@damphuquy/agent-init 1.2.4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,114 +8,60 @@
8
8
 
9
9
  ---
10
10
 
11
- A structured scaffolding framework for AI Coding Agents following the **RIPER-5 Framework** — cleanly separated into three independent layers: `AGENTS.md` (entry point), `.agents/` (agent control), and `process/` (engineering workflow).
11
+ A structured scaffolding framework for AI Coding Agents following the **RIPER-5 Framework** — cleanly separated into three layers: `AGENTS.md` (project configuration), `.agents/` (agent behavioral controls), and `process/` (task execution and verification workflow).
12
12
 
13
13
  ```bash
14
- # Bootstrap immediately into your project
15
- npx @damphuquy/agent-init ./my-project
14
+ # Bootstrap immediately into your project (takes 30 seconds)
15
+ npx @damphuquy/agent-init .
16
16
  ```
17
17
 
18
18
  ---
19
19
 
20
- ### 3-Layer Architecture
20
+ ## 🚀 Documentation
21
21
 
22
- ```
23
- AGENTS.md ← Entry point: project-specific toolchain + RIPER-5 phase definitions
24
- .agents/ ← Agent control layer: mode declaration, guardrails, conventions
25
- process/ ← Engineering workflow: task artifacts, seed blueprints, context
26
- ```
22
+ Designed for minimal overhead, practical focus, and zero fluff:
27
23
 
28
- Each layer has single-responsibility ownership with **Zero Duplication**.
29
- Full architectural details [`docs/en/01-overview.md`](docs/en/01-overview.md)
24
+ ### 1. For Daily Development (Start Here)
25
+ * 📘 **[01 · Hands-on Walkthrough from A–Z](docs/en/01-getting-started.md)**: **The only guide you need to get started**. Step-by-step instructions with **a complete end-to-end example** (adding a user change-password endpoint), prompt templates, and quality gate sign-offs.
26
+ * ⚡ **[02 · Daily Cheat Sheet](docs/en/02-cheat-sheet.md)**: Copy-paste prompt templates for each phase, quality gates summary (Gates G0–G3), and file ownership matrix (Human vs Agent).
30
27
 
31
- > 💡 **Note on Context Router:** All long-term domain knowledge, database schemas, and architectural invariants stored in `process/context/` must be registered in [`process/context/all-context.md`](templates/process/context/all-context.md). Agents rely on this router to selectively load context, preventing token waste and unconstrained repository scans.
28
+ ### 2. In-Depth Reference (For Tech Leads & Maintainers)
29
+ * 🏛️ **[3-Layer Architecture & Context Router](docs/en/reference/architecture.md)**: Deep dive into the 3-layer decoupled architecture and Minimum Sufficient Context principles (No Full-Repo Scan).
30
+ * 🚢 **[DevOps & Release Automation](docs/en/reference/devops-release.md)**: CI/CD release lifecycle, automated Semantic Versioning, and NPM package publishing.
32
31
 
33
32
  ---
34
33
 
35
- ### RIPER-5 End-to-End Workflow
34
+ ## 5-Step Daily Collaboration Workflow
36
35
 
37
36
  ```
38
- [Task Inception] ──► [0. Task Init: task.md] (Human defines spec & AC)
39
-
40
-
41
- [1. RESEARCH] (Agent reads context ──► research.md ──► Gate G0)
42
-
43
-
44
- [2. INNOVATE] (Agent creates 2-3 options in decision.md ──► Gate G1: Human Approval)
45
-
46
-
47
- [3. PLAN] (Agent creates vertical slices in plan.md ──► Gate G2: Human Sign-off)
48
-
49
-
50
- [4. EXECUTE] (Agent implements slice-by-slice ──► tests pass ──► state.md)
51
-
52
-
53
- [5. REVIEW] (Agent audits behavior/security in review.md ──► Gate G3: Human Approval)
54
-
55
-
56
- [COMPLETE] (Archive to completed/ ──► handoff.md)
37
+ ┌────────────────────────────────────────────────────────────────────────────────┐
38
+ YOUR 5-STEP DAILY WORKFLOW WITH AGENTS │
39
+ ├────────────────────────────────────────────────────────────────────────────────┤
40
+ 1. YOU: Create task folder & describe spec in task.md (1 min)
41
+ 2. PROMPT AGENT: "Read task.md, start RESEARCH" ──► Agent inspects codebase │
42
+ │ 3. YOU: Pick architectural option & sign Gate G1 in decision.md (30 secs) │
43
+ │ 4. YOU: Verify allowed files list & sign Gate G2 in plan.md (30 secs)
44
+ 5. AGENT CODES & TESTS ──► YOU: Review git diff, sign Gate G3, commit & push! │
45
+ └────────────────────────────────────────────────────────────────────────────────┘
57
46
  ```
58
- *(Interactive Mermaid diagram available in [`docs/en/01-overview.md`](docs/en/01-overview.md#riper-5-end-to-end-workflow-diagram))*.
59
-
60
- ---
61
-
62
- ### Documentation
63
-
64
- | Document | Description |
65
- |---|---|
66
- | [01 · Overview & Architecture](docs/en/01-overview.md) | Mental model, 3-layer design, info flow, workflow diagram |
67
- | [02 · Layer: `.agents/`](docs/en/02-layer-agents.md) | File-by-file: behavior, guardrails, conventions |
68
- | [03 · Layer: `process/`](docs/en/03-layer-process.md) | File-by-file: seeds, context router, artifact chain |
69
- | [04 · Layer: `AGENTS.md`](docs/en/04-layer-agentsmd.md) | Entry point anatomy & project customization |
70
- | [05 · Workflow: New Task](docs/en/05-workflow-new-task.md) | Step-by-step tutorial: idea → completed task |
71
- | [06 · Human vs Agent](docs/en/06-human-vs-agent.md) | Responsibility matrix & Quality Gates (G0–G3) deep dive |
72
- | [07 · Deployment](docs/en/07-deployment.md) | Bootstrap options, monorepo setup, troubleshooting |
73
- | [08 · Developer Playbook](docs/en/08-developer-workflow-playbook.md) | Practical scenarios, day-to-day operations, prompt cheat sheet |
74
- | [Note · DevOps CI/CD & Release](docs/en/note/devops-release-automation.md) | Automated SemVer, 2FA npm tokens, Git tag sync |
75
47
 
76
48
  ---
77
49
 
78
- ### Quick-start (5 minutes)
50
+ ## 📦 NPX CLI Commands
79
51
 
80
52
  ```bash
81
- # 1. Bootstrap template into your target project
82
- npx @damphuquy/agent-init ./my-project
53
+ # Bootstrap in current directory
54
+ npx @damphuquy/agent-init .
83
55
 
84
- # 2. Configure project toolchain in AGENTS.md (2 mins)
85
- # Find <validation_commands> and enter your test/lint commands
56
+ # Bootstrap into a subfolder/monorepo package
57
+ npx @damphuquy/agent-init ./services/billing
86
58
 
87
- # 3. Instantiate your first active task
88
- cp my-project/process/_seeds/task-template.md.seed \
89
- my-project/process/general-plans/active/CHG-001-init/task.md
90
-
91
- # 4. Prompt your AI Agent to begin
92
- # "Read AGENTS.md and task.md, start RESEARCH phase."
59
+ # Force overwrite existing scaffold files
60
+ npx @damphuquy/agent-init . --force
93
61
  ```
94
62
 
95
63
  ---
96
64
 
97
- ### NPX CLI Options
98
-
99
- ```bash
100
- npx @damphuquy/agent-init . # Bootstrap in current directory
101
- npx @damphuquy/agent-init ./services/billing # Bootstrap into a monorepo subsystem
102
- npx @damphuquy/agent-init ./my-project --force # Overwrite existing files
103
- ```
104
-
105
- ---
65
+ ## 📄 License
106
66
 
107
- ### CI/CD & Automated NPM Release
108
-
109
- This repository includes a continuous integration and release pipeline configured at [`.github/workflows/release.yml`](.github/workflows/release.yml):
110
-
111
- 1. **Automated Semantic Versioning:** On pushes to `main`, commit messages determine the version bump:
112
- - `BREAKING CHANGE:`, `!:`, `major:` $\rightarrow$ **Major** bump (`2.0.0`)
113
- - `feat:` $\rightarrow$ **Minor** bump (`1.1.0`)
114
- - `fix:`, `chore:`, `docs:`, etc. $\rightarrow$ **Patch** bump (`1.0.4`)
115
- *(Manual version increments in `package.json` are automatically respected)*.
116
- 2. **Git Tagging & GitHub Release:** Automatically creates and pushes the tag (e.g. `v1.1.0`), commits `package.json` with `[skip ci]`, and publishes GitHub Release notes.
117
- 3. **NPM Publishing:** Automatically packages and publishes to npm registry using `NPM_TOKEN` (Classic Token with **Automation** type).
118
- 4. **Local Sync:** To sync newly generated tags and commits locally:
119
- ```bash
120
- git pull --tags origin main
121
- ```
67
+ Licensed under the [MIT License](LICENSE).
package/README.vi.md CHANGED
@@ -8,114 +8,60 @@
8
8
 
9
9
  ---
10
10
 
11
- Hệ thống mẫu (scaffold) điều phối AI Coding Agent theo chuẩn **RIPER-5 Framework** — phân tách thành ba layer rõ ràng: `AGENTS.md` (entry point), `.agents/` (agent control), và `process/` (engineering workflow).
11
+ Hệ thống mẫu (scaffold) điều phối AI Coding Agent theo chuẩn **RIPER-5 Framework** — phân tách thành ba layer rõ ràng: `AGENTS.md` (cấu hình dự án), `.agents/` (quy chuẩn hành vi của Agent), và `process/` (quy trình thực thi task và kiểm thử).
12
12
 
13
13
  ```bash
14
- # Khởi tạo ngay vào project của bạn
15
- npx @damphuquy/agent-init ./my-project
14
+ # Khởi tạo ngay vào project của bạn (chỉ mất 30 giây)
15
+ npx @damphuquy/agent-init .
16
16
  ```
17
17
 
18
18
  ---
19
19
 
20
- ### Kiến trúc 3-layer
20
+ ## 🚀 Tài liệu Hướng dẫn
21
21
 
22
- ```
23
- AGENTS.md ← Entry point: cấu hình project + định nghĩa các phase RIPER-5
24
- .agents/ ← Agent control layer: hành vi, guardrails, quy chuẩn code
25
- process/ ← Engineering workflow: task artifacts, seed blueprints, context
26
- ```
22
+ Tài liệu được thiết kế tối giản, tập trung vào thực hành, không lý thuyết rườm rà:
27
23
 
28
- Mỗi layer chịu trách nhiệm độc lập theo nguyên tắc **Zero Duplication**.
29
- Chi tiết kiến trúc [`docs/vi/01-overview.md`](docs/vi/01-overview.md)
24
+ ### 1. Dành cho công việc hằng ngày (Bắt đầu tại đây)
25
+ * 📘 **[01 · Hướng dẫn Thực chiến từ A–Z (Hands-on Walkthrough)](docs/vi/01-getting-started.md)**: **Tài liệu duy nhất bạn cần đọc để bắt đầu**. Hướng dẫn từng bước với **ví dụ cụ thể xuyên suốt** (thêm chức năng đổi mật khẩu), chi tiết ai làm gì, gõ lệnh gì, prompt mẫu và cách ký duyệt qua các cổng.
26
+ * ⚡ **[02 · Sổ tay Tra cứu Nhanh (Cheat Sheet)](docs/vi/02-cheat-sheet.md)**: Bảng copy-paste prompt mẫu cho từng giai đoạn, bảng 4 cổng kiểm soát (Gates G0–G3), và ma trận quyền hạn file (Human vs Agent).
30
27
 
31
- > 💡 **Lưu ý về Context Router:** Mọi tri thức domain lâu dài, database schema và quy tắc kiến trúc lưu trong `process/context/` đều cần được đăng ký định tuyến trong [`process/context/all-context.md`](templates/process/context/all-context.md). Agent sẽ dựa vào router này để nạp đúng ngữ cảnh khi cần, tránh scan bừa bãi toàn bộ repository.
28
+ ### 2. Tài liệu Chuyên sâu & Tham khảo (Dành cho Lead / Maintainer)
29
+ * 🏛️ **[Kiến trúc 3 Tầng & Cơ chế Context Router](docs/vi/reference/architecture.md)**: Giải thích sâu về thiết kế tách rời 3 layer và cơ chế nạp ngữ cảnh tối thiểu (No Full-Repo Scan).
30
+ * 🚢 **[Cẩm nang DevOps & Tự động hóa Phát hành](docs/vi/reference/devops-release.md)**: Quy trình CI/CD tự động tính Semantic Versioning và publish package lên NPM.
32
31
 
33
32
  ---
34
33
 
35
- ### đồ Tổng quát Quy trình RIPER-5 (Workflows)
34
+ ## Quy trình Phối hợp 5 Bước trong 1 Phút
36
35
 
37
36
  ```
38
- [Khởi tạo Idea] ──► [0. Khởi tạo Task: task.md] (Human định nghĩa spec & AC)
39
-
40
-
41
- [1. RESEARCH] (Agent nạp context ──► research.md ──► Gate G0)
42
-
43
-
44
- [2. INNOVATE] (Agent tạo 2-3 options trong decision.md ──► Gate G1: Human duyệt)
45
-
46
-
47
- [3. PLAN] (Agent chia vertical slices trong plan.md ──► Gate G2: Human duyệt)
48
-
49
-
50
- [4. EXECUTE] (Agent code từng slice ──► test verifier ──► state.md)
51
-
52
-
53
- [5. REVIEW] (Agent kiểm định đa chiều trong review.md ──► Gate G3: Human duyệt)
54
-
55
-
56
- [COMPLETE] (Lưu trữ completed/ ──► handoff.md)
37
+ ┌────────────────────────────────────────────────────────────────────────────────┐
38
+ QUY TRÌNH 5 BƯỚC HẰNG NGÀY CỦA BẠN │
39
+ ├────────────────────────────────────────────────────────────────────────────────┤
40
+ 1. BẠN: Tạo thư mục task & viết yêu cầu vào task.md (1 phút)
41
+ 2. PROMPT AGENT: "Đọc task.md, bắt đầu RESEARCH" ──► Agent tự khảo sát code │
42
+ │ 3. BẠN: Chọn phương án kiến trúc & ký Gate G1 trong decision.md (30 giây) │
43
+ │ 4. BẠN: Xem danh sách file được sửa & Gate G2 trong plan.md (30 giây)
44
+ 5. AGENT CODE & TEST ──► BẠN: Kiểm tra git diff, ký Gate G3, commit & push! │
45
+ └────────────────────────────────────────────────────────────────────────────────┘
57
46
  ```
58
- *(Sơ đồ tương tác chi tiết Mermaid có tại [`docs/vi/01-overview.md`](docs/vi/01-overview.md#sơ-đồ-tổng-quát-quy-trình-riper-5-workflows))*.
59
-
60
- ---
61
-
62
- ### Tài liệu hướng dẫn
63
-
64
- | Tài liệu | Nội dung |
65
- |---|---|
66
- | [01 · Overview & Architecture](docs/vi/01-overview.md) | Mental model, thiết kế 3 layer, luồng thông tin, sơ đồ workflow |
67
- | [02 · Layer: `.agents/`](docs/vi/02-layer-agents.md) | Chi tiết: behavior, guardrails, conventions |
68
- | [03 · Layer: `process/`](docs/vi/03-layer-process.md) | Chi tiết: seeds, context router, chuỗi artifact |
69
- | [04 · Layer: `AGENTS.md`](docs/vi/04-layer-agentsmd.md) | Cấu trúc entry point & cách tùy biến theo project |
70
- | [05 · Workflow: Tạo task mới](docs/vi/05-workflow-new-task.md) | Hướng dẫn từng bước: từ ý tưởng đến hoàn thành |
71
- | [06 · Human vs Agent](docs/vi/06-human-vs-agent.md) | Ma trận trách nhiệm & chi tiết 4 Cổng kiểm soát (Gates G0–G3) |
72
- | [07 · Deployment](docs/vi/07-deployment.md) | Các cách bootstrap, cấu hình monorepo, xử lý sự cố |
73
- | [08 · Cẩm nang Kỹ thuật](docs/vi/08-developer-workflow-playbook.md) | Tình huống thực tế, thao tác hằng ngày, bảng prompt mẫu |
74
- | [Note · DevOps CI/CD & Release](docs/vi/note/devops-release-automation.md) | Cẩm nang DevOps, xử lý token 2FA npm, đồng bộ Git tag |
75
47
 
76
48
  ---
77
49
 
78
- ### Quick-start (5 phút)
50
+ ## 📦 Các Lệnh NPX CLI Tiện ích
79
51
 
80
52
  ```bash
81
- # 1. Bootstrap template vào project của bạn
82
- npx @damphuquy/agent-init ./my-project
53
+ # Khởi tạo tại thư mục hiện tại
54
+ npx @damphuquy/agent-init .
83
55
 
84
- # 2. Mở AGENTS.md, cấu hình toolchain (2 phút)
85
- # Tìm thẻ <validation_commands> và điền lệnh test/lint của dự án
56
+ # Khởi tạo vào một thư mục con trong monorepo
57
+ npx @damphuquy/agent-init ./services/billing
86
58
 
87
- # 3. Khởi tạo task đầu tiên
88
- cp my-project/process/_seeds/task-template.md.seed \
89
- my-project/process/general-plans/active/CHG-001-init/task.md
90
-
91
- # 4. Yêu cầu AI Agent bắt đầu
92
- # "Đọc AGENTS.md và task.md, bắt đầu phase RESEARCH."
59
+ # Ghi đè file nếu đã tồn tại
60
+ npx @damphuquy/agent-init . --force
93
61
  ```
94
62
 
95
63
  ---
96
64
 
97
- ### Tùy chọn lệnh NPX CLI
98
-
99
- ```bash
100
- npx @damphuquy/agent-init . # Khởi tạo tại thư mục hiện tại
101
- npx @damphuquy/agent-init ./services/billing # Khởi tạo vào subsystem trong monorepo
102
- npx @damphuquy/agent-init ./my-project --force # Ghi đè file nếu đã tồn tại
103
- ```
104
-
105
- ---
65
+ ## 📄 Giấy phép
106
66
 
107
- ### Quy trình CI/CD & Tự động Publish lên NPM
108
-
109
- Repository được thiết lập pipeline tự động hóa tại [`.github/workflows/release.yml`](.github/workflows/release.yml):
110
-
111
- 1. **Tự động tính toán Semantic Versioning:** Khi push code lên nhánh `main`, hệ thống tự phát hiện version dựa trên commit message:
112
- - `BREAKING CHANGE:`, `!:`, `major:` $\rightarrow$ Tăng **Major** (`2.0.0`)
113
- - `feat:` $\rightarrow$ Tăng **Minor** (`1.1.0`)
114
- - `fix:`, `chore:`, `docs:`, ... $\rightarrow$ Tăng **Patch** (`1.0.4`)
115
- *(Nếu bạn chủ động sửa version trong `package.json`, CI sẽ tự nhận diện version đó)*.
116
- 2. **Tự động gắn Git Tag & Tạo GitHub Release:** Tự tạo tag `vX.Y.Z`, commit cập nhật `package.json` kèm `[skip ci]` và sinh release notes trên GitHub.
117
- 3. **Tự động Publish NPM:** Build và đẩy package lên npm registry bằng `NPM_TOKEN` (loại Classic **Automation** token).
118
- 4. **Đồng bộ về máy Local:** Để kéo commit và Git tag mới nhất về máy sau khi CI hoàn tất:
119
- ```bash
120
- git pull --tags origin main
121
- ```
67
+ Phát hành dưới giấy phép [MIT](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@damphuquy/agent-init",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
4
4
  "description": "Scaffolding CLI to bootstrap RIPER-5 Coding Agents & Operational Workspace",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,7 +57,8 @@
57
57
  2. All validation commands (as defined in `AGENTS.md`) execute with
58
58
  zero errors and zero warnings.
59
59
  3. Gate 3 in `review.md` is checked and review decision is PASS.
60
- 4. The final `git diff` contains zero extraneous or unreviewed modifications.
60
+ 4. The final `git diff` contains zero extraneous or unreviewed modifications,
61
+ and all transient debug code/scratch artifacts are completely removed.
61
62
  5. Task folder is moved to `completed/` and `handoff.md` is produced.
62
63
  </completion_gate>
63
64
 
@@ -73,4 +74,40 @@
73
74
  coordination is requested and approved.
74
75
  </invariants>
75
76
 
77
+ ---
78
+
79
+ ## 5. Command Safety & Destructive Action Blacklist
80
+
81
+ <command_safety>
82
+ The agent must NEVER execute destructive, irreversible, or credential-leaking commands:
83
+
84
+ - **Git Operations:** Never execute `git push --force`, `git push -f`, `git reset --hard`,
85
+ or `git clean -fdx` unless explicitly authorized by the human engineer in the current session.
86
+ - **Filesystem Deletion:** Never execute unconstrained recursive deletion (e.g. `rm -rf /`,
87
+ `rm -rf ~`, `rm -rf .`) or delete files outside the immediate active task scope.
88
+ - **Database DDL/DML:** Never execute destructive data operations without explicit prior approval
89
+ (`DROP DATABASE`, `DROP TABLE`, `TRUNCATE`, or `DELETE` queries lacking a specific `WHERE` clause).
90
+ - **Secrets & Credentials:** Never read, print, log, or export contents of `.env*`, `*.pem`,
91
+ `*.key`, SSH keys, or cloud credential stores into task artifacts or conversation output.
92
+ - **Environment Containment:** Execute commands exclusively through the designated harness
93
+ `<validation_commands>` or standard package managers. Never download or execute arbitrary
94
+ remote binary scripts (`curl ... | bash`).
95
+ </command_safety>
96
+
97
+ ---
98
+
99
+ ## 6. Session Housekeeping & Teardown Protocol
100
+
101
+ <housekeeping_protocol>
102
+ Before requesting Gate 3 sign-off or marking a task COMPLETE, the agent must perform full teardown:
103
+
104
+ 1. **Transient Debug Removal:** Remove all temporary debugging lines (`console.log`, `print()`,
105
+ `debugger`, `dump()`, `pprint()`, or commented-out experiment blocks) introduced during execution.
106
+ 2. **Scratch Cleanup:** Delete temporary mock files, scratch test scripts, and transient SQLite/data
107
+ dumps created during the execution loop.
108
+ 3. **Diff Sanitization:** Run `git status` and `git diff` to ensure that only the intentional, scoped
109
+ files agreed upon in `plan.md` have been modified.
110
+ 4. **State Finalization:** Ensure `state.md` is cleanly synchronized and generate `handoff.md`.
111
+ </housekeeping_protocol>
112
+
76
113
  </agent_guardrails>
@@ -126,6 +126,8 @@
126
126
  <rule id="isolation">Keep edits within this subsystem unless explicit cross-system coordination is requested.</rule>
127
127
  <rule id="subagents">Subagent delegation must adhere to [`process/development-protocols/orchestration.md`](process/development-protocols/orchestration.md).</rule>
128
128
  <rule id="no_stale_context">Re-read relevant files after the repository changes. Do not rely on stale conversation context.</rule>
129
+ <rule id="command_safety">Never run destructive commands (force push, hard reset, unconstrained rm -rf, DDL drops, secret inspection). See .agents/guardrails.md.</rule>
130
+ <rule id="housekeeping">Remove all debug logs, scratch artifacts, and verify git diff cleanliness before Gate G3.</rule>
129
131
  </workspace_rules>
130
132
 
131
133
  </agent_guidelines>
@@ -135,7 +135,8 @@
135
135
  ## Gate 3 — Review Passed
136
136
 
137
137
  <gate id="G3">
138
- - [ ] Full diff reviewed.
138
+ - [ ] Full diff reviewed (zero extraneous changes).
139
+ - [ ] Housekeeping complete: all transient debug logs, print statements, and scratch files removed.
139
140
  - [ ] All required evidence exists and is attached.
140
141
  - [ ] All findings triaged (Confirmed Defects resolved or risk-accepted).
141
142
  - [ ] Residual risk explicitly accepted.