Skip to content

Commit 2874f48

Browse files
committed
✨ feat: update gitn docs to use local run.cjs and paginate list_repos
1 parent 4fcd82c commit 2874f48

7 files changed

Lines changed: 112 additions & 79 deletions

File tree

.claude/skills/gitnexus/gitnexus-cli/SKILL.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ description: "Use when the user needs to run GitNexus CLI commands like analyze/
55

66
# GitNexus CLI Commands
77

8-
All commands work via `npx` — no global install required.
8+
Commands below use `node .gitnexus/run.cjs <command>` — the project-local runner `gitnexus analyze` drops next to the index. It auto-selects an available runner at call time (global `gitnexus`, else `pnpm dlx`, else `npx`), so no package-manager assumption and no global install is required.
9+
10+
> **Not analyzed yet, or `node .gitnexus/run.cjs` reports `Cannot find module`** (the gitignored runner is absent — e.g. a fresh clone or `git clean`)? (Re)generate it with `npx gitnexus analyze` from the project root. On **npm 11.x**, if `npx` crashes during install (`node.target is null`), install once with `npm i -g gitnexus` (then `gitnexus analyze`) or use `pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter dlx gitnexus@latest analyze`. See [#1939](https://github.com/abhigyanpatwari/GitNexus/issues/1939).
911
1012
## Commands
1113

1214
### analyze — Build or refresh the index
1315

1416
```bash
15-
npx gitnexus analyze
17+
node .gitnexus/run.cjs analyze
1618
```
1719

1820
Run from the project root. This parses all source files, builds the knowledge graph, writes it to `.gitnexus/`, and generates CLAUDE.md / AGENTS.md context files.
@@ -28,15 +30,15 @@ Run from the project root. This parses all source files, builds the knowledge gr
2830
### status — Check index freshness
2931

3032
```bash
31-
npx gitnexus status
33+
node .gitnexus/run.cjs status
3234
```
3335

3436
Shows whether the current repo has a GitNexus index, when it was last updated, and symbol/relationship counts. Use this to check if re-indexing is needed.
3537

3638
### clean — Delete the index
3739

3840
```bash
39-
npx gitnexus clean
41+
node .gitnexus/run.cjs clean
4042
```
4143

4244
Deletes the `.gitnexus/` directory and unregisters the repo from the global registry. Use before re-indexing if the index is corrupt or after removing GitNexus from a project.
@@ -49,7 +51,7 @@ Deletes the `.gitnexus/` directory and unregisters the repo from the global regi
4951
### wiki — Generate documentation from the graph
5052

5153
```bash
52-
npx gitnexus wiki
54+
node .gitnexus/run.cjs wiki
5355
```
5456

5557
Generates repository documentation from the knowledge graph using an LLM. Requires an API key (saved to `~/.gitnexus/config.json` on first use).
@@ -66,7 +68,7 @@ Generates repository documentation from the knowledge graph using an LLM. Requir
6668
### list — Show all indexed repos
6769

6870
```bash
69-
npx gitnexus list
71+
node .gitnexus/run.cjs list
7072
```
7173

7274
Lists all repositories registered in `~/.gitnexus/registry.json`. The MCP `list_repos` tool provides the same information.

.claude/skills/gitnexus/gitnexus-debugging/SKILL.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,56 @@ description: "Use when the user is debugging a bug, tracing an error, or asking
1616
## Workflow
1717

1818
```
19-
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
20-
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
19+
1. query({query: "<error or symptom>"}) → Find related execution flows
20+
2. context({name: "<suspect>"}) → See callers/callees/processes
2121
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
22-
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
22+
4. cypher({query: "MATCH path..."}) → Custom traces if needed
2323
```
2424

25-
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
25+
> If "Index is stale" → run `node .gitnexus/run.cjs analyze` in terminal.
2626
2727
## Checklist
2828

2929
```
3030
- [ ] Understand the symptom (error message, unexpected behavior)
31-
- [ ] gitnexus_query for error text or related code
31+
- [ ] query for error text or related code
3232
- [ ] Identify the suspect function from returned processes
33-
- [ ] gitnexus_context to see callers and callees
33+
- [ ] context to see callers and callees
3434
- [ ] Trace execution flow via process resource if applicable
35-
- [ ] gitnexus_cypher for custom call chain traces if needed
35+
- [ ] cypher for custom call chain traces if needed
3636
- [ ] Read source files to confirm root cause
3737
```
3838

3939
## Debugging Patterns
4040

4141
| Symptom | GitNexus Approach |
4242
| -------------------- | ---------------------------------------------------------- |
43-
| Error message | `gitnexus_query` for error text → `context` on throw sites |
43+
| Error message | `query` for error text → `context` on throw sites |
4444
| Wrong return value | `context` on the function → trace callees for data flow |
4545
| Intermittent failure | `context` → look for external calls, async deps |
4646
| Performance issue | `context` → find symbols with many callers (hot paths) |
4747
| Recent regression | `detect_changes` to see what your changes affect |
4848

4949
## Tools
5050

51-
**gitnexus_query** — find code related to error:
51+
**query** — find code related to error:
5252

5353
```
54-
gitnexus_query({query: "payment validation error"})
54+
query({query: "payment validation error"})
5555
→ Processes: CheckoutFlow, ErrorHandling
5656
→ Symbols: validatePayment, handlePaymentError, PaymentException
5757
```
5858

59-
**gitnexus_context** — full context for a suspect:
59+
**context** — full context for a suspect:
6060

6161
```
62-
gitnexus_context({name: "validatePayment"})
62+
context({name: "validatePayment"})
6363
→ Incoming calls: processCheckout, webhookHandler
6464
→ Outgoing calls: verifyCard, fetchRates (external API!)
6565
→ Processes: CheckoutFlow (step 3/7)
6666
```
6767

68-
**gitnexus_cypher** — custom call chain traces:
68+
**cypher** — custom call chain traces:
6969

7070
```cypher
7171
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
@@ -75,11 +75,11 @@ RETURN [n IN nodes(path) | n.name] AS chain
7575
## Example: "Payment endpoint returns 500 intermittently"
7676

7777
```
78-
1. gitnexus_query({query: "payment error handling"})
78+
1. query({query: "payment error handling"})
7979
→ Processes: CheckoutFlow, ErrorHandling
8080
→ Symbols: validatePayment, handlePaymentError
8181
82-
2. gitnexus_context({name: "validatePayment"})
82+
2. context({name: "validatePayment"})
8383
→ Outgoing calls: verifyCard, fetchRates (external API!)
8484
8585
3. READ gitnexus://repo/my-app/process/CheckoutFlow

.claude/skills/gitnexus/gitnexus-exploring/SKILL.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ description: "Use when the user asks how code works, wants to understand archite
1818
```
1919
1. READ gitnexus://repos → Discover indexed repos
2020
2. READ gitnexus://repo/{name}/context → Codebase overview, check staleness
21-
3. gitnexus_query({query: "<what you want to understand>"}) → Find related execution flows
22-
4. gitnexus_context({name: "<symbol>"}) → Deep dive on specific symbol
21+
3. query({query: "<what you want to understand>"}) → Find related execution flows
22+
4. context({name: "<symbol>"}) → Deep dive on specific symbol
2323
5. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow
2424
```
2525

26-
> If step 2 says "Index is stale" → run `npx gitnexus analyze` in terminal.
26+
> If step 2 says "Index is stale" → run `node .gitnexus/run.cjs analyze` in terminal.
2727
2828
## Checklist
2929

3030
```
3131
- [ ] READ gitnexus://repo/{name}/context
32-
- [ ] gitnexus_query for the concept you want to understand
32+
- [ ] query for the concept you want to understand
3333
- [ ] Review returned processes (execution flows)
34-
- [ ] gitnexus_context on key symbols for callers/callees
34+
- [ ] context on key symbols for callers/callees
3535
- [ ] READ process resource for full execution traces
3636
- [ ] Read source files for implementation details
3737
```
@@ -47,18 +47,18 @@ description: "Use when the user asks how code works, wants to understand archite
4747

4848
## Tools
4949

50-
**gitnexus_query** — find execution flows related to a concept:
50+
**query** — find execution flows related to a concept:
5151

5252
```
53-
gitnexus_query({query: "payment processing"})
53+
query({query: "payment processing"})
5454
→ Processes: CheckoutFlow, RefundFlow, WebhookHandler
5555
→ Symbols grouped by flow with file locations
5656
```
5757

58-
**gitnexus_context** — 360-degree view of a symbol:
58+
**context** — 360-degree view of a symbol:
5959

6060
```
61-
gitnexus_context({name: "validateUser"})
61+
context({name: "validateUser"})
6262
→ Incoming calls: loginHandler, apiMiddleware
6363
→ Outgoing calls: checkToken, getUserById
6464
→ Processes: LoginFlow (step 2/5), TokenRefresh (step 1/3)
@@ -68,10 +68,10 @@ gitnexus_context({name: "validateUser"})
6868

6969
```
7070
1. READ gitnexus://repo/my-app/context → 918 symbols, 45 processes
71-
2. gitnexus_query({query: "payment processing"})
71+
2. query({query: "payment processing"})
7272
→ CheckoutFlow: processPayment → validateCard → chargeStripe
7373
→ RefundFlow: initiateRefund → calculateRefund → processRefund
74-
3. gitnexus_context({name: "processPayment"})
74+
3. context({name: "processPayment"})
7575
→ Incoming: checkoutHandler, webhookHandler
7676
→ Outgoing: validateCard, chargeStripe, saveTransaction
7777
4. Read src/payments/processor.ts for implementation details

.claude/skills/gitnexus/gitnexus-guide/SKILL.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For any task involving code understanding, debugging, impact analysis, or refact
1515
2. **Match your task to a skill below** and **read that skill file**
1616
3. **Follow the skill's workflow and checklist**
1717

18-
> If step 1 warns the index is stale, run `npx gitnexus analyze` in the terminal first.
18+
> If step 1 warns the index is stale, run `node .gitnexus/run.cjs analyze` in the terminal first.
1919
2020
## Skills
2121

@@ -38,7 +38,38 @@ For any task involving code understanding, debugging, impact analysis, or refact
3838
| `detect_changes` | Git-diff impact — what do your current changes affect |
3939
| `rename` | Multi-file coordinated rename with confidence-tagged edits |
4040
| `cypher` | Raw graph queries (read `gitnexus://repo/{name}/schema` first) |
41-
| `list_repos` | Discover indexed repos |
41+
| `list_repos` | Discover indexed repos (paginated — `limit`/`offset`) |
42+
43+
### Paginating `list_repos`
44+
45+
`list_repos` is paginated so a large registry is not truncated by MCP/LLM token limits. It takes optional `limit` (default **50**, max **200**) and `offset`, and returns:
46+
47+
```jsonc
48+
{
49+
"repositories": [
50+
{ "name": "...", "path": "...", "indexedAt": "...", "lastCommit": "...", "stats": { } }
51+
],
52+
"pagination": {
53+
"total": 437,
54+
"limit": 50,
55+
"offset": 0,
56+
"returned": 50,
57+
"hasMore": true,
58+
"nextOffset": 50
59+
}
60+
}
61+
```
62+
63+
To enumerate **every** repository, keep calling with `offset` set to `pagination.nextOffset` until `hasMore` is `false`:
64+
65+
```text
66+
list_repos {} → repos 1–50, nextOffset 50, hasMore true
67+
list_repos { offset: 50 } → repos 51–100, nextOffset 100, hasMore true
68+
69+
list_repos { offset: 400 } → repos 401–437, hasMore false (done)
70+
```
71+
72+
Notes: `offset``total` returns an empty page (with `total` still reported). Out-of-range or malformed `limit`/`offset` (non-integer, `limit` outside `[1, 200]`, `offset < 0`) are rejected with a clear error — `limit` above the max is rejected, not silently capped. The order is deterministic (lower-cased name, then path), so paging never skips or duplicates an entry while the registry is unchanged.
4273

4374
## Resources Reference
4475

.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ description: "Use when the user wants to know what will break if they change som
1717
## Workflow
1818

1919
```
20-
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
20+
1. impact({target: "X", direction: "upstream"}) → What depends on this
2121
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
22-
3. gitnexus_detect_changes() → Map current git changes to affected flows
22+
3. detect_changes() → Map current git changes to affected flows
2323
4. Assess risk and report to user
2424
```
2525

26-
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
26+
> If "Index is stale" → run `node .gitnexus/run.cjs analyze` in terminal.
2727
2828
## Checklist
2929

3030
```
31-
- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
31+
- [ ] impact({target, direction: "upstream"}) to find dependents
3232
- [ ] Review d=1 items first (these WILL BREAK)
3333
- [ ] Check high-confidence (>0.8) dependencies
3434
- [ ] READ processes to check affected execution flows
35-
- [ ] gitnexus_detect_changes() for pre-commit check
35+
- [ ] detect_changes() for pre-commit check
3636
- [ ] Assess risk level and report to user
3737
```
3838

@@ -55,10 +55,10 @@ description: "Use when the user wants to know what will break if they change som
5555

5656
## Tools
5757

58-
**gitnexus_impact** — the primary tool for symbol blast radius:
58+
**impact** — the primary tool for symbol blast radius:
5959

6060
```
61-
gitnexus_impact({
61+
impact({
6262
target: "validateUser",
6363
direction: "upstream",
6464
minConfidence: 0.8,
@@ -73,10 +73,10 @@ gitnexus_impact({
7373
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]
7474
```
7575

76-
**gitnexus_detect_changes** — git-diff based impact analysis:
76+
**detect_changes** — git-diff based impact analysis:
7777

7878
```
79-
gitnexus_detect_changes({scope: "staged"})
79+
detect_changes({scope: "staged"})
8080
8181
→ Changed: 5 symbols in 3 files
8282
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
@@ -86,7 +86,7 @@ gitnexus_detect_changes({scope: "staged"})
8686
## Example: "What breaks if I change validateUser?"
8787

8888
```
89-
1. gitnexus_impact({target: "validateUser", direction: "upstream"})
89+
1. impact({target: "validateUser", direction: "upstream"})
9090
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
9191
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
9292

0 commit comments

Comments
 (0)