@shrkcrft/mcp-server 0.1.0-alpha.1 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/server/create-mcp-server.d.ts.map +1 -1
- package/dist/server/create-mcp-server.js +21 -15
- package/dist/server/http-transport.d.ts +2 -7
- package/dist/server/http-transport.d.ts.map +1 -1
- package/dist/server/http-transport.js +6 -10
- package/dist/tools/all-tools.d.ts.map +1 -1
- package/dist/tools/all-tools.js +49 -7
- 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 +59 -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 +80 -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 +91 -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 +57 -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-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 +42 -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 +127 -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 +75 -0
- package/dist/tools/get-graph-status.tool.d.ts +9 -0
- package/dist/tools/get-graph-status.tool.d.ts.map +1 -0
- package/dist/tools/get-graph-status.tool.js +46 -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 +81 -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-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-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/primary-tools.d.ts +24 -0
- package/dist/tools/primary-tools.d.ts.map +1 -0
- package/dist/tools/primary-tools.js +70 -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/package.json +31 -20
- 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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { runQualityGates } from '@shrkcrft/quality-gates';
|
|
2
|
+
export const getQualityGateTool = {
|
|
3
|
+
name: 'get_quality_gate',
|
|
4
|
+
description: 'Read-only: run the code-intelligence quality-gate aggregator (graph freshness, architecture, impact since `main`) and return the unified pass/fail report. The CI / pre-merge hook for AI-agent-authored changes.',
|
|
5
|
+
cliCommand: 'gate',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
sinceRef: { type: 'string' },
|
|
10
|
+
failOn: { type: 'array', items: { type: 'string', enum: ['high', 'critical'] } },
|
|
11
|
+
disable: { type: 'array', items: { type: 'string' } },
|
|
12
|
+
},
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
},
|
|
15
|
+
handler(input, ctx) {
|
|
16
|
+
const args = input;
|
|
17
|
+
const report = runQualityGates({
|
|
18
|
+
projectRoot: ctx.inspection.projectRoot,
|
|
19
|
+
impact: {
|
|
20
|
+
...(args.sinceRef ? { sinceRef: args.sinceRef } : {}),
|
|
21
|
+
...(args.failOn ? { failOn: args.failOn } : {}),
|
|
22
|
+
},
|
|
23
|
+
...(args.disable ? { disable: args.disable } : {}),
|
|
24
|
+
});
|
|
25
|
+
return { data: report };
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-rules-for-file.tool.d.ts","sourceRoot":"","sources":["../../src/tools/get-rules-for-file.tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,eAAO,MAAM,mBAAmB,EAAE,eAqDjC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RuleGraphQueryApi } from '@shrkcrft/rule-graph';
|
|
2
|
+
export const getRulesForFileTool = {
|
|
3
|
+
name: 'get_rules_for_file',
|
|
4
|
+
description: 'Read-only bridge query: return rules (boundary), path conventions, and templates that apply to the given file. Requires `shrk graph index` + `shrk rule-graph index`.',
|
|
5
|
+
cliCommand: 'rule-graph for',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: { file: { type: 'string' } },
|
|
9
|
+
required: ['file'],
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
},
|
|
12
|
+
handler(input, ctx) {
|
|
13
|
+
const file = (input.file ?? '').trim();
|
|
14
|
+
if (!file) {
|
|
15
|
+
return {
|
|
16
|
+
isError: true,
|
|
17
|
+
error: { code: 'invalid-input', message: 'file is required' },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const missing = RuleGraphQueryApi.missingDescription(ctx.inspection.projectRoot);
|
|
21
|
+
if (missing) {
|
|
22
|
+
const next = missing.includes('rule-graph') ? 'shrk rule-graph index' : 'shrk graph index';
|
|
23
|
+
return {
|
|
24
|
+
isError: true,
|
|
25
|
+
error: {
|
|
26
|
+
code: 'bridge-missing',
|
|
27
|
+
message: missing,
|
|
28
|
+
details: { nextCommand: next },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const api = RuleGraphQueryApi.fromStores(ctx.inspection.projectRoot);
|
|
33
|
+
const r = api.forFile(file);
|
|
34
|
+
if (!r) {
|
|
35
|
+
return {
|
|
36
|
+
isError: true,
|
|
37
|
+
error: { code: 'not-found', message: `No file node for "${file}".`, details: { file } },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
data: {
|
|
42
|
+
schema: 'sharkcraft.rule-graph-for-file/v1',
|
|
43
|
+
file: r.path,
|
|
44
|
+
rules: r.rules.map((h) => ({
|
|
45
|
+
id: h.target.id,
|
|
46
|
+
label: h.target.label,
|
|
47
|
+
severity: h.edge.data?.['severity'] ?? undefined,
|
|
48
|
+
})),
|
|
49
|
+
paths: r.paths.map((h) => ({ id: h.target.id, label: h.target.label })),
|
|
50
|
+
templates: r.templates.map((h) => ({ id: h.target.id, label: h.target.label })),
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-structural-rewrite-plan.tool.d.ts","sourceRoot":"","sources":["../../src/tools/get-structural-rewrite-plan.tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAUpE,eAAO,MAAM,4BAA4B,EAAE,eA0C1C,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { planRewrite } from '@shrkcrft/structural-search';
|
|
2
|
+
export const getStructuralRewritePlanTool = {
|
|
3
|
+
// Tool name intentionally uses "codemod" rather than "rewrite" — the
|
|
4
|
+
// CLI ceremony tests forbid any MCP tool name containing the
|
|
5
|
+
// substring "write" so a future read of the catalog can't mistake a
|
|
6
|
+
// preview tool for a write surface. The plan is still read-only
|
|
7
|
+
// here; apply ceremony happens via `shrk search-structural ... --apply`.
|
|
8
|
+
name: 'get_structural_codemod_plan',
|
|
9
|
+
description: 'Preview a structural codemod as a per-file edit plan (`sharkcraft.structural-rewrite-plan/v1`). Read-only — apply ceremony stays on the CLI (`shrk search-structural ... --apply`). Useful for "what would this codemod do?" without touching disk.',
|
|
10
|
+
cliCommand: 'search-structural',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
pattern: { type: 'object' },
|
|
15
|
+
recipe: { type: 'object' },
|
|
16
|
+
files: { type: 'array', items: { type: 'string' } },
|
|
17
|
+
perFileLimit: { type: 'number' },
|
|
18
|
+
fileLimit: { type: 'number' },
|
|
19
|
+
},
|
|
20
|
+
required: ['pattern', 'recipe'],
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
},
|
|
23
|
+
handler(input, ctx) {
|
|
24
|
+
const args = input;
|
|
25
|
+
const pattern = args.pattern;
|
|
26
|
+
const recipe = args.recipe;
|
|
27
|
+
if (!pattern || typeof pattern !== 'object' || !pattern.kind) {
|
|
28
|
+
return { isError: true, error: { code: 'invalid-input', message: 'pattern.kind is required' } };
|
|
29
|
+
}
|
|
30
|
+
if (!recipe || typeof recipe !== 'object' || !recipe.kind) {
|
|
31
|
+
return { isError: true, error: { code: 'invalid-input', message: 'recipe.kind is required' } };
|
|
32
|
+
}
|
|
33
|
+
const plan = planRewrite({
|
|
34
|
+
projectRoot: ctx.inspection.projectRoot,
|
|
35
|
+
pattern,
|
|
36
|
+
recipe,
|
|
37
|
+
...(args.files ? { files: args.files } : {}),
|
|
38
|
+
...(typeof args.perFileLimit === 'number' ? { perFileLimit: clamp(args.perFileLimit, 1, 1000) } : {}),
|
|
39
|
+
...(typeof args.fileLimit === 'number' ? { fileLimit: clamp(args.fileLimit, 1, 50000) } : {}),
|
|
40
|
+
});
|
|
41
|
+
return { data: plan };
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
function clamp(n, lo, hi) {
|
|
45
|
+
return Math.max(lo, Math.min(hi, n));
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-structural-search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/get-structural-search.tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAOpE,eAAO,MAAM,uBAAuB,EAAE,eA+BrC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { runSearch } from '@shrkcrft/structural-search';
|
|
2
|
+
export const getStructuralSearchTool = {
|
|
3
|
+
name: 'get_structural_search',
|
|
4
|
+
description: 'Run a declarative AST pattern over the project and return matches. Patterns are JSON of shape `{ kind: "CallExpression" | "ImportDeclaration" | "ClassDeclaration" | ..., ... }`. No executable predicates, no rewrites. Read-only.',
|
|
5
|
+
cliCommand: 'search-structural',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
pattern: { type: 'object' },
|
|
10
|
+
limit: { type: 'number' },
|
|
11
|
+
},
|
|
12
|
+
required: ['pattern'],
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
},
|
|
15
|
+
handler(input, ctx) {
|
|
16
|
+
const args = input;
|
|
17
|
+
const pat = args.pattern;
|
|
18
|
+
if (!pat || typeof pat !== 'object' || !pat.kind) {
|
|
19
|
+
return {
|
|
20
|
+
isError: true,
|
|
21
|
+
error: { code: 'invalid-input', message: 'pattern.kind is required' },
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const limit = clamp(args.limit ?? 200, 1, 2000);
|
|
25
|
+
const result = runSearch({
|
|
26
|
+
projectRoot: ctx.inspection.projectRoot,
|
|
27
|
+
pattern: pat,
|
|
28
|
+
limit,
|
|
29
|
+
});
|
|
30
|
+
return { data: result };
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
function clamp(n, lo, hi) {
|
|
34
|
+
return Math.max(lo, Math.min(hi, n));
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Primary MCP tools — the ~30 tools advertised to a connected agent
|
|
3
|
+
* by default. Every tool in {@link ALL_TOOLS} stays callable (so an
|
|
4
|
+
* agent that already knows the name can use it), but `tools/list`
|
|
5
|
+
* only advertises the primary set. Smaller surface = better
|
|
6
|
+
* tool-selection accuracy for the agent.
|
|
7
|
+
*
|
|
8
|
+
* Picked to match the CLI's allowlist semantics: anything an agent
|
|
9
|
+
* could realistically reach for during a normal task — discovery,
|
|
10
|
+
* context, planning, validation — is in. Internal introspection
|
|
11
|
+
* (catalog dumps, fix-preview internals, drift baselines) is out;
|
|
12
|
+
* still callable, just not in the default tool list.
|
|
13
|
+
*
|
|
14
|
+
* Escape hatch: set `SHRK_MCP_FULL_TOOLS=1` to advertise the full
|
|
15
|
+
* catalog (useful when debugging an agent's tool selection).
|
|
16
|
+
*/
|
|
17
|
+
export declare const PRIMARY_MCP_TOOLS: ReadonlySet<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Should `tools/list` advertise the full catalog instead of the
|
|
20
|
+
* primary set? Driven by the env var so an agent operator can flip it
|
|
21
|
+
* without rebuilding.
|
|
22
|
+
*/
|
|
23
|
+
export declare function shouldAdvertiseFullToolset(): boolean;
|
|
24
|
+
//# sourceMappingURL=primary-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary-tools.d.ts","sourceRoot":"","sources":["../../src/tools/primary-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CA4ChD,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAGpD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Primary MCP tools — the ~30 tools advertised to a connected agent
|
|
3
|
+
* by default. Every tool in {@link ALL_TOOLS} stays callable (so an
|
|
4
|
+
* agent that already knows the name can use it), but `tools/list`
|
|
5
|
+
* only advertises the primary set. Smaller surface = better
|
|
6
|
+
* tool-selection accuracy for the agent.
|
|
7
|
+
*
|
|
8
|
+
* Picked to match the CLI's allowlist semantics: anything an agent
|
|
9
|
+
* could realistically reach for during a normal task — discovery,
|
|
10
|
+
* context, planning, validation — is in. Internal introspection
|
|
11
|
+
* (catalog dumps, fix-preview internals, drift baselines) is out;
|
|
12
|
+
* still callable, just not in the default tool list.
|
|
13
|
+
*
|
|
14
|
+
* Escape hatch: set `SHRK_MCP_FULL_TOOLS=1` to advertise the full
|
|
15
|
+
* catalog (useful when debugging an agent's tool selection).
|
|
16
|
+
*/
|
|
17
|
+
export const PRIMARY_MCP_TOOLS = new Set([
|
|
18
|
+
// Project orientation
|
|
19
|
+
'inspect_workspace',
|
|
20
|
+
'get_project_overview',
|
|
21
|
+
'get_agent_instructions',
|
|
22
|
+
'get_start_here',
|
|
23
|
+
// Context / task routing
|
|
24
|
+
'get_relevant_context',
|
|
25
|
+
'get_task_packet',
|
|
26
|
+
'get_action_hints',
|
|
27
|
+
'create_agent_brief',
|
|
28
|
+
'get_relevant_rules',
|
|
29
|
+
'explain_command',
|
|
30
|
+
// Browse the registries
|
|
31
|
+
'list_knowledge',
|
|
32
|
+
'get_knowledge',
|
|
33
|
+
'list_rules',
|
|
34
|
+
'get_rule',
|
|
35
|
+
'list_path_conventions',
|
|
36
|
+
'list_templates',
|
|
37
|
+
'get_template',
|
|
38
|
+
'list_pipelines',
|
|
39
|
+
'get_pipeline',
|
|
40
|
+
'list_presets',
|
|
41
|
+
'get_preset',
|
|
42
|
+
'list_packs',
|
|
43
|
+
'get_pack',
|
|
44
|
+
// Safe code generation (plan-first)
|
|
45
|
+
'create_generation_plan',
|
|
46
|
+
'render_template_preview',
|
|
47
|
+
'explain_generation_target',
|
|
48
|
+
// Validation gates (read-only)
|
|
49
|
+
'check_boundaries',
|
|
50
|
+
'get_diff_check_report',
|
|
51
|
+
'get_file_advice',
|
|
52
|
+
'get_architecture_constraints',
|
|
53
|
+
'get_architecture_violations',
|
|
54
|
+
// Doctor / readiness
|
|
55
|
+
'get_ai_readiness_report',
|
|
56
|
+
'doctor_packs',
|
|
57
|
+
// Search
|
|
58
|
+
'search_all',
|
|
59
|
+
'search_knowledge',
|
|
60
|
+
'search_commands',
|
|
61
|
+
]);
|
|
62
|
+
/**
|
|
63
|
+
* Should `tools/list` advertise the full catalog instead of the
|
|
64
|
+
* primary set? Driven by the env var so an agent operator can flip it
|
|
65
|
+
* without rebuilding.
|
|
66
|
+
*/
|
|
67
|
+
export function shouldAdvertiseFullToolset() {
|
|
68
|
+
const v = process.env.SHRK_MCP_FULL_TOOLS;
|
|
69
|
+
return v === '1' || v === 'true' || v === 'yes';
|
|
70
|
+
}
|
|
@@ -93,7 +93,7 @@ export const getCommandTaxonomyTool = {
|
|
|
93
93
|
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
94
94
|
async handler() {
|
|
95
95
|
// The CLI carries the canonical catalog; here we describe the surface
|
|
96
|
-
// without importing it (no inspector → CLI dependency).
|
|
96
|
+
// without importing it (no inspector → CLI dependency). Consumers can
|
|
97
97
|
// run `shrk commands taxonomy` for the full grouped output.
|
|
98
98
|
return {
|
|
99
99
|
data: {
|
|
@@ -2,7 +2,4 @@ import type { IToolDefinition } from '../server/tool-definition.js';
|
|
|
2
2
|
export declare const listProfilesTool: IToolDefinition;
|
|
3
3
|
export declare const getProfileTool: IToolDefinition;
|
|
4
4
|
export declare const getProfilesDoctorTool: IToolDefinition;
|
|
5
|
-
export declare const listPluginLifecycleProfilesTool: IToolDefinition;
|
|
6
|
-
export declare const getPluginLifecycleProfileTool: IToolDefinition;
|
|
7
|
-
export declare const getPluginLifecycleProfileDoctorTool: IToolDefinition;
|
|
8
5
|
//# sourceMappingURL=r32-profiles.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r32-profiles.tool.d.ts","sourceRoot":"","sources":["../../src/tools/r32-profiles.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"r32-profiles.tool.d.ts","sourceRoot":"","sources":["../../src/tools/r32-profiles.tool.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,eAAO,MAAM,gBAAgB,EAAE,eAe9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAsB5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAOnC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Read-only MCP tools for profiles
|
|
2
|
+
* Read-only MCP tools for profiles.
|
|
3
3
|
*
|
|
4
4
|
* Engine never writes from MCP. These tools surface pack-contributed and
|
|
5
5
|
* locally configured profiles so an agent can decide which one to pass to
|
|
6
|
-
*
|
|
6
|
+
* a profile-aware command (the human runs the CLI).
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { findProfile, listProfileIssues, listProfiles, ProfileKind, } from '@shrkcrft/inspector';
|
|
9
9
|
export const listProfilesTool = {
|
|
10
10
|
name: 'list_profiles',
|
|
11
11
|
description: 'List all pack-contributed and locally configured profiles. Read-only.',
|
|
@@ -54,54 +54,3 @@ export const getProfilesDoctorTool = {
|
|
|
54
54
|
return { data: { issues: await listProfileIssues(ctx.inspection) } };
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
|
-
export const listPluginLifecycleProfilesTool = {
|
|
58
|
-
name: 'list_plugin_lifecycle_profiles',
|
|
59
|
-
description: 'List registered plugin lifecycle profiles. Read-only.',
|
|
60
|
-
inputSchema: { type: 'object', additionalProperties: false, properties: {} },
|
|
61
|
-
async handler(_input, ctx) {
|
|
62
|
-
return { data: await listPluginLifecycleProfiles(ctx.inspection) };
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
export const getPluginLifecycleProfileTool = {
|
|
66
|
-
name: 'get_plugin_lifecycle_profile',
|
|
67
|
-
description: 'Get one plugin lifecycle profile by id. Read-only.',
|
|
68
|
-
inputSchema: {
|
|
69
|
-
type: 'object',
|
|
70
|
-
additionalProperties: false,
|
|
71
|
-
required: ['id'],
|
|
72
|
-
properties: { id: { type: 'string' } },
|
|
73
|
-
},
|
|
74
|
-
async handler(input, ctx) {
|
|
75
|
-
const id = typeof input.id === 'string' ? input.id : '';
|
|
76
|
-
if (!id)
|
|
77
|
-
return { isError: true, error: { code: 'invalid-input', message: 'id is required.' } };
|
|
78
|
-
const entries = await listPluginLifecycleProfiles(ctx.inspection);
|
|
79
|
-
const entry = entries.find((e) => e.profile.id === id);
|
|
80
|
-
if (!entry) {
|
|
81
|
-
return { isError: true, error: { code: 'not-found', message: `Unknown lifecycle profile "${id}".` } };
|
|
82
|
-
}
|
|
83
|
-
return { data: entry };
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
export const getPluginLifecycleProfileDoctorTool = {
|
|
87
|
-
name: 'get_plugin_lifecycle_profile_doctor',
|
|
88
|
-
description: 'Health check for plugin lifecycle profiles. Read-only.',
|
|
89
|
-
inputSchema: {
|
|
90
|
-
type: 'object',
|
|
91
|
-
additionalProperties: false,
|
|
92
|
-
properties: { id: { type: 'string' } },
|
|
93
|
-
},
|
|
94
|
-
async handler(input, ctx) {
|
|
95
|
-
const id = typeof input.id === 'string' ? input.id : undefined;
|
|
96
|
-
const entries = await listPluginLifecycleProfiles(ctx.inspection);
|
|
97
|
-
const targets = id ? entries.filter((e) => e.profile.id === id) : entries;
|
|
98
|
-
if (id && targets.length === 0) {
|
|
99
|
-
return { isError: true, error: { code: 'not-found', message: `Unknown lifecycle profile "${id}".` } };
|
|
100
|
-
}
|
|
101
|
-
const health = {};
|
|
102
|
-
for (const e of targets) {
|
|
103
|
-
health[e.profile.id] = checkPluginLifecycleProfileHealth(ctx.cwd, e.profile);
|
|
104
|
-
}
|
|
105
|
-
return { data: { health } };
|
|
106
|
-
},
|
|
107
|
-
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/mcp-server",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "SharkCraft MCP server:
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
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.ts",
|
|
9
|
+
"types": "./dist/index.d.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
+
"bun": "./src/index.ts",
|
|
13
14
|
"import": "./dist/index.js",
|
|
14
15
|
"default": "./dist/index.js"
|
|
15
16
|
}
|
|
@@ -21,12 +22,12 @@
|
|
|
21
22
|
],
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/
|
|
25
|
+
"url": "git+https://github.com/shrkcrft/sharkcraft.git",
|
|
25
26
|
"directory": "packages/mcp-server"
|
|
26
27
|
},
|
|
27
|
-
"homepage": "https://github.com/
|
|
28
|
+
"homepage": "https://github.com/shrkcrft/sharkcraft",
|
|
28
29
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/
|
|
30
|
+
"url": "https://github.com/shrkcrft/sharkcraft/issues"
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
|
32
33
|
"sharkcraft",
|
|
@@ -43,20 +44,30 @@
|
|
|
43
44
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
47
|
-
"@shrkcrft/config": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/workspace": "^0.1.0-alpha.
|
|
49
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
50
|
-
"@shrkcrft/context": "^0.1.0-alpha.
|
|
51
|
-
"@shrkcrft/rules": "^0.1.0-alpha.
|
|
52
|
-
"@shrkcrft/paths": "^0.1.0-alpha.
|
|
53
|
-
"@shrkcrft/templates": "^0.1.0-alpha.
|
|
54
|
-
"@shrkcrft/pipelines": "^0.1.0-alpha.
|
|
55
|
-
"@shrkcrft/presets": "^0.1.0-alpha.
|
|
56
|
-
"@shrkcrft/boundaries": "^0.1.0-alpha.
|
|
57
|
-
"@shrkcrft/
|
|
58
|
-
"@shrkcrft/
|
|
59
|
-
"@shrkcrft/
|
|
47
|
+
"@shrkcrft/core": "^0.1.0-alpha.10",
|
|
48
|
+
"@shrkcrft/config": "^0.1.0-alpha.10",
|
|
49
|
+
"@shrkcrft/workspace": "^0.1.0-alpha.10",
|
|
50
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.10",
|
|
51
|
+
"@shrkcrft/context": "^0.1.0-alpha.10",
|
|
52
|
+
"@shrkcrft/rules": "^0.1.0-alpha.10",
|
|
53
|
+
"@shrkcrft/paths": "^0.1.0-alpha.10",
|
|
54
|
+
"@shrkcrft/templates": "^0.1.0-alpha.10",
|
|
55
|
+
"@shrkcrft/pipelines": "^0.1.0-alpha.10",
|
|
56
|
+
"@shrkcrft/presets": "^0.1.0-alpha.10",
|
|
57
|
+
"@shrkcrft/boundaries": "^0.1.0-alpha.10",
|
|
58
|
+
"@shrkcrft/graph": "^0.1.0-alpha.10",
|
|
59
|
+
"@shrkcrft/rule-graph": "^0.1.0-alpha.10",
|
|
60
|
+
"@shrkcrft/structural-search": "^0.1.0-alpha.10",
|
|
61
|
+
"@shrkcrft/impact-engine": "^0.1.0-alpha.10",
|
|
62
|
+
"@shrkcrft/context-planner": "^0.1.0-alpha.10",
|
|
63
|
+
"@shrkcrft/architecture-guard": "^0.1.0-alpha.10",
|
|
64
|
+
"@shrkcrft/framework-scanners": "^0.1.0-alpha.10",
|
|
65
|
+
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.10",
|
|
66
|
+
"@shrkcrft/quality-gates": "^0.1.0-alpha.10",
|
|
67
|
+
"@shrkcrft/migrate": "^0.1.0-alpha.10",
|
|
68
|
+
"@shrkcrft/packs": "^0.1.0-alpha.10",
|
|
69
|
+
"@shrkcrft/generator": "^0.1.0-alpha.10",
|
|
70
|
+
"@shrkcrft/inspector": "^0.1.0-alpha.10",
|
|
60
71
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
61
72
|
"zod": "^3.25.0 || ^4.0.0"
|
|
62
73
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"r28-plugin-lifecycle.tool.d.ts","sourceRoot":"","sources":["../../src/tools/r28-plugin-lifecycle.tool.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,eAAO,MAAM,uBAAuB,EAAE,eA0CrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,eAuCrC,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plan-only plugin lifecycle previews (profile-driven).
|
|
3
|
-
*
|
|
4
|
-
* preview_plugin_rename — returns the rename plan (replace ops + manual steps).
|
|
5
|
-
* preview_plugin_remove — returns the destructive remove plan.
|
|
6
|
-
*
|
|
7
|
-
* Both tools never write source — the human runs `shrk plugin rename|remove`
|
|
8
|
-
* to produce the saved plan and applies it via `shrk apply --verify-signature`.
|
|
9
|
-
*
|
|
10
|
-
* A `profile` input is required. If exactly one lifecycle profile is
|
|
11
|
-
* registered, the tool implicitly uses it; otherwise the caller must supply
|
|
12
|
-
* `profile`.
|
|
13
|
-
*/
|
|
14
|
-
import { buildPluginRemovePlan, buildPluginRenamePlan, resolvePluginLifecycleProfile, } from '@shrkcrft/inspector';
|
|
15
|
-
function nextHint(cmd) {
|
|
16
|
-
return `Next: \`${cmd}\` (CLI is the only write path).`;
|
|
17
|
-
}
|
|
18
|
-
export const previewPluginRenameTool = {
|
|
19
|
-
name: 'preview_plugin_rename',
|
|
20
|
-
description: 'Preview a plugin rename plan. Read-only — returns the structured plan only. Requires a registered plugin lifecycle profile (pass `profile` if more than one is registered).',
|
|
21
|
-
inputSchema: {
|
|
22
|
-
type: 'object',
|
|
23
|
-
additionalProperties: false,
|
|
24
|
-
required: ['oldName', 'newName'],
|
|
25
|
-
properties: {
|
|
26
|
-
oldName: { type: 'string' },
|
|
27
|
-
newName: { type: 'string' },
|
|
28
|
-
profile: { type: 'string' },
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
async handler(input, ctx) {
|
|
32
|
-
const oldName = String(input.oldName ?? '');
|
|
33
|
-
const newName = String(input.newName ?? '');
|
|
34
|
-
const profileId = typeof input.profile === 'string' ? input.profile : undefined;
|
|
35
|
-
const resolved = await resolvePluginLifecycleProfile(ctx.inspection, {
|
|
36
|
-
profileId,
|
|
37
|
-
allowSingleDefault: true,
|
|
38
|
-
});
|
|
39
|
-
if (!resolved.entry) {
|
|
40
|
-
return {
|
|
41
|
-
isError: true,
|
|
42
|
-
error: { code: 'profile-required', message: resolved.error ?? 'Profile resolution failed' },
|
|
43
|
-
data: { availableProfiles: resolved.availableIds },
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const plan = buildPluginRenamePlan({
|
|
47
|
-
projectRoot: ctx.cwd,
|
|
48
|
-
profile: resolved.entry.profile,
|
|
49
|
-
oldName,
|
|
50
|
-
newName,
|
|
51
|
-
});
|
|
52
|
-
return {
|
|
53
|
-
text: nextHint(`shrk plugin rename ${oldName} ${newName} --profile ${resolved.entry.profile.id} --output /tmp/plan.json`),
|
|
54
|
-
data: plan,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
export const previewPluginRemoveTool = {
|
|
59
|
-
name: 'preview_plugin_remove',
|
|
60
|
-
description: 'Preview a destructive plugin remove plan. Read-only — returns the structured plan only. Requires a registered plugin lifecycle profile (pass `profile` if more than one is registered).',
|
|
61
|
-
inputSchema: {
|
|
62
|
-
type: 'object',
|
|
63
|
-
additionalProperties: false,
|
|
64
|
-
required: ['name'],
|
|
65
|
-
properties: {
|
|
66
|
-
name: { type: 'string' },
|
|
67
|
-
profile: { type: 'string' },
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
async handler(input, ctx) {
|
|
71
|
-
const name = String(input.name ?? '');
|
|
72
|
-
const profileId = typeof input.profile === 'string' ? input.profile : undefined;
|
|
73
|
-
const resolved = await resolvePluginLifecycleProfile(ctx.inspection, {
|
|
74
|
-
profileId,
|
|
75
|
-
allowSingleDefault: true,
|
|
76
|
-
});
|
|
77
|
-
if (!resolved.entry) {
|
|
78
|
-
return {
|
|
79
|
-
isError: true,
|
|
80
|
-
error: { code: 'profile-required', message: resolved.error ?? 'Profile resolution failed' },
|
|
81
|
-
data: { availableProfiles: resolved.availableIds },
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
const plan = buildPluginRemovePlan({
|
|
85
|
-
projectRoot: ctx.cwd,
|
|
86
|
-
profile: resolved.entry.profile,
|
|
87
|
-
oldName: name,
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
text: nextHint(`shrk plugin remove ${name} --profile ${resolved.entry.profile.id} --output /tmp/plan.json`),
|
|
91
|
-
data: plan,
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
};
|