gitnexus 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -186
- package/dist/cli/ai-context.js +71 -71
- package/dist/cli/analyze.js +1 -1
- package/dist/cli/setup.js +8 -1
- package/dist/cli/view.d.ts +13 -0
- package/dist/cli/view.js +59 -0
- package/dist/core/augmentation/engine.js +20 -20
- package/dist/core/embeddings/embedding-pipeline.js +26 -26
- package/dist/core/graph/html-graph-viewer.d.ts +15 -0
- package/dist/core/graph/html-graph-viewer.js +542 -0
- package/dist/core/graph/html-graph-viewer.test.d.ts +1 -0
- package/dist/core/graph/html-graph-viewer.test.js +67 -0
- package/dist/core/ingestion/cluster-enricher.js +16 -16
- package/dist/core/kuzu/kuzu-adapter.js +9 -9
- package/dist/core/kuzu/schema.js +256 -256
- package/dist/core/search/bm25-index.js +5 -5
- package/dist/core/search/hybrid-search.js +3 -3
- package/dist/core/wiki/graph-queries.js +52 -52
- package/dist/core/wiki/html-viewer.js +192 -192
- package/dist/core/wiki/prompts.js +82 -82
- package/dist/mcp/core/embedder.js +8 -4
- package/dist/mcp/local/local-backend.d.ts +6 -0
- package/dist/mcp/local/local-backend.js +224 -117
- package/dist/mcp/resources.js +42 -42
- package/dist/mcp/server.js +16 -16
- package/dist/mcp/tools.js +86 -77
- package/dist/server/api.d.ts +4 -2
- package/dist/server/api.js +253 -83
- package/hooks/claude/gitnexus-hook.cjs +135 -135
- package/hooks/claude/pre-tool-use.sh +78 -78
- package/hooks/claude/session-start.sh +42 -42
- package/package.json +82 -82
- package/skills/debugging.md +85 -85
- package/skills/exploring.md +75 -75
- package/skills/impact-analysis.md +94 -94
- package/skills/refactoring.md +113 -113
- package/vendor/leiden/index.cjs +355 -355
- package/vendor/leiden/utils.cjs +392 -392
|
@@ -5,98 +5,98 @@
|
|
|
5
5
|
* Templates use {{PLACEHOLDER}} substitution.
|
|
6
6
|
*/
|
|
7
7
|
// ─── Grouping Prompt ──────────────────────────────────────────────────
|
|
8
|
-
export const GROUPING_SYSTEM_PROMPT = `You are a documentation architect. Given a list of source files with their exported symbols, group them into logical documentation modules.
|
|
9
|
-
|
|
10
|
-
Rules:
|
|
11
|
-
- Each module should represent a cohesive feature, layer, or domain
|
|
12
|
-
- Every file must appear in exactly one module
|
|
13
|
-
- Module names should be human-readable (e.g. "Authentication", "Database Layer", "API Routes")
|
|
14
|
-
- Aim for 5-15 modules for a typical project. Fewer for small projects, more for large ones
|
|
15
|
-
- Group by functionality, not by file type or directory structure alone
|
|
8
|
+
export const GROUPING_SYSTEM_PROMPT = `You are a documentation architect. Given a list of source files with their exported symbols, group them into logical documentation modules.
|
|
9
|
+
|
|
10
|
+
Rules:
|
|
11
|
+
- Each module should represent a cohesive feature, layer, or domain
|
|
12
|
+
- Every file must appear in exactly one module
|
|
13
|
+
- Module names should be human-readable (e.g. "Authentication", "Database Layer", "API Routes")
|
|
14
|
+
- Aim for 5-15 modules for a typical project. Fewer for small projects, more for large ones
|
|
15
|
+
- Group by functionality, not by file type or directory structure alone
|
|
16
16
|
- Do NOT create modules for tests, configs, or non-source files`;
|
|
17
|
-
export const GROUPING_USER_PROMPT = `Group these source files into documentation modules.
|
|
18
|
-
|
|
19
|
-
**Files and their exports:**
|
|
20
|
-
{{FILE_LIST}}
|
|
21
|
-
|
|
22
|
-
**Directory structure:**
|
|
23
|
-
{{DIRECTORY_TREE}}
|
|
24
|
-
|
|
25
|
-
Respond with ONLY a JSON object mapping module names to file path arrays. No markdown, no explanation.
|
|
26
|
-
Example format:
|
|
27
|
-
{
|
|
28
|
-
"Authentication": ["src/auth/login.ts", "src/auth/session.ts"],
|
|
29
|
-
"Database": ["src/db/connection.ts", "src/db/models.ts"]
|
|
17
|
+
export const GROUPING_USER_PROMPT = `Group these source files into documentation modules.
|
|
18
|
+
|
|
19
|
+
**Files and their exports:**
|
|
20
|
+
{{FILE_LIST}}
|
|
21
|
+
|
|
22
|
+
**Directory structure:**
|
|
23
|
+
{{DIRECTORY_TREE}}
|
|
24
|
+
|
|
25
|
+
Respond with ONLY a JSON object mapping module names to file path arrays. No markdown, no explanation.
|
|
26
|
+
Example format:
|
|
27
|
+
{
|
|
28
|
+
"Authentication": ["src/auth/login.ts", "src/auth/session.ts"],
|
|
29
|
+
"Database": ["src/db/connection.ts", "src/db/models.ts"]
|
|
30
30
|
}`;
|
|
31
31
|
// ─── Leaf Module Prompt ───────────────────────────────────────────────
|
|
32
|
-
export const MODULE_SYSTEM_PROMPT = `You are a technical documentation writer. Write clear, developer-focused documentation for a code module.
|
|
33
|
-
|
|
34
|
-
Rules:
|
|
35
|
-
- Reference actual function names, class names, and code patterns — do NOT invent APIs
|
|
36
|
-
- Use the call graph and execution flow data for accuracy, but do NOT mechanically list every edge
|
|
37
|
-
- Include Mermaid diagrams only when they genuinely help understanding. Keep them small (5-10 nodes max)
|
|
38
|
-
- Structure the document however makes sense for this module — there is no mandatory format
|
|
32
|
+
export const MODULE_SYSTEM_PROMPT = `You are a technical documentation writer. Write clear, developer-focused documentation for a code module.
|
|
33
|
+
|
|
34
|
+
Rules:
|
|
35
|
+
- Reference actual function names, class names, and code patterns — do NOT invent APIs
|
|
36
|
+
- Use the call graph and execution flow data for accuracy, but do NOT mechanically list every edge
|
|
37
|
+
- Include Mermaid diagrams only when they genuinely help understanding. Keep them small (5-10 nodes max)
|
|
38
|
+
- Structure the document however makes sense for this module — there is no mandatory format
|
|
39
39
|
- Write for a developer who needs to understand and contribute to this code`;
|
|
40
|
-
export const MODULE_USER_PROMPT = `Write documentation for the **{{MODULE_NAME}}** module.
|
|
41
|
-
|
|
42
|
-
## Source Code
|
|
43
|
-
|
|
44
|
-
{{SOURCE_CODE}}
|
|
45
|
-
|
|
46
|
-
## Call Graph & Execution Flows (reference for accuracy)
|
|
47
|
-
|
|
48
|
-
Internal calls: {{INTRA_CALLS}}
|
|
49
|
-
Outgoing calls: {{OUTGOING_CALLS}}
|
|
50
|
-
Incoming calls: {{INCOMING_CALLS}}
|
|
51
|
-
Execution flows: {{PROCESSES}}
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
40
|
+
export const MODULE_USER_PROMPT = `Write documentation for the **{{MODULE_NAME}}** module.
|
|
41
|
+
|
|
42
|
+
## Source Code
|
|
43
|
+
|
|
44
|
+
{{SOURCE_CODE}}
|
|
45
|
+
|
|
46
|
+
## Call Graph & Execution Flows (reference for accuracy)
|
|
47
|
+
|
|
48
|
+
Internal calls: {{INTRA_CALLS}}
|
|
49
|
+
Outgoing calls: {{OUTGOING_CALLS}}
|
|
50
|
+
Incoming calls: {{INCOMING_CALLS}}
|
|
51
|
+
Execution flows: {{PROCESSES}}
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
55
|
Write comprehensive documentation for this module. Cover its purpose, how it works, its key components, and how it connects to the rest of the codebase. Use whatever structure best fits this module — you decide the sections and headings. Include a Mermaid diagram only if it genuinely clarifies the architecture.`;
|
|
56
56
|
// ─── Parent Module Prompt ─────────────────────────────────────────────
|
|
57
|
-
export const PARENT_SYSTEM_PROMPT = `You are a technical documentation writer. Write a summary page for a module that contains sub-modules. Synthesize the children's documentation — do not re-read source code.
|
|
58
|
-
|
|
59
|
-
Rules:
|
|
60
|
-
- Reference actual components from the child modules
|
|
61
|
-
- Focus on how the sub-modules work together, not repeating their individual docs
|
|
62
|
-
- Keep it concise — the reader can click through to child pages for detail
|
|
57
|
+
export const PARENT_SYSTEM_PROMPT = `You are a technical documentation writer. Write a summary page for a module that contains sub-modules. Synthesize the children's documentation — do not re-read source code.
|
|
58
|
+
|
|
59
|
+
Rules:
|
|
60
|
+
- Reference actual components from the child modules
|
|
61
|
+
- Focus on how the sub-modules work together, not repeating their individual docs
|
|
62
|
+
- Keep it concise — the reader can click through to child pages for detail
|
|
63
63
|
- Include a Mermaid diagram only if it genuinely clarifies how the sub-modules relate`;
|
|
64
|
-
export const PARENT_USER_PROMPT = `Write documentation for the **{{MODULE_NAME}}** module, which contains these sub-modules:
|
|
65
|
-
|
|
66
|
-
{{CHILDREN_DOCS}}
|
|
67
|
-
|
|
68
|
-
Cross-module calls: {{CROSS_MODULE_CALLS}}
|
|
69
|
-
Shared execution flows: {{CROSS_PROCESSES}}
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
64
|
+
export const PARENT_USER_PROMPT = `Write documentation for the **{{MODULE_NAME}}** module, which contains these sub-modules:
|
|
65
|
+
|
|
66
|
+
{{CHILDREN_DOCS}}
|
|
67
|
+
|
|
68
|
+
Cross-module calls: {{CROSS_MODULE_CALLS}}
|
|
69
|
+
Shared execution flows: {{CROSS_PROCESSES}}
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
73
|
Write a concise overview of this module group. Explain its purpose, how the sub-modules fit together, and the key workflows that span them. Link to sub-module pages (e.g. \`[Sub-module Name](sub-module-slug.md)\`) rather than repeating their content. Use whatever structure fits best.`;
|
|
74
74
|
// ─── Overview Prompt ──────────────────────────────────────────────────
|
|
75
|
-
export const OVERVIEW_SYSTEM_PROMPT = `You are a technical documentation writer. Write the top-level overview page for a repository wiki. This is the first page a new developer sees.
|
|
76
|
-
|
|
77
|
-
Rules:
|
|
78
|
-
- Be clear and welcoming — this is the entry point to the entire codebase
|
|
79
|
-
- Reference actual module names so readers can navigate to their docs
|
|
80
|
-
- Include a high-level Mermaid architecture diagram showing only the most important modules and their relationships (max 10 nodes). A new dev should grasp it in 10 seconds
|
|
81
|
-
- Do NOT create module index tables or list every module with descriptions — just link to module pages naturally within the text
|
|
75
|
+
export const OVERVIEW_SYSTEM_PROMPT = `You are a technical documentation writer. Write the top-level overview page for a repository wiki. This is the first page a new developer sees.
|
|
76
|
+
|
|
77
|
+
Rules:
|
|
78
|
+
- Be clear and welcoming — this is the entry point to the entire codebase
|
|
79
|
+
- Reference actual module names so readers can navigate to their docs
|
|
80
|
+
- Include a high-level Mermaid architecture diagram showing only the most important modules and their relationships (max 10 nodes). A new dev should grasp it in 10 seconds
|
|
81
|
+
- Do NOT create module index tables or list every module with descriptions — just link to module pages naturally within the text
|
|
82
82
|
- Use the inter-module edges and execution flow data for accuracy, but do NOT dump them raw`;
|
|
83
|
-
export const OVERVIEW_USER_PROMPT = `Write the overview page for this repository's wiki.
|
|
84
|
-
|
|
85
|
-
## Project Info
|
|
86
|
-
|
|
87
|
-
{{PROJECT_INFO}}
|
|
88
|
-
|
|
89
|
-
## Module Summaries
|
|
90
|
-
|
|
91
|
-
{{MODULE_SUMMARIES}}
|
|
92
|
-
|
|
93
|
-
## Reference Data (for accuracy — do not reproduce verbatim)
|
|
94
|
-
|
|
95
|
-
Inter-module call edges: {{MODULE_EDGES}}
|
|
96
|
-
Key system flows: {{TOP_PROCESSES}}
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
83
|
+
export const OVERVIEW_USER_PROMPT = `Write the overview page for this repository's wiki.
|
|
84
|
+
|
|
85
|
+
## Project Info
|
|
86
|
+
|
|
87
|
+
{{PROJECT_INFO}}
|
|
88
|
+
|
|
89
|
+
## Module Summaries
|
|
90
|
+
|
|
91
|
+
{{MODULE_SUMMARIES}}
|
|
92
|
+
|
|
93
|
+
## Reference Data (for accuracy — do not reproduce verbatim)
|
|
94
|
+
|
|
95
|
+
Inter-module call edges: {{MODULE_EDGES}}
|
|
96
|
+
Key system flows: {{TOP_PROCESSES}}
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
100
|
Write a clear overview of this project: what it does, how it's architected, and the key end-to-end flows. Include a simple Mermaid architecture diagram (max 10 nodes, big-picture only). Link to module pages (e.g. \`[Module Name](module-slug.md)\`) naturally in the text rather than listing them in a table. If project config was provided, include brief setup instructions. Structure the page however reads best.`;
|
|
101
101
|
// ─── Template Substitution Helper ─────────────────────────────────────
|
|
102
102
|
/**
|
|
@@ -33,10 +33,13 @@ export const initEmbedder = async () => {
|
|
|
33
33
|
const devicesToTry = [gpuDevice, 'cpu'];
|
|
34
34
|
for (const device of devicesToTry) {
|
|
35
35
|
try {
|
|
36
|
-
// Silence stdout during model load — ONNX Runtime and transformers.js
|
|
37
|
-
// may write progress/init messages
|
|
38
|
-
|
|
36
|
+
// Silence stdout and stderr during model load — ONNX Runtime and transformers.js
|
|
37
|
+
// may write progress/init messages that corrupt MCP stdio protocol or produce
|
|
38
|
+
// noisy warnings (e.g. node assignment to execution providers).
|
|
39
|
+
const origStdout = process.stdout.write;
|
|
40
|
+
const origStderr = process.stderr.write;
|
|
39
41
|
process.stdout.write = (() => true);
|
|
42
|
+
process.stderr.write = (() => true);
|
|
40
43
|
try {
|
|
41
44
|
embedderInstance = await pipeline('feature-extraction', MODEL_ID, {
|
|
42
45
|
device: device,
|
|
@@ -44,7 +47,8 @@ export const initEmbedder = async () => {
|
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
finally {
|
|
47
|
-
process.stdout.write =
|
|
50
|
+
process.stdout.write = origStdout;
|
|
51
|
+
process.stderr.write = origStderr;
|
|
48
52
|
}
|
|
49
53
|
console.error(`GitNexus: Embedding model loaded (${device})`);
|
|
50
54
|
return embedderInstance;
|
|
@@ -94,7 +94,13 @@ export declare class LocalBackend {
|
|
|
94
94
|
* Semantic vector search helper
|
|
95
95
|
*/
|
|
96
96
|
private semanticSearch;
|
|
97
|
+
executeCypher(repoName: string, query: string): Promise<any>;
|
|
97
98
|
private cypher;
|
|
99
|
+
/**
|
|
100
|
+
* Format raw Cypher result rows as a markdown table for LLM readability.
|
|
101
|
+
* Falls back to raw result if rows aren't tabular objects.
|
|
102
|
+
*/
|
|
103
|
+
private formatCypherAsMarkdown;
|
|
98
104
|
/**
|
|
99
105
|
* Aggregate same-named clusters: group by heuristicLabel, sum symbols,
|
|
100
106
|
* weighted-average cohesion, filter out tiny clusters (<5 symbols).
|