@manhd_d/ai-harness 0.6.0 → 0.7.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.
@@ -1,148 +1,110 @@
1
- # Getting started — cài và sử dụng AI Harness
1
+ # Bắt đầu với AI Harness
2
2
 
3
- AI Harness phân phối **rules, role contracts, skills và workflows** tới repository ứng dụng. Lệnh `aih` là CLI chạy offline, không phải AI agent runner: nó không tạo ứng dụng, đọc Confluence, tạo Figma, chạy test, gọi LLM, merge PR hay deploy.
3
+ **Cài một lần → ghi context dự án → giao việc cho AI → kiểm tra kết quả.**
4
4
 
5
- **Đọc theo thứ tự:** [Full SDLC](end-to-end-workflow.md) → [Skill matrix](skill-matrix.md) → [Agent handoffs](agent-handoffs.md) → [Ví dụ theo stack](#ví-dụ-thực-hành).
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
6
 
7
- ## 1. Chuẩn bị
7
+ ## 1. Cài vào project
8
8
 
9
- - Node.js >=22, Git và npm (cần quyền repository private chỉ khi cài từ source).
10
- - Một **repository ứng dụng đã tồn tại** và AI IDE/assistant có thể đọc file trong repository đó.
11
- - Chỉ kết nối GitHub, Confluence, Figma hay nền tảng khác trong AI host khi cần, theo quyền đã phê duyệt.
12
- - **OpenSpec CLI là tùy chọn**: `aih new-change` tạo bản nháp offline, còn `openspec validate` cần OpenSpec CLI cài riêng. Xem [OpenSpec](openspec.md).
13
- - Bản nguồn hiện tại là candidate; chưa mặc định có một bản `@manhd_d/ai-harness` được phát hành trên npm registry. Xem [npm release](npm-release.md).
14
-
15
- ## 2. Cài một lần từ source đã review
16
-
17
- ~~~bash
18
- git clone git@github.com:manh0303/ai-harness.git
19
- cd ai-harness
20
- # Nếu thử PR Astro chưa merge, chọn branch đã review:
21
- git switch feat/astro-lightweight-adapter
22
- # Sau khi merge, ưu tiên commit/tag chính thức đã review.
23
- npm test
24
- npm run validate
25
- npm run test:package
26
- npm pack
27
- npm install -g ./manhd_d-ai-harness-0.6.0.tgz
28
- aih --version
29
- ~~~
30
-
31
- Nếu package đã được publish công khai thì có thể cài bằng `npm install -g @manhd_d/ai-harness`; **đừng coi lệnh cài registry là dùng được trước khi xác minh việc phát hành**. Cài bộ `aih` không tự cài OpenSpec hay dependency Spring/React/Python cho ứng dụng.
32
-
33
- ## 3. Cài Harness vào repository ứng dụng
34
-
35
- Ví dụ service Spring Boot có nhu cầu làm tài liệu sản phẩm và triển khai Kubernetes:
36
-
37
- ~~~bash
38
- cd /path/to/existing-spring-service
39
- aih resolve --adapters java-spring,kubernetes --capabilities product,devops
40
- aih init --adapters java-spring,kubernetes --capabilities product,devops --dry-run
41
- aih init --adapters java-spring,kubernetes --capabilities product,devops
9
+ ```bash
10
+ npm install -g @manhd_d/ai-harness
11
+ cd /path/to/existing-project
12
+ aih init --adapters java-spring
42
13
  aih check
43
- aih skills
44
- ~~~
14
+ ```
45
15
 
46
- - `aih resolve`: kiểm tra dependency/compatibility và cảnh báo recommendation; **không cài module**.
47
- - `aih init --dry-run`: xem diff dự kiến, **không cài đặt lâu dài**.
48
- - `aih init`: cài snapshot đã chọn trong `.harness/`, tạo AGENTS block, ghi lock và expose skills trong `.agents/skills/`.
49
- - `aih check`: kiểm tra integrity của file do Harness quản lý, **không kiểm thử source code ứng dụng**.
50
- - `aih skills`: liệt kê metadata. `aih skill <tên>`: đọc **một** skill đã cài, không tự kích hoạt agent.
16
+ Chọn module theo nhu cầu, không cần cài cả bộ:
51
17
 
52
- **Các lựa chọn phổ biến:**
53
-
54
- | Dự án | Lựa chọn |
18
+ | Nhu cầu | Tham số cho `aih init` |
55
19
  | --- | --- |
56
- | API Spring | `--adapters java-spring` |
57
- | Web React/Next.js | `--adapters react-nextjs --capabilities uiux` |
58
- | Astro web tools (static-first) | `--adapters astro` (tùy chọn `--capabilities product,uiux`) |
59
- | Astro/React + advertising | `--adapters astro --capabilities monetization` (hoặc `react-nextjs`) |
60
- | React Native/Expo | `--adapters react-native --capabilities product,uiux` |
61
- | Python AI/RAG | `--adapters ai-python --capabilities product` |
62
- | Full-stack một repo | `--adapters java-spring,react-nextjs,kubernetes --capabilities product,uiux,devops` |
63
- | Chỉ BA/PO | `--capabilities product` |
64
- | Core-only | Không truyền adapters/capabilities |
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` |
65
26
 
66
- `aih detect` kiểm tra heuristic các file trực tiếp ở target, không tìm đệ quy monorepo. Với mỗi microservice/repository độc lập, cài riêng và chỉ chọn những module thực sự cần.
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.
67
28
 
68
- ## Astro cho web tools nhỏ
29
+ ## 2. Ghi context và bắt đầu giao việc
69
30
 
70
- Nếu xây nhiều tiện ích như QR, JSON hoặc image tools: dùng [Astro micro-tools walkthrough](examples/astro-micro-tools.md) với lệnh `aih init --adapters astro` và skill islands, SEO, performance, Cloudflare. `astro` được nhận diện từ dependencies. React Islands không bắt buộc; MFE/Workers không được cài tự động.
31
+ Chạy `aih setup` rồi nhờ AI đọc workflow `project-setup`. Đây là gợi ý cho AI host, không phải wizard
32
+ nhập liệu của CLI. AI đọc repo trước, chỉ hỏi 1–3 câu A/B/C cho điểm còn thiếu, có đề xuất và lý do.
33
+ Không cần xác nhận lại thông tin hoặc quyền triển khai đã có.
71
34
 
72
- ## Website công cụ miễn phí có quảng cáo
35
+ Điền `.harness/local.md` bằng thông tin thực của project:
73
36
 
74
- Nếu mục tiêu là traffic SEO và doanh thu AdSense, chọn optional `monetization` **không phụ thuộc Astro**; website có thể dùng Next.js. Xem [Monetization guide](monetization.md), [walkthrough Astro + AdSense](examples/astro-adsense-microtools.md) và `aih skill harness-monetization-adsense-integration`. Các hướng dẫn chỉ giúp chuẩn bị, không tự tạo tài khoản AdSense hoặc kết nối Analytics.
37
+ - Mục tiêu, phạm vi và quy tắc nghiệp vụ quan trọng.
38
+ - Stack/phiên bản, database, cấu trúc service/module.
39
+ - Lệnh build/test đã xác nhận chạy được.
40
+ - Đường dẫn tài liệu BA, conventions và những ràng buộc cần giữ.
75
41
 
76
- ## Hai hướng dẫn theo loại dự án
42
+ Mở project trong AI IDE và giao yêu cầu, ví dụ:
77
43
 
78
- - [Idea-driven — có ý tưởng và muốn AI cùng thảo luận, nghiên cứu, viết tài liệu](examples/idea-driven-project.md).
79
- - [Document-driven — có BRD/PRD/SRS từ BA, cần AI đưa vào phát triển phần mềm](examples/document-driven-project.md).
44
+ > Đọ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.
80
45
 
81
- **Lưu ý:** khi PR chứa tính năng chưa merge, cần checkout đúng branch/commit đã review trước khi `npm pack`; cài từ `main` không mặc định có các tính năng chỉ có trong PR.
46
+ 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.
82
47
 
83
- ## 4. Bắt đầu một thay đổi có traceability
48
+ 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ý.
84
49
 
85
- Hai workflow tài liệu: `idea-driven` khi bắt đầu từ ý tưởng thô, `document-driven` khi đã có BRD/PRD/SRS/Confluence do BA cung cấp. Cả hai dùng chung pipeline, approval và OpenSpec. Xem [Documentation workflows](documentation-workflows.md).
50
+ Lệnh/tool chung thuộc `.harness/environment.json`; đường dẫn máy riêng thuộc file ignored
51
+ `.harness/machine.json`. `aih doctor` kiểm tra tham chiếu biến và sự hiện diện công cụ, không chạy chúng.
52
+ Xem [cấu hình Maven nội bộ](project-configuration.md).
86
53
 
54
+ ## 3. Tài liệu và spec khi cần
87
55
 
88
- ~~~bash
89
- # Chỉ dùng được khi đã chọn capability product:
90
- aih new-doc brd
91
- aih new-doc prd
92
- aih new-doc backlog
93
- aih new-doc acceptance-criteria
94
- aih new-doc traceability
95
- aih new-doc idea # docs/discovery/
96
- aih new-doc research # docs/discovery/
97
- aih new-doc prd-lite # docs/product/
98
- aih new-doc srs # docs/product/
99
- aih new-doc use-cases # docs/product/
56
+ Với capability `product`:
100
57
 
101
- # Tạo change bản nháp OpenSpec — không cần cài OpenSpec CLI:
102
- aih new-change add-customer-api
58
+ ```bash
59
+ aih new-doc prd-lite
60
+ ```
103
61
 
104
- # Đọc từng skill cần thiết:
105
- aih skill harness-product-prd-generation
106
- aih skill harness-spec
107
- aih skill harness-tdd
108
- ~~~
62
+ 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.
109
63
 
110
- Các lệnh `new-doc` chỉ copy template trống sang `docs/product/`; AI host/BA/PO phải điền theo nguồn đáng tin cậy và duyệt. `new-change` chỉ tạo proposal/design/tasks/spec có TODO; **không phải spec đã được approve**. Trước khi yêu cầu IDE implement, hướng assistant đọc `AGENTS.md` và `.harness/local.md` của dự án.
64
+ Khi một tính năng cần proposal/design/tasks/spec riêng:
111
65
 
112
- **Prompt mẫu gửi cho assistant:**
66
+ ```bash
67
+ aih new-change add-customer-search
68
+ ```
113
69
 
114
- > Hãy đọc AGENTS.md, .harness/local.md và các skill phù hợp đã cài. Phân tích yêu cầu theo source ID, nêu các điểm chưa rõ, soạn OpenSpec change và test scenarios. Chỉ implement khi scope được duyệt; báo cáo tests thực chạy và tạo PR để tôi review, không tự merge hoặc deploy.
70
+ Đây là bản nháp trong `openspec/changes/add-customer-search/`, chưa phải spec được duyệt.
71
+ AI ghi câu trả lời thực tế trong `decisions.json`; kiểm tra bằng `aih ready add-customer-search --stage implement`.
72
+ Sau code, ghi bằng chứng trong `verification.json` và chạy với `--stage review`. Xem [Change readiness](change-readiness.md). 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.
115
73
 
116
- ## 5. Verify / evaluate và release
74
+ `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).
117
75
 
118
- ~~~bash
119
- aih verify --scope all
120
- aih eval --scope all
121
- aih check
122
- ~~~
76
+ ## 4. Kiểm tra đúng thứ
77
+
78
+ | Lệnh | Ý nghĩa |
79
+ | --- | --- |
80
+ | `aih check` | Kiểm tra integrity của file Harness; không kiểm thử ứng dụng |
81
+ | `aih doctor` | Kiểm tra công cụ và environment đã cấu hình; không chạy build/test |
82
+ | `aih verify --scope all` | Xuất checklist, `executed: false`; không chạy build/test |
83
+ | `aih eval --scope all` | Xuất tình huống và báo cáo chưa chấm; không gọi model |
84
+ | Lệnh test của project | Do bạn, AI host hoặc CI thực chạy để xác minh code |
123
85
 
124
- - `verify`: checklist advisory, `executed: false`. Dùng bằng chứng chạy build/test **bên ngoài CLI**.
125
- - `eval`: dataset và report để con người chạy bài test với một AI runtime được cấp quyền rồi chấm; **không gọi model, không tự chấm**.
126
- - `--scope all`: Core + capability + adapter và scenario ghép module phù hợp. Không có scope thì mặc định chỉ là adapter.
127
- - Production approval phải chỉ rõ artifact, environment và người phê duyệt; CI xanh không cấp quyền deploy.
86
+ 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.
128
87
 
129
- Đọc các [approval gates trong Full SDLC](end-to-end-workflow.md) và [DevOps runbook](../capabilities/devops/workflows/pr-to-production.md).
88
+ ## 5. Cập nhật: CLI trước, project sau
130
89
 
131
- ## 6. Update bộ Harness đã cài
90
+ 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:
132
91
 
133
- ~~~bash
134
- # Trên branch của consumer, commit trạng thái hiện tại trước.
135
- # Thay đổi adapters/capabilities trong .harness/project.json nếu cần.
92
+ ```bash
93
+ npm install -g @manhd_d/ai-harness@latest
94
+ aih --version
95
+ aih check
136
96
  aih update --dry-run
137
97
  aih update
138
98
  aih check
139
- ~~~
99
+ ```
100
+
101
+ `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.
140
102
 
141
- Không chỉnh file snapshot dưới `.harness/core|adapters|capabilities` hoặc skill do Harness quản lý; nội dung riêng của dự án thuộc `.harness/local.md`. Nếu có drift, khôi phục từ Git và review diff; không sửa lock hash để che lỗi.
103
+ Nếu cài local trong project, dùng `npm install --save-dev @manhd_d/ai-harness@latest` và `npx aih` thay cho `aih`.
142
104
 
143
- ## Ví dụ thực hành
105
+ ## Đọc thêm theo nhu cầu
144
106
 
145
- - [Spring Boot REST API với Kafka/DB/Kubernetes](examples/spring-boot-api.md)
146
- - [Full-stack Spring + Next.js + Figma](examples/fullstack-web.md)
147
- - [React Native/Expo có offline-sync](examples/react-native-app.md)
148
- - [Python AI/RAG với kiểm soát truy cập](examples/ai-rag-service.md)
107
+ - [CLI reference](cli.md) · [Full SDLC](end-to-end-workflow.md) · [Skill matrix](skill-matrix.md) · [Agent handoffs](agent-handoffs.md).
108
+ - [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).
109
+ - [Astro micro-tools](examples/astro-micro-tools.md) · [Astro + AdSense](examples/astro-adsense-microtools.md).
110
+ - [Release guide](npm-release.md): dành cho maintainer; merge source không đồng nghĩa npm đã có bản mới.
@@ -1,70 +1,57 @@
1
- # npm installation and release
1
+ # npm publishing — automated releases
2
2
 
3
- The public npm package is `@manhd_d/ai-harness` (executable: `aih`). The private GitHub repository stays `manh0303/ai-harness`. Different npm and GitHub usernames are expected.
3
+ The public distribution is `@manhd_d/ai-harness` (CLI command `aih`). The GitHub source stays **private** at `manh0303/ai-harness`. First version `0.6.0` was published manually by its owner.
4
4
 
5
- **Changing this configuration and merging a PR does not publish a package.** Public npm publication makes every file inside the npm tarball publicly accessible, regardless of GitHub repository visibility.
5
+ ## One-time npm Trusted Publisher setup
6
6
 
7
- ## First publication: manual, maintainer-controlled
7
+ In [npm package settings](https://www.npmjs.com/package/@manhd_d/ai-harness) → Trusted Publisher select **GitHub Actions** with:
8
8
 
9
- 1. Confirm the verified npm account is `manhd_d`, with 2FA enabled, and the publishing machine uses the official npm registry.
10
- 2. Merge the reviewed PR. Check out the approved `main` commit. Review `npm pack --dry-run` for secrets before sharing the archive.
11
- 3. Run:
9
+ | Field | Value |
10
+ | --- | --- |
11
+ | Organization or user | `manh0303` |
12
+ | Repository | `ai-harness` |
13
+ | Workflow filename | `npm-publish.yml` |
14
+ | Environment | Leave empty |
15
+ | Allowed actions | **Allow npm publish** (required) |
12
16
 
13
- ```bash
14
- git switch main
15
- git pull --ff-only
16
- npm login
17
- npm whoami
18
- npm config get registry
19
- npm ci --ignore-scripts --no-audit --no-fund
20
- npm test
21
- npm run validate
22
- npm run check:release
23
- npm run test:package
24
- npm pack --dry-run
25
- npm publish --access public
26
- npm view @manhd_d/ai-harness version
27
- ```
17
+ Use **npm CLI >= 11.5.1** and Node 22.14+ for OIDC; this workflow runs Node 24 and installs npm 11. No `NPM_TOKEN` or OTP is required in GitHub Actions. Keep npm 2FA on for account security. Because the GitHub repository is private, npm provenance attestations are unavailable and the workflow disables provenance while retaining OIDC.
28
18
 
29
- `npm whoami` must return `manhd_d`. The expected first package version is `0.6.0`, if the maintainer has approved that release and the version is not already published. Publishing may require browser/2FA confirmation. Never commit npm credentials or tokens.
19
+ **Repository setting required:** GitHub → `manh0303/ai-harness` → Settings → Actions → General → Workflow permissions → ensure **Allow GitHub Actions to create and approve pull requests** is enabled. This grants Release Please permission to open Release PRs (which are still reviewed by a human). GitHub does not validate the npm Trusted Publisher mapping when it is saved; the first OIDC release run proves it works.
30
20
 
31
- A successful publish is independently verifiable with `npm view`. You can add an annotated git tag `v0.6.0` to the exact commit afterwards, but **do not create/publish a GitHub Release for a version already published manually**.
21
+ ## End-to-end workflow
32
22
 
33
- ## Later releases: npm Trusted Publishing via GitHub Actions
23
+ 1. Feature/fix PRs use Conventional Commits or squash titles: `feat: ...` (minor), `fix: ...` (patch), `feat!: ...` / `BREAKING CHANGE` (breaking). Do **not** bump `package.json`, `package-lock.json`, `harness.yaml` or the Release Please manifest on feature branches.
24
+ 2. CI runs tests; **you review and merge** the feature PR into `main`.
25
+ 3. `.github/workflows/npm-publish.yml` runs CI on `main` then Release Please. It opens/updates a separate **Release PR**, proposing version/changelog changes. It also explicitly dispatches `harness.yml` for the generated Release PR branch; the `GITHUB_TOKEN` does not trigger arbitrary downstream workflows.
26
+ 4. **You review and merge the Release PR** once satisfied. That `main` push triggers the same workflow. After tests pass, Release Please creates a `vX.Y.Z` Git tag and GitHub Release.
27
+ 5. The **same** `npm-publish.yml` run checks out that tag, checks ancestry on `main`, verifies scope/manifest/changelog, runs tests and an actual npm tarball smoke test, then executes `npm publish --access public` with GitHub OIDC.
28
+ 6. Confirm the new version with `npm view @manhd_d/ai-harness version`. npm processing can take a few minutes. Consumers run `npm install -g @manhd_d/ai-harness@latest`, then `aih update --dry-run`, `aih update` and `aih check` inside each project.
34
29
 
35
- After the first successful manual publication, go to [npm](https://www.npmjs.com) → package `@manhd_d/ai-harness` → Settings → Trusted publishing and configure a GitHub Actions publisher:
30
+ **Why one workflow?** Release Please uses `GITHUB_TOKEN`. GitHub usually suppresses new workflow runs in response to events created by `GITHUB_TOKEN`, including its `release.published` event. Publishing in the same `push main` workflow avoids silently skipping npm publication. For a **manually published** GitHub Release, the same file also supports `release.published` as a fallback, with matching version and main-ancestry guards. Do not create a manual GitHub Release for a version already present on npm; npm versions cannot be overwritten.
36
31
 
37
- | Field | Value |
38
- | --- | --- |
39
- | GitHub user/organization | `manh0303` |
40
- | Repository | `ai-harness` |
41
- | Workflow file | `npm-publish.yml` |
42
- | Environment | Leave empty (workflow does not use an environment) |
32
+ ## Bootstrap from manually published v0.6.0
43
33
 
44
- Select direct **npm publish** permissions if npm offers a stage-only option. Configure the trusted publisher shortly before the next release if npm applies an initial activation deadline. No long-lived `NPM_TOKEN` is required.
34
+ `.release-please-manifest.json` starts at `{".":"0.6.0"}` and `release-please-config.json` pins `bootstrap-sha` to the main commit from which v0.6.0 was published. This prevents replaying all historical changes or treating an older branch's releases as new. For the root npm package Release Please uses:
45
35
 
46
- For each subsequent version: use a dedicated release PR to update `package.json`, `package-lock.json`, `harness.yaml` and `CHANGELOG.md` together, run CI, review and merge. Create a tag `vX.Y.Z` at the tested main commit and **publish the corresponding GitHub Release**. Only this Release publication triggers `.github/workflows/npm-publish.yml`. The workflow checks that the commit is reachable from main, that the tag matches the package version, and that tests and tarball smoke checks pass before attempting OIDC-based publication.
36
+ - `release-type: node` to update `package.json`, `package-lock.json`, and `CHANGELOG.md`.
37
+ - `include-v-in-tag: true` and `include-component-in-tag: false` to create tags like `v0.6.1`.
38
+ - **`extra-files` type `json` for `harness.yaml`**, because despite its .yaml name, this file must stay valid JSON and is parsed with `JSON.parse`; a YAML updater would break the CLI.
47
39
 
48
- A private GitHub source repository does not support npm provenance attestation even though the public package can use OIDC. Do not enable npm provenance for this private repository. See [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/).
40
+ `scripts/check-release.js` blocks mismatched versions across the three distribution metadata files and Release Please manifest, and accepts old and Release Please-generated changelog version headings. Feature PRs should not edit `bootstrap-sha`; it becomes irrelevant after the first automated release.
49
41
 
50
- ## Local installation before npm publication
42
+ ## Security and recovery
51
43
 
52
- ```bash
53
- npm pack
54
- npm install -g ./manhd_d-ai-harness-0.6.0.tgz
55
- aih --version
56
- ```
44
+ No workflow automatically merges a PR. The release job uses only `contents: read` and `id-token: write`; the Release Please job has separately scoped permissions to open PRs/create releases. GitHub-hosted runners are required for npm OIDC. If a Release PR appears without CI checks, use the explicitly dispatched CI run linked from Actions. Never merge an unreviewed release PR.
57
45
 
58
- ## Installation after verified npm publication
46
+ If the Release Please job fails to create a PR, check repository Actions workflow permissions and the workflow logs. If npm returns E403, check Trusted Publisher's **workflow filename exactly `npm-publish.yml`**, allowed action `npm publish`, and that the connection is active. Do not add bypass-2FA tokens as a workaround. An expired/unverified publisher binding may require recreating it in npm settings.
59
47
 
60
- ```bash
61
- npm install -g @manhd_d/ai-harness
62
- aih --version
63
- cd /path/to/existing-project
64
- aih init --adapters java-spring
65
- aih check
66
- ```
48
+ If GitHub Release exists but npm publish failed, **do not bump the version blindly or create another GitHub Release for the same tag**. Diagnose the failed job. Re-running the workflow is appropriate only when npm still has no published version and the error is resolved. A documented manual recovery is possible after verifying the tag and credentials.
67
49
 
68
- Existing consumers can update the CLI with `npm update -g @manhd_d/ai-harness`. Use `aih update --dry-run`, `aih update`, `aih check` to update a consumer project's snapshot on a branch. CLI installation does not install OpenSpec, an AI runtime or application dependencies.
50
+ If the failure is in code/tests stored in the release tag, fixing `main` does not fix that immutable
51
+ tag. Do not move or overwrite it. Merge the repair, let Release Please prepare a new patch Release PR,
52
+ verify CI on its exact head, then review/merge it. Re-running the old tag will reproduce the old defect.
53
+ For example, v0.6.1 failed before publication because two migration tests expected 0.6.0.
54
+ Main now compares against the source version; the regression suite also exercises the next patch
55
+ version. Publish the reviewed follow-up release rather than changing v0.6.1.
69
56
 
70
- Read [Getting started](getting-started.md) and [Release policy](release-policy.md).
57
+ Official docs: [Release Please](https://github.com/googleapis/release-please-action), [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/), [GitHub Actions event triggering](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow).
@@ -0,0 +1,82 @@
1
+ # Cấu hình từng project và từng máy
2
+
3
+ | File | Nội dung | Git |
4
+ | --- | --- | --- |
5
+ | `.harness/project.json` | Adapter/capability | Commit |
6
+ | `.harness/local.md` | Nghiệp vụ, kiến trúc, nguồn và quyết định chung | Commit |
7
+ | `.harness/environment.json` | Công cụ, lệnh, file cần có | Commit |
8
+ | `.harness/machine.json` | Đường dẫn riêng của máy, tùy chọn | Ignore |
9
+
10
+ Init/update tạo environment rỗng nếu chưa có và thêm `/machine.json` vào cuối
11
+ `.harness/.gitignore`. File đã được Git track vẫn được track: ignore không xóa khỏi index/history.
12
+ CLI không tạo file machine và không đọc nội dung Maven settings. Không ghi mật khẩu/token vào các
13
+ file Harness; credentials thuộc cơ chế quản lý riêng của công cụ.
14
+
15
+ ## Ví dụ Maven nội bộ
16
+
17
+ Cấu hình chung:
18
+
19
+ ```json
20
+ {
21
+ "schema_version": 1,
22
+ "tools": {
23
+ "maven": { "executable": "mvn", "required": true }
24
+ },
25
+ "files": {
26
+ "maven-settings": { "path": "${PROJECT_MAVEN_SETTINGS}", "required": true }
27
+ },
28
+ "commands": {
29
+ "test": { "tool": "maven", "args": ["-s", "${PROJECT_MAVEN_SETTINGS}", "verify"] }
30
+ }
31
+ }
32
+ ```
33
+
34
+ Máy Windows của bạn có thể đặt `.harness/machine.json`:
35
+
36
+ ```json
37
+ {
38
+ "schema_version": 1,
39
+ "tools": {
40
+ "maven": { "executable": "D:\\tools\\apache-maven\\bin\\mvn.cmd" }
41
+ }
42
+ }
43
+ ```
44
+
45
+ Đặt biến môi trường trong terminal của AI host, ví dụ PowerShell:
46
+
47
+ ```powershell
48
+ $env:PROJECT_MAVEN_SETTINGS = "C:\Users\YourName\.m2\settings-company.xml"
49
+ aih doctor
50
+ ```
51
+
52
+ `doctor` báo trạng thái như `present`, `missing-env`, `missing` hoặc `platform-mismatch`; không in
53
+ đường dẫn/giá trị biến/arguments. Với công cụ bắt buộc bị thiếu, exit code là 1. PATH hints chung
54
+ không thay thế executable đã cấu hình. Thiếu công cụ `required: false` chỉ là chẩn đoán.
55
+
56
+ AI host đọc command và sử dụng cách quoting đúng terminal; ví dụ PowerShell dùng toán tử `&` cho
57
+ executable có khoảng trắng. Không nối arguments thành shell text một cách mù quáng. Harness không
58
+ tự chạy lệnh, đổi JAVA_HOME, sửa settings.xml hay tải dependency.
59
+
60
+ ## Quy tắc cấu hình
61
+
62
+ - Schema 1 yêu cầu các map `tools`, `files`, `commands` (có thể rỗng); ID dùng lowercase-hyphen.
63
+ - Tool: `executable` và `required` tùy chọn, mặc định true. File: `path` và `required` tương tự.
64
+ - Command: `tool` phải trỏ tới tool đã khai báo, `args` là mảng string.
65
+ - Machine chỉ có `schema_version`, `tools`/`files` tùy chọn; chỉ override `executable`/`path` của
66
+ ID đã có. Không đổi commands, required flags hay policy.
67
+ - Đường dẫn machine ưu tiên đường dẫn project; project ưu tiên gợi ý adapter. Không fallback khi
68
+ đường dẫn được chọn không dùng được. Paths tương đối tính từ project root; executable không
69
+ chứa separator được tìm trên PATH. Paths tuyệt đối phải phù hợp OS của host.
70
+ - Chỉ cú pháp ${ENV_NAME} tham chiếu biến môi trường hiện tại. Không tự đọc .env, không mở rộng
71
+ `~` hay shell substitution. Command arguments chỉ được kiểm tra tham chiếu biến; giá trị trong
72
+ files không tự thay thế arguments. Nếu settings dùng trong args, dùng cùng biến môi trường như ví dụ.
73
+ - `files` dành cho file (settings, config), không phải thư mục JDK. Dùng biến JAVA_HOME của host
74
+ hoặc khai báo executable Java trực tiếp. Doctor không xác nhận Java/Maven version.
75
+ - `aih check` kiểm tra snapshot; `aih doctor` kiểm tra thêm environment. Dự án cũ chưa có
76
+ environment vẫn dùng được; không bắt buộc migrate chỉ để chạy check.
77
+
78
+ ## Hỏi trước, lưu lại
79
+
80
+ Chạy `aih setup` rồi nhờ AI đọc workflow `project-setup`. Host đọc repo và câu trả lời cũ trước khi
81
+ hỏi 1–3 câu A/B/C có đề xuất dựa trên bằng chứng. Các gợi ý JSON của CLI có thể được bỏ qua nếu
82
+ local.md đã trả lời. Setup không phải wizard nhập liệu và không tự ghi lựa chọn.
@@ -7,7 +7,7 @@ Distribution version is `harness.yaml` + `package.json` + `package-lock.json`. O
7
7
  2. Each module maintainer changes `module_version` only for real contract changes, describing compatibility impact in the PR.
8
8
  3. One **release PR** assigns the next distribution version, updates all three metadata files, and moves Unreleased notes into a version heading.
9
9
  4. Check CI on Linux/Windows and Node 22/24; run behavioral agent evaluations when instructions change, not just synthetic unit tests.
10
- 5. A human merges the release PR and separately approves npm publication: first version is manually published; subsequent versions require a human-published matching GitHub Release. No publishing merely on merge or tag.
10
+ 5. A human reviews/merges the feature PR, then reviews/merges the auto-generated Release Please PR. The second approval authorizes the workflow to tag/release and publish npm through OIDC, after tests. No publishing from feature PRs, and no publish-on-tag alone.
11
11
 
12
12
  ## Compatibility
13
13
  - Existing schema-1 config and locks remain valid. Optional module contract fields are additive.
@@ -1,7 +1,7 @@
1
1
  # Versioning and migration
2
2
 
3
3
  Framework version is in harness.yaml and package.json; keep both and package-lock.json synchronized. Use three-part SemVer releases and Git tags vX.Y.Z after review.
4
- 0.6.0 is a DevOps/Kubernetes candidate (0.5.0 added the Product documentation capability), not a claim of a registry publication or Git tag. Do not publish from a feature PR.
4
+ 0.6.0 was initially published manually to npm. Future versions are prepared by Release Please after human PR review; do not publish directly from a feature PR.
5
5
 
6
6
  - Patch: compatible corrections to instructions or installer defects.
7
7
  - Minor: backward-compatible adapter, skill or CLI additions.
@@ -16,13 +16,28 @@ It does not fetch releases or silently follow main. Pass a reviewed local checko
16
16
  See [release policy](release-policy.md) for independently versioned module contracts and single release-PR version ownership.
17
17
 
18
18
  ## Release procedure
19
+
20
+ **Current automation (after v0.6.0):** Release Please maintains the root distribution version, changelog and JSON-formatted harness.yaml. The human review/merge of its generated Release PR is the explicit publishing approval. See [npm release](npm-release.md).
19
21
  1. Update harness.yaml, CHANGELOG and migration notes. Review policy/behavior changes as code.
20
22
  2. Run structural validation and CLI tests on the supported Node.js 22/24 and OS matrix, including actual npm package smoke tests.
21
23
  3. Run the behavioral evaluation suite with the intended agent/model if prompts materially changed.
22
24
  4. Inspect the install/update diff in a sample consumer; document source commit and limitations.
23
- 5. Merge by human decision. First npm publication is manual. Subsequent releases use an approved GitHub Release triggering npm Trusted Publishing; merge or tag alone never publishes.
25
+ 5. Merge feature PR by human decision. Release Please opens a separate version/changelog PR; after human review and merge, the release workflow creates the tag and GitHub Release and publishes npm from the same workflow through OIDC. Merge of feature PR alone does not publish.
26
+
27
+ ## Project setup and readiness additions (unreleased)
28
+
29
+ The project/lock schema remains 1. Update adds optional project-owned environment.json plus the
30
+ scoped machine.json ignore rule and new managed workflows/templates. Existing local.md, environment,
31
+ machine data and old OpenSpec changes survive. No machine paths are created or committed automatically.
32
+ Doctor only enforces declared required environment entries; empty or absent configuration remains valid.
33
+ Existing changes need decision/evidence sidecars only when using the new ready command.
24
34
 
25
35
  ## Consumer update
36
+ For global npm installs, first run `npm install -g @manhd_d/ai-harness@latest`.
37
+ For local installs, update the local dependency and use `npx aih`.
38
+ `aih --version` identifies the CLI; `aih check` identifies the installed project snapshot.
39
+ `aih update` applies the installed CLI bundle (or explicit `--source`), without fetching releases.
40
+
26
41
  Create a branch, commit current state, obtain the reviewed source commit/tag and inspect CHANGELOG.
27
42
  Run update --dry-run; resolve conflicts by moving custom rules into .harness/local.md and restoring
28
43
  managed files from the last installation commit. Apply update and run check plus application tests.
@@ -82,8 +97,8 @@ Do not treat raw Confluence data, drafts or AI review as approved business decis
82
97
 
83
98
  ## 0.5 → 0.6 migration
84
99
 
85
- No new configuration/lock schema version: 0.5 Product templates, `aih new-doc`, UI/UX and all earlier adapter selections stay compatible. New DevOps and Kubernetes modules are opt-in. On a consumer branch, pin a reviewed 0.6 source/package, add `"devops"` to `.harness/project.json` capabilities and/or `"kubernetes"` to adapters, then run `aih update --dry-run`, `aih update` and `aih check`. Unmodified installed payload updates safely; any drift still blocks update. Application DevOps workflows remain instruction-only and do not deploy production workloads; a separate repository-level npm workflow publishes only after a human-approved GitHub Release.
100
+ No new configuration/lock schema version: 0.5 Product templates, `aih new-doc`, UI/UX and all earlier adapter selections stay compatible. New DevOps and Kubernetes modules are opt-in. On a consumer branch, pin a reviewed 0.6 source/package, add `"devops"` to `.harness/project.json` capabilities and/or `"kubernetes"` to adapters, then run `aih update --dry-run`, `aih update` and `aih check`. Unmodified installed payload updates safely; any drift still blocks update. Application DevOps workflows remain instruction-only and do not deploy production workloads; a separate repository-level npm workflow publishes only after a human-approved Release Please PR creates a tagged GitHub Release.
86
101
 
87
102
  ## Foundation hardening (unreleased after 0.6)
88
103
 
89
- Module contracts gain optional version and dependency fields without changing config/lock schema 1. Existing consumer snapshots retain default adapter-only verify/eval. After a reviewed update, `--scope all` enables locked Core/capability/composition evaluation, and `--scope core` works in core-only projects. Feature branches retain distribution version 0.6.0; release PR chooses the next number. Use tagged releases for other consumers rather than interpreting an unreleased commit as a published update.
104
+ Module contracts gain optional version and dependency fields without changing config/lock schema 1. Existing consumer snapshots retain default adapter-only verify/eval. After a reviewed update, `--scope all` enables locked Core/capability/composition evaluation, and `--scope core` works in core-only projects. Feature branches keep the latest release version; Release Please's generated PR chooses and synchronizes the next number. Use tagged releases for other consumers rather than interpreting an unreleased commit as a published update.
package/evals/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Behavioral evaluation
2
2
 
3
+ For controlled with/without-Harness trials, use [Real-task comparison](real-task-comparison.md).
4
+ The protocol is unperformed; no effectiveness result is implied by the supplied cases or CLI tests.
5
+
3
6
  The cases are scenarios to run through your actual agent/IDE with the installed harness and a disposable
4
7
  project. They are not mocked model transcripts and are not automatically run by CI.
5
8
  No live model or tool-side-effect evaluation has been performed for this initial implementation.
@@ -0,0 +1,49 @@
1
+ # Real-task comparison protocol (unperformed)
2
+
3
+ Purpose: measure whether the installed Harness improves actual delivery, not whether its CLI passes.
4
+ No results are supplied here. Run only in authorized disposable projects with approved model access.
5
+
6
+ Use the same starting commit, model/version, runtime permissions, task, tools and time budget for both
7
+ conditions. Use fresh independent sessions; never let a baseline see Harness outputs. Alternate order.
8
+ Do not relax runtime security for the baseline. Preserve all runs, including failed or interrupted runs.
9
+
10
+ | Task | Observable acceptance |
11
+ | --- | --- |
12
+ | Spring API from a short BA requirement | Correct contract/auth, duplicate behavior clarified, meaningful tests run |
13
+ | Transaction/notification defect | Reproduce failure, preserve transaction boundaries, regression test passes |
14
+ | Internal Maven onboarding | Ask only missing setup details, use supplied tool path, no invented successful build |
15
+
16
+ Run each task at least three times per condition. Review blind to condition when feasible.
17
+ Record accepted/total criteria, failing tests, consequential assumptions made without asking, human
18
+ correction rounds, unnecessary questions, elapsed time, actual token/cost if available, and trace/log
19
+ references. Use null for unavailable metrics. Do not convert missing evidence to zero cost or success.
20
+
21
+ Keep the unscored report template below with project-owned evaluation artifacts. Fill only from
22
+ observations; this is separate from the boolean behavioral report accepted by `aih eval --report`.
23
+
24
+ ```json
25
+ {
26
+ "status": "unperformed",
27
+ "model": null,
28
+ "runtime": null,
29
+ "harness_commit": null,
30
+ "starting_commit": null,
31
+ "task_id": null,
32
+ "condition": null,
33
+ "run_id": null,
34
+ "accepted_criteria": null,
35
+ "total_criteria": null,
36
+ "tests": null,
37
+ "unasked_consequential_assumptions": null,
38
+ "human_correction_rounds": null,
39
+ "unnecessary_questions": null,
40
+ "elapsed_seconds": null,
41
+ "tokens": null,
42
+ "cost": null,
43
+ "evidence": []
44
+ }
45
+ ```
46
+
47
+ Report per-task outcomes and variation across repeats. Distinguish instruction-following gains from
48
+ model capability and runtime differences. Do not claim a general productivity gain from one anecdote.
49
+ Any safety/authorization regression remains visible even if average completion time improves.
package/harness.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "name": "ai-harness",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "adapters": [
6
6
  "java-spring",
7
7
  "react-nextjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manhd_d/ai-harness",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Reusable AI development rules, skills and workflows with a safe local installer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,9 +1,14 @@
1
1
  <!-- ai-harness:start -->
2
2
  ## AI Harness {{version}}
3
3
 
4
- 1. Read `.harness/core/rules/foundations.md` and `.harness/core/policies/security.md`.
4
+ 1. Read `.harness/core/rules/foundations.md`, `.harness/core/rules/context.md` and `.harness/core/policies/security.md`.
5
5
  2. Read `.harness/core/policies/permissions.md` and `.harness/core/workflows/spec-to-code.md`.
6
- 3. Read `.harness/local.md` for project facts and reviewed exceptions.
6
+ 3. Read `.harness/local.md` and `.harness/environment.json` (if present) for project facts and commands.
7
+ For first-run or missing environment facts, use `.harness/core/workflows/project-setup.md`.
8
+ Machine paths may come from ignored `.harness/machine.json`; do not copy private values into shared files.
9
+ Before consequential implementation, follow `.harness/core/workflows/clarification.md`:
10
+ inspect existing answers, ask 1–3 A/B/C questions with grounded recommendations only where needed,
11
+ record decisions, then continue within existing authorization.
7
12
  4. Load only the adapter and skills needed for the current task:
8
13
  {{adapters}}
9
14
  5. For optional capabilities, read only their selected workflow and relevant skill descriptions:
@@ -0,0 +1,6 @@
1
+ {
2
+ "schema_version": 1,
3
+ "tools": {},
4
+ "files": {},
5
+ "commands": {}
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "schema_version": 1,
3
+ "reviewed": false,
4
+ "decisions": []
5
+ }