@happyvertical/smrt-dev-mcp 0.45.0 → 0.45.2
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 +9 -4
- package/README.md +14 -9
- package/dist/index.js +1 -42
- package/dist/index.js.map +1 -1
- package/dist/knowledge/index.d.ts +13 -3
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/{knowledge-D2k9xM3M.js → knowledge-SqpqYA67.js} +107 -56
- package/dist/knowledge-SqpqYA67.js.map +1 -0
- package/dist/knowledge.js +2 -2
- package/package.json +4 -4
- package/dist/knowledge-D2k9xM3M.js.map +0 -1
|
@@ -17,9 +17,10 @@ export type KnowledgeScope = 'project' | 'local' | 'package' | 'sdk' | 'installe
|
|
|
17
17
|
export type KnowledgeObjectSource = 'domain-artifact' | 'manifest' | 'scanner' | 'none';
|
|
18
18
|
/**
|
|
19
19
|
* `summary` keeps prompt bundles inside tool-result budgets by listing authored
|
|
20
|
-
* docs by path
|
|
20
|
+
* docs by path; `full` embeds package docs and matching modules; `complete`
|
|
21
|
+
* embeds every module and preserves the complete authored reference.
|
|
21
22
|
*/
|
|
22
|
-
export type KnowledgeDetail = 'summary' | 'full';
|
|
23
|
+
export type KnowledgeDetail = 'summary' | 'full' | 'complete';
|
|
23
24
|
/** Where the workspace package globs were read from. */
|
|
24
25
|
export type WorkspaceGlobSource = 'pnpm-workspace.yaml' | 'package.json#workspaces' | 'fallback';
|
|
25
26
|
export type KnowledgeField = DomainKnowledgeField;
|
|
@@ -265,7 +266,7 @@ interface ContextSelectorOptions {
|
|
|
265
266
|
packageName?: string;
|
|
266
267
|
/**
|
|
267
268
|
* Defaults to `summary` so MCP callers stay inside tool-result budgets. CLI
|
|
268
|
-
* consumers
|
|
269
|
+
* consumers may request `complete` for the entire authored reference.
|
|
269
270
|
*/
|
|
270
271
|
detail?: KnowledgeDetail;
|
|
271
272
|
}
|
|
@@ -300,5 +301,14 @@ export declare function renderFreshnessResult(result: KnowledgeFreshnessResult):
|
|
|
300
301
|
* Markdown bundle can never disagree about where a doc lives.
|
|
301
302
|
*/
|
|
302
303
|
export declare function packageDocPaths(pkg: KnowledgePackage): string[];
|
|
304
|
+
/**
|
|
305
|
+
* Shared MCP/CLI context projection: prose lives only in the prompt bundle.
|
|
306
|
+
*
|
|
307
|
+
* `selectedPackages` carries each package's whole authored `agentDoc`, its
|
|
308
|
+
* module-doc contents, and its full domain manifest. A three-package downstream
|
|
309
|
+
* product serialized to 329,003 characters that way, which is what made these
|
|
310
|
+
* tools unusable as planning aids. `detail: "complete"` returns the whole shape.
|
|
311
|
+
*/
|
|
312
|
+
export declare function compactContextResult(result: object, detail: string | undefined): Record<string, unknown>;
|
|
303
313
|
export {};
|
|
304
314
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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":"AA2CA,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;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE9D,wD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,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;AA8wDD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAK/D;AAy5BD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, lstatSync, opendirSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
2
|
-
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, matchesGlob, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { AGENT_SURFACE_HASH_PREFIX, MODULE_DOC_HASH_PREFIX, readAgentModuleDocs } from "@happyvertical/smrt-core/knowledge";
|
|
5
|
+
import { AGENT_SURFACE_HASH_PREFIX, MODULE_DOC_HASH_PREFIX, discoverScopedPackageDirectories, readAgentModuleDocs, readPackageAgentDoc, resolveAgentModuleDocPaths } from "@happyvertical/smrt-core/knowledge";
|
|
6
6
|
import { toSnakeCase } from "@happyvertical/smrt-core/utils";
|
|
7
7
|
import { ManifestAdapter, OxcScanner, isAgentSurfaceSourcePath, isPrunedAgentSurfacePath, lintNumericPrecision, mergeAgentSurfaces, parseSource, scanSvelteAgentSurface, sourceMayContainNumericPrecisionIssue, sourceMayDeclareAgentSurface } from "@happyvertical/smrt-scanner";
|
|
8
8
|
//#region src/tool-catalog.ts
|
|
@@ -42,7 +42,7 @@ var DEV_MCP_OUTPUT_SCHEMA = {
|
|
|
42
42
|
data: {}
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
var KNOWLEDGE_DETAIL_DESCRIPTION = "summary: authored package docs are listed by path to stay inside tool-result budgets. full: embed docs and
|
|
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
46
|
var TOOLS = [
|
|
47
47
|
{
|
|
48
48
|
name: "generate-smrt-class",
|
|
@@ -329,7 +329,11 @@ var TOOLS = [
|
|
|
329
329
|
documentation: { type: "string" },
|
|
330
330
|
detail: {
|
|
331
331
|
type: "string",
|
|
332
|
-
enum: [
|
|
332
|
+
enum: [
|
|
333
|
+
"summary",
|
|
334
|
+
"full",
|
|
335
|
+
"complete"
|
|
336
|
+
],
|
|
333
337
|
default: "summary",
|
|
334
338
|
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
335
339
|
}
|
|
@@ -363,7 +367,11 @@ var TOOLS = [
|
|
|
363
367
|
package: { type: "string" },
|
|
364
368
|
detail: {
|
|
365
369
|
type: "string",
|
|
366
|
-
enum: [
|
|
370
|
+
enum: [
|
|
371
|
+
"summary",
|
|
372
|
+
"full",
|
|
373
|
+
"complete"
|
|
374
|
+
],
|
|
367
375
|
default: "summary",
|
|
368
376
|
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
369
377
|
}
|
|
@@ -394,7 +402,11 @@ var TOOLS = [
|
|
|
394
402
|
},
|
|
395
403
|
detail: {
|
|
396
404
|
type: "string",
|
|
397
|
-
enum: [
|
|
405
|
+
enum: [
|
|
406
|
+
"summary",
|
|
407
|
+
"full",
|
|
408
|
+
"complete"
|
|
409
|
+
],
|
|
398
410
|
default: "summary",
|
|
399
411
|
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
400
412
|
}
|
|
@@ -413,7 +425,11 @@ var TOOLS = [
|
|
|
413
425
|
focus: { type: "string" },
|
|
414
426
|
detail: {
|
|
415
427
|
type: "string",
|
|
416
|
-
enum: [
|
|
428
|
+
enum: [
|
|
429
|
+
"summary",
|
|
430
|
+
"full",
|
|
431
|
+
"complete"
|
|
432
|
+
],
|
|
417
433
|
default: "summary",
|
|
418
434
|
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
419
435
|
}
|
|
@@ -460,7 +476,11 @@ var TOOLS = [
|
|
|
460
476
|
package: { type: "string" },
|
|
461
477
|
detail: {
|
|
462
478
|
type: "string",
|
|
463
|
-
enum: [
|
|
479
|
+
enum: [
|
|
480
|
+
"summary",
|
|
481
|
+
"full",
|
|
482
|
+
"complete"
|
|
483
|
+
],
|
|
464
484
|
default: "summary",
|
|
465
485
|
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
466
486
|
}
|
|
@@ -479,7 +499,11 @@ var TOOLS = [
|
|
|
479
499
|
focus: { type: "string" },
|
|
480
500
|
detail: {
|
|
481
501
|
type: "string",
|
|
482
|
-
enum: [
|
|
502
|
+
enum: [
|
|
503
|
+
"summary",
|
|
504
|
+
"full",
|
|
505
|
+
"complete"
|
|
506
|
+
],
|
|
483
507
|
default: "summary",
|
|
484
508
|
description: KNOWLEDGE_DETAIL_DESCRIPTION
|
|
485
509
|
}
|
|
@@ -1777,27 +1801,10 @@ function discoverInstalledPackages(rootDir, packageDirs, includeDocs) {
|
|
|
1777
1801
|
}
|
|
1778
1802
|
}));
|
|
1779
1803
|
const byRealPath = /* @__PURE__ */ new Map();
|
|
1780
|
-
for (const
|
|
1781
|
-
if (
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
entries = readdirSync(scopeDir, { withFileTypes: true });
|
|
1785
|
-
} catch {
|
|
1786
|
-
continue;
|
|
1787
|
-
}
|
|
1788
|
-
for (const entry of entries) {
|
|
1789
|
-
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
1790
|
-
const entryPath = join(scopeDir, entry.name);
|
|
1791
|
-
let resolved;
|
|
1792
|
-
try {
|
|
1793
|
-
resolved = realpathSync(entryPath);
|
|
1794
|
-
} catch {
|
|
1795
|
-
continue;
|
|
1796
|
-
}
|
|
1797
|
-
if (workspaceRealPaths.has(resolved)) continue;
|
|
1798
|
-
if (byRealPath.has(resolved)) continue;
|
|
1799
|
-
byRealPath.set(resolved, entryPath);
|
|
1800
|
-
}
|
|
1804
|
+
for (const entry of discoverScopedPackageDirectories(scopeDirs)) {
|
|
1805
|
+
if (workspaceRealPaths.has(entry.realDirectory)) continue;
|
|
1806
|
+
if (byRealPath.has(entry.realDirectory)) continue;
|
|
1807
|
+
byRealPath.set(entry.realDirectory, entry.directory);
|
|
1801
1808
|
}
|
|
1802
1809
|
const packages = [];
|
|
1803
1810
|
for (const directory of byRealPath.values()) {
|
|
@@ -1834,13 +1841,9 @@ function readKnowledgePackage(rootDir, directory, includeDocs, options = {}) {
|
|
|
1834
1841
|
...peerDependencies
|
|
1835
1842
|
};
|
|
1836
1843
|
const name = String(packageJson.name ?? directory);
|
|
1837
|
-
const
|
|
1838
|
-
const
|
|
1839
|
-
const
|
|
1840
|
-
const hasClaudeMd = existsSync(claudePath);
|
|
1841
|
-
const claudeContent = hasClaudeMd ? readFileSync(claudePath, "utf8") : "";
|
|
1842
|
-
const agentsContent = hasAgentsMd ? readFileSync(agentsPath, "utf8") : "";
|
|
1843
|
-
const fallbackClaudeDoc = hasClaudeMd && claudeContent.trim() !== "@AGENTS.md" ? claudeContent : "";
|
|
1844
|
+
const agentDoc = readPackageAgentDoc(directory, { inspectAdapter: true });
|
|
1845
|
+
const { hasAgentsMd, hasClaudeMd, agentsContent, claudeContent } = agentDoc;
|
|
1846
|
+
const fallbackClaudeDoc = hasClaudeMd && !agentDoc.hasClaudeShim ? claudeContent : "";
|
|
1844
1847
|
const manifest = readManifest(directory);
|
|
1845
1848
|
const discoveredDomainKnowledge = readDomainKnowledge(directory);
|
|
1846
1849
|
const domainKnowledge = discoveredDomainKnowledge ? {
|
|
@@ -1874,7 +1877,7 @@ function readKnowledgePackage(rootDir, directory, includeDocs, options = {}) {
|
|
|
1874
1877
|
sdkDependencies,
|
|
1875
1878
|
hasAgentsMd,
|
|
1876
1879
|
hasClaudeMd,
|
|
1877
|
-
hasClaudeShim:
|
|
1880
|
+
hasClaudeShim: agentDoc.hasClaudeShim,
|
|
1878
1881
|
docSource,
|
|
1879
1882
|
agentDoc: includeDocs ? domainKnowledge?.content.agentDoc || (hasAgentsMd ? agentsContent : fallbackClaudeDoc || void 0) : void 0,
|
|
1880
1883
|
agentDocSha256: hasAgentsMd ? createHash("sha256").update(agentsContent).digest("hex") : void 0,
|
|
@@ -2873,15 +2876,7 @@ function renderDiagnosticsSection(diagnostics) {
|
|
|
2873
2876
|
lines.push("");
|
|
2874
2877
|
return lines;
|
|
2875
2878
|
}
|
|
2876
|
-
/**
|
|
2877
|
-
* Which of a package's module docs to embed for this request (#2108).
|
|
2878
|
-
*
|
|
2879
|
-
* The moved prose is unregenerable, so the DEFAULT is to embed everything —
|
|
2880
|
-
* dropping a doc must never be the silent outcome. Hints only NARROW: when the
|
|
2881
|
-
* changed files or the focus/idea text point at specific modules, the rest are
|
|
2882
|
-
* still listed by path so an agent can open them on demand. If hints exist but
|
|
2883
|
-
* match nothing, fall open and embed all.
|
|
2884
|
-
*/
|
|
2879
|
+
/** Select matching authored modules; unmatched modules remain listed by path. */
|
|
2885
2880
|
function selectModuleDocs(pkg, hints) {
|
|
2886
2881
|
const all = pkg.moduleDocs;
|
|
2887
2882
|
if (all.length === 0) return {
|
|
@@ -2892,26 +2887,41 @@ function selectModuleDocs(pkg, hints) {
|
|
|
2892
2887
|
const packageFiles = (hints?.changedFiles ?? []).filter((file) => file === pkg.relativeDirectory || file.startsWith(prefix));
|
|
2893
2888
|
const text = hints?.text ?? "";
|
|
2894
2889
|
if (packageFiles.length === 0 && text.trim() === "") return {
|
|
2895
|
-
embedded:
|
|
2896
|
-
scoped:
|
|
2890
|
+
embedded: [],
|
|
2891
|
+
scoped: true
|
|
2897
2892
|
};
|
|
2893
|
+
const sourceMappings = /* @__PURE__ */ new Map();
|
|
2894
|
+
for (const row of (pkg.agentDoc ?? "").split("\n")) {
|
|
2895
|
+
if (!row.trimStart().startsWith("|")) continue;
|
|
2896
|
+
const paths = resolveAgentModuleDocPaths(pkg.directory, row);
|
|
2897
|
+
if (paths.length === 0) continue;
|
|
2898
|
+
const sources = [...row.matchAll(/`([^`]+)`/g)].map((match) => match[1].replace(/^\.\//, "")).filter((source) => !source.startsWith("/") && !source.split("/").includes("..") && !/\s/.test(source) && (source.includes("/") || /\.[a-z0-9]+$/i.test(source)));
|
|
2899
|
+
for (const path of paths) sourceMappings.set(path, [...sourceMappings.get(path) ?? [], ...sources]);
|
|
2900
|
+
}
|
|
2898
2901
|
const matched = all.filter((doc) => {
|
|
2902
|
+
const mappedSources = sourceMappings.get(doc.path) ?? [];
|
|
2899
2903
|
const segment = new RegExp(`(^|[/.])${escapeRegExp(doc.module)}([/.]|$)`);
|
|
2900
|
-
return packageFiles.some((file) => segment.test(file.slice(prefix.length)) ||
|
|
2904
|
+
return packageFiles.some((file) => segment.test(file.slice(prefix.length)) || mappedSources.some((source) => {
|
|
2905
|
+
const relativeFile = file.slice(prefix.length);
|
|
2906
|
+
return matchesGlob(relativeFile, source) || source.endsWith("/") && relativeFile.startsWith(source);
|
|
2907
|
+
}) || file === packageRelativePath(pkg, doc.path)) || includesToken(text, doc.module);
|
|
2901
2908
|
});
|
|
2902
2909
|
return matched.length > 0 ? {
|
|
2903
2910
|
embedded: matched,
|
|
2904
2911
|
scoped: true
|
|
2905
2912
|
} : {
|
|
2906
|
-
embedded:
|
|
2907
|
-
scoped:
|
|
2913
|
+
embedded: [],
|
|
2914
|
+
scoped: true
|
|
2908
2915
|
};
|
|
2909
2916
|
}
|
|
2910
2917
|
function escapeRegExp(value) {
|
|
2911
2918
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2912
2919
|
}
|
|
2913
2920
|
function renderPackageContext(pkg, hints, detail = "full") {
|
|
2914
|
-
const { embedded, scoped } =
|
|
2921
|
+
const { embedded, scoped } = detail === "complete" ? {
|
|
2922
|
+
embedded: pkg.moduleDocs,
|
|
2923
|
+
scoped: false
|
|
2924
|
+
} : selectModuleDocs(pkg, hints);
|
|
2915
2925
|
const lines = [
|
|
2916
2926
|
`### ${pkg.name}`,
|
|
2917
2927
|
"",
|
|
@@ -2943,7 +2953,7 @@ function renderPackageContext(pkg, hints, detail = "full") {
|
|
|
2943
2953
|
}
|
|
2944
2954
|
if (scoped) {
|
|
2945
2955
|
const omitted = pkg.moduleDocs.filter((doc) => !embedded.includes(doc));
|
|
2946
|
-
if (omitted.length > 0) lines.push("", `> Module docs not loaded for this request (read on demand): ${omitted.map((doc) => packageRelativePath(pkg, doc.path)).join(", ")}
|
|
2956
|
+
if (omitted.length > 0) lines.push("", `> Module docs not loaded for this request (read on demand): ${omitted.map((doc) => packageRelativePath(pkg, doc.path)).join(", ")}`, "> Request detail: \"complete\" to embed every module.");
|
|
2947
2957
|
}
|
|
2948
2958
|
lines.push("");
|
|
2949
2959
|
return lines.join("\n");
|
|
@@ -3083,7 +3093,48 @@ function sortJson(value) {
|
|
|
3083
3093
|
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, entry]) => [key, sortJson(entry)]));
|
|
3084
3094
|
return value;
|
|
3085
3095
|
}
|
|
3096
|
+
/**
|
|
3097
|
+
* Shared MCP/CLI context projection: prose lives only in the prompt bundle.
|
|
3098
|
+
*
|
|
3099
|
+
* `selectedPackages` carries each package's whole authored `agentDoc`, its
|
|
3100
|
+
* module-doc contents, and its full domain manifest. A three-package downstream
|
|
3101
|
+
* product serialized to 329,003 characters that way, which is what made these
|
|
3102
|
+
* tools unusable as planning aids. `detail: "complete"` returns the whole shape.
|
|
3103
|
+
*/
|
|
3104
|
+
function compactContextResult(result, detail) {
|
|
3105
|
+
const source = result;
|
|
3106
|
+
if (detail === "complete") return source;
|
|
3107
|
+
const compact = {
|
|
3108
|
+
...source,
|
|
3109
|
+
detail: detail === "full" ? "full" : "summary"
|
|
3110
|
+
};
|
|
3111
|
+
for (const key of ["selectedPackages", "selectedSdkPackages"]) {
|
|
3112
|
+
const packages = source[key];
|
|
3113
|
+
if (!Array.isArray(packages)) continue;
|
|
3114
|
+
compact[key] = packages.map(compactKnowledgePackage);
|
|
3115
|
+
}
|
|
3116
|
+
return compact;
|
|
3117
|
+
}
|
|
3118
|
+
function compactKnowledgePackage(pkg) {
|
|
3119
|
+
return {
|
|
3120
|
+
name: pkg.name,
|
|
3121
|
+
version: pkg.version,
|
|
3122
|
+
kind: pkg.kind,
|
|
3123
|
+
directory: pkg.relativeDirectory,
|
|
3124
|
+
objectSource: pkg.objectSource,
|
|
3125
|
+
...pkg.objectSourceReason ? { objectSourceReason: pkg.objectSourceReason } : {},
|
|
3126
|
+
docs: packageDocPaths(pkg),
|
|
3127
|
+
domainKnowledgePath: pkg.domainKnowledgePath,
|
|
3128
|
+
relationshipFeatures: pkg.relationshipFeatures,
|
|
3129
|
+
smrtDependencies: pkg.smrtDependencies,
|
|
3130
|
+
sdkDependencies: pkg.sdkDependencies,
|
|
3131
|
+
exportKeys: pkg.exportKeys,
|
|
3132
|
+
objectCount: pkg.objects.length,
|
|
3133
|
+
objects: pkg.objects.map((object) => object.tableName ? `${object.qualifiedName ?? object.className} (${object.tableName})` : object.qualifiedName ?? object.className),
|
|
3134
|
+
mcpToolCount: pkg.mcpTools.length
|
|
3135
|
+
};
|
|
3136
|
+
}
|
|
3086
3137
|
//#endregion
|
|
3087
|
-
export { checkKnowledgeFreshness as a,
|
|
3138
|
+
export { checkKnowledgeFreshness as a, diffKnowledgeIndex as c, renderKnowledgeIndexMarkdown as d, smrtArchitecture as f, TOOLS as h, buildReviewContext as i, packageDocPaths as l, REVIEW_SKILL_NAME as m, buildKnowledgeIndex as n, checkKnowledgeFreshnessFromIndex as o, smrtReview as p, buildPackageSpecialistContext as r, compactContextResult as s, buildArchitectureContext as t, renderFreshnessResult as u };
|
|
3088
3139
|
|
|
3089
|
-
//# sourceMappingURL=knowledge-
|
|
3140
|
+
//# sourceMappingURL=knowledge-SqpqYA67.js.map
|