@g3nomaly/core 0.2.0 → 0.3.1
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/installFromSources.d.ts +49 -0
- package/dist/cli/commands/installFromSources.d.ts.map +1 -0
- package/dist/cli/commands/installFromSources.js +138 -0
- package/dist/cli/commands/installFromSources.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +11 -0
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +43 -0
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/sources.d.ts +45 -0
- package/dist/cli/commands/sources.d.ts.map +1 -0
- package/dist/cli/commands/sources.js +89 -0
- package/dist/cli/commands/sources.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installDialogues.d.ts +15 -0
- package/dist/cli/installDialogues.d.ts.map +1 -0
- package/dist/cli/installDialogues.js +72 -0
- package/dist/cli/installDialogues.js.map +1 -0
- package/dist/cli/pick.d.ts +14 -0
- package/dist/cli/pick.d.ts.map +1 -0
- package/dist/cli/pick.js +35 -0
- package/dist/cli/pick.js.map +1 -0
- package/dist/cli/report.d.ts +34 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +71 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/config/types.d.ts +0 -16
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +0 -2
- package/dist/config/types.js.map +1 -1
- package/dist/installer/files.d.ts +15 -0
- package/dist/installer/files.d.ts.map +1 -0
- package/dist/installer/files.js +22 -0
- package/dist/installer/files.js.map +1 -0
- package/dist/installer/index.d.ts +13 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +7 -0
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/manifest.d.ts +59 -0
- package/dist/installer/manifest.d.ts.map +1 -0
- package/dist/installer/manifest.js +60 -0
- package/dist/installer/manifest.js.map +1 -0
- package/dist/installer/manifestSources.d.ts +21 -0
- package/dist/installer/manifestSources.d.ts.map +1 -0
- package/dist/installer/manifestSources.js +39 -0
- package/dist/installer/manifestSources.js.map +1 -0
- package/dist/installer/marketplace.d.ts +34 -0
- package/dist/installer/marketplace.d.ts.map +1 -0
- package/dist/installer/marketplace.js +64 -0
- package/dist/installer/marketplace.js.map +1 -0
- package/dist/installer/origin.d.ts +43 -0
- package/dist/installer/origin.d.ts.map +1 -0
- package/dist/installer/origin.js +22 -0
- package/dist/installer/origin.js.map +1 -0
- package/dist/installer/resolve.d.ts +78 -0
- package/dist/installer/resolve.d.ts.map +1 -0
- package/dist/installer/resolve.js +184 -0
- package/dist/installer/resolve.js.map +1 -0
- package/dist/installer/sourceRegistry.d.ts +59 -0
- package/dist/installer/sourceRegistry.d.ts.map +1 -0
- package/dist/installer/sourceRegistry.js +71 -0
- package/dist/installer/sourceRegistry.js.map +1 -0
- package/dist/sources/checkout.d.ts +14 -0
- package/dist/sources/checkout.d.ts.map +1 -0
- package/dist/sources/checkout.js +27 -0
- package/dist/sources/checkout.js.map +1 -0
- package/dist/sources/git.d.ts +9 -0
- package/dist/sources/git.d.ts.map +1 -0
- package/dist/sources/git.js +22 -0
- package/dist/sources/git.js.map +1 -0
- package/dist/sources/index.d.ts +5 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +6 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/local.d.ts +10 -0
- package/dist/sources/local.d.ts.map +1 -0
- package/dist/sources/local.js +20 -0
- package/dist/sources/local.js.map +1 -0
- package/dist/sources/npm.d.ts +13 -0
- package/dist/sources/npm.d.ts.map +1 -0
- package/dist/sources/npm.js +128 -0
- package/dist/sources/npm.js.map +1 -0
- package/dist/sources/packageJson.d.ts +3 -0
- package/dist/sources/packageJson.d.ts.map +1 -0
- package/dist/sources/packageJson.js +13 -0
- package/dist/sources/packageJson.js.map +1 -0
- package/dist/sources/parse.d.ts +34 -0
- package/dist/sources/parse.d.ts.map +1 -0
- package/dist/sources/parse.js +92 -0
- package/dist/sources/parse.js.map +1 -0
- package/dist/sources/process.d.ts +18 -0
- package/dist/sources/process.d.ts.map +1 -0
- package/dist/sources/process.js +43 -0
- package/dist/sources/process.js.map +1 -0
- package/dist/sources/register.d.ts +16 -0
- package/dist/sources/register.d.ts.map +1 -0
- package/dist/sources/register.js +37 -0
- package/dist/sources/register.js.map +1 -0
- package/dist/sources/types.d.ts +73 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +36 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/utils/errors.d.ts +3 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +6 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { InstallManifest } from "../../installer/manifest";
|
|
3
|
+
import type { OriginEntry } from "../../installer/origin";
|
|
4
|
+
import type { SourceRegistry } from "../../installer/sourceRegistry";
|
|
5
|
+
import type { EntrySource, InstallOptions, InstallTarget } from "../types";
|
|
6
|
+
/** An install target together with the manifest that backs its store. */
|
|
7
|
+
export interface ManifestTarget extends InstallTarget {
|
|
8
|
+
manifest: InstallManifest;
|
|
9
|
+
}
|
|
10
|
+
/** What an installer tells the install commands about itself. */
|
|
11
|
+
export interface InstallCommandContext<T extends OriginEntry> {
|
|
12
|
+
/** Installer binary, for the hints it prints, e.g. `g3n-skills` */
|
|
13
|
+
bin: string;
|
|
14
|
+
/** What one entry is called, e.g. `skill` */
|
|
15
|
+
noun: string;
|
|
16
|
+
entrySchema: z.ZodType<T>;
|
|
17
|
+
/** Where entry files come from; copying out of each source's checkout (`entrySource`) when absent */
|
|
18
|
+
fileSource?: (registry: SourceRegistry<T>) => EntrySource;
|
|
19
|
+
}
|
|
20
|
+
/** Runs after a target's manifest is saved, with the keys just installed, updated or removed. */
|
|
21
|
+
export type AfterTarget = (target: ManifestTarget, keys: string[]) => void | Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Installs entries or whole groups from a source registry into every target,
|
|
24
|
+
* each with its dependencies from any source, and saves each manifest. With
|
|
25
|
+
* no names the user picks from what the sources offer.
|
|
26
|
+
*
|
|
27
|
+
* @param names - As typed: `<name>` or `<name>@<source>`, a name being an entry key or a group
|
|
28
|
+
*/
|
|
29
|
+
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
|
+
/**
|
|
31
|
+
* Re-installs installed entries from the source each one was installed
|
|
32
|
+
* from, at that source's current revision; with no names, everything
|
|
33
|
+
* installed. Names installed in no target are reported first, and the
|
|
34
|
+
* sources are only opened once something is left to update. Dependencies an
|
|
35
|
+
* entry gained since install are reported, not installed.
|
|
36
|
+
*
|
|
37
|
+
* @param openRegistry - Opens the source registry; the command disposes it
|
|
38
|
+
*/
|
|
39
|
+
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
|
+
/**
|
|
41
|
+
* Removes installed entries, or whole groups, from every target and saves
|
|
42
|
+
* each manifest. Works from the manifests alone, so no source needs to be
|
|
43
|
+
* reachable; installed dependents are offered for removal too. With no names
|
|
44
|
+
* the user picks from what is installed.
|
|
45
|
+
*
|
|
46
|
+
* @param after - Gets the keys a target no longer holds, to clean up what the installer added beside the files
|
|
47
|
+
*/
|
|
48
|
+
export declare function removeFromTargets<T extends OriginEntry>(targets: readonly ManifestTarget[], names: readonly string[], options: InstallOptions, context: InstallCommandContext<T>, after?: AfterTarget): Promise<void>;
|
|
49
|
+
//# sourceMappingURL=installFromSources.d.ts.map
|
|
@@ -0,0 +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,yEAAyE;AACzE,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,iEAAiE;AACjE,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,WAAW;IAC1D,mEAAmE;IACnE,GAAG,EAAU,MAAM,CAAC;IACpB,6CAA6C;IAC7C,IAAI,EAAS,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,qGAAqG;IACrG,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC;CAC3D;AAED,iGAAiG;AACjG,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAc3F;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,WAAW,EACxD,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACjC,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAYD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAC3D,OAAO,EAAE,SAAS,cAAc,EAAE,EAClC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAC9C,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,EACjC,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CA+Cf;AAED;;;;;;;GAOG;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"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { installedEntries, saveInstallManifest } from "../../installer/manifest";
|
|
2
|
+
import { installedOrigins, resolveInstalled, resolveRequests, resolveUpdates } from "../../installer/resolve";
|
|
3
|
+
import { entrySource, offerRegistry, offers } from "../../installer/sourceRegistry";
|
|
4
|
+
import { runDialogueValue } from "../dialogue";
|
|
5
|
+
import { cascadeDialogue, incompleteDialogue, notInstalledDialogue, overwriteDialogue, removeChangedDialogue, selectRemovalDialogue } from "../installDialogues";
|
|
6
|
+
import { pickOffers } from "../pick";
|
|
7
|
+
import { reportResolution } from "../report";
|
|
8
|
+
import { c, lineError, lineInfo, lineWarn } from "../theme";
|
|
9
|
+
import { addEntries } from "./add";
|
|
10
|
+
import { removeEntries } from "./remove";
|
|
11
|
+
import { updateEntries } from "./update";
|
|
12
|
+
/** The context's file source for a registry, or a copy out of each source's checkout. */
|
|
13
|
+
function filesFrom(registry, context) {
|
|
14
|
+
return context.fileSource?.(registry) ?? entrySource(registry);
|
|
15
|
+
}
|
|
16
|
+
/** Installed entries of every target, each key once; the first target wins on a clash. */
|
|
17
|
+
function installedAcross(targets, schema) {
|
|
18
|
+
const installed = {};
|
|
19
|
+
for (const target of targets)
|
|
20
|
+
for (const [key, entry] of Object.entries(installedEntries(target.manifest, schema)))
|
|
21
|
+
installed[key] ??= entry;
|
|
22
|
+
return installed;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Installs entries or whole groups from a source registry into every target,
|
|
26
|
+
* each with its dependencies from any source, and saves each manifest. With
|
|
27
|
+
* no names the user picks from what the sources offer.
|
|
28
|
+
*
|
|
29
|
+
* @param names - As typed: `<name>` or `<name>@<source>`, a name being an entry key or a group
|
|
30
|
+
*/
|
|
31
|
+
export async function addFromSources(targets, names, registry, options, context, after) {
|
|
32
|
+
const available = offers(registry);
|
|
33
|
+
const requested = names.length > 0 ? [...names] : await pickOffers(available, context.noun, options.answers);
|
|
34
|
+
if (requested.length === 0)
|
|
35
|
+
return;
|
|
36
|
+
const origins = installedOrigins(targets.map((t) => installedEntries(t.manifest, context.entrySchema)));
|
|
37
|
+
const resolution = resolveRequests(requested, available, origins);
|
|
38
|
+
await reportResolution(resolution, context, options.answers);
|
|
39
|
+
const selected = [...resolution.entries.values()];
|
|
40
|
+
const keys = selected.map((s) => s.key);
|
|
41
|
+
await addEntries(offerRegistry(selected), [...targets], filesFrom(registry, context), keys, options, { onCollision: overwriteDialogue });
|
|
42
|
+
for (const target of targets) {
|
|
43
|
+
saveInstallManifest(target.manifest, context.entrySchema);
|
|
44
|
+
await after?.(target, keys);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Warns about dependencies an entry now has that the target does not hold. */
|
|
48
|
+
function reportNewDependencies(updated, installed, context) {
|
|
49
|
+
for (const { key, entry } of updated) {
|
|
50
|
+
const missing = (entry.registryDependencies ?? []).filter((dep) => installed[dep] === undefined);
|
|
51
|
+
if (missing.length > 0) {
|
|
52
|
+
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
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Re-installs installed entries from the source each one was installed
|
|
58
|
+
* from, at that source's current revision; with no names, everything
|
|
59
|
+
* installed. Names installed in no target are reported first, and the
|
|
60
|
+
* sources are only opened once something is left to update. Dependencies an
|
|
61
|
+
* entry gained since install are reported, not installed.
|
|
62
|
+
*
|
|
63
|
+
* @param openRegistry - Opens the source registry; the command disposes it
|
|
64
|
+
*/
|
|
65
|
+
export async function updateFromSources(targets, names, openRegistry, options, context, after) {
|
|
66
|
+
const plans = targets.map((target) => {
|
|
67
|
+
const installed = installedEntries(target.manifest, context.entrySchema);
|
|
68
|
+
return { target, installed, ...(names.length > 0 ? resolveInstalled(names, installed) : { keys: Object.keys(installed), unknown: [] }) };
|
|
69
|
+
});
|
|
70
|
+
const unknown = [...new Set(plans.flatMap((p) => p.unknown))].filter((name) => plans.every((p) => p.unknown.includes(name)));
|
|
71
|
+
if (unknown.length > 0) {
|
|
72
|
+
const list = unknown.map((k) => c.key(k)).join(", ");
|
|
73
|
+
console.error(lineError(`Not installed: ${list}. Run ${c.cmd(`${context.bin} add`)} to install them.`));
|
|
74
|
+
const proceed = plans.some((p) => p.keys.length > 0)
|
|
75
|
+
&& (await runDialogueValue(notInstalledDialogue, { unknown: list }, options.answers)) === true;
|
|
76
|
+
if (!proceed)
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
if (plans.every((p) => p.keys.length === 0)) {
|
|
80
|
+
console.log(lineInfo("Nothing to update."));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const registry = await openRegistry();
|
|
84
|
+
const available = offers(registry);
|
|
85
|
+
const origins = installedOrigins(plans.map((p) => p.installed));
|
|
86
|
+
try {
|
|
87
|
+
for (const plan of plans) {
|
|
88
|
+
if (targets.length > 1)
|
|
89
|
+
console.log(c.header(plan.target.label));
|
|
90
|
+
if (plan.keys.length === 0) {
|
|
91
|
+
console.log(lineInfo("Nothing to update."));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const { offers: updated, missing } = resolveUpdates(plan.keys, plan.installed, available, origins);
|
|
95
|
+
reportNewDependencies(updated, plan.installed, context);
|
|
96
|
+
for (const key of missing) {
|
|
97
|
+
console.log(lineWarn(`${c.key(key)}: its source ${c.key(plan.installed[key]?.origin.source ?? "")} is not registered or no longer offers it, left as is`));
|
|
98
|
+
}
|
|
99
|
+
if (updated.length === 0)
|
|
100
|
+
continue;
|
|
101
|
+
const keys = updated.map((u) => u.key);
|
|
102
|
+
await updateEntries(offerRegistry(updated), [plan.target], filesFrom(registry, context), keys, options, { onCollision: overwriteDialogue });
|
|
103
|
+
if (options.dryRun !== true) {
|
|
104
|
+
saveInstallManifest(plan.target.manifest, context.entrySchema);
|
|
105
|
+
await after?.(plan.target, keys);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
registry.dispose();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Removes installed entries, or whole groups, from every target and saves
|
|
115
|
+
* each manifest. Works from the manifests alone, so no source needs to be
|
|
116
|
+
* reachable; installed dependents are offered for removal too. With no names
|
|
117
|
+
* the user picks from what is installed.
|
|
118
|
+
*
|
|
119
|
+
* @param after - Gets the keys a target no longer holds, to clean up what the installer added beside the files
|
|
120
|
+
*/
|
|
121
|
+
export async function removeFromTargets(targets, names, options, context, after) {
|
|
122
|
+
const installed = installedAcross(targets, context.entrySchema);
|
|
123
|
+
// Unknown names stay in the list so the command reports them as "not installed".
|
|
124
|
+
const { keys, unknown } = resolveInstalled(names, installed);
|
|
125
|
+
const before = targets.map((t) => Object.keys(installedEntries(t.manifest, context.entrySchema)));
|
|
126
|
+
await removeEntries(installed, [...targets], [...keys, ...unknown], options, {
|
|
127
|
+
onNoValue: selectRemovalDialogue(context.noun),
|
|
128
|
+
onCascade: cascadeDialogue,
|
|
129
|
+
onCollision: removeChangedDialogue,
|
|
130
|
+
onIncomplete: incompleteDialogue,
|
|
131
|
+
});
|
|
132
|
+
for (const [index, target] of targets.entries()) {
|
|
133
|
+
saveInstallManifest(target.manifest, context.entrySchema);
|
|
134
|
+
const still = installedEntries(target.manifest, context.entrySchema);
|
|
135
|
+
await after?.(target, (before[index] ?? []).filter((key) => still[key] === undefined));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=installFromSources.js.map
|
|
@@ -0,0 +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;AAC9G,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjK,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,QAA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AAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACrE,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { BaseRegistry } from "../../registry/types";
|
|
2
2
|
import type { LSOptions } from "../types";
|
|
3
|
+
import type { OriginEntry } from "../../installer/origin";
|
|
4
|
+
import type { SourceRegistry } from "../../installer/sourceRegistry";
|
|
5
|
+
import type { RegisteredSource } from "../../sources/types";
|
|
3
6
|
/** Lists the entries of a registry, grouped by each entry's `group`. */
|
|
4
7
|
export declare function lsEntries(registry: BaseRegistry, options?: LSOptions): void;
|
|
8
|
+
/**
|
|
9
|
+
* Lists what each source of a source registry offers: a header per source
|
|
10
|
+
* with where it comes from when `sources` holds its spec, then its entries by group, `●` marking the ones
|
|
11
|
+
* `installed` holds. With `json`, prints every offer as `{ key, ...entry }`.
|
|
12
|
+
*
|
|
13
|
+
* @param installed - Installed entries by key, to mark; empty to mark nothing
|
|
14
|
+
*/
|
|
15
|
+
export declare function lsSourceRegistry<T extends OriginEntry>(registry: SourceRegistry<T>, sources: readonly RegisteredSource[], installed: Record<string, OriginEntry>, options?: LSOptions): void;
|
|
5
16
|
//# sourceMappingURL=ls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,GAAE,SAAc,GAAG,IAAI,CAiB/E;AASD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EACpD,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,SAAS,gBAAgB,EAAE,EACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,OAAO,GAAE,SAAc,GACtB,IAAI,CAwBN"}
|
package/dist/cli/commands/ls.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// packages/core/src/cli/commands/ls.ts
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { c } from "../theme";
|
|
4
|
+
import { offers } from "../../installer/sourceRegistry";
|
|
5
|
+
import { describeSource } from "../../sources/checkout";
|
|
4
6
|
/** Lists the entries of a registry, grouped by each entry's `group`. */
|
|
5
7
|
export function lsEntries(registry, options = {}) {
|
|
6
8
|
if (options.json === true) {
|
|
@@ -19,4 +21,45 @@ export function lsEntries(registry, options = {}) {
|
|
|
19
21
|
console.log();
|
|
20
22
|
}
|
|
21
23
|
}
|
|
24
|
+
/** ` at <commit>` or ` v<version>` of the checkout an entry was read from. */
|
|
25
|
+
function revision(origin) {
|
|
26
|
+
if (origin?.commit !== undefined)
|
|
27
|
+
return ` at ${origin.commit.slice(0, 7)}`;
|
|
28
|
+
if (origin?.version !== undefined)
|
|
29
|
+
return ` v${origin.version}`;
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Lists what each source of a source registry offers: a header per source
|
|
34
|
+
* with where it comes from when `sources` holds its spec, then its entries by group, `●` marking the ones
|
|
35
|
+
* `installed` holds. With `json`, prints every offer as `{ key, ...entry }`.
|
|
36
|
+
*
|
|
37
|
+
* @param installed - Installed entries by key, to mark; empty to mark nothing
|
|
38
|
+
*/
|
|
39
|
+
export function lsSourceRegistry(registry, sources, installed, options = {}) {
|
|
40
|
+
if (options.json === true) {
|
|
41
|
+
console.log(JSON.stringify(offers(registry).map(({ key, entry }) => ({ key, ...entry })), null, 2));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
for (const [name, store] of registry.sources) {
|
|
45
|
+
const listed = Object.entries(store.store.state).sort(([a], [b]) => a.localeCompare(b));
|
|
46
|
+
if (listed.length === 0)
|
|
47
|
+
continue;
|
|
48
|
+
const spec = sources.find((s) => s.name === name)?.spec;
|
|
49
|
+
const from = spec === undefined ? "" : describeSource(spec);
|
|
50
|
+
console.log(chalk.bold(`${name} ${chalk.dim(`${from}${revision(listed[0]?.[1].origin)}`)}`));
|
|
51
|
+
const byGroup = {};
|
|
52
|
+
for (const [key, entry] of listed)
|
|
53
|
+
(byGroup[entry.group ?? "default"] ??= []).push([key, entry]);
|
|
54
|
+
for (const group of Object.keys(byGroup).sort()) {
|
|
55
|
+
console.log(c.header(group));
|
|
56
|
+
for (const [key, entry] of byGroup[group] ?? []) {
|
|
57
|
+
const mark = installed[key]?.origin.source === name ? chalk.green("●") : " ";
|
|
58
|
+
const label = `${c.key(key)} ${chalk.dim(entry.version ?? "")}`;
|
|
59
|
+
console.log(` ${mark} ${label.padEnd(40)} ${chalk.dim(entry.description ?? "")}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
console.log();
|
|
63
|
+
}
|
|
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AK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC9E,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;gBAChE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YACrF,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { OriginEntry } from "../../installer/origin";
|
|
3
|
+
import type { ReadSource } from "../../installer/sourceRegistry";
|
|
4
|
+
import type { SourceRecord } from "../../sources/types";
|
|
5
|
+
import type { ManifestTarget } from "./installFromSources";
|
|
6
|
+
/** What an installer tells the source commands about itself. */
|
|
7
|
+
export interface SourceCommandContext<T extends OriginEntry> {
|
|
8
|
+
/** Installer binary, for the hints it prints, e.g. `g3n-skills` */
|
|
9
|
+
bin: string;
|
|
10
|
+
/** What one entry is called, e.g. `skill` */
|
|
11
|
+
noun: string;
|
|
12
|
+
builtins: SourceRecord;
|
|
13
|
+
entrySchema: z.ZodType<T>;
|
|
14
|
+
readSource: ReadSource<T>;
|
|
15
|
+
/** Absolute root that local source paths and the `node_modules` lookup start from */
|
|
16
|
+
projectRoot: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SourceAddOptions {
|
|
19
|
+
/** Name to register under; derived from the source when absent */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Branch or tag a git source is pinned to */
|
|
22
|
+
ref?: string;
|
|
23
|
+
/** Store a local path absolute instead of relative to the project root, for a manifest every project shares */
|
|
24
|
+
absolutePaths?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Registers a git repository, npm package or local folder as a source in
|
|
28
|
+
* every manifest, after checking it can be read and offers at least one entry.
|
|
29
|
+
*
|
|
30
|
+
* @param input - The source as typed, e.g. `owner/repo`, `npm:@scope/pkg` or `./folder`
|
|
31
|
+
*/
|
|
32
|
+
export declare function addSourceEntries<T extends OriginEntry>(manifests: readonly ManifestTarget[], input: string, options: SourceAddOptions, context: SourceCommandContext<T>): Promise<void>;
|
|
33
|
+
/** Lists each manifest's sources, built-in ones first, with how many installed entries came from each. */
|
|
34
|
+
export declare function lsSources<T extends OriginEntry>(manifests: readonly ManifestTarget[], options: {
|
|
35
|
+
json?: boolean;
|
|
36
|
+
}, context: Pick<SourceCommandContext<T>, "builtins" | "entrySchema">): void;
|
|
37
|
+
/**
|
|
38
|
+
* Unregisters a source from every manifest that has it. Refused for built-in
|
|
39
|
+
* sources, and while installed entries came from it unless `force` is set;
|
|
40
|
+
* forced, those entries stay installed but can no longer be updated.
|
|
41
|
+
*/
|
|
42
|
+
export declare function removeSourceEntries<T extends OriginEntry>(manifests: readonly ManifestTarget[], name: string, options: {
|
|
43
|
+
force?: boolean;
|
|
44
|
+
}, context: Pick<SourceCommandContext<T>, "bin" | "noun" | "builtins" | "entrySchema">): void;
|
|
45
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/sources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,s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O,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC,GAClF,IAAI,CAmBN"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// packages/core/src/cli/commands/sources.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { installedEntries, saveInstallManifest } from "../../installer/manifest";
|
|
4
|
+
import { manifestSources, registerSource, unregisterSource } from "../../installer/manifestSources";
|
|
5
|
+
import { loadSourceRegistry } from "../../installer/sourceRegistry";
|
|
6
|
+
import { describeSource } from "../../sources/checkout";
|
|
7
|
+
import { anchorLocalSpec, defaultSourceName, parseSourceSpec } from "../../sources/parse";
|
|
8
|
+
import { orExit, reportSourceRegistry } from "../report";
|
|
9
|
+
import { c, lineError, lineInfo, lineSuccess } from "../theme";
|
|
10
|
+
/**
|
|
11
|
+
* Registers a git repository, npm package or local folder as a source in
|
|
12
|
+
* every manifest, after checking it can be read and offers at least one entry.
|
|
13
|
+
*
|
|
14
|
+
* @param input - The source as typed, e.g. `owner/repo`, `npm:@scope/pkg` or `./folder`
|
|
15
|
+
*/
|
|
16
|
+
export async function addSourceEntries(manifests, input, options, context) {
|
|
17
|
+
const parsed = orExit(() => parseSourceSpec(input, { ref: options.ref }));
|
|
18
|
+
const spec = anchorLocalSpec(parsed, process.cwd(), options.absolutePaths === true ? null : context.projectRoot);
|
|
19
|
+
const name = options.name ?? orExit(() => defaultSourceName(spec));
|
|
20
|
+
const files = manifests.map((m) => m.manifest);
|
|
21
|
+
// A dry run on copies rejects a taken name before the source is fetched.
|
|
22
|
+
orExit(() => registerSource(files.map((m) => ({ ...m })), name, spec, context.builtins));
|
|
23
|
+
const registry = await loadSourceRegistry([{ name, spec, builtin: false }], context.projectRoot, context.readSource);
|
|
24
|
+
try {
|
|
25
|
+
reportSourceRegistry(registry);
|
|
26
|
+
const keys = Object.keys(registry.sources.get(name)?.store.state ?? {}).sort();
|
|
27
|
+
if (registry.failed.length > 0)
|
|
28
|
+
process.exit(1);
|
|
29
|
+
if (keys.length === 0) {
|
|
30
|
+
console.error(lineError(`${c.key(name)} offers no ${context.noun}s, nothing registered`));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
registerSource(files, name, spec, context.builtins);
|
|
34
|
+
for (const manifest of files)
|
|
35
|
+
saveInstallManifest(manifest, context.entrySchema);
|
|
36
|
+
console.log(lineSuccess(`Registered ${c.key(name)} ${chalk.dim(`(${describeSource(spec)})`)} with ${keys.length} ${context.noun}(s): ${keys.map((k) => c.key(k)).join(", ")}`));
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
registry.dispose();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Lists each manifest's sources, built-in ones first, with how many installed entries came from each. */
|
|
43
|
+
export function lsSources(manifests, options, context) {
|
|
44
|
+
const listing = manifests.map(({ label, manifest }) => {
|
|
45
|
+
const installed = Object.values(installedEntries(manifest, context.entrySchema));
|
|
46
|
+
return {
|
|
47
|
+
target: label,
|
|
48
|
+
sources: manifestSources([manifest], context.builtins).map((source) => ({
|
|
49
|
+
...source,
|
|
50
|
+
installed: installed.filter((entry) => entry.origin.source === source.name).length,
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
if (options.json === true) {
|
|
55
|
+
console.log(JSON.stringify(listing, null, 2));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
for (const { target, sources } of listing) {
|
|
59
|
+
if (listing.length > 1)
|
|
60
|
+
console.log(c.header(target));
|
|
61
|
+
for (const source of sources) {
|
|
62
|
+
const tag = source.builtin ? chalk.dim(" (built in)") : "";
|
|
63
|
+
console.log(` ${c.key(source.name.padEnd(20))} ${describeSource(source.spec)}${tag} ${chalk.dim(`${source.installed} installed`)}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Unregisters a source from every manifest that has it. Refused for built-in
|
|
69
|
+
* sources, and while installed entries came from it unless `force` is set;
|
|
70
|
+
* forced, those entries stay installed but can no longer be updated.
|
|
71
|
+
*/
|
|
72
|
+
export function removeSourceEntries(manifests, name, options, context) {
|
|
73
|
+
const files = manifests.map((m) => m.manifest);
|
|
74
|
+
// A dry run on copies rejects a built-in or unknown name before the installed entries are checked.
|
|
75
|
+
orExit(() => unregisterSource(files.map((m) => ({ ...m })), name, context.builtins));
|
|
76
|
+
const fromSource = [...new Set(files.flatMap((manifest) => Object.entries(installedEntries(manifest, context.entrySchema)).filter(([, entry]) => entry.origin.source === name).map(([key]) => key)))].sort();
|
|
77
|
+
if (fromSource.length > 0 && options.force !== true) {
|
|
78
|
+
console.error(lineError(`Installed from ${c.key(name)}: ${fromSource.map((k) => c.key(k)).join(", ")}. ` +
|
|
79
|
+
`Remove those ${context.noun}s first with ${c.cmd(`${context.bin} remove ${fromSource.join(" ")}`)}, or pass ${c.flag("-f")} to keep them without updates.`));
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
unregisterSource(files, name, context.builtins);
|
|
83
|
+
for (const manifest of files)
|
|
84
|
+
saveInstallManifest(manifest, context.entrySchema);
|
|
85
|
+
console.log(lineSuccess(`Unregistered ${c.key(name)}`));
|
|
86
|
+
if (fromSource.length > 0)
|
|
87
|
+
console.log(lineInfo(`Still installed, without updates: ${fromSource.map((k) => c.key(k)).join(", ")}`));
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/cli/commands/sources.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iC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
|
|
|
7
7
|
export { removeEntries } from "./commands/remove";
|
|
8
8
|
export { lsEntries } from "./commands/ls";
|
|
9
9
|
export { c, sym, lineSuccess, lineWarn, lineInfo, lineError } from "./theme";
|
|
10
|
+
export { reportSourceRegistry, orExit, reportResolution, entryNotFoundDialogue, narrowSources } from "./report";
|
|
11
|
+
export type { ResolutionContext } from "./report";
|
|
12
|
+
export { lsSourceRegistry } from "./commands/ls";
|
|
13
|
+
export { addSourceEntries, lsSources, removeSourceEntries } from "./commands/sources";
|
|
14
|
+
export type { SourceCommandContext, SourceAddOptions } from "./commands/sources";
|
|
15
|
+
export { pickOffers, selectEntriesDialogue } from "./pick";
|
|
16
|
+
export { overwriteDialogue, removeChangedDialogue, cascadeDialogue, incompleteDialogue, selectRemovalDialogue, notInstalledDialogue } from "./installDialogues";
|
|
17
|
+
export { addFromSources, updateFromSources, removeFromTargets } from "./commands/installFromSources";
|
|
18
|
+
export type { ManifestTarget, InstallCommandContext, AfterTarget } from "./commands/installFromSources";
|
|
10
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACpE,YAAY,EACV,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAC/D,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,GACnD,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAA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AChF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC/J,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACpG,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -7,4 +7,10 @@ export { updateEntries } from "./commands/update";
|
|
|
7
7
|
export { removeEntries } from "./commands/remove";
|
|
8
8
|
export { lsEntries } from "./commands/ls";
|
|
9
9
|
export { c, sym, lineSuccess, lineWarn, lineInfo, lineError } from "./theme";
|
|
10
|
+
export { reportSourceRegistry, orExit, reportResolution, entryNotFoundDialogue, narrowSources } from "./report";
|
|
11
|
+
export { lsSourceRegistry } from "./commands/ls";
|
|
12
|
+
export { addSourceEntries, lsSources, removeSourceEntries } from "./commands/sources";
|
|
13
|
+
export { pickOffers, selectEntriesDialogue } from "./pick";
|
|
14
|
+
export { overwriteDialogue, removeChangedDialogue, cascadeDialogue, incompleteDialogue, selectRemovalDialogue, notInstalledDialogue } from "./installDialogues";
|
|
15
|
+
export { addFromSources, updateFromSources, removeFromTargets } from "./commands/installFromSources";
|
|
10
16
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKpE,O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kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC/J,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Dialogue } from "./dialogue";
|
|
2
|
+
import type { InstallInput } from "./types";
|
|
3
|
+
/** Keep or overwrite an entry with local changes, for `add` and `update`; step id `conflict`. */
|
|
4
|
+
export declare const overwriteDialogue: Dialogue<InstallInput>;
|
|
5
|
+
/** Keep or remove an entry with local changes, for `remove`; step id `conflict`. */
|
|
6
|
+
export declare const removeChangedDialogue: Dialogue<InstallInput>;
|
|
7
|
+
/** Whether to remove the installed entries that depend on one being removed; step id `cascade`. */
|
|
8
|
+
export declare const cascadeDialogue: Dialogue<InstallInput>;
|
|
9
|
+
/** Whether to remove an entry with files already missing on disk; step id `incomplete`. */
|
|
10
|
+
export declare const incompleteDialogue: Dialogue<InstallInput>;
|
|
11
|
+
/** Which installed entries to remove when none were named; step id `selectEntries`. */
|
|
12
|
+
export declare function selectRemovalDialogue(noun: string): Dialogue<InstallInput>;
|
|
13
|
+
/** Whether to go on when some names given to `update` are not installed; step id `entryNotFound`. */
|
|
14
|
+
export declare const notInstalledDialogue: Dialogue<InstallInput>;
|
|
15
|
+
//# sourceMappingURL=installDialogues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installDialogues.d.ts","sourceRoot":"","sources":["../../src/cli/installDialogues.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,YAAY,CAWpD,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAWxD,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,YAAY,CAQlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,YAAY,CAQrD,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED,qGAAqG;AACrG,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,YAAY,CAQvD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// packages/core/src/cli/installDialogues.ts
|
|
2
|
+
import { ConflictDecision } from "../installer/types";
|
|
3
|
+
import { StepKind } from "./dialogue";
|
|
4
|
+
/** Keep or overwrite an entry with local changes, for `add` and `update`; step id `conflict`. */
|
|
5
|
+
export const overwriteDialogue = {
|
|
6
|
+
steps: {
|
|
7
|
+
conflict: {
|
|
8
|
+
kind: StepKind.Select,
|
|
9
|
+
message: "{key} ({target}) has local changes. What would you like to do?",
|
|
10
|
+
choices: [
|
|
11
|
+
{ value: ConflictDecision.Keep, label: "Keep my changes: skip modified files" },
|
|
12
|
+
{ value: ConflictDecision.Overwrite, label: "Overwrite with the source version" },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
/** Keep or remove an entry with local changes, for `remove`; step id `conflict`. */
|
|
18
|
+
export const removeChangedDialogue = {
|
|
19
|
+
steps: {
|
|
20
|
+
conflict: {
|
|
21
|
+
kind: StepKind.Select,
|
|
22
|
+
message: "{key} ({target}) has local changes. What would you like to do?",
|
|
23
|
+
choices: [
|
|
24
|
+
{ value: ConflictDecision.Keep, label: "Keep it: remove nothing" },
|
|
25
|
+
{ value: ConflictDecision.Overwrite, label: "Remove it anyway, including my changes" },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
/** Whether to remove the installed entries that depend on one being removed; step id `cascade`. */
|
|
31
|
+
export const cascadeDialogue = {
|
|
32
|
+
steps: {
|
|
33
|
+
cascade: {
|
|
34
|
+
kind: StepKind.Confirm,
|
|
35
|
+
message: "Also remove {dependents}?",
|
|
36
|
+
initial: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/** Whether to remove an entry with files already missing on disk; step id `incomplete`. */
|
|
41
|
+
export const incompleteDialogue = {
|
|
42
|
+
steps: {
|
|
43
|
+
incomplete: {
|
|
44
|
+
kind: StepKind.Confirm,
|
|
45
|
+
message: "{key} ({target}) is missing {missing} on disk. Remove the rest and untrack it?",
|
|
46
|
+
initial: true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/** Which installed entries to remove when none were named; step id `selectEntries`. */
|
|
51
|
+
export function selectRemovalDialogue(noun) {
|
|
52
|
+
return {
|
|
53
|
+
steps: {
|
|
54
|
+
selectEntries: {
|
|
55
|
+
kind: StepKind.MultiSelect,
|
|
56
|
+
message: `Select ${noun}s to remove:`,
|
|
57
|
+
choices: (input) => input.keyChoices ?? [],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Whether to go on when some names given to `update` are not installed; step id `entryNotFound`. */
|
|
63
|
+
export const notInstalledDialogue = {
|
|
64
|
+
steps: {
|
|
65
|
+
entryNotFound: {
|
|
66
|
+
kind: StepKind.Confirm,
|
|
67
|
+
message: "Not installed: {unknown}. Continue with the remaining selection?",
|
|
68
|
+
initial: false,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=installDialogues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installDialogues.js","sourceRoot":"","sources":["../../src/cli/installDialogues.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM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KAAK,EAAE;YACL,aAAa,EAAE;gBACb,IAAI,EAAK,QAAQ,CAAC,WAAW;gBAC7B,OAAO,EAAE,UAAU,IAAI,cAAc;gBACrC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE;aAC3C;SACF;KACF,CAAC;AACJ,CAAC;AAED,qGAAqG;AACrG,MAAM,CAAC,MAAM,oBAAoB,GAA2B;IAC1D,KAAK,EAAE;QACL,aAAa,EAAE;YACb,IAAI,EAAK,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,kEAAkE;YAC3E,OAAO,EAAE,KAAK;SACf;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OriginEntry } from "../installer/origin";
|
|
2
|
+
import type { SourceOffer } from "../installer/sourceRegistry";
|
|
3
|
+
import type { Dialogue, DialogueAnswers } from "./dialogue";
|
|
4
|
+
import type { InstallInput } from "./types";
|
|
5
|
+
/** The multi-select `pickOffers` asks through, by step id `selectEntries`, for preset answers. */
|
|
6
|
+
export declare function selectEntriesDialogue(noun: string): Dialogue<InstallInput>;
|
|
7
|
+
/**
|
|
8
|
+
* Asks which offers to install, each as `<key>@<source>`, so two sources
|
|
9
|
+
* offering one key stay apart. Exits when the prompt is cancelled.
|
|
10
|
+
*
|
|
11
|
+
* @returns the picked requests, e.g. `["emphasise@g3n-skills"]`
|
|
12
|
+
*/
|
|
13
|
+
export declare function pickOffers<T extends OriginEntry>(available: readonly SourceOffer<T>[], noun: string, answers?: DialogueAnswers): Promise<string[]>;
|
|
14
|
+
//# sourceMappingURL=pick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../src/cli/pick.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C,kGAAkG;AAClG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,SAAS,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQxJ"}
|