specweave 0.28.17 → 0.28.19
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.
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts +94 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.js +219 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +6 -11
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.js +6 -11
- package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts +19 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js +380 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js.map +1 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts +92 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.js +349 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts +50 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.js +84 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.js.map +1 -0
- package/dist/src/cli/commands/import-external.d.ts.map +1 -1
- package/dist/src/cli/commands/import-external.js +12 -7
- package/dist/src/cli/commands/import-external.js.map +1 -1
- package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/external-import.js +122 -17
- package/dist/src/cli/helpers/init/external-import.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts +65 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js +278 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts +64 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js +251 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js.map +1 -0
- package/dist/src/core/ac-test-validator-cli.js +4 -1
- package/dist/src/core/ac-test-validator-cli.js.map +1 -1
- package/dist/src/core/ac-test-validator.d.ts.map +1 -1
- package/dist/src/core/ac-test-validator.js +4 -1
- package/dist/src/core/ac-test-validator.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +75 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +137 -5
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js +63 -0
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/dist/src/importers/external-importer.d.ts +25 -0
- package/dist/src/importers/external-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.js +5 -3
- package/dist/src/importers/github-importer.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +51 -0
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +39 -12
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/init/repo/types.d.ts +1 -1
- package/dist/src/living-docs/fs-id-allocator.d.ts +72 -3
- package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.js +142 -16
- package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
- package/dist/src/locales/de/cli.json +14 -0
- package/dist/src/locales/es/cli.json +14 -0
- package/dist/src/locales/fr/cli.json +14 -0
- package/dist/src/locales/ja/cli.json +14 -0
- package/dist/src/locales/ko/cli.json +14 -0
- package/dist/src/locales/pt/cli.json +14 -0
- package/dist/src/locales/ru/cli.json +14 -0
- package/dist/src/locales/zh/cli.json +14 -0
- package/dist/src/utils/chalk-fallback.d.ts +38 -0
- package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
- package/dist/src/utils/chalk-fallback.js +118 -0
- package/dist/src/utils/chalk-fallback.js.map +1 -0
- package/dist/src/utils/project-id-generator.d.ts +127 -0
- package/dist/src/utils/project-id-generator.d.ts.map +1 -0
- package/dist/src/utils/project-id-generator.js +228 -0
- package/dist/src/utils/project-id-generator.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/agents/pm/AGENT.md +202 -0
- package/plugins/specweave/commands/specweave-import-external.md +5 -3
- package/plugins/specweave/commands/specweave-sync-docs.md +6 -2
- package/plugins/specweave/hooks/pre-task-completion.sh +35 -17
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.d.ts +16 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js +121 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.d.ts +111 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.js +295 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +75 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.d.ts +38 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.js +118 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.js.map +1 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.d.ts +179 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.js +319 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -0
- package/plugins/specweave/skills/code-reviewer/SKILL.md +1 -1
- package/plugins/specweave/skills/docs-updater/SKILL.md +61 -0
- package/plugins/specweave/skills/increment-planner/SKILL.md +10 -335
- package/plugins/specweave/skills/increment-planner/templates/metadata.json +13 -0
- package/plugins/specweave/skills/increment-planner/templates/plan.md +50 -0
- package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +86 -0
- package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +50 -0
- package/plugins/specweave/skills/increment-planner/templates/tasks-multi-project.md +86 -0
- package/plugins/specweave/skills/increment-planner/templates/tasks-single-project.md +48 -0
- package/plugins/specweave-ado/commands/specweave-ado-import-areas.md +358 -0
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +1 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +1 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +1 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +1 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +1 -0
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +14 -10
- package/plugins/specweave-github/commands/specweave-github-sync.md +57 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +68 -0
- package/plugins/specweave-github/lib/github-feature-sync.ts +6 -11
- package/plugins/specweave-github/lib/github-increment-sync-cli.js +343 -0
- package/plugins/specweave-github/lib/github-increment-sync-cli.ts +484 -0
- package/plugins/specweave-github/lib/increment-issue-builder.js +368 -0
- package/plugins/specweave-github/lib/increment-issue-builder.ts +471 -0
- package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +19 -24
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +15 -23
- package/plugins/specweave-jira/commands/specweave-jira-import-boards.md +331 -0
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +16 -20
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +18 -19
- package/plugins/specweave-ml/skills/{ml-pipeline-workflow → mlops-dag-builder}/SKILL.md +18 -14
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +102 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +1 -1
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +10 -122
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +0 -70
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/epic-content-builder.js +0 -258
- package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +0 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +0 -83
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js +0 -466
- package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +0 -1
- package/plugins/specweave-github/lib/epic-content-builder.js +0 -265
- package/plugins/specweave-github/lib/epic-content-builder.ts +0 -376
- package/plugins/specweave-github/lib/github-epic-sync.js +0 -488
- package/plugins/specweave-github/lib/github-epic-sync.ts +0 -715
|
@@ -615,6 +615,208 @@ With project-scoped stories:
|
|
|
615
615
|
|
|
616
616
|
---
|
|
617
617
|
|
|
618
|
+
## 🌐 Multi-Project User Stories (v0.29.0+ - JIRA Boards/ADO Area Paths)
|
|
619
|
+
|
|
620
|
+
**⚠️ CRITICAL: User Stories MUST Consider ALL Relevant Projects!**
|
|
621
|
+
|
|
622
|
+
When working with enterprise setups where JIRA boards or ADO area paths map to SpecWeave projects, a single user story often spans MULTIPLE projects.
|
|
623
|
+
|
|
624
|
+
### STEP 0C: Detect Multi-Project Mode (Board/Area Path Mapping)
|
|
625
|
+
|
|
626
|
+
**YOU MUST CHECK THIS BEFORE WRITING ANY USER STORIES:**
|
|
627
|
+
|
|
628
|
+
```bash
|
|
629
|
+
# Check for JIRA board mapping
|
|
630
|
+
cat .specweave/config.json | jq '.sync.profiles[].config.boardMapping'
|
|
631
|
+
|
|
632
|
+
# Check for ADO area path mapping
|
|
633
|
+
cat .specweave/config.json | jq '.sync.profiles[].config.areaPathMapping'
|
|
634
|
+
|
|
635
|
+
# Check for 2-level spec structure
|
|
636
|
+
ls -la .specweave/docs/internal/specs/JIRA-*/
|
|
637
|
+
ls -la .specweave/docs/internal/specs/ADO-*/
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
**Decision Flow:**
|
|
641
|
+
```
|
|
642
|
+
Is boardMapping or areaPathMapping configured?
|
|
643
|
+
→ YES → MUST use multi-project-aware user stories
|
|
644
|
+
Each US must list ALL affected projects with scope
|
|
645
|
+
→ NO → Check for umbrella mode (see Step 0)
|
|
646
|
+
Use standard or project-scoped user stories
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### Multi-Project User Story Format (v0.29.0+)
|
|
650
|
+
|
|
651
|
+
**When board/area path mapping is detected, EVERY user story MUST:**
|
|
652
|
+
|
|
653
|
+
1. List ALL projects it touches
|
|
654
|
+
2. Define scope per project
|
|
655
|
+
3. Identify cross-project dependencies
|
|
656
|
+
|
|
657
|
+
**Example: OAuth Implementation Spanning 3 Projects**
|
|
658
|
+
|
|
659
|
+
```markdown
|
|
660
|
+
### US-001: OAuth Authentication (Priority: P0 - Critical)
|
|
661
|
+
|
|
662
|
+
**Projects Involved**:
|
|
663
|
+
| Project | Scope | Keywords |
|
|
664
|
+
|---------|-------|----------|
|
|
665
|
+
| BE (Backend Board) | OAuth API endpoints, token validation, session management | api, oauth, token, session |
|
|
666
|
+
| FE (Frontend Board) | Login UI with OIDC, token storage, logout flow | ui, login, oidc, logout |
|
|
667
|
+
| Shared | Common auth types, interfaces, JWT utilities | types, interfaces, jwt |
|
|
668
|
+
|
|
669
|
+
**As a** user
|
|
670
|
+
**I want** to log in using Google OAuth
|
|
671
|
+
**So that** I can access the system without creating a new password
|
|
672
|
+
|
|
673
|
+
**Cross-Project Dependencies**:
|
|
674
|
+
- FE depends on Shared (auth types/interfaces)
|
|
675
|
+
- BE depends on Shared (JWT utilities)
|
|
676
|
+
- FE calls BE (OAuth callback API)
|
|
677
|
+
|
|
678
|
+
**Acceptance Criteria**:
|
|
679
|
+
|
|
680
|
+
**BE Project (Backend Board)**:
|
|
681
|
+
- [ ] **AC-BE-US1-01**: POST /api/auth/oauth/google initiates OAuth flow
|
|
682
|
+
- Priority: P0
|
|
683
|
+
- Testable: Yes (integration test)
|
|
684
|
+
- [ ] **AC-BE-US1-02**: GET /api/auth/oauth/callback processes OAuth response
|
|
685
|
+
- Priority: P0
|
|
686
|
+
- Testable: Yes (integration test)
|
|
687
|
+
- [ ] **AC-BE-US1-03**: JWT tokens generated with 1-hour expiry
|
|
688
|
+
- Priority: P0
|
|
689
|
+
- Testable: Yes (unit test)
|
|
690
|
+
|
|
691
|
+
**FE Project (Frontend Board)**:
|
|
692
|
+
- [ ] **AC-FE-US1-01**: "Sign in with Google" button visible on login page
|
|
693
|
+
- Priority: P0
|
|
694
|
+
- Testable: Yes (E2E test)
|
|
695
|
+
- [ ] **AC-FE-US1-02**: OAuth redirect handled correctly
|
|
696
|
+
- Priority: P0
|
|
697
|
+
- Testable: Yes (E2E test)
|
|
698
|
+
- [ ] **AC-FE-US1-03**: Token stored securely in HTTP-only cookie
|
|
699
|
+
- Priority: P0
|
|
700
|
+
- Testable: Yes (security test)
|
|
701
|
+
|
|
702
|
+
**Shared Project**:
|
|
703
|
+
- [ ] **AC-SHARED-US1-01**: AuthUser interface defined with OAuth fields
|
|
704
|
+
- Priority: P0
|
|
705
|
+
- Testable: Yes (type check)
|
|
706
|
+
- [ ] **AC-SHARED-US1-02**: JWT decode utility function
|
|
707
|
+
- Priority: P0
|
|
708
|
+
- Testable: Yes (unit test)
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
### spec.md Frontmatter for Multi-Project US
|
|
712
|
+
|
|
713
|
+
```yaml
|
|
714
|
+
---
|
|
715
|
+
increment: 0001-oauth-implementation
|
|
716
|
+
feature_id: FS-001
|
|
717
|
+
status: active
|
|
718
|
+
|
|
719
|
+
# Single project (legacy - backward compatible)
|
|
720
|
+
# project: BE
|
|
721
|
+
|
|
722
|
+
# Multi-project user story (v0.29.0+)
|
|
723
|
+
projects:
|
|
724
|
+
- id: BE
|
|
725
|
+
scope: "OAuth API endpoints, token validation, session management"
|
|
726
|
+
keywords: ["api", "oauth", "token", "session"]
|
|
727
|
+
effort_percentage: 50
|
|
728
|
+
- id: FE
|
|
729
|
+
scope: "Login UI with OIDC, token storage, logout flow"
|
|
730
|
+
keywords: ["ui", "login", "oidc", "logout"]
|
|
731
|
+
effort_percentage: 35
|
|
732
|
+
- id: Shared
|
|
733
|
+
scope: "Common auth types, interfaces, JWT utilities"
|
|
734
|
+
keywords: ["types", "interfaces", "jwt"]
|
|
735
|
+
effort_percentage: 15
|
|
736
|
+
|
|
737
|
+
cross_dependencies:
|
|
738
|
+
- from: FE
|
|
739
|
+
to: Shared
|
|
740
|
+
reason: "FE uses auth types from Shared"
|
|
741
|
+
- from: BE
|
|
742
|
+
to: Shared
|
|
743
|
+
reason: "BE uses JWT utilities from Shared"
|
|
744
|
+
- from: FE
|
|
745
|
+
to: BE
|
|
746
|
+
reason: "FE calls OAuth callback API"
|
|
747
|
+
|
|
748
|
+
sync_strategy: linked # 'linked' | 'primary-only' | 'all'
|
|
749
|
+
primary_project: BE # Which project owns the main issue
|
|
750
|
+
---
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### Sync Behavior for Multi-Project US
|
|
754
|
+
|
|
755
|
+
**sync_strategy options**:
|
|
756
|
+
|
|
757
|
+
| Strategy | Behavior |
|
|
758
|
+
|----------|----------|
|
|
759
|
+
| `linked` | Create main issue in primary_project, linked child issues in others |
|
|
760
|
+
| `primary-only` | Only create issue in primary_project |
|
|
761
|
+
| `all` | Create full issues in all projects (may cause duplication) |
|
|
762
|
+
|
|
763
|
+
**Example: `linked` strategy with JIRA boards**:
|
|
764
|
+
```
|
|
765
|
+
JIRA Project: CORE
|
|
766
|
+
|
|
767
|
+
Backend Board (BE project):
|
|
768
|
+
→ CORE-123: [Epic] OAuth Authentication (parent)
|
|
769
|
+
→ CORE-124: OAuth API endpoints
|
|
770
|
+
→ CORE-125: Token validation
|
|
771
|
+
|
|
772
|
+
Frontend Board (FE project):
|
|
773
|
+
→ CORE-130: OAuth Login UI (linked to CORE-123)
|
|
774
|
+
→ CORE-131: Google sign-in button
|
|
775
|
+
→ CORE-132: Token storage
|
|
776
|
+
|
|
777
|
+
Both boards can track progress, but CORE-123 is the parent epic.
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
### Why Multi-Project Awareness Matters
|
|
781
|
+
|
|
782
|
+
**Without multi-project awareness**:
|
|
783
|
+
- ❌ US created in ONE board/area only (wrong!)
|
|
784
|
+
- ❌ Cross-team dependencies unclear
|
|
785
|
+
- ❌ Frontend dev doesn't know backend is a blocker
|
|
786
|
+
- ❌ Shared changes not communicated to dependent teams
|
|
787
|
+
- ❌ Progress tracking incomplete
|
|
788
|
+
|
|
789
|
+
**With multi-project awareness**:
|
|
790
|
+
- ✅ Each board/area gets relevant ACs
|
|
791
|
+
- ✅ Clear cross-project dependencies
|
|
792
|
+
- ✅ All teams know their scope
|
|
793
|
+
- ✅ Linked issues enable coordination
|
|
794
|
+
- ✅ Progress tracked across all projects
|
|
795
|
+
|
|
796
|
+
### PM Agent Workflow for Multi-Project US
|
|
797
|
+
|
|
798
|
+
1. **Detect** board/area path mapping in config.json
|
|
799
|
+
2. **Analyze** user story for multi-project scope
|
|
800
|
+
3. **Ask** user: "This feature spans BE, FE, and Shared. Should I create linked issues?"
|
|
801
|
+
4. **Generate** spec.md with `projects` array in frontmatter
|
|
802
|
+
5. **Create** ACs grouped by project (AC-BE-*, AC-FE-*, AC-SHARED-*)
|
|
803
|
+
6. **Document** cross-project dependencies
|
|
804
|
+
7. **Sync** to external tool based on sync_strategy
|
|
805
|
+
|
|
806
|
+
### Validation Checklist for Multi-Project US
|
|
807
|
+
|
|
808
|
+
Before finalizing any user story:
|
|
809
|
+
|
|
810
|
+
- [ ] Analyzed scope across ALL configured projects (BE, FE, Shared, etc.)
|
|
811
|
+
- [ ] `projects` array in frontmatter lists all affected projects
|
|
812
|
+
- [ ] Each project has defined scope and keywords
|
|
813
|
+
- [ ] ACs are grouped by project with correct prefixes
|
|
814
|
+
- [ ] Cross-project dependencies documented
|
|
815
|
+
- [ ] sync_strategy explicitly chosen
|
|
816
|
+
- [ ] primary_project designated for linked strategy
|
|
817
|
+
|
|
818
|
+
---
|
|
819
|
+
|
|
618
820
|
**Role**: Product Manager specialized in product strategy, requirements gathering, and feature prioritization.
|
|
619
821
|
|
|
620
822
|
## Purpose
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specweave:import-external
|
|
3
|
-
description:
|
|
3
|
+
description: Pull external work items from GitHub, JIRA, or Azure DevOps into living docs as READ-ONLY REFERENCES (not increments). To implement imported items, manually create an increment. Supports time range filtering and dry-run mode.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Import External Work Items
|
|
6
|
+
# Import External Work Items (Reference Import)
|
|
7
7
|
|
|
8
|
-
Import work items from GitHub (issues/milestones), JIRA (epics/stories), or Azure DevOps (work items) into SpecWeave living docs
|
|
8
|
+
Import work items from GitHub (issues/milestones), JIRA (epics/stories), or Azure DevOps (work items) into SpecWeave living docs **as read-only references**.
|
|
9
|
+
|
|
10
|
+
> **Important**: This command creates a **reference catalog**, NOT increments. Imported items have E-suffix IDs (US-001E, FS-042E). To implement an imported item, you must **manually create an increment** that references it.
|
|
9
11
|
|
|
10
12
|
## What This Does
|
|
11
13
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specweave:sync-docs
|
|
3
|
-
description:
|
|
3
|
+
description: Strategic documentation sync - review docs before implementation (pull context) OR export learnings after implementation (push to living docs). NOT bidirectional - two separate one-way operations at different phases.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Sync Documentation
|
|
7
7
|
|
|
8
|
-
You are executing the SpecWeave documentation sync command. This handles
|
|
8
|
+
You are executing the SpecWeave strategic documentation sync command. This handles phase-based documentation synchronization:
|
|
9
|
+
- **Review mode**: Pull strategic docs for pre-implementation context
|
|
10
|
+
- **Update mode**: Push implementation learnings to living docs
|
|
11
|
+
|
|
12
|
+
**Note**: This is NOT bidirectional sync (simultaneous two-way). It's two separate one-way operations at different project phases.
|
|
9
13
|
|
|
10
14
|
---
|
|
11
15
|
|
|
@@ -38,20 +38,31 @@ if [[ "${SPECWEAVE_DISABLE_HOOKS:-0}" == "1" ]]; then
|
|
|
38
38
|
exit 0
|
|
39
39
|
fi
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
# Capture stdin FIRST to extract cwd from Claude's JSON input
|
|
42
|
+
_EARLY_STDIN=$(mktemp)
|
|
43
|
+
cat > "$_EARLY_STDIN"
|
|
44
|
+
|
|
45
|
+
# Extract cwd from JSON (Claude always provides this)
|
|
46
|
+
if command -v jq >/dev/null 2>&1; then
|
|
47
|
+
PROJECT_ROOT=$(jq -r '.cwd // empty' "$_EARLY_STDIN" 2>/dev/null)
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Fallback: find project root by walking up from script location
|
|
51
|
+
if [ -z "$PROJECT_ROOT" ] || [ ! -d "$PROJECT_ROOT/.specweave" ]; then
|
|
52
|
+
find_project_root() {
|
|
53
|
+
local dir="$1"
|
|
54
|
+
while [ "$dir" != "/" ]; do
|
|
55
|
+
if [ -d "$dir/.specweave" ]; then
|
|
56
|
+
echo "$dir"
|
|
57
|
+
return 0
|
|
58
|
+
fi
|
|
59
|
+
dir="$(dirname "$dir")"
|
|
60
|
+
done
|
|
61
|
+
pwd
|
|
62
|
+
}
|
|
63
|
+
PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
64
|
+
fi
|
|
53
65
|
|
|
54
|
-
PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
55
66
|
cd "$PROJECT_ROOT" 2>/dev/null || true
|
|
56
67
|
|
|
57
68
|
# ============================================================================
|
|
@@ -129,8 +140,8 @@ echo "[$(date)] 🔒 Pre-task-completion hook fired" >> "$DEBUG_LOG" 2>/dev/null
|
|
|
129
140
|
# CAPTURE INPUT
|
|
130
141
|
# ============================================================================
|
|
131
142
|
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
# Reuse the early stdin capture
|
|
144
|
+
STDIN_DATA="$_EARLY_STDIN"
|
|
134
145
|
|
|
135
146
|
echo "[$(date)] Input JSON:" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
136
147
|
cat "$STDIN_DATA" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
@@ -201,13 +212,20 @@ fi
|
|
|
201
212
|
echo "[$(date)] 🧪 Running AC test validation for $CURRENT_INCREMENT" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
202
213
|
|
|
203
214
|
# Determine which validation script to use
|
|
215
|
+
# Priority order:
|
|
216
|
+
# 1. SpecWeave development (dist/src/core/) - for contributors
|
|
217
|
+
# 2. npm package installation (node_modules/specweave/dist/)
|
|
218
|
+
# 3. Marketplace plugin (lib/vendor/core/) - for end users
|
|
204
219
|
VALIDATOR_SCRIPT=""
|
|
205
220
|
if [ -f "$PROJECT_ROOT/dist/src/core/ac-test-validator-cli.js" ]; then
|
|
221
|
+
# SpecWeave development repo
|
|
206
222
|
VALIDATOR_SCRIPT="$PROJECT_ROOT/dist/src/core/ac-test-validator-cli.js"
|
|
207
223
|
elif [ -f "$PROJECT_ROOT/node_modules/specweave/dist/src/core/ac-test-validator-cli.js" ]; then
|
|
224
|
+
# npm package installation
|
|
208
225
|
VALIDATOR_SCRIPT="$PROJECT_ROOT/node_modules/specweave/dist/src/core/ac-test-validator-cli.js"
|
|
209
|
-
elif [ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/
|
|
210
|
-
|
|
226
|
+
elif [ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/lib/vendor/core/ac-test-validator-cli.js" ]; then
|
|
227
|
+
# Marketplace plugin (bundled in lib/vendor/)
|
|
228
|
+
VALIDATOR_SCRIPT="${CLAUDE_PLUGIN_ROOT}/lib/vendor/core/ac-test-validator-cli.js"
|
|
211
229
|
fi
|
|
212
230
|
|
|
213
231
|
if [ -z "$VALIDATOR_SCRIPT" ] || ! command -v node &> /dev/null; then
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AC Test Validator CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for validating Acceptance Criteria tests before task completion.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node ac-test-validator-cli.js <increment-id>
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 - All AC tests passed
|
|
12
|
+
* 1 - Validation failed (tests failed or missing)
|
|
13
|
+
* 2 - Configuration error (missing files, invalid setup)
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=ac-test-validator-cli.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AC Test Validator CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for validating Acceptance Criteria tests before task completion.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node ac-test-validator-cli.js <increment-id>
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 - All AC tests passed
|
|
12
|
+
* 1 - Validation failed (tests failed or missing)
|
|
13
|
+
* 2 - Configuration error (missing files, invalid setup)
|
|
14
|
+
*/
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import * as fs from '../utils/fs-native.js';
|
|
17
|
+
import { createACTestValidator } from './ac-test-validator.js';
|
|
18
|
+
import { parseTasksWithUSLinks, getAllTasks } from '../generators/spec/task-parser.js';
|
|
19
|
+
import chalkFallback, { getChalk } from '../utils/chalk-fallback.js';
|
|
20
|
+
// Use chalk if available, otherwise fallback to ANSI codes
|
|
21
|
+
let chalk = chalkFallback;
|
|
22
|
+
getChalk().then(c => { chalk = c; }).catch(() => { });
|
|
23
|
+
async function main() {
|
|
24
|
+
// Parse arguments
|
|
25
|
+
const incrementId = process.argv[2];
|
|
26
|
+
if (!incrementId) {
|
|
27
|
+
console.error(chalk.red('Error: Missing increment ID'));
|
|
28
|
+
console.error(chalk.gray('Usage: node ac-test-validator-cli.js <increment-id>'));
|
|
29
|
+
process.exit(2);
|
|
30
|
+
}
|
|
31
|
+
// Find project root
|
|
32
|
+
const projectRoot = process.cwd();
|
|
33
|
+
// Validate increment exists
|
|
34
|
+
const incrementPath = path.join(projectRoot, '.specweave/increments', incrementId);
|
|
35
|
+
if (!await fs.pathExists(incrementPath)) {
|
|
36
|
+
console.error(chalk.red(`Error: Increment not found: ${incrementId}`));
|
|
37
|
+
process.exit(2);
|
|
38
|
+
}
|
|
39
|
+
const tasksPath = path.join(incrementPath, 'tasks.md');
|
|
40
|
+
if (!await fs.pathExists(tasksPath)) {
|
|
41
|
+
console.error(chalk.red(`Error: tasks.md not found in ${incrementId}`));
|
|
42
|
+
process.exit(2);
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
// Parse tasks
|
|
46
|
+
console.log(chalk.blue('\n[AC Test Validator]') + ' Parsing tasks...');
|
|
47
|
+
const tasksByUS = parseTasksWithUSLinks(tasksPath);
|
|
48
|
+
const tasks = getAllTasks(tasksByUS);
|
|
49
|
+
// Filter tasks being marked complete (looking for recently modified tasks)
|
|
50
|
+
// For now, validate ALL tasks with ACs
|
|
51
|
+
const tasksToValidate = tasks.filter(t => {
|
|
52
|
+
return t.satisfiesACs && t.satisfiesACs.length > 0 && t.status === 'completed';
|
|
53
|
+
});
|
|
54
|
+
if (tasksToValidate.length === 0) {
|
|
55
|
+
console.log(chalk.yellow('No completed tasks with Acceptance Criteria to validate.'));
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
console.log(chalk.blue(`Found ${tasksToValidate.length} completed task(s) with ACs to validate\n`));
|
|
59
|
+
// Create validator
|
|
60
|
+
const validator = await createACTestValidator(projectRoot);
|
|
61
|
+
// Validate each task
|
|
62
|
+
const results = [];
|
|
63
|
+
let allPassed = true;
|
|
64
|
+
for (const task of tasksToValidate) {
|
|
65
|
+
console.log(chalk.bold(`\nValidating ${task.id}: ${task.title}`));
|
|
66
|
+
const result = await validator.validateTask(task, projectRoot);
|
|
67
|
+
results.push(result);
|
|
68
|
+
// Display formatted result
|
|
69
|
+
console.log(validator.formatResult(result));
|
|
70
|
+
if (!result.passed) {
|
|
71
|
+
allPassed = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Overall summary
|
|
75
|
+
console.log(chalk.bold('\n' + '='.repeat(60)));
|
|
76
|
+
console.log(chalk.bold('OVERALL VALIDATION SUMMARY'));
|
|
77
|
+
console.log('='.repeat(60));
|
|
78
|
+
const totalTasks = results.length;
|
|
79
|
+
const passedTasks = results.filter(r => r.passed).length;
|
|
80
|
+
const failedTasks = totalTasks - passedTasks;
|
|
81
|
+
console.log(`Tasks Validated: ${totalTasks}`);
|
|
82
|
+
console.log(`Passed: ${chalk.green(passedTasks)}`);
|
|
83
|
+
console.log(`Failed: ${chalk.red(failedTasks)}`);
|
|
84
|
+
const totalACs = results.reduce((sum, r) => sum + r.summary.totalACs, 0);
|
|
85
|
+
const acsPassed = results.reduce((sum, r) => sum + r.summary.acsTested, 0);
|
|
86
|
+
const acsFailed = totalACs - acsPassed;
|
|
87
|
+
console.log(`\nTotal ACs: ${totalACs}`);
|
|
88
|
+
console.log(`ACs with Passing Tests: ${chalk.green(acsPassed)}`);
|
|
89
|
+
console.log(`ACs with Failing Tests: ${chalk.red(acsFailed)}`);
|
|
90
|
+
console.log('='.repeat(60));
|
|
91
|
+
if (allPassed) {
|
|
92
|
+
console.log(chalk.green.bold('\n✓ ALL VALIDATIONS PASSED\n'));
|
|
93
|
+
console.log(chalk.green('All Acceptance Criteria have passing tests.'));
|
|
94
|
+
console.log(chalk.green('Task completion allowed.\n'));
|
|
95
|
+
process.exit(0);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
console.log(chalk.red.bold('\n✗ VALIDATION FAILED\n'));
|
|
99
|
+
console.log(chalk.red('Some Acceptance Criteria have failing or missing tests.'));
|
|
100
|
+
console.log(chalk.red('Task completion blocked until all tests pass.\n'));
|
|
101
|
+
console.log(chalk.yellow('Fix the failing tests and try again.'));
|
|
102
|
+
console.log(chalk.gray('Run tests manually: npm test\n'));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error(chalk.red('\nValidation Error:'));
|
|
108
|
+
console.error(chalk.red(error.message));
|
|
109
|
+
if (error.stack) {
|
|
110
|
+
console.error(chalk.gray('\nStack trace:'));
|
|
111
|
+
console.error(chalk.gray(error.stack));
|
|
112
|
+
}
|
|
113
|
+
process.exit(2);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Run CLI
|
|
117
|
+
main().catch(error => {
|
|
118
|
+
console.error(chalk.red('Fatal error:'), error);
|
|
119
|
+
process.exit(2);
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=ac-test-validator-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ac-test-validator-cli.js","sourceRoot":"","sources":["../../../src/core/ac-test-validator-cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,uBAAuB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CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IAEH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAExC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,UAAU;AACV,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AC Test Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates that all Acceptance Criteria linked to a task have passing tests
|
|
5
|
+
* before allowing the task to be marked complete.
|
|
6
|
+
*
|
|
7
|
+
* **CRITICAL QUALITY GATE**: This is the enforcement point that prevents
|
|
8
|
+
* tasks from being marked complete without validated ACs.
|
|
9
|
+
*
|
|
10
|
+
* Workflow:
|
|
11
|
+
* 1. Task completion requested via TodoWrite
|
|
12
|
+
* 2. Validator extracts task's satisfiesACs field
|
|
13
|
+
* 3. Validator finds corresponding test files from Test Plan section
|
|
14
|
+
* 4. Validator runs tests using configured test runner (vitest/jest)
|
|
15
|
+
* 5. If ALL tests pass → Allow completion, auto-check ACs in spec.md
|
|
16
|
+
* 6. If ANY test fails → Block completion, show detailed error
|
|
17
|
+
*/
|
|
18
|
+
import { Task } from '../generators/spec/task-parser.js';
|
|
19
|
+
/**
|
|
20
|
+
* Test validation result
|
|
21
|
+
*/
|
|
22
|
+
export interface ACTestValidationResult {
|
|
23
|
+
/** Whether all tests passed */
|
|
24
|
+
passed: boolean;
|
|
25
|
+
/** Task ID being validated */
|
|
26
|
+
taskId: string;
|
|
27
|
+
/** AC-IDs this task satisfies */
|
|
28
|
+
acIds: string[];
|
|
29
|
+
/** Test results by AC-ID */
|
|
30
|
+
testResults: Map<string, ACTestResult>;
|
|
31
|
+
/** Overall summary */
|
|
32
|
+
summary: {
|
|
33
|
+
totalACs: number;
|
|
34
|
+
acsTested: number;
|
|
35
|
+
acsUntested: number;
|
|
36
|
+
testsPassed: number;
|
|
37
|
+
testsFailed: number;
|
|
38
|
+
};
|
|
39
|
+
/** Detailed error messages (if validation failed) */
|
|
40
|
+
errors: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Test result for a single AC
|
|
44
|
+
*/
|
|
45
|
+
export interface ACTestResult {
|
|
46
|
+
acId: string;
|
|
47
|
+
testFile?: string;
|
|
48
|
+
testCases: string[];
|
|
49
|
+
passed: boolean;
|
|
50
|
+
duration: number;
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Test runner configuration
|
|
55
|
+
*/
|
|
56
|
+
export interface TestRunnerConfig {
|
|
57
|
+
/** Test runner command (e.g., "npm test", "vitest run") */
|
|
58
|
+
command: string;
|
|
59
|
+
/** Test file pattern (glob pattern for test files) */
|
|
60
|
+
pattern: string;
|
|
61
|
+
/** Working directory for test execution */
|
|
62
|
+
cwd: string;
|
|
63
|
+
/** Environment variables for test execution */
|
|
64
|
+
env?: Record<string, string>;
|
|
65
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
66
|
+
timeout?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* AC Test Validator - Core validation engine
|
|
70
|
+
*/
|
|
71
|
+
export declare class ACTestValidator {
|
|
72
|
+
private config;
|
|
73
|
+
constructor(config: TestRunnerConfig);
|
|
74
|
+
/**
|
|
75
|
+
* Validate all ACs for a task have passing tests
|
|
76
|
+
*
|
|
77
|
+
* @param task - Task to validate (must have satisfiesACs field)
|
|
78
|
+
* @param projectRoot - Project root directory
|
|
79
|
+
* @returns Validation result
|
|
80
|
+
*/
|
|
81
|
+
validateTask(task: Task, projectRoot: string): Promise<ACTestValidationResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Validate a single AC has passing tests
|
|
84
|
+
*/
|
|
85
|
+
private validateAC;
|
|
86
|
+
/**
|
|
87
|
+
* Build test command with AC-ID filter
|
|
88
|
+
*/
|
|
89
|
+
private buildTestCommand;
|
|
90
|
+
/**
|
|
91
|
+
* Extract test case names from test output
|
|
92
|
+
*/
|
|
93
|
+
private extractTestCases;
|
|
94
|
+
/**
|
|
95
|
+
* Extract failure message from test output
|
|
96
|
+
*/
|
|
97
|
+
private extractFailureMessage;
|
|
98
|
+
/**
|
|
99
|
+
* Extract test file path from task description (Test Plan section)
|
|
100
|
+
*/
|
|
101
|
+
private extractTestFile;
|
|
102
|
+
/**
|
|
103
|
+
* Format validation result for display
|
|
104
|
+
*/
|
|
105
|
+
formatResult(result: ACTestValidationResult): string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create AC test validator from project config
|
|
109
|
+
*/
|
|
110
|
+
export declare function createACTestValidator(projectRoot: string): Promise<ACTestValidator>;
|
|
111
|
+
//# sourceMappingURL=ac-test-validator.d.ts.map
|