Skip to content

feat(cli): fetch issue by number directly from GitHub (#17)#45

Open
mahsumaktas wants to merge 1 commit intosimiligh:mainfrom
mahsumaktas:feat/cli-fetch-issue-17
Open

feat(cli): fetch issue by number directly from GitHub (#17)#45
mahsumaktas wants to merge 1 commit intosimiligh:mainfrom
mahsumaktas:feat/cli-fetch-issue-17

Conversation

@mahsumaktas
Copy link
Contributor

@mahsumaktas mahsumaktas commented Feb 13, 2026

Summary

Implements #17 — adds support for fetching issues directly from GitHub by number, eliminating the need for a local JSON file.

Usage

# Fetch and process issue #17 from similigh/simili-bot
simili process --repo similigh/simili-bot --number 17

# Using separate --org and --repo flags
simili process --org similigh --repo simili-bot --number 17

# Using GITHUB_REPOSITORY env var (CI-friendly)
export GITHUB_REPOSITORY=similigh/simili-bot
simili process --number 17

The existing --issue <file> path continues to work as before.

Changes

cmd/simili/commands/process.go

  • New flow: When --issue is not provided but --number is, fetches the issue via github.Client.GetIssue()
  • resolveIssueRepo() — resolves org/repo from:
    1. --repo owner/name (preferred)
    2. --org + --repo separately
    3. GITHUB_REPOSITORY env var fallback
  • githubIssueToPipelineIssue() — converts *github.Issue to pipeline.Issue with proper field mapping
    • Sets EventType: "issues", EventAction: "opened" for directly fetched issues
    • Safely handles nil fields via GitHub API getter methods
  • Updated Long description documenting the new usage patterns
  • Cleaned up the old manual byte-scanning for GITHUB_REPOSITORY parsing (replaced with strings.SplitN)

cmd/simili/commands/process_test.go

  • TestGithubIssueToPipelineIssue — full conversion with all fields
  • TestGithubIssueToPipelineIssue_NilIssue — nil safety

Validation

go build ./...   #
go test ./...    # ✅ all passed

Notes

  • Uses GITHUB_TOKEN (or TRANSFER_TOKEN) for authentication — same as existing GitHub client usage
  • No new dependencies — uses the already-imported go-github/v60 package
  • No breaking changes for existing --issue <file> users

Summary by CodeRabbit

  • New Features

    • Fetch GitHub issues directly by number with --number, deriving org/repo from flags, env, or defaults.
    • Require and accept GitHub auth tokens via environment for authorized API access.
    • Allow overriding issue metadata via --issue, --repo, --org, and --number; clearer error messages for missing inputs/auth.
  • Documentation

    • Updated help text and usage to reflect direct GitHub issue fetching and override options.
  • Tests

    • Added tests validating conversion of GitHub issues into the pipeline format and handling of nil inputs.

@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Adds direct GitHub issue fetch to the process command when --number is supplied: resolves org/repo from flags/env, requires TRANSFER_TOKEN/GITHUB_TOKEN for auth, fetches the issue via GitHub API, converts it into pipeline.Issue, and integrates this path into CLI processing with explicit errors and updated help text.

Changes

Cohort / File(s) Summary
Process command (GitHub integration)
cmd/simili/commands/process.go
Implements fetching a GitHub issue when --number is provided; adds resolveIssueRepo (derive org/repo from flags/env/GITHUB_REPOSITORY), requires TRANSFER_TOKEN/GITHUB_TOKEN for API calls, replaces placeholder fetch with real GitHub API call, converts result via githubIssueToPipelineIssue, updates CLI flags, errors, and help text.
Tests for conversion
cmd/simili/commands/process_test.go
Adds TestGithubIssueToPipelineIssue and TestGithubIssueToPipelineIssue_NilIssue to validate mapping from GitHub issue to pipeline.Issue and default behavior when the input is nil; adds GitHub API import alias used in tests.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped in with a tiny key,
Peeked at issues from the Git tree,
Mapped labels, author, time with cheer,
Sent the payload down the gear,
Hops and bytes — the pipeline's clear!

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (18 files):

⚔️ .env.sample (content)
⚔️ .simili.yaml (content)
⚔️ DOCS/examples/multi-repo/simili.yaml (content)
⚔️ DOCS/examples/single-repo/simili.yaml (content)
⚔️ DOCS/multi-repo-org-setup.md (content)
⚔️ DOCS/single-repo-setup.md (content)
⚔️ Dockerfile (content)
⚔️ README.md (content)
⚔️ cmd/simili-web/main.go (content)
⚔️ cmd/simili/commands/batch.go (content)
⚔️ cmd/simili/commands/index.go (content)
⚔️ cmd/simili/commands/process.go (content)
⚔️ cmd/simili/commands/process_test.go (content)
⚔️ internal/core/config/config.go (content)
⚔️ internal/core/config/config_test.go (content)
⚔️ internal/integrations/gemini/embedder.go (content)
⚔️ internal/integrations/gemini/llm.go (content)
⚔️ internal/steps/indexer.go (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main feature being added: fetching GitHub issues by issue number directly from the GitHub API via CLI flags.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feat/cli-fetch-issue-17
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +139 to +148
// 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
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

--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.Org from --org, not from --repo owner/name
  • Line 143-145 explicitly skips setting issue.Repo when repoName contains "/"

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>
@mahsumaktas mahsumaktas force-pushed the feat/cli-fetch-issue-17 branch from 0835c1e to eead182 Compare February 14, 2026 19:09
@mahsumaktas
Copy link
Contributor Author

Friendly ping! 👋 This has been ready for review. Let me know if any changes are needed.

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.

1 participant