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.
Files changed (78) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/catalog/build.js +7 -7
  3. package/dist/catalog/generate.js +27 -12
  4. package/dist/commands/init.js +26 -7
  5. package/dist/commands/orchestrator.js +9 -2
  6. package/dist/dashboard/timeline-build.js +4 -151
  7. package/dist/devcontainer/command.js +1 -1
  8. package/dist/devcontainer/scaffold.js +24 -9
  9. package/dist/exec/core.js +4 -0
  10. package/dist/exec/events.js +17 -6
  11. package/dist/exec/plans-core.js +26 -6
  12. package/dist/exec/plans-generation.js +13 -0
  13. package/dist/exec/plans-storage.js +15 -3
  14. package/dist/exec/register.js +64 -6
  15. package/dist/exec/results.js +5 -1
  16. package/dist/exec/strategy.js +4 -0
  17. package/dist/kata/authoring.js +100 -0
  18. package/dist/kata/command.js +52 -2
  19. package/dist/kata/kata.js +55 -12
  20. package/dist/register/approach.js +29 -1
  21. package/dist/register/core.js +3 -2
  22. package/dist/register/create-commands.js +9 -0
  23. package/dist/register/cross-project.js +141 -0
  24. package/dist/register/derivation.js +28 -7
  25. package/dist/register/external-project.js +136 -0
  26. package/dist/register/item.js +26 -5
  27. package/dist/register/register.js +45 -28
  28. package/dist/schedule/strategy-generate-scope.js +2 -1
  29. package/dist/schedule/strategy-profiles.js +3 -0
  30. package/dist/shared/agent-types.js +4 -0
  31. package/dist/shared/catalog-files.js +31 -0
  32. package/dist/shared/lefthook-scaffold.js +177 -0
  33. package/dist/shared/provider-scaffold.js +3 -3
  34. package/dist/shared/specdojo-config.js +130 -6
  35. package/dist/shared/timeline-index.js +125 -0
  36. package/docs/ja/specdojo/exec-templates/xep-recipe-authoring-template.md +45 -0
  37. package/docs/ja/specdojo/exec-templates/xep-rulebook-authoring-template.md +45 -0
  38. package/docs/ja/specdojo/exec-templates/xep-sample-authoring-template.md +45 -0
  39. package/docs/ja/specdojo/exec-templates/xep-template-authoring-template.md +45 -0
  40. package/docs/ja/specdojo/guides/docs-editing-guide.md +32 -0
  41. package/docs/ja/specdojo/guides/docs-structure-guide.md +1 -1
  42. package/docs/ja/specdojo/guides/exec-config-guide.md +13 -6
  43. package/docs/ja/specdojo/guides/kata-guide.md +4 -0
  44. package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +4 -2
  45. package/docs/ja/specdojo/guides/quick-start-guide.md +374 -68
  46. package/docs/ja/specdojo/guides/register-operation-guide.md +30 -0
  47. package/docs/ja/specdojo/guides/remote-host-development-guide.md +10 -2
  48. package/docs/ja/specdojo/guides/ryu-guide.md +18 -4
  49. package/docs/ja/specdojo/guides/use-case-guide.md +2 -2
  50. package/docs/ja/specdojo/references/command-reference.md +77 -29
  51. package/docs/ja/specdojo/references/specdojo-config-reference.md +41 -12
  52. package/docs/ja/specdojo/standards/recipe-authoring-standard.md +10 -10
  53. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +13 -13
  54. package/docs/ja/specdojo/standards/sample-authoring-standard.md +4 -4
  55. package/docs/ja/specdojo/standards/template-authoring-standard.md +4 -4
  56. package/docs/specdojo/schemas/v1/exec-common.schema.yaml +6 -0
  57. package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +6 -6
  58. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +21 -4
  59. package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +34 -0
  60. package/package.json +2 -2
  61. package/templates/antigravity/README.md +1 -1
  62. package/templates/antigravity/settings.global.json +5 -0
  63. package/templates/claude/README.md +11 -8
  64. package/templates/claude/settings.edit.json +10 -1
  65. package/templates/claude/settings.orchestrator.json +90 -0
  66. package/templates/claude/settings.report.json +14 -1
  67. package/templates/claude/settings.review.json +13 -1
  68. package/templates/codex/README.md +7 -5
  69. package/templates/codex/rules/specdojo.rules +48 -0
  70. package/templates/devcontainer/devcontainer.json +1 -4
  71. package/templates/init-agent-members.yaml +3 -3
  72. package/templates/lefthook/tools/install-lefthook.mjs +46 -0
  73. package/templates/lefthook/tools/specdojo-pre-commit.mjs +207 -0
  74. package/templates/opencode/README.md +8 -2
  75. package/templates/opencode/agents/opencode-executor.md +2 -0
  76. package/templates/opencode/agents/opencode-review-executor.md +2 -0
  77. package/templates/opencode/agents/specdojo-orchestrator.md +60 -6
  78. /package/dist/{shared → kata}/yaml-schema-modeline.js +0 -0
@@ -110,12 +110,12 @@ properties:
110
110
  minLength: 1
111
111
  minItems: 1
112
112
  description: >
113
- Doc ids of the documents this task targets, each resolvable via the doc index.
114
- The first entry is the target deliverable (project-qualified doc id,
115
- <project-id>:<local_id>). Subsequent entries are reference materials
116
- (rulebook/recipe/sample/template doc ids) the approach may modify or confirm
117
- (bootstrap, bootstrap-finalize, *-maintenance). Unresolvable reference
118
- materials are omitted.
113
+ Doc ids of the documents this task targets. Existing documents are resolvable via the
114
+ doc index. For deliverable work, the first entry is the target deliverable and subsequent
115
+ entries are reference materials the approach may modify or confirm. For *-authoring
116
+ register tasks, the first entry is an intentionally not-yet-existing kata id and
117
+ subsequent entries are read-only exemplar deliverables. Unresolvable reference materials
118
+ are omitted.
119
119
 
120
120
  paths:
121
121
  type: array
@@ -56,7 +56,20 @@ properties:
56
56
  targets:
57
57
  type: array
58
58
  minItems: 1
59
- maxItems: 1
59
+ allOf:
60
+ - if:
61
+ properties:
62
+ approach:
63
+ enum:
64
+ - rulebook-authoring
65
+ - recipe-authoring
66
+ - sample-authoring
67
+ - template-authoring
68
+ else:
69
+ properties:
70
+ targets:
71
+ type: array
72
+ maxItems: 1
60
73
  - type: object
61
74
  required:
62
75
  - rulebook
@@ -186,9 +199,9 @@ properties:
186
199
  approach:
187
200
  $ref: "#/$defs/Approach"
188
201
  description: >
189
- Execution approach for the single target. When present, targets must
190
- contain exactly one document id whose kind is compatible with the
191
- approach.
202
+ Execution approach. Authoring approaches use the first target as the new kata id
203
+ and any remaining targets as exemplar deliverables. Other approaches require one
204
+ compatible document id.
192
205
 
193
206
  targets:
194
207
  type: array
@@ -264,6 +277,10 @@ $defs:
264
277
  - recipe-guided
265
278
  - freeform
266
279
  - bootstrap
280
+ - rulebook-authoring
281
+ - recipe-authoring
282
+ - sample-authoring
283
+ - template-authoring
267
284
  - retrofit
268
285
  - cross-deliverable-dedup
269
286
  - rulebook-maintenance
@@ -18,10 +18,23 @@ properties:
18
18
  description: Repository-wide protected agent registry path.
19
19
  type: string
20
20
  pattern: "^(?!.*(?:^|/)\\.\\.(?:/|$))\\.specdojo/.+\\.ya?ml$"
21
+ kata_authority:
22
+ description: Repository-wide authority used by locally authored kata.
23
+ type: string
24
+ pattern: "^(?!prj-)(?!specdojo$)[a-z][a-z0-9-]*$"
21
25
  projects:
22
26
  type: object
23
27
  additionalProperties:
24
28
  $ref: "#/$defs/Project"
29
+ external_projects:
30
+ description: >-
31
+ Project registers hosted by other repositories, keyed by a local alias. Aliases must not
32
+ collide with a local project id.
33
+ type: object
34
+ propertyNames:
35
+ pattern: "^[a-z0-9-]+$"
36
+ additionalProperties:
37
+ $ref: "#/$defs/ExternalProject"
25
38
  $defs:
26
39
  NonEmptyString:
27
40
  type: string
@@ -57,6 +70,11 @@ $defs:
57
70
  properties:
58
71
  base_path:
59
72
  type: string
73
+ integration_branch:
74
+ description: >-
75
+ Branch that receives direct project-register commits. Defaults to
76
+ project/<project-id>/develop.
77
+ $ref: "#/$defs/NonEmptyString"
60
78
  catalog_path:
61
79
  type: string
62
80
  schedule_path:
@@ -90,6 +108,22 @@ $defs:
90
108
  $ref: "#/$defs/Repo"
91
109
  run:
92
110
  $ref: "#/$defs/Run"
111
+ ExternalProject:
112
+ type: object
113
+ additionalProperties: false
114
+ required:
115
+ - path
116
+ - project_id
117
+ properties:
118
+ path:
119
+ description: External repository root, relative to the SpecDojo root.
120
+ type: string
121
+ pattern: "\\S"
122
+ not:
123
+ pattern: "^(/|[A-Za-z]:[\\\\/])"
124
+ project_id:
125
+ description: Project id understood by SpecDojo in the external repository.
126
+ $ref: "#/$defs/NonEmptyString"
93
127
  Repo:
94
128
  type: object
95
129
  additionalProperties: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdojo",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "A dojo for Spec-Dō, the way of specification: decide with a register, write specs and designs with kata, and keep sharpening them with AI.",
5
5
  "license": "MIT",
6
6
  "author": "naoji3x",
@@ -25,7 +25,7 @@
25
25
  "type": "git",
26
26
  "url": "git+https://github.com/specdojo/specdojo.git"
27
27
  },
28
- "homepage": "https://github.com/specdojo/specdojo#readme",
28
+ "homepage": "https://specdojo.org",
29
29
  "bugs": {
30
30
  "url": "https://github.com/specdojo/specdojo/issues"
31
31
  },
@@ -33,7 +33,7 @@ npx specdojo config scaffold --provider antigravity --global
33
33
  - 既存 JSON や permission 配列の形式が不正な場合は、バックアップも書き込みも行わずエラーにします。
34
34
  - `--force` はリポジトリ内の配布物だけに作用し、グローバル設定の既存項目を上書きしません。
35
35
 
36
- 権限原本は、必要な検証コマンドを allow し、`git push`、破壊的コマンド、秘密情報、親 runner・hook・CI・agent 設定を変更できるパスを deny します。`.specdojo/doc-index.json` のような既知の生成物は検証で更新できるよう、`.specdojo/` 全体ではなく設定ファイルと provider ディレクトリを個別に deny します。provider 非依存の実行後ガードも併用されます。
36
+ 権限原本は、必要な検証コマンドを allow し、`git push`、読み取りを含む全 `gh`、破壊的コマンド、秘密情報、親 runner・hook・CI・agent 設定を変更できるパスを deny します。`.specdojo/doc-index.json` のような既知の生成物は検証で更新できるよう、`.specdojo/` 全体ではなく設定ファイルと provider ディレクトリを個別に deny します。provider 非依存の実行後ガードも併用されます。
37
37
 
38
38
  ## オーケストレーターの起動
39
39
 
@@ -5,6 +5,11 @@
5
5
  "command(git add)",
6
6
  "command(git commit)",
7
7
  "command(git push)",
8
+ "command(gh)",
9
+ "command(/usr/bin/git push)",
10
+ "command(/usr/bin/gh)",
11
+ "command(/usr/local/bin/git push)",
12
+ "command(/usr/local/bin/gh)",
8
13
  "command(git reset --hard)",
9
14
  "command(rm -rf)",
10
15
  "command(sudo)",
@@ -13,12 +13,13 @@ specdojo:
13
13
 
14
14
  ## 2. 構成
15
15
 
16
- | パス | 利用プロジェクトでの配置先 | 説明 |
17
- | ---------------------- | -------------------------- | --------------------------------------------------------------------- |
18
- | `agents/*.md` | `.claude/agents/` | 役割ごとの agent 定義。`--agent <name>` で参照されるため配置先は固定 |
19
- | `settings.edit.json` | `.specdojo/claude/` | edit executor 用 permission 設定。成果物への書き込みを許可する |
20
- | `settings.review.json` | `.specdojo/claude/` | review executor 用 permission 設定。result 配下のみ書き込みを許可する |
21
- | `settings.report.json` | `.specdojo/claude/` | reporter 用 permission 設定。Edit/Write と git add/commit を拒否する |
16
+ | パス | 利用プロジェクトでの配置先 | 説明 |
17
+ | ---------------------------- | -------------------------- | --------------------------------------------------------------------- |
18
+ | `agents/*.md` | `.claude/agents/` | 役割ごとの agent 定義。`--agent <name>` で参照されるため配置先は固定 |
19
+ | `settings.edit.json` | `.specdojo/claude/` | edit executor 用 permission 設定 |
20
+ | `settings.orchestrator.json` | `.specdojo/claude/` | 対話型 orchestrator 用 permission 設定 |
21
+ | `settings.review.json` | `.specdojo/claude/` | review executor 用 permission 設定。result 配下のみ書き込みを許可する |
22
+ | `settings.report.json` | `.specdojo/claude/` | reporter 用 permission 設定。ファイル編集を拒否する |
22
23
 
23
24
  ## 3. 導入手順
24
25
 
@@ -28,7 +29,7 @@ specdojo:
28
29
  specdojo exec scaffold --provider claude
29
30
  ```
30
31
 
31
- 既存ファイルは上書きされません(`--force` 指定時のみ上書き)。`--dry-run` でコピー予定を確認できます。コピー後に次の 2 点を行います。
32
+ 既存ファイルは上書きされません(`--force` 指定時のみ上書き)。`--dry-run` でコピー予定を確認できます。scaffold が `package.json` に追加する対話型オーケストレーターの npm script は `settings.orchestrator.json` を指定し、executor 用の `settings.edit.json` は使いません。コピー後に次の 3 点を行います。
32
33
 
33
34
  1. `.specdojo/exec-defaults.yaml` の `providers.claude.command_template` に `--settings .specdojo/claude/settings.{mode}.json` を指定する(`--permission-mode bypassPermissions` は付けない)。member 側に `command` は書かない。
34
35
  2. agent の定義は役割(executor・review executor・reporter)ごとの 1 ファイルで、model を持たない。`command_params.by_mode` で mode から定義を選び、model は実体の member の `model` を `--model {model}` で渡す。
@@ -67,4 +68,6 @@ aliases:
67
68
 
68
69
  - edit 用の既定値は `docs/**`、`src/**`、`tests/**` を許可する。`Edit(...)` / `Write(...)` のパスパターンは、利用プロジェクトの成果物・execution ディレクトリ配置に合わせて調整する。
69
70
  - report 用の既定値はファイルへの Edit/Write と `git add` / `git commit` を deny する。reporter は evidence から構造化結果を返すだけで、result への反映は runner が行う。
70
- - 全セッション共通で効かせたい deny(`.env` 読み取り禁止、`git push` 禁止など)は、利用プロジェクトの `.claude/settings.json` に置く。ここで配布するロール別設定は `--settings` 指定時の追加マージであり、共通設定の allow を取り消すことはできない。
71
+ - executor・review executor・reporter は `git push` と全 `gh` を deny する。Dev Container の名前付き volume に GitHub 認証がある場合も、この 3 ロールは GitHub CLI を使わない。
72
+ - orchestrator 用設定は `Edit(**)` を許可し、executor 用設定にある保護対象の編集 deny を持たない。`git push`、`gh api`、PR・release・repository などの書き込みサブコマンドは deny し、`gh pr view`・`gh pr list`・`gh run list`・`gh run view`・`gh release view` などの読み取りだけを allow する。
73
+ - そのほかの全セッション共通 deny(`.env` 読み取り禁止など)は、利用プロジェクトの `.claude/settings.json` に置く。ここで配布するロール別設定は `--settings` 指定時の追加マージであり、共通設定の allow を取り消すことはできない。
@@ -26,7 +26,16 @@
26
26
  "Edit(./.gitlab-ci.yaml)",
27
27
  "Edit(./azure-pipelines.yml)",
28
28
  "Edit(./azure-pipelines.yaml)",
29
- "Edit(./Jenkinsfile)"
29
+ "Edit(./Jenkinsfile)",
30
+ "Bash(git push)",
31
+ "Bash(git push *)",
32
+ "Bash(gh *)",
33
+ "Bash(/usr/bin/git push)",
34
+ "Bash(/usr/bin/git push *)",
35
+ "Bash(/usr/bin/gh *)",
36
+ "Bash(/usr/local/bin/git push)",
37
+ "Bash(/usr/local/bin/git push *)",
38
+ "Bash(/usr/local/bin/gh *)"
30
39
  ]
31
40
  }
32
41
  }
@@ -0,0 +1,90 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "permissions": {
4
+ "allow": [
5
+ "Edit(**)",
6
+ "Bash(gh auth status:*)",
7
+ "Bash(gh issue list:*)",
8
+ "Bash(gh issue view:*)",
9
+ "Bash(gh pr checks:*)",
10
+ "Bash(gh pr diff:*)",
11
+ "Bash(gh pr list:*)",
12
+ "Bash(gh pr status:*)",
13
+ "Bash(gh pr view:*)",
14
+ "Bash(gh release list:*)",
15
+ "Bash(gh release view:*)",
16
+ "Bash(gh repo list:*)",
17
+ "Bash(gh repo view:*)",
18
+ "Bash(gh run list:*)",
19
+ "Bash(gh run view:*)",
20
+ "Bash(gh run watch:*)",
21
+ "Bash(gh search:*)",
22
+ "Bash(gh status:*)",
23
+ "Bash(gh workflow list:*)",
24
+ "Bash(gh workflow view:*)"
25
+ ],
26
+ "deny": [
27
+ "Bash(git push:*)",
28
+ "Bash(gh api:*)",
29
+ "Bash(gh auth login:*)",
30
+ "Bash(gh auth logout:*)",
31
+ "Bash(gh auth refresh:*)",
32
+ "Bash(gh auth setup-git:*)",
33
+ "Bash(gh alias:*)",
34
+ "Bash(gh codespace:*)",
35
+ "Bash(gh config:*)",
36
+ "Bash(gh extension:*)",
37
+ "Bash(gh gist:*)",
38
+ "Bash(gh gpg-key:*)",
39
+ "Bash(gh issue close:*)",
40
+ "Bash(gh issue comment:*)",
41
+ "Bash(gh issue create:*)",
42
+ "Bash(gh issue delete:*)",
43
+ "Bash(gh issue edit:*)",
44
+ "Bash(gh issue lock:*)",
45
+ "Bash(gh issue pin:*)",
46
+ "Bash(gh issue reopen:*)",
47
+ "Bash(gh issue transfer:*)",
48
+ "Bash(gh issue unlock:*)",
49
+ "Bash(gh issue unpin:*)",
50
+ "Bash(gh label:*)",
51
+ "Bash(gh project:*)",
52
+ "Bash(gh pr close:*)",
53
+ "Bash(gh pr comment:*)",
54
+ "Bash(gh pr create:*)",
55
+ "Bash(gh pr edit:*)",
56
+ "Bash(gh pr lock:*)",
57
+ "Bash(gh pr merge:*)",
58
+ "Bash(gh pr ready:*)",
59
+ "Bash(gh pr reopen:*)",
60
+ "Bash(gh pr review:*)",
61
+ "Bash(gh pr unlock:*)",
62
+ "Bash(gh release create:*)",
63
+ "Bash(gh release delete:*)",
64
+ "Bash(gh release delete-asset:*)",
65
+ "Bash(gh release edit:*)",
66
+ "Bash(gh release upload:*)",
67
+ "Bash(gh repo archive:*)",
68
+ "Bash(gh repo create:*)",
69
+ "Bash(gh repo delete:*)",
70
+ "Bash(gh repo edit:*)",
71
+ "Bash(gh repo fork:*)",
72
+ "Bash(gh repo rename:*)",
73
+ "Bash(gh repo set-default:*)",
74
+ "Bash(gh repo sync:*)",
75
+ "Bash(gh run cancel:*)",
76
+ "Bash(gh run delete:*)",
77
+ "Bash(gh run rerun:*)",
78
+ "Bash(gh secret:*)",
79
+ "Bash(gh ssh-key:*)",
80
+ "Bash(gh variable:*)",
81
+ "Bash(gh workflow disable:*)",
82
+ "Bash(gh workflow enable:*)",
83
+ "Bash(gh workflow run:*)",
84
+ "Bash(/usr/bin/git push:*)",
85
+ "Bash(/usr/bin/gh:*)",
86
+ "Bash(/usr/local/bin/git push:*)",
87
+ "Bash(/usr/local/bin/gh:*)"
88
+ ]
89
+ }
90
+ }
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
3
  "permissions": {
4
- "deny": ["Edit(**)", "Bash(git add *)", "Bash(git commit *)"]
4
+ "deny": [
5
+ "Edit(**)",
6
+ "Bash(git add *)",
7
+ "Bash(git commit *)",
8
+ "Bash(git push)",
9
+ "Bash(git push *)",
10
+ "Bash(gh *)",
11
+ "Bash(/usr/bin/git push)",
12
+ "Bash(/usr/bin/git push *)",
13
+ "Bash(/usr/bin/gh *)",
14
+ "Bash(/usr/local/bin/git push)",
15
+ "Bash(/usr/local/bin/git push *)",
16
+ "Bash(/usr/local/bin/gh *)"
17
+ ]
5
18
  }
6
19
  }
@@ -2,6 +2,18 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
3
  "permissions": {
4
4
  "allow": ["Edit(docs/ja/projects/**/exec/results/**)"],
5
- "deny": ["Bash(git add *)", "Bash(git commit *)"]
5
+ "deny": [
6
+ "Bash(git add *)",
7
+ "Bash(git commit *)",
8
+ "Bash(git push)",
9
+ "Bash(git push *)",
10
+ "Bash(gh *)",
11
+ "Bash(/usr/bin/git push)",
12
+ "Bash(/usr/bin/git push *)",
13
+ "Bash(/usr/bin/gh *)",
14
+ "Bash(/usr/local/bin/git push)",
15
+ "Bash(/usr/local/bin/git push *)",
16
+ "Bash(/usr/local/bin/gh *)"
17
+ ]
6
18
  }
7
19
  }
@@ -13,9 +13,10 @@ specdojo:
13
13
 
14
14
  ## 2. 構成
15
15
 
16
- | パス | 利用プロジェクトでの配置先 | 説明 |
17
- | --------------- | -------------------------- | ------------------------------------------------------ |
18
- | `agents/*.toml` | `.codex/agents/` | subagent 定義。command template から直接選択はされない |
16
+ | パス | 利用プロジェクトでの配置先 | 説明 |
17
+ | --------------- | -------------------------- | ---------------------------------------------------------- |
18
+ | `agents/*.toml` | `.codex/agents/` | subagent 定義。command template から直接選択はされない |
19
+ | `rules/*.rules` | `.codex/rules/` | `git push` と全 `gh` を拒否する project-local command rule |
19
20
 
20
21
  配布する subagent には、成果物の編集と検証だけを担い result を更新しない `codex-expert-executor` を含みます。
21
22
 
@@ -88,8 +89,9 @@ npm run orch:terra
88
89
 
89
90
  model を持たない従来の 1 段の member は、`command_params.by_proficiency` に `model` を書けばそのまま動く(member の `model` があればそちらが優先される)。
90
91
 
91
- 3. 対話セッション用のデフォルト(`.codex/config.toml`)は利用環境に合わせて作成する。モデルや `approval_policy` の好みを含むため、このテンプレートには含めていない。
92
- 4. コピーしたファイルと `.specdojo/agent-members.yaml` をコミットする。worktree はコミット済み内容から作られるため、未コミットだと agent 実行時に設定が読めない。
92
+ 3. scaffold が配置する `.codex/rules/specdojo.rules` を維持する。この rule は Dev Container の共有 GitHub 認証を agent が使わないよう、`git push` と読み取りを含む全 `gh` を `forbidden` にする。project-local rule は信頼済み project で読み込まれる。
93
+ 4. 対話セッション用のデフォルト(`.codex/config.toml`)は利用環境に合わせて作成する。モデルや `approval_policy` の好みを含むため、このテンプレートには含めていない。
94
+ 5. コピーしたファイルと `.specdojo/agent-members.yaml` をコミットする。worktree はコミット済み内容から作られるため、未コミットだと agent 実行時に設定が読めない。
93
95
 
94
96
  ## 4. カスタマイズ
95
97
 
@@ -0,0 +1,48 @@
1
+ # The Dev Container keeps GitHub CLI credentials in a named volume. Keep remote
2
+ # repository mutations under the user's direct control, even when credentials are
3
+ # visible to Codex.
4
+ prefix_rule(
5
+ pattern = [["git", "/usr/bin/git", "/usr/local/bin/git"], "push"],
6
+ decision = "forbidden",
7
+ justification = "SpecDojo agents must hand git push back to the user.",
8
+ match = [
9
+ "git push",
10
+ "git push origin main",
11
+ "git push --force-with-lease origin feature/example",
12
+ "/usr/bin/git push origin main",
13
+ ],
14
+ not_match = ["git status"],
15
+ )
16
+
17
+ prefix_rule(
18
+ pattern = [["gh", "/usr/bin/gh", "/usr/local/bin/gh"]],
19
+ decision = "forbidden",
20
+ justification = "GitHub CLI access is reserved for the user because the Dev Container shares its credentials with agents.",
21
+ match = [
22
+ "gh pr view 123",
23
+ "gh pr create --title example --body example",
24
+ "gh pr merge 123",
25
+ "gh pr close 123",
26
+ "gh release create v1.0.0",
27
+ "gh repo delete owner/repo",
28
+ "gh api --method POST repos/owner/repo/issues",
29
+ "/usr/bin/gh pr create --title example --body example",
30
+ ],
31
+ not_match = ["git status"],
32
+ )
33
+
34
+ prefix_rule(
35
+ pattern = ["env", ["git", "/usr/bin/git", "/usr/local/bin/git"], "push"],
36
+ decision = "forbidden",
37
+ justification = "SpecDojo agents must hand git push back to the user.",
38
+ match = ["env git push origin main", "env /usr/bin/git push origin main"],
39
+ not_match = ["env git status"],
40
+ )
41
+
42
+ prefix_rule(
43
+ pattern = ["env", ["gh", "/usr/bin/gh", "/usr/local/bin/gh"]],
44
+ decision = "forbidden",
45
+ justification = "GitHub CLI access is reserved for the user because the Dev Container shares its credentials with agents.",
46
+ match = ["env gh pr view 123", "env /usr/bin/gh pr create --title example --body example"],
47
+ not_match = ["env git status"],
48
+ )
@@ -11,10 +11,7 @@
11
11
  "upgradePackages": false
12
12
  }
13
13
  },
14
- "mounts": [
15
- "source=specdojo-git,target=/home/node/.config/git,type=volume",
16
- "source=specdojo-gh,target=/home/node/.config/gh,type=volume"
17
- ],
14
+ "mounts": ["source=specdojo-git,target=/home/node/.config/git,type=volume"],
18
15
  "containerEnv": {
19
16
  "GIT_CONFIG_GLOBAL": "/home/node/.config/git/config"
20
17
  },
@@ -103,7 +103,7 @@ members:
103
103
  roles: []
104
104
  type: agent
105
105
  provider: opencode
106
- model: ollama-local/gemma4:31b-mlx-work-64k
106
+ model: ollama-local/gemma4:31b
107
107
  mode: edit
108
108
  stage_role: executor
109
109
  capabilities: [web_search]
@@ -117,7 +117,7 @@ members:
117
117
  roles: []
118
118
  type: agent
119
119
  provider: opencode
120
- model: ollama-local/gemma4:31b-mlx-work-64k
120
+ model: ollama-local/gemma4:31b
121
121
  mode: review
122
122
  stage_role: executor
123
123
  capabilities: [web_search]
@@ -131,7 +131,7 @@ members:
131
131
  roles: []
132
132
  type: agent
133
133
  provider: opencode
134
- model: ollama-local/gemma4:31b-mlx-work-64k
134
+ model: ollama-local/gemma4:26b
135
135
  mode: report
136
136
  stage_role: reporter
137
137
  capabilities: []
@@ -0,0 +1,46 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync, lstatSync } from "node:fs";
3
+ import { join } from "node:path";
4
+
5
+ const repoRoot = process.cwd();
6
+ const gitEntry = join(repoRoot, ".git");
7
+ const lefthookCli = join(repoRoot, "node_modules", "lefthook", "bin", "index.js");
8
+
9
+ if (!existsSync(gitEntry) || !lstatSync(gitEntry).isDirectory()) {
10
+ process.stdout.write("Skipping lefthook install outside the primary Git worktree.\n");
11
+ process.exit(0);
12
+ }
13
+ if (!existsSync(lefthookCli)) {
14
+ process.stdout.write(
15
+ "Skipping lefthook install because node_modules/lefthook is unavailable. Run npm install first.\n",
16
+ );
17
+ process.exit(0);
18
+ }
19
+
20
+ const env = { ...process.env };
21
+ for (const name of [
22
+ "GIT_ALTERNATE_OBJECT_DIRECTORIES",
23
+ "GIT_COMMON_DIR",
24
+ "GIT_DIR",
25
+ "GIT_GRAFT_FILE",
26
+ "GIT_IMPLICIT_WORK_TREE",
27
+ "GIT_INDEX_FILE",
28
+ "GIT_NAMESPACE",
29
+ "GIT_NO_REPLACE_OBJECTS",
30
+ "GIT_OBJECT_DIRECTORY",
31
+ "GIT_PREFIX",
32
+ "GIT_QUARANTINE_PATH",
33
+ "GIT_REPLACE_REF_BASE",
34
+ "GIT_SHALLOW_FILE",
35
+ "GIT_WORK_TREE",
36
+ ]) {
37
+ delete env[name];
38
+ }
39
+
40
+ const result = spawnSync(process.execPath, [lefthookCli, "install"], {
41
+ cwd: repoRoot,
42
+ env,
43
+ stdio: "inherit",
44
+ });
45
+ if (result.error) throw result.error;
46
+ process.exit(result.status ?? 1);