sdd-forge 0.1.0-alpha.24 → 0.1.0-alpha.26
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 +24 -24
- package/docs/01_overview.md +78 -53
- package/docs/02_cli_commands.md +34 -34
- package/docs/03_configuration.md +45 -42
- package/docs/04_internal_design.md +206 -145
- package/docs/ja/01_overview.md +114 -0
- package/docs/ja/02_cli_commands.md +270 -0
- package/docs/ja/03_configuration.md +136 -0
- package/docs/ja/04_internal_design.md +261 -0
- package/docs/ja/README.md +160 -0
- package/package.json +1 -1
- package/src/docs/lib/directive-parser.js +2 -2
package/README.md
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/sdd-forge)
|
|
4
4
|
|
|
5
|
-
> **Alpha:** This tool is currently in alpha.
|
|
5
|
+
> **Alpha:** This tool is currently in alpha. APIs, command structure, and configuration formats may change without notice. Not recommended for production use.
|
|
6
6
|
|
|
7
|
-
**A CLI tool that automatically generates and maintains project documentation
|
|
7
|
+
**A CLI tool that automatically generates and maintains project documentation via source code analysis + AI.**
|
|
8
8
|
|
|
9
9
|
Statically analyzes your codebase and combines templates with AI to auto-generate `docs/`.
|
|
10
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
|
-
- **Zero dependencies** — Runs on Node.js 18+ only. No npm
|
|
15
|
-
- **Automatic source
|
|
16
|
-
- **AI document generation** — AI automatically expands `{{text}}` directives in templates
|
|
17
|
-
- **Template inheritance** — Four-layer inheritance (base → arch → preset → project-local) for
|
|
18
|
-
- **SDD workflow** — Manage the
|
|
19
|
-
- **
|
|
20
|
-
- **AI agent integration** —
|
|
21
|
-
- **Multi-preset** — Supports Node.js CLI / CakePHP2 / Laravel / Symfony
|
|
14
|
+
- **Zero dependencies** — Runs on Node.js 18+ only. No npm packages required
|
|
15
|
+
- **Automatic source 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 full customization
|
|
18
|
+
- **SDD workflow** — Manage the spec → gate → implement → forge → review development cycle with commands
|
|
19
|
+
- **Multi-language support** — Auto-generate documentation in multiple languages via translate / generate modes
|
|
20
|
+
- **AI agent integration** — Supports Claude Code (skills) and Codex CLI
|
|
21
|
+
- **Multi-preset** — Supports Node.js CLI / CakePHP2 / Laravel / Symfony
|
|
22
22
|
|
|
23
23
|
## Quick Start
|
|
24
24
|
|
|
@@ -41,13 +41,13 @@ pnpm add -g {{data: project.name("")}}sdd-forge{{/data}}
|
|
|
41
41
|
# 1. Register your project (interactive wizard)
|
|
42
42
|
{{data: project.name("")}}sdd-forge{{/data}} setup
|
|
43
43
|
|
|
44
|
-
# 2. Generate all documentation
|
|
44
|
+
# 2. Generate all documentation (scan → init → data → text → readme → agents → translate)
|
|
45
45
|
{{data: project.name("")}}sdd-forge{{/data}} build
|
|
46
46
|
</pre>
|
|
47
47
|
|
|
48
|
-
This
|
|
48
|
+
This generates `docs/` and `README.md` in one step.
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## Commands
|
|
51
51
|
|
|
52
52
|
### Document Generation
|
|
53
53
|
|
|
@@ -57,12 +57,12 @@ This is all it takes to generate `docs/` and `README.md`.
|
|
|
57
57
|
| `build` | Run the full document generation pipeline |
|
|
58
58
|
| `scan` | Analyze source code → `analysis.json` |
|
|
59
59
|
| `init` | Initialize `docs/` from templates |
|
|
60
|
-
| `data` | Resolve `{{data}}` directives with
|
|
60
|
+
| `data` | Resolve `{{data}}` directives with analysis data |
|
|
61
61
|
| `text` | Resolve `{{text}}` directives with AI |
|
|
62
62
|
| `readme` | Auto-generate `README.md` from `docs/` |
|
|
63
63
|
| `forge` | Iteratively improve documentation with AI |
|
|
64
64
|
| `review` | Check documentation quality |
|
|
65
|
-
| `translate` |
|
|
65
|
+
| `translate` | Multi-language translation (default language → others) |
|
|
66
66
|
| `upgrade` | Update preset templates to the latest version |
|
|
67
67
|
|
|
68
68
|
### SDD Workflow
|
|
@@ -81,16 +81,16 @@ This is all it takes to generate `docs/` and `README.md`.
|
|
|
81
81
|
|---|---|
|
|
82
82
|
| `default` | Set the default project |
|
|
83
83
|
| `presets` | List available presets |
|
|
84
|
-
| `help` |
|
|
84
|
+
| `help` | Display command list |
|
|
85
85
|
|
|
86
86
|
## SDD Workflow
|
|
87
87
|
|
|
88
|
-
The
|
|
88
|
+
The feature addition / change flow:
|
|
89
89
|
|
|
90
90
|
```
|
|
91
|
-
spec Create
|
|
91
|
+
spec Create spec (feature branch + spec.md)
|
|
92
92
|
↓
|
|
93
|
-
gate Spec gate check (PASS when no
|
|
93
|
+
gate Spec gate check (PASS when no open questions)
|
|
94
94
|
↓
|
|
95
95
|
implement Write code after gate PASS
|
|
96
96
|
↓
|
|
@@ -112,7 +112,7 @@ Run the SDD workflow with skills:
|
|
|
112
112
|
|
|
113
113
|
#### Codex CLI
|
|
114
114
|
|
|
115
|
-
Run the workflow from
|
|
115
|
+
Run the workflow from prompts:
|
|
116
116
|
|
|
117
117
|
```
|
|
118
118
|
$sdd-flow-start — Start spec creation → gate → implementation
|
|
@@ -121,7 +121,7 @@ $sdd-flow-close — Finish with forge → review → commit → merge
|
|
|
121
121
|
|
|
122
122
|
## Configuration
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
`sdd-forge setup` generates `.sdd-forge/config.json`.
|
|
125
125
|
|
|
126
126
|
```jsonc
|
|
127
127
|
{
|
|
@@ -149,9 +149,9 @@ You can add project-specific templates and data sources:
|
|
|
149
149
|
<!-- {{data: docs.chapters("Chapter|Overview")}} -->
|
|
150
150
|
| Chapter | Overview |
|
|
151
151
|
| --- | --- |
|
|
152
|
-
| [01. System Overview](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/01_overview.md) | This chapter provides a
|
|
153
|
-
| [02. CLI Command Reference](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/02_cli_commands.md) | This chapter
|
|
154
|
-
| [03. Configuration and Customization](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/03_configuration.md) | This chapter covers
|
|
152
|
+
| [01. System Overview](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/01_overview.md) | This chapter provides a structural overview of sdd-forge, a Node.js CLI tool that automates documentation generation … |
|
|
153
|
+
| [02. CLI Command Reference](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/02_cli_commands.md) | This chapter covers all 18 subcommands available in `sdd-forge`, organized into documentation generation commands (ro… |
|
|
154
|
+
| [03. Configuration and Customization](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/03_configuration.md) | This chapter covers all configuration files used by sdd-forge, the full range of options available in `.sdd-forge/con… |
|
|
155
155
|
| [04. Internal Design](https://github.com/SpreadWorks/sdd-forge/blob/main/docs/04_internal_design.md) | |
|
|
156
156
|
<!-- {{/data}} -->
|
|
157
157
|
|
package/docs/01_overview.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
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
|
-
This chapter provides a
|
|
7
|
+
This chapter provides a structural overview 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 follows a three-layer command dispatch architecture and integrates with external AI agents (such as Claude CLI) to generate and refine documentation text.
|
|
8
8
|
|
|
9
9
|
## Content
|
|
10
10
|
|
|
@@ -14,35 +14,61 @@ This chapter provides a high-level view of `sdd-forge`, a Node.js CLI tool that
|
|
|
14
14
|
|
|
15
15
|
```mermaid
|
|
16
16
|
flowchart TD
|
|
17
|
-
User
|
|
18
|
-
|
|
19
|
-
Entry
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
User["User (CLI)"]
|
|
18
|
+
|
|
19
|
+
subgraph Entry["Entry Layer"]
|
|
20
|
+
SDF["sdd-forge.js\n(Entry Point)"]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
subgraph Dispatch["Dispatcher Layer"]
|
|
24
|
+
DOCS["docs.js"]
|
|
25
|
+
SPEC["spec.js"]
|
|
26
|
+
FLOW["flow.js"]
|
|
27
|
+
HELP["help.js"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
subgraph Commands["Command Layer"]
|
|
31
|
+
SCAN["scan"]
|
|
32
|
+
DATA["data"]
|
|
33
|
+
TEXT["text"]
|
|
34
|
+
FORGE["forge"]
|
|
35
|
+
REVIEW["review"]
|
|
36
|
+
SPEC_INIT["spec init"]
|
|
37
|
+
GATE["gate"]
|
|
38
|
+
OTHER["readme / agents / changelog / …"]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
subgraph Lib["Core Libraries"]
|
|
42
|
+
AGENT["agent.js\n(AI Agent Caller)"]
|
|
43
|
+
CONFIG["config.js\n(Config & Paths)"]
|
|
44
|
+
SCANNER["scanner.js\n(Source Analyzer)"]
|
|
45
|
+
PARSER["directive-parser.js"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
subgraph Storage["File System"]
|
|
49
|
+
SRC["Source Code\n(project root)"]
|
|
50
|
+
ANALYSIS[".sdd-forge/output/\nanalysis.json / summary.json"]
|
|
51
|
+
DOCFILES["docs/*.md\n(generated docs)"]
|
|
52
|
+
SPECS["specs/NNN-xxx/spec.md"]
|
|
53
|
+
CFGFILE[".sdd-forge/config.json"]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
AI["External AI Agent\n(e.g. Claude CLI)"]
|
|
57
|
+
|
|
58
|
+
User --> SDF
|
|
59
|
+
SDF --> DOCS & SPEC & FLOW & HELP
|
|
60
|
+
DOCS --> SCAN & DATA & TEXT & FORGE & REVIEW & OTHER
|
|
61
|
+
SPEC --> SPEC_INIT & GATE
|
|
62
|
+
SCAN --> SCANNER --> SRC
|
|
63
|
+
SCANNER --> ANALYSIS
|
|
64
|
+
DATA --> PARSER --> DOCFILES
|
|
65
|
+
TEXT --> AGENT --> AI
|
|
66
|
+
FORGE --> AGENT
|
|
67
|
+
REVIEW --> AGENT
|
|
68
|
+
AGENT --> DOCFILES
|
|
69
|
+
CONFIG --> CFGFILE
|
|
70
|
+
SPEC_INIT --> SPECS
|
|
71
|
+
GATE --> SPECS
|
|
46
72
|
```
|
|
47
73
|
|
|
48
74
|
### Component Responsibilities
|
|
@@ -51,17 +77,17 @@ flowchart TD
|
|
|
51
77
|
|
|
52
78
|
| Component | Location | Responsibility | Input | Output |
|
|
53
79
|
|---|---|---|---|---|
|
|
54
|
-
| CLI Entry Point | `src/sdd-forge.js` |
|
|
55
|
-
| Docs Dispatcher | `src/docs.js` | Routes
|
|
56
|
-
| Spec Dispatcher | `src/spec.js` | Routes spec
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
80
|
+
| CLI Entry Point | `src/sdd-forge.js` | Resolves project context; routes subcommands to the appropriate dispatcher | CLI arguments, env vars (`SDD_SOURCE_ROOT`, `SDD_WORK_ROOT`) | Dispatched command execution |
|
|
81
|
+
| Docs Dispatcher | `src/docs.js` | Routes `build`, `scan`, `init`, `data`, `text`, `forge`, `review`, and related subcommands | Subcommand name + flags | Delegates to `docs/commands/*.js` |
|
|
82
|
+
| Spec Dispatcher | `src/spec.js` | Routes `spec` and `gate` subcommands | Subcommand name + flags | Delegates to `specs/commands/*.js` |
|
|
83
|
+
| SDD Flow Runner | `src/flow.js` | Automates the full SDD cycle end-to-end | `--request` prompt string | Orchestrated spec → gate → implement → forge → review sequence |
|
|
84
|
+
| Source Scanner | `src/docs/lib/scanner.js` | Parses project source files; extracts modules, routes, and structure | Source root directory | `.sdd-forge/output/analysis.json`, `summary.json` |
|
|
85
|
+
| Directive Parser | `src/docs/lib/directive-parser.js` | Parses `{{data}}` and `{{text}}` directives in Markdown templates | `.md` template files | Directive AST for resolvers |
|
|
86
|
+
| Data Resolver | `src/docs/lib/resolver-factory.js` | Injects structured analysis data into `{{data}}` directives | `analysis.json`, directive AST | Resolved Markdown sections |
|
|
87
|
+
| AI Agent Caller | `src/lib/agent.js` | Invokes external AI agent processes synchronously or asynchronously | Prompt string, agent config | AI-generated text (stdout) |
|
|
88
|
+
| Config Manager | `src/lib/config.js` | Loads and validates `.sdd-forge/config.json`; resolves standard paths | `.sdd-forge/` directory | Typed config object, file paths |
|
|
89
|
+
| Spec Gate | `src/specs/commands/gate.js` | Validates a spec against pre/post implementation checklists | `spec.md` path, `--phase` flag | PASS / FAIL report |
|
|
90
|
+
| Forge Engine | `src/docs/commands/forge.js` | Iteratively improves `docs/` by prompting the AI agent | Change summary prompt, `spec.md` path | Updated `docs/*.md` files |
|
|
65
91
|
|
|
66
92
|
### External Integrations
|
|
67
93
|
|
|
@@ -69,22 +95,21 @@ flowchart TD
|
|
|
69
95
|
|
|
70
96
|
| System | Purpose | Connection Method | Configuration |
|
|
71
97
|
|---|---|---|---|
|
|
72
|
-
| AI Agent (e.g. Claude CLI) | Generates and refines documentation text
|
|
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 |
|
|
98
|
+
| AI Agent (e.g. Claude CLI) | Generates and refines documentation text for `{{text}}` directives; drives `forge`, `review`, `agents`, and `text` commands | Spawned as a child process via `execFileSync` (sync) or `spawn` (async streaming) in `src/lib/agent.js` | Defined under `providers` in `.sdd-forge/config.json`; selected by `defaultAgent` key |
|
|
74
99
|
|
|
75
|
-
|
|
100
|
+
The AI agent is the only external integration. All other operations — file scanning, directive parsing, template merging, spec management — rely exclusively on Node.js built-in modules (`fs`, `path`, `child_process`, `os`). The agent command, arguments, timeout, and system-prompt delivery method (`--system-prompt` or `--system-prompt-file`) are all configurable per project.
|
|
76
101
|
|
|
77
102
|
### Environment Differences
|
|
78
103
|
|
|
79
104
|
<!-- {{text: Describe the configuration differences across environments (local/staging/production).}} -->
|
|
80
105
|
|
|
81
|
-
|
|
106
|
+
As a local CLI tool, sdd-forge does not have distinct deployment environments in the traditional sense. Configuration differences are instead expressed through per-project `.sdd-forge/config.json` settings and environment variables.
|
|
82
107
|
|
|
83
|
-
| Aspect | Local Development | CI / Automated Pipeline |
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
108
|
+
| Aspect | Local Development | CI / Automated Pipeline | Multi-Project Setup |
|
|
109
|
+
|---|---|---|---|
|
|
110
|
+
| Project resolution | Interactive; `--project` flag or `.sdd-forge/projects.json` `default` key | `SDD_SOURCE_ROOT` and `SDD_WORK_ROOT` env vars set explicitly per job | `.sdd-forge/projects.json` registers named projects; `--project <name>` selects the target |
|
|
111
|
+
| AI agent | Configured via `providers` + `defaultAgent` in `config.json`; runs interactively | Same config; `stdin: "ignore"` prevents CLI hang in non-TTY environments (`callAgentAsync`) | Each project carries its own `config.json` with independent agent settings |
|
|
112
|
+
| Language / output | `lang` and `output.languages` control CLI language and doc output locale | Same config values apply; no separate override mechanism | Per-project `config.json` allows different languages per project |
|
|
113
|
+
| Concurrency | `limits.concurrency` (default: 5) controls parallel file processing | Can be raised for faster execution on high-core machines | Independently tunable per project |
|
|
114
|
+
| Timeouts | `limits.designTimeoutMs` / per-provider `timeoutMs` | Should be increased for slow CI agents; default constants: 120 s / 180 s / 300 s | Configurable per project |
|
|
115
|
+
```
|
package/docs/02_cli_commands.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<!-- {{text: Write a 1–2 sentence overview of this chapter. Cover the total number of commands, whether global options exist, and the subcommand structure.}} -->
|
|
6
6
|
|
|
7
|
-
This chapter
|
|
7
|
+
This chapter covers all 18 subcommands available in `sdd-forge`, organized into documentation generation commands (routed through `docs.js`), spec workflow commands (routed through `spec.js`), and directly executed commands (`flow`, `presets`). All commands share a common set of global options, and most require a resolved project context before execution.
|
|
8
8
|
|
|
9
9
|
## Contents
|
|
10
10
|
|
|
@@ -14,42 +14,44 @@ This chapter documents all 17 subcommands available in `sdd-forge`, organized ac
|
|
|
14
14
|
|
|
15
15
|
| Command | Description | Key Options |
|
|
16
16
|
|---|---|---|
|
|
17
|
-
| `build` |
|
|
18
|
-
| `scan` |
|
|
19
|
-
| `init` |
|
|
20
|
-
| `data` |
|
|
21
|
-
| `text` |
|
|
22
|
-
| `readme` | Auto-
|
|
23
|
-
| `forge` | Iteratively
|
|
24
|
-
| `review` |
|
|
25
|
-
| `changelog` |
|
|
26
|
-
| `agents` |
|
|
27
|
-
| `translate` |
|
|
28
|
-
| `upgrade` |
|
|
29
|
-
| `setup` |
|
|
30
|
-
| `default` |
|
|
31
|
-
| `spec` |
|
|
32
|
-
| `gate` |
|
|
33
|
-
| `flow` |
|
|
34
|
-
| `presets` |
|
|
35
|
-
| `help` |
|
|
17
|
+
| `build` | Runs the full documentation pipeline (`scan → init → data → text → readme → agents → translate`) in one step | `--project` |
|
|
18
|
+
| `scan` | Analyzes source code and writes `analysis.json` and `summary.json` | `--project` |
|
|
19
|
+
| `init` | Initializes `docs/` from preset templates | `--project` |
|
|
20
|
+
| `data` | Resolves `{{data: ...}}` directives using analysis output | `--project` |
|
|
21
|
+
| `text` | Resolves `{{text: ...}}` directives using the configured AI agent | `--file`, `--agent`, `--project` |
|
|
22
|
+
| `readme` | Auto-generates `README.md` from docs content via AI | `--project` |
|
|
23
|
+
| `forge` | Iteratively improves docs using AI, guided by a prompt | `--prompt`, `--spec`, `--project` |
|
|
24
|
+
| `review` | Runs an AI quality check on docs and reports PASS/FAIL | `--project` |
|
|
25
|
+
| `changelog` | Generates `change_log.md` from all spec files under `specs/` | `--project` |
|
|
26
|
+
| `agents` | Updates `AGENTS.md` with the latest SDD template and PROJECT section | `--sdd`, `--project-only`, `--dry-run` |
|
|
27
|
+
| `translate` | Translates docs into additional output languages defined in config | `--lang`, `--force`, `--dry-run` |
|
|
28
|
+
| `upgrade` | Updates SDD-managed template sections to match the installed package version | `--project` |
|
|
29
|
+
| `setup` | Registers a project and generates initial `.sdd-forge/config.json` | — |
|
|
30
|
+
| `default` | Sets or displays the default project in `projects.json` | — |
|
|
31
|
+
| `spec` | Creates a new spec file and optionally a feature branch | `--title`, `--no-branch` |
|
|
32
|
+
| `gate` | Validates a spec against acceptance criteria before or after implementation | `--spec`, `--phase` |
|
|
33
|
+
| `flow` | Automates the full SDD flow from a natural-language request | `--request` |
|
|
34
|
+
| `presets` | Lists all bundled project type presets | — |
|
|
35
|
+
| `help` | Displays available subcommands and descriptions | `-h`, `--help` |
|
|
36
36
|
|
|
37
37
|
### Global Options
|
|
38
38
|
|
|
39
39
|
<!-- {{text: List global options common to all commands in a table format. Include --project, --help/-h, and --version/-v/-V. Also note that setup, default, help, and presets skip project context resolution.}} -->
|
|
40
40
|
|
|
41
|
-
| Option |
|
|
41
|
+
| Option | Aliases | Description |
|
|
42
42
|
|---|---|---|
|
|
43
|
-
| `--project <name>` | — |
|
|
44
|
-
| `--help` | `-h` |
|
|
45
|
-
| `--version` | `-v`, `-V` |
|
|
43
|
+
| `--project <name>` | — | Specifies the target project by name, as registered in `.sdd-forge/projects.json`. When omitted, the project marked as `default` in `projects.json` is used. |
|
|
44
|
+
| `--help` | `-h` | Prints the help text for the given subcommand and exits. |
|
|
45
|
+
| `--version` | `-v`, `-V` | Prints the current `sdd-forge` version from `package.json` and exits. |
|
|
46
46
|
|
|
47
|
-
> **Note:** The `setup`, `default`, `help`, and `presets`
|
|
47
|
+
> **Note:** The `setup`, `default`, `help`, and `presets` commands skip project context resolution entirely. They do not require a registered project and ignore the `--project` flag.
|
|
48
48
|
|
|
49
49
|
### Command Details
|
|
50
50
|
|
|
51
51
|
<!-- {{text: Describe the usage, options, and examples for each command in detail. Create a #### subsection for each command. For the build pipeline, list all steps: scan → init → data → text → readme → agents → translate. The translate command has --lang, --force, and --dry-run options.}} -->
|
|
52
52
|
|
|
53
|
+
Each command below is documented with its purpose, available options, and representative usage examples. Commands that involve AI generation require a valid `defaultAgent` or `providers` entry in `.sdd-forge/config.json`. Commands that modify files on disk always operate within the resolved project's `docs/` directory unless otherwise noted.
|
|
54
|
+
|
|
53
55
|
#### build
|
|
54
56
|
|
|
55
57
|
Runs the complete documentation generation pipeline in a single step. The pipeline executes the following stages in order: `scan → init → data → text → readme → agents → translate`. This is the standard entry point for first-time setup or full regeneration of project docs.
|
|
@@ -252,19 +254,17 @@ sdd-forge -h
|
|
|
252
254
|
|
|
253
255
|
<!-- {{text: Describe exit code definitions (0=success, 1=general error, etc.) and the rules for stdout/stderr usage in a table format. Include the fact that gate and review PASS/FAIL results are printed to stdout.}} -->
|
|
254
256
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
| Code | Meaning |
|
|
257
|
+
| Exit Code | Meaning |
|
|
258
258
|
|---|---|
|
|
259
259
|
| `0` | Command completed successfully |
|
|
260
|
-
| `1` | General error (
|
|
261
|
-
| `2` |
|
|
260
|
+
| `1` | General error (missing required option, file not found, configuration invalid, etc.) |
|
|
261
|
+
| `2` | Gate or review check failed (FAIL result reported; see stdout for details) |
|
|
262
262
|
|
|
263
|
-
**stdout / stderr
|
|
263
|
+
**stdout / stderr usage:**
|
|
264
264
|
|
|
265
265
|
| Stream | Content |
|
|
266
266
|
|---|---|
|
|
267
|
-
| `stdout` | Primary command output: generated text, rendered tables,
|
|
268
|
-
| `stderr` |
|
|
267
|
+
| `stdout` | Primary command output: generated text, rendered tables, PASS/FAIL results from `gate` and `review`, dry-run previews |
|
|
268
|
+
| `stderr` | Progress indicators, warnings, debug information, and error messages |
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
`gate` and `review` always print their PASS/FAIL verdict and per-item check results to **stdout**, making them suitable for capture in CI pipelines. Error messages describing why a command could not run (missing config, invalid arguments, etc.) are written to **stderr** and do not appear in captured stdout.
|
package/docs/03_configuration.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<!-- {{text: Describe the overview of this chapter in 1-2 sentences. Cover the types of configuration files, the range of configurable options, and customization points.}} -->
|
|
6
6
|
|
|
7
|
-
This chapter covers
|
|
7
|
+
This chapter covers all configuration files used by sdd-forge, the full range of options available in `.sdd-forge/config.json`, and the customization points for AI providers, document style, project type, merge strategy, and concurrency.
|
|
8
8
|
|
|
9
9
|
## Contents
|
|
10
10
|
|
|
@@ -12,41 +12,41 @@ This chapter covers the configuration files and customization options available
|
|
|
12
12
|
|
|
13
13
|
<!-- {{text: List all configuration files loaded by this tool in a table, including their locations and roles. Main files: .sdd-forge/config.json (project settings), .sdd-forge/context.json (project context), .sdd-forge/projects.json (multi-project management), .sdd-forge/current-spec (SDD flow state), .sdd-forge/output/analysis.json (analysis results), .sdd-forge/output/summary.json (lightweight version for AI).}} -->
|
|
14
14
|
|
|
15
|
-
All configuration and
|
|
15
|
+
All configuration and state files are stored under the `.sdd-forge/` directory at the working root of your project.
|
|
16
16
|
|
|
17
17
|
| File | Location | Role |
|
|
18
18
|
|---|---|---|
|
|
19
|
-
| `config.json` | `.sdd-forge/config.json` | Primary project configuration. Defines output languages, project type, AI
|
|
20
|
-
| `context.json` | `.sdd-forge/context.json` | Free-form project context string passed to AI
|
|
21
|
-
| `projects.json` | `.sdd-forge/projects.json` | Multi-project registry.
|
|
22
|
-
| `current-spec` | `.sdd-forge/current-spec` | JSON file tracking the active SDD flow state, including
|
|
23
|
-
| `analysis.json` | `.sdd-forge/output/analysis.json` | Full source code analysis result produced by `sdd-forge scan`. Stored
|
|
24
|
-
| `summary.json` | `.sdd-forge/output/summary.json` | Lightweight version of `analysis.json` optimized for AI
|
|
19
|
+
| `config.json` | `.sdd-forge/config.json` | Primary project configuration. Defines output languages, project type, AI agent settings, document style, and workflow options. Validated on load. |
|
|
20
|
+
| `context.json` | `.sdd-forge/context.json` | Free-form project context string passed to AI during text generation. Takes priority over `textFill.projectContext` in `config.json`. |
|
|
21
|
+
| `projects.json` | `.sdd-forge/projects.json` | Multi-project registry. Maps project names to their source and work root paths. Generated by `sdd-forge setup`. |
|
|
22
|
+
| `current-spec` | `.sdd-forge/current-spec` | JSON file tracking the active SDD flow state, including spec path, base branch, feature branch, and worktree information. Deleted on flow completion. |
|
|
23
|
+
| `analysis.json` | `.sdd-forge/output/analysis.json` | Full source code analysis result produced by `sdd-forge scan`. Stored without indentation for compact output. |
|
|
24
|
+
| `summary.json` | `.sdd-forge/output/summary.json` | Lightweight version of `analysis.json` optimized for AI consumption. Used in preference to `analysis.json` wherever available. |
|
|
25
25
|
|
|
26
26
|
### Configuration Reference
|
|
27
27
|
|
|
28
28
|
<!-- {{text: Describe all fields in .sdd-forge/config.json in a table format. Include field name, whether required, type, default value, and description. Main fields: output.languages (output language list), output.default (default language), output.mode (translate/generate), lang (CLI operating language), type (project type), documentStyle (purpose/tone/customInstruction), textFill (projectContext/preamblePatterns), defaultAgent, providers (AI agent definitions), flow.merge (squash/ff-only/merge), limits (concurrency/designTimeoutMs).}} -->
|
|
29
29
|
|
|
30
|
-
The
|
|
30
|
+
The table below describes every supported field in `.sdd-forge/config.json`.
|
|
31
31
|
|
|
32
32
|
| Field | Required | Type | Default | Description |
|
|
33
33
|
|---|---|---|---|---|
|
|
34
|
-
| `output.languages` | ✅ | `string[]` | — | List of output languages for generated
|
|
35
|
-
| `output.default` | ✅ | `string` | — | The primary language used when generating
|
|
36
|
-
| `output.mode` | — | `"translate"` \| `"generate"` | `"translate"` | How non-default languages are produced
|
|
37
|
-
| `lang` | ✅ | `string` | — | Operating language for the CLI, AGENTS.md, skill prompts, and spec files
|
|
38
|
-
| `type` | ✅ | `string` | — | Project type
|
|
39
|
-
| `uiLang` | — | `"en"` \| `"ja"` | — | Language
|
|
40
|
-
| `documentStyle.purpose` | — | `string` | — |
|
|
41
|
-
| `documentStyle.tone` | — | `"polite"` \| `"formal"` \| `"casual"` | — |
|
|
42
|
-
| `documentStyle.customInstruction` | — | `string` | — | Additional
|
|
43
|
-
| `textFill.projectContext` | — | `string` | — |
|
|
44
|
-
| `textFill.preamblePatterns` | — | `object[]` | — | Patterns used to strip
|
|
45
|
-
| `defaultAgent` | — | `string` | — |
|
|
46
|
-
| `providers` | — | `object` | — |
|
|
47
|
-
| `flow.merge` | — | `"squash"` \| `"ff-only"` \| `"merge"` | `"squash"` | Git merge strategy applied when closing an SDD flow
|
|
48
|
-
| `limits.concurrency` | — | `number` | `5` |
|
|
49
|
-
| `limits.designTimeoutMs` | — | `number` | — |
|
|
34
|
+
| `output.languages` | ✅ | `string[]` | — | List of output languages for generated docs (e.g., `["ja"]`, `["en", "ja"]`). |
|
|
35
|
+
| `output.default` | ✅ | `string` | — | The primary output language used when generating documents. |
|
|
36
|
+
| `output.mode` | — | `"translate"` \| `"generate"` | `"translate"` | How non-default languages are produced: `translate` uses the default output as source; `generate` calls AI independently. |
|
|
37
|
+
| `lang` | ✅ | `string` | — | Operating language for the CLI, AGENTS.md, skill prompts, and spec files. |
|
|
38
|
+
| `type` | ✅ | `string` | — | Project type that selects the active preset (e.g., `"cli/node-cli"`, `"webapp/cakephp2"`). |
|
|
39
|
+
| `uiLang` | — | `"en"` \| `"ja"` | — | Language for sdd-forge's own UI messages. |
|
|
40
|
+
| `documentStyle.purpose` | — | `string` | — | A short description of the document's intended audience or purpose, passed to AI during generation. |
|
|
41
|
+
| `documentStyle.tone` | — | `"polite"` \| `"formal"` \| `"casual"` | — | Writing tone applied to AI-generated text sections. |
|
|
42
|
+
| `documentStyle.customInstruction` | — | `string` | — | Additional freeform instruction appended to AI prompts for every text generation task. |
|
|
43
|
+
| `textFill.projectContext` | — | `string` | — | Project overview text supplied to AI. Overridden by `context.json` when that file exists. |
|
|
44
|
+
| `textFill.preamblePatterns` | — | `object[]` | — | Patterns used to strip LLM-generated preamble text from AI responses before inserting into docs. |
|
|
45
|
+
| `defaultAgent` | — | `string` | — | Name of the AI provider entry (from `providers`) used when no agent is explicitly specified. |
|
|
46
|
+
| `providers` | — | `object` | — | Map of named AI agent definitions. Each entry specifies `command`, `args`, optional `timeoutMs`, and `systemPromptFlag`. |
|
|
47
|
+
| `flow.merge` | — | `"squash"` \| `"ff-only"` \| `"merge"` | `"squash"` | Git merge strategy applied when closing an SDD flow. |
|
|
48
|
+
| `limits.concurrency` | — | `number` | `5` | Maximum number of files processed in parallel during document generation. |
|
|
49
|
+
| `limits.designTimeoutMs` | — | `number` | — | Timeout in milliseconds for AI agent calls during document generation. |
|
|
50
50
|
|
|
51
51
|
### Customization Points
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ The following table describes every supported field in `.sdd-forge/config.json`.
|
|
|
54
54
|
|
|
55
55
|
**1. AI Provider Settings**
|
|
56
56
|
|
|
57
|
-
The `providers` field
|
|
57
|
+
The `providers` field defines one or more named AI agents. Each entry specifies the executable command, argument list, an optional timeout, and how system prompts are passed. Use `defaultAgent` to select which provider is active by default.
|
|
58
58
|
|
|
59
59
|
```json
|
|
60
60
|
{
|
|
@@ -62,7 +62,7 @@ The `providers` field lets you register one or more AI agents and control how sd
|
|
|
62
62
|
"providers": {
|
|
63
63
|
"claude": {
|
|
64
64
|
"command": "claude",
|
|
65
|
-
"args": ["--model", "claude-opus-4-5", "
|
|
65
|
+
"args": ["--model", "claude-opus-4-5", "{{PROMPT}}"],
|
|
66
66
|
"timeoutMs": 180000,
|
|
67
67
|
"systemPromptFlag": "--system-prompt"
|
|
68
68
|
}
|
|
@@ -70,23 +70,25 @@ The `providers` field lets you register one or more AI agents and control how sd
|
|
|
70
70
|
}
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
The `{{PROMPT}}` placeholder in `args` marks where the generated prompt is injected. If omitted, the prompt is appended at the end of the argument list. Set `systemPromptFlag` to `"--system-prompt-file"` when the agent expects a file path rather than an inline string.
|
|
74
|
+
|
|
73
75
|
**2. Document Style**
|
|
74
76
|
|
|
75
|
-
The `documentStyle`
|
|
77
|
+
The `documentStyle` field controls the tone and purpose of AI-generated documentation. Use `customInstruction` to enforce project-specific writing conventions.
|
|
76
78
|
|
|
77
79
|
```json
|
|
78
80
|
{
|
|
79
81
|
"documentStyle": {
|
|
80
|
-
"purpose": "Internal reference for backend engineers
|
|
82
|
+
"purpose": "Internal reference for backend engineers",
|
|
81
83
|
"tone": "formal",
|
|
82
|
-
"customInstruction": "Always
|
|
84
|
+
"customInstruction": "Always include code examples for each API method."
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
**3. Preset Selection**
|
|
88
90
|
|
|
89
|
-
The `type` field selects the preset that determines which source files are scanned and which
|
|
91
|
+
The `type` field selects the preset that determines which source files are scanned and which document chapters are generated. Choose the value that best matches your project's architecture.
|
|
90
92
|
|
|
91
93
|
```json
|
|
92
94
|
{
|
|
@@ -94,11 +96,11 @@ The `type` field selects the preset that determines which source files are scann
|
|
|
94
96
|
}
|
|
95
97
|
```
|
|
96
98
|
|
|
97
|
-
Available
|
|
99
|
+
Available built-in values include `"cli/node-cli"`, `"webapp/cakephp2"`, `"webapp/laravel"`, and `"webapp/symfony"`. Refer to the preset list for the full set of supported aliases.
|
|
98
100
|
|
|
99
101
|
**4. Merge Strategy**
|
|
100
102
|
|
|
101
|
-
The `flow.merge` field controls how feature branches are
|
|
103
|
+
The `flow.merge` field controls how feature branches are merged into the base branch at the end of an SDD flow.
|
|
102
104
|
|
|
103
105
|
```json
|
|
104
106
|
{
|
|
@@ -108,14 +110,17 @@ The `flow.merge` field controls how feature branches are integrated into the bas
|
|
|
108
110
|
}
|
|
109
111
|
```
|
|
110
112
|
|
|
113
|
+
Use `"squash"` to condense all feature commits into one, `"ff-only"` for a linear history without a merge commit, or `"merge"` for a standard merge commit.
|
|
114
|
+
|
|
111
115
|
**5. Concurrency**
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
Adjust `limits.concurrency` to control how many files are processed in parallel during document generation. Lower this value if AI rate limits are being hit; raise it to speed up generation on large codebases.
|
|
114
118
|
|
|
115
119
|
```json
|
|
116
120
|
{
|
|
117
121
|
"limits": {
|
|
118
|
-
"concurrency":
|
|
122
|
+
"concurrency": 3,
|
|
123
|
+
"designTimeoutMs": 240000
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
```
|
|
@@ -124,10 +129,8 @@ The `limits.concurrency` field sets the number of source files processed in para
|
|
|
124
129
|
|
|
125
130
|
<!-- {{text: List the environment variables referenced by the tool and their purposes in a table. SDD_SOURCE_ROOT (source code root), SDD_WORK_ROOT (working root, location of .sdd-forge/), CLAUDECODE (internal variable removed to prevent Claude CLI hangs).}} -->
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
|
130
|
-
|
|
131
|
-
| `
|
|
132
|
-
| `SDD_WORK_ROOT` | Input | Absolute path to the working root — the directory that contains `.sdd-forge/`. When set, all config, output, and state files are read from and written to this location. |
|
|
133
|
-
| `CLAUDECODE` | Internal | An environment variable that sdd-forge actively **removes** before spawning AI agent processes. This prevents the Claude CLI from entering an interactive mode and hanging when standard input is closed. |
|
|
132
|
+
| Variable | Purpose |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `SDD_SOURCE_ROOT` | Absolute path to the source code root being analyzed. When set, overrides the path resolved from `git rev-parse` or the current working directory. |
|
|
135
|
+
| `SDD_WORK_ROOT` | Absolute path to the working root, i.e., the directory containing `.sdd-forge/`. When set, takes priority over the git-resolved root. |
|
|
136
|
+
| `CLAUDECODE` | An internal variable that sdd-forge actively removes from the environment before spawning AI agent processes. This prevents the Claude CLI from hanging when launched as a child process. |
|