specdojo 0.4.1 → 0.4.3
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/CHANGELOG.md +39 -0
- package/dist/catalog/build.js +7 -7
- package/dist/catalog/generate.js +27 -12
- package/dist/commands/init.js +26 -7
- package/dist/commands/orchestrator.js +9 -2
- package/dist/dashboard/timeline-build.js +4 -151
- package/dist/devcontainer/command.js +1 -1
- package/dist/devcontainer/scaffold.js +24 -9
- package/dist/exec/core.js +4 -0
- package/dist/exec/events.js +17 -6
- package/dist/exec/plans-core.js +26 -6
- package/dist/exec/plans-generation.js +13 -0
- package/dist/exec/plans-storage.js +15 -3
- package/dist/exec/register.js +64 -6
- package/dist/exec/results.js +5 -1
- package/dist/exec/strategy.js +4 -0
- package/dist/kata/authoring.js +100 -0
- package/dist/kata/command.js +52 -2
- package/dist/kata/kata.js +55 -12
- package/dist/register/approach.js +29 -1
- package/dist/register/core.js +3 -2
- package/dist/register/create-commands.js +9 -0
- package/dist/register/cross-project.js +141 -0
- package/dist/register/derivation.js +28 -7
- package/dist/register/external-project.js +136 -0
- package/dist/register/item.js +26 -5
- package/dist/register/register.js +45 -28
- package/dist/schedule/strategy-generate-scope.js +2 -1
- package/dist/schedule/strategy-profiles.js +3 -0
- package/dist/shared/agent-types.js +4 -0
- package/dist/shared/catalog-files.js +31 -0
- package/dist/shared/lefthook-scaffold.js +177 -0
- package/dist/shared/provider-scaffold.js +3 -3
- package/dist/shared/specdojo-config.js +130 -6
- package/dist/shared/timeline-index.js +125 -0
- package/docs/ja/specdojo/exec-templates/xep-recipe-authoring-template.md +45 -0
- package/docs/ja/specdojo/exec-templates/xep-rulebook-authoring-template.md +45 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-authoring-template.md +45 -0
- package/docs/ja/specdojo/exec-templates/xep-template-authoring-template.md +45 -0
- package/docs/ja/specdojo/guides/docs-editing-guide.md +32 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +1 -1
- package/docs/ja/specdojo/guides/exec-config-guide.md +13 -6
- package/docs/ja/specdojo/guides/kata-guide.md +4 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +4 -2
- package/docs/ja/specdojo/guides/quick-start-guide.md +374 -68
- package/docs/ja/specdojo/guides/register-operation-guide.md +30 -0
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +10 -2
- package/docs/ja/specdojo/guides/ryu-guide.md +18 -4
- package/docs/ja/specdojo/guides/use-case-guide.md +2 -2
- package/docs/ja/specdojo/references/command-reference.md +77 -29
- package/docs/ja/specdojo/references/specdojo-config-reference.md +41 -12
- package/docs/ja/specdojo/standards/recipe-authoring-standard.md +10 -10
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +13 -13
- package/docs/ja/specdojo/standards/sample-authoring-standard.md +4 -4
- package/docs/ja/specdojo/standards/template-authoring-standard.md +4 -4
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +6 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +6 -6
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +21 -4
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +34 -0
- package/package.json +2 -2
- package/templates/antigravity/README.md +1 -1
- package/templates/antigravity/settings.global.json +5 -0
- package/templates/claude/README.md +11 -8
- package/templates/claude/settings.edit.json +10 -1
- package/templates/claude/settings.orchestrator.json +90 -0
- package/templates/claude/settings.report.json +14 -1
- package/templates/claude/settings.review.json +13 -1
- package/templates/codex/README.md +7 -5
- package/templates/codex/rules/specdojo.rules +48 -0
- package/templates/devcontainer/devcontainer.json +1 -4
- package/templates/init-agent-members.yaml +3 -3
- package/templates/lefthook/tools/install-lefthook.mjs +46 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +207 -0
- package/templates/opencode/README.md +8 -2
- package/templates/opencode/agents/opencode-executor.md +2 -0
- package/templates/opencode/agents/opencode-review-executor.md +2 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +60 -6
- /package/dist/{shared → kata}/yaml-schema-modeline.js +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
const REQUIRED_DEV_DEPENDENCIES = ["lefthook", "prettier", "markdownlint-cli"];
|
|
5
|
+
const REQUIRED_SCRIPTS = {
|
|
6
|
+
prepare: "node tools/install-lefthook.mjs",
|
|
7
|
+
"pre-commit": "lefthook run pre-commit",
|
|
8
|
+
};
|
|
9
|
+
const MARKDOWNLINT_CONFIG_FILES = [
|
|
10
|
+
".markdownlint.jsonc",
|
|
11
|
+
".markdownlint.json",
|
|
12
|
+
".markdownlint.yaml",
|
|
13
|
+
".markdownlint.yml",
|
|
14
|
+
".markdownlintrc",
|
|
15
|
+
];
|
|
16
|
+
const MARKDOWNLINT_CONFIG = `${JSON.stringify({
|
|
17
|
+
MD013: false,
|
|
18
|
+
MD024: false,
|
|
19
|
+
MD033: false,
|
|
20
|
+
MD036: false,
|
|
21
|
+
MD041: false,
|
|
22
|
+
MD060: false,
|
|
23
|
+
}, null, 2)}\n`;
|
|
24
|
+
const MARKDOWNLINT_IGNORE = [".claude/agents/", ".github/agents/", ".opencode/agents/", ""].join("\n");
|
|
25
|
+
function isRecord(value) {
|
|
26
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
function hasConfiguredPath(config, key) {
|
|
29
|
+
return Object.values(config.projects).some((project) => !!project[key]?.trim());
|
|
30
|
+
}
|
|
31
|
+
export function renderLefthookConfig(config) {
|
|
32
|
+
const commands = [
|
|
33
|
+
" prettier:",
|
|
34
|
+
' glob: "*.{md,yaml,yml}"',
|
|
35
|
+
" run: node tools/specdojo-pre-commit.mjs prettier {staged_files}",
|
|
36
|
+
" stage_fixed: true",
|
|
37
|
+
"",
|
|
38
|
+
" markdownlint:",
|
|
39
|
+
' glob: "*.md"',
|
|
40
|
+
" run: node tools/specdojo-pre-commit.mjs markdownlint {staged_files}",
|
|
41
|
+
];
|
|
42
|
+
if (hasConfiguredPath(config, "project_register_path")) {
|
|
43
|
+
commands.push("", " register-build:", " run: node tools/specdojo-pre-commit.mjs register-build", " stage_fixed: true");
|
|
44
|
+
}
|
|
45
|
+
if (hasConfiguredPath(config, "catalog_path")) {
|
|
46
|
+
commands.push("", " catalog-validate:", " run: node tools/specdojo-pre-commit.mjs catalog-validate");
|
|
47
|
+
}
|
|
48
|
+
return [
|
|
49
|
+
"# Generated by SpecDojo. Re-run `specdojo config scaffold --lefthook --force` to refresh.",
|
|
50
|
+
"pre-commit:",
|
|
51
|
+
" parallel: false",
|
|
52
|
+
" commands:",
|
|
53
|
+
...commands,
|
|
54
|
+
"",
|
|
55
|
+
].join("\n");
|
|
56
|
+
}
|
|
57
|
+
function detectIndent(content) {
|
|
58
|
+
const match = content.match(/^([\t ]+)\S/m);
|
|
59
|
+
if (!match)
|
|
60
|
+
return 2;
|
|
61
|
+
return match[1].includes("\t") ? "\t" : match[1].length;
|
|
62
|
+
}
|
|
63
|
+
function parsePackageJson(content, packageJsonPath) {
|
|
64
|
+
let value;
|
|
65
|
+
try {
|
|
66
|
+
value = JSON.parse(content);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
+
throw new Error(`Invalid JSON in ${packageJsonPath}: ${message}`);
|
|
71
|
+
}
|
|
72
|
+
if (!isRecord(value))
|
|
73
|
+
throw new Error(`Invalid JSON in ${packageJsonPath}: expected an object`);
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
async function requiredDependencyVersions(packageRoot) {
|
|
77
|
+
const sourcePath = path.join(packageRoot, "package.json");
|
|
78
|
+
const source = parsePackageJson(await readFile(sourcePath, "utf8"), sourcePath);
|
|
79
|
+
// prettier is a runtime dependency of SpecDojo itself, so versions are resolved from both fields.
|
|
80
|
+
const dependencies = {
|
|
81
|
+
...(isRecord(source.dependencies) ? source.dependencies : {}),
|
|
82
|
+
...(isRecord(source.devDependencies) ? source.devDependencies : {}),
|
|
83
|
+
};
|
|
84
|
+
return Object.fromEntries(REQUIRED_DEV_DEPENDENCIES.map((name) => {
|
|
85
|
+
const version = dependencies[name];
|
|
86
|
+
if (typeof version !== "string") {
|
|
87
|
+
throw new Error(`SpecDojo package.json (${sourcePath}) does not declare dependency or devDependency: ${name}`);
|
|
88
|
+
}
|
|
89
|
+
return [name, version];
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
async function updatePackageJson(opts) {
|
|
93
|
+
const packageJsonPath = path.join(opts.repoRoot, "package.json");
|
|
94
|
+
const requiredDependencies = await requiredDependencyVersions(opts.packageRoot);
|
|
95
|
+
if (!existsSync(packageJsonPath)) {
|
|
96
|
+
process.stdout.write("Skipped package.json update (package.json not found). Add these entries after creating it:\n" +
|
|
97
|
+
`${JSON.stringify({ scripts: REQUIRED_SCRIPTS, devDependencies: requiredDependencies }, null, 2)}\n`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const content = await readFile(packageJsonPath, "utf8");
|
|
101
|
+
const packageJson = parsePackageJson(content, packageJsonPath);
|
|
102
|
+
if (packageJson.scripts !== undefined && !isRecord(packageJson.scripts)) {
|
|
103
|
+
throw new Error(`Invalid ${packageJsonPath}: scripts must be an object`);
|
|
104
|
+
}
|
|
105
|
+
if (packageJson.dependencies !== undefined && !isRecord(packageJson.dependencies)) {
|
|
106
|
+
throw new Error(`Invalid ${packageJsonPath}: dependencies must be an object`);
|
|
107
|
+
}
|
|
108
|
+
if (packageJson.devDependencies !== undefined && !isRecord(packageJson.devDependencies)) {
|
|
109
|
+
throw new Error(`Invalid ${packageJsonPath}: devDependencies must be an object`);
|
|
110
|
+
}
|
|
111
|
+
const scripts = isRecord(packageJson.scripts) ? packageJson.scripts : {};
|
|
112
|
+
const dependencies = isRecord(packageJson.dependencies) ? packageJson.dependencies : {};
|
|
113
|
+
const devDependencies = isRecord(packageJson.devDependencies) ? packageJson.devDependencies : {};
|
|
114
|
+
const scriptAdditions = Object.fromEntries(Object.entries(REQUIRED_SCRIPTS).filter(([name]) => !Object.hasOwn(scripts, name)));
|
|
115
|
+
const dependencyAdditions = Object.fromEntries(Object.entries(requiredDependencies).filter(([name]) => !Object.hasOwn(dependencies, name) && !Object.hasOwn(devDependencies, name)));
|
|
116
|
+
const additions = { scripts: scriptAdditions, devDependencies: dependencyAdditions };
|
|
117
|
+
process.stdout.write(`Planned package.json additions:\n${JSON.stringify(additions, null, 2)}\n`);
|
|
118
|
+
for (const name of Object.keys(REQUIRED_SCRIPTS)) {
|
|
119
|
+
if (Object.hasOwn(scripts, name)) {
|
|
120
|
+
process.stdout.write(`Skipped (script already exists): ${name} in package.json\n`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
for (const name of REQUIRED_DEV_DEPENDENCIES) {
|
|
124
|
+
if (Object.hasOwn(dependencies, name) || Object.hasOwn(devDependencies, name)) {
|
|
125
|
+
process.stdout.write(`Skipped (dependency already exists): ${name} in package.json\n`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (opts.dryRun ||
|
|
129
|
+
(Object.keys(scriptAdditions).length === 0 && Object.keys(dependencyAdditions).length === 0)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
packageJson.scripts = { ...scripts, ...scriptAdditions };
|
|
133
|
+
packageJson.devDependencies = { ...devDependencies, ...dependencyAdditions };
|
|
134
|
+
await writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, detectIndent(content))}\n`, "utf8");
|
|
135
|
+
process.stdout.write("Updated: package.json\n");
|
|
136
|
+
}
|
|
137
|
+
async function writeScaffoldFile(sourcePath, destinationPath, destinationLabel, content, opts) {
|
|
138
|
+
if (existsSync(destinationPath) && !opts.force) {
|
|
139
|
+
process.stdout.write(`Skipped (already exists): ${destinationLabel}\n`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (opts.dryRun) {
|
|
143
|
+
process.stdout.write(`[dry-run] would write: ${destinationLabel}\n`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await mkdir(path.dirname(destinationPath), { recursive: true });
|
|
147
|
+
if (sourcePath)
|
|
148
|
+
await copyFile(sourcePath, destinationPath);
|
|
149
|
+
else
|
|
150
|
+
await writeFile(destinationPath, content ?? "", "utf8");
|
|
151
|
+
process.stdout.write(`Written: ${destinationLabel}\n`);
|
|
152
|
+
}
|
|
153
|
+
async function writeMarkdownlintScaffold(opts) {
|
|
154
|
+
const existingConfig = MARKDOWNLINT_CONFIG_FILES.find((filename) => existsSync(path.join(opts.repoRoot, filename)));
|
|
155
|
+
if (existingConfig) {
|
|
156
|
+
process.stdout.write(`Skipped (markdownlint config already exists): ${existingConfig}\n`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
await writeScaffoldFile(undefined, path.join(opts.repoRoot, ".markdownlint.jsonc"), ".markdownlint.jsonc", MARKDOWNLINT_CONFIG, { force: false, dryRun: opts.dryRun });
|
|
160
|
+
}
|
|
161
|
+
await writeScaffoldFile(undefined, path.join(opts.repoRoot, ".markdownlintignore"), ".markdownlintignore", MARKDOWNLINT_IGNORE, { force: false, dryRun: opts.dryRun });
|
|
162
|
+
}
|
|
163
|
+
export async function runLefthookScaffold(opts) {
|
|
164
|
+
const templateTools = path.join(opts.packageRoot, "templates", "lefthook", "tools");
|
|
165
|
+
await writeScaffoldFile(undefined, path.join(opts.repoRoot, "lefthook.yml"), "lefthook.yml", renderLefthookConfig(opts.config), opts);
|
|
166
|
+
await writeMarkdownlintScaffold(opts);
|
|
167
|
+
for (const filename of ["install-lefthook.mjs", "specdojo-pre-commit.mjs"]) {
|
|
168
|
+
await writeScaffoldFile(path.join(templateTools, filename), path.join(opts.repoRoot, "tools", filename), `tools/${filename}`, undefined, opts);
|
|
169
|
+
}
|
|
170
|
+
await updatePackageJson(opts);
|
|
171
|
+
if (!opts.dryRun) {
|
|
172
|
+
process.stdout.write("Next steps:\n" +
|
|
173
|
+
" 1. Run npm install and review the package.json additions shown above.\n" +
|
|
174
|
+
" 2. Run node tools/install-lefthook.mjs if an existing prepare script was kept.\n" +
|
|
175
|
+
" 3. Stage and commit lefthook.yml, markdownlint settings, tools/, and package.json.\n");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -8,8 +8,8 @@ function isRecord(value) {
|
|
|
8
8
|
export { specdojoPackageRootDir } from "./package-paths.js";
|
|
9
9
|
export const ORCHESTRATOR_NPM_SCRIPTS = {
|
|
10
10
|
claude: {
|
|
11
|
-
"orch:opus": "specdojo orchestrator launch --provider claude -- --agent specdojo-orchestrator --model opus",
|
|
12
|
-
"orch:sonnet": "specdojo orchestrator launch --provider claude -- --agent specdojo-orchestrator --model sonnet",
|
|
11
|
+
"orch:opus": "specdojo orchestrator launch --provider claude -- --agent specdojo-orchestrator --model opus --settings .specdojo/claude/settings.orchestrator.json",
|
|
12
|
+
"orch:sonnet": "specdojo orchestrator launch --provider claude -- --agent specdojo-orchestrator --model sonnet --settings .specdojo/claude/settings.orchestrator.json",
|
|
13
13
|
},
|
|
14
14
|
codex: {
|
|
15
15
|
"orch:sol": 'specdojo orchestrator launch --provider codex -- -m gpt-5.6-sol "$(cat .specdojo/codex/orchestrator.md)"',
|
|
@@ -75,7 +75,7 @@ export async function buildProviderScaffoldPlan(opts) {
|
|
|
75
75
|
relFile === PROVIDER_GLOBAL_SETTINGS[provider]?.templateRelPath) {
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
|
-
const destinationRelPath = relFile.startsWith("agents/")
|
|
78
|
+
const destinationRelPath = relFile.startsWith("agents/") || relFile.startsWith("rules/")
|
|
79
79
|
? `.${provider}/${relFile}`
|
|
80
80
|
: `.specdojo/${provider}/${relFile}`;
|
|
81
81
|
entries.push({
|
|
@@ -5,6 +5,7 @@ import { dump, load } from "./yaml.js";
|
|
|
5
5
|
import Ajv2020Module from "ajv/dist/2020.js";
|
|
6
6
|
import { runProviderScaffold, specdojoPackageRootDir } from "./provider-scaffold.js";
|
|
7
7
|
import { runWorkspaceScaffold } from "./workspace-scaffold.js";
|
|
8
|
+
import { runLefthookScaffold } from "./lefthook-scaffold.js";
|
|
8
9
|
import { ensureGitignore, formatGitignoreReport, gitignorePatternsForLayouts, } from "./specdojo-gitignore.js";
|
|
9
10
|
/** Default IANA time zone for register date derivation when run.register_date_timezone is unset. */
|
|
10
11
|
export const DEFAULT_REGISTER_DATE_TIMEZONE = "UTC";
|
|
@@ -119,6 +120,48 @@ export function resolveRegisterActor(actor, roster) {
|
|
|
119
120
|
accepted.join(", "));
|
|
120
121
|
}
|
|
121
122
|
export const DEFAULT_AGENT_MEMBERS_PATH = ".specdojo/agent-members.yaml";
|
|
123
|
+
export const KATA_AUTHORITY_PATTERN = /^(?!prj-)(?!specdojo$)[a-z][a-z0-9-]*$/;
|
|
124
|
+
function repositoryIdentityRoot(rootDir) {
|
|
125
|
+
const root = resolve(rootDir);
|
|
126
|
+
const dotGit = join(root, ".git");
|
|
127
|
+
if (!existsSync(dotGit) || statSync(dotGit).isDirectory())
|
|
128
|
+
return root;
|
|
129
|
+
const gitdirLine = readTextFileOrNull(dotGit)
|
|
130
|
+
?.split(/\r?\n/)
|
|
131
|
+
.find((line) => line.startsWith("gitdir:"));
|
|
132
|
+
if (!gitdirLine)
|
|
133
|
+
return root;
|
|
134
|
+
const gitdir = resolve(root, gitdirLine.slice("gitdir:".length).trim()).replaceAll("\\", "/");
|
|
135
|
+
const marker = "/.git/worktrees/";
|
|
136
|
+
const markerIndex = gitdir.lastIndexOf(marker);
|
|
137
|
+
return markerIndex >= 0 ? gitdir.slice(0, markerIndex) : root;
|
|
138
|
+
}
|
|
139
|
+
export function defaultKataAuthority(rootDir = specdojoRootDir()) {
|
|
140
|
+
const directoryName = basename(repositoryIdentityRoot(rootDir));
|
|
141
|
+
const normalized = directoryName
|
|
142
|
+
.toLowerCase()
|
|
143
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
144
|
+
.replace(/^-+|-+$/g, "");
|
|
145
|
+
const withLetterPrefix = /^[a-z]/.test(normalized) ? normalized : `repo-${normalized}`;
|
|
146
|
+
const withoutReservedAuthority = withLetterPrefix === "specdojo" || withLetterPrefix.startsWith("prj-")
|
|
147
|
+
? `repo-${withLetterPrefix}`
|
|
148
|
+
: withLetterPrefix;
|
|
149
|
+
return KATA_AUTHORITY_PATTERN.test(withoutReservedAuthority)
|
|
150
|
+
? withoutReservedAuthority
|
|
151
|
+
: "repository";
|
|
152
|
+
}
|
|
153
|
+
export function getKataAuthority(config, rootDir = specdojoRootDir()) {
|
|
154
|
+
return config?.kata_authority?.trim() || defaultKataAuthority(rootDir);
|
|
155
|
+
}
|
|
156
|
+
export function isSpecdojoSourceRepository(rootDir = specdojoRootDir()) {
|
|
157
|
+
try {
|
|
158
|
+
const pkg = JSON.parse(readFileSync(join(rootDir, "package.json"), "utf8"));
|
|
159
|
+
return pkg.name === "specdojo" && existsSync(join(rootDir, "src", "specdojo.ts"));
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
122
165
|
function findUpward(startDir, name) {
|
|
123
166
|
let currentDir = resolve(startDir);
|
|
124
167
|
while (true) {
|
|
@@ -212,6 +255,64 @@ function isRecord(value) {
|
|
|
212
255
|
}
|
|
213
256
|
const REPO_KEYS = new Set(["name", "path", "integration_branch", "setup"]);
|
|
214
257
|
const REPO_SETUP_KEYS = new Set(["install", "build"]);
|
|
258
|
+
const EXTERNAL_PROJECT_KEYS = new Set(["path", "project_id"]);
|
|
259
|
+
/** Resolve a configured external-project repository from the SpecDojo root. */
|
|
260
|
+
export function resolveExternalProjectRoot(rootDir, project) {
|
|
261
|
+
return resolve(rootDir, project.path);
|
|
262
|
+
}
|
|
263
|
+
/** Return external projects in configuration order with absolute repository roots. */
|
|
264
|
+
export function resolveExternalProjects(rootDir, config) {
|
|
265
|
+
return Object.entries(config.external_projects ?? {}).map(([alias, project]) => ({
|
|
266
|
+
alias,
|
|
267
|
+
...project,
|
|
268
|
+
repoRoot: resolveExternalProjectRoot(rootDir, project),
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
/** Validate top-level `external_projects` declarations. */
|
|
272
|
+
export function validateExternalProjects(externalProjects, projectIds, rootDir) {
|
|
273
|
+
if (externalProjects === undefined)
|
|
274
|
+
return [];
|
|
275
|
+
if (!isRecord(externalProjects))
|
|
276
|
+
return ["external_projects must be an object"];
|
|
277
|
+
const errors = [];
|
|
278
|
+
for (const [alias, value] of Object.entries(externalProjects)) {
|
|
279
|
+
const at = `external_projects.${alias}`;
|
|
280
|
+
if (!REPO_NAME_PATTERN.test(alias)) {
|
|
281
|
+
errors.push(`external project alias ${JSON.stringify(alias)} must match ${String(REPO_NAME_PATTERN)}`);
|
|
282
|
+
}
|
|
283
|
+
if (projectIds.includes(alias)) {
|
|
284
|
+
errors.push(`${at} collides with local project id "${alias}"`);
|
|
285
|
+
}
|
|
286
|
+
if (!isRecord(value)) {
|
|
287
|
+
errors.push(`${at} must be an object with path and project_id`);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
for (const key of Object.keys(value).sort()) {
|
|
291
|
+
if (!EXTERNAL_PROJECT_KEYS.has(key))
|
|
292
|
+
errors.push(`${at}: unknown key "${key}"`);
|
|
293
|
+
}
|
|
294
|
+
const path = value.path;
|
|
295
|
+
if (typeof path !== "string" || path.trim().length === 0) {
|
|
296
|
+
errors.push(`${at}.path must be a non-empty string`);
|
|
297
|
+
}
|
|
298
|
+
else if (isAbsolute(path)) {
|
|
299
|
+
errors.push(`${at}.path must be relative to the SpecDojo root (got absolute "${path}")`);
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
const absolutePath = resolve(rootDir, path);
|
|
303
|
+
if (!existsSync(absolutePath)) {
|
|
304
|
+
errors.push(`${at}.path "${path}" does not exist (resolved to ${absolutePath})`);
|
|
305
|
+
}
|
|
306
|
+
else if (!statSync(absolutePath).isDirectory()) {
|
|
307
|
+
errors.push(`${at}.path "${path}" is not a directory (resolved to ${absolutePath})`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (typeof value.project_id !== "string" || value.project_id.trim().length === 0) {
|
|
311
|
+
errors.push(`${at}.project_id must be a non-empty string`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return errors;
|
|
315
|
+
}
|
|
215
316
|
/**
|
|
216
317
|
* Validate `projects.<projectId>.repos`. Returns one message per problem (empty when valid) so
|
|
217
318
|
* loadConfig can report every misconfigured repository at once. `path` is resolved from
|
|
@@ -535,6 +636,8 @@ function isValidProjectConfig(project) {
|
|
|
535
636
|
return false;
|
|
536
637
|
if (!isOmittedOrNonEmptyString(candidate.execution_path))
|
|
537
638
|
return false;
|
|
639
|
+
if (!isOmittedOrNonEmptyString(candidate.integration_branch))
|
|
640
|
+
return false;
|
|
538
641
|
if (candidate.project_context !== undefined &&
|
|
539
642
|
(!Array.isArray(candidate.project_context) ||
|
|
540
643
|
!candidate.project_context.every((ref) => typeof ref === "string" && ref.trim().length > 0))) {
|
|
@@ -559,10 +662,15 @@ export function loadConfig(configRootDir = specdojoRootDir()) {
|
|
|
559
662
|
}
|
|
560
663
|
assertProtectedAgentMembersPath(parsed.agent_members_path, configPath);
|
|
561
664
|
}
|
|
665
|
+
if (parsed.kata_authority !== undefined &&
|
|
666
|
+
(typeof parsed.kata_authority !== "string" ||
|
|
667
|
+
!KATA_AUTHORITY_PATTERN.test(parsed.kata_authority))) {
|
|
668
|
+
throw new Error(`Invalid .specdojo/specdojo.config.json: kata_authority must match ${KATA_AUTHORITY_PATTERN}`);
|
|
669
|
+
}
|
|
562
670
|
for (const [projectId, project] of Object.entries(parsed.projects)) {
|
|
563
671
|
if (!isValidProjectConfig(project)) {
|
|
564
672
|
throw new Error(`Invalid .specdojo/specdojo.config.json: projects.${projectId} must omit ` +
|
|
565
|
-
`schedule_path/execution_path or set them to non-empty strings, ` +
|
|
673
|
+
`schedule_path/execution_path/integration_branch or set them to non-empty strings, ` +
|
|
566
674
|
`and project_context must be a string[] when present`);
|
|
567
675
|
}
|
|
568
676
|
}
|
|
@@ -571,9 +679,11 @@ export function loadConfig(configRootDir = specdojoRootDir()) {
|
|
|
571
679
|
const repoErrors = projectIds
|
|
572
680
|
.sort()
|
|
573
681
|
.flatMap((projectId) => validateProjectRepos(projectId, parsed.projects[projectId], projectIds, rootDir));
|
|
574
|
-
|
|
682
|
+
const externalProjectErrors = validateExternalProjects(parsed.external_projects, projectIds, rootDir);
|
|
683
|
+
const configErrors = [...repoErrors, ...externalProjectErrors];
|
|
684
|
+
if (configErrors.length > 0) {
|
|
575
685
|
throw new Error(`Invalid .specdojo/specdojo.config.json (${configPath}):\n` +
|
|
576
|
-
|
|
686
|
+
configErrors.map((message) => ` - ${message}`).join("\n"));
|
|
577
687
|
}
|
|
578
688
|
return { configPath, config: parsed };
|
|
579
689
|
}
|
|
@@ -676,17 +786,18 @@ export function registerConfigCommands(program) {
|
|
|
676
786
|
});
|
|
677
787
|
cfg
|
|
678
788
|
.command("scaffold")
|
|
679
|
-
.description("Scaffold
|
|
789
|
+
.description("Scaffold provider settings, a VS Code multi-root workspace, or Git hooks")
|
|
680
790
|
.option("--provider <name>", "Provider template to copy (antigravity|claude|codex|copilot|opencode)")
|
|
681
791
|
.option("--workspace", "Generate VS Code multi-root workspace (<project-id>.code-workspace) from repos config", false)
|
|
792
|
+
.option("--lefthook", "Generate pre-commit hooks for SpecDojo repositories", false)
|
|
682
793
|
.option("--project <id>", "Target project ID for workspace scaffolding (defaults to current_project)")
|
|
683
794
|
.option("--force", "Overwrite existing files", false)
|
|
684
795
|
.option("--dry-run", "Show planned files without writing", false)
|
|
685
796
|
.option("--global", "Merge provider permissions into user-level settings (currently antigravity only)", false)
|
|
686
797
|
.action(async (opts) => {
|
|
687
798
|
try {
|
|
688
|
-
if (!opts.provider && !opts.workspace) {
|
|
689
|
-
throw new Error("Specify --provider <name
|
|
799
|
+
if (!opts.provider && !opts.workspace && !opts.lefthook) {
|
|
800
|
+
throw new Error("Specify --provider <name>, --workspace, or --lefthook to scaffold.");
|
|
690
801
|
}
|
|
691
802
|
if (opts.global && !opts.provider) {
|
|
692
803
|
throw new Error("--global requires --provider antigravity");
|
|
@@ -708,6 +819,19 @@ export function registerConfigCommands(program) {
|
|
|
708
819
|
dryRun: !!opts.dryRun,
|
|
709
820
|
});
|
|
710
821
|
}
|
|
822
|
+
if (opts.lefthook) {
|
|
823
|
+
const { configPath, config } = loadConfig();
|
|
824
|
+
if (!config) {
|
|
825
|
+
throw new Error(`No config found: ${configPath}. Run specdojo config init first.`);
|
|
826
|
+
}
|
|
827
|
+
await runLefthookScaffold({
|
|
828
|
+
packageRoot: specdojoPackageRootDir(),
|
|
829
|
+
repoRoot: specdojoRootDir(),
|
|
830
|
+
config,
|
|
831
|
+
force: !!opts.force,
|
|
832
|
+
dryRun: !!opts.dryRun,
|
|
833
|
+
});
|
|
834
|
+
}
|
|
711
835
|
}
|
|
712
836
|
catch (error) {
|
|
713
837
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { readYaml } from "./fs.js";
|
|
2
|
+
import { normalizeDateOnly } from "./time.js";
|
|
3
|
+
const CATALOG_STATUSES = ["not_started", "draft", "primary"];
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function readStringArray(value, field, errors) {
|
|
8
|
+
if (value === undefined)
|
|
9
|
+
return [];
|
|
10
|
+
if (!Array.isArray(value)) {
|
|
11
|
+
errors.push(`${field}: must be an array of strings`);
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const result = [];
|
|
15
|
+
for (const item of value) {
|
|
16
|
+
if (typeof item !== "string" || item.trim().length === 0) {
|
|
17
|
+
errors.push(`${field}: must contain non-empty strings only`);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
result.push(item);
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function parseTrack(raw, index, errors) {
|
|
25
|
+
const where = `tracks[${index}]`;
|
|
26
|
+
if (!isRecord(raw)) {
|
|
27
|
+
errors.push(`${where}: must be an object`);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const track = raw.track;
|
|
31
|
+
if (typeof track !== "string" || track.trim().length === 0) {
|
|
32
|
+
errors.push(`${where}.track: required non-empty string`);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const domains = readStringArray(raw.domains, `${where}.domains`, errors);
|
|
36
|
+
if (domains.length === 0)
|
|
37
|
+
errors.push(`${where}.domains: required non-empty array`);
|
|
38
|
+
const catalogStatus = raw.catalog_status;
|
|
39
|
+
if (typeof catalogStatus !== "string" ||
|
|
40
|
+
!CATALOG_STATUSES.includes(catalogStatus)) {
|
|
41
|
+
errors.push(`${where}.catalog_status: must be one of ${CATALOG_STATUSES.join(" | ")}`);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const order = raw.order;
|
|
45
|
+
if (typeof order !== "number" || !Number.isInteger(order) || order < 1) {
|
|
46
|
+
errors.push(`${where}.order: must be an integer >= 1`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (raw.depends_on === undefined) {
|
|
50
|
+
errors.push(`${where}.depends_on: required (use [] when there is no prerequisite)`);
|
|
51
|
+
}
|
|
52
|
+
const dependsOn = readStringArray(raw.depends_on, `${where}.depends_on`, errors);
|
|
53
|
+
const estimate = raw.catalog_duration_estimate_days;
|
|
54
|
+
if (estimate !== undefined && (typeof estimate !== "number" || estimate <= 0)) {
|
|
55
|
+
errors.push(`${where}.catalog_duration_estimate_days: must be a number > 0`);
|
|
56
|
+
}
|
|
57
|
+
const parallelGroup = raw.parallel_group;
|
|
58
|
+
if (parallelGroup !== undefined && typeof parallelGroup !== "string") {
|
|
59
|
+
errors.push(`${where}.parallel_group: must be a string`);
|
|
60
|
+
}
|
|
61
|
+
const note = raw.note;
|
|
62
|
+
if (note !== undefined && typeof note !== "string") {
|
|
63
|
+
errors.push(`${where}.note: must be a string`);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
track,
|
|
67
|
+
domains,
|
|
68
|
+
catalog_status: catalogStatus,
|
|
69
|
+
...(typeof estimate === "number" ? { catalog_duration_estimate_days: estimate } : {}),
|
|
70
|
+
order,
|
|
71
|
+
...(typeof parallelGroup === "string" ? { parallel_group: parallelGroup } : {}),
|
|
72
|
+
depends_on: dependsOn,
|
|
73
|
+
...(typeof note === "string" ? { note } : {}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function loadTimelineIndex(filePath) {
|
|
77
|
+
const errors = [];
|
|
78
|
+
const parsed = readYaml(filePath);
|
|
79
|
+
if (!isRecord(parsed)) {
|
|
80
|
+
throw new Error(`${filePath}: invalid or empty YAML`);
|
|
81
|
+
}
|
|
82
|
+
const projectId = parsed.project_id;
|
|
83
|
+
if (typeof projectId !== "string" || projectId.trim().length === 0) {
|
|
84
|
+
errors.push(`project_id: required non-empty string`);
|
|
85
|
+
}
|
|
86
|
+
if (!Array.isArray(parsed.tracks) || parsed.tracks.length === 0) {
|
|
87
|
+
errors.push(`tracks: required non-empty array`);
|
|
88
|
+
return {
|
|
89
|
+
index: {
|
|
90
|
+
id: typeof parsed.id === "string" ? parsed.id : "",
|
|
91
|
+
project_id: typeof projectId === "string" ? projectId : "",
|
|
92
|
+
status: typeof parsed.status === "string" ? parsed.status : "",
|
|
93
|
+
tracks: [],
|
|
94
|
+
},
|
|
95
|
+
errors,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const tracks = [];
|
|
99
|
+
parsed.tracks.forEach((raw, index) => {
|
|
100
|
+
const track = parseTrack(raw, index, errors);
|
|
101
|
+
if (track)
|
|
102
|
+
tracks.push(track);
|
|
103
|
+
});
|
|
104
|
+
// 計画開始日は YYYY-MM-DD に正規化する。不正な値はエラーとして報告し、未設定とみなす。
|
|
105
|
+
let plannedStartDate;
|
|
106
|
+
if (parsed.planned_start_date !== undefined && parsed.planned_start_date !== null) {
|
|
107
|
+
const normalized = normalizeDateOnly(parsed.planned_start_date);
|
|
108
|
+
if (!normalized) {
|
|
109
|
+
errors.push("planned_start_date: must be a YYYY-MM-DD date");
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
plannedStartDate = normalized;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
index: {
|
|
117
|
+
id: typeof parsed.id === "string" ? parsed.id : "",
|
|
118
|
+
project_id: typeof projectId === "string" ? projectId : "",
|
|
119
|
+
status: typeof parsed.status === "string" ? parsed.status : "",
|
|
120
|
+
tracks,
|
|
121
|
+
...(plannedStartDate !== undefined ? { planned_start_date: plannedStartDate } : {}),
|
|
122
|
+
},
|
|
123
|
+
errors,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
_FRONTMATTER_
|
|
2
|
+
|
|
3
|
+
# Edit Plan: _TASK_ID_
|
|
4
|
+
|
|
5
|
+
## 1. このフェーズで行うこと
|
|
6
|
+
|
|
7
|
+
_PHASE_DESCRIPTION_
|
|
8
|
+
|
|
9
|
+
## 2. 新しく作る実践の型
|
|
10
|
+
|
|
11
|
+
- id: `_AUTHORING_KATA_ID_`
|
|
12
|
+
- kind: `_AUTHORING_KATA_KIND_`
|
|
13
|
+
- path: `_AUTHORING_KATA_PATH_`
|
|
14
|
+
- 記述標準: [[_AUTHORING_STANDARD_ID_|執筆標準]](`_AUTHORING_STANDARD_PATH_`)
|
|
15
|
+
- result: `_RESULT_REF_`
|
|
16
|
+
|
|
17
|
+
手本にする既存成果物:
|
|
18
|
+
|
|
19
|
+
_AUTHORING_EXEMPLARS_
|
|
20
|
+
|
|
21
|
+
手本の成果物は読み取り専用であり、成果物そのものを変更しない。手本がない場合は、記述標準と対象領域の慣行だけを根拠に実践の型を作る。
|
|
22
|
+
|
|
23
|
+
## 3. 進め方
|
|
24
|
+
|
|
25
|
+
1. 記述標準と手本の成果物を実際に読み、複数の成果物に再利用できる規則・問い・完成例・雛形を抽出する。
|
|
26
|
+
2. `_AUTHORING_KATA_PATH_` に `_AUTHORING_KATA_ID_` を持つ `_AUTHORING_KATA_KIND_` を新規作成する。frontmatter の `status` は `draft` とし、`ready` へ変更しない。
|
|
27
|
+
3. 手本の内容を丸写しせず、プロジェクト固有の値を一般化する。手本同士が矛盾する場合は、共通部分と差異を分け、判断できない点を result の申し送りへ記録する。
|
|
28
|
+
4. 手本ごとに、作った種類の参照が `undecided` または未記入なら `_AUTHORING_KATA_ID_` へ更新する。rulebook は成果物カタログの `rulebook`、recipe / sample / template は成果物が参照する rulebook frontmatter の同名フィールドを正本とする。
|
|
29
|
+
5. 参照がすでに別の kata を指す場合は上書きせず、その成果物 ID・既存参照・新しい kata ID を result の申し送りへ記録する。`not-needed` も意図的な判断として上書きしない。
|
|
30
|
+
recipe / sample / template の作成時に、手本の rulebook 自体が `undecided`・未記入・`not-needed` で参照先を記録できない場合は、別種の kata を同時作成せず、付け替え不能として result へ記録する。
|
|
31
|
+
6. 新しい kata と参照の更新だけを変更対象とし、手本の成果物本文は変更しない。
|
|
32
|
+
|
|
33
|
+
## 4. 完了手順
|
|
34
|
+
|
|
35
|
+
1. 新しい実践の型と、条件を満たす参照の更新を完了する。
|
|
36
|
+
2. 共通規約に従って必要な整形・静的検査を実行する。
|
|
37
|
+
3. result に実施内容、変更ファイル、手本、一般化した内容、参照を更新しなかった理由を記録する。
|
|
38
|
+
|
|
39
|
+
## 5. 異常終了の条件
|
|
40
|
+
|
|
41
|
+
- 新しい id が既に存在する、対象種別と id の末尾が一致しない、手本を解決できない、または検査が未解消の場合は異常終了する。
|
|
42
|
+
- 手本の成果物本文へ変更が生じた場合は元に戻し、解消できなければ異常終了する。
|
|
43
|
+
- agent 自身は登録簿の状態を変更しない。
|
|
44
|
+
|
|
45
|
+
_COMMON_CONVENTIONS_
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
_FRONTMATTER_
|
|
2
|
+
|
|
3
|
+
# Edit Plan: _TASK_ID_
|
|
4
|
+
|
|
5
|
+
## 1. このフェーズで行うこと
|
|
6
|
+
|
|
7
|
+
_PHASE_DESCRIPTION_
|
|
8
|
+
|
|
9
|
+
## 2. 新しく作る実践の型
|
|
10
|
+
|
|
11
|
+
- id: `_AUTHORING_KATA_ID_`
|
|
12
|
+
- kind: `_AUTHORING_KATA_KIND_`
|
|
13
|
+
- path: `_AUTHORING_KATA_PATH_`
|
|
14
|
+
- 記述標準: [[_AUTHORING_STANDARD_ID_|執筆標準]](`_AUTHORING_STANDARD_PATH_`)
|
|
15
|
+
- result: `_RESULT_REF_`
|
|
16
|
+
|
|
17
|
+
手本にする既存成果物:
|
|
18
|
+
|
|
19
|
+
_AUTHORING_EXEMPLARS_
|
|
20
|
+
|
|
21
|
+
手本の成果物は読み取り専用であり、成果物そのものを変更しない。手本がない場合は、記述標準と対象領域の慣行だけを根拠に実践の型を作る。
|
|
22
|
+
|
|
23
|
+
## 3. 進め方
|
|
24
|
+
|
|
25
|
+
1. 記述標準と手本の成果物を実際に読み、複数の成果物に再利用できる規則・問い・完成例・雛形を抽出する。
|
|
26
|
+
2. `_AUTHORING_KATA_PATH_` に `_AUTHORING_KATA_ID_` を持つ `_AUTHORING_KATA_KIND_` を新規作成する。frontmatter の `status` は `draft` とし、`ready` へ変更しない。
|
|
27
|
+
3. 手本の内容を丸写しせず、プロジェクト固有の値を一般化する。手本同士が矛盾する場合は、共通部分と差異を分け、判断できない点を result の申し送りへ記録する。
|
|
28
|
+
4. 手本ごとに、作った種類の参照が `undecided` または未記入なら `_AUTHORING_KATA_ID_` へ更新する。rulebook は成果物カタログの `rulebook`、recipe / sample / template は成果物が参照する rulebook frontmatter の同名フィールドを正本とする。
|
|
29
|
+
5. 参照がすでに別の kata を指す場合は上書きせず、その成果物 ID・既存参照・新しい kata ID を result の申し送りへ記録する。`not-needed` も意図的な判断として上書きしない。
|
|
30
|
+
recipe / sample / template の作成時に、手本の rulebook 自体が `undecided`・未記入・`not-needed` で参照先を記録できない場合は、別種の kata を同時作成せず、付け替え不能として result へ記録する。
|
|
31
|
+
6. 新しい kata と参照の更新だけを変更対象とし、手本の成果物本文は変更しない。
|
|
32
|
+
|
|
33
|
+
## 4. 完了手順
|
|
34
|
+
|
|
35
|
+
1. 新しい実践の型と、条件を満たす参照の更新を完了する。
|
|
36
|
+
2. 共通規約に従って必要な整形・静的検査を実行する。
|
|
37
|
+
3. result に実施内容、変更ファイル、手本、一般化した内容、参照を更新しなかった理由を記録する。
|
|
38
|
+
|
|
39
|
+
## 5. 異常終了の条件
|
|
40
|
+
|
|
41
|
+
- 新しい id が既に存在する、対象種別と id の末尾が一致しない、手本を解決できない、または検査が未解消の場合は異常終了する。
|
|
42
|
+
- 手本の成果物本文へ変更が生じた場合は元に戻し、解消できなければ異常終了する。
|
|
43
|
+
- agent 自身は登録簿の状態を変更しない。
|
|
44
|
+
|
|
45
|
+
_COMMON_CONVENTIONS_
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
_FRONTMATTER_
|
|
2
|
+
|
|
3
|
+
# Edit Plan: _TASK_ID_
|
|
4
|
+
|
|
5
|
+
## 1. このフェーズで行うこと
|
|
6
|
+
|
|
7
|
+
_PHASE_DESCRIPTION_
|
|
8
|
+
|
|
9
|
+
## 2. 新しく作る実践の型
|
|
10
|
+
|
|
11
|
+
- id: `_AUTHORING_KATA_ID_`
|
|
12
|
+
- kind: `_AUTHORING_KATA_KIND_`
|
|
13
|
+
- path: `_AUTHORING_KATA_PATH_`
|
|
14
|
+
- 記述標準: [[_AUTHORING_STANDARD_ID_|執筆標準]](`_AUTHORING_STANDARD_PATH_`)
|
|
15
|
+
- result: `_RESULT_REF_`
|
|
16
|
+
|
|
17
|
+
手本にする既存成果物:
|
|
18
|
+
|
|
19
|
+
_AUTHORING_EXEMPLARS_
|
|
20
|
+
|
|
21
|
+
手本の成果物は読み取り専用であり、成果物そのものを変更しない。手本がない場合は、記述標準と対象領域の慣行だけを根拠に実践の型を作る。
|
|
22
|
+
|
|
23
|
+
## 3. 進め方
|
|
24
|
+
|
|
25
|
+
1. 記述標準と手本の成果物を実際に読み、複数の成果物に再利用できる規則・問い・完成例・雛形を抽出する。
|
|
26
|
+
2. `_AUTHORING_KATA_PATH_` に `_AUTHORING_KATA_ID_` を持つ `_AUTHORING_KATA_KIND_` を新規作成する。frontmatter の `status` は `draft` とし、`ready` へ変更しない。
|
|
27
|
+
3. 手本の内容を丸写しせず、プロジェクト固有の値を一般化する。手本同士が矛盾する場合は、共通部分と差異を分け、判断できない点を result の申し送りへ記録する。
|
|
28
|
+
4. 手本ごとに、作った種類の参照が `undecided` または未記入なら `_AUTHORING_KATA_ID_` へ更新する。rulebook は成果物カタログの `rulebook`、recipe / sample / template は成果物が参照する rulebook frontmatter の同名フィールドを正本とする。
|
|
29
|
+
5. 参照がすでに別の kata を指す場合は上書きせず、その成果物 ID・既存参照・新しい kata ID を result の申し送りへ記録する。`not-needed` も意図的な判断として上書きしない。
|
|
30
|
+
recipe / sample / template の作成時に、手本の rulebook 自体が `undecided`・未記入・`not-needed` で参照先を記録できない場合は、別種の kata を同時作成せず、付け替え不能として result へ記録する。
|
|
31
|
+
6. 新しい kata と参照の更新だけを変更対象とし、手本の成果物本文は変更しない。
|
|
32
|
+
|
|
33
|
+
## 4. 完了手順
|
|
34
|
+
|
|
35
|
+
1. 新しい実践の型と、条件を満たす参照の更新を完了する。
|
|
36
|
+
2. 共通規約に従って必要な整形・静的検査を実行する。
|
|
37
|
+
3. result に実施内容、変更ファイル、手本、一般化した内容、参照を更新しなかった理由を記録する。
|
|
38
|
+
|
|
39
|
+
## 5. 異常終了の条件
|
|
40
|
+
|
|
41
|
+
- 新しい id が既に存在する、対象種別と id の末尾が一致しない、手本を解決できない、または検査が未解消の場合は異常終了する。
|
|
42
|
+
- 手本の成果物本文へ変更が生じた場合は元に戻し、解消できなければ異常終了する。
|
|
43
|
+
- agent 自身は登録簿の状態を変更しない。
|
|
44
|
+
|
|
45
|
+
_COMMON_CONVENTIONS_
|