@inventarch/cli 0.0.0-stage → 1.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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +19 -2
- package/SPEC.md +30 -0
- package/assets/base/71f0665cb1ffc3f3964fc7710528451f635d664bdf4b8c95005ee97c21db5928.ia.tgz +0 -0
- package/assets/base.json +6 -0
- package/assets/host/43a1f8c471141b1f2f46cef4411a9a61c00da1c1aa19d277189ae2423282bfd6.tgz +0 -0
- package/assets/host.json +6 -0
- package/assets/vocabulary.json +3268 -0
- package/dist/args.d.ts +62 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +117 -0
- package/dist/args.js.map +1 -0
- package/dist/briefing.d.ts +76 -0
- package/dist/briefing.d.ts.map +1 -0
- package/dist/briefing.js +105 -0
- package/dist/briefing.js.map +1 -0
- package/dist/channel.d.ts +22 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.js +74 -0
- package/dist/channel.js.map +1 -0
- package/dist/claude-cli.d.ts +35 -0
- package/dist/claude-cli.d.ts.map +1 -0
- package/dist/claude-cli.js +101 -0
- package/dist/claude-cli.js.map +1 -0
- package/dist/commands.d.ts +39 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +436 -0
- package/dist/commands.js.map +1 -0
- package/dist/compile.d.ts +39 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +136 -0
- package/dist/compile.js.map +1 -0
- package/dist/consumer.d.ts +137 -0
- package/dist/consumer.d.ts.map +1 -0
- package/dist/consumer.js +366 -0
- package/dist/consumer.js.map +1 -0
- package/dist/decline.d.ts +7 -0
- package/dist/decline.d.ts.map +1 -0
- package/dist/decline.js +78 -0
- package/dist/decline.js.map +1 -0
- package/dist/distribute.d.ts +163 -0
- package/dist/distribute.d.ts.map +1 -0
- package/dist/distribute.js +664 -0
- package/dist/distribute.js.map +1 -0
- package/dist/doctor-user.d.ts +45 -0
- package/dist/doctor-user.d.ts.map +1 -0
- package/dist/doctor-user.js +193 -0
- package/dist/doctor-user.js.map +1 -0
- package/dist/doctor.d.ts +57 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +754 -0
- package/dist/doctor.js.map +1 -0
- package/dist/format.d.ts +25 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +168 -0
- package/dist/format.js.map +1 -0
- package/dist/home-remedy.d.ts +10 -0
- package/dist/home-remedy.d.ts.map +1 -0
- package/dist/home-remedy.js +26 -0
- package/dist/home-remedy.js.map +1 -0
- package/dist/host-projection.d.ts +11 -0
- package/dist/host-projection.d.ts.map +1 -0
- package/dist/host-projection.js +73 -0
- package/dist/host-projection.js.map +1 -0
- package/dist/host.d.ts +162 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +599 -0
- package/dist/host.js.map +1 -0
- package/dist/init.d.ts +217 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +840 -0
- package/dist/init.js.map +1 -0
- package/dist/inspect.d.ts +32 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +226 -0
- package/dist/inspect.js.map +1 -0
- package/dist/main.d.ts +24 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +215 -0
- package/dist/main.js.map +1 -0
- package/dist/operation-help.d.ts +14 -0
- package/dist/operation-help.d.ts.map +1 -0
- package/dist/operation-help.js +75 -0
- package/dist/operation-help.js.map +1 -0
- package/dist/pack.d.ts +17 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +121 -0
- package/dist/pack.js.map +1 -0
- package/dist/render.d.ts +165 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +277 -0
- package/dist/render.js.map +1 -0
- package/dist/session.d.ts +13 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +25 -0
- package/dist/session.js.map +1 -0
- package/dist/user-host.d.ts +59 -0
- package/dist/user-host.d.ts.map +1 -0
- package/dist/user-host.js +228 -0
- package/dist/user-host.js.map +1 -0
- package/dist/validate.d.ts +53 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +220 -0
- package/dist/validate.js.map +1 -0
- package/dist/vocabulary.d.ts +55 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +179 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +153 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host plugin distribution spec §6.3 (amended, item 5) and §2.3: Claude's own CLI does the registering and reports its
|
|
3
|
+
* own state through its `--json` lists; Claude's files are never read or written here. `IA_CLAUDE` names a Node
|
|
4
|
+
* script to run instead of `claude`; it exists for tests and is not a user-facing setting.
|
|
5
|
+
*/
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
import { existsSync } from 'node:fs';
|
|
8
|
+
import { CLAUDE_MARKETPLACE, CLAUDE_PLUGIN } from '@inventarch/compliance';
|
|
9
|
+
import { Refusal } from './consumer.js';
|
|
10
|
+
export const PLUGIN_ID = `${CLAUDE_PLUGIN}@${CLAUDE_MARKETPLACE}`;
|
|
11
|
+
/** Whether one of Claude's `--json` lists has a matching row; null when the command failed or printed no array. */
|
|
12
|
+
function listed(runner, args, match) {
|
|
13
|
+
const result = runner.run(args);
|
|
14
|
+
if (result.status !== 0)
|
|
15
|
+
return null;
|
|
16
|
+
try {
|
|
17
|
+
const rows = JSON.parse(result.stdout);
|
|
18
|
+
return Array.isArray(rows)
|
|
19
|
+
? rows.some((row) => row !== null && typeof row === 'object' && match(row))
|
|
20
|
+
: null;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* §2.3's observed shapes: `plugin marketplace list --json` is an array of `{name, …}` and `plugin list --json` an
|
|
28
|
+
* array of `{id, scope, …}`. Only a user-scope install is ours to remove; a row without a scope is taken as one.
|
|
29
|
+
*/
|
|
30
|
+
export function observeClaude(runner) {
|
|
31
|
+
if (!runner.available)
|
|
32
|
+
return { marketplaceKnown: null, installed: null };
|
|
33
|
+
return {
|
|
34
|
+
marketplaceKnown: listed(runner, ['plugin', 'marketplace', 'list', '--json'], (row) => row['name'] === CLAUDE_MARKETPLACE),
|
|
35
|
+
installed: listed(runner, ['plugin', 'list', '--json'], (row) => row['id'] === PLUGIN_ID && (row['scope'] === undefined || row['scope'] === 'user')),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** §2.3: `marketplace add` and `install` are both idempotent, so registration is always the same two commands. */
|
|
39
|
+
export const registrationCommands = (marketplace) => [
|
|
40
|
+
['plugin', 'marketplace', 'add', marketplace],
|
|
41
|
+
['plugin', 'install', PLUGIN_ID, '--scope', 'user'],
|
|
42
|
+
];
|
|
43
|
+
/** §2.3: `uninstall` and `remove` exit 1 when there is nothing to remove, so only what is listed (or unknown) is removed. */
|
|
44
|
+
export function removalCommands(state) {
|
|
45
|
+
return [
|
|
46
|
+
...(state.installed === false ? [] : [['plugin', 'uninstall', PLUGIN_ID, '--scope', 'user']]),
|
|
47
|
+
...(state.marketplaceKnown === false ? [] : [['plugin', 'marketplace', 'remove', CLAUDE_MARKETPLACE]]),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
/** Registration and removal commands get two minutes; the availability probe far less, so a hung `claude` cannot stall a plan. */
|
|
51
|
+
const COMMAND_TIMEOUT = 120_000, PROBE_TIMEOUT = 10_000;
|
|
52
|
+
/** The variables that steer tests/fake-claude.mjs. Only the ones this invocation was given reach it; inherited ones are dropped. */
|
|
53
|
+
const FAKE_VARIABLE = /^(IA_CLAUDE_|FAKE_CLAUDE_)/;
|
|
54
|
+
const DEFAULTS = {
|
|
55
|
+
platform: process.platform,
|
|
56
|
+
spawn: (command, args, options) => spawnSync(command, [...args], { ...options, encoding: 'utf8' }),
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* One argument on the cmd.exe line of the Windows fallback. cmd.exe expands `%NAME%` even inside quotes and a `"`
|
|
60
|
+
* ends the quoting, so neither can be passed safely; such an argument refuses rather than being quoted.
|
|
61
|
+
*/
|
|
62
|
+
function cmdArgument(value) {
|
|
63
|
+
if (/[%"]/.test(value))
|
|
64
|
+
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 ", or install Claude Code so that claude.exe is on PATH, then rerun.');
|
|
65
|
+
return /^[\w\-.:\\/@=+,]+$/.test(value) ? value : `"${value}"`;
|
|
66
|
+
}
|
|
67
|
+
export function claudeRunner(env, dependencies = DEFAULTS) {
|
|
68
|
+
const { platform, spawn } = dependencies;
|
|
69
|
+
const fake = env['IA_CLAUDE'];
|
|
70
|
+
const real = (args, timeout) => {
|
|
71
|
+
if (platform !== 'win32')
|
|
72
|
+
return spawn('claude', args, { timeout, windowsHide: true });
|
|
73
|
+
// Windows: a claude.exe on PATH runs with no shell, so no argument is reinterpreted. Node resolves no .cmd file
|
|
74
|
+
// without a shell, so only a missing executable falls back to the cmd.exe line an npm shim needs.
|
|
75
|
+
const direct = spawn('claude', args, { shell: false, timeout, windowsHide: true });
|
|
76
|
+
if (direct.error?.code !== 'ENOENT')
|
|
77
|
+
return direct;
|
|
78
|
+
return spawn(['claude', ...args].map(cmdArgument).join(' '), [], { shell: true, timeout, windowsHide: true });
|
|
79
|
+
};
|
|
80
|
+
const fakeEnv = () => ({
|
|
81
|
+
...Object.fromEntries(Object.entries(process.env).filter(([name]) => !FAKE_VARIABLE.test(name))),
|
|
82
|
+
...Object.fromEntries(Object.entries(env).filter(([name]) => FAKE_VARIABLE.test(name))),
|
|
83
|
+
});
|
|
84
|
+
const invoke = (args, timeout) => fake !== undefined
|
|
85
|
+
? spawn(process.execPath, [fake, ...args], { env: fakeEnv(), timeout, windowsHide: true })
|
|
86
|
+
: real(args, timeout);
|
|
87
|
+
// The fake is probed exactly as `claude` is, so tests observe when the probe runs.
|
|
88
|
+
const available = (fake === undefined || existsSync(fake)) && invoke(['--version'], PROBE_TIMEOUT).status === 0;
|
|
89
|
+
return {
|
|
90
|
+
available,
|
|
91
|
+
run: (args) => {
|
|
92
|
+
const result = invoke(args, COMMAND_TIMEOUT);
|
|
93
|
+
return {
|
|
94
|
+
status: result.status,
|
|
95
|
+
stdout: result.stdout ?? '',
|
|
96
|
+
output: `${result.stdout ?? ''}${result.stderr ?? ''}`.trim(),
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=claude-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-cli.js","sourceRoot":"","sources":["../src/claude-cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;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;AAGxC,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,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAY,CAAC;QAClD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACxB,CAAC,CAAC,IAAI,CAAC,IAAI,C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C,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAC1F,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1B,mFAAmF;IACnF,MAAM,SAAS,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAChH,OAAO;QACL,SAAS;QACT,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;YACZ,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;YAC7C,OAAO;gBACL,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;gBAC3B,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;aAC9D,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The consumer command table: docs/specs/consumer-cli-contract/README.md §1.2 step 5 and §2.
|
|
3
|
+
*
|
|
4
|
+
* One row per verb, carrying its help text and its whole argument grammar. §1.2's order is a property of this
|
|
5
|
+
* table and of the dispatcher that reads it; nothing else in the binary enumerates a verb or a flag name.
|
|
6
|
+
*/
|
|
7
|
+
import type { Grammar, OptionSpec } from './args.js';
|
|
8
|
+
/** §1.2 step 4. The frozen machine routes, in the order `packages/runtime/src/door.ts:103` admits them. */
|
|
9
|
+
export declare const LEGACY_OPERATIONS: readonly ["scope", "context", "select", "get", "records", "resolve", "search", "traverse", "report"];
|
|
10
|
+
/** §1.2 step 6. Reserved so a later milestone can take the name without a rename; see §1.5. */
|
|
11
|
+
export declare const RESERVED_TOKEN = "agent";
|
|
12
|
+
export type Group = 'workspace' | 'distribution';
|
|
13
|
+
export interface CommandSpec {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly group: Group;
|
|
16
|
+
readonly summary: string;
|
|
17
|
+
/** The syntax lines `ia <command> --help` prints, verbatim from §2. */
|
|
18
|
+
readonly syntax: readonly string[];
|
|
19
|
+
readonly grammar: Grammar;
|
|
20
|
+
}
|
|
21
|
+
export declare const ROOT: OptionSpec;
|
|
22
|
+
/** §2.0. Applies to all thirteen verbs; §2.1 refuses `--root` for `init` alone, with its own reason. */
|
|
23
|
+
export declare const COMMON_OPTIONS: readonly OptionSpec[];
|
|
24
|
+
export declare const COMMANDS: readonly CommandSpec[];
|
|
25
|
+
/**
|
|
26
|
+
* §1.6: L ∪ C ∪ R and the step 1–2 tokens — every token an extension may never take. The core wins: `dispatch`
|
|
27
|
+
* routes such a token to its core route even when an extension claims it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const CORE_TOKENS: ReadonlySet<string>;
|
|
30
|
+
/** §1.6: the shape of an extension token. */
|
|
31
|
+
export declare const EXTENSION_TOKEN: RegExp;
|
|
32
|
+
export declare const commandNames: readonly string[];
|
|
33
|
+
export declare const findCommand: (token: string) => CommandSpec | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* §1.2 step 7's nearest match. Ordinary Levenshtein distance over the tokens the dispatcher admits, capped so a
|
|
36
|
+
* wholly unrelated word gets no suggestion rather than a misleading one.
|
|
37
|
+
*/
|
|
38
|
+
export declare function nearestTokens(token: string, admitted: readonly string[], limit?: number): readonly string[];
|
|
39
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAkB,MAAM,WAAW,CAAC;AAGrE,2GAA2G;AAC3G,eAAO,MAAM,iBAAiB,sGAUpB,CAAC;AAEX,+FAA+F;AAC/F,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,MAAM,MAAM,KAAK,GAAG,WAAW,GAAG,cAAc,CAAC;AACjD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAGD,eAAO,MAAM,IAAI,EAAE,UAKjB,CAAC;AACH,wGAAwG;AACxG,eAAO,MAAM,cAAc,EAAE,SAAS,UAAU,EAS/C,CAAC;AAmBF,eAAO,MAAM,QAAQ,EAAE,SAAS,WAAW,EAkX1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,CAO1C,CAAC;AACH,6CAA6C;AAC7C,eAAO,MAAM,eAAe,QAA2B,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAA4C,CAAC;AACvF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,WAAW,GAAG,SACN,CAAC;AAErD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,SAAI,GAAG,SAAS,MAAM,EAAE,CAkBtG"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { none, positionals } from './args.js';
|
|
2
|
+
/** §1.2 step 4. The frozen machine routes, in the order `packages/runtime/src/door.ts:103` admits them. */
|
|
3
|
+
export const LEGACY_OPERATIONS = [
|
|
4
|
+
'scope',
|
|
5
|
+
'context',
|
|
6
|
+
'select',
|
|
7
|
+
'get',
|
|
8
|
+
'records',
|
|
9
|
+
'resolve',
|
|
10
|
+
'search',
|
|
11
|
+
'traverse',
|
|
12
|
+
'report',
|
|
13
|
+
];
|
|
14
|
+
/** §1.2 step 6. Reserved so a later milestone can take the name without a rename; see §1.5. */
|
|
15
|
+
export const RESERVED_TOKEN = 'agent';
|
|
16
|
+
const option = (spec) => spec;
|
|
17
|
+
export const ROOT = option({
|
|
18
|
+
name: 'root',
|
|
19
|
+
kind: 'value',
|
|
20
|
+
placeholder: '<path>',
|
|
21
|
+
summary: 'Workspace root (default: nearest ancestor with .ia/src)',
|
|
22
|
+
});
|
|
23
|
+
/** §2.0. Applies to all thirteen verbs; §2.1 refuses `--root` for `init` alone, with its own reason. */
|
|
24
|
+
export const COMMON_OPTIONS = [
|
|
25
|
+
ROOT,
|
|
26
|
+
option({ name: 'json', kind: 'boolean', summary: 'One JSON value on stdout; no color, progress or prompts' }),
|
|
27
|
+
option({ name: 'color', kind: 'boolean', conflicts: ['no-color'], summary: 'Force ANSI styling' }),
|
|
28
|
+
option({ name: 'no-color', kind: 'boolean', summary: 'Disable ANSI styling; NO_COLOR is also honored' }),
|
|
29
|
+
option({ name: 'ascii', kind: 'boolean', summary: 'ASCII status symbols instead of Unicode' }),
|
|
30
|
+
option({ name: 'quiet', kind: 'boolean', short: 'q', summary: 'Suppress progress on stderr' }),
|
|
31
|
+
option({ name: 'yes', kind: 'boolean', short: 'y', summary: 'Assume yes; required for --apply without a terminal' }),
|
|
32
|
+
option({ name: 'help', kind: 'boolean', short: 'h', summary: 'Show help for the binary or for one command' }),
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Registry spec §4 level 1: one registry for every id in the command, whatever its provider. It replaces discovery's
|
|
36
|
+
* per-provider choice, so it cannot stand beside the two sources that replace discovery outright.
|
|
37
|
+
*/
|
|
38
|
+
const REGISTRY = option({
|
|
39
|
+
name: 'registry',
|
|
40
|
+
kind: 'value',
|
|
41
|
+
conflicts: ['catalog', 'offline'],
|
|
42
|
+
placeholder: '<url|dir>',
|
|
43
|
+
summary: 'Registry for every id in this command (default: per-provider configuration)',
|
|
44
|
+
});
|
|
45
|
+
const grammar = (options, rest = none) => ({
|
|
46
|
+
options: [...COMMON_OPTIONS, ...options],
|
|
47
|
+
positionals: rest,
|
|
48
|
+
});
|
|
49
|
+
export const COMMANDS = [
|
|
50
|
+
{
|
|
51
|
+
name: 'init',
|
|
52
|
+
group: 'workspace',
|
|
53
|
+
summary: 'Plan or create a new workspace',
|
|
54
|
+
syntax: [
|
|
55
|
+
'ia init [<directory>] [--id <provider/name>] [--host claude|codex|none] [--apply] [--json] [--yes]',
|
|
56
|
+
'ia init [<directory>] --decline today|forever | --forget-decline [--host claude|codex|none] [--json]',
|
|
57
|
+
],
|
|
58
|
+
grammar: {
|
|
59
|
+
options: [
|
|
60
|
+
...COMMON_OPTIONS.filter((entry) => entry.name !== 'root'),
|
|
61
|
+
{ ...ROOT, refuse: 'ia init takes its target as <directory>; --root is not accepted for this verb' },
|
|
62
|
+
// M5.1 §2.3: the package id, when the directory name does not normalize to the one wanted.
|
|
63
|
+
option({
|
|
64
|
+
name: 'id',
|
|
65
|
+
kind: 'value',
|
|
66
|
+
placeholder: '<provider/name>',
|
|
67
|
+
summary: 'Package id (default: local/<directory name>)',
|
|
68
|
+
}),
|
|
69
|
+
// Host registration spec §4 "init --host": with --apply, `ia host <host> --apply` runs after initialization.
|
|
70
|
+
option({
|
|
71
|
+
name: 'host',
|
|
72
|
+
kind: 'value',
|
|
73
|
+
values: ['claude', 'codex', 'none'],
|
|
74
|
+
summary: 'Host to register after initialization',
|
|
75
|
+
}),
|
|
76
|
+
option({ name: 'apply', kind: 'boolean', summary: 'Apply the plan instead of previewing it' }),
|
|
77
|
+
// Host plugin distribution spec §7.2: record the user's answer in the IA home; never writes the repository.
|
|
78
|
+
option({
|
|
79
|
+
name: 'decline',
|
|
80
|
+
kind: 'value',
|
|
81
|
+
values: ['today', 'forever'],
|
|
82
|
+
conflicts: ['apply', 'id', 'forget-decline'],
|
|
83
|
+
summary: 'Record that this repository should not be initialized',
|
|
84
|
+
}),
|
|
85
|
+
option({
|
|
86
|
+
name: 'forget-decline',
|
|
87
|
+
kind: 'boolean',
|
|
88
|
+
conflicts: ['apply', 'id', 'decline', 'host'],
|
|
89
|
+
summary: 'Remove a recorded decline for this repository',
|
|
90
|
+
}),
|
|
91
|
+
],
|
|
92
|
+
positionals: positionals('directory', 0, 1),
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'validate',
|
|
97
|
+
group: 'workspace',
|
|
98
|
+
summary: 'Check records against the language and declared contracts',
|
|
99
|
+
syntax: ['ia validate [<path>...] [--severity error|warning] [--max-findings <n>] [--json]'],
|
|
100
|
+
grammar: grammar([
|
|
101
|
+
option({ name: 'severity', kind: 'value', values: ['error', 'warning'], summary: 'Lowest severity to report' }),
|
|
102
|
+
option({
|
|
103
|
+
name: 'max-findings',
|
|
104
|
+
kind: 'value',
|
|
105
|
+
integer: { min: 1 },
|
|
106
|
+
placeholder: '<n>',
|
|
107
|
+
summary: 'Findings to render (default 50)',
|
|
108
|
+
}),
|
|
109
|
+
], positionals('path', 0, Number.POSITIVE_INFINITY)),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'compile',
|
|
113
|
+
group: 'workspace',
|
|
114
|
+
summary: 'Write a deterministic compiled artifact',
|
|
115
|
+
syntax: ['ia compile [--out <file> | --stdout] [--force] [--json]'],
|
|
116
|
+
grammar: grammar([
|
|
117
|
+
option({
|
|
118
|
+
name: 'out',
|
|
119
|
+
kind: 'value',
|
|
120
|
+
conflicts: ['stdout'],
|
|
121
|
+
placeholder: '<file>',
|
|
122
|
+
summary: 'Artifact path under <root>/.ia/work/',
|
|
123
|
+
}),
|
|
124
|
+
option({ name: 'stdout', kind: 'boolean', summary: 'Write the artifact to stdout instead of a file' }),
|
|
125
|
+
option({ name: 'force', kind: 'boolean', summary: 'Overwrite an existing artifact' }),
|
|
126
|
+
]),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'format',
|
|
130
|
+
group: 'workspace',
|
|
131
|
+
summary: 'Check or rewrite record formatting',
|
|
132
|
+
syntax: ['ia format [<path>...] [--check | --write] [--json]'],
|
|
133
|
+
grammar: grammar([
|
|
134
|
+
option({
|
|
135
|
+
name: 'check',
|
|
136
|
+
kind: 'boolean',
|
|
137
|
+
conflicts: ['write'],
|
|
138
|
+
summary: 'Report differing files and write nothing',
|
|
139
|
+
}),
|
|
140
|
+
option({ name: 'write', kind: 'boolean', summary: 'Rewrite differing files in place' }),
|
|
141
|
+
], positionals('path', 0, Number.POSITIVE_INFINITY)),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'inspect',
|
|
145
|
+
group: 'workspace',
|
|
146
|
+
summary: 'Show an admitted record, its edges, or a workspace overview',
|
|
147
|
+
syntax: ['ia inspect [<identity>] [--path <file>] [--edges in|out|both] [--depth <n>] [--json]'],
|
|
148
|
+
grammar: grammar([
|
|
149
|
+
option({
|
|
150
|
+
name: 'path',
|
|
151
|
+
kind: 'value',
|
|
152
|
+
excludesPositionals: true,
|
|
153
|
+
placeholder: '<file>',
|
|
154
|
+
summary: 'Record source file, relative to --root',
|
|
155
|
+
}),
|
|
156
|
+
option({
|
|
157
|
+
name: 'edges',
|
|
158
|
+
kind: 'value',
|
|
159
|
+
values: ['in', 'out', 'both'],
|
|
160
|
+
summary: 'Edge direction (default out); in and both also list typed field references',
|
|
161
|
+
}),
|
|
162
|
+
option({
|
|
163
|
+
name: 'depth',
|
|
164
|
+
kind: 'value',
|
|
165
|
+
integer: { min: 0, max: 3 },
|
|
166
|
+
placeholder: '<n>',
|
|
167
|
+
summary: 'Traversal depth 0-3 (default 1)',
|
|
168
|
+
}),
|
|
169
|
+
], positionals('identity', 0, 1)),
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'vocabulary',
|
|
173
|
+
group: 'workspace',
|
|
174
|
+
summary: 'Look up the public words, their schemas and fields',
|
|
175
|
+
syntax: [
|
|
176
|
+
'ia vocabulary [<word>] [--domain <owner>]... [--kind <kind>]... [--search <text>]',
|
|
177
|
+
' [--schema] [--example] [--json]',
|
|
178
|
+
],
|
|
179
|
+
grammar: {
|
|
180
|
+
options: [
|
|
181
|
+
...COMMON_OPTIONS.filter((entry) => entry.name !== 'root'),
|
|
182
|
+
// §2.0's exception: this verb resolves no root at all, so accepting --root and discarding it would be a
|
|
183
|
+
// flag that does nothing. It refuses with the reason instead.
|
|
184
|
+
{
|
|
185
|
+
...ROOT,
|
|
186
|
+
refuse: 'ia vocabulary reads the catalogue shipped with the package; --root is not accepted for this verb',
|
|
187
|
+
},
|
|
188
|
+
option({
|
|
189
|
+
name: 'domain',
|
|
190
|
+
kind: 'value',
|
|
191
|
+
repeatable: true,
|
|
192
|
+
placeholder: '<owner>',
|
|
193
|
+
summary: 'Owning system; repeatable, union',
|
|
194
|
+
}),
|
|
195
|
+
option({
|
|
196
|
+
name: 'kind',
|
|
197
|
+
kind: 'value',
|
|
198
|
+
repeatable: true,
|
|
199
|
+
placeholder: '<kind>',
|
|
200
|
+
summary: 'Record kind; repeatable, union',
|
|
201
|
+
}),
|
|
202
|
+
option({
|
|
203
|
+
name: 'search',
|
|
204
|
+
kind: 'value',
|
|
205
|
+
placeholder: '<text>',
|
|
206
|
+
summary: 'Case-insensitive substring of word or description',
|
|
207
|
+
}),
|
|
208
|
+
option({
|
|
209
|
+
name: 'schema',
|
|
210
|
+
kind: 'boolean',
|
|
211
|
+
needsPositional: true,
|
|
212
|
+
summary: 'Show sections, fields and edges for the word',
|
|
213
|
+
}),
|
|
214
|
+
option({
|
|
215
|
+
name: 'example',
|
|
216
|
+
kind: 'boolean',
|
|
217
|
+
needsPositional: true,
|
|
218
|
+
summary: 'Show a shipped worked example, when one exists',
|
|
219
|
+
}),
|
|
220
|
+
],
|
|
221
|
+
positionals: positionals('word', 0, 1),
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'pack',
|
|
226
|
+
group: 'distribution',
|
|
227
|
+
summary: 'Build a digest-named distribution archive',
|
|
228
|
+
syntax: ['ia pack --descriptor <file> [--out <dir>] [--force] [--json]'],
|
|
229
|
+
grammar: grammar([
|
|
230
|
+
option({
|
|
231
|
+
name: 'descriptor',
|
|
232
|
+
kind: 'value',
|
|
233
|
+
required: true,
|
|
234
|
+
placeholder: '<file>',
|
|
235
|
+
summary: 'Release descriptor, relative to --root',
|
|
236
|
+
}),
|
|
237
|
+
option({
|
|
238
|
+
name: 'out',
|
|
239
|
+
kind: 'value',
|
|
240
|
+
placeholder: '<dir>',
|
|
241
|
+
summary: 'Output directory (default <root>/.ia/work/dist)',
|
|
242
|
+
}),
|
|
243
|
+
option({ name: 'force', kind: 'boolean', summary: 'Overwrite an existing archive' }),
|
|
244
|
+
]),
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'install',
|
|
248
|
+
group: 'distribution',
|
|
249
|
+
summary: 'Plan or apply an installation of distributions',
|
|
250
|
+
syntax: [
|
|
251
|
+
'ia install <id>[@<range>]... [--requests <file>] [--registry <url|dir>]',
|
|
252
|
+
' [--catalog <file>] [--offline] [--plan-out <file>]',
|
|
253
|
+
' [--apply] [--yes] [--json]',
|
|
254
|
+
],
|
|
255
|
+
grammar: grammar([
|
|
256
|
+
option({
|
|
257
|
+
name: 'requests',
|
|
258
|
+
kind: 'value',
|
|
259
|
+
excludesPositionals: true,
|
|
260
|
+
placeholder: '<file>',
|
|
261
|
+
summary: 'Request set file, relative to --root',
|
|
262
|
+
}),
|
|
263
|
+
REGISTRY,
|
|
264
|
+
option({
|
|
265
|
+
name: 'catalog',
|
|
266
|
+
kind: 'value',
|
|
267
|
+
placeholder: '<file>',
|
|
268
|
+
summary: 'Release catalog file, relative to --root',
|
|
269
|
+
}),
|
|
270
|
+
option({ name: 'offline', kind: 'boolean', summary: 'Use only the local cache' }),
|
|
271
|
+
option({
|
|
272
|
+
name: 'plan-out',
|
|
273
|
+
kind: 'value',
|
|
274
|
+
placeholder: '<file>',
|
|
275
|
+
summary: 'New plan file under <root>/.ia/work/',
|
|
276
|
+
}),
|
|
277
|
+
option({ name: 'apply', kind: 'boolean', summary: 'Apply the plan rather than previewing it' }),
|
|
278
|
+
], positionals('id', 0, Number.POSITIVE_INFINITY)),
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: 'update',
|
|
282
|
+
group: 'distribution',
|
|
283
|
+
summary: 'Plan or apply a version change for one direct request',
|
|
284
|
+
syntax: [
|
|
285
|
+
'ia update <id> [--to <range>] [--registry <url|dir>] [--catalog <file>]',
|
|
286
|
+
' [--offline] [--plan-out <file>] [--apply] [--yes] [--json]',
|
|
287
|
+
],
|
|
288
|
+
grammar: grammar([
|
|
289
|
+
// Registry spec §6.2: without --to the request keeps its range and the newest release in it wins.
|
|
290
|
+
option({
|
|
291
|
+
name: 'to',
|
|
292
|
+
kind: 'value',
|
|
293
|
+
placeholder: '<range>',
|
|
294
|
+
summary: 'Replacement version range (default: the existing range)',
|
|
295
|
+
}),
|
|
296
|
+
REGISTRY,
|
|
297
|
+
option({
|
|
298
|
+
name: 'catalog',
|
|
299
|
+
kind: 'value',
|
|
300
|
+
placeholder: '<file>',
|
|
301
|
+
summary: 'Release catalog file, relative to --root',
|
|
302
|
+
}),
|
|
303
|
+
option({ name: 'offline', kind: 'boolean', summary: 'Use only the local cache' }),
|
|
304
|
+
option({
|
|
305
|
+
name: 'plan-out',
|
|
306
|
+
kind: 'value',
|
|
307
|
+
placeholder: '<file>',
|
|
308
|
+
summary: 'New plan file under <root>/.ia/work/',
|
|
309
|
+
}),
|
|
310
|
+
option({ name: 'apply', kind: 'boolean', summary: 'Apply the plan rather than previewing it' }),
|
|
311
|
+
], positionals('id', 1, 1)),
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'remove',
|
|
315
|
+
group: 'distribution',
|
|
316
|
+
summary: 'Plan or apply the removal of one direct request',
|
|
317
|
+
syntax: ['ia remove <id> [--plan-out <file>] [--apply] [--yes] [--json]'],
|
|
318
|
+
grammar: grammar([
|
|
319
|
+
option({
|
|
320
|
+
name: 'plan-out',
|
|
321
|
+
kind: 'value',
|
|
322
|
+
placeholder: '<file>',
|
|
323
|
+
summary: 'New plan file under <root>/.ia/work/',
|
|
324
|
+
}),
|
|
325
|
+
option({ name: 'apply', kind: 'boolean', summary: 'Apply the plan rather than previewing it' }),
|
|
326
|
+
], positionals('id', 1, 1)),
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'restore',
|
|
330
|
+
group: 'distribution',
|
|
331
|
+
summary: 'Reinstall the locked generation from its pinned archives',
|
|
332
|
+
syntax: [
|
|
333
|
+
'ia restore [--registry <url|dir> | --offline | --catalog <file>]',
|
|
334
|
+
' [--allow-withdrawn] --apply [--yes] [--json]',
|
|
335
|
+
],
|
|
336
|
+
grammar: grammar([
|
|
337
|
+
REGISTRY,
|
|
338
|
+
option({
|
|
339
|
+
name: 'catalog',
|
|
340
|
+
kind: 'value',
|
|
341
|
+
conflicts: ['offline'],
|
|
342
|
+
placeholder: '<file>',
|
|
343
|
+
summary: 'Release catalog file, relative to --root',
|
|
344
|
+
}),
|
|
345
|
+
option({ name: 'offline', kind: 'boolean', summary: 'Use only the local cache' }),
|
|
346
|
+
option({ name: 'allow-withdrawn', kind: 'boolean', summary: 'Accept a withdrawn release' }),
|
|
347
|
+
option({ name: 'apply', kind: 'boolean', required: true, summary: 'Required; restore has no preview yet' }),
|
|
348
|
+
]),
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: 'doctor',
|
|
352
|
+
group: 'distribution',
|
|
353
|
+
summary: 'Report runtime, workspace and installation state',
|
|
354
|
+
// Host plugin distribution spec §7.3: --host adds the §8.2 session briefing and next actions for that host.
|
|
355
|
+
syntax: ['ia doctor [--host claude|codex|cursor] [--json]'],
|
|
356
|
+
grammar: grammar([
|
|
357
|
+
option({
|
|
358
|
+
name: 'host',
|
|
359
|
+
kind: 'value',
|
|
360
|
+
values: ['claude', 'codex', 'cursor'],
|
|
361
|
+
summary: 'Add the session briefing and next actions for this host',
|
|
362
|
+
}),
|
|
363
|
+
]),
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
// docs/specs/host-registration/README.md §4. The host is a positional the handler checks against the
|
|
367
|
+
// host adapter table (host plugin distribution spec §4), because a positional has no closed value set here; a host
|
|
368
|
+
// outside the table is still usage (exit 2). `--user` is that spec's §7.1 user-level entry point.
|
|
369
|
+
name: 'host',
|
|
370
|
+
group: 'distribution',
|
|
371
|
+
summary: "Plan or apply this workspace's host registration",
|
|
372
|
+
syntax: [
|
|
373
|
+
'ia host <claude|codex|cursor> [--remove] [--context <identity>] [--apply] [--json] [--yes]',
|
|
374
|
+
'ia host claude --user [--remove] [--apply] [--json] [--yes]',
|
|
375
|
+
],
|
|
376
|
+
grammar: grammar([
|
|
377
|
+
option({
|
|
378
|
+
name: 'user',
|
|
379
|
+
kind: 'boolean',
|
|
380
|
+
conflicts: ['context'],
|
|
381
|
+
summary: 'Claude only: user-level plugin; needs no workspace',
|
|
382
|
+
}),
|
|
383
|
+
option({
|
|
384
|
+
name: 'remove',
|
|
385
|
+
kind: 'boolean',
|
|
386
|
+
conflicts: ['context'],
|
|
387
|
+
summary: 'Plan removal of the owned host set',
|
|
388
|
+
}),
|
|
389
|
+
option({
|
|
390
|
+
name: 'context',
|
|
391
|
+
kind: 'value',
|
|
392
|
+
placeholder: '<identity>',
|
|
393
|
+
summary: 'Claude only: select the lifecycle context element',
|
|
394
|
+
}),
|
|
395
|
+
option({ name: 'apply', kind: 'boolean', summary: 'Apply the plan rather than previewing it' }),
|
|
396
|
+
], positionals('host', 1, 1)),
|
|
397
|
+
},
|
|
398
|
+
];
|
|
399
|
+
/**
|
|
400
|
+
* §1.6: L ∪ C ∪ R and the step 1–2 tokens — every token an extension may never take. The core wins: `dispatch`
|
|
401
|
+
* routes such a token to its core route even when an extension claims it.
|
|
402
|
+
*/
|
|
403
|
+
export const CORE_TOKENS = new Set([
|
|
404
|
+
...LEGACY_OPERATIONS,
|
|
405
|
+
...COMMANDS.map((command) => command.name),
|
|
406
|
+
RESERVED_TOKEN,
|
|
407
|
+
'--help',
|
|
408
|
+
'-h',
|
|
409
|
+
'--version',
|
|
410
|
+
]);
|
|
411
|
+
/** §1.6: the shape of an extension token. */
|
|
412
|
+
export const EXTENSION_TOKEN = /^[a-z][a-z0-9-]{0,31}$/;
|
|
413
|
+
export const commandNames = COMMANDS.map((command) => command.name);
|
|
414
|
+
export const findCommand = (token) => COMMANDS.find((command) => command.name === token);
|
|
415
|
+
/**
|
|
416
|
+
* §1.2 step 7's nearest match. Ordinary Levenshtein distance over the tokens the dispatcher admits, capped so a
|
|
417
|
+
* wholly unrelated word gets no suggestion rather than a misleading one.
|
|
418
|
+
*/
|
|
419
|
+
export function nearestTokens(token, admitted, limit = 3) {
|
|
420
|
+
const distance = (a, b) => {
|
|
421
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
422
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
423
|
+
const current = [i];
|
|
424
|
+
for (let j = 1; j <= b.length; j += 1)
|
|
425
|
+
current.push(Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1)));
|
|
426
|
+
previous = current;
|
|
427
|
+
}
|
|
428
|
+
return previous[b.length];
|
|
429
|
+
};
|
|
430
|
+
const scored = admitted
|
|
431
|
+
.map((candidate) => ({ candidate, score: distance(token.toLowerCase(), candidate) }))
|
|
432
|
+
.filter((row) => row.score <= Math.max(2, Math.floor(row.candidate.length / 3)))
|
|
433
|
+
.sort((a, b) => a.score - b.score || a.candidate.localeCompare(b.candidate));
|
|
434
|
+
return scored.slice(0, limit).map((row) => row.candidate);
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -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AAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Context, Result } from './consumer.js';
|
|
2
|
+
import type { Session } from './session.js';
|
|
3
|
+
import type { Capabilities } from './render.js';
|
|
4
|
+
type Admission = ReturnType<Session['admission']>;
|
|
5
|
+
type Finding = Admission['findings'][number];
|
|
6
|
+
export declare const DEFAULT_OUT = ".ia/work/compiled.json";
|
|
7
|
+
export declare const ARTIFACT = "ia.compiled.v1";
|
|
8
|
+
export interface CompileCounts {
|
|
9
|
+
readonly records: number;
|
|
10
|
+
readonly errors: number;
|
|
11
|
+
readonly warnings: number;
|
|
12
|
+
readonly notEvaluated: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CompiledArtifact {
|
|
15
|
+
readonly formatVersion: 1;
|
|
16
|
+
readonly artifact: typeof ARTIFACT;
|
|
17
|
+
readonly language: string;
|
|
18
|
+
readonly kernelDigest: string;
|
|
19
|
+
readonly root: string;
|
|
20
|
+
readonly revision: string;
|
|
21
|
+
readonly records: readonly unknown[];
|
|
22
|
+
readonly diagnostics: readonly Finding[];
|
|
23
|
+
readonly counts: CompileCounts;
|
|
24
|
+
}
|
|
25
|
+
export interface CompileView {
|
|
26
|
+
readonly artifact: CompiledArtifact;
|
|
27
|
+
/** The exact bytes the artifact serializes to, so the file and the reported digest cannot disagree. */
|
|
28
|
+
readonly text: string;
|
|
29
|
+
readonly digest: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function buildArtifact(root: string, session: Session): CompileView;
|
|
32
|
+
export declare function collectCompile(root: string): CompileView;
|
|
33
|
+
/** §2.4: the artifact is written even when the compilation produced errors; the exit class carries the verdict. */
|
|
34
|
+
export declare const compileExit: (view: CompileView) => 0 | 1;
|
|
35
|
+
export declare function compileEnvelope(view: CompileView, path: string): unknown;
|
|
36
|
+
export declare function renderCompile(view: CompileView, path: string, caps: Capabilities): string;
|
|
37
|
+
export declare function runCompile(context: Context): Result;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=compile.d.ts.map
|