@haaaiawd/anws 1.2.3 → 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 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 | `.agent/rules/agents.md` + versioned docs as persistent memory |
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 `agents.md`.
56
- > If the `agents.md` template has new content, an `agents.md.new` file will be generated for you to merge manually.
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/bin/cli.js CHANGED
@@ -34,11 +34,16 @@ const { values, positionals } = parseArgs({
34
34
  options: {
35
35
  version: { type: 'boolean', short: 'v', default: false },
36
36
  help: { type: 'boolean', short: 'h', default: false },
37
+ yes: { type: 'boolean', short: 'y', default: false },
37
38
  },
38
39
  strict: false,
39
40
  allowPositionals: true,
40
41
  });
41
42
 
43
+ if (values.yes) {
44
+ global.__ANWS_FORCE_YES = true;
45
+ }
46
+
42
47
  // ─── 命令路由 ─────────────────────────────────────────────────────────────────
43
48
  async function main() {
44
49
  if (values.version) {
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,186 +1,221 @@
1
- 'use strict';
2
-
3
- const fs = require('node:fs/promises');
4
- const path = require('node:path');
5
- const crypto = require('node:crypto');
6
- const { copyDir } = require('./copy');
7
- const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
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
-
18
- // ── 冲突检测(T1.2.3 在此处插入冲突分支)──────────────────────────────────
19
- const conflicting = await findConflicts(cwd);
20
- if (conflicting.length > 0) {
21
- const confirmed = await askOverwrite(conflicting.length);
22
- if (!confirmed) {
23
- blank();
24
- info('Aborted. No files were changed.');
25
- process.exit(0);
26
- }
27
- // 仅覆盖托管文件(用户自有文件不受影响)
28
- const { written: updated, skipped } = await overwriteManaged(srcRoot, cwd);
29
- await storeAgentsTemplateHash(srcRoot, cwd);
30
- printSummary(updated, skipped, 'updated');
31
- return;
32
- }
33
- // ── 无冲突:直接复制 ─────────────────────────────────────────────────────────
34
-
35
- logo();
36
- info('Initializing Antigravity Workflow System...');
37
- blank();
38
-
39
- const written = await copyDir(srcRoot, destRoot);
40
-
41
- // 存储 agents.md 模板指纹,供后续 update 检测模板变化
42
- await storeAgentsTemplateHash(srcRoot, cwd);
43
-
44
- // 打印文件列表
45
- for (const absPath of written) {
46
- const rel = path.relative(cwd, absPath).replace(/\\/g, '/');
47
- fileLine(rel);
48
- }
49
-
50
- blank();
51
- success(`Done! ${written.length} files written to .agent/`);
52
- printNextSteps();
53
- }
54
-
55
- // ─── 辅助函数 ──────────────────────────────────────────────────────────────────
56
-
57
- /**
58
- * 找出 cwd 中已存在的托管文件列表。
59
- * @returns {Promise<string[]>} 已存在的托管文件相对路径数组
60
- */
61
- async function findConflicts(cwd) {
62
- const conflicts = [];
63
- for (const rel of MANAGED_FILES) {
64
- const abs = path.join(cwd, rel);
65
- const exists = await fs.access(abs).then(() => true).catch(() => false);
66
- if (exists) conflicts.push(rel);
67
- }
68
- return conflicts;
69
- }
70
-
71
- /**
72
- * 交互式询问用户是否覆盖(默认 N)。
73
- * 非 TTY 环境(如 CI)自动返回 false。
74
- * @returns {Promise<boolean>}
75
- */
76
- async function askOverwrite(count) {
77
- // 非 TTY 环境:默认不覆盖,防止 CI 挂起
78
- if (!process.stdin.isTTY) {
79
- warn(`${count} managed file(s) already exist. Non-TTY: skipping overwrite.`);
80
- return false;
81
- }
82
-
83
- const readline = require('node:readline');
84
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
85
-
86
- return new Promise((resolve) => {
87
- rl.question(
88
- `\n\u26a0 ${count} managed file(s) already exist. Overwrite? [y/N] `,
89
- (answer) => {
90
- rl.close();
91
- resolve(answer.trim().toLowerCase() === 'y');
92
- }
93
- );
94
- });
95
- }
96
-
97
- /**
98
- * 仅覆盖 MANAGED_FILES 清单内的文件,用户自有文件不受影响。
99
- * USER_PROTECTED_FILES 中的文件即便冲突也跳过,保留用户修改。
100
- * @returns {{ written: string[], skipped: string[] }}
101
- */
102
- async function overwriteManaged(srcRoot, cwd) {
103
- const srcBase = path.dirname(srcRoot); // templates/
104
- const written = [];
105
- const skipped = [];
106
-
107
- for (const rel of MANAGED_FILES) {
108
- // 受保护文件:文件已存在时跳过,交给用户自行维护
109
- if (USER_PROTECTED_FILES.includes(rel)) {
110
- const destPath = path.join(cwd, rel);
111
- const exists = await fs.access(destPath).then(() => true).catch(() => false);
112
- if (exists) {
113
- skipped.push(rel);
114
- continue;
115
- }
116
- }
117
-
118
- const srcPath = path.join(srcBase, rel);
119
- const destPath = path.join(cwd, rel);
120
-
121
- await fs.mkdir(path.dirname(destPath), { recursive: true });
122
- const srcExists = await fs.access(srcPath).then(() => true).catch(() => false);
123
- if (srcExists) {
124
- await fs.copyFile(srcPath, destPath);
125
- written.push(rel);
126
- }
127
- }
128
-
129
- return { written, skipped };
130
- }
131
-
132
- /**
133
- * 打印操作摘要(更新场景)。
134
- * @param {string[]} files 已写入的文件
135
- * @param {string[]} skipped 受保护跳过的文件
136
- * @param {string} action
137
- */
138
- function printSummary(files, skipped = [], action) {
139
- const verb = action === 'updated' ? 'Updating' : 'Writing';
140
- blank();
141
- info(`${verb} files...`);
142
- blank();
143
- for (const rel of files) {
144
- fileLine(rel.replace(/\\/g, '/'));
145
- }
146
- if (skipped.length > 0) {
147
- blank();
148
- info('Skipped (project-specific, preserved):');
149
- for (const rel of skipped) {
150
- skippedLine(rel.replace(/\\/g, '/'));
151
- }
152
- }
153
- blank();
154
- success(`Done! ${files.length} file(s) ${action}${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
155
- if (action === 'updated') {
156
- info('Managed files have been updated to the latest version.');
157
- }
158
- }
159
-
160
- function printNextSteps() {
161
- blank();
162
- info('Next steps:');
163
- info(' 1. Read .agent/rules/agents.md to understand the system');
164
- info(' 2. Run /quickstart in your AI assistant to analyze and start the workflow');
165
- }
166
-
167
- /**
168
- * 存储 agents.md 模板的 MD5 指纹。
169
- * 供 `anws update` 检测模板是否在版本间发生了变化。
170
- * @param {string} srcRoot 模板 .agent/ 目录绝对路径
171
- * @param {string} cwd 项目根目录
172
- */
173
- async function storeAgentsTemplateHash(srcRoot, cwd) {
174
- const templatePath = path.join(srcRoot, 'rules', 'agents.md');
175
- const hashPath = path.join(cwd, '.agent', 'rules', '.agents-template-hash');
176
-
177
- try {
178
- const content = await fs.readFile(templatePath, 'utf-8');
179
- const hash = crypto.createHash('md5').update(content).digest('hex');
180
- await fs.writeFile(hashPath, hash, 'utf-8');
181
- } catch {
182
- // 模板文件不存在时静默失败(不应该发生)
183
- }
184
- }
185
-
186
- module.exports = init;
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/manifest.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * 此数组列出 anws 包负责管理的所有文件路径(相对于目标项目根目录)。
7
7
  */
8
8
  const MANAGED_FILES = [
9
- '.agent/rules/agents.md',
9
+ 'AGENTS.md',
10
10
  '.agent/skills/build-inspector/SKILL.md',
11
11
  '.agent/skills/complexity-guard/references/anti_patterns.md',
12
12
  '.agent/skills/complexity-guard/SKILL.md',
@@ -53,7 +53,7 @@ const MANAGED_FILES = [
53
53
  * anws update 默认会跳过这些文件。
54
54
  */
55
55
  const USER_PROTECTED_FILES = [
56
- '.agent/rules/agents.md'
56
+ 'AGENTS.md'
57
57
  ];
58
58
 
59
59
  module.exports = {
package/lib/update.js CHANGED
@@ -1,153 +1,147 @@
1
- 'use strict';
2
-
3
- const fs = require('node:fs/promises');
4
- const path = require('node:path');
5
- const crypto = require('node:crypto');
6
- const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
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 fs.access(agentDir).then(() => true).catch(() => false);
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 updated = [];
37
- const skipped = [];
38
-
39
- for (const rel of MANAGED_FILES) {
40
- if (USER_PROTECTED_FILES.includes(rel)) {
41
- skipped.push(rel);
42
- continue;
43
- }
44
-
45
- const srcPath = path.join(path.dirname(srcRoot), rel);
46
- const destPath = path.join(cwd, rel);
47
-
48
- const srcExists = await fs.access(srcPath).then(() => true).catch(() => false);
49
- if (!srcExists) continue;
50
-
51
- await fs.mkdir(path.dirname(destPath), { recursive: true });
52
- await fs.copyFile(srcPath, destPath);
53
- updated.push(rel);
54
- }
55
-
56
- // 打印摘要
57
- blank();
58
- info('Updated files:');
59
- blank();
60
- for (const rel of updated) {
61
- fileLine(rel.replace(/\\/g, '/'));
62
- }
63
- if (skipped.length > 0) {
64
- blank();
65
- info('Skipped (project-specific, preserved):');
66
- for (const rel of skipped) {
67
- skippedLine(rel.replace(/\\/g, '/'));
68
- }
69
- }
70
-
71
- // 检查 agents.md 模板是否有变更,提供 .new 文件供用户合并
72
- const agentsMerged = await checkAgentsTemplate(cwd, srcRoot);
73
-
74
- blank();
75
- success(`Done! ${updated.length} file(s) updated${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
76
- info('Managed files have been updated to the latest version.');
77
- info('Your custom files in .agent/ were not touched.');
78
-
79
- if (agentsMerged) {
80
- blank();
81
- warn('agents.md template has changed!');
82
- info('A new template has been saved to:');
83
- info(' .agent/rules/agents.md.new');
84
- blank();
85
- info('Please review and merge the changes into your agents.md.');
86
- info('After merging, delete agents.md.new.');
87
- }
88
- }
89
-
90
- /**
91
- * 交互式确认更新操作(默认 N)。
92
- */
93
- async function askUpdate() {
94
- if (!process.stdin.isTTY) {
95
- warn('Non-TTY environment detected. Skipping update to avoid accidental overwrites.');
96
- return false;
97
- }
98
-
99
- const readline = require('node:readline');
100
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
101
-
102
- return new Promise((resolve) => {
103
- rl.question(
104
- '\n\u26a0 This will overwrite all managed .agent/ files. Continue? [y/N] ',
105
- (answer) => {
106
- rl.close();
107
- resolve(answer.trim().toLowerCase() === 'y');
108
- }
109
- );
110
- });
111
- }
112
-
113
- /**
114
- * 检查 agents.md 模板是否相比上次安装/更新有变化。
115
- * 用 hash 文件记录上次模板指纹,与新模板比较。
116
- * 如果有变化 → 写入 agents.md.new + 更新 hash。
117
- *
118
- * @param {string} cwd 项目根目录
119
- * @param {string} srcRoot 模板 .agent/ 目录
120
- * @returns {Promise<boolean>} 是否产生了 .new 文件
121
- */
122
- async function checkAgentsTemplate(cwd, srcRoot) {
123
- const templatePath = path.join(path.dirname(srcRoot), '.agent', 'rules', 'agents.md');
124
- const hashPath = path.join(cwd, '.agent', 'rules', '.agents-template-hash');
125
- const newPath = path.join(cwd, '.agent', 'rules', 'agents.md.new');
126
-
127
- const templateExists = await fs.access(templatePath).then(() => true).catch(() => false);
128
- if (!templateExists) return false;
129
-
130
- const templateContent = await fs.readFile(templatePath, 'utf-8');
131
- const newHash = crypto.createHash('md5').update(templateContent).digest('hex');
132
-
133
- // 读取上次存储的 hash
134
- let oldHash = null;
135
- try {
136
- oldHash = (await fs.readFile(hashPath, 'utf-8')).trim();
137
- } catch {
138
- // hash 文件不存在(首次 update 或旧版本安装)
139
- }
140
-
141
- if (oldHash === newHash) {
142
- return false; // 模板没变化
143
- }
144
-
145
- // 模板有变化 → 写入 .new 供用户合并
146
- await fs.writeFile(newPath, templateContent, 'utf-8');
147
- // 更新 hash 记录
148
- await fs.writeFile(hashPath, newHash, 'utf-8');
149
-
150
- return true;
151
- }
152
-
153
- 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",
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
- **目标**: 保存最终的任务清单,并**更新 .agent/rules/agents.md**。
235
+ **目标**: 保存最终的任务清单,并**更新 AGENTS.md**。
236
236
 
237
237
  1. **保存**: 将内容保存到 `genesis/v{N}/05_TASKS.md`
238
238
  2. **验证**: 确保文件包含所有任务、验收标准和依赖图。
239
- 3. **更新 .agent/rules/agents.md "当前状态"**:
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
- - ✅ 已更新 .agent/rules/agents.md(含初始波次建议)?
257
+ - ✅ 已更新 AGENTS.md(含初始波次建议)?
258
258
 
259
259
  ---
260
260
 
@@ -282,7 +282,7 @@ graph TD
282
282
 
283
283
  ### Agent Context 自更新
284
284
 
285
- **更新 `.agent/rules/agents.md` 的 `AUTO:BEGIN` ~ `AUTO:END` 区块**:
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
- - ✅ 已更新 .agent/rules/agents.md(含初始波次建议)
309
- - ✅ 更新了 agents.md AUTO:BEGIN 区块 (当前任务状态)
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` — 按任务清单开始波次执行
@@ -227,7 +227,7 @@ description: 处理微调级变更请求,通过 7 问题法严格评估,仅
227
227
  - PRD 追溯: [REQ-XXX]
228
228
  ```
229
229
 
230
- 3. **更新 .agent/rules/agents.md**:
230
+ 3. **更新 AGENTS.md**:
231
231
  - 更新 `最近一次更新` 日期。
232
232
  - (注意: 微调不改变待办任务数)
233
233
 
@@ -569,7 +569,7 @@ description: 当用户需要 [具体触发场景] 时使用。[一句话核心
569
569
  - [ ] Markdown 格式正确无误
570
570
 
571
571
  **输出后建议**:
572
- - 如果是 Workflow,考虑将其添加到 `.agent/rules/agents.md` 的工作流注册表(如果是通用工作流)
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
- **更新 `.agent/rules/agents.md` 的 `AUTO:BEGIN` ~ `AUTO:END` 区块**:
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
- - ✅ 更新了 agents.md AUTO:BEGIN 区块 (系统边界)
525
+ - ✅ 更新了 AGENTS.md AUTO:BEGIN 区块 (系统边界)
526
526
  - ✅ 用户已确认
527
527
  </completion_criteria>
528
528
 
@@ -313,4 +313,4 @@ description: 深度探索复杂问题,通过"向外搜索 + 向内发散"双
313
313
 
314
314
  ---
315
315
 
316
- // turbo-all
316
+ // turbo-all
@@ -44,7 +44,7 @@ description: 按照架构文档和任务清单将设计锻造为代码,通过
44
44
  > | 更新 `05_TASKS.md` 的 checkbox | ✅ | |
45
45
  > | 运行测试和 lint | ✅ | |
46
46
  > | Git commit 已完成的任务 | ✅ | |
47
- > | 更新 `.agent/rules/agents.md` 当前状态 | ✅ | |
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
- - 读取 `.agent/rules/agents.md` 的 `🌊 Wave` 块
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
- **人类检查点** ⚠️: 用户确认后,将确认的波次写入 `.agent/rules/agents.md` 的 `🌊 Wave` 块:
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
- > 配合 agents.md 的 Wave 块形成**双层恢复机制**: 粗粒度(Wave) + 细粒度(Task checkbox)。
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
- **更新 `.agent/rules/agents.md`**:
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
- - ✅ .agent/rules/agents.md 当前状态已更新
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
- **目标**: 总结产出,并**更新 .agent/rules/agents.md** 以反映新版本。
201
+ **目标**: 总结产出,并**更新 AGENTS.md** 以反映新版本。
202
202
 
203
203
  > [!IMPORTANT]
204
204
  > **必须完成以下 3 个更新动作**:
205
- > 1. 更新 .agent/rules/agents.md "当前状态"
206
- > 2. 更新 .agent/rules/agents.md "项目结构"
207
- > 3. 更新 .agent/rules/agents.md "导航指南"
205
+ > 1. 更新 AGENTS.md "当前状态"
206
+ > 2. 更新 AGENTS.md "项目结构"
207
+ > 3. 更新 AGENTS.md "导航指南"
208
208
 
209
- ### 7.1 更新 .agent/rules/agents.md
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
- **更新 `.agent/rules/agents.md` 的 `AUTO:BEGIN` ~ `AUTO:END` 区块**:
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
- - ✅ 更新了 .agent/rules/agents.md (当前状态、项目结构、导航指南)
287
- - ✅ 更新了 agents.md AUTO:BEGIN 区块 (技术栈、系统边界、活跃 ADR)
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` — 对当前设计进行系统性挑战
@@ -136,4 +136,4 @@ Scout 的发现将作为**输入**反馈给 Architectural Overview。
136
136
 
137
137
  完成本工作流后,根据情况选择:
138
138
 
139
- - **启动新版本架构** → `/genesis` — 基于侦察发现启动架构重构 *(发现需要重大重构时)*
139
+ - **启动新版本架构** → `/genesis` — 基于侦察发现启动架构重构 *(发现需要重大重构时)*
@@ -11,7 +11,7 @@
11
11
 
12
12
  **当你开始新会话或感到"迷失"时,立即执行**:
13
13
 
14
- 1. **读取 .agent/rules/agents.md** → 获取项目地图
14
+ 1. **读取根目录的 AGENTS.md** → 获取项目地图
15
15
  2. **查看下方"当前状态"** → 找到最新架构版本
16
16
  3. **读取 `genesis/v{N}/05_TASKS.md`** → 了解当前待办
17
17
  4. **开始工作**
@@ -73,11 +73,11 @@ _尚未开始执行_
73
73
  | `/genesis` | 新项目 / 重大重构 | PRD, Architecture, ADRs |
74
74
  | `/scout` | 变更前 / 接手项目 | `genesis/v{N}/00_SCOUT_REPORT.md` |
75
75
  | `/design-system` | genesis 后 | 04_SYSTEM_DESIGN/*.md |
76
- | `/blueprint` | genesis 后 | 05_TASKS.md + agents.md 初始 Wave |
76
+ | `/blueprint` | genesis 后 | 05_TASKS.md + AGENTS.md 初始 Wave |
77
77
  | `/change` | 微调已有任务 | 更新 TASKS + SYSTEM_DESIGN (仅修改) + CHANGELOG |
78
78
  | `/explore` | 调研时 | 探索报告 |
79
79
  | `/challenge` | 决策前质疑 | 07_CHALLENGE_REPORT.md (含问题总览目录) |
80
- | `/forge` | 编码执行 | 代码 + 更新 agents.md Wave 块 |
80
+ | `/forge` | 编码执行 | 代码 + 更新 AGENTS.md Wave 块 |
81
81
  | `/craft` | 创建工作流/技能/提示词 | Workflow / Skill / Prompt 文档 |
82
82
 
83
83
  ---
@@ -110,3 +110,4 @@ _尚未开始执行_
110
110
 
111
111
  ---
112
112
  > **状态自检**: 准备好了?提醒用户运行 `/quickstart` 开始吧。
113
+ \n# TEST NEW CONTENT\n
@@ -1 +0,0 @@
1
- 0b7931a8ef4374d59141cdc919d4bc47
@@ -1,112 +0,0 @@
1
- # AGENTS.md - AI 协作协议
2
-
3
- > **"如果你正在阅读此文档,你就是那个智能体 (The Intelligence)。"**
4
- >
5
- > 这个文件是你的**锚点 (Anchor)**。它定义了项目的法则、领地的地图,以及记忆协议。
6
- > 当你唤醒(开始新会话)时,**请首先阅读此文件**。
7
-
8
- ---
9
-
10
- ## 🧠 30秒恢复协议 (Quick Recovery)
11
-
12
- **当你开始新会话或感到"迷失"时,立即执行**:
13
-
14
- 1. **读取 .agent/rules/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` 开始吧。