agentplane 0.3.6 → 0.3.8
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/assets/AGENTS.md +11 -1
- package/assets/RUNNER.md +17 -0
- package/bin/agentplane.js +16 -7
- package/bin/framework-dev-contract.d.ts +6 -0
- package/bin/framework-dev-contract.js +13 -0
- package/bin/stale-dist-policy.js +6 -1
- package/dist/.build-manifest.json +724 -359
- package/dist/adapters/task-backend/task-backend-adapter.d.ts +4 -2
- package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -1
- package/dist/adapters/task-backend/task-backend-adapter.js +15 -2
- package/dist/backends/task-backend/local-backend-doc.d.ts +5 -0
- package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-doc.js +98 -0
- package/dist/backends/task-backend/local-backend-read.d.ts +7 -0
- package/dist/backends/task-backend/local-backend-read.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-read.js +186 -0
- package/dist/backends/task-backend/local-backend-state.d.ts +17 -0
- package/dist/backends/task-backend/local-backend-state.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-state.js +50 -0
- package/dist/backends/task-backend/local-backend-write.d.ts +15 -0
- package/dist/backends/task-backend/local-backend-write.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend-write.js +254 -0
- package/dist/backends/task-backend/local-backend.d.ts +10 -6
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend.js +32 -337
- package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts +40 -0
- package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-cache-doc.js +178 -0
- package/dist/backends/task-backend/redmine/backend-report.d.ts +10 -0
- package/dist/backends/task-backend/redmine/backend-report.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-report.js +43 -0
- package/dist/backends/task-backend/redmine/backend-sync.d.ts +67 -0
- package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync.js +367 -0
- package/dist/backends/task-backend/redmine/env.d.ts +1 -1
- package/dist/backends/task-backend/redmine/env.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/env.js +3 -0
- package/dist/backends/task-backend/redmine/inspect.d.ts +11 -0
- package/dist/backends/task-backend/redmine/inspect.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/inspect.js +75 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts +2 -1
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/mapping.js +32 -3
- package/dist/backends/task-backend/redmine/parse.d.ts +2 -1
- package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/parse.js +5 -3
- package/dist/backends/task-backend/redmine/state.d.ts +19 -0
- package/dist/backends/task-backend/redmine/state.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/state.js +109 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +14 -17
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +121 -379
- package/dist/backends/task-backend/shared/constants.d.ts +2 -1
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/constants.js +1 -1
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/doc.js +25 -39
- package/dist/backends/task-backend/shared/export.d.ts +2 -9
- package/dist/backends/task-backend/shared/export.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/export.js +73 -8
- package/dist/backends/task-backend/shared/normalize.d.ts +5 -1
- package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/normalize.js +166 -0
- package/dist/backends/task-backend/shared/record.d.ts +1 -1
- package/dist/backends/task-backend/shared/record.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/record.js +27 -3
- package/dist/backends/task-backend/shared/types.d.ts +76 -36
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
- package/dist/backends/task-backend/shared.d.ts +2 -2
- package/dist/backends/task-backend/shared.d.ts.map +1 -1
- package/dist/backends/task-backend/shared.js +1 -1
- package/dist/backends/task-backend.d.ts +1 -1
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +1 -1
- package/dist/backends/task-index.d.ts +2 -2
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +9 -5
- package/dist/cli/bootstrap-guide.d.ts +2 -2
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +10 -10
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +11 -9
- package/dist/cli/command-invocations.d.ts +4 -0
- package/dist/cli/command-invocations.d.ts.map +1 -0
- package/dist/cli/command-invocations.js +35 -0
- package/dist/cli/command-snippets.d.ts +12 -8
- package/dist/cli/command-snippets.d.ts.map +1 -1
- package/dist/cli/command-snippets.js +14 -8
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +1 -0
- package/dist/cli/group-command.d.ts +18 -0
- package/dist/cli/group-command.d.ts.map +1 -0
- package/dist/cli/group-command.js +45 -0
- package/dist/cli/output.d.ts +29 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +76 -0
- package/dist/cli/prompts.d.ts.map +1 -1
- package/dist/cli/prompts.js +5 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +38 -29
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/lifecycle.js +9 -6
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +11 -7
- package/dist/cli/run-cli/command-catalog/shared.d.ts +12 -3
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/shared.js +6 -3
- package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +46 -11
- package/dist/cli/run-cli/command-catalog.d.ts +11 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog.js +29 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +52 -6
- package/dist/cli/run-cli/commands/core/agent-profiles.d.ts +34 -0
- package/dist/cli/run-cli/commands/core/agent-profiles.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/agent-profiles.js +97 -0
- package/dist/cli/run-cli/commands/core/agents.d.ts +7 -0
- package/dist/cli/run-cli/commands/core/agents.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/agents.js +97 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts +10 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/preflight.js +286 -0
- package/dist/cli/run-cli/commands/core/quickstart.d.ts +8 -0
- package/dist/cli/run-cli/commands/core/quickstart.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/quickstart.js +43 -0
- package/dist/cli/run-cli/commands/core/role.d.ts +9 -0
- package/dist/cli/run-cli/commands/core/role.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core/role.js +128 -0
- package/dist/cli/run-cli/commands/core.d.ts +4 -24
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core.js +4 -630
- package/dist/cli/run-cli/commands/init/write-env.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-env.js +12 -0
- package/dist/cli/run-cli/error-guidance.js +10 -0
- package/dist/cli/run-cli/globals.d.ts +5 -2
- package/dist/cli/run-cli/globals.d.ts.map +1 -1
- package/dist/cli/run-cli/globals.js +82 -86
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +137 -100
- package/dist/cli/run-cli.test-helpers.d.ts +21 -0
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +90 -4
- package/dist/cli/spec/help.d.ts +10 -2
- package/dist/cli/spec/help.d.ts.map +1 -1
- package/dist/cli/spec/help.js +7 -5
- package/dist/cli/spec/registry.d.ts +27 -1
- package/dist/cli/spec/registry.d.ts.map +1 -1
- package/dist/cli/spec/registry.js +98 -25
- package/dist/commands/backend/sync.command.d.ts +8 -6
- package/dist/commands/backend/sync.command.d.ts.map +1 -1
- package/dist/commands/backend/sync.command.js +75 -14
- package/dist/commands/backend.d.ts +22 -0
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +111 -1
- package/dist/commands/branch/base.command.d.ts +2 -3
- package/dist/commands/branch/base.command.d.ts.map +1 -1
- package/dist/commands/branch/base.command.js +8 -12
- package/dist/commands/branch/base.d.ts.map +1 -1
- package/dist/commands/branch/base.js +11 -7
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +9 -8
- package/dist/commands/branch/remove.d.ts.map +1 -1
- package/dist/commands/branch/remove.js +4 -3
- package/dist/commands/branch/status.d.ts.map +1 -1
- package/dist/commands/branch/status.js +4 -3
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +48 -5
- package/dist/commands/cleanup/merged.command.d.ts +2 -3
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +8 -12
- package/dist/commands/commit.spec.d.ts.map +1 -1
- package/dist/commands/commit.spec.js +30 -6
- package/dist/commands/docs/cli.command.js +2 -2
- package/dist/commands/doctor/runtime.js +1 -1
- package/dist/commands/doctor/workflow.d.ts.map +1 -1
- package/dist/commands/doctor/workflow.js +10 -1
- package/dist/commands/doctor/workspace.d.ts +8 -0
- package/dist/commands/doctor/workspace.d.ts.map +1 -1
- package/dist/commands/doctor/workspace.js +127 -3
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +7 -0
- package/dist/commands/guard/commit.command.d.ts.map +1 -1
- package/dist/commands/guard/commit.command.js +30 -6
- package/dist/commands/guard/guard.command.d.ts +3 -3
- package/dist/commands/guard/guard.command.d.ts.map +1 -1
- package/dist/commands/guard/guard.command.js +9 -14
- package/dist/commands/guard/impl/allow.d.ts +4 -0
- package/dist/commands/guard/impl/allow.d.ts.map +1 -1
- package/dist/commands/guard/impl/allow.js +14 -3
- package/dist/commands/guard/impl/commands.d.ts +2 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +66 -9
- package/dist/commands/guard/impl/policy.d.ts +1 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -1
- package/dist/commands/guard/impl/policy.js +9 -6
- package/dist/commands/hooks/hooks.command.d.ts +3 -3
- package/dist/commands/hooks/hooks.command.d.ts.map +1 -1
- package/dist/commands/hooks/hooks.command.js +9 -11
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +90 -18
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +31 -3
- package/dist/commands/pr/integrate/internal/cleanup.d.ts +12 -0
- package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/cleanup.js +46 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts +4 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +34 -40
- package/dist/commands/pr/integrate/internal/merge.d.ts +6 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +92 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +1 -0
- package/dist/commands/pr/integrate/verify.d.ts.map +1 -1
- package/dist/commands/pr/integrate/verify.js +4 -3
- package/dist/commands/pr/note.d.ts.map +1 -1
- package/dist/commands/pr/note.js +3 -2
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +9 -12
- package/dist/commands/pr/pr.command.d.ts +3 -4
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +6 -11
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +5 -10
- package/dist/commands/recipes/cache.command.d.ts +3 -4
- package/dist/commands/recipes/cache.command.d.ts.map +1 -1
- package/dist/commands/recipes/cache.command.js +8 -26
- package/dist/commands/recipes/impl/apply.d.ts +1 -1
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +1 -1
- package/dist/commands/recipes/impl/commands/explain.js +1 -1
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +1 -2
- package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +1 -2
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
- package/dist/commands/recipes/impl/manifest.js +0 -10
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +1 -2
- package/dist/commands/recipes/impl/resolver.d.ts +1 -1
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
- package/dist/commands/recipes/impl/resolver.js +26 -16
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
- package/dist/commands/recipes/impl/scenario.js +80 -0
- package/dist/commands/recipes/impl/types.d.ts +27 -13
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/recipes/recipes.command.d.ts +3 -4
- package/dist/commands/recipes/recipes.command.d.ts.map +1 -1
- package/dist/commands/recipes/recipes.command.js +8 -34
- package/dist/commands/recipes.d.ts +4 -4
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +3 -3
- package/dist/commands/recipes.test-helpers.d.ts +17 -0
- package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
- package/dist/commands/recipes.test-helpers.js +56 -2
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +77 -56
- package/dist/commands/release/plan.command.d.ts.map +1 -1
- package/dist/commands/release/plan.command.js +7 -3
- package/dist/commands/release/release.command.d.ts +3 -3
- package/dist/commands/release/release.command.d.ts.map +1 -1
- package/dist/commands/release/release.command.js +9 -11
- package/dist/commands/release.test-helpers.d.ts +20 -0
- package/dist/commands/release.test-helpers.d.ts.map +1 -0
- package/dist/commands/release.test-helpers.js +37 -0
- package/dist/commands/runtime.command.d.ts +7 -7
- package/dist/commands/runtime.command.d.ts.map +1 -1
- package/dist/commands/runtime.command.js +29 -33
- package/dist/commands/scenario/execute.command.d.ts +8 -0
- package/dist/commands/scenario/execute.command.d.ts.map +1 -0
- package/dist/commands/scenario/execute.command.js +117 -0
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +45 -32
- package/dist/commands/scenario/run.command.js +2 -2
- package/dist/commands/scenario/scenario.command.d.ts +3 -4
- package/dist/commands/scenario/scenario.command.d.ts.map +1 -1
- package/dist/commands/scenario/scenario.command.js +8 -26
- package/dist/commands/shared/git-context.d.ts +1 -0
- package/dist/commands/shared/git-context.d.ts.map +1 -1
- package/dist/commands/shared/git-context.js +4 -2
- package/dist/commands/shared/git-ops.d.ts +1 -0
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +13 -0
- package/dist/commands/shared/operator-pipeline.d.ts +10 -0
- package/dist/commands/shared/operator-pipeline.d.ts.map +1 -0
- package/dist/commands/shared/operator-pipeline.js +16 -0
- package/dist/commands/shared/pr-meta.d.ts +32 -12
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +49 -14
- package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
- package/dist/commands/shared/reconcile-check.js +28 -3
- package/dist/commands/shared/task-backend.d.ts +11 -7
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +107 -24
- package/dist/commands/shared/task-handoff.d.ts +64 -0
- package/dist/commands/shared/task-handoff.d.ts.map +1 -0
- package/dist/commands/shared/task-handoff.js +151 -0
- package/dist/commands/shared/task-mutation.d.ts +36 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -0
- package/dist/commands/shared/task-mutation.js +67 -0
- package/dist/commands/shared/task-store.d.ts +65 -2
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +309 -91
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +41 -39
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +31 -89
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +0 -7
- package/dist/commands/task/close-noop.d.ts.map +1 -1
- package/dist/commands/task/close-noop.js +0 -21
- package/dist/commands/task/close-shared.d.ts +0 -2
- package/dist/commands/task/close-shared.d.ts.map +1 -1
- package/dist/commands/task/close-shared.js +24 -57
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +48 -42
- package/dist/commands/task/derive.command.d.ts +1 -0
- package/dist/commands/task/derive.command.d.ts.map +1 -1
- package/dist/commands/task/derive.command.js +15 -2
- package/dist/commands/task/derive.d.ts +1 -0
- package/dist/commands/task/derive.d.ts.map +1 -1
- package/dist/commands/task/derive.js +37 -7
- package/dist/commands/task/doc.command.d.ts.map +1 -1
- package/dist/commands/task/doc.command.js +7 -6
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +68 -61
- package/dist/commands/task/finish-shared.d.ts +60 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -0
- package/dist/commands/task/finish-shared.js +181 -0
- package/dist/commands/task/finish.d.ts +1 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +73 -204
- package/dist/commands/task/handoff-record.command.d.ts +17 -0
- package/dist/commands/task/handoff-record.command.d.ts.map +1 -0
- package/dist/commands/task/handoff-record.command.js +140 -0
- package/dist/commands/task/handoff-show.command.d.ts +8 -0
- package/dist/commands/task/handoff-show.command.d.ts.map +1 -0
- package/dist/commands/task/handoff-show.command.js +77 -0
- package/dist/commands/task/handoff.command.d.ts +7 -0
- package/dist/commands/task/handoff.command.d.ts.map +1 -0
- package/dist/commands/task/handoff.command.js +21 -0
- package/dist/commands/task/handoff.shared.d.ts +39 -0
- package/dist/commands/task/handoff.shared.d.ts.map +1 -0
- package/dist/commands/task/handoff.shared.js +134 -0
- package/dist/commands/task/hosted-close.command.d.ts +9 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close.command.js +190 -0
- package/dist/commands/task/hosted-merge-sync.d.ts +40 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync.js +277 -0
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +7 -24
- package/dist/commands/task/migrate-doc.d.ts +15 -0
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +126 -35
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +26 -4
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +10 -28
- package/dist/commands/task/normalize.command.d.ts +1 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +12 -0
- package/dist/commands/task/normalize.d.ts +1 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +21 -9
- package/dist/commands/task/plan.command.d.ts +3 -4
- package/dist/commands/task/plan.command.d.ts.map +1 -1
- package/dist/commands/task/plan.command.js +6 -12
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +118 -125
- package/dist/commands/task/reclaim.command.d.ts +11 -0
- package/dist/commands/task/reclaim.command.d.ts.map +1 -0
- package/dist/commands/task/reclaim.command.js +102 -0
- package/dist/commands/task/resume-context.command.d.ts +9 -0
- package/dist/commands/task/resume-context.command.d.ts.map +1 -0
- package/dist/commands/task/resume-context.command.js +60 -0
- package/dist/commands/task/run-cancel.command.d.ts +6 -0
- package/dist/commands/task/run-cancel.command.d.ts.map +1 -0
- package/dist/commands/task/run-cancel.command.js +45 -0
- package/dist/commands/task/run-cancel.spec.d.ts +7 -0
- package/dist/commands/task/run-cancel.spec.d.ts.map +1 -0
- package/dist/commands/task/run-cancel.spec.js +20 -0
- package/dist/commands/task/run-resume.command.d.ts +6 -0
- package/dist/commands/task/run-resume.command.d.ts.map +1 -0
- package/dist/commands/task/run-resume.command.js +55 -0
- package/dist/commands/task/run-resume.spec.d.ts +7 -0
- package/dist/commands/task/run-resume.spec.d.ts.map +1 -0
- package/dist/commands/task/run-resume.spec.js +20 -0
- package/dist/commands/task/run-retry.command.d.ts +6 -0
- package/dist/commands/task/run-retry.command.d.ts.map +1 -0
- package/dist/commands/task/run-retry.command.js +56 -0
- package/dist/commands/task/run-retry.spec.d.ts +7 -0
- package/dist/commands/task/run-retry.spec.d.ts.map +1 -0
- package/dist/commands/task/run-retry.spec.js +20 -0
- package/dist/commands/task/run-show.command.d.ts +6 -0
- package/dist/commands/task/run-show.command.d.ts.map +1 -0
- package/dist/commands/task/run-show.command.js +133 -0
- package/dist/commands/task/run-show.spec.d.ts +8 -0
- package/dist/commands/task/run-show.spec.d.ts.map +1 -0
- package/dist/commands/task/run-show.spec.js +44 -0
- package/dist/commands/task/run-tail.command.d.ts +6 -0
- package/dist/commands/task/run-tail.command.d.ts.map +1 -0
- package/dist/commands/task/run-tail.command.js +26 -0
- package/dist/commands/task/run-tail.spec.d.ts +8 -0
- package/dist/commands/task/run-tail.spec.d.ts.map +1 -0
- package/dist/commands/task/run-tail.spec.js +51 -0
- package/dist/commands/task/run-trace.command.d.ts +6 -0
- package/dist/commands/task/run-trace.command.d.ts.map +1 -0
- package/dist/commands/task/run-trace.command.js +25 -0
- package/dist/commands/task/run-trace.spec.d.ts +7 -0
- package/dist/commands/task/run-trace.spec.d.ts.map +1 -0
- package/dist/commands/task/run-trace.spec.js +31 -0
- package/dist/commands/task/run.command.d.ts +6 -0
- package/dist/commands/task/run.command.d.ts.map +1 -0
- package/dist/commands/task/run.command.js +74 -0
- package/dist/commands/task/run.spec.d.ts +7 -0
- package/dist/commands/task/run.spec.d.ts.map +1 -0
- package/dist/commands/task/run.spec.js +26 -0
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +4 -2
- package/dist/commands/task/scrub.d.ts.map +1 -1
- package/dist/commands/task/scrub.js +27 -24
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +21 -31
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +38 -111
- package/dist/commands/task/shared/dependencies.d.ts +5 -4
- package/dist/commands/task/shared/dependencies.d.ts.map +1 -1
- package/dist/commands/task/shared/dependencies.js +20 -2
- package/dist/commands/task/shared/docs.d.ts +6 -1
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +14 -1
- package/dist/commands/task/shared/listing.d.ts +16 -2
- package/dist/commands/task/shared/listing.d.ts.map +1 -1
- package/dist/commands/task/shared/listing.js +56 -0
- package/dist/commands/task/shared/transition-command.d.ts +15 -0
- package/dist/commands/task/shared/transition-command.d.ts.map +1 -0
- package/dist/commands/task/shared/transition-command.js +43 -0
- package/dist/commands/task/shared/transitions.d.ts +56 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +82 -8
- package/dist/commands/task/shared/workflow-transition-service.d.ts +75 -0
- package/dist/commands/task/shared/workflow-transition-service.d.ts.map +1 -0
- package/dist/commands/task/shared/workflow-transition-service.js +226 -0
- package/dist/commands/task/shared.d.ts +6 -4
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +6 -4
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +37 -3
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +32 -113
- package/dist/commands/task/task.command.d.ts +3 -4
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +22 -37
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +21 -146
- package/dist/commands/task/verify.command.d.ts.map +1 -1
- package/dist/commands/task/verify.command.js +7 -6
- package/dist/commands/task.test-helpers.d.ts +13 -0
- package/dist/commands/task.test-helpers.d.ts.map +1 -0
- package/dist/commands/task.test-helpers.js +65 -0
- package/dist/commands/upgrade/apply.d.ts +2 -0
- package/dist/commands/upgrade/apply.d.ts.map +1 -1
- package/dist/commands/upgrade/apply.js +33 -1
- package/dist/commands/upgrade/materialize.d.ts +28 -0
- package/dist/commands/upgrade/materialize.d.ts.map +1 -0
- package/dist/commands/upgrade/materialize.js +154 -0
- package/dist/commands/upgrade/plan.d.ts +18 -0
- package/dist/commands/upgrade/plan.d.ts.map +1 -0
- package/dist/commands/upgrade/plan.js +219 -0
- package/dist/commands/upgrade/policy.d.ts +24 -0
- package/dist/commands/upgrade/policy.d.ts.map +1 -0
- package/dist/commands/upgrade/policy.js +182 -0
- package/dist/commands/upgrade/report.d.ts.map +1 -1
- package/dist/commands/upgrade/report.js +7 -5
- package/dist/commands/upgrade.command.d.ts.map +1 -1
- package/dist/commands/upgrade.command.js +25 -0
- package/dist/commands/upgrade.d.ts +1 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +164 -618
- package/dist/commands/workflow.command.d.ts +3 -4
- package/dist/commands/workflow.command.d.ts.map +1 -1
- package/dist/commands/workflow.command.js +8 -25
- package/dist/policy/rules/allowlist.d.ts.map +1 -1
- package/dist/policy/rules/allowlist.js +12 -9
- package/dist/ports/task-backend-port.d.ts +4 -2
- package/dist/ports/task-backend-port.d.ts.map +1 -1
- package/dist/runner/adapters/codex.d.ts +9 -0
- package/dist/runner/adapters/codex.d.ts.map +1 -0
- package/dist/runner/adapters/codex.js +414 -0
- package/dist/runner/adapters/custom.d.ts +12 -0
- package/dist/runner/adapters/custom.d.ts.map +1 -0
- package/dist/runner/adapters/custom.js +512 -0
- package/dist/runner/adapters/index.d.ts +8 -0
- package/dist/runner/adapters/index.d.ts.map +1 -0
- package/dist/runner/adapters/index.js +15 -0
- package/dist/runner/adapters/recipe-run-profile.d.ts +8 -0
- package/dist/runner/adapters/recipe-run-profile.d.ts.map +1 -0
- package/dist/runner/adapters/recipe-run-profile.js +53 -0
- package/dist/runner/adapters/shared.d.ts +45 -0
- package/dist/runner/adapters/shared.d.ts.map +1 -0
- package/dist/runner/adapters/shared.js +58 -0
- package/dist/runner/artifacts.d.ts +31 -0
- package/dist/runner/artifacts.d.ts.map +1 -0
- package/dist/runner/artifacts.js +153 -0
- package/dist/runner/codex-approval-probe.d.ts +23 -0
- package/dist/runner/codex-approval-probe.d.ts.map +1 -0
- package/dist/runner/codex-approval-probe.js +55 -0
- package/dist/runner/codex-smoke.d.ts +11 -0
- package/dist/runner/codex-smoke.d.ts.map +1 -0
- package/dist/runner/codex-smoke.js +45 -0
- package/dist/runner/config.d.ts +6 -0
- package/dist/runner/config.d.ts.map +1 -0
- package/dist/runner/config.js +15 -0
- package/dist/runner/context/base-prompts.d.ts +10 -0
- package/dist/runner/context/base-prompts.d.ts.map +1 -0
- package/dist/runner/context/base-prompts.js +255 -0
- package/dist/runner/context/recipe-context.d.ts +17 -0
- package/dist/runner/context/recipe-context.d.ts.map +1 -0
- package/dist/runner/context/recipe-context.js +48 -0
- package/dist/runner/context/task-context.d.ts +24 -0
- package/dist/runner/context/task-context.d.ts.map +1 -0
- package/dist/runner/context/task-context.js +266 -0
- package/dist/runner/index.d.ts +12 -0
- package/dist/runner/index.d.ts.map +1 -0
- package/dist/runner/index.js +11 -0
- package/dist/runner/policy-decision.d.ts +12 -0
- package/dist/runner/policy-decision.d.ts.map +1 -0
- package/dist/runner/policy-decision.js +89 -0
- package/dist/runner/policy-display.d.ts +4 -0
- package/dist/runner/policy-display.d.ts.map +1 -0
- package/dist/runner/policy-display.js +41 -0
- package/dist/runner/process-supervision.d.ts +48 -0
- package/dist/runner/process-supervision.d.ts.map +1 -0
- package/dist/runner/process-supervision.js +490 -0
- package/dist/runner/result-manifest-policy.d.ts +9 -0
- package/dist/runner/result-manifest-policy.d.ts.map +1 -0
- package/dist/runner/result-manifest-policy.js +96 -0
- package/dist/runner/result-manifest.d.ts +30 -0
- package/dist/runner/result-manifest.d.ts.map +1 -0
- package/dist/runner/result-manifest.js +322 -0
- package/dist/runner/run-id.d.ts +2 -0
- package/dist/runner/run-id.d.ts.map +1 -0
- package/dist/runner/run-id.js +3 -0
- package/dist/runner/run-repository.d.ts +51 -0
- package/dist/runner/run-repository.d.ts.map +1 -0
- package/dist/runner/run-repository.js +222 -0
- package/dist/runner/task-run-paths.d.ts +19 -0
- package/dist/runner/task-run-paths.d.ts.map +1 -0
- package/dist/runner/task-run-paths.js +25 -0
- package/dist/runner/task-state.d.ts +9 -0
- package/dist/runner/task-state.d.ts.map +1 -0
- package/dist/runner/task-state.js +354 -0
- package/dist/runner/test-helpers.d.ts +30 -0
- package/dist/runner/test-helpers.d.ts.map +1 -0
- package/dist/runner/test-helpers.js +97 -0
- package/dist/runner/trace-artifacts.d.ts +14 -0
- package/dist/runner/trace-artifacts.d.ts.map +1 -0
- package/dist/runner/trace-artifacts.js +80 -0
- package/dist/runner/trace.d.ts +10 -0
- package/dist/runner/trace.d.ts.map +1 -0
- package/dist/runner/trace.js +37 -0
- package/dist/runner/types.d.ts +317 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +3 -0
- package/dist/runner/usecases/scenario-materialize-task.d.ts +29 -0
- package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -0
- package/dist/runner/usecases/scenario-materialize-task.js +151 -0
- package/dist/runner/usecases/task-run-inspect.d.ts +41 -0
- package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-inspect.js +74 -0
- package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts +10 -0
- package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle-cancel.js +172 -0
- package/dist/runner/usecases/task-run-lifecycle-replay.d.ts +18 -0
- package/dist/runner/usecases/task-run-lifecycle-replay.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle-replay.js +128 -0
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts +45 -0
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle-shared.js +172 -0
- package/dist/runner/usecases/task-run-lifecycle.d.ts +4 -0
- package/dist/runner/usecases/task-run-lifecycle.d.ts.map +1 -0
- package/dist/runner/usecases/task-run-lifecycle.js +2 -0
- package/dist/runner/usecases/task-run.d.ts +32 -0
- package/dist/runner/usecases/task-run.d.ts.map +1 -0
- package/dist/runner/usecases/task-run.js +278 -0
- package/dist/shared/agent-emoji.d.ts.map +1 -1
- package/dist/shared/agent-emoji.js +1 -0
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/guards.d.ts.map +1 -1
- package/dist/shared/guards.js +1 -0
- package/dist/shared/protected-paths.d.ts +10 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +33 -0
- package/dist/shared/repo-cli-version.d.ts.map +1 -1
- package/dist/shared/repo-cli-version.js +7 -5
- package/dist/shared/task-doc-conflicts.d.ts +12 -0
- package/dist/shared/task-doc-conflicts.d.ts.map +1 -0
- package/dist/shared/task-doc-conflicts.js +40 -0
- package/dist/shared/task-doc-state.d.ts +10 -0
- package/dist/shared/task-doc-state.d.ts.map +1 -0
- package/dist/shared/task-doc-state.js +15 -0
- package/dist/test-helpers/fs.d.ts +2 -0
- package/dist/test-helpers/fs.d.ts.map +1 -0
- package/dist/test-helpers/fs.js +9 -0
- package/dist/usecases/context/resolve-context.d.ts +2 -0
- package/dist/usecases/context/resolve-context.d.ts.map +1 -1
- package/dist/usecases/context/resolve-context.js +4 -1
- package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
- package/dist/usecases/task/task-list-usecase.js +2 -8
- package/dist/workflow-runtime/fix.d.ts +9 -1
- package/dist/workflow-runtime/fix.d.ts.map +1 -1
- package/dist/workflow-runtime/fix.js +9 -1
- package/package.json +3 -2
- package/dist/backends/task-backend.test-helpers.d.ts +0 -4
- package/dist/backends/task-backend.test-helpers.d.ts.map +0 -1
- package/dist/backends/task-backend.test-helpers.js +0 -33
- package/dist/cli/run-cli/catalog.d.ts +0 -7
- package/dist/cli/run-cli/catalog.d.ts.map +0 -1
- package/dist/cli/run-cli/catalog.js +0 -22
- package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts +0 -3
- package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts.map +0 -1
- package/dist/cli/run-cli.core.pr-flow.test-helpers.js +0 -41
- package/dist/cli/run-cli.core.tasks.test-helpers.d.ts +0 -2
- package/dist/cli/run-cli.core.tasks.test-helpers.d.ts.map +0 -1
- package/dist/cli/run-cli.core.tasks.test-helpers.js +0 -6
- package/dist/commands/block.command.d.ts +0 -4
- package/dist/commands/block.command.d.ts.map +0 -1
- package/dist/commands/block.command.js +0 -2
- package/dist/commands/doctor.command.d.ts +0 -3
- package/dist/commands/doctor.command.d.ts.map +0 -1
- package/dist/commands/doctor.command.js +0 -2
- package/dist/commands/finish.command.d.ts +0 -4
- package/dist/commands/finish.command.d.ts.map +0 -1
- package/dist/commands/finish.command.js +0 -2
- package/dist/commands/recipes/install.command.d.ts +0 -3
- package/dist/commands/recipes/install.command.d.ts.map +0 -1
- package/dist/commands/recipes/install.command.js +0 -2
- package/dist/commands/start.command.d.ts +0 -4
- package/dist/commands/start.command.d.ts.map +0 -1
- package/dist/commands/start.command.js +0 -2
- package/dist/commands/task/list.command.d.ts +0 -4
- package/dist/commands/task/list.command.d.ts.map +0 -1
- package/dist/commands/task/list.command.js +0 -2
- package/dist/commands/task/next.command.d.ts +0 -4
- package/dist/commands/task/next.command.d.ts.map +0 -1
- package/dist/commands/task/next.command.js +0 -2
- package/dist/commands/task/search.command.d.ts +0 -4
- package/dist/commands/task/search.command.d.ts.map +0 -1
- package/dist/commands/task/search.command.js +0 -2
- package/dist/commands/task/show.command.d.ts +0 -4
- package/dist/commands/task/show.command.d.ts.map +0 -1
- package/dist/commands/task/show.command.js +0 -2
- package/dist/commands/verify.command.d.ts +0 -4
- package/dist/commands/verify.command.d.ts.map +0 -1
- package/dist/commands/verify.command.js +0 -2
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { resolveTaskDocUpdatedBy, parseTaskReadme, taskDocToSectionMap, validateTaskReadmeFrontmatter, withTaskReadmeFrontmatterDefaults, } from "@agentplaneorg/core";
|
|
2
3
|
import { CliError } from "../../shared/errors.js";
|
|
3
|
-
import { loadTaskBackend } from "../../backends/task-backend.js";
|
|
4
|
+
import { loadTaskBackend, taskRecordToData, toTaskSummary, } from "../../backends/task-backend.js";
|
|
5
|
+
import { gitShowFile, toGitPath } from "./git-diff.js";
|
|
4
6
|
import { GitContext } from "./git-context.js";
|
|
7
|
+
import { gitListTaskBranches, parseTaskIdFromBranch } from "./git-worktree.js";
|
|
5
8
|
function normalizeDocUpdatedBy(value) {
|
|
6
9
|
const trimmed = value?.trim() ?? "";
|
|
7
10
|
if (!trimmed)
|
|
@@ -11,19 +14,23 @@ function normalizeDocUpdatedBy(value) {
|
|
|
11
14
|
return trimmed;
|
|
12
15
|
}
|
|
13
16
|
export function resolveDocUpdatedBy(task, author) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return fromTask;
|
|
20
|
-
return normalizeDocUpdatedBy(typeof task.owner === "string" ? task.owner : undefined);
|
|
17
|
+
return normalizeDocUpdatedBy(resolveTaskDocUpdatedBy({
|
|
18
|
+
comments: task.comments ?? null,
|
|
19
|
+
doc_updated_by: task.doc_updated_by,
|
|
20
|
+
owner: task.owner,
|
|
21
|
+
}, author));
|
|
21
22
|
}
|
|
22
23
|
export function taskDataToFrontmatter(task) {
|
|
23
24
|
const planApproval = task.plan_approval ??
|
|
24
25
|
{ state: "pending", updated_at: null, updated_by: null, note: null };
|
|
25
26
|
const verification = task.verification ??
|
|
26
27
|
{ state: "pending", updated_at: null, updated_by: null, note: null };
|
|
28
|
+
const revision = Number.isInteger(task.revision) && Number(task.revision) > 0 ? Number(task.revision) : 1;
|
|
29
|
+
const sections = task.doc === undefined
|
|
30
|
+
? task.sections && Object.keys(task.sections).length > 0
|
|
31
|
+
? task.sections
|
|
32
|
+
: undefined
|
|
33
|
+
: taskDocToSectionMap(task.doc);
|
|
27
34
|
return {
|
|
28
35
|
id: task.id,
|
|
29
36
|
title: task.title,
|
|
@@ -33,11 +40,14 @@ export function taskDataToFrontmatter(task) {
|
|
|
33
40
|
status: task.status,
|
|
34
41
|
priority: task.priority,
|
|
35
42
|
owner: task.owner,
|
|
43
|
+
revision,
|
|
44
|
+
origin: task.origin ?? undefined,
|
|
36
45
|
depends_on: task.depends_on ?? [],
|
|
37
46
|
tags: task.tags ?? [],
|
|
38
47
|
verify: task.verify ?? [],
|
|
39
48
|
plan_approval: planApproval,
|
|
40
49
|
verification,
|
|
50
|
+
runner: task.runner ?? undefined,
|
|
41
51
|
commit: task.commit ?? null,
|
|
42
52
|
comments: task.comments ?? [],
|
|
43
53
|
events: task.events ?? [],
|
|
@@ -45,6 +55,7 @@ export function taskDataToFrontmatter(task) {
|
|
|
45
55
|
doc_updated_at: task.doc_updated_at,
|
|
46
56
|
doc_updated_by: task.doc_updated_by,
|
|
47
57
|
description: task.description ?? "",
|
|
58
|
+
sections,
|
|
48
59
|
id_source: task.id_source,
|
|
49
60
|
dirty: task.dirty,
|
|
50
61
|
};
|
|
@@ -65,22 +76,70 @@ export async function loadCommandContext(opts) {
|
|
|
65
76
|
backendConfigPath,
|
|
66
77
|
git: new GitContext({ gitRoot: resolved.gitRoot }),
|
|
67
78
|
memo: {},
|
|
68
|
-
resolved,
|
|
69
|
-
backend,
|
|
70
79
|
};
|
|
71
80
|
}
|
|
72
81
|
export async function loadTaskFromContext(opts) {
|
|
73
82
|
const task = await opts.ctx.taskBackend.getTask(opts.taskId);
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
if (task)
|
|
84
|
+
return task;
|
|
85
|
+
const tasksDir = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir);
|
|
86
|
+
const readmePath = path.join(tasksDir, opts.taskId, "README.md");
|
|
87
|
+
const branchFallback = await loadTaskFromBranchSnapshot({
|
|
88
|
+
ctx: opts.ctx,
|
|
89
|
+
taskId: opts.taskId,
|
|
90
|
+
readmePath,
|
|
91
|
+
});
|
|
92
|
+
if (branchFallback)
|
|
93
|
+
return branchFallback;
|
|
94
|
+
throw new CliError({
|
|
95
|
+
exitCode: 4,
|
|
96
|
+
code: "E_IO",
|
|
97
|
+
message: `ENOENT: no such file or directory, open '${readmePath}'`,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export async function loadTaskFromBranchSnapshot(opts) {
|
|
101
|
+
if (opts.ctx.backendId !== "local") {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const branch = await resolveSingleTaskBranch(opts.ctx, opts.taskId);
|
|
105
|
+
if (!branch)
|
|
106
|
+
return null;
|
|
107
|
+
const relReadmePath = toGitPath(path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
|
|
108
|
+
let text = "";
|
|
109
|
+
try {
|
|
110
|
+
text = await gitShowFile(opts.ctx.resolvedProject.gitRoot, branch, relReadmePath);
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const parsed = parseTaskReadme(text);
|
|
116
|
+
const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
|
|
117
|
+
...parsed.frontmatter,
|
|
118
|
+
id: typeof parsed.frontmatter.id === "string" && parsed.frontmatter.id.trim().length > 0
|
|
119
|
+
? parsed.frontmatter.id
|
|
120
|
+
: opts.taskId,
|
|
121
|
+
}));
|
|
122
|
+
return taskRecordToData({
|
|
123
|
+
id: opts.taskId,
|
|
124
|
+
frontmatter: frontmatter,
|
|
125
|
+
body: parsed.body,
|
|
126
|
+
readmePath: opts.readmePath,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async function resolveSingleTaskBranch(ctx, taskId) {
|
|
130
|
+
const prefix = ctx.config.branch.task_prefix;
|
|
131
|
+
const branches = await gitListTaskBranches(ctx.resolvedProject.gitRoot, prefix);
|
|
132
|
+
const matches = branches.filter((branch) => parseTaskIdFromBranch(prefix, branch) === taskId);
|
|
133
|
+
if (matches.length === 1)
|
|
134
|
+
return matches[0] ?? null;
|
|
135
|
+
if (matches.length > 1) {
|
|
77
136
|
throw new CliError({
|
|
78
|
-
exitCode:
|
|
79
|
-
code: "
|
|
80
|
-
message: `
|
|
137
|
+
exitCode: 3,
|
|
138
|
+
code: "E_VALIDATION",
|
|
139
|
+
message: `Multiple task branches match ${taskId}: ${matches.join(", ")}`,
|
|
81
140
|
});
|
|
82
141
|
}
|
|
83
|
-
return
|
|
142
|
+
return null;
|
|
84
143
|
}
|
|
85
144
|
export async function loadBackendTask(opts) {
|
|
86
145
|
const ctx = opts.ctx ??
|
|
@@ -95,16 +154,40 @@ export async function loadBackendTask(opts) {
|
|
|
95
154
|
task,
|
|
96
155
|
};
|
|
97
156
|
}
|
|
98
|
-
export async function
|
|
99
|
-
|
|
100
|
-
|
|
157
|
+
export async function writeTasksOrFallback(backend, tasks) {
|
|
158
|
+
if (tasks.length === 0)
|
|
159
|
+
return;
|
|
160
|
+
if (backend.writeTasks) {
|
|
161
|
+
await backend.writeTasks([...tasks]);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
for (const task of tasks) {
|
|
165
|
+
await backend.writeTask(task);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
export async function listTaskSummariesMemo(ctx) {
|
|
169
|
+
ctx.memo.taskProjection ??= (async () => {
|
|
170
|
+
if (ctx.taskBackend.capabilities?.projection_read_mode === "native") {
|
|
171
|
+
if (!ctx.taskBackend.listProjectionTasks) {
|
|
172
|
+
throw new CliError({
|
|
173
|
+
exitCode: 1,
|
|
174
|
+
code: "E_INTERNAL",
|
|
175
|
+
message: `Backend ${ctx.taskBackend.id} advertises native projection reads but does not implement listProjectionTasks()`,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return await ctx.taskBackend.listProjectionTasks();
|
|
179
|
+
}
|
|
180
|
+
const tasks = await ctx.taskBackend.listTasks();
|
|
181
|
+
return tasks.map((task) => toTaskSummary(task));
|
|
182
|
+
})();
|
|
183
|
+
return await ctx.memo.taskProjection;
|
|
101
184
|
}
|
|
102
185
|
export async function listTaskProjection(ctx) {
|
|
103
|
-
if (ctx.taskBackend.
|
|
104
|
-
return await ctx
|
|
186
|
+
if (ctx.taskBackend.capabilities?.projection_read_mode === "native") {
|
|
187
|
+
return await listTaskSummariesMemo(ctx);
|
|
105
188
|
}
|
|
106
|
-
if (ctx.taskBackend.capabilities
|
|
107
|
-
return await
|
|
189
|
+
if (ctx.taskBackend.capabilities?.reads_from_projection_by_default) {
|
|
190
|
+
return await listTaskSummariesMemo(ctx);
|
|
108
191
|
}
|
|
109
192
|
return null;
|
|
110
193
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type TaskHandoff, type TaskHandoffRunnerNextAction, type TaskHandoffRunnerState } from "@agentplaneorg/core";
|
|
2
|
+
import type { CommandContext } from "./task-backend.js";
|
|
3
|
+
export type TaskHandoffArtifact = TaskHandoff;
|
|
4
|
+
export type TaskHandoffRunnerHint = TaskHandoffRunnerState;
|
|
5
|
+
export type TaskHandoffPaths = {
|
|
6
|
+
handoff_dir: string;
|
|
7
|
+
latest_path: string;
|
|
8
|
+
history_path: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveTaskHandoffPaths(opts: {
|
|
11
|
+
git_root: string;
|
|
12
|
+
workflow_dir: string;
|
|
13
|
+
task_id: string;
|
|
14
|
+
}): TaskHandoffPaths;
|
|
15
|
+
export declare function readTaskHandoffLatest(paths: TaskHandoffPaths): Promise<TaskHandoffArtifact | null>;
|
|
16
|
+
export declare function readTaskHandoffLatestRequired(opts: {
|
|
17
|
+
task_id: string;
|
|
18
|
+
paths: TaskHandoffPaths;
|
|
19
|
+
}): Promise<TaskHandoffArtifact>;
|
|
20
|
+
export declare function writeTaskHandoff(opts: {
|
|
21
|
+
paths: TaskHandoffPaths;
|
|
22
|
+
handoff: TaskHandoffArtifact;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
export declare function currentGitBranch(gitRoot: string): Promise<string | null>;
|
|
25
|
+
export declare function readTaskPrBranch(opts: {
|
|
26
|
+
ctx: CommandContext;
|
|
27
|
+
task_id: string;
|
|
28
|
+
}): Promise<string | null>;
|
|
29
|
+
export declare function readTaskPrMetaSummary(opts: {
|
|
30
|
+
ctx: CommandContext;
|
|
31
|
+
task_id: string;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
branch: string | null;
|
|
34
|
+
base: string | null;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function buildTaskHandoffArtifact(opts: {
|
|
37
|
+
task_id: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
from_role: string;
|
|
40
|
+
to_role?: string | null;
|
|
41
|
+
reason: string;
|
|
42
|
+
note?: string;
|
|
43
|
+
branch?: string | null;
|
|
44
|
+
base_branch?: string | null;
|
|
45
|
+
head_sha?: string | null;
|
|
46
|
+
workspace_root?: string | null;
|
|
47
|
+
pr_branch?: string | null;
|
|
48
|
+
runner?: TaskHandoffRunnerHint | undefined;
|
|
49
|
+
next_actions?: string[] | undefined;
|
|
50
|
+
risks?: string[] | undefined;
|
|
51
|
+
open_questions?: string[] | undefined;
|
|
52
|
+
evidence_paths?: string[] | undefined;
|
|
53
|
+
}): TaskHandoffArtifact;
|
|
54
|
+
export declare function buildRunnerHintCommands(opts: {
|
|
55
|
+
task_id: string;
|
|
56
|
+
run_id: string | null;
|
|
57
|
+
status: string | null;
|
|
58
|
+
}): {
|
|
59
|
+
next_action: TaskHandoffRunnerNextAction;
|
|
60
|
+
next_command: string | null;
|
|
61
|
+
resume_command: string | null;
|
|
62
|
+
retry_command: string | null;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=task-handoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-handoff.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-handoff.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GA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AE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC,GAAG,mBAAmB,CAoBtB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GAAG;IACF,WAAW,EAAE,2BAA2B,CAAC;IACzC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CA8CA"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { appendFile, mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { validateTaskHandoff, } from "@agentplaneorg/core";
|
|
4
|
+
import { CliError } from "../../shared/errors.js";
|
|
5
|
+
import { execFileAsync, gitEnv } from "./git.js";
|
|
6
|
+
import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
|
|
7
|
+
function trimOrNull(value) {
|
|
8
|
+
const trimmed = value?.trim() ?? "";
|
|
9
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
10
|
+
}
|
|
11
|
+
function normalizeStringList(values) {
|
|
12
|
+
if (!values?.length)
|
|
13
|
+
return undefined;
|
|
14
|
+
const normalized = values.map((value) => value.trim()).filter((value) => value.length > 0);
|
|
15
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
16
|
+
}
|
|
17
|
+
export function resolveTaskHandoffPaths(opts) {
|
|
18
|
+
const handoff_dir = path.join(opts.git_root, opts.workflow_dir, opts.task_id, "handoff");
|
|
19
|
+
return {
|
|
20
|
+
handoff_dir,
|
|
21
|
+
latest_path: path.join(handoff_dir, "latest.json"),
|
|
22
|
+
history_path: path.join(handoff_dir, "history.jsonl"),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export async function readTaskHandoffLatest(paths) {
|
|
26
|
+
try {
|
|
27
|
+
const raw = await readFile(paths.latest_path, "utf8");
|
|
28
|
+
return validateTaskHandoff(JSON.parse(raw));
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
const code = err?.code;
|
|
32
|
+
if (code === "ENOENT")
|
|
33
|
+
return null;
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export async function readTaskHandoffLatestRequired(opts) {
|
|
38
|
+
const handoff = await readTaskHandoffLatest(opts.paths);
|
|
39
|
+
if (handoff)
|
|
40
|
+
return handoff;
|
|
41
|
+
throw new CliError({
|
|
42
|
+
exitCode: 4,
|
|
43
|
+
code: "E_IO",
|
|
44
|
+
message: `Task handoff artifact not found for ${opts.task_id} (${opts.paths.latest_path})`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export async function writeTaskHandoff(opts) {
|
|
48
|
+
await mkdir(opts.paths.handoff_dir, { recursive: true });
|
|
49
|
+
await writeJsonStableIfChanged(opts.paths.latest_path, opts.handoff);
|
|
50
|
+
await appendFile(opts.paths.history_path, `${JSON.stringify(opts.handoff)}\n`, "utf8");
|
|
51
|
+
}
|
|
52
|
+
export async function currentGitBranch(gitRoot) {
|
|
53
|
+
try {
|
|
54
|
+
const { stdout } = await execFileAsync("git", ["branch", "--show-current"], {
|
|
55
|
+
cwd: gitRoot,
|
|
56
|
+
env: gitEnv(),
|
|
57
|
+
});
|
|
58
|
+
return trimOrNull(stdout);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export async function readTaskPrBranch(opts) {
|
|
65
|
+
const summary = await readTaskPrMetaSummary(opts);
|
|
66
|
+
return summary.branch;
|
|
67
|
+
}
|
|
68
|
+
export async function readTaskPrMetaSummary(opts) {
|
|
69
|
+
const prMetaPath = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir, opts.task_id, "pr", "meta.json");
|
|
70
|
+
try {
|
|
71
|
+
const raw = JSON.parse(await readFile(prMetaPath, "utf8"));
|
|
72
|
+
return {
|
|
73
|
+
branch: trimOrNull(raw.branch),
|
|
74
|
+
base: trimOrNull(raw.base),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
const code = err?.code;
|
|
79
|
+
if (code === "ENOENT")
|
|
80
|
+
return { branch: null, base: null };
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function buildTaskHandoffArtifact(opts) {
|
|
85
|
+
return validateTaskHandoff({
|
|
86
|
+
schema_version: 1,
|
|
87
|
+
task_id: opts.task_id,
|
|
88
|
+
created_at: opts.created_at,
|
|
89
|
+
from_role: opts.from_role.trim(),
|
|
90
|
+
to_role: trimOrNull(opts.to_role),
|
|
91
|
+
reason: opts.reason.trim(),
|
|
92
|
+
note: trimOrNull(opts.note) ?? undefined,
|
|
93
|
+
branch: trimOrNull(opts.branch),
|
|
94
|
+
base_branch: trimOrNull(opts.base_branch),
|
|
95
|
+
head_sha: trimOrNull(opts.head_sha),
|
|
96
|
+
workspace_root: trimOrNull(opts.workspace_root),
|
|
97
|
+
pr_branch: trimOrNull(opts.pr_branch),
|
|
98
|
+
runner: opts.runner,
|
|
99
|
+
next_actions: normalizeStringList(opts.next_actions),
|
|
100
|
+
risks: normalizeStringList(opts.risks),
|
|
101
|
+
open_questions: normalizeStringList(opts.open_questions),
|
|
102
|
+
evidence_paths: normalizeStringList(opts.evidence_paths),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function buildRunnerHintCommands(opts) {
|
|
106
|
+
const taskRunCommand = `agentplane task run ${opts.task_id}`;
|
|
107
|
+
const resumeCommand = opts.run_id
|
|
108
|
+
? `agentplane task run resume ${opts.task_id} ${opts.run_id}`
|
|
109
|
+
: null;
|
|
110
|
+
const retryCommand = opts.run_id
|
|
111
|
+
? `agentplane task run retry ${opts.task_id} ${opts.run_id}`
|
|
112
|
+
: null;
|
|
113
|
+
if (!opts.run_id || !opts.status) {
|
|
114
|
+
return {
|
|
115
|
+
next_action: "run",
|
|
116
|
+
next_command: taskRunCommand,
|
|
117
|
+
resume_command: null,
|
|
118
|
+
retry_command: null,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (opts.status === "prepared") {
|
|
122
|
+
return {
|
|
123
|
+
next_action: "resume",
|
|
124
|
+
next_command: resumeCommand,
|
|
125
|
+
resume_command: resumeCommand,
|
|
126
|
+
retry_command: retryCommand,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (opts.status === "failed" || opts.status === "cancelled") {
|
|
130
|
+
return {
|
|
131
|
+
next_action: "retry",
|
|
132
|
+
next_command: retryCommand,
|
|
133
|
+
resume_command: resumeCommand,
|
|
134
|
+
retry_command: retryCommand,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (opts.status === "success") {
|
|
138
|
+
return {
|
|
139
|
+
next_action: "none",
|
|
140
|
+
next_command: null,
|
|
141
|
+
resume_command: resumeCommand,
|
|
142
|
+
retry_command: retryCommand,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
next_action: "wait",
|
|
147
|
+
next_command: null,
|
|
148
|
+
resume_command: resumeCommand,
|
|
149
|
+
retry_command: retryCommand,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TaskData, TaskWriteOptions } from "../../backends/task-backend.js";
|
|
2
|
+
import { type CommandContext } from "./task-backend.js";
|
|
3
|
+
import { getTaskStore, type TaskStoreIntentResult } from "./task-store.js";
|
|
4
|
+
export type TaskMutationPlan = {
|
|
5
|
+
intents?: TaskStoreIntentResult;
|
|
6
|
+
nextTask?: TaskData;
|
|
7
|
+
forceWrite?: boolean;
|
|
8
|
+
writeOptions?: TaskWriteOptions;
|
|
9
|
+
};
|
|
10
|
+
export type TaskCollectionMutationPlan<TResult> = {
|
|
11
|
+
tasksToWrite?: readonly TaskData[];
|
|
12
|
+
result: TResult;
|
|
13
|
+
};
|
|
14
|
+
export declare function withTaskMutationStorage<TResult>(opts: {
|
|
15
|
+
ctx: CommandContext;
|
|
16
|
+
local: (store: ReturnType<typeof getTaskStore>) => Promise<TResult> | TResult;
|
|
17
|
+
remote: (backend: CommandContext["taskBackend"]) => Promise<TResult> | TResult;
|
|
18
|
+
}): Promise<TResult>;
|
|
19
|
+
export declare function applyTaskMutation(opts: {
|
|
20
|
+
ctx: CommandContext;
|
|
21
|
+
taskId: string;
|
|
22
|
+
build: (current: TaskData) => Promise<TaskMutationPlan | null | undefined> | TaskMutationPlan | null | undefined;
|
|
23
|
+
writeOptions?: TaskWriteOptions;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
changed: boolean;
|
|
26
|
+
task: TaskData;
|
|
27
|
+
mode: "local-store" | "backend";
|
|
28
|
+
}>;
|
|
29
|
+
export declare function applyTaskCollectionMutation<TResult>(opts: {
|
|
30
|
+
ctx: CommandContext;
|
|
31
|
+
build: (current: TaskData[]) => Promise<TaskCollectionMutationPlan<TResult>> | TaskCollectionMutationPlan<TResult>;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
result: TResult;
|
|
34
|
+
tasksToWrite: TaskData[];
|
|
35
|
+
}>;
|
|
36
|
+
//# sourceMappingURL=task-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-mutation.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAGL,YAAY,EACZ,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,OAAO,IAAI;IAChD,YAAY,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACnC,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,IAAI,EAAE;IAC3D,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC9E,MAAM,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAChF,GAAG,OAAO,CAAC,OAAO,CAAC,CAKnB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CACL,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAC;IACxF,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,aAAa,GAAG,SAAS,CAAA;CAAE,CAAC,CAuDjF;AAED,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,IAAI,EAAE;IAC/D,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,CACL,OAAO,EAAE,QAAQ,EAAE,KAChB,OAAO,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;CACzF,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAQzD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { loadTaskFromContext, writeTasksOrFallback } from "./task-backend.js";
|
|
2
|
+
import { applyTaskStoreIntentsToTask, backendIsLocalFileBackend, getTaskStore, } from "./task-store.js";
|
|
3
|
+
export async function withTaskMutationStorage(opts) {
|
|
4
|
+
if (backendIsLocalFileBackend(opts.ctx)) {
|
|
5
|
+
return await opts.local(getTaskStore(opts.ctx));
|
|
6
|
+
}
|
|
7
|
+
return await opts.remote(opts.ctx.taskBackend);
|
|
8
|
+
}
|
|
9
|
+
export async function applyTaskMutation(opts) {
|
|
10
|
+
if (backendIsLocalFileBackend(opts.ctx)) {
|
|
11
|
+
const store = getTaskStore(opts.ctx);
|
|
12
|
+
const result = await store.update(opts.taskId, async (current) => {
|
|
13
|
+
const plan = await opts.build({ ...current });
|
|
14
|
+
if (!plan)
|
|
15
|
+
return current;
|
|
16
|
+
if (plan.nextTask !== undefined)
|
|
17
|
+
return plan.nextTask;
|
|
18
|
+
if (plan.intents !== undefined) {
|
|
19
|
+
return applyTaskStoreIntentsToTask(current, plan.intents);
|
|
20
|
+
}
|
|
21
|
+
return current;
|
|
22
|
+
}, {
|
|
23
|
+
expectedRevision: opts.writeOptions?.expectedRevision,
|
|
24
|
+
});
|
|
25
|
+
return { ...result, mode: "local-store" };
|
|
26
|
+
}
|
|
27
|
+
const current = await loadTaskFromContext({ ctx: opts.ctx, taskId: opts.taskId });
|
|
28
|
+
let materializedCurrent = current;
|
|
29
|
+
if (opts.ctx.taskBackend.getTaskDoc) {
|
|
30
|
+
const currentDoc = typeof current.doc === "string" && current.doc.length > 0
|
|
31
|
+
? current.doc
|
|
32
|
+
: ((await opts.ctx.taskBackend.getTaskDoc(opts.taskId)) ?? "");
|
|
33
|
+
if (currentDoc !== current.doc) {
|
|
34
|
+
materializedCurrent = { ...current, doc: currentDoc };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const plan = await opts.build({ ...materializedCurrent });
|
|
38
|
+
if (!plan)
|
|
39
|
+
return { changed: false, task: current, mode: "backend" };
|
|
40
|
+
const nextTask = plan.nextTask ??
|
|
41
|
+
(plan.intents === undefined
|
|
42
|
+
? undefined
|
|
43
|
+
: applyTaskStoreIntentsToTask(materializedCurrent, plan.intents));
|
|
44
|
+
if (nextTask === undefined) {
|
|
45
|
+
return { changed: false, task: current, mode: "backend" };
|
|
46
|
+
}
|
|
47
|
+
const changed = JSON.stringify(materializedCurrent) !== JSON.stringify(nextTask);
|
|
48
|
+
if (!changed && plan.forceWrite !== true) {
|
|
49
|
+
return { changed: false, task: nextTask, mode: "backend" };
|
|
50
|
+
}
|
|
51
|
+
const mergedWriteOptions = {};
|
|
52
|
+
if (opts.writeOptions)
|
|
53
|
+
Object.assign(mergedWriteOptions, opts.writeOptions);
|
|
54
|
+
if (plan.writeOptions)
|
|
55
|
+
Object.assign(mergedWriteOptions, plan.writeOptions);
|
|
56
|
+
await opts.ctx.taskBackend.writeTask(nextTask, mergedWriteOptions);
|
|
57
|
+
return { changed, task: nextTask, mode: "backend" };
|
|
58
|
+
}
|
|
59
|
+
export async function applyTaskCollectionMutation(opts) {
|
|
60
|
+
const current = await opts.ctx.taskBackend.listTasks();
|
|
61
|
+
const plan = await opts.build(current.map((task) => ({ ...task })));
|
|
62
|
+
const tasksToWrite = [...(plan.tasksToWrite ?? [])];
|
|
63
|
+
if (tasksToWrite.length > 0) {
|
|
64
|
+
await writeTasksOrFallback(opts.ctx.taskBackend, tasksToWrite);
|
|
65
|
+
}
|
|
66
|
+
return { result: plan.result, tasksToWrite };
|
|
67
|
+
}
|
|
@@ -24,17 +24,80 @@ export type TaskStorePatch = {
|
|
|
24
24
|
version?: 2 | 3;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
export type TaskStoreIntent = {
|
|
28
|
+
kind: "set-task-fields";
|
|
29
|
+
task: TaskStoreTaskPatch;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "append-comments";
|
|
32
|
+
comments: TaskComment[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: "append-events";
|
|
35
|
+
events: TaskEvent[];
|
|
36
|
+
} | {
|
|
37
|
+
kind: "replace-doc";
|
|
38
|
+
doc: string;
|
|
39
|
+
expectedCurrentDoc?: string | null;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "set-section";
|
|
42
|
+
section: string;
|
|
43
|
+
text: string;
|
|
44
|
+
requiredSections: string[];
|
|
45
|
+
expectedCurrentText?: string | null;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "touch-doc-meta";
|
|
48
|
+
updatedBy?: string;
|
|
49
|
+
version?: 2 | 3;
|
|
50
|
+
};
|
|
51
|
+
export type TaskStoreIntentResult = TaskStoreIntent | readonly TaskStoreIntent[] | null | undefined;
|
|
52
|
+
export type TaskStoreMutationOptions = {
|
|
53
|
+
expectedRevision?: number;
|
|
54
|
+
};
|
|
55
|
+
export type TaskStoreLike = Pick<TaskStore, "patch"> & {
|
|
56
|
+
mutate?: TaskStore["mutate"];
|
|
57
|
+
};
|
|
58
|
+
export declare function setTaskFieldsIntent(task: TaskStoreTaskPatch): TaskStoreIntent;
|
|
59
|
+
export declare function appendTaskCommentsIntent(comments: TaskComment[]): TaskStoreIntent;
|
|
60
|
+
export declare function appendTaskCommentIntent(comment: TaskComment): TaskStoreIntent;
|
|
61
|
+
export declare function appendTaskEventsIntent(events: TaskEvent[]): TaskStoreIntent;
|
|
62
|
+
export declare function appendTaskEventIntent(event: TaskEvent): TaskStoreIntent;
|
|
63
|
+
export declare function replaceTaskDocIntent(opts: {
|
|
64
|
+
doc: string;
|
|
65
|
+
expectedCurrentDoc?: string | null;
|
|
66
|
+
}): TaskStoreIntent;
|
|
67
|
+
export declare function setTaskSectionIntent(opts: {
|
|
68
|
+
section: string;
|
|
69
|
+
text: string;
|
|
70
|
+
requiredSections: string[];
|
|
71
|
+
expectedCurrentText?: string | null;
|
|
72
|
+
}): TaskStoreIntent;
|
|
73
|
+
export declare function touchTaskDocMetaIntent(opts?: {
|
|
74
|
+
updatedBy?: string;
|
|
75
|
+
version?: 2 | 3;
|
|
76
|
+
}): TaskStoreIntent;
|
|
77
|
+
export declare function taskStorePatchFromIntents(intents: TaskStoreIntentResult): TaskStorePatch | null | undefined;
|
|
78
|
+
export declare function mutateTaskStore(store: TaskStoreLike, taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
79
|
+
changed: boolean;
|
|
80
|
+
task: TaskData;
|
|
81
|
+
}>;
|
|
82
|
+
export declare function applyTaskStoreIntentsToTask(task: TaskData, intents: TaskStoreIntentResult, opts?: {
|
|
83
|
+
currentDocVersion?: 2 | 3;
|
|
84
|
+
docUpdatedAt?: string;
|
|
85
|
+
}): TaskData;
|
|
27
86
|
export declare class TaskStore {
|
|
28
87
|
private ctx;
|
|
29
88
|
private cache;
|
|
30
89
|
constructor(ctx: CommandContext);
|
|
31
90
|
get(taskId: string): Promise<TaskData>;
|
|
32
91
|
private getCached;
|
|
33
|
-
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData): Promise<{
|
|
92
|
+
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
|
|
93
|
+
changed: boolean;
|
|
94
|
+
task: TaskData;
|
|
95
|
+
}>;
|
|
96
|
+
patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
|
|
34
97
|
changed: boolean;
|
|
35
98
|
task: TaskData;
|
|
36
99
|
}>;
|
|
37
|
-
|
|
100
|
+
mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
38
101
|
changed: boolean;
|
|
39
102
|
task: TaskData;
|
|
40
103
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAC;AAQxC,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUpG,KAAK,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAW7D,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,IAAI,CACF,QAAQ,EACR,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