reply-cli 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -5
- package/dist/commands/skills.d.ts +12 -0
- package/dist/commands/skills.js +138 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/skills/adapter-flat.d.ts +32 -0
- package/dist/skills/adapter-flat.js +480 -0
- package/dist/skills/adapter-flat.js.map +1 -0
- package/dist/skills/adapter-native.d.ts +22 -0
- package/dist/skills/adapter-native.js +335 -0
- package/dist/skills/adapter-native.js.map +1 -0
- package/dist/skills/detect.d.ts +21 -0
- package/dist/skills/detect.js +102 -0
- package/dist/skills/detect.js.map +1 -0
- package/dist/skills/hosts.d.ts +5 -0
- package/dist/skills/hosts.js +118 -0
- package/dist/skills/hosts.js.map +1 -0
- package/dist/skills/journal.d.ts +23 -0
- package/dist/skills/journal.js +91 -0
- package/dist/skills/journal.js.map +1 -0
- package/dist/skills/orchestrate.d.ts +27 -0
- package/dist/skills/orchestrate.js +124 -0
- package/dist/skills/orchestrate.js.map +1 -0
- package/dist/skills/packs.d.ts +16 -0
- package/dist/skills/packs.js +153 -0
- package/dist/skills/packs.js.map +1 -0
- package/dist/skills/report.d.ts +7 -0
- package/dist/skills/report.js +105 -0
- package/dist/skills/report.js.map +1 -0
- package/dist/skills/types.d.ts +80 -0
- package/dist/skills/types.js +5 -0
- package/dist/skills/types.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.run_flat = exports.skills_target = exports.copy_dir = exports.clone_repo = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const adapter_native_1 = require("./adapter-native");
|
|
11
|
+
const journal_1 = require("./journal");
|
|
12
|
+
const packs_1 = require("./packs");
|
|
13
|
+
const clone_repo = async ({ ref, run, tmp_root }) => {
|
|
14
|
+
const dir = fs_1.default.mkdtempSync(path_1.default.join(tmp_root, 'reply-skills-'));
|
|
15
|
+
const url = `https://github.com/${packs_1.REPO}.git`;
|
|
16
|
+
const cloned = await run('git', ['clone', '--depth', '1', '--branch', ref, url, dir]);
|
|
17
|
+
if (cloned.code !== 0) {
|
|
18
|
+
fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
19
|
+
throw new Error((cloned.stderr || cloned.stdout).trim() || `git clone failed for ${url}`);
|
|
20
|
+
}
|
|
21
|
+
const head = await run('git', ['-C', dir, 'rev-parse', 'HEAD']);
|
|
22
|
+
if (head.code !== 0) {
|
|
23
|
+
fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
24
|
+
throw new Error((head.stderr || head.stdout).trim() || `git rev-parse HEAD failed for ${url}`);
|
|
25
|
+
}
|
|
26
|
+
return { dir, commit: head.stdout.trim().slice(0, 7) };
|
|
27
|
+
};
|
|
28
|
+
exports.clone_repo = clone_repo;
|
|
29
|
+
// Where this host reads skills from, for the requested scope. A native host
|
|
30
|
+
// only lands here under --project, because its plugin mechanism is user-scoped.
|
|
31
|
+
// Returns undefined when the host has no directory configured for this scope
|
|
32
|
+
// (e.g. a native host under `user` scope) so the caller can report a status
|
|
33
|
+
// instead of joining `undefined` into a path.
|
|
34
|
+
const skills_target = (def, scope, home, cwd) => {
|
|
35
|
+
const rel = scope === 'project' ? def.project_skills_dir : def.user_skills_dir;
|
|
36
|
+
return rel === undefined ? undefined : path_1.default.join(scope === 'project' ? cwd : home, rel);
|
|
37
|
+
};
|
|
38
|
+
exports.skills_target = skills_target;
|
|
39
|
+
// Mutates `written` as it goes, rather than returning a fresh array, so that
|
|
40
|
+
// a throw partway through (a read-only destination, a full disk) still leaves
|
|
41
|
+
// the caller with exactly the files that landed before the failure — see the
|
|
42
|
+
// install loop, which journals that partial list instead of orphaning it.
|
|
43
|
+
const copy_dir = (from, to, written) => {
|
|
44
|
+
fs_1.default.mkdirSync(to, { recursive: true });
|
|
45
|
+
for (const entry of fs_1.default.readdirSync(from, { withFileTypes: true })) {
|
|
46
|
+
const src = path_1.default.join(from, entry.name);
|
|
47
|
+
const dst = path_1.default.join(to, entry.name);
|
|
48
|
+
if (entry.isDirectory()) {
|
|
49
|
+
copy_dir(src, dst, written);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
fs_1.default.copyFileSync(src, dst);
|
|
53
|
+
written.push(dst);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.copy_dir = copy_dir;
|
|
57
|
+
// True when `target` resolves inside `root` — never equal to it, never above
|
|
58
|
+
// it via `..`. Every path handed to delete_files must pass this: the journal
|
|
59
|
+
// is JSON in the user's config directory, and a hand-edited or stale entry
|
|
60
|
+
// must not be able to name a file outside the host's own skills directory.
|
|
61
|
+
// `path.relative` — not string equality — so this agrees with the OS on
|
|
62
|
+
// whether two differently-cased paths are the same file, which matters on
|
|
63
|
+
// Windows: is_within, owns_dir and the protected-files check must all reach
|
|
64
|
+
// the same answer for the same pair of paths.
|
|
65
|
+
const is_within = (root, target) => {
|
|
66
|
+
const rel = path_1.default.relative(root, target);
|
|
67
|
+
return rel !== '' && !rel.startsWith('..') && !path_1.default.isAbsolute(rel);
|
|
68
|
+
};
|
|
69
|
+
const paths_equal = (a, b) => path_1.default.relative(a, b) === '';
|
|
70
|
+
// Removes the files we're told to, minus two carve-outs: anything outside
|
|
71
|
+
// `target_root` (a tampered or stale journal entry) and anything another
|
|
72
|
+
// host's own journal entry still claims (several flat hosts share the same
|
|
73
|
+
// project-scope directory, see claimed_by_others). What's left is pruned back
|
|
74
|
+
// to empty directories, but `target_root` itself is never removed.
|
|
75
|
+
const delete_files = (files, target_root, protected_files = new Set()) => {
|
|
76
|
+
const resolved_root = path_1.default.resolve(target_root);
|
|
77
|
+
const dirs = new Set();
|
|
78
|
+
const outside = [];
|
|
79
|
+
const failed = [];
|
|
80
|
+
for (const file of files) {
|
|
81
|
+
const resolved = path_1.default.resolve(file);
|
|
82
|
+
if (!is_within(resolved_root, resolved)) {
|
|
83
|
+
outside.push(resolved);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
// A sibling host still claims this one; not deleting it is the point,
|
|
87
|
+
// so it is neither a failure nor a refusal.
|
|
88
|
+
if ([...protected_files].some(p => paths_equal(p, resolved))) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
// `force` already makes a missing file a no-op, so removal stays
|
|
93
|
+
// idempotent without a catch. Anything that does throw here is a
|
|
94
|
+
// real failure — a read-only file on Windows (EPERM), an open
|
|
95
|
+
// handle (EBUSY) — and must be reported, not swallowed.
|
|
96
|
+
fs_1.default.rmSync(resolved, { force: true });
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
failed.push({ file: resolved, message: error.message });
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
dirs.add(path_1.default.dirname(resolved));
|
|
103
|
+
}
|
|
104
|
+
for (const dir of [...dirs].sort((a, b) => b.length - a.length)) {
|
|
105
|
+
if (dir === resolved_root) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
if (!fs_1.default.readdirSync(dir).length) {
|
|
110
|
+
fs_1.default.rmdirSync(dir);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// Non-empty or missing — leave it alone.
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { outside, failed };
|
|
118
|
+
};
|
|
119
|
+
// The user-facing reason a removal did not fully happen, or undefined when it
|
|
120
|
+
// did. Anything but undefined means the pack must be reported `failed` and its
|
|
121
|
+
// journal entry kept, so the next run can retry.
|
|
122
|
+
const delete_detail = (result, target_root) => {
|
|
123
|
+
const reasons = [];
|
|
124
|
+
if (result.outside.length) {
|
|
125
|
+
reasons.push(`${result.outside.length} recorded file(s) sit outside ${target_root} and were left alone`
|
|
126
|
+
+ `, starting with ${result.outside[0]}`);
|
|
127
|
+
}
|
|
128
|
+
for (const failure of result.failed) {
|
|
129
|
+
reasons.push(`could not delete ${failure.file}: ${failure.message}`);
|
|
130
|
+
}
|
|
131
|
+
return reasons.length ? reasons.join('; ') : undefined;
|
|
132
|
+
};
|
|
133
|
+
// Absolute file paths that some *other* host's journal entry for this exact
|
|
134
|
+
// (scope, pack) still claims. Several flat hosts resolve the same physical
|
|
135
|
+
// project-scope directory (`.agents/skills`), so deleting or overwriting one
|
|
136
|
+
// host's copy must not break a sibling host's install of the same pack.
|
|
137
|
+
// `project_root` narrows this to the repository this run is acting on: a
|
|
138
|
+
// sibling's entry recorded in a different checkout claims nothing here.
|
|
139
|
+
const claimed_by_others = (env, scope, pack_name, exclude_host, project_root) => {
|
|
140
|
+
const journal = (0, journal_1.read_journal)(env);
|
|
141
|
+
const claimed = new Set();
|
|
142
|
+
for (const [host, scopes] of Object.entries(journal.hosts)) {
|
|
143
|
+
if (host === exclude_host) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const entry = scopes[scope]?.[pack_name];
|
|
147
|
+
if (!entry) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (project_root !== undefined && entry.project_root !== undefined
|
|
151
|
+
&& !paths_equal(entry.project_root, project_root)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
for (const file of entry.files) {
|
|
155
|
+
claimed.add(path_1.default.resolve(file));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return claimed;
|
|
159
|
+
};
|
|
160
|
+
// True when every file under `dir` is accounted for by files we already know
|
|
161
|
+
// about — our own previous install of this pack, or a sibling host's install
|
|
162
|
+
// of the same pack at a shared directory. Anything else sitting at `dir` is
|
|
163
|
+
// foreign (typically user-authored) and must not be clobbered. Reuses
|
|
164
|
+
// is_within rather than a raw prefix check, so this agrees with delete_files'
|
|
165
|
+
// containment check on a differently-cased path (routine on Windows).
|
|
166
|
+
const owns_dir = (dir, known_files) => {
|
|
167
|
+
for (const file of known_files) {
|
|
168
|
+
if (is_within(dir, file)) {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
};
|
|
174
|
+
// Mirrors adapter-native.ts's status_of: 'ok' with no failures, 'failed' when
|
|
175
|
+
// every pack in this operation failed, 'partial' otherwise. Kept local rather
|
|
176
|
+
// than shared, since the two adapters are twin, independent implementations
|
|
177
|
+
// of the same rule.
|
|
178
|
+
const status_of = (packs) => {
|
|
179
|
+
const failed = packs.filter(p => p.action === 'failed');
|
|
180
|
+
if (!failed.length) {
|
|
181
|
+
return 'ok';
|
|
182
|
+
}
|
|
183
|
+
return failed.length === packs.length ? 'failed' : 'partial';
|
|
184
|
+
};
|
|
185
|
+
// Twins of adapter-native.ts's pair, for the same reason status_of is a twin:
|
|
186
|
+
// install refuses a pack whose dependency failed, remove refuses a pack whose
|
|
187
|
+
// dependent failed, and the user reads the identical sentence either way.
|
|
188
|
+
const blocked_hint = (names) => {
|
|
189
|
+
const list = [...names];
|
|
190
|
+
return list.length
|
|
191
|
+
? `packs ${list.join(', ')} were not attempted because their dependencies failed; fix those installs and re-run`
|
|
192
|
+
: undefined;
|
|
193
|
+
};
|
|
194
|
+
const kept_hint = (names) => {
|
|
195
|
+
const list = [...names];
|
|
196
|
+
return list.length
|
|
197
|
+
? `packs ${list.join(', ')} were kept because packs that depend on them could not be removed; fix those removals and re-run`
|
|
198
|
+
: undefined;
|
|
199
|
+
};
|
|
200
|
+
// A copy that landed at the version the pack was already on is not an upgrade,
|
|
201
|
+
// even though this adapter really did re-copy from a fresh clone — the commit
|
|
202
|
+
// carries that difference, the version does not. Mirrors
|
|
203
|
+
// adapter-native.ts's updated_outcome so `current` means one thing everywhere.
|
|
204
|
+
//
|
|
205
|
+
// But "the version moved" and "the bytes moved" are two different facts, and
|
|
206
|
+
// this adapter clones a *ref*: a new commit on `main` can rewrite every file
|
|
207
|
+
// at an unchanged 0.1.0, and so can repairing an install that never finished.
|
|
208
|
+
// `current` cannot say that, so `refreshed` does — otherwise a run that really
|
|
209
|
+
// did rewrite the user's files reads as a no-op and the reporter never tells
|
|
210
|
+
// them to start a new session.
|
|
211
|
+
//
|
|
212
|
+
// `commit` is the commit these files were copied from, and is passed only by
|
|
213
|
+
// the path that actually copied: a dry run never clones, so it cannot know
|
|
214
|
+
// whether the ref moved and must not guess.
|
|
215
|
+
const copied_outcome = (pack_name, version, previous, commit) => {
|
|
216
|
+
if (previous === undefined) {
|
|
217
|
+
return { name: pack_name, action: 'installed', version };
|
|
218
|
+
}
|
|
219
|
+
if (previous.version !== version) {
|
|
220
|
+
return { name: pack_name, action: 'upgraded', version, from: previous.version };
|
|
221
|
+
}
|
|
222
|
+
const refreshed = commit !== undefined
|
|
223
|
+
&& (previous.commit !== commit || !previous.complete);
|
|
224
|
+
return refreshed
|
|
225
|
+
? { name: pack_name, action: 'current', version, refreshed: true }
|
|
226
|
+
: { name: pack_name, action: 'current', version };
|
|
227
|
+
};
|
|
228
|
+
const run_flat = async (opts) => {
|
|
229
|
+
const { operation, host, packs, scope } = opts;
|
|
230
|
+
const run = opts.run ?? adapter_native_1.default_runner;
|
|
231
|
+
const ref = opts.ref ?? packs_1.DEFAULT_REF;
|
|
232
|
+
const home = opts.home ?? os_1.default.homedir();
|
|
233
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
234
|
+
const tmp_root = opts.tmp_root ?? os_1.default.tmpdir();
|
|
235
|
+
const dry_run = opts.dry_run === true;
|
|
236
|
+
const clone = opts.clone ?? clone_repo;
|
|
237
|
+
const id = host.def.id;
|
|
238
|
+
const base = {
|
|
239
|
+
host: id, label: host.def.label, kind: 'flat-skills-dir', scope, status: 'ok',
|
|
240
|
+
};
|
|
241
|
+
// The repository a project-scope run acts on, and the identity a
|
|
242
|
+
// project-scope journal entry is stamped with. Undefined under user scope,
|
|
243
|
+
// whose directory is the home directory and cannot be confused with
|
|
244
|
+
// another one.
|
|
245
|
+
const project_root = scope === 'project' ? path_1.default.resolve(cwd) : undefined;
|
|
246
|
+
// An entry written from a different checkout is not this run's to read,
|
|
247
|
+
// replace or forget: `remove --project` from the wrong repository must
|
|
248
|
+
// report nothing, rather than delete nothing (containment refuses every
|
|
249
|
+
// path) and still claim `removed`. Entries written before the field
|
|
250
|
+
// existed carry no root and are treated as ours, so nothing already
|
|
251
|
+
// journaled becomes unreachable.
|
|
252
|
+
const belongs_here = (entry) => project_root === undefined
|
|
253
|
+
|| entry.project_root === undefined
|
|
254
|
+
|| paths_equal(entry.project_root, project_root);
|
|
255
|
+
// Scope-bound wrappers: every journal lookup for this run goes through
|
|
256
|
+
// these, so neither `scope` nor the project root can be forgotten at a
|
|
257
|
+
// call site.
|
|
258
|
+
const entry_for = (pack_name) => {
|
|
259
|
+
const entry = (0, journal_1.journal_entry)(id, scope, pack_name, opts.env);
|
|
260
|
+
return entry && belongs_here(entry) ? entry : undefined;
|
|
261
|
+
};
|
|
262
|
+
const record_for = (pack_name, data) => (0, journal_1.record_pack)(id, scope, pack_name, project_root ? { ...data, project_root } : data, opts.env);
|
|
263
|
+
const forget_for = (pack_name) => (0, journal_1.forget_pack)(id, scope, pack_name, opts.env);
|
|
264
|
+
const others_claim = (pack_name) => claimed_by_others(opts.env, scope, pack_name, id, project_root);
|
|
265
|
+
const outcomes = [];
|
|
266
|
+
if (operation === 'list') {
|
|
267
|
+
for (const pack of packs) {
|
|
268
|
+
const entry = entry_for(pack.name);
|
|
269
|
+
if (!entry) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
// An incomplete entry never reads as current, regardless of
|
|
273
|
+
// version — it is a copy that did not finish, and needs a repair
|
|
274
|
+
// install, not a clean bill of health.
|
|
275
|
+
if (!entry.complete) {
|
|
276
|
+
outcomes.push({
|
|
277
|
+
name: pack.name,
|
|
278
|
+
action: 'failed',
|
|
279
|
+
detail: 'installation incomplete; run `reply skills install` to repair',
|
|
280
|
+
});
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
outcomes.push(entry.version === pack.version
|
|
284
|
+
? { name: pack.name, action: 'current', version: entry.version }
|
|
285
|
+
: { name: pack.name, action: 'upgraded', version: pack.version, from: entry.version });
|
|
286
|
+
}
|
|
287
|
+
return { ...base, packs: outcomes, status: status_of(outcomes) };
|
|
288
|
+
}
|
|
289
|
+
// Every other operation touches the filesystem, so a host with no
|
|
290
|
+
// directory configured for this scope (a native host under `user` scope)
|
|
291
|
+
// is reported, not crashed on.
|
|
292
|
+
const target_root = skills_target(host.def, scope, home, cwd);
|
|
293
|
+
if (!target_root) {
|
|
294
|
+
return {
|
|
295
|
+
...base,
|
|
296
|
+
status: 'skipped',
|
|
297
|
+
reason: 'no-skills-dir',
|
|
298
|
+
detail: `${host.def.label} has no ${scope} skills directory`,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
if (operation === 'remove') {
|
|
302
|
+
// Reverse dependency order, and — since delete_files can now report a
|
|
303
|
+
// file it could not remove — the same transposed guard as
|
|
304
|
+
// adapter-native.ts: a dependency is never dropped once a pack that
|
|
305
|
+
// depends on it failed to be removed, so no host is left holding an
|
|
306
|
+
// adapter with no core. Reverse order means every dependent has
|
|
307
|
+
// already been visited, so the block propagates down the chain.
|
|
308
|
+
const failed_names = new Set();
|
|
309
|
+
const blocked_names = new Set();
|
|
310
|
+
const kept_names = new Set();
|
|
311
|
+
for (const pack of [...packs].reverse()) {
|
|
312
|
+
const blocker = packs.find(p => p.dependencies.includes(pack.name)
|
|
313
|
+
&& (failed_names.has(p.name) || blocked_names.has(p.name)));
|
|
314
|
+
if (blocker) {
|
|
315
|
+
blocked_names.add(pack.name);
|
|
316
|
+
if (entry_for(pack.name)) {
|
|
317
|
+
kept_names.add(pack.name);
|
|
318
|
+
}
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const entry = entry_for(pack.name);
|
|
322
|
+
if (!entry) {
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
if (dry_run) {
|
|
326
|
+
outcomes.push({ name: pack.name, action: 'removed', version: entry.version });
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
const refusal = delete_detail(delete_files(entry.files, target_root, others_claim(pack.name)), target_root);
|
|
330
|
+
if (refusal) {
|
|
331
|
+
// The entry stays: forgetting it would strand whatever is
|
|
332
|
+
// still on disk with nothing left tracking it.
|
|
333
|
+
failed_names.add(pack.name);
|
|
334
|
+
outcomes.push({ name: pack.name, action: 'failed', detail: refusal });
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
forget_for(pack.name);
|
|
338
|
+
outcomes.push({ name: pack.name, action: 'removed', version: entry.version });
|
|
339
|
+
}
|
|
340
|
+
return { ...base, packs: outcomes, status: status_of(outcomes), hint: kept_hint(kept_names) };
|
|
341
|
+
}
|
|
342
|
+
// install and update both need the repository contents. update only touches
|
|
343
|
+
// packs the journal already knows about.
|
|
344
|
+
const targets = operation === 'update'
|
|
345
|
+
? packs.filter(p => entry_for(p.name))
|
|
346
|
+
: packs;
|
|
347
|
+
const pending = targets.filter(p => {
|
|
348
|
+
const entry = entry_for(p.name);
|
|
349
|
+
return operation === 'update' || !entry || !entry.complete || entry.version !== p.version;
|
|
350
|
+
});
|
|
351
|
+
for (const pack of targets) {
|
|
352
|
+
if (!pending.includes(pack)) {
|
|
353
|
+
outcomes.push({ name: pack.name, action: 'current', version: pack.version });
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (!pending.length) {
|
|
357
|
+
return { ...base, packs: outcomes };
|
|
358
|
+
}
|
|
359
|
+
if (dry_run) {
|
|
360
|
+
for (const pack of pending) {
|
|
361
|
+
outcomes.push(copied_outcome(pack.name, pack.version, entry_for(pack.name)));
|
|
362
|
+
}
|
|
363
|
+
return { ...base, packs: outcomes };
|
|
364
|
+
}
|
|
365
|
+
let cloned;
|
|
366
|
+
try {
|
|
367
|
+
cloned = await clone({ ref, run, tmp_root });
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
return {
|
|
371
|
+
...base,
|
|
372
|
+
status: 'failed',
|
|
373
|
+
reason: 'clone-failed',
|
|
374
|
+
detail: error.message,
|
|
375
|
+
hint: 'install git (the flat-directory install clones the skills repository), then re-run',
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
// Stamped only now that a clone actually happened this run — every
|
|
379
|
+
// return past this point reports the commit this run cloned, never a
|
|
380
|
+
// journal entry from some earlier run or a sibling host.
|
|
381
|
+
const cloned_base = { ...base, commit: cloned.commit };
|
|
382
|
+
// A per-host filesystem failure here (a read-only destination, a corrupt
|
|
383
|
+
// clone layout, a journal write error) must become a Host_outcome, never
|
|
384
|
+
// a rejected promise — one host failing must never abort the others, and
|
|
385
|
+
// any pack already installed and journaled before the failure still counts.
|
|
386
|
+
//
|
|
387
|
+
// A pack whose dependency failed (or was itself blocked) must never be
|
|
388
|
+
// attempted — mirrors adapter-native.ts's failed_names/blocked_names, so
|
|
389
|
+
// the invariant "never reply-adapter without ai-sdr-core" holds the same
|
|
390
|
+
// way regardless of which adapter is doing the installing.
|
|
391
|
+
const failed_names = new Set();
|
|
392
|
+
const blocked_names = new Set();
|
|
393
|
+
try {
|
|
394
|
+
for (const pack of pending) {
|
|
395
|
+
const blocker = pack.dependencies.find(d => failed_names.has(d) || blocked_names.has(d));
|
|
396
|
+
if (blocker) {
|
|
397
|
+
blocked_names.add(pack.name);
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
const from = path_1.default.join(cloned.dir, 'plugins', pack.name, 'skills');
|
|
401
|
+
const previous = entry_for(pack.name);
|
|
402
|
+
const elsewhere = others_claim(pack.name);
|
|
403
|
+
const known_files = previous
|
|
404
|
+
? [...previous.files.map(f => path_1.default.resolve(f)), ...elsewhere]
|
|
405
|
+
: [...elsewhere];
|
|
406
|
+
const skill_dirs = fs_1.default.readdirSync(from, { withFileTypes: true }).filter(e => e.isDirectory());
|
|
407
|
+
const collision = skill_dirs.find(skill => {
|
|
408
|
+
const dst_dir = path_1.default.join(target_root, skill.name);
|
|
409
|
+
return fs_1.default.existsSync(dst_dir) && !owns_dir(dst_dir, known_files);
|
|
410
|
+
});
|
|
411
|
+
if (collision) {
|
|
412
|
+
failed_names.add(pack.name);
|
|
413
|
+
outcomes.push({
|
|
414
|
+
name: pack.name,
|
|
415
|
+
action: 'failed',
|
|
416
|
+
detail: `conflicts with an existing skill: ${collision.name}`,
|
|
417
|
+
});
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (previous) {
|
|
421
|
+
// Best-effort: a file that survives here is either overwritten
|
|
422
|
+
// by the copy below or fails it, and either way the copy's own
|
|
423
|
+
// error path — not a silent skip — is what reaches the user.
|
|
424
|
+
delete_files(previous.files, target_root, elsewhere);
|
|
425
|
+
}
|
|
426
|
+
const written = [];
|
|
427
|
+
try {
|
|
428
|
+
for (const skill of skill_dirs) {
|
|
429
|
+
copy_dir(path_1.default.join(from, skill.name), path_1.default.join(target_root, skill.name), written);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
catch (copy_error) {
|
|
433
|
+
// Whatever landed before the failure — possibly nothing — is
|
|
434
|
+
// journaled as incomplete, never as done: a version match
|
|
435
|
+
// alone must never read as installed when the copy did not
|
|
436
|
+
// finish, or `install`'s own hint to re-run would do nothing.
|
|
437
|
+
record_for(pack.name, {
|
|
438
|
+
version: pack.version, ref, commit: cloned.commit, scope,
|
|
439
|
+
files: written, complete: false, installed_at: new Date().toISOString(),
|
|
440
|
+
});
|
|
441
|
+
throw copy_error;
|
|
442
|
+
}
|
|
443
|
+
record_for(pack.name, {
|
|
444
|
+
version: pack.version,
|
|
445
|
+
ref,
|
|
446
|
+
commit: cloned.commit,
|
|
447
|
+
scope,
|
|
448
|
+
files: written,
|
|
449
|
+
complete: true,
|
|
450
|
+
installed_at: new Date().toISOString(),
|
|
451
|
+
});
|
|
452
|
+
outcomes.push(copied_outcome(pack.name, pack.version, previous, cloned.commit));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
catch (error) {
|
|
456
|
+
// outcomes.length is not "something landed" — every entry pushed so
|
|
457
|
+
// far could itself be a collision failure, so check the actions.
|
|
458
|
+
const landed = outcomes.some(p => p.action !== 'failed');
|
|
459
|
+
return {
|
|
460
|
+
...cloned_base,
|
|
461
|
+
status: landed ? 'partial' : 'failed',
|
|
462
|
+
packs: outcomes,
|
|
463
|
+
reason: 'copy-failed',
|
|
464
|
+
detail: error.message,
|
|
465
|
+
hint: blocked_hint(blocked_names) ?? 'check filesystem permissions for the skills directory, then re-run',
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
finally {
|
|
469
|
+
try {
|
|
470
|
+
fs_1.default.rmSync(cloned.dir, { recursive: true, force: true });
|
|
471
|
+
}
|
|
472
|
+
catch {
|
|
473
|
+
// Best-effort cleanup of the clone's temp directory — never masks
|
|
474
|
+
// the result computed above.
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return { ...cloned_base, packs: outcomes, status: status_of(outcomes), hint: blocked_hint(blocked_names) };
|
|
478
|
+
};
|
|
479
|
+
exports.run_flat = run_flat;
|
|
480
|
+
//# sourceMappingURL=adapter-flat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-flat.js","sourceRoot":"","sources":["../../src/skills/adapter-flat.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,qDAAgD;AAChD,uCAAgF;AAChF,mCAA0C;AAa1C,MAAM,UAAU,GAAa,KAAK,EAAC,EAAC,GAAG,EA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AAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACL,kEAAkE;YAClE,6BAA6B;QACjC,CAAC;IACL,CAAC;IACD,OAAO,EAAC,GAAG,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,EAAC,CAAC;AAC7G,CAAC,CAAC;AAE2C,4BAAQ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Detected_host } from './detect';
|
|
2
|
+
import type { Host_outcome, Operation, Pack, Runner, Scope } from './types';
|
|
3
|
+
declare const default_runner: Runner;
|
|
4
|
+
type Listing_result = {
|
|
5
|
+
ok: true;
|
|
6
|
+
versions: Record<string, string>;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
detail?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const installed_versions: (host: Detected_host, run: Runner) => Promise<Listing_result>;
|
|
12
|
+
type Native_opts = {
|
|
13
|
+
operation: Operation;
|
|
14
|
+
host: Detected_host;
|
|
15
|
+
packs: Pack[];
|
|
16
|
+
scope: Scope;
|
|
17
|
+
run?: Runner;
|
|
18
|
+
dry_run?: boolean;
|
|
19
|
+
};
|
|
20
|
+
declare const run_native: (opts: Native_opts) => Promise<Host_outcome>;
|
|
21
|
+
export { default_runner, installed_versions, run_native };
|
|
22
|
+
export type { Native_opts };
|