@shrkcrft/mcp-server 0.1.0-alpha.2 → 0.1.0-alpha.21
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/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/server/columnar-format.d.ts +34 -0
- package/dist/server/columnar-format.d.ts.map +1 -0
- package/dist/server/columnar-format.js +95 -0
- package/dist/server/create-mcp-server.d.ts +3 -0
- package/dist/server/create-mcp-server.d.ts.map +1 -1
- package/dist/server/create-mcp-server.js +24 -9
- package/dist/server/fit-array-to-budget.d.ts +24 -0
- package/dist/server/fit-array-to-budget.d.ts.map +1 -0
- package/dist/server/fit-array-to-budget.js +60 -0
- package/dist/server/serialize-tool-data.d.ts +15 -0
- package/dist/server/serialize-tool-data.d.ts.map +1 -0
- package/dist/server/serialize-tool-data.js +22 -0
- package/dist/server/tool-definition.d.ts +15 -0
- package/dist/server/tool-definition.d.ts.map +1 -1
- package/dist/server/tool-input-validators.d.ts.map +1 -1
- package/dist/server/tool-input-validators.js +43 -0
- package/dist/tools/agent-brief.tool.d.ts.map +1 -1
- package/dist/tools/agent-brief.tool.js +20 -0
- package/dist/tools/align-cache.tool.d.ts +11 -0
- package/dist/tools/align-cache.tool.d.ts.map +1 -0
- package/dist/tools/align-cache.tool.js +76 -0
- package/dist/tools/all-tools.d.ts.map +1 -1
- package/dist/tools/all-tools.js +72 -7
- package/dist/tools/architecture-map.tool.d.ts.map +1 -1
- package/dist/tools/architecture-map.tool.js +4 -2
- package/dist/tools/code-find-usages.tool.d.ts +16 -0
- package/dist/tools/code-find-usages.tool.d.ts.map +1 -0
- package/dist/tools/code-find-usages.tool.js +180 -0
- package/dist/tools/command-catalog.tool.d.ts.map +1 -1
- package/dist/tools/command-catalog.tool.js +11 -7
- package/dist/tools/compress-context.tool.d.ts +8 -0
- package/dist/tools/compress-context.tool.d.ts.map +1 -0
- package/dist/tools/compress-context.tool.js +81 -0
- package/dist/tools/dashboard-summary.tool.d.ts.map +1 -1
- package/dist/tools/dashboard-summary.tool.js +2 -4
- package/dist/tools/delegate-task.tool.d.ts +3 -0
- package/dist/tools/delegate-task.tool.d.ts.map +1 -0
- package/dist/tools/delegate-task.tool.js +94 -0
- package/dist/tools/deps-audit.tool.d.ts +10 -0
- package/dist/tools/deps-audit.tool.d.ts.map +1 -0
- package/dist/tools/deps-audit.tool.js +251 -0
- package/dist/tools/diff-check.tool.d.ts +15 -0
- package/dist/tools/diff-check.tool.d.ts.map +1 -0
- package/dist/tools/diff-check.tool.js +157 -0
- package/dist/tools/file-advice.tool.d.ts +22 -0
- package/dist/tools/file-advice.tool.d.ts.map +1 -0
- package/dist/tools/file-advice.tool.js +88 -0
- package/dist/tools/get-api-surface-diff.tool.d.ts +3 -0
- package/dist/tools/get-api-surface-diff.tool.d.ts.map +1 -0
- package/dist/tools/get-api-surface-diff.tool.js +60 -0
- package/dist/tools/get-arch-violations.tool.d.ts +3 -0
- package/dist/tools/get-arch-violations.tool.d.ts.map +1 -0
- package/dist/tools/get-arch-violations.tool.js +30 -0
- package/dist/tools/get-code-intelligence-state.tool.d.ts +11 -0
- package/dist/tools/get-code-intelligence-state.tool.d.ts.map +1 -0
- package/dist/tools/get-code-intelligence-state.tool.js +60 -0
- package/dist/tools/get-context-pack.tool.d.ts +3 -0
- package/dist/tools/get-context-pack.tool.d.ts.map +1 -0
- package/dist/tools/get-context-pack.tool.js +40 -0
- package/dist/tools/get-framework-entities.tool.d.ts +3 -0
- package/dist/tools/get-framework-entities.tool.d.ts.map +1 -0
- package/dist/tools/get-framework-entities.tool.js +68 -0
- package/dist/tools/get-graph-callers.tool.d.ts +3 -0
- package/dist/tools/get-graph-callers.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-callers.tool.js +94 -0
- package/dist/tools/get-graph-context.tool.d.ts +3 -0
- package/dist/tools/get-graph-context.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-context.tool.js +125 -0
- package/dist/tools/get-graph-cycles.tool.d.ts +10 -0
- package/dist/tools/get-graph-cycles.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-cycles.tool.js +58 -0
- package/dist/tools/get-graph-deps.tool.d.ts +12 -0
- package/dist/tools/get-graph-deps.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-deps.tool.js +80 -0
- package/dist/tools/get-graph-hubs.tool.d.ts +3 -0
- package/dist/tools/get-graph-hubs.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-hubs.tool.js +61 -0
- package/dist/tools/get-graph-impact-analysis.tool.d.ts +3 -0
- package/dist/tools/get-graph-impact-analysis.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-impact-analysis.tool.js +44 -0
- package/dist/tools/get-graph-impact.tool.d.ts +3 -0
- package/dist/tools/get-graph-impact.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-impact.tool.js +150 -0
- package/dist/tools/get-graph-path.tool.d.ts +3 -0
- package/dist/tools/get-graph-path.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-path.tool.js +144 -0
- package/dist/tools/get-graph-search.tool.d.ts +3 -0
- package/dist/tools/get-graph-search.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-search.tool.js +95 -0
- package/dist/tools/get-graph-status.tool.d.ts +11 -0
- package/dist/tools/get-graph-status.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-status.tool.js +55 -0
- package/dist/tools/get-graph-unresolved.tool.d.ts +11 -0
- package/dist/tools/get-graph-unresolved.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-unresolved.tool.js +85 -0
- package/dist/tools/get-impact-baseline.tool.d.ts +9 -0
- package/dist/tools/get-impact-baseline.tool.d.ts.map +1 -0
- package/dist/tools/get-impact-baseline.tool.js +65 -0
- package/dist/tools/get-intent-benchmark-run.tool.d.ts +12 -0
- package/dist/tools/get-intent-benchmark-run.tool.d.ts.map +1 -0
- package/dist/tools/get-intent-benchmark-run.tool.js +55 -0
- package/dist/tools/get-knowledge-graph.tool.d.ts +7 -0
- package/dist/tools/get-knowledge-graph.tool.d.ts.map +1 -1
- package/dist/tools/get-knowledge-graph.tool.js +62 -3
- package/dist/tools/get-migrations.tool.d.ts +3 -0
- package/dist/tools/get-migrations.tool.d.ts.map +1 -0
- package/dist/tools/get-migrations.tool.js +70 -0
- package/dist/tools/get-pattern-registry.tool.d.ts +8 -0
- package/dist/tools/get-pattern-registry.tool.d.ts.map +1 -0
- package/dist/tools/get-pattern-registry.tool.js +40 -0
- package/dist/tools/get-quality-gate.tool.d.ts +3 -0
- package/dist/tools/get-quality-gate.tool.d.ts.map +1 -0
- package/dist/tools/get-quality-gate.tool.js +27 -0
- package/dist/tools/get-relevant-context.tool.d.ts.map +1 -1
- package/dist/tools/get-relevant-context.tool.js +30 -6
- package/dist/tools/get-rules-for-file.tool.d.ts +3 -0
- package/dist/tools/get-rules-for-file.tool.d.ts.map +1 -0
- package/dist/tools/get-rules-for-file.tool.js +54 -0
- package/dist/tools/get-structural-rewrite-plan.tool.d.ts +3 -0
- package/dist/tools/get-structural-rewrite-plan.tool.d.ts.map +1 -0
- package/dist/tools/get-structural-rewrite-plan.tool.js +46 -0
- package/dist/tools/get-structural-search.tool.d.ts +3 -0
- package/dist/tools/get-structural-search.tool.d.ts.map +1 -0
- package/dist/tools/get-structural-search.tool.js +35 -0
- package/dist/tools/get-task-packet.tool.d.ts.map +1 -1
- package/dist/tools/get-task-packet.tool.js +26 -22
- package/dist/tools/graph-staleness.d.ts +34 -0
- package/dist/tools/graph-staleness.d.ts.map +1 -0
- package/dist/tools/graph-staleness.js +36 -0
- package/dist/tools/list-boundary-rules.tool.d.ts.map +1 -1
- package/dist/tools/list-boundary-rules.tool.js +20 -16
- package/dist/tools/list-knowledge.tool.d.ts.map +1 -1
- package/dist/tools/list-knowledge.tool.js +14 -13
- package/dist/tools/list-packs.tool.d.ts.map +1 -1
- package/dist/tools/list-packs.tool.js +19 -15
- package/dist/tools/list-path-conventions.tool.d.ts.map +1 -1
- package/dist/tools/list-path-conventions.tool.js +19 -15
- package/dist/tools/list-pipelines.tool.d.ts.map +1 -1
- package/dist/tools/list-pipelines.tool.js +18 -14
- package/dist/tools/list-presets.tool.d.ts.map +1 -1
- package/dist/tools/list-presets.tool.js +25 -21
- package/dist/tools/list-rules.tool.d.ts.map +1 -1
- package/dist/tools/list-rules.tool.js +18 -14
- package/dist/tools/list-templates.tool.d.ts.map +1 -1
- package/dist/tools/list-templates.tool.js +18 -14
- package/dist/tools/plan-quality-review.tool.d.ts +21 -0
- package/dist/tools/plan-quality-review.tool.d.ts.map +1 -0
- package/dist/tools/plan-quality-review.tool.js +294 -0
- package/dist/tools/primary-tools.d.ts +24 -0
- package/dist/tools/primary-tools.d.ts.map +1 -0
- package/dist/tools/primary-tools.js +86 -0
- package/dist/tools/r19-extras.tool.js +1 -1
- package/dist/tools/r32-profiles.tool.d.ts +0 -3
- package/dist/tools/r32-profiles.tool.d.ts.map +1 -1
- package/dist/tools/r32-profiles.tool.js +3 -54
- package/dist/tools/retrieve-original.tool.d.ts +9 -0
- package/dist/tools/retrieve-original.tool.d.ts.map +1 -0
- package/dist/tools/retrieve-original.tool.js +47 -0
- package/dist/tools/runtime-reports.tool.d.ts.map +1 -1
- package/dist/tools/runtime-reports.tool.js +1 -3
- package/dist/tools/safety-audit.tool.d.ts.map +1 -1
- package/dist/tools/safety-audit.tool.js +1 -4
- package/dist/tools/search-knowledge.tool.d.ts.map +1 -1
- package/dist/tools/search-knowledge.tool.js +17 -13
- package/dist/tools/search.tool.d.ts.map +1 -1
- package/dist/tools/search.tool.js +11 -8
- package/dist/tools/smart-context-bundle.tool.d.ts +17 -0
- package/dist/tools/smart-context-bundle.tool.d.ts.map +1 -0
- package/dist/tools/smart-context-bundle.tool.js +110 -0
- package/dist/tools/smart-context-feed.tool.d.ts +17 -0
- package/dist/tools/smart-context-feed.tool.d.ts.map +1 -0
- package/dist/tools/smart-context-feed.tool.js +138 -0
- package/dist/tools/start-here.tool.js +2 -2
- package/package.json +28 -16
- package/dist/tools/r22-extras.tool.d.ts +0 -4
- package/dist/tools/r22-extras.tool.d.ts.map +0 -1
- package/dist/tools/r22-extras.tool.js +0 -42
- package/dist/tools/r26-ingest.tool.d.ts +0 -10
- package/dist/tools/r26-ingest.tool.d.ts.map +0 -1
- package/dist/tools/r26-ingest.tool.js +0 -174
- package/dist/tools/r28-plugin-lifecycle.tool.d.ts +0 -4
- package/dist/tools/r28-plugin-lifecycle.tool.d.ts.map +0 -1
- package/dist/tools/r28-plugin-lifecycle.tool.js +0 -94
- package/dist/tools/r34-search-unified.tool.d.ts +0 -3
- package/dist/tools/r34-search-unified.tool.d.ts.map +0 -1
- package/dist/tools/r34-search-unified.tool.js +0 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search.tool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search.tool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,eAAO,MAAM,aAAa,EAAE,eA4C3B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { buildSearchIndex, loadConstructs, loadPlaybooks, searchIndex, SearchKind, SearchSource, } from '@shrkcrft/inspector';
|
|
2
|
+
import { FORMAT_INPUT_PROPERTY, formatObjectArrays } from "../server/columnar-format.js";
|
|
2
3
|
export const searchAllTool = {
|
|
3
4
|
name: 'search_all',
|
|
4
|
-
description: 'Unified, deterministic search across knowledge, rules, paths, templates, pipelines, presets, packs, boundaries, docs, sessions, bundles, constructs, and playbooks. No AI / embeddings — pure ranking. Read-only.',
|
|
5
|
+
description: 'Unified, deterministic search across knowledge, rules, paths, templates, pipelines, presets, packs, boundaries, docs, sessions, bundles, constructs, and playbooks. No AI / embeddings — pure ranking. Pass `format:"table"` for a token-efficient columnar encoding of the `hits` array. Read-only.',
|
|
5
6
|
inputSchema: {
|
|
6
7
|
type: 'object',
|
|
7
8
|
required: ['query'],
|
|
@@ -11,6 +12,7 @@ export const searchAllTool = {
|
|
|
11
12
|
sources: { type: 'array', items: { type: 'string' } },
|
|
12
13
|
limit: { type: 'number' },
|
|
13
14
|
explain: { type: 'boolean' },
|
|
15
|
+
...FORMAT_INPUT_PROPERTY,
|
|
14
16
|
},
|
|
15
17
|
additionalProperties: false,
|
|
16
18
|
},
|
|
@@ -33,13 +35,14 @@ export const searchAllTool = {
|
|
|
33
35
|
if (sources.length > 0)
|
|
34
36
|
opts.sources = sources;
|
|
35
37
|
const result = searchIndex(index, opts);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
hits: result.hits,
|
|
42
|
-
},
|
|
38
|
+
const data = {
|
|
39
|
+
query: result.query,
|
|
40
|
+
total: result.total,
|
|
41
|
+
truncated: result.truncated,
|
|
42
|
+
hits: result.hits,
|
|
43
43
|
};
|
|
44
|
+
// `format:"table"` columnar-encodes the homogeneous `hits` array; the
|
|
45
|
+
// scalar fields (query/total/truncated) pass through untouched.
|
|
46
|
+
return { data: formatObjectArrays(data, input) };
|
|
44
47
|
},
|
|
45
48
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IToolDefinition } from '../server/tool-definition.js';
|
|
2
|
+
/**
|
|
3
|
+
* `smart_context_bundle` — read-only MCP surface for the focused
|
|
4
|
+
* context bundle that `shrk smart-context --focused` builds.
|
|
5
|
+
*
|
|
6
|
+
* The agent calls this with a task string. The tool runs BGE-based
|
|
7
|
+
* semantic search, declaration extraction, and re-ranking against
|
|
8
|
+
* the existing on-disk embedding index, then returns the bundle as
|
|
9
|
+
* JSON plus a hint pointing at the CLI commands the agent should
|
|
10
|
+
* run next.
|
|
11
|
+
*
|
|
12
|
+
* No writes. No LLM calls. If the index has not been built yet the
|
|
13
|
+
* tool returns a structured error pointing to
|
|
14
|
+
* `shrk smart-context embeddings-build`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const smartContextBundleTool: IToolDefinition;
|
|
17
|
+
//# sourceMappingURL=smart-context-bundle.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-context-bundle.tool.d.ts","sourceRoot":"","sources":["../../src/tools/smart-context-bundle.tool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAiFpC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { buildTaskPacket } from '@shrkcrft/inspector';
|
|
2
|
+
import { SemanticIndex, TaskType, buildFocusedContext, classifyTask, parseTaskTypeOverride, } from '@shrkcrft/embeddings';
|
|
3
|
+
import { FORMAT_INPUT_PROPERTY, formatObjectArrays } from "../server/columnar-format.js";
|
|
4
|
+
/**
|
|
5
|
+
* `smart_context_bundle` — read-only MCP surface for the focused
|
|
6
|
+
* context bundle that `shrk smart-context --focused` builds.
|
|
7
|
+
*
|
|
8
|
+
* The agent calls this with a task string. The tool runs BGE-based
|
|
9
|
+
* semantic search, declaration extraction, and re-ranking against
|
|
10
|
+
* the existing on-disk embedding index, then returns the bundle as
|
|
11
|
+
* JSON plus a hint pointing at the CLI commands the agent should
|
|
12
|
+
* run next.
|
|
13
|
+
*
|
|
14
|
+
* No writes. No LLM calls. If the index has not been built yet the
|
|
15
|
+
* tool returns a structured error pointing to
|
|
16
|
+
* `shrk smart-context embeddings-build`.
|
|
17
|
+
*/
|
|
18
|
+
export const smartContextBundleTool = {
|
|
19
|
+
name: 'smart_context_bundle',
|
|
20
|
+
description: 'Build a task-focused context bundle (semantic-ranked code blocks + rules + doc hits + validation commands). Read-only.',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
task: { type: 'string' },
|
|
25
|
+
taskType: { type: 'string' },
|
|
26
|
+
maxBlocks: { type: 'number' },
|
|
27
|
+
...FORMAT_INPUT_PROPERTY,
|
|
28
|
+
},
|
|
29
|
+
required: ['task'],
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
async handler(input, ctx) {
|
|
33
|
+
const task = typeof input['task'] === 'string' ? input['task'].trim() : '';
|
|
34
|
+
if (task.length === 0) {
|
|
35
|
+
return {
|
|
36
|
+
data: {
|
|
37
|
+
error: 'task is required',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const overrideRaw = typeof input['taskType'] === 'string' ? input['taskType'] : undefined;
|
|
42
|
+
const taskTypeOverride = parseTaskTypeOverride(overrideRaw);
|
|
43
|
+
const maxBlocks = typeof input['maxBlocks'] === 'number' ? input['maxBlocks'] : 10;
|
|
44
|
+
const index = await SemanticIndex.tryLoad(ctx.cwd);
|
|
45
|
+
if (!index) {
|
|
46
|
+
return {
|
|
47
|
+
data: {
|
|
48
|
+
error: 'no-semantic-index',
|
|
49
|
+
message: 'The semantic index has not been built for this workspace yet. The agent should ask the human to run the CLI command below.',
|
|
50
|
+
nextCommand: 'shrk smart-context embeddings-build',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const classification = taskTypeOverride
|
|
55
|
+
? { type: taskTypeOverride, confidence: 1, signals: ['override'], scores: {} }
|
|
56
|
+
: classifyTask(task);
|
|
57
|
+
const packet = buildTaskPacket(ctx.inspection, task, { maxTokens: 3500 });
|
|
58
|
+
const focused = await buildFocusedContext({
|
|
59
|
+
cwd: ctx.cwd,
|
|
60
|
+
task,
|
|
61
|
+
index,
|
|
62
|
+
rules: packet.relevantRules,
|
|
63
|
+
verificationCommands: packet.verificationCommands,
|
|
64
|
+
maxBlocks: Math.max(2, Math.min(20, maxBlocks)),
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
data: {
|
|
68
|
+
task,
|
|
69
|
+
taskType: classification.type,
|
|
70
|
+
classification: {
|
|
71
|
+
type: classification.type,
|
|
72
|
+
confidence: classification.confidence,
|
|
73
|
+
signals: classification.signals.slice(0, 6),
|
|
74
|
+
},
|
|
75
|
+
focused: formatObjectArrays({
|
|
76
|
+
model: focused.model,
|
|
77
|
+
approxTokens: focused.approxTokens,
|
|
78
|
+
files: focused.files,
|
|
79
|
+
rules: focused.rules,
|
|
80
|
+
docHits: focused.docHits,
|
|
81
|
+
verificationCommands: focused.verificationCommands,
|
|
82
|
+
}, input),
|
|
83
|
+
nextCommands: nextCommandHints(task, classification.type),
|
|
84
|
+
notes: [
|
|
85
|
+
'This bundle is read-only. To turn the recommended MVP into starter files, the human should run `shrk smart-context "<task>" --focused --plan --save` followed by `shrk spike <slug>`.',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
function nextCommandHints(task, taskType) {
|
|
92
|
+
const quotedTask = JSON.stringify(task);
|
|
93
|
+
if (taskType === TaskType.Architecture) {
|
|
94
|
+
return [
|
|
95
|
+
`shrk smart-context ${quotedTask} --focused --plan --save`,
|
|
96
|
+
`shrk smart-context list # find the saved slug`,
|
|
97
|
+
`shrk spike <slug> # scaffold the recommended MVP`,
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
if (taskType === TaskType.Investigation) {
|
|
101
|
+
return [
|
|
102
|
+
`shrk smart-context ${quotedTask} --focused --save`,
|
|
103
|
+
`shrk graph why <a> <b> # trace structural relationships`,
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
return [
|
|
107
|
+
`shrk smart-context ${quotedTask} --focused --plan --save`,
|
|
108
|
+
`shrk spike <slug> # if the plan has a firstSpike`,
|
|
109
|
+
];
|
|
110
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IToolDefinition } from '../server/tool-definition.js';
|
|
2
|
+
/**
|
|
3
|
+
* `smart_context_feed` — read-only MCP surface for an active
|
|
4
|
+
* `shrk watch` JSONL feed.
|
|
5
|
+
*
|
|
6
|
+
* Two modes:
|
|
7
|
+
* - `list` → returns active watch manifests under .sharkcraft/feed/.
|
|
8
|
+
* - `tail` → returns the JSONL tail of one slug, optionally
|
|
9
|
+
* filtered by `since` (emittedAt ISO timestamp) or `tailLines`.
|
|
10
|
+
*
|
|
11
|
+
* The agent uses `list` first to discover which watcher is running for
|
|
12
|
+
* which task, then `tail` to pull new packets since the last call.
|
|
13
|
+
* Nothing is written; the daemon CLI (`shrk watch`) is the only
|
|
14
|
+
* producer.
|
|
15
|
+
*/
|
|
16
|
+
export declare const smartContextFeedTool: IToolDefinition;
|
|
17
|
+
//# sourceMappingURL=smart-context-feed.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-context-feed.tool.d.ts","sourceRoot":"","sources":["../../src/tools/smart-context-feed.tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,EAAE,eA+BlC,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
const FEED_DIR = nodePath.join('.sharkcraft', 'feed');
|
|
4
|
+
const MANIFEST_SCHEMA = 'sharkcraft.shrk-watch-manifest/v1';
|
|
5
|
+
/**
|
|
6
|
+
* `smart_context_feed` — read-only MCP surface for an active
|
|
7
|
+
* `shrk watch` JSONL feed.
|
|
8
|
+
*
|
|
9
|
+
* Two modes:
|
|
10
|
+
* - `list` → returns active watch manifests under .sharkcraft/feed/.
|
|
11
|
+
* - `tail` → returns the JSONL tail of one slug, optionally
|
|
12
|
+
* filtered by `since` (emittedAt ISO timestamp) or `tailLines`.
|
|
13
|
+
*
|
|
14
|
+
* The agent uses `list` first to discover which watcher is running for
|
|
15
|
+
* which task, then `tail` to pull new packets since the last call.
|
|
16
|
+
* Nothing is written; the daemon CLI (`shrk watch`) is the only
|
|
17
|
+
* producer.
|
|
18
|
+
*/
|
|
19
|
+
export const smartContextFeedTool = {
|
|
20
|
+
name: 'smart_context_feed',
|
|
21
|
+
description: 'Poll the JSONL feed of an active `shrk watch` daemon. Read-only. Use mode="list" to discover slugs and mode="tail" to pull packets.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
mode: { type: 'string' },
|
|
26
|
+
slug: { type: 'string' },
|
|
27
|
+
since: { type: 'string' },
|
|
28
|
+
tailLines: { type: 'number' },
|
|
29
|
+
},
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
async handler(input, ctx) {
|
|
33
|
+
const mode = typeof input['mode'] === 'string' ? input['mode'] : 'list';
|
|
34
|
+
if (mode !== 'list' && mode !== 'tail') {
|
|
35
|
+
return { data: { error: 'invalid-mode', valid: ['list', 'tail'] } };
|
|
36
|
+
}
|
|
37
|
+
const dir = nodePath.join(ctx.cwd, FEED_DIR);
|
|
38
|
+
if (mode === 'list') {
|
|
39
|
+
return { data: listFeeds(dir) };
|
|
40
|
+
}
|
|
41
|
+
const slug = typeof input['slug'] === 'string' ? input['slug'].trim() : '';
|
|
42
|
+
if (slug.length === 0) {
|
|
43
|
+
return { data: { error: 'slug is required for mode=tail' } };
|
|
44
|
+
}
|
|
45
|
+
const since = typeof input['since'] === 'string' ? input['since'] : undefined;
|
|
46
|
+
const tailLines = typeof input['tailLines'] === 'number' ? input['tailLines'] : 50;
|
|
47
|
+
return { data: tailFeed(dir, slug, { since, tailLines }) };
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
function listFeeds(dir) {
|
|
51
|
+
if (!existsSync(dir))
|
|
52
|
+
return { active: [], stale: [] };
|
|
53
|
+
const active = [];
|
|
54
|
+
const stale = [];
|
|
55
|
+
let entries = [];
|
|
56
|
+
try {
|
|
57
|
+
entries = readdirSync(dir);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return { active: [], stale: [] };
|
|
61
|
+
}
|
|
62
|
+
for (const name of entries) {
|
|
63
|
+
if (!name.endsWith('.pid.json'))
|
|
64
|
+
continue;
|
|
65
|
+
const path = nodePath.join(dir, name);
|
|
66
|
+
let m;
|
|
67
|
+
try {
|
|
68
|
+
m = JSON.parse(readFileSync(path, 'utf8'));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (m.schema !== MANIFEST_SCHEMA || typeof m.pid !== 'number')
|
|
74
|
+
continue;
|
|
75
|
+
const summary = {
|
|
76
|
+
slug: m.slug ?? '',
|
|
77
|
+
pid: m.pid,
|
|
78
|
+
task: m.task ?? '',
|
|
79
|
+
startedAt: m.startedAt ?? '',
|
|
80
|
+
feedPath: m.feedPath ?? '',
|
|
81
|
+
alive: isProcessAlive(m.pid),
|
|
82
|
+
feedExists: m.feedPath ? existsSync(m.feedPath) : false,
|
|
83
|
+
};
|
|
84
|
+
(summary.alive ? active : stale).push(summary);
|
|
85
|
+
}
|
|
86
|
+
return { active, stale };
|
|
87
|
+
}
|
|
88
|
+
function tailFeed(dir, slug, options) {
|
|
89
|
+
const feedPath = nodePath.join(dir, `${slug}.jsonl`);
|
|
90
|
+
if (!existsSync(feedPath)) {
|
|
91
|
+
return { slug, feedPath, packets: [], totalLines: 0, filteredOut: 0, feedExists: false };
|
|
92
|
+
}
|
|
93
|
+
let body;
|
|
94
|
+
try {
|
|
95
|
+
body = readFileSync(feedPath, 'utf8');
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return { slug, feedPath, packets: [], totalLines: 0, filteredOut: 0, feedExists: true };
|
|
99
|
+
}
|
|
100
|
+
const rawLines = body.split('\n').filter((l) => l.trim().length > 0);
|
|
101
|
+
const packets = [];
|
|
102
|
+
let filteredOut = 0;
|
|
103
|
+
for (const line of rawLines) {
|
|
104
|
+
try {
|
|
105
|
+
const p = JSON.parse(line);
|
|
106
|
+
if (options.since) {
|
|
107
|
+
const emittedAt = typeof p['emittedAt'] === 'string' ? p['emittedAt'] : '';
|
|
108
|
+
if (emittedAt && emittedAt <= options.since) {
|
|
109
|
+
filteredOut += 1;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
packets.push(p);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
filteredOut += 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Keep only the trailing N once filtered.
|
|
120
|
+
const tailed = options.tailLines > 0 ? packets.slice(-options.tailLines) : packets;
|
|
121
|
+
return {
|
|
122
|
+
slug,
|
|
123
|
+
feedPath,
|
|
124
|
+
packets: tailed,
|
|
125
|
+
totalLines: rawLines.length,
|
|
126
|
+
filteredOut,
|
|
127
|
+
feedExists: true,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function isProcessAlive(pid) {
|
|
131
|
+
try {
|
|
132
|
+
process.kill(pid, 0);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { buildStartHereReport, buildPrimaryCommandsReport, } from '@shrkcrft/inspector';
|
|
2
2
|
export const getStartHereTool = {
|
|
3
3
|
name: 'get_start_here',
|
|
4
|
-
description: 'Return the SharkCraft start-here flow list (30-second explanation +
|
|
4
|
+
description: 'Return the SharkCraft start-here flow list (30-second explanation + primary flows incl. "investigate existing code" + safety pledge). Read-only.',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: 'object',
|
|
7
7
|
properties: {
|
|
8
8
|
flow: {
|
|
9
9
|
type: 'string',
|
|
10
|
-
enum: ['onboard', 'brief', 'dev', 'review', 'governance', 'packs', 'release'],
|
|
10
|
+
enum: ['onboard', 'investigate', 'brief', 'dev', 'review', 'governance', 'packs', 'release'],
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
13
|
additionalProperties: false,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/mcp-server",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
4
4
|
"description": "SharkCraft MCP server: 25 tools over @modelcontextprotocol/sdk's stdio transport.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
@@ -44,20 +44,32 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/
|
|
49
|
-
"@shrkcrft/
|
|
50
|
-
"@shrkcrft/
|
|
51
|
-
"@shrkcrft/
|
|
52
|
-
"@shrkcrft/
|
|
53
|
-
"@shrkcrft/
|
|
54
|
-
"@shrkcrft/
|
|
55
|
-
"@shrkcrft/
|
|
56
|
-
"@shrkcrft/
|
|
57
|
-
"@shrkcrft/
|
|
58
|
-
"@shrkcrft/
|
|
59
|
-
"@shrkcrft/
|
|
60
|
-
"@shrkcrft/
|
|
47
|
+
"@shrkcrft/core": "^0.1.0-alpha.21",
|
|
48
|
+
"@shrkcrft/compress": "^0.1.0-alpha.21",
|
|
49
|
+
"@shrkcrft/config": "^0.1.0-alpha.21",
|
|
50
|
+
"@shrkcrft/workspace": "^0.1.0-alpha.21",
|
|
51
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.21",
|
|
52
|
+
"@shrkcrft/context": "^0.1.0-alpha.21",
|
|
53
|
+
"@shrkcrft/rules": "^0.1.0-alpha.21",
|
|
54
|
+
"@shrkcrft/paths": "^0.1.0-alpha.21",
|
|
55
|
+
"@shrkcrft/templates": "^0.1.0-alpha.21",
|
|
56
|
+
"@shrkcrft/pipelines": "^0.1.0-alpha.21",
|
|
57
|
+
"@shrkcrft/presets": "^0.1.0-alpha.21",
|
|
58
|
+
"@shrkcrft/boundaries": "^0.1.0-alpha.21",
|
|
59
|
+
"@shrkcrft/graph": "^0.1.0-alpha.21",
|
|
60
|
+
"@shrkcrft/rule-graph": "^0.1.0-alpha.21",
|
|
61
|
+
"@shrkcrft/structural-search": "^0.1.0-alpha.21",
|
|
62
|
+
"@shrkcrft/impact-engine": "^0.1.0-alpha.21",
|
|
63
|
+
"@shrkcrft/context-planner": "^0.1.0-alpha.21",
|
|
64
|
+
"@shrkcrft/architecture-guard": "^0.1.0-alpha.21",
|
|
65
|
+
"@shrkcrft/framework-scanners": "^0.1.0-alpha.21",
|
|
66
|
+
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.21",
|
|
67
|
+
"@shrkcrft/quality-gates": "^0.1.0-alpha.21",
|
|
68
|
+
"@shrkcrft/migrate": "^0.1.0-alpha.21",
|
|
69
|
+
"@shrkcrft/packs": "^0.1.0-alpha.21",
|
|
70
|
+
"@shrkcrft/generator": "^0.1.0-alpha.21",
|
|
71
|
+
"@shrkcrft/inspector": "^0.1.0-alpha.21",
|
|
72
|
+
"@shrkcrft/embeddings": "^0.1.0-alpha.21",
|
|
61
73
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
62
74
|
"zod": "^3.25.0 || ^4.0.0"
|
|
63
75
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"r22-extras.tool.d.ts","sourceRoot":"","sources":["../../src/tools/r22-extras.tool.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,eAAO,MAAM,yBAAyB,EAAE,eAuBvC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,eAevC,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration / readiness MCP tools. All read-only.
|
|
3
|
-
*/
|
|
4
|
-
import { buildMigrationReadiness, listMigrationProfiles, listMigrationProfilesFromPacks, } from '@shrkcrft/inspector';
|
|
5
|
-
export const getMigrationReadinessTool = {
|
|
6
|
-
name: 'get_migration_readiness',
|
|
7
|
-
description: 'Migration readiness verdict for a profile id. Read-only — probes local files and env vars; never runs source.',
|
|
8
|
-
inputSchema: {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
profileId: { type: 'string' },
|
|
12
|
-
},
|
|
13
|
-
required: ['profileId'],
|
|
14
|
-
additionalProperties: false,
|
|
15
|
-
},
|
|
16
|
-
async handler(input, ctx) {
|
|
17
|
-
const profileId = typeof input['profileId'] === 'string' ? input['profileId'] : '';
|
|
18
|
-
const packProfiles = await listMigrationProfilesFromPacks(ctx.inspection);
|
|
19
|
-
const report = buildMigrationReadiness({
|
|
20
|
-
profileId,
|
|
21
|
-
projectRoot: ctx.inspection.projectRoot,
|
|
22
|
-
customProfiles: packProfiles,
|
|
23
|
-
});
|
|
24
|
-
return { data: report };
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
export const listMigrationProfilesTool = {
|
|
28
|
-
name: 'list_migration_profiles',
|
|
29
|
-
description: 'List registered migration profiles (built-in + pack-contributed). Read-only.',
|
|
30
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
31
|
-
async handler(_input, ctx) {
|
|
32
|
-
const packProfiles = await listMigrationProfilesFromPacks(ctx.inspection);
|
|
33
|
-
const profiles = listMigrationProfiles(packProfiles).map((p) => ({
|
|
34
|
-
id: p.id,
|
|
35
|
-
title: p.title,
|
|
36
|
-
description: p.description,
|
|
37
|
-
successVerdict: p.successVerdict,
|
|
38
|
-
checks: p.checks.length,
|
|
39
|
-
}));
|
|
40
|
-
return { data: profiles };
|
|
41
|
-
},
|
|
42
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IToolDefinition } from '../server/tool-definition.js';
|
|
2
|
-
export declare const createRepositoryIngestionPlanTool: IToolDefinition;
|
|
3
|
-
export declare const getRepositoryKnowledgeModelTool: IToolDefinition;
|
|
4
|
-
export declare const getRepositoryIngestionStatusTool: IToolDefinition;
|
|
5
|
-
export declare const getRepositoryIngestionReportTool: IToolDefinition;
|
|
6
|
-
export declare const getContradictionReportTool: IToolDefinition;
|
|
7
|
-
export declare const getGeneratedCodeReportTool: IToolDefinition;
|
|
8
|
-
export declare const getStabilityMapTool: IToolDefinition;
|
|
9
|
-
export declare const getIngestAdoptionPreviewTool: IToolDefinition;
|
|
10
|
-
//# sourceMappingURL=r26-ingest.tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"r26-ingest.tool.d.ts","sourceRoot":"","sources":["../../src/tools/r26-ingest.tool.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAyBpE,eAAO,MAAM,iCAAiC,EAAE,eA4B/C,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,eAyB7C,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,eAiB9C,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,eAiB9C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,eAWxC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,eAWxC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,eAejC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,eAY1C,CAAC"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import * as nodePath from 'node:path';
|
|
2
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { buildContradictionReport, buildGeneratedCodeReport, buildIngestAdoptionPlan, buildRepositoryKnowledgeModel, buildStabilityMap, IngestDepth, IngestSection, } from '@shrkcrft/inspector';
|
|
4
|
-
function nextHint(cmd) {
|
|
5
|
-
return `Next: \`${cmd}\` (CLI is the only write path).`;
|
|
6
|
-
}
|
|
7
|
-
function parseDepth(raw) {
|
|
8
|
-
if (typeof raw !== 'string')
|
|
9
|
-
return IngestDepth.Standard;
|
|
10
|
-
const lower = raw.toLowerCase();
|
|
11
|
-
for (const d of Object.values(IngestDepth))
|
|
12
|
-
if (d === lower)
|
|
13
|
-
return d;
|
|
14
|
-
return IngestDepth.Standard;
|
|
15
|
-
}
|
|
16
|
-
function parseSections(raw) {
|
|
17
|
-
if (!Array.isArray(raw))
|
|
18
|
-
return undefined;
|
|
19
|
-
const out = [];
|
|
20
|
-
for (const s of raw) {
|
|
21
|
-
if (typeof s !== 'string')
|
|
22
|
-
continue;
|
|
23
|
-
for (const v of Object.values(IngestSection)) {
|
|
24
|
-
if (v === s)
|
|
25
|
-
out.push(v);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return out.length > 0 ? out : undefined;
|
|
29
|
-
}
|
|
30
|
-
export const createRepositoryIngestionPlanTool = {
|
|
31
|
-
name: 'create_repository_ingestion_plan',
|
|
32
|
-
description: 'Build a SharkCraft repository knowledge model (read-only). Returns the model + a next-command hint. MCP never writes; pass --write-drafts to the CLI to materialise drafts under sharkcraft/ingestion/.',
|
|
33
|
-
inputSchema: {
|
|
34
|
-
type: 'object',
|
|
35
|
-
additionalProperties: false,
|
|
36
|
-
properties: {
|
|
37
|
-
depth: { type: 'string' },
|
|
38
|
-
include: { type: 'array', items: { type: 'string' } },
|
|
39
|
-
exclude: { type: 'array', items: { type: 'string' } },
|
|
40
|
-
presets: { type: 'array', items: { type: 'string' } },
|
|
41
|
-
task: { type: 'string' },
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
async handler(input, ctx) {
|
|
45
|
-
const model = await buildRepositoryKnowledgeModel({
|
|
46
|
-
inspection: ctx.inspection,
|
|
47
|
-
depth: parseDepth(input.depth),
|
|
48
|
-
selectedSections: parseSections(input.include),
|
|
49
|
-
excludedSections: parseSections(input.exclude),
|
|
50
|
-
forcedPresetIds: Array.isArray(input.presets) ? input.presets.filter((p) => typeof p === 'string') : undefined,
|
|
51
|
-
...(typeof input.task === 'string' ? { task: input.task } : {}),
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
text: nextHint('shrk ingest repository --write-drafts'),
|
|
55
|
-
data: model,
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
export const getRepositoryKnowledgeModelTool = {
|
|
60
|
-
name: 'get_repository_knowledge_model',
|
|
61
|
-
description: 'Return the previously-saved repository knowledge model (`sharkcraft/ingestion/repository-knowledge-model.json`). Read-only.',
|
|
62
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
63
|
-
handler(_input, ctx) {
|
|
64
|
-
const file = nodePath.join(ctx.cwd, 'sharkcraft', 'ingestion', 'repository-knowledge-model.json');
|
|
65
|
-
if (!existsSync(file)) {
|
|
66
|
-
return {
|
|
67
|
-
isError: true,
|
|
68
|
-
error: { code: 'not-found', message: 'No saved knowledge model. Run `shrk ingest repository --write-drafts` first.' },
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
const body = JSON.parse(readFileSync(file, 'utf8'));
|
|
73
|
-
return {
|
|
74
|
-
text: nextHint('shrk ingest report --format markdown'),
|
|
75
|
-
data: body,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
return {
|
|
80
|
-
isError: true,
|
|
81
|
-
error: { code: 'parse-failed', message: err.message },
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
export const getRepositoryIngestionStatusTool = {
|
|
87
|
-
name: 'get_repository_ingestion_status',
|
|
88
|
-
description: 'Report whether ingest drafts/adoption files exist on disk. Read-only.',
|
|
89
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
90
|
-
handler(_input, ctx) {
|
|
91
|
-
const base = nodePath.join(ctx.cwd, 'sharkcraft', 'ingestion');
|
|
92
|
-
const modelExists = existsSync(nodePath.join(base, 'repository-knowledge-model.json'));
|
|
93
|
-
const adoptionExists = existsSync(nodePath.join(base, 'adoption', 'ingest-adoption-state.json'));
|
|
94
|
-
return {
|
|
95
|
-
text: nextHint('shrk ingest status'),
|
|
96
|
-
data: {
|
|
97
|
-
ingestDirExists: existsSync(base),
|
|
98
|
-
modelExists,
|
|
99
|
-
adoptionExists,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
export const getRepositoryIngestionReportTool = {
|
|
105
|
-
name: 'get_repository_ingestion_report',
|
|
106
|
-
description: 'Return a markdown summary of the saved repository knowledge model. Read-only.',
|
|
107
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
108
|
-
async handler(_input, ctx) {
|
|
109
|
-
const file = nodePath.join(ctx.cwd, 'sharkcraft', 'ingestion', 'REPOSITORY_KNOWLEDGE_MODEL.md');
|
|
110
|
-
if (!existsSync(file)) {
|
|
111
|
-
return {
|
|
112
|
-
isError: true,
|
|
113
|
-
error: { code: 'not-found', message: 'No saved report — run `shrk ingest repository --write-drafts` first.' },
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
text: nextHint('shrk ingest report --format markdown'),
|
|
118
|
-
data: { markdown: readFileSync(file, 'utf8') },
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
export const getContradictionReportTool = {
|
|
123
|
-
name: 'get_contradiction_report',
|
|
124
|
-
description: 'Detect documentation/code contradictions (missing paths, deprecated CLI usage, missing commands). Read-only.',
|
|
125
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
126
|
-
async handler(_input, ctx) {
|
|
127
|
-
const report = buildContradictionReport({ inspection: ctx.inspection });
|
|
128
|
-
return {
|
|
129
|
-
text: nextHint('shrk contradictions --format markdown'),
|
|
130
|
-
data: report,
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
export const getGeneratedCodeReportTool = {
|
|
135
|
-
name: 'get_generated_code_report',
|
|
136
|
-
description: 'Classify generated vs hand-written files; surface protect/policy recommendations. Read-only.',
|
|
137
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
138
|
-
async handler(_input, ctx) {
|
|
139
|
-
const report = buildGeneratedCodeReport({ inspection: ctx.inspection });
|
|
140
|
-
return {
|
|
141
|
-
text: nextHint('shrk generated report --format markdown'),
|
|
142
|
-
data: report,
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
export const getStabilityMapTool = {
|
|
147
|
-
name: 'get_stability_map',
|
|
148
|
-
description: 'Classify repo areas as stable/experimental/deprecated/legacy/generated/internal/public-api/high-risk. Read-only.',
|
|
149
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
150
|
-
async handler(_input, ctx) {
|
|
151
|
-
const generated = buildGeneratedCodeReport({ inspection: ctx.inspection });
|
|
152
|
-
const map = buildStabilityMap({
|
|
153
|
-
inspection: ctx.inspection,
|
|
154
|
-
generatedRoots: generated.generatedRoots.map((r) => r.path),
|
|
155
|
-
});
|
|
156
|
-
return {
|
|
157
|
-
text: nextHint('shrk stability map --format markdown'),
|
|
158
|
-
data: map,
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
export const getIngestAdoptionPreviewTool = {
|
|
163
|
-
name: 'get_ingest_adoption_preview',
|
|
164
|
-
description: 'Preview the ingest-adoption plan (safe-append / manual-review / low-confidence / already-covered / generated-protected). Read-only.',
|
|
165
|
-
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
166
|
-
async handler(_input, ctx) {
|
|
167
|
-
const model = await buildRepositoryKnowledgeModel({ inspection: ctx.inspection });
|
|
168
|
-
const plan = buildIngestAdoptionPlan({ model });
|
|
169
|
-
return {
|
|
170
|
-
text: nextHint('shrk ingest adopt --write-patch'),
|
|
171
|
-
data: plan,
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
};
|