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,207 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { join, posix } from "node:path";
|
|
5
|
+
|
|
6
|
+
const repoRoot = process.cwd();
|
|
7
|
+
const command = process.argv[2];
|
|
8
|
+
const files = process.argv.slice(3);
|
|
9
|
+
|
|
10
|
+
function cleanGitEnvironment() {
|
|
11
|
+
const env = { ...process.env };
|
|
12
|
+
for (const name of [
|
|
13
|
+
"GIT_ALTERNATE_OBJECT_DIRECTORIES",
|
|
14
|
+
"GIT_COMMON_DIR",
|
|
15
|
+
"GIT_DIR",
|
|
16
|
+
"GIT_GRAFT_FILE",
|
|
17
|
+
"GIT_IMPLICIT_WORK_TREE",
|
|
18
|
+
"GIT_INDEX_FILE",
|
|
19
|
+
"GIT_NAMESPACE",
|
|
20
|
+
"GIT_NO_REPLACE_OBJECTS",
|
|
21
|
+
"GIT_OBJECT_DIRECTORY",
|
|
22
|
+
"GIT_PREFIX",
|
|
23
|
+
"GIT_QUARANTINE_PATH",
|
|
24
|
+
"GIT_REPLACE_REF_BASE",
|
|
25
|
+
"GIT_SHALLOW_FILE",
|
|
26
|
+
"GIT_WORK_TREE",
|
|
27
|
+
]) {
|
|
28
|
+
delete env[name];
|
|
29
|
+
}
|
|
30
|
+
return env;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function runNode(entry, args) {
|
|
34
|
+
if (!existsSync(entry)) {
|
|
35
|
+
process.stdout.write(`[specdojo-hook] skipped: ${entry} is unavailable; run npm install.\n`);
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
const result = spawnSync(process.execPath, [entry, ...args], {
|
|
39
|
+
cwd: repoRoot,
|
|
40
|
+
env: cleanGitEnvironment(),
|
|
41
|
+
stdio: "inherit",
|
|
42
|
+
});
|
|
43
|
+
if (result.error) throw result.error;
|
|
44
|
+
return result.status ?? 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function stagedFiles() {
|
|
48
|
+
const result = spawnSync("git", ["diff", "--cached", "--name-only", "-z", "--diff-filter=ACMR"], {
|
|
49
|
+
cwd: repoRoot,
|
|
50
|
+
env: cleanGitEnvironment(),
|
|
51
|
+
encoding: "utf8",
|
|
52
|
+
});
|
|
53
|
+
if (result.error) throw result.error;
|
|
54
|
+
if (result.status !== 0) {
|
|
55
|
+
process.stderr.write(result.stderr || "Unable to inspect staged files.\n");
|
|
56
|
+
process.exit(result.status ?? 1);
|
|
57
|
+
}
|
|
58
|
+
return result.stdout
|
|
59
|
+
.split("\0")
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.map((file) => file.replaceAll("\\", "/"));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function configuredProjects() {
|
|
65
|
+
const configPath = join(repoRoot, ".specdojo", "specdojo.config.json");
|
|
66
|
+
if (!existsSync(configPath)) return [];
|
|
67
|
+
const config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
68
|
+
if (!config.projects || typeof config.projects !== "object") return [];
|
|
69
|
+
return Object.entries(config.projects).map(([id, project]) => ({ id, project }));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function configuredPath(project, key) {
|
|
73
|
+
const relativePath = typeof project[key] === "string" ? project[key].trim() : "";
|
|
74
|
+
if (!relativePath) return undefined;
|
|
75
|
+
const basePath = typeof project.base_path === "string" ? project.base_path.trim() : "";
|
|
76
|
+
return posix
|
|
77
|
+
.normalize(
|
|
78
|
+
basePath
|
|
79
|
+
? `${basePath.replaceAll("\\", "/")}/${relativePath.replaceAll("\\", "/")}`
|
|
80
|
+
: relativePath.replaceAll("\\", "/"),
|
|
81
|
+
)
|
|
82
|
+
.replace(/^\.\//, "");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isWithin(file, directory) {
|
|
86
|
+
return file === directory || file.startsWith(`${directory}/`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function runSpecDojoForChangedProjects(key, args) {
|
|
90
|
+
const changed = stagedFiles();
|
|
91
|
+
const projects = configuredProjects().filter(({ project }) => {
|
|
92
|
+
const directory = configuredPath(project, key);
|
|
93
|
+
return directory && changed.some((file) => isWithin(file, directory));
|
|
94
|
+
});
|
|
95
|
+
if (projects.length === 0) return 0;
|
|
96
|
+
const specdojoCli = join(repoRoot, "node_modules", "specdojo", "dist", "specdojo.js");
|
|
97
|
+
for (const { id } of projects) {
|
|
98
|
+
const status = runNode(specdojoCli, [...args, "--project", id]);
|
|
99
|
+
if (status !== 0) return status;
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function getIgnoreModule() {
|
|
105
|
+
const tryPaths = [
|
|
106
|
+
join(repoRoot, "node_modules", "markdownlint-cli", "markdownlint.js"),
|
|
107
|
+
join(repoRoot, "package.json"),
|
|
108
|
+
];
|
|
109
|
+
for (const candidatePath of tryPaths) {
|
|
110
|
+
if (existsSync(candidatePath)) {
|
|
111
|
+
try {
|
|
112
|
+
const req = createRequire(candidatePath);
|
|
113
|
+
return req("ignore");
|
|
114
|
+
} catch {
|
|
115
|
+
// Continue searching
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function parseSimpleIgnore(content) {
|
|
123
|
+
const rules = content
|
|
124
|
+
.split(/\r?\n/)
|
|
125
|
+
.map((line) => line.trim())
|
|
126
|
+
.filter((line) => line && !line.startsWith("#"));
|
|
127
|
+
|
|
128
|
+
return (file) => {
|
|
129
|
+
const normalized = posix.normalize(file.replaceAll("\\", "/")).replace(/^\.\//, "");
|
|
130
|
+
for (const rule of rules) {
|
|
131
|
+
const isNegated = rule.startsWith("!");
|
|
132
|
+
const pattern = (isNegated ? rule.slice(1) : rule).replace(/^\.\//, "");
|
|
133
|
+
let matches = false;
|
|
134
|
+
if (pattern.endsWith("/")) {
|
|
135
|
+
matches = normalized === pattern.slice(0, -1) || normalized.startsWith(pattern);
|
|
136
|
+
} else {
|
|
137
|
+
matches =
|
|
138
|
+
normalized === pattern ||
|
|
139
|
+
normalized.endsWith(`/${pattern}`) ||
|
|
140
|
+
normalized.startsWith(`${pattern}/`);
|
|
141
|
+
}
|
|
142
|
+
if (matches) {
|
|
143
|
+
return !isNegated;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function getIgnoreFilter(ignoreFileName) {
|
|
151
|
+
const ignorePath = join(repoRoot, ignoreFileName);
|
|
152
|
+
if (!existsSync(ignorePath)) return () => false;
|
|
153
|
+
const content = readFileSync(ignorePath, "utf8");
|
|
154
|
+
const ignoreFactory = getIgnoreModule();
|
|
155
|
+
if (ignoreFactory) {
|
|
156
|
+
const ig = ignoreFactory().add(content);
|
|
157
|
+
return (file) => ig.ignores(posix.normalize(file.replaceAll("\\", "/")).replace(/^\.\//, ""));
|
|
158
|
+
}
|
|
159
|
+
return parseSimpleIgnore(content);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function filterFiles(candidateFiles, ignoreFileName) {
|
|
163
|
+
if (candidateFiles.length === 0) return [];
|
|
164
|
+
const isIgnored = getIgnoreFilter(ignoreFileName);
|
|
165
|
+
return candidateFiles.filter((file) => !isIgnored(file));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function isMarkdownFile(file) {
|
|
169
|
+
return /\.(md|markdown)$/i.test(file);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let status;
|
|
173
|
+
switch (command) {
|
|
174
|
+
case "prettier": {
|
|
175
|
+
const targetFiles = filterFiles(files, ".prettierignore");
|
|
176
|
+
status =
|
|
177
|
+
targetFiles.length === 0
|
|
178
|
+
? 0
|
|
179
|
+
: runNode(join(repoRoot, "node_modules", "prettier", "bin", "prettier.cjs"), [
|
|
180
|
+
"--write",
|
|
181
|
+
"--",
|
|
182
|
+
...targetFiles,
|
|
183
|
+
]);
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case "markdownlint": {
|
|
187
|
+
const targetFiles = filterFiles(files.filter(isMarkdownFile), ".markdownlintignore");
|
|
188
|
+
status =
|
|
189
|
+
targetFiles.length === 0
|
|
190
|
+
? 0
|
|
191
|
+
: runNode(join(repoRoot, "node_modules", "markdownlint-cli", "markdownlint.js"), [
|
|
192
|
+
"--",
|
|
193
|
+
...targetFiles,
|
|
194
|
+
]);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
case "register-build":
|
|
198
|
+
status = runSpecDojoForChangedProjects("project_register_path", ["register", "build"]);
|
|
199
|
+
break;
|
|
200
|
+
case "catalog-validate":
|
|
201
|
+
status = runSpecDojoForChangedProjects("catalog_path", ["catalog", "validate"]);
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
process.stderr.write(`Unknown SpecDojo hook command: ${command ?? "(missing)"}\n`);
|
|
205
|
+
status = 1;
|
|
206
|
+
}
|
|
207
|
+
process.exit(status);
|
|
@@ -42,7 +42,7 @@ specdojo exec scaffold --provider opencode
|
|
|
42
42
|
report: { agent: opencode-reporter }
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
2. `.specdojo/agent-members.yaml` を実体と別名の 2 段で書く。実体は model の系統で名付け(`gemma-executor`・`qwen-executor` など)、`model` に `opencode.json` の provider 名を含む ID(`ollama-local/gemma4:31b-
|
|
45
|
+
2. `.specdojo/agent-members.yaml` を実体と別名の 2 段で書く。実体は model の系統で名付け(`gemma-executor`・`qwen-executor` など)、`model` に `opencode.json` の provider 名を含む ID(`ollama-local/gemma4:31b` や `ollama-local/gemma4:26b` など)を持つ。従来の名前(`opencode-executor` など)は `aliases` で実体を指す別名にする。
|
|
46
46
|
3. モデル接続設定(`opencode.json` の provider / model)を利用環境に合わせて作成する。ローカル Ollama の接続先などマシン固有の値を含むため、このテンプレートには含めていない。
|
|
47
47
|
4. コピーしたファイルをコミットする。worktree はコミット済み内容から作られるため、未コミットだと agent 実行時に設定が読めない。
|
|
48
48
|
|
|
@@ -50,6 +50,12 @@ specdojo exec scaffold --provider opencode
|
|
|
50
50
|
|
|
51
51
|
- edit agent の `permission.edit` は既定で `docs/**`、`src/**`、`tests/**` を許可する。`permission.edit` / `permission.bash` のパターンは、利用プロジェクトの成果物・execution ディレクトリ配置に合わせて調整する。
|
|
52
52
|
- 従来の `opencode run --agent {nickname}` と model を持つ定義ファイルで組んだ 1 段の名簿は、そのまま動く。scaffold は既存ファイルを上書きしないため、`--force` で役割ごとの定義(model を持たない)に置き換える場合だけ、上の `command_template` と 2 段の名簿へ移す。
|
|
53
|
+
- 文脈の長さ(`num_ctx` など)を広げたい場合は、Modelfile(`FROM gemma4:31b`、`PARAMETER num_ctx 65536` など)を用意して Ollama で別タグを作成し(`ollama create gemma4:31b-work-64k -f Modelfile` など)、`.specdojo/agent-members.yaml` の各 member の `model` をそのタグ名へ書き換えます。
|
|
54
|
+
- `specdojo init` や `config scaffold` は既存の `.specdojo/agent-members.yaml` を上書きしません。既に導入したプロジェクトで reporter を 26b に変えたい場合は、`.specdojo/agent-members.yaml` の `gemma-reporter` の `model` を `ollama-local/gemma4:26b`(または独自タグ)へ直接書き換えてください。
|
|
55
|
+
- Mac の Apple シリコンでは、Ollama の公式の mlx 版(`gemma4:26b-mlx`・`gemma4:31b-mlx`)を `ollama pull` で取得して使えます。
|
|
56
|
+
- 使う場合は `.specdojo/agent-members.yaml` の `model` を `ollama-local/gemma4:26b-mlx` などに書き換えてください。Modelfile で文脈を広げる場合は `FROM` に mlx 版のタグを書きます。
|
|
57
|
+
- 既定の雛形は環境を選ばない無印のタグ(`gemma4:26b`・`gemma4:31b`)のままとします。
|
|
53
58
|
- executor の result パス deny と reporter の全ツール deny は、pipeline の責務境界なので維持する。
|
|
54
|
-
- `bash` は deny 基点の許可リストを維持する。`git add` / `git commit`
|
|
59
|
+
- executor・review executor の `bash` は deny 基点の許可リストを維持する。`git add` / `git commit` を許可せず、末尾の `git push` と全 `gh` の明示 deny も維持する(許可リストの追加で remote 操作を誤って開かないため)。
|
|
60
|
+
- orchestrator は利用者の承認後に保護設定も変更できるよう `edit` をリポジトリ全体で allow する。`gh pr view`・`gh pr list`・`gh run list`・`gh run view`・`gh release view` などの読み取りだけを allow し、`git push`、`gh api`、PR・release・repository などの書き込みサブコマンドは明示 deny する。それ以外の `gh` は先頭の `"*": deny` により拒否する。
|
|
55
61
|
- 権限設計の背景は `exec-config-guide.md` の `agent 権限とプロンプトインジェクション対策` を参照する。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: SpecDojo 対話型オーケストレーター。会話から意図を読み取り、specdojo register / exec などを提案→承認→実行で代行する。
|
|
3
3
|
mode: primary
|
|
4
|
-
model: ollama-local/gemma4:31b
|
|
4
|
+
model: ollama-local/gemma4:31b
|
|
5
5
|
temperature: 0.2
|
|
6
6
|
permission:
|
|
7
7
|
read:
|
|
@@ -33,11 +33,65 @@ permission:
|
|
|
33
33
|
"npm run lint:md*": allow
|
|
34
34
|
"npm run lint:fm*": allow
|
|
35
35
|
"npm run validate:schema:file*": allow
|
|
36
|
-
|
|
37
|
-
"*":
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
36
|
+
"gh auth status*": allow
|
|
37
|
+
"gh issue list*": allow
|
|
38
|
+
"gh issue status*": allow
|
|
39
|
+
"gh issue view*": allow
|
|
40
|
+
"gh pr checks*": allow
|
|
41
|
+
"gh pr diff*": allow
|
|
42
|
+
"gh pr list*": allow
|
|
43
|
+
"gh pr status*": allow
|
|
44
|
+
"gh pr view*": allow
|
|
45
|
+
"gh release list*": allow
|
|
46
|
+
"gh release view*": allow
|
|
47
|
+
"gh repo list*": allow
|
|
48
|
+
"gh repo view*": allow
|
|
49
|
+
"gh run list*": allow
|
|
50
|
+
"gh run view*": allow
|
|
51
|
+
"gh run watch*": allow
|
|
52
|
+
"gh search *": allow
|
|
53
|
+
"gh status*": allow
|
|
54
|
+
"gh workflow list*": allow
|
|
55
|
+
"gh workflow view*": allow
|
|
56
|
+
"git push*": deny
|
|
57
|
+
"gh api*": deny
|
|
58
|
+
"gh pr close*": deny
|
|
59
|
+
"gh pr create*": deny
|
|
60
|
+
"gh pr merge*": deny
|
|
61
|
+
"gh auth login*": deny
|
|
62
|
+
"gh auth logout*": deny
|
|
63
|
+
"gh auth refresh*": deny
|
|
64
|
+
"gh auth setup-git*": deny
|
|
65
|
+
"gh * archive*": deny
|
|
66
|
+
"gh * cancel*": deny
|
|
67
|
+
"gh * clone*": deny
|
|
68
|
+
"gh * close*": deny
|
|
69
|
+
"gh * comment*": deny
|
|
70
|
+
"gh * create*": deny
|
|
71
|
+
"gh * delete*": deny
|
|
72
|
+
"gh * disable*": deny
|
|
73
|
+
"gh * edit*": deny
|
|
74
|
+
"gh * enable*": deny
|
|
75
|
+
"gh * fork*": deny
|
|
76
|
+
"gh * install*": deny
|
|
77
|
+
"gh * lock*": deny
|
|
78
|
+
"gh * merge*": deny
|
|
79
|
+
"gh * pin*": deny
|
|
80
|
+
"gh * ready*": deny
|
|
81
|
+
"gh * remove*": deny
|
|
82
|
+
"gh * rename*": deny
|
|
83
|
+
"gh * reopen*": deny
|
|
84
|
+
"gh * rerun*": deny
|
|
85
|
+
"gh * review*": deny
|
|
86
|
+
"gh * run*": deny
|
|
87
|
+
"gh * set*": deny
|
|
88
|
+
"gh * sync*": deny
|
|
89
|
+
"gh * transfer*": deny
|
|
90
|
+
"gh * unlock*": deny
|
|
91
|
+
"gh * unpin*": deny
|
|
92
|
+
"gh * upgrade*": deny
|
|
93
|
+
"gh * upload*": deny
|
|
94
|
+
edit: allow
|
|
41
95
|
task: deny
|
|
42
96
|
webfetch: allow
|
|
43
97
|
websearch: allow
|
|
File without changes
|