feat(cli): fetch issue by number directly from GitHub (#17)#45
feat(cli): fetch issue by number directly from GitHub (#17)#45mahsumaktas wants to merge 1 commit intosimiligh:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds direct GitHub issue fetch to the Changes
Sequence DiagramsequenceDiagram
participant User as CLI User
participant Cmd as Process Command
participant Resolver as resolveIssueRepo
participant Auth as Token Resolver
participant GitHub as GitHub API
participant Converter as githubIssueToPipelineIssue
participant Pipeline as Pipeline
User->>Cmd: run `process` with --number
Cmd->>Resolver: determine org/repo from flags/env
Resolver-->>Cmd: org, repo (or error)
Cmd->>Auth: read TRANSFER_TOKEN / GITHUB_TOKEN
Auth-->>Cmd: token (or error)
Cmd->>GitHub: GET /repos/{org}/{repo}/issues/{number} (auth)
GitHub-->>Cmd: GitHub Issue payload
Cmd->>Converter: map GitHub issue -> pipeline.Issue
Converter-->>Cmd: pipeline.Issue
Cmd->>Pipeline: submit pipeline.Issue for processing
Pipeline-->>User: result / error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@cmd/simili/commands/process.go`:
- Around line 139-148: The override logic in the function updating issue
(variables issue, orgName, repoName, issueNum) ignores a slash-formatted --repo
(owner/name); update the block that applies overrides so that when repoName
contains a "/" you parse it (e.g., split on "/" into owner and repo) and set
issue.Org and issue.Repo accordingly, while still letting explicit --org
override the owner; alternatively, if you prefer not to auto-parse, emit a clear
warning via the same logger when --issue is used together with a slash-formatted
--repo to avoid silent ignoring.
| // Apply optional overrides when --issue is used | ||
| if orgName != "" { | ||
| issue.Org = orgName | ||
| } | ||
| if repoName != "" && !strings.Contains(repoName, "/") { | ||
| issue.Repo = repoName | ||
| } | ||
| if issueNum != 0 { | ||
| issue.Number = issueNum | ||
| } |
There was a problem hiding this comment.
--repo owner/name is silently ignored when combined with --issue.
When --issue is provided along with --repo owner/name (containing a slash), neither the org nor repo from the slash-formatted value are applied because:
- Line 140-142 only sets
issue.Orgfrom--org, not from--repo owner/name - Line 143-145 explicitly skips setting
issue.RepowhenrepoNamecontains "/"
This may cause user confusion. Consider either parsing --repo owner/name here as well, or logging a warning when this combination is detected.
Suggested fix to parse `--repo owner/name` consistently
// Apply optional overrides when --issue is used
- if orgName != "" {
- issue.Org = orgName
- }
- if repoName != "" && !strings.Contains(repoName, "/") {
- issue.Repo = repoName
- }
+ if repoName != "" && strings.Contains(repoName, "/") {
+ parts := strings.SplitN(repoName, "/", 2)
+ if len(parts) == 2 {
+ issue.Org = strings.TrimSpace(parts[0])
+ issue.Repo = strings.TrimSpace(parts[1])
+ }
+ } else {
+ if orgName != "" {
+ issue.Org = orgName
+ }
+ if repoName != "" {
+ issue.Repo = repoName
+ }
+ }🤖 Prompt for AI Agents
In `@cmd/simili/commands/process.go` around lines 139 - 148, The override logic in
the function updating issue (variables issue, orgName, repoName, issueNum)
ignores a slash-formatted --repo (owner/name); update the block that applies
overrides so that when repoName contains a "/" you parse it (e.g., split on "/"
into owner and repo) and set issue.Org and issue.Repo accordingly, while still
letting explicit --org override the owner; alternatively, if you prefer not to
auto-parse, emit a clear warning via the same logger when --issue is used
together with a slash-formatted --repo to avoid silent ignoring.
Signed-off-by: Mahsum Aktas <mahsum@mahsumaktas.com>
0835c1e to
eead182
Compare
|
Friendly ping! 👋 This has been ready for review. Let me know if any changes are needed. |
Summary
Implements #17 — adds support for fetching issues directly from GitHub by number, eliminating the need for a local JSON file.
Usage
The existing
--issue <file>path continues to work as before.Changes
cmd/simili/commands/process.go--issueis not provided but--numberis, fetches the issue viagithub.Client.GetIssue()resolveIssueRepo()— resolves org/repo from:--repo owner/name(preferred)--org+--reposeparatelyGITHUB_REPOSITORYenv var fallbackgithubIssueToPipelineIssue()— converts*github.Issuetopipeline.Issuewith proper field mappingEventType: "issues",EventAction: "opened"for directly fetched issuesGITHUB_REPOSITORYparsing (replaced withstrings.SplitN)cmd/simili/commands/process_test.goTestGithubIssueToPipelineIssue— full conversion with all fieldsTestGithubIssueToPipelineIssue_NilIssue— nil safetyValidation
Notes
GITHUB_TOKEN(orTRANSFER_TOKEN) for authentication — same as existing GitHub client usagego-github/v60package--issue <file>usersSummary by CodeRabbit
New Features
Documentation
Tests