fleetfizz 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fleetfizz.mjs +80 -19
- package/package.json +1 -1
package/dist/fleetfizz.mjs
CHANGED
|
@@ -33032,7 +33032,7 @@ const runWith = (command, config) => {
|
|
|
33032
33032
|
};
|
|
33033
33033
|
//#endregion
|
|
33034
33034
|
//#region package.json
|
|
33035
|
-
var version = "0.9.
|
|
33035
|
+
var version = "0.9.1";
|
|
33036
33036
|
//#endregion
|
|
33037
33037
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Logger.js
|
|
33038
33038
|
const TypeId = "~effect/Logger";
|
|
@@ -65150,6 +65150,8 @@ const MachineEntry = Struct({
|
|
|
65150
65150
|
detail: optionalKey(String$6),
|
|
65151
65151
|
output: optionalKey(ArraySchema(String$6)),
|
|
65152
65152
|
items: ArraySchema(Item),
|
|
65153
|
+
connected: optionalKey(Boolean$4),
|
|
65154
|
+
checked: optionalKey(Number$2),
|
|
65153
65155
|
started: optionalKey(Number$2),
|
|
65154
65156
|
ended: optionalKey(Number$2)
|
|
65155
65157
|
});
|
|
@@ -65158,6 +65160,10 @@ const LedgerState = Struct({
|
|
|
65158
65160
|
dryRun: Boolean$4,
|
|
65159
65161
|
notes: ArraySchema(Note),
|
|
65160
65162
|
machines: ArraySchema(MachineEntry),
|
|
65163
|
+
resolving: optionalKey(Struct({
|
|
65164
|
+
started: Number$2,
|
|
65165
|
+
items: Number$2
|
|
65166
|
+
})),
|
|
65161
65167
|
started: Number$2,
|
|
65162
65168
|
ended: optionalKey(Number$2)
|
|
65163
65169
|
});
|
|
@@ -65271,9 +65277,14 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
65271
65277
|
});
|
|
65272
65278
|
yield* logInfo(`${kind}: ${text}`);
|
|
65273
65279
|
}),
|
|
65274
|
-
|
|
65280
|
+
connected: (name) => machine(name, (m) => ({
|
|
65281
|
+
...m,
|
|
65282
|
+
connected: true
|
|
65283
|
+
})).pipe(andThen(log(name, logInfo("connected")))),
|
|
65284
|
+
checked: (name) => machine(name, (m, now) => ({
|
|
65275
65285
|
...m,
|
|
65276
|
-
status: "waiting"
|
|
65286
|
+
status: "waiting",
|
|
65287
|
+
checked: now
|
|
65277
65288
|
})).pipe(andThen(log(name, logInfo("checked")))),
|
|
65278
65289
|
skip: (name, reason) => machine(name, (m) => ({
|
|
65279
65290
|
...m,
|
|
@@ -65287,6 +65298,14 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
65287
65298
|
...output.length === 0 ? {} : { output },
|
|
65288
65299
|
ended: now
|
|
65289
65300
|
})).pipe(andThen(log(name, logError(`failed: ${reason}`)))),
|
|
65301
|
+
resolving: (n) => update((state, now) => ({
|
|
65302
|
+
...state,
|
|
65303
|
+
resolving: {
|
|
65304
|
+
started: now,
|
|
65305
|
+
items: n
|
|
65306
|
+
}
|
|
65307
|
+
})).pipe(andThen(logInfo(`resolving ${n} items`))),
|
|
65308
|
+
resolved: update(({ resolving: _, ...state }) => state).pipe(andThen(logInfo("resolved"))),
|
|
65290
65309
|
plan: (name, p) => machine(name, (m) => ({
|
|
65291
65310
|
...m,
|
|
65292
65311
|
status: "planned",
|
|
@@ -65298,6 +65317,7 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
65298
65317
|
start: (name) => machine(name, (m, now) => ({
|
|
65299
65318
|
...m,
|
|
65300
65319
|
status: "running",
|
|
65320
|
+
connected: false,
|
|
65301
65321
|
started: now
|
|
65302
65322
|
})).pipe(andThen(log(name, logInfo("applying")))),
|
|
65303
65323
|
stepStarted: (name, id) => items(name, id, (item, now) => item.status === "failed" || item.status === "skipped" ? item : {
|
|
@@ -65348,7 +65368,7 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
65348
65368
|
ended: m.ended ?? now
|
|
65349
65369
|
})).pipe(andThen(log(name, logInfo(`finished: ${outcome}`)))),
|
|
65350
65370
|
end: gen(function* () {
|
|
65351
|
-
yield* update((state, now) => ({
|
|
65371
|
+
yield* update(({ resolving: _, ...state }, now) => ({
|
|
65352
65372
|
...state,
|
|
65353
65373
|
ended: now,
|
|
65354
65374
|
machines: state.machines.map((m) => m.status === "running" || m.status === "checking" ? {
|
|
@@ -67402,15 +67422,23 @@ const countsOf = (m) => {
|
|
|
67402
67422
|
skipped: m.items.filter((i) => i.status === "skipped").length
|
|
67403
67423
|
};
|
|
67404
67424
|
};
|
|
67405
|
-
const settled = (m, dryRun) => dryRun || m.status === "ok" || m.status === "failed";
|
|
67425
|
+
const settled = (m, dryRun) => dryRun && m.status === "planned" || m.status === "ok" || m.status === "failed";
|
|
67406
67426
|
const upToDate = (m, dryRun) => {
|
|
67407
67427
|
const c = countsOf(m);
|
|
67408
67428
|
return c.changes === 0 && c.skipped === 0 && settled(m, dryRun);
|
|
67409
67429
|
};
|
|
67410
|
-
const summaryOf = (m, dryRun) => {
|
|
67411
|
-
if (m.status === "checking"
|
|
67412
|
-
text: m.
|
|
67413
|
-
tone: "
|
|
67430
|
+
const summaryOf = (m, dryRun, glyph) => {
|
|
67431
|
+
if (m.status === "checking") return [{
|
|
67432
|
+
text: `${glyph} ${m.connected === true ? "checking" : "connecting"}`,
|
|
67433
|
+
tone: "run"
|
|
67434
|
+
}];
|
|
67435
|
+
if (m.status === "waiting") return [{
|
|
67436
|
+
text: "✓ checked",
|
|
67437
|
+
tone: "ok"
|
|
67438
|
+
}];
|
|
67439
|
+
if (m.status === "running" && m.connected !== true) return [{
|
|
67440
|
+
text: `${glyph} connecting`,
|
|
67441
|
+
tone: "run"
|
|
67414
67442
|
}];
|
|
67415
67443
|
if (m.status === "skipped") return [{
|
|
67416
67444
|
text: "– skipped",
|
|
@@ -67421,6 +67449,10 @@ const summaryOf = (m, dryRun) => {
|
|
|
67421
67449
|
tone: "fail"
|
|
67422
67450
|
}, { text: ` ${m.detail}` }];
|
|
67423
67451
|
const { changes, done, failed, skipped } = countsOf(m);
|
|
67452
|
+
if (changes === 0 && skipped === 0 && m.status === "running") return [{
|
|
67453
|
+
text: "applying",
|
|
67454
|
+
tone: "dim"
|
|
67455
|
+
}];
|
|
67424
67456
|
if (changes === 0 && skipped === 0) return [{
|
|
67425
67457
|
text: "up to date",
|
|
67426
67458
|
tone: settled(m, dryRun) ? "ok" : "dim"
|
|
@@ -67478,6 +67510,7 @@ const shipSummary = (state) => {
|
|
|
67478
67510
|
}] : parts;
|
|
67479
67511
|
};
|
|
67480
67512
|
const elapsed = (started, ended, now) => started === void 0 ? "" : duration((ended ?? now) - started);
|
|
67513
|
+
const machineTime = (m, shipStarted, now) => m.status === "checking" || m.status === "waiting" ? elapsed(shipStarted, m.checked, now) : elapsed(m.started, m.ended, now);
|
|
67481
67514
|
const Parts = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Line, { children: props.parts.map((part, n) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T, {
|
|
67482
67515
|
tone: part.tone,
|
|
67483
67516
|
children: part.text
|
|
@@ -67518,9 +67551,9 @@ const MachineLine = (props) => {
|
|
|
67518
67551
|
width: w.time,
|
|
67519
67552
|
right: true,
|
|
67520
67553
|
tone: "dim",
|
|
67521
|
-
children: upToDate(m, props.dryRun) ? "" :
|
|
67554
|
+
children: upToDate(m, props.dryRun) ? "" : machineTime(m, props.shipStarted, props.now)
|
|
67522
67555
|
}),
|
|
67523
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Parts, { parts: summaryOf(m, props.dryRun) })
|
|
67556
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Parts, { parts: summaryOf(m, props.dryRun, props.glyph) })
|
|
67524
67557
|
]
|
|
67525
67558
|
});
|
|
67526
67559
|
};
|
|
@@ -67565,8 +67598,18 @@ const LedgerView = (props) => {
|
|
|
67565
67598
|
const { live } = (0, import_react.useContext)(ModeContext);
|
|
67566
67599
|
const running = live && state.ended === void 0;
|
|
67567
67600
|
const glyph = runGlyph(live, now);
|
|
67568
|
-
const shownItems = (m) => m.items.filter((i) => full || i.changes || i.status === "failed" || i.status === "skipped");
|
|
67569
|
-
const
|
|
67601
|
+
const shownItems = (m) => m.items.filter((i) => full || i.changes || i.status === "failed" || i.status === "skipped" || i.status === "running");
|
|
67602
|
+
const resolve = state.resolving === void 0 || state.ended !== void 0 ? void 0 : {
|
|
67603
|
+
name: "versions and commits",
|
|
67604
|
+
kind: "range",
|
|
67605
|
+
from: `${state.resolving.items} items`,
|
|
67606
|
+
changes: false,
|
|
67607
|
+
status: "running",
|
|
67608
|
+
doing: "resolving",
|
|
67609
|
+
steps: [],
|
|
67610
|
+
started: state.resolving.started
|
|
67611
|
+
};
|
|
67612
|
+
const visible = [...state.machines.flatMap(shownItems), ...resolve === void 0 ? [] : [resolve]];
|
|
67570
67613
|
const width = (texts) => Math.max(0, ...texts.map((t) => t.length));
|
|
67571
67614
|
const item = width(visible.map((i) => i.name));
|
|
67572
67615
|
const status = width(visible.map((i) => statusOf(i, dryRun, glyph).text));
|
|
@@ -67574,7 +67617,7 @@ const LedgerView = (props) => {
|
|
|
67574
67617
|
status,
|
|
67575
67618
|
item,
|
|
67576
67619
|
value: Math.max(width(visible.map(value)), width(state.machines.map((m) => m.name)) - (status + GAP + INDENT + item + GAP)),
|
|
67577
|
-
time: width([...visible.map((i) => elapsed(i.started, i.ended, now)), ...state.machines.map((m) =>
|
|
67620
|
+
time: width([...visible.map((i) => elapsed(i.started, i.ended, now)), ...state.machines.map((m) => machineTime(m, state.started, now))])
|
|
67578
67621
|
};
|
|
67579
67622
|
const blocks = state.machines.map((m) => ({
|
|
67580
67623
|
m,
|
|
@@ -67582,7 +67625,9 @@ const LedgerView = (props) => {
|
|
|
67582
67625
|
m,
|
|
67583
67626
|
w,
|
|
67584
67627
|
dryRun,
|
|
67585
|
-
|
|
67628
|
+
shipStarted: state.started,
|
|
67629
|
+
now,
|
|
67630
|
+
glyph
|
|
67586
67631
|
}, m.name),
|
|
67587
67632
|
body: [...m.output === void 0 ? [] : outputLines(m.name, m.output, nameAt(w), running), ...shownItems(m).flatMap((i) => [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemLine, {
|
|
67588
67633
|
i,
|
|
@@ -67593,7 +67638,7 @@ const LedgerView = (props) => {
|
|
|
67593
67638
|
}, `${m.name}/${i.kind}:${i.name}`), ...i.output === void 0 ? [] : outputLines(`${m.name}/${i.kind}:${i.name}`, i.output, nameAt(w), running)])]
|
|
67594
67639
|
}));
|
|
67595
67640
|
const legend = state.ended === void 0 ? `f ${full ? "changes only" : "full list"} · ctrl-c stop` : void 0;
|
|
67596
|
-
const room = height === void 0 ? Infinity : height - (legend === void 0 ? 1 : 3);
|
|
67641
|
+
const room = height === void 0 ? Infinity : height - (legend === void 0 ? 1 : 3) - (resolve === void 0 ? 0 : 2);
|
|
67597
67642
|
const count = (bs) => bs.reduce((n, b) => n + 1 + b.body.length, Math.max(0, bs.length - 1));
|
|
67598
67643
|
const fits = count(blocks) <= room;
|
|
67599
67644
|
let spare = room - count(blocks.map((b) => ({
|
|
@@ -67642,6 +67687,16 @@ const LedgerView = (props) => {
|
|
|
67642
67687
|
tone: "dim",
|
|
67643
67688
|
children: "…"
|
|
67644
67689
|
}),
|
|
67690
|
+
resolve !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
67691
|
+
marginTop: 1,
|
|
67692
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemLine, {
|
|
67693
|
+
i: resolve,
|
|
67694
|
+
w,
|
|
67695
|
+
dryRun,
|
|
67696
|
+
now,
|
|
67697
|
+
glyph
|
|
67698
|
+
})
|
|
67699
|
+
}),
|
|
67645
67700
|
state.ended !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
67646
67701
|
marginTop: 1,
|
|
67647
67702
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Parts, { parts: [...shipSummary(state), ...dryRun ? [] : [{
|
|
@@ -68001,11 +68056,12 @@ const decideRepo = (repo, root, observed, resolved, ctx) => {
|
|
|
68001
68056
|
};
|
|
68002
68057
|
const fetchStep = ({ item, root, commit }) => {
|
|
68003
68058
|
const url = originUrl(item.origin);
|
|
68059
|
+
const fetch = (what) => `if [ "$(git -C "$ff_d" rev-parse HEAD)" != ${quote(commit)} ]; then ff_git -C "$ff_d" fetch --quiet origin ${quote(what)}; fi`;
|
|
68004
68060
|
const sync = isPin(item.ref) ? [
|
|
68005
|
-
|
|
68061
|
+
fetch(commit),
|
|
68006
68062
|
`git -C "$ff_d" checkout --quiet --detach ${quote(commit)}`,
|
|
68007
68063
|
`git -C "$ff_d" reset --quiet --hard ${quote(commit)}`
|
|
68008
|
-
] : [
|
|
68064
|
+
] : [fetch(item.ref), `git -C "$ff_d" reset --quiet --hard ${quote(commit)}`];
|
|
68009
68065
|
return {
|
|
68010
68066
|
id: `repos:${item.name}:fetch`,
|
|
68011
68067
|
items: [item.name],
|
|
@@ -68556,12 +68612,15 @@ const canRedraw = () => Boolean(process.stdout.isTTY) && process.env.TERM !== "d
|
|
|
68556
68612
|
const decodeAt = decodeUnknownOption(AtFact);
|
|
68557
68613
|
const runOn = fn("runOn")(function* (target, script, secrets, onLine, ledger) {
|
|
68558
68614
|
let first;
|
|
68615
|
+
let connected = false;
|
|
68559
68616
|
yield* logDebug(`script:\n${script}`);
|
|
68560
68617
|
const started = yield* currentTimeMillis;
|
|
68561
68618
|
const run = yield* runScript(target, script, secrets, (line) => {
|
|
68562
68619
|
const parsed = parseLine(line);
|
|
68563
68620
|
if (parsed.kind === "text" && first === void 0 && line.trim() !== "") first = line.trim();
|
|
68564
|
-
|
|
68621
|
+
const connect = connected ? void_ : ledger.connected(target.name);
|
|
68622
|
+
connected = true;
|
|
68623
|
+
return logDebug(`> ${line}`).pipe(andThen(connect), andThen(onLine(parsed)));
|
|
68565
68624
|
}).pipe(map$5((exitCode) => ({
|
|
68566
68625
|
kind: "ran",
|
|
68567
68626
|
exitCode
|
|
@@ -68911,11 +68970,13 @@ const shipPass = fn("shipPass")(function* (flags, tailnet, hidden) {
|
|
|
68911
68970
|
provider,
|
|
68912
68971
|
items: checked.flatMap(({ machine }) => targetedItems(provider, config, machine))
|
|
68913
68972
|
}));
|
|
68973
|
+
yield* ledger.resolving(new Set(targeted.flatMap(({ provider, items }) => items.map((i) => `${provider.name}:${i.name}`))).size);
|
|
68914
68974
|
const lent = targeted.some(({ provider, items }) => provider.name === "repos" && items.length > 0) ? yield* readLentToken() : { token: void 0 };
|
|
68915
68975
|
if (lent.token !== void 0) hidden.add(lent.token);
|
|
68916
68976
|
yield* logInfo(lent.token !== void 0 ? "gh token: lent" : `gh token: none (${lent.reason ?? "no repos"})`);
|
|
68917
68977
|
if (lent.token === void 0 && lent.reason !== void 0) yield* ledger.note("info", `no gh token (${lent.reason}); private repos will fail`);
|
|
68918
68978
|
const resolved = Object.fromEntries(yield* forEach$1(targeted, ({ provider, items }) => provider.resolve(items, lent.token === void 0 ? {} : { token: lent.token }).pipe(map$5((r) => [provider.name, r])), { concurrency: "unbounded" }));
|
|
68979
|
+
yield* ledger.resolved;
|
|
68919
68980
|
const planAll = (cfg, answer) => checked.map((g) => ({
|
|
68920
68981
|
...g,
|
|
68921
68982
|
plan: planMachine({
|