@astrosheep/keiyaku 4.1.0 → 4.1.2
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/README.md +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +3 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +3 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +3 -6
- package/build/src/akuma/akuma-errors.d.ts +6 -0
- package/build/src/akuma/akuma-errors.js +9 -0
- package/build/src/akuma/akuma-handle.d.ts +39 -0
- package/build/src/akuma/akuma-handle.js +263 -0
- package/build/src/akuma/akuma-observe.d.ts +19 -0
- package/build/src/akuma/akuma-observe.js +74 -0
- package/build/src/akuma/akuma-product-symbols.d.ts +1 -0
- package/build/src/akuma/akuma-product-symbols.js +1 -0
- package/build/src/akuma/akuma-product.d.ts +18 -0
- package/build/src/akuma/akuma-product.js +154 -0
- package/build/src/akuma/akuma.d.ts +37 -81
- package/build/src/akuma/akuma.js +39 -447
- package/build/src/akuma/allowed.d.ts +1 -0
- package/build/src/akuma/allowed.js +6 -0
- package/build/src/akuma/archetype.js +8 -5
- package/build/src/akuma/body-supervisor.d.ts +26 -0
- package/build/src/akuma/body-supervisor.js +89 -0
- package/build/src/akuma/body.d.ts +45 -4
- package/build/src/akuma/body.js +145 -35
- package/build/src/akuma/coordinate.js +17 -7
- package/build/src/akuma/heart/facts.js +1 -1
- package/build/src/akuma/heart/index.d.ts +1 -1
- package/build/src/akuma/heart/index.js +2 -4
- package/build/src/akuma/heart/request-authority.js +4 -4
- package/build/src/akuma/heart/request-rows.js +27 -16
- package/build/src/akuma/heart/rows.js +79 -41
- package/build/src/akuma/heart/soul.js +1 -1
- package/build/src/akuma/heart/storage.d.ts +1 -0
- package/build/src/akuma/heart/storage.js +76 -11
- package/build/src/akuma/heart/tells.js +35 -18
- package/build/src/akuma/heart/timeline.js +19 -11
- package/build/src/akuma/identity.d.ts +1 -0
- package/build/src/akuma/identity.js +1 -0
- package/build/src/akuma/index.d.ts +3 -3
- package/build/src/akuma/index.js +1 -1
- package/build/src/akuma/nuke.js +106 -14
- package/build/src/akuma/projection-read.d.ts +17 -0
- package/build/src/akuma/projection-read.js +135 -0
- package/build/src/akuma/projection.d.ts +1 -16
- package/build/src/akuma/projection.js +77 -154
- package/build/src/akuma/provider-recipe.js +11 -5
- package/build/src/akuma/provider.js +105 -62
- package/build/src/akuma/providers/acp/config.js +5 -6
- package/build/src/akuma/providers/acp/core.js +17 -10
- package/build/src/akuma/providers/acp/events.js +38 -29
- package/build/src/akuma/providers/acp/index.js +13 -9
- package/build/src/akuma/providers/claude/events.js +8 -12
- package/build/src/akuma/providers/claude/index.d.ts +1 -0
- package/build/src/akuma/providers/claude/index.js +55 -26
- package/build/src/akuma/providers/claude/input.js +6 -2
- package/build/src/akuma/providers/codex-app-server/events.js +61 -36
- package/build/src/akuma/providers/codex-app-server/index.js +25 -13
- package/build/src/akuma/providers/grok-build/index.js +22 -25
- package/build/src/akuma/providers/index.js +2 -18
- package/build/src/akuma/providers/opencode-sdk/events.js +32 -18
- package/build/src/akuma/providers/opencode-sdk/index.js +26 -17
- package/build/src/akuma/providers/opencode-sdk/session.js +21 -5
- package/build/src/akuma/providers/pi/events.js +26 -19
- package/build/src/akuma/providers/pi/index.js +58 -40
- package/build/src/akuma/publication.js +9 -9
- package/build/src/akuma/request-execution.d.ts +6 -0
- package/build/src/akuma/request-execution.js +86 -0
- package/build/src/akuma/request-serve.d.ts +12 -1
- package/build/src/akuma/request-serve.js +19 -122
- package/build/src/akuma/request-wire.d.ts +2 -2
- package/build/src/akuma/request-wire.js +75 -102
- package/build/src/akuma/requests.js +2 -2
- package/build/src/akuma/{body-turn.d.ts → turn-drive.d.ts} +2 -25
- package/build/src/akuma/{body-turn.js → turn-drive.js} +20 -103
- package/build/src/akuma-body.js +6 -5
- package/build/src/body/amend.d.ts +4 -1
- package/build/src/body/amend.js +14 -6
- package/build/src/body/decode.js +2 -4
- package/build/src/body/envelope.js +2 -4
- package/build/src/body/region.d.ts +1 -2
- package/build/src/body/region.js +2 -70
- package/build/src/body/render.js +17 -12
- package/build/src/body/shape.js +1 -7
- package/build/src/cli/accepted.d.ts +1 -1
- package/build/src/cli/accepted.js +8 -1
- package/build/src/cli/commands/akuma-invoke.js +18 -6
- package/build/src/cli/commands/akuma.d.ts +0 -6
- package/build/src/cli/commands/akuma.js +11 -24
- package/build/src/cli/commands/amend.d.ts +2 -2
- package/build/src/cli/commands/amend.js +2 -4
- package/build/src/cli/commands/bind.d.ts +4 -4
- package/build/src/cli/commands/bind.js +16 -6
- package/build/src/cli/commands/contract-invoke.d.ts +25 -0
- package/build/src/cli/commands/contract-invoke.js +193 -0
- package/build/src/cli/commands/contract.d.ts +109 -10
- package/build/src/cli/commands/contract.js +339 -16
- package/build/src/cli/commands/install.d.ts +1 -1
- package/build/src/cli/commands/install.js +23 -15
- package/build/src/cli/commands/task-invoke.js +187 -67
- package/build/src/cli/commands/task-query.js +48 -24
- package/build/src/cli/commands/task.js +150 -38
- package/build/src/cli/coordinates.js +2 -4
- package/build/src/cli/invoke.js +92 -208
- package/build/src/cli/main.js +4 -2
- package/build/src/cli/parse.d.ts +3 -90
- package/build/src/cli/parse.js +27 -233
- package/build/src/cli/render/akuma-activity.d.ts +38 -0
- package/build/src/cli/render/akuma-activity.js +362 -0
- package/build/src/cli/render/akuma-tool-command.js +6 -7
- package/build/src/cli/render/akuma-tool.js +10 -8
- package/build/src/cli/render/akuma.d.ts +1 -1
- package/build/src/cli/render/akuma.js +61 -353
- package/build/src/cli/render/audit.js +5 -15
- package/build/src/cli/render/board.d.ts +1 -0
- package/build/src/cli/render/board.js +17 -0
- package/build/src/cli/render/catalog.js +81 -8
- package/build/src/cli/render/contract-history.d.ts +2 -0
- package/build/src/cli/render/contract-history.js +83 -0
- package/build/src/cli/render/contract-observation.d.ts +10 -0
- package/build/src/cli/render/contract-observation.js +58 -0
- package/build/src/cli/render/contract.d.ts +1 -2
- package/build/src/cli/render/contract.js +41 -142
- package/build/src/cli/render/kanshi.js +239 -215
- package/build/src/cli/render/receipt.js +2 -9
- package/build/src/cli/render/refusal.js +10 -15
- package/build/src/cli/render/region.js +22 -6
- package/build/src/cli/render/settings.js +4 -4
- package/build/src/cli/render/task.js +34 -14
- package/build/src/cli/render/terminal.js +16 -5
- package/build/src/cli/result.d.ts +3 -3
- package/build/src/cli/runtime.d.ts +6 -1
- package/build/src/cli/runtime.js +84 -63
- package/build/src/cli/selectors.js +2 -4
- package/build/src/cli/usage.js +6 -5
- package/build/src/contract-worktree.d.ts +1 -23
- package/build/src/contract-worktree.js +79 -155
- package/build/src/coordination/durable-file.js +7 -3
- package/build/src/coordination/sqlite-transaction-lock.js +29 -12
- package/build/src/core/facts/codec.js +7 -3
- package/build/src/core/facts/types.d.ts +1 -1
- package/build/src/core/subject.js +16 -9
- package/build/src/core/verbs/abandon.d.ts +1 -1
- package/build/src/core/verbs/abandon.js +1 -1
- package/build/src/core/verbs/amend.d.ts +1 -1
- package/build/src/core/verbs/amend.js +7 -7
- package/build/src/core/verbs/attestation.js +4 -1
- package/build/src/core/verbs/bind.d.ts +1 -1
- package/build/src/core/verbs/bind.js +1 -1
- package/build/src/core/verbs/placement.d.ts +1 -1
- package/build/src/core/verbs/placement.js +10 -8
- package/build/src/dispatch/index.js +8 -6
- package/build/src/duration.js +5 -1
- package/build/src/git/admission.js +5 -3
- package/build/src/git/hooks.d.ts +8 -0
- package/build/src/git/hooks.js +63 -14
- package/build/src/git/identity.js +1 -4
- package/build/src/git/integration.d.ts +2 -3
- package/build/src/git/integration.js +32 -39
- package/build/src/git/nuke.d.ts +1 -1
- package/build/src/git/nuke.js +110 -57
- package/build/src/git/observe.d.ts +13 -1
- package/build/src/git/observe.js +51 -44
- package/build/src/git/process.js +4 -2
- package/build/src/git/read-observation.js +10 -8
- package/build/src/git/reconcile.d.ts +22 -2
- package/build/src/git/reconcile.js +38 -274
- package/build/src/git/repository.d.ts +2 -0
- package/build/src/git/repository.js +13 -22
- package/build/src/git/scratch.d.ts +8 -5
- package/build/src/git/scratch.js +29 -2
- package/build/src/git/target-placement.d.ts +9 -10
- package/build/src/git/target-placement.js +59 -62
- package/build/src/git/tender.js +13 -46
- package/build/src/git/terminal-reconcile.d.ts +21 -0
- package/build/src/git/terminal-reconcile.js +278 -0
- package/build/src/git/terminal-seal.js +15 -12
- package/build/src/git/tree.js +5 -2
- package/build/src/git/workspace.d.ts +24 -2
- package/build/src/git/workspace.js +120 -16
- package/build/src/identity/coordinates.js +3 -1
- package/build/src/identity/selector.js +6 -3
- package/build/src/kanshi/fleet.d.ts +6 -0
- package/build/src/kanshi/fleet.js +27 -0
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/read.js +60 -48
- package/build/src/kanshi/report.d.ts +11 -23
- package/build/src/kanshi/select.js +25 -24
- package/build/src/library/address.d.ts +2 -1
- package/build/src/library/address.js +7 -8
- package/build/src/library/akuma-creation.js +20 -12
- package/build/src/library/audit.d.ts +0 -1
- package/build/src/library/audit.js +1 -2
- package/build/src/library/bind.d.ts +53 -5
- package/build/src/library/bind.js +98 -22
- package/build/src/library/catalog.d.ts +1 -0
- package/build/src/library/catalog.js +6 -3
- package/build/src/library/configuration.js +3 -1
- package/build/src/library/continuation.d.ts +15 -4
- package/build/src/library/continuation.js +24 -16
- package/build/src/library/contract-bind.d.ts +26 -0
- package/build/src/library/contract-bind.js +106 -0
- package/build/src/library/contract-operations.d.ts +77 -0
- package/build/src/library/contract-operations.js +130 -0
- package/build/src/library/contract-types.d.ts +95 -0
- package/build/src/library/contract-types.js +1 -0
- package/build/src/library/contract.d.ts +19 -154
- package/build/src/library/contract.js +46 -261
- package/build/src/library/fleet.d.ts +1 -1
- package/build/src/library/fleet.js +19 -11
- package/build/src/library/input.d.ts +2 -0
- package/build/src/library/input.js +14 -0
- package/build/src/library/keiyaku.d.ts +8 -7
- package/build/src/library/keiyaku.js +3 -3
- package/build/src/library/nuke.js +14 -5
- package/build/src/library/reconcile.d.ts +9 -4
- package/build/src/library/reconcile.js +30 -24
- package/build/src/library/refusal.d.ts +13 -5
- package/build/src/library/refusal.js +7 -0
- package/build/src/library/region.d.ts +8 -7
- package/build/src/library/region.js +31 -11
- package/build/src/library/repo.js +2 -2
- package/build/src/markdown/lex.js +9 -2
- package/build/src/markdown/parse.js +11 -7
- package/build/src/markdown/query.js +4 -2
- package/build/src/protocol/amend.js +3 -1
- package/build/src/protocol/attempt.d.ts +7 -3
- package/build/src/protocol/attempt.js +9 -5
- package/build/src/protocol/audit.d.ts +1 -1
- package/build/src/protocol/audit.js +4 -14
- package/build/src/protocol/bind.d.ts +19 -6
- package/build/src/protocol/bind.js +28 -13
- package/build/src/protocol/completion.d.ts +0 -1
- package/build/src/protocol/completion.js +1 -3
- package/build/src/protocol/deliver.d.ts +1 -3
- package/build/src/protocol/deliver.js +15 -39
- package/build/src/protocol/intent.d.ts +1 -0
- package/build/src/protocol/intent.js +9 -7
- package/build/src/protocol/operations.d.ts +3 -7
- package/build/src/protocol/operations.js +5 -3
- package/build/src/protocol/placement.d.ts +0 -1
- package/build/src/protocol/placement.js +6 -6
- package/build/src/protocol/read/observation.d.ts +11 -0
- package/build/src/protocol/read/observation.js +37 -0
- package/build/src/protocol/read/status.d.ts +23 -12
- package/build/src/protocol/read/status.js +90 -72
- package/build/src/protocol/reconcile.d.ts +1 -0
- package/build/src/protocol/reconcile.js +2 -3
- package/build/src/protocol/reintegrate.js +1 -1
- package/build/src/protocol/review.d.ts +0 -1
- package/build/src/protocol/review.js +15 -22
- package/build/src/protocol/run.d.ts +1 -0
- package/build/src/protocol/run.js +4 -5
- package/build/src/runtime/proc/launch.d.ts +33 -0
- package/build/src/runtime/proc/launch.js +98 -0
- package/build/src/runtime/proc/line-rpc.js +9 -3
- package/build/src/runtime/proc/run.d.ts +12 -6
- package/build/src/runtime/proc/run.js +78 -21
- package/build/src/runtime/proc/stdio.js +7 -10
- package/build/src/settings.js +6 -2
- package/build/src/settlement/holder.js +13 -10
- package/build/src/settlement/settle.js +39 -6
- package/build/src/task/board.js +12 -6
- package/build/src/task/compose.js +85 -22
- package/build/src/task/context.js +21 -8
- package/build/src/task/document.js +46 -10
- package/build/src/task/identity.js +5 -2
- package/build/src/task/index.d.ts +0 -1
- package/build/src/task/index.js +119 -34
- package/build/src/task/input.js +29 -7
- package/build/src/task/mutation.js +61 -19
- package/build/src/task/operations.d.ts +6 -1
- package/build/src/task/operations.js +83 -29
- package/build/src/task/query.js +55 -26
- package/build/src/task/store.d.ts +3 -1
- package/build/src/task/store.js +81 -17
- package/build/src/verification/execution.js +14 -11
- package/build/src/workspace-place.js +19 -7
- package/build/src/world.js +16 -6
- package/package.json +8 -3
package/build/src/cli/parse.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { isTaskAction, parseTaskCommand, renderTaskHelp, renderTaskUsage, } from "./commands/task.js";
|
|
2
|
-
import { isAkumaAction,
|
|
3
|
-
import { INSTALL_USAGE, parseInstallCommand, renderInstallHelp } from "./commands/install.js";
|
|
4
|
-
import { CONTRACT_COMMAND_SPECS, } from "./commands/contract.js";
|
|
5
|
-
import { CliUsageError, isBlankInput
|
|
2
|
+
import { isAkumaAction, parseAkumaCommand, renderAkumaHelp, renderAkumaRootRows, renderAkumaUsage, } from "./commands/akuma.js";
|
|
3
|
+
import { INSTALL_USAGE, parseInstallCommand, renderInstallHelp, } from "./commands/install.js";
|
|
4
|
+
import { CONTRACT_COMMAND_SPECS, parseContractCommand, renderContractHelp as renderContractHelpForOwner, renderContractUsage, } from "./commands/contract.js";
|
|
5
|
+
import { CliUsageError, isBlankInput } from "./usage.js";
|
|
6
6
|
export { CliUsageError } from "./usage.js";
|
|
7
|
+
export { renderContractHelp } from "./commands/contract.js";
|
|
7
8
|
const ROOT_USAGE = "usage: keiyaku [-C <path>] [--repo <path>] <command> [<contract>|@<contract>] [--flag ...] [-]";
|
|
8
9
|
export function renderRootHelp() {
|
|
9
10
|
return [
|
|
@@ -22,13 +23,8 @@ export function renderRootHelp() {
|
|
|
22
23
|
...renderAkumaRootRows(),
|
|
23
24
|
].join("\n");
|
|
24
25
|
}
|
|
25
|
-
export function renderContractHelp(command) {
|
|
26
|
-
const spec = CONTRACT_COMMAND_SPECS[command];
|
|
27
|
-
const help = `${spec.purpose}\n\n${usageLine(spec.usage)}`;
|
|
28
|
-
return spec.help === undefined ? help : `${help}\n\n${spec.help}`;
|
|
29
|
-
}
|
|
30
26
|
function contractUsage(command) {
|
|
31
|
-
return
|
|
27
|
+
return renderContractUsage(command);
|
|
32
28
|
}
|
|
33
29
|
export function renderCommandUsage(command) {
|
|
34
30
|
if (command.command === "install")
|
|
@@ -41,11 +37,16 @@ export function renderCommandUsage(command) {
|
|
|
41
37
|
}
|
|
42
38
|
export function renderHelp(coordinate) {
|
|
43
39
|
switch (coordinate.kind) {
|
|
44
|
-
case "root":
|
|
45
|
-
|
|
46
|
-
case "
|
|
47
|
-
|
|
48
|
-
case "
|
|
40
|
+
case "root":
|
|
41
|
+
return renderRootHelp();
|
|
42
|
+
case "contract":
|
|
43
|
+
return renderContractHelpForOwner(coordinate.command);
|
|
44
|
+
case "task":
|
|
45
|
+
return renderTaskHelp(coordinate.action);
|
|
46
|
+
case "install":
|
|
47
|
+
return renderInstallHelp();
|
|
48
|
+
case "akuma":
|
|
49
|
+
return renderAkumaHelp(coordinate.action);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
export function commandRepoPolicy(command) {
|
|
@@ -98,18 +99,12 @@ export function assertExplicitRepoUse(command, repo) {
|
|
|
98
99
|
if (repo !== undefined && !commandRepoPolicy(command).acceptsExplicit)
|
|
99
100
|
refuseUnusedRepo(command);
|
|
100
101
|
}
|
|
101
|
-
function optionalFlag(flags, name) {
|
|
102
|
-
const value = flags[name];
|
|
103
|
-
return typeof value === "string" ? value : undefined;
|
|
104
|
-
}
|
|
105
102
|
function refuse(command, message) {
|
|
106
103
|
throw new CliUsageError(message, contractUsage(command));
|
|
107
104
|
}
|
|
108
|
-
function scanStdin(command, state
|
|
105
|
+
function scanStdin(command, state) {
|
|
109
106
|
if (state.stdin)
|
|
110
107
|
refuse(command, "stdin marker '-' may appear only once");
|
|
111
|
-
if (index !== length - 1)
|
|
112
|
-
refuse(command, "stdin marker '-' must be the final argument");
|
|
113
108
|
if (CONTRACT_COMMAND_SPECS[command].stdin === "none")
|
|
114
109
|
refuse(command, `${command} reads no stdin`);
|
|
115
110
|
state.stdin = true;
|
|
@@ -155,7 +150,7 @@ function scanArgv(argv) {
|
|
|
155
150
|
for (let index = 1; index < argv.length; index += 1) {
|
|
156
151
|
const token = argv[index];
|
|
157
152
|
if (token === "-") {
|
|
158
|
-
scanStdin(command, state
|
|
153
|
+
scanStdin(command, state);
|
|
159
154
|
continue;
|
|
160
155
|
}
|
|
161
156
|
if (token.startsWith("--")) {
|
|
@@ -176,174 +171,19 @@ function scanArgv(argv) {
|
|
|
176
171
|
refuse(command, `${command} requires stdin`);
|
|
177
172
|
}
|
|
178
173
|
const output = state.flags.json === true ? "json" : "text";
|
|
179
|
-
const actor =
|
|
174
|
+
const actor = typeof state.flags.actor === "string" ? state.flags.actor : undefined;
|
|
180
175
|
return { command, ...state, output, ...(actor === undefined ? {} : { actor }) };
|
|
181
176
|
}
|
|
182
|
-
function parseBind(parts) {
|
|
183
|
-
const task = optionalFlag(parts.flags, "task");
|
|
184
|
-
const target = optionalFlag(parts.flags, "target");
|
|
185
|
-
const after = parts.flags.after === undefined ? [] : Array.isArray(parts.flags.after) ? parts.flags.after : [parts.flags.after];
|
|
186
|
-
const gates = parseGateBundleNames(parts, "bind");
|
|
187
|
-
return {
|
|
188
|
-
command: "bind",
|
|
189
|
-
...(task === undefined ? {} : { task }),
|
|
190
|
-
...(target === undefined ? {} : { target }),
|
|
191
|
-
...(parts.flags.here === true ? { workspace: "here" } : {}),
|
|
192
|
-
...(parts.flags.after === undefined ? {} : { after }),
|
|
193
|
-
...(gates === undefined ? {} : { gates }),
|
|
194
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
195
|
-
output: parts.output,
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function parseAmend(parts) {
|
|
199
|
-
const contract = parts.positionals[0];
|
|
200
|
-
const after = parts.flags.after === undefined ? [] : Array.isArray(parts.flags.after) ? parts.flags.after : [parts.flags.after];
|
|
201
|
-
if (parts.flags["clear-after"] === true && after.length > 0)
|
|
202
|
-
refuse("amend", "--clear-after and --after are mutually exclusive");
|
|
203
|
-
const gates = parseGateBundleNames(parts, "amend");
|
|
204
|
-
if (!parts.stdin && parts.flags.after === undefined && parts.flags["clear-after"] !== true && gates === undefined) {
|
|
205
|
-
refuse("amend", "amend requires stdin or --after, --clear-after, or --gates");
|
|
206
|
-
}
|
|
207
|
-
return {
|
|
208
|
-
command: "amend",
|
|
209
|
-
...(contract === undefined ? {} : { contract }),
|
|
210
|
-
...(parts.flags.after === undefined ? {} : { after }),
|
|
211
|
-
...(parts.flags["clear-after"] === true ? { clearAfter: true } : {}),
|
|
212
|
-
...(gates === undefined ? {} : { gates }),
|
|
213
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
214
|
-
...(parts.stdin ? { stdin: true } : {}),
|
|
215
|
-
output: parts.output,
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
function parseGateBundleNames(parts, command) {
|
|
219
|
-
const value = optionalFlag(parts.flags, "gates");
|
|
220
|
-
if (value === undefined)
|
|
221
|
-
return undefined;
|
|
222
|
-
const names = value.split(",");
|
|
223
|
-
if (names.some((name) => name.length === 0)) {
|
|
224
|
-
refuse(command, "--gates requires nonempty comma-separated names");
|
|
225
|
-
}
|
|
226
|
-
return names;
|
|
227
|
-
}
|
|
228
|
-
function parseDeliver(parts) {
|
|
229
|
-
const contract = parts.positionals[0];
|
|
230
|
-
const message = optionalFlag(parts.flags, "message");
|
|
231
|
-
return {
|
|
232
|
-
command: "deliver",
|
|
233
|
-
...(contract === undefined ? {} : { contract }),
|
|
234
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
235
|
-
...(message === undefined ? {} : { message }),
|
|
236
|
-
includeDirty: parts.flags["include-dirty"] === true,
|
|
237
|
-
materializeConflict: parts.flags["materialize-conflict"] === true,
|
|
238
|
-
output: parts.output,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function parseReview(parts) {
|
|
242
|
-
if (Number(parts.flags.satisfied === true) + Number(parts.flags.unsatisfied === true) !== 1) {
|
|
243
|
-
refuse("review", "review requires exactly one verdict flag");
|
|
244
|
-
}
|
|
245
|
-
const summary = optionalFlag(parts.flags, "summary");
|
|
246
|
-
if (parts.stdin === (summary !== undefined)) {
|
|
247
|
-
refuse("review", "review requires exactly one of --summary <text> or stdin '-'");
|
|
248
|
-
}
|
|
249
|
-
const contract = parts.positionals[0];
|
|
250
|
-
return {
|
|
251
|
-
command: "review",
|
|
252
|
-
...(contract === undefined ? {} : { contract }),
|
|
253
|
-
verdict: parts.flags.satisfied === true ? "satisfied" : "unsatisfied",
|
|
254
|
-
...(summary === undefined ? {} : { summary }),
|
|
255
|
-
...(parts.stdin ? { summaryFromStdin: true } : {}),
|
|
256
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
257
|
-
output: parts.output,
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
function parseArc(parts) {
|
|
261
|
-
const contract = parts.positionals[0];
|
|
262
|
-
return {
|
|
263
|
-
command: "arc",
|
|
264
|
-
...(contract === undefined ? {} : { contract }),
|
|
265
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
266
|
-
output: parts.output,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
function parseAbandon(parts) {
|
|
270
|
-
const contract = parts.positionals[0];
|
|
271
|
-
const note = optionalFlag(parts.flags, "note");
|
|
272
|
-
return {
|
|
273
|
-
command: "abandon",
|
|
274
|
-
...(contract === undefined ? {} : { contract }),
|
|
275
|
-
...(note === undefined ? {} : { note }),
|
|
276
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
277
|
-
output: parts.output,
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
function parseStatus(parts) {
|
|
281
|
-
const contract = parts.positionals[0];
|
|
282
|
-
if (contract?.startsWith("aku/") === true) {
|
|
283
|
-
return {
|
|
284
|
-
command: "status",
|
|
285
|
-
contract,
|
|
286
|
-
akuma: true,
|
|
287
|
-
output: parts.output,
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
return {
|
|
291
|
-
command: "status",
|
|
292
|
-
...(contract === undefined ? {} : { contract }),
|
|
293
|
-
output: parts.output,
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
function parseShow(parts) {
|
|
297
|
-
const contract = parts.positionals[0];
|
|
298
|
-
return { command: "show", ...(contract === undefined ? {} : { contract }), output: parts.output };
|
|
299
|
-
}
|
|
300
|
-
function parseRegion(parts) {
|
|
301
|
-
const contract = parts.positionals[0];
|
|
302
|
-
const path = optionalFlag(parts.flags, "path");
|
|
303
|
-
const overlap = parts.flags.overlap === true;
|
|
304
|
-
if (path !== undefined && (contract !== undefined || overlap))
|
|
305
|
-
refuse("region", "--path cannot combine with a contract or --overlap");
|
|
306
|
-
return {
|
|
307
|
-
command: "region",
|
|
308
|
-
...(contract === undefined ? {} : { contract }),
|
|
309
|
-
...(path === undefined ? {} : { path }),
|
|
310
|
-
overlap,
|
|
311
|
-
output: parts.output,
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
function parseLs(parts) {
|
|
315
|
-
const path = parts.positionals[0];
|
|
316
|
-
if (path === "task" || path === "task/")
|
|
317
|
-
return { command: "ls", query: { kind: "tasks" }, output: parts.output };
|
|
318
|
-
if (path === "kei" || path === "kei/")
|
|
319
|
-
return { command: "ls", query: { kind: "contracts" }, output: parts.output };
|
|
320
|
-
try {
|
|
321
|
-
const query = parseAkumaCatalogPath(path);
|
|
322
|
-
if (query === null)
|
|
323
|
-
refuse("ls", "ls requires a supported identity directory selector");
|
|
324
|
-
return { command: "ls", query, output: parts.output };
|
|
325
|
-
}
|
|
326
|
-
catch (error) {
|
|
327
|
-
if (error instanceof CliUsageError)
|
|
328
|
-
throw error;
|
|
329
|
-
refuse("ls", error instanceof Error ? error.message : "invalid ls directory");
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
177
|
function invocationOptions(argv) {
|
|
333
178
|
let cwd;
|
|
334
179
|
let repo;
|
|
335
|
-
let stdinSeen = false;
|
|
336
180
|
const commandArgv = [];
|
|
337
181
|
for (let index = 0; index < argv.length; index += 1) {
|
|
338
182
|
const token = argv[index];
|
|
339
183
|
if (token !== "-C" && token !== "--cwd" && token !== "--repo") {
|
|
340
184
|
commandArgv.push(token);
|
|
341
|
-
if (token === "-")
|
|
342
|
-
stdinSeen = true;
|
|
343
185
|
continue;
|
|
344
186
|
}
|
|
345
|
-
if (stdinSeen)
|
|
346
|
-
throw new CliUsageError("stdin marker '-' must be the final argument", renderRootHelp());
|
|
347
187
|
if (token === "--repo" && repo !== undefined) {
|
|
348
188
|
throw new CliUsageError("--repo may appear only once", renderRootHelp());
|
|
349
189
|
}
|
|
@@ -385,68 +225,22 @@ function helpCoordinate(argv) {
|
|
|
385
225
|
}
|
|
386
226
|
return { kind: "root" };
|
|
387
227
|
}
|
|
388
|
-
function parseCommand(parts) {
|
|
389
|
-
switch (parts.command) {
|
|
390
|
-
case "bind": return parseBind(parts);
|
|
391
|
-
case "amend": return parseAmend(parts);
|
|
392
|
-
case "deliver": return parseDeliver(parts);
|
|
393
|
-
case "review": return parseReview(parts);
|
|
394
|
-
case "arc": return parseArc(parts);
|
|
395
|
-
case "abandon": return parseAbandon(parts);
|
|
396
|
-
case "status": return parseStatus(parts);
|
|
397
|
-
case "show": return parseShow(parts);
|
|
398
|
-
case "ls": return parseLs(parts);
|
|
399
|
-
case "audit": {
|
|
400
|
-
const contract = parts.positionals[0];
|
|
401
|
-
return {
|
|
402
|
-
command: "audit",
|
|
403
|
-
...(contract === undefined ? {} : { contract }),
|
|
404
|
-
includeDirty: parts.flags["include-dirty"] === true,
|
|
405
|
-
showDiff: parts.flags.diff === true,
|
|
406
|
-
...(parts.actor === undefined ? {} : { actor: parts.actor }),
|
|
407
|
-
output: parts.output,
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
case "reconcile": {
|
|
411
|
-
const contract = parts.positionals[0];
|
|
412
|
-
return {
|
|
413
|
-
command: "reconcile",
|
|
414
|
-
...(contract === undefined ? {} : { contract }),
|
|
415
|
-
retryHooks: parts.flags["retry-hooks"] === true,
|
|
416
|
-
output: parts.output,
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
case "nuke": {
|
|
420
|
-
const confirm = optionalFlag(parts.flags, "confirm");
|
|
421
|
-
return { command: "nuke", ...(confirm === undefined ? {} : { confirm }), output: parts.output };
|
|
422
|
-
}
|
|
423
|
-
case "settings": return { command: "settings", output: parts.output };
|
|
424
|
-
case "region": return parseRegion(parts);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
228
|
export function parseArgv(argv) {
|
|
428
229
|
const invocation = invocationOptions(argv);
|
|
429
230
|
const help = helpCoordinate(invocation.commandArgv);
|
|
430
231
|
if (help !== null)
|
|
431
232
|
return { help };
|
|
432
|
-
if (invocation.commandArgv[0] === "ls"
|
|
433
|
-
|
|
434
|
-
|
|
233
|
+
if (invocation.commandArgv[0] === "ls" &&
|
|
234
|
+
(invocation.commandArgv.length === 1 ||
|
|
235
|
+
(invocation.commandArgv.length === 2 && invocation.commandArgv[1] === "--json"))) {
|
|
435
236
|
return { help: { kind: "contract", command: "ls" } };
|
|
436
237
|
}
|
|
437
|
-
const task = invocation.commandArgv[0] === "task"
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
? parseInstallCommand(invocation.commandArgv.slice(1))
|
|
442
|
-
: undefined;
|
|
443
|
-
const akuma = isAkumaAction(invocation.commandArgv[0])
|
|
444
|
-
? parseAkumaCommand(invocation.commandArgv)
|
|
445
|
-
: undefined;
|
|
446
|
-
const parsed = {
|
|
238
|
+
const task = invocation.commandArgv[0] === "task" ? parseTaskCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
239
|
+
const install = invocation.commandArgv[0] === "install" ? parseInstallCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
240
|
+
const akuma = isAkumaAction(invocation.commandArgv[0]) ? parseAkumaCommand(invocation.commandArgv) : undefined;
|
|
241
|
+
return {
|
|
447
242
|
...(invocation.cwd === undefined ? {} : { cwd: invocation.cwd }),
|
|
448
243
|
...(invocation.repo === undefined ? {} : { repo: invocation.repo }),
|
|
449
|
-
command: task ?? akuma ?? install ??
|
|
244
|
+
command: task ?? akuma ?? install ?? parseContractCommand(scanArgv(invocation.commandArgv)),
|
|
450
245
|
};
|
|
451
|
-
return parsed;
|
|
452
246
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AkumaObservation, AkumaObservationStage, CreatedTaskObservation, DispatchAssociation } from "../../index.js";
|
|
2
|
+
import type { AkumaInvocationResult } from "../commands/akuma-invoke.js";
|
|
3
|
+
import type { ParsedCommand } from "../parse.js";
|
|
4
|
+
import { type TextRenderContext } from "./terminal.js";
|
|
5
|
+
export declare const DEFAULT_CONTEXT: TextRenderContext;
|
|
6
|
+
export declare function associatedIdentity(id: string, alias?: string, contract?: DispatchAssociation): string;
|
|
7
|
+
export declare function snapshotHeading(id: string, alias: string | undefined, contract: DispatchAssociation | undefined): readonly string[];
|
|
8
|
+
type SnapshotView = Readonly<{
|
|
9
|
+
status: AkumaObservation["status"];
|
|
10
|
+
contract: DispatchAssociation;
|
|
11
|
+
createdTasks?: CreatedTaskObservation;
|
|
12
|
+
}>;
|
|
13
|
+
type SnapshotCoreOptions = Readonly<{
|
|
14
|
+
alias?: string;
|
|
15
|
+
facts?: readonly string[];
|
|
16
|
+
}>;
|
|
17
|
+
export declare function snapshotText(view: SnapshotView, context: TextRenderContext, options?: SnapshotCoreOptions): string;
|
|
18
|
+
export declare function mutationObservationStageText(id: string, observation: AkumaObservationStage, context: TextRenderContext, options?: SnapshotCoreOptions & Readonly<{
|
|
19
|
+
showLife?: boolean;
|
|
20
|
+
}>): string;
|
|
21
|
+
export declare function statusAnswer(view: Readonly<{
|
|
22
|
+
status: AkumaObservation["status"];
|
|
23
|
+
}>): string | undefined;
|
|
24
|
+
export declare function akumaRawAnswer(result: AkumaInvocationResult): string | undefined;
|
|
25
|
+
export declare function waitText(result: Extract<AkumaInvocationResult, {
|
|
26
|
+
action: "wait";
|
|
27
|
+
}>, context: TextRenderContext): string;
|
|
28
|
+
export declare function historyText(command: Extract<ParsedCommand, {
|
|
29
|
+
command: "history";
|
|
30
|
+
last: boolean;
|
|
31
|
+
}>, result: Extract<AkumaInvocationResult, {
|
|
32
|
+
action: "history";
|
|
33
|
+
}>, context: TextRenderContext): string;
|
|
34
|
+
export declare function tellText(result: Extract<AkumaInvocationResult, {
|
|
35
|
+
action: "tell";
|
|
36
|
+
mode: "ordinary";
|
|
37
|
+
}>, context: TextRenderContext): string;
|
|
38
|
+
export {};
|