feat: US-04-05 CLI Search Command#28
Merged
Merged
Conversation
- Add IngestCommand in io.megabrain.cli with @command(name = "ingest") - Add MegaBrainCommand as @topcommand with ingest subcommand - IngestCommandTest: command name, --help, no-args run - Docs: api-reference, cli-reference, getting-started, implemented-features Resolves T1: US-04-04 CLI Ingest Command Made-with: Cursor
- Add --source, --repo, --branch, --token, --incremental with validation - Reuse IngestionResource.SourceType; validate source and repo non-blank - Extend IngestCommandTest for options, defaults, help, validation - Update cli-reference, api-reference, implemented-features Resolves T2: US-04-04 CLI Ingest Command Made-with: Cursor
- Inject IngestionService into IngestCommand; subscribe to Multi<ProgressEvent> - Single-line \r updates for TTY, line-by-line for non-TTY; cap message length - Tests: mock IngestionService, assert progress messages and full/incremental routing - Docs: cli-reference progress subsection, api-reference, implemented-features T3 Resolves T3: US-04-04 CLI Ingest Command Made-with: Cursor
- @command(exitCodeOnInvalidInput=2, exitCodeOnExecutionException=1) - Throw ExecutionException on ingestion failure; ParameterException for invalid args - Tests: assert execute() returns 0, 1, 2 for success, failure, invalid args - Docs: cli-reference exit codes subsection, implemented-features Resolves T4: US-04-04 CLI Ingest Command Made-with: Cursor
- Add --verbose option; set io.megabrain logger to DEBUG when true - Fuller progress and stack traces on errors when verbose - Tests: help contains --verbose; optional verbose behavior - Docs: cli-reference options and Verbose subsection, implemented-features Resolves T5: US-04-04 CLI Ingest Command Made-with: Cursor
- Step 1: Parse task file; stop if all completed - Step 2: Create feature branch (git checkout -b feature/<story-slug>) - Steps 3-4: Per-task council/implement/commit, then full test suite - Step 5: Commit any remaining changes, push branch, gh pr create Documents exact gh commands: gh pr create --title/--body or --fill. Prerequisite: gh installed and authenticated (gh auth status). Made-with: Cursor
- Token never in output; repo trim; exit-code spec; branch default in help - Non-verbose truncation; null progress message; missing --repo exit 2 - MegaBrainCommand help test; io.megabrain.cli >80% coverage (84% line, 80% branch) - Docs: implemented-features Done, development-guide CLI testing note Resolves T6: US-04-04 CLI Ingest Command Made-with: Cursor
- SearchCommand with @command(name = "search"), query @parameters, help mixin - Register SearchCommand in MegaBrainCommand subcommands - SearchCommandTest: command name, --help, query parsing, blank query exit 2 - docs: cli-reference megabrain search, getting-started, implemented-features US-04-05 Resolves T1: Create SearchCommand Picocli class Made-with: Cursor
- --language, --repo, --type (repeatable), --limit (default 10), --json, --quiet - Validate language and entity_type against allowed sets; limit 1-100 - Build SearchRequest in run(); ParameterException for invalid options - SearchCommandTest: option parsing, defaults, multi-value, validation, help - docs: cli-reference options table and examples, implemented-features T2 Resolves T2: Add filter options Made-with: Cursor
- SearchResultMapper (MergedResult -> SearchResult) shared by SearchResource and CLI - SearchResultFormatter interface and HumanReadableSearchResultFormatter - Format: File, Entity, Score, snippet, ---; truncation; quiet one-line per result - SearchCommand injects SearchOrchestrator, formatter, config; runs search and prints formatted output - SearchResultFormatterTest and SearchCommandTest updates - docs: cli-reference format description, implemented-features T3 Resolves T3: Implement result formatting Made-with: Cursor
- Jansi dependency; SyntaxHighlighter interface and CliSyntaxHighlighter (Java, Python, JS, TS) - HumanReadableSearchResultFormatter uses highlighter; format(response, quiet, useColor) - SearchCommand --no-color; resolve useColor (NO_COLOR env, TTY) - CliSyntaxHighlighterTest, SearchResultFormatterTest, SearchCommandTest updates - docs: cli-reference --no-color and highlighting, implemented-features T4 Resolves T4: Add syntax highlighting Made-with: Cursor
- Inject ObjectMapper; when --json serialize SearchResponse or results only (--quiet) - Pretty when TTY and not quiet; compact otherwise; write to getOut() and flush - SearchCommandTest: full JSON shape, --json --quiet array, empty results - docs: cli-reference JSON subsection, implemented-features T5, getting-started --json Resolves T5: Add JSON output mode Made-with: Cursor
- Orchestrator failure, JSON null ObjectMapper, JSON serialization failure - NO_COLOR env (SystemStubs), filter normalization, --quiet human-readable - JSON with facets; CaptureUseColorFormatter lastQuiet - implemented-features US-04-05 Done, T6 completed, >80% coverage Resolves T6: Write command tests Made-with: Cursor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Implements all tasks from US-04-05-cli-search-command-tasks.md.
Resolves US-04-05.
Made with Cursor