You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add PRD §0.13-0.14: section variants and enhanced scan (#20)
Introduces two new PRD sections covering paired/grouped section
variants (colon syntax ID=group:variant) and enhanced scan capabilities
including variant-aware output, --check validation, and --pair
enforcement. These features are scoped to Phase 3.
Solo sections (`ID=foo`) toggle a single block on or off. **Variants** extend this by linking multiple sections under a shared group — toggling one variant on simultaneously toggles its siblings off. The primary use case is swapping between two alternative implementations (e.g., dev vs prod config, SQLite vs Postgres backend).
202
+
203
+
### 0.13.2 Marker Syntax
204
+
205
+
Variants use a **colon separator** in the section ID: `group:variant`.
|`-S db` (group, no variant) | 3+ |**Error** — `"group 'db' has N variants; specify one with -S db:<name>"`|
232
+
|`-S db:postgres`| any |**Activate** — uncomment `db:postgres`, comment all other `db:*` variants |
233
+
|`-S db --force on`| any |**Force all** — comment every `db:*` variant |
234
+
|`-S db --force off`| any |**Force all** — uncomment every `db:*` variant |
235
+
236
+
### 0.13.4 `--pair` Enforcement Flag
237
+
238
+
The `--pair` flag is a **pre-execution validation guard**. When supplied, the tool scans for all variants in the targeted group and errors if the count is not exactly 2. No file modifications occur on failure.
239
+
240
+
```bash
241
+
# Succeeds — db has exactly 2 variants
242
+
toggle -S db --pair myfile.py
243
+
244
+
# Errors before any changes
245
+
# Error: --pair: group 'db' has 3 variants, expected exactly 2
246
+
toggle -S db --pair myfile.py
247
+
```
248
+
249
+
`--pair` is optional. Without it, a group of 2 still flips via `-S <group>`. The flag adds an explicit guardrail for cases where the pairing contract must be enforced.
250
+
251
+
| Flag | Type | Description |
252
+
|---|---|---|
253
+
|`--pair`|`bool`| Enforce exactly 2 variants in the targeted group. Error otherwise. |
254
+
255
+
### 0.13.5 Multi-File Variant Toggling
256
+
257
+
Variants work across files with `-R` (recursive) or multi-path arguments. The tool collects all occurrences of the group's variants across all targeted files and applies the toggle atomically.
258
+
259
+
```bash
260
+
# Flip db pair across entire src/ tree
261
+
toggle -S db --pair -R src/
262
+
263
+
# Activate postgres everywhere
264
+
toggle -S db:postgres -R src/
265
+
```
266
+
267
+
Cross-file consistency: all files should contain the same set of variants for a given group. Mismatches are reported as warnings (or errors with `--check`).
268
+
269
+
---
270
+
271
+
## 0.14 Section Scan Enhancements
272
+
273
+
### 0.14.1 Variant-Aware Scan Output
274
+
275
+
The existing `--scan` flag is extended to understand variant groups. Output groups variants under their parent group.
0 commit comments