@manhd_d/ai-harness 0.0.0-stage → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -0
- package/CONTRIBUTING.md +13 -0
- package/LICENSE +21 -0
- package/README.md +70 -2
- package/SECURITY.md +10 -0
- package/adapters/ai-python/adapter.yaml +46 -0
- package/adapters/ai-python/checks/verification.yaml +32 -0
- package/adapters/ai-python/evals/cases.json +25 -0
- package/adapters/ai-python/rules/architecture.md +3 -0
- package/adapters/ai-python/rules/database.md +3 -0
- package/adapters/ai-python/rules/performance.md +3 -0
- package/adapters/ai-python/rules/security.md +3 -0
- package/adapters/ai-python/rules.md +29 -0
- package/adapters/ai-python/skills/harness-ai-python-rag-access/SKILL.md +23 -0
- package/adapters/ai-python/skills/harness-ai-python-tool-safety/SKILL.md +23 -0
- package/adapters/astro/README.md +23 -0
- package/adapters/astro/adapter.yaml +31 -0
- package/adapters/astro/checks/verification.yaml +59 -0
- package/adapters/astro/evals/cases.json +45 -0
- package/adapters/astro/rules/architecture.md +9 -0
- package/adapters/astro/rules/deployment.md +9 -0
- package/adapters/astro/rules/performance.md +8 -0
- package/adapters/astro/rules/security.md +9 -0
- package/adapters/astro/rules.md +17 -0
- package/adapters/astro/skills/harness-astro-cloudflare/SKILL.md +27 -0
- package/adapters/astro/skills/harness-astro-islands/SKILL.md +28 -0
- package/adapters/astro/skills/harness-astro-microfrontend/SKILL.md +27 -0
- package/adapters/astro/skills/harness-astro-performance/SKILL.md +27 -0
- package/adapters/astro/skills/harness-astro-project-architecture/SKILL.md +28 -0
- package/adapters/astro/skills/harness-astro-seo/SKILL.md +28 -0
- package/adapters/java-spring/adapter.yaml +42 -0
- package/adapters/java-spring/checks/verification.yaml +33 -0
- package/adapters/java-spring/evals/cases.json +25 -0
- package/adapters/java-spring/rules/architecture.md +3 -0
- package/adapters/java-spring/rules/database.md +3 -0
- package/adapters/java-spring/rules/performance.md +3 -0
- package/adapters/java-spring/rules/security.md +3 -0
- package/adapters/java-spring/rules.md +34 -0
- package/adapters/java-spring/skills/harness-java-spring-database-migration/SKILL.md +23 -0
- package/adapters/java-spring/skills/harness-java-spring-kafka-outbox/SKILL.md +23 -0
- package/adapters/java-spring/skills/harness-java-spring-spring-api/SKILL.md +23 -0
- package/adapters/kubernetes/adapter.yaml +58 -0
- package/adapters/kubernetes/checks/verification.yaml +63 -0
- package/adapters/kubernetes/evals/cases.json +25 -0
- package/adapters/kubernetes/rules/architecture.md +5 -0
- package/adapters/kubernetes/rules/reliability.md +5 -0
- package/adapters/kubernetes/rules/security.md +5 -0
- package/adapters/kubernetes/rules.md +9 -0
- package/adapters/kubernetes/skills/harness-kubernetes-helm-release/SKILL.md +26 -0
- package/adapters/kubernetes/skills/harness-kubernetes-rollout-safety/SKILL.md +27 -0
- package/adapters/kubernetes/skills/harness-kubernetes-workload-review/SKILL.md +27 -0
- package/adapters/react-native/adapter.yaml +28 -0
- package/adapters/react-native/checks/verification.yaml +30 -0
- package/adapters/react-native/evals/cases.json +25 -0
- package/adapters/react-native/rules/architecture.md +3 -0
- package/adapters/react-native/rules/database.md +3 -0
- package/adapters/react-native/rules/performance.md +3 -0
- package/adapters/react-native/rules/security.md +3 -0
- package/adapters/react-native/rules.md +23 -0
- package/adapters/react-native/skills/harness-react-native-device-permissions/SKILL.md +23 -0
- package/adapters/react-native/skills/harness-react-native-offline-sync/SKILL.md +23 -0
- package/adapters/react-nextjs/adapter.yaml +28 -0
- package/adapters/react-nextjs/checks/verification.yaml +49 -0
- package/adapters/react-nextjs/evals/cases.json +25 -0
- package/adapters/react-nextjs/rules/architecture.md +3 -0
- package/adapters/react-nextjs/rules/database.md +3 -0
- package/adapters/react-nextjs/rules/performance.md +3 -0
- package/adapters/react-nextjs/rules/security.md +3 -0
- package/adapters/react-nextjs/rules.md +27 -0
- package/adapters/react-nextjs/skills/harness-react-nextjs-accessible-ui/SKILL.md +23 -0
- package/adapters/react-nextjs/skills/harness-react-nextjs-server-boundaries/SKILL.md +23 -0
- package/bin/aih.js +4 -0
- package/capabilities/devops/README.md +24 -0
- package/capabilities/devops/capability.json +20 -0
- package/capabilities/devops/checks/verification.json +17 -0
- package/capabilities/devops/evals/cases.json +25 -0
- package/capabilities/devops/skills/harness-devops-ci-cd/SKILL.md +27 -0
- package/capabilities/devops/skills/harness-devops-deployment/SKILL.md +27 -0
- package/capabilities/devops/skills/harness-devops-docker/SKILL.md +25 -0
- package/capabilities/devops/skills/harness-devops-incident-response/SKILL.md +27 -0
- package/capabilities/devops/skills/harness-devops-infrastructure/SKILL.md +28 -0
- package/capabilities/devops/skills/harness-devops-observability/SKILL.md +25 -0
- package/capabilities/devops/workflows/incident-recovery.md +12 -0
- package/capabilities/devops/workflows/pr-to-production.md +16 -0
- package/capabilities/monetization/README.md +40 -0
- package/capabilities/monetization/capability.json +25 -0
- package/capabilities/monetization/checks/verification.json +53 -0
- package/capabilities/monetization/evals/cases.json +45 -0
- package/capabilities/monetization/skills/harness-monetization-ad-placement-ux/SKILL.md +28 -0
- package/capabilities/monetization/skills/harness-monetization-adsense-integration/SKILL.md +29 -0
- package/capabilities/monetization/skills/harness-monetization-analytics-revenue/SKILL.md +28 -0
- package/capabilities/monetization/skills/harness-monetization-publisher-compliance/SKILL.md +28 -0
- package/capabilities/monetization/skills/harness-monetization-seo-growth/SKILL.md +28 -0
- package/capabilities/monetization/templates/ad-placement-review.md +31 -0
- package/capabilities/monetization/templates/analytics-report.md +38 -0
- package/capabilities/monetization/templates/privacy-consent-checklist.md +39 -0
- package/capabilities/monetization/templates/site-monetization-plan.md +46 -0
- package/capabilities/monetization/workflows/site-to-adsense.md +19 -0
- package/capabilities/monetization/workflows/traffic-to-revenue-review.md +14 -0
- package/capabilities/product/README.md +78 -0
- package/capabilities/product/agents/business-analyst.md +15 -0
- package/capabilities/product/agents/product-manager.md +15 -0
- package/capabilities/product/agents/product-owner.md +15 -0
- package/capabilities/product/agents/project-manager.md +15 -0
- package/capabilities/product/agents/requirements-reviewer.md +15 -0
- package/capabilities/product/capability.json +55 -0
- package/capabilities/product/checks/verification.json +41 -0
- package/capabilities/product/evals/cases.json +35 -0
- package/capabilities/product/skills/harness-product-acceptance-criteria/SKILL.md +25 -0
- package/capabilities/product/skills/harness-product-backlog-prioritization/SKILL.md +25 -0
- package/capabilities/product/skills/harness-product-brd-generation/SKILL.md +25 -0
- package/capabilities/product/skills/harness-product-business-analysis/SKILL.md +26 -0
- package/capabilities/product/skills/harness-product-document-review/SKILL.md +26 -0
- package/capabilities/product/skills/harness-product-idea-discovery/SKILL.md +27 -0
- package/capabilities/product/skills/harness-product-knowledge-analysis/SKILL.md +28 -0
- package/capabilities/product/skills/harness-product-prd-generation/SKILL.md +26 -0
- package/capabilities/product/skills/harness-product-product-research/SKILL.md +27 -0
- package/capabilities/product/skills/harness-product-srs-generation/SKILL.md +28 -0
- package/capabilities/product/skills/harness-product-traceability/SKILL.md +24 -0
- package/capabilities/product/skills/harness-product-use-case-generation/SKILL.md +26 -0
- package/capabilities/product/skills/harness-product-user-stories/SKILL.md +25 -0
- package/capabilities/product/templates/acceptance-criteria.md +27 -0
- package/capabilities/product/templates/backlog.md +23 -0
- package/capabilities/product/templates/brd.md +43 -0
- package/capabilities/product/templates/business-rules.md +27 -0
- package/capabilities/product/templates/decision-log.md +7 -0
- package/capabilities/product/templates/delivery-plan.md +18 -0
- package/capabilities/product/templates/idea.md +38 -0
- package/capabilities/product/templates/prd-lite.md +39 -0
- package/capabilities/product/templates/prd.md +36 -0
- package/capabilities/product/templates/product-brief.md +27 -0
- package/capabilities/product/templates/research.md +31 -0
- package/capabilities/product/templates/review-report.md +26 -0
- package/capabilities/product/templates/source-register.md +19 -0
- package/capabilities/product/templates/srs.md +46 -0
- package/capabilities/product/templates/traceability.md +23 -0
- package/capabilities/product/templates/use-cases.md +34 -0
- package/capabilities/product/workflows/change-impact-analysis.md +15 -0
- package/capabilities/product/workflows/confluence-to-spec.md +21 -0
- package/capabilities/product/workflows/document-driven.md +13 -0
- package/capabilities/product/workflows/idea-driven.md +13 -0
- package/capabilities/product/workflows/idea-to-prd.md +20 -0
- package/capabilities/uiux/README.md +21 -0
- package/capabilities/uiux/capability.json +23 -0
- package/capabilities/uiux/checks/verification.json +17 -0
- package/capabilities/uiux/design-system/tokens.example.json +21 -0
- package/capabilities/uiux/evals/cases.json +15 -0
- package/capabilities/uiux/integrations/confluence.md +10 -0
- package/capabilities/uiux/integrations/figma.md +10 -0
- package/capabilities/uiux/skills/harness-uiux-design-review/SKILL.md +24 -0
- package/capabilities/uiux/skills/harness-uiux-design-system/SKILL.md +24 -0
- package/capabilities/uiux/skills/harness-uiux-figma-design/SKILL.md +26 -0
- package/capabilities/uiux/skills/harness-uiux-requirements-analysis/SKILL.md +26 -0
- package/capabilities/uiux/skills/harness-uiux-screen-planning/SKILL.md +24 -0
- package/capabilities/uiux/skills/harness-uiux-user-flow/SKILL.md +25 -0
- package/capabilities/uiux/templates/requirements.md +7 -0
- package/capabilities/uiux/templates/screen-spec.md +15 -0
- package/capabilities/uiux/workflows/docs-to-figma.md +22 -0
- package/capabilities/uiux/workflows/idea-to-figma.md +11 -0
- package/cli/adapter-schema.js +42 -0
- package/cli/adapters.js +149 -0
- package/cli/capabilities.js +93 -0
- package/cli/composition.js +96 -0
- package/cli/evaluation-contract.js +40 -0
- package/cli/files.js +125 -0
- package/cli/harness.js +255 -0
- package/cli/main.js +119 -0
- package/cli/module-contract.js +29 -0
- package/core/agents/implementer.md +16 -0
- package/core/agents/planner.md +16 -0
- package/core/agents/reviewer.md +16 -0
- package/core/agents/security-reviewer.md +16 -0
- package/core/agents/test-engineer.md +16 -0
- package/core/checks/verification.json +28 -0
- package/core/evals/cases.json +25 -0
- package/core/evals/composition.json +33 -0
- package/core/policies/permissions.md +17 -0
- package/core/policies/security.md +15 -0
- package/core/rules/context.md +15 -0
- package/core/rules/foundations.md +24 -0
- package/core/skills/harness-ai-evaluation/SKILL.md +21 -0
- package/core/skills/harness-debugging/SKILL.md +20 -0
- package/core/skills/harness-review/SKILL.md +20 -0
- package/core/skills/harness-spec/SKILL.md +21 -0
- package/core/skills/harness-tdd/SKILL.md +20 -0
- package/core/workflows/bugfix.md +9 -0
- package/core/workflows/spec-to-code.md +19 -0
- package/core/workflows/upgrade.md +10 -0
- package/docs/adapters.md +83 -0
- package/docs/agent-handoffs.md +79 -0
- package/docs/architecture.md +107 -0
- package/docs/cli.md +109 -0
- package/docs/documentation-workflows.md +71 -0
- package/docs/end-to-end-workflow.md +116 -0
- package/docs/examples/ai-rag-service.md +60 -0
- package/docs/examples/astro-adsense-microtools.md +80 -0
- package/docs/examples/astro-micro-tools.md +125 -0
- package/docs/examples/document-driven-project.md +62 -0
- package/docs/examples/fullstack-web.md +80 -0
- package/docs/examples/idea-driven-project.md +71 -0
- package/docs/examples/react-native-app.md +57 -0
- package/docs/examples/spring-boot-api.md +100 -0
- package/docs/getting-started.md +100 -0
- package/docs/monetization.md +53 -0
- package/docs/npm-release.md +57 -0
- package/docs/openspec.md +23 -0
- package/docs/pull-request.md +37 -0
- package/docs/reference-analysis.md +22 -0
- package/docs/release-policy.md +17 -0
- package/docs/skill-matrix.md +134 -0
- package/docs/verification.md +20 -0
- package/docs/versioning.md +96 -0
- package/evals/README.md +45 -0
- package/evals/cases.json +41 -0
- package/harness.yaml +24 -0
- package/integrations/confluence/README.md +31 -0
- package/integrations/github/README.md +17 -0
- package/integrations/github/pull_request_template.md +22 -0
- package/integrations/gitlab/README.md +9 -0
- package/integrations/gitlab/harness-ci.yml +10 -0
- package/integrations/mcp/README.md +16 -0
- package/integrations/mcp/server-inventory.example.json +16 -0
- package/package.json +42 -4
- package/scripts/score-eval.js +40 -0
- package/templates/AGENTS.md +18 -0
- package/templates/openspec/.openspec.yaml +1 -0
- package/templates/openspec/config.yaml +14 -0
- package/templates/openspec/design.md +14 -0
- package/templates/openspec/proposal.md +19 -0
- package/templates/openspec/spec.md +8 -0
- package/templates/openspec/tasks.md +11 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Walkthrough — Astro micro-tools, SEO, React Islands and future MFE
|
|
2
|
+
|
|
3
|
+
**Tình huống:** bạn muốn xây website gồm nhiều công cụ nhỏ như QR generator, JSON formatter, image compressor và có thể thêm các tool phức tạp hơn. Mục tiêu là deploy nhẹ, SEO tốt và có đường nâng cấp lên MFE *nếu thực sự cần*, không phải triển khai micro frontend từ ngày đầu.
|
|
4
|
+
|
|
5
|
+
## 1. Chuẩn bị Astro project
|
|
6
|
+
|
|
7
|
+
Cần Node.js 22+, Git, một repo Astro đã tạo hoặc đã checkout và `aih` CLI bản nguồn chứa Astro adapter. Nếu chưa có Astro repo, tạo bằng **Astro CLI chính thức** rồi chọn TypeScript theo nhu cầu; lệnh sau là ví dụ tương tác, phải kiểm tra phiên bản hướng dẫn hiện hành:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create astro@latest
|
|
11
|
+
cd /path/to/astro-project
|
|
12
|
+
# Nếu sử dụng React islands, cài @astrojs/react theo tài liệu Astro
|
|
13
|
+
# npx astro add react
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Không cần React để viết đa số tool cơ bản. `aih` là bộ hướng dẫn AI, **không** tạo Astro source code và không cài các dependencies này.
|
|
17
|
+
|
|
18
|
+
## 2. Cài Harness vào repo
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
aih resolve --adapters astro --capabilities product,uiux
|
|
22
|
+
aih init --adapters astro --capabilities product,uiux --dry-run
|
|
23
|
+
aih init --adapters astro --capabilities product,uiux
|
|
24
|
+
aih check
|
|
25
|
+
aih skills
|
|
26
|
+
aih skill harness-astro-project-architecture
|
|
27
|
+
aih skill harness-astro-seo
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`product,uiux` đều **tùy chọn**; dự án chỉ cần Core + Astro có thể dùng `aih init --adapters astro`. Trong repo *đã cài Harness*, chỉnh `.harness/project.json` để thêm `astro`, sau đó `aih update --dry-run`, `aih update`, `aih check`. Không chạy lại init với cấu hình khác khi có file snapshot.
|
|
31
|
+
|
|
32
|
+
Để thử detector an toàn:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
aih detect
|
|
36
|
+
aih init --detect --dry-run
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Detector chỉ đọc dependencies của `package.json` ngay trong thư mục hiện tại. `astro` được nhận diện từ dependency tên `astro`; `react-dom` do React islands **không tự động** khiến detector thêm `react-nextjs` nếu không có `next`. Nếu app dùng `next` thật hoặc muốn đồng thời cài cả hai adapter, có thể chọn thủ công.
|
|
40
|
+
|
|
41
|
+
## 3. Tổ chức tools kiểu static-first
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
src/
|
|
45
|
+
layouts/
|
|
46
|
+
ToolLayout.astro
|
|
47
|
+
pages/
|
|
48
|
+
index.astro
|
|
49
|
+
tools/
|
|
50
|
+
qr-generator.astro
|
|
51
|
+
json-formatter.astro
|
|
52
|
+
image-compressor.astro
|
|
53
|
+
components/
|
|
54
|
+
ImageEditor.tsx # chỉ khi có React thực sự cần thiết
|
|
55
|
+
lib/
|
|
56
|
+
qr/
|
|
57
|
+
validation.ts
|
|
58
|
+
encode.ts
|
|
59
|
+
image/
|
|
60
|
+
transform.ts
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Một công cụ đơn giản nên chạy ngay trên trình duyệt, không gửi dữ liệu riêng tư lên server. Đặt validation và functions riêng, tránh tool này import trạng thái tool khác. Các API có quyền/secret mới cần Worker/server xử lý theo authorization rõ ràng.
|
|
64
|
+
|
|
65
|
+
Prompt ví dụ trong Codex/IDE/Work đã được cấp quyền repo:
|
|
66
|
+
|
|
67
|
+
> Đọc AGENTS.md và skill harness-astro-project-architecture + harness-astro-seo. Tôi muốn làm 3 tools: QR generator, JSON formatter và image compressor. Lập kế hoạch UI, route và ưu tiên xử lý dữ liệu ngay trên trình duyệt. Kiểm tra scripts/dependencies trước khi sửa, không tự cài backend, database, auth hay React. Tạo vertical slice cho QR generator với validation, trạng thái lỗi và accessible keyboard labels. Sau khi tôi duyệt spec, triển khai và chạy các test/build scripts thực có. Trả về diff và kết quả thực tế, không tự deploy.
|
|
68
|
+
|
|
69
|
+
## 4. Thêm React Islands khi cần
|
|
70
|
+
|
|
71
|
+
Chỉ hydrate React cho phần có tương tác đủ phức tạp. Nếu đã cài `@astrojs/react` phù hợp, ví dụ nhúng React component vào Astro page:
|
|
72
|
+
|
|
73
|
+
```astro
|
|
74
|
+
---
|
|
75
|
+
import ImageEditor from '../../components/ImageEditor.tsx';
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
<h1>Image Editor</h1>
|
|
79
|
+
<ImageEditor client:visible />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Chọn `client:load` nếu cần tương tác ngay ở phần đầu trang, `client:visible` khi tool nằm dưới fold; kiểm tra timing/hydration trong browser. Đừng nhúng React cho toàn bộ landing page chỉ để có một nút.
|
|
83
|
+
|
|
84
|
+
**Islands không phải MFE.** Hiện tại tất cả trang và island của Astro project vẫn build/deploy cùng nhau.
|
|
85
|
+
|
|
86
|
+
## 5. Cloudflare và deployment
|
|
87
|
+
|
|
88
|
+
- Với các tool hoàn toàn chạy trong browser: build Astro ra static files, phục vụ từ CDN/host hỗ trợ static; **không cần Cloudflare Workers** chỉ để chạy website.
|
|
89
|
+
- Nếu cần API dùng secrets, xử lý server hoặc điều phối dữ liệu được phép truy cập: đánh giá Cloudflare Workers và adapter/runtime theo **phiên bản Astro hiện dùng**. Với dự án mới, kiểm tra tài liệu Cloudflare Workers chính thức trước khi chọn thiết lập.
|
|
90
|
+
- Không để private keys trong `PUBLIC_*` biến môi trường hoặc phía frontend. Nếu tính năng fetch URL của người dùng, phải xét SSRF, redirect, private IP, quotas và quyền nội dung; không triển khai arbitrary URL proxy thiếu kiểm soát.
|
|
91
|
+
- `aih verify` chỉ đưa ra checklist, không chạy build. Chỉ chạy các lệnh **thực có trong package.json**, ví dụ `npm run build`, `npm run check` nếu có, cùng browser UX tests. Con người duyệt trước bất kỳ cloud deployment/DNS thay đổi nào.
|
|
92
|
+
|
|
93
|
+
## 6. Scale lên Micro Frontend khi cần
|
|
94
|
+
|
|
95
|
+
**Giai đoạn 1:** một Astro repository, các route/tool độc lập.
|
|
96
|
+
|
|
97
|
+
**Giai đoạn 2:** các React Islands hoặc shared UI packages được phép dùng, vẫn trong một build/deploy. Có thể dùng monorepo khi cần quản lý code dùng chung, nhưng chưa phải MFE.
|
|
98
|
+
|
|
99
|
+
**Giai đoạn 3:** khi một tool cần team, release cadence hoặc runtime riêng, tách **một route** (ví dụ `/tools/image-editor`) ra ứng dụng deploy riêng qua routing/proxy phù hợp. Kiểm tra domain, deep links, assets, CSP/cookies/auth, analytics, SEO/canonicals, lỗi và rollback trước cut-over. Không mặc định Module Federation.
|
|
100
|
+
|
|
101
|
+
Prompt ra quyết định:
|
|
102
|
+
|
|
103
|
+
> Dựa vào docs, ownership và deploy hiện tại, đánh giá tách image-editor thành MFE hay giữ Astro Island. So sánh khả năng deploy độc lập, SEO, routing, caching, cookie/auth, bundle và chi phí vận hành. Chỉ đề xuất kiến trúc sau khi có nhu cầu thực; ghi ADR/approval và migration steps, chưa tự triển khai.
|
|
104
|
+
|
|
105
|
+
## Optional: AdSense revenue model
|
|
106
|
+
|
|
107
|
+
Nếu mục tiêu website là quảng cáo, có thể cài capability `monetization` bên cạnh adapter Astro. Dự án đã cài hãy cập nhật `.harness/project.json` và dùng `aih update` sau khi review. Đọc [Astro + AdSense walkthrough](astro-adsense-microtools.md) để phân biệt build tool với publisher compliance, đặt quảng cáo tránh Generate/Download và đo Page RPM. `aih` không tự nhúng script, tạo ad account hay cam kết doanh thu.
|
|
108
|
+
|
|
109
|
+
## 7. Test và PR review
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
aih verify --scope all # advisory, không thực thi test
|
|
113
|
+
aih eval --scope all # dataset/review template, không gọi model
|
|
114
|
+
aih check
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Dùng Core review/TDD và `harness-astro-performance` để ghi bằng chứng build/browser thực chạy, cùng `harness-astro-microfrontend` khi đánh giá split. Hoàn tất spec → code → tests → human PR review. Harness không deploy/merge tự động.
|
|
118
|
+
|
|
119
|
+
## Tài liệu chính thức
|
|
120
|
+
|
|
121
|
+
- [Astro islands và framework components](https://docs.astro.build/en/guides/framework-components/)
|
|
122
|
+
- [Astro + Cloudflare deployment](https://docs.astro.build/en/guides/deploy/cloudflare/)
|
|
123
|
+
- [Astro sitemap integration](https://docs.astro.build/en/guides/integrations-guide/sitemap/)
|
|
124
|
+
- [Astro adapter](../../adapters/astro/README.md)
|
|
125
|
+
- [Full SDLC](../end-to-end-workflow.md)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Walkthrough B — dự án đã có tài liệu BA/Confluence → OpenSpec → code
|
|
2
|
+
|
|
3
|
+
Dùng chế độ **Document-driven** cho dự án doanh nghiệp hoặc bất kỳ codebase nào đã có BRD/PRD/SRS/Confluence/Jira. Tài liệu gốc tiếp tục do hệ thống/chủ sở hữu hiện tại quản lý; AI **không cần tạo lại BRD hay PRD** chỉ để code.
|
|
4
|
+
|
|
5
|
+
## 1. Cài Harness trong repository hiện có
|
|
6
|
+
|
|
7
|
+
Ví dụ một backend Spring Boot đã được checkout. Cần Node.js 22+, Git và `aih` đã cài từ bản nguồn được review.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd /path/to/existing-spring-project
|
|
11
|
+
git switch -c feat/customer-search
|
|
12
|
+
aih init --adapters java-spring --capabilities product --dry-run
|
|
13
|
+
aih init --adapters java-spring --capabilities product
|
|
14
|
+
aih check
|
|
15
|
+
aih skills
|
|
16
|
+
aih skill harness-product-knowledge-analysis
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Nếu repository **đã cài** Harness, chỉnh `.harness/project.json` nếu cần thêm capability rồi `aih update --dry-run`, `aih update`, `aih check`. Không thực hiện init chồng lên bộ cài do dự án đã quản lý.
|
|
20
|
+
|
|
21
|
+
## 2. Cung cấp tài liệu có quyền truy cập
|
|
22
|
+
|
|
23
|
+
Chia sẻ **đường dẫn/trang được cấp phép** (Confluence, Git files) hoặc export được phép. Agent phải ghi ID trang, URL, revision, owner, phạm vi quyền và approval status; không suy diễn rằng mọi trang đều mới nhất hoặc đã được duyệt.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
aih new-doc source-register
|
|
27
|
+
aih new-doc traceability
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Prompt dùng với AI host có quyền đọc project và nguồn:
|
|
31
|
+
|
|
32
|
+
> Đọc AGENTS.md, Product workflow document-driven và các tài liệu BA tôi cho phép. Tác vụ: triển khai tìm kiếm khách hàng có phân quyền. Đầu tiên xác định BRD/PRD/SRS nào là nguồn chuẩn, ghi source IDs, URL và phiên bản trong docs/product/source-register.md. Liệt kê FR/NFR/US/AC liên quan, kiểm tra mâu thuẫn và thông tin còn thiếu. Không bịa nội dung chưa đọc được, không viết lại tài liệu BA đã approved. Hoàn thiện traceability draft và đưa tôi review trước khi tạo technical spec.
|
|
33
|
+
|
|
34
|
+
Nếu Confluence chưa kết nối trong AI host, agent phải báo là **không thể đọc**, yêu cầu export/phạm vi được phép; `aih` không tự truy cập Confluence.
|
|
35
|
+
|
|
36
|
+
## 3. Gap analysis và phê duyệt
|
|
37
|
+
|
|
38
|
+
- Tài liệu BA có sẵn và hợp lệ: chỉ tạo `source-register`, `traceability`, decision log hoặc các artifact thiếu.
|
|
39
|
+
- SRS chưa có hoặc thiếu chi tiết thực sự: có thể chạy `aih new-doc srs` và `aih new-doc use-cases`, nhờ AI điền **draft** từ những requirement đã xác nhận.
|
|
40
|
+
- Có source conflict, thiếu AC hoặc yêu cầu chưa rõ: AI ghi UNKNOWN và chờ BA/PO hoặc chủ dự án có quyền quyết định; không tự gắn nhãn approved.
|
|
41
|
+
|
|
42
|
+
## 4. Tạo OpenSpec từ phạm vi đã duyệt
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
aih new-change customer-search
|
|
46
|
+
# Điền TODO trong openspec/changes/customer-search/ rồi review.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Prompt handoff:
|
|
50
|
+
|
|
51
|
+
> Dựa vào các requirement IDs đã approved và source revisions trong docs/product/traceability.md, dùng core harness-spec và skill adapter java-spring phù hợp để lập proposal/design/tasks/spec cho customer-search. Chỉ mô tả hành vi có bằng chứng, test cases gồm authorization deny-other-tenant, input validation, no-result/error cases nếu phù hợp với yêu cầu nguồn. Đánh dấu NFR còn thiếu; không tự duyệt. Sau khi tôi chốt spec, implement trên branch hiện tại, chạy test thực tế, tạo PR để review và không tự merge/deploy.
|
|
52
|
+
|
|
53
|
+
Nếu dùng OpenSpec upstream thì pin và cài CLI riêng, sau đó có thể chạy `openspec validate customer-search --strict` khi bản nháp đã hoàn thiện.
|
|
54
|
+
|
|
55
|
+
## 5. Lưu trữ và bảo mật
|
|
56
|
+
|
|
57
|
+
- Tài liệu BA chính thức vẫn ở Confluence/Drive/repo được chỉ định; trong repository kỹ thuật giữ URL/revision và những tài liệu dẫn xuất được phép lưu.
|
|
58
|
+
- `docs/product/` chứa traceability, source register và các bản draft phục vụ dự án; `openspec/` chứa technical spec và change liên kết FR/US/AC.
|
|
59
|
+
- Không đưa tài liệu khách hàng mật, secrets hoặc export nguyên bản vào repo không được phép. Không publish Confluence hay sửa PRD gốc nếu chưa được phê duyệt.
|
|
60
|
+
- Khi tài liệu BA đổi revision, dùng change-impact analysis và review delta thay vì ghi đè code/spec.
|
|
61
|
+
|
|
62
|
+
**Giới hạn:** skills và role contracts không tự biến thành agent runtime; CI/test/OpenSpec validation thực tế phải do host/IDE và công cụ liên quan chạy, có kết quả kiểm chứng.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Walkthrough 2 — Full-stack Spring Boot + Next.js + Product + Figma
|
|
2
|
+
|
|
3
|
+
**Tình huống giả định:** xây hành trình tạo ticket (backend Spring Boot + frontend Next.js) trong **một repo chứa cả hai module**, bắt đầu từ product idea hoặc Confluence. Đây là runbook minh họa; không có ứng dụng nào được tạo tự động.
|
|
4
|
+
|
|
5
|
+
## 1. Chọn modules cho repo
|
|
6
|
+
|
|
7
|
+
~~~bash
|
|
8
|
+
cd /path/to/existing-fullstack-repository
|
|
9
|
+
aih resolve --adapters java-spring,react-nextjs --capabilities product,uiux,devops
|
|
10
|
+
aih init --adapters java-spring,react-nextjs --capabilities product,uiux,devops --dry-run
|
|
11
|
+
aih init --adapters java-spring,react-nextjs --capabilities product,uiux,devops
|
|
12
|
+
aih check
|
|
13
|
+
aih skills
|
|
14
|
+
~~~
|
|
15
|
+
|
|
16
|
+
Chỉ thêm `kubernetes` nếu repo cũng sở hữu manifest/chart. Nếu backend/frontend nằm **hai Git repository** độc lập, cài `aih` riêng từng repo theo stack tương ứng, liên kết hai PR bằng cùng change ID; không cố ép cả hai vào một Git root. `aih detect` không quét lồng `apps/web` / `services/api`.
|
|
17
|
+
|
|
18
|
+
## 2. Product discovery và gate
|
|
19
|
+
|
|
20
|
+
~~~bash
|
|
21
|
+
aih new-doc brd
|
|
22
|
+
aih new-doc prd
|
|
23
|
+
aih new-doc backlog
|
|
24
|
+
aih new-doc acceptance-criteria
|
|
25
|
+
aih new-doc traceability
|
|
26
|
+
aih skill harness-product-knowledge-analysis
|
|
27
|
+
aih skill harness-product-brd-generation
|
|
28
|
+
aih skill harness-product-user-stories
|
|
29
|
+
aih skill harness-product-document-review
|
|
30
|
+
~~~
|
|
31
|
+
|
|
32
|
+
BA xác nhận nguồn/timestamps; PM chốt mục tiêu, PO duyệt `US-001`/`AC-US-001-01`; requirements reviewer kiểm tra truy vết. Confluence là **nguồn dữ liệu**, không cấp quyền tự động. Các draft chưa phê duyệt không được tự đánh dấu Approved.
|
|
33
|
+
|
|
34
|
+
## 3. UI/UX & design gate
|
|
35
|
+
|
|
36
|
+
~~~bash
|
|
37
|
+
aih skill harness-uiux-user-flow
|
|
38
|
+
aih skill harness-uiux-screen-planning
|
|
39
|
+
aih skill harness-uiux-design-system
|
|
40
|
+
aih skill harness-uiux-figma-design
|
|
41
|
+
aih skill harness-uiux-design-review
|
|
42
|
+
~~~
|
|
43
|
+
|
|
44
|
+
Từ approved PRD/AC, lập screen inventory (create, success, validation error, permission denial, loading, empty), responsive/keyboard/accessibility states. Nếu UI/UX cần trích nguồn riêng, dùng `harness-uiux-requirements-analysis` nhưng **không tạo lại ID cạnh tranh với Product**.
|
|
45
|
+
|
|
46
|
+
Figma MCP phải được cấu hình ngoài `aih`; **Gate A:** người phụ trách duyệt flow/screen trước quyền ghi Figma; **Gate B:** duyệt review findings và Figma nodes trước implementation. Không có kết nối Figma thì bàn giao screen specs bằng Markdown, không khẳng định đã tạo frames.
|
|
47
|
+
|
|
48
|
+
## 4. Spec → implementation
|
|
49
|
+
|
|
50
|
+
~~~bash
|
|
51
|
+
aih new-change add-ticket-creation
|
|
52
|
+
aih skill harness-spec
|
|
53
|
+
aih skill harness-tdd
|
|
54
|
+
aih skill harness-java-spring-spring-api
|
|
55
|
+
aih skill harness-react-nextjs-accessible-ui
|
|
56
|
+
aih skill harness-react-nextjs-server-boundaries
|
|
57
|
+
~~~
|
|
58
|
+
|
|
59
|
+
Spec phải chứa contract `POST /...` thực tế đã review, authorization, error envelope, loading/empty/errors, client/server boundaries, cache invalidation và contract tests. Implement thành vertical slice API + UI cùng acceptance IDs. Đối với giao diện frontend, kiểm tra SSR/client boundary và tránh đưa credentials ra browser.
|
|
60
|
+
|
|
61
|
+
Ví dụ kiểm tra **chỉ nếu repo có tương ứng**:
|
|
62
|
+
|
|
63
|
+
~~~bash
|
|
64
|
+
# Backend, chạy từ module sở hữu Maven wrapper:
|
|
65
|
+
./mvnw test
|
|
66
|
+
# Frontend, chạy từ module Next.js có script:
|
|
67
|
+
npm test
|
|
68
|
+
npm run build
|
|
69
|
+
~~~
|
|
70
|
+
|
|
71
|
+
Không coi dòng lệnh minh họa là bằng chứng đã chạy. Với multi-repo, mỗi repo có CI, owner và PR riêng.
|
|
72
|
+
|
|
73
|
+
## 5. PR → release & feedback
|
|
74
|
+
|
|
75
|
+
- Review dùng `harness-review`, `test-engineer`, `security-reviewer`, trace `AC → API/FE tests → PR` và Figma node IDs.
|
|
76
|
+
- `aih verify --scope all` và `aih eval --scope all` **chỉ trả kế hoạch/dataset**, không tự chạy tests.
|
|
77
|
+
- `harness-devops-ci-cd` + `harness-devops-deployment` cung cấp rollout/rollback plan, `harness-devops-observability` chỉ rõ SLI/SLO/alert.
|
|
78
|
+
- Staging/production cần phê duyệt environment và artifact riêng; user hoặc operator quyết định merge/deploy.
|
|
79
|
+
|
|
80
|
+
**Deliverables:** approved PRD/AC → user-flow/screen-spec/Figma reference → OpenSpec change → backend + frontend diff/tests → reviewed PR(s) → telemetry evidence.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Walkthrough A — từ ý tưởng của developer tới tài liệu và code
|
|
2
|
+
|
|
3
|
+
Đây là **ví dụ thực hành** của chế độ **Idea-driven**, không gắn với một dự án CRM hay công nghệ cụ thể. `aih` chỉ cài hướng dẫn/skills và tạo **template trống**; AI host như Codex, IDE assistant hoặc ChatGPT Work có quyền repo mới có thể phân tích và ghi nội dung. Trong Chat thông thường, bạn vẫn có thể thảo luận ý tưởng, nhưng việc ghi file cần công cụ và quyền truy cập phù hợp.
|
|
4
|
+
|
|
5
|
+
## 1. Chuẩn bị dự án và cài Harness
|
|
6
|
+
|
|
7
|
+
Yêu cầu: Node.js 22+, Git, CLI `aih` đã cài từ bản nguồn được review, và một thư mục dự án tồn tại. Xem [Getting started](../getting-started.md) để cài CLI từ source; bản tính năng này nằm trong PR cho tới khi merge.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
mkdir expense-app
|
|
11
|
+
cd expense-app
|
|
12
|
+
git init
|
|
13
|
+
aih init --capabilities product
|
|
14
|
+
aih new-doc idea
|
|
15
|
+
aih new-doc decision-log
|
|
16
|
+
aih check
|
|
17
|
+
aih skills
|
|
18
|
+
aih skill harness-product-idea-discovery
|
|
19
|
+
aih skill harness-product-product-research
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Nếu dự án đã cài Harness, sửa `.harness/project.json` để thêm `product` vào `capabilities`, rồi dùng `aih update --dry-run && aih update && aih check` trên branch riêng; **không** chạy lại init với lựa chọn không tương thích.
|
|
23
|
+
|
|
24
|
+
## 2. Giao AI thảo luận thay vì bắt đầu code
|
|
25
|
+
|
|
26
|
+
Dán prompt này vào AI host có quyền đọc repository (hoặc thảo luận trước trong Chat):
|
|
27
|
+
|
|
28
|
+
> Đọc AGENTS.md và skill harness-product-idea-discovery đã cài. Ý tưởng ban đầu của tôi: “Ứng dụng quản lý chi tiêu cá nhân cho phép nhập giao dịch, AI đề xuất phân loại, có báo cáo theo tháng”. Hãy giữ nguyên ý tưởng gốc, đóng vai BA/PM/PO và thảo luận từng nhóm vấn đề quan trọng với tôi. Đề xuất user personas, MVP, non-goals và trade-off; không tự cho rằng các đề xuất là quyết định của tôi. Phân biệt FACT / INFERENCE / DECISION / UNKNOWN. Chưa code hay tự duyệt scope.
|
|
29
|
+
|
|
30
|
+
Sau mỗi vòng thảo luận, AI host cập nhật các file đã tạo trước đó: `docs/discovery/idea.md` và `docs/product/decision-log.md` (nếu được cấp quyền). Bạn là người chốt mục tiêu và MVP, không cần có BA/PM/PO riêng cho dự án cá nhân.
|
|
31
|
+
|
|
32
|
+
## 3. Tạo draft tài liệu có cấu trúc
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
aih new-doc research
|
|
36
|
+
aih new-doc prd-lite
|
|
37
|
+
aih new-doc acceptance-criteria
|
|
38
|
+
aih new-doc traceability
|
|
39
|
+
aih check
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`idea.md` và `decision-log.md` đã tạo tại bước 1; không chạy lại. Các lệnh chỉ chạy **một lần trên mỗi file** và sẽ từ chối ghi đè. Khi đã có file, AI host điền nội dung vào đúng file dựa trên thảo luận, không chạy lại `new-doc`.
|
|
43
|
+
|
|
44
|
+
Prompt mẫu:
|
|
45
|
+
|
|
46
|
+
> Đọc AGENTS.md và skill harness-product-product-research đã cài. Nếu có công cụ web được cấp phép, hãy tìm các sản phẩm tương tự và ghi nguồn, ngày kiểm tra, điểm mạnh/yếu vào docs/discovery/research.md; nếu không có công cụ thì đánh dấu chưa nghiên cứu, không bịa nguồn. Từ các quyết định tôi đã duyệt, hoàn thiện docs/product/prd-lite.md, acceptance-criteria.md và traceability.md. Chỉ ghi draft/pending-review đối với thông tin chưa phê duyệt, rồi gửi diff để tôi review.
|
|
47
|
+
|
|
48
|
+
Khi cần chi tiết hơn (đa actor, nghiệp vụ phức tạp, nhiều tích hợp), tạo thêm `aih new-doc brd`, `aih new-doc prd`, `aih new-doc srs`, `aih new-doc use-cases` theo **mức độ cần thiết**, không bắt mọi dự án phải có tất cả.
|
|
49
|
+
|
|
50
|
+
## 4. Human approval và OpenSpec
|
|
51
|
+
|
|
52
|
+
Sau khi duyệt scope, cập nhật trạng thái/decision record thật của owner. Chỉ khi requirements và AC cho một thay đổi đã được duyệt, mới chuyển sang OpenSpec:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
aih new-change add-expense-categorization
|
|
56
|
+
# Chỉ là các file proposal/design/tasks/spec dạng TODO, chưa được phê duyệt.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Prompt handoff:
|
|
60
|
+
|
|
61
|
+
> Đọc approved scope trong docs/product/ và requirement IDs; dùng core harness-spec để hoàn thiện openspec/changes/add-expense-categorization/, bao gồm test scenarios, rủi ro bảo mật dữ liệu, xử lý lỗi và những điểm còn thiếu. Không tự triển khai nếu scope chưa được duyệt. Sau khi tôi review, dùng adapter phù hợp để implement/test và tạo PR, không tự merge.
|
|
62
|
+
|
|
63
|
+
Nếu dùng OpenSpec upstream, cài/pin CLI riêng và chạy `openspec validate add-expense-categorization --strict` sau khi điền nội dung. Harness không tự cài hay chạy OpenSpec CLI.
|
|
64
|
+
|
|
65
|
+
## 5. Lưu trữ và thay đổi về sau
|
|
66
|
+
|
|
67
|
+
- `docs/discovery/` lưu ý tưởng và research đã ghi nguồn; `docs/product/` lưu tài liệu yêu cầu của **project**, không lưu trong source `ai-harness`.
|
|
68
|
+
- `openspec/` lưu technical change và trace ID. Review tài liệu, code và CI trên PR, sau đó con người quyết định merge.
|
|
69
|
+
- Khi ý tưởng thay đổi, dùng `workflows/change-impact-analysis.md` và yêu cầu AI tạo diff; không tự ghi đè tài liệu approved.
|
|
70
|
+
|
|
71
|
+
**Giới hạn:** `aih verify --scope all` / `aih eval --scope all` chỉ cho checklist/eval advisory; không chứng minh đã thực sự chạy test, nghiên cứu hoặc review.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Walkthrough 3 — React Native/Expo: permission, offline và release
|
|
2
|
+
|
|
3
|
+
**Tình huống giả định:** thêm màn hình lưu nháp khi offline và đồng bộ lại khi có mạng trong ứng dụng React Native/Expo đã tồn tại. Đây là hướng dẫn công việc, **không** scaffold app, không dùng Kubernetes cho ứng dụng di động.
|
|
4
|
+
|
|
5
|
+
## 1. Init
|
|
6
|
+
|
|
7
|
+
~~~bash
|
|
8
|
+
cd /path/to/existing-react-native-app
|
|
9
|
+
aih resolve --adapters react-native --capabilities product,uiux
|
|
10
|
+
aih init --adapters react-native --capabilities product,uiux --dry-run
|
|
11
|
+
aih init --adapters react-native --capabilities product,uiux
|
|
12
|
+
aih check
|
|
13
|
+
aih skills
|
|
14
|
+
~~~
|
|
15
|
+
|
|
16
|
+
Nếu chỉ sửa một lỗi offline đã có ticket/AC duyệt, có thể bỏ Product và UI/UX không cần thiết, giữ Core + React Native. `aih detect` có thể nhận React Native/Expo tại thư mục target chứa `package.json`, không tự quét monorepo.
|
|
17
|
+
|
|
18
|
+
## 2. Requirements & UX
|
|
19
|
+
|
|
20
|
+
- BA/PO mô tả business rule: trạng thái draft, server authoritative fields, replay/dedupe, login/logout giữa chừng, đa thiết bị, mất mạng và dữ liệu nhạy cảm.
|
|
21
|
+
- Tạo draft Product theo [getting started](../getting-started.md); duyệt story/AC trước khi design.
|
|
22
|
+
- `harness-uiux-user-flow` và `harness-uiux-screen-planning` mô tả offline banner, pending queue, syncing, conflict, retry, auth expired và error accessibility.
|
|
23
|
+
- Figma chỉ ghi khi có MCP quyền hợp lệ và gate. Khi không có Figma, Markdown screen specs vẫn là bàn giao hợp lệ.
|
|
24
|
+
|
|
25
|
+
## 3. Spec và code
|
|
26
|
+
|
|
27
|
+
~~~bash
|
|
28
|
+
aih new-change offline-draft-sync
|
|
29
|
+
aih skill harness-spec
|
|
30
|
+
aih skill harness-tdd
|
|
31
|
+
aih skill harness-react-native-offline-sync
|
|
32
|
+
aih skill harness-react-native-device-permissions
|
|
33
|
+
~~~
|
|
34
|
+
|
|
35
|
+
- `offline-sync`: định nghĩa local persistence encryption/retention, idempotency key, queue/retry backoff, conflict resolution và đồng bộ lại khi token hết hạn.
|
|
36
|
+
- `device-permissions`: chỉ cần nếu feature có camera/location/notification/deep link; kiểm tra iOS và Android riêng, fallback khi từ chối permission.
|
|
37
|
+
- Spec chứa test matrix: airplane mode, offline restart, duplicate request, conflict, revoke session, low storage và app update.
|
|
38
|
+
- Không log token/customer payload, không giả định AsyncStorage/SecureStore đã được chọn; dùng stack đang có.
|
|
39
|
+
|
|
40
|
+
**Verification** — tùy project scripts/toolchain, không được Harness thực thi:
|
|
41
|
+
|
|
42
|
+
~~~bash
|
|
43
|
+
# Chỉ chạy sau khi xác nhận có scripts tương ứng trong package.json
|
|
44
|
+
npm test
|
|
45
|
+
# Expo / device build và kiểm thử emulator/thiết bị cần setup riêng
|
|
46
|
+
~~~
|
|
47
|
+
|
|
48
|
+
Ngoài unit tests, report thiết bị/OS và test thật trên iOS/Android, permissions denied, offline transitions và accessibility evidence.
|
|
49
|
+
|
|
50
|
+
## 4. PR và phát hành
|
|
51
|
+
|
|
52
|
+
- `harness-review` và `security-reviewer` kiểm tra mã hóa/scope lưu local, auth và routing.
|
|
53
|
+
- `aih verify --scope all` chỉ tạo checklist; đính kèm kết quả build/device tests thực chạy.
|
|
54
|
+
- Nếu dùng `devops`, đây là **release planning** chung, không phải auto publish App Store/Play Store. Approval theo signing credentials/store policy nằm ngoài `aih`.
|
|
55
|
+
- Nếu app phụ thuộc backend API, xác nhận contract tương thích và liên kết PR khác repo; không stage backend từ repo mobile.
|
|
56
|
+
|
|
57
|
+
**Handoff:** approved user stories/AC → offline flows → OpenSpec → persistence/sync implementation → device test evidence → reviewed PR → authorized mobile release.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Walkthrough 1 — Spring Boot API từ yêu cầu tới release
|
|
2
|
+
|
|
3
|
+
**Tình huống giả định:** thêm REST API tra cứu khách hàng theo tenant vào một **repo Spring Boot hiện có**, có PostgreSQL/Oracle tùy dự án, có thể thêm Kafka Outbox và Kubernetes **nếu thật sự có**. Không có source thực tế trong walkthrough này; endpoint, SQL và lệnh test là **đề xuất cần đối chiếu với project**.
|
|
4
|
+
|
|
5
|
+
**Modules:** Core + `java-spring` + `product`, bổ sung `devops,kubernetes` chỉ khi sở hữu pipeline/manifests. Xem [full SDLC](../end-to-end-workflow.md), [skills](../skill-matrix.md).
|
|
6
|
+
|
|
7
|
+
## 1. Setup & input
|
|
8
|
+
|
|
9
|
+
~~~bash
|
|
10
|
+
cd /path/to/existing-spring-service
|
|
11
|
+
aih resolve --adapters java-spring,kubernetes --capabilities product,devops
|
|
12
|
+
aih init --adapters java-spring,kubernetes --capabilities product,devops --dry-run
|
|
13
|
+
aih init --adapters java-spring,kubernetes --capabilities product,devops
|
|
14
|
+
aih check
|
|
15
|
+
aih skills
|
|
16
|
+
~~~
|
|
17
|
+
|
|
18
|
+
Trong service không triển khai trên Kubernetes thì **bỏ `kubernetes`**; không dùng `aih detect` thay cho việc xác nhận stack. `aih init` chỉ chép Harness, không scaffold Spring Boot.
|
|
19
|
+
|
|
20
|
+
Input: source revision, business owner, endpoint contract đang có, auth/tenant rules, schema migration policy, test/build tool, environment/approver. Ghi fact và unknown trong `.harness/local.md` hoặc change riêng, không thay Core managed files.
|
|
21
|
+
|
|
22
|
+
## 2. BA/PO → reviewed requirements
|
|
23
|
+
|
|
24
|
+
~~~bash
|
|
25
|
+
aih new-doc brd
|
|
26
|
+
aih new-doc prd
|
|
27
|
+
aih new-doc backlog
|
|
28
|
+
aih new-doc acceptance-criteria
|
|
29
|
+
aih new-doc traceability
|
|
30
|
+
aih skill harness-product-business-analysis
|
|
31
|
+
aih skill harness-product-prd-generation
|
|
32
|
+
aih skill harness-product-acceptance-criteria
|
|
33
|
+
~~~
|
|
34
|
+
|
|
35
|
+
AI IDE đọc nguồn được cấp quyền, đề xuất `FR-001`: tenant chỉ xem dữ liệu của mình; `AC-US-001-01`: tenant khác trả 403/404 tùy contract đã duyệt. **Chưa có xác nhận của PO thì đây vẫn là draft.** Reviewer dùng `harness-product-document-review` để phát hiện lỗ hổng; BA/PO là người xác nhận.
|
|
36
|
+
|
|
37
|
+
## 3. OpenSpec & technical review
|
|
38
|
+
|
|
39
|
+
~~~bash
|
|
40
|
+
aih new-change add-customer-lookup
|
|
41
|
+
aih skill harness-spec
|
|
42
|
+
~~~
|
|
43
|
+
|
|
44
|
+
Từ approved `FR/AC`, hoàn thiện `openspec/changes/add-customer-lookup/{proposal,design,tasks}.md` và delta specs. Nội dung cần có: API status/body, JWT/LDAP principal→tenant, authorization ở service/data access, error mapping, pagination, audit, DB indexes và backward compatibility. Không suy đoán dialect hoặc thông số tải.
|
|
45
|
+
|
|
46
|
+
Nếu OpenSpec CLI được cài **riêng** và version tương thích với project:
|
|
47
|
+
|
|
48
|
+
~~~bash
|
|
49
|
+
openspec validate add-customer-lookup --strict
|
|
50
|
+
~~~
|
|
51
|
+
|
|
52
|
+
Lệnh `new-change` **chỉ tạo draft**, không validate/approve spec. Gate: reviewer duyệt API/security/data boundaries.
|
|
53
|
+
|
|
54
|
+
## 4. Code theo adapter skills
|
|
55
|
+
|
|
56
|
+
~~~bash
|
|
57
|
+
aih skill harness-java-spring-spring-api
|
|
58
|
+
aih skill harness-tdd
|
|
59
|
+
aih skill harness-java-spring-database-migration
|
|
60
|
+
aih skill harness-java-spring-kafka-outbox
|
|
61
|
+
~~~
|
|
62
|
+
|
|
63
|
+
- `spring-api`: controller/service/repository theo pattern hiện có, tenant-scope server-side, DTO và HTTP contract.
|
|
64
|
+
- `database-migration`: chỉ dùng **khi đổi schema**; thiết kế expand → compatible deploy → contract, rollback/data-loss risk.
|
|
65
|
+
- `kafka-outbox`: chỉ dùng **khi có event publication**; transactional write, duplicate consumer delivery, retry/dead-letter.
|
|
66
|
+
- `harness-tdd`: negative auth test, missing resource, validation, successful request, regression. Không tạo implementation Kafka/DB nếu requirement không cần.
|
|
67
|
+
|
|
68
|
+
Lệnh verify ứng dụng **tùy repo** — dưới đây chỉ là ví dụ nếu có Maven wrapper:
|
|
69
|
+
|
|
70
|
+
~~~bash
|
|
71
|
+
# Kiểm tra wrapper và profile của repo trước khi chạy
|
|
72
|
+
./mvnw test
|
|
73
|
+
# ./mvnw verify # nếu project cấu hình integration tests phù hợp
|
|
74
|
+
~~~
|
|
75
|
+
|
|
76
|
+
`aih verify --scope all` xuất checklist **không chạy Maven**. Nếu không chạy được integration test do thiếu DB, báo blocker; không ghi Pass.
|
|
77
|
+
|
|
78
|
+
## 5. PR → staging → production
|
|
79
|
+
|
|
80
|
+
~~~bash
|
|
81
|
+
aih verify --scope all
|
|
82
|
+
aih eval --scope all
|
|
83
|
+
aih check
|
|
84
|
+
~~~
|
|
85
|
+
|
|
86
|
+
Reviewer sử dụng `harness-review` + `security-reviewer`; PR gắn change ID, approved AC, diff, actual test logs, migration sequence, unrun checks, release/rollback plan. Không tự merge.
|
|
87
|
+
|
|
88
|
+
Nếu có pipeline/manifests: `harness-devops-ci-cd` → `harness-devops-docker` → `harness-kubernetes-workload-review`, `harness-kubernetes-helm-release` (nếu Helm) → `harness-devops-deployment` / `harness-kubernetes-rollout-safety`. Chỉ người/runtime được phép và có approval theo artifact/environment mới deploy; sau rollout kiểm chứng readiness + actual error/latency data.
|
|
89
|
+
|
|
90
|
+
## Expected handoff (mẫu, không phải kết quả đã chạy)
|
|
91
|
+
|
|
92
|
+
| Stage | Output cần bàn giao |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| Product | `docs/product/brd.md`, `prd.md`, `backlog.md`, `acceptance-criteria.md`, `traceability.md` approved |
|
|
95
|
+
| Spec | `openspec/changes/add-customer-lookup/` reviewed |
|
|
96
|
+
| Code | Endpoint + auth/contract tests + migration/event tests nếu có |
|
|
97
|
+
| Review | PR, CI/test evidence, risk list, human decision |
|
|
98
|
+
| Release | Image digest, environment approval, rollback steps, measured health |
|
|
99
|
+
|
|
100
|
+
**Sau khi PR đã merge:** upstream OpenSpec archive/sync nếu dự án sử dụng OpenSpec; không archive khi change vẫn chưa merge.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Bắt đầu với AI Harness
|
|
2
|
+
|
|
3
|
+
**Cài một lần → ghi context dự án → giao việc cho AI → kiểm tra kết quả.**
|
|
4
|
+
|
|
5
|
+
Cần Node.js **22+**, Git và một repository ứng dụng đã tồn tại. AI IDE/assistant phải đọc được file trong repository; cách tự nạp `AGENTS.md` và skills phụ thuộc AI host. CLI `aih` quản lý hướng dẫn, không chạy LLM hay tạo ứng dụng.
|
|
6
|
+
|
|
7
|
+
## 1. Cài vào project
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @manhd_d/ai-harness
|
|
11
|
+
cd /path/to/existing-project
|
|
12
|
+
aih init --adapters java-spring
|
|
13
|
+
aih check
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Chọn module theo nhu cầu, không cần cài cả bộ:
|
|
17
|
+
|
|
18
|
+
| Nhu cầu | Tham số cho `aih init` |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| Spring Boot API | `--adapters java-spring` |
|
|
21
|
+
| React/Next.js + UI | `--adapters react-nextjs --capabilities uiux` |
|
|
22
|
+
| Astro tool nhỏ | `--adapters astro` |
|
|
23
|
+
| Website có quảng cáo | `--adapters astro --capabilities monetization` |
|
|
24
|
+
| Viết tài liệu từ ý tưởng hoặc tài liệu BA | `--capabilities product` |
|
|
25
|
+
| Spring + tài liệu + Kubernetes | `--adapters java-spring,kubernetes --capabilities product,devops` |
|
|
26
|
+
|
|
27
|
+
`aih list` xem toàn bộ module. `aih init --dry-run` xem trước thay đổi với cùng tham số đã chọn. Với project đã cài, đổi module trong `.harness/project.json` rồi dùng `aih update`, không chạy lại `init` với lựa chọn khác.
|
|
28
|
+
|
|
29
|
+
## 2. Ghi context và bắt đầu giao việc
|
|
30
|
+
|
|
31
|
+
Điền `.harness/local.md` bằng thông tin thực của project:
|
|
32
|
+
|
|
33
|
+
- Mục tiêu, phạm vi và quy tắc nghiệp vụ quan trọng.
|
|
34
|
+
- Stack/phiên bản, database, cấu trúc service/module.
|
|
35
|
+
- Lệnh build/test đã xác nhận chạy được.
|
|
36
|
+
- Đường dẫn tài liệu BA, conventions và những ràng buộc cần giữ.
|
|
37
|
+
|
|
38
|
+
Mở project trong AI IDE và giao yêu cầu, ví dụ:
|
|
39
|
+
|
|
40
|
+
> Đọc AGENTS.md và .harness/local.md, chỉ nạp skill liên quan. Thêm API tìm kiếm khách hàng theo yêu cầu này: … Làm rõ điểm chưa chắc chắn, đề xuất acceptance scenarios; sau khi thống nhất scope, triển khai, chạy test phù hợp và báo cáo kết quả thực chạy.
|
|
41
|
+
|
|
42
|
+
Bạn không cần gọi từng role/skill thủ công. Nếu host không tự phát hiện hướng dẫn, yêu cầu assistant đọc các đường dẫn trên. `aih skills` xem danh sách; `aih skill <tên>` đọc một skill khi cần.
|
|
43
|
+
|
|
44
|
+
Review diff và kết quả test, rồi commit `AGENTS.md`, `.harness/`, `.agents/skills/` và tài liệu thay đổi cùng project. Sửa quy tắc riêng trong `.harness/local.md`; giữ nguyên snapshot do Harness quản lý.
|
|
45
|
+
|
|
46
|
+
## 3. Tài liệu và spec khi cần
|
|
47
|
+
|
|
48
|
+
Với capability `product`:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
aih new-doc prd-lite
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Lệnh tạo template `docs/product/prd-lite.md`; bạn và AI điền nội dung, nguồn và acceptance criteria. Chọn [Idea-driven](examples/idea-driven-project.md) nếu bắt đầu từ ý tưởng; chọn [Document-driven](examples/document-driven-project.md) nếu đã có tài liệu BA/Confluence.
|
|
55
|
+
|
|
56
|
+
Khi một tính năng cần proposal/design/tasks/spec riêng:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
aih new-change add-customer-search
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Đây là bản nháp trong `openspec/changes/add-customer-search/`, chưa phải spec được duyệt. Sửa nhỏ, ít rủi ro có thể bỏ qua full spec với lý do rõ ràng; không bắt mọi task tạo đủ BRD/PRD/SRS.
|
|
63
|
+
|
|
64
|
+
`aih new-change` không cần OpenSpec CLI. Chỉ cài OpenSpec riêng khi cần validator/archive của công cụ đó; xem [OpenSpec](openspec.md).
|
|
65
|
+
|
|
66
|
+
## 4. Kiểm tra đúng thứ
|
|
67
|
+
|
|
68
|
+
| Lệnh | Ý nghĩa |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `aih check` | Kiểm tra integrity của file Harness; không kiểm thử ứng dụng |
|
|
71
|
+
| `aih doctor` | Thêm kiểm tra sự hiện diện của công cụ; không xác nhận công cụ chạy được |
|
|
72
|
+
| `aih verify --scope all` | Xuất checklist, `executed: false`; không chạy build/test |
|
|
73
|
+
| `aih eval --scope all` | Xuất tình huống và báo cáo chưa chấm; không gọi model |
|
|
74
|
+
| Lệnh test của project | Do bạn, AI host hoặc CI thực chạy để xác minh code |
|
|
75
|
+
|
|
76
|
+
Một lần `aih check` thành công không có nghĩa tính năng đã đúng. Ghi lệnh test thực chạy, kết quả và phần chưa kiểm chứng trong PR. Xem [đánh giá hành vi AI](../evals/README.md) nếu muốn đo hiệu quả Harness.
|
|
77
|
+
|
|
78
|
+
## 5. Cập nhật: CLI trước, project sau
|
|
79
|
+
|
|
80
|
+
Trên branch riêng, commit trạng thái hiện tại trước. Với cách cài global ở trên:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install -g @manhd_d/ai-harness@latest
|
|
84
|
+
aih --version
|
|
85
|
+
aih check
|
|
86
|
+
aih update --dry-run
|
|
87
|
+
aih update
|
|
88
|
+
aih check
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`aih --version` là phiên bản CLI; `aih check` trả phiên bản snapshot trong project. `aih update` lấy bundle từ CLI đang cài (hoặc `--source`), **không tự tải npm**. Review diff, chạy test ứng dụng và commit snapshot/lock cùng nhau. Nếu báo drift, giữ lại thay đổi trong Git, chuyển tùy chỉnh sang `.harness/local.md` và khôi phục managed files trước khi update.
|
|
92
|
+
|
|
93
|
+
Nếu cài local trong project, dùng `npm install --save-dev @manhd_d/ai-harness@latest` và `npx aih` thay cho `aih`.
|
|
94
|
+
|
|
95
|
+
## Đọc thêm theo nhu cầu
|
|
96
|
+
|
|
97
|
+
- [CLI reference](cli.md) · [Full SDLC](end-to-end-workflow.md) · [Skill matrix](skill-matrix.md) · [Agent handoffs](agent-handoffs.md).
|
|
98
|
+
- [Spring Boot API](examples/spring-boot-api.md) · [Full-stack](examples/fullstack-web.md) · [React Native](examples/react-native-app.md) · [Python AI/RAG](examples/ai-rag-service.md).
|
|
99
|
+
- [Astro micro-tools](examples/astro-micro-tools.md) · [Astro + AdSense](examples/astro-adsense-microtools.md).
|
|
100
|
+
- [Release guide](npm-release.md): dành cho maintainer; merge source không đồng nghĩa npm đã có bản mới.
|