@m1khal3v/dsh-tool-codegraph 0.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/LICENSE +21 -0
- package/README.md +86 -0
- package/cordis.patch.yml +11 -0
- package/lib/index.d.ts +119 -0
- package/lib/index.js +392 -0
- package/lib/invariant.d.ts +15 -0
- package/lib/invariant.js +15 -0
- package/lib/render.d.ts +51 -0
- package/lib/tools.d.ts +53 -0
- package/package.json +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anton Mikhalev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.npmjs.com/package/@m1khal3v/dsh-tool-codegraph"><img alt="npm" src="https://img.shields.io/npm/v/@m1khal3v/dsh-tool-codegraph?style=flat-square&color=4b6fff"></a>
|
|
3
|
+
<img alt="DeepSeek Harness" src="https://img.shields.io/badge/deepseek--harness-v0.1.1--rc.1-263146?style=flat-square">
|
|
4
|
+
<a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-263146?style=flat-square"></a>
|
|
5
|
+
<img alt="Status" src="https://img.shields.io/badge/status-beta-7da1de?style=flat-square">
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<h1 align="center">dsh-tool-codegraph</h1>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<b>CodeGraph navigation tools for <a href="https://github.com/deepseek-ai/deepseek-harness">DeepSeek Harness</a>.</b><br>
|
|
11
|
+
A DSH plugin that wraps the open-source <a href="https://github.com/colbymchenry/codegraph">codegraph</a> CLI
|
|
12
|
+
(an AST/tree-sitter code index) into ten focused agent tools — status, search,
|
|
13
|
+
callers/callees, impact, explore, and more.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
> **This package is a thin wrapper.** All indexing and querying is done by the
|
|
17
|
+
> [codegraph](https://github.com/colbymchenry/codegraph) CLI — install it first
|
|
18
|
+
> and make sure its binary is on `PATH`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## ⚡️ Highlights
|
|
23
|
+
|
|
24
|
+
- 🧭 **Orientation-first workflow** — usage rules (`status → sync → explore → targeted lookups`) are injected into the agent system prompt automatically.
|
|
25
|
+
- 🧰 **Ten focused tools**, one per operation — no mega-tool with an `action` parameter.
|
|
26
|
+
- ⚡ **O(1) indexed lookups** — light outputs for the main session, heavy explore builds routed to subagents.
|
|
27
|
+
- ⚠️ **Honest about soundness** — callers/callees/impact can miss dynamic-dispatch edges; the prompt tells the model when to fall back to `grep`.
|
|
28
|
+
|
|
29
|
+
## 🛠 Requirements
|
|
30
|
+
|
|
31
|
+
- Node `^22.19 || >=24`
|
|
32
|
+
- The [`codegraph`](https://github.com/colbymchenry/codegraph) CLI available on `PATH` (override via the `executable` config key)
|
|
33
|
+
|
|
34
|
+
## 🚀 Quick Start
|
|
35
|
+
|
|
36
|
+
### 1. Install the plugin
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
dsh plugin add @m1khal3v/dsh-tool-codegraph
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Check the wrapped CLI
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
codegraph status
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If the binary is missing, the tools reply with an install hint and the agent
|
|
49
|
+
falls back to `bash`/`grep`.
|
|
50
|
+
|
|
51
|
+
## 🧰 Tools
|
|
52
|
+
|
|
53
|
+
| Tool | Purpose | Output |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `codegraph_status` | Index health and statistics | light |
|
|
56
|
+
| `codegraph_sync` | Sync changes since the last index | long |
|
|
57
|
+
| `codegraph_search` | Find a symbol by name | light |
|
|
58
|
+
| `codegraph_explore` | Map an area with verbatim source and call paths | heavy |
|
|
59
|
+
| `codegraph_callers` | Who calls this symbol (unsound) | light |
|
|
60
|
+
| `codegraph_callees` | What this symbol calls | light |
|
|
61
|
+
| `codegraph_impact` | Blast radius of changing a symbol | light |
|
|
62
|
+
| `codegraph_node` | One symbol's details or a file view | light |
|
|
63
|
+
| `codegraph_files` | Project file structure from the index | light |
|
|
64
|
+
| `codegraph_affected` | Find test files affected by changed source files | light |
|
|
65
|
+
|
|
66
|
+
## ⚙️ Configuration
|
|
67
|
+
|
|
68
|
+
| Key | Default | Description |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `executable` | `codegraph` | Binary name or path of the wrapped CLI |
|
|
71
|
+
| `queryTimeoutMs` | `10000` | Timeout for regular commands |
|
|
72
|
+
| `initTimeoutMs` | `60000` | Timeout for `init` / `sync` |
|
|
73
|
+
|
|
74
|
+
## 🧑💻 Development
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
pnpm install
|
|
78
|
+
pnpm run verify # typecheck + test
|
|
79
|
+
pnpm run build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 📄 License
|
|
83
|
+
|
|
84
|
+
[MIT](LICENSE)
|
|
85
|
+
|
|
86
|
+
Built on top of [colbymchenry/codegraph](https://github.com/colbymchenry/codegraph).
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @m1khal3v/dsh-tool-codegraph — bundle patch layer.
|
|
2
|
+
#
|
|
3
|
+
# Inserts one plugin row that mounts the CodeGraph tool set. Tools shell out to
|
|
4
|
+
# the local `codegraph` CLI (https://github.com/colbymchenry/codegraph) through
|
|
5
|
+
# ctx.shell; override the binary via the `executable` config key if it is not
|
|
6
|
+
# on PATH.
|
|
7
|
+
- insert:
|
|
8
|
+
- id: tool-codegraph
|
|
9
|
+
name: '@m1khal3v/dsh-tool-codegraph'
|
|
10
|
+
config:
|
|
11
|
+
executable: codegraph
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeGraph navigation tools for DeepSeek Harness agents.
|
|
3
|
+
*
|
|
4
|
+
* The plugin registers ten independent agent tools (`codegraph_status`,
|
|
5
|
+
* `codegraph_sync`, `codegraph_search`, `codegraph_explore`,
|
|
6
|
+
* `codegraph_callers`, `codegraph_callees`, `codegraph_impact`,
|
|
7
|
+
* `codegraph_node`, `codegraph_files`, `codegraph_affected`). Every tool
|
|
8
|
+
* shells out to the local codegraph CLI (https://github.com/colbymchenry/codegraph)
|
|
9
|
+
* through `ctx.shell` and renders the result as a terminal call card plus
|
|
10
|
+
* model-facing text.
|
|
11
|
+
*
|
|
12
|
+
* A system-prompt section teaches the model the orientation-first workflow:
|
|
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 bash/grep meanwhile);
|
|
15
|
+
* sync when stale; then lookups; callers/callees/impact are accelerators, not
|
|
16
|
+
* exhaustive proofs — exhaustive searches fall back to bash/grep.
|
|
17
|
+
*
|
|
18
|
+
* Execution follows the canonical-value flow: `execute` returns the structured
|
|
19
|
+
* `CodegraphResult` validated against `CODEGRAPH_OUTPUT_SCHEMA`, and the
|
|
20
|
+
* model-facing text is a pure projection of that value (`output.render`), so
|
|
21
|
+
* every consumer (model, UI, tests) reads the same canonical fact set.
|
|
22
|
+
*
|
|
23
|
+
* No background jobs: codegraph runs synchronously under the caller's
|
|
24
|
+
* AbortSignal; timeouts come from the plugin config.
|
|
25
|
+
*
|
|
26
|
+
* @module @m1khal3v/dsh-tool-codegraph
|
|
27
|
+
*/
|
|
28
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
29
|
+
import z from '@deepseek-ai/schemastery';
|
|
30
|
+
import type { TimeoutKind } from './tools.ts';
|
|
31
|
+
/** Cordis plugin name. */
|
|
32
|
+
export declare const name = "tool-codegraph";
|
|
33
|
+
/** Services the plugin needs on its context. */
|
|
34
|
+
export declare const inject: string[];
|
|
35
|
+
/** Plugin config shape (composition entry config). */
|
|
36
|
+
export interface Config {
|
|
37
|
+
/** Binary name or path of the codegraph CLI. */
|
|
38
|
+
executable?: string;
|
|
39
|
+
/** Timeout for regular (light) commands, ms. */
|
|
40
|
+
queryTimeoutMs?: number;
|
|
41
|
+
/** Timeout for index-building commands (sync), ms. */
|
|
42
|
+
initTimeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
export declare const Config: z<Config>;
|
|
45
|
+
/** Config with every default applied. */
|
|
46
|
+
export interface ResolvedConfig {
|
|
47
|
+
executable: string;
|
|
48
|
+
queryTimeoutMs: number;
|
|
49
|
+
initTimeoutMs: number;
|
|
50
|
+
}
|
|
51
|
+
/** Resolve the configured timeout for one tool timeout kind. */
|
|
52
|
+
export declare function resolveTimeout(kind: TimeoutKind, config: ResolvedConfig): number;
|
|
53
|
+
/** Expand a leading `~` and make the path absolute and normalized. */
|
|
54
|
+
export declare function canonicalPath(input: string): string;
|
|
55
|
+
/** Canonical value every codegraph tool returns from `execute`. */
|
|
56
|
+
export interface CodegraphResult {
|
|
57
|
+
/** Constant discriminant of this package's tool outputs. */
|
|
58
|
+
kind: 'codegraph';
|
|
59
|
+
/** Full CLI command line that was run, executable included. */
|
|
60
|
+
command: string;
|
|
61
|
+
/** Working directory the command ran in; `null` when the session has no cwd. */
|
|
62
|
+
workdir: string | null;
|
|
63
|
+
/** Process exit code; `null` when it never exited (signal kill or spawn failure). */
|
|
64
|
+
exitCode: number | null;
|
|
65
|
+
/** Model-facing text for the run (output, markers, or an error envelope). */
|
|
66
|
+
content: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Output contract validated against every successful `execute` value. The
|
|
70
|
+
* author-facing `required: true` annotations compile into the object's JSON
|
|
71
|
+
* Schema `required` list, and the nullable fields are `oneOf` unions — a plain
|
|
72
|
+
* `type: 'string'` would reject the canonical `null` workdir of a session
|
|
73
|
+
* without a cwd (and `null` exitCode of a signal-killed run).
|
|
74
|
+
*/
|
|
75
|
+
export declare const CODEGRAPH_OUTPUT_SCHEMA: {
|
|
76
|
+
readonly type: "object";
|
|
77
|
+
readonly additionalProperties: false;
|
|
78
|
+
readonly properties: {
|
|
79
|
+
readonly kind: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly const: "codegraph";
|
|
82
|
+
readonly required: true;
|
|
83
|
+
};
|
|
84
|
+
readonly command: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
readonly required: true;
|
|
87
|
+
};
|
|
88
|
+
readonly workdir: {
|
|
89
|
+
readonly oneOf: readonly [{
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
}, {
|
|
92
|
+
readonly type: "null";
|
|
93
|
+
}];
|
|
94
|
+
readonly required: true;
|
|
95
|
+
};
|
|
96
|
+
readonly exitCode: {
|
|
97
|
+
readonly oneOf: readonly [{
|
|
98
|
+
readonly type: "integer";
|
|
99
|
+
}, {
|
|
100
|
+
readonly type: "null";
|
|
101
|
+
}];
|
|
102
|
+
readonly required: true;
|
|
103
|
+
};
|
|
104
|
+
readonly content: {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
readonly required: true;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Cordis plugin entry: register the codegraph tools and the system-prompt
|
|
112
|
+
* section. State lives only in this closure; nothing is registered beyond
|
|
113
|
+
* `ctx.tools` / `ctx.systemPrompt`, and no background jobs are started.
|
|
114
|
+
* @param ctx - Cordis context carrying the injected services.
|
|
115
|
+
* @param config - entry config; cordis applies the schemastery defaults of
|
|
116
|
+
* {@link Config} before calling `apply`, so the `?? fallback` reads here are
|
|
117
|
+
* a defensive normalization for hosts that bypass it, not the primary path.
|
|
118
|
+
*/
|
|
119
|
+
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import z from "@deepseek-ai/schemastery";
|
|
4
|
+
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
5
|
+
//#region src/render.ts
|
|
6
|
+
/** Placeholder shown when a truncated stream has no recoverable spill file. */
|
|
7
|
+
const SPILL_UNAVAILABLE = "(unavailable)";
|
|
8
|
+
/** Model text for a successful run that produced no stdout at all. */
|
|
9
|
+
const NO_OUTPUT = "(no output)";
|
|
10
|
+
/**
|
|
11
|
+
* Marker appended when the executor truncated a stream and can name the file
|
|
12
|
+
* holding the complete output. `spillPath` is optional in the real
|
|
13
|
+
* `CollectedOutput`: truncation can occur without a safe spill path, so the
|
|
14
|
+
* marker degrades to an explicit placeholder instead of printing "undefined".
|
|
15
|
+
*/
|
|
16
|
+
const truncationMarker = (output) => {
|
|
17
|
+
if (!output.truncated) return "";
|
|
18
|
+
return `\n[output truncated; full output: ${output.spillPath ?? SPILL_UNAVAILABLE}]`;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Terminal call card for one codegraph invocation.
|
|
22
|
+
* @param action - CLI subcommand (first argv token), rendered as `codegraph <action>`.
|
|
23
|
+
* @param description - full CLI command line of the invocation.
|
|
24
|
+
* @param cwd - working directory the command runs in; omit when unknown.
|
|
25
|
+
* @returns the pending-state call card shown to the user.
|
|
26
|
+
*/
|
|
27
|
+
function buildCallCard(action, description, cwd) {
|
|
28
|
+
return {
|
|
29
|
+
card: "terminal",
|
|
30
|
+
title: `codegraph ${action}`,
|
|
31
|
+
description,
|
|
32
|
+
cwd
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** True when the failure looks like a missing codegraph binary. */
|
|
36
|
+
function detectBinaryNotFound(stderrText, exitCode) {
|
|
37
|
+
if (exitCode === 127) return true;
|
|
38
|
+
return /not found|missing|no such file/i.test(stderrText);
|
|
39
|
+
}
|
|
40
|
+
/** True when the failure looks like a missing/uninitialized index. */
|
|
41
|
+
function detectIndexMissing(stderrText) {
|
|
42
|
+
return /not initialized/i.test(stderrText) || /\.codegraph\b/.test(stderrText);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Model-facing text extracted from a finished shell run. A zero exit code
|
|
46
|
+
* surfaces stdout (stderr is deliberately ignored there); anything else —
|
|
47
|
+
* including a signal kill with a null exit code — surfaces stderr plus
|
|
48
|
+
* actionable recovery markers, each on its own leading-newline line.
|
|
49
|
+
* @param result - completed shell run to summarize.
|
|
50
|
+
* @returns the text handed back to the model for this tool call.
|
|
51
|
+
*/
|
|
52
|
+
function extractModelText(result) {
|
|
53
|
+
if (result.exitCode === 0) return (result.stdout.text.length > 0 ? result.stdout.text : NO_OUTPUT) + truncationMarker(result.stdout);
|
|
54
|
+
const stderr = result.stderr.text;
|
|
55
|
+
let text = stderr;
|
|
56
|
+
if (detectBinaryNotFound(stderr, result.exitCode ?? 0)) text += "\n[Codegraph executable not found. Please install it or rely on bash/grep.]";
|
|
57
|
+
if (detectIndexMissing(stderr)) text += "\n[Codegraph error: Index missing. Run codegraph_init first.]";
|
|
58
|
+
return text;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/tools.ts
|
|
62
|
+
/**
|
|
63
|
+
* POSIX single-quote shell escaping: wraps the value in '…' and replaces every
|
|
64
|
+
* interior single quote with '\'' so the value survives shell joining intact.
|
|
65
|
+
*/
|
|
66
|
+
function quoteArg(value) {
|
|
67
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
68
|
+
}
|
|
69
|
+
/** Type-safe factory erasing the concrete param type into CodegraphToolSpec. */
|
|
70
|
+
function defineSpec(spec) {
|
|
71
|
+
return {
|
|
72
|
+
name: spec.name,
|
|
73
|
+
description: spec.description,
|
|
74
|
+
parameters: spec.parameters,
|
|
75
|
+
buildArgs: (params) => spec.buildArgs(params),
|
|
76
|
+
timeout: spec.timeout
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** All codegraph tools in registration order. */
|
|
80
|
+
const codegraphToolSpecs = [
|
|
81
|
+
defineSpec({
|
|
82
|
+
name: "codegraph_status",
|
|
83
|
+
description: "Check index health and statistics. Run this once per session to confirm index freshness before querying.",
|
|
84
|
+
parameters: {},
|
|
85
|
+
buildArgs: () => ["status"],
|
|
86
|
+
timeout: "query"
|
|
87
|
+
}),
|
|
88
|
+
defineSpec({
|
|
89
|
+
name: "codegraph_sync",
|
|
90
|
+
description: "Sync changes since the last index. Run this if the index is stale.",
|
|
91
|
+
parameters: {},
|
|
92
|
+
buildArgs: () => ["sync"],
|
|
93
|
+
timeout: "init"
|
|
94
|
+
}),
|
|
95
|
+
defineSpec({
|
|
96
|
+
name: "codegraph_search",
|
|
97
|
+
description: "Find a symbol by name across the codebase (Light output).",
|
|
98
|
+
parameters: { query: {
|
|
99
|
+
type: "string",
|
|
100
|
+
required: true,
|
|
101
|
+
description: "Symbol name to look up."
|
|
102
|
+
} },
|
|
103
|
+
buildArgs: ({ query }) => [
|
|
104
|
+
"query",
|
|
105
|
+
quoteArg(query),
|
|
106
|
+
"--json"
|
|
107
|
+
],
|
|
108
|
+
timeout: "query"
|
|
109
|
+
}),
|
|
110
|
+
defineSpec({
|
|
111
|
+
name: "codegraph_explore",
|
|
112
|
+
description: "PRIMARY tool for orienting. Explores an area by returning verbatim source code of relevant symbols and their call paths grouped by file.",
|
|
113
|
+
parameters: { query: {
|
|
114
|
+
type: "string",
|
|
115
|
+
required: true,
|
|
116
|
+
description: "Area or question to explore."
|
|
117
|
+
} },
|
|
118
|
+
buildArgs: ({ query }) => ["explore", quoteArg(query)],
|
|
119
|
+
timeout: "query"
|
|
120
|
+
}),
|
|
121
|
+
defineSpec({
|
|
122
|
+
name: "codegraph_callers",
|
|
123
|
+
description: "Find all functions/methods that call a specific symbol. Unsound (may have false negatives). Do not use for exhaustive completeness.",
|
|
124
|
+
parameters: { symbol: {
|
|
125
|
+
type: "string",
|
|
126
|
+
required: true,
|
|
127
|
+
description: "Symbol name to look up."
|
|
128
|
+
} },
|
|
129
|
+
buildArgs: ({ symbol }) => ["callers", quoteArg(symbol)],
|
|
130
|
+
timeout: "query"
|
|
131
|
+
}),
|
|
132
|
+
defineSpec({
|
|
133
|
+
name: "codegraph_callees",
|
|
134
|
+
description: "Find all functions/methods that a specific symbol calls.",
|
|
135
|
+
parameters: { symbol: {
|
|
136
|
+
type: "string",
|
|
137
|
+
required: true,
|
|
138
|
+
description: "Symbol name to look up."
|
|
139
|
+
} },
|
|
140
|
+
buildArgs: ({ symbol }) => ["callees", quoteArg(symbol)],
|
|
141
|
+
timeout: "query"
|
|
142
|
+
}),
|
|
143
|
+
defineSpec({
|
|
144
|
+
name: "codegraph_impact",
|
|
145
|
+
description: "Analyze what code is affected by changing a symbol. Pre-rank blast radius before editing. depth is optional (default 2).",
|
|
146
|
+
parameters: {
|
|
147
|
+
symbol: {
|
|
148
|
+
type: "string",
|
|
149
|
+
required: true,
|
|
150
|
+
description: "Symbol to change."
|
|
151
|
+
},
|
|
152
|
+
depth: {
|
|
153
|
+
type: "number",
|
|
154
|
+
description: "Blast-radius depth (default 2); flag added only when provided."
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
buildArgs: ({ symbol, depth }) => [
|
|
158
|
+
"impact",
|
|
159
|
+
quoteArg(symbol),
|
|
160
|
+
...depth !== void 0 ? ["--depth", String(depth)] : []
|
|
161
|
+
],
|
|
162
|
+
timeout: "query"
|
|
163
|
+
}),
|
|
164
|
+
defineSpec({
|
|
165
|
+
name: "codegraph_node",
|
|
166
|
+
description: "Get one symbol's details (source + caller/callee trail) or read a file with line numbers + dependents. Good for overloaded names.",
|
|
167
|
+
parameters: { name: {
|
|
168
|
+
type: "string",
|
|
169
|
+
required: true,
|
|
170
|
+
description: "Symbol name or file path."
|
|
171
|
+
} },
|
|
172
|
+
buildArgs: ({ name }) => ["node", quoteArg(name)],
|
|
173
|
+
timeout: "query"
|
|
174
|
+
}),
|
|
175
|
+
defineSpec({
|
|
176
|
+
name: "codegraph_files",
|
|
177
|
+
description: "Show project file structure from the index.",
|
|
178
|
+
parameters: {},
|
|
179
|
+
buildArgs: () => ["files", "--json"],
|
|
180
|
+
timeout: "query"
|
|
181
|
+
}),
|
|
182
|
+
defineSpec({
|
|
183
|
+
name: "codegraph_affected",
|
|
184
|
+
description: "Find test files affected by changed source files.",
|
|
185
|
+
parameters: { files: {
|
|
186
|
+
type: "array",
|
|
187
|
+
required: true,
|
|
188
|
+
items: { type: "string" },
|
|
189
|
+
description: "Changed source files whose affected tests to find."
|
|
190
|
+
} },
|
|
191
|
+
buildArgs: ({ files }) => ["affected", ...files.map(quoteArg)],
|
|
192
|
+
timeout: "query"
|
|
193
|
+
})
|
|
194
|
+
];
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/index.ts
|
|
197
|
+
/**
|
|
198
|
+
* CodeGraph navigation tools for DeepSeek Harness agents.
|
|
199
|
+
*
|
|
200
|
+
* The plugin registers ten independent agent tools (`codegraph_status`,
|
|
201
|
+
* `codegraph_sync`, `codegraph_search`, `codegraph_explore`,
|
|
202
|
+
* `codegraph_callers`, `codegraph_callees`, `codegraph_impact`,
|
|
203
|
+
* `codegraph_node`, `codegraph_files`, `codegraph_affected`). Every tool
|
|
204
|
+
* shells out to the local codegraph CLI (https://github.com/colbymchenry/codegraph)
|
|
205
|
+
* through `ctx.shell` and renders the result as a terminal call card plus
|
|
206
|
+
* model-facing text.
|
|
207
|
+
*
|
|
208
|
+
* A system-prompt section teaches the model the orientation-first workflow:
|
|
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 bash/grep meanwhile);
|
|
211
|
+
* sync when stale; then lookups; callers/callees/impact are accelerators, not
|
|
212
|
+
* exhaustive proofs — exhaustive searches fall back to bash/grep.
|
|
213
|
+
*
|
|
214
|
+
* Execution follows the canonical-value flow: `execute` returns the structured
|
|
215
|
+
* `CodegraphResult` validated against `CODEGRAPH_OUTPUT_SCHEMA`, and the
|
|
216
|
+
* model-facing text is a pure projection of that value (`output.render`), so
|
|
217
|
+
* every consumer (model, UI, tests) reads the same canonical fact set.
|
|
218
|
+
*
|
|
219
|
+
* No background jobs: codegraph runs synchronously under the caller's
|
|
220
|
+
* AbortSignal; timeouts come from the plugin config.
|
|
221
|
+
*
|
|
222
|
+
* @module @m1khal3v/dsh-tool-codegraph
|
|
223
|
+
*/
|
|
224
|
+
/** Cordis plugin name. */
|
|
225
|
+
const name = "tool-codegraph";
|
|
226
|
+
/** Services the plugin needs on its context. */
|
|
227
|
+
const inject = [
|
|
228
|
+
"shell",
|
|
229
|
+
"tools",
|
|
230
|
+
"systemPrompt"
|
|
231
|
+
];
|
|
232
|
+
const Config = z.object({
|
|
233
|
+
executable: z.string().default("codegraph"),
|
|
234
|
+
queryTimeoutMs: z.number().default(1e4),
|
|
235
|
+
initTimeoutMs: z.number().default(6e4)
|
|
236
|
+
});
|
|
237
|
+
/** Resolve the configured timeout for one tool timeout kind. */
|
|
238
|
+
function resolveTimeout(kind, config) {
|
|
239
|
+
return kind === "init" ? config.initTimeoutMs : config.queryTimeoutMs;
|
|
240
|
+
}
|
|
241
|
+
/** Expand a leading `~` and make the path absolute and normalized. */
|
|
242
|
+
function canonicalPath(input) {
|
|
243
|
+
const home = homedir();
|
|
244
|
+
const expanded = input === "~" || input.startsWith("~/") ? join(home, input.slice(1).replace(/^\/+/, "")) : input;
|
|
245
|
+
return resolve(expanded);
|
|
246
|
+
}
|
|
247
|
+
/** System-prompt section text, verbatim contract of the tool catalog workflow. */
|
|
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 bash/grep meanwhile. If stale, run \`codegraph_sync\`.
|
|
250
|
+
- Orientation: Use \`codegraph_explore\` for mapping architecture or "how X works". Use \`codegraph_callers\` / \`codegraph_callees\` / \`codegraph_node\` for targeted lookups.
|
|
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
|
+
- DO NOT trust callers/callees/impact for completeness! They silently drop unresolved method/generic/trait-dispatch edges.
|
|
253
|
+
- For exhaustive searches (e.g., finding ALL callers before a rename or signature change), you MUST use \`bash\` with \`grep\` or \`rg\`. Codegraph is only an accelerator.
|
|
254
|
+
- Overloaded names: Do not query overloaded names with bare callers/callees. Use \`codegraph_node\` on a specific symbol ID or use grep.`;
|
|
255
|
+
/**
|
|
256
|
+
* Output contract validated against every successful `execute` value. The
|
|
257
|
+
* author-facing `required: true` annotations compile into the object's JSON
|
|
258
|
+
* Schema `required` list, and the nullable fields are `oneOf` unions — a plain
|
|
259
|
+
* `type: 'string'` would reject the canonical `null` workdir of a session
|
|
260
|
+
* without a cwd (and `null` exitCode of a signal-killed run).
|
|
261
|
+
*/
|
|
262
|
+
const CODEGRAPH_OUTPUT_SCHEMA = {
|
|
263
|
+
type: "object",
|
|
264
|
+
additionalProperties: false,
|
|
265
|
+
properties: {
|
|
266
|
+
kind: {
|
|
267
|
+
type: "string",
|
|
268
|
+
const: "codegraph",
|
|
269
|
+
required: true
|
|
270
|
+
},
|
|
271
|
+
command: {
|
|
272
|
+
type: "string",
|
|
273
|
+
required: true
|
|
274
|
+
},
|
|
275
|
+
workdir: {
|
|
276
|
+
oneOf: [{ type: "string" }, { type: "null" }],
|
|
277
|
+
required: true
|
|
278
|
+
},
|
|
279
|
+
exitCode: {
|
|
280
|
+
oneOf: [{ type: "integer" }, { type: "null" }],
|
|
281
|
+
required: true
|
|
282
|
+
},
|
|
283
|
+
content: {
|
|
284
|
+
type: "string",
|
|
285
|
+
required: true
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* First content block of a completed tool result, when it is plain text.
|
|
291
|
+
* `presentResult` sees only the durable content projection, and codegraph
|
|
292
|
+
* results always render as a single text block; anything else (future block
|
|
293
|
+
* kinds, empty content) degrades to an empty card output.
|
|
294
|
+
*/
|
|
295
|
+
function textOf(result) {
|
|
296
|
+
const block = result.content[0];
|
|
297
|
+
return block !== void 0 && block.type === "text" ? block.text : "";
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Exit code carried in a tool result's presentation metadata, when present.
|
|
301
|
+
* `ToolResult.meta` is an opaque `JsonValue`, so the shape is narrowed via
|
|
302
|
+
* `in`/`typeof` with one local cast instead of trusting an untyped payload.
|
|
303
|
+
*/
|
|
304
|
+
function metaExitCode(meta) {
|
|
305
|
+
if (typeof meta !== "object" || meta === null || !("exitCode" in meta)) return void 0;
|
|
306
|
+
const value = meta.exitCode;
|
|
307
|
+
return typeof value === "number" ? value : void 0;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Cordis plugin entry: register the codegraph tools and the system-prompt
|
|
311
|
+
* section. State lives only in this closure; nothing is registered beyond
|
|
312
|
+
* `ctx.tools` / `ctx.systemPrompt`, and no background jobs are started.
|
|
313
|
+
* @param ctx - Cordis context carrying the injected services.
|
|
314
|
+
* @param config - entry config; cordis applies the schemastery defaults of
|
|
315
|
+
* {@link Config} before calling `apply`, so the `?? fallback` reads here are
|
|
316
|
+
* a defensive normalization for hosts that bypass it, not the primary path.
|
|
317
|
+
*/
|
|
318
|
+
function apply(ctx, config) {
|
|
319
|
+
const resolved = {
|
|
320
|
+
executable: config.executable ?? "codegraph",
|
|
321
|
+
queryTimeoutMs: config.queryTimeoutMs ?? 1e4,
|
|
322
|
+
initTimeoutMs: config.initTimeoutMs ?? 6e4
|
|
323
|
+
};
|
|
324
|
+
/** Run one codegraph CLI command in the agent session's cwd and project it canonically. */
|
|
325
|
+
const runCodegraph = async (argv, exec, timeout) => {
|
|
326
|
+
const sessionCwd = exec.agent?.session.header.cwd;
|
|
327
|
+
const workdir = sessionCwd === void 0 ? void 0 : canonicalPath(sessionCwd);
|
|
328
|
+
const cmd = [resolved.executable, ...argv].join(" ");
|
|
329
|
+
const failure = (cause) => ({
|
|
330
|
+
kind: "codegraph",
|
|
331
|
+
command: cmd,
|
|
332
|
+
workdir: workdir ?? null,
|
|
333
|
+
exitCode: null,
|
|
334
|
+
content: `[Codegraph error: ${cause}]`
|
|
335
|
+
});
|
|
336
|
+
try {
|
|
337
|
+
const result = await ctx.shell.run(ctx.shell.resolve({
|
|
338
|
+
command: cmd,
|
|
339
|
+
workdir,
|
|
340
|
+
timeoutMs: timeout,
|
|
341
|
+
signal: exec.signal
|
|
342
|
+
}));
|
|
343
|
+
if (result.aborted) return failure("call aborted");
|
|
344
|
+
return {
|
|
345
|
+
kind: "codegraph",
|
|
346
|
+
command: cmd,
|
|
347
|
+
workdir: workdir ?? null,
|
|
348
|
+
exitCode: result.exitCode,
|
|
349
|
+
content: extractModelText(result)
|
|
350
|
+
};
|
|
351
|
+
} catch (error) {
|
|
352
|
+
return failure(error instanceof Error ? error.message : String(error));
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
for (const spec of codegraphToolSpecs) ctx.tools.register(defineTool({
|
|
356
|
+
name: spec.name,
|
|
357
|
+
description: spec.description,
|
|
358
|
+
parameters: spec.parameters,
|
|
359
|
+
output: {
|
|
360
|
+
schema: CODEGRAPH_OUTPUT_SCHEMA,
|
|
361
|
+
render: (_args, value) => [{
|
|
362
|
+
type: "text",
|
|
363
|
+
text: value.content
|
|
364
|
+
}],
|
|
365
|
+
presentationMeta: (_args, value) => ({
|
|
366
|
+
command: value.command,
|
|
367
|
+
workdir: value.workdir,
|
|
368
|
+
exitCode: value.exitCode
|
|
369
|
+
})
|
|
370
|
+
},
|
|
371
|
+
execute: (args, exec) => runCodegraph(spec.buildArgs(args), exec, resolveTimeout(spec.timeout, resolved)),
|
|
372
|
+
presentCall: (args) => {
|
|
373
|
+
const argv = spec.buildArgs(args);
|
|
374
|
+
return buildCallCard(argv[0] ?? "", [resolved.executable, ...argv].join(" "), void 0);
|
|
375
|
+
},
|
|
376
|
+
presentResult: (_args, result) => {
|
|
377
|
+
const exitCode = metaExitCode(result.meta);
|
|
378
|
+
return {
|
|
379
|
+
card: "terminal",
|
|
380
|
+
output: textOf(result),
|
|
381
|
+
...exitCode !== void 0 ? { exitCode } : {}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}));
|
|
385
|
+
ctx.systemPrompt.section({
|
|
386
|
+
name: "tool:codegraph",
|
|
387
|
+
order: 110,
|
|
388
|
+
text: CODEGRAPH_PROMPT
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
export { CODEGRAPH_OUTPUT_SCHEMA, Config, apply, canonicalPath, inject, name, resolveTimeout };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@m1khal3v/dsh-tool-codegraph`.
|
|
3
|
+
* @module @m1khal3v/dsh-tool-codegraph/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "tool-codegraph-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/invariant.ts
|
|
2
|
+
const PACKAGE_NAME = "@m1khal3v/dsh-tool-codegraph";
|
|
3
|
+
/** Cordis companion plugin name. */
|
|
4
|
+
const name = "tool-codegraph-invariant";
|
|
5
|
+
/** Service required before the companion can reserve package ownership. */
|
|
6
|
+
const inject = ["invariants"];
|
|
7
|
+
const install = () => {};
|
|
8
|
+
/**
|
|
9
|
+
* Register this package's invariant companion.
|
|
10
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
11
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
12
|
+
*/
|
|
13
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
14
|
+
//#endregion
|
|
15
|
+
export { apply, inject, name };
|
package/lib/render.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result rendering for codegraph tool calls: the terminal call card shown to
|
|
3
|
+
* the user and the model-facing text with actionable markers (missing binary,
|
|
4
|
+
* missing index, truncated output). Pure functions only.
|
|
5
|
+
* @module @m1khal3v/dsh-tool-codegraph/render
|
|
6
|
+
*/
|
|
7
|
+
import type { ShellRunResult } from '@deepseek-ai/dsh-shell';
|
|
8
|
+
import type { TerminalCallView, ToolResultView } from '@deepseek-ai/dsh-tools';
|
|
9
|
+
/**
|
|
10
|
+
* Terminal call card for one codegraph invocation.
|
|
11
|
+
* @param action - CLI subcommand (first argv token), rendered as `codegraph <action>`.
|
|
12
|
+
* @param description - full CLI command line of the invocation.
|
|
13
|
+
* @param cwd - working directory the command runs in; omit when unknown.
|
|
14
|
+
* @returns the pending-state call card shown to the user.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildCallCard(action: string, description: string, cwd: string | undefined): TerminalCallView;
|
|
17
|
+
/** True when the failure looks like a missing codegraph binary. */
|
|
18
|
+
export declare function detectBinaryNotFound(stderrText: string, exitCode: number): boolean;
|
|
19
|
+
/** True when the failure looks like a missing/uninitialized index. */
|
|
20
|
+
export declare function detectIndexMissing(stderrText: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Model-facing text extracted from a finished shell run. A zero exit code
|
|
23
|
+
* surfaces stdout (stderr is deliberately ignored there); anything else —
|
|
24
|
+
* including a signal kill with a null exit code — surfaces stderr plus
|
|
25
|
+
* actionable recovery markers, each on its own leading-newline line.
|
|
26
|
+
* @param result - completed shell run to summarize.
|
|
27
|
+
* @returns the text handed back to the model for this tool call.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractModelText(result: ShellRunResult): string;
|
|
30
|
+
/**
|
|
31
|
+
* Full tool result for a finished shell run: the completed terminal card
|
|
32
|
+
* carrying the model text in `output` (the real `ToolResultView` union has no
|
|
33
|
+
* `text` field) plus the exit code when the process exited.
|
|
34
|
+
* @param result - completed shell run.
|
|
35
|
+
* @param command - full CLI command line of the invocation.
|
|
36
|
+
* @param workdir - working directory the command ran in; the completed view
|
|
37
|
+
* cannot carry it, but the pending title is still derived through the call
|
|
38
|
+
* card built from it.
|
|
39
|
+
* @returns the completed terminal card for the invocation.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderResult(result: ShellRunResult, command: string, workdir: string | undefined): ToolResultView;
|
|
42
|
+
/**
|
|
43
|
+
* Tool result for a shell call that threw (timeout/abort/spawn failure): the
|
|
44
|
+
* run produced no exit status, so the completed card carries only the error
|
|
45
|
+
* text for the model.
|
|
46
|
+
* @param command - full CLI command line of the invocation.
|
|
47
|
+
* @param workdir - working directory the command was meant to run in.
|
|
48
|
+
* @param cause - short reason string, e.g. `call aborted` on an aborted signal.
|
|
49
|
+
* @returns the completed terminal card with the `[Codegraph error: …]` text.
|
|
50
|
+
*/
|
|
51
|
+
export declare function renderShellFailure(command: string, workdir: string | undefined, cause: string): ToolResultView;
|
package/lib/tools.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog of the codegraph agent tools: names, model-facing descriptions,
|
|
3
|
+
* parameter schemas, CLI argv builders and timeout kinds. Pure data — no
|
|
4
|
+
* context, no shell. The CLI is the open-source codegraph binary
|
|
5
|
+
* (https://github.com/colbymchenry/codegraph) wrapped by this plugin.
|
|
6
|
+
* @module @m1khal3v/dsh-tool-codegraph/tools
|
|
7
|
+
*/
|
|
8
|
+
import type { ParameterSchemaSpec } from '@deepseek-ai/dsh-tools';
|
|
9
|
+
/** Which configured timeout a tool uses (see plugin Config). */
|
|
10
|
+
export type TimeoutKind = 'query' | 'init';
|
|
11
|
+
/**
|
|
12
|
+
* POSIX single-quote shell escaping: wraps the value in '…' and replaces every
|
|
13
|
+
* interior single quote with '\'' so the value survives shell joining intact.
|
|
14
|
+
*/
|
|
15
|
+
export declare function quoteArg(value: string): string;
|
|
16
|
+
/** Parameter shapes per tool. */
|
|
17
|
+
export interface SearchParams {
|
|
18
|
+
query: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ExploreParams {
|
|
21
|
+
query: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CallersParams {
|
|
24
|
+
symbol: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CalleesParams {
|
|
27
|
+
symbol: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ImpactParams {
|
|
30
|
+
symbol: string;
|
|
31
|
+
depth?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface NodeParams {
|
|
34
|
+
name: string;
|
|
35
|
+
}
|
|
36
|
+
export interface AffectedParams {
|
|
37
|
+
files: string[];
|
|
38
|
+
}
|
|
39
|
+
/** Erased per-tool spec stored in the registry. */
|
|
40
|
+
export interface CodegraphToolSpec {
|
|
41
|
+
/** Registered tool name, e.g. `codegraph_search`. */
|
|
42
|
+
readonly name: string;
|
|
43
|
+
/** Model-facing description (English, verbatim from the catalog table). */
|
|
44
|
+
readonly description: string;
|
|
45
|
+
/** dsh-tools parameter schema validating the tool input before buildArgs. */
|
|
46
|
+
readonly parameters: ParameterSchemaSpec;
|
|
47
|
+
/** Build CLI argv after the executable; dynamic values are quoteArg-ed. */
|
|
48
|
+
buildArgs(params: unknown): string[];
|
|
49
|
+
/** Which configured timeout applies to this tool. */
|
|
50
|
+
readonly timeout: TimeoutKind;
|
|
51
|
+
}
|
|
52
|
+
/** All codegraph tools in registration order. */
|
|
53
|
+
export declare const codegraphToolSpecs: readonly CodegraphToolSpec[];
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@m1khal3v/dsh-tool-codegraph",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "CodeGraph integration for DeepSeek Harness",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "m1khal3v",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/m1khal3v/dsh-tool-codegraph.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/m1khal3v/dsh-tool-codegraph/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/m1khal3v/dsh-tool-codegraph#readme",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "lib/index.js",
|
|
20
|
+
"types": "lib/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./lib/index.d.ts",
|
|
24
|
+
"default": "./lib/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./invariant": {
|
|
27
|
+
"types": "./lib/invariant.d.ts",
|
|
28
|
+
"default": "./lib/invariant.js"
|
|
29
|
+
},
|
|
30
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"lib/**/*.js",
|
|
35
|
+
"lib/**/*.d.ts",
|
|
36
|
+
"cordis.patch.yml",
|
|
37
|
+
"README.md",
|
|
38
|
+
"LICENSE"
|
|
39
|
+
],
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": "^22.19 || >=24"
|
|
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
|
+
"dsh": {
|
|
52
|
+
"bundle": {
|
|
53
|
+
"patch": "./cordis.patch.yml"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"keywords": [
|
|
57
|
+
"dsh",
|
|
58
|
+
"deepseek-harness",
|
|
59
|
+
"cordis",
|
|
60
|
+
"codegraph",
|
|
61
|
+
"tree-sitter",
|
|
62
|
+
"code-navigation",
|
|
63
|
+
"tools"
|
|
64
|
+
],
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
67
|
+
"@deepseek-ai/dsh-agent": "^0.1.1-rc.1",
|
|
68
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.1",
|
|
69
|
+
"@deepseek-ai/dsh-shell": "^0.1.1-rc.1",
|
|
70
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.1",
|
|
71
|
+
"@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
|
|
72
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
76
|
+
"@deepseek-ai/dsh-agent": "^0.1.1-rc.1",
|
|
77
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.1",
|
|
78
|
+
"@deepseek-ai/dsh-shell": "^0.1.1-rc.1",
|
|
79
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.1",
|
|
80
|
+
"@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
|
|
81
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
82
|
+
"@types/node": "^22.0.0",
|
|
83
|
+
"tsdown": "^0.22.14",
|
|
84
|
+
"typescript": "^5.9.0",
|
|
85
|
+
"vitest": "^2.1.9"
|
|
86
|
+
}
|
|
87
|
+
}
|