specdojo 0.3.1 → 0.4.1
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/.github/agents/specdojo-orchestrator.md +61 -2
- package/CHANGELOG.md +90 -0
- package/README.md +85 -25
- package/dist/{catalog-build-references.js → catalog/build-references.js} +4 -4
- package/dist/catalog/build-render.js +32 -0
- package/dist/{catalog-build.js → catalog/build.js} +9 -9
- package/dist/{catalog.js → catalog/catalog.js} +10 -10
- package/dist/{catalog-generate.js → catalog/generate.js} +8 -8
- package/dist/catalog/paths.js +1 -0
- package/dist/{catalog-plan-generate.js → catalog/plan-generate.js} +4 -4
- package/dist/{catalog-plan.js → catalog/plan.js} +4 -4
- package/dist/{catalog-scaffold.js → catalog/scaffold.js} +3 -3
- package/dist/{agent.js → commands/agent.js} +11 -11
- package/dist/{build-command.js → commands/build.js} +2 -2
- package/dist/{init-command.js → commands/init.js} +168 -45
- package/dist/commands/night-orchestrator.js +287 -0
- package/dist/{orchestrator.js → commands/orchestrator.js} +12 -5
- package/dist/{watch.js → commands/watch.js} +3 -3
- package/dist/{dashboard-timeline.js → dashboard/dashboard-timeline.js} +2 -2
- package/dist/{dashboard.js → dashboard/dashboard.js} +11 -10
- package/dist/{dashboard-exec-records.js → dashboard/exec-records.js} +2 -2
- package/dist/{dashboard-routines.js → dashboard/routines.js} +6 -5
- package/dist/{dashboard-shared.js → dashboard/shared.js} +1 -1
- package/dist/{timeline-build.js → dashboard/timeline-build.js} +2 -1
- package/dist/{timeline.js → dashboard/timeline.js} +1 -1
- package/dist/{deliverable.js → deliverable/deliverable.js} +5 -5
- package/dist/{deliverable-trash.js → deliverable/trash.js} +5 -5
- package/dist/{devcontainer-command.js → devcontainer/command.js} +8 -4
- package/dist/devcontainer/scaffold.js +418 -0
- package/dist/{doc-index.js → docs/doc-index.js} +1 -1
- package/dist/{frontmatter-namespace.js → docs/frontmatter-namespace.js} +1 -1
- package/dist/{index-command.js → docs/index-command.js} +1 -1
- package/dist/docs/template-resolution.js +1 -0
- package/dist/{viewpoint-document-kinds-check.js → docs/viewpoint-document-kinds-check.js} +1 -1
- package/dist/{yaml-pages-command.js → docs/yaml-pages-command.js} +1 -1
- package/dist/{yaml-pages.js → docs/yaml-pages.js} +2 -2
- package/dist/{exec-agent-config.js → exec/agent-config.js} +92 -5
- package/dist/{exec-agent-git-state.js → exec/agent-git-state.js} +1 -1
- package/dist/{exec-agent-protected-config.js → exec/agent-protected-config.js} +1 -1
- package/dist/{exec-commands.js → exec/commands.js} +22 -18
- package/dist/{exec-core.js → exec/core.js} +11 -11
- package/dist/{exec-events.js → exec/events.js} +2 -2
- package/dist/{exec-evidence.js → exec/evidence.js} +11 -6
- package/dist/exec/exec.js +2 -0
- package/dist/exec/format.js +1 -0
- package/dist/{exec-handoff.js → exec/handoff.js} +13 -12
- package/dist/{exec-limit.js → exec/limit.js} +93 -12
- package/dist/{exec-parent-validation.js → exec/parent-validation.js} +18 -4
- package/dist/{exec-pipeline-state.js → exec/pipeline-state.js} +29 -2
- package/dist/{exec-plans-core.js → exec/plans-core.js} +68 -114
- package/dist/{exec-plans-generation.js → exec/plans-generation.js} +53 -10
- package/dist/{exec-plans-storage.js → exec/plans-storage.js} +5 -5
- package/dist/{exec-plans.js → exec/plans.js} +3 -3
- package/dist/{exec-project.js → exec/project.js} +1 -1
- package/dist/{exec-protection-handoff.js → exec/protection-handoff.js} +3 -3
- package/dist/{exec-register-resume.js → exec/register-resume.js} +2 -2
- package/dist/{exec-register.js → exec/register.js} +114 -9
- package/dist/{exec-repo-integration-git.js → exec/repo-integration-git.js} +2 -2
- package/dist/{exec-repo-integration-sync.js → exec/repo-integration-sync.js} +4 -4
- package/dist/{exec-repo-integration.js → exec/repo-integration.js} +14 -11
- package/dist/{exec-repo-trace.js → exec/repo-trace.js} +3 -3
- package/dist/{exec-reporter-output.js → exec/reporter-output.js} +2 -2
- package/dist/{exec-reporter.js → exec/reporter.js} +142 -25
- package/dist/{exec-results.js → exec/results.js} +287 -31
- package/dist/{exec-run-agent-pipeline.js → exec/run/agent-pipeline.js} +35 -12
- package/dist/{exec-run-agent.js → exec/run/agent.js} +115 -28
- package/dist/{exec-run-in-place.js → exec/run/in-place.js} +56 -27
- package/dist/{exec-run-job.js → exec/run/job.js} +65 -36
- package/dist/{exec-run-lifecycle-commands.js → exec/run/lifecycle-commands.js} +30 -22
- package/dist/{exec-run-lock.js → exec/run/lock.js} +4 -3
- package/dist/{exec-run-mode-shared.js → exec/run/mode-shared.js} +3 -3
- package/dist/{exec-run-register-command.js → exec/run/register-command.js} +38 -11
- package/dist/{exec-run-register-core.js → exec/run/register-core.js} +63 -21
- package/dist/{exec-run-register-mode.js → exec/run/register-mode.js} +58 -31
- package/dist/exec/run/register-post-review.js +420 -0
- package/dist/{exec-run-register-resume.js → exec/run/register-resume.js} +48 -27
- package/dist/{exec-run-register-state.js → exec/run/register-state.js} +13 -10
- package/dist/{exec-run-register-worktree.js → exec/run/register-worktree.js} +119 -24
- package/dist/{exec-run.js → exec/run/run.js} +11 -11
- package/dist/{exec-run-schedule-mode.js → exec/run/schedule-mode.js} +17 -17
- package/dist/{exec-run-schedule-prepare.js → exec/run/schedule-prepare.js} +31 -18
- package/dist/{exec-run-schedule-task.js → exec/run/schedule-task.js} +45 -18
- package/dist/{exec-run-shared.js → exec/run/shared.js} +78 -30
- package/dist/{exec-schedule-calendar.js → exec/schedule/calendar.js} +1 -1
- package/dist/{exec-schedule-cpm.js → exec/schedule/cpm.js} +2 -2
- package/dist/{exec-schedule-gantt-chart-render.js → exec/schedule/gantt-chart-render.js} +2 -2
- package/dist/exec/schedule/gantt-chart.js +2 -0
- package/dist/{exec-schedule-hash.js → exec/schedule/hash.js} +2 -2
- package/dist/exec/schedule/index.js +1 -0
- package/dist/{exec-schedule-initial.js → exec/schedule/initial.js} +2 -2
- package/dist/{exec-schedule-progress.js → exec/schedule/progress.js} +2 -2
- package/dist/{exec-schedule-ready.js → exec/schedule/ready.js} +2 -2
- package/dist/{exec-schedule.js → exec/schedule/schedule.js} +11 -11
- package/dist/exec/shared.js +63 -0
- package/dist/exec/slot-lock.js +1 -0
- package/dist/{exec-strategy.js → exec/strategy.js} +2 -2
- package/dist/{exec-task-repos.js → exec/task-repos.js} +104 -17
- package/dist/{exec-task-view.js → exec/task-view.js} +4 -4
- package/dist/{exec-trial-commands.js → exec/trial-commands.js} +20 -22
- package/dist/{exec-trial-core.js → exec/trial-core.js} +6 -6
- package/dist/{exec-trial.js → exec/trial.js} +2 -2
- package/dist/{exec-worktree-command.js → exec/worktree-command.js} +25 -23
- package/dist/{exec-worktree-ops-commit.js → exec/worktree-ops-commit.js} +25 -60
- package/dist/{exec-worktree-ops-lifecycle.js → exec/worktree-ops-lifecycle.js} +13 -8
- package/dist/{exec-worktree-ops-merge.js → exec/worktree-ops-merge.js} +48 -7
- package/dist/{exec-worktree-ops.js → exec/worktree-ops.js} +3 -3
- package/dist/exec/worktree.js +305 -0
- package/dist/{grade-apply.js → grade/apply.js} +9 -9
- package/dist/{grade-command-apply.js → grade/command-apply.js} +7 -7
- package/dist/{grade-command-inspect.js → grade/command-inspect.js} +6 -6
- package/dist/{grade-command-plan.js → grade/command-plan.js} +5 -5
- package/dist/{grade-core.js → grade/core.js} +3 -3
- package/dist/grade/grade.js +19 -0
- package/dist/{grade-markdown.js → grade/markdown.js} +6 -6
- package/dist/{grade-pipeline-state.js → grade/pipeline-state.js} +4 -4
- package/dist/{grade-plan.js → grade/plan.js} +5 -5
- package/dist/{grade-result.js → grade/result.js} +5 -94
- package/dist/{grade-target-discovery.js → grade/target-discovery.js} +7 -7
- package/dist/{grade-targets.js → grade/targets.js} +11 -8
- package/dist/{job-definition.js → job/definition.js} +25 -6
- package/dist/{job.js → job/job.js} +12 -11
- package/dist/{kata-command.js → kata/command.js} +3 -3
- package/dist/{kata.js → kata/kata.js} +5 -5
- package/dist/register/approach.js +134 -0
- package/dist/{register-core.js → register/core.js} +26 -8
- package/dist/{register-create-commands.js → register/create-commands.js} +171 -8
- package/dist/{register-date.js → register/date.js} +1 -1
- package/dist/register/derivation.js +163 -0
- package/dist/{register-event-merge.js → register/event-merge.js} +44 -3
- package/dist/{register-events.js → register/events.js} +13 -3
- package/dist/{register-history.js → register/history.js} +7 -6
- package/dist/{register-item.js → register/item.js} +32 -5
- package/dist/register/lifecycle-lock.js +5 -0
- package/dist/{register-maintenance-commands.js → register/maintenance-commands.js} +13 -7
- package/dist/{register-migrate-timestamps.js → register/migrate-timestamps.js} +3 -3
- package/dist/{register-migration.js → register/migration.js} +5 -4
- package/dist/{register.js → register/register.js} +32 -27
- package/dist/{register-renumber.js → register/renumber.js} +38 -11
- package/dist/{register-transition-commands.js → register/transition-commands.js} +3 -3
- package/dist/{register-update.js → register/update.js} +5 -5
- package/dist/{register-views.js → register/views.js} +47 -7
- package/dist/{review-grade.js → review/grade.js} +2 -2
- package/dist/{review-plan.js → review/plan.js} +3 -3
- package/dist/{routine-definition.js → routine/definition.js} +2 -2
- package/dist/{routine.js → routine/routine.js} +49 -22
- package/dist/{schedule-approach.js → schedule/approach.js} +8 -8
- package/dist/{schedule-build.js → schedule/build.js} +7 -4
- package/dist/{schedule.js → schedule/schedule.js} +6 -6
- package/dist/{schedule-strategy-generate-document.js → schedule/strategy-generate-document.js} +2 -2
- package/dist/{schedule-strategy-generate-scope.js → schedule/strategy-generate-scope.js} +4 -4
- package/dist/{schedule-strategy-generate.js → schedule/strategy-generate.js} +10 -10
- package/dist/shared/agent-types.js +23 -0
- package/dist/shared/artifact-path.js +9 -0
- package/dist/{build-if-stale.js → shared/build-if-stale.js} +1 -1
- package/dist/{catalog-build-render.js → shared/catalog-render.js} +3 -32
- package/dist/{exec-slot-lock.js → shared/cross-process-lock.js} +3 -1
- package/dist/shared/fs.js +30 -0
- package/dist/shared/git.js +346 -0
- package/dist/shared/grade-result.js +94 -0
- package/dist/{package-paths.js → shared/package-paths.js} +3 -3
- package/dist/shared/plan-templates.js +114 -0
- package/dist/{exec-provider-scaffold.js → shared/provider-scaffold.js} +6 -3
- package/dist/shared/random.js +4 -0
- package/dist/{exec-schedule-index.js → shared/schedule-index.js} +3 -1
- package/dist/shared/schedule-paths.js +9 -0
- package/dist/{specdojo-config.js → shared/specdojo-config.js} +162 -21
- package/dist/{exec-shared.js → shared/text.js} +4 -135
- package/dist/shared/time.js +28 -0
- package/dist/shared/workspace-scaffold.js +69 -0
- package/dist/specdojo.js +22 -22
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +31 -18
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +1 -2
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +3 -2
- package/docs/ja/specdojo/exec-templates/xer-template.md +1 -3
- package/docs/ja/specdojo/exec-templates/xrp-job-template.md +6 -4
- package/docs/ja/specdojo/exec-templates/xrp-register-post-run-template.md +46 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +34 -1
- package/docs/ja/specdojo/guides/docs-structure-guide.md +2 -0
- package/docs/ja/specdojo/guides/exec-config-guide.md +169 -26
- package/docs/ja/specdojo/guides/exec-operation-guide.md +184 -13
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +2 -0
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +40 -3
- package/docs/ja/specdojo/guides/quick-start-guide.md +89 -21
- package/docs/ja/specdojo/guides/register-operation-guide.md +44 -1
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +61 -6
- package/docs/ja/specdojo/guides/review-guide.md +1 -1
- package/docs/ja/specdojo/guides/routine-operation-guide.md +5 -5
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +1 -1
- package/docs/ja/specdojo/guides/use-case-guide.md +1 -1
- package/docs/ja/specdojo/guides/waza-guide.md +1 -1
- package/docs/ja/specdojo/references/command-reference.md +124 -55
- package/docs/ja/specdojo/references/specdojo-config-reference.md +33 -7
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +22 -13
- package/docs/ja/specdojo/standards/job-definition-standard.md +20 -18
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +2 -2
- package/docs/ja/specdojo/templates/pjr-derived-items-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-index-template.md +1 -0
- package/docs/specdojo/schemas/v1/agent-members.schema.yaml +29 -2
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +111 -17
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +28 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +2 -2
- package/docs/specdojo/schemas/v1/job.schema.yaml +7 -0
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +5 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +91 -7
- package/docs/specdojo/schemas/v1/routine-run.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +36 -1
- package/package.json +17 -17
- package/templates/antigravity/README.md +6 -2
- package/templates/antigravity/agent-members-snippet.yaml +108 -12
- package/templates/antigravity/exec-defaults-snippet.yaml +8 -13
- package/templates/antigravity/orchestrator.md +61 -2
- package/templates/claude/README.md +27 -3
- package/templates/claude/agents/claude-executor.md +0 -1
- package/templates/claude/agents/claude-reporter.md +2 -1
- package/templates/claude/agents/claude-review-executor.md +0 -1
- package/templates/claude/agents/specdojo-orchestrator.md +61 -2
- package/templates/codex/README.md +40 -4
- package/templates/codex/agents/specdojo-orchestrator.toml +61 -2
- package/templates/codex/orchestrator.md +61 -2
- package/templates/devcontainer/devcontainer.json +5 -2
- package/templates/devcontainer/post-create.sh +15 -7
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +102 -0
- package/templates/devcontainer/remote-host/ssh-config.sample +19 -0
- package/templates/devcontainer/vim/vimrc +37 -0
- package/templates/init-agent-members.yaml +75 -25
- package/templates/init-exec-defaults.yaml +44 -9
- package/templates/opencode/README.md +17 -3
- package/templates/opencode/agents/opencode-executor.md +0 -1
- package/templates/opencode/agents/opencode-reporter.md +2 -1
- package/templates/opencode/agents/opencode-review-executor.md +0 -1
- package/templates/opencode/agents/specdojo-orchestrator.md +61 -2
- package/dist/devcontainer-scaffold.js +0 -165
- package/dist/exec-schedule-gantt-chart.js +0 -2
- package/dist/exec-worktree.js +0 -474
- package/dist/exec.js +0 -2
- package/dist/grade.js +0 -19
- package/templates/claude/agents/claude-expert-review-executor.md +0 -14
- /package/dist/{catalog-plan-prompt.js → catalog/plan-prompt.js} +0 -0
- /package/dist/{catalog-types.js → catalog/types.js} +0 -0
- /package/dist/{template-frontmatter.js → docs/template-frontmatter.js} +0 -0
- /package/dist/{role-types.js → exec/role-types.js} +0 -0
- /package/dist/{exec-schedule-gantt-chart-scope.js → exec/schedule/gantt-chart-scope.js} +0 -0
- /package/dist/{exec-types.js → exec/types.js} +0 -0
- /package/dist/{grade-command-shared.js → grade/command-shared.js} +0 -0
- /package/dist/{register-command-types.js → register/command-types.js} +0 -0
- /package/dist/{review-types.js → review/types.js} +0 -0
- /package/dist/{schedule-phase-sets.js → schedule/phase-sets.js} +0 -0
- /package/dist/{schedule-strategy-profiles.js → schedule/strategy-profiles.js} +0 -0
- /package/dist/{agent-response.js → shared/agent-response.js} +0 -0
- /package/dist/{catalog-paths.js → shared/catalog-paths.js} +0 -0
- /package/dist/{dist-freshness.js → shared/dist-freshness.js} +0 -0
- /package/dist/{git-environment.js → shared/git-environment.js} +0 -0
- /package/dist/{exec-format.js → shared/markdown-format.js} +0 -0
- /package/dist/{practice-id.js → shared/practice-id.js} +0 -0
- /package/dist/{spawn-self.js → shared/spawn-self.js} +0 -0
- /package/dist/{specdojo-gitignore.js → shared/specdojo-gitignore.js} +0 -0
- /package/dist/{template-resolution.js → shared/template-resolution.js} +0 -0
- /package/dist/{yaml-schema-modeline.js → shared/yaml-schema-modeline.js} +0 -0
- /package/dist/{yaml.js → shared/yaml.js} +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { loadExecDefaultsConfig, providerSlotPoolPath, resolveMaxConcurrency, resolveMaxConcurrentRuns, } from "
|
|
4
|
-
import { activateResolvedProjectPaths, resolveProjectPaths } from "
|
|
5
|
-
import { acquireSchedulerLock, buildEvent, readAllEventFiles, foldEventsToState, releaseSchedulerLock, writeEventFile, } from "
|
|
6
|
-
import { selectDueDeferredLimitTasks } from "
|
|
7
|
-
import { buildScheduleIndex } from "
|
|
8
|
-
import { buildInitialStateFromStrategy } from "
|
|
9
|
-
import { qualifyTaskId } from "
|
|
10
|
-
import { specdojoRootDir } from "
|
|
11
|
-
import { collectExecLockUsage, execLocksDir, formatExecLockUsage } from "./
|
|
12
|
-
import { buildTaskView } from "
|
|
13
|
-
import { readResultFrontmatterSnapshot, updateResultStatus } from "
|
|
14
|
-
import { findExecWorktree, resolveWorktreeBase } from "
|
|
15
|
-
import { configuredProductRepos, withProductWorktrees } from "
|
|
16
|
-
import { parentValidationPoolPath, resolveParentValidationConcurrency, } from "
|
|
17
|
-
import { loadPipelineResumeCheckpoint } from "
|
|
18
|
-
import { buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, withProjectExecRunLock, } from "./
|
|
19
|
-
import { loadRosterForExecutionPath, pathInsideWorktree } from "./
|
|
20
|
-
import { findClaimEventPath, prepareSingleTask, } from "./
|
|
21
|
-
import { runPreparedTask } from "./
|
|
22
|
-
import { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor, runBatchMode, } from "./
|
|
23
|
-
import { spawnBlock, spawnIndexBuild, spawnRefresh, spawnValidate
|
|
3
|
+
import { loadExecDefaultsConfig, providerSlotPoolPath, resolveMaxConcurrency, resolveMaxConcurrentRuns, } from "../agent-config.js";
|
|
4
|
+
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
5
|
+
import { acquireSchedulerLock, buildEvent, readAllEventFiles, foldEventsToState, releaseSchedulerLock, writeEventFile, } from "../events.js";
|
|
6
|
+
import { selectDueDeferredLimitTasks } from "../limit.js";
|
|
7
|
+
import { buildScheduleIndex } from "../schedule/schedule.js";
|
|
8
|
+
import { buildInitialStateFromStrategy } from "../schedule/initial.js";
|
|
9
|
+
import { qualifyTaskId } from "../shared.js";
|
|
10
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
11
|
+
import { collectExecLockUsage, execLocksDir, formatExecLockUsage } from "./lock.js";
|
|
12
|
+
import { buildTaskView } from "../task-view.js";
|
|
13
|
+
import { readResultFrontmatterSnapshot, updateResultStatus } from "../results.js";
|
|
14
|
+
import { findExecWorktree, resolveWorktreeBase } from "../worktree.js";
|
|
15
|
+
import { configuredProductRepos, withProductWorktrees } from "../task-repos.js";
|
|
16
|
+
import { parentValidationPoolPath, resolveParentValidationConcurrency, } from "../parent-validation.js";
|
|
17
|
+
import { loadPipelineResumeCheckpoint } from "../pipeline-state.js";
|
|
18
|
+
import { buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, withProjectExecRunLock, } from "./shared.js";
|
|
19
|
+
import { loadRosterForExecutionPath, pathInsideWorktree } from "./agent.js";
|
|
20
|
+
import { findClaimEventPath, prepareSingleTask, } from "./schedule-prepare.js";
|
|
21
|
+
import { runPreparedTask } from "./schedule-task.js";
|
|
22
|
+
import { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor, runBatchMode, } from "./schedule-mode.js";
|
|
23
|
+
import { spawnBlock, spawnIndexBuild, spawnRefresh, spawnValidate } from "./mode-shared.js";
|
|
24
24
|
// 同じ project の exec run が共有する枠(主 run・--join run・register lifecycle・provider の
|
|
25
25
|
// max_concurrency・親検証)の上限と現在の使用数を表示する。ロックは取得しない。
|
|
26
26
|
export function formatExecSlotsReport(executionPath, execDefaults) {
|
|
@@ -444,7 +444,7 @@ export async function runResumeMode(opts) {
|
|
|
444
444
|
stateRef: typeof snapshot.tasks[taskId]?.meta?.pipeline_state_ref === "string"
|
|
445
445
|
? snapshot.tasks[taskId]?.meta?.pipeline_state_ref
|
|
446
446
|
: undefined,
|
|
447
|
-
});
|
|
447
|
+
}, opts);
|
|
448
448
|
if (typeof prepared !== "string") {
|
|
449
449
|
const attempts = snapshot.tasks[taskId]?.meta?.limit_attempts;
|
|
450
450
|
prepared.priorLimitAttempts =
|
|
@@ -499,6 +499,9 @@ export function registerResumeCommand(exec) {
|
|
|
499
499
|
cmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks (overrides the claiming actor)");
|
|
500
500
|
cmd.option("--executor-by <nickname>", "agent-members.yaml executor nickname for pipeline tasks");
|
|
501
501
|
cmd.option("--reporter-by <nickname>", "agent-members.yaml reporter nickname for pipeline tasks");
|
|
502
|
+
cmd.option("--on-rate-limit <action>", "Pinned-agent rate-limit action: stop|wait|fallback (overrides rate_limit_policy.pinned)");
|
|
503
|
+
cmd.option("--fallback-executor-by <nickname>", "Fallback executor after a rate limit or configured connection error");
|
|
504
|
+
cmd.option("--fallback-reporter-by <nickname>", "Fallback reporter after a rate limit or configured connection error");
|
|
502
505
|
cmd.option("--parallel <n>", "Number of tasks to resume in parallel", "1");
|
|
503
506
|
cmd.option("--worktree-base <path>", "Override worktree base directory");
|
|
504
507
|
cmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
|
|
@@ -511,6 +514,11 @@ export function registerResumeCommand(exec) {
|
|
|
511
514
|
process.exitCode = 1;
|
|
512
515
|
return;
|
|
513
516
|
}
|
|
517
|
+
if (opts.onRateLimit && !["stop", "wait", "fallback"].includes(opts.onRateLimit)) {
|
|
518
|
+
process.stdout.write('--on-rate-limit must be "stop", "wait", or "fallback".\n');
|
|
519
|
+
process.exitCode = 1;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
514
522
|
await withProjectExecRunLock(opts, "resume", () => runResumeMode(opts));
|
|
515
523
|
}
|
|
516
524
|
catch (error) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { ensureDir } from "
|
|
3
|
-
import {
|
|
2
|
+
import { ensureDir } from "../shared.js";
|
|
3
|
+
import { registerLifecyclePoolPath } from "../../register/lifecycle-lock.js";
|
|
4
|
+
import { delay, formatLockOwner, isLiveLock, LOCK_HEARTBEAT_MS, LOCK_POLL_MS, LOCK_STALE_MS, livePoolHolders, readLockOwner, releaseLock, tryAcquireLock, tryAcquirePoolSlot, } from "../slot-lock.js";
|
|
4
5
|
export const EXEC_RUN_LOCK_HEARTBEAT_MS = LOCK_HEARTBEAT_MS;
|
|
5
6
|
export const EXEC_RUN_LOCK_STALE_MS = LOCK_STALE_MS;
|
|
6
7
|
export const EXEC_RUN_LOCK_TOKEN_ENV = "SPECDOJO_EXEC_RUN_LOCK_TOKEN";
|
|
@@ -104,7 +105,7 @@ export function releaseExecRunLock(handle) {
|
|
|
104
105
|
// Serializes the register lifecycle steps that write the root worktree (start transition,
|
|
105
106
|
// checkpoint, merge, wait commit, view rebuild) across every exec run of the project.
|
|
106
107
|
export function execLifecyclePoolPath(executionPath) {
|
|
107
|
-
return
|
|
108
|
+
return registerLifecyclePoolPath(executionPath);
|
|
108
109
|
}
|
|
109
110
|
function describeSlotOwner(slot) {
|
|
110
111
|
if (!slot.owner)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, sep } from "node:path";
|
|
4
|
-
import { selfRunArgs } from "
|
|
5
|
-
import { specdojoRootDir } from "
|
|
6
|
-
import { readPipelineState, updatePipelineRepoIntegration, updatePipelineStage, writePipelineState, } from "
|
|
4
|
+
import { selfRunArgs } from "../../shared/spawn-self.js";
|
|
5
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
6
|
+
import { readPipelineState, updatePipelineRepoIntegration, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
7
7
|
export function spawnSelf(args, cwd = specdojoRootDir()) {
|
|
8
8
|
const [exe, fullArgs] = selfRunArgs(args);
|
|
9
9
|
const result = spawnSync(exe, fullArgs, { stdio: "inherit", cwd });
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { loadExecDefaultsConfig } from "
|
|
2
|
-
import { resolveProjectPaths } from "
|
|
3
|
-
import { isRegisterFailureMode } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { loadExecDefaultsConfig, resolveRegisterPostReview } from "../agent-config.js";
|
|
2
|
+
import { resolveProjectPaths } from "../project.js";
|
|
3
|
+
import { isRegisterFailureMode } from "../register.js";
|
|
4
|
+
import { configuredProductRepos } from "../task-repos.js";
|
|
5
|
+
import { EXCLUSIVE_EXEC_RUN, parseParallel, resolveExecDefaultsPath, resolveRegisterWorktree, withProjectExecRunLock, } from "./shared.js";
|
|
6
|
+
import { runBatchMode, runManualMode } from "./schedule-mode.js";
|
|
7
|
+
import { runInPlaceMode } from "./in-place.js";
|
|
8
|
+
import { runJobMode } from "./job.js";
|
|
9
|
+
import { spawnRefresh, spawnValidate } from "./mode-shared.js";
|
|
10
|
+
import { resolveRegisterPipelineCommand } from "./register-core.js";
|
|
11
|
+
import { runRegisterMode } from "./register-mode.js";
|
|
11
12
|
export function registerRunCommand(exec) {
|
|
12
13
|
const rcmd = exec
|
|
13
14
|
.command("run")
|
|
@@ -29,6 +30,7 @@ export function registerRunCommand(exec) {
|
|
|
29
30
|
rcmd.option("--scheduled-at <dateTime>", "Scheduled occurrence time for a Job Run");
|
|
30
31
|
rcmd.option("--job-trigger <source>", "Job trigger source: manual|routine|ci", "manual");
|
|
31
32
|
rcmd.option("--register-commit", "With in-place --register: commit each successful item's changes as a separate commit (default: leave changes in the working tree). Ignored in worktree mode, which always commits", false);
|
|
33
|
+
rcmd.option("--post-review", "After integrating a register worktree, run a read-only completion review and automatically close eligible todo/issue items");
|
|
32
34
|
rcmd.option("--on-failure <mode>", "With --register: stop|continue remaining items after a failure (default: stop)");
|
|
33
35
|
rcmd.option("--resume", "With register worktree mode: resume the stage where a run stopped (executor, reporter, or integration), reusing the existing worktree and checkpoints", false);
|
|
34
36
|
rcmd.option("--resume-from <stage>", "With --resume: resume a reporter-stage run from executor instead (accepted value: executor)");
|
|
@@ -37,6 +39,7 @@ export function registerRunCommand(exec) {
|
|
|
37
39
|
rcmd.option("--in-place", "Run a register item in the current working tree (overrides run.register_execution; cannot be combined with --worktree)", false);
|
|
38
40
|
rcmd.option("--track-state", "Record claim/complete events (requires --task; --by optional, actor auto-derived from the resolved agent)", false);
|
|
39
41
|
rcmd.option("--archive-on-success", "Archive the generated plan to exec/plans/done/ after a successful in-place run", false);
|
|
42
|
+
rcmd.option("--integration-branch <repo=branch>", "With register worktree mode: integrate the declared product repository <repo> into the local branch <branch> for this run (repeatable; overrides repos[].integration_branch; resume reuses the value recorded at the start)", (value, previous = []) => [...previous, value]);
|
|
40
43
|
rcmd.option("--parallel <n>", "Number of worktree instances to run in parallel", "1");
|
|
41
44
|
rcmd.option("--worktree-base <path>", "Override worktree base directory");
|
|
42
45
|
rcmd.option("--strategy <s>", "Task selection strategy: critical-first|fifo (default: critical-first)");
|
|
@@ -47,9 +50,12 @@ export function registerRunCommand(exec) {
|
|
|
47
50
|
rcmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
|
|
48
51
|
rcmd.option("--agent-config <path>", "Deprecated alias for --exec-defaults");
|
|
49
52
|
rcmd.option("--edit-by <nickname>", "agent-members.yaml nickname for edit-mode tasks in --auto batch runs");
|
|
50
|
-
rcmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks in --auto batch runs");
|
|
53
|
+
rcmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks in --auto batch runs or register post-review");
|
|
51
54
|
rcmd.option("--executor-by <nickname>", "Executor nickname; with --register, also accepts PJR-ID=nickname assignments separated by commas. With --plan / --deliverable, runs the executor/reporter pipeline");
|
|
52
55
|
rcmd.option("--reporter-by <nickname>", "agent-members.yaml reporter nickname for agent_pipeline tasks (with --plan / --deliverable, runs the executor/reporter pipeline)");
|
|
56
|
+
rcmd.option("--on-rate-limit <action>", "Pinned-agent rate-limit action: stop|wait|fallback (overrides rate_limit_policy.pinned)");
|
|
57
|
+
rcmd.option("--fallback-executor-by <nickname>", "Fallback executor for a selected rate-limit fallback or configured connection error");
|
|
58
|
+
rcmd.option("--fallback-reporter-by <nickname>", "Fallback reporter for a selected rate-limit fallback or configured connection error");
|
|
53
59
|
rcmd.option("--dry-run", "Print resolved command without executing", false);
|
|
54
60
|
rcmd.action(async (opts) => {
|
|
55
61
|
try {
|
|
@@ -106,12 +112,28 @@ export function registerRunCommand(exec) {
|
|
|
106
112
|
const { schedulePath, executionPath } = resolveProjectPaths({ project: opts.project });
|
|
107
113
|
const execDefaults = loadExecDefaultsConfig(resolveExecDefaultsPath(opts, schedulePath), executionPath);
|
|
108
114
|
opts.worktree = resolveRegisterWorktree(opts, execDefaults);
|
|
115
|
+
opts.postReview = opts.postReview || resolveRegisterPostReview(execDefaults);
|
|
116
|
+
}
|
|
117
|
+
if (opts.postReview && !(hasRegister && opts.worktree)) {
|
|
118
|
+
process.stdout.write("--post-review (or run.register_post_review) requires --register in worktree mode.\n");
|
|
119
|
+
process.exitCode = 1;
|
|
120
|
+
return;
|
|
109
121
|
}
|
|
110
122
|
if (hasRegister && !opts.worktree && parseParallel(opts.parallel) !== 1) {
|
|
111
123
|
process.stdout.write("--parallel with --register requires worktree mode; use --worktree or configure run.register_execution: worktree.\n");
|
|
112
124
|
process.exitCode = 1;
|
|
113
125
|
return;
|
|
114
126
|
}
|
|
127
|
+
const integrationBranches = opts.integrationBranch ?? [];
|
|
128
|
+
if (integrationBranches.length > 0) {
|
|
129
|
+
if (!(hasRegister && opts.worktree)) {
|
|
130
|
+
process.stdout.write("--integration-branch requires --register (or --register-filter) in worktree mode.\n");
|
|
131
|
+
process.exitCode = 1;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// 形式・宣言済みリポジトリ・ローカルブランチの存在を、register の状態を変える前に確かめる。
|
|
135
|
+
configuredProductRepos(resolveProjectPaths({ project: opts.project }).schedulePath, integrationBranches);
|
|
136
|
+
}
|
|
115
137
|
if (opts.join && !(hasRegister && opts.worktree)) {
|
|
116
138
|
process.stdout.write("--join requires --register (or --register-filter) in worktree mode.\n");
|
|
117
139
|
process.exitCode = 1;
|
|
@@ -182,6 +204,11 @@ export function registerRunCommand(exec) {
|
|
|
182
204
|
process.exitCode = 1;
|
|
183
205
|
return;
|
|
184
206
|
}
|
|
207
|
+
if (opts.onRateLimit && !["stop", "wait", "fallback"].includes(opts.onRateLimit)) {
|
|
208
|
+
process.stdout.write('--on-rate-limit must be "stop", "wait", or "fallback".\n');
|
|
209
|
+
process.exitCode = 1;
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
185
212
|
if (opts.worktree && !hasTask && !hasRegister && !hasJob) {
|
|
186
213
|
process.stdout.write("--worktree requires --task, --register, or --job.\n");
|
|
187
214
|
process.exitCode = 1;
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { basename } from "node:path";
|
|
3
|
-
import { resolveMemberCommand, } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
3
|
+
import { resolveMemberCommand, } from "../agent-config.js";
|
|
4
|
+
import { resolveAgentMember, } from "../../shared/specdojo-config.js";
|
|
5
|
+
import { buildInPlaceStem } from "../plans.js";
|
|
6
|
+
import { generateRegisterPlan, normalizePjrId, requireRunnableRegisterItem, resolveRegisterRunTarget, sanitizeRegisterConclusion, selectRegisterCommitPaths, selectRegisterRunArtifactResidue, ticketPathFromItem, } from "../register.js";
|
|
7
|
+
import { registerEventFilePath } from "../../register/events.js";
|
|
8
|
+
import { displayIdFromTicketFilename } from "../../register/item.js";
|
|
9
|
+
import { isResultUnfilled, readResultFrontmatterSnapshot, scaffoldResult, updateResultStatus, } from "../results.js";
|
|
10
|
+
import { formatGitResultFailure, gitOutput, gitResult } from "../worktree.js";
|
|
11
|
+
import { stabilizeCommitTargets, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
12
|
+
import { resolveAgentOverride, resolvePinnedRateLimitRunOptions, rateLimitRecoveryReason, selectCandidates, } from "./shared.js";
|
|
13
|
+
import { expandPromptRefs } from "./agent.js";
|
|
14
|
+
import { runAgentPipeline } from "./agent-pipeline.js";
|
|
15
|
+
import { spawnAgentInPlace } from "./in-place.js";
|
|
16
|
+
import { commitSubject, repoRelativePath, spawnSelf } from "./mode-shared.js";
|
|
17
|
+
// CLI choices are the highest-priority layer. A difficulty route only supplies omitted stage and
|
|
18
|
+
// recovery options; without a matching route the historical priority-based selection is kept.
|
|
19
|
+
export function applyRegisterDifficultyRouting(item, opts, execDefaults) {
|
|
20
|
+
if (opts.by?.trim() || !item.difficulty)
|
|
21
|
+
return opts;
|
|
22
|
+
const route = execDefaults.routing?.[item.difficulty];
|
|
23
|
+
if (!route)
|
|
24
|
+
return opts;
|
|
25
|
+
return {
|
|
26
|
+
...opts,
|
|
27
|
+
executorBy: opts.executorBy ?? route.executor_by,
|
|
28
|
+
reporterBy: opts.reporterBy ?? route.reporter_by,
|
|
29
|
+
onRateLimit: opts.onRateLimit ?? route.on_rate_limit,
|
|
30
|
+
fallbackExecutorBy: opts.fallbackExecutorBy ?? route.fallback_executor_by,
|
|
31
|
+
fallbackReporterBy: opts.fallbackReporterBy ?? route.fallback_reporter_by,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
16
34
|
// --register の単一 agent 実行(--by 指定時)の agent を解決する。owner(Role code)や
|
|
17
35
|
// role からの自動選択は行わない(PJR-ADZ6)。agent は全員 stage_role を持つ pipeline
|
|
18
36
|
// メンバーであり、owner・role から選ぶと pipeline 用でない agent(翻訳専用など)や
|
|
@@ -24,11 +42,11 @@ export function resolveRegisterCommand(item, roster, opts, execDefaults = {}) {
|
|
|
24
42
|
throw new Error(`No agent specified for register item ${item.id} (owner: ${item.owner || "-"}). ` +
|
|
25
43
|
"Specify --by <nickname>, or --executor-by <nickname> --reporter-by <nickname>.");
|
|
26
44
|
}
|
|
27
|
-
const member = roster
|
|
45
|
+
const member = resolveAgentMember(roster, by);
|
|
28
46
|
const command = member ? resolveMemberCommand(execDefaults, member) : undefined;
|
|
29
|
-
if (!command)
|
|
47
|
+
if (!member || !command)
|
|
30
48
|
throw new Error(`Agent command not found for actor: ${by}`);
|
|
31
|
-
return { command, actor:
|
|
49
|
+
return { command, actor: member.nickname };
|
|
32
50
|
}
|
|
33
51
|
// --register を executor/reporter パイプラインで実行するかを判定する。--executor-by /
|
|
34
52
|
// --reporter-by の指定があれば pipeline、どちらも無く --by も無い場合も stage_role からの
|
|
@@ -163,11 +181,13 @@ export function commitRegisterItemChanges(repoRoot, item, preexisting, runnerMan
|
|
|
163
181
|
return { committed: false };
|
|
164
182
|
try {
|
|
165
183
|
stageCommitTargets(repoRoot, paths);
|
|
166
|
-
const
|
|
184
|
+
const stagedArgs = ["diff", "--cached", "--quiet", "--", ...paths];
|
|
185
|
+
const staged = gitResult(repoRoot, stagedArgs);
|
|
167
186
|
if (staged.status === 0)
|
|
168
187
|
return { committed: false };
|
|
169
|
-
if (staged.status !== 1)
|
|
170
|
-
throw new Error(
|
|
188
|
+
if (staged.status !== 1) {
|
|
189
|
+
throw new Error(`Failed to inspect staged register changes: ${formatGitResultFailure(stagedArgs, staged)}`);
|
|
190
|
+
}
|
|
171
191
|
const subject = commitSubject(`exec(register ${item.id}): `, item.title);
|
|
172
192
|
gitOutput(repoRoot, ["commit", "-m", subject, "--", ...paths]);
|
|
173
193
|
stabilizeCommitTargets(repoRoot, remainingPaths);
|
|
@@ -245,6 +265,10 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
245
265
|
const { planPath } = await generateRegisterPlan({
|
|
246
266
|
executionPath,
|
|
247
267
|
projectId,
|
|
268
|
+
...(context.catalogPath ? { catalogPath: context.catalogPath } : {}),
|
|
269
|
+
...(context.rolesPath ? { rolesPath: context.rolesPath } : {}),
|
|
270
|
+
...(context.viewpointsPath ? { viewpointsPath: context.viewpointsPath } : {}),
|
|
271
|
+
...(context.projectContext ? { projectContext: context.projectContext } : {}),
|
|
248
272
|
registerPaths,
|
|
249
273
|
item,
|
|
250
274
|
stem,
|
|
@@ -260,6 +284,7 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
260
284
|
agent: actor,
|
|
261
285
|
startedAt: new Date().toISOString(),
|
|
262
286
|
stem,
|
|
287
|
+
...(item.approach ? { approach: item.approach } : {}),
|
|
263
288
|
...(item.targets && item.targets.length > 0 ? { targets: item.targets } : {}),
|
|
264
289
|
});
|
|
265
290
|
const resultScaffold = readResultFrontmatterSnapshot(resultPath);
|
|
@@ -273,6 +298,7 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
273
298
|
}
|
|
274
299
|
let exitCode;
|
|
275
300
|
let pipelineBlockReason;
|
|
301
|
+
let transitionReason;
|
|
276
302
|
if (pipelineAgents) {
|
|
277
303
|
process.stdout.write(`Running ${item.id} in place (executor/reporter pipeline)\n`);
|
|
278
304
|
const pipelineOutcome = await runAgentPipeline({
|
|
@@ -289,9 +315,16 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
289
315
|
registerPaths: registerReporterManagedPaths(registerPaths),
|
|
290
316
|
execDefaults: context.execDefaults,
|
|
291
317
|
providerConcurrencyGate: context.providerConcurrencyGate,
|
|
318
|
+
executorRateLimitOptions: opts.executorBy
|
|
319
|
+
? resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "executor", pipelineAgents.executor)
|
|
320
|
+
: undefined,
|
|
321
|
+
reporterRateLimitOptions: opts.reporterBy
|
|
322
|
+
? resolvePinnedRateLimitRunOptions(opts, context.execDefaults, context.roster, "reporter", pipelineAgents.reporterCandidates[0])
|
|
323
|
+
: undefined,
|
|
292
324
|
});
|
|
293
325
|
exitCode = pipelineOutcome.exitCode;
|
|
294
326
|
pipelineBlockReason = pipelineOutcome.blockReason;
|
|
327
|
+
transitionReason = rateLimitRecoveryReason(pipelineOutcome.rateLimitEvents) || undefined;
|
|
295
328
|
if (pipelineOutcome.exitCode !== 0) {
|
|
296
329
|
process.stdout.write(`run blocked: ${item.id} (${pipelineOutcome.blockReason ?? "pipeline failed"})\n`);
|
|
297
330
|
}
|
|
@@ -316,7 +349,14 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
316
349
|
if (effectiveExit === 0) {
|
|
317
350
|
let transition = "review";
|
|
318
351
|
let reason;
|
|
319
|
-
if (!spawnRegisterTransition(projectId, [
|
|
352
|
+
if (!spawnRegisterTransition(projectId, [
|
|
353
|
+
"review",
|
|
354
|
+
"--id",
|
|
355
|
+
item.id,
|
|
356
|
+
"--by",
|
|
357
|
+
actor,
|
|
358
|
+
...(transitionReason ? ["--reason", transitionReason] : []),
|
|
359
|
+
])) {
|
|
320
360
|
process.stderr.write(`register review transition failed: ${item.id}\n`);
|
|
321
361
|
transition = "none";
|
|
322
362
|
reason = "register review transition failed";
|
|
@@ -362,7 +402,9 @@ export async function runSingleRegisterItem(context, opts, pjrId) {
|
|
|
362
402
|
process.stdout.write(`run done: ${item.id} (status: review — confirm and close with "register close")\n`);
|
|
363
403
|
return { id: item.id, title: item.title, outcome: "success", transition, commit, reason };
|
|
364
404
|
}
|
|
365
|
-
const waitingReason = sanitizeRegisterConclusion(blockReason ?? `agent exited with non-zero code (exit ${exitCode})
|
|
405
|
+
const waitingReason = sanitizeRegisterConclusion([blockReason ?? `agent exited with non-zero code (exit ${exitCode})`, transitionReason]
|
|
406
|
+
.filter(Boolean)
|
|
407
|
+
.join("; "));
|
|
366
408
|
if (!spawnRegisterTransition(projectId, [
|
|
367
409
|
"wait",
|
|
368
410
|
"--id",
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { loadExecDefaultsConfig, ProviderConcurrencyGate } from "
|
|
3
|
-
import { activateResolvedProjectPaths, resolveProjectPaths } from "
|
|
4
|
-
import { qualifyTaskId } from "
|
|
5
|
-
import { specdojoRootDir } from "
|
|
6
|
-
import { execLifecyclePoolPath, execLocksDir } from "./
|
|
7
|
-
import { CrossProcessMutex } from "
|
|
8
|
-
import { buildInPlaceStem } from "
|
|
9
|
-
import { formatRegisterRunSummary, parseRegisterIds, parseRegisterSelectionFilter, registerRunExitCode, requireRunnableRegisterItem, resolveRegisterRunTarget, selectRegisterItems, } from "
|
|
10
|
-
import { loadRegisterItems, resolveRegisterPaths } from "
|
|
11
|
-
import { findExecWorktree, resolveWorktreeBase } from "
|
|
12
|
-
import { findResumableRegisterRun } from "
|
|
13
|
-
import { configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, runCompletionDrivenWorkerPool, } from "./
|
|
14
|
-
import { loadRosterForExecutionPath } from "./
|
|
15
|
-
import { resolveRegisterCommand, isRegisterPipelineRequested, parseRegisterExecutorSelection, selectedRegisterExecutor, resolveRegisterPipelineCommand, runSingleRegisterItem, } from "./
|
|
16
|
-
import { runSingleRegisterItemWorktree } from "./
|
|
17
|
-
import { resumeSingleRegisterItemWorktree } from "./
|
|
2
|
+
import { loadExecDefaultsConfig, ProviderConcurrencyGate } from "../agent-config.js";
|
|
3
|
+
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
4
|
+
import { qualifyTaskId } from "../shared.js";
|
|
5
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
6
|
+
import { execLifecyclePoolPath, execLocksDir } from "./lock.js";
|
|
7
|
+
import { CrossProcessMutex } from "../slot-lock.js";
|
|
8
|
+
import { buildInPlaceStem } from "../plans.js";
|
|
9
|
+
import { formatRegisterRunSummary, parseRegisterIds, parseRegisterSelectionFilter, registerRunExitCode, requireRunnableRegisterItem, resolveRegisterRunTarget, selectRegisterItems, } from "../register.js";
|
|
10
|
+
import { loadRegisterItems, resolveRegisterPaths } from "../../register/register.js";
|
|
11
|
+
import { findExecWorktree, resolveWorktreeBase } from "../worktree.js";
|
|
12
|
+
import { findResumableRegisterRun } from "../register-resume.js";
|
|
13
|
+
import { configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, runCompletionDrivenWorkerPool, } from "./shared.js";
|
|
14
|
+
import { loadRosterForExecutionPath } from "./agent.js";
|
|
15
|
+
import { applyRegisterDifficultyRouting, resolveRegisterCommand, isRegisterPipelineRequested, parseRegisterExecutorSelection, selectedRegisterExecutor, resolveRegisterPipelineCommand, runSingleRegisterItem, } from "./register-core.js";
|
|
16
|
+
import { runSingleRegisterItemWorktree } from "./register-worktree.js";
|
|
17
|
+
import { resumeSingleRegisterItemWorktree } from "./register-resume.js";
|
|
18
|
+
import { resolveRegisterPostReviewAgents } from "./register-post-review.js";
|
|
18
19
|
// register 項目の実行(複数ID)。in-place モードは指定順に1件ずつ直列実行し、各IDが plan/result
|
|
19
20
|
// 生成・start・agent実行・review/waiting 遷移まで完結してから次へ進む。worktree モードは成果物を
|
|
20
21
|
// worktree に隔離し、状態遷移を root で直列化する(--parallel で並列化可能)。失敗時は
|
|
@@ -48,29 +49,46 @@ export async function runRegisterMode(opts) {
|
|
|
48
49
|
process.stdout.write("No matching register items.\n");
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
const hasExecutorSelection = executorSelection.kind !== "none";
|
|
52
|
-
const optsForItem = (pjrId) => ({
|
|
53
|
-
...opts,
|
|
54
|
-
executorBy: selectedRegisterExecutor(executorSelection, pjrId),
|
|
55
|
-
});
|
|
56
52
|
for (const duplicate of duplicates) {
|
|
57
53
|
process.stdout.write(`Skipping duplicate register item id: ${duplicate}\n`);
|
|
58
54
|
}
|
|
59
55
|
const failureMode = opts.onFailure
|
|
60
56
|
? opts.onFailure
|
|
61
57
|
: "stop";
|
|
62
|
-
// --executor-by / --reporter-by は両方揃って初めて pipeline モードになる。片方だけの指定は
|
|
63
|
-
// 曖昧なため、実行前に明示的なエラーで止める(isRegisterPipelineRequested は片方でも true を
|
|
64
|
-
// 返すため、resolveRegisterPipelineCommand 側の対称チェックとは別に、ここで早期に検知する)。
|
|
65
|
-
// 再開は state が示す段だけを実行する。stale executor の再実行では各 agent の明示指定を
|
|
66
|
-
// 個別に許可し、省略時は state に記録された actor を使う。
|
|
67
|
-
if (!opts.resume &&
|
|
68
|
-
((hasExecutorSelection && !opts.reporterBy) || (!hasExecutorSelection && opts.reporterBy))) {
|
|
69
|
-
throw new Error("--register pipeline execution requires both --executor-by and --reporter-by.");
|
|
70
|
-
}
|
|
71
58
|
const roster = loadRosterForExecutionPath(executionPath);
|
|
72
59
|
const execDefaults = loadExecDefaultsConfig(resolveExecDefaultsPath(opts, schedulePath), executionPath);
|
|
60
|
+
const optsForItem = (pjrId) => {
|
|
61
|
+
const { item } = resolveRegisterRunTarget(projectId, pjrId);
|
|
62
|
+
const itemOptions = {
|
|
63
|
+
...opts,
|
|
64
|
+
executorBy: selectedRegisterExecutor(executorSelection, pjrId),
|
|
65
|
+
};
|
|
66
|
+
const routed = applyRegisterDifficultyRouting(item, itemOptions, execDefaults);
|
|
67
|
+
// A resume without explicit stage overrides must keep the actors recorded in pipeline state.
|
|
68
|
+
// The route still supplies recovery behavior and fallbacks for those pinned actors.
|
|
69
|
+
return opts.resume
|
|
70
|
+
? {
|
|
71
|
+
...routed,
|
|
72
|
+
executorBy: itemOptions.executorBy,
|
|
73
|
+
reporterBy: itemOptions.reporterBy,
|
|
74
|
+
}
|
|
75
|
+
: routed;
|
|
76
|
+
};
|
|
77
|
+
// Validate the effective per-item selection before creating worktrees or changing register
|
|
78
|
+
// state. A route may supply the counterpart of one explicitly overridden stage.
|
|
79
|
+
if (!opts.resume) {
|
|
80
|
+
for (const pjrId of ids) {
|
|
81
|
+
const itemOpts = optsForItem(pjrId);
|
|
82
|
+
if ((itemOpts.executorBy && !itemOpts.reporterBy) ||
|
|
83
|
+
(!itemOpts.executorBy && itemOpts.reporterBy)) {
|
|
84
|
+
throw new Error("--register pipeline execution requires both --executor-by and --reporter-by, either explicitly or from the item's difficulty route.");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
73
88
|
const useWorktree = !!opts.worktree;
|
|
89
|
+
const postReviewAgents = opts.postReview
|
|
90
|
+
? resolveRegisterPostReviewAgents(roster, opts, execDefaults)
|
|
91
|
+
: undefined;
|
|
74
92
|
const parallel = parseParallel(opts.parallel);
|
|
75
93
|
const worktreeBase = resolveWorktreeBase(repoRoot, opts.worktreeBase, configuredWorktreeBase(schedulePath));
|
|
76
94
|
if (opts.dryRun && opts.resume) {
|
|
@@ -121,15 +139,23 @@ export async function runRegisterMode(opts) {
|
|
|
121
139
|
process.stdout.write(`[dry-run] command: ${command}\n`);
|
|
122
140
|
}
|
|
123
141
|
process.stdout.write(`[dry-run] plan: ${join(executionPath, "exec", "plans", `${stem}-plan.md`)}\n`);
|
|
142
|
+
if (postReviewAgents) {
|
|
143
|
+
process.stdout.write(`[dry-run] post-review executor: ${postReviewAgents.executor.actor}\n`);
|
|
144
|
+
process.stdout.write(`[dry-run] post-review reporter: ${postReviewAgents.reporterCandidates[0]?.actor}\n`);
|
|
145
|
+
}
|
|
124
146
|
}
|
|
125
147
|
process.stdout.write(`[dry-run] cwd: ${useWorktree ? `${worktreeBase}/<worktree>` : repoRoot}\n`);
|
|
126
|
-
process.stdout.write(`[dry-run] transitions: start (in-progress) → review on success / waiting on failure\n`);
|
|
148
|
+
process.stdout.write(`[dry-run] transitions: start (in-progress) → review on success / waiting on failure${postReviewAgents ? "; after integration, post-review closes eligible todo/issue items or returns incomplete items to waiting" : ""}\n`);
|
|
127
149
|
return;
|
|
128
150
|
}
|
|
129
151
|
const context = {
|
|
130
152
|
projectId,
|
|
131
153
|
schedulePath,
|
|
132
154
|
executionPath,
|
|
155
|
+
...(resolvedPaths.catalogPath ? { catalogPath: resolvedPaths.catalogPath } : {}),
|
|
156
|
+
...(resolvedPaths.rolesPath ? { rolesPath: resolvedPaths.rolesPath } : {}),
|
|
157
|
+
...(resolvedPaths.viewpointsPath ? { viewpointsPath: resolvedPaths.viewpointsPath } : {}),
|
|
158
|
+
...(resolvedPaths.projectContext ? { projectContext: resolvedPaths.projectContext } : {}),
|
|
133
159
|
repoRoot,
|
|
134
160
|
roster,
|
|
135
161
|
execDefaults,
|
|
@@ -137,6 +163,7 @@ export async function runRegisterMode(opts) {
|
|
|
137
163
|
// ロックディレクトリの枠で統制する。
|
|
138
164
|
providerConcurrencyGate: new ProviderConcurrencyGate(execDefaults, execLocksDir(executionPath)),
|
|
139
165
|
registerCommit: !!opts.registerCommit,
|
|
166
|
+
postReview: !!opts.postReview,
|
|
140
167
|
worktree: useWorktree,
|
|
141
168
|
worktreeBase,
|
|
142
169
|
};
|