contract-driven-delivery 2.1.0 → 2.1.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.1.2] - 2026-05-29
|
|
4
|
+
|
|
5
|
+
Recommended MCP setup during install and upgrade.
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- `cdd-kit init` and `cdd-kit refresh` now explicitly recommend enabling the
|
|
10
|
+
`cdd-kit mcp` server so AI agents use graph/code-map tools directly.
|
|
11
|
+
- `CLAUDE.md`, `CODEX.md`, README, and install guide now present MCP graph tools
|
|
12
|
+
as the recommended project exploration path, with `cdd-kit graph/index` as
|
|
13
|
+
fallback.
|
|
14
|
+
|
|
15
|
+
## [2.1.1] - 2026-05-29
|
|
16
|
+
|
|
17
|
+
MCP tool access for graph/code-map exploration.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **`cdd-kit mcp`**: runs a stdio MCP server exposing graph and code-map tools
|
|
22
|
+
(`cdd_graph_status`, `cdd_graph_context`, `cdd_graph_query`,
|
|
23
|
+
`cdd_graph_impact`, `cdd_index_query`, `cdd_index_impact`) so AI agents can
|
|
24
|
+
use project exploration as native tools instead of shell-only commands.
|
|
25
|
+
|
|
3
26
|
## [2.1.0] - 2026-05-27
|
|
4
27
|
|
|
5
28
|
Native code graph and symptom-driven bug-fix workflow.
|
package/README.md
CHANGED
|
@@ -275,6 +275,12 @@ Creates: `contracts/`, `specs/templates/`, provider guidance files (`CLAUDE.md`,
|
|
|
275
275
|
|
|
276
276
|
`.cdd/model-policy.json` stores role-to-model **classes** (`opus`, `sonnet`, `haiku`) instead of provider release IDs such as `claude-opus-4-7`. This keeps the policy stable across Claude and Codex adapters; provider-specific tooling can map the class to the concrete model available in that environment.
|
|
277
277
|
|
|
278
|
+
Recommended: configure MCP-capable AI agents with `command: "cdd-kit"` and
|
|
279
|
+
`args: ["mcp"]` after init. This exposes graph/code-map tools directly to the
|
|
280
|
+
agent (`cdd_graph_context`, `cdd_graph_query`, `cdd_graph_impact`,
|
|
281
|
+
`cdd_index_query`, `cdd_index_impact`) so project exploration does not depend on
|
|
282
|
+
the agent remembering shell commands.
|
|
283
|
+
|
|
278
284
|
---
|
|
279
285
|
|
|
280
286
|
### `cdd-kit update`
|
|
@@ -307,6 +313,10 @@ cdd-kit migrate --all # add new per-change scaffolds such as implementation-p
|
|
|
307
313
|
cdd-kit doctor --strict
|
|
308
314
|
```
|
|
309
315
|
|
|
316
|
+
After syncing, configure MCP-capable agents with `command: "cdd-kit"` and
|
|
317
|
+
`args: ["mcp"]`. This is the recommended way for agents to use the regenerated
|
|
318
|
+
code graph and code-map; shell commands remain the fallback.
|
|
319
|
+
|
|
310
320
|
What gets updated:
|
|
311
321
|
|
|
312
322
|
| command | updates | preserves |
|
|
@@ -389,6 +399,11 @@ cdd-kit refresh --yes --no-templates
|
|
|
389
399
|
5. Resyncs `.cdd/model-policy.json` roles from installed agent frontmatter.
|
|
390
400
|
6. Regenerates `.cdd/code-map.yml`.
|
|
391
401
|
|
|
402
|
+
After `refresh --yes`, configure MCP-capable agents to run `cdd-kit mcp`.
|
|
403
|
+
The MCP tools are the recommended graph/code-map exploration interface for AI
|
|
404
|
+
agents; `cdd-kit graph ...` and `cdd-kit index ...` remain the fallback when MCP
|
|
405
|
+
is not available.
|
|
406
|
+
|
|
392
407
|
Run `cdd-kit migrate --all` separately when you need existing
|
|
393
408
|
`specs/changes/*` directories to gain new required artifacts.
|
|
394
409
|
|
|
@@ -713,6 +728,31 @@ Use `--engine native` for the built-in graph, `--engine codemap` for the older
|
|
|
713
728
|
code-map-only fallback, `--engine codegraph` to require external CodeGraph, or
|
|
714
729
|
`CDD_CODEGRAPH_BIN=/path/to/codegraph` to point at a custom binary.
|
|
715
730
|
|
|
731
|
+
### `cdd-kit mcp`
|
|
732
|
+
|
|
733
|
+
`cdd-kit mcp` runs a stdio MCP server so agents can call the graph/index layer
|
|
734
|
+
as tools instead of shelling out manually.
|
|
735
|
+
|
|
736
|
+
```json
|
|
737
|
+
{
|
|
738
|
+
"mcpServers": {
|
|
739
|
+
"cdd-kit": {
|
|
740
|
+
"command": "cdd-kit",
|
|
741
|
+
"args": ["mcp"]
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
Exposed tools:
|
|
748
|
+
|
|
749
|
+
- `cdd_graph_status`
|
|
750
|
+
- `cdd_graph_context`
|
|
751
|
+
- `cdd_graph_query`
|
|
752
|
+
- `cdd_graph_impact`
|
|
753
|
+
- `cdd_index_query`
|
|
754
|
+
- `cdd_index_impact`
|
|
755
|
+
|
|
716
756
|
Large Python repos are scanned in chunks (`CDD_CODE_MAP_BATCH_SIZE`, default 400)
|
|
717
757
|
so one slow batch cannot drop the whole language. Raise
|
|
718
758
|
`CDD_CODE_MAP_TIMEOUT_MS` (default 30000) if a single batch still times out.
|
|
@@ -744,6 +784,9 @@ cdd-kit migrate --all
|
|
|
744
784
|
cdd-kit doctor --strict
|
|
745
785
|
```
|
|
746
786
|
|
|
787
|
+
Recommended agent setup after the refresh: enable the `cdd-kit` MCP server with
|
|
788
|
+
args `["mcp"]` so agents use graph/code-map tools before opening source files.
|
|
789
|
+
|
|
747
790
|
### Old completed specs
|
|
748
791
|
|
|
749
792
|
If a change is already finished, merged, or only kept for audit/history:
|
|
@@ -776,11 +819,12 @@ Then choose one path per active change:
|
|
|
776
819
|
### Recommended rollout for production repos already burned by token overuse
|
|
777
820
|
|
|
778
821
|
1. Run `cdd-kit refresh --yes` once per repo after updating the npm package.
|
|
779
|
-
2.
|
|
780
|
-
3.
|
|
781
|
-
4.
|
|
782
|
-
5.
|
|
783
|
-
6.
|
|
822
|
+
2. Configure MCP-capable agents with `command: "cdd-kit"` and `args: ["mcp"]`.
|
|
823
|
+
3. Run `cdd-kit migrate --all` so existing active changes receive the current required artifact set.
|
|
824
|
+
4. Review and fill `implementation-plan.md` before resuming implementation agents on active changes.
|
|
825
|
+
5. Run `cdd-kit doctor --strict` in CI.
|
|
826
|
+
6. Migrate active specs with `cdd-kit migrate --enable-context-governance` only after reviewing the generated manifest.
|
|
827
|
+
7. Teach agents to use `cdd-kit context request/approve/reject/list` instead of silently widening context.
|
|
784
828
|
|
|
785
829
|
---
|
|
786
830
|
|
|
@@ -42,6 +42,28 @@ This repository follows the Contract-Driven Delivery workflow.
|
|
|
42
42
|
|
|
43
43
|
Run `cdd-kit detect-stack` to verify the detected tech stack.
|
|
44
44
|
|
|
45
|
+
## Recommended MCP Tools
|
|
46
|
+
|
|
47
|
+
Configure MCP-capable agents to use the cdd-kit server:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"cdd-kit": {
|
|
53
|
+
"command": "cdd-kit",
|
|
54
|
+
"args": ["mcp"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Prefer these MCP tools before reading source files: `cdd_graph_context`,
|
|
61
|
+
`cdd_graph_query`, `cdd_graph_impact`, `cdd_index_query`, and
|
|
62
|
+
`cdd_index_impact`. They use `.cdd/code-map.yml` and
|
|
63
|
+
`.cdd/code-graph.index.json` as the project exploration layer. If MCP is not
|
|
64
|
+
available, use the equivalent CLI commands: `cdd-kit graph ...` and
|
|
65
|
+
`cdd-kit index ...`.
|
|
66
|
+
|
|
45
67
|
## Context Governance
|
|
46
68
|
|
|
47
69
|
For context-governed changes, read `specs/changes/<change-id>/context-manifest.md` before using file-reading or broad search tools.
|
package/assets/CODEX.template.md
CHANGED
|
@@ -11,6 +11,28 @@ This project uses Contract-Driven Delivery (CDD).
|
|
|
11
11
|
- Run `cdd-kit context-scan` before classification when project context may be stale.
|
|
12
12
|
- Run `cdd-kit gate <change-id>` before proposing a commit or PR.
|
|
13
13
|
|
|
14
|
+
## Recommended MCP Tools
|
|
15
|
+
|
|
16
|
+
Configure MCP-capable agents to use the cdd-kit server:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"cdd-kit": {
|
|
22
|
+
"command": "cdd-kit",
|
|
23
|
+
"args": ["mcp"]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Prefer these MCP tools before reading source files: `cdd_graph_context`,
|
|
30
|
+
`cdd_graph_query`, `cdd_graph_impact`, `cdd_index_query`, and
|
|
31
|
+
`cdd_index_impact`. They use `.cdd/code-map.yml` and
|
|
32
|
+
`.cdd/code-graph.index.json` as the project exploration layer. If MCP is not
|
|
33
|
+
available, use the equivalent CLI commands: `cdd-kit graph ...` and
|
|
34
|
+
`cdd-kit index ...`.
|
|
35
|
+
|
|
14
36
|
## Context Governance
|
|
15
37
|
|
|
16
38
|
Read `specs/changes/<change-id>/context-manifest.md` before using file-reading or search tools.
|
|
@@ -9,7 +9,16 @@ auto-refreshing `cdd-kit index ...` commands for that job.
|
|
|
9
9
|
|
|
10
10
|
## Preferred workflow: graph/query before reading
|
|
11
11
|
|
|
12
|
-
Before reading source, use the graph layer when available
|
|
12
|
+
Before reading source, use the graph layer when available. If the `cdd-kit`
|
|
13
|
+
MCP server is configured, prefer these tools:
|
|
14
|
+
|
|
15
|
+
- `cdd_graph_context`
|
|
16
|
+
- `cdd_graph_query`
|
|
17
|
+
- `cdd_graph_impact`
|
|
18
|
+
- `cdd_index_query`
|
|
19
|
+
- `cdd_index_impact`
|
|
20
|
+
|
|
21
|
+
If MCP tools are not available, use the equivalent CLI commands:
|
|
13
22
|
|
|
14
23
|
```bash
|
|
15
24
|
cdd-kit graph context "fix login redirect bug"
|
package/dist/cli/index.js
CHANGED
|
@@ -98,6 +98,21 @@ var init_logger = __esm({
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
+
// src/utils/mcp-hint.ts
|
|
102
|
+
function logRecommendedMcpSetup() {
|
|
103
|
+
log.info("Recommended for AI agents: enable the cdd-kit MCP server.");
|
|
104
|
+
log.dim(" MCP server command: cdd-kit");
|
|
105
|
+
log.dim(' MCP server args: ["mcp"]');
|
|
106
|
+
log.dim(" Tools exposed: cdd_graph_context, cdd_graph_query, cdd_graph_impact, cdd_index_query, cdd_index_impact");
|
|
107
|
+
log.dim(" Use MCP graph tools before source reads; CLI fallback: cdd-kit graph/index.");
|
|
108
|
+
}
|
|
109
|
+
var init_mcp_hint = __esm({
|
|
110
|
+
"src/utils/mcp-hint.ts"() {
|
|
111
|
+
"use strict";
|
|
112
|
+
init_logger();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
101
116
|
// src/commands/code-map-hook.ts
|
|
102
117
|
var code_map_hook_exports = {};
|
|
103
118
|
__export(code_map_hook_exports, {
|
|
@@ -10283,8 +10298,10 @@ async function refresh(opts) {
|
|
|
10283
10298
|
log.info("Next: review changes with `git diff`, then commit:");
|
|
10284
10299
|
log.dim(" git add .cdd/code-map.yml .cdd/model-policy.json specs/templates tests/templates ci-templates .github/workflows");
|
|
10285
10300
|
log.dim(' git commit -m "chore: cdd-kit refresh"');
|
|
10301
|
+
logRecommendedMcpSetup();
|
|
10286
10302
|
} else {
|
|
10287
10303
|
log.info("Dry-run finished. Re-run with `--yes` to apply.");
|
|
10304
|
+
log.info('After applying, configure MCP with command `cdd-kit` and args ["mcp"] so agents use graph/code-map tools directly.');
|
|
10288
10305
|
}
|
|
10289
10306
|
log.blank();
|
|
10290
10307
|
}
|
|
@@ -10299,6 +10316,7 @@ var init_refresh = __esm({
|
|
|
10299
10316
|
init_upgrade();
|
|
10300
10317
|
init_code_map();
|
|
10301
10318
|
init_code_map_hook();
|
|
10319
|
+
init_mcp_hint();
|
|
10302
10320
|
HOOKS_MARKER_PATH = ".cdd/.hooks-installed";
|
|
10303
10321
|
}
|
|
10304
10322
|
});
|
|
@@ -11816,6 +11834,315 @@ var init_graph = __esm({
|
|
|
11816
11834
|
}
|
|
11817
11835
|
});
|
|
11818
11836
|
|
|
11837
|
+
// src/mcp/server.ts
|
|
11838
|
+
var server_exports = {};
|
|
11839
|
+
__export(server_exports, {
|
|
11840
|
+
runMcpServer: () => runMcpServer
|
|
11841
|
+
});
|
|
11842
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
11843
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
11844
|
+
import { createInterface } from "readline";
|
|
11845
|
+
async function runMcpServer(opts) {
|
|
11846
|
+
const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
11847
|
+
for await (const line of rl) {
|
|
11848
|
+
if (!line.trim())
|
|
11849
|
+
continue;
|
|
11850
|
+
let request;
|
|
11851
|
+
try {
|
|
11852
|
+
request = JSON.parse(line);
|
|
11853
|
+
} catch (err) {
|
|
11854
|
+
writeError(null, -32700, `Parse error: ${err.message}`);
|
|
11855
|
+
continue;
|
|
11856
|
+
}
|
|
11857
|
+
if (!request.method) {
|
|
11858
|
+
if ("id" in request)
|
|
11859
|
+
writeError(request.id ?? null, -32600, "Invalid Request: missing method");
|
|
11860
|
+
continue;
|
|
11861
|
+
}
|
|
11862
|
+
try {
|
|
11863
|
+
const result = await handleRequest(request, opts);
|
|
11864
|
+
if ("id" in request)
|
|
11865
|
+
writeResult(request.id ?? null, result);
|
|
11866
|
+
} catch (err) {
|
|
11867
|
+
if ("id" in request)
|
|
11868
|
+
writeError(request.id ?? null, -32e3, err.message);
|
|
11869
|
+
}
|
|
11870
|
+
}
|
|
11871
|
+
}
|
|
11872
|
+
async function handleRequest(request, opts) {
|
|
11873
|
+
switch (request.method) {
|
|
11874
|
+
case "initialize": {
|
|
11875
|
+
const params = asObject(request.params);
|
|
11876
|
+
return {
|
|
11877
|
+
protocolVersion: typeof params.protocolVersion === "string" ? params.protocolVersion : "2024-11-05",
|
|
11878
|
+
capabilities: {
|
|
11879
|
+
tools: { listChanged: false },
|
|
11880
|
+
resources: {},
|
|
11881
|
+
prompts: {}
|
|
11882
|
+
},
|
|
11883
|
+
serverInfo: {
|
|
11884
|
+
name: "cdd-kit",
|
|
11885
|
+
version: opts.version
|
|
11886
|
+
}
|
|
11887
|
+
};
|
|
11888
|
+
}
|
|
11889
|
+
case "ping":
|
|
11890
|
+
return {};
|
|
11891
|
+
case "tools/list":
|
|
11892
|
+
return { tools };
|
|
11893
|
+
case "tools/call": {
|
|
11894
|
+
const params = asObject(request.params);
|
|
11895
|
+
const name = requireString(params, "name");
|
|
11896
|
+
const args = asObject(params.arguments);
|
|
11897
|
+
return callTool(name, args);
|
|
11898
|
+
}
|
|
11899
|
+
case "resources/list":
|
|
11900
|
+
return { resources: [] };
|
|
11901
|
+
case "prompts/list":
|
|
11902
|
+
return { prompts: [] };
|
|
11903
|
+
case "notifications/initialized":
|
|
11904
|
+
return {};
|
|
11905
|
+
default:
|
|
11906
|
+
throw new Error(`Method not found: ${request.method}`);
|
|
11907
|
+
}
|
|
11908
|
+
}
|
|
11909
|
+
function callTool(name, args) {
|
|
11910
|
+
switch (name) {
|
|
11911
|
+
case "cdd_graph_status":
|
|
11912
|
+
return runCddJson([
|
|
11913
|
+
"graph",
|
|
11914
|
+
"status",
|
|
11915
|
+
"--engine",
|
|
11916
|
+
optionalString(args.engine, "auto"),
|
|
11917
|
+
"--map",
|
|
11918
|
+
optionalString(args.map, DEFAULT_MAP),
|
|
11919
|
+
"--json"
|
|
11920
|
+
]);
|
|
11921
|
+
case "cdd_graph_query":
|
|
11922
|
+
return runCddJson([
|
|
11923
|
+
"graph",
|
|
11924
|
+
"query",
|
|
11925
|
+
requireString(args, "query"),
|
|
11926
|
+
"--engine",
|
|
11927
|
+
optionalString(args.engine, "auto"),
|
|
11928
|
+
"--map",
|
|
11929
|
+
optionalString(args.map, DEFAULT_MAP),
|
|
11930
|
+
"--limit",
|
|
11931
|
+
String(optionalInt(args.limit, 10)),
|
|
11932
|
+
"--json",
|
|
11933
|
+
...refreshArgs(args)
|
|
11934
|
+
]);
|
|
11935
|
+
case "cdd_graph_context":
|
|
11936
|
+
return runCddJson([
|
|
11937
|
+
"graph",
|
|
11938
|
+
"context",
|
|
11939
|
+
requireString(args, "task"),
|
|
11940
|
+
"--engine",
|
|
11941
|
+
optionalString(args.engine, "auto"),
|
|
11942
|
+
"--map",
|
|
11943
|
+
optionalString(args.map, DEFAULT_MAP),
|
|
11944
|
+
"--max-nodes",
|
|
11945
|
+
String(optionalInt(args.maxNodes, 20)),
|
|
11946
|
+
"--json",
|
|
11947
|
+
...refreshArgs(args)
|
|
11948
|
+
]);
|
|
11949
|
+
case "cdd_graph_impact":
|
|
11950
|
+
return runCddJson([
|
|
11951
|
+
"graph",
|
|
11952
|
+
"impact",
|
|
11953
|
+
requireString(args, "target"),
|
|
11954
|
+
"--engine",
|
|
11955
|
+
optionalString(args.engine, "auto"),
|
|
11956
|
+
"--map",
|
|
11957
|
+
optionalString(args.map, DEFAULT_MAP),
|
|
11958
|
+
"--limit",
|
|
11959
|
+
String(optionalInt(args.limit, 20)),
|
|
11960
|
+
"--depth",
|
|
11961
|
+
String(optionalInt(args.depth, 2)),
|
|
11962
|
+
"--json",
|
|
11963
|
+
...refreshArgs(args)
|
|
11964
|
+
]);
|
|
11965
|
+
case "cdd_index_query":
|
|
11966
|
+
return runCddJson([
|
|
11967
|
+
"index",
|
|
11968
|
+
"query",
|
|
11969
|
+
requireString(args, "query"),
|
|
11970
|
+
"--map",
|
|
11971
|
+
optionalString(args.map, DEFAULT_MAP),
|
|
11972
|
+
"--limit",
|
|
11973
|
+
String(optionalInt(args.limit, 10)),
|
|
11974
|
+
"--json",
|
|
11975
|
+
...refreshArgs(args)
|
|
11976
|
+
]);
|
|
11977
|
+
case "cdd_index_impact":
|
|
11978
|
+
return runCddJson([
|
|
11979
|
+
"index",
|
|
11980
|
+
"impact",
|
|
11981
|
+
requireString(args, "target"),
|
|
11982
|
+
"--map",
|
|
11983
|
+
optionalString(args.map, DEFAULT_MAP),
|
|
11984
|
+
"--limit",
|
|
11985
|
+
String(optionalInt(args.limit, 20)),
|
|
11986
|
+
"--json",
|
|
11987
|
+
...refreshArgs(args)
|
|
11988
|
+
]);
|
|
11989
|
+
default:
|
|
11990
|
+
return {
|
|
11991
|
+
isError: true,
|
|
11992
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }]
|
|
11993
|
+
};
|
|
11994
|
+
}
|
|
11995
|
+
}
|
|
11996
|
+
function runCddJson(args) {
|
|
11997
|
+
const cliPath = process.argv[1] || fileURLToPath3(import.meta.url);
|
|
11998
|
+
const result = spawnSync4(process.execPath, [cliPath, ...args], {
|
|
11999
|
+
cwd: process.cwd(),
|
|
12000
|
+
env: process.env,
|
|
12001
|
+
encoding: "utf8"
|
|
12002
|
+
});
|
|
12003
|
+
const stdout = result.stdout?.trim() ?? "";
|
|
12004
|
+
const stderr = result.stderr?.trim() ?? "";
|
|
12005
|
+
const isError = !!result.error || (result.status ?? 1) !== 0;
|
|
12006
|
+
if (stdout) {
|
|
12007
|
+
return {
|
|
12008
|
+
isError: isError || void 0,
|
|
12009
|
+
content: [{ type: "text", text: stdout }]
|
|
12010
|
+
};
|
|
12011
|
+
}
|
|
12012
|
+
return {
|
|
12013
|
+
isError: true,
|
|
12014
|
+
content: [{ type: "text", text: result.error?.message || stderr || `cdd-kit exited with status ${result.status}` }]
|
|
12015
|
+
};
|
|
12016
|
+
}
|
|
12017
|
+
function refreshArgs(args) {
|
|
12018
|
+
return args.refresh === false ? ["--no-refresh"] : [];
|
|
12019
|
+
}
|
|
12020
|
+
function asObject(value) {
|
|
12021
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
12022
|
+
}
|
|
12023
|
+
function requireString(args, key) {
|
|
12024
|
+
const value = args[key];
|
|
12025
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
12026
|
+
throw new Error(`Missing required string argument: ${key}`);
|
|
12027
|
+
}
|
|
12028
|
+
return value;
|
|
12029
|
+
}
|
|
12030
|
+
function optionalString(value, fallback) {
|
|
12031
|
+
return typeof value === "string" && value.trim() ? value : fallback;
|
|
12032
|
+
}
|
|
12033
|
+
function optionalInt(value, fallback) {
|
|
12034
|
+
const parsed = typeof value === "number" ? value : typeof value === "string" ? Number.parseInt(value, 10) : fallback;
|
|
12035
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : fallback;
|
|
12036
|
+
}
|
|
12037
|
+
function writeResult(id, result) {
|
|
12038
|
+
process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id, result })}
|
|
12039
|
+
`);
|
|
12040
|
+
}
|
|
12041
|
+
function writeError(id, code, message) {
|
|
12042
|
+
process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id, error: { code, message } })}
|
|
12043
|
+
`);
|
|
12044
|
+
}
|
|
12045
|
+
var DEFAULT_MAP, tools;
|
|
12046
|
+
var init_server = __esm({
|
|
12047
|
+
"src/mcp/server.ts"() {
|
|
12048
|
+
"use strict";
|
|
12049
|
+
DEFAULT_MAP = ".cdd/code-map.yml";
|
|
12050
|
+
tools = [
|
|
12051
|
+
{
|
|
12052
|
+
name: "cdd_graph_status",
|
|
12053
|
+
description: "Show the active cdd-kit graph engine and code-map/code-graph freshness for the current workspace.",
|
|
12054
|
+
inputSchema: {
|
|
12055
|
+
type: "object",
|
|
12056
|
+
properties: {
|
|
12057
|
+
map: { type: "string", description: "Code-map YAML path.", default: DEFAULT_MAP },
|
|
12058
|
+
engine: { type: "string", enum: ["auto", "native", "codegraph", "codemap"], default: "auto" }
|
|
12059
|
+
},
|
|
12060
|
+
additionalProperties: false
|
|
12061
|
+
}
|
|
12062
|
+
},
|
|
12063
|
+
{
|
|
12064
|
+
name: "cdd_graph_query",
|
|
12065
|
+
description: "Search native graph symbols/files and return candidate nodes with line ranges.",
|
|
12066
|
+
inputSchema: {
|
|
12067
|
+
type: "object",
|
|
12068
|
+
properties: {
|
|
12069
|
+
query: { type: "string", description: "Symbol, file path, file stem, class, function, component, or route term." },
|
|
12070
|
+
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
|
12071
|
+
map: { type: "string", description: "Code-map YAML path.", default: DEFAULT_MAP },
|
|
12072
|
+
engine: { type: "string", enum: ["auto", "native", "codegraph", "codemap"], default: "auto" },
|
|
12073
|
+
refresh: { type: "boolean", default: true }
|
|
12074
|
+
},
|
|
12075
|
+
required: ["query"],
|
|
12076
|
+
additionalProperties: false
|
|
12077
|
+
}
|
|
12078
|
+
},
|
|
12079
|
+
{
|
|
12080
|
+
name: "cdd_graph_context",
|
|
12081
|
+
description: "Build graph-first task context from a task, symptom, or known feature term.",
|
|
12082
|
+
inputSchema: {
|
|
12083
|
+
type: "object",
|
|
12084
|
+
properties: {
|
|
12085
|
+
task: { type: "string", description: "Task, bug symptom, feature name, screen name, or domain term." },
|
|
12086
|
+
maxNodes: { type: "integer", minimum: 1, maximum: 100, default: 20 },
|
|
12087
|
+
map: { type: "string", description: "Code-map YAML path.", default: DEFAULT_MAP },
|
|
12088
|
+
engine: { type: "string", enum: ["auto", "native", "codegraph", "codemap"], default: "auto" },
|
|
12089
|
+
refresh: { type: "boolean", default: true }
|
|
12090
|
+
},
|
|
12091
|
+
required: ["task"],
|
|
12092
|
+
additionalProperties: false
|
|
12093
|
+
}
|
|
12094
|
+
},
|
|
12095
|
+
{
|
|
12096
|
+
name: "cdd_graph_impact",
|
|
12097
|
+
description: "Analyze callers, callees, imports, references, and dependents for a file or symbol before editing.",
|
|
12098
|
+
inputSchema: {
|
|
12099
|
+
type: "object",
|
|
12100
|
+
properties: {
|
|
12101
|
+
target: { type: "string", description: "Candidate file path, symbol, graph node id, or qualified name." },
|
|
12102
|
+
depth: { type: "integer", minimum: 1, maximum: 10, default: 2 },
|
|
12103
|
+
limit: { type: "integer", minimum: 1, maximum: 200, default: 20 },
|
|
12104
|
+
map: { type: "string", description: "Code-map YAML path.", default: DEFAULT_MAP },
|
|
12105
|
+
engine: { type: "string", enum: ["auto", "native", "codegraph", "codemap"], default: "auto" },
|
|
12106
|
+
refresh: { type: "boolean", default: true }
|
|
12107
|
+
},
|
|
12108
|
+
required: ["target"],
|
|
12109
|
+
additionalProperties: false
|
|
12110
|
+
}
|
|
12111
|
+
},
|
|
12112
|
+
{
|
|
12113
|
+
name: "cdd_index_query",
|
|
12114
|
+
description: "Fallback code-map query for files, symbols, imports, and line ranges.",
|
|
12115
|
+
inputSchema: {
|
|
12116
|
+
type: "object",
|
|
12117
|
+
properties: {
|
|
12118
|
+
query: { type: "string", description: "Symbol, file path, import module, enum member, or substring." },
|
|
12119
|
+
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
|
12120
|
+
map: { type: "string", description: "Code-map YAML path.", default: DEFAULT_MAP },
|
|
12121
|
+
refresh: { type: "boolean", default: true }
|
|
12122
|
+
},
|
|
12123
|
+
required: ["query"],
|
|
12124
|
+
additionalProperties: false
|
|
12125
|
+
}
|
|
12126
|
+
},
|
|
12127
|
+
{
|
|
12128
|
+
name: "cdd_index_impact",
|
|
12129
|
+
description: "Fallback code-map impact query for local imports and direct dependents.",
|
|
12130
|
+
inputSchema: {
|
|
12131
|
+
type: "object",
|
|
12132
|
+
properties: {
|
|
12133
|
+
target: { type: "string", description: "File path or unique symbol." },
|
|
12134
|
+
limit: { type: "integer", minimum: 1, maximum: 200, default: 20 },
|
|
12135
|
+
map: { type: "string", description: "Code-map YAML path.", default: DEFAULT_MAP },
|
|
12136
|
+
refresh: { type: "boolean", default: true }
|
|
12137
|
+
},
|
|
12138
|
+
required: ["target"],
|
|
12139
|
+
additionalProperties: false
|
|
12140
|
+
}
|
|
12141
|
+
}
|
|
12142
|
+
];
|
|
12143
|
+
}
|
|
12144
|
+
});
|
|
12145
|
+
|
|
11819
12146
|
// src/commands/archive.ts
|
|
11820
12147
|
var archive_exports = {};
|
|
11821
12148
|
__export(archive_exports, {
|
|
@@ -12358,7 +12685,7 @@ var init_context = __esm({
|
|
|
12358
12685
|
// src/cli/index.ts
|
|
12359
12686
|
import { readFileSync as readFileSync31 } from "fs";
|
|
12360
12687
|
import os from "os";
|
|
12361
|
-
import { fileURLToPath as
|
|
12688
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
12362
12689
|
import { dirname as dirname7, join as join30 } from "path";
|
|
12363
12690
|
import { Command } from "commander";
|
|
12364
12691
|
|
|
@@ -12534,6 +12861,7 @@ function detectStack(repoRoot) {
|
|
|
12534
12861
|
}
|
|
12535
12862
|
|
|
12536
12863
|
// src/commands/init.ts
|
|
12864
|
+
init_mcp_hint();
|
|
12537
12865
|
function readCondaEnvName(cwd) {
|
|
12538
12866
|
const envYml = join5(cwd, "environment.yml");
|
|
12539
12867
|
if (!existsSync4(envYml))
|
|
@@ -12771,6 +13099,7 @@ async function init(opts) {
|
|
|
12771
13099
|
} else {
|
|
12772
13100
|
log.info("Use the contract-driven-delivery skill in Claude Code to scan this repo.");
|
|
12773
13101
|
}
|
|
13102
|
+
logRecommendedMcpSetup();
|
|
12774
13103
|
log.blank();
|
|
12775
13104
|
}
|
|
12776
13105
|
|
|
@@ -13464,7 +13793,7 @@ async function installHooks() {
|
|
|
13464
13793
|
}
|
|
13465
13794
|
|
|
13466
13795
|
// src/cli/index.ts
|
|
13467
|
-
var __dirname2 = dirname7(
|
|
13796
|
+
var __dirname2 = dirname7(fileURLToPath4(import.meta.url));
|
|
13468
13797
|
var pkg = JSON.parse(readFileSync31(join30(__dirname2, "..", "..", "package.json"), "utf8"));
|
|
13469
13798
|
var program = new Command();
|
|
13470
13799
|
program.name("cdd-kit").description("Contract-Driven Delivery Kit CLI").version(pkg.version);
|
|
@@ -13622,6 +13951,10 @@ graph.command("context <task>").description("Build task context with native grap
|
|
|
13622
13951
|
});
|
|
13623
13952
|
process.exit(exit);
|
|
13624
13953
|
});
|
|
13954
|
+
program.command("mcp").description("Run the cdd-kit MCP stdio server exposing graph and code-map tools").action(async () => {
|
|
13955
|
+
const { runMcpServer: runMcpServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
13956
|
+
await runMcpServer2({ version: pkg.version });
|
|
13957
|
+
});
|
|
13625
13958
|
program.command("gate <change-id>").description("Run delivery-quality gate for a change (required artifacts, tasks, tier, contracts)").option("--strict", "Treat pending tasks (except section 7) as errors", false).action(async (id, opts) => {
|
|
13626
13959
|
await gate(id, { strict: opts.strict });
|
|
13627
13960
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contract-driven-delivery",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Contract-driven delivery kit for AI coding agents with deterministic context indexes, manifest-backed read-scope governance, and orchestrated contracts-first delivery.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contract-driven",
|