specdojo 0.2.0 → 0.3.0
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 +280 -0
- package/README.md +143 -30
- package/dist/agent-response.js +20 -0
- package/dist/agent.js +4 -4
- package/dist/build-command.js +28 -8
- package/dist/dashboard.js +140 -9
- package/dist/devcontainer-command.js +43 -0
- package/dist/devcontainer-scaffold.js +165 -0
- 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-evidence.js +254 -11
- package/dist/exec-format.js +13 -4
- 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.js +115 -113
- 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.js +811 -0
- package/dist/exec-repo-trace.js +182 -0
- package/dist/exec-reporter.js +613 -132
- package/dist/exec-results.js +81 -56
- package/dist/exec-run-lock.js +110 -107
- package/dist/exec-run.js +1585 -356
- package/dist/exec-shared.js +7 -0
- package/dist/exec-slot-lock.js +242 -0
- package/dist/exec-task-repos.js +415 -0
- package/dist/exec-trial.js +51 -25
- package/dist/exec-worktree-command.js +87 -43
- package/dist/exec-worktree-ops.js +502 -57
- package/dist/exec-worktree.js +114 -27
- package/dist/exec.js +13 -6
- package/dist/grade-result.js +128 -0
- package/dist/grade.js +809 -72
- package/dist/init-command.js +443 -0
- package/dist/job.js +160 -10
- package/dist/orchestrator.js +213 -0
- package/dist/package-paths.js +19 -1
- package/dist/register-event-merge.js +169 -0
- package/dist/register-item.js +7 -1
- package/dist/register.js +294 -86
- package/dist/review-grade.js +252 -0
- package/dist/review-plan.js +111 -1
- package/dist/review-types.js +40 -1
- package/dist/routine.js +72 -5
- package/dist/schedule-build.js +2 -2
- package/dist/schedule.js +17 -4
- package/dist/specdojo-config.js +466 -20
- package/dist/specdojo-gitignore.js +135 -0
- package/dist/specdojo.js +8 -1
- package/dist/viewpoint-document-kinds-check.js +128 -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 +91 -47
- 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 +25 -4
- 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 +261 -32
- 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 +184 -0
- package/docs/ja/specdojo/guides/review-guide.md +195 -158
- package/docs/ja/specdojo/guides/routine-operation-guide.md +74 -9
- 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 +336 -93
- 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 +16 -9
- package/templates/antigravity/README.md +60 -0
- package/templates/antigravity/agent-members-snippet.yaml +61 -0
- package/templates/antigravity/exec-defaults-snippet.yaml +39 -0
- package/templates/antigravity/orchestrator.md +157 -0
- 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 +164 -0
- package/templates/claude/settings.edit.json +27 -1
- package/templates/codex/README.md +5 -4
- package/templates/codex/agents/specdojo-orchestrator.toml +165 -0
- package/templates/codex/orchestrator.md +157 -0
- 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 +72 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +204 -0
- 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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { productMergeState } from "./exec-repo-integration.js";
|
|
3
|
+
import { productIntegrationTarget } from "./exec-task-repos.js";
|
|
4
|
+
import { gitOutput, gitResult } from "./exec-worktree.js";
|
|
5
|
+
// PJR-30SW: プロダクト側の commit と merge commit へ付ける `Refs:` trailer と、統合後に result へ
|
|
6
|
+
// 記録する trace 表。trace key は PJR-1SXK の決定どおり `<project-id>:<item-id>` とする。
|
|
7
|
+
/** Heading text of the trace section the runner appends to the result. */
|
|
8
|
+
export const RESULT_TRACE_HEADING = "トレーサビリティ";
|
|
9
|
+
/** Project-qualified trace key (`<project-id>:<item-id>`) used by the `Refs:` trailer. */
|
|
10
|
+
export function traceKey(projectId, itemId) {
|
|
11
|
+
const project = projectId.trim();
|
|
12
|
+
const item = itemId.trim();
|
|
13
|
+
if (!project || !item) {
|
|
14
|
+
throw new Error(`trace key requires a project id and an item id (got "${projectId}:${itemId}")`);
|
|
15
|
+
}
|
|
16
|
+
return `${project}:${item}`;
|
|
17
|
+
}
|
|
18
|
+
/** `Refs:` trailer line for a register item (`Refs: <project-id>:<item-id>`). */
|
|
19
|
+
export function refsTrailer(projectId, itemId) {
|
|
20
|
+
return `Refs: ${traceKey(projectId, itemId)}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Append trailer lines to a commit message as the last paragraph. Trailers already present in the
|
|
24
|
+
* message are not duplicated, so retried commits keep a single `Refs:` line.
|
|
25
|
+
*/
|
|
26
|
+
export function withCommitTrailers(message, trailers) {
|
|
27
|
+
const body = message.trimEnd();
|
|
28
|
+
const existing = new Set(body.split("\n").map((line) => line.trim()));
|
|
29
|
+
const missing = trailers.filter((trailer) => !existing.has(trailer.trim()));
|
|
30
|
+
if (missing.length === 0)
|
|
31
|
+
return body;
|
|
32
|
+
return `${body}\n\n${missing.join("\n")}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Message of the project-side merge commit of a register item: the subject, then the transition,
|
|
36
|
+
* the agents, and the project-qualified `Refs:` trailer.
|
|
37
|
+
*/
|
|
38
|
+
export function registerProjectMergeMessage(params) {
|
|
39
|
+
return (`${params.subject}\n\n` +
|
|
40
|
+
`Transition: start → review\nExecutor: ${params.executor}\nReporter: ${params.reporter}\n` +
|
|
41
|
+
refsTrailer(params.projectId, params.itemId));
|
|
42
|
+
}
|
|
43
|
+
// 統合先の first-parent 上で、exec branch の先端を初めて含んだ commit(= merge commit)。
|
|
44
|
+
function integrationCommitOf(product, target) {
|
|
45
|
+
const tip = gitResult(product.repoRoot, ["rev-parse", "--verify", `${product.branch}^{commit}`]);
|
|
46
|
+
if (tip.status !== 0)
|
|
47
|
+
return null;
|
|
48
|
+
const tipSha = String(tip.stdout).trim();
|
|
49
|
+
const lines = gitOutput(product.repoRoot, [
|
|
50
|
+
"rev-list",
|
|
51
|
+
"--first-parent",
|
|
52
|
+
"--ancestry-path",
|
|
53
|
+
`${tipSha}..${target}`,
|
|
54
|
+
])
|
|
55
|
+
.split("\n")
|
|
56
|
+
.map((line) => line.trim())
|
|
57
|
+
.filter(Boolean);
|
|
58
|
+
return lines.at(-1) ?? null;
|
|
59
|
+
}
|
|
60
|
+
const PULL_REQUEST_SUBJECT = /^Merge pull request (#\d+)\b/;
|
|
61
|
+
function pullRequestOf(repoRoot, commit) {
|
|
62
|
+
const subject = gitOutput(repoRoot, ["log", "-1", "--format=%s", commit]).trim();
|
|
63
|
+
return PULL_REQUEST_SUBJECT.exec(subject)?.[1] ?? null;
|
|
64
|
+
}
|
|
65
|
+
/** Integration snapshot of one product repository, read from the Git state after integration. */
|
|
66
|
+
export function productIntegrationTrace(product) {
|
|
67
|
+
const integrationBranch = productIntegrationTarget(product);
|
|
68
|
+
const state = productMergeState(product);
|
|
69
|
+
const commit = state === "merged" ? integrationCommitOf(product, integrationBranch) : null;
|
|
70
|
+
return {
|
|
71
|
+
repo: product.name,
|
|
72
|
+
integrationBranch,
|
|
73
|
+
state,
|
|
74
|
+
commit,
|
|
75
|
+
pullRequest: commit ? pullRequestOf(product.repoRoot, commit) : null,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const NOT_APPLICABLE = "not applicable";
|
|
79
|
+
function traceRows(key, traces, recordedAt) {
|
|
80
|
+
return traces.map((trace) => [
|
|
81
|
+
`\`${key}\``,
|
|
82
|
+
`\`${trace.repo}\``,
|
|
83
|
+
`\`${trace.integrationBranch}\``,
|
|
84
|
+
trace.pullRequest ?? NOT_APPLICABLE,
|
|
85
|
+
trace.commit
|
|
86
|
+
? `\`${trace.commit}\``
|
|
87
|
+
: trace.state === "unchanged"
|
|
88
|
+
? `${NOT_APPLICABLE} (no changes)`
|
|
89
|
+
: `${NOT_APPLICABLE} (not integrated)`,
|
|
90
|
+
recordedAt,
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
function renderTable(header, rows) {
|
|
94
|
+
const escape = (cell) => cell.replace(/\|/g, "\\|");
|
|
95
|
+
const all = [header.map(escape), ...rows.map((row) => row.map(escape))];
|
|
96
|
+
const widths = header.map((cell, column) => Math.max(3, cell.length, ...all.map((row) => (row[column] ?? "").length)));
|
|
97
|
+
const line = (cells) => `| ${cells.map((cell, column) => cell.padEnd(widths[column] ?? 0)).join(" | ")} |`;
|
|
98
|
+
return [
|
|
99
|
+
line(all[0] ?? []),
|
|
100
|
+
`| ${widths.map((width) => "-".repeat(width)).join(" | ")} |`,
|
|
101
|
+
...all.slice(1).map(line),
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
/** Body of the trace section (without the heading). */
|
|
105
|
+
export function renderResultTraceBody(params) {
|
|
106
|
+
const table = renderTable(["trace key", "repository", "integration branch", "PR", "commit snapshot", "recorded at"], traceRows(params.traceKey, params.traces, params.recordedAt));
|
|
107
|
+
// PJR-9KST: result は利用側プロジェクトの markdownlint 設定で検査され、既定の MD013(80 文字)が
|
|
108
|
+
// 効くことがある。説明文は文ごとに改行して短く保ち、行長を内容で決められない表だけ MD013 を外す。
|
|
109
|
+
return [
|
|
110
|
+
"runner がプロダクトリポジトリを統合した後に記録した、統合先の commit snapshot です。",
|
|
111
|
+
"プロジェクトリポジトリの統合は、この result を含む merge commit で確認します。",
|
|
112
|
+
`その merge commit には \`Refs: ${params.traceKey}\` を付けます。`,
|
|
113
|
+
"PR が `not applicable` の行は、runner がローカルで統合し PR を経由していません。",
|
|
114
|
+
"",
|
|
115
|
+
"<!-- markdownlint-disable MD013 -->",
|
|
116
|
+
"",
|
|
117
|
+
...table,
|
|
118
|
+
"",
|
|
119
|
+
"<!-- markdownlint-enable MD013 -->",
|
|
120
|
+
].join("\n");
|
|
121
|
+
}
|
|
122
|
+
// `## n. <title>` の見出しを、コードフェンスの内側を除いて列挙する。
|
|
123
|
+
function topLevelSections(lines) {
|
|
124
|
+
const headings = [];
|
|
125
|
+
let fence = null;
|
|
126
|
+
lines.forEach((line, index) => {
|
|
127
|
+
const marker = /^\s*(```+|~~~+)/.exec(line)?.[1];
|
|
128
|
+
if (marker) {
|
|
129
|
+
if (fence === null)
|
|
130
|
+
fence = marker;
|
|
131
|
+
else if (marker[0] === fence[0] && marker.length >= fence.length)
|
|
132
|
+
fence = null;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (fence !== null)
|
|
136
|
+
return;
|
|
137
|
+
const match = /^## (\d+)\. (.+?)\s*$/.exec(line);
|
|
138
|
+
if (match)
|
|
139
|
+
headings.push({ index, number: Number(match[1]), title: match[2] ?? "" });
|
|
140
|
+
});
|
|
141
|
+
return headings.map((heading, position) => ({
|
|
142
|
+
start: heading.index,
|
|
143
|
+
end: headings[position + 1]?.index ?? lines.length,
|
|
144
|
+
number: heading.number,
|
|
145
|
+
title: heading.title,
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Insert or replace the trace section of a result Markdown. The section is appended as the next
|
|
150
|
+
* numbered `##` chapter; a re-run (integration resume) replaces the previous section in place.
|
|
151
|
+
*/
|
|
152
|
+
export function upsertResultTraceSection(content, body) {
|
|
153
|
+
const lines = content.replace(/\r\n/g, "\n").replace(/\n+$/, "").split("\n");
|
|
154
|
+
const sections = topLevelSections(lines);
|
|
155
|
+
const existing = sections.find((section) => section.title === RESULT_TRACE_HEADING);
|
|
156
|
+
if (existing) {
|
|
157
|
+
const replaced = [
|
|
158
|
+
...lines.slice(0, existing.start),
|
|
159
|
+
`## ${existing.number}. ${RESULT_TRACE_HEADING}`,
|
|
160
|
+
"",
|
|
161
|
+
body,
|
|
162
|
+
...(existing.end < lines.length ? ["", ...lines.slice(existing.end)] : []),
|
|
163
|
+
];
|
|
164
|
+
return `${replaced.join("\n")}\n`;
|
|
165
|
+
}
|
|
166
|
+
const next = Math.max(0, ...sections.map((section) => section.number)) + 1;
|
|
167
|
+
return `${[...lines, "", `## ${next}. ${RESULT_TRACE_HEADING}`, "", body].join("\n")}\n`;
|
|
168
|
+
}
|
|
169
|
+
/** Record the product integration snapshots in the result file. */
|
|
170
|
+
export function recordResultTrace(params) {
|
|
171
|
+
if (params.traces.length === 0)
|
|
172
|
+
return;
|
|
173
|
+
const body = renderResultTraceBody({
|
|
174
|
+
traceKey: params.traceKey,
|
|
175
|
+
traces: params.traces,
|
|
176
|
+
recordedAt: params.recordedAt ?? new Date().toISOString(),
|
|
177
|
+
});
|
|
178
|
+
const content = readFileSync(params.resultPath, "utf8");
|
|
179
|
+
const updated = upsertResultTraceSection(content, body);
|
|
180
|
+
if (updated !== content)
|
|
181
|
+
writeFileSync(params.resultPath, updated, "utf8");
|
|
182
|
+
}
|