codeninja 3.2.0 → 4.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/README.md +13 -1
- package/agent/database-agent.md +24 -1
- package/agent/nodejs-agent.md +79 -0
- package/cli.js +27 -7
- package/commands/audit.workflow.md +4 -1
- package/commands/db-create-table.workflow.md +1 -1
- package/commands/initialize-project.workflow.md +21 -0
- package/ide/antigravity/.agents/personas/database-architect.md +431 -153
- package/ide/antigravity/.agents/personas/global-orchestrator.md +202 -85
- package/ide/antigravity/.agents/personas/nodejs-backend.md +368 -133
- package/ide/antigravity/.agents/personas/reactjs-frontend.md +182 -101
- package/ide/antigravity/.agents/skills/api-builder/SKILL.md +58 -0
- package/ide/antigravity/.agents/skills/code-intelligence/SKILL.md +22 -0
- package/ide/antigravity/.agents/skills/database/SKILL.md +32 -0
- package/ide/antigravity/.agents/skills/mcp-and-context/SKILL.md +76 -82
- package/ide/antigravity/.agents/skills/reactjs/SKILL.md +36 -0
- package/ide/antigravity/.agents/workflows/codeninja-api.md +76 -83
- package/ide/antigravity/.agents/workflows/codeninja-audit.md +82 -44
- package/ide/antigravity/.agents/workflows/codeninja-db-create.md +107 -94
- package/ide/antigravity/.agents/workflows/codeninja-db-drop.md +89 -67
- package/ide/antigravity/.agents/workflows/codeninja-db-index.md +86 -54
- package/ide/antigravity/.agents/workflows/codeninja-db-modify.md +126 -68
- package/ide/antigravity/.agents/workflows/codeninja-db-seed.md +87 -59
- package/ide/antigravity/.agents/workflows/codeninja-db-sync.md +77 -41
- package/ide/antigravity/.agents/workflows/codeninja-debug.md +35 -21
- package/ide/antigravity/.agents/workflows/codeninja-design.md +49 -35
- package/ide/antigravity/.agents/workflows/codeninja-explain.md +41 -20
- package/ide/antigravity/.agents/workflows/codeninja-init.md +479 -289
- package/ide/antigravity/.agents/workflows/codeninja-integrate-api.md +253 -136
- package/ide/antigravity/.agents/workflows/codeninja-modularize.md +250 -132
- package/ide/antigravity/.agents/workflows/codeninja-optimize.md +71 -29
- package/ide/antigravity/.agents/workflows/codeninja-refactor.md +50 -42
- package/ide/antigravity/.agents/workflows/codeninja-review.md +38 -21
- package/ide/antigravity/.agents/workflows/codeninja-sync.md +922 -141
- package/ide/antigravity/.agents/workflows/codeninja-test.md +34 -49
- package/ide/antigravity/.agents/workflows/codeninja-validate-page.md +449 -151
- package/ide/claude-code/.claude/CLAUDE.md +99 -0
- package/ide/claude-code/.claude/agents/database-agent.md +535 -0
- package/ide/claude-code/.claude/agents/nodejs-agent.md +493 -0
- package/ide/claude-code/.claude/agents/reactjs-agent.md +267 -0
- package/ide/claude-code/.claude/commands/codeninja-api.md +104 -0
- package/ide/claude-code/.claude/commands/codeninja-audit.md +119 -0
- package/ide/claude-code/.claude/commands/codeninja-db-create.md +138 -0
- package/ide/claude-code/.claude/commands/codeninja-db-drop.md +109 -0
- package/ide/claude-code/.claude/commands/codeninja-db-index.md +103 -0
- package/ide/claude-code/.claude/commands/codeninja-db-modify.md +165 -0
- package/ide/claude-code/.claude/commands/codeninja-db-seed.md +104 -0
- package/ide/claude-code/.claude/commands/codeninja-db-sync.md +106 -0
- package/ide/claude-code/.claude/commands/codeninja-debug.md +99 -0
- package/ide/claude-code/.claude/commands/codeninja-design.md +68 -0
- package/ide/claude-code/.claude/commands/codeninja-explain.md +61 -0
- package/ide/claude-code/.claude/commands/codeninja-init.md +529 -0
- package/ide/claude-code/.claude/commands/codeninja-integrate-api.md +453 -0
- package/ide/claude-code/.claude/commands/codeninja-modularize.md +334 -0
- package/ide/claude-code/.claude/commands/codeninja-optimize.md +129 -0
- package/ide/claude-code/.claude/commands/codeninja-refactor.md +76 -0
- package/ide/claude-code/.claude/commands/codeninja-review.md +87 -0
- package/ide/claude-code/.claude/commands/codeninja-sync.md +964 -0
- package/ide/claude-code/.claude/commands/codeninja-test.md +45 -0
- package/ide/claude-code/.claude/commands/codeninja-validate-page.md +548 -0
- package/ide/cursor/.cursor/rules/01-global-orchestrator.mdc +12 -13
- package/ide/cursor/.cursor/rules/02-mcp-and-context.mdc +47 -31
- package/ide/cursor/.cursor/rules/03-api-builder.mdc +32 -110
- package/ide/cursor/.cursor/rules/04-nodejs-generation.mdc +58 -0
- package/ide/cursor/.cursor/rules/05-database.mdc +54 -0
- package/ide/cursor/.cursor/rules/06-reactjs.mdc +36 -0
- package/ide/cursor/.cursor/rules/07-reactjs-generation.mdc +49 -0
- package/ide/cursor/.cursor/rules/08-code-intelligence.mdc +56 -0
- package/ide/cursor/.cursor/rules/09-workflow-steps.mdc +53 -0
- package/ide/vscode/.github/copilot-instructions.md +67 -382
- package/ide/vscode/.vscode/instructions/code-intelligence.instructions.md +58 -0
- package/ide/vscode/.vscode/instructions/database.instructions.md +55 -0
- package/ide/vscode/.vscode/instructions/nodejs.instructions.md +77 -0
- package/ide/vscode/.vscode/instructions/reactjs.instructions.md +42 -0
- package/package.json +2 -2
- package/tasks/ask-hashing-library.task.md +31 -0
- package/tasks/ask-language-type.task.md +26 -0
- package/tasks/ask-new-module-name.task.md +13 -0
- package/tasks/ask-new-service-name.task.md +13 -0
- package/tasks/ask-old-module-name.task.md +15 -0
- package/tasks/ask-old-service-name.task.md +13 -0
- package/tasks/ask-orm-type.task.md +26 -0
- package/tasks/collect-seed-data.task.md +19 -0
- package/tasks/generate-app.task.md +42 -0
- package/tasks/generate-common.task.md +13 -0
- package/tasks/generate-constants.task.md +13 -0
- package/tasks/generate-database.task.md +32 -0
- package/tasks/generate-encryption.task.md +28 -0
- package/tasks/generate-fast-defaults.task.md +7 -0
- package/tasks/generate-hashing.task.md +180 -0
- package/tasks/generate-headerValidator.task.md +13 -0
- package/tasks/generate-ioRedis.task.md +20 -0
- package/tasks/generate-language-en.task.md +12 -0
- package/tasks/generate-logging.task.md +12 -0
- package/tasks/generate-model.task.md +74 -6
- package/tasks/generate-notification.task.md +12 -0
- package/tasks/generate-package-json.task.md +69 -0
- package/tasks/generate-prisma-client.task.md +56 -0
- package/tasks/generate-prisma-schema.task.md +71 -0
- package/tasks/generate-rateLimiter.task.md +20 -0
- package/tasks/generate-readme.task.md +24 -0
- package/tasks/generate-response.task.md +27 -0
- package/tasks/generate-route-manager.task.md +32 -0
- package/tasks/generate-route.task.md +37 -0
- package/tasks/generate-swagger.task.md +8 -0
- package/tasks/generate-template.task.md +12 -0
- package/tasks/generate-tsconfig.task.md +38 -0
- package/tasks/generate-validator.task.md +31 -0
- package/ide/cursor/.cursor/rules/04-database.mdc +0 -90
- package/ide/cursor/.cursor/rules/05-reactjs.mdc +0 -147
- package/ide/cursor/.cursor/rules/06-code-intelligence.mdc +0 -112
|
@@ -1,68 +1,76 @@
|
|
|
1
|
+
This workflow runs when user invokes /codeninja:refactor
|
|
2
|
+
|
|
1
3
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type: workflow
|
|
5
|
+
name: refactor
|
|
6
|
+
description: >
|
|
7
|
+
Rename, restructure, or improve existing code. Always records changes in
|
|
8
|
+
context.change_log so all agents remain aware of the history.
|
|
6
9
|
---
|
|
7
10
|
|
|
8
|
-
#
|
|
11
|
+
# Workflow: @refactor
|
|
12
|
+
|
|
13
|
+
## Goal
|
|
14
|
+
Make a controlled change to existing code with full traceability in context.
|
|
9
15
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
## Rules
|
|
17
|
+
- Every rename is recorded in `context.change_log`
|
|
18
|
+
- DB column renames generate a migration file
|
|
19
|
+
- Never delete the old name from change_log
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
---
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
1. Rename a DB column
|
|
18
|
-
2. Rename a service
|
|
19
|
-
3. Rename a table
|
|
20
|
-
4. Rename a module
|
|
21
|
-
5. Restructure files
|
|
22
|
-
- Store: `context.current_refactor.type`
|
|
23
|
+
## Step-by-Step Execution
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
1. Run task: `ask-refactor-type`
|
|
26
|
+
- Options: rename DB column, rename service, rename module, restructure files
|
|
27
|
+
- Stores: `context.current_refactor.type`
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
2. Run task: `ask-target-service` (if applicable)
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
|
|
31
|
+
3. Based on refactor type:
|
|
32
|
+
|
|
33
|
+
### rename DB column
|
|
34
|
+
- Run task: `ask-table-name`
|
|
35
|
+
- Run task: `ask-old-column-name`
|
|
36
|
+
- Run task: `ask-new-column-name`
|
|
37
|
+
- Delegate to `database-agent`:
|
|
38
|
+
- Generate ALTER TABLE migration
|
|
34
39
|
- Update `context.db.schema.tables[<table>].columns`
|
|
35
40
|
- Append to `context.db.schema.change_log`
|
|
36
|
-
- Delegate to nodejs-agent
|
|
41
|
+
- Delegate to `nodejs-agent`:
|
|
37
42
|
- Find all references to old column name in service files
|
|
38
43
|
- Update model queries
|
|
39
44
|
- Update swagger_doc.json
|
|
40
45
|
|
|
41
|
-
###
|
|
42
|
-
-
|
|
43
|
-
-
|
|
46
|
+
### rename service
|
|
47
|
+
- Run task: `ask-old-service-name`
|
|
48
|
+
- Run task: `ask-new-service-name`
|
|
44
49
|
- Update `context.services` key
|
|
45
50
|
- Append to `context.change_log`
|
|
46
51
|
|
|
47
|
-
###
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- Delegate to database-agent
|
|
52
|
+
### rename table
|
|
53
|
+
- Run task: `ask-table-name`
|
|
54
|
+
- Run task: `ask-new-table-name`
|
|
55
|
+
- Delegate to `database-agent`:
|
|
51
56
|
- Generate ALTER migration: `RENAME TABLE <old> TO <new>`
|
|
52
57
|
- Update `context.db.schema.tables` key
|
|
53
|
-
- Append to `context.db.schema.change_log`:
|
|
54
|
-
|
|
58
|
+
- Append to `context.db.schema.change_log`:
|
|
59
|
+
`{ type: "table_renamed", from: "<old>", to: "<new>", migration_file: "..." }`
|
|
60
|
+
- Delegate to `nodejs-agent`:
|
|
55
61
|
- Find all references to old table name in model files
|
|
56
62
|
- Update queries in all affected services
|
|
57
63
|
- Append to top-level `context.change_log`
|
|
58
64
|
|
|
59
|
-
###
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
- Delegate to nodejs-agent → rename files and update route_manager
|
|
65
|
+
### rename module
|
|
66
|
+
- Run task: `ask-old-module-name`
|
|
67
|
+
- Run task: `ask-new-module-name`
|
|
68
|
+
- Delegate to `nodejs-agent` → rename files and update route_manager
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
4. Confirm: "Apply refactor? (yes/no)"
|
|
71
|
+
|
|
72
|
+
> **Multi-agent:** Delegate to `database-architect` (DB refactors) or `nodejs-backend` (service/module refactors) via Task invocation for parallel execution.
|
|
73
|
+
> Read `.codeninja/tasks/` before applying each change.
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Show final summary.
|
|
75
|
+
5. If yes → make changes → run task: `write-context`
|
|
76
|
+
6. Run task: `show-final-summary`
|
|
@@ -1,29 +1,42 @@
|
|
|
1
|
+
This workflow runs when user invokes /codeninja:review
|
|
2
|
+
|
|
1
3
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type: workflow
|
|
5
|
+
name: review
|
|
6
|
+
description: >
|
|
7
|
+
Deep code review of any file or module — security, architecture, naming
|
|
8
|
+
conventions, and alignment with project patterns. Outputs severity-ranked
|
|
9
|
+
findings with exact fixes.
|
|
6
10
|
---
|
|
7
11
|
|
|
8
|
-
# /codeninja:review
|
|
12
|
+
# Workflow: @review / /codeninja:review
|
|
9
13
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
## Goal
|
|
15
|
+
Produce a structured code review that finds real issues using actual project
|
|
16
|
+
context — not generic best practices. Every finding references the real file
|
|
17
|
+
and line, and every fix is concrete code, not advice.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Read the actual file before reviewing it
|
|
21
|
+
- Cross-reference `context.db.schema` for table/column accuracy
|
|
22
|
+
- Compare against 1–2 existing modules to check pattern consistency
|
|
23
|
+
- Never flag something as an issue if it's the established pattern in this project
|
|
24
|
+
|
|
25
|
+
---
|
|
13
26
|
|
|
14
|
-
##
|
|
27
|
+
## Step-by-Step Execution
|
|
15
28
|
|
|
16
29
|
### Step 1 — Identify Target
|
|
17
|
-
If not specified, ask: "Which file or module would you like
|
|
30
|
+
If not specified, ask: "Which file or module would you like me to review?"
|
|
18
31
|
|
|
19
32
|
### Step 2 — Load Context
|
|
20
|
-
1. Call `
|
|
21
|
-
2.
|
|
22
|
-
3.
|
|
33
|
+
1. Call `context_read`
|
|
34
|
+
2. Call `fs_read` on the target file
|
|
35
|
+
3. Read 1–2 similar modules from `context.services[<service>].modules` for comparison
|
|
23
36
|
|
|
24
37
|
### Step 3 — Run Review Checklist
|
|
25
38
|
|
|
26
|
-
#### Security (CRITICAL if failing)
|
|
39
|
+
#### Security (flag as CRITICAL if failing)
|
|
27
40
|
- [ ] All POST/PUT/PATCH routes have validatorjs input validation
|
|
28
41
|
- [ ] API key middleware applied before any route logic
|
|
29
42
|
- [ ] JWT auth middleware present on protected routes
|
|
@@ -31,20 +44,20 @@ If not specified, ask: "Which file or module would you like reviewed?"
|
|
|
31
44
|
- [ ] Parameterized queries only — no string concatenation in SQL
|
|
32
45
|
- [ ] Error responses don't leak stack traces or internal details
|
|
33
46
|
|
|
34
|
-
#### Architecture (WARNING if failing)
|
|
47
|
+
#### Architecture (flag as WARNING if failing)
|
|
35
48
|
- [ ] 2-layer rule: no SQL in route.js, no res.json() in model.js
|
|
36
49
|
- [ ] route_manager.js registration matches route file
|
|
37
50
|
- [ ] swagger_doc.json has entry for this endpoint
|
|
38
51
|
- [ ] All user-facing strings in languages/en.js — none hardcoded in route.js
|
|
39
52
|
|
|
40
|
-
#### Code Quality (SUGGESTION if failing)
|
|
53
|
+
#### Code Quality (flag as SUGGESTION if failing)
|
|
41
54
|
- [ ] JSDoc on every exported function
|
|
42
55
|
- [ ] No unused variables or dead imports
|
|
43
56
|
- [ ] No console.log — project logger used instead
|
|
44
57
|
- [ ] Async functions have try/catch blocks
|
|
45
58
|
- [ ] SELECT * not used — explicit column list
|
|
46
59
|
|
|
47
|
-
#### Database (WARNING if failing)
|
|
60
|
+
#### Database (flag as WARNING if failing)
|
|
48
61
|
- [ ] Column names match context.db.schema exactly (snake_case)
|
|
49
62
|
- [ ] Foreign key columns indexed
|
|
50
63
|
- [ ] Transactions used where multiple writes occur together
|
|
@@ -62,9 +75,13 @@ After: the corrected code
|
|
|
62
75
|
Why: one sentence explanation
|
|
63
76
|
```
|
|
64
77
|
|
|
65
|
-
End with
|
|
78
|
+
End with summary line:
|
|
79
|
+
```
|
|
80
|
+
Review complete: X critical · Y warnings · Z suggestions
|
|
81
|
+
```
|
|
66
82
|
|
|
67
83
|
### Step 5 — Offer Auto-Fix
|
|
68
|
-
"Would you like me to apply any of these fixes?
|
|
69
|
-
|
|
70
|
-
-
|
|
84
|
+
"Would you like me to apply any of these fixes? I'll confirm each change before writing."
|
|
85
|
+
|
|
86
|
+
For SUGGESTION-level items: offer to apply all at once.
|
|
87
|
+
For WARNING/CRITICAL items: apply one at a time, confirm each.
|