@chc880/everything-antigravity 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -0
  3. package/assets/rules/common/coding-style.md +53 -0
  4. package/assets/rules/common/git-workflow.md +47 -0
  5. package/assets/rules/common/patterns.md +36 -0
  6. package/assets/rules/common/performance.md +21 -0
  7. package/assets/rules/common/security.md +34 -0
  8. package/assets/rules/common/testing.md +29 -0
  9. package/assets/rules/golang/coding-style.md +40 -0
  10. package/assets/rules/golang/patterns.md +44 -0
  11. package/assets/rules/golang/security.md +33 -0
  12. package/assets/rules/golang/testing.md +30 -0
  13. package/assets/rules/python/coding-style.md +52 -0
  14. package/assets/rules/python/patterns.md +39 -0
  15. package/assets/rules/python/security.md +30 -0
  16. package/assets/rules/python/testing.md +38 -0
  17. package/assets/rules/typescript/coding-style.md +44 -0
  18. package/assets/rules/typescript/patterns.md +50 -0
  19. package/assets/rules/typescript/security.md +27 -0
  20. package/assets/rules/typescript/testing.md +24 -0
  21. package/assets/skills/agent-guides/SKILL.md +40 -0
  22. package/assets/skills/agent-guides/references/architect.md +209 -0
  23. package/assets/skills/agent-guides/references/build-error-resolver.md +530 -0
  24. package/assets/skills/agent-guides/references/code-reviewer.md +102 -0
  25. package/assets/skills/agent-guides/references/database-reviewer.md +652 -0
  26. package/assets/skills/agent-guides/references/doc-updater.md +450 -0
  27. package/assets/skills/agent-guides/references/e2e-runner.md +795 -0
  28. package/assets/skills/agent-guides/references/go-build-resolver.md +366 -0
  29. package/assets/skills/agent-guides/references/go-reviewer.md +265 -0
  30. package/assets/skills/agent-guides/references/planner.md +117 -0
  31. package/assets/skills/agent-guides/references/python-reviewer.md +467 -0
  32. package/assets/skills/agent-guides/references/refactor-cleaner.md +304 -0
  33. package/assets/skills/agent-guides/references/security-reviewer.md +543 -0
  34. package/assets/skills/agent-guides/references/tdd-guide.md +278 -0
  35. package/assets/skills/backend-patterns/SKILL.md +587 -0
  36. package/assets/skills/clickhouse-io/SKILL.md +429 -0
  37. package/assets/skills/coding-standards/SKILL.md +520 -0
  38. package/assets/skills/cpp-testing/SKILL.md +322 -0
  39. package/assets/skills/django-patterns/SKILL.md +733 -0
  40. package/assets/skills/django-security/SKILL.md +592 -0
  41. package/assets/skills/django-tdd/SKILL.md +728 -0
  42. package/assets/skills/django-verification/SKILL.md +460 -0
  43. package/assets/skills/frontend-patterns/SKILL.md +631 -0
  44. package/assets/skills/golang-patterns/SKILL.md +673 -0
  45. package/assets/skills/golang-testing/SKILL.md +719 -0
  46. package/assets/skills/java-coding-standards/SKILL.md +138 -0
  47. package/assets/skills/jpa-patterns/SKILL.md +141 -0
  48. package/assets/skills/knowledge-management/SKILL.md +77 -0
  49. package/assets/skills/nutrient-document-processing/SKILL.md +165 -0
  50. package/assets/skills/postgres-patterns/SKILL.md +146 -0
  51. package/assets/skills/python-patterns/SKILL.md +749 -0
  52. package/assets/skills/python-testing/SKILL.md +815 -0
  53. package/assets/skills/security-hardening/SKILL.md +76 -0
  54. package/assets/skills/security-review/SKILL.md +494 -0
  55. package/assets/skills/security-review/cloud-infrastructure-security.md +361 -0
  56. package/assets/skills/springboot-patterns/SKILL.md +304 -0
  57. package/assets/skills/springboot-security/SKILL.md +119 -0
  58. package/assets/skills/springboot-tdd/SKILL.md +157 -0
  59. package/assets/skills/springboot-verification/SKILL.md +100 -0
  60. package/assets/skills/tdd-workflow/SKILL.md +409 -0
  61. package/assets/workflows/build-fix.md +50 -0
  62. package/assets/workflows/code-review.md +61 -0
  63. package/assets/workflows/e2e.md +65 -0
  64. package/assets/workflows/go-build.md +39 -0
  65. package/assets/workflows/go-review.md +44 -0
  66. package/assets/workflows/go-test.md +61 -0
  67. package/assets/workflows/plan.md +93 -0
  68. package/assets/workflows/python-review.md +95 -0
  69. package/assets/workflows/setup-pm.md +36 -0
  70. package/assets/workflows/tdd.md +75 -0
  71. package/assets/workflows/verify.md +81 -0
  72. package/bin/cli.js +69 -0
  73. package/lib/installer.js +301 -0
  74. package/package.json +34 -0
@@ -0,0 +1,301 @@
1
+ /**
2
+ * Everything Antigravity 安装器逻辑
3
+ * 零依赖 — 仅使用 Node.js 标准库
4
+ */
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ // ── 颜色 ─────────────────────────────────────────────
10
+ const C = {
11
+ red: (s) => `\x1b[0;31m${s}\x1b[0m`,
12
+ green: (s) => `\x1b[0;32m${s}\x1b[0m`,
13
+ yellow: (s) => `\x1b[1;33m${s}\x1b[0m`,
14
+ blue: (s) => `\x1b[0;34m${s}\x1b[0m`,
15
+ cyan: (s) => `\x1b[0;36m${s}\x1b[0m`,
16
+ };
17
+
18
+ // ── 配置 ─────────────────────────────────────────────
19
+ const ASSETS_DIR = path.join(__dirname, '..', 'assets');
20
+ const PROJECT_DIR = process.cwd();
21
+ const AGENT_DIR = path.join(PROJECT_DIR, '.agent');
22
+
23
+ // ── 工具函数 ─────────────────────────────────────────
24
+ function banner() {
25
+ console.log(C.cyan(`
26
+ ╔══════════════════════════════════════════════════╗
27
+ ║ Everything Antigravity v2.1 ║
28
+ ╚══════════════════════════════════════════════════╝
29
+ `));
30
+ console.log(`ℹ 目标项目: ${C.blue(PROJECT_DIR)}`);
31
+ console.log('');
32
+ }
33
+
34
+ function copyDirRecursive(src, dest) {
35
+ fs.mkdirSync(dest, { recursive: true });
36
+ const entries = fs.readdirSync(src, { withFileTypes: true });
37
+ for (const entry of entries) {
38
+ const srcPath = path.join(src, entry.name);
39
+ const destPath = path.join(dest, entry.name);
40
+ if (entry.isDirectory()) {
41
+ copyDirRecursive(srcPath, destPath);
42
+ } else {
43
+ fs.copyFileSync(srcPath, destPath);
44
+ }
45
+ }
46
+ }
47
+
48
+ function countFiles(dir, ext) {
49
+ if (!fs.existsSync(dir)) return 0;
50
+ let count = 0;
51
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
52
+ for (const entry of entries) {
53
+ if (entry.isDirectory()) {
54
+ count += countFiles(path.join(dir, entry.name), ext);
55
+ } else if (!ext || entry.name.endsWith(ext)) {
56
+ count++;
57
+ }
58
+ }
59
+ return count;
60
+ }
61
+
62
+ function listDirs(dir) {
63
+ if (!fs.existsSync(dir)) return [];
64
+ return fs.readdirSync(dir, { withFileTypes: true })
65
+ .filter((e) => e.isDirectory())
66
+ .map((e) => e.name);
67
+ }
68
+
69
+ function listFiles(dir, ext) {
70
+ if (!fs.existsSync(dir)) return [];
71
+ return fs.readdirSync(dir)
72
+ .filter((f) => !ext || f.endsWith(ext));
73
+ }
74
+
75
+ function checkClaudeRefs(dir) {
76
+ let count = 0;
77
+ if (!fs.existsSync(dir)) return 0;
78
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
79
+ for (const entry of entries) {
80
+ const fullPath = path.join(dir, entry.name);
81
+ if (entry.isDirectory()) {
82
+ count += checkClaudeRefs(fullPath);
83
+ } else {
84
+ try {
85
+ const content = fs.readFileSync(fullPath, 'utf-8');
86
+ const matches = content.match(/~\/.claude\//g);
87
+ if (matches) count += matches.length;
88
+ } catch (_) {
89
+ // skip binary files
90
+ }
91
+ }
92
+ }
93
+ return count;
94
+ }
95
+
96
+ function dateStr() {
97
+ const d = new Date();
98
+ return `${d.getFullYear()}${String(d.getMonth() + 1).padStart(2, '0')}${String(d.getDate()).padStart(2, '0')}-${String(d.getHours()).padStart(2, '0')}${String(d.getMinutes()).padStart(2, '0')}${String(d.getSeconds()).padStart(2, '0')}`;
99
+ }
100
+
101
+ // ── 安装 ─────────────────────────────────────────────
102
+ function install(lang) {
103
+ banner();
104
+ console.log(`ℹ 语言选择: ${C.yellow(lang)}`);
105
+ console.log('');
106
+
107
+ // 备份已有配置
108
+ if (fs.existsSync(AGENT_DIR)) {
109
+ const backupDir = path.join(PROJECT_DIR, `.agent-backup-${dateStr()}`);
110
+ console.log(`${C.blue('↗')} 备份已有 .agent/ → ${backupDir}`);
111
+ copyDirRecursive(AGENT_DIR, backupDir);
112
+ console.log('');
113
+ }
114
+
115
+ // Step 1: Skills
116
+ console.log(C.cyan('── Step 1/3: 安装 Skills → .agent/skills/ ──'));
117
+ const skillsSrc = path.join(ASSETS_DIR, 'skills');
118
+ let skillCount = 0;
119
+ for (const skillName of listDirs(skillsSrc)) {
120
+ const skillDir = path.join(skillsSrc, skillName);
121
+ if (fs.existsSync(path.join(skillDir, 'SKILL.md'))) {
122
+ copyDirRecursive(skillDir, path.join(AGENT_DIR, 'skills', skillName));
123
+ skillCount++;
124
+ }
125
+ }
126
+ console.log(C.green(`✓ 安装了 ${skillCount} 个 Skills`));
127
+
128
+ // Step 2: Workflows
129
+ console.log('');
130
+ console.log(C.cyan('── Step 2/3: 安装 Workflows → .agent/workflows/ ──'));
131
+ const wfSrc = path.join(ASSETS_DIR, 'workflows');
132
+ const wfDest = path.join(AGENT_DIR, 'workflows');
133
+ fs.mkdirSync(wfDest, { recursive: true });
134
+ let wfCount = 0;
135
+ for (const wf of listFiles(wfSrc, '.md')) {
136
+ fs.copyFileSync(path.join(wfSrc, wf), path.join(wfDest, wf));
137
+ wfCount++;
138
+ }
139
+ console.log(C.green(`✓ 安装了 ${wfCount} 个 Workflows`));
140
+
141
+ // Step 3: Rules
142
+ console.log('');
143
+ console.log(C.cyan('── Step 3/3: 安装 Rules → .agent/rules/ ──'));
144
+ const rulesDest = path.join(AGENT_DIR, 'rules');
145
+ fs.mkdirSync(rulesDest, { recursive: true });
146
+ let ruleCount = 0;
147
+
148
+ // 通用规则(始终安装)
149
+ const commonSrc = path.join(ASSETS_DIR, 'rules', 'common');
150
+ for (const rule of listFiles(commonSrc, '.md')) {
151
+ fs.copyFileSync(path.join(commonSrc, rule), path.join(rulesDest, rule));
152
+ ruleCount++;
153
+ }
154
+
155
+ // 语言规则
156
+ const installLangRules = (langName) => {
157
+ const langSrc = path.join(ASSETS_DIR, 'rules', langName);
158
+ if (!fs.existsSync(langSrc)) return;
159
+ for (const rule of listFiles(langSrc, '.md')) {
160
+ fs.copyFileSync(
161
+ path.join(langSrc, rule),
162
+ path.join(rulesDest, `${langName}-${rule}`)
163
+ );
164
+ ruleCount++;
165
+ }
166
+ };
167
+
168
+ const VALID_LANGS = ['typescript', 'python', 'golang'];
169
+ if (lang === 'all') {
170
+ VALID_LANGS.forEach(installLangRules);
171
+ } else if (VALID_LANGS.includes(lang)) {
172
+ installLangRules(lang);
173
+ } else {
174
+ console.log(C.red(`✗ 未知语言: ${lang}`));
175
+ console.log(` 支持: all, ${VALID_LANGS.join(', ')}`);
176
+ process.exit(1);
177
+ }
178
+ console.log(C.green(`✓ 安装了 ${ruleCount} 条 Rules`));
179
+
180
+ // 验证
181
+ console.log('');
182
+ console.log(C.cyan('── 验证安装 ──'));
183
+ const refs = checkClaudeRefs(AGENT_DIR);
184
+ if (refs > 0) {
185
+ console.log(C.red(`✗ 发现 ${refs} 处 ~/.claude/ 残留引用!`));
186
+ } else {
187
+ console.log(C.green('✓ 无 Claude Code 路径残留'));
188
+ }
189
+
190
+ // 统计
191
+ console.log('');
192
+ console.log(C.green('╔══════════════════════════════════════════════════╗'));
193
+ console.log(C.green('║ 安装完成! ║'));
194
+ console.log(C.green('╚══════════════════════════════════════════════════╝'));
195
+ console.log('');
196
+ console.log(` Skills: ${C.cyan(skillCount)} 个`);
197
+ console.log(` Workflows: ${C.cyan(wfCount)} 个`);
198
+ console.log(` Rules: ${C.cyan(ruleCount)} 条`);
199
+ console.log('');
200
+ console.log(` ${C.blue('提示:')}`);
201
+ console.log(' - 使用 /plan 开始规划工作流');
202
+ console.log(' - 使用 /verify 验证实现');
203
+ console.log(' - ea status 查看安装状态');
204
+ console.log(' - ea uninstall 卸载');
205
+ }
206
+
207
+ // ── 卸载 ─────────────────────────────────────────────
208
+ function uninstall() {
209
+ banner();
210
+ console.log(C.yellow('⚠ 即将卸载 Everything Antigravity 组件'));
211
+ console.log('');
212
+
213
+ if (!fs.existsSync(AGENT_DIR)) {
214
+ console.log(C.yellow('✗ 未安装(.agent 目录不存在)'));
215
+ return;
216
+ }
217
+
218
+ // 统计
219
+ const skillCount = listDirs(path.join(AGENT_DIR, 'skills')).length;
220
+ const wfCount = listFiles(path.join(AGENT_DIR, 'workflows'), '.md').length;
221
+ const ruleCount = listFiles(path.join(AGENT_DIR, 'rules'), '.md').length;
222
+ console.log(` 将删除: ${skillCount} Skills, ${wfCount} Workflows, ${ruleCount} Rules`);
223
+ console.log('');
224
+
225
+ // 备份
226
+ const backupDir = path.join(PROJECT_DIR, `.agent-backup-${dateStr()}`);
227
+ console.log(`${C.blue('↗')} 备份到: ${backupDir}`);
228
+ copyDirRecursive(AGENT_DIR, backupDir);
229
+
230
+ // 删除
231
+ fs.rmSync(path.join(AGENT_DIR, 'skills'), { recursive: true, force: true });
232
+ fs.rmSync(path.join(AGENT_DIR, 'workflows'), { recursive: true, force: true });
233
+ fs.rmSync(path.join(AGENT_DIR, 'rules'), { recursive: true, force: true });
234
+
235
+ console.log(C.green('✓ 卸载完成'));
236
+ console.log(` 备份位置: ${C.yellow(backupDir)}`);
237
+ }
238
+
239
+ // ── 状态 ─────────────────────────────────────────────
240
+ function status() {
241
+ banner();
242
+ console.log(C.cyan('── 安装状态 ──'));
243
+
244
+ if (!fs.existsSync(AGENT_DIR)) {
245
+ console.log(C.yellow('✗ 未安装(.agent 目录不存在)'));
246
+ return;
247
+ }
248
+
249
+ // Skills
250
+ const skills = listDirs(path.join(AGENT_DIR, 'skills'));
251
+ console.log(C.green(`✓ Skills: ${skills.length}`));
252
+ skills.forEach((s) => console.log(` ${s}`));
253
+
254
+ // Workflows
255
+ console.log('');
256
+ const wfs = listFiles(path.join(AGENT_DIR, 'workflows'), '.md');
257
+ console.log(C.green(`✓ Workflows: ${wfs.length}`));
258
+ wfs.forEach((w) => console.log(` ${w.replace('.md', '')}`));
259
+
260
+ // Rules
261
+ console.log('');
262
+ const rules = listFiles(path.join(AGENT_DIR, 'rules'), '.md');
263
+ console.log(C.green(`✓ Rules: ${rules.length}`));
264
+ rules.forEach((r) => console.log(` ${r.replace('.md', '')}`));
265
+
266
+ // Claude 残留
267
+ console.log('');
268
+ const refs = checkClaudeRefs(AGENT_DIR);
269
+ if (refs > 0) {
270
+ console.log(C.red(`⚠ 发现 ${refs} 处 ~/.claude/ 残留引用`));
271
+ } else {
272
+ console.log(C.green('✓ 无 Claude Code 路径残留'));
273
+ }
274
+ }
275
+
276
+ // ── 帮助 ─────────────────────────────────────────────
277
+ function showHelp() {
278
+ banner();
279
+ console.log('用法: ea <命令> [选项]');
280
+ console.log('');
281
+ console.log('命令:');
282
+ console.log(' init [--lang <lang>] 安装到当前项目(默认全部语言)');
283
+ console.log(' status 查看安装状态');
284
+ console.log(' uninstall 卸载(自动备份)');
285
+ console.log(' help 显示帮助');
286
+ console.log('');
287
+ console.log('语言选项:');
288
+ console.log(' --lang all 全部语言(默认)');
289
+ console.log(' --lang typescript TypeScript/JavaScript');
290
+ console.log(' --lang python Python');
291
+ console.log(' --lang golang Go');
292
+ console.log('');
293
+ console.log('示例:');
294
+ console.log(' npm install -g everything-antigravity');
295
+ console.log(' ea init # 安装全部');
296
+ console.log(' ea init --lang ts # 仅 TypeScript');
297
+ console.log(' ea status');
298
+ console.log(' ea uninstall');
299
+ }
300
+
301
+ module.exports = { install, uninstall, status, showHelp };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@chc880/everything-antigravity",
3
+ "version": "1.0.0",
4
+ "description": "Everything Antigravity — AI 编程最佳实践合集,一键为 Antigravity 配置 Skills/Rules/Workflows",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "ea": "bin/cli.js",
8
+ "everything-antigravity": "bin/cli.js"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "lib/",
13
+ "assets/",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/chc880/everything-antigravity.git"
20
+ },
21
+ "homepage": "https://github.com/chc880/everything-antigravity",
22
+ "keywords": [
23
+ "antigravity",
24
+ "ai",
25
+ "coding",
26
+ "best-practices",
27
+ "skills",
28
+ "rules",
29
+ "workflows"
30
+ ],
31
+ "engines": {
32
+ "node": ">=16.7.0"
33
+ }
34
+ }