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,336 +1,526 @@
|
|
|
1
|
+
This workflow runs when user invokes /codeninja:init
|
|
2
|
+
|
|
1
3
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
skills: [mcp-and-context, api-builder, reactjs, database]
|
|
4
|
+
type: workflow
|
|
5
|
+
name: initialize-project
|
|
5
6
|
description: >
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Interactive bootstrap workflow for a new service. Collects project
|
|
8
|
+
information first, then service details one value at a time, then scaffolds
|
|
9
|
+
database folder and service baseline. Single confirmation before generation —
|
|
10
|
+
no per-file prompts after that.
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
#
|
|
13
|
+
# Workflow: @initialize-project
|
|
14
|
+
|
|
15
|
+
## Goal
|
|
16
|
+
Scaffold a new service (NodeJS API, ReactJS frontend, or Database-only) with
|
|
17
|
+
full context recorded in `.codeninja/context/context.json`.
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
- Phase 0 runs ONCE per repository — skip entirely if `context.project_info` already populated.
|
|
21
|
+
- Confirm the full summary ONCE before creating any file.
|
|
22
|
+
- After confirmation → generate ALL files using wave structure, no further per-file prompts.
|
|
23
|
+
- Always scaffold database folder at REPOSITORY ROOT before any service
|
|
24
|
+
code. The database/ folder is always at the same level as service
|
|
25
|
+
folders, never inside one.
|
|
26
|
+
- After completion → run task: `write-context` then task: `show-final-summary`
|
|
27
|
+
|
|
28
|
+
## Init Mode Rules
|
|
29
|
+
- Fast mode: ask only essential questions. Auto-generate all technical
|
|
30
|
+
config silently. Show everything in summary for review.
|
|
31
|
+
- Manual mode: ask every value individually, one at a time.
|
|
32
|
+
- In BOTH modes: the summary shows ALL values and ALL are editable
|
|
33
|
+
before confirmation. Fast mode is not a shortcut around review —
|
|
34
|
+
it is a shortcut around data entry.
|
|
35
|
+
- Auto-generated security values (api_key, encryption_key) are
|
|
36
|
+
cryptographically random and production-safe.
|
|
37
|
+
encryption_iv is always the first 16 characters of encryption_key —
|
|
38
|
+
never randomly generated independently.
|
|
39
|
+
The user does not need to provide them unless they have specific
|
|
40
|
+
requirements.
|
|
41
|
+
|
|
42
|
+
---
|
|
12
43
|
|
|
13
|
-
##
|
|
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
|
|
44
|
+
## Step-by-Step Execution
|
|
17
45
|
|
|
18
|
-
|
|
46
|
+
---
|
|
19
47
|
|
|
20
48
|
### Phase 0 — Project Information (runs ONCE per repo)
|
|
49
|
+
|
|
21
50
|
Check `context.project_info` — if already populated, skip Phase 0 entirely.
|
|
22
51
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- Store: `context.project_info.has_doc`, `.doc_url` or `.doc_content`, `.from_doc`
|
|
52
|
+
0a. Run task: `ask-project-info-doc`
|
|
53
|
+
Stores: `context.project_info.has_doc`, `.doc_url` or `.doc_content`, `.from_doc`
|
|
26
54
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- Store: `context.project_info.has_sow`, `.sow_url` or `.sow_content`, `.from_sow`
|
|
55
|
+
0b. Run task: `ask-project-scope-of-work`
|
|
56
|
+
Stores: `context.project_info.has_sow`, `.sow_url` or `.sow_content`, `.from_sow`
|
|
30
57
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- Store: `context.project_info.has_figma`, `.figma_url`, `.from_figma`
|
|
58
|
+
0c. Run task: `ask-project-figma`
|
|
59
|
+
Stores: `context.project_info.has_figma`, `.figma_url`, `.from_figma`
|
|
34
60
|
|
|
35
|
-
After all three:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
61
|
+
After all three tasks:
|
|
62
|
+
Agent synthesizes all collected information and builds:
|
|
63
|
+
`context.project_info.summary` — 150–200 word plain text summary including:
|
|
64
|
+
- What the project does
|
|
65
|
+
- Key features identified
|
|
66
|
+
- Entities/modules detected
|
|
67
|
+
- Tech preferences mentioned
|
|
68
|
+
- Third-party integrations noted
|
|
39
69
|
|
|
40
|
-
|
|
70
|
+
`context.project_info.detected_entities[]` — flat list of data entities found
|
|
71
|
+
Example: ["users", "admins", "bots", "orders", "products"]
|
|
41
72
|
|
|
42
|
-
|
|
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.
|
|
73
|
+
Agent uses this summary for ALL remaining suggestions in this and future workflows.
|
|
82
74
|
|
|
83
75
|
---
|
|
84
76
|
|
|
85
|
-
### Phase
|
|
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.
|
|
77
|
+
### Phase 1 — Project Type
|
|
123
78
|
|
|
124
|
-
|
|
79
|
+
0. Run task: `ask-init-mode`
|
|
80
|
+
- Stores: `context.current_init.init_mode`
|
|
81
|
+
- Values: "fast" | "manual"
|
|
125
82
|
|
|
126
|
-
|
|
83
|
+
1. Run task: `ask-project-type`
|
|
84
|
+
- Stores: `context.current_init.project_type`
|
|
85
|
+
- Valid values: `nodejs`, `reactjs`, `database-only`
|
|
127
86
|
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
- Store: `context.current_init.service_name`
|
|
87
|
+
1b. If `project_type == nodejs`:
|
|
88
|
+
- Run task: `ask-client-type`
|
|
89
|
+
Stores: `context.current_init.client_type`
|
|
132
90
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- Store: `context.current_init.port`
|
|
91
|
+
- Run task: `ask-encrypted-transport`
|
|
92
|
+
Stores: `context.current_init.encrypted_transport`
|
|
136
93
|
|
|
137
|
-
|
|
138
|
-
|
|
94
|
+
- Run task: `ask-language-type`
|
|
95
|
+
Stores: `context.current_init.language`
|
|
96
|
+
Only runs for project_type == nodejs. Skipped for reactjs and database-only.
|
|
139
97
|
|
|
140
|
-
|
|
98
|
+
- Run task: `ask-supported-languages`
|
|
99
|
+
Stores: `context.current_init.supported_languages[]`
|
|
141
100
|
|
|
142
|
-
|
|
101
|
+
2. If `project_type == reactjs`:
|
|
102
|
+
- Run task: `ask-linked-service`
|
|
103
|
+
This enforces the backend requirement. If no NodeJS service exists,
|
|
104
|
+
the task aborts the workflow with instructions. Otherwise it:
|
|
105
|
+
- Stores: `context.current_init.linked_service`
|
|
106
|
+
- Stores: `context.current_init.linked_service_port`
|
|
107
|
+
- Inherits and stores: `encryption_key`, `encryption_iv`, `api_key`
|
|
108
|
+
from the selected backend service into `context.current_init`
|
|
109
|
+
- Skip Phase 2 (no DB questions for frontend)
|
|
110
|
+
- Skip Phase 4 (no package author/name questions — handled by fast defaults)
|
|
111
|
+
- Skip Phase 5 (no api-key, encryption-key, redis questions — inherited
|
|
112
|
+
from linked backend, never asked from user)
|
|
113
|
+
- Jump directly to Phase 3 (service identity)
|
|
143
114
|
|
|
144
|
-
|
|
145
|
-
-
|
|
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`
|
|
115
|
+
3. If `project_type == nodejs` or `database-only`:
|
|
116
|
+
- Continue to Phase 2
|
|
151
117
|
|
|
152
118
|
---
|
|
153
119
|
|
|
154
|
-
### Phase
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
|
|
120
|
+
### Phase 2 — Database (for nodejs and database-only)
|
|
121
|
+
|
|
122
|
+
4. Run task: `ask-database-type`
|
|
123
|
+
- If `context.db.type` already exists → inform user and ask:
|
|
124
|
+
use existing or configure new?
|
|
125
|
+
- Stores: `context.db.type`
|
|
126
|
+
|
|
127
|
+
4.5. Run task: `ask-orm-type`
|
|
128
|
+
- Stores: `context.db.orm`
|
|
129
|
+
- Fast mode: silently sets orm = "none"
|
|
130
|
+
|
|
131
|
+
5. If `init_mode == "manual"`:
|
|
132
|
+
Run task: `ask-database-config`
|
|
133
|
+
- Collects: name, host, port, user in one grouped display
|
|
134
|
+
- Stores: `context.db.name`, `context.db.host`,
|
|
135
|
+
`context.db.port`, `context.db.user`
|
|
136
|
+
|
|
137
|
+
If `init_mode == "fast"`:
|
|
138
|
+
Run task: `ask-database-name`
|
|
139
|
+
- Stores: `context.db.name`
|
|
140
|
+
Run task: `ask-database-user`
|
|
141
|
+
- Stores: `context.db.user`
|
|
142
|
+
(host and port will be auto-populated by generate-fast-defaults)
|
|
143
|
+
|
|
144
|
+
9. Delegate to `database-agent` — generate database folder at the
|
|
145
|
+
REPOSITORY ROOT — not inside the service folder.
|
|
146
|
+
The database/ directory is always a sibling of service folders,
|
|
147
|
+
never a child. All services share the same database directory.
|
|
148
|
+
|
|
149
|
+
Path anchor: all paths below are relative to repository root.
|
|
150
|
+
|
|
151
|
+
## Database Folder Existence Check (CRITICAL)
|
|
152
|
+
|
|
153
|
+
Before generating ANY database files, check whether
|
|
154
|
+
`<repo_root>/database/<db_type>/` already exists on disk.
|
|
155
|
+
|
|
156
|
+
### If database folder does NOT exist → generate everything:
|
|
157
|
+
- <repo_root>/database/<db_type>/migrations/ (empty, ready for table files)
|
|
158
|
+
- <repo_root>/database/<db_type>/create-schema.sql (header only)
|
|
159
|
+
- <repo_root>/database/<db_type>/setup-database.sh (Linux/Mac runner)
|
|
160
|
+
- <repo_root>/database/<db_type>/setup-database.ps1 (Windows runner)
|
|
161
|
+
- <repo_root>/database/<db_type>/reset-database.sh (dev-only reset)
|
|
162
|
+
- <repo_root>/database/<db_type>/seeds/ (empty with .gitkeep)
|
|
163
|
+
- <repo_root>/database/README.md
|
|
164
|
+
|
|
165
|
+
Then run task: generate-tbl-user-deviceinfo
|
|
166
|
+
(only for nodejs projects — not database-only)
|
|
167
|
+
|
|
168
|
+
### If database folder ALREADY exists → skip folder generation entirely:
|
|
169
|
+
Inform user:
|
|
170
|
+
"Database folder already exists at database/<db_type>/. Skipping
|
|
171
|
+
folder generation — your existing migrations are untouched."
|
|
172
|
+
|
|
173
|
+
Then check: does `database/<db_type>/migrations/1-setup-tbl-user-deviceinfo.sql`
|
|
174
|
+
already exist on disk?
|
|
175
|
+
- If YES → skip generate-tbl-user-deviceinfo entirely.
|
|
176
|
+
Inform user: "tbl_user_deviceinfo migration already exists. Skipping."
|
|
177
|
+
- If NO AND project_type == nodejs → run task: generate-tbl-user-deviceinfo.
|
|
178
|
+
This handles the case where database-only was initialized first
|
|
179
|
+
and the NodeJS system table was never created.
|
|
180
|
+
- If NO AND project_type == database-only → skip. This table is
|
|
181
|
+
not needed for database-only projects.
|
|
182
|
+
|
|
183
|
+
10. Inform user:
|
|
184
|
+
"Database folder initialized. You can now run @db:create-table
|
|
185
|
+
to add your first table, or continue to scaffold your service below."
|
|
186
|
+
|
|
187
|
+
11. If `project_type == database-only`:
|
|
188
|
+
- Skip Phases 3–5 entirely
|
|
189
|
+
- Jump directly to Phase 6 (confirmation and final summary)
|
|
159
190
|
|
|
160
|
-
|
|
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`
|
|
191
|
+
---
|
|
168
192
|
|
|
169
|
-
|
|
170
|
-
- Ask: "Redis host and port?" (grouped)
|
|
171
|
-
- Store: `context.current_init.redis_host`, `context.current_init.redis_port`
|
|
193
|
+
### Phase 3 — Service Identity
|
|
172
194
|
|
|
173
|
-
|
|
195
|
+
12. Run task: `ask-service-name`
|
|
196
|
+
- Must be unique across `context.services`
|
|
197
|
+
- Agent suggests name from `context.project_info.detected_entities`
|
|
198
|
+
if relevant
|
|
199
|
+
- Stores: `context.current_init.service_name`
|
|
174
200
|
|
|
175
|
-
|
|
201
|
+
13. If `init_mode == "manual"`:
|
|
202
|
+
Run task: `ask-service-port`
|
|
203
|
+
- Must not conflict with existing ports in `context.services`
|
|
204
|
+
- Stores: `context.current_init.port`
|
|
176
205
|
|
|
177
|
-
|
|
178
|
-
- `context.
|
|
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
|
|
206
|
+
14. Run task: `ask-service-description`
|
|
207
|
+
- Stores: `context.current_init.description`
|
|
189
208
|
|
|
190
209
|
---
|
|
191
210
|
|
|
192
|
-
### Phase
|
|
211
|
+
### Phase 4 — Package Info (nodejs only, manual mode only — skipped for reactjs)
|
|
193
212
|
|
|
194
|
-
|
|
195
|
-
Run
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
-
|
|
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
|
|
213
|
+
15. If `init_mode == "manual"`:
|
|
214
|
+
Run task: `ask-package-name`
|
|
215
|
+
- Default: service_name
|
|
216
|
+
- Stores: `context.current_init.package_name`
|
|
217
|
+
|
|
218
|
+
16. If `init_mode == "manual"`:
|
|
219
|
+
Run task: `ask-package-author`
|
|
220
|
+
- Stores: `context.current_init.author`
|
|
211
221
|
|
|
212
222
|
---
|
|
213
223
|
|
|
214
|
-
### Phase
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
- `
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
- `
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
- `
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
-
|
|
240
|
-
- `
|
|
241
|
-
|
|
242
|
-
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
-
|
|
247
|
-
- `
|
|
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.
|
|
224
|
+
### Phase 5 — Runtime Config (nodejs only — skipped entirely for reactjs)
|
|
225
|
+
|
|
226
|
+
17. If `init_mode == "manual"`:
|
|
227
|
+
Run task: `ask-api-key`
|
|
228
|
+
- Auto-generate suggestion (32 chars)
|
|
229
|
+
- Stores: `context.current_init.api_key`
|
|
230
|
+
|
|
231
|
+
18. If `init_mode == "manual"`:
|
|
232
|
+
Run task: `ask-encryption-key`
|
|
233
|
+
- Enforce exactly 32 characters
|
|
234
|
+
- Auto-generate suggestion
|
|
235
|
+
- Stores: `context.current_init.encryption_key`
|
|
236
|
+
|
|
237
|
+
19. If `init_mode == "manual"`:
|
|
238
|
+
Run task: `ask-encryption-iv`
|
|
239
|
+
- Enforce exactly 16 characters
|
|
240
|
+
- Auto-generate suggestion
|
|
241
|
+
- Stores: `context.current_init.encryption_iv`
|
|
242
|
+
|
|
243
|
+
Note: KEY and IV are always generated regardless of encrypted_transport
|
|
244
|
+
value. They are used for password encryption even when transport is
|
|
245
|
+
not encrypted.
|
|
246
|
+
|
|
247
|
+
20. If `init_mode == "manual"`:
|
|
248
|
+
Run task: `ask-redis-config`
|
|
249
|
+
- Collects: host and port in one grouped display
|
|
250
|
+
- Stores: `context.current_init.redis_host`,
|
|
251
|
+
`context.current_init.redis_port`
|
|
252
|
+
(If init_mode == "fast" → handled by generate-fast-defaults)
|
|
253
|
+
|
|
254
|
+
21. If `init_mode == "manual"` AND `project_type == "nodejs"`:
|
|
255
|
+
Run task: `ask-hashing-library`
|
|
256
|
+
- Options: bcryptjs (recommended) / argon2
|
|
257
|
+
- Stores: `context.current_init.hashing_library`
|
|
265
258
|
|
|
266
259
|
---
|
|
267
260
|
|
|
268
|
-
### Phase
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
- `
|
|
274
|
-
|
|
275
|
-
-
|
|
276
|
-
-
|
|
277
|
-
-
|
|
278
|
-
-
|
|
279
|
-
- `
|
|
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`
|
|
261
|
+
### Phase 5b — Auto-populate Defaults (fast mode, nodejs only)
|
|
262
|
+
|
|
263
|
+
Run task: `generate-fast-defaults`
|
|
264
|
+
- Condition: only runs if `context.current_init.init_mode == "fast"`
|
|
265
|
+
AND `context.current_init.project_type == "nodejs"`
|
|
266
|
+
- For `project_type == "reactjs"` → skip entirely. All security values
|
|
267
|
+
were already inherited from the linked backend in ask-linked-service.
|
|
268
|
+
Only port and package defaults need auto-filling — see step 13.
|
|
269
|
+
- Silently sets all values not yet in context.current_init
|
|
270
|
+
- No output, no questions — values appear in summary
|
|
271
|
+
- See task description for full list of what is auto-generated
|
|
272
|
+
- `hashing_library` → "bcryptjs" (fast mode default — no native bindings, production-safe)
|
|
307
273
|
|
|
308
274
|
---
|
|
309
275
|
|
|
310
|
-
### Phase
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
-
|
|
314
|
-
-
|
|
315
|
-
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
-
|
|
319
|
-
|
|
320
|
-
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
276
|
+
### Phase 6 — Single Confirmation, Then Generate Everything
|
|
277
|
+
|
|
278
|
+
22. Run task: `show-init-summary`
|
|
279
|
+
- Runs pre-generation validation before displaying anything
|
|
280
|
+
- Resolves any BLOCKERs interactively before showing the summary
|
|
281
|
+
- Displays all collected values with auto-generated markers
|
|
282
|
+
- Shows any non-blocking WARNINGs
|
|
283
|
+
- Shows the 5-wave generation plan
|
|
284
|
+
- Asks ONE question: "Confirm and generate all files?
|
|
285
|
+
(yes / no / change a value)"
|
|
286
|
+
- If yes → proceed immediately to step 23 — NO further confirmations
|
|
287
|
+
- If no → abort, nothing created
|
|
288
|
+
- If change → re-run that specific ask-* task → re-validate →
|
|
289
|
+
return to show-init-summary
|
|
290
|
+
|
|
291
|
+
23. Branch on `context.current_init.project_type`:
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## IF project_type == "nodejs"
|
|
296
|
+
|
|
297
|
+
Read `.codeninja/agent/nodejs-agent.md`.
|
|
298
|
+
Execute ALL generation steps below directly as the nodejs-agent.
|
|
299
|
+
Do NOT proceed to step 24 until every file listed in Waves 1–5
|
|
300
|
+
has been confirmed written to disk.
|
|
301
|
+
|
|
302
|
+
Pass values into generation:
|
|
303
|
+
- Full `context.current_init` + `context.db`
|
|
304
|
+
- `context.current_init.client_type`
|
|
305
|
+
- `context.current_init.encrypted_transport`
|
|
306
|
+
- `context.current_init.supported_languages`
|
|
307
|
+
|
|
308
|
+
Generation rules:
|
|
309
|
+
- Do NOT pause between waves
|
|
310
|
+
- Do NOT ask for confirmation on individual files or folders
|
|
311
|
+
- Do NOT skip any file — every file listed in every wave is required
|
|
312
|
+
- ALL paths below are relative to <service_name>/ — NOT repo root
|
|
313
|
+
- Step 24 MUST NOT run until ALL 5 waves are complete
|
|
314
|
+
|
|
315
|
+
## COMPLETION GATE (nodejs)
|
|
316
|
+
Before proceeding to step 24, verify these files exist on disk:
|
|
317
|
+
- <service_name>/app.js
|
|
318
|
+
- <service_name>/modules/v1/route_manager.js
|
|
319
|
+
- <service_name>/modules/v1/<ServiceName>/route.js
|
|
320
|
+
- <service_name>/modules/v1/<ServiceName>/<service>_model.js
|
|
321
|
+
- <service_name>/document/v1/swagger_doc.json
|
|
322
|
+
If any of these are missing → generate them now before continuing.
|
|
323
|
+
Only proceed to step 24 when ALL are confirmed present.
|
|
324
|
+
|
|
325
|
+
## Generation Wave Structure (nodejs)
|
|
326
|
+
|
|
327
|
+
### Why waves exist
|
|
328
|
+
All files within a wave share zero generation-time dependencies on
|
|
329
|
+
each other — they all read only from context.current_init and
|
|
330
|
+
context.db which are fully loaded before Wave 1 begins.
|
|
331
|
+
Waves only exist where one file must know the output of another
|
|
332
|
+
file before it can be written correctly.
|
|
333
|
+
|
|
334
|
+
### Wave 1 — Foundation (no dependencies, generate all simultaneously)
|
|
335
|
+
These files depend only on context values. None depend on each other.
|
|
336
|
+
|
|
337
|
+
> **Multi-agent:** Delegate to `nodejs-backend` + `database-architect` (parallel) via Task invocation for parallel execution.
|
|
338
|
+
> Read `.codeninja/tasks/generate-package-json.task.md`, `.codeninja/tasks/generate-hashing.task.md`, `.codeninja/tasks/generate-tsconfig.task.md` before generating each file.
|
|
339
|
+
|
|
340
|
+
- package.json → task: generate-package-json
|
|
341
|
+
- .env and .env.example → from context.current_init values
|
|
342
|
+
- .gitignore → task: generate-gitignore
|
|
343
|
+
- README.md → task: generate-readme
|
|
344
|
+
- config/constants.js → task: generate-constants
|
|
345
|
+
- config/template.js → task: generate-template
|
|
346
|
+
- logger/logging.js → task: generate-logging
|
|
347
|
+
- utilities/encryption.js → task: generate-encryption
|
|
348
|
+
- utilities/hashing.js (or .ts) → task: generate-hashing
|
|
349
|
+
- tsconfig.json → task: generate-tsconfig
|
|
350
|
+
(Only generated when language == "typescript")
|
|
351
|
+
- languages/<lang>.js for each in supported_languages[] → task: generate-language-en
|
|
352
|
+
- If `context.db.orm == "prisma"`:
|
|
353
|
+
- prisma/schema.prisma → task: generate-prisma-schema
|
|
354
|
+
- config/prisma.js (or .ts) → task: generate-prisma-client
|
|
355
|
+
- enc_dec.html OR enc_dec.php (based on client_type) → task: generate-enc-dec-html or generate-enc-dec-php
|
|
356
|
+
- <service_name>/pem/ directory with .gitkeep
|
|
357
|
+
- <service_name>/images/ directory with .gitkeep
|
|
358
|
+
- <service_name>/logger/logs/ directory with .gitkeep
|
|
359
|
+
|
|
360
|
+
### Wave 2 — Infrastructure (depend on Wave 1 context, not on Wave 1 files)
|
|
361
|
+
These files reference logging.js and encryption.js at runtime but
|
|
362
|
+
their generation only needs context values — they can be written
|
|
363
|
+
while Wave 1 is still completing.
|
|
364
|
+
|
|
365
|
+
- config/database.js → task: generate-database
|
|
366
|
+
(Skipped when orm == "prisma" — Prisma client replaces it)
|
|
367
|
+
- utilities/ioRedis.js → task: generate-ioRedis
|
|
368
|
+
- utilities/response.js → task: generate-response
|
|
369
|
+
|
|
370
|
+
### Wave 3 — Service Layer (depend on Wave 2 context)
|
|
371
|
+
These files reference database, ioRedis, and response at runtime.
|
|
372
|
+
Generation needs only context values.
|
|
373
|
+
|
|
374
|
+
- config/common.js → task: generate-common
|
|
375
|
+
- utilities/validator.js → task: generate-validator
|
|
376
|
+
- utilities/notification.js → task: generate-notification
|
|
377
|
+
- middleware/rateLimiter.js → task: generate-rateLimiter
|
|
378
|
+
|
|
379
|
+
### Wave 4 — Middleware and Business Layer
|
|
380
|
+
headerValidator references encryption, response, ioRedis, and
|
|
381
|
+
all language files — all of which are complete by now.
|
|
382
|
+
route.js and model.js reference common, database, encryption,
|
|
383
|
+
response, validator — all complete by now.
|
|
384
|
+
swagger_doc.json skeleton needs no other generated files.
|
|
385
|
+
All four can be written simultaneously.
|
|
386
|
+
|
|
387
|
+
- middleware/headerValidator.js → task: generate-headerValidator
|
|
388
|
+
- modules/v1/<ServiceName>/route.js → task: generate-route
|
|
389
|
+
- modules/v1/<ServiceName>/<service>_model.js → task: generate-model
|
|
390
|
+
- document/v1/swagger_doc.json (skeleton) → task: generate-swagger (Mode 1)
|
|
391
|
+
|
|
392
|
+
### Wave 5 — Orchestration Layer (must come last)
|
|
393
|
+
route_manager.js must know which module routes exist so it can
|
|
394
|
+
register them. It reads the module list from context.current_init
|
|
395
|
+
and the route files from Wave 4.
|
|
396
|
+
app.js must know the route_manager path.
|
|
397
|
+
Both depend on Wave 4 completing first. They can be written
|
|
398
|
+
simultaneously with each other.
|
|
399
|
+
|
|
400
|
+
- modules/v1/route_manager.js → task: generate-route-manager
|
|
401
|
+
- app.js → task: generate-app
|
|
402
|
+
|
|
403
|
+
### Wave 6 — Docker Containerization (post-completion)
|
|
404
|
+
These files depend on the complete service being functional.
|
|
405
|
+
Can be written simultaneously.
|
|
406
|
+
|
|
407
|
+
- Dockerfile → task: generate-dockerfile
|
|
408
|
+
- .dockerignore → task: generate-dockerignore
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## IF project_type == "reactjs"
|
|
413
|
+
|
|
414
|
+
Read `.codeninja/agent/reactjs-agent.md`.
|
|
415
|
+
Execute ALL generation steps below directly as the reactjs-agent.
|
|
416
|
+
Do NOT proceed to step 24 until every file listed in Waves 1–3
|
|
417
|
+
has been confirmed written to disk.
|
|
418
|
+
|
|
419
|
+
Pass values into generation:
|
|
420
|
+
- Full `context.current_init` including `linked_service`,
|
|
421
|
+
`linked_service_port`, `encryption_key`, `encryption_iv`, `api_key`
|
|
422
|
+
|
|
423
|
+
Generation rules:
|
|
424
|
+
- Do NOT pause between waves
|
|
425
|
+
- Do NOT ask for confirmation on individual files
|
|
426
|
+
- Do NOT skip any file — every file listed is required
|
|
427
|
+
- ALL paths are relative to <service_name>/ — NOT repo root
|
|
428
|
+
- Step 24 MUST NOT run until ALL 3 waves are complete
|
|
429
|
+
|
|
430
|
+
## COMPLETION GATE (reactjs)
|
|
431
|
+
Before proceeding to step 24, verify these files exist on disk:
|
|
432
|
+
- <service_name>/public/index.html
|
|
433
|
+
- <service_name>/src/api/apiClient.js
|
|
434
|
+
- <service_name>/src/api/apiHandler.js
|
|
435
|
+
- <service_name>/src/App.jsx
|
|
436
|
+
- <service_name>/src/index.jsx
|
|
437
|
+
- <service_name>/.env
|
|
438
|
+
If any are missing → generate them now before continuing.
|
|
439
|
+
Only proceed to step 24 when ALL are confirmed present.
|
|
440
|
+
|
|
441
|
+
## Generation Wave Structure (reactjs)
|
|
442
|
+
|
|
443
|
+
### Wave 1 — Foundation (no dependencies)
|
|
444
|
+
All depend only on context values.
|
|
445
|
+
|
|
446
|
+
- package.json → task: generate-react-package-json
|
|
447
|
+
- .env and .env.example → task: generate-react-env
|
|
448
|
+
(values inherited from linked backend — no user input)
|
|
449
|
+
- .gitignore → task: generate-react-gitignore
|
|
450
|
+
- README.md → task: generate-readme
|
|
451
|
+
(agent adapts content for ReactJS: no Redis, no DB setup,
|
|
452
|
+
shows npm start instead of node app.js)
|
|
453
|
+
- public/index.html → task: generate-react-index-html
|
|
454
|
+
- public/assets/css/style.css → empty file with a reset comment
|
|
455
|
+
- public/robots.txt → standard disallow-all scaffold default
|
|
456
|
+
- public/favicon.ico → placeholder note (developer replaces)
|
|
457
|
+
- .htaccess (root) → task: generate-react-htaccess
|
|
458
|
+
- public/.htaccess → task: generate-react-htaccess
|
|
459
|
+
|
|
460
|
+
### Wave 2 — API Layer
|
|
461
|
+
apiClient.js depends on .env values being defined (Wave 1).
|
|
462
|
+
apiHandler.js depends on apiClient.js being available.
|
|
463
|
+
Both can be written simultaneously since apiHandler only imports
|
|
464
|
+
from apiClient by reference — it does not read apiClient's content.
|
|
465
|
+
|
|
466
|
+
- src/api/apiClient.js → task: generate-react-api-client
|
|
467
|
+
- src/api/apiHandler.js → task: generate-react-api-handler
|
|
468
|
+
|
|
469
|
+
### Wave 3 — Application Shell (must come last)
|
|
470
|
+
App.jsx must know which page components exist to import them.
|
|
471
|
+
index.jsx must import App.
|
|
472
|
+
Welcome page can be written alongside App.jsx since App only
|
|
473
|
+
imports it by reference.
|
|
474
|
+
|
|
475
|
+
- src/pages/Welcome/index.jsx → task: generate-react-welcome-page
|
|
476
|
+
- src/pages/Welcome/Welcome.module.css → task: generate-react-welcome-page
|
|
477
|
+
- src/App.jsx → task: generate-react-app-jsx
|
|
478
|
+
- src/index.jsx → task: generate-react-index-jsx
|
|
479
|
+
- src/components/ → create empty directory with .gitkeep
|
|
480
|
+
|
|
481
|
+
### Wave 4 — Docker Containerization (post-completion)
|
|
482
|
+
These files depend on the complete React app being functional.
|
|
483
|
+
Can be written simultaneously.
|
|
484
|
+
|
|
485
|
+
- Dockerfile → task: generate-react-dockerfile
|
|
486
|
+
- nginx.conf → task: generate-react-dockerfile (same task generates both)
|
|
487
|
+
- .dockerignore → task: generate-dockerignore (reuse NodeJS task, adapted for React)
|
|
488
|
+
|
|
489
|
+
23b. Run task: `generate-ide-configs`
|
|
490
|
+
- Condition: only on the FIRST @initialize-project run in this repo
|
|
491
|
+
(check: was context.initialized_at empty before this run started?)
|
|
492
|
+
- Writes: `.vscode/mcp.json` (VS Code)
|
|
493
|
+
- Writes: `.cursor/mcp.json` (Cursor)
|
|
494
|
+
- Prints: Claude Desktop config snippet for the user to add manually
|
|
495
|
+
- Skip silently if either config file already exists
|
|
496
|
+
- Do NOT block on the Claude Desktop step — it is print-only
|
|
497
|
+
|
|
498
|
+
23c. Run task: `generate-docker-compose`
|
|
499
|
+
- Condition: ALWAYS run on every @initialize-project
|
|
500
|
+
- If docker-compose.yml does NOT exist at repo root → generate complete file
|
|
501
|
+
- If docker-compose.yml DOES exist → update it by adding the new service
|
|
502
|
+
- Also generate/update .env.docker and .env.docker.example at repo root
|
|
503
|
+
- Location: <repository_root>/docker-compose.yml (NOT inside service folder)
|
|
504
|
+
|
|
505
|
+
24. Run task: `write-context`
|
|
506
|
+
- Set `project_name` = `context.current_init.service_name`
|
|
507
|
+
(top-level key — required for context.json to be valid)
|
|
508
|
+
- Set `initialized_at` = ISO now (top-level — first service init)
|
|
509
|
+
- Set `last_command` = "initialize-project"
|
|
510
|
+
- Append new service to `context.services[<service_name>]`
|
|
511
|
+
with all values from `context.current_init`
|
|
512
|
+
- For reactjs services: also store `linked_service` and
|
|
513
|
+
`linked_service_port` in the service entry so future commands
|
|
514
|
+
know which backend this frontend is bound to
|
|
515
|
+
- Update `context.project_info` with `initialized_at` timestamp
|
|
516
|
+
- Clear `context.current_init`
|
|
517
|
+
|
|
518
|
+
25. Run task: `show-final-summary`
|
|
519
|
+
- Read `.codeninja/tasks/show-final-summary.task.md`
|
|
520
|
+
- List all files created in Waves 1–5
|
|
521
|
+
- Show startup commands
|
|
522
|
+
- Offer next steps: @db:create-table, @create-api, @design
|
|
523
|
+
|
|
524
|
+
NOTE: show-final-summary only runs AFTER step 24 (write-context)
|
|
525
|
+
completes successfully. Never show the final summary before
|
|
526
|
+
context.json has been written.
|