codeninja 3.2.0 → 4.0.1
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 +15 -4
- 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,54 +1,68 @@
|
|
|
1
|
+
This workflow runs when user invokes /codeninja:design
|
|
2
|
+
|
|
1
3
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type: workflow
|
|
5
|
+
name: design
|
|
6
|
+
description: >
|
|
7
|
+
Plan a feature, API contract, or database change before writing any code.
|
|
8
|
+
Produces a design document and optionally updates context with the planned
|
|
9
|
+
schema or routes for other agents to reference.
|
|
6
10
|
---
|
|
7
11
|
|
|
8
|
-
#
|
|
12
|
+
# Workflow: @design
|
|
13
|
+
|
|
14
|
+
## Goal
|
|
15
|
+
Think before coding. Produce a structured design plan that becomes the
|
|
16
|
+
contract for `@create-api`, `@initialize-project`, or manual implementation.
|
|
9
17
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
## Rules
|
|
19
|
+
- No files are generated unless user explicitly confirms
|
|
20
|
+
- Design output is stored in `.codeninja/agent/designs/<feature_name>.design.md`
|
|
21
|
+
- Approved designs update context with planned routes and schema
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Step-by-Step Execution
|
|
15
26
|
|
|
16
27
|
### Phase 1 — Scope
|
|
28
|
+
1. Run task: `ask-design-target`
|
|
29
|
+
- Options: new feature, new API endpoint, database change, full module
|
|
30
|
+
- Stores: `context.current_design.type`
|
|
17
31
|
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
- Store: `context.current_design.type`
|
|
32
|
+
2. Run task: `ask-feature-name`
|
|
33
|
+
- Stores: `context.current_design.feature_name`
|
|
21
34
|
|
|
22
|
-
|
|
23
|
-
-
|
|
35
|
+
3. Run task: `ask-design-description`
|
|
36
|
+
- Free text: what should this feature do?
|
|
37
|
+
- Stores: `context.current_design.description`
|
|
24
38
|
|
|
25
|
-
|
|
26
|
-
- Store: `context.current_design.description`
|
|
39
|
+
---
|
|
27
40
|
|
|
28
41
|
### Phase 2 — Database Design (if applicable)
|
|
42
|
+
4. If design involves data storage:
|
|
43
|
+
- Delegate to `database-agent`
|
|
44
|
+
- Design table structure, column types, indexes, relationships
|
|
45
|
+
- Present schema proposal to user for feedback
|
|
46
|
+
- Allow user to request changes (one change at a time)
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
- Delegate to database-agent
|
|
32
|
-
- Design table structure, column types, indexes, relationships
|
|
33
|
-
- Present schema proposal for feedback
|
|
34
|
-
- Allow changes one at a time
|
|
48
|
+
---
|
|
35
49
|
|
|
36
50
|
### Phase 3 — API Design (if applicable)
|
|
51
|
+
5. If design involves API endpoints:
|
|
52
|
+
- Delegate to `nodejs-agent`
|
|
53
|
+
- Propose: method, path, request body, response shape, auth requirement
|
|
54
|
+
- Present to user for feedback
|
|
37
55
|
|
|
38
|
-
|
|
39
|
-
- Delegate to nodejs-agent
|
|
40
|
-
- Propose: method, path, request body, response shape, auth requirement
|
|
41
|
-
- Present for feedback
|
|
56
|
+
---
|
|
42
57
|
|
|
43
58
|
### Phase 4 — Output
|
|
59
|
+
6. Generate `.codeninja/agent/designs/<feature_name>.design.md` containing:
|
|
60
|
+
- Feature summary
|
|
61
|
+
- DB schema proposal (tables, columns)
|
|
62
|
+
- API contracts (method, path, request, response)
|
|
63
|
+
- Open questions / decisions needed
|
|
44
64
|
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- Open questions / decisions needed
|
|
50
|
-
|
|
51
|
-
**Step 7.** Ask: "Save this design and mark planned routes/schema in context? (yes/no)"
|
|
52
|
-
If yes → call `context_write` with operation "design", then `context_clear_scratchpad` ["current_design"]
|
|
53
|
-
|
|
54
|
-
**Step 8.** Show final summary.
|
|
65
|
+
7. Ask: "Save this design and mark planned routes/schema in context? (yes/no)"
|
|
66
|
+
8. If yes → run task: `write-context` with operation = "design"
|
|
67
|
+
Then call: context_clear_scratchpad with keys: ["current_design"]
|
|
68
|
+
9. Run task: `show-final-summary`
|
|
@@ -1,40 +1,61 @@
|
|
|
1
|
+
This workflow runs when user invokes /codeninja:explain
|
|
2
|
+
|
|
1
3
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type: workflow
|
|
5
|
+
name: explain
|
|
6
|
+
description: >
|
|
7
|
+
Explain any file, function, pattern, or architectural concept in this project
|
|
8
|
+
using full project context. Useful for onboarding, code review, and exam prep.
|
|
6
9
|
---
|
|
7
10
|
|
|
8
|
-
# /codeninja:explain
|
|
11
|
+
# Workflow: @explain / /codeninja:explain
|
|
12
|
+
|
|
13
|
+
## Goal
|
|
14
|
+
Give a clear, context-aware explanation of any part of the codebase.
|
|
15
|
+
Reference real file names, table names, service names — never placeholders.
|
|
16
|
+
|
|
17
|
+
## Rules
|
|
18
|
+
- Always read the actual file before explaining it
|
|
19
|
+
- Use `context.db.schema` to reference real table/column names
|
|
20
|
+
- Use `context.services` to reference real service names and ports
|
|
21
|
+
- Explain the "why" not just the "what"
|
|
9
22
|
|
|
10
|
-
|
|
11
|
-
1. Call `context_read`
|
|
12
|
-
2. Call `context_check_stale`
|
|
23
|
+
---
|
|
13
24
|
|
|
14
|
-
##
|
|
25
|
+
## Step-by-Step Execution
|
|
15
26
|
|
|
16
27
|
### Step 1 — Identify Target
|
|
17
28
|
If not specified, ask: "What would you like me to explain?
|
|
18
|
-
(e.g., a file path, a function name, a pattern like 'the auth middleware',
|
|
19
|
-
or a concept like 'why we use DENSE_RANK')"
|
|
29
|
+
(e.g., a file path, a function name, a pattern like 'the auth middleware', or a concept like 'why we use DENSE_RANK')"
|
|
20
30
|
|
|
21
31
|
### Step 2 — Load Context
|
|
22
|
-
1. Call `
|
|
23
|
-
2.
|
|
24
|
-
3.
|
|
25
|
-
4. Reference `context.services` for service names and ports
|
|
32
|
+
1. Call MCP tool `context_read`
|
|
33
|
+
2. Call MCP tool `fs_read` on the target file (if a file was specified)
|
|
34
|
+
3. Read 1 related file to understand how the target fits in the system
|
|
26
35
|
|
|
27
36
|
### Step 3 — Explain
|
|
28
37
|
|
|
29
|
-
Structure
|
|
38
|
+
Structure the explanation as:
|
|
30
39
|
|
|
31
40
|
**What it is** (1–2 sentences — plain English)
|
|
41
|
+
> This is the route handler for the leaderboard endpoint. It validates the
|
|
42
|
+
> incoming request, calls the model to fetch ranked scores, and returns them
|
|
43
|
+
> in the project's standard response format.
|
|
32
44
|
|
|
33
45
|
**How it works** (step-by-step walkthrough of the key logic)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
> 1. The `apiKeyMiddleware` checks the `api-key` header against the env value
|
|
47
|
+
> 2. `validatorjs` ensures `weekId` is present and a non-empty string
|
|
48
|
+
> 3. `LeaderboardModel.getTopScores(weekId)` runs the DENSE_RANK query
|
|
49
|
+
> 4. The result is wrapped in `{ status: 1, message: lang.success, data: rows }`
|
|
50
|
+
|
|
51
|
+
**Why this way** (the architectural decision)
|
|
52
|
+
> We use DENSE_RANK instead of RANK because tied scores should get the same
|
|
53
|
+
> position without gaps — position 3 should follow position 2, even with ties.
|
|
54
|
+
|
|
55
|
+
**Where it connects** (related files/functions)
|
|
56
|
+
> - Model: `modules/v1/Leaderboard/leaderboard_model.js`
|
|
57
|
+
> - Language strings: `languages/en.js` → `leaderboard_success`
|
|
58
|
+
> - Route registration: `modules/v1/route_manager.js` line ~45
|
|
38
59
|
|
|
39
60
|
### Step 4 — Offer Follow-up
|
|
40
61
|
End with: "Want me to explain any part in more detail, or show how to modify it?"
|