feat(wiki): add Cursor CLI as LLM provider option#381
Conversation
|
@cnighut is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
63831dc to
f24ce66
Compare
|
@claude suggest e2e tests for these new flags, check for redundancies in the incoming branch for the flags |
|
Claude finished @zander-raycraft's task in 2m 10s —— View job Analysis: E2E Tests & Flag Redundancies for PR #381
Redundancies Found1.
|
CI Report✅ All checks passed Pipeline
Tests
✅ All 3697 tests passed across 1070 files 20 test(s) skipped
Coverage
📋 Full run · Coverage from Ubuntu · Generated by CI |
|
@zander-raycraft I have added the relevant tests. Could you please check now? Sorry for the delay btw. |
fd82657 to
b98f66d
Compare
CI Report✅ All checks passed Pipeline Status
Test Results
✅ All 4154 tests passed 1 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
|
@claude check to verify all the e2e tests are integrated and passing, deep think on the pr scanning for any discrepancies and recommend status for merging |
|
Claude finished @zander-raycraft's task in 2m 5s —— View job PR #381 — E2E Test Verification & Merge Readiness Review
E2E & Unit Test Coverage — What's There
|
| Test | File | Notes |
|---|---|---|
callCursorLLM throws when CLI not in PATH |
wiki-flags.test.ts:424 |
✅ Unit |
Routes to callCursorLLM when provider=cursor |
wiki-flags.test.ts:347 |
✅ Unit |
| No API key prompt in non-TTY with cursor | cli-e2e.test.ts:293 |
✅ E2E |
Config saves cursorModel (not model) |
wiki-flags.test.ts:288 |
✅ Unit (config roundtrip) |
detectCursorCLI result cached after first call |
wiki-flags.test.ts:27 |
✅ Unit — redundancy from prior review is fixed |
--review
| Test | File | Notes |
|---|---|---|
reviewOnly returns pagesGenerated=0 + moduleTree |
wiki-flags.test.ts:199 |
✅ Unit |
module_tree.json written in review mode |
wiki-flags.test.ts:265 |
✅ Unit |
--review flag in help text |
cli-e2e.test.ts:238 |
✅ E2E |
| Interactive n/Y/edit flow | — | ❌ Not tested (requires TTY simulation) |
--verbose
| Test | File | Notes |
|---|---|---|
GITNEXUS_VERBOSE=1 env var set |
wiki-flags.test.ts:166 |
✅ Unit (env var check only) |
GITNEXUS_VERBOSE unset when flag absent |
wiki-flags.test.ts:178 |
✅ Unit |
--verbose in help text |
cli-index-help.test.ts:46 |
✅ Unit |
| E2E: flag actually sets env var in spawned process | — | ❌ Missing — see note below |
Discrepancies Found
1. Misleading --verbose E2E test name (cli-e2e.test.ts:308)
it('wiki --verbose sets GITNEXUS_VERBOSE env', () => {
// But actually just runs `wiki --help` — never exercises the flag itself
const result = runCliRaw(['wiki', '--help'], repoRoot);
expect(result.stdout).toMatch(/verbose/i);
});The test is named "wiki --verbose sets GITNEXUS_VERBOSE env" but only checks that --verbose appears in help output. The actual env-var behavior (setting GITNEXUS_VERBOSE=1) is only verified in the unit test via direct env inspection — not through a spawned CLI process. This is a naming/coverage issue, not a functional bug.
2. --review has no non-TTY guard (wiki.ts:343)
The interactive setup at line 157 has process.stdin.isTTY guard, but the review prompt at line 343 does not:
// wiki.ts:343 — No TTY check before readline prompt
const answer = await prompt(' Continue with generation? (Y/n/edit): ');If --review is passed in a non-TTY environment (CI, piped stdin), the readline prompt could hang indefinitely waiting for input. This was flagged in the prior Claude comment and remains unaddressed.
3. Two unrelated debug env-vars still present (wiki.ts:87 vs wiki.ts:468)
// --verbose sets GITNEXUS_VERBOSE (line 87)
if (options?.verbose) { process.env.GITNEXUS_VERBOSE = '1'; }
// But error stack traces gate on a different var (line 468)
if (process.env.DEBUG) { console.error(err); }--verbose does not enable DEBUG, so verbose users won't see stack traces on errors. The previous review flagged this and it remains unresolved. Low severity, but creates a confusing split between two debug mechanisms.
4. --review progress bar restart (wiki.ts:311 and wiki.ts:368)
bar.stop(); // line 311 — stopped during review pause
// ... user interaction ...
bar.start(100, 30, { phase: 'Generating pages...' }); // line 368 — restartedcliProgress documents that calling start() on a stopped bar is supported, but this flow is unintuitive and could cause display artifacts in some terminal environments. Minor cosmetic issue.
5. Coverage regression
CI reports a small regression vs main:
- Statements: -0.4% | Branches: -0.3% | Lines: -0.5%
This is expected given the new code is primarily Cursor CLI interaction (TTY-dependent, LLM-dependent), which is genuinely hard to cover without an agent binary or full TTY simulation. Not a blocker.
What Was Fixed vs Prior Review
The prior Claude comment identified 4 redundancies. Status:
| Issue | Status |
|---|---|
detectCursorCLI() called on every LLM invocation |
✅ Fixed — module-level cache added (cursor-client.ts:28) |
| Two verbose/debug env-var mechanisms | |
Config written then re-read via resolveLLMConfig |
|
WikiOptions doesn't carry verbose |
The most important fix (the caching redundancy that caused N extra execSync forks per wiki page) has been addressed. The remaining items are lower-priority style/design concerns.
Merge Recommendation
✅ APPROVE — Ready to merge with minor follow-ups
The PR is in good shape:
- All 4096 tests pass across 3 platforms (Ubuntu, Windows, macOS)
- The critical
detectCursorCLIcaching redundancy from the prior review is fixed - Core functionality (cursor provider routing, reviewOnly mode, verbose mode) is well-tested at unit level
- CLI flags are properly registered and appear correctly in help text
- Incremental update with divergent branch detection (
isCommitReachable) is a solid defensive fix - DB idle timeout prevention during long LLM calls is correct
- Slug collision fix for subDir paths prevents wiki page overwrites
Suggested follow-ups (not blocking):
- Add a
process.stdin.isTTYguard before the--reviewprompt atwiki.ts:343to prevent CI hangs - Rename the misleading
--verbosee2e test to reflect what it actually tests - Optionally unify the two debug env vars (
GITNEXUS_VERBOSE/DEBUG) in a future cleanup
Add Cursor headless CLI as a 4th provider option for wiki generation, allowing users to leverage their Cursor subscription for wiki pages. - Add --provider cursor flag and cursor-client.ts - Add --review flag for interactive module tree editing - Add --verbose flag for debugging - Improve module tree generation (flatten single-child, unique slugs) - Prevent DB timeout during long LLM calls Usage: gitnexus wiki --provider cursor --model claude-4.5-opus-high Made-with: Cursor
- Cache detectCursorCLI() result to avoid spawning `agent --version` on every LLM call - Fix stale JSDoc in cursor-client.ts (no longer uses stdin or stream-json) - Remove unused WikiOptions fields (model, baseUrl, apiKey) that were passed but never read by WikiGenerator - Fix inconsistent progress callback phase tracking in --review continuation path - Add wiki CLI help test covering --provider, --review, --verbose flags Made-with: Cursor
…ose) 17 tests covering: - detectCursorCLI caching (avoids repeated spawns) - resolveCursorConfig defaults - resolveLLMConfig provider routing (cursor vs openai) - --verbose env var propagation - WikiGenerator reviewOnly mode (early return with moduleTree) - CLI config round-trip for cursor and openai providers - invokeLLM dispatch (cursor → callCursorLLM, openai → callLLM) - callCursorLLM error when CLI not found - estimateTokens heuristic Made-with: Cursor
Spawn actual CLI process to verify: - wiki --help surfaces all new flags - wiki on non-git directory exits with code 1 - wiki on non-indexed repo fails with "No GitNexus index" - --provider cursor skips API key prompt in non-TTY mode - --verbose is accepted as valid flag Made-with: Cursor
Made-with: Cursor
- Add process.stdin.isTTY guard before --review prompt to prevent CI hangs - Rename misleading --verbose e2e test to reflect it checks help output - Replace DEBUG with GITNEXUS_VERBOSE for error stack traces Made-with: Cursor
4d645e4 to
048347d
Compare
|
@zander-raycraft I have fixed the minor follow ups too. |
|
Thank you for your contributions and for the support fix!! @cnighut |
Summary
Add Cursor headless CLI as a 4th provider option for wiki generation, allowing users to leverage their Cursor subscription for generating wiki pages.
The mcp created using gitnexus setup and analyse can now be used for wiki too!
New Features
--provider cursor- Use Cursor CLI instead of OpenAI API--review- Interactive module tree review before generation (edit structure, then continue)--verbose- Debug logging for Cursor CLI interactionsagentbinary in PATHImprovements
Usage
Test Plan
--reviewworkflow allows editing module_tree.json--verboseshows Cursor CLI spawn info and output