@brucewaynedecoy/make-docs 1.0.0-rc.1 → 2.0.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/LICENSE +21 -201
- package/README.md +36 -27
- package/dist/backup-73HQNKMC.js +20 -0
- package/dist/backup-73HQNKMC.js.map +1 -0
- package/dist/chunk-3BAJQXGH.js +1575 -0
- package/dist/chunk-3BAJQXGH.js.map +1 -0
- package/dist/chunk-64CTKJO7.js +4136 -0
- package/dist/chunk-64CTKJO7.js.map +1 -0
- package/dist/chunk-BENO4IH5.js +875 -0
- package/dist/chunk-BENO4IH5.js.map +1 -0
- package/dist/chunk-D4HDZEJT.js +37 -0
- package/dist/chunk-D4HDZEJT.js.map +1 -0
- package/dist/chunk-G5EF63GG.js +1291 -0
- package/dist/chunk-G5EF63GG.js.map +1 -0
- package/dist/chunk-GNP6HRVP.js +523 -0
- package/dist/chunk-GNP6HRVP.js.map +1 -0
- package/dist/chunk-HJYIQTMD.js +204 -0
- package/dist/chunk-HJYIQTMD.js.map +1 -0
- package/dist/chunk-LQ5NSWCJ.js +39 -0
- package/dist/chunk-LQ5NSWCJ.js.map +1 -0
- package/dist/chunk-LRVV7UDD.js +2340 -0
- package/dist/chunk-LRVV7UDD.js.map +1 -0
- package/dist/chunk-LVQSJF63.js +24674 -0
- package/dist/chunk-LVQSJF63.js.map +1 -0
- package/dist/chunk-MXBHCHSM.js +13995 -0
- package/dist/chunk-MXBHCHSM.js.map +1 -0
- package/dist/chunk-Z5K4FHYP.js +922 -0
- package/dist/chunk-Z5K4FHYP.js.map +1 -0
- package/dist/index.js +3798 -250
- package/dist/index.js.map +1 -1
- package/dist/self-YYXOLDKU.js +653 -0
- package/dist/self-YYXOLDKU.js.map +1 -0
- package/dist/server-O2ZELIMX.js +512 -0
- package/dist/server-O2ZELIMX.js.map +1 -0
- package/dist/setup-system-HZROFNMP.js +544 -0
- package/dist/setup-system-HZROFNMP.js.map +1 -0
- package/dist/{skills-command-3ESCZ75U.js → skills-command-MGGHY7HU.js} +190 -32
- package/dist/skills-command-MGGHY7HU.js.map +1 -0
- package/dist/uninstall-3UXXXNFO.js +223 -0
- package/dist/uninstall-3UXXXNFO.js.map +1 -0
- package/dist/virtual_make-docs-first-party-skills-ZII74YOB.js +11 -0
- package/dist/virtual_make-docs-first-party-skills-ZII74YOB.js.map +1 -0
- package/package.json +9 -6
- package/skill-registry.json +328 -125
- package/skill-registry.schema.json +221 -45
- package/template/.make-docs/AGENTS.md +18 -0
- package/template/.make-docs/CLAUDE.md +18 -0
- package/template/.make-docs/archive/AGENTS.md +11 -0
- package/template/.make-docs/archive/CLAUDE.md +11 -0
- package/template/.make-docs/system/AGENTS.md +12 -0
- package/template/.make-docs/system/CLAUDE.md +12 -0
- package/template/.make-docs/system/contracts/AGENTS.md +13 -0
- package/template/.make-docs/system/contracts/CLAUDE.md +13 -0
- package/template/{docs/assets/references → .make-docs/system/contracts}/commit-message-convention.md +4 -4
- package/template/.make-docs/system/contracts/coverage-pass-contract.md +198 -0
- package/template/.make-docs/system/contracts/deferred-obligation-contract.md +128 -0
- package/template/{docs/assets/references → .make-docs/system/contracts}/design-contract.md +7 -2
- package/template/{docs/assets/references → .make-docs/system/contracts}/guide-contract.md +21 -19
- package/template/{docs/assets/references → .make-docs/system/contracts}/history-record-contract.md +17 -11
- package/template/.make-docs/system/contracts/human-experience-contract.md +134 -0
- package/template/.make-docs/system/contracts/naive-uat-contract.md +231 -0
- package/template/.make-docs/system/contracts/output-contract.md +277 -0
- package/template/.make-docs/system/contracts/performance-evidence-governance.md +257 -0
- package/template/.make-docs/system/contracts/system-resource-contract.md +93 -0
- package/template/.make-docs/system/prompts/AGENTS.md +12 -0
- package/template/.make-docs/system/prompts/CLAUDE.md +12 -0
- package/template/.make-docs/system/prompts/coverage-pass-maintainer-guide.prompt.md +20 -0
- package/template/.make-docs/system/prompts/coverage-pass-prd-reconciliation.prompt.md +18 -0
- package/template/.make-docs/system/prompts/coverage-pass-testing-uat.prompt.md +46 -0
- package/template/.make-docs/system/prompts/coverage-pass-user-guide.prompt.md +20 -0
- package/template/.make-docs/system/prompts/designs-to-plan-change.prompt.md +18 -0
- package/template/.make-docs/system/prompts/designs-to-plan.prompt.md +14 -0
- package/template/.make-docs/system/prompts/docs-path-hygiene-cleanup.prompt.md +29 -0
- package/template/.make-docs/system/prompts/naive-uat-facilitator.prompt.md +28 -0
- package/template/.make-docs/system/prompts/naive-uat-tester.prompt.md +20 -0
- package/template/.make-docs/system/prompts/performance-coverage.prompt.md +63 -0
- package/template/.make-docs/system/prompts/plan-to-prd-change.prompt.md +12 -0
- package/template/.make-docs/system/prompts/plan-to-prd-green-field.prompt.md +10 -0
- package/template/.make-docs/system/prompts/prd-change-to-work.prompt.md +14 -0
- package/template/.make-docs/system/prompts/prd-to-work-full-prd.prompt.md +10 -0
- package/template/.make-docs/system/prompts/prd-to-work-prd-feature.prompt.md +10 -0
- package/template/.make-docs/system/prompts/request-to-design.prompt.md +20 -0
- package/template/.make-docs/system/prompts/session-to-history-record.prompt.md +23 -0
- package/template/{docs/assets → .make-docs/system}/prompts/work-to-commit-message.prompt.md +2 -2
- package/template/.make-docs/system/prompts/work-to-guides.prompt.md +22 -0
- package/template/.make-docs/system/references/AGENTS.md +14 -0
- package/template/.make-docs/system/references/CLAUDE.md +14 -0
- package/template/{docs/assets → .make-docs/system}/references/design-workflow.md +15 -2
- package/template/.make-docs/system/references/execution-workflow.md +189 -0
- package/template/.make-docs/system/references/human-experience.md +138 -0
- package/template/.make-docs/system/references/lifecycle.md +153 -0
- package/template/.make-docs/system/references/naive-uat-validation.md +65 -0
- package/template/.make-docs/system/references/naive-uat-workflow.md +64 -0
- package/template/.make-docs/system/references/path-and-link-hygiene.md +101 -0
- package/template/.make-docs/system/references/performance-evidence.md +114 -0
- package/template/.make-docs/system/references/planning-workflow.md +209 -0
- package/template/.make-docs/system/references/prd-change-management.md +165 -0
- package/template/{docs/assets → .make-docs/system}/references/wave-model.md +10 -8
- package/template/.make-docs/system/templates/AGENTS.md +12 -0
- package/template/.make-docs/system/templates/CLAUDE.md +12 -0
- package/template/.make-docs/system/templates/design.md +79 -0
- package/template/{docs/assets/templates/guide-developer.md → .make-docs/system/templates/guide-maintainer.md} +7 -3
- package/template/{docs/assets → .make-docs/system}/templates/guide-user.md +6 -2
- package/template/{docs/assets → .make-docs/system}/templates/history-record.md +6 -3
- package/template/.make-docs/system/templates/naive-uat-scenario.md +91 -0
- package/template/.make-docs/system/templates/performance-evidence-profile.md +252 -0
- package/template/.make-docs/system/templates/plan-overview.md +76 -0
- package/template/.make-docs/system/templates/plan-prd-change.md +155 -0
- package/template/{docs/assets → .make-docs/system}/templates/plan-prd-decompose.md +10 -0
- package/template/{docs/assets → .make-docs/system}/templates/plan-prd.md +28 -2
- package/template/{docs/assets → .make-docs/system}/templates/prd-architecture.md +13 -0
- package/template/.make-docs/system/templates/prd-glossary.md +28 -0
- package/template/.make-docs/system/templates/prd-index.md +70 -0
- package/template/{docs/assets → .make-docs/system}/templates/prd-overview.md +13 -0
- package/template/.make-docs/system/templates/prd-reference.md +30 -0
- package/template/{docs/assets → .make-docs/system}/templates/prd-risk-register.md +16 -1
- package/template/{docs/assets → .make-docs/system}/templates/prd-subsystem.md +15 -0
- package/template/.make-docs/system/templates/work-index.md +58 -0
- package/template/.make-docs/system/templates/work-phase.md +107 -0
- package/template/.make-docs/system-resources.catalog.json +91 -0
- package/template/.make-docs/system-resources.schema.json +204 -0
- package/template/AGENTS.md +8 -1
- package/template/CLAUDE.md +8 -1
- package/template/docs/AGENTS.codex-only.md +22 -0
- package/template/docs/AGENTS.md +21 -13
- package/template/docs/CLAUDE.claude-only.md +22 -0
- package/template/docs/CLAUDE.md +21 -13
- package/template/docs/assets/AGENTS.md +11 -7
- package/template/docs/assets/CLAUDE.md +11 -7
- package/template/docs/designs/AGENTS.md +8 -3
- package/template/docs/designs/CLAUDE.md +8 -3
- package/template/docs/plans/AGENTS.md +10 -3
- package/template/docs/plans/CLAUDE.md +10 -3
- package/template/docs/prd/AGENTS.md +14 -4
- package/template/docs/prd/CLAUDE.md +14 -4
- package/template/docs/work/AGENTS.md +10 -3
- package/template/docs/work/CLAUDE.md +10 -3
- package/dist/chunk-HP3HBG7F.js +0 -626
- package/dist/chunk-HP3HBG7F.js.map +0 -1
- package/dist/chunk-QRFH4J6H.js +0 -1194
- package/dist/chunk-QRFH4J6H.js.map +0 -1
- package/dist/chunk-WM3OXYTW.js +0 -2630
- package/dist/chunk-WM3OXYTW.js.map +0 -1
- package/dist/skills-command-3ESCZ75U.js.map +0 -1
- package/dist/uninstall-GQE4SJF2.js +0 -150
- package/dist/uninstall-GQE4SJF2.js.map +0 -1
- package/template/.make-docs/scripts/check_path_hygiene.py +0 -435
- package/template/docs/assets/archive/AGENTS.md +0 -20
- package/template/docs/assets/archive/CLAUDE.md +0 -20
- package/template/docs/assets/history/AGENTS.md +0 -12
- package/template/docs/assets/history/CLAUDE.md +0 -12
- package/template/docs/assets/prompts/AGENTS.md +0 -8
- package/template/docs/assets/prompts/CLAUDE.md +0 -8
- package/template/docs/assets/prompts/designs-to-plan-change.prompt.md +0 -14
- package/template/docs/assets/prompts/designs-to-plan.prompt.md +0 -10
- package/template/docs/assets/prompts/docs-path-hygiene-cleanup.prompt.md +0 -27
- package/template/docs/assets/prompts/plan-to-prd-change.prompt.md +0 -8
- package/template/docs/assets/prompts/plan-to-prd-green-field.prompt.md +0 -6
- package/template/docs/assets/prompts/prd-change-to-work.prompt.md +0 -10
- package/template/docs/assets/prompts/prd-to-work-full-prd.prompt.md +0 -6
- package/template/docs/assets/prompts/prd-to-work-prd-feature.prompt.md +0 -6
- package/template/docs/assets/prompts/request-to-design.prompt.md +0 -16
- package/template/docs/assets/prompts/session-to-history-record.prompt.md +0 -19
- package/template/docs/assets/prompts/work-to-guides.prompt.md +0 -18
- package/template/docs/assets/references/AGENTS.md +0 -9
- package/template/docs/assets/references/CLAUDE.md +0 -9
- package/template/docs/assets/references/execution-workflow.md +0 -157
- package/template/docs/assets/references/output-contract.md +0 -221
- package/template/docs/assets/references/path-and-link-hygiene.md +0 -49
- package/template/docs/assets/references/planning-workflow.md +0 -160
- package/template/docs/assets/references/prd-change-management.md +0 -129
- package/template/docs/assets/templates/AGENTS.md +0 -8
- package/template/docs/assets/templates/CLAUDE.md +0 -8
- package/template/docs/assets/templates/design.md +0 -30
- package/template/docs/assets/templates/plan-overview.md +0 -32
- package/template/docs/assets/templates/plan-prd-change.md +0 -99
- package/template/docs/assets/templates/prd-change-addition.md +0 -45
- package/template/docs/assets/templates/prd-change-revision.md +0 -45
- package/template/docs/assets/templates/prd-glossary.md +0 -15
- package/template/docs/assets/templates/prd-index.md +0 -45
- package/template/docs/assets/templates/prd-reference.md +0 -17
- package/template/docs/assets/templates/work-index.md +0 -21
- package/template/docs/assets/templates/work-phase.md +0 -34
- package/template/docs/guides/AGENTS.md +0 -15
- package/template/docs/guides/CLAUDE.md +0 -15
- /package/template/{docs/assets → .make-docs/system}/prompts/update-readme-green-field.prompt.md +0 -0
- /package/template/{docs/assets → .make-docs/system}/references/harness-capability-matrix.md +0 -0
package/dist/chunk-HP3HBG7F.js
DELETED
|
@@ -1,626 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
CONFLICTS_RELATIVE_DIR,
|
|
4
|
-
INSTRUCTION_KINDS,
|
|
5
|
-
createManifest,
|
|
6
|
-
createRunId,
|
|
7
|
-
ensureParentDir,
|
|
8
|
-
getDesiredAssets,
|
|
9
|
-
getDesiredSkillAssets,
|
|
10
|
-
hashText,
|
|
11
|
-
pruneEmptyDirectories,
|
|
12
|
-
readPackageMeta,
|
|
13
|
-
readTextFile,
|
|
14
|
-
relativePathToTarget,
|
|
15
|
-
resolveInstallProfile,
|
|
16
|
-
writeManifest,
|
|
17
|
-
writeTextFile
|
|
18
|
-
} from "./chunk-WM3OXYTW.js";
|
|
19
|
-
|
|
20
|
-
// src/install.ts
|
|
21
|
-
import { existsSync as existsSync2, mkdirSync, rmSync } from "fs";
|
|
22
|
-
import path2 from "path";
|
|
23
|
-
|
|
24
|
-
// src/planner.ts
|
|
25
|
-
import { existsSync } from "fs";
|
|
26
|
-
import path from "path";
|
|
27
|
-
async function createInstallPlan(options) {
|
|
28
|
-
const {
|
|
29
|
-
targetDir,
|
|
30
|
-
packageMeta,
|
|
31
|
-
profile,
|
|
32
|
-
existingManifest,
|
|
33
|
-
managedFileConflictResolutions
|
|
34
|
-
} = options;
|
|
35
|
-
const desiredAssets = getDesiredAssets(profile);
|
|
36
|
-
const desiredSkillAssets = await getDesiredSkillAssets(profile.selections);
|
|
37
|
-
const desiredSkillFiles = desiredSkillAssets.map((asset) => asset.relativePath);
|
|
38
|
-
const desiredSkillFileSet = new Set(desiredSkillFiles);
|
|
39
|
-
const allDesiredAssets = [...desiredAssets, ...desiredSkillAssets];
|
|
40
|
-
const desiredFiles = Object.fromEntries(
|
|
41
|
-
allDesiredAssets.map((asset) => [
|
|
42
|
-
asset.relativePath,
|
|
43
|
-
{
|
|
44
|
-
hash: hashText(asset.content),
|
|
45
|
-
sourceId: asset.sourceId
|
|
46
|
-
}
|
|
47
|
-
])
|
|
48
|
-
);
|
|
49
|
-
const actions = [];
|
|
50
|
-
let conflictsRunId;
|
|
51
|
-
const existingSkillFiles = new Set(existingManifest?.skillFiles ?? []);
|
|
52
|
-
for (const asset of allDesiredAssets) {
|
|
53
|
-
const absolutePath = relativePathToTarget(targetDir, asset.relativePath);
|
|
54
|
-
const desiredHash = hashText(asset.content);
|
|
55
|
-
if (!existsSync(absolutePath)) {
|
|
56
|
-
actions.push({
|
|
57
|
-
type: asset.assetClass === "buildable" ? "generate" : "create",
|
|
58
|
-
relativePath: asset.relativePath,
|
|
59
|
-
sourceId: asset.sourceId,
|
|
60
|
-
content: asset.content,
|
|
61
|
-
contentHash: desiredHash
|
|
62
|
-
});
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const currentContent = readTextFile(absolutePath);
|
|
66
|
-
if (currentContent === asset.content) {
|
|
67
|
-
actions.push({
|
|
68
|
-
type: "noop",
|
|
69
|
-
relativePath: asset.relativePath,
|
|
70
|
-
sourceId: asset.sourceId,
|
|
71
|
-
contentHash: desiredHash
|
|
72
|
-
});
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const manifestEntry = existingManifest?.files[asset.relativePath];
|
|
76
|
-
const conflictClassification = classifyReviewableManagedFileConflictPath(
|
|
77
|
-
asset.relativePath,
|
|
78
|
-
{ isDesiredSkillAsset: desiredSkillFileSet.has(asset.relativePath) }
|
|
79
|
-
);
|
|
80
|
-
const conflictResolution = getManagedFileConflictResolution(
|
|
81
|
-
asset.relativePath,
|
|
82
|
-
conflictClassification,
|
|
83
|
-
managedFileConflictResolutions
|
|
84
|
-
);
|
|
85
|
-
if (conflictClassification && conflictResolution === "overwrite") {
|
|
86
|
-
actions.push({
|
|
87
|
-
type: "update",
|
|
88
|
-
relativePath: asset.relativePath,
|
|
89
|
-
sourceId: asset.sourceId,
|
|
90
|
-
content: asset.content,
|
|
91
|
-
contentHash: desiredHash,
|
|
92
|
-
reason: getManagedFileConflictOverwriteReason(conflictClassification.group)
|
|
93
|
-
});
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (conflictClassification && conflictResolution === "skip") {
|
|
97
|
-
actions.push({
|
|
98
|
-
type: "skip",
|
|
99
|
-
relativePath: asset.relativePath,
|
|
100
|
-
sourceId: asset.sourceId,
|
|
101
|
-
contentHash: desiredHash,
|
|
102
|
-
reason: getManagedFileConflictSkipReason(
|
|
103
|
-
conflictClassification,
|
|
104
|
-
conflictResolution,
|
|
105
|
-
Boolean(manifestEntry)
|
|
106
|
-
)
|
|
107
|
-
});
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
conflictsRunId ??= createRunId();
|
|
111
|
-
actions.push({
|
|
112
|
-
type: "skip-conflict",
|
|
113
|
-
relativePath: asset.relativePath,
|
|
114
|
-
sourceId: asset.sourceId,
|
|
115
|
-
content: asset.content,
|
|
116
|
-
contentHash: desiredHash,
|
|
117
|
-
reason: getManagedFileConflictSkipReason(
|
|
118
|
-
conflictClassification,
|
|
119
|
-
conflictResolution,
|
|
120
|
-
Boolean(manifestEntry)
|
|
121
|
-
)
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
if (existingManifest) {
|
|
125
|
-
for (const [relativePath, manifestEntry] of Object.entries(existingManifest.files)) {
|
|
126
|
-
if (relativePath in desiredFiles) {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
const absolutePath = relativePathToTarget(targetDir, relativePath);
|
|
130
|
-
if (!existsSync(absolutePath)) {
|
|
131
|
-
actions.push({
|
|
132
|
-
type: "remove-managed",
|
|
133
|
-
relativePath,
|
|
134
|
-
sourceId: manifestEntry.sourceId
|
|
135
|
-
});
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
const currentContent = readTextFile(absolutePath);
|
|
139
|
-
const currentHash = hashText(currentContent);
|
|
140
|
-
if (currentHash === manifestEntry.hash) {
|
|
141
|
-
actions.push({
|
|
142
|
-
type: "remove-managed",
|
|
143
|
-
relativePath,
|
|
144
|
-
sourceId: manifestEntry.sourceId
|
|
145
|
-
});
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
conflictsRunId ??= createRunId();
|
|
149
|
-
actions.push({
|
|
150
|
-
type: "skip-conflict",
|
|
151
|
-
relativePath,
|
|
152
|
-
sourceId: manifestEntry.sourceId,
|
|
153
|
-
reason: "Existing managed file differs from the recorded manifest and will not be removed automatically."
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
for (const relativePath of existingSkillFiles) {
|
|
157
|
-
if (relativePath in desiredFiles || relativePath in existingManifest.files) {
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
actions.push({
|
|
161
|
-
type: "remove-managed",
|
|
162
|
-
relativePath,
|
|
163
|
-
sourceId: `skill:${relativePath}`
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
actions.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
168
|
-
return {
|
|
169
|
-
packageName: packageMeta.name,
|
|
170
|
-
packageVersion: packageMeta.version,
|
|
171
|
-
profile,
|
|
172
|
-
actions,
|
|
173
|
-
desiredFiles,
|
|
174
|
-
desiredSkillFiles: desiredSkillFiles.sort(),
|
|
175
|
-
conflictsRunId
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
async function createSkillsOnlyInstallPlan(options) {
|
|
179
|
-
const { targetDir, packageMeta, profile, existingManifest, remove } = options;
|
|
180
|
-
const desiredSkillAssets = remove ? [] : await getDesiredSkillAssets(profile.selections);
|
|
181
|
-
const desiredSkillFiles = desiredSkillAssets.map((asset) => asset.relativePath);
|
|
182
|
-
const desiredFiles = Object.fromEntries(
|
|
183
|
-
desiredSkillAssets.map((asset) => [
|
|
184
|
-
asset.relativePath,
|
|
185
|
-
{
|
|
186
|
-
hash: hashText(asset.content),
|
|
187
|
-
sourceId: asset.sourceId
|
|
188
|
-
}
|
|
189
|
-
])
|
|
190
|
-
);
|
|
191
|
-
const previousSkillContent = await getPreviousSkillContentByPath(existingManifest);
|
|
192
|
-
const existingSkillFiles = new Set(existingManifest?.skillFiles ?? []);
|
|
193
|
-
const actions = [];
|
|
194
|
-
let conflictsRunId;
|
|
195
|
-
if (!remove) {
|
|
196
|
-
for (const asset of desiredSkillAssets) {
|
|
197
|
-
const action = planDesiredSkillAsset({
|
|
198
|
-
targetDir,
|
|
199
|
-
asset,
|
|
200
|
-
existingManifest,
|
|
201
|
-
existingSkillFiles,
|
|
202
|
-
previousSkillContent
|
|
203
|
-
});
|
|
204
|
-
if (action.type === "skip-conflict") {
|
|
205
|
-
conflictsRunId ??= createRunId();
|
|
206
|
-
}
|
|
207
|
-
actions.push(action);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (existingManifest) {
|
|
211
|
-
for (const relativePath of existingSkillFiles) {
|
|
212
|
-
if (relativePath in desiredFiles) {
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
const action = planStaleSkillFile({
|
|
216
|
-
targetDir,
|
|
217
|
-
relativePath,
|
|
218
|
-
existingManifest,
|
|
219
|
-
previousSkillContent
|
|
220
|
-
});
|
|
221
|
-
if (action.type === "skip-conflict") {
|
|
222
|
-
conflictsRunId ??= createRunId();
|
|
223
|
-
}
|
|
224
|
-
actions.push(action);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
actions.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
228
|
-
return {
|
|
229
|
-
packageName: packageMeta.name,
|
|
230
|
-
packageVersion: packageMeta.version,
|
|
231
|
-
profile,
|
|
232
|
-
actions,
|
|
233
|
-
desiredFiles,
|
|
234
|
-
desiredSkillFiles: desiredSkillFiles.sort(),
|
|
235
|
-
conflictsRunId
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function planDesiredSkillAsset(options) {
|
|
239
|
-
const { targetDir, asset, existingManifest, existingSkillFiles, previousSkillContent } = options;
|
|
240
|
-
const absolutePath = relativePathToTarget(targetDir, asset.relativePath);
|
|
241
|
-
const desiredHash = hashText(asset.content);
|
|
242
|
-
if (!existsSync(absolutePath)) {
|
|
243
|
-
return {
|
|
244
|
-
type: "create",
|
|
245
|
-
relativePath: asset.relativePath,
|
|
246
|
-
sourceId: asset.sourceId,
|
|
247
|
-
content: asset.content,
|
|
248
|
-
contentHash: desiredHash
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
const currentContent = readTextFile(absolutePath);
|
|
252
|
-
if (currentContent === asset.content) {
|
|
253
|
-
return {
|
|
254
|
-
type: "noop",
|
|
255
|
-
relativePath: asset.relativePath,
|
|
256
|
-
sourceId: asset.sourceId,
|
|
257
|
-
contentHash: desiredHash
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
const currentHash = hashText(currentContent);
|
|
261
|
-
const manifestEntry = existingManifest?.files[asset.relativePath];
|
|
262
|
-
if (manifestEntry && manifestEntry.hash === currentHash) {
|
|
263
|
-
return {
|
|
264
|
-
type: "update",
|
|
265
|
-
relativePath: asset.relativePath,
|
|
266
|
-
sourceId: asset.sourceId,
|
|
267
|
-
content: asset.content,
|
|
268
|
-
contentHash: desiredHash
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
const previousContent = previousSkillContent.get(asset.relativePath);
|
|
272
|
-
if (existingSkillFiles.has(asset.relativePath) && previousContent !== void 0 && currentContent === previousContent) {
|
|
273
|
-
return {
|
|
274
|
-
type: "update",
|
|
275
|
-
relativePath: asset.relativePath,
|
|
276
|
-
sourceId: asset.sourceId,
|
|
277
|
-
content: asset.content,
|
|
278
|
-
contentHash: desiredHash,
|
|
279
|
-
reason: "Managed skill file will be refreshed."
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
return {
|
|
283
|
-
type: "skip-conflict",
|
|
284
|
-
relativePath: asset.relativePath,
|
|
285
|
-
sourceId: asset.sourceId,
|
|
286
|
-
content: asset.content,
|
|
287
|
-
contentHash: desiredHash,
|
|
288
|
-
reason: existingSkillFiles.has(asset.relativePath) ? "Existing managed skill file differs from the desired skill content." : "Unmanaged skill file already exists with different content."
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function planStaleSkillFile(options) {
|
|
292
|
-
const { targetDir, relativePath, existingManifest, previousSkillContent } = options;
|
|
293
|
-
const manifestEntry = existingManifest.files[relativePath];
|
|
294
|
-
const absolutePath = relativePathToTarget(targetDir, relativePath);
|
|
295
|
-
if (!existsSync(absolutePath)) {
|
|
296
|
-
return {
|
|
297
|
-
type: "remove-managed",
|
|
298
|
-
relativePath,
|
|
299
|
-
sourceId: manifestEntry?.sourceId ?? `skill:${relativePath}`
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
const currentContent = readTextFile(absolutePath);
|
|
303
|
-
const currentHash = hashText(currentContent);
|
|
304
|
-
if (manifestEntry && manifestEntry.hash === currentHash) {
|
|
305
|
-
return {
|
|
306
|
-
type: "remove-managed",
|
|
307
|
-
relativePath,
|
|
308
|
-
sourceId: manifestEntry.sourceId
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
const previousContent = previousSkillContent.get(relativePath);
|
|
312
|
-
if (!manifestEntry && (previousContent === void 0 || currentContent === previousContent)) {
|
|
313
|
-
return {
|
|
314
|
-
type: "remove-managed",
|
|
315
|
-
relativePath,
|
|
316
|
-
sourceId: `skill:${relativePath}`
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
return {
|
|
320
|
-
type: "skip-conflict",
|
|
321
|
-
relativePath,
|
|
322
|
-
sourceId: manifestEntry?.sourceId ?? `skill:${relativePath}`,
|
|
323
|
-
reason: "Existing managed file differs from the recorded manifest and will not be removed automatically."
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
async function getPreviousSkillContentByPath(existingManifest) {
|
|
327
|
-
if (!existingManifest) {
|
|
328
|
-
return /* @__PURE__ */ new Map();
|
|
329
|
-
}
|
|
330
|
-
const selections = structuredClone(existingManifest.selections);
|
|
331
|
-
selections.skills = true;
|
|
332
|
-
try {
|
|
333
|
-
const previousAssets = await getDesiredSkillAssets(selections);
|
|
334
|
-
return new Map(previousAssets.map((asset) => [asset.relativePath, asset.content]));
|
|
335
|
-
} catch {
|
|
336
|
-
return /* @__PURE__ */ new Map();
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function getManagedFileConflictResolution(relativePath, classification, managedFileConflictResolutions) {
|
|
340
|
-
if (!classification) {
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
return managedFileConflictResolutions?.[relativePath] ?? null;
|
|
344
|
-
}
|
|
345
|
-
function classifyReviewableManagedFileConflictPath(relativePath, options = {}) {
|
|
346
|
-
if (options.isDesiredSkillAsset || isSkillAssetPath(relativePath)) {
|
|
347
|
-
return {
|
|
348
|
-
group: "skills",
|
|
349
|
-
instructionKind: getInstructionKindForPath(relativePath) ?? void 0
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
if (relativePath.startsWith("docs/assets/references/")) {
|
|
353
|
-
return {
|
|
354
|
-
group: "references",
|
|
355
|
-
instructionKind: getInstructionKindForPath(relativePath) ?? void 0
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
if (relativePath.startsWith("docs/assets/templates/")) {
|
|
359
|
-
return {
|
|
360
|
-
group: "templates",
|
|
361
|
-
instructionKind: getInstructionKindForPath(relativePath) ?? void 0
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
if (relativePath.startsWith("docs/assets/prompts/")) {
|
|
365
|
-
return {
|
|
366
|
-
group: "prompts",
|
|
367
|
-
instructionKind: getInstructionKindForPath(relativePath) ?? void 0
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
const instructionKind = getInstructionKindForPath(relativePath);
|
|
371
|
-
if (instructionKind) {
|
|
372
|
-
return {
|
|
373
|
-
group: "agent-instructions",
|
|
374
|
-
instructionKind
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
return {
|
|
378
|
-
group: "managed-files"
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
function getInstructionKindForPath(relativePath) {
|
|
382
|
-
const basename = path.posix.basename(relativePath);
|
|
383
|
-
return INSTRUCTION_KINDS.includes(basename) ? basename : null;
|
|
384
|
-
}
|
|
385
|
-
function isSkillAssetPath(relativePath) {
|
|
386
|
-
return relativePath.startsWith(".claude/skills/") || relativePath.startsWith(".claude/skill-assets/") || relativePath.startsWith(".agents/skills/") || relativePath.startsWith(".agents/skill-assets/");
|
|
387
|
-
}
|
|
388
|
-
function getManagedFileConflictOverwriteReason(group) {
|
|
389
|
-
switch (group) {
|
|
390
|
-
case "agent-instructions":
|
|
391
|
-
return "Overwrite existing conflicting agent instruction file.";
|
|
392
|
-
case "managed-files":
|
|
393
|
-
return "Overwrite existing conflicting managed file.";
|
|
394
|
-
case "prompts":
|
|
395
|
-
return "Overwrite existing conflicting prompt file.";
|
|
396
|
-
case "references":
|
|
397
|
-
return "Overwrite existing conflicting reference file.";
|
|
398
|
-
case "skills":
|
|
399
|
-
return "Overwrite existing conflicting skill file.";
|
|
400
|
-
case "templates":
|
|
401
|
-
return "Overwrite existing conflicting template file.";
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
function getManagedFileConflictSkipReason(classification, resolution, isManifestOwned) {
|
|
405
|
-
if (!classification) {
|
|
406
|
-
return isManifestOwned ? "Existing managed file differs from the recorded manifest." : "Unmanaged file already exists with different content.";
|
|
407
|
-
}
|
|
408
|
-
if (resolution === "skip") {
|
|
409
|
-
return `Existing conflicting ${getManagedFileConflictGroupLabel(
|
|
410
|
-
classification.group
|
|
411
|
-
)} was explicitly skipped.`;
|
|
412
|
-
}
|
|
413
|
-
return `Existing conflicting ${getManagedFileConflictGroupLabel(
|
|
414
|
-
classification.group
|
|
415
|
-
)} was skipped because no overwrite resolution was provided.`;
|
|
416
|
-
}
|
|
417
|
-
function getManagedFileConflictGroupLabel(group) {
|
|
418
|
-
switch (group) {
|
|
419
|
-
case "agent-instructions":
|
|
420
|
-
return "agent instruction file";
|
|
421
|
-
case "managed-files":
|
|
422
|
-
return "managed file";
|
|
423
|
-
case "prompts":
|
|
424
|
-
return "prompt file";
|
|
425
|
-
case "references":
|
|
426
|
-
return "reference file";
|
|
427
|
-
case "skills":
|
|
428
|
-
return "skill file";
|
|
429
|
-
case "templates":
|
|
430
|
-
return "template file";
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// src/install.ts
|
|
435
|
-
async function planInstall(options) {
|
|
436
|
-
const packageMeta = options.packageMeta ?? readPackageMeta();
|
|
437
|
-
const profile = resolveInstallProfile(options.selections);
|
|
438
|
-
return createInstallPlan({
|
|
439
|
-
targetDir: options.targetDir,
|
|
440
|
-
packageMeta,
|
|
441
|
-
profile,
|
|
442
|
-
existingManifest: options.existingManifest,
|
|
443
|
-
managedFileConflictResolutions: options.managedFileConflictResolutions
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
async function planSkillsOnlyInstall(options) {
|
|
447
|
-
const packageMeta = options.packageMeta ?? readPackageMeta();
|
|
448
|
-
const profile = resolveInstallProfile(options.selections);
|
|
449
|
-
return createSkillsOnlyInstallPlan({
|
|
450
|
-
targetDir: options.targetDir,
|
|
451
|
-
packageMeta,
|
|
452
|
-
profile,
|
|
453
|
-
existingManifest: options.existingManifest,
|
|
454
|
-
remove: options.remove
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
function findReviewableManagedFileConflicts(plan) {
|
|
458
|
-
return plan.actions.flatMap((action) => {
|
|
459
|
-
if (action.type !== "skip-conflict" || typeof action.content !== "string" || !action.reason) {
|
|
460
|
-
return [];
|
|
461
|
-
}
|
|
462
|
-
const classification = classifyReviewableManagedFileConflictPath(action.relativePath);
|
|
463
|
-
if (!classification || !action.sourceId) {
|
|
464
|
-
return [];
|
|
465
|
-
}
|
|
466
|
-
return [
|
|
467
|
-
{
|
|
468
|
-
relativePath: action.relativePath,
|
|
469
|
-
group: classification.group,
|
|
470
|
-
sourceId: action.sourceId,
|
|
471
|
-
reason: action.reason,
|
|
472
|
-
...classification.instructionKind ? { instructionKind: classification.instructionKind } : {}
|
|
473
|
-
}
|
|
474
|
-
];
|
|
475
|
-
}).sort(compareReviewableManagedFileConflicts);
|
|
476
|
-
}
|
|
477
|
-
function applyInstallPlan(options) {
|
|
478
|
-
const unresolvedConflicts = findReviewableManagedFileConflicts(options.plan);
|
|
479
|
-
if (unresolvedConflicts.length > 0) {
|
|
480
|
-
const paths = unresolvedConflicts.map((conflict) => conflict.relativePath).join(", ");
|
|
481
|
-
throw new Error(`Cannot apply install plan with unresolved managed-file conflicts: ${paths}.`);
|
|
482
|
-
}
|
|
483
|
-
return applyInstallPlanInternal({
|
|
484
|
-
...options,
|
|
485
|
-
trackSkillFilesInManifestFiles: true
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
function applySkillsOnlyInstallPlan(options) {
|
|
489
|
-
return applyInstallPlanInternal({
|
|
490
|
-
...options,
|
|
491
|
-
trackSkillFilesInManifestFiles: false
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
function applyInstallPlanInternal(options) {
|
|
495
|
-
const { targetDir, plan, existingManifest } = options;
|
|
496
|
-
const nextFiles = { ...existingManifest?.files ?? {} };
|
|
497
|
-
const nextSkillFiles = new Set(existingManifest?.skillFiles ?? []);
|
|
498
|
-
const desiredSkillFiles = new Set(plan.desiredSkillFiles);
|
|
499
|
-
const conflictFiles = [];
|
|
500
|
-
mkdirSync(targetDir, { recursive: true });
|
|
501
|
-
for (const action of plan.actions) {
|
|
502
|
-
applyAction({
|
|
503
|
-
targetDir,
|
|
504
|
-
plan,
|
|
505
|
-
action,
|
|
506
|
-
nextFiles,
|
|
507
|
-
conflictFiles
|
|
508
|
-
});
|
|
509
|
-
if (desiredSkillFiles.has(action.relativePath) && (action.type === "create" || action.type === "update" || action.type === "generate" || action.type === "noop")) {
|
|
510
|
-
nextSkillFiles.add(action.relativePath);
|
|
511
|
-
if (!options.trackSkillFilesInManifestFiles) {
|
|
512
|
-
delete nextFiles[action.relativePath];
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
if (action.type === "remove-managed") {
|
|
516
|
-
nextSkillFiles.delete(action.relativePath);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
const manifest = createManifest(
|
|
520
|
-
{
|
|
521
|
-
name: plan.packageName,
|
|
522
|
-
version: plan.packageVersion
|
|
523
|
-
},
|
|
524
|
-
plan.profile,
|
|
525
|
-
nextFiles,
|
|
526
|
-
Array.from(nextSkillFiles).sort()
|
|
527
|
-
);
|
|
528
|
-
writeManifest(targetDir, manifest);
|
|
529
|
-
return {
|
|
530
|
-
manifest,
|
|
531
|
-
appliedActions: plan.actions,
|
|
532
|
-
conflictFiles
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
function applyAction(options) {
|
|
536
|
-
const { targetDir, plan, action, nextFiles, conflictFiles } = options;
|
|
537
|
-
const absolutePath = relativePathToTarget(targetDir, action.relativePath);
|
|
538
|
-
const desiredEntry = plan.desiredFiles[action.relativePath];
|
|
539
|
-
switch (action.type) {
|
|
540
|
-
case "create":
|
|
541
|
-
case "update":
|
|
542
|
-
case "generate": {
|
|
543
|
-
if (typeof action.content !== "string" || !desiredEntry) {
|
|
544
|
-
throw new Error(`Missing content for ${action.type} action on ${action.relativePath}.`);
|
|
545
|
-
}
|
|
546
|
-
writeTextFile(absolutePath, action.content);
|
|
547
|
-
nextFiles[action.relativePath] = desiredEntry;
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
case "update-conflict": {
|
|
551
|
-
if (typeof action.content !== "string") {
|
|
552
|
-
throw new Error(`Missing content for ${action.type} action on ${action.relativePath}.`);
|
|
553
|
-
}
|
|
554
|
-
writeTextFile(absolutePath, action.content);
|
|
555
|
-
delete nextFiles[action.relativePath];
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
case "noop": {
|
|
559
|
-
if (desiredEntry) {
|
|
560
|
-
nextFiles[action.relativePath] = desiredEntry;
|
|
561
|
-
}
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
case "skip": {
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
case "remove-managed": {
|
|
568
|
-
if (existsSync2(absolutePath)) {
|
|
569
|
-
rmSync(absolutePath, { force: true });
|
|
570
|
-
pruneEmptyDirectories(path2.dirname(absolutePath), targetDir);
|
|
571
|
-
}
|
|
572
|
-
delete nextFiles[action.relativePath];
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
case "skip-conflict": {
|
|
576
|
-
if (typeof action.content === "string" && plan.conflictsRunId) {
|
|
577
|
-
const conflictPath = path2.join(
|
|
578
|
-
targetDir,
|
|
579
|
-
CONFLICTS_RELATIVE_DIR,
|
|
580
|
-
plan.conflictsRunId,
|
|
581
|
-
toConflictRelativePath(action.relativePath)
|
|
582
|
-
);
|
|
583
|
-
ensureParentDir(conflictPath);
|
|
584
|
-
writeTextFile(conflictPath, action.content);
|
|
585
|
-
conflictFiles.push(conflictPath);
|
|
586
|
-
}
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
default: {
|
|
590
|
-
const exhaustiveCheck = action.type;
|
|
591
|
-
throw new Error(`Unhandled action type: ${exhaustiveCheck}`);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
function compareReviewableManagedFileConflicts(left, right) {
|
|
596
|
-
const leftGroup = MANAGED_FILE_CONFLICT_GROUP_ORDER[left.group];
|
|
597
|
-
const rightGroup = MANAGED_FILE_CONFLICT_GROUP_ORDER[right.group];
|
|
598
|
-
return leftGroup - rightGroup || left.relativePath.localeCompare(right.relativePath);
|
|
599
|
-
}
|
|
600
|
-
var MANAGED_FILE_CONFLICT_GROUP_ORDER = {
|
|
601
|
-
"agent-instructions": 0,
|
|
602
|
-
references: 1,
|
|
603
|
-
templates: 2,
|
|
604
|
-
prompts: 3,
|
|
605
|
-
skills: 4,
|
|
606
|
-
"managed-files": 5
|
|
607
|
-
};
|
|
608
|
-
function toConflictRelativePath(relativePath) {
|
|
609
|
-
const segments = relativePath.split(/[/\\]+/).filter(Boolean);
|
|
610
|
-
const safeSegments = segments.filter((segment) => segment !== "." && segment !== "..");
|
|
611
|
-
if (path2.isAbsolute(relativePath)) {
|
|
612
|
-
const [first, ...rest] = safeSegments;
|
|
613
|
-
const drive = first?.replace(/:$/, "");
|
|
614
|
-
return path2.join("__absolute__", ...drive ? [drive, ...rest] : rest);
|
|
615
|
-
}
|
|
616
|
-
return path2.join(...safeSegments);
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
export {
|
|
620
|
-
planInstall,
|
|
621
|
-
planSkillsOnlyInstall,
|
|
622
|
-
findReviewableManagedFileConflicts,
|
|
623
|
-
applyInstallPlan,
|
|
624
|
-
applySkillsOnlyInstallPlan
|
|
625
|
-
};
|
|
626
|
-
//# sourceMappingURL=chunk-HP3HBG7F.js.map
|