@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
@@ -0,0 +1,399 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 迁移 HelloAGENTS 方案包到 archive/
5
+
6
+ Usage:
7
+ python migrate_package.py <package-name> [--path <base-path>] [--status <completed|skipped>]
8
+
9
+ Examples:
10
+ python migrate_package.py 202512191430_login
11
+ python migrate_package.py 202512191430_login --status skipped
12
+ python migrate_package.py --all --status skipped
13
+ """
14
+
15
+ import argparse
16
+ import re
17
+ import shutil
18
+ import sys
19
+ from pathlib import Path
20
+ from datetime import datetime
21
+
22
+ # 确保能找到同目录下的 utils 模块
23
+ sys.path.insert(0, str(Path(__file__).parent))
24
+ from utils import (
25
+ setup_encoding,
26
+ get_plan_path,
27
+ get_archive_path,
28
+ parse_package_name,
29
+ get_year_month,
30
+ list_packages,
31
+ print_error,
32
+ print_success,
33
+ script_error_handler,
34
+ validate_base_path,
35
+ get_template_loader,
36
+ ExecutionReport
37
+ )
38
+
39
+
40
+ def update_task_status(task_file: Path, status: str):
41
+ """
42
+ 更新 tasks.md 的状态备注
43
+
44
+ Args:
45
+ task_file: tasks.md 文件路径
46
+ status: 状态类型 (completed/skipped)
47
+ """
48
+ if not task_file.exists():
49
+ return
50
+
51
+ content = task_file.read_text(encoding='utf-8')
52
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
53
+
54
+ # 使用语言无关的标识符 @status(不会被翻译)
55
+ if status == "completed":
56
+ status_line = f"> **@status:** completed | {timestamp}"
57
+ else:
58
+ status_line = f"> **@status:** skipped | {timestamp}"
59
+
60
+ # 检测是否已有状态备注(兼容新旧格式)
61
+ status_pattern = r'^> \*\*(?:@status|Status|状态):\*\*'
62
+ lines = content.split('\n')
63
+
64
+ # 查找并替换已有的状态行
65
+ found_status = False
66
+ for i, line in enumerate(lines):
67
+ if re.match(status_pattern, line):
68
+ lines[i] = status_line
69
+ found_status = True
70
+ break
71
+
72
+ if not found_status:
73
+ # 在标题后插入
74
+ if content.startswith('#'):
75
+ # 找到第一个空行
76
+ insert_pos = 1
77
+ for i, line in enumerate(lines[1:], 1):
78
+ if not line.strip():
79
+ insert_pos = i + 1
80
+ break
81
+ lines.insert(insert_pos, status_line)
82
+ lines.insert(insert_pos + 1, '') # 添加空行
83
+ else:
84
+ lines.insert(0, status_line)
85
+ lines.insert(1, '')
86
+
87
+ content = '\n'.join(lines)
88
+ task_file.write_text(content, encoding='utf-8')
89
+
90
+
91
+ def update_archive_index(archive_path: Path, package_name: str, status: str):
92
+ """
93
+ 更新 archive/_index.md
94
+
95
+ Args:
96
+ archive_path: archive/ 目录路径
97
+ package_name: 方案包名称
98
+ status: 状态 (completed/skipped)
99
+ """
100
+ index_file = archive_path / "_index.md"
101
+
102
+ # 解析方案包名称
103
+ parsed = parse_package_name(package_name)
104
+ if not parsed:
105
+ return
106
+
107
+ timestamp, feature = parsed
108
+ year_month = get_year_month(timestamp)
109
+ # 使用中文状态标识符,与模板一致(无空格格式)
110
+ status_icon = "✅完成" if status == "completed" else "⏸未执行"
111
+
112
+ # 新记录行(6列:时间戳、名称、类型、涉及模块、决策、结果)
113
+ new_entry = f"| {timestamp} | {feature} | - | - | - | {status_icon} |"
114
+
115
+ if index_file.exists():
116
+ content = index_file.read_text(encoding='utf-8')
117
+
118
+ # 在索引表中插入新记录(表头之后)
119
+ lines = content.split('\n')
120
+ insert_pos = -1
121
+ for i, line in enumerate(lines):
122
+ # 检测表格分隔行(语言无关)
123
+ if line.startswith('|') and '---' in line:
124
+ insert_pos = i + 1
125
+ break
126
+
127
+ if insert_pos > 0 and insert_pos <= len(lines):
128
+ lines.insert(insert_pos, new_entry)
129
+ content = '\n'.join(lines)
130
+ else:
131
+ content += f"\n{new_entry}"
132
+ else:
133
+ # 创建新的 _index.md - 从模板加载
134
+ loader = get_template_loader()
135
+ template_content = loader.load("archive/_index.md")
136
+
137
+ if template_content:
138
+ # 在表格分隔行后插入新记录
139
+ lines = template_content.split('\n')
140
+ for i, line in enumerate(lines):
141
+ if line.startswith('|') and '---' in line:
142
+ lines.insert(i + 1, new_entry)
143
+ break
144
+ content = '\n'.join(lines)
145
+ else:
146
+ raise FileNotFoundError("模板文件不存在: archive/_index.md")
147
+
148
+ index_file.write_text(content, encoding='utf-8')
149
+
150
+
151
+ def migrate_package(package_path: Path, archive_base: Path, status: str = "completed") -> ExecutionReport:
152
+ """
153
+ 迁移单个方案包到 archive/(支持 AI 降级接手)
154
+
155
+ Args:
156
+ package_path: 方案包源路径
157
+ archive_base: archive/ 基础路径
158
+ status: 迁移状态
159
+
160
+ Returns:
161
+ ExecutionReport: 执行报告
162
+ """
163
+ report = ExecutionReport("migrate_package")
164
+ report.set_context(
165
+ package_name=package_path.name,
166
+ source_path=str(package_path),
167
+ archive_base=str(archive_base),
168
+ status=status
169
+ )
170
+
171
+ # 步骤1: 验证方案包存在
172
+ if not package_path.exists():
173
+ report.mark_failed(
174
+ "验证方案包存在",
175
+ ["迁移方案包"],
176
+ f"方案包不存在: {package_path}"
177
+ )
178
+ return report
179
+
180
+ report.mark_completed(
181
+ "验证方案包存在",
182
+ str(package_path),
183
+ "检查源路径是否存在"
184
+ )
185
+
186
+ # 步骤2: 解析时间戳获取年月
187
+ parsed = parse_package_name(package_path.name)
188
+ if not parsed:
189
+ # 使用当前年月
190
+ year_month = datetime.now().strftime("%Y-%m")
191
+ report.set_context(year_month=year_month, name_format_warning=True)
192
+ else:
193
+ year_month = get_year_month(parsed[0])
194
+ report.set_context(year_month=year_month)
195
+
196
+ # 步骤3: 创建目标目录
197
+ target_dir = archive_base / year_month
198
+ target_path = target_dir / package_path.name
199
+ report.set_context(target_path=str(target_path))
200
+
201
+ try:
202
+ target_dir.mkdir(parents=True, exist_ok=True)
203
+ report.mark_completed(
204
+ "创建归档目录",
205
+ str(target_dir),
206
+ "检查 archive/YYYY-MM/ 目录是否存在"
207
+ )
208
+ except PermissionError as e:
209
+ report.mark_failed(
210
+ "创建归档目录",
211
+ ["创建归档目录", "更新 tasks.md 状态", "移动方案包", "更新 _index.md"],
212
+ f"权限不足: {e}"
213
+ )
214
+ return report
215
+
216
+ # 步骤4: 更新 tasks.md 状态
217
+ task_file = package_path / "tasks.md"
218
+ try:
219
+ update_task_status(task_file, status)
220
+ report.mark_completed(
221
+ "更新 tasks.md 状态",
222
+ str(task_file),
223
+ "检查 tasks.md 中是否包含 @status 状态行"
224
+ )
225
+ except Exception as e:
226
+ report.mark_failed(
227
+ "更新 tasks.md 状态",
228
+ ["更新 tasks.md 状态", "移动方案包", "更新 _index.md"],
229
+ str(e)
230
+ )
231
+ return report
232
+
233
+ # 步骤5: 移动方案包(覆盖已存在的)
234
+ try:
235
+ if target_path.exists():
236
+ shutil.rmtree(target_path)
237
+ report.set_context(overwritten=True)
238
+
239
+ shutil.move(str(package_path), str(target_path))
240
+ report.mark_completed(
241
+ "移动方案包",
242
+ str(target_path),
243
+ "检查目标路径存在且源路径已删除"
244
+ )
245
+ except Exception as e:
246
+ report.mark_failed(
247
+ "移动方案包",
248
+ ["移动方案包", "更新 _index.md"],
249
+ str(e)
250
+ )
251
+ return report
252
+
253
+ # 步骤6: 更新 _index.md
254
+ try:
255
+ update_archive_index(archive_base, package_path.name, status)
256
+ report.mark_completed(
257
+ "更新 _index.md",
258
+ str(archive_base / "_index.md"),
259
+ "检查 _index.md 中是否包含新迁移的方案包记录"
260
+ )
261
+ except FileNotFoundError as e:
262
+ # 模板不存在的特殊情况
263
+ report.mark_failed(
264
+ "更新 _index.md",
265
+ ["创建 _index.md(需包含表格:时间戳、名称、类型、涉及模块、决策、结果)"],
266
+ str(e)
267
+ )
268
+ return report
269
+ except Exception as e:
270
+ report.mark_failed(
271
+ "更新 _index.md",
272
+ ["更新 _index.md"],
273
+ str(e)
274
+ )
275
+ return report
276
+
277
+ # 全部完成
278
+ report.mark_success(str(target_path))
279
+ return report
280
+
281
+
282
+ def main():
283
+ setup_encoding()
284
+ parser = argparse.ArgumentParser(
285
+ description="迁移 HelloAGENTS 方案包到 archive/"
286
+ )
287
+ parser.add_argument(
288
+ "package",
289
+ nargs="?",
290
+ help="方案包名称"
291
+ )
292
+ parser.add_argument(
293
+ "--path",
294
+ default=None,
295
+ help="项目根目录 (默认: 当前目录)"
296
+ )
297
+ parser.add_argument(
298
+ "--status",
299
+ choices=["completed", "skipped"],
300
+ default="completed",
301
+ help="迁移状态: completed(已完成) 或 skipped(未执行)"
302
+ )
303
+ parser.add_argument(
304
+ "--all",
305
+ action="store_true",
306
+ help="迁移 plan/ 中的所有方案包"
307
+ )
308
+
309
+ args = parser.parse_args()
310
+
311
+ # 验证基础路径
312
+ try:
313
+ validate_base_path(args.path)
314
+ except ValueError as e:
315
+ report = ExecutionReport("migrate_package")
316
+ report.mark_failed("验证基础路径", ["迁移方案包"], str(e))
317
+ report.print_report()
318
+ sys.exit(1)
319
+
320
+ plan_path = get_plan_path(args.path)
321
+ archive_path = get_archive_path(args.path)
322
+
323
+ if args.all:
324
+ # 迁移所有方案包 - 返回汇总报告
325
+ packages = list_packages(plan_path)
326
+
327
+ if not packages:
328
+ report = ExecutionReport("migrate_package")
329
+ report.set_context(mode="all", status=args.status)
330
+ report.mark_success("plan/ 目录为空,无方案包需要迁移")
331
+ report.print_report()
332
+ sys.exit(0)
333
+
334
+ # 汇总报告
335
+ summary_report = ExecutionReport("migrate_package")
336
+ summary_report.set_context(
337
+ mode="all",
338
+ status=args.status,
339
+ total_packages=len(packages)
340
+ )
341
+
342
+ success_count = 0
343
+ failed_packages = []
344
+
345
+ for pkg in packages:
346
+ pkg_report = migrate_package(pkg['path'], archive_path, args.status)
347
+ if pkg_report.success:
348
+ success_count += 1
349
+ summary_report.mark_completed(
350
+ f"迁移 {pkg['name']}",
351
+ pkg_report.context.get("target_path", ""),
352
+ "检查目标路径存在"
353
+ )
354
+ else:
355
+ failed_packages.append({
356
+ "name": pkg['name'],
357
+ "failed_at": pkg_report.failed_at,
358
+ "error": pkg_report.error_message
359
+ })
360
+
361
+ if failed_packages:
362
+ summary_report.set_context(
363
+ success_count=success_count,
364
+ failed_packages=failed_packages
365
+ )
366
+ pending = [f"迁移 {p['name']}" for p in failed_packages]
367
+ summary_report.mark_failed(
368
+ f"批量迁移({success_count}/{len(packages)} 成功)",
369
+ pending,
370
+ f"{len(failed_packages)} 个方案包迁移失败"
371
+ )
372
+ else:
373
+ summary_report.set_context(success_count=success_count)
374
+ summary_report.mark_success(f"全部 {success_count} 个方案包迁移完成")
375
+
376
+ summary_report.print_report()
377
+ sys.exit(0 if not failed_packages else 1)
378
+
379
+ elif args.package:
380
+ # 迁移单个方案包
381
+ package_path = plan_path / args.package
382
+
383
+ if not package_path.exists():
384
+ report = ExecutionReport("migrate_package")
385
+ report.mark_failed("查找方案包", ["迁移方案包"], f"方案包不存在: {package_path}")
386
+ report.print_report()
387
+ sys.exit(1)
388
+
389
+ report = migrate_package(package_path, archive_path, args.status)
390
+ report.print_report()
391
+ sys.exit(0 if report.success else 1)
392
+
393
+ else:
394
+ parser.print_help()
395
+ sys.exit(1)
396
+
397
+
398
+ if __name__ == "__main__":
399
+ main()