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.
Files changed (111) hide show
  1. package/README.md +13 -1
  2. package/agent/database-agent.md +24 -1
  3. package/agent/nodejs-agent.md +79 -0
  4. package/cli.js +27 -7
  5. package/commands/audit.workflow.md +4 -1
  6. package/commands/db-create-table.workflow.md +1 -1
  7. package/commands/initialize-project.workflow.md +21 -0
  8. package/ide/antigravity/.agents/personas/database-architect.md +431 -153
  9. package/ide/antigravity/.agents/personas/global-orchestrator.md +202 -85
  10. package/ide/antigravity/.agents/personas/nodejs-backend.md +368 -133
  11. package/ide/antigravity/.agents/personas/reactjs-frontend.md +182 -101
  12. package/ide/antigravity/.agents/skills/api-builder/SKILL.md +58 -0
  13. package/ide/antigravity/.agents/skills/code-intelligence/SKILL.md +22 -0
  14. package/ide/antigravity/.agents/skills/database/SKILL.md +32 -0
  15. package/ide/antigravity/.agents/skills/mcp-and-context/SKILL.md +76 -82
  16. package/ide/antigravity/.agents/skills/reactjs/SKILL.md +36 -0
  17. package/ide/antigravity/.agents/workflows/codeninja-api.md +76 -83
  18. package/ide/antigravity/.agents/workflows/codeninja-audit.md +82 -44
  19. package/ide/antigravity/.agents/workflows/codeninja-db-create.md +107 -94
  20. package/ide/antigravity/.agents/workflows/codeninja-db-drop.md +89 -67
  21. package/ide/antigravity/.agents/workflows/codeninja-db-index.md +86 -54
  22. package/ide/antigravity/.agents/workflows/codeninja-db-modify.md +126 -68
  23. package/ide/antigravity/.agents/workflows/codeninja-db-seed.md +87 -59
  24. package/ide/antigravity/.agents/workflows/codeninja-db-sync.md +77 -41
  25. package/ide/antigravity/.agents/workflows/codeninja-debug.md +35 -21
  26. package/ide/antigravity/.agents/workflows/codeninja-design.md +49 -35
  27. package/ide/antigravity/.agents/workflows/codeninja-explain.md +41 -20
  28. package/ide/antigravity/.agents/workflows/codeninja-init.md +479 -289
  29. package/ide/antigravity/.agents/workflows/codeninja-integrate-api.md +253 -136
  30. package/ide/antigravity/.agents/workflows/codeninja-modularize.md +250 -132
  31. package/ide/antigravity/.agents/workflows/codeninja-optimize.md +71 -29
  32. package/ide/antigravity/.agents/workflows/codeninja-refactor.md +50 -42
  33. package/ide/antigravity/.agents/workflows/codeninja-review.md +38 -21
  34. package/ide/antigravity/.agents/workflows/codeninja-sync.md +922 -141
  35. package/ide/antigravity/.agents/workflows/codeninja-test.md +34 -49
  36. package/ide/antigravity/.agents/workflows/codeninja-validate-page.md +449 -151
  37. package/ide/claude-code/.claude/CLAUDE.md +99 -0
  38. package/ide/claude-code/.claude/agents/database-agent.md +535 -0
  39. package/ide/claude-code/.claude/agents/nodejs-agent.md +493 -0
  40. package/ide/claude-code/.claude/agents/reactjs-agent.md +267 -0
  41. package/ide/claude-code/.claude/commands/codeninja-api.md +104 -0
  42. package/ide/claude-code/.claude/commands/codeninja-audit.md +119 -0
  43. package/ide/claude-code/.claude/commands/codeninja-db-create.md +138 -0
  44. package/ide/claude-code/.claude/commands/codeninja-db-drop.md +109 -0
  45. package/ide/claude-code/.claude/commands/codeninja-db-index.md +103 -0
  46. package/ide/claude-code/.claude/commands/codeninja-db-modify.md +165 -0
  47. package/ide/claude-code/.claude/commands/codeninja-db-seed.md +104 -0
  48. package/ide/claude-code/.claude/commands/codeninja-db-sync.md +106 -0
  49. package/ide/claude-code/.claude/commands/codeninja-debug.md +99 -0
  50. package/ide/claude-code/.claude/commands/codeninja-design.md +68 -0
  51. package/ide/claude-code/.claude/commands/codeninja-explain.md +61 -0
  52. package/ide/claude-code/.claude/commands/codeninja-init.md +529 -0
  53. package/ide/claude-code/.claude/commands/codeninja-integrate-api.md +453 -0
  54. package/ide/claude-code/.claude/commands/codeninja-modularize.md +334 -0
  55. package/ide/claude-code/.claude/commands/codeninja-optimize.md +129 -0
  56. package/ide/claude-code/.claude/commands/codeninja-refactor.md +76 -0
  57. package/ide/claude-code/.claude/commands/codeninja-review.md +87 -0
  58. package/ide/claude-code/.claude/commands/codeninja-sync.md +964 -0
  59. package/ide/claude-code/.claude/commands/codeninja-test.md +45 -0
  60. package/ide/claude-code/.claude/commands/codeninja-validate-page.md +548 -0
  61. package/ide/cursor/.cursor/rules/01-global-orchestrator.mdc +12 -13
  62. package/ide/cursor/.cursor/rules/02-mcp-and-context.mdc +47 -31
  63. package/ide/cursor/.cursor/rules/03-api-builder.mdc +32 -110
  64. package/ide/cursor/.cursor/rules/04-nodejs-generation.mdc +58 -0
  65. package/ide/cursor/.cursor/rules/05-database.mdc +54 -0
  66. package/ide/cursor/.cursor/rules/06-reactjs.mdc +36 -0
  67. package/ide/cursor/.cursor/rules/07-reactjs-generation.mdc +49 -0
  68. package/ide/cursor/.cursor/rules/08-code-intelligence.mdc +56 -0
  69. package/ide/cursor/.cursor/rules/09-workflow-steps.mdc +53 -0
  70. package/ide/vscode/.github/copilot-instructions.md +67 -382
  71. package/ide/vscode/.vscode/instructions/code-intelligence.instructions.md +58 -0
  72. package/ide/vscode/.vscode/instructions/database.instructions.md +55 -0
  73. package/ide/vscode/.vscode/instructions/nodejs.instructions.md +77 -0
  74. package/ide/vscode/.vscode/instructions/reactjs.instructions.md +42 -0
  75. package/package.json +2 -2
  76. package/tasks/ask-hashing-library.task.md +31 -0
  77. package/tasks/ask-language-type.task.md +26 -0
  78. package/tasks/ask-new-module-name.task.md +13 -0
  79. package/tasks/ask-new-service-name.task.md +13 -0
  80. package/tasks/ask-old-module-name.task.md +15 -0
  81. package/tasks/ask-old-service-name.task.md +13 -0
  82. package/tasks/ask-orm-type.task.md +26 -0
  83. package/tasks/collect-seed-data.task.md +19 -0
  84. package/tasks/generate-app.task.md +42 -0
  85. package/tasks/generate-common.task.md +13 -0
  86. package/tasks/generate-constants.task.md +13 -0
  87. package/tasks/generate-database.task.md +32 -0
  88. package/tasks/generate-encryption.task.md +28 -0
  89. package/tasks/generate-fast-defaults.task.md +7 -0
  90. package/tasks/generate-hashing.task.md +180 -0
  91. package/tasks/generate-headerValidator.task.md +13 -0
  92. package/tasks/generate-ioRedis.task.md +20 -0
  93. package/tasks/generate-language-en.task.md +12 -0
  94. package/tasks/generate-logging.task.md +12 -0
  95. package/tasks/generate-model.task.md +74 -6
  96. package/tasks/generate-notification.task.md +12 -0
  97. package/tasks/generate-package-json.task.md +69 -0
  98. package/tasks/generate-prisma-client.task.md +56 -0
  99. package/tasks/generate-prisma-schema.task.md +71 -0
  100. package/tasks/generate-rateLimiter.task.md +20 -0
  101. package/tasks/generate-readme.task.md +24 -0
  102. package/tasks/generate-response.task.md +27 -0
  103. package/tasks/generate-route-manager.task.md +32 -0
  104. package/tasks/generate-route.task.md +37 -0
  105. package/tasks/generate-swagger.task.md +8 -0
  106. package/tasks/generate-template.task.md +12 -0
  107. package/tasks/generate-tsconfig.task.md +38 -0
  108. package/tasks/generate-validator.task.md +31 -0
  109. package/ide/cursor/.cursor/rules/04-database.mdc +0 -90
  110. package/ide/cursor/.cursor/rules/05-reactjs.mdc +0 -147
  111. 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
- slash_command: /codeninja:design
3
- personas: [global-orchestrator, nodejs-backend, database-architect]
4
- skills: [mcp-and-context, api-builder, database]
5
- description: Plan a feature, API contract, or database change before writing any code.
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
- # /codeninja:design
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
- ## Before Running
11
- 1. Call `context_read`
12
- 2. Call `context_check_stale`
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
- ## Execution — Full Step-by-Step
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
- **Step 1.** Ask: "What are you designing?"
19
- - Options: new feature / new API endpoint / database change / full module
20
- - Store: `context.current_design.type`
32
+ 2. Run task: `ask-feature-name`
33
+ - Stores: `context.current_design.feature_name`
21
34
 
22
- **Step 2.** Ask: "Feature or module name?"
23
- - Store: `context.current_design.feature_name`
35
+ 3. Run task: `ask-design-description`
36
+ - Free text: what should this feature do?
37
+ - Stores: `context.current_design.description`
24
38
 
25
- **Step 3.** Ask: "What should this feature do?" (free text)
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
- **Step 4.** If design involves data storage:
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
- **Step 5.** If design involves API endpoints:
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
- **Step 6.** Generate `.codeninja/agent/designs/<feature_name>.design.md`:
46
- - Feature summary
47
- - DB schema proposal (tables, columns, indexes, relationships)
48
- - API contracts (method, path, request, response shape)
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
- slash_command: /codeninja:explain
3
- personas: [global-orchestrator]
4
- skills: [mcp-and-context, code-intelligence]
5
- description: Explain any file, function, pattern, or concept using full project context.
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
- ## Before Running
11
- 1. Call `context_read`
12
- 2. Call `context_check_stale`
23
+ ---
13
24
 
14
- ## Execution — Full Step-by-Step
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 `fs_read` on the target file (if a file was specified)
23
- 2. Read 1 related file to understand how the target fits in the system
24
- 3. Reference `context.db.schema` for any table/column mentions
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 every explanation as:
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
- **Why this way** (the architectural decision behind it)
36
-
37
- **Where it connects** (related files and functions in this project use real names)
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?"