@solaqua/skul 0.1.0
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 +15 -0
- package/README.md +282 -0
- package/bin/skul.js +13 -0
- package/dist/bundle-discovery.d.ts +30 -0
- package/dist/bundle-discovery.js +284 -0
- package/dist/bundle-discovery.js.map +1 -0
- package/dist/bundle-fetch.d.ts +67 -0
- package/dist/bundle-fetch.js +378 -0
- package/dist/bundle-fetch.js.map +1 -0
- package/dist/bundle-items.d.ts +34 -0
- package/dist/bundle-items.js +149 -0
- package/dist/bundle-items.js.map +1 -0
- package/dist/bundle-manifest.d.ts +26 -0
- package/dist/bundle-manifest.js +196 -0
- package/dist/bundle-manifest.js.map +1 -0
- package/dist/bundle-materialization.d.ts +52 -0
- package/dist/bundle-materialization.js +587 -0
- package/dist/bundle-materialization.js.map +1 -0
- package/dist/bundle-translation.d.ts +38 -0
- package/dist/bundle-translation.js +502 -0
- package/dist/bundle-translation.js.map +1 -0
- package/dist/cli.d.ts +126 -0
- package/dist/cli.js +648 -0
- package/dist/cli.js.map +1 -0
- package/dist/fs-utils.d.ts +7 -0
- package/dist/fs-utils.js +27 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/git-context.d.ts +14 -0
- package/dist/git-context.js +53 -0
- package/dist/git-context.js.map +1 -0
- package/dist/git-exclude.d.ts +13 -0
- package/dist/git-exclude.js +76 -0
- package/dist/git-exclude.js.map +1 -0
- package/dist/git-index.d.ts +106 -0
- package/dist/git-index.js +224 -0
- package/dist/git-index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +4190 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +91 -0
- package/dist/registry.js +551 -0
- package/dist/registry.js.map +1 -0
- package/dist/root-instruction-content.d.ts +11 -0
- package/dist/root-instruction-content.js +61 -0
- package/dist/root-instruction-content.js.map +1 -0
- package/dist/root-instruction-render.d.ts +31 -0
- package/dist/root-instruction-render.js +121 -0
- package/dist/root-instruction-render.js.map +1 -0
- package/dist/root-instruction-state.d.ts +41 -0
- package/dist/root-instruction-state.js +273 -0
- package/dist/root-instruction-state.js.map +1 -0
- package/dist/state-layout.d.ts +11 -0
- package/dist/state-layout.js +26 -0
- package/dist/state-layout.js.map +1 -0
- package/dist/tool-mapping.d.ts +35 -0
- package/dist/tool-mapping.js +227 -0
- package/dist/tool-mapping.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.previewMaterializeBundleWriteTargets = previewMaterializeBundleWriteTargets;
|
|
7
|
+
exports.materializeBundle = materializeBundle;
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const bundle_items_1 = require("./bundle-items");
|
|
11
|
+
const bundle_translation_1 = require("./bundle-translation");
|
|
12
|
+
const fs_utils_1 = require("./fs-utils");
|
|
13
|
+
const root_instruction_content_1 = require("./root-instruction-content");
|
|
14
|
+
const root_instruction_render_1 = require("./root-instruction-render");
|
|
15
|
+
const tool_mapping_1 = require("./tool-mapping");
|
|
16
|
+
/**
|
|
17
|
+
* Predicts the initial repo-relative files a bundle targets before any
|
|
18
|
+
* conflict-resolution overwrites are applied.
|
|
19
|
+
*
|
|
20
|
+
* This is a side-effect-free preview used by higher-level safety checks such as
|
|
21
|
+
* root-instruction shadow protection, where Skul needs to know the exact
|
|
22
|
+
* root-instruction targets before it removes existing managed files or writes
|
|
23
|
+
* new content.
|
|
24
|
+
*/
|
|
25
|
+
function previewMaterializeBundleWriteTargets(options) {
|
|
26
|
+
const writeTargets = new Set();
|
|
27
|
+
const pathLayout = options.pathLayout ?? tool_mapping_1.PROJECT_TOOL_MATERIALIZATION_LAYOUT;
|
|
28
|
+
const toolEntries = options.tools && options.tools.length > 0
|
|
29
|
+
? Object.entries(options.manifest.tools).filter(([toolName]) => options.tools.includes(toolName))
|
|
30
|
+
: Object.entries(options.manifest.tools);
|
|
31
|
+
for (const [toolName, targets] of toolEntries) {
|
|
32
|
+
for (const [targetName, target] of Object.entries(targets)) {
|
|
33
|
+
const targetDefinition = (0, tool_mapping_1.getToolDefinition)(toolName)?.targets[targetName];
|
|
34
|
+
if (targetDefinition?.kind === "file") {
|
|
35
|
+
if (!(0, bundle_items_1.isRootInstructionItemSelected)(options.itemSelectors)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
for (const repoRelativePath of previewRootInstructionWriteTargets({
|
|
39
|
+
bundleDir: options.bundleDir,
|
|
40
|
+
sourcePath: target.path,
|
|
41
|
+
toolName: toolName,
|
|
42
|
+
targetName: targetName,
|
|
43
|
+
pathLayout,
|
|
44
|
+
})) {
|
|
45
|
+
writeTargets.add(repoRelativePath);
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (isNativeSourcePath(toolName, targetName, target.path)) {
|
|
50
|
+
const sourceDir = node_path_1.default.join(options.bundleDir, target.path);
|
|
51
|
+
const destinationDir = pathLayout.resolveToolTargetPath(toolName, targetName, options.repoRoot);
|
|
52
|
+
if (!destinationDir) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
assertBundleTargetDirectory(sourceDir, target.path);
|
|
56
|
+
for (const relativePath of listRelativeFiles(sourceDir)) {
|
|
57
|
+
if (!(0, bundle_items_1.isDirectoryItemSelected)({
|
|
58
|
+
selectors: options.itemSelectors,
|
|
59
|
+
targetName: targetName,
|
|
60
|
+
entryName: relativePath.split(node_path_1.default.sep)[0] ?? relativePath,
|
|
61
|
+
})) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
writeTargets.add(node_path_1.default.relative(options.repoRoot, node_path_1.default.join(destinationDir, relativePath)));
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
for (const repoRelativePath of previewCanonicalTargetWriteTargets({
|
|
69
|
+
bundleDir: options.bundleDir,
|
|
70
|
+
sourcePath: target.path,
|
|
71
|
+
toolName: toolName,
|
|
72
|
+
targetName: targetName,
|
|
73
|
+
itemSelectors: options.itemSelectors,
|
|
74
|
+
pathLayout,
|
|
75
|
+
disableModelInvocation: options.disableModelInvocation,
|
|
76
|
+
})) {
|
|
77
|
+
writeTargets.add(repoRelativePath);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Array.from(writeTargets).sort((left, right) => left.localeCompare(right));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Materializes a bundle into the repository, returning the files and
|
|
85
|
+
* directories that became owned by each tool.
|
|
86
|
+
*
|
|
87
|
+
* Callers may optionally provide `assertSafeWriteTarget` to veto individual
|
|
88
|
+
* writes before they happen and `resolveFileConflict` to overwrite or abort
|
|
89
|
+
* colliding outputs.
|
|
90
|
+
*/
|
|
91
|
+
async function materializeBundle(options) {
|
|
92
|
+
const byTool = {};
|
|
93
|
+
const writtenSharedFileTargets = new Set();
|
|
94
|
+
const pathLayout = options.pathLayout ?? tool_mapping_1.PROJECT_TOOL_MATERIALIZATION_LAYOUT;
|
|
95
|
+
const toolEntries = options.tools && options.tools.length > 0
|
|
96
|
+
? Object.entries(options.manifest.tools).filter(([toolName]) => options.tools.includes(toolName))
|
|
97
|
+
: Object.entries(options.manifest.tools);
|
|
98
|
+
const composedRootInstructionContents = (0, bundle_items_1.isRootInstructionItemSelected)(options.itemSelectors)
|
|
99
|
+
? (0, root_instruction_content_1.collectComposedRootInstructionContents)({
|
|
100
|
+
bundleDir: options.bundleDir,
|
|
101
|
+
manifest: options.manifest,
|
|
102
|
+
toolNames: toolEntries
|
|
103
|
+
.filter(([toolName, targets]) => Object.keys(targets).some((targetName) => (0, tool_mapping_1.getToolDefinition)(toolName)?.targets[targetName]?.kind === "file"))
|
|
104
|
+
.map(([toolName]) => toolName),
|
|
105
|
+
})
|
|
106
|
+
: {};
|
|
107
|
+
for (const [toolName, targets] of toolEntries) {
|
|
108
|
+
const toolFiles = [];
|
|
109
|
+
const toolDirectories = new Set();
|
|
110
|
+
for (const [targetName, target] of Object.entries(targets)) {
|
|
111
|
+
const targetDefinition = (0, tool_mapping_1.getToolDefinition)(toolName)?.targets[targetName];
|
|
112
|
+
if (targetDefinition?.kind === "file") {
|
|
113
|
+
if (!(0, bundle_items_1.isRootInstructionItemSelected)(options.itemSelectors)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
await materializeRootInstructionTarget({
|
|
117
|
+
bundleDir: options.bundleDir,
|
|
118
|
+
sourcePath: target.path,
|
|
119
|
+
toolName: toolName,
|
|
120
|
+
targetName: targetName,
|
|
121
|
+
repoRoot: options.repoRoot,
|
|
122
|
+
writtenFiles: toolFiles,
|
|
123
|
+
ownedDirectories: toolDirectories,
|
|
124
|
+
assertSafeWriteTarget: options.assertSafeWriteTarget,
|
|
125
|
+
allowFileOverwriteTargets: options.allowFileOverwriteTargets,
|
|
126
|
+
deferredWriteTargets: options.deferredWriteTargets,
|
|
127
|
+
composedRootInstructionContents,
|
|
128
|
+
writtenSharedFileTargets,
|
|
129
|
+
rootInstructionBaseContents: options.rootInstructionBaseContents,
|
|
130
|
+
bundleName: options.bundleName ?? options.manifest.name ?? "bundle",
|
|
131
|
+
bundleSource: options.bundleSource,
|
|
132
|
+
resolveFileConflict: options.resolveFileConflict,
|
|
133
|
+
pathLayout,
|
|
134
|
+
});
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (isNativeSourcePath(toolName, targetName, target.path)) {
|
|
138
|
+
// Native dotdir path: raw copy verbatim into the tool's target directory.
|
|
139
|
+
const reservedDestinations = new Set();
|
|
140
|
+
const sourceDir = node_path_1.default.join(options.bundleDir, target.path);
|
|
141
|
+
const destinationDir = pathLayout.resolveToolTargetPath(toolName, targetName, options.repoRoot);
|
|
142
|
+
if (!destinationDir) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const destinationDirExisted = node_fs_1.default.existsSync(destinationDir);
|
|
146
|
+
assertBundleTargetDirectory(sourceDir, target.path);
|
|
147
|
+
node_fs_1.default.mkdirSync(destinationDir, { recursive: true });
|
|
148
|
+
if (!destinationDirExisted) {
|
|
149
|
+
toolDirectories.add(node_path_1.default.relative(options.repoRoot, destinationDir));
|
|
150
|
+
}
|
|
151
|
+
await copyDirectory(sourceDir, destinationDir, destinationDir, toolFiles, toolDirectories, reservedDestinations, options.repoRoot, options.assertSafeWriteTarget, options.resolveFileConflict, options.itemSelectors
|
|
152
|
+
? {
|
|
153
|
+
targetName: targetName,
|
|
154
|
+
selectors: options.itemSelectors,
|
|
155
|
+
sourceRoot: sourceDir,
|
|
156
|
+
}
|
|
157
|
+
: undefined);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// Canonical path: apply cross-tool content transforms via bundle-translation.
|
|
161
|
+
await materializeCanonicalTarget({
|
|
162
|
+
bundleDir: options.bundleDir,
|
|
163
|
+
sourcePath: target.path,
|
|
164
|
+
toolName: toolName,
|
|
165
|
+
targetName: targetName,
|
|
166
|
+
repoRoot: options.repoRoot,
|
|
167
|
+
writtenFiles: toolFiles,
|
|
168
|
+
ownedDirectories: toolDirectories,
|
|
169
|
+
assertSafeWriteTarget: options.assertSafeWriteTarget,
|
|
170
|
+
resolveFileConflict: options.resolveFileConflict,
|
|
171
|
+
itemSelectors: options.itemSelectors,
|
|
172
|
+
pathLayout,
|
|
173
|
+
disableModelInvocation: options.disableModelInvocation,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
toolFiles.sort((left, right) => {
|
|
178
|
+
const depthDifference = (0, fs_utils_1.pathDepth)(left) - (0, fs_utils_1.pathDepth)(right);
|
|
179
|
+
return depthDifference !== 0
|
|
180
|
+
? depthDifference
|
|
181
|
+
: left.localeCompare(right);
|
|
182
|
+
});
|
|
183
|
+
const sortedToolDirs = Array.from(toolDirectories).sort((left, right) => {
|
|
184
|
+
const depthDifference = (0, fs_utils_1.pathDepth)(right) - (0, fs_utils_1.pathDepth)(left);
|
|
185
|
+
return depthDifference !== 0
|
|
186
|
+
? depthDifference
|
|
187
|
+
: left.localeCompare(right);
|
|
188
|
+
});
|
|
189
|
+
byTool[toolName] = {
|
|
190
|
+
files: toolFiles,
|
|
191
|
+
directories: sortedToolDirs,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return { byTool };
|
|
195
|
+
}
|
|
196
|
+
async function materializeRootInstructionTarget(options) {
|
|
197
|
+
if (options.targetName !== "root_instruction") {
|
|
198
|
+
throw new Error(`Unsupported file target: ${options.targetName}`);
|
|
199
|
+
}
|
|
200
|
+
const translatedContentByPath = readTranslatedRootInstructionTargets({
|
|
201
|
+
bundleDir: options.bundleDir,
|
|
202
|
+
sourcePath: options.sourcePath,
|
|
203
|
+
toolName: options.toolName,
|
|
204
|
+
});
|
|
205
|
+
for (const [origRelPath, content] of Object.entries(translatedContentByPath)) {
|
|
206
|
+
const repoRelPath = options.pathLayout.remapRepoRelPath(options.toolName, origRelPath);
|
|
207
|
+
if (options.writtenSharedFileTargets.has(repoRelPath)) {
|
|
208
|
+
options.writtenFiles.push(repoRelPath);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (options.deferredWriteTargets?.has(repoRelPath)) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
await writeTranslatedFile({
|
|
215
|
+
repoRelPath,
|
|
216
|
+
content: renderRootInstructionDocument({
|
|
217
|
+
repoRoot: options.repoRoot,
|
|
218
|
+
repoRelPath,
|
|
219
|
+
rootInstructionBaseContents: options.rootInstructionBaseContents,
|
|
220
|
+
bundleName: options.bundleName,
|
|
221
|
+
bundleSource: options.bundleSource,
|
|
222
|
+
composedContent: options.composedRootInstructionContents[origRelPath] ?? content,
|
|
223
|
+
}),
|
|
224
|
+
repoRoot: options.repoRoot,
|
|
225
|
+
writtenFiles: options.writtenFiles,
|
|
226
|
+
ownedDirectories: options.ownedDirectories,
|
|
227
|
+
reservedDestinations: new Set(),
|
|
228
|
+
assertSafeWriteTarget: options.assertSafeWriteTarget,
|
|
229
|
+
allowExistingFileOverwrite: true,
|
|
230
|
+
resolveFileConflict: options.resolveFileConflict,
|
|
231
|
+
targetRoot: "",
|
|
232
|
+
});
|
|
233
|
+
options.writtenSharedFileTargets.add(repoRelPath);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function readTranslatedRootInstructionTargets(options) {
|
|
237
|
+
const sourceFile = node_path_1.default.join(options.bundleDir, options.sourcePath);
|
|
238
|
+
assertBundleTargetFile(sourceFile, options.sourcePath);
|
|
239
|
+
return (0, bundle_translation_1.translateRootInstruction)({
|
|
240
|
+
targetTool: (0, bundle_translation_1.toTranslationToolName)(options.toolName),
|
|
241
|
+
source: node_fs_1.default.readFileSync(sourceFile, "utf8"),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function renderRootInstructionDocument(options) {
|
|
245
|
+
return ensureTrailingNewline((0, root_instruction_render_1.composeRootInstructionContent)([
|
|
246
|
+
options.rootInstructionBaseContents?.[options.repoRelPath] ??
|
|
247
|
+
readExistingRootInstructionBaseContent(options.repoRoot, options.repoRelPath),
|
|
248
|
+
(0, root_instruction_render_1.wrapRootInstructionBundleContent)({
|
|
249
|
+
bundleName: options.bundleName,
|
|
250
|
+
source: options.bundleSource,
|
|
251
|
+
content: options.composedContent,
|
|
252
|
+
}),
|
|
253
|
+
]));
|
|
254
|
+
}
|
|
255
|
+
async function copyDirectory(sourceDir, destinationDir, targetRoot, writtenFiles, ownedDirectories, reservedDestinations, repoRoot, assertSafeWriteTarget, resolveFileConflict, itemFilter) {
|
|
256
|
+
for (const entry of node_fs_1.default.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
257
|
+
assertNotSymlink(entry, sourceDir);
|
|
258
|
+
const sourcePath = node_path_1.default.join(sourceDir, entry.name);
|
|
259
|
+
const destinationPath = node_path_1.default.join(destinationDir, entry.name);
|
|
260
|
+
const relativeSourcePath = node_path_1.default.relative(itemFilter?.sourceRoot ?? sourceDir, sourcePath);
|
|
261
|
+
const topLevelEntryName = relativeSourcePath.split(node_path_1.default.sep)[0] ?? entry.name;
|
|
262
|
+
if (itemFilter &&
|
|
263
|
+
!(0, bundle_items_1.isDirectoryItemSelected)({
|
|
264
|
+
selectors: itemFilter.selectors,
|
|
265
|
+
targetName: itemFilter.targetName,
|
|
266
|
+
entryName: topLevelEntryName,
|
|
267
|
+
})) {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (entry.isDirectory()) {
|
|
271
|
+
await copyDirectory(sourcePath, destinationPath, targetRoot, writtenFiles, ownedDirectories, reservedDestinations, repoRoot, assertSafeWriteTarget, resolveFileConflict, itemFilter);
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (entry.isFile()) {
|
|
275
|
+
const finalDestinationPath = await resolveDestinationPath({
|
|
276
|
+
destinationPath,
|
|
277
|
+
targetRoot,
|
|
278
|
+
reservedDestinations,
|
|
279
|
+
resolveFileConflict,
|
|
280
|
+
});
|
|
281
|
+
ensureOwnedParentDirectories(node_path_1.default.dirname(finalDestinationPath), targetRoot, ownedDirectories, repoRoot);
|
|
282
|
+
assertSafeWriteTarget?.(node_path_1.default.relative(repoRoot, finalDestinationPath));
|
|
283
|
+
node_fs_1.default.copyFileSync(sourcePath, finalDestinationPath);
|
|
284
|
+
reservedDestinations.add(node_path_1.default
|
|
285
|
+
.relative(targetRoot, finalDestinationPath)
|
|
286
|
+
.split(node_path_1.default.sep)
|
|
287
|
+
.join("/"));
|
|
288
|
+
writtenFiles.push(node_path_1.default.relative(repoRoot, finalDestinationPath));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
async function resolveDestinationPath(options) {
|
|
293
|
+
const relativePath = node_path_1.default
|
|
294
|
+
.relative(options.targetRoot, options.destinationPath)
|
|
295
|
+
.split(node_path_1.default.sep)
|
|
296
|
+
.join("/");
|
|
297
|
+
if (options.reservedDestinations.has(relativePath)) {
|
|
298
|
+
throw new Error(`Conflict detected: ${relativePath}`);
|
|
299
|
+
}
|
|
300
|
+
if (!node_fs_1.default.existsSync(options.destinationPath)) {
|
|
301
|
+
return options.destinationPath;
|
|
302
|
+
}
|
|
303
|
+
if (!options.resolveFileConflict) {
|
|
304
|
+
throw new Error(`Conflict detected: ${relativePath}`);
|
|
305
|
+
}
|
|
306
|
+
await options.resolveFileConflict(relativePath);
|
|
307
|
+
return options.destinationPath;
|
|
308
|
+
}
|
|
309
|
+
function ensureOwnedParentDirectories(directoryPath, targetRoot, ownedDirectories, repoRoot) {
|
|
310
|
+
if (directoryPath === targetRoot) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const missingDirectories = [];
|
|
314
|
+
let currentPath = directoryPath;
|
|
315
|
+
while (currentPath !== targetRoot && !node_fs_1.default.existsSync(currentPath)) {
|
|
316
|
+
missingDirectories.push(currentPath);
|
|
317
|
+
currentPath = node_path_1.default.dirname(currentPath);
|
|
318
|
+
}
|
|
319
|
+
node_fs_1.default.mkdirSync(directoryPath, { recursive: true });
|
|
320
|
+
for (const missingDirectory of missingDirectories) {
|
|
321
|
+
ownedDirectories.add(node_path_1.default.relative(repoRoot, missingDirectory));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function listRelativeFiles(sourceDir, prefix = "") {
|
|
325
|
+
const relativeFiles = [];
|
|
326
|
+
for (const entry of node_fs_1.default.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
327
|
+
assertNotSymlink(entry, sourceDir);
|
|
328
|
+
const sourcePath = node_path_1.default.join(sourceDir, entry.name);
|
|
329
|
+
const relativePath = prefix ? node_path_1.default.join(prefix, entry.name) : entry.name;
|
|
330
|
+
if (entry.isDirectory()) {
|
|
331
|
+
relativeFiles.push(...listRelativeFiles(sourcePath, relativePath));
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
if (entry.isFile()) {
|
|
335
|
+
relativeFiles.push(relativePath);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return relativeFiles;
|
|
339
|
+
}
|
|
340
|
+
function assertNotSymlink(entry, parentDir) {
|
|
341
|
+
if (entry.isSymbolicLink()) {
|
|
342
|
+
throw new Error(`Bundle contains a symlink which is not allowed: ${node_path_1.default.join(parentDir, entry.name)}`);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function isNativeSourcePath(toolName, targetName, sourcePath) {
|
|
346
|
+
const nativePath = (0, tool_mapping_1.getToolDefinition)(toolName)?.targets[targetName]?.path;
|
|
347
|
+
return (!!nativePath &&
|
|
348
|
+
(sourcePath === nativePath || sourcePath.startsWith(`${nativePath}/`)));
|
|
349
|
+
}
|
|
350
|
+
function readFilesIntoRecord(dir, prefix, result) {
|
|
351
|
+
for (const entry of node_fs_1.default.readdirSync(dir, { withFileTypes: true })) {
|
|
352
|
+
assertNotSymlink(entry, dir);
|
|
353
|
+
const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
354
|
+
const fullPath = node_path_1.default.join(dir, entry.name);
|
|
355
|
+
if (entry.isDirectory()) {
|
|
356
|
+
readFilesIntoRecord(fullPath, relPath, result);
|
|
357
|
+
}
|
|
358
|
+
else if (entry.isFile()) {
|
|
359
|
+
result[relPath] = node_fs_1.default.readFileSync(fullPath, "utf8");
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
async function materializeCanonicalTarget(options) {
|
|
364
|
+
const sourceDir = node_path_1.default.join(options.bundleDir, options.sourcePath);
|
|
365
|
+
assertBundleTargetDirectory(sourceDir, options.sourcePath);
|
|
366
|
+
const translTool = (0, bundle_translation_1.toTranslationToolName)(options.toolName);
|
|
367
|
+
const reservedDestinations = new Set();
|
|
368
|
+
for (const entry of node_fs_1.default.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
369
|
+
assertNotSymlink(entry, sourceDir);
|
|
370
|
+
if (!(0, bundle_items_1.isDirectoryItemSelected)({
|
|
371
|
+
selectors: options.itemSelectors,
|
|
372
|
+
targetName: options.targetName,
|
|
373
|
+
entryName: entry.name,
|
|
374
|
+
})) {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
let translated;
|
|
378
|
+
if (options.targetName === "skills") {
|
|
379
|
+
if (!entry.isDirectory())
|
|
380
|
+
continue;
|
|
381
|
+
const skillDir = node_path_1.default.join(sourceDir, entry.name);
|
|
382
|
+
const files = {};
|
|
383
|
+
readFilesIntoRecord(skillDir, "", files);
|
|
384
|
+
translated = (0, bundle_translation_1.translateSkill)({
|
|
385
|
+
sourceTool: "claude",
|
|
386
|
+
targetTool: translTool,
|
|
387
|
+
files,
|
|
388
|
+
options: options.disableModelInvocation
|
|
389
|
+
? { disableModelInvocation: true }
|
|
390
|
+
: undefined,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
else if (options.targetName === "commands") {
|
|
394
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
395
|
+
continue;
|
|
396
|
+
const commandName = entry.name.slice(0, -3);
|
|
397
|
+
const content = node_fs_1.default.readFileSync(node_path_1.default.join(sourceDir, entry.name), "utf8");
|
|
398
|
+
translated = (0, bundle_translation_1.translateCommand)({
|
|
399
|
+
sourceTool: "claude",
|
|
400
|
+
targetTool: translTool,
|
|
401
|
+
source: content,
|
|
402
|
+
options: { name: commandName },
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
else if (options.targetName === "agents") {
|
|
406
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
407
|
+
continue;
|
|
408
|
+
const content = node_fs_1.default.readFileSync(node_path_1.default.join(sourceDir, entry.name), "utf8");
|
|
409
|
+
translated = (0, bundle_translation_1.translateAgent)({
|
|
410
|
+
sourceTool: "claude",
|
|
411
|
+
targetTool: translTool,
|
|
412
|
+
source: content,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
for (const [origRelPath, content] of Object.entries(translated)) {
|
|
419
|
+
const repoRelPath = options.pathLayout.remapRepoRelPath(options.toolName, origRelPath);
|
|
420
|
+
const targetRoot = resolveDirectoryTargetRoot({
|
|
421
|
+
pathLayout: options.pathLayout,
|
|
422
|
+
toolName: options.toolName,
|
|
423
|
+
targetName: options.targetName,
|
|
424
|
+
repoRoot: options.repoRoot,
|
|
425
|
+
});
|
|
426
|
+
await writeTranslatedFile({
|
|
427
|
+
repoRelPath,
|
|
428
|
+
content,
|
|
429
|
+
repoRoot: options.repoRoot,
|
|
430
|
+
writtenFiles: options.writtenFiles,
|
|
431
|
+
ownedDirectories: options.ownedDirectories,
|
|
432
|
+
reservedDestinations,
|
|
433
|
+
assertSafeWriteTarget: options.assertSafeWriteTarget,
|
|
434
|
+
resolveFileConflict: options.resolveFileConflict,
|
|
435
|
+
targetRoot,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
function readExistingRootInstructionBaseContent(repoRoot, repoRelPath) {
|
|
441
|
+
const targetPath = node_path_1.default.join(repoRoot, repoRelPath);
|
|
442
|
+
if (!node_fs_1.default.existsSync(targetPath)) {
|
|
443
|
+
return undefined;
|
|
444
|
+
}
|
|
445
|
+
return node_fs_1.default.readFileSync(targetPath, "utf8");
|
|
446
|
+
}
|
|
447
|
+
function previewCanonicalTargetWriteTargets(options) {
|
|
448
|
+
const sourceDir = node_path_1.default.join(options.bundleDir, options.sourcePath);
|
|
449
|
+
assertBundleTargetDirectory(sourceDir, options.sourcePath);
|
|
450
|
+
const translTool = (0, bundle_translation_1.toTranslationToolName)(options.toolName);
|
|
451
|
+
const writeTargets = [];
|
|
452
|
+
for (const entry of node_fs_1.default.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
453
|
+
assertNotSymlink(entry, sourceDir);
|
|
454
|
+
if (!(0, bundle_items_1.isDirectoryItemSelected)({
|
|
455
|
+
selectors: options.itemSelectors,
|
|
456
|
+
targetName: options.targetName,
|
|
457
|
+
entryName: entry.name,
|
|
458
|
+
})) {
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
let translated;
|
|
462
|
+
if (options.targetName === "skills") {
|
|
463
|
+
if (!entry.isDirectory())
|
|
464
|
+
continue;
|
|
465
|
+
const skillDir = node_path_1.default.join(sourceDir, entry.name);
|
|
466
|
+
const files = {};
|
|
467
|
+
readFilesIntoRecord(skillDir, "", files);
|
|
468
|
+
translated = (0, bundle_translation_1.translateSkill)({
|
|
469
|
+
sourceTool: "claude",
|
|
470
|
+
targetTool: translTool,
|
|
471
|
+
files,
|
|
472
|
+
options: options.disableModelInvocation
|
|
473
|
+
? { disableModelInvocation: true }
|
|
474
|
+
: undefined,
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
else if (options.targetName === "commands") {
|
|
478
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
479
|
+
continue;
|
|
480
|
+
const commandName = entry.name.slice(0, -3);
|
|
481
|
+
const content = node_fs_1.default.readFileSync(node_path_1.default.join(sourceDir, entry.name), "utf8");
|
|
482
|
+
translated = (0, bundle_translation_1.translateCommand)({
|
|
483
|
+
sourceTool: "claude",
|
|
484
|
+
targetTool: translTool,
|
|
485
|
+
source: content,
|
|
486
|
+
options: { name: commandName },
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
else if (options.targetName === "agents") {
|
|
490
|
+
if (!entry.isFile() || !entry.name.endsWith(".md"))
|
|
491
|
+
continue;
|
|
492
|
+
const content = node_fs_1.default.readFileSync(node_path_1.default.join(sourceDir, entry.name), "utf8");
|
|
493
|
+
translated = (0, bundle_translation_1.translateAgent)({
|
|
494
|
+
sourceTool: "claude",
|
|
495
|
+
targetTool: translTool,
|
|
496
|
+
source: content,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
writeTargets.push(...Object.keys(translated).map((repoRelPath) => options.pathLayout.remapRepoRelPath(options.toolName, repoRelPath)));
|
|
503
|
+
}
|
|
504
|
+
return writeTargets;
|
|
505
|
+
}
|
|
506
|
+
function previewRootInstructionWriteTargets(options) {
|
|
507
|
+
if (options.targetName !== "root_instruction") {
|
|
508
|
+
throw new Error(`Unsupported file target: ${options.targetName}`);
|
|
509
|
+
}
|
|
510
|
+
return Object.keys(readTranslatedRootInstructionTargets(options)).map((p) => options.pathLayout.remapRepoRelPath(options.toolName, p));
|
|
511
|
+
}
|
|
512
|
+
function resolveDirectoryTargetRoot(options) {
|
|
513
|
+
const targetPath = options.pathLayout.resolveToolTargetPath(options.toolName, options.targetName, options.repoRoot);
|
|
514
|
+
if (!targetPath) {
|
|
515
|
+
throw new Error(`Tool ${options.toolName} does not support ${options.targetName}`);
|
|
516
|
+
}
|
|
517
|
+
return node_path_1.default.relative(options.repoRoot, targetPath).split(node_path_1.default.sep).join("/");
|
|
518
|
+
}
|
|
519
|
+
async function writeTranslatedFile(options) {
|
|
520
|
+
// Conflict resolution paths are expressed relative to the target root. Directory-based
|
|
521
|
+
// targets use the two-segment tool root (e.g. ".cursor/skills"); repo-root files use "".
|
|
522
|
+
const targetRoot = options.targetRoot ?? options.repoRelPath.split("/").slice(0, 2).join("/");
|
|
523
|
+
const targetRootAbsPath = node_path_1.default.join(options.repoRoot, ...targetRoot.split("/"));
|
|
524
|
+
const targetRootIsNew = !node_fs_1.default.existsSync(targetRootAbsPath);
|
|
525
|
+
const currentRepoRelPath = options.repoRelPath;
|
|
526
|
+
const currentAbsPath = node_path_1.default.join(options.repoRoot, ...currentRepoRelPath.split("/"));
|
|
527
|
+
const hasReserved = options.reservedDestinations.has(currentRepoRelPath);
|
|
528
|
+
const hasFilesystem = node_fs_1.default.existsSync(currentAbsPath);
|
|
529
|
+
if (hasReserved) {
|
|
530
|
+
throw new Error(`Conflict detected: ${currentRepoRelPath}`);
|
|
531
|
+
}
|
|
532
|
+
if (hasFilesystem && !options.allowExistingFileOverwrite) {
|
|
533
|
+
if (!options.resolveFileConflict) {
|
|
534
|
+
throw new Error(`Conflict detected: ${currentRepoRelPath}`);
|
|
535
|
+
}
|
|
536
|
+
const relWithinTarget = targetRoot === ""
|
|
537
|
+
? currentRepoRelPath
|
|
538
|
+
: currentRepoRelPath.substring(targetRoot.length + 1);
|
|
539
|
+
await options.resolveFileConflict(relWithinTarget);
|
|
540
|
+
}
|
|
541
|
+
const parentAbsDir = node_path_1.default.dirname(currentAbsPath);
|
|
542
|
+
const newDirs = [];
|
|
543
|
+
let current = parentAbsDir;
|
|
544
|
+
while (current !== targetRootAbsPath && !node_fs_1.default.existsSync(current)) {
|
|
545
|
+
newDirs.push(current);
|
|
546
|
+
current = node_path_1.default.dirname(current);
|
|
547
|
+
}
|
|
548
|
+
node_fs_1.default.mkdirSync(parentAbsDir, { recursive: true });
|
|
549
|
+
for (const dir of newDirs) {
|
|
550
|
+
options.ownedDirectories.add(node_path_1.default.relative(options.repoRoot, dir));
|
|
551
|
+
}
|
|
552
|
+
if (targetRoot !== "" && targetRootIsNew) {
|
|
553
|
+
options.ownedDirectories.add(node_path_1.default.relative(options.repoRoot, targetRootAbsPath));
|
|
554
|
+
}
|
|
555
|
+
options.assertSafeWriteTarget?.(currentRepoRelPath);
|
|
556
|
+
node_fs_1.default.writeFileSync(currentAbsPath, options.content);
|
|
557
|
+
options.reservedDestinations.add(currentRepoRelPath);
|
|
558
|
+
options.writtenFiles.push(currentRepoRelPath);
|
|
559
|
+
}
|
|
560
|
+
function assertBundleTargetDirectory(sourceDir, targetPath) {
|
|
561
|
+
if (!node_fs_1.default.existsSync(sourceDir)) {
|
|
562
|
+
throw new Error(`Bundle target path does not exist: ${targetPath}`);
|
|
563
|
+
}
|
|
564
|
+
const stat = node_fs_1.default.lstatSync(sourceDir);
|
|
565
|
+
if (stat.isSymbolicLink()) {
|
|
566
|
+
throw new Error(`Bundle target path must not be a symlink: ${targetPath}`);
|
|
567
|
+
}
|
|
568
|
+
if (!stat.isDirectory()) {
|
|
569
|
+
throw new Error(`Bundle target path must be a directory: ${targetPath}`);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
function ensureTrailingNewline(content) {
|
|
573
|
+
return content.endsWith("\n") ? content : `${content}\n`;
|
|
574
|
+
}
|
|
575
|
+
function assertBundleTargetFile(sourceFile, targetPath) {
|
|
576
|
+
if (!node_fs_1.default.existsSync(sourceFile)) {
|
|
577
|
+
throw new Error(`Bundle target path does not exist: ${targetPath}`);
|
|
578
|
+
}
|
|
579
|
+
const stat = node_fs_1.default.lstatSync(sourceFile);
|
|
580
|
+
if (stat.isSymbolicLink()) {
|
|
581
|
+
throw new Error(`Bundle target path must not be a symlink: ${targetPath}`);
|
|
582
|
+
}
|
|
583
|
+
if (!stat.isFile()) {
|
|
584
|
+
throw new Error(`Bundle target path must be a file: ${targetPath}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
//# sourceMappingURL=bundle-materialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-materialization.js","sourceRoot":"","sources":["../src/bundle-materialization.ts"],"names":[],"mappings":";;;;;AA2CA,oFAqGC;AAUD,8CAsKC;AAhUD,sDAAyB;AACzB,0DAA6B;AAC7B,iDAIwB;AAExB,6DAM8B;AAE9B,yCAAuC;AACvC,yEAAoF;AACpF,uEAGmC;AACnC,iDAMwB;AAMxB;;;;;;;;GAQG;AACH,SAAgB,oCAAoC,CAAC,OAQpD;IACC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,kDAAmC,CAAC;IAC7E,MAAM,WAAW,GACf,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CA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C,CAAC;IAErC,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,UAAU,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,UAAU,EAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAe;IAC5C,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC;AAC3D,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAkB,EAAE,UAAkB;IACpE,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAI,GAAG,iBAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEtC,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,UAAU,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ToolName } from "./tool-mapping";
|
|
2
|
+
type SkillTool = "claude" | "cursor" | "codex" | "opencode" | "copilot" | "kiro" | "antigravity";
|
|
3
|
+
type CommandTool = "claude" | "cursor" | "opencode" | "antigravity";
|
|
4
|
+
type AgentTool = "claude" | "cursor" | "codex" | "opencode" | "copilot" | "kiro";
|
|
5
|
+
type RootInstructionTool = "claude" | "cursor" | "codex" | "opencode" | "copilot" | "kiro" | "antigravity";
|
|
6
|
+
export interface BundleTranslationOptions {
|
|
7
|
+
name?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
disableModelInvocation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Translates a canonical skill bundle into one target tool's skill file layout. */
|
|
12
|
+
export declare function translateSkill(options: {
|
|
13
|
+
sourceTool: SkillTool;
|
|
14
|
+
targetTool: SkillTool;
|
|
15
|
+
files: Record<string, string>;
|
|
16
|
+
options?: BundleTranslationOptions;
|
|
17
|
+
}): Record<string, string>;
|
|
18
|
+
/** Translates a canonical command document into one target tool's command layout. */
|
|
19
|
+
export declare function translateCommand(options: {
|
|
20
|
+
sourceTool: CommandTool;
|
|
21
|
+
targetTool: CommandTool | "codex";
|
|
22
|
+
source: string;
|
|
23
|
+
options?: BundleTranslationOptions;
|
|
24
|
+
}): Record<string, string>;
|
|
25
|
+
/** Translates a canonical agent document into one target tool's agent layout. */
|
|
26
|
+
export declare function translateAgent(options: {
|
|
27
|
+
sourceTool: AgentTool;
|
|
28
|
+
targetTool: AgentTool;
|
|
29
|
+
source: string;
|
|
30
|
+
}): Record<string, string>;
|
|
31
|
+
/** Translates one root-instruction source into target-tool root files such as `AGENTS.md`. */
|
|
32
|
+
export declare function translateRootInstruction(options: {
|
|
33
|
+
targetTool: RootInstructionTool;
|
|
34
|
+
source: string;
|
|
35
|
+
}): Record<string, string>;
|
|
36
|
+
/** Maps a ToolName (e.g. "claude-code") to the internal translation name (e.g. "claude"). */
|
|
37
|
+
export declare function toTranslationToolName(toolName: ToolName): SkillTool;
|
|
38
|
+
export {};
|