@shrkcrft/mcp-server 0.1.0-alpha.2 → 0.1.0-alpha.20

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.
Files changed (189) hide show
  1. package/dist/index.d.ts +4 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -0
  4. package/dist/server/columnar-format.d.ts +34 -0
  5. package/dist/server/columnar-format.d.ts.map +1 -0
  6. package/dist/server/columnar-format.js +95 -0
  7. package/dist/server/create-mcp-server.d.ts +3 -0
  8. package/dist/server/create-mcp-server.d.ts.map +1 -1
  9. package/dist/server/create-mcp-server.js +24 -9
  10. package/dist/server/fit-array-to-budget.d.ts +24 -0
  11. package/dist/server/fit-array-to-budget.d.ts.map +1 -0
  12. package/dist/server/fit-array-to-budget.js +60 -0
  13. package/dist/server/serialize-tool-data.d.ts +15 -0
  14. package/dist/server/serialize-tool-data.d.ts.map +1 -0
  15. package/dist/server/serialize-tool-data.js +22 -0
  16. package/dist/server/tool-definition.d.ts +15 -0
  17. package/dist/server/tool-definition.d.ts.map +1 -1
  18. package/dist/server/tool-input-validators.d.ts.map +1 -1
  19. package/dist/server/tool-input-validators.js +43 -0
  20. package/dist/tools/agent-brief.tool.d.ts.map +1 -1
  21. package/dist/tools/agent-brief.tool.js +20 -0
  22. package/dist/tools/align-cache.tool.d.ts +11 -0
  23. package/dist/tools/align-cache.tool.d.ts.map +1 -0
  24. package/dist/tools/align-cache.tool.js +76 -0
  25. package/dist/tools/all-tools.d.ts.map +1 -1
  26. package/dist/tools/all-tools.js +72 -7
  27. package/dist/tools/architecture-map.tool.d.ts.map +1 -1
  28. package/dist/tools/architecture-map.tool.js +4 -2
  29. package/dist/tools/code-find-usages.tool.d.ts +16 -0
  30. package/dist/tools/code-find-usages.tool.d.ts.map +1 -0
  31. package/dist/tools/code-find-usages.tool.js +180 -0
  32. package/dist/tools/command-catalog.tool.d.ts.map +1 -1
  33. package/dist/tools/command-catalog.tool.js +11 -7
  34. package/dist/tools/compress-context.tool.d.ts +8 -0
  35. package/dist/tools/compress-context.tool.d.ts.map +1 -0
  36. package/dist/tools/compress-context.tool.js +81 -0
  37. package/dist/tools/dashboard-summary.tool.d.ts.map +1 -1
  38. package/dist/tools/dashboard-summary.tool.js +2 -4
  39. package/dist/tools/delegate-task.tool.d.ts +3 -0
  40. package/dist/tools/delegate-task.tool.d.ts.map +1 -0
  41. package/dist/tools/delegate-task.tool.js +94 -0
  42. package/dist/tools/deps-audit.tool.d.ts +10 -0
  43. package/dist/tools/deps-audit.tool.d.ts.map +1 -0
  44. package/dist/tools/deps-audit.tool.js +251 -0
  45. package/dist/tools/diff-check.tool.d.ts +15 -0
  46. package/dist/tools/diff-check.tool.d.ts.map +1 -0
  47. package/dist/tools/diff-check.tool.js +157 -0
  48. package/dist/tools/file-advice.tool.d.ts +22 -0
  49. package/dist/tools/file-advice.tool.d.ts.map +1 -0
  50. package/dist/tools/file-advice.tool.js +88 -0
  51. package/dist/tools/get-api-surface-diff.tool.d.ts +3 -0
  52. package/dist/tools/get-api-surface-diff.tool.d.ts.map +1 -0
  53. package/dist/tools/get-api-surface-diff.tool.js +60 -0
  54. package/dist/tools/get-arch-violations.tool.d.ts +3 -0
  55. package/dist/tools/get-arch-violations.tool.d.ts.map +1 -0
  56. package/dist/tools/get-arch-violations.tool.js +30 -0
  57. package/dist/tools/get-code-intelligence-state.tool.d.ts +11 -0
  58. package/dist/tools/get-code-intelligence-state.tool.d.ts.map +1 -0
  59. package/dist/tools/get-code-intelligence-state.tool.js +60 -0
  60. package/dist/tools/get-context-pack.tool.d.ts +3 -0
  61. package/dist/tools/get-context-pack.tool.d.ts.map +1 -0
  62. package/dist/tools/get-context-pack.tool.js +40 -0
  63. package/dist/tools/get-framework-entities.tool.d.ts +3 -0
  64. package/dist/tools/get-framework-entities.tool.d.ts.map +1 -0
  65. package/dist/tools/get-framework-entities.tool.js +68 -0
  66. package/dist/tools/get-graph-callers.tool.d.ts +3 -0
  67. package/dist/tools/get-graph-callers.tool.d.ts.map +1 -0
  68. package/dist/tools/get-graph-callers.tool.js +94 -0
  69. package/dist/tools/get-graph-context.tool.d.ts +3 -0
  70. package/dist/tools/get-graph-context.tool.d.ts.map +1 -0
  71. package/dist/tools/get-graph-context.tool.js +125 -0
  72. package/dist/tools/get-graph-cycles.tool.d.ts +10 -0
  73. package/dist/tools/get-graph-cycles.tool.d.ts.map +1 -0
  74. package/dist/tools/get-graph-cycles.tool.js +58 -0
  75. package/dist/tools/get-graph-deps.tool.d.ts +12 -0
  76. package/dist/tools/get-graph-deps.tool.d.ts.map +1 -0
  77. package/dist/tools/get-graph-deps.tool.js +80 -0
  78. package/dist/tools/get-graph-hubs.tool.d.ts +3 -0
  79. package/dist/tools/get-graph-hubs.tool.d.ts.map +1 -0
  80. package/dist/tools/get-graph-hubs.tool.js +61 -0
  81. package/dist/tools/get-graph-impact-analysis.tool.d.ts +3 -0
  82. package/dist/tools/get-graph-impact-analysis.tool.d.ts.map +1 -0
  83. package/dist/tools/get-graph-impact-analysis.tool.js +44 -0
  84. package/dist/tools/get-graph-impact.tool.d.ts +3 -0
  85. package/dist/tools/get-graph-impact.tool.d.ts.map +1 -0
  86. package/dist/tools/get-graph-impact.tool.js +150 -0
  87. package/dist/tools/get-graph-path.tool.d.ts +3 -0
  88. package/dist/tools/get-graph-path.tool.d.ts.map +1 -0
  89. package/dist/tools/get-graph-path.tool.js +144 -0
  90. package/dist/tools/get-graph-search.tool.d.ts +3 -0
  91. package/dist/tools/get-graph-search.tool.d.ts.map +1 -0
  92. package/dist/tools/get-graph-search.tool.js +95 -0
  93. package/dist/tools/get-graph-status.tool.d.ts +11 -0
  94. package/dist/tools/get-graph-status.tool.d.ts.map +1 -0
  95. package/dist/tools/get-graph-status.tool.js +55 -0
  96. package/dist/tools/get-graph-unresolved.tool.d.ts +11 -0
  97. package/dist/tools/get-graph-unresolved.tool.d.ts.map +1 -0
  98. package/dist/tools/get-graph-unresolved.tool.js +85 -0
  99. package/dist/tools/get-impact-baseline.tool.d.ts +9 -0
  100. package/dist/tools/get-impact-baseline.tool.d.ts.map +1 -0
  101. package/dist/tools/get-impact-baseline.tool.js +65 -0
  102. package/dist/tools/get-intent-benchmark-run.tool.d.ts +12 -0
  103. package/dist/tools/get-intent-benchmark-run.tool.d.ts.map +1 -0
  104. package/dist/tools/get-intent-benchmark-run.tool.js +55 -0
  105. package/dist/tools/get-knowledge-graph.tool.d.ts +7 -0
  106. package/dist/tools/get-knowledge-graph.tool.d.ts.map +1 -1
  107. package/dist/tools/get-knowledge-graph.tool.js +62 -3
  108. package/dist/tools/get-migrations.tool.d.ts +3 -0
  109. package/dist/tools/get-migrations.tool.d.ts.map +1 -0
  110. package/dist/tools/get-migrations.tool.js +70 -0
  111. package/dist/tools/get-pattern-registry.tool.d.ts +8 -0
  112. package/dist/tools/get-pattern-registry.tool.d.ts.map +1 -0
  113. package/dist/tools/get-pattern-registry.tool.js +40 -0
  114. package/dist/tools/get-quality-gate.tool.d.ts +3 -0
  115. package/dist/tools/get-quality-gate.tool.d.ts.map +1 -0
  116. package/dist/tools/get-quality-gate.tool.js +27 -0
  117. package/dist/tools/get-relevant-context.tool.d.ts.map +1 -1
  118. package/dist/tools/get-relevant-context.tool.js +30 -6
  119. package/dist/tools/get-rules-for-file.tool.d.ts +3 -0
  120. package/dist/tools/get-rules-for-file.tool.d.ts.map +1 -0
  121. package/dist/tools/get-rules-for-file.tool.js +54 -0
  122. package/dist/tools/get-structural-rewrite-plan.tool.d.ts +3 -0
  123. package/dist/tools/get-structural-rewrite-plan.tool.d.ts.map +1 -0
  124. package/dist/tools/get-structural-rewrite-plan.tool.js +46 -0
  125. package/dist/tools/get-structural-search.tool.d.ts +3 -0
  126. package/dist/tools/get-structural-search.tool.d.ts.map +1 -0
  127. package/dist/tools/get-structural-search.tool.js +35 -0
  128. package/dist/tools/get-task-packet.tool.d.ts.map +1 -1
  129. package/dist/tools/get-task-packet.tool.js +26 -22
  130. package/dist/tools/graph-staleness.d.ts +34 -0
  131. package/dist/tools/graph-staleness.d.ts.map +1 -0
  132. package/dist/tools/graph-staleness.js +36 -0
  133. package/dist/tools/list-boundary-rules.tool.d.ts.map +1 -1
  134. package/dist/tools/list-boundary-rules.tool.js +20 -16
  135. package/dist/tools/list-knowledge.tool.d.ts.map +1 -1
  136. package/dist/tools/list-knowledge.tool.js +14 -13
  137. package/dist/tools/list-packs.tool.d.ts.map +1 -1
  138. package/dist/tools/list-packs.tool.js +19 -15
  139. package/dist/tools/list-path-conventions.tool.d.ts.map +1 -1
  140. package/dist/tools/list-path-conventions.tool.js +19 -15
  141. package/dist/tools/list-pipelines.tool.d.ts.map +1 -1
  142. package/dist/tools/list-pipelines.tool.js +18 -14
  143. package/dist/tools/list-presets.tool.d.ts.map +1 -1
  144. package/dist/tools/list-presets.tool.js +25 -21
  145. package/dist/tools/list-rules.tool.d.ts.map +1 -1
  146. package/dist/tools/list-rules.tool.js +18 -14
  147. package/dist/tools/list-templates.tool.d.ts.map +1 -1
  148. package/dist/tools/list-templates.tool.js +18 -14
  149. package/dist/tools/plan-quality-review.tool.d.ts +21 -0
  150. package/dist/tools/plan-quality-review.tool.d.ts.map +1 -0
  151. package/dist/tools/plan-quality-review.tool.js +294 -0
  152. package/dist/tools/primary-tools.d.ts +24 -0
  153. package/dist/tools/primary-tools.d.ts.map +1 -0
  154. package/dist/tools/primary-tools.js +86 -0
  155. package/dist/tools/r19-extras.tool.js +1 -1
  156. package/dist/tools/r32-profiles.tool.d.ts +0 -3
  157. package/dist/tools/r32-profiles.tool.d.ts.map +1 -1
  158. package/dist/tools/r32-profiles.tool.js +3 -54
  159. package/dist/tools/retrieve-original.tool.d.ts +9 -0
  160. package/dist/tools/retrieve-original.tool.d.ts.map +1 -0
  161. package/dist/tools/retrieve-original.tool.js +47 -0
  162. package/dist/tools/runtime-reports.tool.d.ts.map +1 -1
  163. package/dist/tools/runtime-reports.tool.js +1 -3
  164. package/dist/tools/safety-audit.tool.d.ts.map +1 -1
  165. package/dist/tools/safety-audit.tool.js +1 -4
  166. package/dist/tools/search-knowledge.tool.d.ts.map +1 -1
  167. package/dist/tools/search-knowledge.tool.js +17 -13
  168. package/dist/tools/search.tool.d.ts.map +1 -1
  169. package/dist/tools/search.tool.js +11 -8
  170. package/dist/tools/smart-context-bundle.tool.d.ts +17 -0
  171. package/dist/tools/smart-context-bundle.tool.d.ts.map +1 -0
  172. package/dist/tools/smart-context-bundle.tool.js +110 -0
  173. package/dist/tools/smart-context-feed.tool.d.ts +17 -0
  174. package/dist/tools/smart-context-feed.tool.d.ts.map +1 -0
  175. package/dist/tools/smart-context-feed.tool.js +138 -0
  176. package/dist/tools/start-here.tool.js +2 -2
  177. package/package.json +28 -16
  178. package/dist/tools/r22-extras.tool.d.ts +0 -4
  179. package/dist/tools/r22-extras.tool.d.ts.map +0 -1
  180. package/dist/tools/r22-extras.tool.js +0 -42
  181. package/dist/tools/r26-ingest.tool.d.ts +0 -10
  182. package/dist/tools/r26-ingest.tool.d.ts.map +0 -1
  183. package/dist/tools/r26-ingest.tool.js +0 -174
  184. package/dist/tools/r28-plugin-lifecycle.tool.d.ts +0 -4
  185. package/dist/tools/r28-plugin-lifecycle.tool.d.ts.map +0 -1
  186. package/dist/tools/r28-plugin-lifecycle.tool.js +0 -94
  187. package/dist/tools/r34-search-unified.tool.d.ts +0 -3
  188. package/dist/tools/r34-search-unified.tool.d.ts.map +0 -1
  189. package/dist/tools/r34-search-unified.tool.js +0 -38
@@ -42,8 +42,36 @@ import { checkBoundariesTool } from "./check-boundaries.tool.js";
42
42
  import { listBoundaryRulesTool } from "./list-boundary-rules.tool.js";
43
43
  import { getBoundaryRuleTool } from "./get-boundary-rule.tool.js";
44
44
  import { getImportGraphSummaryTool } from "./get-import-graph-summary.tool.js";
45
+ import { getGraphStatusTool } from "./get-graph-status.tool.js";
46
+ import { getGraphSearchTool } from "./get-graph-search.tool.js";
47
+ import { getGraphContextTool } from "./get-graph-context.tool.js";
48
+ import { getGraphImpactTool } from "./get-graph-impact.tool.js";
49
+ import { getGraphPathTool } from "./get-graph-path.tool.js";
50
+ import { getGraphHubsTool } from "./get-graph-hubs.tool.js";
51
+ import { getGraphCallersTool } from "./get-graph-callers.tool.js";
52
+ import { delegateTaskTool } from "./delegate-task.tool.js";
53
+ import { getGraphCyclesTool } from "./get-graph-cycles.tool.js";
54
+ import { getGraphUnresolvedTool } from "./get-graph-unresolved.tool.js";
55
+ import { getGraphDepsTool } from "./get-graph-deps.tool.js";
56
+ import { getImpactBaselineTool } from "./get-impact-baseline.tool.js";
57
+ import { getPatternRegistryTool } from "./get-pattern-registry.tool.js";
58
+ import { getIntentBenchmarkRunTool } from "./get-intent-benchmark-run.tool.js";
59
+ import { getCodeIntelligenceStateTool } from "./get-code-intelligence-state.tool.js";
60
+ import { getRulesForFileTool } from "./get-rules-for-file.tool.js";
61
+ import { getStructuralSearchTool } from "./get-structural-search.tool.js";
62
+ import { getStructuralRewritePlanTool } from "./get-structural-rewrite-plan.tool.js";
63
+ import { getGraphImpactAnalysisTool } from "./get-graph-impact-analysis.tool.js";
64
+ import { getContextPackTool } from "./get-context-pack.tool.js";
65
+ import { getArchViolationsTool } from "./get-arch-violations.tool.js";
66
+ import { getFrameworkEntitiesTool } from "./get-framework-entities.tool.js";
67
+ import { getApiSurfaceDiffTool } from "./get-api-surface-diff.tool.js";
68
+ import { getQualityGateTool } from "./get-quality-gate.tool.js";
69
+ import { getMigrationsTool } from "./get-migrations.tool.js";
45
70
  import { getDriftReportTool } from "./get-drift-report.tool.js";
46
71
  import { getKnowledgeGraphTool } from "./get-knowledge-graph.tool.js";
72
+ import { compressContextTool } from "./compress-context.tool.js";
73
+ import { retrieveOriginalTool } from "./retrieve-original.tool.js";
74
+ import { alignCacheTool, restoreCacheTool } from "./align-cache.tool.js";
47
75
  import { getGraphNodeTool } from "./get-graph-node.tool.js";
48
76
  import { getCoverageReportTool } from "./get-coverage-report.tool.js";
49
77
  import { getReviewPacketTool } from "./get-review-packet.tool.js";
@@ -74,6 +102,11 @@ import { getImportGraphAnalysisTool } from "./import-graph-analysis.tool.js";
74
102
  import { getDashboardSummaryTool } from "./dashboard-summary.tool.js";
75
103
  import { searchAllTool } from "./search.tool.js";
76
104
  import { createAgentBriefTool } from "./agent-brief.tool.js";
105
+ import { smartContextBundleTool } from "./smart-context-bundle.tool.js";
106
+ import { smartContextFeedTool } from "./smart-context-feed.tool.js";
107
+ import { codeFindUsagesTool } from "./code-find-usages.tool.js";
108
+ import { planQualityReviewTool } from "./plan-quality-review.tool.js";
109
+ import { depsAuditTool } from "./deps-audit.tool.js";
77
110
  import { getConstructApiTool, getConstructTool, listConstructFacetsTool, listConstructsTool, traceConstructTool, } from "./constructs.tool.js";
78
111
  import { getPlaybookTool, listPlaybooksTool, recommendPlaybooksTool, } from "./playbooks.tool.js";
79
112
  import { replayBundleApplyTool } from "./bundle-replay.tool.js";
@@ -116,7 +149,8 @@ import { getContractTemplateTool, getLanguageCommandsTool, getLanguageProfilesTo
116
149
  import { getTaskContextTool, understandTaskTool, validateChangeContextTool, } from "./r26-task-context.tool.js";
117
150
  import { getLanguageCacheStatusTool, getLanguageProfilesLiveTool, getLanguageRunPlanTool, getPolyglotBoundaryReportTool, } from "./r27-polyglot.tool.js";
118
151
  import { getChangedBoundaryReportTool } from "./r28-changed-boundary.tool.js";
119
- import { previewPluginRemoveTool, previewPluginRenameTool } from "./r28-plugin-lifecycle.tool.js";
152
+ import { getDiffCheckReportTool } from "./diff-check.tool.js";
153
+ import { getFileAdviceTool } from "./file-advice.tool.js";
120
154
  import { getHelperTool, listHelpersTool, previewHelperPlanTool } from "./r28-helpers.tool.js";
121
155
  import { getPackDevStatusTool, previewPackTestsTool } from "./r28-pack-author.tool.js";
122
156
  import { getRegistryLifecycleReportTool } from "./r28-registry-lifecycle.tool.js";
@@ -135,7 +169,7 @@ import { suggestCommandsTool, searchCommandsTool, explainCommandTool, } from "./
135
169
  import { previewFixTool, listFixKindsTool, } from "./r31-fix-preview.tool.js";
136
170
  import { getScaffoldCoverageReportTool } from "./r31-scaffold-coverage.tool.js";
137
171
  import { getChangesSummaryTool, getPrSummaryPreviewTool, getCiIntegrityReportTool, } from "./r31-changes-pr-ci.tool.js";
138
- import { listProfilesTool, getProfileTool, getProfilesDoctorTool, listPluginLifecycleProfilesTool, getPluginLifecycleProfileTool, getPluginLifecycleProfileDoctorTool, } from "./r32-profiles.tool.js";
172
+ import { listProfilesTool, getProfileTool, getProfilesDoctorTool, } from "./r32-profiles.tool.js";
139
173
  import { getProjectCouplingReportTool } from "./r32-project-coupling.tool.js";
140
174
  import { getPackContributionsTool, getPackConflictsTool, } from "./r33-pack-contributions.tool.js";
141
175
  import { listConventionsTool, getConventionTool, getConventionsDoctorTool, } from "./r33-conventions.tool.js";
@@ -192,8 +226,37 @@ export const ALL_TOOLS = Object.freeze([
192
226
  listBoundaryRulesTool,
193
227
  getBoundaryRuleTool,
194
228
  getImportGraphSummaryTool,
229
+ getGraphStatusTool,
230
+ getGraphSearchTool,
231
+ getGraphContextTool,
232
+ getGraphImpactTool,
233
+ getGraphPathTool,
234
+ getGraphHubsTool,
235
+ getGraphCallersTool,
236
+ delegateTaskTool,
237
+ getGraphCyclesTool,
238
+ getGraphUnresolvedTool,
239
+ getGraphDepsTool,
240
+ getImpactBaselineTool,
241
+ getPatternRegistryTool,
242
+ getIntentBenchmarkRunTool,
243
+ getCodeIntelligenceStateTool,
244
+ getRulesForFileTool,
245
+ getStructuralSearchTool,
246
+ getStructuralRewritePlanTool,
247
+ getGraphImpactAnalysisTool,
248
+ getContextPackTool,
249
+ getArchViolationsTool,
250
+ getFrameworkEntitiesTool,
251
+ getApiSurfaceDiffTool,
252
+ getQualityGateTool,
253
+ getMigrationsTool,
195
254
  getDriftReportTool,
196
255
  getKnowledgeGraphTool,
256
+ compressContextTool,
257
+ retrieveOriginalTool,
258
+ alignCacheTool,
259
+ restoreCacheTool,
197
260
  getGraphNodeTool,
198
261
  getCoverageReportTool,
199
262
  getReviewPacketTool,
@@ -242,6 +305,11 @@ export const ALL_TOOLS = Object.freeze([
242
305
  getDashboardSummaryTool,
243
306
  searchAllTool,
244
307
  createAgentBriefTool,
308
+ smartContextBundleTool,
309
+ smartContextFeedTool,
310
+ codeFindUsagesTool,
311
+ planQualityReviewTool,
312
+ depsAuditTool,
245
313
  listConstructsTool,
246
314
  getConstructTool,
247
315
  traceConstructTool,
@@ -334,8 +402,8 @@ export const ALL_TOOLS = Object.freeze([
334
402
  getLanguageCacheStatusTool,
335
403
  getLanguageProfilesLiveTool,
336
404
  getChangedBoundaryReportTool,
337
- previewPluginRenameTool,
338
- previewPluginRemoveTool,
405
+ getDiffCheckReportTool,
406
+ getFileAdviceTool,
339
407
  listHelpersTool,
340
408
  getHelperTool,
341
409
  previewHelperPlanTool,
@@ -370,9 +438,6 @@ export const ALL_TOOLS = Object.freeze([
370
438
  listProfilesTool,
371
439
  getProfileTool,
372
440
  getProfilesDoctorTool,
373
- listPluginLifecycleProfilesTool,
374
- getPluginLifecycleProfileTool,
375
- getPluginLifecycleProfileDoctorTool,
376
441
  getProjectCouplingReportTool,
377
442
  getPackContributionsTool,
378
443
  getPackConflictsTool,
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-map.tool.d.ts","sourceRoot":"","sources":["../../src/tools/architecture-map.tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,eAAO,MAAM,sBAAsB,EAAE,eAoBpC,CAAC"}
1
+ {"version":3,"file":"architecture-map.tool.d.ts","sourceRoot":"","sources":["../../src/tools/architecture-map.tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE,eAAO,MAAM,sBAAsB,EAAE,eAqBpC,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { buildArchitectureMap } from '@shrkcrft/inspector';
2
+ import { FORMAT_INPUT_PROPERTY, formatObjectArrays } from "../server/columnar-format.js";
2
3
  export const getArchitectureMapTool = {
3
4
  name: 'get_architecture_map',
4
- description: 'Build an architecture map: layers, constructs, boundary rules, public-API surfaces, tests/ownership hints, risks. Read-only.',
5
+ description: 'Build an architecture map: layers, constructs, boundary rules, public-API surfaces, tests/ownership hints, risks. Pass `format:"table"` for a token-efficient columnar encoding of the array fields. Read-only.',
5
6
  inputSchema: {
6
7
  type: 'object',
7
8
  properties: {
8
9
  include: { type: 'array', items: { type: 'string' } },
9
10
  risk: { type: 'boolean' },
11
+ ...FORMAT_INPUT_PROPERTY,
10
12
  },
11
13
  additionalProperties: false,
12
14
  },
@@ -17,6 +19,6 @@ export const getArchitectureMapTool = {
17
19
  ...(include ? { include } : {}),
18
20
  ...(risk !== undefined ? { risk } : {}),
19
21
  });
20
- return { data: map };
22
+ return { data: formatObjectArrays(map, input) };
21
23
  },
22
24
  };
@@ -0,0 +1,16 @@
1
+ import type { IToolDefinition } from '../server/tool-definition.js';
2
+ /**
3
+ * `code_find_usages` — structured usage finder backed by the
4
+ * SharkCraft graph (file + symbol nodes + import/declare edges).
5
+ *
6
+ * Unlike grep, this distinguishes:
7
+ * - the symbol's definition site
8
+ * - which files import the declaring file (runtime + type-only
9
+ * can't be split without TS-level checks, so we mark them all as
10
+ * `import-of-declaring-file` for honesty)
11
+ * - which other symbols neighbour the target in the graph
12
+ *
13
+ * Read-only. Skips when the graph is missing (returns a hint).
14
+ */
15
+ export declare const codeFindUsagesTool: IToolDefinition;
16
+ //# sourceMappingURL=code-find-usages.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-find-usages.tool.d.ts","sourceRoot":"","sources":["../../src/tools/code-find-usages.tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAuIhC,CAAC"}
@@ -0,0 +1,180 @@
1
+ import { existsSync } from 'node:fs';
2
+ import * as nodePath from 'node:path';
3
+ import { EdgeKind, GraphQueryApi, GraphStore, NodeKind, loadGraphApiCached } from '@shrkcrft/graph';
4
+ import { FORMAT_INPUT_PROPERTY, formatObjectArrays } from "../server/columnar-format.js";
5
+ import { callGraphLanguageNote } from "./graph-staleness.js";
6
+ /**
7
+ * `code_find_usages` — structured usage finder backed by the
8
+ * SharkCraft graph (file + symbol nodes + import/declare edges).
9
+ *
10
+ * Unlike grep, this distinguishes:
11
+ * - the symbol's definition site
12
+ * - which files import the declaring file (runtime + type-only
13
+ * can't be split without TS-level checks, so we mark them all as
14
+ * `import-of-declaring-file` for honesty)
15
+ * - which other symbols neighbour the target in the graph
16
+ *
17
+ * Read-only. Skips when the graph is missing (returns a hint).
18
+ */
19
+ export const codeFindUsagesTool = {
20
+ name: 'code_find_usages',
21
+ description: 'Find where a symbol is used (use this instead of grep). Returns the definition site and exact use sites as path:line via the SharkCraft graph, plus files that import the declaring file and neighbouring symbols. Read-only; needs `shrk graph index`. Pass `format:"table"` for a token-efficient columnar encoding.',
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ symbolName: { type: 'string' },
26
+ kindHint: { type: 'string' },
27
+ maxResults: { type: 'number' },
28
+ ...FORMAT_INPUT_PROPERTY,
29
+ },
30
+ required: ['symbolName'],
31
+ additionalProperties: false,
32
+ },
33
+ async handler(input, ctx) {
34
+ const symbolName = typeof input['symbolName'] === 'string' ? input['symbolName'].trim() : '';
35
+ if (symbolName.length === 0) {
36
+ return { data: { error: 'symbolName is required' } };
37
+ }
38
+ const maxResults = clamp(typeof input['maxResults'] === 'number' ? input['maxResults'] : 25, 1, 200);
39
+ const store = new GraphStore(ctx.cwd);
40
+ if (!store.exists()) {
41
+ return {
42
+ data: {
43
+ error: 'no-graph',
44
+ message: 'The SharkCraft graph index has not been built yet. Build it with `shrk graph index`.',
45
+ nextCommand: 'shrk graph index',
46
+ },
47
+ };
48
+ }
49
+ const api = loadGraphApiCached(ctx.cwd) ?? GraphQueryApi.fromStore(ctx.cwd);
50
+ const matches = api.findSymbol(symbolName, { exact: true, limit: maxResults });
51
+ if (matches.length === 0) {
52
+ return {
53
+ data: {
54
+ symbol: { name: symbolName, kind: 'unknown' },
55
+ definitions: [],
56
+ importersOfDeclaringFile: [],
57
+ neighbouringSymbols: [],
58
+ totalSymbolMatches: 0,
59
+ note: 'No exact symbol match in the graph. Try `shrk knowledge search` for fuzzy lookup.',
60
+ },
61
+ };
62
+ }
63
+ const definitions = [];
64
+ const importerSet = new Map();
65
+ const neighbours = [];
66
+ const useSites = [];
67
+ for (const sym of matches) {
68
+ const declaringFile = declaringFileOf(api, sym.id);
69
+ definitions.push({
70
+ symbolId: sym.id,
71
+ file: declaringFile?.path ?? null,
72
+ ...(sym.line ? { line: sym.line } : {}),
73
+ kind: String(sym.label && sym.label.length > 0 ? sym.label : sym.kind),
74
+ });
75
+ // Exact use sites (path:line) from the symbol's own call/reference
76
+ // edges, so the agent jumps straight to where it's used rather than
77
+ // grepping inside each importing file.
78
+ for (const site of api.referenceSitesOf(sym.id)) {
79
+ if (!site.node.path)
80
+ continue;
81
+ // Prune use sites whose file no longer exists — uniformly with
82
+ // importersOfDeclaringFile below, so the payload never lists a deleted
83
+ // file in one field while dropping it in another (a self-contradicting,
84
+ // authoritative-looking result is worse than a uniformly-stale one).
85
+ if (!pathExists(ctx.cwd, site.node.path))
86
+ continue;
87
+ useSites.push({ file: site.node.path, ...(site.line ? { line: site.line } : {}) });
88
+ }
89
+ if (declaringFile) {
90
+ for (const importer of api.importersOf(declaringFile.id)) {
91
+ if (!importer.path)
92
+ continue;
93
+ const exists = pathExists(ctx.cwd, importer.path);
94
+ if (!exists)
95
+ continue;
96
+ const key = `${importer.path}::${declaringFile.path}`;
97
+ if (!importerSet.has(key)) {
98
+ importerSet.set(key, {
99
+ file: importer.path,
100
+ via: declaringFile.path ?? '',
101
+ });
102
+ }
103
+ }
104
+ }
105
+ // Sibling symbols declared by the same file.
106
+ if (declaringFile) {
107
+ for (const sib of api.symbolsIn(declaringFile.id).slice(0, 6)) {
108
+ if (sib.id === sym.id)
109
+ continue;
110
+ neighbours.push({
111
+ name: sib.label,
112
+ kind: String(sib.kind),
113
+ file: declaringFile.path ?? null,
114
+ });
115
+ }
116
+ }
117
+ }
118
+ // Result-file staleness: which surviving result files changed content
119
+ // since indexing (deleted ones are already pruned above). Flags a payload
120
+ // whose line numbers / membership may be out of date for files the agent
121
+ // just edited. Read-only.
122
+ const resultPaths = [
123
+ ...definitions.map((d) => d.file),
124
+ ...useSites.map((u) => u.file),
125
+ ...[...importerSet.values()].map((i) => i.file),
126
+ ].filter((p) => !!p);
127
+ const stale = api.staleFilesAmong(ctx.cwd, resultPaths);
128
+ // Non-TS languages have no call/reference extraction, so empty useSites must
129
+ // not be read as "no usages".
130
+ const langNote = matches[0] ? callGraphLanguageNote(api, matches[0]) : undefined;
131
+ const data = {
132
+ symbol: { name: symbolName, kind: matches[0]?.kind ?? 'unknown' },
133
+ definitions,
134
+ useSites,
135
+ importersOfDeclaringFile: [...importerSet.values()],
136
+ neighbouringSymbols: neighbours.slice(0, 12),
137
+ totalSymbolMatches: matches.length,
138
+ note: (langNote ? langNote + ' ' : '') +
139
+ 'useSites = exact file:line of each call/reference to the symbol (first use per file). importersOfDeclaringFile = files that import the declaring file (coarser; may include type-only/unused imports). Pair with `shrk impact` for a tighter blast radius.',
140
+ ...(stale.modified.length > 0
141
+ ? {
142
+ stale: { modified: stale.modified },
143
+ staleHint: 'Some result files changed since indexing — run `shrk graph index --changed` for fresh line numbers.',
144
+ }
145
+ : {}),
146
+ };
147
+ // `format:"table"` columnar-encodes the homogeneous object-array fields
148
+ // (definitions, importersOfDeclaringFile, neighbouringSymbols); the scalar
149
+ // `symbol` object, totalSymbolMatches, and the note string pass through
150
+ // untouched. Default/`format:"json"` returns the bare object unchanged.
151
+ return { data: formatObjectArrays(data, input) };
152
+ },
153
+ };
154
+ function declaringFileOf(api, symbolId) {
155
+ const n = api.neighbours(symbolId);
156
+ if (!n)
157
+ return undefined;
158
+ for (const incoming of n.in) {
159
+ if (incoming.edge.kind !== EdgeKind.DeclaresSymbol)
160
+ continue;
161
+ if ('resolved' in incoming.source)
162
+ continue;
163
+ if (incoming.source.kind === NodeKind.File)
164
+ return incoming.source;
165
+ }
166
+ return undefined;
167
+ }
168
+ function pathExists(cwd, path) {
169
+ try {
170
+ return existsSync(nodePath.isAbsolute(path) ? path : nodePath.join(cwd, path));
171
+ }
172
+ catch {
173
+ return false;
174
+ }
175
+ }
176
+ function clamp(n, lo, hi) {
177
+ if (Number.isNaN(n))
178
+ return lo;
179
+ return Math.max(lo, Math.min(hi, Math.floor(n)));
180
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"command-catalog.tool.d.ts","sourceRoot":"","sources":["../../src/tools/command-catalog.tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAiBpE,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,cAAc,CAAC;CAC7C;AAwBD,eAAO,MAAM,sBAAsB,EAAE,SAAS,aAAa,EAgFzD,CAAC;AA+BH,eAAO,MAAM,qBAAqB,EAAE,eA4BnC,CAAC"}
1
+ {"version":3,"file":"command-catalog.tool.d.ts","sourceRoot":"","sources":["../../src/tools/command-catalog.tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAkBpE,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,cAAc,CAAC;CAC7C;AAwBD,eAAO,MAAM,sBAAsB,EAAE,SAAS,aAAa,EAgFzD,CAAC;AA+BH,eAAO,MAAM,qBAAqB,EAAE,eA+BnC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { FORMAT_INPUT_PROPERTY, formatObjectArrays } from "../server/columnar-format.js";
1
2
  const MCP_BOOTSTRAP_CORE = new Set([
2
3
  'doctor',
3
4
  'init',
@@ -123,6 +124,7 @@ export const getCommandCatalogTool = {
123
124
  properties: {
124
125
  safetyLevel: { type: 'string', description: 'Filter by safety level (read-only, writes-session, writes-drafts, writes-source, runs-shell, requires-review).' },
125
126
  category: { type: 'string', description: 'Filter by category.' },
127
+ ...FORMAT_INPUT_PROPERTY,
126
128
  },
127
129
  additionalProperties: false,
128
130
  },
@@ -134,14 +136,16 @@ export const getCommandCatalogTool = {
134
136
  entries = entries.filter((e) => e.safetyLevel === safety);
135
137
  if (typeof category === 'string')
136
138
  entries = entries.filter((e) => e.category === category);
137
- return {
138
- data: {
139
- entries,
140
- totals: {
141
- total: COMMAND_CATALOG_EXPORT.length,
142
- returned: entries.length,
143
- },
139
+ const data = {
140
+ entries,
141
+ totals: {
142
+ total: COMMAND_CATALOG_EXPORT.length,
143
+ returned: entries.length,
144
144
  },
145
145
  };
146
+ // `format:"table"` columnar-encodes the homogeneous `entries` array
147
+ // (the ~11-field catalog rows); the `totals` scalar object is left
148
+ // untouched. Default/`format:"json"` returns the object unchanged.
149
+ return { data: formatObjectArrays(data, input) };
146
150
  },
147
151
  };
@@ -0,0 +1,8 @@
1
+ import type { IToolDefinition } from '../server/tool-definition.js';
2
+ /**
3
+ * Deterministic context compressor exposed to agents — shrink a blob before it
4
+ * re-enters the prompt, with no model in the loop: it's a pure function of the
5
+ * input. Reversible via the CCR store wired into the server context.
6
+ */
7
+ export declare const compressContextTool: IToolDefinition;
8
+ //# sourceMappingURL=compress-context.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compress-context.tool.d.ts","sourceRoot":"","sources":["../../src/tools/compress-context.tool.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,eA6EjC,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { compressContent, EContentType, } from '@shrkcrft/compress';
2
+ const CONTENT_TYPES = new Set(Object.values(EContentType));
3
+ /**
4
+ * Deterministic context compressor exposed to agents — shrink a blob before it
5
+ * re-enters the prompt, with no model in the loop: it's a pure function of the
6
+ * input. Reversible via the CCR store wired into the server context.
7
+ */
8
+ export const compressContextTool = {
9
+ name: 'compress_context',
10
+ description: 'Deterministically compress a blob (tool output, build/test log, grep/search results, unified diff, or JSON) BEFORE you feed it back to the model — same information, far fewer tokens. Routes by content type, hoists JSON object-array schemas into dense tables, and reduces logs/search/diffs to their highest-signal lines. Reversible: when a lossy pass drops detail it caches the original and emits a `<<ccr:KEY>>` marker — call `retrieve_original` to get the full text back. No AI involved; same bytes in, same bytes out. Read-only.',
11
+ inputSchema: {
12
+ type: 'object',
13
+ properties: {
14
+ content: { type: 'string', description: 'The text to compress.' },
15
+ contentType: {
16
+ type: 'string',
17
+ description: 'Force a content class instead of auto-detecting: json | json-array | git-diff | search-results | build-log | source-code | markdown | plain-text.',
18
+ },
19
+ query: {
20
+ type: 'string',
21
+ description: 'Optional task/query text that biases which lines or matches are kept.',
22
+ },
23
+ maxItems: {
24
+ type: 'integer',
25
+ minimum: 1,
26
+ description: 'Soft cap on retained lines / matches / hunks (compressor-specific).',
27
+ },
28
+ maxTokens: {
29
+ type: 'integer',
30
+ minimum: 1,
31
+ description: 'Token budget for a JSON array. When set and the lossless columnar form still exceeds it, falls back to the lossy SmartCrusher row-sampler (kept rows + CCR original).',
32
+ },
33
+ },
34
+ required: ['content'],
35
+ additionalProperties: false,
36
+ },
37
+ handler(input, ctx) {
38
+ const content = typeof input.content === 'string' ? input.content : '';
39
+ if (content.length === 0) {
40
+ return {
41
+ isError: true,
42
+ text: 'compress_context requires a non-empty "content" string.',
43
+ error: { code: 'invalid-input', message: 'content is required' },
44
+ };
45
+ }
46
+ const opts = {};
47
+ if (ctx.ccrStore)
48
+ opts.store = ctx.ccrStore;
49
+ if (typeof input.query === 'string')
50
+ opts.query = input.query;
51
+ if (typeof input.maxItems === 'number' && input.maxItems > 0) {
52
+ opts.maxItems = Math.floor(input.maxItems);
53
+ }
54
+ if (typeof input.maxTokens === 'number' && input.maxTokens > 0) {
55
+ opts.maxTokens = Math.floor(input.maxTokens);
56
+ }
57
+ if (typeof input.contentType === 'string' && CONTENT_TYPES.has(input.contentType)) {
58
+ opts.contentType = input.contentType;
59
+ }
60
+ const result = compressContent(content, opts);
61
+ const pct = Math.round(result.savings.ratio * 100);
62
+ return {
63
+ data: {
64
+ contentType: result.contentType,
65
+ strategy: result.strategy,
66
+ lossy: result.lossy,
67
+ tokensBefore: result.savings.before,
68
+ tokensAfter: result.savings.after,
69
+ tokensSaved: result.savings.saved,
70
+ savedRatio: result.savings.ratio,
71
+ ccrKey: result.ccrKey ?? null,
72
+ note: result.note,
73
+ compressed: result.compressed,
74
+ ...(result.ccrKey
75
+ ? { retrieveWith: `retrieve_original { "key": "${result.ccrKey}" }` }
76
+ : {}),
77
+ },
78
+ text: `${result.strategy}: ${result.savings.before} → ${result.savings.after} tokens (−${pct}%)${result.ccrKey ? ` · original cached as ${result.ccrKey}` : ''}`,
79
+ };
80
+ },
81
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-summary.tool.d.ts","sourceRoot":"","sources":["../../src/tools/dashboard-summary.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAUpE,eAAO,MAAM,uBAAuB,EAAE,eA0LrC,CAAC"}
1
+ {"version":3,"file":"dashboard-summary.tool.d.ts","sourceRoot":"","sources":["../../src/tools/dashboard-summary.tool.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQpE,eAAO,MAAM,uBAAuB,EAAE,eA0LrC,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { buildAreaMap, buildAiReadinessReport, buildCoverageReport, buildDriftReport, buildQualityReport, buildReleaseReadiness, buildSafetyAudit, evaluatePolicy, listConstructs, listDevSessionsDetailed, listFeatureBundles, listPlaybooks, } from '@shrkcrft/inspector';
2
2
  import { existsSync, readFileSync, statSync } from 'node:fs';
3
3
  import * as nodePath from 'node:path';
4
- // DX#4 — derive audit view from ALL_TOOLS at runtime.
5
- import { ALL_TOOLS } from "./all-tools.js";
6
4
  export const getDashboardSummaryTool = {
7
5
  name: 'get_dashboard_summary',
8
6
  description: 'Compact dashboard summary aggregating quality, safety, readiness, coverage, drift, packs, sessions, bundles, command-safety totals, and recommended next commands. Read-only.',
@@ -75,7 +73,7 @@ export const getDashboardSummaryTool = {
75
73
  const safety = buildSafetyAudit({
76
74
  inspection,
77
75
  catalog: [],
78
- mcpTools: ALL_TOOLS.map((t) => ({ name: t.name, description: t.description })),
76
+ mcpTools: (ctx.allTools ?? []).map((t) => ({ name: t.name, description: t.description })),
79
77
  planSecretEnv: 'SHARKCRAFT_PLAN_SECRET',
80
78
  planSecretConfigured: typeof process.env['SHARKCRAFT_PLAN_SECRET'] === 'string' &&
81
79
  process.env['SHARKCRAFT_PLAN_SECRET'].length > 0,
@@ -155,7 +153,7 @@ export const getDashboardSummaryTool = {
155
153
  invalid: inspection.packs.invalidPacks?.length ?? 0,
156
154
  },
157
155
  policy: policySummary,
158
- mcpTools: { total: ALL_TOOLS.length, anyWritable: safety.mcp.anyWritable },
156
+ mcpTools: { total: ctx.allTools?.length ?? 0, anyWritable: safety.mcp.anyWritable },
159
157
  reportSite: { available: siteAvailable, dir: reportSiteDir },
160
158
  releaseReadiness: releaseReadinessSummary,
161
159
  releaseSmoke: smokeSummary,
@@ -0,0 +1,3 @@
1
+ import type { IToolDefinition } from '../server/tool-definition.js';
2
+ export declare const delegateTaskTool: IToolDefinition;
3
+ //# sourceMappingURL=delegate-task.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegate-task.tool.d.ts","sourceRoot":"","sources":["../../src/tools/delegate-task.tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAUpE,eAAO,MAAM,gBAAgB,EAAE,eA0E9B,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { compressMarkdown } from '@shrkcrft/compress';
2
+ import { loadProjectConfig } from '@shrkcrft/config';
3
+ const READONLY_NOTE = 'Read-only. The CLI is the only write path. The worker may emit ONLY the allowed ops and touch ONLY the guardrail globs; the edit is verified deterministically and auto-reverted on failure — so it lands only if it passes the recipe verification.';
4
+ export const delegateTaskTool = {
5
+ name: 'delegate_task',
6
+ description: 'Get a compact brief for delegating a MECHANICAL, deterministically-verifiable edit to the local-LLM worker (read-only). Returns the recipe fence — allowed ops, guardrail globs, verification — and the exact `shrk delegate run` next command. Hand the grunt edit to the local worker instead of spending your own tokens reading the whole file and writing the edit. Never writes; needs a `delegation` block in sharkcraft.config.ts.',
7
+ cliCommand: 'delegate',
8
+ inputSchema: {
9
+ type: 'object',
10
+ properties: {
11
+ task: { type: 'string' },
12
+ recipe: { type: 'string' },
13
+ },
14
+ required: ['task', 'recipe'],
15
+ additionalProperties: false,
16
+ },
17
+ async handler(input, ctx) {
18
+ const args = input;
19
+ const task = (args.task ?? '').trim();
20
+ const recipeId = (args.recipe ?? '').trim();
21
+ if (!task || !recipeId) {
22
+ return { isError: true, error: { code: 'invalid-input', message: 'task and recipe are required' } };
23
+ }
24
+ const loaded = await loadProjectConfig(ctx.inspection.projectRoot);
25
+ if (!loaded.ok) {
26
+ return { isError: true, error: { code: 'config-error', message: loaded.error.message } };
27
+ }
28
+ const delegation = loaded.value.config.delegation;
29
+ if (!delegation || delegation.enabled === false) {
30
+ return {
31
+ isError: true,
32
+ error: {
33
+ code: 'not-enabled',
34
+ message: 'delegation is not enabled in sharkcraft.config.ts',
35
+ details: { nextCommand: 'add a delegation { recipes: [...] } block to sharkcraft.config.ts' },
36
+ },
37
+ };
38
+ }
39
+ const recipes = delegation.recipes ?? [];
40
+ const recipe = recipes.find((r) => r.id === recipeId);
41
+ if (!recipe) {
42
+ return {
43
+ isError: true,
44
+ error: {
45
+ code: 'not-found',
46
+ message: `unknown recipe "${recipeId}". Available: ${recipes.map((r) => r.id).join(', ') || '(none)'}`,
47
+ details: { available: recipes.map((r) => r.id) },
48
+ },
49
+ };
50
+ }
51
+ const provider = recipe.provider ?? delegation.provider ?? 'auto';
52
+ const briefMarkdown = buildBriefMarkdown(task, recipe, provider);
53
+ // Compress the brief body (CCR-reversible when the server store is present).
54
+ // Small briefs pass through unchanged via the net-loss guard.
55
+ const compressed = compressMarkdown(briefMarkdown, ctx.ccrStore ? { store: ctx.ccrStore, query: task } : { query: task });
56
+ return {
57
+ data: {
58
+ schema: 'sharkcraft.delegate-task/v1',
59
+ recipeId: recipe.id,
60
+ title: recipe.title ?? recipe.id,
61
+ task,
62
+ allowedOps: recipe.allowedOps,
63
+ guardrailGlobs: recipe.guardrailGlobs,
64
+ verificationIds: recipe.verificationIds,
65
+ provider,
66
+ riskCeiling: recipe.riskCeiling ?? null,
67
+ brief: compressed.compressed,
68
+ ...(compressed.ccrKey ? { ccrKey: compressed.ccrKey } : {}),
69
+ next: `shrk delegate run "${task}" --recipe ${recipe.id} --apply`,
70
+ note: READONLY_NOTE,
71
+ },
72
+ };
73
+ },
74
+ };
75
+ function buildBriefMarkdown(task, recipe, provider) {
76
+ return [
77
+ `# Delegate brief: ${recipe.title ?? recipe.id}`,
78
+ '',
79
+ `**Task:** ${task}`,
80
+ '',
81
+ `**Recipe:** \`${recipe.id}\``,
82
+ `**Allowed ops:** ${recipe.allowedOps.join(', ')}`,
83
+ `**Guardrail globs (the worker may ONLY touch files matching these):** ${recipe.guardrailGlobs.join(', ')}`,
84
+ `**Verification (must pass or the edit is reverted):** ${recipe.verificationIds.join(', ') || '(none)'}`,
85
+ `**Provider:** ${provider}${recipe.model ? ` (${recipe.model})` : ''}`,
86
+ '',
87
+ '## How to delegate',
88
+ '',
89
+ 'The CLI is the only write path. Run the `next` command: the local worker generates the edit,',
90
+ 'the deterministic engine verifies it against the recipe verification, and auto-reverts on failure —',
91
+ 'so the edit lands only if it is correct. You pay for this brief and the compact result, not for',
92
+ 'reading the whole file or writing the edit yourself.',
93
+ ].join('\n');
94
+ }
@@ -0,0 +1,10 @@
1
+ import type { IToolDefinition } from '../server/tool-definition.js';
2
+ /**
3
+ * `deps_audit` — MCP wrapper around `shrk deps-audit`. Pure read-only.
4
+ * Returns the same shape the CLI's `--json` mode emits.
5
+ *
6
+ * NOTE: we re-implement the body here rather than shell out so MCP
7
+ * tools never spawn subprocesses. Identical logic, identical output.
8
+ */
9
+ export declare const depsAuditTool: IToolDefinition;
10
+ //# sourceMappingURL=deps-audit.tool.d.ts.map