@happyvertical/smrt-dev-mcp 0.43.10 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/knowledge/index.d.ts +7 -1
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/{knowledge-CLGmlHl6.js → knowledge-D2k9xM3M.js} +183 -4
- package/dist/knowledge-D2k9xM3M.js.map +1 -0
- package/dist/knowledge.js +1 -1
- package/package.json +4 -4
- package/dist/knowledge-CLGmlHl6.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as checkKnowledgeFreshness, c as packageDocPaths, d as smrtArchitecture, f as smrtReview, i as buildReviewContext, m as TOOLS, n as buildKnowledgeIndex, o as checkKnowledgeFreshnessFromIndex, p as REVIEW_SKILL_NAME, r as buildPackageSpecialistContext, t as buildArchitectureContext } from "./knowledge-
|
|
2
|
+
import { a as checkKnowledgeFreshness, c as packageDocPaths, d as smrtArchitecture, f as smrtReview, i as buildReviewContext, m as TOOLS, n as buildKnowledgeIndex, o as checkKnowledgeFreshnessFromIndex, p as REVIEW_SKILL_NAME, r as buildPackageSpecialistContext, t as buildArchitectureContext } from "./knowledge-D2k9xM3M.js";
|
|
3
3
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DomainKnowledgeField, DomainKnowledgeManifest, DomainKnowledgeMethodSignature, DomainKnowledgeModuleDoc, DomainKnowledgeTenant } from '@happyvertical/smrt-types';
|
|
1
|
+
import { DomainKnowledgeAgentSurface, DomainKnowledgeField, DomainKnowledgeManifest, DomainKnowledgeMethodSignature, DomainKnowledgeModuleDoc, DomainKnowledgeTenant } from '@happyvertical/smrt-types';
|
|
2
2
|
export type KnowledgePackageKind = 'smrt' | 'sdk' | 'workspace';
|
|
3
3
|
export type KnowledgeIssueSeverity = 'error' | 'warning';
|
|
4
4
|
/**
|
|
@@ -87,6 +87,12 @@ export interface KnowledgePackage {
|
|
|
87
87
|
hasDomainKnowledge: boolean;
|
|
88
88
|
domainKnowledgePath?: string;
|
|
89
89
|
domainKnowledge?: DomainKnowledgeManifest;
|
|
90
|
+
/**
|
|
91
|
+
* The package's declared view intents and playbooks (#2591), lifted out of
|
|
92
|
+
* the domain-knowledge artifact so a consumer of the index never has to reach
|
|
93
|
+
* into the whole artifact for them. Absent when the package declares none.
|
|
94
|
+
*/
|
|
95
|
+
agentSurface?: DomainKnowledgeAgentSurface;
|
|
90
96
|
manifestPath?: string;
|
|
91
97
|
manifestVersion?: string;
|
|
92
98
|
objects: KnowledgeObject[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge/index.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EAEpB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EAExB,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAInC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC;AAChE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,CAAC;AACzD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,OAAO,GACP,SAAS,GACT,KAAK,GACL,WAAW,CAAC;AAEhB;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,UAAU,GACV,SAAS,GACT,MAAM,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS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AE,sBAA2B,GACnC,OAAO,CAAC,yBAAyB,CAAC,CAwCpC;AAED,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,8BAA8B,CAAC,CA+CzC;AAED,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,sBAAsB,CAAC,CASjC;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,kBAAkB,GACxB,MAAM,CAgFR;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,wBAAwB,GAC/B,MAAM,CAkBR;AAoyDD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAK/D"}
|
|
@@ -2,9 +2,9 @@ import { existsSync, lstatSync, opendirSync, readFileSync, readdirSync, realpath
|
|
|
2
2
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { MODULE_DOC_HASH_PREFIX, readAgentModuleDocs } from "@happyvertical/smrt-core/knowledge";
|
|
5
|
+
import { AGENT_SURFACE_HASH_PREFIX, MODULE_DOC_HASH_PREFIX, readAgentModuleDocs } from "@happyvertical/smrt-core/knowledge";
|
|
6
6
|
import { toSnakeCase } from "@happyvertical/smrt-core/utils";
|
|
7
|
-
import { ManifestAdapter, OxcScanner, lintNumericPrecision, parseSource, sourceMayContainNumericPrecisionIssue } from "@happyvertical/smrt-scanner";
|
|
7
|
+
import { ManifestAdapter, OxcScanner, isAgentSurfaceSourcePath, isPrunedAgentSurfacePath, lintNumericPrecision, mergeAgentSurfaces, parseSource, scanSvelteAgentSurface, sourceMayContainNumericPrecisionIssue, sourceMayDeclareAgentSurface } from "@happyvertical/smrt-scanner";
|
|
8
8
|
//#region src/tool-catalog.ts
|
|
9
9
|
var REVIEW_SKILL_NAME = "smrt-code-review";
|
|
10
10
|
var JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
@@ -1023,9 +1023,13 @@ async function checkKnowledgeFreshnessFromIndex(index, options = {}) {
|
|
|
1023
1023
|
packageName: pkg.name
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
|
-
for (const pkg of authoredPackages)
|
|
1026
|
+
for (const pkg of authoredPackages) {
|
|
1027
|
+
issues.push(...checkDomainKnowledgeArtifact(index.rootDir, pkg));
|
|
1028
|
+
issues.push(...checkAgentSurface(pkg));
|
|
1029
|
+
}
|
|
1027
1030
|
const devMcpPackage = authoredPackages.find((pkg) => pkg.name === "@happyvertical/smrt-dev-mcp");
|
|
1028
1031
|
if (devMcpPackage) issues.push(...checkMcpToolDocumentation(index.rootDir, devMcpPackage.directory, TOOLS));
|
|
1032
|
+
issues.push(...findAgentSurfaceDriftIssues(authoredPackages));
|
|
1029
1033
|
issues.push(...findStalePatternIssues(index.rootDir, changedFiles));
|
|
1030
1034
|
issues.push(...findNumericPrecisionIssues(index, authoredPackages, changedFiles));
|
|
1031
1035
|
const effectiveIssues = issues.map((issue) => issue.code.startsWith("stale-") ? {
|
|
@@ -1083,6 +1087,16 @@ function checkDomainKnowledgeArtifact(rootDir, pkg) {
|
|
|
1083
1087
|
kind: "raw",
|
|
1084
1088
|
label: docPath
|
|
1085
1089
|
};
|
|
1090
|
+
}),
|
|
1091
|
+
...Object.keys(hashes).filter((key) => key.startsWith(AGENT_SURFACE_HASH_PREFIX)).sort().map((key) => {
|
|
1092
|
+
const sourcePath = key.slice(AGENT_SURFACE_HASH_PREFIX.length);
|
|
1093
|
+
const filePath = join(pkg.directory, sourcePath);
|
|
1094
|
+
return {
|
|
1095
|
+
key,
|
|
1096
|
+
filePath: existsSync(filePath) ? filePath : void 0,
|
|
1097
|
+
kind: "raw",
|
|
1098
|
+
label: sourcePath
|
|
1099
|
+
};
|
|
1086
1100
|
})
|
|
1087
1101
|
];
|
|
1088
1102
|
for (const check of checks) {
|
|
@@ -1108,6 +1122,165 @@ function checkDomainKnowledgeArtifact(rootDir, pkg) {
|
|
|
1108
1122
|
}
|
|
1109
1123
|
return issues;
|
|
1110
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Validate the emitted agent surface (#2591).
|
|
1127
|
+
*
|
|
1128
|
+
* Two rules, and the second is the reason this exists at all:
|
|
1129
|
+
*
|
|
1130
|
+
* - an identity must be present and unique within the package. `id`/`key` is
|
|
1131
|
+
* what a playbook step, a parity snapshot, and `smrt doctor` all name, so a
|
|
1132
|
+
* blank or colliding one makes the surface unaddressable;
|
|
1133
|
+
* - every declaration the matcher recognized but could not read is reported.
|
|
1134
|
+
* It is a warning, not an error, because a computed tool set is a legitimate
|
|
1135
|
+
* choice with a supported path — but it is never silence, because the whole
|
|
1136
|
+
* value of emitting the surface is that "what can an agent do here" has one
|
|
1137
|
+
* answer, and an invisible declaration makes that answer wrong.
|
|
1138
|
+
*/
|
|
1139
|
+
function checkAgentSurface(pkg) {
|
|
1140
|
+
const surface = pkg.domainKnowledge?.agentSurface;
|
|
1141
|
+
if (!surface) return [];
|
|
1142
|
+
const issues = [];
|
|
1143
|
+
const file = pkg.domainKnowledgePath;
|
|
1144
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1145
|
+
const checkIdentity = (label, identity, sourceFile) => {
|
|
1146
|
+
if (!identity) {
|
|
1147
|
+
issues.push({
|
|
1148
|
+
severity: "error",
|
|
1149
|
+
code: "agent-surface-missing-identity",
|
|
1150
|
+
message: `${label} declared in ${sourceFile} has no identity`,
|
|
1151
|
+
file,
|
|
1152
|
+
packageName: pkg.name
|
|
1153
|
+
});
|
|
1154
|
+
return;
|
|
1155
|
+
}
|
|
1156
|
+
const scoped = `${label}:${identity}`;
|
|
1157
|
+
if (seen.has(scoped)) {
|
|
1158
|
+
issues.push({
|
|
1159
|
+
severity: "error",
|
|
1160
|
+
code: "agent-surface-duplicate-identity",
|
|
1161
|
+
message: `${label} \`${identity}\` is emitted more than once`,
|
|
1162
|
+
file,
|
|
1163
|
+
packageName: pkg.name
|
|
1164
|
+
});
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
seen.add(scoped);
|
|
1168
|
+
};
|
|
1169
|
+
for (const intent of surface.intents) checkIdentity("view intent", intent.id, intent.sourceFile);
|
|
1170
|
+
for (const playbook of surface.playbooks) {
|
|
1171
|
+
checkIdentity("playbook", playbook.key, playbook.sourceFile);
|
|
1172
|
+
if (playbook.steps.length === 0) issues.push({
|
|
1173
|
+
severity: "error",
|
|
1174
|
+
code: "agent-surface-empty-playbook",
|
|
1175
|
+
message: `playbook \`${playbook.key}\` declares no steps`,
|
|
1176
|
+
file,
|
|
1177
|
+
packageName: pkg.name
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
for (const diagnostic of surface.diagnostics) {
|
|
1181
|
+
const where = diagnostic.line ? `${diagnostic.sourceFile}:${diagnostic.line}` : diagnostic.sourceFile;
|
|
1182
|
+
const duplicate = diagnostic.code === "duplicate-identity";
|
|
1183
|
+
issues.push({
|
|
1184
|
+
severity: duplicate ? "error" : "warning",
|
|
1185
|
+
code: duplicate ? "agent-surface-duplicate-identity" : "agent-surface-not-static",
|
|
1186
|
+
message: `${where} — ${diagnostic.message}`,
|
|
1187
|
+
file,
|
|
1188
|
+
packageName: pkg.name
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
return issues;
|
|
1192
|
+
}
|
|
1193
|
+
/** Turn a comparison key back into something a human can act on. */
|
|
1194
|
+
function describeAgentSurfaceIdentity(identity) {
|
|
1195
|
+
if (!identity.startsWith("diagnostic:")) return identity;
|
|
1196
|
+
const [, code, ...rest] = identity.split(":");
|
|
1197
|
+
const line = rest.pop();
|
|
1198
|
+
const path = rest.join(":");
|
|
1199
|
+
return `${code} diagnostic at ${line && line !== "0" ? `${path}:${line}` : path}`;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Compare the artifact's emitted surface against what the sources declare NOW
|
|
1203
|
+
* (#2591).
|
|
1204
|
+
*
|
|
1205
|
+
* `sourceHashes` alone cannot see an ADDED declaration: a brand-new
|
|
1206
|
+
* `Foo.intents.ts` has no recorded hash to mismatch, the runtime manifest does
|
|
1207
|
+
* not change (intents never enter it), and `AGENTS.md` does not change either —
|
|
1208
|
+
* so every existing freshness signal stays green while the artifact silently
|
|
1209
|
+
* omits a real operation. That defeats the point of emitting the surface, so
|
|
1210
|
+
* the declaration SET is re-derived from source and compared by identity.
|
|
1211
|
+
*
|
|
1212
|
+
* The scan is bounded the same way the numeric-precision lint is: `src` only,
|
|
1213
|
+
* with the scanner's cheap token pre-filter in front of every parse. Which
|
|
1214
|
+
* files count is decided by the scanner's own `isAgentSurfaceSourcePath`, never
|
|
1215
|
+
* by a list copied into this package: the two sides disagreeing produces a
|
|
1216
|
+
* drift error no rebuild can clear, in whichever direction they differ.
|
|
1217
|
+
*/
|
|
1218
|
+
function findAgentSurfaceDriftIssues(authoredPackages) {
|
|
1219
|
+
const issues = [];
|
|
1220
|
+
for (const pkg of authoredPackages) {
|
|
1221
|
+
if (pkg.kind === "sdk" || pkg.isInstalledDependency) continue;
|
|
1222
|
+
if (!pkg.domainKnowledge || !pkg.domainKnowledgePath) continue;
|
|
1223
|
+
const srcDir = join(pkg.directory, "src");
|
|
1224
|
+
if (!existsSync(srcDir)) continue;
|
|
1225
|
+
const perFile = [];
|
|
1226
|
+
for (const filePath of walkFiles(srcDir)) {
|
|
1227
|
+
if (filePath.endsWith(".svelte")) {
|
|
1228
|
+
if (isPrunedAgentSurfacePath(filePath, pkg.directory)) continue;
|
|
1229
|
+
const diagnostics = scanSvelteAgentSurface(filePath);
|
|
1230
|
+
if (diagnostics.length > 0) perFile.push({
|
|
1231
|
+
intents: [],
|
|
1232
|
+
playbooks: [],
|
|
1233
|
+
diagnostics
|
|
1234
|
+
});
|
|
1235
|
+
continue;
|
|
1236
|
+
}
|
|
1237
|
+
if (!isAgentSurfaceSourcePath(filePath, pkg.directory)) continue;
|
|
1238
|
+
let sourceText;
|
|
1239
|
+
try {
|
|
1240
|
+
sourceText = readFileSync(filePath, "utf8");
|
|
1241
|
+
} catch {
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
if (!sourceMayDeclareAgentSurface(sourceText)) continue;
|
|
1245
|
+
const surface = parseSource(sourceText, filePath).agentSurface;
|
|
1246
|
+
if (surface) perFile.push(surface);
|
|
1247
|
+
}
|
|
1248
|
+
const merged = mergeAgentSurfaces(perFile, (filePath) => relative(pkg.directory, filePath).split(sep).join("/"));
|
|
1249
|
+
const declared = /* @__PURE__ */ new Set();
|
|
1250
|
+
for (const intent of merged.intents) declared.add(`view intent:${intent.id}`);
|
|
1251
|
+
for (const playbook of merged.playbooks) declared.add(`playbook:${playbook.key}`);
|
|
1252
|
+
for (const diagnostic of merged.diagnostics) declared.add(`diagnostic:${diagnostic.code}:${diagnostic.filePath}:${diagnostic.line ?? 0}`);
|
|
1253
|
+
const withinScan = (sourceFile) => sourceFile === "src" || sourceFile.startsWith("src/");
|
|
1254
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
1255
|
+
for (const intent of pkg.agentSurface?.intents ?? []) if (withinScan(intent.sourceFile)) emitted.add(`view intent:${intent.id}`);
|
|
1256
|
+
for (const playbook of pkg.agentSurface?.playbooks ?? []) if (withinScan(playbook.sourceFile)) emitted.add(`playbook:${playbook.key}`);
|
|
1257
|
+
for (const diagnostic of pkg.agentSurface?.diagnostics ?? []) {
|
|
1258
|
+
if (!withinScan(diagnostic.sourceFile)) continue;
|
|
1259
|
+
emitted.add(`diagnostic:${diagnostic.code}:${diagnostic.sourceFile}:${diagnostic.line ?? 0}`);
|
|
1260
|
+
}
|
|
1261
|
+
for (const identity of [...declared].sort()) {
|
|
1262
|
+
if (emitted.has(identity)) continue;
|
|
1263
|
+
issues.push({
|
|
1264
|
+
severity: "error",
|
|
1265
|
+
code: "stale-agent-surface",
|
|
1266
|
+
message: `${describeAgentSurfaceIdentity(identity)} is present in source but missing from smrt-knowledge.json — rebuild the package`,
|
|
1267
|
+
file: pkg.domainKnowledgePath,
|
|
1268
|
+
packageName: pkg.name
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
for (const identity of [...emitted].sort()) {
|
|
1272
|
+
if (declared.has(identity)) continue;
|
|
1273
|
+
issues.push({
|
|
1274
|
+
severity: "error",
|
|
1275
|
+
code: "stale-agent-surface",
|
|
1276
|
+
message: `${describeAgentSurfaceIdentity(identity)} is in smrt-knowledge.json but no longer present in source — rebuild the package`,
|
|
1277
|
+
file: pkg.domainKnowledgePath,
|
|
1278
|
+
packageName: pkg.name
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
return issues;
|
|
1283
|
+
}
|
|
1111
1284
|
function domainSourceManifestPath(rootDir, pkg) {
|
|
1112
1285
|
if (pkg.domainKnowledge?.sourceManifestPath) return join(pkg.directory, pkg.domainKnowledge.sourceManifestPath);
|
|
1113
1286
|
if (pkg.manifestPath) return join(rootDir, pkg.manifestPath);
|
|
@@ -1292,6 +1465,11 @@ function renderKnowledgeIndexMarkdown(index) {
|
|
|
1292
1465
|
}
|
|
1293
1466
|
if (pkg.moduleDocs.length > 0) lines.push(`- module docs: ${pkg.moduleDocs.map((doc) => doc.path).join(", ")}`);
|
|
1294
1467
|
if (pkg.relationshipFeatures.length > 0) lines.push(`- relationships-v2: ${pkg.relationshipFeatures.join(", ")}`);
|
|
1468
|
+
if (pkg.agentSurface) {
|
|
1469
|
+
lines.push(`- view intents: ${pkg.agentSurface.intents.map((intent) => intent.id).join(", ") || "(none)"}`);
|
|
1470
|
+
lines.push(`- playbooks: ${pkg.agentSurface.playbooks.map((playbook) => playbook.key).join(", ") || "(none)"}`);
|
|
1471
|
+
if (pkg.agentSurface.diagnostics.length > 0) lines.push(`- non-static declarations: ${pkg.agentSurface.diagnostics.length}`);
|
|
1472
|
+
}
|
|
1295
1473
|
lines.push("");
|
|
1296
1474
|
}
|
|
1297
1475
|
return lines.join("\n");
|
|
@@ -1704,6 +1882,7 @@ function readKnowledgePackage(rootDir, directory, includeDocs, options = {}) {
|
|
|
1704
1882
|
hasDomainKnowledge: Boolean(domainKnowledge),
|
|
1705
1883
|
domainKnowledgePath: domainKnowledge?.path ? relative(rootDir, domainKnowledge.path) : void 0,
|
|
1706
1884
|
domainKnowledge: domainKnowledge?.content,
|
|
1885
|
+
agentSurface: domainKnowledge?.content.agentSurface,
|
|
1707
1886
|
manifestPath: manifest?.path ? relative(rootDir, manifest.path) : void 0,
|
|
1708
1887
|
manifestVersion: typeof manifest?.content.version === "string" ? manifest.content.version : void 0,
|
|
1709
1888
|
objects,
|
|
@@ -2907,4 +3086,4 @@ function sortJson(value) {
|
|
|
2907
3086
|
//#endregion
|
|
2908
3087
|
export { checkKnowledgeFreshness as a, packageDocPaths as c, smrtArchitecture as d, smrtReview as f, buildReviewContext as i, renderFreshnessResult as l, TOOLS as m, buildKnowledgeIndex as n, checkKnowledgeFreshnessFromIndex as o, REVIEW_SKILL_NAME as p, buildPackageSpecialistContext as r, diffKnowledgeIndex as s, buildArchitectureContext as t, renderKnowledgeIndexMarkdown as u };
|
|
2909
3088
|
|
|
2910
|
-
//# sourceMappingURL=knowledge-
|
|
3089
|
+
//# sourceMappingURL=knowledge-D2k9xM3M.js.map
|