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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
SpecDojo の利用者に影響する変更を記録します。
|
|
4
4
|
|
|
5
|
+
## [0.4.3] - 2026-10-23
|
|
6
|
+
|
|
7
|
+
### 追加機能
|
|
8
|
+
|
|
9
|
+
- 既存成果物を手本に kata だけを新規作成する `rulebook-authoring` / `recipe-authoring` / `sample-authoring` / `template-authoring` approach を追加しました。利用者の kata はリポジトリ単位の `kata_authority` と `docs/ja/kata/` 配置で同梱 kata から分離し、手本の未決参照は同じ実行で新しい ID へ更新します(PJR-CT6G)。
|
|
10
|
+
- Dev Container の preset に、provider の CLI と最低限だけを入れる `minimal` と、推奨構成に開発ツール・Ollama 接続・cron を加える `full` を追加しました。`specdojo init` では `minimal` / `recommended` / `full` を選択でき、既定は従来どおり `recommended`、従来の `none` は `minimal` の別名として利用できます(PJR-47S6)。
|
|
11
|
+
- Dev Container の推奨 preset に GitHub CLI(`gh`)を加え、コンテナ内で行ったログインをリポジトリ別の名前付き volume に保存するようにしました。ホストの認証情報はマウントせず、自動ログインもしません。共有された認証を agent が使ってリモートを書き換えないよう、Claude Code・Codex・OpenCode・Antigravity の配布権限では `git push` と `gh` の書き込みを拒否します。pipeline executor と reporter は全 `gh` を拒否し、Claude Code と OpenCode の対話型オーケストレーターだけは専用権限で読み取りを許可します(PJR-ZH7Q)。
|
|
12
|
+
- `specdojo.config.json` の `external_projects` で別リポジトリの project を別名付きで宣言し、`register add --project <別名> --commit` から相手にインストールされた SpecDojo へ起票を委譲できるようにしました。`--from <別名>:PJR-XXXX` は相手の実 project ID へ変換し、`orchestrator launch` は宣言した外部リポジトリにも編集許可を付けます(PJR-5B42)。
|
|
13
|
+
|
|
14
|
+
### 変更
|
|
15
|
+
|
|
16
|
+
- ドキュメントサイトの Mermaid 12 で既定のレイアウトを Dagre から ELK へ切り替え、複雑な図を層状・直角配線で描くようにしました。日本語と絵文字のフォントを描画環境へ揃え、図中の絵文字が欠けないようにしました。文書編集ガイドには、辺が多い図の分割、中心へ矢印を集める `architecture` 図、格子状に並べる `block` 図の書き方を追加しました(PJR-QF45)。
|
|
17
|
+
|
|
18
|
+
### 文書
|
|
19
|
+
|
|
20
|
+
- Quick Start ガイドを register のユースケース別の実行例を中心に組み替え、`difficulty` と approach、統合後 review、夜間実行、再開、別 project への起票を「こんなとき」「チャットでの頼み方」「コマンド」の順で追加しました。成果物カタログ、Schedule、worktree、routine は発展手順として後段にまとめました(PJR-98SQ)。
|
|
21
|
+
|
|
22
|
+
## [0.4.2] - 2026-10-22
|
|
23
|
+
|
|
24
|
+
### 追加機能
|
|
25
|
+
|
|
26
|
+
- `specdojo init --lefthook` と `specdojo config scaffold --lefthook` で、利用リポジトリ向けの `lefthook.yml`、SpecDojo 文書向けの markdownlint 設定と agent 定義の除外、依存なしの入口スクリプトを生成できるようにしました。pre-commit は staged の Markdown・YAML に対する Prettier、Markdown に対する markdownlint、設定済みパスの変更に対する `register build`・`catalog validate` を実行します。既存ファイル・npm script・依存は上書きせず、package への追加内容を先に表示します(PJR-7H7N)。
|
|
27
|
+
- 別 project の作業ツリーから `register add --project <project-id> --commit` を実行し、対象 project の統合ブランチへ直接起票できるようにしました。統合ブランチは project の `integration_branch` で指定でき、省略時は `project/<project-id>/develop` です。project 修飾した `--from` は参照先 project の統合ブランチから存在を確認します(PJR-W93C)。
|
|
28
|
+
|
|
29
|
+
### 変更
|
|
30
|
+
|
|
31
|
+
- ドキュメントサイトでは exec の plan / result をページ生成の対象から外し、実行記録一覧などからのリンクを GitHub 上の正本へ置き換えるようにしました。元の実行記録と dead link 検査は維持したまま、ページ数とビルド時のメモリ使用量を削減します(PJR-98P8)。
|
|
32
|
+
- `templates/init-agent-members.yaml` で配布する OpenCode の `gemma-reporter` の既定モデルを 26b(`ollama-local/gemma4:26b`)にし、`gemma-executor`・`gemma-review-executor` および対話型オーケストレーターのモデル名からローカル固有のタグ(`-mlx-work-64k`)を除いて利用者が `ollama pull` で取得できるタグ名(`ollama-local/gemma4:31b`)に改めました。また `templates/opencode/README.md` に文脈長拡張のための Modelfile 手順と既存名簿の書き換え案内を追記しました(PJR-2ASZ)。
|
|
33
|
+
|
|
34
|
+
### 不具合修正
|
|
35
|
+
|
|
36
|
+
- plan / result の stem、アーカイブ済み plan、実行 event の乱数部分を2バイトから4バイトへ広げ、同じ slug・UTC秒・乱数が重複した場合は連番で別名にするようにしました。event は排他的な新規作成で既存履歴を上書きせず、旧形式の plan 名も引き続き読み取れます(PJR-CNNT)。
|
|
37
|
+
- `templates/lefthook/tools/specdojo-pre-commit.mjs` で、commit したファイルが `.markdownlintignore` や `.prettierignore` で除外されて検査対象がなくなった場合に、markdownlint や Prettier を呼ばずに成功で終えるようにしました。除外ファイルのみを commit したときに markdownlint の使い方の説明(Usage)が出力される問題を解消します(PJR-62T2)。
|
|
38
|
+
- `register build` が生成する登録簿一覧・派生ビュー・PM ログで、自由記述セルのアスタリスクとアンダースコアをエスケープするようにしました。既存のコードスパンとエスケープ済みの記号は保持し、`orch:*` のような記述が複数ある場合も markdownlint(MD037)で止まりません(PJR-6SQH)。
|
|
39
|
+
|
|
40
|
+
### 文書
|
|
41
|
+
|
|
42
|
+
- `templates/opencode/README.md` に、Mac の Apple シリコン向けに Ollama の公式 mlx 版(`gemma4:26b-mlx`・`gemma4:31b-mlx`)を利用する場合の指定方法と Modelfile での文脈拡張の案内を追記しました(PJR-STB4)。
|
|
43
|
+
|
|
5
44
|
## [0.4.1] - 2026-10-21
|
|
6
45
|
|
|
7
46
|
### 追加機能
|
package/dist/catalog/build.js
CHANGED
|
@@ -2,13 +2,13 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { load } from "../shared/yaml.js";
|
|
4
4
|
import { isDctCatalogFileName } from "./types.js";
|
|
5
|
-
import { declaredIncludes, declaredKata } from "../kata/kata.js";
|
|
5
|
+
import { declaredIncludes, declaredKata, resolveKataDocumentPathIfExists } from "../kata/kata.js";
|
|
6
6
|
import { readSpecdojoNamespace } from "../docs/frontmatter-namespace.js";
|
|
7
7
|
import { flattenTemplateFrontmatter } from "../docs/template-frontmatter.js";
|
|
8
8
|
import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
9
9
|
import { buildMarkdown, isRecord, isDctTemplateCatalog, renderCatalogTemplateBody, } from "./build-render.js";
|
|
10
10
|
import { collectResolvedDeliverables, validateBasedOn } from "./build-references.js";
|
|
11
|
-
import { resolveSpecdojoPath, resolveSpecdojoPathIfExists, specdojoDirectoryPaths,
|
|
11
|
+
import { resolveSpecdojoPath, resolveSpecdojoPathIfExists, specdojoDirectoryPaths, } from "../docs/template-resolution.js";
|
|
12
12
|
const CATALOG_RULEBOOK_ID_PATTERN = /^(?:[a-z][a-z0-9-]*:)?[a-z0-9][a-z0-9-]*-rulebook$/;
|
|
13
13
|
const CATALOG_KATA_DIRS = {
|
|
14
14
|
rulebook: "rulebooks",
|
|
@@ -17,12 +17,12 @@ const CATALOG_KATA_DIRS = {
|
|
|
17
17
|
template: "templates",
|
|
18
18
|
};
|
|
19
19
|
function declaredKataCandidates(repoRoot, kind, id) {
|
|
20
|
-
const localId = id.includes(":") ? id.split(":").slice(1).join(":") : id;
|
|
21
20
|
const extensions = kind === "rulebook" || kind === "recipe" ? ["md"] : ["md", "yaml", "json"];
|
|
22
|
-
return extensions.
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return extensions.flatMap((extension) => {
|
|
22
|
+
const resolved = resolveKataDocumentPathIfExists(kind, id, extension, {
|
|
23
|
+
repositoryRoot: repoRoot,
|
|
24
|
+
});
|
|
25
|
+
return resolved ? [resolved] : [];
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function readPracticeDocumentId(filePath) {
|
package/dist/catalog/generate.js
CHANGED
|
@@ -4,7 +4,8 @@ import { dump, load } from "../shared/yaml.js";
|
|
|
4
4
|
import { collectResolvedDeliverables } from "./build.js";
|
|
5
5
|
import { resolveBasePath } from "./paths.js";
|
|
6
6
|
import { buildSpecdojoFrontmatter, readSpecdojoNamespace } from "../docs/frontmatter-namespace.js";
|
|
7
|
-
import { practiceLocalId } from "../shared/practice-id.js";
|
|
7
|
+
import { parsePracticeId, practiceLocalId } from "../shared/practice-id.js";
|
|
8
|
+
import { resolveKataDocumentPathIfExists } from "../kata/kata.js";
|
|
8
9
|
import { flattenTemplateFrontmatter } from "../docs/template-frontmatter.js";
|
|
9
10
|
import { isDctCatalogFileName } from "./types.js";
|
|
10
11
|
import { resolveSpecdojoPathIfExists, } from "../docs/template-resolution.js";
|
|
@@ -64,7 +65,7 @@ function normalizeDctName(name) {
|
|
|
64
65
|
// Resolve a deliverable template from the rulebook frontmatter declaration. The declaration is
|
|
65
66
|
// the SSOT, so local_id naming conventions are deliberately not used as a fallback. This lets
|
|
66
67
|
// every deliverable in one rulebook lineage share a single template.
|
|
67
|
-
function findTemplate(templatesPath, rulebooksPath, rulebookId, ext, resourceRoots) {
|
|
68
|
+
function findTemplate(templatesPath, rulebooksPath, repoRoot, rulebookId, ext, resourceRoots) {
|
|
68
69
|
if (!rulebookId ||
|
|
69
70
|
rulebookId === "none" ||
|
|
70
71
|
rulebookId === "not-needed" ||
|
|
@@ -72,9 +73,16 @@ function findTemplate(templatesPath, rulebooksPath, rulebookId, ext, resourceRoo
|
|
|
72
73
|
return null;
|
|
73
74
|
}
|
|
74
75
|
const rulebookFileName = `${practiceLocalId(rulebookId)}.md`;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
const rulebookAuthority = parsePracticeId(rulebookId).authority;
|
|
77
|
+
const localRulebook = rulebookAuthority !== undefined && rulebookAuthority !== "specdojo";
|
|
78
|
+
const rulebookPath = localRulebook
|
|
79
|
+
? resolveKataDocumentPathIfExists("rulebook", rulebookId, "md", {
|
|
80
|
+
...resourceRoots,
|
|
81
|
+
repositoryRoot: repoRoot,
|
|
82
|
+
})
|
|
83
|
+
: resourceRoots
|
|
84
|
+
? resolveSpecdojoPathIfExists(`docs/ja/specdojo/rulebooks/${rulebookFileName}`, resourceRoots)
|
|
85
|
+
: join(rulebooksPath, rulebookFileName);
|
|
78
86
|
if (!rulebookPath)
|
|
79
87
|
return null;
|
|
80
88
|
if (!existsSync(rulebookPath))
|
|
@@ -87,9 +95,16 @@ function findTemplate(templatesPath, rulebooksPath, rulebookId, ext, resourceRoo
|
|
|
87
95
|
return null;
|
|
88
96
|
}
|
|
89
97
|
const templateFileName = `${practiceLocalId(templateId)}${ext}`;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
const templateAuthority = parsePracticeId(templateId).authority;
|
|
99
|
+
const localTemplate = templateAuthority !== undefined && templateAuthority !== "specdojo";
|
|
100
|
+
const candidate = localTemplate
|
|
101
|
+
? resolveKataDocumentPathIfExists("template", templateId, ext.slice(1), {
|
|
102
|
+
...resourceRoots,
|
|
103
|
+
repositoryRoot: repoRoot,
|
|
104
|
+
})
|
|
105
|
+
: resourceRoots
|
|
106
|
+
? resolveSpecdojoPathIfExists(`docs/ja/specdojo/templates/${templateFileName}`, resourceRoots)
|
|
107
|
+
: join(templatesPath, templateFileName);
|
|
93
108
|
if (!candidate)
|
|
94
109
|
return null;
|
|
95
110
|
return existsSync(candidate) ? candidate : null;
|
|
@@ -138,12 +153,12 @@ function expandYamlTemplate(templatePath, item, projectId) {
|
|
|
138
153
|
const doc = replaceGeneratedPlaceholders(merged, item, projectId);
|
|
139
154
|
return dump(doc, { lineWidth: 120, noRefs: true });
|
|
140
155
|
}
|
|
141
|
-
function generateContent(item, resolvedPath, projectId, templatesPath, rulebooksPath, resourceRoots) {
|
|
156
|
+
function generateContent(item, resolvedPath, projectId, templatesPath, rulebooksPath, repoRoot, resourceRoots) {
|
|
142
157
|
if (isYamlPath(resolvedPath)) {
|
|
143
|
-
const template = findTemplate(templatesPath, rulebooksPath, item.rulebook, ".yaml", resourceRoots);
|
|
158
|
+
const template = findTemplate(templatesPath, rulebooksPath, repoRoot, item.rulebook, ".yaml", resourceRoots);
|
|
144
159
|
return template ? expandYamlTemplate(template, item, projectId) : fallbackYaml(item, projectId);
|
|
145
160
|
}
|
|
146
|
-
const template = findTemplate(templatesPath, rulebooksPath, item.rulebook, ".md", resourceRoots);
|
|
161
|
+
const template = findTemplate(templatesPath, rulebooksPath, repoRoot, item.rulebook, ".md", resourceRoots);
|
|
147
162
|
if (template) {
|
|
148
163
|
const raw = readFileSync(template, "utf8");
|
|
149
164
|
return replaceGeneratedPlaceholders(flattenTemplateFrontmatter(raw), item, projectId);
|
|
@@ -207,7 +222,7 @@ export function runGenerate(opts) {
|
|
|
207
222
|
continue;
|
|
208
223
|
}
|
|
209
224
|
try {
|
|
210
|
-
const content = generateContent(item, resolvedPath, projectId, templatesPath, rulebooksPath, resourceRoots);
|
|
225
|
+
const content = generateContent(item, resolvedPath, projectId, templatesPath, rulebooksPath, repoRoot, resourceRoots);
|
|
211
226
|
if (!dryRun) {
|
|
212
227
|
mkdirSync(dirname(outputPath), { recursive: true });
|
|
213
228
|
writeFileSync(outputPath, content, "utf8");
|
package/dist/commands/init.js
CHANGED
|
@@ -5,6 +5,7 @@ import { dump, load } from "../shared/yaml.js";
|
|
|
5
5
|
import { runScaffold } from "../catalog/scaffold.js";
|
|
6
6
|
import { runDevcontainerScaffold } from "../devcontainer/scaffold.js";
|
|
7
7
|
import { runProviderScaffold } from "../shared/provider-scaffold.js";
|
|
8
|
+
import { runLefthookScaffold } from "../shared/lefthook-scaffold.js";
|
|
8
9
|
import { generateDerivedViewFiles } from "../register/register.js";
|
|
9
10
|
import { defaultWorktreeBase, projectGitignoreLayout, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
10
11
|
import { ensureGitignore, formatGitignoreReport, gitignorePatternsForLayouts, } from "../shared/specdojo-gitignore.js";
|
|
@@ -67,11 +68,14 @@ function parseCatalog(value) {
|
|
|
67
68
|
}
|
|
68
69
|
function parseDevcontainerPreset(value) {
|
|
69
70
|
const normalized = value?.trim().toLowerCase();
|
|
70
|
-
if (!normalized
|
|
71
|
+
if (!normalized)
|
|
71
72
|
return undefined;
|
|
72
|
-
if (normalized === "
|
|
73
|
+
if (normalized === "none" || normalized === "-")
|
|
74
|
+
return "minimal";
|
|
75
|
+
if (normalized === "minimal" || normalized === "recommended" || normalized === "full") {
|
|
73
76
|
return normalized;
|
|
74
|
-
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`Invalid Dev Container preset: ${value}. Must be minimal, recommended, full, or none`);
|
|
75
79
|
}
|
|
76
80
|
function validateProjectId(projectId) {
|
|
77
81
|
if (!/^prj-[0-9]{4,}$/.test(projectId)) {
|
|
@@ -142,6 +146,7 @@ export async function collectInitAnswers(options, prompter) {
|
|
|
142
146
|
exec: !!options.exec,
|
|
143
147
|
catalog: parseCatalog(options.catalog),
|
|
144
148
|
devcontainer,
|
|
149
|
+
lefthook: !!options.lefthook,
|
|
145
150
|
...(devcontainerPreset ? { devcontainerPreset } : {}),
|
|
146
151
|
});
|
|
147
152
|
for (const [label, used] of [
|
|
@@ -154,6 +159,7 @@ export async function collectInitAnswers(options, prompter) {
|
|
|
154
159
|
["exec=no", !options.exec],
|
|
155
160
|
["catalog=none", !options.catalog],
|
|
156
161
|
["devcontainer=no", !options.devcontainer],
|
|
162
|
+
["lefthook=no", !options.lefthook],
|
|
157
163
|
["devcontainer-preset=recommended", devcontainer && options.devcontainerPreset === undefined],
|
|
158
164
|
]) {
|
|
159
165
|
if (used)
|
|
@@ -170,6 +176,7 @@ export async function collectInitAnswers(options, prompter) {
|
|
|
170
176
|
const providerDefault = options.provider?.trim() || DEFAULTS.providers.join(",");
|
|
171
177
|
const execDefault = !!options.exec;
|
|
172
178
|
const devcontainerDefault = !!options.devcontainer;
|
|
179
|
+
const lefthookDefault = !!options.lefthook;
|
|
173
180
|
const explicitDevcontainerPreset = parseDevcontainerPreset(options.devcontainerPreset);
|
|
174
181
|
const providerPrompt = `Orchestrator providers (${PROVIDERS.join(", ")}) [${providerDefault}]: `;
|
|
175
182
|
const projectId = await promptUntilValid(prompter, `Project ID [${projectDefault}]: `, (answer) => validateProjectId(answer.trim() || projectDefault));
|
|
@@ -186,8 +193,9 @@ export async function collectInitAnswers(options, prompter) {
|
|
|
186
193
|
const catalog = parseCatalog(options.catalog);
|
|
187
194
|
const devcontainer = await promptUntilValid(prompter, `Create a Dev Container? [${devcontainerDefault ? "Y/n" : "y/N"}]: `, (answer) => parseBoolean(answer, devcontainerDefault));
|
|
188
195
|
const devcontainerPreset = devcontainer && options.devcontainerPreset === undefined
|
|
189
|
-
? await promptUntilValid(prompter, "
|
|
196
|
+
? await promptUntilValid(prompter, "Dev Container preset (minimal, recommended, full) [recommended]: ", (answer) => parseDevcontainerPreset(answer.trim() || "recommended"))
|
|
190
197
|
: explicitDevcontainerPreset;
|
|
198
|
+
const lefthook = await promptUntilValid(prompter, `Create Git hooks with lefthook? [${lefthookDefault ? "Y/n" : "y/N"}]: `, (answer) => parseBoolean(answer, lefthookDefault));
|
|
191
199
|
return validateAnswers({
|
|
192
200
|
projectId,
|
|
193
201
|
projectName,
|
|
@@ -198,6 +206,7 @@ export async function collectInitAnswers(options, prompter) {
|
|
|
198
206
|
exec,
|
|
199
207
|
catalog,
|
|
200
208
|
devcontainer,
|
|
209
|
+
lefthook,
|
|
201
210
|
...(devcontainerPreset ? { devcontainerPreset } : {}),
|
|
202
211
|
});
|
|
203
212
|
}
|
|
@@ -510,9 +519,18 @@ export async function runInit(options, deps) {
|
|
|
510
519
|
preset: answers.devcontainerPreset,
|
|
511
520
|
providers: answers.providers,
|
|
512
521
|
editors: [],
|
|
513
|
-
ollama:
|
|
522
|
+
ollama: false,
|
|
514
523
|
cron: false,
|
|
515
|
-
tmux:
|
|
524
|
+
tmux: false,
|
|
525
|
+
force: false,
|
|
526
|
+
dryRun,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
if (answers.lefthook) {
|
|
530
|
+
await runLefthookScaffold({
|
|
531
|
+
packageRoot,
|
|
532
|
+
repoRoot,
|
|
533
|
+
config,
|
|
516
534
|
force: false,
|
|
517
535
|
dryRun,
|
|
518
536
|
});
|
|
@@ -551,7 +569,8 @@ export function registerInitCommand(program) {
|
|
|
551
569
|
.option("--exec", "Configure executor and reporter agents", false)
|
|
552
570
|
.option("--catalog <size>", "Create a deliverables catalog (small|medium|large)")
|
|
553
571
|
.option("--devcontainer", "Create a Dev Container for the selected providers", false)
|
|
554
|
-
.option("--
|
|
572
|
+
.option("--lefthook", "Create pre-commit hooks for SpecDojo repositories", false)
|
|
573
|
+
.option("--devcontainer-preset <name>", "Apply a Dev Container preset when creating it (minimal|recommended|full; none aliases minimal)")
|
|
555
574
|
.option("--workspace-name <name>", "Override the Dev Container workspace parent name used under /workspaces")
|
|
556
575
|
.option("--dry-run", "Show planned files and changes without writing", false)
|
|
557
576
|
.action(async (options) => {
|
|
@@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { constants as osConstants } from "node:os";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { agentExtraRootArguments, resolveProductRepos } from "../exec/task-repos.js";
|
|
5
|
-
import { loadConfig, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
5
|
+
import { loadConfig, resolveExternalProjects, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
6
6
|
import { registerNightOrchestratorCommand } from "./night-orchestrator.js";
|
|
7
7
|
const ORCHESTRATOR_EXECUTABLES = {
|
|
8
8
|
claude: "claude",
|
|
@@ -131,10 +131,17 @@ export function resolveOrchestratorLaunch(options) {
|
|
|
131
131
|
throw new Error(`No config found: ${configPath}`);
|
|
132
132
|
const projectId = resolveOrchestratorProjectId(config, options.project, env);
|
|
133
133
|
const repos = resolveProductRepos(configRootDir, config.projects[projectId]);
|
|
134
|
+
const externalProjects = resolveExternalProjects(configRootDir, config);
|
|
135
|
+
const repoRoots = [
|
|
136
|
+
...new Set([
|
|
137
|
+
...repos.map((repo) => repo.repoRoot),
|
|
138
|
+
...externalProjects.map((project) => project.repoRoot),
|
|
139
|
+
]),
|
|
140
|
+
];
|
|
134
141
|
const launch = buildOrchestratorLaunch({
|
|
135
142
|
provider: options.provider,
|
|
136
143
|
providerArgs: options.providerArgs,
|
|
137
|
-
repoRoots
|
|
144
|
+
repoRoots,
|
|
138
145
|
cwd: rootDir,
|
|
139
146
|
env,
|
|
140
147
|
});
|
|
@@ -1,130 +1,8 @@
|
|
|
1
|
-
import { existsSync
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
function isRecord(value) {
|
|
7
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
-
}
|
|
9
|
-
function readStringArray(value, field, errors) {
|
|
10
|
-
if (value === undefined)
|
|
11
|
-
return [];
|
|
12
|
-
if (!Array.isArray(value)) {
|
|
13
|
-
errors.push(`${field}: must be an array of strings`);
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const result = [];
|
|
17
|
-
for (const item of value) {
|
|
18
|
-
if (typeof item !== "string" || item.trim().length === 0) {
|
|
19
|
-
errors.push(`${field}: must contain non-empty strings only`);
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
result.push(item);
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
function parseTrack(raw, index, errors) {
|
|
27
|
-
const where = `tracks[${index}]`;
|
|
28
|
-
if (!isRecord(raw)) {
|
|
29
|
-
errors.push(`${where}: must be an object`);
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const track = raw.track;
|
|
33
|
-
if (typeof track !== "string" || track.trim().length === 0) {
|
|
34
|
-
errors.push(`${where}.track: required non-empty string`);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const domains = readStringArray(raw.domains, `${where}.domains`, errors);
|
|
38
|
-
if (domains.length === 0)
|
|
39
|
-
errors.push(`${where}.domains: required non-empty array`);
|
|
40
|
-
const catalogStatus = raw.catalog_status;
|
|
41
|
-
if (typeof catalogStatus !== "string" ||
|
|
42
|
-
!CATALOG_STATUSES.includes(catalogStatus)) {
|
|
43
|
-
errors.push(`${where}.catalog_status: must be one of ${CATALOG_STATUSES.join(" | ")}`);
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
const order = raw.order;
|
|
47
|
-
if (typeof order !== "number" || !Number.isInteger(order) || order < 1) {
|
|
48
|
-
errors.push(`${where}.order: must be an integer >= 1`);
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (raw.depends_on === undefined) {
|
|
52
|
-
errors.push(`${where}.depends_on: required (use [] when there is no prerequisite)`);
|
|
53
|
-
}
|
|
54
|
-
const dependsOn = readStringArray(raw.depends_on, `${where}.depends_on`, errors);
|
|
55
|
-
const estimate = raw.catalog_duration_estimate_days;
|
|
56
|
-
if (estimate !== undefined && (typeof estimate !== "number" || estimate <= 0)) {
|
|
57
|
-
errors.push(`${where}.catalog_duration_estimate_days: must be a number > 0`);
|
|
58
|
-
}
|
|
59
|
-
const parallelGroup = raw.parallel_group;
|
|
60
|
-
if (parallelGroup !== undefined && typeof parallelGroup !== "string") {
|
|
61
|
-
errors.push(`${where}.parallel_group: must be a string`);
|
|
62
|
-
}
|
|
63
|
-
const note = raw.note;
|
|
64
|
-
if (note !== undefined && typeof note !== "string") {
|
|
65
|
-
errors.push(`${where}.note: must be a string`);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
track,
|
|
69
|
-
domains,
|
|
70
|
-
catalog_status: catalogStatus,
|
|
71
|
-
...(typeof estimate === "number" ? { catalog_duration_estimate_days: estimate } : {}),
|
|
72
|
-
order,
|
|
73
|
-
...(typeof parallelGroup === "string" ? { parallel_group: parallelGroup } : {}),
|
|
74
|
-
depends_on: dependsOn,
|
|
75
|
-
...(typeof note === "string" ? { note } : {}),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export function loadTimelineIndex(filePath) {
|
|
79
|
-
const errors = [];
|
|
80
|
-
const parsed = readYaml(filePath);
|
|
81
|
-
if (!isRecord(parsed)) {
|
|
82
|
-
throw new Error(`${filePath}: invalid or empty YAML`);
|
|
83
|
-
}
|
|
84
|
-
const projectId = parsed.project_id;
|
|
85
|
-
if (typeof projectId !== "string" || projectId.trim().length === 0) {
|
|
86
|
-
errors.push(`project_id: required non-empty string`);
|
|
87
|
-
}
|
|
88
|
-
if (!Array.isArray(parsed.tracks) || parsed.tracks.length === 0) {
|
|
89
|
-
errors.push(`tracks: required non-empty array`);
|
|
90
|
-
return {
|
|
91
|
-
index: {
|
|
92
|
-
id: typeof parsed.id === "string" ? parsed.id : "",
|
|
93
|
-
project_id: typeof projectId === "string" ? projectId : "",
|
|
94
|
-
status: typeof parsed.status === "string" ? parsed.status : "",
|
|
95
|
-
tracks: [],
|
|
96
|
-
},
|
|
97
|
-
errors,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const tracks = [];
|
|
101
|
-
parsed.tracks.forEach((raw, index) => {
|
|
102
|
-
const track = parseTrack(raw, index, errors);
|
|
103
|
-
if (track)
|
|
104
|
-
tracks.push(track);
|
|
105
|
-
});
|
|
106
|
-
// 計画開始日は YYYY-MM-DD に正規化する。不正な値はエラーとして報告し、未設定とみなす。
|
|
107
|
-
let plannedStartDate;
|
|
108
|
-
if (parsed.planned_start_date !== undefined && parsed.planned_start_date !== null) {
|
|
109
|
-
const normalized = normalizeDateOnly(parsed.planned_start_date);
|
|
110
|
-
if (!normalized) {
|
|
111
|
-
errors.push("planned_start_date: must be a YYYY-MM-DD date");
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
plannedStartDate = normalized;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
index: {
|
|
119
|
-
id: typeof parsed.id === "string" ? parsed.id : "",
|
|
120
|
-
project_id: typeof projectId === "string" ? projectId : "",
|
|
121
|
-
status: typeof parsed.status === "string" ? parsed.status : "",
|
|
122
|
-
tracks,
|
|
123
|
-
...(plannedStartDate !== undefined ? { planned_start_date: plannedStartDate } : {}),
|
|
124
|
-
},
|
|
125
|
-
errors,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
3
|
+
import { collectCatalogFilesByDomain } from "../shared/catalog-files.js";
|
|
4
|
+
import { loadTimelineIndex, } from "../shared/timeline-index.js";
|
|
5
|
+
export { collectCatalogFilesByDomain, loadTimelineIndex };
|
|
128
6
|
// depends_on の未定義参照・循環・order との矛盾を検出する。
|
|
129
7
|
export function validateTimelineTracks(tracks) {
|
|
130
8
|
const errors = [];
|
|
@@ -193,31 +71,6 @@ export function buildTimelineWaves(tracks) {
|
|
|
193
71
|
tracks: [...group].sort((a, b) => a.track.localeCompare(b.track)),
|
|
194
72
|
}));
|
|
195
73
|
}
|
|
196
|
-
// 1 ドメインが dct-<domain>-<sub>.yaml のように複数ファイルへ分割されることがあるため、
|
|
197
|
-
// ファイル名ではなく各カタログの domain 値で突き合わせる。
|
|
198
|
-
export function collectCatalogFilesByDomain(catalogPath) {
|
|
199
|
-
const byDomain = new Map();
|
|
200
|
-
if (!existsSync(catalogPath))
|
|
201
|
-
return byDomain;
|
|
202
|
-
const files = readdirSync(catalogPath)
|
|
203
|
-
.filter((file) => /^dct-.+\.ya?ml$/.test(file))
|
|
204
|
-
.sort();
|
|
205
|
-
for (const file of files) {
|
|
206
|
-
const fullPath = join(catalogPath, file);
|
|
207
|
-
const parsed = readYaml(fullPath);
|
|
208
|
-
if (!isRecord(parsed))
|
|
209
|
-
continue;
|
|
210
|
-
const domain = parsed.domain;
|
|
211
|
-
if (typeof domain !== "string" || domain.trim().length === 0)
|
|
212
|
-
continue;
|
|
213
|
-
const group = byDomain.get(domain);
|
|
214
|
-
if (group)
|
|
215
|
-
group.push(fullPath);
|
|
216
|
-
else
|
|
217
|
-
byDomain.set(domain, [fullPath]);
|
|
218
|
-
}
|
|
219
|
-
return byDomain;
|
|
220
|
-
}
|
|
221
74
|
// catalog_status と実カタログの有無から catalog scaffold の対象を決める。
|
|
222
75
|
export function buildCatalogScaffoldPlans(tracks, catalogPath) {
|
|
223
76
|
const scaffolds = [];
|
|
@@ -5,7 +5,7 @@ export function registerDevcontainerCommands(program) {
|
|
|
5
5
|
const dc = program.command("devcontainer").description("Dev Container helpers");
|
|
6
6
|
dc.command("scaffold")
|
|
7
7
|
.description("Scaffold .devcontainer/ configuration for the repository")
|
|
8
|
-
.option("--preset <name>", "Apply a bundled preset (
|
|
8
|
+
.option("--preset <name>", "Apply a bundled preset (minimal|recommended|full)")
|
|
9
9
|
.option("--provider <names>", "Comma-separated list of agent providers to install (e.g. claude,codex,opencode,antigravity)", "")
|
|
10
10
|
.option("--editor <names>", "Comma-separated list of editors to install and configure (emacs,vim)", "")
|
|
11
11
|
.option("--ollama", "Add Ollama connection settings", false)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
export const DEVCONTAINER_PRESETS = ["minimal", "recommended", "full"];
|
|
4
5
|
const RECOMMENDED_VSCODE_EXTENSIONS = [
|
|
5
6
|
"mhutchie.git-graph",
|
|
6
7
|
"davidanson.vscode-markdownlint",
|
|
@@ -150,12 +151,15 @@ export function generateSshConfigSample(ports) {
|
|
|
150
151
|
}
|
|
151
152
|
export async function runDevcontainerScaffold(opts) {
|
|
152
153
|
const { packageRoot, repoRoot, workspaceName: workspaceNameOverride, preset, providers, editors, ollama, cron, tmux, force, dryRun, } = opts;
|
|
153
|
-
if (preset !== undefined && preset
|
|
154
|
-
throw new Error(`Unknown Dev Container preset: ${preset}. Available:
|
|
154
|
+
if (preset !== undefined && !DEVCONTAINER_PRESETS.includes(preset)) {
|
|
155
|
+
throw new Error(`Unknown Dev Container preset: ${preset}. Available: ${DEVCONTAINER_PRESETS.join(", ")}`);
|
|
155
156
|
}
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const
|
|
157
|
+
const includesRecommended = preset === "recommended" || preset === "full";
|
|
158
|
+
const full = preset === "full";
|
|
159
|
+
const effectiveEditors = unique([...editors, ...(includesRecommended ? ["emacs", "vim"] : [])]);
|
|
160
|
+
const effectiveTmux = tmux || includesRecommended;
|
|
161
|
+
const effectiveOllama = ollama || full;
|
|
162
|
+
const effectiveCron = cron || full;
|
|
159
163
|
const devcontainerDir = path.join(repoRoot, ".devcontainer");
|
|
160
164
|
const workspaceName = resolveWorkspaceName(repoRoot, workspaceNameOverride);
|
|
161
165
|
if (existsSync(devcontainerDir) && !force) {
|
|
@@ -188,10 +192,21 @@ export async function runDevcontainerScaffold(opts) {
|
|
|
188
192
|
const extraScripts = [];
|
|
189
193
|
let emacsInitTemplate;
|
|
190
194
|
let vimrcTemplate;
|
|
195
|
+
if (includesRecommended) {
|
|
196
|
+
aptPackages.push("gh");
|
|
197
|
+
devcontainer.mounts.push(`source=${volumeName("gh")},target=/home/node/.config/gh,type=volume`);
|
|
198
|
+
}
|
|
199
|
+
if (full) {
|
|
200
|
+
aptPackages.push("ripgrep", "fd-find", "fzf", "yq", "shellcheck", "shfmt");
|
|
201
|
+
extraScripts.push(`# Debian installs fd as fdfind. Expose the upstream command name as well.
|
|
202
|
+
if command -v fdfind >/dev/null 2>&1 && ! command -v fd >/dev/null 2>&1; then
|
|
203
|
+
sudo ln -s "$(command -v fdfind)" /usr/local/bin/fd
|
|
204
|
+
fi`);
|
|
205
|
+
}
|
|
191
206
|
if (effectiveTmux) {
|
|
192
207
|
aptPackages.push("tmux");
|
|
193
208
|
}
|
|
194
|
-
if (
|
|
209
|
+
if (effectiveCron) {
|
|
195
210
|
aptPackages.push("cron");
|
|
196
211
|
devcontainer.postAttachCommand = "sudo service cron start";
|
|
197
212
|
}
|
|
@@ -258,7 +273,7 @@ fi`);
|
|
|
258
273
|
}
|
|
259
274
|
let vscodeExtensions = [];
|
|
260
275
|
let extensionsFile;
|
|
261
|
-
if (
|
|
276
|
+
if (includesRecommended) {
|
|
262
277
|
vscodeExtensions = unique([...RECOMMENDED_VSCODE_EXTENSIONS, ...providerExtensions(providers)]);
|
|
263
278
|
const customizations = (devcontainer.customizations ??= {});
|
|
264
279
|
const vscode = (customizations.vscode ??= {});
|
|
@@ -292,11 +307,11 @@ fi`);
|
|
|
292
307
|
}
|
|
293
308
|
if (aptPackages.length > 0) {
|
|
294
309
|
devcontainer.features["ghcr.io/rocker-org/devcontainer-features/apt-packages:1"] = {
|
|
295
|
-
packages: aptPackages.join(","),
|
|
310
|
+
packages: unique(aptPackages).join(","),
|
|
296
311
|
upgradePackages: false,
|
|
297
312
|
};
|
|
298
313
|
}
|
|
299
|
-
if (
|
|
314
|
+
if (effectiveOllama) {
|
|
300
315
|
devcontainer.containerEnv["OLLAMA_BASE_URL"] = "http://host.docker.internal:11434";
|
|
301
316
|
devcontainer.containerEnv["LOCAL_OPENAI_BASE_URL"] = "http://host.docker.internal:11434/v1";
|
|
302
317
|
}
|
package/dist/exec/core.js
CHANGED
package/dist/exec/events.js
CHANGED
|
@@ -112,17 +112,28 @@ export function buildEvent(type, o) {
|
|
|
112
112
|
e.meta = meta;
|
|
113
113
|
return e;
|
|
114
114
|
}
|
|
115
|
-
export function writeEventFile(projectPath, event) {
|
|
115
|
+
export function writeEventFile(projectPath, event, dependencies = {}) {
|
|
116
116
|
const execDir = eventsDirForProject(projectPath);
|
|
117
117
|
ensureDir(execDir);
|
|
118
118
|
const tsPart = tsForFilenameUtc(event.ts);
|
|
119
119
|
const byPart = safeSlug(event.by);
|
|
120
120
|
const idPart = safeSlug(event.task_id);
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
const makeRandomHex = dependencies.randomHex ?? randomHex;
|
|
122
|
+
const base = `${tsPart}_${byPart}_${idPart}_${event.type}_${makeRandomHex(4)}`;
|
|
123
|
+
const contents = JSON.stringify(event, null, 2) + "\n";
|
|
124
|
+
for (let sequence = 0;; sequence += 1) {
|
|
125
|
+
const filename = `${base}${sequence === 0 ? "" : `-${sequence}`}.json`;
|
|
126
|
+
const fullpath = join(execDir, filename);
|
|
127
|
+
try {
|
|
128
|
+
// `wx` preserves the append-only event contract even if another writer wins the name.
|
|
129
|
+
writeFileSync(fullpath, contents, { encoding: "utf8", flag: "wx" });
|
|
130
|
+
return fullpath;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
if (error.code !== "EEXIST")
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
126
137
|
}
|
|
127
138
|
export function foldEventsToState(events, schedule, projectPath, initialTasks) {
|
|
128
139
|
const tasks = initialTasks ? { ...initialTasks } : {};
|