@inventarch/cli 3.5.0 → 3.6.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/NOTICE +2 -0
- package/README.md +2 -1
- package/SPEC.md +13 -4
- package/THIRD_PARTY_NOTICES.txt +49 -0
- package/assets/host/44dc1fa77e0235df35e1dd05d5a5ce8c2b19d4545caf0b8579f2f4e1b9efbbc6.tgz +0 -0
- package/assets/host.json +4 -4
- package/dist/args.d.ts +9 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js.map +1 -1
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +53 -0
- package/dist/bin.js.map +1 -0
- package/dist/claude-cli.d.ts +13 -1
- package/dist/claude-cli.d.ts.map +1 -1
- package/dist/claude-cli.js +31 -1
- package/dist/claude-cli.js.map +1 -1
- package/dist/commands.d.ts +17 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +66 -3
- package/dist/commands.js.map +1 -1
- package/dist/committed-host.d.ts.map +1 -1
- package/dist/committed-host.js +14 -2
- package/dist/committed-host.js.map +1 -1
- package/dist/console/app.d.ts +47 -0
- package/dist/console/app.d.ts.map +1 -0
- package/dist/console/app.js +921 -0
- package/dist/console/app.js.map +1 -0
- package/dist/console/batch-next.d.ts +54 -0
- package/dist/console/batch-next.d.ts.map +1 -0
- package/dist/console/batch-next.js +260 -0
- package/dist/console/batch-next.js.map +1 -0
- package/dist/console/batch-plan.d.ts +109 -0
- package/dist/console/batch-plan.d.ts.map +1 -0
- package/dist/console/batch-plan.js +308 -0
- package/dist/console/batch-plan.js.map +1 -0
- package/dist/console/batch-run.d.ts +195 -0
- package/dist/console/batch-run.d.ts.map +1 -0
- package/dist/console/batch-run.js +868 -0
- package/dist/console/batch-run.js.map +1 -0
- package/dist/console/batch-screen.d.ts +36 -0
- package/dist/console/batch-screen.d.ts.map +1 -0
- package/dist/console/batch-screen.js +113 -0
- package/dist/console/batch-screen.js.map +1 -0
- package/dist/console/grid.d.ts +30 -0
- package/dist/console/grid.d.ts.map +1 -0
- package/dist/console/grid.js +87 -0
- package/dist/console/grid.js.map +1 -0
- package/dist/console/keys.d.ts +54 -0
- package/dist/console/keys.d.ts.map +1 -0
- package/dist/console/keys.js +204 -0
- package/dist/console/keys.js.map +1 -0
- package/dist/console/layout-all.d.ts +70 -0
- package/dist/console/layout-all.d.ts.map +1 -0
- package/dist/console/layout-all.js +401 -0
- package/dist/console/layout-all.js.map +1 -0
- package/dist/console/layout-repo.d.ts +65 -0
- package/dist/console/layout-repo.d.ts.map +1 -0
- package/dist/console/layout-repo.js +275 -0
- package/dist/console/layout-repo.js.map +1 -0
- package/dist/console/load.d.ts +33 -0
- package/dist/console/load.d.ts.map +1 -0
- package/dist/console/load.js +166 -0
- package/dist/console/load.js.map +1 -0
- package/dist/console/offers.d.ts +39 -0
- package/dist/console/offers.d.ts.map +1 -0
- package/dist/console/offers.js +285 -0
- package/dist/console/offers.js.map +1 -0
- package/dist/console/run.d.ts +56 -0
- package/dist/console/run.d.ts.map +1 -0
- package/dist/console/run.js +210 -0
- package/dist/console/run.js.map +1 -0
- package/dist/console/state.d.ts +127 -0
- package/dist/console/state.d.ts.map +1 -0
- package/dist/console/state.js +273 -0
- package/dist/console/state.js.map +1 -0
- package/dist/console/terminal.d.ts +60 -0
- package/dist/console/terminal.d.ts.map +1 -0
- package/dist/console/terminal.js +114 -0
- package/dist/console/terminal.js.map +1 -0
- package/dist/console/width-table.d.ts +10 -0
- package/dist/console/width-table.d.ts.map +1 -0
- package/dist/console/width-table.js +753 -0
- package/dist/console/width-table.js.map +1 -0
- package/dist/console/width.d.ts +18 -0
- package/dist/console/width.d.ts.map +1 -0
- package/dist/console/width.js +114 -0
- package/dist/console/width.js.map +1 -0
- package/dist/console/workspaces-state.d.ts +93 -0
- package/dist/console/workspaces-state.d.ts.map +1 -0
- package/dist/console/workspaces-state.js +192 -0
- package/dist/console/workspaces-state.js.map +1 -0
- package/dist/consumer.d.ts +13 -8
- package/dist/consumer.d.ts.map +1 -1
- package/dist/consumer.js +22 -34
- package/dist/consumer.js.map +1 -1
- package/dist/discovery.d.ts +8 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +36 -0
- package/dist/discovery.js.map +1 -0
- package/dist/distribute.d.ts +9 -0
- package/dist/distribute.d.ts.map +1 -1
- package/dist/distribute.js +70 -13
- package/dist/distribute.js.map +1 -1
- package/dist/doctor-authority.d.ts.map +1 -1
- package/dist/doctor-authority.js +7 -4
- package/dist/doctor-authority.js.map +1 -1
- package/dist/doctor-extensions.d.ts +36 -0
- package/dist/doctor-extensions.d.ts.map +1 -0
- package/dist/doctor-extensions.js +118 -0
- package/dist/doctor-extensions.js.map +1 -0
- package/dist/doctor-mounts.d.ts.map +1 -1
- package/dist/doctor-mounts.js +3 -2
- package/dist/doctor-mounts.js.map +1 -1
- package/dist/doctor-user.d.ts +64 -0
- package/dist/doctor-user.d.ts.map +1 -1
- package/dist/doctor-user.js +309 -34
- package/dist/doctor-user.js.map +1 -1
- package/dist/doctor.d.ts +22 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +81 -32
- package/dist/doctor.js.map +1 -1
- package/dist/fix.d.ts +67 -0
- package/dist/fix.d.ts.map +1 -0
- package/dist/fix.js +136 -0
- package/dist/fix.js.map +1 -0
- package/dist/handoff.d.ts +65 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +264 -0
- package/dist/handoff.js.map +1 -0
- package/dist/host-projection.d.ts.map +1 -1
- package/dist/host-projection.js +1 -8
- package/dist/host-projection.js.map +1 -1
- package/dist/host.d.ts +9 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +23 -7
- package/dist/host.js.map +1 -1
- package/dist/init.d.ts +4 -6
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +85 -10
- package/dist/init.js.map +1 -1
- package/dist/local-cli.d.ts +67 -0
- package/dist/local-cli.d.ts.map +1 -0
- package/dist/local-cli.js +269 -0
- package/dist/local-cli.js.map +1 -0
- package/dist/main.d.ts +47 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +121 -26
- package/dist/main.js.map +1 -1
- package/dist/marketplace-record.d.ts +7 -1
- package/dist/marketplace-record.d.ts.map +1 -1
- package/dist/marketplace-record.js +6 -3
- package/dist/marketplace-record.js.map +1 -1
- package/dist/package-manager.d.ts +43 -0
- package/dist/package-manager.d.ts.map +1 -0
- package/dist/package-manager.js +164 -0
- package/dist/package-manager.js.map +1 -0
- package/dist/position.d.ts.map +1 -1
- package/dist/position.js +16 -2
- package/dist/position.js.map +1 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +11 -3
- package/dist/preview.js.map +1 -1
- package/dist/profile.d.ts +1 -1
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +3 -4
- package/dist/profile.js.map +1 -1
- package/dist/program.d.ts +10 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +38 -1
- package/dist/program.js.map +1 -1
- package/dist/project.js +2 -2
- package/dist/project.js.map +1 -1
- package/dist/render.d.ts +7 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +42 -3
- package/dist/render.js.map +1 -1
- package/dist/self.d.ts +6 -0
- package/dist/self.d.ts.map +1 -0
- package/dist/self.js +20 -0
- package/dist/self.js.map +1 -0
- package/dist/tracked-lock.d.ts +15 -0
- package/dist/tracked-lock.d.ts.map +1 -0
- package/dist/tracked-lock.js +37 -0
- package/dist/tracked-lock.js.map +1 -0
- package/dist/tracked.d.ts +125 -0
- package/dist/tracked.d.ts.map +1 -0
- package/dist/tracked.js +436 -0
- package/dist/tracked.js.map +1 -0
- package/dist/user-host.d.ts +7 -3
- package/dist/user-host.d.ts.map +1 -1
- package/dist/user-host.js +24 -11
- package/dist/user-host.js.map +1 -1
- package/dist/workspace-state.d.ts +15 -0
- package/dist/workspace-state.d.ts.map +1 -0
- package/dist/workspace-state.js +35 -0
- package/dist/workspace-state.js.map +1 -0
- package/dist/workspaces.d.ts +37 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +319 -0
- package/dist/workspaces.js.map +1 -0
- package/package.json +9 -8
- package/assets/host/0f17774a928b0ed422d4eaae433d379df6df70a94ee2ba47501ed7b7bbbe73e4.tgz +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The console's offer table (consumer CLI contract §1.2 and §2.12). Every command an offer runs is a doctor check's `fix` or
|
|
3
|
+
* one of the package-manager argv builders, never text: one offer per reported check with a fix (warn or fail: attention; info:
|
|
4
|
+
* set up), the set-up offers doctor has no fix for (register a host, add a kit, track this workspace), the upgrade
|
|
5
|
+
* recipe, the More entries, and the offers an extension declares as data. Check ids are an open set: a row this table
|
|
6
|
+
* does not know still gets its offer, titled by its check. Pure: everything it reads is in the state.
|
|
7
|
+
*/
|
|
8
|
+
import { compareVersions } from '@inventarch/distribution/updates';
|
|
9
|
+
import { REQUEST } from '../distribute.js';
|
|
10
|
+
import { externalFix, iaFix } from '../fix.js';
|
|
11
|
+
import { installArgv, pinArgv } from '../package-manager.js';
|
|
12
|
+
import { AREA_TABLE, areaOf, DEFAULT_AREA } from './state.js';
|
|
13
|
+
/** Offer titles by check id; an id missing here is titled by its check. */
|
|
14
|
+
const TITLES = {
|
|
15
|
+
'plugin-claude': 'Refresh Claude plugin',
|
|
16
|
+
records: 'Fix record errors',
|
|
17
|
+
generation: 'Re-lock',
|
|
18
|
+
pending: 'Resume interrupted install',
|
|
19
|
+
'install-lock': 'Resume interrupted install',
|
|
20
|
+
marketplace: 'Install the Claude plugin',
|
|
21
|
+
root: 'Initialise a workspace here',
|
|
22
|
+
};
|
|
23
|
+
function titleOf(row) {
|
|
24
|
+
if (row.id.startsWith('kit-update:'))
|
|
25
|
+
return `Update kit ${row.id.slice('kit-update:'.length)}`;
|
|
26
|
+
if (row.id === 'cli-version')
|
|
27
|
+
return row.status === 'info' ? 'Pin the CLI in this repo' : 'Install dependencies';
|
|
28
|
+
return TITLES[row.id] ?? row.title;
|
|
29
|
+
}
|
|
30
|
+
/** One sentence on what running the steps does, by the first step's flow. */
|
|
31
|
+
function sentence(steps) {
|
|
32
|
+
const first = steps[0];
|
|
33
|
+
if (first === undefined)
|
|
34
|
+
return '';
|
|
35
|
+
const recipe = steps.length > 1 ? ` It runs ${steps.length} steps in order and stops at the first that fails.` : '';
|
|
36
|
+
switch (first.flow) {
|
|
37
|
+
case 'preview-apply':
|
|
38
|
+
return `It previews the change first and applies it when you confirm.${recipe}`;
|
|
39
|
+
case 'preview-flag':
|
|
40
|
+
return `It runs a preview first and the command when you confirm.${recipe}`;
|
|
41
|
+
case 'confirm':
|
|
42
|
+
return `It shows the command and runs it when you confirm.${recipe}`;
|
|
43
|
+
case 'immediate':
|
|
44
|
+
return `It runs straight away.${recipe}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const explainOf = (detail, steps) => [detail.endsWith('.') ? detail : `${detail}.`, sentence(steps)].filter((part) => part !== '').join(' ');
|
|
48
|
+
/** What a step writes, as the right pane names it. */
|
|
49
|
+
function change(step) {
|
|
50
|
+
if (step.writesTo === 'none')
|
|
51
|
+
return 'writes nothing';
|
|
52
|
+
if (step.writesTo === 'machine')
|
|
53
|
+
return 'this machine';
|
|
54
|
+
if (step.writesTo === 'repo')
|
|
55
|
+
return step.program === 'external' ? 'this repo (package.json, lockfile)' : 'this repo (.ia/)';
|
|
56
|
+
if (step.program === 'ia' && step.argv[0] === 'workspaces')
|
|
57
|
+
return 'your IA home (tracked-workspaces.json)';
|
|
58
|
+
if (step.program === 'ia' && step.argv[0] === 'host' && step.argv.includes('--user'))
|
|
59
|
+
return '~/.claude plugin and your IA home';
|
|
60
|
+
if (step.program === 'external' && step.argv.includes('refresh-updates'))
|
|
61
|
+
return 'your IA home (update cache)';
|
|
62
|
+
return 'your IA home';
|
|
63
|
+
}
|
|
64
|
+
function changesOf(steps) {
|
|
65
|
+
const writes = [...new Set(steps.filter((step) => step.writesTo !== 'none').map(change))];
|
|
66
|
+
return writes.length === 0 ? ['writes nothing'] : writes;
|
|
67
|
+
}
|
|
68
|
+
/** At least one step writes the repo; every other writes nothing, the user's home or the machine. */
|
|
69
|
+
export const batchable = (steps) => steps.some((step) => step.writesTo === 'repo');
|
|
70
|
+
/** Which copy runs a step (consumer CLI contract §1.2): its program, the running copy for user or machine writes, else the repo's. */
|
|
71
|
+
export function runsOn(step, state) {
|
|
72
|
+
if (step.program === 'external')
|
|
73
|
+
return 'external';
|
|
74
|
+
if (step.writesTo === 'user' || step.writesTo === 'machine')
|
|
75
|
+
return 'running';
|
|
76
|
+
return state.repo === null ? 'running' : 'repo';
|
|
77
|
+
}
|
|
78
|
+
/** The kit request line: the CLI's own request grammar, never an option. */
|
|
79
|
+
function acceptKit(value) {
|
|
80
|
+
if (value.startsWith('-'))
|
|
81
|
+
return 'A kit id cannot start with a dash.';
|
|
82
|
+
if (value === '' || /\s/.test(value) || !REQUEST.test(value))
|
|
83
|
+
return 'Enter a kit id as scope/name, optionally with @range, such as acme/kit@^1.2.';
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const buildKit = (value) => [iaFix(['install', value], 'repo').fix];
|
|
87
|
+
/** Install and pin for a copy that reports `cli-version` without a fix, with the manifest's directory named. */
|
|
88
|
+
function cliFallback(row, state) {
|
|
89
|
+
const { manager, managerConflict, manifestDir } = state.facts;
|
|
90
|
+
if (manager === null || managerConflict.length > 0 || state.root === null)
|
|
91
|
+
return null;
|
|
92
|
+
if (row.status === 'warn' && manifestDir !== null)
|
|
93
|
+
return externalFix(installArgv(manager, manifestDir, state.root), 'repo').fix;
|
|
94
|
+
if (row.status === 'info')
|
|
95
|
+
return externalFix(pinArgv(manager, state.running.version, manifestDir ?? state.root, state.root), 'repo').fix;
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
/** The upgrade recipe, each step included only when it applies; none without a manager the repo agrees on. */
|
|
99
|
+
function upgrade(state) {
|
|
100
|
+
const { latest, manager, managerConflict, manifestDir, generation, marketplace } = state.facts;
|
|
101
|
+
if (latest === null || state.repo === null || state.root === null || manifestDir === null)
|
|
102
|
+
return null;
|
|
103
|
+
if (manager === null || managerConflict.length > 0)
|
|
104
|
+
return null;
|
|
105
|
+
if (compareVersions(latest, state.repo.version) <= 0)
|
|
106
|
+
return null;
|
|
107
|
+
const steps = [externalFix(pinArgv(manager, latest, manifestDir, state.root), 'repo').fix];
|
|
108
|
+
if (generation)
|
|
109
|
+
steps.push({ ...iaFix(['restore', '--apply'], 'repo').fix, requires: 'repo-copy' });
|
|
110
|
+
steps.push({ ...iaFix(['validate'], 'none').fix, requires: 'repo-copy' });
|
|
111
|
+
if (marketplace)
|
|
112
|
+
steps.push(iaFix(['host', 'claude', '--user', '--apply'], 'user').fix);
|
|
113
|
+
return {
|
|
114
|
+
id: 'upgrade',
|
|
115
|
+
answers: ['cli-version', 'updates'],
|
|
116
|
+
title: `Upgrade CLI to ${latest}`,
|
|
117
|
+
explain: explainOf(`ia ${latest} is available; this workspace pins ${state.repo.version}`, steps),
|
|
118
|
+
steps,
|
|
119
|
+
group: 'attention',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const ORDER = ['attention', 'setup', 'more'];
|
|
123
|
+
const sameSteps = (a, b) => a.length === b.length &&
|
|
124
|
+
a.every((step, index) => step.program === b[index].program &&
|
|
125
|
+
step.argv.length === b[index].argv.length &&
|
|
126
|
+
step.argv.every((part, at) => part === b[index].argv[at]));
|
|
127
|
+
/** Every offer for the state: attention, then set up, then More; inside a group, by area order, then as found. */
|
|
128
|
+
export function offersFor(state, extensions = []) {
|
|
129
|
+
const reported = state.checks.filter((row) => row.reported);
|
|
130
|
+
const byId = new Map(reported.map((row) => [row.id, row]));
|
|
131
|
+
const drafts = [];
|
|
132
|
+
const add = (draft) => {
|
|
133
|
+
// Two checks with the same command make one offer that answers both.
|
|
134
|
+
const same = draft.steps.length > 0 ? drafts.find((other) => sameSteps(other.steps, draft.steps)) : undefined;
|
|
135
|
+
if (same === undefined)
|
|
136
|
+
drafts.push(draft);
|
|
137
|
+
else
|
|
138
|
+
drafts[drafts.indexOf(same)] = { ...same, answers: [...same.answers, ...draft.answers] };
|
|
139
|
+
};
|
|
140
|
+
for (const row of reported) {
|
|
141
|
+
if (row.status === 'ok' || row.status === 'unknown')
|
|
142
|
+
continue;
|
|
143
|
+
// A copy older than fixes still names its install or pin as a remedy; the console builds that command here.
|
|
144
|
+
const fix = row.fix ?? (row.id === 'cli-version' && row.remedy !== null ? cliFallback(row, state) : null);
|
|
145
|
+
if (fix === null)
|
|
146
|
+
continue;
|
|
147
|
+
add({
|
|
148
|
+
id: `fix:${row.id}`,
|
|
149
|
+
answers: [row.id],
|
|
150
|
+
title: titleOf(row),
|
|
151
|
+
explain: explainOf(row.detail, [fix]),
|
|
152
|
+
steps: [fix],
|
|
153
|
+
group: row.id === 'root' || row.status === 'info' ? 'setup' : 'attention',
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const recipe = upgrade(state);
|
|
157
|
+
if (recipe !== null)
|
|
158
|
+
add(recipe);
|
|
159
|
+
if (byId.get('host')?.status === 'info')
|
|
160
|
+
for (const host of ['claude', 'codex']) {
|
|
161
|
+
const steps = [iaFix(['host', host], 'repo').fix];
|
|
162
|
+
add({
|
|
163
|
+
id: `register-host:${host}`,
|
|
164
|
+
answers: ['host'],
|
|
165
|
+
title: `Register a host: ${host === 'claude' ? 'Claude' : 'Codex'}`,
|
|
166
|
+
explain: explainOf(`No host is registered; this registers ${host === 'claude' ? 'Claude' : 'Codex'}`, steps),
|
|
167
|
+
steps,
|
|
168
|
+
group: 'setup',
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const kits = byId.get('kits');
|
|
172
|
+
if (state.root !== null && kits !== undefined)
|
|
173
|
+
add({
|
|
174
|
+
id: 'add-kit',
|
|
175
|
+
answers: ['kits'],
|
|
176
|
+
title: 'Add a kit…',
|
|
177
|
+
explain: explainOf(kits.status === 'info' ? 'No kits are installed' : 'Installs another kit', buildKit('scope/name')),
|
|
178
|
+
steps: buildKit('<kit>'),
|
|
179
|
+
group: kits.status === 'info' ? 'setup' : 'more',
|
|
180
|
+
input: { label: 'Kit id', accept: acceptKit, build: buildKit },
|
|
181
|
+
});
|
|
182
|
+
if (state.root !== null && !state.tracked) {
|
|
183
|
+
const steps = [iaFix(['workspaces', 'add', state.root], 'user').fix];
|
|
184
|
+
add({
|
|
185
|
+
id: 'track',
|
|
186
|
+
answers: [],
|
|
187
|
+
title: 'Track this workspace',
|
|
188
|
+
explain: explainOf('This workspace is not in your tracked list, which the all-workspaces view reads', steps),
|
|
189
|
+
steps,
|
|
190
|
+
group: 'setup',
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
for (const extension of extensions)
|
|
194
|
+
for (const declared of extension.offers) {
|
|
195
|
+
const statuses = declared.answers.flatMap((id) => {
|
|
196
|
+
const row = byId.get(id);
|
|
197
|
+
return row === undefined ? [] : [row.status];
|
|
198
|
+
});
|
|
199
|
+
const group = declared.answers.length === 0
|
|
200
|
+
? 'more'
|
|
201
|
+
: statuses.some((status) => status === 'warn' || status === 'fail')
|
|
202
|
+
? 'attention'
|
|
203
|
+
: statuses.includes('info')
|
|
204
|
+
? 'setup'
|
|
205
|
+
: null;
|
|
206
|
+
if (group === null)
|
|
207
|
+
continue;
|
|
208
|
+
const steps = declared.steps.map((step) => ({ program: 'ia', ...step, argv: [...step.argv] }));
|
|
209
|
+
add({
|
|
210
|
+
id: declared.id,
|
|
211
|
+
answers: declared.answers,
|
|
212
|
+
title: declared.title,
|
|
213
|
+
explain: declared.explain,
|
|
214
|
+
steps,
|
|
215
|
+
group,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
add({
|
|
219
|
+
id: 'diagnostics',
|
|
220
|
+
answers: [],
|
|
221
|
+
title: 'Diagnostics',
|
|
222
|
+
explain: 'Every doctor check for this workspace, with the copy that reported it.',
|
|
223
|
+
steps: [],
|
|
224
|
+
group: 'more',
|
|
225
|
+
view: 'diagnostics',
|
|
226
|
+
});
|
|
227
|
+
if (state.refreshNow !== null) {
|
|
228
|
+
const steps = [{ program: 'external', argv: [...state.refreshNow], flow: 'immediate', writesTo: 'user' }];
|
|
229
|
+
add({
|
|
230
|
+
id: 'check-updates',
|
|
231
|
+
answers: [],
|
|
232
|
+
title: 'Check for updates now',
|
|
233
|
+
explain: explainOf('Asks the update source for the newest ia and every installed kit, even if checked today', steps),
|
|
234
|
+
steps,
|
|
235
|
+
group: 'more',
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
else
|
|
239
|
+
add({
|
|
240
|
+
id: 'check-updates',
|
|
241
|
+
answers: [],
|
|
242
|
+
title: 'Check for updates now',
|
|
243
|
+
explain: `Not available: ${state.refreshNowWhy ?? 'the update mechanism could not be found'}.`,
|
|
244
|
+
steps: [],
|
|
245
|
+
group: 'more',
|
|
246
|
+
disabled: state.refreshNowWhy ?? 'the update mechanism could not be found',
|
|
247
|
+
});
|
|
248
|
+
// Area order: the table's areas, Other, then the extension areas; an offer with no area comes last in its group.
|
|
249
|
+
const areaOrder = [
|
|
250
|
+
...AREA_TABLE.flatMap((row) => (row.area === null ? [] : [row.area])),
|
|
251
|
+
DEFAULT_AREA,
|
|
252
|
+
...extensions.flatMap((extension) => extension.areas.map((area) => area.id)),
|
|
253
|
+
];
|
|
254
|
+
const rank = (area) => {
|
|
255
|
+
const at = area === null ? -1 : areaOrder.indexOf(area);
|
|
256
|
+
return at === -1 ? areaOrder.length : at;
|
|
257
|
+
};
|
|
258
|
+
return drafts
|
|
259
|
+
.map((draft, index) => {
|
|
260
|
+
const area = draft.answers.length === 0 ? null : areaOf(draft.answers[0], extensions);
|
|
261
|
+
return {
|
|
262
|
+
index,
|
|
263
|
+
offer: {
|
|
264
|
+
...draft,
|
|
265
|
+
area,
|
|
266
|
+
changes: changesOf(draft.steps),
|
|
267
|
+
writesTo: [...new Set(draft.steps.map((step) => step.writesTo))],
|
|
268
|
+
batchable: batchable(draft.steps),
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
})
|
|
272
|
+
.sort((a, b) => ORDER.indexOf(a.offer.group) - ORDER.indexOf(b.offer.group) ||
|
|
273
|
+
rank(a.offer.area) - rank(b.offer.area) ||
|
|
274
|
+
a.index - b.index)
|
|
275
|
+
.map((entry) => entry.offer);
|
|
276
|
+
}
|
|
277
|
+
/** The ids whose `info` rows count as "not set up" (○): those a set-up offer answers. */
|
|
278
|
+
export function setupIds(state, extensions = []) {
|
|
279
|
+
const info = new Set(state.checks.filter((row) => row.reported && row.status === 'info').map((row) => row.id));
|
|
280
|
+
return new Set(offersFor({ ...state, areas: [] }, extensions)
|
|
281
|
+
.filter((offer) => offer.group === 'setup')
|
|
282
|
+
.flatMap((offer) => offer.answers)
|
|
283
|
+
.filter((id) => info.has(id)));
|
|
284
|
+
}
|
|
285
|
+
//# sourceMappingURL=offers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offers.js","sourceRoot":"","sources":["../../src/console/offers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA8B9D,2EAA2E;AAC3E,MAAM,MAAM,GAAqC;IAC/C,eAAe,EAAE,uBAAuB;IACxC,OAAO,EAAE,mBAAmB;IAC5B,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,4BAA4B;IACrC,cAAc,EAAE,4BAA4B;IAC5C,WAAW,EAAE,2BAA2B;IACxC,IAAI,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,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QACvC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CACpB;SACA,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,QAAQ,CACtB,KAAkC,EAClC,aAA0C,EAAE;IAE5C,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/G,OAAO,IAAI,GAAG,CACZ,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,CAAC;SAC3C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,OAAO,CAAC;SAC1C,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;SACjC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { LocalCli } from '../local-cli.js';
|
|
2
|
+
import type { Env } from '../program.js';
|
|
3
|
+
import type { Offer } from './offers.js';
|
|
4
|
+
import type { ConsoleState } from './state.js';
|
|
5
|
+
import type { Screen } from './terminal.js';
|
|
6
|
+
export interface SpawnOptions {
|
|
7
|
+
readonly cwd: string;
|
|
8
|
+
readonly env: Env;
|
|
9
|
+
readonly windowsVerbatimArguments?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Starts a program with inherited stdio and settles with its exit code, or null when it ended on a signal. */
|
|
12
|
+
export interface Spawner {
|
|
13
|
+
(file: string, args: readonly string[], options: SpawnOptions): Promise<number | null>;
|
|
14
|
+
}
|
|
15
|
+
export interface RunIO {
|
|
16
|
+
readonly screen: Pick<Screen, 'enter' | 'leave' | 'invalidate'>;
|
|
17
|
+
readonly spawn: Spawner;
|
|
18
|
+
/** A yes/no question in the normal screen; only an explicit yes consents. */
|
|
19
|
+
readonly ask: (question: string) => Promise<boolean>;
|
|
20
|
+
/** One line of input in the console; null when cancelled. */
|
|
21
|
+
readonly prompt: (label: string, accept: (value: string) => string | null) => Promise<string | null>;
|
|
22
|
+
readonly waitKey: () => Promise<void>;
|
|
23
|
+
readonly print: (text: string) => void;
|
|
24
|
+
/** The workspace's own copy as the disk has it now, by hand-off's rule (handoff.ts `runnableCopy`), or null. */
|
|
25
|
+
readonly resolveRepo: (root: string) => LocalCli | null;
|
|
26
|
+
readonly env: Env;
|
|
27
|
+
/** The working directory outside a workspace. */
|
|
28
|
+
readonly cwd: string;
|
|
29
|
+
}
|
|
30
|
+
/** The running copy's entry, which never hands off. */
|
|
31
|
+
export declare const runningEntry: (packageRoot: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* One argument on the line cmd.exe runs a `.cmd` program with, which forwards it (`%*`) to a program that splits its
|
|
34
|
+
* line by the Windows argv rules (CommandLineToArgvW and the C runtime). Plain text passes as typed. Anything else is
|
|
35
|
+
* put in quotes, with a run of backslashes before the closing quote doubled, so the program reads back exactly this
|
|
36
|
+
* argument; and cmd.exe, which sees it inside quotes, leaves a caret, an ampersand, a pipe, a redirection or a bang
|
|
37
|
+
* alone. Null, refused, for `%`, which cmd.exe expands even inside quotes; for any double quote, since cmd.exe knows
|
|
38
|
+
* no escape for one: every quote toggles its quoting for the rest of the line, so a quote in one argument would leave
|
|
39
|
+
* a later argument's `&` live; and for a control character, since cmd.exe ends the command at a line break.
|
|
40
|
+
*/
|
|
41
|
+
export declare function cmdArgument(value: string): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* One argument, or one piece of text, as the normal screen shows it: as written, so a path reads as typed, unless it
|
|
44
|
+
* holds a control character (C0, DEL or C1) or a lone surrogate, starts with a double quote or is empty; then as a
|
|
45
|
+
* JSON string literal, with DEL and C1 escaped too (a lone surrogate JSON escapes itself). So no control character
|
|
46
|
+
* reaches the terminal, no character is lost to UTF-8 output, and what is shown reads back exactly: `JSON.parse` when
|
|
47
|
+
* it starts with a quote, as written otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export declare function shownArgument(text: string): string;
|
|
50
|
+
/** The default spawner: inherited stdio, and this process deaf to the terminal's signals while the child decides. */
|
|
51
|
+
export declare const spawnInherited: Spawner;
|
|
52
|
+
export declare function runOffer(offer: Offer, state: ConsoleState, io: RunIO): Promise<{
|
|
53
|
+
readonly completed: number;
|
|
54
|
+
readonly exitCode: number | null;
|
|
55
|
+
}>;
|
|
56
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/console/run.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAQ,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;CAC7C;AACD,+GAA+G;AAC/G,MAAM,WAAW,OAAO;IACtB,CAAC,I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A2BzB,CAAC;AA8CL,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,KAAK,GACR,OAAO,CAAC;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAiF3E"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running an offer (consumer CLI contract §1.2): in the normal screen, with inherited stdio, so the user sees the real output. Each
|
|
3
|
+
* step follows its flow: a preview-apply form previews, asks, then applies with `--apply --yes`; a preview-flag form
|
|
4
|
+
* runs with `--preview`, asks, then as given; a confirm step is shown, asked and run in its confirmed form (a required
|
|
5
|
+
* `--apply` gains `--yes`, so the child never asks again); an immediate step runs straight away. A decline, a non-zero
|
|
6
|
+
* exit, a program that cannot start, or a step that needs the repo copy when none resolves stops the recipe.
|
|
7
|
+
*
|
|
8
|
+
* Which copy runs a step is decided at that step, from the disk (`resolveRepo`), never from the state's snapshot: a
|
|
9
|
+
* step that installs or replaces the workspace's copy changes which entry the next step runs. An `ia` step is spawned
|
|
10
|
+
* as `process.execPath <entry> …argv` with `IA_NO_HANDOFF=1`; an external one by the absolute path `findProgram` finds
|
|
11
|
+
* on qualified PATH entries (a Windows `.cmd` through cmd.exe named by its path), or as given when it is absolute.
|
|
12
|
+
*/
|
|
13
|
+
import { spawn as spawnChild } from 'node:child_process';
|
|
14
|
+
import { isAbsolute, join } from 'node:path';
|
|
15
|
+
import { confirmedArgv, previewArgv } from '../fix.js';
|
|
16
|
+
import { NO_HANDOFF } from '../handoff.js';
|
|
17
|
+
import { findProgram, programEnv, windowsShell, windowsShellArgs } from '../program.js';
|
|
18
|
+
import { runsOn } from './offers.js';
|
|
19
|
+
import { sanitize } from './grid.js';
|
|
20
|
+
/** The running copy's entry, which never hands off. */
|
|
21
|
+
export const runningEntry = (packageRoot) => join(packageRoot, 'dist', 'main.js');
|
|
22
|
+
/**
|
|
23
|
+
* One argument on the line cmd.exe runs a `.cmd` program with, which forwards it (`%*`) to a program that splits its
|
|
24
|
+
* line by the Windows argv rules (CommandLineToArgvW and the C runtime). Plain text passes as typed. Anything else is
|
|
25
|
+
* put in quotes, with a run of backslashes before the closing quote doubled, so the program reads back exactly this
|
|
26
|
+
* argument; and cmd.exe, which sees it inside quotes, leaves a caret, an ampersand, a pipe, a redirection or a bang
|
|
27
|
+
* alone. Null, refused, for `%`, which cmd.exe expands even inside quotes; for any double quote, since cmd.exe knows
|
|
28
|
+
* no escape for one: every quote toggles its quoting for the rest of the line, so a quote in one argument would leave
|
|
29
|
+
* a later argument's `&` live; and for a control character, since cmd.exe ends the command at a line break.
|
|
30
|
+
*/
|
|
31
|
+
export function cmdArgument(value) {
|
|
32
|
+
if (/[%"\x00-\x1f]/.test(value))
|
|
33
|
+
return null;
|
|
34
|
+
if (/^[\w\-.:\\/@+~]+$/.test(value))
|
|
35
|
+
return value;
|
|
36
|
+
const trailing = /\\*$/.exec(value)[0].length;
|
|
37
|
+
return `"${value}${'\\'.repeat(trailing)}"`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One argument, or one piece of text, as the normal screen shows it: as written, so a path reads as typed, unless it
|
|
41
|
+
* holds a control character (C0, DEL or C1) or a lone surrogate, starts with a double quote or is empty; then as a
|
|
42
|
+
* JSON string literal, with DEL and C1 escaped too (a lone surrogate JSON escapes itself). So no control character
|
|
43
|
+
* reaches the terminal, no character is lost to UTF-8 output, and what is shown reads back exactly: `JSON.parse` when
|
|
44
|
+
* it starts with a quote, as written otherwise.
|
|
45
|
+
*/
|
|
46
|
+
export function shownArgument(text) {
|
|
47
|
+
if (text !== '' && !text.startsWith('"') && !/[\x00-\x1f\x7f-\x9f]|\p{Cs}/u.test(text))
|
|
48
|
+
return text;
|
|
49
|
+
return JSON.stringify(text).replace(/[\x7f-\x9f]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
50
|
+
}
|
|
51
|
+
/** A command as a confirmation shows it: each argument by `shownArgument`. */
|
|
52
|
+
function shownArgv(program, argv) {
|
|
53
|
+
const parts = argv.map(shownArgument);
|
|
54
|
+
return (program === 'ia' ? ['ia', ...parts] : parts).join(' ');
|
|
55
|
+
}
|
|
56
|
+
/** The default spawner: inherited stdio, and this process deaf to the terminal's signals while the child decides. */
|
|
57
|
+
export const spawnInherited = (file, args, options) => new Promise((settle, reject) => {
|
|
58
|
+
const ignore = () => { };
|
|
59
|
+
const signals = [
|
|
60
|
+
'SIGINT',
|
|
61
|
+
'SIGTERM',
|
|
62
|
+
'SIGHUP',
|
|
63
|
+
...(process.platform === 'win32' ? ['SIGBREAK'] : []),
|
|
64
|
+
];
|
|
65
|
+
for (const signal of signals)
|
|
66
|
+
process.on(signal, ignore);
|
|
67
|
+
const done = () => {
|
|
68
|
+
for (const signal of signals)
|
|
69
|
+
process.off(signal, ignore);
|
|
70
|
+
};
|
|
71
|
+
const child = spawnChild(file, [...args], {
|
|
72
|
+
cwd: options.cwd,
|
|
73
|
+
env: options.env,
|
|
74
|
+
stdio: 'inherit',
|
|
75
|
+
windowsVerbatimArguments: options.windowsVerbatimArguments === true,
|
|
76
|
+
});
|
|
77
|
+
child.once('error', (error) => {
|
|
78
|
+
done();
|
|
79
|
+
reject(error);
|
|
80
|
+
});
|
|
81
|
+
child.once('exit', (code) => {
|
|
82
|
+
done();
|
|
83
|
+
settle(code);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
/** How one form of a step is started, or why it cannot be. */
|
|
87
|
+
function target(step, argv, state, repo, io) {
|
|
88
|
+
const cwd = state.root ?? io.cwd;
|
|
89
|
+
if (step.program === 'ia') {
|
|
90
|
+
const on = runsOn({ ...step, argv }, { running: state.running, repo });
|
|
91
|
+
const entry = on === 'repo' && repo !== null ? repo.entry : runningEntry(state.running.packageRoot);
|
|
92
|
+
return {
|
|
93
|
+
file: process.execPath,
|
|
94
|
+
args: [entry, ...argv],
|
|
95
|
+
options: { cwd, env: { ...io.env, [NO_HANDOFF]: '1' } },
|
|
96
|
+
copy: on === 'repo' ? 'repo' : 'running',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const [name, ...rest] = argv;
|
|
100
|
+
if (name === undefined)
|
|
101
|
+
return 'the step names no program';
|
|
102
|
+
const env = programEnv(io.env);
|
|
103
|
+
if (isAbsolute(name))
|
|
104
|
+
return { file: name, args: rest, options: { cwd, env }, copy: 'external' };
|
|
105
|
+
const program = findProgram(name, io.env, 'program');
|
|
106
|
+
if (program !== null)
|
|
107
|
+
return { file: program, args: rest, options: { cwd, env }, copy: 'external' };
|
|
108
|
+
const script = findProgram(name, io.env, 'script');
|
|
109
|
+
if (script === null)
|
|
110
|
+
return `${name} was not found on a qualified PATH entry`;
|
|
111
|
+
const quoted = rest.map(cmdArgument);
|
|
112
|
+
if (quoted.some((value) => value === null))
|
|
113
|
+
return `cmd.exe cannot pass an argument of ${name} unchanged`;
|
|
114
|
+
return {
|
|
115
|
+
file: windowsShell(io.env),
|
|
116
|
+
args: windowsShellArgs(script, quoted),
|
|
117
|
+
options: { cwd, env, windowsVerbatimArguments: true },
|
|
118
|
+
copy: 'external',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const shown = (step, argv) => shownArgv(step.program, argv);
|
|
122
|
+
export async function runOffer(offer, state, io) {
|
|
123
|
+
if (offer.disabled !== undefined)
|
|
124
|
+
return { completed: 0, exitCode: null };
|
|
125
|
+
// What the normal screen shows goes through `shownArgument` and `shownArgv`; the argv that runs is untouched. The grid's
|
|
126
|
+
// replacement stays as a last net for anything that was not.
|
|
127
|
+
const say = (text) => io.print(sanitize(text));
|
|
128
|
+
const confirm = (question) => io.ask(sanitize(question));
|
|
129
|
+
let steps = offer.steps;
|
|
130
|
+
if (offer.input !== undefined) {
|
|
131
|
+
const value = await io.prompt(offer.input.label, offer.input.accept);
|
|
132
|
+
if (value === null)
|
|
133
|
+
return { completed: 0, exitCode: null };
|
|
134
|
+
steps = offer.input.build(value);
|
|
135
|
+
}
|
|
136
|
+
let left = false;
|
|
137
|
+
const leave = () => {
|
|
138
|
+
if (left)
|
|
139
|
+
return;
|
|
140
|
+
io.screen.leave();
|
|
141
|
+
left = true;
|
|
142
|
+
};
|
|
143
|
+
let completed = 0, exitCode = null, outcome = '';
|
|
144
|
+
for (const [index, step] of steps.entries()) {
|
|
145
|
+
const label = steps.length > 1 ? `Step ${index + 1} of ${steps.length}: ` : '';
|
|
146
|
+
// The target is resolved now, from the disk: an earlier step may have installed or replaced the repo copy.
|
|
147
|
+
const repo = state.root === null ? null : io.resolveRepo(state.root);
|
|
148
|
+
leave();
|
|
149
|
+
if (step.requires === 'repo-copy' && repo === null) {
|
|
150
|
+
outcome = `Stopped at step ${index + 1}: the repo copy is not installed.`;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
const run = async (argv) => {
|
|
154
|
+
const started = target(step, argv, state, repo, io);
|
|
155
|
+
if (typeof started === 'string')
|
|
156
|
+
return started;
|
|
157
|
+
say(`$ ${shown(step, argv)}`);
|
|
158
|
+
try {
|
|
159
|
+
return { code: await io.spawn(started.file, started.args, started.options), copy: started.copy };
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
// A program that cannot start (ENOENT, EACCES) is a failed step, not the console's end.
|
|
163
|
+
return `could not start: ${error instanceof Error ? error.message : String(error)}`;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
let result = null;
|
|
167
|
+
const preview = previewArgv(step);
|
|
168
|
+
if (step.flow === 'immediate')
|
|
169
|
+
result = await run(step.argv);
|
|
170
|
+
else {
|
|
171
|
+
say(`${label}${shownArgument(offer.title)}`);
|
|
172
|
+
if (preview !== null) {
|
|
173
|
+
const previewed = await run(preview);
|
|
174
|
+
if (typeof previewed === 'string' || previewed.code !== 0)
|
|
175
|
+
result = previewed;
|
|
176
|
+
}
|
|
177
|
+
if (result === null) {
|
|
178
|
+
const final = step.flow === 'preview-flag' ? step.argv : confirmedArgv(step);
|
|
179
|
+
if (!(await confirm(`${preview === null ? 'Run' : 'Apply'}: ${shown(step, final)}?`))) {
|
|
180
|
+
outcome = `Declined; ${index === 0 ? 'nothing ran' : `stopped before step ${index + 1}`}.`;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
result = await run(final);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (typeof result === 'string') {
|
|
187
|
+
outcome = `Stopped at step ${index + 1}: ${shownArgument(result)}.`;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
if (result.code !== 0) {
|
|
191
|
+
exitCode = result.code;
|
|
192
|
+
const how = result.code === null ? 'ended by a signal' : `exited ${result.code}`;
|
|
193
|
+
outcome =
|
|
194
|
+
result.code === 2 && result.copy === 'repo'
|
|
195
|
+
? `Stopped at step ${index + 1}: this workspace's ia ${shownArgument(repo?.version ?? '')} refused the command as usage (exit 2); it may be older than the command this console runs.`
|
|
196
|
+
: `Stopped at step ${index + 1}: ${shown(step, step.argv)} ${how}.`;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
completed += 1;
|
|
200
|
+
}
|
|
201
|
+
if (!left)
|
|
202
|
+
return { completed, exitCode };
|
|
203
|
+
say(outcome === '' ? (steps.length > 1 ? `Done: ${completed} steps.` : 'Done.') : outcome);
|
|
204
|
+
say('Press any key to return to the console.');
|
|
205
|
+
await io.waitKey();
|
|
206
|
+
io.screen.enter();
|
|
207
|
+
io.screen.invalidate();
|
|
208
|
+
return { completed, exitCode };
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/console/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAA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