specweave 0.33.2 → 0.33.3

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 (56) hide show
  1. package/CLAUDE.md +56 -0
  2. package/dist/plugins/specweave-ado/lib/per-us-sync.d.ts +120 -0
  3. package/dist/plugins/specweave-ado/lib/per-us-sync.d.ts.map +1 -0
  4. package/dist/plugins/specweave-ado/lib/per-us-sync.js +276 -0
  5. package/dist/plugins/specweave-ado/lib/per-us-sync.js.map +1 -0
  6. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +4 -1
  7. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  8. package/dist/plugins/specweave-github/lib/github-client-v2.js +13 -3
  9. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  10. package/dist/plugins/specweave-github/lib/per-us-sync.d.ts +97 -0
  11. package/dist/plugins/specweave-github/lib/per-us-sync.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/per-us-sync.js +274 -0
  13. package/dist/plugins/specweave-github/lib/per-us-sync.js.map +1 -0
  14. package/dist/plugins/specweave-jira/lib/per-us-sync.d.ts +113 -0
  15. package/dist/plugins/specweave-jira/lib/per-us-sync.d.ts.map +1 -0
  16. package/dist/plugins/specweave-jira/lib/per-us-sync.js +254 -0
  17. package/dist/plugins/specweave-jira/lib/per-us-sync.js.map +1 -0
  18. package/dist/src/core/config/config-manager.d.ts.map +1 -1
  19. package/dist/src/core/config/config-manager.js +58 -0
  20. package/dist/src/core/config/config-manager.js.map +1 -1
  21. package/dist/src/core/config/types.d.ts +80 -0
  22. package/dist/src/core/config/types.d.ts.map +1 -1
  23. package/dist/src/core/config/types.js.map +1 -1
  24. package/dist/src/core/living-docs/cross-project-sync.d.ts +87 -15
  25. package/dist/src/core/living-docs/cross-project-sync.d.ts.map +1 -1
  26. package/dist/src/core/living-docs/cross-project-sync.js +147 -28
  27. package/dist/src/core/living-docs/cross-project-sync.js.map +1 -1
  28. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  29. package/dist/src/core/living-docs/living-docs-sync.js +26 -22
  30. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  31. package/dist/src/core/living-docs/types.d.ts +24 -3
  32. package/dist/src/core/living-docs/types.d.ts.map +1 -1
  33. package/dist/src/core/types/config.d.ts +79 -0
  34. package/dist/src/core/types/config.d.ts.map +1 -1
  35. package/dist/src/core/types/config.js.map +1 -1
  36. package/dist/src/sync/sync-coordinator.d.ts +20 -0
  37. package/dist/src/sync/sync-coordinator.d.ts.map +1 -1
  38. package/dist/src/sync/sync-coordinator.js +258 -33
  39. package/dist/src/sync/sync-coordinator.js.map +1 -1
  40. package/dist/src/utils/project-resolver.d.ts +156 -0
  41. package/dist/src/utils/project-resolver.d.ts.map +1 -0
  42. package/dist/src/utils/project-resolver.js +587 -0
  43. package/dist/src/utils/project-resolver.js.map +1 -0
  44. package/package.json +1 -1
  45. package/plugins/specweave/hooks/hooks.json +10 -0
  46. package/plugins/specweave/hooks/user-prompt-submit.sh +105 -3
  47. package/plugins/specweave/hooks/v2/guards/per-us-project-validator.sh +281 -0
  48. package/plugins/specweave/hooks/v2/handlers/living-specs-handler.sh +29 -0
  49. package/plugins/specweave-ado/lib/per-us-sync.js +247 -0
  50. package/plugins/specweave-ado/lib/per-us-sync.ts +410 -0
  51. package/plugins/specweave-github/lib/github-client-v2.js +10 -3
  52. package/plugins/specweave-github/lib/github-client-v2.ts +15 -3
  53. package/plugins/specweave-github/lib/per-us-sync.js +241 -0
  54. package/plugins/specweave-github/lib/per-us-sync.ts +375 -0
  55. package/plugins/specweave-jira/lib/per-us-sync.js +224 -0
  56. package/plugins/specweave-jira/lib/per-us-sync.ts +366 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Project Resolver
3
+ *
4
+ * Smart utility that auto-resolves project/board for user stories
5
+ * based on context analysis:
6
+ * - Single project → auto-select
7
+ * - Keyword matching → suggest with confidence
8
+ * - Cross-cutting detection → split across projects
9
+ * - Learned patterns from existing specs
10
+ *
11
+ * Part of increment 0137: Per-US Project/Board Enforcement
12
+ *
13
+ * @module utils/project-resolver
14
+ * @since v0.34.0
15
+ */
16
+ import { type ProjectInfo, type BoardInfo } from './structure-level-detector.js';
17
+ import { Logger } from './logger.js';
18
+ import { CrossCuttingDetector, type CrossCuttingResult, type DetectedPattern } from './cross-cutting-detector.js';
19
+ /**
20
+ * Resolution result for a single user story
21
+ */
22
+ export interface ProjectResolution {
23
+ /** Whether project was successfully resolved */
24
+ resolved: boolean;
25
+ /** Resolved project ID (if resolved) */
26
+ projectId?: string;
27
+ /** Resolved board ID (for 2-level structures) */
28
+ boardId?: string;
29
+ /** Confidence level */
30
+ confidence: 'high' | 'medium' | 'low';
31
+ /** Reason for resolution decision */
32
+ reason: string;
33
+ /** Keywords that matched (if any) */
34
+ matchedKeywords?: string[];
35
+ }
36
+ /**
37
+ * Resolution result for an entire increment
38
+ */
39
+ export interface IncrementResolution {
40
+ /** Whether this is a cross-project increment */
41
+ isCrossProject: boolean;
42
+ /** Default project for USs without explicit assignment */
43
+ defaultProject: string;
44
+ /** Default board for 2-level (optional) */
45
+ defaultBoard?: string;
46
+ /** Suggested project for each US type */
47
+ suggestions: Map<string, ProjectResolution>;
48
+ /** Structure level detected */
49
+ structureLevel: 1 | 2;
50
+ /** Cross-cutting detection result (when detected) */
51
+ crossCuttingResult?: CrossCuttingResult;
52
+ /** Detected patterns for display/logging */
53
+ detectedPatterns?: DetectedPattern[];
54
+ }
55
+ /**
56
+ * Project Resolver
57
+ *
58
+ * Resolves project/board context for user stories based on:
59
+ * 1. Single project auto-selection
60
+ * 2. Learned patterns from existing specs
61
+ * 3. Keyword-based matching
62
+ * 4. Cross-cutting detection
63
+ */
64
+ export declare class ProjectResolver {
65
+ private projectRoot;
66
+ private logger;
67
+ private structureConfig;
68
+ private learnedPatterns;
69
+ private keywordPatterns;
70
+ private crossCuttingDetector;
71
+ constructor(projectRoot: string, options?: {
72
+ logger?: Logger;
73
+ });
74
+ /**
75
+ * Get structure level (1 or 2)
76
+ */
77
+ getStructureLevel(): 1 | 2;
78
+ /**
79
+ * Get available projects
80
+ */
81
+ getProjects(): ProjectInfo[];
82
+ /**
83
+ * Get boards for a project (2-level only)
84
+ */
85
+ getBoards(projectId: string): BoardInfo[];
86
+ /**
87
+ * Learn keyword patterns from existing spec.md files
88
+ */
89
+ learnFromExistingSpecs(): Promise<void>;
90
+ /**
91
+ * Extract keyword → project patterns from a spec file
92
+ */
93
+ private extractPatternsFromSpec;
94
+ /**
95
+ * Check if word is in default patterns
96
+ */
97
+ private isDefaultPattern;
98
+ /**
99
+ * Resolve project for a single user story
100
+ */
101
+ resolveForUserStory(usContent: string): ProjectResolution;
102
+ /**
103
+ * Map suggested project type (frontend, backend, etc.) to actual project ID
104
+ */
105
+ private mapSuggestedTypeToProject;
106
+ /**
107
+ * Resolve board for a user story (2-level structures only)
108
+ */
109
+ resolveBoard(usContent: string, projectId: string): ProjectResolution;
110
+ /**
111
+ * Match content against project keywords
112
+ */
113
+ private matchProjectsByKeywords;
114
+ /**
115
+ * Resolve project context for an entire increment description
116
+ */
117
+ resolveForIncrement(incrementDescription: string): IncrementResolution;
118
+ /**
119
+ * Detect if description indicates cross-project work
120
+ */
121
+ private detectCrossProject;
122
+ /**
123
+ * Check if content matches any keywords
124
+ */
125
+ private matchesKeywords;
126
+ /**
127
+ * Detect cross-cutting concerns using the integrated detector
128
+ * Returns full detection result for advanced use cases
129
+ */
130
+ detectCrossCuttingConcerns(description: string): CrossCuttingResult;
131
+ /**
132
+ * Get the cross-cutting detector instance for direct access
133
+ */
134
+ getCrossCuttingDetector(): CrossCuttingDetector;
135
+ /**
136
+ * Format available projects for display
137
+ */
138
+ formatProjectsForDisplay(): string;
139
+ }
140
+ /**
141
+ * Create a project resolver instance (sync - no pattern learning)
142
+ */
143
+ export declare function createProjectResolver(projectRoot: string, options?: {
144
+ logger?: Logger;
145
+ }): ProjectResolver;
146
+ /**
147
+ * Create a project resolver instance with pattern learning (async)
148
+ *
149
+ * This awaits learnFromExistingSpecs() to ensure patterns are available
150
+ * before the resolver is used.
151
+ */
152
+ export declare function createProjectResolverWithPatterns(projectRoot: string, options?: {
153
+ logger?: Logger;
154
+ }): Promise<ProjectResolver>;
155
+ export type { CrossCuttingResult, DetectedPattern };
156
+ //# sourceMappingURL=project-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-resolver.d.ts","sourceRoot":"","sources":["../../../src/utils/project-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAmD,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAClI,OAAO,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAElH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAElB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,uBAAuB;IACvB,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAEtC,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IAEf,qCAAqC;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,cAAc,EAAE,OAAO,CAAC;IAExB,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IAEvB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,yCAAyC;IACzC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAE5C,+BAA+B;I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