@inventarch/cli 1.1.1 → 2.0.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/LANGUAGE.md +2 -2
- package/README.md +17 -4
- package/SPEC.md +51 -7
- package/assets/base/0305ca741b1dfec97ff35fbeb36d4a66a0c9c0614b730fe14fcdac0f1565e28a.ia.tgz +0 -0
- package/assets/base.json +3 -3
- package/assets/host/3d2c8530db8d14755410b17be8228a230d88de96f9dc78f953979d3ca7c6ea62.tgz +0 -0
- package/assets/host.json +4 -4
- package/assets/vocabulary.json +436 -4
- package/dist/bundled-base.d.ts +18 -0
- package/dist/bundled-base.d.ts.map +1 -0
- package/dist/bundled-base.js +44 -0
- package/dist/bundled-base.js.map +1 -0
- package/dist/capture.d.ts +108 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +346 -0
- package/dist/capture.js.map +1 -0
- package/dist/claude-cli.js +1 -1
- package/dist/claude-cli.js.map +1 -1
- package/dist/commands.d.ts +23 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +201 -10
- package/dist/commands.js.map +1 -1
- package/dist/compile.d.ts +5 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +40 -51
- package/dist/compile.js.map +1 -1
- package/dist/consumer.d.ts +48 -7
- package/dist/consumer.d.ts.map +1 -1
- package/dist/consumer.js +142 -29
- package/dist/consumer.js.map +1 -1
- package/dist/decline.d.ts.map +1 -1
- package/dist/decline.js +15 -7
- package/dist/decline.js.map +1 -1
- package/dist/distribute.d.ts +68 -16
- package/dist/distribute.d.ts.map +1 -1
- package/dist/distribute.js +243 -110
- package/dist/distribute.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +113 -60
- package/dist/doctor.js.map +1 -1
- package/dist/format.d.ts +2 -2
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +19 -11
- package/dist/format.js.map +1 -1
- package/dist/home-remedy.d.ts +8 -4
- package/dist/home-remedy.d.ts.map +1 -1
- package/dist/home-remedy.js +8 -4
- package/dist/home-remedy.js.map +1 -1
- package/dist/host-projection.d.ts +73 -6
- package/dist/host-projection.d.ts.map +1 -1
- package/dist/host-projection.js +296 -38
- package/dist/host-projection.js.map +1 -1
- package/dist/host.d.ts +106 -30
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +270 -139
- package/dist/host.js.map +1 -1
- package/dist/init.d.ts +285 -37
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +1270 -205
- package/dist/init.js.map +1 -1
- package/dist/inspect.d.ts +26 -2
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +117 -52
- package/dist/inspect.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/migration-journal.d.ts +35 -0
- package/dist/migration-journal.d.ts.map +1 -0
- package/dist/migration-journal.js +205 -0
- package/dist/migration-journal.js.map +1 -0
- package/dist/next.d.ts +21 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +210 -0
- package/dist/next.js.map +1 -0
- package/dist/operation-help.d.ts.map +1 -1
- package/dist/operation-help.js +14 -3
- package/dist/operation-help.js.map +1 -1
- package/dist/pack.d.ts +3 -1
- package/dist/pack.d.ts.map +1 -1
- package/dist/pack.js +56 -11
- package/dist/pack.js.map +1 -1
- package/dist/position.d.ts +22 -0
- package/dist/position.d.ts.map +1 -0
- package/dist/position.js +242 -0
- package/dist/position.js.map +1 -0
- package/dist/project.d.ts +42 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +232 -0
- package/dist/project.js.map +1 -0
- package/dist/read.d.ts +31 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +152 -0
- package/dist/read.js.map +1 -0
- package/dist/render.d.ts +19 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +44 -1
- package/dist/render.js.map +1 -1
- package/dist/session.d.ts +12 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +68 -6
- package/dist/session.js.map +1 -1
- package/dist/user-host.d.ts.map +1 -1
- package/dist/user-host.js +7 -5
- package/dist/user-host.js.map +1 -1
- package/dist/validate.d.ts +1 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +6 -27
- package/dist/validate.js.map +1 -1
- package/dist/vocabulary.d.ts +4 -0
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +12 -7
- package/dist/vocabulary.js.map +1 -1
- package/package.json +6 -6
- package/assets/base/78bff5eb3188b628c06d2f1cf1477fb1bfcea874ec3863ae112b4972b8e81517.ia.tgz +0 -0
- package/assets/host/b97e367bbf15db09f552d6bd6dd3701210efe77931d34b57ccb85240957aba61.tgz +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const PIN_PATH = "assets/base.json";
|
|
2
|
+
export declare const baseArchivePath: (digest: string) => string;
|
|
3
|
+
export declare const PACKAGE_ID: RegExp;
|
|
4
|
+
export declare const DAMAGED = "The ia installation is damaged; run \"ia doctor\" for its install channel and reinstall @inventarch/cli through it.";
|
|
5
|
+
export interface BasePin {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly version: string;
|
|
8
|
+
readonly archive: string;
|
|
9
|
+
readonly manifest: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Base {
|
|
12
|
+
readonly pin: BasePin;
|
|
13
|
+
readonly bytes: Buffer;
|
|
14
|
+
/** The systems the bundled manifest carries, sorted, which the starter composes and the descriptor externalizes. */
|
|
15
|
+
readonly systems: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function readBase(packageRoot: string): Base;
|
|
18
|
+
//# sourceMappingURL=bundled-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-base.d.ts","sourceRoot":"","sources":["../src/bundled-base.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,qBAAqB,CAAC;AAC3C,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAwC,CAAC;AAC1F,eAAO,MAAM,UAAU,QAAwC,CAAC;AAChE,eAAO,MAAM,OAAO,wHACiG,CAAC;AACtH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AACD,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oHAAoH;IACpH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AACD,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAmDlD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Exact packaged base acquisition shared by init, migration and restore. */
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { verifyArchive } from '@inventarch/distribution/archive';
|
|
5
|
+
import { Refusal } from './consumer.js';
|
|
6
|
+
import { codeOf } from './session.js';
|
|
7
|
+
export const PIN_PATH = 'assets/base.json';
|
|
8
|
+
export const baseArchivePath = (digest) => `assets/base/${digest}.ia.tgz`;
|
|
9
|
+
export const PACKAGE_ID = /^[a-z][a-z0-9.-]*\/[a-z][a-z0-9-]*$/;
|
|
10
|
+
export const DAMAGED = 'The ia installation is damaged; run "ia doctor" for its install channel and reinstall @inventarch/cli through it.';
|
|
11
|
+
export function readBase(packageRoot) {
|
|
12
|
+
const pinPath = resolve(packageRoot, PIN_PATH);
|
|
13
|
+
let pin;
|
|
14
|
+
try {
|
|
15
|
+
const value = JSON.parse(readFileSync(pinPath, 'utf8'));
|
|
16
|
+
const keys = Object.keys(value).sort().join(',');
|
|
17
|
+
if (keys !== 'archive,id,manifest,version' ||
|
|
18
|
+
!Object.values(value).every((item) => typeof item === 'string') ||
|
|
19
|
+
!PACKAGE_ID.test(String(value['id'])))
|
|
20
|
+
throw new Error('unexpected fields');
|
|
21
|
+
if (!/^[a-f0-9]{64}$/.test(String(value['archive'])) || !/^[a-f0-9]{64}$/.test(String(value['manifest'])))
|
|
22
|
+
throw new Error('malformed digest');
|
|
23
|
+
pin = value;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw new Refusal('IA-CLI-FAILED', `The bundled base package pin cannot be read: ${error instanceof Error ? error.message : String(error)}`, 3, { path: pinPath }, DAMAGED);
|
|
27
|
+
}
|
|
28
|
+
const archivePath = resolve(packageRoot, baseArchivePath(pin.archive));
|
|
29
|
+
const bytes = existsSync(archivePath) ? readFileSync(archivePath) : Buffer.alloc(0);
|
|
30
|
+
try {
|
|
31
|
+
const verified = verifyArchive(bytes, pin.archive);
|
|
32
|
+
if (verified.manifestDigest !== pin.manifest ||
|
|
33
|
+
verified.manifest.id !== pin.id ||
|
|
34
|
+
verified.manifest.version !== pin.version)
|
|
35
|
+
throw new Refusal('IA-CLI-FAILED', 'The bundled base archive does not carry the pinned manifest', 3, { path: archivePath }, DAMAGED);
|
|
36
|
+
return { pin, bytes, systems: verified.manifest.systems.map((system) => system.name) };
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error instanceof Refusal)
|
|
40
|
+
throw error;
|
|
41
|
+
throw new Refusal(codeOf(error, 'IA-CLI-FAILED'), error instanceof Error ? error.message : String(error), 3, { path: archivePath }, DAMAGED);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=bundled-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-base.js","sourceRoot":"","sources":["../src/bundled-base.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE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IACzF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,OAAO;YAAE,MAAM,KAAK,CAAC;QAC1C,MAAM,IAAI,OAAO,CACf,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,EAC9B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,CAAC,EACD,EAAE,IAAI,EAAE,WAAW,EAAE,EACrB,OAAO,CACR,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { CapturePlan, CaptureWrite, MembershipRow, Snapshot } from '@inventarch/db';
|
|
2
|
+
import type { Context, Result } from './consumer.js';
|
|
3
|
+
import type { Capabilities } from './render.js';
|
|
4
|
+
import type { Session } from './session.js';
|
|
5
|
+
type Admission = ReturnType<Session['admission']>;
|
|
6
|
+
type Finding = Admission['findings'][number];
|
|
7
|
+
export declare const SNAPSHOT_FORMAT = "ia-snapshot-1";
|
|
8
|
+
export declare const SNAPSHOT_DIRECTORY = ".ia/work/snapshot";
|
|
9
|
+
export declare const CURRENT = ".ia/work/snapshot/current.json";
|
|
10
|
+
export declare const PREVIOUS = ".ia/work/snapshot/previous.json";
|
|
11
|
+
export interface SnapshotCounts {
|
|
12
|
+
readonly records: number;
|
|
13
|
+
readonly errors: number;
|
|
14
|
+
readonly warnings: number;
|
|
15
|
+
readonly notEvaluated: number;
|
|
16
|
+
}
|
|
17
|
+
/** The `ia-snapshot-1` document a capture writes to `current.json`. */
|
|
18
|
+
export interface SnapshotDocument {
|
|
19
|
+
readonly format: typeof SNAPSHOT_FORMAT;
|
|
20
|
+
readonly language: string;
|
|
21
|
+
readonly kernelDigest: string;
|
|
22
|
+
readonly revision: string;
|
|
23
|
+
readonly records: Snapshot['records'];
|
|
24
|
+
readonly membership: readonly MembershipRow[];
|
|
25
|
+
readonly diagnostics: readonly Finding[];
|
|
26
|
+
readonly counts: SnapshotCounts;
|
|
27
|
+
}
|
|
28
|
+
/** A capture written: the document and its bytes, with db D08a's comparison and rotation (`CaptureWrite`). */
|
|
29
|
+
export interface CaptureView extends CaptureWrite {
|
|
30
|
+
readonly root: string;
|
|
31
|
+
readonly snapshot: SnapshotDocument;
|
|
32
|
+
readonly status: Admission['status'];
|
|
33
|
+
/** The exact bytes written to `current.json`, so the file and the reported digest cannot disagree. */
|
|
34
|
+
readonly text: string;
|
|
35
|
+
readonly digest: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A capture previewed: the document a capture would write and db D08b's plan of it (`CapturePlan`), the identities its
|
|
39
|
+
* counts count included. `text` and `digest` are the bytes the capture would write; nothing is written.
|
|
40
|
+
*/
|
|
41
|
+
export interface CapturePreview extends CaptureView, CapturePlan {
|
|
42
|
+
readonly preview: true;
|
|
43
|
+
/** The capture that writes what this preview reports, with `--root` as given. */
|
|
44
|
+
readonly capture: string;
|
|
45
|
+
}
|
|
46
|
+
/** The ordering the compliance layer already applies, reused rather than reinvented. */
|
|
47
|
+
export declare const orderFindings: (findings: readonly Finding[]) => readonly Finding[];
|
|
48
|
+
export declare const findingCounts: (records: number, findings: readonly Finding[]) => SnapshotCounts;
|
|
49
|
+
/** The admitted root snapshot as `ia-snapshot-1`: records and membership rows sorted by identity, findings ordered. */
|
|
50
|
+
export declare function buildSnapshot(session: Session): Pick<CaptureView, 'snapshot' | 'status' | 'text' | 'digest'>;
|
|
51
|
+
/**
|
|
52
|
+
* The language's syntax diagnostics: the codes its scanner and parser emit, which language SPEC S03 calls parser-owned.
|
|
53
|
+
* A source with one fails to parse. Every other language code is a registration, compilation or resolution result
|
|
54
|
+
* over sources that parsed (a keyword two systems register, a schema or system a registration lacks, an unresolved or
|
|
55
|
+
* unconsented row, a colliding identity), which position-and-projection §5 keeps as a finding, never a refusal.
|
|
56
|
+
* tests/capture.test.ts holds this set to the codes packages/language/src/scanner and parser spell.
|
|
57
|
+
*/
|
|
58
|
+
export declare const SYNTAX_CODES: ReadonlySet<string>;
|
|
59
|
+
/** §5: the first error by which a floor or seed input fails to parse, or undefined when every one parsed. */
|
|
60
|
+
export declare const unparsedSeed: (diagnostics: readonly Finding[]) => Finding | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Admits the workspace at `root` and writes its snapshot pair through db D08a, unless one of §5's two refusals answers
|
|
63
|
+
* first. `given` is the `--root` the invocation typed, which the `ia validate` a refusal names carries.
|
|
64
|
+
*/
|
|
65
|
+
export declare function collectCapture(root: string, given?: string): CaptureView;
|
|
66
|
+
/**
|
|
67
|
+
* `ia capture --preview`: admits and refuses exactly as `collectCapture` does, then plans the write through db D08b's
|
|
68
|
+
* `planCapture` instead of making it, so nothing is created or written and the pair stays as it was.
|
|
69
|
+
*/
|
|
70
|
+
export declare function previewCapture(root: string, given?: string): CapturePreview;
|
|
71
|
+
/** As `ia compile` does: the snapshot is written even when admission has errors; the exit class carries the verdict. */
|
|
72
|
+
export declare const captureExit: (view: CaptureView) => 0 | 1;
|
|
73
|
+
/** A preview adds `preview: true` and the identities its counts count; a capture's keys are the 1.x ones. */
|
|
74
|
+
export declare function captureEnvelope(view: CaptureView | CapturePreview): unknown;
|
|
75
|
+
/**
|
|
76
|
+
* A capture's report, or a preview's: the same counts and snapshot rows. A preview says it wrote nothing, states the
|
|
77
|
+
* rotation as the one the capture would make, and names every changed, new and removed identity, each list sorted.
|
|
78
|
+
*/
|
|
79
|
+
export declare function renderCapture(view: CaptureView | CapturePreview, caps: Capabilities): string;
|
|
80
|
+
/** What a failed snapshot write names to repair: a file the system would not let it replace, or a directory. */
|
|
81
|
+
export interface WriteRepair {
|
|
82
|
+
readonly path: string;
|
|
83
|
+
readonly kind: 'file' | 'directory';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The system errors a write repair answers: permission, a busy or read-only entry, and an entry of the wrong kind. Any
|
|
87
|
+
* other (a full disk, an I/O error, too many open files) is not the path's to fix, so it takes the generic next.
|
|
88
|
+
*/
|
|
89
|
+
export declare const WRITE_REPAIRABLE: ReadonlySet<string>;
|
|
90
|
+
/**
|
|
91
|
+
* The repair a write failure names. Creating an entry (staging the new bytes, creating the snapshot directory) needs the
|
|
92
|
+
* directory it is created in to be writable, and on POSIX so do renaming and removing one, whatever the file's own mode,
|
|
93
|
+
* so those name that directory. On Windows a rename onto, or a removal of, a read-only or open file fails on the file,
|
|
94
|
+
* so that one names the file, without a staged file's temporary suffix. A path outside the root names the snapshot
|
|
95
|
+
* directory.
|
|
96
|
+
*/
|
|
97
|
+
export declare function writeRepair(root: string, error: unknown, platform?: NodeJS.Platform): WriteRepair;
|
|
98
|
+
/**
|
|
99
|
+
* A capture's failure as this verb refuses it, each repair followed by `rerun`. A refusal from opening the workspace, or
|
|
100
|
+
* one of the capture's own, already names its own repair and is returned as it is. A snapshot path the db does not
|
|
101
|
+
* write through is located and named, and so is a file or directory the system would not let a capture write, which a
|
|
102
|
+
* preview (`writes` false) never writes. Any other failure is returned as it is. `ia init`'s capture effect refuses
|
|
103
|
+
* through this too, so it locates and repairs what `ia capture` would.
|
|
104
|
+
*/
|
|
105
|
+
export declare function captureFailure(error: unknown, root: string, rerun: string, writes?: boolean): unknown;
|
|
106
|
+
export declare function runCapture(context: Context): Result;
|
|
107
|
+
export {};
|
|
108
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEzF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAS,MAAM,aAAa,CAAC;AAcvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,KAAK,SAA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AAgH;AAChH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CACrC;AAKD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAO/C,CAAC;AACH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,WAAW,CAUnH;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,CAsBlG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAcnD"}
|
package/dist/capture.js
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ia capture`: position-and-projection §5's capture effect, design rows 3 and 20.
|
|
3
|
+
*
|
|
4
|
+
* The one verb that records what the workspace admits. It admits the workspace as every workspace verb does and writes
|
|
5
|
+
* the admitted root snapshot to `.ia/work/snapshot/current.json`, an `ia-snapshot-1` document: the language identity,
|
|
6
|
+
* the revision, the admitted records sorted by identity with their graph G13 per-record digests, their db D02a
|
|
7
|
+
* membership rows, the admission findings and their counts. The distribution's `json()` serializer writes it, as it
|
|
8
|
+
* writes `ia.compiled.v1`, so identical sources on one language version capture to identical bytes.
|
|
9
|
+
*
|
|
10
|
+
* The pair is db D08a's, the one retained pair (`writeCapture`): the db writes and rotates it and compares the records
|
|
11
|
+
* with the prior capture by digest, and every db handle seeds its previous snapshot from it, whatever its cache
|
|
12
|
+
* setting, so `previousRevision`, `staleness` and `readiness` answer against what this verb retained.
|
|
13
|
+
*
|
|
14
|
+
* The effect is reported apart from validation. Its counts compare each record's digest with the prior capture's
|
|
15
|
+
* `current.json`, so a capture with no edit since the last one reports nothing changed. The admission findings are
|
|
16
|
+
* written into the snapshot and counted in the report, and an error makes the exit class 1. Two cases refuse before
|
|
17
|
+
* anything is written, as §5 and §11 have it, so both files stay as they were: a root with no `@workspace` of its own,
|
|
18
|
+
* and a floor or seed input (the floor, an installed or an adopted source) that fails to parse. Every other finding there
|
|
19
|
+
* (unresolved references, colliding identities, unconsented rows, a keyword two systems register) stays a finding, as it
|
|
20
|
+
* does in a source the workspace authors.
|
|
21
|
+
*
|
|
22
|
+
* `--preview` (decision capture-preview-placement) admits and refuses as a capture does, then reports what the capture
|
|
23
|
+
* would write through db D08b's `planCapture` (the counts, the rotation and the changed, new and removed identities)
|
|
24
|
+
* and writes nothing, so the retained previous snapshot that readiness compares against is not spent.
|
|
25
|
+
*/
|
|
26
|
+
import { existsSync } from 'node:fs';
|
|
27
|
+
import { isAbsolute, posix, relative, resolve } from 'node:path';
|
|
28
|
+
import { CAPTURE_CURRENT, CAPTURE_DIRECTORY, CAPTURE_FORMAT, CAPTURE_PREVIOUS, planCapture, writeCapture, } from '@inventarch/db';
|
|
29
|
+
import { json, LANGUAGE_IDENTITY, sha256 } from '@inventarch/distribution/services';
|
|
30
|
+
import { Refusal, requireRoot, respell } from './consumer.js';
|
|
31
|
+
import { atom, commandFacts, document, entry, headerLine, quote, sectionLabel, terminalText, truncateDigest, words, } from './render.js';
|
|
32
|
+
import { codeOf, openSession } from './session.js';
|
|
33
|
+
import { NOT_EVALUATED } from './validate.js';
|
|
34
|
+
export const SNAPSHOT_FORMAT = CAPTURE_FORMAT;
|
|
35
|
+
export const SNAPSHOT_DIRECTORY = CAPTURE_DIRECTORY;
|
|
36
|
+
export const CURRENT = CAPTURE_CURRENT;
|
|
37
|
+
export const PREVIOUS = CAPTURE_PREVIOUS;
|
|
38
|
+
const compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
39
|
+
/** The ordering the compliance layer already applies, reused rather than reinvented. */
|
|
40
|
+
export const orderFindings = (findings) => [...findings].sort((a, b) => compare(a.path, b.path) || a.line - b.line || compare(a.code, b.code) || compare(a.message, b.message));
|
|
41
|
+
export const findingCounts = (records, findings) => ({
|
|
42
|
+
records,
|
|
43
|
+
errors: findings.filter((finding) => finding.severity === 'error').length,
|
|
44
|
+
warnings: findings.filter((finding) => finding.severity === 'warning').length,
|
|
45
|
+
notEvaluated: findings.filter((finding) => NOT_EVALUATED.has(finding.code)).length,
|
|
46
|
+
});
|
|
47
|
+
/** The admitted root snapshot as `ia-snapshot-1`: records and membership rows sorted by identity, findings ordered. */
|
|
48
|
+
export function buildSnapshot(session) {
|
|
49
|
+
// The finding set `ia validate` reports (the distribution's one validation service), inert declarations included.
|
|
50
|
+
const admission = session.validation(), admitted = session.reader.snapshot();
|
|
51
|
+
const records = [...admitted.records].sort((a, b) => compare(a.identity, b.identity));
|
|
52
|
+
const membership = [...admitted.membership].sort((a, b) => compare(a.identity, b.identity));
|
|
53
|
+
const diagnostics = orderFindings(admission.findings);
|
|
54
|
+
const snapshot = {
|
|
55
|
+
format: SNAPSHOT_FORMAT,
|
|
56
|
+
language: LANGUAGE_IDENTITY.language,
|
|
57
|
+
kernelDigest: LANGUAGE_IDENTITY.kernelDigest,
|
|
58
|
+
revision: admitted.revision,
|
|
59
|
+
records,
|
|
60
|
+
membership,
|
|
61
|
+
diagnostics,
|
|
62
|
+
counts: findingCounts(records.length, diagnostics),
|
|
63
|
+
};
|
|
64
|
+
const text = json(snapshot);
|
|
65
|
+
return { snapshot, status: admission.status, text, digest: sha256(text) };
|
|
66
|
+
}
|
|
67
|
+
/** Sources the workspace does not author: the floor, an installed package's and an adopted mount's. */
|
|
68
|
+
const SEEDED = ['.ia/src/floor/', '.ia/distributions/', '.ia/adopted/'];
|
|
69
|
+
/**
|
|
70
|
+
* The language's syntax diagnostics: the codes its scanner and parser emit, which language SPEC S03 calls parser-owned.
|
|
71
|
+
* A source with one fails to parse. Every other language code is a registration, compilation or resolution result
|
|
72
|
+
* over sources that parsed (a keyword two systems register, a schema or system a registration lacks, an unresolved or
|
|
73
|
+
* unconsented row, a colliding identity), which position-and-projection §5 keeps as a finding, never a refusal.
|
|
74
|
+
* tests/capture.test.ts holds this set to the codes packages/language/src/scanner and parser spell.
|
|
75
|
+
*/
|
|
76
|
+
export const SYNTAX_CODES = new Set([
|
|
77
|
+
'IA-LANG-PRAGMA-MISSING',
|
|
78
|
+
'IA-LANG-VERSION-UNSUPPORTED',
|
|
79
|
+
'IA-LANG-INDENT-TAB',
|
|
80
|
+
'IA-LANG-INDENT-STEP',
|
|
81
|
+
'IA-LANG-STRING-UNTERMINATED',
|
|
82
|
+
'IA-LANG-PROSE-TRAILING',
|
|
83
|
+
'IA-LANG-PROSE-UNTERMINATED',
|
|
84
|
+
'IA-LANG-LIST-UNTERMINATED',
|
|
85
|
+
'IA-LANG-LIST-MALFORMED',
|
|
86
|
+
'IA-LANG-HEADER-MALFORMED',
|
|
87
|
+
'IA-LANG-HEAD-FIELD-AFTER-SECTION',
|
|
88
|
+
'IA-LANG-TOPLEVEL-UNEXPECTED',
|
|
89
|
+
'IA-LANG-VALUE-TRAILING',
|
|
90
|
+
'IA-LANG-REF-MALFORMED',
|
|
91
|
+
'IA-LANG-FIELD-KEY-MISSING',
|
|
92
|
+
]);
|
|
93
|
+
/** §5: the first error by which a floor or seed input fails to parse, or undefined when every one parsed. */
|
|
94
|
+
export const unparsedSeed = (diagnostics) => diagnostics.find((finding) => finding.severity === 'error' &&
|
|
95
|
+
SYNTAX_CODES.has(finding.code) &&
|
|
96
|
+
SEEDED.some((prefix) => finding.path.startsWith(prefix)));
|
|
97
|
+
/** Admits the workspace at `root` and builds its snapshot; the session is closed before anything is written. */
|
|
98
|
+
function admit(root) {
|
|
99
|
+
const session = openSession(root);
|
|
100
|
+
try {
|
|
101
|
+
const own = (path) => path.startsWith('.ia/src/') && !path.startsWith('.ia/src/floor/');
|
|
102
|
+
const declared = session.reader.records().some((record) => record.discriminator === 'workspace' && own(record.source.path)) ||
|
|
103
|
+
session.reader.refused.some((record) => record.identity.split('/')[2] === 'workspace' && own(record.path));
|
|
104
|
+
return { ...buildSnapshot(session), declared };
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
session.close();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Position-and-projection §5 and §11: the two cases a capture refuses, before anything is written, so the previous
|
|
112
|
+
* snapshot is kept. A floor or seed input that fails to parse would drop its records from the snapshot, so it refuses
|
|
113
|
+
* first and names `ia validate`; a root whose own `.ia/src` holds no `@workspace` is not a workspace to capture and
|
|
114
|
+
* names `ia init`, unless its own sources have errors, which may be why none is read. Any other finding in a floor or
|
|
115
|
+
* seed input is written into the snapshot, as one in a source the workspace authors is.
|
|
116
|
+
*/
|
|
117
|
+
function captureRefusal(root, given, admitted) {
|
|
118
|
+
const validate = `ia validate${given === undefined ? '' : ` --root ${quote(given)}`}`;
|
|
119
|
+
const failed = unparsedSeed(admitted.snapshot.diagnostics);
|
|
120
|
+
if (failed !== undefined)
|
|
121
|
+
return new Refusal(failed.code, `${failed.path} is a floor or seed input that fails to parse, so nothing was captured and the previous snapshot is kept: ${failed.message}`, 3, { path: failed.path, line: failed.line }, `Run "${validate}" for the located findings, repair the input, then capture again.`);
|
|
122
|
+
if (admitted.declared)
|
|
123
|
+
return null;
|
|
124
|
+
const errors = admitted.snapshot.diagnostics.some((finding) => finding.severity === 'error' && finding.path.startsWith('.ia/src/'));
|
|
125
|
+
return new Refusal('IA-DB-ROOT-INVALID', `No @workspace record is declared in ${resolve(root, '.ia/src')}, so ${root} is not a workspace to capture; nothing was written`, 3, { path: root }, errors
|
|
126
|
+
? `Run "${validate}" for the findings that may keep its @workspace from being read.`
|
|
127
|
+
: existsSync(resolve(root, '.ia/release.json'))
|
|
128
|
+
? `Restore the authored @workspace source under .ia/src from source control, then run "ia position --root ${quote(root)}" to inspect this initialized workspace.`
|
|
129
|
+
: `Run "ia init ${quote(root)}" to see what a new workspace there would contain.`);
|
|
130
|
+
}
|
|
131
|
+
/** Admits the workspace at `root` and builds the snapshot to write, unless one of §5's two refusals answers first. */
|
|
132
|
+
function capturable(root, given) {
|
|
133
|
+
const admitted = admit(root);
|
|
134
|
+
const refused = captureRefusal(root, given, admitted);
|
|
135
|
+
if (refused !== null)
|
|
136
|
+
throw refused;
|
|
137
|
+
const { declared: _declared, ...built } = admitted;
|
|
138
|
+
return built;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Admits the workspace at `root` and writes its snapshot pair through db D08a, unless one of §5's two refusals answers
|
|
142
|
+
* first. `given` is the `--root` the invocation typed, which the `ia validate` a refusal names carries.
|
|
143
|
+
*/
|
|
144
|
+
export function collectCapture(root, given) {
|
|
145
|
+
const built = capturable(root, given);
|
|
146
|
+
return { root, ...built, ...writeCapture(root, built.text) };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* `ia capture --preview`: admits and refuses exactly as `collectCapture` does, then plans the write through db D08b's
|
|
150
|
+
* `planCapture` instead of making it, so nothing is created or written and the pair stays as it was.
|
|
151
|
+
*/
|
|
152
|
+
export function previewCapture(root, given) {
|
|
153
|
+
const built = capturable(root, given);
|
|
154
|
+
return {
|
|
155
|
+
root,
|
|
156
|
+
...built,
|
|
157
|
+
...planCapture(root, built.text),
|
|
158
|
+
preview: true,
|
|
159
|
+
capture: `ia capture${given === undefined ? '' : ` --root ${quote(given)}`}`,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** As `ia compile` does: the snapshot is written even when admission has errors; the exit class carries the verdict. */
|
|
163
|
+
export const captureExit = (view) => (view.snapshot.counts.errors === 0 ? 0 : 1);
|
|
164
|
+
/** A preview adds `preview: true` and the identities its counts count; a capture's keys are the 1.x ones. */
|
|
165
|
+
export function captureEnvelope(view) {
|
|
166
|
+
const { counts, revision } = view.snapshot;
|
|
167
|
+
return {
|
|
168
|
+
version: 1,
|
|
169
|
+
...('preview' in view ? { preview: true } : {}),
|
|
170
|
+
snapshot: resolve(view.root, CURRENT),
|
|
171
|
+
format: SNAPSHOT_FORMAT,
|
|
172
|
+
revision,
|
|
173
|
+
digest: view.digest,
|
|
174
|
+
records: counts.records,
|
|
175
|
+
changed: view.changed,
|
|
176
|
+
unchanged: view.unchanged,
|
|
177
|
+
new: view.added,
|
|
178
|
+
removed: view.removed,
|
|
179
|
+
prior: view.prior,
|
|
180
|
+
ignored: view.ignored,
|
|
181
|
+
previous: view.previous === null ? null : { path: resolve(view.root, PREVIOUS), revision: view.previous },
|
|
182
|
+
rotated: view.rotated,
|
|
183
|
+
...('preview' in view
|
|
184
|
+
? {
|
|
185
|
+
identities: {
|
|
186
|
+
changed: view.identities.changed,
|
|
187
|
+
new: view.identities.added,
|
|
188
|
+
removed: view.identities.removed,
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
: {}),
|
|
192
|
+
admission: {
|
|
193
|
+
status: view.status,
|
|
194
|
+
errors: counts.errors,
|
|
195
|
+
warnings: counts.warnings,
|
|
196
|
+
notEvaluated: counts.notEvaluated,
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* A capture's report, or a preview's: the same counts and snapshot rows. A preview says it wrote nothing, states the
|
|
202
|
+
* rotation as the one the capture would make, and names every changed, new and removed identity, each list sorted.
|
|
203
|
+
*/
|
|
204
|
+
export function renderCapture(view, caps) {
|
|
205
|
+
const { counts, revision } = view.snapshot;
|
|
206
|
+
const preview = 'preview' in view ? view : null;
|
|
207
|
+
const digest = (value) => truncateDigest(value, caps.ascii);
|
|
208
|
+
const effect = [
|
|
209
|
+
words(`${preview === null ? 'Captured' : 'Would capture'} ${counts.records} records.`),
|
|
210
|
+
words(view.prior === null
|
|
211
|
+
? `No prior capture to compare with${view.ignored === null ? '' : ` (the existing current.json ${view.ignored})`}, so every record is new.`
|
|
212
|
+
: `Since the capture at revision ${digest(view.prior)}: ${view.changed} changed, ${view.unchanged} unchanged, ${view.added} new, ${view.removed} removed.`),
|
|
213
|
+
];
|
|
214
|
+
const previous = view.previous === null
|
|
215
|
+
? [words(`No earlier capture at another revision ${preview === null ? 'is' : 'would be'} retained.`, 'dim')]
|
|
216
|
+
: [
|
|
217
|
+
[atom(PREVIOUS, 'cyan', 0)],
|
|
218
|
+
words(preview === null
|
|
219
|
+
? `revision ${digest(view.previous)}, ${view.rotated ? 'moved from current.json because the revision changed' : 'kept because the revision did not change'}`
|
|
220
|
+
: `revision ${digest(view.previous)}, ${view.rotated ? 'would move from current.json because the revision changed' : 'would be kept because the revision did not change'}`, 'dim'),
|
|
221
|
+
];
|
|
222
|
+
const admission = [
|
|
223
|
+
words(`${counts.errors} errors, ${counts.warnings} warnings, ${counts.notEvaluated} not evaluated.`),
|
|
224
|
+
];
|
|
225
|
+
if (counts.notEvaluated > 0)
|
|
226
|
+
admission.push(words(`${counts.notEvaluated} checks had no evaluator, so the snapshot ${preview === null ? 'records' : 'would record'} a not-evaluated result rather than a pass.`));
|
|
227
|
+
// A preview names every identity its counts count, which the counts already bound. A removed one is read from the
|
|
228
|
+
// current.json on disk, which only its shape is checked against, so each is escaped as source-derived text is.
|
|
229
|
+
const identities = preview === null
|
|
230
|
+
? []
|
|
231
|
+
: [
|
|
232
|
+
['Changed', 'updated', preview.identities.changed],
|
|
233
|
+
['New', 'added', preview.identities.added],
|
|
234
|
+
['Removed', 'removed', preview.identities.removed],
|
|
235
|
+
].map(([label, symbol, named]) => named.length === 0
|
|
236
|
+
? []
|
|
237
|
+
: [
|
|
238
|
+
sectionLabel(label, caps),
|
|
239
|
+
...named.flatMap((identity) => entry([[atom(terminalText(identity), null, 0)]], { depth: 1, symbol }, caps)),
|
|
240
|
+
]);
|
|
241
|
+
const footer = preview === null
|
|
242
|
+
? [
|
|
243
|
+
words(counts.errors > 0
|
|
244
|
+
? 'The snapshot records these findings. Run "ia validate" for their locations, fix them, then capture again.'
|
|
245
|
+
: 'Identical sources on one language version capture identically, so a capture after no edit reports 0 changed.'),
|
|
246
|
+
]
|
|
247
|
+
: counts.errors > 0
|
|
248
|
+
? [
|
|
249
|
+
words('The snapshot would record these findings. Run "ia validate" for their locations, fix them, then capture.'),
|
|
250
|
+
]
|
|
251
|
+
: commandFacts('Write this snapshot with "', preview.capture, '".', 3, caps);
|
|
252
|
+
return document([
|
|
253
|
+
preview === null
|
|
254
|
+
? headerLine('Capture', SNAPSHOT_FORMAT, [{ text: `revision ${digest(revision)}`, column: 50 }], caps)
|
|
255
|
+
: headerLine('Plan', `capture ${SNAPSHOT_FORMAT}`, [{ text: `revision ${digest(revision)}`, column: 50 }], caps),
|
|
256
|
+
...(preview === null ? [] : [entry([words('This is a preview. Nothing has been written.')], { depth: 1 }, caps)]),
|
|
257
|
+
// The write succeeded either way; an admission error marks what it holds. A preview wrote nothing to mark.
|
|
258
|
+
entry(effect, { depth: 1, symbol: preview !== null ? 'info' : counts.errors === 0 ? 'success' : 'warning' }, caps),
|
|
259
|
+
[
|
|
260
|
+
sectionLabel('Snapshot', caps),
|
|
261
|
+
...entry([
|
|
262
|
+
[atom(CURRENT, 'cyan', 0)],
|
|
263
|
+
[
|
|
264
|
+
atom(`sha256 ${digest(view.digest)}`, null, 0),
|
|
265
|
+
...words(`${Buffer.byteLength(view.text)} bytes`, 'dim', 2),
|
|
266
|
+
],
|
|
267
|
+
], { depth: 1, symbol: 'info' }, caps),
|
|
268
|
+
...entry(previous, { depth: 1, symbol: 'info' }, caps),
|
|
269
|
+
],
|
|
270
|
+
...identities,
|
|
271
|
+
[
|
|
272
|
+
sectionLabel('Admission', caps),
|
|
273
|
+
...entry(admission, { depth: 1, symbol: counts.errors === 0 ? 'success' : 'error' }, caps),
|
|
274
|
+
],
|
|
275
|
+
entry(footer, { depth: 0, symbol: 'step' }, caps),
|
|
276
|
+
], { leadingBlank: true });
|
|
277
|
+
}
|
|
278
|
+
const property = (error, key) => {
|
|
279
|
+
const value = error !== null && typeof error === 'object' ? error[key] : undefined;
|
|
280
|
+
return typeof value === 'string' ? value : undefined;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* The system errors a write repair answers: permission, a busy or read-only entry, and an entry of the wrong kind. Any
|
|
284
|
+
* other (a full disk, an I/O error, too many open files) is not the path's to fix, so it takes the generic next.
|
|
285
|
+
*/
|
|
286
|
+
export const WRITE_REPAIRABLE = new Set([
|
|
287
|
+
'EACCES',
|
|
288
|
+
'EPERM',
|
|
289
|
+
'EBUSY',
|
|
290
|
+
'EROFS',
|
|
291
|
+
'ENOTDIR',
|
|
292
|
+
'EEXIST',
|
|
293
|
+
]);
|
|
294
|
+
/**
|
|
295
|
+
* The repair a write failure names. Creating an entry (staging the new bytes, creating the snapshot directory) needs the
|
|
296
|
+
* directory it is created in to be writable, and on POSIX so do renaming and removing one, whatever the file's own mode,
|
|
297
|
+
* so those name that directory. On Windows a rename onto, or a removal of, a read-only or open file fails on the file,
|
|
298
|
+
* so that one names the file, without a staged file's temporary suffix. A path outside the root names the snapshot
|
|
299
|
+
* directory.
|
|
300
|
+
*/
|
|
301
|
+
export function writeRepair(root, error, platform = process.platform) {
|
|
302
|
+
const path = property(error, 'path');
|
|
303
|
+
const local = path === undefined ? '' : relative(root, path).replaceAll('\\', '/');
|
|
304
|
+
if (local === '' || local.startsWith('..') || isAbsolute(local))
|
|
305
|
+
return { path: SNAPSHOT_DIRECTORY, kind: 'directory' };
|
|
306
|
+
const syscall = property(error, 'syscall'), code = property(error, 'code');
|
|
307
|
+
if (syscall === 'open' || syscall === 'mkdir' || code === 'EEXIST' || code === 'ENOTDIR' || platform !== 'win32')
|
|
308
|
+
return { path: posix.dirname(local), kind: 'directory' };
|
|
309
|
+
return { path: local.replace(/\.[0-9a-f-]{36}\.tmp$/, ''), kind: 'file' };
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* A capture's failure as this verb refuses it, each repair followed by `rerun`. A refusal from opening the workspace, or
|
|
313
|
+
* one of the capture's own, already names its own repair and is returned as it is. A snapshot path the db does not
|
|
314
|
+
* write through is located and named, and so is a file or directory the system would not let a capture write, which a
|
|
315
|
+
* preview (`writes` false) never writes. Any other failure is returned as it is. `ia init`'s capture effect refuses
|
|
316
|
+
* through this too, so it locates and repairs what `ia capture` would.
|
|
317
|
+
*/
|
|
318
|
+
export function captureFailure(error, root, rerun, writes = true) {
|
|
319
|
+
if (error instanceof Refusal)
|
|
320
|
+
return error;
|
|
321
|
+
const code = codeOf(error, '');
|
|
322
|
+
if (code === 'IA-DB-PATH-UNSAFE')
|
|
323
|
+
return new Refusal(code, error instanceof Error ? error.message : String(error), 3, { path: property(error, 'path') ?? SNAPSHOT_DIRECTORY }, `Replace or remove the path named above, so ${SNAPSHOT_DIRECTORY} is a plain directory holding plain files, then run "${rerun}".`);
|
|
324
|
+
if (!writes || !WRITE_REPAIRABLE.has(code))
|
|
325
|
+
return error;
|
|
326
|
+
const repair = writeRepair(root, error);
|
|
327
|
+
return new Refusal('IA-CLI-FAILED', error instanceof Error ? error.message : String(error), 3, { path: repair.path }, repair.kind === 'file'
|
|
328
|
+
? `Make ${repair.path} writable, or close what holds it open, then run "${rerun}"; the snapshot pair is as it was.`
|
|
329
|
+
: `Make the directory ${repair.path} writable, then run "${rerun}"; the snapshot pair is as it was.`);
|
|
330
|
+
}
|
|
331
|
+
export function runCapture(context) {
|
|
332
|
+
const { caps, json: machine } = context;
|
|
333
|
+
const root = requireRoot(context), preview = context.args.flag('preview');
|
|
334
|
+
let view;
|
|
335
|
+
try {
|
|
336
|
+
view = (preview ? previewCapture : collectCapture)(root, context.args.value('root'));
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
throw captureFailure(error, root, respell(context), !preview);
|
|
340
|
+
}
|
|
341
|
+
const exitCode = captureExit(view);
|
|
342
|
+
return machine
|
|
343
|
+
? { exitCode, stdout: JSON.stringify(captureEnvelope(view)) + '\n', stderr: '' }
|
|
344
|
+
: { exitCode, stdout: renderCapture(view, caps), stderr: '' };
|
|
345
|
+
}
|
|
346
|
+
//# s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', `claude is reachable only through cmd.exe here (no claude executable on PATH, so an npm claude.cmd shim), and cmd.exe cannot pass ${value} unchanged because it contains % or "`, 3, null, 'Set IA_HOME to a directory whose path has no % or
|
|
76
|
+
throw new Refusal('IA-CLI-HOST-COMMAND-FAILED', `claude is reachable only through cmd.exe here (no claude executable on PATH, so an npm claude.cmd shim), and cmd.exe cannot pass ${value} unchanged because it contains % or "`, 3, null, 'Set IA_HOME to a directory whose path has no % or double quote, or install Claude Code so that claude.exe is on PATH, then run "ia host claude --user" to plan again.');
|
|
77
77
|
return /^[\w\-.:\\/@=+,]+$/.test(value) ? value : `"${value}"`;
|
|
78
78
|
}
|
|
79
79
|
export function claudeRunner(env, dependencies = DEFAULTS) {
|
package/dist/claude-cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-cli.js","sourceRoot":"","sources":["../src/claude-cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5G,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,aAAa,IAAI,kBAAkB,EAAE,CAAC;AAgBlE,mHAAmH;AACnH,SAAS,MAAM,CAAC,MAAoB,EAAE,IAAuB,EAAE,KAA4B;IACzF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,IAAI,CAAC;QACH,MAAM,IAAI,GA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