kimu-cli 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/README.md +18 -7
  3. package/bin/kimu.js +7 -5
  4. package/dist/commands/install.d.ts +3 -0
  5. package/dist/commands/install.d.ts.map +1 -0
  6. package/dist/commands/install.js +58 -0
  7. package/dist/commands/install.js.map +1 -0
  8. package/dist/commands/list.d.ts +3 -0
  9. package/dist/commands/list.d.ts.map +1 -0
  10. package/dist/commands/list.js +167 -0
  11. package/dist/commands/list.js.map +1 -0
  12. package/dist/commands/new.d.ts +16 -0
  13. package/dist/commands/new.d.ts.map +1 -0
  14. package/dist/commands/new.js +316 -0
  15. package/dist/commands/new.js.map +1 -0
  16. package/dist/types/cli-types.d.ts +7 -0
  17. package/dist/types/cli-types.d.ts.map +1 -1
  18. package/dist/utils/module-installer.d.ts +11 -0
  19. package/dist/utils/module-installer.d.ts.map +1 -0
  20. package/dist/utils/module-installer.js +21 -0
  21. package/dist/utils/module-installer.js.map +1 -0
  22. package/dist/utils/registry.d.ts +8 -0
  23. package/dist/utils/registry.d.ts.map +1 -0
  24. package/dist/utils/registry.js +109 -0
  25. package/dist/utils/registry.js.map +1 -0
  26. package/docs/README.md +126 -0
  27. package/docs/command-kimu.md +14 -0
  28. package/docs/commands/create.md +60 -15
  29. package/docs/commands/install.md +52 -8
  30. package/docs/commands/list.md +39 -51
  31. package/docs/commands/new.md +626 -0
  32. package/docs/configuration-files.md +192 -0
  33. package/docs/getting-started.md +386 -0
  34. package/docs/index.md +57 -27
  35. package/docs/intro.md +30 -8
  36. package/docs/quick-reference.md +335 -0
  37. package/package.json +101 -101
  38. package/templates/generators/README.md +76 -0
  39. package/templates/generators/extension/config.json +45 -0
  40. package/templates/generators/extension/templates/component.ts.template +66 -0
  41. package/templates/generators/extension/templates/style.css.template +40 -0
  42. package/templates/generators/extension/templates/view.html.template +9 -0
  43. package/templates/generators/module/config.json +35 -0
  44. package/templates/generators/module/templates/README.md.template +62 -0
  45. package/templates/generators/module/templates/module.ts.template +36 -0
  46. package/templates/generators/module/templates/service.ts.template +41 -0
  47. package/docs/command-kimu-new.md +0 -207
  48. package/docs/command-kimu-old.md +0 -51
@@ -0,0 +1,192 @@
1
+ # Configuration Files
2
+
3
+ This directory contains various configuration files to ensure consistency across different development environments and tools.
4
+
5
+ ## Files Overview
6
+
7
+ ### `.editorconfig`
8
+ **Purpose**: Defines consistent coding styles across different editors and IDEs.
9
+
10
+ **Key settings**:
11
+ - Line endings: LF (Unix-style)
12
+ - Charset: UTF-8
13
+ - Indentation: 2 spaces
14
+ - Trim trailing whitespace
15
+ - Insert final newline
16
+
17
+ **Supported editors**: VSCode, IntelliJ IDEA, Sublime Text, Vim, Emacs, and many others with EditorConfig plugins.
18
+
19
+ ### `.gitattributes`
20
+ **Purpose**: Git attributes for consistent line endings and file handling across different operating systems.
21
+
22
+ **Key features**:
23
+ - Enforces LF line endings for all text files
24
+ - Special handling for Windows-specific files (.bat, .cmd with CRLF)
25
+ - Binary file detection
26
+ - Linguist settings for GitHub language statistics
27
+ - Custom merge strategies for lock files
28
+
29
+ ### `.prettierrc`
30
+ **Purpose**: Prettier code formatter configuration.
31
+
32
+ **Key settings**:
33
+ - Single quotes
34
+ - Semicolons enabled
35
+ - Line width: 80 characters
36
+ - Tab width: 2 spaces
37
+ - End of line: LF
38
+ - Arrow function parentheses: avoid
39
+ - Trailing commas: ES5 compatible
40
+
41
+ ### `.prettierignore`
42
+ **Purpose**: Files and directories that Prettier should ignore.
43
+
44
+ **Ignored**:
45
+ - Build outputs (dist/, build/)
46
+ - Dependencies (node_modules/)
47
+ - Lock files
48
+ - Temporary files
49
+ - Generated files
50
+
51
+ ### `.nvmrc`
52
+ **Purpose**: Specifies the Node.js version required for this project.
53
+
54
+ **Value**: `18` (Node.js 18.x)
55
+
56
+ **Usage**:
57
+ ```bash
58
+ # If you have nvm installed
59
+ nvm use
60
+
61
+ # Or install the specified version
62
+ nvm install
63
+ ```
64
+
65
+ ## Why These Files Matter
66
+
67
+ ### Consistency Across Environments
68
+ These files ensure that:
69
+ - **Line endings are consistent** (LF) regardless of OS (Windows, macOS, Linux)
70
+ - **Character encoding is UTF-8** everywhere
71
+ - **Code style is uniform** across team members
72
+ - **Git handles files correctly** across platforms
73
+
74
+ ### Common Problems Prevented
75
+
76
+ 1. **Line Ending Issues**
77
+ - Without `.editorconfig` + `.gitattributes`: Windows uses CRLF, Unix uses LF
78
+ - This causes: Git showing entire files as changed, merge conflicts, linter errors
79
+ - **Solution**: Both files enforce LF for all text files
80
+
81
+ 2. **Character Encoding Issues**
82
+ - Without `.editorconfig`: Different default encodings (ISO-8859-1, Windows-1252, UTF-8)
83
+ - This causes: Special characters broken, emoji not working, accented letters corrupted
84
+ - **Solution**: UTF-8 everywhere
85
+
86
+ 3. **Formatting Inconsistencies**
87
+ - Without `.prettierrc`: Different tab/space settings, line lengths, quote styles
88
+ - This causes: Merge conflicts, noisy diffs, readability issues
89
+ - **Solution**: Automated consistent formatting
90
+
91
+ 4. **Node Version Mismatches**
92
+ - Without `.nvmrc`: Team members use different Node versions
93
+ - This causes: "Works on my machine", package incompatibilities
94
+ - **Solution**: Documented and enforceable Node version
95
+
96
+ ## Setup Recommendations
97
+
98
+ ### For VSCode Users
99
+ Install these extensions:
100
+ ```json
101
+ {
102
+ "recommendations": [
103
+ "editorconfig.editorconfig",
104
+ "esbenp.prettier-vscode",
105
+ "dbaeumer.vscode-eslint"
106
+ ]
107
+ }
108
+ ```
109
+
110
+ ### For Git Users
111
+ Ensure line endings are normalized:
112
+ ```bash
113
+ # Check current setting
114
+ git config --global core.autocrlf
115
+
116
+ # Recommended settings:
117
+ # On Windows: git config --global core.autocrlf true
118
+ # On macOS/Linux: git config --global core.autocrlf input
119
+ ```
120
+
121
+ ### For Team Consistency
122
+ **Before first commit**:
123
+ ```bash
124
+ # Install dependencies
125
+ npm install
126
+
127
+ # Format all files
128
+ npm run format
129
+
130
+ # Verify linting
131
+ npm run lint
132
+
133
+ # Build to verify everything works
134
+ npm run build
135
+ ```
136
+
137
+ ## Integration with CI/CD
138
+
139
+ These configurations work with our GitHub Actions workflows:
140
+ - Linting checks enforce `.prettierrc` rules
141
+ - Build process validates `.editorconfig` compliance
142
+ - Tests run on Node version specified in `.nvmrc`
143
+
144
+ ## Troubleshooting
145
+
146
+ ### Issue: "Delete ␍" errors in ESLint
147
+ **Cause**: CRLF line endings instead of LF
148
+
149
+ **Solution**:
150
+ ```bash
151
+ # Fix with Prettier
152
+ npm run format
153
+
154
+ # Or manually convert line endings
155
+ git add --renormalize .
156
+ git commit -m "Normalize line endings"
157
+ ```
158
+
159
+ ### Issue: Files showing as modified after checkout
160
+ **Cause**: Git autocrlf settings conflict with repository settings
161
+
162
+ **Solution**:
163
+ ```bash
164
+ # Re-normalize repository
165
+ git rm --cached -r .
166
+ git reset --hard
167
+ ```
168
+
169
+ ### Issue: Different formatting from team members
170
+ **Cause**: Editor not respecting `.editorconfig` or `.prettierrc`
171
+
172
+ **Solution**:
173
+ - Install EditorConfig plugin for your editor
174
+ - Install Prettier plugin and enable "Format on Save"
175
+ - Run `npm run format` before committing
176
+
177
+ ## References
178
+
179
+ - [EditorConfig Documentation](https://editorconfig.org/)
180
+ - [Git Attributes Documentation](https://git-scm.com/docs/gitattributes)
181
+ - [Prettier Documentation](https://prettier.io/)
182
+ - [nvm Documentation](https://github.com/nvm-sh/nvm)
183
+
184
+ ## Maintenance
185
+
186
+ These files should be:
187
+ - ✅ Committed to version control
188
+ - ✅ Kept in sync across all project repositories
189
+ - ✅ Updated when project conventions change
190
+ - ✅ Referenced in CONTRIBUTING.md
191
+
192
+ Last updated: December 2025
@@ -0,0 +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/kimu-home/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('kimu-home');
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": ["kimu-home"],
152
+ "main": "kimu-home"
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!** 🚀