fix(plugin): mirror installed CLI stale guidance

This commit is contained in:
AlphaComposite 2026-05-11 04:19:11 +03:00
parent 089cc5677c
commit 62e7e7cabf
8 changed files with 11 additions and 10 deletions

View file

@ -296,11 +296,12 @@ function handlePostToolUse(input) {
// If HEAD matches last indexed commit, no reindex needed
if (currentHead && currentHead === lastCommit) return;
const analyzeCmd = `npx gitnexus analyze${hadEmbeddings ? ' --embeddings' : ''}`;
const analyzeCmd = `gitnexus analyze${hadEmbeddings ? ' --embeddings' : ''}`;
const npxAnalyzeCmd = `npx gitnexus analyze${hadEmbeddings ? ' --embeddings' : ''}`;
sendHookResponse(
'PostToolUse',
`GitNexus index is stale (last indexed: ${lastCommit ? lastCommit.slice(0, 7) : 'never'}). ` +
`Run \`${analyzeCmd}\` to update the knowledge graph.`,
`Run \`${analyzeCmd}\` to update the knowledge graph, or \`${npxAnalyzeCmd}\` if the CLI is not installed.`,
);
}

View file

@ -5,14 +5,14 @@ description: "Use when the user needs to run GitNexus CLI commands like analyze/
# GitNexus CLI Commands
All commands work via `npx` — no global install required.
Use the installed `gitnexus` CLI when available. Prefix commands with `npx gitnexus` if the CLI is not installed globally.
## Commands
### analyze — Build or refresh the index
```bash
npx gitnexus analyze
gitnexus analyze
```
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.

View file

@ -22,7 +22,7 @@ description: "Use when the user is debugging a bug, tracing an error, or asking
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
```
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
> If "Index is stale" → run `gitnexus analyze` in terminal (`npx gitnexus analyze` if the CLI is not installed).
## Checklist

View file

@ -23,7 +23,7 @@ description: "Use when the user asks how code works, wants to understand archite
5. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow
```
> If step 2 says "Index is stale" → run `npx gitnexus analyze` in terminal.
> If step 2 says "Index is stale" → run `gitnexus analyze` in terminal (`npx gitnexus analyze` if the CLI is not installed).
## Checklist

View file

@ -15,7 +15,7 @@ For any task involving code understanding, debugging, impact analysis, or refact
2. **Match your task to a skill below** and **read that skill file**
3. **Follow the skill's workflow and checklist**
> If step 1 warns the index is stale, run `npx gitnexus analyze` in the terminal first.
> If step 1 warns the index is stale, run `gitnexus analyze` in the terminal first (`npx gitnexus analyze` if the CLI is not installed).
## Skills

View file

@ -23,7 +23,7 @@ description: "Use when the user wants to know what will break if they change som
4. Assess risk and report to user
```
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
> If "Index is stale" → run `gitnexus analyze` in terminal (`npx gitnexus analyze` if the CLI is not installed).
## Checklist

View file

@ -26,7 +26,7 @@ description: "Use when the user wants to review a pull request, understand what
6. Summarize findings with risk assessment
```
> If "Index is stale" → run `npx gitnexus analyze` in terminal before reviewing.
> If "Index is stale" → run `gitnexus analyze` in terminal before reviewing (`npx gitnexus analyze` if the CLI is not installed).
## Checklist

View file

@ -22,7 +22,7 @@ description: "Use when the user wants to rename, extract, split, move, or restru
4. Plan update order: interfaces → implementations → callers → tests
```
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
> If "Index is stale" → run `gitnexus analyze` in terminal (`npx gitnexus analyze` if the CLI is not installed).
## Checklists