@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,11 +1,8 @@
|
|
|
1
1
|
import type { AkumaList } from "../../akuma/akuma.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ArchetypeCatalog } from "../../index.js";
|
|
3
3
|
import type { ContractList } from "../../library/contract-types.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { DebtPage, DebtRow } from "../../debt/index.js";
|
|
5
5
|
export declare function renderAkumaCatalogue(list: AkumaList, archetype: string | null): string;
|
|
6
6
|
export declare function renderContractCatalogue(list: ContractList): string;
|
|
7
|
-
export declare function renderArchetypeCatalogue(list:
|
|
8
|
-
|
|
9
|
-
hasMore: boolean;
|
|
10
|
-
}>): string;
|
|
11
|
-
export declare function renderTaskCatalogue(list: TaskPage<TaskRow>, namespace: readonly string[]): string;
|
|
7
|
+
export declare function renderArchetypeCatalogue(list: ArchetypeCatalog): string;
|
|
8
|
+
export declare function renderDebtCatalogue(list: DebtPage<DebtRow>, namespace: readonly string[]): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { abbreviateGitIds, displayGitId, gitIdsInRow, lifecycleWord, progressStrip } from "./contract-observation.js";
|
|
2
2
|
import { ageText, emptyCatalogue, renderBoundedPayload, safeText } from "./terminal.js";
|
|
3
3
|
import { akumaMark, contractMark } from "./marks.js";
|
|
4
|
-
import { dispositionText,
|
|
4
|
+
import { dispositionText, debtFrameHead, debtMark } from "./debt.js";
|
|
5
5
|
function relativeAge(source, observedAt) {
|
|
6
6
|
if (source === null)
|
|
7
7
|
return null;
|
|
@@ -92,14 +92,14 @@ export function renderArchetypeCatalogue(list) {
|
|
|
92
92
|
]),
|
|
93
93
|
].join("\n");
|
|
94
94
|
}
|
|
95
|
-
export function
|
|
95
|
+
export function renderDebtCatalogue(list, namespace) {
|
|
96
96
|
const scope = namespace.length === 0 ? "root" : `namespace ${namespace.join("/")}`;
|
|
97
|
-
const head =
|
|
97
|
+
const head = debtFrameHead("debts", scope);
|
|
98
98
|
if (list.rows.length === 0)
|
|
99
|
-
return emptyCatalogue("
|
|
99
|
+
return emptyCatalogue("debts");
|
|
100
100
|
return [
|
|
101
101
|
head,
|
|
102
|
-
...list.rows.map((row) => `${
|
|
102
|
+
...list.rows.map((row) => `${debtMark(row.disposition)} ${safeText(row.id)} · ${dispositionText(row.disposition)} · P${row.priority} — ${safeText(row.title)}`),
|
|
103
103
|
...(list.hasMore ? ["…"] : []),
|
|
104
104
|
].join("\n");
|
|
105
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAkuId } from "../../akuma/identity.js";
|
|
2
|
-
import { lifecycleWord, shortGitId } from "./contract-observation.js";
|
|
2
|
+
import { gateDisplayName, lifecycleWord, shortGitId } from "./contract-observation.js";
|
|
3
3
|
import { receiptPayload } from "./receipt.js";
|
|
4
4
|
import { renderOpaqueBlock, DEFAULT_CLI_COLUMNS } from "./terminal.js";
|
|
5
5
|
function journalCount(events, source) {
|
|
@@ -120,15 +120,12 @@ function eventAt(event) {
|
|
|
120
120
|
function eventKind(event) {
|
|
121
121
|
return event.source === "journal" ? event.fact.kind : "dispatch";
|
|
122
122
|
}
|
|
123
|
-
function gateNoun(gate) {
|
|
124
|
-
return gate === "reviewed" ? "review" : gate === "verified" ? "verification" : gate;
|
|
125
|
-
}
|
|
126
123
|
function mark(verdict) {
|
|
127
124
|
return verdict === "satisfied" ? "✓" : "×";
|
|
128
125
|
}
|
|
129
126
|
function bindLine(bind, dispatch) {
|
|
130
127
|
const target = bind.data.coordinates.target?.replace(/^refs\/heads\//u, "") ?? "targetless";
|
|
131
|
-
const gates = bind.data.terms.gates.map(
|
|
128
|
+
const gates = bind.data.terms.gates.map(gateDisplayName);
|
|
132
129
|
const gateFact = gates.length === 0 ? "" : ` · ${gates.length === 1 ? "gate" : "gates"} ${gates.join(" · ")}`;
|
|
133
130
|
let alias = "";
|
|
134
131
|
if (dispatch?.source === "dispatch") {
|
|
@@ -190,7 +187,7 @@ function skeletonBeatLines(beat, history) {
|
|
|
190
187
|
];
|
|
191
188
|
}
|
|
192
189
|
case "attestation":
|
|
193
|
-
return [`${clock(first)} ${mark(fact.data.verdict)} ${
|
|
190
|
+
return [`${clock(first)} ${mark(fact.data.verdict)} ${gateDisplayName(fact.data.gate)}${evidenceSuffix()}`];
|
|
194
191
|
case "amend": {
|
|
195
192
|
const changed = [fact.data.gates.length > 0 ? "gates" : "", fact.data.after.length > 0 ? "after" : ""]
|
|
196
193
|
.filter((value) => value.length > 0)
|
|
@@ -40,26 +40,7 @@ function checkoutBehindRows(path, target, columns) {
|
|
|
40
40
|
}
|
|
41
41
|
function lagRows(lag, columns) {
|
|
42
42
|
const lines = [];
|
|
43
|
-
if (lag.kind === "worktree-
|
|
44
|
-
receiptRow(lines, "!", "lag", [{ text: "worktree retained" }, { text: lag.path, opaque: true }], columns);
|
|
45
|
-
}
|
|
46
|
-
else if (lag.kind === "worktree-follow-retained") {
|
|
47
|
-
receiptRow(lines, "!", "lag", [
|
|
48
|
-
{ text: "worktree follow retained" },
|
|
49
|
-
{ text: "·" },
|
|
50
|
-
{ text: lag.reason.replaceAll("-", " ") },
|
|
51
|
-
{ text: "·" },
|
|
52
|
-
{ text: lag.path, opaque: true },
|
|
53
|
-
], columns);
|
|
54
|
-
}
|
|
55
|
-
else if (lag.kind === "unsealed-bytes") {
|
|
56
|
-
receiptRow(lines, "!", "lag", [{ text: "unsealed bytes" }, { text: lag.path, opaque: true }], columns);
|
|
57
|
-
}
|
|
58
|
-
else if (lag.kind === "target-checkout-retained") {
|
|
59
|
-
pushBlock(lines, checkoutBehindRows(lag.path, lag.target, columns));
|
|
60
|
-
receiptPayload(lines, "reason", lag.diagnostic);
|
|
61
|
-
}
|
|
62
|
-
else if (lag.kind === "worktree-hook-failed") {
|
|
43
|
+
if (lag.kind === "worktree-hook-failed") {
|
|
63
44
|
receiptRow(lines, "!", "lag", [
|
|
64
45
|
{
|
|
65
46
|
text: `worktree-hook-failed ${lag.phase} ${lag.path} command ${lag.command} name ${lag.name} ${hookFailureSummary(lag.failure)}`,
|
|
@@ -81,8 +62,8 @@ function lagRows(lag, columns) {
|
|
|
81
62
|
function settlementLagRows(lag, columns) {
|
|
82
63
|
const lines = [];
|
|
83
64
|
receiptRow(lines, "!", "settlement", [{ text: lag.surface.replaceAll("-", " ") }], columns);
|
|
84
|
-
if (lag.
|
|
85
|
-
receiptRow(lines, " ", "
|
|
65
|
+
if (lag.debtId !== undefined)
|
|
66
|
+
receiptRow(lines, " ", "debt", [{ text: lag.debtId, opaque: true }], columns);
|
|
86
67
|
if (lag.path !== undefined)
|
|
87
68
|
receiptRow(lines, " ", "path", [{ text: lag.path, opaque: true }], columns);
|
|
88
69
|
receiptPayload(lines, "reason", lag.diagnostic);
|
|
@@ -153,24 +134,12 @@ function overlapRows(overlaps, color) {
|
|
|
153
134
|
}
|
|
154
135
|
return lines;
|
|
155
136
|
}
|
|
156
|
-
function pushBlock(lines, block) {
|
|
157
|
-
if (block.length === 0)
|
|
158
|
-
return;
|
|
159
|
-
lines.push(...block);
|
|
160
|
-
}
|
|
161
|
-
function acceptedRecord(result, columns) {
|
|
162
|
-
const record = [];
|
|
163
|
-
const recoverySnapshot = effectRecoverySnapshot(result.effects);
|
|
164
|
-
if (recoverySnapshot !== undefined)
|
|
165
|
-
receiptRow(record, " ", "recovery snapshot", [{ text: recoverySnapshot, opaque: true }], columns);
|
|
166
|
-
return record;
|
|
167
|
-
}
|
|
168
137
|
function acceptedLagRows(result, columns) {
|
|
169
138
|
const obligations = [];
|
|
170
139
|
// A checkout this invocation's own follow could not carry is loud; the same arm's reconciliation lag
|
|
171
140
|
// is pre-existing residue and stays in the typed result only.
|
|
172
141
|
for (const checkout of effectRetainedCheckouts(result.effects) ?? []) {
|
|
173
|
-
|
|
142
|
+
obligations.push(...checkoutBehindRows(checkout.path, checkout.target, columns));
|
|
174
143
|
}
|
|
175
144
|
for (const { contract, lag } of effectLags(result.effects)) {
|
|
176
145
|
if (lag.kind === "worktree-retained" ||
|
|
@@ -180,29 +149,34 @@ function acceptedLagRows(result, columns) {
|
|
|
180
149
|
continue;
|
|
181
150
|
if (contract !== result.contract)
|
|
182
151
|
receiptRow(obligations, "!", "lag owner", [{ text: contract, opaque: true }], columns);
|
|
183
|
-
|
|
152
|
+
obligations.push(...lagRows(lag, columns));
|
|
184
153
|
}
|
|
185
154
|
for (const { contract, lag } of effectSettlementLags(result.effects)) {
|
|
186
155
|
if (contract !== result.contract)
|
|
187
156
|
receiptRow(obligations, "!", "settlement owner", [{ text: contract, opaque: true }], columns);
|
|
188
|
-
|
|
157
|
+
obligations.push(...settlementLagRows(lag, columns));
|
|
189
158
|
}
|
|
190
|
-
|
|
191
|
-
|
|
159
|
+
obligations.push(...executionCleanupLines(effectCleanup(result.effects), columns, result.contract));
|
|
160
|
+
obligations.push(...executionStopLines(effectExecutionStops(result.effects), columns));
|
|
192
161
|
return obligations;
|
|
193
162
|
}
|
|
194
163
|
function acceptedDeviations(result, columns, color) {
|
|
195
164
|
const deviations = [];
|
|
196
165
|
if (result.value.overlaps !== undefined)
|
|
197
|
-
|
|
166
|
+
deviations.push(...overlapRows(result.value.overlaps, color));
|
|
198
167
|
if (result.value.overlapFailure !== undefined) {
|
|
199
168
|
receiptRow(deviations, "!", "overlap", [{ text: "unavailable" }], columns);
|
|
200
169
|
receiptPayload(deviations, "reason", result.value.overlapFailure);
|
|
201
170
|
}
|
|
202
171
|
return deviations;
|
|
203
172
|
}
|
|
173
|
+
/** Evidence handles stay in JSON and history; ordinary receipt text carries only outstanding obligations. */
|
|
204
174
|
function recordBlock(result, columns) {
|
|
205
|
-
const rows = [
|
|
175
|
+
const rows = [];
|
|
176
|
+
const recoverySnapshot = effectRecoverySnapshot(result.effects);
|
|
177
|
+
if (recoverySnapshot !== undefined)
|
|
178
|
+
receiptRow(rows, " ", "recovery snapshot", [{ text: recoverySnapshot, opaque: true }], columns);
|
|
179
|
+
rows.push(...acceptedLagRows(result, columns));
|
|
206
180
|
return rows;
|
|
207
181
|
}
|
|
208
182
|
/** A terminal command names the worktree it retired, or the retained worktree it failed to remove. */
|
|
@@ -279,15 +253,6 @@ function completedPlacementLines(result, columns) {
|
|
|
279
253
|
receiptRow(lines, "✓", lifecycleWord("claimed"), [], columns);
|
|
280
254
|
return lines;
|
|
281
255
|
}
|
|
282
|
-
/** Evidence handles stay in JSON and history; ordinary receipt text carries only outstanding obligations. */
|
|
283
|
-
function obligationLines(result, columns) {
|
|
284
|
-
const rows = [];
|
|
285
|
-
const recoverySnapshot = effectRecoverySnapshot(result.effects);
|
|
286
|
-
if (recoverySnapshot !== undefined)
|
|
287
|
-
receiptRow(rows, " ", "recovery snapshot", [{ text: recoverySnapshot, opaque: true }], columns);
|
|
288
|
-
rows.push(...acceptedLagRows(result, columns));
|
|
289
|
-
return rows;
|
|
290
|
-
}
|
|
291
256
|
function movementLines(result, columns) {
|
|
292
257
|
const count = result.facts.filter((fact) => fact.kind === "reintegrated").length;
|
|
293
258
|
if (count === 0)
|
|
@@ -403,7 +368,7 @@ function renderAcceptedDeliver(result, columns) {
|
|
|
403
368
|
lines.push(...stopLines(verification.stop, columns, result.contract));
|
|
404
369
|
if (!complete && result.value.placement !== undefined)
|
|
405
370
|
lines.push(...stopLines(result.value.placement, columns, result.contract));
|
|
406
|
-
lines.push(...continuationLines(result, columns), ...
|
|
371
|
+
lines.push(...continuationLines(result, columns), ...recordBlock(result, columns), ...worktreeRetirementLines(result, columns), ...gatesAwaitLines(result.value.placement));
|
|
407
372
|
return lines.join("\n");
|
|
408
373
|
}
|
|
409
374
|
function renderAcceptedReview(result, columns) {
|
|
@@ -416,7 +381,7 @@ function renderAcceptedReview(result, columns) {
|
|
|
416
381
|
lines.push(...stopLines(result.value.placement, columns, result.contract));
|
|
417
382
|
}
|
|
418
383
|
lines.push(...continuationLines(result, columns));
|
|
419
|
-
lines.push(...
|
|
384
|
+
lines.push(...recordBlock(result, columns));
|
|
420
385
|
lines.push(...worktreeRetirementLines(result, columns));
|
|
421
386
|
lines.push(...gatesAwaitLines(result.value.placement));
|
|
422
387
|
return lines.join("\n");
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BlockedDebtList, DebtBatchResult, DebtContextResult, DebtDecompositionTree, DebtDetail, DebtDoctorReport, DebtList, DebtMutationResult, DebtQueryResult, DebtUpdateResult } from "../../debt/index.js";
|
|
2
|
+
import { type TextRenderContext } from "./terminal.js";
|
|
3
|
+
export { debtMark } from "./marks.js";
|
|
4
|
+
type DebtListOutcome = DebtList | BlockedDebtList | DebtQueryResult;
|
|
5
|
+
/** One addressed show selection: native details, or a refusal naming a missing addressed read. */
|
|
6
|
+
export type DebtShowResult = DebtDetail | DebtDetail[] | Extract<DebtMutationResult, {
|
|
7
|
+
kind: "refused";
|
|
8
|
+
}>;
|
|
9
|
+
/** Presentation-only list scope the leaf acquired; never part of a product value. */
|
|
10
|
+
export type DebtListScope = "world" | "current" | Readonly<{
|
|
11
|
+
namespace: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** The union of native Debt SDK answers one leaf renders directly; the CLI adds no result envelope. */
|
|
14
|
+
type DebtNativeResult = DebtMutationResult | DebtUpdateResult | DebtBatchResult | DebtShowResult | DebtList | BlockedDebtList | DebtQueryResult | DebtDecompositionTree | DebtDoctorReport | DebtContextResult;
|
|
15
|
+
/** Debt dispositions and relation states are snake_case facts; people read them as words. */
|
|
16
|
+
export declare function dispositionText(word: string): string;
|
|
17
|
+
export declare function debtFrameHead(view: string, scope: string): string;
|
|
18
|
+
export declare function renderDebtList(action: "ls" | "ready" | "blocked" | "query", scope: DebtListScope, result: DebtListOutcome, context?: TextRenderContext): string;
|
|
19
|
+
export declare function renderDebtShow(result: DebtShowResult, context?: TextRenderContext): string;
|
|
20
|
+
export declare function renderDoctor(report: DebtDoctorReport): string;
|
|
21
|
+
export declare function renderDebtUpdate(result: DebtUpdateResult, context?: TextRenderContext): string;
|
|
22
|
+
export declare function renderDebtTree(result: DebtDecompositionTree, context?: TextRenderContext): string;
|
|
23
|
+
export declare function renderDebtContext(result: DebtContextResult, context?: TextRenderContext): string;
|
|
24
|
+
/** One single-Debt mutation answer; `verb` is the literal action the leaf invoked. */
|
|
25
|
+
export declare function renderDebtMutation(verb: string, result: DebtMutationResult, context?: TextRenderContext): string;
|
|
26
|
+
/** One lifecycle answer: a single mutation or a plural batch, both native shapes. */
|
|
27
|
+
export declare function renderDebtLifecycle(verb: string, result: DebtMutationResult | DebtBatchResult, context?: TextRenderContext): string;
|
|
28
|
+
export declare function debtExitCode(result: DebtNativeResult): number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { debtMark } from "./marks.js";
|
|
2
2
|
import { outcomeLines, receiptPayload, receiptRow, refusalLines } from "./receipt.js";
|
|
3
3
|
import { DEFAULT_CLI_COLUMNS, displayColumns, emptyCatalogue, renderTextBlock, safeText, } from "./terminal.js";
|
|
4
|
-
export {
|
|
4
|
+
export { debtMark } from "./marks.js";
|
|
5
5
|
const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
6
|
-
/**
|
|
6
|
+
/** Debt dispositions and relation states are snake_case facts; people read them as words. */
|
|
7
7
|
export function dispositionText(word) {
|
|
8
8
|
return word === "drop" ? "dropped" : word.replaceAll("_", " ");
|
|
9
9
|
}
|
|
@@ -12,8 +12,8 @@ function priorityText(priority) {
|
|
|
12
12
|
}
|
|
13
13
|
function scanUnit(id, priority, word) {
|
|
14
14
|
return word === undefined
|
|
15
|
-
? `${
|
|
16
|
-
: `${
|
|
15
|
+
? `${debtMark("ready")} ${id} · ${priorityText(priority)}`
|
|
16
|
+
: `${debtMark(word)} ${id} · ${dispositionText(word)} · ${priorityText(priority)}`;
|
|
17
17
|
}
|
|
18
18
|
function entityLines(entity, columns, indent = "") {
|
|
19
19
|
const scan = `${indent}${scanUnit(entity.id, entity.priority, entity.word)}${entity.facts === undefined ? "" : ` · ${entity.facts}`}`;
|
|
@@ -25,27 +25,20 @@ function entityLines(entity, columns, indent = "") {
|
|
|
25
25
|
return [inline];
|
|
26
26
|
return [scan, ...renderTextBlock(title, `${indent} `, columns, "—")];
|
|
27
27
|
}
|
|
28
|
-
function stateEntity(
|
|
28
|
+
function stateEntity(debt) {
|
|
29
29
|
return {
|
|
30
|
-
id:
|
|
31
|
-
priority: "priority" in
|
|
32
|
-
word:
|
|
33
|
-
title:
|
|
30
|
+
id: debt.id,
|
|
31
|
+
priority: "priority" in debt && debt.priority !== undefined ? debt.priority : null,
|
|
32
|
+
word: debt.state,
|
|
33
|
+
title: debt.title,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const TASK_REFUSAL_WORDS = {
|
|
37
|
-
"task-missing": "task missing",
|
|
38
|
-
"invalid-lifecycle-transition": "invalid lifecycle transition",
|
|
39
|
-
"invalid-namespace-context": "invalid namespace context",
|
|
40
|
-
"relation-owned-by-other": "relation owned by other",
|
|
41
|
-
"invalid-composition": "invalid composition",
|
|
42
|
-
};
|
|
43
36
|
function projectRefusal(refusal) {
|
|
44
|
-
const diagnostic =
|
|
45
|
-
if (refusal.kind === "
|
|
46
|
-
return { diagnostic, facts: [`
|
|
37
|
+
const diagnostic = refusal.kind.replaceAll("-", " ");
|
|
38
|
+
if (refusal.kind === "debt-missing")
|
|
39
|
+
return { diagnostic, facts: [`debt ${refusal.debtId}`] };
|
|
47
40
|
if (refusal.kind === "invalid-lifecycle-transition") {
|
|
48
|
-
return { diagnostic, facts: [`
|
|
41
|
+
return { diagnostic, facts: [`debt ${refusal.debtId}`, `state ${refusal.state} · verb ${refusal.verb}`] };
|
|
49
42
|
}
|
|
50
43
|
if (refusal.kind === "invalid-namespace-context")
|
|
51
44
|
return { diagnostic, facts: [`path ${refusal.path}`] };
|
|
@@ -53,14 +46,12 @@ function projectRefusal(refusal) {
|
|
|
53
46
|
return {
|
|
54
47
|
diagnostic,
|
|
55
48
|
facts: [
|
|
56
|
-
`
|
|
57
|
-
`related
|
|
58
|
-
`declaring
|
|
49
|
+
`debt ${refusal.debtId}`,
|
|
50
|
+
`related debt ${refusal.related}`,
|
|
51
|
+
`declaring debt ${refusal.declaringDebt}`,
|
|
59
52
|
],
|
|
60
53
|
};
|
|
61
54
|
}
|
|
62
|
-
if (refusal.kind === "invalid-composition")
|
|
63
|
-
return { diagnostic, compositionDiagnostics: refusal.diagnostics };
|
|
64
55
|
return refusal.diagnostic === undefined ? { diagnostic } : { diagnostic, facts: [`detail ${refusal.diagnostic}`] };
|
|
65
56
|
}
|
|
66
57
|
function renderFailure(verb, result, columns) {
|
|
@@ -68,13 +59,13 @@ function renderFailure(verb, result, columns) {
|
|
|
68
59
|
return [...outcomeLines("?", verb, "retry", undefined, columns), result.reason].join("\n");
|
|
69
60
|
}
|
|
70
61
|
const facts = projectRefusal(result.refusal);
|
|
71
|
-
return refusalLines(verb, [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], columns
|
|
62
|
+
return refusalLines(verb, [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], columns).join("\n");
|
|
72
63
|
}
|
|
73
64
|
function edge(label, ref, mark) {
|
|
74
65
|
const prefix = mark === undefined ? ` ${label}` : ` ${mark} ${label}`;
|
|
75
66
|
return `${prefix} ${ref.id} · ${dispositionText(ref.state)}`;
|
|
76
67
|
}
|
|
77
|
-
export function
|
|
68
|
+
export function debtFrameHead(view, scope) {
|
|
78
69
|
return `${view.toUpperCase()} // ${scope}`;
|
|
79
70
|
}
|
|
80
71
|
function updatedAge(updatedAt) {
|
|
@@ -110,17 +101,18 @@ function renderListRow(item, columns, omitDisposition) {
|
|
|
110
101
|
}
|
|
111
102
|
return lines;
|
|
112
103
|
}
|
|
113
|
-
function
|
|
104
|
+
export function renderDebtList(action, scope, result, context = DEFAULT_CONTEXT) {
|
|
105
|
+
const columns = context.columns;
|
|
114
106
|
if (result.kind !== "accepted")
|
|
115
107
|
return renderFailure(action, result, columns);
|
|
116
|
-
const view = action === "ls" ? "
|
|
108
|
+
const view = action === "ls" ? "debts" : action;
|
|
117
109
|
const footer = result.value.hasMore ? ["…"] : [];
|
|
118
110
|
const scopeText = scope === "world"
|
|
119
111
|
? "world"
|
|
120
112
|
: scope === "current"
|
|
121
113
|
? "current namespace"
|
|
122
|
-
: `namespace ${scope.namespace.replace(/^
|
|
123
|
-
const heading =
|
|
114
|
+
: `namespace ${scope.namespace.replace(/^debt\//u, "").replace(/\/$/u, "") || "root"}`;
|
|
115
|
+
const heading = debtFrameHead(view, scopeText);
|
|
124
116
|
if (result.value.rows.length === 0)
|
|
125
117
|
return emptyCatalogue(view);
|
|
126
118
|
return [
|
|
@@ -133,12 +125,12 @@ function textTimestamp(timestamp) {
|
|
|
133
125
|
return timestamp.replace(/\.\d+(?=Z$)/u, "");
|
|
134
126
|
}
|
|
135
127
|
function renderShowDetail(result, columns) {
|
|
136
|
-
const
|
|
128
|
+
const debt = result.debt;
|
|
137
129
|
const lines = [
|
|
138
|
-
...entityLines(stateEntity(
|
|
139
|
-
` created ${textTimestamp(
|
|
140
|
-
` updated ${textTimestamp(
|
|
141
|
-
...(
|
|
130
|
+
...entityLines(stateEntity(debt), columns),
|
|
131
|
+
` created ${textTimestamp(debt.createdAt)}`,
|
|
132
|
+
` updated ${textTimestamp(debt.updatedAt)}`,
|
|
133
|
+
...(debt.createdBy === undefined ? [] : [` created by ${debt.createdBy}`]),
|
|
142
134
|
];
|
|
143
135
|
for (const need of result.needs.filter((item) => !item.released))
|
|
144
136
|
lines.push(edge("needs", need, "!"));
|
|
@@ -156,13 +148,14 @@ function renderShowDetail(result, columns) {
|
|
|
156
148
|
lines.push(edge("superseded-by", item));
|
|
157
149
|
for (const item of result.related)
|
|
158
150
|
lines.push(edge("related", item));
|
|
159
|
-
if (
|
|
160
|
-
receiptPayload(lines, "note",
|
|
161
|
-
if (
|
|
162
|
-
receiptPayload(lines, "body",
|
|
151
|
+
if (debt.note.length > 0)
|
|
152
|
+
receiptPayload(lines, "note", debt.note);
|
|
153
|
+
if (debt.body.length > 0)
|
|
154
|
+
receiptPayload(lines, "body", debt.body);
|
|
163
155
|
return lines.join("\n");
|
|
164
156
|
}
|
|
165
|
-
function
|
|
157
|
+
export function renderDebtShow(result, context = DEFAULT_CONTEXT) {
|
|
158
|
+
const columns = context.columns;
|
|
166
159
|
if (Array.isArray(result))
|
|
167
160
|
return result.map((detail) => renderShowDetail(detail, columns)).join("\n\n");
|
|
168
161
|
if ("kind" in result)
|
|
@@ -172,18 +165,18 @@ function renderShow(result, columns) {
|
|
|
172
165
|
function treeLines(node, columns, depth = 0) {
|
|
173
166
|
const indent = " ".repeat(depth);
|
|
174
167
|
if (node.cycle === true)
|
|
175
|
-
return [`${indent}! ${node.
|
|
168
|
+
return [`${indent}! ${node.debt.id} · cycle`];
|
|
176
169
|
return [
|
|
177
|
-
...entityLines(stateEntity(node.
|
|
170
|
+
...entityLines(stateEntity(node.debt), columns, indent),
|
|
178
171
|
...node.children.flatMap((child) => treeLines(child, columns, depth + 1)),
|
|
179
172
|
];
|
|
180
173
|
}
|
|
181
174
|
function doctorIssue(issue) {
|
|
182
175
|
if (issue.kind === "missing-target")
|
|
183
|
-
return `! missing-target ${issue.
|
|
176
|
+
return `! missing-target ${issue.debtId} ${issue.relation} ${issue.target}`;
|
|
184
177
|
if (issue.kind === "self-relation")
|
|
185
|
-
return `! self-relation ${issue.
|
|
186
|
-
return `! cycle ${issue.relation} ${issue.
|
|
178
|
+
return `! self-relation ${issue.debtId} ${issue.relation}`;
|
|
179
|
+
return `! cycle ${issue.relation} ${issue.debts.join(" ")}`;
|
|
187
180
|
}
|
|
188
181
|
export function renderDoctor(report) {
|
|
189
182
|
if (report.issues.length === 0)
|
|
@@ -193,18 +186,14 @@ export function renderDoctor(report) {
|
|
|
193
186
|
}
|
|
194
187
|
const PAST_VERBS = {
|
|
195
188
|
add: "added",
|
|
196
|
-
start: "started",
|
|
197
|
-
stop: "stopped",
|
|
198
|
-
hold: "held",
|
|
199
|
-
resume: "resumed",
|
|
200
189
|
done: "done",
|
|
201
190
|
drop: "dropped",
|
|
202
191
|
update: "updated",
|
|
203
192
|
};
|
|
204
|
-
function renderAcceptedMutation(verb,
|
|
193
|
+
function renderAcceptedMutation(verb, debt, columns, changes = []) {
|
|
205
194
|
const lines = [];
|
|
206
|
-
receiptRow(lines, "✓", PAST_VERBS[verb] ?? verb, [{ text:
|
|
207
|
-
lines.push(...entityLines(stateEntity(
|
|
195
|
+
receiptRow(lines, "✓", PAST_VERBS[verb] ?? verb, [{ text: debt.id, opaque: true }], columns);
|
|
196
|
+
lines.push(...entityLines(stateEntity(debt), columns));
|
|
208
197
|
for (const change of changes)
|
|
209
198
|
lines.push(` ${change.field} ${change.action}`);
|
|
210
199
|
return lines.join("\n");
|
|
@@ -214,10 +203,11 @@ function renderMutation(action, result, columns) {
|
|
|
214
203
|
return renderFailure(action, result, columns);
|
|
215
204
|
return renderAcceptedMutation(action, result.value, columns);
|
|
216
205
|
}
|
|
217
|
-
function
|
|
206
|
+
export function renderDebtUpdate(result, context = DEFAULT_CONTEXT) {
|
|
207
|
+
const columns = context.columns;
|
|
218
208
|
if (result.kind !== "accepted")
|
|
219
209
|
return renderFailure("update", result, columns);
|
|
220
|
-
return renderAcceptedMutation("update", result.value.
|
|
210
|
+
return renderAcceptedMutation("update", result.value.debt, columns, result.value.changedFields);
|
|
221
211
|
}
|
|
222
212
|
function renderBatchItem(verb, item, columns) {
|
|
223
213
|
if (item.outcome.kind === "accepted")
|
|
@@ -225,100 +215,32 @@ function renderBatchItem(verb, item, columns) {
|
|
|
225
215
|
if (item.outcome.kind === "retry")
|
|
226
216
|
return `? ${verb} ${item.id} ${item.outcome.reason}`;
|
|
227
217
|
const facts = projectRefusal(item.outcome.refusal);
|
|
228
|
-
const rest = (facts.facts ?? []).filter((fact) => fact !== `
|
|
229
|
-
return refusalLines(verb, [`
|
|
218
|
+
const rest = (facts.facts ?? []).filter((fact) => fact !== `debt ${item.id}`);
|
|
219
|
+
return refusalLines(verb, [`debt ${item.id}`, `reason ${facts.diagnostic}`, ...rest], columns).join("\n");
|
|
230
220
|
}
|
|
231
221
|
function renderBatch(verb, batch, columns) {
|
|
232
222
|
return batch.items.map((item) => renderBatchItem(verb, item, columns)).join("\n");
|
|
233
223
|
}
|
|
234
|
-
function
|
|
235
|
-
return admissions.map((admission) => `admit ${admission.position} ${admission.kind === "new" ? "+" : `@${admission.taskId}`} ${safeText(admission.title)}${admission.kind === "new" && admission.alias !== undefined ? ` as ^${admission.alias}` : ""}`);
|
|
236
|
-
}
|
|
237
|
-
function stoppedLines(stopped) {
|
|
238
|
-
if (stopped.kind === "retry")
|
|
239
|
-
return [`? stopped ${stopped.reason}`];
|
|
240
|
-
const facts = projectRefusal(stopped);
|
|
241
|
-
return refusalLines("stopped", [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], DEFAULT_CLI_COLUMNS);
|
|
242
|
-
}
|
|
243
|
-
function aliasLines(aliases) {
|
|
244
|
-
return aliases.map((binding) => `alias ^${binding.alias} ${binding.taskId}`);
|
|
245
|
-
}
|
|
246
|
-
function planAliasLines(aliases) {
|
|
247
|
-
return aliases.map((binding) => `alias ^${binding.alias} ${binding.position}`);
|
|
248
|
-
}
|
|
249
|
-
function renderPlan(result) {
|
|
250
|
-
const lines = [
|
|
251
|
-
`compose plan · ${result.admissionOrder.length} documents`,
|
|
252
|
-
...planAliasLines(result.aliases),
|
|
253
|
-
...admissionLines(result.admissions),
|
|
254
|
-
];
|
|
255
|
-
for (const body of result.bodies) {
|
|
256
|
-
lines.push(`body ${body.position} + ${safeText(body.title)} · ${body.bytes} bytes`);
|
|
257
|
-
lines.push(` first ${safeText(body.firstLine)}`);
|
|
258
|
-
lines.push(` last ${safeText(body.lastLine)}`);
|
|
259
|
-
}
|
|
260
|
-
return lines.join("\n");
|
|
261
|
-
}
|
|
262
|
-
function renderCompose(result, columns) {
|
|
263
|
-
if (result.kind === "incomplete")
|
|
264
|
-
return "";
|
|
265
|
-
if (result.kind === "planned")
|
|
266
|
-
return renderPlan(result);
|
|
267
|
-
if (result.kind !== "accepted")
|
|
268
|
-
return renderFailure("compose", result, columns);
|
|
269
|
-
return [
|
|
270
|
-
`✓ composed · ${result.documentChanges.length} changed`,
|
|
271
|
-
...aliasLines(result.aliases),
|
|
272
|
-
...admissionLines(result.admissions),
|
|
273
|
-
].join("\n");
|
|
274
|
-
}
|
|
275
|
-
/** One addressed show selection rendered directly from its native answer. */
|
|
276
|
-
export function renderTaskShow(result, context = DEFAULT_CONTEXT) {
|
|
277
|
-
return renderShow(result, context.columns);
|
|
278
|
-
}
|
|
279
|
-
/** One list read rendered from its native answer and the leaf's presentation-only scope. */
|
|
280
|
-
export function renderTaskList(action, scope, result, context = DEFAULT_CONTEXT) {
|
|
281
|
-
return renderRows(action, scope, result, context.columns);
|
|
282
|
-
}
|
|
283
|
-
export function renderTaskTree(result, context = DEFAULT_CONTEXT) {
|
|
224
|
+
export function renderDebtTree(result, context = DEFAULT_CONTEXT) {
|
|
284
225
|
return result.kind === "accepted"
|
|
285
226
|
? treeLines(result.value, context.columns).join("\n")
|
|
286
227
|
: renderFailure("tree", result, context.columns);
|
|
287
228
|
}
|
|
288
|
-
export function
|
|
229
|
+
export function renderDebtContext(result, context = DEFAULT_CONTEXT) {
|
|
289
230
|
if (result.kind !== "accepted")
|
|
290
231
|
return renderFailure("context", result, context.columns);
|
|
291
232
|
const value = result.value.namespace.length === 0 ? "root" : result.value.namespace.join("/");
|
|
292
233
|
return `context ${value} · ${result.value.source}`;
|
|
293
234
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
/** One single-Task mutation answer; `verb` is the literal action the leaf invoked. */
|
|
298
|
-
export function renderTaskMutation(verb, result, context = DEFAULT_CONTEXT) {
|
|
235
|
+
/** One single-Debt mutation answer; `verb` is the literal action the leaf invoked. */
|
|
236
|
+
export function renderDebtMutation(verb, result, context = DEFAULT_CONTEXT) {
|
|
299
237
|
return renderMutation(verb, result, context.columns);
|
|
300
238
|
}
|
|
301
|
-
export function renderTaskUpdate(result, context = DEFAULT_CONTEXT) {
|
|
302
|
-
return renderUpdate(result, context.columns);
|
|
303
|
-
}
|
|
304
239
|
/** One lifecycle answer: a single mutation or a plural batch, both native shapes. */
|
|
305
|
-
export function
|
|
240
|
+
export function renderDebtLifecycle(verb, result, context = DEFAULT_CONTEXT) {
|
|
306
241
|
return "items" in result ? renderBatch(verb, result, context.columns) : renderMutation(verb, result, context.columns);
|
|
307
242
|
}
|
|
308
|
-
|
|
309
|
-
export function renderTaskFailure(verb, result, context = DEFAULT_CONTEXT) {
|
|
310
|
-
return renderFailure(verb, result, context.columns);
|
|
311
|
-
}
|
|
312
|
-
export function renderTaskIncompleteDiagnostic(result) {
|
|
313
|
-
if (result.kind !== "incomplete")
|
|
314
|
-
return "";
|
|
315
|
-
return [
|
|
316
|
-
`! compose incomplete ${result.documentChanges.length} admitted`,
|
|
317
|
-
...admissionLines(result.admissions.slice(0, result.documentChanges.length)),
|
|
318
|
-
...stoppedLines(result.stopped),
|
|
319
|
-
].join("\n");
|
|
320
|
-
}
|
|
321
|
-
export function taskExitCode(result) {
|
|
243
|
+
export function debtExitCode(result) {
|
|
322
244
|
if ("issues" in result)
|
|
323
245
|
return result.issues.length === 0 ? 0 : 1;
|
|
324
246
|
if ("items" in result) {
|
|
@@ -328,7 +250,7 @@ export function taskExitCode(result) {
|
|
|
328
250
|
if ("kind" in result) {
|
|
329
251
|
if (result.kind === "retry")
|
|
330
252
|
return 2;
|
|
331
|
-
if (result.kind === "refused"
|
|
253
|
+
if (result.kind === "refused")
|
|
332
254
|
return 1;
|
|
333
255
|
}
|
|
334
256
|
return 0;
|