kimu-cli 1.3.0 → 1.3.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.
@@ -1,386 +1,386 @@
1
- # Getting Started with KIMU-CLI
2
-
3
- This guide will help you install KIMU-CLI and create your first KIMU application in just a few minutes.
4
-
5
- ## Prerequisites
6
-
7
- Before you begin, ensure you have:
8
- - **Node.js** >= 18.0.0 ([Download here](https://nodejs.org/))
9
- - **NPM** >= 8.0.0 (comes with Node.js)
10
- - A terminal/command prompt
11
-
12
- Check your versions:
13
- ```bash
14
- node --version
15
- npm --version
16
- ```
17
-
18
- ## Installation
19
-
20
- ### Option 1: Global Installation (Recommended)
21
-
22
- Install KIMU-CLI globally to use the `kimu` command anywhere:
23
-
24
- ```bash
25
- npm install -g kimu-cli
26
- ```
27
-
28
- Verify the installation:
29
- ```bash
30
- kimu --version
31
- # Output: 0.1.1 (or current version)
32
-
33
- kimu --help
34
- # Shows all available commands
35
- ```
36
-
37
- ### Option 2: Using npx (No Installation Required)
38
-
39
- You can use KIMU-CLI without installing it globally by using `npx`:
40
-
41
- ```bash
42
- npx kimu-cli create my-app
43
- ```
44
-
45
- This downloads and runs the latest version of KIMU-CLI temporarily.
46
-
47
- ## Creating Your First Project
48
-
49
- ### Step 1: Create a New Project
50
-
51
- ```bash
52
- kimu create my-first-app
53
- ```
54
-
55
- You'll be prompted to:
56
- - Confirm the project name
57
- - Choose whether to initialize git
58
- - Optionally select a template (coming soon)
59
-
60
- The CLI will:
61
- 1. Create a new folder `my-first-app/`
62
- 2. Initialize npm with `package.json`
63
- 3. Install `kimu-core` and copy all framework files
64
- 4. Install all dependencies
65
- 5. Generate configuration files
66
-
67
- ### Step 2: Navigate to Your Project
68
-
69
- ```bash
70
- cd my-first-app
71
- ```
72
-
73
- ### Step 3: Explore Your Project Structure
74
-
75
- ```
76
- my-first-app/
77
- ├── src/ # Source code
78
- │ ├── core/ # KIMU core framework files
79
- │ ├── extensions/ # Your custom extensions
80
- │ ├── modules/ # Modules (router, i18n, etc.)
81
- │ └── main.ts # Application entry point
82
- ├── public/ # Static assets
83
- ├── scripts/ # Build and utility scripts
84
- ├── dist/ # Build output
85
- ├── kimu.config.json # KIMU configuration
86
- ├── kimu-build-config.ts # Build configuration
87
- ├── package.json # NPM dependencies
88
- ├── tsconfig.json # TypeScript configuration
89
- ├── vite.config.ts # Vite bundler configuration
90
- └── README.md # Project documentation
91
- ```
92
-
93
- ### Step 4: Start Development Server
94
-
95
- ```bash
96
- npm run dev
97
- ```
98
-
99
- This will:
100
- - Start the Vite development server
101
- - Enable hot module replacement (HMR)
102
- - Open your app at `http://localhost:5173/`
103
-
104
- You should see your KIMU application running! 🎉
105
-
106
- ### Step 5: Make Your First Change
107
-
108
- Open `src/extensions/app-root/component.ts` and modify the `getData()` method:
109
-
110
- ```typescript
111
- getData() {
112
- return {
113
- title: 'My First KIMU App!', // Change this
114
- version: this.version,
115
- kimuLogo: this.getKimuLogo(),
116
- };
117
- }
118
- ```
119
-
120
- Save the file and watch the browser update automatically!
121
-
122
- ## Understanding Key Files
123
-
124
- ### `src/main.ts`
125
- The main entry point that initializes the KIMU application:
126
- ```typescript
127
- import { KimuApp } from './core/kimu-app';
128
- import { KimuExtensionManager } from './core/kimu-extension-manager';
129
-
130
- async function main() {
131
- const app = await KimuApp.getInstance();
132
- const extensionManager = KimuExtensionManager.getInstance();
133
-
134
- await extensionManager.init();
135
- await extensionManager.load('app-root');
136
- }
137
- ```
138
-
139
- ### `kimu.config.json`
140
- Project configuration file:
141
- ```json
142
- {
143
- "name": "my-first-app",
144
- "version": "1.0.0",
145
- "kimuCore": "^0.4.0",
146
- "modules": {
147
- "installed": [],
148
- "registry": "https://github.com/unicoverso/kimu-modules"
149
- },
150
- "extensions": {
151
- "installed": ["app-root"],
152
- "main": "app-root"
153
- }
154
- }
155
- ```
156
-
157
- ### `package.json`
158
- NPM package configuration with scripts:
159
- ```json
160
- {
161
- "scripts": {
162
- "dev": "vite",
163
- "build": "vite build",
164
- "preview": "vite preview",
165
- "lint": "eslint src/**/*.ts",
166
- "generate-config:dev": "node scripts/generate-build-config.js dev",
167
- "generate-config:prod": "node scripts/generate-build-config.js prod"
168
- }
169
- }
170
- ```
171
-
172
- ## Development Commands
173
-
174
- ### Start Development Server
175
- ```bash
176
- npm run dev
177
- ```
178
- - Hot reload enabled
179
- - Access at `http://localhost:5173/`
180
-
181
- ### Build for Production
182
- ```bash
183
- npm run build
184
- ```
185
- - Optimized production bundle
186
- - Output in `dist/` folder
187
-
188
- ### Preview Production Build
189
- ```bash
190
- npm run preview
191
- ```
192
- - Test production build locally
193
-
194
- ### Lint Your Code
195
- ```bash
196
- npm run lint
197
- ```
198
- - Check code quality with ESLint
199
-
200
- ## KIMU-CLI Commands
201
-
202
- ### Get Project Information
203
- ```bash
204
- kimu info
205
- ```
206
- Shows basic project details.
207
-
208
- ```bash
209
- kimu info --verbose
210
- ```
211
- Shows detailed information including dependencies and configuration.
212
-
213
- ### Check CLI Version
214
- ```bash
215
- kimu --version
216
- ```
217
- Shows KIMU-CLI version.
218
-
219
- ```bash
220
- kimu version --verbose
221
- ```
222
- Shows detailed version information including Node.js and platform.
223
-
224
- ### Get Help
225
- ```bash
226
- kimu --help
227
- ```
228
- Shows all available commands.
229
-
230
- ```bash
231
- kimu create --help
232
- ```
233
- Shows help for a specific command.
234
-
235
- ## Creating Extensions
236
-
237
- KIMU applications are built using extensions. Here's how to create your first extension:
238
-
239
- ### Using the CLI (Recommended)
240
-
241
- The easiest way is to use the `kimu new` command:
242
-
243
- ```bash
244
- # Create a new extension
245
- kimu new extension my-first-extension
246
- ```
247
-
248
- This automatically creates:
249
- - `component.ts` - Logic and lifecycle methods
250
- - `style.css` - Component styles
251
- - `view.html` - HTML template
252
- - Registers in `extension-manifest.json`
253
-
254
- ### Manual Creation
255
-
256
- Alternatively, create the structure manually:
257
-
258
- ### 1. Create Extension Folder
259
- ```bash
260
- mkdir -p src/extensions/my-first-extension
261
- ```
262
-
263
- ### 2. Create Required Files
264
- Each extension needs three files:
265
- - `component.ts` - Logic and data
266
- - `style.css` - Styles
267
- - `view.html` - Template
268
-
269
- Example `component.ts`:
270
- ```typescript
271
- import { KimuComponent } from '../../core/kimu-component';
272
- import { KimuComponentElement } from '../../core/kimu-component-element';
273
-
274
- @KimuComponent({
275
- tag: 'my-first-extension',
276
- name: 'My First Extension',
277
- version: '1.0.0',
278
- description: 'My first KIMU extension',
279
- author: 'Your Name',
280
- icon: '🎨',
281
- internal: false,
282
- path: 'my-first-extension',
283
- dependencies: []
284
- })
285
- export class MyFirstExtension extends KimuComponentElement {
286
- async onInit() {
287
- console.log('Extension initialized!');
288
- }
289
-
290
- getData() {
291
- return {
292
- message: 'Hello from my first extension!'
293
- };
294
- }
295
- }
296
- ```
297
-
298
- Example `view.html`:
299
- ```html
300
- <div class="extension-container">
301
- <h1>${message}</h1>
302
- </div>
303
- ```
304
-
305
- Example `style.css`:
306
- ```css
307
- .extension-container {
308
- padding: 20px;
309
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
310
- color: white;
311
- border-radius: 10px;
312
- }
313
- ```
314
-
315
- ### 3. Register Your Extension
316
-
317
- Add to `extension-manifest.json`:
318
- ```json
319
- {
320
- "tag": "my-first-extension",
321
- "name": "My First Extension",
322
- "version": "1.0.0",
323
- "description": "My first KIMU extension",
324
- "author": "Your Name",
325
- "icon": "🎨",
326
- "internal": false,
327
- "path": "my-first-extension",
328
- "dependencies": []
329
- }
330
- ```
331
-
332
- ### 4. Load Your Extension
333
-
334
- In `src/main.ts`:
335
- ```typescript
336
- await extensionManager.load('my-first-extension');
337
- ```
338
-
339
- ## Next Steps
340
-
341
- - **Read the Documentation**: Explore the [full command reference](command-kimu.md)
342
- - **Learn About Extensions**: Check the [KIMU-Core documentation](https://github.com/UnicoVerso/kimu-core)
343
- - **Join the Community**: Visit the [KIMU GitHub](https://github.com/UnicoVerso)
344
- - **Explore Examples**: Check out [example projects](https://github.com/UnicoVerso/kimu-extensions-example)
345
-
346
- ## Troubleshooting
347
-
348
- ### "Command not found: kimu"
349
- If you get this error after global installation:
350
- ```bash
351
- # Check if npm global bin is in PATH
352
- npm config get prefix
353
-
354
- # Add to PATH (example for bash/zsh)
355
- echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
356
- source ~/.zshrc
357
- ```
358
-
359
- ### Port 5173 Already in Use
360
- If the dev server fails to start:
361
- ```bash
362
- # Kill the process using port 5173
363
- lsof -ti:5173 | xargs kill -9
364
-
365
- # Or use a different port
366
- vite --port 3000
367
- ```
368
-
369
- ### Build Errors
370
- If you encounter build errors:
371
- ```bash
372
- # Clean and rebuild
373
- rm -rf node_modules dist
374
- npm install
375
- npm run build
376
- ```
377
-
378
- ## Support
379
-
380
- - **Issues**: [GitHub Issues](https://github.com/UnicoVerso/kimu-cli/issues)
381
- - **Discussions**: [GitHub Discussions](https://github.com/UnicoVerso/kimu-cli/discussions)
382
- - **Documentation**: [Full Docs](https://github.com/UnicoVerso/kimu-cli/docs)
383
-
384
- ---
385
-
386
- **Happy coding with KIMU!** 🚀
1
+ # Getting Started with KIMU-CLI
2
+
3
+ This guide will help you install KIMU-CLI and create your first KIMU application in just a few minutes.
4
+
5
+ ## Prerequisites
6
+
7
+ Before you begin, ensure you have:
8
+ - **Node.js** >= 18.0.0 ([Download here](https://nodejs.org/))
9
+ - **NPM** >= 8.0.0 (comes with Node.js)
10
+ - A terminal/command prompt
11
+
12
+ Check your versions:
13
+ ```bash
14
+ node --version
15
+ npm --version
16
+ ```
17
+
18
+ ## Installation
19
+
20
+ ### Option 1: Global Installation (Recommended)
21
+
22
+ Install KIMU-CLI globally to use the `kimu` command anywhere:
23
+
24
+ ```bash
25
+ npm install -g kimu-cli
26
+ ```
27
+
28
+ Verify the installation:
29
+ ```bash
30
+ kimu --version
31
+ # Output: 0.1.1 (or current version)
32
+
33
+ kimu --help
34
+ # Shows all available commands
35
+ ```
36
+
37
+ ### Option 2: Using npx (No Installation Required)
38
+
39
+ You can use KIMU-CLI without installing it globally by using `npx`:
40
+
41
+ ```bash
42
+ npx kimu-cli create my-app
43
+ ```
44
+
45
+ This downloads and runs the latest version of KIMU-CLI temporarily.
46
+
47
+ ## Creating Your First Project
48
+
49
+ ### Step 1: Create a New Project
50
+
51
+ ```bash
52
+ kimu create my-first-app
53
+ ```
54
+
55
+ You'll be prompted to:
56
+ - Confirm the project name
57
+ - Choose whether to initialize git
58
+ - Optionally select a template (coming soon)
59
+
60
+ The CLI will:
61
+ 1. Create a new folder `my-first-app/`
62
+ 2. Initialize npm with `package.json`
63
+ 3. Install `kimu-core` and copy all framework files
64
+ 4. Install all dependencies
65
+ 5. Generate configuration files
66
+
67
+ ### Step 2: Navigate to Your Project
68
+
69
+ ```bash
70
+ cd my-first-app
71
+ ```
72
+
73
+ ### Step 3: Explore Your Project Structure
74
+
75
+ ```
76
+ my-first-app/
77
+ ├── src/ # Source code
78
+ │ ├── core/ # KIMU core framework files
79
+ │ ├── extensions/ # Your custom extensions
80
+ │ ├── modules/ # Modules (router, i18n, etc.)
81
+ │ └── main.ts # Application entry point
82
+ ├── public/ # Static assets
83
+ ├── scripts/ # Build and utility scripts
84
+ ├── dist/ # Build output
85
+ ├── kimu.config.json # KIMU configuration
86
+ ├── kimu-build-config.ts # Build configuration
87
+ ├── package.json # NPM dependencies
88
+ ├── tsconfig.json # TypeScript configuration
89
+ ├── vite.config.ts # Vite bundler configuration
90
+ └── README.md # Project documentation
91
+ ```
92
+
93
+ ### Step 4: Start Development Server
94
+
95
+ ```bash
96
+ npm run dev
97
+ ```
98
+
99
+ This will:
100
+ - Start the Vite development server
101
+ - Enable hot module replacement (HMR)
102
+ - Open your app at `http://localhost:5173/`
103
+
104
+ You should see your KIMU application running! 🎉
105
+
106
+ ### Step 5: Make Your First Change
107
+
108
+ Open `src/extensions/app-root/component.ts` and modify the `getData()` method:
109
+
110
+ ```typescript
111
+ getData() {
112
+ return {
113
+ title: 'My First KIMU App!', // Change this
114
+ version: this.version,
115
+ kimuLogo: this.getKimuLogo(),
116
+ };
117
+ }
118
+ ```
119
+
120
+ Save the file and watch the browser update automatically!
121
+
122
+ ## Understanding Key Files
123
+
124
+ ### `src/main.ts`
125
+ The main entry point that initializes the KIMU application:
126
+ ```typescript
127
+ import { KimuApp } from './core/kimu-app';
128
+ import { KimuExtensionManager } from './core/kimu-extension-manager';
129
+
130
+ async function main() {
131
+ const app = await KimuApp.getInstance();
132
+ const extensionManager = KimuExtensionManager.getInstance();
133
+
134
+ await extensionManager.init();
135
+ await extensionManager.load('app-root');
136
+ }
137
+ ```
138
+
139
+ ### `kimu.config.json`
140
+ Project configuration file:
141
+ ```json
142
+ {
143
+ "name": "my-first-app",
144
+ "version": "1.0.0",
145
+ "kimuCore": "^0.4.0",
146
+ "modules": {
147
+ "installed": [],
148
+ "registry": "https://github.com/unicoverso/kimu-modules"
149
+ },
150
+ "extensions": {
151
+ "installed": ["app-root"],
152
+ "main": "app-root"
153
+ }
154
+ }
155
+ ```
156
+
157
+ ### `package.json`
158
+ NPM package configuration with scripts:
159
+ ```json
160
+ {
161
+ "scripts": {
162
+ "dev": "vite",
163
+ "build": "vite build",
164
+ "preview": "vite preview",
165
+ "lint": "eslint src/**/*.ts",
166
+ "generate-config:dev": "node scripts/generate-build-config.js dev",
167
+ "generate-config:prod": "node scripts/generate-build-config.js prod"
168
+ }
169
+ }
170
+ ```
171
+
172
+ ## Development Commands
173
+
174
+ ### Start Development Server
175
+ ```bash
176
+ npm run dev
177
+ ```
178
+ - Hot reload enabled
179
+ - Access at `http://localhost:5173/`
180
+
181
+ ### Build for Production
182
+ ```bash
183
+ npm run build
184
+ ```
185
+ - Optimized production bundle
186
+ - Output in `dist/` folder
187
+
188
+ ### Preview Production Build
189
+ ```bash
190
+ npm run preview
191
+ ```
192
+ - Test production build locally
193
+
194
+ ### Lint Your Code
195
+ ```bash
196
+ npm run lint
197
+ ```
198
+ - Check code quality with ESLint
199
+
200
+ ## KIMU-CLI Commands
201
+
202
+ ### Get Project Information
203
+ ```bash
204
+ kimu info
205
+ ```
206
+ Shows basic project details.
207
+
208
+ ```bash
209
+ kimu info --verbose
210
+ ```
211
+ Shows detailed information including dependencies and configuration.
212
+
213
+ ### Check CLI Version
214
+ ```bash
215
+ kimu --version
216
+ ```
217
+ Shows KIMU-CLI version.
218
+
219
+ ```bash
220
+ kimu version --verbose
221
+ ```
222
+ Shows detailed version information including Node.js and platform.
223
+
224
+ ### Get Help
225
+ ```bash
226
+ kimu --help
227
+ ```
228
+ Shows all available commands.
229
+
230
+ ```bash
231
+ kimu create --help
232
+ ```
233
+ Shows help for a specific command.
234
+
235
+ ## Creating Extensions
236
+
237
+ KIMU applications are built using extensions. Here's how to create your first extension:
238
+
239
+ ### Using the CLI (Recommended)
240
+
241
+ The easiest way is to use the `kimu new` command:
242
+
243
+ ```bash
244
+ # Create a new extension
245
+ kimu new extension my-first-extension
246
+ ```
247
+
248
+ This automatically creates:
249
+ - `component.ts` - Logic and lifecycle methods
250
+ - `style.css` - Component styles
251
+ - `view.html` - HTML template
252
+ - Registers in `extension-manifest.json`
253
+
254
+ ### Manual Creation
255
+
256
+ Alternatively, create the structure manually:
257
+
258
+ ### 1. Create Extension Folder
259
+ ```bash
260
+ mkdir -p src/extensions/my-first-extension
261
+ ```
262
+
263
+ ### 2. Create Required Files
264
+ Each extension needs three files:
265
+ - `component.ts` - Logic and data
266
+ - `style.css` - Styles
267
+ - `view.html` - Template
268
+
269
+ Example `component.ts`:
270
+ ```typescript
271
+ import { KimuComponent } from '../../core/kimu-component';
272
+ import { KimuComponentElement } from '../../core/kimu-component-element';
273
+
274
+ @KimuComponent({
275
+ tag: 'my-first-extension',
276
+ name: 'My First Extension',
277
+ version: '1.0.0',
278
+ description: 'My first KIMU extension',
279
+ author: 'Your Name',
280
+ icon: '🎨',
281
+ internal: false,
282
+ path: 'my-first-extension',
283
+ dependencies: []
284
+ })
285
+ export class MyFirstExtension extends KimuComponentElement {
286
+ async onInit() {
287
+ console.log('Extension initialized!');
288
+ }
289
+
290
+ getData() {
291
+ return {
292
+ message: 'Hello from my first extension!'
293
+ };
294
+ }
295
+ }
296
+ ```
297
+
298
+ Example `view.html`:
299
+ ```html
300
+ <div class="extension-container">
301
+ <h1>${message}</h1>
302
+ </div>
303
+ ```
304
+
305
+ Example `style.css`:
306
+ ```css
307
+ .extension-container {
308
+ padding: 20px;
309
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
310
+ color: white;
311
+ border-radius: 10px;
312
+ }
313
+ ```
314
+
315
+ ### 3. Register Your Extension
316
+
317
+ Add to `extension-manifest.json`:
318
+ ```json
319
+ {
320
+ "tag": "my-first-extension",
321
+ "name": "My First Extension",
322
+ "version": "1.0.0",
323
+ "description": "My first KIMU extension",
324
+ "author": "Your Name",
325
+ "icon": "🎨",
326
+ "internal": false,
327
+ "path": "my-first-extension",
328
+ "dependencies": []
329
+ }
330
+ ```
331
+
332
+ ### 4. Load Your Extension
333
+
334
+ In `src/main.ts`:
335
+ ```typescript
336
+ await extensionManager.load('my-first-extension');
337
+ ```
338
+
339
+ ## Next Steps
340
+
341
+ - **Read the Documentation**: Explore the [full command reference](command-kimu.md)
342
+ - **Learn About Extensions**: Check the [KIMU-Core documentation](https://github.com/UnicoVerso/kimu-core)
343
+ - **Join the Community**: Visit the [KIMU GitHub](https://github.com/UnicoVerso)
344
+ - **Explore Examples**: Check out [example projects](https://github.com/UnicoVerso/kimu-extensions-example)
345
+
346
+ ## Troubleshooting
347
+
348
+ ### "Command not found: kimu"
349
+ If you get this error after global installation:
350
+ ```bash
351
+ # Check if npm global bin is in PATH
352
+ npm config get prefix
353
+
354
+ # Add to PATH (example for bash/zsh)
355
+ echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
356
+ source ~/.zshrc
357
+ ```
358
+
359
+ ### Port 5173 Already in Use
360
+ If the dev server fails to start:
361
+ ```bash
362
+ # Kill the process using port 5173
363
+ lsof -ti:5173 | xargs kill -9
364
+
365
+ # Or use a different port
366
+ vite --port 3000
367
+ ```
368
+
369
+ ### Build Errors
370
+ If you encounter build errors:
371
+ ```bash
372
+ # Clean and rebuild
373
+ rm -rf node_modules dist
374
+ npm install
375
+ npm run build
376
+ ```
377
+
378
+ ## Support
379
+
380
+ - **Issues**: [GitHub Issues](https://github.com/UnicoVerso/kimu-cli/issues)
381
+ - **Discussions**: [GitHub Discussions](https://github.com/UnicoVerso/kimu-cli/discussions)
382
+ - **Documentation**: [Full Docs](https://github.com/UnicoVerso/kimu-cli/docs)
383
+
384
+ ---
385
+
386
+ **Happy coding with KIMU!** 🚀