specdojo 0.8.0 → 0.9.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 +4 -1
- package/CHANGELOG.md +77 -0
- package/dist/catalog/catalog.js +16 -14
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +4 -2
- package/dist/commands/orchestrator.js +5 -77
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard.js +5 -3
- package/dist/dashboard/routines.js +4 -7
- package/dist/dashboard/shared.js +2 -2
- package/dist/dashboard/timeline.js +14 -14
- package/dist/deliverable/trash.js +2 -1
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +146 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +9 -0
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +31 -18
- package/dist/exec/events.js +34 -14
- package/dist/exec/evidence.js +13 -3
- package/dist/exec/opencode-permissions.js +117 -0
- package/dist/exec/parent-validation.js +56 -3
- package/dist/exec/plans-core.js +21 -2
- package/dist/exec/plans-generation.js +6 -7
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +82 -0
- package/dist/exec/repo-integration-sync.js +17 -5
- package/dist/exec/repo-trace.js +2 -1
- package/dist/exec/reporter.js +2 -2
- package/dist/exec/results.js +24 -4
- package/dist/exec/review-kata.js +4 -1
- package/dist/exec/run/agent-pipeline.js +3 -2
- package/dist/exec/run/agent.js +12 -6
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +5 -2
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +56 -19
- package/dist/exec/run/lifecycle-commands.js +1 -1
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/register-command.js +8 -5
- package/dist/exec/run/register-mode.js +68 -8
- package/dist/exec/run/register-resume.js +68 -14
- package/dist/exec/run/register-state.js +13 -8
- package/dist/exec/run/register-worktree.js +140 -125
- package/dist/exec/run/schedule-mode.js +75 -14
- package/dist/exec/run/schedule-prepare.js +3 -0
- package/dist/exec/run/schedule-task.js +88 -38
- package/dist/exec/run/shared.js +5 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +2 -2
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +13 -3
- package/dist/exec/task-repos.js +19 -4
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trial-commands.js +5 -2
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +12 -2
- package/dist/exec/worktree-ops-commit.js +2 -2
- package/dist/exec/worktree.js +13 -2
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +5 -3
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +5 -1
- package/dist/grade/run.js +64 -8
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +79 -23
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/maintenance-commands.js +2 -2
- package/dist/register/register.js +31 -7
- package/dist/register/renumber.js +1 -3
- package/dist/routine/definition.js +9 -0
- package/dist/routine/routine.js +137 -43
- package/dist/routine/status.js +62 -0
- package/dist/schedule/schedule.js +38 -39
- package/dist/shared/agent-types.js +5 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +44 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/specdojo-config.js +34 -20
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +17 -1
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +2 -0
- package/docs/ja/specdojo/guides/exec-config-guide.md +23 -4
- package/docs/ja/specdojo/guides/exec-operation-guide.md +44 -1
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +1 -1
- package/docs/ja/specdojo/guides/quick-start-guide.md +3 -3
- package/docs/ja/specdojo/guides/register-operation-guide.md +1 -1
- package/docs/ja/specdojo/guides/routine-operation-guide.md +11 -6
- package/docs/ja/specdojo/guides/schedule-design-guide.md +20 -17
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +66 -49
- package/docs/ja/specdojo/recipes/bes-recipe.md +90 -54
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +40 -47
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +91 -110
- package/docs/ja/specdojo/recipes/cnd-recipe.md +79 -69
- package/docs/ja/specdojo/recipes/cpd-recipe.md +78 -64
- package/docs/ja/specdojo/recipes/cxd-recipe.md +92 -75
- package/docs/ja/specdojo/recipes/ifd-recipe.md +79 -68
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +78 -105
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +105 -71
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -51
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +69 -56
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +37 -56
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -53
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -79
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -93
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -157
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +79 -109
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +78 -55
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +82 -73
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +78 -59
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +258 -118
- package/docs/ja/specdojo/references/deliverables-reference.md +21 -12
- package/docs/ja/specdojo/references/specdojo-config-reference.md +47 -10
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +19 -28
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +16 -67
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +30 -51
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +41 -61
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +22 -50
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +13 -38
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +41 -76
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +21 -46
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +27 -48
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +37 -50
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +52 -69
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +16 -32
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +23 -56
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +39 -47
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +37 -56
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +118 -175
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +5 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +59 -81
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +51 -61
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +38 -45
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +26 -38
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +26 -107
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +42 -49
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +21 -44
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +14 -38
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +11 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +91 -106
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +37 -45
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +45 -46
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +37 -48
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +25 -29
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +36 -41
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +5 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +16 -37
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +39 -57
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +39 -49
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +42 -49
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +64 -89
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +6 -12
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +49 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +51 -60
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +46 -50
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +39 -64
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -70
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +41 -108
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bds-sample.md +58 -71
- package/docs/ja/specdojo/samples/bes-index-sample.md +20 -37
- package/docs/ja/specdojo/samples/bes-sample.md +43 -53
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +40 -52
- package/docs/ja/specdojo/samples/ccd-sample.md +0 -1
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +47 -63
- package/docs/ja/specdojo/samples/clis-sample.md +70 -77
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-organization-sample.md +39 -50
- package/docs/ja/specdojo/samples/pm-plan-sample.md +61 -67
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +31 -45
- package/docs/ja/specdojo/samples/pm-raci-sample.md +31 -37
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +32 -48
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +55 -61
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +13 -55
- package/docs/ja/specdojo/samples/sf-sample.md +73 -85
- package/docs/ja/specdojo/samples/sld-sample.md +60 -79
- package/docs/ja/specdojo/samples/uis-sample.md +98 -121
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +2 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +42 -5
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +35 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +9 -6
- package/templates/antigravity/orchestrator.md +4 -1
- package/templates/claude/agents/specdojo-orchestrator.md +4 -1
- package/templates/codex/agents/specdojo-orchestrator.toml +4 -1
- package/templates/codex/orchestrator.md +4 -1
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +5 -2
package/dist/docs/yaml-pages.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname, join, posix } from "node:path";
|
|
|
3
3
|
import { dump, load } from "../shared/yaml.js";
|
|
4
4
|
import { collectDocIndexEntries } from "./doc-index.js";
|
|
5
5
|
import { isDctTemplateCatalog, renderCatalogTemplateBody } from "../shared/catalog-render.js";
|
|
6
|
+
import { renderTypedYamlTable } from "./yaml-tables.js";
|
|
6
7
|
// YAML は VitePress のページにならないため、doc-index に載っている YAML ごとに
|
|
7
8
|
// 同階層の generated/<name>.md へ表示用ページを生成する。
|
|
8
9
|
// wikilink・frontmatter リンクはこのページへ解決される。
|
|
@@ -118,6 +119,143 @@ function renderGlossaryBody(doc, terms) {
|
|
|
118
119
|
lines.push("", `## ${++chapter}. YAML の正本`, "");
|
|
119
120
|
return lines.join("\n");
|
|
120
121
|
}
|
|
122
|
+
const IFX_MODELINE_RE = /^#\s*(?:yaml-language-server:|specdojo-schema:)/;
|
|
123
|
+
function collectIfxIndexComments(content) {
|
|
124
|
+
const result = { document: [], interfaces: [] };
|
|
125
|
+
let inInterfaces = false;
|
|
126
|
+
let itemIndent = -1;
|
|
127
|
+
let pending = [];
|
|
128
|
+
let group;
|
|
129
|
+
let groupTarget = result.document;
|
|
130
|
+
let previousWasComment = false;
|
|
131
|
+
for (const line of content.split(/\r?\n/)) {
|
|
132
|
+
const trimmed = line.trim();
|
|
133
|
+
const indent = line.length - line.trimStart().length;
|
|
134
|
+
if (trimmed.startsWith("#")) {
|
|
135
|
+
if (IFX_MODELINE_RE.test(trimmed))
|
|
136
|
+
continue;
|
|
137
|
+
// 連携の内側(ダッシュより深い字下げ)は今の連携、ダッシュと同じ字下げは次の連携、
|
|
138
|
+
// 行頭のコメントは一覧全体の注記とする。
|
|
139
|
+
const current = result.interfaces.at(-1);
|
|
140
|
+
const target = !inInterfaces || indent === 0
|
|
141
|
+
? result.document
|
|
142
|
+
: current !== undefined && indent > itemIndent
|
|
143
|
+
? current
|
|
144
|
+
: pending;
|
|
145
|
+
if (!previousWasComment || target !== groupTarget) {
|
|
146
|
+
group = [];
|
|
147
|
+
target.push(group);
|
|
148
|
+
groupTarget = target;
|
|
149
|
+
}
|
|
150
|
+
group?.push(trimmed.replace(/^#\s?/, ""));
|
|
151
|
+
previousWasComment = true;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
previousWasComment = false;
|
|
155
|
+
if (trimmed === "")
|
|
156
|
+
continue;
|
|
157
|
+
if (indent === 0) {
|
|
158
|
+
result.document.push(...pending);
|
|
159
|
+
pending = [];
|
|
160
|
+
inInterfaces = /^interfaces:\s*$/.test(line);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (inInterfaces && trimmed.startsWith("- ") && (itemIndent === -1 || indent === itemIndent)) {
|
|
164
|
+
itemIndent = indent;
|
|
165
|
+
result.interfaces.push(pending);
|
|
166
|
+
pending = [];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
result.document.push(...pending);
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
const IFX_DIRECTION_LABELS = {
|
|
173
|
+
source_to_target: "連携元 → 連携先",
|
|
174
|
+
target_to_source: "連携先 → 連携元",
|
|
175
|
+
bidirectional: "双方向",
|
|
176
|
+
};
|
|
177
|
+
const IFX_LABEL_RE = /_(?:TODO|UNDECIDED|ASSUMPTION)_/g;
|
|
178
|
+
function ifxSpecRefCell(specRef, docId) {
|
|
179
|
+
if (specRef === "")
|
|
180
|
+
return "未記入";
|
|
181
|
+
if (specRef === "TBD")
|
|
182
|
+
return "未整備(TBD)";
|
|
183
|
+
// 成果物の wikilink は project 修飾 ID で解決するため、修飾のない参照には一覧の修飾を補う。
|
|
184
|
+
const prefix = docId.includes(":") ? `${docId.slice(0, docId.indexOf(":"))}:` : "";
|
|
185
|
+
return `[[${specRef.includes(":") ? specRef : `${prefix}${specRef}`}]]`;
|
|
186
|
+
}
|
|
187
|
+
function renderIfxIndexBody(doc, interfaces, content) {
|
|
188
|
+
const comments = collectIfxIndexComments(content);
|
|
189
|
+
const docId = glossaryText(doc.id);
|
|
190
|
+
const tbdCount = interfaces.filter((item) => glossaryText(item.spec_ref) === "TBD").length;
|
|
191
|
+
const paragraphs = (groups) => groups.flatMap((lines) => [lines.join("\n"), ""]);
|
|
192
|
+
const lines = [
|
|
193
|
+
"<!-- prettier-ignore -->",
|
|
194
|
+
"| ID | 状態 | 連携の数 | 詳細仕様が未整備(TBD) |",
|
|
195
|
+
"| --- | --- | --- | --- |",
|
|
196
|
+
`| ${[docId, glossaryText(doc.status)].map((value) => glossaryCell(value) || "-").join(" | ")} | ${interfaces.length} | ${tbdCount} |`,
|
|
197
|
+
"",
|
|
198
|
+
"## 1. 連携の一覧",
|
|
199
|
+
"",
|
|
200
|
+
"<!-- prettier-ignore -->",
|
|
201
|
+
"| No | 連携名 | 連携先 | 向き | 種別 | 形式 | 詳細仕様 | 注記 |",
|
|
202
|
+
"| --- | --- | --- | --- | --- | --- | --- | --- |",
|
|
203
|
+
];
|
|
204
|
+
interfaces.forEach((item, index) => {
|
|
205
|
+
const notes = comments.interfaces[index] ?? [];
|
|
206
|
+
const labels = [...new Set(notes.flat().join("\n").match(IFX_LABEL_RE) ?? [])];
|
|
207
|
+
const noteCell = notes.length === 0
|
|
208
|
+
? "-"
|
|
209
|
+
: [
|
|
210
|
+
`[${notes.length} 件](#ifx-${index + 1})`,
|
|
211
|
+
...labels.map((label) => `\`${label}\``),
|
|
212
|
+
].join(" ");
|
|
213
|
+
const direction = glossaryText(item.direction);
|
|
214
|
+
const cells = [
|
|
215
|
+
String(index + 1),
|
|
216
|
+
`[${glossaryText(item.name).replace(/[[\]\\]/g, "\\$&")}](#ifx-${index + 1})`,
|
|
217
|
+
glossaryText(item.target),
|
|
218
|
+
IFX_DIRECTION_LABELS[direction] ?? direction,
|
|
219
|
+
glossaryText(item.kind),
|
|
220
|
+
glossaryText(item.format),
|
|
221
|
+
ifxSpecRefCell(glossaryText(item.spec_ref), docId),
|
|
222
|
+
noteCell,
|
|
223
|
+
];
|
|
224
|
+
lines.push(`| ${cells.map((cell) => glossaryCell(cell) || "-").join(" | ")} |`);
|
|
225
|
+
});
|
|
226
|
+
lines.push("", "## 2. 連携ごとの詳細", "");
|
|
227
|
+
interfaces.forEach((item, index) => {
|
|
228
|
+
const name = glossaryText(item.name);
|
|
229
|
+
const direction = glossaryText(item.direction);
|
|
230
|
+
const rows = [
|
|
231
|
+
["連携名", `<a id="ifx-${index + 1}">${escapeAnchorText(name)}</a>`],
|
|
232
|
+
["連携元", glossaryText(item.source)],
|
|
233
|
+
["連携先", glossaryText(item.target)],
|
|
234
|
+
["向き", IFX_DIRECTION_LABELS[direction] ?? direction],
|
|
235
|
+
["種別", glossaryText(item.kind)],
|
|
236
|
+
["形式", glossaryText(item.format)],
|
|
237
|
+
["タイミング", glossaryText(item.timing)],
|
|
238
|
+
["異常時の扱い", glossaryText(item.error_handling)],
|
|
239
|
+
["詳細仕様", ifxSpecRefCell(glossaryText(item.spec_ref), docId)],
|
|
240
|
+
];
|
|
241
|
+
lines.push(`### 2.${index + 1}. ${glossaryCell(name) || "-"}`, "", "<!-- prettier-ignore -->", "| 項目 | 内容 |", "| --- | --- |", ...rows.map(([label, value]) => `| ${label} | ${glossaryCell(value) || "-"} |`), "");
|
|
242
|
+
const notes = comments.interfaces[index] ?? [];
|
|
243
|
+
if (notes.length > 0)
|
|
244
|
+
lines.push("注記(YAML のコメント):", "", ...paragraphs(notes));
|
|
245
|
+
});
|
|
246
|
+
let chapter = 2;
|
|
247
|
+
if (comments.document.length > 0) {
|
|
248
|
+
lines.push(`## ${++chapter}. 一覧全体の注記`, "", ...paragraphs(comments.document));
|
|
249
|
+
}
|
|
250
|
+
lines.push(`## ${++chapter}. YAML の正本`, "");
|
|
251
|
+
return lines.join("\n");
|
|
252
|
+
}
|
|
253
|
+
function isIfxIndex(yamlRelPath, parsed) {
|
|
254
|
+
return (/^ifx-index(?:-[a-z0-9-]+)?\.ya?ml$/.test(posix.basename(yamlRelPath)) &&
|
|
255
|
+
isRecord(parsed) &&
|
|
256
|
+
parsed.type === "api" &&
|
|
257
|
+
Array.isArray(parsed.interfaces));
|
|
258
|
+
}
|
|
121
259
|
// doc-index の "path:42" 形式から行番号サフィックスを除去する。
|
|
122
260
|
function stripLineSuffix(entry) {
|
|
123
261
|
const colonIndex = entry.lastIndexOf(":");
|
|
@@ -225,8 +363,13 @@ export function renderYamlPage(yamlRelPath, content) {
|
|
|
225
363
|
const longestRun = backtickRuns.reduce((max, run) => Math.max(max, run.length), 0);
|
|
226
364
|
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
227
365
|
const body = content.endsWith("\n") ? content : `${content}\n`;
|
|
228
|
-
|
|
229
|
-
|
|
366
|
+
// 対応する文書系列は表で本文を描き、YAML の正本を折りたたんで添える。
|
|
367
|
+
const tableBody = isRecord(parsed) && parsed.type === "glossary" && Array.isArray(parsed.terms)
|
|
368
|
+
? renderGlossaryBody(parsed, parsed.terms.filter(isRecord))
|
|
369
|
+
: isIfxIndex(yamlRelPath, parsed)
|
|
370
|
+
? renderIfxIndexBody(parsed, parsed.interfaces.filter(isRecord), content)
|
|
371
|
+
: renderTypedYamlTable(yamlRelPath, parsed);
|
|
372
|
+
if (tableBody !== undefined) {
|
|
230
373
|
return [
|
|
231
374
|
...header,
|
|
232
375
|
`# ${heading}`,
|
|
@@ -235,7 +378,7 @@ export function renderYamlPage(yamlRelPath, content) {
|
|
|
235
378
|
"",
|
|
236
379
|
YAML_PAGE_MARKER,
|
|
237
380
|
"",
|
|
238
|
-
|
|
381
|
+
tableBody,
|
|
239
382
|
"<details>",
|
|
240
383
|
"<summary>YAML の正本を表示</summary>",
|
|
241
384
|
"",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function isRecord(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function records(value) {
|
|
5
|
+
return Array.isArray(value) ? value.filter(isRecord) : [];
|
|
6
|
+
}
|
|
7
|
+
export function code(value) {
|
|
8
|
+
const runs = value.match(/`+/g) ?? [];
|
|
9
|
+
const fence = "`".repeat(Math.max(1, ...runs.map((run) => run.length + 1)));
|
|
10
|
+
return `${fence} ${value} ${fence}`.replace(/^` ([^`]+) `$/, "`$1`");
|
|
11
|
+
}
|
|
12
|
+
// Markdown の参照とコードを保ち、YAML に含まれるパスのプレースホルダを HTML として解釈させない。
|
|
13
|
+
function text(value) {
|
|
14
|
+
return value
|
|
15
|
+
.split(/(`+[^`]*`+|\[\[[^\]]+\]\]|\[[^\]]*\]\([^)]*\)|https?:\/\/[^\s<>]+)/g)
|
|
16
|
+
.map((part, index) => {
|
|
17
|
+
if (index % 2 === 1)
|
|
18
|
+
return /^https?:/.test(part) ? `<${part}>` : part;
|
|
19
|
+
return part
|
|
20
|
+
.replace(/&/g, "&")
|
|
21
|
+
.replace(/</g, "<")
|
|
22
|
+
.replace(/>/g, ">")
|
|
23
|
+
.replace(/\b[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)+\b/g, (identifier) => code(identifier));
|
|
24
|
+
})
|
|
25
|
+
.join("");
|
|
26
|
+
}
|
|
27
|
+
export function valueText(value) {
|
|
28
|
+
if (value === undefined || value === null || value === "")
|
|
29
|
+
return "-";
|
|
30
|
+
if (value instanceof Date)
|
|
31
|
+
return value.toISOString().slice(0, 10);
|
|
32
|
+
if (Array.isArray(value))
|
|
33
|
+
return value.length ? value.map(valueText).join(" / ") : "-";
|
|
34
|
+
if (isRecord(value)) {
|
|
35
|
+
return (Object.entries(value)
|
|
36
|
+
.map(([key, entry]) => `${code(key)}: ${valueText(entry)}`)
|
|
37
|
+
.join(" / ") || "-");
|
|
38
|
+
}
|
|
39
|
+
return text(String(value));
|
|
40
|
+
}
|
|
41
|
+
export function cell(value) {
|
|
42
|
+
return value
|
|
43
|
+
.replace(/\s*[\r\n]+\s*/g, " ")
|
|
44
|
+
.replace(/(\\*)\|/g, (_match, slashes) => `${slashes}${slashes.length % 2 === 0 ? "\\" : ""}|`);
|
|
45
|
+
}
|
|
46
|
+
export function table(headers, rows) {
|
|
47
|
+
return [
|
|
48
|
+
"<!-- prettier-ignore -->",
|
|
49
|
+
`| ${headers.join(" | ")} |`,
|
|
50
|
+
`| ${headers.map(() => "---").join(" | ")} |`,
|
|
51
|
+
...rows.map((row) => `| ${row.map((entry) => cell(entry) || "-").join(" | ")} |`),
|
|
52
|
+
].join("\n");
|
|
53
|
+
}
|
|
54
|
+
export function recordTable(items, columns) {
|
|
55
|
+
return table(columns.map(([, label]) => label), items.map((item) => columns.map(([key]) => valueText(item[key]))));
|
|
56
|
+
}
|
|
57
|
+
export function properties(value, columns) {
|
|
58
|
+
const entries = isRecord(value) ? value : {};
|
|
59
|
+
const selected = columns ?? Object.keys(entries).map((key) => [key, code(key)]);
|
|
60
|
+
return table(["項目", "内容"], selected.map(([key, label]) => [label, valueText(entries[key])]));
|
|
61
|
+
}
|
|
62
|
+
export class TableBody {
|
|
63
|
+
sections = [];
|
|
64
|
+
section(title, body) {
|
|
65
|
+
this.sections.push(`## ${this.sections.length + 1}. ${title}\n\n${body}`);
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return [...this.sections, `## ${this.sections.length + 1}. YAML の正本\n`].join("\n\n");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { isRecord } from "./yaml-table-shared.js";
|
|
3
|
+
import { renderBdd, renderDct, renderDctIndex, renderMembers, renderMilestones, renderRoles, renderTimeline, renderViewpoints, } from "./yaml-business-tables.js";
|
|
4
|
+
import { renderCommand, renderFileInterface } from "./yaml-interface-tables.js";
|
|
5
|
+
// type とファイル系列の両方で限定し、template・schema・grade 記録などを巻き込まない。
|
|
6
|
+
export function renderTypedYamlTable(path, parsed) {
|
|
7
|
+
if (!isRecord(parsed) || /\/(?:templates|schemas|execution|jobs|routines)\//.test(path))
|
|
8
|
+
return undefined;
|
|
9
|
+
const name = posix.basename(path).replace(/\.ya?ml$/, "");
|
|
10
|
+
if (parsed.type === "template" || parsed.openapi || parsed.asyncapi)
|
|
11
|
+
return undefined;
|
|
12
|
+
if (/^bdd-/.test(name) && parsed.type === "data" && Array.isArray(parsed.entities))
|
|
13
|
+
return renderBdd(parsed);
|
|
14
|
+
if (parsed.type === "project") {
|
|
15
|
+
if (/^pm-roles(?:-|$)/.test(name) && Array.isArray(parsed.roles))
|
|
16
|
+
return renderRoles(parsed);
|
|
17
|
+
if (/^pm-members(?:-|$)/.test(name) && Array.isArray(parsed.members))
|
|
18
|
+
return renderMembers(parsed);
|
|
19
|
+
if (/^tml-/.test(name) && Array.isArray(parsed.tracks))
|
|
20
|
+
return renderTimeline(parsed);
|
|
21
|
+
if (name === "sch-milestones" &&
|
|
22
|
+
parsed.kind === "milestones" &&
|
|
23
|
+
Array.isArray(parsed.milestones))
|
|
24
|
+
return renderMilestones(parsed);
|
|
25
|
+
if (/^dct-index(?:-|$)/.test(name) && Array.isArray(parsed.groups))
|
|
26
|
+
return renderDctIndex(parsed);
|
|
27
|
+
if (/^dct-/.test(name) && typeof parsed.domain === "string" && Array.isArray(parsed.groups))
|
|
28
|
+
return renderDct(parsed);
|
|
29
|
+
}
|
|
30
|
+
if (/^pm-review-viewpoints(?:-|$)/.test(name) &&
|
|
31
|
+
["project", "standard"].includes(String(parsed.type)))
|
|
32
|
+
return renderViewpoints(parsed);
|
|
33
|
+
if (/^ifx-cmd-/.test(name) && parsed.type === "api" && isRecord(parsed.command))
|
|
34
|
+
return renderCommand(parsed);
|
|
35
|
+
const meta = isRecord(parsed["x-spec-meta"]) ? parsed["x-spec-meta"] : parsed;
|
|
36
|
+
if (/^ifx-file-/.test(name) && meta.type === "api" && Array.isArray(parsed.files))
|
|
37
|
+
return renderFileInterface(parsed);
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
@@ -6,6 +6,7 @@ import { getProjectExecutionPath, loadConfig, specdojoRootDir, } from "../shared
|
|
|
6
6
|
import { resolveParentValidationConcurrency, resolveParentValidationAssignments, resolveParentValidationDefinitions, } from "./parent-validation.js";
|
|
7
7
|
import { resolveCommitHookSkips } from "./commit-hook-skips.js";
|
|
8
8
|
import { configureIndexLockWait, DEFAULT_INDEX_LOCK_WAIT_MS } from "../shared/git.js";
|
|
9
|
+
import { resolvePostIntegrationEntries } from "./post-integration.js";
|
|
9
10
|
const PLACEHOLDER_PATTERN = /\{([a-z][a-z0-9_]*)\}/g;
|
|
10
11
|
const BUILTIN_VARIABLE_NAMES = new Set(["nickname", "mode", "proficiency"]);
|
|
11
12
|
// Mirror of the nickname pattern in docs/specdojo/schemas/v1/agent-members.schema.yaml.
|
|
@@ -66,6 +67,13 @@ function buildCommandVariables(provider, member, params) {
|
|
|
66
67
|
// not runnable by exec run). Throws when a template exists but cannot be fully expanded,
|
|
67
68
|
// so a broken definition surfaces as an error instead of launching a malformed command.
|
|
68
69
|
export function resolveMemberCommand(config, member) {
|
|
70
|
+
// Require provider opt-in even for an explicit member command: otherwise a frontier
|
|
71
|
+
// member could silently inherit ordinary defaults or bypass the missing-tier error.
|
|
72
|
+
if (member.proficiency === "frontier" &&
|
|
73
|
+
(!member.provider ||
|
|
74
|
+
!config.providers?.[member.provider]?.command_params?.by_proficiency?.frontier)) {
|
|
75
|
+
throw new Error(`Cannot launch frontier member ${member.nickname}: configure providers.${member.provider ?? "<provider>"}.command_params.by_proficiency.frontier in exec-defaults.yaml (use {} if no extra variables are needed)`);
|
|
76
|
+
}
|
|
69
77
|
const override = member.command?.trim();
|
|
70
78
|
if (override)
|
|
71
79
|
return override;
|
|
@@ -371,6 +379,7 @@ export function loadExecDefaultsConfig(configPath, executionPath) {
|
|
|
371
379
|
};
|
|
372
380
|
}
|
|
373
381
|
resolveParentValidationDefinitions(defaults.pipeline?.parent_validations);
|
|
382
|
+
resolvePostIntegrationEntries(defaults.pipeline?.post_integration);
|
|
374
383
|
resolveParentValidationConcurrency(defaults.pipeline?.parent_validation_concurrency);
|
|
375
384
|
resolveCommitHookSkips(defaults.pipeline?.commit_hook_skips, defaults.pipeline?.parent_validations);
|
|
376
385
|
if (defaults.pipeline?.mechanical_result !== undefined &&
|
|
@@ -51,6 +51,8 @@ const SNAPSHOT_DIRECTORY_ROOTS = [
|
|
|
51
51
|
// 保護対象ディレクトリの配下にあるが、設定ではなく再生成可能な既知の生成物。
|
|
52
52
|
// 任意の gitignore 対象を除外すると、agent が .gitignore と新規設定を同時に作ることで
|
|
53
53
|
// ガードをすり抜けられるため、生成物として用途が確定しているパスだけを列挙する。
|
|
54
|
+
// `.specdojo/specdojo.local.config.json`(PJR-NC9R)は gitignore 済みでも設定であり、repos の
|
|
55
|
+
// 差し替え・追加で commit の許可範囲を変えるため、ここに含めず `.specdojo/` の保護対象に残す。
|
|
54
56
|
// `.opencode/` の 4 件は opencode が起動時に作る実行時生成物で、親 runner / hook / CI の
|
|
55
57
|
// 実行内容を変えない。指示ファイル(`.opencode/AGENTS.md`、`.opencode/agents/**`)は
|
|
56
58
|
// ここに含めず、保護対象のままにする。
|
package/dist/exec/commands.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerDeprecatedWhereAlias } from "../shared/where-alias.js";
|
|
1
2
|
import { Option } from "commander";
|
|
2
3
|
import { existsSync } from "node:fs";
|
|
3
4
|
import { join, resolve as pathResolve } from "node:path";
|
|
@@ -5,6 +6,7 @@ import { validateCatalogLocalIds, validateRulebookKata } from "../catalog/build.
|
|
|
5
6
|
import { commonViewpointsPath, scaffoldViewpoints } from "../review/plan.js";
|
|
6
7
|
import { runProviderScaffold, specdojoPackageRootDir } from "../shared/provider-scaffold.js";
|
|
7
8
|
import { assertValidActor, getProjectViewpointsPath, getProjectRoutinesPath, loadConfig, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
9
|
+
import { formatLocalConfigLines } from "../shared/local-config.js";
|
|
8
10
|
import { DEFAULT_EVENT_MESSAGES, KNOWN_OWNER_LABELS, KNOWN_OWNER_LABELS_TEXT, addCommonAddOptions, addForceOption, addLockOptions, addOwnerOptions, addProjectOptions, addTakeOverOption, ensureActorCanClaimNext, findRosterMember, loadRosterForOpts, loadValidatedExecState, parseApproach, parseTaskMode, printCommandError, resolveClaimOwner, resolveForceOverride, resolveProjectContext, resolveProjectId, resolveSchedulerStrategy, runLockedEventCommand, runReleaseAllBlocked, runSimpleEventCommand, scaffoldClaimResult, } from "./core.js";
|
|
9
11
|
import { acquireSchedulerLock, canBlockTask, canCancelTask, canClaimTask, canCompleteTask, canReleaseTask, canReopenTask, canUnblockTask, claimOwnerOf, computeReadyIds, readAllEventFiles, releaseSchedulerLock, schedulerLockPath, writeEventFile, } from "./events.js";
|
|
10
12
|
import { registerExecHandoffCommands } from "./handoff.js";
|
|
@@ -19,13 +21,37 @@ import { displayWidth, nowUtcIsoSeconds, padEndDisplay, requireNonEmpty } from "
|
|
|
19
21
|
import { resolveOwnerForLocalId } from "./strategy.js";
|
|
20
22
|
import { buildTaskView } from "./task-view.js";
|
|
21
23
|
import { registerExecTrialCommands } from "./trial.js";
|
|
24
|
+
import { registerExecSmokeCommand } from "./smoke.js";
|
|
25
|
+
import { registerExecQueueCommands, writeActiveQueueSummary } from "./queue-command.js";
|
|
22
26
|
import { registerExecWorktreeCommands } from "./worktree-command.js";
|
|
23
27
|
import { validateRunRecordLayout } from "./validate-records.js";
|
|
24
28
|
import { validateRunRecordLayoutAtCommit } from "./validate-records-commit.js";
|
|
29
|
+
export function printExecPaths(opts) {
|
|
30
|
+
try {
|
|
31
|
+
const resolvedPaths = resolveProjectContext(opts);
|
|
32
|
+
process.stdout.write(`schedule-path: ${resolvedPaths.schedulePath}\n`);
|
|
33
|
+
process.stdout.write(`execution-path: ${resolvedPaths.executionPath}\n`);
|
|
34
|
+
const projectPath = resolvedPaths.schedulePath;
|
|
35
|
+
process.stdout.write(`exec/events : ${eventsDirForProject(projectPath)}\n`);
|
|
36
|
+
process.stdout.write(`generated : ${generatedDirForProject(projectPath)}\n`);
|
|
37
|
+
process.stdout.write(`scheduler-lock: ${schedulerLockPath(projectPath)}\n`);
|
|
38
|
+
// Only with a local config, so the output stays unchanged for checkouts without one.
|
|
39
|
+
const loaded = loadConfig();
|
|
40
|
+
if (loaded.localConfigPath) {
|
|
41
|
+
const lines = formatLocalConfigLines(loaded, resolveProjectId(opts));
|
|
42
|
+
process.stdout.write(lines.map((line) => `${line}\n`).join(""));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
printCommandError(error, false);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
25
49
|
export function registerExecCommands(program) {
|
|
26
50
|
const exec = program.command("exec").description("Execution helpers");
|
|
27
51
|
registerExecHandoffCommands(exec);
|
|
28
52
|
registerRecordMigrationCommand(exec);
|
|
53
|
+
registerExecSmokeCommand(exec);
|
|
54
|
+
registerExecQueueCommands(exec);
|
|
29
55
|
const lockedActions = {
|
|
30
56
|
claim: {
|
|
31
57
|
type: "claim",
|
|
@@ -318,7 +344,7 @@ export function registerExecCommands(program) {
|
|
|
318
344
|
}
|
|
319
345
|
});
|
|
320
346
|
const scmd = exec
|
|
321
|
-
.command("scheduler")
|
|
347
|
+
.command("scheduler", { hidden: true })
|
|
322
348
|
.description("Auto-claim next task safely (with project-level lock).");
|
|
323
349
|
addProjectOptions(scmd);
|
|
324
350
|
scmd.requiredOption("--by <actor>", "Actor (agent name)");
|
|
@@ -545,7 +571,7 @@ export function registerExecCommands(program) {
|
|
|
545
571
|
statusCmd.option("--state <state>", "Filter by state: todo|doing|blocked|done|cancelled (default: doing)", "doing");
|
|
546
572
|
statusCmd.action((opts) => {
|
|
547
573
|
try {
|
|
548
|
-
const { schedulePath } = resolveProjectContext(opts);
|
|
574
|
+
const { schedulePath, executionPath } = resolveProjectContext(opts);
|
|
549
575
|
// Compute state directly from events (not from cached state.json)
|
|
550
576
|
const state = loadValidatedExecState(schedulePath);
|
|
551
577
|
if (!state)
|
|
@@ -561,6 +587,7 @@ export function registerExecCommands(program) {
|
|
|
561
587
|
if (entries.length === 0) {
|
|
562
588
|
const byMsg = filterBy ? ` for ${filterBy}` : "";
|
|
563
589
|
process.stdout.write(`No ${filterState} tasks${byMsg}.\n`);
|
|
590
|
+
writeActiveQueueSummary(executionPath);
|
|
564
591
|
exitWithCode(true);
|
|
565
592
|
return;
|
|
566
593
|
}
|
|
@@ -584,26 +611,12 @@ export function registerExecCommands(program) {
|
|
|
584
611
|
// The trailing claimed_at column is left unpadded to avoid stray trailing whitespace.
|
|
585
612
|
process.stdout.write(` ${padEndDisplay(r.taskId, taskWidth)} ${padEndDisplay(r.name, nameWidth)} ${padEndDisplay(r.by, byWidth)} ${r.ts}\n`);
|
|
586
613
|
}
|
|
614
|
+
writeActiveQueueSummary(executionPath);
|
|
587
615
|
exitWithCode(true);
|
|
588
616
|
}
|
|
589
617
|
catch (error) {
|
|
590
618
|
printCommandError(error, false);
|
|
591
619
|
}
|
|
592
620
|
});
|
|
593
|
-
|
|
594
|
-
addProjectOptions(wcmd);
|
|
595
|
-
wcmd.action((opts) => {
|
|
596
|
-
try {
|
|
597
|
-
const resolvedPaths = resolveProjectContext(opts);
|
|
598
|
-
process.stdout.write(`schedule-path: ${resolvedPaths.schedulePath}\n`);
|
|
599
|
-
process.stdout.write(`execution-path: ${resolvedPaths.executionPath}\n`);
|
|
600
|
-
const projectPath = resolvedPaths.schedulePath;
|
|
601
|
-
process.stdout.write(`exec/events : ${eventsDirForProject(projectPath)}\n`);
|
|
602
|
-
process.stdout.write(`generated : ${generatedDirForProject(projectPath)}\n`);
|
|
603
|
-
process.stdout.write(`scheduler-lock: ${schedulerLockPath(projectPath)}\n`);
|
|
604
|
-
}
|
|
605
|
-
catch (error) {
|
|
606
|
-
printCommandError(error, false);
|
|
607
|
-
}
|
|
608
|
-
});
|
|
621
|
+
registerDeprecatedWhereAlias(exec, printExecPaths);
|
|
609
622
|
}
|
package/dist/exec/events.js
CHANGED
|
@@ -76,7 +76,22 @@ function advanceTaskState(state, event) {
|
|
|
76
76
|
}
|
|
77
77
|
return state;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function resumesPipelineBlock(block, unblock) {
|
|
80
|
+
return (block.type === "block" &&
|
|
81
|
+
unblock.type === "unblock" &&
|
|
82
|
+
typeof block.meta?.pipeline_stage === "string" &&
|
|
83
|
+
typeof block.meta?.pipeline_state_ref === "string" &&
|
|
84
|
+
block.meta.pipeline_stage === unblock.meta?.pipeline_stage &&
|
|
85
|
+
block.meta.pipeline_state_ref === unblock.meta?.pipeline_state_ref);
|
|
86
|
+
}
|
|
87
|
+
function advanceEventOrderState(cur, event) {
|
|
88
|
+
return {
|
|
89
|
+
state: advanceTaskState(cur.state, event),
|
|
90
|
+
lastBy: event.by,
|
|
91
|
+
lastBlock: event.type === "block" ? event : cur.lastBlock,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function isTransitionValidForState(state, lastBy, lastBlock, candidate, remaining) {
|
|
80
95
|
const { type } = candidate;
|
|
81
96
|
if (type === "note" || type === "estimate" || type === "link")
|
|
82
97
|
return true;
|
|
@@ -104,6 +119,14 @@ function isTransitionValidForState(state, lastBy, candidate, remaining) {
|
|
|
104
119
|
if (type !== "block" && type !== "complete" && type !== "release" && type !== "cancel") {
|
|
105
120
|
return false;
|
|
106
121
|
}
|
|
122
|
+
// A resume identifies the block it follows. Prefer that block over a later failure in
|
|
123
|
+
// the same second, regardless of the random suffix in either block's filename.
|
|
124
|
+
if (type === "block") {
|
|
125
|
+
const resumedBlocks = remaining.filter((item) => remaining.some((other) => resumesPipelineBlock(item.event, other.event)));
|
|
126
|
+
if (resumedBlocks.length > 0 && !resumedBlocks.some((item) => item.event === candidate)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
107
130
|
if (lastBy &&
|
|
108
131
|
candidate.by !== lastBy &&
|
|
109
132
|
remaining.some((item) => (item.event.type === "block" ||
|
|
@@ -122,6 +145,12 @@ function isTransitionValidForState(state, lastBy, candidate, remaining) {
|
|
|
122
145
|
return true;
|
|
123
146
|
}
|
|
124
147
|
if (state === "blocked") {
|
|
148
|
+
if (type === "unblock" &&
|
|
149
|
+
lastBlock &&
|
|
150
|
+
!resumesPipelineBlock(lastBlock, candidate) &&
|
|
151
|
+
remaining.some((item) => resumesPipelineBlock(lastBlock, item.event))) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
125
154
|
return type === "unblock" || type === "release" || type === "cancel";
|
|
126
155
|
}
|
|
127
156
|
if (state === "done") {
|
|
@@ -139,10 +168,7 @@ function orderSameTimestampEventsByState(items) {
|
|
|
139
168
|
if (end - start === 1) {
|
|
140
169
|
const { event } = items[start];
|
|
141
170
|
const cur = taskStates.get(event.task_id) ?? { state: "todo" };
|
|
142
|
-
taskStates.set(event.task_id,
|
|
143
|
-
state: advanceTaskState(cur.state, event),
|
|
144
|
-
lastBy: event.by,
|
|
145
|
-
});
|
|
171
|
+
taskStates.set(event.task_id, advanceEventOrderState(cur, event));
|
|
146
172
|
start = end;
|
|
147
173
|
continue;
|
|
148
174
|
}
|
|
@@ -159,21 +185,15 @@ function orderSameTimestampEventsByState(items) {
|
|
|
159
185
|
let cur = taskStates.get(taskId) ?? { state: "todo" };
|
|
160
186
|
if (indices.length === 1) {
|
|
161
187
|
const { event } = items[indices[0]];
|
|
162
|
-
taskStates.set(taskId,
|
|
163
|
-
state: advanceTaskState(cur.state, event),
|
|
164
|
-
lastBy: event.by,
|
|
165
|
-
});
|
|
188
|
+
taskStates.set(taskId, advanceEventOrderState(cur, event));
|
|
166
189
|
continue;
|
|
167
190
|
}
|
|
168
191
|
const remaining = indices.map((idx) => items[idx]);
|
|
169
192
|
for (const targetIdx of indices) {
|
|
170
|
-
const validIdx = remaining.findIndex((candidate) => isTransitionValidForState(cur.state, cur.lastBy, candidate.event, remaining));
|
|
193
|
+
const validIdx = remaining.findIndex((candidate) => isTransitionValidForState(cur.state, cur.lastBy, cur.lastBlock, candidate.event, remaining));
|
|
171
194
|
const [chosen] = remaining.splice(validIdx >= 0 ? validIdx : 0, 1);
|
|
172
195
|
items[targetIdx] = chosen;
|
|
173
|
-
cur =
|
|
174
|
-
state: advanceTaskState(cur.state, chosen.event),
|
|
175
|
-
lastBy: chosen.event.by,
|
|
176
|
-
};
|
|
196
|
+
cur = advanceEventOrderState(cur, chosen.event);
|
|
177
197
|
}
|
|
178
198
|
taskStates.set(taskId, cur);
|
|
179
199
|
}
|
package/dist/exec/evidence.js
CHANGED
|
@@ -2,8 +2,9 @@ import { readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { dirname, join, relative, sep } from "node:path";
|
|
3
3
|
import { runLogPath, runnerRecordPrefixes, taskEvidencePaths, taskRecordPaths, } from "./run-records.js";
|
|
4
4
|
import { ensureDir, redactSensitiveText, safeSlug } from "./shared.js";
|
|
5
|
-
import { gitOutput } from "./worktree.js";
|
|
5
|
+
import { gitOutput, gitResult } from "./worktree.js";
|
|
6
6
|
import { isCondenseRecords } from "../shared/condense-records.js";
|
|
7
|
+
import { loadConfig } from "../shared/specdojo-config.js";
|
|
7
8
|
const MAX_LOG_BYTES = 64 * 1024;
|
|
8
9
|
export const MAX_CHANGE_FILES = 1_000;
|
|
9
10
|
const MAX_FINAL_MESSAGE_LENGTH = 4_000;
|
|
@@ -386,6 +387,9 @@ export function buildExecutorEvidence(input) {
|
|
|
386
387
|
},
|
|
387
388
|
validations,
|
|
388
389
|
...(report.condenseRecords ? { condense_records: report.condenseRecords } : {}),
|
|
390
|
+
...(input.localConfigOverrides?.length
|
|
391
|
+
? { local_config_overrides: input.localConfigOverrides.map((item) => ({ ...item })) }
|
|
392
|
+
: {}),
|
|
389
393
|
...(report.targetCoverage.length > 0 ? { target_coverage: report.targetCoverage } : {}),
|
|
390
394
|
...(input.rateLimitEvents?.length ? { rate_limit_events: input.rateLimitEvents } : {}),
|
|
391
395
|
final_message: report.finalMessage,
|
|
@@ -458,6 +462,8 @@ export function recordExecutorEvidence(input) {
|
|
|
458
462
|
logRefPath: repoRelative(input.worktreePath, logPath),
|
|
459
463
|
parentValidations: input.parentValidations,
|
|
460
464
|
rateLimitEvents: input.rateLimitEvents,
|
|
465
|
+
// The runner's own config load (the main working tree) decides what the run used.
|
|
466
|
+
localConfigOverrides: loadConfig(input.repoRoot).localOverrides,
|
|
461
467
|
});
|
|
462
468
|
writeFileSync(logPath, logExcerpt, "utf8");
|
|
463
469
|
writeFileSync(evidencePath, `${JSON.stringify(evidence, null, 2)}\n`, "utf8");
|
|
@@ -471,14 +477,18 @@ export function recordCommandEvidence(input) {
|
|
|
471
477
|
`${executionRel}/exec/events/`,
|
|
472
478
|
`${executionRel}/generated/`,
|
|
473
479
|
];
|
|
474
|
-
const
|
|
480
|
+
const inGit = gitResult(input.worktreePath, ["rev-parse", "--is-inside-work-tree"]).status === 0;
|
|
481
|
+
const changes = (inGit ? parseStatusPaths(input.worktreePath) : [])
|
|
475
482
|
.filter((change) => runnerManagedPrefixes.every((prefix) => !change.path.startsWith(prefix)))
|
|
476
483
|
.slice(0, MAX_CHANGE_FILES)
|
|
477
484
|
.map((change) => ({
|
|
478
485
|
path: boundedText(change.path, 1_000),
|
|
479
486
|
status: boundedText(change.status, 40),
|
|
480
487
|
}));
|
|
481
|
-
const
|
|
488
|
+
const hasHead = inGit && gitResult(input.worktreePath, ["rev-parse", "--verify", "HEAD"]).status === 0;
|
|
489
|
+
const diffStat = inGit
|
|
490
|
+
? gitOutput(input.worktreePath, ["diff", "--stat", ...(hasHead ? ["HEAD"] : []), "--"])
|
|
491
|
+
: "";
|
|
482
492
|
const evidenceDir = taskRecordPaths(join(input.worktreePath, executionRel), input.taskId, input.runId).directory;
|
|
483
493
|
ensureDir(evidenceDir);
|
|
484
494
|
const evidencePath = taskRecordPaths(join(input.worktreePath, executionRel), input.taskId, input.runId).evidence;
|