Skip to content

Commit 287337b

Browse files
committed
docs: fix --output flag description to match actual behavior
- --output accepts full file path, format auto-detected from extension - --output-dir for directory-only (uses default filename) - Copilot's assumption was incorrect for this implementation Signed-off-by: spencercjh <spencercjh@gmail.com>
1 parent 6bd896d commit 287337b

5 files changed

Lines changed: 53 additions & 31 deletions

File tree

README.zh_CN.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ LLM **从不** 虚构类型或改变结构 —— 它只为我们已经验证存
159159
160160
## 配置
161161
162-
在项目根目录创建 `.spec-forge.yaml`:
162+
在当前工作目录创建 `.spec-forge.yaml`:
163163
164164
```yaml
165165
enrich:
@@ -173,10 +173,12 @@ output:
173173
format: yaml
174174
```
175175

176-
**注意:** AI 增强需要通过环境变量提供 API 密钥:
177-
- OpenAI: `OPENAI_API_KEY`
178-
- Anthropic: `ANTHROPIC_API_KEY`
179-
- 自定义提供商: `LLM_API_KEY`(或在 `apiKeyEnv` 中配置的变量)
176+
**注意:**
177+
- AI 增强需要通过环境变量提供 API 密钥:
178+
- OpenAI: `OPENAI_API_KEY`
179+
- Anthropic: `ANTHROPIC_API_KEY`
180+
- 自定义提供商: `LLM_API_KEY`
181+
- 配置文件只在当前工作目录读取,不会自动读取项目目录。如果在其他目录运行 `spec-forge generate ./path/to/project`,请确保配置文件在当前目录。
180182

181183
查看 [.spec-forge.example.yaml](.spec-forge.example.yaml) 了解所有选项。
182184

docs/ai-enrichment.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,10 @@ Use `--no-stream` for concurrent processing:
264264
spec-forge enrich ./openapi.json --no-stream
265265
```
266266

267-
Or increase concurrency:
267+
Or increase concurrency (CLI flag only):
268268

269-
```yaml
270-
enrich:
271-
concurrency: 10
269+
```bash
270+
spec-forge enrich ./openapi.json --no-stream --concurrency 10
272271
```
273272

274273
### Poor quality descriptions
@@ -279,7 +278,7 @@ enrich:
279278

280279
### Rate limiting
281280

282-
- Reduce concurrency: `enrich.concurrency: 3`
281+
- Reduce concurrency: use `--concurrency 3` flag
283282
- Add delays between batches (not directly supported, use smaller specs)
284283
- Consider upgrading your API plan
285284

docs/configuration.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ Complete reference for `.spec-forge.yaml` configuration.
44

55
## Configuration File Location
66

7-
Spec Forge looks for `.spec-forge.yaml` in:
7+
Spec Forge looks for `.spec-forge.yaml` in the current working directory only.
88

9-
1. Current working directory
10-
2. Project directory (when using `spec-forge generate ./project`)
9+
**Note:** If you run `spec-forge generate ./path/to/project`, the config file must be in your current directory, not in `./path/to/project`. Use `--config /path/to/.spec-forge.yaml` to specify a custom location.
1110

1211
## Configuration Priority
1312

@@ -126,14 +125,15 @@ CLI equivalent: `--custom-base-url`
126125

127126
### `enrich.apiKeyEnv`
128127

129-
Environment variable containing the API key.
128+
Environment variable containing the API key. **Only used for `custom` provider.**
130129

131130
```yaml
132131
enrich:
133-
apiKeyEnv: LLM_API_KEY
132+
provider: custom
133+
apiKeyEnv: MY_API_KEY
134134
```
135135

136-
Default: `LLM_API_KEY` for custom, `OPENAI_API_KEY` for OpenAI, etc.
136+
**Note:** For OpenAI and Anthropic providers, API keys are always read from `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` respectively. The `apiKeyEnv` setting only applies to custom providers.
137137

138138
### `enrich.language`
139139

@@ -174,7 +174,7 @@ output:
174174

175175
Default: Current directory
176176

177-
CLI equivalent: `--output` (accepts file or directory)
177+
CLI equivalent: `--output-dir` for directory, `--output` for full file path
178178

179179
### `output.format`
180180

@@ -309,21 +309,23 @@ enrich:
309309
enabled: true
310310
provider: openai
311311
model: gpt-4o
312-
apiKeyEnv: OPENAI_API_KEY
313312
language: en
314313
```
315314

315+
**Note:** Requires `OPENAI_API_KEY` environment variable.
316+
316317
### Anthropic
317318

318319
```yaml
319320
enrich:
320321
enabled: true
321322
provider: anthropic
322323
model: claude-3-sonnet-20240229
323-
apiKeyEnv: ANTHROPIC_API_KEY
324324
language: en
325325
```
326326

327+
**Note:** Requires `ANTHROPIC_API_KEY` environment variable.
328+
327329
### Ollama (Local)
328330

329331
```yaml

docs/publishing.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ Guide to publishing OpenAPI specs to documentation platforms.
1818
The default output is a local file.
1919

2020
```bash
21-
# Default output: ./openapi.yaml
21+
# Default output
2222
spec-forge generate ./project
2323

24-
# Custom output path
24+
# Custom output path (format auto-detected from extension)
2525
spec-forge generate ./project --output ./docs/api.yaml
26-
27-
# JSON format
2826
spec-forge generate ./project --output ./api.json
27+
28+
# Custom output directory (uses default filename)
29+
spec-forge generate ./project --output-dir ./docs
2930
```
3031

3132
---
@@ -181,9 +182,11 @@ enrich:
181182
✅ Good:
182183
183184
```yaml
184-
# .spec-forge.yaml
185+
# .spec-forge.yaml - No API keys here!
185186
enrich:
186-
apiKeyEnv: OPENAI_API_KEY
187+
enabled: true
188+
provider: openai
189+
model: gpt-4o
187190
```
188191
189192
```bash
@@ -193,16 +196,26 @@ spec-forge generate ./
193196

194197
### Use Environment Variables
195198

196-
All sensitive values support `*Env` variants:
199+
Keep API keys in environment variables, never in config files:
197200

198201
```yaml
202+
# .spec-forge.yaml - Safe: no API keys
199203
enrich:
200-
apiKeyEnv: OPENAI_API_KEY # Instead of apiKey
204+
enabled: true
205+
provider: openai
206+
model: gpt-4o
207+
```
201208
202-
readme:
203-
# No slug here, pass via CLI or keep in CI secrets
209+
```bash
210+
# Set environment variable
211+
export OPENAI_API_KEY="sk-xxx"
212+
213+
# Run spec-forge
214+
spec-forge generate ./
204215
```
205216

217+
**Note:** For OpenAI and Anthropic, API keys are always read from `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` respectively. For custom providers, use `LLM_API_KEY` or set `apiKeyEnv` in config.
218+
206219
### CI/CD Secrets
207220

208221
Store in your CI system's secret management:

docs/quick-start.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Requirements:
109109

110110
## Configuration
111111

112-
Create `.spec-forge.yaml` in your project root:
112+
Create `.spec-forge.yaml` in your **current working directory**:
113113

114114
```yaml
115115
# AI Enrichment
@@ -127,6 +127,8 @@ output:
127127
format: yaml # yaml or json
128128
```
129129
130+
**Important:** Spec Forge reads `.spec-forge.yaml` from the current working directory, not the project directory. If you run `spec-forge generate ./path/to/project`, ensure the config file is in your current directory, not `./path/to/project`.
131+
130132
**Priority:** CLI flags > Environment variables > Config file > Defaults
131133

132134
---
@@ -145,8 +147,12 @@ spec-forge generate ./project --language zh
145147
# Disable enrichment
146148
spec-forge generate ./project --language zh --skip-enrich
147149
148-
# Custom output
150+
# Custom output path (format auto-detected from extension)
149151
spec-forge generate ./project --output ./specs/api.yaml
152+
spec-forge generate ./project --output ./specs/api.json
153+
154+
# Custom output directory (uses default filename)
155+
spec-forge generate ./project --output-dir ./specs
150156
151157
# Verbose logging
152158
spec-forge generate ./project -v

0 commit comments

Comments
 (0)