@astrosheep/keiyaku 4.5.29 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +0 -13
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +47 -78
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/references/automation.md +54 -41
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +10 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +27 -9
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +68 -71
- package/build/src/akuma/akuma-call.d.ts +53 -0
- package/build/src/akuma/akuma-call.js +113 -0
- package/build/src/akuma/akuma-instance.d.ts +20 -18
- package/build/src/akuma/akuma-instance.js +65 -175
- package/build/src/akuma/akuma-observe.d.ts +3 -21
- package/build/src/akuma/akuma-observe.js +7 -24
- package/build/src/akuma/{akuma-handle.d.ts → akuma-owner.d.ts} +55 -27
- package/build/src/akuma/{akuma-handle.js → akuma-owner.js} +24 -23
- package/build/src/akuma/akuma-selection-execution.d.ts +51 -0
- package/build/src/akuma/akuma-selection-execution.js +134 -0
- package/build/src/akuma/{fleet-execution.d.ts → akuma-wait.d.ts} +24 -44
- package/build/src/akuma/akuma-wait.js +113 -0
- package/build/src/akuma/akuma.d.ts +35 -89
- package/build/src/akuma/akuma.js +148 -30
- package/build/src/akuma/archetype.d.ts +12 -0
- package/build/src/akuma/archetype.js +47 -19
- package/build/src/akuma/body.d.ts +76 -36
- package/build/src/akuma/body.js +84 -49
- package/build/src/akuma/call-initial-tell.d.ts +131 -22
- package/build/src/akuma/call-initial-tell.js +31 -1
- package/build/src/akuma/call-request.d.ts +237 -31
- package/build/src/akuma/call-request.js +67 -94
- package/build/src/akuma/coordinate.d.ts +15 -5
- package/build/src/akuma/coordinate.js +12 -22
- package/build/src/akuma/dispatch-association.d.ts +1 -1
- package/build/src/akuma/dispatch-association.js +1 -10
- package/build/src/akuma/heart/activity-schema.d.ts +325 -0
- package/build/src/akuma/heart/activity-schema.js +53 -0
- package/build/src/akuma/heart/facts.d.ts +1 -6
- package/build/src/akuma/heart/index.d.ts +3 -1
- package/build/src/akuma/heart/index.js +4 -1
- package/build/src/akuma/heart/rows.d.ts +49 -2
- package/build/src/akuma/heart/rows.js +16 -2
- package/build/src/akuma/heart/soul.d.ts +1 -0
- package/build/src/akuma/heart/soul.js +6 -4
- package/build/src/akuma/heart/tells.d.ts +1 -0
- package/build/src/akuma/heart/tells.js +18 -0
- package/build/src/akuma/identity.d.ts +10 -7
- package/build/src/akuma/identity.js +23 -0
- package/build/src/akuma/index.d.ts +10 -8
- package/build/src/akuma/index.js +2 -2
- package/build/src/akuma/nuke.d.ts +3 -0
- package/build/src/akuma/nuke.js +13 -7
- package/build/src/akuma/projection.d.ts +0 -5
- package/build/src/akuma/projection.js +22 -43
- package/build/src/akuma/provider-recipe.d.ts +58 -13
- package/build/src/akuma/provider-recipe.js +62 -80
- package/build/src/akuma/provider.d.ts +6 -76
- package/build/src/akuma/provider.js +11 -219
- package/build/src/akuma/providers/acp/config.d.ts +2 -0
- package/build/src/akuma/providers/acp/config.js +26 -1
- package/build/src/akuma/providers/acp/core.d.ts +7 -0
- package/build/src/akuma/providers/acp/core.js +49 -18
- package/build/src/akuma/providers/acp/index.js +14 -6
- package/build/src/akuma/providers/grok-build/index.js +44 -13
- package/build/src/akuma/providers/index.d.ts +3 -3
- package/build/src/akuma/providers/index.js +2 -13
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +28 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +92 -0
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +0 -1
- package/build/src/akuma/providers/opencode-sdk/index.js +200 -64
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +41 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +69 -2
- package/build/src/akuma/providers/pi/events.js +5 -2
- package/build/src/akuma/providers/pi/index.d.ts +3 -4
- package/build/src/akuma/providers/pi/index.js +99 -45
- package/build/src/akuma/publication.d.ts +84 -3
- package/build/src/akuma/publication.js +145 -2
- package/build/src/akuma/read-pool.d.ts +2 -0
- package/build/src/akuma/read-pool.js +15 -0
- package/build/src/akuma/request-rendezvous.js +10 -0
- package/build/src/akuma/request-serve.js +7 -0
- package/build/src/akuma/request-wire.d.ts +14 -26
- package/build/src/akuma/request-wire.js +4 -0
- package/build/src/akuma/requests.d.ts +0 -2
- package/build/src/akuma/requests.js +0 -17
- package/build/src/akuma/{fleet-observation.d.ts → selection-observation.d.ts} +37 -36
- package/build/src/akuma/selection-observation.js +65 -0
- package/build/src/akuma/{fleet-owner-port.d.ts → selection-owner-port.d.ts} +3 -3
- package/build/src/akuma/{fleet-owner-port.js → selection-owner-port.js} +11 -17
- package/build/src/akuma/{fleet-request.d.ts → selection-request.d.ts} +42 -82
- package/build/src/akuma/{fleet-request.js → selection-request.js} +92 -136
- package/build/src/akuma/turn-drive.js +73 -14
- package/build/src/akuma-body.js +91 -56
- package/build/src/body/amend.d.ts +5 -0
- package/build/src/body/amend.js +26 -50
- package/build/src/body/arc.d.ts +4 -2
- package/build/src/body/arc.js +19 -26
- package/build/src/body/criteria.d.ts +6 -0
- package/build/src/body/criteria.js +37 -0
- package/build/src/body/decode.js +5 -42
- package/build/src/body/region.d.ts +5 -0
- package/build/src/body/region.js +45 -2
- package/build/src/body/render.js +2 -4
- package/build/src/cli/activity.d.ts +26 -0
- package/build/src/cli/activity.js +75 -0
- package/build/src/cli/actor.d.ts +3 -1
- package/build/src/cli/actor.js +15 -2
- package/build/src/cli/commands/akuma-grammar.d.ts +75 -0
- package/build/src/cli/commands/akuma-grammar.js +414 -0
- package/build/src/cli/commands/akuma.d.ts +5 -69
- package/build/src/cli/commands/akuma.js +352 -319
- package/build/src/cli/commands/amend.d.ts +4 -5
- package/build/src/cli/commands/amend.js +1 -2
- package/build/src/cli/commands/bind.d.ts +4 -5
- package/build/src/cli/commands/bind.js +7 -10
- package/build/src/cli/commands/contract-grammar.d.ts +112 -0
- package/build/src/cli/commands/contract-grammar.js +282 -0
- package/build/src/cli/commands/contract-help.d.ts +17 -22
- package/build/src/cli/commands/contract-help.js +37 -24
- package/build/src/cli/commands/contract.d.ts +18 -97
- package/build/src/cli/commands/contract.js +621 -233
- package/build/src/cli/commands/install.d.ts +1 -1
- package/build/src/cli/commands/install.js +2 -2
- package/build/src/cli/commands/task-grammar.d.ts +19 -0
- package/build/src/cli/commands/task-grammar.js +438 -0
- package/build/src/cli/commands/task-query.js +23 -104
- package/build/src/cli/commands/task.d.ts +5 -20
- package/build/src/cli/commands/task.js +414 -364
- package/build/src/cli/coordinates.d.ts +10 -0
- package/build/src/cli/coordinates.js +20 -0
- package/build/src/cli/draft.d.ts +7 -1
- package/build/src/cli/main.js +10 -1
- package/build/src/cli/parse.d.ts +8 -9
- package/build/src/cli/parse.js +62 -62
- package/build/src/cli/render/akuma-activity.d.ts +54 -36
- package/build/src/cli/render/akuma-activity.js +262 -242
- package/build/src/cli/render/akuma-tool.d.ts +8 -4
- package/build/src/cli/render/akuma-tool.js +6 -5
- package/build/src/cli/render/akuma.d.ts +36 -16
- package/build/src/cli/render/akuma.js +65 -132
- package/build/src/cli/render/audit.d.ts +6 -2
- package/build/src/cli/render/audit.js +59 -28
- package/build/src/cli/render/catalog.d.ts +11 -2
- package/build/src/cli/render/catalog.js +75 -95
- package/build/src/cli/render/contract-history.d.ts +3 -1
- package/build/src/cli/render/contract-history.js +215 -22
- package/build/src/cli/render/contract-observation.d.ts +10 -5
- package/build/src/cli/render/contract-observation.js +29 -46
- package/build/src/cli/render/contract.d.ts +10 -3
- package/build/src/cli/render/contract.js +252 -103
- package/build/src/cli/render/effects.d.ts +26 -0
- package/build/src/cli/render/effects.js +41 -0
- package/build/src/cli/render/execution-progress.d.ts +18 -6
- package/build/src/cli/render/execution-progress.js +34 -31
- package/build/src/cli/render/kanshi-akuma.d.ts +1 -2
- package/build/src/cli/render/kanshi-akuma.js +5 -26
- package/build/src/cli/render/kanshi.js +107 -128
- package/build/src/cli/render/marks.d.ts +13 -0
- package/build/src/cli/render/marks.js +74 -0
- package/build/src/cli/render/nuke.js +18 -7
- package/build/src/cli/render/receipt.d.ts +10 -4
- package/build/src/cli/render/receipt.js +124 -44
- package/build/src/cli/render/reconcile.d.ts +5 -0
- package/build/src/cli/render/reconcile.js +152 -0
- package/build/src/cli/render/refusal.d.ts +21 -4
- package/build/src/cli/render/refusal.js +60 -33
- package/build/src/cli/render/region.js +3 -2
- package/build/src/cli/render/settings.js +2 -12
- package/build/src/cli/render/task.d.ts +37 -6
- package/build/src/cli/render/task.js +161 -157
- package/build/src/cli/render/terminal.d.ts +20 -1
- package/build/src/cli/render/terminal.js +92 -18
- package/build/src/cli/runtime.d.ts +32 -8
- package/build/src/cli/runtime.js +157 -165
- package/build/src/cli/selectors.d.ts +5 -2
- package/build/src/cli/selectors.js +11 -3
- package/build/src/cli/streams.d.ts +11 -0
- package/build/src/cli/streams.js +32 -0
- package/build/src/cli/usage.d.ts +2 -0
- package/build/src/cli/usage.js +12 -8
- package/build/src/contract-guidance.js +3 -7
- package/build/src/contract-worktree.d.ts +20 -28
- package/build/src/contract-worktree.js +18 -70
- package/build/src/coordination/durable-file.d.ts +2 -2
- package/build/src/coordination/durable-file.js +0 -27
- package/build/src/core/facts/codec.d.ts +1 -2
- package/build/src/core/facts/codec.js +6 -7
- package/build/src/core/facts/gate.d.ts +0 -1
- package/build/src/core/facts/gate.js +0 -82
- package/build/src/core/facts/types.d.ts +1 -2
- package/build/src/core/verbs/abandon.d.ts +2 -6
- package/build/src/core/verbs/abandon.js +0 -16
- package/build/src/core/verbs/amend.d.ts +0 -1
- package/build/src/core/verbs/amend.js +0 -20
- package/build/src/core/verbs/arc.d.ts +7 -8
- package/build/src/core/verbs/arc.js +2 -19
- package/build/src/core/verbs/attestation.d.ts +2 -6
- package/build/src/core/verbs/attestation.js +0 -16
- package/build/src/core/verbs/bind.d.ts +0 -1
- package/build/src/core/verbs/bind.js +0 -16
- package/build/src/core/verbs/deliver.d.ts +0 -1
- package/build/src/core/verbs/deliver.js +0 -16
- package/build/src/core/verbs/placement.d.ts +2 -1
- package/build/src/core/verbs/placement.js +10 -59
- package/build/src/git/admission.d.ts +6 -4
- package/build/src/git/admission.js +4 -0
- package/build/src/git/hooks.d.ts +55 -30
- package/build/src/git/hooks.js +30 -3
- package/build/src/git/identity.d.ts +6 -0
- package/build/src/git/identity.js +47 -0
- package/build/src/git/integration.d.ts +31 -13
- package/build/src/git/integration.js +32 -1
- package/build/src/git/nuke.d.ts +10 -1
- package/build/src/git/nuke.js +31 -11
- package/build/src/git/observe.js +2 -15
- package/build/src/git/private-state-seat.d.ts +6 -7
- package/build/src/git/private-state-seat.js +8 -6
- package/build/src/git/read-observation.d.ts +6 -1
- package/build/src/git/read-observation.js +81 -46
- package/build/src/git/reconcile.d.ts +117 -40
- package/build/src/git/reconcile.js +169 -40
- package/build/src/git/scratch.d.ts +7 -4
- package/build/src/git/scratch.js +28 -6
- package/build/src/git/target-placement.d.ts +53 -38
- package/build/src/git/target-placement.js +69 -54
- package/build/src/git/tender.d.ts +37 -28
- package/build/src/git/tender.js +39 -0
- package/build/src/git/terminal-reconcile.js +21 -23
- package/build/src/git/terminal-seal.d.ts +8 -6
- package/build/src/git/terminal-seal.js +10 -0
- package/build/src/git/workspace.d.ts +29 -15
- package/build/src/git/workspace.js +28 -2
- package/build/src/identity/normalize.js +19 -6
- package/build/src/index.d.ts +78 -7
- package/build/src/index.js +52 -4
- package/build/src/kanshi/read.d.ts +3 -3
- package/build/src/kanshi/read.js +21 -21
- package/build/src/kanshi/report.d.ts +9 -8
- package/build/src/kanshi/roster.d.ts +2 -0
- package/build/src/kanshi/roster.js +2 -0
- package/build/src/kanshi/select.js +7 -3
- package/build/src/library/address.d.ts +3 -7
- package/build/src/library/address.js +7 -7
- package/build/src/library/akuma-creation.d.ts +21 -32
- package/build/src/library/akuma-creation.js +148 -165
- package/build/src/library/akumas.d.ts +20 -22
- package/build/src/library/akumas.js +43 -20
- package/build/src/library/bind.d.ts +107 -13
- package/build/src/library/bind.js +29 -23
- package/build/src/library/continuation.d.ts +556 -28
- package/build/src/library/continuation.js +29 -54
- package/build/src/library/contract-composition.d.ts +40 -0
- package/build/src/library/contract-composition.js +105 -0
- package/build/src/library/contract-creation.d.ts +7 -0
- package/build/src/library/contract-creation.js +192 -0
- package/build/src/library/contract-execution.d.ts +29 -40
- package/build/src/library/contract-execution.js +503 -128
- package/build/src/library/contract-operations.d.ts +275 -134
- package/build/src/library/contract-operations.js +83 -92
- package/build/src/library/contract-outcomes.d.ts +71 -0
- package/build/src/library/contract-outcomes.js +32 -0
- package/build/src/library/contract-settings.d.ts +25 -0
- package/build/src/library/contract-settings.js +135 -0
- package/build/src/library/contract-types.d.ts +17 -38
- package/build/src/library/delivery.d.ts +530 -10
- package/build/src/library/delivery.js +20 -45
- package/build/src/library/input.d.ts +3 -1
- package/build/src/library/input.js +11 -16
- package/build/src/library/invocation.d.ts +87 -0
- package/build/src/library/invocation.js +290 -0
- package/build/src/library/keiyaku.d.ts +45 -22
- package/build/src/library/keiyaku.js +134 -8
- package/build/src/library/nuke.d.ts +2 -11
- package/build/src/library/nuke.js +70 -57
- package/build/src/library/outcome.d.ts +13196 -0
- package/build/src/library/outcome.js +487 -0
- package/build/src/library/reconcile.d.ts +96 -24
- package/build/src/library/reconcile.js +102 -42
- package/build/src/library/refusal.d.ts +470 -42
- package/build/src/library/refusal.js +55 -143
- package/build/src/library/region.d.ts +15 -7
- package/build/src/library/region.js +23 -3
- package/build/src/library/repo.d.ts +2 -12
- package/build/src/library/repo.js +1 -22
- package/build/src/library/selection.d.ts +121 -0
- package/build/src/library/{fleet.js → selection.js} +169 -152
- package/build/src/plugin/public.d.ts +2 -0
- package/build/src/protocol/abandon.d.ts +2 -2
- package/build/src/protocol/abandon.js +1 -0
- package/build/src/protocol/amend.js +1 -0
- package/build/src/protocol/arc.d.ts +6 -4
- package/build/src/protocol/attempt.d.ts +4 -2
- package/build/src/protocol/attempt.js +10 -0
- package/build/src/protocol/audit.d.ts +255 -52
- package/build/src/protocol/audit.js +63 -5
- package/build/src/protocol/bind.d.ts +18 -17
- package/build/src/protocol/bind.js +9 -28
- package/build/src/protocol/completion.d.ts +256 -22
- package/build/src/protocol/completion.js +100 -12
- package/build/src/protocol/deliver.d.ts +34 -23
- package/build/src/protocol/deliver.js +39 -25
- package/build/src/protocol/execution-observation.d.ts +36 -37
- package/build/src/protocol/execution-observation.js +7 -9
- package/build/src/protocol/intent.d.ts +101 -30
- package/build/src/protocol/intent.js +74 -1
- package/build/src/protocol/operations.d.ts +570 -64
- package/build/src/protocol/operations.js +189 -9
- package/build/src/protocol/outcome.d.ts +2 -1
- package/build/src/protocol/placement.d.ts +2 -2
- package/build/src/protocol/placement.js +3 -1
- package/build/src/protocol/progress.d.ts +108 -65
- package/build/src/protocol/progress.js +82 -132
- package/build/src/protocol/read/status.d.ts +4 -3
- package/build/src/protocol/read/status.js +6 -5
- package/build/src/protocol/reconcile.d.ts +3 -3
- package/build/src/protocol/reconcile.js +4 -0
- package/build/src/protocol/reintegrate.d.ts +2 -2
- package/build/src/protocol/review.d.ts +30 -12
- package/build/src/protocol/review.js +15 -24
- package/build/src/protocol/run.d.ts +34 -5
- package/build/src/protocol/run.js +24 -12
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settings.d.ts +0 -10
- package/build/src/settings.js +0 -76
- package/build/src/settlement/holder.d.ts +1 -1
- package/build/src/settlement/settle.d.ts +25 -16
- package/build/src/settlement/settle.js +80 -20
- package/build/src/task/board.d.ts +3 -1
- package/build/src/task/board.js +13 -17
- package/build/src/task/catalog.d.ts +0 -4
- package/build/src/task/catalog.js +0 -15
- package/build/src/task/compose-language.d.ts +19 -9
- package/build/src/task/compose-language.js +30 -20
- package/build/src/task/compose.d.ts +7 -37
- package/build/src/task/compose.js +20 -2
- package/build/src/task/created-observation.d.ts +0 -1
- package/build/src/task/created-observation.js +1 -4
- package/build/src/task/document.d.ts +12 -2
- package/build/src/task/document.js +4 -0
- package/build/src/task/identity.d.ts +4 -1
- package/build/src/task/identity.js +21 -17
- package/build/src/task/index.d.ts +36 -16
- package/build/src/task/index.js +103 -96
- package/build/src/task/lifecycle-operations.d.ts +1 -1
- package/build/src/task/mutation-result.d.ts +647 -586
- package/build/src/task/mutation-result.js +79 -46
- package/build/src/task/mutation.d.ts +298 -270
- package/build/src/task/mutation.js +93 -110
- package/build/src/task/operation-types.d.ts +6 -49
- package/build/src/task/operations.d.ts +2 -1
- package/build/src/task/operations.js +35 -12
- package/build/src/task/query.d.ts +9 -3
- package/build/src/task/query.js +42 -16
- package/build/src/task/store.d.ts +2 -1
- package/build/src/task/store.js +10 -14
- package/build/src/verification/declaration.d.ts +0 -1
- package/build/src/verification/declaration.js +1 -18
- package/build/src/verification/execution.d.ts +6 -2
- package/build/src/verification/observation.d.ts +1 -1
- package/package.json +2 -18
- package/build/src/akuma/akuma-product.d.ts +0 -58
- package/build/src/akuma/akuma-product.js +0 -276
- package/build/src/akuma/fleet-execution.js +0 -234
- package/build/src/akuma/fleet-observation.js +0 -97
- package/build/src/cli/accepted.d.ts +0 -24
- package/build/src/cli/accepted.js +0 -167
- package/build/src/cli/catalog.d.ts +0 -45
- package/build/src/cli/catalog.js +0 -1
- package/build/src/cli/commands/akuma-invoke.d.ts +0 -114
- package/build/src/cli/commands/akuma-invoke.js +0 -375
- package/build/src/cli/commands/contract-invoke.d.ts +0 -34
- package/build/src/cli/commands/contract-invoke.js +0 -259
- package/build/src/cli/commands/nuke.d.ts +0 -10
- package/build/src/cli/commands/nuke.js +0 -20
- package/build/src/cli/commands/status-set.d.ts +0 -4
- package/build/src/cli/commands/status-set.js +0 -52
- package/build/src/cli/commands/task-invoke.d.ts +0 -49
- package/build/src/cli/commands/task-invoke.js +0 -306
- package/build/src/cli/invoke.d.ts +0 -27
- package/build/src/cli/invoke.js +0 -521
- package/build/src/cli/render/board.d.ts +0 -3
- package/build/src/cli/render/board.js +0 -25
- package/build/src/cli/render/status-set.d.ts +0 -5
- package/build/src/cli/render/status-set.js +0 -19
- package/build/src/cli/render/text.d.ts +0 -3
- package/build/src/cli/render/text.js +0 -33
- package/build/src/cli/result.d.ts +0 -240
- package/build/src/cli/result.js +0 -1
- package/build/src/git/result-codec.d.ts +0 -29
- package/build/src/git/result-codec.js +0 -309
- package/build/src/kanshi/fleet.d.ts +0 -6
- package/build/src/kanshi/fleet.js +0 -27
- package/build/src/library/audit.d.ts +0 -29
- package/build/src/library/audit.js +0 -41
- package/build/src/library/composition.d.ts +0 -15
- package/build/src/library/composition.js +0 -28
- package/build/src/library/configuration.d.ts +0 -4
- package/build/src/library/configuration.js +0 -2
- package/build/src/library/contract-bind.d.ts +0 -31
- package/build/src/library/contract-bind.js +0 -140
- package/build/src/library/contract-forwarding.d.ts +0 -55
- package/build/src/library/contract-forwarding.js +0 -67
- package/build/src/library/contract-handle.d.ts +0 -50
- package/build/src/library/contract-handle.js +0 -385
- package/build/src/library/contract.d.ts +0 -46
- package/build/src/library/contract.js +0 -73
- package/build/src/library/execution-result.d.ts +0 -243
- package/build/src/library/execution-result.js +0 -101
- package/build/src/library/execution.d.ts +0 -8
- package/build/src/library/execution.js +0 -102
- package/build/src/library/fleet.d.ts +0 -83
- package/build/src/library/mutation.d.ts +0 -501
- package/build/src/library/mutation.js +0 -248
- package/build/src/library/result-codec.d.ts +0 -2
- package/build/src/library/result-codec.js +0 -12
- package/build/src/protocol/result-codec.d.ts +0 -23
- package/build/src/protocol/result-codec.js +0 -488
- package/build/src/settlement/result-codec.d.ts +0 -2
- package/build/src/settlement/result-codec.js +0 -56
- package/build/src/task/public.d.ts +0 -2
- package/build/src/task/public.js +0 -1
|
@@ -17,7 +17,7 @@ export type InstallInvocationResult = Readonly<{
|
|
|
17
17
|
}>;
|
|
18
18
|
export type InstallRunner = (input: ProcessInput) => Promise<ProcessOutcome>;
|
|
19
19
|
export declare const INSTALL_USAGE = "install <codex|claude|opencode|pi>\ninstall --all";
|
|
20
|
-
export declare const INSTALL_ROOT_PURPOSE = "Install the Keiyaku plugin into a supported coding harness";
|
|
20
|
+
export declare const INSTALL_ROOT_PURPOSE = "Install the Keiyaku plugin into a supported coding harness.";
|
|
21
21
|
export declare function parseInstallCommand(argv: readonly string[]): ParsedInstallCommand;
|
|
22
22
|
export declare function renderInstallHelp(): string;
|
|
23
23
|
export declare function installAssetsRoot(): string;
|
|
@@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url";
|
|
|
3
3
|
import { CliUsageError, commandGuide, usageLine } from "../usage.js";
|
|
4
4
|
export const HARNESS_NAMES = ["codex", "claude", "opencode", "pi"];
|
|
5
5
|
export const INSTALL_USAGE = "install <codex|claude|opencode|pi>\ninstall --all";
|
|
6
|
-
export const INSTALL_ROOT_PURPOSE = "Install the Keiyaku plugin into a supported coding harness";
|
|
6
|
+
export const INSTALL_ROOT_PURPOSE = "Install the Keiyaku plugin into a supported coding harness.";
|
|
7
7
|
function isHarness(value) {
|
|
8
8
|
return value !== undefined && HARNESS_NAMES.includes(value);
|
|
9
9
|
}
|
|
@@ -44,7 +44,7 @@ export function parseInstallCommand(argv) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
export function renderInstallHelp() {
|
|
47
|
-
return
|
|
47
|
+
return `${INSTALL_ROOT_PURPOSE}\n\n${usageLine(INSTALL_USAGE)}\n\n--all continues past failures; any failure exits 1.`;
|
|
48
48
|
}
|
|
49
49
|
const INSTALL_TIMEOUT_MS = 5 * 60 * 1000;
|
|
50
50
|
const ASSET_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../../../integrations/marketplace");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CliUsageGuide } from "../usage.js";
|
|
2
|
+
import { type TaskQueryExpression } from "./task-query.js";
|
|
3
|
+
export type TaskAction = "add" | "show" | "ls" | "ready" | "blocked" | "tree" | "doctor" | "update" | "query" | "start" | "stop" | "hold" | "resume" | "done" | "drop" | "context" | "compose";
|
|
4
|
+
type TaskFlagValue = string | true | readonly string[];
|
|
5
|
+
type TaskStdin = "document" | "body" | "append" | "note" | "compose";
|
|
6
|
+
export type ParsedTaskCommand = Readonly<{
|
|
7
|
+
command: "task";
|
|
8
|
+
action: TaskAction;
|
|
9
|
+
output: "text" | "json";
|
|
10
|
+
positionals: readonly string[];
|
|
11
|
+
flags: Readonly<Record<string, TaskFlagValue>>;
|
|
12
|
+
stdin?: TaskStdin;
|
|
13
|
+
where?: TaskQueryExpression;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function isTaskAction(value: string | undefined): value is TaskAction;
|
|
16
|
+
export declare function renderTaskHelp(action?: TaskAction): string;
|
|
17
|
+
export declare function taskUsageGuide(action: TaskAction): CliUsageGuide;
|
|
18
|
+
export declare function parseTaskCommand(argv: readonly string[]): ParsedTaskCommand;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { CliUsageError, isBlankInput, TASK_FAMILY_USAGE_GUIDE, unknownCommandGuide, } from "../usage.js";
|
|
2
|
+
import { parseTaskNamespaceSelector } from "../../task/catalog.js";
|
|
3
|
+
import { parseTaskId } from "../../task/identity.js";
|
|
4
|
+
import { parseTaskQueryExpression, validateTaskLimit, validateTaskParent, } from "./task-query.js";
|
|
5
|
+
const COMMON = { json: "boolean" };
|
|
6
|
+
const TASK_COMMAND_SPECS = {
|
|
7
|
+
add: {
|
|
8
|
+
arity: [0, 1],
|
|
9
|
+
stdin: "document",
|
|
10
|
+
flags: {
|
|
11
|
+
...COMMON,
|
|
12
|
+
namespace: "value",
|
|
13
|
+
state: "value",
|
|
14
|
+
priority: "value",
|
|
15
|
+
needs: "repeat",
|
|
16
|
+
parent: "value",
|
|
17
|
+
supersedes: "repeat",
|
|
18
|
+
relates: "repeat",
|
|
19
|
+
body: "value",
|
|
20
|
+
note: "value",
|
|
21
|
+
actor: "value",
|
|
22
|
+
},
|
|
23
|
+
usage: `task add <TITLE> [--namespace <ns>] [--priority 0..3]
|
|
24
|
+
[--state open|in_progress|on_hold|done|drop]
|
|
25
|
+
[--note <text>] [--actor <actor>]
|
|
26
|
+
[--needs <TaskId>]... [--parent <TaskId>]
|
|
27
|
+
[--supersedes <TaskId>]... [--relates <TaskId>]...
|
|
28
|
+
[--body <text>]
|
|
29
|
+
task add [--namespace <ns>] [--actor <actor>] -`,
|
|
30
|
+
purpose: "Create a Task from flags or a Task document on stdin.",
|
|
31
|
+
details: "The stdin document is YAML front matter (title, state, priority, needs, parent, supersedes, relates, note) followed by a Markdown body.",
|
|
32
|
+
},
|
|
33
|
+
show: {
|
|
34
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
35
|
+
flags: COMMON,
|
|
36
|
+
usage: "task show <TaskId>...",
|
|
37
|
+
purpose: "Read one or more Tasks and their relationships.",
|
|
38
|
+
},
|
|
39
|
+
ls: {
|
|
40
|
+
arity: [0, 1],
|
|
41
|
+
flags: { ...COMMON, closed: "boolean", all: "boolean", world: "boolean", limit: "value" },
|
|
42
|
+
usage: "task ls [<namespace-selector>] [--closed | --all] [--world] [--limit <n>]",
|
|
43
|
+
purpose: "List Tasks in the selected namespace.",
|
|
44
|
+
details: [
|
|
45
|
+
"With no selector, lists the current directory Task context.",
|
|
46
|
+
"task/ selects the root namespace; --world lists every namespace in the current Task world.",
|
|
47
|
+
].join("\n"),
|
|
48
|
+
},
|
|
49
|
+
ready: {
|
|
50
|
+
arity: [0, 0],
|
|
51
|
+
flags: { ...COMMON, world: "boolean", parent: "value", limit: "value" },
|
|
52
|
+
usage: "task ready [--world] [--parent <TaskId>] [--limit <n>]",
|
|
53
|
+
purpose: "List open Tasks whose every dependency is complete or dropped.",
|
|
54
|
+
details: "--world lists every namespace in the current Task world.",
|
|
55
|
+
},
|
|
56
|
+
blocked: {
|
|
57
|
+
arity: [0, 0],
|
|
58
|
+
flags: { ...COMMON, world: "boolean", parent: "value", limit: "value" },
|
|
59
|
+
usage: "task blocked [--world] [--parent <TaskId>] [--limit <n>]",
|
|
60
|
+
purpose: "List Tasks with unmet dependencies.",
|
|
61
|
+
details: "--world lists every namespace in the current Task world.",
|
|
62
|
+
},
|
|
63
|
+
query: {
|
|
64
|
+
arity: [0, 0],
|
|
65
|
+
flags: {
|
|
66
|
+
...COMMON,
|
|
67
|
+
where: "value",
|
|
68
|
+
world: "boolean",
|
|
69
|
+
closed: "boolean",
|
|
70
|
+
all: "boolean",
|
|
71
|
+
sort: "value",
|
|
72
|
+
limit: "value",
|
|
73
|
+
},
|
|
74
|
+
usage: `task query [--where <expression>] [--closed | --all] [--world]
|
|
75
|
+
[--sort priority|created|updated|id] [--limit <n>]`,
|
|
76
|
+
purpose: "Filter and sort Tasks with a boolean expression.",
|
|
77
|
+
details: [
|
|
78
|
+
"fields: state priority title id parent under needs blocks ready blocked created updated",
|
|
79
|
+
"operators: = != < > <= >= ~ and or not ( )",
|
|
80
|
+
"sort: priority and created ascend; updated descends; id is lexical. Default: priority.",
|
|
81
|
+
"--world lists every namespace in the current Task world.",
|
|
82
|
+
"By default only active Tasks match; --closed selects terminal Tasks, --all includes both.",
|
|
83
|
+
"examples:",
|
|
84
|
+
" keiyaku task query --where 'priority <= 1 and ready' --world",
|
|
85
|
+
" keiyaku task query --where 'updated < 2026-08-06T00:00:00.000Z' --world",
|
|
86
|
+
].join("\n"),
|
|
87
|
+
},
|
|
88
|
+
tree: {
|
|
89
|
+
arity: [1, 1],
|
|
90
|
+
flags: COMMON,
|
|
91
|
+
usage: "task tree <TaskId>",
|
|
92
|
+
purpose: "Show a Task and its parent/child breakdown.",
|
|
93
|
+
},
|
|
94
|
+
doctor: {
|
|
95
|
+
arity: [0, 0],
|
|
96
|
+
flags: COMMON,
|
|
97
|
+
usage: "task doctor",
|
|
98
|
+
purpose: "Check Tasks for inconsistencies without changing them.",
|
|
99
|
+
},
|
|
100
|
+
update: {
|
|
101
|
+
arity: [1, 1],
|
|
102
|
+
flags: {
|
|
103
|
+
...COMMON,
|
|
104
|
+
title: "value",
|
|
105
|
+
body: "value",
|
|
106
|
+
append: "value",
|
|
107
|
+
note: "value",
|
|
108
|
+
priority: "value",
|
|
109
|
+
needs: "repeat",
|
|
110
|
+
"drop-needs": "repeat",
|
|
111
|
+
parent: "value",
|
|
112
|
+
"no-parent": "boolean",
|
|
113
|
+
supersedes: "repeat",
|
|
114
|
+
"drop-supersedes": "repeat",
|
|
115
|
+
relates: "repeat",
|
|
116
|
+
"drop-relates": "repeat",
|
|
117
|
+
},
|
|
118
|
+
usage: `task update <TaskId> [--title <text>] [--body <text>|- | --append <text>]
|
|
119
|
+
[--note <text>]
|
|
120
|
+
[--priority 0..3] [--needs <TaskId>]... [--drop-needs <TaskId>]...
|
|
121
|
+
[--parent <TaskId> | --no-parent]
|
|
122
|
+
[--supersedes <TaskId>]... [--drop-supersedes <TaskId>]...
|
|
123
|
+
[--relates <TaskId>]... [--drop-relates <TaskId>]...`,
|
|
124
|
+
purpose: "Change a Task's fields and relationships.",
|
|
125
|
+
details: [
|
|
126
|
+
"--body replaces the body; --append adds text after it, separated by a newline when needed.",
|
|
127
|
+
"--body - reads replacement body text from stdin.",
|
|
128
|
+
].join("\n"),
|
|
129
|
+
},
|
|
130
|
+
start: {
|
|
131
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
132
|
+
flags: COMMON,
|
|
133
|
+
usage: "task start <TaskId>...",
|
|
134
|
+
purpose: "Move one or more open Tasks into progress.",
|
|
135
|
+
},
|
|
136
|
+
stop: {
|
|
137
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
138
|
+
flags: COMMON,
|
|
139
|
+
usage: "task stop <TaskId>...",
|
|
140
|
+
purpose: "Return one or more in-progress Tasks to open.",
|
|
141
|
+
},
|
|
142
|
+
hold: {
|
|
143
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
144
|
+
flags: COMMON,
|
|
145
|
+
usage: "task hold <TaskId>...",
|
|
146
|
+
purpose: "Put one or more Tasks on hold.",
|
|
147
|
+
},
|
|
148
|
+
resume: {
|
|
149
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
150
|
+
flags: COMMON,
|
|
151
|
+
usage: "task resume <TaskId>...",
|
|
152
|
+
purpose: "Return one or more held Tasks to open.",
|
|
153
|
+
},
|
|
154
|
+
done: {
|
|
155
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
156
|
+
flags: { ...COMMON, note: "value" },
|
|
157
|
+
usage: "task done <TaskId>... [--note <text>]",
|
|
158
|
+
purpose: "Mark one or more Tasks done.",
|
|
159
|
+
},
|
|
160
|
+
drop: {
|
|
161
|
+
arity: [1, Number.POSITIVE_INFINITY],
|
|
162
|
+
flags: { ...COMMON, note: "value" },
|
|
163
|
+
usage: "task drop <TaskId>... [--note <text>]",
|
|
164
|
+
purpose: "Mark one or more Tasks as no longer needed.",
|
|
165
|
+
},
|
|
166
|
+
context: {
|
|
167
|
+
arity: [0, 1],
|
|
168
|
+
flags: COMMON,
|
|
169
|
+
usage: "task context [<namespace>]",
|
|
170
|
+
purpose: "Set or read the default Task namespace for this directory.",
|
|
171
|
+
details: "Omit <namespace> to read the current context; use / to reset it to the root namespace.",
|
|
172
|
+
},
|
|
173
|
+
compose: {
|
|
174
|
+
arity: [0, 0],
|
|
175
|
+
stdin: "compose",
|
|
176
|
+
flags: { ...COMMON, actor: "value", plan: "boolean" },
|
|
177
|
+
usage: "task compose [--actor <actor>] [--plan] -",
|
|
178
|
+
purpose: "Create or update several Tasks from one document, with an optional preview.",
|
|
179
|
+
details: [
|
|
180
|
+
"nodes: + <Title> creates; @task/<id> modifies a pre-existing Task",
|
|
181
|
+
"properties: as = <alias>; state = open|in_progress|on_hold|done|drop; pri = 0..3; parent = <ref>|empty",
|
|
182
|
+
"relations: needs|supersedes|relates with =, +=, or -=",
|
|
183
|
+
"references: @task/... is pre-existing; ^alias is new in this document",
|
|
184
|
+
"body: body = clears; body <<TOKEN reads exact content to TOKEN",
|
|
185
|
+
"TOKEN: [A-Z][A-Z0-9_]* with length 3..32",
|
|
186
|
+
"example:",
|
|
187
|
+
" ns=feature",
|
|
188
|
+
" + Parent",
|
|
189
|
+
" as = parent",
|
|
190
|
+
" pri = 1",
|
|
191
|
+
" body <<BODY",
|
|
192
|
+
" Exact body bytes.",
|
|
193
|
+
" BODY",
|
|
194
|
+
" + Child",
|
|
195
|
+
" parent = ^parent",
|
|
196
|
+
].join("\n"),
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
export function isTaskAction(value) {
|
|
200
|
+
return value !== undefined && Object.hasOwn(TASK_COMMAND_SPECS, value);
|
|
201
|
+
}
|
|
202
|
+
export function renderTaskHelp(action) {
|
|
203
|
+
if (action !== undefined) {
|
|
204
|
+
const spec = TASK_COMMAND_SPECS[action];
|
|
205
|
+
return `${spec.purpose}\n\n${renderTaskUsage(action)}${spec.details === undefined ? "" : `\n\n${spec.details}`}`;
|
|
206
|
+
}
|
|
207
|
+
return [
|
|
208
|
+
"usage keiyaku task <command> ...",
|
|
209
|
+
"",
|
|
210
|
+
"commands:",
|
|
211
|
+
...Object.values(TASK_COMMAND_SPECS).flatMap((spec) => spec.usage
|
|
212
|
+
.split("\n")
|
|
213
|
+
.map((line) => ` ${line}`)
|
|
214
|
+
.concat(` ${spec.purpose}`)),
|
|
215
|
+
].join("\n");
|
|
216
|
+
}
|
|
217
|
+
function renderTaskUsage(action) {
|
|
218
|
+
return TASK_COMMAND_SPECS[action].usage
|
|
219
|
+
.split("\n")
|
|
220
|
+
.map((line, index) => {
|
|
221
|
+
if (index === 0 || line.trimStart().startsWith("task ")) {
|
|
222
|
+
const command = line.trimStart().startsWith("task ") ? `keiyaku ${line.trim()}` : `keiyaku ${line}`;
|
|
223
|
+
return `${index === 0 ? "usage " : " "}${command}`;
|
|
224
|
+
}
|
|
225
|
+
return ` ${line.trim()}`;
|
|
226
|
+
})
|
|
227
|
+
.join("\n");
|
|
228
|
+
}
|
|
229
|
+
function taskUsage(action) {
|
|
230
|
+
const lines = TASK_COMMAND_SPECS[action].usage.split("\n");
|
|
231
|
+
return lines
|
|
232
|
+
.map((line, index) => {
|
|
233
|
+
if (index === 0 || line.trimStart().startsWith("task "))
|
|
234
|
+
return `keiyaku ${line.trim()}`;
|
|
235
|
+
return ` ${line.trim()}`;
|
|
236
|
+
})
|
|
237
|
+
.join("\n");
|
|
238
|
+
}
|
|
239
|
+
export function taskUsageGuide(action) {
|
|
240
|
+
return {
|
|
241
|
+
scope: `keiyaku task ${action}`,
|
|
242
|
+
accepts: taskUsage(action),
|
|
243
|
+
help: `keiyaku task ${action} --help`,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function setFlag(flags, name, kind, value, fail) {
|
|
247
|
+
if (flags[name] !== undefined && kind !== "repeat")
|
|
248
|
+
fail(`duplicate option: --${name}`);
|
|
249
|
+
if (kind === "boolean") {
|
|
250
|
+
flags[name] = true;
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (value === undefined)
|
|
254
|
+
fail(`--${name} requires a value`);
|
|
255
|
+
if (isBlankInput(value))
|
|
256
|
+
fail(`--${name} requires a nonblank value`);
|
|
257
|
+
if (kind === "repeat") {
|
|
258
|
+
const current = flags[name];
|
|
259
|
+
flags[name] = [...(Array.isArray(current) ? current : []), value];
|
|
260
|
+
}
|
|
261
|
+
else
|
|
262
|
+
flags[name] = value;
|
|
263
|
+
}
|
|
264
|
+
function scanTaskOption(input, fail) {
|
|
265
|
+
const token = input.argv[input.index], name = token.slice(2), kind = input.spec.flags[name];
|
|
266
|
+
if (kind === undefined)
|
|
267
|
+
fail(`option ${token} is not valid for task ${input.action}`);
|
|
268
|
+
const next = kind === "boolean" ? undefined : input.argv[input.index + 1];
|
|
269
|
+
if (next === "-" && input.action === "update" && name === "body") {
|
|
270
|
+
if (input.stdin !== undefined)
|
|
271
|
+
fail("stdin marker '-' may appear only once");
|
|
272
|
+
input.flags[name] = "";
|
|
273
|
+
return { index: input.index + 1, stdin: name };
|
|
274
|
+
}
|
|
275
|
+
if (kind !== "boolean" && (next === undefined || next.startsWith("--") || next === "-"))
|
|
276
|
+
fail(`--${name} requires a value`);
|
|
277
|
+
setFlag(input.flags, name, kind, next, fail);
|
|
278
|
+
return {
|
|
279
|
+
index: input.index + (kind === "boolean" ? 0 : 1),
|
|
280
|
+
...(input.stdin === undefined ? {} : { stdin: input.stdin }),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function scanTaskArgv(action, argv, fail) {
|
|
284
|
+
const spec = TASK_COMMAND_SPECS[action], positionals = [], flags = {};
|
|
285
|
+
let stdin;
|
|
286
|
+
let positionalOnly = false;
|
|
287
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
288
|
+
const token = argv[index];
|
|
289
|
+
if (!positionalOnly && token === "--") {
|
|
290
|
+
positionalOnly = true;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (!positionalOnly && token === "-") {
|
|
294
|
+
if (spec.stdin === undefined)
|
|
295
|
+
fail("stdin marker '-' is not valid here");
|
|
296
|
+
if (stdin !== undefined)
|
|
297
|
+
fail("stdin marker '-' may appear only once");
|
|
298
|
+
stdin = spec.stdin;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (positionalOnly || !token.startsWith("--")) {
|
|
302
|
+
if (isBlankInput(token))
|
|
303
|
+
fail(`task ${action} requires a nonblank value`);
|
|
304
|
+
positionals.push(token);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const scanned = scanTaskOption({ action, spec, argv, index, flags, ...(stdin === undefined ? {} : { stdin }) }, fail);
|
|
308
|
+
index = scanned.index;
|
|
309
|
+
stdin = scanned.stdin;
|
|
310
|
+
}
|
|
311
|
+
return { positionals, flags, ...(stdin === undefined ? {} : { stdin }) };
|
|
312
|
+
}
|
|
313
|
+
function validateUpdate(scanned, fail) {
|
|
314
|
+
const flags = scanned.flags;
|
|
315
|
+
if (flags.body !== undefined && flags.append !== undefined)
|
|
316
|
+
fail("--body and --append are mutually exclusive");
|
|
317
|
+
if (flags.parent !== undefined && flags["no-parent"] === true)
|
|
318
|
+
fail("--parent and --no-parent are mutually exclusive");
|
|
319
|
+
if (Object.keys(flags).every((name) => name === "json"))
|
|
320
|
+
fail("task update requires at least one patch option");
|
|
321
|
+
}
|
|
322
|
+
function validateTaskReadFlags(action, flags, fail) {
|
|
323
|
+
if ((action === "ls" || action === "query") && flags.closed === true && flags.all === true)
|
|
324
|
+
fail("--closed and --all are mutually exclusive");
|
|
325
|
+
if (action === "ls" && flags.world === true) {
|
|
326
|
+
// An explicit selector is checked below, after positional shape is known.
|
|
327
|
+
}
|
|
328
|
+
if (typeof flags.limit === "string") {
|
|
329
|
+
try {
|
|
330
|
+
validateTaskLimit(flags.limit);
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (typeof flags.sort === "string" &&
|
|
337
|
+
flags.sort !== "priority" &&
|
|
338
|
+
flags.sort !== "created" &&
|
|
339
|
+
flags.sort !== "updated" &&
|
|
340
|
+
flags.sort !== "id") {
|
|
341
|
+
fail("--sort must be priority, created, updated, or id");
|
|
342
|
+
}
|
|
343
|
+
if ((action === "ready" || action === "blocked") && typeof flags.parent === "string") {
|
|
344
|
+
try {
|
|
345
|
+
validateTaskParent(flags.parent);
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/** Actions whose positionals are all addressed TaskIds validated by the native owner. */
|
|
353
|
+
const TASK_ID_ACTIONS = new Set([
|
|
354
|
+
"show",
|
|
355
|
+
"tree",
|
|
356
|
+
"update",
|
|
357
|
+
"start",
|
|
358
|
+
"stop",
|
|
359
|
+
"hold",
|
|
360
|
+
"resume",
|
|
361
|
+
"done",
|
|
362
|
+
"drop",
|
|
363
|
+
]);
|
|
364
|
+
/** Validate every addressed TaskId positional through the native owner before any read or write. */
|
|
365
|
+
function validateTaskIdPositionals(positionals, fail) {
|
|
366
|
+
for (const taskId of positionals) {
|
|
367
|
+
try {
|
|
368
|
+
parseTaskId(taskId);
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/** Validate an explicit `task ls` namespace selector through the native owner. */
|
|
376
|
+
function validateListSelector(selector, fail) {
|
|
377
|
+
if (selector !== "task/" && (!selector.startsWith("task/") || !selector.endsWith("/")))
|
|
378
|
+
fail(`invalid Task namespace selector: ${selector}`);
|
|
379
|
+
if (selector === "task/")
|
|
380
|
+
return;
|
|
381
|
+
try {
|
|
382
|
+
parseTaskNamespaceSelector(selector);
|
|
383
|
+
}
|
|
384
|
+
catch (error) {
|
|
385
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function validateTaskScan(action, scanned, fail) {
|
|
389
|
+
const spec = TASK_COMMAND_SPECS[action], { positionals, flags, stdin } = scanned;
|
|
390
|
+
if (positionals.length < spec.arity[0] || positionals.length > spec.arity[1])
|
|
391
|
+
fail(`task ${action} has invalid positional arguments`);
|
|
392
|
+
if (action === "add" && (stdin === "document") === (positionals.length === 1))
|
|
393
|
+
fail("task add requires either TITLE or '-' input");
|
|
394
|
+
if (action === "add" &&
|
|
395
|
+
stdin === "document" &&
|
|
396
|
+
Object.keys(flags).some((name) => name !== "json" && name !== "namespace" && name !== "actor"))
|
|
397
|
+
fail("task add document input owns its creation fields");
|
|
398
|
+
if (action === "compose" && stdin !== "compose")
|
|
399
|
+
fail("task compose requires '-' input");
|
|
400
|
+
if (TASK_ID_ACTIONS.has(action))
|
|
401
|
+
validateTaskIdPositionals(positionals, fail);
|
|
402
|
+
if (action === "ls" && positionals.length === 1) {
|
|
403
|
+
validateListSelector(positionals[0], fail);
|
|
404
|
+
if (flags.world === true)
|
|
405
|
+
fail("--world cannot be combined with an explicit Task namespace selector");
|
|
406
|
+
}
|
|
407
|
+
validateTaskReadFlags(action, flags, fail);
|
|
408
|
+
if (action === "update")
|
|
409
|
+
validateUpdate(scanned, fail);
|
|
410
|
+
}
|
|
411
|
+
export function parseTaskCommand(argv) {
|
|
412
|
+
const candidate = argv[0];
|
|
413
|
+
if (!isTaskAction(candidate)) {
|
|
414
|
+
throw new CliUsageError(`unknown task command: ${candidate ?? ""}`, unknownCommandGuide(TASK_FAMILY_USAGE_GUIDE, candidate ?? ""));
|
|
415
|
+
}
|
|
416
|
+
const action = candidate;
|
|
417
|
+
const fail = (message) => {
|
|
418
|
+
throw new CliUsageError(message, taskUsageGuide(action));
|
|
419
|
+
};
|
|
420
|
+
const scanned = scanTaskArgv(action, argv, fail);
|
|
421
|
+
validateTaskScan(action, scanned, fail);
|
|
422
|
+
let where;
|
|
423
|
+
if (action === "query" && typeof scanned.flags.where === "string") {
|
|
424
|
+
try {
|
|
425
|
+
where = parseTaskQueryExpression(scanned.flags.where);
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return {
|
|
432
|
+
command: "task",
|
|
433
|
+
action,
|
|
434
|
+
output: scanned.flags.json === true ? "json" : "text",
|
|
435
|
+
...scanned,
|
|
436
|
+
...(where === undefined ? {} : { where }),
|
|
437
|
+
};
|
|
438
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizeTaskQueryPredicate, TaskQueryPredicateError, } from "../../task/query.js";
|
|
2
2
|
function syntax(message, offset) {
|
|
3
3
|
throw new Error(`${message} at column ${offset + 1}`);
|
|
4
4
|
}
|
|
@@ -80,80 +80,27 @@ function lex(source) {
|
|
|
80
80
|
tokens.push({ kind: "end", value: "", offset: source.length });
|
|
81
81
|
return tokens;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
return token.value;
|
|
87
|
-
}
|
|
88
|
-
function state(token) {
|
|
89
|
-
if (token.value !== "open" &&
|
|
90
|
-
token.value !== "in_progress" &&
|
|
91
|
-
token.value !== "on_hold" &&
|
|
92
|
-
token.value !== "done" &&
|
|
93
|
-
token.value !== "drop") {
|
|
94
|
-
return syntax(`invalid state ${JSON.stringify(token.value)}`, token.offset);
|
|
83
|
+
function parsedPredicate(field, operator, value) {
|
|
84
|
+
if (field.value === "title" && value.kind !== "string") {
|
|
85
|
+
syntax("title values must use double quotes", value.offset);
|
|
95
86
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return true;
|
|
107
|
-
if (token.value === "false")
|
|
108
|
-
return false;
|
|
109
|
-
return syntax("boolean predicate requires true or false", token.offset);
|
|
110
|
-
}
|
|
111
|
-
function timestamp(token, field) {
|
|
112
|
-
const milliseconds = Date.parse(token.value);
|
|
113
|
-
if (!Number.isFinite(milliseconds) || new Date(milliseconds).toISOString() !== token.value)
|
|
114
|
-
return syntax(`${field} requires a canonical UTC ISO timestamp`, token.offset);
|
|
115
|
-
return token.value;
|
|
116
|
-
}
|
|
117
|
-
function equalityOperator(token, field) {
|
|
118
|
-
if (token.value !== "=" && token.value !== "!=")
|
|
119
|
-
syntax(`${field} supports only = and !=`, token.offset);
|
|
120
|
-
return token.value;
|
|
121
|
-
}
|
|
122
|
-
function orderedOperator(token, field) {
|
|
123
|
-
if (token.value === "~")
|
|
124
|
-
syntax(`${field} operator is invalid`, token.offset);
|
|
125
|
-
return token.value;
|
|
126
|
-
}
|
|
127
|
-
function textOperator(token, field) {
|
|
128
|
-
if (token.value !== "=" && token.value !== "!=" && token.value !== "~") {
|
|
129
|
-
syntax(`${field} supports only =, !=, and ~`, token.offset);
|
|
87
|
+
// Acquire textual literals only; the Task owner judges fields, operators and values.
|
|
88
|
+
const literal = field.value === "priority"
|
|
89
|
+
? Number(value.value)
|
|
90
|
+
: field.value === "parent" && value.value === "none"
|
|
91
|
+
? null
|
|
92
|
+
: (field.value === "ready" || field.value === "blocked") && (value.value === "true" || value.value === "false")
|
|
93
|
+
? value.value === "true"
|
|
94
|
+
: value.value;
|
|
95
|
+
try {
|
|
96
|
+
return normalizeTaskQueryPredicate({ field: field.value, operator: operator.value, value: literal });
|
|
130
97
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
syntax("title values must use double quotes", value.offset);
|
|
137
|
-
if (field === "id" && selected !== "~")
|
|
138
|
-
canonicalTaskId(value, "id");
|
|
139
|
-
return { field, operator: selected, value: value.value };
|
|
140
|
-
}
|
|
141
|
-
function parseRelationPredicate(field, operator, value) {
|
|
142
|
-
const relationField = TASK_RELATION_PREDICATE_FIELDS.find((candidate) => candidate === field.value);
|
|
143
|
-
if (relationField === undefined) {
|
|
144
|
-
syntax(`unknown query field ${JSON.stringify(field.value)}`, field.offset);
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof TaskQueryPredicateError) {
|
|
100
|
+
return syntax(error.message, { field, operator, value }[error.part].offset);
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
145
103
|
}
|
|
146
|
-
return {
|
|
147
|
-
field: relationField,
|
|
148
|
-
operator: equalityOperator(operator, relationField),
|
|
149
|
-
value: canonicalTaskId(value, relationField),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function parseBooleanPredicate(field, operator, value) {
|
|
153
|
-
return { field, operator: equalityOperator(operator, field), value: boolean(value) };
|
|
154
|
-
}
|
|
155
|
-
function parseTimestampPredicate(field, operator, value) {
|
|
156
|
-
return { field, operator: orderedOperator(operator, field), value: timestamp(value, field) };
|
|
157
104
|
}
|
|
158
105
|
class Parser {
|
|
159
106
|
tokens;
|
|
@@ -217,7 +164,7 @@ class Parser {
|
|
|
217
164
|
if (field.kind !== "word")
|
|
218
165
|
syntax("expected query field", field.offset);
|
|
219
166
|
if ((field.value === "ready" || field.value === "blocked") && this.current().kind !== "operator") {
|
|
220
|
-
return {
|
|
167
|
+
return parsedPredicate(field, { kind: "operator", value: "=", offset: field.offset }, { kind: "word", value: "true", offset: field.offset });
|
|
221
168
|
}
|
|
222
169
|
const operator = this.take();
|
|
223
170
|
if (operator.kind !== "operator")
|
|
@@ -225,41 +172,13 @@ class Parser {
|
|
|
225
172
|
const value = this.take();
|
|
226
173
|
if (value.kind !== "word" && value.kind !== "string")
|
|
227
174
|
syntax(`expected value for ${field.value}`, value.offset);
|
|
228
|
-
return
|
|
229
|
-
}
|
|
230
|
-
typedPredicate(field, operator, value) {
|
|
231
|
-
switch (field.value) {
|
|
232
|
-
case "state":
|
|
233
|
-
return { field: "state", operator: equalityOperator(operator, "state"), value: state(value) };
|
|
234
|
-
case "priority":
|
|
235
|
-
return { field: "priority", operator: orderedOperator(operator, "priority"), value: priority(value) };
|
|
236
|
-
case "title":
|
|
237
|
-
return parseTextPredicate("title", operator, value);
|
|
238
|
-
case "id":
|
|
239
|
-
return parseTextPredicate("id", operator, value);
|
|
240
|
-
case "parent":
|
|
241
|
-
return {
|
|
242
|
-
field: "parent",
|
|
243
|
-
operator: equalityOperator(operator, "parent"),
|
|
244
|
-
value: value.value === "none" ? null : canonicalTaskId(value, "parent"),
|
|
245
|
-
};
|
|
246
|
-
case "ready":
|
|
247
|
-
return parseBooleanPredicate("ready", operator, value);
|
|
248
|
-
case "blocked":
|
|
249
|
-
return parseBooleanPredicate("blocked", operator, value);
|
|
250
|
-
case "created":
|
|
251
|
-
return parseTimestampPredicate("created", operator, value);
|
|
252
|
-
case "updated":
|
|
253
|
-
return parseTimestampPredicate("updated", operator, value);
|
|
254
|
-
default:
|
|
255
|
-
return parseRelationPredicate(field, operator, value);
|
|
256
|
-
}
|
|
175
|
+
return parsedPredicate(field, operator, value);
|
|
257
176
|
}
|
|
258
177
|
}
|
|
259
178
|
export function parseTaskQueryExpression(source) {
|
|
260
179
|
if (source.trim().length === 0)
|
|
261
180
|
return syntax("query expression must be nonblank", 0);
|
|
262
|
-
return
|
|
181
|
+
return new Parser(lex(source)).parse();
|
|
263
182
|
}
|
|
264
183
|
export function validateTaskLimit(source) {
|
|
265
184
|
if (!/^[1-9][0-9]*$/u.test(source) || !Number.isSafeInteger(Number(source)))
|
|
@@ -267,7 +186,7 @@ export function validateTaskLimit(source) {
|
|
|
267
186
|
}
|
|
268
187
|
export function validateTaskParent(source) {
|
|
269
188
|
try {
|
|
270
|
-
|
|
189
|
+
normalizeTaskQueryPredicate({ field: "under", operator: "=", value: source });
|
|
271
190
|
}
|
|
272
191
|
catch {
|
|
273
192
|
throw new Error("--parent requires a canonical TaskId");
|