@g3nomaly/core 0.3.1 → 0.3.3
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 +122 -0
- 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
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @g3nomaly/core
|
|
2
|
+
|
|
3
|
+
`@g3nomaly/core` is the shared runtime behind the g3n installers: [`@g3nomaly/ui`](https://www.npmjs.com/package/@g3nomaly/ui), [`@g3nomaly/mods`](https://www.npmjs.com/package/@g3nomaly/mods) and [`@g3nomaly/skills`](https://www.npmjs.com/package/@g3nomaly/skills). It reads sources from git, npm or a local folder, copies entries into a project, records them in an install manifest and runs the `add`, `update`, `remove`, `ls` and `source` commands those installers share. Use it to build an installer of your own, or to reuse one piece, such as file hashing or the `.g3n.config.json` loader.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- [Bun](https://bun.sh). Core calls `Bun.file` and `Bun.Transpiler`, so it does not run on Node.
|
|
8
|
+
- A CLI or script. `hash` and `config` throw when loaded in a browser.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
bun add @g3nomaly/core
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What each import gives you
|
|
15
|
+
|
|
16
|
+
Import from a subpath. The package root exports nothing.
|
|
17
|
+
|
|
18
|
+
| Import | What it gives you |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `@g3nomaly/core/hash` | SHA-256 of a file or a string, full or 12 characters |
|
|
21
|
+
| `@g3nomaly/core/registry` | A typed registry of entries on a TanStack Store, saved as `.ts` or `.json`, and the base entry schemas |
|
|
22
|
+
| `@g3nomaly/core/config` | Read and write `.g3n.config.json`, with defaults for every section |
|
|
23
|
+
| `@g3nomaly/core/security` | `getSafeObject`, which reads the object a `.ts` file exports without importing the file |
|
|
24
|
+
| `@g3nomaly/core/sources` | Parse `owner/repo`, `npm:pkg` or `./folder` into a source spec and check it out to a folder |
|
|
25
|
+
| `@g3nomaly/core/installer` | Install manifests, reading every source into one registry, resolving names and dependencies, copying files |
|
|
26
|
+
| `@g3nomaly/core/cli` | The shared commands, the prompts they ask, and the terminal theme |
|
|
27
|
+
| `@g3nomaly/core/utils` | `findGitRoot`, `findUp`, `readPackageMeta`, `warnIfOutdated`, `errorMessage` |
|
|
28
|
+
|
|
29
|
+
## Hashes and registries
|
|
30
|
+
|
|
31
|
+
An installer hashes each file it copies, so a later `update` can tell which files you changed.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { hashFile } from "@g3nomaly/core/hash";
|
|
35
|
+
import { createRegistryStore, flush, jsonHandler, load, register } from "@g3nomaly/core/registry";
|
|
36
|
+
|
|
37
|
+
const registry = createRegistryStore({ filePath: "/home/me/app/.installed.json", handler: jsonHandler });
|
|
38
|
+
await load(registry); // a missing file leaves the store empty
|
|
39
|
+
|
|
40
|
+
register(registry, "button", {
|
|
41
|
+
name: "button",
|
|
42
|
+
files: [{ path: "button.tsx", type: "component", hash: await hashFile("/home/me/app/src/button.tsx") }],
|
|
43
|
+
});
|
|
44
|
+
flush(registry); // writes the entries back, sorted by key
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`registry.store` is the TanStack Store itself, so you can subscribe to it. Without a handler, `flush` writes a `.ts` file that exports `registry`. Packages add their own fields by extending `BaseRegistryEntrySchema` and `BaseFileEntrySchema`.
|
|
48
|
+
|
|
49
|
+
## Project config
|
|
50
|
+
|
|
51
|
+
`.g3n.config.json` holds one section per package: `g3nui`, `g3nerate` and `skills`. `loadConfig` fills in every default. `saveConfig` writes only the sections already in the file or named in the update, so one package's `init` never writes another package's section.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { loadConfig, resolveProjectRoot, saveConfig } from "@g3nomaly/core/config";
|
|
55
|
+
|
|
56
|
+
const root = resolveProjectRoot() ?? process.cwd(); // nearest folder with .g3n.config.json or .git
|
|
57
|
+
const { skills } = await loadConfig(root);
|
|
58
|
+
await saveConfig(root, { skills: { settings: { targets: ["claude", "codex"] } } });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Reading a `.ts` file safely
|
|
62
|
+
|
|
63
|
+
`getSafeObject(filePath, schema, timeoutMs = 1000)` takes the object literal a file exports, evaluates it in a worker and checks the result against the zod schema. It refuses source with `eval`, dynamic `import()` or a nested-quantifier regex, and a result holding functions or too many keys. It drops getters without running them.
|
|
64
|
+
|
|
65
|
+
## Building an installer
|
|
66
|
+
|
|
67
|
+
An installer supplies three things: a zod schema for its entries, a function that reads the entries in one checked-out source, and the folder they install into.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import path from "node:path";
|
|
71
|
+
import { z } from "zod";
|
|
72
|
+
import { BaseFileEntrySchema } from "@g3nomaly/core/registry";
|
|
73
|
+
import { listFiles, loadInstallManifest, loadSourceRegistry, manifestSources, OriginEntrySchema, type ReadSource } from "@g3nomaly/core/installer";
|
|
74
|
+
import { addFromSources, reportSourceRegistry } from "@g3nomaly/core/cli";
|
|
75
|
+
|
|
76
|
+
const PromptSchema = OriginEntrySchema.extend({
|
|
77
|
+
files: z.array(BaseFileEntrySchema.extend({ type: z.literal("prompt") })).min(1),
|
|
78
|
+
});
|
|
79
|
+
type Prompt = z.infer<typeof PromptSchema>;
|
|
80
|
+
|
|
81
|
+
// Each file under prompts/ in a source is one entry.
|
|
82
|
+
const readPrompts: ReadSource<Prompt> = async (checkout) => ({
|
|
83
|
+
entries: listFiles(path.join(checkout.dir, "prompts")).map((file): [string, Prompt] => {
|
|
84
|
+
const name = path.basename(file, ".md");
|
|
85
|
+
return [name, {
|
|
86
|
+
name,
|
|
87
|
+
origin: { source: checkout.name, dir: "prompts", commit: checkout.commit, version: checkout.version },
|
|
88
|
+
files: [{ path: file, type: "prompt" }],
|
|
89
|
+
}];
|
|
90
|
+
}),
|
|
91
|
+
warnings: [],
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const root = "/home/me/app";
|
|
95
|
+
const manifest = loadInstallManifest(path.join(root, ".prompts.json"), PromptSchema);
|
|
96
|
+
const target = { label: "project", installDir: path.join(root, "prompts"), store: manifest.store, manifest };
|
|
97
|
+
const builtins = { "my-prompts": { kind: "git" as const, url: "https://github.com/me/prompts.git" } };
|
|
98
|
+
|
|
99
|
+
const registry = await loadSourceRegistry(manifestSources([manifest], builtins), root, readPrompts);
|
|
100
|
+
reportSourceRegistry(registry); // prints warnings and the sources that failed to load
|
|
101
|
+
try {
|
|
102
|
+
await addFromSources([target], ["review"], registry, {}, { bin: "my-prompts", noun: "prompt", entrySchema: PromptSchema });
|
|
103
|
+
} finally {
|
|
104
|
+
registry.dispose(); // removes temporary checkouts
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`addFromSources` resolves `review` or `review@my-prompts` across every source, installs its `registryDependencies`, asks before it overwrites a file you changed, and saves `.prompts.json`. `updateFromSources`, `removeFromTargets`, `addSourceEntries`, `lsSources`, `removeSourceEntries`, `lsSourceRegistry` and `lsEntries` cover the other commands. The CLI of [`@g3nomaly/mods`](https://www.npmjs.com/package/@g3nomaly/mods) is a working example, built from these calls.
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
Run `bun install` at the repository root first, then every command from this directory.
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
bun run build # dist/
|
|
116
|
+
bun run typecheck
|
|
117
|
+
bun test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Elastic License 2.0. See `LICENSE`.
|
|
@@ -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":["../../../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,OA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CAAC;YAC1H,CAAC;YACD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,QAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/I,CAAC;iBAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;YAC9D,CAAC;YAED,sEAAsE;YACtE,0EAA0E;YAC1E,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,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,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAYpD,MAAM,IAAI,GAAmB,EAAE,QAAQ,EAAE,gBAAgB,CAAC,IAAI,EAAE,CAAC;A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AAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,gCAAgC,CAAC,CAAC;IAE5F,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACjD,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC,CAAC;AACjH,CAAC"}
|
|
@@ -3,47 +3,76 @@ import type { InstallManifest } from "../../installer/manifest";
|
|
|
3
3
|
import type { OriginEntry } from "../../installer/origin";
|
|
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,CAAC;AAG1D,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAMlF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAK3E;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,WAAW;IAC1D,GAAG,EAAU,MAAM,CAAC;IACpB,IAAI,EAAS,MAAM,CAAC;IACpB,WAAW,EA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