@astrosheep/keiyaku 4.6.7 → 4.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -16
- package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/build/plugins/claude/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/build/plugins/codex/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/opencode/index.js +1 -1
- package/build/plugins/opencode/skills/keiyaku/SKILL.md +5 -6
- package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/plugins/pi/keiyaku.ts +0 -5
- package/build/skills/keiyaku/SKILL.md +5 -6
- package/build/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/skills/keiyaku-akuma/references/automation.md +8 -8
- package/build/skills/keiyaku-babysit/SKILL.md +1 -1
- package/build/skills/keiyaku-bind/SKILL.md +9 -9
- package/build/skills/keiyaku-debt/SKILL.md +91 -0
- package/build/skills/keiyaku-workflow/SKILL.md +2 -2
- package/build/src/akuma/akuma-call.d.ts +2 -0
- package/build/src/akuma/akuma-call.js +8 -2
- package/build/src/akuma/akuma-instance.d.ts +14 -1
- package/build/src/akuma/akuma-instance.js +37 -7
- package/build/src/akuma/akuma-observe.d.ts +33 -8
- package/build/src/akuma/akuma-observe.js +89 -63
- package/build/src/akuma/akuma-owner.d.ts +14 -2
- package/build/src/akuma/akuma-owner.js +49 -35
- package/build/src/akuma/akuma-selection-execution.js +9 -1
- package/build/src/akuma/akuma-stream.d.ts +22 -0
- package/build/src/akuma/akuma-stream.js +116 -0
- package/build/src/akuma/akuma-wait.d.ts +1 -40
- package/build/src/akuma/akuma-wait.js +23 -84
- package/build/src/akuma/akuma.d.ts +52 -16
- package/build/src/akuma/akuma.js +10 -10
- package/build/src/akuma/allowed.d.ts +7 -12
- package/build/src/akuma/allowed.js +13 -4
- package/build/src/akuma/archetype.d.ts +7 -15
- package/build/src/akuma/archetype.js +36 -35
- package/build/src/akuma/body-supervisor.d.ts +5 -5
- package/build/src/akuma/body-supervisor.js +22 -20
- package/build/src/akuma/body.d.ts +5 -3
- package/build/src/akuma/body.js +57 -8
- package/build/src/akuma/call-request.d.ts +30 -32
- package/build/src/akuma/call-request.js +10 -3
- package/build/src/akuma/caller.d.ts +39 -0
- package/build/src/akuma/caller.js +36 -0
- package/build/src/akuma/dispatch-association.d.ts +0 -1
- package/build/src/akuma/dispatch-association.js +0 -3
- package/build/src/akuma/heart/activity-schema.d.ts +12 -0
- package/build/src/akuma/heart/activity-schema.js +6 -0
- package/build/src/akuma/heart/facts.d.ts +16 -12
- package/build/src/akuma/heart/facts.js +8 -0
- package/build/src/akuma/heart/index.d.ts +61 -9
- package/build/src/akuma/heart/index.js +89 -24
- package/build/src/akuma/heart/rows.d.ts +3 -3
- package/build/src/akuma/heart/rows.js +5 -3
- package/build/src/akuma/heart/soul.d.ts +10 -1
- package/build/src/akuma/heart/soul.js +34 -24
- package/build/src/akuma/heart/storage.d.ts +20 -0
- package/build/src/akuma/heart/storage.js +62 -3
- package/build/src/akuma/heart/timeline.d.ts +7 -0
- package/build/src/akuma/heart/timeline.js +10 -0
- package/build/src/akuma/identity.d.ts +0 -1
- package/build/src/akuma/identity.js +2 -5
- package/build/src/akuma/index.d.ts +6 -2
- package/build/src/akuma/index.js +1 -0
- package/build/src/akuma/nuke.js +6 -28
- package/build/src/akuma/projection.d.ts +25 -11
- package/build/src/akuma/projection.js +24 -7
- package/build/src/akuma/provider-recipe.d.ts +18 -6
- package/build/src/akuma/provider-recipe.js +24 -1
- package/build/src/akuma/provider.d.ts +31 -10
- package/build/src/akuma/provider.js +105 -14
- package/build/src/akuma/providers/acp/events.js +29 -19
- package/build/src/akuma/providers/acp/index.js +2 -3
- package/build/src/akuma/providers/claude/events.js +110 -69
- package/build/src/akuma/providers/claude/index.d.ts +2 -2
- package/build/src/akuma/providers/claude/index.js +4 -8
- package/build/src/akuma/providers/codex-app-server/events.js +17 -2
- package/build/src/akuma/providers/codex-app-server/index.js +17 -11
- package/build/src/akuma/providers/decode.d.ts +33 -0
- package/build/src/akuma/providers/decode.js +65 -0
- package/build/src/akuma/providers/execution-environment.d.ts +2 -1
- package/build/src/akuma/providers/execution-environment.js +3 -0
- package/build/src/akuma/providers/grok-build/index.js +16 -48
- package/build/src/akuma/providers/index.js +2 -0
- package/build/src/akuma/providers/lifecycle.d.ts +9 -0
- package/build/src/akuma/providers/lifecycle.js +10 -0
- package/build/src/akuma/providers/opencode-sdk/event-stream.d.ts +3 -3
- package/build/src/akuma/providers/opencode-sdk/event-stream.js +2 -25
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +7 -43
- package/build/src/akuma/providers/opencode-sdk/events.js +146 -296
- package/build/src/akuma/providers/opencode-sdk/index.js +270 -431
- package/build/src/akuma/providers/opencode-sdk/native-http.d.ts +9 -0
- package/build/src/akuma/providers/opencode-sdk/native-http.js +69 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +42 -36
- package/build/src/akuma/providers/opencode-sdk/session.js +75 -84
- package/build/src/akuma/providers/paseo/events.d.ts +33 -0
- package/build/src/akuma/providers/paseo/events.js +204 -0
- package/build/src/akuma/providers/paseo/index.d.ts +9 -0
- package/build/src/akuma/providers/paseo/index.js +357 -0
- package/build/src/akuma/providers/pi/events.d.ts +2 -0
- package/build/src/akuma/providers/pi/events.js +36 -38
- package/build/src/akuma/providers/pi/index.js +21 -35
- package/build/src/akuma/publication.d.ts +2 -0
- package/build/src/akuma/publication.js +5 -0
- package/build/src/akuma/request-lifecycle.d.ts +4 -2
- package/build/src/akuma/request-lifecycle.js +27 -12
- package/build/src/akuma/request-rendezvous.js +38 -55
- package/build/src/akuma/request-serve.d.ts +1 -1
- package/build/src/akuma/request-serve.js +77 -113
- package/build/src/akuma/requests.d.ts +3 -1
- package/build/src/akuma/requests.js +32 -0
- package/build/src/akuma/selection-observation.d.ts +129 -53
- package/build/src/akuma/selection-observation.js +3 -9
- package/build/src/akuma/turn-drive.d.ts +3 -0
- package/build/src/akuma/turn-drive.js +28 -10
- package/build/src/akuma-body.js +12 -22
- package/build/src/cli/akuma-caller.d.ts +3 -0
- package/build/src/cli/akuma-caller.js +31 -0
- package/build/src/cli/commands/akuma-grammar.js +10 -16
- package/build/src/cli/commands/akuma.js +25 -55
- package/build/src/cli/commands/contract-grammar.d.ts +9 -7
- package/build/src/cli/commands/contract-grammar.js +40 -47
- package/build/src/cli/commands/contract-help.d.ts +17 -7
- package/build/src/cli/commands/contract-help.js +50 -11
- package/build/src/cli/commands/contract.js +34 -63
- package/build/src/cli/commands/debt-grammar.d.ts +19 -0
- package/build/src/cli/commands/debt-grammar.js +323 -0
- package/build/src/cli/commands/debt-query.d.ts +5 -0
- package/build/src/cli/commands/{task-query.js → debt-query.js} +9 -9
- package/build/src/cli/commands/{task.d.ts → debt.d.ts} +2 -2
- package/build/src/cli/commands/{task.js → debt.js} +87 -164
- package/build/src/cli/coordinates.d.ts +1 -1
- package/build/src/cli/coordinates.js +1 -1
- package/build/src/cli/parse.d.ts +5 -5
- package/build/src/cli/parse.js +17 -16
- package/build/src/cli/render/akuma-activity.d.ts +11 -83
- package/build/src/cli/render/akuma-activity.js +20 -382
- package/build/src/cli/render/catalog.d.ts +4 -7
- package/build/src/cli/render/catalog.js +5 -5
- package/build/src/cli/render/contract-history.js +3 -6
- package/build/src/cli/render/contract.js +17 -52
- package/build/src/cli/render/debt.d.ts +28 -0
- package/build/src/cli/render/{task.js → debt.js} +55 -133
- package/build/src/cli/render/kanshi.js +28 -28
- package/build/src/cli/render/marks.d.ts +5 -5
- package/build/src/cli/render/marks.js +4 -10
- package/build/src/cli/render/nuke.js +1 -1
- package/build/src/cli/render/receipt.js +3 -10
- package/build/src/cli/runtime.d.ts +1 -1
- package/build/src/cli/runtime.js +14 -20
- package/build/src/cli/scan.d.ts +1 -1
- package/build/src/cli/selectors.d.ts +3 -6
- package/build/src/cli/selectors.js +22 -53
- package/build/src/cli/usage.d.ts +1 -1
- package/build/src/cli/usage.js +4 -4
- package/build/src/contract-worktree.js +3 -3
- package/build/src/debt/board.d.ts +160 -0
- package/build/src/{task → debt}/board.js +89 -89
- package/build/src/debt/catalog.d.ts +11 -0
- package/build/src/debt/catalog.js +59 -0
- package/build/src/{task → debt}/context.d.ts +1 -1
- package/build/src/{task → debt}/context.js +1 -1
- package/build/src/{task → debt}/created-observation.d.ts +6 -10
- package/build/src/{task → debt}/created-observation.js +7 -7
- package/build/src/debt/document.d.ts +37 -0
- package/build/src/{task → debt}/document.js +37 -37
- package/build/src/debt/identity.d.ts +21 -0
- package/build/src/{task → debt}/identity.js +35 -35
- package/build/src/debt/index.d.ts +111 -0
- package/build/src/debt/index.js +203 -0
- package/build/src/{task → debt}/input.d.ts +8 -8
- package/build/src/{task → debt}/input.js +21 -21
- package/build/src/debt/lifecycle-operations.d.ts +6 -0
- package/build/src/{task → debt}/lifecycle-operations.js +27 -31
- package/build/src/debt/mutation-result.d.ts +981 -0
- package/build/src/debt/mutation-result.js +109 -0
- package/build/src/debt/mutation.d.ts +424 -0
- package/build/src/debt/mutation.js +223 -0
- package/build/src/debt/operation-types.d.ts +71 -0
- package/build/src/debt/operations.d.ts +28 -0
- package/build/src/{task → debt}/operations.js +59 -60
- package/build/src/debt/query.d.ts +76 -0
- package/build/src/{task → debt}/query.js +55 -55
- package/build/src/{task → debt}/store.d.ts +13 -13
- package/build/src/{task → debt}/store.js +58 -49
- package/build/src/debt/view.d.ts +4 -0
- package/build/src/debt/view.js +7 -0
- package/build/src/dispatch/index.d.ts +3 -3
- package/build/src/dispatch/index.js +1 -2
- package/build/src/git/observe.d.ts +6 -2
- package/build/src/git/observe.js +6 -2
- package/build/src/identity/coordinates.d.ts +1 -1
- package/build/src/index.d.ts +17 -17
- package/build/src/index.js +11 -11
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/read.js +54 -39
- package/build/src/kanshi/report.d.ts +7 -7
- package/build/src/kanshi/select.js +4 -4
- package/build/src/library/address.js +2 -4
- package/build/src/library/akuma-creation.d.ts +5 -1
- package/build/src/library/akuma-creation.js +27 -47
- package/build/src/library/akumas.d.ts +7 -7
- package/build/src/library/akumas.js +13 -9
- package/build/src/library/bind.d.ts +17 -17
- package/build/src/library/bind.js +16 -12
- package/build/src/library/contract-address.d.ts +9 -0
- package/build/src/library/contract-address.js +71 -0
- package/build/src/library/contract-composition.d.ts +4 -7
- package/build/src/library/contract-composition.js +6 -18
- package/build/src/library/contract-creation.d.ts +3 -5
- package/build/src/library/contract-creation.js +24 -22
- package/build/src/library/contract-execution.js +21 -26
- package/build/src/library/contract-outcomes.d.ts +2 -14
- package/build/src/library/contract-outcomes.js +2 -13
- package/build/src/library/contract-types.d.ts +38 -4
- package/build/src/library/delivery.d.ts +0 -2
- package/build/src/library/delivery.js +2 -5
- package/build/src/library/input.d.ts +2 -2
- package/build/src/library/input.js +5 -5
- package/build/src/library/invocation.js +2 -2
- package/build/src/library/keiyaku.d.ts +0 -5
- package/build/src/library/keiyaku.js +6 -12
- package/build/src/library/nuke.js +3 -3
- package/build/src/library/outcome.d.ts +626 -625
- package/build/src/library/outcome.js +13 -3
- package/build/src/library/reconcile.js +8 -16
- package/build/src/library/refusal.d.ts +2 -2
- package/build/src/library/repo.d.ts +3 -2
- package/build/src/library/repo.js +10 -5
- package/build/src/library/selection.d.ts +5 -8
- package/build/src/library/selection.js +22 -73
- package/build/src/plugin/akuma-signals.d.ts +2 -0
- package/build/src/plugin/akuma-signals.js +4 -0
- package/build/src/plugin/public.d.ts +32 -2
- package/build/src/plugin/runtime.js +5 -3
- package/build/src/protocol/amend.js +3 -2
- package/build/src/protocol/attempt.js +3 -8
- package/build/src/protocol/bind.d.ts +2 -2
- package/build/src/protocol/bind.js +1 -1
- package/build/src/protocol/deliver.js +3 -3
- package/build/src/protocol/operations.d.ts +1 -3
- package/build/src/protocol/operations.js +0 -8
- package/build/src/protocol/outcome.d.ts +1 -2
- package/build/src/protocol/outcome.js +1 -13
- package/build/src/protocol/placement.js +3 -10
- package/build/src/protocol/read/status.js +31 -70
- package/build/src/protocol/reintegrate.js +3 -10
- package/build/src/protocol/review.js +3 -3
- package/build/src/protocol/run.d.ts +5 -1
- package/build/src/protocol/run.js +3 -3
- package/build/src/runtime/proc/windows-launch.exe +0 -0
- package/build/src/settlement/fence.d.ts +3 -3
- package/build/src/settlement/fence.js +4 -4
- package/build/src/settlement/holder.d.ts +16 -16
- package/build/src/settlement/holder.js +69 -63
- package/build/src/settlement/settle.d.ts +5 -5
- package/build/src/settlement/settle.js +53 -53
- package/package.json +19 -9
- package/plugins/paseo/plugin/index.server.ts +17 -0
- package/plugins/paseo/plugin/paseo-plugin.json +4 -0
- package/plugins/paseo/plugin/server/attach.ts +52 -0
- package/plugins/paseo/plugin/server/keiyaku.ts +44 -0
- package/plugins/paseo/plugin/server/message.ts +60 -0
- package/plugins/paseo/plugin/server/mirror.ts +193 -0
- package/plugins/paseo/plugin/server/model.ts +14 -0
- package/plugins/paseo/plugin/server/provider.ts +276 -0
- package/plugins/paseo/plugin/server/sdk-worker.ts +237 -0
- package/plugins/paseo/plugin/server/sdk.ts +289 -0
- package/plugins/paseo/plugin/server/stop.ts +26 -0
- package/plugins/paseo/plugin/server/transport.ts +35 -0
- package/plugins/paseo/plugin/shared/attach-rpc.ts +10 -0
- package/plugins/paseo/plugin/shared/refresh-rpc.ts +6 -0
- package/plugins/paseo/plugin/tsconfig.json +6 -0
- package/plugins/pi/keiyaku.ts +57 -0
- package/skills/keiyaku/SKILL.md +43 -0
- package/skills/keiyaku-akuma/SKILL.md +130 -0
- package/skills/keiyaku-akuma/references/automation.md +269 -0
- package/skills/keiyaku-babysit/SKILL.md +65 -0
- package/skills/keiyaku-bind/SKILL.md +216 -0
- package/skills/keiyaku-bind/agents/openai.yaml +4 -0
- package/skills/keiyaku-debt/SKILL.md +91 -0
- package/skills/keiyaku-workflow/SKILL.md +129 -0
- package/build/plugins/claude/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/codex/skills/keiyaku-task/SKILL.md +0 -104
- package/build/plugins/opencode/skills/keiyaku-task/SKILL.md +0 -104
- package/build/skills/keiyaku-task/SKILL.md +0 -104
- package/build/src/cli/commands/amend.d.ts +0 -12
- package/build/src/cli/commands/amend.js +0 -10
- package/build/src/cli/commands/bind.d.ts +0 -11
- package/build/src/cli/commands/bind.js +0 -23
- package/build/src/cli/commands/task-grammar.d.ts +0 -19
- package/build/src/cli/commands/task-grammar.js +0 -384
- package/build/src/cli/commands/task-query.d.ts +0 -5
- package/build/src/cli/render/task.d.ts +0 -41
- package/build/src/dispatch/association.d.ts +0 -1
- package/build/src/dispatch/association.js +0 -1
- package/build/src/task/board.d.ts +0 -168
- package/build/src/task/catalog.d.ts +0 -11
- package/build/src/task/catalog.js +0 -59
- package/build/src/task/compose-language.d.ts +0 -57
- package/build/src/task/compose-language.js +0 -364
- package/build/src/task/compose-parser.d.ts +0 -32
- package/build/src/task/compose-parser.js +0 -180
- package/build/src/task/compose.d.ts +0 -16
- package/build/src/task/compose.js +0 -189
- package/build/src/task/document.d.ts +0 -39
- package/build/src/task/identity.d.ts +0 -21
- package/build/src/task/index.d.ts +0 -138
- package/build/src/task/index.js +0 -269
- package/build/src/task/lifecycle-operations.d.ts +0 -6
- package/build/src/task/mutation-result.d.ts +0 -1726
- package/build/src/task/mutation-result.js +0 -198
- package/build/src/task/mutation.d.ts +0 -590
- package/build/src/task/mutation.js +0 -262
- package/build/src/task/operation-types.d.ts +0 -71
- package/build/src/task/operations.d.ts +0 -28
- package/build/src/task/query.d.ts +0 -76
- package/build/src/task/view.d.ts +0 -4
- package/build/src/task/view.js +0 -7
- /package/build/src/{task → debt}/operation-types.js +0 -0
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: keiyaku-task
|
|
3
|
-
description: >-
|
|
4
|
-
Must read when using Tasks for durable work planning, decomposition, or
|
|
5
|
-
dependencies.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Keiyaku Task
|
|
9
|
-
|
|
10
|
-
A Task is durable planning memory. It records work, decomposition, and
|
|
11
|
-
relationships that must remain after the current conversation. Task is an
|
|
12
|
-
independent product; it is not a Contract, Arc, Akuma, permission, acceptance
|
|
13
|
-
boundary, or fulfillment lifecycle.
|
|
14
|
-
|
|
15
|
-
## 1. When To Use A Task
|
|
16
|
-
|
|
17
|
-
Use a Task when the plan or dependency must outlive the current conversation.
|
|
18
|
-
Skip it when the work is small and no durable planning memory is needed.
|
|
19
|
-
|
|
20
|
-
- Use a `kei` for one independently acceptable outcome.
|
|
21
|
-
- Use an Arc for a chapter inside one `kei`.
|
|
22
|
-
- Use a Task for decomposition or dependency memory.
|
|
23
|
-
- Do not create a Task just to mirror a `kei`.
|
|
24
|
-
|
|
25
|
-
A Task may exist without a Contract. Associating a Task with a `kei` does not
|
|
26
|
-
transfer the Contract's holder, acceptance, or lifecycle to the Task.
|
|
27
|
-
|
|
28
|
-
## 2. Relationships And Parallel Work
|
|
29
|
-
|
|
30
|
-
Independent Tasks may start and progress in parallel when their dependencies
|
|
31
|
-
allow it.
|
|
32
|
-
|
|
33
|
-
Use the relationships for their actual meanings:
|
|
34
|
-
|
|
35
|
-
- `needs` means this Task must wait for another Task to become terminal.
|
|
36
|
-
- `parent` groups decomposition; it does not create a dependency.
|
|
37
|
-
- `supersedes` points to work replaced by this Task.
|
|
38
|
-
- `relates` records a connection without affecting readiness.
|
|
39
|
-
|
|
40
|
-
Only `needs` orders work. Do not add it because Tasks touch the same Region or
|
|
41
|
-
because one Task is related to another. A terminal Task releases its dependents.
|
|
42
|
-
An `on_hold` Task is deliberately paused; it is neither ready nor blocked.
|
|
43
|
-
|
|
44
|
-
## 3. Task Commands
|
|
45
|
-
|
|
46
|
-
Create and inspect Tasks:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
keiyaku task add "<title>"
|
|
50
|
-
keiyaku task add "<title>" --priority 1 --needs <task-id>
|
|
51
|
-
keiyaku task show <task-id>
|
|
52
|
-
keiyaku task ls
|
|
53
|
-
keiyaku task ready
|
|
54
|
-
keiyaku task blocked
|
|
55
|
-
keiyaku task tree <task-id>
|
|
56
|
-
keiyaku task doctor
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Use complete Task IDs for targeted commands. `ls`, `ready`, and `blocked` use
|
|
60
|
-
the current namespace; use `--world` to inspect the complete Task world.
|
|
61
|
-
|
|
62
|
-
Change lifecycle state:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
keiyaku task start <task-id>...
|
|
66
|
-
keiyaku task stop <task-id>
|
|
67
|
-
keiyaku task hold <task-id>...
|
|
68
|
-
keiyaku task resume <task-id>
|
|
69
|
-
keiyaku task done <task-id>...
|
|
70
|
-
keiyaku task drop <task-id>... --note "<reason>"
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Use `done` when the Task is complete. Use `drop` when it will not be done.
|
|
74
|
-
Both terminal states release dependent Tasks. Use `hold` for a deliberate pause,
|
|
75
|
-
not for an unresolved dependency; unresolved `needs` appear in `blocked`.
|
|
76
|
-
|
|
77
|
-
Update a Task without changing its lifecycle:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
keiyaku task update <task-id> --title "<title>"
|
|
81
|
-
keiyaku task update <task-id> --body "<body>"
|
|
82
|
-
keiyaku task update <task-id> --needs <task-id>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Use `task compose -` when several Tasks and their relationships should be
|
|
86
|
-
planned or admitted together. Use `--plan` to inspect the composition without
|
|
87
|
-
writing it.
|
|
88
|
-
|
|
89
|
-
## 4. After Creating A Task
|
|
90
|
-
|
|
91
|
-
Read the returned Task identity. Then:
|
|
92
|
-
|
|
93
|
-
1. Start ready work.
|
|
94
|
-
2. Run independent Tasks in parallel.
|
|
95
|
-
3. Add or remove relationships when the plan changes.
|
|
96
|
-
4. Hold work that is deliberately paused.
|
|
97
|
-
5. Mark completed work `done`, or mark abandoned work `drop` with a reason.
|
|
98
|
-
6. Use `ready`, `blocked`, `tree`, or `doctor` to rebuild the current view.
|
|
99
|
-
|
|
100
|
-
Task records planning memory. It does not perform the work, claim acceptance,
|
|
101
|
-
assign a holder, or decide what a Contract may accept.
|
|
102
|
-
|
|
103
|
-
Read `keiyaku-bind` for Contract authoring and `keiyaku-workflow` for Contract
|
|
104
|
-
lifecycle.
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: keiyaku-task
|
|
3
|
-
description: >-
|
|
4
|
-
Must read when using Tasks for durable work planning, decomposition, or
|
|
5
|
-
dependencies.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Keiyaku Task
|
|
9
|
-
|
|
10
|
-
A Task is durable planning memory. It records work, decomposition, and
|
|
11
|
-
relationships that must remain after the current conversation. Task is an
|
|
12
|
-
independent product; it is not a Contract, Arc, Akuma, permission, acceptance
|
|
13
|
-
boundary, or fulfillment lifecycle.
|
|
14
|
-
|
|
15
|
-
## 1. When To Use A Task
|
|
16
|
-
|
|
17
|
-
Use a Task when the plan or dependency must outlive the current conversation.
|
|
18
|
-
Skip it when the work is small and no durable planning memory is needed.
|
|
19
|
-
|
|
20
|
-
- Use a `kei` for one independently acceptable outcome.
|
|
21
|
-
- Use an Arc for a chapter inside one `kei`.
|
|
22
|
-
- Use a Task for decomposition or dependency memory.
|
|
23
|
-
- Do not create a Task just to mirror a `kei`.
|
|
24
|
-
|
|
25
|
-
A Task may exist without a Contract. Associating a Task with a `kei` does not
|
|
26
|
-
transfer the Contract's holder, acceptance, or lifecycle to the Task.
|
|
27
|
-
|
|
28
|
-
## 2. Relationships And Parallel Work
|
|
29
|
-
|
|
30
|
-
Independent Tasks may start and progress in parallel when their dependencies
|
|
31
|
-
allow it.
|
|
32
|
-
|
|
33
|
-
Use the relationships for their actual meanings:
|
|
34
|
-
|
|
35
|
-
- `needs` means this Task must wait for another Task to become terminal.
|
|
36
|
-
- `parent` groups decomposition; it does not create a dependency.
|
|
37
|
-
- `supersedes` points to work replaced by this Task.
|
|
38
|
-
- `relates` records a connection without affecting readiness.
|
|
39
|
-
|
|
40
|
-
Only `needs` orders work. Do not add it because Tasks touch the same Region or
|
|
41
|
-
because one Task is related to another. A terminal Task releases its dependents.
|
|
42
|
-
An `on_hold` Task is deliberately paused; it is neither ready nor blocked.
|
|
43
|
-
|
|
44
|
-
## 3. Task Commands
|
|
45
|
-
|
|
46
|
-
Create and inspect Tasks:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
keiyaku task add "<title>"
|
|
50
|
-
keiyaku task add "<title>" --priority 1 --needs <task-id>
|
|
51
|
-
keiyaku task show <task-id>
|
|
52
|
-
keiyaku task ls
|
|
53
|
-
keiyaku task ready
|
|
54
|
-
keiyaku task blocked
|
|
55
|
-
keiyaku task tree <task-id>
|
|
56
|
-
keiyaku task doctor
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Use complete Task IDs for targeted commands. `ls`, `ready`, and `blocked` use
|
|
60
|
-
the current namespace; use `--world` to inspect the complete Task world.
|
|
61
|
-
|
|
62
|
-
Change lifecycle state:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
keiyaku task start <task-id>...
|
|
66
|
-
keiyaku task stop <task-id>
|
|
67
|
-
keiyaku task hold <task-id>...
|
|
68
|
-
keiyaku task resume <task-id>
|
|
69
|
-
keiyaku task done <task-id>...
|
|
70
|
-
keiyaku task drop <task-id>... --note "<reason>"
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Use `done` when the Task is complete. Use `drop` when it will not be done.
|
|
74
|
-
Both terminal states release dependent Tasks. Use `hold` for a deliberate pause,
|
|
75
|
-
not for an unresolved dependency; unresolved `needs` appear in `blocked`.
|
|
76
|
-
|
|
77
|
-
Update a Task without changing its lifecycle:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
keiyaku task update <task-id> --title "<title>"
|
|
81
|
-
keiyaku task update <task-id> --body "<body>"
|
|
82
|
-
keiyaku task update <task-id> --needs <task-id>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Use `task compose -` when several Tasks and their relationships should be
|
|
86
|
-
planned or admitted together. Use `--plan` to inspect the composition without
|
|
87
|
-
writing it.
|
|
88
|
-
|
|
89
|
-
## 4. After Creating A Task
|
|
90
|
-
|
|
91
|
-
Read the returned Task identity. Then:
|
|
92
|
-
|
|
93
|
-
1. Start ready work.
|
|
94
|
-
2. Run independent Tasks in parallel.
|
|
95
|
-
3. Add or remove relationships when the plan changes.
|
|
96
|
-
4. Hold work that is deliberately paused.
|
|
97
|
-
5. Mark completed work `done`, or mark abandoned work `drop` with a reason.
|
|
98
|
-
6. Use `ready`, `blocked`, `tree`, or `doctor` to rebuild the current view.
|
|
99
|
-
|
|
100
|
-
Task records planning memory. It does not perform the work, claim acceptance,
|
|
101
|
-
assign a holder, or decide what a Contract may accept.
|
|
102
|
-
|
|
103
|
-
Read `keiyaku-bind` for Contract authoring and `keiyaku-workflow` for Contract
|
|
104
|
-
lifecycle.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ActorId, type Keiyaku, type Repo } from "../../index.js";
|
|
2
|
-
import type { ParsedAmend } from "./contract-grammar.js";
|
|
3
|
-
type AmendCommandInput = Readonly<{
|
|
4
|
-
command: ParsedAmend;
|
|
5
|
-
repo: Repo;
|
|
6
|
-
contract: Keiyaku;
|
|
7
|
-
markdown?: string;
|
|
8
|
-
gates?: readonly string[];
|
|
9
|
-
actor?: ActorId;
|
|
10
|
-
}>;
|
|
11
|
-
export declare function amendFromCommand({ command, repo, contract, markdown, gates, actor, }: AmendCommandInput): ReturnType<Keiyaku["amend"]>;
|
|
12
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { contractFromInput } from "../selectors.js";
|
|
2
|
-
export function amendFromCommand({ command, repo, contract, markdown, gates, actor, }) {
|
|
3
|
-
const after = command.clearAfter === true ? [] : command.after?.map((id) => contractFromInput(repo, id).id);
|
|
4
|
-
return contract.amend({
|
|
5
|
-
...(markdown === undefined ? {} : { markdown }),
|
|
6
|
-
...(actor === undefined ? {} : { actor }),
|
|
7
|
-
...(after === undefined ? {} : { after }),
|
|
8
|
-
...(gates === undefined ? {} : { gates }),
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ActorId, type BindResult, type KeiyakuLibrary, type Repo } from "../../index.js";
|
|
2
|
-
import type { ParsedBind } from "./contract-grammar.js";
|
|
3
|
-
type BindCommandInput = Readonly<{
|
|
4
|
-
command: ParsedBind;
|
|
5
|
-
repo: Repo;
|
|
6
|
-
library: KeiyakuLibrary;
|
|
7
|
-
markdown?: string;
|
|
8
|
-
actor?: ActorId;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function bindFromCommand({ command, repo, library, markdown, actor, }: BindCommandInput): Promise<BindResult>;
|
|
11
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { contractFromInput } from "../selectors.js";
|
|
2
|
-
export async function bindFromCommand({ command, repo, library, markdown, actor, }) {
|
|
3
|
-
if (command.forkOf !== undefined) {
|
|
4
|
-
return library.bind({
|
|
5
|
-
repo,
|
|
6
|
-
forkOf: contractFromInput(repo, command.forkOf).id,
|
|
7
|
-
...(command.target === undefined ? {} : { target: command.target }),
|
|
8
|
-
...(actor === undefined ? {} : { actor }),
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
const after = command.after?.map((id) => contractFromInput(repo, id).id);
|
|
12
|
-
if (markdown === undefined)
|
|
13
|
-
throw new Error("Markdown bind command is missing stdin terms");
|
|
14
|
-
return library.bind({
|
|
15
|
-
repo,
|
|
16
|
-
markdown,
|
|
17
|
-
...(command.task === undefined ? {} : { task: command.task }),
|
|
18
|
-
...(command.target === undefined ? {} : { target: command.target }),
|
|
19
|
-
...(actor === undefined ? {} : { actor }),
|
|
20
|
-
...(after === undefined ? {} : { after }),
|
|
21
|
-
...(command.gates === undefined ? {} : { gates: command.gates }),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
import { CliUsageError, TASK_FAMILY_USAGE_GUIDE, unknownCommandGuide } from "../usage.js";
|
|
2
|
-
import { scanArgs } from "../scan.js";
|
|
3
|
-
import { parseTaskNamespaceSelector } from "../../task/catalog.js";
|
|
4
|
-
import { parseTaskId } from "../../task/identity.js";
|
|
5
|
-
import { parseTaskQueryExpression, validateTaskLimit, validateTaskParent, } from "./task-query.js";
|
|
6
|
-
const COMMON = { json: "boolean" };
|
|
7
|
-
const TASK_COMMAND_SPECS = {
|
|
8
|
-
add: {
|
|
9
|
-
arity: [0, 1],
|
|
10
|
-
stdin: "document",
|
|
11
|
-
flags: {
|
|
12
|
-
...COMMON,
|
|
13
|
-
namespace: "value",
|
|
14
|
-
state: "value",
|
|
15
|
-
priority: "value",
|
|
16
|
-
needs: "repeat",
|
|
17
|
-
parent: "value",
|
|
18
|
-
supersedes: "repeat",
|
|
19
|
-
relates: "repeat",
|
|
20
|
-
body: "value",
|
|
21
|
-
note: "value",
|
|
22
|
-
actor: "value",
|
|
23
|
-
},
|
|
24
|
-
usage: `task add <TITLE> [--namespace <ns>] [--priority 0..3]
|
|
25
|
-
[--state open|in_progress|on_hold|done|drop]
|
|
26
|
-
[--note <text>] [--actor <actor>]
|
|
27
|
-
[--needs <TaskId>]... [--parent <TaskId>]
|
|
28
|
-
[--supersedes <TaskId>]... [--relates <TaskId>]...
|
|
29
|
-
[--body <text>]
|
|
30
|
-
task add [--namespace <ns>] [--actor <actor>] -`,
|
|
31
|
-
purpose: "Create a Task from flags or a Task document on stdin.",
|
|
32
|
-
details: "The stdin document is YAML front matter (title, state, priority, needs, parent, supersedes, relates, note) followed by a Markdown body.",
|
|
33
|
-
},
|
|
34
|
-
show: {
|
|
35
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
36
|
-
flags: COMMON,
|
|
37
|
-
usage: "task show <TaskId>...",
|
|
38
|
-
purpose: "Read one or more Tasks and their relationships.",
|
|
39
|
-
},
|
|
40
|
-
ls: {
|
|
41
|
-
arity: [0, 1],
|
|
42
|
-
flags: { ...COMMON, closed: "boolean", all: "boolean", world: "boolean", limit: "value" },
|
|
43
|
-
usage: "task ls [<namespace-selector>] [--closed | --all] [--world] [--limit <n>]",
|
|
44
|
-
purpose: "List Tasks in the selected namespace.",
|
|
45
|
-
details: [
|
|
46
|
-
"With no selector, lists the current directory Task context.",
|
|
47
|
-
"task/ selects the root namespace; --world lists every namespace in the current Task world.",
|
|
48
|
-
].join("\n"),
|
|
49
|
-
},
|
|
50
|
-
ready: {
|
|
51
|
-
arity: [0, 0],
|
|
52
|
-
flags: { ...COMMON, world: "boolean", parent: "value", limit: "value" },
|
|
53
|
-
usage: "task ready [--world] [--parent <TaskId>] [--limit <n>]",
|
|
54
|
-
purpose: "List open Tasks whose every dependency is complete or dropped.",
|
|
55
|
-
details: "--world lists every namespace in the current Task world.",
|
|
56
|
-
},
|
|
57
|
-
blocked: {
|
|
58
|
-
arity: [0, 0],
|
|
59
|
-
flags: { ...COMMON, world: "boolean", parent: "value", limit: "value" },
|
|
60
|
-
usage: "task blocked [--world] [--parent <TaskId>] [--limit <n>]",
|
|
61
|
-
purpose: "List Tasks with unmet dependencies.",
|
|
62
|
-
details: "--world lists every namespace in the current Task world.",
|
|
63
|
-
},
|
|
64
|
-
query: {
|
|
65
|
-
arity: [0, 0],
|
|
66
|
-
flags: {
|
|
67
|
-
...COMMON,
|
|
68
|
-
where: "value",
|
|
69
|
-
world: "boolean",
|
|
70
|
-
closed: "boolean",
|
|
71
|
-
all: "boolean",
|
|
72
|
-
sort: "value",
|
|
73
|
-
limit: "value",
|
|
74
|
-
},
|
|
75
|
-
usage: `task query [--where <expression>] [--closed | --all] [--world]
|
|
76
|
-
[--sort priority|created|updated|id] [--limit <n>]`,
|
|
77
|
-
purpose: "Filter and sort Tasks with a boolean expression.",
|
|
78
|
-
details: [
|
|
79
|
-
"fields: state priority title id parent under needs blocks ready blocked created updated",
|
|
80
|
-
"operators: = != < > <= >= ~ and or not ( )",
|
|
81
|
-
"sort: priority and created ascend; updated descends; id is lexical. Default: priority.",
|
|
82
|
-
"--world lists every namespace in the current Task world.",
|
|
83
|
-
"By default only active Tasks match; --closed selects terminal Tasks, --all includes both.",
|
|
84
|
-
"examples:",
|
|
85
|
-
" keiyaku task query --where 'priority <= 1 and ready' --world",
|
|
86
|
-
" keiyaku task query --where 'updated < 2026-08-06T00:00:00.000Z' --world",
|
|
87
|
-
].join("\n"),
|
|
88
|
-
},
|
|
89
|
-
tree: {
|
|
90
|
-
arity: [1, 1],
|
|
91
|
-
flags: COMMON,
|
|
92
|
-
usage: "task tree <TaskId>",
|
|
93
|
-
purpose: "Show a Task and its parent/child breakdown.",
|
|
94
|
-
},
|
|
95
|
-
doctor: {
|
|
96
|
-
arity: [0, 0],
|
|
97
|
-
flags: COMMON,
|
|
98
|
-
usage: "task doctor",
|
|
99
|
-
purpose: "Check Tasks for inconsistencies without changing them.",
|
|
100
|
-
},
|
|
101
|
-
update: {
|
|
102
|
-
arity: [1, 1],
|
|
103
|
-
flags: {
|
|
104
|
-
...COMMON,
|
|
105
|
-
title: "value",
|
|
106
|
-
body: "value",
|
|
107
|
-
append: "value",
|
|
108
|
-
note: "value",
|
|
109
|
-
priority: "value",
|
|
110
|
-
needs: "repeat",
|
|
111
|
-
"drop-needs": "repeat",
|
|
112
|
-
parent: "value",
|
|
113
|
-
"no-parent": "boolean",
|
|
114
|
-
supersedes: "repeat",
|
|
115
|
-
"drop-supersedes": "repeat",
|
|
116
|
-
relates: "repeat",
|
|
117
|
-
"drop-relates": "repeat",
|
|
118
|
-
},
|
|
119
|
-
usage: `task update <TaskId> [--title <text>] [--body <text>|- | --append <text>]
|
|
120
|
-
[--note <text>]
|
|
121
|
-
[--priority 0..3] [--needs <TaskId>]... [--drop-needs <TaskId>]...
|
|
122
|
-
[--parent <TaskId> | --no-parent]
|
|
123
|
-
[--supersedes <TaskId>]... [--drop-supersedes <TaskId>]...
|
|
124
|
-
[--relates <TaskId>]... [--drop-relates <TaskId>]...`,
|
|
125
|
-
purpose: "Change a Task's fields and relationships.",
|
|
126
|
-
details: [
|
|
127
|
-
"--body replaces the body; --append adds text after it, separated by a newline when needed.",
|
|
128
|
-
"--body - reads replacement body text from stdin.",
|
|
129
|
-
].join("\n"),
|
|
130
|
-
},
|
|
131
|
-
start: {
|
|
132
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
133
|
-
flags: COMMON,
|
|
134
|
-
usage: "task start <TaskId>...",
|
|
135
|
-
purpose: "Move one or more open Tasks into progress.",
|
|
136
|
-
},
|
|
137
|
-
stop: {
|
|
138
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
139
|
-
flags: COMMON,
|
|
140
|
-
usage: "task stop <TaskId>...",
|
|
141
|
-
purpose: "Return one or more in-progress Tasks to open.",
|
|
142
|
-
},
|
|
143
|
-
hold: {
|
|
144
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
145
|
-
flags: COMMON,
|
|
146
|
-
usage: "task hold <TaskId>...",
|
|
147
|
-
purpose: "Put one or more Tasks on hold.",
|
|
148
|
-
},
|
|
149
|
-
resume: {
|
|
150
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
151
|
-
flags: COMMON,
|
|
152
|
-
usage: "task resume <TaskId>...",
|
|
153
|
-
purpose: "Return one or more held Tasks to open.",
|
|
154
|
-
},
|
|
155
|
-
done: {
|
|
156
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
157
|
-
flags: { ...COMMON, note: "value" },
|
|
158
|
-
usage: "task done <TaskId>... [--note <text>]",
|
|
159
|
-
purpose: "Mark one or more Tasks done.",
|
|
160
|
-
},
|
|
161
|
-
drop: {
|
|
162
|
-
arity: [1, Number.POSITIVE_INFINITY],
|
|
163
|
-
flags: { ...COMMON, note: "value" },
|
|
164
|
-
usage: "task drop <TaskId>... [--note <text>]",
|
|
165
|
-
purpose: "Mark one or more Tasks as no longer needed.",
|
|
166
|
-
},
|
|
167
|
-
context: {
|
|
168
|
-
arity: [0, 1],
|
|
169
|
-
flags: COMMON,
|
|
170
|
-
usage: "task context [<namespace>]",
|
|
171
|
-
purpose: "Set or read the default Task namespace for this directory.",
|
|
172
|
-
details: "Omit <namespace> to read the current context; use / to reset it to the root namespace.",
|
|
173
|
-
},
|
|
174
|
-
compose: {
|
|
175
|
-
arity: [0, 0],
|
|
176
|
-
stdin: "compose",
|
|
177
|
-
flags: { ...COMMON, actor: "value", plan: "boolean" },
|
|
178
|
-
usage: "task compose [--actor <actor>] [--plan] -",
|
|
179
|
-
purpose: "Create or update several Tasks from one document, with an optional preview.",
|
|
180
|
-
details: [
|
|
181
|
-
"nodes: + <Title> creates; @task/<id> modifies a pre-existing Task",
|
|
182
|
-
"properties: as = <alias>; state = open|in_progress|on_hold|done|drop; pri = 0..3; parent = <ref>|empty",
|
|
183
|
-
"relations: needs|supersedes|relates with =, +=, or -=",
|
|
184
|
-
"references: @task/... is pre-existing; ^alias is new in this document",
|
|
185
|
-
"body: body = clears; body <<TOKEN reads exact content to TOKEN",
|
|
186
|
-
"TOKEN: [A-Z][A-Z0-9_]* with length 3..32",
|
|
187
|
-
"example:",
|
|
188
|
-
" ns=feature",
|
|
189
|
-
" + Parent",
|
|
190
|
-
" as = parent",
|
|
191
|
-
" pri = 1",
|
|
192
|
-
" body <<BODY",
|
|
193
|
-
" Exact body bytes.",
|
|
194
|
-
" BODY",
|
|
195
|
-
" + Child",
|
|
196
|
-
" parent = ^parent",
|
|
197
|
-
].join("\n"),
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
export function isTaskAction(value) {
|
|
201
|
-
return value !== undefined && Object.hasOwn(TASK_COMMAND_SPECS, value);
|
|
202
|
-
}
|
|
203
|
-
export function renderTaskHelp(action) {
|
|
204
|
-
if (action !== undefined) {
|
|
205
|
-
const spec = TASK_COMMAND_SPECS[action];
|
|
206
|
-
return `${spec.purpose}\n\n${renderTaskUsage(action)}${spec.details === undefined ? "" : `\n\n${spec.details}`}`;
|
|
207
|
-
}
|
|
208
|
-
const nameWidth = Math.max(...Object.keys(TASK_COMMAND_SPECS).map((name) => name.length));
|
|
209
|
-
return [
|
|
210
|
-
"usage keiyaku task <command> ...",
|
|
211
|
-
" keiyaku task <command> --help shows that command's complete usage",
|
|
212
|
-
"",
|
|
213
|
-
...Object.entries(TASK_COMMAND_SPECS).map(([name, spec]) => ` ${name.padEnd(nameWidth)} ${spec.purpose}`),
|
|
214
|
-
].join("\n");
|
|
215
|
-
}
|
|
216
|
-
function renderTaskUsage(action) {
|
|
217
|
-
return TASK_COMMAND_SPECS[action].usage
|
|
218
|
-
.split("\n")
|
|
219
|
-
.map((line, index) => {
|
|
220
|
-
if (index === 0 || line.trimStart().startsWith("task ")) {
|
|
221
|
-
const command = line.trimStart().startsWith("task ") ? `keiyaku ${line.trim()}` : `keiyaku ${line}`;
|
|
222
|
-
return `${index === 0 ? "usage " : " "}${command}`;
|
|
223
|
-
}
|
|
224
|
-
return ` ${line.trim()}`;
|
|
225
|
-
})
|
|
226
|
-
.join("\n");
|
|
227
|
-
}
|
|
228
|
-
function taskUsage(action) {
|
|
229
|
-
const lines = TASK_COMMAND_SPECS[action].usage.split("\n");
|
|
230
|
-
return lines
|
|
231
|
-
.map((line, index) => {
|
|
232
|
-
if (index === 0 || line.trimStart().startsWith("task "))
|
|
233
|
-
return `keiyaku ${line.trim()}`;
|
|
234
|
-
return ` ${line.trim()}`;
|
|
235
|
-
})
|
|
236
|
-
.join("\n");
|
|
237
|
-
}
|
|
238
|
-
export function taskUsageGuide(action) {
|
|
239
|
-
return {
|
|
240
|
-
scope: `keiyaku task ${action}`,
|
|
241
|
-
accepts: taskUsage(action),
|
|
242
|
-
help: `keiyaku task ${action} --help`,
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
/** One scan spec per Task action: `-` reads the document, or `--body -` replaces an update body. */
|
|
246
|
-
function scanSpec(action, spec) {
|
|
247
|
-
return {
|
|
248
|
-
subject: `task ${action}`,
|
|
249
|
-
flags: spec.flags,
|
|
250
|
-
...(spec.stdin === undefined ? {} : { stdin: spec.stdin }),
|
|
251
|
-
stdinRefusal: "stdin marker '-' is not valid here",
|
|
252
|
-
...(action === "update" ? { stdinValue: "body" } : {}),
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
function validateUpdate(scanned, fail) {
|
|
256
|
-
const flags = scanned.flags;
|
|
257
|
-
if (flags.body !== undefined && flags.append !== undefined)
|
|
258
|
-
fail("--body and --append are mutually exclusive");
|
|
259
|
-
if (flags.parent !== undefined && flags["no-parent"] === true)
|
|
260
|
-
fail("--parent and --no-parent are mutually exclusive");
|
|
261
|
-
if (Object.keys(flags).every((name) => name === "json"))
|
|
262
|
-
fail("task update requires at least one patch option");
|
|
263
|
-
}
|
|
264
|
-
function validateTaskReadFlags(action, flags, fail) {
|
|
265
|
-
if ((action === "ls" || action === "query") && flags.closed === true && flags.all === true)
|
|
266
|
-
fail("--closed and --all are mutually exclusive");
|
|
267
|
-
if (action === "ls" && flags.world === true) {
|
|
268
|
-
// An explicit selector is checked below, after positional shape is known.
|
|
269
|
-
}
|
|
270
|
-
if (typeof flags.limit === "string") {
|
|
271
|
-
try {
|
|
272
|
-
validateTaskLimit(flags.limit);
|
|
273
|
-
}
|
|
274
|
-
catch (error) {
|
|
275
|
-
fail(error instanceof Error ? error.message : String(error));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (typeof flags.sort === "string" &&
|
|
279
|
-
flags.sort !== "priority" &&
|
|
280
|
-
flags.sort !== "created" &&
|
|
281
|
-
flags.sort !== "updated" &&
|
|
282
|
-
flags.sort !== "id") {
|
|
283
|
-
fail("--sort must be priority, created, updated, or id");
|
|
284
|
-
}
|
|
285
|
-
if ((action === "ready" || action === "blocked") && typeof flags.parent === "string") {
|
|
286
|
-
try {
|
|
287
|
-
validateTaskParent(flags.parent);
|
|
288
|
-
}
|
|
289
|
-
catch (error) {
|
|
290
|
-
fail(error instanceof Error ? error.message : String(error));
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
/** Actions whose positionals are all addressed TaskIds validated by the native owner. */
|
|
295
|
-
const TASK_ID_ACTIONS = new Set([
|
|
296
|
-
"show",
|
|
297
|
-
"tree",
|
|
298
|
-
"update",
|
|
299
|
-
"start",
|
|
300
|
-
"stop",
|
|
301
|
-
"hold",
|
|
302
|
-
"resume",
|
|
303
|
-
"done",
|
|
304
|
-
"drop",
|
|
305
|
-
]);
|
|
306
|
-
/** Validate every addressed TaskId positional through the native owner before any read or write. */
|
|
307
|
-
function validateTaskIdPositionals(positionals, fail) {
|
|
308
|
-
for (const taskId of positionals) {
|
|
309
|
-
try {
|
|
310
|
-
parseTaskId(taskId);
|
|
311
|
-
}
|
|
312
|
-
catch (error) {
|
|
313
|
-
fail(error instanceof Error ? error.message : String(error));
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
/** Validate an explicit `task ls` namespace selector through the native owner. */
|
|
318
|
-
function validateListSelector(selector, fail) {
|
|
319
|
-
if (selector !== "task/" && (!selector.startsWith("task/") || !selector.endsWith("/")))
|
|
320
|
-
fail(`invalid Task namespace selector: ${selector}`);
|
|
321
|
-
if (selector === "task/")
|
|
322
|
-
return;
|
|
323
|
-
try {
|
|
324
|
-
parseTaskNamespaceSelector(selector);
|
|
325
|
-
}
|
|
326
|
-
catch (error) {
|
|
327
|
-
fail(error instanceof Error ? error.message : String(error));
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function validateTaskScan(action, scanned, fail) {
|
|
331
|
-
const spec = TASK_COMMAND_SPECS[action], { positionals, flags, stdin } = scanned;
|
|
332
|
-
if (positionals.length < spec.arity[0])
|
|
333
|
-
fail(spec.arity[1] === 1 ? `task ${action} requires a TaskId` : `task ${action} requires at least one TaskId`);
|
|
334
|
-
if (positionals.length > spec.arity[1])
|
|
335
|
-
fail(spec.arity[1] === 0
|
|
336
|
-
? `task ${action} accepts no positional arguments`
|
|
337
|
-
: `task ${action} accepts at most ${spec.arity[1]} positional argument${spec.arity[1] === 1 ? "" : "s"}`);
|
|
338
|
-
if (action === "add" && (stdin === "document") === (positionals.length === 1))
|
|
339
|
-
fail("task add requires either TITLE or '-' input");
|
|
340
|
-
if (action === "add" &&
|
|
341
|
-
stdin === "document" &&
|
|
342
|
-
Object.keys(flags).some((name) => name !== "json" && name !== "namespace" && name !== "actor"))
|
|
343
|
-
fail("task add document input owns its creation fields");
|
|
344
|
-
if (action === "compose" && stdin !== "compose")
|
|
345
|
-
fail("task compose requires '-' input");
|
|
346
|
-
if (TASK_ID_ACTIONS.has(action))
|
|
347
|
-
validateTaskIdPositionals(positionals, fail);
|
|
348
|
-
if (action === "ls" && positionals.length === 1) {
|
|
349
|
-
validateListSelector(positionals[0], fail);
|
|
350
|
-
if (flags.world === true)
|
|
351
|
-
fail("--world cannot be combined with an explicit Task namespace selector");
|
|
352
|
-
}
|
|
353
|
-
validateTaskReadFlags(action, flags, fail);
|
|
354
|
-
if (action === "update")
|
|
355
|
-
validateUpdate(scanned, fail);
|
|
356
|
-
}
|
|
357
|
-
export function parseTaskCommand(argv) {
|
|
358
|
-
const candidate = argv[0];
|
|
359
|
-
if (!isTaskAction(candidate)) {
|
|
360
|
-
throw new CliUsageError(`unknown task command: ${candidate ?? ""}`, unknownCommandGuide(TASK_FAMILY_USAGE_GUIDE, candidate ?? ""));
|
|
361
|
-
}
|
|
362
|
-
const action = candidate;
|
|
363
|
-
const fail = (message) => {
|
|
364
|
-
throw new CliUsageError(message, taskUsageGuide(action));
|
|
365
|
-
};
|
|
366
|
-
const scanned = scanArgs(argv, scanSpec(action, TASK_COMMAND_SPECS[action]), fail);
|
|
367
|
-
validateTaskScan(action, scanned, fail);
|
|
368
|
-
let where;
|
|
369
|
-
if (action === "query" && typeof scanned.flags.where === "string") {
|
|
370
|
-
try {
|
|
371
|
-
where = parseTaskQueryExpression(scanned.flags.where);
|
|
372
|
-
}
|
|
373
|
-
catch (error) {
|
|
374
|
-
fail(error instanceof Error ? error.message : String(error));
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return {
|
|
378
|
-
command: "task",
|
|
379
|
-
action,
|
|
380
|
-
output: scanned.flags.json === true ? "json" : "text",
|
|
381
|
-
...scanned,
|
|
382
|
-
...(where === undefined ? {} : { where }),
|
|
383
|
-
};
|
|
384
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type TaskQueryExpression } from "../../task/query.js";
|
|
2
|
-
export type { TaskQueryExpression } from "../../task/query.js";
|
|
3
|
-
export declare function parseTaskQueryExpression(source: string): TaskQueryExpression;
|
|
4
|
-
export declare function validateTaskLimit(source: string): void;
|
|
5
|
-
export declare function validateTaskParent(source: string): void;
|