codeninja 3.1.0 → 3.2.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/ide/antigravity/.agents/personas/global-orchestrator.md +103 -84
- package/ide/antigravity/.agents/workflows/codeninja-api.md +98 -15
- package/ide/antigravity/.agents/workflows/codeninja-audit.md +69 -11
- package/ide/antigravity/.agents/workflows/codeninja-db-create.md +118 -5
- package/ide/antigravity/.agents/workflows/codeninja-db-drop.md +81 -5
- package/ide/antigravity/.agents/workflows/codeninja-db-index.md +64 -5
- package/ide/antigravity/.agents/workflows/codeninja-db-modify.md +100 -5
- package/ide/antigravity/.agents/workflows/codeninja-db-seed.md +70 -4
- package/ide/antigravity/.agents/workflows/codeninja-db-sync.md +64 -6
- package/ide/antigravity/.agents/workflows/codeninja-debug.md +76 -6
- package/ide/antigravity/.agents/workflows/codeninja-design.md +45 -12
- package/ide/antigravity/.agents/workflows/codeninja-explain.md +35 -6
- package/ide/antigravity/.agents/workflows/codeninja-init.md +329 -22
- package/ide/antigravity/.agents/workflows/codeninja-integrate-api.md +334 -9
- package/ide/antigravity/.agents/workflows/codeninja-modularize.md +214 -9
- package/ide/antigravity/.agents/workflows/codeninja-optimize.md +78 -7
- package/ide/antigravity/.agents/workflows/codeninja-refactor.md +58 -13
- package/ide/antigravity/.agents/workflows/codeninja-review.md +64 -6
- package/ide/antigravity/.agents/workflows/codeninja-sync.md +172 -12
- package/ide/antigravity/.agents/workflows/codeninja-test.md +51 -9
- package/ide/antigravity/.agents/workflows/codeninja-validate-page.md +248 -9
- package/ide/cursor/.cursor/rules/01-global-orchestrator.mdc +35 -32
- package/ide/cursor/.cursor/rules/03-api-builder.mdc +100 -50
- package/ide/cursor/.cursor/rules/04-database.mdc +73 -70
- package/ide/cursor/.cursor/rules/05-reactjs.mdc +133 -69
- package/ide/vscode/.github/copilot-instructions.md +304 -190
- package/package.json +1 -1
|
@@ -1,29 +1,336 @@
|
|
|
1
1
|
---
|
|
2
2
|
slash_command: /codeninja:init
|
|
3
|
-
personas: [global-orchestrator, nodejs-backend
|
|
4
|
-
skills: [mcp-and-context, api-builder
|
|
5
|
-
description:
|
|
3
|
+
personas: [global-orchestrator, nodejs-backend, reactjs-frontend, database-architect]
|
|
4
|
+
skills: [mcp-and-context, api-builder, reactjs, database]
|
|
5
|
+
description: >
|
|
6
|
+
Bootstrap a new NodeJS service, ReactJS app, or database-only project.
|
|
7
|
+
Collects project information first, then service details, then generates
|
|
8
|
+
ALL files in one pass after a single confirmation.
|
|
6
9
|
---
|
|
7
10
|
|
|
8
11
|
# /codeninja:init
|
|
9
12
|
|
|
10
|
-
Delegates to: `.codeninja/commands/initialize-project.workflow.md`
|
|
11
|
-
|
|
12
13
|
## Before Running
|
|
13
|
-
1. Call `context_check_stale` — resolve stale
|
|
14
|
-
2. Call `context_read` — if context_version > 0,
|
|
15
|
-
3.
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
1. Call `context_check_stale` — resolve any stale scratchpad keys first
|
|
15
|
+
2. Call `context_read` — if context_version > 0, load existing context
|
|
16
|
+
3. Call `service_scan` — detect existing service directories
|
|
17
|
+
|
|
18
|
+
## Execution — Full Step-by-Step
|
|
19
|
+
|
|
20
|
+
### Phase 0 — Project Information (runs ONCE per repo)
|
|
21
|
+
Check `context.project_info` — if already populated, skip Phase 0 entirely.
|
|
22
|
+
|
|
23
|
+
**0a.** Ask: "Do you have a project information document or requirement document?"
|
|
24
|
+
- Options: Yes (provide URL or paste) / No
|
|
25
|
+
- Store: `context.project_info.has_doc`, `.doc_url` or `.doc_content`, `.from_doc`
|
|
26
|
+
|
|
27
|
+
**0b.** Ask: "Do you have a scope of work document?"
|
|
28
|
+
- Options: Yes (provide URL or paste) / No
|
|
29
|
+
- Store: `context.project_info.has_sow`, `.sow_url` or `.sow_content`, `.from_sow`
|
|
30
|
+
|
|
31
|
+
**0c.** Ask: "Do you have a Figma design URL?"
|
|
32
|
+
- Options: Yes (provide URL) / No
|
|
33
|
+
- Store: `context.project_info.has_figma`, `.figma_url`, `.from_figma`
|
|
34
|
+
|
|
35
|
+
After all three: synthesize `context.project_info.summary` (150–200 words covering
|
|
36
|
+
what the project does, key features, entities/modules, tech preferences,
|
|
37
|
+
third-party integrations) and `context.project_info.detected_entities[]`.
|
|
38
|
+
Use this summary for all suggestions throughout the session.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Phase 1 — Init Mode and Project Type
|
|
43
|
+
|
|
44
|
+
**Step 0.** Ask: "How would you like to set up this service?"
|
|
45
|
+
- Option 1: Fast setup — auto-generate secure values, only 9 essential questions
|
|
46
|
+
- Option 2: Manual setup — walk through every value one at a time (22 questions)
|
|
47
|
+
- Store: `context.current_init.init_mode` ("fast" | "manual")
|
|
48
|
+
|
|
49
|
+
**Step 1.** Ask: "What are you initializing?"
|
|
50
|
+
- Option 1: NodeJS API service
|
|
51
|
+
- Option 2: ReactJS frontend app
|
|
52
|
+
- Option 3: Database only (no service code)
|
|
53
|
+
- Store: `context.current_init.project_type` ("nodejs" | "reactjs" | "database-only")
|
|
54
|
+
|
|
55
|
+
**Step 1b.** If `project_type == nodejs`:
|
|
56
|
+
- Ask: "What type of client will consume this API?"
|
|
57
|
+
- Options: ReactJS web app / Mobile app
|
|
58
|
+
- Store: `context.current_init.client_type` ("reactjs" | "app")
|
|
59
|
+
- Ask: "Does this service use encrypted transport (AES response wrapping)?"
|
|
60
|
+
- Options: Yes / No
|
|
61
|
+
- Store: `context.current_init.encrypted_transport` (true | false)
|
|
62
|
+
- Ask: "Which languages should this service support?"
|
|
63
|
+
- Show options + allow multi-select (en always included)
|
|
64
|
+
- Store: `context.current_init.supported_languages[]`
|
|
65
|
+
|
|
66
|
+
**Step 2.** If `project_type == reactjs`:
|
|
67
|
+
- Check `context.services` for any NodeJS services.
|
|
68
|
+
If none exist → ABORT: "A ReactJS service requires an existing NodeJS backend.
|
|
69
|
+
Run /codeninja:init first to create a NodeJS service."
|
|
70
|
+
- Ask: "Which NodeJS service should this ReactJS app connect to?"
|
|
71
|
+
- List available NodeJS services from `context.services`
|
|
72
|
+
- Store: `context.current_init.linked_service`
|
|
73
|
+
- Store: `context.current_init.linked_service_port` (read from context)
|
|
74
|
+
- Auto-inherit from the linked service (never ask user):
|
|
75
|
+
- `context.current_init.encryption_key`
|
|
76
|
+
- `context.current_init.encryption_iv`
|
|
77
|
+
- `context.current_init.api_key`
|
|
78
|
+
- Skip Phase 2 (no DB), skip Phase 4 (no package questions), skip Phase 5 (no security questions)
|
|
79
|
+
- Jump directly to Phase 3
|
|
80
|
+
|
|
81
|
+
**Step 3.** If `project_type == nodejs` or `database-only` → continue to Phase 2.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### Phase 2 — Database (nodejs and database-only only)
|
|
86
|
+
|
|
87
|
+
**Step 4.** Ask: "Which database type?"
|
|
88
|
+
- Options: PostgreSQL / MySQL / MongoDB
|
|
89
|
+
- If `context.db.type` already exists → ask: use existing or configure new?
|
|
90
|
+
- Store: `context.db.type`
|
|
91
|
+
|
|
92
|
+
**Step 5.** If `init_mode == manual`:
|
|
93
|
+
- Ask: "Database name?", "Database host?", "Database port?", "Database user?" (grouped display)
|
|
94
|
+
- Store: `context.db.name`, `context.db.host`, `context.db.port`, `context.db.user`
|
|
95
|
+
|
|
96
|
+
If `init_mode == fast`:
|
|
97
|
+
- Ask: "Database name?" only
|
|
98
|
+
- Ask: "Database user?" only
|
|
99
|
+
- (host and port auto-set by generate-fast-defaults)
|
|
100
|
+
- Store: `context.db.name`, `context.db.user`
|
|
101
|
+
|
|
102
|
+
**Step 9.** Delegate to database-agent — generate database folder at REPOSITORY ROOT
|
|
103
|
+
(not inside the service folder — always a sibling).
|
|
104
|
+
|
|
105
|
+
Check if `<repo_root>/database/<db_type>/` already exists:
|
|
106
|
+
- If NOT exists → generate:
|
|
107
|
+
- `database/<db_type>/migrations/` (empty)
|
|
108
|
+
- `database/<db_type>/create-schema.sql`
|
|
109
|
+
- `database/<db_type>/setup-database.sh`
|
|
110
|
+
- `database/<db_type>/setup-database.ps1`
|
|
111
|
+
- `database/<db_type>/reset-database.sh`
|
|
112
|
+
- `database/<db_type>/seeds/` (with .gitkeep)
|
|
113
|
+
- `database/README.md`
|
|
114
|
+
- Then generate `tbl_user_deviceinfo` migration (nodejs projects only)
|
|
115
|
+
- If ALREADY exists → skip generation entirely. Inform user.
|
|
116
|
+
Then check if `migrations/1-setup-tbl-user-deviceinfo.sql` exists:
|
|
117
|
+
- If NO and project_type == nodejs → generate it
|
|
118
|
+
- Otherwise → skip
|
|
119
|
+
|
|
120
|
+
**Step 10.** Inform: "Database folder initialized. You can run /codeninja:db:create to add tables."
|
|
121
|
+
|
|
122
|
+
**Step 11.** If `project_type == database-only` → skip Phases 3–5, jump to Phase 6.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### Phase 3 — Service Identity
|
|
127
|
+
|
|
128
|
+
**Step 12.** Ask: "Service name?"
|
|
129
|
+
- Must be unique across `context.services`
|
|
130
|
+
- Agent suggests based on `context.project_info.detected_entities`
|
|
131
|
+
- Store: `context.current_init.service_name`
|
|
132
|
+
|
|
133
|
+
**Step 13.** If `init_mode == manual`:
|
|
134
|
+
- Ask: "Port number?" (must not conflict with existing services)
|
|
135
|
+
- Store: `context.current_init.port`
|
|
136
|
+
|
|
137
|
+
**Step 14.** Ask: "Short description of this service?"
|
|
138
|
+
- Store: `context.current_init.description`
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### Phase 4 — Package Info (nodejs + manual mode only)
|
|
143
|
+
|
|
144
|
+
**Step 15.** If `init_mode == manual`:
|
|
145
|
+
- Ask: "Package name?" (default: service_name)
|
|
146
|
+
- Store: `context.current_init.package_name`
|
|
147
|
+
|
|
148
|
+
**Step 16.** If `init_mode == manual`:
|
|
149
|
+
- Ask: "Author name?"
|
|
150
|
+
- Store: `context.current_init.author`
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Phase 5 — Runtime Config (nodejs + manual mode only)
|
|
155
|
+
|
|
156
|
+
**Step 17.** If `init_mode == manual`:
|
|
157
|
+
- Ask: "API key?" (auto-suggest 32 random chars)
|
|
158
|
+
- Store: `context.current_init.api_key`
|
|
159
|
+
|
|
160
|
+
**Step 18.** If `init_mode == manual`:
|
|
161
|
+
- Ask: "Encryption key?" (must be exactly 32 characters)
|
|
162
|
+
- Store: `context.current_init.encryption_key`
|
|
163
|
+
|
|
164
|
+
**Step 19.** If `init_mode == manual`:
|
|
165
|
+
- Auto-set `encryption_iv` = first 16 chars of `encryption_key`
|
|
166
|
+
- Show derived value: "Encryption IV auto-derived: [first 16 chars of key]"
|
|
167
|
+
- Store: `context.current_init.encryption_iv`
|
|
168
|
+
|
|
169
|
+
**Step 20.** If `init_mode == manual`:
|
|
170
|
+
- Ask: "Redis host and port?" (grouped)
|
|
171
|
+
- Store: `context.current_init.redis_host`, `context.current_init.redis_port`
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### Phase 5b — Auto-populate Defaults (fast mode, nodejs only)
|
|
176
|
+
|
|
177
|
+
If `init_mode == fast` AND `project_type == nodejs`:
|
|
178
|
+
- `context.db.host` → "localhost" (if not set)
|
|
179
|
+
- `context.db.port` → 5432 / 3306 / 27017 based on db type
|
|
180
|
+
- Port: scan all `context.services` ports → highest + 1 → minimum 1001
|
|
181
|
+
- `package_name` → same as `service_name`
|
|
182
|
+
- `author` → ""
|
|
183
|
+
- `api_key` → 32 cryptographically random alphanumeric chars
|
|
184
|
+
- `encryption_key` → exactly 32 cryptographically random alphanumeric chars
|
|
185
|
+
- `encryption_iv` → first 16 chars of `encryption_key` (always derived, never random)
|
|
186
|
+
- `redis_host` → "localhost"
|
|
187
|
+
- `redis_port` → 6379
|
|
188
|
+
- All done silently — values shown in summary for review
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### Phase 6 — Single Confirmation, Then Generate Everything
|
|
193
|
+
|
|
194
|
+
**Step 22.** Show init summary — ALL collected values including auto-generated ones.
|
|
195
|
+
Run pre-generation validation BEFORE displaying:
|
|
196
|
+
- BLOCKER: service name conflict
|
|
197
|
+
- BLOCKER: port conflict
|
|
198
|
+
- BLOCKER: encryption_key not 32 chars (nodejs)
|
|
199
|
+
- BLOCKER: encryption_iv not 16 chars (nodejs)
|
|
200
|
+
- BLOCKER: required fields missing
|
|
201
|
+
- BLOCKER: no linked service (reactjs)
|
|
202
|
+
- WARNING: port below 1024
|
|
203
|
+
- WARNING: service name has uppercase
|
|
204
|
+
|
|
205
|
+
Resolve all BLOCKERs interactively before showing summary.
|
|
206
|
+
Show the 5-wave generation plan.
|
|
207
|
+
Ask ONE question: "Confirm and generate all files? (yes / no / change a value)"
|
|
208
|
+
- If yes → generate immediately, NO further confirmations
|
|
209
|
+
- If no → abort
|
|
210
|
+
- If change → re-run specific ask-* task → re-validate → return to summary
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### Phase 6b — Generation (nodejs)
|
|
215
|
+
|
|
216
|
+
Read `nodejs-agent.md` persona. Execute ALL waves. Do NOT pause between waves.
|
|
217
|
+
|
|
218
|
+
**Wave 1 — Foundation** (all simultaneously):
|
|
219
|
+
- `package.json`
|
|
220
|
+
- `.env` and `.env.example`
|
|
221
|
+
- `.gitignore`
|
|
222
|
+
- `README.md`
|
|
223
|
+
- `config/constants.js`
|
|
224
|
+
- `config/template.js`
|
|
225
|
+
- `logger/logging.js`
|
|
226
|
+
- `utilities/encryption.js`
|
|
227
|
+
- `languages/<lang>.js` for each in supported_languages[]
|
|
228
|
+
- `enc_dec.html` (if client_type == reactjs) OR `enc_dec.php` (if client_type == app)
|
|
229
|
+
- `pem/` directory with .gitkeep
|
|
230
|
+
- `images/` directory with .gitkeep
|
|
231
|
+
- `logger/logs/` directory with .gitkeep
|
|
232
|
+
|
|
233
|
+
**Wave 2 — Infrastructure**:
|
|
234
|
+
- `config/database.js`
|
|
235
|
+
- `utilities/ioRedis.js`
|
|
236
|
+
- `utilities/response.js`
|
|
237
|
+
|
|
238
|
+
**Wave 3 — Service Layer**:
|
|
239
|
+
- `config/common.js`
|
|
240
|
+
- `utilities/validator.js`
|
|
241
|
+
- `utilities/notification.js`
|
|
242
|
+
- `middleware/rateLimiter.js`
|
|
243
|
+
|
|
244
|
+
**Wave 4 — Middleware and Business Layer** (all simultaneously):
|
|
245
|
+
- `middleware/headerValidator.js`
|
|
246
|
+
- `modules/v1/<ServiceName>/route.js`
|
|
247
|
+
- `modules/v1/<ServiceName>/<service>_model.js`
|
|
248
|
+
- `document/v1/swagger_doc.json` (skeleton)
|
|
249
|
+
|
|
250
|
+
**Wave 5 — Orchestration Layer**:
|
|
251
|
+
- `modules/v1/route_manager.js`
|
|
252
|
+
- `app.js`
|
|
253
|
+
|
|
254
|
+
**Wave 6 — Docker** (post-completion):
|
|
255
|
+
- `Dockerfile`
|
|
256
|
+
- `.dockerignore`
|
|
257
|
+
|
|
258
|
+
COMPLETION GATE — before proceeding, verify these exist on disk:
|
|
259
|
+
- `<service_name>/app.js`
|
|
260
|
+
- `<service_name>/modules/v1/route_manager.js`
|
|
261
|
+
- `<service_name>/modules/v1/<ServiceName>/route.js`
|
|
262
|
+
- `<service_name>/modules/v1/<ServiceName>/<service>_model.js`
|
|
263
|
+
- `<service_name>/document/v1/swagger_doc.json`
|
|
264
|
+
If any missing → generate now before continuing.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### Phase 6c — Generation (reactjs)
|
|
269
|
+
|
|
270
|
+
Read `reactjs-frontend.md` persona. Execute ALL waves.
|
|
271
|
+
|
|
272
|
+
**Wave 1 — Foundation**:
|
|
273
|
+
- `package.json`
|
|
274
|
+
- `.env` and `.env.example`
|
|
275
|
+
- `.gitignore`
|
|
276
|
+
- `README.md`
|
|
277
|
+
- `public/index.html`
|
|
278
|
+
- `public/assets/css/style.css`
|
|
279
|
+
- `public/robots.txt`
|
|
280
|
+
- `public/favicon.ico` (placeholder note)
|
|
281
|
+
- `.htaccess` (root)
|
|
282
|
+
- `public/.htaccess`
|
|
283
|
+
|
|
284
|
+
**Wave 2 — API Layer**:
|
|
285
|
+
- `src/api/apiClient.js`
|
|
286
|
+
- `src/api/apiHandler.js`
|
|
287
|
+
|
|
288
|
+
**Wave 3 — Application Shell**:
|
|
289
|
+
- `src/pages/Welcome/index.jsx`
|
|
290
|
+
- `src/pages/Welcome/Welcome.module.css`
|
|
291
|
+
- `src/App.jsx`
|
|
292
|
+
- `src/index.jsx`
|
|
293
|
+
- `src/components/` (empty dir with .gitkeep)
|
|
294
|
+
|
|
295
|
+
**Wave 4 — Docker**:
|
|
296
|
+
- `Dockerfile`
|
|
297
|
+
- `nginx.conf`
|
|
298
|
+
- `.dockerignore`
|
|
299
|
+
|
|
300
|
+
COMPLETION GATE — verify before proceeding:
|
|
301
|
+
- `<service_name>/public/index.html`
|
|
302
|
+
- `<service_name>/src/api/apiClient.js`
|
|
303
|
+
- `<service_name>/src/api/apiHandler.js`
|
|
304
|
+
- `<service_name>/src/App.jsx`
|
|
305
|
+
- `<service_name>/src/index.jsx`
|
|
306
|
+
- `<service_name>/.env`
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
### Phase 7 — Post-Generation Steps
|
|
311
|
+
|
|
312
|
+
**Step 23b.** Generate IDE configs (first init only):
|
|
313
|
+
- Write `.vscode/mcp.json`
|
|
314
|
+
- Write `.cursor/mcp.json`
|
|
315
|
+
- Print Claude Desktop config snippet for manual addition
|
|
316
|
+
|
|
317
|
+
**Step 23c.** Generate docker-compose.yml:
|
|
318
|
+
- If does not exist → generate complete file at repo root
|
|
319
|
+
- If exists → update by adding the new service
|
|
320
|
+
- Also generate/update `.env.docker` and `.env.docker.example`
|
|
321
|
+
|
|
322
|
+
**Step 24.** Call `context_write`:
|
|
323
|
+
- Set `project_name` = service_name (top-level)
|
|
324
|
+
- Set `initialized_at` = ISO now
|
|
325
|
+
- Set `last_command` = "initialize-project"
|
|
326
|
+
- Append new service to `context.services[<service_name>]`
|
|
327
|
+
- For reactjs: store `linked_service` and `linked_service_port`
|
|
328
|
+
- Update `context.project_info` with `initialized_at`
|
|
329
|
+
- Clear `context.current_init`
|
|
330
|
+
|
|
331
|
+
**Step 25.** Call `context_clear_scratchpad` with keys: ["current_init"]
|
|
332
|
+
|
|
333
|
+
**Step 26.** Show final summary:
|
|
334
|
+
- List all files created per wave
|
|
335
|
+
- Show startup commands
|
|
336
|
+
- Offer next steps: /codeninja:db:create, /codeninja:api, /codeninja:design
|