@astrosheep/keiyaku 4.6.30 → 4.6.31
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 +5 -5
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/opencode/package.json +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +12 -12
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/plugins/pi/README.md +5 -5
- package/build/plugins/pi/akuma-tools.ts +17 -23
- package/build/skills/keiyaku/SKILL.md +12 -12
- package/build/skills/keiyaku-akuma/SKILL.md +16 -16
- package/build/skills/keiyaku-akuma/references/automation.md +14 -14
- package/build/skills/keiyaku-babysit/SKILL.md +10 -10
- package/build/skills/keiyaku-bind/SKILL.md +15 -15
- package/build/skills/keiyaku-debt/SKILL.md +16 -16
- package/build/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/src/akuma/akuma-call.d.ts +1 -1
- package/build/src/akuma/akuma-call.js +9 -9
- package/build/src/akuma/akuma-errors.d.ts +5 -5
- package/build/src/akuma/akuma-instance.d.ts +355 -12
- package/build/src/akuma/akuma-instance.js +20 -20
- package/build/src/akuma/akuma-observe.d.ts +11 -12
- package/build/src/akuma/akuma-observe.js +34 -26
- package/build/src/akuma/akuma-owner.d.ts +32 -11
- package/build/src/akuma/akuma-owner.js +35 -16
- package/build/src/akuma/akuma-probe.d.ts +3 -3
- package/build/src/akuma/akuma-probe.js +2 -2
- package/build/src/akuma/akuma-selection-execution.d.ts +985 -1
- package/build/src/akuma/akuma-selection-execution.js +42 -18
- package/build/src/akuma/akuma-stream.d.ts +2 -2
- package/build/src/akuma/akuma-stream.js +1 -1
- package/build/src/akuma/akuma-wait.d.ts +5 -5
- package/build/src/akuma/akuma-wait.js +52 -14
- package/build/src/akuma/akuma.d.ts +245 -271
- package/build/src/akuma/akuma.js +98 -46
- package/build/src/akuma/archetype.d.ts +19 -6
- package/build/src/akuma/archetype.js +25 -9
- package/build/src/akuma/body-launch.d.ts +2 -2
- package/build/src/akuma/body.js +4 -4
- package/build/src/akuma/call-initial-tell.d.ts +60 -44
- package/build/src/akuma/call-initial-tell.js +41 -2
- package/build/src/akuma/caller.d.ts +26 -17
- package/build/src/akuma/caller.js +22 -9
- package/build/src/akuma/coordinate.d.ts +9 -0
- package/build/src/akuma/coordinate.js +13 -0
- package/build/src/akuma/detached-body.js +2 -2
- package/build/src/akuma/dispatch-association.d.ts +4 -4
- package/build/src/akuma/dispatch-association.js +12 -3
- package/build/src/akuma/execution-instructions.js +2 -2
- package/build/src/akuma/heart/facts.d.ts +29 -7
- package/build/src/akuma/heart/facts.js +13 -0
- package/build/src/akuma/heart/index.d.ts +0 -3
- package/build/src/akuma/heart/index.js +3 -6
- package/build/src/akuma/heart/rows.js +2 -2
- package/build/src/akuma/heart/soul.js +5 -5
- package/build/src/akuma/identity.d.ts +17 -16
- package/build/src/akuma/identity.js +20 -19
- package/build/src/akuma/index.d.ts +1 -2
- package/build/src/akuma/lineage-cache.d.ts +4 -4
- package/build/src/akuma/lineage-cache.js +10 -10
- package/build/src/akuma/projection-read.d.ts +2 -5
- package/build/src/akuma/projection-read.js +34 -47
- package/build/src/akuma/projection.d.ts +659 -569
- package/build/src/akuma/projection.js +203 -94
- package/build/src/akuma/providers/acp/index.js +1 -1
- package/build/src/akuma/providers/execution-environment.d.ts +1 -3
- package/build/src/akuma/providers/execution-environment.js +0 -4
- package/build/src/akuma/publication.d.ts +2 -2
- package/build/src/akuma/publication.js +3 -3
- package/build/src/akuma/retention.js +2 -2
- package/build/src/akuma/selection-observation.d.ts +507 -43
- package/build/src/akuma/selection-observation.js +153 -1
- package/build/src/akuma/status-projection.d.ts +288 -0
- package/build/src/akuma/status-projection.js +154 -0
- package/build/src/akuma/turn-drive.js +0 -3
- package/build/src/alias/index.d.ts +9 -4
- package/build/src/alias/index.js +11 -9
- package/build/src/bounded-list.d.ts +8 -0
- package/build/src/bounded-list.js +9 -0
- package/build/src/cli/commands/akuma-grammar.d.ts +2 -2
- package/build/src/cli/commands/akuma-grammar.js +21 -21
- package/build/src/cli/commands/akuma.d.ts +1 -2
- package/build/src/cli/commands/akuma.js +115 -251
- package/build/src/cli/commands/contract-grammar.d.ts +4 -3
- package/build/src/cli/commands/contract-grammar.js +39 -22
- package/build/src/cli/commands/contract-help.d.ts +3 -1
- package/build/src/cli/commands/contract-help.js +4 -3
- package/build/src/cli/commands/contract.d.ts +6 -3
- package/build/src/cli/commands/contract.js +203 -434
- package/build/src/cli/commands/debt.d.ts +2 -3
- package/build/src/cli/commands/debt.js +101 -317
- package/build/src/cli/commands/report.js +11 -28
- package/build/src/cli/commands/whoami.d.ts +3 -43
- package/build/src/cli/commands/whoami.js +8 -121
- package/build/src/cli/coordinates.d.ts +4 -35
- package/build/src/cli/coordinates.js +13 -129
- package/build/src/cli/parse.d.ts +0 -6
- package/build/src/cli/parse.js +5 -48
- package/build/src/cli/render/akuma-activity.d.ts +31 -16
- package/build/src/cli/render/akuma-activity.js +157 -149
- package/build/src/cli/render/akuma-tool.d.ts +3 -6
- package/build/src/cli/render/akuma-tool.js +20 -14
- package/build/src/cli/render/akuma.d.ts +25 -26
- package/build/src/cli/render/akuma.js +100 -129
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +52 -99
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +140 -215
- package/build/src/cli/render/contract-observation.d.ts +43 -30
- package/build/src/cli/render/contract-observation.js +64 -31
- package/build/src/cli/render/contract-wait.js +6 -6
- package/build/src/cli/render/contract.d.ts +41 -6
- package/build/src/cli/render/contract.js +274 -370
- package/build/src/cli/render/debt.d.ts +9 -19
- package/build/src/cli/render/debt.js +120 -185
- package/build/src/cli/render/delivery-preview.d.ts +4 -3
- package/build/src/cli/render/delivery-preview.js +68 -96
- package/build/src/cli/render/kanshi-akuma.d.ts +4 -4
- package/build/src/cli/render/kanshi-akuma.js +70 -59
- package/build/src/cli/render/kanshi.d.ts +4 -4
- package/build/src/cli/render/kanshi.js +205 -221
- package/build/src/cli/render/marks.d.ts +11 -2
- package/build/src/cli/render/marks.js +13 -3
- package/build/src/cli/render/nuke.d.ts +3 -3
- package/build/src/cli/render/nuke.js +13 -16
- package/build/src/cli/render/receipt.d.ts +37 -43
- package/build/src/cli/render/receipt.js +313 -236
- package/build/src/cli/render/reconcile.d.ts +6 -4
- package/build/src/cli/render/reconcile.js +53 -137
- package/build/src/cli/render/refusal.d.ts +3 -2
- package/build/src/cli/render/refusal.js +73 -54
- package/build/src/cli/render/region.d.ts +11 -2
- package/build/src/cli/render/region.js +17 -23
- package/build/src/cli/render/settings.d.ts +0 -1
- package/build/src/cli/render/settings.js +8 -17
- package/build/src/cli/render/terminal.d.ts +2 -0
- package/build/src/cli/render/verbs.d.ts +4 -0
- package/build/src/cli/render/verbs.js +312 -0
- package/build/src/cli/render/whoami.d.ts +1 -1
- package/build/src/cli/render/whoami.js +24 -31
- package/build/src/cli/runtime.d.ts +3 -11
- package/build/src/cli/runtime.js +96 -79
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/streams.js +1 -0
- package/build/src/contract-guidance.js +2 -2
- package/build/src/contract-worktree.d.ts +2 -15
- package/build/src/contract-worktree.js +19 -35
- package/build/src/core/facts/observation.d.ts +4 -5
- package/build/src/core/facts/observation.js +7 -9
- package/build/src/core/verbs/amend.d.ts +0 -1
- package/build/src/core/verbs/amend.js +3 -3
- package/build/src/core/verbs/bind.d.ts +0 -1
- package/build/src/core/verbs/bind.js +5 -5
- package/build/src/core/verbs/deliver.d.ts +3 -2
- package/build/src/core/verbs/deliver.js +2 -2
- package/build/src/core/verbs/placement.d.ts +0 -5
- package/build/src/core/verbs/placement.js +4 -6
- package/build/src/core/verbs/reintegrate.d.ts +0 -1
- package/build/src/core/verbs/reintegrate.js +2 -2
- package/build/src/debt/board.d.ts +132 -116
- package/build/src/debt/board.js +138 -94
- package/build/src/debt/catalog.d.ts +4 -4
- package/build/src/debt/catalog.js +2 -18
- package/build/src/debt/context.d.ts +15 -3
- package/build/src/debt/context.js +12 -1
- package/build/src/debt/created-observation.d.ts +5 -17
- package/build/src/debt/created-observation.js +14 -6
- package/build/src/debt/document.d.ts +20 -15
- package/build/src/debt/document.js +18 -1
- package/build/src/debt/index.d.ts +346 -23
- package/build/src/debt/index.js +68 -22
- package/build/src/debt/input.d.ts +2 -1
- package/build/src/debt/input.js +14 -0
- package/build/src/debt/lifecycle-operations.d.ts +2 -2
- package/build/src/debt/lifecycle-operations.js +14 -22
- package/build/src/debt/operation-types.d.ts +188 -66
- package/build/src/debt/operation-types.js +113 -1
- package/build/src/debt/operations.d.ts +11 -10
- package/build/src/debt/operations.js +46 -71
- package/build/src/debt/query.d.ts +14 -10
- package/build/src/debt/query.js +3 -12
- package/build/src/debt/store.d.ts +4 -2
- package/build/src/debt/store.js +8 -8
- package/build/src/debt/view.d.ts +0 -3
- package/build/src/debt/view.js +0 -4
- package/build/src/dispatch/index.d.ts +22 -5
- package/build/src/dispatch/index.js +46 -37
- package/build/src/git/admission.d.ts +2 -2
- package/build/src/git/admission.js +2 -1
- package/build/src/git/hooks.d.ts +14 -35
- package/build/src/git/hooks.js +45 -25
- package/build/src/git/integration.d.ts +6 -24
- package/build/src/git/integration.js +10 -16
- package/build/src/git/private-state-seat.d.ts +2 -2
- package/build/src/git/private-state-seat.js +2 -1
- package/build/src/git/reconcile.d.ts +17 -79
- package/build/src/git/reconcile.js +37 -52
- package/build/src/git/scratch.d.ts +3 -3
- package/build/src/git/scratch.js +4 -1
- package/build/src/git/target-placement.d.ts +23 -31
- package/build/src/git/target-placement.js +42 -27
- package/build/src/git/target.d.ts +2 -2
- package/build/src/git/target.js +2 -1
- package/build/src/git/tender.d.ts +7 -39
- package/build/src/git/tender.js +21 -54
- package/build/src/git/terminal-reconcile.js +15 -18
- package/build/src/git/terminal-seal.d.ts +2 -4
- package/build/src/git/terminal-seal.js +7 -33
- package/build/src/git/workspace.d.ts +65 -41
- package/build/src/git/workspace.js +45 -14
- package/build/src/identity/selector.d.ts +2 -0
- package/build/src/identity/selector.js +13 -3
- package/build/src/index.d.ts +48 -54
- package/build/src/index.js +31 -43
- package/build/src/kanshi/counts.d.ts +42 -8
- package/build/src/kanshi/counts.js +13 -2
- package/build/src/kanshi/index.d.ts +5 -5
- package/build/src/kanshi/index.js +4 -3
- package/build/src/kanshi/read.d.ts +489 -6
- package/build/src/kanshi/read.js +334 -483
- package/build/src/kanshi/report.d.ts +2504 -103
- package/build/src/kanshi/report.js +165 -1
- package/build/src/kanshi/select.d.ts +0 -8
- package/build/src/kanshi/select.js +20 -59
- package/build/src/library/address.d.ts +8 -8
- package/build/src/library/address.js +7 -7
- package/build/src/library/akuma-creation.d.ts +690 -84
- package/build/src/library/akuma-creation.js +202 -142
- package/build/src/library/akuma-retention.d.ts +2 -2
- package/build/src/library/akuma-retention.js +2 -2
- package/build/src/library/akumas.d.ts +10 -6
- package/build/src/library/akumas.js +24 -7
- package/build/src/library/bind.d.ts +28 -54
- package/build/src/library/bind.js +6 -4
- package/build/src/library/continuation.d.ts +197 -479
- package/build/src/library/continuation.js +40 -23
- package/build/src/library/contract-address.d.ts +6 -5
- package/build/src/library/contract-address.js +5 -7
- package/build/src/library/contract-composition.d.ts +18 -12
- package/build/src/library/contract-composition.js +55 -47
- package/build/src/library/contract-creation.d.ts +3 -2
- package/build/src/library/contract-creation.js +38 -32
- package/build/src/library/contract-execution.js +77 -38
- package/build/src/library/contract-outcomes.d.ts +1877 -27
- package/build/src/library/contract-outcomes.js +93 -10
- package/build/src/library/contract-settings.d.ts +2 -2
- package/build/src/library/contract-settings.js +18 -14
- package/build/src/library/contract-types.d.ts +238 -61
- package/build/src/library/contract-types.js +131 -1
- package/build/src/library/contract-wait.d.ts +38 -17
- package/build/src/library/contract-wait.js +40 -10
- package/build/src/library/delivery.d.ts +588 -36
- package/build/src/library/delivery.js +35 -27
- package/build/src/library/input.d.ts +1 -1
- package/build/src/library/input.js +1 -2
- package/build/src/library/invocation.d.ts +11 -7
- package/build/src/library/invocation.js +42 -51
- package/build/src/library/kei.d.ts +48 -0
- package/build/src/library/kei.js +256 -0
- package/build/src/library/keiyaku-attribution.d.ts +11 -0
- package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
- package/build/src/library/keiyaku-classify.d.ts +11 -0
- package/build/src/library/keiyaku-classify.js +146 -0
- package/build/src/library/keiyaku-coordinates.d.ts +31 -0
- package/build/src/library/keiyaku-coordinates.js +103 -0
- package/build/src/library/keiyaku-debt.d.ts +142 -0
- package/build/src/library/keiyaku-debt.js +188 -0
- package/build/src/library/keiyaku-identity.d.ts +58 -0
- package/build/src/library/keiyaku-identity.js +176 -0
- package/build/src/library/keiyaku-policy.d.ts +27 -0
- package/build/src/library/keiyaku-policy.js +44 -0
- package/build/src/library/keiyaku-status.d.ts +1487 -0
- package/build/src/library/keiyaku-status.js +92 -0
- package/build/src/library/keiyaku-verbs.d.ts +6774 -0
- package/build/src/library/keiyaku-verbs.js +458 -0
- package/build/src/library/keiyaku.d.ts +871 -38
- package/build/src/library/keiyaku.js +677 -127
- package/build/src/library/nuke.d.ts +22 -0
- package/build/src/library/nuke.js +4 -1
- package/build/src/library/outcome.d.ts +706 -692
- package/build/src/library/outcome.js +582 -167
- package/build/src/library/reconcile.d.ts +464 -116
- package/build/src/library/reconcile.js +174 -102
- package/build/src/library/refusal.d.ts +113 -577
- package/build/src/library/refusal.js +64 -51
- package/build/src/library/region.d.ts +5 -24
- package/build/src/library/region.js +6 -21
- package/build/src/library/selection.d.ts +181 -32
- package/build/src/library/selection.js +99 -64
- package/build/src/mcp/adapter.d.ts +11 -0
- package/build/src/mcp/adapter.js +106 -0
- package/build/src/mcp/help.d.ts +1 -0
- package/build/src/mcp/help.js +26 -0
- package/build/src/mcp/index.d.ts +2 -0
- package/build/src/mcp/index.js +37 -0
- package/build/src/plugin/public.d.ts +1 -1
- package/build/src/plugin/runtime.js +17 -14
- package/build/src/protocol/arc.d.ts +4 -1
- package/build/src/protocol/arc.js +7 -1
- package/build/src/protocol/attempt.d.ts +2 -3
- package/build/src/protocol/attempt.js +1 -10
- package/build/src/protocol/bind.d.ts +6 -7
- package/build/src/protocol/bind.js +9 -5
- package/build/src/protocol/completion.d.ts +448 -12
- package/build/src/protocol/completion.js +164 -26
- package/build/src/protocol/deliver.d.ts +26 -24
- package/build/src/protocol/deliver.js +24 -52
- package/build/src/protocol/delivery-preview.d.ts +97 -247
- package/build/src/protocol/delivery-preview.js +132 -128
- package/build/src/protocol/execution-observation.d.ts +146 -123
- package/build/src/protocol/execution-observation.js +9 -6
- package/build/src/protocol/intent.d.ts +9 -48
- package/build/src/protocol/intent.js +32 -46
- package/build/src/protocol/operations.d.ts +207 -505
- package/build/src/protocol/operations.js +81 -134
- package/build/src/protocol/placement.d.ts +0 -1
- package/build/src/protocol/placement.js +5 -2
- package/build/src/protocol/progress.d.ts +7 -97
- package/build/src/protocol/progress.js +7 -55
- package/build/src/protocol/read/observation.d.ts +13 -6
- package/build/src/protocol/read/observation.js +10 -9
- package/build/src/protocol/read/status.d.ts +464 -93
- package/build/src/protocol/read/status.js +372 -85
- package/build/src/protocol/reconcile.d.ts +2 -0
- package/build/src/protocol/reconcile.js +12 -11
- package/build/src/protocol/reintegrate.d.ts +0 -1
- package/build/src/protocol/reintegrate.js +4 -4
- package/build/src/protocol/result-leaves.d.ts +528 -0
- package/build/src/protocol/result-leaves.js +195 -0
- package/build/src/protocol/result-reasons.d.ts +129 -0
- package/build/src/protocol/result-reasons.js +87 -0
- package/build/src/protocol/review.d.ts +14 -11
- package/build/src/protocol/review.js +30 -14
- package/build/src/protocol/run.d.ts +4 -4
- package/build/src/protocol/run.js +4 -1
- package/build/src/protocol/verify.d.ts +359 -30
- package/build/src/protocol/verify.js +118 -28
- package/build/src/region.d.ts +26 -0
- package/build/src/region.js +28 -0
- package/build/src/runtime/proc/diagnostic.d.ts +11 -0
- package/build/src/runtime/proc/diagnostic.js +20 -0
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +126 -32
- package/build/src/settings.js +107 -34
- package/build/src/settlement/settle.d.ts +29 -12
- package/build/src/settlement/settle.js +22 -15
- package/build/src/verification/declaration.d.ts +1 -3
- package/build/src/verification/declaration.js +2 -5
- package/build/src/verification/execution.d.ts +7 -19
- package/build/src/verification/execution.js +37 -16
- package/build/src/verification/observation.d.ts +13 -13
- package/build/src/verification/observation.js +9 -7
- package/build/src/world.d.ts +8 -0
- package/build/src/world.js +7 -0
- package/package.json +6 -5
- package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
- package/plugins/paseo/plugin/server/message.ts +8 -30
- package/plugins/paseo/plugin/server/mirror.ts +16 -20
- package/plugins/paseo/plugin/server/provider.ts +1 -1
- package/plugins/paseo/plugin/server/sdk.ts +14 -6
- package/plugins/pi/README.md +5 -5
- package/plugins/pi/akuma-tools.ts +17 -23
- package/skills/keiyaku/SKILL.md +12 -12
- package/skills/keiyaku-akuma/SKILL.md +16 -16
- package/skills/keiyaku-akuma/references/automation.md +14 -14
- package/skills/keiyaku-babysit/SKILL.md +10 -10
- package/skills/keiyaku-bind/SKILL.md +15 -15
- package/skills/keiyaku-debt/SKILL.md +16 -16
- package/skills/keiyaku-workflow/SKILL.md +21 -21
- package/build/src/cli/actor.d.ts +0 -10
- package/build/src/cli/actor.js +0 -24
- package/build/src/cli/akuma-caller.d.ts +0 -3
- package/build/src/cli/akuma-caller.js +0 -31
- package/build/src/cli/delivery-identity.d.ts +0 -3
- package/build/src/cli/render/effects.d.ts +0 -26
- package/build/src/cli/render/effects.js +0 -41
- package/build/src/cli/selectors.d.ts +0 -10
- package/build/src/cli/selectors.js +0 -42
- package/build/src/markdown/diff.d.ts +0 -1
- package/build/src/markdown/diff.js +0 -4
|
@@ -1,29 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { BlockedDebtList, DebtBatchResult, DebtContextResult, DebtDecompositionTree, DebtDetail, DebtDoctorReport, DebtList, DebtMutationResult, DebtQueryResult, DebtUpdateResult } from "../../debt/index.js";
|
|
1
|
+
import type { BlockedDebtRow, DebtAbsent, DebtBatchResult, DebtCatalogue, DebtContextResult, DebtDoctorReport, DebtMutationResult, DebtParentReadRefusal, DebtReadPage, DebtReadRefusal, DebtShowResult, DebtSummary, DebtTreeResult, DebtUpdateResult, ReadyDebtRow } from "../../debt/index.js";
|
|
3
2
|
import { type TextRenderContext } from "./terminal.js";
|
|
4
3
|
export { debtMark } from "./marks.js";
|
|
5
|
-
type DebtListOutcome = DebtList | BlockedDebtList | DebtQueryResult;
|
|
6
|
-
/** One addressed show selection: native details, or a refusal naming a missing addressed read. */
|
|
7
|
-
export type DebtShowResult = DebtDetail | DebtDetail[] | Extract<DebtMutationResult, {
|
|
8
|
-
kind: "refused";
|
|
9
|
-
}>;
|
|
10
4
|
/** Presentation-only list scope the leaf acquired; never part of a product value. */
|
|
11
5
|
export type DebtListScope = "world" | "current" | Readonly<{
|
|
12
6
|
namespace: string;
|
|
13
7
|
}>;
|
|
14
|
-
/** The union of native Debt SDK answers one leaf renders directly; the CLI adds no result envelope. */
|
|
15
|
-
type DebtNativeResult = DebtMutationResult | DebtUpdateResult | DebtBatchResult | DebtShowResult | DebtList | BlockedDebtList | DebtQueryResult | DebtDecompositionTree | DebtDoctorReport | DebtContextResult;
|
|
16
|
-
/** Debt dispositions and relation states are snake_case facts; people read them as words. */
|
|
17
8
|
export declare function dispositionText(word: string): string;
|
|
18
9
|
export declare function debtFrameHead(view: string, scope: string): string;
|
|
19
|
-
export declare function renderDebtList(action: "ls" | "ready" | "blocked" | "query", scope: DebtListScope, result:
|
|
20
|
-
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
10
|
+
export declare function renderDebtList(action: "ls" | "ready" | "blocked" | "query", scope: DebtListScope, result: DebtCatalogue | DebtReadPage<DebtSummary | BlockedDebtRow | ReadyDebtRow, DebtReadRefusal | DebtParentReadRefusal>, context?: TextRenderContext): string;
|
|
11
|
+
/** Each item corresponds to the same invocation position, including missing targets. */
|
|
12
|
+
export declare function renderDebtShow(ids: readonly string[], result: DebtShowResult | DebtAbsent, context?: TextRenderContext): string;
|
|
13
|
+
export declare function renderDoctor(report: DebtDoctorReport | DebtAbsent): string;
|
|
14
|
+
export declare function renderDebtUpdate(id: string | undefined, result: DebtUpdateResult, context?: TextRenderContext): string;
|
|
15
|
+
export declare function renderDebtTree(id: string, result: DebtTreeResult | DebtAbsent, context?: TextRenderContext): string;
|
|
24
16
|
export declare function renderDebtContext(result: DebtContextResult, context?: TextRenderContext): string;
|
|
25
|
-
/**
|
|
17
|
+
/** Creation retains its minted identity in the native answer. */
|
|
26
18
|
export declare function renderDebtMutation(verb: string, result: DebtMutationResult, context?: TextRenderContext): string;
|
|
27
|
-
|
|
28
|
-
export declare function renderDebtLifecycle(verb: string, result: DebtMutationResult | DebtBatchResult, context?: TextRenderContext): string;
|
|
29
|
-
export declare function debtOutcome(result: DebtNativeResult): CliOutcome;
|
|
19
|
+
export declare function renderDebtLifecycle(verb: string, ids: readonly string[], result: DebtBatchResult, context?: TextRenderContext): string;
|
|
@@ -1,174 +1,131 @@
|
|
|
1
1
|
import { debtMark } from "./marks.js";
|
|
2
2
|
import { outcomeLines, receiptPayload, receiptRow, refusalLines } from "./receipt.js";
|
|
3
|
-
import { DEFAULT_CLI_COLUMNS, displayColumns, emptyCatalogue, renderTextBlock, safeText, } from "./terminal.js";
|
|
3
|
+
import { DEFAULT_CLI_COLUMNS, displayColumns, emptyCatalogue, renderOpaqueBlock, renderTextBlock, safeText, } from "./terminal.js";
|
|
4
4
|
export { debtMark } from "./marks.js";
|
|
5
5
|
const DEFAULT_CONTEXT = { columns: DEFAULT_CLI_COLUMNS, color: false };
|
|
6
|
-
/** Debt dispositions and relation states are snake_case facts; people read them as words. */
|
|
7
6
|
export function dispositionText(word) {
|
|
8
7
|
return word === "drop" ? "dropped" : word.replaceAll("_", " ");
|
|
9
8
|
}
|
|
10
|
-
function priorityText(priority) {
|
|
11
|
-
return priority === null ? "P?" : `P${priority}`;
|
|
12
|
-
}
|
|
13
|
-
function scanUnit(id, priority, word) {
|
|
14
|
-
return word === undefined
|
|
15
|
-
? `${debtMark("ready")} ${id} · ${priorityText(priority)}`
|
|
16
|
-
: `${debtMark(word)} ${id} · ${dispositionText(word)} · ${priorityText(priority)}`;
|
|
17
|
-
}
|
|
18
9
|
function entityLines(entity, columns, indent = "") {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
const parts = [
|
|
11
|
+
`${entity.mark} ${entity.id}`,
|
|
12
|
+
...(entity.word === undefined ? [] : [dispositionText(entity.word)]),
|
|
13
|
+
`P${entity.priority}`,
|
|
14
|
+
];
|
|
15
|
+
const scan = `${indent}${parts.join(" · ")}`;
|
|
22
16
|
const title = safeText(entity.title);
|
|
23
17
|
const inline = `${scan} — ${title}`;
|
|
24
18
|
if (displayColumns(inline) <= columns)
|
|
25
19
|
return [inline];
|
|
26
20
|
return [scan, ...renderTextBlock(title, `${indent} `, columns, "—")];
|
|
27
21
|
}
|
|
28
|
-
function stateEntity(debt) {
|
|
29
|
-
return {
|
|
30
|
-
id: debt.id,
|
|
31
|
-
priority: "priority" in debt && debt.priority !== undefined ? debt.priority : null,
|
|
32
|
-
word: debt.state,
|
|
33
|
-
title: debt.title,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
22
|
function projectRefusal(refusal) {
|
|
37
|
-
const diagnostic = refusal.
|
|
38
|
-
if (refusal.
|
|
39
|
-
return { diagnostic, facts: [`debt ${refusal.debtId}`] };
|
|
40
|
-
if (refusal.
|
|
41
|
-
return { diagnostic, facts: [`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
const facts = projectRefusal(result.refusal);
|
|
62
|
-
return refusalLines(verb, [`reason ${facts.diagnostic}`, ...(facts.facts ?? [])], columns).join("\n");
|
|
63
|
-
}
|
|
64
|
-
function edge(label, ref, mark) {
|
|
65
|
-
const prefix = mark === undefined ? ` ${label}` : ` ${mark} ${label}`;
|
|
66
|
-
return `${prefix} ${ref.id} · ${dispositionText(ref.state)}`;
|
|
23
|
+
const diagnostic = refusal.reason.replaceAll("-", " ");
|
|
24
|
+
if (refusal.reason === "debt-missing")
|
|
25
|
+
return { diagnostic, ...("debtId" in refusal ? { facts: [`debt ${refusal.debtId}`] } : {}) };
|
|
26
|
+
if (refusal.reason === "invalid-lifecycle-transition")
|
|
27
|
+
return { diagnostic, facts: [`state ${dispositionText(refusal.state)}`] };
|
|
28
|
+
if (refusal.reason === "invalid-namespace-context")
|
|
29
|
+
return { diagnostic, ...(refusal.path === undefined ? {} : { facts: [`path ${refusal.path}`] }) };
|
|
30
|
+
if (refusal.reason === "relation-owned-by-other")
|
|
31
|
+
return { diagnostic, facts: [`related debt ${refusal.related}`] };
|
|
32
|
+
return { diagnostic, facts: [`detail ${refusal.diagnostic}`] };
|
|
33
|
+
}
|
|
34
|
+
function renderFailure(verb, result, columns, id) {
|
|
35
|
+
if (result.kind === "retry")
|
|
36
|
+
return [...outcomeLines("?", verb, "retry", id, columns), result.reason].join("\n");
|
|
37
|
+
const facts = projectRefusal(result);
|
|
38
|
+
return refusalLines(verb, [...(id === undefined ? [] : [`debt ${id}`]), `reason ${facts.diagnostic}`, ...(facts.facts ?? [])], columns).join("\n");
|
|
39
|
+
}
|
|
40
|
+
/** A cleanup problem cannot reverse the confirmed write. */
|
|
41
|
+
function warningLines(warning, columns) {
|
|
42
|
+
return [" ! warning", ...renderOpaqueBlock(warning, " ", columns)];
|
|
43
|
+
}
|
|
44
|
+
function edge(label, ref) {
|
|
45
|
+
return ` ${label} ${ref.id} · ${dispositionText(ref.state)}`;
|
|
67
46
|
}
|
|
68
47
|
export function debtFrameHead(view, scope) {
|
|
69
48
|
return `${view.toUpperCase()} // ${scope}`;
|
|
70
49
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
function compactFacts(item) {
|
|
82
|
-
return [
|
|
83
|
-
`updated ${updatedAge(item.updatedAt)}`,
|
|
84
|
-
...(item.children === undefined ? [] : [`children ${item.children.live} live · ${item.children.total} total`]),
|
|
85
|
-
].join(" · ");
|
|
86
|
-
}
|
|
87
|
-
function listEntity(item, omitDisposition) {
|
|
88
|
-
return {
|
|
89
|
-
id: item.id,
|
|
90
|
-
priority: item.priority,
|
|
91
|
-
...(omitDisposition ? {} : { word: item.disposition }),
|
|
92
|
-
facts: compactFacts(item),
|
|
93
|
-
title: item.title,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function renderListRow(item, columns, omitDisposition) {
|
|
97
|
-
const lines = [...entityLines(listEntity(item, omitDisposition), columns)];
|
|
98
|
-
if ("blockers" in item) {
|
|
50
|
+
function renderListRow(item, columns, action) {
|
|
51
|
+
const disposition = "disposition" in item ? item.disposition : action === "blocked" ? "blocked" : "ready";
|
|
52
|
+
const lines = [
|
|
53
|
+
...entityLines({
|
|
54
|
+
...item,
|
|
55
|
+
mark: debtMark(disposition),
|
|
56
|
+
...(action === "ready" || action === "blocked" ? {} : { word: disposition }),
|
|
57
|
+
}, columns),
|
|
58
|
+
];
|
|
59
|
+
if ("blockers" in item)
|
|
99
60
|
for (const blocker of item.blockers)
|
|
100
|
-
lines.push(` needs ${blocker.id} · ${
|
|
101
|
-
}
|
|
61
|
+
lines.push(` needs ${blocker.id} · ${blocker.missing === true ? "missing" : "open"}`);
|
|
102
62
|
return lines;
|
|
103
63
|
}
|
|
104
64
|
export function renderDebtList(action, scope, result, context = DEFAULT_CONTEXT) {
|
|
65
|
+
const page = result;
|
|
105
66
|
const columns = context.columns;
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
67
|
+
if (page.kind === "absent")
|
|
68
|
+
return "debt world absent";
|
|
69
|
+
if (page.kind === "invalid-namespace-context")
|
|
70
|
+
return refusalLines(action, ["reason invalid namespace context", `path ${page.path}`], columns).join("\n");
|
|
71
|
+
if (page.kind === "refused")
|
|
72
|
+
return renderFailure(action, page, columns);
|
|
73
|
+
const rows = page.rows ?? [];
|
|
108
74
|
const view = action === "ls" ? "debts" : action;
|
|
109
|
-
|
|
75
|
+
if (rows.length === 0)
|
|
76
|
+
return emptyCatalogue(view);
|
|
110
77
|
const scopeText = scope === "world"
|
|
111
78
|
? "world"
|
|
112
79
|
: scope === "current"
|
|
113
80
|
? "current namespace"
|
|
114
81
|
: `namespace ${scope.namespace.replace(/^debt\//u, "").replace(/\/$/u, "") || "root"}`;
|
|
115
|
-
const heading = debtFrameHead(view, scopeText);
|
|
116
|
-
if (result.value.rows.length === 0)
|
|
117
|
-
return emptyCatalogue(view);
|
|
118
82
|
return [
|
|
119
|
-
|
|
120
|
-
...
|
|
121
|
-
...
|
|
83
|
+
debtFrameHead(view, scopeText),
|
|
84
|
+
...rows.flatMap((row) => renderListRow(row, columns, action)),
|
|
85
|
+
...(page.more === true ? ["…"] : []),
|
|
122
86
|
].join("\n");
|
|
123
87
|
}
|
|
124
88
|
function textTimestamp(timestamp) {
|
|
125
89
|
return timestamp.replace(/\.\d+(?=Z$)/u, "");
|
|
126
90
|
}
|
|
127
|
-
function renderShowDetail(
|
|
128
|
-
const debt = result.debt;
|
|
91
|
+
function renderShowDetail(id, debt, columns) {
|
|
129
92
|
const lines = [
|
|
130
|
-
...entityLines(
|
|
93
|
+
...entityLines({ id, priority: debt.priority, mark: debtMark(debt.state), word: debt.state, title: debt.title }, columns),
|
|
131
94
|
` created ${textTimestamp(debt.createdAt)}`,
|
|
132
95
|
` updated ${textTimestamp(debt.updatedAt)}`,
|
|
133
96
|
...(debt.createdBy === undefined ? [] : [` created by ${debt.createdBy}`]),
|
|
134
97
|
];
|
|
135
|
-
for (const need of
|
|
136
|
-
lines.push(edge("needs", need
|
|
137
|
-
|
|
138
|
-
lines.push(edge("
|
|
139
|
-
for (const item of
|
|
140
|
-
lines.push(edge("blocks", item));
|
|
141
|
-
if (result.parent !== null)
|
|
142
|
-
lines.push(edge("parent", result.parent));
|
|
143
|
-
for (const item of result.children)
|
|
144
|
-
lines.push(edge("child", item));
|
|
145
|
-
for (const item of result.supersedes)
|
|
98
|
+
for (const need of debt.needs ?? [])
|
|
99
|
+
lines.push(edge("needs", need));
|
|
100
|
+
if (debt.parent !== undefined)
|
|
101
|
+
lines.push(edge("parent", debt.parent));
|
|
102
|
+
for (const item of debt.supersedes ?? [])
|
|
146
103
|
lines.push(edge("supersedes", item));
|
|
147
|
-
for (const item of
|
|
148
|
-
lines.push(edge("
|
|
149
|
-
|
|
150
|
-
lines.push(edge("related", item));
|
|
151
|
-
if (debt.note.length > 0)
|
|
104
|
+
for (const item of debt.relates ?? [])
|
|
105
|
+
lines.push(edge("relates", item));
|
|
106
|
+
if (debt.note !== undefined)
|
|
152
107
|
receiptPayload(lines, "note", debt.note);
|
|
153
|
-
if (debt.body
|
|
108
|
+
if (debt.body !== undefined)
|
|
154
109
|
receiptPayload(lines, "body", debt.body);
|
|
155
110
|
return lines.join("\n");
|
|
156
111
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
112
|
+
/** Each item corresponds to the same invocation position, including missing targets. */
|
|
113
|
+
export function renderDebtShow(ids, result, context = DEFAULT_CONTEXT) {
|
|
114
|
+
if (result.kind === "absent")
|
|
115
|
+
return "debt world absent";
|
|
116
|
+
return result.items
|
|
117
|
+
.map((item, index) => item.kind === "found"
|
|
118
|
+
? renderShowDetail(ids[index], item, context.columns)
|
|
119
|
+
: refusalLines("show", ["reason debt missing", `debt ${ids[index]}`], context.columns).join("\n"))
|
|
120
|
+
.join("\n\n");
|
|
121
|
+
}
|
|
122
|
+
function treeLines(id, node, columns, depth = 0) {
|
|
166
123
|
const indent = " ".repeat(depth);
|
|
167
|
-
if (node.
|
|
168
|
-
return [`${indent}! ${node.
|
|
124
|
+
if ("kind" in node && node.kind === "cycle")
|
|
125
|
+
return [`${indent}! ${node.id} · cycle`];
|
|
169
126
|
return [
|
|
170
|
-
...entityLines(
|
|
171
|
-
...node.children.flatMap((child) => treeLines(child, columns, depth + 1)),
|
|
127
|
+
...entityLines({ id, priority: node.priority, mark: debtMark(node.state), word: node.state, title: node.title }, columns, indent),
|
|
128
|
+
...(node.children ?? []).flatMap((child) => treeLines(child.id, child, columns, depth + 1)),
|
|
172
129
|
];
|
|
173
130
|
}
|
|
174
131
|
function doctorIssue(issue) {
|
|
@@ -179,79 +136,57 @@ function doctorIssue(issue) {
|
|
|
179
136
|
return `! cycle ${issue.relation} ${issue.debts.join(" ")}`;
|
|
180
137
|
}
|
|
181
138
|
export function renderDoctor(report) {
|
|
182
|
-
if (report.
|
|
139
|
+
if (report.kind === "absent")
|
|
140
|
+
return "debt world absent";
|
|
141
|
+
if (report.issues === undefined)
|
|
183
142
|
return "✓ doctor healthy";
|
|
184
143
|
const noun = report.issues.length === 1 ? "issue" : "issues";
|
|
185
144
|
return [`! doctor ${report.issues.length} ${noun}`, ...report.issues.map(doctorIssue)].join("\n");
|
|
186
145
|
}
|
|
187
|
-
const PAST_VERBS = {
|
|
188
|
-
|
|
189
|
-
done: "done",
|
|
190
|
-
drop: "dropped",
|
|
191
|
-
update: "updated",
|
|
192
|
-
};
|
|
193
|
-
function renderAcceptedMutation(verb, debt, columns, changes = []) {
|
|
194
|
-
const lines = [];
|
|
195
|
-
receiptRow(lines, "✓", PAST_VERBS[verb] ?? verb, [{ text: debt.id, opaque: true }], columns);
|
|
196
|
-
lines.push(...entityLines(stateEntity(debt), columns));
|
|
197
|
-
for (const change of changes)
|
|
198
|
-
lines.push(` ${change.field} ${change.action}`);
|
|
199
|
-
return lines.join("\n");
|
|
200
|
-
}
|
|
201
|
-
function renderMutation(action, result, columns) {
|
|
202
|
-
if (result.kind !== "accepted")
|
|
203
|
-
return renderFailure(action, result, columns);
|
|
204
|
-
return renderAcceptedMutation(action, result.value, columns);
|
|
205
|
-
}
|
|
206
|
-
export function renderDebtUpdate(result, context = DEFAULT_CONTEXT) {
|
|
146
|
+
const PAST_VERBS = { add: "added", done: "done", drop: "dropped", update: "updated" };
|
|
147
|
+
export function renderDebtUpdate(id, result, context = DEFAULT_CONTEXT) {
|
|
207
148
|
const columns = context.columns;
|
|
208
149
|
if (result.kind !== "accepted")
|
|
209
|
-
return renderFailure("update", result, columns);
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const facts = projectRefusal(item.outcome.refusal);
|
|
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");
|
|
150
|
+
return renderFailure("update", result, columns, id);
|
|
151
|
+
const lines = [];
|
|
152
|
+
receiptRow(lines, "✓", PAST_VERBS.update, id === undefined ? [] : [{ text: id, opaque: true }], columns);
|
|
153
|
+
for (const field of result.changes ?? [])
|
|
154
|
+
lines.push(` ${field} changed`);
|
|
155
|
+
if (result.warning !== undefined)
|
|
156
|
+
lines.push(...warningLines(result.warning, columns));
|
|
157
|
+
return lines.join("\n");
|
|
220
158
|
}
|
|
221
|
-
function
|
|
222
|
-
|
|
159
|
+
function renderBatchItem(verb, id, item, columns) {
|
|
160
|
+
if (item.kind !== "accepted")
|
|
161
|
+
return renderFailure(verb, item, columns, id).split("\n");
|
|
162
|
+
return [
|
|
163
|
+
`✓ ${PAST_VERBS[verb] ?? verb} ${id}`,
|
|
164
|
+
...(item.warning === undefined ? [] : warningLines(item.warning, columns)),
|
|
165
|
+
];
|
|
223
166
|
}
|
|
224
|
-
export function renderDebtTree(result, context = DEFAULT_CONTEXT) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
167
|
+
export function renderDebtTree(id, result, context = DEFAULT_CONTEXT) {
|
|
168
|
+
if (result.kind === "absent")
|
|
169
|
+
return "debt world absent";
|
|
170
|
+
if (result.kind === "missing")
|
|
171
|
+
return refusalLines("tree", ["reason debt missing", `debt ${id}`], context.columns).join("\n");
|
|
172
|
+
return treeLines(id, result, context.columns).join("\n");
|
|
228
173
|
}
|
|
229
174
|
export function renderDebtContext(result, context = DEFAULT_CONTEXT) {
|
|
230
|
-
if (result.kind
|
|
231
|
-
return
|
|
232
|
-
const value =
|
|
233
|
-
return `context ${value} · ${result.
|
|
175
|
+
if (result.kind === "refused")
|
|
176
|
+
return refusalLines("context", ["reason invalid namespace context", `path ${result.path}`], context.columns).join("\n");
|
|
177
|
+
const value = "namespace" in result ? (result.namespace ?? "root") : "root";
|
|
178
|
+
return `context ${value} · ${result.source}`;
|
|
234
179
|
}
|
|
235
|
-
/**
|
|
180
|
+
/** Creation retains its minted identity in the native answer. */
|
|
236
181
|
export function renderDebtMutation(verb, result, context = DEFAULT_CONTEXT) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
182
|
+
if (result.kind !== "accepted")
|
|
183
|
+
return renderFailure(verb, result, context.columns);
|
|
184
|
+
const lines = [];
|
|
185
|
+
receiptRow(lines, "✓", PAST_VERBS[verb] ?? verb, [{ text: result.id, opaque: true }], context.columns);
|
|
186
|
+
if (result.warning !== undefined)
|
|
187
|
+
lines.push(...warningLines(result.warning, context.columns));
|
|
188
|
+
return lines.join("\n");
|
|
242
189
|
}
|
|
243
|
-
export function
|
|
244
|
-
|
|
245
|
-
return result.issues.length === 0 ? "accepted" : "failed";
|
|
246
|
-
if ("items" in result) {
|
|
247
|
-
const kinds = result.items.map((item) => item.outcome.kind);
|
|
248
|
-
return kinds.includes("retry") ? "retryable" : kinds.includes("refused") ? "refused" : "accepted";
|
|
249
|
-
}
|
|
250
|
-
if ("kind" in result) {
|
|
251
|
-
if (result.kind === "retry")
|
|
252
|
-
return "retryable";
|
|
253
|
-
if (result.kind === "refused")
|
|
254
|
-
return "refused";
|
|
255
|
-
}
|
|
256
|
-
return "accepted";
|
|
190
|
+
export function renderDebtLifecycle(verb, ids, result, context = DEFAULT_CONTEXT) {
|
|
191
|
+
return result.items.flatMap((item, index) => renderBatchItem(verb, ids[index], item, context.columns)).join("\n");
|
|
257
192
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { DeliveryPreviewOutcome } from "../../index.js";
|
|
2
2
|
import { type TextRenderContext } from "./terminal.js";
|
|
3
|
-
type
|
|
4
|
-
kind: "
|
|
3
|
+
type Preview = Extract<DeliveryPreviewOutcome, {
|
|
4
|
+
kind: "ready" | "blocked";
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
/** A preview is an observation, not a successful mutation or a prediction of placement. */
|
|
7
|
+
export declare function renderDeliveryPreview(report: Preview, context?: TextRenderContext): string;
|
|
7
8
|
export {};
|
|
@@ -1,129 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { executionCleanupLines, executionStopLines, standingGateLines, receiptPayload, receiptRow, titleLines, } from "./receipt.js";
|
|
1
|
+
import { unmetRequirementLines, receiptPayload, receiptRow, titleLines } from "./receipt.js";
|
|
3
2
|
import { renderRefusalFacts } from "./refusal.js";
|
|
4
3
|
import { abbreviateGitIds, displayGitId } from "./contract-observation.js";
|
|
5
|
-
import { DEFAULT_CLI_COLUMNS, gitShortStat,
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
return [`${CHILD}worktree ${safeText(workspace.path)}`];
|
|
9
|
-
}
|
|
10
|
-
function candidateLines(report, columns, addressed, abbreviations) {
|
|
11
|
-
const candidate = report.candidate;
|
|
12
|
-
const lines = [];
|
|
13
|
-
if (candidate.kind === "blocked") {
|
|
14
|
-
receiptRow(lines, "!", "candidate", [{ text: "blocked" }], columns);
|
|
15
|
-
lines.push(...renderRefusalFacts(candidate.refusal, CHILD, columns, addressed));
|
|
16
|
-
return lines;
|
|
17
|
-
}
|
|
18
|
-
const identity = candidate.identity;
|
|
19
|
-
receiptRow(lines, " ", "candidate", [{ text: "prepared" }, { text: displayGitId(identity.tenderSnapshot, abbreviations), opaque: true }], columns);
|
|
20
|
-
lines.push(`${CHILD}integration result ${displayGitId(identity.integration.snapshot, abbreviations)}`);
|
|
21
|
-
if (!/^0{40}$/u.test(identity.integration.changeId))
|
|
22
|
-
lines.push(`${CHILD}content identity ${displayGitId(identity.integration.changeId, abbreviations)}`);
|
|
23
|
-
lines.push(...workspaceEvidence(candidate.workspace));
|
|
24
|
-
lines.push(...standingGateLines(candidate.requirements.gates.filter((report) => report.gate !== "verified"), columns));
|
|
25
|
-
for (const prerequisite of candidate.requirements.unmetPrerequisites) {
|
|
26
|
-
receiptRow(lines, "!", "prerequisite", [{ text: prerequisite.contractId }, { text: prerequisite.state }], columns);
|
|
27
|
-
}
|
|
28
|
-
lines.push(...renderTextBlock(gitShortStat(candidate.scope), CHILD, columns));
|
|
29
|
-
if (candidate.scope.paths !== undefined) {
|
|
30
|
-
for (const path of candidate.scope.paths) {
|
|
31
|
-
lines.push(`${CHILD}${safeText(path)}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (candidate.diff !== undefined)
|
|
35
|
-
receiptPayload(lines, "diff", candidate.diff);
|
|
36
|
-
return lines;
|
|
37
|
-
}
|
|
38
|
-
function verificationLines(verification, columns) {
|
|
39
|
-
if (verification.kind === "requirements")
|
|
40
|
-
return standingGateLines([{ gate: "verified", requirements: verification.requirements }], columns);
|
|
41
|
-
const lines = [];
|
|
42
|
-
receiptRow(lines, " ", "verification", [{ text: verification.kind === "undeclared" ? "none declared" : "not run" }], columns);
|
|
43
|
-
return lines;
|
|
44
|
-
}
|
|
45
|
-
function admittedCandidateLines(report, columns) {
|
|
46
|
-
if (report.delivery === undefined)
|
|
47
|
-
return [];
|
|
48
|
-
const lines = [];
|
|
49
|
-
receiptRow(lines, " ", "admitted candidate", [
|
|
50
|
-
{ text: report.delivery.relation },
|
|
51
|
-
{
|
|
52
|
-
text: `· content identity ${displayGitId(report.delivery.changeId, abbreviateGitIds([report.delivery.changeId]))}`,
|
|
53
|
-
},
|
|
54
|
-
], columns);
|
|
55
|
-
return lines;
|
|
56
|
-
}
|
|
57
|
-
function targetLines(report, columns, addressed, abbreviations) {
|
|
4
|
+
import { DEFAULT_CLI_COLUMNS, gitShortStat, safeText } from "./terminal.js";
|
|
5
|
+
import { contractIssueLines } from "./contract.js";
|
|
6
|
+
function targetLines(report, columns, ids) {
|
|
58
7
|
const target = report.target;
|
|
59
8
|
const lines = [];
|
|
60
|
-
if (target
|
|
61
|
-
receiptRow(lines, " ", "target", [{ text: "none" }], columns);
|
|
9
|
+
if (target === undefined)
|
|
62
10
|
return lines;
|
|
63
|
-
}
|
|
64
11
|
if (target.kind === "placeable") {
|
|
12
|
+
const lag = target.behind === undefined ? "" : ` · behind ${target.behind === "unknown" ? "unknown" : String(target.behind)}`;
|
|
65
13
|
receiptRow(lines, " ", "target", [
|
|
66
14
|
{ text: "placeable" },
|
|
67
15
|
{
|
|
68
|
-
text: `${target.ref.replace(/^refs\/heads\//u, "")} @ ${displayGitId(target.head,
|
|
16
|
+
text: `${target.ref.replace(/^refs\/heads\//u, "")} @ ${displayGitId(target.head, ids)}${lag}`,
|
|
69
17
|
opaque: true,
|
|
70
18
|
},
|
|
71
19
|
], columns);
|
|
72
|
-
for (const checkout of target.checkouts) {
|
|
73
|
-
if (checkout.kind === "followable")
|
|
74
|
-
continue;
|
|
20
|
+
for (const checkout of target.checkouts ?? []) {
|
|
75
21
|
receiptRow(lines, "!", "checkout cannot follow", [{ text: checkout.path, opaque: true }], columns);
|
|
76
22
|
receiptPayload(lines, "reason", checkout.diagnostic);
|
|
77
23
|
}
|
|
78
|
-
return lines;
|
|
79
24
|
}
|
|
80
|
-
if (target.kind === "moved") {
|
|
25
|
+
else if (target.kind === "moved") {
|
|
81
26
|
receiptRow(lines, "!", "target", [
|
|
82
27
|
{ text: "moved" },
|
|
83
28
|
{ text: target.ref, opaque: true },
|
|
84
29
|
{
|
|
85
|
-
text: `${displayGitId(target.expected,
|
|
30
|
+
text: `${displayGitId(target.expected, ids)} -> ${target.observed === null ? "absent" : displayGitId(target.observed, ids)}`,
|
|
86
31
|
opaque: true,
|
|
87
32
|
},
|
|
88
33
|
], columns);
|
|
89
|
-
return lines;
|
|
90
34
|
}
|
|
91
|
-
if (target.kind === "failed") {
|
|
35
|
+
else if (target.kind === "failed") {
|
|
92
36
|
receiptRow(lines, "!", "target", [{ text: "failed" }], columns);
|
|
93
37
|
receiptPayload(lines, "reason", target.diagnostic);
|
|
94
|
-
return lines;
|
|
95
38
|
}
|
|
96
|
-
|
|
97
|
-
|
|
39
|
+
else {
|
|
40
|
+
receiptRow(lines, "!", "target", [{ text: "refused" }], columns);
|
|
41
|
+
lines.push(...renderRefusalFacts(target.reason, " ", columns, report.contractId));
|
|
42
|
+
}
|
|
43
|
+
return lines;
|
|
44
|
+
}
|
|
45
|
+
function previewGitIds(report) {
|
|
46
|
+
const ids = [report.candidate, report.integration, report.contentId];
|
|
47
|
+
if (report.previousContentId !== undefined)
|
|
48
|
+
ids.push(report.previousContentId);
|
|
49
|
+
if (report.target?.kind === "placeable")
|
|
50
|
+
ids.push(report.target.head);
|
|
51
|
+
if (report.target?.kind === "moved")
|
|
52
|
+
ids.push(report.target.expected, report.target.observed ?? "");
|
|
53
|
+
return abbreviateGitIds(ids);
|
|
54
|
+
}
|
|
55
|
+
function unmetLines(report, columns) {
|
|
56
|
+
const lines = [];
|
|
57
|
+
lines.push(...unmetRequirementLines(report.unmetGates ?? [], columns));
|
|
58
|
+
for (const prerequisite of report.unmetPrerequisites ?? [])
|
|
59
|
+
receiptRow(lines, "!", "prerequisite", [{ text: prerequisite.contractId, opaque: true }, { text: prerequisite.state }], columns);
|
|
98
60
|
return lines;
|
|
99
61
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
62
|
+
function scopeLines(report) {
|
|
63
|
+
const lines = [
|
|
64
|
+
` ${safeText(gitShortStat({
|
|
65
|
+
filesChanged: report.scope.filesChanged ?? 0,
|
|
66
|
+
insertions: report.scope.insertions ?? 0,
|
|
67
|
+
deletions: report.scope.deletions ?? 0,
|
|
68
|
+
}))}`,
|
|
104
69
|
];
|
|
70
|
+
for (const path of report.scope.paths ?? [])
|
|
71
|
+
lines.push(` ${safeText(path)}`);
|
|
72
|
+
return lines;
|
|
105
73
|
}
|
|
106
|
-
|
|
107
|
-
|
|
74
|
+
/** A preview is an observation, not a successful mutation or a prediction of placement. */
|
|
75
|
+
export function renderDeliveryPreview(report, context) {
|
|
108
76
|
const columns = context?.columns ?? DEFAULT_CLI_COLUMNS;
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (report.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
77
|
+
const lines = titleLines(report.kind === "ready" ? "✓" : "!", "deliver --dry-run", report.contractId, columns);
|
|
78
|
+
if (report.kind === "blocked") {
|
|
79
|
+
receiptRow(lines, "!", "candidate", [{ text: "blocked" }], columns);
|
|
80
|
+
lines.push(...renderRefusalFacts(report.reason, " ", columns, report.contractId), ...contractIssueLines(report, columns));
|
|
81
|
+
return lines.join("\n");
|
|
82
|
+
}
|
|
83
|
+
const ids = previewGitIds(report);
|
|
84
|
+
receiptRow(lines, " ", "candidate", [{ text: "prepared" }, { text: displayGitId(report.candidate, ids), opaque: true }], columns);
|
|
85
|
+
receiptRow(lines, " ", "integration result", [{ text: displayGitId(report.integration, ids), opaque: true }], columns);
|
|
86
|
+
if (!/^0{40}$/u.test(report.contentId))
|
|
87
|
+
receiptRow(lines, " ", "content identity", [{ text: displayGitId(report.contentId, ids), opaque: true }], columns);
|
|
88
|
+
lines.push(...unmetLines(report, columns), ...scopeLines(report));
|
|
89
|
+
if (report.diff?.kind === "present") {
|
|
90
|
+
if (report.diff.text.length === 0)
|
|
91
|
+
receiptRow(lines, " ", "diff", [{ text: "empty" }], columns);
|
|
92
|
+
else
|
|
93
|
+
receiptPayload(lines, "diff", report.diff.text);
|
|
94
|
+
}
|
|
95
|
+
else if (report.diff?.kind === "unavailable")
|
|
96
|
+
receiptRow(lines, "!", "diff", [{ text: "unavailable" }], columns);
|
|
97
|
+
if (report.previousContentId !== undefined)
|
|
98
|
+
receiptRow(lines, " ", "admitted candidate", [{ text: `previous content ${displayGitId(report.previousContentId, ids)}` }], columns);
|
|
99
|
+
lines.push(...targetLines(report, columns, ids), ...contractIssueLines(report, columns));
|
|
100
|
+
return lines.join("\n");
|
|
129
101
|
}
|