@damphuquy/agent-init 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/README.vi.md +8 -2
- package/dist/cli.d.ts +4 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +49 -5
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +4 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +71 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/scaffolder.d.ts +2 -1
- package/dist/scaffolder.d.ts.map +1 -1
- package/dist/scaffolder.js +64 -12
- package/dist/scaffolder.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +3 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +71 -6
- package/dist/ui.js.map +1 -1
- package/package.json +2 -2
- package/templates/en/process/.editorconfig +15 -0
- package/templates/{process → en/process}/README.md +10 -2
- package/templates/{process → en/process}/_seeds/_GUIDE.md +37 -8
- package/templates/en/process/_seeds/cancellation-template.md.seed +79 -0
- package/templates/en/process/_seeds/results-template.tsv.seed +5 -0
- package/templates/{process → en/process}/context/all-context.md +6 -0
- package/templates/en/process/context/tests/all-tests.md +56 -0
- package/templates/vi/.agents/README.md +29 -0
- package/templates/vi/.agents/behavior.md +72 -0
- package/templates/vi/.agents/conventions/naming.md +55 -0
- package/templates/vi/.agents/guardrails.md +113 -0
- package/templates/vi/AGENTS.md +133 -0
- package/templates/vi/process/.editorconfig +15 -0
- package/templates/vi/process/README.md +150 -0
- package/templates/vi/process/_seeds/_GUIDE.md +170 -0
- package/templates/vi/process/_seeds/cancellation-template.md.seed +79 -0
- package/templates/vi/process/_seeds/context-group.md.seed +154 -0
- package/templates/vi/process/_seeds/decision-template.md.seed +143 -0
- package/templates/vi/process/_seeds/handoff-template.md.seed +79 -0
- package/templates/vi/process/_seeds/plan-template.md.seed +135 -0
- package/templates/vi/process/_seeds/program-template.md.seed +56 -0
- package/templates/vi/process/_seeds/results-template.tsv.seed +5 -0
- package/templates/vi/process/_seeds/review-template.md.seed +149 -0
- package/templates/vi/process/_seeds/state-template.md.seed +149 -0
- package/templates/vi/process/_seeds/task-template.md.seed +196 -0
- package/templates/vi/process/context/all-context.md +53 -0
- package/templates/vi/process/context/planning/all-planning.md +31 -0
- package/templates/vi/process/context/tests/all-tests.md +56 -0
- package/templates/vi/process/development-protocols/all-development-protocols.md +27 -0
- package/templates/vi/process/development-protocols/implementation-standards.md +28 -0
- package/templates/vi/process/development-protocols/orchestration.md +24 -0
- package/templates/vi/process/features/active/.gitkeep +0 -0
- package/templates/vi/process/features/backlog/.gitkeep +0 -0
- package/templates/vi/process/features/completed/.gitkeep +0 -0
- package/templates/vi/process/general-plans/active/.gitkeep +0 -0
- package/templates/vi/process/general-plans/backlog/.gitkeep +0 -0
- package/templates/vi/process/general-plans/completed/.gitkeep +0 -0
- /package/templates/{.agents → en/.agents}/README.md +0 -0
- /package/templates/{.agents → en/.agents}/behavior.md +0 -0
- /package/templates/{.agents → en/.agents}/conventions/naming.md +0 -0
- /package/templates/{.agents → en/.agents}/guardrails.md +0 -0
- /package/templates/{AGENTS.md → en/AGENTS.md} +0 -0
- /package/templates/{process → en/process}/_seeds/context-group.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/decision-template.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/handoff-template.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/plan-template.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/program-template.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/review-template.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/state-template.md.seed +0 -0
- /package/templates/{process → en/process}/_seeds/task-template.md.seed +0 -0
- /package/templates/{process → en/process}/context/planning/all-planning.md +0 -0
- /package/templates/{process → en/process}/development-protocols/all-development-protocols.md +0 -0
- /package/templates/{process → en/process}/development-protocols/implementation-standards.md +0 -0
- /package/templates/{process → en/process}/development-protocols/orchestration.md +0 -0
- /package/templates/{process → en/process}/features/active/.gitkeep +0 -0
- /package/templates/{process → en/process}/features/backlog/.gitkeep +0 -0
- /package/templates/{process → en/process}/features/completed/.gitkeep +0 -0
- /package/templates/{process → en/process}/general-plans/active/.gitkeep +0 -0
- /package/templates/{process → en/process}/general-plans/backlog/.gitkeep +0 -0
- /package/templates/{process → en/process}/general-plans/completed/.gitkeep +0 -0
package/dist/ui.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import readline from 'node:readline';
|
|
2
|
+
import process from 'node:process';
|
|
1
3
|
export function stripAnsi(str) {
|
|
2
4
|
return String(str).replace(/\x1b\[[0-9;]*m/g, '');
|
|
3
5
|
}
|
|
@@ -58,6 +60,62 @@ export function renderBanner(pkgInfo, colors) {
|
|
|
58
60
|
console.log(renderBox(bannerLines, colors));
|
|
59
61
|
console.log();
|
|
60
62
|
}
|
|
63
|
+
export function askQuestion(query) {
|
|
64
|
+
if (process.stdin.destroyed || !process.stdin.readable) {
|
|
65
|
+
return Promise.resolve('');
|
|
66
|
+
}
|
|
67
|
+
const rl = readline.createInterface({
|
|
68
|
+
input: process.stdin,
|
|
69
|
+
output: process.stdout,
|
|
70
|
+
});
|
|
71
|
+
return new Promise((resolve) => {
|
|
72
|
+
let resolved = false;
|
|
73
|
+
const onDone = (val) => {
|
|
74
|
+
if (!resolved) {
|
|
75
|
+
resolved = true;
|
|
76
|
+
rl.close();
|
|
77
|
+
resolve(val);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
rl.question(query, (answer) => {
|
|
81
|
+
onDone(answer);
|
|
82
|
+
});
|
|
83
|
+
rl.on('close', () => {
|
|
84
|
+
onDone('');
|
|
85
|
+
});
|
|
86
|
+
rl.on('error', () => {
|
|
87
|
+
onDone('');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export async function promptLanguage(colors) {
|
|
92
|
+
if (process.env.CI || process.stdin.destroyed || !process.stdin.readable) {
|
|
93
|
+
return 'en';
|
|
94
|
+
}
|
|
95
|
+
const promptLines = [
|
|
96
|
+
colors.purple(colors.bold('SELECT TEMPLATE LANGUAGE / CHỌN NGÔN NGỮ TEMPLATE')),
|
|
97
|
+
'',
|
|
98
|
+
` ${colors.cyan(colors.bold('1) English (eng / en)'))} ${colors.green('[Default]')}`,
|
|
99
|
+
` ${colors.comment('Standard template set in English for international teams')}`,
|
|
100
|
+
'',
|
|
101
|
+
` ${colors.teal(colors.bold('2) Tiếng Việt (vi)'))}`,
|
|
102
|
+
` ${colors.comment('Bộ mẫu chuẩn hóa hoàn toàn bằng Tiếng Việt cho kỹ sư Việt Nam')}`,
|
|
103
|
+
];
|
|
104
|
+
console.log(renderBox(promptLines, colors, { minWidth: 74 }));
|
|
105
|
+
console.log();
|
|
106
|
+
const answer = await askQuestion(` ${colors.purple('?')} ${colors.bold('Choice / Lựa chọn')} ${colors.yellow('[1: English, 2: Tiếng Việt]')}${colors.dim(', default: 1')}: `);
|
|
107
|
+
console.log();
|
|
108
|
+
const trimmed = answer.trim().toLowerCase();
|
|
109
|
+
if (trimmed === '2' ||
|
|
110
|
+
trimmed === 'vi' ||
|
|
111
|
+
trimmed === 'vie' ||
|
|
112
|
+
trimmed === 'vietnamese' ||
|
|
113
|
+
trimmed === 'tieng viet' ||
|
|
114
|
+
trimmed === 'tiếng việt') {
|
|
115
|
+
return 'vi';
|
|
116
|
+
}
|
|
117
|
+
return 'en';
|
|
118
|
+
}
|
|
61
119
|
export function showHelp(pkgInfo, colors) {
|
|
62
120
|
renderBanner(pkgInfo, colors);
|
|
63
121
|
console.log(colors.purple(colors.bold(' USAGE')));
|
|
@@ -68,16 +126,23 @@ export function showHelp(pkgInfo, colors) {
|
|
|
68
126
|
console.log(` ${colors.cyan('target_directory')} Destination path for workspace ${colors.comment('(default: .)')}`);
|
|
69
127
|
console.log();
|
|
70
128
|
console.log(colors.purple(colors.bold(' OPTIONS')));
|
|
71
|
-
console.log(` ${colors.yellow('-
|
|
72
|
-
console.log(` ${colors.yellow('-
|
|
73
|
-
console.log(` ${colors.yellow('-
|
|
129
|
+
console.log(` ${colors.yellow('-l, --lang <en|vi>')} Template language: 'en' / 'eng' (English) or 'vi' (Tiếng Việt)`);
|
|
130
|
+
console.log(` ${colors.yellow('-f, --force')} Overwrite existing files if already present`);
|
|
131
|
+
console.log(` ${colors.yellow('-h, --help')} Display this help documentation`);
|
|
132
|
+
console.log(` ${colors.yellow('-v, --version')} Display version number`);
|
|
74
133
|
console.log();
|
|
75
134
|
console.log(colors.purple(colors.bold(' EXAMPLES')));
|
|
76
|
-
console.log(` ${colors.comment('#
|
|
135
|
+
console.log(` ${colors.comment('# Interactive mode (prompts for English / Vietnamese):')}`);
|
|
77
136
|
console.log(` ${colors.cyan('$')} npx @damphuquy/agent-init .`);
|
|
78
137
|
console.log();
|
|
79
|
-
console.log(` ${colors.comment('#
|
|
80
|
-
console.log(` ${colors.cyan('$')} npx @damphuquy/agent-init
|
|
138
|
+
console.log(` ${colors.comment('# Bootstrap directly with Vietnamese templates:')}`);
|
|
139
|
+
console.log(` ${colors.cyan('$')} npx @damphuquy/agent-init . --lang vi`);
|
|
140
|
+
console.log();
|
|
141
|
+
console.log(` ${colors.comment('# Bootstrap directly with English templates:')}`);
|
|
142
|
+
console.log(` ${colors.cyan('$')} npx @damphuquy/agent-init . --lang en`);
|
|
143
|
+
console.log();
|
|
144
|
+
console.log(` ${colors.comment('# Scaffold into a specific project:')}`);
|
|
145
|
+
console.log(` ${colors.cyan('$')} npx @damphuquy/agent-init ./services/ai-agent --lang vi`);
|
|
81
146
|
console.log();
|
|
82
147
|
console.log(` ${colors.comment('# Force overwrite existing files:')}`);
|
|
83
148
|
console.log(` ${colors.cyan('$')} npx @damphuquy/agent-init . --force`);
|
package/dist/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,WAAmB;IAC5D,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,IAAI,IAAI,WAAW;QAAE,OAAO,GAAG,CAAC;IACpC,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,KAAwB,EACxB,MAAmB,EACnB,OAAO,GAAe,EAAE;IAExB,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAE3E,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YAClC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,aAAa,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
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Scaffolding CLI to bootstrap RIPER-5 Coding Agents & Operational Workspace",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prepublishOnly": "npm run build",
|
|
24
24
|
"start": "node ./dist/cli.js",
|
|
25
25
|
"scaffold": "node ./dist/cli.js",
|
|
26
|
-
"test": "node
|
|
26
|
+
"test": "node --test test/test-runner.js"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"ai-agent",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
```text
|
|
14
14
|
process/
|
|
15
15
|
├── README.md # Operational guide (this file)
|
|
16
|
+
├── .editorconfig # Unified format settings for markdown, tsv, json
|
|
16
17
|
├── _seeds/ # Read-only archetype blueprints
|
|
17
18
|
│ ├── _GUIDE.md # Full catalog, artifact chain, and instantiation commands
|
|
18
19
|
│ ├── task-template.md.seed # Master contract & RIPER state record
|
|
@@ -22,10 +23,13 @@ process/
|
|
|
22
23
|
│ ├── state-template.md.seed # Execute loop persistent memory
|
|
23
24
|
│ ├── review-template.md.seed # Review phase artifact (Gate 3)
|
|
24
25
|
│ ├── handoff-template.md.seed # Final projection (short)
|
|
26
|
+
│ ├── cancellation-template.md.seed # Knowledge-preserving cancellation record
|
|
27
|
+
│ ├── results-template.tsv.seed # Benchmark & quantitative metrics tracker
|
|
25
28
|
│ └── program-template.md.seed # Multi-phase program blueprint
|
|
26
29
|
├── context/ # Durable knowledge base & context routers
|
|
27
30
|
│ ├── all-context.md # Root context router
|
|
28
|
-
│
|
|
31
|
+
│ ├── planning/all-planning.md # Planning calibration & vertical slicing rules
|
|
32
|
+
│ └── tests/all-tests.md # Testing pyramid, harness policy & mock conventions
|
|
29
33
|
├── development-protocols/ # System rules & execution harness
|
|
30
34
|
│ ├── all-development-protocols.md
|
|
31
35
|
│ ├── orchestration.md # Subagent delegation rules
|
|
@@ -39,7 +43,9 @@ process/
|
|
|
39
43
|
│ │ ├── plan.md # Plan phase output
|
|
40
44
|
│ │ ├── state.md # Execute loop memory
|
|
41
45
|
│ │ ├── review.md # Review phase output
|
|
42
|
-
│ │
|
|
46
|
+
│ │ ├── handoff.md # Final projection
|
|
47
|
+
│ │ ├── results.tsv # (Optional) Benchmark & metric iteration tracking
|
|
48
|
+
│ │ └── cancelled.md # (If aborted) Cancellation findings & rollback status
|
|
43
49
|
│ ├── completed/ # Archived task workspaces
|
|
44
50
|
│ └── backlog/ # Backlog notes: {note_slug}_NOTE_{dd-mm-yy}.md
|
|
45
51
|
└── general-plans/ # Cross-cutting & standalone tasks
|
|
@@ -101,6 +107,8 @@ handoff.md ← (Complete) Short final projection
|
|
|
101
107
|
| Execute | source code + tests + `state.md` |
|
|
102
108
|
| Review | `review.md` |
|
|
103
109
|
| Handoff | `handoff.md` |
|
|
110
|
+
| Cancellation | `cancelled.md` (knowledge preservation upon abort) |
|
|
111
|
+
| Benchmark / Metrics | `results.tsv` (performance and eval metrics) |
|
|
104
112
|
| Gate 1 | `decision.md` approval |
|
|
105
113
|
| Gate 2 | `plan.md` approval |
|
|
106
114
|
| Gate 3 | `review.md` approval |
|
|
@@ -69,6 +69,16 @@
|
|
|
69
69
|
blast radius registries, and phase gate rules.
|
|
70
70
|
</seed>
|
|
71
71
|
|
|
72
|
+
<seed type="cancellation" path="cancellation-template.md.seed">
|
|
73
|
+
Task cancellation record. Preserves investigation findings, decision rationale,
|
|
74
|
+
reusable prototypes/tests, and rollback verification when an in-flight task is cancelled.
|
|
75
|
+
</seed>
|
|
76
|
+
|
|
77
|
+
<seed type="results" path="results-template.tsv.seed">
|
|
78
|
+
Benchmark and quantitative metrics evaluation registry.
|
|
79
|
+
Use for tracking latency, throughput, memory, or eval scores across iterations and vertical slices.
|
|
80
|
+
</seed>
|
|
81
|
+
|
|
72
82
|
</catalog>
|
|
73
83
|
|
|
74
84
|
---
|
|
@@ -107,15 +117,28 @@ handoff.md ← Final projection (short)
|
|
|
107
117
|
|
|
108
118
|
## 3. Recommended Task Workspace Layout
|
|
109
119
|
|
|
120
|
+
### Standard Single-Project Layout
|
|
110
121
|
```text
|
|
111
122
|
process/features/active/CHG-017-your-feature/
|
|
112
|
-
├── task.md ← instantiated from task-template.md.seed
|
|
113
|
-
├── research.md ← instantiated from context-group.md.seed
|
|
114
|
-
├── decision.md ← instantiated from decision-template.md.seed
|
|
115
|
-
├── plan.md ← instantiated from plan-template.md.seed
|
|
116
|
-
├── state.md ← instantiated from state-template.md.seed
|
|
117
|
-
├── review.md ← instantiated from review-template.md.seed
|
|
118
|
-
|
|
123
|
+
├── task.md ← instantiated from task-template.md.seed (Master Spec & AC)
|
|
124
|
+
├── research.md ← instantiated from context-group.md.seed (Research Output)
|
|
125
|
+
├── decision.md ← instantiated from decision-template.md.seed (Gate 1 Options)
|
|
126
|
+
├── plan.md ← instantiated from plan-template.md.seed (Gate 2 Execution Contract)
|
|
127
|
+
├── state.md ← instantiated from state-template.md.seed (Execute Memory)
|
|
128
|
+
├── review.md ← instantiated from review-template.md.seed (Gate 3 Audit)
|
|
129
|
+
├── handoff.md ← instantiated from handoff-template.md.seed (Final Projection)
|
|
130
|
+
├── results.tsv ← (Optional) instantiated from results-template.tsv.seed (Metrics/Benchmarks)
|
|
131
|
+
└── cancelled.md ← (If cancelled) instantiated from cancellation-template.md.seed
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Monorepo / Multi-Domain Layout (Optional)
|
|
135
|
+
When working in monorepos with independent domains (e.g. `mobile-app`, `billing-service`), partition features by domain:
|
|
136
|
+
```text
|
|
137
|
+
process/features/{domain-slug}/
|
|
138
|
+
├── active/
|
|
139
|
+
│ └── CHG-XXX-your-feature/
|
|
140
|
+
├── backlog/
|
|
141
|
+
└── completed/
|
|
119
142
|
```
|
|
120
143
|
|
|
121
144
|
Not all artifacts are required at start. Create them progressively as the task advances through RIPER phases.
|
|
@@ -128,7 +151,7 @@ Not all artifacts are required at start. Create them progressively as the task a
|
|
|
128
151
|
# Create a new task workspace
|
|
129
152
|
mkdir -p process/features/active/CHG-XXX-your-feature
|
|
130
153
|
|
|
131
|
-
# Instantiate seeds into the workspace
|
|
154
|
+
# Instantiate primary seeds into the workspace
|
|
132
155
|
cp process/_seeds/task-template.md.seed process/features/active/CHG-XXX-your-feature/task.md
|
|
133
156
|
cp process/_seeds/context-group.md.seed process/features/active/CHG-XXX-your-feature/research.md
|
|
134
157
|
cp process/_seeds/decision-template.md.seed process/features/active/CHG-XXX-your-feature/decision.md
|
|
@@ -136,6 +159,12 @@ cp process/_seeds/plan-template.md.seed process/features/active/CHG-XXX-your-
|
|
|
136
159
|
cp process/_seeds/state-template.md.seed process/features/active/CHG-XXX-your-feature/state.md
|
|
137
160
|
cp process/_seeds/review-template.md.seed process/features/active/CHG-XXX-your-feature/review.md
|
|
138
161
|
cp process/_seeds/handoff-template.md.seed process/features/active/CHG-XXX-your-feature/handoff.md
|
|
162
|
+
|
|
163
|
+
# (Optional) Tracking performance or evaluation metrics:
|
|
164
|
+
cp process/_seeds/results-template.tsv.seed process/features/active/CHG-XXX-your-feature/results.tsv
|
|
165
|
+
|
|
166
|
+
# (When cancelling an in-flight task):
|
|
167
|
+
cp process/_seeds/cancellation-template.md.seed process/features/active/CHG-XXX-your-feature/cancelled.md
|
|
139
168
|
```
|
|
140
169
|
|
|
141
170
|
</seeds_guide>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Cancellation Record: [TASK-ID] [Task Title]
|
|
2
|
+
|
|
3
|
+
<cancellation_record task_id="[TASK-ID]" version="1.0" framework="RIPER-5">
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
TASK CANCELLATION GUIDELINES:
|
|
7
|
+
- Purpose: Preserve investigation knowledge, technical discoveries, and decision rationale when a task is aborted.
|
|
8
|
+
- Never delete a task workspace outright if research or partial planning has occurred.
|
|
9
|
+
- Instantiate this file as `cancelled.md` inside the task workspace.
|
|
10
|
+
- Complete the reversal checklist, then move the task directory to `completed/` (or `cancelled/`).
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
<status>
|
|
14
|
+
<phase_at_cancellation>[RESEARCH | INNOVATE | PLAN | EXECUTE | REVIEW]</phase_at_cancellation>
|
|
15
|
+
<cancelled_date>[YYYY-MM-DD or DD-MM-YY]</cancelled_date>
|
|
16
|
+
<cancelled_by>[@engineer_or_product_lead]</cancelled_by>
|
|
17
|
+
<reversal_status>[CLEAN | ROLLBACK_APPLIED | DIRTY_NEEDS_MANUAL_CLEANUP]</reversal_status>
|
|
18
|
+
</status>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 1. Rationale for Cancellation
|
|
23
|
+
|
|
24
|
+
<cancellation_rationale>
|
|
25
|
+
<primary_reason>
|
|
26
|
+
<!-- [e.g. Pivot in product strategy / Architectural blocker / Excessive blast radius / Superseded by CHG-YYY] -->
|
|
27
|
+
[Concise summary of why this task was terminated prematurely.]
|
|
28
|
+
</primary_reason>
|
|
29
|
+
|
|
30
|
+
<decision_context>
|
|
31
|
+
[Detailed context, trade-offs evaluated, and key stakeholder guidance that led to cancellation.]
|
|
32
|
+
</decision_context>
|
|
33
|
+
</cancellation_rationale>
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Technical Findings & Preserved Knowledge
|
|
38
|
+
|
|
39
|
+
<preserved_knowledge>
|
|
40
|
+
<codebase_discoveries>
|
|
41
|
+
<!-- What did we learn about the system, data models, or hidden dependencies during this task? -->
|
|
42
|
+
- [Discovery 1 — Component behavior, undocumented API limits, or legacy constraints]
|
|
43
|
+
- [Discovery 2 — Existing tests or subsystem boundaries uncovered]
|
|
44
|
+
</codebase_discoveries>
|
|
45
|
+
|
|
46
|
+
<invalidated_hypotheses>
|
|
47
|
+
<!-- What assumptions proved false during investigation? -->
|
|
48
|
+
- [Hypothesis that turned out incorrect or infeasible]
|
|
49
|
+
</invalidated_hypotheses>
|
|
50
|
+
|
|
51
|
+
<reusable_assets>
|
|
52
|
+
<!-- Are there test cases, draft schemas, benchmarks, or prototypes that future tasks can reuse? -->
|
|
53
|
+
- [Reusable asset 1: test cases or data models in draft branch / commit]
|
|
54
|
+
</reusable_assets>
|
|
55
|
+
</preserved_knowledge>
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 3. Working Tree Reversal & Cleanup Checklist
|
|
60
|
+
|
|
61
|
+
<cleanup_checklist>
|
|
62
|
+
- [ ] Uncommitted changes rolled back or stashed cleanly (`git status` clean)
|
|
63
|
+
- [ ] Temporary debug logs, scratch scripts, or test dumps deleted
|
|
64
|
+
- [ ] No phantom migrations or schema artifacts left in local database
|
|
65
|
+
- [ ] Task folder archived to `completed/` (or `cancelled/`)
|
|
66
|
+
</cleanup_checklist>
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 4. Superseding Task or Follow-Up
|
|
71
|
+
|
|
72
|
+
<follow_up>
|
|
73
|
+
<superseded_by>[Link to new task folder or CHG-YYY, or NONE]</superseded_by>
|
|
74
|
+
<recommended_next_action>
|
|
75
|
+
[Specific recommendations if this problem is revisited in the future.]
|
|
76
|
+
</recommended_next_action>
|
|
77
|
+
</follow_up>
|
|
78
|
+
|
|
79
|
+
</cancellation_record>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Benchmark & Metric Evaluation Registry (RIPER-5 Framework)
|
|
2
|
+
# Instantiate as results.tsv in task workspace when tracking performance, latency, memory, or eval metrics.
|
|
3
|
+
iteration timestamp slice_id metric_name baseline observed unit diff_pct status notes
|
|
4
|
+
0 2026-01-01T00:00:00Z baseline p99_latency_ms 100.0 100.0 ms 0.0% BASELINE Initial baseline measurement
|
|
5
|
+
1 2026-01-01T01:00:00Z slice-01 p99_latency_ms 100.0 75.0 ms -25.0% PASS Optimization slice 1 applied
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
<scope>Scaffolding seeds for tasks, research, decisions, plans, state, reviews, handoffs, and programs. Full artifact chain and instantiation commands.</scope>
|
|
30
30
|
</group>
|
|
31
31
|
|
|
32
|
+
<group id="tests">
|
|
33
|
+
<title>Testing Standards & Harness Strategy</title>
|
|
34
|
+
<path>[`tests/all-tests.md`](tests/all-tests.md)</path>
|
|
35
|
+
<scope>Test pyramid, unit/integration isolation policies, mock conventions, and test fixtures</scope>
|
|
36
|
+
</group>
|
|
37
|
+
|
|
32
38
|
<group id="protocols">
|
|
33
39
|
<title>Development Protocols Index</title>
|
|
34
40
|
<path>[`../development-protocols/all-development-protocols.md`](../development-protocols/all-development-protocols.md)</path>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Testing Standards & Harness Strategy Context
|
|
2
|
+
|
|
3
|
+
<testing_context version="1.0">
|
|
4
|
+
|
|
5
|
+
<overview>
|
|
6
|
+
Guidelines for test pyramid calibration, isolation policies, mock conventions, and automated verification harness across the system.
|
|
7
|
+
</overview>
|
|
8
|
+
|
|
9
|
+
## 1. Test Pyramid & Classification
|
|
10
|
+
<test_pyramid>
|
|
11
|
+
<layer name="Unit Tests" path="tests/unit/">
|
|
12
|
+
- Scope: Pure business logic, domain models, utility functions, edge case branching.
|
|
13
|
+
- Execution speed: Fast (< 50ms per test), zero network/disk/external I/O.
|
|
14
|
+
- Mock policy: Mock all I/O boundaries, external clients, and port interfaces.
|
|
15
|
+
</layer>
|
|
16
|
+
|
|
17
|
+
<layer name="Integration Tests" path="tests/integration/">
|
|
18
|
+
- Scope: Database persistence, external API client adapters, framework wiring.
|
|
19
|
+
- Isolation: Ephemeral test containers (e.g. Testcontainers) or dedicated isolated test database per suite.
|
|
20
|
+
- Teardown: Must guarantee zero state leakage across test runs.
|
|
21
|
+
</layer>
|
|
22
|
+
|
|
23
|
+
<layer name="End-to-End Tests" path="tests/e2e/">
|
|
24
|
+
- Scope: Critical user journeys, full HTTP/gRPC API lifecycle, regression smoke tests.
|
|
25
|
+
- Verification: Validates end-to-end contract integrity across subsystems.
|
|
26
|
+
</layer>
|
|
27
|
+
</test_pyramid>
|
|
28
|
+
|
|
29
|
+
## 2. Test Harness Policies
|
|
30
|
+
<test_policies>
|
|
31
|
+
<policy name="Determinism">
|
|
32
|
+
Zero flaky tests. Tests must not depend on real wall-clock time (use frozen clocks or fake timers) or randomized execution order.
|
|
33
|
+
</policy>
|
|
34
|
+
|
|
35
|
+
<policy name="Clean State">
|
|
36
|
+
Every test must seed its own data or fixtures. Tests must never assume pre-existing database rows.
|
|
37
|
+
</policy>
|
|
38
|
+
|
|
39
|
+
<policy name="Assertion Precision">
|
|
40
|
+
Avoid vague assertions (e.g. `expect(res).toBeTruthy()`). Always assert exact expected structures, status codes, and error types.
|
|
41
|
+
</policy>
|
|
42
|
+
|
|
43
|
+
<policy name="Fast Feedback">
|
|
44
|
+
Unit tests must execute in under 30 seconds for the entire suite. Slow integration suites must be cleanly partitioned.
|
|
45
|
+
</policy>
|
|
46
|
+
</test_policies>
|
|
47
|
+
|
|
48
|
+
## 3. Verification Commands Mapping
|
|
49
|
+
<verification_commands>
|
|
50
|
+
<!-- Keep aligned with AGENTS.md <validation_commands> -->
|
|
51
|
+
<command type="unit">Run fast unit test suite</command>
|
|
52
|
+
<command type="integration">Run integration/e2e tests</command>
|
|
53
|
+
<command type="coverage">Run test coverage check</command>
|
|
54
|
+
</verification_commands>
|
|
55
|
+
|
|
56
|
+
</testing_context>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Tầng Điều Khiển Agent (`.agents/`)
|
|
2
|
+
|
|
3
|
+
<agent_control_layer version="1.0">
|
|
4
|
+
|
|
5
|
+
<purpose>
|
|
6
|
+
Quy chuẩn điều khiển Agent dùng chung, độc lập với dự án. Các tệp này định nghĩa
|
|
7
|
+
CÁCH Agent tư duy và hành xử — không quyết định những gì Agent xây dựng hay cách theo dõi task.
|
|
8
|
+
|
|
9
|
+
Sao chép nguyên vẹn thư mục này vào bất kỳ repository nào. Không cần chỉnh sửa riêng theo dự án.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<boundary>
|
|
13
|
+
`.agents/` quản lý: khai báo chế độ hoạt động (mode), giao thức khởi động session, ngân sách thử lại (retry budget),
|
|
14
|
+
điều kiện dừng khẩn cấp (escalation triggers), cổng hoàn thành (completion gate), và quy ước đặt tên / mã nguồn.
|
|
15
|
+
|
|
16
|
+
`.agents/` TUYỆT ĐỐI KHÔNG quản lý: quy trình task (→ `process/`), chuỗi artifact
|
|
17
|
+
(→ `process/_seeds/`), lệnh kiểm thử/build của dự án (→ `AGENTS.md`), hay ngữ cảnh nghiệp vụ
|
|
18
|
+
(→ `process/context/`).
|
|
19
|
+
</boundary>
|
|
20
|
+
|
|
21
|
+
## Danh Mục Tệp
|
|
22
|
+
|
|
23
|
+
| Tệp | Mục đích |
|
|
24
|
+
|-----|---------|
|
|
25
|
+
| [`behavior.md`](behavior.md) | Khai báo mode, khởi động session, nạp lại trạng thái bền vững từ file |
|
|
26
|
+
| [`guardrails.md`](guardrails.md) | Ngân sách thử lại, điều kiện kích hoạt dừng, điều kiện dừng, cổng hoàn thành |
|
|
27
|
+
| [`conventions/naming.md`](conventions/naming.md) | Quy chuẩn đặt tên biến/hàm và vệ sinh mã nguồn phổ quát |
|
|
28
|
+
|
|
29
|
+
</agent_control_layer>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Giao Thức Hành Vi Của Agent (Behavior Protocol)
|
|
2
|
+
|
|
3
|
+
<behavior_protocol version="1.0">
|
|
4
|
+
|
|
5
|
+
<description>
|
|
6
|
+
Quy tắc phổ quát quy định CÁCH Agent khai báo chế độ hoạt động (mode),
|
|
7
|
+
nạp lại trạng thái khi khởi động session và điều hướng ngữ cảnh. Dùng chung cho mọi dự án.
|
|
8
|
+
</description>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Khai Báo Chế Độ Hoạt Động (Mode Declaration)
|
|
13
|
+
|
|
14
|
+
Mọi phản hồi thúc đẩy tiến độ task BẮT BUỘC phải mở đầu bằng dòng khai báo mode
|
|
15
|
+
ở ngay dòng đầu tiên. Chế độ khai báo phải khớp với giai đoạn hiện tại được ghi trong `task.md`.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
[MODE: RESEARCH] — chỉ đọc, không chỉnh sửa mã nguồn
|
|
19
|
+
[MODE: INNOVATE] — tạo phương án đề xuất, không chỉnh sửa mã nguồn
|
|
20
|
+
[MODE: PLAN] — lập kế hoạch lát cắt, không chỉnh sửa mã nguồn
|
|
21
|
+
[MODE: EXECUTE] — thực thi thay đổi mã nguồn trong phạm vi cho phép
|
|
22
|
+
[MODE: REVIEW] — nghiệm thu, không sửa mã nguồn trong lúc review
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Chỉ lược bỏ khai báo mode đối với các trao đổi mang tính đàm thoại thuần túy không
|
|
26
|
+
làm thay đổi tiến độ task (ví dụ: giải đáp câu hỏi kỹ thuật, làm rõ phạm vi yêu cầu).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. Giao Thức Khởi Động Session (Session Startup Protocol)
|
|
31
|
+
|
|
32
|
+
Trước khi tiếp tục bất kỳ task đang dang dở nào, nạp lại trạng thái bền vững theo đúng thứ tự sau:
|
|
33
|
+
|
|
34
|
+
<startup_sequence>
|
|
35
|
+
1. Đọc `task.md` — xác nhận giai đoạn hiện tại và các cổng đang mở.
|
|
36
|
+
2. Đọc `research.md` nếu giai đoạn Research đã hoàn thành.
|
|
37
|
+
3. Đọc `decision.md` nếu giai đoạn Innovate đã hoàn thành — xác nhận các quyết định đã được duyệt.
|
|
38
|
+
4. Đọc `plan.md` — xác nhận chỉ số lát cắt (slice) hiện tại và hợp đồng phạm vi file.
|
|
39
|
+
5. Đọc `state.md` — xác nhận các slice đã xong, bộ nhớ lỗi (failure memory), ngân sách thử lại và hành động tiếp theo.
|
|
40
|
+
6. Đọc lại bất kỳ tệp mã nguồn nào đã thay đổi kể từ lần nạp ngữ cảnh gần nhất.
|
|
41
|
+
</startup_sequence>
|
|
42
|
+
|
|
43
|
+
**KHÔNG phụ thuộc vào bộ nhớ cửa sổ chat.** Luôn đối chiếu và xác thực
|
|
44
|
+
dựa trên các tệp artifact được liệt kê ở trên.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 3. Quy Tắc Điều Hướng Ngữ Cảnh (Context Navigation Rules)
|
|
49
|
+
|
|
50
|
+
<context_rules>
|
|
51
|
+
<rule id="minimum_context">
|
|
52
|
+
Chỉ thu thập ngữ cảnh tối thiểu đủ dùng (Minimum Sufficient Context). Không quét toàn bộ repository
|
|
53
|
+
hay tự ý refactor ngoài phạm vi task đang thực thi.
|
|
54
|
+
</rule>
|
|
55
|
+
|
|
56
|
+
<rule id="information_priority">
|
|
57
|
+
Nạp ngữ cảnh theo đúng thứ tự ưu tiên sau:
|
|
58
|
+
1. Đặc tả task và tiêu chí nghiệm thu (`task.md`)
|
|
59
|
+
2. Artifact khảo sát và quyết định (`research.md`, `decision.md`)
|
|
60
|
+
3. Bộ kiểm thử liên quan (test suites)
|
|
61
|
+
4. Domain models và giao diện cổng (port interfaces)
|
|
62
|
+
5. Cấu hình và thiết lập dependency injection
|
|
63
|
+
6. Triển khai cụ thể hạ tầng (infrastructure implementations)
|
|
64
|
+
</rule>
|
|
65
|
+
|
|
66
|
+
<rule id="no_stale_context">
|
|
67
|
+
Đọc lại các tệp liên quan sau bất kỳ thay đổi nào trong repository. Tuyệt đối không
|
|
68
|
+
hành động dựa trên dữ liệu tạm đã lỗi thời trong bộ nhớ.
|
|
69
|
+
</rule>
|
|
70
|
+
</context_rules>
|
|
71
|
+
|
|
72
|
+
</behavior_protocol>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Quy Chuẩn Đặt Tên & Vệ Sinh Mã Nguồn (Naming & Code Conventions)
|
|
2
|
+
|
|
3
|
+
<naming_conventions version="1.0">
|
|
4
|
+
|
|
5
|
+
<description>
|
|
6
|
+
Quy tắc vệ sinh mã nguồn phổ quát áp dụng cho mọi ngôn ngữ và dự án.
|
|
7
|
+
Quy tắc linting/formatting riêng của dự án nằm trong `AGENTS.md` và
|
|
8
|
+
`process/development-protocols/implementation-standards.md`.
|
|
9
|
+
</description>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Quy Tắc Đặt Tên (Naming Rules)
|
|
14
|
+
|
|
15
|
+
<naming_rules>
|
|
16
|
+
<rule id="no_leading_underscore">
|
|
17
|
+
Không dùng dấu gạch dưới mở đầu `_` cho tên hàm hoặc phương thức để ám chỉ
|
|
18
|
+
"private". Viết các hàm public rõ ràng, phẳng với tên tự giải thích mục đích.
|
|
19
|
+
Ngoại lệ: các dunder/magic methods bắt buộc của ngôn ngữ (ví dụ: `__init__` trong Python).
|
|
20
|
+
</rule>
|
|
21
|
+
|
|
22
|
+
<rule id="self_explanatory">
|
|
23
|
+
Tên gọi phải bộc lộ rõ ý định mà không cần comment giải thích thêm.
|
|
24
|
+
Ưu tiên `calculate_retry_delay()` thay vì `calc()` hay `do_thing()`.
|
|
25
|
+
</rule>
|
|
26
|
+
|
|
27
|
+
<rule id="no_abbreviations">
|
|
28
|
+
Tránh viết tắt khó hiểu. Viết `connection_timeout` thay vì `conn_to`,
|
|
29
|
+
`maximum_retry_count` thay vì `max_rtry_cnt`.
|
|
30
|
+
Ngoại lệ: các từ viết tắt phổ quát được hiểu chung (ví dụ: `url`, `id`, `api`).
|
|
31
|
+
</rule>
|
|
32
|
+
</naming_rules>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 2. Vệ Sinh Cấu Trúc (Structural Hygiene)
|
|
37
|
+
|
|
38
|
+
<structural_rules>
|
|
39
|
+
<rule id="single_responsibility">
|
|
40
|
+
Mỗi hàm hoặc class chỉ có duy nhất một trách nhiệm được nêu rõ ràng.
|
|
41
|
+
Tách nhỏ khi một đơn vị làm nhiều hơn một việc.
|
|
42
|
+
</rule>
|
|
43
|
+
|
|
44
|
+
<rule id="no_magic_values">
|
|
45
|
+
Trích xuất toàn bộ giá trị số/chuỗi trực tiếp (magic literals) thành hằng số có tên hoặc file cấu hình.
|
|
46
|
+
</rule>
|
|
47
|
+
|
|
48
|
+
<rule id="no_suppression">
|
|
49
|
+
Tuyệt đối không tắt cảnh báo linter hoặc type checker bằng comment bỏ qua nội dòng
|
|
50
|
+
(`# type: ignore`, `# noqa`, `eslint-disable`, `@SuppressWarnings`, v.v.)
|
|
51
|
+
trừ khi chính việc bỏ qua đó được review rõ ràng và chú thích lý do cụ thể.
|
|
52
|
+
</rule>
|
|
53
|
+
</structural_rules>
|
|
54
|
+
|
|
55
|
+
</naming_conventions>
|