x-ipe 1.0.23__py3-none-any.whl → 1.0.25__py3-none-any.whl

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 (146) hide show
  1. x_ipe/app.py +32 -1
  2. x_ipe/handlers/terminal_handlers.py +6 -0
  3. x_ipe/handlers/voice_handlers.py +5 -0
  4. x_ipe/resources/copilot-instructions.md +19 -6
  5. x_ipe/resources/skills/lesson-learned/SKILL.md +208 -0
  6. x_ipe/resources/skills/lesson-learned/references/examples.md +238 -0
  7. x_ipe/resources/skills/project-quality-board-management/SKILL.md +135 -298
  8. x_ipe/resources/skills/project-quality-board-management/references/evaluation-principles.md +213 -0
  9. x_ipe/resources/skills/project-quality-board-management/references/evaluation-procedures.md +214 -0
  10. x_ipe/resources/skills/project-quality-board-management/templates/quality-report.md +70 -18
  11. x_ipe/resources/skills/task-execution-guideline/SKILL.md +2 -2
  12. x_ipe/resources/skills/task-execution-guideline/templates/task-record.yaml +1 -1
  13. x_ipe/resources/skills/task-type-code-implementation/SKILL.md +72 -270
  14. x_ipe/resources/skills/task-type-code-implementation/references/implementation-guidelines.md +432 -0
  15. x_ipe/resources/skills/task-type-code-refactor-v2/SKILL.md +127 -353
  16. x_ipe/resources/skills/task-type-code-refactor-v2/references/refactoring-techniques.md +373 -0
  17. x_ipe/resources/skills/task-type-feature-breakdown/SKILL.md +31 -243
  18. x_ipe/resources/skills/task-type-feature-breakdown/references/breakdown-guidelines.md +330 -0
  19. x_ipe/resources/skills/task-type-feature-refinement/SKILL.md +27 -180
  20. x_ipe/resources/skills/task-type-feature-refinement/references/specification-writing-guide.md +267 -0
  21. x_ipe/resources/skills/task-type-idea-mockup/SKILL.md +38 -276
  22. x_ipe/resources/skills/task-type-idea-mockup/references/mockup-guidelines.md +299 -0
  23. x_ipe/resources/skills/task-type-idea-to-architecture/SKILL.md +20 -218
  24. x_ipe/resources/skills/task-type-idea-to-architecture/references/architecture-patterns.md +342 -0
  25. x_ipe/resources/skills/task-type-ideation/SKILL.md +10 -266
  26. x_ipe/resources/skills/task-type-ideation/references/folder-naming-guide.md +55 -0
  27. x_ipe/resources/skills/task-type-ideation/references/tool-usage-guide.md +236 -0
  28. x_ipe/resources/skills/task-type-ideation-v2/SKILL.md +488 -0
  29. x_ipe/resources/skills/task-type-ideation-v2/references/examples.md +377 -0
  30. x_ipe/resources/skills/task-type-ideation-v2/references/folder-naming-guide.md +74 -0
  31. x_ipe/resources/skills/task-type-ideation-v2/references/tool-usage-guide.md +145 -0
  32. x_ipe/resources/skills/task-type-ideation-v2/references/visualization-guide.md +160 -0
  33. x_ipe/resources/skills/task-type-ideation-v2/templates/idea-summary.md +86 -0
  34. x_ipe/resources/skills/task-type-refactoring-analysis/SKILL.md +83 -145
  35. x_ipe/resources/skills/task-type-refactoring-analysis/references/output-schema.md +172 -0
  36. x_ipe/resources/skills/task-type-technical-design/SKILL.md +28 -214
  37. x_ipe/resources/skills/task-type-technical-design/references/design-templates.md +422 -0
  38. x_ipe/resources/skills/task-type-test-generation/SKILL.md +47 -332
  39. x_ipe/resources/skills/task-type-test-generation/references/test-patterns.md +368 -0
  40. x_ipe/resources/skills/tool-tracing-creator/SKILL.md +312 -0
  41. x_ipe/resources/skills/tool-tracing-creator/references/examples.md +324 -0
  42. x_ipe/resources/skills/tool-tracing-instrumentation/SKILL.md +373 -0
  43. x_ipe/resources/skills/tool-tracing-instrumentation/references/examples.md +264 -0
  44. x_ipe/resources/skills/x-ipe-skill-creator-v3/SKILL.md +486 -0
  45. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/10. example-gate-conditions.md +73 -0
  46. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/11. reference-quality-standards.md +127 -0
  47. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/2. reference-section-order.md +127 -0
  48. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/3. example-step-based-code-review.md +84 -0
  49. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/4. example-step-based-feature-implementation.md +113 -0
  50. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/5. example-function-based-validation.md +73 -0
  51. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/6. example-function-based-analysis.md +94 -0
  52. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/7. example-task-io-code-implementation.md +36 -0
  53. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/8. example-structured-summary.md +43 -0
  54. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/9. example-dor-dod.md +77 -0
  55. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/examples.md +429 -0
  56. x_ipe/resources/skills/x-ipe-skill-creator-v3/references/skill-general-guidelines-v2.md +611 -0
  57. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/skill-meta-x-ipe-meta.md +153 -0
  58. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/skill-meta-x-ipe-task-based.md +324 -0
  59. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/skill-meta-x-ipe-task-category.md +109 -0
  60. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/skill-meta-x-ipe-tool.md +205 -0
  61. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/x-ipe-meta.md +334 -0
  62. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/x-ipe-task-based.md +279 -0
  63. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/x-ipe-tool.md +175 -0
  64. x_ipe/resources/skills/x-ipe-skill-creator-v3/templates/x-ipe-workflow-orchestration.md +329 -0
  65. x_ipe/resources/skills/x-ipe-task-based-ideation/SKILL.md +487 -0
  66. x_ipe/resources/skills/x-ipe-task-based-ideation/references/examples.md +377 -0
  67. x_ipe/resources/skills/x-ipe-task-based-ideation/references/folder-naming-guide.md +74 -0
  68. x_ipe/resources/skills/x-ipe-task-based-ideation/references/tool-usage-guide.md +145 -0
  69. x_ipe/resources/skills/x-ipe-task-based-ideation/references/visualization-guide.md +160 -0
  70. x_ipe/resources/skills/x-ipe-task-based-ideation/templates/idea-summary.md +86 -0
  71. x_ipe/routes/__init__.py +2 -0
  72. x_ipe/routes/ideas_routes.py +289 -0
  73. x_ipe/routes/kb_routes.py +80 -0
  74. x_ipe/routes/main_routes.py +18 -0
  75. x_ipe/routes/project_routes.py +7 -0
  76. x_ipe/routes/proxy_routes.py +10 -2
  77. x_ipe/routes/quality_evaluation_routes.py +193 -0
  78. x_ipe/routes/settings_routes.py +6 -0
  79. x_ipe/routes/tools_routes.py +6 -0
  80. x_ipe/routes/tracing_routes.py +232 -0
  81. x_ipe/routes/uiux_feedback_routes.py +50 -0
  82. x_ipe/services/__init__.py +5 -0
  83. x_ipe/services/config_service.py +6 -0
  84. x_ipe/services/file_service.py +20 -0
  85. x_ipe/services/homepage_service.py +160 -0
  86. x_ipe/services/ideas_service.py +535 -2
  87. x_ipe/services/kb_service.py +378 -0
  88. x_ipe/services/proxy_service.py +37 -7
  89. x_ipe/services/settings_service.py +13 -0
  90. x_ipe/services/skills_service.py +4 -0
  91. x_ipe/services/terminal_service.py +24 -0
  92. x_ipe/services/themes_service.py +4 -0
  93. x_ipe/services/tools_config_service.py +4 -0
  94. x_ipe/services/tracing_service.py +333 -0
  95. x_ipe/services/uiux_feedback_service.py +148 -1
  96. x_ipe/services/voice_input_service_v2.py +11 -0
  97. x_ipe/static/css/base.css +7 -0
  98. x_ipe/static/css/homepage-infinity.css +330 -0
  99. x_ipe/static/css/kb-core.css +301 -0
  100. x_ipe/static/css/quality-evaluation.css +345 -0
  101. x_ipe/static/css/sidebar.css +14 -4
  102. x_ipe/static/css/terminal.css +23 -0
  103. x_ipe/static/css/tracing-dashboard.css +796 -0
  104. x_ipe/static/css/uiux-feedback.css +7 -1
  105. x_ipe/static/css/workplace.css +636 -0
  106. x_ipe/static/img/homepage-infinity-loop.png +0 -0
  107. x_ipe/static/js/features/confirm-dialog.js +169 -0
  108. x_ipe/static/js/features/folder-view.js +742 -0
  109. x_ipe/static/js/features/homepage-infinity.js +314 -0
  110. x_ipe/static/js/features/kb-core.js +371 -0
  111. x_ipe/static/js/features/quality-evaluation.js +387 -0
  112. x_ipe/static/js/features/sidebar.js +255 -12
  113. x_ipe/static/js/features/tracing-dashboard.js +855 -0
  114. x_ipe/static/js/features/tracing-graph.js +1031 -0
  115. x_ipe/static/js/features/tree-drag.js +227 -0
  116. x_ipe/static/js/features/tree-search.js +228 -0
  117. x_ipe/static/js/features/workplace.js +661 -33
  118. x_ipe/static/js/init.js +76 -0
  119. x_ipe/static/js/terminal-v2.js +45 -14
  120. x_ipe/static/js/terminal.js +50 -49
  121. x_ipe/static/js/uiux-feedback.js +75 -16
  122. x_ipe/templates/base.html +24 -0
  123. x_ipe/templates/index.html +10 -1
  124. x_ipe/templates/knowledge-base.html +110 -0
  125. x_ipe/templates/workplace.html +4 -0
  126. x_ipe/tracing/__init__.py +37 -0
  127. x_ipe/tracing/buffer.py +135 -0
  128. x_ipe/tracing/context.py +125 -0
  129. x_ipe/tracing/decorator.py +288 -0
  130. x_ipe/tracing/middleware.py +197 -0
  131. x_ipe/tracing/parser.py +235 -0
  132. x_ipe/tracing/redactor.py +111 -0
  133. x_ipe/tracing/writer.py +122 -0
  134. {x_ipe-1.0.23.dist-info → x_ipe-1.0.25.dist-info}/METADATA +2 -2
  135. {x_ipe-1.0.23.dist-info → x_ipe-1.0.25.dist-info}/RECORD +138 -65
  136. x_ipe/app.py.bak +0 -1333
  137. x_ipe/resources/skills/x-ipe-skill-creator/SKILL.md +0 -329
  138. x_ipe/resources/skills/x-ipe-skill-creator/references/output-patterns.md +0 -169
  139. x_ipe/resources/skills/x-ipe-skill-creator/references/skill-structure.md +0 -162
  140. x_ipe/resources/skills/x-ipe-skill-creator/references/workflows.md +0 -110
  141. x_ipe/resources/skills/x-ipe-skill-creator/templates/references/examples.md +0 -113
  142. x_ipe/resources/skills/x-ipe-skill-creator/templates/skill-category-skill.md +0 -296
  143. x_ipe/resources/skills/x-ipe-skill-creator/templates/task-type-skill.md +0 -269
  144. {x_ipe-1.0.23.dist-info → x_ipe-1.0.25.dist-info}/WHEEL +0 -0
  145. {x_ipe-1.0.23.dist-info → x_ipe-1.0.25.dist-info}/entry_points.txt +0 -0
  146. {x_ipe-1.0.23.dist-info → x_ipe-1.0.25.dist-info}/licenses/LICENSE +0 -0
@@ -19,25 +19,21 @@ Execute safe code refactoring with full traceability by:
19
19
  ## Important Notes
20
20
 
21
21
  ### Skill Prerequisite
22
- - If you HAVE NOT learned `task-execution-guideline` skill, please learn it first before executing this skill.
22
+ - Learn `task-execution-guideline` skill first before executing this skill.
23
23
  - This skill REQUIRES output from `task-type-improve-code-quality-before-refactoring` skill.
24
- - All documentation MUST be aligned before this skill executes.
25
24
 
26
25
  ### ⚠️ Prerequisite Chain Required
27
- - This skill is part of the **code-refactoring-stage** chain:
28
- 1. `task-type-refactoring-analysis` → produces refactoring_suggestion, refactoring_principle
29
- 2. `task-type-improve-code-quality-before-refactoring` → produces code_quality_evaluated
30
- 3. `task-type-code-refactor-v2` → executes refactoring (this skill)
26
+ This skill is part of the **code-refactoring-stage** chain:
27
+ 1. `task-type-refactoring-analysis` → produces refactoring_suggestion, refactoring_principle
28
+ 2. `task-type-improve-code-quality-before-refactoring` → produces code_quality_evaluated
29
+ 3. `task-type-code-refactor-v2` → executes refactoring (this skill)
31
30
 
32
- - **If user requests "refactor" directly without prior analysis:**
33
- DO NOT execute this skill
34
- → REDIRECT to `task-type-refactoring-analysis` to start the proper chain
35
-
36
- **Important:** If Agent DO NOT have skill capability, can directly go to `.github/skills/` folder to learn skills. And SKILL.md file is the entry point to understand each skill.
31
+ **If user requests "refactor" directly without prior analysis:**
32
+ REDIRECT to `task-type-refactoring-analysis` to start the proper chain
37
33
 
38
34
  ---
39
35
 
40
- ## Task Type Default Attributes
36
+ ## Task Type Attributes
41
37
 
42
38
  | Attribute | Value |
43
39
  |-----------|-------|
@@ -46,137 +42,17 @@ Execute safe code refactoring with full traceability by:
46
42
  | Next Task Type | null |
47
43
  | Require Human Review | Yes |
48
44
 
49
- ---
45
+ ### Required Input Attributes
50
46
 
51
- ## Task Type Required Input Attributes
47
+ | Attribute | Source |
48
+ |-----------|--------|
49
+ | Auto Proceed | False (default) |
50
+ | refactoring_scope | previous task |
51
+ | refactoring_suggestion | Refactoring Analysis task |
52
+ | refactoring_principle | Refactoring Analysis task |
53
+ | code_quality_evaluated | Improve Code Quality task |
52
54
 
53
- | Attribute | Default Value |
54
- |-----------|---------------|
55
- | Auto Proceed | False |
56
- | refactoring_scope | (required - from previous task) |
57
- | refactoring_suggestion | (required - from Refactoring Analysis task) |
58
- | refactoring_principle | (required - from Refactoring Analysis task) |
59
- | code_quality_evaluated | (required - from Improve Code Quality task) |
60
-
61
- **refactoring_scope Structure:**
62
- ```yaml
63
- refactoring_scope:
64
- files: [<list of file paths>]
65
- modules: [<list of module names>]
66
- dependencies: [<identified dependencies>]
67
- scope_expansion_log: [<log of scope expansions>]
68
- ```
69
-
70
- **refactoring_suggestion Structure:**
71
- ```yaml
72
- refactoring_suggestion:
73
- summary: "<high-level description of suggested refactoring>"
74
- goals:
75
- - goal: "<specific improvement goal>"
76
- priority: high | medium | low
77
- rationale: "<why this goal matters>"
78
- principle: "<SOLID | DRY | KISS | YAGNI | Modular Design | etc.>"
79
- target_structure: "<description of desired structure after refactoring>"
80
- ```
81
-
82
- **refactoring_principle Structure:**
83
- ```yaml
84
- refactoring_principle:
85
- primary_principles:
86
- - principle: <SOLID | DRY | KISS | YAGNI | SoC | Modular Design | etc.>
87
- rationale: "<why this principle applies>"
88
- applications:
89
- - area: "<code area>"
90
- action: "<specific application>"
91
- secondary_principles:
92
- - principle: <name>
93
- rationale: "<supporting rationale>"
94
- constraints:
95
- - constraint: "<what to avoid or preserve>"
96
- reason: "<why this constraint exists>"
97
- ```
98
-
99
- **code_quality_evaluated Structure (from Improve Code Quality):**
100
- ```yaml
101
- code_quality_evaluated:
102
- requirements_alignment: { status: aligned, updates_made: [...] }
103
- specification_alignment: { status: aligned, updates_made: [...] }
104
- test_coverage: { status: sufficient, line_coverage: XX%, tests_added: N }
105
- code_alignment:
106
- status: aligned | needs_attention | critical
107
- file_size_violations: [<files to split>]
108
- solid_assessment: { srp, ocp, lsp, isp, dip }
109
- kiss_assessment: { over_engineering, straightforward_logic, minimal_dependencies, clear_intent }
110
- modular_design_assessment: { module_cohesion, module_coupling, single_entry_point, folder_structure, reusability, testability }
111
- code_smells: [<smells to address>]
112
- overall_quality_score: <1-10>
113
- ```
114
-
115
- ---
116
-
117
- ## Skill/Task Completion Output Attributes
118
-
119
- This skill MUST return these attributes to the Task Data Model upon task completion:
120
-
121
- ```yaml
122
- Output:
123
- category: code-refactoring-stage
124
- status: completed | blocked
125
- next_task_type: null
126
- require_human_review: Yes
127
- auto_proceed: {from input Auto Proceed}
128
- task_output_links: [<paths to refactored files>]
129
-
130
- # Dynamic attributes
131
- refactoring_summary:
132
- files_modified: <count>
133
- files_created: <count>
134
- files_deleted: <count>
135
- tests_updated: <count>
136
- principles_applied:
137
- - principle: <SOLID | DRY | KISS | YAGNI | SoC | Modular Design>
138
- application_count: <N>
139
- areas: [<code areas where applied>]
140
- goals_achieved:
141
- - goal: "<from refactoring_suggestion>"
142
- status: achieved | partially | skipped
143
- notes: "<any relevant notes>"
144
- constraints_respected: [<list of constraints verified>]
145
-
146
- code_quality_evaluated:
147
- quality_score_before: <1-10>
148
- quality_score_after: <1-10>
149
-
150
- # Code Alignment Improvements
151
- code_alignment:
152
- file_size_violations:
153
- before: <count>
154
- after: <count>
155
- resolved: [<files that were split>]
156
- solid_assessment:
157
- before: { srp: status, ocp: status, ... }
158
- after: { srp: status, ocp: status, ... }
159
- kiss_assessment:
160
- before: { over_engineering: status, ... }
161
- after: { over_engineering: status, ... }
162
- modular_design_assessment:
163
- before: { module_cohesion: status, ... }
164
- after: { module_cohesion: status, ... }
165
- code_smells:
166
- before: <count>
167
- after: <count>
168
- resolved: [<smells addressed>]
169
-
170
- test_coverage:
171
- before: <XX%>
172
- after: <XX%>
173
- status: maintained | improved | degraded
174
-
175
- references_updated:
176
- requirements: [<paths>]
177
- specifications: [<paths>]
178
- technical_designs: [<paths>]
179
- ```
55
+ > **📚 Input/Output Structure Definitions:** See [references/refactoring-techniques.md](references/refactoring-techniques.md#input-structure-definitions)
180
56
 
181
57
  ---
182
58
 
@@ -187,53 +63,40 @@ Output:
187
63
  | 1 | refactoring_scope provided | Yes |
188
64
  | 2 | refactoring_suggestion provided | Yes |
189
65
  | 3 | refactoring_principle provided | Yes |
190
- | 4 | code_quality_evaluated provided (from Improve Code Quality) | Yes |
191
- | 5 | All documentation aligned (requirements, specs) | Yes |
66
+ | 4 | code_quality_evaluated provided | Yes |
67
+ | 5 | All documentation aligned | Yes |
192
68
  | 6 | Test coverage ≥80% | Yes |
193
69
  | 7 | All tests passing | Yes |
194
70
 
195
- ### ⚠️ Prerequisite Chain Enforcement
196
-
197
- **Before executing this skill, verify the refactoring chain was followed:**
71
+ ### Prerequisite Chain Enforcement
198
72
 
199
73
  ```
200
- 1. CHECK if refactoring_suggestion AND refactoring_principle exist:
201
- - These attributes are ONLY produced by task-type-refactoring-analysis
202
-
203
- 2. IF refactoring_suggestion OR refactoring_principle is MISSING:
204
- → ⛔ STOP execution of this skill
205
- → LOG: "Missing prerequisite: task-type-refactoring-analysis not executed"
206
- REDIRECT: Load and execute `task-type-refactoring-analysis` skill first
207
- → After completion, chain will auto-proceed through:
208
- task-type-refactoring-analysis → task-type-improve-code-quality-before-refactoring → task-type-code-refactor-v2
209
-
210
- 3. IF code_quality_evaluated is MISSING:
211
- → ⛔ STOP execution of this skill
212
- → LOG: "Missing prerequisite: task-type-improve-code-quality-before-refactoring not executed"
213
- → REDIRECT: Load and execute `task-type-improve-code-quality-before-refactoring` skill first
214
-
215
- 4. ONLY proceed to Execution Flow if ALL prerequisites are present
74
+ 1. IF refactoring_suggestion OR refactoring_principle MISSING:
75
+ STOP REDIRECT to `task-type-refactoring-analysis`
76
+
77
+ 2. IF code_quality_evaluated MISSING:
78
+ → ⛔ STOP REDIRECT to `task-type-improve-code-quality-before-refactoring`
79
+
80
+ 3. ONLY proceed if ALL prerequisites present
216
81
  ```
217
82
 
218
83
  ---
219
84
 
220
85
  ## Execution Flow
221
86
 
222
- Execute Code Refactor V2 by following these steps in order:
223
-
224
- | Step | Name | Action | Gate to Next |
225
- |------|------|--------|--------------|
226
- | 1 | Reflect on Context | Analyze requirements, features, and input suggestions/principles | Context understood |
227
- | 2 | Generate Plan | Propose refactoring plan following suggestions and principles | **Human approves plan** |
228
- | 3 | Execute Refactoring | Apply changes per principles incrementally | All tests pass |
87
+ | Step | Name | Action | Gate |
88
+ |------|------|--------|------|
89
+ | 1 | Reflect on Context | Analyze requirements, features, suggestions/principles | Context understood |
90
+ | 2 | Generate Plan | Propose refactoring plan | **Human approves** |
91
+ | 3 | Execute Refactoring | Apply changes incrementally | All tests pass |
229
92
  | 4 | Update References | Sync docs with new structure | Docs updated |
230
- | 5 | Validate & Complete | Verify quality improvement against principles | **Human approves** |
93
+ | 5 | Validate & Complete | Verify quality improvement | **Human approves** |
94
+ | 6 | Apply Tracing | Preserve/add tracing decorators | Tests pass |
231
95
 
232
96
  **⛔ BLOCKING RULES:**
233
- - Step 1 2: BLOCKED if documentation not aligned
234
- - Step 2 → 3: BLOCKED until human approves refactoring plan
97
+ - Step 23: BLOCKED until human approves plan
235
98
  - Step 3: BLOCKED if any test fails (must fix or revert)
236
- - Step 4 5: BLOCKED if references not updated
99
+ - Step 4→5: BLOCKED if references not updated
237
100
 
238
101
  ---
239
102
 
@@ -241,30 +104,11 @@ Execute Code Refactor V2 by following these steps in order:
241
104
 
242
105
  ### Step 1: Reflect on Context
243
106
 
244
- **Action:** Analyze requirements, features, and input suggestions/principles
245
-
246
- ```
247
- 1. FOR EACH file in scope:
248
- - IDENTIFY associated requirements, features, tech specs
249
- - BUILD context_map with all relationships
250
-
251
- 2. REVIEW refactoring_suggestion:
252
- - EXTRACT goals and priorities
253
- - NOTE target_structure as end-state vision
254
- - UNDERSTAND rationale for each goal
255
-
256
- 3. REVIEW refactoring_principle:
257
- - EXTRACT primary_principles and their applications
258
- - NOTE constraints and preservation requirements
259
- - MAP principles to specific code areas
260
-
107
+ 1. FOR EACH file in scope → BUILD context_map with requirements, features, tech specs
108
+ 2. REVIEW refactoring_suggestion → EXTRACT goals, priorities, target_structure
109
+ 3. REVIEW refactoring_principle → MAP principles to code areas, note constraints
261
110
  4. IDENTIFY impacts (docs, tests, downstream code)
262
-
263
- 5. VALIDATE alignment:
264
- - Suggestions align with code_quality_evaluated gaps?
265
- - Principles applicable to identified problem areas?
266
- - Constraints achievable with current codebase?
267
- ```
111
+ 5. VALIDATE alignment with code_quality_evaluated gaps
268
112
 
269
113
  **Output:** context_map with code relationships and principle-to-code mapping
270
114
 
@@ -272,140 +116,59 @@ Execute Code Refactor V2 by following these steps in order:
272
116
 
273
117
  ### Step 2: Generate Refactoring Plan
274
118
 
275
- **Action:** Create detailed refactoring plan following suggestions and principles
276
-
277
- ```
278
- 1. ANALYZE current structure (sizes, smells, principle violations)
279
-
280
- 2. DESIGN target structure per refactoring_suggestion.target_structure:
281
- FOR EACH primary_principle in refactoring_principle:
282
- - Apply principle to specific areas as defined in applications
283
- - SOLID: Extract classes/modules for SRP violations
284
- - DRY: Plan abstractions for duplications
285
- - KISS: Plan simplifications
286
- - YAGNI: Remove unused code
287
- - SoC: Separate mixed concerns
288
-
289
- 3. CREATE refactoring_plan with phases:
290
- FOR EACH goal in refactoring_suggestion.goals (by priority):
291
- - phase, name, changes (type/from/to/reason/principle_applied), risk, tests_affected
292
- - ENSURE each change references the principle driving it
293
-
294
- 4. VALIDATE plan against constraints:
295
- FOR EACH constraint in refactoring_principle.constraints:
296
- - VERIFY plan respects constraint
297
- - IF violation → revise plan
298
-
299
- 5. CREATE test_plan and doc_plan
300
-
301
- 6. PRESENT plan to human:
302
- "Refactoring Plan Summary:
303
- - Goals: {goals_addressed}
304
- - Principles Applied: {principle_list}
305
- - Phases: {phase_count}
306
- - Constraints Respected: {constraint_list}
307
-
308
- [Detailed phase breakdown...]"
309
-
310
- 7. WAIT for human approval
311
- ```
119
+ 1. ANALYZE current structure (sizes, smells, violations)
120
+ 2. DESIGN target structure applying principles:
121
+ - SOLID: Extract classes/modules for SRP violations
122
+ - DRY: Plan abstractions | KISS: Simplifications | YAGNI: Remove unused
123
+ 3. CREATE refactoring_plan with phases (by goal priority)
124
+ 4. VALIDATE plan against constraints
125
+ 5. PRESENT plan WAIT for human approval
312
126
 
313
127
  ---
314
128
 
315
129
  ### Step 3: Execute Refactoring
316
130
 
317
- **Action:** Apply refactoring plan per principles incrementally with test validation
318
-
319
131
  ```
320
132
  FOR EACH phase:
321
133
  1. CREATE checkpoint: git commit -m "checkpoint: before phase {N}"
322
-
323
- 2. FOR EACH change:
324
- - Apply change following the principle_applied for this change
325
- - VERIFY change aligns with constraint requirements
326
- - Update imports and exports
327
-
328
- 3. RUN tests immediately after each change
329
-
330
- 4. IF tests fail:
331
- - Import error → Fix import
332
- - Behavior changed → REVERT to checkpoint, revise plan
333
- - Legitimate update → Update test, document why
334
-
335
- 5. LOG principle application:
336
- "Applied {principle} to {area}: {action}"
337
-
338
- 6. COMMIT: git commit -m "refactor({scope}): {description} [principle: {principle}]"
339
-
340
- 7. LOG phase completion with principles applied
134
+ 2. Apply changes following principle_applied, update imports
135
+ 3. RUN tests after each change
136
+ 4. IF tests fail: Fix import | REVERT if behavior changed | Update test if legitimate
137
+ 5. COMMIT: git commit -m "refactor({scope}): {desc} [principle: {p}]"
341
138
  ```
342
139
 
343
140
  ---
344
141
 
345
142
  ### Step 4: Update References
346
143
 
347
- **Action:** Update all documentation to reflect new code structure
144
+ 1. UPDATE technical designs (component list, paths, Design Change Log)
145
+ 2. UPDATE feature specifications (file references)
146
+ 3. UPDATE requirements (implementation notes)
147
+ 4. COMPILE references_updated list
348
148
 
349
- ```
350
- 1. UPDATE technical designs:
351
- - Update component list, file locations, import paths
352
- - ADD to Design Change Log with date and summary
353
-
354
- 2. UPDATE feature specifications (file references, code snippets)
149
+ ---
355
150
 
356
- 3. UPDATE requirements (implementation notes, file references)
151
+ ### Step 5: Validate and Complete
357
152
 
358
- 4. COMPILE references_updated with all paths
359
- ```
153
+ 1. RUN final test suite (coverage maintained/improved)
154
+ 2. VALIDATE goals achieved from refactoring_suggestion
155
+ 3. VALIDATE principles applied, constraints respected
156
+ 4. CALCULATE quality improvements (before/after scores)
157
+ 5. PRESENT summary → WAIT for human approval
158
+ 6. CREATE final commit
360
159
 
361
160
  ---
362
161
 
363
- ### Step 5: Validate and Complete
162
+ ### Step 6: Apply Tracing
364
163
 
365
- **Action:** Verify quality improvement against suggestions and principles
164
+ > **📚 Detailed Procedure:** See [references/refactoring-techniques.md](references/refactoring-techniques.md#tracing-instrumentation)
366
165
 
367
- ```
368
- 1. RUN final test suite (all must pass, coverage maintained/improved)
369
-
370
- 2. VALIDATE against refactoring_suggestion.goals:
371
- FOR EACH goal:
372
- - VERIFY goal achieved
373
- - NOTE if partially achieved or skipped
374
-
375
- 3. VALIDATE against refactoring_principle:
376
- FOR EACH primary_principle:
377
- - VERIFY principle applied in specified areas
378
- - VERIFY no new violations introduced
379
- FOR EACH constraint:
380
- - VERIFY constraint respected
381
-
382
- 4. CALCULATE quality improvements:
383
- - Run static analysis (before vs after)
384
- - Score: readability, maintainability, testability, cohesion, coupling
385
- - Calculate overall quality_score_before and quality_score_after
386
-
387
- 5. VERIFY test coverage (if degraded → add tests before completing)
388
-
389
- 6. COMPILE refactoring_summary:
390
- - files_modified, files_created, files_deleted
391
- - tests_updated
392
- - principles_applied: [<list with application counts>]
393
- - goals_achieved: [<from refactoring_suggestion>]
394
-
395
- 7. PRESENT summary to human:
396
- "Refactoring Complete
397
-
398
- Goals Achieved: {goal_list}
399
- Principles Applied: {principle_list with counts}
400
- Constraints Respected: {constraint_list}
401
-
402
- Quality: {before_score} → {after_score}
403
- Coverage: {before}% → {after}%"
404
-
405
- 8. WAIT for human approval
406
-
407
- 9. CREATE final commit
408
- ```
166
+ 1. CHECK tracing preserved on moved/renamed functions
167
+ 2. IDENTIFY new code needing tracing
168
+ 3. INVOKE `tool-tracing-instrumentation` skill for new files/functions
169
+ 4. RE-RUN tests → UPDATE tracing counts in summary
170
+
171
+ **Skip if:** No tracing infrastructure or only non-code files touched
409
172
 
410
173
  ---
411
174
 
@@ -422,68 +185,79 @@ FOR EACH phase:
422
185
  | 7 | Requirements updated (if affected) | Yes |
423
186
  | 8 | All changes committed | Yes |
424
187
  | 9 | Human review approved | Yes |
188
+ | 10 | Existing tracing preserved | Yes |
189
+ | 11 | New/moved code has tracing decorators | Yes |
425
190
 
426
- **Important:** After completing this skill, always return to `task-execution-guideline` skill to continue the task execution flow and validate the DoD defined there.
191
+ ### Tracing Preservation Rules
427
192
 
428
- ---
193
+ | Scenario | Action |
194
+ |----------|--------|
195
+ | Moving functions | Keep `@x_ipe_tracing` decorators, preserve `redact=[]` |
196
+ | Splitting modules | Each new module's public functions get decorators |
197
+ | Renaming functions | Decorator stays attached |
198
+ | Adding new code | Apply `@x_ipe_tracing` via `tool-tracing-instrumentation` |
429
199
 
430
- ## Patterns
200
+ ---
431
201
 
432
- ### Pattern: Extract Module
202
+ ## Output Attributes
433
203
 
434
- **When:** File has multiple responsibilities
435
- **Then:**
436
- ```
437
- 1. Identify cohesive code blocks
438
- 2. Create new file per responsibility
439
- 3. Move code with tests
440
- 4. Update imports everywhere
441
- 5. Run tests after each move
204
+ ```yaml
205
+ Output:
206
+ category: code-refactoring-stage
207
+ status: completed | blocked
208
+ next_task_type: null
209
+ require_human_review: Yes
210
+ task_output_links: [<paths to refactored files>]
211
+
212
+ refactoring_summary:
213
+ files_modified: <count>
214
+ files_created: <count>
215
+ files_deleted: <count>
216
+ principles_applied: [{ principle, application_count, areas }]
217
+ goals_achieved: [{ goal, status, notes }]
218
+
219
+ code_quality_evaluated:
220
+ quality_score_before: <1-10>
221
+ quality_score_after: <1-10>
222
+ test_coverage: { before, after, status }
223
+ references_updated: { requirements, specifications, technical_designs }
442
224
  ```
443
225
 
444
- ### Pattern: Apply SOLID Principles
226
+ > **📚 Full Output Structure:** See [references/refactoring-techniques.md](references/refactoring-techniques.md#output-structure-definition)
445
227
 
446
- **When:** refactoring_principle includes SOLID in primary_principles
447
- **Then:**
448
- ```
449
- 1. Review applications defined for SOLID principle
450
- 2. S - Split classes with multiple reasons to change
451
- 3. O - Extract interfaces for extension points
452
- 4. L - Ensure subtypes are substitutable
453
- 5. I - Split fat interfaces
454
- 6. D - Inject dependencies instead of creating
455
- 6. LOG each application for traceability
456
- ```
228
+ ---
457
229
 
458
- ### Pattern: Rollback on Failure
230
+ ## Patterns
231
+
232
+ ### Extract Module
233
+ **When:** File has multiple responsibilities
234
+ **Then:** Identify cohesive blocks → Create new file per responsibility → Move with tests → Update imports → Test after each move
459
235
 
236
+ ### Apply SOLID Principles
237
+ **When:** refactoring_principle includes SOLID
238
+ **Then:** S-Split classes → O-Extract interfaces → L-Ensure substitutability → I-Split fat interfaces → D-Inject dependencies
239
+
240
+ ### Rollback on Failure
460
241
  **When:** Tests fail after change
461
- **Then:**
462
- ```
463
- 1. STOP immediately
464
- 2. Analyze failure cause
465
- 3. If behavior change: git revert to checkpoint
466
- 4. If import issue: fix and retry
467
- 5. If legitimate update: update test carefully
468
- ```
242
+ **Then:** STOP → Analyze cause → Revert if behavior changed → Fix if import issue → Update test if legitimate
469
243
 
470
244
  ---
471
245
 
472
246
  ## Anti-Patterns
473
247
 
474
- | Anti-Pattern | Why Bad | Do Instead |
475
- |--------------|---------|------------|
476
- | Big bang refactor | Hard to debug | Small incremental changes |
477
- | Skip test runs | Miss regressions | Test after EVERY change |
478
- | Change behavior | Hidden bugs | Structure only, same behavior |
479
- | Ignore failing tests | Technical debt | Fix immediately or revert |
480
- | Skip doc updates | Stale documentation | Always update docs at end |
481
- | Lower coverage | Reduced safety | Maintain or improve coverage |
482
- | Ignore suggestions | Miss goals | Follow refactoring_suggestion goals |
483
- | Violate constraints | Break requirements | Always respect constraints |
248
+ | Anti-Pattern | Do Instead |
249
+ |--------------|------------|
250
+ | Big bang refactor | Small incremental changes |
251
+ | Skip test runs | Test after EVERY change |
252
+ | Change behavior | Structure only, same behavior |
253
+ | Ignore failing tests | Fix immediately or revert |
254
+ | Skip doc updates | Always update docs at end |
255
+ | Ignore suggestions | Follow refactoring_suggestion goals |
256
+ | Violate constraints | Always respect constraints |
484
257
 
485
258
  ---
486
259
 
487
- ## Example
260
+ ## References
488
261
 
489
- See [references/examples.md](references/examples.md) for concrete execution examples.
262
+ - [Refactoring Techniques](references/refactoring-techniques.md) - Detailed procedures, input/output structures, tracing rules
263
+ - [Examples](references/examples.md) - Concrete execution examples