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.
Files changed (66) hide show
  1. specfact_cli/__init__.py +1 -1
  2. specfact_cli/agents/analyze_agent.py +2 -3
  3. specfact_cli/analyzers/__init__.py +2 -1
  4. specfact_cli/analyzers/ambiguity_scanner.py +601 -0
  5. specfact_cli/analyzers/code_analyzer.py +462 -30
  6. specfact_cli/analyzers/constitution_evidence_extractor.py +491 -0
  7. specfact_cli/analyzers/contract_extractor.py +419 -0
  8. specfact_cli/analyzers/control_flow_analyzer.py +281 -0
  9. specfact_cli/analyzers/requirement_extractor.py +337 -0
  10. specfact_cli/analyzers/test_pattern_extractor.py +330 -0
  11. specfact_cli/cli.py +151 -206
  12. specfact_cli/commands/constitution.py +281 -0
  13. specfact_cli/commands/enforce.py +42 -34
  14. specfact_cli/commands/import_cmd.py +481 -152
  15. specfact_cli/commands/init.py +224 -55
  16. specfact_cli/commands/plan.py +2133 -547
  17. specfact_cli/commands/repro.py +100 -78
  18. specfact_cli/commands/sync.py +701 -186
  19. specfact_cli/enrichers/constitution_enricher.py +765 -0
  20. specfact_cli/enrichers/plan_enricher.py +294 -0
  21. specfact_cli/importers/speckit_converter.py +364 -48
  22. specfact_cli/importers/speckit_scanner.py +65 -0
  23. specfact_cli/models/plan.py +42 -0
  24. specfact_cli/resources/mappings/node-async.yaml +49 -0
  25. specfact_cli/resources/mappings/python-async.yaml +47 -0
  26. specfact_cli/resources/mappings/speckit-default.yaml +82 -0
  27. specfact_cli/resources/prompts/specfact-enforce.md +185 -0
  28. specfact_cli/resources/prompts/specfact-import-from-code.md +626 -0
  29. specfact_cli/resources/prompts/specfact-plan-add-feature.md +188 -0
  30. specfact_cli/resources/prompts/specfact-plan-add-story.md +212 -0
  31. specfact_cli/resources/prompts/specfact-plan-compare.md +571 -0
  32. specfact_cli/resources/prompts/specfact-plan-init.md +531 -0
  33. specfact_cli/resources/prompts/specfact-plan-promote.md +352 -0
  34. specfact_cli/resources/prompts/specfact-plan-review.md +1276 -0
  35. specfact_cli/resources/prompts/specfact-plan-select.md +401 -0
  36. specfact_cli/resources/prompts/specfact-plan-update-feature.md +242 -0
  37. specfact_cli/resources/prompts/specfact-plan-update-idea.md +211 -0
  38. specfact_cli/resources/prompts/specfact-repro.md +268 -0
  39. specfact_cli/resources/prompts/specfact-sync.md +497 -0
  40. specfact_cli/resources/schemas/deviation.schema.json +61 -0
  41. specfact_cli/resources/schemas/plan.schema.json +204 -0
  42. specfact_cli/resources/schemas/protocol.schema.json +53 -0
  43. specfact_cli/resources/templates/github-action.yml.j2 +140 -0
  44. specfact_cli/resources/templates/plan.bundle.yaml.j2 +141 -0
  45. specfact_cli/resources/templates/pr-template.md.j2 +58 -0
  46. specfact_cli/resources/templates/protocol.yaml.j2 +24 -0
  47. specfact_cli/resources/templates/telemetry.yaml.example +35 -0
  48. specfact_cli/sync/__init__.py +10 -1
  49. specfact_cli/sync/watcher.py +268 -0
  50. specfact_cli/telemetry.py +440 -0
  51. specfact_cli/utils/acceptance_criteria.py +127 -0
  52. specfact_cli/utils/enrichment_parser.py +445 -0
  53. specfact_cli/utils/feature_keys.py +12 -3
  54. specfact_cli/utils/ide_setup.py +170 -0
  55. specfact_cli/utils/structure.py +179 -2
  56. specfact_cli/utils/yaml_utils.py +33 -0
  57. specfact_cli/validators/repro_checker.py +22 -1
  58. specfact_cli/validators/schema.py +15 -4
  59. specfact_cli-0.6.8.dist-info/METADATA +456 -0
  60. specfact_cli-0.6.8.dist-info/RECORD +99 -0
  61. {specfact_cli-0.4.2.dist-info → specfact_cli-0.6.8.dist-info}/entry_points.txt +1 -0
  62. specfact_cli-0.6.8.dist-info/licenses/LICENSE.md +202 -0
  63. specfact_cli-0.4.2.dist-info/METADATA +0 -370
  64. specfact_cli-0.4.2.dist-info/RECORD +0 -62
  65. specfact_cli-0.4.2.dist-info/licenses/LICENSE.md +0 -61
  66. {specfact_cli-0.4.2.dist-info → specfact_cli-0.6.8.dist-info}/WHEEL +0 -0
@@ -0,0 +1,497 @@
1
+ ---
2
+ description: Synchronize Spec-Kit artifacts with SpecFact plans bidirectionally.
3
+ ---
4
+ # SpecFact Sync Command
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 sync spec-kit` before any sync operation - execute the CLI command before any other operations
21
+ 2. **NEVER write code**: Do not implement sync logic - the CLI handles this
22
+ 3. **NEVER create YAML/JSON directly**: All sync operations 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, SpecKit artifacts, 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, SpecKit converter, 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
+ ## Goal
50
+
51
+ Synchronize Spec-Kit artifacts with SpecFact plan bundles bidirectionally. This command enables seamless integration between Spec-Kit workflows and SpecFact contract-driven development, allowing teams to use either tooling while maintaining consistency.
52
+
53
+ **Note**: This is a **read-write operation** - it modifies both Spec-Kit and SpecFact artifacts to keep them in sync.
54
+
55
+ ## Action Required
56
+
57
+ **If arguments provided**: Execute `specfact sync spec-kit` immediately with provided arguments.
58
+
59
+ **If arguments missing**: Ask user interactively for each missing argument and **WAIT for their response**:
60
+
61
+ 1. **Sync direction**: "Sync direction? (1) Unidirectional: Spec-Kit → SpecFact, (2) Bidirectional: both directions"
62
+ - **[WAIT FOR USER RESPONSE - DO NOT CONTINUE]**
63
+
64
+ 2. **Repository path**: "Repository path? (default: current directory '.')"
65
+ - **[WAIT FOR USER RESPONSE - DO NOT CONTINUE]**
66
+
67
+ 3. **Confirmation**: Confirm before executing
68
+ - **[WAIT FOR USER RESPONSE - DO NOT CONTINUE]**
69
+
70
+ **Only execute CLI after** getting necessary information from user.
71
+
72
+ ## Operating Constraints
73
+
74
+ **STRICTLY READ-WRITE**: This command modifies Spec-Kit and SpecFact artifacts. All sync operations must be performed by the specfact CLI.
75
+
76
+ **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:
77
+
78
+ - Environment variables (`SPECFACT_MODE`)
79
+ - CoPilot API availability
80
+ - IDE integration (VS Code/Cursor with CoPilot)
81
+ - Defaults to CI/CD mode if none detected
82
+
83
+ ## Command
84
+
85
+ ```bash
86
+ specfact sync spec-kit [--repo PATH] [--bidirectional] [--plan PATH] [--overwrite] [--watch] [--interval SECONDS]
87
+ ```
88
+
89
+ **Note**: Mode is auto-detected by the CLI. No need to specify `--mode` flag.
90
+
91
+ **CRITICAL**: Always execute this CLI command. Never perform sync operations directly.
92
+
93
+ ## Quick Reference
94
+
95
+ **Arguments:**
96
+
97
+ - `--repo PATH` - Repository path (default: current directory)
98
+ - `--bidirectional` - Enable bidirectional sync (Spec-Kit ↔ SpecFact) - **ASK USER if not provided**
99
+ - `--plan PATH` - Path to SpecFact plan bundle for SpecFact → Spec-Kit conversion (default: main plan)
100
+ - `--overwrite` - Overwrite existing Spec-Kit artifacts (delete all existing before sync) - **ASK USER if intent is clear**
101
+ - `--watch` - Watch mode (not implemented - will exit with message)
102
+ - `--interval SECONDS` - Watch interval (default: 5, only with `--watch`)
103
+
104
+ **What it does:**
105
+
106
+ 1. Detects Spec-Kit repository (exits with error if not found)
107
+ 2. **Validates prerequisites**:
108
+ - Constitution (`.specify/memory/constitution.md`) must exist and be populated (not just template placeholders)
109
+ - For unidirectional sync: At least one `spec.md` file must exist in `specs/` directories
110
+ 3. Auto-creates SpecFact structure if missing
111
+ 4. Syncs Spec-Kit → SpecFact (unidirectional) or both directions (bidirectional)
112
+ 5. Reports sync summary with features updated/added
113
+
114
+ **Prerequisites:**
115
+
116
+ Before running sync, ensure you have:
117
+
118
+ 1. **Constitution** (REQUIRED for all sync operations):
119
+ - **Option 1 (Recommended for brownfield)**: Run `specfact constitution bootstrap --repo .` to auto-generate from repository analysis
120
+ - This analyzes your repository (README.md, pyproject.toml, .cursor/rules/, docs/rules/) and generates a bootstrap constitution
121
+ - Perfect for brownfield projects where you want to extract principles from existing codebase
122
+ - **Option 2 (Manual)**: Run `/speckit.constitution` command in your AI assistant and fill in the template
123
+ - Use this for greenfield projects or when you want full manual control
124
+ - **Enrichment**: If you have a minimal constitution, run `specfact constitution enrich --repo .` to fill placeholders
125
+ - **Validation**: Run `specfact constitution validate` to check completeness before sync
126
+ - The constitution must be populated (not just template placeholders like `[PROJECT_NAME]`)
127
+
128
+ 2. **Spec-Kit Features** (REQUIRED for unidirectional sync):
129
+ - Run `/speckit.specify` command to create at least one feature specification
130
+ - Creates `specs/[###-feature-name]/spec.md` files
131
+ - Optional: Run `/speckit.plan` and `/speckit.tasks` for complete artifacts
132
+
133
+ 3. **SpecFact Plan** (REQUIRED for bidirectional sync when syncing SpecFact → Spec-Kit):
134
+ - Must have a valid plan bundle at `.specfact/plans/main.bundle.yaml` (or specify with `--plan`)
135
+
136
+ **Validation Errors:**
137
+
138
+ If prerequisites are missing, the CLI will exit with clear error messages:
139
+
140
+ - **Constitution missing or empty**: "Constitution required. Run 'specfact constitution bootstrap --repo .' to auto-generate, or '/speckit.constitution' command to create manually."
141
+ - **No features found (unidirectional sync)**: "No Spec-Kit features found. Run '/speckit.specify' command first."
142
+
143
+ **Spec-Kit Format Compatibility:**
144
+
145
+ When exporting to Spec-Kit (bidirectional sync), the generated artifacts are **fully compatible** with Spec-Kit commands (`/speckit.analyze`, `/speckit.implement`, `/speckit.checklist`). The export includes:
146
+
147
+ - **spec.md**: Frontmatter (Feature Branch, Created date, Status), INVSEST criteria, Scenarios (Primary, Alternate, Exception, Recovery), "Why this priority" text
148
+ - **plan.md**: Constitution Check section (Article VII, VIII, IX), Phases (Phase 0, Phase 1, Phase 2, Phase -1), Technology Stack, Constraints, Unknowns
149
+ - **tasks.md**: Phase organization (Phase 1: Setup, Phase 2: Foundational, Phase 3+: User Stories), Parallel markers [P], Story mappings
150
+
151
+ This ensures exported Spec-Kit artifacts work seamlessly with Spec-Kit slash commands.
152
+
153
+ **Workflow Integration:**
154
+
155
+ After running `specfact sync spec-kit --bidirectional`, you can immediately run `/speckit.analyze` to validate consistency across all artifacts. The sync command ensures all prerequisites for `/speckit.analyze` are met:
156
+
157
+ - ✅ Constitution (`.specify/memory/constitution.md`) - Validated before sync
158
+ - ✅ spec.md - Generated during sync
159
+ - ✅ plan.md - Generated during sync
160
+ - ✅ tasks.md - Generated during sync
161
+
162
+ **Note**: `/speckit.analyze` is a read-only analysis command that checks for inconsistencies, duplications, ambiguities, and constitution alignment across the three core artifacts. It does not modify files.
163
+
164
+ **⚠️ Spec-Kit Requirements Fulfillment:**
165
+
166
+ The CLI automatically generates all required Spec-Kit fields during sync. However, you may want to customize some fields for your project:
167
+
168
+ 1. **Constitution Check Gates** (plan.md): Default gates are provided, but you may want to customize Article VII/VIII/IX checks for your project
169
+ 2. **Phase Organization** (plan.md, tasks.md): Default phases are auto-generated, but you may want to reorganize tasks into different phases
170
+ 3. **Feature Branch Name** (spec.md): Auto-generated from feature key, but you can customize if needed
171
+ 4. **INVSEST Criteria** (spec.md): Auto-generated as "YES" for all criteria, but you may want to adjust based on story characteristics
172
+
173
+ **Optional Customization Workflow:**
174
+
175
+ If you want to customize Spec-Kit-specific fields, you can:
176
+
177
+ 1. **After sync**: Edit the generated `spec.md`, `plan.md`, and `tasks.md` files directly
178
+ 2. **Before sync**: Use `specfact plan review` to enrich plan bundle with additional context that will be reflected in Spec-Kit artifacts
179
+ 3. **During sync** (if implemented): The CLI may prompt for customization options in interactive mode
180
+
181
+ **Note**: All Spec-Kit fields are auto-generated with sensible defaults, so manual customization is **optional** unless you have specific project requirements.
182
+
183
+ ## Interactive Flow
184
+
185
+ **Step 1**: Check if `--bidirectional` or sync direction is specified in user input.
186
+
187
+ - **If missing**: Ask user and **WAIT**:
188
+
189
+ ```text
190
+ "Sync direction? (1) Unidirectional: Spec-Kit → SpecFact, (2) Bidirectional: both directions
191
+ [WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
192
+ ```
193
+
194
+ - **If provided**: Use specified direction
195
+
196
+ **Step 2**: Check if `--repo` is specified.
197
+
198
+ - **If missing**: Ask user and **WAIT**:
199
+
200
+ ```text
201
+ "Repository path? (default: current directory '.')
202
+ [WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
203
+ ```
204
+
205
+ - **If provided**: Use specified path
206
+
207
+ **Step 3**: Check if intent is clear for SpecFact → Spec-Kit sync.
208
+
209
+ - **If bidirectional is enabled OR user input mentions "update spec-kit" or "sync to spec-kit"**: Ask about overwrite mode and **WAIT**:
210
+
211
+ ```text
212
+ "How should SpecFact → Spec-Kit sync work?
213
+ (1) Merge: Keep existing Spec-Kit artifacts and update/merge,
214
+ (2) Overwrite: Delete all existing Spec-Kit artifacts and replace with SpecFact plan
215
+ [WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
216
+ ```
217
+
218
+ - **If merge (default)**: Use without `--overwrite`
219
+ - **If overwrite**: Add `--overwrite` flag
220
+ - **If intent is not clear**: Skip this step
221
+
222
+ **Step 4**: Check if `--plan` should be specified.
223
+
224
+ - **If user input mentions "auto-derived", "from code", "brownfield", or "code2spec"**: Suggest using auto-derived plan and **WAIT**:
225
+
226
+ ```text
227
+ "Use auto-derived plan (from codebase) instead of main plan? (y/n)
228
+ [WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
229
+ ```
230
+
231
+ - **If yes**: Find latest auto-derived plan in `.specfact/plans/` and add `--plan PATH`
232
+ - **If no**: Use default main plan
233
+
234
+ **Step 5**: Check if user wants to customize Spec-Kit-specific fields (OPTIONAL).
235
+
236
+ - **If bidirectional sync is enabled**: Ask user if they want to customize Spec-Kit fields and **WAIT**:
237
+
238
+ ```text
239
+ "The sync will generate complete Spec-Kit artifacts with all required fields (frontmatter, INVSEST, Constitution Check, Phases, etc.).
240
+
241
+ Do you want to customize any Spec-Kit-specific fields? (y/n)
242
+ - Constitution Check gates (Article VII/VIII/IX)
243
+ - Phase organization
244
+ - Feature branch names
245
+ - INVSEST criteria adjustments
246
+
247
+ [WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
248
+ ```
249
+
250
+ - **If yes**: Note that customization will be done after sync (edit generated files)
251
+ - **If no**: Proceed with default auto-generated fields
252
+
253
+ - **If unidirectional sync**: Skip this step (no Spec-Kit artifacts generated)
254
+
255
+ **Step 6**: Confirm execution.
256
+
257
+ - Show summary and **WAIT**:
258
+
259
+ ```text
260
+ "Will sync [DIRECTION] in [REPO_PATH] [with overwrite mode if enabled] [using PLAN_PATH if specified] [with Spec-Kit customization if requested].
261
+ Continue? (y/n)
262
+ [WAIT FOR USER RESPONSE - DO NOT CONTINUE]"
263
+ ```
264
+
265
+ - **If yes**: Execute CLI command
266
+ - **If no**: Cancel or ask for changes
267
+
268
+ **Step 7**: Execute CLI command with confirmed arguments.
269
+
270
+ ```bash
271
+ specfact sync spec-kit --repo <repo_path> [--bidirectional] [--plan <plan_path>] [--overwrite]
272
+ ```
273
+
274
+ **Capture CLI output**:
275
+
276
+ - Sync summary (features updated/added)
277
+ - **Deduplication summary**: "✓ Removed N duplicate features from plan bundle" (if duplicates were found)
278
+ - Spec-Kit artifacts created/updated (with all required fields auto-generated)
279
+ - SpecFact artifacts created/updated
280
+ - Any error messages or warnings
281
+
282
+ **Understanding Deduplication**:
283
+
284
+ The CLI automatically deduplicates features during sync using normalized key matching:
285
+
286
+ 1. **Exact matches**: Features with identical normalized keys are automatically deduplicated
287
+ - Example: `FEATURE-001` and `001_FEATURE_NAME` normalize to the same key
288
+ 2. **Prefix matches**: Abbreviated class names vs full Spec-Kit directory names
289
+ - Example: `FEATURE-IDEINTEGRATION` (from code analysis) vs `041_IDE_INTEGRATION_SYSTEM` (from Spec-Kit)
290
+ - Only matches when at least one key has a numbered prefix (Spec-Kit origin) to avoid false positives
291
+ - Requires minimum 10 characters, 6+ character difference, and <75% length ratio
292
+
293
+ **LLM Semantic Deduplication**:
294
+
295
+ After automated deduplication, you should review the plan bundle for **semantic/logical duplicates** that automated matching might miss:
296
+
297
+ 1. **Review feature titles and descriptions**: Look for features that represent the same functionality with different names
298
+ - Example: "Git Operations Manager" vs "Git Operations Handler" (both handle git operations)
299
+ - Example: "Telemetry Settings" vs "Telemetry Configuration" (both configure telemetry)
300
+ 2. **Check feature stories**: Features with overlapping or identical user stories may be duplicates
301
+ 3. **Analyze code coverage**: If multiple features reference the same code files/modules, they might be the same feature
302
+ 4. **Suggest consolidation**: When semantic duplicates are found:
303
+ - Use `specfact plan update-feature` to merge information into one feature
304
+ - Use `specfact plan add-feature` to create a consolidated feature if needed
305
+ - Remove duplicate features using appropriate CLI commands
306
+
307
+ **Example Semantic Duplicate Detection**:
308
+
309
+ ```text
310
+ After sync, review the plan bundle and identify:
311
+ - Features with similar titles but different keys
312
+ - Features covering the same code modules
313
+ - Features with overlapping user stories
314
+ - Features that represent the same functionality
315
+
316
+ If semantic duplicates are found, suggest consolidation:
317
+ "Found semantic duplicates: FEATURE-GITOPERATIONS and FEATURE-GITOPERATIONSHANDLER
318
+ both cover git operations. Should I consolidate these into a single feature?"
319
+ ```
320
+
321
+ **Step 8**: After sync completes, guide user on next steps.
322
+
323
+ - **Always suggest validation**: After successful sync, remind user to run `/speckit.analyze`:
324
+
325
+ ```text
326
+ "Sync completed successfully! Run '/speckit.analyze' to validate artifact consistency and quality.
327
+ This will check for ambiguities, duplications, and constitution alignment."
328
+ ```
329
+
330
+ - **If bidirectional sync completed**: Remind user that all Spec-Kit fields are auto-generated and ready for `/speckit.analyze`
331
+ - **Note**: `/speckit.analyze` requires `spec.md`, `plan.md`, and `tasks.md` to exist. The sync command generates all three files, so artifacts are ready for analysis.
332
+ - **Constitution requirement**: `/speckit.analyze` also requires the constitution (`.specify/memory/constitution.md`) which is validated before sync, so this prerequisite is already met.
333
+ - **Constitution Check status**: Generated `plan.md` files have Constitution Check gates set to "PENDING" - users should review and check gates based on their project's actual state
334
+
335
+ - **If customization was requested**: Guide user to edit generated files:
336
+ - `specs/<feature-num>-<feature-name>/spec.md` - Customize frontmatter, INVSEST, scenarios
337
+ - `specs/<feature-num>-<feature-name>/plan.md` - Customize Constitution Check, Phases, Technology Stack
338
+ - `specs/<feature-num>-<feature-name>/tasks.md` - Customize phase organization, story mappings
339
+ - **After customization**: User should run `/speckit.analyze` to validate consistency across all artifacts
340
+
341
+ ## Expected Output
342
+
343
+ **Unidirectional sync:**
344
+
345
+ ```bash
346
+ Syncing Spec-Kit artifacts from: /path/to/repo
347
+ ✓ Detected Spec-Kit repository
348
+ ✓ Constitution found and validated
349
+ 📦 Scanning Spec-Kit artifacts...
350
+ ✓ Found 5 features in specs/
351
+ ✓ Detected SpecFact structure (or created automatically)
352
+ 📝 Converting to SpecFact format...
353
+ - Updated 2 features
354
+ - Added 0 new features
355
+ ✓ Sync complete!
356
+
357
+ Sync Summary (Unidirectional):
358
+ - Updated: 2 features
359
+ - Added: 0 new features
360
+ - Direction: Spec-Kit → SpecFact
361
+
362
+ Next Steps:
363
+ Run '/speckit.analyze' to validate artifact consistency and quality
364
+ This will check for ambiguities, duplications, and constitution alignment
365
+
366
+ ✓ Sync complete!
367
+ ```
368
+
369
+ **Error example (missing constitution):**
370
+
371
+ ```bash
372
+ Syncing Spec-Kit artifacts from: /path/to/repo
373
+ ✓ Detected Spec-Kit repository
374
+ ✗ Constitution required
375
+ Constitution file not found: .specify/memory/constitution.md
376
+ The constitution is required before syncing Spec-Kit artifacts.
377
+
378
+ Next Steps:
379
+ 1. Run 'specfact constitution bootstrap --repo .' to auto-generate from repository analysis (recommended for brownfield)
380
+ OR run '/speckit.constitution' command in your AI assistant to create manually (for greenfield)
381
+ 2. Review and adjust the generated constitution as needed
382
+ 3. Run 'specfact constitution validate' to check completeness
383
+ 4. Then run 'specfact sync spec-kit' again
384
+ ```
385
+
386
+ **Error example (minimal constitution detected):**
387
+
388
+ ```bash
389
+ Syncing Spec-Kit artifacts from: /path/to/repo
390
+ ✓ Detected Spec-Kit repository
391
+ ⚠ Constitution is minimal (essentially empty)
392
+ Generate bootstrap constitution from repository analysis? (y/n): y
393
+ Generating bootstrap constitution...
394
+ ✓ Bootstrap constitution generated
395
+ Review and adjust as needed before syncing
396
+
397
+ Next Steps:
398
+ 1. Review the generated constitution at .specify/memory/constitution.md
399
+ 2. Adjust principles and sections as needed
400
+ 3. Run 'specfact constitution validate' to check completeness
401
+ 4. Then run 'specfact sync spec-kit' again
402
+ ```
403
+
404
+ **Error example (no features for unidirectional sync):**
405
+
406
+ ```bash
407
+ Syncing Spec-Kit artifacts from: /path/to/repo
408
+ ✓ Detected Spec-Kit repository
409
+ ✓ Constitution found and validated
410
+ 📦 Scanning Spec-Kit artifacts...
411
+ ✓ Found 0 features in specs/
412
+ ✗ No Spec-Kit features found
413
+ Unidirectional sync (Spec-Kit → SpecFact) requires at least one feature specification.
414
+
415
+ Next Steps:
416
+ 1. Run '/speckit.specify' command in your AI assistant to create feature specifications
417
+ 2. Optionally run '/speckit.plan' and '/speckit.tasks' to create complete artifacts
418
+ 3. Then run 'specfact sync spec-kit' again
419
+
420
+ Note: For bidirectional sync, Spec-Kit artifacts are optional if syncing from SpecFact → Spec-Kit
421
+ ```
422
+
423
+ **Bidirectional sync** adds:
424
+
425
+ ```bash
426
+ Syncing Spec-Kit artifacts from: /path/to/repo
427
+ ✓ Detected Spec-Kit repository
428
+ ✓ Constitution found and validated
429
+ 📦 Scanning Spec-Kit artifacts...
430
+ ✓ Found 2 features in specs/
431
+ ✓ Detected SpecFact structure
432
+ 📝 Converting Spec-Kit → SpecFact...
433
+ - Updated 2 features
434
+ - Added 0 new features
435
+ 🔄 Converting SpecFact → Spec-Kit...
436
+ ✓ Converted 2 features to Spec-Kit
437
+ ✓ Generated Spec-Kit compatible artifacts:
438
+ - spec.md with frontmatter, INVSEST criteria, scenarios
439
+ - plan.md with Constitution Check, Phases, Technology Stack
440
+ - tasks.md with phase organization and parallel markers
441
+ ✓ No conflicts detected
442
+
443
+ Sync Summary (Bidirectional):
444
+ - Spec-Kit → SpecFact: Updated 2, Added 0 features
445
+ - SpecFact → Spec-Kit: 2 features converted to Spec-Kit markdown
446
+ - Format Compatibility: ✅ Full (works with /speckit.analyze, /speckit.implement, /speckit.checklist)
447
+ - Conflicts: None detected
448
+
449
+ ⚠ Note: Constitution Check gates in plan.md are set to PENDING - review and check gates based on your project's actual state
450
+
451
+ Next Steps:
452
+ Run '/speckit.analyze' to validate artifact consistency and quality
453
+ This will check for ambiguities, duplications, and constitution alignment
454
+
455
+ ✓ Sync complete!
456
+ ```
457
+
458
+ **Bidirectional sync with overwrite** adds:
459
+
460
+ ```bash
461
+ Syncing Spec-Kit artifacts from: /path/to/repo
462
+ ✓ Detected Spec-Kit repository
463
+ ✓ Constitution found and validated
464
+ 📦 Scanning Spec-Kit artifacts...
465
+ ✓ Found 2 features in specs/
466
+ ✓ Detected SpecFact structure
467
+ 📝 Converting Spec-Kit → SpecFact...
468
+ - Updated 2 features
469
+ - Added 0 new features
470
+ 🔄 Converting SpecFact → Spec-Kit...
471
+ ⚠ Overwrite mode: Removing existing Spec-Kit artifacts...
472
+ ✓ Existing artifacts removed
473
+ ✓ Converted 32 features to Spec-Kit
474
+ ✓ Generated Spec-Kit compatible artifacts:
475
+ - spec.md with frontmatter, INVSEST criteria, scenarios
476
+ - plan.md with Constitution Check, Phases, Technology Stack
477
+ - tasks.md with phase organization and parallel markers
478
+ ✓ No conflicts detected
479
+
480
+ Sync Summary (Bidirectional):
481
+ - Spec-Kit → SpecFact: Updated 2, Added 0 features
482
+ - SpecFact → Spec-Kit: 32 features converted to Spec-Kit markdown (overwritten)
483
+ - Format Compatibility: ✅ Full (works with /speckit.analyze, /speckit.implement, /speckit.checklist)
484
+ - Conflicts: None detected
485
+
486
+ ⚠ Note: Constitution Check gates in plan.md are set to PENDING - review and check gates based on your project's actual state
487
+
488
+ Next Steps:
489
+ Run '/speckit.analyze' to validate artifact consistency and quality
490
+ This will check for ambiguities, duplications, and constitution alignment
491
+
492
+ ✓ Sync complete!
493
+ ```
494
+
495
+ ## Context
496
+
497
+ {ARGS}
@@ -0,0 +1,61 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Deviation Report Schema",
4
+ "description": "Schema for SpecFact CLI deviation report validation",
5
+ "type": "object",
6
+ "required": ["manual_plan", "auto_plan", "deviations", "summary"],
7
+ "properties": {
8
+ "manual_plan": {
9
+ "type": "string",
10
+ "description": "Path to manual plan bundle"
11
+ },
12
+ "auto_plan": {
13
+ "type": "string",
14
+ "description": "Path to auto-generated plan bundle"
15
+ },
16
+ "deviations": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "object",
20
+ "required": ["type", "severity", "description", "location"],
21
+ "properties": {
22
+ "type": {
23
+ "type": "string",
24
+ "enum": [
25
+ "missing_feature",
26
+ "missing_story",
27
+ "extra_feature",
28
+ "extra_story",
29
+ "acceptance_drift",
30
+ "fsm_mismatch",
31
+ "risk_omission"
32
+ ]
33
+ },
34
+ "severity": {
35
+ "type": "string",
36
+ "enum": ["HIGH", "MEDIUM", "LOW"]
37
+ },
38
+ "description": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "location": {
43
+ "type": "string"
44
+ },
45
+ "fix_hint": {
46
+ "type": "string"
47
+ }
48
+ }
49
+ }
50
+ },
51
+ "summary": {
52
+ "type": "object",
53
+ "additionalProperties": {
54
+ "type": "integer",
55
+ "minimum": 0
56
+ },
57
+ "description": "Deviation counts by type"
58
+ }
59
+ }
60
+ }
61
+