@haaaiawd/anws 1.0.0 → 1.0.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 +1 -1
- package/lib/init.js +34 -11
- package/lib/manifest.js +58 -53
- package/lib/output.js +6 -1
- package/lib/update.js +18 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ anws update
|
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
# 克隆仓库
|
|
64
|
-
git clone https://github.com/
|
|
64
|
+
git clone https://github.com/Haaaiawd/Antigravity-Workflow-System.git
|
|
65
65
|
|
|
66
66
|
# 将 templates/.agent/ 复制到你的项目
|
|
67
67
|
cp -r Antigravity-Workflow-System/src/anws/templates/.agent/ my-project/
|
package/lib/init.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
const fs = require('node:fs/promises');
|
|
4
4
|
const path = require('node:path');
|
|
5
5
|
const { copyDir } = require('./copy');
|
|
6
|
-
const { MANAGED_FILES } = require('./manifest');
|
|
7
|
-
const { success, warn, info, fileLine, blank, logo } = require('./output');
|
|
6
|
+
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
7
|
+
const { success, warn, info, fileLine, skippedLine, blank, logo } = require('./output');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* anws init — 将工作流系统写入当前项目
|
|
@@ -24,8 +24,8 @@ async function init() {
|
|
|
24
24
|
process.exit(0);
|
|
25
25
|
}
|
|
26
26
|
// 仅覆盖托管文件(用户自有文件不受影响)
|
|
27
|
-
await overwriteManaged(srcRoot, cwd);
|
|
28
|
-
printSummary(
|
|
27
|
+
const { written: updated, skipped } = await overwriteManaged(srcRoot, cwd);
|
|
28
|
+
printSummary(updated, skipped, 'updated');
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
// ── 无冲突:直接复制 ─────────────────────────────────────────────────────────
|
|
@@ -91,30 +91,46 @@ async function askOverwrite(count) {
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* 仅覆盖 MANAGED_FILES 清单内的文件,用户自有文件不受影响。
|
|
94
|
+
* USER_PROTECTED_FILES 中的文件即便冲突也跳过,保留用户修改。
|
|
95
|
+
* @returns {{ written: string[], skipped: string[] }}
|
|
94
96
|
*/
|
|
95
97
|
async function overwriteManaged(srcRoot, cwd) {
|
|
96
|
-
// srcRoot 是 templates/.agent/
|
|
97
98
|
const srcBase = path.dirname(srcRoot); // templates/
|
|
99
|
+
const written = [];
|
|
100
|
+
const skipped = [];
|
|
101
|
+
|
|
98
102
|
for (const rel of MANAGED_FILES) {
|
|
99
|
-
//
|
|
103
|
+
// 受保护文件:文件已存在时跳过,交给用户自行维护
|
|
104
|
+
if (USER_PROTECTED_FILES.includes(rel)) {
|
|
105
|
+
const destPath = path.join(cwd, rel);
|
|
106
|
+
const exists = await fs.access(destPath).then(() => true).catch(() => false);
|
|
107
|
+
if (exists) {
|
|
108
|
+
skipped.push(rel);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
const srcPath = path.join(srcBase, rel);
|
|
101
114
|
const destPath = path.join(cwd, rel);
|
|
102
115
|
|
|
103
|
-
// 确保目标目录存在
|
|
104
116
|
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
105
|
-
|
|
106
|
-
// 只复制 templates 中存在的文件(安全检查)
|
|
107
117
|
const srcExists = await fs.access(srcPath).then(() => true).catch(() => false);
|
|
108
118
|
if (srcExists) {
|
|
109
119
|
await fs.copyFile(srcPath, destPath);
|
|
120
|
+
written.push(rel);
|
|
110
121
|
}
|
|
111
122
|
}
|
|
123
|
+
|
|
124
|
+
return { written, skipped };
|
|
112
125
|
}
|
|
113
126
|
|
|
114
127
|
/**
|
|
115
128
|
* 打印操作摘要(更新场景)。
|
|
129
|
+
* @param {string[]} files 已写入的文件
|
|
130
|
+
* @param {string[]} skipped 受保护跳过的文件
|
|
131
|
+
* @param {string} action
|
|
116
132
|
*/
|
|
117
|
-
function printSummary(files,
|
|
133
|
+
function printSummary(files, skipped = [], action) {
|
|
118
134
|
const verb = action === 'updated' ? 'Updating' : 'Writing';
|
|
119
135
|
blank();
|
|
120
136
|
info(`${verb} files...`);
|
|
@@ -122,8 +138,15 @@ function printSummary(files, cwd, action) {
|
|
|
122
138
|
for (const rel of files) {
|
|
123
139
|
fileLine(rel.replace(/\\/g, '/'));
|
|
124
140
|
}
|
|
141
|
+
if (skipped.length > 0) {
|
|
142
|
+
blank();
|
|
143
|
+
info('Skipped (project-specific, preserved):');
|
|
144
|
+
for (const rel of skipped) {
|
|
145
|
+
skippedLine(rel.replace(/\\/g, '/'));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
125
148
|
blank();
|
|
126
|
-
success(`Done! ${files.length} file(s) ${action}.`);
|
|
149
|
+
success(`Done! ${files.length} file(s) ${action}${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
|
|
127
150
|
if (action === 'updated') {
|
|
128
151
|
info('Managed files have been updated to the latest version.');
|
|
129
152
|
}
|
package/lib/manifest.js
CHANGED
|
@@ -1,53 +1,58 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MANAGED_FILES — anws 托管文件清单
|
|
5
|
-
*
|
|
6
|
-
* 此数组列出 anws 包负责管理的所有文件路径(相对于目标项目根目录)。
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'.agent/
|
|
18
|
-
'.agent/skills/
|
|
19
|
-
'.agent/skills/
|
|
20
|
-
'.agent/skills/
|
|
21
|
-
'.agent/skills/
|
|
22
|
-
'.agent/skills/
|
|
23
|
-
'.agent/skills/
|
|
24
|
-
'.agent/skills/
|
|
25
|
-
'.agent/skills/
|
|
26
|
-
'.agent/skills/
|
|
27
|
-
'.agent/skills/
|
|
28
|
-
'.agent/skills/
|
|
29
|
-
'.agent/skills/
|
|
30
|
-
'.agent/skills/
|
|
31
|
-
'.agent/skills/
|
|
32
|
-
'.agent/skills/
|
|
33
|
-
'.agent/skills/
|
|
34
|
-
'.agent/
|
|
35
|
-
'.agent/
|
|
36
|
-
'.agent/
|
|
37
|
-
'.agent/
|
|
38
|
-
'.agent/
|
|
39
|
-
'.agent/
|
|
40
|
-
'.agent/
|
|
41
|
-
'.agent/
|
|
42
|
-
'.agent/workflows/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MANAGED_FILES — anws 托管文件清单
|
|
5
|
+
*
|
|
6
|
+
* 此数组列出 anws 包负责管理的所有文件路径(相对于目标项目根目录)。
|
|
7
|
+
*/
|
|
8
|
+
const MANAGED_FILES = [
|
|
9
|
+
'.agent/rules/agents.md',
|
|
10
|
+
'.agent/skills/build-inspector/SKILL.md',
|
|
11
|
+
'.agent/skills/complexity-guard/references/anti_patterns.md',
|
|
12
|
+
'.agent/skills/complexity-guard/SKILL.md',
|
|
13
|
+
'.agent/skills/concept-modeler/prompts/GLOSSARY_PROMPT.md',
|
|
14
|
+
'.agent/skills/concept-modeler/references/ENTITY_EXTRACTION_PROMPT.md',
|
|
15
|
+
'.agent/skills/concept-modeler/scripts/glossary_gen.py',
|
|
16
|
+
'.agent/skills/concept-modeler/SKILL.md',
|
|
17
|
+
'.agent/skills/git-forensics/references/ANALYSIS_METHODOLOGY.md',
|
|
18
|
+
'.agent/skills/git-forensics/scripts/git_forensics.py',
|
|
19
|
+
'.agent/skills/git-forensics/scripts/git_hotspots.py',
|
|
20
|
+
'.agent/skills/git-forensics/SKILL.md',
|
|
21
|
+
'.agent/skills/report-template/references/REPORT_TEMPLATE.md',
|
|
22
|
+
'.agent/skills/report-template/SKILL.md',
|
|
23
|
+
'.agent/skills/runtime-inspector/SKILL.md',
|
|
24
|
+
'.agent/skills/spec-writer/references/prd_template.md',
|
|
25
|
+
'.agent/skills/spec-writer/SKILL.md',
|
|
26
|
+
'.agent/skills/system-architect/references/rfc_template.md',
|
|
27
|
+
'.agent/skills/system-architect/SKILL.md',
|
|
28
|
+
'.agent/skills/system-designer/references/system-design-template.md',
|
|
29
|
+
'.agent/skills/system-designer/SKILL.md',
|
|
30
|
+
'.agent/skills/task-planner/references/TASK_TEMPLATE.md',
|
|
31
|
+
'.agent/skills/task-planner/SKILL.md',
|
|
32
|
+
'.agent/skills/tech-evaluator/references/ADR_TEMPLATE.md',
|
|
33
|
+
'.agent/skills/tech-evaluator/SKILL.md',
|
|
34
|
+
'.agent/workflows/blueprint.md',
|
|
35
|
+
'.agent/workflows/challenge.md',
|
|
36
|
+
'.agent/workflows/change.md',
|
|
37
|
+
'.agent/workflows/craft.md',
|
|
38
|
+
'.agent/workflows/design-system.md',
|
|
39
|
+
'.agent/workflows/explore.md',
|
|
40
|
+
'.agent/workflows/forge.md',
|
|
41
|
+
'.agent/workflows/genesis.md',
|
|
42
|
+
'.agent/workflows/scout.md'
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* USER_PROTECTED_FILES — 用户保护文件
|
|
47
|
+
*
|
|
48
|
+
* 这些文件在项目初始化后通常会包含特定于项目的配置。
|
|
49
|
+
* anws update 默认会跳过这些文件。
|
|
50
|
+
*/
|
|
51
|
+
const USER_PROTECTED_FILES = [
|
|
52
|
+
'.agent/rules/agents.md'
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
module.exports = {
|
|
56
|
+
MANAGED_FILES,
|
|
57
|
+
USER_PROTECTED_FILES
|
|
58
|
+
};
|
package/lib/output.js
CHANGED
|
@@ -52,6 +52,11 @@ function fileLine(relativePath) {
|
|
|
52
52
|
console.log(` ${c.dim}${relativePath}${c.reset}`);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/** 跳过行(黄色 dim,带 ~ 前缀表示未修改)*/
|
|
56
|
+
function skippedLine(relativePath) {
|
|
57
|
+
console.log(` ${c.yellow}~ ${relativePath}${c.reset}${c.dim} (skipped)${c.reset}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
/** 空行 */
|
|
56
61
|
function blank() {
|
|
57
62
|
console.log('');
|
|
@@ -71,4 +76,4 @@ function logo() {
|
|
|
71
76
|
console.log(`${cyan}${art}${reset}`);
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
module.exports = { success, warn, error, info, fileLine, blank, logo, c };
|
|
79
|
+
module.exports = { success, warn, error, info, fileLine, skippedLine, blank, logo, c };
|
package/lib/update.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('node:fs/promises');
|
|
4
4
|
const path = require('node:path');
|
|
5
|
-
const { MANAGED_FILES } = require('./manifest');
|
|
6
|
-
const { success, warn, error, info, fileLine, blank, logo } = require('./output');
|
|
5
|
+
const { MANAGED_FILES, USER_PROTECTED_FILES } = require('./manifest');
|
|
6
|
+
const { success, warn, error, info, fileLine, skippedLine, blank, logo } = require('./output');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* anws update — 将当前项目的托管文件更新到最新版本
|
|
@@ -30,12 +30,18 @@ async function update() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
logo();
|
|
33
|
-
//
|
|
33
|
+
// 仅覆盖托管文件;USER_PROTECTED_FILES 永远跳过
|
|
34
34
|
const srcRoot = path.join(__dirname, '..', 'templates', '.agent');
|
|
35
35
|
const updated = [];
|
|
36
|
+
const skipped = [];
|
|
36
37
|
|
|
37
38
|
for (const rel of MANAGED_FILES) {
|
|
38
|
-
|
|
39
|
+
if (USER_PROTECTED_FILES.includes(rel)) {
|
|
40
|
+
skipped.push(rel);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const srcPath = path.join(path.dirname(srcRoot), rel);
|
|
39
45
|
const destPath = path.join(cwd, rel);
|
|
40
46
|
|
|
41
47
|
const srcExists = await fs.access(srcPath).then(() => true).catch(() => false);
|
|
@@ -53,8 +59,15 @@ async function update() {
|
|
|
53
59
|
for (const rel of updated) {
|
|
54
60
|
fileLine(rel.replace(/\\/g, '/'));
|
|
55
61
|
}
|
|
62
|
+
if (skipped.length > 0) {
|
|
63
|
+
blank();
|
|
64
|
+
info('Skipped (project-specific, preserved):');
|
|
65
|
+
for (const rel of skipped) {
|
|
66
|
+
skippedLine(rel.replace(/\\/g, '/'));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
56
69
|
blank();
|
|
57
|
-
success(`Done! ${updated.length} file(s) updated.`);
|
|
70
|
+
success(`Done! ${updated.length} file(s) updated${skipped.length > 0 ? `, ${skipped.length} skipped` : ''}.`);
|
|
58
71
|
info('Managed files have been updated to the latest version.');
|
|
59
72
|
info('Your custom files in .agent/ were not touched.');
|
|
60
73
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haaaiawd/anws",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Antigravity Workflow System CLI — one command to install AI collaboration workflows into your project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"cli",
|
|
10
10
|
"developer-tools"
|
|
11
11
|
],
|
|
12
|
-
"homepage": "https://github.com/
|
|
12
|
+
"homepage": "https://github.com/Haaaiawd/Antigravity-Workflow-System",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/
|
|
15
|
+
"url": "git+https://github.com/Haaaiawd/Antigravity-Workflow-System.git"
|
|
16
16
|
},
|
|
17
17
|
"author": "haaaiawd <1134180104@qq.com>",
|
|
18
18
|
"license": "MIT",
|