@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,260 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 创建 HelloAGENTS 方案包
5
+
6
+ Usage:
7
+ python create_package.py <feature-name> [--path <base-path>] [--type <implementation|overview>]
8
+
9
+ Examples:
10
+ python create_package.py user-login
11
+ python create_package.py api-refactor --type overview
12
+ python create_package.py auth-system --path /path/to/project
13
+ """
14
+
15
+ import argparse
16
+ import re
17
+ import sys
18
+ from pathlib import Path
19
+ from datetime import datetime
20
+
21
+ # 确保能找到同目录下的 utils 模块
22
+ sys.path.insert(0, str(Path(__file__).parent))
23
+ from utils import (
24
+ setup_encoding,
25
+ get_plan_path,
26
+ generate_package_name,
27
+ print_error,
28
+ print_success,
29
+ validate_base_path,
30
+ get_template_loader,
31
+ ExecutionReport
32
+ )
33
+
34
+
35
+ # 模板路径常量
36
+ TEMPLATE_PROPOSAL = "plan/proposal.md"
37
+ TEMPLATE_TASKS = "plan/tasks.md"
38
+
39
+
40
+ def create_package(feature: str, base_path: str = None, pkg_type: str = "implementation") -> ExecutionReport:
41
+ """
42
+ 创建方案包(并发安全,支持 AI 降级接手)
43
+
44
+ Args:
45
+ feature: 功能名称
46
+ base_path: 项目根目录
47
+ pkg_type: 方案包类型 (implementation/overview)
48
+
49
+ Returns:
50
+ ExecutionReport: 执行报告,包含完成状态和上下文
51
+ """
52
+ report = ExecutionReport("create_package")
53
+ report.set_context(feature=feature, pkg_type=pkg_type, base_path=base_path or "cwd")
54
+
55
+ plan_path = get_plan_path(base_path)
56
+ original_name = generate_package_name(feature)
57
+
58
+ # 步骤1: 确保父目录存在
59
+ try:
60
+ plan_path.mkdir(parents=True, exist_ok=True)
61
+ report.mark_completed(
62
+ "创建 plan/ 目录",
63
+ str(plan_path),
64
+ "检查目录是否存在: ls 或 Read 工具"
65
+ )
66
+ except PermissionError as e:
67
+ report.mark_failed(
68
+ "创建 plan/ 目录",
69
+ ["创建 plan/ 目录", "创建方案包目录", "创建 proposal.md", "创建 tasks.md"],
70
+ f"权限不足: {e}"
71
+ )
72
+ return report
73
+
74
+ # 步骤2: 并发安全的目录创建(原子操作 + 重试)
75
+ max_retries = 100
76
+ package_path = None
77
+ package_name = None
78
+
79
+ for version in range(1, max_retries + 1):
80
+ package_name = original_name if version == 1 else f"{original_name}_v{version}"
81
+ package_path = plan_path / package_name
82
+
83
+ try:
84
+ package_path.mkdir(exist_ok=False)
85
+ report.mark_completed(
86
+ "创建方案包目录",
87
+ str(package_path),
88
+ "检查目录是否存在且为空目录"
89
+ )
90
+ report.set_context(package_path=str(package_path), package_name=package_name)
91
+ break
92
+ except FileExistsError:
93
+ continue
94
+ except PermissionError as e:
95
+ report.mark_failed(
96
+ "创建方案包目录",
97
+ ["创建方案包目录", "创建 proposal.md", "创建 tasks.md"],
98
+ f"权限不足: {package_path}"
99
+ )
100
+ return report
101
+ else:
102
+ report.mark_failed(
103
+ "创建方案包目录",
104
+ ["创建方案包目录", "创建 proposal.md", "创建 tasks.md"],
105
+ f"超过最大重试次数 ({max_retries}),存在大量同名方案包"
106
+ )
107
+ return report
108
+
109
+ # 步骤3: 加载并填充模板
110
+ current_date = datetime.now().strftime("%Y-%m-%d")
111
+ loader = get_template_loader()
112
+
113
+ # 定义占位符替换映射
114
+ replacements = {
115
+ "{feature}": feature,
116
+ "{YYYY-MM-DD}": current_date,
117
+ "{pkg_type}": pkg_type,
118
+ "{package_name}": package_name,
119
+ "{YYYYMMDDHHMM}_{feature}": package_name
120
+ }
121
+
122
+ # 步骤4: proposal.md - 检查模板存在性
123
+ proposal_content = loader.fill(TEMPLATE_PROPOSAL, replacements)
124
+ if proposal_content is None:
125
+ report.mark_failed(
126
+ f"加载模板 {TEMPLATE_PROPOSAL}",
127
+ ["创建 proposal.md(需包含:元信息、需求、方案章节)", "创建 tasks.md"],
128
+ f"模板文件不存在: {TEMPLATE_PROPOSAL}"
129
+ )
130
+ return report
131
+
132
+ # 步骤5: tasks.md - 检查模板存在性
133
+ tasks_content = loader.fill(TEMPLATE_TASKS, replacements)
134
+ if tasks_content is None:
135
+ report.mark_failed(
136
+ f"加载模板 {TEMPLATE_TASKS}",
137
+ ["创建 tasks.md(需包含:执行状态、任务列表、执行备注章节)"],
138
+ f"模板文件不存在: {TEMPLATE_TASKS}"
139
+ )
140
+ # 仍需标记 proposal 模板加载成功
141
+ report.mark_completed(
142
+ "加载 proposal.md 模板",
143
+ "模板内容已加载",
144
+ "N/A - 模板加载成功但未写入文件"
145
+ )
146
+ return report
147
+
148
+ # overview 类型:替换任务列表为"无执行任务"
149
+ if pkg_type == "overview":
150
+ # 替换执行状态中的完成率
151
+ tasks_content = re.sub(r'完成率:\s*\d+%', '完成率: N/A', tasks_content)
152
+ tasks_content = re.sub(r'总任务:\s*\w+', '总任务: 0', tasks_content)
153
+ # 替换任务列表部分
154
+ tasks_content = re.sub(
155
+ r'## 任务列表\s*\n.*?(?=\n---)',
156
+ '## 任务列表\n\n> 无执行任务(概述文档)\n',
157
+ tasks_content,
158
+ flags=re.DOTALL
159
+ )
160
+
161
+ # 步骤6: 写入 proposal.md
162
+ proposal_path = package_path / "proposal.md"
163
+ try:
164
+ proposal_path.write_text(proposal_content, encoding='utf-8')
165
+ report.mark_completed(
166
+ "创建 proposal.md",
167
+ str(proposal_path),
168
+ "检查文件存在且包含必需章节(元信息、需求、方案)"
169
+ )
170
+ except Exception as e:
171
+ report.mark_failed(
172
+ "写入 proposal.md",
173
+ ["创建 proposal.md", "创建 tasks.md"],
174
+ str(e)
175
+ )
176
+ return report
177
+
178
+ # 步骤7: 写入 tasks.md
179
+ tasks_path = package_path / "tasks.md"
180
+ try:
181
+ tasks_path.write_text(tasks_content, encoding='utf-8')
182
+ report.mark_completed(
183
+ "创建 tasks.md",
184
+ str(tasks_path),
185
+ "检查文件存在且包含必需章节(执行状态、任务列表)"
186
+ )
187
+ except Exception as e:
188
+ report.mark_failed(
189
+ "写入 tasks.md",
190
+ ["创建 tasks.md"],
191
+ str(e)
192
+ )
193
+ return report
194
+
195
+ # 全部完成
196
+ report.mark_success(str(package_path))
197
+ return report
198
+
199
+
200
+ def main():
201
+ setup_encoding()
202
+ parser = argparse.ArgumentParser(
203
+ description="创建 HelloAGENTS 方案包"
204
+ )
205
+ parser.add_argument(
206
+ "feature",
207
+ help="功能名称 (如: user-login, api-refactor)"
208
+ )
209
+ parser.add_argument(
210
+ "--path",
211
+ default=None,
212
+ help="项目根目录 (默认: 当前目录)"
213
+ )
214
+ parser.add_argument(
215
+ "--type",
216
+ choices=["implementation", "overview"],
217
+ default="implementation",
218
+ help="方案包类型: implementation(实施计划) 或 overview(概述文档)"
219
+ )
220
+
221
+ args = parser.parse_args()
222
+
223
+ # 验证基础路径
224
+ try:
225
+ validate_base_path(args.path)
226
+ except ValueError as e:
227
+ report = ExecutionReport("create_package")
228
+ report.mark_failed("验证基础路径", ["验证路径", "创建方案包"], str(e))
229
+ report.print_report()
230
+ sys.exit(1)
231
+
232
+ # 验证 feature 名称
233
+ feature = args.feature.strip()
234
+ if not feature:
235
+ report = ExecutionReport("create_package")
236
+ report.mark_failed("验证功能名称", ["创建方案包"], "功能名称不能为空")
237
+ report.print_report()
238
+ sys.exit(1)
239
+
240
+ # 预验证 feature 名称有效性(检查规范化后是否为空)
241
+ try:
242
+ generate_package_name(feature)
243
+ except ValueError as e:
244
+ report = ExecutionReport("create_package")
245
+ report.mark_failed("验证功能名称", ["创建方案包"], str(e))
246
+ report.print_report()
247
+ sys.exit(1)
248
+
249
+ # 执行创建
250
+ report = create_package(feature, args.path, args.type)
251
+
252
+ # 输出执行报告(JSON格式,供 AI 解析)
253
+ report.print_report()
254
+
255
+ # 返回状态码
256
+ sys.exit(0 if report.success else 1)
257
+
258
+
259
+ if __name__ == "__main__":
260
+ main()
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ 列出 HelloAGENTS 方案包
5
+
6
+ Usage:
7
+ python list_packages.py [--path <base-path>] [--archive] [--format <table|json>]
8
+
9
+ Examples:
10
+ python list_packages.py
11
+ python list_packages.py --archive
12
+ python list_packages.py --format json
13
+ """
14
+
15
+ import argparse
16
+ import json
17
+ import sys
18
+ from pathlib import Path
19
+
20
+ # 确保能找到同目录下的 utils 模块
21
+ sys.path.insert(0, str(Path(__file__).parent))
22
+ from utils import (
23
+ setup_encoding,
24
+ get_plan_path,
25
+ get_archive_path,
26
+ list_packages,
27
+ get_package_summary,
28
+ print_error,
29
+ validate_base_path
30
+ )
31
+
32
+
33
+ def print_table(packages: list, title: str):
34
+ """以表格形式打印方案包列表"""
35
+ if not packages:
36
+ print(f"{title}: 空(无方案包)")
37
+ return
38
+
39
+ print(f"\n{title} ({len(packages)} 个):")
40
+ print("-" * 80)
41
+ print(f"{'序号':<4} {'名称':<30} {'任务':<6} {'状态':<8} {'摘要':<30}")
42
+ print("-" * 80)
43
+
44
+ for i, pkg in enumerate(packages, 1):
45
+ status = "✅完整" if pkg['complete'] else "⚠️不完整"
46
+ try:
47
+ summary = get_package_summary(pkg['path'])
48
+ except Exception:
49
+ summary = "(读取失败)"
50
+ print(f"{i:<4} {pkg['name']:<30} {pkg['task_count']:<6} {status:<8} {summary:<30}")
51
+
52
+ print("-" * 80)
53
+
54
+
55
+ def print_json(packages: list):
56
+ """以 JSON 形式打印方案包列表"""
57
+ output = []
58
+ for pkg in packages:
59
+ try:
60
+ summary = get_package_summary(pkg['path'])
61
+ except Exception:
62
+ summary = "(读取失败)"
63
+ output.append({
64
+ 'name': pkg['name'],
65
+ 'timestamp': pkg['timestamp'],
66
+ 'feature': pkg['feature'],
67
+ 'complete': pkg['complete'],
68
+ 'task_count': pkg['task_count'],
69
+ 'path': str(pkg['path']),
70
+ 'summary': summary
71
+ })
72
+ print(json.dumps(output, ensure_ascii=False, indent=2))
73
+
74
+
75
+ def main():
76
+ setup_encoding()
77
+ try:
78
+ parser = argparse.ArgumentParser(
79
+ description="列出 HelloAGENTS 方案包"
80
+ )
81
+ parser.add_argument(
82
+ "--path",
83
+ default=None,
84
+ help="项目根目录 (默认: 当前目录)"
85
+ )
86
+ parser.add_argument(
87
+ "--archive",
88
+ action="store_true",
89
+ help="同时列出 archive/ 中的方案包"
90
+ )
91
+ parser.add_argument(
92
+ "--format",
93
+ choices=["table", "json"],
94
+ default="table",
95
+ help="输出格式: table(表格) 或 json"
96
+ )
97
+
98
+ args = parser.parse_args()
99
+
100
+ # 验证基础路径
101
+ validate_base_path(args.path)
102
+
103
+ # 获取 plan/ 方案包
104
+ plan_path = get_plan_path(args.path)
105
+ plan_packages = list_packages(plan_path)
106
+
107
+ if args.format == "json":
108
+ result = {'plan': plan_packages}
109
+
110
+ if args.archive:
111
+ archive_path = get_archive_path(args.path)
112
+ # 扫描 archive 下的所有年月子目录
113
+ archive_packages = []
114
+ if archive_path.exists():
115
+ for month_dir in archive_path.iterdir():
116
+ if month_dir.is_dir() and not month_dir.name.startswith('.'):
117
+ archive_packages.extend(list_packages(month_dir))
118
+ result['archive'] = archive_packages
119
+
120
+ print(json.dumps(result, ensure_ascii=False, indent=2, default=str))
121
+ else:
122
+ print_table(plan_packages, "📦 plan/ 方案包")
123
+
124
+ if args.archive:
125
+ archive_path = get_archive_path(args.path)
126
+ if archive_path.exists():
127
+ for month_dir in sorted(archive_path.iterdir(), reverse=True):
128
+ if month_dir.is_dir() and not month_dir.name.startswith('.'):
129
+ month_packages = list_packages(month_dir)
130
+ if month_packages:
131
+ print_table(month_packages, f"📁 archive/{month_dir.name}/")
132
+
133
+ except KeyboardInterrupt:
134
+ print("\n操作已取消", file=sys.stderr)
135
+ sys.exit(130)
136
+ except PermissionError as e:
137
+ print_error(f"权限不足 - {e}")
138
+ sys.exit(1)
139
+ except Exception as e:
140
+ print_error(str(e))
141
+ sys.exit(1)
142
+
143
+
144
+ if __name__ == "__main__":
145
+ main()