@m1khal3v/dsh-tool-codegraph 0.0.1 → 1.0.1
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 +15 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +5 -5
- package/package.json +9 -10
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
### 1. Install the plugin
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
dsh plugin add @m1khal3v/dsh-tool-codegraph
|
|
39
|
+
dsh plugin add --profile web @m1khal3v/dsh-tool-codegraph
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### 2. Check the wrapped CLI
|
|
@@ -46,7 +46,20 @@ codegraph status
|
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
If the binary is missing, the tools reply with an install hint and the agent
|
|
49
|
-
falls back to `
|
|
49
|
+
falls back to `grep`-based search.
|
|
50
|
+
|
|
51
|
+
### 3. Initialize the index — your call
|
|
52
|
+
|
|
53
|
+
There is deliberately **no init tool** in the set above: following the codegraph
|
|
54
|
+
project's own recommendation, indexing should be kicked off by the user, not by
|
|
55
|
+
an agent. When `codegraph status` reports a missing index, run it yourself:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
codegraph init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Until you do, the tools report the missing index and the agent keeps working
|
|
62
|
+
with other search tools.
|
|
50
63
|
|
|
51
64
|
## 🧰 Tools
|
|
52
65
|
|
package/lib/index.d.ts
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*
|
|
12
12
|
* A system-prompt section teaches the model the orientation-first workflow:
|
|
13
13
|
* status first; a missing index is the user's decision (the model tells the
|
|
14
|
-
* user to run `codegraph init` and keeps working with
|
|
14
|
+
* user to run `codegraph init` and keeps working with other tools meanwhile);
|
|
15
15
|
* sync when stale; then lookups; callers/callees/impact are accelerators, not
|
|
16
|
-
* exhaustive proofs — exhaustive searches fall back to
|
|
16
|
+
* exhaustive proofs — exhaustive searches fall back to grep.
|
|
17
17
|
*
|
|
18
18
|
* Execution follows the canonical-value flow: `execute` returns the structured
|
|
19
19
|
* `CodegraphResult` validated against `CODEGRAPH_OUTPUT_SCHEMA`, and the
|
package/lib/index.js
CHANGED
|
@@ -53,7 +53,7 @@ function extractModelText(result) {
|
|
|
53
53
|
if (result.exitCode === 0) return (result.stdout.text.length > 0 ? result.stdout.text : NO_OUTPUT) + truncationMarker(result.stdout);
|
|
54
54
|
const stderr = result.stderr.text;
|
|
55
55
|
let text = stderr;
|
|
56
|
-
if (detectBinaryNotFound(stderr, result.exitCode ?? 0)) text += "\n[Codegraph executable not found. Please install it or rely on
|
|
56
|
+
if (detectBinaryNotFound(stderr, result.exitCode ?? 0)) text += "\n[Codegraph executable not found. Please install it or rely on grep (or similar) instead.]";
|
|
57
57
|
if (detectIndexMissing(stderr)) text += "\n[Codegraph error: Index missing. Run codegraph_init first.]";
|
|
58
58
|
return text;
|
|
59
59
|
}
|
|
@@ -207,9 +207,9 @@ const codegraphToolSpecs = [
|
|
|
207
207
|
*
|
|
208
208
|
* A system-prompt section teaches the model the orientation-first workflow:
|
|
209
209
|
* status first; a missing index is the user's decision (the model tells the
|
|
210
|
-
* user to run `codegraph init` and keeps working with
|
|
210
|
+
* user to run `codegraph init` and keeps working with other tools meanwhile);
|
|
211
211
|
* sync when stale; then lookups; callers/callees/impact are accelerators, not
|
|
212
|
-
* exhaustive proofs — exhaustive searches fall back to
|
|
212
|
+
* exhaustive proofs — exhaustive searches fall back to grep.
|
|
213
213
|
*
|
|
214
214
|
* Execution follows the canonical-value flow: `execute` returns the structured
|
|
215
215
|
* `CodegraphResult` validated against `CODEGRAPH_OUTPUT_SCHEMA`, and the
|
|
@@ -246,11 +246,11 @@ function canonicalPath(input) {
|
|
|
246
246
|
}
|
|
247
247
|
/** System-prompt section text, verbatim contract of the tool catalog workflow. */
|
|
248
248
|
const CODEGRAPH_PROMPT = `CodeGraph Usage Rules:
|
|
249
|
-
- Workflow: ALWAYS check \`codegraph_status\` once per session first. If the index is missing, do NOT build it yourself — indexing is the user's decision: tell the user to run \`codegraph init\`, and continue with
|
|
249
|
+
- Workflow: ALWAYS check \`codegraph_status\` once per session first. If the index is missing, do NOT build it yourself — indexing is the user's decision: tell the user to run \`codegraph init\`, and continue with other tools meanwhile. If stale, run \`codegraph_sync\`.
|
|
250
250
|
- Orientation: Use \`codegraph_explore\` for mapping architecture or "how X works". Use \`codegraph_callers\` / \`codegraph_callees\` / \`codegraph_node\` for targeted lookups.
|
|
251
251
|
- Subagents: For deep exploration, spawn a subagent and explicitly instruct it to use \`codegraph_explore\` — its verbatim source blocks are heavy, so keep them out of the main session.
|
|
252
252
|
- DO NOT trust callers/callees/impact for completeness! They silently drop unresolved method/generic/trait-dispatch edges.
|
|
253
|
-
- For
|
|
253
|
+
- For 100% accuracy (e.g., finding ALL callers before a rename or signature change), use \`grep\` or similar. Codegraph is only an accelerator.
|
|
254
254
|
- Overloaded names: Do not query overloaded names with bare callers/callees. Use \`codegraph_node\` on a specific symbol ID or use grep.`;
|
|
255
255
|
/**
|
|
256
256
|
* Output contract validated against every successful `execute` value. The
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m1khal3v/dsh-tool-codegraph",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CodeGraph integration for DeepSeek Harness",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "m1khal3v",
|
|
@@ -40,14 +40,6 @@
|
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": "^22.19 || >=24"
|
|
42
42
|
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "tsdown && tsc -p tsconfig.types.json",
|
|
45
|
-
"prepublishOnly": "pnpm run build",
|
|
46
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
47
|
-
"test": "vitest run",
|
|
48
|
-
"test:watch": "vitest",
|
|
49
|
-
"verify": "pnpm run typecheck && pnpm run test"
|
|
50
|
-
},
|
|
51
43
|
"dsh": {
|
|
52
44
|
"bundle": {
|
|
53
45
|
"patch": "./cordis.patch.yml"
|
|
@@ -83,5 +75,12 @@
|
|
|
83
75
|
"tsdown": "^0.22.14",
|
|
84
76
|
"typescript": "^5.9.0",
|
|
85
77
|
"vitest": "^2.1.9"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "tsdown && tsc -p tsconfig.types.json",
|
|
81
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
82
|
+
"test": "vitest run",
|
|
83
|
+
"test:watch": "vitest",
|
|
84
|
+
"verify": "pnpm run typecheck && pnpm run test"
|
|
86
85
|
}
|
|
87
|
-
}
|
|
86
|
+
}
|