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
package/.gitattributes
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Force LF line endings for all files — prevents Windows CRLF breaking shebang on Mac/Linux
|
|
2
|
+
* text=auto eol=lf
|
|
3
|
+
|
|
4
|
+
# JS files must always be LF — shebang line breaks with CRLF on Unix
|
|
5
|
+
*.js text eol=lf
|
|
6
|
+
|
|
7
|
+
# Markdown files — LF
|
|
8
|
+
*.md text eol=lf
|
|
9
|
+
|
|
10
|
+
# JSON files — LF
|
|
11
|
+
*.json text eol=lf
|
package/README.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Code Ninja Agent System
|
|
2
|
+
|
|
3
|
+
AI-powered agentic scaffolding and development assistant for your project.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Folder Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
.codeninja/agent/
|
|
11
|
+
global-agent.md ← Master orchestrator
|
|
12
|
+
nodejs-agent.md ← NodeJS backend expert
|
|
13
|
+
reactjs-agent.md ← ReactJS frontend expert
|
|
14
|
+
database-agent.md ← Database architect (PostgreSQL / MySQL / MongoDB)
|
|
15
|
+
designs/ ← @design output files (auto-created)
|
|
16
|
+
|
|
17
|
+
.codeninja/commands/
|
|
18
|
+
initialize-project.workflow.md
|
|
19
|
+
create-api.workflow.md
|
|
20
|
+
design.workflow.md
|
|
21
|
+
audit.workflow.md
|
|
22
|
+
test.workflow.md
|
|
23
|
+
refactor.workflow.md
|
|
24
|
+
sync.workflow.md
|
|
25
|
+
modularize.workflow.md
|
|
26
|
+
validate-page.workflow.md
|
|
27
|
+
integrate-api.workflow.md
|
|
28
|
+
db-create-table.workflow.md
|
|
29
|
+
db-modify-table.workflow.md
|
|
30
|
+
db-add-index.workflow.md
|
|
31
|
+
db-drop-table.workflow.md
|
|
32
|
+
db-seed.workflow.md
|
|
33
|
+
db-sync.workflow.md
|
|
34
|
+
|
|
35
|
+
.codeninja/tasks/
|
|
36
|
+
── Project Info ──────────────────────────────
|
|
37
|
+
ask-project-info-doc.task.md
|
|
38
|
+
ask-project-scope-of-work.task.md
|
|
39
|
+
ask-project-figma.task.md
|
|
40
|
+
|
|
41
|
+
── Repository & Init ─────────────────────────
|
|
42
|
+
detect-repository-state.task.md
|
|
43
|
+
ask-project-type.task.md
|
|
44
|
+
ask-service-name.task.md
|
|
45
|
+
ask-service-port.task.md
|
|
46
|
+
ask-service-description.task.md
|
|
47
|
+
ask-package-name.task.md
|
|
48
|
+
ask-package-author.task.md
|
|
49
|
+
ask-api-key.task.md
|
|
50
|
+
ask-encryption-key.task.md
|
|
51
|
+
ask-encryption-iv.task.md
|
|
52
|
+
ask-redis-host.task.md
|
|
53
|
+
ask-redis-port.task.md
|
|
54
|
+
ask-redis-config.task.md
|
|
55
|
+
show-init-summary.task.md
|
|
56
|
+
ask-client-type.task.md
|
|
57
|
+
ask-encrypted-transport.task.md
|
|
58
|
+
ask-supported-languages.task.md
|
|
59
|
+
ask-init-mode.task.md
|
|
60
|
+
generate-fast-defaults.task.md
|
|
61
|
+
|
|
62
|
+
── Database Config ───────────────────────────
|
|
63
|
+
ask-database-type.task.md
|
|
64
|
+
ask-database-name.task.md
|
|
65
|
+
ask-database-host.task.md
|
|
66
|
+
ask-database-port.task.md
|
|
67
|
+
ask-database-user.task.md
|
|
68
|
+
ask-database-config.task.md
|
|
69
|
+
|
|
70
|
+
── Database Table Operations ─────────────────
|
|
71
|
+
ask-table-purpose.task.md
|
|
72
|
+
ask-table-name.task.md
|
|
73
|
+
ask-table-file-number.task.md
|
|
74
|
+
ask-table-needs-status.task.md
|
|
75
|
+
ask-table-needs-soft-delete.task.md
|
|
76
|
+
ask-table-indexes.task.md
|
|
77
|
+
ask-table-seed-data.task.md
|
|
78
|
+
show-db-table-summary.task.md
|
|
79
|
+
|
|
80
|
+
── Column Operations ─────────────────────────
|
|
81
|
+
ask-column-name.task.md
|
|
82
|
+
ask-column-type.task.md
|
|
83
|
+
ask-column-is-enum.task.md
|
|
84
|
+
ask-column-enum-values.task.md
|
|
85
|
+
ask-column-position.task.md
|
|
86
|
+
ask-old-column-name.task.md
|
|
87
|
+
ask-new-column-name.task.md
|
|
88
|
+
ask-modify-operation.task.md
|
|
89
|
+
|
|
90
|
+
── Index Operations ──────────────────────────
|
|
91
|
+
ask-index-columns.task.md
|
|
92
|
+
ask-index-sort-order.task.md
|
|
93
|
+
ask-index-type.task.md
|
|
94
|
+
ask-index-file-placement.task.md
|
|
95
|
+
|
|
96
|
+
── Seed Data ─────────────────────────────────
|
|
97
|
+
ask-seed-rows-count.task.md
|
|
98
|
+
ask-seed-row-values.task.md
|
|
99
|
+
|
|
100
|
+
── API & Module Operations ───────────────────
|
|
101
|
+
ask-target-service.task.md
|
|
102
|
+
ask-react-target-service.task.md
|
|
103
|
+
ask-module-name.task.md
|
|
104
|
+
ask-http-method.task.md
|
|
105
|
+
ask-route-path.task.md
|
|
106
|
+
ask-route-description.task.md
|
|
107
|
+
ask-primary-table.task.md
|
|
108
|
+
ask-requires-auth.task.md
|
|
109
|
+
ask-api-version.task.md
|
|
110
|
+
|
|
111
|
+
── ReactJS Page Operations ───────────────────
|
|
112
|
+
ask-page-path.task.md
|
|
113
|
+
ask-modularize-scope.task.md
|
|
114
|
+
ask-validation-library.task.md
|
|
115
|
+
ask-api-integration-scope.task.md
|
|
116
|
+
|
|
117
|
+
── Design & Refactor ─────────────────────────
|
|
118
|
+
ask-design-target.task.md
|
|
119
|
+
ask-feature-name.task.md
|
|
120
|
+
ask-design-description.task.md
|
|
121
|
+
ask-refactor-type.task.md
|
|
122
|
+
ask-table-name.task.md
|
|
123
|
+
ask-new-table-name.task.md
|
|
124
|
+
|
|
125
|
+
── Test ──────────────────────────────────────
|
|
126
|
+
ask-test-type.task.md
|
|
127
|
+
|
|
128
|
+
── Output & Context ──────────────────────────
|
|
129
|
+
write-context.task.md
|
|
130
|
+
show-final-summary.task.md
|
|
131
|
+
|
|
132
|
+
── Utilities Generation ──────────────────────────────
|
|
133
|
+
generate-encryption.task.md
|
|
134
|
+
generate-response.task.md
|
|
135
|
+
generate-validator.task.md
|
|
136
|
+
generate-headerValidator.task.md
|
|
137
|
+
generate-logging.task.md
|
|
138
|
+
generate-app.task.md
|
|
139
|
+
generate-rateLimiter.task.md
|
|
140
|
+
generate-route-manager.task.md
|
|
141
|
+
generate-constants.task.md
|
|
142
|
+
generate-database.task.md
|
|
143
|
+
generate-template.task.md
|
|
144
|
+
generate-language-en.task.md
|
|
145
|
+
generate-ioRedis.task.md
|
|
146
|
+
generate-notification.task.md
|
|
147
|
+
generate-common.task.md
|
|
148
|
+
generate-route.task.md
|
|
149
|
+
generate-model.task.md
|
|
150
|
+
generate-enc-dec-html.task.md
|
|
151
|
+
generate-enc-dec-php.task.md
|
|
152
|
+
generate-package-json.task.md
|
|
153
|
+
generate-readme.task.md
|
|
154
|
+
generate-gitignore.task.md
|
|
155
|
+
generate-swagger.task.md
|
|
156
|
+
|
|
157
|
+
── System Tables ─────────────────────────
|
|
158
|
+
generate-tbl-user-deviceinfo.task.md
|
|
159
|
+
|
|
160
|
+
.codeninja/context/
|
|
161
|
+
context.json ← Shared memory for all agents (auto-managed)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Available Commands
|
|
167
|
+
|
|
168
|
+
### Project Initialization
|
|
169
|
+
| Command | Description |
|
|
170
|
+
|---|---|
|
|
171
|
+
| `@initialize-project` | Bootstrap a new NodeJS service, ReactJS app, or database |
|
|
172
|
+
|
|
173
|
+
### API & Service Development
|
|
174
|
+
| Command | Description |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `@create-api` | Add a new API module to an existing service |
|
|
177
|
+
| `@design` | Plan a feature or schema before writing code |
|
|
178
|
+
| `@audit` | Review a service for security, quality, and consistency |
|
|
179
|
+
| `@test` | Generate or run tests for a module |
|
|
180
|
+
| `@refactor` | Rename or restructure code with full change tracking |
|
|
181
|
+
| `@sync` | Scan the entire repo and rebuild context.json |
|
|
182
|
+
|
|
183
|
+
### Database Commands
|
|
184
|
+
| Command | Description |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `@db:create-table` | Design and generate a new table following all conventions |
|
|
187
|
+
| `@db:modify-table` | Add/rename/drop a column via ALTER migration file |
|
|
188
|
+
| `@db:add-index` | Add a new index to an existing table |
|
|
189
|
+
| `@db:drop-table` | Generate a DROP migration and clean up context |
|
|
190
|
+
| `@db:seed` | Add or update seed data for a table |
|
|
191
|
+
| `@db:sync` | Scan migration files and rebuild context.db.schema |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## How It Works
|
|
196
|
+
|
|
197
|
+
1. **You run a command** — e.g. `@initialize-project`
|
|
198
|
+
2. **Global agent activates** — reads `.codeninja/context/context.json` for full awareness
|
|
199
|
+
3. **Project info is collected first (once)** — document, SOW, Figma link → builds project summary
|
|
200
|
+
4. **Workflow runs** — routes to the right agent (NodeJS, ReactJS, Database)
|
|
201
|
+
5. **Tasks execute one at a time** — each asks exactly one question
|
|
202
|
+
6. **Single confirmation** — you approve the summary once, then all files are generated
|
|
203
|
+
7. **Context is updated** — every action recorded in `context.json`
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Key Design Principles
|
|
208
|
+
|
|
209
|
+
### One Question Per Task
|
|
210
|
+
Every `ask-*` task collects exactly one value. No multi-field forms.
|
|
211
|
+
|
|
212
|
+
### Single Confirmation Per Operation
|
|
213
|
+
After collecting all required values, a summary is shown once.
|
|
214
|
+
You confirm once → everything generates. No per-file prompts.
|
|
215
|
+
|
|
216
|
+
### Context is the Brain
|
|
217
|
+
`.codeninja/context/context.json` is the shared memory for all agents.
|
|
218
|
+
- Every service, route, table, column, and change is stored here
|
|
219
|
+
- All agents read it before making any decision
|
|
220
|
+
- The `change_log` gives a full history of every structural change
|
|
221
|
+
|
|
222
|
+
### Database First
|
|
223
|
+
During `@initialize-project`, the database folder is always scaffolded
|
|
224
|
+
before any application service code. This ensures NodeJS services are
|
|
225
|
+
generated with accurate DB config and column awareness.
|
|
226
|
+
|
|
227
|
+
### Project Info Awareness
|
|
228
|
+
When you provide a project document, SOW, or Figma link during initialization,
|
|
229
|
+
the agent extracts entities, features, and tech preferences. Every subsequent
|
|
230
|
+
command uses this context to make smarter suggestions.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Database File Convention
|
|
235
|
+
|
|
236
|
+
Every table follows this structure:
|
|
237
|
+
```
|
|
238
|
+
database/
|
|
239
|
+
<db_type>/
|
|
240
|
+
migrations/
|
|
241
|
+
1-setup-tbl-<name>.sql ← One file per table, numbered
|
|
242
|
+
2-setup-tbl-<name>.sql
|
|
243
|
+
...
|
|
244
|
+
111-setup-database-indexes.sql ← Shared indexes, always last
|
|
245
|
+
seeds/
|
|
246
|
+
<table>_seed.sql ← Standalone seed files
|
|
247
|
+
create-schema.sql ← Auto-generated runner (do not edit)
|
|
248
|
+
setup-database.sh ← Linux/Mac setup script
|
|
249
|
+
setup-database.ps1 ← Windows setup script
|
|
250
|
+
reset-database.sh ← Dev-only full reset (dangerous)
|
|
251
|
+
README.md
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Running the Database
|
|
255
|
+
```bash
|
|
256
|
+
# Linux/Mac — creates DB and runs all migrations
|
|
257
|
+
cd database/<db_type>
|
|
258
|
+
bash setup-database.sh
|
|
259
|
+
|
|
260
|
+
# Windows
|
|
261
|
+
cd database/<db_type>
|
|
262
|
+
.\setup-database.ps1
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Multi-Service Projects
|
|
268
|
+
|
|
269
|
+
Each service gets its own entry in `context.services`:
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"services": {
|
|
273
|
+
"auth": { "type": "nodejs", "port": 1001 },
|
|
274
|
+
"ledger": { "type": "nodejs", "port": 1002 },
|
|
275
|
+
"frontend":{ "type": "reactjs", "port": 3000 }
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
All services share the same `context.db` — they reference the same database
|
|
281
|
+
schema and the same table/column names.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Getting Started
|
|
286
|
+
|
|
287
|
+
1. Run `@initialize-project`
|
|
288
|
+
2. Answer Phase 0 questions (project doc, SOW, Figma) — once per repo
|
|
289
|
+
3. Choose project type (NodeJS, ReactJS, Database)
|
|
290
|
+
4. Configure database
|
|
291
|
+
5. Name your service and configure it
|
|
292
|
+
6. Confirm once → everything is generated
|
|
293
|
+
7. Run `@db:create-table` to start adding your first table
|