@seasb/metafab 0.0.1 → 1.0.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/README.md +46 -1
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +317 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/build.js +70 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/check.d.ts +2 -0
- package/dist/commands/check.js +41 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/create.d.ts +2 -0
- package/dist/commands/create.js +74 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/detach.d.ts +2 -0
- package/dist/commands/detach.js +24 -0
- package/dist/commands/detach.js.map +1 -0
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.js +35 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/import.d.ts +2 -0
- package/dist/commands/import.js +107 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +77 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/map.d.ts +2 -0
- package/dist/commands/map.js +43 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/not-implemented.d.ts +2 -0
- package/dist/commands/not-implemented.js +19 -0
- package/dist/commands/not-implemented.js.map +1 -0
- package/dist/commands/pipeline-add.d.ts +2 -0
- package/dist/commands/pipeline-add.js +67 -0
- package/dist/commands/pipeline-add.js.map +1 -0
- package/dist/commands/pipeline-remove.d.ts +2 -0
- package/dist/commands/pipeline-remove.js +44 -0
- package/dist/commands/pipeline-remove.js.map +1 -0
- package/dist/commands/publish.d.ts +2 -0
- package/dist/commands/publish.js +147 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/types.d.ts +45 -0
- package/dist/commands/types.js +2 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +97 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/core/adopt.d.ts +53 -0
- package/dist/core/adopt.js +676 -0
- package/dist/core/adopt.js.map +1 -0
- package/dist/core/build/agents.d.ts +23 -0
- package/dist/core/build/agents.js +60 -0
- package/dist/core/build/agents.js.map +1 -0
- package/dist/core/build/index.d.ts +4 -0
- package/dist/core/build/index.js +5 -0
- package/dist/core/build/index.js.map +1 -0
- package/dist/core/build/markers.d.ts +34 -0
- package/dist/core/build/markers.js +97 -0
- package/dist/core/build/markers.js.map +1 -0
- package/dist/core/build/plan.d.ts +48 -0
- package/dist/core/build/plan.js +792 -0
- package/dist/core/build/plan.js.map +1 -0
- package/dist/core/build/skill.d.ts +60 -0
- package/dist/core/build/skill.js +275 -0
- package/dist/core/build/skill.js.map +1 -0
- package/dist/core/check/drift.d.ts +13 -0
- package/dist/core/check/drift.js +205 -0
- package/dist/core/check/drift.js.map +1 -0
- package/dist/core/check/index.d.ts +12 -0
- package/dist/core/check/index.js +78 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/markers.d.ts +9 -0
- package/dist/core/check/markers.js +220 -0
- package/dist/core/check/markers.js.map +1 -0
- package/dist/core/config/destinations.d.ts +5 -0
- package/dist/core/config/destinations.js +20 -0
- package/dist/core/config/destinations.js.map +1 -0
- package/dist/core/config/load.d.ts +4 -0
- package/dist/core/config/load.js +41 -0
- package/dist/core/config/load.js.map +1 -0
- package/dist/core/config/parse.d.ts +8 -0
- package/dist/core/config/parse.js +198 -0
- package/dist/core/config/parse.js.map +1 -0
- package/dist/core/config/source.d.ts +14 -0
- package/dist/core/config/source.js +44 -0
- package/dist/core/config/source.js.map +1 -0
- package/dist/core/config/types.d.ts +48 -0
- package/dist/core/config/types.js +2 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/config/validate.d.ts +11 -0
- package/dist/core/config/validate.js +351 -0
- package/dist/core/config/validate.js.map +1 -0
- package/dist/core/config/writers.d.ts +14 -0
- package/dist/core/config/writers.js +261 -0
- package/dist/core/config/writers.js.map +1 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/config.js +8 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/discovery.d.ts +34 -0
- package/dist/core/discovery.js +272 -0
- package/dist/core/discovery.js.map +1 -0
- package/dist/core/edit/create.d.ts +18 -0
- package/dist/core/edit/create.js +190 -0
- package/dist/core/edit/create.js.map +1 -0
- package/dist/core/edit/document.d.ts +4 -0
- package/dist/core/edit/document.js +16 -0
- package/dist/core/edit/document.js.map +1 -0
- package/dist/core/edit/factory-yaml.d.ts +17 -0
- package/dist/core/edit/factory-yaml.js +211 -0
- package/dist/core/edit/factory-yaml.js.map +1 -0
- package/dist/core/edit/files.d.ts +6 -0
- package/dist/core/edit/files.js +47 -0
- package/dist/core/edit/files.js.map +1 -0
- package/dist/core/edit/index.d.ts +9 -0
- package/dist/core/edit/index.js +10 -0
- package/dist/core/edit/index.js.map +1 -0
- package/dist/core/edit/map.d.ts +24 -0
- package/dist/core/edit/map.js +82 -0
- package/dist/core/edit/map.js.map +1 -0
- package/dist/core/edit/names.d.ts +2 -0
- package/dist/core/edit/names.js +17 -0
- package/dist/core/edit/names.js.map +1 -0
- package/dist/core/edit/paths.d.ts +8 -0
- package/dist/core/edit/paths.js +76 -0
- package/dist/core/edit/paths.js.map +1 -0
- package/dist/core/edit/pipeline.d.ts +19 -0
- package/dist/core/edit/pipeline.js +146 -0
- package/dist/core/edit/pipeline.js.map +1 -0
- package/dist/core/edit/skill.d.ts +1 -0
- package/dist/core/edit/skill.js +10 -0
- package/dist/core/edit/skill.js.map +1 -0
- package/dist/core/factory/discovery.d.ts +9 -0
- package/dist/core/factory/discovery.js +139 -0
- package/dist/core/factory/discovery.js.map +1 -0
- package/dist/core/factory/factory-yaml.d.ts +16 -0
- package/dist/core/factory/factory-yaml.js +375 -0
- package/dist/core/factory/factory-yaml.js.map +1 -0
- package/dist/core/factory/index.d.ts +5 -0
- package/dist/core/factory/index.js +6 -0
- package/dist/core/factory/index.js.map +1 -0
- package/dist/core/factory/lines.d.ts +8 -0
- package/dist/core/factory/lines.js +11 -0
- package/dist/core/factory/lines.js.map +1 -0
- package/dist/core/factory/load.d.ts +4 -0
- package/dist/core/factory/load.js +81 -0
- package/dist/core/factory/load.js.map +1 -0
- package/dist/core/factory/requires.d.ts +9 -0
- package/dist/core/factory/requires.js +123 -0
- package/dist/core/factory/requires.js.map +1 -0
- package/dist/core/factory/types.d.ts +45 -0
- package/dist/core/factory/types.js +2 -0
- package/dist/core/factory/types.js.map +1 -0
- package/dist/core/factory/validate.d.ts +41 -0
- package/dist/core/factory/validate.js +441 -0
- package/dist/core/factory/validate.js.map +1 -0
- package/dist/core/hooks/index.d.ts +8 -0
- package/dist/core/hooks/index.js +15 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/script.d.ts +21 -0
- package/dist/core/hooks/script.js +34 -0
- package/dist/core/hooks/script.js.map +1 -0
- package/dist/core/hooks/sync.d.ts +17 -0
- package/dist/core/hooks/sync.js +262 -0
- package/dist/core/hooks/sync.js.map +1 -0
- package/dist/core/import/conflicts.d.ts +82 -0
- package/dist/core/import/conflicts.js +256 -0
- package/dist/core/import/conflicts.js.map +1 -0
- package/dist/core/import/copy.d.ts +10 -0
- package/dist/core/import/copy.js +76 -0
- package/dist/core/import/copy.js.map +1 -0
- package/dist/core/import/file-tree.d.ts +43 -0
- package/dist/core/import/file-tree.js +107 -0
- package/dist/core/import/file-tree.js.map +1 -0
- package/dist/core/import/index.d.ts +5 -0
- package/dist/core/import/index.js +6 -0
- package/dist/core/import/index.js.map +1 -0
- package/dist/core/import/pipeline-changes.d.ts +8 -0
- package/dist/core/import/pipeline-changes.js +89 -0
- package/dist/core/import/pipeline-changes.js.map +1 -0
- package/dist/core/import/run.d.ts +76 -0
- package/dist/core/import/run.js +258 -0
- package/dist/core/import/run.js.map +1 -0
- package/dist/core/init/gitattributes.d.ts +20 -0
- package/dist/core/init/gitattributes.js +89 -0
- package/dist/core/init/gitattributes.js.map +1 -0
- package/dist/core/init/index.d.ts +4 -0
- package/dist/core/init/index.js +5 -0
- package/dist/core/init/index.js.map +1 -0
- package/dist/core/init/name.d.ts +1 -0
- package/dist/core/init/name.js +4 -0
- package/dist/core/init/name.js.map +1 -0
- package/dist/core/init/run.d.ts +51 -0
- package/dist/core/init/run.js +261 -0
- package/dist/core/init/run.js.map +1 -0
- package/dist/core/init/targets.d.ts +17 -0
- package/dist/core/init/targets.js +87 -0
- package/dist/core/init/targets.js.map +1 -0
- package/dist/core/merge.d.ts +88 -0
- package/dist/core/merge.js +239 -0
- package/dist/core/merge.js.map +1 -0
- package/dist/core/publish/exclude.d.ts +9 -0
- package/dist/core/publish/exclude.js +32 -0
- package/dist/core/publish/exclude.js.map +1 -0
- package/dist/core/publish/git-target.d.ts +32 -0
- package/dist/core/publish/git-target.js +447 -0
- package/dist/core/publish/git-target.js.map +1 -0
- package/dist/core/publish/index.d.ts +10 -0
- package/dist/core/publish/index.js +11 -0
- package/dist/core/publish/index.js.map +1 -0
- package/dist/core/publish/npm-target.d.ts +15 -0
- package/dist/core/publish/npm-target.js +170 -0
- package/dist/core/publish/npm-target.js.map +1 -0
- package/dist/core/publish/package-json.d.ts +31 -0
- package/dist/core/publish/package-json.js +74 -0
- package/dist/core/publish/package-json.js.map +1 -0
- package/dist/core/publish/prepare.d.ts +24 -0
- package/dist/core/publish/prepare.js +93 -0
- package/dist/core/publish/prepare.js.map +1 -0
- package/dist/core/publish/provenance.d.ts +1 -0
- package/dist/core/publish/provenance.js +20 -0
- package/dist/core/publish/provenance.js.map +1 -0
- package/dist/core/publish/publish.d.ts +13 -0
- package/dist/core/publish/publish.js +130 -0
- package/dist/core/publish/publish.js.map +1 -0
- package/dist/core/publish/readme.d.ts +22 -0
- package/dist/core/publish/readme.js +112 -0
- package/dist/core/publish/readme.js.map +1 -0
- package/dist/core/publish/stage.d.ts +19 -0
- package/dist/core/publish/stage.js +333 -0
- package/dist/core/publish/stage.js.map +1 -0
- package/dist/core/publish/types.d.ts +71 -0
- package/dist/core/publish/types.js +2 -0
- package/dist/core/publish/types.js.map +1 -0
- package/dist/core/requires/check.d.ts +15 -0
- package/dist/core/requires/check.js +83 -0
- package/dist/core/requires/check.js.map +1 -0
- package/dist/core/requires/index.d.ts +4 -0
- package/dist/core/requires/index.js +5 -0
- package/dist/core/requires/index.js.map +1 -0
- package/dist/core/requires/inspect.d.ts +44 -0
- package/dist/core/requires/inspect.js +114 -0
- package/dist/core/requires/inspect.js.map +1 -0
- package/dist/core/requires/paths.d.ts +29 -0
- package/dist/core/requires/paths.js +83 -0
- package/dist/core/requires/paths.js.map +1 -0
- package/dist/core/requires/setup.d.ts +37 -0
- package/dist/core/requires/setup.js +147 -0
- package/dist/core/requires/setup.js.map +1 -0
- package/dist/core/setup.d.ts +27 -0
- package/dist/core/setup.js +84 -0
- package/dist/core/setup.js.map +1 -0
- package/dist/core/sources/cache.d.ts +38 -0
- package/dist/core/sources/cache.js +200 -0
- package/dist/core/sources/cache.js.map +1 -0
- package/dist/core/sources/containment.d.ts +21 -0
- package/dist/core/sources/containment.js +50 -0
- package/dist/core/sources/containment.js.map +1 -0
- package/dist/core/sources/env.d.ts +12 -0
- package/dist/core/sources/env.js +28 -0
- package/dist/core/sources/env.js.map +1 -0
- package/dist/core/sources/extract.d.ts +25 -0
- package/dist/core/sources/extract.js +676 -0
- package/dist/core/sources/extract.js.map +1 -0
- package/dist/core/sources/git-process.d.ts +26 -0
- package/dist/core/sources/git-process.js +51 -0
- package/dist/core/sources/git-process.js.map +1 -0
- package/dist/core/sources/git.d.ts +41 -0
- package/dist/core/sources/git.js +511 -0
- package/dist/core/sources/git.js.map +1 -0
- package/dist/core/sources/https.d.ts +21 -0
- package/dist/core/sources/https.js +208 -0
- package/dist/core/sources/https.js.map +1 -0
- package/dist/core/sources/index.d.ts +13 -0
- package/dist/core/sources/index.js +14 -0
- package/dist/core/sources/index.js.map +1 -0
- package/dist/core/sources/npm-cli.d.ts +19 -0
- package/dist/core/sources/npm-cli.js +43 -0
- package/dist/core/sources/npm-cli.js.map +1 -0
- package/dist/core/sources/npm.d.ts +29 -0
- package/dist/core/sources/npm.js +386 -0
- package/dist/core/sources/npm.js.map +1 -0
- package/dist/core/sources/parse.d.ts +32 -0
- package/dist/core/sources/parse.js +389 -0
- package/dist/core/sources/parse.js.map +1 -0
- package/dist/core/sources/path.d.ts +10 -0
- package/dist/core/sources/path.js +316 -0
- package/dist/core/sources/path.js.map +1 -0
- package/dist/core/sources/redact.d.ts +2 -0
- package/dist/core/sources/redact.js +70 -0
- package/dist/core/sources/redact.js.map +1 -0
- package/dist/core/sources/resolve.d.ts +9 -0
- package/dist/core/sources/resolve.js +29 -0
- package/dist/core/sources/resolve.js.map +1 -0
- package/dist/core/sources/types.d.ts +86 -0
- package/dist/core/sources/types.js +2 -0
- package/dist/core/sources/types.js.map +1 -0
- package/dist/core/sources/validate.d.ts +9 -0
- package/dist/core/sources/validate.js +111 -0
- package/dist/core/sources/validate.js.map +1 -0
- package/dist/core/summary.d.ts +77 -0
- package/dist/core/summary.js +405 -0
- package/dist/core/summary.js.map +1 -0
- package/dist/core/update/clashes.d.ts +63 -0
- package/dist/core/update/clashes.js +192 -0
- package/dist/core/update/clashes.js.map +1 -0
- package/dist/core/update/detach.d.ts +21 -0
- package/dist/core/update/detach.js +38 -0
- package/dist/core/update/detach.js.map +1 -0
- package/dist/core/update/diff.d.ts +58 -0
- package/dist/core/update/diff.js +180 -0
- package/dist/core/update/diff.js.map +1 -0
- package/dist/core/update/fetch.d.ts +34 -0
- package/dist/core/update/fetch.js +73 -0
- package/dist/core/update/fetch.js.map +1 -0
- package/dist/core/update/index.d.ts +6 -0
- package/dist/core/update/index.js +7 -0
- package/dist/core/update/index.js.map +1 -0
- package/dist/core/update/restore.d.ts +20 -0
- package/dist/core/update/restore.js +195 -0
- package/dist/core/update/restore.js.map +1 -0
- package/dist/core/update/run.d.ts +113 -0
- package/dist/core/update/run.js +1132 -0
- package/dist/core/update/run.js.map +1 -0
- package/dist/core/update/select.d.ts +39 -0
- package/dist/core/update/select.js +157 -0
- package/dist/core/update/select.js.map +1 -0
- package/dist/core/update/spelling.d.ts +51 -0
- package/dist/core/update/spelling.js +185 -0
- package/dist/core/update/spelling.js.map +1 -0
- package/dist/core/update/trees.d.ts +24 -0
- package/dist/core/update/trees.js +72 -0
- package/dist/core/update/trees.js.map +1 -0
- package/dist/errors.d.ts +29 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.d.ts +46 -0
- package/dist/help.js +103 -0
- package/dist/help.js.map +1 -0
- package/dist/input.d.ts +25 -0
- package/dist/input.js +173 -0
- package/dist/input.js.map +1 -0
- package/dist/output.d.ts +21 -0
- package/dist/output.js +37 -0
- package/dist/output.js.map +1 -0
- package/dist/util/frontmatter.d.ts +12 -0
- package/dist/util/frontmatter.js +58 -0
- package/dist/util/frontmatter.js.map +1 -0
- package/dist/util/fs.d.ts +32 -0
- package/dist/util/fs.js +126 -0
- package/dist/util/fs.js.map +1 -0
- package/dist/util/git-names.d.ts +8 -0
- package/dist/util/git-names.js +25 -0
- package/dist/util/git-names.js.map +1 -0
- package/dist/util/git.d.ts +12 -0
- package/dist/util/git.js +33 -0
- package/dist/util/git.js.map +1 -0
- package/dist/util/suggest.d.ts +6 -0
- package/dist/util/suggest.js +48 -0
- package/dist/util/suggest.js.map +1 -0
- package/dist/util/text.d.ts +8 -0
- package/dist/util/text.js +19 -0
- package/dist/util/text.js.map +1 -0
- package/dist/util/version.d.ts +7 -0
- package/dist/util/version.js +13 -0
- package/dist/util/version.js.map +1 -0
- package/dist/util/yaml.d.ts +30 -0
- package/dist/util/yaml.js +201 -0
- package/dist/util/yaml.js.map +1 -0
- package/package.json +50 -3
- package/resources/metafab-skill/SKILL.md +99 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { snapshotDirectories, snapshotTree } from "./file-tree.js";
|
|
3
|
+
/** One list of entries per folded name, each entry keeping its local spelling. */
|
|
4
|
+
export function indexOf(entries) {
|
|
5
|
+
const index = new Map();
|
|
6
|
+
for (const [key, value] of entries) {
|
|
7
|
+
const folded = key.toLowerCase();
|
|
8
|
+
const indexed = index.get(folded);
|
|
9
|
+
if (indexed === undefined)
|
|
10
|
+
index.set(folded, [{ key, value }]);
|
|
11
|
+
else
|
|
12
|
+
indexed.push({ key, value });
|
|
13
|
+
}
|
|
14
|
+
return index;
|
|
15
|
+
}
|
|
16
|
+
function absolute(root, relativePath) {
|
|
17
|
+
return path.join(root, ...relativePath.split("/"));
|
|
18
|
+
}
|
|
19
|
+
export function ancestors(relativePath) {
|
|
20
|
+
const parts = relativePath.split("/");
|
|
21
|
+
const prefixes = [];
|
|
22
|
+
for (let index = 1; index < parts.length; index += 1) {
|
|
23
|
+
prefixes.push(parts.slice(0, index).join("/"));
|
|
24
|
+
}
|
|
25
|
+
return prefixes;
|
|
26
|
+
}
|
|
27
|
+
function replaced(file) {
|
|
28
|
+
return {
|
|
29
|
+
level: "error",
|
|
30
|
+
file,
|
|
31
|
+
message: `The incoming fab would replace ${file}`,
|
|
32
|
+
fix: "Keep the local file, or run metafab import --force to replace it",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function blocked(file) {
|
|
36
|
+
return {
|
|
37
|
+
level: "error",
|
|
38
|
+
file,
|
|
39
|
+
message: `The incoming fab would replace ${file} with a different kind of entry`,
|
|
40
|
+
fix: "Move the local entry away, or run metafab import --force to replace it",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** The one wording for a local entry that differs only in case from an incoming path. */
|
|
44
|
+
export function differentSpelling(file, incoming, command) {
|
|
45
|
+
const importing = command === "import";
|
|
46
|
+
return {
|
|
47
|
+
level: "error",
|
|
48
|
+
file,
|
|
49
|
+
message: importing
|
|
50
|
+
? `The incoming fab writes ${incoming}, which differs only in case from ${file}`
|
|
51
|
+
: `The update writes ${incoming}, which differs only in case from ${file}`,
|
|
52
|
+
fix: importing
|
|
53
|
+
? "Keep the local file, or run metafab import --force to replace it"
|
|
54
|
+
: "Move the local entry away, then run metafab update again",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The problem for an incoming path that several local spellings fold to.
|
|
59
|
+
*
|
|
60
|
+
* The clash preflight and the realignment both refuse this case, so the text is
|
|
61
|
+
* built here once and both paths report it identically.
|
|
62
|
+
*/
|
|
63
|
+
export function ambiguousSpellingProblem(files, incoming, command) {
|
|
64
|
+
const importing = command === "import";
|
|
65
|
+
return {
|
|
66
|
+
level: "error",
|
|
67
|
+
file: files[0] ?? incoming,
|
|
68
|
+
message: importing
|
|
69
|
+
? `The incoming fab writes ${incoming}, but these local entries differ only in case: ${files.join(", ")}`
|
|
70
|
+
: `The update writes ${incoming}, but these local entries differ only in case: ${files.join(", ")}`,
|
|
71
|
+
fix: importing
|
|
72
|
+
? "Move all but one of the local entries away, then run metafab import again"
|
|
73
|
+
: "Move all but one of the local entries away, then run metafab update again",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function addTree(files, tree, prefix, sourceDirectory) {
|
|
77
|
+
for (const [relativePath, entry] of Object.entries(tree)) {
|
|
78
|
+
const key = prefix === "" ? relativePath : `${prefix}/${relativePath}`;
|
|
79
|
+
if (files.has(key))
|
|
80
|
+
continue;
|
|
81
|
+
files.set(key, { entry, file: `${sourceDirectory}/${relativePath}` });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function addDirectories(directories, relativePaths, prefix, sourceDirectory) {
|
|
85
|
+
for (const relativePath of relativePaths) {
|
|
86
|
+
const key = prefix === "" ? relativePath : `${prefix}/${relativePath}`;
|
|
87
|
+
if (directories.has(key))
|
|
88
|
+
continue;
|
|
89
|
+
directories.set(key, `${sourceDirectory}/${relativePath}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The local paths an import could write over: the factory, plus the files of
|
|
94
|
+
* each skill adoption will move into it. Keys are factory-relative paths, so a
|
|
95
|
+
* planned move of `release` maps `.claude/skills/release/SKILL.md` to
|
|
96
|
+
* `skills/release/SKILL.md`, where the incoming fab writes.
|
|
97
|
+
*
|
|
98
|
+
* Directories are listed too, empty ones included: a snapshot has none, so
|
|
99
|
+
* without this an incoming file could quietly delete one.
|
|
100
|
+
*/
|
|
101
|
+
export async function localFilesForImport(root, factoryDir, moves, hasFactory) {
|
|
102
|
+
const paths = { files: new Map(), directories: new Map() };
|
|
103
|
+
if (hasFactory) {
|
|
104
|
+
addTree(paths.files, await snapshotTree(factoryDir), "", ".factory");
|
|
105
|
+
addDirectories(paths.directories, await snapshotDirectories(factoryDir), "", ".factory");
|
|
106
|
+
}
|
|
107
|
+
for (const move of moves) {
|
|
108
|
+
const primary = move.from[0];
|
|
109
|
+
if (primary === undefined)
|
|
110
|
+
continue;
|
|
111
|
+
let tree;
|
|
112
|
+
let directories;
|
|
113
|
+
try {
|
|
114
|
+
[tree, directories] = await Promise.all([
|
|
115
|
+
snapshotTree(absolute(root, primary)),
|
|
116
|
+
snapshotDirectories(absolute(root, primary)),
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
addTree(paths.files, tree, `skills/${move.name}`, primary);
|
|
123
|
+
addDirectories(paths.directories, directories, `skills/${move.name}`, primary);
|
|
124
|
+
}
|
|
125
|
+
return paths;
|
|
126
|
+
}
|
|
127
|
+
function localIndex(local) {
|
|
128
|
+
return {
|
|
129
|
+
files: indexOf(local.files.entries()),
|
|
130
|
+
directories: indexOf(local.directories.entries()),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Every incoming path that would replace or remove local content: a file, link
|
|
135
|
+
* or directory whose content differs, or a local path that differs only in
|
|
136
|
+
* case. Content is compared without line-ending changes counting as a
|
|
137
|
+
* difference, and without case: a path that differs only in case still lands on
|
|
138
|
+
* the same entry on a case-insensitive filesystem. An incoming file or link at
|
|
139
|
+
* the path of an existing local directory is a conflict too, empty directories
|
|
140
|
+
* included, because the copy would delete it. A path that would replace a file
|
|
141
|
+
* with a directory, a directory with a file, or a link with a file, is a
|
|
142
|
+
* conflict, so the copy can never fail on it or delete local content.
|
|
143
|
+
*
|
|
144
|
+
* Every incoming path is folded against its local ancestors as well as the
|
|
145
|
+
* path itself, so a case-only clash with a local file, link or directory at any
|
|
146
|
+
* depth is refused. Without that, an incoming `templates/` would slip past a
|
|
147
|
+
* local `Templates/` on a case-insensitive filesystem and split in two on a
|
|
148
|
+
* case-sensitive one.
|
|
149
|
+
*
|
|
150
|
+
* A clash is reported once per clashing component, not once per incoming file
|
|
151
|
+
* beneath it: a local `Templates/` against three incoming files gives one
|
|
152
|
+
* problem that names `templates`.
|
|
153
|
+
*
|
|
154
|
+
* Two local entries that fold to one incoming component are an ambiguity, not
|
|
155
|
+
* a conflict: only a case-sensitive filesystem can hold both, and no rename can
|
|
156
|
+
* choose between them safely. `--force` never overrides an ambiguity.
|
|
157
|
+
*/
|
|
158
|
+
export async function findImportConflicts(incomingDir, local) {
|
|
159
|
+
const [incoming, incomingDirectories] = await Promise.all([
|
|
160
|
+
snapshotTree(incomingDir),
|
|
161
|
+
snapshotDirectories(incomingDir),
|
|
162
|
+
]);
|
|
163
|
+
const index = localIndex(local);
|
|
164
|
+
const conflicts = [];
|
|
165
|
+
const ambiguities = [];
|
|
166
|
+
const reported = new Set();
|
|
167
|
+
function report(into, problem) {
|
|
168
|
+
const id = `${problem.file}\u0000${problem.message}`;
|
|
169
|
+
if (reported.has(id))
|
|
170
|
+
return;
|
|
171
|
+
reported.add(id);
|
|
172
|
+
into.push(problem);
|
|
173
|
+
}
|
|
174
|
+
/** One problem for a component that several local spellings fold to. */
|
|
175
|
+
function ambiguity(files, incoming) {
|
|
176
|
+
report(ambiguities, ambiguousSpellingProblem(files, incoming, "import"));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Reports the first local entry on the path itself, or among its ancestors,
|
|
180
|
+
* that the incoming entry would replace. Case-only clashes name the local
|
|
181
|
+
* entry and the incoming component; an exact spelling that changes the kind
|
|
182
|
+
* of entry is reported as blocked.
|
|
183
|
+
*/
|
|
184
|
+
function checkLocalPath(relativePath, incomingDirectory) {
|
|
185
|
+
const folded = relativePath.toLowerCase();
|
|
186
|
+
const existingFiles = index.files.get(folded);
|
|
187
|
+
if (existingFiles !== undefined && existingFiles.length > 0) {
|
|
188
|
+
if (existingFiles.length > 1) {
|
|
189
|
+
ambiguity(existingFiles.map((entry) => entry.value.file), relativePath);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const existingFile = existingFiles[0];
|
|
193
|
+
if (existingFile.key !== relativePath) {
|
|
194
|
+
report(conflicts, differentSpelling(existingFile.value.file, relativePath, "import"));
|
|
195
|
+
}
|
|
196
|
+
else if (incomingDirectory) {
|
|
197
|
+
report(conflicts, blocked(existingFile.value.file));
|
|
198
|
+
}
|
|
199
|
+
else if (existingFile.value.entry.hash !== incoming[relativePath].hash) {
|
|
200
|
+
report(conflicts, replaced(existingFile.value.file));
|
|
201
|
+
}
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
for (const prefix of ancestors(relativePath)) {
|
|
205
|
+
const foldedPrefix = prefix.toLowerCase();
|
|
206
|
+
const ancestorFiles = index.files.get(foldedPrefix);
|
|
207
|
+
if (ancestorFiles !== undefined) {
|
|
208
|
+
if (ancestorFiles.length > 1) {
|
|
209
|
+
ambiguity(ancestorFiles.map((entry) => entry.value.file), prefix);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const ancestorFile = ancestorFiles[0];
|
|
213
|
+
report(conflicts, ancestorFile.key === prefix
|
|
214
|
+
? blocked(ancestorFile.value.file)
|
|
215
|
+
: differentSpelling(ancestorFile.value.file, prefix, "import"));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const ancestorDirectories = index.directories.get(foldedPrefix);
|
|
219
|
+
if (ancestorDirectories !== undefined) {
|
|
220
|
+
if (ancestorDirectories.length > 1) {
|
|
221
|
+
ambiguity(ancestorDirectories.map((entry) => entry.value), prefix);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const ancestorDirectory = ancestorDirectories[0];
|
|
225
|
+
if (ancestorDirectory.key !== prefix) {
|
|
226
|
+
report(conflicts, differentSpelling(ancestorDirectory.value, prefix, "import"));
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const existingDirectories = index.directories.get(folded);
|
|
232
|
+
if (existingDirectories === undefined)
|
|
233
|
+
return;
|
|
234
|
+
if (existingDirectories.length > 1) {
|
|
235
|
+
ambiguity(existingDirectories.map((entry) => entry.value), relativePath);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const existingDirectory = existingDirectories[0];
|
|
239
|
+
if (existingDirectory.key !== relativePath) {
|
|
240
|
+
report(conflicts, differentSpelling(existingDirectory.value, relativePath, "import"));
|
|
241
|
+
}
|
|
242
|
+
else if (!incomingDirectory) {
|
|
243
|
+
report(conflicts, blocked(existingDirectory.value));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
for (const relativePath of Object.keys(incoming).sort()) {
|
|
247
|
+
checkLocalPath(relativePath, false);
|
|
248
|
+
}
|
|
249
|
+
// Directories are checked too: an incoming empty directory can clash with a
|
|
250
|
+
// local one, or replace a local file or link, just as a file can.
|
|
251
|
+
for (const relativePath of [...incomingDirectories].sort()) {
|
|
252
|
+
checkLocalPath(relativePath, true);
|
|
253
|
+
}
|
|
254
|
+
return { conflicts, ambiguities };
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=conflicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflicts.js","sourceRoot":"","sources":["../../../src/core/import/conflicts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE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C,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;QACxF,CAAC;aAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC9B,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACxD,cAAc,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,4EAA4E;IAC5E,kEAAkE;IAClE,KAAK,MAAM,YAAY,IAAI,CAAC,GAAG,mBAAmB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3D,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Files the fab carries for its own repository, never for the receiver. */
|
|
2
|
+
export declare const FAB_ROOT_EXCLUDES: ReadonlySet<string>;
|
|
3
|
+
/**
|
|
4
|
+
* Copy a fetched fab's `.factory/` into the local `.factory/`, keeping modes.
|
|
5
|
+
*
|
|
6
|
+
* `metafab.yaml` and `.factory/README.md` belong to the fab's repository and are
|
|
7
|
+
* never copied. The source tree was validated by the fetch, so links point
|
|
8
|
+
* inside the factory and can be recreated as they are.
|
|
9
|
+
*/
|
|
10
|
+
export declare function copyFactoryTree(sourceDir: string, destinationDir: string): Promise<string[]>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { lstat, mkdir, readlink, rm, symlink } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { copyFileWithMode, readdirTyped } from "../../util/fs.js";
|
|
4
|
+
/** Files the fab carries for its own repository, never for the receiver. */
|
|
5
|
+
export const FAB_ROOT_EXCLUDES = new Set(["metafab.yaml", "README.md"]);
|
|
6
|
+
async function lstatIfExists(target) {
|
|
7
|
+
try {
|
|
8
|
+
return await lstat(target);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code === "ENOENT")
|
|
12
|
+
return undefined;
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function ensureDirectory(target) {
|
|
17
|
+
const info = await lstatIfExists(target);
|
|
18
|
+
if (info !== undefined && !info.isDirectory()) {
|
|
19
|
+
await rm(target, { recursive: true, force: true });
|
|
20
|
+
}
|
|
21
|
+
await mkdir(target, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
/** Replaces whatever occupies `target` with a regular file copy. */
|
|
24
|
+
async function copyFile(source, target) {
|
|
25
|
+
const info = await lstatIfExists(target);
|
|
26
|
+
if (info !== undefined && !info.isFile()) {
|
|
27
|
+
await rm(target, { recursive: true, force: true });
|
|
28
|
+
}
|
|
29
|
+
await copyFileWithMode(source, target);
|
|
30
|
+
}
|
|
31
|
+
/** Replaces whatever occupies `target` with a symbolic link to `linkTarget`. */
|
|
32
|
+
async function copyLink(linkTarget, target) {
|
|
33
|
+
await rm(target, { recursive: true, force: true });
|
|
34
|
+
await symlink(linkTarget, target);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Copy a fetched fab's `.factory/` into the local `.factory/`, keeping modes.
|
|
38
|
+
*
|
|
39
|
+
* `metafab.yaml` and `.factory/README.md` belong to the fab's repository and are
|
|
40
|
+
* never copied. The source tree was validated by the fetch, so links point
|
|
41
|
+
* inside the factory and can be recreated as they are.
|
|
42
|
+
*/
|
|
43
|
+
export async function copyFactoryTree(sourceDir, destinationDir) {
|
|
44
|
+
const copied = [];
|
|
45
|
+
async function walk(current, relative) {
|
|
46
|
+
const entries = await readdirTyped(current);
|
|
47
|
+
entries.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
if (relative === "" && FAB_ROOT_EXCLUDES.has(entry.name))
|
|
50
|
+
continue;
|
|
51
|
+
const source = path.join(current, entry.name);
|
|
52
|
+
const target = path.join(destinationDir, ...(relative === "" ? [entry.name] : [...relative.split("/"), entry.name]));
|
|
53
|
+
const childRelative = relative === "" ? entry.name : `${relative}/${entry.name}`;
|
|
54
|
+
if (entry.isSymbolicLink()) {
|
|
55
|
+
await ensureDirectory(path.dirname(target));
|
|
56
|
+
await copyLink(await readlink(source), target);
|
|
57
|
+
copied.push(childRelative);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (entry.isDirectory()) {
|
|
61
|
+
await ensureDirectory(target);
|
|
62
|
+
await walk(source, childRelative);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (!entry.isFile())
|
|
66
|
+
continue;
|
|
67
|
+
await ensureDirectory(path.dirname(target));
|
|
68
|
+
await copyFile(source, target);
|
|
69
|
+
copied.push(childRelative);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
await ensureDirectory(destinationDir);
|
|
73
|
+
await walk(sourceDir, "");
|
|
74
|
+
return copied.sort();
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/core/import/copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;AAE7F,KAAK,UAAU,aAAa,CAAC,MAAc;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C,MAAM,CAAC,CAAC,CAAC;gBAC5C,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;gBAC/C,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC3B,SAAS;YACX,CAAC;YAED,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;gBAC9B,MAAM,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;gBAClC,SAAS;YACX,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAAE,SAAS;YAE9B,MAAM,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5C,MAAM,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,MAAM,eAAe,CAAC,cAAc,CAAC,CAAC;IACtC,MAAM,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface FileEntry {
|
|
2
|
+
/** SHA-256 of the content: the LF-normalised bytes for text, the raw bytes for binary. */
|
|
3
|
+
hash: string;
|
|
4
|
+
/** Permission bits, so an executable bit counts as a change. */
|
|
5
|
+
mode: number;
|
|
6
|
+
binary: boolean;
|
|
7
|
+
/** Content when the file is text, with LF line endings. */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Content when the file is binary. */
|
|
10
|
+
data?: Uint8Array;
|
|
11
|
+
/** The target of a symbolic link, when the entry is a link rather than a file. */
|
|
12
|
+
link?: string;
|
|
13
|
+
/** True when the text uses CRLF on every line, so a write can keep it. */
|
|
14
|
+
crlf?: true;
|
|
15
|
+
/** The file's original bytes when they differ from the LF text, so a write can keep them. */
|
|
16
|
+
raw?: Buffer;
|
|
17
|
+
}
|
|
18
|
+
/** A snapshot of a factory directory: relative POSIX path to entry. */
|
|
19
|
+
export type FileTree = Readonly<Record<string, FileEntry>>;
|
|
20
|
+
export declare const LINK_HASH_PREFIX = "\0metafab-link\0";
|
|
21
|
+
/**
|
|
22
|
+
* Snapshot every file and symbolic link under `dir`, keyed by its POSIX path
|
|
23
|
+
* relative to `dir`.
|
|
24
|
+
*
|
|
25
|
+
* Text is stored with LF line endings and hashed that way, so a change of line
|
|
26
|
+
* endings alone is not a change. Content that is not valid UTF-8, and content
|
|
27
|
+
* with a NUL, are binary: stored and hashed as raw bytes. A link is stored with
|
|
28
|
+
* its target, so an added, removed, or repointed link is a change like any
|
|
29
|
+
* other.
|
|
30
|
+
*/
|
|
31
|
+
export declare function snapshotTree(dir: string): Promise<FileTree>;
|
|
32
|
+
/** Snapshot the active factory, `.factory/` under `root`. */
|
|
33
|
+
export declare function snapshotFactory(root: string): Promise<FileTree>;
|
|
34
|
+
/**
|
|
35
|
+
* Every directory under `dir`, as POSIX paths relative to it, symbolic links
|
|
36
|
+
* not followed.
|
|
37
|
+
*
|
|
38
|
+
* A snapshot keeps no directories, so this is how a preflight finds a local
|
|
39
|
+
* directory that an incoming file or link would delete, empty or not.
|
|
40
|
+
*/
|
|
41
|
+
export declare function snapshotDirectories(dir: string): Promise<string[]>;
|
|
42
|
+
/** A file tree with no entries: the state of a repository before its first import. */
|
|
43
|
+
export declare function emptyTree(): FileTree;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { lstat, readFile, readlink } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { readdirTyped } from "../../util/fs.js";
|
|
5
|
+
import { toLF, usesCRLF } from "../../util/text.js";
|
|
6
|
+
import { textContent } from "../build/skill.js";
|
|
7
|
+
export const LINK_HASH_PREFIX = "\0metafab-link\0";
|
|
8
|
+
function hashOf(data) {
|
|
9
|
+
return createHash("sha256").update(data).digest("hex");
|
|
10
|
+
}
|
|
11
|
+
async function entryOf(target, link) {
|
|
12
|
+
if (link !== undefined) {
|
|
13
|
+
const info = await lstat(target);
|
|
14
|
+
// The prefix keeps a link's target from hashing like file content with the same bytes.
|
|
15
|
+
return {
|
|
16
|
+
hash: hashOf(`${LINK_HASH_PREFIX}${link}`),
|
|
17
|
+
mode: info.mode & 0o777,
|
|
18
|
+
binary: false,
|
|
19
|
+
link,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const [data, info] = await Promise.all([readFile(target), lstat(target)]);
|
|
23
|
+
const mode = info.mode & 0o777;
|
|
24
|
+
// Decoding keeps a valid UTF-8 file as text. Anything else stays raw bytes:
|
|
25
|
+
// re-encoding a lossy decode would corrupt the file, and two different invalid
|
|
26
|
+
// sequences would decode to the same replacement characters.
|
|
27
|
+
const decoded = textContent(data);
|
|
28
|
+
if (decoded === undefined) {
|
|
29
|
+
return { hash: hashOf(data), mode, binary: true, data };
|
|
30
|
+
}
|
|
31
|
+
const text = toLF(decoded);
|
|
32
|
+
const entry = { hash: hashOf(text), mode, binary: false, text };
|
|
33
|
+
// Keep the original bytes only when normalising changed them, which is a
|
|
34
|
+
// CRLF or mixed-ending file, so a write can reproduce the file as it was.
|
|
35
|
+
if (text !== decoded)
|
|
36
|
+
entry.raw = data;
|
|
37
|
+
if (usesCRLF(decoded))
|
|
38
|
+
entry.crlf = true;
|
|
39
|
+
return entry;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Snapshot every file and symbolic link under `dir`, keyed by its POSIX path
|
|
43
|
+
* relative to `dir`.
|
|
44
|
+
*
|
|
45
|
+
* Text is stored with LF line endings and hashed that way, so a change of line
|
|
46
|
+
* endings alone is not a change. Content that is not valid UTF-8, and content
|
|
47
|
+
* with a NUL, are binary: stored and hashed as raw bytes. A link is stored with
|
|
48
|
+
* its target, so an added, removed, or repointed link is a change like any
|
|
49
|
+
* other.
|
|
50
|
+
*/
|
|
51
|
+
export async function snapshotTree(dir) {
|
|
52
|
+
const root = path.resolve(dir);
|
|
53
|
+
const entries = {};
|
|
54
|
+
async function walk(directory, prefix) {
|
|
55
|
+
const children = await readdirTyped(directory);
|
|
56
|
+
children.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
|
|
57
|
+
for (const child of children) {
|
|
58
|
+
const relativePath = prefix === "" ? child.name : `${prefix}/${child.name}`;
|
|
59
|
+
const target = path.join(directory, child.name);
|
|
60
|
+
if (child.isSymbolicLink()) {
|
|
61
|
+
entries[relativePath] = await entryOf(target, await readlink(target));
|
|
62
|
+
}
|
|
63
|
+
else if (child.isDirectory()) {
|
|
64
|
+
await walk(target, relativePath);
|
|
65
|
+
}
|
|
66
|
+
else if (child.isFile()) {
|
|
67
|
+
entries[relativePath] = await entryOf(target, undefined);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
await walk(root, "");
|
|
72
|
+
return entries;
|
|
73
|
+
}
|
|
74
|
+
/** Snapshot the active factory, `.factory/` under `root`. */
|
|
75
|
+
export async function snapshotFactory(root) {
|
|
76
|
+
return snapshotTree(path.join(path.resolve(root), ".factory"));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Every directory under `dir`, as POSIX paths relative to it, symbolic links
|
|
80
|
+
* not followed.
|
|
81
|
+
*
|
|
82
|
+
* A snapshot keeps no directories, so this is how a preflight finds a local
|
|
83
|
+
* directory that an incoming file or link would delete, empty or not.
|
|
84
|
+
*/
|
|
85
|
+
export async function snapshotDirectories(dir) {
|
|
86
|
+
const root = path.resolve(dir);
|
|
87
|
+
const directories = [];
|
|
88
|
+
async function walk(directory, prefix) {
|
|
89
|
+
const children = await readdirTyped(directory);
|
|
90
|
+
children.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
|
|
91
|
+
for (const child of children) {
|
|
92
|
+
// A symbolic link is not a directory here: the snapshot treats it as a link.
|
|
93
|
+
if (!child.isDirectory())
|
|
94
|
+
continue;
|
|
95
|
+
const relativePath = prefix === "" ? child.name : `${prefix}/${child.name}`;
|
|
96
|
+
directories.push(relativePath);
|
|
97
|
+
await walk(path.join(directory, child.name), relativePath);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
await walk(root, "");
|
|
101
|
+
return directories;
|
|
102
|
+
}
|
|
103
|
+
/** A file tree with no entries: the state of a repository before its first import. */
|
|
104
|
+
export function emptyTree() {
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=file-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.js","sourceRoot":"","sources":["../../../src/core/import/file-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAuBhD,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD,SAAS,MAAM,CAAC,IAAyB;IACvC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,MAAc,EAAE,IAAwB;IAC7D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QACjC,uFAAuF;QACvF,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,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AAO,WAAW,CAAC;AACrB,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,SAAS;IACvB,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/import/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describe changes to the `pipeline` list of `factory.yaml` in words, such as
|
|
3
|
+
* `pipeline: finish-slice added after review-slice`.
|
|
4
|
+
*
|
|
5
|
+
* Returns no descriptions when either side cannot be parsed, or when the
|
|
6
|
+
* pipeline did not change; the caller then falls back to line counts.
|
|
7
|
+
*/
|
|
8
|
+
export declare function describePipelineChanges(before: string | undefined, after: string | undefined): string[];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { parseFactoryYaml } from "../factory/index.js";
|
|
2
|
+
function pipelineOf(text) {
|
|
3
|
+
if (text === undefined)
|
|
4
|
+
return { names: [], stops: new Map() };
|
|
5
|
+
const parsed = parseFactoryYaml(text, "factory.yaml");
|
|
6
|
+
if (parsed.problems.length > 0)
|
|
7
|
+
return undefined;
|
|
8
|
+
const snapshot = { names: [], stops: new Map() };
|
|
9
|
+
for (const entry of parsed.pipeline ?? []) {
|
|
10
|
+
snapshot.names.push(entry.workflow);
|
|
11
|
+
snapshot.stops.set(entry.workflow, entry.stop);
|
|
12
|
+
}
|
|
13
|
+
return snapshot;
|
|
14
|
+
}
|
|
15
|
+
function at(grid, row, column) {
|
|
16
|
+
return grid[row]?.[column] ?? 0;
|
|
17
|
+
}
|
|
18
|
+
/** Indices in `after` of one longest common subsequence of the two name lists. */
|
|
19
|
+
function lcsIndices(before, after) {
|
|
20
|
+
const rows = before.length;
|
|
21
|
+
const columns = after.length;
|
|
22
|
+
const grid = Array.from({ length: rows + 1 }, () => new Array(columns + 1).fill(0));
|
|
23
|
+
for (let row = rows - 1; row >= 0; row -= 1) {
|
|
24
|
+
for (let column = columns - 1; column >= 0; column -= 1) {
|
|
25
|
+
grid[row][column] =
|
|
26
|
+
before[row] === after[column]
|
|
27
|
+
? at(grid, row + 1, column + 1) + 1
|
|
28
|
+
: Math.max(at(grid, row + 1, column), at(grid, row, column + 1));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const kept = new Set();
|
|
32
|
+
let row = 0;
|
|
33
|
+
let column = 0;
|
|
34
|
+
while (row < rows && column < columns) {
|
|
35
|
+
if (before[row] === after[column]) {
|
|
36
|
+
kept.add(column);
|
|
37
|
+
row += 1;
|
|
38
|
+
column += 1;
|
|
39
|
+
}
|
|
40
|
+
else if (at(grid, row + 1, column) >= at(grid, row, column + 1)) {
|
|
41
|
+
row += 1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
column += 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return kept;
|
|
48
|
+
}
|
|
49
|
+
function positionIn(names, index) {
|
|
50
|
+
const previous = index === 0 ? undefined : names[index - 1];
|
|
51
|
+
return previous === undefined ? "at the start" : `after ${previous}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Describe changes to the `pipeline` list of `factory.yaml` in words, such as
|
|
55
|
+
* `pipeline: finish-slice added after review-slice`.
|
|
56
|
+
*
|
|
57
|
+
* Returns no descriptions when either side cannot be parsed, or when the
|
|
58
|
+
* pipeline did not change; the caller then falls back to line counts.
|
|
59
|
+
*/
|
|
60
|
+
export function describePipelineChanges(before, after) {
|
|
61
|
+
const previous = pipelineOf(before);
|
|
62
|
+
const next = pipelineOf(after);
|
|
63
|
+
if (previous === undefined || next === undefined)
|
|
64
|
+
return [];
|
|
65
|
+
const beforeNames = new Set(previous.names);
|
|
66
|
+
const afterNames = new Set(next.names);
|
|
67
|
+
const kept = lcsIndices(previous.names, next.names);
|
|
68
|
+
const descriptions = [];
|
|
69
|
+
next.names.forEach((name, index) => {
|
|
70
|
+
const position = positionIn(next.names, index);
|
|
71
|
+
if (!beforeNames.has(name)) {
|
|
72
|
+
descriptions.push(`pipeline: ${name} added ${position}`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!kept.has(index)) {
|
|
76
|
+
descriptions.push(index === 0 ? `pipeline: ${name} moved to the start` : `pipeline: ${name} moved ${position}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (previous.stops.get(name) !== next.stops.get(name)) {
|
|
80
|
+
descriptions.push(`pipeline: ${name} stop changed`);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
for (const name of previous.names) {
|
|
84
|
+
if (!afterNames.has(name))
|
|
85
|
+
descriptions.push(`pipeline: ${name} removed`);
|
|
86
|
+
}
|
|
87
|
+
return descriptions;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=pipeline-changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-changes.js","sourceRoot":"","sources":["../../../src/core/import/pipeline-changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD,SAAS,UAAU,CAAC,IAAwB;IAC1C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAC/D,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACjD,MAAM,QAAQ,GAAqB,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACnE,KAAK,MAAM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