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
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { normalizeTaskDocVersion } from "@agentplaneorg/core";
|
|
4
|
+
import { CliError } from "../../shared/errors.js";
|
|
5
|
+
import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
|
|
6
|
+
import { execFileAsync } from "../shared/git.js";
|
|
7
|
+
import { parseTaskIdFromBranch } from "../shared/git-worktree.js";
|
|
8
|
+
import { parsePrMeta } from "../shared/pr-meta.js";
|
|
9
|
+
import { appendTaskEvent } from "./shared.js";
|
|
10
|
+
function normalizeMergedPr(value) {
|
|
11
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
12
|
+
return null;
|
|
13
|
+
const record = value;
|
|
14
|
+
const number = typeof record.number === "number" ? record.number : null;
|
|
15
|
+
if (!number || number <= 0)
|
|
16
|
+
return null;
|
|
17
|
+
const mergeCommit = record.mergeCommit &&
|
|
18
|
+
typeof record.mergeCommit === "object" &&
|
|
19
|
+
!Array.isArray(record.mergeCommit)
|
|
20
|
+
? {
|
|
21
|
+
oid: typeof record.mergeCommit.oid === "string"
|
|
22
|
+
? String(record.mergeCommit.oid)
|
|
23
|
+
: null,
|
|
24
|
+
}
|
|
25
|
+
: null;
|
|
26
|
+
return {
|
|
27
|
+
number,
|
|
28
|
+
title: typeof record.title === "string" ? record.title : null,
|
|
29
|
+
url: typeof record.url === "string" ? record.url : null,
|
|
30
|
+
mergedAt: typeof record.mergedAt === "string" ? record.mergedAt : null,
|
|
31
|
+
baseRefName: typeof record.baseRefName === "string" ? record.baseRefName : null,
|
|
32
|
+
headRefName: typeof record.headRefName === "string" ? record.headRefName : null,
|
|
33
|
+
headRefOid: typeof record.headRefOid === "string" ? record.headRefOid : null,
|
|
34
|
+
mergeCommit,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function normalizePullRequestLike(value) {
|
|
38
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
39
|
+
return null;
|
|
40
|
+
const record = value;
|
|
41
|
+
if (record.merged !== true)
|
|
42
|
+
return null;
|
|
43
|
+
const number = typeof record.number === "number" ? record.number : null;
|
|
44
|
+
const mergeCommitSha = typeof record.merge_commit_sha === "string" && record.merge_commit_sha.trim().length > 0
|
|
45
|
+
? record.merge_commit_sha.trim()
|
|
46
|
+
: null;
|
|
47
|
+
const head = record.head && typeof record.head === "object" && !Array.isArray(record.head)
|
|
48
|
+
? record.head
|
|
49
|
+
: null;
|
|
50
|
+
const base = record.base && typeof record.base === "object" && !Array.isArray(record.base)
|
|
51
|
+
? record.base
|
|
52
|
+
: null;
|
|
53
|
+
const headRefName = typeof head?.ref === "string" ? head.ref : null;
|
|
54
|
+
const headRefOid = typeof head?.sha === "string" ? head.sha : null;
|
|
55
|
+
const baseRefName = typeof base?.ref === "string" ? base.ref : null;
|
|
56
|
+
if (!number || number <= 0 || !mergeCommitSha || !headRefName)
|
|
57
|
+
return null;
|
|
58
|
+
return {
|
|
59
|
+
number,
|
|
60
|
+
title: typeof record.title === "string" ? record.title : null,
|
|
61
|
+
url: typeof record.html_url === "string" ? record.html_url : null,
|
|
62
|
+
mergedAt: typeof record.merged_at === "string" ? record.merged_at : null,
|
|
63
|
+
baseRefName,
|
|
64
|
+
headRefName,
|
|
65
|
+
headRefOid,
|
|
66
|
+
mergeCommit: { oid: mergeCommitSha },
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function pickHostedMergedPr(records) {
|
|
70
|
+
const merged = records
|
|
71
|
+
.map((record) => normalizeMergedPr(record))
|
|
72
|
+
.filter((record) => !!record && !!record.mergeCommit?.oid);
|
|
73
|
+
if (merged.length === 0)
|
|
74
|
+
return null;
|
|
75
|
+
return (merged.toSorted((a, b) => {
|
|
76
|
+
const left = a.mergedAt ?? "";
|
|
77
|
+
const right = b.mergedAt ?? "";
|
|
78
|
+
return right.localeCompare(left);
|
|
79
|
+
})[0] ?? null);
|
|
80
|
+
}
|
|
81
|
+
export function resolveHostedMergeTargetFromEvent(opts) {
|
|
82
|
+
if (!opts.event || typeof opts.event !== "object" || Array.isArray(opts.event))
|
|
83
|
+
return null;
|
|
84
|
+
const pullRequest = opts.event.pull_request;
|
|
85
|
+
const mergedPr = normalizePullRequestLike(pullRequest);
|
|
86
|
+
if (!mergedPr?.headRefName || !mergedPr.mergeCommit?.oid)
|
|
87
|
+
return null;
|
|
88
|
+
const taskId = parseTaskIdFromBranch(opts.branchPrefix, mergedPr.headRefName);
|
|
89
|
+
if (!taskId)
|
|
90
|
+
return null;
|
|
91
|
+
return {
|
|
92
|
+
taskId,
|
|
93
|
+
branch: mergedPr.headRefName,
|
|
94
|
+
mergedPr,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function resolveHostedMergedPr(opts) {
|
|
98
|
+
const { stdout } = await execFileAsync("gh", [
|
|
99
|
+
"pr",
|
|
100
|
+
"list",
|
|
101
|
+
"--state",
|
|
102
|
+
"merged",
|
|
103
|
+
"--head",
|
|
104
|
+
opts.branch,
|
|
105
|
+
"--json",
|
|
106
|
+
"number,title,url,mergedAt,baseRefName,headRefName,headRefOid,mergeCommit",
|
|
107
|
+
], {
|
|
108
|
+
cwd: opts.cwd,
|
|
109
|
+
env: process.env,
|
|
110
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
111
|
+
});
|
|
112
|
+
const parsed = JSON.parse(stdout);
|
|
113
|
+
return Array.isArray(parsed) ? pickHostedMergedPr(parsed) : null;
|
|
114
|
+
}
|
|
115
|
+
function buildSyncedPrMeta(opts) {
|
|
116
|
+
const at = opts.mergedPr.mergedAt ?? new Date().toISOString();
|
|
117
|
+
return {
|
|
118
|
+
...opts.meta,
|
|
119
|
+
branch: opts.branch,
|
|
120
|
+
status: "MERGED",
|
|
121
|
+
base: opts.mergedPr.baseRefName ?? opts.meta.base,
|
|
122
|
+
merge_strategy: opts.meta.merge_strategy,
|
|
123
|
+
merged_at: opts.meta.merged_at ?? at,
|
|
124
|
+
merge_commit: opts.mergedPr.mergeCommit?.oid ?? opts.meta.merge_commit,
|
|
125
|
+
head_sha: opts.mergedPr.headRefOid ?? opts.meta.head_sha,
|
|
126
|
+
updated_at: at,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function buildSyncedTask(opts) {
|
|
130
|
+
const at = opts.mergedPr.mergedAt ?? new Date().toISOString();
|
|
131
|
+
const currentStatus = String(opts.task.status || "TODO").toUpperCase();
|
|
132
|
+
const note = `Hosted PR #${opts.mergedPr.number} merged on GitHub main; ` +
|
|
133
|
+
"task projection reconciled from hosted PR artifacts.";
|
|
134
|
+
const statusEvent = {
|
|
135
|
+
type: "status",
|
|
136
|
+
at,
|
|
137
|
+
author: "INTEGRATOR",
|
|
138
|
+
from: currentStatus,
|
|
139
|
+
to: "DONE",
|
|
140
|
+
note,
|
|
141
|
+
};
|
|
142
|
+
const mergeHash = opts.mergedPr.mergeCommit?.oid ?? "";
|
|
143
|
+
const mergeMessage = opts.mergedPr.title?.trim();
|
|
144
|
+
return {
|
|
145
|
+
...opts.task,
|
|
146
|
+
status: "DONE",
|
|
147
|
+
result_summary: opts.task.result_summary ?? `Merged via PR #${opts.mergedPr.number}.`,
|
|
148
|
+
commit: opts.task.commit?.hash?.trim()
|
|
149
|
+
? opts.task.commit
|
|
150
|
+
: mergeHash
|
|
151
|
+
? {
|
|
152
|
+
hash: mergeHash,
|
|
153
|
+
message: (mergeMessage && mergeMessage.length > 0 ? mergeMessage : null) ??
|
|
154
|
+
`Hosted PR #${opts.mergedPr.number} merged on GitHub main`,
|
|
155
|
+
}
|
|
156
|
+
: null,
|
|
157
|
+
events: appendTaskEvent(opts.task, statusEvent),
|
|
158
|
+
doc_version: normalizeTaskDocVersion(opts.task.doc_version),
|
|
159
|
+
doc_updated_at: at,
|
|
160
|
+
doc_updated_by: "INTEGRATOR",
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
async function readPrMetaIfPresent(opts) {
|
|
164
|
+
const metaPath = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir, opts.taskId, "pr", "meta.json");
|
|
165
|
+
try {
|
|
166
|
+
const raw = await readFile(metaPath, "utf8");
|
|
167
|
+
return { meta: parsePrMeta(raw, opts.taskId), metaPath };
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function needsHostedMergeSync(opts) {
|
|
174
|
+
const currentStatus = String(opts.task.status || "TODO").toUpperCase();
|
|
175
|
+
const expectedCommit = opts.mergedPr.mergeCommit?.oid ?? "";
|
|
176
|
+
const expectedBase = opts.mergedPr.baseRefName ?? opts.meta.base ?? "";
|
|
177
|
+
const expectedHeadSha = opts.mergedPr.headRefOid ?? opts.meta.head_sha ?? "";
|
|
178
|
+
if (currentStatus !== "DONE")
|
|
179
|
+
return true;
|
|
180
|
+
if ((opts.task.commit?.hash ?? "") !== expectedCommit)
|
|
181
|
+
return true;
|
|
182
|
+
if (opts.meta.status !== "MERGED")
|
|
183
|
+
return true;
|
|
184
|
+
if ((opts.meta.merge_commit ?? "") !== expectedCommit)
|
|
185
|
+
return true;
|
|
186
|
+
if ((opts.meta.branch ?? "") !== opts.branch)
|
|
187
|
+
return true;
|
|
188
|
+
if ((opts.meta.base ?? "") !== expectedBase)
|
|
189
|
+
return true;
|
|
190
|
+
if (opts.meta.head_sha?.trim() !== expectedHeadSha)
|
|
191
|
+
return true;
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
export async function syncHostedMergedTask(opts) {
|
|
195
|
+
if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
|
|
196
|
+
return { tasks: opts.tasks, synced: 0 };
|
|
197
|
+
}
|
|
198
|
+
const task = opts.tasks.find((entry) => entry.id === opts.target.taskId);
|
|
199
|
+
if (!task) {
|
|
200
|
+
if (opts.missingTask === "error") {
|
|
201
|
+
throw new CliError({
|
|
202
|
+
exitCode: 3,
|
|
203
|
+
code: "E_VALIDATION",
|
|
204
|
+
message: `Hosted task closure could not find task artifact: ${opts.target.taskId}`,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return { tasks: opts.tasks, synced: 0 };
|
|
208
|
+
}
|
|
209
|
+
const prMetaRecord = await readPrMetaIfPresent({ ctx: opts.ctx, taskId: opts.target.taskId });
|
|
210
|
+
if (!prMetaRecord) {
|
|
211
|
+
if (opts.missingPrMeta === "error") {
|
|
212
|
+
throw new CliError({
|
|
213
|
+
exitCode: 3,
|
|
214
|
+
code: "E_VALIDATION",
|
|
215
|
+
message: `Hosted task closure could not find pr/meta.json for ${opts.target.taskId}`,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return { tasks: opts.tasks, synced: 0 };
|
|
219
|
+
}
|
|
220
|
+
if (!needsHostedMergeSync({
|
|
221
|
+
task,
|
|
222
|
+
meta: prMetaRecord.meta,
|
|
223
|
+
mergedPr: opts.target.mergedPr,
|
|
224
|
+
branch: opts.target.branch,
|
|
225
|
+
})) {
|
|
226
|
+
return { tasks: opts.tasks, synced: 0 };
|
|
227
|
+
}
|
|
228
|
+
const nextMeta = buildSyncedPrMeta({
|
|
229
|
+
meta: prMetaRecord.meta,
|
|
230
|
+
mergedPr: opts.target.mergedPr,
|
|
231
|
+
branch: opts.target.branch,
|
|
232
|
+
});
|
|
233
|
+
await writeJsonStableIfChanged(prMetaRecord.metaPath, nextMeta);
|
|
234
|
+
return {
|
|
235
|
+
tasks: opts.tasks.map((entry) => entry.id === opts.target.taskId
|
|
236
|
+
? buildSyncedTask({ task: entry, mergedPr: opts.target.mergedPr })
|
|
237
|
+
: entry),
|
|
238
|
+
synced: 1,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export async function syncHostedMergedTasks(opts) {
|
|
242
|
+
if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
|
|
243
|
+
return { tasks: opts.tasks, synced: 0 };
|
|
244
|
+
}
|
|
245
|
+
const nextTasks = [];
|
|
246
|
+
let synced = 0;
|
|
247
|
+
for (const task of opts.tasks) {
|
|
248
|
+
const prMetaRecord = await readPrMetaIfPresent({ ctx: opts.ctx, taskId: task.id });
|
|
249
|
+
if (!prMetaRecord) {
|
|
250
|
+
nextTasks.push(task);
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const branch = prMetaRecord.meta.branch?.trim() ?? "";
|
|
254
|
+
if (!branch) {
|
|
255
|
+
nextTasks.push(task);
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const mergedPr = await resolveHostedMergedPr({
|
|
259
|
+
cwd: opts.ctx.resolvedProject.gitRoot,
|
|
260
|
+
branch,
|
|
261
|
+
});
|
|
262
|
+
if (!mergedPr?.mergeCommit?.oid) {
|
|
263
|
+
nextTasks.push(task);
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const syncedTask = await syncHostedMergedTask({
|
|
267
|
+
ctx: opts.ctx,
|
|
268
|
+
tasks: [task],
|
|
269
|
+
target: { taskId: task.id, branch, mergedPr },
|
|
270
|
+
missingTask: "noop",
|
|
271
|
+
missingPrMeta: "noop",
|
|
272
|
+
});
|
|
273
|
+
nextTasks.push(syncedTask.tasks[0] ?? task);
|
|
274
|
+
synced += syncedTask.synced;
|
|
275
|
+
}
|
|
276
|
+
return { tasks: nextTasks, synced };
|
|
277
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}
|
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
import { mapBackendError } from "../../cli/error-map.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { listTaskSummariesMemo, loadCommandContext, } from "../shared/task-backend.js";
|
|
3
|
+
import { formatTaskLine, handleTaskListWarnings, queryTaskProjection, } from "./shared.js";
|
|
4
4
|
export async function cmdTaskListWithFilters(opts) {
|
|
5
5
|
try {
|
|
6
6
|
const ctx = opts.ctx ??
|
|
7
7
|
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
8
|
-
const tasks = await
|
|
8
|
+
const tasks = await listTaskSummariesMemo(ctx);
|
|
9
9
|
handleTaskListWarnings({ backend: ctx.taskBackend, strictRead: opts.filters.strictRead });
|
|
10
|
-
const depState =
|
|
11
|
-
|
|
12
|
-
if (opts.filters.status.length > 0) {
|
|
13
|
-
const wanted = new Set(opts.filters.status.map((s) => s.trim().toUpperCase()));
|
|
14
|
-
filtered = filtered.filter((task) => wanted.has(String(task.status || "TODO").toUpperCase()));
|
|
15
|
-
}
|
|
16
|
-
if (opts.filters.owner.length > 0) {
|
|
17
|
-
const wanted = new Set(opts.filters.owner.map((o) => o.trim().toUpperCase()));
|
|
18
|
-
filtered = filtered.filter((task) => wanted.has(String(task.owner || "").toUpperCase()));
|
|
19
|
-
}
|
|
20
|
-
if (opts.filters.tag.length > 0) {
|
|
21
|
-
const wanted = new Set(opts.filters.tag.map((t) => t.trim()).filter(Boolean));
|
|
22
|
-
filtered = filtered.filter((task) => {
|
|
23
|
-
const tags = dedupeStrings(toStringArray(task.tags));
|
|
24
|
-
return tags.some((tag) => wanted.has(tag));
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const sorted = filtered.toSorted((a, b) => a.id.localeCompare(b.id));
|
|
28
|
-
for (const task of sorted) {
|
|
10
|
+
const { depState, items } = queryTaskProjection({ tasks, filters: opts.filters });
|
|
11
|
+
for (const task of items) {
|
|
29
12
|
process.stdout.write(`${formatTaskLine(task, depState.get(task.id))}\n`);
|
|
30
13
|
}
|
|
31
14
|
if (!opts.filters.quiet) {
|
|
32
15
|
const counts = {};
|
|
33
|
-
for (const task of
|
|
16
|
+
for (const task of items) {
|
|
34
17
|
const status = String(task.status || "TODO").toUpperCase();
|
|
35
18
|
counts[status] = (counts[status] ?? 0) + 1;
|
|
36
19
|
}
|
|
37
|
-
const total =
|
|
20
|
+
const total = items.length;
|
|
38
21
|
const summary = Object.keys(counts)
|
|
39
22
|
.toSorted()
|
|
40
23
|
.map((key) => `${key}=${counts[key]}`)
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import { resolveProject, type AgentplaneConfig } from "@agentplaneorg/core";
|
|
2
|
+
import { type CommandContext } from "../shared/task-backend.js";
|
|
3
|
+
export type TaskDocMigrationResult = {
|
|
4
|
+
changed: number;
|
|
5
|
+
changedPaths: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function migrateTaskDocsInWorkspace(opts: {
|
|
8
|
+
cwd: string;
|
|
9
|
+
rootOverride?: string | null;
|
|
10
|
+
all: boolean;
|
|
11
|
+
taskIds: string[];
|
|
12
|
+
resolvedProject?: Awaited<ReturnType<typeof resolveProject>>;
|
|
13
|
+
config?: AgentplaneConfig;
|
|
14
|
+
ctx?: CommandContext;
|
|
15
|
+
}): Promise<TaskDocMigrationResult>;
|
|
1
16
|
export declare function cmdTaskMigrateDoc(opts: {
|
|
2
17
|
cwd: string;
|
|
3
18
|
rootOverride?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-doc.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate-doc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate-doc.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate-doc.ts"],"names":[],"mappings":"AAGA,OAAO,EAUL,cAAc,EAGd,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAanC,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA+TF,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;IAC7D,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,GAAG,CAAC,EAAE,cAAc,CAAC;CACtB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA4DlC;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlB"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { readdir, readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { atomicWriteFile, ensureDocSections, extractTaskDoc, loadConfig, mergeTaskDoc, normalizeTaskDoc, parseTaskReadme, renderTaskReadme, resolveProject, setMarkdownSection, } from "@agentplaneorg/core";
|
|
3
|
+
import { atomicWriteFile, ensureDocSections, extractTaskDoc, loadConfig, mergeTaskDoc, normalizeTaskDoc, parseTaskReadme, renderTaskDocFromSections, renderTaskReadme, resolveProject, setMarkdownSection, taskDocToSectionMap, } from "@agentplaneorg/core";
|
|
4
4
|
import { mapCoreError } from "../../cli/error-map.js";
|
|
5
5
|
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
6
6
|
import { fileExists, getPathKind } from "../../cli/fs-utils.js";
|
|
7
7
|
import { successMessage } from "../../cli/output.js";
|
|
8
8
|
import { CliError } from "../../shared/errors.js";
|
|
9
|
-
import {
|
|
9
|
+
import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
10
|
+
import { exportTaskProjectionSnapshot, loadCommandContext, } from "../shared/task-backend.js";
|
|
10
11
|
import { extractDocSection, extractTaskObservationSection, decodeEscapedTaskTextNewlines, normalizeTaskDocVersion, normalizeVerificationSectionLayout, } from "./shared/docs.js";
|
|
11
12
|
import { defaultTaskDocV3 } from "./doc-template.js";
|
|
12
13
|
const V3_CANONICAL_ORDER = [
|
|
@@ -22,6 +23,21 @@ const HUMAN_TEXT_SECTIONS = new Set(["summary", "context", "scope", "plan", "fin
|
|
|
22
23
|
function isRecord(value) {
|
|
23
24
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
24
25
|
}
|
|
26
|
+
function normalizeRevision(value) {
|
|
27
|
+
return Number.isInteger(value) && typeof value === "number" && value > 0 ? value : null;
|
|
28
|
+
}
|
|
29
|
+
function normalizeCanonicalSections(value) {
|
|
30
|
+
if (!isRecord(value))
|
|
31
|
+
return null;
|
|
32
|
+
const out = {};
|
|
33
|
+
for (const [title, text] of Object.entries(value)) {
|
|
34
|
+
const normalizedTitle = title.trim();
|
|
35
|
+
if (!normalizedTitle || typeof text !== "string")
|
|
36
|
+
continue;
|
|
37
|
+
out[normalizedTitle] = text.replaceAll("\r\n", "\n").trimEnd();
|
|
38
|
+
}
|
|
39
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
40
|
+
}
|
|
25
41
|
function normalizeSectionKey(section) {
|
|
26
42
|
return section.trim().replaceAll(/\s+/g, " ").toLowerCase();
|
|
27
43
|
}
|
|
@@ -177,9 +193,12 @@ async function migrateTaskReadmeDoc(opts) {
|
|
|
177
193
|
ensurePlanApprovalFrontmatter(frontmatter);
|
|
178
194
|
ensureVerificationFrontmatter(frontmatter);
|
|
179
195
|
normalizeFrontmatterNoteTimestamps(frontmatter);
|
|
196
|
+
const canonicalSections = normalizeCanonicalSections(frontmatter.sections);
|
|
180
197
|
const required = opts.config.tasks.doc.required_sections;
|
|
181
198
|
const extracted = extractTaskDoc(parsed.body);
|
|
182
|
-
const baseDoc =
|
|
199
|
+
const baseDoc = canonicalSections === null
|
|
200
|
+
? extracted || parsed.body
|
|
201
|
+
: renderTaskDocFromSections(canonicalSections);
|
|
183
202
|
let nextDoc = normalizeTaskDoc(ensureDocSections(baseDoc, required));
|
|
184
203
|
const docVersion = normalizeTaskDocVersion(frontmatter.doc_version);
|
|
185
204
|
if (docVersion === 2) {
|
|
@@ -202,6 +221,8 @@ async function migrateTaskReadmeDoc(opts) {
|
|
|
202
221
|
}
|
|
203
222
|
}
|
|
204
223
|
const nextBody = extracted ? mergeTaskDoc(parsed.body, nextDoc) : nextDoc;
|
|
224
|
+
frontmatter.sections = taskDocToSectionMap(nextDoc);
|
|
225
|
+
frontmatter.revision = normalizeRevision(frontmatter.revision) ?? 1;
|
|
205
226
|
const rendered = renderTaskReadme(frontmatter, nextBody);
|
|
206
227
|
const next = rendered.endsWith("\n") ? rendered : `${rendered}\n`;
|
|
207
228
|
if (next === original)
|
|
@@ -226,48 +247,118 @@ async function resolveReadmePaths(opts) {
|
|
|
226
247
|
}
|
|
227
248
|
return out;
|
|
228
249
|
}
|
|
229
|
-
|
|
230
|
-
|
|
250
|
+
async function exportProjectionSnapshotIfChanged(opts) {
|
|
251
|
+
if (!(opts.ctx.taskBackend.exportProjectionSnapshot || opts.ctx.taskBackend.exportTasksJson)) {
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
const relOutputPath = opts.tasksPath.replaceAll("\\", "/");
|
|
255
|
+
const outputPath = path.join(opts.resolvedGitRoot, relOutputPath);
|
|
256
|
+
let before = null;
|
|
257
|
+
try {
|
|
258
|
+
before = await readFile(outputPath, "utf8");
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
before = null;
|
|
262
|
+
}
|
|
263
|
+
await exportTaskProjectionSnapshot({ ctx: opts.ctx, outputPath });
|
|
264
|
+
let after = null;
|
|
231
265
|
try {
|
|
232
|
-
|
|
266
|
+
after = await readFile(outputPath, "utf8");
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
after = null;
|
|
270
|
+
}
|
|
271
|
+
if (before === after)
|
|
272
|
+
return [];
|
|
273
|
+
return (await canStageGitPath(opts.resolvedGitRoot, relOutputPath)) ? [relOutputPath] : [];
|
|
274
|
+
}
|
|
275
|
+
async function canStageGitPath(gitRoot, relPath) {
|
|
276
|
+
try {
|
|
277
|
+
await execFileAsync("git", ["ls-files", "--error-unmatch", "--", relPath], {
|
|
278
|
+
cwd: gitRoot,
|
|
279
|
+
env: gitEnv(),
|
|
280
|
+
});
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
// Continue below: untracked paths may still be stageable when they are not ignored.
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
await execFileAsync("git", ["check-ignore", "--quiet", "--", relPath], {
|
|
288
|
+
cwd: gitRoot,
|
|
289
|
+
env: gitEnv(),
|
|
290
|
+
});
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
export async function migrateTaskDocsInWorkspace(opts) {
|
|
298
|
+
const resolved = opts.resolvedProject ??
|
|
299
|
+
(await resolveProject({
|
|
233
300
|
cwd: opts.cwd,
|
|
234
301
|
rootOverride: opts.rootOverride ?? null,
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
|
|
302
|
+
}));
|
|
303
|
+
let config = opts.config;
|
|
304
|
+
if (!config) {
|
|
305
|
+
const loadedConfig = await loadConfig(resolved.agentplaneDir);
|
|
306
|
+
config = loadedConfig.config;
|
|
307
|
+
}
|
|
308
|
+
const ctx = opts.ctx ??
|
|
309
|
+
(await loadCommandContext({
|
|
238
310
|
cwd: opts.cwd,
|
|
239
311
|
rootOverride: opts.rootOverride ?? null,
|
|
240
312
|
resolvedProject: resolved,
|
|
241
|
-
config
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (!(await fileExists(readmePath))) {
|
|
248
|
-
const taskId = path.basename(path.dirname(readmePath));
|
|
249
|
-
throw new CliError({
|
|
250
|
-
exitCode: exitCodeForError("E_IO"),
|
|
251
|
-
code: "E_IO",
|
|
252
|
-
message: `Task README not found: ${taskId}`,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
let changed = 0;
|
|
313
|
+
config,
|
|
314
|
+
}));
|
|
315
|
+
const params = { all: opts.all, quiet: false, taskIds: opts.taskIds };
|
|
316
|
+
const tasksDir = path.join(resolved.gitRoot, config.paths.workflow_dir);
|
|
317
|
+
const readmePaths = await resolveReadmePaths({ tasksDir, params });
|
|
318
|
+
if (!opts.all) {
|
|
258
319
|
for (const readmePath of readmePaths) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
320
|
+
if (!(await fileExists(readmePath))) {
|
|
321
|
+
const taskId = path.basename(path.dirname(readmePath));
|
|
322
|
+
throw new CliError({
|
|
323
|
+
exitCode: exitCodeForError("E_IO"),
|
|
324
|
+
code: "E_IO",
|
|
325
|
+
message: `Task README not found: ${taskId}`,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
262
328
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
329
|
+
}
|
|
330
|
+
let changed = 0;
|
|
331
|
+
const changedPaths = [];
|
|
332
|
+
for (const readmePath of readmePaths) {
|
|
333
|
+
const res = await migrateTaskReadmeDoc({ readmePath, config });
|
|
334
|
+
if (!res.changed)
|
|
335
|
+
continue;
|
|
336
|
+
changed += 1;
|
|
337
|
+
const relReadmePath = path.relative(resolved.gitRoot, readmePath).replaceAll("\\", "/");
|
|
338
|
+
if (await canStageGitPath(resolved.gitRoot, relReadmePath)) {
|
|
339
|
+
changedPaths.push(relReadmePath);
|
|
268
340
|
}
|
|
341
|
+
}
|
|
342
|
+
if (changed > 0) {
|
|
343
|
+
changedPaths.push(...(await exportProjectionSnapshotIfChanged({
|
|
344
|
+
ctx,
|
|
345
|
+
resolvedGitRoot: resolved.gitRoot,
|
|
346
|
+
tasksPath: config.paths.tasks_path,
|
|
347
|
+
})));
|
|
348
|
+
}
|
|
349
|
+
return { changed, changedPaths: [...new Set(changedPaths)] };
|
|
350
|
+
}
|
|
351
|
+
export async function cmdTaskMigrateDoc(opts) {
|
|
352
|
+
const params = { all: opts.all, quiet: opts.quiet, taskIds: opts.taskIds };
|
|
353
|
+
try {
|
|
354
|
+
const result = await migrateTaskDocsInWorkspace({
|
|
355
|
+
cwd: opts.cwd,
|
|
356
|
+
rootOverride: opts.rootOverride ?? null,
|
|
357
|
+
all: params.all,
|
|
358
|
+
taskIds: params.taskIds,
|
|
359
|
+
});
|
|
269
360
|
if (!params.quiet) {
|
|
270
|
-
process.stdout.write(`${successMessage("migrated task docs", undefined, `changed=${changed}`)}\n`);
|
|
361
|
+
process.stdout.write(`${successMessage("migrated task docs", undefined, `changed=${result.changed}`)}\n`);
|
|
271
362
|
}
|
|
272
363
|
return 0;
|
|
273
364
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"AAOA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAcpF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAmDF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsGlB"}
|
|
@@ -2,6 +2,7 @@ import { setMarkdownSection } from "@agentplaneorg/core";
|
|
|
2
2
|
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
3
|
import { backendNotSupportedMessage, warnMessage } from "../../cli/output.js";
|
|
4
4
|
import { CliError } from "../../shared/errors.js";
|
|
5
|
+
import { buildTaskDocState } from "../../shared/task-doc-state.js";
|
|
5
6
|
import { loadCommandContext } from "../shared/task-backend.js";
|
|
6
7
|
import { ensureTaskDependsOnGraphIsAcyclic, nowIso, requiresVerifyStepsByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared.js";
|
|
7
8
|
import { buildDefaultVerifyStepsSection, defaultTaskDocV3, TASK_DOC_VERSION_V3, } from "./doc-template.js";
|
|
@@ -66,6 +67,13 @@ export async function runTaskNewParsed(opts) {
|
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
const taskId = await ctx.taskBackend.generateTaskId({ length: suffixLength, attempts: 1000 });
|
|
70
|
+
const docState = buildTaskDocState({
|
|
71
|
+
doc: defaultTaskDocV3({ title: p.title, description: p.description }),
|
|
72
|
+
owner: p.owner,
|
|
73
|
+
updatedBy: p.owner,
|
|
74
|
+
version: TASK_DOC_VERSION_V3,
|
|
75
|
+
updatedAt: nowIso(),
|
|
76
|
+
});
|
|
69
77
|
const task = {
|
|
70
78
|
id: taskId,
|
|
71
79
|
title: p.title,
|
|
@@ -73,15 +81,17 @@ export async function runTaskNewParsed(opts) {
|
|
|
73
81
|
status: "TODO",
|
|
74
82
|
priority: p.priority,
|
|
75
83
|
owner: p.owner,
|
|
84
|
+
revision: 1,
|
|
85
|
+
origin: { system: "manual" },
|
|
76
86
|
tags: p.tags,
|
|
77
87
|
depends_on: p.dependsOn,
|
|
78
88
|
verify: p.verify,
|
|
79
89
|
comments: [],
|
|
80
|
-
doc_version:
|
|
81
|
-
doc_updated_at:
|
|
82
|
-
doc_updated_by:
|
|
90
|
+
doc_version: docState.doc_version,
|
|
91
|
+
doc_updated_at: docState.doc_updated_at,
|
|
92
|
+
doc_updated_by: docState.doc_updated_by,
|
|
83
93
|
id_source: "generated",
|
|
84
|
-
doc:
|
|
94
|
+
doc: docState.doc,
|
|
85
95
|
};
|
|
86
96
|
const spikeTag = (ctx.config.tasks.verify.spike_tag ?? "spike").trim().toLowerCase();
|
|
87
97
|
const primary = resolvePrimaryTag(p.tags, ctx);
|
|
@@ -107,6 +117,18 @@ export async function runTaskNewParsed(opts) {
|
|
|
107
117
|
if (hasSpike && hasImplementationTags) {
|
|
108
118
|
process.stderr.write(`${warnMessage("spike is combined with a primary tag that requires verify steps; consider splitting spike vs implementation tasks")}\n`);
|
|
109
119
|
}
|
|
120
|
+
const normalizedDoc = buildTaskDocState({
|
|
121
|
+
doc: task.doc ?? "",
|
|
122
|
+
owner: p.owner,
|
|
123
|
+
updatedBy: task.doc_updated_by,
|
|
124
|
+
version: TASK_DOC_VERSION_V3,
|
|
125
|
+
updatedAt: task.doc_updated_at,
|
|
126
|
+
});
|
|
127
|
+
task.doc = normalizedDoc.doc;
|
|
128
|
+
task.sections = normalizedDoc.sections;
|
|
129
|
+
task.doc_version = normalizedDoc.doc_version;
|
|
130
|
+
task.doc_updated_at = normalizedDoc.doc_updated_at;
|
|
131
|
+
task.doc_updated_by = normalizedDoc.doc_updated_by;
|
|
110
132
|
await ctx.taskBackend.writeTask(task);
|
|
111
133
|
process.stdout.write(`${taskId}\n`);
|
|
112
134
|
return 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/commands/task/next.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/commands/task/next.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlB"}
|