@skj1724/oh-my-opencode 3.18.27 → 3.18.28

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 (132) hide show
  1. package/README.ja.md +16 -16
  2. package/README.ko.md +16 -16
  3. package/README.md +19 -19
  4. package/README.ru.md +8 -8
  5. package/README.zh-cn.md +16 -16
  6. package/bin/oh-my-opencode.js +4 -2
  7. package/bin/platform.js +2 -2
  8. package/bin/platform.test.ts +25 -0
  9. package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-16.d.ts +1 -0
  10. package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-17.d.ts +1 -0
  11. package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-18.d.ts +1 -0
  12. package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-19.d.ts +1 -0
  13. package/dist/__tests__/perf/fixtures/in-tree/packages/pkg-one/src/file-20.d.ts +1 -0
  14. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-01.d.ts +1 -0
  15. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-02.d.ts +1 -0
  16. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-03.d.ts +1 -0
  17. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-04.d.ts +1 -0
  18. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-05.d.ts +1 -0
  19. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-06.d.ts +1 -0
  20. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-07.d.ts +1 -0
  21. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-08.d.ts +1 -0
  22. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-09.d.ts +1 -0
  23. package/dist/__tests__/perf/fixtures/in-tree/src/app/file-10.d.ts +1 -0
  24. package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-11.d.ts +1 -0
  25. package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-12.d.ts +1 -0
  26. package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-13.d.ts +1 -0
  27. package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-14.d.ts +1 -0
  28. package/dist/__tests__/perf/fixtures/in-tree/src/lib/file-15.d.ts +1 -0
  29. package/dist/agents/atlas/agent.d.ts +2 -3
  30. package/dist/agents/atlas/default-prompt-sections.d.ts +6 -6
  31. package/dist/agents/atlas/gemini-prompt-sections.d.ts +6 -6
  32. package/dist/agents/atlas/gpt-prompt-sections.d.ts +6 -6
  33. package/dist/agents/atlas/prompt-section-builder.d.ts +3 -3
  34. package/dist/agents/builtin-agents/atlas-agent.d.ts +0 -2
  35. package/dist/agents/builtin-agents/environment-context.d.ts +0 -1
  36. package/dist/agents/builtin-agents/general-agents.d.ts +0 -1
  37. package/dist/agents/builtin-agents/hephaestus-agent.d.ts +0 -1
  38. package/dist/agents/builtin-agents/sisyphus-agent.d.ts +0 -1
  39. package/dist/agents/builtin-agents.d.ts +1 -1
  40. package/dist/agents/dynamic-agent-category-skills-guide.d.ts +1 -1
  41. package/dist/agents/dynamic-agent-core-sections.d.ts +14 -9
  42. package/dist/agents/dynamic-agent-policy-sections.d.ts +5 -5
  43. package/dist/agents/dynamic-agent-tool-categorization.d.ts +1 -1
  44. package/dist/agents/env-context.d.ts +7 -1
  45. package/dist/agents/hephaestus/agent.d.ts +2 -2
  46. package/dist/agents/hephaestus/gpt-5-3-codex.d.ts +9 -9
  47. package/dist/agents/hephaestus/gpt-5-4.d.ts +18 -18
  48. package/dist/agents/hephaestus/gpt-5-5.d.ts +13 -0
  49. package/dist/agents/hephaestus/gpt.d.ts +1 -1
  50. package/dist/agents/metis.d.ts +9 -9
  51. package/dist/agents/momus.d.ts +10 -11
  52. package/dist/agents/prometheus/behavioral-summary.d.ts +3 -3
  53. package/dist/agents/prometheus/gemini.d.ts +7 -7
  54. package/dist/agents/prometheus/gpt.d.ts +6 -6
  55. package/dist/agents/prometheus/high-accuracy-mode.d.ts +3 -3
  56. package/dist/agents/prometheus/identity-constraints.d.ts +3 -4
  57. package/dist/agents/prometheus/interview-mode.d.ts +3 -3
  58. package/dist/agents/prometheus/plan-generation.d.ts +4 -4
  59. package/dist/agents/prometheus/plan-template.d.ts +4 -4
  60. package/dist/agents/prometheus/system-prompt.d.ts +11 -11
  61. package/dist/agents/sisyphus/default.d.ts +3 -3
  62. package/dist/agents/sisyphus/gemini.d.ts +10 -10
  63. package/dist/agents/sisyphus/gpt-5-4.d.ts +18 -18
  64. package/dist/agents/sisyphus/gpt-5-5.d.ts +18 -0
  65. package/dist/agents/sisyphus/index.d.ts +1 -0
  66. package/dist/agents/sisyphus-junior/agent.d.ts +2 -2
  67. package/dist/agents/sisyphus-junior/default.d.ts +5 -5
  68. package/dist/agents/sisyphus-junior/gemini.d.ts +6 -6
  69. package/dist/agents/sisyphus-junior/gpt-5-3-codex.d.ts +4 -4
  70. package/dist/agents/sisyphus-junior/gpt-5-4.d.ts +7 -7
  71. package/dist/agents/sisyphus-junior/gpt-5-5.d.ts +12 -0
  72. package/dist/agents/sisyphus-junior/gpt.d.ts +5 -5
  73. package/dist/agents/sisyphus-junior/index.d.ts +1 -0
  74. package/dist/agents/sisyphus.d.ts +2 -3
  75. package/dist/agents/types.d.ts +2 -1
  76. package/dist/cli/index.js +2360 -3399
  77. package/dist/config/schema/agent-overrides.d.ts +0 -15
  78. package/dist/config/schema/commands.d.ts +0 -2
  79. package/dist/config/schema/oh-my-opencode-config.d.ts +0 -19
  80. package/dist/features/background-agent/concurrency.d.ts +1 -1
  81. package/dist/features/builtin-commands/templates/init-deep.d.ts +1 -1
  82. package/dist/features/builtin-commands/templates/ralph-loop.d.ts +3 -3
  83. package/dist/features/builtin-commands/templates/refactor.d.ts +1 -1
  84. package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
  85. package/dist/features/builtin-commands/types.d.ts +1 -2
  86. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -1
  87. package/dist/hooks/atlas/system-reminder-templates.d.ts +6 -6
  88. package/dist/hooks/auto-update-checker/constants.d.ts +1 -1
  89. package/dist/hooks/compaction-context-injector/compaction-context-prompt.d.ts +1 -1
  90. package/dist/hooks/keyword-detector/analyze/default.d.ts +8 -8
  91. package/dist/hooks/keyword-detector/search/default.d.ts +8 -8
  92. package/dist/hooks/keyword-detector/ultrawork/default.d.ts +6 -6
  93. package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +12 -12
  94. package/dist/hooks/keyword-detector/ultrawork/gpt.d.ts +7 -7
  95. package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +3 -3
  96. package/dist/hooks/prometheus-md-only/constants.d.ts +2 -2
  97. package/dist/hooks/todo-continuation-enforcer/constants.d.ts +1 -1
  98. package/dist/hooks/tool-output-truncator.d.ts +0 -6
  99. package/dist/index.js +9793 -10923
  100. package/dist/oh-my-opencode.schema.json +3 -57
  101. package/dist/plugin-handlers/prometheus-agent-config-builder.d.ts +1 -5
  102. package/dist/shared/logger.d.ts +0 -1
  103. package/dist/shared/model-capabilities/supplemental-entries.d.ts +2 -0
  104. package/dist/shared/plugin-identity.d.ts +4 -4
  105. package/dist/shared/system-directive.d.ts +1 -2
  106. package/dist/tools/ast-grep/pattern-hints.d.ts +4 -0
  107. package/dist/tools/ast-grep/tool-descriptions.d.ts +3 -0
  108. package/dist/tools/call-omo-agent/constants.d.ts +1 -1
  109. package/dist/tools/delegate-task/prompt-builder.d.ts +2 -2
  110. package/dist/tools/index.d.ts +1 -1
  111. package/dist/tools/interactive-bash/index.d.ts +2 -2
  112. package/dist/tools/interactive-bash/tools.d.ts +0 -1
  113. package/package.json +104 -99
  114. package/postinstall.mjs +133 -35
  115. package/dist/agents/load-prompt-template.d.ts +0 -1
  116. package/dist/agents/prompts-zh/index.d.ts +0 -16
  117. package/dist/agents/types/language.d.ts +0 -3
  118. package/dist/config/schema/i18n.d.ts +0 -21
  119. package/dist/features/builtin-commands/templates/open-plan.d.ts +0 -1
  120. package/src/agents/prompts-zh/atlas.md +0 -657
  121. package/src/agents/prompts-zh/explore.md +0 -85
  122. package/src/agents/prompts-zh/general-agents.md +0 -401
  123. package/src/agents/prompts-zh/hephaestus.md +0 -391
  124. package/src/agents/prompts-zh/index.ts +0 -17
  125. package/src/agents/prompts-zh/librarian.md +0 -282
  126. package/src/agents/prompts-zh/metis.md +0 -284
  127. package/src/agents/prompts-zh/momus.md +0 -181
  128. package/src/agents/prompts-zh/multimodal-looker.md +0 -40
  129. package/src/agents/prompts-zh/oracle.md +0 -206
  130. package/src/agents/prompts-zh/prometheus.md +0 -1327
  131. package/src/agents/prompts-zh/sisyphus-junior.md +0 -29
  132. package/src/agents/prompts-zh/sisyphus.md +0 -387
@@ -51,7 +51,6 @@ export declare const AgentOverrideConfigSchema: z.ZodObject<{
51
51
  top_p: z.ZodOptional<z.ZodNumber>;
52
52
  prompt: z.ZodOptional<z.ZodString>;
53
53
  prompt_append: z.ZodOptional<z.ZodString>;
54
- language: z.ZodOptional<z.ZodString>;
55
54
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
56
55
  disable: z.ZodOptional<z.ZodBoolean>;
57
56
  description: z.ZodOptional<z.ZodString>;
@@ -181,7 +180,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
181
180
  top_p: z.ZodOptional<z.ZodNumber>;
182
181
  prompt: z.ZodOptional<z.ZodString>;
183
182
  prompt_append: z.ZodOptional<z.ZodString>;
184
- language: z.ZodOptional<z.ZodString>;
185
183
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
186
184
  disable: z.ZodOptional<z.ZodBoolean>;
187
185
  description: z.ZodOptional<z.ZodString>;
@@ -310,7 +308,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
310
308
  top_p: z.ZodOptional<z.ZodNumber>;
311
309
  prompt: z.ZodOptional<z.ZodString>;
312
310
  prompt_append: z.ZodOptional<z.ZodString>;
313
- language: z.ZodOptional<z.ZodString>;
314
311
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
315
312
  disable: z.ZodOptional<z.ZodBoolean>;
316
313
  description: z.ZodOptional<z.ZodString>;
@@ -439,7 +436,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
439
436
  top_p: z.ZodOptional<z.ZodNumber>;
440
437
  prompt: z.ZodOptional<z.ZodString>;
441
438
  prompt_append: z.ZodOptional<z.ZodString>;
442
- language: z.ZodOptional<z.ZodString>;
443
439
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
444
440
  disable: z.ZodOptional<z.ZodBoolean>;
445
441
  description: z.ZodOptional<z.ZodString>;
@@ -568,7 +564,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
568
564
  top_p: z.ZodOptional<z.ZodNumber>;
569
565
  prompt: z.ZodOptional<z.ZodString>;
570
566
  prompt_append: z.ZodOptional<z.ZodString>;
571
- language: z.ZodOptional<z.ZodString>;
572
567
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
573
568
  disable: z.ZodOptional<z.ZodBoolean>;
574
569
  description: z.ZodOptional<z.ZodString>;
@@ -698,7 +693,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
698
693
  top_p: z.ZodOptional<z.ZodNumber>;
699
694
  prompt: z.ZodOptional<z.ZodString>;
700
695
  prompt_append: z.ZodOptional<z.ZodString>;
701
- language: z.ZodOptional<z.ZodString>;
702
696
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
703
697
  disable: z.ZodOptional<z.ZodBoolean>;
704
698
  description: z.ZodOptional<z.ZodString>;
@@ -827,7 +821,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
827
821
  top_p: z.ZodOptional<z.ZodNumber>;
828
822
  prompt: z.ZodOptional<z.ZodString>;
829
823
  prompt_append: z.ZodOptional<z.ZodString>;
830
- language: z.ZodOptional<z.ZodString>;
831
824
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
832
825
  disable: z.ZodOptional<z.ZodBoolean>;
833
826
  description: z.ZodOptional<z.ZodString>;
@@ -956,7 +949,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
956
949
  top_p: z.ZodOptional<z.ZodNumber>;
957
950
  prompt: z.ZodOptional<z.ZodString>;
958
951
  prompt_append: z.ZodOptional<z.ZodString>;
959
- language: z.ZodOptional<z.ZodString>;
960
952
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
961
953
  disable: z.ZodOptional<z.ZodBoolean>;
962
954
  description: z.ZodOptional<z.ZodString>;
@@ -1085,7 +1077,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1085
1077
  top_p: z.ZodOptional<z.ZodNumber>;
1086
1078
  prompt: z.ZodOptional<z.ZodString>;
1087
1079
  prompt_append: z.ZodOptional<z.ZodString>;
1088
- language: z.ZodOptional<z.ZodString>;
1089
1080
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1090
1081
  disable: z.ZodOptional<z.ZodBoolean>;
1091
1082
  description: z.ZodOptional<z.ZodString>;
@@ -1214,7 +1205,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1214
1205
  top_p: z.ZodOptional<z.ZodNumber>;
1215
1206
  prompt: z.ZodOptional<z.ZodString>;
1216
1207
  prompt_append: z.ZodOptional<z.ZodString>;
1217
- language: z.ZodOptional<z.ZodString>;
1218
1208
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1219
1209
  disable: z.ZodOptional<z.ZodBoolean>;
1220
1210
  description: z.ZodOptional<z.ZodString>;
@@ -1343,7 +1333,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1343
1333
  top_p: z.ZodOptional<z.ZodNumber>;
1344
1334
  prompt: z.ZodOptional<z.ZodString>;
1345
1335
  prompt_append: z.ZodOptional<z.ZodString>;
1346
- language: z.ZodOptional<z.ZodString>;
1347
1336
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1348
1337
  disable: z.ZodOptional<z.ZodBoolean>;
1349
1338
  description: z.ZodOptional<z.ZodString>;
@@ -1472,7 +1461,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1472
1461
  top_p: z.ZodOptional<z.ZodNumber>;
1473
1462
  prompt: z.ZodOptional<z.ZodString>;
1474
1463
  prompt_append: z.ZodOptional<z.ZodString>;
1475
- language: z.ZodOptional<z.ZodString>;
1476
1464
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1477
1465
  disable: z.ZodOptional<z.ZodBoolean>;
1478
1466
  description: z.ZodOptional<z.ZodString>;
@@ -1601,7 +1589,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1601
1589
  top_p: z.ZodOptional<z.ZodNumber>;
1602
1590
  prompt: z.ZodOptional<z.ZodString>;
1603
1591
  prompt_append: z.ZodOptional<z.ZodString>;
1604
- language: z.ZodOptional<z.ZodString>;
1605
1592
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1606
1593
  disable: z.ZodOptional<z.ZodBoolean>;
1607
1594
  description: z.ZodOptional<z.ZodString>;
@@ -1730,7 +1717,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1730
1717
  top_p: z.ZodOptional<z.ZodNumber>;
1731
1718
  prompt: z.ZodOptional<z.ZodString>;
1732
1719
  prompt_append: z.ZodOptional<z.ZodString>;
1733
- language: z.ZodOptional<z.ZodString>;
1734
1720
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1735
1721
  disable: z.ZodOptional<z.ZodBoolean>;
1736
1722
  description: z.ZodOptional<z.ZodString>;
@@ -1859,7 +1845,6 @@ export declare const AgentOverridesSchema: z.ZodObject<{
1859
1845
  top_p: z.ZodOptional<z.ZodNumber>;
1860
1846
  prompt: z.ZodOptional<z.ZodString>;
1861
1847
  prompt_append: z.ZodOptional<z.ZodString>;
1862
- language: z.ZodOptional<z.ZodString>;
1863
1848
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1864
1849
  disable: z.ZodOptional<z.ZodBoolean>;
1865
1850
  description: z.ZodOptional<z.ZodString>;
@@ -7,8 +7,6 @@ export declare const BuiltinCommandNameSchema: z.ZodEnum<{
7
7
  refactor: "refactor";
8
8
  "start-work": "start-work";
9
9
  "stop-continuation": "stop-continuation";
10
- handoff: "handoff";
11
10
  "remove-ai-slops": "remove-ai-slops";
12
- "open-plan": "open-plan";
13
11
  }>;
14
12
  export type BuiltinCommandName = z.infer<typeof BuiltinCommandNameSchema>;
@@ -24,9 +24,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
24
24
  refactor: "refactor";
25
25
  "start-work": "start-work";
26
26
  "stop-continuation": "stop-continuation";
27
- handoff: "handoff";
28
27
  "remove-ai-slops": "remove-ai-slops";
29
- "open-plan": "open-plan";
30
28
  }>>>;
31
29
  disabled_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
30
  mcp_env_allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -85,7 +83,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
85
83
  top_p: z.ZodOptional<z.ZodNumber>;
86
84
  prompt: z.ZodOptional<z.ZodString>;
87
85
  prompt_append: z.ZodOptional<z.ZodString>;
88
- language: z.ZodOptional<z.ZodString>;
89
86
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
90
87
  disable: z.ZodOptional<z.ZodBoolean>;
91
88
  description: z.ZodOptional<z.ZodString>;
@@ -214,7 +211,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
214
211
  top_p: z.ZodOptional<z.ZodNumber>;
215
212
  prompt: z.ZodOptional<z.ZodString>;
216
213
  prompt_append: z.ZodOptional<z.ZodString>;
217
- language: z.ZodOptional<z.ZodString>;
218
214
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
219
215
  disable: z.ZodOptional<z.ZodBoolean>;
220
216
  description: z.ZodOptional<z.ZodString>;
@@ -343,7 +339,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
343
339
  top_p: z.ZodOptional<z.ZodNumber>;
344
340
  prompt: z.ZodOptional<z.ZodString>;
345
341
  prompt_append: z.ZodOptional<z.ZodString>;
346
- language: z.ZodOptional<z.ZodString>;
347
342
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
348
343
  disable: z.ZodOptional<z.ZodBoolean>;
349
344
  description: z.ZodOptional<z.ZodString>;
@@ -472,7 +467,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
472
467
  top_p: z.ZodOptional<z.ZodNumber>;
473
468
  prompt: z.ZodOptional<z.ZodString>;
474
469
  prompt_append: z.ZodOptional<z.ZodString>;
475
- language: z.ZodOptional<z.ZodString>;
476
470
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
477
471
  disable: z.ZodOptional<z.ZodBoolean>;
478
472
  description: z.ZodOptional<z.ZodString>;
@@ -602,7 +596,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
602
596
  top_p: z.ZodOptional<z.ZodNumber>;
603
597
  prompt: z.ZodOptional<z.ZodString>;
604
598
  prompt_append: z.ZodOptional<z.ZodString>;
605
- language: z.ZodOptional<z.ZodString>;
606
599
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
607
600
  disable: z.ZodOptional<z.ZodBoolean>;
608
601
  description: z.ZodOptional<z.ZodString>;
@@ -731,7 +724,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
731
724
  top_p: z.ZodOptional<z.ZodNumber>;
732
725
  prompt: z.ZodOptional<z.ZodString>;
733
726
  prompt_append: z.ZodOptional<z.ZodString>;
734
- language: z.ZodOptional<z.ZodString>;
735
727
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
736
728
  disable: z.ZodOptional<z.ZodBoolean>;
737
729
  description: z.ZodOptional<z.ZodString>;
@@ -860,7 +852,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
860
852
  top_p: z.ZodOptional<z.ZodNumber>;
861
853
  prompt: z.ZodOptional<z.ZodString>;
862
854
  prompt_append: z.ZodOptional<z.ZodString>;
863
- language: z.ZodOptional<z.ZodString>;
864
855
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
865
856
  disable: z.ZodOptional<z.ZodBoolean>;
866
857
  description: z.ZodOptional<z.ZodString>;
@@ -989,7 +980,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
989
980
  top_p: z.ZodOptional<z.ZodNumber>;
990
981
  prompt: z.ZodOptional<z.ZodString>;
991
982
  prompt_append: z.ZodOptional<z.ZodString>;
992
- language: z.ZodOptional<z.ZodString>;
993
983
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
994
984
  disable: z.ZodOptional<z.ZodBoolean>;
995
985
  description: z.ZodOptional<z.ZodString>;
@@ -1118,7 +1108,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1118
1108
  top_p: z.ZodOptional<z.ZodNumber>;
1119
1109
  prompt: z.ZodOptional<z.ZodString>;
1120
1110
  prompt_append: z.ZodOptional<z.ZodString>;
1121
- language: z.ZodOptional<z.ZodString>;
1122
1111
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1123
1112
  disable: z.ZodOptional<z.ZodBoolean>;
1124
1113
  description: z.ZodOptional<z.ZodString>;
@@ -1247,7 +1236,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1247
1236
  top_p: z.ZodOptional<z.ZodNumber>;
1248
1237
  prompt: z.ZodOptional<z.ZodString>;
1249
1238
  prompt_append: z.ZodOptional<z.ZodString>;
1250
- language: z.ZodOptional<z.ZodString>;
1251
1239
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1252
1240
  disable: z.ZodOptional<z.ZodBoolean>;
1253
1241
  description: z.ZodOptional<z.ZodString>;
@@ -1376,7 +1364,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1376
1364
  top_p: z.ZodOptional<z.ZodNumber>;
1377
1365
  prompt: z.ZodOptional<z.ZodString>;
1378
1366
  prompt_append: z.ZodOptional<z.ZodString>;
1379
- language: z.ZodOptional<z.ZodString>;
1380
1367
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1381
1368
  disable: z.ZodOptional<z.ZodBoolean>;
1382
1369
  description: z.ZodOptional<z.ZodString>;
@@ -1505,7 +1492,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1505
1492
  top_p: z.ZodOptional<z.ZodNumber>;
1506
1493
  prompt: z.ZodOptional<z.ZodString>;
1507
1494
  prompt_append: z.ZodOptional<z.ZodString>;
1508
- language: z.ZodOptional<z.ZodString>;
1509
1495
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1510
1496
  disable: z.ZodOptional<z.ZodBoolean>;
1511
1497
  description: z.ZodOptional<z.ZodString>;
@@ -1634,7 +1620,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1634
1620
  top_p: z.ZodOptional<z.ZodNumber>;
1635
1621
  prompt: z.ZodOptional<z.ZodString>;
1636
1622
  prompt_append: z.ZodOptional<z.ZodString>;
1637
- language: z.ZodOptional<z.ZodString>;
1638
1623
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1639
1624
  disable: z.ZodOptional<z.ZodBoolean>;
1640
1625
  description: z.ZodOptional<z.ZodString>;
@@ -1763,7 +1748,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1763
1748
  top_p: z.ZodOptional<z.ZodNumber>;
1764
1749
  prompt: z.ZodOptional<z.ZodString>;
1765
1750
  prompt_append: z.ZodOptional<z.ZodString>;
1766
- language: z.ZodOptional<z.ZodString>;
1767
1751
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
1768
1752
  disable: z.ZodOptional<z.ZodBoolean>;
1769
1753
  description: z.ZodOptional<z.ZodString>;
@@ -2122,9 +2106,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
2122
2106
  start_work: z.ZodOptional<z.ZodObject<{
2123
2107
  auto_commit: z.ZodDefault<z.ZodBoolean>;
2124
2108
  }, z.core.$strip>>;
2125
- i18n: z.ZodOptional<z.ZodObject<{
2126
- language: z.ZodOptional<z.ZodString>;
2127
- }, z.core.$strip>>;
2128
2109
  _migrations: z.ZodOptional<z.ZodArray<z.ZodString>>;
2129
2110
  }, z.core.$strip>;
2130
2111
  export type OhMyOpenCodeConfig = z.infer<typeof OhMyOpenCodeConfigSchema>;
@@ -5,7 +5,7 @@ export declare class ConcurrencyManager {
5
5
  private queues;
6
6
  constructor(config?: BackgroundTaskConfig);
7
7
  getConcurrencyLimit(model: string): number;
8
- acquire(model: string, timeoutMs?: number): Promise<void>;
8
+ acquire(model: string): Promise<void>;
9
9
  release(model: string): void;
10
10
  /**
11
11
  * Cancel all waiting acquires for a model. Used during cleanup.
@@ -1 +1 @@
1
- export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\nGenerate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.\n\n## Usage\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## Workflow (High-Level)\n\n1. **Discovery + Analysis** (concurrent)\n - Fire background explore agents immediately\n - Main session: bash structure + LSP codemap + read existing AGENTS.md\n2. **Score & Decide** - Determine AGENTS.md locations from merged findings\n3. **Generate** - Root first, then subdirs in parallel\n4. **Review** - Deduplicate, trim, validate\n\n<critical>\n**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## Phase 1: Discovery + Analysis (Concurrent)\n\n**Mark \"discovery\" as in_progress.**\n\n### Fire Background Explore Agents IMMEDIATELY\n\nDon't wait-these run async while main session works.\n\n```\n// Fire all at once, collect results later\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore project structure\", run_in_background=true, prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find entry points\", run_in_background=true, prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find conventions\", run_in_background=true, prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find anti-patterns\", run_in_background=true, prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore build/CI\", run_in_background=true, prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find test patterns\", run_in_background=true, prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**DYNAMIC AGENT SPAWNING**: After bash analysis, spawn ADDITIONAL explore agents based on project scale:\n\n| Factor | Threshold | Additional Agents |\n|--------|-----------|-------------------|\n| **Total files** | >100 | +1 per 100 files |\n| **Total lines** | >10k | +1 per 10k lines |\n| **Directory depth** | \u22654 | +2 for deep exploration |\n| **Large files (>500 lines)** | >10 files | +1 for complexity hotspots |\n| **Monorepo** | detected | +1 per package/workspace |\n| **Multiple languages** | >1 | +1 per language |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\ntask(subagent_type=\"explore\", load_skills=[], description=\"Analyze large files\", run_in_background=true, prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore deep modules\", run_in_background=true, prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find shared utilities\", run_in_background=true, prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### Main Session: Concurrent Analysis\n\n**While background agents run**, main session does:\n\n#### 1. Bash Structural Analysis\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. Read Existing AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\nIf `--create-new`: Read all existing first (preserve context) \u2192 then delete all \u2192 regenerate.\n\n#### 3. LSP Codemap (if available)\n```\nLspServers() # Check availability\n\n# Entry points (parallel)\nLspDocumentSymbols(filePath=\"src/index.ts\")\nLspDocumentSymbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nLspWorkspaceSymbols(filePath=\".\", query=\"class\")\nLspWorkspaceSymbols(filePath=\".\", query=\"interface\")\nLspWorkspaceSymbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nLspFindReferences(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP Fallback**: If unavailable, rely on explore agents + AST-grep.\n\n### Collect Background Results\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**Merge: bash + LSP + existing + explore findings. Mark \"discovery\" as completed.**\n\n---\n\n## Phase 2: Scoring & Location Decision\n\n**Mark \"scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | High Threshold | Source |\n|--------|--------|----------------|--------|\n| File count | 3x | >20 | bash |\n| Subdir count | 2x | >5 | bash |\n| Code ratio | 2x | >70% | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has index.ts/__init__.py | bash |\n| Symbol density | 2x | >30 symbols | LSP |\n| Export count | 2x | >10 exports | LSP |\n| Reference centrality | 3x | >20 refs | LSP |\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create |\n| **>15** | Create AGENTS.md |\n| **8-15** | Create if distinct domain |\n| **<8** | Skip (parent covers) |\n\n### Output\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**Mark \"scoring\" as completed.**\n\n---\n\n## Phase 3: Generate AGENTS.md\n\n**Mark \"generate\" as in_progress.**\n\n<critical>\n**File Writing Rule**: If AGENTS.md already exists at the target path \u2192 use `Edit` tool. If it does NOT exist \u2192 use `Write` tool.\nNEVER use Write to overwrite an existing file. ALWAYS check existence first via `Read` or discovery results.\n</critical>\n\n### Root AGENTS.md (Full Treatment)\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch writing tasks for each location:\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n task(category=\"writing\", load_skills=[], run_in_background=false, description=\"Generate AGENTS.md\", prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review & Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n [OK] ./AGENTS.md (root, {N} lines)\n [OK] ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die";
1
+ export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\n\u751F\u6210\u5206\u5C42 AGENTS.md \u6587\u4EF6\u3002\u6839\u76EE\u5F55 + \u590D\u6742\u5EA6\u8BC4\u5206\u5B50\u76EE\u5F55\u3002\n\n## \u4F7F\u7528\u65B9\u6CD5\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## \u5DE5\u4F5C\u6D41\u7A0B\uFF08\u9AD8\u7EA7\uFF09\n\n1. **\u53D1\u73B0 + \u5206\u6790**\uFF08\u5E76\u53D1\uFF09\n - \u7ACB\u5373\u89E6\u53D1\u540E\u53F0\u63A2\u7D22\u4EE3\u7406\n - \u4E3B\u4F1A\u8BDD\uFF1Abash \u7ED3\u6784 + LSP \u4EE3\u7801\u6620\u5C04 + \u8BFB\u53D6\u73B0\u6709 AGENTS.md\n2. **\u8BC4\u5206\u4E0E\u51B3\u7B56** - \u6839\u636E\u5408\u5E76\u7ED3\u679C\u786E\u5B9A AGENTS.md \u4F4D\u7F6E\n3. **\u751F\u6210** - \u5148\u6839\u76EE\u5F55\uFF0C\u7136\u540E\u5E76\u884C\u5B50\u76EE\u5F55\n4. **\u5BA1\u67E5** - \u53BB\u91CD\u3001\u7CBE\u7B80\u3001\u9A8C\u8BC1\n\n<critical>\n**\u7528 TodoWrite \u8BB0\u5F55\u6240\u6709\u9636\u6BB5\u3002\u5B9E\u65F6\u6807\u8BB0 in_progress \u2192 completed\u3002**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## \u9636\u6BB5 1\uFF1A\u53D1\u73B0 + \u5206\u6790\uFF08\u5E76\u53D1\uFF09\n\n**\u5C06 \"discovery\" \u6807\u8BB0\u4E3A in_progress\u3002**\n\n### \u7ACB\u5373\u89E6\u53D1\u540E\u53F0\u63A2\u7D22\u4EE3\u7406\n\n\u4E0D\u8981\u7B49\u5F85\u2014\u2014\u8FD9\u4E9B\u4EE3\u7406\u5728\u4E3B\u4F1A\u8BDD\u5DE5\u4F5C\u65F6\u5F02\u6B65\u8FD0\u884C\u3002\n\n```\n// Fire all at once, collect results later\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore project structure\", run_in_background=true, prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find entry points\", run_in_background=true, prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find conventions\", run_in_background=true, prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find anti-patterns\", run_in_background=true, prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore build/CI\", run_in_background=true, prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find test patterns\", run_in_background=true, prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**\u52A8\u6001\u4EE3\u7406\u751F\u6210**\uFF1A\u5728 bash \u5206\u6790\u4E4B\u540E\uFF0C\u6839\u636E\u9879\u76EE\u89C4\u6A21\u751F\u6210\u989D\u5916\u7684\u63A2\u7D22\u4EE3\u7406\uFF1A\n\n| \u56E0\u7D20 | \u9608\u503C | \u989D\u5916\u4EE3\u7406\u6570 |\n|--------|-----------|-------------------|\n| **\u603B\u6587\u4EF6\u6570** | >100 | \u6BCF 100 \u4E2A\u6587\u4EF6 +1 |\n| **\u603B\u884C\u6570** | >10k | \u6BCF 10k \u884C +1 |\n| **\u76EE\u5F55\u6DF1\u5EA6** | \u22654 | \u6DF1\u5EA6\u63A2\u7D22 +2 |\n| **\u5927\u6587\u4EF6\uFF08>500 \u884C\uFF09** | >10 \u4E2A\u6587\u4EF6 | \u590D\u6742\u5EA6\u70ED\u70B9 +1 |\n| **Monorepo** | \u68C0\u6D4B\u5230 | \u6BCF\u4E2A\u5305/\u5DE5\u4F5C\u7A7A\u95F4 +1 |\n| **\u591A\u8BED\u8A00** | >1 | \u6BCF\u79CD\u8BED\u8A00 +1 |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\ntask(subagent_type=\"explore\", load_skills=[], description=\"Analyze large files\", run_in_background=true, prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Explore deep modules\", run_in_background=true, prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\ntask(subagent_type=\"explore\", load_skills=[], description=\"Find shared utilities\", run_in_background=true, prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### \u4E3B\u4F1A\u8BDD\uFF1A\u5E76\u53D1\u5206\u6790\n\n**\u5728\u540E\u53F0\u4EE3\u7406\u8FD0\u884C\u65F6**\uFF0C\u4E3B\u4F1A\u8BDD\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C\uFF1A\n\n#### 1. Bash \u7ED3\u6784\u5206\u6790\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. \u8BFB\u53D6\u73B0\u6709 AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\n\u5982\u679C\u4F7F\u7528 `--create-new`\uFF1A\u5148\u8BFB\u53D6\u6240\u6709\u73B0\u6709\u6587\u4EF6\uFF08\u4FDD\u7559\u4E0A\u4E0B\u6587\uFF09\u2192 \u7136\u540E\u5220\u9664\u6240\u6709 \u2192 \u91CD\u65B0\u751F\u6210\u3002\n\n#### 3. LSP \u4EE3\u7801\u6620\u5C04\uFF08\u5982\u53EF\u7528\uFF09\n```\nLspServers() # Check availability\n\n# Entry points (parallel)\nLspDocumentSymbols(filePath=\"src/index.ts\")\nLspDocumentSymbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nLspWorkspaceSymbols(filePath=\".\", query=\"class\")\nLspWorkspaceSymbols(filePath=\".\", query=\"interface\")\nLspWorkspaceSymbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nLspFindReferences(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP \u964D\u7EA7\u65B9\u6848**\uFF1A\u5982\u679C\u4E0D\u53EF\u7528\uFF0C\u4F9D\u8D56\u63A2\u7D22\u4EE3\u7406 + AST-grep\u3002\n\n### \u6536\u96C6\u540E\u53F0\u7ED3\u679C\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**\u5408\u5E76\uFF1Abash + LSP + \u73B0\u6709\u6587\u4EF6 + \u63A2\u7D22\u7ED3\u679C\u3002\u5C06 \"discovery\" \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n## \u9636\u6BB5 2\uFF1A\u8BC4\u5206\u4E0E\u4F4D\u7F6E\u51B3\u7B56\n\n**\u5C06 \"scoring\" \u6807\u8BB0\u4E3A in_progress\u3002**\n\n### \u8BC4\u5206\u77E9\u9635\n\n| \u56E0\u7D20 | \u6743\u91CD | \u9AD8\u9608\u503C | \u6570\u636E\u6765\u6E90 |\n|--------|--------|----------------|--------|\n| \u6587\u4EF6\u6570\u91CF | 3x | >20 | bash |\n| \u5B50\u76EE\u5F55\u6570\u91CF | 2x | >5 | bash |\n| \u4EE3\u7801\u5360\u6BD4 | 2x | >70% | bash |\n| \u72EC\u7279\u6A21\u5F0F | 1x | \u6709\u81EA\u6709\u914D\u7F6E | explore |\n| \u6A21\u5757\u8FB9\u754C | 2x | \u6709 index.ts/__init__.py | bash |\n| \u7B26\u53F7\u5BC6\u5EA6 | 2x | >30 \u4E2A\u7B26\u53F7 | LSP |\n| \u5BFC\u51FA\u6570\u91CF | 2x | >10 \u4E2A\u5BFC\u51FA | LSP |\n| \u5F15\u7528\u4E2D\u5FC3\u5EA6 | 3x | >20 \u6B21\u5F15\u7528 | LSP |\n\n### \u51B3\u7B56\u89C4\u5219\n\n| \u5206\u6570 | \u64CD\u4F5C |\n|-------|--------|\n| **\u6839\u76EE\u5F55\uFF08.\uFF09** | \u59CB\u7EC8\u521B\u5EFA |\n| **>15** | \u521B\u5EFA AGENTS.md |\n| **8-15** | \u5982\u679C\u662F\u72EC\u7ACB\u9886\u57DF\u5219\u521B\u5EFA |\n| **<8** | \u8DF3\u8FC7\uFF08\u7236\u76EE\u5F55\u5DF2\u8986\u76D6\uFF09 |\n\n### \u8F93\u51FA\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**\u5C06 \"scoring\" \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n## \u9636\u6BB5 3\uFF1A\u751F\u6210 AGENTS.md\n\n**\u5C06 \"generate\" \u6807\u8BB0\u4E3A in_progress\u3002**\n\n<critical>\n**\u6587\u4EF6\u5199\u5165\u89C4\u5219**\uFF1A\u5982\u679C\u76EE\u6807\u8DEF\u5F84\u5DF2\u5B58\u5728 AGENTS.md \u2192 \u4F7F\u7528 `Edit` \u5DE5\u5177\u3002\u5982\u679C\u4E0D\u5B58\u5728 \u2192 \u4F7F\u7528 `Write` \u5DE5\u5177\u3002\n\u7EDD\u4E0D\u8981\u4F7F\u7528 Write \u8986\u76D6\u73B0\u6709\u6587\u4EF6\u3002\u59CB\u7EC8\u901A\u8FC7 `Read` \u6216\u53D1\u73B0\u7ED3\u679C\u5148\u68C0\u67E5\u662F\u5426\u5B58\u5728\u3002\n</critical>\n\n### \u6839\u76EE\u5F55 AGENTS.md\uFF08\u5B8C\u6574\u5904\u7406\uFF09\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**\u8D28\u91CF\u6807\u51C6**\uFF1A50-150 \u884C\uFF0C\u65E0\u901A\u7528\u5EFA\u8BAE\uFF0C\u65E0\u663E\u800C\u6613\u89C1\u7684\u4FE1\u606F\u3002\n\n### \u5B50\u76EE\u5F55 AGENTS.md\uFF08\u5E76\u884C\uFF09\n\n\u4E3A\u6BCF\u4E2A\u4F4D\u7F6E\u542F\u52A8\u5199\u5165\u4EFB\u52A1\uFF1A\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n task(category=\"writing\", load_skills=[], run_in_background=false, description=\"Generate AGENTS.md\", prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**\u7B49\u5F85\u6240\u6709\u5B8C\u6210\u3002\u5C06 \"generate\" \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n## \u9636\u6BB5 4\uFF1A\u5BA1\u67E5\u4E0E\u53BB\u91CD\n\n**\u5C06 \"review\" \u6807\u8BB0\u4E3A in_progress\u3002**\n\n\u5BF9\u6BCF\u4E2A\u751F\u6210\u7684\u6587\u4EF6\uFF1A\n- \u79FB\u9664\u901A\u7528\u5EFA\u8BAE\n- \u79FB\u9664\u4E0E\u7236\u76EE\u5F55\u91CD\u590D\u7684\u5185\u5BB9\n- \u7CBE\u7B80\u5230\u5927\u5C0F\u9650\u5236\n- \u9A8C\u8BC1\u7B80\u6D01\u98CE\u683C\n\n**\u5C06 \"review\" \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n## \u6700\u7EC8\u62A5\u544A\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n [OK] ./AGENTS.md (root, {N} lines)\n [OK] ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## \u53CD\u6A21\u5F0F\n\n- **\u9759\u6001\u4EE3\u7406\u6570\u91CF**\uFF1A\u5FC5\u987B\u6839\u636E\u9879\u76EE\u89C4\u6A21/\u6DF1\u5EA6\u53D8\u5316\u4EE3\u7406\u6570\u91CF\n- **\u987A\u5E8F\u6267\u884C**\uFF1A\u5FC5\u987B\u5E76\u884C\u5316\uFF08\u63A2\u7D22 + LSP \u5E76\u53D1\uFF09\n- **\u5FFD\u7565\u73B0\u6709\u6587\u4EF6**\uFF1A\u59CB\u7EC8\u5148\u8BFB\u53D6\u73B0\u6709\u6587\u4EF6\uFF0C\u5373\u4F7F\u4F7F\u7528 --create-new\n- **\u8FC7\u5EA6\u6587\u6863\u5316**\uFF1A\u5E76\u975E\u6BCF\u4E2A\u76EE\u5F55\u90FD\u9700\u8981 AGENTS.md\n- **\u5197\u4F59**\uFF1A\u5B50\u76EE\u5F55\u7EDD\u4E0D\u91CD\u590D\u7236\u76EE\u5F55\u5185\u5BB9\n- **\u901A\u7528\u5185\u5BB9**\uFF1A\u79FB\u9664\u4EFB\u4F55\u9002\u7528\u4E8E\u6240\u6709\u9879\u76EE\u7684\u5185\u5BB9\n- **\u5197\u4F59\u98CE\u683C**\uFF1A\u7B80\u6D01\u81F3\u4E0A";
@@ -1,3 +1,3 @@
1
- export declare const RALPH_LOOP_TEMPLATE = "You are starting a Ralph Loop - a self-referential development loop that runs until task completion.\n\n## How Ralph Loop Works\n\n1. You will work on the task continuously\n2. When you believe the task is FULLY complete, output: `<promise>{{COMPLETION_PROMISE}}</promise>`\n3. If you don't output the promise, the loop will automatically inject another prompt to continue\n4. Maximum iterations: Configurable (default 100)\n\n## Rules\n\n- Focus on completing the task fully, not partially\n- Don't output the completion promise until the task is truly done\n- Each iteration should make meaningful progress toward the goal\n- If stuck, try different approaches\n- Use todos to track your progress\n\n## Exit Conditions\n\n1. **Completion**: Output your completion promise tag when fully complete\n2. **Max Iterations**: Loop stops automatically at limit\n3. **Cancel**: User runs `/cancel-ralph` command\n\n## Your Task\n\nParse the arguments below and begin working on the task. The format is:\n`\"task description\" [--completion-promise=TEXT] [--max-iterations=N] [--strategy=reset|continue]`\n\nDefault completion promise is \"DONE\" and default max iterations is 100.";
2
- export declare const ULW_LOOP_TEMPLATE = "You are starting an ULTRAWORK Loop - a self-referential development loop that runs until verified completion.\n\n## How ULTRAWORK Loop Works\n\n1. You will work on the task continuously\n2. When you believe the work is complete, output: `<promise>{{COMPLETION_PROMISE}}</promise>`\n3. That does NOT finish the loop yet. The system will require Oracle verification\n4. The loop only ends after the system confirms Oracle verified the result\n5. The iteration limit is 500 for ultrawork mode, 100 for normal mode\n\n## Rules\n\n- Focus on finishing the task completely\n- After you emit the completion promise, run Oracle verification when instructed\n- Do not treat DONE as final completion until Oracle verifies it\n\n## Exit Conditions\n\n1. **Verified Completion**: Oracle verifies the result and the system confirms it\n2. **Cancel**: User runs `/cancel-ralph`\n\n## Your Task\n\nParse the arguments below and begin working on the task. The format is:\n`\"task description\" [--completion-promise=TEXT] [--strategy=reset|continue]`\n\nDefault completion promise is \"DONE\".";
3
- export declare const CANCEL_RALPH_TEMPLATE = "Cancel the currently active Ralph Loop.\n\nThis will:\n1. Stop the loop from continuing\n2. Clear the loop state file\n3. Allow the session to end normally\n\nCheck if a loop is active and cancel it. Inform the user of the result.";
1
+ export declare const RALPH_LOOP_TEMPLATE = "\u4F60\u6B63\u5728\u542F\u52A8 Ralph \u5FAA\u73AF\u2014\u2014\u4E00\u4E2A\u81EA\u5F15\u7528\u7684\u5F00\u53D1\u5FAA\u73AF\uFF0C\u5C06\u6301\u7EED\u8FD0\u884C\u76F4\u5230\u4EFB\u52A1\u5B8C\u6210\u3002\n\n## Ralph \u5FAA\u73AF\u5DE5\u4F5C\u539F\u7406\n\n1. \u4F60\u5C06\u6301\u7EED\u5904\u7406\u4EFB\u52A1\n2. \u5F53\u4F60\u8BA4\u4E3A\u4EFB\u52A1\u5B8C\u5168\u5B8C\u6210\u65F6\uFF0C\u8F93\u51FA\uFF1A`<promise>{{COMPLETION_PROMISE}}</promise>`\n3. \u5982\u679C\u4F60\u672A\u8F93\u51FA\u627F\u8BFA\u6807\u7B7E\uFF0C\u5FAA\u73AF\u5C06\u81EA\u52A8\u6CE8\u5165\u53E6\u4E00\u4E2A\u63D0\u793A\u4EE5\u7EE7\u7EED\n4. \u6700\u5927\u8FED\u4EE3\u6B21\u6570\uFF1A\u53EF\u914D\u7F6E\uFF08\u9ED8\u8BA4 100\uFF09\n\n## \u89C4\u5219\n\n- \u4E13\u6CE8\u4E8E\u5B8C\u5168\u5B8C\u6210\u4EFB\u52A1\uFF0C\u800C\u975E\u90E8\u5206\u5B8C\u6210\n- \u5728\u4EFB\u52A1\u771F\u6B63\u5B8C\u6210\u4E4B\u524D\u4E0D\u8981\u8F93\u51FA\u5B8C\u6210\u627F\u8BFA\n- \u6BCF\u6B21\u8FED\u4EE3\u5E94\u671D\u7740\u76EE\u6807\u53D6\u5F97\u6709\u610F\u4E49\u7684\u8FDB\u5C55\n- \u5982\u679C\u9047\u5230\u56F0\u96BE\uFF0C\u5C1D\u8BD5\u4E0D\u540C\u7684\u65B9\u6CD5\n- \u4F7F\u7528\u5F85\u529E\u4E8B\u9879\u8FFD\u8E2A\u8FDB\u5EA6\n\n## \u9000\u51FA\u6761\u4EF6\n\n1. **\u5B8C\u6210**\uFF1A\u5B8C\u5168\u5B8C\u6210\u540E\u8F93\u51FA\u5B8C\u6210\u627F\u8BFA\u6807\u7B7E\n2. **\u6700\u5927\u8FED\u4EE3\u6B21\u6570**\uFF1A\u5FAA\u73AF\u5728\u8FBE\u5230\u9650\u5236\u65F6\u81EA\u52A8\u505C\u6B62\n3. **\u53D6\u6D88**\uFF1A\u7528\u6237\u8FD0\u884C `/cancel-ralph` \u547D\u4EE4\n\n## \u4F60\u7684\u4EFB\u52A1\n\n\u89E3\u6790\u4EE5\u4E0B\u53C2\u6570\u5E76\u5F00\u59CB\u5904\u7406\u4EFB\u52A1\u3002\u683C\u5F0F\u4E3A\uFF1A\n`\"task description\" [--completion-promise=TEXT] [--max-iterations=N] [--strategy=reset|continue]`\n\n\u9ED8\u8BA4\u5B8C\u6210\u627F\u8BFA\u4E3A \"DONE\"\uFF0C\u9ED8\u8BA4\u6700\u5927\u8FED\u4EE3\u6B21\u6570\u4E3A 100\u3002";
2
+ export declare const ULW_LOOP_TEMPLATE = "\u4F60\u6B63\u5728\u542F\u52A8 ULTRAWORK \u5FAA\u73AF\u2014\u2014\u4E00\u4E2A\u81EA\u5F15\u7528\u7684\u5F00\u53D1\u5FAA\u73AF\uFF0C\u5C06\u6301\u7EED\u8FD0\u884C\u76F4\u5230\u9A8C\u8BC1\u5B8C\u6210\u3002\n\n## ULTRAWORK \u5FAA\u73AF\u5DE5\u4F5C\u539F\u7406\n\n1. \u4F60\u5C06\u6301\u7EED\u5904\u7406\u4EFB\u52A1\n2. \u5F53\u4F60\u8BA4\u4E3A\u5DE5\u4F5C\u5B8C\u6210\u65F6\uFF0C\u8F93\u51FA\uFF1A`<promise>{{COMPLETION_PROMISE}}</promise>`\n3. \u8FD9\u5E76\u4E0D\u4F1A\u7ED3\u675F\u5FAA\u73AF\u3002\u7CFB\u7EDF\u5C06\u8981\u6C42 Oracle \u8FDB\u884C\u9A8C\u8BC1\n4. \u53EA\u6709\u5F53\u7CFB\u7EDF\u786E\u8BA4 Oracle \u9A8C\u8BC1\u901A\u8FC7\u540E\uFF0C\u5FAA\u73AF\u624D\u4F1A\u7ED3\u675F\n5. \u8D85\u9AD8\u6548\u6A21\u5F0F\u7684\u6700\u5927\u8FED\u4EE3\u6B21\u6570\u4E3A 500\uFF0C\u666E\u901A\u6A21\u5F0F\u4E3A 100\n\n## \u89C4\u5219\n\n- \u4E13\u6CE8\u4E8E\u5B8C\u5168\u5B8C\u6210\u4EFB\u52A1\n- \u5728\u8F93\u51FA\u5B8C\u6210\u627F\u8BFA\u540E\uFF0C\u6309\u7167\u6307\u793A\u8FD0\u884C Oracle \u9A8C\u8BC1\n- \u5728 Oracle \u9A8C\u8BC1\u901A\u8FC7\u4E4B\u524D\uFF0C\u4E0D\u8981\u5C06 DONE \u89C6\u4E3A\u6700\u7EC8\u5B8C\u6210\n\n## \u9000\u51FA\u6761\u4EF6\n\n1. **\u9A8C\u8BC1\u901A\u8FC7**\uFF1AOracle \u9A8C\u8BC1\u7ED3\u679C\u4E14\u7CFB\u7EDF\u786E\u8BA4\u901A\u8FC7\n2. **\u53D6\u6D88**\uFF1A\u7528\u6237\u8FD0\u884C `/cancel-ralph`\n\n## \u4F60\u7684\u4EFB\u52A1\n\n\u89E3\u6790\u4EE5\u4E0B\u53C2\u6570\u5E76\u5F00\u59CB\u5904\u7406\u4EFB\u52A1\u3002\u683C\u5F0F\u4E3A\uFF1A\n`\"task description\" [--completion-promise=TEXT] [--strategy=reset|continue]`\n\n\u9ED8\u8BA4\u5B8C\u6210\u627F\u8BFA\u4E3A \"DONE\"\u3002";
3
+ export declare const CANCEL_RALPH_TEMPLATE = "\u53D6\u6D88\u5F53\u524D\u6D3B\u52A8\u7684 Ralph \u5FAA\u73AF\u3002\n\n\u8FD9\u5C06\uFF1A\n1. \u505C\u6B62\u5FAA\u73AF\u7EE7\u7EED\u8FD0\u884C\n2. \u6E05\u9664\u5FAA\u73AF\u72B6\u6001\u6587\u4EF6\n3. \u5141\u8BB8\u4F1A\u8BDD\u6B63\u5E38\u7ED3\u675F\n\n\u68C0\u67E5\u5FAA\u73AF\u662F\u5426\u5904\u4E8E\u6D3B\u52A8\u72B6\u6001\u5E76\u53D6\u6D88\u5B83\u3002\u544A\u77E5\u7528\u6237\u7ED3\u679C\u3002";
@@ -1 +1 @@
1
- export declare const REFACTOR_TEMPLATE = "# Intelligent Refactor Command\n\n## Usage\n```\n/refactor <refactoring-target> [--scope=<file|module|project>] [--strategy=<safe|aggressive>]\n\nArguments:\n refactoring-target: What to refactor. Can be:\n - File path: src/auth/handler.ts\n - Symbol name: \"AuthService class\"\n - Pattern: \"all functions using deprecated API\"\n - Description: \"extract validation logic into separate module\"\n\nOptions:\n --scope: Refactoring scope (default: module)\n - file: Single file only\n - module: Module/directory scope\n - project: Entire codebase\n\n --strategy: Risk tolerance (default: safe)\n - safe: Conservative, maximum test coverage required\n - aggressive: Allow broader changes with adequate coverage\n```\n\n## What This Command Does\n\nPerforms intelligent, deterministic refactoring with full codebase awareness. Unlike blind search-and-replace, this command:\n\n1. **Understands your intent** - Analyzes what you actually want to achieve\n2. **Maps the codebase** - Builds a definitive codemap before touching anything\n3. **Assesses risk** - Evaluates test coverage and determines verification strategy\n4. **Plans meticulously** - Creates a detailed plan with Plan agent\n5. **Executes precisely** - Step-by-step refactoring with LSP and AST-grep\n6. **Verifies constantly** - Runs tests after each change to ensure zero regression\n\n---\n\n# PHASE 0: INTENT GATE (MANDATORY FIRST STEP)\n\n**BEFORE ANY ACTION, classify and validate the request.**\n\n## Step 0.1: Parse Request Type\n\n| Signal | Classification | Action |\n|--------|----------------|--------|\n| Specific file/symbol | Explicit | Proceed to codebase analysis |\n| \"Refactor X to Y\" | Clear transformation | Proceed to codebase analysis |\n| \"Improve\", \"Clean up\" | Open-ended | **MUST ask**: \"What specific improvement?\" |\n| Ambiguous scope | Uncertain | **MUST ask**: \"Which modules/files?\" |\n| Missing context | Incomplete | **MUST ask**: \"What's the desired outcome?\" |\n\n## Step 0.2: Validate Understanding\n\nBefore proceeding, confirm:\n- [ ] Target is clearly identified\n- [ ] Desired outcome is understood\n- [ ] Scope is defined (file/module/project)\n- [ ] Success criteria can be articulated\n\n**If ANY of above is unclear, ASK CLARIFYING QUESTION:**\n\n```\nI want to make sure I understand the refactoring goal correctly.\n\n**What I understood**: [interpretation]\n**What I'm unsure about**: [specific ambiguity]\n\nOptions I see:\n1. [Option A] - [implications]\n2. [Option B] - [implications]\n\n**My recommendation**: [suggestion with reasoning]\n\nShould I proceed with [recommendation], or would you prefer differently?\n```\n\n## Step 0.3: Create Initial Todos\n\n**IMMEDIATELY after understanding the request, create todos:**\n\n```\nTodoWrite([\n {\"id\": \"phase-1\", \"content\": \"PHASE 1: Codebase Analysis - launch parallel explore agents\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-2\", \"content\": \"PHASE 2: Build Codemap - map dependencies and impact zones\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-3\", \"content\": \"PHASE 3: Test Assessment - analyze test coverage and verification strategy\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-4\", \"content\": \"PHASE 4: Plan Generation - invoke Plan agent for detailed refactoring plan\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-5\", \"content\": \"PHASE 5: Execute Refactoring - step-by-step with continuous verification\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-6\", \"content\": \"PHASE 6: Final Verification - full test suite and regression check\", \"status\": \"pending\", \"priority\": \"high\"}\n])\n```\n\n---\n\n# PHASE 1: CODEBASE ANALYSIS (PARALLEL EXPLORATION)\n\n**Mark phase-1 as in_progress.**\n\n## 1.1: Launch Parallel Explore Agents (BACKGROUND)\n\nFire ALL of these simultaneously using `call_omo_agent`:\n\n```\n// Agent 1: Find the refactoring target\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find all occurrences and definitions of [TARGET]. \n Report: file paths, line numbers, usage patterns.\"\n)\n\n// Agent 2: Find related code\ncall_omo_agent(\n subagent_type=\"explore\", \n run_in_background=true,\n prompt=\"Find all code that imports, uses, or depends on [TARGET].\n Report: dependency chains, import graphs.\"\n)\n\n// Agent 3: Find similar patterns\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find similar code patterns to [TARGET] in the codebase.\n Report: analogous implementations, established conventions.\"\n)\n\n// Agent 4: Find tests\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find all test files related to [TARGET].\n Report: test file paths, test case names, coverage indicators.\"\n)\n\n// Agent 5: Architecture context\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find architectural patterns and module organization around [TARGET].\n Report: module boundaries, layer structure, design patterns in use.\"\n)\n```\n\n## 1.2: Direct Tool Exploration (WHILE AGENTS RUN)\n\nWhile background agents are running, use direct tools:\n\n### LSP Tools for Precise Analysis:\n\n```typescript\n// Find definition(s)\nLspGotoDefinition(filePath, line, character) // Where is it defined?\n\n// Find ALL usages across workspace\nLspFindReferences(filePath, line, character, includeDeclaration=true)\n\n// Get file structure\nLspDocumentSymbols(filePath) // Hierarchical outline\nLspWorkspaceSymbols(filePath, query=\"[target_symbol]\") // Search by name\n\n// Get current diagnostics\nlsp_diagnostics(filePath) // Errors, warnings before we start\n```\n\n### AST-Grep for Pattern Analysis:\n\n```typescript\n// Find structural patterns\nast_grep_search(\n pattern=\"function $NAME($$$) { $$$ }\", // or relevant pattern\n lang=\"typescript\", // or relevant language\n paths=[\"src/\"]\n)\n\n// Preview refactoring (DRY RUN)\nast_grep_replace(\n pattern=\"[old_pattern]\",\n rewrite=\"[new_pattern]\",\n lang=\"[language]\",\n dryRun=true // ALWAYS preview first\n)\n```\n\n### Grep for Text Patterns:\n\n```\ngrep(pattern=\"[search_term]\", path=\"src/\", include=\"*.ts\")\n```\n\n## 1.3: Collect Background Results\n\n```\nbackground_output(task_id=\"[agent_1_id]\")\nbackground_output(task_id=\"[agent_2_id]\")\n...\n```\n\n**Mark phase-1 as completed after all results collected.**\n\n---\n\n# PHASE 2: BUILD CODEMAP (DEPENDENCY MAPPING)\n\n**Mark phase-2 as in_progress.**\n\n## 2.1: Construct Definitive Codemap\n\nBased on Phase 1 results, build:\n\n```\n## CODEMAP: [TARGET]\n\n### Core Files (Direct Impact)\n- `path/to/file.ts:L10-L50` - Primary definition\n- `path/to/file2.ts:L25` - Key usage\n\n### Dependency Graph\n```\n[TARGET] \n\u251C\u2500\u2500 imports from: \n\u2502 \u251C\u2500\u2500 module-a (types)\n\u2502 \u2514\u2500\u2500 module-b (utils)\n\u251C\u2500\u2500 imported by:\n\u2502 \u251C\u2500\u2500 consumer-1.ts\n\u2502 \u251C\u2500\u2500 consumer-2.ts\n\u2502 \u2514\u2500\u2500 consumer-3.ts\n\u2514\u2500\u2500 used by:\n \u251C\u2500\u2500 handler.ts (direct call)\n \u2514\u2500\u2500 service.ts (dependency injection)\n```\n\n### Impact Zones\n| Zone | Risk Level | Files Affected | Test Coverage |\n|------|------------|----------------|---------------|\n| Core | HIGH | 3 files | 85% covered |\n| Consumers | MEDIUM | 8 files | 70% covered |\n| Edge | LOW | 2 files | 50% covered |\n\n### Established Patterns\n- Pattern A: [description] - used in N places\n- Pattern B: [description] - established convention\n```\n\n## 2.2: Identify Refactoring Constraints\n\nBased on codemap:\n- **MUST follow**: [existing patterns identified]\n- **MUST NOT break**: [critical dependencies]\n- **Safe to change**: [isolated code zones]\n- **Requires migration**: [breaking changes impact]\n\n**Mark phase-2 as completed.**\n\n---\n\n# PHASE 3: TEST ASSESSMENT (VERIFICATION STRATEGY)\n\n**Mark phase-3 as in_progress.**\n\n## 3.1: Detect Test Infrastructure\n\n```bash\n# Check for test commands\ncat package.json | jq '.scripts | keys[] | select(test(\"test\"))'\n\n# Or for Python\nls -la pytest.ini pyproject.toml setup.cfg\n\n# Or for Go\nls -la *_test.go\n```\n\n## 3.2: Analyze Test Coverage\n\n```\n// Find all tests related to target\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=false, // Need this synchronously\n prompt=\"Analyze test coverage for [TARGET]:\n 1. Which test files cover this code?\n 2. What test cases exist?\n 3. Are there integration tests?\n 4. What edge cases are tested?\n 5. Estimated coverage percentage?\"\n)\n```\n\n## 3.3: Determine Verification Strategy\n\nBased on test analysis:\n\n| Coverage Level | Strategy |\n|----------------|----------|\n| HIGH (>80%) | Run existing tests after each step |\n| MEDIUM (50-80%) | Run tests + add safety assertions |\n| LOW (<50%) | **PAUSE**: Propose adding tests first |\n| NONE | **BLOCK**: Refuse aggressive refactoring |\n\n**If coverage is LOW or NONE, ask user:**\n\n```\nTest coverage for [TARGET] is [LEVEL].\n\n**Risk Assessment**: Refactoring without adequate tests is dangerous.\n\nOptions:\n1. Add tests first, then refactor (RECOMMENDED)\n2. Proceed with extra caution, manual verification required\n3. Abort refactoring\n\nWhich approach do you prefer?\n```\n\n## 3.4: Document Verification Plan\n\n```\n## VERIFICATION PLAN\n\n### Test Commands\n- Unit: `bun test` / `npm test` / `pytest` / etc.\n- Integration: [command if exists]\n- Type check: `tsc --noEmit` / `pyright` / etc.\n\n### Verification Checkpoints\nAfter each refactoring step:\n1. lsp_diagnostics \u2192 zero new errors\n2. Run test command \u2192 all pass\n3. Type check \u2192 clean\n\n### Regression Indicators\n- [Specific test that must pass]\n- [Behavior that must be preserved]\n- [API contract that must not change]\n```\n\n**Mark phase-3 as completed.**\n\n---\n\n# PHASE 4: PLAN GENERATION (PLAN AGENT)\n\n**Mark phase-4 as in_progress.**\n\n## 4.1: Invoke Plan Agent\n\n```\nTask(\n subagent_type=\"plan\",\n prompt=\"Create a detailed refactoring plan:\n\n ## Refactoring Goal\n [User's original request]\n\n ## Codemap (from Phase 2)\n [Insert codemap here]\n\n ## Test Coverage (from Phase 3)\n [Insert verification plan here]\n\n ## Constraints\n - MUST follow existing patterns: [list]\n - MUST NOT break: [critical paths]\n - MUST run tests after each step\n\n ## Requirements\n 1. Break down into atomic refactoring steps\n 2. Each step must be independently verifiable\n 3. Order steps by dependency (what must happen first)\n 4. Specify exact files and line ranges for each step\n 5. Include rollback strategy for each step\n 6. Define commit checkpoints\"\n)\n```\n\n## 4.2: Review and Validate Plan\n\nAfter receiving plan from Plan agent:\n\n1. **Verify completeness**: All identified files addressed?\n2. **Verify safety**: Each step reversible?\n3. **Verify order**: Dependencies respected?\n4. **Verify verification**: Test commands specified?\n\n## 4.3: Register Detailed Todos\n\nConvert Plan agent output into granular todos:\n\n```\nTodoWrite([\n // Each step from the plan becomes a todo\n {\"id\": \"refactor-1\", \"content\": \"Step 1: [description]\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"verify-1\", \"content\": \"Verify Step 1: run tests\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"refactor-2\", \"content\": \"Step 2: [description]\", \"status\": \"pending\", \"priority\": \"medium\"},\n {\"id\": \"verify-2\", \"content\": \"Verify Step 2: run tests\", \"status\": \"pending\", \"priority\": \"medium\"},\n // ... continue for all steps\n])\n```\n\n**Mark phase-4 as completed.**\n\n---\n\n# PHASE 5: EXECUTE REFACTORING (DETERMINISTIC EXECUTION)\n\n**Mark phase-5 as in_progress.**\n\n## 5.1: Execution Protocol\n\nFor EACH refactoring step:\n\n### Pre-Step\n1. Mark step todo as `in_progress`\n2. Read current file state\n3. Verify lsp_diagnostics is baseline\n\n### Execute Step\nUse appropriate tool:\n\n**For Symbol Renames:**\n```typescript\nlsp_prepare_rename(filePath, line, character) // Validate rename is possible\nlsp_rename(filePath, line, character, newName) // Execute rename\n```\n\n**For Pattern Transformations:**\n```typescript\n// Preview first\nast_grep_replace(pattern, rewrite, lang, dryRun=true)\n\n// If preview looks good, execute\nast_grep_replace(pattern, rewrite, lang, dryRun=false)\n```\n\n**For Structural Changes:**\n```typescript\n// Use Edit tool for precise changes\nedit(filePath, oldString, newString)\n```\n\n### Post-Step Verification (MANDATORY)\n\n```typescript\n// 1. Check diagnostics\nlsp_diagnostics(filePath) // Must be clean or same as baseline\n\n// 2. Run tests\nbash(\"bun test\") // Or appropriate test command\n\n// 3. Type check\nbash(\"tsc --noEmit\") // Or appropriate type check\n```\n\n### Step Completion\n1. If verification passes \u2192 Mark step todo as `completed`\n2. If verification fails \u2192 **STOP AND FIX**\n\n## 5.2: Failure Recovery Protocol\n\nIf ANY verification fails:\n\n1. **STOP** immediately\n2. **REVERT** the failed change\n3. **DIAGNOSE** what went wrong\n4. **OPTIONS**:\n - Fix the issue and retry\n - Skip this step (if optional)\n - Consult oracle agent for help\n - Ask user for guidance\n\n**NEVER proceed to next step with broken tests.**\n\n## 5.3: Commit Checkpoints\n\nAfter each logical group of changes:\n\n```bash\ngit add [changed-files]\ngit commit -m \"refactor(scope): description\n\n[details of what was changed and why]\"\n```\n\n**Mark phase-5 as completed when all refactoring steps done.**\n\n---\n\n# PHASE 6: FINAL VERIFICATION (REGRESSION CHECK)\n\n**Mark phase-6 as in_progress.**\n\n## 6.1: Full Test Suite\n\n```bash\n# Run complete test suite\nbun test # or npm test, pytest, go test, etc.\n```\n\n## 6.2: Type Check\n\n```bash\n# Full type check\ntsc --noEmit # or equivalent\n```\n\n## 6.3: Lint Check\n\n```bash\n# Run linter\neslint . # or equivalent\n```\n\n## 6.4: Build Verification (if applicable)\n\n```bash\n# Ensure build still works\nbun run build # or npm run build, etc.\n```\n\n## 6.5: Final Diagnostics\n\n```typescript\n// Check all changed files\nfor (file of changedFiles) {\n lsp_diagnostics(file) // Must all be clean\n}\n```\n\n## 6.6: Generate Summary\n\n```markdown\n## Refactoring Complete\n\n### What Changed\n- [List of changes made]\n\n### Files Modified\n- `path/to/file.ts` - [what changed]\n- `path/to/file2.ts` - [what changed]\n\n### Verification Results\n- Tests: PASSED (X/Y passing)\n- Type Check: CLEAN\n- Lint: CLEAN\n- Build: SUCCESS\n\n### No Regressions Detected\nAll existing tests pass. No new errors introduced.\n```\n\n**Mark phase-6 as completed.**\n\n---\n\n# CRITICAL RULES\n\n## NEVER DO\n- Skip lsp_diagnostics check after changes\n- Proceed with failing tests\n- Make changes without understanding impact\n- Use `as any`, `@ts-ignore`, `@ts-expect-error`\n- Delete tests to make them pass\n- Commit broken code\n- Refactor without understanding existing patterns\n\n## ALWAYS DO\n- Understand before changing\n- Preview before applying (ast_grep dryRun=true)\n- Verify after every change\n- Follow existing codebase patterns\n- Keep todos updated in real-time\n- Commit at logical checkpoints\n- Report issues immediately\n\n## ABORT CONDITIONS\nIf any of these occur, **STOP and consult user**:\n- Test coverage is zero for target code\n- Changes would break public API\n- Refactoring scope is unclear\n- 3 consecutive verification failures\n- User-defined constraints violated\n\n---\n\n# Tool Usage Philosophy\n\nYou already know these tools. Use them intelligently:\n\n## LSP Tools\nLeverage LSP tools for precision analysis. Key patterns:\n- **Understand before changing**: `LspGotoDefinition` to grasp context\n- **Impact analysis**: `LspFindReferences` to map all usages before modification\n- **Safe refactoring**: `lsp_prepare_rename` \u2192 `lsp_rename` for symbol renames\n- **Continuous verification**: `lsp_diagnostics` after every change\n\n## AST-Grep\nUse `ast_grep_search` and `ast_grep_replace` for structural transformations.\n**Critical**: Always `dryRun=true` first, review, then execute.\n\n## Agents\n- `explore`: Parallel codebase pattern discovery\n- `plan`: Detailed refactoring plan generation\n- `oracle`: Read-only consultation for complex architectural decisions and debugging\n- `librarian`: **Use proactively** when encountering deprecated methods or library migration tasks. Query official docs and OSS examples for modern replacements.\n\n## Deprecated Code & Library Migration\nWhen you encounter deprecated methods/APIs during refactoring:\n1. Fire `librarian` to find the recommended modern alternative\n2. **DO NOT auto-upgrade to latest version** unless user explicitly requests migration\n3. If user requests library migration, use `librarian` to fetch latest API docs before making changes\n\n---\n\n**Remember: Refactoring without tests is reckless. Refactoring without understanding is destructive. This command ensures you do neither.**\n\n<user-request>\n$ARGUMENTS\n</user-request>\n";
1
+ export declare const REFACTOR_TEMPLATE = "# \u667A\u80FD\u91CD\u6784\u547D\u4EE4\n\n## \u4F7F\u7528\u65B9\u6CD5\n```\n/refactor <refactoring-target> [--scope=<file|module|project>] [--strategy=<safe|aggressive>]\n\nArguments:\n refactoring-target: \u8981\u91CD\u6784\u7684\u5BF9\u8C61\u3002\u53EF\u4EE5\u662F\uFF1A\n - \u6587\u4EF6\u8DEF\u5F84\uFF1Asrc/auth/handler.ts\n - \u7B26\u53F7\u540D\u79F0\uFF1A\"AuthService class\"\n - \u6A21\u5F0F\uFF1A \"\u6240\u6709\u4F7F\u7528\u5DF2\u5F03\u7528API\u7684\u51FD\u6570\"\n - \u63CF\u8FF0\uFF1A \"\u5C06\u9A8C\u8BC1\u903B\u8F91\u63D0\u53D6\u5230\u72EC\u7ACB\u6A21\u5757\"\n\nOptions:\n --scope: \u91CD\u6784\u8303\u56F4\uFF08\u9ED8\u8BA4\uFF1Amodule\uFF09\n - file\uFF1A\u4EC5\u5355\u4E2A\u6587\u4EF6\n - module\uFF1A\u6A21\u5757/\u76EE\u5F55\u8303\u56F4\n - project\uFF1A\u6574\u4E2A\u4EE3\u7801\u5E93\n\n --strategy: \u98CE\u9669\u627F\u53D7\u5EA6\uFF08\u9ED8\u8BA4\uFF1Asafe\uFF09\n - safe\uFF1A\u4FDD\u5B88\uFF0C\u9700\u8981\u6700\u5927\u6D4B\u8BD5\u8986\u76D6\u7387\n - aggressive\uFF1A\u5141\u8BB8\u5728\u5145\u5206\u8986\u76D6\u7684\u60C5\u51B5\u4E0B\u8FDB\u884C\u66F4\u5927\u8303\u56F4\u66F4\u6539\n```\n\n## \u6B64\u547D\u4EE4\u7684\u529F\u80FD\n\n\u6267\u884C\u667A\u80FD\u3001\u786E\u5B9A\u6027\u7684\u91CD\u6784\uFF0C\u5177\u6709\u5B8C\u6574\u7684\u4EE3\u7801\u5E93\u611F\u77E5\u80FD\u529B\u3002\u4E0E\u76F2\u76EE\u7684\u641C\u7D22\u66FF\u6362\u4E0D\u540C\uFF0C\u6B64\u547D\u4EE4\uFF1A\n\n1. **\u7406\u89E3\u4F60\u7684\u610F\u56FE** - \u5206\u6790\u4F60\u5B9E\u9645\u60F3\u8981\u5B9E\u73B0\u7684\u76EE\u6807\n2. **\u6620\u5C04\u4EE3\u7801\u5E93** - \u5728\u89E6\u78B0\u4EFB\u4F55\u4EE3\u7801\u4E4B\u524D\u6784\u5EFA\u786E\u5B9A\u6027\u7684\u4EE3\u7801\u6620\u5C04\n3. **\u8BC4\u4F30\u98CE\u9669** - \u8BC4\u4F30\u6D4B\u8BD5\u8986\u76D6\u7387\u5E76\u786E\u5B9A\u9A8C\u8BC1\u7B56\u7565\n4. **\u7CBE\u5FC3\u89C4\u5212** - \u4F7F\u7528\u89C4\u5212\u4EE3\u7406\u521B\u5EFA\u8BE6\u7EC6\u8BA1\u5212\n5. **\u7CBE\u786E\u6267\u884C** - \u4F7F\u7528 LSP \u548C AST-grep \u8FDB\u884C\u9010\u6B65\u91CD\u6784\n6. **\u6301\u7EED\u9A8C\u8BC1** - \u6BCF\u6B21\u66F4\u6539\u540E\u8FD0\u884C\u6D4B\u8BD5\u4EE5\u786E\u4FDD\u96F6\u56DE\u5F52\n\n---\n\n# \u9636\u6BB5 0\uFF1A\u610F\u56FE\u68C0\u67E5\uFF08\u5F3A\u5236\u7B2C\u4E00\u6B65\uFF09\n\n**\u5728\u4EFB\u4F55\u64CD\u4F5C\u4E4B\u524D\uFF0C\u5BF9\u8BF7\u6C42\u8FDB\u884C\u5206\u7C7B\u548C\u9A8C\u8BC1\u3002**\n\n## \u6B65\u9AA4 0.1\uFF1A\u89E3\u6790\u8BF7\u6C42\u7C7B\u578B\n\n| \u4FE1\u53F7 | \u5206\u7C7B | \u64CD\u4F5C |\n|--------|----------------|--------|\n| \u7279\u5B9A\u6587\u4EF6/\u7B26\u53F7 | \u663E\u5F0F | \u8FDB\u5165\u4EE3\u7801\u5E93\u5206\u6790 |\n| \"\u5C06 X \u91CD\u6784\u4E3A Y\" | \u660E\u786E\u8F6C\u6362 | \u8FDB\u5165\u4EE3\u7801\u5E93\u5206\u6790 |\n| \"\u6539\u8FDB\"\u3001\"\u6E05\u7406\" | \u6A21\u7CCA\u4E0D\u6E05 | **\u5FC5\u987B\u8BE2\u95EE**\uFF1A\"\u9700\u8981\u4EC0\u4E48\u5177\u4F53\u6539\u8FDB\uFF1F\" |\n| \u8303\u56F4\u4E0D\u660E\u786E | \u4E0D\u786E\u5B9A | **\u5FC5\u987B\u8BE2\u95EE**\uFF1A\"\u6D89\u53CA\u54EA\u4E9B\u6A21\u5757/\u6587\u4EF6\uFF1F\" |\n| \u7F3A\u5C11\u4E0A\u4E0B\u6587 | \u4E0D\u5B8C\u6574 | **\u5FC5\u987B\u8BE2\u95EE**\uFF1A\"\u671F\u671B\u7684\u7ED3\u679C\u662F\u4EC0\u4E48\uFF1F\" |\n\n## \u6B65\u9AA4 0.2\uFF1A\u9A8C\u8BC1\u7406\u89E3\n\n\u5728\u7EE7\u7EED\u4E4B\u524D\uFF0C\u786E\u8BA4\uFF1A\n- [ ] \u76EE\u6807\u5DF2\u660E\u786E\u8BC6\u522B\n- [ ] \u671F\u671B\u7ED3\u679C\u5DF2\u7406\u89E3\n- [ ] \u8303\u56F4\u5DF2\u5B9A\u4E49\uFF08\u6587\u4EF6/\u6A21\u5757/\u9879\u76EE\uFF09\n- [ ] \u6210\u529F\u6807\u51C6\u53EF\u63CF\u8FF0\n\n**\u5982\u679C\u4EE5\u4E0A\u4EFB\u4F55\u4E00\u9879\u4E0D\u660E\u786E\uFF0C\u8BF7\u63D0\u51FA\u6F84\u6E05\u95EE\u9898\uFF1A**\n\n```\nI want to make sure I understand the refactoring goal correctly.\n\n**What I understood**: [interpretation]\n**What I'm unsure about**: [specific ambiguity]\n\nOptions I see:\n1. [Option A] - [implications]\n2. [Option B] - [implications]\n\n**My recommendation**: [suggestion with reasoning]\n\nShould I proceed with [recommendation], or would you prefer differently?\n```\n\n## \u6B65\u9AA4 0.3\uFF1A\u521B\u5EFA\u521D\u59CB\u5F85\u529E\u4E8B\u9879\n\n**\u5728\u7406\u89E3\u8BF7\u6C42\u540E\u7ACB\u5373\u521B\u5EFA\u5F85\u529E\u4E8B\u9879\uFF1A**\n\n```\nTodoWrite([\n {\"id\": \"phase-1\", \"content\": \"PHASE 1: Codebase Analysis - launch parallel explore agents\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-2\", \"content\": \"PHASE 2: Build Codemap - map dependencies and impact zones\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-3\", \"content\": \"PHASE 3: Test Assessment - analyze test coverage and verification strategy\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-4\", \"content\": \"PHASE 4: Plan Generation - invoke Plan agent for detailed refactoring plan\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-5\", \"content\": \"PHASE 5: Execute Refactoring - step-by-step with continuous verification\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-6\", \"content\": \"PHASE 6: Final Verification - full test suite and regression check\", \"status\": \"pending\", \"priority\": \"high\"}\n])\n```\n\n---\n\n# \u9636\u6BB5 1\uFF1A\u4EE3\u7801\u5E93\u5206\u6790\uFF08\u5E76\u884C\u63A2\u7D22\uFF09\n\n**\u5C06 phase-1 \u6807\u8BB0\u4E3A in_progress\u3002**\n\n## 1.1\uFF1A\u542F\u52A8\u5E76\u884C\u63A2\u7D22\u4EE3\u7406\uFF08\u540E\u53F0\uFF09\n\n\u4F7F\u7528 `call_omo_agent` \u540C\u65F6\u89E6\u53D1\u6240\u6709\u4EE5\u4E0B\u4EE3\u7406\uFF1A\n\n```\n// Agent 1: Find the refactoring target\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find all occurrences and definitions of [TARGET]. \n Report: file paths, line numbers, usage patterns.\"\n)\n\n// Agent 2: Find related code\ncall_omo_agent(\n subagent_type=\"explore\", \n run_in_background=true,\n prompt=\"Find all code that imports, uses, or depends on [TARGET].\n Report: dependency chains, import graphs.\"\n)\n\n// Agent 3: Find similar patterns\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find similar code patterns to [TARGET] in the codebase.\n Report: analogous implementations, established conventions.\"\n)\n\n// Agent 4: Find tests\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find all test files related to [TARGET].\n Report: test file paths, test case names, coverage indicators.\"\n)\n\n// Agent 5: Architecture context\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find architectural patterns and module organization around [TARGET].\n Report: module boundaries, layer structure, design patterns in use.\"\n)\n```\n\n## 1.2\uFF1A\u76F4\u63A5\u5DE5\u5177\u63A2\u7D22\uFF08\u5728\u4EE3\u7406\u8FD0\u884C\u65F6\uFF09\n\n\u5728\u540E\u53F0\u4EE3\u7406\u8FD0\u884C\u65F6\uFF0C\u4F7F\u7528\u76F4\u63A5\u5DE5\u5177\uFF1A\n\n### LSP \u5DE5\u5177\u7528\u4E8E\u7CBE\u786E\u5206\u6790\uFF1A\n\n```typescript\n// Find definition(s)\nLspGotoDefinition(filePath, line, character) // Where is it defined?\n\n// Find ALL usages across workspace\nLspFindReferences(filePath, line, character, includeDeclaration=true)\n\n// Get file structure\nLspDocumentSymbols(filePath) // Hierarchical outline\nLspWorkspaceSymbols(filePath, query=\"[target_symbol]\") // Search by name\n\n// Get current diagnostics\nlsp_diagnostics(filePath) // Errors, warnings before we start\n```\n\n### AST-Grep \u7528\u4E8E\u6A21\u5F0F\u5206\u6790\uFF1A\n\n```typescript\n// Find structural patterns\nast_grep_search(\n pattern=\"function $NAME($$$) { $$$ }\", // or relevant pattern\n lang=\"typescript\", // or relevant language\n paths=[\"src/\"]\n)\n\n// Preview refactoring (DRY RUN)\nast_grep_replace(\n pattern=\"[old_pattern]\",\n rewrite=\"[new_pattern]\",\n lang=\"[language]\",\n dryRun=true // ALWAYS preview first\n)\n```\n\n### Grep \u7528\u4E8E\u6587\u672C\u6A21\u5F0F\u641C\u7D22\uFF1A\n\n```\ngrep(pattern=\"[search_term]\", path=\"src/\", include=\"*.ts\")\n```\n\n## 1.3\uFF1A\u6536\u96C6\u540E\u53F0\u7ED3\u679C\n\n```\nbackground_output(task_id=\"[agent_1_id]\")\nbackground_output(task_id=\"[agent_2_id]\")\n...\n```\n\n**\u6536\u96C6\u6240\u6709\u7ED3\u679C\u540E\uFF0C\u5C06 phase-1 \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n# \u9636\u6BB5 2\uFF1A\u6784\u5EFA\u4EE3\u7801\u6620\u5C04\uFF08\u4F9D\u8D56\u6620\u5C04\uFF09\n\n**\u5C06 phase-2 \u6807\u8BB0\u4E3A in_progress\u3002**\n\n## 2.1\uFF1A\u6784\u5EFA\u786E\u5B9A\u6027\u4EE3\u7801\u6620\u5C04\n\n\u57FA\u4E8E\u9636\u6BB5 1 \u7684\u7ED3\u679C\u6784\u5EFA\uFF1A\n\n```\n## CODEMAP: [TARGET]\n\n### Core Files (Direct Impact)\n- `path/to/file.ts:L10-L50` - Primary definition\n- `path/to/file2.ts:L25` - Key usage\n\n### Dependency Graph\n```\n[TARGET] \n\u251C\u2500\u2500 imports from: \n\u2502 \u251C\u2500\u2500 module-a (types)\n\u2502 \u2514\u2500\u2500 module-b (utils)\n\u251C\u2500\u2500 imported by:\n\u2502 \u251C\u2500\u2500 consumer-1.ts\n\u2502 \u251C\u2500\u2500 consumer-2.ts\n\u2502 \u2514\u2500\u2500 consumer-3.ts\n\u2514\u2500\u2500 used by:\n \u251C\u2500\u2500 handler.ts (direct call)\n \u2514\u2500\u2500 service.ts (dependency injection)\n```\n\n### Impact Zones\n| \u533A\u57DF | \u98CE\u9669\u7B49\u7EA7 | \u53D7\u5F71\u54CD\u6587\u4EF6 | \u6D4B\u8BD5\u8986\u76D6\u7387 |\n|------|------------|----------------|---------------|\n| \u6838\u5FC3 | \u9AD8 | 3 \u4E2A\u6587\u4EF6 | 85% \u5DF2\u8986\u76D6 |\n| \u6D88\u8D39\u8005 | \u4E2D | 8 \u4E2A\u6587\u4EF6 | 70% \u5DF2\u8986\u76D6 |\n| \u8FB9\u7F18 | \u4F4E | 2 \u4E2A\u6587\u4EF6 | 50% \u5DF2\u8986\u76D6 |\n\n### \u5DF2\u6709\u6A21\u5F0F\n- \u6A21\u5F0F A\uFF1A[\u63CF\u8FF0] - \u5728 N \u5904\u4F7F\u7528\n- \u6A21\u5F0F B\uFF1A[\u63CF\u8FF0] - \u5DF2\u5EFA\u7ACB\u7684\u7EA6\u5B9A\n```\n\n## 2.2\uFF1A\u8BC6\u522B\u91CD\u6784\u7EA6\u675F\n\n\u57FA\u4E8E\u4EE3\u7801\u6620\u5C04\uFF1A\n- **\u5FC5\u987B\u9075\u5FAA**\uFF1A[\u5DF2\u8BC6\u522B\u7684\u73B0\u6709\u6A21\u5F0F]\n- **\u4E0D\u80FD\u7834\u574F**\uFF1A[\u5173\u952E\u4F9D\u8D56]\n- **\u53EF\u5B89\u5168\u66F4\u6539**\uFF1A[\u9694\u79BB\u7684\u4EE3\u7801\u533A\u57DF]\n- **\u9700\u8981\u8FC1\u79FB**\uFF1A[\u7834\u574F\u6027\u53D8\u66F4\u7684\u5F71\u54CD]\n\n**\u5C06 phase-2 \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n# \u9636\u6BB5 3\uFF1A\u6D4B\u8BD5\u8BC4\u4F30\uFF08\u9A8C\u8BC1\u7B56\u7565\uFF09\n\n**\u5C06 phase-3 \u6807\u8BB0\u4E3A in_progress\u3002**\n\n## 3.1\uFF1A\u68C0\u6D4B\u6D4B\u8BD5\u57FA\u7840\u8BBE\u65BD\n\n```bash\n# Check for test commands\ncat package.json | jq '.scripts | keys[] | select(test(\"test\"))'\n\n# Or for Python\nls -la pytest.ini pyproject.toml setup.cfg\n\n# Or for Go\nls -la *_test.go\n```\n\n## 3.2\uFF1A\u5206\u6790\u6D4B\u8BD5\u8986\u76D6\u7387\n\n```\n// Find all tests related to target\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=false, // Need this synchronously\n prompt=\"Analyze test coverage for [TARGET]:\n 1. Which test files cover this code?\n 2. What test cases exist?\n 3. Are there integration tests?\n 4. What edge cases are tested?\n 5. Estimated coverage percentage?\"\n)\n```\n\n## 3.3\uFF1A\u786E\u5B9A\u9A8C\u8BC1\u7B56\u7565\n\n\u57FA\u4E8E\u6D4B\u8BD5\u5206\u6790\uFF1A\n\n| \u8986\u76D6\u7387\u7B49\u7EA7 | \u7B56\u7565 |\n|----------------|----------|\n| \u9AD8\uFF08>80%\uFF09 | \u6BCF\u4E00\u6B65\u540E\u8FD0\u884C\u73B0\u6709\u6D4B\u8BD5 |\n| \u4E2D\uFF0850-80%\uFF09 | \u8FD0\u884C\u6D4B\u8BD5 + \u6DFB\u52A0\u5B89\u5168\u65AD\u8A00 |\n| \u4F4E\uFF08<50%\uFF09 | **\u6682\u505C**\uFF1A\u5EFA\u8BAE\u5148\u6DFB\u52A0\u6D4B\u8BD5 |\n| \u65E0 | **\u963B\u6B62**\uFF1A\u62D2\u7EDD\u6FC0\u8FDB\u91CD\u6784 |\n\n**\u5982\u679C\u8986\u76D6\u7387\u4E3A\u4F4E\u6216\u65E0\uFF0C\u8BE2\u95EE\u7528\u6237\uFF1A**\n\n```\nTest coverage for [TARGET] is [LEVEL].\n\n**Risk Assessment**: Refactoring without adequate tests is dangerous.\n\nOptions:\n1. Add tests first, then refactor (RECOMMENDED)\n2. Proceed with extra caution, manual verification required\n3. Abort refactoring\n\nWhich approach do you prefer?\n```\n\n## 3.4\uFF1A\u8BB0\u5F55\u9A8C\u8BC1\u8BA1\u5212\n\n```\n## VERIFICATION PLAN\n\n### Test Commands\n- Unit: `bun test` / `npm test` / `pytest` / etc.\n- Integration: [command if exists]\n- Type check: `tsc --noEmit` / `pyright` / etc.\n\n### Verification Checkpoints\nAfter each refactoring step:\n1. lsp_diagnostics \u2192 zero new errors\n2. Run test command \u2192 all pass\n3. Type check \u2192 clean\n\n### Regression Indicators\n- [Specific test that must pass]\n- [Behavior that must be preserved]\n- [API contract that must not change]\n```\n\n**\u5C06 phase-3 \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n# \u9636\u6BB5 4\uFF1A\u8BA1\u5212\u751F\u6210\uFF08\u89C4\u5212\u4EE3\u7406\uFF09\n\n**\u5C06 phase-4 \u6807\u8BB0\u4E3A in_progress\u3002**\n\n## 4.1\uFF1A\u8C03\u7528\u89C4\u5212\u4EE3\u7406\n\n```\nTask(\n subagent_type=\"plan\",\n prompt=\"Create a detailed refactoring plan:\n\n ## Refactoring Goal\n [User's original request]\n\n ## Codemap (from Phase 2)\n [Insert codemap here]\n\n ## Test Coverage (from Phase 3)\n [Insert verification plan here]\n\n ## Constraints\n - MUST follow existing patterns: [list]\n - MUST NOT break: [critical paths]\n - MUST run tests after each step\n\n ## Requirements\n 1. Break down into atomic refactoring steps\n 2. Each step must be independently verifiable\n 3. Order steps by dependency (what must happen first)\n 4. Specify exact files and line ranges for each step\n 5. Include rollback strategy for each step\n 6. Define commit checkpoints\"\n)\n```\n\n## 4.2\uFF1A\u5BA1\u67E5\u548C\u9A8C\u8BC1\u8BA1\u5212\n\nAfter receiving plan from Plan agent:\n\n1. **Verify completeness**: All identified files addressed?\n2. **Verify safety**: Each step reversible?\n3. **Verify order**: Dependencies respected?\n4. **Verify verification**: Test commands specified?\n\n## 4.3\uFF1A\u6CE8\u518C\u8BE6\u7EC6\u5F85\u529E\u4E8B\u9879\n\nConvert Plan agent output into granular todos:\n\n```\nTodoWrite([\n // Each step from the plan becomes a todo\n {\"id\": \"refactor-1\", \"content\": \"Step 1: [description]\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"verify-1\", \"content\": \"Verify Step 1: run tests\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"refactor-2\", \"content\": \"Step 2: [description]\", \"status\": \"pending\", \"priority\": \"medium\"},\n {\"id\": \"verify-2\", \"content\": \"Verify Step 2: run tests\", \"status\": \"pending\", \"priority\": \"medium\"},\n // ... continue for all steps\n])\n```\n\n**\u5C06 phase-4 \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n# \u9636\u6BB5 5\uFF1A\u6267\u884C\u91CD\u6784\uFF08\u786E\u5B9A\u6027\u6267\u884C\uFF09\n\n**\u5C06 phase-5 \u6807\u8BB0\u4E3A in_progress\u3002**\n\n## 5.1\uFF1A\u6267\u884C\u534F\u8BAE\n\n\u5BF9\u6BCF\u4E2A\u91CD\u6784\u6B65\u9AA4\uFF1A\n\n### \u6B65\u9AA4\u524D\n1. Mark step todo as `in_progress`\n2. Read current file state\n3. Verify lsp_diagnostics is baseline\n\n### \u6267\u884C\u6B65\u9AA4\n\u4F7F\u7528\u9002\u5F53\u7684\u5DE5\u5177\uFF1A\n\n**\u5BF9\u4E8E\u7B26\u53F7\u91CD\u547D\u540D\uFF1A**\n```typescript\nlsp_prepare_rename(filePath, line, character) // Validate rename is possible\nlsp_rename(filePath, line, character, newName) // Execute rename\n```\n\n**\u5BF9\u4E8E\u6A21\u5F0F\u8F6C\u6362\uFF1A**\n```typescript\n// Preview first\nast_grep_replace(pattern, rewrite, lang, dryRun=true)\n\n// If preview looks good, execute\nast_grep_replace(pattern, rewrite, lang, dryRun=false)\n```\n\n**\u5BF9\u4E8E\u7ED3\u6784\u6027\u66F4\u6539\uFF1A**\n```typescript\n// Use Edit tool for precise changes\nedit(filePath, oldString, newString)\n```\n\n### \u6B65\u9AA4\u540E\u9A8C\u8BC1\uFF08\u5F3A\u5236\uFF09\n\n```typescript\n// 1. Check diagnostics\nlsp_diagnostics(filePath) // Must be clean or same as baseline\n\n// 2. Run tests\nbash(\"bun test\") // Or appropriate test command\n\n// 3. Type check\nbash(\"tsc --noEmit\") // Or appropriate type check\n```\n\n### \u6B65\u9AA4\u5B8C\u6210\n1. \u5982\u679C\u9A8C\u8BC1\u901A\u8FC7 \u2192 \u5C06\u6B65\u9AA4\u5F85\u529E\u6807\u8BB0\u4E3A `completed`\n2. \u5982\u679C\u9A8C\u8BC1\u5931\u8D25 \u2192 **\u505C\u6B62\u5E76\u4FEE\u590D**\n\n## 5.2\uFF1A\u5931\u8D25\u6062\u590D\u534F\u8BAE\n\n\u5982\u679C\u4EFB\u4F55\u9A8C\u8BC1\u5931\u8D25\uFF1A\n\n1. **\u7ACB\u5373\u505C\u6B62**\n2. **\u56DE\u9000**\u5931\u8D25\u7684\u66F4\u6539\n3. **\u8BCA\u65AD**\u51FA\u9519\u539F\u56E0\n4. **\u9009\u9879**\uFF1A\n - \u4FEE\u590D\u95EE\u9898\u5E76\u91CD\u8BD5\n - \u8DF3\u8FC7\u6B64\u6B65\u9AA4\uFF08\u5982\u679C\u53EF\u9009\uFF09\n - \u54A8\u8BE2 Oracle \u4EE3\u7406\u83B7\u53D6\u5E2E\u52A9\n - \u8BF7\u6C42\u7528\u6237\u6307\u5BFC\n\n**\u7EDD\u4E0D\u8981\u5728\u6D4B\u8BD5\u5931\u8D25\u7684\u60C5\u51B5\u4E0B\u8FDB\u5165\u4E0B\u4E00\u6B65\u3002**\n\n## 5.3\uFF1A\u63D0\u4EA4\u68C0\u67E5\u70B9\n\nAfter each logical group of changes:\n\n```bash\ngit add [changed-files]\ngit commit -m \"refactor(scope): description\n\n[details of what was changed and why]\"\n```\n\n**\u6240\u6709\u91CD\u6784\u6B65\u9AA4\u5B8C\u6210\u540E\uFF0C\u5C06 phase-5 \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n# \u9636\u6BB5 6\uFF1A\u6700\u7EC8\u9A8C\u8BC1\uFF08\u56DE\u5F52\u68C0\u67E5\uFF09\n\n**\u5C06 phase-6 \u6807\u8BB0\u4E3A in_progress\u3002**\n\n## 6.1\uFF1A\u5B8C\u6574\u6D4B\u8BD5\u5957\u4EF6\n\n```bash\n# Run complete test suite\nbun test # or npm test, pytest, go test, etc.\n```\n\n## 6.2\uFF1A\u7C7B\u578B\u68C0\u67E5\n\n```bash\n# Full type check\ntsc --noEmit # or equivalent\n```\n\n## 6.3\uFF1ALint \u68C0\u67E5\n\n```bash\n# Run linter\neslint . # or equivalent\n```\n\n## 6.4\uFF1A\u6784\u5EFA\u9A8C\u8BC1\uFF08\u5982\u9002\u7528\uFF09\n\n```bash\n# Ensure build still works\nbun run build # or npm run build, etc.\n```\n\n## 6.5\uFF1A\u6700\u7EC8\u8BCA\u65AD\n\n```typescript\n// Check all changed files\nfor (file of changedFiles) {\n lsp_diagnostics(file) // Must all be clean\n}\n```\n\n## 6.6\uFF1A\u751F\u6210\u603B\u7ED3\n\n```markdown\n## Refactoring Complete\n\n### What Changed\n- [List of changes made]\n\n### Files Modified\n- `path/to/file.ts` - [what changed]\n- `path/to/file2.ts` - [what changed]\n\n### Verification Results\n- Tests: PASSED (X/Y passing)\n- Type Check: CLEAN\n- Lint: CLEAN\n- Build: SUCCESS\n\n### No Regressions Detected\nAll existing tests pass. No new errors introduced.\n```\n\n**\u5C06 phase-6 \u6807\u8BB0\u4E3A completed\u3002**\n\n---\n\n# \u5173\u952E\u89C4\u5219\n\n## \u7981\u6B62\u64CD\u4F5C\n- \u66F4\u6539\u540E\u8DF3\u8FC7 lsp_diagnostics \u68C0\u67E5\n- \u5728\u6D4B\u8BD5\u5931\u8D25\u7684\u60C5\u51B5\u4E0B\u7EE7\u7EED\n- \u5728\u4E0D\u4E86\u89E3\u5F71\u54CD\u7684\u60C5\u51B5\u4E0B\u8FDB\u884C\u66F4\u6539\n- \u4F7F\u7528 `as any`\u3001`@ts-ignore`\u3001`@ts-expect-error`\n- \u5220\u9664\u6D4B\u8BD5\u4EE5\u4F7F\u5176\u901A\u8FC7\n- \u63D0\u4EA4\u635F\u574F\u7684\u4EE3\u7801\n- \u5728\u4E0D\u7406\u89E3\u73B0\u6709\u6A21\u5F0F\u7684\u60C5\u51B5\u4E0B\u8FDB\u884C\u91CD\u6784\n\n## \u5FC5\u987B\u64CD\u4F5C\n- \u5728\u66F4\u6539\u4E4B\u524D\u5148\u7406\u89E3\n- \u5728\u5E94\u7528\u4E4B\u524D\u5148\u9884\u89C8\uFF08ast_grep dryRun=true\uFF09\n- \u6BCF\u6B21\u66F4\u6539\u540E\u8FDB\u884C\u9A8C\u8BC1\n- \u9075\u5FAA\u73B0\u6709\u4EE3\u7801\u5E93\u6A21\u5F0F\n- \u5B9E\u65F6\u66F4\u65B0\u5F85\u529E\u4E8B\u9879\n- \u5728\u903B\u8F91\u68C0\u67E5\u70B9\u63D0\u4EA4\n- \u7ACB\u5373\u62A5\u544A\u95EE\u9898\n\n## \u4E2D\u6B62\u6761\u4EF6\n\u5982\u679C\u53D1\u751F\u4EE5\u4E0B\u4EFB\u4F55\u60C5\u51B5\uFF0C**\u505C\u6B62\u5E76\u54A8\u8BE2\u7528\u6237**\uFF1A\n- \u76EE\u6807\u4EE3\u7801\u7684\u6D4B\u8BD5\u8986\u76D6\u7387\u4E3A\u96F6\n- \u66F4\u6539\u5C06\u7834\u574F\u516C\u5171 API\n- \u91CD\u6784\u8303\u56F4\u4E0D\u660E\u786E\n- \u8FDE\u7EED 3 \u6B21\u9A8C\u8BC1\u5931\u8D25\n- \u8FDD\u53CD\u7528\u6237\u5B9A\u4E49\u7684\u7EA6\u675F\n\n---\n\n# \u5DE5\u5177\u4F7F\u7528\u7406\u5FF5\n\n\u4F60\u5DF2\u7ECF\u4E86\u89E3\u8FD9\u4E9B\u5DE5\u5177\u3002\u667A\u80FD\u5730\u4F7F\u7528\u5B83\u4EEC\uFF1A\n\n## LSP \u5DE5\u5177\n\u5229\u7528 LSP \u5DE5\u5177\u8FDB\u884C\u7CBE\u786E\u5206\u6790\u3002\u5173\u952E\u6A21\u5F0F\uFF1A\n- **\u5728\u66F4\u6539\u524D\u5148\u7406\u89E3**\uFF1A\u4F7F\u7528 `LspGotoDefinition` \u638C\u63E1\u4E0A\u4E0B\u6587\n- **\u5F71\u54CD\u5206\u6790**\uFF1A\u4F7F\u7528 `LspFindReferences` \u5728\u4FEE\u6539\u524D\u6620\u5C04\u6240\u6709\u4F7F\u7528\u70B9\n- **\u5B89\u5168\u91CD\u6784**\uFF1A`lsp_prepare_rename` \u2192 `lsp_rename` \u7528\u4E8E\u7B26\u53F7\u91CD\u547D\u540D\n- **\u6301\u7EED\u9A8C\u8BC1**\uFF1A\u6BCF\u6B21\u66F4\u6539\u540E\u8FD0\u884C `lsp_diagnostics`\n\n## AST-Grep\n\u4F7F\u7528 `ast_grep_search` \u548C `ast_grep_replace` \u8FDB\u884C\u7ED3\u6784\u6027\u8F6C\u6362\u3002\n**\u5173\u952E**\uFF1A\u59CB\u7EC8\u5148 `dryRun=true`\uFF0C\u5BA1\u67E5\uFF0C\u7136\u540E\u518D\u6267\u884C\u3002\n\n## \u4EE3\u7406\n- `explore`\uFF1A\u5E76\u884C\u4EE3\u7801\u5E93\u6A21\u5F0F\u53D1\u73B0\n- `plan`\uFF1A\u8BE6\u7EC6\u91CD\u6784\u8BA1\u5212\u751F\u6210\n- `oracle`\uFF1A\u9488\u5BF9\u590D\u6742\u67B6\u6784\u51B3\u7B56\u548C\u8C03\u8BD5\u7684\u53EA\u8BFB\u54A8\u8BE2\n- `librarian`\uFF1A\u9047\u5230\u5DF2\u5F03\u7528\u65B9\u6CD5\u6216\u5E93\u8FC1\u79FB\u4EFB\u52A1\u65F6**\u4E3B\u52A8\u4F7F\u7528**\u3002\u67E5\u8BE2\u5B98\u65B9\u6587\u6863\u548C\u5F00\u6E90\u793A\u4F8B\u4EE5\u83B7\u53D6\u73B0\u4EE3\u66FF\u4EE3\u65B9\u6848\u3002\n\n## \u5DF2\u5F03\u7528\u4EE3\u7801\u548C\u5E93\u8FC1\u79FB\n\u5728\u91CD\u6784\u8FC7\u7A0B\u4E2D\u9047\u5230\u5DF2\u5F03\u7528\u7684\u65B9\u6CD5/API \u65F6\uFF1A\n1. \u89E6\u53D1 `librarian` \u67E5\u627E\u63A8\u8350\u7684\u73B0\u4EE3\u66FF\u4EE3\u65B9\u6848\n2. **\u9664\u975E\u7528\u6237\u660E\u786E\u8BF7\u6C42\u8FC1\u79FB\uFF0C\u5426\u5219\u4E0D\u8981\u81EA\u52A8\u5347\u7EA7\u5230\u6700\u65B0\u7248\u672C**\n3. \u5982\u679C\u7528\u6237\u8BF7\u6C42\u5E93\u8FC1\u79FB\uFF0C\u4F7F\u7528 `librarian` \u83B7\u53D6\u6700\u65B0\u7684 API \u6587\u6863\u540E\u518D\u8FDB\u884C\u66F4\u6539\n\n---\n\n**\u8BB0\u4F4F\uFF1A\u6CA1\u6709\u6D4B\u8BD5\u7684\u91CD\u6784\u662F\u9C81\u83BD\u7684\u3002\u6CA1\u6709\u7406\u89E3\u7684\u91CD\u6784\u662F\u7834\u574F\u6027\u7684\u3002\u6B64\u547D\u4EE4\u786E\u4FDD\u4F60\u4E24\u8005\u90FD\u4E0D\u4F1A\u505A\u3002**\n\n<user-request>\n$ARGUMENTS\n</user-request>\n";
@@ -1 +1 @@
1
- export declare const REMOVE_AI_SLOPS_TEMPLATE = "# Remove AI Slops Command\n\n## What this command does\nAnalyzes all files changed in the current branch (compared to parent commit), removes AI-generated code smells in parallel, then critically reviews the changes to ensure safety and behavior preservation. Fixes any issues found during review.\n\n## Step 0: Task Planning\n\nUse TodoWrite to create the task list:\n1. Get changed files from branch\n2. Run ai-slop-remover on each file in parallel\n3. Critically review all changes\n4. Fix any issues found\n\n## Role Definition\nYou are a senior code quality engineer specialized in identifying and removing AI-generated code patterns while preserving original functionality. You have deep expertise in code review, refactoring safety, and behavioral preservation.\n\n## Process\n\n### Phase 1: Identify Changed Files\nDetect the repository base branch dynamically, then get all changed files in the current branch:\n```bash\nBASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\")\ngit diff $(git merge-base \"$BASE_BRANCH\" HEAD)..HEAD --name-only\n```\n\nIf `git symbolic-ref refs/remotes/origin/HEAD` is unavailable, detect the base branch at runtime using the repo's configured remote default branch. Only fall back to `main` as a last resort.\n\n### Phase 2: Parallel AI Slop Removal\nFor each changed file, spawn an agent in parallel using the Task tool with the ai-slop-remover skill:\n\n```\ntask(category=\"quick\", load_skills=[\"ai-slop-remover\"], run_in_background=true, description=\"Remove AI slops from {filename}\", prompt=\"Remove AI slops from: {file_path}\")\n```\n\n**CRITICAL**: Launch ALL agents in a SINGLE message with multiple Task tool calls for maximum parallelism.\n\nBefore running ai-slop-remover on each file, save a file-specific rollback artifact that captures only the delta introduced by the slop-removal pass. Use a safe pattern such as generating a per-file patch and reverse-applying it if review fails.\n\nDo NOT use `git checkout -- {file_path}` or any rollback that discards pre-existing branch changes in the file.\n\n### Phase 3: Critical Review\nAfter all ai-slop-remover agents complete, perform a critical review with the following checklist:\n\n**Safety Verification**:\n- [ ] No functional logic was accidentally removed\n- [ ] All error handling is preserved\n- [ ] Type hints remain correct and complete\n- [ ] Import statements are still valid\n- [ ] No breaking changes to public APIs\n\n**Behavior Preservation**:\n- [ ] Return values unchanged\n- [ ] Side effects unchanged\n- [ ] Exception behavior unchanged\n- [ ] Edge case handling preserved\n\n**Code Quality**:\n- [ ] Removed changes are genuinely AI slop (not intentional patterns)\n- [ ] Remaining code follows project conventions\n- [ ] No orphaned code or dead references\n\n### Phase 4: Fix Issues\nIf any issues are found during critical review:\n1. Identify the specific problem\n2. Explain why it's a problem\n3. Revert only the ai-slop-remover delta using the saved per-file patch or an equivalent reverse-apply workflow\n4. If remaining ai-slops are found after reverting, remove them by editing the file yourself - with parallel tool calls, per-file\n5. Verify the fix doesn't introduce new issues\n\n## Output Format\n\n### Summary Report\n```\n## AI Slop Removal Summary\n\n### Files Processed\n- file1.py: X changes\n- file2.py: Y changes\n\n### Critical Review Results\n- Safety: PASS/FAIL\n- Behavior: PASS/FAIL\n- Quality: PASS/FAIL\n\n### Issues Found & Fixed\n1. [Issue description] -> [Fix applied]\n\n### Final Status\n[CLEAN / ISSUES FIXED / REQUIRES ATTENTION]\n```\n\n## Quality Assurance\n- NEVER remove code that serves a functional purpose\n- ALWAYS verify changes compile/parse correctly\n- ALWAYS preserve test coverage\n- If uncertain about a change, err on the side of keeping the original code";
1
+ export declare const REMOVE_AI_SLOPS_TEMPLATE = "# \u79FB\u9664 AI \u75D5\u8FF9\u547D\u4EE4\n\n## \u6B64\u547D\u4EE4\u7684\u529F\u80FD\n\u5206\u6790\u5F53\u524D\u5206\u652F\u4E2D\u6240\u6709\u66F4\u6539\u7684\u6587\u4EF6\uFF08\u4E0E\u7236\u63D0\u4EA4\u6BD4\u8F83\uFF09\uFF0C\u5E76\u884C\u79FB\u9664 AI \u751F\u6210\u7684\u4EE3\u7801\u5F02\u5473\uFF0C\u7136\u540E\u4E25\u683C\u5BA1\u67E5\u66F4\u6539\u4EE5\u786E\u4FDD\u5B89\u5168\u548C\u884C\u4E3A\u4FDD\u7559\u3002\u4FEE\u590D\u5BA1\u67E5\u8FC7\u7A0B\u4E2D\u53D1\u73B0\u7684\u4EFB\u4F55\u95EE\u9898\u3002\n\n## \u7B2C 0 \u6B65\uFF1A\u4EFB\u52A1\u89C4\u5212\n\n\u4F7F\u7528 TodoWrite \u521B\u5EFA\u4EFB\u52A1\u5217\u8868\uFF1A\n1. \u4ECE\u5206\u652F\u83B7\u53D6\u66F4\u6539\u7684\u6587\u4EF6\n2. \u5728\u6BCF\u4E2A\u6587\u4EF6\u4E0A\u5E76\u884C\u8FD0\u884C ai-slop-remover\n3. \u4E25\u683C\u5BA1\u67E5\u6240\u6709\u66F4\u6539\n4. \u4FEE\u590D\u53D1\u73B0\u7684\u4EFB\u4F55\u95EE\u9898\n\n## \u89D2\u8272\u5B9A\u4E49\n\u4F60\u662F\u4E00\u540D\u9AD8\u7EA7\u4EE3\u7801\u8D28\u91CF\u5DE5\u7A0B\u5E08\uFF0C\u4E13\u95E8\u8D1F\u8D23\u8BC6\u522B\u548C\u79FB\u9664 AI \u751F\u6210\u7684\u4EE3\u7801\u6A21\u5F0F\uFF0C\u540C\u65F6\u4FDD\u7559\u539F\u59CB\u529F\u80FD\u3002\u4F60\u5728\u4EE3\u7801\u5BA1\u67E5\u3001\u91CD\u6784\u5B89\u5168\u548C\u884C\u4E3A\u4FDD\u7559\u65B9\u9762\u62E5\u6709\u6DF1\u539A\u7684\u4E13\u4E1A\u77E5\u8BC6\u3002\n\n## \u6D41\u7A0B\n\n### \u9636\u6BB5 1\uFF1A\u8BC6\u522B\u66F4\u6539\u7684\u6587\u4EF6\n\u52A8\u6001\u68C0\u6D4B\u4ED3\u5E93\u7684\u57FA\u7840\u5206\u652F\uFF0C\u7136\u540E\u83B7\u53D6\u5F53\u524D\u5206\u652F\u4E2D\u6240\u6709\u66F4\u6539\u7684\u6587\u4EF6\uFF1A\n```bash\nBASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\")\ngit diff $(git merge-base \"$BASE_BRANCH\" HEAD)..HEAD --name-only\n```\n\nIf `git symbolic-ref refs/remotes/origin/HEAD` is unavailable, detect the base branch at runtime using the repo's configured remote default branch. Only fall back to `main` as a last resort.\n\n### \u9636\u6BB5 2\uFF1A\u5E76\u884C AI \u75D5\u8FF9\u79FB\u9664\n\u5BF9\u6BCF\u4E2A\u66F4\u6539\u7684\u6587\u4EF6\uFF0C\u4F7F\u7528 Task \u5DE5\u5177\u548C ai-slop-remover \u6280\u80FD\u5E76\u884C\u751F\u6210\u4EE3\u7406\uFF1A\n\n```\ntask(category=\"quick\", load_skills=[\"ai-slop-remover\"], run_in_background=true, description=\"Remove AI slops from {filename}\", prompt=\"Remove AI slops from: {file_path}\")\n```\n\n**\u5173\u952E**\uFF1A\u5728\u5355\u6761\u6D88\u606F\u4E2D\u901A\u8FC7\u591A\u6B21 Task \u5DE5\u5177\u8C03\u7528\u542F\u52A8\u6240\u6709\u4EE3\u7406\uFF0C\u4EE5\u5B9E\u73B0\u6700\u5927\u5E76\u884C\u5EA6\u3002\n\n\u5728\u8FD0\u884C ai-slop-remover \u5904\u7406\u6BCF\u4E2A\u6587\u4EF6\u4E4B\u524D\uFF0C\u4FDD\u5B58\u6587\u4EF6\u7279\u5B9A\u7684\u56DE\u6EDA\u5DE5\u4EF6\uFF0C\u4EC5\u6355\u83B7 AI \u75D5\u8FF9\u79FB\u9664\u8FC7\u7A0B\u5F15\u5165\u7684\u5DEE\u5F02\u3002\u4F7F\u7528\u5B89\u5168\u6A21\u5F0F\uFF0C\u4F8B\u5982\u751F\u6210\u6BCF\u4E2A\u6587\u4EF6\u7684\u8865\u4E01\uFF0C\u5E76\u5728\u5BA1\u67E5\u5931\u8D25\u65F6\u53CD\u5411\u5E94\u7528\u3002\n\n\u4E0D\u8981\u4F7F\u7528 `git checkout -- {file_path}` \u6216\u4EFB\u4F55\u4F1A\u4E22\u5F03\u6587\u4EF6\u4E2D\u5DF2\u6709\u5206\u652F\u66F4\u6539\u7684\u56DE\u6EDA\u64CD\u4F5C\u3002\n\n### \u9636\u6BB5 3\uFF1A\u4E25\u683C\u5BA1\u67E5\n\u5728\u6240\u6709 ai-slop-remover \u4EE3\u7406\u5B8C\u6210\u540E\uFF0C\u4F7F\u7528\u4EE5\u4E0B\u68C0\u67E5\u6E05\u5355\u8FDB\u884C\u4E25\u683C\u5BA1\u67E5\uFF1A\n\n**\u5B89\u5168\u9A8C\u8BC1**\uFF1A\n- [ ] \u672A\u610F\u5916\u79FB\u9664\u529F\u80FD\u6027\u903B\u8F91\n- [ ] \u6240\u6709\u9519\u8BEF\u5904\u7406\u4FDD\u7559\n- [ ] \u7C7B\u578B\u63D0\u793A\u4FDD\u6301\u6B63\u786E\u548C\u5B8C\u6574\n- [ ] \u5BFC\u5165\u8BED\u53E5\u4ECD\u7136\u6709\u6548\n- [ ] \u516C\u5171 API \u65E0\u7834\u574F\u6027\u66F4\u6539\n\n**\u884C\u4E3A\u4FDD\u7559**\uFF1A\n- [ ] \u8FD4\u56DE\u503C\u4E0D\u53D8\n- [ ] \u526F\u4F5C\u7528\u4E0D\u53D8\n- [ ] \u5F02\u5E38\u884C\u4E3A\u4E0D\u53D8\n- [ ] \u8FB9\u754C\u60C5\u51B5\u5904\u7406\u4FDD\u7559\n\n**\u4EE3\u7801\u8D28\u91CF**\uFF1A\n- [ ] \u79FB\u9664\u7684\u5185\u5BB9\u786E\u5B9E\u662F AI \u75D5\u8FF9\uFF08\u800C\u975E\u6709\u610F\u4E3A\u4E4B\u7684\u6A21\u5F0F\uFF09\n- [ ] \u5269\u4F59\u4EE3\u7801\u9075\u5FAA\u9879\u76EE\u7EA6\u5B9A\n- [ ] \u65E0\u5B64\u7ACB\u4EE3\u7801\u6216\u6B7B\u5F15\u7528\n\n### \u9636\u6BB5 4\uFF1A\u4FEE\u590D\u95EE\u9898\n\u5982\u679C\u5728\u4E25\u683C\u5BA1\u67E5\u8FC7\u7A0B\u4E2D\u53D1\u73B0\u4EFB\u4F55\u95EE\u9898\uFF1A\n1. \u8BC6\u522B\u5177\u4F53\u95EE\u9898\n2. \u89E3\u91CA\u4E3A\u4EC0\u4E48\u8FD9\u662F\u4E00\u4E2A\u95EE\u9898\n3. \u4F7F\u7528\u4FDD\u5B58\u7684\u6BCF\u6587\u4EF6\u8865\u4E01\u6216\u7B49\u6548\u7684\u53CD\u5411\u5E94\u7528\u5DE5\u4F5C\u6D41\uFF0C\u4EC5\u56DE\u9000 AI \u75D5\u8FF9\u79FB\u9664\u7684\u5DEE\u5F02\n4. \u5982\u679C\u56DE\u9000\u540E\u53D1\u73B0\u4ECD\u6709 AI \u75D5\u8FF9\uFF0C\u81EA\u884C\u7F16\u8F91\u6587\u4EF6\u79FB\u9664\u2014\u2014\u4F7F\u7528\u5E76\u884C\u5DE5\u5177\u8C03\u7528\uFF0C\u9010\u6587\u4EF6\u5904\u7406\n5. \u9A8C\u8BC1\u4FEE\u590D\u4E0D\u4F1A\u5F15\u5165\u65B0\u95EE\u9898\n\n## \u8F93\u51FA\u683C\u5F0F\n\n### \u603B\u7ED3\u62A5\u544A\n```\n## AI Slop Removal Summary\n\n### Files Processed\n- file1.py: X changes\n- file2.py: Y changes\n\n### Critical Review Results\n- Safety: PASS/FAIL\n- Behavior: PASS/FAIL\n- Quality: PASS/FAIL\n\n### Issues Found & Fixed\n1. [Issue description] -> [Fix applied]\n\n### Final Status\n[CLEAN / ISSUES FIXED / REQUIRES ATTENTION]\n```\n\n## \u8D28\u91CF\u4FDD\u8BC1\n- \u7EDD\u4E0D\u5220\u9664\u5177\u6709\u529F\u80FD\u7528\u9014\u7684\u4EE3\u7801\n- \u59CB\u7EC8\u9A8C\u8BC1\u66F4\u6539\u7F16\u8BD1/\u89E3\u6790\u6B63\u786E\n- \u59CB\u7EC8\u4FDD\u7559\u6D4B\u8BD5\u8986\u76D6\u7387\n- \u5982\u679C\u4E0D\u786E\u5B9A\u67D0\u4E2A\u66F4\u6539\uFF0C\u5B81\u53EF\u4FDD\u7559\u539F\u59CB\u4EE3\u7801";
@@ -1,6 +1,5 @@
1
- import type { BuiltinCommandName } from "../../config/schema/commands";
2
- export type { BuiltinCommandName };
3
1
  import type { CommandDefinition } from "../claude-code-command-loader";
2
+ export type BuiltinCommandName = "init-deep" | "ralph-loop" | "cancel-ralph" | "ulw-loop" | "refactor" | "start-work" | "stop-continuation" | "handoff" | "remove-ai-slops";
4
3
  export interface BuiltinCommandConfig {
5
4
  disabled_commands?: BuiltinCommandName[];
6
5
  }
@@ -1 +1 @@
1
- export declare const GIT_MASTER_COMMIT_WORKFLOW_SECTION = "## PHASE 0: Parallel Context Gathering (MANDATORY FIRST STEP)\n\n<parallel_analysis>\n**Execute ALL of the following commands IN PARALLEL to minimize latency:**\n\n```bash\n# Group 1: Current state\ngit status\ngit diff --staged --stat\ngit diff --stat\n\n# Group 2: History context \ngit log -30 --oneline\ngit log -30 --pretty=format:\"%s\"\n\n# Group 3: Branch context\ngit branch --show-current\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null\ngit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo \"NO_UPSTREAM\"\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)..HEAD 2>/dev/null\n```\n\n**Capture these data points simultaneously:**\n1. What files changed (staged vs unstaged)\n2. Recent 30 commit messages for style detection\n3. Branch position relative to main/master\n4. Whether branch has upstream tracking\n5. Commits that would go in PR (local only)\n</parallel_analysis>\n\n---\n\n## PHASE 1: Style Detection (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<style_detection>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the analysis result before moving to Phase 2.\n\n### 1.1 Language Detection\n\n```\nCount from git log -30:\n- Chinese characters (\\u4e00-\\u9fff): N commits\n- English only: K commits\n- Mixed: L commits\n\nDECISION:\n- If Chinese >= 50% -> CHINESE\n- If English >= 50% -> ENGLISH\n- If Mixed -> Use MAJORITY language\n```\n\n### 1.2 Commit Style Classification\n\n| Style | Pattern | Example | Detection Regex |\n|-------|---------|---------|-----------------|\n| `SEMANTIC` | `type: message` or `type(scope): message` | `feat: add login` | `/^(feat\\|fix\\|chore\\|refactor\\|docs\\|test\\|ci\\|style\\|perf\\|build)(\\(.+\\))?:/` |\n| `PLAIN` | Just description, no prefix | `Add login feature` | No conventional prefix, >3 words |\n| `SENTENCE` | Full sentence style | `Implemented the new login flow` | Complete grammatical sentence |\n| `SHORT` | Minimal keywords | `format`, `lint` | 1-3 words only |\n\n**Detection Algorithm:**\n```\nsemantic_count = commits matching semantic regex\nplain_count = non-semantic commits with >3 words\nshort_count = commits with <=3 words\n\nIF semantic_count >= 15 (50%): STYLE = SEMANTIC\nELSE IF plain_count >= 15: STYLE = PLAIN \nELSE IF short_count >= 10: STYLE = SHORT\nELSE: STYLE = PLAIN (safe default)\n```\n\n### 1.3 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 2. NO EXCEPTIONS.**\n\n```\nSTYLE DETECTION RESULT\n======================\nAnalyzed: 30 commits from git log\n\nLanguage: [CHINESE | ENGLISH]\n - Chinese commits: N (X%)\n - English commits: K (Z%)\n\nStyle: [SEMANTIC | PLAIN | SENTENCE | SHORT]\n - Semantic (feat:, fix:, etc): N (X%)\n - Plain: M (Y%)\n - Short: K (Z%)\n\nReference examples from repo:\n 1. \"actual commit message from log\"\n 2. \"actual commit message from log\"\n 3. \"actual commit message from log\"\n\nAll commits will follow: [LANGUAGE] + [STYLE]\n```\n\n**IF YOU SKIP THIS OUTPUT, YOUR COMMITS WILL BE WRONG. STOP AND REDO.**\n</style_detection>\n\n---\n\n## PHASE 2: Branch Context Analysis\n\n<branch_analysis>\n### 2.1 Determine Branch State\n\n```\nBRANCH_STATE:\n current_branch: <name>\n has_upstream: true | false\n commits_ahead: N # Local-only commits\n merge_base: <hash>\n \nREWRITE_SAFETY:\n - If has_upstream AND commits_ahead > 0 AND already pushed:\n -> WARN before force push\n - If no upstream OR all commits local:\n -> Safe for aggressive rewrite (fixup, reset, rebase)\n - If on main/master:\n -> NEVER rewrite, only new commits\n```\n\n### 2.2 History Rewrite Strategy Decision\n\n```\nIF current_branch == main OR current_branch == master:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> Never fixup, never rebase\n\nELSE IF commits_ahead == 0:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> No history to rewrite\n\nELSE IF all commits are local (not pushed):\n -> STRATEGY = AGGRESSIVE_REWRITE\n -> Fixup freely, reset if needed, rebase to clean\n\nELSE IF pushed but not merged:\n -> STRATEGY = CAREFUL_REWRITE \n -> Fixup OK but warn about force push\n```\n</branch_analysis>\n\n---\n\n## PHASE 3: Atomic Unit Planning (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<atomic_planning>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the commit plan before moving to Phase 4.\n\n### 3.0 Calculate Minimum Commit Count FIRST\n\n```\nFORMULA: min_commits = ceil(file_count / 3)\n\n 3 files -> min 1 commit\n 5 files -> min 2 commits\n 9 files -> min 3 commits\n15 files -> min 5 commits\n```\n\n**If your planned commit count < min_commits -> WRONG. SPLIT MORE.**\n\n### 3.1 Split by Directory/Module FIRST (Primary Split)\n\n**RULE: Different directories = Different commits (almost always)**\n\n```\nExample: 8 changed files\n - app/[locale]/page.tsx\n - app/[locale]/layout.tsx\n - components/demo/browser-frame.tsx\n - components/demo/shopify-full-site.tsx\n - components/pricing/pricing-table.tsx\n - e2e/navbar.spec.ts\n - messages/en.json\n - messages/ko.json\n\nWRONG: 1 commit \"Update landing page\" (LAZY, WRONG)\nWRONG: 2 commits (still too few)\n\nCORRECT: Split by directory/concern:\n - Commit 1: app/[locale]/page.tsx + layout.tsx (app layer)\n - Commit 2: components/demo/* (demo components)\n - Commit 3: components/pricing/* (pricing components)\n - Commit 4: e2e/* (tests)\n - Commit 5: messages/* (i18n)\n = 5 commits from 8 files (CORRECT)\n```\n\n### 3.2 Split by Concern SECOND (Secondary Split)\n\n**Within same directory, split by logical concern:**\n\n```\nExample: components/demo/ has 4 files\n - browser-frame.tsx (UI frame)\n - shopify-full-site.tsx (specific demo)\n - review-dashboard.tsx (NEW - specific demo)\n - tone-settings.tsx (NEW - specific demo)\n\nOption A (acceptable): 1 commit if ALL tightly coupled\nOption B (preferred): 2 commits\n - Commit: \"Update existing demo components\" (browser-frame, shopify)\n - Commit: \"Add new demo components\" (review-dashboard, tone-settings)\n```\n\n### 3.3 NEVER Do This (Anti-Pattern Examples)\n\n```\nWRONG: \"Refactor entire landing page\" - 1 commit with 15 files\nWRONG: \"Update components and tests\" - 1 commit mixing concerns\nWRONG: \"Big update\" - Any commit touching 5+ unrelated files\n\nRIGHT: Multiple focused commits, each 1-4 files max\nRIGHT: Each commit message describes ONE specific change\nRIGHT: A reviewer can understand each commit in 30 seconds\n```\n\n### 3.4 Implementation + Test Pairing (MANDATORY)\n\n```\nRULE: Test files MUST be in same commit as implementation\n\nTest patterns to match:\n- test_*.py <-> *.py\n- *_test.py <-> *.py\n- *.test.ts <-> *.ts\n- *.spec.ts <-> *.ts\n- __tests__/*.ts <-> *.ts\n- tests/*.py <-> src/*.py\n```\n\n### 3.5 MANDATORY JUSTIFICATION (Before Creating Commit Plan)\n\n**NON-NEGOTIABLE: Before finalizing your commit plan, you MUST:**\n\n```\nFOR EACH planned commit with 3+ files:\n 1. List all files in this commit\n 2. Write ONE sentence explaining why they MUST be together\n 3. If you can't write that sentence -> SPLIT\n \nTEMPLATE:\n\"Commit N contains [files] because [specific reason they are inseparable].\"\n\nVALID reasons:\n VALID: \"implementation file + its direct test file\"\n VALID: \"type definition + the only file that uses it\"\n VALID: \"migration + model change (would break without both)\"\n \nINVALID reasons (MUST SPLIT instead):\n INVALID: \"all related to feature X\" (too vague)\n INVALID: \"part of the same PR\" (not a reason)\n INVALID: \"they were changed together\" (not a reason)\n INVALID: \"makes sense to group\" (not a reason)\n```\n\n**OUTPUT THIS JUSTIFICATION in your analysis before executing commits.**\n\n### 3.7 Dependency Ordering\n\n```\nLevel 0: Utilities, constants, type definitions\nLevel 1: Models, schemas, interfaces\nLevel 2: Services, business logic\nLevel 3: API endpoints, controllers\nLevel 4: Configuration, infrastructure\n\nCOMMIT ORDER: Level 0 -> Level 1 -> Level 2 -> Level 3 -> Level 4\n```\n\n### 3.8 Create Commit Groups\n\nFor each logical feature/change:\n```yaml\n- group_id: 1\n feature: \"Add Shopify discount deletion\"\n files:\n - errors/shopify_error.py\n - types/delete_input.py\n - mutations/update_contract.py\n - tests/test_update_contract.py\n dependency_level: 2\n target_commit: null | <existing-hash> # null = new, hash = fixup\n```\n\n### 3.9 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 4. NO EXCEPTIONS.**\n\n```\nCOMMIT PLAN\n===========\nFiles changed: N\nMinimum commits required: ceil(N/3) = M\nPlanned commits: K\nStatus: K >= M (PASS) | K < M (FAIL - must split more)\n\nCOMMIT 1: [message in detected style]\n - path/to/file1.py\n - path/to/file1_test.py\n Justification: implementation + its test\n\nCOMMIT 2: [message in detected style]\n - path/to/file2.py\n Justification: independent utility function\n\nCOMMIT 3: [message in detected style]\n - config/settings.py\n - config/constants.py\n Justification: tightly coupled config changes\n\nExecution order: Commit 1 -> Commit 2 -> Commit 3\n(follows dependency: Level 0 -> Level 1 -> Level 2 -> ...)\n```\n\n**VALIDATION BEFORE EXECUTION:**\n- Each commit has <=4 files (or justified)\n- Each commit message matches detected STYLE + LANGUAGE\n- Test files paired with implementation\n- Different directories = different commits (or justified)\n- Total commits >= min_commits\n\n**IF ANY CHECK FAILS, DO NOT PROCEED. REPLAN.**\n</atomic_planning>\n\n---\n\n## PHASE 4: Commit Strategy Decision\n\n<strategy_decision>\n### 4.1 For Each Commit Group, Decide:\n\n```\nFIXUP if:\n - Change complements existing commit's intent\n - Same feature, fixing bugs or adding missing parts\n - Review feedback incorporation\n - Target commit exists in local history\n\nNEW COMMIT if:\n - New feature or capability\n - Independent logical unit\n - Different issue/ticket\n - No suitable target commit exists\n```\n\n### 4.2 History Rebuild Decision (Aggressive Option)\n\n```\nCONSIDER RESET & REBUILD when:\n - History is messy (many small fixups already)\n - Commits are not atomic (mixed concerns)\n - Dependency order is wrong\n \nRESET WORKFLOW:\n 1. git reset --soft $(git merge-base HEAD main)\n 2. All changes now staged\n 3. Re-commit in proper atomic units\n 4. Clean history from scratch\n \nONLY IF:\n - All commits are local (not pushed)\n - User explicitly allows OR branch is clearly WIP\n```\n\n### 4.3 Final Plan Summary\n\n```yaml\nEXECUTION_PLAN:\n strategy: FIXUP_THEN_NEW | NEW_ONLY | RESET_REBUILD\n fixup_commits:\n - files: [...]\n target: <hash>\n new_commits:\n - files: [...]\n message: \"...\"\n level: N\n requires_force_push: true | false\n```\n</strategy_decision>\n\n---\n\n## PHASE 5: Commit Execution\n\n<execution>\n### 5.1 Register TODO Items\n\nUse TodoWrite to register each commit as a trackable item:\n```\n- [ ] Fixup: <description> -> <target-hash>\n- [ ] New: <description>\n- [ ] Rebase autosquash\n- [ ] Final verification\n```\n\n### 5.2 Fixup Commits (If Any)\n\n```bash\n# Stage files for each fixup\ngit add <files>\ngit commit --fixup=<target-hash>\n\n# Repeat for all fixups...\n\n# Single autosquash rebase at the end\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\nGIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE\n```\n\n### 5.3 New Commits (After Fixups)\n\nFor each new commit group, in dependency order:\n\n```bash\n# Stage files\ngit add <file1> <file2> ...\n\n# Verify staging\ngit diff --staged --stat\n\n# Commit with detected style\ngit commit -m \"<message-matching-COMMIT_CONFIG>\"\n\n# Verify\ngit log -1 --oneline\n```\n\n### 5.4 Commit Message Generation\n\n**Based on COMMIT_CONFIG from Phase 1:**\n\n```\nIF style == SEMANTIC AND language == CHINESE:\n -> \"feat: \u6DFB\u52A0\u767B\u5F55\u529F\u80FD\"\n \nIF style == SEMANTIC AND language == ENGLISH:\n -> \"feat: add login feature\"\n\nIF style == PLAIN AND language == CHINESE:\n -> \"\u6DFB\u52A0\u767B\u5F55\u529F\u80FD\"\n\nIF style == PLAIN AND language == ENGLISH:\n -> \"Add login feature\"\n\nIF style == SHORT:\n -> \"format\" / \"type fix\" / \"lint\"\n```\n\n**VALIDATION before each commit:**\n1. Does message match detected style?\n2. Does language match detected language?\n3. Is it similar to examples from git log?\n\nIf ANY check fails -> REWRITE message.\n```\n</execution>\n\n---\n\n## PHASE 6: Verification & Cleanup\n\n<verification>\n### 6.1 Post-Commit Verification\n\n```bash\n# Check working directory clean\ngit status\n\n# Review new history\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD\n\n# Verify each commit is atomic\n# (mentally check: can each be reverted independently?)\n```\n\n### 6.2 Force Push Decision\n\n```\nIF fixup was used AND branch has upstream:\n -> Requires: git push --force-with-lease\n -> WARN user about force push implications\n \nIF only new commits:\n -> Regular: git push\n```\n\n### 6.3 Final Report\n\n```\nCOMMIT SUMMARY:\n Strategy: <what was done>\n Commits created: N\n Fixups merged: M\n \nHISTORY:\n <hash1> <message1>\n <hash2> <message2>\n ...\n\nNEXT STEPS:\n - git push [--force-with-lease]\n - Create PR if ready\n```\n</verification>";
1
+ export declare const GIT_MASTER_COMMIT_WORKFLOW_SECTION = "## PHASE 0: Parallel Context Gathering (MANDATORY FIRST STEP)\n\n<parallel_analysis>\n**Execute ALL of the following commands IN PARALLEL to minimize latency:**\n\n```bash\n# Group 1: Current state\ngit status\ngit diff --staged --stat\ngit diff --stat\n\n# Group 2: History context \ngit log -30 --oneline\ngit log -30 --pretty=format:\"%s\"\n\n# Group 3: Branch context\ngit branch --show-current\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null\ngit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo \"NO_UPSTREAM\"\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)..HEAD 2>/dev/null\n```\n\n**Capture these data points simultaneously:**\n1. What files changed (staged vs unstaged)\n2. Recent 30 commit messages for style detection\n3. Branch position relative to main/master\n4. Whether branch has upstream tracking\n5. Commits that would go in PR (local only)\n</parallel_analysis>\n\n---\n\n## PHASE 1: Style Detection (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<style_detection>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the analysis result before moving to Phase 2.\n\n### 1.1 Language Detection\n\n```\nCount from git log -30:\n- Korean characters: N commits\n- English only: M commits\n- Mixed: K commits\n\nDECISION:\n- If Korean >= 50% -> KOREAN\n- If English >= 50% -> ENGLISH \n- If Mixed -> Use MAJORITY language\n```\n\n### 1.2 Commit Style Classification\n\n| Style | Pattern | Example | Detection Regex |\n|-------|---------|---------|-----------------|\n| `SEMANTIC` | `type: message` or `type(scope): message` | `feat: add login` | `/^(feat\\|fix\\|chore\\|refactor\\|docs\\|test\\|ci\\|style\\|perf\\|build)(\\(.+\\))?:/` |\n| `PLAIN` | Just description, no prefix | `Add login feature` | No conventional prefix, >3 words |\n| `SENTENCE` | Full sentence style | `Implemented the new login flow` | Complete grammatical sentence |\n| `SHORT` | Minimal keywords | `format`, `lint` | 1-3 words only |\n\n**Detection Algorithm:**\n```\nsemantic_count = commits matching semantic regex\nplain_count = non-semantic commits with >3 words\nshort_count = commits with <=3 words\n\nIF semantic_count >= 15 (50%): STYLE = SEMANTIC\nELSE IF plain_count >= 15: STYLE = PLAIN \nELSE IF short_count >= 10: STYLE = SHORT\nELSE: STYLE = PLAIN (safe default)\n```\n\n### 1.3 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 2. NO EXCEPTIONS.**\n\n```\nSTYLE DETECTION RESULT\n======================\nAnalyzed: 30 commits from git log\n\nLanguage: [KOREAN | ENGLISH]\n - Korean commits: N (X%)\n - English commits: M (Y%)\n\nStyle: [SEMANTIC | PLAIN | SENTENCE | SHORT]\n - Semantic (feat:, fix:, etc): N (X%)\n - Plain: M (Y%)\n - Short: K (Z%)\n\nReference examples from repo:\n 1. \"actual commit message from log\"\n 2. \"actual commit message from log\"\n 3. \"actual commit message from log\"\n\nAll commits will follow: [LANGUAGE] + [STYLE]\n```\n\n**IF YOU SKIP THIS OUTPUT, YOUR COMMITS WILL BE WRONG. STOP AND REDO.**\n</style_detection>\n\n---\n\n## PHASE 2: Branch Context Analysis\n\n<branch_analysis>\n### 2.1 Determine Branch State\n\n```\nBRANCH_STATE:\n current_branch: <name>\n has_upstream: true | false\n commits_ahead: N # Local-only commits\n merge_base: <hash>\n \nREWRITE_SAFETY:\n - If has_upstream AND commits_ahead > 0 AND already pushed:\n -> WARN before force push\n - If no upstream OR all commits local:\n -> Safe for aggressive rewrite (fixup, reset, rebase)\n - If on main/master:\n -> NEVER rewrite, only new commits\n```\n\n### 2.2 History Rewrite Strategy Decision\n\n```\nIF current_branch == main OR current_branch == master:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> Never fixup, never rebase\n\nELSE IF commits_ahead == 0:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> No history to rewrite\n\nELSE IF all commits are local (not pushed):\n -> STRATEGY = AGGRESSIVE_REWRITE\n -> Fixup freely, reset if needed, rebase to clean\n\nELSE IF pushed but not merged:\n -> STRATEGY = CAREFUL_REWRITE \n -> Fixup OK but warn about force push\n```\n</branch_analysis>\n\n---\n\n## PHASE 3: Atomic Unit Planning (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<atomic_planning>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the commit plan before moving to Phase 4.\n\n### 3.0 Calculate Minimum Commit Count FIRST\n\n```\nFORMULA: min_commits = ceil(file_count / 3)\n\n 3 files -> min 1 commit\n 5 files -> min 2 commits\n 9 files -> min 3 commits\n15 files -> min 5 commits\n```\n\n**If your planned commit count < min_commits -> WRONG. SPLIT MORE.**\n\n### 3.1 Split by Directory/Module FIRST (Primary Split)\n\n**RULE: Different directories = Different commits (almost always)**\n\n```\nExample: 8 changed files\n - app/[locale]/page.tsx\n - app/[locale]/layout.tsx\n - components/demo/browser-frame.tsx\n - components/demo/shopify-full-site.tsx\n - components/pricing/pricing-table.tsx\n - e2e/navbar.spec.ts\n - messages/en.json\n - messages/ko.json\n\nWRONG: 1 commit \"Update landing page\" (LAZY, WRONG)\nWRONG: 2 commits (still too few)\n\nCORRECT: Split by directory/concern:\n - Commit 1: app/[locale]/page.tsx + layout.tsx (app layer)\n - Commit 2: components/demo/* (demo components)\n - Commit 3: components/pricing/* (pricing components)\n - Commit 4: e2e/* (tests)\n - Commit 5: messages/* (i18n)\n = 5 commits from 8 files (CORRECT)\n```\n\n### 3.2 Split by Concern SECOND (Secondary Split)\n\n**Within same directory, split by logical concern:**\n\n```\nExample: components/demo/ has 4 files\n - browser-frame.tsx (UI frame)\n - shopify-full-site.tsx (specific demo)\n - review-dashboard.tsx (NEW - specific demo)\n - tone-settings.tsx (NEW - specific demo)\n\nOption A (acceptable): 1 commit if ALL tightly coupled\nOption B (preferred): 2 commits\n - Commit: \"Update existing demo components\" (browser-frame, shopify)\n - Commit: \"Add new demo components\" (review-dashboard, tone-settings)\n```\n\n### 3.3 NEVER Do This (Anti-Pattern Examples)\n\n```\nWRONG: \"Refactor entire landing page\" - 1 commit with 15 files\nWRONG: \"Update components and tests\" - 1 commit mixing concerns\nWRONG: \"Big update\" - Any commit touching 5+ unrelated files\n\nRIGHT: Multiple focused commits, each 1-4 files max\nRIGHT: Each commit message describes ONE specific change\nRIGHT: A reviewer can understand each commit in 30 seconds\n```\n\n### 3.4 Implementation + Test Pairing (MANDATORY)\n\n```\nRULE: Test files MUST be in same commit as implementation\n\nTest patterns to match:\n- test_*.py <-> *.py\n- *_test.py <-> *.py\n- *.test.ts <-> *.ts\n- *.spec.ts <-> *.ts\n- __tests__/*.ts <-> *.ts\n- tests/*.py <-> src/*.py\n```\n\n### 3.5 MANDATORY JUSTIFICATION (Before Creating Commit Plan)\n\n**NON-NEGOTIABLE: Before finalizing your commit plan, you MUST:**\n\n```\nFOR EACH planned commit with 3+ files:\n 1. List all files in this commit\n 2. Write ONE sentence explaining why they MUST be together\n 3. If you can't write that sentence -> SPLIT\n \nTEMPLATE:\n\"Commit N contains [files] because [specific reason they are inseparable].\"\n\nVALID reasons:\n VALID: \"implementation file + its direct test file\"\n VALID: \"type definition + the only file that uses it\"\n VALID: \"migration + model change (would break without both)\"\n \nINVALID reasons (MUST SPLIT instead):\n INVALID: \"all related to feature X\" (too vague)\n INVALID: \"part of the same PR\" (not a reason)\n INVALID: \"they were changed together\" (not a reason)\n INVALID: \"makes sense to group\" (not a reason)\n```\n\n**OUTPUT THIS JUSTIFICATION in your analysis before executing commits.**\n\n### 3.7 Dependency Ordering\n\n```\nLevel 0: Utilities, constants, type definitions\nLevel 1: Models, schemas, interfaces\nLevel 2: Services, business logic\nLevel 3: API endpoints, controllers\nLevel 4: Configuration, infrastructure\n\nCOMMIT ORDER: Level 0 -> Level 1 -> Level 2 -> Level 3 -> Level 4\n```\n\n### 3.8 Create Commit Groups\n\nFor each logical feature/change:\n```yaml\n- group_id: 1\n feature: \"Add Shopify discount deletion\"\n files:\n - errors/shopify_error.py\n - types/delete_input.py\n - mutations/update_contract.py\n - tests/test_update_contract.py\n dependency_level: 2\n target_commit: null | <existing-hash> # null = new, hash = fixup\n```\n\n### 3.9 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 4. NO EXCEPTIONS.**\n\n```\nCOMMIT PLAN\n===========\nFiles changed: N\nMinimum commits required: ceil(N/3) = M\nPlanned commits: K\nStatus: K >= M (PASS) | K < M (FAIL - must split more)\n\nCOMMIT 1: [message in detected style]\n - path/to/file1.py\n - path/to/file1_test.py\n Justification: implementation + its test\n\nCOMMIT 2: [message in detected style]\n - path/to/file2.py\n Justification: independent utility function\n\nCOMMIT 3: [message in detected style]\n - config/settings.py\n - config/constants.py\n Justification: tightly coupled config changes\n\nExecution order: Commit 1 -> Commit 2 -> Commit 3\n(follows dependency: Level 0 -> Level 1 -> Level 2 -> ...)\n```\n\n**VALIDATION BEFORE EXECUTION:**\n- Each commit has <=4 files (or justified)\n- Each commit message matches detected STYLE + LANGUAGE\n- Test files paired with implementation\n- Different directories = different commits (or justified)\n- Total commits >= min_commits\n\n**IF ANY CHECK FAILS, DO NOT PROCEED. REPLAN.**\n</atomic_planning>\n\n---\n\n## PHASE 4: Commit Strategy Decision\n\n<strategy_decision>\n### 4.1 For Each Commit Group, Decide:\n\n```\nFIXUP if:\n - Change complements existing commit's intent\n - Same feature, fixing bugs or adding missing parts\n - Review feedback incorporation\n - Target commit exists in local history\n\nNEW COMMIT if:\n - New feature or capability\n - Independent logical unit\n - Different issue/ticket\n - No suitable target commit exists\n```\n\n### 4.2 History Rebuild Decision (Aggressive Option)\n\n```\nCONSIDER RESET & REBUILD when:\n - History is messy (many small fixups already)\n - Commits are not atomic (mixed concerns)\n - Dependency order is wrong\n \nRESET WORKFLOW:\n 1. git reset --soft $(git merge-base HEAD main)\n 2. All changes now staged\n 3. Re-commit in proper atomic units\n 4. Clean history from scratch\n \nONLY IF:\n - All commits are local (not pushed)\n - User explicitly allows OR branch is clearly WIP\n```\n\n### 4.3 Final Plan Summary\n\n```yaml\nEXECUTION_PLAN:\n strategy: FIXUP_THEN_NEW | NEW_ONLY | RESET_REBUILD\n fixup_commits:\n - files: [...]\n target: <hash>\n new_commits:\n - files: [...]\n message: \"...\"\n level: N\n requires_force_push: true | false\n```\n</strategy_decision>\n\n---\n\n## PHASE 5: Commit Execution\n\n<execution>\n### 5.1 Register TODO Items\n\nUse TodoWrite to register each commit as a trackable item:\n```\n- [ ] Fixup: <description> -> <target-hash>\n- [ ] New: <description>\n- [ ] Rebase autosquash\n- [ ] Final verification\n```\n\n### 5.2 Fixup Commits (If Any)\n\n```bash\n# Stage files for each fixup\ngit add <files>\ngit commit --fixup=<target-hash>\n\n# Repeat for all fixups...\n\n# Single autosquash rebase at the end\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\nGIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE\n```\n\n### 5.3 New Commits (After Fixups)\n\nFor each new commit group, in dependency order:\n\n```bash\n# Stage files\ngit add <file1> <file2> ...\n\n# Verify staging\ngit diff --staged --stat\n\n# Commit with detected style\ngit commit -m \"<message-matching-COMMIT_CONFIG>\"\n\n# Verify\ngit log -1 --oneline\n```\n\n### 5.4 Commit Message Generation\n\n**Based on COMMIT_CONFIG from Phase 1:**\n\n```\nIF style == SEMANTIC AND language == KOREAN:\n -> \"feat: \uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00\"\n \nIF style == SEMANTIC AND language == ENGLISH:\n -> \"feat: add login feature\"\n \nIF style == PLAIN AND language == KOREAN:\n -> \"\uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00\"\n \nIF style == PLAIN AND language == ENGLISH:\n -> \"Add login feature\"\n \nIF style == SHORT:\n -> \"format\" / \"type fix\" / \"lint\"\n```\n\n**VALIDATION before each commit:**\n1. Does message match detected style?\n2. Does language match detected language?\n3. Is it similar to examples from git log?\n\nIf ANY check fails -> REWRITE message.\n```\n</execution>\n\n---\n\n## PHASE 6: Verification & Cleanup\n\n<verification>\n### 6.1 Post-Commit Verification\n\n```bash\n# Check working directory clean\ngit status\n\n# Review new history\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD\n\n# Verify each commit is atomic\n# (mentally check: can each be reverted independently?)\n```\n\n### 6.2 Force Push Decision\n\n```\nIF fixup was used AND branch has upstream:\n -> Requires: git push --force-with-lease\n -> WARN user about force push implications\n \nIF only new commits:\n -> Regular: git push\n```\n\n### 6.3 Final Report\n\n```\nCOMMIT SUMMARY:\n Strategy: <what was done>\n Commits created: N\n Fixups merged: M\n \nHISTORY:\n <hash1> <message1>\n <hash2> <message2>\n ...\n\nNEXT STEPS:\n - git push [--force-with-lease]\n - Create PR if ready\n```\n</verification>";