specweave 0.34.20 → 0.34.22

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 (37) hide show
  1. package/CLAUDE.md +112 -111
  2. package/dist/src/cli/commands/import-external.d.ts.map +1 -1
  3. package/dist/src/cli/commands/import-external.js +33 -29
  4. package/dist/src/cli/commands/import-external.js.map +1 -1
  5. package/dist/src/cli/workers/living-docs-worker.js +18 -12
  6. package/dist/src/cli/workers/living-docs-worker.js.map +1 -1
  7. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.d.ts +8 -0
  8. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.d.ts.map +1 -1
  9. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.js +151 -4
  10. package/dist/src/core/living-docs/intelligent-analyzer/architecture-generator.js.map +1 -1
  11. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +2 -0
  12. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -1
  13. package/dist/src/core/living-docs/intelligent-analyzer/index.js +101 -1
  14. package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -1
  15. package/dist/src/importers/item-converter.d.ts.map +1 -1
  16. package/dist/src/importers/item-converter.js +8 -2
  17. package/dist/src/importers/item-converter.js.map +1 -1
  18. package/dist/src/integrations/jira/jira-client.d.ts +12 -0
  19. package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
  20. package/dist/src/integrations/jira/jira-client.js +58 -0
  21. package/dist/src/integrations/jira/jira-client.js.map +1 -1
  22. package/dist/src/sync/format-preservation-sync.d.ts +8 -0
  23. package/dist/src/sync/format-preservation-sync.d.ts.map +1 -1
  24. package/dist/src/sync/format-preservation-sync.js +56 -8
  25. package/dist/src/sync/format-preservation-sync.js.map +1 -1
  26. package/dist/src/sync/sync-coordinator.d.ts +8 -0
  27. package/dist/src/sync/sync-coordinator.d.ts.map +1 -1
  28. package/dist/src/sync/sync-coordinator.js +108 -3
  29. package/dist/src/sync/sync-coordinator.js.map +1 -1
  30. package/dist/src/utils/auth-helpers.d.ts +22 -0
  31. package/dist/src/utils/auth-helpers.d.ts.map +1 -1
  32. package/dist/src/utils/auth-helpers.js +72 -0
  33. package/dist/src/utils/auth-helpers.js.map +1 -1
  34. package/package.json +1 -1
  35. package/plugins/specweave/commands/increment.md +63 -16
  36. package/plugins/specweave/skills/increment-planner/SKILL.md +97 -2
  37. package/plugins/specweave/skills/spec-generator/SKILL.md +64 -57
@@ -49,6 +49,54 @@ Automates creation of increment structure for ANY type of work:
49
49
 
50
50
  ## Critical Rules
51
51
 
52
+ ### 0. **Project**: Field is MANDATORY (v0.35.0+ - HIGHEST PRIORITY!)
53
+
54
+ **⛔ EVERY User Story MUST have `**Project**:` field - NO EXCEPTIONS!**
55
+
56
+ This applies to BOTH single-project AND multi-project modes:
57
+ - **Single-project**: Use `config.project.name` value (e.g., `**Project**: my-app`)
58
+ - **Multi-project**: Use one of `multiProject.projects` keys (e.g., `**Project**: frontend-app`)
59
+
60
+ **HOW TO GET THE PROJECT VALUE:**
61
+ 1. Run `specweave context projects`
62
+ 2. Use project ID from output
63
+
64
+ **Single-project output:**
65
+ ```json
66
+ { "level": 1, "projects": [{"id": "my-app"}] }
67
+ → Use: **Project**: my-app
68
+ ```
69
+
70
+ **Multi-project output:**
71
+ ```json
72
+ { "level": 1, "projects": [{"id": "frontend"}, {"id": "backend"}] }
73
+ → Pick appropriate project per US
74
+ ```
75
+
76
+ **2-level output (ADO/JIRA):**
77
+ ```json
78
+ { "level": 2, "projects": [...], "boardsByProject": {"corp": [{"id": "digital-ops"}]} }
79
+ → ALSO add: **Board**: digital-ops
80
+ ```
81
+
82
+ **EXAMPLE (v0.35.0+):**
83
+ ```markdown
84
+ ### US-001: Show Last 2 Git Commits
85
+ **Project**: aac # ← MANDATORY! Value from config
86
+ **As a** developer, I want to see the last 2 git commits...
87
+ ```
88
+
89
+ **⛔ NEVER GENERATE:**
90
+ ```markdown
91
+ ### US-001: Feature Name
92
+ **As a** user, I want... # ← MISSING **Project**: = INVALID!
93
+ ```
94
+
95
+ **EDGE CASES:**
96
+ - **Empty config.project.name**: Run `specweave init` to configure
97
+ - **Empty multiProject.projects**: Invalid config - ask user to configure projects
98
+ - **Project name with special chars**: Only `a-z`, `0-9`, `-` allowed
99
+
52
100
  ### 1. Increment Naming (MANDATORY)
53
101
 
54
102
  **Format**: `####-descriptive-kebab-case-name`
@@ -182,8 +230,22 @@ echo "Using coverageTarget: $coverageTarget"
182
230
 
183
231
  **🚨 FAILURE TO COMPLETE THIS STEP = spec.md WILL BE BLOCKED BY VALIDATION HOOK!**
184
232
 
233
+ **🧠 ULTRATHINK REQUIRED - ANALYZE ALL AVAILABLE CONTEXT FIRST!**
234
+
185
235
  Before generating ANY spec.md content, you MUST:
186
236
 
237
+ **0. ULTRATHINK - Gather context BEFORE running API:**
238
+ ```bash
239
+ # 1. Check existing project folders in living docs
240
+ ls .specweave/docs/internal/specs/
241
+
242
+ # 2. Check how recent increments assigned projects
243
+ grep -r "^\*\*Project\*\*:" .specweave/increments/*/spec.md | tail -10
244
+
245
+ # 3. Read config.json for project.name or multiProject.projects
246
+ cat .specweave/config.json | jq '.project.name, .multiProject'
247
+ ```
248
+
187
249
  **1. RUN THE CONTEXT API (via Bash tool):**
188
250
  ```bash
189
251
  specweave context projects
@@ -214,7 +276,37 @@ For 2-level structures (ADO/JIRA boards):
214
276
  }
215
277
  ```
216
278
 
217
- **3. RESOLVE PROJECT/BOARD FOR EACH USER STORY:**
279
+ **3. 🧠 ULTRATHINK - SMART PROJECT RESOLUTION (v0.35.0+ CRITICAL!):**
280
+
281
+ **RESOLUTION PRIORITY (MUST FOLLOW THIS ORDER!):**
282
+ ```
283
+ 1. ✅ EXACT MATCH: config.project.name or multiProject.projects key → USE IT
284
+ 2. ✅ LIVING DOCS: Existing folder in specs/ → USE THAT PROJECT ID
285
+ 3. ✅ RECENT PATTERNS: Same feature type in past increments → USE SAME PROJECT
286
+ 4. ⚠️ UNCERTAIN: Multiple valid options OR no clear match → ASK USER!
287
+ 5. 🔄 FALLBACK: If all else fails → USE "default" (NEVER "specweave"!)
288
+ ```
289
+
290
+ **⚠️ CRITICAL: IF UNCERTAIN - YOU MUST ASK THE USER!**
291
+ ```
292
+ I found multiple potential projects for this feature:
293
+ - frontend-app (keywords: UI, form, React)
294
+ - backend-api (keywords: API, endpoint)
295
+
296
+ Which project should I assign to this feature?
297
+ ```
298
+
299
+ **❌ NEVER DO THIS:**
300
+ - Silently assign to "specweave" (that's the framework name, not user's project!)
301
+ - Guess without analyzing context
302
+ - Skip asking when genuinely uncertain
303
+
304
+ **✅ CORRECT FALLBACK (when no projects configured):**
305
+ ```
306
+ **Project**: default
307
+ ```
308
+
309
+ **4. RESOLVE PROJECT/BOARD FOR EACH USER STORY:**
218
310
 
219
311
  ```
220
312
  CONTEXT_OUTPUT = <output from specweave context projects>
@@ -228,7 +320,7 @@ For each US you will generate:
228
320
  US.board = select from CONTEXT_OUTPUT.boardsByProject[project][].id
229
321
  ```
230
322
 
231
- **4. NOW PROCEED TO STEP 1 (with resolved values stored)**
323
+ **5. NOW PROCEED TO STEP 1 (with resolved values stored)**
232
324
 
233
325
  ---
234
326
 
@@ -240,13 +332,16 @@ For each US you will generate:
240
332
  ✅ REQUIRED: project field MUST match one of projects[].id from output
241
333
  ✅ REQUIRED: board field (2-level) MUST match one of boardsByProject[project][].id
242
334
  ✅ REQUIRED: Each US has **Project**: and **Board**: (2-level) with RESOLVED values
335
+ ✅ REQUIRED: ASK USER when uncertain (multiple valid options or no clear match)
243
336
 
244
337
  ❌ FORBIDDEN: Skipping this step and generating spec.md directly
245
338
  ❌ FORBIDDEN: Inventing project names not in the API output
339
+ ❌ FORBIDDEN: Using "specweave" as project name (it's the framework, not user's project!)
246
340
  ❌ FORBIDDEN: Using folder names as project (e.g., "my-project-folder")
247
341
  ❌ FORBIDDEN: Using {{PROJECT_ID}} or {{BOARD_ID}} placeholders
248
342
  ❌ FORBIDDEN: Creating spec.md for 2-level without board: field
249
343
  ❌ FORBIDDEN: Generating spec.md without running context API first
344
+ ❌ FORBIDDEN: Silently guessing project without analyzing context
250
345
  ```
251
346
 
252
347
  **WHY THIS IS BLOCKING:**
@@ -27,7 +27,7 @@ description: Generates comprehensive specifications (spec.md, plan.md, tasks.md
27
27
  - **Bug Fix**: Problem statement, root cause, solution, impact analysis
28
28
  - **Refactoring**: Current state, proposed changes, benefits, migration plan
29
29
 
30
- **YAML Frontmatter** (v0.31.0+ MANDATORY):
30
+ **YAML Frontmatter** (v0.35.0+ simplified):
31
31
  ```yaml
32
32
  ---
33
33
  increment: 0001-feature-name
@@ -36,14 +36,14 @@ type: feature
36
36
  priority: P1
37
37
  status: planned
38
38
  created: 2025-12-04
39
- project: my-project # REQUIRED - target project for living docs sync
40
- board: my-board # REQUIRED for 2-level structures (ADO area paths, JIRA boards)
39
+ # NOTE: project: and board: fields REMOVED from frontmatter!
40
+ # Use per-US **Project**: and **Board**: fields instead (see below)
41
41
  ---
42
42
  ```
43
43
 
44
- **Detect Structure Level First** (see `src/utils/structure-level-detector.ts`):
45
- - 1-level: `project:` field REQUIRED
46
- - 2-level: `project:` AND `board:` fields REQUIRED
44
+ **⛔ CRITICAL RULE: Every User Story MUST have `**Project**:` field!**
45
+
46
+ This is MANDATORY in BOTH single-project AND multi-project modes.
47
47
 
48
48
  **Core Sections** (Always Present):
49
49
  ```markdown
@@ -66,14 +66,15 @@ board: my-board # REQUIRED for 2-level structures (ADO area paths,
66
66
  ## User Stories & Acceptance Criteria
67
67
 
68
68
  <!--
69
- ⚠️ PER-US PROJECT TARGETING (v0.33.0+):
70
- Each user story MUST have **Project**: (and **Board**: for 2-level) fields.
71
- The LLM MUST resolve these from context - see RULE 0 in increment-planner.
69
+ MANDATORY: **Project**: field on EVERY User Story (v0.35.0+)
70
+ - Single-project: Use config.project.name value
71
+ - Multi-project: Use one of multiProject.projects keys
72
+ NEVER generate a User Story without **Project**: field!
72
73
  -->
73
74
 
74
75
  ### US-001: [Title]
75
- **Project**: [resolved-from-context] <!-- REQUIRED - actual project ID from config/folders -->
76
- **Board**: [resolved-from-context] <!-- REQUIRED for 2-level structures -->
76
+ **Project**: [MANDATORY - use config.project.name or multiProject.projects key]
77
+ **Board**: [MANDATORY for 2-level structures only]
77
78
 
78
79
  **As a** [user type]
79
80
  **I want** [goal]
@@ -91,6 +92,14 @@ The LLM MUST resolve these from context - see RULE 0 in increment-planner.
91
92
 
92
93
  **This step is BLOCKING - do not proceed until you have actual project/board IDs.**
93
94
 
95
+ **🧠 ULTRATHINK REQUIRED - ANALYZE ALL AVAILABLE CONTEXT FIRST!**
96
+
97
+ Before assigning ANY project, you MUST analyze:
98
+ 1. **Living docs structure**: `ls .specweave/docs/internal/specs/` - what project folders exist?
99
+ 2. **Recent increments**: `grep -r "^\*\*Project\*\*:" .specweave/increments/*/spec.md | tail -10`
100
+ 3. **config.json**: Read `project.name` (single-project) or `multiProject.projects` (multi-project)
101
+ 4. **Feature description**: What does the user want to build? Match to existing projects.
102
+
94
103
  **1. Run the context API command:**
95
104
  ```bash
96
105
  specweave context projects
@@ -118,13 +127,43 @@ For 2-level:
118
127
  }
119
128
  ```
120
129
 
121
- **3. STORE the actual IDs for use in spec.md:**
130
+ **3. 🧠 ULTRATHINK - SMART PROJECT RESOLUTION (v0.35.0+ CRITICAL!):**
131
+
132
+ **RESOLUTION PRIORITY (MUST FOLLOW THIS ORDER!):**
133
+ ```
134
+ 1. ✅ EXACT MATCH: config.project.name or multiProject.projects key → USE IT
135
+ 2. ✅ LIVING DOCS: Existing folder in specs/ → USE THAT PROJECT ID
136
+ 3. ✅ RECENT PATTERNS: Same feature type in past increments → USE SAME PROJECT
137
+ 4. ⚠️ UNCERTAIN: Multiple valid options OR no clear match → ASK USER!
138
+ 5. 🔄 FALLBACK: If all else fails → USE "default" (NEVER "specweave"!)
139
+ ```
140
+
141
+ **⚠️ CRITICAL: IF UNCERTAIN - YOU MUST ASK THE USER!**
142
+ ```
143
+ I found multiple potential projects for this feature:
144
+ - frontend-app (keywords: UI, form, React)
145
+ - backend-api (keywords: API, endpoint)
146
+
147
+ Which project should I assign to this feature?
148
+ ```
149
+
150
+ **❌ NEVER DO THIS:**
151
+ - Silently assign to "specweave" (that's the framework name, not user's project!)
152
+ - Guess without analyzing context
153
+ - Skip asking when genuinely uncertain
154
+
155
+ **✅ CORRECT FALLBACK (when no projects configured):**
156
+ ```
157
+ **Project**: default
158
+ ```
159
+
160
+ **4. STORE the actual IDs for use in spec.md:**
122
161
  ```
123
162
  RESOLVED_PROJECT = "frontend-app" // from projects[].id
124
163
  RESOLVED_BOARD = "digital-ops" // from boardsByProject (2-level only)
125
164
  ```
126
165
 
127
- **4. Now generate spec.md using RESOLVED values (NEVER placeholders!)**
166
+ **5. Now generate spec.md using RESOLVED values (NEVER placeholders!)**
128
167
 
129
168
  ---
130
169
 
@@ -522,63 +561,31 @@ spec_generator:
522
561
  - Living docs auto-grouped by project
523
562
  - External tools (GitHub/JIRA/ADO) receive issues in correct project
524
563
 
525
- ### Legacy Project-Scoped User Story Format (Pre-v0.33.0)
564
+ ### Multi-Project User Story Format (with **Project**: per US)
526
565
 
527
- **❌ LEGACY (Project prefixes - still works but per-US targeting preferred):**
566
+ **✅ CORRECT Format - Every US has `**Project**:`:**
528
567
  ```markdown
529
568
  ## User Stories
530
569
 
531
570
  ### US-001: Thumbnail Upload
532
- As a content creator, I want to upload thumbnails...
533
-
534
- ### US-002: CTR Prediction API
535
- As a system, I want to predict click-through rates...
536
- ```
537
-
538
- **✅ LEGACY (Multi-Project Format with prefixes - use per-US targeting instead):**
539
- ```markdown
540
- ## User Stories by Project
541
-
542
- ### Frontend (sw-thumbnail-ab-fe)
543
-
544
- #### US-FE-001: Thumbnail Upload & Comparison (P1)
545
- **Related Repo**: sw-thumbnail-ab-fe
571
+ **Project**: frontend-app # MANDATORY!
546
572
  **As a** content creator
547
- **I want** to upload multiple thumbnail variants and compare them side-by-side
548
- **So that** I can visually evaluate my options before testing
573
+ **I want** to upload thumbnails
574
+ **So that** I can test different versions
549
575
 
550
576
  **Acceptance Criteria**:
551
- - [ ] **AC-FE-US1-01**: User can drag-and-drop up to 5 thumbnail images (JPG, PNG, WebP)
552
- - [ ] **AC-FE-US1-02**: Images are validated for YouTube specs (1280x720 min, <2MB)
553
- - [ ] **AC-FE-US1-03**: Side-by-side comparison view displays all variants
554
-
555
- ---
556
-
557
- ### Backend (sw-thumbnail-ab-be)
577
+ - [ ] **AC-US1-01**: User can drag-and-drop images
578
+ - [ ] **AC-US1-02**: Images validated for YouTube specs
558
579
 
559
- #### US-BE-001: Thumbnail Analysis API (P1)
560
- **Related Repo**: sw-thumbnail-ab-be
580
+ ### US-002: Thumbnail Analysis API
581
+ **Project**: backend-api # ← MANDATORY! Different project = different folder
561
582
  **As a** frontend application
562
583
  **I want** to call POST /predict-ctr endpoint
563
- **So that** I can get AI-powered click-through rate predictions
564
-
565
- **Acceptance Criteria**:
566
- - [ ] **AC-BE-US1-01**: POST /predict-ctr endpoint accepts thumbnail image
567
- - [ ] **AC-BE-US1-02**: ML model analyzes: face detection, text readability, color psychology
568
-
569
- ---
570
-
571
- ### Shared Library (sw-thumbnail-ab-shared)
572
-
573
- #### US-SHARED-001: Common Types & Validators (P1)
574
- **Related Repo**: sw-thumbnail-ab-shared
575
- **As a** developer in FE or BE repos
576
- **I want** shared TypeScript types and validators
577
- **So that** API contracts are consistent across projects
584
+ **So that** I can get AI-powered predictions
578
585
 
579
586
  **Acceptance Criteria**:
580
- - [ ] **AC-SHARED-US1-01**: ThumbnailMetadata type exported
581
- - [ ] **AC-SHARED-US1-02**: Validation schemas for image specs
587
+ - [ ] **AC-US2-01**: POST /predict-ctr endpoint accepts thumbnail image
588
+ - [ ] **AC-US2-02**: ML model returns prediction score
582
589
  ```
583
590
 
584
591
  ### Project Classification Rules