cc-devflow 2.5.0 → 4.1.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.
Files changed (192) hide show
  1. package/.claude/CLAUDE.md +1065 -53
  2. package/.claude/agents/dev-implementer.md +195 -0
  3. package/.claude/commands/{flow-archive.md → flow/archive.md} +46 -11
  4. package/.claude/commands/flow/context.md +150 -0
  5. package/.claude/commands/flow/delta.md +245 -0
  6. package/.claude/commands/{flow-dev.md → flow/dev.md} +112 -11
  7. package/.claude/commands/flow/init.md +45 -0
  8. package/.claude/commands/flow/new.md +279 -0
  9. package/.claude/commands/flow/quality.md +159 -0
  10. package/.claude/commands/flow/spec.md +186 -0
  11. package/.claude/commands/flow/workspace.md +146 -0
  12. package/.claude/commands/{cancel-ralph.md → util/cancel-ralph.md} +1 -0
  13. package/.claude/config/quality-gates.yml +305 -0
  14. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +313 -0
  15. package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +91 -0
  16. package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +151 -0
  17. package/.claude/docs/templates/JOURNAL_TEMPLATE.md +75 -0
  18. package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +51 -91
  19. package/.claude/docs/templates/_shared/CLAUDE.md +36 -0
  20. package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +125 -0
  21. package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +187 -0
  22. package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +164 -0
  23. package/.claude/docs/templates/context/dev.jsonl.template +6 -0
  24. package/.claude/docs/templates/context/epic.jsonl.template +5 -0
  25. package/.claude/docs/templates/context/prd.jsonl.template +4 -0
  26. package/.claude/docs/templates/context/research.jsonl.template +4 -0
  27. package/.claude/docs/templates/context/review.jsonl.template +5 -0
  28. package/.claude/docs/templates/context/tech.jsonl.template +5 -0
  29. package/.claude/hooks/CLAUDE.md +342 -0
  30. package/.claude/hooks/inject-agent-context.ts +480 -0
  31. package/.claude/hooks/inject-skill-context.ts +359 -0
  32. package/.claude/hooks/ralph-loop.ts +931 -0
  33. package/.claude/hooks/task-completed-hook.ts +593 -0
  34. package/.claude/hooks/teammate-idle-hook.ts +690 -0
  35. package/.claude/hooks/types/team-types.d.ts +238 -0
  36. package/.claude/rules/devflow-conventions.md +82 -9
  37. package/.claude/scripts/archive-requirement.sh +44 -1
  38. package/.claude/scripts/common.sh +670 -3
  39. package/.claude/scripts/delta-parser.ts +527 -0
  40. package/.claude/scripts/detect-file-conflicts.sh +151 -0
  41. package/.claude/scripts/flow-context-add.sh +134 -0
  42. package/.claude/scripts/flow-context-init.sh +133 -0
  43. package/.claude/scripts/flow-context-validate.sh +144 -0
  44. package/.claude/scripts/flow-delta-apply.sh +297 -0
  45. package/.claude/scripts/flow-delta-archive.sh +71 -0
  46. package/.claude/scripts/flow-delta-create.sh +202 -0
  47. package/.claude/scripts/flow-delta-list.sh +142 -0
  48. package/.claude/scripts/flow-delta-status.sh +235 -0
  49. package/.claude/scripts/flow-quality-full.sh +184 -0
  50. package/.claude/scripts/flow-quality-quick.sh +64 -0
  51. package/.claude/scripts/flow-workspace-init.sh +117 -0
  52. package/.claude/scripts/flow-workspace-record.sh +164 -0
  53. package/.claude/scripts/flow-workspace-start.sh +88 -0
  54. package/.claude/scripts/get-workflow-status.sh +415 -0
  55. package/.claude/scripts/parse-task-dependencies.js +334 -0
  56. package/.claude/scripts/record-quality-error.sh +165 -0
  57. package/.claude/scripts/run-quality-gates.sh +242 -0
  58. package/.claude/scripts/team-dev-init.sh +319 -0
  59. package/.claude/scripts/team-state-recovery.sh +229 -0
  60. package/.claude/scripts/workflow-status.ts +433 -0
  61. package/.claude/settings.json +19 -0
  62. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +85 -200
  63. package/.claude/skills/domain/using-git-worktrees/SKILL.md +252 -0
  64. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +133 -0
  65. package/.claude/skills/domain/using-git-worktrees/context.jsonl +4 -0
  66. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +218 -0
  67. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +232 -0
  68. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +130 -0
  69. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +140 -0
  70. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +70 -0
  71. package/.claude/skills/utility/skill-creator/LICENSE.txt +202 -0
  72. package/.claude/skills/utility/skill-creator/SKILL.md +356 -0
  73. package/.claude/skills/utility/skill-creator/references/output-patterns.md +82 -0
  74. package/.claude/skills/utility/skill-creator/references/workflows.md +28 -0
  75. package/.claude/skills/utility/skill-creator/scripts/init_skill.py +303 -0
  76. package/.claude/skills/utility/skill-creator/scripts/package_skill.py +110 -0
  77. package/.claude/skills/utility/skill-creator/scripts/quick_validate.py +95 -0
  78. package/.claude/skills/workflow/flow-dev/CLAUDE.md +78 -0
  79. package/.claude/skills/workflow/flow-dev/SKILL.md +96 -0
  80. package/.claude/skills/workflow/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +71 -0
  81. package/.claude/skills/workflow/flow-dev/context.jsonl +8 -0
  82. package/.claude/skills/workflow/flow-dev/dev-implementer.jsonl +8 -0
  83. package/.claude/skills/workflow/flow-dev/scripts/entry-gate.sh +116 -0
  84. package/.claude/skills/workflow/flow-dev/scripts/exit-gate.sh +101 -0
  85. package/.claude/skills/workflow/flow-dev/scripts/task-orchestrator.sh +106 -0
  86. package/.claude/skills/workflow/flow-fix/SKILL.md +105 -0
  87. package/.claude/skills/workflow/flow-fix/context.jsonl +6 -0
  88. package/.claude/skills/workflow/flow-fix/references/bug-analyzer.md +381 -0
  89. package/.claude/skills/workflow/flow-init/SKILL.md +211 -0
  90. package/.claude/skills/workflow/flow-init/assets/BRAINSTORM_TEMPLATE.md +148 -0
  91. package/.claude/skills/workflow/flow-init/assets/INIT_FLOW_TEMPLATE.md +198 -0
  92. package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +276 -0
  93. package/.claude/skills/workflow/flow-init/context.jsonl +5 -0
  94. package/.claude/skills/workflow/flow-init/references/flow-researcher.md +132 -0
  95. package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +240 -0
  96. package/.claude/skills/workflow/flow-init/scripts/consolidate-research.sh +182 -0
  97. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +523 -0
  98. package/.claude/skills/workflow/flow-init/scripts/generate-research-tasks.sh +157 -0
  99. package/.claude/skills/workflow/flow-init/scripts/populate-research-tasks.sh +284 -0
  100. package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +340 -0
  101. package/.claude/skills/workflow/flow-quality/SKILL.md +94 -0
  102. package/.claude/skills/workflow/flow-quality/context.jsonl +6 -0
  103. package/.claude/skills/workflow/flow-quality/references/code-quality-reviewer.md +205 -0
  104. package/.claude/skills/workflow/flow-quality/references/qa-tester.md +313 -0
  105. package/.claude/skills/workflow/flow-quality/references/security-reviewer.md +314 -0
  106. package/.claude/skills/workflow/flow-quality/references/spec-reviewer.md +221 -0
  107. package/.claude/skills/workflow/flow-release/SKILL.md +126 -0
  108. package/.claude/skills/workflow/flow-release/context.jsonl +7 -0
  109. package/.claude/skills/workflow/flow-release/references/release-manager.md +295 -0
  110. package/.claude/skills/workflow/flow-spec/CLAUDE.md +103 -0
  111. package/.claude/skills/workflow/flow-spec/SKILL.md +545 -0
  112. package/.claude/skills/workflow/flow-spec/context.jsonl +7 -0
  113. package/.claude/skills/workflow/flow-spec/scripts/entry-gate.sh +194 -0
  114. package/.claude/skills/workflow/flow-spec/scripts/exit-gate.sh +244 -0
  115. package/.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh +205 -0
  116. package/.claude/skills/workflow/flow-spec/scripts/team-communication.sh +353 -0
  117. package/.claude/skills/workflow/flow-spec/scripts/team-init.sh +195 -0
  118. package/.claude/skills/workflow/flow-spec/scripts/test-team-mode.sh +496 -0
  119. package/.claude/skills/workflow/flow-spec/team-config.json +165 -0
  120. package/.claude/skills/workflow.yaml +417 -0
  121. package/CHANGELOG.md +268 -0
  122. package/README.md +206 -50
  123. package/README.zh-CN.md +219 -57
  124. package/lib/compiler/CLAUDE.md +77 -46
  125. package/lib/compiler/__tests__/multi-module-emitters.test.js +508 -0
  126. package/lib/compiler/context-expander.js +179 -0
  127. package/lib/compiler/emitters/antigravity-emitter.js +195 -5
  128. package/lib/compiler/emitters/base-emitter.js +217 -2
  129. package/lib/compiler/emitters/codex-emitter.js +200 -4
  130. package/lib/compiler/emitters/cursor-emitter.js +307 -3
  131. package/lib/compiler/emitters/qwen-emitter.js +196 -4
  132. package/lib/compiler/index.js +197 -2
  133. package/lib/compiler/platforms.js +270 -21
  134. package/package.json +2 -2
  135. package/.claude/commands/flow-epic.md +0 -183
  136. package/.claude/commands/flow-init.md +0 -370
  137. package/.claude/commands/flow-new.md +0 -442
  138. package/.claude/commands/flow-prd.md +0 -144
  139. package/.claude/commands/flow-qa.md +0 -93
  140. package/.claude/commands/flow-review.md +0 -257
  141. package/.claude/commands/flow-tech.md +0 -142
  142. package/.claude/commands/flow-ui.md +0 -189
  143. package/.claude/skills/file-header-guardian/SKILL.md +0 -56
  144. package/.claude/skills/skill-developer/ADVANCED.md +0 -197
  145. package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
  146. package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
  147. package/.claude/skills/skill-developer/SKILL.md +0 -426
  148. package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
  149. package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
  150. package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
  151. package/.claude/skills/writing-skills/SKILL.md +0 -655
  152. package/.claude/skills/writing-skills/anthropic-best-practices.md +0 -1150
  153. package/.claude/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  154. package/.claude/skills/writing-skills/graphviz-conventions.dot +0 -172
  155. package/.claude/skills/writing-skills/persuasion-principles.md +0 -187
  156. package/.claude/skills/writing-skills/render-graphs.js +0 -168
  157. package/.claude/skills/writing-skills/testing-skills-with-subagents.md +0 -384
  158. package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +0 -1
  159. package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +0 -1
  160. /package/.claude/commands/{core-architecture.md → core/architecture.md} +0 -0
  161. /package/.claude/commands/{core-guidelines.md → core/guidelines.md} +0 -0
  162. /package/.claude/commands/{core-roadmap.md → core/roadmap.md} +0 -0
  163. /package/.claude/commands/{core-style.md → core/style.md} +0 -0
  164. /package/.claude/commands/{flow-checklist.md → flow/checklist.md} +0 -0
  165. /package/.claude/commands/{flow-clarify.md → flow/clarify.md} +0 -0
  166. /package/.claude/commands/{flow-constitution.md → flow/constitution.md} +0 -0
  167. /package/.claude/commands/{flow-fix.md → flow/fix.md} +0 -0
  168. /package/.claude/commands/{flow-ideate.md → flow/ideate.md} +0 -0
  169. /package/.claude/commands/{flow-release.md → flow/release.md} +0 -0
  170. /package/.claude/commands/{flow-restart.md → flow/restart.md} +0 -0
  171. /package/.claude/commands/{flow-status.md → flow/status.md} +0 -0
  172. /package/.claude/commands/{flow-update.md → flow/update.md} +0 -0
  173. /package/.claude/commands/{flow-upgrade.md → flow/upgrade.md} +0 -0
  174. /package/.claude/commands/{flow-verify.md → flow/verify.md} +0 -0
  175. /package/.claude/commands/{code-review-high.md → util/code-review.md} +0 -0
  176. /package/.claude/commands/{git-commit.md → util/git-commit.md} +0 -0
  177. /package/.claude/commands/{problem-analyzer.md → util/problem-analyzer.md} +0 -0
  178. /package/.claude/skills/{flow-attention-refresh → domain/attention-refresh}/SKILL.md +0 -0
  179. /package/.claude/skills/{flow-brainstorming → domain/brainstorming}/SKILL.md +0 -0
  180. /package/.claude/skills/{flow-debugging → domain/debugging}/SKILL.md +0 -0
  181. /package/.claude/skills/{flow-finishing-branch → domain/finishing-branch}/SKILL.md +0 -0
  182. /package/.claude/skills/{flow-receiving-review → domain/receiving-review}/SKILL.md +0 -0
  183. /package/.claude/skills/{flow-tdd → domain/tdd}/SKILL.md +0 -0
  184. /package/.claude/skills/{verification-before-completion → domain/verification}/SKILL.md +0 -0
  185. /package/.claude/skills/{constitution-guardian → guardrail/constitution-guardian}/SKILL.md +0 -0
  186. /package/.claude/skills/{devflow-tdd-enforcer → guardrail/tdd-enforcer}/SKILL.md +0 -0
  187. /package/.claude/skills/{devflow-constitution-quick-ref → utility/constitution-quick-ref}/SKILL.md +0 -0
  188. /package/.claude/skills/{devflow-file-standards → utility/file-standards}/SKILL.md +0 -0
  189. /package/.claude/skills/{fractal-docs-generator → utility/fractal-docs}/SKILL.md +0 -0
  190. /package/.claude/skills/{journey-coherence-checker → utility/journey-checker}/SKILL.md +0 -0
  191. /package/.claude/skills/{journey-coherence-checker → utility/journey-checker}/pressure-scenarios.md +0 -0
  192. /package/.claude/skills/{npm-release → utility/npm-release}/SKILL.md +0 -0
@@ -1,15 +1,23 @@
1
1
  /**
2
- * Compiler Entry Point (v2.0)
2
+ * Compiler Entry Point (v3.0)
3
+ *
4
+ * [INPUT]: .claude/commands/, .claude/skills/, .claude/agents/, .claude/rules/, .claude/hooks/
5
+ * [OUTPUT]: 各平台目录 (.codex/, .cursor/, .qwen/, .agent/)
6
+ * [POS]: 编译器主入口,协调多模块编译流程
7
+ * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
3
8
  *
4
9
  * 编译器主入口:
5
10
  * - compile(options): 编译命令文件到目标平台
11
+ * - compileMultiModule(options): 编译所有模块到目标平台 (v3.0)
6
12
  * - 协调 parser, transformer, emitters, manifest
7
13
  * - 复制资源文件并重写路径
8
14
  * - 生成 skills-registry.json 和规则入口文件
9
15
  *
10
16
  * v2.0 (REQ-006): 支持 --rules, --skills 参数
17
+ * v3.0: 支持多模块编译 (skills, commands, agents, rules, hooks)
11
18
  */
12
19
  const path = require('path');
20
+ const fs = require('fs');
13
21
 
14
22
  const { parseAllCommands } = require('./parser.js');
15
23
  const { transformForPlatform } = require('./transformer.js');
@@ -36,6 +44,191 @@ const {
36
44
  } = require('./resource-copier.js');
37
45
  const { generateSkillsRegistryV2, writeSkillsRegistry } = require('./skills-registry.js');
38
46
  const { getRulesEmitter, emitAllRules } = require('./rules-emitters/index.js');
47
+ const { getPlatformConfig, MODULE_TYPES, isModuleSupported } = require('./platforms.js');
48
+
49
+ // ============================================================
50
+ // DEFAULT_MODULES - 默认编译的模块
51
+ // ============================================================
52
+ const DEFAULT_MODULES = ['skills', 'commands', 'agents', 'rules'];
53
+
54
+ // ============================================================
55
+ // compileMultiModule - 多模块编译主函数 (v3.0)
56
+ // ============================================================
57
+ async function compileMultiModule(options = {}) {
58
+ const {
59
+ sourceBaseDir = '.claude/',
60
+ outputBaseDir = '.',
61
+ platforms = PLATFORMS,
62
+ modules = DEFAULT_MODULES,
63
+ verbose = false,
64
+ check = false
65
+ } = options;
66
+
67
+ // 验证平台参数
68
+ for (const platform of platforms) {
69
+ if (!PLATFORMS.includes(platform)) {
70
+ throw new Error(`Unknown platform: ${platform}`);
71
+ }
72
+ }
73
+
74
+ const result = {
75
+ success: true,
76
+ platforms: platforms,
77
+ modules: modules,
78
+ skillsEmitted: 0,
79
+ commandsEmitted: 0,
80
+ agentsEmitted: 0,
81
+ rulesEmitted: 0,
82
+ hooksEmitted: 0,
83
+ errors: []
84
+ };
85
+
86
+ // 加载 manifest
87
+ const manifestPath = path.join(outputBaseDir, MANIFEST_PATH);
88
+ let manifest = await loadManifest(manifestPath);
89
+ manifest = migrateToV2(manifest);
90
+
91
+ // 如果是 check 模式,只做漂移检测
92
+ if (check) {
93
+ const { checkDrift } = require('./manifest.js');
94
+ const drift = await checkDrift(manifest);
95
+ return {
96
+ ...result,
97
+ check: true,
98
+ drift,
99
+ success: drift.length === 0
100
+ };
101
+ }
102
+
103
+ // 为每个平台编译每个模块
104
+ for (const platform of platforms) {
105
+ const emitter = getEmitter(platform);
106
+ const platformConfig = getPlatformConfig(platform);
107
+
108
+ if (verbose) {
109
+ console.log(`\nCompiling for ${platformConfig.name}...`);
110
+ }
111
+
112
+ // 编译 Skills
113
+ if (modules.includes('skills')) {
114
+ try {
115
+ const skillsSourceDir = path.join(sourceBaseDir, 'skills');
116
+ const skillsTargetDir = getSkillsTargetDir(platform, platformConfig);
117
+
118
+ if (fs.existsSync(skillsSourceDir)) {
119
+ const skillResults = await emitter.emitSkills(skillsSourceDir, skillsTargetDir);
120
+ result.skillsEmitted += skillResults.length;
121
+
122
+ if (verbose && skillResults.length > 0) {
123
+ console.log(` Skills: ${skillResults.length} emitted to ${skillsTargetDir}`);
124
+ }
125
+ }
126
+ } catch (error) {
127
+ result.errors.push(`${platform}/skills: ${error.message}`);
128
+ }
129
+ }
130
+
131
+ // 编译 Agents
132
+ if (modules.includes('agents')) {
133
+ try {
134
+ const agentsSourceDir = path.join(sourceBaseDir, 'agents');
135
+ const agentsTargetPath = getAgentsTargetPath(platform, platformConfig);
136
+
137
+ if (fs.existsSync(agentsSourceDir)) {
138
+ const agentResults = await emitter.emitAgents(agentsSourceDir, agentsTargetPath);
139
+ result.agentsEmitted += agentResults.length;
140
+
141
+ if (verbose && agentResults.length > 0) {
142
+ console.log(` Agents: ${agentResults.length} emitted to ${agentsTargetPath}`);
143
+ }
144
+ }
145
+ } catch (error) {
146
+ result.errors.push(`${platform}/agents: ${error.message}`);
147
+ }
148
+ }
149
+
150
+ // 编译 Rules
151
+ if (modules.includes('rules')) {
152
+ try {
153
+ const rulesSourceDir = path.join(sourceBaseDir, 'rules');
154
+ const rulesTargetPath = getRulesTargetPath(platform, platformConfig);
155
+
156
+ if (fs.existsSync(rulesSourceDir)) {
157
+ const ruleResults = await emitter.emitRules(rulesSourceDir, rulesTargetPath);
158
+ result.rulesEmitted += ruleResults.length;
159
+
160
+ if (verbose && ruleResults.length > 0) {
161
+ console.log(` Rules: ${ruleResults.length} emitted to ${rulesTargetPath}`);
162
+ }
163
+ }
164
+ } catch (error) {
165
+ result.errors.push(`${platform}/rules: ${error.message}`);
166
+ }
167
+ }
168
+
169
+ // 编译 Hooks (仅 Cursor 支持)
170
+ if (modules.includes('hooks') && isModuleSupported(platform, 'hooks')) {
171
+ try {
172
+ const hooksSourceDir = path.join(sourceBaseDir, 'hooks');
173
+ const hooksTargetDir = platformConfig.folder;
174
+
175
+ if (fs.existsSync(hooksSourceDir)) {
176
+ const hookResults = await emitter.emitHooks(hooksSourceDir, hooksTargetDir);
177
+ result.hooksEmitted += hookResults.length;
178
+
179
+ if (verbose && hookResults.length > 0) {
180
+ console.log(` Hooks: ${hookResults.length} emitted to ${hooksTargetDir}`);
181
+ }
182
+ }
183
+ } catch (error) {
184
+ result.errors.push(`${platform}/hooks: ${error.message}`);
185
+ }
186
+ }
187
+ }
188
+
189
+ // 保存 manifest
190
+ manifest.generatedAt = new Date().toISOString();
191
+ await saveManifest(manifest, manifestPath);
192
+
193
+ // 设置成功状态
194
+ result.success = result.errors.length === 0;
195
+
196
+ return result;
197
+ }
198
+
199
+ // ============================================================
200
+ // Helper Functions - 获取目标路径
201
+ // ============================================================
202
+
203
+ function getSkillsTargetDir(platform, config) {
204
+ const skillsConfig = config.skills;
205
+ if (!skillsConfig) {
206
+ return path.join(config.folder, 'skills');
207
+ }
208
+ return path.join(config.folder, skillsConfig.dir || 'skills');
209
+ }
210
+
211
+ function getAgentsTargetPath(platform, config) {
212
+ const agentsConfig = config.agents;
213
+ if (!agentsConfig) {
214
+ return 'AGENTS.md';
215
+ }
216
+ if (agentsConfig.outputFile) {
217
+ return agentsConfig.outputFile;
218
+ }
219
+ return path.join(config.folder, agentsConfig.dir || 'agents');
220
+ }
221
+
222
+ function getRulesTargetPath(platform, config) {
223
+ const rulesConfig = config.rules;
224
+ if (!rulesConfig) {
225
+ return path.join(config.folder, 'rules');
226
+ }
227
+ if (rulesConfig.outputFile) {
228
+ return rulesConfig.outputFile;
229
+ }
230
+ return path.join(config.folder, rulesConfig.dir || 'rules');
231
+ }
39
232
 
40
233
  // ============================================================
41
234
  // compile - 编译主函数
@@ -252,5 +445,7 @@ async function compile(options = {}) {
252
445
 
253
446
  module.exports = {
254
447
  compile,
255
- PLATFORMS
448
+ compileMultiModule,
449
+ PLATFORMS,
450
+ DEFAULT_MODULES
256
451
  };
@@ -1,50 +1,196 @@
1
1
  /**
2
- * T001: Platform Configuration Registry
2
+ * T001: Platform Configuration Registry (v2.0)
3
+ *
4
+ * [INPUT]: 无外部依赖
5
+ * [OUTPUT]: PLATFORM_CONFIG, PLATFORMS, getPlatformConfig, isValidPlatform, getRulesEntryPath
6
+ * [POS]: 编译器核心配置,定义四个目标平台的完整编译配置
7
+ * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
3
8
  *
4
9
  * 定义四个目标平台的编译配置:
5
- * - cursor: Cursor IDE (.mdc format)
6
- * - codex: Codex CLI (SKILL.md format)
7
- * - qwen: Qwen Code (.toml format)
8
- * - antigravity: Antigravity (.md with 12K limit)
10
+ * - cursor: Cursor IDE (.mdc rules, subagents, hooks)
11
+ * - codex: Codex CLI (skills/, prompts/, AGENTS.md)
12
+ * - qwen: Qwen Code (.toml commands, agents/)
13
+ * - antigravity: Antigravity (skills/, workflows/, rules/)
9
14
  *
10
- * Reference: data-model.md#PlatformConfig
15
+ * v2.0: 支持完整功能模块 (skills, commands, agents, rules, hooks)
11
16
  */
12
17
 
13
18
  // ============================================================
14
- // PLATFORM_CONFIG - 平台配置注册表
19
+ // MODULE_TYPES - 支持的模块类型
20
+ // ============================================================
21
+ const MODULE_TYPES = ['skills', 'commands', 'agents', 'rules', 'hooks'];
22
+
23
+ // ============================================================
24
+ // PLATFORM_CONFIG - 平台配置注册表 (v2.0)
15
25
  // ============================================================
16
26
  const PLATFORM_CONFIG = {
17
- cursor: {
18
- name: 'Cursor IDE',
19
- folder: '.cursor/',
27
+ // ----------------------------------------------------------
28
+ // Codex CLI
29
+ // ----------------------------------------------------------
30
+ codex: {
31
+ name: 'Codex CLI',
32
+ folder: '.codex/',
33
+
34
+ // Skills 配置
35
+ skills: {
36
+ dir: 'skills/',
37
+ file: 'SKILL.md',
38
+ frontmatter: 'yaml',
39
+ supportsScripts: true,
40
+ supportsReferences: true
41
+ },
42
+
43
+ // Commands → Prompts
44
+ commands: {
45
+ dir: 'prompts/',
46
+ ext: '.md',
47
+ frontmatter: 'yaml',
48
+ argumentPattern: '$ARGUMENTS'
49
+ },
50
+
51
+ // Agents → AGENTS.md (项目根目录合并)
52
+ agents: {
53
+ outputFile: 'AGENTS.md',
54
+ mergeMode: 'append'
55
+ },
56
+
57
+ // Rules → AGENTS.md (合并到 agents)
58
+ rules: {
59
+ outputFile: 'AGENTS.md',
60
+ mergeMode: 'append'
61
+ },
62
+
63
+ // Hooks: 不支持
64
+ hooks: {
65
+ supported: false
66
+ },
67
+
68
+ // 旧版兼容字段
20
69
  rulesEntry: {
21
- path: 'rules/devflow.mdc',
22
- format: 'mdc'
70
+ path: 'skills/cc-devflow/SKILL.md',
71
+ format: 'markdown'
23
72
  },
24
- commandsDir: 'commands/',
73
+ commandsDir: 'prompts/',
25
74
  commandExt: '.md',
26
75
  argumentPattern: '$ARGUMENTS',
27
76
  hasHooks: false,
28
77
  limits: {}
29
78
  },
30
79
 
31
- codex: {
32
- name: 'Codex CLI',
33
- folder: '.codex/',
80
+ // ----------------------------------------------------------
81
+ // Cursor IDE
82
+ // ----------------------------------------------------------
83
+ cursor: {
84
+ name: 'Cursor IDE',
85
+ folder: '.cursor/',
86
+
87
+ // Skills → Rules (.mdc)
88
+ skills: {
89
+ dir: 'rules/',
90
+ ext: '.mdc',
91
+ frontmatter: 'yaml',
92
+ supportsGlobs: true,
93
+ supportsAlwaysApply: true
94
+ },
95
+
96
+ // Commands
97
+ commands: {
98
+ dir: 'commands/',
99
+ ext: '.md',
100
+ frontmatter: null,
101
+ argumentPattern: '$ARGUMENTS'
102
+ },
103
+
104
+ // Agents → Subagents
105
+ agents: {
106
+ dir: 'subagents/',
107
+ ext: '.md',
108
+ frontmatter: 'yaml',
109
+ supportsTools: true
110
+ },
111
+
112
+ // Rules → Rules (.mdc)
113
+ rules: {
114
+ dir: 'rules/',
115
+ ext: '.mdc',
116
+ frontmatter: 'yaml'
117
+ },
118
+
119
+ // Hooks: 支持
120
+ hooks: {
121
+ supported: true,
122
+ configFile: 'hooks.json',
123
+ scriptsDir: 'hooks/',
124
+ events: ['sessionStart', 'preToolUse', 'postToolUse', 'afterFileEdit']
125
+ },
126
+
127
+ // MCP 配置
128
+ mcp: {
129
+ supported: true,
130
+ configFile: 'mcp.json'
131
+ },
132
+
133
+ // 项目级指令
134
+ projectFile: 'AGENTS.md',
135
+
136
+ // 旧版兼容字段
34
137
  rulesEntry: {
35
- path: 'skills/cc-devflow/SKILL.md',
36
- format: 'markdown'
138
+ path: 'rules/devflow.mdc',
139
+ format: 'mdc'
37
140
  },
38
- commandsDir: 'prompts/',
141
+ commandsDir: 'commands/',
39
142
  commandExt: '.md',
40
143
  argumentPattern: '$ARGUMENTS',
41
- hasHooks: false,
144
+ hasHooks: true,
42
145
  limits: {}
43
146
  },
44
147
 
148
+ // ----------------------------------------------------------
149
+ // Qwen Code
150
+ // ----------------------------------------------------------
45
151
  qwen: {
46
152
  name: 'Qwen Code',
47
153
  folder: '.qwen/',
154
+
155
+ // Skills → Commands (.toml)
156
+ skills: {
157
+ dir: 'commands/',
158
+ ext: '.toml',
159
+ frontmatter: 'toml',
160
+ supportsNesting: true
161
+ },
162
+
163
+ // Commands (.toml)
164
+ commands: {
165
+ dir: 'commands/',
166
+ ext: '.toml',
167
+ frontmatter: 'toml',
168
+ argumentPattern: '{{args}}'
169
+ },
170
+
171
+ // Agents
172
+ agents: {
173
+ dir: 'agents/',
174
+ ext: '.md',
175
+ frontmatter: 'yaml',
176
+ supportsTemplating: true
177
+ },
178
+
179
+ // Rules → CONTEXT.md
180
+ rules: {
181
+ outputFile: 'CONTEXT.md',
182
+ mergeMode: 'append'
183
+ },
184
+
185
+ // Hooks: 不支持
186
+ hooks: {
187
+ supported: false
188
+ },
189
+
190
+ // 配置文件
191
+ configFile: 'settings.json',
192
+
193
+ // 旧版兼容字段
48
194
  rulesEntry: {
49
195
  path: 'commands/devflow.toml',
50
196
  format: 'toml'
@@ -56,9 +202,51 @@ const PLATFORM_CONFIG = {
56
202
  limits: {}
57
203
  },
58
204
 
205
+ // ----------------------------------------------------------
206
+ // Antigravity
207
+ // ----------------------------------------------------------
59
208
  antigravity: {
60
209
  name: 'Antigravity',
61
210
  folder: '.agent/',
211
+
212
+ // Skills
213
+ skills: {
214
+ dir: 'skills/',
215
+ file: 'SKILL.md',
216
+ frontmatter: 'yaml',
217
+ supportsScripts: true,
218
+ supportsReferences: true,
219
+ supportsMetadata: true
220
+ },
221
+
222
+ // Commands → Workflows
223
+ commands: {
224
+ dir: 'workflows/',
225
+ ext: '.md',
226
+ frontmatter: 'yaml',
227
+ argumentPattern: '$ARGUMENTS',
228
+ supportsTurbo: true
229
+ },
230
+
231
+ // Agents → AGENTS.md
232
+ agents: {
233
+ outputFile: 'AGENTS.md',
234
+ mergeMode: 'append'
235
+ },
236
+
237
+ // Rules
238
+ rules: {
239
+ dir: 'rules/',
240
+ ext: '.md',
241
+ frontmatter: null
242
+ },
243
+
244
+ // Hooks: 不支持
245
+ hooks: {
246
+ supported: false
247
+ },
248
+
249
+ // 旧版兼容字段
62
250
  rulesEntry: {
63
251
  path: 'rules/rules.md',
64
252
  format: 'markdown'
@@ -104,10 +292,71 @@ function getRulesEntryPath(platform) {
104
292
  return `${config.folder}${config.rulesEntry.path}`;
105
293
  }
106
294
 
295
+ // ============================================================
296
+ // getModuleConfig - 获取特定模块的配置
297
+ // ============================================================
298
+ function getModuleConfig(platform, moduleType) {
299
+ const config = getPlatformConfig(platform);
300
+ const moduleConfig = config[moduleType];
301
+
302
+ if (!moduleConfig) {
303
+ return null;
304
+ }
305
+
306
+ return moduleConfig;
307
+ }
308
+
309
+ // ============================================================
310
+ // isModuleSupported - 检查平台是否支持特定模块
311
+ // ============================================================
312
+ function isModuleSupported(platform, moduleType) {
313
+ const moduleConfig = getModuleConfig(platform, moduleType);
314
+
315
+ if (!moduleConfig) {
316
+ return false;
317
+ }
318
+
319
+ // hooks 模块需要检查 supported 字段
320
+ if (moduleType === 'hooks') {
321
+ return moduleConfig.supported === true;
322
+ }
323
+
324
+ return true;
325
+ }
326
+
327
+ // ============================================================
328
+ // getOutputPath - 获取模块输出路径
329
+ // ============================================================
330
+ function getOutputPath(platform, moduleType, filename = '') {
331
+ const config = getPlatformConfig(platform);
332
+ const moduleConfig = config[moduleType];
333
+
334
+ if (!moduleConfig) {
335
+ return null;
336
+ }
337
+
338
+ // 合并模式 (AGENTS.md, CONTEXT.md)
339
+ if (moduleConfig.outputFile) {
340
+ return moduleConfig.outputFile;
341
+ }
342
+
343
+ // 目录模式
344
+ if (moduleConfig.dir) {
345
+ const ext = moduleConfig.ext || '';
346
+ return `${config.folder}${moduleConfig.dir}${filename}${ext}`;
347
+ }
348
+
349
+ return null;
350
+ }
351
+
107
352
  module.exports = {
108
353
  PLATFORM_CONFIG,
109
354
  PLATFORMS,
355
+ MODULE_TYPES,
110
356
  getPlatformConfig,
111
357
  isValidPlatform,
112
- getRulesEntryPath
358
+ getRulesEntryPath,
359
+ getModuleConfig,
360
+ isModuleSupported,
361
+ getOutputPath
113
362
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-devflow",
3
- "version": "2.5.0",
3
+ "version": "4.1.1",
4
4
  "description": "DevFlow CLI tool",
5
5
  "main": "bin/cc-devflow.js",
6
6
  "bin": {
@@ -47,4 +47,4 @@
47
47
  "engines": {
48
48
  "node": ">=18"
49
49
  }
50
- }
50
+ }