@maka/maka-cli 5.1.40 → 5.1.42
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/.claude/codebase-overview.md +736 -0
- package/.claude/settings.local.json +17 -0
- package/bundle/typescript/package.json +8 -2
- package/bundle/typescript/src/commands/_index.d.ts +1 -1
- package/bundle/typescript/src/commands/_index.js +1 -1
- package/bundle/typescript/src/commands/_index.js.map +1 -1
- package/bundle/typescript/src/commands/ai/_index.d.ts +2 -0
- package/bundle/typescript/src/commands/ai/_index.js +3 -0
- package/bundle/typescript/src/commands/ai/_index.js.map +1 -0
- package/bundle/typescript/src/commands/ai/ai.command.d.ts +3 -0
- package/bundle/typescript/src/commands/{ai.js → ai/ai.command.js} +9 -7
- package/bundle/typescript/src/commands/ai/ai.command.js.map +1 -0
- package/bundle/typescript/src/commands/ai/mcp.sub.cmd.js +605 -0
- package/bundle/typescript/src/commands/ai/mcp.sub.cmd.js.map +1 -0
- package/bundle/typescript/src/commands/aws/cecr.sub.cmd.js +3 -1
- package/bundle/typescript/src/commands/aws/cecr.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/aws/lecr.sub.cmd.js +3 -1
- package/bundle/typescript/src/commands/aws/lecr.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/build/build.js +7 -1
- package/bundle/typescript/src/commands/build/build.js.map +1 -1
- package/bundle/typescript/src/commands/create.js +171 -36
- package/bundle/typescript/src/commands/create.js.map +1 -1
- package/bundle/typescript/src/commands/debug.js +20 -1
- package/bundle/typescript/src/commands/debug.js.map +1 -1
- package/bundle/typescript/src/commands/deploy/galaxy.sub.cmd.js +38 -8
- package/bundle/typescript/src/commands/deploy/galaxy.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/deploy/ubuntu.sub.cmd.js +47 -10
- package/bundle/typescript/src/commands/deploy/ubuntu.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/get/whoami.sub.cmd.js +3 -1
- package/bundle/typescript/src/commands/get/whoami.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/lint.js +4 -1
- package/bundle/typescript/src/commands/lint.js.map +1 -1
- package/bundle/typescript/src/commands/login.js +9 -1
- package/bundle/typescript/src/commands/login.js.map +1 -1
- package/bundle/typescript/src/commands/logout.js +3 -1
- package/bundle/typescript/src/commands/logout.js.map +1 -1
- package/bundle/typescript/src/commands/logs.js +3 -1
- package/bundle/typescript/src/commands/logs.js.map +1 -1
- package/bundle/typescript/src/commands/proxy.js +6 -1
- package/bundle/typescript/src/commands/proxy.js.map +1 -1
- package/bundle/typescript/src/commands/reconfig.js +1 -1
- package/bundle/typescript/src/commands/reconfig.js.map +1 -1
- package/bundle/typescript/src/commands/register.js +4 -1
- package/bundle/typescript/src/commands/register.js.map +1 -1
- package/bundle/typescript/src/commands/run/docker.sub.cmd.js +3 -1
- package/bundle/typescript/src/commands/run/docker.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/run/run.command.js +59 -12
- package/bundle/typescript/src/commands/run/run.command.js.map +1 -1
- package/bundle/typescript/src/commands/ssh.js +4 -1
- package/bundle/typescript/src/commands/ssh.js.map +1 -1
- package/bundle/typescript/src/commands/ssl.js +4 -1
- package/bundle/typescript/src/commands/ssl.js.map +1 -1
- package/bundle/typescript/src/commands/testCmd/mocha.sub.cmd.js +10 -10
- package/bundle/typescript/src/commands/testCmd/mocha.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/version/use.sub.cmd.js +15 -3
- package/bundle/typescript/src/commands/version/use.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/version/version.js +3 -1
- package/bundle/typescript/src/commands/version/version.js.map +1 -1
- package/bundle/typescript/src/generators/api.js +61 -9
- package/bundle/typescript/src/generators/api.js.map +1 -1
- package/bundle/typescript/src/generators/aws/cloudformation/cloudformation.js +1 -1
- package/bundle/typescript/src/generators/aws/cloudformation/cloudformation.js.map +1 -1
- package/bundle/typescript/src/generators/aws/cloudformation/create-ec2-instance.cf.gen.js +6 -3
- package/bundle/typescript/src/generators/aws/cloudformation/create-ec2-instance.cf.gen.js.map +1 -1
- package/bundle/typescript/src/generators/collection.js +8 -1
- package/bundle/typescript/src/generators/collection.js.map +1 -1
- package/bundle/typescript/src/generators/component.js +4 -1
- package/bundle/typescript/src/generators/component.js.map +1 -1
- package/bundle/typescript/src/generators/config.js +5 -1
- package/bundle/typescript/src/generators/config.js.map +1 -1
- package/bundle/typescript/src/generators/dbc.js +4 -1
- package/bundle/typescript/src/generators/dbc.js.map +1 -1
- package/bundle/typescript/src/generators/hook.js +3 -1
- package/bundle/typescript/src/generators/hook.js.map +1 -1
- package/bundle/typescript/src/generators/kits/_index.d.ts +1 -0
- package/bundle/typescript/src/generators/kits/_index.js +1 -0
- package/bundle/typescript/src/generators/kits/_index.js.map +1 -1
- package/bundle/typescript/src/generators/kits/auth/auth.generator.js +1 -1
- package/bundle/typescript/src/generators/kits/auth/auth.generator.js.map +1 -1
- package/bundle/typescript/src/generators/kits/auth/basic-meteor.auth.gen.js +5 -1
- package/bundle/typescript/src/generators/kits/auth/basic-meteor.auth.gen.js.map +1 -1
- package/bundle/typescript/src/generators/kits/auth/provider.auth.gen.js +5 -1
- package/bundle/typescript/src/generators/kits/auth/provider.auth.gen.js.map +1 -1
- package/bundle/typescript/src/generators/kits/esri/esri.generator.js +1 -1
- package/bundle/typescript/src/generators/kits/esri/esri.generator.js.map +1 -1
- package/bundle/typescript/src/generators/kits/esri/map.esri.gen.js +1 -1
- package/bundle/typescript/src/generators/kits/esri/map.esri.gen.js.map +1 -1
- package/bundle/typescript/src/generators/kits/frames/_index.d.ts +1 -0
- package/bundle/typescript/src/generators/kits/frames/_index.js +2 -0
- package/bundle/typescript/src/generators/kits/frames/_index.js.map +1 -0
- package/bundle/typescript/src/generators/kits/frames/frames.generator.d.ts +3 -0
- package/bundle/typescript/src/generators/kits/frames/frames.generator.js +163 -0
- package/bundle/typescript/src/generators/kits/frames/frames.generator.js.map +1 -0
- package/bundle/typescript/src/generators/kits/mui/auth.mui.gen.js +33 -14
- package/bundle/typescript/src/generators/kits/mui/auth.mui.gen.js.map +1 -1
- package/bundle/typescript/src/generators/kits/mui/frame.mui.gen.js +26 -6
- package/bundle/typescript/src/generators/kits/mui/frame.mui.gen.js.map +1 -1
- package/bundle/typescript/src/generators/kits/mui/mui.generator.js +19 -10
- package/bundle/typescript/src/generators/kits/mui/mui.generator.js.map +1 -1
- package/bundle/typescript/src/generators/layout.js +8 -2
- package/bundle/typescript/src/generators/layout.js.map +1 -1
- package/bundle/typescript/src/generators/methods.js +4 -1
- package/bundle/typescript/src/generators/methods.js.map +1 -1
- package/bundle/typescript/src/generators/package.js +7 -2
- package/bundle/typescript/src/generators/package.js.map +1 -1
- package/bundle/typescript/src/generators/page.js +6 -2
- package/bundle/typescript/src/generators/page.js.map +1 -1
- package/bundle/typescript/src/generators/publish.js +5 -1
- package/bundle/typescript/src/generators/publish.js.map +1 -1
- package/bundle/typescript/src/generators/route.js +4 -2
- package/bundle/typescript/src/generators/route.js.map +1 -1
- package/bundle/typescript/src/templates/meteor/template/template-tests.js.jsx +2 -2
- package/bundle/typescript/src/templates/meteor/template/template-tests.js.tsx +2 -2
- package/bundle/typescript/src/templates/meteor/template/template.js.jsx +2 -2
- package/bundle/typescript/src/templates/meteor/template/template.js.tsx +2 -2
- package/bundle/typescript/src/templates/react/hook/hook.js.jsx +1 -1
- package/bundle/typescript/src/templates/react/kit/auth/service/meteor-auth-service.js.jsx +4 -2
- package/bundle/typescript/src/templates/react/kit/frames/frames-demo.css +63 -0
- package/bundle/typescript/src/templates/react/kit/frames/frames-demo.jsx +153 -0
- package/bundle/typescript/src/templates/react/kit/frames/frames-demo.tsx +164 -0
- package/bundle/typescript/src/templates/react/kit/frames/workspace-manager.css +105 -0
- package/bundle/typescript/src/templates/react/kit/frames/workspace-manager.jsx +158 -0
- package/bundle/typescript/src/templates/react/kit/frames/workspace-manager.tsx +166 -0
- package/bundle/typescript/src/templates/react/kit/mui/auth/login/basic-login-page.js.jsx +3 -1
- package/bundle/typescript/src/templates/react/kit/mui/auth/login/basic-login-page.js.tsx +3 -1
- package/bundle/typescript/src/templates/react/test/test.js.jsx +2 -2
- package/bundle/typescript/src/templates/react/test/test.js.tsx +2 -2
- package/bundle/typescript/src/tools/fsi/fsi.interfaces.d.ts +3 -0
- package/bundle/typescript/src/tools/fsi/fsi.interfaces.js +3 -1
- package/bundle/typescript/src/tools/fsi/fsi.interfaces.js.map +1 -1
- package/docs/MCP_SERVER.md +396 -0
- package/package.json +8 -2
- package/bundle/typescript/src/commands/ai.js.map +0 -1
- /package/bundle/typescript/src/commands/{ai.d.ts → ai/mcp.sub.cmd.d.ts} +0 -0
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
# Maka-CLI Codebase Overview
|
|
2
|
+
|
|
3
|
+
**Version**: 5.1.40
|
|
4
|
+
**Package**: @maka/maka-cli
|
|
5
|
+
**Purpose**: Command-line scaffolding and DevOps tool for MeteorJS applications
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
maka create KickTiresApp
|
|
11
|
+
cd KickTiresApp
|
|
12
|
+
maka run
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Architecture Overview
|
|
16
|
+
|
|
17
|
+
### Entry Points
|
|
18
|
+
|
|
19
|
+
1. **src/exec.js** - Binary executable entry point
|
|
20
|
+
2. **src/maka.ts** - Main application entry
|
|
21
|
+
- Parses CLI arguments with `minimist`
|
|
22
|
+
- Sets Node.js memory limits based on system RAM
|
|
23
|
+
- Routes to main Maka command handler
|
|
24
|
+
|
|
25
|
+
### Core Class Hierarchy
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Tool (src/tool.ts:60)
|
|
29
|
+
├── Command (src/command.ts:57)
|
|
30
|
+
└── Generator (src/generator.ts:65)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Tool Class
|
|
34
|
+
Base class providing shared utilities:
|
|
35
|
+
- `docker` - Docker operations
|
|
36
|
+
- `fsi` - File system interface (FSI)
|
|
37
|
+
- `cfg` - Configuration management
|
|
38
|
+
- `mpi` - Meteor package interface
|
|
39
|
+
- `pkg` - Package management
|
|
40
|
+
- `aws` - AWS SDK integration
|
|
41
|
+
- `scaffold` - Template-based scaffolding
|
|
42
|
+
|
|
43
|
+
Key methods:
|
|
44
|
+
- `validateMakaProject()` - Check if in Maka project
|
|
45
|
+
- `validateMeteorInstall()` - Check Meteor installation
|
|
46
|
+
- `validateParams()` - Validate arguments and options
|
|
47
|
+
- `match()` - Match command/generator names and aliases
|
|
48
|
+
|
|
49
|
+
#### Command Class
|
|
50
|
+
Handles CLI commands with:
|
|
51
|
+
- Sub-command support
|
|
52
|
+
- Validation pipeline
|
|
53
|
+
- Help text generation
|
|
54
|
+
- Error handling
|
|
55
|
+
- Usage examples
|
|
56
|
+
|
|
57
|
+
Key methods:
|
|
58
|
+
- `run()` - Execute command
|
|
59
|
+
- `invoke()` - Internal execution with validation
|
|
60
|
+
- `processAndRunCommand()` - Route to sub-commands
|
|
61
|
+
|
|
62
|
+
#### Generator Class
|
|
63
|
+
Code generation with:
|
|
64
|
+
- Transaction history (`.maka/history.json`)
|
|
65
|
+
- Undo functionality
|
|
66
|
+
- Template rendering
|
|
67
|
+
- Resource naming
|
|
68
|
+
|
|
69
|
+
Key methods:
|
|
70
|
+
- `invoke()` - Execute generator with validation
|
|
71
|
+
- `addToHistory()` - Track operations for undo
|
|
72
|
+
- `undo()` - Rollback operations
|
|
73
|
+
- `processAndRunGenerator()` - Route to sub-generators
|
|
74
|
+
|
|
75
|
+
## Commands (src/commands/)
|
|
76
|
+
|
|
77
|
+
### Core Commands
|
|
78
|
+
|
|
79
|
+
| Command | File | Description |
|
|
80
|
+
|---------|------|-------------|
|
|
81
|
+
| `create` | create.ts | Scaffold new Meteor applications |
|
|
82
|
+
| `run` | run/ | Run application with configurations |
|
|
83
|
+
| `build` | build/ | Build application |
|
|
84
|
+
| `generate` | generate.ts | Code generation dispatcher |
|
|
85
|
+
| `install` | install.ts | Install packages/tools |
|
|
86
|
+
| `uninstall` | uninstall.ts | Remove packages/tools |
|
|
87
|
+
| `help` | help.ts | Display help information |
|
|
88
|
+
|
|
89
|
+
### DevOps Commands
|
|
90
|
+
|
|
91
|
+
| Command | File | Description |
|
|
92
|
+
|---------|------|-------------|
|
|
93
|
+
| `deploy` | deploy/ | Deployment utilities |
|
|
94
|
+
| `proxy` | proxy.ts | HTTP proxy server |
|
|
95
|
+
| `ssl` | ssl.ts | SSL certificate management |
|
|
96
|
+
| `ssh` | ssh.ts | SSH operations |
|
|
97
|
+
| `docker` | - | Docker operations (via tool) |
|
|
98
|
+
|
|
99
|
+
### AWS Commands (aws/)
|
|
100
|
+
|
|
101
|
+
- EC2 instance management
|
|
102
|
+
- ECR registry operations
|
|
103
|
+
- Route 53 DNS management
|
|
104
|
+
- CloudFormation stack deployment
|
|
105
|
+
|
|
106
|
+
### Development Commands
|
|
107
|
+
|
|
108
|
+
| Command | File | Description |
|
|
109
|
+
|---------|------|-------------|
|
|
110
|
+
| `debug` | debug.ts | Debug utilities |
|
|
111
|
+
| `lint` | lint.ts | Code linting |
|
|
112
|
+
| `jsdoc` | jsdoc.ts | Generate JSDoc |
|
|
113
|
+
| `logs` | logs.ts | View application logs |
|
|
114
|
+
| `reconfig` | reconfig.ts | Reconfigure project |
|
|
115
|
+
|
|
116
|
+
### User Commands
|
|
117
|
+
|
|
118
|
+
| Command | File | Description |
|
|
119
|
+
|---------|------|-------------|
|
|
120
|
+
| `login` | login.ts | User authentication |
|
|
121
|
+
| `logout` | logout.ts | End user session |
|
|
122
|
+
| `register` | register.ts | User registration |
|
|
123
|
+
| `profile` | profile.ts | User profile management |
|
|
124
|
+
|
|
125
|
+
### Utility Commands
|
|
126
|
+
|
|
127
|
+
| Command | File | Description |
|
|
128
|
+
|---------|------|-------------|
|
|
129
|
+
| `undo` | undo.ts | Undo last operation |
|
|
130
|
+
| `version` | version/ | Version information |
|
|
131
|
+
| `murder` | murder.ts | Kill processes |
|
|
132
|
+
| `ai` / `mcp` | ai.ts | MCP server for AI assistant integration |
|
|
133
|
+
| `game` | game/ | Interactive game features |
|
|
134
|
+
|
|
135
|
+
## Generators (src/generators/)
|
|
136
|
+
|
|
137
|
+
### Core Generators
|
|
138
|
+
|
|
139
|
+
| Generator | File | Description |
|
|
140
|
+
|-----------|------|-------------|
|
|
141
|
+
| `g:api` | api.ts | REST/GraphQL API endpoints |
|
|
142
|
+
| `g:collection` | collection.ts | MongoDB collections |
|
|
143
|
+
| `g:component` | component.ts | React components |
|
|
144
|
+
| `g:page` | page.ts | Full pages with routing |
|
|
145
|
+
| `g:route` | route.ts | Route definitions |
|
|
146
|
+
| `g:layout` | layout.ts | Layout components |
|
|
147
|
+
| `g:hook` | hook.ts | React hooks |
|
|
148
|
+
| `g:publish` | publish.ts | Meteor publications |
|
|
149
|
+
| `g:methods` | methods.ts | Meteor methods |
|
|
150
|
+
| `g:package` | package.ts | Meteor packages |
|
|
151
|
+
| `g:config` | config.ts | Environment configurations |
|
|
152
|
+
| `g:dbc` | dbc.ts | Database configurations |
|
|
153
|
+
| `g:dockerfile` | dockerfile.ts | Docker configurations |
|
|
154
|
+
|
|
155
|
+
### AWS Generators (aws/)
|
|
156
|
+
|
|
157
|
+
- Infrastructure as code templates
|
|
158
|
+
- CloudFormation stacks
|
|
159
|
+
- Service configurations
|
|
160
|
+
|
|
161
|
+
### Service Generators (services/)
|
|
162
|
+
|
|
163
|
+
- Microservice scaffolding
|
|
164
|
+
- API service templates
|
|
165
|
+
- Test configurations
|
|
166
|
+
|
|
167
|
+
## Tools & Utilities (src/tools/)
|
|
168
|
+
|
|
169
|
+
### File System Interface (fsi/)
|
|
170
|
+
|
|
171
|
+
**Class**: `FSI` (Singleton)
|
|
172
|
+
**Purpose**: Project-aware file system operations
|
|
173
|
+
|
|
174
|
+
Key methods:
|
|
175
|
+
- `findProjectDirectory()` - Locate project root
|
|
176
|
+
- `pathFromProject()` - Resolve paths from project root
|
|
177
|
+
- `ensureDir()` - Create directories safely
|
|
178
|
+
- `readFile()` / `writeFile()` - File I/O
|
|
179
|
+
- `exists()` - Check file existence
|
|
180
|
+
- `deepen()` - Deep copy/transform objects
|
|
181
|
+
|
|
182
|
+
### Configuration (cfg/)
|
|
183
|
+
|
|
184
|
+
**Class**: `CFG` (Singleton)
|
|
185
|
+
**Purpose**: Manage global and project configurations
|
|
186
|
+
|
|
187
|
+
Key methods:
|
|
188
|
+
- `getGlobalConfig()` - User-wide settings
|
|
189
|
+
- `getMakaProjectConfig()` - Project settings
|
|
190
|
+
- `getAppProjectConfigs()` - Environment configs
|
|
191
|
+
- `setConfig()` - Update configuration
|
|
192
|
+
- `initializeGlobalConfig()` - First-time setup
|
|
193
|
+
|
|
194
|
+
Configuration locations:
|
|
195
|
+
- Global: `~/.maka/global-config.json`
|
|
196
|
+
- Project: `.maka/config.json`
|
|
197
|
+
- Environments: `.maka/config-{env}.json`
|
|
198
|
+
|
|
199
|
+
### Meteor Package Interface (mpi/)
|
|
200
|
+
|
|
201
|
+
**Class**: `MPI` (Singleton)
|
|
202
|
+
**Purpose**: Interact with Meteor CLI and packages
|
|
203
|
+
|
|
204
|
+
Key methods:
|
|
205
|
+
- `meteorVersion()` - Get Meteor version
|
|
206
|
+
- `maybeProxyCommandToMeteor()` - Pass-through to Meteor
|
|
207
|
+
- `installPackage()` - Add Meteor package
|
|
208
|
+
- `removePackage()` - Remove Meteor package
|
|
209
|
+
|
|
210
|
+
### Package Management (pkg/)
|
|
211
|
+
|
|
212
|
+
**Class**: `PKG` (Singleton)
|
|
213
|
+
**Purpose**: npm/package.json operations
|
|
214
|
+
|
|
215
|
+
Key methods:
|
|
216
|
+
- `getPackageJson()` - Read package.json
|
|
217
|
+
- `updatePackageJson()` - Modify package.json
|
|
218
|
+
- `installDependencies()` - Run npm install
|
|
219
|
+
- `addDependency()` - Add to dependencies
|
|
220
|
+
- `addDevDependency()` - Add to devDependencies
|
|
221
|
+
|
|
222
|
+
### AWS Integration (aws/)
|
|
223
|
+
|
|
224
|
+
**Class**: `AWS` (Singleton)
|
|
225
|
+
**Purpose**: AWS SDK operations
|
|
226
|
+
|
|
227
|
+
Services:
|
|
228
|
+
- EC2 - Instance management
|
|
229
|
+
- ECR - Container registry
|
|
230
|
+
- Route 53 - DNS management
|
|
231
|
+
- Route 53 Domains - Domain registration
|
|
232
|
+
|
|
233
|
+
### Docker (docker/)
|
|
234
|
+
|
|
235
|
+
**Class**: `Docker`
|
|
236
|
+
**Purpose**: Docker container and image operations
|
|
237
|
+
|
|
238
|
+
Key methods:
|
|
239
|
+
- `build()` - Build Docker images
|
|
240
|
+
- `run()` - Run containers
|
|
241
|
+
- `compose()` - Docker Compose operations
|
|
242
|
+
- `exec()` - Execute in container
|
|
243
|
+
|
|
244
|
+
### SSH (ssh/)
|
|
245
|
+
|
|
246
|
+
**Class**: `SSH`
|
|
247
|
+
**Purpose**: SSH connection and operations
|
|
248
|
+
|
|
249
|
+
Key methods:
|
|
250
|
+
- `connect()` - Establish SSH connection
|
|
251
|
+
- `exec()` - Execute remote commands
|
|
252
|
+
- `uploadFile()` - SCP file upload
|
|
253
|
+
- `downloadFile()` - SCP file download
|
|
254
|
+
|
|
255
|
+
### SSL (ssl/)
|
|
256
|
+
|
|
257
|
+
**Class**: `SSL`
|
|
258
|
+
**Purpose**: SSL certificate generation
|
|
259
|
+
|
|
260
|
+
Key methods:
|
|
261
|
+
- `generateSelfSigned()` - Self-signed certificates
|
|
262
|
+
- `generateCSR()` - Certificate signing request
|
|
263
|
+
- Uses `node-forge` for cryptography
|
|
264
|
+
|
|
265
|
+
### Scaffolding (scaffold/)
|
|
266
|
+
|
|
267
|
+
**Class**: `Scaffold` (Singleton)
|
|
268
|
+
**Purpose**: Template-based code generation
|
|
269
|
+
|
|
270
|
+
Key methods:
|
|
271
|
+
- `template()` - Process EJS template
|
|
272
|
+
- `copy()` - Copy template files
|
|
273
|
+
- `createDir()` - Create directory structure
|
|
274
|
+
- `render()` - Render template with data
|
|
275
|
+
|
|
276
|
+
Template locations: `src/templates/`
|
|
277
|
+
|
|
278
|
+
### Actions (actions/)
|
|
279
|
+
|
|
280
|
+
**Class**: `Actions`
|
|
281
|
+
**Purpose**: User interaction and prompts
|
|
282
|
+
|
|
283
|
+
Key methods:
|
|
284
|
+
- `ask()` - Text input
|
|
285
|
+
- `confirm()` - Yes/no confirmation
|
|
286
|
+
- `select()` - Selection from list
|
|
287
|
+
- `multiSelect()` - Multiple selections
|
|
288
|
+
- Uses `@inquirer/prompts`
|
|
289
|
+
|
|
290
|
+
### Logging (log/)
|
|
291
|
+
|
|
292
|
+
**Class**: `Log`
|
|
293
|
+
**Purpose**: Colored terminal output
|
|
294
|
+
|
|
295
|
+
Methods:
|
|
296
|
+
- `error()` - Red error messages
|
|
297
|
+
- `warn()` - Yellow warnings
|
|
298
|
+
- `success()` - Green success messages
|
|
299
|
+
- `info()` - Informational messages
|
|
300
|
+
- `notice()` - Important notices
|
|
301
|
+
- `header()` - Section headers
|
|
302
|
+
- `bright()` - Bright text
|
|
303
|
+
- `usage()` - Command usage info
|
|
304
|
+
|
|
305
|
+
Features:
|
|
306
|
+
- Light/dark mode support
|
|
307
|
+
- Color customization
|
|
308
|
+
- Uses `cli-color`
|
|
309
|
+
|
|
310
|
+
### Spawn Async (spawn-async/)
|
|
311
|
+
|
|
312
|
+
**Class**: `SpawnAsync`
|
|
313
|
+
**Purpose**: Asynchronous process execution
|
|
314
|
+
|
|
315
|
+
Key methods:
|
|
316
|
+
- `spawn()` - Execute command
|
|
317
|
+
- `spawnPromise()` - Promise-based execution
|
|
318
|
+
- Stream handling for stdout/stderr
|
|
319
|
+
- Exit code handling
|
|
320
|
+
|
|
321
|
+
### Progress (progress/)
|
|
322
|
+
|
|
323
|
+
**Class**: `Progress`
|
|
324
|
+
**Purpose**: Terminal progress indicators
|
|
325
|
+
|
|
326
|
+
Features:
|
|
327
|
+
- Spinner animations
|
|
328
|
+
- Progress bars
|
|
329
|
+
- Status messages
|
|
330
|
+
- Uses `elegant-spinner` and `single-line-log2`
|
|
331
|
+
|
|
332
|
+
### MCP (mcp/)
|
|
333
|
+
|
|
334
|
+
**Class**: `MCP`
|
|
335
|
+
**Purpose**: Model Context Protocol server for AI assistant integration
|
|
336
|
+
|
|
337
|
+
Key methods:
|
|
338
|
+
- `start()` - Start MCP server with stdio transport
|
|
339
|
+
- `stop()` - Stop MCP server
|
|
340
|
+
- `registerTool()` - Register custom MCP tools
|
|
341
|
+
- `registerResource()` - Register custom MCP resources
|
|
342
|
+
|
|
343
|
+
Features:
|
|
344
|
+
- Exposes Maka-CLI functionality to AI assistants (Claude Code, Claude Desktop, etc.)
|
|
345
|
+
- Standard mode: Read-only informational tools
|
|
346
|
+
- Advanced mode: Command execution and file operations
|
|
347
|
+
- Resources: Project config, project info, global config
|
|
348
|
+
- Uses `@modelcontextprotocol/sdk`
|
|
349
|
+
|
|
350
|
+
Tools (Standard Mode):
|
|
351
|
+
- `maka_list_generators` - List available generators
|
|
352
|
+
- `maka_list_commands` - List available commands
|
|
353
|
+
|
|
354
|
+
Tools (Advanced Mode):
|
|
355
|
+
- `maka_execute` - Execute any Maka command
|
|
356
|
+
- `maka_run_generator` - Run code generators
|
|
357
|
+
- `maka_read_file` - Read file contents
|
|
358
|
+
- `maka_list_directory` - List directory contents
|
|
359
|
+
|
|
360
|
+
Resources:
|
|
361
|
+
- `maka://config` - Project configuration
|
|
362
|
+
- `maka://project-info` - Project information
|
|
363
|
+
- `maka://global-config` - Global user configuration
|
|
364
|
+
|
|
365
|
+
Configuration file: `src/tools/mcp/`
|
|
366
|
+
Documentation: `MCP-README.md`
|
|
367
|
+
|
|
368
|
+
## Templates (src/templates/)
|
|
369
|
+
|
|
370
|
+
### Template Structure
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
src/templates/
|
|
374
|
+
├── meteor/ # Meteor-specific templates
|
|
375
|
+
│ ├── app/ # Application structure
|
|
376
|
+
│ ├── collection/ # MongoDB collections
|
|
377
|
+
│ ├── api/ # API endpoints
|
|
378
|
+
│ ├── publish/ # Publications
|
|
379
|
+
│ ├── method/ # Methods
|
|
380
|
+
│ ├── template/ # UI templates
|
|
381
|
+
│ ├── config/ # Configurations
|
|
382
|
+
│ ├── service/ # Services
|
|
383
|
+
│ ├── dbc/ # Database configs
|
|
384
|
+
│ └── package/ # Package structure
|
|
385
|
+
├── aws/ # AWS templates
|
|
386
|
+
│ └── cloudformation/
|
|
387
|
+
├── service/ # Service templates
|
|
388
|
+
│ ├── docker/ # Dockerfile templates
|
|
389
|
+
│ ├── test/ # Test templates
|
|
390
|
+
│ └── eslint/ # ESLint configs
|
|
391
|
+
└── [framework]/ # Framework-specific
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Template Format
|
|
395
|
+
|
|
396
|
+
Templates use EJS (Embedded JavaScript):
|
|
397
|
+
- Extension: `.ejs` or `.js.ts`
|
|
398
|
+
- Variables: `<%= varName %>`
|
|
399
|
+
- Logic: `<% if (condition) { %> ... <% } %>`
|
|
400
|
+
- Includes: `<%- include('partial') %>`
|
|
401
|
+
|
|
402
|
+
## Configuration Files
|
|
403
|
+
|
|
404
|
+
### Global Config (~/.maka/global-config.json)
|
|
405
|
+
|
|
406
|
+
```json
|
|
407
|
+
{
|
|
408
|
+
"pallet": "dark", // or "light"
|
|
409
|
+
"userId": "...",
|
|
410
|
+
"username": "...",
|
|
411
|
+
"token": "..."
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### Project Config (.maka/config.json)
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"name": "ProjectName",
|
|
420
|
+
"engines": {
|
|
421
|
+
"meteor": "2.x",
|
|
422
|
+
"node": ">=22.17.0"
|
|
423
|
+
},
|
|
424
|
+
"template": "react",
|
|
425
|
+
"features": [],
|
|
426
|
+
"ui": "material-ui"
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### History File (.maka/history.json)
|
|
431
|
+
|
|
432
|
+
Tracks generator operations for undo:
|
|
433
|
+
```json
|
|
434
|
+
[
|
|
435
|
+
{
|
|
436
|
+
"generatorName": "maka:generate:page",
|
|
437
|
+
"transactionId": "uuid",
|
|
438
|
+
"details": {
|
|
439
|
+
"success": true,
|
|
440
|
+
"params": { "args": [...], "opts": {...} }
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Max size: 100KB (auto-pruning)
|
|
447
|
+
|
|
448
|
+
## Command/Generator Options
|
|
449
|
+
|
|
450
|
+
### IOpts Interface (src/tool.ts:32)
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
{
|
|
454
|
+
name: string // Command/generator name
|
|
455
|
+
aliases?: string[] // Alternative names
|
|
456
|
+
usage?: string // Usage text
|
|
457
|
+
shortDesc: string // Brief description
|
|
458
|
+
description?: string // Full description
|
|
459
|
+
examples?: string[] // Usage examples
|
|
460
|
+
requiredOpts?: NamedParam[] // Required options
|
|
461
|
+
validOpts: NamedParam[] // Valid options
|
|
462
|
+
validArgs?: string[] // Valid arguments
|
|
463
|
+
resourceNameRequired?: boolean // Needs resource name
|
|
464
|
+
mustBeInMakaProject?: boolean // Project context required
|
|
465
|
+
mustHaveMeteorInstalled?: boolean // Meteor required
|
|
466
|
+
minArgLength?: number // Min arguments
|
|
467
|
+
maxArgLength?: number // Max arguments
|
|
468
|
+
minOptsLength?: number // Min options
|
|
469
|
+
maxOptsLength?: number // Max options
|
|
470
|
+
disableAuthCheck?: boolean // Skip auth
|
|
471
|
+
isRoot?: boolean // Root command
|
|
472
|
+
checkWhere?: boolean // Check where flag
|
|
473
|
+
isPro?: boolean // Pro feature
|
|
474
|
+
mustBeLoggedIn?: boolean // Login required
|
|
475
|
+
experimental?: boolean // Experimental feature
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### NamedParam Interface (src/tool.ts:23)
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
{
|
|
483
|
+
name: string // Option name
|
|
484
|
+
boolFlag?: boolean // Boolean flag
|
|
485
|
+
hidden?: boolean // Hidden from help
|
|
486
|
+
values?: string[] // Valid values
|
|
487
|
+
regex?: RegExp // Validation pattern
|
|
488
|
+
description?: string // Help text
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## Error Handling
|
|
493
|
+
|
|
494
|
+
### Custom Errors (src/error.js)
|
|
495
|
+
|
|
496
|
+
- `UsageError` - Incorrect usage
|
|
497
|
+
- `UsageErrorWithSubs` - Show sub-commands
|
|
498
|
+
- `MustBeInProjectError` - Not in Maka project
|
|
499
|
+
- `NoMeteorFoundError` - Meteor not installed
|
|
500
|
+
- `NoMeteorAppFoundError` - No Meteor app
|
|
501
|
+
- `MustBeLoggedIn` - Authentication required
|
|
502
|
+
|
|
503
|
+
### Error Flow
|
|
504
|
+
|
|
505
|
+
1. Error thrown in command/generator
|
|
506
|
+
2. Caught in `invoke()` method
|
|
507
|
+
3. Usage information displayed
|
|
508
|
+
4. Specific error message shown
|
|
509
|
+
5. Process exits with code 1
|
|
510
|
+
|
|
511
|
+
## Validation Pipeline
|
|
512
|
+
|
|
513
|
+
### Command Validation Order
|
|
514
|
+
|
|
515
|
+
1. Check if help requested → Show usage
|
|
516
|
+
2. Validate project context (if required)
|
|
517
|
+
3. Validate Meteor installation (if required)
|
|
518
|
+
4. Validate authentication (if required)
|
|
519
|
+
5. Check argument length
|
|
520
|
+
6. Check option length
|
|
521
|
+
7. Validate engine requirements
|
|
522
|
+
8. Validate parameters
|
|
523
|
+
9. Execute handler
|
|
524
|
+
|
|
525
|
+
### Generator Validation Order
|
|
526
|
+
|
|
527
|
+
1. Check if help requested → Show usage
|
|
528
|
+
2. Validate project context (if required)
|
|
529
|
+
3. Validate Meteor installation (if required)
|
|
530
|
+
4. Check argument/option lengths
|
|
531
|
+
5. Validate engine requirements
|
|
532
|
+
6. Validate parameters
|
|
533
|
+
7. Check resource name (if required)
|
|
534
|
+
8. Check `--where` flag (if required)
|
|
535
|
+
9. Execute handler
|
|
536
|
+
10. Add to history
|
|
537
|
+
|
|
538
|
+
## Build & Development
|
|
539
|
+
|
|
540
|
+
### Scripts (package.json:20-31)
|
|
541
|
+
|
|
542
|
+
- `npm run build` - Clean, compile TypeScript, copy templates
|
|
543
|
+
- `npm run develop` - Watch mode for development
|
|
544
|
+
- `npm run lint` - ESLint with auto-fix
|
|
545
|
+
- `npm run test` - Jest test suite
|
|
546
|
+
- `npm run prep` - Copy templates and resources
|
|
547
|
+
|
|
548
|
+
### Build Output
|
|
549
|
+
|
|
550
|
+
- Source: `src/`
|
|
551
|
+
- Output: `bundle/typescript/`
|
|
552
|
+
- Templates copied to: `bundle/typescript/src/templates/`
|
|
553
|
+
|
|
554
|
+
### TypeScript Configuration (tsconfig.json)
|
|
555
|
+
|
|
556
|
+
- Target: ES modules
|
|
557
|
+
- Module: ESNext
|
|
558
|
+
- Output: `bundle/typescript/`
|
|
559
|
+
- Source maps enabled
|
|
560
|
+
|
|
561
|
+
## Key Patterns & Conventions
|
|
562
|
+
|
|
563
|
+
### 1. Singleton Pattern
|
|
564
|
+
Used for shared utilities:
|
|
565
|
+
- `FSI.getInstance()`
|
|
566
|
+
- `CFG.getInstance(fsi)`
|
|
567
|
+
- `MPI.getInstance(fsi, cfg, pkg)`
|
|
568
|
+
- `AWS.getInstance(fsi, cfg, scaffold)`
|
|
569
|
+
- `Scaffold.getInstance(fsi, mpi)`
|
|
570
|
+
|
|
571
|
+
### 2. Factory Pattern
|
|
572
|
+
Command/Generator creation:
|
|
573
|
+
```typescript
|
|
574
|
+
Command.create(opts, handler, parent)
|
|
575
|
+
Generator.create(opts, handler, undoHandler, parent)
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### 3. Template Method Pattern
|
|
579
|
+
Base `Tool` class provides template methods:
|
|
580
|
+
- `validateMakaProject()`
|
|
581
|
+
- `validateParams()`
|
|
582
|
+
- Subclasses implement specific behavior
|
|
583
|
+
|
|
584
|
+
### 4. Chain of Responsibility
|
|
585
|
+
Command routing through hierarchy:
|
|
586
|
+
```
|
|
587
|
+
maka → command → sub-command → handler
|
|
588
|
+
maka:generate → generator → sub-generator → handler
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### 5. Transaction Pattern
|
|
592
|
+
Generator operations tracked with:
|
|
593
|
+
- Transaction ID (UUID)
|
|
594
|
+
- Operation details
|
|
595
|
+
- Undo handlers
|
|
596
|
+
- History persistence
|
|
597
|
+
|
|
598
|
+
## Testing
|
|
599
|
+
|
|
600
|
+
### Test Structure (test/)
|
|
601
|
+
|
|
602
|
+
- Integration tests
|
|
603
|
+
- Located in `test/integration/`
|
|
604
|
+
- Jest configuration: `jest.config.js`
|
|
605
|
+
- Coverage reports
|
|
606
|
+
|
|
607
|
+
### Running Tests
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
npm test
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## Dependencies Highlights
|
|
614
|
+
|
|
615
|
+
### Production
|
|
616
|
+
- `@aws-sdk/*` - AWS integrations
|
|
617
|
+
- `@inquirer/prompts` - Interactive CLI
|
|
618
|
+
- `blessed` - Terminal UI framework
|
|
619
|
+
- `cli-color` - ANSI colors
|
|
620
|
+
- `cli-table` - Table formatting
|
|
621
|
+
- `ejs` - Template engine
|
|
622
|
+
- `http-proxy` - Proxy server
|
|
623
|
+
- `node-forge` - Cryptography
|
|
624
|
+
- `minimist` - Argument parsing
|
|
625
|
+
- `semver` - Version handling
|
|
626
|
+
- `tar` - Archive operations
|
|
627
|
+
- `uuid` - Unique IDs
|
|
628
|
+
|
|
629
|
+
### Development
|
|
630
|
+
- `typescript` - Type system
|
|
631
|
+
- `jest` - Testing framework
|
|
632
|
+
- `eslint` - Linting
|
|
633
|
+
- `concurrently` - Parallel scripts
|
|
634
|
+
- `wait-on` - File watching
|
|
635
|
+
|
|
636
|
+
## Project Stats
|
|
637
|
+
|
|
638
|
+
- **Total Lines**: ~4,400 lines of TypeScript
|
|
639
|
+
- **Commands**: 32+
|
|
640
|
+
- **Generators**: 18+
|
|
641
|
+
- **Tools**: 15+
|
|
642
|
+
- **Templates**: 50+
|
|
643
|
+
- **Node Version**: >=22.17.0
|
|
644
|
+
- **License**: MIT
|
|
645
|
+
|
|
646
|
+
## Common Workflows
|
|
647
|
+
|
|
648
|
+
### Creating a New Command
|
|
649
|
+
|
|
650
|
+
1. Create file in `src/commands/`
|
|
651
|
+
2. Import Command class
|
|
652
|
+
3. Define options (IOpts)
|
|
653
|
+
4. Implement handler
|
|
654
|
+
5. Register in `src/commands/_index.ts`
|
|
655
|
+
|
|
656
|
+
Example:
|
|
657
|
+
```typescript
|
|
658
|
+
import { Command } from '../command.js';
|
|
659
|
+
|
|
660
|
+
const MyCmd = Command.create({
|
|
661
|
+
name: 'mycmd',
|
|
662
|
+
aliases: ['mc'],
|
|
663
|
+
shortDesc: 'My command',
|
|
664
|
+
validOpts: ['option1', 'option2'],
|
|
665
|
+
mustBeInMakaProject: true
|
|
666
|
+
}, async function(args, opts) {
|
|
667
|
+
// Implementation
|
|
668
|
+
});
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
### Creating a New Generator
|
|
672
|
+
|
|
673
|
+
1. Create file in `src/generators/`
|
|
674
|
+
2. Import Generator class
|
|
675
|
+
3. Define options (IOpts)
|
|
676
|
+
4. Implement handler and undo handler
|
|
677
|
+
5. Register in `src/generators/_index.ts`
|
|
678
|
+
|
|
679
|
+
Example:
|
|
680
|
+
```typescript
|
|
681
|
+
import { Generator } from '../generator.js';
|
|
682
|
+
|
|
683
|
+
const MyGen = Generator.create({
|
|
684
|
+
name: 'mytype',
|
|
685
|
+
aliases: ['mt'],
|
|
686
|
+
shortDesc: 'Generate my type',
|
|
687
|
+
validOpts: ['where'],
|
|
688
|
+
resourceNameRequired: true
|
|
689
|
+
},
|
|
690
|
+
async function(args, opts) {
|
|
691
|
+
// Generation logic
|
|
692
|
+
return { success: true };
|
|
693
|
+
},
|
|
694
|
+
async function(details) {
|
|
695
|
+
// Undo logic
|
|
696
|
+
});
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### Adding a Template
|
|
700
|
+
|
|
701
|
+
1. Create template in `src/templates/`
|
|
702
|
+
2. Use EJS syntax
|
|
703
|
+
3. Reference in generator
|
|
704
|
+
4. Update `prep` script if needed
|
|
705
|
+
|
|
706
|
+
## Useful File Locations
|
|
707
|
+
|
|
708
|
+
- Main entry: `src/maka.ts:1`
|
|
709
|
+
- Command base: `src/command.ts:57`
|
|
710
|
+
- Generator base: `src/generator.ts:65`
|
|
711
|
+
- Tool base: `src/tool.ts:60`
|
|
712
|
+
- Commands index: `src/commands/_index.ts`
|
|
713
|
+
- Generators index: `src/generators/_index.ts`
|
|
714
|
+
- Error definitions: `src/error.js`
|
|
715
|
+
- Global types: `src/global.d.ts`
|
|
716
|
+
|
|
717
|
+
## Development Tips
|
|
718
|
+
|
|
719
|
+
1. **Hot Reload**: Use `npm run develop` for watch mode
|
|
720
|
+
2. **Testing**: Command is `maka` after build
|
|
721
|
+
3. **Debugging**: Use `maka --debug` flag
|
|
722
|
+
4. **Templates**: Changes require rebuild
|
|
723
|
+
5. **History**: Check `.maka/history.json` for operation tracking
|
|
724
|
+
6. **Undo**: Use `maka undo` to reverse operations
|
|
725
|
+
|
|
726
|
+
## Known Limitations
|
|
727
|
+
|
|
728
|
+
- History file capped at 100KB
|
|
729
|
+
- Undo handlers not implemented for all generators
|
|
730
|
+
- Some commands hidden from help (murder, play)
|
|
731
|
+
- Experimental features may be unstable
|
|
732
|
+
|
|
733
|
+
---
|
|
734
|
+
|
|
735
|
+
*Last Updated: 2025-10-13*
|
|
736
|
+
*Maka-CLI Version: 5.1.40*
|