codeninja 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +11 -0
- package/README.md +293 -0
- package/agent/database-agent.md +504 -0
- package/agent/designs/README.md +10 -0
- package/agent/global-agent.md +236 -0
- package/agent/nodejs-agent.md +406 -0
- package/agent/reactjs-agent.md +260 -0
- package/cli.js +352 -0
- package/commands/audit.workflow.md +111 -0
- package/commands/create-api.workflow.md +99 -0
- package/commands/db-add-index.workflow.md +97 -0
- package/commands/db-create-table.workflow.md +132 -0
- package/commands/db-drop-table.workflow.md +103 -0
- package/commands/db-modify-table.workflow.md +159 -0
- package/commands/db-seed.workflow.md +99 -0
- package/commands/db-sync.workflow.md +100 -0
- package/commands/design.workflow.md +66 -0
- package/commands/initialize-project.workflow.md +500 -0
- package/commands/integrate-api.workflow.md +448 -0
- package/commands/modularize.workflow.md +329 -0
- package/commands/refactor.workflow.md +70 -0
- package/commands/sync.workflow.md +962 -0
- package/commands/test.workflow.md +40 -0
- package/commands/validate-page.workflow.md +543 -0
- package/mcp-server.js +842 -0
- package/package.json +24 -0
- package/tasks/README.md +283 -0
- package/tasks/add-health-route.task.md +103 -0
- package/tasks/ask-api-integration-scope.task.md +34 -0
- package/tasks/ask-api-key.task.md +23 -0
- package/tasks/ask-api-version.task.md +28 -0
- package/tasks/ask-client-type.task.md +24 -0
- package/tasks/ask-column-enum-values.task.md +51 -0
- package/tasks/ask-column-is-enum.task.md +39 -0
- package/tasks/ask-column-name.task.md +39 -0
- package/tasks/ask-column-position.task.md +39 -0
- package/tasks/ask-column-type.task.md +59 -0
- package/tasks/ask-database-config.task.md +66 -0
- package/tasks/ask-database-host.task.md +16 -0
- package/tasks/ask-database-name.task.md +18 -0
- package/tasks/ask-database-port.task.md +23 -0
- package/tasks/ask-database-type.task.md +30 -0
- package/tasks/ask-database-user.task.md +14 -0
- package/tasks/ask-design-description.task.md +16 -0
- package/tasks/ask-design-target.task.md +24 -0
- package/tasks/ask-encrypted-transport.task.md +25 -0
- package/tasks/ask-encryption-iv.task.md +23 -0
- package/tasks/ask-encryption-key.task.md +23 -0
- package/tasks/ask-feature-name.task.md +20 -0
- package/tasks/ask-http-method.task.md +21 -0
- package/tasks/ask-index-columns.task.md +46 -0
- package/tasks/ask-index-file-placement.task.md +33 -0
- package/tasks/ask-index-sort-order.task.md +37 -0
- package/tasks/ask-index-type.task.md +42 -0
- package/tasks/ask-init-mode.task.md +28 -0
- package/tasks/ask-linked-service.task.md +57 -0
- package/tasks/ask-modify-operation.task.md +36 -0
- package/tasks/ask-modularize-scope.task.md +31 -0
- package/tasks/ask-module-name.task.md +30 -0
- package/tasks/ask-new-column-name.task.md +21 -0
- package/tasks/ask-new-table-name.task.md +22 -0
- package/tasks/ask-old-column-name.task.md +22 -0
- package/tasks/ask-package-author.task.md +16 -0
- package/tasks/ask-package-name.task.md +23 -0
- package/tasks/ask-page-path.task.md +40 -0
- package/tasks/ask-primary-table.task.md +30 -0
- package/tasks/ask-project-figma.task.md +71 -0
- package/tasks/ask-project-info-doc.task.md +57 -0
- package/tasks/ask-project-scope-of-work.task.md +57 -0
- package/tasks/ask-project-type.task.md +24 -0
- package/tasks/ask-react-target-service.task.md +32 -0
- package/tasks/ask-redis-config.task.md +42 -0
- package/tasks/ask-redis-host.task.md +16 -0
- package/tasks/ask-redis-port.task.md +18 -0
- package/tasks/ask-refactor-type.task.md +26 -0
- package/tasks/ask-requires-auth.task.md +22 -0
- package/tasks/ask-response-mode.task.md +38 -0
- package/tasks/ask-route-description.task.md +20 -0
- package/tasks/ask-route-path.task.md +29 -0
- package/tasks/ask-seed-row-values.task.md +42 -0
- package/tasks/ask-seed-rows-count.task.md +22 -0
- package/tasks/ask-service-description.task.md +16 -0
- package/tasks/ask-service-name.task.md +27 -0
- package/tasks/ask-service-port.task.md +24 -0
- package/tasks/ask-supported-languages.task.md +40 -0
- package/tasks/ask-table-file-number.task.md +36 -0
- package/tasks/ask-table-indexes.task.md +47 -0
- package/tasks/ask-table-name.task.md +32 -0
- package/tasks/ask-table-needs-soft-delete.task.md +29 -0
- package/tasks/ask-table-needs-status.task.md +30 -0
- package/tasks/ask-table-purpose.task.md +28 -0
- package/tasks/ask-table-seed-data.task.md +44 -0
- package/tasks/ask-target-service.task.md +32 -0
- package/tasks/ask-test-type.task.md +20 -0
- package/tasks/ask-validation-library.task.md +38 -0
- package/tasks/detect-repository-state.task.md +92 -0
- package/tasks/generate-app.task.md +146 -0
- package/tasks/generate-common.task.md +330 -0
- package/tasks/generate-constants.task.md +123 -0
- package/tasks/generate-database.task.md +168 -0
- package/tasks/generate-docker-compose.task.md +298 -0
- package/tasks/generate-dockerfile.task.md +126 -0
- package/tasks/generate-dockerignore.task.md +123 -0
- package/tasks/generate-enc-dec-html.task.md +127 -0
- package/tasks/generate-enc-dec-php.task.md +145 -0
- package/tasks/generate-encryption.task.md +159 -0
- package/tasks/generate-fast-defaults.task.md +68 -0
- package/tasks/generate-gitignore.task.md +79 -0
- package/tasks/generate-headerValidator.task.md +377 -0
- package/tasks/generate-ide-configs.task.md +114 -0
- package/tasks/generate-ioRedis.task.md +120 -0
- package/tasks/generate-language-en.task.md +155 -0
- package/tasks/generate-logging.task.md +257 -0
- package/tasks/generate-model.task.md +180 -0
- package/tasks/generate-notification.task.md +251 -0
- package/tasks/generate-package-json.task.md +114 -0
- package/tasks/generate-rateLimiter.task.md +125 -0
- package/tasks/generate-react-api-client.task.md +169 -0
- package/tasks/generate-react-api-handler.task.md +102 -0
- package/tasks/generate-react-app-jsx.task.md +56 -0
- package/tasks/generate-react-dockerfile.task.md +175 -0
- package/tasks/generate-react-env.task.md +58 -0
- package/tasks/generate-react-gitignore.task.md +49 -0
- package/tasks/generate-react-htaccess.task.md +54 -0
- package/tasks/generate-react-index-html.task.md +53 -0
- package/tasks/generate-react-index-jsx.task.md +51 -0
- package/tasks/generate-react-package-json.task.md +77 -0
- package/tasks/generate-react-welcome-page.task.md +71 -0
- package/tasks/generate-readme.task.md +160 -0
- package/tasks/generate-response.task.md +202 -0
- package/tasks/generate-route-manager.task.md +173 -0
- package/tasks/generate-route.task.md +203 -0
- package/tasks/generate-swagger.task.md +290 -0
- package/tasks/generate-tbl-user-deviceinfo.task.md +75 -0
- package/tasks/generate-template.task.md +129 -0
- package/tasks/generate-validator.task.md +122 -0
- package/tasks/show-db-table-summary.task.md +66 -0
- package/tasks/show-final-summary.task.md +108 -0
- package/tasks/show-init-summary.task.md +257 -0
- package/tasks/write-context.task.md +314 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: workflow
|
|
3
|
+
name: modularize
|
|
4
|
+
description: >
|
|
5
|
+
Scans one or all ReactJS pages, extracts repeated layout blocks
|
|
6
|
+
(header, footer, sidebar, navbar, etc.) into reusable components,
|
|
7
|
+
and rewrites each page to import and use those components. Reuses
|
|
8
|
+
existing components when they already exist. Never rewrites component
|
|
9
|
+
logic — layout structure only.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Workflow: @modularize
|
|
13
|
+
|
|
14
|
+
## Goal
|
|
15
|
+
Identify repeated structural blocks across pages, create shared components
|
|
16
|
+
for them under `src/components/`, and update each page to use the new
|
|
17
|
+
components. Result: zero duplicated layout HTML across the project.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Read ALL target pages fully before creating any component
|
|
21
|
+
- NEVER create a component that already exists under `src/components/`
|
|
22
|
+
— reuse it instead
|
|
23
|
+
- NEVER modify business logic, state, API calls, or event handlers
|
|
24
|
+
in any page file — layout structure only
|
|
25
|
+
- NEVER break existing imports or prop flows
|
|
26
|
+
- ONE confirmation before any file is written
|
|
27
|
+
- After writing files → run task: `write-context`
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Step-by-Step Execution
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Phase 1 — Target Selection
|
|
36
|
+
|
|
37
|
+
1. Run task: `ask-react-target-service`
|
|
38
|
+
Stores: `context.current_action.service_name`
|
|
39
|
+
|
|
40
|
+
2. Run task: `ask-modularize-scope`
|
|
41
|
+
Stores: `context.current_action.modularize_scope`
|
|
42
|
+
If scope == "specific" → also stores `context.current_action.page_path`
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### Phase 2 — Inventory Existing Components
|
|
47
|
+
|
|
48
|
+
Before scanning pages, inventory what already exists:
|
|
49
|
+
|
|
50
|
+
1. Scan `src/components/` in the target service.
|
|
51
|
+
For each subdirectory → record the component name and its file path.
|
|
52
|
+
Example findings:
|
|
53
|
+
- `src/components/Header/index.jsx` → component: Header
|
|
54
|
+
- `src/components/Sidebar/index.jsx` → component: Sidebar
|
|
55
|
+
- `src/components/layout/Navbar/index.jsx` → component: Navbar
|
|
56
|
+
|
|
57
|
+
2. For each existing component:
|
|
58
|
+
- Read the file
|
|
59
|
+
- Identify what structural role it plays (header, footer, sidebar,
|
|
60
|
+
navbar, modal wrapper, card shell, breadcrumbs, etc.)
|
|
61
|
+
- Record: `{ name, path, role, props_accepted }`
|
|
62
|
+
|
|
63
|
+
3. Store the full inventory as the "existing components registry" in memory.
|
|
64
|
+
This is the source of truth for the reuse decision in Phase 4.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Phase 3 — Scan Target Pages
|
|
69
|
+
|
|
70
|
+
#### If scope == "all":
|
|
71
|
+
Scan `src/pages/` — for each subdirectory containing `index.jsx` or
|
|
72
|
+
`index.js`, add it to the pages list.
|
|
73
|
+
Also scan `src/views/` if it exists.
|
|
74
|
+
|
|
75
|
+
#### If scope == "specific":
|
|
76
|
+
Pages list = [ context.current_action.page_path ]
|
|
77
|
+
|
|
78
|
+
For each page in the pages list:
|
|
79
|
+
|
|
80
|
+
1. Read the full file content.
|
|
81
|
+
|
|
82
|
+
2. Parse the JSX structure to identify the top-level layout blocks.
|
|
83
|
+
A layout block is a JSX subtree that:
|
|
84
|
+
- Appears at the top level of the return statement (not inside
|
|
85
|
+
a conditional or a list map)
|
|
86
|
+
- Has a clear structural role in the visual layout
|
|
87
|
+
- Does NOT contain unique per-page business logic
|
|
88
|
+
|
|
89
|
+
3. Classify each block using these roles (in priority order):
|
|
90
|
+
- **header** — contains site logo, navigation links, user avatar/menu,
|
|
91
|
+
search bar. Typically rendered at the very top of every page.
|
|
92
|
+
- **footer** — copyright text, footer links, social icons. Bottom.
|
|
93
|
+
- **sidebar** — vertical navigation panel, collapsible menu, drawer.
|
|
94
|
+
- **navbar** — horizontal navigation bar, tab bar, breadcrumbs.
|
|
95
|
+
- **topbar** — page title row with action buttons (e.g. "Users | + Add New")
|
|
96
|
+
- **page-wrapper** — the outer container div that sets max-width,
|
|
97
|
+
padding, or background — wraps all page content.
|
|
98
|
+
- **card** — a bordered/shadowed container used for data display.
|
|
99
|
+
Only extract as a component if it appears in 2+ pages unchanged.
|
|
100
|
+
- **modal-shell** — the backdrop + centered box wrapper for modals.
|
|
101
|
+
Only extract if used in 2+ pages unchanged.
|
|
102
|
+
|
|
103
|
+
4. Record for each block:
|
|
104
|
+
- Role (from list above)
|
|
105
|
+
- Exact JSX tree content
|
|
106
|
+
- Props/variables it references from the parent page scope
|
|
107
|
+
- Which pages it appears in (identical or near-identical)
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### Phase 4 — Decide: Create vs Reuse vs Skip
|
|
112
|
+
|
|
113
|
+
For each block found across all pages, make one of three decisions:
|
|
114
|
+
|
|
115
|
+
**REUSE** — an existing component from Phase 2 already covers this role.
|
|
116
|
+
Condition: an existing component has the same `role` AND its structure
|
|
117
|
+
matches the block (same element types, same general layout — minor
|
|
118
|
+
class name differences are acceptable).
|
|
119
|
+
Action: the page will import the existing component. No new file created.
|
|
120
|
+
|
|
121
|
+
**CREATE** — no existing component covers this role.
|
|
122
|
+
Condition: no match in existing components registry.
|
|
123
|
+
Additional condition: the block appears in at least ONE page
|
|
124
|
+
(for header/footer/sidebar/navbar/topbar/page-wrapper — always create
|
|
125
|
+
even if seen on only one page, because they are foundational layout).
|
|
126
|
+
For card/modal-shell → only create if seen on 2+ pages unchanged.
|
|
127
|
+
Action: a new component will be created.
|
|
128
|
+
|
|
129
|
+
**SKIP** — the block is too unique to extract.
|
|
130
|
+
Condition: the block contains page-specific state, API calls, or
|
|
131
|
+
dynamic content that cannot be expressed as simple props.
|
|
132
|
+
Example: a sidebar that renders a different menu depending on user role
|
|
133
|
+
and reads from a page-specific hook → SKIP.
|
|
134
|
+
Action: leave the block inline in the page. Note it in the report.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Phase 5 — Build Component Plan
|
|
139
|
+
|
|
140
|
+
For each block decided as CREATE, determine:
|
|
141
|
+
|
|
142
|
+
1. **Component name** — PascalCase of the role.
|
|
143
|
+
Examples: Header, Footer, Sidebar, Navbar, PageTopbar, PageWrapper,
|
|
144
|
+
DataCard, ModalShell.
|
|
145
|
+
If a more specific name is obvious from the content
|
|
146
|
+
(e.g. the sidebar contains "Admin Menu") → use AdminSidebar.
|
|
147
|
+
|
|
148
|
+
2. **File path** — `src/components/<ComponentName>/index.jsx`
|
|
149
|
+
and `src/components/<ComponentName>/<ComponentName>.module.css`
|
|
150
|
+
|
|
151
|
+
3. **Props** — anything the block references from the parent scope
|
|
152
|
+
that varies between pages must become a prop.
|
|
153
|
+
Examples:
|
|
154
|
+
- Page title → `title` prop
|
|
155
|
+
- Active nav item → `activeItem` prop
|
|
156
|
+
- User display name in header → `userName` prop
|
|
157
|
+
Common static content (logo, copyright text, link list) → hardcoded
|
|
158
|
+
inside the component, not a prop.
|
|
159
|
+
|
|
160
|
+
4. **CSS extraction** — any inline styles or style classes that belong
|
|
161
|
+
only to this block are moved to the component's `.module.css` file.
|
|
162
|
+
Classes shared with the rest of the page remain in the page's own
|
|
163
|
+
`.module.css`. Do not break existing page styles.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### Phase 6 — Show Plan and Confirm
|
|
168
|
+
|
|
169
|
+
Display the modularization plan:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
┌──────────────────────────────────────────────────────┐
|
|
173
|
+
│ MODULARIZATION PLAN │
|
|
174
|
+
├──────────────────────────────────────────────────────┤
|
|
175
|
+
│ Service : [service_name] │
|
|
176
|
+
│ Pages scanned: [n] │
|
|
177
|
+
├──────────────────────────────────────────────────────┤
|
|
178
|
+
│ COMPONENTS TO CREATE │
|
|
179
|
+
│ → src/components/Header/index.jsx │
|
|
180
|
+
│ Props: userName, activeItem │
|
|
181
|
+
│ Used by: Login, Dashboard, Profile (3 pages) │
|
|
182
|
+
│ │
|
|
183
|
+
│ → src/components/Footer/index.jsx │
|
|
184
|
+
│ Props: none │
|
|
185
|
+
│ Used by: all 3 pages │
|
|
186
|
+
├──────────────────────────────────────────────────────┤
|
|
187
|
+
│ COMPONENTS TO REUSE (already exist) │
|
|
188
|
+
│ → src/components/Sidebar/index.jsx [existing] │
|
|
189
|
+
│ Will be imported into: Dashboard, Profile │
|
|
190
|
+
├──────────────────────────────────────────────────────┤
|
|
191
|
+
│ BLOCKS SKIPPED (too page-specific to extract) │
|
|
192
|
+
│ → Dashboard hero banner — contains dynamic API data │
|
|
193
|
+
├──────────────────────────────────────────────────────┤
|
|
194
|
+
│ PAGES TO UPDATE │
|
|
195
|
+
│ → src/pages/Login/index.jsx │
|
|
196
|
+
│ → src/pages/Dashboard/index.jsx │
|
|
197
|
+
│ → src/pages/Profile/index.jsx │
|
|
198
|
+
└──────────────────────────────────────────────────────┘
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Ask exactly this question:
|
|
202
|
+
"Proceed with this modularization plan? (yes / no / adjust)"
|
|
203
|
+
|
|
204
|
+
- If yes → proceed to Phase 7 immediately
|
|
205
|
+
- If no → abort. Nothing is created.
|
|
206
|
+
- If adjust → ask: "What would you like to change?"
|
|
207
|
+
Allow the user to exclude a component, rename one, or change a
|
|
208
|
+
prop assignment. Apply the adjustment and re-display the plan.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### Phase 7 — Generate Components
|
|
213
|
+
|
|
214
|
+
For each component in the CREATE list:
|
|
215
|
+
|
|
216
|
+
#### Generate `src/components/<ComponentName>/index.jsx`
|
|
217
|
+
|
|
218
|
+
Structure:
|
|
219
|
+
- JSDoc block above the component:
|
|
220
|
+
```
|
|
221
|
+
/**
|
|
222
|
+
* [Role] component shared across all pages.
|
|
223
|
+
*
|
|
224
|
+
* @param {Object} props
|
|
225
|
+
* @param {string} [props.<propName>] - [description] ← one line per prop
|
|
226
|
+
* @returns {JSX.Element}
|
|
227
|
+
*/
|
|
228
|
+
```
|
|
229
|
+
- Import React at the top
|
|
230
|
+
- Import CSS module: `import styles from './<ComponentName>.module.css'`
|
|
231
|
+
- Functional component with props destructured in the signature
|
|
232
|
+
- JSX extracted verbatim from the source page, with parent-scope
|
|
233
|
+
variable references replaced by the corresponding prop name
|
|
234
|
+
- Default export
|
|
235
|
+
|
|
236
|
+
#### Generate `src/components/<ComponentName>/<ComponentName>.module.css`
|
|
237
|
+
|
|
238
|
+
- Move all CSS classes that belong exclusively to this component's
|
|
239
|
+
block from the source page's `.module.css`
|
|
240
|
+
- If no specific classes are used → generate an empty file with a
|
|
241
|
+
comment: `/* Styles for <ComponentName> */`
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### Phase 8 — Update Pages
|
|
246
|
+
|
|
247
|
+
For each page in the pages list that references at least one component
|
|
248
|
+
(created or reused):
|
|
249
|
+
|
|
250
|
+
Read the current page file. Apply these surgical edits:
|
|
251
|
+
|
|
252
|
+
1. **Add imports** at the top of the file, after existing imports:
|
|
253
|
+
```jsx
|
|
254
|
+
import Header from '../../components/Header';
|
|
255
|
+
import Footer from '../../components/Footer';
|
|
256
|
+
```
|
|
257
|
+
Use the correct relative path from the page file's location to
|
|
258
|
+
`src/components/`. Always use `../../components/` from the standard
|
|
259
|
+
`src/pages/<PageName>/` depth.
|
|
260
|
+
|
|
261
|
+
2. **Replace the extracted JSX block** with the component tag.
|
|
262
|
+
Pass any required props using the values that were previously
|
|
263
|
+
inline in the page.
|
|
264
|
+
Example:
|
|
265
|
+
Before: `<header className={styles.header}><nav>...</nav></header>`
|
|
266
|
+
After: `<Header activeItem="dashboard" userName={user.name} />`
|
|
267
|
+
|
|
268
|
+
3. **Remove orphaned imports** — if the original block used an import
|
|
269
|
+
that is no longer referenced in the page after extraction
|
|
270
|
+
(e.g. a logo image import that moved into the Header component) →
|
|
271
|
+
remove it from the page's import list.
|
|
272
|
+
|
|
273
|
+
4. **Clean up orphaned CSS classes** — if classes were moved to the
|
|
274
|
+
component's CSS module, remove them from the page's `.module.css`.
|
|
275
|
+
|
|
276
|
+
Never modify:
|
|
277
|
+
- Business logic functions (state, useEffect, API calls)
|
|
278
|
+
- The page's own JSX content outside the extracted blocks
|
|
279
|
+
- Event handlers, form logic, any non-layout code
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
### Phase 9 — Write Context and Report
|
|
284
|
+
|
|
285
|
+
Run task: `write-context` with:
|
|
286
|
+
- Append to `context.services[<service_name>].components`:
|
|
287
|
+
For each new component created:
|
|
288
|
+
`{ name, path, role, props, used_by: [page_names], created_by: "modularize" }`
|
|
289
|
+
- Set `last_command` = "modularize"
|
|
290
|
+
- Append to top-level `change_log`:
|
|
291
|
+
`{ timestamp, command: "modularize", action: "Created [n] components, updated [n] pages", affected_files: [...] }`
|
|
292
|
+
- After write-context → call MCP tool `context_clear_scratchpad` with keys: ["current_action"]
|
|
293
|
+
|
|
294
|
+
Display the modularization report:
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
@modularize Complete
|
|
298
|
+
─────────────────────────────────────────
|
|
299
|
+
Components created : [n]
|
|
300
|
+
Components reused : [n]
|
|
301
|
+
Pages updated : [n]
|
|
302
|
+
Blocks skipped : [n]
|
|
303
|
+
─────────────────────────────────────────
|
|
304
|
+
Created:
|
|
305
|
+
✓ src/components/Header/index.jsx
|
|
306
|
+
✓ src/components/Header/Header.module.css
|
|
307
|
+
✓ src/components/Footer/index.jsx
|
|
308
|
+
✓ src/components/Footer/Footer.module.css
|
|
309
|
+
|
|
310
|
+
Updated:
|
|
311
|
+
✓ src/pages/Login/index.jsx
|
|
312
|
+
✓ src/pages/Dashboard/index.jsx
|
|
313
|
+
✓ src/pages/Profile/index.jsx
|
|
314
|
+
─────────────────────────────────────────
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Run task: `show-final-summary`
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## What This Workflow Does NOT Do
|
|
322
|
+
|
|
323
|
+
- Does not create page-level components (forms, tables, charts) —
|
|
324
|
+
only layout/structural shell components
|
|
325
|
+
- Does not add routing — components are not registered in App.jsx
|
|
326
|
+
- Does not touch any backend files
|
|
327
|
+
- Does not modify apiHandler.js or apiClient.js
|
|
328
|
+
- Does not add state management (Redux, Context API)
|
|
329
|
+
- Does not install any new npm packages
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: workflow
|
|
3
|
+
name: refactor
|
|
4
|
+
description: >
|
|
5
|
+
Rename, restructure, or improve existing code. Always records changes in
|
|
6
|
+
context.change_log so all agents remain aware of the history.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Workflow: @refactor
|
|
10
|
+
|
|
11
|
+
## Goal
|
|
12
|
+
Make a controlled change to existing code with full traceability in context.
|
|
13
|
+
|
|
14
|
+
## Rules
|
|
15
|
+
- Every rename is recorded in `context.change_log`
|
|
16
|
+
- DB column renames generate a migration file
|
|
17
|
+
- Never delete the old name from change_log
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step-by-Step Execution
|
|
22
|
+
|
|
23
|
+
1. Run task: `ask-refactor-type`
|
|
24
|
+
- Options: rename DB column, rename service, rename module, restructure files
|
|
25
|
+
- Stores: `context.current_refactor.type`
|
|
26
|
+
|
|
27
|
+
2. Run task: `ask-target-service` (if applicable)
|
|
28
|
+
|
|
29
|
+
3. Based on refactor type:
|
|
30
|
+
|
|
31
|
+
### rename DB column
|
|
32
|
+
- Run task: `ask-table-name`
|
|
33
|
+
- Run task: `ask-old-column-name`
|
|
34
|
+
- Run task: `ask-new-column-name`
|
|
35
|
+
- Delegate to `database-agent`:
|
|
36
|
+
- Generate ALTER TABLE migration
|
|
37
|
+
- Update `context.db.schema.tables[<table>].columns`
|
|
38
|
+
- Append to `context.db.schema.change_log`
|
|
39
|
+
- Delegate to `nodejs-agent`:
|
|
40
|
+
- Find all references to old column name in service files
|
|
41
|
+
- Update model queries
|
|
42
|
+
- Update swagger_doc.json
|
|
43
|
+
|
|
44
|
+
### rename service
|
|
45
|
+
- Run task: `ask-old-service-name`
|
|
46
|
+
- Run task: `ask-new-service-name`
|
|
47
|
+
- Update `context.services` key
|
|
48
|
+
- Append to `context.change_log`
|
|
49
|
+
|
|
50
|
+
### rename table
|
|
51
|
+
- Run task: `ask-table-name`
|
|
52
|
+
- Run task: `ask-new-table-name`
|
|
53
|
+
- Delegate to `database-agent`:
|
|
54
|
+
- Generate ALTER migration: `RENAME TABLE <old> TO <new>`
|
|
55
|
+
- Update `context.db.schema.tables` key
|
|
56
|
+
- Append to `context.db.schema.change_log`:
|
|
57
|
+
`{ type: "table_renamed", from: "<old>", to: "<new>", migration_file: "..." }`
|
|
58
|
+
- Delegate to `nodejs-agent`:
|
|
59
|
+
- Find all references to old table name in model files
|
|
60
|
+
- Update queries in all affected services
|
|
61
|
+
- Append to top-level `context.change_log`
|
|
62
|
+
|
|
63
|
+
### rename module
|
|
64
|
+
- Run task: `ask-old-module-name`
|
|
65
|
+
- Run task: `ask-new-module-name`
|
|
66
|
+
- Delegate to `nodejs-agent` → rename files and update route_manager
|
|
67
|
+
|
|
68
|
+
4. Confirm: "Apply refactor? (yes/no)"
|
|
69
|
+
5. If yes → make changes → run task: `write-context`
|
|
70
|
+
6. Run task: `show-final-summary`
|