@huajiwuyan/hello 3.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 (117) hide show
  1. package/README.md +68 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +448 -0
  4. package/package.json +38 -0
  5. package/templates/claude/commands/hello.md +760 -0
  6. package/templates/claude/skills/SKILL.md +90 -0
  7. package/templates/claude/skills/SKILL.toml +7 -0
  8. package/templates/claude/skills/assets/icon-large.svg +12 -0
  9. package/templates/claude/skills/assets/icon-small-400px.svg +12 -0
  10. package/templates/claude/skills/assets/templates/CHANGELOG.md +24 -0
  11. package/templates/claude/skills/assets/templates/CHANGELOG_{YYYY}.md +25 -0
  12. package/templates/claude/skills/assets/templates/INDEX.md +36 -0
  13. package/templates/claude/skills/assets/templates/archive/_index.md +22 -0
  14. package/templates/claude/skills/assets/templates/context.md +82 -0
  15. package/templates/claude/skills/assets/templates/modules/_index.md +22 -0
  16. package/templates/claude/skills/assets/templates/modules/module.md +35 -0
  17. package/templates/claude/skills/assets/templates/plan/proposal.md +104 -0
  18. package/templates/claude/skills/assets/templates/plan/tasks.md +49 -0
  19. package/templates/claude/skills/references/functions/auto.md +217 -0
  20. package/templates/claude/skills/references/functions/clean.md +167 -0
  21. package/templates/claude/skills/references/functions/commit.md +374 -0
  22. package/templates/claude/skills/references/functions/exec.md +178 -0
  23. package/templates/claude/skills/references/functions/help.md +105 -0
  24. package/templates/claude/skills/references/functions/init.md +228 -0
  25. package/templates/claude/skills/references/functions/plan.md +219 -0
  26. package/templates/claude/skills/references/functions/review.md +146 -0
  27. package/templates/claude/skills/references/functions/rollback.md +208 -0
  28. package/templates/claude/skills/references/functions/test.md +153 -0
  29. package/templates/claude/skills/references/functions/upgrade.md +371 -0
  30. package/templates/claude/skills/references/functions/validate.md +147 -0
  31. package/templates/claude/skills/references/rules/package.md +212 -0
  32. package/templates/claude/skills/references/rules/scaling.md +150 -0
  33. package/templates/claude/skills/references/rules/state.md +318 -0
  34. package/templates/claude/skills/references/rules/tools.md +371 -0
  35. package/templates/claude/skills/references/services/knowledge.md +408 -0
  36. package/templates/claude/skills/references/services/templates.md +344 -0
  37. package/templates/claude/skills/references/stages/analyze.md +201 -0
  38. package/templates/claude/skills/references/stages/design.md +379 -0
  39. package/templates/claude/skills/references/stages/develop.md +497 -0
  40. package/templates/claude/skills/references/stages/evaluate.md +286 -0
  41. package/templates/claude/skills/references/stages/tweak.md +244 -0
  42. package/templates/claude/skills/scripts/create_package.py +260 -0
  43. package/templates/claude/skills/scripts/list_packages.py +145 -0
  44. package/templates/claude/skills/scripts/migrate_package.py +399 -0
  45. package/templates/claude/skills/scripts/project_stats.py +438 -0
  46. package/templates/claude/skills/scripts/upgradewiki.py +321 -0
  47. package/templates/claude/skills/scripts/utils.py +596 -0
  48. package/templates/claude/skills/scripts/validate_package.py +309 -0
  49. package/templates/codex/prompts/hello.md +757 -0
  50. package/templates/codex/skills/SKILL.md +74 -0
  51. package/templates/codex/skills/SKILL.toml +7 -0
  52. package/templates/codex/skills/assets/icon-large.svg +12 -0
  53. package/templates/codex/skills/assets/icon-small-400px.svg +12 -0
  54. package/templates/codex/skills/assets/templates/CHANGELOG.md +24 -0
  55. package/templates/codex/skills/assets/templates/CHANGELOG_{YYYY}.md +25 -0
  56. package/templates/codex/skills/assets/templates/INDEX.md +36 -0
  57. package/templates/codex/skills/assets/templates/archive/_index.md +22 -0
  58. package/templates/codex/skills/assets/templates/context.md +82 -0
  59. package/templates/codex/skills/assets/templates/modules/_index.md +22 -0
  60. package/templates/codex/skills/assets/templates/modules/module.md +35 -0
  61. package/templates/codex/skills/assets/templates/plan/proposal.md +104 -0
  62. package/templates/codex/skills/assets/templates/plan/tasks.md +29 -0
  63. package/templates/codex/skills/references/functions/auto.md +181 -0
  64. package/templates/codex/skills/references/functions/brain.md +275 -0
  65. package/templates/codex/skills/references/functions/clean.md +154 -0
  66. package/templates/codex/skills/references/functions/commit.md +265 -0
  67. package/templates/codex/skills/references/functions/debug/condition-based-waiting.md +151 -0
  68. package/templates/codex/skills/references/functions/debug/defense-in-depth.md +147 -0
  69. package/templates/codex/skills/references/functions/debug/root-cause-tracing.md +168 -0
  70. package/templates/codex/skills/references/functions/debug.md +389 -0
  71. package/templates/codex/skills/references/functions/exec.md +153 -0
  72. package/templates/codex/skills/references/functions/help.md +101 -0
  73. package/templates/codex/skills/references/functions/init.md +221 -0
  74. package/templates/codex/skills/references/functions/plan.md +178 -0
  75. package/templates/codex/skills/references/functions/review.md +135 -0
  76. package/templates/codex/skills/references/functions/rlm.md +864 -0
  77. package/templates/codex/skills/references/functions/rollback.md +190 -0
  78. package/templates/codex/skills/references/functions/test.md +140 -0
  79. package/templates/codex/skills/references/functions/upgrade.md +363 -0
  80. package/templates/codex/skills/references/functions/validate.md +135 -0
  81. package/templates/codex/skills/references/rules/cache.md +136 -0
  82. package/templates/codex/skills/references/rules/scaling.md +124 -0
  83. package/templates/codex/skills/references/rules/state.md +201 -0
  84. package/templates/codex/skills/references/rules/tools.md +301 -0
  85. package/templates/codex/skills/references/services/attention.md +53 -0
  86. package/templates/codex/skills/references/services/knowledge.md +559 -0
  87. package/templates/codex/skills/references/services/package.md +383 -0
  88. package/templates/codex/skills/references/services/templates.md +390 -0
  89. package/templates/codex/skills/references/stages/analyze.md +191 -0
  90. package/templates/codex/skills/references/stages/design.md +355 -0
  91. package/templates/codex/skills/references/stages/develop.md +520 -0
  92. package/templates/codex/skills/references/stages/tweak.md +239 -0
  93. package/templates/codex/skills/rlm/__init__.py +39 -0
  94. package/templates/codex/skills/rlm/agent_orchestrator.py +422 -0
  95. package/templates/codex/skills/rlm/context_manager.py +366 -0
  96. package/templates/codex/skills/rlm/engine.py +915 -0
  97. package/templates/codex/skills/rlm/folding.py +391 -0
  98. package/templates/codex/skills/rlm/repl.py +452 -0
  99. package/templates/codex/skills/rlm/roles/analyzer.md +66 -0
  100. package/templates/codex/skills/rlm/roles/designer.md +94 -0
  101. package/templates/codex/skills/rlm/roles/explorer.md +43 -0
  102. package/templates/codex/skills/rlm/roles/implementer.md +62 -0
  103. package/templates/codex/skills/rlm/roles/kb_keeper.md +138 -0
  104. package/templates/codex/skills/rlm/roles/pkg_keeper.md +163 -0
  105. package/templates/codex/skills/rlm/roles/reviewer.md +74 -0
  106. package/templates/codex/skills/rlm/roles/synthesizer.md +90 -0
  107. package/templates/codex/skills/rlm/roles/tester.md +83 -0
  108. package/templates/codex/skills/rlm/schemas/agent_result.json +174 -0
  109. package/templates/codex/skills/rlm/session.py +376 -0
  110. package/templates/codex/skills/rlm/shared_tasks.py +370 -0
  111. package/templates/codex/skills/scripts/create_package.py +260 -0
  112. package/templates/codex/skills/scripts/list_packages.py +145 -0
  113. package/templates/codex/skills/scripts/migrate_package.py +399 -0
  114. package/templates/codex/skills/scripts/project_stats.py +438 -0
  115. package/templates/codex/skills/scripts/upgradewiki.py +321 -0
  116. package/templates/codex/skills/scripts/utils.py +596 -0
  117. package/templates/codex/skills/scripts/validate_package.py +309 -0
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @huajiwuyan/hello
2
+
3
+ HelloAGENTS 交互式安装器 - 支持 Claude Code 和 Codex CLI。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ # 使用 npx 一次性运行(推荐)
9
+ npx @huajiwuyan/hello
10
+
11
+ # 或全局安装
12
+ npm install -g @huajiwuyan/hello
13
+ hello
14
+ ```
15
+
16
+ ## 使用
17
+
18
+ ### 交互式安装
19
+
20
+ ```bash
21
+ npx @huajiwuyan/hello
22
+ ```
23
+
24
+ 运行后会引导你:
25
+ 1. 选择要安装的 CLI(Claude Code / Codex CLI / 两者)
26
+ 2. 选择是否自定义安装路径
27
+ 3. 处理已存在的安装(覆盖/跳过/取消)
28
+
29
+ ### 卸载
30
+
31
+ ```bash
32
+ npx @huajiwuyan/hello -u
33
+ # 或
34
+ npx @huajiwuyan/hello --uninstall
35
+ ```
36
+
37
+ ### 帮助
38
+
39
+ ```bash
40
+ npx @huajiwuyan/hello -h
41
+ ```
42
+
43
+ ## 默认安装位置
44
+
45
+ | CLI | 默认路径 |
46
+ |-----|----------|
47
+ | Claude Code | `~/.claude` |
48
+ | Codex CLI | `~/.codex` |
49
+
50
+ 安装内容:
51
+ - `skills/helloagents/` - HelloAGENTS 技能模块
52
+ - `commands/hello.md`(Claude)或 `prompts/hello.md`(Codex)- 命令入口
53
+
54
+ ## 安装后使用
55
+
56
+ **Claude Code:**
57
+ ```
58
+ /hello
59
+ ```
60
+
61
+ **Codex CLI:**
62
+ ```
63
+ ~hello
64
+ ```
65
+
66
+ ## 许可证
67
+
68
+ MIT
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,448 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { parseArgs } from "util";
5
+
6
+ // src/installer.ts
7
+ import { join as join2, dirname as dirname2 } from "path";
8
+ import { fileURLToPath } from "url";
9
+ import * as p2 from "@clack/prompts";
10
+
11
+ // src/constants.ts
12
+ import { homedir } from "os";
13
+ import { join } from "path";
14
+ var CLI_CONFIGS = {
15
+ claude: {
16
+ name: "Claude Code",
17
+ defaultPath: join(homedir(), ".claude"),
18
+ skillsDir: "skills/helloagents",
19
+ commandDir: "commands",
20
+ commandFile: "hello.md"
21
+ },
22
+ codex: {
23
+ name: "Codex CLI",
24
+ defaultPath: join(homedir(), ".codex"),
25
+ skillsDir: "skills/helloagents",
26
+ commandDir: "prompts",
27
+ commandFile: "hello.md"
28
+ }
29
+ };
30
+ function getDefaultPaths(cli) {
31
+ const paths = {};
32
+ if (cli === "claude" || cli === "both") {
33
+ paths.claude = CLI_CONFIGS.claude.defaultPath;
34
+ }
35
+ if (cli === "codex" || cli === "both") {
36
+ paths.codex = CLI_CONFIGS.codex.defaultPath;
37
+ }
38
+ return paths;
39
+ }
40
+
41
+ // src/utils/fs.ts
42
+ import { existsSync, mkdirSync, cpSync, rmSync, readdirSync, statSync } from "fs";
43
+ import { dirname } from "path";
44
+ function ensureDir(dirPath) {
45
+ if (!existsSync(dirPath)) {
46
+ mkdirSync(dirPath, { recursive: true });
47
+ }
48
+ }
49
+ function copyDir(src, dest) {
50
+ ensureDir(dirname(dest));
51
+ cpSync(src, dest, { recursive: true });
52
+ }
53
+ function copyFile(src, dest) {
54
+ ensureDir(dirname(dest));
55
+ cpSync(src, dest);
56
+ }
57
+ function remove(targetPath) {
58
+ if (existsSync(targetPath)) {
59
+ rmSync(targetPath, { recursive: true, force: true });
60
+ }
61
+ }
62
+ function exists(targetPath) {
63
+ return existsSync(targetPath);
64
+ }
65
+
66
+ // src/prompts.ts
67
+ import * as p from "@clack/prompts";
68
+
69
+ // src/utils/platform.ts
70
+ import { homedir as homedir2 } from "os";
71
+ function expandHome(inputPath) {
72
+ if (inputPath.startsWith("~")) {
73
+ return inputPath.replace("~", homedir2());
74
+ }
75
+ return inputPath;
76
+ }
77
+
78
+ // src/prompts.ts
79
+ async function askInstallOptions() {
80
+ p.intro("\u{1F680} HelloAGENTS \u5B89\u88C5\u5668");
81
+ const cli = await p.select({
82
+ message: "\u9009\u62E9\u8981\u5B89\u88C5\u7684 CLI",
83
+ options: [
84
+ { value: "claude", label: "Claude Code", hint: "~/.claude" },
85
+ { value: "codex", label: "Codex CLI", hint: "~/.codex" },
86
+ { value: "both", label: "\u4E24\u8005\u90FD\u5B89\u88C5" }
87
+ ]
88
+ });
89
+ if (p.isCancel(cli)) {
90
+ p.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88");
91
+ return null;
92
+ }
93
+ const customPath = await p.confirm({
94
+ message: "\u662F\u5426\u81EA\u5B9A\u4E49\u5B89\u88C5\u8DEF\u5F84\uFF1F",
95
+ initialValue: false
96
+ });
97
+ if (p.isCancel(customPath)) {
98
+ p.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88");
99
+ return null;
100
+ }
101
+ let paths = getDefaultPaths(cli);
102
+ if (customPath) {
103
+ const customPaths = await askCustomPaths(cli);
104
+ if (!customPaths) return null;
105
+ paths = customPaths;
106
+ }
107
+ const existingPaths = checkExistingInstall(cli, paths);
108
+ if (existingPaths.length > 0) {
109
+ const overwrite = await p.select({
110
+ message: "\u68C0\u6D4B\u5230\u5DF2\u5B89\u88C5\u7684 HelloAGENTS",
111
+ options: [
112
+ { value: "overwrite", label: "\u8986\u76D6\u73B0\u6709\u6587\u4EF6" },
113
+ { value: "skip", label: "\u8DF3\u8FC7\u5DF2\u5B58\u5728\u7684\u6587\u4EF6" },
114
+ { value: "cancel", label: "\u53D6\u6D88\u5B89\u88C5" }
115
+ ]
116
+ });
117
+ if (p.isCancel(overwrite) || overwrite === "cancel") {
118
+ p.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88");
119
+ return null;
120
+ }
121
+ if (overwrite === "skip") {
122
+ for (const existing of existingPaths) {
123
+ if (existing === "claude") paths.claude = void 0;
124
+ if (existing === "codex") paths.codex = void 0;
125
+ }
126
+ }
127
+ }
128
+ return { cli, paths };
129
+ }
130
+ async function askCustomPaths(cli) {
131
+ const paths = {};
132
+ if (cli === "claude" || cli === "both") {
133
+ const claudePath = await p.text({
134
+ message: "Claude Code \u5B89\u88C5\u8DEF\u5F84",
135
+ placeholder: CLI_CONFIGS.claude.defaultPath,
136
+ defaultValue: CLI_CONFIGS.claude.defaultPath,
137
+ validate: (value) => {
138
+ if (!value) return "\u8BF7\u8F93\u5165\u8DEF\u5F84";
139
+ return void 0;
140
+ }
141
+ });
142
+ if (p.isCancel(claudePath)) {
143
+ p.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88");
144
+ return null;
145
+ }
146
+ paths.claude = expandHome(claudePath);
147
+ }
148
+ if (cli === "codex" || cli === "both") {
149
+ const codexPath = await p.text({
150
+ message: "Codex CLI \u5B89\u88C5\u8DEF\u5F84",
151
+ placeholder: CLI_CONFIGS.codex.defaultPath,
152
+ defaultValue: CLI_CONFIGS.codex.defaultPath,
153
+ validate: (value) => {
154
+ if (!value) return "\u8BF7\u8F93\u5165\u8DEF\u5F84";
155
+ return void 0;
156
+ }
157
+ });
158
+ if (p.isCancel(codexPath)) {
159
+ p.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88");
160
+ return null;
161
+ }
162
+ paths.codex = expandHome(codexPath);
163
+ }
164
+ return paths;
165
+ }
166
+ function checkExistingInstall(cli, paths) {
167
+ const existing = [];
168
+ if ((cli === "claude" || cli === "both") && paths.claude) {
169
+ const skillsPath = `${paths.claude}/${CLI_CONFIGS.claude.skillsDir}`;
170
+ if (exists(skillsPath)) existing.push("claude");
171
+ }
172
+ if ((cli === "codex" || cli === "both") && paths.codex) {
173
+ const skillsPath = `${paths.codex}/${CLI_CONFIGS.codex.skillsDir}`;
174
+ if (exists(skillsPath)) existing.push("codex");
175
+ }
176
+ return existing;
177
+ }
178
+ async function askUninstallOptions() {
179
+ p.intro("\u{1F5D1}\uFE0F HelloAGENTS \u5378\u8F7D\u5668");
180
+ const installed = [];
181
+ const claudePath = CLI_CONFIGS.claude.defaultPath;
182
+ const codexPath = CLI_CONFIGS.codex.defaultPath;
183
+ const claudeInstalled = exists(`${claudePath}/${CLI_CONFIGS.claude.skillsDir}`);
184
+ const codexInstalled = exists(`${codexPath}/${CLI_CONFIGS.codex.skillsDir}`);
185
+ if (claudeInstalled) installed.push({ value: "claude", label: "Claude Code" });
186
+ if (codexInstalled) installed.push({ value: "codex", label: "Codex CLI" });
187
+ if (installed.length === 0) {
188
+ p.log.warning("\u672A\u68C0\u6D4B\u5230\u5DF2\u5B89\u88C5\u7684 HelloAGENTS");
189
+ p.outro("\u65E0\u9700\u5378\u8F7D");
190
+ return null;
191
+ }
192
+ if (installed.length === 2) {
193
+ installed.push({ value: "both", label: "\u4E24\u8005\u90FD\u5378\u8F7D" });
194
+ }
195
+ const cli = await p.select({
196
+ message: "\u9009\u62E9\u8981\u5378\u8F7D\u7684 CLI",
197
+ options: installed
198
+ });
199
+ if (p.isCancel(cli)) {
200
+ p.cancel("\u5378\u8F7D\u5DF2\u53D6\u6D88");
201
+ return null;
202
+ }
203
+ const toDelete = [];
204
+ const paths = {};
205
+ if (cli === "claude" || cli === "both") {
206
+ paths.claude = claudePath;
207
+ toDelete.push(`${claudePath}/${CLI_CONFIGS.claude.skillsDir}`);
208
+ toDelete.push(`${claudePath}/${CLI_CONFIGS.claude.commandDir}/${CLI_CONFIGS.claude.commandFile}`);
209
+ }
210
+ if (cli === "codex" || cli === "both") {
211
+ paths.codex = codexPath;
212
+ toDelete.push(`${codexPath}/${CLI_CONFIGS.codex.skillsDir}`);
213
+ toDelete.push(`${codexPath}/${CLI_CONFIGS.codex.commandDir}/${CLI_CONFIGS.codex.commandFile}`);
214
+ }
215
+ p.log.info("\u5C06\u5220\u9664\u4EE5\u4E0B\u6587\u4EF6:");
216
+ for (const file of toDelete) {
217
+ p.log.message(` - ${file}`);
218
+ }
219
+ const confirm2 = await p.confirm({
220
+ message: "\u786E\u8BA4\u5378\u8F7D\uFF1F",
221
+ initialValue: false
222
+ });
223
+ if (p.isCancel(confirm2) || !confirm2) {
224
+ p.cancel("\u5378\u8F7D\u5DF2\u53D6\u6D88");
225
+ return null;
226
+ }
227
+ return { cli, paths };
228
+ }
229
+
230
+ // src/installer.ts
231
+ var __dirname2 = dirname2(fileURLToPath(import.meta.url));
232
+ var templatesDir = join2(__dirname2, "..", "templates");
233
+ function installCLI(cliType, basePath, result) {
234
+ const config = CLI_CONFIGS[cliType];
235
+ const templatePath = join2(templatesDir, cliType);
236
+ const skillsSrc = join2(templatePath, "skills", "helloagents");
237
+ const skillsDest = join2(basePath, config.skillsDir);
238
+ try {
239
+ if (exists(skillsSrc)) {
240
+ copyDir(skillsSrc, skillsDest);
241
+ result.installed.push(skillsDest);
242
+ } else {
243
+ result.errors.push(`Skills \u6A21\u677F\u4E0D\u5B58\u5728: ${skillsSrc}`);
244
+ }
245
+ } catch (error) {
246
+ result.errors.push(`\u590D\u5236 skills \u5931\u8D25: ${error.message}`);
247
+ }
248
+ const commandSrc = join2(templatePath, config.commandDir, config.commandFile);
249
+ const commandDest = join2(basePath, config.commandDir, config.commandFile);
250
+ try {
251
+ if (exists(commandSrc)) {
252
+ ensureDir(dirname2(commandDest));
253
+ copyFile(commandSrc, commandDest);
254
+ result.installed.push(commandDest);
255
+ } else {
256
+ result.errors.push(`\u547D\u4EE4\u6A21\u677F\u4E0D\u5B58\u5728: ${commandSrc}`);
257
+ }
258
+ } catch (error) {
259
+ result.errors.push(`\u590D\u5236\u547D\u4EE4\u6587\u4EF6\u5931\u8D25: ${error.message}`);
260
+ }
261
+ }
262
+ async function install(config) {
263
+ const result = {
264
+ success: true,
265
+ installed: [],
266
+ skipped: [],
267
+ errors: []
268
+ };
269
+ const s = p2.spinner();
270
+ s.start("\u5B89\u88C5\u4E2D...");
271
+ try {
272
+ if (config.paths.claude) {
273
+ installCLI("claude", config.paths.claude, result);
274
+ }
275
+ if (config.paths.codex) {
276
+ installCLI("codex", config.paths.codex, result);
277
+ }
278
+ if (result.errors.length > 0) {
279
+ result.success = false;
280
+ }
281
+ } catch (error) {
282
+ result.success = false;
283
+ result.errors.push(error.message);
284
+ }
285
+ s.stop(result.success ? "\u5B89\u88C5\u5B8C\u6210" : "\u5B89\u88C5\u8FC7\u7A0B\u4E2D\u51FA\u73B0\u9519\u8BEF");
286
+ return result;
287
+ }
288
+ async function runInstaller() {
289
+ try {
290
+ const config = await askInstallOptions();
291
+ if (!config) {
292
+ process.exit(0);
293
+ }
294
+ const result = await install(config);
295
+ if (result.installed.length > 0) {
296
+ p2.log.success("\u5DF2\u5B89\u88C5:");
297
+ for (const file of result.installed) {
298
+ p2.log.message(` \u2713 ${file}`);
299
+ }
300
+ }
301
+ if (result.skipped.length > 0) {
302
+ p2.log.warning("\u5DF2\u8DF3\u8FC7:");
303
+ for (const file of result.skipped) {
304
+ p2.log.message(` - ${file}`);
305
+ }
306
+ }
307
+ if (result.errors.length > 0) {
308
+ p2.log.error("\u9519\u8BEF:");
309
+ for (const error of result.errors) {
310
+ p2.log.message(` \u2717 ${error}`);
311
+ }
312
+ }
313
+ if (result.success) {
314
+ p2.outro("\u2705 \u5B89\u88C5\u5B8C\u6210\uFF01\u4F7F\u7528 /hello \u542F\u52A8");
315
+ } else {
316
+ p2.outro("\u26A0\uFE0F \u5B89\u88C5\u5B8C\u6210\uFF0C\u4F46\u5B58\u5728\u9519\u8BEF");
317
+ process.exit(1);
318
+ }
319
+ } catch (error) {
320
+ if (error.code === "EACCES") {
321
+ p2.log.error("\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u76EE\u5F55\u6743\u9650\u6216\u4F7F\u7528 sudo");
322
+ } else if (error.code === "ENOSPC") {
323
+ p2.log.error("\u78C1\u76D8\u7A7A\u95F4\u4E0D\u8DB3");
324
+ } else {
325
+ p2.log.error(`\u5B89\u88C5\u5931\u8D25: ${error.message}`);
326
+ }
327
+ process.exit(1);
328
+ }
329
+ }
330
+
331
+ // src/uninstaller.ts
332
+ import * as p3 from "@clack/prompts";
333
+ function uninstallCLI(cliType, basePath, deleted, errors) {
334
+ const config = CLI_CONFIGS[cliType];
335
+ const skillsPath = `${basePath}/${config.skillsDir}`;
336
+ try {
337
+ if (exists(skillsPath)) {
338
+ remove(skillsPath);
339
+ deleted.push(skillsPath);
340
+ }
341
+ } catch (error) {
342
+ errors.push(`\u5220\u9664 skills \u5931\u8D25: ${error.message}`);
343
+ }
344
+ const commandPath = `${basePath}/${config.commandDir}/${config.commandFile}`;
345
+ try {
346
+ if (exists(commandPath)) {
347
+ remove(commandPath);
348
+ deleted.push(commandPath);
349
+ }
350
+ } catch (error) {
351
+ errors.push(`\u5220\u9664\u547D\u4EE4\u6587\u4EF6\u5931\u8D25: ${error.message}`);
352
+ }
353
+ }
354
+ async function uninstall(config) {
355
+ const deleted = [];
356
+ const errors = [];
357
+ const s = p3.spinner();
358
+ s.start("\u5378\u8F7D\u4E2D...");
359
+ try {
360
+ if (config.paths.claude) {
361
+ uninstallCLI("claude", config.paths.claude, deleted, errors);
362
+ }
363
+ if (config.paths.codex) {
364
+ uninstallCLI("codex", config.paths.codex, deleted, errors);
365
+ }
366
+ } catch (error) {
367
+ errors.push(error.message);
368
+ }
369
+ s.stop(errors.length === 0 ? "\u5378\u8F7D\u5B8C\u6210" : "\u5378\u8F7D\u8FC7\u7A0B\u4E2D\u51FA\u73B0\u9519\u8BEF");
370
+ return { deleted, errors };
371
+ }
372
+ async function runUninstaller() {
373
+ try {
374
+ const config = await askUninstallOptions();
375
+ if (!config) {
376
+ process.exit(0);
377
+ }
378
+ const { deleted, errors } = await uninstall(config);
379
+ if (deleted.length > 0) {
380
+ p3.log.success("\u5DF2\u5220\u9664:");
381
+ for (const file of deleted) {
382
+ p3.log.message(` \u2713 ${file}`);
383
+ }
384
+ }
385
+ if (errors.length > 0) {
386
+ p3.log.error("\u9519\u8BEF:");
387
+ for (const error of errors) {
388
+ p3.log.message(` \u2717 ${error}`);
389
+ }
390
+ }
391
+ if (errors.length === 0) {
392
+ p3.outro("\u2705 \u5378\u8F7D\u5B8C\u6210");
393
+ } else {
394
+ p3.outro("\u26A0\uFE0F \u5378\u8F7D\u5B8C\u6210\uFF0C\u4F46\u5B58\u5728\u9519\u8BEF");
395
+ process.exit(1);
396
+ }
397
+ } catch (error) {
398
+ if (error.code === "EACCES") {
399
+ p3.log.error("\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u76EE\u5F55\u6743\u9650\u6216\u4F7F\u7528 sudo");
400
+ } else {
401
+ p3.log.error(`\u5378\u8F7D\u5931\u8D25: ${error.message}`);
402
+ }
403
+ process.exit(1);
404
+ }
405
+ }
406
+
407
+ // src/index.ts
408
+ function showHelp() {
409
+ console.log(`
410
+ \u{1F680} HelloAGENTS \u5B89\u88C5\u5668
411
+
412
+ \u7528\u6CD5:
413
+ npx @huajiwuyan/hello \u4EA4\u4E92\u5F0F\u5B89\u88C5
414
+ npx @huajiwuyan/hello -u \u5378\u8F7D
415
+ npx @huajiwuyan/hello -h \u663E\u793A\u5E2E\u52A9
416
+
417
+ \u9009\u9879:
418
+ -u, --uninstall \u5378\u8F7D HelloAGENTS
419
+ -h, --help \u663E\u793A\u5E2E\u52A9\u4FE1\u606F
420
+
421
+ \u652F\u6301\u7684 CLI:
422
+ - Claude Code (~/.claude)
423
+ - Codex CLI (~/.codex)
424
+ `);
425
+ }
426
+ async function main() {
427
+ try {
428
+ const { values } = parseArgs({
429
+ options: {
430
+ uninstall: { type: "boolean", short: "u" },
431
+ help: { type: "boolean", short: "h" }
432
+ }
433
+ });
434
+ if (values.help) {
435
+ showHelp();
436
+ process.exit(0);
437
+ }
438
+ if (values.uninstall) {
439
+ await runUninstaller();
440
+ } else {
441
+ await runInstaller();
442
+ }
443
+ } catch (error) {
444
+ console.error("\u9519\u8BEF:", error.message);
445
+ process.exit(1);
446
+ }
447
+ }
448
+ main();
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@huajiwuyan/hello",
3
+ "version": "3.0.0",
4
+ "description": "HelloAGENTS 交互式安装器 - 支持 Claude Code 和 Codex CLI",
5
+ "type": "module",
6
+ "bin": {
7
+ "hello": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "templates"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsup",
15
+ "dev": "tsup --watch",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "keywords": [
19
+ "helloagents",
20
+ "claude",
21
+ "codex",
22
+ "cli",
23
+ "installer"
24
+ ],
25
+ "author": "huajiwuyan",
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "@clack/prompts": "^0.7.0"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^25.1.0",
32
+ "tsup": "^8.0.0",
33
+ "typescript": "^5.3.0"
34
+ },
35
+ "engines": {
36
+ "node": ">=18"
37
+ }
38
+ }