@g3nomaly/core 0.3.1 → 0.3.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/dist/cli/commands/add.d.ts +24 -4
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +37 -14
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/conflict.d.ts +52 -0
- package/dist/cli/commands/conflict.d.ts.map +1 -0
- package/dist/cli/commands/conflict.js +88 -0
- package/dist/cli/commands/conflict.js.map +1 -0
- package/dist/cli/commands/installFromSources.d.ts +42 -13
- package/dist/cli/commands/installFromSources.d.ts.map +1 -1
- package/dist/cli/commands/installFromSources.js +68 -19
- package/dist/cli/commands/installFromSources.js.map +1 -1
- package/dist/cli/commands/ls.d.ts +13 -3
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +26 -6
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/remove.d.ts +7 -1
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/remove.js +15 -1
- package/dist/cli/commands/remove.js.map +1 -1
- package/dist/cli/commands/sources.d.ts +34 -10
- package/dist/cli/commands/sources.d.ts.map +1 -1
- package/dist/cli/commands/sources.js +17 -3
- package/dist/cli/commands/sources.js.map +1 -1
- package/dist/cli/commands/update.d.ts +11 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +32 -14
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/dialogue.d.ts +65 -13
- package/dist/cli/dialogue.d.ts.map +1 -1
- package/dist/cli/dialogue.js +46 -7
- package/dist/cli/dialogue.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installDialogues.d.ts +11 -3
- package/dist/cli/installDialogues.d.ts.map +1 -1
- package/dist/cli/installDialogues.js +22 -5
- package/dist/cli/installDialogues.js.map +1 -1
- package/dist/cli/pick.d.ts +11 -2
- package/dist/cli/pick.d.ts.map +1 -1
- package/dist/cli/pick.js +11 -2
- package/dist/cli/pick.js.map +1 -1
- package/dist/cli/report.d.ts +32 -8
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +26 -5
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/theme.d.ts +4 -0
- package/dist/cli/theme.d.ts.map +1 -1
- package/dist/cli/theme.js +4 -0
- package/dist/cli/theme.js.map +1 -1
- package/dist/cli/types.d.ts +56 -5
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/config/config.d.ts +32 -7
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +37 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +58 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +0 -10
- package/dist/config/types.js.map +1 -1
- package/dist/hash/hash.d.ts +6 -8
- package/dist/hash/hash.d.ts.map +1 -1
- package/dist/hash/hash.js +7 -8
- package/dist/hash/hash.js.map +1 -1
- package/dist/hash/index.d.ts.map +1 -1
- package/dist/hash/index.js +1 -0
- package/dist/hash/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/installer/classify.d.ts +27 -1
- package/dist/installer/classify.d.ts.map +1 -1
- package/dist/installer/classify.js +36 -1
- package/dist/installer/classify.js.map +1 -1
- package/dist/installer/files.d.ts +10 -6
- package/dist/installer/files.d.ts.map +1 -1
- package/dist/installer/files.js +4 -3
- package/dist/installer/files.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +1 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/install.d.ts +18 -6
- package/dist/installer/install.d.ts.map +1 -1
- package/dist/installer/install.js +20 -7
- package/dist/installer/install.js.map +1 -1
- package/dist/installer/io.d.ts +6 -1
- package/dist/installer/io.d.ts.map +1 -1
- package/dist/installer/io.js +6 -1
- package/dist/installer/io.js.map +1 -1
- package/dist/installer/manifest.d.ts +29 -19
- package/dist/installer/manifest.d.ts.map +1 -1
- package/dist/installer/manifest.js +20 -10
- package/dist/installer/manifest.js.map +1 -1
- package/dist/installer/manifestSources.d.ts +18 -7
- package/dist/installer/manifestSources.d.ts.map +1 -1
- package/dist/installer/manifestSources.js +18 -7
- package/dist/installer/manifestSources.js.map +1 -1
- package/dist/installer/marketplace.d.ts +24 -12
- package/dist/installer/marketplace.d.ts.map +1 -1
- package/dist/installer/marketplace.js +18 -10
- package/dist/installer/marketplace.js.map +1 -1
- package/dist/installer/origin.d.ts +23 -7
- package/dist/installer/origin.d.ts.map +1 -1
- package/dist/installer/origin.js +14 -7
- package/dist/installer/origin.js.map +1 -1
- package/dist/installer/remove.d.ts +17 -5
- package/dist/installer/remove.d.ts.map +1 -1
- package/dist/installer/remove.js +17 -5
- package/dist/installer/remove.js.map +1 -1
- package/dist/installer/resolve.d.ts +80 -31
- package/dist/installer/resolve.d.ts.map +1 -1
- package/dist/installer/resolve.js +96 -29
- package/dist/installer/resolve.js.map +1 -1
- package/dist/installer/sourceRegistry.d.ts +59 -22
- package/dist/installer/sourceRegistry.d.ts.map +1 -1
- package/dist/installer/sourceRegistry.js +25 -10
- package/dist/installer/sourceRegistry.js.map +1 -1
- package/dist/installer/types.d.ts +72 -19
- package/dist/installer/types.d.ts.map +1 -1
- package/dist/installer/types.js +18 -8
- package/dist/installer/types.js.map +1 -1
- package/dist/registry/index.d.ts +0 -4
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -4
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/registry.handlers.d.ts +7 -0
- package/dist/registry/registry.handlers.d.ts.map +1 -1
- package/dist/registry/registry.handlers.js.map +1 -1
- package/dist/registry/registry.io.d.ts +23 -7
- package/dist/registry/registry.io.d.ts.map +1 -1
- package/dist/registry/registry.io.js +37 -14
- package/dist/registry/registry.io.js.map +1 -1
- package/dist/registry/registry.mutations.d.ts +10 -3
- package/dist/registry/registry.mutations.d.ts.map +1 -1
- package/dist/registry/registry.mutations.js +10 -3
- package/dist/registry/registry.mutations.js.map +1 -1
- package/dist/registry/registry.selectors.d.ts +41 -11
- package/dist/registry/registry.selectors.d.ts.map +1 -1
- package/dist/registry/registry.selectors.js +41 -11
- package/dist/registry/registry.selectors.js.map +1 -1
- package/dist/registry/registry.store.d.ts +22 -9
- package/dist/registry/registry.store.d.ts.map +1 -1
- package/dist/registry/registry.store.js +12 -3
- package/dist/registry/registry.store.js.map +1 -1
- package/dist/registry/registry.template.d.ts +12 -6
- package/dist/registry/registry.template.d.ts.map +1 -1
- package/dist/registry/registry.template.js +13 -6
- package/dist/registry/registry.template.js.map +1 -1
- package/dist/registry/types.d.ts +17 -3
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +16 -6
- package/dist/registry/types.js.map +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/securityParser.d.ts +9 -8
- package/dist/security/securityParser.d.ts.map +1 -1
- package/dist/security/securityParser.js +12 -22
- package/dist/security/securityParser.js.map +1 -1
- package/dist/security/securityWorker.d.ts +11 -0
- package/dist/security/securityWorker.d.ts.map +1 -1
- package/dist/security/securityWorker.js +17 -38
- package/dist/security/securityWorker.js.map +1 -1
- package/dist/sources/checkout.d.ts +10 -4
- package/dist/sources/checkout.d.ts.map +1 -1
- package/dist/sources/checkout.js +10 -4
- package/dist/sources/checkout.js.map +1 -1
- package/dist/sources/git.d.ts +5 -3
- package/dist/sources/git.d.ts.map +1 -1
- package/dist/sources/git.js +5 -3
- package/dist/sources/git.js.map +1 -1
- package/dist/sources/local.d.ts +6 -4
- package/dist/sources/local.d.ts.map +1 -1
- package/dist/sources/local.js +6 -4
- package/dist/sources/local.js.map +1 -1
- package/dist/sources/npm.d.ts +10 -7
- package/dist/sources/npm.d.ts.map +1 -1
- package/dist/sources/npm.js +49 -15
- package/dist/sources/npm.js.map +1 -1
- package/dist/sources/parse.d.ts +24 -16
- package/dist/sources/parse.d.ts.map +1 -1
- package/dist/sources/parse.js +40 -18
- package/dist/sources/parse.js.map +1 -1
- package/dist/sources/process.d.ts +10 -7
- package/dist/sources/process.d.ts.map +1 -1
- package/dist/sources/process.js +10 -7
- package/dist/sources/process.js.map +1 -1
- package/dist/sources/register.d.ts +20 -5
- package/dist/sources/register.d.ts.map +1 -1
- package/dist/sources/register.js +20 -5
- package/dist/sources/register.js.map +1 -1
- package/dist/sources/types.d.ts +43 -8
- package/dist/sources/types.d.ts.map +1 -1
- package/dist/sources/types.js +21 -4
- package/dist/sources/types.js.map +1 -1
- package/dist/utils/errors.d.ts +6 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/merge.d.ts +8 -2
- package/dist/utils/merge.d.ts.map +1 -1
- package/dist/utils/merge.js +9 -2
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/packageMeta.d.ts +16 -2
- package/dist/utils/packageMeta.d.ts.map +1 -1
- package/dist/utils/packageMeta.js +6 -2
- package/dist/utils/packageMeta.js.map +1 -1
- package/dist/utils/paths.d.ts +16 -5
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +16 -5
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/prompt.d.ts +6 -1
- package/dist/utils/prompt.d.ts.map +1 -1
- package/dist/utils/prompt.js +6 -1
- package/dist/utils/prompt.js.map +1 -1
- package/dist/utils/version.d.ts +7 -2
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +40 -3
- package/dist/utils/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
import type { BaseFileEntry, BaseRegistry } from "../../registry/types";
|
|
2
2
|
import type { FileSource, InstallerIO } from "../../installer/types";
|
|
3
3
|
import type { AddDialogues, EntrySource, InstallOptions, InstallTarget } from "../types";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @brief Builds the hasher of a package's current version of each file.
|
|
6
|
+
*
|
|
7
|
+
* @param source - Source of each file's content in the package.
|
|
8
|
+
* @param io - Installer I/O that hashes copied files.
|
|
9
|
+
* @returns Function giving the hash of a file's package content, empty when the package has none.
|
|
10
|
+
*/
|
|
5
11
|
export declare function latestHashFrom(source: FileSource, io: InstallerIO): (file: BaseFileEntry) => Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* @brief Builds one picker choice per registry key, labelled with its description.
|
|
14
|
+
*
|
|
15
|
+
* @param registry - Registry whose keys are offered.
|
|
16
|
+
* @returns Choices with the key as value.
|
|
17
|
+
*/
|
|
6
18
|
export declare function pickerChoices(registry: BaseRegistry): {
|
|
7
19
|
value: string;
|
|
8
20
|
label: string;
|
|
9
21
|
}[];
|
|
10
22
|
/**
|
|
11
|
-
* Installs entries into every target, keeping locally modified files.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
23
|
+
* @brief Installs entries into every target, keeping locally modified files.
|
|
24
|
+
*
|
|
25
|
+
* With no keys and an `onNoValue` dialogue the user picks from the registry. Local
|
|
26
|
+
* changes prompt restore/fork/skip through `onCollision` unless `--force`.
|
|
14
27
|
* The caller resolves keys before and saves each target's store after.
|
|
28
|
+
*
|
|
29
|
+
* @param registry - Entries available to install, by key.
|
|
30
|
+
* @param targets - Destinations to install into.
|
|
31
|
+
* @param source - Source of each entry's files.
|
|
32
|
+
* @param keys - Keys to install; empty to pick from the registry.
|
|
33
|
+
* @param options - Force, dry run and preset answers.
|
|
34
|
+
* @param dialogues - Dialogues for the picker and for local changes.
|
|
15
35
|
*/
|
|
16
36
|
export declare function addEntries(registry: BaseRegistry, targets: InstallTarget[], source: EntrySource, keys: string[], options?: InstallOptions, dialogues?: AddDialogues): Promise<void>;
|
|
17
37
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKrE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,GAAG,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,CAM5G;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAKxF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,aAAa,EAAE,EACxB,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,cAAmB,EAC5B,SAAS,GAAE,YAAiB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
|
package/dist/cli/commands/add.js
CHANGED
|
@@ -9,9 +9,16 @@ import { ConflictDecision, FileState } from "../../installer/types";
|
|
|
9
9
|
import { hashString } from "../../hash/hash";
|
|
10
10
|
import { guardCancel } from "../../utils/prompt";
|
|
11
11
|
import { runDialogueValue } from "../dialogue";
|
|
12
|
+
import { chooseConflict, forkEntry } from "./conflict";
|
|
12
13
|
import { c, lineSuccess, lineWarn, lineInfo } from "../theme";
|
|
13
14
|
const KeysSchema = z.array(z.string());
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* @brief Builds the hasher of a package's current version of each file.
|
|
17
|
+
*
|
|
18
|
+
* @param source - Source of each file's content in the package.
|
|
19
|
+
* @param io - Installer I/O that hashes copied files.
|
|
20
|
+
* @returns Function giving the hash of a file's package content, empty when the package has none.
|
|
21
|
+
*/
|
|
15
22
|
export function latestHashFrom(source, io) {
|
|
16
23
|
return async (file) => {
|
|
17
24
|
const content = await source(file);
|
|
@@ -20,6 +27,12 @@ export function latestHashFrom(source, io) {
|
|
|
20
27
|
return content.kind === "copy" ? io.hashFile(content.sourcePath) : hashString(content.content);
|
|
21
28
|
};
|
|
22
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @brief Builds one picker choice per registry key, labelled with its description.
|
|
32
|
+
*
|
|
33
|
+
* @param registry - Registry whose keys are offered.
|
|
34
|
+
* @returns Choices with the key as value.
|
|
35
|
+
*/
|
|
23
36
|
export function pickerChoices(registry) {
|
|
24
37
|
return Object.entries(registry).map(([key, meta]) => ({
|
|
25
38
|
value: key,
|
|
@@ -27,10 +40,18 @@ export function pickerChoices(registry) {
|
|
|
27
40
|
}));
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
30
|
-
* Installs entries into every target, keeping locally modified files.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
43
|
+
* @brief Installs entries into every target, keeping locally modified files.
|
|
44
|
+
*
|
|
45
|
+
* With no keys and an `onNoValue` dialogue the user picks from the registry. Local
|
|
46
|
+
* changes prompt restore/fork/skip through `onCollision` unless `--force`.
|
|
33
47
|
* The caller resolves keys before and saves each target's store after.
|
|
48
|
+
*
|
|
49
|
+
* @param registry - Entries available to install, by key.
|
|
50
|
+
* @param targets - Destinations to install into.
|
|
51
|
+
* @param source - Source of each entry's files.
|
|
52
|
+
* @param keys - Keys to install; empty to pick from the registry.
|
|
53
|
+
* @param options - Force, dry run and preset answers.
|
|
54
|
+
* @param dialogues - Dialogues for the picker and for local changes.
|
|
34
55
|
*/
|
|
35
56
|
export async function addEntries(registry, targets, source, keys, options = {}, dialogues = {}) {
|
|
36
57
|
const io = createInstallerIO();
|
|
@@ -45,21 +66,23 @@ export async function addEntries(registry, targets, source, keys, options = {},
|
|
|
45
66
|
const meta = registry[key];
|
|
46
67
|
if (!meta)
|
|
47
68
|
continue;
|
|
69
|
+
const installed = get(target.store, key);
|
|
48
70
|
const fileSource = await source(meta);
|
|
49
|
-
const classifications = await classifyFiles(meta.files, target.installDir, recordedHashes(
|
|
50
|
-
let decision = ConflictDecision.Keep;
|
|
71
|
+
const classifications = await classifyFiles(meta.files, target.installDir, recordedHashes(installed), io, latestHashFrom(fileSource, io));
|
|
51
72
|
const hasLocalChanges = classifications.some((cl) => cl.state >= FileState.UserOnly);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
const choice = hasLocalChanges
|
|
74
|
+
? await chooseConflict(dialogues.onCollision, key, installed ?? meta, target, options)
|
|
75
|
+
: { decision: ConflictDecision.Keep };
|
|
76
|
+
if (choice.decision === ConflictDecision.Fork) {
|
|
77
|
+
await forkEntry(target, key, installed ?? meta, choice.forkKey, io);
|
|
78
|
+
continue;
|
|
56
79
|
}
|
|
57
|
-
const result = await applyClassifications(classifications, fileSource, { decision, force: options.force ?? false }, io);
|
|
80
|
+
const result = await applyClassifications(classifications, fileSource, { decision: choice.decision, force: options.force ?? false }, io);
|
|
58
81
|
for (const file of result.missingSource) {
|
|
59
82
|
console.log(lineWarn(`No content for ${c.file(file)} in the package source — skipped`));
|
|
60
83
|
}
|
|
61
84
|
for (const file of result.kept) {
|
|
62
|
-
console.log(lineWarn(`${c.file(file)} has local changes —
|
|
85
|
+
console.log(lineWarn(`${c.file(file)} has local changes — skipped ${chalk.dim(`(use ${c.flag("-f")} to overwrite)`)}`));
|
|
63
86
|
}
|
|
64
87
|
if (result.written.length > 0) {
|
|
65
88
|
console.log(lineSuccess(`Installed ${c.key(key)} ${chalk.dim(`(${result.written.length} file${result.written.length === 1 ? "" : "s"})`)}`));
|
|
@@ -67,8 +90,8 @@ export async function addEntries(registry, targets, source, keys, options = {},
|
|
|
67
90
|
else if (result.kept.length === 0) {
|
|
68
91
|
console.log(lineInfo(`${c.key(key)} — already up to date`));
|
|
69
92
|
}
|
|
70
|
-
//
|
|
71
|
-
//
|
|
93
|
+
// The recorded hashes are the baseline that lets later runs tell user
|
|
94
|
+
// edits from package changes; a skipped file keeps its install-time hash.
|
|
72
95
|
register(target.store, key, { ...meta, files: result.files.map((f) => ({ ...f, version: meta.version })) });
|
|
73
96
|
}
|
|
74
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources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CAAC;QAC9G,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BaseRegistryEntry } from "../../registry/types";
|
|
2
|
+
import { ConflictDecision } from "../../installer/types";
|
|
3
|
+
import type { InstallerIO } from "../../installer/types";
|
|
4
|
+
import type { Dialogue } from "../dialogue";
|
|
5
|
+
import type { InstallInput, InstallOptions, InstallTarget } from "../types";
|
|
6
|
+
/**
|
|
7
|
+
* @brief What to do with one entry that has local changes.
|
|
8
|
+
*
|
|
9
|
+
* @property decision - Keep (skip), Overwrite (restore) or Fork.
|
|
10
|
+
* @property forkKey - Key the entry moves to, on a fork only.
|
|
11
|
+
*/
|
|
12
|
+
export type ConflictChoice = {
|
|
13
|
+
decision: typeof ConflictDecision.Keep | typeof ConflictDecision.Overwrite;
|
|
14
|
+
} | {
|
|
15
|
+
decision: typeof ConflictDecision.Fork;
|
|
16
|
+
forkKey: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @brief Returns the key an installed entry was forked from.
|
|
20
|
+
*
|
|
21
|
+
* @param entry - Installed entry to check.
|
|
22
|
+
* @returns The original key, or `undefined` when the entry is no fork.
|
|
23
|
+
*/
|
|
24
|
+
export declare function forkedFrom(entry: BaseRegistryEntry): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* @brief Asks what to do with `key`, whose files in `target` have local changes: restore, fork or skip.
|
|
27
|
+
*
|
|
28
|
+
* `--force` restores without asking. No dialogue, a cancelled one, or a fork onto a key the target
|
|
29
|
+
* already holds skips.
|
|
30
|
+
*
|
|
31
|
+
* @param dialogue - Asks for the decision; `undefined` skips.
|
|
32
|
+
* @param key - Key of the entry with local changes.
|
|
33
|
+
* @param entry - The entry as installed, or as offered; its `name` seeds the suggested fork key.
|
|
34
|
+
* @param target - Install target the entry is in.
|
|
35
|
+
* @param options - Force flag and preset answers.
|
|
36
|
+
* @returns The decision, with the key a fork moves to.
|
|
37
|
+
*/
|
|
38
|
+
export declare function chooseConflict(dialogue: Dialogue<InstallInput> | undefined, key: string, entry: BaseRegistryEntry, target: InstallTarget, options: InstallOptions): Promise<ConflictChoice>;
|
|
39
|
+
/**
|
|
40
|
+
* @brief Moves `key` in `target` to the local entry `forkKey`: the files `base` lists that are on disk, each
|
|
41
|
+
* with its current hash, and `forkedFrom` naming `key`. Writes no file, so imports of the files keep
|
|
42
|
+
* working.
|
|
43
|
+
*
|
|
44
|
+
* @param target - Install target holding the entry.
|
|
45
|
+
* @param key - Key of the entry being forked.
|
|
46
|
+
* @param base - The entry as installed, or as offered when the target never recorded it
|
|
47
|
+
* @param forkKey - Key the local entry takes.
|
|
48
|
+
* @param io - Installer I/O that hashes the files on disk.
|
|
49
|
+
* @throws {Error} When none of the entry's files is on disk
|
|
50
|
+
*/
|
|
51
|
+
export declare function forkEntry(target: InstallTarget, key: string, base: BaseRegistryEntry, forkKey: string, io: InstallerIO): Promise<void>;
|
|
52
|
+
//# sourceMappingURL=conflict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/conflict.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG5E;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,EAAE,OAAO,gBAAgB,CAAC,IAAI,GAAG,OAAO,gBAAgB,CAAC,SAAS,CAAA;CAAE,GAC9E;IAAE,QAAQ,EAAE,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAMhE;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAGvE;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS,EAC5C,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAkBzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5I"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// packages/core/src/cli/commands/conflict.ts
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { get } from "../../registry/registry.selectors";
|
|
6
|
+
import { register, unregister } from "../../registry/registry.mutations";
|
|
7
|
+
import { ConflictDecision } from "../../installer/types";
|
|
8
|
+
import { runDialogue } from "../dialogue";
|
|
9
|
+
import { c, lineSuccess, lineWarn } from "../theme";
|
|
10
|
+
const SKIP = { decision: ConflictDecision.Keep };
|
|
11
|
+
const ForkSchema = z.object({ forkedFrom: z.string().min(1) });
|
|
12
|
+
/**
|
|
13
|
+
* @brief Returns the key an installed entry was forked from.
|
|
14
|
+
*
|
|
15
|
+
* @param entry - Installed entry to check.
|
|
16
|
+
* @returns The original key, or `undefined` when the entry is no fork.
|
|
17
|
+
*/
|
|
18
|
+
export function forkedFrom(entry) {
|
|
19
|
+
const fork = ForkSchema.safeParse(entry);
|
|
20
|
+
return fork.success ? fork.data.forkedFrom : undefined;
|
|
21
|
+
}
|
|
22
|
+
const ConflictAnswersSchema = z.object({
|
|
23
|
+
conflict: z.union([z.literal(ConflictDecision.Keep), z.literal(ConflictDecision.Overwrite), z.literal(ConflictDecision.Fork)]),
|
|
24
|
+
forkName: z.string().trim().min(1).optional(),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* @brief Asks what to do with `key`, whose files in `target` have local changes: restore, fork or skip.
|
|
28
|
+
*
|
|
29
|
+
* `--force` restores without asking. No dialogue, a cancelled one, or a fork onto a key the target
|
|
30
|
+
* already holds skips.
|
|
31
|
+
*
|
|
32
|
+
* @param dialogue - Asks for the decision; `undefined` skips.
|
|
33
|
+
* @param key - Key of the entry with local changes.
|
|
34
|
+
* @param entry - The entry as installed, or as offered; its `name` seeds the suggested fork key.
|
|
35
|
+
* @param target - Install target the entry is in.
|
|
36
|
+
* @param options - Force flag and preset answers.
|
|
37
|
+
* @returns The decision, with the key a fork moves to.
|
|
38
|
+
*/
|
|
39
|
+
export async function chooseConflict(dialogue, key, entry, target, options) {
|
|
40
|
+
if (options.force === true)
|
|
41
|
+
return { decision: ConflictDecision.Overwrite };
|
|
42
|
+
if (dialogue === undefined)
|
|
43
|
+
return SKIP;
|
|
44
|
+
const input = { key: c.key(key), target: c.target(target.label), forkName: `${entry.name}-local` };
|
|
45
|
+
const record = await runDialogue(dialogue, input, options.answers);
|
|
46
|
+
if (typeof record === "symbol")
|
|
47
|
+
return SKIP;
|
|
48
|
+
const answers = ConflictAnswersSchema.safeParse(record);
|
|
49
|
+
if (!answers.success)
|
|
50
|
+
return SKIP;
|
|
51
|
+
const { conflict, forkName } = answers.data;
|
|
52
|
+
if (conflict !== ConflictDecision.Fork)
|
|
53
|
+
return { decision: conflict };
|
|
54
|
+
if (forkName === undefined)
|
|
55
|
+
return SKIP;
|
|
56
|
+
if (get(target.store, forkName) !== undefined) {
|
|
57
|
+
console.log(lineWarn(`${c.key(forkName)} is already installed — ${c.key(key)} skipped, nothing forked`));
|
|
58
|
+
return SKIP;
|
|
59
|
+
}
|
|
60
|
+
return { decision: ConflictDecision.Fork, forkKey: forkName };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @brief Moves `key` in `target` to the local entry `forkKey`: the files `base` lists that are on disk, each
|
|
64
|
+
* with its current hash, and `forkedFrom` naming `key`. Writes no file, so imports of the files keep
|
|
65
|
+
* working.
|
|
66
|
+
*
|
|
67
|
+
* @param target - Install target holding the entry.
|
|
68
|
+
* @param key - Key of the entry being forked.
|
|
69
|
+
* @param base - The entry as installed, or as offered when the target never recorded it
|
|
70
|
+
* @param forkKey - Key the local entry takes.
|
|
71
|
+
* @param io - Installer I/O that hashes the files on disk.
|
|
72
|
+
* @throws {Error} When none of the entry's files is on disk
|
|
73
|
+
*/
|
|
74
|
+
export async function forkEntry(target, key, base, forkKey, io) {
|
|
75
|
+
const files = [];
|
|
76
|
+
for (const file of base.files) {
|
|
77
|
+
const destPath = path.join(target.installDir, file.path);
|
|
78
|
+
if (io.exists(destPath))
|
|
79
|
+
files.push({ ...file, hash: await io.hashFile(destPath) });
|
|
80
|
+
}
|
|
81
|
+
if (files.length === 0)
|
|
82
|
+
throw new Error(`cannot fork ${key}: none of its files is on disk`);
|
|
83
|
+
const fork = { ...base, forkedFrom: key, files };
|
|
84
|
+
unregister(target.store, key);
|
|
85
|
+
register(target.store, forkKey, fork);
|
|
86
|
+
console.log(lineSuccess(`Forked ${c.key(key)} as ${c.key(forkKey)} ${chalk.dim("— updates leave it alone")}`));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=conflict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict.js","sourceRoot":"","sources":["../../../src/cli/commands/conflict.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,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|
|
4
4
|
import type { SourceRegistry } from "../../installer/sourceRegistry";
|
|
5
5
|
import type { EntrySource, InstallOptions, InstallTarget } from "../types";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @brief An install target together with the manifest that backs its store.
|
|
8
|
+
*
|
|
9
|
+
* @property manifest - Manifest the store is saved to.
|
|
10
|
+
*/
|
|
7
11
|
export interface ManifestTarget extends InstallTarget {
|
|
8
12
|
manifest: InstallManifest;
|
|
9
13
|
}
|
|
10
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @brief What an installer tells the install commands about itself.
|
|
16
|
+
*
|
|
17
|
+
* @property bin - Installer binary, for the hints it prints, e.g. `g3n-skills`.
|
|
18
|
+
* @property noun - What one entry is called, e.g. `skill`.
|
|
19
|
+
* @property entrySchema - Schema installed entries are parsed with.
|
|
20
|
+
* @property fileSource - Where entry files come from; copying out of each source's checkout (`entrySource`) when absent.
|
|
21
|
+
*/
|
|
11
22
|
export interface InstallCommandContext<T extends OriginEntry> {
|
|
12
|
-
/** Installer binary, for the hints it prints, e.g. `g3n-skills` */
|
|
13
23
|
bin: string;
|
|
14
|
-
/** What one entry is called, e.g. `skill` */
|
|
15
24
|
noun: string;
|
|
16
25
|
entrySchema: z.ZodType<T>;
|
|
17
|
-
/** Where entry files come from; copying out of each source's checkout (`entrySource`) when absent */
|
|
18
26
|
fileSource?: (registry: SourceRegistry<T>) => EntrySource;
|
|
19
27
|
}
|
|
20
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* @brief Runs after a target's manifest is saved, with the keys just installed, updated or removed.
|
|
30
|
+
*
|
|
31
|
+
* @param target - Target whose manifest was saved.
|
|
32
|
+
* @param keys - Keys just installed, updated or removed.
|
|
33
|
+
*/
|
|
21
34
|
export type AfterTarget = (target: ManifestTarget, keys: string[]) => void | Promise<void>;
|
|
22
35
|
/**
|
|
23
|
-
* Installs entries or whole groups from a source registry into every target,
|
|
36
|
+
* @brief Installs entries or whole groups from a source registry into every target,
|
|
24
37
|
* each with its dependencies from any source, and saves each manifest. With
|
|
25
|
-
* no names the user picks from what the sources offer.
|
|
38
|
+
* no names the user picks from what the sources offer. A key an installed
|
|
39
|
+
* fork stands in for is not installed.
|
|
26
40
|
*
|
|
27
41
|
* @param names - As typed: `<name>` or `<name>@<source>`, a name being an entry key or a group
|
|
42
|
+
* @param targets - Install targets, each with its manifest.
|
|
43
|
+
* @param registry - Source registry the names are resolved against.
|
|
44
|
+
* @param options - Force, dry run and preset answers.
|
|
45
|
+
* @param context - What the installer calls itself.
|
|
46
|
+
* @param after - Runs after each manifest is saved.
|
|
28
47
|
*/
|
|
29
48
|
export declare function addFromSources<T extends OriginEntry>(targets: readonly ManifestTarget[], names: readonly string[], registry: SourceRegistry<T>, options: InstallOptions, context: InstallCommandContext<T>, after?: AfterTarget): Promise<void>;
|
|
30
49
|
/**
|
|
31
|
-
* Re-installs installed entries from the source each one was installed
|
|
50
|
+
* @brief Re-installs installed entries from the source each one was installed
|
|
32
51
|
* from, at that source's current revision; with no names, everything
|
|
33
|
-
* installed.
|
|
34
|
-
*
|
|
35
|
-
* entry gained since install are
|
|
52
|
+
* installed. Forks are reported and left alone. Names installed in no
|
|
53
|
+
* target are reported first, and the sources are only opened once something
|
|
54
|
+
* is left to update. Dependencies an entry gained since install are
|
|
55
|
+
* reported, not installed.
|
|
36
56
|
*
|
|
57
|
+
* @param targets - Install targets, each with its manifest.
|
|
58
|
+
* @param names - Names to update; empty to update everything installed.
|
|
37
59
|
* @param openRegistry - Opens the source registry; the command disposes it
|
|
60
|
+
* @param options - Force, dry run and preset answers.
|
|
61
|
+
* @param context - What the installer calls itself.
|
|
62
|
+
* @param after - Runs after each manifest is saved.
|
|
38
63
|
*/
|
|
39
64
|
export declare function updateFromSources<T extends OriginEntry>(targets: readonly ManifestTarget[], names: readonly string[], openRegistry: () => Promise<SourceRegistry<T>>, options: InstallOptions, context: InstallCommandContext<T>, after?: AfterTarget): Promise<void>;
|
|
40
65
|
/**
|
|
41
|
-
* Removes installed entries, or whole groups, from every target and saves
|
|
66
|
+
* @brief Removes installed entries, or whole groups, from every target and saves
|
|
42
67
|
* each manifest. Works from the manifests alone, so no source needs to be
|
|
43
68
|
* reachable; installed dependents are offered for removal too. With no names
|
|
44
69
|
* the user picks from what is installed.
|
|
45
70
|
*
|
|
46
71
|
* @param after - Gets the keys a target no longer holds, to clean up what the installer added beside the files
|
|
72
|
+
* @param targets - Install targets, each with its manifest.
|
|
73
|
+
* @param names - Names to remove; empty to pick from what is installed.
|
|
74
|
+
* @param options - Force flag and preset answers.
|
|
75
|
+
* @param context - What the installer calls itself.
|
|
47
76
|
*/
|
|
48
77
|
export declare function removeFromTargets<T extends OriginEntry>(targets: readonly ManifestTarget[], names: readonly string[], options: InstallOptions, context: InstallCommandContext<T>, after?: AfterTarget): Promise<void>;
|
|
49
78
|
//# sourceMappingURL=installFromSources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installFromSources.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/installFromSources.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAMlF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAK3E
|
|
1
|
+
{"version":3,"file":"installFromSources.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/installFromSources.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,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,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACjC,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAoDf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAC3D,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACjC,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { installedEntries, saveInstallManifest } from "../../installer/manifest";
|
|
2
|
-
import { installedOrigins, resolveInstalled, resolveRequests, resolveUpdates } from "../../installer/resolve";
|
|
2
|
+
import { installedForks, installedOrigins, resolveInstalled, resolveRequests, resolveUpdates } from "../../installer/resolve";
|
|
3
3
|
import { entrySource, offerRegistry, offers } from "../../installer/sourceRegistry";
|
|
4
4
|
import { runDialogueValue } from "../dialogue";
|
|
5
|
-
import { cascadeDialogue, incompleteDialogue, notInstalledDialogue,
|
|
5
|
+
import { cascadeDialogue, incompleteDialogue, notInstalledDialogue, conflictDialogue, removeChangedDialogue, selectRemovalDialogue } from "../installDialogues";
|
|
6
6
|
import { pickOffers } from "../pick";
|
|
7
7
|
import { reportResolution } from "../report";
|
|
8
8
|
import { c, lineError, lineInfo, lineWarn } from "../theme";
|
|
9
9
|
import { addEntries } from "./add";
|
|
10
10
|
import { removeEntries } from "./remove";
|
|
11
11
|
import { updateEntries } from "./update";
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* @brief The context's file source for a registry, or a copy out of each source's checkout.
|
|
14
|
+
*
|
|
15
|
+
* @param registry - Source registry the files are read from.
|
|
16
|
+
* @param context - What the installer calls itself.
|
|
17
|
+
* @returns Function giving each entry's files.
|
|
18
|
+
*/
|
|
13
19
|
function filesFrom(registry, context) {
|
|
14
20
|
return context.fileSource?.(registry) ?? entrySource(registry);
|
|
15
21
|
}
|
|
16
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @brief Installed entries of every target, each key once; the first target wins on a clash.
|
|
24
|
+
*
|
|
25
|
+
* @param targets - Targets to read, in priority order.
|
|
26
|
+
* @param schema - Schema installed entries are parsed with.
|
|
27
|
+
* @returns Installed entries by key.
|
|
28
|
+
*/
|
|
17
29
|
function installedAcross(targets, schema) {
|
|
18
30
|
const installed = {};
|
|
19
31
|
for (const target of targets)
|
|
@@ -22,51 +34,84 @@ function installedAcross(targets, schema) {
|
|
|
22
34
|
return installed;
|
|
23
35
|
}
|
|
24
36
|
/**
|
|
25
|
-
* Installs entries or whole groups from a source registry into every target,
|
|
37
|
+
* @brief Installs entries or whole groups from a source registry into every target,
|
|
26
38
|
* each with its dependencies from any source, and saves each manifest. With
|
|
27
|
-
* no names the user picks from what the sources offer.
|
|
39
|
+
* no names the user picks from what the sources offer. A key an installed
|
|
40
|
+
* fork stands in for is not installed.
|
|
28
41
|
*
|
|
29
42
|
* @param names - As typed: `<name>` or `<name>@<source>`, a name being an entry key or a group
|
|
43
|
+
* @param targets - Install targets, each with its manifest.
|
|
44
|
+
* @param registry - Source registry the names are resolved against.
|
|
45
|
+
* @param options - Force, dry run and preset answers.
|
|
46
|
+
* @param context - What the installer calls itself.
|
|
47
|
+
* @param after - Runs after each manifest is saved.
|
|
30
48
|
*/
|
|
31
49
|
export async function addFromSources(targets, names, registry, options, context, after) {
|
|
32
50
|
const available = offers(registry);
|
|
33
51
|
const requested = names.length > 0 ? [...names] : await pickOffers(available, context.noun, options.answers);
|
|
34
52
|
if (requested.length === 0)
|
|
35
53
|
return;
|
|
36
|
-
const
|
|
37
|
-
const resolution = resolveRequests(requested, available,
|
|
54
|
+
const installed = targets.map((t) => installedEntries(t.manifest, context.entrySchema));
|
|
55
|
+
const resolution = resolveRequests(requested, available, installedOrigins(installed));
|
|
38
56
|
await reportResolution(resolution, context, options.answers);
|
|
39
|
-
const
|
|
57
|
+
const forks = installedForks(installed);
|
|
58
|
+
const selected = [...resolution.entries.values()].filter(({ key }) => {
|
|
59
|
+
const fork = forks[key];
|
|
60
|
+
if (fork !== undefined)
|
|
61
|
+
console.log(lineInfo(`${c.key(key)} is forked as ${c.key(fork)} — not installed. Remove the fork to install it.`));
|
|
62
|
+
return fork === undefined;
|
|
63
|
+
});
|
|
64
|
+
if (selected.length === 0)
|
|
65
|
+
return;
|
|
40
66
|
const keys = selected.map((s) => s.key);
|
|
41
|
-
await addEntries(offerRegistry(selected), [...targets], filesFrom(registry, context), keys, options, { onCollision:
|
|
67
|
+
await addEntries(offerRegistry(selected), [...targets], filesFrom(registry, context), keys, options, { onCollision: conflictDialogue });
|
|
42
68
|
for (const target of targets) {
|
|
43
69
|
saveInstallManifest(target.manifest, context.entrySchema);
|
|
44
70
|
await after?.(target, keys);
|
|
45
71
|
}
|
|
46
72
|
}
|
|
47
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* @brief Warns about dependencies an updated entry now has that the target does not hold.
|
|
75
|
+
*
|
|
76
|
+
* @param updated - Offers that were updated.
|
|
77
|
+
* @param installed - Installed entries by key.
|
|
78
|
+
* @param context - What the installer calls itself.
|
|
79
|
+
*/
|
|
48
80
|
function reportNewDependencies(updated, installed, context) {
|
|
81
|
+
const forks = installedForks([installed]);
|
|
49
82
|
for (const { key, entry } of updated) {
|
|
50
|
-
const missing = (entry.registryDependencies ?? []).filter((dep) => installed[dep] === undefined);
|
|
83
|
+
const missing = (entry.registryDependencies ?? []).filter((dep) => installed[dep] === undefined && forks[dep] === undefined);
|
|
51
84
|
if (missing.length > 0) {
|
|
52
85
|
console.log(lineWarn(`${c.key(key)} now depends on ${missing.map((m) => c.key(m)).join(", ")}: run ${c.cmd(`${context.bin} add ${key}`)} to install them`));
|
|
53
86
|
}
|
|
54
87
|
}
|
|
55
88
|
}
|
|
56
89
|
/**
|
|
57
|
-
* Re-installs installed entries from the source each one was installed
|
|
90
|
+
* @brief Re-installs installed entries from the source each one was installed
|
|
58
91
|
* from, at that source's current revision; with no names, everything
|
|
59
|
-
* installed.
|
|
60
|
-
*
|
|
61
|
-
* entry gained since install are
|
|
92
|
+
* installed. Forks are reported and left alone. Names installed in no
|
|
93
|
+
* target are reported first, and the sources are only opened once something
|
|
94
|
+
* is left to update. Dependencies an entry gained since install are
|
|
95
|
+
* reported, not installed.
|
|
62
96
|
*
|
|
97
|
+
* @param targets - Install targets, each with its manifest.
|
|
98
|
+
* @param names - Names to update; empty to update everything installed.
|
|
63
99
|
* @param openRegistry - Opens the source registry; the command disposes it
|
|
100
|
+
* @param options - Force, dry run and preset answers.
|
|
101
|
+
* @param context - What the installer calls itself.
|
|
102
|
+
* @param after - Runs after each manifest is saved.
|
|
64
103
|
*/
|
|
65
104
|
export async function updateFromSources(targets, names, openRegistry, options, context, after) {
|
|
66
105
|
const plans = targets.map((target) => {
|
|
67
106
|
const installed = installedEntries(target.manifest, context.entrySchema);
|
|
68
|
-
|
|
107
|
+
const named = names.length > 0 ? resolveInstalled(names, installed) : { keys: Object.keys(installed), unknown: [] };
|
|
108
|
+
const forks = named.keys.filter((key) => installed[key]?.forkedFrom !== undefined);
|
|
109
|
+
return { target, installed, forks, unknown: named.unknown, keys: named.keys.filter((key) => !forks.includes(key)) };
|
|
69
110
|
});
|
|
111
|
+
for (const { installed, forks } of plans) {
|
|
112
|
+
for (const key of forks)
|
|
113
|
+
console.log(lineInfo(`${c.key(key)} is a fork of ${c.key(installed[key]?.forkedFrom ?? "")} — not updated`));
|
|
114
|
+
}
|
|
70
115
|
const unknown = [...new Set(plans.flatMap((p) => p.unknown))].filter((name) => plans.every((p) => p.unknown.includes(name)));
|
|
71
116
|
if (unknown.length > 0) {
|
|
72
117
|
const list = unknown.map((k) => c.key(k)).join(", ");
|
|
@@ -99,7 +144,7 @@ export async function updateFromSources(targets, names, openRegistry, options, c
|
|
|
99
144
|
if (updated.length === 0)
|
|
100
145
|
continue;
|
|
101
146
|
const keys = updated.map((u) => u.key);
|
|
102
|
-
await updateEntries(offerRegistry(updated), [plan.target], filesFrom(registry, context), keys, options, { onCollision:
|
|
147
|
+
await updateEntries(offerRegistry(updated), [plan.target], filesFrom(registry, context), keys, options, { onCollision: conflictDialogue });
|
|
103
148
|
if (options.dryRun !== true) {
|
|
104
149
|
saveInstallManifest(plan.target.manifest, context.entrySchema);
|
|
105
150
|
await after?.(plan.target, keys);
|
|
@@ -111,12 +156,16 @@ export async function updateFromSources(targets, names, openRegistry, options, c
|
|
|
111
156
|
}
|
|
112
157
|
}
|
|
113
158
|
/**
|
|
114
|
-
* Removes installed entries, or whole groups, from every target and saves
|
|
159
|
+
* @brief Removes installed entries, or whole groups, from every target and saves
|
|
115
160
|
* each manifest. Works from the manifests alone, so no source needs to be
|
|
116
161
|
* reachable; installed dependents are offered for removal too. With no names
|
|
117
162
|
* the user picks from what is installed.
|
|
118
163
|
*
|
|
119
164
|
* @param after - Gets the keys a target no longer holds, to clean up what the installer added beside the files
|
|
165
|
+
* @param targets - Install targets, each with its manifest.
|
|
166
|
+
* @param names - Names to remove; empty to pick from what is installed.
|
|
167
|
+
* @param options - Force flag and preset answers.
|
|
168
|
+
* @param context - What the installer calls itself.
|
|
120
169
|
*/
|
|
121
170
|
export async function removeFromTargets(targets, names, options, context, after) {
|
|
122
171
|
const installed = installedAcross(targets, context.entrySchema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installFromSources.js","sourceRoot":"","sources":["../../../src/cli/commands/installFromSources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGjF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"installFromSources.js","sourceRoot":"","sources":["../../../src/cli/commands/installFromSources.ts"],"names":[],"mappings":"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