@happyvertical/smrt-dev-mcp 0.47.1 → 0.48.0
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/AGENTS.md +10 -9
- package/README.md +151 -66
- package/dist/dev-plane.d.ts +48 -0
- package/dist/dev-plane.d.ts.map +1 -0
- package/dist/dev-plane.js +211 -0
- package/dist/dev-plane.js.map +1 -0
- package/dist/http-TeoaK9Xr.js +168 -0
- package/dist/http-TeoaK9Xr.js.map +1 -0
- package/dist/http.d.ts +96 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -428
- package/dist/index.js.map +1 -1
- package/dist/knowledge/index.d.ts +27 -1
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/{knowledge-DmZ-7GO9.js → knowledge-BOsSAdPo.js} +82 -655
- package/dist/knowledge-BOsSAdPo.js.map +1 -0
- package/dist/knowledge.js +2 -2
- package/dist/observation-VJgHaPps.js +802 -0
- package/dist/observation-VJgHaPps.js.map +1 -0
- package/dist/runtime.d.ts +21 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +18 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server-info.d.ts +3 -0
- package/dist/server-info.d.ts.map +1 -0
- package/dist/tool-catalog-Zl-bcimC.js +643 -0
- package/dist/tool-catalog-Zl-bcimC.js.map +1 -0
- package/dist/tool-catalog.d.ts.map +1 -1
- package/dist/tools/introspect-project.d.ts +8 -0
- package/dist/tools/introspect-project.d.ts.map +1 -1
- package/dist/tools/runtime/boot.d.ts +70 -0
- package/dist/tools/runtime/boot.d.ts.map +1 -0
- package/dist/tools/runtime/connection.d.ts +19 -0
- package/dist/tools/runtime/connection.d.ts.map +1 -1
- package/dist/tools/runtime/observation.d.ts +43 -0
- package/dist/tools/runtime/observation.d.ts.map +1 -0
- package/dist/tools/runtime/tools.d.ts +19 -0
- package/dist/tools/runtime/tools.d.ts.map +1 -1
- package/package.json +14 -6
- package/skills/smrt-code-review/SKILL.md +1 -1
- package/dist/knowledge-DmZ-7GO9.js.map +0 -1
|
@@ -1,653 +1,11 @@
|
|
|
1
|
+
import { n as TOOLS } from "./tool-catalog-Zl-bcimC.js";
|
|
1
2
|
import { existsSync, lstatSync, opendirSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
2
3
|
import { basename, dirname, isAbsolute, join, matchesGlob, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
+
import { execFileSync } from "node:child_process";
|
|
5
6
|
import { AGENT_SURFACE_HASH_PREFIX, MODULE_DOC_HASH_PREFIX, discoverScopedPackageDirectories, readAgentModuleDocs, readPackageAgentDoc, resolveAgentModuleDocPaths } from "@happyvertical/smrt-core/knowledge";
|
|
6
7
|
import { toSnakeCase } from "@happyvertical/smrt-core/utils";
|
|
7
8
|
import { ManifestAdapter, OxcScanner, isAgentSurfaceSourcePath, isPrunedAgentSurfacePath, lintNumericPrecision, mergeAgentSurfaces, parseSource, scanSvelteAgentSurface, sourceMayContainNumericPrecisionIssue, sourceMayDeclareAgentSurface } from "@happyvertical/smrt-scanner";
|
|
8
|
-
//#region src/tool-catalog.ts
|
|
9
|
-
var REVIEW_SKILL_NAME = "smrt-code-review";
|
|
10
|
-
var JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
11
|
-
function compareToolNames(left, right) {
|
|
12
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Stable success/error envelope for development tools. `data` preserves each
|
|
16
|
-
* tool's existing payload exactly; coverage/diagnostics are promoted only when
|
|
17
|
-
* the underlying result actually reports them.
|
|
18
|
-
*/
|
|
19
|
-
var DEV_MCP_OUTPUT_SCHEMA = {
|
|
20
|
-
$schema: JSON_SCHEMA_2020_12,
|
|
21
|
-
type: "object",
|
|
22
|
-
additionalProperties: false,
|
|
23
|
-
required: [
|
|
24
|
-
"ok",
|
|
25
|
-
"coverage",
|
|
26
|
-
"diagnostics",
|
|
27
|
-
"data"
|
|
28
|
-
],
|
|
29
|
-
properties: {
|
|
30
|
-
ok: { type: "boolean" },
|
|
31
|
-
coverage: {
|
|
32
|
-
type: ["object", "null"],
|
|
33
|
-
additionalProperties: true
|
|
34
|
-
},
|
|
35
|
-
diagnostics: {
|
|
36
|
-
type: "array",
|
|
37
|
-
items: {
|
|
38
|
-
type: "object",
|
|
39
|
-
additionalProperties: true
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
data: {}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var KNOWLEDGE_DETAIL_DESCRIPTION = "summary: authored package docs are listed by path to stay inside tool-result budgets. full: embed package docs and matching modules with structural object facts. complete: embed all modules and return full package records.";
|
|
46
|
-
var DATABASE_URL_PROPERTY = {
|
|
47
|
-
type: "string",
|
|
48
|
-
description: "Optional dev database URL override (read-only diagnostics); prefer SMRT_DEV_DB_URL or cli.database config"
|
|
49
|
-
};
|
|
50
|
-
var DATABASE_TYPE_PROPERTY = {
|
|
51
|
-
type: "string",
|
|
52
|
-
enum: [
|
|
53
|
-
"sqlite",
|
|
54
|
-
"postgres",
|
|
55
|
-
"duckdb"
|
|
56
|
-
],
|
|
57
|
-
description: "Optional engine hint for dbUrl or the environment connection (sqlite, postgres, duckdb); inferred from the URL scheme when omitted"
|
|
58
|
-
};
|
|
59
|
-
var LIMIT_PROPERTY = {
|
|
60
|
-
type: "number",
|
|
61
|
-
description: "Row budget for result lists (default 50, capped at 500)"
|
|
62
|
-
};
|
|
63
|
-
var TOOLS = [
|
|
64
|
-
{
|
|
65
|
-
name: "generate-smrt-class",
|
|
66
|
-
description: "Generate a complete SMRT class with @smrt() decorator",
|
|
67
|
-
inputSchema: {
|
|
68
|
-
type: "object",
|
|
69
|
-
properties: {
|
|
70
|
-
className: {
|
|
71
|
-
type: "string",
|
|
72
|
-
description: "Name of the class (PascalCase)"
|
|
73
|
-
},
|
|
74
|
-
properties: {
|
|
75
|
-
type: "array",
|
|
76
|
-
description: "Array of property definitions",
|
|
77
|
-
items: {
|
|
78
|
-
type: "object",
|
|
79
|
-
properties: {
|
|
80
|
-
name: { type: "string" },
|
|
81
|
-
type: {
|
|
82
|
-
type: "string",
|
|
83
|
-
enum: [
|
|
84
|
-
"text",
|
|
85
|
-
"integer",
|
|
86
|
-
"decimal",
|
|
87
|
-
"boolean",
|
|
88
|
-
"datetime",
|
|
89
|
-
"json"
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
required: { type: "boolean" },
|
|
93
|
-
nullable: { type: "boolean" },
|
|
94
|
-
description: { type: "string" },
|
|
95
|
-
defaultValue: { oneOf: [
|
|
96
|
-
{ type: "string" },
|
|
97
|
-
{ type: "number" },
|
|
98
|
-
{ type: "boolean" },
|
|
99
|
-
{ type: "object" },
|
|
100
|
-
{ type: "null" }
|
|
101
|
-
] }
|
|
102
|
-
},
|
|
103
|
-
required: ["name", "type"]
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
baseClass: {
|
|
107
|
-
type: "string",
|
|
108
|
-
enum: ["SmrtObject", "SmrtCollection"],
|
|
109
|
-
default: "SmrtObject"
|
|
110
|
-
},
|
|
111
|
-
template: {
|
|
112
|
-
type: "string",
|
|
113
|
-
enum: [
|
|
114
|
-
"basic",
|
|
115
|
-
"global-catalog",
|
|
116
|
-
"optional-catalog",
|
|
117
|
-
"tenant-project-object",
|
|
118
|
-
"tenant-event-log-object",
|
|
119
|
-
"cross-package-reference"
|
|
120
|
-
],
|
|
121
|
-
default: "basic"
|
|
122
|
-
},
|
|
123
|
-
tableName: { type: "string" },
|
|
124
|
-
conflictColumns: {
|
|
125
|
-
type: "array",
|
|
126
|
-
items: { type: "string" }
|
|
127
|
-
},
|
|
128
|
-
tenantScoped: { oneOf: [{ type: "boolean" }, {
|
|
129
|
-
type: "object",
|
|
130
|
-
properties: {
|
|
131
|
-
mode: {
|
|
132
|
-
type: "string",
|
|
133
|
-
enum: ["required", "optional"]
|
|
134
|
-
},
|
|
135
|
-
field: { type: "string" },
|
|
136
|
-
autoFilter: { type: "boolean" },
|
|
137
|
-
autoPopulate: { type: "boolean" },
|
|
138
|
-
allowSuperAdminBypass: { type: "boolean" }
|
|
139
|
-
}
|
|
140
|
-
}] },
|
|
141
|
-
includeTenantIdField: { type: "boolean" },
|
|
142
|
-
relationships: {
|
|
143
|
-
type: "array",
|
|
144
|
-
items: {
|
|
145
|
-
type: "object",
|
|
146
|
-
properties: {
|
|
147
|
-
name: { type: "string" },
|
|
148
|
-
type: {
|
|
149
|
-
type: "string",
|
|
150
|
-
enum: [
|
|
151
|
-
"foreignKey",
|
|
152
|
-
"crossPackageRef",
|
|
153
|
-
"oneToMany",
|
|
154
|
-
"manyToMany"
|
|
155
|
-
]
|
|
156
|
-
},
|
|
157
|
-
related: { type: "string" },
|
|
158
|
-
required: { type: "boolean" },
|
|
159
|
-
nullable: { type: "boolean" },
|
|
160
|
-
description: { type: "string" },
|
|
161
|
-
validate: { type: "boolean" },
|
|
162
|
-
foreignKey: { type: "string" },
|
|
163
|
-
through: { type: "string" },
|
|
164
|
-
sourceKey: { type: "string" },
|
|
165
|
-
targetKey: { type: "string" }
|
|
166
|
-
},
|
|
167
|
-
required: [
|
|
168
|
-
"name",
|
|
169
|
-
"type",
|
|
170
|
-
"related"
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
includeCompanionSnippets: {
|
|
175
|
-
type: "boolean",
|
|
176
|
-
default: false
|
|
177
|
-
},
|
|
178
|
-
includeApiConfig: {
|
|
179
|
-
type: "boolean",
|
|
180
|
-
default: true
|
|
181
|
-
},
|
|
182
|
-
includeMcpConfig: {
|
|
183
|
-
type: "boolean",
|
|
184
|
-
default: true
|
|
185
|
-
},
|
|
186
|
-
includeCliConfig: {
|
|
187
|
-
type: "boolean",
|
|
188
|
-
default: true
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
required: ["className", "properties"]
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: "introspect-project",
|
|
196
|
-
description: "Scan a directory for SMRT objects. Returns a compact summary by default; pass detail: \"full\" for field, schema, and method details.",
|
|
197
|
-
inputSchema: {
|
|
198
|
-
type: "object",
|
|
199
|
-
properties: {
|
|
200
|
-
directory: {
|
|
201
|
-
type: "string",
|
|
202
|
-
description: "Project directory (default: cwd)"
|
|
203
|
-
},
|
|
204
|
-
manifestPath: {
|
|
205
|
-
type: "string",
|
|
206
|
-
description: "Optional manifest path. Defaults to .smrt/manifest.json, dist/manifest.json, then source scanning."
|
|
207
|
-
},
|
|
208
|
-
detail: {
|
|
209
|
-
type: "string",
|
|
210
|
-
enum: ["summary", "full"],
|
|
211
|
-
default: "summary",
|
|
212
|
-
description: "summary: one compact record per object. full: complete field/schema/method detail (large)."
|
|
213
|
-
},
|
|
214
|
-
maxChars: {
|
|
215
|
-
type: "number",
|
|
216
|
-
description: "Character budget for the `objects` payload. Objects past the budget are omitted and reported under `truncated`. Project metadata and diagnostics are always returned in full, so the serialized response is somewhat larger than this budget."
|
|
217
|
-
},
|
|
218
|
-
includeFields: {
|
|
219
|
-
type: "boolean",
|
|
220
|
-
description: "Include field details (detail: \"full\" only)"
|
|
221
|
-
},
|
|
222
|
-
includeRelationships: {
|
|
223
|
-
type: "boolean",
|
|
224
|
-
description: "Analyze relationships (detail: \"full\" only)"
|
|
225
|
-
},
|
|
226
|
-
includeMethods: {
|
|
227
|
-
type: "boolean",
|
|
228
|
-
description: "Include public method details (detail: \"full\" only)"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: "review-smrt-project",
|
|
235
|
-
description: "Advisory ecosystem alignment review for downstream SMRT projects",
|
|
236
|
-
inputSchema: {
|
|
237
|
-
type: "object",
|
|
238
|
-
properties: {
|
|
239
|
-
directory: {
|
|
240
|
-
type: "string",
|
|
241
|
-
description: "Project directory (default: cwd)"
|
|
242
|
-
},
|
|
243
|
-
rootDir: {
|
|
244
|
-
type: "string",
|
|
245
|
-
description: "Compatibility alias for directory"
|
|
246
|
-
},
|
|
247
|
-
includeSourceEvidence: {
|
|
248
|
-
type: "boolean",
|
|
249
|
-
description: "Include file and line evidence in findings",
|
|
250
|
-
default: true
|
|
251
|
-
},
|
|
252
|
-
maxFindings: {
|
|
253
|
-
type: "number",
|
|
254
|
-
description: "Optional maximum number of findings to return"
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
name: "reflect-knowledge",
|
|
261
|
-
description: "Report deterministic SMRT + HappyVertical SDK knowledge coverage and freshness",
|
|
262
|
-
inputSchema: {
|
|
263
|
-
type: "object",
|
|
264
|
-
properties: { rootDir: {
|
|
265
|
-
type: "string",
|
|
266
|
-
description: "Project root directory (default: cwd)"
|
|
267
|
-
} }
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
name: "reflect-domain-knowledge",
|
|
272
|
-
description: "Report domain-scoped SMRT knowledge artifacts, SDK packages, and freshness",
|
|
273
|
-
inputSchema: {
|
|
274
|
-
type: "object",
|
|
275
|
-
properties: {
|
|
276
|
-
rootDir: { type: "string" },
|
|
277
|
-
scope: {
|
|
278
|
-
type: "string",
|
|
279
|
-
enum: [
|
|
280
|
-
"project",
|
|
281
|
-
"local",
|
|
282
|
-
"package",
|
|
283
|
-
"sdk",
|
|
284
|
-
"installed"
|
|
285
|
-
],
|
|
286
|
-
default: "project"
|
|
287
|
-
},
|
|
288
|
-
package: { type: "string" }
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
name: "check-knowledge-freshness",
|
|
294
|
-
description: "Run deterministic freshness checks for SMRT agent knowledge",
|
|
295
|
-
inputSchema: {
|
|
296
|
-
type: "object",
|
|
297
|
-
properties: {
|
|
298
|
-
rootDir: { type: "string" },
|
|
299
|
-
changed: {
|
|
300
|
-
type: "boolean",
|
|
301
|
-
description: "Limit stale-pattern checks to changed files"
|
|
302
|
-
},
|
|
303
|
-
strict: {
|
|
304
|
-
type: "boolean",
|
|
305
|
-
description: "Treat stale-pattern findings as errors"
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
name: "check-domain-knowledge",
|
|
312
|
-
description: "Run deterministic freshness checks for domain knowledge artifacts",
|
|
313
|
-
inputSchema: {
|
|
314
|
-
type: "object",
|
|
315
|
-
properties: {
|
|
316
|
-
rootDir: { type: "string" },
|
|
317
|
-
changed: { type: "boolean" },
|
|
318
|
-
strict: { type: "boolean" },
|
|
319
|
-
scope: {
|
|
320
|
-
type: "string",
|
|
321
|
-
enum: [
|
|
322
|
-
"project",
|
|
323
|
-
"local",
|
|
324
|
-
"package",
|
|
325
|
-
"sdk",
|
|
326
|
-
"installed"
|
|
327
|
-
],
|
|
328
|
-
default: "project"
|
|
329
|
-
},
|
|
330
|
-
package: { type: "string" }
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: "build-review-context",
|
|
336
|
-
description: "Build model-ready SMRT review context from changed files and optional focus text",
|
|
337
|
-
inputSchema: {
|
|
338
|
-
type: "object",
|
|
339
|
-
properties: {
|
|
340
|
-
rootDir: { type: "string" },
|
|
341
|
-
changedFiles: {
|
|
342
|
-
type: "array",
|
|
343
|
-
items: { type: "string" }
|
|
344
|
-
},
|
|
345
|
-
focus: { type: "string" },
|
|
346
|
-
documentation: { type: "string" },
|
|
347
|
-
detail: {
|
|
348
|
-
type: "string",
|
|
349
|
-
enum: [
|
|
350
|
-
"summary",
|
|
351
|
-
"full",
|
|
352
|
-
"complete"
|
|
353
|
-
],
|
|
354
|
-
default: "summary",
|
|
355
|
-
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
name: "build-domain-review-context",
|
|
362
|
-
description: "Build domain-scoped model-ready SMRT review context and prompt bundle",
|
|
363
|
-
inputSchema: {
|
|
364
|
-
type: "object",
|
|
365
|
-
properties: {
|
|
366
|
-
rootDir: { type: "string" },
|
|
367
|
-
changedFiles: {
|
|
368
|
-
type: "array",
|
|
369
|
-
items: { type: "string" }
|
|
370
|
-
},
|
|
371
|
-
focus: { type: "string" },
|
|
372
|
-
documentation: { type: "string" },
|
|
373
|
-
scope: {
|
|
374
|
-
type: "string",
|
|
375
|
-
enum: [
|
|
376
|
-
"project",
|
|
377
|
-
"local",
|
|
378
|
-
"package",
|
|
379
|
-
"sdk",
|
|
380
|
-
"installed"
|
|
381
|
-
],
|
|
382
|
-
default: "project"
|
|
383
|
-
},
|
|
384
|
-
package: { type: "string" },
|
|
385
|
-
detail: {
|
|
386
|
-
type: "string",
|
|
387
|
-
enum: [
|
|
388
|
-
"summary",
|
|
389
|
-
"full",
|
|
390
|
-
"complete"
|
|
391
|
-
],
|
|
392
|
-
default: "summary",
|
|
393
|
-
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
name: "smrt-review",
|
|
400
|
-
description: "Return deterministic review findings and/or a reusable model prompt bundle. For a formal downstream review, first call get-agent-skill with { \"name\": \"smrt-code-review\" } or load the smrt-code-review MCP prompt/resource.",
|
|
401
|
-
inputSchema: {
|
|
402
|
-
type: "object",
|
|
403
|
-
properties: {
|
|
404
|
-
rootDir: { type: "string" },
|
|
405
|
-
changedFiles: {
|
|
406
|
-
type: "array",
|
|
407
|
-
items: { type: "string" }
|
|
408
|
-
},
|
|
409
|
-
focus: { type: "string" },
|
|
410
|
-
documentation: { type: "string" },
|
|
411
|
-
mode: {
|
|
412
|
-
type: "string",
|
|
413
|
-
enum: [
|
|
414
|
-
"findings",
|
|
415
|
-
"prompt-bundle",
|
|
416
|
-
"both"
|
|
417
|
-
],
|
|
418
|
-
default: "both"
|
|
419
|
-
},
|
|
420
|
-
detail: {
|
|
421
|
-
type: "string",
|
|
422
|
-
enum: [
|
|
423
|
-
"summary",
|
|
424
|
-
"full",
|
|
425
|
-
"complete"
|
|
426
|
-
],
|
|
427
|
-
default: "summary",
|
|
428
|
-
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
name: "build-architecture-context",
|
|
435
|
-
description: "Build model-ready SMRT architecture context from an idea or documentation",
|
|
436
|
-
inputSchema: {
|
|
437
|
-
type: "object",
|
|
438
|
-
properties: {
|
|
439
|
-
rootDir: { type: "string" },
|
|
440
|
-
idea: { type: "string" },
|
|
441
|
-
documentation: { type: "string" },
|
|
442
|
-
focus: { type: "string" },
|
|
443
|
-
detail: {
|
|
444
|
-
type: "string",
|
|
445
|
-
enum: [
|
|
446
|
-
"summary",
|
|
447
|
-
"full",
|
|
448
|
-
"complete"
|
|
449
|
-
],
|
|
450
|
-
default: "summary",
|
|
451
|
-
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
name: "build-package-specialist-context",
|
|
458
|
-
description: "Build deterministic package specialist context for the SMRT workbench",
|
|
459
|
-
inputSchema: {
|
|
460
|
-
type: "object",
|
|
461
|
-
properties: {
|
|
462
|
-
rootDir: { type: "string" },
|
|
463
|
-
package: {
|
|
464
|
-
type: "string",
|
|
465
|
-
description: "Package name or short package query, e.g. @happyvertical/smrt-content or content"
|
|
466
|
-
},
|
|
467
|
-
focus: { type: "string" }
|
|
468
|
-
},
|
|
469
|
-
required: ["package"]
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
name: "build-domain-architecture-context",
|
|
474
|
-
description: "Build domain-scoped model-ready SMRT architecture context and prompt bundle",
|
|
475
|
-
inputSchema: {
|
|
476
|
-
type: "object",
|
|
477
|
-
properties: {
|
|
478
|
-
rootDir: { type: "string" },
|
|
479
|
-
idea: { type: "string" },
|
|
480
|
-
documentation: { type: "string" },
|
|
481
|
-
focus: { type: "string" },
|
|
482
|
-
scope: {
|
|
483
|
-
type: "string",
|
|
484
|
-
enum: [
|
|
485
|
-
"project",
|
|
486
|
-
"local",
|
|
487
|
-
"package",
|
|
488
|
-
"sdk",
|
|
489
|
-
"installed"
|
|
490
|
-
],
|
|
491
|
-
default: "project"
|
|
492
|
-
},
|
|
493
|
-
package: { type: "string" },
|
|
494
|
-
detail: {
|
|
495
|
-
type: "string",
|
|
496
|
-
enum: [
|
|
497
|
-
"summary",
|
|
498
|
-
"full",
|
|
499
|
-
"complete"
|
|
500
|
-
],
|
|
501
|
-
default: "summary",
|
|
502
|
-
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
name: "smrt-architecture",
|
|
509
|
-
description: "Suggest SMRT and HappyVertical SDK packages and return an architecture prompt bundle",
|
|
510
|
-
inputSchema: {
|
|
511
|
-
type: "object",
|
|
512
|
-
properties: {
|
|
513
|
-
rootDir: { type: "string" },
|
|
514
|
-
idea: { type: "string" },
|
|
515
|
-
documentation: { type: "string" },
|
|
516
|
-
focus: { type: "string" },
|
|
517
|
-
detail: {
|
|
518
|
-
type: "string",
|
|
519
|
-
enum: [
|
|
520
|
-
"summary",
|
|
521
|
-
"full",
|
|
522
|
-
"complete"
|
|
523
|
-
],
|
|
524
|
-
default: "summary",
|
|
525
|
-
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
name: "list-agent-skills",
|
|
532
|
-
description: "List bundled harness-agnostic agent skills shipped with smrt-dev-mcp",
|
|
533
|
-
inputSchema: {
|
|
534
|
-
type: "object",
|
|
535
|
-
properties: {}
|
|
536
|
-
}
|
|
537
|
-
},
|
|
538
|
-
{
|
|
539
|
-
name: "get-agent-skill",
|
|
540
|
-
description: "Return a bundled harness-agnostic agent skill as Markdown plus optional references",
|
|
541
|
-
inputSchema: {
|
|
542
|
-
type: "object",
|
|
543
|
-
properties: {
|
|
544
|
-
name: {
|
|
545
|
-
type: "string",
|
|
546
|
-
enum: [REVIEW_SKILL_NAME],
|
|
547
|
-
description: "Bundled agent skill name"
|
|
548
|
-
},
|
|
549
|
-
includeReferences: {
|
|
550
|
-
type: "boolean",
|
|
551
|
-
default: true,
|
|
552
|
-
description: "Include referenced files with the skill bundle"
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
required: ["name"]
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
name: "migration-status",
|
|
560
|
-
description: "Live migration status from the _smrt_schema_migrations system table (runtime provenance; read-only)",
|
|
561
|
-
inputSchema: {
|
|
562
|
-
type: "object",
|
|
563
|
-
properties: {
|
|
564
|
-
dbUrl: DATABASE_URL_PROPERTY,
|
|
565
|
-
dbType: DATABASE_TYPE_PROPERTY,
|
|
566
|
-
limit: LIMIT_PROPERTY
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
name: "job-health",
|
|
572
|
-
description: "Live job queue health from the _smrt_jobs/_smrt_workers system tables (runtime provenance; read-only)",
|
|
573
|
-
inputSchema: {
|
|
574
|
-
type: "object",
|
|
575
|
-
properties: {
|
|
576
|
-
dbUrl: DATABASE_URL_PROPERTY,
|
|
577
|
-
dbType: DATABASE_TYPE_PROPERTY,
|
|
578
|
-
limit: LIMIT_PROPERTY
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
name: "schedule-health",
|
|
584
|
-
description: "Live agent schedule health from the _smrt_agent_schedules system table (runtime provenance; read-only; sensitive agentConfig never read)",
|
|
585
|
-
inputSchema: {
|
|
586
|
-
type: "object",
|
|
587
|
-
properties: {
|
|
588
|
-
dbUrl: DATABASE_URL_PROPERTY,
|
|
589
|
-
dbType: DATABASE_TYPE_PROPERTY,
|
|
590
|
-
limit: LIMIT_PROPERTY
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
name: "dispatch-health",
|
|
596
|
-
description: "Live dispatch health from the _smrt_dispatch/_smrt_dispatch_subscriptions system tables (runtime provenance; read-only; payloads never read)",
|
|
597
|
-
inputSchema: {
|
|
598
|
-
type: "object",
|
|
599
|
-
properties: {
|
|
600
|
-
dbUrl: DATABASE_URL_PROPERTY,
|
|
601
|
-
dbType: DATABASE_TYPE_PROPERTY,
|
|
602
|
-
limit: LIMIT_PROPERTY
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
name: "recent-changes",
|
|
608
|
-
description: "Tail of the _smrt_changes change feed (runtime provenance; read-only; filter by table/tenant)",
|
|
609
|
-
inputSchema: {
|
|
610
|
-
type: "object",
|
|
611
|
-
properties: {
|
|
612
|
-
dbUrl: DATABASE_URL_PROPERTY,
|
|
613
|
-
dbType: DATABASE_TYPE_PROPERTY,
|
|
614
|
-
since: {
|
|
615
|
-
type: "number",
|
|
616
|
-
description: "Cursor to read after (default 0)"
|
|
617
|
-
},
|
|
618
|
-
tables: {
|
|
619
|
-
type: "array",
|
|
620
|
-
items: { type: "string" },
|
|
621
|
-
description: "Restrict to these physical table names"
|
|
622
|
-
},
|
|
623
|
-
tenantId: {
|
|
624
|
-
type: "string",
|
|
625
|
-
description: "Tenant narrowing filter"
|
|
626
|
-
},
|
|
627
|
-
limit: LIMIT_PROPERTY
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
name: "registry-drift",
|
|
633
|
-
description: "Registry drift report; _smrt_registry is retired and reported as such, never queried (read-only)",
|
|
634
|
-
inputSchema: {
|
|
635
|
-
type: "object",
|
|
636
|
-
properties: {
|
|
637
|
-
dbUrl: DATABASE_URL_PROPERTY,
|
|
638
|
-
dbType: DATABASE_TYPE_PROPERTY
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
].map((tool) => ({
|
|
643
|
-
...tool,
|
|
644
|
-
inputSchema: {
|
|
645
|
-
...tool.inputSchema,
|
|
646
|
-
$schema: JSON_SCHEMA_2020_12
|
|
647
|
-
},
|
|
648
|
-
outputSchema: DEV_MCP_OUTPUT_SCHEMA
|
|
649
|
-
})).sort((left, right) => compareToolNames(left.name, right.name));
|
|
650
|
-
//#endregion
|
|
651
9
|
//#region src/knowledge/mcp-docs.ts
|
|
652
10
|
var PACKAGE_NAME = "@happyvertical/smrt-dev-mcp";
|
|
653
11
|
/**
|
|
@@ -1441,10 +799,12 @@ async function buildReviewContext(options = {}) {
|
|
|
1441
799
|
scope: options.scope,
|
|
1442
800
|
packageName: options.packageName ?? options.package
|
|
1443
801
|
});
|
|
802
|
+
const reviewFindings = buildReviewFindings(index, changedFiles, selectedPackages);
|
|
1444
803
|
return {
|
|
1445
804
|
selectedPackages,
|
|
1446
805
|
selectedSdkPackages,
|
|
1447
|
-
deterministicFindings: findStalePatternIssues(index.rootDir, changedFiles.length > 0 ? changedFiles : void 0).concat(
|
|
806
|
+
deterministicFindings: findStalePatternIssues(index.rootDir, changedFiles.length > 0 ? changedFiles : void 0).concat(reviewFindings.findings),
|
|
807
|
+
reviewHints: reviewFindings.hints,
|
|
1448
808
|
promptBundle: buildPromptBundle({
|
|
1449
809
|
title: "SMRT code review",
|
|
1450
810
|
task: "Review the changed SMRT code. Prioritize correctness, relationships-v2 invariants, tenancy, SDK usage, prompt/data safety, and stale documentation.",
|
|
@@ -1470,7 +830,10 @@ async function smrtReview(options = {}) {
|
|
|
1470
830
|
mode,
|
|
1471
831
|
selectedPackages: context.selectedPackages,
|
|
1472
832
|
selectedSdkPackages: context.selectedSdkPackages,
|
|
1473
|
-
...mode !== "prompt-bundle" ? {
|
|
833
|
+
...mode !== "prompt-bundle" ? {
|
|
834
|
+
deterministicFindings: context.deterministicFindings,
|
|
835
|
+
reviewHints: context.reviewHints
|
|
836
|
+
} : {},
|
|
1474
837
|
...mode !== "findings" ? { promptBundle: context.promptBundle } : {},
|
|
1475
838
|
coverage: context.coverage,
|
|
1476
839
|
diagnostics: context.diagnostics
|
|
@@ -1539,6 +902,24 @@ async function buildPackageSpecialistContext(options = {}) {
|
|
|
1539
902
|
})
|
|
1540
903
|
};
|
|
1541
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* The single context entry point (#2780). `task: 'review'` routes changed
|
|
907
|
+
* files and focus text to package experts and returns findings, hints, and a
|
|
908
|
+
* prompt bundle; `task: 'architecture'` ranks packages by the idea text and
|
|
909
|
+
* returns the bundle plus recommendations. Replaces build-review-context,
|
|
910
|
+
* build-domain-review-context, build-architecture-context, and
|
|
911
|
+
* build-domain-architecture-context, which dispatched to the same code.
|
|
912
|
+
*/
|
|
913
|
+
async function buildContext(options) {
|
|
914
|
+
if (options.task === "architecture") return {
|
|
915
|
+
task: "architecture",
|
|
916
|
+
...await smrtArchitecture(options)
|
|
917
|
+
};
|
|
918
|
+
return {
|
|
919
|
+
task: "review",
|
|
920
|
+
...await smrtReview(options)
|
|
921
|
+
};
|
|
922
|
+
}
|
|
1542
923
|
async function smrtArchitecture(options = {}) {
|
|
1543
924
|
const context = await buildArchitectureContext(options);
|
|
1544
925
|
const ideaText = [
|
|
@@ -2667,6 +2048,7 @@ function shouldScanStalePatternFile(rootDir, filePath) {
|
|
|
2667
2048
|
}
|
|
2668
2049
|
function buildReviewFindings(index, changedFiles, selectedPackages) {
|
|
2669
2050
|
const issues = [];
|
|
2051
|
+
const hints = [];
|
|
2670
2052
|
for (const pkg of selectedPackages) {
|
|
2671
2053
|
const changedPackageFiles = changedFiles.filter((file) => packageOwnsFile(pkg, file, index.packages));
|
|
2672
2054
|
if (!pkg.agentDoc && pkg.kind === "smrt") issues.push({
|
|
@@ -2676,15 +2058,15 @@ function buildReviewFindings(index, changedFiles, selectedPackages) {
|
|
|
2676
2058
|
file: pkg.relativeDirectory,
|
|
2677
2059
|
packageName: pkg.name
|
|
2678
2060
|
});
|
|
2679
|
-
if (changedPackageFiles.some((file) => file.endsWith(".ts")) && pkg.relationshipFeatures.length > 0)
|
|
2680
|
-
severity: "
|
|
2061
|
+
if (changedPackageFiles.some((file) => file.endsWith(".ts")) && pkg.relationshipFeatures.length > 0) hints.push({
|
|
2062
|
+
severity: "info",
|
|
2681
2063
|
code: "relationship-sensitive-review",
|
|
2682
2064
|
message: `Package uses relationships-v2 features: ${pkg.relationshipFeatures.join(", ")}`,
|
|
2683
2065
|
file: changedPackageFiles.find((file) => file.endsWith(".ts")),
|
|
2684
2066
|
packageName: pkg.name
|
|
2685
2067
|
});
|
|
2686
|
-
if (changedPackageFiles.some((file) => file.endsWith(".ts")) && pkg.mcpTools.length > 0)
|
|
2687
|
-
severity: "
|
|
2068
|
+
if (changedPackageFiles.some((file) => file.endsWith(".ts")) && pkg.mcpTools.length > 0) hints.push({
|
|
2069
|
+
severity: "info",
|
|
2688
2070
|
code: "mcp-surface-review",
|
|
2689
2071
|
message: `Package exposes ${pkg.mcpTools.length} generated MCP tool(s); check public tool compatibility`,
|
|
2690
2072
|
file: changedPackageFiles.find((file) => file.endsWith(".ts")),
|
|
@@ -2725,7 +2107,10 @@ function buildReviewFindings(index, changedFiles, selectedPackages) {
|
|
|
2725
2107
|
file
|
|
2726
2108
|
});
|
|
2727
2109
|
}
|
|
2728
|
-
return
|
|
2110
|
+
return {
|
|
2111
|
+
findings: issues,
|
|
2112
|
+
hints
|
|
2113
|
+
};
|
|
2729
2114
|
}
|
|
2730
2115
|
/**
|
|
2731
2116
|
* Joins a package-relative path onto a package's workspace-relative directory.
|
|
@@ -2837,9 +2222,14 @@ function selectPackages(index, options) {
|
|
|
2837
2222
|
}
|
|
2838
2223
|
for (const pkg of selectPackagesForFiles(index, options.changedFiles ?? [])) if (scopeAllowsPackage(pkg, options.scope)) selected.add(pkg);
|
|
2839
2224
|
const text = (options.text ?? "").toLowerCase();
|
|
2225
|
+
const scores = /* @__PURE__ */ new Map();
|
|
2840
2226
|
if (text) for (const pkg of domainPackages(index)) {
|
|
2841
2227
|
if (!scopeAllowsPackage(pkg, options.scope)) continue;
|
|
2842
|
-
|
|
2228
|
+
const score = scorePackageForText(pkg, text);
|
|
2229
|
+
if (score > 0) {
|
|
2230
|
+
selected.add(pkg);
|
|
2231
|
+
scores.set(pkg, score);
|
|
2232
|
+
}
|
|
2843
2233
|
}
|
|
2844
2234
|
if (selected.size === 0 && options.scope === "local") for (const pkg of domainPackages(index).filter((item) => scopeAllowsPackage(item, "local"))) selected.add(pkg);
|
|
2845
2235
|
if (selected.size === 0 && options.scope !== "sdk") {
|
|
@@ -2858,7 +2248,44 @@ function selectPackages(index, options) {
|
|
|
2858
2248
|
for (const pkg of contributing) selected.add(pkg);
|
|
2859
2249
|
}
|
|
2860
2250
|
}
|
|
2861
|
-
return [...selected].sort((a, b) => a.name.localeCompare(b.name));
|
|
2251
|
+
return [...selected].sort((a, b) => (scores.get(b) ?? 0) - (scores.get(a) ?? 0) || a.name.localeCompare(b.name));
|
|
2252
|
+
}
|
|
2253
|
+
/** Word tokens (3+ chars) with naive singular/plural variants. */
|
|
2254
|
+
function textTokens(text) {
|
|
2255
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
2256
|
+
for (const raw of text.toLowerCase().match(/[a-z][a-z0-9_-]{2,}/g) ?? []) {
|
|
2257
|
+
tokens.add(raw);
|
|
2258
|
+
if (raw.endsWith("ies")) tokens.add(`${raw.slice(0, -3)}y`);
|
|
2259
|
+
else if (raw.endsWith("sses") || raw.endsWith("xes") || raw.endsWith("ches") || raw.endsWith("shes")) tokens.add(raw.slice(0, -2));
|
|
2260
|
+
else if (raw.endsWith("s") && !raw.endsWith("ss")) tokens.add(raw.slice(0, -1));
|
|
2261
|
+
else tokens.add(`${raw}s`);
|
|
2262
|
+
}
|
|
2263
|
+
return tokens;
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Score how strongly free text names a package: its short name, its full
|
|
2267
|
+
* name, its object class names, and its tables/collections/fields. A
|
|
2268
|
+
* request for "newsletter subscription with double opt-in" must rank
|
|
2269
|
+
* `smrt-subscriptions` above the framework default list.
|
|
2270
|
+
*/
|
|
2271
|
+
function scorePackageForText(pkg, text) {
|
|
2272
|
+
const tokens = textTokens(text);
|
|
2273
|
+
let score = 0;
|
|
2274
|
+
const shortName = pkg.name.replace("@happyvertical/smrt-", "").replace("@happyvertical/", "").toLowerCase();
|
|
2275
|
+
if (text.includes(pkg.name.toLowerCase())) score += 5;
|
|
2276
|
+
if (tokens.has(shortName)) score += 4;
|
|
2277
|
+
for (const object of pkg.objects) {
|
|
2278
|
+
const className = object.className.toLowerCase();
|
|
2279
|
+
if (tokens.has(className) || includesToken(text, className)) score += 3;
|
|
2280
|
+
for (const candidate of [object.collection, object.tableName]) if (candidate && tokens.has(candidate.toLowerCase())) score += 1;
|
|
2281
|
+
let fieldHits = 0;
|
|
2282
|
+
for (const field of object.fields) if (tokens.has(field.name.toLowerCase()) && fieldHits < 3) {
|
|
2283
|
+
fieldHits += 1;
|
|
2284
|
+
score += 1;
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
for (const tag of pkg.domainKnowledge?.tags ?? []) if (tokens.has(String(tag).toLowerCase())) score += 1;
|
|
2288
|
+
return score;
|
|
2862
2289
|
}
|
|
2863
2290
|
function selectSdkPackages(index, selectedPackages, texts, options = {}) {
|
|
2864
2291
|
const selected = /* @__PURE__ */ new Set();
|
|
@@ -3238,6 +2665,6 @@ function compactKnowledgePackage(pkg) {
|
|
|
3238
2665
|
};
|
|
3239
2666
|
}
|
|
3240
2667
|
//#endregion
|
|
3241
|
-
export {
|
|
2668
|
+
export { buildReviewContext as a, compactContextResult as c, renderFreshnessResult as d, renderKnowledgeIndexMarkdown as f, buildPackageSpecialistContext as i, diffKnowledgeIndex as l, smrtReview as m, buildContext as n, checkKnowledgeFreshness as o, smrtArchitecture as p, buildKnowledgeIndex as r, checkKnowledgeFreshnessFromIndex as s, buildArchitectureContext as t, packageDocPaths as u };
|
|
3242
2669
|
|
|
3243
|
-
//# sourceMappingURL=knowledge-
|
|
2670
|
+
//# sourceMappingURL=knowledge-BOsSAdPo.js.map
|