specdojo 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +2 -0
- package/CHANGELOG.md +60 -0
- package/dist/catalog/generate.js +144 -13
- package/dist/commands/init.js +1 -0
- package/dist/deliverable/deliverable.js +77 -4
- package/dist/exec/core.js +1 -0
- package/dist/exec/parent-validation.js +7 -0
- package/dist/exec/plans-core.js +46 -1
- package/dist/exec/plans-generation.js +39 -3
- package/dist/exec/plans-planning.js +1 -1
- package/dist/exec/plans-storage.js +1 -0
- package/dist/exec/product-branch-records.js +105 -0
- package/dist/exec/product-branches.js +52 -0
- package/dist/exec/register-product-message.js +50 -0
- package/dist/exec/register.js +6 -0
- package/dist/exec/repo-integration-sync.js +4 -2
- package/dist/exec/repo-integration.js +41 -4
- package/dist/exec/repo-trace.js +2 -0
- package/dist/exec/results.js +9 -5
- package/dist/exec/run/register-command.js +16 -0
- package/dist/exec/run/register-resume.js +11 -1
- package/dist/exec/run/register-worktree.js +29 -8
- package/dist/exec/run/schedule-prepare.js +7 -3
- package/dist/exec/strategy.js +2 -1
- package/dist/exec/task-repos.js +78 -16
- package/dist/exec/worktree-command.js +2 -2
- package/dist/exec/worktree.js +3 -3
- package/dist/register/core.js +5 -0
- package/dist/register/create-commands.js +54 -2
- package/dist/register/deliverable-target.js +24 -17
- package/dist/register/event-merge.js +4 -0
- package/dist/register/events.js +6 -0
- package/dist/register/external-project.js +2 -0
- package/dist/register/input.js +168 -0
- package/dist/register/item.js +61 -0
- package/dist/register/register.js +2 -2
- package/dist/register/renumber.js +4 -0
- package/dist/register/update.js +6 -0
- package/dist/schedule/approach.js +9 -0
- package/dist/schedule/strategy-profiles.js +22 -2
- package/dist/shared/agent-types.js +4 -1
- package/dist/shared/branch-template.js +26 -0
- package/dist/shared/commit-message-template.js +38 -0
- package/dist/shared/commit-types.js +15 -0
- package/dist/shared/specdojo-config.js +35 -4
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +93 -0
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +9 -2
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xer-human-bootstrap-finalize-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xer-human-draft-template.md +23 -0
- package/docs/ja/specdojo/exec-templates/xer-human-finalize-template.md +2 -0
- package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +7 -4
- package/docs/ja/specdojo/guides/exec-config-guide.md +3 -1
- package/docs/ja/specdojo/guides/exec-operation-guide.md +96 -2
- package/docs/ja/specdojo/guides/register-operation-guide.md +14 -1
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +1 -1
- package/docs/ja/specdojo/guides/ryu-guide.md +114 -23
- package/docs/ja/specdojo/guides/schedule-design-guide.md +31 -4
- package/docs/ja/specdojo/recipes/exec-human-finalize-recipe.md +1 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +20 -12
- package/docs/ja/specdojo/references/command-reference.md +44 -11
- package/docs/ja/specdojo/references/specdojo-config-reference.md +69 -8
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +8 -0
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +4 -0
- package/docs/ja/specdojo/rulebooks/sch-rulebook.md +3 -1
- package/docs/ja/specdojo/samples/dct-sample.yaml +5 -1
- package/docs/ja/specdojo/standards/document-metadata-standard.md +16 -0
- package/docs/ja/specdojo/standards/exec-human-finalize-standard.md +1 -0
- package/docs/ja/specdojo/standards/guide-authoring-standard.md +2 -1
- package/docs/ja/specdojo/standards/philosophy-authoring-standard.md +1 -0
- package/docs/ja/specdojo/standards/recipe-authoring-standard.md +2 -1
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +2 -1
- package/docs/ja/specdojo/standards/standard-authoring-standard.md +2 -1
- package/docs/ja/specdojo/templates/pjr-change-request-template.md +10 -4
- package/docs/ja/specdojo/templates/pjr-issue-template.md +10 -4
- package/docs/ja/specdojo/templates/pjr-question-template.md +11 -5
- package/docs/ja/specdojo/templates/pjr-risk-template.md +10 -4
- package/docs/ja/specdojo/templates/pjr-todo-template.md +10 -4
- package/docs/specdojo/schemas/v1/dct.schema.yaml +9 -0
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +2 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +1 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +35 -0
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +1 -0
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +40 -2
- package/package.json +3 -2
- package/templates/antigravity/orchestrator.md +2 -0
- package/templates/claude/agents/specdojo-orchestrator.md +2 -0
- package/templates/codex/agents/specdojo-orchestrator.toml +2 -0
- package/templates/codex/orchestrator.md +2 -0
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +14 -8
- package/templates/opencode/agents/specdojo-orchestrator.md +2 -0
|
@@ -106,6 +106,8 @@ type は次のように使い分ける。
|
|
|
106
106
|
|
|
107
107
|
起票では `--title` と `--description` を具体的に書く。`--description` は一覧へ出るため、後から見て内容が分かる文にする。`--topic` を省くとタイトルの英数字の部分から導出される。タイトルが日本語の場合は、内容を表す英語の `--topic`(小文字・ハイフン区切り。例: `payment-scope`)を渡す。
|
|
108
108
|
|
|
109
|
+
対話で得た前提・制約・調査や選定を任せる範囲は、起票時に `--input <text>` を繰り返して個票の `入力` へ記録する。完了条件とは分け、会話で確認できた事実と明示的な委任範囲だけを書く。更新時の `--input` は一覧置換なので、追記では既存分も含めて渡し、全削除は `--input -` とする。
|
|
110
|
+
|
|
109
111
|
```bash
|
|
110
112
|
npx specdojo register add --project <project-id> \
|
|
111
113
|
--type todo --title "<title>" --description "<description>" \
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
SpecDojo の利用者に影響する変更を記録します。
|
|
4
4
|
|
|
5
|
+
## [0.6.0] - 2026-10-31
|
|
6
|
+
|
|
7
|
+
同梱パッケージは `@specdojo/docs-lint` 0.4.0 を同時に公開します。docs-lint 0.4.0 は、成果物の文脈の目印 `_CONTEXT_:` の検出(`status: ready` の文書ではエラー、それ以外は情報。PJR-JRSY・PJR-D0GB)を含みます。`remark/md-content` を options なしで読み込むと失敗する問題の修正(PJR-5EN3)と、0.3.1(2026-10-29 公開)の rulebook 一覧のキャッシュ(PJR-SC8T)も含みます。`@specdojo/docs-site` は変更がないため 0.3.0 のままです。
|
|
8
|
+
|
|
9
|
+
### 利用者から見て動きが変わる点
|
|
10
|
+
|
|
11
|
+
この版に破壊的変更はありません。ただし、次の 2 点は既存の使い方で結果が変わります。
|
|
12
|
+
|
|
13
|
+
- schedule の strategy の `guided-pass`(草案作成)の approach が、`fully-guided` から `draft` に変わりました。既存の schedule を作り直すと、草案の段の plan が `draft` の雛形で作られます(PJR-3MY5・PJR-E45K)。
|
|
14
|
+
- `fully-guided` は、既存成果物の磨き込み専用になりました。参照するのは宣言された文書(rulebook・recipe・sample、`based_on`、個票の `入力`、カタログの `brief` など)だけで、template から本文を新しく作ることはしません。文脈から下書きを作る場合は `draft` を使います(PJR-3MY5)。
|
|
15
|
+
|
|
16
|
+
### 追加機能
|
|
17
|
+
|
|
18
|
+
- 本リポジトリの開発用に `node tools/lint-mermaid.mjs '<Markdown のパスまたは glob>'` を追加しました。docs-site と同じ Mermaid で、ブラウザを使わずに図の構文を検査し、エラーの文書・開始行・図の種類と未検査の件数を報告します。引数なしでは `docs/` 全体を検査します。本リポジトリでは `npm run lint:mermaid` として `npm run check` と commit 時の hook(変更した Markdown)に組み込みました(PJR-B5TY)。
|
|
19
|
+
|
|
20
|
+
- exec の親の検証に `lint-mermaid`(`npm run lint:mermaid`)を追加しました。`pipeline.parent_validations` に指定でき、利用するリポジトリに `lint:mermaid` script が必要です(PJR-B5TY)。
|
|
21
|
+
|
|
22
|
+
- プロダクトの作業ブランチ名を `repos[].branch_template` と `exec run --branch <repo>=<name>` で選べるようにしました。項目とブランチの対応を runner が記録し、再開・片付けに使います。別項目との名前の重なりは開始前に停止します。`integration_strategy: ff` は merge commit を作らず早送りだけで統合し、分岐した履歴では停止します。未設定時の名前と `merge`・`branch-only` の動作は従来どおりです(PJR-M1DH)。
|
|
23
|
+
|
|
24
|
+
- プロダクトリポジトリの `repos[].commit_subject_template` と `repos[].merge_message_template` で、register の exec が作る commit と merge commit の書式を選べるようにしました。8 種類の変数と空 scope の括弧除去に対応し、本文末尾の `Refs:` は常に付けます。未設定時の書式と SpecDojo の記帳は従来どおりです(PJR-Z7GX)。
|
|
25
|
+
|
|
26
|
+
- 個票に `commit_type` と `commit_scope` を追加し、`register add` / `update` に `--commit-type` と `--commit-scope` を追加しました。Conventional Commits の type・scope を個票ごとに指定でき、`update` では `-` で削除できます。未指定時は項目の type から既定の対応(`issue` は `fix`、`todo`・`change-request` は `feat` など)で解決し、`specdojo.config.json` の `projects.<project-id>.commit_types` や `repos[].commit_types` で対応を上書きできます(PJR-TC62)。
|
|
27
|
+
|
|
28
|
+
- `deliverable scaffold` に `--target <doc-id>` を追加しました。成果物を 1 つだけ指定して雛形を作成できます(`--dct` との併用は不可)。カタログにない成果物は `--target-path` と `--target-rulebook` を指定して作成できます。template のない rulebook でも最小構成の雛形を生成します(PJR-S23T)。
|
|
29
|
+
|
|
30
|
+
- 文脈を渡して成果物を作成する流れ(scaffold・文脈記入・`draft`・`fully-guided`・`finalize`)と、文脈の置き場所(成果物内の `_CONTEXT_:`、個票の `入力` / `--input`、カタログの `brief`)の使い分けを `exec-operation-guide` と `ryu-guide` にまとめました。あわせて `tsd-recipe` の「作成前に集める情報」に文脈の置き場所の対応を追加し、静的サイト向け TSD の技術選定を指示して作成する例を掲載しました(PJR-6A2B)。
|
|
31
|
+
|
|
32
|
+
- schedule に `draft` profile を追加しました。`strategy-planning` で `intent: draft-with-context` を宣言すると、雛形作成・文脈記入(human)→ draft → refine → review → finalize(human)を生成します。human は claim / complete で記録し、文脈記入用の result に雛形作成と `_CONTEXT_:` の案内を表示します(PJR-E45K)。
|
|
33
|
+
|
|
34
|
+
- `register add` / `update` に繰り返し指定できる `--input` を追加しました。対話で得た前提を個票の `入力` 節と event に記録し、register 経由の plan へ完了条件とは別に渡します。update は一覧置換、`--input -` は全削除です(PJR-6DD7)。
|
|
35
|
+
|
|
36
|
+
- 成果物内の文脈の目印 `_CONTEXT_:` を定めました。`draft` で反映した指示を result に記録し、`fully-guided` では未反映の指示を論点として残します。finalize の確認と文書 lint で残りを検出し、lint は `ready` で error、それ以外で warning とします(PJR-JRSY)。
|
|
37
|
+
- `draft` approach を追加しました。文脈で任された範囲を調べて下書きし、選定値を提案として示して出典と選定理由を記録します。register・schedule・plan で使えます(PJR-3MY5)。
|
|
38
|
+
|
|
39
|
+
- 成果物カタログ(dct)の成果物に `brief` を追加しました。成果物の外から継続して渡す前提(技術スタックや制約など)を記載でき、schedule の task の plan および register 経由の plan に「前提」として反映します。`brief` が無い場合は plan に載せません。複数成果物で共有する場合は YAML アンカーを利用できます(PJR-YKMA)。
|
|
40
|
+
|
|
41
|
+
### 変更
|
|
42
|
+
|
|
43
|
+
- `schedule-design-guide`・`xer-human-draft-template`・`plans-planning.ts` に残っていた雛形作成の案内を、成果物を 1 つだけ作成する `deliverable scaffold --project <project-id> --target <doc-id>` の形にそろえました。これに伴い、カタログ全体の未作成成果物も生成される旨の注意事項を案内から削除しました(PJR-73KT)。
|
|
44
|
+
|
|
45
|
+
- strategy の `guided-pass`(草案作成)の approach を `fully-guided` から `draft` に変更しました。型がそろった未作成成果物を、文脈の記入がなくても template から下書きできます。調査・選定の委任がない範囲は保留し、後続の refine で `fully-guided` による磨き込みを行います。既存 strategy へは再生成時に反映されます(PJR-E45K)。
|
|
46
|
+
|
|
47
|
+
- `@specdojo/docs-lint` の `_CONTEXT_:` の検出において、`status: ready` 以外の文書では warning ではなく情報(info)として報告するように変更しました。下書き時に `_CONTEXT_:` を残したまま実行しても `--frail` 付きの `npm run lint:fm` が失敗せず、親の検証を妨げません。`status: ready` の文書では従来どおり error として失敗させます(PJR-D0GB)。
|
|
48
|
+
|
|
49
|
+
- 配布するオーケストレーターの指示に、対話で得た前提・制約・委任範囲を `--input` で個票の `入力` へ記録し、完了条件と分ける扱いを書き足しました(PJR-6DD7)。
|
|
50
|
+
|
|
51
|
+
- `fully-guided` を既存成果物の磨き込み専用に整理しました。参照は宣言された文書だけとし、対象成果物の `based_on`、個票の `入力`、カタログの `brief` を参照範囲に加えました。`入力`・`brief` の差し込み口は、値が無ければ「なし」と表示します(PJR-3MY5)。
|
|
52
|
+
|
|
53
|
+
### 不具合修正
|
|
54
|
+
|
|
55
|
+
- `specdojo-tmux.sh.sample` の `find_container` で、ラベル `devcontainer.local_folder` が一致するコンテナが見つからない場合に `vsc-` で始まる別のコンテナへ誤って接続していた問題を修正しました。ラベルの一致するコンテナだけを検索対象とし、見つからない場合は `devcontainer up` を呼び出して起動するようにしました。あわせて `docker exec` の前にコンテナ内の作業ディレクトリの存在を確認し、存在しない場合は明示的なメッセージで停止するようにしました(PJR-P9ZC)。
|
|
56
|
+
|
|
57
|
+
- `decision`・`note`・`epic` など `入力` の章がない種類の個票へ `--input` を指定した際に、末尾に番号のない `## 入力` が追加されて章番号の連続性規約に違反していた問題を修正しました。最初の章の直後に `## 2. 入力` として挿入し、以降の章番号を 1 つずつ繰り下げます。既存の個票に番号のない `## 入力` がある場合も、同様に番号付きの章として適切な位置へ移動します(PJR-790T)。
|
|
58
|
+
|
|
59
|
+
- `deliverable scaffold` の一括生成と `--target` において、template のない rulebook の最小の雛形の `type` を rulebook の frontmatter で宣言された `deliverable_type` に合わせるように修正しました(未宣言時は従来どおり `project`)。これにより、template のない rulebook を指定して生成した雛形が docs-lint の `frontmatter-deliverable-type` で警告にならず、コミット時ガードを通過します(PJR-YKYK)。
|
|
60
|
+
|
|
61
|
+
- `@specdojo/docs-lint` の Markdown / YAML frontmatter 検証において、rulebook 一覧の生成をプロセス内でワークスペースごとに 1 回だけ行いキャッシュするように修正しました。remark のファイルごとのプラグイン読み込みで rulebook 一覧が毎回再生成されて `lint:fm` が著しく低速化していた問題を解消します。本修正は `@specdojo/docs-lint` 0.3.1 で公開済みです(PJR-SC8T)。
|
|
62
|
+
|
|
63
|
+
- `@specdojo/docs-lint` の `remark/md-content` を options なしで読み込んだ場合に `TypeError` で失敗する問題を修正しました。options が渡されないときは空の options として扱い、`schemas` は空、`workspaceRoot` は `process.cwd()` として動作します。これにより options なしでも `_CONTEXT_:` の検出が動作します(PJR-5EN3)。
|
|
64
|
+
|
|
5
65
|
## [0.5.0] - 2026-10-29
|
|
6
66
|
|
|
7
67
|
同梱パッケージは `@specdojo/docs-lint` 0.3.0 と `@specdojo/docs-site` 0.3.0 を同時に公開します。docs-lint 0.3.0 は、rulebook の `deliverable_type` と成果物の `type` の照合、YAML 成果物の旧 type のエラー化(下記の破壊的変更の PJR-484B・PJR-0D0T)を含みます。下記の移行手順の検査には docs-lint 0.3.0 が必要です。docs-site 0.3.0 は、生成物の `.vitepress/` への集約(PJR-9ZN5)と、Mermaid の構文エラーで生成を止めない変更(PJR-N9JC)を含みます。
|
package/dist/catalog/generate.js
CHANGED
|
@@ -3,12 +3,14 @@ import { dirname, join } from "node:path";
|
|
|
3
3
|
import { dump, load } from "../shared/yaml.js";
|
|
4
4
|
import { collectResolvedDeliverables } from "./build.js";
|
|
5
5
|
import { resolveBasePath } from "./paths.js";
|
|
6
|
-
import { buildSpecdojoFrontmatter, readSpecdojoNamespace } from "../docs/frontmatter-namespace.js";
|
|
6
|
+
import { buildSpecdojoFrontmatter, parseSpecdojoDocument, readSpecdojoNamespace, } from "../docs/frontmatter-namespace.js";
|
|
7
7
|
import { parsePracticeId, practiceLocalId } from "../shared/practice-id.js";
|
|
8
8
|
import { resolveKataDocumentPathIfExists } from "../kata/kata.js";
|
|
9
9
|
import { flattenTemplateFrontmatter } from "../docs/template-frontmatter.js";
|
|
10
10
|
import { isDctCatalogFileName } from "./types.js";
|
|
11
11
|
import { resolveSpecdojoPathIfExists, } from "../docs/template-resolution.js";
|
|
12
|
+
import { resolveDeliverableByDocId } from "./document-target.js";
|
|
13
|
+
import { validateDeliverableTargetPath } from "../register/deliverable-target.js";
|
|
12
14
|
const PROJECT_ID_PLACEHOLDER = "_PROJECT_ID_";
|
|
13
15
|
const LOCAL_ID_PLACEHOLDER = "_LOCAL_ID_";
|
|
14
16
|
const DELIVERABLE_NAME_PLACEHOLDER = "_DELIVERABLE_NAME_";
|
|
@@ -62,10 +64,8 @@ function normalizeDctName(name) {
|
|
|
62
64
|
.replace(/\.ya?ml$/i, "")
|
|
63
65
|
.replace(/^dct-/, "");
|
|
64
66
|
}
|
|
65
|
-
// Resolve
|
|
66
|
-
|
|
67
|
-
// every deliverable in one rulebook lineage share a single template.
|
|
68
|
-
function findTemplate(templatesPath, rulebooksPath, repoRoot, rulebookId, ext, resourceRoots) {
|
|
67
|
+
// Resolve the path to a rulebook file. The declaration is the SSOT.
|
|
68
|
+
function resolveRulebookPath(rulebooksPath, repoRoot, rulebookId, resourceRoots) {
|
|
69
69
|
if (!rulebookId ||
|
|
70
70
|
rulebookId === "none" ||
|
|
71
71
|
rulebookId === "not-needed" ||
|
|
@@ -83,11 +83,41 @@ function findTemplate(templatesPath, rulebooksPath, repoRoot, rulebookId, ext, r
|
|
|
83
83
|
: resourceRoots
|
|
84
84
|
? resolveSpecdojoPathIfExists(`docs/ja/specdojo/rulebooks/${rulebookFileName}`, resourceRoots)
|
|
85
85
|
: join(rulebooksPath, rulebookFileName);
|
|
86
|
+
if (!rulebookPath || !existsSync(rulebookPath))
|
|
87
|
+
return null;
|
|
88
|
+
return rulebookPath;
|
|
89
|
+
}
|
|
90
|
+
// Resolve a rulebook's declared deliverable_type from its frontmatter.
|
|
91
|
+
// Falls back to "project" if the rulebook is absent, unreadable, or omits deliverable_type.
|
|
92
|
+
function resolveDeliverableType(rulebooksPath, repoRoot, rulebookId, resourceRoots) {
|
|
93
|
+
const rulebookPath = resolveRulebookPath(rulebooksPath, repoRoot, rulebookId, resourceRoots);
|
|
94
|
+
if (!rulebookPath)
|
|
95
|
+
return "project";
|
|
96
|
+
try {
|
|
97
|
+
const meta = readSpecdojoNamespace(readFileSync(rulebookPath, "utf8"));
|
|
98
|
+
if (typeof meta.deliverable_type === "string" && meta.deliverable_type.trim().length > 0) {
|
|
99
|
+
return meta.deliverable_type.trim();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return "project";
|
|
104
|
+
}
|
|
105
|
+
return "project";
|
|
106
|
+
}
|
|
107
|
+
// Resolve a deliverable template from the rulebook frontmatter declaration. The declaration is
|
|
108
|
+
// the SSOT, so local_id naming conventions are deliberately not used as a fallback. This lets
|
|
109
|
+
// every deliverable in one rulebook lineage share a single template.
|
|
110
|
+
function findTemplate(templatesPath, rulebooksPath, repoRoot, rulebookId, ext, resourceRoots) {
|
|
111
|
+
const rulebookPath = resolveRulebookPath(rulebooksPath, repoRoot, rulebookId, resourceRoots);
|
|
86
112
|
if (!rulebookPath)
|
|
87
113
|
return null;
|
|
88
|
-
|
|
114
|
+
let templateId;
|
|
115
|
+
try {
|
|
116
|
+
templateId = readSpecdojoNamespace(readFileSync(rulebookPath, "utf8")).template;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
89
119
|
return null;
|
|
90
|
-
|
|
120
|
+
}
|
|
91
121
|
if (typeof templateId !== "string" ||
|
|
92
122
|
templateId === "none" ||
|
|
93
123
|
templateId === "not-needed" ||
|
|
@@ -112,10 +142,10 @@ function findTemplate(templatesPath, rulebooksPath, repoRoot, rulebookId, ext, r
|
|
|
112
142
|
// Minimal Markdown scaffold built from catalog metadata when no template exists.
|
|
113
143
|
// Fills the generated Frontmatter, an H1 from `name`, the catalog `overview`, and a
|
|
114
144
|
// single `_TODO_` line so the author knows the body is unwritten.
|
|
115
|
-
function fallbackMarkdown(item, projectId) {
|
|
145
|
+
function fallbackMarkdown(item, projectId, deliverableType = "project") {
|
|
116
146
|
const inner = {
|
|
117
147
|
id: `${projectId}:${item.local_id}`,
|
|
118
|
-
type:
|
|
148
|
+
type: deliverableType,
|
|
119
149
|
status: "draft",
|
|
120
150
|
};
|
|
121
151
|
if (item.rulebook && item.rulebook !== "undecided") {
|
|
@@ -129,10 +159,10 @@ function fallbackMarkdown(item, projectId) {
|
|
|
129
159
|
return `${frontmatter}\n\n# ${item.name}\n\n${item.overview}\n\n_TODO_: 本文を記述する\n`;
|
|
130
160
|
}
|
|
131
161
|
// Minimal YAML scaffold built from catalog metadata when no template exists.
|
|
132
|
-
function fallbackYaml(item, projectId) {
|
|
162
|
+
function fallbackYaml(item, projectId, deliverableType = "project") {
|
|
133
163
|
const doc = {
|
|
134
164
|
id: `${projectId}:${item.local_id}`,
|
|
135
|
-
type:
|
|
165
|
+
type: deliverableType,
|
|
136
166
|
status: "draft",
|
|
137
167
|
};
|
|
138
168
|
if (item.rulebook && item.rulebook !== "undecided") {
|
|
@@ -156,14 +186,19 @@ function expandYamlTemplate(templatePath, item, projectId) {
|
|
|
156
186
|
function generateContent(item, resolvedPath, projectId, templatesPath, rulebooksPath, repoRoot, resourceRoots) {
|
|
157
187
|
if (isYamlPath(resolvedPath)) {
|
|
158
188
|
const template = findTemplate(templatesPath, rulebooksPath, repoRoot, item.rulebook, ".yaml", resourceRoots);
|
|
159
|
-
|
|
189
|
+
if (template) {
|
|
190
|
+
return expandYamlTemplate(template, item, projectId);
|
|
191
|
+
}
|
|
192
|
+
const deliverableType = resolveDeliverableType(rulebooksPath, repoRoot, item.rulebook, resourceRoots);
|
|
193
|
+
return fallbackYaml(item, projectId, deliverableType);
|
|
160
194
|
}
|
|
161
195
|
const template = findTemplate(templatesPath, rulebooksPath, repoRoot, item.rulebook, ".md", resourceRoots);
|
|
162
196
|
if (template) {
|
|
163
197
|
const raw = readFileSync(template, "utf8");
|
|
164
198
|
return replaceGeneratedPlaceholders(flattenTemplateFrontmatter(raw), item, projectId);
|
|
165
199
|
}
|
|
166
|
-
|
|
200
|
+
const deliverableType = resolveDeliverableType(rulebooksPath, repoRoot, item.rulebook, resourceRoots);
|
|
201
|
+
return fallbackMarkdown(item, projectId, deliverableType);
|
|
167
202
|
}
|
|
168
203
|
// Materialize the deliverable files a project's catalog points to. Only `kind: work`
|
|
169
204
|
// items are generated; `control` deliverables have dedicated scaffolds (e.g. register
|
|
@@ -236,3 +271,99 @@ export function runGenerate(opts) {
|
|
|
236
271
|
}
|
|
237
272
|
return { written, skipped, errors };
|
|
238
273
|
}
|
|
274
|
+
function ensureFrontmatterProperties(content, isYaml, expected) {
|
|
275
|
+
if (isYaml) {
|
|
276
|
+
const loaded = load(content);
|
|
277
|
+
const doc = loaded && typeof loaded === "object" && !Array.isArray(loaded) ? loaded : {};
|
|
278
|
+
doc.id = expected.id;
|
|
279
|
+
doc.status = expected.status;
|
|
280
|
+
if (expected.rulebook && expected.rulebook !== "undecided") {
|
|
281
|
+
doc.rulebook = expected.rulebook === "not-needed" ? "none" : expected.rulebook;
|
|
282
|
+
}
|
|
283
|
+
return dump(doc, { lineWidth: 120, noRefs: true });
|
|
284
|
+
}
|
|
285
|
+
const { data, body } = parseSpecdojoDocument(content);
|
|
286
|
+
data.id = expected.id;
|
|
287
|
+
data.status = expected.status;
|
|
288
|
+
if (expected.rulebook && expected.rulebook !== "undecided") {
|
|
289
|
+
data.rulebook = expected.rulebook === "not-needed" ? "none" : expected.rulebook;
|
|
290
|
+
}
|
|
291
|
+
const innerLines = dump(data, { lineWidth: 120, noRefs: true }).replace(/\n+$/, "").split("\n");
|
|
292
|
+
const fm = buildSpecdojoFrontmatter(innerLines);
|
|
293
|
+
return `${fm}\n\n${body.replace(/^\n+/, "")}`;
|
|
294
|
+
}
|
|
295
|
+
export function runGenerateTarget(opts) {
|
|
296
|
+
const { catalogPath, templatesPath, rulebooksPath, repoRoot, projectId, targetId, targetPath, targetRulebook, force, dryRun = false, resourceRoots, } = opts;
|
|
297
|
+
const written = [];
|
|
298
|
+
const skipped = [];
|
|
299
|
+
const errors = [];
|
|
300
|
+
const localId = targetId.includes(":") ? targetId.slice(targetId.indexOf(":") + 1) : targetId;
|
|
301
|
+
const canonicalDocId = targetId.includes(":") ? targetId : `${projectId}:${targetId}`;
|
|
302
|
+
let item;
|
|
303
|
+
let resolvedPath;
|
|
304
|
+
if (catalogPath && existsSync(catalogPath)) {
|
|
305
|
+
try {
|
|
306
|
+
const resolved = resolveDeliverableByDocId(catalogPath, projectId, targetId, repoRoot);
|
|
307
|
+
item = resolved.info.deliverable;
|
|
308
|
+
resolvedPath = resolved.info.resolvedPath;
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
if (!(error instanceof Error) ||
|
|
312
|
+
!error.message.startsWith("catalog deliverable target not found")) {
|
|
313
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
314
|
+
return { written, skipped, errors };
|
|
315
|
+
}
|
|
316
|
+
if (!targetPath || !targetRulebook) {
|
|
317
|
+
errors.push(error.message);
|
|
318
|
+
return { written, skipped, errors };
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if (!item || !resolvedPath) {
|
|
323
|
+
if (!targetPath || !targetRulebook) {
|
|
324
|
+
errors.push(`Catalog-less deliverable ${targetId} requires both --target-path and --target-rulebook`);
|
|
325
|
+
return { written, skipped, errors };
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
resolvedPath = validateDeliverableTargetPath(repoRoot, canonicalDocId, targetPath);
|
|
329
|
+
}
|
|
330
|
+
catch (err) {
|
|
331
|
+
errors.push(err instanceof Error ? err.message : String(err));
|
|
332
|
+
return { written, skipped, errors };
|
|
333
|
+
}
|
|
334
|
+
item = {
|
|
335
|
+
local_id: localId,
|
|
336
|
+
name: localId,
|
|
337
|
+
kind: "work",
|
|
338
|
+
overview: "",
|
|
339
|
+
path: resolvedPath,
|
|
340
|
+
rulebook: targetRulebook,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
if (item.kind !== "work") {
|
|
344
|
+
errors.push(`Deliverable ${targetId} is kind '${item.kind}', only 'work' deliverables can be scaffolded`);
|
|
345
|
+
return { written, skipped, errors };
|
|
346
|
+
}
|
|
347
|
+
const outputPath = join(repoRoot, resolvedPath);
|
|
348
|
+
if (existsSync(outputPath) && !force) {
|
|
349
|
+
skipped.push(resolvedPath);
|
|
350
|
+
return { written, skipped, errors };
|
|
351
|
+
}
|
|
352
|
+
try {
|
|
353
|
+
let content = generateContent(item, resolvedPath, projectId, templatesPath, rulebooksPath, repoRoot, resourceRoots);
|
|
354
|
+
content = ensureFrontmatterProperties(content, isYamlPath(resolvedPath), {
|
|
355
|
+
id: canonicalDocId,
|
|
356
|
+
status: "draft",
|
|
357
|
+
rulebook: item.rulebook,
|
|
358
|
+
});
|
|
359
|
+
if (!dryRun) {
|
|
360
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
361
|
+
writeFileSync(outputPath, content, "utf8");
|
|
362
|
+
}
|
|
363
|
+
written.push(resolvedPath);
|
|
364
|
+
}
|
|
365
|
+
catch (err) {
|
|
366
|
+
errors.push(`${resolvedPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
367
|
+
}
|
|
368
|
+
return { written, skipped, errors };
|
|
369
|
+
}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { addProjectOption, printCommandError, resolveCatalogPath } from "../catalog/catalog.js";
|
|
3
|
-
import { runGenerate } from "../catalog/generate.js";
|
|
4
|
-
import {
|
|
3
|
+
import { runGenerate, runGenerateTarget } from "../catalog/generate.js";
|
|
4
|
+
import { deriveProjectId } from "../catalog/scaffold.js";
|
|
5
|
+
import { loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
|
|
5
6
|
import { resolveSpecdojoPath } from "../docs/template-resolution.js";
|
|
6
7
|
import { applyTrash, planTrash } from "./trash.js";
|
|
8
|
+
function resolveTargetProjectId(opts, catalogPath, targetId) {
|
|
9
|
+
if (opts.projectId?.trim())
|
|
10
|
+
return opts.projectId.trim();
|
|
11
|
+
if (opts.project?.trim())
|
|
12
|
+
return opts.project.trim();
|
|
13
|
+
if (process.env.SPECDOJO_PROJECT?.trim())
|
|
14
|
+
return process.env.SPECDOJO_PROJECT.trim();
|
|
15
|
+
if (catalogPath) {
|
|
16
|
+
const derived = deriveProjectId(catalogPath);
|
|
17
|
+
if (derived)
|
|
18
|
+
return derived;
|
|
19
|
+
}
|
|
20
|
+
const config = loadConfig().config;
|
|
21
|
+
if (config && Object.keys(config.projects).length > 0) {
|
|
22
|
+
return Object.keys(config.projects)[0];
|
|
23
|
+
}
|
|
24
|
+
if (targetId.includes(":")) {
|
|
25
|
+
return targetId.slice(0, targetId.indexOf(":"));
|
|
26
|
+
}
|
|
27
|
+
throw new Error("No project specified. Use --project <id> or --project-id <id>.");
|
|
28
|
+
}
|
|
7
29
|
function collectCommaSeparated(value, previous) {
|
|
8
30
|
return [
|
|
9
31
|
...previous,
|
|
@@ -23,11 +45,24 @@ export function registerDeliverableCommands(program) {
|
|
|
23
45
|
addProjectOption(scaffold);
|
|
24
46
|
scaffold.option("--project-id <projectId>", "Project ID to embed (e.g. prj-0001); derived from each dct-*.yaml if omitted");
|
|
25
47
|
scaffold.option("--dct <name>", "Limit to specific dct-*.yaml (repeatable / comma-separated; with or without 'dct-' prefix and '.yaml')", collectCommaSeparated, []);
|
|
48
|
+
scaffold.option("--target <targetId>", "Scaffold only a single deliverable by document id");
|
|
49
|
+
scaffold.option("--target-path <targetPath>", "Repository-relative file path for catalog-less deliverable");
|
|
50
|
+
scaffold.option("--target-rulebook <targetRulebook>", "Rulebook document id for catalog-less deliverable");
|
|
26
51
|
scaffold.option("--force", "Overwrite existing files", false);
|
|
27
52
|
scaffold.option("--dry-run", "Print planned files without writing", false);
|
|
28
53
|
scaffold.action((opts) => {
|
|
29
54
|
try {
|
|
30
|
-
const
|
|
55
|
+
const dctList = opts.dct ?? [];
|
|
56
|
+
const hasDct = dctList.length > 0;
|
|
57
|
+
const target = typeof opts.target === "string" ? opts.target.trim() : "";
|
|
58
|
+
const targetPath = typeof opts.targetPath === "string" ? opts.targetPath.trim() : undefined;
|
|
59
|
+
const targetRulebook = typeof opts.targetRulebook === "string" ? opts.targetRulebook.trim() : undefined;
|
|
60
|
+
if (target && hasDct) {
|
|
61
|
+
throw new Error("Cannot specify both --target and --dct");
|
|
62
|
+
}
|
|
63
|
+
if (!target && (targetPath || targetRulebook)) {
|
|
64
|
+
throw new Error("--target-path and --target-rulebook require --target");
|
|
65
|
+
}
|
|
31
66
|
const templatesPath = resolveSpecdojoPath("docs/ja/specdojo/templates");
|
|
32
67
|
const rulebooksPath = resolveSpecdojoPath("docs/ja/specdojo/rulebooks");
|
|
33
68
|
if (!existsSync(templatesPath)) {
|
|
@@ -36,6 +71,44 @@ export function registerDeliverableCommands(program) {
|
|
|
36
71
|
if (!existsSync(rulebooksPath)) {
|
|
37
72
|
throw new Error(`Rulebooks directory not found: ${rulebooksPath}`);
|
|
38
73
|
}
|
|
74
|
+
if (target) {
|
|
75
|
+
const repoRoot = specdojoRootDir();
|
|
76
|
+
let catalogPath;
|
|
77
|
+
try {
|
|
78
|
+
catalogPath = resolveCatalogPath(opts);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
if (!targetPath || !targetRulebook) {
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const projectId = resolveTargetProjectId(opts, catalogPath, target);
|
|
86
|
+
const { written, skipped, errors } = runGenerateTarget({
|
|
87
|
+
catalogPath,
|
|
88
|
+
templatesPath,
|
|
89
|
+
rulebooksPath,
|
|
90
|
+
repoRoot,
|
|
91
|
+
projectId,
|
|
92
|
+
targetId: target,
|
|
93
|
+
targetPath,
|
|
94
|
+
targetRulebook,
|
|
95
|
+
force: !!opts.force,
|
|
96
|
+
dryRun: !!opts.dryRun,
|
|
97
|
+
resourceRoots: { repositoryRoot: repoRoot },
|
|
98
|
+
});
|
|
99
|
+
const createdLabel = opts.dryRun ? "Would create" : "Created";
|
|
100
|
+
for (const error of errors)
|
|
101
|
+
process.stdout.write(`ERROR: ${error}\n`);
|
|
102
|
+
for (const path of written)
|
|
103
|
+
process.stdout.write(`${createdLabel}: ${path}\n`);
|
|
104
|
+
for (const path of skipped) {
|
|
105
|
+
process.stdout.write(`Skipped (already exists; use --force to overwrite): ${path}\n`);
|
|
106
|
+
}
|
|
107
|
+
if (errors.length > 0)
|
|
108
|
+
process.exitCode = 1;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const catalogPath = resolveCatalogPath(opts);
|
|
39
112
|
const { written, skipped, errors } = runGenerate({
|
|
40
113
|
catalogPath,
|
|
41
114
|
templatesPath,
|
|
@@ -44,7 +117,7 @@ export function registerDeliverableCommands(program) {
|
|
|
44
117
|
projectId: opts.projectId ?? null,
|
|
45
118
|
force: !!opts.force,
|
|
46
119
|
dryRun: !!opts.dryRun,
|
|
47
|
-
dctNames:
|
|
120
|
+
dctNames: dctList,
|
|
48
121
|
resourceRoots: { repositoryRoot: specdojoRootDir() },
|
|
49
122
|
});
|
|
50
123
|
const createdLabel = opts.dryRun ? "Would create" : "Created";
|
package/dist/exec/core.js
CHANGED
|
@@ -12,6 +12,7 @@ import { buildPhaseModeIndex, resolveApproach, resolveTaskExecution, resolveTask
|
|
|
12
12
|
export const KNOWN_OWNER_LABELS = ["PO", "PM", "BA", "ARC", "DEV", "QE", "UX", "OPS"];
|
|
13
13
|
export const KNOWN_OWNER_LABELS_TEXT = KNOWN_OWNER_LABELS.join("|");
|
|
14
14
|
const KNOWN_APPROACHES = [
|
|
15
|
+
"draft",
|
|
15
16
|
"fully-guided",
|
|
16
17
|
"recipe-guided",
|
|
17
18
|
"freeform",
|
|
@@ -57,6 +57,13 @@ const PARENT_VALIDATION_REGISTRY = {
|
|
|
57
57
|
displayCommand: "npm run lint:md",
|
|
58
58
|
timeoutMs: 10 * 60 * 1_000,
|
|
59
59
|
},
|
|
60
|
+
"lint-mermaid": {
|
|
61
|
+
id: "lint-mermaid",
|
|
62
|
+
command: process.platform === "win32" ? "npm.cmd" : "npm",
|
|
63
|
+
args: ["run", "lint:mermaid"],
|
|
64
|
+
displayCommand: "npm run lint:mermaid",
|
|
65
|
+
timeoutMs: 10 * 60 * 1_000,
|
|
66
|
+
},
|
|
60
67
|
build: {
|
|
61
68
|
id: "build",
|
|
62
69
|
command: process.platform === "win32" ? "npm.cmd" : "npm",
|
package/dist/exec/plans-core.js
CHANGED
|
@@ -7,7 +7,7 @@ import { specdojoRootDir } from "../shared/specdojo-config.js";
|
|
|
7
7
|
import { kataDirsForKinds, resolveIncludedRulebooks, resolveKataRefs } from "../kata/kata.js";
|
|
8
8
|
import { resolveBasePath, resolveDeliverablePath } from "../catalog/paths.js";
|
|
9
9
|
import { isDctPlanFileName } from "../catalog/plan.js";
|
|
10
|
-
import { buildSpecdojoFrontmatter } from "../docs/frontmatter-namespace.js";
|
|
10
|
+
import { readSpecdojoNamespace, buildSpecdojoFrontmatter } from "../docs/frontmatter-namespace.js";
|
|
11
11
|
import { qualifyPracticeId, SPECDOJO_PRACTICE_AUTHORITY } from "../shared/practice-id.js";
|
|
12
12
|
import { MISSING } from "../shared/plan-templates.js";
|
|
13
13
|
export { MISSING, execTemplatePath, execTemplatesDir, injectCommonConventions, loadPlanTemplate, } from "../shared/plan-templates.js";
|
|
@@ -315,6 +315,33 @@ export function deliverableDependsOn(deliverable, projectId, catalogPath) {
|
|
|
315
315
|
});
|
|
316
316
|
return `\n${lines.join("\n")}`;
|
|
317
317
|
}
|
|
318
|
+
// based_on is declared evidence, not a new dependency edge. Keep the document's IDs verbatim.
|
|
319
|
+
export function deliverableBasedOn(deliverable) {
|
|
320
|
+
if (!deliverable)
|
|
321
|
+
return "なし";
|
|
322
|
+
const path = resolve(specdojoRootDir(), deliverable.resolvedPath);
|
|
323
|
+
if (!/\.(md|mdx|yaml|yml|json)$/.test(path) || !existsSync(path))
|
|
324
|
+
return "なし";
|
|
325
|
+
let metadata;
|
|
326
|
+
try {
|
|
327
|
+
const content = readFileSync(path, "utf8");
|
|
328
|
+
const parsed = /\.mdx?$/.test(path)
|
|
329
|
+
? readSpecdojoNamespace(content)
|
|
330
|
+
: load(content);
|
|
331
|
+
metadata = (parsed?.specdojo ?? parsed);
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
// Invalid metadata is reported by document validation; it must not prevent plan generation.
|
|
335
|
+
return "なし";
|
|
336
|
+
}
|
|
337
|
+
const refs = metadata?.based_on;
|
|
338
|
+
if (!Array.isArray(refs))
|
|
339
|
+
return "なし";
|
|
340
|
+
const ids = [
|
|
341
|
+
...new Set(refs.filter((ref) => typeof ref === "string" && !!ref.trim())),
|
|
342
|
+
];
|
|
343
|
+
return ids.length ? ids.map((ref) => `[[${ref}]]`).join("、") : "なし";
|
|
344
|
+
}
|
|
318
345
|
const PROJECT_CONTEXT_EXCLUDED_APPROACHES = new Set([
|
|
319
346
|
"cross-deliverable-dedup",
|
|
320
347
|
"rulebook-authoring",
|
|
@@ -357,6 +384,24 @@ export function projectContextSection(refs, deliverable, approach, projectId) {
|
|
|
357
384
|
export function deliverableOverview(deliverable) {
|
|
358
385
|
return deliverable?.deliverable.overview ?? MISSING;
|
|
359
386
|
}
|
|
387
|
+
export function deliverableBrief(deliverable) {
|
|
388
|
+
const brief = deliverable?.deliverable.brief?.trim();
|
|
389
|
+
if (!brief)
|
|
390
|
+
return "";
|
|
391
|
+
if (!brief.includes("\n")) {
|
|
392
|
+
return brief;
|
|
393
|
+
}
|
|
394
|
+
if (brief.startsWith("-")) {
|
|
395
|
+
return `\n ${brief
|
|
396
|
+
.split("\n")
|
|
397
|
+
.map((line) => line.trimEnd())
|
|
398
|
+
.join("\n ")}`;
|
|
399
|
+
}
|
|
400
|
+
return brief
|
|
401
|
+
.split("\n")
|
|
402
|
+
.map((line, idx) => (idx === 0 ? line : ` ${line}`))
|
|
403
|
+
.join("\n");
|
|
404
|
+
}
|
|
360
405
|
export function implementationEvidence(deliverable) {
|
|
361
406
|
const refs = deliverable?.deliverable.evidence_refs ?? [];
|
|
362
407
|
if (refs.length === 0)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerInputSection } from "../register/input.js";
|
|
1
2
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import { DEFAULT_PROJECT_CONTEXT } from "../shared/specdojo-config.js";
|
|
@@ -6,7 +7,7 @@ import { formatMarkdownFile } from "./format.js";
|
|
|
6
7
|
import { expandTemplate } from "./shared.js";
|
|
7
8
|
import { isAuthoringApproach } from "../kata/authoring.js";
|
|
8
9
|
import { isPlanningApproach } from "../register/planning.js";
|
|
9
|
-
import { MISSING, applicableReviewCriteria, crossDeliverableTargetDetails, deliverableDependsOn, deliverableName, deliverableOverview, deliverablePath, doneCriteriaChecklist, doneCriteriaGoals, doneCriteriaItems, execDocId, findDeliverableInfo, frontmatter, gradeFindingsText, gradeFindingTargetPath, gradeResultRef, gradeTargetKind, implementationEvidence, injectCommonConventions, kataRefState, loadPlanTemplate, loadRoles, loadViewpoints, ownerRoleFields, phaseDescriptionText, projectContextSection, repoRelativePath, reviewDoneCriteriaRows, reviewGradeSummaryText, rulebookIncludesText, targetDocIds, targetDocIdsForTask, } from "./plans-core.js";
|
|
10
|
+
import { MISSING, applicableReviewCriteria, crossDeliverableTargetDetails, deliverableDependsOn, deliverableBasedOn, deliverableBrief, deliverableName, deliverableOverview, deliverablePath, doneCriteriaChecklist, doneCriteriaGoals, doneCriteriaItems, execDocId, findDeliverableInfo, frontmatter, gradeFindingsText, gradeFindingTargetPath, gradeResultRef, gradeTargetKind, implementationEvidence, injectCommonConventions, kataRefState, loadPlanTemplate, loadRoles, loadViewpoints, ownerRoleFields, phaseDescriptionText, projectContextSection, repoRelativePath, reviewDoneCriteriaRows, reviewGradeSummaryText, rulebookIncludesText, targetDocIds, targetDocIdsForTask, } from "./plans-core.js";
|
|
10
11
|
function buildEditPlanMarkdown(template, task, deliverable, roleMap, vpMap, projectId, catalogPath, projectContext, resultRef, stem, crossDeliverables = new Map(), planOverrides) {
|
|
11
12
|
const cpm = task.cpm;
|
|
12
13
|
const onCriticalPath = cpm !== undefined && cpm.slack === 0;
|
|
@@ -38,6 +39,11 @@ function buildEditPlanMarkdown(template, task, deliverable, roleMap, vpMap, proj
|
|
|
38
39
|
_PHASE_DESCRIPTION_: phaseDescriptionText(task),
|
|
39
40
|
_DELIVERABLE_NAME_: deliverableName(deliverable),
|
|
40
41
|
_DELIVERABLE_DEPENDS_ON_: deliverableDependsOn(deliverable, projectId, catalogPath),
|
|
42
|
+
_DELIVERABLE_BASED_ON_: deliverableBasedOn(deliverable),
|
|
43
|
+
_REGISTER_INPUT_: registerInputSection(planOverrides?.registerInput)
|
|
44
|
+
? "下記「個票の入力(前提)」を参照。"
|
|
45
|
+
: "なし",
|
|
46
|
+
_DELIVERABLE_BRIEF_: deliverableBrief(deliverable),
|
|
41
47
|
_PROJECT_CONTEXT_: projectContextSection(projectContext, deliverable, task.approach, projectId),
|
|
42
48
|
_DELIVERABLE_OVERVIEW_: deliverableOverview(deliverable),
|
|
43
49
|
_IMPLEMENTATION_EVIDENCE_: deliverable?.catalogless
|
|
@@ -79,10 +85,29 @@ function buildEditPlanMarkdown(template, task, deliverable, roleMap, vpMap, proj
|
|
|
79
85
|
.filter((line) => !["recipe", "sample", "template"].some((kind) => refs[kind] === MISSING && line.includes(`_${kind.toUpperCase()}_REF_`)))
|
|
80
86
|
.join("\n")
|
|
81
87
|
: template;
|
|
82
|
-
|
|
88
|
+
const hasBrief = Boolean(deliverable?.deliverable.brief?.trim());
|
|
89
|
+
const templateWithoutBrief = hasBrief
|
|
90
|
+
? effectiveTemplate
|
|
91
|
+
: effectiveTemplate
|
|
92
|
+
.split("\n")
|
|
93
|
+
.filter((line) => !line.includes("_DELIVERABLE_BRIEF_"))
|
|
94
|
+
.join("\n");
|
|
95
|
+
const visibleTemplate = planOverrides?.origin === "register" && !planOverrides.registerInput?.length
|
|
96
|
+
? templateWithoutBrief
|
|
97
|
+
.split("\n")
|
|
98
|
+
.filter((line) => !line.includes("_REGISTER_INPUT_"))
|
|
99
|
+
.join("\n")
|
|
100
|
+
: templateWithoutBrief;
|
|
101
|
+
let body = expandTemplate(visibleTemplate, values);
|
|
83
102
|
if (deliverable?.catalogless && task.approach === "retrofit") {
|
|
84
103
|
body = body.replace("成果物カタログの `evidence_refs` から展開した", "個票に明記する");
|
|
85
104
|
}
|
|
105
|
+
const inputSection = registerInputSection(planOverrides?.registerInput);
|
|
106
|
+
if (inputSection) {
|
|
107
|
+
body = body.includes("_COMMON_CONVENTIONS_")
|
|
108
|
+
? body.replace("_COMMON_CONVENTIONS_", `${inputSection}\n_COMMON_CONVENTIONS_`)
|
|
109
|
+
: `${body.trimEnd()}\n\n${inputSection}`;
|
|
110
|
+
}
|
|
86
111
|
if (!planOverrides?.additionalConditions)
|
|
87
112
|
return body;
|
|
88
113
|
const section = [
|
|
@@ -130,6 +155,9 @@ function buildReviewPlanMarkdown(template, task, deliverable, criteria, vpMap, p
|
|
|
130
155
|
_PHASE_DESCRIPTION_: phaseDescriptionText(task),
|
|
131
156
|
_DELIVERABLE_NAME_: deliverableName(deliverable),
|
|
132
157
|
_DELIVERABLE_DEPENDS_ON_: deliverableDependsOn(deliverable, projectId, catalogPath),
|
|
158
|
+
_DELIVERABLE_BASED_ON_: deliverableBasedOn(deliverable),
|
|
159
|
+
_REGISTER_INPUT_: "なし",
|
|
160
|
+
_DELIVERABLE_BRIEF_: deliverableBrief(deliverable),
|
|
133
161
|
_PROJECT_CONTEXT_: projectContextSection(projectContext, deliverable, task.approach, projectId),
|
|
134
162
|
_DELIVERABLE_OVERVIEW_: deliverableOverview(deliverable),
|
|
135
163
|
_IMPLEMENTATION_EVIDENCE_: implementationEvidence(deliverable),
|
|
@@ -146,7 +174,14 @@ function buildReviewPlanMarkdown(template, task, deliverable, criteria, vpMap, p
|
|
|
146
174
|
_GRADE_SUMMARY_: reviewGradeSummaryText(projectId, gradeSubjectPath, reviewGradeOutcome),
|
|
147
175
|
_DONE_CRITERIA_ROWS_: reviewDoneCriteriaRows(applicableCriteria),
|
|
148
176
|
};
|
|
149
|
-
|
|
177
|
+
const hasBrief = Boolean(deliverable?.deliverable.brief?.trim());
|
|
178
|
+
const visibleTemplate = hasBrief
|
|
179
|
+
? template
|
|
180
|
+
: template
|
|
181
|
+
.split("\n")
|
|
182
|
+
.filter((line) => !line.includes("_DELIVERABLE_BRIEF_"))
|
|
183
|
+
.join("\n");
|
|
184
|
+
return expandTemplate(visibleTemplate, values);
|
|
150
185
|
}
|
|
151
186
|
async function writeTaskPlan(ctx, task, override) {
|
|
152
187
|
const mode = task.mode ?? "edit";
|
|
@@ -254,6 +289,7 @@ export async function generateRegisterApproachPlan(opts) {
|
|
|
254
289
|
targets: opts.targets,
|
|
255
290
|
...(opts.refs ? { refs: opts.refs } : {}),
|
|
256
291
|
...(opts.authoring ? { authoring: opts.authoring } : {}),
|
|
292
|
+
registerInput: opts.registerInput,
|
|
257
293
|
additionalConditions: opts.additionalConditions,
|
|
258
294
|
...(opts.outPath ? { outPath: opts.outPath } : {}),
|
|
259
295
|
stem: opts.stem,
|
|
@@ -37,7 +37,7 @@ export function planningPlanFields(opts) {
|
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
39
|
const strategy = join(getProjectSchedulePath(opts.project), `sch-strategy-${unit}.yaml`).replaceAll("\\", "/");
|
|
40
|
-
common.push("### scope・intent の宣言と完了条件", "", `1. \`${join(getProjectTimelinePath(opts.project), "tml-index.yaml").replaceAll("\\", "/")}\` があれば対象 track の domains と依存・着手順を確認する。\`timeline build\` の register 由来の状態と既存カタログも確認する。`, `2. \`${strategy}\` に \`scope.catalogs\`(ID・リポジトリルートからのパス)、\`scope.include_kinds\` と \`approach_rules\` を宣言する。既存 scope の意図を保ち、各成果物の \`local_ids\` と \`intent\`(例: author-deliverable / bootstrap-kata-set / confirm-deliverable)、必要時の \`kata_target\` / \`bootstrap_scope\` を根拠付きで決める。`, "3. 主担当を `owner_rules` または生成時の `--owner` / `--default-owner` で明示する。`done_criteria.roles` を主担当と解釈しない。必要な kata の grade が不足なら先に評価し、不明な判断を推測で補わない。", `4. \`specdojo schedule strategy generate ${projectArg} --track ${unit}\` を実行し、scope・intent・担当・依存関係に関するエラーを解消する。既存 strategy の変更は差分を確認し、必要な場合だけ \`--force\` を指定する。`, `5. \`specdojo schedule build ${projectArg} --track ${unit}\` を通し、\`sch-track-${unit}.yaml\` が生成され、scope の成果物とタスクの対応・依存が一致することを確認する。`, "6. strategy と track の保存、scope 全件の intent と担当の解決、生成・検証の成功を完了基準とし、個票の作業内容・対応結果と実行記録へ判断と検証を記録する。カタログ本体と `tml-index.yaml` は変更しない。");
|
|
40
|
+
common.push("### scope・intent の宣言と完了条件", "", `1. \`${join(getProjectTimelinePath(opts.project), "tml-index.yaml").replaceAll("\\", "/")}\` があれば対象 track の domains と依存・着手順を確認する。\`timeline build\` の register 由来の状態と既存カタログも確認する。`, `2. \`${strategy}\` に \`scope.catalogs\`(ID・リポジトリルートからのパス)、\`scope.include_kinds\` と \`approach_rules\` を宣言する。既存 scope の意図を保ち、各成果物の \`local_ids\` と \`intent\`(例: author-deliverable / bootstrap-kata-set / confirm-deliverable)、必要時の \`kata_target\` / \`bootstrap_scope\` を根拠付きで決める。`, "3. 主担当を `owner_rules` または生成時の `--owner` / `--default-owner` で明示する。`done_criteria.roles` を主担当と解釈しない。必要な kata の grade が不足なら先に評価し、不明な判断を推測で補わない。", " 人の文脈記入から始める場合は `intent: draft-with-context` を選ぶ。必要な kata がすべて利用可能なら `draft` profile(context → draft → refine → review → finalize)になる。context と finalize は human、他は agent とし、refine は `fully-guided` で磨き込む。", ` context の担当者は \`specdojo exec claim ${projectArg} --task <context-task-id> --by <human>\` で着手し、\`specdojo deliverable scaffold ${projectArg} --target <doc-id>\` で雛形を作る。既存成果物は上書きしない。本文の \`_CONTEXT_:\` に固定前提・制約・調査や選定を任せる範囲を書く(例: \`_CONTEXT_: 既存 API を維持し、認証方式の候補を調べて提案してほしい。\`)。result に記入内容を残して \`specdojo exec complete ${projectArg} --task <context-task-id> --by <human>\` で draft へ渡す。human 用の plan は生成しない。`, `4. \`specdojo schedule strategy generate ${projectArg} --track ${unit}\` を実行し、scope・intent・担当・依存関係に関するエラーを解消する。既存 strategy の変更は差分を確認し、必要な場合だけ \`--force\` を指定する。`, `5. \`specdojo schedule build ${projectArg} --track ${unit}\` を通し、\`sch-track-${unit}.yaml\` が生成され、scope の成果物とタスクの対応・依存が一致することを確認する。`, "6. strategy と track の保存、scope 全件の intent と担当の解決、生成・検証の成功を完了基準とし、個票の作業内容・対応結果と実行記録へ判断と検証を記録する。カタログ本体と `tml-index.yaml` は変更しない。");
|
|
41
41
|
}
|
|
42
42
|
return { refs, conditions: common.join("\n") };
|
|
43
43
|
}
|