Skip to content

Add non-interactive mode to claude-search CLI#45

Open
MaxGhenis wants to merge 1 commit into
ZeroSumQuant:mainfrom
MaxGhenis:feature/non-interactive-search
Open

Add non-interactive mode to claude-search CLI#45
MaxGhenis wants to merge 1 commit into
ZeroSumQuant:mainfrom
MaxGhenis:feature/non-interactive-search

Conversation

@MaxGhenis
Copy link
Copy Markdown

Summary

  • Adds --no-interactive / -n flag to claude-search that prints results and exits without the V/E/Q interactive prompt
  • Adds --help / -h with proper usage info (via argparse)
  • Adds --max-results / -m flag (was hardcoded to 20)
  • Replaces manual sys.argv parsing with argparse
  • Preserves existing interactive behavior when no flags are given

Motivation

claude-search currently hangs in non-interactive contexts because input() blocks waiting for stdin:

  • Claude Code sessions — running claude-search from within Claude Code's Bash tool hangs on the V/E/Q prompt
  • Piped/scripted contexts — e.g. claude-search "query" | head
  • CI/automation workflows

Closes #44

Test plan

  • 15 new tests in tests/test_search_cli.py covering:
    • Argument parsing (parse_args)
    • --no-interactive skips input() calls
    • --no-interactive still prints results
    • --max-results forwarded to searcher
    • --help prints usage and exits
    • Interactive mode preserved without flags
  • All 15 tests passing
  • flake8 clean (no new lint issues)
  • Existing tests unaffected

Usage

# Non-interactive (safe for scripts/Claude Code):
claude-search -n "Rules Foundation"
claude-search --no-interactive --max-results 5 "query"

# Interactive (existing behavior, unchanged):
claude-search "query"

🤖 Generated with Claude Code

Add --no-interactive/-n flag that prints results and exits without
the V/E/Q interactive prompt, making claude-search usable in piped,
scripted, and Claude Code session contexts. Also adds --help/-h and
--max-results/-m flags via argparse.

Closes ZeroSumQuant#44

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add non-interactive mode to claude-search CLI

1 participant