agentplane 0.3.9 → 0.3.11
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 +4 -2
- package/assets/agents/CODER.json +1 -1
- package/assets/policy/dod.core.md +1 -1
- package/assets/policy/governance.md +5 -3
- package/assets/policy/incidents.md +19 -77
- package/assets/policy/workflow.branch_pr.md +2 -0
- package/assets/policy/workflow.direct.md +3 -1
- package/bin/agentplane.js +56 -1
- package/bin/runtime-watch.js +1 -0
- package/bin/stale-dist-policy.d.ts +1 -1
- package/bin/stale-dist-policy.js +13 -0
- package/dist/.build-manifest.json +462 -202
- package/dist/cli/bootstrap-guide.d.ts +1 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +20 -1
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +2 -1
- package/dist/cli/command-invocations.d.ts.map +1 -1
- package/dist/cli/command-invocations.js +6 -1
- package/dist/cli/command-snippets.d.ts +2 -0
- package/dist/cli/command-snippets.d.ts.map +1 -1
- package/dist/cli/command-snippets.js +2 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +10 -0
- 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 +3 -1
- 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 +10 -0
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +13 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core/preflight.js +44 -1
- package/dist/cli/run-cli.js +2 -2
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +12 -0
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +4 -0
- package/dist/commands/branch/cleanup-merged.d.ts +2 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +132 -28
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +60 -1
- package/dist/commands/cleanup/merged.command.d.ts +2 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +24 -0
- package/dist/commands/doctor/branch-pr.d.ts +4 -0
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
- package/dist/commands/doctor/branch-pr.js +96 -0
- package/dist/commands/doctor/fixes.d.ts +5 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +70 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +6 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +11 -0
- package/dist/commands/finish.spec.d.ts +11 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +51 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
- package/dist/commands/guard/impl/close-message.js +23 -6
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +24 -2
- package/dist/commands/guard/impl/env.d.ts +1 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +1 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +98 -1
- package/dist/commands/incidents/advise.command.d.ts +15 -0
- package/dist/commands/incidents/advise.command.d.ts.map +1 -0
- package/dist/commands/incidents/advise.command.js +139 -0
- package/dist/commands/incidents/collect.command.d.ts +11 -0
- package/dist/commands/incidents/collect.command.d.ts.map +1 -0
- package/dist/commands/incidents/collect.command.js +72 -0
- package/dist/commands/incidents/incidents.command.d.ts +5 -0
- package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
- package/dist/commands/incidents/incidents.command.js +21 -0
- package/dist/commands/incidents/shared.d.ts +76 -0
- package/dist/commands/incidents/shared.d.ts.map +1 -0
- package/dist/commands/incidents/shared.js +261 -0
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +249 -75
- package/dist/commands/pr/close-superseded.d.ts +9 -0
- package/dist/commands/pr/close-superseded.d.ts.map +1 -0
- package/dist/commands/pr/close-superseded.js +129 -0
- package/dist/commands/pr/close.d.ts +11 -0
- package/dist/commands/pr/close.d.ts.map +1 -0
- package/dist/commands/pr/close.js +116 -0
- package/dist/commands/pr/index.d.ts +2 -0
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +2 -0
- package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
- package/dist/commands/pr/integrate/artifacts.js +66 -1
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +20 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +40 -12
- package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +59 -15
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +107 -19
- package/dist/commands/pr/internal/freshness.d.ts +20 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
- package/dist/commands/pr/internal/freshness.js +50 -0
- package/dist/commands/pr/internal/gh-api.d.ts +6 -0
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
- package/dist/commands/pr/internal/gh-api.js +80 -0
- package/dist/commands/pr/internal/note-store.d.ts +18 -0
- package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
- package/dist/commands/pr/internal/note-store.js +66 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +13 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
- package/dist/commands/pr/internal/pr-paths.js +13 -0
- package/dist/commands/pr/internal/review-template.d.ts +24 -4
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
- package/dist/commands/pr/internal/review-template.js +221 -33
- package/dist/commands/pr/internal/sync.d.ts +41 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync.js +598 -0
- package/dist/commands/pr/note.d.ts.map +1 -1
- package/dist/commands/pr/note.js +37 -4
- package/dist/commands/pr/open.d.ts +1 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +18 -54
- package/dist/commands/pr/pr.command.d.ts +15 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +124 -5
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +58 -74
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
- package/dist/commands/recipes/impl/commands/install.js +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +9 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +12 -17
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +1 -1
- package/dist/commands/shared/approval-requirements.d.ts +5 -7
- package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
- package/dist/commands/shared/approval-requirements.js +3 -73
- package/dist/commands/shared/gh-transport.d.ts +16 -0
- package/dist/commands/shared/gh-transport.d.ts.map +1 -0
- package/dist/commands/shared/gh-transport.js +71 -0
- package/dist/commands/shared/git-diff.d.ts +3 -1
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +10 -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 +15 -0
- package/dist/commands/shared/git-worktree.d.ts +2 -0
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +22 -2
- package/dist/commands/shared/network-approval.d.ts +2 -0
- package/dist/commands/shared/network-approval.d.ts.map +1 -1
- package/dist/commands/shared/network-approval.js +1 -1
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
- package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
- package/dist/commands/shared/pr-meta.d.ts +29 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +152 -3
- package/dist/commands/shared/task-backend.d.ts +9 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -22
- package/dist/commands/shared/task-local-freshness.d.ts +13 -0
- package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
- package/dist/commands/shared/task-local-freshness.js +20 -0
- package/dist/commands/shared/task-mutation.d.ts +2 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -1
- package/dist/commands/shared/task-mutation.js +7 -0
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +1 -0
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +34 -1
- package/dist/commands/task/close-shared.d.ts.map +1 -1
- package/dist/commands/task/close-shared.js +1 -0
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/doc-template.d.ts.map +1 -1
- package/dist/commands/task/doc-template.js +7 -11
- package/dist/commands/task/findings-add.command.d.ts +20 -0
- package/dist/commands/task/findings-add.command.d.ts.map +1 -0
- package/dist/commands/task/findings-add.command.js +165 -0
- package/dist/commands/task/findings.command.d.ts +7 -0
- package/dist/commands/task/findings.command.d.ts.map +1 -0
- package/dist/commands/task/findings.command.js +20 -0
- package/dist/commands/task/findings.d.ts +63 -0
- package/dist/commands/task/findings.d.ts.map +1 -0
- package/dist/commands/task/findings.js +188 -0
- package/dist/commands/task/finish-shared.d.ts +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +60 -3
- package/dist/commands/task/finish.d.ts +10 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +143 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.command.js +414 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +49 -1
- package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +249 -17
- package/dist/commands/task/index.d.ts +1 -0
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +1 -0
- package/dist/commands/task/new.d.ts +1 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +140 -30
- package/dist/commands/task/new.spec.d.ts.map +1 -1
- package/dist/commands/task/new.spec.js +7 -0
- package/dist/commands/task/normalize.command.d.ts +2 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +45 -0
- package/dist/commands/task/normalize.d.ts +2 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +85 -8
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +7 -10
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +1 -0
- package/dist/commands/task/shared/docs.d.ts +6 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +14 -0
- package/dist/commands/task/shared/transition-command.d.ts +2 -0
- package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
- package/dist/commands/task/shared/transition-command.js +1 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +11 -1
- package/dist/commands/task/shared.d.ts +1 -1
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +1 -1
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +98 -1
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +18 -10
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +4 -0
- package/dist/commands/task/verify-command-shared.d.ts +19 -0
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
- package/dist/commands/task/verify-command-shared.js +152 -1
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
- package/dist/commands/task/verify-ok.command.js +15 -2
- package/dist/commands/task/verify-record.d.ts +36 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +193 -11
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
- package/dist/commands/task/verify-rework.command.js +15 -2
- package/dist/commands/task/verify-show.command.d.ts +1 -1
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +28 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +6 -1
- package/dist/commands/verify.run.d.ts.map +1 -1
- package/dist/commands/verify.run.js +12 -0
- package/dist/commands/verify.spec.d.ts +2 -6
- package/dist/commands/verify.spec.d.ts.map +1 -1
- package/dist/commands/verify.spec.js +30 -3
- package/dist/policy/engine.d.ts +3 -1
- package/dist/policy/engine.d.ts.map +1 -1
- package/dist/policy/engine.js +5 -6
- package/dist/policy/taxonomy.d.ts +17 -0
- package/dist/policy/taxonomy.d.ts.map +1 -0
- package/dist/policy/taxonomy.js +302 -0
- package/dist/policy/types.d.ts +2 -1
- package/dist/policy/types.d.ts.map +1 -1
- package/dist/runner/artifacts.d.ts.map +1 -1
- package/dist/runner/artifacts.js +2 -0
- package/dist/runner/context/base-prompts.d.ts +25 -0
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +182 -54
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +5 -0
- package/dist/runner/types.d.ts +12 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.js +81 -11
- package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-inspect.js +9 -7
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +59 -12
- package/dist/runtime/approvals/index.d.ts +3 -0
- package/dist/runtime/approvals/index.d.ts.map +1 -0
- package/dist/runtime/approvals/index.js +1 -0
- package/dist/runtime/approvals/runtime.d.ts +12 -0
- package/dist/runtime/approvals/runtime.d.ts.map +1 -0
- package/dist/runtime/approvals/runtime.js +154 -0
- package/dist/runtime/approvals/types.d.ts +31 -0
- package/dist/runtime/approvals/types.d.ts.map +1 -0
- package/dist/runtime/approvals/types.js +1 -0
- package/dist/runtime/behavior/index.d.ts +3 -0
- package/dist/runtime/behavior/index.d.ts.map +1 -0
- package/dist/runtime/behavior/index.js +1 -0
- package/dist/runtime/behavior/resolve.d.ts +7 -0
- package/dist/runtime/behavior/resolve.d.ts.map +1 -0
- package/dist/runtime/behavior/resolve.js +66 -0
- package/dist/runtime/behavior/types.d.ts +25 -0
- package/dist/runtime/behavior/types.d.ts.map +1 -0
- package/dist/runtime/behavior/types.js +1 -0
- package/dist/runtime/capabilities/backend.d.ts +7 -0
- package/dist/runtime/capabilities/backend.d.ts.map +1 -0
- package/dist/runtime/capabilities/backend.js +104 -0
- package/dist/runtime/capabilities/index.d.ts +6 -0
- package/dist/runtime/capabilities/index.d.ts.map +1 -0
- package/dist/runtime/capabilities/index.js +4 -0
- package/dist/runtime/capabilities/recipe.d.ts +10 -0
- package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
- package/dist/runtime/capabilities/recipe.js +123 -0
- package/dist/runtime/capabilities/registry.d.ts +6 -0
- package/dist/runtime/capabilities/registry.d.ts.map +1 -0
- package/dist/runtime/capabilities/registry.js +69 -0
- package/dist/runtime/capabilities/runner.d.ts +8 -0
- package/dist/runtime/capabilities/runner.d.ts.map +1 -0
- package/dist/runtime/capabilities/runner.js +73 -0
- package/dist/runtime/capabilities/types.d.ts +28 -0
- package/dist/runtime/capabilities/types.d.ts.map +1 -0
- package/dist/runtime/capabilities/types.js +1 -0
- package/dist/runtime/execution-profile/index.d.ts +3 -0
- package/dist/runtime/execution-profile/index.d.ts.map +1 -0
- package/dist/runtime/execution-profile/index.js +1 -0
- package/dist/runtime/execution-profile/resolve.d.ts +9 -0
- package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
- package/dist/runtime/execution-profile/resolve.js +80 -0
- package/dist/runtime/execution-profile/types.d.ts +27 -0
- package/dist/runtime/execution-profile/types.d.ts.map +1 -0
- package/dist/runtime/execution-profile/types.js +1 -0
- package/dist/runtime/explain/index.d.ts +3 -0
- package/dist/runtime/explain/index.d.ts.map +1 -0
- package/dist/runtime/explain/index.js +1 -0
- package/dist/runtime/explain/resolve.d.ts +14 -0
- package/dist/runtime/explain/resolve.d.ts.map +1 -0
- package/dist/runtime/explain/resolve.js +50 -0
- package/dist/runtime/explain/types.d.ts +28 -0
- package/dist/runtime/explain/types.d.ts.map +1 -0
- package/dist/runtime/explain/types.js +1 -0
- package/dist/runtime/harness/index.d.ts +4 -0
- package/dist/runtime/harness/index.d.ts.map +1 -0
- package/dist/runtime/harness/index.js +2 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
- package/dist/runtime/harness/resolve-from-command-context.js +11 -0
- package/dist/runtime/harness/resolve.d.ts +13 -0
- package/dist/runtime/harness/resolve.d.ts.map +1 -0
- package/dist/runtime/harness/resolve.js +146 -0
- package/dist/runtime/harness/types.d.ts +65 -0
- package/dist/runtime/harness/types.d.ts.map +1 -0
- package/dist/runtime/harness/types.js +1 -0
- package/dist/runtime/incidents/index.d.ts +3 -0
- package/dist/runtime/incidents/index.d.ts.map +1 -0
- package/dist/runtime/incidents/index.js +1 -0
- package/dist/runtime/incidents/resolve.d.ts +26 -0
- package/dist/runtime/incidents/resolve.d.ts.map +1 -0
- package/dist/runtime/incidents/resolve.js +683 -0
- package/dist/runtime/incidents/types.d.ts +84 -0
- package/dist/runtime/incidents/types.d.ts.map +1 -0
- package/dist/runtime/incidents/types.js +1 -0
- package/dist/runtime/protocol/index.d.ts +3 -0
- package/dist/runtime/protocol/index.d.ts.map +1 -0
- package/dist/runtime/protocol/index.js +2 -0
- package/dist/runtime/protocol/resolve.d.ts +16 -0
- package/dist/runtime/protocol/resolve.d.ts.map +1 -0
- package/dist/runtime/protocol/resolve.js +36 -0
- package/dist/runtime/protocol/types.d.ts +36 -0
- package/dist/runtime/protocol/types.d.ts.map +1 -0
- package/dist/runtime/protocol/types.js +1 -0
- package/dist/runtime/task-intake/index.d.ts +3 -0
- package/dist/runtime/task-intake/index.d.ts.map +1 -0
- package/dist/runtime/task-intake/index.js +1 -0
- package/dist/runtime/task-intake/resolve.d.ts +48 -0
- package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
- package/dist/runtime/task-intake/resolve.js +316 -0
- package/dist/runtime/task-intake/types.d.ts +117 -0
- package/dist/runtime/task-intake/types.d.ts.map +1 -0
- package/dist/runtime/task-intake/types.js +1 -0
- package/dist/shared/env.d.ts +1 -0
- package/dist/shared/env.d.ts.map +1 -1
- package/dist/shared/env.js +22 -1
- package/dist/shared/protected-paths.d.ts +4 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +8 -4
- package/dist/usecases/context/resolve-context.d.ts +55 -6
- package/dist/usecases/context/resolve-context.d.ts.map +1 -1
- package/dist/usecases/context/resolve-context.js +96 -6
- package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
- package/dist/usecases/task/task-list-usecase.js +8 -2
- package/dist/usecases/task/task-new-usecase.js +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { loadDirectSubcommandNames, parseGroupCommand, throwGroupCommandUsage, } from "../../cli/group-command.js";
|
|
2
|
+
export const incidentsSpec = {
|
|
3
|
+
id: ["incidents"],
|
|
4
|
+
group: "Policy",
|
|
5
|
+
summary: "Promote external incident advice and resolve incident hints for analogous tasks.",
|
|
6
|
+
synopsis: ["agentplane incidents <collect|advise> [args] [options]"],
|
|
7
|
+
args: [{ name: "cmd", required: false, variadic: true, valueHint: "<command>" }],
|
|
8
|
+
notes: [
|
|
9
|
+
"Use `incidents collect` to promote resolved reusable external findings into `.agentplane/policy/incidents.md`.",
|
|
10
|
+
"Use `incidents advise` to query registry advice by task id or lightweight scope/tags.",
|
|
11
|
+
],
|
|
12
|
+
parse: (raw) => parseGroupCommand(raw),
|
|
13
|
+
};
|
|
14
|
+
export const runIncidents = async (_ctx, p) => {
|
|
15
|
+
throwGroupCommandUsage({
|
|
16
|
+
spec: incidentsSpec,
|
|
17
|
+
cmd: p.cmd,
|
|
18
|
+
subcommands: await loadDirectSubcommandNames(["incidents"]),
|
|
19
|
+
command: "incidents",
|
|
20
|
+
});
|
|
21
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { TaskData } from "../../backends/task-backend.js";
|
|
2
|
+
import { type IncidentAdviceMatch, type IncidentAdviceQuery, type IncidentCollectionPlan, type IncidentRegistry } from "../../runtime/incidents/index.js";
|
|
3
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
4
|
+
export declare const INCIDENTS_POLICY_PATH = ".agentplane/policy/incidents.md";
|
|
5
|
+
export declare const INCIDENTS_POLICY_ASSET_PATH = "packages/agentplane/assets/policy/incidents.md";
|
|
6
|
+
export type LoadedTaskIncidents = {
|
|
7
|
+
task: TaskData;
|
|
8
|
+
findings: string;
|
|
9
|
+
scope: string | null;
|
|
10
|
+
query: IncidentAdviceQuery;
|
|
11
|
+
};
|
|
12
|
+
export declare function incidentRegistryPath(ctx: CommandContext): string;
|
|
13
|
+
export declare function incidentRegistryAssetPath(ctx: CommandContext): string;
|
|
14
|
+
export declare function loadIncidentRegistry(ctx: CommandContext): Promise<{
|
|
15
|
+
registryPath: string;
|
|
16
|
+
registryText: string;
|
|
17
|
+
registry: IncidentRegistry;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function loadTaskIncidents(ctx: CommandContext, taskId: string, taskOverride?: TaskData | null): Promise<LoadedTaskIncidents>;
|
|
20
|
+
export declare function formatIncidentCollectionIssues(taskId: string, plan: IncidentCollectionPlan): string;
|
|
21
|
+
export declare function collectTaskIncidents(opts: {
|
|
22
|
+
ctx: CommandContext;
|
|
23
|
+
taskId: string;
|
|
24
|
+
task?: TaskData | null;
|
|
25
|
+
write: boolean;
|
|
26
|
+
now?: Date;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
loaded: LoadedTaskIncidents;
|
|
29
|
+
registryPath: string;
|
|
30
|
+
registryPaths: string[];
|
|
31
|
+
registryText: string;
|
|
32
|
+
registry: IncidentRegistry;
|
|
33
|
+
plan: IncidentCollectionPlan;
|
|
34
|
+
wrote: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function inspectTaskIncidents(opts: {
|
|
37
|
+
ctx: CommandContext;
|
|
38
|
+
taskId: string;
|
|
39
|
+
task?: TaskData | null;
|
|
40
|
+
now?: Date;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
loaded: LoadedTaskIncidents;
|
|
43
|
+
registryPath: string;
|
|
44
|
+
registryPaths: string[];
|
|
45
|
+
registryText: string;
|
|
46
|
+
registry: IncidentRegistry;
|
|
47
|
+
plan: IncidentCollectionPlan;
|
|
48
|
+
}>;
|
|
49
|
+
export declare function renderIncidentCollectionOutcome(promotedCount: number): string;
|
|
50
|
+
export declare function renderIncidentCollectionPlanOutcome(plan: {
|
|
51
|
+
candidates?: readonly unknown[];
|
|
52
|
+
skipped?: readonly unknown[];
|
|
53
|
+
promotable?: readonly unknown[];
|
|
54
|
+
duplicates?: readonly unknown[];
|
|
55
|
+
issues?: readonly {
|
|
56
|
+
missingFields?: readonly string[];
|
|
57
|
+
}[];
|
|
58
|
+
findingsTextPresent?: boolean;
|
|
59
|
+
structuredFindingCount?: number;
|
|
60
|
+
}, opts?: {
|
|
61
|
+
wrote?: boolean;
|
|
62
|
+
context?: "collect" | "verify" | "finish" | "generic";
|
|
63
|
+
promotedIds?: readonly string[];
|
|
64
|
+
registryPaths?: readonly string[];
|
|
65
|
+
taskId?: string | null;
|
|
66
|
+
}): string;
|
|
67
|
+
export declare function adviseTaskIncidents(opts: {
|
|
68
|
+
ctx: CommandContext;
|
|
69
|
+
taskId: string;
|
|
70
|
+
task?: TaskData | null;
|
|
71
|
+
limit?: number;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
loaded: LoadedTaskIncidents;
|
|
74
|
+
matches: IncidentAdviceMatch[];
|
|
75
|
+
}>;
|
|
76
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/incidents/shared.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAM1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AACvE,eAAO,MAAM,2BAA2B,mDAAmD,CAAC;AAG5F,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAYF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAEhE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAErE;AAyCD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC,CAQD;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAyB9B;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,sBAAsB,GAC3B,MAAM,CAUR;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC,CA+BD;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,sBAAsB,CAAC;CAC9B,CAAC,CAkBD;AAED,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAI7E;AASD,wBAAgB,mCAAmC,CACjD,IAAI,EAAE;IACJ,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,SAAS;QAAE,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAC1D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,EACD,IAAI,CAAC,EAAE;IACL,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtD,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,GACA,MAAM,CA0GR;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC;IACV,MAAM,EAAE,mBAAmB,CAAC;IAC5B,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAChC,CAAC,CAWD"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { CliError } from "../../shared/errors.js";
|
|
4
|
+
import { writeTextIfChanged } from "../../shared/write-if-changed.js";
|
|
5
|
+
import { appendIncidentRegistryEntries, buildIncidentAdviceQueryFromTask, createIncidentRegistrySkeleton, parseIncidentRegistry, planIncidentCollection, resolveIncidentAdviceMatches, } from "../../runtime/incidents/index.js";
|
|
6
|
+
import { extractDocSection, extractTaskObservationSection, normalizeTaskDocVersion, } from "../task/shared.js";
|
|
7
|
+
export const INCIDENTS_POLICY_PATH = ".agentplane/policy/incidents.md";
|
|
8
|
+
export const INCIDENTS_POLICY_ASSET_PATH = "packages/agentplane/assets/policy/incidents.md";
|
|
9
|
+
const INCIDENTS_POLICY_LINE_BUDGET = 100;
|
|
10
|
+
async function readTextIfExists(filePath) {
|
|
11
|
+
try {
|
|
12
|
+
return await readFile(filePath, "utf8");
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
const code = err?.code;
|
|
16
|
+
if (code === "ENOENT")
|
|
17
|
+
return null;
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function incidentRegistryPath(ctx) {
|
|
22
|
+
return path.join(ctx.resolvedProject.gitRoot, INCIDENTS_POLICY_PATH);
|
|
23
|
+
}
|
|
24
|
+
export function incidentRegistryAssetPath(ctx) {
|
|
25
|
+
return path.join(ctx.resolvedProject.gitRoot, INCIDENTS_POLICY_ASSET_PATH);
|
|
26
|
+
}
|
|
27
|
+
function normalizeIncidentRegistryDocument(text) {
|
|
28
|
+
const normalized = text.replaceAll("\r\n", "\n").trimEnd();
|
|
29
|
+
return normalized.length > 0 ? `${normalized}\n` : createIncidentRegistrySkeleton();
|
|
30
|
+
}
|
|
31
|
+
async function writeIncidentRegistryMirrors(ctx, content) {
|
|
32
|
+
const registryPath = incidentRegistryPath(ctx);
|
|
33
|
+
const assetPath = incidentRegistryAssetPath(ctx);
|
|
34
|
+
const assetExists = (await readTextIfExists(assetPath)) !== null;
|
|
35
|
+
const normalizedContent = normalizeIncidentRegistryDocument(content);
|
|
36
|
+
let wroteRegistry = await writeTextIfChanged(registryPath, normalizedContent);
|
|
37
|
+
let wroteAsset = false;
|
|
38
|
+
if (assetExists) {
|
|
39
|
+
const canonicalText = (await readTextIfExists(registryPath)) ?? normalizedContent;
|
|
40
|
+
wroteAsset = await writeTextIfChanged(assetPath, canonicalText);
|
|
41
|
+
const registryText = await readTextIfExists(registryPath);
|
|
42
|
+
if (registryText !== canonicalText) {
|
|
43
|
+
wroteRegistry = (await writeTextIfChanged(registryPath, canonicalText)) || wroteRegistry;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return wroteRegistry || wroteAsset;
|
|
47
|
+
}
|
|
48
|
+
async function resolveIncidentRegistryMirrorPaths(ctx) {
|
|
49
|
+
const paths = [INCIDENTS_POLICY_PATH];
|
|
50
|
+
const assetPath = incidentRegistryAssetPath(ctx);
|
|
51
|
+
if ((await readTextIfExists(assetPath)) !== null) {
|
|
52
|
+
paths.push(INCIDENTS_POLICY_ASSET_PATH);
|
|
53
|
+
}
|
|
54
|
+
return paths;
|
|
55
|
+
}
|
|
56
|
+
function countTextLines(text) {
|
|
57
|
+
return text.replaceAll("\r\n", "\n").split("\n").length;
|
|
58
|
+
}
|
|
59
|
+
export async function loadIncidentRegistry(ctx) {
|
|
60
|
+
const registryPath = incidentRegistryPath(ctx);
|
|
61
|
+
const registryText = (await readTextIfExists(registryPath)) ?? createIncidentRegistrySkeleton();
|
|
62
|
+
return {
|
|
63
|
+
registryPath,
|
|
64
|
+
registryText,
|
|
65
|
+
registry: parseIncidentRegistry(registryText),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export async function loadTaskIncidents(ctx, taskId, taskOverride) {
|
|
69
|
+
const task = taskOverride ?? (await ctx.taskBackend.getTask(taskId));
|
|
70
|
+
if (!task) {
|
|
71
|
+
throw new CliError({
|
|
72
|
+
exitCode: 2,
|
|
73
|
+
code: "E_USAGE",
|
|
74
|
+
message: `Unknown task: ${taskId}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const doc = typeof task.doc === "string" ? task.doc : "";
|
|
78
|
+
const docVersion = normalizeTaskDocVersion(task.doc_version);
|
|
79
|
+
const findings = extractTaskObservationSection(doc, docVersion)?.trim() ?? "";
|
|
80
|
+
const scope = extractDocSection(doc, "Scope")?.trim() ?? null;
|
|
81
|
+
return {
|
|
82
|
+
task,
|
|
83
|
+
findings,
|
|
84
|
+
scope,
|
|
85
|
+
query: buildIncidentAdviceQueryFromTask({
|
|
86
|
+
taskId: task.id,
|
|
87
|
+
title: task.title,
|
|
88
|
+
description: task.description,
|
|
89
|
+
scope,
|
|
90
|
+
tags: task.tags ?? [],
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function formatIncidentCollectionIssues(taskId, plan) {
|
|
95
|
+
const issueLines = plan.issues.map((issue) => {
|
|
96
|
+
const scope = issue.candidate.incidentScope ?? issue.candidate.observation;
|
|
97
|
+
return `line ${issue.candidate.line}: ${scope} -> missing ${issue.missingFields.join(", ")}`;
|
|
98
|
+
});
|
|
99
|
+
return [
|
|
100
|
+
`${taskId}: reusable external findings need explicit external marking and enough recovery detail before promotion.`,
|
|
101
|
+
"Required fields:",
|
|
102
|
+
...issueLines.map((line) => `- ${line}`),
|
|
103
|
+
].join("\n");
|
|
104
|
+
}
|
|
105
|
+
export async function collectTaskIncidents(opts) {
|
|
106
|
+
const inspected = await inspectTaskIncidents(opts);
|
|
107
|
+
const { loaded, registryPath, registryPaths, registryText, registry, plan } = inspected;
|
|
108
|
+
if (plan.issues.length > 0) {
|
|
109
|
+
throw new CliError({
|
|
110
|
+
exitCode: 3,
|
|
111
|
+
code: "E_VALIDATION",
|
|
112
|
+
message: formatIncidentCollectionIssues(opts.taskId, plan),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const nextText = appendIncidentRegistryEntries(registryText, plan.promotable.map((item) => item.entry));
|
|
116
|
+
if (plan.promotable.length > 0) {
|
|
117
|
+
const nextLineCount = countTextLines(nextText);
|
|
118
|
+
if (nextLineCount > INCIDENTS_POLICY_LINE_BUDGET) {
|
|
119
|
+
throw new CliError({
|
|
120
|
+
exitCode: 3,
|
|
121
|
+
code: "E_VALIDATION",
|
|
122
|
+
message: `Incident registry write would exceed policy budget: ${nextLineCount} lines ` +
|
|
123
|
+
`(limit ${INCIDENTS_POLICY_LINE_BUDGET}). Compact or promote fewer entries before writing.`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const wrote = opts.write && plan.promotable.length > 0
|
|
128
|
+
? await writeIncidentRegistryMirrors(opts.ctx, nextText)
|
|
129
|
+
: false;
|
|
130
|
+
return { loaded, registryPath, registryPaths, registryText, registry, plan, wrote };
|
|
131
|
+
}
|
|
132
|
+
export async function inspectTaskIncidents(opts) {
|
|
133
|
+
const loaded = await loadTaskIncidents(opts.ctx, opts.taskId, opts.task ?? null);
|
|
134
|
+
const { registryPath, registryText, registry } = await loadIncidentRegistry(opts.ctx);
|
|
135
|
+
const registryPaths = await resolveIncidentRegistryMirrorPaths(opts.ctx);
|
|
136
|
+
const plan = planIncidentCollection({
|
|
137
|
+
task: {
|
|
138
|
+
id: loaded.task.id,
|
|
139
|
+
title: loaded.task.title,
|
|
140
|
+
description: loaded.task.description,
|
|
141
|
+
scope: loaded.scope,
|
|
142
|
+
tags: loaded.task.tags ?? [],
|
|
143
|
+
commitHash: loaded.task.commit?.hash ?? null,
|
|
144
|
+
},
|
|
145
|
+
findings: loaded.findings,
|
|
146
|
+
registry,
|
|
147
|
+
now: opts.now,
|
|
148
|
+
});
|
|
149
|
+
return { loaded, registryPath, registryPaths, registryText, registry, plan };
|
|
150
|
+
}
|
|
151
|
+
export function renderIncidentCollectionOutcome(promotedCount) {
|
|
152
|
+
return promotedCount > 0
|
|
153
|
+
? `incident registry updated (${promotedCount} promoted)`
|
|
154
|
+
: "incident registry unchanged (no promotable external findings)";
|
|
155
|
+
}
|
|
156
|
+
function summarizeDetailList(values, maxItems = 3) {
|
|
157
|
+
const filtered = values.map((value) => value.trim()).filter((value) => value.length > 0);
|
|
158
|
+
if (filtered.length === 0)
|
|
159
|
+
return null;
|
|
160
|
+
if (filtered.length <= maxItems)
|
|
161
|
+
return filtered.join(", ");
|
|
162
|
+
return `${filtered.slice(0, maxItems).join(", ")}, +${filtered.length - maxItems} more`;
|
|
163
|
+
}
|
|
164
|
+
export function renderIncidentCollectionPlanOutcome(plan, opts) {
|
|
165
|
+
const candidates = Array.isArray(plan.candidates) ? plan.candidates.length : 0;
|
|
166
|
+
const skipped = Array.isArray(plan.skipped) ? plan.skipped.length : 0;
|
|
167
|
+
const promoted = Array.isArray(plan.promotable) ? plan.promotable.length : 0;
|
|
168
|
+
const duplicates = Array.isArray(plan.duplicates) ? plan.duplicates.length : 0;
|
|
169
|
+
const issues = Array.isArray(plan.issues) ? plan.issues.length : 0;
|
|
170
|
+
const findingsTextPresent = plan.findingsTextPresent === true;
|
|
171
|
+
const structuredFindingCount = typeof plan.structuredFindingCount === "number" ? plan.structuredFindingCount : 0;
|
|
172
|
+
const wrote = opts?.wrote === true;
|
|
173
|
+
const context = opts?.context ?? "generic";
|
|
174
|
+
const taskId = typeof opts?.taskId === "string" && opts.taskId.trim().length > 0 ? opts.taskId.trim() : null;
|
|
175
|
+
const findingsNextStep = taskId
|
|
176
|
+
? ` next: agentplane task findings add ${taskId} --observation "<observation>" --impact "<impact>" --resolution "<resolution>"`
|
|
177
|
+
: "";
|
|
178
|
+
if (promoted > 0 && wrote) {
|
|
179
|
+
const suffix = [];
|
|
180
|
+
if (duplicates > 0)
|
|
181
|
+
suffix.push(`${duplicates} duplicate${duplicates === 1 ? "" : "s"}`);
|
|
182
|
+
if (skipped > 0)
|
|
183
|
+
suffix.push(`${skipped} skipped structured finding${skipped === 1 ? "" : "s"}`);
|
|
184
|
+
const base = suffix.length > 0
|
|
185
|
+
? `incident registry updated (${promoted} promoted; ${suffix.join("; ")})`
|
|
186
|
+
: renderIncidentCollectionOutcome(promoted);
|
|
187
|
+
const details = [];
|
|
188
|
+
const promotedIds = Array.isArray(opts?.promotedIds)
|
|
189
|
+
? opts.promotedIds.filter((id) => typeof id === "string" && id.trim().length > 0)
|
|
190
|
+
: [];
|
|
191
|
+
const registryPaths = Array.isArray(opts?.registryPaths)
|
|
192
|
+
? opts.registryPaths.filter((filePath) => typeof filePath === "string" && filePath.trim().length > 0)
|
|
193
|
+
: [];
|
|
194
|
+
const idsSummary = summarizeDetailList(promotedIds);
|
|
195
|
+
const pathsSummary = summarizeDetailList(registryPaths);
|
|
196
|
+
if (idsSummary)
|
|
197
|
+
details.push(`ids=${idsSummary}`);
|
|
198
|
+
if (pathsSummary)
|
|
199
|
+
details.push(`files=${pathsSummary}`);
|
|
200
|
+
return details.length > 0 ? `${base} ${details.join(" ")}` : base;
|
|
201
|
+
}
|
|
202
|
+
if (promoted > 0 && !wrote) {
|
|
203
|
+
if (context === "collect") {
|
|
204
|
+
return `incident registry unchanged (${promoted} promotable external finding${promoted === 1 ? "" : "s"} validated; rerun without --check to update incidents.md)`;
|
|
205
|
+
}
|
|
206
|
+
if (context === "verify") {
|
|
207
|
+
return `incident registry unchanged (${promoted} promotable external finding${promoted === 1 ? "" : "s"} stayed task-local in the current task worktree; run verify --collect-incidents, agentplane incidents collect <task-id>, or finish on the base branch to update incidents.md)`;
|
|
208
|
+
}
|
|
209
|
+
return `incident registry unchanged (${promoted} promotable external finding${promoted === 1 ? "" : "s"} pending promotion)`;
|
|
210
|
+
}
|
|
211
|
+
if (issues > 0) {
|
|
212
|
+
const issueEntries = Array.isArray(plan.issues)
|
|
213
|
+
? plan.issues
|
|
214
|
+
: [];
|
|
215
|
+
const firstIssue = issueEntries[0];
|
|
216
|
+
const rawMissingFields = firstIssue?.missingFields;
|
|
217
|
+
const missingFields = Array.isArray(rawMissingFields)
|
|
218
|
+
? rawMissingFields.filter((field) => typeof field === "string" && field.trim().length > 0)
|
|
219
|
+
: [];
|
|
220
|
+
const detail = missingFields.length > 0
|
|
221
|
+
? ` missing required fields: ${missingFields.join(", ")}`
|
|
222
|
+
: " missing required promotion fields";
|
|
223
|
+
const suffix = issues > 1 ? `; +${issues - 1} more candidate${issues - 1 === 1 ? "" : "s"}` : "";
|
|
224
|
+
return `incident registry unchanged (${issues} structured finding candidate${issues === 1 ? "" : "s"} still invalid;${detail}${suffix})`;
|
|
225
|
+
}
|
|
226
|
+
if (skipped > 0) {
|
|
227
|
+
return `incident registry unchanged (${skipped} structured finding${skipped === 1 ? "" : "s"} stayed task-local in the current checkout: mark reusable external findings with Promotion: incident-candidate plus Fixability: external, or use task findings add without --local-only)`;
|
|
228
|
+
}
|
|
229
|
+
if (candidates === 0 && structuredFindingCount === 0 && findingsTextPresent) {
|
|
230
|
+
return "incident registry unchanged (plain Findings text stays task-local in the current checkout and does not update incidents.md: add a structured Observation/Impact/Resolution block for reusable external incidents, or use task findings add without --local-only)";
|
|
231
|
+
}
|
|
232
|
+
if (candidates === 0) {
|
|
233
|
+
if (context === "verify") {
|
|
234
|
+
return ("incident registry unchanged (plain verify note stayed task-local and did not update " +
|
|
235
|
+
"incidents.md: add --observation, --impact, and --resolution for a reusable incident, " +
|
|
236
|
+
`then rerun with --collect-incidents or collect later on the base branch.${findingsNextStep})`);
|
|
237
|
+
}
|
|
238
|
+
if (context === "finish") {
|
|
239
|
+
return ("incident registry unchanged (plain finish body/result stayed task-local and did not " +
|
|
240
|
+
"update incidents.md: add --observation, --impact, and --resolution for a reusable " +
|
|
241
|
+
`incident before closeout.${findingsNextStep})`);
|
|
242
|
+
}
|
|
243
|
+
return "incident registry unchanged (no structured incident findings)";
|
|
244
|
+
}
|
|
245
|
+
if (duplicates > 0 && duplicates === candidates) {
|
|
246
|
+
return `incident registry unchanged (${duplicates} duplicate incident${duplicates === 1 ? "" : "s"} already recorded)`;
|
|
247
|
+
}
|
|
248
|
+
return "incident registry unchanged (no promotable external findings)";
|
|
249
|
+
}
|
|
250
|
+
export async function adviseTaskIncidents(opts) {
|
|
251
|
+
const loaded = await loadTaskIncidents(opts.ctx, opts.taskId, opts.task ?? null);
|
|
252
|
+
const { registry } = await loadIncidentRegistry(opts.ctx);
|
|
253
|
+
return {
|
|
254
|
+
loaded,
|
|
255
|
+
matches: resolveIncidentAdviceMatches({
|
|
256
|
+
query: loaded.query,
|
|
257
|
+
registry,
|
|
258
|
+
limit: opts.limit,
|
|
259
|
+
}),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/check.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgLnC,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2NlB"}
|