@dreamlake/dreamlake-cli 0.95.0 → 0.97.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/dist/api/index.d.ts +48 -10
- package/dist/api/notes.d.ts +13 -2
- package/dist/api/notes.js +17 -8
- package/dist/api/workspace.d.ts +42 -3
- package/dist/api/workspace.js +7 -0
- package/dist/cli/create/index.js +1 -1
- package/dist/cli/delete/index.js +1 -1
- package/dist/cli/download/index.js +2 -1
- package/dist/cli/folders/index.d.ts +15 -0
- package/dist/cli/folders/index.js +81 -0
- package/dist/cli/help-examples.generated.js +11 -4
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -1
- package/dist/cli/hosts/bootstrap-source.js +1 -1
- package/dist/cli/hosts/index.js +2 -0
- package/dist/cli/hosts/ssh.d.ts +3 -0
- package/dist/cli/hosts/ssh.js +37 -8
- package/dist/cli/hosts/upgrade.d.ts +122 -0
- package/dist/cli/hosts/upgrade.js +366 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/list/index.js +1 -1
- package/dist/cli/notes/archive-command.d.ts +7 -0
- package/dist/cli/notes/archive-command.js +59 -0
- package/dist/cli/notes/edit-commands.d.ts +1 -0
- package/dist/cli/notes/edit-commands.js +2 -0
- package/dist/cli/notes/index.d.ts +2 -0
- package/dist/cli/notes/index.js +21 -11
- package/dist/cli/resources.d.ts +6 -2
- package/dist/cli/resources.js +4 -4
- package/dist/cli/update/index.js +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { BOOTSTRAP_PYTHON } from "./bootstrap-source.js";
|
|
7
|
+
import { hostStatus } from "./enroll.js";
|
|
8
|
+
import { hostConnection, listHosts, resolveHostNamespace } from "./inventory.js";
|
|
9
|
+
import { defaultSshIO, runHostSsh } from "./ssh.js";
|
|
10
|
+
/**
|
|
11
|
+
* Host-side upgrade, verification and rollback run the enrollment bootstrap
|
|
12
|
+
* (bootstrap.py) over `dreamlake exec`. The program and its JSON payload travel
|
|
13
|
+
* on stdin, so the remote command stays a short fixed loader.
|
|
14
|
+
*/
|
|
15
|
+
export const BOOTSTRAP_LOADER = [
|
|
16
|
+
"import io,sys",
|
|
17
|
+
"d=sys.stdin.buffer.read()",
|
|
18
|
+
"n,_,r=d.partition(b'\\n')",
|
|
19
|
+
"n=int(n)",
|
|
20
|
+
"sys.stdin=io.TextIOWrapper(io.BytesIO(r[n:]),encoding='utf-8')",
|
|
21
|
+
"exec(compile(r[:n].decode('utf-8'),'dreamlake-host-bootstrap','exec'),{'__name__':'__main__'})",
|
|
22
|
+
].join("\n");
|
|
23
|
+
export function bootstrapInput(payload) {
|
|
24
|
+
const source = Buffer.from(BOOTSTRAP_PYTHON, "utf8");
|
|
25
|
+
return Buffer.concat([Buffer.from(`${source.length}\n`), source, Buffer.from(JSON.stringify(payload))]);
|
|
26
|
+
}
|
|
27
|
+
/** The bootstrap prints exactly one JSON object; tolerate shell noise before it. */
|
|
28
|
+
export function parseBootstrapOutput(text) {
|
|
29
|
+
for (const line of text.trim().split("\n").reverse()) {
|
|
30
|
+
try {
|
|
31
|
+
const value = JSON.parse(line);
|
|
32
|
+
if (value && typeof value === "object" && !Array.isArray(value))
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
catch { }
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
/** Runs one bootstrap action through the nymph SSH relay (the `dreamlake exec` path). */
|
|
40
|
+
export const execOverNymph = async (target, payload, timeoutSeconds) => {
|
|
41
|
+
const chunks = [];
|
|
42
|
+
let bytes = 0;
|
|
43
|
+
const io = { ...defaultSshIO, spawn: args => {
|
|
44
|
+
const child = spawn("ssh", args, { stdio: ["pipe", "pipe", "ignore"] });
|
|
45
|
+
child.stdout.on("data", (b) => { bytes += b.length; if (bytes <= 64_000)
|
|
46
|
+
chunks.push(b); });
|
|
47
|
+
child.stdin.on("error", () => { });
|
|
48
|
+
child.stdin.end(bootstrapInput(payload));
|
|
49
|
+
return child;
|
|
50
|
+
} };
|
|
51
|
+
const exitCode = await runHostSsh(target.selector, { namespace: target.namespace, enrollment: target.enrollment,
|
|
52
|
+
duration: "1800", timeout: String(timeoutSeconds) }, ["python3", "-c", BOOTSTRAP_LOADER], io);
|
|
53
|
+
return { exitCode, result: parseBootstrapOutput(Buffer.concat(chunks).toString("utf8")) };
|
|
54
|
+
};
|
|
55
|
+
const VERSION = /^v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
56
|
+
const UPGRADE_ID = /^\d{8}-\d{3}$/;
|
|
57
|
+
const ENROLLMENT = /^[a-f0-9]{24}$/;
|
|
58
|
+
// Host-side verification waits up to this long after the scheduled restart.
|
|
59
|
+
const RESTART_GRACE = 90;
|
|
60
|
+
function integer(value, fallback, low, high, flag) {
|
|
61
|
+
const n = value === undefined ? fallback : Number(value);
|
|
62
|
+
if (!Number.isInteger(n) || n < low || n > high)
|
|
63
|
+
throw new Error(`${flag} must be an integer from ${low} to ${high}`);
|
|
64
|
+
return n;
|
|
65
|
+
}
|
|
66
|
+
export function resolveFleetPlan(opts) {
|
|
67
|
+
let version;
|
|
68
|
+
if (opts.action === "upgrade") {
|
|
69
|
+
if (typeof opts.nymphVersion !== "string" || !VERSION.test(opts.nymphVersion)) {
|
|
70
|
+
throw new Error("--nymph-version must be an exact release such as 0.1.32; fleet upgrades never use latest");
|
|
71
|
+
}
|
|
72
|
+
version = opts.nymphVersion.replace(/^v/, "");
|
|
73
|
+
}
|
|
74
|
+
else if (opts.nymphVersion !== undefined)
|
|
75
|
+
throw new Error("rollback restores the kept previous binary; omit --nymph-version");
|
|
76
|
+
if (opts.upgradeId !== undefined && (opts.action !== "rollback" || !UPGRADE_ID.test(opts.upgradeId))) {
|
|
77
|
+
throw new Error("--upgrade-id applies to rollback and must look like YYYYMMDD-NNN");
|
|
78
|
+
}
|
|
79
|
+
if (opts.enrollment !== undefined && !ENROLLMENT.test(opts.enrollment))
|
|
80
|
+
throw new Error("--enrollment must be an exact enrollment ID");
|
|
81
|
+
const restartDelay = integer(opts.restartDelay, 15, 5, 300, "--restart-delay");
|
|
82
|
+
const stableSeconds = integer(opts.stableSeconds, 15, 5, 300, "--stable-seconds");
|
|
83
|
+
return {
|
|
84
|
+
action: opts.action, version, upgradeId: opts.upgradeId, dryRun: opts.dryRun === true, namespace: opts.namespace, enrollment: opts.enrollment,
|
|
85
|
+
concurrency: integer(opts.concurrency, 1, 1, 16, "--concurrency"),
|
|
86
|
+
maxFailures: integer(opts.maxFailures, 1, 1, 10_000, "--max-failures"),
|
|
87
|
+
restartDelay, stableSeconds,
|
|
88
|
+
verifyTimeout: integer(opts.verifyTimeout, 300, restartDelay + stableSeconds + 30, 3600, "--verify-timeout"),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const resolveDefaults = { status: hostStatus, list: listHosts, namespace: resolveHostNamespace };
|
|
92
|
+
/** Expands selectors into distinct hosts, in order. A host appears at most once. */
|
|
93
|
+
export async function resolveFleetHosts(selectors, opts, deps = resolveDefaults) {
|
|
94
|
+
if (opts.all ? selectors.length > 0 : selectors.length === 0)
|
|
95
|
+
throw new Error("Select hosts by ID, namespace/group/host or namespace/group/*, or use --all (not both)");
|
|
96
|
+
const hosts = [];
|
|
97
|
+
const seen = new Set();
|
|
98
|
+
const add = (host, namespace, enrollments = host.enrollments) => {
|
|
99
|
+
if (!host || typeof host.id !== "string" || !/^[a-f0-9]{24}$/i.test(host.id) || typeof host.name !== "string")
|
|
100
|
+
throw new Error("Host API returned an invalid host");
|
|
101
|
+
const id = host.id.toLowerCase();
|
|
102
|
+
if (seen.has(id))
|
|
103
|
+
return;
|
|
104
|
+
seen.add(id);
|
|
105
|
+
hosts.push({ id, name: host.name, namespace, online: hostConnection(enrollments) === "online" });
|
|
106
|
+
};
|
|
107
|
+
if (opts.all) {
|
|
108
|
+
const namespace = await deps.namespace(opts.namespace);
|
|
109
|
+
for (const host of (await deps.list({ namespace, all: true })).hosts)
|
|
110
|
+
add(host, namespace);
|
|
111
|
+
return hosts;
|
|
112
|
+
}
|
|
113
|
+
for (const selector of selectors) {
|
|
114
|
+
const parts = selector.split("/");
|
|
115
|
+
if (parts.length === 3 && parts[2] === "*") {
|
|
116
|
+
if (opts.namespace !== undefined && opts.namespace !== parts[0])
|
|
117
|
+
throw new Error("--namespace conflicts with the host selector");
|
|
118
|
+
for (const host of (await deps.list({ namespace: parts[0], group: parts[1], all: true })).hosts)
|
|
119
|
+
add(host, parts[0]);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (selector.includes("*"))
|
|
123
|
+
throw new Error("Wildcards select a whole group: namespace/group/*");
|
|
124
|
+
if (parts.length === 3 && opts.namespace !== undefined && opts.namespace !== parts[0])
|
|
125
|
+
throw new Error("--namespace conflicts with the host selector");
|
|
126
|
+
const namespace = parts.length === 3 ? parts[0] : await deps.namespace(opts.namespace);
|
|
127
|
+
const detail = await deps.status(selector, { namespace: parts.length === 3 ? undefined : namespace });
|
|
128
|
+
add(detail?.host, namespace, detail?.enrollments);
|
|
129
|
+
}
|
|
130
|
+
return hosts;
|
|
131
|
+
}
|
|
132
|
+
const nowIso = (deps) => new Date(deps.now()).toISOString();
|
|
133
|
+
function failure(base, code, error, extra = {}) {
|
|
134
|
+
return { ...base, ...extra, status: "failed", code, error };
|
|
135
|
+
}
|
|
136
|
+
const HOST_ERRORS = {
|
|
137
|
+
service_not_installed: "no nymph service from `dreamlake hosts enroll` was found for this host name",
|
|
138
|
+
nymph_binary_unmanaged: "the service binary is not a user-owned regular file in a writable directory (package-managed or root-owned); upgrade it with its installer",
|
|
139
|
+
nymph_binary_missing: "the service binary is missing",
|
|
140
|
+
upgrade_in_progress: "another upgrade, verification or rollback holds this host's lock",
|
|
141
|
+
restart_pending: "another restart became due on the host during this run; rerun to apply",
|
|
142
|
+
restart_schedule_failed: "the delayed restart could not be scheduled; the previous binary was restored",
|
|
143
|
+
installer_failed: "the nymph installer did not produce a binary",
|
|
144
|
+
installer_version_mismatch: "the installed binary reports a different version than requested",
|
|
145
|
+
rollback_receipt_mismatch: "the installed binary is not the one the selected upgrade installed; nothing was changed",
|
|
146
|
+
rollback_binary_corrupt: "the kept previous binary no longer matches its recorded checksum; nothing was changed",
|
|
147
|
+
receipt_not_found: "no upgrade receipt from this tool matches the installed binary",
|
|
148
|
+
systemd_run_required: "Linux upgrade needs systemd-run for the one-shot restart timer",
|
|
149
|
+
invalid_version: "invalid nymph version",
|
|
150
|
+
upgrade_failed: "host-side upgrade failed",
|
|
151
|
+
};
|
|
152
|
+
function hostError(reply) {
|
|
153
|
+
const code = typeof reply.result?.code === "string" ? reply.result.code : "no_result";
|
|
154
|
+
return { code, error: HOST_ERRORS[code] ?? (code === "no_result" ? `the host returned no result (exit ${reply.exitCode})` : `host-side check failed: ${code}`) };
|
|
155
|
+
}
|
|
156
|
+
/** One host: apply, wait out the delayed restart, then verify it happened exactly once. */
|
|
157
|
+
export async function processFleetHost(host, plan, deps) {
|
|
158
|
+
const base = { host: host.name, hostId: host.id, status: "failed", startedAt: nowIso(deps) };
|
|
159
|
+
const done = (outcome) => ({ ...outcome, finishedAt: nowIso(deps) });
|
|
160
|
+
if (!host.online)
|
|
161
|
+
return done({ ...base, status: "skipped", code: "offline", error: "no verified online enrollment; not contacted" });
|
|
162
|
+
const target = { selector: host.id, namespace: host.namespace, enrollment: plan.enrollment };
|
|
163
|
+
if (plan.dryRun) {
|
|
164
|
+
let reply;
|
|
165
|
+
try {
|
|
166
|
+
reply = await deps.exec(target, { action: "inspect", name: host.name, ...(plan.version ? { version: plan.version } : {}) }, 120);
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
return done(failure(base, "transport", error instanceof Error ? error.message : "exec failed"));
|
|
170
|
+
}
|
|
171
|
+
if (reply.result?.status !== "inspected")
|
|
172
|
+
return done(failure(base, hostError(reply).code, hostError(reply).error));
|
|
173
|
+
const { status: _status, ...inspected } = reply.result;
|
|
174
|
+
return done({ ...base, status: "planned", version: inspected.version, plan: inspected });
|
|
175
|
+
}
|
|
176
|
+
const payload = { action: plan.action, name: host.name, restartDelaySeconds: plan.restartDelay,
|
|
177
|
+
...(plan.version ? { version: plan.version } : {}), ...(plan.upgradeId ? { upgradeId: plan.upgradeId } : {}) };
|
|
178
|
+
let earlier;
|
|
179
|
+
// At most two rounds: a restart still due from an earlier run is verified first (never
|
|
180
|
+
// stacked), then the requested action is applied once.
|
|
181
|
+
for (let round = 0; round < 2; round++) {
|
|
182
|
+
let reply;
|
|
183
|
+
try {
|
|
184
|
+
reply = await deps.exec(target, payload, 600);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return done(failure(base, "transport", error instanceof Error ? error.message : "exec failed"));
|
|
188
|
+
}
|
|
189
|
+
const applied = reply.result;
|
|
190
|
+
const extra = earlier ? { earlierRestart: earlier } : {};
|
|
191
|
+
if (applied?.status === "current") {
|
|
192
|
+
return done({ ...base, ...extra, status: "current", version: applied.version, pid: { before: applied.pid, after: applied.pid }, restarts: 0, leftoverJobsRemoved: applied.leftoverJobsRemoved });
|
|
193
|
+
}
|
|
194
|
+
if (applied?.code === "restart_pending" && UPGRADE_ID.test(applied.upgradeId) && round === 0) {
|
|
195
|
+
const previous = await verifyRestart(host, target, applied.upgradeId, plan, deps, { ...base, upgradeId: applied.upgradeId });
|
|
196
|
+
if (previous.status !== "verified") {
|
|
197
|
+
return done(failure(previous.outcome, "earlier_restart_unverified", `an earlier restart (${applied.upgradeId}) was still due and did not verify: ${previous.outcome.error}`));
|
|
198
|
+
}
|
|
199
|
+
earlier = { upgradeId: applied.upgradeId, status: "verified" };
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (applied?.status !== "restart_scheduled" || !UPGRADE_ID.test(applied.upgradeId)) {
|
|
203
|
+
const { code, error } = hostError(reply);
|
|
204
|
+
return done(failure({ ...base, ...extra }, code, error));
|
|
205
|
+
}
|
|
206
|
+
const pending = { ...base, ...extra, upgradeId: applied.upgradeId, version: applied.version, previousVersion: applied.previousVersion,
|
|
207
|
+
restart: applied.restart, leftoverJobsRemoved: applied.leftoverJobsRemoved };
|
|
208
|
+
deps.record({ type: "scheduled", ...pending });
|
|
209
|
+
const result = await verifyRestart(host, target, applied.upgradeId, plan, deps, pending);
|
|
210
|
+
return done(result.status === "verified" ? { ...result.outcome, status: plan.action === "rollback" ? "rolled_back" : "upgraded" } : result.outcome);
|
|
211
|
+
}
|
|
212
|
+
return done(failure(base, "restart_pending", "a restart is still pending on the host"));
|
|
213
|
+
}
|
|
214
|
+
/** Waits out the delayed restart, then verifies it, retrying while the relay reconnects. */
|
|
215
|
+
async function verifyRestart(host, target, upgradeId, plan, deps, pending) {
|
|
216
|
+
// The restart ends the session that scheduled it; reconnect only after it is due.
|
|
217
|
+
await deps.sleep((plan.restartDelay + 3) * 1000);
|
|
218
|
+
const deadline = deps.now() + plan.verifyTimeout * 1000;
|
|
219
|
+
let last = "verification did not run";
|
|
220
|
+
while (true) {
|
|
221
|
+
try {
|
|
222
|
+
const check = await deps.exec(target, { action: "verify", name: host.name, upgradeId, stableSeconds: plan.stableSeconds }, plan.stableSeconds + RESTART_GRACE + 60);
|
|
223
|
+
const result = check.result;
|
|
224
|
+
const observed = result?.status === "verified" || result?.status === "failed" ? {
|
|
225
|
+
version: result.version, pid: result.pid, restarts: result.restarts, failures: result.failures,
|
|
226
|
+
} : undefined;
|
|
227
|
+
if (result?.status === "verified")
|
|
228
|
+
return { status: "verified", outcome: { ...pending, ...observed } };
|
|
229
|
+
if (result?.status === "failed") {
|
|
230
|
+
return { status: "failed", outcome: failure(pending, "verification_failed", `restart verification failed: ${(result.failures ?? []).join(", ")}`, observed) };
|
|
231
|
+
}
|
|
232
|
+
// A missing result means the relay dropped (often nymph restarting); a busy lock clears.
|
|
233
|
+
if (result?.code && result.code !== "upgrade_in_progress") {
|
|
234
|
+
const e = hostError(check);
|
|
235
|
+
return { status: "failed", outcome: failure(pending, e.code, e.error) };
|
|
236
|
+
}
|
|
237
|
+
last = result?.code ? HOST_ERRORS[result.code] : `verification session ended without a result (exit ${check.exitCode})`;
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
last = error instanceof Error ? error.message : "exec failed";
|
|
241
|
+
}
|
|
242
|
+
if (deps.now() >= deadline)
|
|
243
|
+
return { status: "failed", outcome: failure(pending, "verification_timeout", `${last}; rerun upgrade or inspect with --dry-run`) };
|
|
244
|
+
await deps.sleep(5000);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/** Bounded concurrency; stops starting hosts after maxFailures; one worker per host at a time. */
|
|
248
|
+
export async function runFleet(hosts, plan, deps) {
|
|
249
|
+
const ids = new Set(hosts.map(h => h.id));
|
|
250
|
+
if (ids.size !== hosts.length)
|
|
251
|
+
throw new Error("A host was selected twice");
|
|
252
|
+
const outcomes = new Array(hosts.length);
|
|
253
|
+
const active = new Set();
|
|
254
|
+
let next = 0, failures = 0;
|
|
255
|
+
const worker = async () => {
|
|
256
|
+
while (next < hosts.length && failures < plan.maxFailures) {
|
|
257
|
+
const index = next++;
|
|
258
|
+
const host = hosts[index];
|
|
259
|
+
if (active.has(host.id))
|
|
260
|
+
throw new Error("A host was scheduled twice concurrently");
|
|
261
|
+
active.add(host.id);
|
|
262
|
+
let outcome;
|
|
263
|
+
try {
|
|
264
|
+
outcome = await processFleetHost(host, plan, deps);
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
outcome = { host: host.name, hostId: host.id, status: "failed", code: "internal", error: error instanceof Error ? error.message : String(error) };
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
active.delete(host.id);
|
|
271
|
+
}
|
|
272
|
+
if (outcome.status === "failed")
|
|
273
|
+
failures++;
|
|
274
|
+
outcomes[index] = outcome;
|
|
275
|
+
deps.record({ type: "host", ...outcome });
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
await Promise.all(Array.from({ length: Math.min(plan.concurrency, hosts.length) }, worker));
|
|
279
|
+
// Array.from, not map: map skips the holes left by hosts that were never started.
|
|
280
|
+
const final = Array.from(hosts, (h, i) => outcomes[i] ?? { host: h.name, hostId: h.id, status: "not_started" });
|
|
281
|
+
const counts = {};
|
|
282
|
+
for (const outcome of final)
|
|
283
|
+
counts[outcome.status] = (counts[outcome.status] ?? 0) + 1;
|
|
284
|
+
return { action: plan.action, ...(plan.version ? { version: plan.version } : {}), dryRun: plan.dryRun,
|
|
285
|
+
stoppedEarly: final.some(o => o.status === "not_started"), counts, hosts: final };
|
|
286
|
+
}
|
|
287
|
+
export function fleetSucceeded(report) {
|
|
288
|
+
return report.hosts.every(h => ["upgraded", "rolled_back", "current", "planned"].includes(h.status));
|
|
289
|
+
}
|
|
290
|
+
function cell(value) {
|
|
291
|
+
return value === undefined || value === null || value === "" ? "-" : String(value).replace(/[\x00-\x1f\x7f-\x9f]/g, " ");
|
|
292
|
+
}
|
|
293
|
+
export function formatFleetReport(report) {
|
|
294
|
+
const rows = [["HOST", "STATUS", "VERSION", "PID", "RESTARTS", "NOTE"], ...report.hosts.map(h => [
|
|
295
|
+
cell(h.host), h.status, h.plan ? `${cell(h.version)} (plan: ${cell(h.plan.plan)})` : h.previousVersion && h.version ? `${h.previousVersion} -> ${h.version}` : cell(h.version),
|
|
296
|
+
h.pid ? `${cell(h.pid.before)} -> ${cell(h.pid.after)}` : "-", cell(h.restarts),
|
|
297
|
+
cell([h.error, h.leftoverJobsRemoved?.length ? `removed leftover job ${h.leftoverJobsRemoved.join(", ")}` : "",
|
|
298
|
+
h.plan && Array.isArray(h.plan.leftoverJobs) && h.plan.leftoverJobs.length ? `would remove leftover job ${h.plan.leftoverJobs.join(", ")}` : ""].filter(Boolean).join("; ")),
|
|
299
|
+
])];
|
|
300
|
+
const widths = rows[0].map((_, i) => Math.max(...rows.map(r => r[i].length)));
|
|
301
|
+
const lines = rows.map(r => r.map((v, i) => i === r.length - 1 ? v : v.padEnd(widths[i])).join(" "));
|
|
302
|
+
lines.push(Object.entries(report.counts).map(([k, v]) => `${v} ${k}`).join(", ") + ".");
|
|
303
|
+
if (report.stoppedEarly)
|
|
304
|
+
lines.push("Stopped after reaching --max-failures; not_started hosts were not contacted.");
|
|
305
|
+
if (report.dryRun)
|
|
306
|
+
lines.push("Dry run: hosts were inspected read-only; nothing was changed.");
|
|
307
|
+
if (report.record)
|
|
308
|
+
lines.push(`Outcome record: ${report.record}`);
|
|
309
|
+
return lines.join("\n");
|
|
310
|
+
}
|
|
311
|
+
function recordFile(file) {
|
|
312
|
+
const target = file ?? path.join(homedir(), ".dreamlake/hosts-upgrades", `${new Date().toISOString().replace(/[:.]/g, "-")}-${randomBytes(3).toString("hex")}.jsonl`);
|
|
313
|
+
mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
|
|
314
|
+
return { path: target, write: entry => appendFileSync(target, JSON.stringify({ at: new Date().toISOString(), ...entry }) + "\n", { mode: 0o600 }) };
|
|
315
|
+
}
|
|
316
|
+
export async function runHostsUpgrade(selectors, opts, overrides = {}) {
|
|
317
|
+
let record;
|
|
318
|
+
try {
|
|
319
|
+
const plan = resolveFleetPlan(opts);
|
|
320
|
+
const hosts = await resolveFleetHosts(selectors, { all: opts.all, namespace: opts.namespace }, overrides.resolve);
|
|
321
|
+
if (plan.enrollment && hosts.length !== 1)
|
|
322
|
+
throw new Error("--enrollment applies to exactly one host");
|
|
323
|
+
if (plan.upgradeId && hosts.length !== 1)
|
|
324
|
+
throw new Error("--upgrade-id applies to exactly one host; upgrade IDs are per host");
|
|
325
|
+
record = recordFile(opts.record);
|
|
326
|
+
const deps = { exec: overrides.exec ?? execOverNymph, sleep: overrides.sleep ?? (ms => new Promise(r => setTimeout(r, ms))),
|
|
327
|
+
now: overrides.now ?? Date.now, record: overrides.record ?? record.write };
|
|
328
|
+
deps.record({ type: "run", action: plan.action, version: plan.version, dryRun: plan.dryRun, concurrency: plan.concurrency,
|
|
329
|
+
maxFailures: plan.maxFailures, hosts: hosts.map(h => ({ host: h.name, hostId: h.id, online: h.online })) });
|
|
330
|
+
const report = { ...await runFleet(hosts, plan, deps), record: record.path };
|
|
331
|
+
deps.record({ type: "summary", counts: report.counts, stoppedEarly: report.stoppedEarly });
|
|
332
|
+
console.log(opts.json ? JSON.stringify(report, null, 2) : formatFleetReport(report));
|
|
333
|
+
return fleetSucceeded(report) ? 0 : 1;
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
337
|
+
if (opts.json)
|
|
338
|
+
console.log(JSON.stringify({ status: "error", error: message, ...(record ? { record: record.path } : {}) }));
|
|
339
|
+
else
|
|
340
|
+
console.error(`Host ${opts.action}: ${message}`);
|
|
341
|
+
return 1;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
export function registerHostUpgradeCommands(group) {
|
|
345
|
+
const common = (command) => command
|
|
346
|
+
.argument("[selectors...]", "host IDs, namespace/group/host, or quoted namespace/group/*")
|
|
347
|
+
.option("--all", "every host in --namespace (offline hosts are reported as skipped)")
|
|
348
|
+
.option("--namespace <namespace>", "namespace for --all and host IDs (default: signed-in personal namespace)")
|
|
349
|
+
.option("--enrollment <id>", "exact SSH enrollment when one host has several")
|
|
350
|
+
.option("--dry-run", "inspect each host read-only (version, pending restart, leftover jobs); change nothing")
|
|
351
|
+
.option("--concurrency <n>", "hosts processed at once, 1–16 (default 1)")
|
|
352
|
+
.option("--max-failures <n>", "stop starting new hosts after this many failures (default 1)")
|
|
353
|
+
.option("--restart-delay <seconds>", "delay before the one-shot nymph restart, 5–300 (default 15)")
|
|
354
|
+
.option("--stable-seconds <seconds>", "new nymph PID must stay unchanged this long, 5–300 (default 15)")
|
|
355
|
+
.option("--verify-timeout <seconds>", "time allowed to reconnect and verify after the restart (default 300)")
|
|
356
|
+
.option("--record <path>", "JSON Lines outcome record (default ~/.dreamlake/hosts-upgrades/<run>.jsonl)")
|
|
357
|
+
.option("--json", "emit the fleet report as JSON");
|
|
358
|
+
common(group.command("upgrade")
|
|
359
|
+
.description("upgrade nymph on enrolled hosts over the nymph relay with one verified delayed restart"))
|
|
360
|
+
.option("--nymph-version <version>", "exact nymph release to install, such as 0.1.32 (required)")
|
|
361
|
+
.action(async (selectors, opts) => { process.exitCode = await runHostsUpgrade(selectors, { ...opts, action: "upgrade" }); });
|
|
362
|
+
common(group.command("rollback")
|
|
363
|
+
.description("restore the nymph binary kept by the last upgrade and verify one delayed restart"))
|
|
364
|
+
.option("--upgrade-id <id>", "roll back this YYYYMMDD-NNN host receipt instead of the latest (one host only)")
|
|
365
|
+
.action(async (selectors, opts) => { process.exitCode = await runHostsUpgrade(selectors, { ...opts, action: "rollback" }); });
|
|
366
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import { registerPageCommand } from "./page/index.js";
|
|
|
34
34
|
import { registerConnectionCommand } from "./connection/index.js";
|
|
35
35
|
import { registerSourceCommand } from "./source/index.js";
|
|
36
36
|
import { registerTasksCommand } from "./tasks/index.js";
|
|
37
|
+
import { registerFoldersCommand } from "./folders/index.js";
|
|
37
38
|
import { registerNotesCommand } from "./notes/index.js";
|
|
38
39
|
import { registerDeclareCommand } from "./declare/index.js";
|
|
39
40
|
import { registerHostsCommand } from "./hosts/index.js";
|
|
@@ -194,6 +195,7 @@ async function main(argv) {
|
|
|
194
195
|
registerPageCommand(program);
|
|
195
196
|
registerSourceCommand(program);
|
|
196
197
|
registerNotesCommand(program);
|
|
198
|
+
registerFoldersCommand(program);
|
|
197
199
|
registerOwnershipCommand(program);
|
|
198
200
|
registerProjectCommand(program);
|
|
199
201
|
registerTasksCommand(program);
|
package/dist/cli/list/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export async function runListAssets(opts) {
|
|
|
37
37
|
let containerPrefix;
|
|
38
38
|
try {
|
|
39
39
|
if (t.episode) {
|
|
40
|
-
const episodes = await fetchAllEpisodes(remote, t.namespace, t.project, token);
|
|
40
|
+
const episodes = await fetchAllEpisodes(remote, t.namespace, t.project, token, { includeArchived: true });
|
|
41
41
|
const ep = episodes.find((e) => e.name === t.episode);
|
|
42
42
|
if (!ep) {
|
|
43
43
|
fail(`episode '${t.episode}' not found in ${t.project}@${t.namespace}`);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Archive is reversible lifecycle metadata, independent of deletion and tags. */
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
import { type ConnOpts } from './index.js';
|
|
4
|
+
export declare function runNotesArchive(ref: string, archived: boolean, opts: ConnOpts & {
|
|
5
|
+
json?: boolean;
|
|
6
|
+
}): Promise<number>;
|
|
7
|
+
export declare function registerArchiveCommands(notes: Command): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { notesApi } from '../../api/notes.js';
|
|
2
|
+
import { requestJson } from '../client.js';
|
|
3
|
+
import { resolveCtx } from '../compat/ctx.js';
|
|
4
|
+
import { requireNamespace, requireToken } from '../compat/http.js';
|
|
5
|
+
import { withConnFlags } from '../compat/flags.js';
|
|
6
|
+
import { emitJson, fail } from '../helpers.js';
|
|
7
|
+
import { noteTransport } from './api-transport.js';
|
|
8
|
+
import { resolveNote, report, seg } from './index.js';
|
|
9
|
+
export async function runNotesArchive(ref, archived, opts) {
|
|
10
|
+
const c = resolveCtx(opts), token = requireToken(c);
|
|
11
|
+
if (!token)
|
|
12
|
+
return 1;
|
|
13
|
+
const asserted = opts.namespace?.trim().replace(/^@/, '') || undefined;
|
|
14
|
+
try {
|
|
15
|
+
let id = ref;
|
|
16
|
+
if (!/^[a-f0-9]{24}$/i.test(ref)) {
|
|
17
|
+
const ns = await requireNamespace(c, asserted);
|
|
18
|
+
if (!ns)
|
|
19
|
+
return 1;
|
|
20
|
+
const found = await resolveNote({ remote: c.remote, token, ns }, ref);
|
|
21
|
+
if (!found)
|
|
22
|
+
return 1;
|
|
23
|
+
id = found;
|
|
24
|
+
}
|
|
25
|
+
const note = await requestJson(c.remote, `/notes/${seg(id)}`, { token });
|
|
26
|
+
if (note.id !== id || !note.namespaceSlug) {
|
|
27
|
+
fail("server did not return the note's owning namespace");
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
if (asserted && asserted !== note.namespaceSlug) {
|
|
31
|
+
fail(`note ${id} is in '${note.namespaceSlug}', not --namespace '${asserted}'`);
|
|
32
|
+
return 1;
|
|
33
|
+
}
|
|
34
|
+
if (note.permissions?.rename === false) {
|
|
35
|
+
fail('you do not have permission to archive this note');
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
const api = notesApi(noteTransport({ remote: c.remote, token }), note.namespaceSlug);
|
|
39
|
+
const result = await (archived ? api.archive(id) : api.unarchive(id));
|
|
40
|
+
if (opts.json)
|
|
41
|
+
emitJson(result);
|
|
42
|
+
else
|
|
43
|
+
process.stdout.write(`✓ ${archived ? 'archived' : 'unarchived'} note ${id}\n`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return report(error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function registerArchiveCommands(notes) {
|
|
51
|
+
for (const action of ['archive', 'unarchive']) {
|
|
52
|
+
withConnFlags(notes.command(action).allowExcessArguments(false))
|
|
53
|
+
.description(action === 'archive' ? 'archive a note without deleting it or removing its filings' : 'unarchive a note and restore its folder path')
|
|
54
|
+
.argument('<note>', 'note id, slug or exact title')
|
|
55
|
+
.option('--namespace <slug>', 'whose notes for lookup; with an id, asserts the owner')
|
|
56
|
+
.option('--json', 'emit the updated note metadata')
|
|
57
|
+
.action(async (note, opts) => { process.exitCode = await runNotesArchive(note, action === 'archive', opts); });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -94,6 +94,7 @@ export declare function runNotesSelect(css: string, opts: ConnOpts & {
|
|
|
94
94
|
json?: boolean;
|
|
95
95
|
}): Promise<number>;
|
|
96
96
|
export declare function runNotesGrep(query: string | undefined, opts: ConnOpts & {
|
|
97
|
+
includeArchived?: boolean;
|
|
97
98
|
regex?: string;
|
|
98
99
|
flags?: string;
|
|
99
100
|
caseSensitive?: boolean;
|
|
@@ -545,6 +545,8 @@ export async function runNotesGrep(query, opts) {
|
|
|
545
545
|
const base = new URLSearchParams();
|
|
546
546
|
if (query !== undefined)
|
|
547
547
|
base.set("q", query);
|
|
548
|
+
if (opts.includeArchived)
|
|
549
|
+
base.set("includeArchived", "true");
|
|
548
550
|
if (opts.regex !== undefined)
|
|
549
551
|
base.set("regex", opts.regex);
|
|
550
552
|
if (opts.flags)
|
|
@@ -44,10 +44,12 @@ export declare function registerNotesCommand(program: Command): void;
|
|
|
44
44
|
export declare function runNotesList(opts: ConnOpts & {
|
|
45
45
|
limit?: string;
|
|
46
46
|
shared?: boolean;
|
|
47
|
+
includeArchived?: boolean;
|
|
47
48
|
json?: boolean;
|
|
48
49
|
}): Promise<number>;
|
|
49
50
|
export declare function runNotesSearch(query: string, opts: ConnOpts & {
|
|
50
51
|
limit?: string;
|
|
52
|
+
includeArchived?: boolean;
|
|
51
53
|
json?: boolean;
|
|
52
54
|
}): Promise<number>;
|
|
53
55
|
export declare function runNotesSections(ref: string, opts: ConnOpts & {
|
package/dist/cli/notes/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { collectionList } from "../collection-list.js";
|
|
|
4
4
|
import { registerVersionCommands, runSavedVersionRead } from "./version-commands.js";
|
|
5
5
|
import { registerMoveCommand } from "./move-command.js";
|
|
6
6
|
import { registerTransferCommand } from "./transfer-command.js";
|
|
7
|
+
import { registerArchiveCommands } from "./archive-command.js";
|
|
7
8
|
import { registerRmCommand } from "./rm-command.js";
|
|
8
9
|
import { registerSuggestDiffCommand } from "./suggest-diff.js";
|
|
9
10
|
import { registerShareCommands } from "../share.js";
|
|
@@ -108,14 +109,19 @@ export function report(err) {
|
|
|
108
109
|
export async function resolveNote(c, ref) {
|
|
109
110
|
if (/^[a-f0-9]{24}$/i.test(ref))
|
|
110
111
|
return ref;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
let offset = 0;
|
|
113
|
+
for (;;) {
|
|
114
|
+
const res = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/notes?limit=200&includeArchived=true&offset=${offset}`, { token: c.token });
|
|
115
|
+
const hit = res.notes.find((n) => n.slug === ref || n.id === ref || n.name === ref);
|
|
116
|
+
if (hit)
|
|
117
|
+
return hit.id;
|
|
118
|
+
offset += res.notes.length;
|
|
119
|
+
if (!res.notes.length || (res.total === undefined ? res.notes.length < 200 : offset >= res.total))
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
fail(`no note '${ref}' in namespace '${c.ns}' — 'dreamlake notes list --include-archived' shows what is there, ` +
|
|
123
|
+
`and an organization's notes need --namespace <slug>`);
|
|
124
|
+
return null;
|
|
119
125
|
}
|
|
120
126
|
/** Body text from --file, --text, or stdin. Exactly one, so an empty write is
|
|
121
127
|
* always deliberate rather than the result of a forgotten flag. */
|
|
@@ -193,6 +199,7 @@ export function registerNotesCommand(program) {
|
|
|
193
199
|
registerMoveCommand(notes);
|
|
194
200
|
registerTransferCommand(notes);
|
|
195
201
|
registerRmCommand(notes);
|
|
202
|
+
registerArchiveCommands(notes);
|
|
196
203
|
registerSuggestDiffCommand(notes);
|
|
197
204
|
// Same connection flags as the other ported groups, so --debug/--remote
|
|
198
205
|
// behave identically across the CLI.
|
|
@@ -229,6 +236,7 @@ export function registerNotesCommand(program) {
|
|
|
229
236
|
// ── notes list ──
|
|
230
237
|
strict(collectionList(notes, "list"))
|
|
231
238
|
.description("list notes in one namespace")
|
|
239
|
+
.option("--include-archived", "include archived notes")
|
|
232
240
|
.option("--limit <n>", "page size", "50")
|
|
233
241
|
.option("--namespace <slug>", "whose notes (default: your personal namespace, not an org's)")
|
|
234
242
|
.option("--shared", "list notes other people shared with you, across namespaces")
|
|
@@ -238,6 +246,7 @@ export function registerNotesCommand(program) {
|
|
|
238
246
|
strict(notes.command("search"))
|
|
239
247
|
.argument("<query>", "matched against note titles and bodies, case-insensitively")
|
|
240
248
|
.description("find notes by title or body text")
|
|
249
|
+
.option("--include-archived", "include archived notes")
|
|
241
250
|
.option("--limit <n>", "page size", "50")
|
|
242
251
|
.option("--namespace <slug>", "whose notes (default: your personal namespace, not an org's)")
|
|
243
252
|
.option("--json", "emit JSON")
|
|
@@ -246,6 +255,7 @@ export function registerNotesCommand(program) {
|
|
|
246
255
|
strict(notes.command("grep"))
|
|
247
256
|
.argument("[query]", "literal text; punctuation matches itself")
|
|
248
257
|
.description("search every note you can see and print where each hit is")
|
|
258
|
+
.option("--include-archived", "include archived notes")
|
|
249
259
|
.option("--regex <pattern>", "search by pattern instead of literal text")
|
|
250
260
|
.option("--flags <flags>", "regex flags: any of i, m, s, u")
|
|
251
261
|
.option("--case-sensitive", "match case (the default for --regex)")
|
|
@@ -604,8 +614,8 @@ export async function runNotesList(opts) {
|
|
|
604
614
|
return 1;
|
|
605
615
|
try {
|
|
606
616
|
const rows = opts.shared
|
|
607
|
-
? (await requestJson(c.remote, "/me/notes/shared", { token: c.token })).notes
|
|
608
|
-
: (await requestJson(c.remote, `/namespaces/${seg(c.ns)}/notes?limit=${encodeURIComponent(opts.limit ?? "50")}`, { token: c.token })).notes;
|
|
617
|
+
? (await requestJson(c.remote, "/me/notes/shared", { token: c.token, query: { includeArchived: opts.includeArchived } })).notes
|
|
618
|
+
: (await requestJson(c.remote, `/namespaces/${seg(c.ns)}/notes?limit=${encodeURIComponent(opts.limit ?? "50")}${opts.includeArchived ? "&includeArchived=true" : ""}`, { token: c.token })).notes;
|
|
609
619
|
if (opts.json)
|
|
610
620
|
return emitJson({ notes: rows }), 0;
|
|
611
621
|
if (rows.length === 0) {
|
|
@@ -642,7 +652,7 @@ export async function runNotesSearch(query, opts) {
|
|
|
642
652
|
if (!c)
|
|
643
653
|
return 1;
|
|
644
654
|
try {
|
|
645
|
-
const res = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/notes?q=${seg(query)}&limit=${encodeURIComponent(opts.limit ?? "50")}`, { token: c.token });
|
|
655
|
+
const res = await requestJson(c.remote, `/namespaces/${seg(c.ns)}/notes?q=${seg(query)}&limit=${encodeURIComponent(opts.limit ?? "50")}${opts.includeArchived ? "&includeArchived=true" : ""}`, { token: c.token });
|
|
646
656
|
if (opts.json)
|
|
647
657
|
return emitJson(res), 0;
|
|
648
658
|
if (res.notes.length === 0) {
|
package/dist/cli/resources.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export interface BindrRec {
|
|
|
21
21
|
name: string;
|
|
22
22
|
}
|
|
23
23
|
/** Fetch all episodes in a project (throws on error). */
|
|
24
|
-
export declare function fetchAllEpisodes(remote: string, namespace: string, project: string, token: string
|
|
24
|
+
export declare function fetchAllEpisodes(remote: string, namespace: string, project: string, token: string, options?: {
|
|
25
|
+
includeArchived?: boolean;
|
|
26
|
+
}): Promise<EpisodeRec[]>;
|
|
25
27
|
/** Fetch all bindrs in a project (throws on error). */
|
|
26
28
|
export declare function fetchAllBindrs(remote: string, namespace: string, project: string, token: string): Promise<BindrRec[]>;
|
|
27
29
|
/** Match episodes by glob against their name OR node path (leading "/" stripped). */
|
|
@@ -69,4 +71,6 @@ export declare function lookupNode(remote: string, token: string, q: {
|
|
|
69
71
|
* (paginated; ?kind= filters). NOTE: /nodes/:id/descendants exists but its
|
|
70
72
|
* response schema strips the node list on the deployed server — use this.
|
|
71
73
|
*/
|
|
72
|
-
export declare function fetchAllContents(remote: string, token: string, nodeId: string, kind?: string
|
|
74
|
+
export declare function fetchAllContents(remote: string, token: string, nodeId: string, kind?: string, options?: {
|
|
75
|
+
includeArchived?: boolean;
|
|
76
|
+
}): Promise<NodeRec[]>;
|
package/dist/cli/resources.js
CHANGED
|
@@ -63,8 +63,8 @@ async function fetchEveryPage(remote, path, token, key) {
|
|
|
63
63
|
return { items, total };
|
|
64
64
|
}
|
|
65
65
|
/** Fetch all episodes in a project (throws on error). */
|
|
66
|
-
export async function fetchAllEpisodes(remote, namespace, project, token) {
|
|
67
|
-
const r = await fetchAllPages(remote, `/namespaces/${namespace}/projects/${project}/episodes`, token, "episodes");
|
|
66
|
+
export async function fetchAllEpisodes(remote, namespace, project, token, options = {}) {
|
|
67
|
+
const r = await fetchAllPages(remote, `/namespaces/${namespace}/projects/${project}/episodes${options.includeArchived ? "?includeArchived=true" : ""}`, token, "episodes");
|
|
68
68
|
return r === "not-found" ? [] : r.items;
|
|
69
69
|
}
|
|
70
70
|
/** Fetch all bindrs in a project (throws on error). */
|
|
@@ -118,13 +118,13 @@ export async function lookupNode(remote, token, q) {
|
|
|
118
118
|
* (paginated; ?kind= filters). NOTE: /nodes/:id/descendants exists but its
|
|
119
119
|
* response schema strips the node list on the deployed server — use this.
|
|
120
120
|
*/
|
|
121
|
-
export async function fetchAllContents(remote, token, nodeId, kind) {
|
|
121
|
+
export async function fetchAllContents(remote, token, nodeId, kind, options = {}) {
|
|
122
122
|
const files = [];
|
|
123
123
|
let page = 1;
|
|
124
124
|
for (;;) {
|
|
125
125
|
const data = await requestJson(remote, `/nodes/${nodeId}/contents`, {
|
|
126
126
|
token,
|
|
127
|
-
query: { page, pageSize: 500, kind: kind ?? undefined },
|
|
127
|
+
query: { page, pageSize: 500, kind: kind ?? undefined, ...options },
|
|
128
128
|
});
|
|
129
129
|
const batch = data.files ?? [];
|
|
130
130
|
files.push(...batch);
|
package/dist/cli/update/index.js
CHANGED
|
@@ -76,7 +76,7 @@ export async function runUpdateBindr(name, opts) {
|
|
|
76
76
|
return 1;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const episodes = opts.add || opts.remove ? await fetchAllEpisodes(remote, s.namespace, s.project, token) : [];
|
|
79
|
+
const episodes = opts.add || opts.remove ? await fetchAllEpisodes(remote, s.namespace, s.project, token, { includeArchived: true }) : [];
|
|
80
80
|
try {
|
|
81
81
|
if (opts.add) {
|
|
82
82
|
const toAdd = matchEpisodes(episodes, opts.add);
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.97.0";
|