Repository navigation
[Spec 589] Support non-GitHub repositories via forge concept commands - #593
waleedkadous merged 17 commits into
Conversation
|
Excellent implementation! Thank you so much for doing this. I would like to see 3 changes. 1. Provider PresetsUsers shouldn't have to manually configure 15 commands. Add built-in presets for common forges: {
"forge": {
"provider": "gitlab"
}
}Resolution order: manual concept override > provider preset > default (github) Add at least one, but perhaps:
Each preset maps all 15 concepts to the equivalent CLI commands. Concepts that don't have an equivalent on that platform should be Users can still override individual concepts on top of a preset: {
"forge": {
"provider": "gitlab",
"issue-comment": "my-custom-script $CODEV_ISSUE_ID"
}
}Update 2. Skill FileCreate
The anthropic official skill builder available on anthropic's skill github repo should help. 3. Address Deferred ItemsThe review lists two deferred follow-up items. Address them now:
|
Architect Integration ReviewVerdict: REQUEST_CHANGES Solid forge abstraction architecture. The concept command pattern is clean, well-tested, and backward compatible. However, the integration review found gaps that undermine the spec's first success criterion ("all GitHub-calling code paths go through concept commands"). Must-Fix
Should-Fix
Notes
Architect integration review (Claude) |
|
Closing — PR was incorrectly targeted at cluesmith/codev. Recreating against nharward/codev. |
|
If I can be blunt, why? We'd be happy to have it upstreamed to us (espcially with the minor fixes above, but even so, I'm happy to make the minor fixes). Less maintenance work for you in future. |
Concept command architecture: configurable external commands with JSON contracts for each forge operation, defaulting to `gh`. Enables any forge via user-provided commands without codev code changes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ispatcher Introduce the concept command architecture for decoupling codev from direct gh CLI calls. Each forge operation becomes a configurable command with a JSON output contract. - New lib/forge.ts: async/sync dispatcher, config loading, validation - 15 default gh-based concept commands defined - UserConfig type extended with forge section for af-config.json - 26 unit tests covering resolution, execution, and validation Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add forge-contracts.ts with TypeScript interfaces for all concept outputs - Fix duplicate config loading: accept ForgeConfig directly in options - Fix recently-closed/recently-merged defaults to use $CODEV_SINCE_DATE - Rewrite tests with mock shell scripts for deterministic execution testing - 40 tests covering JSON parsing, env vars, non-zero exit, raw mode, config loading Co-Authored-By: Claude Opus 4.6 <[email protected]>
…orge concepts Refactor 7 functions in github.ts to route through executeForgeCommand: - fetchGitHubIssue → issue-view concept (now accepts string|number) - fetchPRList → pr-list concept - fetchIssueList → issue-list concept - fetchRecentlyClosed → recently-closed concept - fetchRecentMergedPRs → recently-merged concept - fetchMergedPRs → recently-merged concept (with CODEV_SINCE_DATE) - fetchClosedIssues → recently-closed concept (with CODEV_SINCE_DATE) fetchOnItTimestamps left on direct gh calls (Phase 4). parseLinkedIssue/parseLabelDefaults unchanged (not forge operations). Updated analytics tests to mock forge module instead of execFile. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…thub.test.ts Address review feedback: add mock-based tests verifying correct concept command routing for fetchGitHubIssue, fetchPRList, fetchIssueList, fetchRecentlyClosed, fetchRecentMergedPRs, and forgeConfig threading. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…cepts - spawn-worktree.ts: PR collision detection uses pr-search concept, issue commenting uses issue-comment concept, graceful degradation when concepts unavailable - spawn.ts: Legacy issue comment fallback uses issue-comment concept - cleanup.ts: PR merge/open status check uses pr-search concept - Tests updated to mock executeForgeCommand instead of shell.run Co-Authored-By: Claude Opus 4.6 <[email protected]>
…stamps to forge concept - fetchOnItTimestamps now routes through on-it-timestamps concept command - Default path: builds GraphQL query, passes via CODEV_GRAPHQL_QUERY with CODEV_REPO_OWNER/CODEV_REPO_NAME env vars - Custom forge path: accepts CODEV_ISSUE_NUMBERS, returns simple JSON map - Updated default command to include -f owner/name GraphQL variable params - Analytics tests updated to mock executeForgeCommand instead of execFile - Added tests for custom forge config and disabled concept scenarios Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ough forge concept
- checks.ts: Intercept pr_exists check to route through executeForgeCommand
instead of running raw protocol.json command. Gets branch via git, passes
CODEV_BRANCH_NAME to pr-exists concept. Other checks pass through unchanged.
- next.ts: Merge instructions use getForgeCommand('pr-merge') to show the
configured merge command instead of hardcoded 'gh pr merge --merge'.
- Protocol JSON files unchanged (interception is transparent).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
…forge concepts Route remaining gh CLI calls through forge concept commands: - team.ts: user-identity concept for detectAuthor - consult/index.ts: pr-view, pr-diff, pr-search concepts - doctor.ts: gh-auth-status concept (conditional on forge config) - team-github.ts: team-activity concept with forgeConfig param - Add forge.js mocks to consult.test.ts and doctor.test.ts Co-Authored-By: Claude Opus 4.6 <[email protected]>
…gh porch Address review feedback: pass workspaceRoot to executeForgeCommand in runPrExistsViaConcept and loadForgeConfig for pr-merge instructions, so user-configured forge overrides in af-config.json are respected. Also use static imports instead of dynamic for child_process/util. Co-Authored-By: Claude Opus 4.6 <[email protected]>
- getRepoInfo: derive owner/name from git remote URL instead of gh CLI - consult: replace direct gh pr view --comments with pr-view concept - pr-view default: conditional on CODEV_INCLUDE_COMMENTS for comments - doctor: integrate validateForgeConfig to report forge concept status Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ned.md - Review document with spec compliance, deviations, consultation feedback - arch.md: new Forge Concept Commands section under External Services - lessons-learned.md: concept command abstraction and config threading Co-Authored-By: Claude Opus 4.6 <[email protected]>
Owner requests: - Add provider presets (gitlab via glab, gitea via tea) with resolution order: manual override > provider preset > default (github) - Create forge skill file (.claude/skills/forge/SKILL.md) - Create user documentation (codev/resources/commands/forge.md) with worked examples for GitLab and Gitea - Add graceful degradation tests (command not found returns null) Architect must-fix: - team-update.ts: replace direct gh pr list with recently-merged concept - github.ts: replace gh repo view with getRepoInfo (git remote) - resolveForgeConfig: default workspaceRoot to cwd so forge config auto-loads from all call sites - recently-merged: handle null CODEV_SINCE_DATE gracefully Architect should-fix: - validateForgeConfig: report provider status - doctor.ts: show provider in forge validation output - Provider preset tests (7 new) and degradation tests (3 new) - Update analytics test mocks for git remote instead of gh repo view Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Architect Integration ReviewReviewers: Claude (integration), Explore agent (code audit). Gemini/Codex failed due to E2BIG (200KB diff exceeded process arg limit). Verdict: REQUEST_CHANGES (minor fixes before merge)Must Fix
Should Fix (non-blocking)
Verified Good
Notes for Follow-up
Architect integration review |
…, pr-diff Address 4 must-fix items from architect integration review: 1. Thread forgeConfig through spawnBugfix fallback "On it!" comment 2. Add null-date handling to recently-closed default command 3. Add CODEV_DIFF_NAME_ONLY conditional to pr-diff default command 4. Handle null pr-merge in next.ts merge instruction rendering Also thread forgeConfig through spawnSpec issue fetching for consistency. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Re-Review: All Fixes VerifiedAll 4 must-fix items confirmed resolved:
Approved. Please merge (regular merge, no squash). Architect integration review |
TL;DR - not intended at all. This was learning curve on my part; I cloned my fork but |
@waleedkadous I thought about this, in the moment preferring user documentation and/or contrib code vs. making it part of the Unrelated: I thought I would be impressed by |
|
I think an important consideration is the blast radius ones: if there's a bug in one CLI, it's unlikely it takes out all of the So let's do it! Once you're done, let me know and I'll do the merge. |
|
@waleedkadous — All 3 items from your review have been addressed in the current branch: 1. Provider Presets ✓
2. Skill File ✓
3. Deferred Items ✓
Architect review |
Architect Integration Review (3-way CMAP)Excellent work on the forge abstraction, Nat! The architecture is solid — 3-tier resolution, clean config model, thorough migration of all I would like to see 5 changes before we merge: 1.
|
1. codev doctor: full concept reporting — iterates all 15 concepts, shows resolution source (preset/override/default), checks executable availability. Moved gh hard-requirement inside GitHub-only block. 2. parseOutput(): returns null on JSON parse failure when raw=false, preventing downstream cast errors. Callers expecting plain text (user-identity) now pass raw: true explicitly. 3. Increased default --limit from 50 to 1000 for recently-merged and recently-closed concepts across all provider presets (gh, glab, tea). 4. Added maxBuffer support to executeForgeCommand/Sync with 10MB default, preventing truncation for large PR diffs. 5. Documented provider presets (gitlab, gitea) as best-effort in forge-contracts.ts, forge.ts, docs, and skill file.
Address waleedkadous review comments and architect follow-up items:
1. Rename `gh-auth-status` → `auth-status` (provider-agnostic concept name)
2. Generalize GitHub-specific types: GitHubIssue → ForgeIssue, GitHubPR → ForgePR,
GitHubIssueListItem → ForgeIssueListItem (with deprecated aliases)
3. Wire forge-contracts.ts types (IssueViewResult, PrListItem, IssueListItem)
into consumers via github.ts re-exports — prevents contract drift
4. Extract all 15 inline shell one-liners to on-disk scripts at
scripts/forge/{github,gitlab,gitea}/<concept>.sh — readable, testable,
customizable independently of TypeScript code
5. Update DEFAULT_COMMANDS and PROVIDER_PRESETS to resolve lazily from
script paths instead of hardcoded strings
6. Update extractExecutable() to parse script files for doctor diagnostics
7. Update all tests and documentation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The forge PR (#593) moved gh behind the concept layer, so doctor no longer lists "gh" as a named dependency. Update E2E test to check for "Claude" (AI CLI section) instead. Also: architect role cleanup step now includes closing GitHub issues.
Summary
Introduces a "forge concept command" abstraction layer that decouples codev from direct
ghCLI calls. Each GitHub operation is now routed through configurable external commands with JSON output contracts.issue-view,pr-list,issue-list,issue-comment,pr-exists,recently-closed,recently-merged,user-identity,team-activity,on-it-timestamps,pr-merge,pr-search,pr-view,pr-diff,gh-auth-statusghfor backward compatibilityaf-config.jsonforgesectioncodev doctorvalidates forge concept configurationChanges
src/lib/forge.ts— concept command dispatcher with async/sync variantssrc/lib/forge-contracts.ts— TypeScript interfaces for concept JSON contractssrc/lib/github.ts— 7 functions migrated to forge conceptssrc/agent-farm/commands/spawn-worktree.ts— PR search, issue comments via forgesrc/agent-farm/commands/spawn.ts— issue comment via forgesrc/agent-farm/commands/cleanup.ts— PR search via forgesrc/commands/porch/checks.ts—pr_existscheck intercepted via forgesrc/commands/porch/next.ts— merge instructions via forgesrc/commands/consult/index.ts— PR view/diff/search via forgesrc/commands/doctor.ts— conditional gh auth, forge validationsrc/agent-farm/commands/team.ts— user identity via forgesrc/lib/team-github.ts— team activity via forge, getRepoInfo via git remoteTesting
Spec
Link: codev/specs/589-non-github-repository-support.md
Review
Link: codev/reviews/589-non-github-repository-support.md