@educa-corp/sdd-framework 0.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.
- package/bin/build.js +230 -0
- package/bin/index.js +609 -0
- package/commands/debug.md +835 -0
- package/commands/debug.tmpl +257 -0
- package/commands/define-product.md +746 -0
- package/commands/define-product.tmpl +191 -0
- package/commands/dev-gen-test.md +1015 -0
- package/commands/dev-gen-test.tmpl +490 -0
- package/commands/dev-run-test.md +749 -0
- package/commands/dev-run-test.tmpl +224 -0
- package/commands/dev-smoke-test.md +716 -0
- package/commands/dev-smoke-test.tmpl +217 -0
- package/commands/fix-bug.md +749 -0
- package/commands/fix-bug.tmpl +171 -0
- package/commands/generate-bdd.md +1144 -0
- package/commands/generate-bdd.tmpl +499 -0
- package/commands/generate-code.md +1038 -0
- package/commands/generate-code.tmpl +513 -0
- package/commands/generate-design-spec.md +1079 -0
- package/commands/generate-design-spec.tmpl +524 -0
- package/commands/generate-prd.md +945 -0
- package/commands/generate-prd.tmpl +166 -0
- package/commands/generate-spec-manifest.md +663 -0
- package/commands/generate-spec-manifest.tmpl +164 -0
- package/commands/generate-tech-docs.md +1249 -0
- package/commands/generate-tech-docs.tmpl +252 -0
- package/commands/learn.md +641 -0
- package/commands/learn.tmpl +63 -0
- package/commands/map-testids.md +580 -0
- package/commands/map-testids.tmpl +81 -0
- package/commands/propose-scenario.md +632 -0
- package/commands/propose-scenario.tmpl +133 -0
- package/commands/qc-analyze.md +611 -0
- package/commands/qc-analyze.tmpl +112 -0
- package/commands/qc-design-test.md +567 -0
- package/commands/qc-design-test.tmpl +68 -0
- package/commands/qc-plan.md +548 -0
- package/commands/qc-plan.tmpl +49 -0
- package/commands/qc-report.md +559 -0
- package/commands/qc-report.tmpl +60 -0
- package/commands/qc-review.md +552 -0
- package/commands/qc-review.tmpl +53 -0
- package/commands/qc-run-test.md +609 -0
- package/commands/qc-run-test.tmpl +84 -0
- package/commands/refine-prd.md +992 -0
- package/commands/refine-prd.tmpl +278 -0
- package/commands/report-bug.md +647 -0
- package/commands/report-bug.tmpl +148 -0
- package/commands/review-code.md +682 -0
- package/commands/review-code.tmpl +104 -0
- package/commands/review-context.md +1202 -0
- package/commands/review-context.tmpl +488 -0
- package/commands/review-tech-docs.md +871 -0
- package/commands/review-tech-docs.tmpl +372 -0
- package/commands/setup-ai-first.md +546 -0
- package/commands/setup-ai-first.tmpl +358 -0
- package/commands/sync.md +451 -0
- package/commands/sync.tmpl +351 -0
- package/commands/update-framework.md +251 -0
- package/commands/update-framework.tmpl +151 -0
- package/commands/validate-traces.md +928 -0
- package/commands/validate-traces.tmpl +429 -0
- package/core/FRAMEWORK_VERSION +1 -0
- package/core/commands/debug.md +835 -0
- package/core/commands/define-product.md +746 -0
- package/core/commands/dev-gen-test.md +1015 -0
- package/core/commands/dev-run-test.md +749 -0
- package/core/commands/dev-smoke-test.md +716 -0
- package/core/commands/fix-bug.md +749 -0
- package/core/commands/generate-bdd.md +1144 -0
- package/core/commands/generate-code.md +1038 -0
- package/core/commands/generate-design-spec.md +1079 -0
- package/core/commands/generate-prd.md +945 -0
- package/core/commands/generate-spec-manifest.md +663 -0
- package/core/commands/generate-tech-docs.md +1249 -0
- package/core/commands/learn.md +641 -0
- package/core/commands/map-testids.md +580 -0
- package/core/commands/propose-scenario.md +632 -0
- package/core/commands/qc-analyze.md +611 -0
- package/core/commands/qc-design-test.md +567 -0
- package/core/commands/qc-plan.md +548 -0
- package/core/commands/qc-report.md +559 -0
- package/core/commands/qc-review.md +552 -0
- package/core/commands/qc-run-test.md +609 -0
- package/core/commands/refine-prd.md +992 -0
- package/core/commands/report-bug.md +647 -0
- package/core/commands/review-code.md +682 -0
- package/core/commands/review-context.md +1202 -0
- package/core/commands/review-tech-docs.md +871 -0
- package/core/commands/setup-ai-first.md +546 -0
- package/core/commands/sync.md +451 -0
- package/core/commands/update-framework.md +251 -0
- package/core/commands/validate-traces.md +928 -0
- package/core/hooks/data-guard.js +141 -0
- package/core/hooks/settings.json +18 -0
- package/core/modules/android-compose/module.yaml +13 -0
- package/core/modules/android-compose/stack-profile.yaml +57 -0
- package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/core/modules/angular/module.yaml +6 -0
- package/core/modules/angular/stack-profile.yaml +38 -0
- package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/core/modules/context-engineering/module.yaml +9 -0
- package/core/modules/context-engineering/stack-profile.yaml +61 -0
- package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/core/modules/dotnet/module.yaml +6 -0
- package/core/modules/dotnet/stack-profile.yaml +50 -0
- package/core/modules/flutter/module.yaml +14 -0
- package/core/modules/flutter/stack-profile.yaml +59 -0
- package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/core/modules/golang/module.yaml +6 -0
- package/core/modules/golang/stack-profile.yaml +40 -0
- package/core/modules/ios-swiftui/module.yaml +13 -0
- package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/core/modules/java-spring/module.yaml +15 -0
- package/core/modules/java-spring/stack-profile.yaml +28 -0
- package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/core/modules/nextjs/module.yaml +14 -0
- package/core/modules/nextjs/stack-profile.yaml +74 -0
- package/core/modules/nuxt/module.yaml +14 -0
- package/core/modules/nuxt/stack-profile.yaml +58 -0
- package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/core/modules/php-laravel/module.yaml +15 -0
- package/core/modules/php-laravel/stack-profile.yaml +56 -0
- package/core/modules/qc-playwright/stack-profile.yaml +66 -0
- package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/core/modules/react/module.yaml +14 -0
- package/core/modules/react/stack-profile.yaml +63 -0
- package/core/modules/react-native/module.yaml +14 -0
- package/core/modules/react-native/stack-profile.yaml +56 -0
- package/core/modules/vue/module.yaml +14 -0
- package/core/modules/vue/stack-profile.yaml +65 -0
- package/core/rules/data-protection.md +80 -0
- package/core/rules/workflow.md +44 -0
- package/core/skills/code/SKILL.md +19 -0
- package/core/skills/debug/SKILL.md +19 -0
- package/core/skills/design-spec/SKILL.md +11 -0
- package/core/skills/discovery/SKILL.md +14 -0
- package/core/skills/prd/SKILL.md +19 -0
- package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
- package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
- package/core/skills/qc/qa-analyst/business-rules.md +59 -0
- package/core/skills/qc/qa-analyst/data-flow.md +64 -0
- package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
- package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
- package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
- package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
- package/core/skills/qc/qa-designer/functional/api.md +45 -0
- package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
- package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
- package/core/skills/qc/qa-designer/integration/api.md +42 -0
- package/core/skills/qc/qa-designer/integration/db.md +39 -0
- package/core/skills/qc/qa-designer/integration/gui.md +40 -0
- package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
- package/core/skills/qc/qa-designer/non-functional.md +40 -0
- package/core/skills/qc/qa-planner/test-plan.md +120 -0
- package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
- package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
- package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
- package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
- package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
- package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
- package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
- package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
- package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
- package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
- package/core/skills/qc/qa-runner/e2e.md +49 -0
- package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
- package/core/skills/qc/qa-runner/functional/api.md +35 -0
- package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
- package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
- package/core/skills/qc/qa-runner/integration.md +47 -0
- package/core/skills/qc/qa-runner/non-functional.md +49 -0
- package/core/skills/qc/qa-runner/report/report.md +37 -0
- package/core/skills/setup-ai-first/SKILL.md +11 -0
- package/core/skills/spec/SKILL.md +19 -0
- package/core/skills/test/SKILL.md +18 -0
- package/core/steps/business-language.md +56 -0
- package/core/steps/capture-lesson.md +79 -0
- package/core/steps/context-loader.md +311 -0
- package/core/steps/gate.md +88 -0
- package/core/steps/report-footer.md +100 -0
- package/core/steps/review-fanout.md +159 -0
- package/core/steps/spawn-agent.md +129 -0
- package/core/steps/trace-mirror.md +26 -0
- package/core/templates/architecture.template.md +113 -0
- package/core/templates/design-spec.template.md +217 -0
- package/core/templates/feature.template +120 -0
- package/core/templates/platform-guide.template.md +145 -0
- package/core/templates/prd.template.md +224 -0
- package/core/templates/product-definition.template.md +188 -0
- package/core/templates/project-context.yaml +161 -0
- package/core/templates/tech-design.template.md +498 -0
- package/docs/01-getting-started/README.md +19 -0
- package/docs/01-getting-started/core-concepts.md +102 -0
- package/docs/01-getting-started/installation.md +156 -0
- package/docs/01-getting-started/quickstart.md +86 -0
- package/docs/02-guides/README.md +26 -0
- package/docs/02-guides/bdd-input-checklist.md +68 -0
- package/docs/02-guides/developer/README.md +49 -0
- package/docs/02-guides/developer/bdd-and-trace.md +126 -0
- package/docs/02-guides/developer/commands.md +76 -0
- package/docs/02-guides/developer/pr-checklist.md +16 -0
- package/docs/02-guides/developer/scenarios.md +460 -0
- package/docs/02-guides/developer/workflow.md +121 -0
- package/docs/02-guides/prd-input-checklist.md +94 -0
- package/docs/02-guides/product-owner/README.md +81 -0
- package/docs/02-guides/product-owner/commands.md +30 -0
- package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
- package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
- package/docs/02-guides/product-owner/scenarios.md +438 -0
- package/docs/02-guides/tech-docs-input-checklist.md +109 -0
- package/docs/02-guides/tester/README.md +75 -0
- package/docs/02-guides/tester/bug-reporting.md +117 -0
- package/docs/02-guides/tester/qc-automation.md +165 -0
- package/docs/02-guides/tester/reading-specs.md +79 -0
- package/docs/02-guides/tester/scenarios.md +186 -0
- package/docs/02-guides/tester/spec-manifest.md +130 -0
- package/docs/02-guides/tester/test-checklist.md +31 -0
- package/docs/02-guides/tester/workflow.md +77 -0
- package/docs/03-concepts/README.md +20 -0
- package/docs/03-concepts/architecture.md +248 -0
- package/docs/03-concepts/mechanisms-explained.md +124 -0
- package/docs/03-concepts/pipeline.md +278 -0
- package/docs/03-concepts/traceability.md +152 -0
- package/docs/04-operations/README.md +33 -0
- package/docs/04-operations/bug-flow.md +364 -0
- package/docs/04-operations/publishing.md +154 -0
- package/docs/04-operations/sync-and-update.md +522 -0
- package/docs/05-reference/README.md +34 -0
- package/docs/05-reference/command-cheatsheet.md +147 -0
- package/docs/05-reference/commands.md +234 -0
- package/docs/05-reference/model-selection.md +74 -0
- package/docs/05-reference/modules.md +110 -0
- package/docs/05-reference/trace-schema.md +154 -0
- package/docs/06-commands/README.md +75 -0
- package/docs/06-commands/explain-debug.md +32 -0
- package/docs/06-commands/explain-define-product.md +43 -0
- package/docs/06-commands/explain-dev-gen-test.md +28 -0
- package/docs/06-commands/explain-dev-run-test.md +24 -0
- package/docs/06-commands/explain-dev-smoke-test.md +25 -0
- package/docs/06-commands/explain-fix-bug.md +28 -0
- package/docs/06-commands/explain-generate-bdd.md +45 -0
- package/docs/06-commands/explain-generate-code.md +53 -0
- package/docs/06-commands/explain-generate-design-spec.md +54 -0
- package/docs/06-commands/explain-generate-prd.md +45 -0
- package/docs/06-commands/explain-generate-spec-manifest.md +20 -0
- package/docs/06-commands/explain-generate-tech-docs.md +56 -0
- package/docs/06-commands/explain-learn.md +21 -0
- package/docs/06-commands/explain-map-testids.md +28 -0
- package/docs/06-commands/explain-propose-scenario.md +24 -0
- package/docs/06-commands/explain-qc-analyze.md +22 -0
- package/docs/06-commands/explain-qc-design-test.md +20 -0
- package/docs/06-commands/explain-qc-plan.md +21 -0
- package/docs/06-commands/explain-qc-report.md +23 -0
- package/docs/06-commands/explain-qc-review.md +24 -0
- package/docs/06-commands/explain-qc-run-test.md +27 -0
- package/docs/06-commands/explain-refine-prd.md +51 -0
- package/docs/06-commands/explain-report-bug.md +24 -0
- package/docs/06-commands/explain-review-code.md +45 -0
- package/docs/06-commands/explain-review-context.md +68 -0
- package/docs/06-commands/explain-review-tech-docs.md +45 -0
- package/docs/06-commands/explain-setup-ai-first.md +25 -0
- package/docs/06-commands/explain-sync.md +24 -0
- package/docs/06-commands/explain-update-framework.md +22 -0
- package/docs/06-commands/explain-validate-traces.md +25 -0
- package/docs/README.md +53 -0
- package/docs/t-sample.md +826 -0
- package/hooks/data-guard.js +141 -0
- package/hooks/settings.json +18 -0
- package/modules/android-compose/module.yaml +13 -0
- package/modules/android-compose/stack-profile.yaml +57 -0
- package/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/modules/angular/module.yaml +6 -0
- package/modules/angular/stack-profile.yaml +38 -0
- package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/modules/context-engineering/module.yaml +9 -0
- package/modules/context-engineering/stack-profile.yaml +61 -0
- package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/modules/dotnet/module.yaml +6 -0
- package/modules/dotnet/stack-profile.yaml +50 -0
- package/modules/flutter/module.yaml +14 -0
- package/modules/flutter/stack-profile.yaml +59 -0
- package/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/modules/golang/module.yaml +6 -0
- package/modules/golang/stack-profile.yaml +40 -0
- package/modules/ios-swiftui/module.yaml +13 -0
- package/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/modules/java-spring/module.yaml +15 -0
- package/modules/java-spring/stack-profile.yaml +28 -0
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/modules/nextjs/module.yaml +14 -0
- package/modules/nextjs/stack-profile.yaml +74 -0
- package/modules/nuxt/module.yaml +14 -0
- package/modules/nuxt/stack-profile.yaml +58 -0
- package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/modules/php-laravel/module.yaml +15 -0
- package/modules/php-laravel/stack-profile.yaml +56 -0
- package/modules/qc-playwright/stack-profile.yaml +66 -0
- package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/modules/react/module.yaml +14 -0
- package/modules/react/stack-profile.yaml +63 -0
- package/modules/react-native/module.yaml +14 -0
- package/modules/react-native/stack-profile.yaml +56 -0
- package/modules/vue/module.yaml +14 -0
- package/modules/vue/stack-profile.yaml +65 -0
- package/package.json +49 -0
- package/readme.txt +1 -0
- package/rules/data-protection.md +80 -0
- package/rules/workflow.md +44 -0
- package/scripts/init.sh +49 -0
- package/scripts/migrate-specs.js +258 -0
- package/scripts/rename-prd-files.js +174 -0
- package/scripts/upgrade.sh +94 -0
- package/skills/code/SKILL.md +19 -0
- package/skills/code/SKILL.tmpl +19 -0
- package/skills/debug/SKILL.md +19 -0
- package/skills/debug/SKILL.tmpl +19 -0
- package/skills/design-spec/SKILL.md +11 -0
- package/skills/design-spec/SKILL.tmpl +11 -0
- package/skills/discovery/SKILL.md +14 -0
- package/skills/discovery/SKILL.tmpl +14 -0
- package/skills/prd/SKILL.md +19 -0
- package/skills/prd/SKILL.tmpl +19 -0
- package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
- package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
- package/skills/qc/qa-analyst/business-rules.md +59 -0
- package/skills/qc/qa-analyst/data-flow.md +64 -0
- package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
- package/skills/qc/qa-designer/e2e/journey.md +41 -0
- package/skills/qc/qa-designer/exploratory/charter.md +68 -0
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
- package/skills/qc/qa-designer/functional/api.md +45 -0
- package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
- package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
- package/skills/qc/qa-designer/integration/api.md +42 -0
- package/skills/qc/qa-designer/integration/db.md +39 -0
- package/skills/qc/qa-designer/integration/gui.md +40 -0
- package/skills/qc/qa-designer/integration/kafka.md +40 -0
- package/skills/qc/qa-designer/non-functional.md +40 -0
- package/skills/qc/qa-planner/test-plan.md +120 -0
- package/skills/qc/qa-reviewer/script/e2e.md +87 -0
- package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
- package/skills/qc/qa-reviewer/script/functional.md +101 -0
- package/skills/qc/qa-reviewer/script/integration.md +91 -0
- package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
- package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
- package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
- package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
- package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
- package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
- package/skills/qc/qa-runner/e2e.md +49 -0
- package/skills/qc/qa-runner/exploratory/session.md +36 -0
- package/skills/qc/qa-runner/functional/api.md +35 -0
- package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
- package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
- package/skills/qc/qa-runner/integration.md +47 -0
- package/skills/qc/qa-runner/non-functional.md +49 -0
- package/skills/qc/qa-runner/report/report.md +37 -0
- package/skills/setup-ai-first/SKILL.md +11 -0
- package/skills/setup-ai-first/SKILL.tmpl +11 -0
- package/skills/spec/SKILL.md +19 -0
- package/skills/spec/SKILL.tmpl +19 -0
- package/skills/test/SKILL.md +18 -0
- package/skills/test/SKILL.tmpl +18 -0
- package/steps/business-language.md +56 -0
- package/steps/capture-lesson.md +79 -0
- package/steps/context-loader.md +311 -0
- package/steps/gate.md +88 -0
- package/steps/report-footer.md +100 -0
- package/steps/review-fanout.md +159 -0
- package/steps/spawn-agent.md +129 -0
- package/steps/trace-mirror.md +26 -0
- package/templates/architecture.template.md +113 -0
- package/templates/design-spec.template.md +217 -0
- package/templates/feature.template +120 -0
- package/templates/platform-guide.template.md +145 -0
- package/templates/prd.template.md +224 -0
- package/templates/product-definition.template.md +188 -0
- package/templates/project-context.yaml +161 -0
- package/templates/tech-design.template.md +498 -0
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
# /validate-traces — Traceability Coverage Matrix
|
|
2
|
+
|
|
3
|
+
Check read-only độ phủ giữa spec, code, và test — gồm cả PRD version drift.
|
|
4
|
+
|
|
5
|
+
## Gate
|
|
6
|
+
# Gate — Quy trình vào chuẩn cho mọi lệnh
|
|
7
|
+
|
|
8
|
+
Mọi lệnh PHẢI chạy gate này trước khi thực thi phần logic riêng của nó.
|
|
9
|
+
|
|
10
|
+
## Bước 0 — Kiểm tra chế độ Sub-Agent
|
|
11
|
+
|
|
12
|
+
Trước tiên, kiểm tra xem `$ARGUMENTS` có phải là payload JSON từ một orchestrator hay không:
|
|
13
|
+
|
|
14
|
+
1. Thử parse `$ARGUMENTS` dưới dạng JSON.
|
|
15
|
+
2. Nếu parse thành công **và** chứa `"_agent_mode": true`:
|
|
16
|
+
- **Bỏ qua hoàn toàn Bước 1, 2 và 3 của Gate này.**
|
|
17
|
+
- Đặt target file = `payload.target_file`
|
|
18
|
+
- Đặt loaded context = `payload.context` (KHÔNG chạy context-loader.md)
|
|
19
|
+
- Đặt phạm vi UC = `payload.uc_id` (chỉ xử lý UC này)
|
|
20
|
+
- Đặt line range = `payload.uc_section` (chỉ đọc đúng section đó của PRD)
|
|
21
|
+
- Đặt dimension = `payload.dimension` nếu có (lệnh review per-UC: chỉ review đúng lăng kính này)
|
|
22
|
+
- Đi thẳng tới phần logic riêng của lệnh.
|
|
23
|
+
3. Nếu `$ARGUMENTS` không phải JSON hoặc không có `_agent_mode` → tiếp tục sang Bước 1 (chế độ thường).
|
|
24
|
+
|
|
25
|
+
## Bước 0-B — Kiểm tra Model
|
|
26
|
+
|
|
27
|
+
*Bỏ qua bước này nếu `_agent_mode: true` (sub-agent — orchestrator đã kiểm tra rồi).*
|
|
28
|
+
|
|
29
|
+
Các lệnh sinh nội dung và review phức tạp đòi hỏi khả năng suy luận mạnh.
|
|
30
|
+
Dùng model nhỏ hơn sẽ rủi ro: bỏ sót edge case, phân tích spec thiếu sót, vi phạm kiến trúc.
|
|
31
|
+
|
|
32
|
+
Hiển thị và chờ phản hồi:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
⚙️ MODEL CHECK
|
|
36
|
+
──────────────────────────────────────────────────────────────────
|
|
37
|
+
Recommended : claude-opus-4 (hoặc model Opus mới nhất)
|
|
38
|
+
Why needed : Phân tích spec, review kiến trúc, sinh code đòi hỏi
|
|
39
|
+
suy luận sâu. Model nhỏ hơn dễ bỏ sót edge case.
|
|
40
|
+
|
|
41
|
+
Cách đổi trong Claude Code:
|
|
42
|
+
• Settings → Model → chọn "claude-opus"
|
|
43
|
+
• hoặc: /model → chọn claude-opus
|
|
44
|
+
|
|
45
|
+
Đang chạy claude-opus?
|
|
46
|
+
Y — đúng, đang dùng claude-opus → tiếp tục
|
|
47
|
+
S — bỏ qua kiểm tra (tôi chấp nhận rủi ro chất lượng thấp hơn với model hiện tại)
|
|
48
|
+
──────────────────────────────────────────────────────────────────
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- "Y" → tiếp tục sang Bước 1.
|
|
52
|
+
- "S" → tiếp tục sang Bước 1 (người dùng chấp nhận rủi ro, thêm ⚠️ vào report cuối).
|
|
53
|
+
- "N" hoặc bất kỳ giá trị nào khác → **DỪNG.** Xuất: "Vui lòng chuyển sang claude-opus rồi chạy lại lệnh này."
|
|
54
|
+
|
|
55
|
+
## Bước 1 — Xác định Target File
|
|
56
|
+
|
|
57
|
+
1. Nếu `$ARGUMENTS` được cung cấp và trỏ tới một file tồn tại → dùng trực tiếp làm target.
|
|
58
|
+
2. Nếu `$ARGUMENTS` là một **UC-ID / ticket ID / tên rút gọn** (không có path) → phân giải thành file bằng cách glob theo bố cục feature-package. `{prd-slug}` lúc này **chưa biết**, nên dùng wildcard `*` cho segment đó, và `**` đệ quy dưới `bdd/` để phủ hết các thư mục con theo platform (`bdd/web/`, `bdd/app/`, `bdd/system/`):
|
|
59
|
+
- **Lệnh BDD** (target là `.feature`): `{specs_dir}/{domain}/*/bdd/**/{UC-ID}*.feature` — hoặc `{specs_dir}/*/*/bdd/**/{UC-ID}*.feature` nếu domain cũng chưa biết. Nếu lệnh ngụ ý một platform/scope cụ thể (vd: system tech-doc cần BDD `system/`), ưu tiên kết quả trong thư mục con platform đó.
|
|
60
|
+
- **Lệnh PRD** (target là file PRD `{TICKET-ID}-{prd-slug}.md` — file `.md` duy nhất ở gốc feature folder, cạnh `bdd/`): `{specs_dir}/{domain}/*/{TICKET-ID}*.md` nếu biết TICKET-ID; nếu không, `{specs_dir}/{domain}/*/*.md` (khớp feature folder có id tương ứng), hoặc `{specs_dir}/*/*/*.md` nếu domain cũng chưa biết. *(Glob `*/*.md` ở cấp gốc folder chỉ khớp PRD — tech-docs/design-spec `.md` nằm sâu hơn trong thư mục con.)*
|
|
61
|
+
- **Lệnh tech-docs**: `{specs_dir}/{domain}/*/tech-docs/{UC-ID}*-tech-design*.md`.
|
|
62
|
+
- **Lệnh design-spec**: `{specs_dir}/{domain}/*/design-spec/{TICKET-ID}*.md`.
|
|
63
|
+
|
|
64
|
+
Khi một file khớp: đặt nó làm target **và** ghi lại `domain` + `prd_slug` từ path của nó (theo quy tắc trích xuất trong `context-loader.md` Bước 1 — `prd_slug` = segment đầu tiên sau `{specs_dir}/{domain}/`). Mọi path mà lệnh đọc/ghi về sau (BDD/tech-docs/design-spec/trace cùng cấp) đều dùng **`prd_slug` đã phân giải đó**, nên tất cả artifact nằm chung một feature package. Nếu nhiều file khớp (vd: nhiều platform), chọn theo platform/scope của lệnh hoặc liệt kê ra và hỏi.
|
|
65
|
+
3. Nếu `$ARGUMENTS` rỗng hoặc không tìm thấy file khớp:
|
|
66
|
+
- Liệt kê các file trong thư mục liên quan của lệnh này (vd: `specs/*/*/*.md` — file PRD ở gốc mỗi feature folder — cho lệnh PRD, `specs/*/*/bdd/**/*.feature` cho lệnh BDD).
|
|
67
|
+
- Hiển thị danh sách cho người dùng và hỏi: "Bạn muốn làm việc với file nào? (Nhập số thứ tự hoặc tên file)"
|
|
68
|
+
- Chờ người dùng chọn rồi mới tiếp tục.
|
|
69
|
+
|
|
70
|
+
## Bước 2 — Chạy Context Loader
|
|
71
|
+
|
|
72
|
+
Nạp toàn bộ context của dự án bằng cách làm theo quy trình trong `steps/context-loader.md`.
|
|
73
|
+
Lưu toàn bộ context đã nạp vào bộ nhớ để dùng xuyên suốt phiên làm việc của lệnh.
|
|
74
|
+
|
|
75
|
+
## Bước 3 — CHECKPOINT
|
|
76
|
+
|
|
77
|
+
Sau khi hoàn thành Bước 1 và 2, hiển thị bản tóm tắt và chờ xác nhận:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
CHECKPOINT
|
|
81
|
+
-----------
|
|
82
|
+
Target : {resolved file path}
|
|
83
|
+
Project : {project.name từ project-context.yaml}
|
|
84
|
+
Tech stack : {language} / {framework}
|
|
85
|
+
Module : {module nếu có, else "not configured"}
|
|
86
|
+
Domains : {danh sách domain, ngăn cách bởi dấu phẩy}
|
|
87
|
+
|
|
88
|
+
Tiếp tục? (Y/N)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Chờ người dùng trả lời rõ ràng "Y" hoặc "N" rồi mới tiếp tục.
|
|
92
|
+
- "Y" → tiếp tục sang các bước riêng của lệnh bên dưới.
|
|
93
|
+
- "N" → dừng lại và hỏi người dùng muốn thay đổi gì.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
*Lưu ý: Với lệnh này, target ở Bước 1 là một tên domain hoặc UC-ID cụ thể từ `$ARGUMENTS`. Không có một file đơn để phân giải — lệnh quét nhiều thư mục.*
|
|
97
|
+
|
|
98
|
+
## Context
|
|
99
|
+
# Context Loader — Nạp toàn bộ context dự án
|
|
100
|
+
|
|
101
|
+
Thực hiện các bước theo đúng thứ tự. Lưu mọi thứ vào bộ nhớ trong suốt phiên làm việc của lệnh.
|
|
102
|
+
|
|
103
|
+
**Hướng dẫn ưu tiên (chống lost-in-middle):**
|
|
104
|
+
- Bước 1–2 là PROJECT-CONFIG — nạp trước, phân giải mọi path và metadata.
|
|
105
|
+
- Bước 3 là CRITICAL — kiến trúc + coding standards, là các sự thật ưu tiên cao nhất khi sinh nội dung.
|
|
106
|
+
- Bước 4 là SAFETY — quy tắc bảo vệ dữ liệu, thực thi ngầm suốt cả phiên.
|
|
107
|
+
- Bước 5–6 là DOMAIN KNOWLEDGE — thuật ngữ và định nghĩa entity.
|
|
108
|
+
- Bước 7 là WORKING MEMORY RECAP — chốt các sự thật quan trọng lên đầu bộ nhớ làm việc.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Bước 1 — [PROJECT-CONFIG] Nạp project-context.yaml
|
|
113
|
+
|
|
114
|
+
Đọc `.agent/project-context.yaml`. Trích xuất và lưu:
|
|
115
|
+
|
|
116
|
+
**Tech Stack:**
|
|
117
|
+
- `tech_stack.language` → ngôn ngữ đang dùng (vd: Java 17, TypeScript, C#, Go)
|
|
118
|
+
- `tech_stack.framework` → framework đang dùng (vd: Spring Boot 3.2, Angular 17, .NET 8)
|
|
119
|
+
- `tech_stack.build_tool` → build tool (vd: Maven, npm, dotnet, go)
|
|
120
|
+
- `tech_stack.test_framework` → test framework (vd: JUnit 5 + Mockito, Jest, xUnit)
|
|
121
|
+
- `tech_stack.database` → database (vd: PostgreSQL, MySQL, MongoDB)
|
|
122
|
+
- `tech_stack.module` → module profile đang dùng (vd: java-spring, angular, dotnet, golang, context-engineering)
|
|
123
|
+
|
|
124
|
+
**Conventions:**
|
|
125
|
+
- `conventions.build_command` → cách compile/build
|
|
126
|
+
- `conventions.test_command` → cách chạy test
|
|
127
|
+
- `conventions.service_run` → cách khởi động service
|
|
128
|
+
- `conventions.ticket_prefix` → tiền tố ticket ID (vd: PROJ, FEAT, UC)
|
|
129
|
+
|
|
130
|
+
**Domains:**
|
|
131
|
+
- `domains` → danh sách các business domain đang hoạt động
|
|
132
|
+
|
|
133
|
+
**Paths (nếu có):**
|
|
134
|
+
- `paths.specs_dir` → gốc của spec artifact — PRD, BDD, tech-docs, design-spec. Cấu trúc: `{specs_dir}/{domain}/{prd-slug}/{ {TICKET-ID}-{prd-slug}.md | bdd/ | tech-docs/ | design-spec/}` (file PRD đặt tên `{TICKET-ID}-{prd-slug}.md`, là file `.md` duy nhất ở gốc feature folder)
|
|
135
|
+
- `paths.refinement_dir` → thư mục output cho findings/review
|
|
136
|
+
- `paths.qc_dir` → gốc artifact QC automation (hiện ở top-level, mỗi UC một thư mục con: `{qc_dir}/{UC-ID}/`)
|
|
137
|
+
- `paths.qc_skills_dir` → nơi các lệnh qc-* nạp QC skill (mặc định bundled `.agent/skills/qc`; override sang repo/submodule riêng của team QC để bản nâng cấp framework không ghi đè)
|
|
138
|
+
- `paths.product_definitions_dir` → gốc product definition
|
|
139
|
+
- `paths.domain_knowledge_dir` → gốc domain knowledge
|
|
140
|
+
- `paths.business_dictionary` → path tới business-dictionary.md
|
|
141
|
+
- `paths.core_entities` → path tới core-entities.md
|
|
142
|
+
- `paths.tech_docs_dir` → gốc tài liệu kỹ thuật (gộp với specs_dir trong bố cục feature-package — tech-docs nằm dưới `{specs_dir}/{domain}/{prd-slug}/tech-docs/`)
|
|
143
|
+
- `paths.trace_dir` → thư mục trạng thái trace; cấu trúc: `.trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv` (mỗi UC × platform một sổ)
|
|
144
|
+
|
|
145
|
+
Nếu không có section `paths`, dùng các giá trị mặc định:
|
|
146
|
+
- `specs_dir` = `specs`
|
|
147
|
+
- `refinement_dir` = `.agent/review`
|
|
148
|
+
- `qc_dir` = `docs`
|
|
149
|
+
- `qc_skills_dir` = `.agent/skills/qc`
|
|
150
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
151
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
152
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
153
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
154
|
+
- `tech_docs_dir` = `specs`
|
|
155
|
+
- `trace_dir` = `.trace`
|
|
156
|
+
|
|
157
|
+
Lưu ý: Trong bố cục feature-package, `specs_dir` là gốc thống nhất. Mọi loại spec artifact (PRD, BDD, tech-docs, design-spec) đều nằm dưới `{specs_dir}/{domain}/{prd-slug}/`. `prd-slug` là tên folder feature-package, không phải một biến config riêng.
|
|
158
|
+
|
|
159
|
+
**Cách trích xuất `prd_slug` (đúng cho MỌI target file, bất kể độ sâu lồng nhau):** với một path target dạng `{specs_dir}/{domain}/{prd-slug}/...`, lấy **segment path đầu tiên sau `{specs_dir}/{domain}/`** — tức vị trí `{prd-slug}`. KHÔNG dùng folder cha trực tiếp của file, vì artifact BDD/tech-docs/design-spec lồng sâu hơn một hoặc hai cấp bên trong package. Ví dụ:
|
|
160
|
+
- `specs/payment/create-invoice/PAY01-create-invoice.md` → `prd_slug = create-invoice`
|
|
161
|
+
- `specs/payment/create-invoice/bdd/system/PAY-UC1.feature` → `prd_slug = create-invoice` *(KHÔNG phải `system`)*
|
|
162
|
+
- `specs/payment/create-invoice/bdd/web/PAY-UC1.feature` → `prd_slug = create-invoice` *(KHÔNG phải `web`)*
|
|
163
|
+
- `specs/payment/create-invoice/tech-docs/PAY01-tech-design.md` → `prd_slug = create-invoice` *(KHÔNG phải `tech-docs`)*
|
|
164
|
+
- `specs/payment/create-invoice/design-spec/PAY-design-spec-web.md` → `prd_slug = create-invoice`
|
|
165
|
+
|
|
166
|
+
Mọi artifact cùng cấp của một feature (PRD, BDD của từng platform, tech-docs BE + FE, design-spec, và trace TSV) đều phân giải về **cùng một `prd_slug`** — nên một BDD **system** hay tech-doc **system/BE** được tổng hợp sẽ nằm chung package `{specs_dir}/{domain}/{prd-slug}/` với các artifact web/app mà nó được suy ra từ đó.
|
|
167
|
+
|
|
168
|
+
Nếu `tech_stack.module` được đặt, đồng thời nạp `.agent/modules/{module}/stack-profile.yaml` nếu file tồn tại.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Bước 1.5 — [SERVICE ROUTING] Phân giải path service (chế độ umbrella)
|
|
173
|
+
|
|
174
|
+
*Bỏ qua hoàn toàn bước này nếu `setup.mode` không phải `"umbrella"` và không có section `services` trong project-context.yaml.*
|
|
175
|
+
|
|
176
|
+
Nếu có section `services`:
|
|
177
|
+
|
|
178
|
+
**1. Phát hiện active domain** (theo thứ tự ưu tiên):
|
|
179
|
+
- Đọc `@trace.domain` từ frontmatter của target file (nếu Gate đã nạp một target file)
|
|
180
|
+
- Trích xuất từ path target file: `domain` = segment đầu tiên sau base path `specs_dir`; `prd_slug` = segment kế tiếp (folder feature-package). Điều này đúng ở mọi độ sâu target — xem quy tắc trích xuất `prd_slug` ở Bước 1.
|
|
181
|
+
*(vd: `specs/user/create-account/USR01-create-account.md` **và** `specs/user/create-account/bdd/system/UC1.feature` đều → domain = `user`, prd_slug = `create-account`)*
|
|
182
|
+
- Nếu `$ARGUMENTS` chứa một path, trích xuất segment domain sau `specs_dir`
|
|
183
|
+
|
|
184
|
+
**2. Route tới service** — nếu active domain khớp với một key trong `services`:
|
|
185
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **chỉ khi `setup.spec_source` KHÔNG được đặt.** Khi `spec_source` ĐƯỢC đặt, MỌI BDD (web/app/**system**) là artifact dùng chung liên team → để bước 4 route sang spec repo; KHÔNG pin theo service ở đây.
|
|
186
|
+
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **chỉ khi `setup.spec_source` KHÔNG được đặt.** Khi `spec_source` ĐƯỢC đặt, tech-design (API contract) là artifact liên team và phải nằm trong spec repo dùng chung (xử lý ở bước 4), nên để bước 4 route `tech_docs_dir` — KHÔNG pin theo service ở đây.
|
|
187
|
+
- Lưu `active_service` = `services.{domain}.path`
|
|
188
|
+
- Lưu `active_service_module` = `services.{domain}.module`
|
|
189
|
+
- Nếu service có `module` riêng → dùng nó làm `active_module` (override `tech_stack.module`)
|
|
190
|
+
|
|
191
|
+
**3. Fallback** — nếu không phát hiện được domain hoặc không có service key khớp:
|
|
192
|
+
- Giữ path mặc định từ Bước 1
|
|
193
|
+
- Đặt `active_service = unresolved`
|
|
194
|
+
|
|
195
|
+
**4. Tự động override theo spec source** — nếu `setup.spec_source` được đặt VÀ path tương ứng chưa được set tường minh trong `paths:`:
|
|
196
|
+
- Override `paths.specs_dir` → `{spec_source}/specs` — **luôn khi `spec_source` được đặt.** Mọi spec artifact (PRD, BDD, tech-docs, design-spec) nằm dưới gốc spec thống nhất trong spec repo dùng chung theo bố cục feature-package: `{spec_source}/specs/{domain}/{prd-slug}/`. Mọi umbrella (FE/App/BE) đều đọc từ đây. *(`specs/` theo service chỉ khi không có `spec_source`.)*
|
|
197
|
+
- Override `paths.tech_docs_dir` → `{spec_source}/specs` — **luôn khi `spec_source` được đặt** (bước 2 không còn pin tech-docs theo service trong trường hợp này). Tech-docs nằm tại `{spec_source}/specs/{domain}/{prd-slug}/tech-docs/`. Tech-design CHÍNH LÀ API contract liên team: BE viết ở đây, FE/App đọc nó từ cùng spec submodule tại `/generate-code --phase=integration`. *(tech-docs theo service chỉ xảy ra khi không có `spec_source` — repo BE thuần đa-service không có spec module dùng chung.)*
|
|
198
|
+
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
199
|
+
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
200
|
+
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
201
|
+
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
202
|
+
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
203
|
+
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
204
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **luôn khi `spec_source` được đặt.** Trace TSV được gộp vào spec repo (một nơi authoritative duy nhất, không tách theo service) để PM/PO có một chỗ duy nhất quản lý trạng thái. Cấu trúc bên trong: `.trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv`. Các lệnh phía code (`/generate-code`, `/dev-run-test`, `/qc-run-test`) chạy từ `service_root` nhưng **ghi trace row của chúng vào `{spec_source}/.trace/{domain}/{prd-slug}/`** — giống như chúng đã push `feedback/` vào đó. *(`.trace` theo service chỉ khi không có `spec_source`.)*
|
|
205
|
+
- Override `paths.refinement_dir` → `{spec_source}/.agent/review` — **luôn khi `spec_source` được đặt.** Findings review (`/refine-prd`, `/review-context`, `/review-tech-docs`) là artifact liên-team *về* tài liệu trong spec repo (PRD/BDD/tech-design) — thuộc cùng khu vực ghi với `.trace/` và `feedback/`. Các lệnh review chạy từ working dir của service (BE repo) nhưng **ghi findings vào `{spec_source}/.agent/review/`**, KHÔNG phải `.agent/review` của service repo. Bên trong flat, phân biệt bằng tên file đã prefix `{prd-slug}`/`{UC-ID}`/`{TICKET-ID}`. *(`.agent/review` theo service chỉ khi không có `spec_source`.)*
|
|
206
|
+
|
|
207
|
+
> **Vì sao đặt dưới `spec_source`:** PRD, BDD, tech-docs, design-spec, domain knowledge, feedback của tester, **trạng thái coverage `.trace/`**, **và findings review `.agent/review/`** đều là **artifact liên team** — chúng nằm trong **spec repo dùng chung** theo bố cục feature-package để mọi umbrella (FE/App/BE) và PM đọc từ một nguồn qua `/sync`. Trong bố cục feature-package, một folder `specs/{domain}/{prd-slug}/` gom tất cả loại artifact của một PRD, giúp spec repo tự đủ và dễ điều hướng theo feature. Service submodule chỉ chứa **code** (+ tooling build/test). `.trace/`, `.agent/review/` và `feedback/` là khu vực **ghi** của dev/QC/reviewer trong spec repo. Ở chế độ single-service (không có `spec_source`), mọi thứ mặc định dưới gốc repo — vẫn là một repo.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Bước 1.6 — [SERVICE CONVENTIONS] Nạp convention riêng của service (chế độ umbrella)
|
|
212
|
+
|
|
213
|
+
*Bỏ qua hoàn toàn bước này nếu `active_service` là `"unresolved"` hoặc context ở chế độ single-service.*
|
|
214
|
+
|
|
215
|
+
Khi `active_service` đã được phân giải thành một path thật ở Bước 1.5 (vd: `user-service/`):
|
|
216
|
+
|
|
217
|
+
**1. Định vị config của service** — thử theo thứ tự ưu tiên:
|
|
218
|
+
- `{active_service}/.agent/project-context.yaml`
|
|
219
|
+
- `{active_service}/project-context.yaml`
|
|
220
|
+
|
|
221
|
+
**2. Nếu tìm thấy, override bằng giá trị riêng của service:**
|
|
222
|
+
|
|
223
|
+
| Biến | Nguồn |
|
|
224
|
+
|----------|--------|
|
|
225
|
+
| `conventions.test_command` | `conventions.test_command` của service |
|
|
226
|
+
| `conventions.build_command` | `conventions.build_command` của service |
|
|
227
|
+
| `paths.trace_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/.trace`); bỏ qua mọi `trace_dir` cấp service.** Chỉ khi không có `spec_source`: `{active_service}/{service paths.trace_dir}` (mặc định `{active_service}/.trace`). |
|
|
228
|
+
| `paths.specs_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/specs`); bỏ qua mọi `specs_dir` cấp service** (mọi spec artifact đều liên team, không bao giờ theo service ở chế độ này). Chỉ khi không có `spec_source`: `{active_service}/{service paths.specs_dir}` nếu được set, else dùng override ở Bước 1.5. |
|
|
229
|
+
| `paths.refinement_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/.agent/review`); bỏ qua mọi `refinement_dir` cấp service** (findings review là artifact liên team). Chỉ khi không có `spec_source`: `{active_service}/.agent/review`. |
|
|
230
|
+
|
|
231
|
+
**3. Lưu** `service_root = {active_service}` làm mốc thư mục làm việc cho mọi lệnh phía sau:
|
|
232
|
+
- Các lệnh shell (`/dev-run-test`, `/dev-gen-test`) chạy **bên trong** `service_root`
|
|
233
|
+
- **File source/test** được ghi tương đối với `service_root`; **trace TSV** được ghi vào `{paths.trace_dir}` (là spec repo khi `spec_source` được đặt — một thao tác ghi liên-repo, commit/push vào spec submodule giống như `feedback/`).
|
|
234
|
+
|
|
235
|
+
**4. Nếu không tìm thấy config của service** — giữ mặc định umbrella, vẫn set `service_root = {active_service}` (luôn cần mốc path kể cả khi không có config override).
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Bước 2 — [PROJECT-CONFIG] Nạp module stack profile (có điều kiện)
|
|
240
|
+
|
|
241
|
+
Nếu `tech_stack.module` được đặt, đọc `.agent/modules/{module}/stack-profile.yaml`.
|
|
242
|
+
Merge các convention riêng của framework (layer pattern, test pattern, quy tắc đặt tên) vào context đã nạp.
|
|
243
|
+
Nếu file không tồn tại → bỏ qua âm thầm.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Bước 3 — [CRITICAL] Nạp CLAUDE.md (phân tầng: root + service overlay)
|
|
248
|
+
|
|
249
|
+
*Đây là context ưu tiên cao nhất — nó định nghĩa CÁCH viết code và tài liệu cho dự án này.*
|
|
250
|
+
|
|
251
|
+
CLAUDE.md được nạp theo **hai tầng** để các quy tắc toàn-umbrella và kiến trúc/coding standards
|
|
252
|
+
riêng của service kết hợp đúng cách. Agent luôn đứng ở gốc umbrella, nhưng code triển khai nằm
|
|
253
|
+
trong một service submodule với stack, kiến trúc, và convention RIÊNG của nó — nên CLAUDE.md của
|
|
254
|
+
service phải thắng khi sinh code.
|
|
255
|
+
|
|
256
|
+
**Tầng 1 — [BASE] Root CLAUDE.md (toàn umbrella).**
|
|
257
|
+
Đọc `CLAUDE.md` ở gốc repo. Coi nội dung của nó là **nền tảng dùng chung** cho cả umbrella —
|
|
258
|
+
git convention, tư thế bảo vệ dữ liệu, quy tắc xuyên suốt, và (ở chế độ single-service) là
|
|
259
|
+
kiến trúc + coding standards duy nhất của dự án.
|
|
260
|
+
|
|
261
|
+
**Tầng 2 — [OVERLAY] Service CLAUDE.md (chỉ chế độ umbrella).**
|
|
262
|
+
*Chỉ chạy nếu `service_root` đã được set ở Bước 1.6 (tức đã route tới một service thật).*
|
|
263
|
+
Đọc `{service_root}/CLAUDE.md`. File này định nghĩa kiến trúc + coding standards của **stack
|
|
264
|
+
thực sự đang được triển khai** (vd: `user-service` = java-spring, `web` = nextjs).
|
|
265
|
+
Overlay nó lên trên Tầng 1: **khi có xung đột, giá trị của service THẮNG** cho kiến trúc,
|
|
266
|
+
coding standards, và error handling. Các giá trị Tầng 1 mà service không định nghĩa lại
|
|
267
|
+
(vd: git convention, banned pattern dùng chung toàn tổ chức) vẫn có hiệu lực.
|
|
268
|
+
|
|
269
|
+
Từ kết quả **đã merge**, trích xuất và lưu:
|
|
270
|
+
|
|
271
|
+
- **§1 Project Overview** → tên dự án, ngôn ngữ, framework, lệnh build/test, domains
|
|
272
|
+
- **§2 Architecture** → thứ tự layer (vd: Controller → Facade → Service → Repository), quy tắc kiến trúc — *service overlay thắng*
|
|
273
|
+
- **§2 Package Layout** → **base package** (vd `vn.edupia.{service}`) + **chiến lược đặt package** (by-layer / by-feature) + nơi code một domain sống. Đây là **quy ước đặt code trên đĩa**, PHẢI enforce khi sinh code. Nếu §2 chỉ nêu base package + thứ tự layer mà **không** nói tới sub-package theo feature → hiểu là **by-layer**: các layer đặt **TRỰC TIẾP** dưới base package (vd `vn.edupia.{service}.service`, `.repository`); feature/UC/prd-slug **KHÔNG** thành sub-package, chỉ phân biệt ở **tên class**. Lưu `code_base_package` + `package_strategy` — *service overlay thắng*.
|
|
274
|
+
- **§3 Coding Standards** → quy tắc đặt tên (class, method), kiểu response wrapper, pattern bị cấm — *service overlay thắng*
|
|
275
|
+
- **§5 Error Handling** → kiểu exception, mapping HTTP status code, tên class not-found exception — *service overlay thắng*
|
|
276
|
+
- **§7 Git Conventions** → pattern đặt tên branch, format commit message — *lấy theo root trừ khi service định nghĩa lại*
|
|
277
|
+
|
|
278
|
+
**Quy tắc phân giải:**
|
|
279
|
+
- Nếu cả hai tầng tồn tại → merge như trên; ghi `claude_md_source = root + {service_root}`.
|
|
280
|
+
- Nếu chỉ có service overlay (không có root CLAUDE.md) → dùng file service một mình; `claude_md_source = {service_root}`.
|
|
281
|
+
- Nếu `service_root` được set nhưng `{service_root}/CLAUDE.md` **thiếu** → fallback về root CLAUDE.md và gắn cờ ⚠️ trong recap Bước 7 (service không có định nghĩa kiến trúc/coding-standards — việc sinh code sẽ dùng mặc định umbrella, có thể sai stack).
|
|
282
|
+
- Nếu cả hai đều không tồn tại → ghi nhận CLAUDE.md thiếu và tiếp tục chỉ với dữ liệu từ project-context.yaml.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Bước 4 — [SAFETY] Nạp quy tắc bảo vệ dữ liệu
|
|
287
|
+
|
|
288
|
+
Đọc `.agent/rules/data-protection.md` (hoặc `rules/data-protection.md` từ bản cài đặt framework).
|
|
289
|
+
|
|
290
|
+
Lưu các pattern file nhạy cảm — bạn **tuyệt đối không** đọc, ghi, hiển thị, hay tham chiếu nội dung từ các file khớp những pattern đó trong suốt cả phiên.
|
|
291
|
+
|
|
292
|
+
Nếu cả hai file đều không tồn tại → áp dụng mặc định built-in: không bao giờ truy cập `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Bước 5 — [DOMAIN] Nạp Business Dictionary (có điều kiện)
|
|
297
|
+
|
|
298
|
+
Kiểm tra file business dictionary có tồn tại không (dùng `paths.business_dictionary` đã phân giải ở Bước 1).
|
|
299
|
+
|
|
300
|
+
Nếu tồn tại, đọc và trích xuất:
|
|
301
|
+
- **Canonical Terms** → danh sách đầy đủ các thuật ngữ chuẩn và định nghĩa
|
|
302
|
+
- **Banned Terms** → danh sách đầy đủ các thuật ngữ bị cấm và bản thay thế chuẩn
|
|
303
|
+
- **Status / Enum Registry** → các giá trị enum được phép theo từng entity
|
|
304
|
+
|
|
305
|
+
Lưu danh sách banned term để **thực thi chủ động** suốt phiên làm việc của lệnh:
|
|
306
|
+
- Khi sinh bất kỳ văn bản nào (PRD, BDD, comment code, tech docs), kiểm tra không có banned term nào xuất hiện
|
|
307
|
+
- Tự động thay banned term bằng bản chuẩn tương đương
|
|
308
|
+
|
|
309
|
+
Nếu file không tồn tại → bỏ qua âm thầm. Không cảnh báo hay chặn.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Bước 6 — [DOMAIN] Nạp Core Entities (có điều kiện)
|
|
314
|
+
|
|
315
|
+
Kiểm tra file core entities có tồn tại tại `paths.core_entities` không (đã phân giải ở Bước 1).
|
|
316
|
+
Path mặc định: `specs/domain-knowledge/core-entities.md`.
|
|
317
|
+
|
|
318
|
+
Nếu tồn tại, đọc và lưu:
|
|
319
|
+
- **Entity catalog** → với mỗi entity: tên, mục đích, service sở hữu, các field chính (tên + kiểu), business invariant, và quan hệ
|
|
320
|
+
- **Field name registry** → tên field chuẩn dùng trong code và tài liệu được sinh ra
|
|
321
|
+
- **Relationship map** → cách các entity liên hệ với nhau (1:N, N:N, embedded, v.v.)
|
|
322
|
+
|
|
323
|
+
**Cách dùng catalog này:**
|
|
324
|
+
- Khi sinh code: dùng tên field, kiểu, và quan hệ định nghĩa ở đây — KHÔNG suy đoán từ code có sẵn
|
|
325
|
+
- Khi sinh PRD/BDD: tham chiếu tên entity từ catalog này để nhất quán
|
|
326
|
+
- Khi sinh tech-docs: dùng catalog này làm nguồn chân lý cho định nghĩa entity
|
|
327
|
+
|
|
328
|
+
Nếu file không tồn tại → bỏ qua âm thầm.
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Bước 6.5 — [PLATFORM] Suy ra active_module và platform_type
|
|
333
|
+
|
|
334
|
+
Dùng `tech_stack.module` đã nạp ở Bước 1, suy ra và lưu hai biến để mọi lệnh phía sau dùng:
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
active_module = tech_stack.module (vd: "java-spring", "react", "flutter")
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
| `platform_type` | Modules |
|
|
341
|
+
|---|---|
|
|
342
|
+
| `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
|
|
343
|
+
| `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
|
|
344
|
+
| `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
|
|
345
|
+
|
|
346
|
+
Nếu `tech_stack.module` rỗng hoặc không nhận diện được → set `platform_type = "unknown"` và gắn cờ ⚠️ trong recap Bước 7.
|
|
347
|
+
|
|
348
|
+
Hai biến này (`active_module`, `platform_type`) là nguồn chuẩn cho mọi logic rẽ nhánh trong các lệnh cần hành vi riêng theo platform (dev-gen-test, debug, fix-bug, dev-smoke-test).
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Bước 6.7 — [GUARDRAILS] Nạp Project Lessons (có điều kiện)
|
|
353
|
+
|
|
354
|
+
*Các lỗi tích luỹ mà AI không được lặp lại trong dự án này. Chúng được bổ sung dần qua `/learn`
|
|
355
|
+
hoặc được chấp nhận trong `/review-code`, `/fix-bug`, `/debug`.*
|
|
356
|
+
|
|
357
|
+
Phân giải path file lessons:
|
|
358
|
+
- Dùng `paths.lessons_file` nếu được set (có thể bị service override ở chế độ umbrella, Bước 1.6)
|
|
359
|
+
- Else mặc định `specs/domain-knowledge/lessons-learned.md`
|
|
360
|
+
- Ở chế độ umbrella/service (khi `service_root` được set), nếu `paths.lessons_file` chưa set, mặc định `{service_root}/.agent/project-lessons.md`
|
|
361
|
+
|
|
362
|
+
Nếu file tồn tại, đọc và lưu TẤT CẢ lesson làm **GUARDRAIL ĐANG HOẠT ĐỘNG** cho phiên:
|
|
363
|
+
- Coi **Rule** của mỗi lesson là ràng buộc cứng — cùng mức ưu tiên với coding standards trong CLAUDE.md (Bước 3).
|
|
364
|
+
- Trước khi sinh hoặc sửa bất kỳ artifact nào (PRD, BDD, tech-doc, code, test), đối chiếu output với mọi lesson có `category` khớp lệnh hiện tại VÀ `scope` khớp target (domain / file).
|
|
365
|
+
- Nếu output sinh ra vi phạm một lesson → sửa **trước khi** trình bày, và ghi rõ lesson nào (`L-NNN`) đã được áp dụng.
|
|
366
|
+
|
|
367
|
+
Nếu file không tồn tại → bỏ qua âm thầm (chưa có lesson nào được ghi nhận).
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Bước 7 — [RECAP] Working Memory Recap (chống lost-in-middle)
|
|
372
|
+
|
|
373
|
+
Sau khi nạp toàn bộ context, tổng hợp và xuất một khối tóm tắt gọn.
|
|
374
|
+
Recap này đảm bảo các sự thật quan trọng nhất được nêu ở CUỐI quá trình nạp context
|
|
375
|
+
(hiệu ứng recency — tươi mới nhất trong bộ nhớ làm việc khi bắt đầu task).
|
|
376
|
+
|
|
377
|
+
Xuất đúng khối này:
|
|
378
|
+
```
|
|
379
|
+
[CTX LOADED]
|
|
380
|
+
Stack : {language} / {framework} / {database}
|
|
381
|
+
Platform : {active_module} ({platform_type})
|
|
382
|
+
Layers : {thứ tự layer từ CLAUDE.md §2 đã merge, vd: Controller → Facade → Service → Repository}
|
|
383
|
+
Package : {code_base_package}.{layer} · {by-layer | by-feature} ← feature/UC → tên class, KHÔNG thành package (nếu by-layer)
|
|
384
|
+
CLAUDE.md : {root + {service_root} | chỉ {service_root} | chỉ root | ⚠️ service overlay THIẾU — dùng root | missing}
|
|
385
|
+
Ticket : {ticket_prefix}-
|
|
386
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
387
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
388
|
+
Lessons : {loaded — N guardrails | chưa có}
|
|
389
|
+
Service : {active_service} ({active_service_module}) | single-service
|
|
390
|
+
Svc Root : {service_root} — đã nạp conventions + trace_dir từ config service | —
|
|
391
|
+
Status : {FULL | PARTIAL — thiếu: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Nếu bất kỳ file CRITICAL nào thiếu (CLAUDE.md), gắn cờ rõ ràng để người dùng quyết định có tiếp tục hay không.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Hoàn tất nạp Context
|
|
399
|
+
|
|
400
|
+
Sau khi hoàn thành tất cả các bước, bạn đã nạp:
|
|
401
|
+
- Định danh dự án, tech stack, convention module
|
|
402
|
+
- Quy tắc kiến trúc và thứ tự layer ← **[CRITICAL — giữ trong bộ nhớ làm việc]**
|
|
403
|
+
- Coding standards và quy tắc đặt tên ← **[CRITICAL — giữ trong bộ nhớ làm việc]**
|
|
404
|
+
- Quy tắc bảo vệ dữ liệu (pattern file nhạy cảm không bao giờ truy cập)
|
|
405
|
+
- Quy tắc thuật ngữ kèm danh sách banned term ← **[DOMAIN — áp dụng cho mọi từ được sinh ra]**
|
|
406
|
+
- Entity catalog (tên field, kiểu, invariant) ← **[DOMAIN — dùng khi sinh code]**
|
|
407
|
+
- Toàn bộ path đã cấu hình
|
|
408
|
+
|
|
409
|
+
Tiếp tục sang bước kế tiếp của lệnh đang gọi.
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Process
|
|
415
|
+
|
|
416
|
+
### Step 0 — Umbrella Mode Detection
|
|
417
|
+
|
|
418
|
+
Kiểm tra mảng `services` có tồn tại trong `project-context.yaml` không.
|
|
419
|
+
|
|
420
|
+
**Nếu `services` tồn tại (umbrella mode):**
|
|
421
|
+
- Phân giải trace dir:
|
|
422
|
+
- **Nếu `setup.spec_source` được set (consolidated trace):** `all_trace_dirs = [ {spec_source}/.trace ]` — một vị trí authoritative **duy nhất** trong spec repo. Scenario mang service sở hữu qua field `@trace.service`, nên không cần tách theo service. Đây là trường hợp phổ biến.
|
|
423
|
+
- **Else (không có spec_source — legacy per-service trace):** một dir mỗi service — `services[N].trace_dir` nếu set, else `{services[N].path}/.trace`; `all_trace_dirs = [ dir1, dir2, … ]`, gắn tag tên service khi đọc.
|
|
424
|
+
- Step 1 đọc TSV từ `all_trace_dirs`.
|
|
425
|
+
- **Phân giải Living Docs home (vị trí report sinh ra):**
|
|
426
|
+
- Nếu `setup.spec_source` được set → `living_docs_dir = {spec_source}/.living-docs`
|
|
427
|
+
*(specs module dùng chung — mount trong mọi service/umbrella workspace, nên panel phân giải nó bất kể dev đứng ở submodule nào)*
|
|
428
|
+
- Else (umbrella không có spec repo riêng) → `living_docs_dir = .living-docs` ở umbrella root
|
|
429
|
+
- **Phân giải panel mirror:** `panel_mirror = ./.trace` ở **gốc workspace hiện tại** (nơi lệnh chạy). Panel VS Code đọc `.trace/trace-report.json` từ workspace đang mở — ghi report ở đây là cái làm view không rỗng khi dev mở một service submodule trực tiếp.
|
|
430
|
+
|
|
431
|
+
**Nếu không có key `services` (single-service mode):**
|
|
432
|
+
- Set `all_trace_dirs = [ {paths.trace_dir} ]`
|
|
433
|
+
- Không cần umbrella sync
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
### Step 1 — Nạp dữ liệu TSV
|
|
438
|
+
|
|
439
|
+
**Umbrella mode:** đọc tất cả file `{trace_dir}/**/*.tsv` từ mọi dir trong `all_trace_dirs`. Với mỗi TSV, gắn tag row với tên service gốc.
|
|
440
|
+
|
|
441
|
+
**Single-service mode:** đọc tất cả file `{paths.trace_dir}/{domain}/**/*.tsv` khớp domain target (hoặc `{paths.trace_dir}/**/*.tsv` cho mọi domain nếu không có domain filter).
|
|
442
|
+
|
|
443
|
+
Mỗi file cho trace state đã lưu của UC đó.
|
|
444
|
+
|
|
445
|
+
**Nếu không tìm thấy file `.tsv` nào** trong bất kỳ trace dir nào:
|
|
446
|
+
- Quét tất cả file `{paths.specs_dir}/**/*.feature` trong domain target để dựng list in-memory mọi scenario.
|
|
447
|
+
- Coi mọi scenario là `UNTRACKED` (chưa sinh code).
|
|
448
|
+
- In: "⚠️ No trace files found. All {N} scenarios across {M} UCs are UNTRACKED."
|
|
449
|
+
- Đề xuất: "Run `/generate-bdd {prd-file}` to initialize trace state, or `/generate-code {feature-file}` to generate code."
|
|
450
|
+
- **Bỏ qua hoàn toàn Step 2–6.** Đi thẳng tới Step 7 dùng state in-memory này — ĐỪNG abort.
|
|
451
|
+
|
|
452
|
+
### Step 2 — Reconcile với file `.feature` hiện tại
|
|
453
|
+
|
|
454
|
+
Mỗi file trace là `{UC-ID}-{platform}.tsv` (một sổ / UC × platform). Với mỗi row, đọc file `.feature` **của đúng platform đó** (`{specs_dir}/{domain}/{prd-slug}/bdd/{platform}/{UC-ID}*.feature` — platform lấy từ tên file TSV) và lấy `@trace.sc_version` **hiện tại** cho SC đó.
|
|
455
|
+
Nếu version SC trong `.feature` khác `spec_ver` của `.tsv` → cập nhật `spec_ver` trong memory (sẽ ghi lại).
|
|
456
|
+
|
|
457
|
+
Cũng phát hiện SC có trong `.feature` (platform đó) nhưng thiếu trong `.tsv` → thêm row mới với `status: UNTRACKED`. *(sc_id trùng số giữa các platform là 2 scenario khác nhau → mỗi sổ platform giữ tập SC riêng, không dedupe chéo platform.)*
|
|
458
|
+
|
|
459
|
+
### Step 3 — Tính `status` theo từng scenario
|
|
460
|
+
|
|
461
|
+
Áp dụng quy tắc theo thứ tự ưu tiên (first-match-wins):
|
|
462
|
+
|
|
463
|
+
| Rule | Status | Điều kiện |
|
|
464
|
+
|------|--------|-----------|
|
|
465
|
+
| 1 | `UNTRACKED` | `implemented_by == —` (chưa sinh code) |
|
|
466
|
+
| 2 | `DRIFT` | `implemented_by != —` AND `spec_ver != gen_ver` (spec đã đổi sau lần codegen — code cũ, **ưu tiên regen trước khi test**) |
|
|
467
|
+
| 3 | `GAP` | `implemented_by != —` AND (`test_count == —` OR `test_count == 0`) |
|
|
468
|
+
| 4 | `OK` | tất cả: `spec_ver == gen_ver`, `implemented_by != —`, `test_count > 0` |
|
|
469
|
+
|
|
470
|
+
> **Vì sao DRIFT xét trước GAP:** một scenario đã có code, chưa test, **và** spec vừa drift phải hiện `DRIFT` (không phải `GAP`) — vì `generate-code` xử `GAP` = "skip codegen, chạy /dev-gen-test" còn `DRIFT` = "regenerate". Nếu GAP thắng, code lỗi thời bị bỏ qua và test lại sinh trên code cũ. UNTRACKED vẫn phải là Rule 1 để scenario chưa code (gen_ver `—`) không lọt vào DRIFT.
|
|
471
|
+
|
|
472
|
+
### Step 4 — PRD version drift check
|
|
473
|
+
|
|
474
|
+
Với mỗi UC, so:
|
|
475
|
+
- PRD `| **Version** |` hiện tại từ `{paths.specs_dir}/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md`
|
|
476
|
+
- `prd_version` lưu trong `.tsv` (version tại thời điểm sinh BDD)
|
|
477
|
+
- `@trace.prd_version` trong các file code implement UC đó
|
|
478
|
+
|
|
479
|
+
Nếu layer nào sau version PRD hiện tại → gắn cờ `PRD_DRIFT` và trích các changelog entry kể từ version đó.
|
|
480
|
+
|
|
481
|
+
### Step 5 — Tech-doc revision drift check
|
|
482
|
+
|
|
483
|
+
Mỗi PRD có **một** tech-doc gộp `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{TICKET-ID}-tech-design.md` với một `@trace.revision` chung. So revision đó vs hai cột đã lưu:
|
|
484
|
+
|
|
485
|
+
- **Backend drift:** `@trace.revision` của doc vs `tech_doc_revision` trong `.tsv`.
|
|
486
|
+
Code sinh từ revision cũ hơn → gắn cờ `TECHDOC_DRIFT`.
|
|
487
|
+
- **FE integration drift:** `@trace.revision` của doc vs `fe_tech_doc_revision` trong `.tsv` (row FE `--phase=integration`, theo từng platform).
|
|
488
|
+
Code FE wire theo revision cũ hơn (§4.5.4 đã đổi) → gắn cờ `FE_TECHDOC_DRIFT`.
|
|
489
|
+
|
|
490
|
+
Skip cột nào chưa có revision đã lưu (`—`), hoặc cả UC chưa có tech-doc.
|
|
491
|
+
|
|
492
|
+
### Step 5b — Seam & Stub Audit (mồ côi khi ghép luồng)
|
|
493
|
+
|
|
494
|
+
*Bắt lỗi "gen từng BDD thì đúng, ghép cả luồng thì hỏng": chỗ giả lập còn rỗng trong khi hàng thật đã tồn tại ở nơi khác — luồng chạy vào no-op / hàm thật không ai gọi. Build vẫn xanh, test từng-UC vẫn xanh, nên không cổng nào khác bắt được. Hai loại: `seam` (port cross-UC chưa nối) và `stub` (method trắng nội-feature chưa lấp).*
|
|
495
|
+
|
|
496
|
+
**Nguồn (dùng cái nào có, hợp nhất):**
|
|
497
|
+
1. Sổ chung `{trace_dir}/{domain}/{prd-slug}/_seams.tsv` — do `/generate-code` ghi (cột `kind` phân biệt `seam`/`stub`).
|
|
498
|
+
2. Quét code dưới `{code_base_package}` (từ CLAUDE.md §2 đã nạp) — bắt cả chỗ sinh **trước khi** có sổ:
|
|
499
|
+
- **seam:** class mang `@trace.seam_pending` HOẶC tên khớp `*Stub*Adapter`.
|
|
500
|
+
- **stub:** method mang `@trace.stub` (thân còn placeholder — `throw UnsupportedOperationException` / TODO / rỗng).
|
|
501
|
+
|
|
502
|
+
**Audit A — Seam (port cross-UC).** Với mỗi seam:
|
|
503
|
+
- Tìm **hàng thật**: class KHÁC (không `*Stub*`/`*Mock*`) implement cùng port/interface dưới `{code_base_package}`.
|
|
504
|
+
- Tìm **binding hiện tại**: stub có còn được tham chiếu như adapter đang dùng không (được inject / `@Primary` / đăng ký trong config) — hàng thật thì KHÔNG có đường vào?
|
|
505
|
+
|
|
506
|
+
| Điều kiện | Cờ | Ý nghĩa |
|
|
507
|
+
|---|---|---|
|
|
508
|
+
| Hàng thật CHƯA tồn tại | `SEAM_PENDING` | Bình thường — owner UC chưa gen. Chỉ nhắc. |
|
|
509
|
+
| Hàng thật ĐÃ tồn tại **và** stub vẫn là binding đang dùng | `SEAM_UNWIRED` 🔴 | **Lỗi thật** — hàng thật mồ côi, luồng chạy vào stub rỗng. |
|
|
510
|
+
| Binding đã trỏ hàng thật (stub chỉ còn cho test) | *(sạch)* | Đã nối xong. |
|
|
511
|
+
|
|
512
|
+
**Audit B — Stub (method trắng nội-feature).** Với mỗi method còn tag `@trace.stub`:
|
|
513
|
+
- Đọc `@trace.stub_owner` (UC lẽ ra phải lấp) + `@trace.stub_for` (trách nhiệm).
|
|
514
|
+
- **Owner đã gen chưa?** = có bất kỳ `@trace.implements={stub_owner}-*` nào trong codebase không.
|
|
515
|
+
- **Có hàng thật song song không?** = method KHÁC mang `@trace.implements` với thân thật cùng trách nhiệm `stub_for` (dấu hiệu BDD owner đã đẻ hàm song song thay vì lấp).
|
|
516
|
+
|
|
517
|
+
| Điều kiện | Cờ | Ý nghĩa |
|
|
518
|
+
|---|---|---|
|
|
519
|
+
| `stub_owner` chưa gen **và** không có hàng song song | `STUB_PENDING` | Bình thường — owner BDD chưa chạy. Chỉ nhắc. |
|
|
520
|
+
| `stub_owner` ĐÃ gen (hoặc có method song song cùng `stub_for`) mà method vẫn còn `@trace.stub` rỗng | `STUB_UNRESOLVED` 🔴 | **Lỗi thật** — hàm trắng mồ côi (caller chạy vào rỗng) và/hoặc hàm thật mồ côi (không ai gọi). Fill-before-create đã trượt. |
|
|
521
|
+
| Không còn method nào mang `@trace.stub` cho trách nhiệm đó | *(sạch)* | Đã lấp xong. |
|
|
522
|
+
|
|
523
|
+
- **Cập nhật sổ `_seams.tsv`** (nếu tồn tại): theo `kind`,
|
|
524
|
+
- `seam`: `PENDING`→`READY` khi hàng thật xuất hiện mà chưa nối; `→RESOLVED` khi binding đã trỏ hàng thật.
|
|
525
|
+
- `stub`: `PENDING`→`READY` khi phát hiện `STUB_UNRESOLVED`; `→RESOLVED` khi method đã được lấp (hết `@trace.stub`).
|
|
526
|
+
`READY` = đồng nghĩa cờ 🔴 tương ứng (`SEAM_UNWIRED` / `STUB_UNRESOLVED`).
|
|
527
|
+
|
|
528
|
+
Không tìm thấy seam/stub nào → bỏ qua im lặng.
|
|
529
|
+
|
|
530
|
+
### Step 6 — Ghi status lại vào TSV
|
|
531
|
+
|
|
532
|
+
*Bỏ qua step này nếu không có file TSV nào (đã xử lý bởi path no-TSV của Step 1).*
|
|
533
|
+
|
|
534
|
+
Với mỗi file `.tsv` đã xử lý: ghi `spec_ver`, `status`, `last_updated` đã cập nhật lại disk.
|
|
535
|
+
Đồng thời **đồng bộ `uc_status` ← `@trace.status`** của file `.feature` tương ứng (header `.feature` là nguồn-sự-thật về duyệt BDD — người đặt `approved` sau khi review sạch, giống PO đặt PRD Metadata `Status`). Nhờ vậy `approved_ucs` trên dashboard phản ánh đúng thay vì luôn = 0.
|
|
536
|
+
**Đừng** sửa `dev_selftest`/`dev_selftest_at` (do `/dev-run-test` sở hữu) hay `qc_status`/`qc_run_at`/`qc_owner`/`qc_blocked_by` (do `/qc-run-test` + `/report-bug` sở hữu); lệnh này chỉ đọc chúng cho report.
|
|
537
|
+
|
|
538
|
+
### Step 7 — Tính aggregate cho dashboard
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
total_prds = count distinct PRD files in {paths.specs_dir}/{domain}/*/*.md (file .md ở gốc mỗi feature folder = PRD)
|
|
542
|
+
approved_prds = PRDs with | Status | approved
|
|
543
|
+
total_ucs = count distinct UC-IDs across all .tsv files (strip the -{platform} suffix from the filename)
|
|
544
|
+
approved_ucs = UCs with uc_status == approved
|
|
545
|
+
draft_ucs = UCs with uc_status == draft
|
|
546
|
+
total_scs = total rows across all .tsv files (a UC's SCs are counted per platform — no cross-platform dedupe by sc_id)
|
|
547
|
+
code_coverage = rows where implemented_by != — / total_scs
|
|
548
|
+
test_coverage = rows where test_count > 0 / total_scs
|
|
549
|
+
drift_count = rows where status == DRIFT
|
|
550
|
+
untracked_count = rows where status == UNTRACKED
|
|
551
|
+
gap_count = rows where status == GAP
|
|
552
|
+
seam_unwired_count = số seam bị cờ SEAM_UNWIRED (hàng thật đã có nhưng consumer còn wire vào stub — Step 5b)
|
|
553
|
+
stub_unresolved_count = số stub bị cờ STUB_UNRESOLVED (method còn trắng dù owner đã gen / có hàm song song — Step 5b)
|
|
554
|
+
dev_selftest_passing = rows where dev_selftest == pass
|
|
555
|
+
dev_selftest_failing = rows where dev_selftest == fail
|
|
556
|
+
dev_selftest_not_run = rows where dev_selftest in (not_run, —)
|
|
557
|
+
# NOTE: dev_selftest is the DEV self-check signal (did the dev run their own smoke tests),
|
|
558
|
+
# NOT official coverage — keep it labeled as such on the dashboard.
|
|
559
|
+
qc_passing = rows where qc_status == pass
|
|
560
|
+
qc_failing = rows where qc_status == fail
|
|
561
|
+
qc_skipped = rows where qc_status == skip
|
|
562
|
+
qc_not_run = rows where qc_status in (not_run, —)
|
|
563
|
+
# qc_status is the OFFICIAL QC automation result (set by /qc-run-test),
|
|
564
|
+
# shown alongside — never merged with — dev_selftest.
|
|
565
|
+
waiting_dev = rows where qc_owner == dev # PM view: QC-found, waiting on dev to fix
|
|
566
|
+
waiting_po = rows where qc_owner == po # PM view: blocked, waiting on PO to confirm/clarify
|
|
567
|
+
# qc_owner + qc_blocked_by trả lời "case nào đang chờ ai" — surface as a "Waiting on" column.
|
|
568
|
+
tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/*/tech-docs/
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
### Step 8 — Ghi JSON report
|
|
572
|
+
|
|
573
|
+
Ghi `{paths.trace_dir}/trace-report.json` (ghi đè nếu tồn tại). File này là source of truth duy nhất cho web dashboard — nó chứa snapshot đầy đủ tại thời điểm `/validate-traces` chạy lần cuối.
|
|
574
|
+
|
|
575
|
+
Schema:
|
|
576
|
+
|
|
577
|
+
```json
|
|
578
|
+
{
|
|
579
|
+
"generated_at": "<ISO-8601 timestamp>",
|
|
580
|
+
"domain": "<domain argument, or 'all' if no filter>",
|
|
581
|
+
"summary": {
|
|
582
|
+
"total_prds": 0,
|
|
583
|
+
"approved_prds": 0,
|
|
584
|
+
"total_ucs": 0,
|
|
585
|
+
"approved_ucs": 0,
|
|
586
|
+
"draft_ucs": 0,
|
|
587
|
+
"total_scs": 0,
|
|
588
|
+
"coded_scs": 0,
|
|
589
|
+
"tested_scs": 0,
|
|
590
|
+
"code_coverage_pct": 0,
|
|
591
|
+
"test_coverage_pct": 0,
|
|
592
|
+
"drift_count": 0,
|
|
593
|
+
"gap_count": 0,
|
|
594
|
+
"untracked_count": 0,
|
|
595
|
+
"seam_unwired_count": 0,
|
|
596
|
+
"stub_unresolved_count": 0,
|
|
597
|
+
"dev_selftest_passing": 0,
|
|
598
|
+
"dev_selftest_failing": 0,
|
|
599
|
+
"dev_selftest_not_run": 0,
|
|
600
|
+
"qc_passing": 0,
|
|
601
|
+
"qc_failing": 0,
|
|
602
|
+
"qc_skipped": 0,
|
|
603
|
+
"qc_not_run": 0,
|
|
604
|
+
"waiting_dev": 0,
|
|
605
|
+
"waiting_po": 0,
|
|
606
|
+
"tech_docs_count": 0
|
|
607
|
+
},
|
|
608
|
+
"prds": [
|
|
609
|
+
{
|
|
610
|
+
"prd_id": "<e.g. PAY>",
|
|
611
|
+
"prd_status": "approved | draft | other",
|
|
612
|
+
"total_scs": 0,
|
|
613
|
+
"coded_scs": 0,
|
|
614
|
+
"tested_scs": 0,
|
|
615
|
+
"drift_count": 0,
|
|
616
|
+
"gap_count": 0,
|
|
617
|
+
"untracked_count": 0,
|
|
618
|
+
"ucs": [
|
|
619
|
+
{
|
|
620
|
+
"uc_id": "<e.g. PAY-UC01>",
|
|
621
|
+
"uc_status": "approved | draft | other",
|
|
622
|
+
"scenarios": [
|
|
623
|
+
{
|
|
624
|
+
"sc_id": "<e.g. PAY-UC01-SC1>",
|
|
625
|
+
"sc_title": "<title>",
|
|
626
|
+
"spec_ver": "<current version from .feature>",
|
|
627
|
+
"gen_ver": "<version at codegen time>",
|
|
628
|
+
"implemented_by": "<ClassName.method or null>",
|
|
629
|
+
"test_count": 0,
|
|
630
|
+
"test_classes": ["<TestClass1>", "<TestClass2>"],
|
|
631
|
+
"dev_selftest": "pass | fail | not_run",
|
|
632
|
+
"dev_selftest_at": "<YYYY-MM-DD or null>",
|
|
633
|
+
"qc_status": "pass | fail | skip | not_run",
|
|
634
|
+
"qc_run_at": "<YYYY-MM-DD or null>",
|
|
635
|
+
"qc_owner": "dev | po | null",
|
|
636
|
+
"qc_blocked_by": "<BUG-id / GAP-id or null>",
|
|
637
|
+
"prd_version": "<prd version when BDD was generated>",
|
|
638
|
+
"bdd_version": "<bdd version when code was generated>",
|
|
639
|
+
"tech_doc_revision": 0,
|
|
640
|
+
"fe_tech_doc_revision": 0,
|
|
641
|
+
"status": "OK | DRIFT | GAP | UNTRACKED",
|
|
642
|
+
"last_updated": "<YYYY-MM-DD>"
|
|
643
|
+
}
|
|
644
|
+
]
|
|
645
|
+
}
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
"issues": {
|
|
650
|
+
"drift": [
|
|
651
|
+
{
|
|
652
|
+
"sc_id": "<SC-ID>",
|
|
653
|
+
"sc_title": "<title>",
|
|
654
|
+
"spec_ver": "<current>",
|
|
655
|
+
"gen_ver": "<at codegen>",
|
|
656
|
+
"fix": "/generate-code <UC-ID>"
|
|
657
|
+
}
|
|
658
|
+
],
|
|
659
|
+
"gap": [
|
|
660
|
+
{
|
|
661
|
+
"sc_id": "<SC-ID>",
|
|
662
|
+
"sc_title": "<title>",
|
|
663
|
+
"implemented_by": "<method>",
|
|
664
|
+
"fix": "/dev-gen-test <UC-ID>"
|
|
665
|
+
}
|
|
666
|
+
],
|
|
667
|
+
"untracked": [
|
|
668
|
+
{
|
|
669
|
+
"sc_id": "<SC-ID>",
|
|
670
|
+
"sc_title": "<title>",
|
|
671
|
+
"fix": "/generate-code <UC-ID>"
|
|
672
|
+
}
|
|
673
|
+
],
|
|
674
|
+
"prd_version_drift": [
|
|
675
|
+
{
|
|
676
|
+
"uc_id": "<UC-ID>",
|
|
677
|
+
"code_prd_version": "<version in code tag>",
|
|
678
|
+
"current_prd_version": "<version in PRD file>",
|
|
679
|
+
"changelog_since": ["<v1.1: ...>", "<v1.2: ...>"],
|
|
680
|
+
"fix": "/generate-bdd <prd-file> then /generate-code <UC-ID>"
|
|
681
|
+
}
|
|
682
|
+
],
|
|
683
|
+
"techdoc_drift": [
|
|
684
|
+
{
|
|
685
|
+
"uc_id": "<UC-ID>",
|
|
686
|
+
"code_revision": 0,
|
|
687
|
+
"current_revision": 0,
|
|
688
|
+
"fix": "/generate-code <UC-ID>"
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"fe_techdoc_drift": [
|
|
692
|
+
{
|
|
693
|
+
"uc_id": "<UC-ID>",
|
|
694
|
+
"platform": "web | app",
|
|
695
|
+
"code_revision": 0,
|
|
696
|
+
"current_revision": 0,
|
|
697
|
+
"fix": "/generate-code <UC-ID> --phase=integration"
|
|
698
|
+
}
|
|
699
|
+
],
|
|
700
|
+
"seam_unwired": [
|
|
701
|
+
{
|
|
702
|
+
"port": "<PortName>",
|
|
703
|
+
"consumer_uc": "<UC còn gọi stub>",
|
|
704
|
+
"owner_uc": "<UC sở hữu hàng thật>",
|
|
705
|
+
"stub_class": "<StubClass>",
|
|
706
|
+
"real_class": "<RealClass>",
|
|
707
|
+
"fix": "Trỏ binding của <consumer_uc> sang <RealClass> (xoá/thay stub), build lại"
|
|
708
|
+
}
|
|
709
|
+
],
|
|
710
|
+
"stub_unresolved": [
|
|
711
|
+
{
|
|
712
|
+
"artifact": "<ClassName#method>",
|
|
713
|
+
"stub_for": "<trách nhiệm>",
|
|
714
|
+
"consumer_uc": "<UC để trắng>",
|
|
715
|
+
"owner_uc": "<UC lẽ ra phải lấp>",
|
|
716
|
+
"parallel_impl": "<ClassName#method hàm song song, hoặc null>",
|
|
717
|
+
"fix": "/generate-code <owner_uc> — lấp logic vào <ClassName#method> tại chỗ (Fill-before-create), xoá hàm song song nếu có, build lại"
|
|
718
|
+
}
|
|
719
|
+
]
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
**Rules:**
|
|
725
|
+
- `implemented_by`: dùng `null` (không phải `"—"`) trong JSON khi không có giá trị
|
|
726
|
+
- `test_count`: dùng integer `0` (không phải `"—"`) khi không có test
|
|
727
|
+
- `test_classes`: dùng `[]` (không phải `"—"`) khi không có test class
|
|
728
|
+
- `tech_doc_revision` / `fe_tech_doc_revision`: dùng integer; `0` nếu chưa sinh
|
|
729
|
+
- `code_coverage_pct` / `test_coverage_pct`: làm tròn về integer gần nhất (0–100)
|
|
730
|
+
- Luôn ghi vào `{paths.trace_dir}/trace-report.json` bất kể domain filter — nếu có domain filter, chỉ gồm các PRD đó trong `prds[]` nhưng ghi domain vào field `domain`
|
|
731
|
+
- **TSV `"—"` mapping**: khi đọc file TSV, map giá trị dash sang kiểu JSON: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`; `fe_tech_doc_revision: "—"` → `0`; `dev_selftest: "—"` → `"not_run"`; `dev_selftest_at: "—"` → `null`; `qc_status: "—"` → `"not_run"`; `qc_run_at: "—"` → `null`; `qc_owner: "—"` → `null`; `qc_blocked_by: "—"` → `null`
|
|
732
|
+
- **Backward-compat:** TSV cũ có thể thiếu cột mới hơn trong header — coi cột vắng nào là giá trị rỗng của nó (đừng báo lỗi): `qc_owner`/`qc_blocked_by` (pre-19-col) → `null`; `fe_tech_doc_revision` (pre-22-col) → `0`. Lần `/generate-bdd` gen lại tiếp theo nâng header lên layout 22 cột hiện tại.
|
|
733
|
+
|
|
734
|
+
### Step 8b — Living Docs Sync *(chỉ umbrella mode)*
|
|
735
|
+
|
|
736
|
+
*Bỏ qua step này ở single-service mode.*
|
|
737
|
+
|
|
738
|
+
**Với `spec_source` được set,** các trace TSV authoritative đã sống ở **một** chỗ —
|
|
739
|
+
`{spec_source}/.trace/` (committed trong spec repo). **Không có merge theo service**:
|
|
740
|
+
mỗi scenario row mang service sở hữu qua `@trace.service`. Step này chỉ
|
|
741
|
+
(re)generate report và làm mới panel local.
|
|
742
|
+
|
|
743
|
+
1. **Ghi report** vào `{living_docs_dir}/trace-report.json` (`mkdir -p` trước) — dựng
|
|
744
|
+
trực tiếp từ `{spec_source}/.trace/*.tsv`, với field `"service"` mỗi scenario row và
|
|
745
|
+
các summary aggregate. *(Umbrella legacy không-`spec_source` vẫn merge mọi `trace-report.json`
|
|
746
|
+
theo service thành một document, namespace theo service.)*
|
|
747
|
+
|
|
748
|
+
2. **Mirror tới panel location** `{panel_mirror}` (`./.trace` ở gốc workspace hiện tại)
|
|
749
|
+
để dev mở *repo này* thấy data ngay: copy
|
|
750
|
+
`{living_docs_dir}/trace-report.json` (+ các file `{UC-ID}-{platform}.tsv`) → `{panel_mirror}/`.
|
|
751
|
+
Nếu `panel_mirror` đã phân giải về `{spec_source}/.trace`, skip.
|
|
752
|
+
|
|
753
|
+
3. **In sync summary:**
|
|
754
|
+
```
|
|
755
|
+
Living Docs → {living_docs_dir}/trace-report.json ({total} scenarios across {S} services)
|
|
756
|
+
Trace (authoritative) → {spec_source}/.trace/ (committed in spec repo)
|
|
757
|
+
Panel mirror → {panel_mirror}/trace-report.json (current workspace)
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
> **Lưu ý:** trace state committed, authoritative là `{spec_source}/.trace/*.tsv` (trong
|
|
761
|
+
> spec repo — một chỗ cho PM). Report (`.living-docs/`) và panel mirror
|
|
762
|
+
> (`./.trace` ở workspace không phải spec repo) là **sinh ra** — gitignore chúng;
|
|
763
|
+
> chúng được regenerate bởi `/validate-traces` hoặc `/sync`.
|
|
764
|
+
|
|
765
|
+
## Output
|
|
766
|
+
|
|
767
|
+
# Report Footer — Định dạng output chuẩn cho mọi lệnh
|
|
768
|
+
|
|
769
|
+
Mọi report của lệnh phải kết thúc bằng section footer chuẩn này.
|
|
770
|
+
|
|
771
|
+
## Status Badge
|
|
772
|
+
|
|
773
|
+
Chọn một theo kết quả:
|
|
774
|
+
- `✅ Complete` — mọi bước thành công, không có vấn đề
|
|
775
|
+
- `❌ Failed` — lệnh không hoàn thành được do lỗi chặn
|
|
776
|
+
- `⚠️ Warnings` — hoàn thành nhưng có vấn đề không chặn, nên review lại
|
|
777
|
+
|
|
778
|
+
## Output Artifacts
|
|
779
|
+
|
|
780
|
+
Liệt kê mọi file được tạo hoặc sửa bởi lệnh này:
|
|
781
|
+
```
|
|
782
|
+
Output Artifacts:
|
|
783
|
+
{created|updated} {file-path} ({mô tả ngắn})
|
|
784
|
+
{created|updated} {file-path} ({mô tả ngắn})
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
Nếu không ghi file nào (vd: lệnh review hoặc phân tích) → ghi `Output Artifacts: none (read-only)`.
|
|
788
|
+
|
|
789
|
+
## Pipeline Position
|
|
790
|
+
|
|
791
|
+
In một sơ đồ pipeline một dòng, đánh dấu phase của lệnh HIỆN TẠI bằng `◀ bạn ở đây`,
|
|
792
|
+
để người dùng luôn thấy lệnh này nằm ở đâu trong luồng end-to-end:
|
|
793
|
+
|
|
794
|
+
```
|
|
795
|
+
Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
Tìm lệnh hiện tại trong bảng phase dưới đây và đánh dấu **phase của nó** trong sơ đồ trên:
|
|
799
|
+
|
|
800
|
+
| Phase | Commands |
|
|
801
|
+
|-------|----------|
|
|
802
|
+
| Discovery | `/define-product` |
|
|
803
|
+
| PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
|
|
804
|
+
| Design Spec | `/generate-design-spec` |
|
|
805
|
+
| BDD | `/generate-bdd` · `/review-context` (BDD) |
|
|
806
|
+
| Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
|
|
807
|
+
| Code | `/generate-code` · `/review-code` |
|
|
808
|
+
| Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
|
|
809
|
+
| QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
|
|
810
|
+
| Trace Audit | `/validate-traces` |
|
|
811
|
+
|
|
812
|
+
Với **lệnh review**, thêm vòng review 3 bước và đánh dấu bước hiện tại, vd:
|
|
813
|
+
`Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
|
|
814
|
+
|
|
815
|
+
**Lệnh xuyên suốt** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
|
|
816
|
+
`/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) nằm ngoài pipeline tuyến tính —
|
|
817
|
+
**bỏ hẳn dòng Pipeline** cho các lệnh này (đừng cố nhét chúng vào sơ đồ).
|
|
818
|
+
|
|
819
|
+
## Gợi ý lệnh tiếp theo
|
|
820
|
+
|
|
821
|
+
Gợi ý lệnh kế tiếp hợp lý theo phase của workflow:
|
|
822
|
+
|
|
823
|
+
| Lệnh hiện tại | Gợi ý lệnh tiếp theo |
|
|
824
|
+
|-------------------------|-----------------------------------------------|
|
|
825
|
+
| /setup-ai-first | `/define-product` để bắt đầu feature đầu tiên |
|
|
826
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
827
|
+
| /generate-prd | `/refine-prd {prd-file}` rồi `/review-context {prd-file}` |
|
|
828
|
+
| /refine-prd | Mở Review Board → cập nhật PRD → `/review-context {prd-file}` |
|
|
829
|
+
| /review-context (PRD) | Khi 0 critical → PO đặt `Status: approved`, rồi FE/App: `/generate-design-spec {prd-file}` (→ design sign-off → BDD); BE: `/generate-bdd {prd-file}`. Còn critical/NEEDS_FIX → sửa PRD (giữ draft) |
|
|
830
|
+
| /generate-design-spec | Designer review → xác nhận link Figma → PO + Designer sign-off → `/generate-bdd {prd-file}` |
|
|
831
|
+
| /generate-bdd | `/review-context {feature-file}` để kiểm tra độ phủ |
|
|
832
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` nếu APPROVED; sinh lại nếu NEEDS_FIX |
|
|
833
|
+
| /qc-analyze | `/qc-plan {UC-ID}` (xử lý các gap blocker 🔴 trước) |
|
|
834
|
+
| /qc-plan | `/qc-design-test {UC-ID}` |
|
|
835
|
+
| /qc-design-test | `/qc-review {UC-ID}` (review test-case) |
|
|
836
|
+
| /qc-review (test-case) | `/qc-run-test {UC-ID}` nếu APPROVED; sửa TC nếu NEEDS_FIX |
|
|
837
|
+
| /qc-run-test | `/qc-report {UC-ID}` rồi `/qc-review {UC-ID}` (review script) |
|
|
838
|
+
| /qc-review (script) | `/qc-report {UC-ID}` rồi tạo PR nếu APPROVED |
|
|
839
|
+
| /qc-report | `/validate-traces {UC-ID}` để làm mới Living Docs (qc_status) |
|
|
840
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
841
|
+
| /review-tech-docs | `/generate-code {feature-file}` nếu APPROVED; sửa doc nếu NEEDS_FIX |
|
|
842
|
+
| /generate-code | Lần gen đầu → `/review-code {UC-ID}`; gen lại → `/dev-gen-test {UC-ID}` |
|
|
843
|
+
| /dev-gen-test | `/dev-run-test {UC-ID}` |
|
|
844
|
+
| /dev-run-test (passing) | `/review-code {UC-ID}` |
|
|
845
|
+
| /dev-run-test (failing) | `/fix-bug {ticket-id}` hoặc `/debug {error}` |
|
|
846
|
+
| /review-code | `/dev-smoke-test {UC-ID}` hoặc tạo PR |
|
|
847
|
+
| /dev-smoke-test | Tạo PR và link tới ticket |
|
|
848
|
+
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; tất cả OK → tạo PR |
|
|
849
|
+
| /fix-bug | Tạo PR và link tới ticket |
|
|
850
|
+
| /debug | `/fix-bug {ticket-id}` nếu cần sửa |
|
|
851
|
+
| /report-bug | Gửi cho dev (`/fix-bug {BUG-ID}`); nếu thiếu coverage → `/propose-scenario {UC-ID}` |
|
|
852
|
+
| /propose-scenario | Báo PO/Dev review proposal trong `feedback/bdd-proposals/` |
|
|
853
|
+
| /learn | Tiếp tục làm việc — lesson áp dụng ở lệnh kế tiếp |
|
|
854
|
+
| /sync | `/validate-traces` để xem độ phủ đầy đủ; xử lý mọi `📥 tester feedback` được nêu |
|
|
855
|
+
| /update-framework | Review `git diff .agent/`, commit; `/sync` để đồng bộ nội dung dự án |
|
|
856
|
+
|
|
857
|
+
Định dạng footer như sau:
|
|
858
|
+
```
|
|
859
|
+
---
|
|
860
|
+
Status : {badge}
|
|
861
|
+
{khối Output Artifacts}
|
|
862
|
+
Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
863
|
+
(lệnh review) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
|
|
864
|
+
Next : {lệnh gợi ý kèm ví dụ tham số}
|
|
865
|
+
```
|
|
866
|
+
*(Bỏ dòng `Pipeline` cho các lệnh xuyên suốt liệt kê ở trên.)*
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
```
|
|
870
|
+
/validate-traces — {domain}
|
|
871
|
+
|
|
872
|
+
📄 {paths.trace_dir}/trace-report.json ← updated
|
|
873
|
+
|
|
874
|
+
┌─────────────────────────────────────────────────────────────────────────────────────┐
|
|
875
|
+
│ PRDs Use Cases Scenarios Code Cov. Test Cov. Drift Untracked Gap │
|
|
876
|
+
│ {N} {N} {N} {N}% {N}% {N} {N} {N} │
|
|
877
|
+
│ {A} appr {A} appr {X}/{T} SCs {X}/{T} SCs │
|
|
878
|
+
└─────────────────────────────────────────────────────────────────────────────────────┘
|
|
879
|
+
{nếu seam_unwired_count > 0 hoặc stub_unresolved_count > 0, in dòng GATE — ngược lại bỏ}
|
|
880
|
+
🔴 GATE — luồng ghép có MỒ CÔI: {seam_unwired_count} SEAM_UNWIRED + {stub_unresolved_count} STUB_UNRESOLVED.
|
|
881
|
+
Build/test từng-UC vẫn xanh nhưng luồng to chạy vào no-op / hàm thật không ai gọi.
|
|
882
|
+
KHÔNG coi là pass tới khi cả hai = 0 (xem Seam & Stub Audit bên dưới).
|
|
883
|
+
|
|
884
|
+
| UC-ID | SC | Title (truncated) | Spec | Gen | Code | Tests | Status |
|
|
885
|
+
|-------------|------|------------------------------|-------|-------|----------------------|----------------|----------|
|
|
886
|
+
| {UC}-UC1 | SC1 | {title...} | v1.0 | v1.0 | ✅ {Controller.fn} | ✅ 10 tests | OK |
|
|
887
|
+
| {UC}-UC1 | SC2 | {title...} | v1.1 | v1.0 | ✅ {Controller.fn} | ✅ 3 tests | DRIFT |
|
|
888
|
+
| {UC}-UC1 | SC6 | {title...} | v1.0 | — | — | — | UNTRACKED|
|
|
889
|
+
| {UC}-UC2 | SC1 | {title...} | v1.0 | v1.0 | ✅ {Controller.fn} | — | GAP |
|
|
890
|
+
|
|
891
|
+
Drift Detail:
|
|
892
|
+
{UC}-UC1-SC2 — spec v1.1 nhưng code sinh từ v1.0
|
|
893
|
+
→ Chạy lại: /generate-code {UC-ID}
|
|
894
|
+
|
|
895
|
+
PRD Version Drift:
|
|
896
|
+
{UC}-UC2 — code ở PRD v1.0, PRD giờ ở v1.2
|
|
897
|
+
Thay đổi kể từ v1.0:
|
|
898
|
+
v1.1: {changelog entry}
|
|
899
|
+
v1.2: {changelog entry}
|
|
900
|
+
→ /generate-bdd {prd-file} then /generate-code {UC-ID}
|
|
901
|
+
|
|
902
|
+
Tech-Doc Revision Drift:
|
|
903
|
+
{UC}-UC3 — code sinh từ tech-doc revision 2, giờ ở revision 4
|
|
904
|
+
→ Review thay đổi tech-doc rồi /generate-code {UC-ID}
|
|
905
|
+
|
|
906
|
+
Seam & Stub Audit (mồ côi khi ghép luồng):
|
|
907
|
+
🔴 SEAM_UNWIRED — {port}: {consumer_uc} còn gọi {stub_class} rỗng,
|
|
908
|
+
hàng thật {real_class} ({owner_uc}) chưa được nối → luồng ghép chạy vào no-op
|
|
909
|
+
→ Trỏ binding {consumer_uc} sang {real_class}, xoá/thay stub, build lại
|
|
910
|
+
ⓘ SEAM_PENDING — {port}: {consumer_uc} đang dùng stub, owner {owner_uc} chưa gen (chưa phải lỗi)
|
|
911
|
+
🔴 STUB_UNRESOLVED — {ClassName#method} ({stub_for}): {consumer_uc} để trắng, owner {owner_uc} đã gen
|
|
912
|
+
{parallel_impl → "đẻ hàm song song " + parallel_impl | ""}→ hàm trắng mồ côi / hàm thật không ai gọi
|
|
913
|
+
→ /generate-code {owner_uc} lấp logic vào {ClassName#method} tại chỗ, xoá hàm song song, build lại
|
|
914
|
+
ⓘ STUB_PENDING — {ClassName#method} ({stub_for}): owner {owner_uc} chưa gen (chưa phải lỗi)
|
|
915
|
+
|
|
916
|
+
Recommendations:
|
|
917
|
+
- /generate-code {UC-ID} cho scenario DRIFT và UNTRACKED
|
|
918
|
+
- /dev-gen-test {UC-ID} cho GAP (thiếu test)
|
|
919
|
+
- /generate-bdd {prd-file} cho PRD version drift
|
|
920
|
+
- Nối binding thủ công cho mỗi SEAM_UNWIRED 🔴 (hàng thật đã có, còn kẹt stub)
|
|
921
|
+
- /generate-code {owner_uc} cho mỗi STUB_UNRESOLVED 🔴 (lấp method trắng tại chỗ + xoá hàm song song)
|
|
922
|
+
|
|
923
|
+
[Chỉ umbrella mode]
|
|
924
|
+
Living Docs canonical → {living_docs_dir}/ (specs module — shared, gitignored)
|
|
925
|
+
Panel mirror → {panel_mirror}/trace-report.json (current workspace)
|
|
926
|
+
Tip: chạy /validate-traces (hoặc /sync) sau mỗi phiên codegen để làm mới panel.
|
|
927
|
+
Cả hai là mirror sinh ra — đừng commit (.living-docs/ + .trace/ trong .gitignore).
|
|
928
|
+
```
|