harness-config-manager 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1547 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +584 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/config.d.ts +7 -0
- package/dist/commands/config.js +49 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/context.d.ts +24 -0
- package/dist/commands/context.js +329 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/export.d.ts +19 -0
- package/dist/commands/export.js +116 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +33 -0
- package/dist/commands/import.js +81 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/info.d.ts +19 -0
- package/dist/commands/info.js +235 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +116 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install.d.ts +119 -0
- package/dist/commands/install.js +533 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.js +102 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/params.d.ts +58 -0
- package/dist/commands/params.js +366 -0
- package/dist/commands/params.js.map +1 -0
- package/dist/commands/refs.d.ts +60 -0
- package/dist/commands/refs.js +329 -0
- package/dist/commands/refs.js.map +1 -0
- package/dist/commands/registry.d.ts +18 -0
- package/dist/commands/registry.js +173 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.js +83 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/targets.d.ts +8 -0
- package/dist/commands/targets.js +61 -0
- package/dist/commands/targets.js.map +1 -0
- package/dist/commands/uninstall.d.ts +71 -0
- package/dist/commands/uninstall.js +322 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +66 -0
- package/dist/commands/update.js +384 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.js +38 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/bundle.d.ts +49 -0
- package/dist/core/bundle.js +326 -0
- package/dist/core/bundle.js.map +1 -0
- package/dist/core/config.d.ts +65 -0
- package/dist/core/config.js +112 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/conflicts.d.ts +67 -0
- package/dist/core/conflicts.js +300 -0
- package/dist/core/conflicts.js.map +1 -0
- package/dist/core/context.d.ts +139 -0
- package/dist/core/context.js +432 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/deps.d.ts +62 -0
- package/dist/core/deps.js +339 -0
- package/dist/core/deps.js.map +1 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.js +26 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/executor.d.ts +9 -0
- package/dist/core/executor.js +139 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/flavors.d.ts +128 -0
- package/dist/core/flavors.js +386 -0
- package/dist/core/flavors.js.map +1 -0
- package/dist/core/frontmatter.d.ts +6 -0
- package/dist/core/frontmatter.js +20 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/fsx.d.ts +40 -0
- package/dist/core/fsx.js +180 -0
- package/dist/core/fsx.js.map +1 -0
- package/dist/core/github.d.ts +37 -0
- package/dist/core/github.js +157 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/harnesses.d.ts +142 -0
- package/dist/core/harnesses.js +215 -0
- package/dist/core/harnesses.js.map +1 -0
- package/dist/core/hash.d.ts +12 -0
- package/dist/core/hash.js +34 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/logger.d.ts +16 -0
- package/dist/core/logger.js +36 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/overlap.d.ts +79 -0
- package/dist/core/overlap.js +155 -0
- package/dist/core/overlap.js.map +1 -0
- package/dist/core/parameters.d.ts +249 -0
- package/dist/core/parameters.js +944 -0
- package/dist/core/parameters.js.map +1 -0
- package/dist/core/paths.d.ts +20 -0
- package/dist/core/paths.js +35 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/planner.d.ts +36 -0
- package/dist/core/planner.js +364 -0
- package/dist/core/planner.js.map +1 -0
- package/dist/core/prompt.d.ts +52 -0
- package/dist/core/prompt.js +197 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/refmap.d.ts +91 -0
- package/dist/core/refmap.js +331 -0
- package/dist/core/refmap.js.map +1 -0
- package/dist/core/refs.d.ts +297 -0
- package/dist/core/refs.js +801 -0
- package/dist/core/refs.js.map +1 -0
- package/dist/core/registry.d.ts +119 -0
- package/dist/core/registry.js +363 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/rename.d.ts +36 -0
- package/dist/core/rename.js +74 -0
- package/dist/core/rename.js.map +1 -0
- package/dist/core/rollback.d.ts +38 -0
- package/dist/core/rollback.js +226 -0
- package/dist/core/rollback.js.map +1 -0
- package/dist/core/semver.d.ts +56 -0
- package/dist/core/semver.js +214 -0
- package/dist/core/semver.js.map +1 -0
- package/dist/core/state.d.ts +99 -0
- package/dist/core/state.js +196 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/store.d.ts +30 -0
- package/dist/core/store.js +54 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/types.d.ts +515 -0
- package/dist/core/types.js +49 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/merge/blocks.d.ts +48 -0
- package/dist/merge/blocks.js +0 -0
- package/dist/merge/blocks.js.map +1 -0
- package/dist/merge/json-merge.d.ts +66 -0
- package/dist/merge/json-merge.js +176 -0
- package/dist/merge/json-merge.js.map +1 -0
- package/dist/merge/toml.d.ts +48 -0
- package/dist/merge/toml.js +118 -0
- package/dist/merge/toml.js.map +1 -0
- package/dist/targets/claude-code.d.ts +11 -0
- package/dist/targets/claude-code.js +94 -0
- package/dist/targets/claude-code.js.map +1 -0
- package/dist/targets/copilot.d.ts +13 -0
- package/dist/targets/copilot.js +126 -0
- package/dist/targets/copilot.js.map +1 -0
- package/dist/targets/index.d.ts +20 -0
- package/dist/targets/index.js +60 -0
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/opencode.d.ts +32 -0
- package/dist/targets/opencode.js +172 -0
- package/dist/targets/opencode.js.map +1 -0
- package/dist/targets/pi.d.ts +42 -0
- package/dist/targets/pi.js +134 -0
- package/dist/targets/pi.js.map +1 -0
- package/dist/targets/reasonix.d.ts +27 -0
- package/dist/targets/reasonix.js +192 -0
- package/dist/targets/reasonix.js.map +1 -0
- package/dist/targets/shared.d.ts +33 -0
- package/dist/targets/shared.js +109 -0
- package/dist/targets/shared.js.map +1 -0
- package/dist/targets/types.d.ts +40 -0
- package/dist/targets/types.js +17 -0
- package/dist/targets/types.js.map +1 -0
- package/docs/authoring-bundles.md +828 -0
- package/package.json +74 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle dependencies.
|
|
3
|
+
*
|
|
4
|
+
* A bundle that explains how to work with the team's JIRA board is worth
|
|
5
|
+
* writing once, and requiring from the half-dozen bundles that assume it. So a
|
|
6
|
+
* manifest may list `dependencies`, and installing a bundle installs what it
|
|
7
|
+
* needs first.
|
|
8
|
+
*
|
|
9
|
+
* The rules, in short:
|
|
10
|
+
*
|
|
11
|
+
* - One version of a bundle per scope. A scope has one `.claude/agents/`, so
|
|
12
|
+
* two versions of the same bundle cannot both be installed; conflicting
|
|
13
|
+
* ranges are reported rather than resolved to something nobody asked for.
|
|
14
|
+
* - Dependencies are installed before dependents, so the assets a dependent
|
|
15
|
+
* shares with its dependency are already on disk and claimed when the
|
|
16
|
+
* dependent's plan is built (see `core/state.ts` on claims).
|
|
17
|
+
* - Cycles are refused, naming the loop.
|
|
18
|
+
*
|
|
19
|
+
* Where a dependency is looked for, in order: bundles already resolved in this
|
|
20
|
+
* run, the registry, a sibling directory in the same collection, and finally
|
|
21
|
+
* the `source` the dependency itself names.
|
|
22
|
+
*/
|
|
23
|
+
import path from 'node:path';
|
|
24
|
+
import { discoverBundleDirs, loadBundle, loadManifest } from './bundle.js';
|
|
25
|
+
import { HcmError } from './errors.js';
|
|
26
|
+
import { isDirectory } from './fsx.js';
|
|
27
|
+
import { describeSource, resolveSource } from './github.js';
|
|
28
|
+
import { entryDir, loadBundlesFrom, parseSource, readRegistry } from './registry.js';
|
|
29
|
+
import { satisfies } from './semver.js';
|
|
30
|
+
/** Guards against a manifest that requires itself through a long enough chain. */
|
|
31
|
+
const MAX_DEPTH = 32;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve `roots` and everything they require into an install order.
|
|
34
|
+
*
|
|
35
|
+
* Roots are seeded first, so a bundle depending on a sibling in the same
|
|
36
|
+
* collection gets the copy the user actually pointed at rather than a
|
|
37
|
+
* registered one of the same name.
|
|
38
|
+
*/
|
|
39
|
+
export async function resolveDependencyGraph(roots, cwd, options = {}) {
|
|
40
|
+
const byName = new Map();
|
|
41
|
+
const order = [];
|
|
42
|
+
const finished = new Set();
|
|
43
|
+
/** Every range asked for, so a clash can name both sides. */
|
|
44
|
+
const constraints = new Map();
|
|
45
|
+
for (const bundle of roots) {
|
|
46
|
+
const name = bundle.manifest.name;
|
|
47
|
+
const existing = byName.get(name);
|
|
48
|
+
// The same collection can list a bundle twice only if two folders share a
|
|
49
|
+
// name, which `hcm registry add` already refuses; keep the first regardless.
|
|
50
|
+
if (!existing)
|
|
51
|
+
byName.set(name, { bundle, requiredBy: [], explicit: true, via: 'requested' });
|
|
52
|
+
}
|
|
53
|
+
const visit = async (entry, stack) => {
|
|
54
|
+
const name = entry.bundle.manifest.name;
|
|
55
|
+
if (finished.has(name))
|
|
56
|
+
return;
|
|
57
|
+
if (stack.includes(name)) {
|
|
58
|
+
throw new HcmError(`Dependency cycle: ${[...stack.slice(stack.indexOf(name)), name].join(' -> ')}`, 'A bundle cannot require something that requires it back. Split the shared part into a third bundle.');
|
|
59
|
+
}
|
|
60
|
+
if (stack.length >= MAX_DEPTH) {
|
|
61
|
+
throw new HcmError(`Dependency chain is more than ${MAX_DEPTH} bundles deep (${[...stack, name].join(' -> ')})`);
|
|
62
|
+
}
|
|
63
|
+
const nextStack = [...stack, name];
|
|
64
|
+
for (const dependency of entry.bundle.dependencies) {
|
|
65
|
+
const asked = constraints.get(dependency.name) ?? [];
|
|
66
|
+
if (dependency.version)
|
|
67
|
+
asked.push({ range: dependency.version, from: name });
|
|
68
|
+
constraints.set(dependency.name, asked);
|
|
69
|
+
let child = byName.get(dependency.name);
|
|
70
|
+
if (!child) {
|
|
71
|
+
child = await locate(dependency, entry.bundle, cwd, options);
|
|
72
|
+
byName.set(dependency.name, child);
|
|
73
|
+
}
|
|
74
|
+
if (!child.requiredBy.includes(name))
|
|
75
|
+
child.requiredBy.push(name);
|
|
76
|
+
assertSatisfies(child.bundle, constraints.get(dependency.name) ?? []);
|
|
77
|
+
await visit(child, nextStack);
|
|
78
|
+
}
|
|
79
|
+
finished.add(name);
|
|
80
|
+
order.push(entry);
|
|
81
|
+
};
|
|
82
|
+
for (const bundle of roots) {
|
|
83
|
+
const entry = byName.get(bundle.manifest.name);
|
|
84
|
+
if (entry)
|
|
85
|
+
await visit(entry, []);
|
|
86
|
+
}
|
|
87
|
+
return { order, byName, hasDependencies: order.some((entry) => !entry.explicit) };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Every constraint has to hold against the one copy that will be installed --
|
|
91
|
+
* a scope has room for exactly one version of a bundle, so there is nothing to
|
|
92
|
+
* reconcile if two dependents disagree.
|
|
93
|
+
*/
|
|
94
|
+
function assertSatisfies(bundle, asked) {
|
|
95
|
+
const version = bundle.manifest.version;
|
|
96
|
+
const failing = asked.filter((constraint) => !satisfies(version, constraint.range));
|
|
97
|
+
if (failing.length === 0)
|
|
98
|
+
return;
|
|
99
|
+
const wanted = asked.map((constraint) => `${constraint.from} wants ${constraint.range}`);
|
|
100
|
+
throw new HcmError(`"${bundle.manifest.name}" v${version} does not satisfy ${failing
|
|
101
|
+
.map((constraint) => `${constraint.range} (required by ${constraint.from})`)
|
|
102
|
+
.join(' and ')}`, asked.length > 1
|
|
103
|
+
? `Only one version of a bundle can be installed in a scope, and ${wanted.join(', ')}.`
|
|
104
|
+
: `Register a version in range, or relax the range in ${failing[0]?.from}'s manifest.`);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Find the bundle a dependency names. Every place is tried, and the first
|
|
108
|
+
* candidate whose version satisfies the range wins -- so a registered copy that
|
|
109
|
+
* is too old does not mask a `source` that would have worked.
|
|
110
|
+
*/
|
|
111
|
+
async function locate(dependency, requirer, cwd, options) {
|
|
112
|
+
const found = [];
|
|
113
|
+
const failures = [];
|
|
114
|
+
for (const lookup of [fromRegistry, fromSibling, fromRepoSibling, fromDeclaredSource]) {
|
|
115
|
+
try {
|
|
116
|
+
const candidate = await lookup(dependency, requirer, cwd, options);
|
|
117
|
+
if (!candidate)
|
|
118
|
+
continue;
|
|
119
|
+
if (!dependency.version || satisfies(candidate.bundle.manifest.version, dependency.version)) {
|
|
120
|
+
return {
|
|
121
|
+
bundle: candidate.bundle,
|
|
122
|
+
requiredBy: [],
|
|
123
|
+
explicit: false,
|
|
124
|
+
via: candidate.via,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
found.push(candidate);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
// A dead GitHub ref in one place should not hide a usable copy in another;
|
|
131
|
+
// the reason is kept for the error we raise if nothing works out.
|
|
132
|
+
failures.push(error.message);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const requirerName = requirer.manifest.name;
|
|
136
|
+
if (found.length > 0) {
|
|
137
|
+
throw new HcmError(`"${requirerName}" requires ${dependency.name}@${dependency.version}, ` +
|
|
138
|
+
`and the ${found.length === 1 ? 'copy' : 'copies'} hcm can find ${found.length === 1 ? 'is' : 'are'}: ` +
|
|
139
|
+
found.map((candidate) => `v${candidate.bundle.manifest.version} (${candidate.where})`).join(', '), 'Update the dependency with "hcm registry add <newer source>", or relax the range.');
|
|
140
|
+
}
|
|
141
|
+
throw new HcmError(`"${requirerName}" requires the bundle "${dependency.name}", which hcm cannot find` +
|
|
142
|
+
(failures.length > 0 ? `: ${failures.join('; ')}` : ''), dependency.source
|
|
143
|
+
? `Its manifest points at ${dependency.source}; check that it is reachable.`
|
|
144
|
+
: `Register it first ("hcm registry add <path-or-repo>"), or give the dependency a "source" in ${requirerName}'s manifest.`);
|
|
145
|
+
}
|
|
146
|
+
async function fromRegistry(dependency, _requirer, _cwd, options) {
|
|
147
|
+
const registry = await readRegistry();
|
|
148
|
+
// By name only: an id is a local handle, not something a manifest can mean.
|
|
149
|
+
const entry = registry.entries.find((candidate) => candidate.name === dependency.name);
|
|
150
|
+
if (!entry)
|
|
151
|
+
return undefined;
|
|
152
|
+
const bundle = await loadBundle(await entryDir(entry, options), entry.source);
|
|
153
|
+
return { bundle, via: 'registry', where: 'registered' };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* A sibling folder in the same collection on this filesystem. This is what
|
|
157
|
+
* makes a monorepo of bundles work while you are writing it: `kits/consumer`
|
|
158
|
+
* requiring `kits/jira-board` needs nothing registered and no network.
|
|
159
|
+
*
|
|
160
|
+
* Two places are searched, because a registered bundle is a *snapshot* of one
|
|
161
|
+
* directory -- the store copy has no siblings, but the source it was taken from
|
|
162
|
+
* still does.
|
|
163
|
+
*/
|
|
164
|
+
async function fromSibling(dependency, requirer, _cwd, _options) {
|
|
165
|
+
const parents = [path.dirname(requirer.root)];
|
|
166
|
+
if (requirer.source.type === 'local')
|
|
167
|
+
parents.push(path.dirname(requirer.source.path));
|
|
168
|
+
for (const parent of new Set(parents.map((dir) => path.resolve(dir)))) {
|
|
169
|
+
const dir = await findSibling(parent, dependency.name, requirer.root);
|
|
170
|
+
if (!dir)
|
|
171
|
+
continue;
|
|
172
|
+
const bundle = await loadBundle(dir, { type: 'local', path: dir });
|
|
173
|
+
return { bundle, via: 'sibling', where: `beside ${requirer.manifest.name}` };
|
|
174
|
+
}
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* A sibling inside the same repository, for a bundle that came from a
|
|
179
|
+
* subdirectory of one. The tarball is already in the cache, so this costs a
|
|
180
|
+
* directory listing rather than a download.
|
|
181
|
+
*/
|
|
182
|
+
async function fromRepoSibling(dependency, requirer, _cwd, options) {
|
|
183
|
+
const source = requirer.source;
|
|
184
|
+
// A bundle at the repo root has no siblings inside the repo; anything beside
|
|
185
|
+
// it in the cache belongs to another download entirely.
|
|
186
|
+
if (source.type !== 'github' || !source.subdir)
|
|
187
|
+
return undefined;
|
|
188
|
+
const parentSubdir = source.subdir.split('/').slice(0, -1).filter(Boolean).join('/');
|
|
189
|
+
const { subdir: _wasHere, ...repo } = source;
|
|
190
|
+
const parentSource = parentSubdir ? { ...repo, subdir: parentSubdir } : repo;
|
|
191
|
+
const parent = await resolveSource(parentSource, options);
|
|
192
|
+
const dir = await findSibling(parent, dependency.name, requirer.root);
|
|
193
|
+
if (!dir)
|
|
194
|
+
return undefined;
|
|
195
|
+
const name = path.basename(dir);
|
|
196
|
+
const bundle = await loadBundle(dir, {
|
|
197
|
+
...source,
|
|
198
|
+
subdir: parentSubdir ? `${parentSubdir}/${name}` : name,
|
|
199
|
+
});
|
|
200
|
+
return { bundle, via: 'sibling', where: `beside ${requirer.manifest.name}` };
|
|
201
|
+
}
|
|
202
|
+
/** The directory in `parent` holding a bundle called `name`, if there is one. */
|
|
203
|
+
async function findSibling(parent, name, exclude) {
|
|
204
|
+
if (!(await isDirectory(parent)))
|
|
205
|
+
return undefined;
|
|
206
|
+
let siblings;
|
|
207
|
+
try {
|
|
208
|
+
siblings = await discoverBundleDirs(parent);
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
for (const dir of siblings) {
|
|
214
|
+
if (path.resolve(dir) === path.resolve(exclude))
|
|
215
|
+
continue;
|
|
216
|
+
const manifest = await loadManifest(dir).catch(() => undefined);
|
|
217
|
+
if (manifest?.name === name)
|
|
218
|
+
return dir;
|
|
219
|
+
}
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
async function fromDeclaredSource(dependency, requirer, _cwd, options) {
|
|
223
|
+
if (!dependency.source)
|
|
224
|
+
return undefined;
|
|
225
|
+
const failures = [];
|
|
226
|
+
for (const source of declaredSources(dependency.source, requirer)) {
|
|
227
|
+
let bundles;
|
|
228
|
+
try {
|
|
229
|
+
bundles = await loadBundlesFrom(source, options);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
// One base out of two not being there is ordinary; the reason is kept in
|
|
233
|
+
// case none of them works out.
|
|
234
|
+
failures.push(error);
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
// A collection is allowed as a source; take the bundle that has the name.
|
|
238
|
+
const bundle = bundles.find((candidate) => candidate.manifest.name === dependency.name) ??
|
|
239
|
+
(bundles.length === 1 ? bundles[0] : undefined);
|
|
240
|
+
if (!bundle)
|
|
241
|
+
continue;
|
|
242
|
+
return { bundle, via: 'source', where: describeSource(source) };
|
|
243
|
+
}
|
|
244
|
+
if (failures.length > 0)
|
|
245
|
+
throw failures[0];
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* What a `source` in a manifest can point at.
|
|
250
|
+
*
|
|
251
|
+
* A GitHub source means one thing wherever it is read. A *relative* path means
|
|
252
|
+
* nothing on its own, so it is read against the bundle that wrote it -- and,
|
|
253
|
+
* when that bundle is a snapshot in the store, against the directory the
|
|
254
|
+
* snapshot was taken from as well, which is where its neighbours still are.
|
|
255
|
+
*
|
|
256
|
+
* The working directory is deliberately not one of them: `hcm install` has to
|
|
257
|
+
* give the same answer from the project it is installing into as from the
|
|
258
|
+
* folder the bundles live in.
|
|
259
|
+
*/
|
|
260
|
+
function declaredSources(declared, requirer) {
|
|
261
|
+
const bases = [requirer.root];
|
|
262
|
+
if (requirer.source.type === 'local')
|
|
263
|
+
bases.push(requirer.source.path);
|
|
264
|
+
const sources = [];
|
|
265
|
+
const seen = new Set();
|
|
266
|
+
for (const base of bases) {
|
|
267
|
+
// Absolute paths and GitHub sources ignore the base, so two bases usually
|
|
268
|
+
// come to one source; a repeat would only re-download it.
|
|
269
|
+
const source = parseSource(declared, path.resolve(base));
|
|
270
|
+
const key = JSON.stringify(source);
|
|
271
|
+
if (seen.has(key))
|
|
272
|
+
continue;
|
|
273
|
+
seen.add(key);
|
|
274
|
+
sources.push(source);
|
|
275
|
+
}
|
|
276
|
+
return sources;
|
|
277
|
+
}
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
// Reporting
|
|
280
|
+
// ---------------------------------------------------------------------------
|
|
281
|
+
/** What gets recorded with an installation, so uninstall knows what it needed. */
|
|
282
|
+
export function installedDependencies(bundle, graph) {
|
|
283
|
+
const dependencies = [];
|
|
284
|
+
for (const dependency of bundle.dependencies) {
|
|
285
|
+
const resolved = graph.byName.get(dependency.name);
|
|
286
|
+
if (!resolved)
|
|
287
|
+
continue;
|
|
288
|
+
dependencies.push({
|
|
289
|
+
name: dependency.name,
|
|
290
|
+
version: resolved.bundle.manifest.version,
|
|
291
|
+
...(dependency.version ? { range: dependency.version } : {}),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return dependencies;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* The tree as `hcm install` and `hcm info` print it:
|
|
298
|
+
*
|
|
299
|
+
* my-kit v1.0.0
|
|
300
|
+
* └─ jira-board v1.4.0 (registered)
|
|
301
|
+
* └─ team-conventions v2.0.0 (github:acme/kits/conventions#HEAD)
|
|
302
|
+
*/
|
|
303
|
+
export function formatDependencyTree(graph, roots) {
|
|
304
|
+
const lines = [];
|
|
305
|
+
const drawn = new Set();
|
|
306
|
+
const walk = (name, prefix, last, depth) => {
|
|
307
|
+
const entry = graph.byName.get(name);
|
|
308
|
+
if (!entry)
|
|
309
|
+
return;
|
|
310
|
+
const branch = depth === 0 ? '' : `${prefix}${last ? '└─ ' : '├─ '}`;
|
|
311
|
+
const version = `v${entry.bundle.manifest.version}`;
|
|
312
|
+
// A bundle needed twice is drawn once; the second mention says where to look.
|
|
313
|
+
const repeat = drawn.has(name) ? ' (see above)' : depth === 0 ? '' : ` (${describeVia(entry)})`;
|
|
314
|
+
lines.push(`${branch}${name} ${version}${repeat}`);
|
|
315
|
+
if (drawn.has(name))
|
|
316
|
+
return;
|
|
317
|
+
drawn.add(name);
|
|
318
|
+
const children = entry.bundle.dependencies.map((dependency) => dependency.name);
|
|
319
|
+
const nextPrefix = depth === 0 ? '' : `${prefix}${last ? ' ' : '│ '}`;
|
|
320
|
+
children.forEach((child, index) => {
|
|
321
|
+
walk(child, nextPrefix, index === children.length - 1, depth + 1);
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
roots.forEach((root, index) => walk(root, '', index === roots.length - 1, 0));
|
|
325
|
+
return lines;
|
|
326
|
+
}
|
|
327
|
+
function describeVia(entry) {
|
|
328
|
+
switch (entry.via) {
|
|
329
|
+
case 'registry':
|
|
330
|
+
return 'registered';
|
|
331
|
+
case 'sibling':
|
|
332
|
+
return 'same collection';
|
|
333
|
+
case 'source':
|
|
334
|
+
return describeSource(entry.bundle.source);
|
|
335
|
+
case 'requested':
|
|
336
|
+
return 'requested';
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=deps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deps.js","sourceRoot":"","sources":["../../src/core/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,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C,KAAK,EAAE,UAAU,EAAE,KAAK,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,KAAqB;IACxC,QAAQ,KAAK,CAAC,GAAG,EAAE,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,YAAY,CAAC;QACtB,KAAK,SAAS;YACZ,OAAO,iBAAiB,CAAC;QAC3B,KAAK,QAAQ;YACX,OAAO,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** An error that should be shown to the user as a clean message, not a stack trace. */
|
|
2
|
+
export declare class HcmError extends Error {
|
|
3
|
+
readonly hint?: string;
|
|
4
|
+
constructor(message: string, hint?: string);
|
|
5
|
+
}
|
|
6
|
+
/** The user chose "abort" at a conflict prompt. Nothing has been written. */
|
|
7
|
+
export declare class AbortedError extends HcmError {
|
|
8
|
+
constructor(message?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class ConflictError extends HcmError {
|
|
11
|
+
readonly conflicts: {
|
|
12
|
+
path: string;
|
|
13
|
+
detail: string;
|
|
14
|
+
owner?: string;
|
|
15
|
+
}[];
|
|
16
|
+
constructor(message: string, conflicts: {
|
|
17
|
+
path: string;
|
|
18
|
+
detail: string;
|
|
19
|
+
owner?: string;
|
|
20
|
+
}[]);
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** An error that should be shown to the user as a clean message, not a stack trace. */
|
|
2
|
+
export class HcmError extends Error {
|
|
3
|
+
hint;
|
|
4
|
+
constructor(message, hint) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'HcmError';
|
|
7
|
+
this.hint = hint;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** The user chose "abort" at a conflict prompt. Nothing has been written. */
|
|
11
|
+
export class AbortedError extends HcmError {
|
|
12
|
+
constructor(message = 'Installation aborted') {
|
|
13
|
+
super(message, 'Nothing was written.');
|
|
14
|
+
this.name = 'AbortedError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class ConflictError extends HcmError {
|
|
18
|
+
conflicts;
|
|
19
|
+
constructor(message, conflicts) {
|
|
20
|
+
super(message, 'Re-run interactively to decide item by item, or pass --on-conflict skip|overwrite ' +
|
|
21
|
+
'(--force is the same as --on-conflict overwrite).');
|
|
22
|
+
this.name = 'ConflictError';
|
|
23
|
+
this.conflicts = conflicts;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,IAAa;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAY,OAAO,GAAG,sBAAsB;QAC1C,KAAK,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,QAAQ;IAChC,SAAS,CAAqD;IAEvE,YAAY,OAAe,EAAE,SAA6D;QACxF,KAAK,CACH,OAAO,EACP,oFAAoF;YAClF,mDAAmD,CACtD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applying a plan and recording receipts.
|
|
3
|
+
*
|
|
4
|
+
* Actions touching the same file are grouped so each file is read once and
|
|
5
|
+
* written once, which keeps JSON key order stable and avoids half-written
|
|
6
|
+
* documents when several resources land in the same place.
|
|
7
|
+
*/
|
|
8
|
+
import type { InstallPlan, Receipt } from './types.js';
|
|
9
|
+
export declare function applyPlan(plan: InstallPlan): Promise<Receipt[]>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applying a plan and recording receipts.
|
|
3
|
+
*
|
|
4
|
+
* Actions touching the same file are grouped so each file is read once and
|
|
5
|
+
* written once, which keeps JSON key order stable and avoids half-written
|
|
6
|
+
* documents when several resources land in the same place.
|
|
7
|
+
*/
|
|
8
|
+
import { fromPosix, pathExists, readJsonIfExists, readTextIfExists, writeBytes, writeJson, writeText, } from './fsx.js';
|
|
9
|
+
import { hashValue, sha256, valuesEqual } from './hash.js';
|
|
10
|
+
import { upsertBlock } from '../merge/blocks.js';
|
|
11
|
+
import { appendArrayItems, setAtPointer } from '../merge/json-merge.js';
|
|
12
|
+
export async function applyPlan(plan) {
|
|
13
|
+
const receipts = [];
|
|
14
|
+
const byFile = groupByPath(plan.actions);
|
|
15
|
+
for (const [relativePath, actions] of byFile) {
|
|
16
|
+
const absolutePath = fromPosix(plan.scopeRoot, relativePath);
|
|
17
|
+
const kind = actions[0]?.payload.kind;
|
|
18
|
+
if (kind === 'file') {
|
|
19
|
+
for (const action of actions) {
|
|
20
|
+
if (action.payload.kind !== 'file')
|
|
21
|
+
continue;
|
|
22
|
+
const { contents } = action.payload;
|
|
23
|
+
// Adopted and shared files are already byte-identical, so writing would
|
|
24
|
+
// only change the mtime. The difference is in the receipt: an adopted
|
|
25
|
+
// file is not ours to remove, a shared one is ours jointly with
|
|
26
|
+
// whoever else claims it.
|
|
27
|
+
if (!action.adopt && !action.share) {
|
|
28
|
+
if (typeof contents === 'string')
|
|
29
|
+
await writeText(absolutePath, contents);
|
|
30
|
+
else
|
|
31
|
+
await writeBytes(absolutePath, contents);
|
|
32
|
+
}
|
|
33
|
+
receipts.push({
|
|
34
|
+
op: 'file',
|
|
35
|
+
path: relativePath,
|
|
36
|
+
hash: sha256(contents),
|
|
37
|
+
...(action.adopt ? { preexisting: true } : {}),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (kind === 'block') {
|
|
43
|
+
receipts.push(...(await applyBlocks(absolutePath, relativePath, actions)));
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
receipts.push(...(await applyJson(absolutePath, relativePath, actions)));
|
|
47
|
+
}
|
|
48
|
+
return receipts;
|
|
49
|
+
}
|
|
50
|
+
function groupByPath(actions) {
|
|
51
|
+
const groups = new Map();
|
|
52
|
+
for (const action of actions) {
|
|
53
|
+
const existing = groups.get(action.path);
|
|
54
|
+
if (existing)
|
|
55
|
+
existing.push(action);
|
|
56
|
+
else
|
|
57
|
+
groups.set(action.path, [action]);
|
|
58
|
+
}
|
|
59
|
+
return groups;
|
|
60
|
+
}
|
|
61
|
+
async function applyBlocks(absolutePath, relativePath, actions) {
|
|
62
|
+
let content = (await readTextIfExists(absolutePath)) ?? '';
|
|
63
|
+
const receipts = [];
|
|
64
|
+
for (const action of actions) {
|
|
65
|
+
if (action.payload.kind !== 'block')
|
|
66
|
+
continue;
|
|
67
|
+
const { blockId, syntax, body } = action.payload;
|
|
68
|
+
content = upsertBlock(content, syntax, blockId, body);
|
|
69
|
+
receipts.push({ op: 'block', path: relativePath, blockId, syntax });
|
|
70
|
+
}
|
|
71
|
+
await writeText(absolutePath, content);
|
|
72
|
+
return receipts;
|
|
73
|
+
}
|
|
74
|
+
async function applyJson(absolutePath, relativePath, actions) {
|
|
75
|
+
const existed = await pathExists(absolutePath);
|
|
76
|
+
const doc = (await readJsonIfExists(absolutePath)) ?? {};
|
|
77
|
+
const receipts = [];
|
|
78
|
+
let changed = !existed;
|
|
79
|
+
for (const action of actions) {
|
|
80
|
+
if (action.payload.kind === 'json-value') {
|
|
81
|
+
const { pointer, value } = action.payload;
|
|
82
|
+
// Adopting: the key already holds exactly this value, so leave the
|
|
83
|
+
// document (and its formatting) untouched and record it as not ours.
|
|
84
|
+
// Sharing is the same write-nothing case, but the value *was* put there
|
|
85
|
+
// by another installation, so this one claims it too.
|
|
86
|
+
if (action.adopt || action.share) {
|
|
87
|
+
receipts.push({
|
|
88
|
+
op: 'json-value',
|
|
89
|
+
path: relativePath,
|
|
90
|
+
pointer,
|
|
91
|
+
hash: hashValue(value),
|
|
92
|
+
hadPrevious: false,
|
|
93
|
+
...(action.adopt ? { preexisting: true } : {}),
|
|
94
|
+
});
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const result = setAtPointer(doc, pointer, value);
|
|
98
|
+
changed = true;
|
|
99
|
+
// Replacing a value with an identical one is a reinstall, not an
|
|
100
|
+
// overwrite -- recording it as one would resurrect the key on uninstall.
|
|
101
|
+
const overwrote = result.hadPrevious && !valuesEqual(result.previous, value);
|
|
102
|
+
receipts.push({
|
|
103
|
+
op: 'json-value',
|
|
104
|
+
path: relativePath,
|
|
105
|
+
pointer,
|
|
106
|
+
hash: hashValue(value),
|
|
107
|
+
hadPrevious: overwrote,
|
|
108
|
+
...(overwrote ? { previous: result.previous } : {}),
|
|
109
|
+
});
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (action.payload.kind === 'json-array-item') {
|
|
113
|
+
const { pointer, items } = action.payload;
|
|
114
|
+
const result = appendArrayItems(doc, pointer, items);
|
|
115
|
+
if (result.appended.length > 0)
|
|
116
|
+
changed = true;
|
|
117
|
+
// Items we appended are ours. Items already in the list are ours too when
|
|
118
|
+
// another installation put them there -- two bundles allowing the same
|
|
119
|
+
// permission both claim it, and it survives until the second one goes.
|
|
120
|
+
// An entry the *user* wrote is claimed by nobody and stays untouched.
|
|
121
|
+
const hashes = new Set([
|
|
122
|
+
...result.appended.map((item) => hashValue(item)),
|
|
123
|
+
...(action.shareItems ?? []),
|
|
124
|
+
]);
|
|
125
|
+
receipts.push({
|
|
126
|
+
op: 'json-array-item',
|
|
127
|
+
path: relativePath,
|
|
128
|
+
pointer,
|
|
129
|
+
hashes: [...hashes],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// A pass that only adopted existing values has nothing to write; rewriting
|
|
134
|
+
// would reformat a file we were asked to leave alone.
|
|
135
|
+
if (changed)
|
|
136
|
+
await writeJson(absolutePath, doc);
|
|
137
|
+
return receipts;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/core/executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGzF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAiB;IAC/C,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,MAA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