decklight 0.9.0 → 0.10.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/PLATFORM.md +44 -3
- package/README.md +7 -5
- package/SPEC.md +100 -31
- package/cli/agent-review.mjs +5 -4
- package/cli/agents.mjs +11 -5
- package/cli/bundle-audio.mjs +10 -3
- package/cli/bundle-module.mjs +95 -0
- package/cli/bundle.mjs +58 -6
- package/cli/cast.mjs +41 -5
- package/cli/check-fixes.mjs +186 -0
- package/cli/check.mjs +32 -5
- package/cli/commit-flow.mjs +7 -3
- package/cli/commit-message.mjs +1 -1
- package/cli/commit-split.mjs +2 -2
- package/cli/deck-refs.mjs +8 -3
- package/cli/design-system-refs.mjs +263 -6
- package/cli/design-system.mjs +82 -14
- package/cli/edit-git.mjs +2 -2
- package/cli/edit-handover.mjs +129 -23
- package/cli/edit-look.mjs +248 -5
- package/cli/edit.mjs +504 -58
- package/cli/enhance.mjs +12 -10
- package/cli/git.mjs +13 -0
- package/cli/init.mjs +8 -3
- package/cli/marketplace-autocheck.mjs +200 -0
- package/cli/marketplace.mjs +250 -13
- package/cli/narrate.mjs +78 -3
- package/cli/open.mjs +24 -6
- package/cli/pdf.mjs +27 -8
- package/cli/pptx-export.mjs +7 -4
- package/cli/record.mjs +73 -13
- package/cli/remote.mjs +32 -6
- package/cli/serve.mjs +2 -2
- package/cli/skill-content.mjs +40 -3
- package/cli/skills.mjs +247 -3
- package/cli/theme-refs.mjs +14 -2
- package/cli/units.mjs +75 -7
- package/dist/build-info.json +1 -1
- package/dist/decklight.css +429 -32
- package/dist/decklight.js +169 -123
- package/dist/decklight.js.map +4 -4
- package/package.json +1 -1
- package/tools/design-system-format.mjs +25 -0
- package/tools/design-system-migrations.mjs +207 -0
- package/tools/exec.mjs +10 -2
- package/tools/narration-manifest.mjs +77 -3
- package/tools/site-clip.mjs +114 -0
- package/tools/video.mjs +69 -6
package/cli/enhance.mjs
CHANGED
|
@@ -286,15 +286,15 @@ export const KINDS = {
|
|
|
286
286
|
};
|
|
287
287
|
const kindOf = (kind) => KINDS[kind] ?? KINDS.tags;
|
|
288
288
|
|
|
289
|
-
/** Run a read-only agent ask; resolves to its stdout, or null. */
|
|
290
|
-
export function ask(cmd, cwd, timeoutMs) {
|
|
289
|
+
/** Run a read-only agent ask; resolves to its stdout, or null — null too when `signal` stops it. */
|
|
290
|
+
export function ask(cmd, cwd, timeoutMs, signal = null) {
|
|
291
291
|
return new Promise((done) => {
|
|
292
292
|
let settled = false;
|
|
293
293
|
const finish = (v) => { if (!settled) { settled = true; done(v); } };
|
|
294
294
|
let child;
|
|
295
295
|
try {
|
|
296
|
-
child = execFile(cmd.bin, cmd.args, { cwd, timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'] },
|
|
297
|
-
(err, stdout) => finish(err && !stdout ? null : String(stdout ?? '')));
|
|
296
|
+
child = execFile(cmd.bin, cmd.args, { cwd, timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'], ...(signal ? { signal } : {}) },
|
|
297
|
+
(err, stdout) => finish(err && (!stdout || err.name === 'AbortError') ? null : String(stdout ?? '')));
|
|
298
298
|
} catch { return finish(null); }
|
|
299
299
|
child.on('error', () => finish(null));
|
|
300
300
|
});
|
|
@@ -329,12 +329,13 @@ export function enhanceable(html, only = null) {
|
|
|
329
329
|
*/
|
|
330
330
|
export async function enhanceText(script, {
|
|
331
331
|
kind = 'tags', agent = null, cwd = process.cwd(), env = process.env, timeoutMs = ENHANCE_TIMEOUT_MS,
|
|
332
|
-
resolveAgent = agentAsk, exec = ask,
|
|
332
|
+
resolveAgent = agentAsk, exec = ask, signal = null,
|
|
333
333
|
} = {}) {
|
|
334
334
|
const k = kindOf(kind);
|
|
335
335
|
const cmd = resolveAgent(agent, k.prompt(script), { env });
|
|
336
336
|
if (!cmd) return { ok: false, why: agentUnavailable(agent, detectAgents({ env })) };
|
|
337
|
-
const out = await exec(cmd, cwd, timeoutMs);
|
|
337
|
+
const out = await exec(cmd, cwd, timeoutMs, signal);
|
|
338
|
+
if (signal?.aborted) return { ok: false, why: 'stopped' };
|
|
338
339
|
if (out == null) return { ok: false, why: 'the agent did not answer in time' };
|
|
339
340
|
const text = unwrapAnswer(out);
|
|
340
341
|
const why = k.problem(script, text);
|
|
@@ -366,20 +367,21 @@ export function applyEnhanced(html, answers) {
|
|
|
366
367
|
* the deck with every passing slide rewritten (`applyEnhanced`), one
|
|
367
368
|
* `{ slide, ok, changed, why }` per slide asked about, and the raw answers for
|
|
368
369
|
* a caller that applies them to a newer copy of the deck. Never throws for one
|
|
369
|
-
* slide's failure — only when there is no agent to ask at all.
|
|
370
|
+
* slide's failure — only when there is no agent to ask at all. `signal` stops
|
|
371
|
+
* it: the asks in flight are killed and no slide after them is asked about.
|
|
370
372
|
*/
|
|
371
373
|
export async function enhanceDeck(html, slides = null, {
|
|
372
374
|
kind = 'tags', agent = null, cwd = process.cwd(), env = process.env, timeoutMs = ENHANCE_TIMEOUT_MS,
|
|
373
|
-
concurrency = ENHANCE_CONCURRENCY, resolveAgent = agentAsk, exec = ask, onSlide = () => {},
|
|
375
|
+
concurrency = ENHANCE_CONCURRENCY, resolveAgent = agentAsk, exec = ask, onSlide = () => {}, signal = null,
|
|
374
376
|
} = {}) {
|
|
375
377
|
if (!resolveAgent(agent, 'x', { env })) throw new Error(agentUnavailable(agent, detectAgents({ env })));
|
|
376
378
|
const todo = enhanceable(html, slides);
|
|
377
379
|
const answers = [];
|
|
378
380
|
let next = 0, finished = 0;
|
|
379
381
|
const worker = async () => {
|
|
380
|
-
while (next < todo.length) {
|
|
382
|
+
while (next < todo.length && !signal?.aborted) {
|
|
381
383
|
const { slide, script } = todo[next++];
|
|
382
|
-
const a = await enhanceText(script, { kind, agent, cwd, env, timeoutMs, resolveAgent, exec });
|
|
384
|
+
const a = await enhanceText(script, { kind, agent, cwd, env, timeoutMs, resolveAgent, exec, signal });
|
|
383
385
|
const r = { slide, ok: a.ok, changed: a.ok && a.text !== script, ...(a.ok ? {} : { why: a.why }) };
|
|
384
386
|
answers.push({ ...r, before: script, text: a.text ?? null });
|
|
385
387
|
onSlide({ ...r, done: ++finished, of: todo.length });
|
package/cli/git.mjs
CHANGED
|
@@ -161,6 +161,19 @@ export function commitSubject(raw, fallback) {
|
|
|
161
161
|
return /^-/.test(capped) ? `agent: ${capped}` : capped;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
/**
|
|
165
|
+
* The untracked files under `dir` git does not ignore, relative to it, a
|
|
166
|
+
* wholly new directory said once as `name/` — what an agent run may leave
|
|
167
|
+
* beside the deck. Null when git cannot answer.
|
|
168
|
+
*/
|
|
169
|
+
export function untrackedFiles(dir) {
|
|
170
|
+
try {
|
|
171
|
+
const out = execFileSync('git', ['ls-files', '--others', '--exclude-standard', '--directory', '-z', '--', '.'],
|
|
172
|
+
{ cwd: dir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
173
|
+
return out.split('\0').filter(Boolean).sort();
|
|
174
|
+
} catch { return null; }
|
|
175
|
+
}
|
|
176
|
+
|
|
164
177
|
/**
|
|
165
178
|
* The sha of the commit `gitAutocommit` last made, or null.
|
|
166
179
|
*
|
package/cli/init.mjs
CHANGED
|
@@ -42,7 +42,8 @@ import {
|
|
|
42
42
|
} from './skill-content.mjs';
|
|
43
43
|
import { THEMES_DIR, themeCss, runtimeCss, runtimeJs } from './pkg.mjs';
|
|
44
44
|
import { configBlock, configBlockHtml, configVersion, hasRuntime } from './runtime-link.mjs';
|
|
45
|
-
import { TARGETS, detectedTargets, installGlobalSkill, display } from './skills.mjs';
|
|
45
|
+
import { TARGETS, detectedTargets, installGlobalSkill, display, syncLibrarySkills } from './skills.mjs';
|
|
46
|
+
import { librarySkills } from './units.mjs';
|
|
46
47
|
import { onPath } from './agents.mjs';
|
|
47
48
|
import { escapeHtml } from './edit.mjs';
|
|
48
49
|
import {
|
|
@@ -401,7 +402,7 @@ export async function wireDesignSystem(build, qualified, { home = configHome(),
|
|
|
401
402
|
const slide = titleSlideTemplate(verdict.manifest.name, verdict.summary?.templates ?? [], titleHtml);
|
|
402
403
|
let html = build(slide);
|
|
403
404
|
const deckRef = refForDeck(html, r.name, r.local, r.source ?? null);
|
|
404
|
-
html = setDesignSystem(html, deckRef, true, { source: r.source ?? null }).html;
|
|
405
|
+
html = setDesignSystem(html, deckRef, true, { source: r.source ?? null, version: verdict.manifest.version }).html;
|
|
405
406
|
const plan = deps.planRecommended(html, { manifest: verdict.manifest, local: r.local }, home);
|
|
406
407
|
html = deps.writePlan(html, plan);
|
|
407
408
|
const look = deps.lookOf(html, plan);
|
|
@@ -820,9 +821,13 @@ unless --no-skill is given. The deck file is only touched with --force.
|
|
|
820
821
|
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), claudeSkillMd());
|
|
821
822
|
fs.writeFileSync(path.join(skillDir, 'reference.md'), referenceDoc());
|
|
822
823
|
note(`wrote .claude/skills/decklight/{SKILL.md,reference.md} (v${PKG.version})`);
|
|
824
|
+
// the marketplace skills in your library go beside it (#880)
|
|
825
|
+
const handedOn = [];
|
|
826
|
+
syncLibrarySkills(path.join(root, '.claude', 'skills'), handedOn);
|
|
827
|
+
for (const line of handedOn.filter(Boolean)) note(line);
|
|
823
828
|
|
|
824
829
|
const agentsPath = path.join(root, 'AGENTS.md');
|
|
825
|
-
const section = agentsSection();
|
|
830
|
+
const section = agentsSection(undefined, { librarySkills: librarySkills() });
|
|
826
831
|
if (!fs.existsSync(agentsPath)) {
|
|
827
832
|
fs.writeFileSync(agentsPath, `# Agent notes\n\n${section}`);
|
|
828
833
|
note('created AGENTS.md');
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Copyright 2026 Gilles Philippart
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* "Check for updates when decklight starts" (SPEC MARKETPLACES_SCREEN): the
|
|
6
|
+
* one way a marketplace check runs without somebody pressing C.
|
|
7
|
+
*
|
|
8
|
+
* Opening a screen is not consent to reach the network, so the check never
|
|
9
|
+
* ran by itself. This is the consent: a per-machine switch, off until the
|
|
10
|
+
* author turns it on (O on the screen, `decklight marketplace auto-check on`),
|
|
11
|
+
* kept in the registry beside the marketplaces it is about. While it is on,
|
|
12
|
+
* an edit server that starts runs the same `decklight marketplace outdated
|
|
13
|
+
* --json` that C runs (`git ls-remote`, nothing fetched, nothing written but
|
|
14
|
+
* the answer), at most once in a window, never on the critical path: the
|
|
15
|
+
* server starts and serves without waiting, the shape of cli/update-check.mjs.
|
|
16
|
+
*
|
|
17
|
+
* The answer is RECORDED (`~/.decklight/marketplace-check.json`): when it was
|
|
18
|
+
* asked, each marketplace's state, and which offers the author dismissed, by
|
|
19
|
+
* the commit they were offered. The screen's list starts from it, and the
|
|
20
|
+
* deck offers what it found once, in a toast that names what the open deck
|
|
21
|
+
* uses from a marketplace that moved. It only ever offers: an update is still
|
|
22
|
+
* the author's, because it re-clones with their credentials and changes what
|
|
23
|
+
* every deck on the machine is served.
|
|
24
|
+
*
|
|
25
|
+
* Every function takes the config home, so a test points it at a temp one.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { readFileSync, mkdirSync } from 'node:fs';
|
|
29
|
+
import { join } from 'node:path';
|
|
30
|
+
import { writeFileAtomic } from '../tools/atomic-write.mjs';
|
|
31
|
+
import { configHome, loadRegistry, saveRegistry } from './marketplace.mjs';
|
|
32
|
+
|
|
33
|
+
/** How long a recorded answer stands before a starting server asks again: a session's restarts ask once. */
|
|
34
|
+
export const AUTO_CHECK_WINDOW_MS = 12 * 60 * 60 * 1000;
|
|
35
|
+
|
|
36
|
+
export const checkRecordPath = (home = configHome()) => join(home, 'marketplace-check.json');
|
|
37
|
+
|
|
38
|
+
/** Is the switch on? An unreadable registry is a no: nothing runs that was not asked for. */
|
|
39
|
+
export function autoCheckOn(home = configHome()) {
|
|
40
|
+
try { return loadRegistry(home).autoCheck === true; } catch { return false; }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Has the screen already asked, once, whether to turn it on? */
|
|
44
|
+
export function autoCheckOffered(home = configHome()) {
|
|
45
|
+
try { return loadRegistry(home).autoCheckOffered === true; } catch { return true; }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Turn it on or off — and turning it either way means the question was answered. */
|
|
49
|
+
export function setAutoCheck(on, home = configHome()) {
|
|
50
|
+
const reg = loadRegistry(home);
|
|
51
|
+
reg.autoCheck = !!on;
|
|
52
|
+
reg.autoCheckOffered = true;
|
|
53
|
+
saveRegistry(reg, home);
|
|
54
|
+
return reg.autoCheck;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The screen asked once; it does not ask again. */
|
|
58
|
+
export function markAutoCheckOffered(home = configHome()) {
|
|
59
|
+
const reg = loadRegistry(home);
|
|
60
|
+
if (reg.autoCheckOffered === true) return false;
|
|
61
|
+
reg.autoCheckOffered = true;
|
|
62
|
+
saveRegistry(reg, home);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The recorded answer — `{ checkedAt, marketplaces, dismissed }` — or null when there is none. */
|
|
67
|
+
export function readCheckRecord(home = configHome()) {
|
|
68
|
+
try {
|
|
69
|
+
const r = JSON.parse(readFileSync(checkRecordPath(home), 'utf8'));
|
|
70
|
+
if (!Number.isFinite(r?.checkedAt) || !Array.isArray(r?.marketplaces)) return null;
|
|
71
|
+
return { checkedAt: r.checkedAt, marketplaces: r.marketplaces, dismissed: r.dismissed && typeof r.dismissed === 'object' ? r.dismissed : {} };
|
|
72
|
+
} catch { return null; }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function writeRecord(rec, home) {
|
|
76
|
+
mkdirSync(home, { recursive: true });
|
|
77
|
+
writeFileAtomic(checkRecordPath(home), `${JSON.stringify(rec, null, 2)}\n`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Record what `outdated` answered. `all` is a check of every marketplace,
|
|
82
|
+
* which is what the window measures; one marketplace's answer is folded into
|
|
83
|
+
* the record without moving it. Dismissals are kept, and one for a
|
|
84
|
+
* marketplace no longer registered goes with it.
|
|
85
|
+
*/
|
|
86
|
+
export function recordCheck(results, home = configHome(), { all = true, now = Date.now() } = {}) {
|
|
87
|
+
const prev = readCheckRecord(home);
|
|
88
|
+
const rows = new Map((all ? [] : prev?.marketplaces ?? []).map((r) => [r.name, r]));
|
|
89
|
+
for (const r of results) rows.set(r.name, r);
|
|
90
|
+
const marketplaces = [...rows.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
91
|
+
const names = new Set(marketplaces.map((r) => r.name));
|
|
92
|
+
const dismissed = Object.fromEntries(Object.entries(prev?.dismissed ?? {}).filter(([n]) => names.has(n)));
|
|
93
|
+
const rec = { checkedAt: all || !prev ? now : prev.checkedAt, marketplaces, dismissed };
|
|
94
|
+
writeRecord(rec, home);
|
|
95
|
+
return rec;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** An update took a marketplace to `commit`: the record says so, and nothing is offered for it any more. */
|
|
99
|
+
export function noteUpdated(name, commit = null, home = configHome()) {
|
|
100
|
+
const rec = readCheckRecord(home);
|
|
101
|
+
const row = rec?.marketplaces.find((r) => r.name === name);
|
|
102
|
+
if (!row) return false;
|
|
103
|
+
Object.assign(row, { state: 'current', commit: commit ?? row.commit ?? null, remote: commit ?? row.remote ?? null, error: null });
|
|
104
|
+
writeRecord(rec, home);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The commit an offer is for — what Dismiss remembers. A local directory has none, so it is "changed on disk". */
|
|
109
|
+
const offerKey = (r) => r.remote ?? 'changed-on-disk';
|
|
110
|
+
|
|
111
|
+
/** Dismiss the offer for `name` at what it was offered at: the same commit is not offered again. */
|
|
112
|
+
export function dismissOffer(name, remote = null, home = configHome()) {
|
|
113
|
+
const rec = readCheckRecord(home);
|
|
114
|
+
if (!rec) return false;
|
|
115
|
+
const row = rec.marketplaces.find((r) => r.name === name);
|
|
116
|
+
rec.dismissed[name] = remote ?? (row ? offerKey(row) : 'changed-on-disk');
|
|
117
|
+
writeRecord(rec, home);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Should a starting server ask? Only with the switch on, and once in the window. */
|
|
122
|
+
export function autoCheckDue(home = configHome(), now = Date.now()) {
|
|
123
|
+
if (!autoCheckOn(home)) return false;
|
|
124
|
+
const rec = readCheckRecord(home);
|
|
125
|
+
return !rec || now - rec.checkedAt >= AUTO_CHECK_WINDOW_MS;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** "checked 3 min ago: 1 of 3 out of date" — the screen's summary line, and the server's startup one. */
|
|
129
|
+
export function checkSummary(rec, now = Date.now()) {
|
|
130
|
+
if (!rec) return null;
|
|
131
|
+
const s = Math.max(0, (now - rec.checkedAt) / 1000);
|
|
132
|
+
const ago = s < 60 ? 'just now' : s < 3600 ? `${Math.round(s / 60)} min ago` : s < 86400 ? `${Math.round(s / 3600)} h ago` : `${Math.round(s / 86400)} days ago`;
|
|
133
|
+
const behind = rec.marketplaces.filter((r) => r.state === 'behind' || r.state === 'unfetched').length;
|
|
134
|
+
return `checked ${ago}: ${behind ? `${behind} of ${rec.marketplaces.length} out of date` : 'all up to date'}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* What the deck offers from the record: every marketplace found BEHIND (one
|
|
139
|
+
* never fetched is not an update to something you have) whose offer was not
|
|
140
|
+
* dismissed at this commit, with what the open deck uses from it. A check
|
|
141
|
+
* asks where a ref points and reads no catalog, so it cannot say which
|
|
142
|
+
* versions the update brings; what it can say is which of this deck's design
|
|
143
|
+
* systems, themes and fonts come from there. Nothing while the switch is off.
|
|
144
|
+
*/
|
|
145
|
+
export async function autoCheckOffers(html = null, home = configHome()) {
|
|
146
|
+
if (!autoCheckOn(home)) return [];
|
|
147
|
+
const rec = readCheckRecord(home);
|
|
148
|
+
if (!rec) return [];
|
|
149
|
+
const uses = html ? await deckUses(html) : new Map();
|
|
150
|
+
return rec.marketplaces
|
|
151
|
+
.filter((r) => r.state === 'behind' && rec.dismissed[r.name] !== offerKey(r))
|
|
152
|
+
.map((r) => {
|
|
153
|
+
const used = uses.get(r.name) ?? [];
|
|
154
|
+
return { name: r.name, commit: r.commit ?? null, remote: offerKey(r), local: !!r.local, uses: used, text: offerText(r, used) };
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** "decklight-confluent has an update: this deck uses confluent-developer (design system) from it". */
|
|
159
|
+
export function offerText(r, uses = []) {
|
|
160
|
+
const what = r.local ? 'has changed on disk' : 'has an update';
|
|
161
|
+
if (!uses.length) return `${r.name} ${what}`;
|
|
162
|
+
return `${r.name} ${what}: this deck uses ${uses.map((u) => `${u.name} (${u.kind})`).join(', ')} from it`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Marketplace name → `[{ name, kind }]`, what the deck references from each. */
|
|
166
|
+
async function deckUses(html) {
|
|
167
|
+
const [{ designSystemRefs }, { markedRefs }, { fontRefs }] = await Promise.all([
|
|
168
|
+
import('./design-system-refs.mjs'), import('./theme-refs.mjs'), import('./font-refs.mjs'),
|
|
169
|
+
]);
|
|
170
|
+
const out = new Map();
|
|
171
|
+
const add = (refs, kind) => {
|
|
172
|
+
for (const r of refs) {
|
|
173
|
+
if (!out.has(r.marketplace)) out.set(r.marketplace, []);
|
|
174
|
+
out.get(r.marketplace).push({ name: r.name, kind });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
add(designSystemRefs(html), 'design system');
|
|
179
|
+
add(markedRefs(html), 'theme');
|
|
180
|
+
add(fontRefs(html), 'font');
|
|
181
|
+
} catch { /* a block that does not parse uses nothing */ }
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The starting server's check: when it is due, `run(['outdated', '--json'])`
|
|
187
|
+
* (the command C runs, as a child) and record the answer. Resolves to the
|
|
188
|
+
* record, or null when nothing ran or it failed — silently, either way: an
|
|
189
|
+
* unreachable source is a row on the screen, never a word at startup.
|
|
190
|
+
*/
|
|
191
|
+
export async function runAutoCheck({ run, home = configHome(), now = Date.now() } = {}) {
|
|
192
|
+
if (!autoCheckDue(home, now)) return null;
|
|
193
|
+
try {
|
|
194
|
+
const out = await run(['outdated', '--json']);
|
|
195
|
+
if (!out?.ok) return null;
|
|
196
|
+
const parsed = JSON.parse(out.stdout);
|
|
197
|
+
// the command recorded it too; recording it again keeps the dismissals either way
|
|
198
|
+
return recordCheck(parsed.marketplaces ?? [], home, { now });
|
|
199
|
+
} catch { return null; }
|
|
200
|
+
}
|