specfact-cli 0.4.2__py3-none-any.whl → 0.6.8__py3-none-any.whl
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.
- specfact_cli/__init__.py +1 -1
- specfact_cli/agents/analyze_agent.py +2 -3
- specfact_cli/analyzers/__init__.py +2 -1
- specfact_cli/analyzers/ambiguity_scanner.py +601 -0
- specfact_cli/analyzers/code_analyzer.py +462 -30
- specfact_cli/analyzers/constitution_evidence_extractor.py +491 -0
- specfact_cli/analyzers/contract_extractor.py +419 -0
- specfact_cli/analyzers/control_flow_analyzer.py +281 -0
- specfact_cli/analyzers/requirement_extractor.py +337 -0
- specfact_cli/analyzers/test_pattern_extractor.py +330 -0
- specfact_cli/cli.py +151 -206
- specfact_cli/commands/constitution.py +281 -0
- specfact_cli/commands/enforce.py +42 -34
- specfact_cli/commands/import_cmd.py +481 -152
- specfact_cli/commands/init.py +224 -55
- specfact_cli/commands/plan.py +2133 -547
- specfact_cli/commands/repro.py +100 -78
- specfact_cli/commands/sync.py +701 -186
- specfact_cli/enrichers/constitution_enricher.py +765 -0
- specfact_cli/enrichers/plan_enricher.py +294 -0
- specfact_cli/importers/speckit_converter.py +364 -48
- specfact_cli/importers/speckit_scanner.py +65 -0
- specfact_cli/models/plan.py +42 -0
- specfact_cli/resources/mappings/node-async.yaml +49 -0
- specfact_cli/resources/mappings/python-async.yaml +47 -0
- specfact_cli/resources/mappings/speckit-default.yaml +82 -0
- specfact_cli/resources/prompts/specfact-enforce.md +185 -0
- specfact_cli/resources/prompts/specfact-import-from-code.md +626 -0
- specfact_cli/resources/prompts/specfact-plan-add-feature.md +188 -0
- specfact_cli/resources/prompts/specfact-plan-add-story.md +212 -0
- specfact_cli/resources/prompts/specfact-plan-compare.md +571 -0
- specfact_cli/resources/prompts/specfact-plan-init.md +531 -0
- specfact_cli/resources/prompts/specfact-plan-promote.md +352 -0
- specfact_cli/resources/prompts/specfact-plan-review.md +1276 -0
- specfact_cli/resources/prompts/specfact-plan-select.md +401 -0
- specfact_cli/resources/prompts/specfact-plan-update-feature.md +242 -0
- specfact_cli/resources/prompts/specfact-plan-update-idea.md +211 -0
- specfact_cli/resources/prompts/specfact-repro.md +268 -0
- specfact_cli/resources/prompts/specfact-sync.md +497 -0
- specfact_cli/resources/schemas/deviation.schema.json +61 -0
- specfact_cli/resources/schemas/plan.schema.json +204 -0
- specfact_cli/resources/schemas/protocol.schema.json +53 -0
- specfact_cli/resources/templates/github-action.yml.j2 +140 -0
- specfact_cli/resources/templates/plan.bundle.yaml.j2 +141 -0
- specfact_cli/resources/templates/pr-template.md.j2 +58 -0
- specfact_cli/resources/templates/protocol.yaml.j2 +24 -0
- specfact_cli/resources/templates/telemetry.yaml.example +35 -0
- specfact_cli/sync/__init__.py +10 -1
- specfact_cli/sync/watcher.py +268 -0
- specfact_cli/telemetry.py +440 -0
- specfact_cli/utils/acceptance_criteria.py +127 -0
- specfact_cli/utils/enrichment_parser.py +445 -0
- specfact_cli/utils/feature_keys.py +12 -3
- specfact_cli/utils/ide_setup.py +170 -0
- specfact_cli/utils/structure.py +179 -2
- specfact_cli/utils/yaml_utils.py +33 -0
- specfact_cli/validators/repro_checker.py +22 -1
- specfact_cli/validators/schema.py +15 -4
- specfact_cli-0.6.8.dist-info/METADATA +456 -0
- specfact_cli-0.6.8.dist-info/RECORD +99 -0
- {specfact_cli-0.4.2.dist-info → specfact_cli-0.6.8.dist-info}/entry_points.txt +1 -0
- specfact_cli-0.6.8.dist-info/licenses/LICENSE.md +202 -0
- specfact_cli-0.4.2.dist-info/METADATA +0 -370
- specfact_cli-0.4.2.dist-info/RECORD +0 -62
- specfact_cli-0.4.2.dist-info/licenses/LICENSE.md +0 -61
- {specfact_cli-0.4.2.dist-info → specfact_cli-0.6.8.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize a new development plan bundle with idea, product, and features structure.
|
|
3
|
+
---
|
|
4
|
+
# SpectFact Plan Init Command (greenfield & brownfield)
|
|
5
|
+
|
|
6
|
+
## User Input
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
$ARGUMENTS
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
13
|
+
|
|
14
|
+
## ⚠️ CRITICAL: CLI Usage Enforcement
|
|
15
|
+
|
|
16
|
+
**YOU MUST ALWAYS USE THE SPECFACT CLI**. Never create artifacts directly or implement functionality.
|
|
17
|
+
|
|
18
|
+
### Rules
|
|
19
|
+
|
|
20
|
+
1. **ALWAYS execute CLI first**: Run `specfact plan init` before any plan creation - execute the CLI command before any other operations
|
|
21
|
+
2. **NEVER write code**: Do not implement plan initialization logic - the CLI handles this
|
|
22
|
+
3. **NEVER create YAML/JSON directly**: All plan bundles must be CLI-generated
|
|
23
|
+
4. **NEVER bypass CLI validation**: CLI ensures schema compliance and metadata - use it, don't bypass its validation
|
|
24
|
+
5. **Use CLI output as grounding**: Parse CLI output, don't regenerate or recreate it - use the CLI output as the source of truth
|
|
25
|
+
6. **NEVER manipulate internal code**: Do NOT use Python code to directly modify PlanBundle objects, Feature objects, or any internal data structures. The CLI is THE interface - use it exclusively.
|
|
26
|
+
7. **No internal knowledge required**: You should NOT need to know about internal implementation details (PlanBundle model, Feature class, etc.). All operations must be performed via CLI commands.
|
|
27
|
+
|
|
28
|
+
### What Happens If You Don't Follow This
|
|
29
|
+
|
|
30
|
+
- ❌ Artifacts may not match CLI schema versions
|
|
31
|
+
- ❌ Missing metadata and telemetry
|
|
32
|
+
- ❌ Format inconsistencies
|
|
33
|
+
- ❌ Validation failures
|
|
34
|
+
- ❌ Works only in Copilot mode, fails in CI/CD
|
|
35
|
+
- ❌ Breaks when CLI internals change
|
|
36
|
+
- ❌ Requires knowledge of internal code structure
|
|
37
|
+
|
|
38
|
+
## ⏸️ Wait States: User Input Required
|
|
39
|
+
|
|
40
|
+
**When user input is required, you MUST wait for the user's response.**
|
|
41
|
+
|
|
42
|
+
### Wait State Rules
|
|
43
|
+
|
|
44
|
+
1. **Never assume**: If input is missing, ask and wait
|
|
45
|
+
2. **Never continue**: Do not proceed until user responds
|
|
46
|
+
3. **Be explicit**: Clearly state what information you need
|
|
47
|
+
4. **Provide options**: Give examples or default suggestions
|
|
48
|
+
|
|
49
|
+
### Example Wait States
|
|
50
|
+
|
|
51
|
+
#### Missing Required Argument
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
❌ WRONG: "Assuming --out is '.specfact/plans/main.bundle.yaml' and continuing..."
|
|
55
|
+
✅ CORRECT:
|
|
56
|
+
"What output path would you like to use for the plan bundle?
|
|
57
|
+
(default: .specfact/plans/main.bundle.yaml)
|
|
58
|
+
[WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Confirmation Required
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
❌ WRONG: "Proceeding with interactive mode..."
|
|
65
|
+
✅ CORRECT:
|
|
66
|
+
"Will execute: specfact plan init --interactive --out .specfact/plans/main.bundle.yaml
|
|
67
|
+
Continue? (y/n)
|
|
68
|
+
[WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Goal
|
|
72
|
+
|
|
73
|
+
Create a new development plan bundle. The plan bundle includes idea, business context, product structure (themes and releases), and initial features with stories.
|
|
74
|
+
|
|
75
|
+
**Two Approaches:**
|
|
76
|
+
|
|
77
|
+
1. **Greenfield** - Start from scratch with manual plan creation (interactive prompts)
|
|
78
|
+
2. **Brownfield** - Scan existing codebase to import structure (`specfact import from-code`), then refine interactively
|
|
79
|
+
|
|
80
|
+
The user should choose their approach at the beginning of the interactive flow.
|
|
81
|
+
|
|
82
|
+
## Operating Constraints
|
|
83
|
+
|
|
84
|
+
**STRICTLY READ-ONLY**: Do **not** modify the codebase. All plan bundles must be generated by the specfact CLI.
|
|
85
|
+
|
|
86
|
+
**Command**: `specfact plan init`
|
|
87
|
+
|
|
88
|
+
**Mode Auto-Detection**: The CLI automatically detects operational mode (CI/CD or CoPilot) based on environment. No need to specify `--mode` flag. Mode is detected from:
|
|
89
|
+
|
|
90
|
+
- Environment variables (`SPECFACT_MODE`)
|
|
91
|
+
- CoPilot API availability
|
|
92
|
+
- IDE integration (VS Code/Cursor with CoPilot)
|
|
93
|
+
- Defaults to CI/CD mode if none detected
|
|
94
|
+
|
|
95
|
+
## 🔄 Dual-Stack Workflow (Copilot Mode)
|
|
96
|
+
|
|
97
|
+
When in copilot mode, follow this three-phase workflow:
|
|
98
|
+
|
|
99
|
+
### Phase 1: CLI Grounding (REQUIRED)
|
|
100
|
+
|
|
101
|
+
**ALWAYS execute CLI first** to get structured, validated output:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
specfact plan init --interactive --out <output_path>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Note**: Mode is auto-detected by the CLI. No need to specify `--mode` flag.
|
|
108
|
+
|
|
109
|
+
**Capture from CLI output**:
|
|
110
|
+
|
|
111
|
+
- CLI-generated plan bundle (`.specfact/plans/main.bundle.yaml` or specified path)
|
|
112
|
+
- Metadata (timestamps, validation results)
|
|
113
|
+
- Telemetry (execution time, feature/story counts)
|
|
114
|
+
|
|
115
|
+
### Phase 2: LLM Enrichment (OPTIONAL, Copilot Only)
|
|
116
|
+
|
|
117
|
+
**Purpose**: Add semantic understanding to CLI output
|
|
118
|
+
|
|
119
|
+
**What to do**:
|
|
120
|
+
|
|
121
|
+
- Read CLI-generated plan bundle
|
|
122
|
+
- Research codebase for additional context (for brownfield approach)
|
|
123
|
+
- Suggest improvements to features/stories
|
|
124
|
+
- Extract business context from code comments/docs
|
|
125
|
+
|
|
126
|
+
**What NOT to do**:
|
|
127
|
+
|
|
128
|
+
- ❌ Create YAML/JSON artifacts directly
|
|
129
|
+
- ❌ Modify CLI artifacts directly
|
|
130
|
+
- ❌ Bypass CLI validation
|
|
131
|
+
|
|
132
|
+
**Output**: Generate enrichment report (Markdown) with insights
|
|
133
|
+
|
|
134
|
+
### Phase 3: CLI Artifact Creation (REQUIRED)
|
|
135
|
+
|
|
136
|
+
**Final artifacts MUST be CLI-generated**:
|
|
137
|
+
|
|
138
|
+
**If enrichment was generated**:
|
|
139
|
+
|
|
140
|
+
- Present CLI output + enrichment report side-by-side
|
|
141
|
+
- User can manually apply enrichments via CLI or interactive mode
|
|
142
|
+
|
|
143
|
+
**If no enrichment**:
|
|
144
|
+
|
|
145
|
+
- Use CLI-generated artifacts as-is
|
|
146
|
+
|
|
147
|
+
**Result**: All artifacts are CLI-generated (ensures format consistency, metadata, telemetry)
|
|
148
|
+
|
|
149
|
+
## Execution Steps
|
|
150
|
+
|
|
151
|
+
### 1. Parse Arguments
|
|
152
|
+
|
|
153
|
+
Extract arguments from user input:
|
|
154
|
+
|
|
155
|
+
- `--interactive/--no-interactive` - Interactive mode with prompts (default: interactive)
|
|
156
|
+
- `--out PATH` - Output plan bundle path (optional, default: `.specfact/plans/main.bundle.yaml`)
|
|
157
|
+
- `--scaffold/--no-scaffold` - Create complete `.specfact/` directory structure (default: scaffold)
|
|
158
|
+
|
|
159
|
+
For single quotes in args like "I'm Groot", use escape syntax: e.g `'I'\''m Groot'` (or double-quote if possible: `"I'm Groot"`).
|
|
160
|
+
|
|
161
|
+
### 2. Ensure Directory Structure
|
|
162
|
+
|
|
163
|
+
If `--scaffold` is enabled (default):
|
|
164
|
+
|
|
165
|
+
- Create `.specfact/` directory structure:
|
|
166
|
+
- `.specfact/plans/` - Plan bundles
|
|
167
|
+
- `.specfact/protocols/` - Protocol definitions (FSM)
|
|
168
|
+
- `.specfact/reports/` - Analysis and comparison reports
|
|
169
|
+
- `.specfact/reports/brownfield/` - Brownfield analysis reports
|
|
170
|
+
- `.specfact/reports/comparison/` - Plan comparison reports
|
|
171
|
+
- `.specfact/reports/enforcement/` - Enforcement reports
|
|
172
|
+
|
|
173
|
+
If `--no-scaffold`, ensure minimum structure exists.
|
|
174
|
+
|
|
175
|
+
### 3. Interactive vs Non-Interactive Mode
|
|
176
|
+
|
|
177
|
+
#### Non-Interactive Mode (`--no-interactive`)
|
|
178
|
+
|
|
179
|
+
Create a minimal plan bundle with:
|
|
180
|
+
|
|
181
|
+
- `version: "1.0"`
|
|
182
|
+
- Empty `idea` (None)
|
|
183
|
+
- Empty `business` (None)
|
|
184
|
+
- Empty `product` (themes: [], releases: [])
|
|
185
|
+
- Empty `features` ([])
|
|
186
|
+
|
|
187
|
+
Write to output path and exit.
|
|
188
|
+
|
|
189
|
+
#### Interactive Mode (default)
|
|
190
|
+
|
|
191
|
+
### 2. Choose Plan Creation Approach
|
|
192
|
+
|
|
193
|
+
**WAIT STATE**: Ask the user which approach they want and **WAIT for their response**:
|
|
194
|
+
|
|
195
|
+
```text
|
|
196
|
+
Plan Creation Approach:
|
|
197
|
+
1. Greenfield - Start from scratch (manual plan creation)
|
|
198
|
+
2. Brownfield - Import from existing codebase (scan repository first)
|
|
199
|
+
|
|
200
|
+
Choose option (1 or 2): _
|
|
201
|
+
[WAIT FOR USER RESPONSE - DO NOT CONTINUE]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**If user chooses option 2 (Brownfield)**:
|
|
205
|
+
|
|
206
|
+
1. **Execute CLI brownfield analysis first** (REQUIRED):
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
specfact import from-code --repo . --name <plan_name> --confidence 0.7
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**WAIT STATE**: If `--name` is not provided, ask user for plan name and **WAIT**:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
"What name would you like to use for the brownfield analysis?
|
|
216
|
+
(e.g., 'my-project', 'API Client v2')
|
|
217
|
+
[WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
- This CLI command analyzes the codebase and generates an auto-derived plan bundle
|
|
221
|
+
- Plan is saved to: `.specfact/plans/<name>-<timestamp>.bundle.yaml` (where `<name>` is the sanitized plan name)
|
|
222
|
+
- **Capture CLI output**: Plan bundle path, feature/story counts, metadata
|
|
223
|
+
|
|
224
|
+
2. **Load the CLI-generated auto-derived plan**:
|
|
225
|
+
- Read the CLI-generated plan bundle from brownfield analysis
|
|
226
|
+
- Extract features, themes, and structure from the auto-derived plan
|
|
227
|
+
|
|
228
|
+
3. **Execute CLI plan init with brownfield data**:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
specfact plan init --interactive --out <output_path>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- CLI will use the auto-derived plan as starting point
|
|
235
|
+
- Guide user through interactive prompts to refine/add:
|
|
236
|
+
- Idea section (title, narrative, target users, metrics)
|
|
237
|
+
- Business context (if needed)
|
|
238
|
+
- Product themes (confirm/add to auto-derived themes)
|
|
239
|
+
- Features (confirm/refine auto-derived features, add stories if missing)
|
|
240
|
+
|
|
241
|
+
4. **CLI merges and finalizes**:
|
|
242
|
+
- CLI merges refined idea/business sections with auto-derived features
|
|
243
|
+
- CLI writes final plan bundle to output path
|
|
244
|
+
|
|
245
|
+
**If user chooses option 1 (Greenfield)**:
|
|
246
|
+
|
|
247
|
+
- Execute CLI plan init directly:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
specfact plan init --interactive --out <output_path>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- CLI will guide user through interactive prompts starting with Section 1 (Idea)
|
|
254
|
+
|
|
255
|
+
### 3. CLI Interactive Flow (Greenfield or Brownfield)
|
|
256
|
+
|
|
257
|
+
**The CLI handles all interactive prompts**. Your role is to:
|
|
258
|
+
|
|
259
|
+
- Execute the CLI command
|
|
260
|
+
- Present CLI prompts to the user
|
|
261
|
+
- Wait for user responses
|
|
262
|
+
- Continue CLI execution based on user input
|
|
263
|
+
|
|
264
|
+
**For reference, the CLI interactive flow includes**:
|
|
265
|
+
|
|
266
|
+
#### Section 1: Idea
|
|
267
|
+
|
|
268
|
+
**For Brownfield approach**: Pre-fill with values from auto-derived plan if available (extract from plan bundle's `idea` section or from README/pyproject.toml analysis).
|
|
269
|
+
|
|
270
|
+
Prompt for:
|
|
271
|
+
|
|
272
|
+
- **Project title** (required) - If brownfield, suggest from auto-derived plan or extract from README/pyproject.toml
|
|
273
|
+
- **Project narrative** (required) - Brief description - If brownfield, suggest from auto-derived plan or README
|
|
274
|
+
- **Optional details**:
|
|
275
|
+
- Target users (list) - If brownfield, suggest from auto-derived plan
|
|
276
|
+
- Value hypothesis (text) - If brownfield, suggest from README value proposition
|
|
277
|
+
- Success metrics (dict: `{"metric_name": "target_value"}`) - Suggest based on project type
|
|
278
|
+
|
|
279
|
+
### 6. Section 2: Business Context (Optional)
|
|
280
|
+
|
|
281
|
+
Ask if user wants to add business context:
|
|
282
|
+
|
|
283
|
+
- **Market segments** (list)
|
|
284
|
+
- **Problems you're solving** (list)
|
|
285
|
+
- **Your solutions** (list)
|
|
286
|
+
- **How you differentiate** (list)
|
|
287
|
+
- **Business risks** (list)
|
|
288
|
+
|
|
289
|
+
### 7. Section 3: Product - Themes and Releases
|
|
290
|
+
|
|
291
|
+
**For Brownfield approach**: Pre-fill themes from auto-derived plan (extract from plan bundle's `product.themes`).
|
|
292
|
+
|
|
293
|
+
Prompt for:
|
|
294
|
+
|
|
295
|
+
- **Product themes** (list, e.g., "AI/ML", "Security", "Performance") - If brownfield, pre-fill with themes from auto-derived plan
|
|
296
|
+
- **Releases** (optional, interactive loop):
|
|
297
|
+
- Release name (e.g., "v1.0 - MVP")
|
|
298
|
+
- Release objectives (list)
|
|
299
|
+
- Feature keys in scope (list, e.g., `["FEATURE-001", "FEATURE-002"]`) - If brownfield, suggest feature keys from auto-derived plan
|
|
300
|
+
- Release risks (list)
|
|
301
|
+
- Ask if user wants to add another release
|
|
302
|
+
|
|
303
|
+
### 8. Section 4: Features
|
|
304
|
+
|
|
305
|
+
**For Brownfield approach**: Pre-fill with features from auto-derived plan. For each feature:
|
|
306
|
+
|
|
307
|
+
- Show auto-derived feature details (key, title, outcomes, acceptance criteria)
|
|
308
|
+
- Ask user to confirm, refine, or add stories
|
|
309
|
+
- If features have no stories, prompt to add them interactively
|
|
310
|
+
|
|
311
|
+
Interactive loop to add features:
|
|
312
|
+
|
|
313
|
+
- **Feature key** (required, e.g., "FEATURE-001")
|
|
314
|
+
- **Feature title** (required)
|
|
315
|
+
- **Expected outcomes** (list)
|
|
316
|
+
- **Acceptance criteria** (list)
|
|
317
|
+
- **Optional details**:
|
|
318
|
+
- Constraints (list)
|
|
319
|
+
- Confidence (0.0-1.0, float)
|
|
320
|
+
- Draft flag (boolean)
|
|
321
|
+
- **Stories** (optional, interactive loop):
|
|
322
|
+
- Story key (required, e.g., "STORY-001")
|
|
323
|
+
- Story title (required)
|
|
324
|
+
- Acceptance criteria (list)
|
|
325
|
+
- Optional details:
|
|
326
|
+
- Tags (list, e.g., `["critical", "backend"]`)
|
|
327
|
+
- Confidence (0.0-1.0, float)
|
|
328
|
+
- Draft flag (boolean)
|
|
329
|
+
|
|
330
|
+
### 9. Sensitive Information Disclosure Gate
|
|
331
|
+
|
|
332
|
+
**BEFORE generating the final plan bundle**, perform a disclosure gate check to identify potentially sensitive information that should not be published publicly:
|
|
333
|
+
|
|
334
|
+
1. **Review Business Section** (if provided):
|
|
335
|
+
- **Risks**: Check for internal business concerns (e.g., "Market competition", "Open source sustainability", "Proprietary competition") - **Remove these** as they contain internal strategy
|
|
336
|
+
- **Segments**: Check for specific targeting strategies - **Generalize if needed** (e.g., "GitHub Spec-Kit community" → "Open source developers")
|
|
337
|
+
- **Differentiation**: Check for competitive positioning details - **Keep public differentiators only** (remove strategic positioning)
|
|
338
|
+
- **Problems/Solutions**: Keep only information already published in public docs (README, public guides)
|
|
339
|
+
|
|
340
|
+
2. **Review Idea Section**:
|
|
341
|
+
- **Metrics**: Check for internal KPIs - **Keep only public success metrics**
|
|
342
|
+
- **Value Hypothesis**: Keep only public value proposition
|
|
343
|
+
|
|
344
|
+
3. **Review Features Section**:
|
|
345
|
+
- **Features**: Technical implementation details are generally safe to publish (already in codebase)
|
|
346
|
+
- **Stories**: Implementation details are safe
|
|
347
|
+
|
|
348
|
+
4. **Display Disclosure Warning**:
|
|
349
|
+
|
|
350
|
+
```text
|
|
351
|
+
⚠️ Disclosure Gate Check
|
|
352
|
+
============================================================
|
|
353
|
+
|
|
354
|
+
Potentially Sensitive Information Detected:
|
|
355
|
+
- Business risks: [list of risks]
|
|
356
|
+
- Market segments: [list of segments]
|
|
357
|
+
- Competitive differentiation: [list of differentiators]
|
|
358
|
+
|
|
359
|
+
This information may contain internal strategy that should not
|
|
360
|
+
be published publicly. Consider:
|
|
361
|
+
1. Removing business section entirely (it's optional)
|
|
362
|
+
2. Sanitizing business section (remove risks, generalize segments)
|
|
363
|
+
3. Keeping as-is if already published in public docs
|
|
364
|
+
|
|
365
|
+
Proceed with sanitized plan? (y/n)
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
5. **If user confirms sanitization**, remove or generalize sensitive information before proceeding.
|
|
369
|
+
|
|
370
|
+
6. **If user chooses to keep sensitive info**, warn them that it will be included in the plan bundle.
|
|
371
|
+
|
|
372
|
+
**Note**: For brownfield plans, business context may have been extracted from internal docs. Always review before finalizing.
|
|
373
|
+
|
|
374
|
+
### 4. CLI Generates Plan Bundle (REQUIRED)
|
|
375
|
+
|
|
376
|
+
**The CLI generates the plan bundle** with:
|
|
377
|
+
|
|
378
|
+
- `version: "1.0"`
|
|
379
|
+
- `idea`: Idea object (or None if not provided) - From CLI interactive prompts
|
|
380
|
+
- `business`: Business object (or None if not provided) - From CLI interactive prompts (after disclosure gate)
|
|
381
|
+
- `product`: Product object with themes and releases - From CLI interactive prompts
|
|
382
|
+
- `features`: List of Feature objects with stories - From CLI interactive prompts (for brownfield: merged with auto-derived features)
|
|
383
|
+
|
|
384
|
+
**For Brownfield approach**: CLI merges the auto-derived plan's features with the refined idea/business/product sections from interactive prompts.
|
|
385
|
+
|
|
386
|
+
### 5. CLI Validates Plan Bundle (REQUIRED)
|
|
387
|
+
|
|
388
|
+
**The CLI validates the generated plan bundle**:
|
|
389
|
+
|
|
390
|
+
- Schema validation (Pydantic models)
|
|
391
|
+
- Required fields check
|
|
392
|
+
- Data type validation
|
|
393
|
+
- Report validation results
|
|
394
|
+
|
|
395
|
+
**If validation fails**: CLI reports errors and does not write the plan bundle.
|
|
396
|
+
|
|
397
|
+
### 6. CLI Writes Plan Bundle (REQUIRED)
|
|
398
|
+
|
|
399
|
+
**The CLI writes the plan bundle** to output path:
|
|
400
|
+
|
|
401
|
+
- Creates parent directories if needed
|
|
402
|
+
- Writes YAML with proper formatting
|
|
403
|
+
- Reports success with file path
|
|
404
|
+
|
|
405
|
+
**Final Disclosure Reminder**: Before committing or publishing, verify that the plan bundle does not contain sensitive internal strategy (business risks, specific competitive positioning, internal targets).
|
|
406
|
+
|
|
407
|
+
### 7. Display Summary
|
|
408
|
+
|
|
409
|
+
Show plan summary:
|
|
410
|
+
|
|
411
|
+
- Title
|
|
412
|
+
- Themes count
|
|
413
|
+
- Features count
|
|
414
|
+
- Releases count
|
|
415
|
+
- Business context included (yes/no) - warn if sensitive info detected
|
|
416
|
+
|
|
417
|
+
**Note**: Plans created with this command can later be exported to Spec-Kit format using `specfact sync spec-kit --bidirectional`. The export will generate fully compatible Spec-Kit artifacts (spec.md, plan.md, tasks.md) with all required fields including INVSEST criteria, Scenarios, Constitution Check, and Phase organization.
|
|
418
|
+
|
|
419
|
+
**Prerequisites for Spec-Kit Sync**: Before running `specfact sync spec-kit --bidirectional`, ensure you have:
|
|
420
|
+
|
|
421
|
+
- Constitution (`.specify/memory/constitution.md`) created via `/speckit.constitution` command
|
|
422
|
+
- The constitution must be populated (not just template placeholders)
|
|
423
|
+
|
|
424
|
+
## Output Format
|
|
425
|
+
|
|
426
|
+
### Plan Bundle Structure
|
|
427
|
+
|
|
428
|
+
```yaml
|
|
429
|
+
version: "1.0"
|
|
430
|
+
idea:
|
|
431
|
+
title: "My Awesome Project"
|
|
432
|
+
narrative: "A project that does amazing things"
|
|
433
|
+
target_users: ["Developers", "Data Scientists"]
|
|
434
|
+
value_hypothesis: "Users will save 50% of their time"
|
|
435
|
+
metrics:
|
|
436
|
+
user_satisfaction: "> 4.5/5"
|
|
437
|
+
time_saved: "50%"
|
|
438
|
+
business:
|
|
439
|
+
segments: ["Enterprise", "SMB"]
|
|
440
|
+
problems: ["Complex workflows", "Time-consuming tasks"]
|
|
441
|
+
solutions: ["Automation", "AI assistance"]
|
|
442
|
+
differentiation: ["Better UX", "Lower cost"]
|
|
443
|
+
# Note: 'risks' field removed - contains internal strategy, not suitable for public disclosure
|
|
444
|
+
product:
|
|
445
|
+
themes: ["AI/ML", "Security"]
|
|
446
|
+
releases:
|
|
447
|
+
- name: "v1.0 - MVP"
|
|
448
|
+
objectives: ["Core features", "Basic security"]
|
|
449
|
+
scope: ["FEATURE-001", "FEATURE-002"]
|
|
450
|
+
risks: ["Scope creep", "Timeline delays"]
|
|
451
|
+
features:
|
|
452
|
+
- key: "FEATURE-001"
|
|
453
|
+
title: "User Authentication"
|
|
454
|
+
outcomes: ["Secure login", "Session management"]
|
|
455
|
+
acceptance: ["Users can log in", "Sessions persist"]
|
|
456
|
+
constraints: ["Must use OAuth2"]
|
|
457
|
+
confidence: 1.0
|
|
458
|
+
draft: false
|
|
459
|
+
stories:
|
|
460
|
+
- key: "STORY-001"
|
|
461
|
+
title: "Login API"
|
|
462
|
+
acceptance: ["API returns JWT token"]
|
|
463
|
+
tags: ["critical", "backend"]
|
|
464
|
+
confidence: 1.0
|
|
465
|
+
draft: false
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
## Guidelines
|
|
469
|
+
|
|
470
|
+
### Feature Keys
|
|
471
|
+
|
|
472
|
+
- Use format: `FEATURE-###` (e.g., `FEATURE-001`, `FEATURE-002`)
|
|
473
|
+
- Keys should be unique within a plan
|
|
474
|
+
- Sequential numbering recommended
|
|
475
|
+
|
|
476
|
+
### Story Keys
|
|
477
|
+
|
|
478
|
+
- Use format: `STORY-###` (e.g., `STORY-001`, `STORY-002`)
|
|
479
|
+
- Keys should be unique within a feature
|
|
480
|
+
- Sequential numbering recommended
|
|
481
|
+
|
|
482
|
+
### Confidence Scores
|
|
483
|
+
|
|
484
|
+
- Range: 0.0-1.0
|
|
485
|
+
- Default: 1.0 for manually created plans
|
|
486
|
+
- Lower confidence indicates uncertainty or draft status
|
|
487
|
+
|
|
488
|
+
### Validation
|
|
489
|
+
|
|
490
|
+
- All required fields must be present
|
|
491
|
+
- Data types must match schema
|
|
492
|
+
- Feature keys must be unique
|
|
493
|
+
- Story keys must be unique within their feature
|
|
494
|
+
|
|
495
|
+
## Summary
|
|
496
|
+
|
|
497
|
+
**Key Decision Point**: Always ask the user first whether they want:
|
|
498
|
+
|
|
499
|
+
1. **Greenfield** - Start from scratch with interactive prompts (standard CLI behavior)
|
|
500
|
+
2. **Brownfield** - Import existing codebase structure using `specfact import from-code`, then refine interactively
|
|
501
|
+
|
|
502
|
+
**For Brownfield**:
|
|
503
|
+
|
|
504
|
+
- **Execute CLI first**: Run `specfact import from-code --repo . --name <name> --confidence 0.7`
|
|
505
|
+
- **Wait for user input**: If `--name` is missing, ask and wait for response
|
|
506
|
+
- Load CLI-generated auto-derived plan from `.specfact/plans/<name>-<timestamp>.bundle.yaml`
|
|
507
|
+
- **Execute CLI plan init**: Run `specfact plan init --interactive --out <path>`
|
|
508
|
+
- CLI uses auto-derived features, themes, and structure as pre-filled suggestions in interactive prompts
|
|
509
|
+
- User can confirm, refine, or add to auto-derived content via CLI interactive prompts
|
|
510
|
+
- CLI merges refined idea/business sections with auto-derived features
|
|
511
|
+
- **CLI performs disclosure gate check** before finalizing (business context may contain internal strategy)
|
|
512
|
+
|
|
513
|
+
**For Greenfield**:
|
|
514
|
+
|
|
515
|
+
- **Execute CLI directly**: Run `specfact plan init --interactive --out <path>`
|
|
516
|
+
- CLI proceeds with interactive prompts (no pre-filling)
|
|
517
|
+
- Standard CLI command behavior
|
|
518
|
+
|
|
519
|
+
**Disclosure Gate** (handled by CLI):
|
|
520
|
+
|
|
521
|
+
- **CLI performs disclosure gate check** before generating final plan bundle
|
|
522
|
+
- CLI reviews business section for sensitive information (risks, competitive positioning, targeting strategy)
|
|
523
|
+
- CLI sanitizes or removes internal strategy information before publishing
|
|
524
|
+
- CLI warns user if sensitive information is detected
|
|
525
|
+
- CLI gets user confirmation before including sensitive information in plan bundle
|
|
526
|
+
|
|
527
|
+
**CRITICAL**: All plan bundles MUST be generated by the CLI. Never create YAML/JSON artifacts directly.
|
|
528
|
+
|
|
529
|
+
## Context
|
|
530
|
+
|
|
531
|
+
{ARGS}
|