@hy-sde-org/dsh-tool-codebase-memory 0.1.2-rc.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.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Package-owned invariant companion for `@hy-sde-org/dsh-tool-codebase-memory`.
3
+ * @module @hy-sde-org/dsh-tool-codebase-memory/invariant
4
+ */
5
+ import { checkCodebaseMemoryCli } from "./cli-check.js";
6
+ const PACKAGE_NAME = '@hy-sde-org/dsh-tool-codebase-memory';
7
+ /** Cordis companion plugin name. */
8
+ export const name = 'tool-codebase-memory-invariant';
9
+ /** Service required before the companion can reserve package ownership. */
10
+ export const inject = ['invariants'];
11
+ /**
12
+ * Install the activation invariant: the `codebase-memory-mcp` CLI must resolve
13
+ * and run, otherwise the tools would error on every call. Config-level
14
+ * `cliPath` overrides are per-call concerns; the companion check uses the PATH
15
+ * default.
16
+ */
17
+ const install = async (_ctx, fail) => {
18
+ try {
19
+ await checkCodebaseMemoryCli();
20
+ }
21
+ catch (err) {
22
+ fail(err.message);
23
+ }
24
+ };
25
+ /**
26
+ * Register this package's invariant companion.
27
+ * @param ctx - Cordis context carrying the invariant service.
28
+ * @returns the installed registration's disposer after setup succeeds.
29
+ */
30
+ export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
31
+ /* jscpd:ignore-end */
32
+ /** Standalone availability probe re-export (usable outside the registry). */
33
+ export { checkCodebaseMemoryCli } from "./cli-check.js";
34
+ //# sourceMappingURL=invariant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariant.js","sourceRoot":"","sources":["../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,YAAY,GAAG,sCAAsC,CAAA;AAE3D,oCAAoC;AACpC,MAAM,CAAC,MAAM,IAAI,GAAG,gCAAgC,CAAA;AACpD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,YAAY,CAAC,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,OAAO,GAAuB,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,sBAAsB,EAAE,CAAA;IAChC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAE,GAAa,CAAC,OAAO,CAAC,CAAA;IAC9B,CAAC;AACH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAY,EAAuB,EAAE,CACzD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAA;AACjE,sBAAsB;AAEtB,6EAA6E;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `codebase:tools` system-prompt section: a compact contract card on the
3
+ * codebase-memory tool surface and the operational rules that keep the graph
4
+ * authoritative (index before asking, prefer graph answers over repeated
5
+ * greps, page with limit/offset, and know the project vocabulary).
6
+ * @module @hy-sde-org/dsh-tool-codebase-memory/prompt
7
+ */
8
+ import type { PromptSection } from '@deepseek-ai/dsh-system-prompt';
9
+ /**
10
+ * Build the codebase-tools prompt section.
11
+ * @param config - configuration; `enabled: false` disables the section.
12
+ * @returns the {@link PromptSection} to register.
13
+ */
14
+ export declare function buildCodebaseMemoryPromptSection(config?: {
15
+ enabled?: boolean;
16
+ }): PromptSection;
17
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAcnE;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,aAAa,CAMlG"}
package/dist/prompt.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `codebase:tools` system-prompt section: a compact contract card on the
3
+ * codebase-memory tool surface and the operational rules that keep the graph
4
+ * authoritative (index before asking, prefer graph answers over repeated
5
+ * greps, page with limit/offset, and know the project vocabulary).
6
+ * @module @hy-sde-org/dsh-tool-codebase-memory/prompt
7
+ */
8
+ const SECTION_NAME = 'codebase:tools';
9
+ const SECTION_ORDER = 131;
10
+ const TEXT = [
11
+ 'Codebase intelligence runs over the codebase-memory CLI tools (`codebase_list_projects`, `codebase_index_repository`, `codebase_index_status`, `codebase_search_graph`, `codebase_query_graph`, `codebase_trace_path`, `codebase_get_code_snippet`, `codebase_get_graph_schema`, `codebase_get_architecture`, `codebase_search_code`, `codebase_detect_changes`, `codebase_manage_adr`, `codebase_ingest_traces`, `codebase_delete_project`) — one-shot queries against the local codebase-memory daemon, not a long-lived MCP server.',
12
+ 'Before relying on graph answers, confirm the project is indexed (`codebase_list_projects` / `codebase_index_status`); index new repos with `codebase_index_repository` (full mode for deep research).',
13
+ 'Prefer `codebase_search_graph` over repeated grep/read cycles for definitions, callers, call chains, routes, and architecture; use `codebase_query_graph` (Cypher) for patterns the curated tools cannot express.',
14
+ 'Page with `limit`/`offset` until `has_more` is false; result sizes are capped and truncation is reported explicitly.',
15
+ '`codebase_delete_project` is destructive — use only for superseded indexes.',
16
+ 'Underlying CLI: `codebase-memory-mcp cli --json <tool>`; it shares the same daemon as any MCP client, so indexes are consistent across sessions.',
17
+ ].join('\n');
18
+ /**
19
+ * Build the codebase-tools prompt section.
20
+ * @param config - configuration; `enabled: false` disables the section.
21
+ * @returns the {@link PromptSection} to register.
22
+ */
23
+ export function buildCodebaseMemoryPromptSection(config = {}) {
24
+ return {
25
+ name: SECTION_NAME,
26
+ order: SECTION_ORDER,
27
+ text: config.enabled === false ? '' : TEXT,
28
+ };
29
+ }
30
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,YAAY,GAAG,gBAAgB,CAAA;AACrC,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB,MAAM,IAAI,GAAG;IACX,wgBAAwgB;IACxgB,uMAAuM;IACvM,mNAAmN;IACnN,sHAAsH;IACtH,6EAA6E;IAC7E,kJAAkJ;CACnJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAAC,SAAgC,EAAE;IACjF,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;KAC3C,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@hy-sde-org/dsh-tool-codebase-memory",
3
+ "description": "Model-facing codebase-memory CLI tools (codebase_list_projects/index_repository/index_status/search_graph/query_graph/trace_path/get_code_snippet/get_graph_schema/get_architecture/search_code/detect_changes/manage_adr/ingest_traces/delete_project) that run one-shot queries against the codebase-memory daemon from the terminal — the local alternative to the stdio MCP client row",
4
+ "version": "0.1.2-rc.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/hy-sde/dsh-tool-codebase-memory.git"
11
+ },
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./codebase-memory": {
21
+ "types": "./dist/codebase-memory.d.ts",
22
+ "default": "./dist/codebase-memory.js"
23
+ },
24
+ "./prompt": {
25
+ "types": "./dist/prompt.d.ts",
26
+ "default": "./dist/prompt.js"
27
+ },
28
+ "./invariant": {
29
+ "types": "./dist/invariant.d.ts",
30
+ "default": "./dist/invariant.js"
31
+ },
32
+ "./cli-check": {
33
+ "types": "./dist/cli-check.d.ts",
34
+ "default": "./dist/cli-check.js"
35
+ },
36
+ "./cordis.patch.yml": "./cordis.patch.yml",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "cordis.patch.yml",
42
+ "README.md",
43
+ "README.zh.md",
44
+ "README.i18n.yaml",
45
+ "LICENSE"
46
+ ],
47
+ "engines": {
48
+ "node": ">=22.19.0"
49
+ },
50
+ "license": "MIT",
51
+ "dsh": {
52
+ "bundle": {
53
+ "patch": "./cordis.patch.yml"
54
+ }
55
+ },
56
+ "dependencies": {},
57
+ "peerDependencies": {
58
+ "@deepseek-ai/cordis": "^4.0.2",
59
+ "@deepseek-ai/dsh-invariants": "^0.1.2-rc.1",
60
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-rc.1",
61
+ "@deepseek-ai/dsh-tools": "^0.1.2-rc.1"
62
+ },
63
+ "devDependencies": {
64
+ "@deepseek-ai/cordis": "^4.0.2",
65
+ "@deepseek-ai/dsh-invariants": "^0.1.2-rc.1",
66
+ "@deepseek-ai/dsh-llm": "^0.1.2-rc.1",
67
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-rc.1",
68
+ "@deepseek-ai/dsh-tools": "^0.1.2-rc.1",
69
+ "@types/node": "^24.13.3",
70
+ "typescript": "^5.9.3",
71
+ "vitest": "^3.2.7"
72
+ },
73
+ "keywords": [
74
+ "deepseek",
75
+ "agent",
76
+ "harness",
77
+ "dsh-plugin",
78
+ "codebase-memory",
79
+ "code-intelligence",
80
+ "knowledge-graph",
81
+ "tool"
82
+ ],
83
+ "scripts": {
84
+ "clean": "rm -rf dist",
85
+ "build": "tsc -p tsconfig.build.json",
86
+ "check": "tsc -p tsconfig.json --noEmit",
87
+ "test": "vitest run"
88
+ }
89
+ }