@astrosheep/keiyaku 4.6.7 → 4.6.9
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 +46 -16
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/opencode/index.js +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/pi/keiyaku.ts +0 -5
- package/build/skills/keiyaku/SKILL.md +5 -6
- package/build/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/src/akuma/akuma-call.d.ts +2 -0
- package/build/src/akuma/akuma-call.js +8 -2
- package/build/src/akuma/akuma-instance.d.ts +14 -1
- package/build/src/akuma/akuma-instance.js +37 -7
- package/build/src/akuma/akuma-observe.d.ts +33 -8
- package/build/src/akuma/akuma-observe.js +89 -63
- package/build/src/akuma/akuma-owner.d.ts +14 -2
- package/build/src/akuma/akuma-owner.js +49 -35
- package/build/src/akuma/akuma-selection-execution.js +9 -1
- package/build/src/akuma/akuma-stream.d.ts +22 -0
- package/build/src/akuma/akuma-stream.js +116 -0
- package/build/src/akuma/akuma-wait.d.ts +1 -40
- package/build/src/akuma/akuma-wait.js +23 -84
- package/build/src/akuma/akuma.d.ts +52 -16
- package/build/src/akuma/akuma.js +10 -10
- package/build/src/akuma/allowed.d.ts +7 -12
- package/build/src/akuma/allowed.js +13 -4
- package/build/src/akuma/archetype.d.ts +7 -15
- package/build/src/akuma/archetype.js +36 -35
- package/build/src/akuma/body-supervisor.d.ts +5 -5
- package/build/src/akuma/body-supervisor.js +22 -20
- package/build/src/akuma/body.d.ts +5 -3
- package/build/src/akuma/body.js +57 -8
- package/build/src/akuma/call-request.d.ts +30 -32
- package/build/src/akuma/call-request.js +10 -3
- package/build/src/akuma/caller.d.ts +39 -0
- package/build/src/akuma/caller.js +36 -0
- package/build/src/akuma/dispatch-association.d.ts +0 -1
- package/build/src/akuma/dispatch-association.js +0 -3
- package/build/src/akuma/heart/activity-schema.d.ts +12 -0
- package/build/src/akuma/heart/activity-schema.js +6 -0
- package/build/src/akuma/heart/facts.d.ts +16 -12
- package/build/src/akuma/heart/facts.js +8 -0
- package/build/src/akuma/heart/index.d.ts +61 -9
- package/build/src/akuma/heart/index.js +89 -24
- package/build/src/akuma/heart/rows.d.ts +3 -3
- package/build/src/akuma/heart/rows.js +5 -3
- package/build/src/akuma/heart/soul.d.ts +10 -1
- package/build/src/akuma/heart/soul.js +34 -24
- package/build/src/akuma/heart/storage.d.ts +20 -0
- package/build/src/akuma/heart/storage.js +62 -3
- package/build/src/akuma/heart/timeline.d.ts +7 -0
- package/build/src/akuma/heart/timeline.js +10 -0
- package/build/src/akuma/identity.d.ts +0 -1
- package/build/src/akuma/identity.js +2 -5
- package/build/src/akuma/index.d.ts +6 -2
- package/build/src/akuma/index.js +1 -0
- package/build/src/akuma/nuke.js +6 -28
- package/build/src/akuma/projection.d.ts +25 -11
- package/build/src/akuma/projection.js +24 -7
- package/build/src/akuma/provider-recipe.d.ts +18 -6
- package/build/src/akuma/provider-recipe.js +24 -1
- package/build/src/akuma/provider.d.ts +31 -10
- package/build/src/akuma/provider.js +105 -14
- package/build/src/akuma/providers/acp/events.js +29 -19
- package/build/src/akuma/providers/acp/index.js +2 -3
- package/build/src/akuma/providers/claude/events.js +110 -69
- package/build/src/akuma/providers/claude/index.d.ts +2 -2
- package/build/src/akuma/providers/claude/index.js +4 -8
- package/build/src/akuma/providers/codex-app-server/events.js +17 -2
- package/build/src/akuma/providers/codex-app-server/index.js +17 -11
- package/build/src/akuma/providers/decode.d.ts +33 -0
- package/build/src/akuma/providers/decode.js +65 -0
- package/build/src/akuma/providers/execution-environment.d.ts +2 -1
- package/build/src/akuma/providers/execution-environment.js +3 -0
- package/build/src/akuma/providers/grok-build/index.js +16 -48
- package/build/src/akuma/providers/index.js +2 -0
- package/build/src/akuma/providers/lifecycle.d.ts +9 -0
- package/build/src/akuma/providers/lifecycle.js +10 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
- package/build/src/akuma/providers/opencode-sdk/events.js +146 -296
- package/build/src/akuma/providers/opencode-sdk/index.js +270 -431
- package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
- package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
- package/build/src/akuma/providers/opencode-sdk/session.js +75 -84
- package/build/src/akuma/providers/paseo/events.d.ts +33 -0
- package/build/src/akuma/providers/paseo/events.js +204 -0
- package/build/src/akuma/providers/paseo/index.d.ts +9 -0
- package/build/src/akuma/providers/paseo/index.js +357 -0
- package/build/src/akuma/providers/pi/events.d.ts +2 -0
- package/build/src/akuma/providers/pi/events.js +36 -38
- package/build/src/akuma/providers/pi/index.js +21 -35
- package/build/src/akuma/publication.d.ts +2 -0
- package/build/src/akuma/publication.js +5 -0
- package/build/src/akuma/request-lifecycle.d.ts +4 -2
- package/build/src/akuma/request-lifecycle.js +27 -12
- package/build/src/akuma/request-rendezvous.js +38 -55
- package/build/src/akuma/request-serve.d.ts +1 -1
- package/build/src/akuma/request-serve.js +77 -113
- package/build/src/akuma/requests.d.ts +3 -1
- package/build/src/akuma/requests.js +32 -0
- package/build/src/akuma/selection-observation.d.ts +129 -53
- package/build/src/akuma/selection-observation.js +3 -9
- package/build/src/akuma/turn-drive.d.ts +3 -0
- package/build/src/akuma/turn-drive.js +28 -10
- package/build/src/akuma-body.js +12 -22
- package/build/src/cli/akuma-caller.d.ts +3 -0
- package/build/src/cli/akuma-caller.js +31 -0
- package/build/src/cli/commands/akuma-grammar.js +10 -16
- package/build/src/cli/commands/akuma.js +25 -55
- package/build/src/cli/commands/contract-grammar.d.ts +9 -7
- package/build/src/cli/commands/contract-grammar.js +40 -47
- package/build/src/cli/commands/contract-help.d.ts +17 -7
- package/build/src/cli/commands/contract-help.js +50 -11
- package/build/src/cli/commands/contract.js +34 -63
- package/build/src/cli/commands/debt-grammar.d.ts +19 -0
- package/build/src/cli/commands/debt-grammar.js +323 -0
- package/build/src/cli/commands/debt-query.d.ts +5 -0
- package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
- package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
- package/build/src/cli/commands/{task.js → debt.js} +87 -164
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/parse.d.ts +5 -5
- package/build/src/cli/parse.js +17 -16
- package/build/src/cli/render/akuma-activity.d.ts +11 -83
- package/build/src/cli/render/akuma-activity.js +20 -382
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +5 -5
- package/build/src/cli/render/contract-history.js +3 -6
- package/build/src/cli/render/contract.js +17 -52
- package/build/src/cli/render/debt.d.ts +28 -0
- package/build/src/cli/render/{task.js → debt.js} +55 -133
- package/build/src/cli/render/kanshi.js +28 -28
- package/build/src/cli/render/marks.d.ts +5 -5
- package/build/src/cli/render/marks.js +4 -10
- package/build/src/cli/render/nuke.js +1 -1
- package/build/src/cli/render/receipt.js +3 -10
- package/build/src/cli/runtime.d.ts +1 -1
- package/build/src/cli/runtime.js +14 -20
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/selectors.d.ts +3 -6
- package/build/src/cli/selectors.js +22 -53
- package/build/src/cli/usage.d.ts +1 -1
- package/build/src/cli/usage.js +4 -4
- package/build/src/contract-worktree.js +3 -3
- package/build/src/debt/board.d.ts +160 -0
- package/build/src/{task → debt}/board.js +89 -89
- package/build/src/debt/catalog.d.ts +11 -0
- package/build/src/debt/catalog.js +59 -0
- package/build/src/{task → debt}/context.d.ts +1 -1
- package/build/src/{task → debt}/context.js +1 -1
- package/build/src/{task → debt}/created-observation.d.ts +6 -10
- package/build/src/{task → debt}/created-observation.js +7 -7
- package/build/src/debt/document.d.ts +37 -0
- package/build/src/{task → debt}/document.js +37 -37
- package/build/src/debt/identity.d.ts +21 -0
- package/build/src/{task → debt}/identity.js +35 -35
- package/build/src/debt/index.d.ts +111 -0
- package/build/src/debt/index.js +203 -0
- package/build/src/{task → debt}/input.d.ts +8 -8
- package/build/src/{task → debt}/input.js +21 -21
- package/build/src/debt/lifecycle-operations.d.ts +6 -0
- package/build/src/{task → debt}/lifecycle-operations.js +27 -31
- package/build/src/debt/mutation-result.d.ts +981 -0
- package/build/src/debt/mutation-result.js +109 -0
- package/build/src/debt/mutation.d.ts +424 -0
- package/build/src/debt/mutation.js +223 -0
- package/build/src/debt/operation-types.d.ts +71 -0
- package/build/src/debt/operations.d.ts +28 -0
- package/build/src/{task → debt}/operations.js +59 -60
- package/build/src/debt/query.d.ts +76 -0
- package/build/src/{task → debt}/query.js +55 -55
- package/build/src/{task → debt}/store.d.ts +13 -13
- package/build/src/{task → debt}/store.js +58 -49
- package/build/src/debt/view.d.ts +4 -0
- package/build/src/debt/view.js +7 -0
- package/build/src/dispatch/index.d.ts +3 -3
- package/build/src/dispatch/index.js +1 -2
- package/build/src/git/observe.d.ts +6 -2
- package/build/src/git/observe.js +6 -2
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/index.d.ts +17 -17
- package/build/src/index.js +11 -11
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/read.js +54 -39
- package/build/src/kanshi/report.d.ts +7 -7
- package/build/src/kanshi/select.js +4 -4
- package/build/src/library/address.js +2 -4
- package/build/src/library/akuma-creation.d.ts +5 -1
- package/build/src/library/akuma-creation.js +27 -47
- package/build/src/library/akumas.d.ts +7 -7
- package/build/src/library/akumas.js +13 -9
- package/build/src/library/bind.d.ts +17 -17
- package/build/src/library/bind.js +16 -12
- package/build/src/library/contract-address.d.ts +9 -0
- package/build/src/library/contract-address.js +71 -0
- package/build/src/library/contract-composition.d.ts +4 -7
- package/build/src/library/contract-composition.js +6 -18
- package/build/src/library/contract-creation.d.ts +3 -5
- package/build/src/library/contract-creation.js +24 -22
- package/build/src/library/contract-execution.js +21 -26
- package/build/src/library/contract-outcomes.d.ts +2 -14
- package/build/src/library/contract-outcomes.js +2 -13
- package/build/src/library/contract-types.d.ts +38 -4
- package/build/src/library/delivery.d.ts +0 -2
- package/build/src/library/delivery.js +2 -5
- package/build/src/library/input.d.ts +2 -2
- package/build/src/library/input.js +5 -5
- package/build/src/library/invocation.js +2 -2
- package/build/src/library/keiyaku.d.ts +0 -5
- package/build/src/library/keiyaku.js +6 -12
- package/build/src/library/nuke.js +3 -3
- package/build/src/library/outcome.d.ts +626 -625
- package/build/src/library/outcome.js +13 -3
- package/build/src/library/reconcile.js +8 -16
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/library/repo.d.ts +3 -2
- package/build/src/library/repo.js +10 -5
- package/build/src/library/selection.d.ts +5 -8
- package/build/src/library/selection.js +22 -73
- package/build/src/plugin/akuma-signals.d.ts +2 -0
- package/build/src/plugin/akuma-signals.js +4 -0
- package/build/src/plugin/public.d.ts +32 -2
- package/build/src/plugin/runtime.js +5 -3
- package/build/src/protocol/amend.js +3 -2
- package/build/src/protocol/attempt.js +3 -8
- package/build/src/protocol/bind.d.ts +2 -2
- package/build/src/protocol/bind.js +1 -1
- package/build/src/protocol/deliver.js +3 -3
- package/build/src/protocol/operations.d.ts +1 -3
- package/build/src/protocol/operations.js +0 -8
- package/build/src/protocol/outcome.d.ts +1 -2
- package/build/src/protocol/outcome.js +1 -13
- package/build/src/protocol/placement.js +3 -10
- package/build/src/protocol/read/status.js +31 -70
- package/build/src/protocol/reintegrate.js +3 -10
- package/build/src/protocol/review.js +3 -3
- package/build/src/protocol/run.d.ts +5 -1
- package/build/src/protocol/run.js +3 -3
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/fence.d.ts +3 -3
- package/build/src/settlement/fence.js +4 -4
- package/build/src/settlement/holder.d.ts +16 -16
- package/build/src/settlement/holder.js +69 -63
- package/build/src/settlement/settle.d.ts +5 -5
- package/build/src/settlement/settle.js +53 -53
- package/package.json +19 -9
- package/plugins/paseo/plugin/index.server.ts +17 -0
- package/plugins/paseo/plugin/paseo-plugin.json +4 -0
- package/plugins/paseo/plugin/server/attach.ts +52 -0
- package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
- package/plugins/paseo/plugin/server/message.ts +60 -0
- package/plugins/paseo/plugin/server/mirror.ts +193 -0
- package/plugins/paseo/plugin/server/model.ts +14 -0
- package/plugins/paseo/plugin/server/provider.ts +276 -0
- package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
- package/plugins/paseo/plugin/server/sdk.ts +289 -0
- package/plugins/paseo/plugin/server/stop.ts +26 -0
- package/plugins/paseo/plugin/server/transport.ts +35 -0
- package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
- package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
- package/plugins/paseo/plugin/tsconfig.json +6 -0
- package/plugins/pi/keiyaku.ts +57 -0
- package/skills/keiyaku/SKILL.md +43 -0
- package/skills/keiyaku-akuma/SKILL.md +130 -0
- package/skills/keiyaku-akuma/references/automation.md +269 -0
- package/skills/keiyaku-babysit/SKILL.md +65 -0
- package/skills/keiyaku-bind/SKILL.md +216 -0
- package/skills/keiyaku-bind/agents/openai.yaml +4 -0
- package/skills/keiyaku-debt/SKILL.md +91 -0
- package/skills/keiyaku-workflow/SKILL.md +129 -0
- package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
- package/build/skills/keiyaku-task/SKILL.md +0 -104
- package/build/src/cli/commands/amend.d.ts +0 -12
- package/build/src/cli/commands/amend.js +0 -10
- package/build/src/cli/commands/bind.d.ts +0 -11
- package/build/src/cli/commands/bind.js +0 -23
- package/build/src/cli/commands/task-grammar.d.ts +0 -19
- package/build/src/cli/commands/task-grammar.js +0 -384
- package/build/src/cli/commands/task-query.d.ts +0 -5
- package/build/src/cli/render/task.d.ts +0 -41
- package/build/src/dispatch/association.d.ts +0 -1
- package/build/src/dispatch/association.js +0 -1
- package/build/src/task/board.d.ts +0 -168
- package/build/src/task/catalog.d.ts +0 -11
- package/build/src/task/catalog.js +0 -59
- package/build/src/task/compose-language.d.ts +0 -57
- package/build/src/task/compose-language.js +0 -364
- package/build/src/task/compose-parser.d.ts +0 -32
- package/build/src/task/compose-parser.js +0 -180
- package/build/src/task/compose.d.ts +0 -16
- package/build/src/task/compose.js +0 -189
- package/build/src/task/document.d.ts +0 -39
- package/build/src/task/identity.d.ts +0 -21
- package/build/src/task/index.d.ts +0 -138
- package/build/src/task/index.js +0 -269
- package/build/src/task/lifecycle-operations.d.ts +0 -6
- package/build/src/task/mutation-result.d.ts +0 -1726
- package/build/src/task/mutation-result.js +0 -198
- package/build/src/task/mutation.d.ts +0 -590
- package/build/src/task/mutation.js +0 -262
- package/build/src/task/operation-types.d.ts +0 -71
- package/build/src/task/operations.d.ts +0 -28
- package/build/src/task/query.d.ts +0 -76
- package/build/src/task/view.d.ts +0 -4
- package/build/src/task/view.js +0 -7
- /package/build/src/{task → debt}/operation-types.js +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { CliUsageError, isBlankInput } from "../usage.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { renderDoctor, renderTaskCompose, renderTaskContext, renderTaskFailure, renderTaskIncompleteDiagnostic, renderTaskLifecycle, renderTaskList, renderTaskMutation, renderTaskShow, renderTaskTree, renderTaskUpdate, taskExitCode, } from "../render/task.js";
|
|
2
|
+
import { parseDebtNamespaceSelector } from "../../debt/catalog.js";
|
|
3
|
+
import { debtsWithExecution, debtRowViewLimit, } from "../../debt/index.js";
|
|
4
|
+
import { installNamespaceContext, resolveDebtNamespaceContext } from "../../debt/context.js";
|
|
5
|
+
import { displayContext, emit, writeJson } from "../streams.js";
|
|
6
|
+
import { renderDoctor, renderDebtContext, renderDebtLifecycle, renderDebtList, renderDebtMutation, renderDebtShow, renderDebtTree, renderDebtUpdate, debtExitCode, } from "../render/debt.js";
|
|
8
7
|
import { actorFromEdge } from "../actor.js";
|
|
9
|
-
import {
|
|
8
|
+
import { debtQuerySelection } from "../../debt/query.js";
|
|
10
9
|
function value(command, name) {
|
|
11
10
|
const item = command.flags[name];
|
|
12
11
|
return typeof item === "string" ? item : undefined;
|
|
@@ -30,40 +29,38 @@ function limit(command) {
|
|
|
30
29
|
const raw = value(command, "limit");
|
|
31
30
|
return raw === undefined ? undefined : Number(raw);
|
|
32
31
|
}
|
|
33
|
-
function
|
|
32
|
+
function validateDebtRowView(command) {
|
|
34
33
|
if (command.action === "ls" ||
|
|
35
34
|
command.action === "ready" ||
|
|
36
35
|
command.action === "blocked" ||
|
|
37
36
|
command.action === "query")
|
|
38
|
-
|
|
37
|
+
debtRowViewLimit(limit(command));
|
|
39
38
|
}
|
|
40
39
|
function explicitListNamespace(command) {
|
|
41
40
|
return command.action === "ls" && command.positionals.length === 1
|
|
42
|
-
?
|
|
41
|
+
? parseDebtNamespaceSelector(command.positionals[0])
|
|
43
42
|
: undefined;
|
|
44
43
|
}
|
|
45
|
-
function
|
|
44
|
+
function debtStdinDiagnostic(command) {
|
|
46
45
|
switch (command.stdin) {
|
|
47
46
|
case "document":
|
|
48
|
-
return "
|
|
49
|
-
case "compose":
|
|
50
|
-
return "task compose requires a nonblank stdin document";
|
|
47
|
+
return "debt add requires a nonblank stdin document";
|
|
51
48
|
case "body":
|
|
52
|
-
return "
|
|
49
|
+
return "debt update --body requires a nonblank value";
|
|
53
50
|
case "append":
|
|
54
|
-
return "
|
|
51
|
+
return "debt update --append requires a nonblank value";
|
|
55
52
|
case "note":
|
|
56
|
-
return "
|
|
53
|
+
return "debt update --note requires a nonblank value";
|
|
57
54
|
default:
|
|
58
55
|
return undefined;
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
async function invokeAdd(input) {
|
|
62
|
-
const {
|
|
59
|
+
const { debts, command, current = [] } = input;
|
|
63
60
|
const selectedNamespace = namespace(value(command, "namespace")) ?? current;
|
|
64
61
|
const actor = input.actor;
|
|
65
62
|
if (command.stdin === "document") {
|
|
66
|
-
return
|
|
63
|
+
return debts.addDocument({
|
|
67
64
|
markdown: input.stdin,
|
|
68
65
|
...(selectedNamespace === undefined ? {} : { namespace: selectedNamespace }),
|
|
69
66
|
...(actor === undefined ? {} : { actor }),
|
|
@@ -72,7 +69,7 @@ async function invokeAdd(input) {
|
|
|
72
69
|
const body = value(command, "body"), note = value(command, "note"), initialState = value(command, "state"), selectedPriority = priority(value(command, "priority"));
|
|
73
70
|
const needs = ids(values(command, "needs")), parent = value(command, "parent");
|
|
74
71
|
const supersedes = ids(values(command, "supersedes")), relates = ids(values(command, "relates"));
|
|
75
|
-
return
|
|
72
|
+
return debts.add({
|
|
76
73
|
title: command.positionals[0],
|
|
77
74
|
...(selectedNamespace === undefined ? {} : { namespace: selectedNamespace }),
|
|
78
75
|
...(body === undefined ? {} : { body }),
|
|
@@ -87,7 +84,7 @@ async function invokeAdd(input) {
|
|
|
87
84
|
});
|
|
88
85
|
}
|
|
89
86
|
function invokeUpdate(input) {
|
|
90
|
-
const {
|
|
87
|
+
const { debts, command, stdin } = input;
|
|
91
88
|
const body = command.stdin === "body" ? stdin : value(command, "body"), appendBody = command.stdin === "append" ? stdin : value(command, "append");
|
|
92
89
|
const note = command.stdin === "note" ? stdin : value(command, "note");
|
|
93
90
|
const title = value(command, "title"), selectedPriority = priority(value(command, "priority"));
|
|
@@ -95,7 +92,7 @@ function invokeUpdate(input) {
|
|
|
95
92
|
const parent = value(command, "parent"), addSupersedes = ids(values(command, "supersedes"));
|
|
96
93
|
const dropSupersedes = ids(values(command, "drop-supersedes")), addRelates = ids(values(command, "relates"));
|
|
97
94
|
const dropRelates = ids(values(command, "drop-relates"));
|
|
98
|
-
return
|
|
95
|
+
return debts.debt({ id: command.positionals[0] }).update({
|
|
99
96
|
...(title === undefined ? {} : { title }),
|
|
100
97
|
...(body === undefined ? {} : { body }),
|
|
101
98
|
...(appendBody === undefined ? {} : { appendBody }),
|
|
@@ -118,21 +115,21 @@ function readScope(command, current) {
|
|
|
118
115
|
return command.flags.world === true ? { scope: "world" } : { namespace: current ?? [] };
|
|
119
116
|
}
|
|
120
117
|
/** One addressed read per caller-supplied id, in caller order; the native null survives to JSON. */
|
|
121
|
-
async function runShow(command,
|
|
122
|
-
const handles = command.positionals.map((
|
|
118
|
+
async function runShow(command, debts) {
|
|
119
|
+
const handles = command.positionals.map((debtId) => debts.debt({ id: debtId }).id);
|
|
123
120
|
const details = [];
|
|
124
121
|
for (const id of handles)
|
|
125
|
-
details.push(await
|
|
122
|
+
details.push(await debts.debt({ id }).read());
|
|
126
123
|
const missing = details.findIndex((detail) => detail === null);
|
|
127
124
|
const code = missing >= 0 ? 1 : 0;
|
|
128
125
|
const projected = handles.length === 1 ? details[0] : details;
|
|
129
126
|
if (missing >= 0) {
|
|
130
|
-
const refusal = { kind: "refused", refusal: { kind: "
|
|
131
|
-
return emit(command.output, projected, () =>
|
|
127
|
+
const refusal = { kind: "refused", refusal: { kind: "debt-missing", debtId: handles[missing] } };
|
|
128
|
+
return emit(command.output, projected, () => renderDebtShow(refusal, displayContext()), code);
|
|
132
129
|
}
|
|
133
130
|
const found = details.filter((detail) => detail !== null);
|
|
134
131
|
const result = found.length === 1 ? found[0] : found;
|
|
135
|
-
return emit(command.output, projected, () =>
|
|
132
|
+
return emit(command.output, projected, () => renderDebtShow(result, displayContext()), code);
|
|
136
133
|
}
|
|
137
134
|
/** Presentation-only list scope the leaf acquired, never part of the native answer. */
|
|
138
135
|
function listPresentation(command) {
|
|
@@ -142,55 +139,49 @@ function listPresentation(command) {
|
|
|
142
139
|
return command.action === "ls" && first !== undefined ? { namespace: first } : "current";
|
|
143
140
|
}
|
|
144
141
|
async function runRead(input) {
|
|
145
|
-
const {
|
|
142
|
+
const { debts, command, current } = input;
|
|
146
143
|
const id = command.positionals[0];
|
|
147
144
|
const scope = listPresentation(command);
|
|
148
145
|
switch (command.action) {
|
|
149
146
|
case "ls": {
|
|
150
|
-
const result = await
|
|
147
|
+
const result = await debts.list({
|
|
151
148
|
selection: command.flags.all === true ? "all" : command.flags.closed === true ? "closed" : "active",
|
|
152
149
|
...(explicitListNamespace(command) === undefined
|
|
153
150
|
? readScope(command, current)
|
|
154
151
|
: { namespace: explicitListNamespace(command) }),
|
|
155
152
|
...(limit(command) === undefined ? {} : { limit: limit(command) }),
|
|
156
153
|
});
|
|
157
|
-
return emit(command.output, result, () =>
|
|
158
|
-
}
|
|
159
|
-
case "ready": {
|
|
160
|
-
const result = await tasks.ready({
|
|
161
|
-
...readScope(command, current),
|
|
162
|
-
...(value(command, "parent") === undefined ? {} : { parent: value(command, "parent") }),
|
|
163
|
-
...(limit(command) === undefined ? {} : { limit: limit(command) }),
|
|
164
|
-
});
|
|
165
|
-
return emit(command.output, result, () => renderTaskList("ready", scope, result, displayContext()), taskExitCode(result));
|
|
154
|
+
return emit(command.output, result, () => renderDebtList("ls", scope, result, displayContext()), debtExitCode(result));
|
|
166
155
|
}
|
|
156
|
+
case "ready":
|
|
167
157
|
case "blocked": {
|
|
168
|
-
const
|
|
158
|
+
const action = command.action;
|
|
159
|
+
const result = await debts[action]({
|
|
169
160
|
...readScope(command, current),
|
|
170
161
|
...(value(command, "parent") === undefined ? {} : { parent: value(command, "parent") }),
|
|
171
162
|
...(limit(command) === undefined ? {} : { limit: limit(command) }),
|
|
172
163
|
});
|
|
173
|
-
return emit(command.output, result, () =>
|
|
164
|
+
return emit(command.output, result, () => renderDebtList(action, scope, result, displayContext()), debtExitCode(result));
|
|
174
165
|
}
|
|
175
166
|
case "query": {
|
|
176
|
-
const result = await
|
|
177
|
-
where:
|
|
167
|
+
const result = await debts.query({
|
|
168
|
+
where: debtQuerySelection(command.flags.all === true ? "all" : command.flags.closed === true ? "closed" : "active", command.where),
|
|
178
169
|
...readScope(command, current),
|
|
179
170
|
...(value(command, "sort") === undefined ? {} : { sort: value(command, "sort") }),
|
|
180
171
|
...(limit(command) === undefined ? {} : { limit: limit(command) }),
|
|
181
172
|
});
|
|
182
|
-
return emit(command.output, result, () =>
|
|
173
|
+
return emit(command.output, result, () => renderDebtList("query", scope, result, displayContext()), debtExitCode(result));
|
|
183
174
|
}
|
|
184
175
|
case "tree": {
|
|
185
|
-
const result = await
|
|
186
|
-
return emit(command.output, result, () =>
|
|
176
|
+
const result = await debts.debt({ id }).tree();
|
|
177
|
+
return emit(command.output, result, () => renderDebtTree(result, displayContext()), debtExitCode(result));
|
|
187
178
|
}
|
|
188
179
|
case "doctor": {
|
|
189
|
-
const result = await
|
|
190
|
-
return emit(command.output, result, () => renderDoctor(result),
|
|
180
|
+
const result = await debts.doctor();
|
|
181
|
+
return emit(command.output, result, () => renderDoctor(result), debtExitCode(result));
|
|
191
182
|
}
|
|
192
183
|
default:
|
|
193
|
-
throw new Error(`
|
|
184
|
+
throw new Error(`debt action is not a read: ${command.action}`);
|
|
194
185
|
}
|
|
195
186
|
}
|
|
196
187
|
function isWorldObservationAction(command) {
|
|
@@ -200,11 +191,11 @@ function isWorldObservationAction(command) {
|
|
|
200
191
|
command.action === "query" ||
|
|
201
192
|
command.action === "doctor");
|
|
202
193
|
}
|
|
203
|
-
function
|
|
204
|
-
return { kind: "refused", refusal: { kind: "
|
|
194
|
+
function missingDebt(id) {
|
|
195
|
+
return { kind: "refused", refusal: { kind: "debt-missing", debtId: id } };
|
|
205
196
|
}
|
|
206
197
|
/**
|
|
207
|
-
* The one CLI edge mapping a
|
|
198
|
+
* The one CLI edge mapping a Debt action with no World to its native refusal answer, then through
|
|
208
199
|
* the matching action renderer and the native exit classifier.
|
|
209
200
|
*/
|
|
210
201
|
function missingWorld(command) {
|
|
@@ -215,135 +206,81 @@ function missingWorld(command) {
|
|
|
215
206
|
writeJson(command.positionals.length === 1 ? null : command.positionals.map(() => null));
|
|
216
207
|
return 1;
|
|
217
208
|
}
|
|
218
|
-
const refusal =
|
|
219
|
-
return emit(output, refusal, () =>
|
|
209
|
+
const refusal = missingDebt(command.positionals[0]);
|
|
210
|
+
return emit(output, refusal, () => renderDebtShow(refusal, displayContext()), 1);
|
|
220
211
|
}
|
|
221
|
-
if (isWorldObservationAction(command)
|
|
222
|
-
return emit(output, { kind: "absent" }, () => "
|
|
212
|
+
if (isWorldObservationAction(command)) {
|
|
213
|
+
return emit(output, { kind: "absent" }, () => "debt world absent", 1);
|
|
223
214
|
}
|
|
224
215
|
if (command.action === "context") {
|
|
225
216
|
const result = { kind: "accepted", value: { namespace: [], source: "default-root" } };
|
|
226
|
-
return emit(output, result, () =>
|
|
217
|
+
return emit(output, result, () => renderDebtContext(result, displayContext()), debtExitCode(result));
|
|
227
218
|
}
|
|
228
219
|
if (command.action === "tree") {
|
|
229
|
-
const result =
|
|
230
|
-
return emit(output, result, () =>
|
|
220
|
+
const result = missingDebt(command.positionals[0]);
|
|
221
|
+
return emit(output, result, () => renderDebtTree(result, displayContext()), debtExitCode(result));
|
|
231
222
|
}
|
|
232
223
|
if (command.action === "update") {
|
|
233
|
-
const result =
|
|
234
|
-
return emit(output, result, () =>
|
|
235
|
-
}
|
|
236
|
-
if (command.action === "start" ||
|
|
237
|
-
command.action === "stop" ||
|
|
238
|
-
command.action === "hold" ||
|
|
239
|
-
command.action === "resume") {
|
|
240
|
-
if (command.positionals.length === 1) {
|
|
241
|
-
const result = missingTask(command.positionals[0]);
|
|
242
|
-
return emit(output, result, () => renderTaskMutation(command.action, result, displayContext()), taskExitCode(result));
|
|
243
|
-
}
|
|
244
|
-
const result = {
|
|
245
|
-
items: command.positionals.map((id) => ({ id: id, outcome: missingTask(id) })),
|
|
246
|
-
};
|
|
247
|
-
return emit(output, result, () => renderTaskLifecycle(command.action, result, displayContext()), taskExitCode(result));
|
|
248
|
-
}
|
|
249
|
-
if (command.action === "done" || command.action === "drop") {
|
|
250
|
-
const result = {
|
|
251
|
-
items: command.positionals.map((id) => ({ id: id, outcome: missingTask(id) })),
|
|
252
|
-
};
|
|
253
|
-
return emit(output, result, () => renderTaskLifecycle(command.action, result, displayContext()), taskExitCode(result));
|
|
224
|
+
const result = missingDebt(command.positionals[0]);
|
|
225
|
+
return emit(output, result, () => renderDebtUpdate(result, displayContext()), debtExitCode(result));
|
|
254
226
|
}
|
|
255
|
-
|
|
227
|
+
if (command.action !== "done" && command.action !== "drop")
|
|
228
|
+
throw new Error(`debt action has no missing-world answer: ${command.action}`);
|
|
229
|
+
const result = {
|
|
230
|
+
items: command.positionals.map((id) => ({ id: id, outcome: missingDebt(id) })),
|
|
231
|
+
};
|
|
232
|
+
return emit(output, result, () => renderDebtLifecycle(command.action, result, displayContext()), debtExitCode(result));
|
|
256
233
|
}
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
* answer recovers its draft and puts the diagnostic on stderr.
|
|
260
|
-
*/
|
|
261
|
-
function emitCompose(output, result) {
|
|
262
|
-
if (output === "json") {
|
|
263
|
-
writeJson(result);
|
|
264
|
-
return taskExitCode(result);
|
|
265
|
-
}
|
|
266
|
-
if (result.kind === "incomplete") {
|
|
267
|
-
const diagnostic = renderTaskIncompleteDiagnostic(result);
|
|
268
|
-
if (diagnostic.length > 0)
|
|
269
|
-
writeStderr(diagnostic);
|
|
270
|
-
process.stdout.write(result.draft);
|
|
271
|
-
return taskExitCode(result);
|
|
272
|
-
}
|
|
273
|
-
writeStdout(renderTaskCompose(result, displayContext()));
|
|
274
|
-
return taskExitCode(result);
|
|
275
|
-
}
|
|
276
|
-
/** One plural Task lifecycle answer: every verb shares the same batch shape and renderer. */
|
|
277
|
-
async function runBatchLifecycle(tasks, command, verb) {
|
|
234
|
+
/** One plural Debt lifecycle answer: every verb shares the same batch shape and renderer. */
|
|
235
|
+
async function runBatchLifecycle(debts, command, verb) {
|
|
278
236
|
const note = value(command, "note");
|
|
279
|
-
const result = await
|
|
237
|
+
const result = await debts.batch({
|
|
280
238
|
verb,
|
|
281
239
|
ids: command.positionals,
|
|
282
240
|
...(note === undefined ? {} : { note }),
|
|
283
241
|
});
|
|
284
|
-
return emit(command.output, result, () =>
|
|
242
|
+
return emit(command.output, result, () => renderDebtLifecycle(verb, result, displayContext()), debtExitCode(result));
|
|
285
243
|
}
|
|
286
244
|
async function runMutation(input) {
|
|
287
|
-
const {
|
|
245
|
+
const { debts, command, current } = input;
|
|
288
246
|
if (isWorldObservationAction(command) || command.action === "tree")
|
|
289
247
|
return await runRead(input);
|
|
290
248
|
switch (command.action) {
|
|
291
249
|
case "add": {
|
|
292
250
|
const result = await invokeAdd(input);
|
|
293
|
-
return emit(command.output, result, () =>
|
|
251
|
+
return emit(command.output, result, () => renderDebtMutation("add", result, displayContext()), debtExitCode(result));
|
|
294
252
|
}
|
|
295
253
|
case "update": {
|
|
296
254
|
const result = await invokeUpdate(input);
|
|
297
|
-
return emit(command.output, result, () =>
|
|
255
|
+
return emit(command.output, result, () => renderDebtUpdate(result, displayContext()), debtExitCode(result));
|
|
298
256
|
}
|
|
299
|
-
case "start":
|
|
300
|
-
case "stop":
|
|
301
|
-
case "resume": {
|
|
302
|
-
const result = await invokeLifecycle(tasks, command.positionals, command.positionals[0], command.action);
|
|
303
|
-
return emit(command.output, result, () => renderTaskLifecycle(command.action, result, displayContext()), taskExitCode(result));
|
|
304
|
-
}
|
|
305
|
-
case "hold":
|
|
306
257
|
case "done":
|
|
307
258
|
case "drop":
|
|
308
|
-
return await runBatchLifecycle(
|
|
259
|
+
return await runBatchLifecycle(debts, command, command.action);
|
|
309
260
|
case "context": {
|
|
310
261
|
const selected = namespace(command.positionals[0]);
|
|
311
262
|
if (selected !== undefined) {
|
|
312
263
|
await installNamespaceContext(input.context.writeRoot ?? input.context.directory, selected);
|
|
313
|
-
const resolved = await
|
|
264
|
+
const resolved = await resolveDebtNamespaceContext(input.context);
|
|
314
265
|
if (typeof resolved === "object" && "kind" in resolved) {
|
|
315
266
|
const result = { kind: "refused", refusal: resolved };
|
|
316
|
-
return emit(command.output, result, () =>
|
|
267
|
+
return emit(command.output, result, () => renderDebtContext(result, displayContext()), debtExitCode(result));
|
|
317
268
|
}
|
|
318
269
|
const result = { kind: "accepted", value: resolved };
|
|
319
|
-
return emit(command.output, result, () =>
|
|
270
|
+
return emit(command.output, result, () => renderDebtContext(result, displayContext()), debtExitCode(result));
|
|
320
271
|
}
|
|
321
272
|
const result = {
|
|
322
273
|
kind: "accepted",
|
|
323
274
|
value: { namespace: current ?? [], source: "default-root" },
|
|
324
275
|
};
|
|
325
|
-
return emit(command.output, result, () =>
|
|
326
|
-
}
|
|
327
|
-
case "compose": {
|
|
328
|
-
const result = await tasks.compose({
|
|
329
|
-
markdown: composeMarkdown ?? stdin ?? "",
|
|
330
|
-
namespace: composeNamespace ?? current ?? [],
|
|
331
|
-
...(input.actor === undefined ? {} : { actor: input.actor }),
|
|
332
|
-
...(command.flags.plan === true ? { plan: true } : {}),
|
|
333
|
-
});
|
|
334
|
-
return emitCompose(command.output, result);
|
|
276
|
+
return emit(command.output, result, () => renderDebtContext(result, displayContext()), debtExitCode(result));
|
|
335
277
|
}
|
|
336
278
|
default:
|
|
337
|
-
throw new Error(`
|
|
279
|
+
throw new Error(`debt action has no invocation: ${command.action}`);
|
|
338
280
|
}
|
|
339
281
|
}
|
|
340
|
-
function invokeLifecycle(tasks, taskIds, firstId, verb) {
|
|
341
|
-
return taskIds.length === 1 ? tasks.task({ id: firstId })[verb]() : tasks.batch({ verb, ids: taskIds });
|
|
342
|
-
}
|
|
343
282
|
function establishesWorld(command) {
|
|
344
|
-
return
|
|
345
|
-
(command.action === "compose" && command.flags.plan !== true) ||
|
|
346
|
-
(command.action === "context" && command.positionals.length > 0));
|
|
283
|
+
return command.action === "add" || (command.action === "context" && command.positionals.length > 0);
|
|
347
284
|
}
|
|
348
285
|
/**
|
|
349
286
|
* One CLI edge turning a namespace-context refusal into the addressed action's native refusal
|
|
@@ -357,42 +294,31 @@ function refuseNamespace(command, refusal) {
|
|
|
357
294
|
case "blocked":
|
|
358
295
|
case "query": {
|
|
359
296
|
const action = command.action;
|
|
360
|
-
return emit(command.output, result, () =>
|
|
297
|
+
return emit(command.output, result, () => renderDebtList(action, listPresentation(command), result, displayContext()), debtExitCode(result));
|
|
361
298
|
}
|
|
362
299
|
case "add":
|
|
363
|
-
return emit(command.output, result, () =>
|
|
300
|
+
return emit(command.output, result, () => renderDebtMutation("add", result, displayContext()), debtExitCode(result));
|
|
364
301
|
case "context":
|
|
365
|
-
return emit(command.output, result, () =>
|
|
366
|
-
case "compose":
|
|
367
|
-
return emit(command.output, result, () => renderTaskFailure("compose", result, displayContext()), taskExitCode(result));
|
|
302
|
+
return emit(command.output, result, () => renderDebtContext(result, displayContext()), debtExitCode(result));
|
|
368
303
|
default:
|
|
369
|
-
throw new Error(`
|
|
304
|
+
throw new Error(`debt action has no namespace refusal: ${command.action}`);
|
|
370
305
|
}
|
|
371
306
|
}
|
|
372
307
|
// eslint-disable-next-line complexity -- this is the single CLI edge ordering world, context, forwarding, and local execution.
|
|
373
|
-
export async function
|
|
374
|
-
|
|
375
|
-
const stdinDiagnostic =
|
|
308
|
+
export async function runDebtCommand(command, coordinates, runtime) {
|
|
309
|
+
validateDebtRowView(command);
|
|
310
|
+
const stdinDiagnostic = debtStdinDiagnostic(command);
|
|
376
311
|
const stdin = stdinDiagnostic === undefined ? undefined : await runtime.readStdin();
|
|
377
312
|
if (stdinDiagnostic !== undefined && isBlankInput(stdin ?? ""))
|
|
378
313
|
throw new CliUsageError(stdinDiagnostic);
|
|
379
|
-
const
|
|
380
|
-
const composeMarkdown = command.action === "compose" ? stdin : undefined;
|
|
381
|
-
const composition = composeMarkdown === undefined ? undefined : taskCompositionNamespaceHeader(composeMarkdown);
|
|
382
|
-
const explicitNamespace = command.action === "add"
|
|
383
|
-
? namespace(value(command, "namespace"))
|
|
384
|
-
: command.action === "compose" && composition?.specified
|
|
385
|
-
? composition.namespace
|
|
386
|
-
: undefined;
|
|
314
|
+
const explicitNamespace = command.action === "add" ? namespace(value(command, "namespace")) : undefined;
|
|
387
315
|
const actor = actorFromEdge(typeof command.flags.actor === "string" ? command.flags.actor : undefined, runtime.environment);
|
|
388
|
-
const world = coordinates.world ??
|
|
389
|
-
(planOnly ? coordinates.candidateWorld : establishesWorld(command) ? await coordinates.establishWorld() : null);
|
|
316
|
+
const world = coordinates.world ?? (establishesWorld(command) ? await coordinates.establishWorld() : null);
|
|
390
317
|
if (world === null)
|
|
391
318
|
return missingWorld(command);
|
|
392
|
-
const
|
|
319
|
+
const debts = debtsWithExecution(world, runtime.execution);
|
|
393
320
|
const contextSensitive = command.action === "context" ||
|
|
394
321
|
(command.action === "add" && explicitNamespace === undefined) ||
|
|
395
|
-
(command.action === "compose" && composition?.specified !== true) ||
|
|
396
322
|
(((command.action === "ls" && explicitListNamespace(command) === undefined) ||
|
|
397
323
|
command.action === "ready" ||
|
|
398
324
|
command.action === "blocked" ||
|
|
@@ -400,26 +326,23 @@ export async function runTaskCommand(command, coordinates, runtime) {
|
|
|
400
326
|
command.flags.world !== true);
|
|
401
327
|
let current;
|
|
402
328
|
if (contextSensitive) {
|
|
403
|
-
const resolved = await
|
|
329
|
+
const resolved = await resolveDebtNamespaceContext(coordinates.debtContext);
|
|
404
330
|
if (typeof resolved === "object" && "kind" in resolved)
|
|
405
331
|
return refuseNamespace(command, resolved);
|
|
406
332
|
current = resolved.namespace;
|
|
407
333
|
if (command.action === "context" && command.positionals.length === 0) {
|
|
408
334
|
const result = { kind: "accepted", value: resolved };
|
|
409
|
-
return emit(command.output, result, () =>
|
|
335
|
+
return emit(command.output, result, () => renderDebtContext(result, displayContext()), debtExitCode(result));
|
|
410
336
|
}
|
|
411
337
|
}
|
|
412
338
|
if (command.action === "show")
|
|
413
|
-
return await runShow(command,
|
|
339
|
+
return await runShow(command, debts);
|
|
414
340
|
return await runMutation({
|
|
415
|
-
|
|
341
|
+
debts,
|
|
416
342
|
command,
|
|
417
|
-
|
|
418
|
-
context: coordinates.taskContext,
|
|
343
|
+
context: coordinates.debtContext,
|
|
419
344
|
...(actor === undefined ? {} : { actor }),
|
|
420
345
|
...(current === undefined ? {} : { current }),
|
|
421
346
|
...(stdin === undefined ? {} : { stdin }),
|
|
422
|
-
...(composeMarkdown === undefined ? {} : { composeMarkdown }),
|
|
423
|
-
...(explicitNamespace === undefined ? {} : { composeNamespace: explicitNamespace }),
|
|
424
347
|
});
|
|
425
348
|
}
|
|
@@ -69,7 +69,7 @@ export const cliCoordinateDiscovery = {
|
|
|
69
69
|
...(repo === undefined ? {} : { repo }),
|
|
70
70
|
world: world.root,
|
|
71
71
|
candidateWorld: world.candidate,
|
|
72
|
-
|
|
72
|
+
debtContext: {
|
|
73
73
|
directory: cwd,
|
|
74
74
|
boundary,
|
|
75
75
|
writeRoot: worldRepo === undefined ? boundary : cwd,
|
package/build/src/cli/parse.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ParsedDebtCommand, type DebtAction } from "./commands/debt-grammar.js";
|
|
2
2
|
import { type AkumaAction, type ParsedAkumaCommand } from "./commands/akuma-grammar.js";
|
|
3
3
|
import { type ParsedInstallCommand } from "./commands/install.js";
|
|
4
|
-
import { type
|
|
4
|
+
import { type ParsedContractCommand } from "./commands/contract-grammar.js";
|
|
5
5
|
import { type ContractCommand as Command } from "./commands/contract-help.js";
|
|
6
6
|
import { type CliUsageGuide } from "./usage.js";
|
|
7
7
|
export { CliUsageError } from "./usage.js";
|
|
@@ -10,15 +10,15 @@ export type { Command };
|
|
|
10
10
|
export declare function renderRootHelp(columns?: number): string;
|
|
11
11
|
export declare function usageGuideForCommand(command: ParsedCommand): CliUsageGuide;
|
|
12
12
|
export declare function renderHelp(coordinate: CliHelpCoordinate, columns?: number): string;
|
|
13
|
-
export type ParsedCommand =
|
|
13
|
+
export type ParsedCommand = ParsedContractCommand | ParsedInstallCommand | ParsedAkumaCommand | ParsedDebtCommand;
|
|
14
14
|
type CliHelpCoordinate = Readonly<{
|
|
15
15
|
kind: "root";
|
|
16
16
|
}> | Readonly<{
|
|
17
17
|
kind: "contract";
|
|
18
18
|
command: Command;
|
|
19
19
|
}> | Readonly<{
|
|
20
|
-
kind: "
|
|
21
|
-
action?:
|
|
20
|
+
kind: "debt";
|
|
21
|
+
action?: DebtAction;
|
|
22
22
|
}> | Readonly<{
|
|
23
23
|
kind: "install";
|
|
24
24
|
}> | Readonly<{
|
package/build/src/cli/parse.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isDebtAction, parseDebtCommand, renderDebtHelp, debtUsageGuide, } from "./commands/debt-grammar.js";
|
|
2
2
|
import { akumaUsageGuide, isAkumaAction, parseAkumaCommand, renderAkumaHelp, renderAkumaRootRows, } from "./commands/akuma-grammar.js";
|
|
3
3
|
import { INSTALL_ROOT_PURPOSE, INSTALL_USAGE, parseInstallCommand, renderInstallHelp, } from "./commands/install.js";
|
|
4
4
|
import { parseContractCommand, } from "./commands/contract-grammar.js";
|
|
@@ -14,7 +14,7 @@ const ROOT_USAGE = [
|
|
|
14
14
|
const INVOCATION_PATH_OPTIONS = new Set(["-C", "--cwd", "--repo", "--workdir"]);
|
|
15
15
|
export function renderRootHelp(columns) {
|
|
16
16
|
return renderHelpText([
|
|
17
|
-
"keiyaku — Contract,
|
|
17
|
+
"keiyaku — Contract, Debt, and Akuma control for one repository",
|
|
18
18
|
"",
|
|
19
19
|
ROOT_USAGE,
|
|
20
20
|
"",
|
|
@@ -23,8 +23,8 @@ export function renderRootHelp(columns) {
|
|
|
23
23
|
.filter(([command]) => command !== "settings")
|
|
24
24
|
.map(([command, spec]) => ` ${command.padEnd(10)} ${spec.purpose}`),
|
|
25
25
|
"",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"Debt — unresolved-work ledger",
|
|
27
|
+
" debt Debt coordination; see `keiyaku debt --help`.",
|
|
28
28
|
"",
|
|
29
29
|
"Akuma — contracted demons",
|
|
30
30
|
...renderAkumaRootRows(),
|
|
@@ -64,8 +64,8 @@ function renderHelpText(help, columns) {
|
|
|
64
64
|
export function usageGuideForCommand(command) {
|
|
65
65
|
if (command.command === "install")
|
|
66
66
|
return commandGuide("install", INSTALL_USAGE);
|
|
67
|
-
if (command.command === "
|
|
68
|
-
return
|
|
67
|
+
if (command.command === "debt")
|
|
68
|
+
return debtUsageGuide(command.action);
|
|
69
69
|
if (isAkumaAction(command.command))
|
|
70
70
|
return akumaUsageGuide(command.command);
|
|
71
71
|
return commandGuide(command.command, CONTRACT_COMMAND_SPECS[command.command].usage);
|
|
@@ -77,8 +77,8 @@ export function renderHelp(coordinate, columns) {
|
|
|
77
77
|
return renderRootHelp();
|
|
78
78
|
case "contract":
|
|
79
79
|
return renderContractHelpForOwner(coordinate.command);
|
|
80
|
-
case "
|
|
81
|
-
return
|
|
80
|
+
case "debt":
|
|
81
|
+
return renderDebtHelp(coordinate.action);
|
|
82
82
|
case "install":
|
|
83
83
|
return renderInstallHelp();
|
|
84
84
|
case "akuma":
|
|
@@ -98,6 +98,7 @@ export function commandRepoPolicy(command) {
|
|
|
98
98
|
case "audit":
|
|
99
99
|
case "reconcile":
|
|
100
100
|
case "region":
|
|
101
|
+
case "show":
|
|
101
102
|
return { use: "required", acceptsExplicit: true };
|
|
102
103
|
case "ls":
|
|
103
104
|
return { use: command.query.kind === "contracts" ? "required" : "none", acceptsExplicit: false };
|
|
@@ -123,7 +124,7 @@ export function commandRepoPolicy(command) {
|
|
|
123
124
|
};
|
|
124
125
|
case "settings":
|
|
125
126
|
case "nuke":
|
|
126
|
-
case "
|
|
127
|
+
case "debt":
|
|
127
128
|
case "install":
|
|
128
129
|
return { use: "none", acceptsExplicit: false };
|
|
129
130
|
}
|
|
@@ -234,9 +235,9 @@ function helpCoordinate(argv) {
|
|
|
234
235
|
return null;
|
|
235
236
|
const words = argv.slice(0, help);
|
|
236
237
|
const root = words[0];
|
|
237
|
-
if (root === "
|
|
238
|
-
const action =
|
|
239
|
-
return { kind: "
|
|
238
|
+
if (root === "debt") {
|
|
239
|
+
const action = isDebtAction(words[1]) ? words[1] : undefined;
|
|
240
|
+
return { kind: "debt", ...(action === undefined ? {} : { action }) };
|
|
240
241
|
}
|
|
241
242
|
if (root === "install")
|
|
242
243
|
return { kind: "install" };
|
|
@@ -255,14 +256,14 @@ export function parseArgv(argv) {
|
|
|
255
256
|
// A bare invocation asks for orientation: the root help index, not a refusal.
|
|
256
257
|
if (invocation.commandArgv.length === 0)
|
|
257
258
|
return { help: { kind: "root" } };
|
|
258
|
-
if (invocation.commandArgv.length === 1 && invocation.commandArgv[0] === "
|
|
259
|
-
return { help: { kind: "
|
|
259
|
+
if (invocation.commandArgv.length === 1 && invocation.commandArgv[0] === "debt")
|
|
260
|
+
return { help: { kind: "debt" } };
|
|
260
261
|
if (invocation.commandArgv.length === 1 && invocation.commandArgv[0] === "--version")
|
|
261
262
|
return { version: true };
|
|
262
|
-
const
|
|
263
|
+
const debt = invocation.commandArgv[0] === "debt" ? parseDebtCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
263
264
|
const install = invocation.commandArgv[0] === "install" ? parseInstallCommand(invocation.commandArgv.slice(1)) : undefined;
|
|
264
265
|
const akuma = isAkumaAction(invocation.commandArgv[0]) ? parseAkumaCommand(invocation.commandArgv) : undefined;
|
|
265
|
-
const command =
|
|
266
|
+
const command = debt ?? akuma ?? install ?? parseContractCommand(scanArgv(invocation.commandArgv));
|
|
266
267
|
if (invocation.workdir !== undefined && command.command !== "call") {
|
|
267
268
|
throw new CliUsageError(`option --workdir is not valid for ${command.command}`, usageGuideForCommand(command));
|
|
268
269
|
}
|