specdojo 0.2.1 → 0.3.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 +165 -0
- package/CHANGELOG.md +298 -0
- package/README.md +92 -42
- package/dist/agent-response.js +20 -0
- package/dist/agent.js +4 -4
- package/dist/build-command.js +28 -8
- package/dist/catalog-build-references.js +144 -0
- package/dist/catalog-build-render.js +144 -0
- package/dist/catalog-build.js +13 -290
- package/dist/catalog-generate.js +6 -9
- package/dist/catalog-plan-generate.js +2 -2
- package/dist/catalog-plan.js +6 -6
- package/dist/catalog-scaffold.js +4 -4
- package/dist/catalog.js +2 -2
- package/dist/dashboard-exec-records.js +105 -0
- package/dist/dashboard-routines.js +255 -0
- package/dist/dashboard-shared.js +14 -0
- package/dist/dashboard-timeline.js +175 -0
- package/dist/dashboard.js +31 -444
- package/dist/deliverable-trash.js +3 -3
- package/dist/devcontainer-command.js +43 -0
- package/dist/devcontainer-scaffold.js +165 -0
- package/dist/doc-index.js +3 -3
- package/dist/exec-agent-config.js +107 -9
- package/dist/exec-agent-git-state.js +18 -0
- package/dist/exec-agent-protected-config.js +46 -8
- package/dist/exec-commands.js +557 -0
- package/dist/exec-core.js +457 -0
- package/dist/exec-evidence.js +254 -11
- package/dist/exec-handoff.js +336 -0
- package/dist/exec-parent-validation.js +317 -43
- package/dist/exec-pipeline-state.js +74 -9
- package/dist/exec-plans-core.js +693 -0
- package/dist/exec-plans-generation.js +206 -0
- package/dist/exec-plans-storage.js +131 -0
- package/dist/exec-plans.js +3 -1016
- package/dist/exec-protection-handoff.js +43 -2
- package/dist/exec-provider-scaffold.js +247 -15
- package/dist/exec-register-resume.js +65 -19
- package/dist/exec-register.js +9 -3
- package/dist/exec-repo-integration-git.js +23 -0
- package/dist/exec-repo-integration-sync.js +264 -0
- package/dist/exec-repo-integration.js +534 -0
- package/dist/exec-repo-trace.js +182 -0
- package/dist/exec-reporter-output.js +206 -0
- package/dist/exec-reporter.js +525 -248
- package/dist/exec-results.js +103 -71
- package/dist/exec-run-agent-pipeline.js +256 -0
- package/dist/exec-run-agent.js +531 -0
- package/dist/exec-run-in-place.js +541 -0
- package/dist/exec-run-job.js +717 -0
- package/dist/exec-run-lifecycle-commands.js +522 -0
- package/dist/exec-run-lock.js +110 -107
- package/dist/exec-run-mode-shared.js +140 -0
- package/dist/exec-run-register-command.js +244 -0
- package/dist/exec-run-register-core.js +386 -0
- package/dist/exec-run-register-mode.js +206 -0
- package/dist/exec-run-register-resume.js +393 -0
- package/dist/exec-run-register-state.js +322 -0
- package/dist/exec-run-register-worktree.js +509 -0
- package/dist/exec-run-schedule-mode.js +294 -0
- package/dist/exec-run-schedule-prepare.js +353 -0
- package/dist/exec-run-schedule-task.js +572 -0
- package/dist/exec-run-shared.js +399 -0
- package/dist/exec-run.js +11 -4953
- package/dist/exec-shared.js +9 -2
- package/dist/exec-slot-lock.js +242 -0
- package/dist/exec-task-repos.js +415 -0
- package/dist/exec-trial-commands.js +558 -0
- package/dist/exec-trial-core.js +371 -0
- package/dist/exec-trial.js +2 -895
- package/dist/exec-worktree-command.js +87 -43
- package/dist/exec-worktree-ops-commit.js +707 -0
- package/dist/exec-worktree-ops-lifecycle.js +292 -0
- package/dist/exec-worktree-ops-merge.js +303 -0
- package/dist/exec-worktree-ops.js +3 -847
- package/dist/exec-worktree.js +146 -31
- package/dist/exec.js +2 -999
- package/dist/frontmatter-namespace.js +2 -2
- package/dist/grade-apply.js +734 -0
- package/dist/grade-command-apply.js +250 -0
- package/dist/grade-command-inspect.js +138 -0
- package/dist/grade-command-plan.js +101 -0
- package/dist/grade-command-shared.js +68 -0
- package/dist/grade-core.js +307 -0
- package/dist/grade-markdown.js +274 -0
- package/dist/grade-pipeline-state.js +184 -0
- package/dist/grade-plan.js +507 -0
- package/dist/grade-result.js +133 -5
- package/dist/grade-target-discovery.js +265 -0
- package/dist/grade-targets.js +432 -0
- package/dist/grade.js +14 -2451
- package/dist/init-command.js +443 -0
- package/dist/job-definition.js +670 -0
- package/dist/job.js +64 -578
- package/dist/kata-command.js +2 -2
- package/dist/orchestrator.js +213 -0
- package/dist/register-command-types.js +1 -0
- package/dist/register-core.js +363 -0
- package/dist/register-create-commands.js +245 -0
- package/dist/register-event-merge.js +169 -0
- package/dist/register-events.js +4 -4
- package/dist/register-item.js +13 -7
- package/dist/register-maintenance-commands.js +187 -0
- package/dist/register-migration.js +268 -0
- package/dist/register-renumber.js +314 -0
- package/dist/register-transition-commands.js +248 -0
- package/dist/register-update.js +230 -0
- package/dist/register-views.js +256 -0
- package/dist/register.js +175 -1975
- package/dist/review-grade.js +252 -0
- package/dist/review-plan.js +114 -4
- package/dist/review-types.js +40 -1
- package/dist/routine-definition.js +401 -0
- package/dist/routine.js +73 -402
- package/dist/schedule-approach.js +2 -2
- package/dist/schedule-build.js +2 -2
- package/dist/schedule-strategy-generate-document.js +273 -0
- package/dist/schedule-strategy-generate-scope.js +199 -0
- package/dist/schedule-strategy-generate.js +9 -473
- package/dist/schedule.js +19 -6
- package/dist/specdojo-config.js +465 -20
- package/dist/specdojo-gitignore.js +135 -0
- package/dist/specdojo.js +6 -0
- package/dist/viewpoint-document-kinds-check.js +128 -0
- package/dist/yaml-pages.js +4 -4
- package/dist/yaml.js +28 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +348 -90
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +51 -17
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +7 -5
- package/docs/ja/specdojo/exec-templates/xrp-freeform-template.md +29 -31
- package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +34 -55
- package/docs/ja/specdojo/exec-templates/xrp-job-template.md +54 -0
- package/docs/ja/specdojo/exec-templates/xrp-recipe-guided-template.md +28 -37
- package/docs/ja/specdojo/exec-templates/xrp-recipe-maintenance-template.md +29 -34
- package/docs/ja/specdojo/exec-templates/xrp-retrofit-template.md +30 -30
- package/docs/ja/specdojo/exec-templates/xrp-rulebook-maintenance-template.md +29 -34
- package/docs/ja/specdojo/exec-templates/xrp-sample-maintenance-template.md +29 -34
- package/docs/ja/specdojo/exec-templates/xrp-template-maintenance-template.md +29 -34
- package/docs/ja/specdojo/exec-templates/xrp-template.md +29 -28
- package/docs/ja/specdojo/exec-templates/xrr-template.md +11 -9
- package/docs/ja/specdojo/guides/docs-editing-guide.md +20 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +103 -70
- package/docs/ja/specdojo/guides/exec-config-guide.md +93 -49
- package/docs/ja/specdojo/guides/exec-operation-guide.md +124 -27
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +40 -11
- package/docs/ja/specdojo/guides/kata-guide.md +4 -4
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +45 -22
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +1 -1
- package/docs/ja/specdojo/guides/practice-system-composition-guide.md +13 -13
- package/docs/ja/specdojo/guides/quick-start-guide.md +260 -30
- package/docs/ja/specdojo/guides/register-operation-guide.md +31 -14
- package/docs/ja/specdojo/guides/release-v0-3-0-migration-guide.md +264 -0
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +22 -1
- package/docs/ja/specdojo/guides/review-guide.md +195 -158
- package/docs/ja/specdojo/guides/routine-operation-guide.md +75 -10
- package/docs/ja/specdojo/guides/ryu-guide.md +32 -30
- package/docs/ja/specdojo/guides/schedule-design-guide.md +10 -10
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +1 -1
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +58 -33
- package/docs/ja/specdojo/guides/use-case-guide.md +3 -3
- package/docs/ja/specdojo/guides/waza-guide.md +15 -2
- package/docs/ja/specdojo/index.md +2 -2
- package/docs/ja/specdojo/philosophy/specdojo-philosophy.md +5 -5
- package/docs/ja/specdojo/recipes/bps-recipe.md +213 -0
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +52 -117
- package/docs/ja/specdojo/references/command-reference.md +335 -92
- package/docs/ja/specdojo/references/deliverables-reference.md +1 -1
- package/docs/ja/specdojo/references/directory-layout-reference.md +13 -9
- package/docs/ja/specdojo/references/specdojo-config-reference.md +107 -24
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +132 -220
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +6 -44
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +2 -0
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +0 -87
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +61 -39
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +0 -87
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +1 -33
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +0 -137
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +0 -247
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +0 -83
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +4 -2
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +78 -150
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +5 -4
- package/docs/ja/specdojo/rulebooks/sch-rulebook.md +1 -1
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +0 -11
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +0 -61
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +2 -47
- package/docs/ja/specdojo/samples/bps-sample.md +74 -21
- package/docs/ja/specdojo/samples/gl-sample.yaml +17 -1
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +28 -0
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +2 -67
- package/docs/ja/specdojo/samples/pm-organization-sample.md +8 -7
- package/docs/ja/specdojo/samples/pm-raci-sample.md +1 -1
- package/docs/ja/specdojo/samples/tml-sample.yaml +40 -0
- package/docs/ja/specdojo/standards/document-metadata-standard.md +21 -16
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +14 -14
- package/docs/ja/specdojo/standards/job-definition-standard.md +37 -17
- package/docs/ja/specdojo/standards/people-and-organization-definition-standard.md +37 -32
- package/docs/ja/specdojo/standards/philosophy-authoring-standard.md +1 -1
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +21 -11
- package/docs/ja/specdojo/templates/agent-members-template.yaml +25 -0
- package/docs/ja/specdojo/templates/bps-template.md +91 -0
- package/docs/ja/specdojo/templates/pm-members-template.yaml +2 -59
- package/docs/specdojo/schemas/v1/agent-members.schema.yaml +76 -0
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +4 -2
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +55 -2
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +93 -6
- package/docs/specdojo/schemas/v1/exec-reporter-output.schema.yaml +27 -78
- package/docs/specdojo/schemas/v1/gl.schema.yaml +87 -0
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +33 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +27 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +25 -0
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +49 -1
- package/docs/specdojo/schemas/v1/pm-members.schema.yaml +9 -169
- package/docs/specdojo/schemas/v1/pm-review-viewpoints.schema.yaml +100 -10
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +13 -0
- package/docs/specdojo/schemas/v1/routine-run.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/routine.schema.yaml +7 -0
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +110 -0
- package/package.json +17 -12
- package/templates/antigravity/README.md +29 -4
- package/templates/antigravity/{pm-members-snippet.yaml → agent-members-snippet.yaml} +8 -2
- package/templates/antigravity/exec-defaults-snippet.yaml +10 -7
- package/templates/antigravity/orchestrator.md +18 -7
- package/templates/antigravity/settings.global.json +55 -0
- package/templates/claude/agents/claude-executor.md +14 -0
- package/templates/claude/agents/claude-reporter.md +16 -0
- package/templates/claude/agents/specdojo-orchestrator.md +18 -7
- package/templates/claude/settings.edit.json +27 -1
- package/templates/codex/README.md +5 -4
- package/templates/codex/agents/specdojo-orchestrator.toml +18 -7
- package/templates/codex/orchestrator.md +18 -7
- package/templates/copilot/README.md +7 -5
- package/templates/copilot/{pm-members-snippet.yaml → agent-members-snippet.yaml} +4 -2
- package/templates/devcontainer/devcontainer.json +27 -0
- package/templates/devcontainer/emacs/init.el +88 -0
- package/templates/devcontainer/post-create.sh +62 -0
- package/templates/init-agent-members.yaml +200 -0
- package/templates/init-exec-defaults.yaml +74 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +18 -7
- package/docs/ja/specdojo/exec-templates/xrp-viewpoint-detail-template.md +0 -7
- package/docs/ja/specdojo/exec-templates/xrr-viewpoint-detail-template.md +0 -7
|
@@ -4,9 +4,10 @@ import { join, resolve } from "node:path";
|
|
|
4
4
|
import { acquireSchedulerLock, foldEventsToState, readAllEventFiles, releaseSchedulerLock, } from "./exec-events.js";
|
|
5
5
|
import { hasMemberCommandSource, loadExecDefaultsConfig, resolveMemberCommand, } from "./exec-agent-config.js";
|
|
6
6
|
import { activateResolvedProjectPaths, resolveProjectPaths } from "./exec-project.js";
|
|
7
|
-
import { agentGitStateViolation,
|
|
8
|
-
import { agentProtectedConfigViolation,
|
|
9
|
-
import {
|
|
7
|
+
import { agentGitStateViolation, captureAgentGitStateAcrossRepos, changedAgentGitStateAcrossRepos, qualifiedGitStateFields, } from "./exec-agent-git-state.js";
|
|
8
|
+
import { agentProtectedConfigViolation, captureAgentProtectedConfigAcrossRepos, changedAgentProtectedConfigAcrossRepos, qualifiedRepoPaths, } from "./exec-agent-protected-config.js";
|
|
9
|
+
import { recordGitStateBlockAcrossRepos, recordProtectedConfigBlockAcrossRepos, } from "./exec-protection-handoff.js";
|
|
10
|
+
import { configuredProductRepos, missingProductWorktrees, plannedProjectWorktreePath, pruneOrphanedProductExecBranches, productRepoEnvironment, withAgentExtraRoots, withoutInheritedRepoEnvironment, withProductRepoPrompt, withProductWorktrees, } from "./exec-task-repos.js";
|
|
10
11
|
import { buildTaskPhaseMap, loadPrompt, loadRosterForExecutionPath, resolveTaskPhaseContext, selectCandidates, } from "./exec-run.js";
|
|
11
12
|
import { buildScheduleIndex } from "./exec-schedule.js";
|
|
12
13
|
import { buildInitialStateFromStrategy } from "./exec-schedule-initial.js";
|
|
@@ -66,12 +67,19 @@ function requireDoingTask(schedulePath, taskId) {
|
|
|
66
67
|
}
|
|
67
68
|
return state;
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
// PJR-98G4: repos を宣言した project では、プロダクトの worktree もタスクの worktree として扱う。
|
|
71
|
+
function requireWorktree(context, worktreeTaskId) {
|
|
72
|
+
const found = findExecWorktree(context.repoRoot, worktreeTaskId);
|
|
73
|
+
if (!found)
|
|
72
74
|
throw new Error(`Worktree is not prepared for task: ${worktreeTaskId}`);
|
|
73
|
-
if (!existsSync(
|
|
74
|
-
throw new Error(`Registered worktree path does not exist: ${
|
|
75
|
+
if (!existsSync(found.path)) {
|
|
76
|
+
throw new Error(`Registered worktree path does not exist: ${found.path}`);
|
|
77
|
+
}
|
|
78
|
+
const products = configuredProductRepos(context.schedulePath);
|
|
79
|
+
const worktree = withProductWorktrees(found, products, worktreeTaskId);
|
|
80
|
+
const missing = missingProductWorktrees(products, worktree);
|
|
81
|
+
if (missing.length > 0) {
|
|
82
|
+
throw new Error(`Product worktrees are not prepared for task ${worktreeTaskId}: ${missing.join(", ")}`);
|
|
75
83
|
}
|
|
76
84
|
return worktree;
|
|
77
85
|
}
|
|
@@ -109,10 +117,13 @@ function resolveAgent(context, taskId, opts) {
|
|
|
109
117
|
const prompt = loadPrompt(context.executionPath, taskId);
|
|
110
118
|
if (!prompt)
|
|
111
119
|
throw new Error(`Plan not found for task: ${taskId}`);
|
|
112
|
-
return { actor: nickname, command, prompt };
|
|
120
|
+
return { actor: nickname, command, provider: member?.provider, prompt };
|
|
113
121
|
}
|
|
114
122
|
function printWorktree(worktree) {
|
|
115
123
|
process.stdout.write(`worktree: ${worktree.path}\nbranch: ${worktree.branch}\n`);
|
|
124
|
+
for (const product of worktree.repos ?? []) {
|
|
125
|
+
process.stdout.write(`repo ${product.name}: ${product.path} (${product.branch})\n`);
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
async function prepare(opts) {
|
|
118
129
|
const context = resolveContext(opts);
|
|
@@ -121,16 +132,29 @@ async function prepare(opts) {
|
|
|
121
132
|
const name = worktreeNameFromTaskId(worktreeTaskId);
|
|
122
133
|
const branch = `exec/${name}`;
|
|
123
134
|
const base = resolveWorktreeBase(context.repoRoot, opts.worktreeBase, configuredWorktreeBase(context.schedulePath));
|
|
135
|
+
const products = configuredProductRepos(context.schedulePath);
|
|
124
136
|
const planned = {
|
|
125
|
-
path:
|
|
137
|
+
path: plannedProjectWorktreePath(base, worktreeTaskId, products),
|
|
126
138
|
branch,
|
|
127
139
|
name,
|
|
128
140
|
created: false,
|
|
141
|
+
...(products.length > 0
|
|
142
|
+
? {
|
|
143
|
+
repos: products.map((product) => ({
|
|
144
|
+
name: product.name,
|
|
145
|
+
repoRoot: product.repoRoot,
|
|
146
|
+
path: resolve(base, name, product.name),
|
|
147
|
+
branch,
|
|
148
|
+
created: false,
|
|
149
|
+
})),
|
|
150
|
+
}
|
|
151
|
+
: {}),
|
|
129
152
|
};
|
|
130
153
|
if (opts.dryRun) {
|
|
131
154
|
process.stdout.write(`[dry-run] claim actor: ${state.actor}\n`);
|
|
132
155
|
process.stdout.write(`[dry-run] checkpoint: exec(${opts.task}): prepare execution\n`);
|
|
133
|
-
|
|
156
|
+
const existing = findExecWorktree(context.repoRoot, worktreeTaskId);
|
|
157
|
+
printWorktree(existing ? withProductWorktrees(existing, products, worktreeTaskId) : planned);
|
|
134
158
|
return;
|
|
135
159
|
}
|
|
136
160
|
let lockDir = "";
|
|
@@ -166,6 +190,7 @@ async function prepare(opts) {
|
|
|
166
190
|
base,
|
|
167
191
|
checkpointPaths: [planPath, resultPath, lockedState.claimEventPath],
|
|
168
192
|
commitMessage: `exec(${opts.task}): prepare execution`,
|
|
193
|
+
products,
|
|
169
194
|
});
|
|
170
195
|
printWorktree(worktree);
|
|
171
196
|
}
|
|
@@ -178,16 +203,19 @@ function status(opts) {
|
|
|
178
203
|
const context = resolveContext(opts);
|
|
179
204
|
const state = taskExecutionState(context.schedulePath, opts.task);
|
|
180
205
|
const worktreeTaskId = qualifyTaskId(context.projectId, opts.task);
|
|
181
|
-
const
|
|
206
|
+
const found = findExecWorktree(context.repoRoot, worktreeTaskId);
|
|
207
|
+
const products = configuredProductRepos(context.schedulePath);
|
|
182
208
|
const branch = `exec/${worktreeNameFromTaskId(worktreeTaskId)}`;
|
|
183
209
|
process.stdout.write(`task: ${opts.task}\nstate: ${state.state}\n`);
|
|
184
210
|
process.stdout.write(`claim-actor: ${state.actor ?? "not found"}\n`);
|
|
185
|
-
if (!
|
|
211
|
+
if (!found) {
|
|
186
212
|
const base = resolveWorktreeBase(context.repoRoot, opts.worktreeBase, configuredWorktreeBase(context.schedulePath));
|
|
187
|
-
|
|
213
|
+
const expected = plannedProjectWorktreePath(base, worktreeTaskId, products);
|
|
214
|
+
process.stdout.write(`worktree: not prepared (expected ${expected})\n`);
|
|
188
215
|
process.stdout.write(`branch: ${branch}\n`);
|
|
189
216
|
return;
|
|
190
217
|
}
|
|
218
|
+
const worktree = withProductWorktrees(found, products, worktreeTaskId);
|
|
191
219
|
const { planRel, resultRel } = taskPaths(context, opts.task);
|
|
192
220
|
const compareBase = gitOutput(context.repoRoot, ["merge-base", "HEAD", branch]).trim();
|
|
193
221
|
const merged = gitResult(context.repoRoot, ["merge-base", "--is-ancestor", branch, "HEAD"]).status === 0;
|
|
@@ -206,60 +234,71 @@ function status(opts) {
|
|
|
206
234
|
const changes = worktreeStatusPaths(worktree.path);
|
|
207
235
|
process.stdout.write(`uncommitted: ${changes.length > 0 ? changes.join(", ") : "none"}\n`);
|
|
208
236
|
process.stdout.write(`merged-into-current: ${merged ? "yes" : "no"}\n`);
|
|
237
|
+
for (const name of missingProductWorktrees(products, worktree)) {
|
|
238
|
+
process.stdout.write(`repo ${name}: not prepared\n`);
|
|
239
|
+
}
|
|
240
|
+
for (const product of worktree.repos ?? []) {
|
|
241
|
+
const productChanges = worktreeStatusPaths(product.path).map((path) => `${product.name}:${path}`);
|
|
242
|
+
process.stdout.write(`repo ${product.name} uncommitted: ${productChanges.length > 0 ? productChanges.join(", ") : "none"}\n`);
|
|
243
|
+
}
|
|
209
244
|
}
|
|
210
245
|
async function agent(opts) {
|
|
211
246
|
const context = resolveContext(opts);
|
|
212
|
-
const worktree = requireWorktree(context
|
|
247
|
+
const worktree = requireWorktree(context, qualifyTaskId(context.projectId, opts.task));
|
|
213
248
|
requireInsideWorktree(context.repoRoot, worktree);
|
|
214
249
|
const resolved = resolveAgent(context, opts.task, opts);
|
|
250
|
+
const productDirs = (worktree.repos ?? []).map((product) => product.path);
|
|
251
|
+
const command = withAgentExtraRoots(resolved.command, resolved.provider, productDirs);
|
|
215
252
|
if (opts.dryRun) {
|
|
216
253
|
process.stdout.write(`[dry-run] actor: ${resolved.actor}\n`);
|
|
217
|
-
process.stdout.write(`[dry-run] command: ${
|
|
254
|
+
process.stdout.write(`[dry-run] command: ${command}\n`);
|
|
218
255
|
process.stdout.write(`[dry-run] cwd: ${worktree.path}\n`);
|
|
219
256
|
process.stdout.write(`[dry-run] plan: ${resolved.prompt.length} chars\n`);
|
|
220
257
|
return;
|
|
221
258
|
}
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
259
|
+
const agentRepos = [
|
|
260
|
+
{ root: worktree.path },
|
|
261
|
+
...(worktree.repos ?? []).map((product) => ({ name: product.name, root: product.path })),
|
|
262
|
+
];
|
|
263
|
+
const protectedConfigBefore = captureAgentProtectedConfigAcrossRepos(agentRepos);
|
|
264
|
+
const gitStateBefore = captureAgentGitStateAcrossRepos(agentRepos);
|
|
265
|
+
const child = spawn(command, {
|
|
225
266
|
cwd: worktree.path,
|
|
226
267
|
env: {
|
|
227
|
-
...gitEnvironment(),
|
|
268
|
+
...withoutInheritedRepoEnvironment(gitEnvironment()),
|
|
228
269
|
SPECDOJO_SCHEDULE_PATH: context.schedulePath,
|
|
229
270
|
SPECDOJO_EXECUTION_PATH: context.executionPath,
|
|
271
|
+
...productRepoEnvironment(worktree.path, worktree.repos),
|
|
230
272
|
},
|
|
231
273
|
shell: true,
|
|
232
274
|
stdio: ["pipe", "inherit", "inherit"],
|
|
233
275
|
});
|
|
234
|
-
child.stdin.end(resolved.prompt);
|
|
276
|
+
child.stdin.end(withProductRepoPrompt(resolved.prompt, worktree.repos));
|
|
235
277
|
const exitCode = await new Promise((resolveExit) => {
|
|
236
278
|
child.once("error", () => resolveExit(1));
|
|
237
279
|
child.once("close", (code) => resolveExit(code ?? 1));
|
|
238
280
|
});
|
|
239
281
|
// 保護機構が block した場合も、対象と提案差分を worktree 側 result の申し送りへ残す。
|
|
240
282
|
const worktreeResultPath = resolve(worktree.path, taskPaths(context, opts.task).resultRel);
|
|
241
|
-
const protectedConfigChanges =
|
|
283
|
+
const protectedConfigChanges = changedAgentProtectedConfigAcrossRepos(protectedConfigBefore);
|
|
242
284
|
if (protectedConfigChanges.length > 0) {
|
|
243
|
-
const reason = agentProtectedConfigViolation(protectedConfigChanges);
|
|
285
|
+
const reason = agentProtectedConfigViolation(qualifiedRepoPaths(protectedConfigChanges));
|
|
244
286
|
process.stderr.write(`blocked: ${reason}\n`);
|
|
245
|
-
|
|
287
|
+
recordProtectedConfigBlockAcrossRepos({
|
|
246
288
|
resultPath: worktreeResultPath,
|
|
247
|
-
|
|
248
|
-
paths: protectedConfigChanges,
|
|
289
|
+
changes: protectedConfigChanges,
|
|
249
290
|
reason,
|
|
250
291
|
});
|
|
251
292
|
process.exitCode = 1;
|
|
252
293
|
return;
|
|
253
294
|
}
|
|
254
|
-
const gitStateChanges =
|
|
295
|
+
const gitStateChanges = changedAgentGitStateAcrossRepos(gitStateBefore);
|
|
255
296
|
if (gitStateChanges.length > 0) {
|
|
256
|
-
const reason = agentGitStateViolation(gitStateChanges);
|
|
297
|
+
const reason = agentGitStateViolation(qualifiedGitStateFields(gitStateChanges));
|
|
257
298
|
process.stderr.write(`blocked: ${reason}\n`);
|
|
258
|
-
|
|
299
|
+
recordGitStateBlockAcrossRepos({
|
|
259
300
|
resultPath: worktreeResultPath,
|
|
260
|
-
|
|
261
|
-
before: gitStateBefore,
|
|
262
|
-
fields: gitStateChanges,
|
|
301
|
+
changes: gitStateChanges,
|
|
263
302
|
reason,
|
|
264
303
|
});
|
|
265
304
|
process.exitCode = 1;
|
|
@@ -271,7 +310,7 @@ async function agent(opts) {
|
|
|
271
310
|
function commit(opts) {
|
|
272
311
|
const context = resolveContext(opts);
|
|
273
312
|
requireDoingTask(context.schedulePath, opts.task);
|
|
274
|
-
const worktree = requireWorktree(context
|
|
313
|
+
const worktree = requireWorktree(context, qualifyTaskId(context.projectId, opts.task));
|
|
275
314
|
requireInsideWorktree(context.repoRoot, worktree);
|
|
276
315
|
commitWorktreeChanges({
|
|
277
316
|
context,
|
|
@@ -283,7 +322,7 @@ function commit(opts) {
|
|
|
283
322
|
}
|
|
284
323
|
function merge(opts) {
|
|
285
324
|
const context = resolveContext(opts);
|
|
286
|
-
const worktree = requireWorktree(context
|
|
325
|
+
const worktree = requireWorktree(context, qualifyTaskId(context.projectId, opts.task));
|
|
287
326
|
// prepare left the root's own copies of the checkpoint files uncommitted (the exec branch
|
|
288
327
|
// carries the commit). Release them so the merge can bring the committed versions in.
|
|
289
328
|
const { claimEventPath } = taskExecutionState(context.schedulePath, opts.task);
|
|
@@ -303,7 +342,7 @@ function merge(opts) {
|
|
|
303
342
|
}
|
|
304
343
|
function remove(opts) {
|
|
305
344
|
const context = resolveContext(opts);
|
|
306
|
-
const worktree = requireWorktree(context
|
|
345
|
+
const worktree = requireWorktree(context, qualifyTaskId(context.projectId, opts.task));
|
|
307
346
|
removeWorktree({
|
|
308
347
|
context,
|
|
309
348
|
worktree,
|
|
@@ -324,17 +363,22 @@ function prune(opts) {
|
|
|
324
363
|
projectId,
|
|
325
364
|
dryRun: opts.dryRun,
|
|
326
365
|
});
|
|
327
|
-
|
|
366
|
+
// PJR-98G4: 宣言済みのプロダクトリポジトリでも、同じ project の孤児 exec branch を検出する。
|
|
367
|
+
const productOrphaned = pruneOrphanedProductExecBranches({
|
|
368
|
+
products: configuredProductRepos(context.schedulePath),
|
|
369
|
+
projectId,
|
|
370
|
+
dryRun: opts.dryRun,
|
|
371
|
+
});
|
|
372
|
+
if (orphaned.length === 0 && productOrphaned.length === 0) {
|
|
328
373
|
process.stdout.write(`No orphaned exec branches for project ${projectId}.\n`);
|
|
329
374
|
return;
|
|
330
375
|
}
|
|
376
|
+
const describe = (merged) => merged ? (opts.dryRun ? "would delete (merged)" : "deleted (merged)") : "kept (not merged)";
|
|
331
377
|
for (const item of orphaned) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
: "kept (not merged)";
|
|
337
|
-
process.stdout.write(`${item.branch}: ${action}\n`);
|
|
378
|
+
process.stdout.write(`${item.branch}: ${describe(item.mergedIntoCurrent)}\n`);
|
|
379
|
+
}
|
|
380
|
+
for (const item of productOrphaned) {
|
|
381
|
+
process.stdout.write(`${item.repo}:${item.branch}: ${describe(item.mergedIntoTarget)}\n`);
|
|
338
382
|
}
|
|
339
383
|
}
|
|
340
384
|
function addCommonOptions(command) {
|
|
@@ -366,7 +410,7 @@ export function registerExecWorktreeCommands(exec) {
|
|
|
366
410
|
}
|
|
367
411
|
});
|
|
368
412
|
const agentCommand = addCommonOptions(worktree.command("agent").description("Run the task agent once inside its worktree"));
|
|
369
|
-
agentCommand.option("--by <nickname>", "Select
|
|
413
|
+
agentCommand.option("--by <nickname>", "Select an agent-members.yaml nickname");
|
|
370
414
|
agentCommand.option("--dry-run", "Print the resolved command without executing", false);
|
|
371
415
|
agentCommand.action(async (opts) => {
|
|
372
416
|
try {
|