feat: add zeabur service search-repo command#233
Conversation
Expose Git repository search as a standalone non-interactive command, so the skilled agent can search repos via bash without interactive mode. DES-534 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds a new Cobra CLI subcommand ChangesSearch repository CLI
Sequence DiagramsequenceDiagram
participant User
participant CLI as "service search-repo"
participant Prompter as "Prompter (f.Prompter)"
participant API as "ApiClient.SearchGitRepositories"
participant Output
User->>CLI: run `search-repo [keyword]?`
alt no keyword and interactive
CLI->>Prompter: prompt for keyword
Prompter-->>CLI: returns keyword
end
CLI->>API: SearchGitRepositories(ctx, keyword)
API-->>CLI: repos / error
alt error
CLI->>Output: print wrapped error
else no repos
CLI->>Output: print JSON [] or "No repositories found" message
else repos
CLI->>Output: print JSON or lines "owner/name (ID: N)"
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/cmd/service/search-repo/search_repo.go (1)
57-59: ⚡ Quick winPrefer
f.Printerfor plaintext output consistency.At Line 57-59, direct
fmt.Printfbypasses the shared printer abstraction used in this command (f.Printer.JSON) and reduces output consistency/testability across commands.Proposed patch
- for _, repo := range repos { - fmt.Printf("%s/%s (ID: %d)\n", repo.Owner, repo.Name, repo.ID) - } + rows := make([][]string, 0, len(repos)) + for _, repo := range repos { + rows = append(rows, []string{ + fmt.Sprintf("%s/%s", repo.Owner, repo.Name), + fmt.Sprintf("%d", repo.ID), + }) + } + f.Printer.Table([]string{"Repository", "ID"}, rows)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/cmd/service/search-repo/search_repo.go` around lines 57 - 59, Replace the direct use of fmt.Printf in the repository loop with the command's shared printer to keep output consistent and testable: in the loop that iterates over repos (the block using fmt.Printf("%s/%s (ID: %d)\n", repo.Owner, repo.Name, repo.ID)), call the printer on f (e.g., f.Printer.Printf or f.Printer.Println with the same formatted string) so plaintext output goes through the same abstraction used by f.Printer.JSON.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/cmd/service/search-repo/search_repo.go`:
- Around line 29-38: The prompt handling for keyword in SearchGitRepositories
currently accepts empty/whitespace input; after calling f.Prompter.Input("Enter
search keyword:", "") you should trim whitespace from the returned k (e.g.,
strings.TrimSpace) and validate it is non-empty; if it is empty, return the same
error used for non-interactive flow (fmt.Errorf("keyword is required")) or
re-prompt as desired so blank input cannot proceed to SearchGitRepositories.
Update the block around f.Prompter.Input in search_repo.go to perform this
trim-and-check on k before assigning to keyword.
---
Nitpick comments:
In `@internal/cmd/service/search-repo/search_repo.go`:
- Around line 57-59: Replace the direct use of fmt.Printf in the repository loop
with the command's shared printer to keep output consistent and testable: in the
loop that iterates over repos (the block using fmt.Printf("%s/%s (ID: %d)\n",
repo.Owner, repo.Name, repo.ID)), call the printer on f (e.g., f.Printer.Printf
or f.Printer.Println with the same formatted string) so plaintext output goes
through the same abstraction used by f.Printer.JSON.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b6ab0015-0ee9-467c-afce-0f4f1d134657
📒 Files selected for processing (2)
internal/cmd/service/search-repo/search_repo.gointernal/cmd/service/service.go
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidated Review SummaryReviewed by 4 parties (CodeRabbit + 3 internal reviewers + AI agent).
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Fixed: positional keyword arg is now trimmed via |
Expose Git repository search as a standalone non-interactive command, so the skilled agent can search repos via bash without interactive mode.
DES-534
Description (required)
Related issues & labels (optional)
Need help on this PR? Tag
@codesmithwith what you need.Summary by CodeRabbit