specweave 1.0.71 → 1.0.72
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/src/core/auto/e2e-coverage.d.ts +248 -0
- package/dist/src/core/auto/e2e-coverage.d.ts.map +1 -0
- package/dist/src/core/auto/e2e-coverage.js +871 -0
- package/dist/src/core/auto/e2e-coverage.js.map +1 -0
- package/dist/src/core/auto/increment-planner.js +7 -1
- package/dist/src/core/auto/increment-planner.js.map +1 -1
- package/dist/src/core/auto/index.d.ts +2 -0
- package/dist/src/core/auto/index.d.ts.map +1 -1
- package/dist/src/core/auto/index.js +4 -0
- package/dist/src/core/auto/index.js.map +1 -1
- package/dist/src/core/auto/plan-approval.d.ts +104 -0
- package/dist/src/core/auto/plan-approval.d.ts.map +1 -0
- package/dist/src/core/auto/plan-approval.js +361 -0
- package/dist/src/core/auto/plan-approval.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/commands/auto.md +86 -0
- package/plugins/specweave/hooks/lib/resolve-package.sh +126 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +47 -3
- package/plugins/specweave/hooks/stop-auto.sh +119 -0
- package/plugins/specweave/hooks/v2/handlers/github-sync-handler.sh +8 -0
- package/plugins/specweave/hooks/v2/handlers/living-docs-handler.sh +10 -3
- package/plugins/specweave/hooks/v2/handlers/living-specs-handler.sh +18 -7
- package/plugins/specweave/hooks/v2/handlers/project-bridge-handler.sh +10 -3
- package/plugins/specweave/hooks/v2/session-end.sh +50 -2
- package/plugins/specweave/hooks/v2/session-start.sh +68 -4
- package/plugins/specweave/scripts/chunk-prompt.js +204 -0
- package/plugins/specweave/scripts/setup-auto.sh +66 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Coverage Manifest
|
|
3
|
+
*
|
|
4
|
+
* Tracks which routes, actions, and viewports have E2E test coverage.
|
|
5
|
+
* Auto-generates manifest from project routes (Next.js, React Router, etc.).
|
|
6
|
+
*
|
|
7
|
+
* @module e2e-coverage
|
|
8
|
+
*/
|
|
9
|
+
export interface RouteEntry {
|
|
10
|
+
path: string;
|
|
11
|
+
tested: boolean;
|
|
12
|
+
viewports: string[];
|
|
13
|
+
lastTested?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ActionEntry {
|
|
16
|
+
id: string;
|
|
17
|
+
description: string;
|
|
18
|
+
tested: boolean;
|
|
19
|
+
lastTested?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ViewportsCovered {
|
|
22
|
+
mobile: boolean;
|
|
23
|
+
tablet: boolean;
|
|
24
|
+
desktop: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface CoverageStats {
|
|
27
|
+
routes: number;
|
|
28
|
+
actions: number;
|
|
29
|
+
viewports: number;
|
|
30
|
+
}
|
|
31
|
+
export interface E2ECoverageManifest {
|
|
32
|
+
version: string;
|
|
33
|
+
generatedAt: string;
|
|
34
|
+
framework?: string;
|
|
35
|
+
routes: Record<string, RouteEntry>;
|
|
36
|
+
criticalActions: Record<string, ActionEntry>;
|
|
37
|
+
viewportsCovered: ViewportsCovered;
|
|
38
|
+
coverage: CoverageStats;
|
|
39
|
+
}
|
|
40
|
+
export type FrameworkType = 'nextjs-pages' | 'nextjs-app' | 'react-router' | 'vue-router' | 'svelte-kit' | 'remix' | 'unknown';
|
|
41
|
+
/**
|
|
42
|
+
* Default viewports for responsive testing
|
|
43
|
+
*/
|
|
44
|
+
export declare const DEFAULT_VIEWPORTS: {
|
|
45
|
+
mobile: {
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
};
|
|
49
|
+
tablet: {
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
};
|
|
53
|
+
desktop: {
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Detect which frontend framework is being used
|
|
60
|
+
*
|
|
61
|
+
* @param projectPath - Project root path
|
|
62
|
+
* @returns Detected framework type
|
|
63
|
+
*/
|
|
64
|
+
export declare function detectFramework(projectPath: string): FrameworkType;
|
|
65
|
+
/**
|
|
66
|
+
* Extract routes from project based on detected framework
|
|
67
|
+
*
|
|
68
|
+
* @param projectPath - Project root path
|
|
69
|
+
* @param framework - Optional framework override
|
|
70
|
+
* @returns Array of route paths
|
|
71
|
+
*/
|
|
72
|
+
export declare function extractRoutes(projectPath: string, framework?: FrameworkType): string[];
|
|
73
|
+
/**
|
|
74
|
+
* Load manual routes override from routes.json
|
|
75
|
+
*/
|
|
76
|
+
export declare function loadManualRoutes(projectPath: string): string[] | null;
|
|
77
|
+
/**
|
|
78
|
+
* Generate E2E coverage manifest
|
|
79
|
+
*
|
|
80
|
+
* @param projectPath - Project root path
|
|
81
|
+
* @param options - Generation options
|
|
82
|
+
* @returns Generated manifest
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const manifest = generateCoverageManifest('/path/to/project');
|
|
87
|
+
* console.log(manifest.coverage.routes); // Coverage percentage
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function generateCoverageManifest(projectPath: string, options?: {
|
|
91
|
+
framework?: FrameworkType;
|
|
92
|
+
includeActions?: boolean;
|
|
93
|
+
}): E2ECoverageManifest;
|
|
94
|
+
/**
|
|
95
|
+
* Save manifest to state directory
|
|
96
|
+
*/
|
|
97
|
+
export declare function saveManifest(projectPath: string, manifest: E2ECoverageManifest): void;
|
|
98
|
+
/**
|
|
99
|
+
* Load existing manifest from state directory
|
|
100
|
+
*/
|
|
101
|
+
export declare function loadManifest(projectPath: string): E2ECoverageManifest | null;
|
|
102
|
+
/**
|
|
103
|
+
* Update route coverage in manifest
|
|
104
|
+
*/
|
|
105
|
+
export declare function updateRouteCoverage(manifest: E2ECoverageManifest, route: string, viewports?: string[]): E2ECoverageManifest;
|
|
106
|
+
/**
|
|
107
|
+
* Calculate coverage statistics
|
|
108
|
+
*/
|
|
109
|
+
export declare function calculateCoverage(manifest: E2ECoverageManifest): CoverageStats;
|
|
110
|
+
/**
|
|
111
|
+
* Get untested routes
|
|
112
|
+
*/
|
|
113
|
+
export declare function getUntestedRoutes(manifest: E2ECoverageManifest): string[];
|
|
114
|
+
/**
|
|
115
|
+
* Get routes missing viewport coverage
|
|
116
|
+
*/
|
|
117
|
+
export declare function getRoutesWithMissingViewports(manifest: E2ECoverageManifest): {
|
|
118
|
+
route: string;
|
|
119
|
+
missingViewports: string[];
|
|
120
|
+
}[];
|
|
121
|
+
/**
|
|
122
|
+
* Route visit detected in test output
|
|
123
|
+
*/
|
|
124
|
+
export interface RouteVisit {
|
|
125
|
+
route: string;
|
|
126
|
+
viewport?: string;
|
|
127
|
+
timestamp?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Result of parsing test output for route visits
|
|
131
|
+
*/
|
|
132
|
+
export interface RouteTrackingResult {
|
|
133
|
+
visits: RouteVisit[];
|
|
134
|
+
manifest: E2ECoverageManifest;
|
|
135
|
+
newlyTested: string[];
|
|
136
|
+
viewportUpdates: {
|
|
137
|
+
route: string;
|
|
138
|
+
viewport: string;
|
|
139
|
+
}[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Parse Playwright test output to extract visited routes
|
|
143
|
+
*
|
|
144
|
+
* Looks for patterns like:
|
|
145
|
+
* - page.goto('http://localhost:3000/login')
|
|
146
|
+
* - await page.goto('/dashboard')
|
|
147
|
+
* - navigating to "http://localhost:3000/products"
|
|
148
|
+
* - → /api/users (XHR) - skip API routes
|
|
149
|
+
*
|
|
150
|
+
* @param output - Test output (stdout/stderr combined)
|
|
151
|
+
* @param baseUrl - Optional base URL to normalize routes
|
|
152
|
+
* @returns Array of route visits
|
|
153
|
+
*/
|
|
154
|
+
export declare function parseRouteVisits(output: string, baseUrl?: string): RouteVisit[];
|
|
155
|
+
/**
|
|
156
|
+
* Match a visited route against manifest routes (handling dynamic segments)
|
|
157
|
+
*
|
|
158
|
+
* @param visitedRoute - The actual route visited (e.g., "/products/123")
|
|
159
|
+
* @param manifestRoutes - Routes in manifest (may include :params like "/products/:id")
|
|
160
|
+
* @returns Matched manifest route or null
|
|
161
|
+
*/
|
|
162
|
+
export declare function matchRouteToManifest(visitedRoute: string, manifestRoutes: string[]): string | null;
|
|
163
|
+
/**
|
|
164
|
+
* Track route coverage from test output
|
|
165
|
+
*
|
|
166
|
+
* Parses test output, extracts route visits, and updates manifest.
|
|
167
|
+
*
|
|
168
|
+
* @param projectPath - Project root path
|
|
169
|
+
* @param testOutput - Raw test output
|
|
170
|
+
* @param options - Tracking options
|
|
171
|
+
* @returns Tracking result with updated manifest
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const result = trackRouteCoverage('/path/to/project', testOutput);
|
|
176
|
+
* console.log(`Tested ${result.newlyTested.length} new routes`);
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export declare function trackRouteCoverage(projectPath: string, testOutput: string, options?: {
|
|
180
|
+
baseUrl?: string;
|
|
181
|
+
viewport?: string;
|
|
182
|
+
}): RouteTrackingResult;
|
|
183
|
+
/**
|
|
184
|
+
* Parse viewport from Playwright project name
|
|
185
|
+
*
|
|
186
|
+
* @param projectName - Playwright project name from config or output
|
|
187
|
+
* @returns Normalized viewport name
|
|
188
|
+
*/
|
|
189
|
+
export declare function parseViewportFromProject(projectName: string): string;
|
|
190
|
+
/**
|
|
191
|
+
* Generate coverage report from manifest
|
|
192
|
+
*
|
|
193
|
+
* @param manifest - E2E coverage manifest
|
|
194
|
+
* @returns Formatted coverage report
|
|
195
|
+
*/
|
|
196
|
+
/**
|
|
197
|
+
* Playwright project/viewport configuration
|
|
198
|
+
*/
|
|
199
|
+
export interface PlaywrightViewportConfig {
|
|
200
|
+
projects: PlaywrightProject[];
|
|
201
|
+
viewports: {
|
|
202
|
+
mobile: boolean;
|
|
203
|
+
tablet: boolean;
|
|
204
|
+
desktop: boolean;
|
|
205
|
+
};
|
|
206
|
+
configPath?: string;
|
|
207
|
+
}
|
|
208
|
+
export interface PlaywrightProject {
|
|
209
|
+
name: string;
|
|
210
|
+
viewport: string;
|
|
211
|
+
width?: number;
|
|
212
|
+
height?: number;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Parse Playwright config to extract viewport/project configuration
|
|
216
|
+
*
|
|
217
|
+
* @param projectPath - Project root path
|
|
218
|
+
* @returns Parsed viewport configuration
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* const config = parsePlaywrightConfig('/path/to/project');
|
|
223
|
+
* console.log(config.viewports.mobile); // true if mobile viewport configured
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
export declare function parsePlaywrightConfig(projectPath: string): PlaywrightViewportConfig;
|
|
227
|
+
/**
|
|
228
|
+
* Get required viewports from config or defaults
|
|
229
|
+
*
|
|
230
|
+
* @param projectPath - Project root path
|
|
231
|
+
* @returns Array of required viewport names
|
|
232
|
+
*/
|
|
233
|
+
export declare function getRequiredViewports(projectPath: string): string[];
|
|
234
|
+
/**
|
|
235
|
+
* Check if viewport coverage meets requirements
|
|
236
|
+
*
|
|
237
|
+
* @param manifest - E2E coverage manifest
|
|
238
|
+
* @param projectPath - Project root path
|
|
239
|
+
* @returns Coverage check result
|
|
240
|
+
*/
|
|
241
|
+
export declare function checkViewportCoverage(manifest: E2ECoverageManifest, projectPath: string): {
|
|
242
|
+
complete: boolean;
|
|
243
|
+
required: string[];
|
|
244
|
+
covered: string[];
|
|
245
|
+
missing: string[];
|
|
246
|
+
};
|
|
247
|
+
export declare function generateCoverageReport(manifest: E2ECoverageManifest): string;
|
|
248
|
+
//# sourceMappingURL=e2e-coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e-coverage.d.ts","sourceRoot":"","sources":["../../../../src/core/auto/e2e-coverage.ts"],"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