specdojo 0.4.0 → 0.4.2
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 +65 -0
- package/README.md +8 -7
- package/dist/commands/init.js +88 -15
- package/dist/commands/night-orchestrator.js +287 -0
- package/dist/commands/orchestrator.js +10 -3
- package/dist/dashboard/timeline-build.js +4 -151
- package/dist/devcontainer/command.js +3 -1
- package/dist/devcontainer/scaffold.js +166 -5
- package/dist/exec/agent-config.js +60 -2
- package/dist/exec/events.js +17 -6
- package/dist/exec/parent-validation.js +14 -0
- package/dist/exec/pipeline-state.js +13 -0
- package/dist/exec/plans-core.js +16 -5
- package/dist/exec/plans-storage.js +11 -3
- package/dist/exec/register.js +23 -1
- package/dist/exec/repo-integration.js +1 -1
- package/dist/exec/reporter.js +113 -13
- package/dist/exec/results.js +36 -14
- package/dist/exec/run/agent-pipeline.js +3 -0
- package/dist/exec/run/agent.js +40 -5
- package/dist/exec/run/job.js +2 -2
- package/dist/exec/run/lifecycle-commands.js +2 -2
- package/dist/exec/run/register-command.js +23 -4
- package/dist/exec/run/register-core.js +17 -0
- package/dist/exec/run/register-mode.js +39 -16
- package/dist/exec/run/register-post-review.js +420 -0
- package/dist/exec/run/register-resume.js +27 -11
- package/dist/exec/run/register-worktree.js +66 -2
- package/dist/exec/run/run.js +1 -1
- package/dist/exec/run/shared.js +22 -24
- package/dist/exec/task-repos.js +102 -15
- package/dist/kata/kata.js +1 -1
- package/dist/register/core.js +17 -4
- package/dist/register/create-commands.js +62 -6
- package/dist/register/cross-project.js +134 -0
- package/dist/register/derivation.js +28 -7
- package/dist/register/event-merge.js +13 -1
- package/dist/register/events.js +4 -0
- package/dist/register/item.js +35 -5
- package/dist/register/migration.js +1 -0
- package/dist/register/register.js +47 -30
- package/dist/schedule/strategy-generate-scope.js +2 -1
- package/dist/shared/catalog-files.js +31 -0
- package/dist/shared/git.js +45 -15
- package/dist/shared/lefthook-scaffold.js +177 -0
- package/dist/shared/provider-scaffold.js +3 -2
- package/dist/shared/specdojo-config.js +87 -17
- package/dist/shared/text.js +4 -1
- package/dist/shared/timeline-index.js +125 -0
- package/dist/shared/workspace-scaffold.js +69 -0
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +2 -1
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +2 -0
- 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 +79 -11
- package/docs/ja/specdojo/guides/exec-operation-guide.md +39 -1
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +9 -3
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +4 -2
- package/docs/ja/specdojo/guides/quick-start-guide.md +31 -6
- package/docs/ja/specdojo/guides/register-operation-guide.md +54 -0
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +52 -6
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +1 -1
- package/docs/ja/specdojo/guides/waza-guide.md +1 -1
- package/docs/ja/specdojo/references/command-reference.md +138 -64
- package/docs/ja/specdojo/references/specdojo-config-reference.md +41 -12
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +5 -2
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +92 -18
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +6 -1
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +12 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +21 -0
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +40 -0
- package/package.json +17 -17
- package/templates/antigravity/README.md +1 -1
- package/templates/antigravity/orchestrator.md +61 -2
- package/templates/claude/agents/specdojo-orchestrator.md +61 -2
- package/templates/codex/README.md +17 -0
- package/templates/codex/agents/specdojo-orchestrator.toml +61 -2
- package/templates/codex/orchestrator.md +61 -2
- package/templates/devcontainer/devcontainer.json +3 -0
- package/templates/devcontainer/post-create.sh +15 -7
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +38 -5
- package/templates/devcontainer/remote-host/ssh-config.sample +3 -0
- package/templates/devcontainer/vim/vimrc +37 -0
- package/templates/init-agent-members.yaml +6 -6
- package/templates/init-exec-defaults.yaml +20 -1
- package/templates/lefthook/tools/install-lefthook.mjs +46 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +207 -0
- package/templates/opencode/README.md +6 -1
- package/templates/opencode/agents/specdojo-orchestrator.md +62 -3
- /package/dist/{shared → kata}/yaml-schema-modeline.js +0 -0
package/dist/exec/reporter.js
CHANGED
|
@@ -3,6 +3,7 @@ import { join, relative, resolve, sep } from "node:path";
|
|
|
3
3
|
import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, } from "./parent-validation.js";
|
|
4
4
|
import { getProjectExecutionPath, resolveRepoRoot, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
5
5
|
import { MAX_TEXT_LENGTH, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
|
|
6
|
+
import { repoEnvironmentVariableName } from "./task-repos.js";
|
|
6
7
|
export { REPORTER_OUTPUT_SCHEMA, REVIEW_VERDICTS, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
|
|
7
8
|
const REPORTER_FORMAT_ATTEMPTS = 3;
|
|
8
9
|
function isProjectConfig(value) {
|
|
@@ -154,9 +155,10 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
154
155
|
commands.add(command);
|
|
155
156
|
target.set(repo, commands);
|
|
156
157
|
};
|
|
157
|
-
// sandbox で実行できない検証を executor が not_run(親 runner
|
|
158
|
-
//
|
|
159
|
-
// failed は runner
|
|
158
|
+
// sandbox で実行できない検証を executor が not_run(親 runner へ委譲)または
|
|
159
|
+
// not_applicable と記録し、runner が同じリポジトリで同じコマンドを実行して通した場合は、
|
|
160
|
+
// 親検証の結果を正として満たされたものと扱う。executor の failed は runner の結果で
|
|
161
|
+
// 打ち消さない(PJR-2GZE、PJR-7AW0)。
|
|
160
162
|
for (const validation of evidence.validations) {
|
|
161
163
|
if (validation.status !== "passed")
|
|
162
164
|
continue;
|
|
@@ -173,16 +175,27 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
173
175
|
// `npm run check` のような合成コマンドを executor が not_run(親 runner へ委譲)とした場合は、
|
|
174
176
|
// 対象リポジトリの package.json の script を展開し、構成する各コマンドが同じリポジトリの
|
|
175
177
|
// 親検証か executor 自身の検証で通っていれば満たされたものとして扱う(PJR-SDWF)。
|
|
176
|
-
const
|
|
178
|
+
const validationCommandAndRepo = (command) => {
|
|
177
179
|
const manifest = commandManifest(normalizeValidationCommand(command), applicabilityOptions, specdojoConfig);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
return {
|
|
181
|
+
command: manifest.command,
|
|
182
|
+
repo: manifest.repoName ?? PARENT_VALIDATION_PROJECT_REPO,
|
|
183
|
+
scripts: manifest.scripts,
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const isPassedParentValidation = (command) => {
|
|
187
|
+
const target = validationCommandAndRepo(command);
|
|
188
|
+
return (runnerPassedCommandsByRepo.get(target.repo) ?? new Set()).has(target.command);
|
|
189
|
+
};
|
|
190
|
+
const isDelegatedValidationSatisfied = (command) => {
|
|
191
|
+
const target = validationCommandAndRepo(command);
|
|
192
|
+
if ((runnerPassedCommandsByRepo.get(target.repo) ?? new Set()).has(target.command)) {
|
|
181
193
|
return true;
|
|
182
|
-
|
|
183
|
-
const
|
|
194
|
+
}
|
|
195
|
+
const passedCommands = passedCommandsByRepo.get(target.repo) ?? new Set();
|
|
196
|
+
const components = compositeComponents(target.command, target.scripts);
|
|
184
197
|
return (components !== undefined &&
|
|
185
|
-
components.every((component) => isComponentSatisfied(component, passedCommands,
|
|
198
|
+
components.every((component) => isComponentSatisfied(component, passedCommands, target.scripts)));
|
|
186
199
|
};
|
|
187
200
|
// runner が担う検証(index build)の executor 側の not_run / not_applicable は満たしたものとする。
|
|
188
201
|
// runner の再生成が失敗した場合は worktree の準備で run が止まり、runner の記録に失敗が残れば
|
|
@@ -202,6 +215,10 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
202
215
|
runnerOwnedValidationReason(validation.command) !== undefined) {
|
|
203
216
|
return false;
|
|
204
217
|
}
|
|
218
|
+
if ((validation.status === "not_run" || validation.status === "not_applicable") &&
|
|
219
|
+
isPassedParentValidation(validation.command)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
205
222
|
if (validation.status === "not_applicable") {
|
|
206
223
|
return !isValidNotApplicableValidation(validation.command, validation.reason, applicabilityOptions);
|
|
207
224
|
}
|
|
@@ -279,6 +296,60 @@ export function runnerOwnedValidationReason(command) {
|
|
|
279
296
|
return "index は runner が worktree の準備と統合の前に再生成する";
|
|
280
297
|
}
|
|
281
298
|
const PROJECT_DOCUMENTS_ROOT = "docs/ja/projects/";
|
|
299
|
+
const hasExtension = (extensions) => (path) => {
|
|
300
|
+
const normalized = path.toLowerCase();
|
|
301
|
+
return extensions.some((extension) => normalized.endsWith(extension));
|
|
302
|
+
};
|
|
303
|
+
// The command-to-change mapping is kept in one place and mirrors the change-type rows in
|
|
304
|
+
// xep-common-conventions-template.md. Checks such as typecheck intentionally remain outside this
|
|
305
|
+
// table: PJR-8WBN requires their existing script-based applicability to stay unchanged.
|
|
306
|
+
const CHANGE_SCOPED_VALIDATIONS = [
|
|
307
|
+
{
|
|
308
|
+
pathCondition: "YAML ファイル(*.yaml / *.yml)",
|
|
309
|
+
matchesCommand: (command) => /^npm run validate:schema:file(?:\s|$)/u.test(command),
|
|
310
|
+
matchesPath: hasExtension([".yaml", ".yml"]),
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
pathCondition: "Prettier 対象ファイル(*.md / *.ts / *.js / *.json / *.yaml / *.yml)",
|
|
314
|
+
matchesCommand: (command) => /^(?:npx\s+)?prettier(?:\s|$)/u.test(command),
|
|
315
|
+
matchesPath: hasExtension([".md", ".ts", ".js", ".json", ".yaml", ".yml"]),
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
pathCondition: "Markdown ファイル(*.md)",
|
|
319
|
+
matchesCommand: (command) => /^npm run lint:md(?:\s|$)/u.test(command) ||
|
|
320
|
+
/^(?:npx\s+)?(?:markdownlint|markdownlint-cli2)(?:\s|$)/u.test(command) ||
|
|
321
|
+
/^node\s+\S*specdojo-docs-lint\.js\s+markdownlint(?:\s|$)/u.test(command),
|
|
322
|
+
matchesPath: hasExtension([".md"]),
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
function changedPathSides(path) {
|
|
326
|
+
return path.split(" -> ").map((side) => side.replaceAll("\\", "/").replace(/^\.\//u, ""));
|
|
327
|
+
}
|
|
328
|
+
function changePathsForCommand(changedPaths, repoName, config, projectId) {
|
|
329
|
+
const repoNames = declaredRepos(config, projectId).map((repo) => repo.name);
|
|
330
|
+
return changedPaths.flatMap(changedPathSides).flatMap((path) => {
|
|
331
|
+
if (repoName !== undefined) {
|
|
332
|
+
const prefix = `${repoName}:`;
|
|
333
|
+
return path.startsWith(prefix) ? [path.slice(prefix.length)] : [];
|
|
334
|
+
}
|
|
335
|
+
return repoNames.some((name) => path.startsWith(`${name}:`)) ? [] : [path];
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function changeScopedValidationApplicability(command, changedPaths, repoName, config, projectId) {
|
|
339
|
+
const validation = CHANGE_SCOPED_VALIDATIONS.find(({ matchesCommand }) => matchesCommand(command));
|
|
340
|
+
if (!validation)
|
|
341
|
+
return { recognized: false };
|
|
342
|
+
if (changedPaths === undefined)
|
|
343
|
+
return { recognized: true };
|
|
344
|
+
const relevantPaths = changePathsForCommand(changedPaths, repoName, config, projectId);
|
|
345
|
+
return relevantPaths.some(validation.matchesPath)
|
|
346
|
+
? { recognized: true, applicable: true }
|
|
347
|
+
: {
|
|
348
|
+
recognized: true,
|
|
349
|
+
applicable: false,
|
|
350
|
+
reason: `変更に ${validation.pathCondition} がない`,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
282
353
|
function changesReachProjectDocuments(changedPaths) {
|
|
283
354
|
return changedPaths
|
|
284
355
|
.flatMap((path) => path.split(" -> "))
|
|
@@ -336,6 +407,9 @@ export function mechanicallyNotApplicableReason(command, options = {}) {
|
|
|
336
407
|
return specdojo.applicable === false ? specdojo.reason : undefined;
|
|
337
408
|
}
|
|
338
409
|
const manifest = commandManifest(normalized, options, config);
|
|
410
|
+
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
|
|
411
|
+
if (changeScoped.applicable === false)
|
|
412
|
+
return changeScoped.reason;
|
|
339
413
|
const packageJson = manifest.repoName === undefined ? "package.json" : `${manifest.repoName} の package.json`;
|
|
340
414
|
const scriptName = invokedScriptNameOf(manifest.command);
|
|
341
415
|
if (scriptName !== undefined && !hasApplicableScript(manifest.scripts, scriptName)) {
|
|
@@ -358,11 +432,16 @@ function isValidNotApplicableValidation(command, reason, options) {
|
|
|
358
432
|
if (specdojo.recognized)
|
|
359
433
|
return specdojo.applicable !== true;
|
|
360
434
|
const manifest = commandManifest(normalized, options, config);
|
|
435
|
+
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
|
|
436
|
+
if (changeScoped.applicable === false)
|
|
437
|
+
return true;
|
|
361
438
|
const scriptName = invokedScriptNameOf(manifest.command);
|
|
362
439
|
if (scriptName !== undefined && hasApplicableScript(manifest.scripts, scriptName))
|
|
363
440
|
return false;
|
|
364
441
|
const packageName = npxPackageNameOf(manifest.command);
|
|
365
|
-
|
|
442
|
+
if (packageName !== undefined)
|
|
443
|
+
return !manifest.dependencies.has(packageName);
|
|
444
|
+
return true;
|
|
366
445
|
}
|
|
367
446
|
const PREFIX_OPTION_PATTERN = /(?:^|\s)--prefix(?:=|\s+)(\S+)(?=\s|$)/u;
|
|
368
447
|
function normalizeRepoPathText(path) {
|
|
@@ -380,8 +459,26 @@ function declaredRepos(config, projectId) {
|
|
|
380
459
|
typeof repo.path === "string");
|
|
381
460
|
}
|
|
382
461
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
462
|
+
* True when a command references a shell variable without mistaking a longer variable name for
|
|
463
|
+
* the requested one. Both `$NAME` and `${NAME}` forms are recognized.
|
|
464
|
+
*/
|
|
465
|
+
function referencesShellVariable(command, variable) {
|
|
466
|
+
if (command.includes("${" + variable + "}"))
|
|
467
|
+
return true;
|
|
468
|
+
const reference = `$${variable}`;
|
|
469
|
+
let offset = command.indexOf(reference);
|
|
470
|
+
while (offset >= 0) {
|
|
471
|
+
const next = command[offset + reference.length];
|
|
472
|
+
if (next === undefined || !/[A-Za-z0-9_]/u.test(next))
|
|
473
|
+
return true;
|
|
474
|
+
offset = command.indexOf(reference, offset + reference.length);
|
|
475
|
+
}
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Identifies a command that targets a declared product repository through `--prefix <repo>` (the
|
|
480
|
+
* repository name or its configured path), `$SPECDOJO_REPO_<NAME>` / its braced form, or a
|
|
481
|
+
* `<repo>:<path>` argument.
|
|
385
482
|
*/
|
|
386
483
|
function productRepoCommand(command, repos) {
|
|
387
484
|
const prefix = PREFIX_OPTION_PATTERN.exec(command)?.[1];
|
|
@@ -395,6 +492,9 @@ function productRepoCommand(command, repos) {
|
|
|
395
492
|
command: normalizeValidationCommand(command.replace(PREFIX_OPTION_PATTERN, " ")),
|
|
396
493
|
};
|
|
397
494
|
}
|
|
495
|
+
const environmentRepo = repos.find((candidate) => referencesShellVariable(command, repoEnvironmentVariableName(candidate.name)));
|
|
496
|
+
if (environmentRepo)
|
|
497
|
+
return { repo: environmentRepo, command };
|
|
398
498
|
const tokens = command.split(" ");
|
|
399
499
|
const repo = repos.find((candidate) => tokens.some((token) => token.startsWith(`${candidate.name}:`)));
|
|
400
500
|
return repo ? { repo, command } : undefined;
|
package/dist/exec/results.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSy
|
|
|
3
3
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
5
5
|
import { buildSpecdojoFrontmatter, parseSpecdojoDocument } from "../docs/frontmatter-namespace.js";
|
|
6
|
-
import { expandTemplate, stripTerminalControlSequences } from "./shared.js";
|
|
6
|
+
import { escapeMarkdownInline, expandTemplate, stripTerminalControlSequences } from "./shared.js";
|
|
7
7
|
import { formatMarkdownFile } from "./format.js";
|
|
8
8
|
import { deriveReporterFacts, mechanicallyNotApplicableReason, runnerOwnedValidationReason, } from "./reporter.js";
|
|
9
9
|
import { resolveSpecdojoPath, resolveSpecdojoPathIfExists } from "../docs/template-resolution.js";
|
|
@@ -325,10 +325,32 @@ function reporterInlineText(value) {
|
|
|
325
325
|
.replace(/>/g, ">")
|
|
326
326
|
.trim();
|
|
327
327
|
}
|
|
328
|
+
// reporter / executor 由来の自由記述は result の Markdown 本文へ直接入る。改行や山括弧を
|
|
329
|
+
// 正規化したうえで、強調と解釈される `_` / `*` 入りの ASCII トークンを code span にする。
|
|
330
|
+
// escapeMarkdownInline は既存の code span を保持するため、agent が意図して付けた書式は二重化しない。
|
|
331
|
+
function reporterFreeText(value) {
|
|
332
|
+
return escapeMarkdownInline(reporterInlineText(value));
|
|
333
|
+
}
|
|
334
|
+
// reporter や runner の文を `- ` の箇条書きに描くとき、文が自前のリスト記号(`1.`・`1)`・
|
|
335
|
+
// `-`・`*`・`+`)で始まると `- 1. ...` が入れ子のリストとして解釈され、markdownlint の
|
|
336
|
+
// MD029 などに当たって pre-commit hook で記帳の commit が失敗する。箇条書きの記号は runner が
|
|
337
|
+
// 付けるため、先頭の記号は外す(番号の意味は箇条書きの順序で保たれる)。
|
|
338
|
+
export function stripLeadingListMarker(text) {
|
|
339
|
+
let current = text.trim();
|
|
340
|
+
for (;;) {
|
|
341
|
+
const next = current.replace(/^(?:\d{1,9}[.)]|[-*+])(?:\s+|$)/u, "").trim();
|
|
342
|
+
if (next === current)
|
|
343
|
+
return current;
|
|
344
|
+
current = next;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
328
347
|
function reporterBulletList(values, empty) {
|
|
329
348
|
if (values.length === 0)
|
|
330
349
|
return `- ${empty}`;
|
|
331
|
-
return values
|
|
350
|
+
return values
|
|
351
|
+
.map((value) => reporterFreeText(stripLeadingListMarker(reporterInlineText(value))))
|
|
352
|
+
.map((text) => `- ${text || empty}`)
|
|
353
|
+
.join("\n");
|
|
332
354
|
}
|
|
333
355
|
function findGitRoot(startDir) {
|
|
334
356
|
try {
|
|
@@ -471,7 +493,7 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
471
493
|
const summary = reporterSummary !== undefined && reporterSummary.trim().length > 0
|
|
472
494
|
? reporterSummary
|
|
473
495
|
: formatMissingSummary(file, lineStats?.get(displayPath) ?? lineStats?.get(file.path));
|
|
474
|
-
return `- \`${reporterInlineText(displayPath).replace(/`/g, "'")}\`: ${
|
|
496
|
+
return `- \`${reporterInlineText(displayPath).replace(/`/g, "'")}\`: ${reporterFreeText(summary)}`;
|
|
475
497
|
})
|
|
476
498
|
.join("\n");
|
|
477
499
|
}
|
|
@@ -494,7 +516,7 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
494
516
|
}
|
|
495
517
|
const lines = [];
|
|
496
518
|
for (const entry of describedFiles) {
|
|
497
|
-
lines.push(`- \`${reporterInlineText(entry.displayPath).replace(/`/g, "'")}\`: ${
|
|
519
|
+
lines.push(`- \`${reporterInlineText(entry.displayPath).replace(/`/g, "'")}\`: ${reporterFreeText(entry.summary)}`);
|
|
498
520
|
}
|
|
499
521
|
const dirGroups = new Map();
|
|
500
522
|
for (const entry of undescribedFiles) {
|
|
@@ -546,20 +568,20 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
546
568
|
.filter((entry) => entry.status === "unchanged")
|
|
547
569
|
.map((entry) => {
|
|
548
570
|
const target = reporterInlineText(entry.target).replace(/`/g, "'");
|
|
549
|
-
return `対象 \`${target}\` は未変更: ${
|
|
571
|
+
return `対象 \`${target}\` は未変更: ${reporterFreeText(entry.reason)}`;
|
|
550
572
|
});
|
|
551
573
|
const humanValidationNotes = evidence.validations
|
|
552
574
|
.filter((validation) => validation.source !== "runner" && validation.status === "requires_human")
|
|
553
575
|
.map((validation) => {
|
|
554
576
|
const command = reporterInlineText(validation.command).replace(/`/g, "'");
|
|
555
|
-
const summary =
|
|
577
|
+
const summary = reporterFreeText(validation.summary) || "要約なし";
|
|
556
578
|
return `人の確認が必要: \`${command}\`(${summary})`;
|
|
557
579
|
});
|
|
558
580
|
const notApplicableValidationNotes = evidence.validations
|
|
559
581
|
.filter((validation) => validation.source !== "runner" && validation.status === "not_applicable")
|
|
560
582
|
.map((validation) => {
|
|
561
583
|
const command = reporterInlineText(validation.command).replace(/`/g, "'");
|
|
562
|
-
const reason =
|
|
584
|
+
const reason = reporterFreeText(validation.reason ?? "") || "理由なし";
|
|
563
585
|
return `適用外の検証: \`${command}\`(${reason})`;
|
|
564
586
|
});
|
|
565
587
|
const changedPaths = evidence.changes.map((change) => change.path);
|
|
@@ -570,7 +592,7 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
570
592
|
if (reason === undefined)
|
|
571
593
|
return [];
|
|
572
594
|
const command = reporterInlineText(validation.command).replace(/`/g, "'");
|
|
573
|
-
return [`runner が担う検証: \`${command}\`(${
|
|
595
|
+
return [`runner が担う検証: \`${command}\`(${reporterFreeText(reason)})`];
|
|
574
596
|
});
|
|
575
597
|
const runnerJudgedNotApplicableNotes = evidence.validations
|
|
576
598
|
.filter((validation) => validation.source !== "runner" && validation.status === "not_run")
|
|
@@ -579,11 +601,11 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
579
601
|
if (reason === undefined)
|
|
580
602
|
return [];
|
|
581
603
|
const command = reporterInlineText(validation.command).replace(/`/g, "'");
|
|
582
|
-
return [`適用外の検証(runner の判定): \`${command}\`(${
|
|
604
|
+
return [`適用外の検証(runner の判定): \`${command}\`(${reporterFreeText(reason)})`];
|
|
583
605
|
});
|
|
584
606
|
const rateLimitRecoveryNotes = (evidence.rate_limit_events ?? []).map((event) => event.action === "wait"
|
|
585
607
|
? `rate limit 後に ${event.resume_at ?? "再開可能時刻"} まで待ち、${event.to_actor} で ${event.resumed_at} に再開`
|
|
586
|
-
:
|
|
608
|
+
: `${event.trigger === "connection_error" ? "接続エラー" : "rate limit"}後に ${event.from_actor} から ${event.to_actor} へ切り替え、${event.resumed_at} に再開`);
|
|
587
609
|
return [
|
|
588
610
|
"# Edit Result",
|
|
589
611
|
"",
|
|
@@ -609,7 +631,7 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
609
631
|
"",
|
|
610
632
|
options?.approach ? "## 4. 進め方と実践の型の適用" : "## 4. 進め方",
|
|
611
633
|
"",
|
|
612
|
-
|
|
634
|
+
reporterFreeText(output.approach),
|
|
613
635
|
].join("\n");
|
|
614
636
|
}
|
|
615
637
|
// review result の章立ては xrr-template.md と一致させる。review は成果物を再評価しないため、
|
|
@@ -617,13 +639,13 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
617
639
|
function renderReviewReporterBody(output, evidence) {
|
|
618
640
|
const rateLimitRecoveryNotes = (evidence.rate_limit_events ?? []).map((event) => event.action === "wait"
|
|
619
641
|
? `rate limit 後に ${event.resume_at ?? "再開可能時刻"} まで待ち、${event.to_actor} で ${event.resumed_at} に再開`
|
|
620
|
-
:
|
|
642
|
+
: `${event.trigger === "connection_error" ? "接続エラー" : "rate limit"}後に ${event.from_actor} から ${event.to_actor} へ切り替え、${event.resumed_at} に再開`);
|
|
621
643
|
return [
|
|
622
644
|
"# Review Result",
|
|
623
645
|
"",
|
|
624
646
|
"## 1. 評価結果の確認",
|
|
625
647
|
"",
|
|
626
|
-
|
|
648
|
+
reporterFreeText(output.grade_check),
|
|
627
649
|
"",
|
|
628
650
|
"## 2. 判断根拠",
|
|
629
651
|
"",
|
|
@@ -635,7 +657,7 @@ function renderReviewReporterBody(output, evidence) {
|
|
|
635
657
|
"",
|
|
636
658
|
"## 4. approach に応じた確認",
|
|
637
659
|
"",
|
|
638
|
-
|
|
660
|
+
reporterFreeText(output.approach),
|
|
639
661
|
"",
|
|
640
662
|
"## 5. decision",
|
|
641
663
|
"",
|
|
@@ -157,6 +157,9 @@ export async function runAgentPipeline(params) {
|
|
|
157
157
|
plan_ref: relative(repoRoot, params.planPath).split(sep).join("/"),
|
|
158
158
|
result_ref: relative(cwd, resultPath).split(sep).join("/"),
|
|
159
159
|
},
|
|
160
|
+
...(params.integrationBranchOverrides
|
|
161
|
+
? { integrationBranches: { ...params.integrationBranchOverrides } }
|
|
162
|
+
: {}),
|
|
160
163
|
});
|
|
161
164
|
state = updatePipelineStage(state, "executor", { status: "running", started_at: startedAt }, startedAt);
|
|
162
165
|
writePipelineState(stateLocation.path, state);
|
package/dist/exec/run/agent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { basename, relative, resolve, sep } from "node:path";
|
|
4
|
-
import { resolveMemberCommand, resolveRateLimitDetection, resolveRateLimitPolicy, } from "../agent-config.js";
|
|
4
|
+
import { resolveConnectionErrorDetection, resolveMemberCommand, resolveRateLimitDetection, resolveRateLimitPolicy, } from "../agent-config.js";
|
|
5
5
|
import { decidePinnedWait, normalizeAgentLimit, } from "../limit.js";
|
|
6
6
|
import { replaceDocIndexRefs } from "../../docs/doc-index.js";
|
|
7
7
|
import { loadPlan, parsePlanTaskIdentity } from "../plans.js";
|
|
@@ -13,7 +13,7 @@ import { agentGitStateViolation, captureAgentGitStateAcrossRepos, changedAgentGi
|
|
|
13
13
|
import { recordGitStateBlockAcrossRepos, recordProtectedConfigBlockAcrossRepos, } from "../protection-handoff.js";
|
|
14
14
|
import { productRepoEnvironment, productRootsFromEnvironment, withAgentExtraRoots, withoutInheritedRepoEnvironment, } from "../task-repos.js";
|
|
15
15
|
import { gitEnvironment } from "../worktree.js";
|
|
16
|
-
import { isRateLimitError, resolveAgentOverride, selectCandidates, } from "./shared.js";
|
|
16
|
+
import { isConnectionError, isRateLimitError, resolveAgentOverride, selectCandidates, } from "./shared.js";
|
|
17
17
|
function delay(ms) {
|
|
18
18
|
return new Promise((resolveDelay) => setTimeout(resolveDelay, ms));
|
|
19
19
|
}
|
|
@@ -133,9 +133,14 @@ and does not block pipeline completion.
|
|
|
133
133
|
Use validation status \`not_applicable\` when the repository does not meet a check's applicability
|
|
134
134
|
conditions, and include a non-empty \`reason\`. The runner carries it into the result without
|
|
135
135
|
blocking completion, but rejects the claim when it can confirm the check applies:
|
|
136
|
-
- \`npm run <script>\` / \`npm test\`: the script exists in package.json
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
- \`npm run <script>\` / \`npm test\`: the script exists in package.json and any change-type
|
|
137
|
+
condition below is met. The placeholder \`test\` script that \`npm init\` writes
|
|
138
|
+
(\`echo "Error: no test specified" && exit 1\`) counts as absent.
|
|
139
|
+
- \`npx <package>\`: the package is in package.json dependencies or devDependencies and any
|
|
140
|
+
change-type condition below is met.
|
|
141
|
+
- \`npm run validate:schema:file\` requires a changed \`*.yaml\` or \`*.yml\` file; Prettier
|
|
142
|
+
requires a changed \`*.md\`, \`*.ts\`, \`*.js\`, \`*.json\`, \`*.yaml\`, or \`*.yml\` file;
|
|
143
|
+
markdownlint requires a changed \`*.md\` file.
|
|
139
144
|
- A command that targets a declared product repository (a \`<repo>:<path>\` argument or
|
|
140
145
|
\`--prefix <repo>\`) is judged by that repository's package.json, not the project repository's.
|
|
141
146
|
- \`specdojo catalog validate\`: the run's target project (or \`--project <id>\`) sets \`catalog_path\`
|
|
@@ -434,6 +439,18 @@ export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, r
|
|
|
434
439
|
lastStdout = attempt.stdout;
|
|
435
440
|
lastExitCode = attempt.exitCode;
|
|
436
441
|
lastLimit = attempt.limit;
|
|
442
|
+
const connectionError = attempt.result === "failure" &&
|
|
443
|
+
isConnectionError(attempt.exitCode, `${attempt.stdout}\n${attempt.stderr}`, resolveConnectionErrorDetection(execDefaults, candidate.provider));
|
|
444
|
+
if (connectionError) {
|
|
445
|
+
return {
|
|
446
|
+
result: "failure",
|
|
447
|
+
exitCode: attempt.exitCode,
|
|
448
|
+
stdout: attempt.stdout,
|
|
449
|
+
stderr: attempt.stderr,
|
|
450
|
+
connectionError: true,
|
|
451
|
+
actor: candidate.actor,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
437
454
|
if (attempt.result !== "rate_limit")
|
|
438
455
|
return {
|
|
439
456
|
result: attempt.result,
|
|
@@ -454,6 +471,22 @@ export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, r
|
|
|
454
471
|
};
|
|
455
472
|
const recoveryEvents = [];
|
|
456
473
|
const firstPass = await runPass(pinned ? candidates.slice(0, 1) : candidates);
|
|
474
|
+
if (firstPass.connectionError && pinned?.fallbackCandidate) {
|
|
475
|
+
const primary = candidates[0];
|
|
476
|
+
const fallback = pinned.fallbackCandidate;
|
|
477
|
+
const resumedAt = (pinned.now?.() ?? new Date()).toISOString();
|
|
478
|
+
process.stdout.write(`Connection error detected for pinned agent ${primary?.actor ?? "-"}. ` +
|
|
479
|
+
`Falling back to ${fallback.actor} at ${resumedAt}.\n`);
|
|
480
|
+
recoveryEvents.push({
|
|
481
|
+
action: "fallback",
|
|
482
|
+
trigger: "connection_error",
|
|
483
|
+
from_actor: primary?.actor ?? "unknown",
|
|
484
|
+
to_actor: fallback.actor,
|
|
485
|
+
resumed_at: resumedAt,
|
|
486
|
+
});
|
|
487
|
+
const fallbackResult = await runPass([fallback]);
|
|
488
|
+
return { ...fallbackResult, attempts, rateLimitEvents: recoveryEvents };
|
|
489
|
+
}
|
|
457
490
|
if (firstPass.result !== "rate_limit") {
|
|
458
491
|
return { ...firstPass, attempts, rateLimitEvents: recoveryEvents };
|
|
459
492
|
}
|
|
@@ -466,6 +499,7 @@ export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, r
|
|
|
466
499
|
`Falling back to ${fallback.actor} at ${resumedAt}.\n`);
|
|
467
500
|
recoveryEvents.push({
|
|
468
501
|
action: "fallback",
|
|
502
|
+
trigger: "rate_limit",
|
|
469
503
|
from_actor: primary?.actor ?? "unknown",
|
|
470
504
|
to_actor: fallback.actor,
|
|
471
505
|
resumed_at: resumedAt,
|
|
@@ -483,6 +517,7 @@ export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, r
|
|
|
483
517
|
const resumedAt = (pinned.now?.() ?? new Date()).toISOString();
|
|
484
518
|
recoveryEvents.push({
|
|
485
519
|
action: "wait",
|
|
520
|
+
trigger: "rate_limit",
|
|
486
521
|
from_actor: primary?.actor ?? "unknown",
|
|
487
522
|
to_actor: primary?.actor ?? "unknown",
|
|
488
523
|
resume_at: resumeAt.toISOString(),
|
package/dist/exec/run/job.js
CHANGED
|
@@ -6,7 +6,7 @@ import { loadExecDefaultsConfig, resolveMemberCommand, } from "../agent-config.j
|
|
|
6
6
|
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
7
7
|
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
8
8
|
import { ROUTINE_BUSY_SKIP_EXIT_CODE, ROUTINE_EXEC_ENV } from "./lock.js";
|
|
9
|
-
import { isResultUnfilled, readResultFrontmatterSnapshot, renderReporterResult, scaffoldResult, updateResultStatus, } from "../results.js";
|
|
9
|
+
import { isResultUnfilled, readResultFrontmatterSnapshot, renderReporterResult, scaffoldResult, stripLeadingListMarker, updateResultStatus, } from "../results.js";
|
|
10
10
|
import { formatMarkdownFile } from "../format.js";
|
|
11
11
|
import { completeJobRun, executeJobCommand, generateJobReviewPlan, isJobCommandTask, jobRunUsesReviewedIntegration, loadJobDefinition, loadJobRunRecord, materializeJobRun, recordJobRunReview, resolveJobPaths, resolveJobReviewAgentNominations, } from "../../job/job.js";
|
|
12
12
|
import { ensureExecWorktree, formatGitResultFailure, gitOutput, gitResult, resolveWorktreeBase, summarizeGitHookFailure, } from "../worktree.js";
|
|
@@ -276,7 +276,7 @@ async function fillIncompleteJobReviewResult(resultPath, reason) {
|
|
|
276
276
|
content = content
|
|
277
277
|
.replace(/_TODO_: 評価結果サイドカー[^\n]*/, `Job Run の review を完了できなかった: ${safeReason}`)
|
|
278
278
|
.replace(/_TODO_: 変更内容[^\n]*/, `- runner が review を完了できなかったため統合不可と判断した。`)
|
|
279
|
-
.replace(/_TODO_: 未充足事項[^\n]*/, `- ${safeReason}`)
|
|
279
|
+
.replace(/_TODO_: 未充足事項[^\n]*/, `- ${stripLeadingListMarker(safeReason) || "理由なし"}`)
|
|
280
280
|
.replace(/_TODO_: `approach`[^\n]*/, "Job Run の出力は変更していない。")
|
|
281
281
|
.replace(/- verdict: _TODO_([^\n]*)/, "- verdict: incomplete");
|
|
282
282
|
writeFileSync(resultPath, content, "utf8");
|
|
@@ -500,8 +500,8 @@ export function registerResumeCommand(exec) {
|
|
|
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
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");
|
|
504
|
-
cmd.option("--fallback-reporter-by <nickname>", "Fallback reporter after a rate limit");
|
|
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");
|
|
505
505
|
cmd.option("--parallel <n>", "Number of tasks to resume in parallel", "1");
|
|
506
506
|
cmd.option("--worktree-base <path>", "Override worktree base directory");
|
|
507
507
|
cmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { loadExecDefaultsConfig } from "../agent-config.js";
|
|
1
|
+
import { loadExecDefaultsConfig, resolveRegisterPostReview } from "../agent-config.js";
|
|
2
2
|
import { resolveProjectPaths } from "../project.js";
|
|
3
3
|
import { isRegisterFailureMode } from "../register.js";
|
|
4
|
+
import { configuredProductRepos } from "../task-repos.js";
|
|
4
5
|
import { EXCLUSIVE_EXEC_RUN, parseParallel, resolveExecDefaultsPath, resolveRegisterWorktree, withProjectExecRunLock, } from "./shared.js";
|
|
5
6
|
import { runBatchMode, runManualMode } from "./schedule-mode.js";
|
|
6
7
|
import { runInPlaceMode } from "./in-place.js";
|
|
@@ -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,12 +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)");
|
|
53
56
|
rcmd.option("--on-rate-limit <action>", "Pinned-agent rate-limit action: stop|wait|fallback (overrides rate_limit_policy.pinned)");
|
|
54
|
-
rcmd.option("--fallback-executor-by <nickname>", "Fallback executor
|
|
55
|
-
rcmd.option("--fallback-reporter-by <nickname>", "Fallback reporter
|
|
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");
|
|
56
59
|
rcmd.option("--dry-run", "Print resolved command without executing", false);
|
|
57
60
|
rcmd.action(async (opts) => {
|
|
58
61
|
try {
|
|
@@ -109,12 +112,28 @@ export function registerRunCommand(exec) {
|
|
|
109
112
|
const { schedulePath, executionPath } = resolveProjectPaths({ project: opts.project });
|
|
110
113
|
const execDefaults = loadExecDefaultsConfig(resolveExecDefaultsPath(opts, schedulePath), executionPath);
|
|
111
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;
|
|
112
121
|
}
|
|
113
122
|
if (hasRegister && !opts.worktree && parseParallel(opts.parallel) !== 1) {
|
|
114
123
|
process.stdout.write("--parallel with --register requires worktree mode; use --worktree or configure run.register_execution: worktree.\n");
|
|
115
124
|
process.exitCode = 1;
|
|
116
125
|
return;
|
|
117
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
|
+
}
|
|
118
137
|
if (opts.join && !(hasRegister && opts.worktree)) {
|
|
119
138
|
process.stdout.write("--join requires --register (or --register-filter) in worktree mode.\n");
|
|
120
139
|
process.exitCode = 1;
|
|
@@ -14,6 +14,23 @@ import { expandPromptRefs } from "./agent.js";
|
|
|
14
14
|
import { runAgentPipeline } from "./agent-pipeline.js";
|
|
15
15
|
import { spawnAgentInPlace } from "./in-place.js";
|
|
16
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
|
+
}
|
|
17
34
|
// --register の単一 agent 実行(--by 指定時)の agent を解決する。owner(Role code)や
|
|
18
35
|
// role からの自動選択は行わない(PJR-ADZ6)。agent は全員 stage_role を持つ pipeline
|
|
19
36
|
// メンバーであり、owner・role から選ぶと pipeline 用でない agent(翻訳専用など)や
|