@inventarch/cli 3.5.1 → 3.7.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 +18 -5
- package/THIRD_PARTY_NOTICES.txt +49 -0
- package/assets/base/ee6e65018df2ebef705913d9da1947f040edf44c2e7ade6c9750c6fa0185985e.ia.tgz +0 -0
- package/assets/base.json +3 -3
- package/assets/host/e373b0f6699516f2ab8794f966728d2f82bca05ba3199c9fc642437cb79b13d5.tgz +0 -0
- package/assets/host.json +4 -4
- package/assets/vocabulary.json +1 -1
- 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 +87 -14
- 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 +14 -5
- 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/validate.d.ts +3 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +44 -1
- package/dist/validate.js.map +1 -1
- package/dist/workspace-state.d.ts +17 -0
- package/dist/workspace-state.d.ts.map +1 -0
- package/dist/workspace-state.js +38 -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/base/7b36e4b4959a7bead1c57906cd346b419f32570dac0ac764af805ad20cd63b16.ia.tgz +0 -0
- package/assets/host/e594fd978a0f8a9f042bf40ab124779067e1c88e4a72b7ce57261ca0e48a984c.tgz +0 -0
package/dist/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { registryWorkspace } from './adopt.js';
|
|
2
2
|
import { HostPluginError, lowerPlugin, readPlugin } from '@inventarch/workspace-runtime/internal/host-plugin';
|
|
3
|
-
import { adoptedBindings } from '@inventarch/db';
|
|
3
|
+
import { adoptedBindings, refusesInstallation } from '@inventarch/db';
|
|
4
4
|
import { adoptionId, OPEN_ATTRIBUTES, planAdoption, applyAdoption } from '@inventarch/distribution/registry';
|
|
5
5
|
import { readBase, PIN_PATH, PACKAGE_ID, DAMAGED } from './bundled-base.js';
|
|
6
6
|
import { canonical } from './plugin-sources.js';
|
|
@@ -34,7 +34,7 @@ export { readBase, PIN_PATH, baseArchivePath, PACKAGE_ID } from './bundled-base.
|
|
|
34
34
|
* already answered here, so it never asks a second one, and its projection is written by `applyHostProjection`, the one
|
|
35
35
|
* writer of projection files. It reads the live revision rather than the capture, so a capture that fails does not keep
|
|
36
36
|
* it from running; the capture's refusal then says the projection is written. The plan names that step and writes
|
|
37
|
-
* nothing for it — the host plan needs
|
|
37
|
+
* nothing for it — the host plan needs the workspace sources, which only the apply writes. A host step that refuses leaves
|
|
38
38
|
* the workspace initialized: the refusal keeps the service's code, message and location, and its next action names the
|
|
39
39
|
* rerun.
|
|
40
40
|
*
|
|
@@ -59,13 +59,14 @@ import { decodeReleaseDescriptor, deriveGenerationInputs, generationDigest, inst
|
|
|
59
59
|
import { verifyArchive } from '@inventarch/distribution/archive';
|
|
60
60
|
import { assertHostRegistrationIdle } from '@inventarch/distribution/host';
|
|
61
61
|
import { assertHomeOutsideWorkspace } from '@inventarch/distribution/host-home';
|
|
62
|
+
import { assertIaHomeUsable } from '@inventarch/distribution/ia-home';
|
|
62
63
|
import { applyInstallation, cacheArchive, planInstallation } from '@inventarch/distribution/install';
|
|
63
64
|
import { resolveReleases } from '@inventarch/distribution/resolve';
|
|
64
65
|
import { createFile, openWorkspaceSession, readInstalledState, readWorkspaceFile, readWorkspaceJson, resolveCatalog, } from '@inventarch/distribution/services';
|
|
65
66
|
import { parseArguments, UsageError } from './args.js';
|
|
66
67
|
import { captureFailure, collectCapture, CURRENT } from './capture.js';
|
|
67
68
|
import { findCommand } from './commands.js';
|
|
68
|
-
import { confirm, iaHomeOf, Interrupted, Refusal, refusalOf, respell } from './consumer.js';
|
|
69
|
+
import { answeredInterruption, confirm, iaHomeOf, Interrupted, Refusal, refusalOf, respell } from './consumer.js';
|
|
69
70
|
import { clearDecline, runDecline } from './decline.js';
|
|
70
71
|
import { CONFIRMATION, registeredProjections } from './distribute.js';
|
|
71
72
|
import { applyHostSet, collectHost, GUARD_RETIRED, hostNotes, JOURNALS, projectionRepair, recoverCommand, refusedPath, rootedNext, SETTINGS, STATE, THEN_RERUN, } from './host.js';
|
|
@@ -73,13 +74,11 @@ import { applyHostProjection, planFiles, planRetirement, preflightHooks, readRec
|
|
|
73
74
|
import { located } from './home-remedy.js';
|
|
74
75
|
import { findProgram, programEnv, programHome } from './program.js';
|
|
75
76
|
import { codeOf, openSession } from './session.js';
|
|
77
|
+
import { commandPath, PATH_OMITTED, readTracked, trackedRow, trackWorkspace } from './tracked.js';
|
|
78
|
+
import { DESCRIPTOR_PATH } from './workspace-state.js';
|
|
76
79
|
import { atom, blockSymbolWidth, document, entry, fieldRows, headerLine, quote, safeRootAdvice, sectionLabel, truncateDigest, words, } from './render.js';
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
* base package's id is read from this pin and appears nowhere in this source: the pin is the only authority for those
|
|
80
|
-
* bytes.
|
|
81
|
-
*/
|
|
82
|
-
export const DESCRIPTOR_PATH = '.ia/release.json';
|
|
80
|
+
/** Re-exported so `@inventarch/cli/internal/init` keeps the 3.5.0 export; the constant now lives in workspace-state.ts. */
|
|
81
|
+
export { DESCRIPTOR_PATH } from './workspace-state.js';
|
|
83
82
|
export const STARTER_VERSION = '0.1.0';
|
|
84
83
|
/** The installer's lock, `acquire()` at apps/distribution/src/install.ts:70; `INSTALL_PATHS` does not name it. */
|
|
85
84
|
export const INSTALL_LOCK = '.ia/distributions/install-lock.json';
|
|
@@ -1219,8 +1218,9 @@ async function initialize(context, root, id) {
|
|
|
1219
1218
|
return { exitCode: 0, stdout: renderDeclined(view, caps, args.positionals[0], host), stderr: '' };
|
|
1220
1219
|
// The project effect, last (SPEC `init`): the `ia host` path, whose apply writes the receipt.
|
|
1221
1220
|
const project = selected === 'none' ? undefined : (done) => registerHost(context, selected, root, done);
|
|
1221
|
+
let result;
|
|
1222
1222
|
try {
|
|
1223
|
-
|
|
1223
|
+
result = rendered(await applyInit(view, { packageRoot: host.packageRoot, signal: host.signal, project }));
|
|
1224
1224
|
}
|
|
1225
1225
|
finally {
|
|
1226
1226
|
// Once the descriptor, the completion point, is written, the target is initialized whatever an effect after it
|
|
@@ -1228,6 +1228,77 @@ async function initialize(context, root, id) {
|
|
|
1228
1228
|
if (existsSync(resolve(root, DESCRIPTOR_PATH)))
|
|
1229
1229
|
clearDecline(host.env, root);
|
|
1230
1230
|
}
|
|
1231
|
+
return offerTracking(context, root, result);
|
|
1232
|
+
}
|
|
1233
|
+
/** §2.16's question, asked once the workspace is initialized. */
|
|
1234
|
+
export const trackQuestion = (root) => `Track ${root} in your workspace list? [y/N] `;
|
|
1235
|
+
/**
|
|
1236
|
+
* Contract §2.16: once `--apply` has initialized the target, offer to add it to the IA home's tracked list. On a
|
|
1237
|
+
* terminal without `--yes` it asks, and tracks on yes; otherwise it prints the one `ia workspaces add` line on stderr
|
|
1238
|
+
* and writes nothing. `--json` says nothing, so its stderr stays as empty as its stdout is single. A root already
|
|
1239
|
+
* tracked, or an IA home that cannot hold the list (a malformed variable, a home holding src/, an invalid list), is
|
|
1240
|
+
* passed over in silence. Tracking is the user's own list, so a failure is one stderr line and never init's exit code,
|
|
1241
|
+
* and a signal at the question declines it (`answeredInterruption`).
|
|
1242
|
+
*/
|
|
1243
|
+
async function offerTracking(context, root, result) {
|
|
1244
|
+
const { args, json, host } = context;
|
|
1245
|
+
const home = iaHomeOf(host.env);
|
|
1246
|
+
if (json || home === undefined)
|
|
1247
|
+
return result;
|
|
1248
|
+
let real;
|
|
1249
|
+
try {
|
|
1250
|
+
assertIaHomeUsable(home);
|
|
1251
|
+
real = realpathSync(root);
|
|
1252
|
+
if (trackedRow(readTracked(home), real) !== undefined)
|
|
1253
|
+
return result;
|
|
1254
|
+
}
|
|
1255
|
+
catch {
|
|
1256
|
+
return result;
|
|
1257
|
+
}
|
|
1258
|
+
const said = (line) => ({ ...result, stderr: `${result.stderr}${line}\n` });
|
|
1259
|
+
// apps/cli/SPEC.md: a root a shell would act on is never printed in a suggested command.
|
|
1260
|
+
const hint = () => {
|
|
1261
|
+
const path = commandPath(real);
|
|
1262
|
+
return said(path !== undefined
|
|
1263
|
+
? `Track it with: ia workspaces add ${path}`
|
|
1264
|
+
: `Track it from the workspace root with: ia workspaces add . (${PATH_OMITTED})`);
|
|
1265
|
+
};
|
|
1266
|
+
// `--yes` answered init's one question; it never stands for a second one, so a --yes run is shown the command.
|
|
1267
|
+
if (!host.interaction.interactive || args.flag('yes'))
|
|
1268
|
+
return hint();
|
|
1269
|
+
// A signal that came before the question is not an answer to it, so §3's interruption stands.
|
|
1270
|
+
if (host.signal?.aborted)
|
|
1271
|
+
return result;
|
|
1272
|
+
let yes;
|
|
1273
|
+
try {
|
|
1274
|
+
yes = await confirm(host.interaction, '', trackQuestion(real));
|
|
1275
|
+
}
|
|
1276
|
+
catch {
|
|
1277
|
+
// A question that cannot be read (a closed stdin, a broken terminal) is not a yes, and tracking is never init's
|
|
1278
|
+
// exit code, so it declines with the one line a terminal without a question gets. A signal is handled below.
|
|
1279
|
+
if (!host.signal?.aborted)
|
|
1280
|
+
return hint();
|
|
1281
|
+
yes = false;
|
|
1282
|
+
}
|
|
1283
|
+
// A signal at the question declines it. The workspace is initialized, so init's report and exit code stand, and the
|
|
1284
|
+
// rerun §3 would name refuses as already initialized. The line break ends the question the signal cut short.
|
|
1285
|
+
if (host.signal?.aborted) {
|
|
1286
|
+
host.interaction.write('\n');
|
|
1287
|
+
return answeredInterruption(result);
|
|
1288
|
+
}
|
|
1289
|
+
if (!yes)
|
|
1290
|
+
return result;
|
|
1291
|
+
try {
|
|
1292
|
+
const { row } = await trackWorkspace(home, { root: real }, new Date(), { signal: host.signal });
|
|
1293
|
+
return said(`Tracked ${row.id} in your workspace list.`);
|
|
1294
|
+
}
|
|
1295
|
+
catch (error) {
|
|
1296
|
+
// A signal while the offer waits for the list's lock declines it, as one at the question does.
|
|
1297
|
+
if (host.signal?.aborted)
|
|
1298
|
+
return answeredInterruption(result);
|
|
1299
|
+
const refusal = refusalOf(error);
|
|
1300
|
+
return said(`Not tracked: ${refusal.message}.${refusal.next === null ? '' : ` ${refusal.next}`}`);
|
|
1301
|
+
}
|
|
1231
1302
|
}
|
|
1232
1303
|
/**
|
|
1233
1304
|
* Host registration spec §4 "init --host": the `ia host <host> --apply` path over the workspace just initialized.
|
|
@@ -1355,7 +1426,8 @@ export function collectMigration(request) {
|
|
|
1355
1426
|
let records, admitted;
|
|
1356
1427
|
try {
|
|
1357
1428
|
records = session.reader.records();
|
|
1358
|
-
|
|
1429
|
+
// A canon finding never refuses (Task 13e): `ia validate` is its gate.
|
|
1430
|
+
admitted = !session.admission().findings.some(refusesInstallation);
|
|
1359
1431
|
}
|
|
1360
1432
|
finally {
|
|
1361
1433
|
session.close();
|
|
@@ -1604,14 +1676,15 @@ const MIGRATED = 'The workspace is migrated.';
|
|
|
1604
1676
|
const MIGRATED_CAPTURED = 'The workspace is migrated and captured.';
|
|
1605
1677
|
const MIGRATED_UNCAPTURED = 'The workspace is migrated but not captured.';
|
|
1606
1678
|
/**
|
|
1607
|
-
* The admission step `ia init` and `ia init --migrate` share: zero error findings
|
|
1608
|
-
* the compiled graph holds it at its path, never string-constructed, with every record the
|
|
1679
|
+
* The admission step `ia init` and `ia init --migrate` share: zero error findings but canon ones (Task 13e), then each
|
|
1680
|
+
* planned starter record as the compiled graph holds it at its path, never string-constructed, with every record the
|
|
1681
|
+
* graph holds.
|
|
1609
1682
|
* `done` opens each refusal's next action with what the command completed before it, if anything.
|
|
1610
1683
|
*/
|
|
1611
1684
|
function admitStarter(root, planned, what, done) {
|
|
1612
1685
|
const session = openWorkspaceSession({ root });
|
|
1613
1686
|
try {
|
|
1614
|
-
const errors = session.admission().findings.filter(
|
|
1687
|
+
const errors = session.admission().findings.filter(refusesInstallation);
|
|
1615
1688
|
if (errors.length > 0)
|
|
1616
1689
|
throw new Refusal('IA-CLI-FAILED', `The ${what} workspace failed admission with ${errors.length} error findings; first: ${errors[0].code}`, 3, { path: root }, `${done}Run "ia validate --root ${quote(root)}" for the findings.`);
|
|
1617
1690
|
const records = session.reader.records();
|