@haaaiawd/anws 1.2.4 → 1.2.5
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 +4 -5
- package/lib/agents.js +50 -0
- package/lib/init.js +221 -175
- package/lib/update.js +147 -149
- package/package.json +1 -1
- package/templates/.agent/workflows/blueprint.md +7 -7
- package/templates/.agent/workflows/change.md +1 -1
- package/templates/.agent/workflows/craft.md +1 -1
- package/templates/.agent/workflows/design-system.md +2 -2
- package/templates/.agent/workflows/explore.md +1 -1
- package/templates/.agent/workflows/forge.md +6 -6
- package/templates/.agent/workflows/genesis.md +9 -9
- package/templates/.agent/workflows/scout.md +1 -1
- package/templates/AGENTS.md +113 -113
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ A **structured workflow framework** for Agentic AI assistants, designed to solve
|
|
|
24
24
|
| ---------------------- | ----------------------------------------------------------- | -------------------------------------------------------------- |
|
|
25
25
|
| **Architecture Drift** | AI generates inconsistent patterns across the same codebase | `/genesis` forces PRD & architecture design first |
|
|
26
26
|
| **Spaghetti Code** | AI lacks project context, writes code that doesn't fit | Tasks include constraints & acceptance criteria |
|
|
27
|
-
| **Context Amnesia** | New session = AI forgets all previous decisions |
|
|
27
|
+
| **Context Amnesia** | New session = AI forgets all previous decisions | `AGENTS.md` + versioned docs as persistent memory |
|
|
28
28
|
| **Lack of Planning** | Vibe Coding skips design, creates tech debt | Mandatory design-first workflow |
|
|
29
29
|
|
|
30
30
|
---
|
|
@@ -52,8 +52,8 @@ cd your-project
|
|
|
52
52
|
anws update
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
> `anws update` overwrites all managed workflow/skill files to the latest version while **preserving** your `
|
|
56
|
-
> If the `
|
|
55
|
+
> `anws update` overwrites all managed workflow/skill files to the latest version while **preserving** your `AGENTS.md`.
|
|
56
|
+
> If the `AGENTS.md` template has new content, an `AGENTS.md.new` file will be generated for you to merge manually.
|
|
57
57
|
|
|
58
58
|
### Your First Project 🐣
|
|
59
59
|
|
|
@@ -214,9 +214,8 @@ Just speak naturally. Antigravity will automatically select and run the right wo
|
|
|
214
214
|
|
|
215
215
|
```
|
|
216
216
|
your-project/
|
|
217
|
+
├── AGENTS.md # 🧠 AI's anchor point
|
|
217
218
|
├── .agent/
|
|
218
|
-
│ ├── rules/
|
|
219
|
-
│ │ └── agents.md # 🧠 AI's anchor point
|
|
220
219
|
│ ├── workflows/ # Workflow definitions
|
|
221
220
|
│ │ ├── genesis.md
|
|
222
221
|
│ │ ├── scout.md
|
package/lib/agents.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { warn, blank } = require('./output');
|
|
6
|
+
|
|
7
|
+
async function pathExists(targetPath) {
|
|
8
|
+
return fs.access(targetPath).then(() => true).catch(() => false);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function getAgentsState(cwd) {
|
|
12
|
+
const legacyPath = path.join(cwd, '.agent', 'rules', 'agents.md');
|
|
13
|
+
const rootPath = path.join(cwd, 'AGENTS.md');
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
legacyPath,
|
|
17
|
+
rootPath,
|
|
18
|
+
legacyExists: await pathExists(legacyPath),
|
|
19
|
+
rootExists: await pathExists(rootPath)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function resolveAgentsInstall({ cwd, askMigrate, forceYes = false }) {
|
|
24
|
+
const state = await getAgentsState(cwd);
|
|
25
|
+
|
|
26
|
+
if (!state.legacyExists) {
|
|
27
|
+
return { ...state, shouldWriteRootAgents: true, shouldWarnMigration: false };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const migrate = forceYes ? true : await askMigrate();
|
|
31
|
+
return {
|
|
32
|
+
...state,
|
|
33
|
+
shouldWriteRootAgents: migrate ? !state.rootExists : false,
|
|
34
|
+
shouldWarnMigration: migrate
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function printLegacyMigrationWarning() {
|
|
39
|
+
blank();
|
|
40
|
+
warn('Please manually copy your custom rules from .agent/rules/agents.md to the root AGENTS.md');
|
|
41
|
+
warn('After copying, you can safely delete the old .agent/rules/agents.md file.');
|
|
42
|
+
blank();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = {
|
|
46
|
+
getAgentsState,
|
|
47
|
+
resolveAgentsInstall,
|
|
48
|
+
printLegacyMigrationWarning,
|
|
49
|
+
pathExists
|
|
50
|
+
};
|
package/lib/init.js
CHANGED
|
@@ -1,175 +1,221 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs/promises');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const { copyDir } = require('./copy');
|
|
6
|
-
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
for (const
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { copyDir } = require('./copy');
|
|
6
|
+
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
7
|
+
const { resolveAgentsInstall, printLegacyMigrationWarning, pathExists } = require('./agents');
|
|
8
|
+
const { success, warn, info, fileLine, skippedLine, blank, logo } = require('./output');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* anws init — 将工作流系统写入当前项目
|
|
12
|
+
*/
|
|
13
|
+
async function init() {
|
|
14
|
+
const cwd = process.cwd();
|
|
15
|
+
const srcRoot = path.join(__dirname, '..', 'templates', '.agent');
|
|
16
|
+
const destRoot = path.join(cwd, '.agent');
|
|
17
|
+
const srcAgents = path.join(__dirname, '..', 'templates', 'AGENTS.md');
|
|
18
|
+
|
|
19
|
+
const agentsDecision = await resolveAgentsInstall({
|
|
20
|
+
cwd,
|
|
21
|
+
askMigrate,
|
|
22
|
+
forceYes: !!global.__ANWS_FORCE_YES
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// ── 冲突检测(T1.2.3 在此处插入冲突分支)──────────────────────────────────
|
|
26
|
+
const conflicting = await findConflicts(cwd);
|
|
27
|
+
if (conflicting.length > 0) {
|
|
28
|
+
const confirmed = await askOverwrite(conflicting.length);
|
|
29
|
+
if (!confirmed) {
|
|
30
|
+
blank();
|
|
31
|
+
info('Aborted. No files were changed.');
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
34
|
+
// 仅覆盖托管文件(用户自有文件不受影响)
|
|
35
|
+
const { written: updated, skipped } = await overwriteManaged(srcRoot, cwd, {
|
|
36
|
+
srcAgents,
|
|
37
|
+
shouldWriteRootAgents: agentsDecision.shouldWriteRootAgents
|
|
38
|
+
});
|
|
39
|
+
if (agentsDecision.shouldWarnMigration) {
|
|
40
|
+
printLegacyMigrationWarning();
|
|
41
|
+
}
|
|
42
|
+
printSummary(updated, skipped, 'updated');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// ── 无冲突:直接复制 ─────────────────────────────────────────────────────────
|
|
46
|
+
|
|
47
|
+
logo();
|
|
48
|
+
info('Initializing Antigravity Workflow System...');
|
|
49
|
+
blank();
|
|
50
|
+
|
|
51
|
+
const writtenFiles = await copyDir(srcRoot, destRoot);
|
|
52
|
+
const written = Array.isArray(writtenFiles) ? writtenFiles : [];
|
|
53
|
+
|
|
54
|
+
if (agentsDecision.shouldWriteRootAgents) {
|
|
55
|
+
const destAgents = path.join(cwd, 'AGENTS.md');
|
|
56
|
+
try {
|
|
57
|
+
await fs.copyFile(srcAgents, destAgents);
|
|
58
|
+
written.push(destAgents);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// 忽略
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (agentsDecision.shouldWarnMigration) {
|
|
65
|
+
printLegacyMigrationWarning();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 打印文件列表
|
|
69
|
+
for (const absPath of written) {
|
|
70
|
+
const rel = path.relative(cwd, absPath).replace(/\\/g, '/');
|
|
71
|
+
fileLine(rel);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
blank();
|
|
75
|
+
success(`Done! ${written.length} files written to .agent/`);
|
|
76
|
+
printNextSteps();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ─── 辅助函数 ──────────────────────────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 找出 cwd 中已存在的托管文件列表。
|
|
83
|
+
* @returns {Promise<string[]>} 已存在的托管文件相对路径数组
|
|
84
|
+
*/
|
|
85
|
+
async function findConflicts(cwd) {
|
|
86
|
+
const conflicts = [];
|
|
87
|
+
for (const rel of MANAGED_FILES) {
|
|
88
|
+
const abs = path.join(cwd, rel);
|
|
89
|
+
const exists = await pathExists(abs);
|
|
90
|
+
if (exists) conflicts.push(rel);
|
|
91
|
+
}
|
|
92
|
+
return conflicts;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 交互式询问用户是否覆盖(默认 N)。
|
|
97
|
+
* 非 TTY 环境(如 CI)自动返回 false。
|
|
98
|
+
* @returns {Promise<boolean>}
|
|
99
|
+
*/
|
|
100
|
+
async function askOverwrite(count) {
|
|
101
|
+
if (global.__ANWS_FORCE_YES) return true;
|
|
102
|
+
|
|
103
|
+
// 非 TTY 环境:默认不覆盖,防止 CI 挂起
|
|
104
|
+
if (!process.stdin.isTTY) {
|
|
105
|
+
warn(`${count} managed file(s) already exist. Non-TTY: skipping overwrite.`);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const readline = require('node:readline');
|
|
110
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
111
|
+
|
|
112
|
+
return new Promise((resolve) => {
|
|
113
|
+
rl.question(
|
|
114
|
+
`\n\u26a0 ${count} managed file(s) already exist. Overwrite? [y/N] `,
|
|
115
|
+
(answer) => {
|
|
116
|
+
rl.close();
|
|
117
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function askMigrate() {
|
|
124
|
+
if (global.__ANWS_FORCE_YES) return true;
|
|
125
|
+
|
|
126
|
+
if (!process.stdin.isTTY) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const readline = require('node:readline');
|
|
131
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
132
|
+
|
|
133
|
+
return new Promise((resolve) => {
|
|
134
|
+
rl.question(
|
|
135
|
+
'\n\u26a0 Legacy .agent/rules/agents.md detected. Do you want to migrate to root AGENTS.md? [y/N] ',
|
|
136
|
+
(answer) => {
|
|
137
|
+
rl.close();
|
|
138
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 仅覆盖 MANAGED_FILES 清单内的文件,用户自有文件不受影响。
|
|
146
|
+
* USER_PROTECTED_FILES 中的文件即便冲突也跳过,保留用户修改。
|
|
147
|
+
* @returns {{ written: string[], skipped: string[] }}
|
|
148
|
+
*/
|
|
149
|
+
async function overwriteManaged(srcRoot, cwd, options = {}) {
|
|
150
|
+
const srcBase = path.dirname(srcRoot); // templates/
|
|
151
|
+
const written = [];
|
|
152
|
+
const skipped = [];
|
|
153
|
+
const shouldWriteRootAgents = options.shouldWriteRootAgents !== false;
|
|
154
|
+
const srcAgents = options.srcAgents || path.join(srcBase, 'AGENTS.md');
|
|
155
|
+
|
|
156
|
+
for (const rel of MANAGED_FILES) {
|
|
157
|
+
if (rel === 'AGENTS.md' && !shouldWriteRootAgents) {
|
|
158
|
+
skipped.push(rel);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 受保护文件:文件已存在时跳过,交给用户自行维护
|
|
163
|
+
if (USER_PROTECTED_FILES.includes(rel)) {
|
|
164
|
+
const destPath = path.join(cwd, rel);
|
|
165
|
+
const exists = await pathExists(destPath);
|
|
166
|
+
if (exists) {
|
|
167
|
+
skipped.push(rel);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const srcPath = rel === 'AGENTS.md' ? srcAgents : path.join(srcBase, rel);
|
|
173
|
+
const destPath = path.join(cwd, rel);
|
|
174
|
+
|
|
175
|
+
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
176
|
+
const srcExists = await pathExists(srcPath);
|
|
177
|
+
if (srcExists) {
|
|
178
|
+
await fs.copyFile(srcPath, destPath);
|
|
179
|
+
written.push(rel);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return { written, skipped };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 打印操作摘要(更新场景)。
|
|
188
|
+
* @param {string[]} files 已写入的文件
|
|
189
|
+
* @param {string[]} skipped 受保护跳过的文件
|
|
190
|
+
* @param {string} action
|
|
191
|
+
*/
|
|
192
|
+
function printSummary(files, skipped = [], action) {
|
|
193
|
+
const verb = action === 'updated' ? 'Updating' : 'Writing';
|
|
194
|
+
blank();
|
|
195
|
+
info(`${verb} files...`);
|
|
196
|
+
blank();
|
|
197
|
+
for (const rel of files) {
|
|
198
|
+
fileLine(rel.replace(/\\/g, '/'));
|
|
199
|
+
}
|
|
200
|
+
if (skipped.length > 0) {
|
|
201
|
+
blank();
|
|
202
|
+
info('Skipped (project-specific, preserved):');
|
|
203
|
+
for (const rel of skipped) {
|
|
204
|
+
skippedLine(rel.replace(/\\/g, '/'));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
blank();
|
|
208
|
+
success(`Done! ${files.length} file(s) ${action}${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
|
|
209
|
+
if (action === 'updated') {
|
|
210
|
+
info('Managed files have been updated to the latest version.');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function printNextSteps() {
|
|
215
|
+
blank();
|
|
216
|
+
info('Next steps:');
|
|
217
|
+
info(' 1. Read AGENTS.md to understand the system');
|
|
218
|
+
info(' 2. Run /quickstart in your AI assistant to analyze and start the workflow');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
module.exports = init;
|
package/lib/update.js
CHANGED
|
@@ -1,149 +1,147 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs/promises');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
blank();
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
module.exports = update;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs/promises');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
6
|
+
const { resolveAgentsInstall, printLegacyMigrationWarning, pathExists } = require('./agents');
|
|
7
|
+
const { success, warn, error, info, fileLine, skippedLine, blank, logo } = require('./output');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* anws update — 将当前项目的托管文件更新到最新版本
|
|
11
|
+
*/
|
|
12
|
+
async function update() {
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const agentDir = path.join(cwd, '.agent');
|
|
15
|
+
|
|
16
|
+
// 检查 .agent/ 是否存在
|
|
17
|
+
const agentExists = await pathExists(agentDir);
|
|
18
|
+
if (!agentExists) {
|
|
19
|
+
logo();
|
|
20
|
+
error('No .agent/ found in current directory.');
|
|
21
|
+
info('Run `anws init` first to set up the workflow system.');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 询问确认
|
|
26
|
+
const confirmed = await askUpdate();
|
|
27
|
+
if (!confirmed) {
|
|
28
|
+
blank();
|
|
29
|
+
info('Aborted. No files were changed.');
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
logo();
|
|
34
|
+
// 仅覆盖托管文件;USER_PROTECTED_FILES 永远跳过
|
|
35
|
+
const srcRoot = path.join(__dirname, '..', 'templates', '.agent');
|
|
36
|
+
const srcAgents = path.join(__dirname, '..', 'templates', 'AGENTS.md');
|
|
37
|
+
const agentsDecision = await resolveAgentsInstall({
|
|
38
|
+
cwd,
|
|
39
|
+
askMigrate,
|
|
40
|
+
forceYes: !!global.__ANWS_FORCE_YES
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (!agentsDecision.shouldWriteRootAgents && agentsDecision.legacyExists) {
|
|
44
|
+
info('Keeping legacy .agent/rules/agents.md. Will not pull root AGENTS.md.');
|
|
45
|
+
}
|
|
46
|
+
if (agentsDecision.shouldWarnMigration) {
|
|
47
|
+
printLegacyMigrationWarning();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const updated = [];
|
|
51
|
+
const skipped = [];
|
|
52
|
+
|
|
53
|
+
for (const rel of MANAGED_FILES) {
|
|
54
|
+
if (rel === 'AGENTS.md' && !agentsDecision.shouldWriteRootAgents) {
|
|
55
|
+
skipped.push(rel);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (USER_PROTECTED_FILES.includes(rel)) {
|
|
60
|
+
if (!(rel === 'AGENTS.md' && agentsDecision.shouldWriteRootAgents && !agentsDecision.rootExists)) {
|
|
61
|
+
skipped.push(rel);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const srcPath = rel === 'AGENTS.md' ? srcAgents : path.join(path.dirname(srcRoot), rel);
|
|
67
|
+
const destPath = path.join(cwd, rel);
|
|
68
|
+
|
|
69
|
+
const srcExists = await pathExists(srcPath);
|
|
70
|
+
if (!srcExists) continue;
|
|
71
|
+
|
|
72
|
+
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
73
|
+
await fs.copyFile(srcPath, destPath);
|
|
74
|
+
updated.push(rel);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 打印摘要
|
|
78
|
+
blank();
|
|
79
|
+
info('Updated files:');
|
|
80
|
+
blank();
|
|
81
|
+
for (const rel of updated) {
|
|
82
|
+
fileLine(rel.replace(/\\/g, '/'));
|
|
83
|
+
}
|
|
84
|
+
if (skipped.length > 0) {
|
|
85
|
+
blank();
|
|
86
|
+
info('Skipped (project-specific, preserved):');
|
|
87
|
+
for (const rel of skipped) {
|
|
88
|
+
skippedLine(rel.replace(/\\/g, '/'));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
blank();
|
|
93
|
+
success(`Done! ${updated.length} file(s) updated${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
|
|
94
|
+
info('Managed files have been updated to the latest version.');
|
|
95
|
+
info('Your custom files in .agent/ were not touched.');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 交互式确认更新操作(默认 N)。
|
|
100
|
+
*/
|
|
101
|
+
async function askUpdate() {
|
|
102
|
+
if (global.__ANWS_FORCE_YES) return true;
|
|
103
|
+
|
|
104
|
+
if (!process.stdin.isTTY) {
|
|
105
|
+
warn('Non-TTY environment detected. Skipping update to avoid accidental overwrites.');
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const readline = require('node:readline');
|
|
110
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
111
|
+
|
|
112
|
+
return new Promise((resolve) => {
|
|
113
|
+
rl.question(
|
|
114
|
+
'\n\u26a0 This will overwrite all managed .agent/ files. Continue? [y/N] ',
|
|
115
|
+
(answer) => {
|
|
116
|
+
rl.close();
|
|
117
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 询问用户是否同意迁移 agents.md
|
|
125
|
+
*/
|
|
126
|
+
async function askMigrate() {
|
|
127
|
+
if (global.__ANWS_FORCE_YES) return true;
|
|
128
|
+
|
|
129
|
+
if (!process.stdin.isTTY) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const readline = require('node:readline');
|
|
134
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
135
|
+
|
|
136
|
+
return new Promise((resolve) => {
|
|
137
|
+
rl.question(
|
|
138
|
+
'\n\u26a0 Legacy .agent/rules/agents.md detected. Do you want to migrate to root AGENTS.md? [y/N] ',
|
|
139
|
+
(answer) => {
|
|
140
|
+
rl.close();
|
|
141
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
module.exports = update;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haaaiawd/anws",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "A spec-driven workflow framework for AI-assisted development. Empowers prompt engineers to build production-ready software through structured PRD → Architecture → Task decomposition. Designed for Antigravity to enforce design-first principles and prevent architectural drift in vibe coding.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antigravity",
|
|
@@ -232,11 +232,11 @@ graph TD
|
|
|
232
232
|
|
|
233
233
|
## Step 6: 生成文档
|
|
234
234
|
|
|
235
|
-
**目标**: 保存最终的任务清单,并**更新 .
|
|
235
|
+
**目标**: 保存最终的任务清单,并**更新 AGENTS.md**。
|
|
236
236
|
|
|
237
237
|
1. **保存**: 将内容保存到 `genesis/v{N}/05_TASKS.md`
|
|
238
238
|
2. **验证**: 确保文件包含所有任务、验收标准和依赖图。
|
|
239
|
-
3. **更新 .
|
|
239
|
+
3. **更新 AGENTS.md "当前状态"**:
|
|
240
240
|
- 活动任务清单: `genesis/v{N}/05_TASKS.md`
|
|
241
241
|
- 最近一次更新: `{Today}`
|
|
242
242
|
- 写入初始波次建议,让 `/forge` 可以直接启动:
|
|
@@ -254,7 +254,7 @@ graph TD
|
|
|
254
254
|
- ✅ 任务间的输入/输出是否对齐(接口追溯)?
|
|
255
255
|
- ✅ 是否生成了 Mermaid 依赖图?
|
|
256
256
|
- ✅ User Story Overlay 已生成,覆盖 GAP 已补充?
|
|
257
|
-
- ✅ 已更新 .
|
|
257
|
+
- ✅ 已更新 AGENTS.md(含初始波次建议)?
|
|
258
258
|
|
|
259
259
|
---
|
|
260
260
|
|
|
@@ -282,7 +282,7 @@ graph TD
|
|
|
282
282
|
|
|
283
283
|
### Agent Context 自更新
|
|
284
284
|
|
|
285
|
-
**更新
|
|
285
|
+
**更新 `AGENTS.md` 的 `AUTO:BEGIN` ~ `AUTO:END` 区块**:
|
|
286
286
|
|
|
287
287
|
在 `### 当前任务状态` 下写入:
|
|
288
288
|
|
|
@@ -305,8 +305,8 @@ graph TD
|
|
|
305
305
|
- ✅ 每个 Sprint 有退出标准和 INT 集成验证任务
|
|
306
306
|
- ✅ 生成了 Mermaid 依赖图
|
|
307
307
|
- ✅ User Story Overlay 已生成并验证覆盖完整性
|
|
308
|
-
- ✅ 已更新 .
|
|
309
|
-
- ✅ 更新了
|
|
308
|
+
- ✅ 已更新 AGENTS.md(含初始波次建议)
|
|
309
|
+
- ✅ 更新了 AGENTS.md AUTO:BEGIN 区块 (当前任务状态)
|
|
310
310
|
- ✅ 用户已确认
|
|
311
311
|
</completion_criteria>
|
|
312
312
|
|
|
@@ -317,4 +317,4 @@ graph TD
|
|
|
317
317
|
完成本工作流后,根据情况选择:
|
|
318
318
|
|
|
319
319
|
- **质疑设计与任务** → `/challenge` — 对设计和任务清单进行系统性审查
|
|
320
|
-
- **开始编码执行** → `/forge` — 按任务清单开始波次执行
|
|
320
|
+
- **开始编码执行** → `/forge` — 按任务清单开始波次执行
|
|
@@ -569,7 +569,7 @@ description: 当用户需要 [具体触发场景] 时使用。[一句话核心
|
|
|
569
569
|
- [ ] Markdown 格式正确无误
|
|
570
570
|
|
|
571
571
|
**输出后建议**:
|
|
572
|
-
- 如果是 Workflow,考虑将其添加到
|
|
572
|
+
- 如果是 Workflow,考虑将其添加到 `AGENTS.md` 的工作流注册表(如果是通用工作流)
|
|
573
573
|
- 如果是 Skill,确保相关 Workflow 知道如何调用它
|
|
574
574
|
|
|
575
575
|
---
|
|
@@ -502,7 +502,7 @@ description: 为单个系统设计详细的技术文档,通过调研最佳实
|
|
|
502
502
|
|
|
503
503
|
### Agent Context 自更新
|
|
504
504
|
|
|
505
|
-
**更新
|
|
505
|
+
**更新 `AGENTS.md` 的 `AUTO:BEGIN` ~ `AUTO:END` 区块**:
|
|
506
506
|
|
|
507
507
|
在 `### 系统边界` 下追加或更新当前设计系统的信息:
|
|
508
508
|
|
|
@@ -522,7 +522,7 @@ description: 为单个系统设计详细的技术文档,通过调研最佳实
|
|
|
522
522
|
- ✅ 调研已完成 (/explore)
|
|
523
523
|
- ✅ 设计已完成 (sequentialthinking 5-7步)
|
|
524
524
|
- ✅ 文档已生成 (使用模板)
|
|
525
|
-
- ✅ 更新了
|
|
525
|
+
- ✅ 更新了 AGENTS.md AUTO:BEGIN 区块 (系统边界)
|
|
526
526
|
- ✅ 用户已确认
|
|
527
527
|
</completion_criteria>
|
|
528
528
|
|
|
@@ -44,7 +44,7 @@ description: 按照架构文档和任务清单将设计锻造为代码,通过
|
|
|
44
44
|
> | 更新 `05_TASKS.md` 的 checkbox | ✅ | |
|
|
45
45
|
> | 运行测试和 lint | ✅ | |
|
|
46
46
|
> | Git commit 已完成的任务 | ✅ | |
|
|
47
|
-
> | 更新
|
|
47
|
+
> | 更新 `AGENTS.md` 当前状态 | ✅ | |
|
|
48
48
|
> | **修改 `genesis/` 下任何设计文档** | | ❌ |
|
|
49
49
|
> | **创建 TASKS.md 中不存在的功能** | | ❌ |
|
|
50
50
|
> | **降级或跳过验收标准** | | ❌ |
|
|
@@ -108,7 +108,7 @@ description: 按照架构文档和任务清单将设计锻造为代码,通过
|
|
|
108
108
|
5. **如果必需文件缺失**: 报错并提示运行 `/genesis` + `/blueprint`。
|
|
109
109
|
|
|
110
110
|
6. **断点续做判定**:
|
|
111
|
-
- 读取
|
|
111
|
+
- 读取 `AGENTS.md` 的 `🌊 Wave` 块
|
|
112
112
|
- 如果存在波次信息:
|
|
113
113
|
- 查看波次任务列表,对照 `05_TASKS.md` 中的 checkbox
|
|
114
114
|
- 如有未完成任务 → **断点续做** → 跳入 Step 3 继续未完成的任务
|
|
@@ -160,7 +160,7 @@ description: 按照架构文档和任务清单将设计锻造为代码,通过
|
|
|
160
160
|
确认此波次?或调整任务组合?
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
**人类检查点** ⚠️: 用户确认后,将确认的波次写入
|
|
163
|
+
**人类检查点** ⚠️: 用户确认后,将确认的波次写入 `AGENTS.md` 的 `🌊 Wave` 块:
|
|
164
164
|
|
|
165
165
|
```markdown
|
|
166
166
|
### 🌊 Wave {N} — {波次目标简述}
|
|
@@ -323,7 +323,7 @@ T{X.Y.Z}, T{X.Y.Z}, T{X.Y.Z}
|
|
|
323
323
|
> **每完成一个 task 并通过验证,立即回写 `05_TASKS.md`**。
|
|
324
324
|
> 这是进度持久化的核心机制——即使 AI 上下文丢失或会话崩溃,
|
|
325
325
|
> 下次加载 TASKS.md 就能看到精确进度。
|
|
326
|
-
> 配合
|
|
326
|
+
> 配合 AGENTS.md 的 Wave 块形成**双层恢复机制**: 粗粒度(Wave) + 细粒度(Task checkbox)。
|
|
327
327
|
|
|
328
328
|
- 将该任务的 `- [ ]` 改为 `- [x]`
|
|
329
329
|
- 确保回写后的 `05_TASKS.md` 与实际进度一致
|
|
@@ -338,7 +338,7 @@ T{X.Y.Z}, T{X.Y.Z}, T{X.Y.Z}
|
|
|
338
338
|
|
|
339
339
|
### 4.1 更新状态
|
|
340
340
|
|
|
341
|
-
**更新
|
|
341
|
+
**更新 `AGENTS.md`**:
|
|
342
342
|
|
|
343
343
|
1. 更新 `🌊 Wave` 块为下一波的初始状态(如果已知下一波任务),或标记当前波已完成:
|
|
344
344
|
```markdown
|
|
@@ -393,7 +393,7 @@ chore: Wave {N} settlement — update task progress
|
|
|
393
393
|
- ✅ 每个任务的遵从性检查全部通过
|
|
394
394
|
- ✅ 所有代码已 git commit,message 包含 Task ID
|
|
395
395
|
- ✅ 05_TASKS.md checkbox 已更新
|
|
396
|
-
- ✅ .
|
|
396
|
+
- ✅ AGENTS.md 当前状态已更新
|
|
397
397
|
- ✅ 用户已确认波次完成
|
|
398
398
|
</completion_criteria>
|
|
399
399
|
|
|
@@ -198,15 +198,15 @@ description: 从 0 到代码的项目启动全流程,将模糊想法转化为
|
|
|
198
198
|
|
|
199
199
|
## Step 7: 完成总结 (Completion Summary)
|
|
200
200
|
|
|
201
|
-
**目标**: 总结产出,并**更新 .
|
|
201
|
+
**目标**: 总结产出,并**更新 AGENTS.md** 以反映新版本。
|
|
202
202
|
|
|
203
203
|
> [!IMPORTANT]
|
|
204
204
|
> **必须完成以下 3 个更新动作**:
|
|
205
|
-
> 1. 更新 .
|
|
206
|
-
> 2. 更新 .
|
|
207
|
-
> 3. 更新 .
|
|
205
|
+
> 1. 更新 AGENTS.md "当前状态"
|
|
206
|
+
> 2. 更新 AGENTS.md "项目结构"
|
|
207
|
+
> 3. 更新 AGENTS.md "导航指南"
|
|
208
208
|
|
|
209
|
-
### 7.1 更新 .
|
|
209
|
+
### 7.1 更新 AGENTS.md
|
|
210
210
|
|
|
211
211
|
使用 `replace_file_content` 或 `multi_replace_file_content`:
|
|
212
212
|
|
|
@@ -254,7 +254,7 @@ description: 从 0 到代码的项目启动全流程,将模糊想法转化为
|
|
|
254
254
|
|
|
255
255
|
### 7.3 Agent Context 自更新
|
|
256
256
|
|
|
257
|
-
**更新
|
|
257
|
+
**更新 `AGENTS.md` 的 `AUTO:BEGIN` ~ `AUTO:END` 区块**:
|
|
258
258
|
|
|
259
259
|
仅修改 `<!-- AUTO:BEGIN -->` 和 `<!-- AUTO:END -->` 之间的内容,保留手动添加的内容不变。
|
|
260
260
|
|
|
@@ -283,8 +283,8 @@ description: 从 0 到代码的项目启动全流程,将模糊想法转化为
|
|
|
283
283
|
- ✅ 创建了 `genesis/v{N}/00_MANIFEST.md`
|
|
284
284
|
- ✅ 创建了 `genesis/v{N}/06_CHANGELOG.md`
|
|
285
285
|
- ✅ 生成了 PRD, Architecture Overview, ADRs
|
|
286
|
-
- ✅ 更新了 .
|
|
287
|
-
- ✅ 更新了
|
|
286
|
+
- ✅ 更新了 AGENTS.md (当前状态、项目结构、导航指南)
|
|
287
|
+
- ✅ 更新了 AGENTS.md AUTO:BEGIN 区块 (技术栈、系统边界、活跃 ADR)
|
|
288
288
|
- ✅ 用户已在人类检查点确认
|
|
289
289
|
</completion_criteria>
|
|
290
290
|
|
|
@@ -296,4 +296,4 @@ description: 从 0 到代码的项目启动全流程,将模糊想法转化为
|
|
|
296
296
|
|
|
297
297
|
- **设计系统详细架构** → `/design-system` — 为 {system-id} 设计详细架构 *(项目包含复杂系统时)*
|
|
298
298
|
- **生成任务清单** → `/blueprint` — 将架构拆解为可执行任务
|
|
299
|
-
- **质疑设计决策** → `/challenge` — 对当前设计进行系统性挑战
|
|
299
|
+
- **质疑设计决策** → `/challenge` — 对当前设计进行系统性挑战
|
package/templates/AGENTS.md
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
# AGENTS.md - AI 协作协议
|
|
2
|
-
|
|
3
|
-
> **"如果你正在阅读此文档,你就是那个智能体 (The Intelligence)。"**
|
|
4
|
-
>
|
|
5
|
-
> 这个文件是你的**锚点 (Anchor)**。它定义了项目的法则、领地的地图,以及记忆协议。
|
|
6
|
-
> 当你唤醒(开始新会话)时,**请首先阅读此文件**。
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🧠 30秒恢复协议 (Quick Recovery)
|
|
11
|
-
|
|
12
|
-
**当你开始新会话或感到"迷失"时,立即执行**:
|
|
13
|
-
|
|
14
|
-
1. **读取根目录的 AGENTS.md** → 获取项目地图
|
|
15
|
-
2. **查看下方"当前状态"** → 找到最新架构版本
|
|
16
|
-
3. **读取 `genesis/v{N}/05_TASKS.md`** → 了解当前待办
|
|
17
|
-
4. **开始工作**
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 🗺️ 地图 (领地感知)
|
|
22
|
-
|
|
23
|
-
以下是这个项目的组织方式:
|
|
24
|
-
|
|
25
|
-
| 路径 | 描述 | 访问协议 |
|
|
26
|
-
|------|------|----------|
|
|
27
|
-
| `src/` | **实现层**。实际的代码库。 | 通过 Task 读/写。 |
|
|
28
|
-
| `genesis/` | **设计演进史**。版本化架构状态 (v1, v2...)。 | **只读**(旧版) / **写一次**(新版)。 |
|
|
29
|
-
| `genesis/v{N}/` | **当前真理**。最新的架构定义。 | 永远寻找最大的 `v{N}`。 |
|
|
30
|
-
| `.agent/workflows/` | **工作流**。`/genesis`, `/blueprint` 等。 | 通过 `view_file` 阅读。 |
|
|
31
|
-
| `.agent/skills/` | **技能库**。原子能力。 | 通过 `view_file` 调用。 |
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 📍 当前状态 (由 Workflow 自动更新)
|
|
36
|
-
|
|
37
|
-
> **注意**: 此部分由 `/genesis`、`/blueprint` 和 `/forge` 自动维护。
|
|
38
|
-
|
|
39
|
-
- **最新架构版本**: `尚未初始化`
|
|
40
|
-
- **活动任务清单**: `尚未生成`
|
|
41
|
-
- **待办任务数**: -
|
|
42
|
-
- **最近一次更新**: `-`
|
|
43
|
-
|
|
44
|
-
### 🌊 Wave 1 — 待 /blueprint 或 /forge 设置
|
|
45
|
-
_尚未开始执行_
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 🌳 项目结构 (Project Tree)
|
|
50
|
-
|
|
51
|
-
> **注意**: 此部分由 `/genesis` 维护。
|
|
52
|
-
|
|
53
|
-
```text
|
|
54
|
-
(等待 Genesis 初始化结构树...)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## 🧭 导航指南 (Navigation Guide)
|
|
60
|
-
|
|
61
|
-
> **注意**: 此部分由 `/genesis` 维护。
|
|
62
|
-
|
|
63
|
-
- **在新架构就绪前**: 请勿大规模修改代码。
|
|
64
|
-
- **遇到架构问题**: 请查阅 `genesis/v{N}/03_ADR/`。
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## 🛠️ 工作流注册表
|
|
69
|
-
|
|
70
|
-
| 工作流 | 触发时机 | 产出 |
|
|
71
|
-
|--------|---------|------|
|
|
72
|
-
| `/quickstart` | 新用户入口 / 不知道从哪开始 | 编排其他工作流 |
|
|
73
|
-
| `/genesis` | 新项目 / 重大重构 | PRD, Architecture, ADRs |
|
|
74
|
-
| `/scout` | 变更前 / 接手项目 | `genesis/v{N}/00_SCOUT_REPORT.md` |
|
|
75
|
-
| `/design-system` | genesis 后 | 04_SYSTEM_DESIGN/*.md |
|
|
76
|
-
| `/blueprint` | genesis 后 | 05_TASKS.md + AGENTS.md 初始 Wave |
|
|
77
|
-
| `/change` | 微调已有任务 | 更新 TASKS + SYSTEM_DESIGN (仅修改) + CHANGELOG |
|
|
78
|
-
| `/explore` | 调研时 | 探索报告 |
|
|
79
|
-
| `/challenge` | 决策前质疑 | 07_CHALLENGE_REPORT.md (含问题总览目录) |
|
|
80
|
-
| `/forge` | 编码执行 | 代码 + 更新 AGENTS.md Wave 块 |
|
|
81
|
-
| `/craft` | 创建工作流/技能/提示词 | Workflow / Skill / Prompt 文档 |
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## 📜 宪法 (The Constitution)
|
|
86
|
-
|
|
87
|
-
1. **版本即法律**: 不"修补"架构文档,只"演进"。变更必须创建新版本。
|
|
88
|
-
2. **显式上下文**: 决策写入 ADR,不留在"聊天记忆"里。
|
|
89
|
-
3. **交叉验证**: 编码前对照 `05_TASKS.md`。我在做计划好的事吗?
|
|
90
|
-
4. **美学**: 文档应该是美的。善用 Markdown 和 Emoji。
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
## 🔄 Auto-Updated Context
|
|
94
|
-
|
|
95
|
-
<!-- AUTO:BEGIN — 由工作流自动维护,请勿手动编辑此区块 -->
|
|
96
|
-
|
|
97
|
-
### 技术栈决策
|
|
98
|
-
- [由 genesis/tech-evaluator 自动填充]
|
|
99
|
-
|
|
100
|
-
### 系统边界
|
|
101
|
-
- [由 genesis/system-architect 自动填充]
|
|
102
|
-
|
|
103
|
-
### 活跃 ADR
|
|
104
|
-
- [由 genesis 自动填充 ADR 摘要]
|
|
105
|
-
|
|
106
|
-
### 当前任务状态
|
|
107
|
-
- [由 blueprint/forge 自动更新]
|
|
108
|
-
|
|
109
|
-
<!-- AUTO:END -->
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
> **状态自检**: 准备好了?提醒用户运行 `/quickstart` 开始吧。
|
|
113
|
-
\n# TEST NEW CONTENT\n
|
|
1
|
+
# AGENTS.md - AI 协作协议
|
|
2
|
+
|
|
3
|
+
> **"如果你正在阅读此文档,你就是那个智能体 (The Intelligence)。"**
|
|
4
|
+
>
|
|
5
|
+
> 这个文件是你的**锚点 (Anchor)**。它定义了项目的法则、领地的地图,以及记忆协议。
|
|
6
|
+
> 当你唤醒(开始新会话)时,**请首先阅读此文件**。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🧠 30秒恢复协议 (Quick Recovery)
|
|
11
|
+
|
|
12
|
+
**当你开始新会话或感到"迷失"时,立即执行**:
|
|
13
|
+
|
|
14
|
+
1. **读取根目录的 AGENTS.md** → 获取项目地图
|
|
15
|
+
2. **查看下方"当前状态"** → 找到最新架构版本
|
|
16
|
+
3. **读取 `genesis/v{N}/05_TASKS.md`** → 了解当前待办
|
|
17
|
+
4. **开始工作**
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🗺️ 地图 (领地感知)
|
|
22
|
+
|
|
23
|
+
以下是这个项目的组织方式:
|
|
24
|
+
|
|
25
|
+
| 路径 | 描述 | 访问协议 |
|
|
26
|
+
|------|------|----------|
|
|
27
|
+
| `src/` | **实现层**。实际的代码库。 | 通过 Task 读/写。 |
|
|
28
|
+
| `genesis/` | **设计演进史**。版本化架构状态 (v1, v2...)。 | **只读**(旧版) / **写一次**(新版)。 |
|
|
29
|
+
| `genesis/v{N}/` | **当前真理**。最新的架构定义。 | 永远寻找最大的 `v{N}`。 |
|
|
30
|
+
| `.agent/workflows/` | **工作流**。`/genesis`, `/blueprint` 等。 | 通过 `view_file` 阅读。 |
|
|
31
|
+
| `.agent/skills/` | **技能库**。原子能力。 | 通过 `view_file` 调用。 |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 📍 当前状态 (由 Workflow 自动更新)
|
|
36
|
+
|
|
37
|
+
> **注意**: 此部分由 `/genesis`、`/blueprint` 和 `/forge` 自动维护。
|
|
38
|
+
|
|
39
|
+
- **最新架构版本**: `尚未初始化`
|
|
40
|
+
- **活动任务清单**: `尚未生成`
|
|
41
|
+
- **待办任务数**: -
|
|
42
|
+
- **最近一次更新**: `-`
|
|
43
|
+
|
|
44
|
+
### 🌊 Wave 1 — 待 /blueprint 或 /forge 设置
|
|
45
|
+
_尚未开始执行_
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🌳 项目结构 (Project Tree)
|
|
50
|
+
|
|
51
|
+
> **注意**: 此部分由 `/genesis` 维护。
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
(等待 Genesis 初始化结构树...)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🧭 导航指南 (Navigation Guide)
|
|
60
|
+
|
|
61
|
+
> **注意**: 此部分由 `/genesis` 维护。
|
|
62
|
+
|
|
63
|
+
- **在新架构就绪前**: 请勿大规模修改代码。
|
|
64
|
+
- **遇到架构问题**: 请查阅 `genesis/v{N}/03_ADR/`。
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🛠️ 工作流注册表
|
|
69
|
+
|
|
70
|
+
| 工作流 | 触发时机 | 产出 |
|
|
71
|
+
|--------|---------|------|
|
|
72
|
+
| `/quickstart` | 新用户入口 / 不知道从哪开始 | 编排其他工作流 |
|
|
73
|
+
| `/genesis` | 新项目 / 重大重构 | PRD, Architecture, ADRs |
|
|
74
|
+
| `/scout` | 变更前 / 接手项目 | `genesis/v{N}/00_SCOUT_REPORT.md` |
|
|
75
|
+
| `/design-system` | genesis 后 | 04_SYSTEM_DESIGN/*.md |
|
|
76
|
+
| `/blueprint` | genesis 后 | 05_TASKS.md + AGENTS.md 初始 Wave |
|
|
77
|
+
| `/change` | 微调已有任务 | 更新 TASKS + SYSTEM_DESIGN (仅修改) + CHANGELOG |
|
|
78
|
+
| `/explore` | 调研时 | 探索报告 |
|
|
79
|
+
| `/challenge` | 决策前质疑 | 07_CHALLENGE_REPORT.md (含问题总览目录) |
|
|
80
|
+
| `/forge` | 编码执行 | 代码 + 更新 AGENTS.md Wave 块 |
|
|
81
|
+
| `/craft` | 创建工作流/技能/提示词 | Workflow / Skill / Prompt 文档 |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 📜 宪法 (The Constitution)
|
|
86
|
+
|
|
87
|
+
1. **版本即法律**: 不"修补"架构文档,只"演进"。变更必须创建新版本。
|
|
88
|
+
2. **显式上下文**: 决策写入 ADR,不留在"聊天记忆"里。
|
|
89
|
+
3. **交叉验证**: 编码前对照 `05_TASKS.md`。我在做计划好的事吗?
|
|
90
|
+
4. **美学**: 文档应该是美的。善用 Markdown 和 Emoji。
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
## 🔄 Auto-Updated Context
|
|
94
|
+
|
|
95
|
+
<!-- AUTO:BEGIN — 由工作流自动维护,请勿手动编辑此区块 -->
|
|
96
|
+
|
|
97
|
+
### 技术栈决策
|
|
98
|
+
- [由 genesis/tech-evaluator 自动填充]
|
|
99
|
+
|
|
100
|
+
### 系统边界
|
|
101
|
+
- [由 genesis/system-architect 自动填充]
|
|
102
|
+
|
|
103
|
+
### 活跃 ADR
|
|
104
|
+
- [由 genesis 自动填充 ADR 摘要]
|
|
105
|
+
|
|
106
|
+
### 当前任务状态
|
|
107
|
+
- [由 blueprint/forge 自动更新]
|
|
108
|
+
|
|
109
|
+
<!-- AUTO:END -->
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
> **状态自检**: 准备好了?提醒用户运行 `/quickstart` 开始吧。
|
|
113
|
+
\n# TEST NEW CONTENT\n
|