sdd-forge 0.1.0-alpha.22 → 0.1.0-alpha.24
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/README.md +87 -80
- package/docs/01_overview.md +69 -89
- package/docs/02_cli_commands.md +166 -175
- package/docs/03_configuration.md +104 -56
- package/docs/04_internal_design.md +161 -191
- package/package.json +1 -1
- package/src/docs/commands/agents.js +106 -263
- package/src/docs/commands/changelog.js +30 -46
- package/src/docs/commands/data.js +60 -95
- package/src/docs/commands/default-project.js +9 -14
- package/src/docs/commands/forge.js +119 -184
- package/src/docs/commands/init.js +112 -126
- package/src/docs/commands/readme.js +62 -89
- package/src/docs/commands/review.js +57 -42
- package/src/docs/commands/scan.js +54 -95
- package/src/docs/commands/setup.js +41 -54
- package/src/docs/commands/text.js +133 -467
- package/src/docs/commands/translate.js +199 -0
- package/src/docs/commands/upgrade.js +12 -79
- package/src/docs/data/agents.js +138 -0
- package/src/docs/data/docs.js +13 -9
- package/src/docs/data/lang.js +109 -0
- package/src/docs/lib/command-context.js +170 -0
- package/src/docs/lib/concurrency.js +47 -0
- package/src/docs/lib/data-source-loader.js +44 -0
- package/src/docs/lib/directive-parser.js +76 -0
- package/src/docs/lib/resolver-factory.js +14 -36
- package/src/docs/lib/review-parser.js +1 -4
- package/src/docs/lib/scan-source.js +1 -1
- package/src/docs/lib/scanner.js +1 -13
- package/src/docs/lib/template-merger.js +289 -160
- package/src/docs/lib/text-prompts.js +225 -0
- package/src/docs.js +129 -89
- package/src/flow.js +12 -31
- package/src/help.js +8 -32
- package/src/lib/agent.js +71 -83
- package/src/lib/agents-md.js +2 -24
- package/src/lib/cli.js +31 -0
- package/src/lib/config.js +59 -4
- package/src/lib/entrypoint.js +23 -0
- package/src/lib/flow-state.js +2 -1
- package/src/lib/i18n.js +2 -1
- package/src/lib/presets.js +1 -0
- package/src/lib/progress.js +50 -13
- package/src/lib/types.js +39 -23
- package/src/locale/en/messages.json +14 -6
- package/src/locale/en/prompts.json +1 -3
- package/src/locale/en/ui.json +110 -4
- package/src/locale/ja/messages.json +14 -6
- package/src/locale/ja/prompts.json +1 -3
- package/src/locale/ja/ui.json +110 -4
- package/src/presets/base/preset.json +7 -1
- package/src/presets/base/templates/en/AGENTS.sdd.md +101 -0
- package/src/presets/base/templates/en/development.md +40 -0
- package/src/presets/base/templates/en/overview.md +33 -0
- package/src/presets/base/templates/en/project_structure.md +28 -0
- package/src/presets/base/templates/en/stack_and_ops.md +34 -0
- package/src/presets/base/templates/ja/AGENTS.sdd.md +28 -17
- package/src/presets/cakephp2/scan/assets.js +1 -1
- package/src/presets/cli/preset.json +9 -1
- package/src/presets/cli/templates/ja/README.md +0 -3
- package/src/presets/laravel/scan/config.js +2 -33
- package/src/presets/laravel/scan/controllers.js +3 -15
- package/src/presets/laravel/scan/models.js +7 -26
- package/src/presets/lib/composer-utils.js +61 -0
- package/src/presets/library/preset.json +9 -1
- package/src/presets/library/templates/ja/README.md +0 -3
- package/src/presets/node-cli/preset.json +7 -0
- package/src/presets/node-cli/templates/ja/cli_commands.md +23 -0
- package/src/presets/node-cli/templates/ja/configuration.md +23 -0
- package/src/presets/node-cli/templates/ja/internal_design.md +27 -0
- package/src/presets/node-cli/templates/ja/overview.md +23 -0
- package/src/presets/symfony/scan/config.js +2 -37
- package/src/presets/symfony/scan/controllers.js +3 -15
- package/src/presets/symfony/scan/entities.js +8 -21
- package/src/presets/symfony/scan/routes.js +7 -15
- package/src/presets/webapp/data/controllers.js +10 -0
- package/src/presets/webapp/data/shells.js +10 -0
- package/src/presets/webapp/preset.json +13 -1
- package/src/presets/webapp/templates/ja/README.md +0 -3
- package/src/sdd-forge.js +4 -6
- package/src/spec.js +1 -3
- package/src/specs/commands/gate.js +45 -20
- package/src/specs/commands/init.js +31 -32
- package/src/templates/config.example.json +1 -2
- package/src/templates/skills/sdd-flow-status/SKILL.md +71 -0
- package/docs/05_development.md +0 -86
- package/src/docs/lib/renderers.js +0 -150
- package/src/presets/node-cli/templates/ja/01_overview.md +0 -23
- package/src/presets/node-cli/templates/ja/02_cli_commands.md +0 -23
- package/src/presets/node-cli/templates/ja/03_configuration.md +0 -23
- package/src/presets/node-cli/templates/ja/04_internal_design.md +0 -30
- package/src/presets/webapp/templates/ja/chapters.json +0 -4
- /package/src/presets/base/templates/ja/{04_development.md → development.md} +0 -0
- /package/src/presets/base/templates/ja/{01_overview.md → overview.md} +0 -0
- /package/src/presets/base/templates/ja/{03_project_structure.md → project_structure.md} +0 -0
- /package/src/presets/base/templates/ja/{02_stack_and_ops.md → stack_and_ops.md} +0 -0
- /package/src/presets/cakephp2/templates/ja/{05_auth_and_session.md → auth_and_session.md} +0 -0
- /package/src/presets/cakephp2/templates/ja/{08_controller_routes.md → controller_routes.md} +0 -0
- /package/src/presets/cakephp2/templates/ja/{07_db_tables.md → db_tables.md} +0 -0
- /package/src/presets/cakephp2/templates/ja/{04_development.md → development.md} +0 -0
- /package/src/presets/cakephp2/templates/ja/{03_project_structure.md → project_structure.md} +0 -0
- /package/src/presets/cakephp2/templates/ja/{02_stack_and_ops.md → stack_and_ops.md} +0 -0
- /package/src/presets/cli/templates/ja/{05_commands.md → commands.md} +0 -0
- /package/src/presets/cli/templates/ja/{06_config.md → config.md} +0 -0
- /package/src/presets/laravel/templates/ja/{05_auth_and_session.md → auth_and_session.md} +0 -0
- /package/src/presets/laravel/templates/ja/{08_controller_routes.md → controller_routes.md} +0 -0
- /package/src/presets/laravel/templates/ja/{07_db_tables.md → db_tables.md} +0 -0
- /package/src/presets/laravel/templates/ja/{03_project_structure.md → project_structure.md} +0 -0
- /package/src/presets/laravel/templates/ja/{02_stack_and_ops.md → stack_and_ops.md} +0 -0
- /package/src/presets/library/templates/ja/{05_public_api.md → public_api.md} +0 -0
- /package/src/presets/library/templates/ja/{06_usage.md → usage.md} +0 -0
- /package/src/presets/node-cli/templates/ja/{02_stack_and_ops.md → commands.md} +0 -0
- /package/src/presets/node-cli/templates/ja/{03_project_structure.md → config.md} +0 -0
- /package/src/presets/node-cli/templates/ja/{04_development.md → development.md} +0 -0
- /package/src/presets/node-cli/templates/ja/{05_development.md → development_testing.md} +0 -0
- /package/src/presets/node-cli/templates/ja/{05_commands.md → project_structure.md} +0 -0
- /package/src/presets/node-cli/templates/ja/{06_config.md → stack_and_ops.md} +0 -0
- /package/src/presets/symfony/templates/ja/{05_auth_and_session.md → auth_and_session.md} +0 -0
- /package/src/presets/symfony/templates/ja/{08_controller_routes.md → controller_routes.md} +0 -0
- /package/src/presets/symfony/templates/ja/{07_db_tables.md → db_tables.md} +0 -0
- /package/src/presets/symfony/templates/ja/{03_project_structure.md → project_structure.md} +0 -0
- /package/src/presets/symfony/templates/ja/{02_stack_and_ops.md → stack_and_ops.md} +0 -0
- /package/src/presets/webapp/templates/ja/{05_auth_and_session.md → auth_and_session.md} +0 -0
- /package/src/presets/webapp/templates/ja/{10_batch_and_shell.md → batch_and_shell.md} +0 -0
- /package/src/presets/webapp/templates/ja/{09_business_logic.md → business_logic.md} +0 -0
- /package/src/presets/webapp/templates/ja/{08_controller_routes.md → controller_routes.md} +0 -0
- /package/src/presets/webapp/templates/ja/{06_database_architecture.md → database_architecture.md} +0 -0
- /package/src/presets/webapp/templates/ja/{07_db_tables.md → db_tables.md} +0 -0
package/README.md
CHANGED
|
@@ -1,153 +1,160 @@
|
|
|
1
|
-
#
|
|
1
|
+
# {{data: project.name("")}}sdd-forge{{/data}}
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/sdd-forge)
|
|
4
4
|
|
|
5
|
-
> **Alpha
|
|
5
|
+
> **Alpha:** This tool is currently in alpha. The API, command structure, and configuration format may change without notice. Please avoid using it in production environments.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**A CLI tool that automatically generates and maintains project documentation using source code analysis + AI.**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Statically analyzes your codebase and combines templates with AI to auto-generate `docs/`.
|
|
10
|
+
The Spec-Driven Development (SDD) workflow also automates documentation updates when adding features or making changes.
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- **AI
|
|
17
|
-
-
|
|
18
|
-
- **SDD
|
|
19
|
-
- **
|
|
20
|
-
-
|
|
14
|
+
- **Zero dependencies** — Runs on Node.js 18+ only. No npm package dependencies.
|
|
15
|
+
- **Automatic source code analysis** — Statically analyzes controllers, models, routes, and config files to extract structural data.
|
|
16
|
+
- **AI document generation** — AI automatically expands `{{text}}` directives in templates.
|
|
17
|
+
- **Template inheritance** — Four-layer inheritance (base → arch → preset → project-local) for flexible customization.
|
|
18
|
+
- **SDD workflow** — Manage the development cycle of spec → gate → implementation → forge → review with simple commands.
|
|
19
|
+
- **Multilingual support** — Automatically generate documentation in multiple languages via translate / generate modes.
|
|
20
|
+
- **AI agent integration** — Compatible with Claude Code (skills) and Codex CLI.
|
|
21
|
+
- **Multi-preset** — Supports Node.js CLI / CakePHP2 / Laravel / Symfony.
|
|
21
22
|
|
|
22
|
-
##
|
|
23
|
+
## Quick Start
|
|
23
24
|
|
|
24
|
-
###
|
|
25
|
+
### Installation
|
|
25
26
|
|
|
26
27
|
<pre>
|
|
27
28
|
# npm
|
|
28
|
-
npm install -g
|
|
29
|
+
npm install -g {{data: project.name("")}}sdd-forge{{/data}}
|
|
29
30
|
|
|
30
31
|
# yarn
|
|
31
|
-
yarn global add
|
|
32
|
+
yarn global add {{data: project.name("")}}sdd-forge{{/data}}
|
|
32
33
|
|
|
33
34
|
# pnpm
|
|
34
|
-
pnpm add -g
|
|
35
|
+
pnpm add -g {{data: project.name("")}}sdd-forge{{/data}}
|
|
35
36
|
</pre>
|
|
36
37
|
|
|
37
|
-
###
|
|
38
|
+
### Setup & Document Generation
|
|
38
39
|
|
|
39
40
|
<pre>
|
|
40
|
-
# 1.
|
|
41
|
-
|
|
41
|
+
# 1. Register your project (interactive wizard)
|
|
42
|
+
{{data: project.name("")}}sdd-forge{{/data}} setup
|
|
42
43
|
|
|
43
|
-
# 2.
|
|
44
|
-
|
|
44
|
+
# 2. Generate all documentation at once (scan → init → data → text → readme → agents → translate)
|
|
45
|
+
{{data: project.name("")}}sdd-forge{{/data}} build
|
|
45
46
|
</pre>
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
This is all it takes to generate `docs/` and `README.md`.
|
|
48
49
|
|
|
49
|
-
##
|
|
50
|
+
## Command Reference
|
|
50
51
|
|
|
51
|
-
###
|
|
52
|
+
### Document Generation
|
|
52
53
|
|
|
53
|
-
|
|
|
54
|
+
| Command | Description |
|
|
54
55
|
|---|---|
|
|
55
|
-
| `setup` |
|
|
56
|
-
| `build` |
|
|
57
|
-
| `scan` |
|
|
58
|
-
| `init` |
|
|
59
|
-
| `data` | `{{data}}`
|
|
60
|
-
| `text` | `{{text}}`
|
|
61
|
-
| `readme` |
|
|
62
|
-
| `forge` | AI
|
|
63
|
-
| `review` |
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
| `setup` | Register project + generate config file |
|
|
57
|
+
| `build` | Run the full document generation pipeline |
|
|
58
|
+
| `scan` | Analyze source code → `analysis.json` |
|
|
59
|
+
| `init` | Initialize `docs/` from templates |
|
|
60
|
+
| `data` | Resolve `{{data}}` directives with analyzed data |
|
|
61
|
+
| `text` | Resolve `{{text}}` directives with AI |
|
|
62
|
+
| `readme` | Auto-generate `README.md` from `docs/` |
|
|
63
|
+
| `forge` | Iteratively improve documentation with AI |
|
|
64
|
+
| `review` | Check documentation quality |
|
|
65
|
+
| `translate` | Multilingual translation (default language → others) |
|
|
66
|
+
| `upgrade` | Update preset templates to the latest version |
|
|
67
|
+
|
|
68
|
+
### SDD Workflow
|
|
69
|
+
|
|
70
|
+
| Command | Description |
|
|
68
71
|
|---|---|
|
|
69
|
-
| `spec` |
|
|
70
|
-
| `gate` |
|
|
71
|
-
| `flow` | SDD
|
|
72
|
-
| `changelog` | specs/
|
|
73
|
-
| `agents` | AGENTS.md
|
|
72
|
+
| `spec` | Create a spec document + feature branch |
|
|
73
|
+
| `gate` | Pre-implementation check for the spec |
|
|
74
|
+
| `flow` | Automatically run the SDD workflow |
|
|
75
|
+
| `changelog` | Generate change history from specs/ |
|
|
76
|
+
| `agents` | Update AGENTS.md |
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
### Project Management
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
| Command | Description |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `default` | Set the default project |
|
|
83
|
+
| `presets` | List available presets |
|
|
84
|
+
| `help` | Show command list |
|
|
85
|
+
|
|
86
|
+
## SDD Workflow
|
|
87
|
+
|
|
88
|
+
The flow for adding features or making changes:
|
|
78
89
|
|
|
79
90
|
```
|
|
80
|
-
spec
|
|
91
|
+
spec Create a spec (feature branch + spec.md)
|
|
81
92
|
↓
|
|
82
|
-
gate
|
|
93
|
+
gate Spec gate check (PASS when no unresolved items)
|
|
83
94
|
↓
|
|
84
|
-
|
|
95
|
+
implement Write code after gate PASS
|
|
85
96
|
↓
|
|
86
|
-
forge
|
|
97
|
+
forge Auto-update documentation
|
|
87
98
|
↓
|
|
88
|
-
review
|
|
99
|
+
review Quality check (repeat until PASS)
|
|
89
100
|
```
|
|
90
101
|
|
|
91
|
-
### AI
|
|
102
|
+
### AI Agent Integration
|
|
92
103
|
|
|
93
104
|
#### Claude Code
|
|
94
105
|
|
|
95
|
-
|
|
106
|
+
Run the SDD workflow with skills:
|
|
96
107
|
|
|
97
108
|
```
|
|
98
|
-
/sdd-flow-start — spec
|
|
99
|
-
/sdd-flow-close — forge → review → commit → merge
|
|
109
|
+
/sdd-flow-start — Start spec creation → gate → implementation
|
|
110
|
+
/sdd-flow-close — Finish with forge → review → commit → merge
|
|
100
111
|
```
|
|
101
112
|
|
|
102
113
|
#### Codex CLI
|
|
103
114
|
|
|
104
|
-
|
|
115
|
+
Run the workflow from a prompt:
|
|
105
116
|
|
|
106
117
|
```
|
|
107
|
-
$sdd-flow-start — spec
|
|
108
|
-
$sdd-flow-close — forge → review → commit → merge
|
|
118
|
+
$sdd-flow-start — Start spec creation → gate → implementation
|
|
119
|
+
$sdd-flow-close — Finish with forge → review → commit → merge
|
|
109
120
|
```
|
|
110
121
|
|
|
111
|
-
##
|
|
122
|
+
## Configuration
|
|
112
123
|
|
|
113
|
-
`sdd-forge setup`
|
|
124
|
+
Running `sdd-forge setup` generates `.sdd-forge/config.json`.
|
|
114
125
|
|
|
115
126
|
```jsonc
|
|
116
127
|
{
|
|
117
|
-
"type": "cli/node-cli", //
|
|
118
|
-
"lang": "
|
|
119
|
-
"defaultAgent": "claude", // AI
|
|
120
|
-
"providers": { ... } //
|
|
128
|
+
"type": "cli/node-cli", // Project type (preset selection)
|
|
129
|
+
"lang": "en", // Documentation language
|
|
130
|
+
"defaultAgent": "claude", // AI agent
|
|
131
|
+
"providers": { ... } // Agent configuration
|
|
121
132
|
}
|
|
122
133
|
```
|
|
123
134
|
|
|
124
|
-
###
|
|
135
|
+
### Customization
|
|
125
136
|
|
|
126
|
-
|
|
137
|
+
You can add project-specific templates and data sources:
|
|
127
138
|
|
|
128
139
|
```
|
|
129
140
|
.sdd-forge/
|
|
130
141
|
├── templates/{lang}/
|
|
131
|
-
│ ├── docs/ ←
|
|
132
|
-
│ └── specs/ ← spec.md / qa.md
|
|
133
|
-
└── data/ ←
|
|
142
|
+
│ ├── docs/ ← Chapter templates / README overrides
|
|
143
|
+
│ └── specs/ ← spec.md / qa.md templates
|
|
144
|
+
└── data/ ← Custom data source modules
|
|
134
145
|
```
|
|
135
146
|
|
|
136
|
-
##
|
|
147
|
+
## Documentation
|
|
137
148
|
|
|
138
|
-
<!-- {{data: docs.chapters("
|
|
139
|
-
|
|
|
149
|
+
<!-- {{data: docs.chapters("Chapter|Overview")}} -->
|
|
150
|
+
| Chapter | Overview |
|
|
140
151
|
| --- | --- |
|
|
141
|
-
| [01.
|
|
142
|
-
| [02. CLI
|
|
143
|
-
| [03.
|
|
144
|
-
| [04.
|
|
145
|
-
| [05. 開発・テスト・配布](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/05_development.md) | 本章では、ローカル開発環境の構築方法からテストの実行手順、npm レジストリへのリリースまでの一連の開発サイクルを説明します。 |
|
|
152
|
+
| [01. System Overview](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/01_overview.md) | This chapter provides a high-level view of `sdd-forge`, a Node.js CLI tool that automates documentation generation th… |
|
|
153
|
+
| [02. CLI Command Reference](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/02_cli_commands.md) | This chapter documents all 17 subcommands available in `sdd-forge`, organized across three dispatcher layers (`docs.j… |
|
|
154
|
+
| [03. Configuration and Customization](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/03_configuration.md) | This chapter covers the configuration files and customization options available in sdd-forge, including project setti… |
|
|
155
|
+
| [04. Internal Design](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/04_internal_design.md) | |
|
|
146
156
|
<!-- {{/data}} -->
|
|
147
157
|
|
|
148
158
|
## License
|
|
149
159
|
|
|
150
160
|
MIT
|
|
151
|
-
|
|
152
|
-
<!-- MANUAL:START -->
|
|
153
|
-
<!-- MANUAL:END -->
|
package/docs/01_overview.md
CHANGED
|
@@ -1,110 +1,90 @@
|
|
|
1
|
-
# 01.
|
|
1
|
+
# 01. System Overview
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Description
|
|
4
4
|
|
|
5
|
-
<!-- {{text:
|
|
5
|
+
<!-- {{text: Write a 1-2 sentence overview of this chapter. Include the project's architecture and whether it integrates with external systems.}} -->
|
|
6
6
|
|
|
7
|
-
sdd-forge
|
|
7
|
+
This chapter provides a high-level view of `sdd-forge`, a Node.js CLI tool that automates documentation generation through source code analysis and drives feature development via a Spec-Driven Development (SDD) workflow. The tool integrates with externally configured AI agents (such as Claude CLI) to produce and refine project documentation, while relying solely on Node.js built-in modules for all other operations.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Content
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Architecture Diagram
|
|
12
12
|
|
|
13
|
-
<!-- {{text:
|
|
14
|
-
|
|
15
|
-
ソフトウェア開発において「ドキュメントが陳腐化する」「仕様と実装が乖離する」という課題を解決するために作られたツールです。ソースコードを静的解析して docs/ 配下のドキュメントを自動生成・更新することで、常にコードと同期されたドキュメントを維持できます。また、機能追加・改修の際には SDD フローに従って spec(仕様書)を作成し、ゲートチェックをパスしてから実装に進む規律ある開発プロセスを提供します。
|
|
16
|
-
|
|
17
|
-
主なターゲットユーザーは、レガシーコードベースを抱えるチームや、ドキュメント管理コストを削減したい開発チームです。CakePHP 2.x・Laravel・Symfony・Node.js CLI などのプリセットが用意されており、対象フレームワークにあわせてすぐに利用を開始できます。
|
|
18
|
-
|
|
19
|
-
### アーキテクチャ概要
|
|
20
|
-
|
|
21
|
-
<!-- {{text: ツール全体のアーキテクチャを mermaid flowchart で生成してください。入力・処理・出力の流れ、主要モジュールの関係を含めること。出力は mermaid コードブロックのみ。}} -->
|
|
13
|
+
<!-- {{text: Generate a mermaid flowchart showing the project architecture. Include data flows between major components. Output only the mermaid code block.}} -->
|
|
22
14
|
|
|
23
15
|
```mermaid
|
|
24
16
|
flowchart TD
|
|
25
|
-
CLI[
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
User([User / CI]) -->|CLI invocation| Entry[sdd-forge.js\nEntry Point]
|
|
18
|
+
|
|
19
|
+
Entry -->|docs subcommands| DocsDispatcher[docs.js\nDispatcher]
|
|
20
|
+
Entry -->|spec / gate| SpecDispatcher[spec.js\nDispatcher]
|
|
21
|
+
Entry -->|flow| Flow[flow.js\nSDD Flow Runner]
|
|
22
|
+
Entry -->|presets| Presets[presets-cmd.js]
|
|
23
|
+
Entry -->|help| Help[help.js]
|
|
24
|
+
|
|
25
|
+
DocsDispatcher --> Scan[scan\nSource Analysis]
|
|
26
|
+
DocsDispatcher --> Data[data\nDirective Resolver]
|
|
27
|
+
DocsDispatcher --> Text[text\nAI Text Fill]
|
|
28
|
+
DocsDispatcher --> Forge[forge\nDocs Refinement]
|
|
29
|
+
DocsDispatcher --> Review[review\nQuality Check]
|
|
30
|
+
DocsDispatcher --> Readme[readme\nREADME Generator]
|
|
31
|
+
|
|
32
|
+
SpecDispatcher --> SpecInit[spec init\nSpec Creation]
|
|
33
|
+
SpecDispatcher --> Gate[gate\nGate Check]
|
|
34
|
+
|
|
35
|
+
Scan -->|analysis.json\nsummary.json| OutputDir[.sdd-forge/output/]
|
|
36
|
+
Data -->|reads| OutputDir
|
|
37
|
+
Text -->|reads| OutputDir
|
|
38
|
+
Forge -->|reads| OutputDir
|
|
39
|
+
|
|
40
|
+
Text -->|prompt| AgentLib[lib/agent.js\nAI Agent Caller]
|
|
41
|
+
Forge -->|prompt| AgentLib
|
|
42
|
+
Review -->|prompt| AgentLib
|
|
43
|
+
AgentLib -->|configured command| ExternalAI([External AI Agent\ne.g. Claude CLI])
|
|
44
|
+
|
|
45
|
+
OutputDir -->|resolved directives| DocsDir[docs/\nGenerated Documentation]
|
|
53
46
|
```
|
|
54
47
|
|
|
55
|
-
###
|
|
48
|
+
### Component Responsibilities
|
|
56
49
|
|
|
57
|
-
<!-- {{text:
|
|
50
|
+
<!-- {{text: Describe the major components with their location, responsibilities, and I/O in table format.}} -->
|
|
58
51
|
|
|
59
|
-
|
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
| docs/ |
|
|
65
|
-
| `{{data}}`
|
|
66
|
-
| `{{
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
52
|
+
| Component | Location | Responsibility | Input | Output |
|
|
53
|
+
|---|---|---|---|---|
|
|
54
|
+
| CLI Entry Point | `src/sdd-forge.js` | Parses top-level subcommand and resolves project context via environment variables | CLI arguments, `.sdd-forge/projects.json` | Routes to dispatcher with `SDD_SOURCE_ROOT` / `SDD_WORK_ROOT` set |
|
|
55
|
+
| Docs Dispatcher | `src/docs.js` | Routes docs-related subcommands (`build`, `scan`, `data`, `text`, `forge`, `review`, etc.) | Subcommand string | Delegates to `src/docs/commands/*.js` |
|
|
56
|
+
| Spec Dispatcher | `src/spec.js` | Routes spec-related subcommands (`spec`, `gate`) | Subcommand string | Delegates to `src/specs/commands/*.js` |
|
|
57
|
+
| Scanner | `src/docs/lib/scanner.js` | Traverses source files and extracts structural information (PHP, JS, YAML) | Source root path, scan config | `.sdd-forge/output/analysis.json`, `summary.json` |
|
|
58
|
+
| Directive Parser | `src/docs/lib/directive-parser.js` | Parses `{{data}}`, `{{text}}`, `@block`, and `@extends` directives in Markdown templates | Markdown template files | Parsed directive AST |
|
|
59
|
+
| Data Resolver | `src/docs/lib/resolver-factory.js` | Resolves `{{data}}` directives by binding analysis data to named data sources | Parsed directives, `analysis.json` | Rendered Markdown sections |
|
|
60
|
+
| AI Agent Caller | `src/lib/agent.js` | Executes configured external AI agent commands synchronously or asynchronously | Prompt string, agent config | AI-generated text streamed or returned as string |
|
|
61
|
+
| Config Manager | `src/lib/config.js` | Loads and validates `.sdd-forge/config.json`; manages context and path resolution | `.sdd-forge/` directory | Typed config object, resolved paths |
|
|
62
|
+
| Flow State Manager | `src/lib/flow-state.js` | Persists and retrieves SDD workflow state (current spec, branch, worktree info) | Work root path, state object | `.sdd-forge/current-spec` JSON file |
|
|
63
|
+
| Preset System | `src/lib/presets.js` | Auto-discovers `preset.json` files under `src/presets/` and registers available project types | `src/presets/` directory tree | `PRESETS` constant used across all consumers |
|
|
64
|
+
| SDD Flow Runner | `src/flow.js` | Orchestrates the full SDD cycle (spec → gate → implement → forge → review) automatically | `--request` argument, flow state | Sequential command execution with user interaction |
|
|
72
65
|
|
|
73
|
-
###
|
|
66
|
+
### External Integrations
|
|
74
67
|
|
|
75
|
-
<!-- {{text:
|
|
68
|
+
<!-- {{text: If there are external system integrations, describe their purpose and connection method in table format.}} -->
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
| System | Purpose | Connection Method | Configuration |
|
|
71
|
+
|---|---|---|---|
|
|
72
|
+
| AI Agent (e.g. Claude CLI) | Generates and refines documentation text, performs quality review, and evaluates spec gate checks | Spawned as a child process via `child_process.execFileSync` (sync) or `spawn` (async) | Defined in `.sdd-forge/config.json` under `providers` and `defaultAgent`; supports `command`, `args`, `timeoutMs`, and `systemPromptFlag` |
|
|
73
|
+
| Git | Branch creation, worktree isolation, and repository root resolution for SDD workflows | Invoked via `child_process` shell commands (`git rev-parse`, `git worktree`, etc.) | Resolved automatically from the working directory; worktree support detected via `.git` file presence |
|
|
78
74
|
|
|
79
|
-
|
|
80
|
-
npm install -g sdd-forge
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**2. プロジェクトのセットアップ**
|
|
84
|
-
|
|
85
|
-
ドキュメント化したいプロジェクトのルートディレクトリで `setup` コマンドを実行します。プロジェクト種別(`type`)・言語(`lang`)・使用する AI エージェントなどの設定が対話形式で生成されます。
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
cd /path/to/your-project
|
|
89
|
-
sdd-forge setup
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**3. ソースコード解析**
|
|
75
|
+
`sdd-forge` has no network-based external dependencies. All integrations are process-level and operate entirely within the local development environment.
|
|
93
76
|
|
|
94
|
-
|
|
77
|
+
### Environment Differences
|
|
95
78
|
|
|
96
|
-
|
|
97
|
-
sdd-forge scan
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**4. docs の一括生成**
|
|
101
|
-
|
|
102
|
-
テンプレート初期化・データ解決・AI によるテキスト生成・README 更新までを一括で実行します。
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
sdd-forge build
|
|
106
|
-
```
|
|
79
|
+
<!-- {{text: Describe the configuration differences across environments (local/staging/production).}} -->
|
|
107
80
|
|
|
108
|
-
|
|
81
|
+
`sdd-forge` is a local developer CLI tool and does not have traditional deployment environments (staging, production). Configuration is driven entirely by `.sdd-forge/config.json` in each project's working directory.
|
|
109
82
|
|
|
110
|
-
|
|
83
|
+
| Aspect | Local Development | CI / Automated Pipeline |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| Agent invocation | Interactive; supports streaming output callbacks for live feedback | Non-interactive; `callAgentAsync()` with `stdin: "ignore"` to prevent hangs |
|
|
86
|
+
| `CLAUDECODE` env var | May be set if running inside Claude Code | Must be unset before spawning AI agent subprocess (handled automatically by `agent.js`) |
|
|
87
|
+
| Project context | Resolved via `.sdd-forge/projects.json` `default` entry or `--project` flag | Set explicitly via `SDD_SOURCE_ROOT` and `SDD_WORK_ROOT` environment variables |
|
|
88
|
+
| AI agent timeout | Defaults: 120 s / 180 s / 300 s depending on command | Same defaults apply; increase via `config.limits.designTimeoutMs` if needed |
|
|
89
|
+
| Concurrency | Default 5 parallel file processes; tunable via `config.limits.concurrency` | Same; reduce if CPU-constrained in CI runners |
|
|
90
|
+
| Output language | Controlled by `config.output.default` and `config.lang` | Same; no environment-specific overrides exist |
|