sdlc-workflow 1.0.10 → 1.1.0

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 (3) hide show
  1. package/README.md +10 -2
  2. package/bin/cli.js +204 -76
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,10 +5,12 @@ Scaffold SDLC workflow docs and templates into your project. Works with **Cursor
5
5
  ## Flow
6
6
 
7
7
  ```
8
- User Request → PO → Business BA → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Deploy (Docker Compose + K8s)
8
+ User Request → PO → Business BA → Design (if app/web) → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Security + PE audit → [fix loop until no issues] → Deploy (Docker Compose + K8s)
9
9
  ```
10
10
 
11
11
  - **Trigger:** When you send an **idea** or **feature request**, the agent should run the **full pipeline** (PO → … → Deploy) in sequence, one sub-agent/role per phase — not handle everything in one go or stop after one phase. See `docs/sdlc/ORCHESTRATION.md`.
12
+ - **Design (optional):** For app/web projects, after Business BA → invoke **Pencil.dev** (MCP) to design; **PO + Business BA review** until approved; then Architect + Technical BA. UX drives technical decisions.
13
+ - **Security + Principle Engineer:** After implementation and QE testing → security + logic audit; **fix loop** (Dev fixes → re-audit) until all issues resolved; sign-off before Deploy.
12
14
  - **Each role runs as a sub-agent** (see `docs/sdlc/agents/`).
13
15
  - **After completion** → deploy immediately with **Docker Compose** (local/staging) and **Kubernetes** (production) — `docs/sdlc/deploy/`.
14
16
  - **QE (docs)**: Test plan, test cases
@@ -54,6 +56,8 @@ docs/sdlc/
54
56
  │ ├── api-spec.template.md
55
57
  │ ├── team-breakdown.template.md
56
58
  │ └── README.md
59
+ ├── design/ # Design (optional, app/web): after BA, before Architect; Pencil.dev .pen; PO+BA review until approved
60
+ │ └── README.md
57
61
  ├── architecture/ # Architect
58
62
  │ ├── adr.template.md
59
63
  │ └── README.md
@@ -74,9 +78,13 @@ docs/sdlc/
74
78
  │ ├── embedded/ # Senior Embedded 10+ yrs — firmware, IoT
75
79
  │ ├── data-ml/ # Senior Data/ML 10+ yrs
76
80
  │ └── platform/ # Senior Platform 10+ yrs — CI/CD, infra
81
+ ├── security/ # Security team: audit security risk (after implementation)
82
+ │ └── README.md
83
+ ├── principle-engineer/ # Principle engineer: audit logic, architecture (after implementation)
84
+ │ └── README.md
77
85
  ├── agents/ # Sub-agent specs (each role = sub-agent)
78
86
  │ └── README.md
79
- └── deploy/ # After completion → Docker Compose + K8s
87
+ └── deploy/ # After Security + PE sign-off (fix loop until no issues) → Docker Compose + K8s
80
88
  ├── README.md
81
89
  ├── docker-compose.yml.template
82
90
  └── k8s/
package/bin/cli.js CHANGED
@@ -163,6 +163,7 @@ async function generateFromInline(cwd) {
163
163
  join(base, "qe"),
164
164
  join(base, "qe", "qe-lead"),
165
165
  join(base, "qe", "senior-qe"),
166
+ join(base, "design"),
166
167
  join(base, "dev", "tech-lead"),
167
168
  join(base, "dev", "senior-developer"),
168
169
  join(base, "dev", "frontend"),
@@ -171,6 +172,8 @@ async function generateFromInline(cwd) {
171
172
  join(base, "dev", "embedded"),
172
173
  join(base, "dev", "data-ml"),
173
174
  join(base, "dev", "platform"),
175
+ join(base, "security"),
176
+ join(base, "principle-engineer"),
174
177
  join(base, "agents"),
175
178
  join(base, "deploy"),
176
179
  join(base, "deploy", "k8s"),
@@ -197,6 +200,7 @@ async function generateFromInline(cwd) {
197
200
  ["qe/README.md", QE_README],
198
201
  ["qe/qe-lead/README.md", QE_LEAD_README],
199
202
  ["qe/senior-qe/README.md", QE_SENIOR_README],
203
+ ["design/README.md", DESIGN_README],
200
204
  ["dev/tech-lead/README.md", DEV_TECH_LEAD_README],
201
205
  ["dev/senior-developer/README.md", DEV_SENIOR_README],
202
206
  ["dev/implementation-roles.template.md", DEV_IMPLEMENTATION_ROLES_TEMPLATE],
@@ -206,6 +210,8 @@ async function generateFromInline(cwd) {
206
210
  ["dev/embedded/README.md", DEV_EMBEDDED_README],
207
211
  ["dev/data-ml/README.md", DEV_DATA_ML_README],
208
212
  ["dev/platform/README.md", DEV_PLATFORM_README],
213
+ ["security/README.md", SECURITY_README],
214
+ ["principle-engineer/README.md", PRINCIPLE_ENGINEER_README],
209
215
  ["agents/README.md", AGENTS_README],
210
216
  ["deploy/README.md", DEPLOY_README],
211
217
  ["deploy/docker-compose.yml.template", DOCKER_COMPOSE_TEMPLATE],
@@ -233,14 +239,17 @@ globs: docs/sdlc/**/*, **/*.md
233
239
 
234
240
  1. **PO** — PRD, user stories → docs/sdlc/po/{epic-slug}/ (one folder per epic)
235
241
  2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/{epic-slug}/ (one folder per epic)
236
- 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
237
- 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
238
- 5. **QE (docs)** — Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
239
- 6. **Dev** — After docs phase → **run implementation immediately**. Tech Lead + implementation roles by project (FE, Backend, Mobile, Embedded, Data/ML, Platform) → docs/sdlc/dev/{role}/
240
- 7. **QE (testing)** — QE Lead (15+ yrs automation: strategy, framework, review) + Senior QE (10+ yrs, automation) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
241
- 8. **Deploy** — Docker Compose + K8s → docs/sdlc/deploy/
242
-
243
- **Each role runs as a sub-agent.** See docs/sdlc/agents/
242
+ 3. **Design (if app/web)** — Pencil.dev designs → docs/sdlc/design/{epic-slug}/; **PO + BA review** → loop until approved
243
+ 4. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
244
+ 5. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
245
+ 6. **QE (docs)** Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
246
+ 7. **Dev** — After docs phase **run implementation immediately**. Tech Lead + implementation roles → docs/sdlc/dev/{role}/
247
+ 8. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/
248
+ 9. **Security** — Audit security risk → docs/sdlc/security/
249
+ 10. **Principle Engineer** Audit logic, architecture docs/sdlc/principle-engineer/
250
+ 11. **Deploy** — Docker Compose + K8s → docs/sdlc/deploy/ (after Security + PE sign-off; fix loop until no issues)
251
+
252
+ **Each role runs as a sub-agent.** Design uses Pencil.dev MCP; UX drives tech. See docs/sdlc/agents/
244
253
  Full workflow: docs/sdlc/SDLC-WORKFLOW.md
245
254
  `;
246
255
 
@@ -258,7 +267,7 @@ Sequential workflow; **each role runs as a sub-agent**. Each phase produces docs
258
267
  **When the user sends an idea, feature request, or new requirement:**
259
268
  1. **Trigger the pipeline** and run it **continuously through deployment** (Phase 1 → 2 → … → 7).
260
269
  2. **One role per phase.** For each phase, act **only** as that role (e.g. only PO in phase 1, only Business BA in phase 2). Produce that phase's outputs into the correct folder, then **continue to the next phase** without waiting for the user.
261
- 3. **Run in order:** PO → Business BA → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Deploy. Do not stop after one phase unless the user explicitly asks to stop.
270
+ 3. **Run in order:** PO → Business BA → **Design (if app/web, PO+BA review loop)** → Architect → Technical BA → QE (docs) → Dev → QE (testing) → **Security + Principle Engineer audit → fix loop until all issues resolved** → Deploy. Do not stop after one phase unless the user explicitly asks to stop.
262
271
 
263
272
  **Note:** In Cursor and similar tools there is a single agent per conversation. "Sub-agent" means **one role per phase** — the same agent must adopt exactly one role per phase and run phases in sequence (do not mix roles in one step). If the platform later supports spawning separate agents per phase, use that; otherwise this single agent simulates the pipeline by switching role each phase.
264
273
 
@@ -267,7 +276,7 @@ Sequential workflow; **each role runs as a sub-agent**. Each phase produces docs
267
276
  ## Flow Overview
268
277
 
269
278
  \`\`\`
270
- User Request → PO → Business BA → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Deploy (Docker Compose + K8s)
279
+ User Request → PO → Business BA → Design (if app/web) → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Security + PE audit → [fix loop until no issues] → Deploy (Docker Compose + K8s)
271
280
  \`\`\`
272
281
 
273
282
  **Determine current phase** before acting. If user sent an idea, assume Phase 0 and start from Phase 1.
@@ -289,18 +298,33 @@ User Request → PO → Business BA → Architect → Technical BA → QE (docs)
289
298
 
290
299
  **Role**: Break down from business perspective.
291
300
  **Deliverables**: Business process flows, functional requirements, use cases, glossary.
292
- **Output**: \`docs/sdlc/ba/business/{epic-slug}/\` — **one folder per epic** (same slug as PO; e.g. \`ba/business/job-scheduler-event-bus/functional-requirements.md\`). Do not merge all epics into one file. **Handoff to Architect.**
301
+ **Output**: \`docs/sdlc/ba/business/{epic-slug}/\` — **one folder per epic** (same slug as PO). Do not merge all epics into one file. **Handoff to Design (if app/web) or Architect.**
293
302
 
294
- ## Phase 3: Architect
303
+ ## Phase 3: Design (optional — app/web only)
304
+
305
+ **When:** Project has UI (web, mobile app). Skip for API-only, library, CLI, data/ML, platform without UI.
306
+
307
+ **Role**: Invoke **Pencil.dev** sub-agent (MCP) to create UI/UX designs from idea + PO + Business BA docs. Design **before** Architect so UX drives technical decisions.
308
+ **Output**: \`docs/sdlc/design/{epic-slug}/\` — .pen designs.
309
+
310
+ **Review loop:**
311
+ 1. **PO review**: Design aligns with epic brief, user stories, acceptance criteria?
312
+ 2. **Business BA review**: Design matches functional requirements, process flows?
313
+ 3. **If not approved**: Capture feedback → redesign with Pencil.dev → repeat until PO and BA approve.
314
+ 4. **If approved** → **Handoff to Architect.**
315
+
316
+ ## Phase 4: Architect
295
317
 
296
318
  **Role**: Design system architecture and technology choices.
297
319
  **Deliverables**: System context, container diagram, ADRs, tech stack, cross-cutting concerns.
320
+ **Input**: Business BA + Design (if app/web) — design informs architecture.
298
321
  **Output**: \`docs/sdlc/architecture/\` — **Handoff to Technical BA.**
299
322
 
300
- ## Phase 4: Technical BA
323
+ ## Phase 5: Technical BA
301
324
 
302
- **Role**: Translate business + architecture into implementable specs.
325
+ **Role**: Translate business + architecture + design into implementable specs.
303
326
  **Deliverables**: API specs, DB schema, team breakdown, acceptance criteria per ticket.
327
+ **Input**: Architect + Design (if app/web) — design informs API/screen contracts.
304
328
  **Output**: \`docs/sdlc/ba/technical/\` — **Handoff to QE + Dev.**
305
329
 
306
330
  ## Phase 5a: QE (Docs phase)
@@ -336,13 +360,22 @@ User Request → PO → Business BA → Architect → Technical BA → QE (docs)
336
360
  - **QE Lead (15+ yrs automation)**: Test strategy, framework choice, automation architecture, review test code. Output per epic: \`docs/sdlc/qe/{epic-slug}/\`
337
361
  - **Senior QE (10+ yrs)**: Write automation tests per QE Lead's strategy. Output per epic: \`docs/sdlc/qe/{epic-slug}/\` (e.g. automation/ or test files there)
338
362
 
339
- **Output**: Automation tests, test report. **Handoff to Deploy.**
363
+ **Output**: Automation tests, test report. **Handoff to Security + Principle Engineer.**
364
+
365
+ ## Phase 8: Security + Principle Engineer (audit → fix loop)
340
366
 
341
- ## Phase 7: Deploy
367
+ **Trigger**: After QE testing sign-off.
368
+ **Roles** (can run in parallel):
369
+ - **Security team**: Audit security risk (OWASP, auth, secrets, infra). Output: \`docs/sdlc/security/\`
370
+ - **Principle Engineer**: Audit logic, architecture alignment, correctness. Output: \`docs/sdlc/principle-engineer/\`
342
371
 
343
- **Trigger**: After QE sign-off.
372
+ **Fix loop**: If issues found → **Dev fixes** → re-audit by Security + Principle Engineer. **Repeat until all issues resolved.** Only when sign-off → **Handoff to Deploy.**
373
+
374
+ ## Phase 9: Deploy
375
+
376
+ **Trigger**: After Security + Principle Engineer sign-off.
344
377
  **Role**: Deploy with **Docker Compose** (local/staging) and **Kubernetes** (production).
345
- **Output**: \`docs/sdlc/deploy/\` — docker-compose.yml, k8s manifests. Deploy right after pipeline completes.
378
+ **Output**: \`docs/sdlc/deploy/\` — docker-compose.yml, k8s manifests.
346
379
 
347
380
  ## Quick Phase Checklist
348
381
 
@@ -351,14 +384,16 @@ User Request → PO → Business BA → Architect → Technical BA → QE (docs)
351
384
  | 0 | Discovery | Raw request |
352
385
  | 1 | PO | PRD, user stories |
353
386
  | 2 | Business BA | FRS, process flows |
354
- | 3 | Architect | ADRs, system diagrams |
355
- | 4 | Technical BA | API specs, tech breakdown |
356
- | 5a | QE (docs) | Test plan, test cases |
357
- | 5b | Dev | Code, unit tests (≥90%) |
358
- | 6 | QE (testing) | QE Lead (15+ yrs automation) + Senior QE (10+ yrs), automation, sign-off |
359
- | 7 | Deploy | Docker Compose + K8s |
360
-
361
- **Sub-agents**: Each role = one sub-agent (PO, Business BA, Architect, Technical BA, QE Lead, Senior QE, Tech Lead, Senior Dev). See docs/sdlc/agents/
387
+ | 3 | Design (if app/web) | Pencil.dev designs; PO+BA review until approved |
388
+ | 4 | Architect | ADRs, system diagrams |
389
+ | 5 | Technical BA | API specs, tech breakdown |
390
+ | 6 | QE (docs) | Test plan, test cases |
391
+ | 7 | Dev | Code, unit tests (≥90%) |
392
+ | 8 | QE (testing) | QE Lead (15+ yrs automation) + Senior QE (10+ yrs), automation, sign-off |
393
+ | 9 | Security + Principle Engineer | Security + logic audit; fix loop until all issues resolved; sign-off → Deploy |
394
+ | 10 | Deploy | Docker Compose + K8s |
395
+
396
+ **Sub-agents**: Each role = one sub-agent. Design uses Pencil.dev MCP. See docs/sdlc/agents/
362
397
  See reference.md for templates.
363
398
  `;
364
399
 
@@ -366,8 +401,9 @@ const CURSOR_REFERENCE_MD = `# SDLC Workflow — Reference
366
401
 
367
402
  ## Folder structure: one per epic/feature (PO and Business BA)
368
403
 
369
- - **PO**: \`docs/sdlc/po/{epic-slug}/\` — one folder per epic (e.g. \`job-scheduler-event-bus\`). Files: epic-brief.md, user-stories.md. Do not put all epics in one file.
404
+ - **PO**: \`docs/sdlc/po/{epic-slug}/\` — one folder per epic. Files: epic-brief.md, user-stories.md. Do not put all epics in one file.
370
405
  - **Business BA**: \`docs/sdlc/ba/business/{epic-slug}/\` — same slug as PO. Files: functional-requirements.md, process-flows.md. Do not merge all epics into one file.
406
+ - **Design (if app/web)**: \`docs/sdlc/design/{epic-slug}/\` — same slug as PO/BA. Pencil.dev .pen designs; PO+BA review until approved.
371
407
  - **QE**: \`docs/sdlc/qe/{epic-slug}/\` — same slug as PO/BA. Files: test-plan.md, test-cases.md, automation artifacts. Do not put all epics in one file.
372
408
 
373
409
  ## PO: Epic Brief Template
@@ -383,6 +419,9 @@ FR-001: [Title] — Description, Trigger, Process Flow, Output, Constraints
383
419
  ## Technical BA: API Spec
384
420
  POST /api/v1/[resource] — Purpose, Request, Response, Contract
385
421
 
422
+ ## Design (if app/web)
423
+ Pencil.dev MCP — create .pen designs from idea + PO + BA (before Architect; UX drives tech). Output: docs/sdlc/design/{epic-slug}/. PO + BA review until approved; loop if not aligned. Handoff to Architect.
424
+
386
425
  ## QE: Test Case
387
426
  TC-001: [Scenario] — Precondition, Steps, Expected, Links to AC
388
427
 
@@ -395,11 +434,13 @@ TC-001: [Scenario] — Precondition, Steps, Expected, Links to AC
395
434
  - Senior Dev (10+ yrs): implement, Unit Test ≥90% → docs/sdlc/dev/senior-developer/
396
435
  - By project (all Senior 10+ yrs): Senior Frontend, Backend, Mobile, Embedded, Data/ML, Platform → docs/sdlc/dev/{role}/
397
436
 
398
- ## Sub-agents
399
- Each role = sub-agent. See docs/sdlc/agents/
437
+ ## Security + Principle Engineer (after implementation)
438
+ - Security team: audit security risk → docs/sdlc/security/
439
+ - Principle Engineer: audit logic, architecture → docs/sdlc/principle-engineer/
440
+ - **Fix loop**: If issues → Dev fixes → re-audit; repeat until all resolved. Sign-off → Deploy
400
441
 
401
442
  ## Deploy
402
- After completion → Docker Compose + K8s. See docs/sdlc/deploy/
443
+ After Security + Principle Engineer sign-off → Docker Compose + K8s. See docs/sdlc/deploy/
403
444
  `;
404
445
 
405
446
  const AGENTS_MD_CONTENT = `## SDLC Workflow
@@ -410,14 +451,16 @@ When working on requirements, features, or handoffs, follow these phases:
410
451
 
411
452
  1. **PO** — PRD, user stories → docs/sdlc/po/{epic-slug}/ (one folder per epic)
412
453
  2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/{epic-slug}/ (one folder per epic)
413
- 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
414
- 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
415
- 5. **QE (docs)** — Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
416
- 6. **Dev** — After docs phase → **run implementation immediately**. Tech Lead + Senior Dev → docs/sdlc/dev/{role}/
417
- 7. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
418
- 8. **Deploy** — Docker Compose + K8s → docs/sdlc/deploy/
419
-
420
- After the docs phase, the Dev team runs implementation immediately. See docs/sdlc/agents/
454
+ 3. **Design (if app/web)** — Pencil.dev designs → docs/sdlc/design/{epic-slug}/; **PO + BA review** until approved
455
+ 4. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
456
+ 5. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
457
+ 6. **QE (docs)** Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
458
+ 7. **Dev** — After docs phase **run implementation immediately**. Tech Lead + Senior Dev → docs/sdlc/dev/{role}/
459
+ 8. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
460
+ 9. **Security + Principle Engineer** — Security + logic audit; **fix loop** (Dev fixes → re-audit) until all issues resolved; sign-off before Deploy
461
+ 10. **Deploy** Docker Compose + K8s docs/sdlc/deploy/
462
+
463
+ Design before Architect (UX drives tech). After the docs phase, the Dev team runs implementation immediately. See docs/sdlc/agents/
421
464
  `;
422
465
 
423
466
  const CLAUDE_SDLC_CONTENT = `## SDLC Workflow
@@ -426,14 +469,16 @@ const CLAUDE_SDLC_CONTENT = `## SDLC Workflow
426
469
 
427
470
  1. **PO** — PRD, user stories → docs/sdlc/po/{epic-slug}/ (one folder per epic)
428
471
  2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/{epic-slug}/ (one folder per epic)
429
- 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
430
- 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
431
- 5. **QE (docs)** — Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
432
- 6. **Dev** — After docs phase → **run implementation immediately**. Tech Lead + Senior Dev → docs/sdlc/dev/{role}/
433
- 7. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
434
- 8. **Deploy** — Docker Compose + K8s → docs/sdlc/deploy/
435
-
436
- After the docs phase (Technical BA + QE docs), the Dev team runs implementation immediately. See docs/sdlc/agents/
472
+ 3. **Design (if app/web)** — Pencil.dev designs → docs/sdlc/design/{epic-slug}/; **PO + BA review** until approved
473
+ 4. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
474
+ 5. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
475
+ 6. **QE (docs)** Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
476
+ 7. **Dev** — After docs phase **run implementation immediately**. Tech Lead + Senior Dev → docs/sdlc/dev/{role}/
477
+ 8. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
478
+ 9. **Security + Principle Engineer** — Security + logic audit; **fix loop** (Dev fixes → re-audit) until all issues resolved; sign-off before Deploy
479
+ 10. **Deploy** Docker Compose + K8s docs/sdlc/deploy/
480
+
481
+ Design before Architect (UX drives tech). After the docs phase, Dev runs implementation immediately. See docs/sdlc/agents/
437
482
  `;
438
483
 
439
484
  const SDLC_WORKFLOW_MD = `# SDLC Workflow (Multi-Role)
@@ -450,7 +495,7 @@ For Cursor, see .cursor/rules/sdlc-workflow.mdc
450
495
  ## Flow
451
496
 
452
497
  \`\`\`
453
- User Request → PO → Business BA → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Deploy
498
+ User Request → PO → Business BA → Design (if app/web) → Architect → Technical BA → QE (docs) → Dev → QE (testing) → Security + PE audit → [fix loop] → Deploy
454
499
  \`\`\`
455
500
 
456
501
  ## Phase Checklist
@@ -460,14 +505,16 @@ User Request → PO → Business BA → Architect → Technical BA → QE (docs)
460
505
  | 0 | Discovery | Raw request |
461
506
  | 1 | PO | PRD, user stories |
462
507
  | 2 | Business BA | FRS, process flows |
463
- | 3 | Architect | ADRs, system diagrams |
464
- | 4 | Technical BA | API specs, tech breakdown |
465
- | 5a | QE (docs) | Test plan, test cases |
466
- | 5b | Dev | Code, unit tests (≥90%) |
467
- | 6 | QE (testing) | QE Lead (15+ yrs automation) + Senior QE (10+ yrs), automation, sign-off |
468
- | 7 | Deploy | Docker Compose + K8s |
508
+ | 3 | Design (if app/web) | Pencil.dev designs; PO+BA review until approved |
509
+ | 4 | Architect | ADRs, system diagrams |
510
+ | 5 | Technical BA | API specs, tech breakdown |
511
+ | 6 | QE (docs) | Test plan, test cases |
512
+ | 7 | Dev | Code, unit tests (≥90%) |
513
+ | 8 | QE (testing) | QE Lead (15+ yrs automation) + Senior QE (10+ yrs), automation, sign-off |
514
+ | 9 | Security + Principle Engineer | Security + logic audit; fix loop until all issues resolved; sign-off → Deploy |
515
+ | 10 | Deploy | Docker Compose + K8s |
469
516
 
470
- **Sub-agents**: Each role runs as a sub-agent (PO, Business BA, Architect, Technical BA, QE Lead, Senior QE, Tech Lead, Senior Dev). See docs/sdlc/agents/
517
+ **Sub-agents**: Each role runs as a sub-agent. See docs/sdlc/agents/
471
518
 
472
519
  ## Phase Details
473
520
 
@@ -479,12 +526,18 @@ User Request → PO → Business BA → Architect → Technical BA → QE (docs)
479
526
  - Functional requirements, process flows, use cases
480
527
  - Output: \`docs/sdlc/ba/business/{epic-slug}/\` — **one folder per epic** (same slug as PO); do not merge into one file
481
528
 
482
- ### Phase 3: Architect
483
- - System context, container diagram, ADRs, tech stack
529
+ ### Phase 3: Design (optional — app/web only)
530
+ - Invoke **Pencil.dev** (MCP) to design based on idea + PO + BA docs. **Design before Architect so UX drives tech.**
531
+ - Output: \`docs/sdlc/design/{epic-slug}/\` — .pen designs
532
+ - **PO + Business BA review**: Both check design vs epic/FRS; if not aligned → feedback → redesign loop until approved
533
+ - When approved → handoff to Architect
534
+
535
+ ### Phase 4: Architect
536
+ - System context, container diagram, ADRs, tech stack. Input: Business BA + Design (if app/web)
484
537
  - Output: \`docs/sdlc/architecture/\`
485
538
 
486
- ### Phase 4: Technical BA
487
- - API specs, DB schema, team breakdown
539
+ ### Phase 5: Technical BA
540
+ - API specs, DB schema, team breakdown. Input: Architect + Design (if app/web)
488
541
  - Output: \`docs/sdlc/ba/technical/\`
489
542
 
490
543
  ### Phase 5a: QE (Docs)
@@ -501,9 +554,15 @@ User Request → PO → Business BA → Architect → Technical BA → QE (docs)
501
554
  ### Phase 6: QE (Testing — automation)
502
555
  - **QE Lead (15+ yrs automation)**: Test strategy, framework choice, automation architecture; review test code. Output per epic: \`docs/sdlc/qe/{epic-slug}/\`
503
556
  - **Senior QE (10+ yrs)**: Write automation tests per QE Lead's strategy. Output per epic: \`docs/sdlc/qe/{epic-slug}/\`
557
+ - **Handoff to Security + Principle Engineer**
558
+
559
+ ### Phase 7: Security + Principle Engineer (audit → fix loop)
560
+ - **Security team**: Audit security risk (OWASP, auth, secrets, infra). Output: \`docs/sdlc/security/\`
561
+ - **Principle Engineer**: Audit logic, architecture alignment, correctness. Output: \`docs/sdlc/principle-engineer/\`
562
+ - **Fix loop**: If issues found → Dev fixes → Security + PE re-audit. **Repeat until all issues resolved.** Sign-off → **Handoff to Deploy**
504
563
 
505
- ### Phase 7: Deploy
506
- - After pipeline completes → deploy with **Docker Compose** (local/staging) and **Kubernetes** (production)
564
+ ### Phase 8: Deploy
565
+ - After Security + Principle Engineer sign-off → deploy with **Docker Compose** (local/staging) and **Kubernetes** (production)
507
566
  - Output: \`docs/sdlc/deploy/\` — docker-compose.yml, k8s/
508
567
 
509
568
  See [reference.md](./reference.md) for templates.
@@ -515,24 +574,26 @@ const ORCHESTRATION_MD = `# Pipeline orchestration
515
574
 
516
575
  When the user sends an **idea**, **feature request**, or **requirement** (e.g. "I want a login page", "We need an API for X"):
517
576
 
518
- 1. **Trigger the full pipeline** and run **Phase 1 → 2 → … → 7 in sequence**.
577
+ 1. **Trigger the full pipeline** and run **Phase 1 → 2 → … → 10 in sequence**.
519
578
  2. **One role per phase:** For each phase, act only as that role, write outputs to the correct \`docs/sdlc/...\` folder, then **continue to the next phase** without asking the user to "run next step".
520
579
  3. **Run through to Deploy.** Do not stop after PO, BA, or Dev unless the user explicitly says to stop.
521
580
 
522
581
  ## How it runs (Cursor and similar)
523
582
 
524
- There is **one agent** per conversation. It simulates the pipeline by **adopting one role per phase** in order: Phase 1 as PO only → Phase 2 as Business BA only → … → Phase 7 as Deploy. Do not mix roles in one step. If the tool later supports separate agents per phase, use that; otherwise this single-agent simulation is correct.
583
+ There is **one agent** per conversation. It simulates the pipeline by **adopting one role per phase** in order: Phase 1 as PO only → Phase 2 as Business BA only → … → Phase 10 as Deploy. Do not mix roles in one step. If the tool later supports separate agents per phase, use that; otherwise this single-agent simulation is correct.
525
584
 
526
585
  ## Checklist per run
527
586
 
528
587
  - [ ] Phase 1 PO: artifacts in \`docs/sdlc/po/{epic-slug}/\` (one folder per epic)
529
588
  - [ ] Phase 2 Business BA: \`docs/sdlc/ba/business/{epic-slug}/\` (one folder per epic)
530
- - [ ] Phase 3 Architect: \`docs/sdlc/architecture/\`
531
- - [ ] Phase 4 Technical BA: \`docs/sdlc/ba/technical/\`
532
- - [ ] Phase 5a QE docs: \`docs/sdlc/qe/{epic-slug}/\` (one folder per epic)
533
- - [ ] Phase 5b Dev: code + unit tests, \`docs/sdlc/dev/\`
534
- - [ ] Phase 6 QE testing: automation, sign-off \`docs/sdlc/qe/{epic-slug}/\`
535
- - [ ] Phase 7 Deploy: \`docs/sdlc/deploy/\`, Docker Compose + K8s
589
+ - [ ] Phase 3 Design (if app/web): Pencil.dev designs in \`docs/sdlc/design/{epic-slug}/\`; PO+BA review until approved
590
+ - [ ] Phase 4 Architect: \`docs/sdlc/architecture/\`
591
+ - [ ] Phase 5 Technical BA: \`docs/sdlc/ba/technical/\`
592
+ - [ ] Phase 6 QE docs: \`docs/sdlc/qe/{epic-slug}/\` (one folder per epic)
593
+ - [ ] Phase 7 Dev: code + unit tests, \`docs/sdlc/dev/\`
594
+ - [ ] Phase 8 QE testing: automation, sign-off → \`docs/sdlc/qe/{epic-slug}/\`
595
+ - [ ] Phase 9 Security + Principle Engineer: \`docs/sdlc/security/\`, \`docs/sdlc/principle-engineer/\`; fix loop until no issues; sign-off
596
+ - [ ] Phase 10 Deploy: \`docs/sdlc/deploy/\`, Docker Compose + K8s
536
597
  `;
537
598
 
538
599
  const REFERENCE_MD = `# SDLC Workflow — Reference
@@ -544,9 +605,12 @@ Deploy: docs/sdlc/deploy/ (Docker Compose + K8s)
544
605
 
545
606
  ## Folder structure: one per epic/feature
546
607
 
547
- - **PO**: \`docs/sdlc/po/{epic-slug}/\` — one folder per epic (e.g. \`job-scheduler-event-bus\`). Files inside: epic-brief.md, user-stories.md, etc. Do not put all epics in one file.
548
- - **Business BA**: \`docs/sdlc/ba/business/{epic-slug}/\` — same slug as PO. Files: functional-requirements.md, process-flows.md, etc. Do not merge all epics into one file.
608
+ - **PO**: \`docs/sdlc/po/{epic-slug}/\` — one folder per epic. Files: epic-brief.md, user-stories.md. Do not put all epics in one file.
609
+ - **Business BA**: \`docs/sdlc/ba/business/{epic-slug}/\` — same slug as PO. Files: functional-requirements.md, process-flows.md. Do not merge all epics into one file.
610
+ - **Design (if app/web)**: \`docs/sdlc/design/{epic-slug}/\` — Pencil.dev .pen designs; PO+BA review until approved.
549
611
  - **QE**: \`docs/sdlc/qe/{epic-slug}/\` — same slug as PO/BA. Files: test-plan.md, test-cases.md, automation. Do not put all epics in one file.
612
+ - **Security**: \`docs/sdlc/security/\` — security audit; fix loop until no issues
613
+ - **Principle Engineer**: \`docs/sdlc/principle-engineer/\` — logic audit; fix loop until no issues
550
614
  `;
551
615
 
552
616
  const AGENTS_README = `# Sub-Agents
@@ -557,9 +621,10 @@ Every role in the SDLC runs as a **sub-agent**. Each phase is assigned to a corr
557
621
  |------|-----------|--------|--------|
558
622
  | PO | po | User request | docs/sdlc/po/{epic-slug}/ (one folder per epic) |
559
623
  | Business BA | business-ba | docs/sdlc/po/{epic-slug}/ | docs/sdlc/ba/business/{epic-slug}/ (one folder per epic) |
560
- | Architect | architect | docs/sdlc/ba/business/ | docs/sdlc/architecture/ |
561
- | Technical BA | technical-ba | docs/sdlc/architecture/ | docs/sdlc/ba/technical/ |
562
- | QE (docs) | qe-docs | docs/sdlc/ba/technical/ | docs/sdlc/qe/{epic-slug}/ (one folder per epic) |
624
+ | Design (if app/web) | pencil-dev | docs/sdlc/po + docs/sdlc/ba/business/ | docs/sdlc/design/{epic-slug}/; PO+BA review until approved |
625
+ | Architect | architect | docs/sdlc/ba/business/ + design (if any) | docs/sdlc/architecture/ |
626
+ | Technical BA | technical-ba | docs/sdlc/architecture/ + design (if any) | docs/sdlc/ba/technical/ |
627
+ | QE (docs) | qe-docs | docs/sdlc/ba/technical/ (+ design if any) | docs/sdlc/qe/{epic-slug}/ (one folder per epic) |
563
628
  | Tech Lead | tech-lead | Technical spec | Review, merge, docs/sdlc/dev/tech-lead/ |
564
629
  | Senior Dev | senior-dev | Spec + test plan | After docs → run implementation immediately. Code, unit tests (≥90%) |
565
630
  | Senior Frontend | frontend | UI spec, API contract | Web UI, docs/sdlc/dev/frontend/ |
@@ -570,16 +635,52 @@ Every role in the SDLC runs as a **sub-agent**. Each phase is assigned to a corr
570
635
  | Senior Platform | platform | Infra spec | CI/CD, observability, docs/sdlc/dev/platform/ |
571
636
  | QE Lead | qe-lead | Test plan | 15+ yrs automation: strategy, framework, review → docs/sdlc/qe/{epic-slug}/ |
572
637
  | Senior QE | senior-qe | Test plan + framework | Automation tests → docs/sdlc/qe/{epic-slug}/ |
573
- | Deploy | deploy | QE sign-off | Docker Compose + K8s, docs/sdlc/deploy/ |
638
+ | Security | security | Code, infra | Security audit docs/sdlc/security/; fix loop until no issues |
639
+ | Principle Engineer | principle-engineer | Code, architecture | Logic audit → docs/sdlc/principle-engineer/; fix loop until no issues |
640
+ | Deploy | deploy | Security + PE sign-off (after fix loop) | Docker Compose + K8s, docs/sdlc/deploy/ |
574
641
 
575
642
  Orchestrator: run each sub-agent in order; hand off output → input of the next sub-agent.
576
643
 
577
644
  **Trigger:** On user idea/request, run the full pipeline (see docs/sdlc/ORCHESTRATION.md). One role per phase; single agent simulates by switching role each phase. Do not stop after one phase until Deploy unless the user asks.
578
645
  `;
579
646
 
647
+ const SECURITY_README = `# Security Team
648
+
649
+ **When:** After implementation (Dev) and QE testing. **Before** Deploy.
650
+
651
+ **Role:** Audit security risk in code, APIs, infra, and configuration. Identify vulnerabilities and recommend mitigations.
652
+
653
+ **Fix loop:** If issues found → Dev fixes → re-audit. Repeat until all issues resolved; then sign-off to Deploy.
654
+
655
+ ## Detailed tasks
656
+
657
+ - [ ] **Read implementation**: Code, API specs, infra configs (docker-compose, k8s)
658
+ - [ ] **Security audit**: OWASP Top 10, auth/authz, injection, XSS, CSRF, secrets exposure, dependency vulns
659
+ - [ ] **Infra/ops security**: Network, TLS, RBAC, secrets management
660
+ - [ ] **Report**: Findings, severity, remediation; output to \`docs/sdlc/security/\`
661
+ - [ ] **Fix loop**: If critical/high issues found → Dev fixes → re-audit. **Repeat until all issues resolved**; then sign-off to Deploy.
662
+ `;
663
+
664
+ const PRINCIPLE_ENGINEER_README = `# Principle Engineer
665
+
666
+ **When:** After implementation (Dev) and QE testing. **Before** Deploy.
667
+
668
+ **Role:** Audit logic, architecture alignment, design decisions, and technical quality. Ensure correctness and consistency with specs.
669
+
670
+ **Fix loop:** If issues found → Dev fixes → re-audit. Repeat until all issues resolved; then sign-off to Deploy.
671
+
672
+ ## Detailed tasks
673
+
674
+ - [ ] **Read implementation**: Code, architecture ADRs, Technical BA spec
675
+ - [ ] **Logic audit**: Business logic correctness, edge cases, error handling, data flow
676
+ - [ ] **Architecture audit**: Alignment with ADRs, patterns, scalability, maintainability
677
+ - [ ] **Report**: Findings, recommendations; output to \`docs/sdlc/principle-engineer/\`
678
+ - [ ] **Fix loop**: If critical logic/arch issues found → Dev fixes → re-audit. **Repeat until all issues resolved**; then sign-off to Deploy.
679
+ `;
680
+
580
681
  const DEPLOY_README = `# Deploy
581
682
 
582
- After the pipeline completes (QE sign-off), deploy immediately with:
683
+ After the pipeline completes (Security + Principle Engineer sign-off, after fix loop until no issues), deploy immediately with:
583
684
 
584
685
  - **Docker Compose** — local / staging: \`docker compose up -d\`
585
686
  - **Kubernetes** — production: \`kubectl apply -f k8s/\`
@@ -763,7 +864,7 @@ docs/sdlc/ba/business/
763
864
  - [ ] **Write use cases**: Actor, goal, preconditions, main/alternate flows, postconditions
764
865
  - [ ] **Maintain glossary**: Business terms, definitions, acronyms
765
866
  - [ ] **Map to user stories**: Trace FRs to user stories / AC
766
- - [ ] **Handoff to Architect**: Deliverables in \`ba/business/{epic-slug}/\`
867
+ - [ ] **Handoff to Design (if app/web) or Architect**: Deliverables in \`ba/business/{epic-slug}/\`
767
868
 
768
869
  Use functional-requirement.template.md for FRS items.
769
870
  `;
@@ -870,6 +971,7 @@ Templates support: HTTP API, library/SDK, CLI, and all project types (see api-sp
870
971
  ## Detailed tasks
871
972
 
872
973
  - [ ] **Read Architect outputs**: ADRs, context/container diagrams, tech stack
974
+ - [ ] **Read Design (if app/web)**: .pen designs — design informs API contracts, screen specs
873
975
  - [ ] **API/interface spec**: For each endpoint/class/command: purpose, request/response, contract (OpenAPI, TS types, CLI help)
874
976
  - [ ] **DB schema**: Tables, columns, indexes, constraints; migrations approach
875
977
  - [ ] **Team breakdown**: Map scope to teams (Backend, Frontend, Mobile, etc.) per project type; dependencies
@@ -904,6 +1006,7 @@ Use adr.template.md for new ADRs.
904
1006
  ## Detailed tasks
905
1007
 
906
1008
  - [ ] **Read Business BA outputs**: Functional requirements, process flows, use cases
1009
+ - [ ] **Read Design (if app/web)**: .pen designs in \`design/{epic-slug}/\` — design informs architecture
907
1010
  - [ ] **Context diagram**: System boundary, external actors, integrations
908
1011
  - [ ] **Container diagram**: Main components/services and their responsibilities
909
1012
  - [ ] **Tech stack decisions**: Languages, frameworks, databases; document in ADRs
@@ -1010,6 +1113,31 @@ const QE_SENIOR_README = `# Senior QE (10+ years exp)
1010
1113
  - [ ] **Output**: Automation code and docs in \`qe/{epic-slug}/\`
1011
1114
  `;
1012
1115
 
1116
+ const DESIGN_README = `# Design (optional — app/web projects only)
1117
+
1118
+ **When:** After Business BA, **before** Architect and Technical BA. **Skip** for API-only, library, CLI, data/ML, platform projects without UI.
1119
+
1120
+ **Why before Architect:** UX drives technical decisions — design informs architecture and API specs.
1121
+
1122
+ **One folder per epic:** \`docs/sdlc/design/{epic-slug}/\` — same slug as PO/BA. Store .pen files and design notes there.
1123
+
1124
+ ## Flow
1125
+
1126
+ 1. **Design sub-agent (Pencil.dev)**: Create UI/UX designs based on idea + PO docs + Business BA FRS. Use Pencil MCP tools (\`batch_design\`, \`get_guidelines\`, \`get_style_guide\`, etc.) to produce .pen designs.
1127
+ 2. **PO + Business BA review**: Both roles review the design against epic brief, user stories, functional requirements.
1128
+ 3. **Loop until approved**: If design does not match idea/docs → return to step 1 with feedback; redesign. Repeat until PO and BA approve.
1129
+ 4. **Handoff to Architect**: Once approved → proceed to Architect (design informs architecture and Technical BA).
1130
+
1131
+ ## Detailed tasks
1132
+
1133
+ - [ ] **Invoke Pencil.dev**: Call design sub-agent (Pencil MCP) with PO epic, BA FRS as context
1134
+ - [ ] **Create designs**: Screens, flows, components in .pen format; output to \`design/{epic-slug}/\`
1135
+ - [ ] **PO review**: Check design aligns with epic brief, user stories, acceptance criteria
1136
+ - [ ] **Business BA review**: Check design matches functional requirements, process flows
1137
+ - [ ] **If not approved**: Capture feedback; loop back to design step with specific changes
1138
+ - [ ] **If approved**: Handoff to Architect; design in \`design/{epic-slug}/\`
1139
+ `;
1140
+
1013
1141
  const DEV_TECH_LEAD_README = `# Tech Lead (15+ years exp)
1014
1142
 
1015
1143
  **Responsibilities**:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdlc-workflow",
3
- "version": "1.0.10",
3
+ "version": "1.1.0",
4
4
  "description": "Scaffold SDLC workflow docs and templates for Cursor, Claude, and dev teams",
5
5
  "type": "module",
6
6
  "bin": {