@educa-corp/sdd-framework 0.6.0 → 0.7.1
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/bin/gate-trace.js +25 -2
- package/bin/index.js +32 -5
- package/bin/lint-trace.js +41 -0
- package/bin/self-check.js +430 -3
- package/bin/trace-schema.json +418 -31
- package/core/FRAMEWORK_VERSION +1 -1
- package/{commands/extend-prd.md → core/commands/amend-prd.md} +206 -173
- package/core/commands/dev-run-test.md +48 -10
- package/core/commands/extend-prd.md +39 -12
- package/core/commands/generate-bdd.md +52 -10
- package/core/commands/generate-code.md +35 -2
- package/core/commands/generate-tech-docs.md +36 -4
- package/core/commands/map-testids.md +1 -1
- package/core/commands/qc-run-test.md +29 -3
- package/core/commands/refine-prd.md +13 -2
- package/core/commands/review-context.md +43 -8
- package/core/commands/sync.md +105 -1
- package/core/commands/validate-traces.md +289 -16
- package/core/rules/workflow.md +34 -0
- package/core/steps/context-loader.md +27 -6
- package/core/templates/feature.template +1 -1
- package/core/templates/project-context.yaml +3 -3
- package/core/templates/tech-design.template.md +2 -2
- package/docs/02-concepts/architecture.md +37 -1
- package/docs/02-concepts/overview.md +1 -1
- package/docs/02-concepts/pipeline-steps/02-specification.md +13 -7
- package/docs/02-concepts/pipeline-steps/07-dev-selftest.md +2 -0
- package/docs/02-concepts/pipeline-steps/08-qc-automation.md +1 -0
- package/docs/02-concepts/pipeline-steps/09-validate-traces.md +34 -3
- package/docs/02-concepts/pipeline-steps/10-feedback-loop.md +10 -1
- package/docs/02-concepts/traceability.md +187 -183
- package/docs/03-guides/architect.md +13 -4
- package/docs/03-guides/developer.md +1 -0
- package/docs/03-guides/product-owner.md +89 -72
- package/docs/03-guides/tester-qa.md +81 -81
- package/docs/04-reference/commands.md +148 -134
- package/docs/04-reference/trace-schema.md +45 -1
- package/docs/explain/02b-extend-prd.md +1 -1
- package/docs/explain/02c-amend-prd.md +152 -0
- package/docs/explain/06-generate-bdd.md +1 -1
- package/docs/explain/13-dev-run-test.md +15 -1
- package/docs/explain/19-qc-run-test.md +91 -87
- package/docs/explain/21-validate-traces.md +79 -75
- package/docs/explain/28-sync.md +25 -0
- package/docs/explain/README.md +136 -135
- package/package.json +1 -8
- package/commands/debug.md +0 -529
- package/commands/debug.tmpl +0 -260
- package/commands/define-product.md +0 -438
- package/commands/define-product.tmpl +0 -225
- package/commands/dev-gen-test.md +0 -700
- package/commands/dev-gen-test.tmpl +0 -490
- package/commands/dev-run-test.md +0 -435
- package/commands/dev-run-test.tmpl +0 -225
- package/commands/dev-smoke-test.md +0 -374
- package/commands/dev-smoke-test.tmpl +0 -217
- package/commands/extend-prd.tmpl +0 -273
- package/commands/fix-bug.md +0 -519
- package/commands/fix-bug.tmpl +0 -197
- package/commands/generate-architecture.md +0 -354
- package/commands/generate-architecture.tmpl +0 -197
- package/commands/generate-bdd.md +0 -923
- package/commands/generate-bdd.tmpl +0 -590
- package/commands/generate-code.md +0 -859
- package/commands/generate-code.tmpl +0 -649
- package/commands/generate-design-spec.md +0 -737
- package/commands/generate-design-spec.tmpl +0 -524
- package/commands/generate-prd.md +0 -722
- package/commands/generate-prd.tmpl +0 -226
- package/commands/generate-spec-manifest.md +0 -321
- package/commands/generate-spec-manifest.tmpl +0 -164
- package/commands/generate-tech-docs.md +0 -920
- package/commands/generate-tech-docs.tmpl +0 -273
- package/commands/learn.md +0 -399
- package/commands/learn.tmpl +0 -130
- package/commands/map-testids.md +0 -238
- package/commands/map-testids.tmpl +0 -81
- package/commands/propose-scenario.md +0 -359
- package/commands/propose-scenario.tmpl +0 -202
- package/commands/qc-analyze.md +0 -269
- package/commands/qc-analyze.tmpl +0 -112
- package/commands/qc-design-test.md +0 -226
- package/commands/qc-design-test.tmpl +0 -69
- package/commands/qc-plan.md +0 -206
- package/commands/qc-plan.tmpl +0 -49
- package/commands/qc-report.md +0 -217
- package/commands/qc-report.tmpl +0 -60
- package/commands/qc-review.md +0 -210
- package/commands/qc-review.tmpl +0 -53
- package/commands/qc-run-test.md +0 -326
- package/commands/qc-run-test.tmpl +0 -116
- package/commands/refine-prd.md +0 -653
- package/commands/refine-prd.tmpl +0 -281
- package/commands/report-bug.md +0 -305
- package/commands/report-bug.tmpl +0 -148
- package/commands/review-code.md +0 -415
- package/commands/review-code.tmpl +0 -146
- package/commands/review-context.md +0 -902
- package/commands/review-context.tmpl +0 -530
- package/commands/review-tech-docs.md +0 -561
- package/commands/review-tech-docs.tmpl +0 -404
- package/commands/setup-ai-first.md +0 -602
- package/commands/setup-ai-first.tmpl +0 -450
- package/commands/sync.md +0 -430
- package/commands/sync.tmpl +0 -429
- package/commands/update-framework.md +0 -203
- package/commands/update-framework.tmpl +0 -202
- package/commands/validate-traces.md +0 -1077
- package/commands/validate-traces.tmpl +0 -920
- package/hooks/data-guard.js +0 -232
- package/hooks/settings.json +0 -19
- package/modules/android-compose/module.yaml +0 -13
- package/modules/android-compose/stack-profile.yaml +0 -57
- package/modules/angular/architecture-snippets/component-patterns.md +0 -187
- package/modules/angular/module.yaml +0 -6
- package/modules/angular/stack-profile.yaml +0 -38
- package/modules/context-engineering/architecture-snippets/context-design.md +0 -119
- package/modules/context-engineering/module.yaml +0 -9
- package/modules/context-engineering/stack-profile.yaml +0 -61
- package/modules/dotnet/architecture-snippets/clean-arch.md +0 -160
- package/modules/dotnet/module.yaml +0 -6
- package/modules/dotnet/stack-profile.yaml +0 -50
- package/modules/flutter/module.yaml +0 -14
- package/modules/flutter/stack-profile.yaml +0 -59
- package/modules/golang/architecture-snippets/domain-layout.md +0 -283
- package/modules/golang/module.yaml +0 -6
- package/modules/golang/stack-profile.yaml +0 -40
- package/modules/ios-swiftui/module.yaml +0 -13
- package/modules/ios-swiftui/stack-profile.yaml +0 -55
- package/modules/java-spring/architecture-snippets/layered-arch.md +0 -201
- package/modules/java-spring/module.yaml +0 -15
- package/modules/java-spring/stack-profile.yaml +0 -28
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +0 -269
- package/modules/nextjs/module.yaml +0 -14
- package/modules/nextjs/stack-profile.yaml +0 -74
- package/modules/nuxt/module.yaml +0 -14
- package/modules/nuxt/stack-profile.yaml +0 -58
- package/modules/phaser-game/architecture-snippets/phaser-scene-patterns.md +0 -646
- package/modules/phaser-game/module.yaml +0 -15
- package/modules/phaser-game/stack-profile.yaml +0 -90
- package/modules/php-laravel/architecture-snippets/service-repository.md +0 -302
- package/modules/php-laravel/module.yaml +0 -15
- package/modules/php-laravel/stack-profile.yaml +0 -56
- package/modules/qc-playwright/stack-profile.yaml +0 -66
- package/modules/react/architecture-snippets/hooks-query-patterns.md +0 -254
- package/modules/react/module.yaml +0 -14
- package/modules/react/stack-profile.yaml +0 -63
- package/modules/react-native/module.yaml +0 -14
- package/modules/react-native/stack-profile.yaml +0 -56
- package/modules/vue/module.yaml +0 -14
- package/modules/vue/stack-profile.yaml +0 -65
- package/rules/data-protection.md +0 -80
- package/rules/workflow.md +0 -99
- package/skills/code/SKILL.md +0 -19
- package/skills/code/SKILL.tmpl +0 -19
- package/skills/debug/SKILL.md +0 -19
- package/skills/debug/SKILL.tmpl +0 -19
- package/skills/design-spec/SKILL.md +0 -11
- package/skills/design-spec/SKILL.tmpl +0 -11
- package/skills/discovery/SKILL.md +0 -14
- package/skills/discovery/SKILL.tmpl +0 -14
- package/skills/prd/SKILL.md +0 -19
- package/skills/prd/SKILL.tmpl +0 -19
- package/skills/qc/qa-analyst/DOC_GAPS.template.md +0 -63
- package/skills/qc/qa-analyst/acceptance-criteria.md +0 -60
- package/skills/qc/qa-analyst/business-rules.md +0 -59
- package/skills/qc/qa-analyst/data-flow.md +0 -64
- package/skills/qc/qa-analyst/spec-breakdown.md +0 -61
- package/skills/qc/qa-designer/e2e/journey.md +0 -41
- package/skills/qc/qa-designer/exploratory/charter.md +0 -68
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +0 -43
- package/skills/qc/qa-designer/functional/api.md +0 -45
- package/skills/qc/qa-designer/functional/gui-feature.md +0 -46
- package/skills/qc/qa-designer/functional/gui-screen.md +0 -52
- package/skills/qc/qa-designer/integration/api.md +0 -42
- package/skills/qc/qa-designer/integration/db.md +0 -39
- package/skills/qc/qa-designer/integration/gui.md +0 -40
- package/skills/qc/qa-designer/integration/kafka.md +0 -40
- package/skills/qc/qa-designer/non-functional.md +0 -40
- package/skills/qc/qa-planner/test-plan.md +0 -120
- package/skills/qc/qa-reviewer/script/e2e.md +0 -87
- package/skills/qc/qa-reviewer/script/exploratory.md +0 -45
- package/skills/qc/qa-reviewer/script/functional.md +0 -101
- package/skills/qc/qa-reviewer/script/integration.md +0 -91
- package/skills/qc/qa-reviewer/script/non-functional.md +0 -126
- package/skills/qc/qa-reviewer/test-case/e2e.md +0 -73
- package/skills/qc/qa-reviewer/test-case/exploratory.md +0 -43
- package/skills/qc/qa-reviewer/test-case/functional.md +0 -76
- package/skills/qc/qa-reviewer/test-case/integration.md +0 -69
- package/skills/qc/qa-reviewer/test-case/non-functional.md +0 -73
- package/skills/qc/qa-runner/e2e.md +0 -49
- package/skills/qc/qa-runner/exploratory/session.md +0 -36
- package/skills/qc/qa-runner/functional/api.md +0 -35
- package/skills/qc/qa-runner/functional/gui-feature.md +0 -51
- package/skills/qc/qa-runner/functional/gui-screen.md +0 -55
- package/skills/qc/qa-runner/integration.md +0 -47
- package/skills/qc/qa-runner/non-functional.md +0 -49
- package/skills/qc/qa-runner/report/report.md +0 -37
- package/skills/setup-ai-first/SKILL.md +0 -19
- package/skills/setup-ai-first/SKILL.tmpl +0 -19
- package/skills/spec/SKILL.md +0 -19
- package/skills/spec/SKILL.tmpl +0 -19
- package/skills/test/SKILL.md +0 -18
- package/skills/test/SKILL.tmpl +0 -18
- package/steps/business-language.md +0 -56
- package/steps/capture-lesson.md +0 -112
- package/steps/context-loader.md +0 -406
- package/steps/gate.md +0 -151
- package/steps/report-footer.md +0 -125
- package/steps/review-fanout.md +0 -159
- package/steps/spawn-agent.md +0 -129
- package/steps/trace-mirror.md +0 -53
- package/templates/README.md +0 -70
- package/templates/architecture.template.md +0 -394
- package/templates/ci/trace-gate.yml +0 -146
- package/templates/design-spec.template.md +0 -217
- package/templates/feature.template +0 -123
- package/templates/hooks/pre-push +0 -61
- package/templates/platform-guide.template.md +0 -145
- package/templates/prd.template.md +0 -283
- package/templates/product-definition.template.md +0 -188
- package/templates/project-context.yaml +0 -212
- package/templates/tech-design.template.md +0 -490
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
# /generate-architecture — Sinh / làm mới Architecture Context (SSOT)
|
|
2
|
-
|
|
3
|
-
> **Mô hình phạm vi:** MỘT `architecture.md` cho mỗi codebase — nguồn chân lý (SSOT)
|
|
4
|
-
> cross-cutting cho kiến trúc, dùng cho cả AI code-gen lẫn ops. Lệnh **thu thập từ mọi
|
|
5
|
-
> nguồn sẵn có (config + tài liệu + code) → phỏng vấn lấp chỗ trống → draft → bàn giao
|
|
6
|
-
> cho người verify**. Tách khỏi `/setup-ai-first` để SA chạy lại nhiều lần (refresh /
|
|
7
|
-
> điền dần). Nó KHÔNG tự ký duyệt — con người là trust-gate.
|
|
8
|
-
>
|
|
9
|
-
> **Triết lý điền:** ưu tiên **hút cái đã biết**, chỉ **hỏi cái chưa biết**. SA không phải
|
|
10
|
-
> điền tay 140 ô — chỉ trả lời vài câu dễ hiểu về phần chưa nguồn nào trả lời được.
|
|
11
|
-
>
|
|
12
|
-
> **Khác `/generate-tech-docs`:** tech-docs là thiết kế **per-PRD/feature**; lệnh này mô tả
|
|
13
|
-
> **kiến trúc toàn hệ thống dùng chung**. Chi tiết per-repo (thư mục, namespace) vẫn ở
|
|
14
|
-
> `.ai-project-guide.md` / CLAUDE.md của từng repo — lệnh này chỉ lo phần cross-cutting.
|
|
15
|
-
|
|
16
|
-
## Gate
|
|
17
|
-
|
|
18
|
-
*Checkpoint: **chặn CỨNG** — ghi đè architecture.md đã verified_by một người thật. `--yes` KHÔNG bỏ qua được (gate Bước 3a).*
|
|
19
|
-
|
|
20
|
-
{{include:steps/gate.md}}
|
|
21
|
-
|
|
22
|
-
*Với lệnh này — **bỏ qua Gate Bước 1** (không có input feature-file). `$ARGUMENTS` là **tuỳ chọn**, có thể gồm:
|
|
23
|
-
- **service path** (chế độ umbrella, vd `user-service`) → target là `architecture.md` của service đó, scan giới hạn trong `{service}/`.
|
|
24
|
-
- `--from=<path/glob,...>` → danh sách **tài liệu có sẵn** để hút nội dung (README, wiki, ADR, doc thiết kế cũ). Vd `--from=docs/**/*.md,README.md`.
|
|
25
|
-
- `--section=<slug>` → chỉ lấp/refresh **đúng một mục** (điền dần). Danh sách slug ở Bước 5.
|
|
26
|
-
- `--interview` → ép chạy phỏng vấn kể cả brownfield.
|
|
27
|
-
Vẫn chạy Bước 0-B (model check) và Context Loader.*
|
|
28
|
-
|
|
29
|
-
## Context
|
|
30
|
-
{{include:steps/context-loader.md}}
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Bước 1 — Phân giải target, chế độ & tham số
|
|
35
|
-
|
|
36
|
-
1. **Target file:**
|
|
37
|
-
- Mặc định → `{paths.specs_dir}/architecture.md` (thường `specs/architecture.md`). Umbrella: context-loader đã trỏ `specs_dir`/`service_root` về service active → target nằm cạnh code service.
|
|
38
|
-
- `$ARGUMENTS` có **service path** → `target = {service}/specs/architecture.md`, scan giới hạn trong `{service}/`.
|
|
39
|
-
- **Umbrella mà không truyền service path** → DỪNG, hỏi: *"Umbrella không có một stack đơn. Chạy `/generate-architecture {service-path}` cho từng service."*
|
|
40
|
-
|
|
41
|
-
2. **Parse cờ:** `--from` (danh sách nguồn tài liệu), `--section=<slug>` (chế độ 1-mục → nhảy Bước 5), `--interview` (ép phỏng vấn).
|
|
42
|
-
|
|
43
|
-
3. **Chế độ code:** brownfield (có build/manifest: `pom.xml`/`*.csproj`/`package.json`/`go.mod`/`pubspec.yaml`/`build.gradle`/`Cargo.toml`) vs greenfield (không có code để scan).
|
|
44
|
-
|
|
45
|
-
4. **File đã tồn tại?**
|
|
46
|
-
- Chưa → tạo mới.
|
|
47
|
-
- `verified_by: AI-draft` (hoặc trống) → được regenerate (xác nhận: *"architecture.md đang là AI-draft chưa verify — regenerate đè lên? (Y/N)"*).
|
|
48
|
-
- `verified_by: {người thật}` → **KHÔNG đè** → nhảy **Bước 6** (refresh có kiểm soát).
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Bước 2 — Thu thập từ mọi nguồn (điền cái đã biết)
|
|
53
|
-
|
|
54
|
-
Gom dữ kiện cho từng section/field theo **thứ tự ưu tiên**. Với mỗi giá trị điền được, ghi lại **nguồn** + **độ chắc chắn** (chắc / cần xác nhận). KHÔNG bịa ngoài bằng chứng.
|
|
55
|
-
|
|
56
|
-
**Thứ tự nguồn:**
|
|
57
|
-
|
|
58
|
-
1. **Config dự án** (luôn có) — đọc `project-context.yaml` + `CLAUDE.md`:
|
|
59
|
-
| Field template | Nguồn |
|
|
60
|
-
|---|---|
|
|
61
|
-
| Tech Stack (language/framework/db/build/test) | `project-context.yaml → tech_stack`, `conventions` |
|
|
62
|
-
| Các tầng + rules kiến trúc | `CLAUDE.md §2` |
|
|
63
|
-
| Quy ước đặt tên, response wrapper, error handling | `CLAUDE.md §3, §5` |
|
|
64
|
-
| Quy ước Git/DB nếu có | `CLAUDE.md §6, §7` |
|
|
65
|
-
|
|
66
|
-
2. **Tài liệu có sẵn** (nếu có `--from`, hoặc hỏi 1 lần: *"Có tài liệu kiến trúc/thiết kế sẵn không? Trỏ path — README, wiki, ADR, doc cũ. Enter để bỏ qua."*) — đọc từng tài liệu, rút fact và **map vào section/field** tương ứng của template. Ghi chú nguồn theo dạng `<!-- nguồn: {đường-dẫn} -->` ở section được điền.
|
|
67
|
-
|
|
68
|
-
3. **Scan code** (chỉ brownfield) — quét có mục tiêu:
|
|
69
|
-
| Nguồn quét | Section suy ra |
|
|
70
|
-
|---|---|
|
|
71
|
-
| build/manifest (dependencies) | **Tech Stack** |
|
|
72
|
-
| cây thư mục + tên project/layer (`*.Domain`/`*.Application`… hoặc `controller/service/repository`) | **Các tầng** + chiều phụ thuộc |
|
|
73
|
-
| DI registration (`Program.cs`/`Startup`/`*ServiceExtensions`) | **Đăng ký DI**, danh mục service/repo, **Ranh giới truy cập dữ liệu** |
|
|
74
|
-
| middleware / filter / interceptor | **Luồng Xác thực**, correlation-id, gateway |
|
|
75
|
-
| `appsettings*`/`application.yml`/`.env.example` | **Caching** (TTL), **Event Bus/Sharding**, **Feature Toggle** (chỉ ghi *tên* cấu hình, KHÔNG copy secret) |
|
|
76
|
-
| response wrapper / base controller / global exception handler | **Response API chuẩn** |
|
|
77
|
-
| entity/model (DbSet/@Entity) vs POCO/DTO từ API client | **Phân loại Entity**, **Identity Resolution** (nếu có external-id) |
|
|
78
|
-
| CI (`.github/workflows`, `Jenkinsfile`…), Dockerfile, k8s | **Triển khai & DevOps** |
|
|
79
|
-
|
|
80
|
-
**Xử lý xung đột:** nếu ≥2 nguồn nói khác nhau (vd doc cũ "Redis TTL 10m" nhưng config "5m") → **KHÔNG tự chọn**. Đưa vào danh sách cần hỏi (Bước 3) hoặc gắn ⚠️ vào draft. Quy tắc chung: fact máy móc (tech stack, TTL, DI) ưu tiên **code/config**; phần ý đồ/narrative (data flow, rules, NFR) ưu tiên **tài liệu**.
|
|
81
|
-
|
|
82
|
-
**Sản phẩm Bước 2:** với mỗi section — trạng thái `đã-điền` (kèm nguồn) / `còn-trống` / `xung-đột`. Đây là đầu vào cho phỏng vấn (chỉ hỏi phần còn-trống/xung-đột).
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Bước 3 — Phỏng vấn thích ứng (chỉ hỏi cái chưa biết)
|
|
87
|
-
|
|
88
|
-
### 3.0 — Báo cáo coverage trước khi hỏi
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
Đã điền từ config/tài liệu/code : {X}/{tổng} mục
|
|
92
|
-
Còn cần hỏi : §{A}, §{B}, §{C}
|
|
93
|
-
Xung đột cần xác nhận : §{D} (nguồn 1 nói …, nguồn 2 nói …)
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### 3.1 — Cách đặt câu hỏi (BẮT BUỘC: dễ hiểu, không thuật ngữ trần)
|
|
97
|
-
|
|
98
|
-
Mỗi câu là một **thẻ giải thích**: tên mục + 1–2 câu nghĩa + ví dụ cụ thể + Có/Không nghĩa là gì. Ví dụ mẫu:
|
|
99
|
-
```
|
|
100
|
-
【 Hệ thống có Multi-tenant không? 】
|
|
101
|
-
Một hệ thống phục vụ NHIỀU khách hàng/chi nhánh, dữ liệu mỗi bên tách riêng,
|
|
102
|
-
không bên nào thấy của bên kia (vd: app SaaS bán hàng — mỗi shop chỉ thấy đơn của mình).
|
|
103
|
-
• CÓ → phục vụ nhiều bên, cần cách ly dữ liệu
|
|
104
|
-
• KHÔNG → chỉ phục vụ một tổ chức duy nhất
|
|
105
|
-
```
|
|
106
|
-
Áp dụng phong cách này cho MỌI câu. Tuyệt đối không hỏi kiểu "Multi-tenant? [Y/N]" trơ trọi.
|
|
107
|
-
|
|
108
|
-
### 3.2 — Pha 1: Sàng lọc (quyết mục conditional nào bật)
|
|
109
|
-
|
|
110
|
-
Hỏi các thẻ dưới đây, **BỎ câu nào đã có đáp án** từ Bước 2 (config/tài liệu/code). Mỗi thẻ quyết định (các) section:
|
|
111
|
-
|
|
112
|
-
| Thẻ hỏi (diễn đạt dễ hiểu như 3.1) | Bật section |
|
|
113
|
-
|---|---|
|
|
114
|
-
| Kiểu kiến trúc? (Layered/Clean/Hexagonal/Component-based) | §Các tầng (chọn sơ đồ mẫu) |
|
|
115
|
-
| Backend có expose REST API cho client gọi? | §Response API + §Quy ước API |
|
|
116
|
-
| Multi-tenant (nhiều khách hàng, dữ liệu tách riêng)? | §Multi-tenant |
|
|
117
|
-
| Có tích hợp hệ ngoài có ID riêng (partner/hệ cũ)? | §Phân loại Entity + §Identity Resolution + §Nguồn dữ liệu + §Ranh giới truy cập dữ liệu |
|
|
118
|
-
| Có xử lý bất đồng bộ qua message bus (Kafka/RabbitMQ…)? | §Event Bus |
|
|
119
|
-
| Dữ liệu chia nhiều DB / sharding? | §Sharding |
|
|
120
|
-
| Có bật/tắt tính năng bằng feature flag lúc chạy? | §Feature Toggle |
|
|
121
|
-
| Có API Gateway đứng trước các service? | §API Gateway |
|
|
122
|
-
| Có cache riêng (Redis…) để tăng tốc? | §Caching |
|
|
123
|
-
| Nhiều repo / nhiều service? | §Repos + §Trách nhiệm service + §Giao tiếp giữa service |
|
|
124
|
-
|
|
125
|
-
Trả lời KHÔNG → section tương ứng để **STUB** (không hỏi thêm về nó nữa).
|
|
126
|
-
|
|
127
|
-
### 3.3 — Pha 2: Đào sâu (drill loop, tới khi ĐỦ-ĐỂ-VIẾT)
|
|
128
|
-
|
|
129
|
-
Với **mỗi mục được bật (CÓ)** mà nội dung còn thiếu để viết đúng, hỏi tiếp bằng thẻ dễ hiểu — **lặp tới khi đủ**. Ví dụ sau khi CÓ multi-tenant:
|
|
130
|
-
```
|
|
131
|
-
Bạn nói CÓ multi-tenant. Để viết đúng phần này, cho hỏi thêm:
|
|
132
|
-
1. Mỗi bản ghi phân biệt khách hàng bằng cột nào? (vd TenantId, MerchantId, OrgId)
|
|
133
|
-
2. Cách ly kiểu gì? [tự động lọc mọi truy vấn / mỗi khách một DB riêng / khác]
|
|
134
|
-
(Chưa rõ thì gõ "để sau" — mục này để trống, bổ sung sau bằng --section=multi-tenant)
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Ràng buộc loop (BẮT BUỘC — tránh lan man/phiền):**
|
|
138
|
-
- **Chỉ đào sâu trong phạm vi mục SA đã trả lời CÓ.** KHÔNG tự mở chủ đề mới. Mục SA nói KHÔNG → không bao giờ hỏi lại.
|
|
139
|
-
- **Chỉ hỏi khi mơ hồ THỰC SỰ cản việc viết đúng** mục đó — không hỏi chi tiết "cho vui".
|
|
140
|
-
- **Gộp 2–3 câu/lượt** theo cụm, không hỏi lắt nhắt từng cái.
|
|
141
|
-
- **Luôn có lối thoát:** SA gõ "để sau / chưa rõ" → mục đó thành **STUB**, dừng đào sâu ngay. → Loop chắc chắn kết thúc.
|
|
142
|
-
- Follow-up cũng **skip-if-answered**: nếu tài liệu/config/code đã trả lời thì không hỏi.
|
|
143
|
-
|
|
144
|
-
**Kết thúc phỏng vấn khi:** mọi mục CÓ đều (a) đủ để viết, hoặc (b) SA chủ động hoãn (→ stub). Xung đột ở 3.0 cũng được hỏi xác nhận trong pha này.
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Bước 4 — Lắp ráp theo tier
|
|
149
|
-
|
|
150
|
-
Nguồn khung: `.agent/templates/architecture.template.md` (đọc marker `<!-- tier: core|conditional|ops -->` mỗi mục).
|
|
151
|
-
|
|
152
|
-
1. **core** → **luôn viết**, pre-fill từ Bước 2 + đáp án. Field nào vẫn chưa rõ → giữ `{{PLACEHOLDER}}` + comment (không stub cả mục core).
|
|
153
|
-
2. **conditional** → nếu mục được bật (Bước 2 có nguồn HOẶC phỏng vấn CÓ) → viết đầy đủ; ngược lại → **STUB**:
|
|
154
|
-
```
|
|
155
|
-
## {Tên mục} <!-- tier: conditional --> <!-- status: stub -->
|
|
156
|
-
> ⏳ Chưa tài liệu hoá. Chạy `/generate-architecture --section={slug}` khi cần, hoặc điền tay.
|
|
157
|
-
```
|
|
158
|
-
3. **ops** → mặc định **STUB** (không ép điền upfront). Chỉ điền nếu Bước 2 đã có nguồn rõ ràng (vd CI config, logging setup) — khi đó điền luôn, bỏ stub.
|
|
159
|
-
4. **Provenance:** mỗi section điền từ tài liệu ngoài → chèn `<!-- nguồn: {path} -->`. Section có xung đột chưa giải → chèn `<!-- ⚠️ xung đột: … -->`.
|
|
160
|
-
5. **Frontmatter — trust-gate:** `last_verified: {hôm nay}`; `verified_by: AI-draft` (khi có bất kỳ nội dung do AI hút/suy) hoặc `{{AUTHOR}}` (greenfield thuần tay chưa có gì).
|
|
161
|
-
6. Nhất quán thuật ngữ với `business-dictionary.md` + tên entity `core-entities.md`; KHÔNG dùng banned term.
|
|
162
|
-
7. Ghi ra `target`.
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Bước 5 — Chế độ `--section=<slug>` (điền dần một mục)
|
|
167
|
-
|
|
168
|
-
Khi `$ARGUMENTS` có `--section=<slug>`: bỏ qua lắp ráp toàn bộ, **chỉ** lấp/refresh đúng mục đó.
|
|
169
|
-
1. Định vị mục theo bảng slug bên dưới trong `target`.
|
|
170
|
-
2. Chạy thu thập (Bước 2) + phỏng vấn đào sâu (Bước 3.3) **giới hạn cho mục này**.
|
|
171
|
-
3. Thay khối stub bằng nội dung đã điền, gỡ `<!-- status: stub -->`. Nếu mục đã có nội dung → refresh theo chênh lệch, giữ chỉnh tay của người.
|
|
172
|
-
4. Cập nhật `last_verified`; nếu file đang `verified_by: {người}` → chỉ đề xuất diff (không tự đè).
|
|
173
|
-
|
|
174
|
-
**Bảng slug ↔ mục:** `tech-stack` · `layers` · `naming` · `api-response` · `api-conventions` · `database` (core) — `data-flow` · `repositories` · `entity-classification` · `data-access` · `service-responsibilities` · `di` · `multi-tenant` · `identity-resolution` · `api-gateway` · `caching` · `event-bus` · `sharding` · `feature-toggle` · `auth` (conditional) — `observability` · `deployment` · `testing` · `nfr` (ops).
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Bước 6 — Refresh có kiểm soát (khi file đã verify bởi người)
|
|
179
|
-
|
|
180
|
-
Nếu Bước 1.4 xác định `verified_by: {người thật}`:
|
|
181
|
-
- KHÔNG ghi đè. Chạy lại thu thập (Bước 2) và **so sánh** với nội dung hiện tại.
|
|
182
|
-
- Xuất **danh sách chênh lệch** (drift): mục nào trong code/config/tài liệu đã khác doc.
|
|
183
|
-
- Với mỗi drift, đề xuất câu chữ cập nhật để SA tự áp; KHÔNG tự đổi `verified_by`.
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## Bước 7 — Bàn giao cho người verify
|
|
188
|
-
|
|
189
|
-
> Nếu frontmatter ghi `verified_by: AI-draft`:
|
|
190
|
-
> 1. Tech Lead/Architect **duyệt từng section**, sửa chỗ AI đoán sai (đối chiếu `<!-- nguồn: … -->` và `<!-- ⚠️ xung đột -->`).
|
|
191
|
-
> 2. Điền nốt `{{PLACEHOLDER}}` còn lại; lấp các mục STUB cần thiết bằng `--section=<slug>`.
|
|
192
|
-
> 3. Đổi `verified_by: AI-draft` → **tên bạn**, cập nhật `last_verified`. Commit.
|
|
193
|
-
>
|
|
194
|
-
> Chỉ khi `verified_by` là người thật, `/generate-tech-docs` (Bước 0.5 [ARCH]) mới coi doc là **ràng buộc kiến trúc chính thức**. Còn `AI-draft` thì bị gắn ⚠️ và ưu tiên CLAUDE.md/BDD khi mâu thuẫn.
|
|
195
|
-
|
|
196
|
-
## Output
|
|
197
|
-
{{include:steps/report-footer.md}}
|