@eskoubar95/spec 0.1.0 → 0.1.2
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/commands/help.d.ts +5 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +23 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +30 -14
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +5 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +88 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +72 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/workspace.d.ts +5 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +17 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.js +42 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/backup-cursor.d.ts +16 -0
- package/dist/lib/backup-cursor.d.ts.map +1 -0
- package/dist/lib/backup-cursor.js +50 -0
- package/dist/lib/backup-cursor.js.map +1 -0
- package/dist/lib/copy-template.d.ts +9 -1
- package/dist/lib/copy-template.d.ts.map +1 -1
- package/dist/lib/copy-template.js +94 -3
- package/dist/lib/copy-template.js.map +1 -1
- package/dist/lib/cursor-detection.d.ts +6 -0
- package/dist/lib/cursor-detection.d.ts.map +1 -0
- package/dist/lib/cursor-detection.js +31 -0
- package/dist/lib/cursor-detection.js.map +1 -0
- package/dist/lib/detection.d.ts +25 -0
- package/dist/lib/detection.d.ts.map +1 -0
- package/dist/lib/detection.js +186 -0
- package/dist/lib/detection.js.map +1 -0
- package/dist/lib/install-existing.d.ts +6 -0
- package/dist/lib/install-existing.d.ts.map +1 -0
- package/dist/lib/install-existing.js +63 -0
- package/dist/lib/install-existing.js.map +1 -0
- package/dist/lib/project-name.d.ts +7 -0
- package/dist/lib/project-name.d.ts.map +1 -0
- package/dist/lib/project-name.js +13 -0
- package/dist/lib/project-name.js.map +1 -0
- package/dist/lib/prompts.d.ts +6 -5
- package/dist/lib/prompts.d.ts.map +1 -1
- package/dist/lib/prompts.js +114 -0
- package/dist/lib/prompts.js.map +1 -1
- package/dist/lib/version-check.d.ts +21 -0
- package/dist/lib/version-check.d.ts.map +1 -0
- package/dist/lib/version-check.js +49 -0
- package/dist/lib/version-check.js.map +1 -0
- package/dist/lib/workspace.d.ts +7 -0
- package/dist/lib/workspace.d.ts.map +1 -0
- package/dist/lib/workspace.js +38 -0
- package/dist/lib/workspace.js.map +1 -0
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +2 -2
- package/template/.cursor/commands/_shared/activation.md +220 -0
- package/template/.cursor/commands/_shared/coderabbit-integration.md +278 -0
- package/template/.cursor/commands/_shared/command-stacks.md +124 -0
- package/template/.cursor/commands/_shared/deployment-detection.md +294 -0
- package/template/.cursor/commands/_shared/detection.md +277 -0
- package/template/.cursor/commands/_shared/documentation-lookup.md +321 -0
- package/template/.cursor/commands/_shared/git-workflow.md +288 -0
- package/template/.cursor/commands/_shared/github-helpers.md +337 -0
- package/template/.cursor/commands/_shared/github-workflows.md +351 -0
- package/template/.cursor/commands/_shared/helper-metadata.md +481 -0
- package/template/.cursor/commands/_shared/linear-automation.md +388 -0
- package/template/.cursor/commands/_shared/linear-helpers.md +254 -0
- package/template/.cursor/commands/_shared/performance-monitoring.md +369 -0
- package/template/.cursor/commands/_shared/pr-description.md +279 -0
- package/template/.cursor/commands/_shared/retrospective-spec-creation.md +977 -0
- package/template/.cursor/commands/_shared/scaling.md +264 -0
- package/template/.cursor/commands/_shared/state-assertions.md +174 -0
- package/template/.cursor/commands/_shared/test-automation.md +388 -0
- package/template/.cursor/commands/_shared/verification-checkpoints.md +145 -0
- package/template/.cursor/commands/spec/audit.md +240 -0
- package/template/.cursor/commands/spec/evolve.md +163 -0
- package/template/.cursor/commands/spec/sync.md +196 -0
- package/template/.cursor/commands/tools/refactor.md +555 -0
- package/template/.cursor/rules/10-engineering.mdc +149 -0
- package/template/.cursor/rules/11-design.mdc +129 -0
- package/template/.cursor/rules/12-business.mdc +132 -0
- package/template/.cursor/rules/20-nextjs.mdc +146 -0
- package/template/.cursor/rules/21-api-design.mdc +176 -0
- package/template/.cursor/rules/30-database.mdc +183 -0
- package/template/.cursor/rules/31-testing.mdc +191 -0
- package/template/.cursor/scripts/validate-helpers.js +254 -0
- package/template/.sdd/detection-cache.json +1 -0
- package/template/.sdd/install-info.json +1 -0
- package/template/.sdd/version +1 -0
- package/template/spec/00-root-spec.md +8 -1
- package/template/work/backlog/tasks.local.md +92 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
---
|
|
2
|
+
helper_id: github-workflows
|
|
3
|
+
load_when:
|
|
4
|
+
- spec_plan
|
|
5
|
+
- spec_refine
|
|
6
|
+
- ci_cd_needed
|
|
7
|
+
sections:
|
|
8
|
+
detection:
|
|
9
|
+
title: "Workflow Detection"
|
|
10
|
+
lines: [1, 50]
|
|
11
|
+
generation:
|
|
12
|
+
title: "Workflow Generation"
|
|
13
|
+
lines: [51, 200]
|
|
14
|
+
templates:
|
|
15
|
+
title: "Workflow Templates"
|
|
16
|
+
lines: [201, 300]
|
|
17
|
+
always_load: false
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# GitHub Actions Workflow Generation
|
|
21
|
+
|
|
22
|
+
This helper provides logic for dynamically generating GitHub Actions workflows based on project complexity (hybrid: size + type).
|
|
23
|
+
|
|
24
|
+
## Purpose
|
|
25
|
+
|
|
26
|
+
Generate appropriate CI/CD workflows for projects based on:
|
|
27
|
+
- **Project size:** small, medium, large, enterprise
|
|
28
|
+
- **Project type:** web-app, api-service, cli-tool, library, mobile-app, monorepo
|
|
29
|
+
- **Hybrid logic:** Both size and type determine workflow complexity
|
|
30
|
+
|
|
31
|
+
## Workflow Generation Logic
|
|
32
|
+
|
|
33
|
+
### Decision Matrix
|
|
34
|
+
|
|
35
|
+
**No workflows:**
|
|
36
|
+
- Small + basic website (web-app with minimal complexity)
|
|
37
|
+
- Small + static site
|
|
38
|
+
- Small + simple landing page
|
|
39
|
+
|
|
40
|
+
**Basic workflows (ci.yml):**
|
|
41
|
+
- Medium+ web-app (with tests, linting)
|
|
42
|
+
- Medium+ api-service (with tests, linting)
|
|
43
|
+
- Small web-app with complex features (if explicitly needed)
|
|
44
|
+
|
|
45
|
+
**Advanced workflows (ci.yml + pr-checks.yml):**
|
|
46
|
+
- Large web-app/api-service
|
|
47
|
+
- Medium+ with complex testing requirements
|
|
48
|
+
- Projects with multiple environments
|
|
49
|
+
|
|
50
|
+
**Full workflows (ci.yml + deploy.yml + pr-checks.yml):**
|
|
51
|
+
- Enterprise projects
|
|
52
|
+
- Large projects with deployment requirements
|
|
53
|
+
- Projects with multiple deployment environments
|
|
54
|
+
|
|
55
|
+
## Workflow Types
|
|
56
|
+
|
|
57
|
+
### 1. CI Workflow (`ci.yml`)
|
|
58
|
+
|
|
59
|
+
**Basic CI (medium+):**
|
|
60
|
+
- Run tests
|
|
61
|
+
- Run linting
|
|
62
|
+
- Type checking (if TypeScript)
|
|
63
|
+
- Build verification
|
|
64
|
+
|
|
65
|
+
**Advanced CI (large/enterprise):**
|
|
66
|
+
- All basic CI steps
|
|
67
|
+
- Code coverage reports
|
|
68
|
+
- Security scanning
|
|
69
|
+
- Performance testing (if applicable)
|
|
70
|
+
|
|
71
|
+
### 2. PR Checks Workflow (`pr-checks.yml`)
|
|
72
|
+
|
|
73
|
+
**For medium+ projects:**
|
|
74
|
+
- PR-specific checks
|
|
75
|
+
- Branch protection rules
|
|
76
|
+
- Required status checks
|
|
77
|
+
- Code review reminders
|
|
78
|
+
|
|
79
|
+
### 3. Deploy Workflow (`deploy.yml`)
|
|
80
|
+
|
|
81
|
+
**For large/enterprise with deployment:**
|
|
82
|
+
- Deployment to staging
|
|
83
|
+
- Deployment to production
|
|
84
|
+
- Environment-specific configurations
|
|
85
|
+
- Rollback capabilities
|
|
86
|
+
|
|
87
|
+
## Framework Detection
|
|
88
|
+
|
|
89
|
+
**Detect framework from:**
|
|
90
|
+
1. Tech stack in `spec/08-infrastructure.md` or `spec/02-architecture.md`
|
|
91
|
+
2. `package.json` dependencies
|
|
92
|
+
3. Config files (next.config.js, vite.config.js, etc.)
|
|
93
|
+
|
|
94
|
+
**Framework-specific adaptations:**
|
|
95
|
+
- **Next.js:** Use Next.js build commands, handle App Router vs Pages Router
|
|
96
|
+
- **Vite:** Use Vite build commands
|
|
97
|
+
- **Python:** Use pytest, black, mypy
|
|
98
|
+
- **Node.js:** Use npm/pnpm/yarn commands
|
|
99
|
+
- **Rust:** Use cargo commands
|
|
100
|
+
- **Go:** Use go test, go build
|
|
101
|
+
|
|
102
|
+
## Workflow Generation Process
|
|
103
|
+
|
|
104
|
+
### Step 1: Read Project Complexity
|
|
105
|
+
|
|
106
|
+
1. **Run detection:**
|
|
107
|
+
- Use detection system (see `_shared/detection.md`)
|
|
108
|
+
- Read project type, size, phase, technologies
|
|
109
|
+
- Read from `.sdd/detection-cache.json` if valid
|
|
110
|
+
|
|
111
|
+
2. **Read deployment requirements:**
|
|
112
|
+
- Check `spec/08-infrastructure.md` for deployment configuration
|
|
113
|
+
- Check if deployment is defined (Railway, Vercel, AWS, etc.)
|
|
114
|
+
|
|
115
|
+
### Step 2: Determine Workflow Needs
|
|
116
|
+
|
|
117
|
+
**Decision logic:**
|
|
118
|
+
1. **Small + basic website:** Skip workflow generation
|
|
119
|
+
2. **Medium+ web-app/api:** Generate `ci.yml`
|
|
120
|
+
3. **Large/Enterprise:** Generate `ci.yml` + `pr-checks.yml`
|
|
121
|
+
4. **Large/Enterprise + deployment:** Generate all workflows including `deploy.yml`
|
|
122
|
+
|
|
123
|
+
### Step 3: Generate Workflow Files
|
|
124
|
+
|
|
125
|
+
**Template selection:**
|
|
126
|
+
- Use framework-agnostic templates
|
|
127
|
+
- Adapt commands based on detected framework
|
|
128
|
+
- Use package manager from detection (npm, pnpm, yarn)
|
|
129
|
+
|
|
130
|
+
**File structure:**
|
|
131
|
+
```
|
|
132
|
+
.github/
|
|
133
|
+
workflows/
|
|
134
|
+
ci.yml
|
|
135
|
+
pr-checks.yml (if needed)
|
|
136
|
+
deploy.yml (if needed)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Workflow Templates
|
|
140
|
+
|
|
141
|
+
### CI Basic Template
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
name: CI
|
|
145
|
+
|
|
146
|
+
on:
|
|
147
|
+
push:
|
|
148
|
+
branches: [main, develop]
|
|
149
|
+
pull_request:
|
|
150
|
+
branches: [main, develop]
|
|
151
|
+
|
|
152
|
+
jobs:
|
|
153
|
+
test:
|
|
154
|
+
runs-on: ubuntu-latest
|
|
155
|
+
steps:
|
|
156
|
+
- uses: actions/checkout@v4
|
|
157
|
+
- uses: actions/setup-node@v4
|
|
158
|
+
with:
|
|
159
|
+
node-version: '20'
|
|
160
|
+
cache: 'npm' # or 'pnpm' or 'yarn'
|
|
161
|
+
- run: npm ci
|
|
162
|
+
- run: npm run lint
|
|
163
|
+
- run: npm run test
|
|
164
|
+
- run: npm run build
|
|
165
|
+
|
|
166
|
+
**Test Execution (Framework-Agnostic):**
|
|
167
|
+
- Detect test framework from package.json or config files
|
|
168
|
+
- Run appropriate test command:
|
|
169
|
+
- Jest: `npm test` or `jest`
|
|
170
|
+
- Vitest: `npm test` or `vitest run`
|
|
171
|
+
- Playwright: `npx playwright test`
|
|
172
|
+
- Cypress: `npx cypress run`
|
|
173
|
+
- pytest: `pytest` (Python)
|
|
174
|
+
- Other: Use project's test script
|
|
175
|
+
- Collect test coverage (if framework supports)
|
|
176
|
+
- Report test results
|
|
177
|
+
- Fail workflow if tests fail (configurable)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### CI Advanced Template
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
name: CI
|
|
184
|
+
|
|
185
|
+
on:
|
|
186
|
+
push:
|
|
187
|
+
branches: [main, develop]
|
|
188
|
+
pull_request:
|
|
189
|
+
branches: [main, develop]
|
|
190
|
+
|
|
191
|
+
jobs:
|
|
192
|
+
test:
|
|
193
|
+
runs-on: ubuntu-latest
|
|
194
|
+
steps:
|
|
195
|
+
- uses: actions/checkout@v4
|
|
196
|
+
- uses: actions/setup-node@v4
|
|
197
|
+
with:
|
|
198
|
+
node-version: '20'
|
|
199
|
+
cache: 'npm'
|
|
200
|
+
- run: npm ci
|
|
201
|
+
- run: npm run lint
|
|
202
|
+
- run: npm run test:coverage
|
|
203
|
+
- run: npm run type-check
|
|
204
|
+
- run: npm run build
|
|
205
|
+
- uses: codecov/codecov-action@v3
|
|
206
|
+
with:
|
|
207
|
+
files: ./coverage/lcov.info
|
|
208
|
+
|
|
209
|
+
**Test Execution with Coverage:**
|
|
210
|
+
- Detect test framework automatically
|
|
211
|
+
- Run tests with coverage flag:
|
|
212
|
+
- Jest: `npm test -- --coverage`
|
|
213
|
+
- Vitest: `npm test -- --coverage`
|
|
214
|
+
- pytest: `pytest --cov` (Python)
|
|
215
|
+
- Upload coverage to codecov or similar service
|
|
216
|
+
- Report coverage in PR comments (if configured)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### PR Checks Template
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
name: PR Checks
|
|
223
|
+
|
|
224
|
+
on:
|
|
225
|
+
pull_request:
|
|
226
|
+
types: [opened, synchronize, reopened]
|
|
227
|
+
|
|
228
|
+
jobs:
|
|
229
|
+
pr-checks:
|
|
230
|
+
runs-on: ubuntu-latest
|
|
231
|
+
steps:
|
|
232
|
+
- uses: actions/checkout@v4
|
|
233
|
+
- name: Check PR description
|
|
234
|
+
run: |
|
|
235
|
+
if [ -z "${{ github.event.pull_request.body }}" ]; then
|
|
236
|
+
echo "PR description is empty"
|
|
237
|
+
exit 1
|
|
238
|
+
fi
|
|
239
|
+
- name: Check for breaking changes
|
|
240
|
+
run: |
|
|
241
|
+
# Add custom checks here
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Deploy Template (Framework-Agnostic)
|
|
245
|
+
|
|
246
|
+
```yaml
|
|
247
|
+
name: Deploy
|
|
248
|
+
|
|
249
|
+
on:
|
|
250
|
+
push:
|
|
251
|
+
branches: [main]
|
|
252
|
+
|
|
253
|
+
jobs:
|
|
254
|
+
deploy:
|
|
255
|
+
runs-on: ubuntu-latest
|
|
256
|
+
steps:
|
|
257
|
+
- uses: actions/checkout@v4
|
|
258
|
+
- name: Deploy to staging
|
|
259
|
+
run: |
|
|
260
|
+
# Framework-specific deployment commands
|
|
261
|
+
# Adapt based on detected framework
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Framework-Specific Adaptations
|
|
265
|
+
|
|
266
|
+
### Next.js
|
|
267
|
+
|
|
268
|
+
```yaml
|
|
269
|
+
- run: npm run build
|
|
270
|
+
env:
|
|
271
|
+
NEXT_PUBLIC_ENV: production
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Vite
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
- run: npm run build
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Python
|
|
281
|
+
|
|
282
|
+
```yaml
|
|
283
|
+
- uses: actions/setup-python@v4
|
|
284
|
+
with:
|
|
285
|
+
python-version: '3.11'
|
|
286
|
+
- run: pip install -r requirements.txt
|
|
287
|
+
- run: pytest
|
|
288
|
+
- run: black --check .
|
|
289
|
+
- run: mypy .
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Node.js (Generic)
|
|
293
|
+
|
|
294
|
+
```yaml
|
|
295
|
+
- run: npm ci
|
|
296
|
+
- run: npm run lint
|
|
297
|
+
- run: npm run test
|
|
298
|
+
- run: npm run build
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Integration Points
|
|
302
|
+
|
|
303
|
+
### In `/spec/plan`:
|
|
304
|
+
|
|
305
|
+
**After milestones created:**
|
|
306
|
+
1. Check if workflows needed (based on complexity)
|
|
307
|
+
2. If needed → generate workflows via this helper
|
|
308
|
+
3. Ask user for confirmation before generating
|
|
309
|
+
4. Create `.github/workflows/` directory if needed
|
|
310
|
+
5. Generate workflow files
|
|
311
|
+
|
|
312
|
+
**User confirmation prompt:**
|
|
313
|
+
"GitHub Actions workflows are recommended for this project. Generate workflows? (y/n)"
|
|
314
|
+
|
|
315
|
+
### In `/spec/refine`:
|
|
316
|
+
|
|
317
|
+
**If project complexity changes:**
|
|
318
|
+
1. Check if workflows need updating
|
|
319
|
+
2. If complexity increased → suggest adding workflows
|
|
320
|
+
3. If complexity decreased → suggest removing workflows (optional)
|
|
321
|
+
4. Ask user for confirmation
|
|
322
|
+
|
|
323
|
+
## Error Handling
|
|
324
|
+
|
|
325
|
+
- **Detection fails:** Use conservative defaults (medium complexity)
|
|
326
|
+
- **Framework not detected:** Use generic Node.js/Python templates
|
|
327
|
+
- **Workflow generation fails:** Report to user, continue without blocking
|
|
328
|
+
- **User declines:** Skip workflow generation, continue workflow
|
|
329
|
+
|
|
330
|
+
## Best Practices
|
|
331
|
+
|
|
332
|
+
1. **Framework-agnostic:** Use generic templates, adapt commands
|
|
333
|
+
2. **Progressive enhancement:** Start with basic, add advanced as needed
|
|
334
|
+
3. **User confirmation:** Always ask before generating workflows
|
|
335
|
+
4. **Don't block workflow:** If generation fails, continue without workflows
|
|
336
|
+
5. **Documentation:** Reference workflow files in `spec/08-infrastructure.md`
|
|
337
|
+
|
|
338
|
+
## Examples
|
|
339
|
+
|
|
340
|
+
### Small Basic Website
|
|
341
|
+
- **Result:** No workflows generated
|
|
342
|
+
- **Reason:** Small + basic website = minimal CI needs
|
|
343
|
+
|
|
344
|
+
### Medium Next.js Web App
|
|
345
|
+
- **Result:** `ci.yml` with Next.js-specific commands
|
|
346
|
+
- **Includes:** Tests, linting, type checking, build
|
|
347
|
+
|
|
348
|
+
### Large Enterprise API Service
|
|
349
|
+
- **Result:** `ci.yml` + `pr-checks.yml` + `deploy.yml`
|
|
350
|
+
- **Includes:** Full CI/CD pipeline with deployment
|
|
351
|
+
|