@brucewaynedecoy/make-docs 2.0.4 → 2.0.5
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/{backup-CM7RL2Q7.js → backup-2OT4A6LR.js} +4 -4
- package/dist/{chunk-GERMRLJ2.js → chunk-46MGH32G.js} +6 -4
- package/dist/chunk-46MGH32G.js.map +1 -0
- package/dist/{chunk-LV3CBXZB.js → chunk-CCYP5NU2.js} +3 -3
- package/dist/{chunk-OR5ZVGLG.js → chunk-CLSOY7NV.js} +151 -5
- package/dist/chunk-CLSOY7NV.js.map +1 -0
- package/dist/{chunk-ADVNSMA7.js → chunk-CMNKQM7L.js} +3 -3
- package/dist/{chunk-YVSASZMT.js → chunk-HXWD2EUD.js} +19 -14
- package/dist/chunk-HXWD2EUD.js.map +1 -0
- package/dist/{chunk-65QWMODG.js → chunk-I4FADOUK.js} +3 -3
- package/dist/{chunk-65QWMODG.js.map → chunk-I4FADOUK.js.map} +1 -1
- package/dist/{chunk-M7DMFIKU.js → chunk-ISSMVKIA.js} +224 -20
- package/dist/chunk-ISSMVKIA.js.map +1 -0
- package/dist/{chunk-J5QDGRZ7.js → chunk-UNR4CYVX.js} +116 -37
- package/dist/chunk-UNR4CYVX.js.map +1 -0
- package/dist/{chunk-7R2PPKTB.js → chunk-VMKG3H4B.js} +2 -2
- package/dist/{chunk-52FTNVXS.js → chunk-XDSWX4Y4.js} +8906 -2899
- package/dist/chunk-XDSWX4Y4.js.map +1 -0
- package/dist/index.js +210 -86
- package/dist/index.js.map +1 -1
- package/dist/registry-PC5GKAKM.js +50 -0
- package/dist/registry-PC5GKAKM.js.map +1 -0
- package/dist/{self-36ULRIJ6.js → self-WYVXO23B.js} +10 -10
- package/dist/server-BQOG6FTA.js +1113 -0
- package/dist/server-BQOG6FTA.js.map +1 -0
- package/dist/{setup-system-JI36YJ6D.js → setup-system-KN7FTTLT.js} +263 -40
- package/dist/setup-system-KN7FTTLT.js.map +1 -0
- package/dist/{skills-command-IGDVLNKY.js → skills-command-KEW7MOEW.js} +17 -7
- package/dist/skills-command-KEW7MOEW.js.map +1 -0
- package/dist/{uninstall-VBGMQQLA.js → uninstall-45XF4CHD.js} +9 -9
- package/dist/virtual_make-docs-first-party-skills-ECJESFL2.js +11 -0
- package/dist/virtual_make-docs-first-party-skills-ECJESFL2.js.map +1 -0
- package/package.json +5 -5
- package/skill-registry.json +24 -8
- package/skill-registry.schema.json +2 -1
- package/template/.make-docs/system/contracts/system-resource-contract.md +16 -0
- package/template/.make-docs/system-resources.catalog.json +415 -0
- package/template/.make-docs/system-resources.schema.json +25 -0
- package/dist/chunk-52FTNVXS.js.map +0 -1
- package/dist/chunk-GERMRLJ2.js.map +0 -1
- package/dist/chunk-J5QDGRZ7.js.map +0 -1
- package/dist/chunk-M7DMFIKU.js.map +0 -1
- package/dist/chunk-OR5ZVGLG.js.map +0 -1
- package/dist/chunk-YVSASZMT.js.map +0 -1
- package/dist/server-H754TA4Q.js +0 -512
- package/dist/server-H754TA4Q.js.map +0 -1
- package/dist/setup-system-JI36YJ6D.js.map +0 -1
- package/dist/skills-command-IGDVLNKY.js.map +0 -1
- package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js +0 -11
- package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js.map +0 -1
- /package/dist/{backup-CM7RL2Q7.js.map → backup-2OT4A6LR.js.map} +0 -0
- /package/dist/{chunk-LV3CBXZB.js.map → chunk-CCYP5NU2.js.map} +0 -0
- /package/dist/{chunk-ADVNSMA7.js.map → chunk-CMNKQM7L.js.map} +0 -0
- /package/dist/{chunk-7R2PPKTB.js.map → chunk-VMKG3H4B.js.map} +0 -0
- /package/dist/{self-36ULRIJ6.js.map → self-WYVXO23B.js.map} +0 -0
- /package/dist/{uninstall-VBGMQQLA.js.map → uninstall-45XF4CHD.js.map} +0 -0
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
prepareBackupExecution,
|
|
6
6
|
resolveBackupDestinationPlan,
|
|
7
7
|
runBackupCommand
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-CCYP5NU2.js";
|
|
9
|
+
import "./chunk-46MGH32G.js";
|
|
10
10
|
import "./chunk-3EXHM5L2.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-HXWD2EUD.js";
|
|
12
12
|
import "./chunk-D4HDZEJT.js";
|
|
13
13
|
export {
|
|
14
14
|
compareBackupRelativePathDepth,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
resolveBackupDestinationPlan,
|
|
18
18
|
runBackupCommand
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=backup-
|
|
20
|
+
//# sourceMappingURL=backup-2OT4A6LR.js.map
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
readTextFile,
|
|
28
28
|
relativePathToTarget,
|
|
29
29
|
resolveInstallProfile
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HXWD2EUD.js";
|
|
31
31
|
|
|
32
32
|
// src/backup-paths.ts
|
|
33
33
|
import path from "path";
|
|
@@ -63,11 +63,13 @@ var SHARED_AGENTICS_SKILL_DIR = ".make-docs/agentics/skills";
|
|
|
63
63
|
var SHARED_AGENTICS_PLUGIN_DIR = ".make-docs/agentics/plugins";
|
|
64
64
|
var HARNESS_SKILL_DIRS = {
|
|
65
65
|
"claude-code": ".claude/skills",
|
|
66
|
-
codex: ".agents/skills"
|
|
66
|
+
codex: ".agents/skills",
|
|
67
|
+
"github-copilot": ".agents/skills"
|
|
67
68
|
};
|
|
68
69
|
var HARNESS_PLUGIN_DIRS = {
|
|
69
70
|
"claude-code": ".claude/plugins",
|
|
70
|
-
codex: ".agents/plugins"
|
|
71
|
+
codex: ".agents/plugins",
|
|
72
|
+
"github-copilot": ".agents/plugins"
|
|
71
73
|
};
|
|
72
74
|
async function createAuditReport(options) {
|
|
73
75
|
if (typeof options?.targetDir !== "string" || options.targetDir.trim().length === 0) {
|
|
@@ -1288,4 +1290,4 @@ export {
|
|
|
1288
1290
|
isWithinRoot,
|
|
1289
1291
|
createAuditReport
|
|
1290
1292
|
};
|
|
1291
|
-
//# sourceMappingURL=chunk-
|
|
1293
|
+
//# sourceMappingURL=chunk-46MGH32G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/backup-paths.ts","../src/audit.ts"],"sourcesContent":["import path from \"node:path\";\n\nexport const PROJECT_BACKUP_RELATIVE_PATH = \".make-docs/backup\";\nexport const LEGACY_PROJECT_BACKUP_RELATIVE_PATH = \".backup\";\n\nexport function getProjectBackupRoot(targetDir: string): string {\n return path.resolve(targetDir, PROJECT_BACKUP_RELATIVE_PATH);\n}\n\nexport function getLegacyProjectBackupRoot(targetDir: string): string {\n return path.resolve(targetDir, LEGACY_PROJECT_BACKUP_RELATIVE_PATH);\n}\n\nexport function getProjectBackupStateRoots(targetDir: string): string[] {\n return [\n getProjectBackupRoot(targetDir),\n getLegacyProjectBackupRoot(targetDir),\n ];\n}\n\nexport function isInsideProjectBackupStateRoot(\n targetDir: string,\n candidatePath: string,\n): boolean {\n return getProjectBackupStateRoots(targetDir).some((backupRoot) =>\n isWithinRoot(backupRoot, candidatePath),\n );\n}\n\nexport function isWithinRoot(rootPath: string, candidatePath: string): boolean {\n const relative = path.relative(path.resolve(rootPath), path.resolve(candidatePath));\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n","import { getHarnessSkillDirectory } from \"./skill-paths\";\nimport { existsSync, lstatSync, readFileSync, readdirSync, readlinkSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport {\n classifyAgenticFileRole,\n formatAgenticFileRole,\n} from \"./agentic-skill-roles\";\nimport { isInsideProjectBackupStateRoot } from \"./backup-paths\";\nimport { getDesiredAssets } from \"./catalog\";\nimport {\n createAuditPathMetadata,\n getManifestFileHash,\n isInstructionManifestPath,\n getManifestAuditContext,\n getManifestPath,\n RETIRED_PLAYBOOK_CONTRACT_PATH,\n RETIRED_PLAYBOOK_CONTRACT_HASH,\n hasTrustedRetiredPlaybookContractOwnership,\n} from \"./manifest\";\nimport { parseManagedBlock } from \"./managed-block\";\nimport { defaultSelections, resolveInstallProfile } from \"./profile\";\nimport { getDesiredSkillAssets, getRetiredManagedSkillAssets } from \"./skill-catalog\";\nimport {\n loadEffectiveSkillRegistry,\n loadSkillRegistry,\n type SkillRegistry,\n} from \"./skill-registry\";\nimport { TOOL_DIRECTORY_CONFIG_RELATIVE_PATH } from \"./tool-directory\";\nimport {\n HARNESSES,\n type AuditCandidateMetadata,\n type AuditManagedPathMetadata,\n type AuditOwnershipSource,\n type AuditPathKind,\n type AuditPluginSelectionReview,\n type AuditPreservedPath,\n type AuditPrunableDirectory,\n type AuditReason,\n type AuditReport,\n type AuditRemovableFile,\n type AuditSkillSelectionReview,\n type AuditSkippedPath,\n type FileContent,\n type Harness,\n type InstallManifest,\n type InstallSelections,\n type ManifestAuditRecord,\n} from \"./types\";\nimport { assertManagedPathHasNoSymlinks, contentEquals, hashText, PACKAGE_ROOT, readTextFile, relativePathToTarget } from \"./utils\";\n\n// Legacy source inventory is read-only; current payloads live in native Skill directories.\nconst SHARED_AGENTICS_SKILL_DIR = \".make-docs/agentics/skills\";\nconst SHARED_AGENTICS_PLUGIN_DIR = \".make-docs/agentics/plugins\";\nconst HARNESS_SKILL_DIRS: Record<Harness, string> = {\n \"claude-code\": \".claude/skills\",\n codex: \".agents/skills\",\n \"github-copilot\": \".agents/skills\",\n};\nconst HARNESS_PLUGIN_DIRS: Record<Harness, string> = {\n \"claude-code\": \".claude/plugins\",\n codex: \".agents/plugins\",\n \"github-copilot\": \".agents/plugins\",\n};\n\nexport async function createAuditReport(options: {\n targetDir: string;\n manifest?: InstallManifest | null;\n homeDir?: string;\n}): Promise<AuditReport> {\n if (typeof options?.targetDir !== \"string\" || options.targetDir.trim().length === 0) {\n throw new TypeError(\"Audit targetDir must be a non-empty string.\");\n }\n const targetDir = path.resolve(options.targetDir);\n const homeDir = path.resolve(options.homeDir ?? os.homedir());\n const removableFiles = new Map<string, AuditRemovableFile>();\n const preservedPaths = new Map<string, AuditPreservedPath>();\n const skippedPaths = new Map<string, AuditSkippedPath>();\n\n if (options.manifest) {\n await classifyManifestPresent({\n targetDir,\n homeDir,\n manifest: options.manifest,\n removableFiles,\n preservedPaths,\n skippedPaths,\n });\n } else {\n await classifyManifestMissing({\n targetDir,\n homeDir,\n removableFiles,\n preservedPaths,\n skippedPaths,\n });\n }\n classifyProjectConfig({\n targetDir,\n homeDir,\n preservedPaths,\n });\n\n const prunableDirectories = classifyPrunableDirectories({\n targetDir,\n homeDir,\n removableFiles: [...removableFiles.values()],\n preservedPaths,\n skippedPaths,\n });\n\n return {\n mode: options.manifest ? \"manifest-present\" : \"manifest-missing\",\n targetDir,\n manifestPath: getManifestPath(targetDir),\n ...(options.manifest\n ? {\n skillSelectionReview: createSkillSelectionReview(\n options.manifest.selections,\n ),\n pluginSelectionReview: createPluginSelectionReview(\n options.manifest.selections,\n ),\n }\n : {}),\n removableFiles: sortAuditEntries([...removableFiles.values()]),\n prunableDirectories: sortPrunableDirectories(prunableDirectories).filter(entry => path.resolve(entry.absolutePath) !== path.resolve(homeDir, \".make-docs\")),\n preservedPaths: sortAuditEntries([...preservedPaths.values()]),\n skippedPaths: sortAuditEntries([...skippedPaths.values()]),\n };\n}\n\nasync function classifyManifestPresent(options: {\n targetDir: string;\n homeDir: string;\n manifest: InstallManifest;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n skippedPaths: Map<string, AuditSkippedPath>;\n}): Promise<void> {\n const {\n targetDir,\n homeDir,\n manifest,\n removableFiles,\n preservedPaths,\n skippedPaths,\n } = options;\n const auditContext = getManifestAuditContext(targetDir, manifest, homeDir);\n\n const manifestCandidates = new Map<string, ManifestAuditRecord>();\n for (const record of auditContext.managedFiles) {\n manifestCandidates.set(record.absolutePath, record);\n }\n for (const record of auditContext.skillFiles) {\n manifestCandidates.set(\n record.absolutePath,\n manifestCandidates.get(record.absolutePath) ?? record,\n );\n }\n\n\n const manifestSkillContentByPath = await loadCanonicalSkillContentByPath(\n targetDir,\n homeDir,\n auditContext.priorSelections,\n [...manifestCandidates.values()].some(\n (record) => record.ownershipSource === \"manifest-skill-file\",\n ),\n );\n const manifestRecordByPath = new Map(\n [...manifestCandidates.values()].map((record) => [record.path, record]),\n );\n\n for (const record of sortAuditEntries([...manifestCandidates.values()])) {\n if (record.path === RETIRED_PLAYBOOK_CONTRACT_PATH) {\n let trusted = hasTrustedRetiredPlaybookContractOwnership(manifest.files[record.path]);\n try {\n assertManagedPathHasNoSymlinks(targetDir, record.path);\n trusted &&= existsSync(record.absolutePath) && lstatSync(record.absolutePath).isFile() &&\n hashText(readTextFile(record.absolutePath)) === RETIRED_PLAYBOOK_CONTRACT_HASH;\n } catch { trusted = false; }\n addPreserved(preservedPaths, record, createReason(trusted ? \"managed-file-hash-match\" : \"managed-file-modified\",\n trusted\n ? \"The retired contract is trusted legacy input. Only reviewed migration checkpoint 11 may remove it.\"\n : \"The retired contract lacks trusted ownership or bytes, or has a symlink path, and must be preserved.\"));\n continue;\n }\n classifyManifestRecord({\n targetDir,\n record,\n manifestSkillContentByPath,\n manifestRecordByPath,\n removableFiles,\n preservedPaths,\n skippedPaths,\n });\n }\n}\n\nfunction classifyManifestRecord(options: {\n targetDir: string;\n record: ManifestAuditRecord;\n manifestSkillContentByPath: Map<string, FileContent> | null;\n manifestRecordByPath: Map<string, ManifestAuditRecord>;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n skippedPaths: Map<string, AuditSkippedPath>;\n}): void {\n const {\n targetDir,\n record,\n manifestSkillContentByPath,\n manifestRecordByPath,\n removableFiles,\n preservedPaths,\n skippedPaths,\n } = options;\n\n if (isInsideProjectBackupRoot(targetDir, record.absolutePath)) {\n addSkipped(\n skippedPaths,\n record,\n \"excluded\",\n createReason(\n \"inside-backup-root\",\n \"Paths inside project backup state trees are excluded from removal consideration.\",\n ),\n );\n return;\n }\n\n if (record.pathScope === \"external\") {\n addSkipped(\n skippedPaths,\n record,\n \"excluded\",\n createReason(\n \"outside-supported-roots\",\n \"This path is outside both the target directory and the user home directory and is preserved conservatively.\",\n ),\n );\n return;\n }\n\n if (!existsSync(record.absolutePath)) {\n addSkipped(\n skippedPaths,\n record,\n \"already-absent\",\n createReason(\"already-absent\", \"The managed path is already absent on disk.\"),\n );\n return;\n }\n\n if (record.skillExposure) {\n classifyManifestSkillExposureRecord({\n targetDir,\n record,\n manifestSkillContentByPath,\n removableFiles,\n preservedPaths,\n });\n return;\n }\n\n if (record.agenticOwnership?.artifactKind === \"plugin\") {\n classifyManifestPluginOwnershipRecord({\n targetDir,\n record,\n manifestRecordByPath,\n removableFiles,\n preservedPaths,\n });\n return;\n }\n\n // Skills-bundle exposure directories written by the Playbook packaging\n // writer (W18 R8) carry skill-kind agentic ownership without W18 R5\n // `skillExposure` metadata; classify them by their recorded symlink target\n // so uninstall removes the managed exposure instead of orphaning it\n // (R-KEEP-1, R-PROV-2).\n if (\n record.agenticOwnership?.artifactKind === \"skill\" &&\n record.agenticOwnership.role === \"native-exposure\" &&\n record.agenticOwnership.pathKind === \"directory\"\n ) {\n classifyPackagingSkillExposureRecord({\n targetDir,\n record,\n removableFiles,\n preservedPaths,\n });\n return;\n }\n\n if (!lstatSync(record.absolutePath).isFile()) {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"managed-file-modified\",\n \"The managed file path is no longer a regular file and will be preserved.\",\n ),\n );\n return;\n }\n\n const currentBytes = readFileSync(record.absolutePath);\n const currentHash = hashText(currentBytes);\n\n if (record.ownershipSource === \"managed-state\") {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-state-file\",\n \"The make-docs manifest is CLI-managed state and is eligible for removal.\",\n ),\n currentHash,\n undefined,\n );\n return;\n }\n\n if (isInstructionPath(record.path)) {\n const currentContent = currentBytes.toString(\"utf8\");\n const currentBlockHash = getManifestFileHash(record.path, currentContent);\n if (currentBlockHash && record.manifestHash && currentBlockHash === record.manifestHash) {\n const parsed = parseManagedBlock(currentContent);\n if (parsed.prefix.trim().length > 0 || parsed.suffix.trim().length > 0) {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"instruction-user-content-preserved\",\n \"The managed block matches the manifest, but user content exists outside the block so the instruction file is preserved.\",\n ),\n );\n return;\n }\n\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"instruction-content-match\",\n \"The instruction file's managed block matches the manifest and no user content exists outside the block.\",\n ),\n currentBlockHash,\n record.manifestHash,\n );\n return;\n }\n\n if (record.manifestHash && currentHash === record.manifestHash) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"instruction-content-match\",\n \"The legacy instruction file still matches the manifest-tracked make-docs content.\",\n ),\n currentHash,\n record.manifestHash,\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"instruction-content-mismatch\",\n \"The instruction file does not match manifest-tracked make-docs content and will be preserved.\",\n ),\n );\n return;\n }\n\n if (record.manifestHash && currentHash === record.manifestHash) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-file-hash-match\",\n \"The file still matches the manifest-tracked make-docs content.\",\n ),\n currentHash,\n record.manifestHash,\n );\n return;\n }\n\n if (record.ownershipSource === \"manifest-skill-file\") {\n const expectedContent = manifestSkillContentByPath?.get(record.path);\n if (!expectedContent) {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-skill-file-without-metadata\",\n `The ${formatAuditAgenticRole(record)} is tracked only by the manifest skill list and cannot be proven removable without canonical make-docs content.`,\n ),\n );\n return;\n }\n\n if (contentEquals(currentBytes, expectedContent)) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-skill-file-content-match\",\n `The ${formatAuditAgenticRole(record)} exactly matches canonical make-docs skill content.`,\n ),\n currentHash,\n hashText(expectedContent),\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-skill-file-content-mismatch\",\n `The manifest-tracked ${formatAuditAgenticRole(record)} does not match canonical make-docs skill content and will be preserved.`,\n ),\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"managed-file-modified\",\n \"The manifest-tracked file was modified locally and will be preserved.\",\n ),\n );\n}\n\nfunction classifyManifestSkillExposureRecord(options: {\n targetDir: string;\n record: ManifestAuditRecord;\n manifestSkillContentByPath: Map<string, FileContent> | null;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n}): void {\n const { targetDir, record, manifestSkillContentByPath, removableFiles, preservedPaths } =\n options;\n const stats = lstatSync(record.absolutePath);\n\n if (stats.isSymbolicLink()) {\n const currentTarget = path.resolve(\n path.dirname(record.absolutePath),\n readlinkSync(record.absolutePath),\n );\n const expectedTarget = relativePathToTarget(\n targetDir,\n record.skillExposure?.canonicalPayloadPath ?? \"\",\n );\n\n if (path.resolve(currentTarget) === path.resolve(expectedTarget)) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-skill-exposure-symlink-match\",\n \"The managed native harness exposure symlink points at the recorded canonical skill payload.\",\n ),\n hashText(readlinkSync(record.absolutePath)),\n record.manifestHash,\n );\n return;\n }\n }\n\n if (\n stats.isDirectory() &&\n manifestSkillContentByPath &&\n copyMirrorMatchesCanonicalContent(record, targetDir, manifestSkillContentByPath)\n ) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-skill-exposure-copy-mirror-match\",\n \"The managed copy-mirror exposure exactly matches canonical make-docs skill content.\",\n ),\n undefined,\n record.manifestHash,\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-skill-exposure-mismatch\",\n \"The manifest-tracked native skill exposure does not match its recorded symlink target or canonical copy-mirror content and will be preserved.\",\n ),\n );\n}\n\n/**\n * Playbook-packaging skills-bundle exposure (W18 R8): a directory symlink at\n * the harness path whose ownership record names the canonical payload\n * directory. Removable only when the on-disk symlink still points at the\n * recorded canonical payload; anything else is preserved for review.\n */\nfunction classifyPackagingSkillExposureRecord(options: {\n targetDir: string;\n record: ManifestAuditRecord;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n}): void {\n const { targetDir, record, removableFiles, preservedPaths } = options;\n const stats = lstatSync(record.absolutePath);\n\n if (stats.isSymbolicLink()) {\n const currentTarget = path.resolve(\n path.dirname(record.absolutePath),\n readlinkSync(record.absolutePath),\n );\n const expectedTarget = relativePathToTarget(\n targetDir,\n record.agenticOwnership?.canonicalPayloadPath ?? \"\",\n );\n\n if (path.resolve(currentTarget) === path.resolve(expectedTarget)) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-skill-exposure-symlink-match\",\n \"The managed skills-bundle exposure symlink points at the recorded canonical package payload.\",\n ),\n hashText(readlinkSync(record.absolutePath)),\n record.manifestHash,\n );\n return;\n }\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-skill-exposure-mismatch\",\n \"The manifest-tracked skills-bundle exposure does not match its recorded symlink target and will be preserved.\",\n ),\n );\n}\n\nfunction classifyManifestPluginOwnershipRecord(options: {\n targetDir: string;\n record: ManifestAuditRecord;\n manifestRecordByPath: Map<string, ManifestAuditRecord>;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n}): void {\n const { targetDir, record, manifestRecordByPath, removableFiles, preservedPaths } =\n options;\n const ownership = record.agenticOwnership;\n if (!ownership || ownership.artifactKind !== \"plugin\") {\n return;\n }\n\n const symlinkExposureAncestor = findPluginSymlinkExposureAncestor(\n record,\n manifestRecordByPath,\n );\n if (symlinkExposureAncestor && symlinkExposureAncestor.path !== record.path) {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-plugin-exposure-mismatch\",\n \"The plugin copy-mirror record is nested under a native exposure symlink and will be preserved for review instead of being removed through the symlink.\",\n ),\n );\n return;\n }\n\n if (ownership.role === \"plugin-native-exposure\") {\n classifyManifestPluginExposureRecord({\n targetDir,\n record,\n manifestRecordByPath,\n removableFiles,\n preservedPaths,\n });\n return;\n }\n\n if (!lstatSync(record.absolutePath).isFile()) {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-plugin-file-content-mismatch\",\n `The manifest-tracked ${formatAuditAgenticRole(record)} is no longer a regular file and will be preserved.`,\n ),\n );\n return;\n }\n\n const currentBytes = readFileSync(record.absolutePath);\n const currentHash = hashText(currentBytes);\n if (record.manifestHash && currentHash === record.manifestHash) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-plugin-file-content-match\",\n `The ${formatAuditAgenticRole(record)} still matches manifest-tracked make-docs plugin content.`,\n ),\n currentHash,\n record.manifestHash,\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-plugin-file-content-mismatch\",\n `The manifest-tracked ${formatAuditAgenticRole(record)} was modified locally and will be preserved.`,\n ),\n );\n}\n\nfunction classifyManifestPluginExposureRecord(options: {\n targetDir: string;\n record: ManifestAuditRecord;\n manifestRecordByPath: Map<string, ManifestAuditRecord>;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n}): void {\n const { targetDir, record, manifestRecordByPath, removableFiles, preservedPaths } =\n options;\n const ownership = record.agenticOwnership;\n const stats = lstatSync(record.absolutePath);\n\n if (stats.isSymbolicLink()) {\n const currentTarget = path.resolve(\n path.dirname(record.absolutePath),\n readlinkSync(record.absolutePath),\n );\n const expectedTarget = relativePathToTarget(\n targetDir,\n ownership?.canonicalPayloadPath ?? \"\",\n );\n\n if (path.resolve(currentTarget) === path.resolve(expectedTarget)) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-plugin-exposure-symlink-match\",\n \"The managed plugin native harness exposure symlink points at the recorded canonical plugin payload.\",\n ),\n hashText(readlinkSync(record.absolutePath)),\n record.manifestHash,\n );\n return;\n }\n }\n\n if (\n stats.isDirectory() &&\n pluginCopyMirrorMatchesManifestRecords(record, targetDir, manifestRecordByPath)\n ) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-plugin-exposure-copy-mirror-match\",\n \"The managed plugin copy-mirror exposure exactly matches manifest-tracked plugin payload content.\",\n ),\n undefined,\n record.manifestHash,\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"manifest-plugin-exposure-mismatch\",\n \"The manifest-tracked plugin exposure does not match its recorded symlink target or manifest-tracked copy-mirror content and will be preserved.\",\n ),\n );\n}\n\nasync function classifyManifestMissing(options: {\n targetDir: string;\n homeDir: string;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n skippedPaths: Map<string, AuditSkippedPath>;\n}): Promise<void> {\n const { targetDir, homeDir, removableFiles, preservedPaths, skippedPaths } = options;\n const fallbackSelections = defaultSelections();\n const fallbackProfile = resolveInstallProfile(fallbackSelections);\n const fallbackCandidates = new Map<string, AuditManagedPathMetadata>();\n const canonicalContentByPath = new Map<string, FileContent>();\n\n for (const asset of getDesiredAssets(fallbackProfile)) {\n const record = createManagedPathRecord(targetDir, homeDir, asset.relativePath, \"fallback\", {\n sourceId: asset.sourceId,\n });\n fallbackCandidates.set(record.absolutePath, record);\n canonicalContentByPath.set(record.path, asset.content);\n }\n\n\n\n const knownAgenticsRoots = getKnownAgenticsRoots(targetDir, homeDir);\n const existingAgenticsRoots = knownAgenticsRoots.filter((root) =>\n existsSync(root.absolutePath),\n );\n const existingSkillRoots = existingAgenticsRoots.filter(\n (root) => root.agenticKind === \"skill\",\n );\n const scopeRootFetchFailures = new Set<\"project\" | \"home\">();\n\n if (existingSkillRoots.some((root) => root.pathScope === \"project\")) {\n const skillRecords = await loadFallbackSkillCandidates({\n targetDir,\n homeDir,\n selections: {\n ...fallbackSelections,\n skillScope: \"project\",\n },\n });\n if (skillRecords) {\n for (const record of skillRecords) {\n fallbackCandidates.set(record.record.absolutePath, record.record);\n canonicalContentByPath.set(record.record.path, record.content);\n }\n } else {\n scopeRootFetchFailures.add(\"project\");\n }\n }\n\n if (existingSkillRoots.some((root) => root.pathScope === \"home\")) {\n const skillRecords = await loadFallbackSkillCandidates({\n targetDir,\n homeDir,\n selections: {\n ...fallbackSelections,\n skillScope: \"global\",\n },\n });\n if (skillRecords) {\n for (const record of skillRecords) {\n fallbackCandidates.set(record.record.absolutePath, record.record);\n canonicalContentByPath.set(record.record.path, record.content);\n }\n } else {\n scopeRootFetchFailures.add(\"home\");\n }\n }\n\n for (const record of sortAuditEntries([...fallbackCandidates.values()])) {\n classifyFallbackRecord({\n targetDir,\n record,\n canonicalContentByPath,\n removableFiles,\n preservedPaths,\n skippedPaths,\n });\n }\n\n for (const agenticsRoot of existingAgenticsRoots) {\n const hasExistingManagedCandidateDescendant = [...fallbackCandidates.values()].some(\n (record) =>\n existsSync(record.absolutePath) &&\n isWithinRoot(agenticsRoot.absolutePath, record.absolutePath),\n );\n if (\n (agenticsRoot.agenticKind === \"skill\" &&\n scopeRootFetchFailures.has(agenticsRoot.pathScope)) ||\n !hasExistingManagedCandidateDescendant\n ) {\n addPreserved(\n preservedPaths,\n agenticsRoot,\n createReason(\n \"fallback-ambiguous\",\n \"The selected-agentics root exists, but fallback mode cannot prove which contents are make-docs-managed.\",\n ),\n );\n }\n }\n}\n\nfunction classifyFallbackRecord(options: {\n targetDir: string;\n record: AuditManagedPathMetadata;\n canonicalContentByPath: Map<string, FileContent>;\n removableFiles: Map<string, AuditRemovableFile>;\n preservedPaths: Map<string, AuditPreservedPath>;\n skippedPaths: Map<string, AuditSkippedPath>;\n}): void {\n const {\n targetDir,\n record,\n canonicalContentByPath,\n removableFiles,\n preservedPaths,\n skippedPaths,\n } = options;\n\n if (isInsideProjectBackupRoot(targetDir, record.absolutePath)) {\n addSkipped(\n skippedPaths,\n record,\n \"excluded\",\n createReason(\n \"inside-backup-root\",\n \"Paths inside project backup state trees are excluded from removal consideration.\",\n ),\n );\n return;\n }\n\n if (record.pathScope === \"external\") {\n addSkipped(\n skippedPaths,\n record,\n \"excluded\",\n createReason(\n \"outside-supported-roots\",\n \"This path is outside both the target directory and the user home directory and cannot be removed in fallback mode.\",\n ),\n );\n return;\n }\n\n if (!existsSync(record.absolutePath)) {\n addSkipped(\n skippedPaths,\n record,\n \"already-absent\",\n createReason(\"already-absent\", \"The candidate path is already absent on disk.\"),\n );\n return;\n }\n\n if (!lstatSync(record.absolutePath).isFile()) {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"fallback-ambiguous\",\n \"Fallback mode found a non-file at an expected make-docs-managed file path and will preserve it.\",\n ),\n );\n return;\n }\n\n const currentBytes = readFileSync(record.absolutePath);\n const currentHash = hashText(currentBytes);\n\n if (record.ownershipSource === \"managed-state\") {\n if (looksLikeMakeDocsManifest(record.absolutePath)) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"managed-state-file\",\n \"The make-docs manifest matches the generated manifest shape and is eligible for removal.\",\n ),\n currentHash,\n undefined,\n );\n } else {\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"fallback-ambiguous\",\n \"Fallback mode found make-docs state at the expected path, but its contents do not match the generated manifest shape.\",\n ),\n );\n }\n return;\n }\n\n if (isInstructionPath(record.path)) {\n const currentContent = currentBytes.toString(\"utf8\");\n const expectedContent = canonicalContentByPath.get(record.path);\n const currentBlockHash = getManifestFileHash(record.path, currentContent);\n const expectedBlockHash =\n typeof expectedContent === \"string\"\n ? getManifestFileHash(record.path, expectedContent)\n : null;\n const parsed = parseManagedBlock(currentContent);\n const blockOnly =\n parsed.state === \"valid\" &&\n parsed.prefix.trim().length === 0 &&\n parsed.suffix.trim().length === 0;\n\n if (\n typeof expectedContent === \"string\" &&\n (currentContent === expectedContent ||\n (blockOnly && currentBlockHash && currentBlockHash === expectedBlockHash))\n ) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"fallback-root-fingerprint-match\",\n \"The instruction file matches canonical make-docs content in fallback mode.\",\n ),\n currentHash,\n expectedBlockHash ?? hashText(expectedContent),\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"fallback-root-fingerprint-mismatch\",\n \"The instruction file does not match canonical make-docs content and will be preserved.\",\n ),\n );\n return;\n }\n\n const expectedContent = canonicalContentByPath.get(record.path);\n if (expectedContent !== undefined && contentEquals(currentBytes, expectedContent)) {\n addRemovable(\n removableFiles,\n record,\n createReason(\n \"fallback-canonical-content-match\",\n \"The file exactly matches canonical make-docs content in fallback mode.\",\n ),\n currentHash,\n hashText(expectedContent),\n );\n return;\n }\n\n addPreserved(\n preservedPaths,\n record,\n createReason(\n \"fallback-ambiguous\",\n \"Fallback mode cannot prove that this existing path is safe to remove.\",\n ),\n );\n}\n\nfunction classifyPrunableDirectories(options: {\n targetDir: string;\n homeDir: string;\n removableFiles: AuditRemovableFile[];\n preservedPaths: Map<string, AuditPreservedPath>;\n skippedPaths: Map<string, AuditSkippedPath>;\n}): AuditPrunableDirectory[] {\n const { targetDir, homeDir, removableFiles, preservedPaths, skippedPaths } = options;\n const removableFileSet = new Set(removableFiles.map((entry) => entry.absolutePath));\n const prunableDirectories = new Map<string, AuditPrunableDirectory>();\n const removableDescendantsByDirectory = new Map<string, Set<string>>();\n\n for (const removableFile of removableFiles) {\n const boundary =\n removableFile.pathScope === \"project\"\n ? targetDir\n : removableFile.pathScope === \"home\"\n ? homeDir\n : null;\n if (!boundary) {\n continue;\n }\n\n for (const directoryPath of getCandidateParentDirectories(\n removableFile.absolutePath,\n boundary,\n targetDir,\n )) {\n if (!removableDescendantsByDirectory.has(directoryPath)) {\n removableDescendantsByDirectory.set(directoryPath, new Set());\n }\n removableDescendantsByDirectory.get(directoryPath)?.add(removableFile.path);\n }\n }\n\n const sortedDirectoryCandidates = [...removableDescendantsByDirectory.keys()].sort(\n (left, right) =>\n createAuditPathMetadata(targetDir, left, \"directory\", homeDir).ordering.pruneSortKey.localeCompare(\n createAuditPathMetadata(targetDir, right, \"directory\", homeDir).ordering.pruneSortKey,\n ),\n );\n\n for (const directoryPath of sortedDirectoryCandidates) {\n if (!existsSync(directoryPath)) {\n continue;\n }\n\n const metadata = createAuditPathMetadata(targetDir, directoryPath, \"directory\", homeDir);\n const remainingEntries = getRemainingDirectoryEntries(\n directoryPath,\n removableFileSet,\n prunableDirectories,\n );\n if (remainingEntries.length === 0) {\n const pruneReason = createReason(\n \"directory-eligible-for-prune\",\n \"The directory becomes empty after removing audited make-docs-managed descendants.\",\n );\n prunableDirectories.set(directoryPath, {\n ...metadata,\n kind: \"directory\",\n reason: pruneReason.message,\n reasonCode: pruneReason.code,\n removableDescendantPaths: [...(removableDescendantsByDirectory.get(directoryPath) ?? [])].sort(),\n preservedDescendantPaths: [],\n });\n continue;\n }\n\n const preservedDescendantPaths = describeBlockingDescendants(\n targetDir,\n homeDir,\n remainingEntries,\n preservedPaths,\n skippedPaths,\n );\n addPreserved(\n preservedPaths,\n metadata,\n createReason(\n preservedDescendantPaths.length > 0\n ? \"directory-contains-preserved-descendants\"\n : \"directory-contains-unmanaged-descendants\",\n preservedDescendantPaths.length > 0\n ? \"The directory still contains preserved descendants after subtracting removable make-docs paths.\"\n : \"The directory still contains unmanaged descendants after subtracting removable make-docs paths.\",\n ),\n preservedDescendantPaths,\n );\n }\n\n return [...prunableDirectories.values()];\n}\n\nfunction getRemainingDirectoryEntries(\n directoryPath: string,\n removableFileSet: Set<string>,\n prunableDirectories: Map<string, AuditPrunableDirectory>,\n): string[] {\n return readdirSync(directoryPath)\n .map((entry) => path.join(directoryPath, entry))\n .filter((entryPath) => !removableFileSet.has(entryPath) && !prunableDirectories.has(entryPath));\n}\n\nfunction copyMirrorMatchesCanonicalContent(\n record: ManifestAuditRecord,\n targetDir: string,\n canonicalContentByPath: Map<string, FileContent>,\n): boolean {\n const expectedEntries = [...canonicalContentByPath.entries()].filter(([candidate]) =>\n isDescendantAuditPath(candidate, record.path),\n );\n if (expectedEntries.length === 0) {\n return false;\n }\n\n const expectedContentByPath = new Map(expectedEntries);\n const existingFiles = listDescendantFilePaths(record.absolutePath).map((filePath) =>\n normalizeAuditPath(path.relative(targetDir, filePath)),\n );\n if (existingFiles.length !== expectedContentByPath.size) {\n return false;\n }\n\n return existingFiles.every((relativePath) => {\n const expectedContent = expectedContentByPath.get(relativePath);\n return (\n expectedContent !== undefined &&\n contentEquals(readFileSync(relativePathToTarget(targetDir, relativePath)), expectedContent)\n );\n });\n}\n\nfunction pluginCopyMirrorMatchesManifestRecords(\n record: ManifestAuditRecord,\n targetDir: string,\n manifestRecordByPath: Map<string, ManifestAuditRecord>,\n): boolean {\n const expectedEntries = [...manifestRecordByPath.values()].filter(\n (candidate) =>\n candidate.agenticOwnership?.artifactKind === \"plugin\" &&\n candidate.agenticOwnership.role === \"plugin-copy-mirror\" &&\n isDescendantAuditPath(candidate.path, record.path),\n );\n if (expectedEntries.length === 0) {\n return false;\n }\n\n const expectedRecordsByPath = new Map(\n expectedEntries.map((candidate) => [candidate.path, candidate]),\n );\n const existingFiles = listDescendantFilePaths(record.absolutePath).map((filePath) =>\n normalizeAuditPath(path.relative(targetDir, filePath)),\n );\n if (existingFiles.length !== expectedRecordsByPath.size) {\n return false;\n }\n\n return existingFiles.every((relativePath) => {\n const expectedRecord = expectedRecordsByPath.get(relativePath);\n return (\n expectedRecord?.manifestHash !== undefined &&\n hashText(readTextFile(relativePathToTarget(targetDir, relativePath))) ===\n expectedRecord.manifestHash\n );\n });\n}\n\nfunction findPluginSymlinkExposureAncestor(\n record: ManifestAuditRecord,\n manifestRecordByPath: Map<string, ManifestAuditRecord>,\n): ManifestAuditRecord | null {\n for (const candidate of manifestRecordByPath.values()) {\n if (\n candidate.path === record.path ||\n candidate.agenticOwnership?.artifactKind !== \"plugin\" ||\n candidate.agenticOwnership.role !== \"plugin-native-exposure\" ||\n !isDescendantAuditPath(record.path, candidate.path) ||\n !existsSync(candidate.absolutePath)\n ) {\n continue;\n }\n\n try {\n if (lstatSync(candidate.absolutePath).isSymbolicLink()) {\n return candidate;\n }\n } catch {\n continue;\n }\n }\n\n return null;\n}\n\nfunction listDescendantFilePaths(root: string): string[] {\n return readdirSync(root, { withFileTypes: true }).flatMap((entry) => {\n const entryPath = path.join(root, entry.name);\n if (entry.isDirectory()) {\n return listDescendantFilePaths(entryPath);\n }\n if (entry.isFile()) {\n return [entryPath];\n }\n return [];\n });\n}\n\nfunction isDescendantAuditPath(candidate: string, possibleAncestor: string): boolean {\n return normalizeAuditPath(candidate).startsWith(`${normalizeAuditPath(possibleAncestor)}/`);\n}\n\nfunction normalizeAuditPath(relativePath: string): string {\n return relativePath.replace(/\\\\/g, \"/\");\n}\n\nfunction describeBlockingDescendants(\n targetDir: string,\n homeDir: string,\n entryPaths: string[],\n preservedPaths: Map<string, AuditPreservedPath>,\n skippedPaths: Map<string, AuditSkippedPath>,\n): string[] {\n const described = new Set<string>();\n\n for (const entryPath of entryPaths) {\n const preserved = findRecordedDescendant(entryPath, preservedPaths);\n if (preserved) {\n described.add(preserved.path);\n continue;\n }\n\n const skipped = findRecordedDescendant(entryPath, skippedPaths);\n if (skipped) {\n described.add(skipped.path);\n continue;\n }\n\n described.add(\n createAuditPathMetadata(targetDir, entryPath, getExistingPathKind(entryPath), homeDir).path,\n );\n }\n\n return [...described].sort();\n}\n\nfunction findRecordedDescendant<T extends AuditCandidateMetadata>(\n rootPath: string,\n records: Map<string, T>,\n): T | null {\n for (const record of records.values()) {\n if (isWithinRoot(rootPath, record.absolutePath)) {\n return record;\n }\n }\n\n return null;\n}\n\nfunction getCandidateParentDirectories(\n absoluteFilePath: string,\n boundary: string,\n targetDir: string,\n): string[] {\n const directories: string[] = [];\n let current = path.dirname(absoluteFilePath);\n const normalizedBoundary = path.resolve(boundary);\n\n while (current !== normalizedBoundary && isWithinRoot(normalizedBoundary, current)) {\n if (isInsideProjectBackupRoot(targetDir, current)) {\n break;\n }\n\n directories.push(current);\n current = path.dirname(current);\n }\n\n return directories;\n}\n\nfunction classifyProjectConfig(options: {\n targetDir: string;\n homeDir: string;\n preservedPaths: Map<string, AuditPreservedPath>;\n}): void {\n const { targetDir, homeDir, preservedPaths } = options;\n const absolutePath = path.join(targetDir, TOOL_DIRECTORY_CONFIG_RELATIVE_PATH);\n if (!existsSync(absolutePath)) {\n return;\n }\n\n addPreserved(\n preservedPaths,\n createCandidatePathRecord(\n targetDir,\n homeDir,\n TOOL_DIRECTORY_CONFIG_RELATIVE_PATH,\n getExistingPathKind(absolutePath),\n \"project-config\",\n ),\n createReason(\n \"project-config-preserved\",\n \"The make-docs config file is project-owned local configuration and is preserved separately from managed files, conflicts, provider state, and cache state.\",\n ),\n );\n}\n\nasync function loadCanonicalSkillContentByPath(\n targetDir: string,\n homeDir: string,\n selections: InstallSelections,\n shouldLoad: boolean,\n): Promise<Map<string, FileContent> | null> {\n if (!shouldLoad) {\n return new Map();\n }\n\n try {\n const skillRegistry = loadSavedSkillRegistry(selections);\n const [assets, retiredAssets] = await Promise.all([\n getDesiredSkillAssets(selections, skillRegistry),\n getRetiredManagedSkillAssets(selections, skillRegistry),\n ]);\n return new Map(\n [...assets, ...retiredAssets].flatMap((asset) =>\n asset.kind === \"skill-exposure\" ? asset.copyMirrorAssets : [asset],\n ).map((asset) => {\n const record = createManagedPathRecord(\n targetDir,\n homeDir,\n asset.relativePath,\n \"manifest-skill-file\",\n { sourceId: asset.sourceId },\n );\n return [record.path, asset.content] as const;\n }),\n );\n } catch {\n return null;\n }\n}\n\nfunction createSkillSelectionReview(\n selections: InstallSelections,\n): AuditSkillSelectionReview {\n return {\n skillsEnabled: selections.skills,\n skillScope: selections.skillScope,\n selectedSkills: [...selections.selectedSkills].sort(),\n ...(selections.skillManifest\n ? { skillManifest: structuredClone(selections.skillManifest) }\n : {}),\n skillSelectionProvenance: [\n ...(selections.skillSelectionProvenance ?? []),\n ].sort((left, right) => left.skillName.localeCompare(right.skillName)),\n };\n}\n\nfunction createPluginSelectionReview(\n selections: InstallSelections,\n): AuditPluginSelectionReview {\n return {\n pluginsEnabled: selections.plugins,\n pluginScope: selections.pluginScope,\n selectedPlugins: [...selections.selectedPlugins].sort(),\n ...(selections.pluginManifest\n ? { pluginManifest: structuredClone(selections.pluginManifest) }\n : {}),\n pluginSelectionProvenance: [\n ...(selections.pluginSelectionProvenance ?? []),\n ].sort((left, right) => left.pluginId.localeCompare(right.pluginId)),\n };\n}\n\nfunction loadSavedSkillRegistry(selections: InstallSelections): SkillRegistry {\n const savedManifest = selections.skillManifest;\n if (!savedManifest || savedManifest.source === \"built-in\") {\n return loadSkillRegistry(PACKAGE_ROOT);\n }\n\n if (savedManifest.source === \"file\" && savedManifest.path) {\n return loadEffectiveSkillRegistry({\n packageRoot: PACKAGE_ROOT,\n manifestReference: savedManifest.path,\n }).registry;\n }\n\n throw new Error(\n \"Saved remote-pinned skill manifests require explicit migration review before lifecycle audit expansion.\",\n );\n}\n\nasync function loadFallbackSkillCandidates(options: {\n targetDir: string;\n homeDir: string;\n selections: InstallSelections;\n}): Promise<Array<{ record: AuditManagedPathMetadata; content: FileContent }> | null> {\n try {\n const assets = await getDesiredSkillAssets(options.selections);\n return assets.flatMap((asset) =>\n (asset.kind === \"skill-exposure\" ? asset.copyMirrorAssets : [asset]).map(\n (resolvedAsset) => ({\n record: createManagedPathRecord(\n options.targetDir,\n options.homeDir,\n resolvedAsset.relativePath,\n \"fallback\",\n { sourceId: resolvedAsset.sourceId },\n ),\n content: resolvedAsset.content,\n }),\n ),\n );\n } catch {\n return null;\n }\n}\n\nfunction getKnownAgenticsRoots(\n targetDir: string,\n homeDir: string,\n): Array<\n AuditCandidateMetadata & {\n pathScope: \"project\" | \"home\";\n agenticKind: \"skill\" | \"plugin\";\n }\n> {\n return [\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(targetDir, SHARED_AGENTICS_SKILL_DIR),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"project\" as const,\n agenticKind: \"skill\" as const,\n },\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(homeDir, SHARED_AGENTICS_SKILL_DIR),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"home\" as const,\n agenticKind: \"skill\" as const,\n },\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(targetDir, SHARED_AGENTICS_PLUGIN_DIR),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"project\" as const,\n agenticKind: \"plugin\" as const,\n },\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(homeDir, SHARED_AGENTICS_PLUGIN_DIR),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"home\" as const,\n agenticKind: \"plugin\" as const,\n },\n {\n ...createCandidatePathRecord(targetDir, homeDir, path.join(homeDir, \".agents/skills\"), \"directory\", \"fallback\"),\n pathScope: \"home\" as const, agenticKind: \"skill\" as const,\n },\n ...HARNESSES.flatMap((harness) => [\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(targetDir, HARNESS_SKILL_DIRS[harness]),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"project\" as const,\n agenticKind: \"skill\" as const,\n },\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n getHarnessSkillDirectory(harness, \"global\", homeDir),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"home\" as const,\n agenticKind: \"skill\" as const,\n },\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(targetDir, HARNESS_PLUGIN_DIRS[harness]),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"project\" as const,\n agenticKind: \"plugin\" as const,\n },\n {\n ...createCandidatePathRecord(\n targetDir,\n homeDir,\n path.join(homeDir, HARNESS_PLUGIN_DIRS[harness]),\n \"directory\",\n \"fallback\",\n ),\n pathScope: \"home\" as const,\n agenticKind: \"plugin\" as const,\n },\n ]),\n ];\n}\n\nfunction createManagedPathRecord(\n targetDir: string,\n homeDir: string,\n auditPath: string,\n ownershipSource: AuditOwnershipSource,\n options?: {\n sourceId?: string;\n manifestHash?: string;\n skillExposure?: ManifestAuditRecord[\"skillExposure\"];\n },\n): ManifestAuditRecord {\n const agenticRole = classifyAgenticFileRole({\n relativePath: auditPath,\n sourceId: options?.sourceId,\n });\n const kind = options?.skillExposure ? \"directory\" : \"file\";\n\n return {\n ...createAuditPathMetadata(targetDir, auditPath, kind, homeDir),\n ownershipSource,\n sourceId: options?.sourceId,\n manifestHash: options?.manifestHash,\n skillExposure: options?.skillExposure,\n ...(agenticRole ? { agenticRole } : {}),\n };\n}\n\nfunction createCandidatePathRecord(\n targetDir: string,\n homeDir: string,\n auditPath: string,\n kind: AuditPathKind,\n ownershipSource?: AuditOwnershipSource,\n): AuditCandidateMetadata {\n const agenticRole = classifyAgenticFileRole({ relativePath: auditPath });\n\n return {\n ...createAuditPathMetadata(targetDir, auditPath, kind, homeDir),\n ownershipSource,\n ...(agenticRole ? { agenticRole } : {}),\n };\n}\n\nfunction addRemovable(\n removableFiles: Map<string, AuditRemovableFile>,\n record: AuditManagedPathMetadata,\n reason: AuditReason,\n currentHash?: string,\n expectedHash?: string,\n): void {\n removableFiles.set(record.absolutePath, {\n ...record,\n kind: record.kind === \"directory\" ? \"directory\" : \"file\",\n reason: reason.message,\n reasonCode: reason.code,\n currentHash,\n expectedHash,\n });\n}\n\nfunction addPreserved(\n preservedPaths: Map<string, AuditPreservedPath>,\n record: AuditCandidateMetadata,\n reason: AuditReason,\n preservedDescendantPaths?: string[],\n): void {\n preservedPaths.set(record.absolutePath, {\n ...record,\n reason: reason.message,\n reasonCode: reason.code,\n preservedDescendantPaths,\n });\n}\n\nfunction addSkipped(\n skippedPaths: Map<string, AuditSkippedPath>,\n record: AuditCandidateMetadata,\n status: AuditSkippedPath[\"status\"],\n reason: AuditReason,\n): void {\n skippedPaths.set(record.absolutePath, {\n ...record,\n reason: reason.message,\n reasonCode: reason.code,\n status,\n });\n}\n\nfunction createReason(code: AuditReason[\"code\"], message: string): AuditReason {\n return { code, message };\n}\n\nfunction formatAuditAgenticRole(record: AuditManagedPathMetadata): string {\n return formatAgenticFileRole(record.agenticRole) ?? \"agentic file\";\n}\n\nfunction isInstructionPath(auditPath: string): boolean {\n return isInstructionManifestPath(auditPath);\n}\n\nfunction isInsideProjectBackupRoot(targetDir: string, absolutePath: string): boolean {\n return isInsideProjectBackupStateRoot(targetDir, absolutePath);\n}\n\nfunction isWithinRoot(rootPath: string, candidatePath: string): boolean {\n const relative = path.relative(path.resolve(rootPath), path.resolve(candidatePath));\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nfunction getExistingPathKind(absolutePath: string): AuditPathKind {\n return lstatSync(absolutePath).isDirectory() ? \"directory\" : \"file\";\n}\n\nfunction looksLikeMakeDocsManifest(filePath: string): boolean {\n try {\n const raw = JSON.parse(readTextFile(filePath)) as Record<string, unknown>;\n return (\n typeof raw.schemaVersion === \"number\" &&\n typeof raw.packageName === \"string\" &&\n typeof raw.packageVersion === \"string\" &&\n typeof raw.profileId === \"string\" &&\n typeof raw.updatedAt === \"string\" &&\n typeof raw.selections === \"object\" &&\n raw.selections !== null &&\n typeof raw.files === \"object\" &&\n raw.files !== null\n );\n } catch {\n return false;\n }\n}\n\nfunction sortAuditEntries<T extends { ordering: { sortKey: string } }>(entries: T[]): T[] {\n return [...entries].sort((left, right) =>\n left.ordering.sortKey.localeCompare(right.ordering.sortKey),\n );\n}\n\nfunction sortPrunableDirectories(entries: AuditPrunableDirectory[]): AuditPrunableDirectory[] {\n return [...entries].sort((left, right) =>\n left.ordering.pruneSortKey.localeCompare(right.ordering.pruneSortKey),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAEV,IAAM,+BAA+B;AACrC,IAAM,sCAAsC;AAE5C,SAAS,qBAAqB,WAA2B;AAC9D,SAAO,KAAK,QAAQ,WAAW,4BAA4B;AAC7D;AAEO,SAAS,2BAA2B,WAA2B;AACpE,SAAO,KAAK,QAAQ,WAAW,mCAAmC;AAC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2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createAuditReport,
|
|
4
4
|
getProjectBackupRoot
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-46MGH32G.js";
|
|
6
6
|
import {
|
|
7
7
|
confirm,
|
|
8
8
|
intro,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
preparePlannedFileChange,
|
|
17
17
|
sealInstallationOperation,
|
|
18
18
|
withInstallationOperation
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HXWD2EUD.js";
|
|
20
20
|
|
|
21
21
|
// src/backup.ts
|
|
22
22
|
import {
|
|
@@ -520,4 +520,4 @@ export {
|
|
|
520
520
|
executePreparedBackup,
|
|
521
521
|
resolveBackupDestinationPlan
|
|
522
522
|
};
|
|
523
|
-
//# sourceMappingURL=chunk-
|
|
523
|
+
//# sourceMappingURL=chunk-CCYP5NU2.js.map
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
prepareInstallationRemoval,
|
|
8
8
|
pruneInstallationParents,
|
|
9
9
|
removeInstallationPath
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VMKG3H4B.js";
|
|
11
11
|
import {
|
|
12
12
|
NO_ACCESS,
|
|
13
13
|
getFirstPartyHarnessAdapter,
|
|
14
14
|
validateHarnessMethodSelection
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ISSMVKIA.js";
|
|
16
16
|
import {
|
|
17
17
|
CONFLICTS_RELATIVE_DIR,
|
|
18
18
|
DEFAULT_SYSTEM_ASSET_MATERIALIZATION_MODE,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
withInstallationOperation,
|
|
76
76
|
writeContentFile,
|
|
77
77
|
writeManifest
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-HXWD2EUD.js";
|
|
79
79
|
|
|
80
80
|
// src/config.ts
|
|
81
81
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -965,6 +965,49 @@ function formatLabelEntries(labels) {
|
|
|
965
965
|
return Object.entries(labels).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
966
966
|
}
|
|
967
967
|
|
|
968
|
+
// src/operations/mcp-metadata.ts
|
|
969
|
+
var MCP_PROFILES = ["core", "setup", "workflow", "quality", "backlog"];
|
|
970
|
+
var MCP_SERVER_PROFILES = [...MCP_PROFILES, "all"];
|
|
971
|
+
function parseMcpServerProfile(value = "all") {
|
|
972
|
+
if (MCP_SERVER_PROFILES.some((profile) => profile === value)) {
|
|
973
|
+
return value;
|
|
974
|
+
}
|
|
975
|
+
throw new Error(
|
|
976
|
+
`Unknown make-docs MCP profile: ${String(value)}. Allowed profiles: ${MCP_SERVER_PROFILES.join(", ")}.`
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
function assertMcpToolMetadata(owner, metadata) {
|
|
980
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
|
|
981
|
+
throw new Error(`MCP tool ${owner} must declare profile metadata.`);
|
|
982
|
+
}
|
|
983
|
+
const { profiles, defaultExposure } = metadata;
|
|
984
|
+
if (!Array.isArray(profiles) || profiles.length === 0) {
|
|
985
|
+
throw new Error(`MCP tool ${owner} must declare a nonempty profile set.`);
|
|
986
|
+
}
|
|
987
|
+
for (const profile of profiles) {
|
|
988
|
+
if (!MCP_PROFILES.some((known) => known === profile)) {
|
|
989
|
+
throw new Error(`MCP tool ${owner} declares unknown profile: ${String(profile)}.`);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
if (new Set(profiles).size !== profiles.length) {
|
|
993
|
+
throw new Error(`MCP tool ${owner} declares duplicate profiles.`);
|
|
994
|
+
}
|
|
995
|
+
if (defaultExposure !== "eager" && defaultExposure !== "deferred") {
|
|
996
|
+
throw new Error(`MCP tool ${owner} must declare eager or deferred default exposure.`);
|
|
997
|
+
}
|
|
998
|
+
const uri = metadata.uiResourceUri;
|
|
999
|
+
if (uri !== void 0 && (typeof uri !== "string" || !/^ui:\/\/[a-z0-9][a-z0-9.-]*(?:\/[a-z0-9][a-z0-9-]*)*\/v[1-9][0-9]*\.html$/.test(uri))) {
|
|
1000
|
+
throw new Error(`MCP tool ${owner} must reference a versioned UI resource URI.`);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function cloneMcpToolMetadata(metadata) {
|
|
1004
|
+
return {
|
|
1005
|
+
profiles: [...metadata.profiles],
|
|
1006
|
+
defaultExposure: metadata.defaultExposure,
|
|
1007
|
+
...metadata.uiResourceUri ? { uiResourceUri: metadata.uiResourceUri } : {}
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
|
|
968
1011
|
// src/install.ts
|
|
969
1012
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
|
|
970
1013
|
import { existsSync as existsSync5, mkdirSync, readFileSync as readFileSync5, symlinkSync } from "fs";
|
|
@@ -1183,6 +1226,93 @@ function invalidUri(value, message) {
|
|
|
1183
1226
|
};
|
|
1184
1227
|
}
|
|
1185
1228
|
|
|
1229
|
+
// src/operations/resource/mcp-profiles.ts
|
|
1230
|
+
function getSystemResourceMcpProfiles(provider) {
|
|
1231
|
+
if (!provider || !Array.isArray(provider.resources)) {
|
|
1232
|
+
return invalidProfiles("The native MCP provider inventory is invalid.");
|
|
1233
|
+
}
|
|
1234
|
+
const uris = [];
|
|
1235
|
+
for (const resource of provider.resources) {
|
|
1236
|
+
if (!resource || typeof resource.identity?.uri !== "string") {
|
|
1237
|
+
return invalidProfiles("Each native MCP provider resource must have a canonical URI.");
|
|
1238
|
+
}
|
|
1239
|
+
uris.push(resource.identity.uri);
|
|
1240
|
+
}
|
|
1241
|
+
const assignments = validateSystemResourceMcpAssignments(provider.mcpResources, uris);
|
|
1242
|
+
if (!assignments.ok) return assignments;
|
|
1243
|
+
const profiles = {};
|
|
1244
|
+
for (const assignment of assignments.value) profiles[assignment.uri] = assignment.profiles;
|
|
1245
|
+
return { ok: true, value: Object.freeze(profiles) };
|
|
1246
|
+
}
|
|
1247
|
+
function validateSystemResourceMcpAssignments(value, resourceUris) {
|
|
1248
|
+
const inventory = /* @__PURE__ */ new Set();
|
|
1249
|
+
for (const uri of resourceUris) {
|
|
1250
|
+
if (typeof uri !== "string" || !parseSystemResourceUri(uri).ok) {
|
|
1251
|
+
return invalidProfiles("The native MCP provider inventory contains an invalid URI.");
|
|
1252
|
+
}
|
|
1253
|
+
if (inventory.has(uri)) {
|
|
1254
|
+
return invalidProfiles(`The native MCP provider inventory repeats URI ${uri}.`, uri);
|
|
1255
|
+
}
|
|
1256
|
+
inventory.add(uri);
|
|
1257
|
+
}
|
|
1258
|
+
if (!Array.isArray(value)) {
|
|
1259
|
+
return invalidProfiles("The system-resource catalog must declare native MCP profile assignments.");
|
|
1260
|
+
}
|
|
1261
|
+
const assignments = [];
|
|
1262
|
+
const assigned = /* @__PURE__ */ new Set();
|
|
1263
|
+
for (const entry of value) {
|
|
1264
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
1265
|
+
return invalidProfiles("Each native MCP resource assignment must be an object.");
|
|
1266
|
+
}
|
|
1267
|
+
if (Object.keys(entry).some((key) => key !== "uri" && key !== "profiles")) {
|
|
1268
|
+
return invalidProfiles("Native MCP resource assignments accept only uri and profiles fields.");
|
|
1269
|
+
}
|
|
1270
|
+
const { uri, profiles } = entry;
|
|
1271
|
+
if (typeof uri !== "string" || !parseSystemResourceUri(uri).ok) {
|
|
1272
|
+
return invalidProfiles("Each native MCP resource assignment must name a canonical system URI.");
|
|
1273
|
+
}
|
|
1274
|
+
if (assigned.has(uri)) {
|
|
1275
|
+
return invalidProfiles(`The system-resource catalog repeats native MCP URI ${uri}.`, uri);
|
|
1276
|
+
}
|
|
1277
|
+
if (!inventory.has(uri)) {
|
|
1278
|
+
return invalidProfiles(`Native MCP URI ${uri} is outside the provider inventory.`, uri);
|
|
1279
|
+
}
|
|
1280
|
+
if (!Array.isArray(profiles) || profiles.length === 0) {
|
|
1281
|
+
return invalidProfiles(`Native MCP resource ${uri} must declare a nonempty profile set.`, uri);
|
|
1282
|
+
}
|
|
1283
|
+
for (const profile of profiles) {
|
|
1284
|
+
if (!MCP_PROFILES.some((known) => known === profile)) {
|
|
1285
|
+
return invalidProfiles(`Native MCP resource ${uri} declares unknown profile: ${String(profile)}.`, uri);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
if (new Set(profiles).size !== profiles.length) {
|
|
1289
|
+
return invalidProfiles(`Native MCP resource ${uri} declares duplicate profiles.`, uri);
|
|
1290
|
+
}
|
|
1291
|
+
assigned.add(uri);
|
|
1292
|
+
assignments.push(Object.freeze({
|
|
1293
|
+
uri,
|
|
1294
|
+
profiles: Object.freeze([...profiles])
|
|
1295
|
+
}));
|
|
1296
|
+
}
|
|
1297
|
+
const missing2 = [...inventory].find((uri) => !assigned.has(uri));
|
|
1298
|
+
if (missing2) {
|
|
1299
|
+
return invalidProfiles(`Native MCP resource ${missing2} has no profile assignment.`, missing2);
|
|
1300
|
+
}
|
|
1301
|
+
assignments.sort((left, right) => left.uri < right.uri ? -1 : left.uri > right.uri ? 1 : 0);
|
|
1302
|
+
return { ok: true, value: Object.freeze(assignments) };
|
|
1303
|
+
}
|
|
1304
|
+
function invalidProfiles(message, uri) {
|
|
1305
|
+
return {
|
|
1306
|
+
ok: false,
|
|
1307
|
+
error: {
|
|
1308
|
+
code: "provider-catalog-invalid",
|
|
1309
|
+
message,
|
|
1310
|
+
recovery: "Restore the shipped catalog with one nonempty intent profile set for each provider URI.",
|
|
1311
|
+
...uri ? { uri } : {}
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1186
1316
|
// src/operations/resource/provider.ts
|
|
1187
1317
|
var DEFAULT_CATALOG_PATH = ".make-docs/system-resources.catalog.json";
|
|
1188
1318
|
function loadSystemResourceProvider(input) {
|
|
@@ -1265,6 +1395,8 @@ function loadSystemResourceProvider(input) {
|
|
|
1265
1395
|
}
|
|
1266
1396
|
}
|
|
1267
1397
|
resources.sort((left, right) => compareCodeUnits(left.identity.uri, right.identity.uri));
|
|
1398
|
+
const mcpResources = Object.hasOwn(catalog, "mcpResources") ? validateSystemResourceMcpAssignments(catalog.mcpResources, resources.map((entry) => entry.identity.uri)) : void 0;
|
|
1399
|
+
if (mcpResources && !mcpResources.ok) return mcpResources;
|
|
1268
1400
|
const inventoryDigest = sha256(
|
|
1269
1401
|
Buffer.from(resources.map((entry) => `${entry.identity.uri}\0${entry.digest}`).join("\n"))
|
|
1270
1402
|
);
|
|
@@ -1288,7 +1420,8 @@ function loadSystemResourceProvider(input) {
|
|
|
1288
1420
|
});
|
|
1289
1421
|
const inventory = Object.freeze({
|
|
1290
1422
|
provider: providerMetadata,
|
|
1291
|
-
resources: Object.freeze([...resources])
|
|
1423
|
+
resources: Object.freeze([...resources]),
|
|
1424
|
+
...mcpResources?.ok ? { mcpResources: mcpResources.value } : {}
|
|
1292
1425
|
});
|
|
1293
1426
|
return {
|
|
1294
1427
|
ok: true,
|
|
@@ -1663,11 +1796,14 @@ function buildSelectedResourceProjection(options) {
|
|
|
1663
1796
|
}
|
|
1664
1797
|
function createThinRouterAssets(profile) {
|
|
1665
1798
|
const assets = [];
|
|
1799
|
+
const added = /* @__PURE__ */ new Set();
|
|
1666
1800
|
for (const [harness, instructionKind] of Object.entries(HARNESS_TO_INSTRUCTION)) {
|
|
1667
1801
|
if (!profile.selections.harnesses[harness]) {
|
|
1668
1802
|
continue;
|
|
1669
1803
|
}
|
|
1670
1804
|
for (const relativePath of getConfiguredRouterPaths(profile, instructionKind)) {
|
|
1805
|
+
if (added.has(relativePath)) continue;
|
|
1806
|
+
added.add(relativePath);
|
|
1671
1807
|
assets.push({
|
|
1672
1808
|
relativePath,
|
|
1673
1809
|
assetClass: "scoped-static",
|
|
@@ -1749,6 +1885,7 @@ function createProjectSurfaceRouterAssets(profile, surface) {
|
|
|
1749
1885
|
artifacts: "docs/assets",
|
|
1750
1886
|
assets: "docs/assets"
|
|
1751
1887
|
}[surface];
|
|
1888
|
+
const added = /* @__PURE__ */ new Set();
|
|
1752
1889
|
return Object.entries(HARNESS_TO_INSTRUCTION).filter(([harness]) => profile.selections.harnesses[harness]).map(([harness, instructionKind]) => {
|
|
1753
1890
|
const relativePath = `${directory}/${instructionKind}`;
|
|
1754
1891
|
return {
|
|
@@ -1757,6 +1894,10 @@ function createProjectSurfaceRouterAssets(profile, surface) {
|
|
|
1757
1894
|
sourceId: `router:${harness}:${relativePath}`,
|
|
1758
1895
|
content: readThinRouterContent(relativePath, profile)
|
|
1759
1896
|
};
|
|
1897
|
+
}).filter((asset) => {
|
|
1898
|
+
if (added.has(asset.relativePath)) return false;
|
|
1899
|
+
added.add(asset.relativePath);
|
|
1900
|
+
return true;
|
|
1760
1901
|
}).sort((left, right) => compareCodeUnits2(left.relativePath, right.relativePath));
|
|
1761
1902
|
}
|
|
1762
1903
|
function applyP4ManifestOwnership(relativePath, entry) {
|
|
@@ -4119,6 +4260,11 @@ export {
|
|
|
4119
4260
|
createSystemResourceIdentity,
|
|
4120
4261
|
parseSystemResourceUri,
|
|
4121
4262
|
canonicalSystemResourcePath,
|
|
4263
|
+
MCP_SERVER_PROFILES,
|
|
4264
|
+
parseMcpServerProfile,
|
|
4265
|
+
assertMcpToolMetadata,
|
|
4266
|
+
cloneMcpToolMetadata,
|
|
4267
|
+
getSystemResourceMcpProfiles,
|
|
4122
4268
|
loadInstalledSystemResourceProvider,
|
|
4123
4269
|
matchesSystemResourceCatalogPath,
|
|
4124
4270
|
createRouterOwnershipManifestEntry,
|
|
@@ -4134,4 +4280,4 @@ export {
|
|
|
4134
4280
|
registerSkillAdoptionRecovery,
|
|
4135
4281
|
applySkillAdoptionReview
|
|
4136
4282
|
};
|
|
4137
|
-
//# sourceMappingURL=chunk-
|
|
4283
|
+
//# sourceMappingURL=chunk-CLSOY7NV.js.map
|