@happyvertical/smrt-dev-mcp 0.40.65 → 0.40.67
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 +13 -1
- package/README.md +28 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -2
- package/dist/index.js.map +1 -1
- package/dist/knowledge/index.d.ts +13 -8
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/{knowledge-A7-gIjW4.js → knowledge-L22wrifG.js} +285 -45
- package/dist/knowledge-L22wrifG.js.map +1 -0
- package/dist/knowledge.js +2 -2
- package/dist/tool-catalog.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/knowledge-A7-gIjW4.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DomainKnowledgeManifest, DomainKnowledgeModuleDoc } from '@happyvertical/smrt-types';
|
|
1
|
+
import { 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
|
/**
|
|
@@ -22,13 +22,7 @@ export type KnowledgeObjectSource = 'domain-artifact' | 'manifest' | 'scanner' |
|
|
|
22
22
|
export type KnowledgeDetail = 'summary' | 'full';
|
|
23
23
|
/** Where the workspace package globs were read from. */
|
|
24
24
|
export type WorkspaceGlobSource = 'pnpm-workspace.yaml' | 'package.json#workspaces' | 'fallback';
|
|
25
|
-
export
|
|
26
|
-
name: string;
|
|
27
|
-
type: string;
|
|
28
|
-
required?: boolean;
|
|
29
|
-
related?: string;
|
|
30
|
-
columnType?: string;
|
|
31
|
-
}
|
|
25
|
+
export type KnowledgeField = DomainKnowledgeField;
|
|
32
26
|
export interface KnowledgeObject {
|
|
33
27
|
className: string;
|
|
34
28
|
qualifiedName?: string;
|
|
@@ -41,6 +35,10 @@ export interface KnowledgeObject {
|
|
|
41
35
|
fields: KnowledgeField[];
|
|
42
36
|
relationships: KnowledgeField[];
|
|
43
37
|
methods: string[];
|
|
38
|
+
methodSignatures?: DomainKnowledgeMethodSignature[];
|
|
39
|
+
tenant?: DomainKnowledgeTenant;
|
|
40
|
+
tableStrategy?: 'cti' | 'sti';
|
|
41
|
+
conflictColumns?: string[];
|
|
44
42
|
}
|
|
45
43
|
export interface KnowledgePrompt {
|
|
46
44
|
filePath: string;
|
|
@@ -214,6 +212,12 @@ export interface ArchitectureContextResult {
|
|
|
214
212
|
coverage: KnowledgeCoverage;
|
|
215
213
|
diagnostics: KnowledgeDiagnostic[];
|
|
216
214
|
}
|
|
215
|
+
export interface PackageSpecialistContextResult {
|
|
216
|
+
selectedPackage: KnowledgePackage;
|
|
217
|
+
selectedSdkPackages: KnowledgePackage[];
|
|
218
|
+
promptBundle: KnowledgePromptBundle;
|
|
219
|
+
sourceFiles: string[];
|
|
220
|
+
}
|
|
217
221
|
export interface SmrtReviewResult {
|
|
218
222
|
mode: 'findings' | 'prompt-bundle' | 'both';
|
|
219
223
|
selectedPackages: KnowledgePackage[];
|
|
@@ -279,6 +283,7 @@ export declare function smrtReview(options?: ContextSelectorOptions & {
|
|
|
279
283
|
mode?: 'findings' | 'prompt-bundle' | 'both';
|
|
280
284
|
}): Promise<SmrtReviewResult>;
|
|
281
285
|
export declare function buildArchitectureContext(options?: ContextSelectorOptions): Promise<ArchitectureContextResult>;
|
|
286
|
+
export declare function buildPackageSpecialistContext(options?: ContextSelectorOptions): Promise<PackageSpecialistContextResult>;
|
|
282
287
|
export declare function smrtArchitecture(options?: ContextSelectorOptions): Promise<SmrtArchitectureResult>;
|
|
283
288
|
export declare function renderKnowledgeIndexMarkdown(index: SmrtKnowledgeIndex): string;
|
|
284
289
|
export declare function renderFreshnessResult(result: KnowledgeFreshnessResult): string;
|
|
@@ -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":"AA0BA,OAAO,KAAK,EACV,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,GAAG,MAAM,CAAC;AAEjD,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAC3B,qBAAqB,GACrB,yBAAyB,GACzB,UAAU,CAAC;AAEf,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,8BA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AM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,GACL,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC,CAYD;AAED,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,CAgD9B;AAED,wBAAsB,UAAU,CAC9B,OAAO,GAAE,sBAAsB,GAAG;IAChC,IAAI,CAAC,EAAE,UAAU,GAAG,eAAe,GAAG,MAAM,CAAC;CACzC,GACL,OAAO,CAAC,gBAAgB,CAAC,CAc3B;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,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,CA0DR;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,wBAAwB,GAC/B,MAAM,CAkBR;AAgtDD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAK/D"}
|
|
@@ -3,6 +3,7 @@ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "nod
|
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { MODULE_DOC_HASH_PREFIX, readAgentModuleDocs } from "@happyvertical/smrt-core/knowledge";
|
|
6
|
+
import { toSnakeCase } from "@happyvertical/smrt-core/utils";
|
|
6
7
|
import { ManifestAdapter, OxcScanner } from "@happyvertical/smrt-scanner";
|
|
7
8
|
//#region src/tool-catalog.ts
|
|
8
9
|
var REVIEW_SKILL_NAME = "smrt-code-review";
|
|
@@ -41,6 +42,7 @@ var DEV_MCP_OUTPUT_SCHEMA = {
|
|
|
41
42
|
data: {}
|
|
42
43
|
}
|
|
43
44
|
};
|
|
45
|
+
var KNOWLEDGE_DETAIL_DESCRIPTION = "summary: authored package docs are listed by path to stay inside tool-result budgets. full: embed docs and render structural object facts.";
|
|
44
46
|
var TOOLS = [
|
|
45
47
|
{
|
|
46
48
|
name: "generate-smrt-class",
|
|
@@ -329,7 +331,7 @@ var TOOLS = [
|
|
|
329
331
|
type: "string",
|
|
330
332
|
enum: ["summary", "full"],
|
|
331
333
|
default: "summary",
|
|
332
|
-
description:
|
|
334
|
+
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
333
335
|
}
|
|
334
336
|
}
|
|
335
337
|
}
|
|
@@ -363,7 +365,7 @@ var TOOLS = [
|
|
|
363
365
|
type: "string",
|
|
364
366
|
enum: ["summary", "full"],
|
|
365
367
|
default: "summary",
|
|
366
|
-
description:
|
|
368
|
+
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
367
369
|
}
|
|
368
370
|
}
|
|
369
371
|
}
|
|
@@ -394,7 +396,7 @@ var TOOLS = [
|
|
|
394
396
|
type: "string",
|
|
395
397
|
enum: ["summary", "full"],
|
|
396
398
|
default: "summary",
|
|
397
|
-
description:
|
|
399
|
+
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
398
400
|
}
|
|
399
401
|
}
|
|
400
402
|
}
|
|
@@ -413,11 +415,27 @@ var TOOLS = [
|
|
|
413
415
|
type: "string",
|
|
414
416
|
enum: ["summary", "full"],
|
|
415
417
|
default: "summary",
|
|
416
|
-
description:
|
|
418
|
+
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
417
419
|
}
|
|
418
420
|
}
|
|
419
421
|
}
|
|
420
422
|
},
|
|
423
|
+
{
|
|
424
|
+
name: "build-package-specialist-context",
|
|
425
|
+
description: "Build deterministic package specialist context for the SMRT workbench",
|
|
426
|
+
inputSchema: {
|
|
427
|
+
type: "object",
|
|
428
|
+
properties: {
|
|
429
|
+
rootDir: { type: "string" },
|
|
430
|
+
package: {
|
|
431
|
+
type: "string",
|
|
432
|
+
description: "Package name or short package query, e.g. @happyvertical/smrt-content or content"
|
|
433
|
+
},
|
|
434
|
+
focus: { type: "string" }
|
|
435
|
+
},
|
|
436
|
+
required: ["package"]
|
|
437
|
+
}
|
|
438
|
+
},
|
|
421
439
|
{
|
|
422
440
|
name: "build-domain-architecture-context",
|
|
423
441
|
description: "Build domain-scoped model-ready SMRT architecture context and prompt bundle",
|
|
@@ -444,7 +462,7 @@ var TOOLS = [
|
|
|
444
462
|
type: "string",
|
|
445
463
|
enum: ["summary", "full"],
|
|
446
464
|
default: "summary",
|
|
447
|
-
description:
|
|
465
|
+
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
448
466
|
}
|
|
449
467
|
}
|
|
450
468
|
}
|
|
@@ -463,7 +481,7 @@ var TOOLS = [
|
|
|
463
481
|
type: "string",
|
|
464
482
|
enum: ["summary", "full"],
|
|
465
483
|
default: "summary",
|
|
466
|
-
description:
|
|
484
|
+
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
467
485
|
}
|
|
468
486
|
}
|
|
469
487
|
}
|
|
@@ -1191,6 +1209,35 @@ async function buildArchitectureContext(options = {}) {
|
|
|
1191
1209
|
diagnostics: index.diagnostics
|
|
1192
1210
|
};
|
|
1193
1211
|
}
|
|
1212
|
+
async function buildPackageSpecialistContext(options = {}) {
|
|
1213
|
+
const packageQuery = options.packageName ?? options.package;
|
|
1214
|
+
if (!packageQuery) throw new Error("Package specialist context requires a package name");
|
|
1215
|
+
const index = await buildKnowledgeIndex({
|
|
1216
|
+
rootDir: options.rootDir,
|
|
1217
|
+
includeDocs: true
|
|
1218
|
+
});
|
|
1219
|
+
const selectedPackage = index.packages.find((pkg) => pkg.kind !== "sdk" && packageMatches(pkg, packageQuery.toLowerCase()));
|
|
1220
|
+
if (!selectedPackage) throw new Error(`Unknown SMRT package: ${packageQuery}`);
|
|
1221
|
+
const selectedSdkPackages = selectSdkPackages(index, [selectedPackage], [selectedPackage.name, ...selectedPackage.sdkDependencies], {
|
|
1222
|
+
scope: "project",
|
|
1223
|
+
packageName: selectedPackage.name
|
|
1224
|
+
});
|
|
1225
|
+
const sourceFiles = packageSpecialistSourceFiles(index.rootDir, selectedPackage);
|
|
1226
|
+
return {
|
|
1227
|
+
selectedPackage,
|
|
1228
|
+
selectedSdkPackages,
|
|
1229
|
+
sourceFiles,
|
|
1230
|
+
promptBundle: buildPromptBundle({
|
|
1231
|
+
title: `SMRT package specialist: ${selectedPackage.name}`,
|
|
1232
|
+
task: "Act as a deterministic specialist for this package. Use only the supplied package docs, manifest/knowledge artifacts, routes, tests, prompts, and dependency context. Explain package concepts, integration surfaces, validation commands, and likely implementation risks with source references. Do not assume provider-backed chat or external model access.",
|
|
1233
|
+
index,
|
|
1234
|
+
packages: [selectedPackage],
|
|
1235
|
+
sdkPackages: selectedSdkPackages,
|
|
1236
|
+
sourceFiles,
|
|
1237
|
+
extraContext: options.focus
|
|
1238
|
+
})
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1194
1241
|
async function smrtArchitecture(options = {}) {
|
|
1195
1242
|
const context = await buildArchitectureContext(options);
|
|
1196
1243
|
const ideaText = [
|
|
@@ -1615,9 +1662,13 @@ function readKnowledgePackage(rootDir, directory, includeDocs, options = {}) {
|
|
|
1615
1662
|
const claudeContent = hasClaudeMd ? readFileSync(claudePath, "utf8") : "";
|
|
1616
1663
|
const agentsContent = hasAgentsMd ? readFileSync(agentsPath, "utf8") : "";
|
|
1617
1664
|
const fallbackClaudeDoc = hasClaudeMd && claudeContent.trim() !== "@AGENTS.md" ? claudeContent : "";
|
|
1618
|
-
const domainKnowledge = readDomainKnowledge(directory);
|
|
1619
|
-
const docSource = hasAgentsMd ? "AGENTS.md" : fallbackClaudeDoc ? "CLAUDE.md" : null;
|
|
1620
1665
|
const manifest = readManifest(directory);
|
|
1666
|
+
const discoveredDomainKnowledge = readDomainKnowledge(directory);
|
|
1667
|
+
const domainKnowledge = discoveredDomainKnowledge ? {
|
|
1668
|
+
...discoveredDomainKnowledge,
|
|
1669
|
+
content: sanitizeDomainKnowledgeManifest(discoveredDomainKnowledge.content, manifest?.content, name)
|
|
1670
|
+
} : null;
|
|
1671
|
+
const docSource = hasAgentsMd ? "AGENTS.md" : fallbackClaudeDoc ? "CLAUDE.md" : null;
|
|
1621
1672
|
const resolvedObjects = resolvePackageObjects({
|
|
1622
1673
|
packageName: name,
|
|
1623
1674
|
directory,
|
|
@@ -1859,18 +1910,14 @@ function readManifestObjects(manifest) {
|
|
|
1859
1910
|
const fields = objectRecord(item.fields);
|
|
1860
1911
|
const schemaColumns = objectRecord(schema.columns);
|
|
1861
1912
|
const decoratorConfig = objectRecord(item.decoratorConfig);
|
|
1862
|
-
const knowledgeFields = Object.entries(fields).map(([fieldName, field]) => {
|
|
1863
|
-
const fieldInfo = objectRecord(field);
|
|
1913
|
+
const knowledgeFields = Object.entries(fields).filter(([, field]) => !isSensitiveKnowledgeField(field)).map(([fieldName, field]) => {
|
|
1864
1914
|
const columnName = camelToSnake(fieldName);
|
|
1865
|
-
|
|
1866
|
-
return {
|
|
1867
|
-
name: fieldName,
|
|
1868
|
-
type: String(fieldInfo.type ?? "unknown"),
|
|
1869
|
-
required: typeof fieldInfo.required === "boolean" ? fieldInfo.required : void 0,
|
|
1870
|
-
related: typeof fieldInfo.related === "string" ? fieldInfo.related : void 0,
|
|
1871
|
-
columnType: typeof column.type === "string" ? column.type : void 0
|
|
1872
|
-
};
|
|
1915
|
+
return projectKnowledgeField(fieldName, field, objectRecord(schemaColumns[columnName]).type);
|
|
1873
1916
|
});
|
|
1917
|
+
const methods = objectRecord(item.methods);
|
|
1918
|
+
const sensitiveIdentifiers = sensitiveKnowledgeFieldIdentifiers(Object.entries(fields));
|
|
1919
|
+
const tenant = sanitizeKnowledgeTenant(projectTenant(decoratorConfig.tenantScoped), sensitiveIdentifiers);
|
|
1920
|
+
const conflictColumns = stringArray(decoratorConfig.conflictColumns).filter((column) => !sensitiveIdentifiers.has(column));
|
|
1874
1921
|
return {
|
|
1875
1922
|
className: String(item.className ?? item.name ?? "Unknown"),
|
|
1876
1923
|
qualifiedName: typeof item.qualifiedName === "string" ? item.qualifiedName : void 0,
|
|
@@ -1882,35 +1929,171 @@ function readManifestObjects(manifest) {
|
|
|
1882
1929
|
idColumnType: typeof objectRecord(schemaColumns.id).type === "string" ? objectRecord(schemaColumns.id).type : void 0,
|
|
1883
1930
|
fields: knowledgeFields,
|
|
1884
1931
|
relationships: knowledgeFields.filter((field) => RELATIONSHIP_FIELD_TYPES.has(field.type)),
|
|
1885
|
-
methods: Object.keys(
|
|
1932
|
+
methods: Object.keys(methods).sort(),
|
|
1933
|
+
methodSignatures: projectMethodSignatures(methods),
|
|
1934
|
+
tenant,
|
|
1935
|
+
tableStrategy: decoratorConfig.tableStrategy === "cti" || decoratorConfig.tableStrategy === "sti" ? decoratorConfig.tableStrategy : void 0,
|
|
1936
|
+
conflictColumns: conflictColumns.length > 0 ? conflictColumns : void 0
|
|
1886
1937
|
};
|
|
1887
1938
|
});
|
|
1888
1939
|
}
|
|
1889
1940
|
function readDomainKnowledgeObjects(manifest) {
|
|
1890
|
-
return manifest.objects.map((object) =>
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1941
|
+
return manifest.objects.map((object) => {
|
|
1942
|
+
const sensitiveIdentifiers = sensitiveKnowledgeFieldIdentifiers(object.fields.map((field) => [field.name, field]));
|
|
1943
|
+
const fields = object.fields.filter((field) => !isSensitiveKnowledgeField(field)).map((field) => projectKnowledgeField(field.name, field));
|
|
1944
|
+
const safeFieldNames = new Set(fields.map((field) => field.name));
|
|
1945
|
+
const conflictColumns = object.conflictColumns?.filter((column) => !sensitiveIdentifiers.has(column));
|
|
1946
|
+
const tenant = sanitizeKnowledgeTenant(object.tenant ? { ...object.tenant } : void 0, sensitiveIdentifiers);
|
|
1947
|
+
return {
|
|
1948
|
+
className: object.name,
|
|
1949
|
+
qualifiedName: object.qualifiedName,
|
|
1950
|
+
extends: object.extends,
|
|
1951
|
+
collection: object.collection,
|
|
1952
|
+
mcpOperations: object.surfaces.filter((surface) => surface.kind === "mcp").map((surface) => surface.operation).sort(),
|
|
1953
|
+
tableName: object.tableName,
|
|
1954
|
+
idColumnType: fields.find((field) => field.name === "id")?.columnType,
|
|
1955
|
+
fields,
|
|
1956
|
+
relationships: object.relationships.filter((field) => safeFieldNames.has(field.name) && !isSensitiveKnowledgeField(field)).map((field) => projectKnowledgeField(field.name, field)),
|
|
1957
|
+
methods: object.methods,
|
|
1958
|
+
methodSignatures: object.methodSignatures?.map((signature) => ({
|
|
1959
|
+
name: signature.name,
|
|
1960
|
+
async: signature.async,
|
|
1961
|
+
static: signature.static,
|
|
1962
|
+
params: signature.params ? [...signature.params] : void 0,
|
|
1963
|
+
returns: signature.returns
|
|
1964
|
+
})),
|
|
1965
|
+
tenant,
|
|
1966
|
+
tableStrategy: object.tableStrategy,
|
|
1967
|
+
conflictColumns: conflictColumns && conflictColumns.length > 0 ? conflictColumns : void 0
|
|
1968
|
+
};
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
function sanitizeDomainKnowledgeManifest(manifest, rawManifest, packageName) {
|
|
1972
|
+
const rawObjects = rawManifest ? ownedManifestObjectsByIdentity(rawManifest, packageName) : /* @__PURE__ */ new Map();
|
|
1973
|
+
const projectionIsSanitized = manifest.sensitiveFieldsExcluded === true;
|
|
1974
|
+
return {
|
|
1975
|
+
...manifest,
|
|
1976
|
+
objects: manifest.objects.map((object) => {
|
|
1977
|
+
const rawObject = (object.qualifiedName ? rawObjects.get(object.qualifiedName) : void 0) ?? rawObjects.get(object.name);
|
|
1978
|
+
const rawFields = objectRecord(rawObject?.fields);
|
|
1979
|
+
const artifactSensitiveIdentifiers = sensitiveKnowledgeFieldIdentifiers(object.fields.map((field) => [field.name, field]));
|
|
1980
|
+
const rawSensitiveIdentifiers = sensitiveKnowledgeFieldIdentifiers(Object.entries(rawFields));
|
|
1981
|
+
const sensitiveIdentifiers = /* @__PURE__ */ new Set([...artifactSensitiveIdentifiers, ...rawSensitiveIdentifiers]);
|
|
1982
|
+
const rawSafeFieldNames = new Set(Object.entries(rawFields).filter(([, field]) => !isSensitiveKnowledgeField(field)).map(([name]) => name));
|
|
1983
|
+
const canTrustField = (field) => projectionIsSanitized || rawObject !== void 0 && rawSafeFieldNames.has(field.name);
|
|
1984
|
+
const fields = object.fields.filter((field) => canTrustField(field) && !isSensitiveKnowledgeField(field)).map((field) => projectKnowledgeField(field.name, field));
|
|
1985
|
+
const safeFieldNames = new Set(fields.map((field) => field.name));
|
|
1986
|
+
const rawDecoratorConfig = objectRecord(rawObject?.decoratorConfig);
|
|
1987
|
+
const conflictColumns = (projectionIsSanitized ? object.conflictColumns : rawObject ? stringArray(rawDecoratorConfig.conflictColumns) : void 0)?.filter((column) => !sensitiveIdentifiers.has(column));
|
|
1988
|
+
const projectedTenant = projectionIsSanitized ? object.tenant : rawObject ? projectTenant(rawDecoratorConfig.tenantScoped) : object.tenant ? {
|
|
1989
|
+
scoped: object.tenant.scoped,
|
|
1990
|
+
mode: object.tenant.mode
|
|
1991
|
+
} : void 0;
|
|
1992
|
+
return {
|
|
1993
|
+
...object,
|
|
1994
|
+
fields,
|
|
1995
|
+
relationships: object.relationships.filter((field) => safeFieldNames.has(field.name) && !isSensitiveKnowledgeField(field)).map((field) => projectKnowledgeField(field.name, field)),
|
|
1996
|
+
tenant: sanitizeKnowledgeTenant(projectedTenant, sensitiveIdentifiers),
|
|
1997
|
+
conflictColumns: conflictColumns && conflictColumns.length > 0 ? conflictColumns : void 0
|
|
1998
|
+
};
|
|
1999
|
+
})
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
function ownedManifestObjectsByIdentity(manifest, packageName) {
|
|
2003
|
+
const owned = packageName ? partitionOwnedObjects(manifest, packageName).owned : objectRecord(manifest.objects);
|
|
2004
|
+
const objects = /* @__PURE__ */ new Map();
|
|
2005
|
+
for (const [key, value] of Object.entries(owned)) {
|
|
2006
|
+
const object = objectRecord(value);
|
|
2007
|
+
objects.set(key, object);
|
|
2008
|
+
if (typeof object.className === "string") objects.set(object.className, object);
|
|
2009
|
+
if (typeof object.qualifiedName === "string") objects.set(object.qualifiedName, object);
|
|
2010
|
+
}
|
|
2011
|
+
return objects;
|
|
2012
|
+
}
|
|
2013
|
+
function isSensitiveKnowledgeField(value) {
|
|
2014
|
+
const field = objectRecord(value);
|
|
2015
|
+
return field.sensitive === true || objectRecord(field._meta).sensitive === true;
|
|
2016
|
+
}
|
|
2017
|
+
function sensitiveKnowledgeFieldIdentifiers(fields) {
|
|
2018
|
+
return new Set(fields.filter(([, field]) => isSensitiveKnowledgeField(field)).flatMap(([name]) => [
|
|
2019
|
+
name,
|
|
2020
|
+
toSnakeCase(name),
|
|
2021
|
+
camelToSnake(name)
|
|
2022
|
+
]));
|
|
2023
|
+
}
|
|
2024
|
+
function projectKnowledgeField(name, value, columnType) {
|
|
2025
|
+
const field = objectRecord(value);
|
|
2026
|
+
const meta = objectRecord(field._meta);
|
|
2027
|
+
const declaredConstraints = objectRecord(field.constraints);
|
|
2028
|
+
const constraints = {};
|
|
2029
|
+
for (const key of [
|
|
2030
|
+
"min",
|
|
2031
|
+
"max",
|
|
2032
|
+
"minLength",
|
|
2033
|
+
"maxLength"
|
|
2034
|
+
]) {
|
|
2035
|
+
const candidate = field[key] ?? meta[key] ?? declaredConstraints[key];
|
|
2036
|
+
if (typeof candidate === "number") constraints[key] = candidate;
|
|
2037
|
+
}
|
|
2038
|
+
const pattern = normalizeKnowledgePattern(field.pattern ?? meta.pattern ?? declaredConstraints.pattern);
|
|
2039
|
+
if (pattern !== void 0) constraints.pattern = pattern;
|
|
2040
|
+
const hasDefault = Object.hasOwn(field, "default") ? field.default !== void 0 : meta.default !== void 0;
|
|
2041
|
+
return {
|
|
2042
|
+
name,
|
|
2043
|
+
type: String(field.type ?? "unknown"),
|
|
2044
|
+
required: typeof field.required === "boolean" ? field.required : void 0,
|
|
2045
|
+
related: typeof field.related === "string" ? field.related : void 0,
|
|
2046
|
+
columnType: typeof columnType === "string" ? columnType : typeof field.columnType === "string" ? field.columnType : void 0,
|
|
2047
|
+
...hasDefault ? { default: Object.hasOwn(field, "default") ? field.default : meta.default } : {},
|
|
2048
|
+
constraints: Object.keys(constraints).length > 0 ? constraints : void 0,
|
|
2049
|
+
readonly: field.readonly === true || meta.readonly === true ? true : void 0,
|
|
2050
|
+
transient: field.transient === true || meta.transient === true ? true : void 0
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
function normalizeKnowledgePattern(value) {
|
|
2054
|
+
if (typeof value === "string") return value;
|
|
2055
|
+
const source = objectRecord(value).source;
|
|
2056
|
+
return typeof source === "string" ? source : void 0;
|
|
2057
|
+
}
|
|
2058
|
+
function projectTenant(value) {
|
|
2059
|
+
if (value === true) return {
|
|
2060
|
+
scoped: true,
|
|
2061
|
+
mode: "required",
|
|
2062
|
+
field: "tenantId"
|
|
2063
|
+
};
|
|
2064
|
+
const config = objectRecord(value);
|
|
2065
|
+
if (Object.keys(config).length === 0) return void 0;
|
|
2066
|
+
return {
|
|
2067
|
+
scoped: true,
|
|
2068
|
+
mode: config.mode === "optional" ? "optional" : "required",
|
|
2069
|
+
field: typeof config.field === "string" ? config.field : "tenantId"
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
function sanitizeKnowledgeTenant(tenant, sensitiveIdentifiers) {
|
|
2073
|
+
if (!tenant?.field || !sensitiveIdentifiers.has(tenant.field)) return tenant;
|
|
2074
|
+
return {
|
|
2075
|
+
scoped: tenant.scoped,
|
|
2076
|
+
mode: tenant.mode
|
|
2077
|
+
};
|
|
2078
|
+
}
|
|
2079
|
+
function projectMethodSignatures(methods) {
|
|
2080
|
+
const signatures = Object.entries(methods).sort(([a], [b]) => a.localeCompare(b)).map(([methodName, value]) => {
|
|
2081
|
+
const method = objectRecord(value);
|
|
2082
|
+
const params = Array.isArray(method.parameters) ? method.parameters.map((raw) => {
|
|
2083
|
+
const parameter = objectRecord(raw);
|
|
2084
|
+
const name = typeof parameter.name === "string" ? parameter.name : "arg";
|
|
2085
|
+
const type = typeof parameter.type === "string" ? parameter.type : "unknown";
|
|
2086
|
+
return `${name}${parameter.optional === true ? "?" : ""}: ${type}`;
|
|
2087
|
+
}) : void 0;
|
|
2088
|
+
return {
|
|
2089
|
+
name: typeof method.name === "string" ? method.name : methodName,
|
|
2090
|
+
async: method.async === true ? true : void 0,
|
|
2091
|
+
static: method.isStatic === true ? true : void 0,
|
|
2092
|
+
params: params && params.length > 0 ? params : void 0,
|
|
2093
|
+
returns: typeof method.returnType === "string" && method.returnType ? method.returnType : void 0
|
|
2094
|
+
};
|
|
2095
|
+
});
|
|
2096
|
+
return signatures.length > 0 ? signatures : void 0;
|
|
1914
2097
|
}
|
|
1915
2098
|
function readDomainKnowledgePrompts(manifest, directory, rootDir) {
|
|
1916
2099
|
return manifest.prompts.map((prompt) => ({
|
|
@@ -2379,6 +2562,28 @@ function packageMatches(pkg, query) {
|
|
|
2379
2562
|
const shortName = pkg.name.replace("@happyvertical/smrt-", "").replace("@happyvertical/", "");
|
|
2380
2563
|
return pkg.name.toLowerCase() === normalized || pkg.name.toLowerCase().includes(normalized) || shortName.toLowerCase() === normalized || pkg.relativeDirectory.toLowerCase().endsWith(`/${normalized}`);
|
|
2381
2564
|
}
|
|
2565
|
+
function packageSpecialistSourceFiles(rootDir, pkg) {
|
|
2566
|
+
const sourceFiles = /* @__PURE__ */ new Set();
|
|
2567
|
+
const addIfExists = (relativePath) => {
|
|
2568
|
+
if (existsSync(join(rootDir, relativePath))) sourceFiles.add(relativePath);
|
|
2569
|
+
};
|
|
2570
|
+
addIfExists(join(pkg.relativeDirectory, "package.json"));
|
|
2571
|
+
addIfExists(join(pkg.relativeDirectory, "README.md"));
|
|
2572
|
+
addIfExists(join(pkg.relativeDirectory, "AGENTS.md"));
|
|
2573
|
+
addIfExists(join(pkg.relativeDirectory, "CHANGELOG.md"));
|
|
2574
|
+
if (pkg.domainKnowledgePath) sourceFiles.add(pkg.domainKnowledgePath);
|
|
2575
|
+
if (pkg.manifestPath) sourceFiles.add(pkg.manifestPath);
|
|
2576
|
+
for (const prompt of pkg.prompts) sourceFiles.add(prompt.filePath);
|
|
2577
|
+
const packageFiles = existsSync(pkg.directory) ? walkFiles(pkg.directory) : [];
|
|
2578
|
+
for (const filePath of packageFiles) {
|
|
2579
|
+
const relativeFilePath = relative(rootDir, filePath);
|
|
2580
|
+
if (isPackageSpecialistSource(relativeFilePath)) sourceFiles.add(relativeFilePath);
|
|
2581
|
+
}
|
|
2582
|
+
return [...sourceFiles].sort().slice(0, 120);
|
|
2583
|
+
}
|
|
2584
|
+
function isPackageSpecialistSource(relativeFilePath) {
|
|
2585
|
+
return relativeFilePath.endsWith("/src/workbench.ts") || relativeFilePath.endsWith("/src/playground.ts") || relativeFilePath.endsWith("/src/route-module.ts") || relativeFilePath.includes("/src/svelte/playground") || relativeFilePath.includes("/src/svelte/routes/") || relativeFilePath.includes("/src/routes/") || relativeFilePath.includes("/src/prompts/") || /\.test\.[cm]?ts$/.test(relativeFilePath) || /\.spec\.[cm]?ts$/.test(relativeFilePath);
|
|
2586
|
+
}
|
|
2382
2587
|
function buildPromptBundle(options) {
|
|
2383
2588
|
const detail = options.detail ?? "summary";
|
|
2384
2589
|
const render = (pkg) => renderPackageContext(pkg, options.moduleDocHints, detail);
|
|
@@ -2487,6 +2692,8 @@ function renderPackageContext(pkg, hints, detail = "full") {
|
|
|
2487
2692
|
lines.push("");
|
|
2488
2693
|
return lines.join("\n");
|
|
2489
2694
|
}
|
|
2695
|
+
const structuralFacts = renderObjectStructuralFacts(pkg.objects);
|
|
2696
|
+
if (structuralFacts.length > 0) lines.push("", "#### Object structural facts", "", ...structuralFacts);
|
|
2490
2697
|
if (pkg.agentDoc) lines.push("", pkg.agentDoc.trim());
|
|
2491
2698
|
for (const doc of embedded) {
|
|
2492
2699
|
lines.push("", `#### ${packageRelativePath(pkg, doc.path)}`, "");
|
|
@@ -2499,6 +2706,39 @@ function renderPackageContext(pkg, hints, detail = "full") {
|
|
|
2499
2706
|
lines.push("");
|
|
2500
2707
|
return lines.join("\n");
|
|
2501
2708
|
}
|
|
2709
|
+
function renderObjectStructuralFacts(objects) {
|
|
2710
|
+
const lines = [];
|
|
2711
|
+
for (const object of objects) {
|
|
2712
|
+
const objectFacts = [
|
|
2713
|
+
object.tenant ? object.tenant.scoped ? `tenant ${object.tenant.mode ?? "required"}${object.tenant.field ? ` via ${object.tenant.field}` : ""}` : "tenant unscoped" : void 0,
|
|
2714
|
+
object.tableStrategy ? `table strategy ${object.tableStrategy}` : void 0,
|
|
2715
|
+
object.conflictColumns && object.conflictColumns.length > 0 ? `conflict columns ${object.conflictColumns.join(", ")}` : void 0
|
|
2716
|
+
].filter((fact) => Boolean(fact));
|
|
2717
|
+
const structuralFields = object.fields.filter((field) => Object.hasOwn(field, "default") || field.constraints !== void 0 || field.readonly === true || field.transient === true);
|
|
2718
|
+
const signatures = object.methodSignatures ?? [];
|
|
2719
|
+
if (objectFacts.length === 0 && structuralFields.length === 0 && signatures.length === 0) continue;
|
|
2720
|
+
lines.push(`- ${object.qualifiedName ?? object.className}${objectFacts.length > 0 ? ` — ${objectFacts.join("; ")}` : ""}`);
|
|
2721
|
+
for (const field of structuralFields) {
|
|
2722
|
+
const facts = [
|
|
2723
|
+
Object.hasOwn(field, "default") ? `default ${renderKnowledgeValue(field.default)}` : void 0,
|
|
2724
|
+
field.constraints ? `constraints ${Object.entries(field.constraints).map(([key, value]) => `${key}=${renderKnowledgeValue(value)}`).join(", ")}` : void 0,
|
|
2725
|
+
field.readonly ? "readonly" : void 0,
|
|
2726
|
+
field.transient ? "transient" : void 0
|
|
2727
|
+
].filter((fact) => Boolean(fact));
|
|
2728
|
+
lines.push(` - field ${field.name}: ${field.type} (${facts.join("; ")})`);
|
|
2729
|
+
}
|
|
2730
|
+
for (const signature of signatures) {
|
|
2731
|
+
const prefix = [signature.static ? "static" : "", signature.async ? "async" : ""].filter(Boolean).join(" ");
|
|
2732
|
+
lines.push(` - method ${prefix ? `${prefix} ` : ""}${signature.name}(${(signature.params ?? []).join(", ")})${signature.returns ? `: ${signature.returns}` : ""}`);
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
return lines;
|
|
2736
|
+
}
|
|
2737
|
+
function renderKnowledgeValue(value) {
|
|
2738
|
+
const rendered = JSON.stringify(value);
|
|
2739
|
+
if (rendered === void 0) return String(value);
|
|
2740
|
+
return rendered.length > 120 ? `${rendered.slice(0, 117)}...` : rendered;
|
|
2741
|
+
}
|
|
2502
2742
|
function getChangedFiles(rootDir, base) {
|
|
2503
2743
|
if (base) try {
|
|
2504
2744
|
const files = execFileSync("git", [
|
|
@@ -2602,6 +2842,6 @@ function sortJson(value) {
|
|
|
2602
2842
|
return value;
|
|
2603
2843
|
}
|
|
2604
2844
|
//#endregion
|
|
2605
|
-
export {
|
|
2845
|
+
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 };
|
|
2606
2846
|
|
|
2607
|
-
//# sourceMappingURL=knowledge-
|
|
2847
|
+
//# sourceMappingURL=knowledge-L22wrifG.js.map
|