@tachui/cli 0.8.1-alpha → 0.8.8

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 (75) hide show
  1. package/README.md +37 -412
  2. package/bin/tacho.js +59 -7
  3. package/dist/commands/analyze-imports.d.ts +18 -0
  4. package/dist/commands/analyze-imports.d.ts.map +1 -0
  5. package/dist/commands/analyze-imports.js +152 -0
  6. package/dist/commands/analyze-imports.js.map +1 -0
  7. package/dist/commands/analyze.js +1 -1
  8. package/dist/commands/analyze.js.map +1 -1
  9. package/dist/commands/dev.js +3 -3
  10. package/dist/commands/dev.js.map +1 -1
  11. package/dist/commands/generate.d.ts +1 -1
  12. package/dist/commands/generate.d.ts.map +1 -1
  13. package/dist/commands/generate.js +1 -22
  14. package/dist/commands/generate.js.map +1 -1
  15. package/dist/commands/init.d.ts +10 -1
  16. package/dist/commands/init.d.ts.map +1 -1
  17. package/dist/commands/init.js +170 -680
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/migrate/remove-modifier-trigger.d.ts +3 -0
  20. package/dist/commands/migrate/remove-modifier-trigger.d.ts.map +1 -0
  21. package/dist/commands/migrate/remove-modifier-trigger.js +103 -0
  22. package/dist/commands/migrate/remove-modifier-trigger.js.map +1 -0
  23. package/dist/commands/migrate.d.ts.map +1 -1
  24. package/dist/commands/migrate.js +8 -6
  25. package/dist/commands/migrate.js.map +1 -1
  26. package/dist/commands/modifier-docs.d.ts +24 -0
  27. package/dist/commands/modifier-docs.d.ts.map +1 -0
  28. package/dist/commands/modifier-docs.js +375 -0
  29. package/dist/commands/modifier-docs.js.map +1 -0
  30. package/dist/import-optimizer.d.ts +50 -0
  31. package/dist/import-optimizer.d.ts.map +1 -0
  32. package/dist/import-optimizer.js +227 -0
  33. package/dist/import-optimizer.js.map +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +14 -3
  36. package/dist/index.js.map +1 -1
  37. package/dist/migrations/remove-modifier-trigger.d.ts +7 -0
  38. package/dist/migrations/remove-modifier-trigger.d.ts.map +1 -0
  39. package/dist/migrations/remove-modifier-trigger.js +99 -0
  40. package/dist/migrations/remove-modifier-trigger.js.map +1 -0
  41. package/dist/scaffold/core-version-map.d.ts +2 -0
  42. package/dist/scaffold/core-version-map.d.ts.map +1 -0
  43. package/dist/scaffold/core-version-map.js +130 -0
  44. package/dist/scaffold/core-version-map.js.map +1 -0
  45. package/dist/scaffold/create-project.d.ts +15 -0
  46. package/dist/scaffold/create-project.d.ts.map +1 -0
  47. package/dist/scaffold/create-project.js +84 -0
  48. package/dist/scaffold/create-project.js.map +1 -0
  49. package/dist/scaffold/package-root.d.ts +2 -0
  50. package/dist/scaffold/package-root.d.ts.map +1 -0
  51. package/dist/scaffold/package-root.js +34 -0
  52. package/dist/scaffold/package-root.js.map +1 -0
  53. package/dist/scaffold/templates.d.ts +11 -0
  54. package/dist/scaffold/templates.d.ts.map +1 -0
  55. package/dist/scaffold/templates.js +26 -0
  56. package/dist/scaffold/templates.js.map +1 -0
  57. package/dist/scaffold/validators.d.ts +2 -0
  58. package/dist/scaffold/validators.d.ts.map +1 -0
  59. package/dist/scaffold/validators.js +32 -0
  60. package/dist/scaffold/validators.js.map +1 -0
  61. package/package.json +7 -3
  62. package/templates/advanced/README.md.template +23 -0
  63. package/templates/advanced/index.html.template +23 -0
  64. package/templates/advanced/package.json.template +20 -0
  65. package/templates/advanced/src/App.ts.template +54 -0
  66. package/templates/advanced/src/main.ts.template +4 -0
  67. package/templates/advanced/tsconfig.json.template +14 -0
  68. package/templates/advanced/vite.config.ts.template +11 -0
  69. package/templates/basic/README.md.template +17 -0
  70. package/templates/basic/index.html.template +22 -0
  71. package/templates/basic/package.json.template +20 -0
  72. package/templates/basic/src/App.ts.template +35 -0
  73. package/templates/basic/src/main.ts.template +4 -0
  74. package/templates/basic/tsconfig.json.template +14 -0
  75. package/templates/basic/vite.config.ts.template +11 -0
package/README.md CHANGED
@@ -1,439 +1,64 @@
1
1
  # @tachui/cli
2
2
 
3
- > Comprehensive developer tooling and CLI for tachUI framework
4
-
5
- [![npm version](https://img.shields.io/npm/v/@tachui/cli.svg)](https://www.npmjs.com/package/@tachui/cli)
6
- [![License: MPL-2.0](https://img.shields.io/badge/License-MPL--2.0-blue.svg)](https://opensource.org/licenses/MPL-2.0)
7
-
8
- ## Overview
9
-
10
- The tachUI CLI (`tacho`) provides comprehensive developer tooling including project scaffolding, code generation, SwiftUI migration utilities, performance analysis, and development server capabilities.
11
-
12
- ## Features
13
-
14
- - 🚀 **Project Scaffolding** - Create new tachUI projects with templates
15
- - 🔧 **Code Generation** - Generate components, pages, and plugins
16
- - 📱 **SwiftUI Migration** - Convert SwiftUI code to tachUI
17
- - ⚡ **Performance Tools** - Bundle analysis and optimization
18
- - 🔍 **Development Server** - Hot reload and debugging capabilities
19
- - 🧪 **Testing Utilities** - Test generation and runner integration
20
-
21
- ## Installation
22
-
23
- ### Global Installation
24
-
25
- ```bash
26
- npm install -g @tachui/cli@0.8.0-alpha
27
- # or
28
- pnpm add -g @tachui/cli@0.8.0-alpha
29
- ```
30
-
31
- ### Local Project Installation
32
-
33
- ```bash
34
- npm install --save-dev @tachui/cli@0.8.0-alpha
35
- # or
36
- pnpm add -D @tachui/cli@0.8.0-alpha
37
- ```
3
+ Developer CLI for TachUI.
38
4
 
39
5
  ## Quick Start
40
6
 
41
- ### Create New Project
42
-
43
- ```bash
44
- # Create a new tachUI project
45
- tacho create my-app
46
-
47
- # Create with specific template
48
- tacho create my-app --template react-integration
49
- tacho create my-app --template mobile-first
50
- tacho create my-app --template desktop-app
51
- ```
52
-
53
- ### Generate Components
54
-
55
- ```bash
56
- # Generate a new component
57
- tacho generate component UserProfile
58
- tacho generate component --interactive
59
-
60
- # Generate a page with routing
61
- tacho generate page ProductDetail --route "/products/:id"
62
-
63
- # Generate a plugin
64
- tacho generate plugin MyCustomPlugin
65
- ```
66
-
67
- ## Commands
68
-
69
- ### Project Management
70
-
71
- ```bash
72
- # Create new project
73
- tacho create <project-name> [options]
74
-
75
- # Initialize tachUI in existing project
76
- tacho init
77
-
78
- # Add tachUI packages to existing project
79
- tacho add forms navigation symbols
80
- ```
81
-
82
- ### Code Generation
83
-
84
- ```bash
85
- # Generate component
86
- tacho generate component <ComponentName>
87
- tacho g c <ComponentName> # Shorthand
88
-
89
- # Generate page
90
- tacho generate page <PageName> --route <route>
91
-
92
- # Generate plugin
93
- tacho generate plugin <PluginName>
94
-
95
- # Generate form
96
- tacho generate form <FormName> --fields name:string,email:email,age:number
97
- ```
98
-
99
- ### SwiftUI Migration
7
+ Use `npx` without a global install:
100
8
 
101
9
  ```bash
102
- # Migrate SwiftUI file to tachUI
103
- tacho migrate swiftui ./MyView.swift
104
-
105
- # Migrate entire SwiftUI project
106
- tacho migrate swiftui-project ./MySwiftUIApp
107
-
108
- # Interactive migration with suggestions
109
- tacho migrate --interactive ./ContentView.swift
10
+ npx @tachui/cli init my-app
11
+ cd my-app
12
+ npm install
13
+ npm run dev
110
14
  ```
111
15
 
112
- ### Development Tools
16
+ ## Init Command
113
17
 
114
18
  ```bash
115
- # Start development server
116
- tacho dev
117
- tacho serve --port 3000
118
-
119
- # Build project
120
- tacho build
121
- tacho build --mode production
122
-
123
- # Analyze bundle size
124
- tacho analyze
125
- tacho bundle-size --detailed
126
- ```
127
-
128
- ### Performance & Optimization
129
-
130
- ```bash
131
- # Performance analysis
132
- tacho perf analyze
133
- tacho perf benchmark
134
-
135
- # Bundle optimization
136
- tacho optimize --tree-shake
137
- tacho optimize --compress-assets
138
-
139
- # Audit dependencies
140
- tacho audit
141
- tacho audit --security
19
+ tacho init <target> [options]
142
20
  ```
143
21
 
144
- ## Templates
145
-
146
- ### Available Project Templates
22
+ Examples:
147
23
 
148
24
  ```bash
149
- # Basic tachUI application
150
- tacho create my-app --template basic
151
-
152
- # React.js integration
153
- tacho create my-app --template react-integration
154
-
155
- # Vue.js integration
156
- tacho create my-app --template vue-integration
157
-
158
- # Mobile-first application
159
- tacho create my-app --template mobile-first
160
-
161
- # Desktop application with Electron
162
- tacho create my-app --template desktop
163
-
164
- # Full-stack application with backend
165
- tacho create my-app --template fullstack
166
- ```
167
-
168
- ### Component Templates
169
-
170
- ```bash
171
- # Basic component
172
- tacho generate component Button
173
-
174
- # Component with props interface
175
- tacho generate component UserCard --props "user:User,onClick:Function"
176
-
177
- # Form component with validation
178
- tacho generate component LoginForm --type form
179
-
180
- # List component with data binding
181
- tacho generate component TodoList --type list --data-source todos
182
- ```
183
-
184
- ## Configuration
185
-
186
- ### `tacho.config.js`
187
-
188
- ```javascript
189
- export default {
190
- // Project settings
191
- projectName: 'my-tachui-app',
192
- version: '1.0.0',
193
-
194
- // Development server
195
- dev: {
196
- port: 3000,
197
- host: 'localhost',
198
- open: true,
199
- https: false,
200
- },
201
-
202
- // Build configuration
203
- build: {
204
- outDir: 'dist',
205
- sourcemap: true,
206
- minify: 'terser',
207
- target: 'es2020',
208
- },
209
-
210
- // Code generation preferences
211
- generate: {
212
- componentsDir: 'src/components',
213
- pagesDir: 'src/pages',
214
- pluginsDir: 'src/plugins',
215
- typescript: true,
216
- cssModules: false,
217
- },
218
-
219
- // SwiftUI migration settings
220
- migration: {
221
- outputDir: 'src/migrated',
222
- preserveComments: true,
223
- generateTypes: true,
224
- swiftUIVersion: '5.0',
225
- },
226
- }
227
- ```
228
-
229
- ## SwiftUI Migration
230
-
231
- ### Supported SwiftUI Features
232
-
233
- ```bash
234
- # Migrate common SwiftUI patterns
235
- tacho migrate swiftui MyView.swift
236
-
237
- # What gets converted:
238
- # - VStack, HStack, ZStack → VStack, HStack, ZStack
239
- # - Text, Button, Image → Text, Button, Image
240
- # - @State → createSignal
241
- # - @ObservedObject → createComputed
242
- # - .modifier chains → .modifier chains
243
- # - NavigationView → NavigationView
244
- # - List, ForEach → List, ForEach
245
- ```
246
-
247
- ### Migration Examples
248
-
249
- **Before (SwiftUI):**
250
-
251
- ```swift
252
- struct ContentView: View {
253
- @State private var count = 0
254
-
255
- var body: some View {
256
- VStack(spacing: 20) {
257
- Text("Count: \(count)")
258
- .font(.title)
259
- .foregroundColor(.blue)
260
-
261
- Button("Increment") {
262
- count += 1
263
- }
264
- .padding()
265
- .background(Color.blue)
266
- .foregroundColor(.white)
267
- .cornerRadius(8)
268
- }
269
- }
270
- }
271
- ```
272
-
273
- **After (tachUI):**
274
-
275
- ```typescript
276
- import { createSignal } from '@tachui/core'
277
- import { VStack, Text, Button } from '@tachui/primitives'
278
-
279
- const ContentView = () => {
280
- const [count, setCount] = createSignal(0)
281
-
282
- return VStack({
283
- children: [
284
- Text(() => `Count: ${count()}`)
285
- .modifier.font({ size: 24, weight: 'bold' })
286
- .foregroundColor('#007AFF')
287
- .build(),
288
-
289
- Button('Increment', () => setCount(count() + 1))
290
- .modifier.padding(16)
291
- .backgroundColor('#007AFF')
292
- .foregroundColor('white')
293
- .cornerRadius(8)
294
- .build(),
295
- ],
296
- spacing: 20,
297
- }).build()
298
- }
299
- ```
300
-
301
- ## Plugin Development
302
-
303
- ### Create Plugin Template
304
-
305
- ```bash
306
- tacho generate plugin MyPlugin --type enhancement
307
-
308
- # Generates:
309
- # - src/plugins/MyPlugin/
310
- # - index.ts (main plugin file)
311
- # - components/ (plugin components)
312
- # - types.ts (TypeScript definitions)
313
- # - README.md (plugin documentation)
314
- ```
315
-
316
- ### Plugin Structure
317
-
318
- ```typescript
319
- // Generated plugin template
320
- import { createTachUIPlugin } from '@tachui/core'
321
-
322
- export const MyPlugin = createTachUIPlugin({
323
- name: 'MyPlugin',
324
- version: '1.0.0',
325
- components: {
326
- // Custom components
327
- },
328
- modifiers: {
329
- // Custom modifiers
330
- },
331
- utilities: {
332
- // Helper functions
333
- },
334
- })
335
-
336
- export default MyPlugin
337
- ```
338
-
339
- ## Development Server
340
-
341
- ```bash
342
- # Start development server with hot reload
343
- tacho dev
344
-
345
- # Start with custom configuration
346
- tacho dev --port 3000 --host 0.0.0.0 --https
347
-
348
- # Start with specific environment
349
- tacho dev --mode development --env local
350
- ```
351
-
352
- Features:
353
-
354
- - **Hot Module Replacement** - Instant updates without page refresh
355
- - **Error Overlay** - In-browser error display
356
- - **Performance Metrics** - Real-time performance monitoring
357
- - **Component Inspector** - Debug component hierarchy
358
-
359
- ## Performance Tools
360
-
361
- ### Bundle Analysis
362
-
363
- ```bash
364
- # Analyze bundle composition
365
- tacho analyze
366
-
367
- # Generate detailed report
368
- tacho analyze --output report.html --detailed
369
-
370
- # Compare bundle sizes
371
- tacho analyze --compare baseline.json
372
- ```
373
-
374
- ### Performance Profiling
375
-
376
- ```bash
377
- # Profile application performance
378
- tacho perf profile --duration 30s
379
-
380
- # Benchmark specific components
381
- tacho perf benchmark --components Button,Text,VStack
382
-
383
- # Memory usage analysis
384
- tacho perf memory --watch
385
- ```
386
-
387
- ## Integration Examples
388
-
389
- ### React Integration
390
-
391
- ```bash
392
- tacho create my-react-app --template react-integration
393
-
394
- # Generates project with:
395
- # - React + tachUI setup
396
- # - Custom React hooks for tachUI signals
397
- # - Component interoperability
398
- # - Shared state management
399
- ```
400
-
401
- ### Vue Integration
402
-
403
- ```bash
404
- tacho create my-vue-app --template vue-integration
405
-
406
- # Generates project with:
407
- # - Vue 3 + tachUI setup
408
- # - Vue composition API integration
409
- # - Reactive property bindings
410
- # - Component bridge utilities
25
+ npx @tachui/cli init my-app --template basic --yes
26
+ npx @tachui/cli init my-app --template advanced --yes
27
+ npx @tachui/cli init . --template basic --yes
28
+ npx @tachui/cli init my-app --tachui-version 0.8.8-alpha --yes
411
29
  ```
412
30
 
413
- ## Examples
31
+ Options:
414
32
 
415
- Check out generated project examples:
33
+ - `--template <template>`: `basic` or `advanced`
34
+ - `--yes`: skip prompts
35
+ - `--tachui-version <version>`: version to use for generated `@tachui/*` dependencies
36
+ - `--package-manager <npm|pnpm>`: controls next-step output only (does not change generated scripts)
37
+ - `--list-templates`: print available templates
416
38
 
417
- - **[Basic App](https://github.com/tach-UI/tachUI/tree/main/apps/examples/cli/basic-app)**
418
- - **[React Integration](https://github.com/tach-UI/tachUI/tree/main/apps/examples/cli/react-integration)**
419
- - **[SwiftUI Migration](https://github.com/tach-UI/tachUI/tree/main/apps/examples/cli/swiftui-migration)**
39
+ Notes:
420
40
 
421
- ## API Reference
41
+ - `phase6` template naming has been removed. Use `advanced`.
42
+ - `--yes` requires an explicit target, for example `init my-app --yes`.
43
+ - By default, the CLI resolves `@tachui/core` from npm registry (`@tachui/core/latest`).
44
+ - If registry resolution fails, the CLI falls back to an internal compatibility map.
45
+ - `--tachui-version` always overrides the default resolution behavior.
422
46
 
423
- - **[CLI Commands](https://github.com/tach-UI/tachUI/blob/main/docs/api/cli/src/functions/main.md)**
424
- - **[Configuration Options](https://github.com/tach-UI/tachUI/blob/main/docs/guide/cli/configuration.md)**
425
- - **[Plugin Development](https://github.com/tach-UI/tachUI/blob/main/docs/guide/cli/plugins.md)**
47
+ ## Development Server Path
426
48
 
427
- ## Requirements
49
+ Scaffolded projects default to plain Vite scripts:
428
50
 
429
- - **Node.js** 20.0+
430
- - **@tachui/core** ^0.8.0-alpha or later
431
- - **TypeScript** 5.0+ (recommended)
51
+ - `npm run dev`
52
+ - `npm run build`
432
53
 
433
- ## Contributing
54
+ `tacho dev` remains available as optional enhanced CLI workflow.
434
55
 
435
- See the main [Contributing Guide](https://github.com/tach-UI/tachUI/blob/main/CONTRIBUTING.md) for information on contributing to tachUI CLI.
56
+ ## Other Commands
436
57
 
437
- ## License
58
+ - `tacho dev`
59
+ - `tacho generate`
60
+ - `tacho migrate`
61
+ - `tacho analyze`
62
+ - `tacho optimize`
438
63
 
439
- Mozilla Public License 2.0 - see [LICENSE](https://github.com/tach-UI/tachUI/blob/main/LICENSE) for details.
64
+ Run `tacho <command> --help` for command-specific flags.
package/bin/tacho.js CHANGED
@@ -1,10 +1,62 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import('../dist/index.js')
4
- .then(({ main }) => {
5
- main()
6
- })
7
- .catch((error) => {
8
- console.error('Failed to start Tacho CLI:', error)
3
+ import { realpathSync } from 'node:fs'
4
+ import { dirname } from 'node:path'
5
+ import { fileURLToPath, pathToFileURL } from 'node:url'
6
+
7
+ const binRealPath = realpathSync(fileURLToPath(import.meta.url))
8
+ const binDirUrl = pathToFileURL(`${dirname(binRealPath)}/`)
9
+
10
+ const moduleCandidates = [
11
+ new URL('../dist/index.js', binDirUrl).href,
12
+ new URL('../dist/cli/src/index.js', binDirUrl).href,
13
+ ]
14
+
15
+ const isMissingModule = (error, candidate) => {
16
+ if (!error) return false
17
+ if (error.code !== 'ERR_MODULE_NOT_FOUND') return false
18
+ return typeof error.message === 'string' && error.message.includes(candidate)
19
+ }
20
+
21
+ async function start() {
22
+ for (const candidate of moduleCandidates) {
23
+ try {
24
+ const { main } = await import(candidate)
25
+ if (typeof main === 'function') {
26
+ await main()
27
+ return
28
+ }
29
+ } catch (error) {
30
+ if (!isMissingModule(error, candidate)) {
31
+ console.error('Failed to start Tacho CLI:', error)
32
+ process.exit(1)
33
+ }
34
+ }
35
+ }
36
+
37
+ await startFromSource()
38
+ }
39
+
40
+ async function startFromSource() {
41
+ try {
42
+ // Register TSX loader so we can import TypeScript sources without building
43
+ await import('tsx/esm')
44
+ const { main } = await import(
45
+ new URL('../src/index.ts', binDirUrl).href
46
+ )
47
+
48
+ if (typeof main !== 'function') {
49
+ throw new Error('CLI entry did not export a main() function')
50
+ }
51
+
52
+ await main()
53
+ } catch (error) {
54
+ console.error(
55
+ 'Failed to start Tacho CLI. Build artifacts missing and TSX loader unavailable.',
56
+ error
57
+ )
9
58
  process.exit(1)
10
- })
59
+ }
60
+ }
61
+
62
+ start()
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * TachUI CLI - Import Analysis Command
4
+ *
5
+ * Analyzes project imports and provides optimization recommendations
6
+ */
7
+ interface AnalyzeOptions {
8
+ project?: string;
9
+ output?: string;
10
+ interactive?: boolean;
11
+ fix?: boolean;
12
+ threshold?: number;
13
+ }
14
+ declare function analyzeImports(options: AnalyzeOptions): Promise<void>;
15
+ declare function showImportGuide(packageName?: string): Promise<void>;
16
+ declare function showCheatSheet(): Promise<void>;
17
+ export { analyzeImports, showImportGuide, showCheatSheet };
18
+ //# sourceMappingURL=analyze-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-imports.d.ts","sourceRoot":"","sources":["../../src/commands/analyze-imports.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAWH,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAqCD,iBAAe,cAAc,CAAC,OAAO,EAAE,cAAc,iBAwFpD;AAiCD,iBAAe,eAAe,CAAC,WAAW,CAAC,EAAE,MAAM,iBAgBlD;AAED,iBAAe,cAAc,kBAI5B;AAGD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,CAAA"}