sdlc-workflow 1.0.11 → 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 -5
  2. package/bin/cli.js +161 -89
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,11 +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 → Design (if app/web, PO+BA review loop) → 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 Technical BA → invoke **Pencil.dev** (MCP) to design; **PO + Business BA review** until approved; then QE + Dev.
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.
13
14
  - **Each role runs as a sub-agent** (see `docs/sdlc/agents/`).
14
15
  - **After completion** → deploy immediately with **Docker Compose** (local/staging) and **Kubernetes** (production) — `docs/sdlc/deploy/`.
15
16
  - **QE (docs)**: Test plan, test cases
@@ -55,11 +56,11 @@ docs/sdlc/
55
56
  │ ├── api-spec.template.md
56
57
  │ ├── team-breakdown.template.md
57
58
  │ └── README.md
59
+ ├── design/ # Design (optional, app/web): after BA, before Architect; Pencil.dev .pen; PO+BA review until approved
60
+ │ └── README.md
58
61
  ├── architecture/ # Architect
59
62
  │ ├── adr.template.md
60
63
  │ └── README.md
61
- ├── design/ # Design (optional, app/web): Pencil.dev .pen; PO+BA review until approved
62
- │ └── README.md
63
64
  ├── qe/ # QE (one folder per epic: qe/{epic-slug}/)
64
65
  │ ├── test-case.template.md
65
66
  │ ├── README.md
@@ -77,9 +78,13 @@ docs/sdlc/
77
78
  │ ├── embedded/ # Senior Embedded 10+ yrs — firmware, IoT
78
79
  │ ├── data-ml/ # Senior Data/ML 10+ yrs
79
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
80
85
  ├── agents/ # Sub-agent specs (each role = sub-agent)
81
86
  │ └── README.md
82
- └── deploy/ # After completion → Docker Compose + K8s
87
+ └── deploy/ # After Security + PE sign-off (fix loop until no issues) → Docker Compose + K8s
83
88
  ├── README.md
84
89
  ├── docker-compose.yml.template
85
90
  └── k8s/
package/bin/cli.js CHANGED
@@ -172,6 +172,8 @@ async function generateFromInline(cwd) {
172
172
  join(base, "dev", "embedded"),
173
173
  join(base, "dev", "data-ml"),
174
174
  join(base, "dev", "platform"),
175
+ join(base, "security"),
176
+ join(base, "principle-engineer"),
175
177
  join(base, "agents"),
176
178
  join(base, "deploy"),
177
179
  join(base, "deploy", "k8s"),
@@ -208,6 +210,8 @@ async function generateFromInline(cwd) {
208
210
  ["dev/embedded/README.md", DEV_EMBEDDED_README],
209
211
  ["dev/data-ml/README.md", DEV_DATA_ML_README],
210
212
  ["dev/platform/README.md", DEV_PLATFORM_README],
213
+ ["security/README.md", SECURITY_README],
214
+ ["principle-engineer/README.md", PRINCIPLE_ENGINEER_README],
211
215
  ["agents/README.md", AGENTS_README],
212
216
  ["deploy/README.md", DEPLOY_README],
213
217
  ["deploy/docker-compose.yml.template", DOCKER_COMPOSE_TEMPLATE],
@@ -235,15 +239,17 @@ globs: docs/sdlc/**/*, **/*.md
235
239
 
236
240
  1. **PO** — PRD, user stories → docs/sdlc/po/{epic-slug}/ (one folder per epic)
237
241
  2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/{epic-slug}/ (one folder per epic)
238
- 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
239
- 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
240
- 5. **Design (if app/web)** — Pencil.dev designs → docs/sdlc/design/{epic-slug}/; **PO + BA review** → loop until approved
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/
241
245
  6. **QE (docs)** — Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
242
246
  7. **Dev** — After docs phase → **run implementation immediately**. Tech Lead + implementation roles → docs/sdlc/dev/{role}/
243
247
  8. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/
244
- 9. **Deploy** — Docker Compose + K8s → docs/sdlc/deploy/
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)
245
251
 
246
- **Each role runs as a sub-agent.** Design uses Pencil.dev MCP. See docs/sdlc/agents/
252
+ **Each role runs as a sub-agent.** Design uses Pencil.dev MCP; UX drives tech. See docs/sdlc/agents/
247
253
  Full workflow: docs/sdlc/SDLC-WORKFLOW.md
248
254
  `;
249
255
 
@@ -261,7 +267,7 @@ Sequential workflow; **each role runs as a sub-agent**. Each phase produces docs
261
267
  **When the user sends an idea, feature request, or new requirement:**
262
268
  1. **Trigger the pipeline** and run it **continuously through deployment** (Phase 1 → 2 → … → 7).
263
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.
264
- 3. **Run in order:** PO → Business BA → Architect → Technical BA → **Design (if app/web)** → QE (docs) → Dev → QE (testing) → Deploy. If Design: **PO + BA review** design; loop until approved before QE/Dev. 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.
265
271
 
266
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.
267
273
 
@@ -270,7 +276,7 @@ Sequential workflow; **each role runs as a sub-agent**. Each phase produces docs
270
276
  ## Flow Overview
271
277
 
272
278
  \`\`\`
273
- User Request → PO → Business BA → Architect → Technical BA → Design (if app/web, PO+BA review loop) → 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)
274
280
  \`\`\`
275
281
 
276
282
  **Determine current phase** before acting. If user sent an idea, assume Phase 0 and start from Phase 1.
@@ -292,32 +298,34 @@ User Request → PO → Business BA → Architect → Technical BA → Design (i
292
298
 
293
299
  **Role**: Break down from business perspective.
294
300
  **Deliverables**: Business process flows, functional requirements, use cases, glossary.
295
- **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.**
296
302
 
297
- ## Phase 3: Architect
298
-
299
- **Role**: Design system architecture and technology choices.
300
- **Deliverables**: System context, container diagram, ADRs, tech stack, cross-cutting concerns.
301
- **Output**: \`docs/sdlc/architecture/\` — **Handoff to Technical BA.**
302
-
303
- ## Phase 4: Technical BA
304
-
305
- **Role**: Translate business + architecture into implementable specs.
306
- **Deliverables**: API specs, DB schema, team breakdown, acceptance criteria per ticket.
307
- **Output**: \`docs/sdlc/ba/technical/\` — **Handoff to Design (if app/web) or QE + Dev.**
308
-
309
- ## Phase 4b: Design (optional — app/web only)
303
+ ## Phase 3: Design (optional — app/web only)
310
304
 
311
305
  **When:** Project has UI (web, mobile app). Skip for API-only, library, CLI, data/ML, platform without UI.
312
306
 
313
- **Role**: Invoke **Pencil.dev** sub-agent (MCP) to create UI/UX designs from idea + PO + Business BA + Technical BA docs.
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.
314
308
  **Output**: \`docs/sdlc/design/{epic-slug}/\` — .pen designs.
315
309
 
316
310
  **Review loop:**
317
311
  1. **PO review**: Design aligns with epic brief, user stories, acceptance criteria?
318
312
  2. **Business BA review**: Design matches functional requirements, process flows?
319
313
  3. **If not approved**: Capture feedback → redesign with Pencil.dev → repeat until PO and BA approve.
320
- 4. **If approved** → **Handoff to QE + Dev.**
314
+ 4. **If approved** → **Handoff to Architect.**
315
+
316
+ ## Phase 4: Architect
317
+
318
+ **Role**: Design system architecture and technology choices.
319
+ **Deliverables**: System context, container diagram, ADRs, tech stack, cross-cutting concerns.
320
+ **Input**: Business BA + Design (if app/web) — design informs architecture.
321
+ **Output**: \`docs/sdlc/architecture/\` — **Handoff to Technical BA.**
322
+
323
+ ## Phase 5: Technical BA
324
+
325
+ **Role**: Translate business + architecture + design into implementable specs.
326
+ **Deliverables**: API specs, DB schema, team breakdown, acceptance criteria per ticket.
327
+ **Input**: Architect + Design (if app/web) — design informs API/screen contracts.
328
+ **Output**: \`docs/sdlc/ba/technical/\` — **Handoff to QE + Dev.**
321
329
 
322
330
  ## Phase 5a: QE (Docs phase)
323
331
 
@@ -352,13 +360,22 @@ User Request → PO → Business BA → Architect → Technical BA → Design (i
352
360
  - **QE Lead (15+ yrs automation)**: Test strategy, framework choice, automation architecture, review test code. Output per epic: \`docs/sdlc/qe/{epic-slug}/\`
353
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)
354
362
 
355
- **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)
356
366
 
357
- ## 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/\`
358
371
 
359
- **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.
360
377
  **Role**: Deploy with **Docker Compose** (local/staging) and **Kubernetes** (production).
361
- **Output**: \`docs/sdlc/deploy/\` — docker-compose.yml, k8s manifests. Deploy right after pipeline completes.
378
+ **Output**: \`docs/sdlc/deploy/\` — docker-compose.yml, k8s manifests.
362
379
 
363
380
  ## Quick Phase Checklist
364
381
 
@@ -367,13 +384,14 @@ User Request → PO → Business BA → Architect → Technical BA → Design (i
367
384
  | 0 | Discovery | Raw request |
368
385
  | 1 | PO | PRD, user stories |
369
386
  | 2 | Business BA | FRS, process flows |
370
- | 3 | Architect | ADRs, system diagrams |
371
- | 4 | Technical BA | API specs, tech breakdown |
372
- | 4b | Design (if app/web) | Pencil.dev designs; PO+BA review until approved |
373
- | 5a | QE (docs) | Test plan, test cases |
374
- | 5b | Dev | Code, unit tests (≥90%) |
375
- | 6 | QE (testing) | QE Lead (15+ yrs automation) + Senior QE (10+ yrs), automation, sign-off |
376
- | 7 | Deploy | Docker Compose + K8s |
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 |
377
395
 
378
396
  **Sub-agents**: Each role = one sub-agent. Design uses Pencil.dev MCP. See docs/sdlc/agents/
379
397
  See reference.md for templates.
@@ -402,7 +420,7 @@ FR-001: [Title] — Description, Trigger, Process Flow, Output, Constraints
402
420
  POST /api/v1/[resource] — Purpose, Request, Response, Contract
403
421
 
404
422
  ## Design (if app/web)
405
- Pencil.dev MCP — create .pen designs from idea + PO + BA + Technical BA. Output: docs/sdlc/design/{epic-slug}/. PO + BA review until approved; loop if not aligned.
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.
406
424
 
407
425
  ## QE: Test Case
408
426
  TC-001: [Scenario] — Precondition, Steps, Expected, Links to AC
@@ -416,11 +434,13 @@ TC-001: [Scenario] — Precondition, Steps, Expected, Links to AC
416
434
  - Senior Dev (10+ yrs): implement, Unit Test ≥90% → docs/sdlc/dev/senior-developer/
417
435
  - By project (all Senior 10+ yrs): Senior Frontend, Backend, Mobile, Embedded, Data/ML, Platform → docs/sdlc/dev/{role}/
418
436
 
419
- ## Sub-agents
420
- 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
421
441
 
422
442
  ## Deploy
423
- After completion → Docker Compose + K8s. See docs/sdlc/deploy/
443
+ After Security + Principle Engineer sign-off → Docker Compose + K8s. See docs/sdlc/deploy/
424
444
  `;
425
445
 
426
446
  const AGENTS_MD_CONTENT = `## SDLC Workflow
@@ -431,15 +451,16 @@ When working on requirements, features, or handoffs, follow these phases:
431
451
 
432
452
  1. **PO** — PRD, user stories → docs/sdlc/po/{epic-slug}/ (one folder per epic)
433
453
  2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/{epic-slug}/ (one folder per epic)
434
- 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
435
- 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
436
- 5. **Design (if app/web)** — Pencil.dev designs → docs/sdlc/design/{epic-slug}/; **PO + BA review** until approved; then QE + Dev
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/
437
457
  6. **QE (docs)** — Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
438
458
  7. **Dev** — After docs phase → **run implementation immediately**. Tech Lead + Senior Dev → docs/sdlc/dev/{role}/
439
459
  8. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
440
- 9. **Deploy** — Docker Compose + K8sdocs/sdlc/deploy/
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/
441
462
 
442
- Design: invoke Pencil.dev MCP; PO and BA review design; loop until approved. After the docs phase, the Dev team runs implementation immediately. See docs/sdlc/agents/
463
+ Design before Architect (UX drives tech). After the docs phase, the Dev team runs implementation immediately. See docs/sdlc/agents/
443
464
  `;
444
465
 
445
466
  const CLAUDE_SDLC_CONTENT = `## SDLC Workflow
@@ -448,15 +469,16 @@ const CLAUDE_SDLC_CONTENT = `## SDLC Workflow
448
469
 
449
470
  1. **PO** — PRD, user stories → docs/sdlc/po/{epic-slug}/ (one folder per epic)
450
471
  2. **Business BA** — FRS, process flows → docs/sdlc/ba/business/{epic-slug}/ (one folder per epic)
451
- 3. **Architect** — ADRs, diagrams → docs/sdlc/architecture/
452
- 4. **Technical BA** — API specs, team breakdown → docs/sdlc/ba/technical/
453
- 5. **Design (if app/web)** — Pencil.dev designs → docs/sdlc/design/{epic-slug}/; **PO + BA review** until approved
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/
454
475
  6. **QE (docs)** — Test plan, test cases → docs/sdlc/qe/{epic-slug}/ (one folder per epic)
455
476
  7. **Dev** — After docs phase → **run implementation immediately**. Tech Lead + Senior Dev → docs/sdlc/dev/{role}/
456
477
  8. **QE (testing)** — QE Lead (15+ yrs automation) + Senior QE (10+ yrs) → docs/sdlc/qe/{epic-slug}/ (same folder per epic)
457
- 9. **Deploy** — Docker Compose + K8sdocs/sdlc/deploy/
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/
458
480
 
459
- Design: Pencil.dev MCP; PO and BA review; loop until approved. After the docs phase, Dev runs implementation immediately. See docs/sdlc/agents/
481
+ Design before Architect (UX drives tech). After the docs phase, Dev runs implementation immediately. See docs/sdlc/agents/
460
482
  `;
461
483
 
462
484
  const SDLC_WORKFLOW_MD = `# SDLC Workflow (Multi-Role)
@@ -473,7 +495,7 @@ For Cursor, see .cursor/rules/sdlc-workflow.mdc
473
495
  ## Flow
474
496
 
475
497
  \`\`\`
476
- User Request → PO → Business BA → Architect → Technical BA → Design (if app/web, PO+BA review loop) → 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
477
499
  \`\`\`
478
500
 
479
501
  ## Phase Checklist
@@ -483,15 +505,16 @@ User Request → PO → Business BA → Architect → Technical BA → Design (i
483
505
  | 0 | Discovery | Raw request |
484
506
  | 1 | PO | PRD, user stories |
485
507
  | 2 | Business BA | FRS, process flows |
486
- | 3 | Architect | ADRs, system diagrams |
487
- | 4 | Technical BA | API specs, tech breakdown |
488
- | 4b | Design (if app/web) | Pencil.dev designs; PO+BA review until approved |
489
- | 5a | QE (docs) | Test plan, test cases |
490
- | 5b | Dev | Code, unit tests (≥90%) |
491
- | 6 | QE (testing) | QE Lead (15+ yrs automation) + Senior QE (10+ yrs), automation, sign-off |
492
- | 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 |
493
516
 
494
- **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/
495
518
 
496
519
  ## Phase Details
497
520
 
@@ -503,20 +526,20 @@ User Request → PO → Business BA → Architect → Technical BA → Design (i
503
526
  - Functional requirements, process flows, use cases
504
527
  - Output: \`docs/sdlc/ba/business/{epic-slug}/\` — **one folder per epic** (same slug as PO); do not merge into one file
505
528
 
506
- ### Phase 3: Architect
507
- - 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)
508
537
  - Output: \`docs/sdlc/architecture/\`
509
538
 
510
- ### Phase 4: Technical BA
511
- - API specs, DB schema, team breakdown
539
+ ### Phase 5: Technical BA
540
+ - API specs, DB schema, team breakdown. Input: Architect + Design (if app/web)
512
541
  - Output: \`docs/sdlc/ba/technical/\`
513
542
 
514
- ### Phase 4b: Design (optional — app/web only)
515
- - Invoke **Pencil.dev** (MCP) to design based on idea + PO + BA + Technical BA docs
516
- - Output: \`docs/sdlc/design/{epic-slug}/\` — .pen designs
517
- - **PO + Business BA review**: Both check design vs epic/FRS; if not aligned → feedback → redesign loop until approved
518
- - When approved → handoff to QE + Dev
519
-
520
543
  ### Phase 5a: QE (Docs)
521
544
  - Test plan, test cases
522
545
  - Output: \`docs/sdlc/qe/{epic-slug}/\` — **one folder per epic**; do not put all epics in one file
@@ -531,9 +554,15 @@ User Request → PO → Business BA → Architect → Technical BA → Design (i
531
554
  ### Phase 6: QE (Testing — automation)
532
555
  - **QE Lead (15+ yrs automation)**: Test strategy, framework choice, automation architecture; review test code. Output per epic: \`docs/sdlc/qe/{epic-slug}/\`
533
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**
534
558
 
535
- ### Phase 7: Deploy
536
- - After pipeline completes deploy with **Docker Compose** (local/staging) and **Kubernetes** (production)
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**
563
+
564
+ ### Phase 8: Deploy
565
+ - After Security + Principle Engineer sign-off → deploy with **Docker Compose** (local/staging) and **Kubernetes** (production)
537
566
  - Output: \`docs/sdlc/deploy/\` — docker-compose.yml, k8s/
538
567
 
539
568
  See [reference.md](./reference.md) for templates.
@@ -545,25 +574,26 @@ const ORCHESTRATION_MD = `# Pipeline orchestration
545
574
 
546
575
  When the user sends an **idea**, **feature request**, or **requirement** (e.g. "I want a login page", "We need an API for X"):
547
576
 
548
- 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**.
549
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".
550
579
  3. **Run through to Deploy.** Do not stop after PO, BA, or Dev unless the user explicitly says to stop.
551
580
 
552
581
  ## How it runs (Cursor and similar)
553
582
 
554
- 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.
555
584
 
556
585
  ## Checklist per run
557
586
 
558
587
  - [ ] Phase 1 PO: artifacts in \`docs/sdlc/po/{epic-slug}/\` (one folder per epic)
559
588
  - [ ] Phase 2 Business BA: \`docs/sdlc/ba/business/{epic-slug}/\` (one folder per epic)
560
- - [ ] Phase 3 Architect: \`docs/sdlc/architecture/\`
561
- - [ ] Phase 4 Technical BA: \`docs/sdlc/ba/technical/\`
562
- - [ ] Phase 4b Design (if app/web): Pencil.dev designs in \`docs/sdlc/design/{epic-slug}/\`; PO+BA review until approved
563
- - [ ] Phase 5a QE docs: \`docs/sdlc/qe/{epic-slug}/\` (one folder per epic)
564
- - [ ] Phase 5b Dev: code + unit tests, \`docs/sdlc/dev/\`
565
- - [ ] Phase 6 QE testing: automation, sign-off → \`docs/sdlc/qe/{epic-slug}/\`
566
- - [ ] 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
567
597
  `;
568
598
 
569
599
  const REFERENCE_MD = `# SDLC Workflow — Reference
@@ -579,6 +609,8 @@ Deploy: docs/sdlc/deploy/ (Docker Compose + K8s)
579
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.
580
610
  - **Design (if app/web)**: \`docs/sdlc/design/{epic-slug}/\` — Pencil.dev .pen designs; PO+BA review until approved.
581
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
582
614
  `;
583
615
 
584
616
  const AGENTS_README = `# Sub-Agents
@@ -589,9 +621,9 @@ Every role in the SDLC runs as a **sub-agent**. Each phase is assigned to a corr
589
621
  |------|-----------|--------|--------|
590
622
  | PO | po | User request | docs/sdlc/po/{epic-slug}/ (one folder per epic) |
591
623
  | Business BA | business-ba | docs/sdlc/po/{epic-slug}/ | docs/sdlc/ba/business/{epic-slug}/ (one folder per epic) |
592
- | Architect | architect | docs/sdlc/ba/business/ | docs/sdlc/architecture/ |
593
- | Technical BA | technical-ba | docs/sdlc/architecture/ | docs/sdlc/ba/technical/ |
594
- | Design (if app/web) | pencil-dev | docs/sdlc/po + ba + technical | docs/sdlc/design/{epic-slug}/; PO+BA review until approved |
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/ |
595
627
  | QE (docs) | qe-docs | docs/sdlc/ba/technical/ (+ design if any) | docs/sdlc/qe/{epic-slug}/ (one folder per epic) |
596
628
  | Tech Lead | tech-lead | Technical spec | Review, merge, docs/sdlc/dev/tech-lead/ |
597
629
  | Senior Dev | senior-dev | Spec + test plan | After docs → run implementation immediately. Code, unit tests (≥90%) |
@@ -603,16 +635,52 @@ Every role in the SDLC runs as a **sub-agent**. Each phase is assigned to a corr
603
635
  | Senior Platform | platform | Infra spec | CI/CD, observability, docs/sdlc/dev/platform/ |
604
636
  | QE Lead | qe-lead | Test plan | 15+ yrs automation: strategy, framework, review → docs/sdlc/qe/{epic-slug}/ |
605
637
  | Senior QE | senior-qe | Test plan + framework | Automation tests → docs/sdlc/qe/{epic-slug}/ |
606
- | 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/ |
607
641
 
608
642
  Orchestrator: run each sub-agent in order; hand off output → input of the next sub-agent.
609
643
 
610
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.
611
645
  `;
612
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
+
613
681
  const DEPLOY_README = `# Deploy
614
682
 
615
- 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:
616
684
 
617
685
  - **Docker Compose** — local / staging: \`docker compose up -d\`
618
686
  - **Kubernetes** — production: \`kubectl apply -f k8s/\`
@@ -796,7 +864,7 @@ docs/sdlc/ba/business/
796
864
  - [ ] **Write use cases**: Actor, goal, preconditions, main/alternate flows, postconditions
797
865
  - [ ] **Maintain glossary**: Business terms, definitions, acronyms
798
866
  - [ ] **Map to user stories**: Trace FRs to user stories / AC
799
- - [ ] **Handoff to Architect**: Deliverables in \`ba/business/{epic-slug}/\`
867
+ - [ ] **Handoff to Design (if app/web) or Architect**: Deliverables in \`ba/business/{epic-slug}/\`
800
868
 
801
869
  Use functional-requirement.template.md for FRS items.
802
870
  `;
@@ -903,6 +971,7 @@ Templates support: HTTP API, library/SDK, CLI, and all project types (see api-sp
903
971
  ## Detailed tasks
904
972
 
905
973
  - [ ] **Read Architect outputs**: ADRs, context/container diagrams, tech stack
974
+ - [ ] **Read Design (if app/web)**: .pen designs — design informs API contracts, screen specs
906
975
  - [ ] **API/interface spec**: For each endpoint/class/command: purpose, request/response, contract (OpenAPI, TS types, CLI help)
907
976
  - [ ] **DB schema**: Tables, columns, indexes, constraints; migrations approach
908
977
  - [ ] **Team breakdown**: Map scope to teams (Backend, Frontend, Mobile, etc.) per project type; dependencies
@@ -937,6 +1006,7 @@ Use adr.template.md for new ADRs.
937
1006
  ## Detailed tasks
938
1007
 
939
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
940
1010
  - [ ] **Context diagram**: System boundary, external actors, integrations
941
1011
  - [ ] **Container diagram**: Main components/services and their responsibilities
942
1012
  - [ ] **Tech stack decisions**: Languages, frameworks, databases; document in ADRs
@@ -1045,25 +1115,27 @@ const QE_SENIOR_README = `# Senior QE (10+ years exp)
1045
1115
 
1046
1116
  const DESIGN_README = `# Design (optional — app/web projects only)
1047
1117
 
1048
- **When:** After Technical BA, before QE and Dev. **Skip** for API-only, library, CLI, data/ML, platform projects without UI.
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.
1049
1121
 
1050
1122
  **One folder per epic:** \`docs/sdlc/design/{epic-slug}/\` — same slug as PO/BA. Store .pen files and design notes there.
1051
1123
 
1052
1124
  ## Flow
1053
1125
 
1054
- 1. **Design sub-agent (Pencil.dev)**: Create UI/UX designs based on idea + PO docs + Business BA FRS + Technical BA spec. Use Pencil MCP tools (\`batch_design\`, \`get_guidelines\`, \`get_style_guide\`, etc.) to produce .pen designs.
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.
1055
1127
  2. **PO + Business BA review**: Both roles review the design against epic brief, user stories, functional requirements.
1056
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.
1057
- 4. **Handoff to QE + Dev**: Once approved → proceed to QE (docs) and Dev.
1129
+ 4. **Handoff to Architect**: Once approved → proceed to Architect (design informs architecture and Technical BA).
1058
1130
 
1059
1131
  ## Detailed tasks
1060
1132
 
1061
- - [ ] **Invoke Pencil.dev**: Call design sub-agent (Pencil MCP) with PO epic, BA FRS, Technical BA spec as context
1133
+ - [ ] **Invoke Pencil.dev**: Call design sub-agent (Pencil MCP) with PO epic, BA FRS as context
1062
1134
  - [ ] **Create designs**: Screens, flows, components in .pen format; output to \`design/{epic-slug}/\`
1063
1135
  - [ ] **PO review**: Check design aligns with epic brief, user stories, acceptance criteria
1064
1136
  - [ ] **Business BA review**: Check design matches functional requirements, process flows
1065
1137
  - [ ] **If not approved**: Capture feedback; loop back to design step with specific changes
1066
- - [ ] **If approved**: Handoff to QE and Dev; design in \`design/{epic-slug}/\`
1138
+ - [ ] **If approved**: Handoff to Architect; design in \`design/{epic-slug}/\`
1067
1139
  `;
1068
1140
 
1069
1141
  const DEV_TECH_LEAD_README = `# Tech Lead (15+ years exp)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdlc-workflow",
3
- "version": "1.0.11",
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": {