agnosticui-cli 2.0.0-alpha.2

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 (50) hide show
  1. package/README.md +1268 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +98 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/add.d.ts +3 -0
  7. package/dist/commands/add.d.ts.map +1 -0
  8. package/dist/commands/add.js +464 -0
  9. package/dist/commands/add.js.map +1 -0
  10. package/dist/commands/init.d.ts +3 -0
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/init.js +381 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/list.d.ts +2 -0
  15. package/dist/commands/list.d.ts.map +1 -0
  16. package/dist/commands/list.js +72 -0
  17. package/dist/commands/list.js.map +1 -0
  18. package/dist/commands/remove.d.ts +3 -0
  19. package/dist/commands/remove.d.ts.map +1 -0
  20. package/dist/commands/remove.js +96 -0
  21. package/dist/commands/remove.js.map +1 -0
  22. package/dist/commands/sync.d.ts +6 -0
  23. package/dist/commands/sync.d.ts.map +1 -0
  24. package/dist/commands/sync.js +143 -0
  25. package/dist/commands/sync.js.map +1 -0
  26. package/dist/types/index.d.ts +61 -0
  27. package/dist/types/index.d.ts.map +1 -0
  28. package/dist/types/index.js +5 -0
  29. package/dist/types/index.js.map +1 -0
  30. package/dist/utils/components.d.ts +76 -0
  31. package/dist/utils/components.d.ts.map +1 -0
  32. package/dist/utils/components.js +208 -0
  33. package/dist/utils/components.js.map +1 -0
  34. package/dist/utils/config.d.ts +9 -0
  35. package/dist/utils/config.d.ts.map +1 -0
  36. package/dist/utils/config.js +78 -0
  37. package/dist/utils/config.js.map +1 -0
  38. package/dist/utils/dependencies.d.ts +23 -0
  39. package/dist/utils/dependencies.d.ts.map +1 -0
  40. package/dist/utils/dependencies.js +93 -0
  41. package/dist/utils/dependencies.js.map +1 -0
  42. package/dist/utils/files.d.ts +48 -0
  43. package/dist/utils/files.d.ts.map +1 -0
  44. package/dist/utils/files.js +171 -0
  45. package/dist/utils/files.js.map +1 -0
  46. package/dist/utils/logger.d.ts +11 -0
  47. package/dist/utils/logger.d.ts.map +1 -0
  48. package/dist/utils/logger.js +34 -0
  49. package/dist/utils/logger.js.map +1 -0
  50. package/package.json +60 -0
package/README.md ADDED
@@ -0,0 +1,1268 @@
1
+ # agnosticui-cli
2
+
3
+ CLI for AgnosticUI Local - The UI kit that lives in your codebase.
4
+
5
+ ## Development Setup
6
+
7
+ ### Using the Script
8
+
9
+ The process of creating a consumer test project is encapsulated in the `qa-verify.js` script for convenience which can be used as follows:
10
+
11
+ Move the last run if you want to preserve it:
12
+
13
+ ```shell
14
+ mv v2/qa_workspace/lit-test v2/qa_workspace/lit-test-v1
15
+ ```
16
+
17
+ Or, if you'd prefer to just completely obliterate the workspace you can "clean" it:
18
+
19
+ ```shell
20
+ rm -rf v2/qa_workspace/ # Optionally cleanup last run
21
+ ```
22
+
23
+ Create new consumer test project (for Lit in this case):
24
+
25
+ ```shell
26
+ ./v2/cli/scripts/qa-verify.js --framework lit
27
+ ```
28
+
29
+ The following goes into step by step details on this…
30
+
31
+ ### Build the CLI
32
+
33
+ ```bash
34
+ npm install # Install dependencies (required first!)
35
+ npm run build # Build TypeScript to dist/
36
+ ```
37
+
38
+ ### Test Locally
39
+
40
+ The CLI is designed to work with a local tarball for development/dogfooding.
41
+
42
+ 1. **Build the v2/lib library tarball first:**
43
+
44
+ ```bash
45
+ cd ../../ # Go to v2 root
46
+ ./scripts/build-local-tarball.sh
47
+ ```
48
+
49
+ **Note:** The tarball name will be `agnosticui-local-v{VERSION}.tar.gz` where VERSION comes from `v2/lib/package.json`.
50
+
51
+ 2. **Package the CLI for local testing:**
52
+
53
+ **Using `npm pack`**
54
+
55
+ ```bash
56
+ cd cli
57
+ npm install # Install dependencies (first time only)
58
+ npm run build # Build TypeScript to dist/
59
+ npm pack # Package it
60
+ # This creates: agnosticui-cli-2.0.0-alpha.1.tgz
61
+ ```
62
+
63
+ Then in your test project:
64
+
65
+ ```bash
66
+ cd /path/to/your/test/project
67
+ npm install /path/to/agnosticui/v2/cli/agnosticui-cli-2.0.0-alpha.1.tgz
68
+
69
+ # Now you can use the CLI
70
+ # Note: Replace VERSION with the version from v2/lib/package.json (e.g., 0.0.1)
71
+ npx ag init --framework vue --tarball /path/to/v2/dist/agnosticui-local-vVERSION.tar.gz
72
+ # Note: if already initialized, we can also use `sync` to update the reference library
73
+ # npx ag sync --tarball /path/to/v2/dist/agnosticui-local-vVERSION.tar.gz
74
+ npx ag add button input
75
+ npx ag list
76
+ ```
77
+
78
+ **T3. **Quick test workflow with pack:\*\*
79
+
80
+ ```bash
81
+ # PREREQUISITES: Build component v2/lib and cli tarball first. See above.
82
+
83
+ # In test project
84
+ npm install /path/to/agnosticui/v2/cli/agnosticui-cli-2.0.0-alpha.1.tgz --force
85
+ # Note: Replace VERSION with the version from v2/lib/package.json
86
+ npx ag init --framework vue --tarball /path/to/v2/dist/agnosticui-local-vVERSION.tar.gz
87
+ ```
88
+
89
+ ## Commands
90
+
91
+ ### `ag init`
92
+
93
+ Initialize AgnosticUI Local in your project.
94
+
95
+ **Options:**
96
+
97
+ - `-f, --framework <framework>` - Framework to use (react, vue, lit, svelte)
98
+ - `-p, --components-path <path>` - Path where components will be generated (default: `./src/components/ag`)
99
+ - `-t, --tarball <path>` - Path to local tarball (for development)
100
+
101
+ **Example:**
102
+
103
+ ```bash
104
+ ag init --framework react --components-path ./src/components/ag
105
+ ```
106
+
107
+ ### `ag add <components...>`
108
+
109
+ Add one or more components to your project.
110
+
111
+ **Options:**
112
+
113
+ - `--force` - Overwrite existing components
114
+
115
+ **Examples:**
116
+
117
+ ```bash
118
+ # Add a single component
119
+ ag add button
120
+
121
+ # Add multiple components
122
+ ag add button input checkbox
123
+
124
+ # Overwrite existing
125
+ ag add button --force
126
+ ```
127
+
128
+ ### `ag list`
129
+
130
+ List all available components and show which ones are already added to your project.
131
+
132
+ **Example:**
133
+
134
+ ```bash
135
+ ag list
136
+ ```
137
+
138
+ ### `ag sync`
139
+
140
+ Update the reference library from a tarball (useful during local development).
141
+
142
+ **Options:**
143
+
144
+ - `-t, --tarball <path>` - Path to tarball (overrides path from config)
145
+
146
+ **Examples:**
147
+
148
+ ```bash
149
+ # Use tarball path from config
150
+ ag sync
151
+
152
+ # Override with specific tarball
153
+ ag sync --tarball /path/to/new/agnosticui-local-v0.0.2.tar.gz
154
+ ```
155
+
156
+ **What it does:**
157
+
158
+ 1. Reads tarball path from `agnosticui.config.json` (or uses `--tarball` flag)
159
+ 2. Shows confirmation with tarball path and version
160
+ 3. Extracts tarball to `./agnosticui/` (overwrites reference library)
161
+ 4. Updates CSS tokens in `{componentsPath}/styles/`
162
+ 5. Updates config with new tarball info and timestamp
163
+
164
+ **Your components are never touched** - only the reference library is updated.
165
+
166
+ **Typical workflow:**
167
+
168
+ ```bash
169
+ # Rebuild the library
170
+ cd v2
171
+ ./scripts/build-local-tarball.sh
172
+
173
+ # Sync in your project
174
+ cd ../your-project
175
+ npx ag sync
176
+ ```
177
+
178
+ ## How It Works
179
+
180
+ 1. **`ag init`** extracts the AgnosticUI reference library to `./agnosticui/` and creates a config file (saves tarball path for sync)
181
+ 2. **`ag add`** copies both the `core/` and framework-specific directories (e.g., `react/`) from the reference library to your project
182
+ 3. **`ag sync`** updates the reference library by re-extracting from the tarball (your components remain untouched)
183
+ 4. Components are fully yours to customize - they're copied, not linked
184
+
185
+ ## Project Structure After Init
186
+
187
+ ```
188
+ your-project/
189
+ β”œβ”€β”€ agnosticui/ # Reference library
190
+ β”‚ β”œβ”€β”€ lib/
191
+ β”‚ β”‚ β”œβ”€β”€ dist/ # Built components
192
+ β”‚ β”‚ └── src/ # Source files
193
+ β”‚ β”œβ”€β”€ tokens/ # Design tokens
194
+ β”‚ β”œβ”€β”€ docs/ # Documentation
195
+ β”‚ └── components.json # Component registry
196
+ β”œβ”€β”€ src/
197
+ β”‚ └── components/
198
+ β”‚ └── ag/ # Your components (customizable)
199
+ β”‚ β”œβ”€β”€ Button/
200
+ β”‚ β”‚ β”œβ”€β”€ core/ # Core Web Component
201
+ β”‚ β”‚ └── react/ # React wrapper
202
+ β”‚ └── Input/
203
+ β”‚ β”œβ”€β”€ core/
204
+ β”‚ └── react/
205
+ └── agnosticui.config.json # CLI configuration
206
+ ```
207
+
208
+ ## How Package Resolution Works
209
+
210
+ The CLI uses a **two-tier resolution strategy** to find the AgnosticUI core library:
211
+
212
+ ### 1. Local Development Mode (Priority)
213
+
214
+ When developing locally, the CLI first checks for a tarball at:
215
+
216
+ ```
217
+ ../../dist/agnosticui-local-v2.0.0-alpha.tar.gz
218
+ ```
219
+
220
+ This allows testing changes without publishing to NPM.
221
+
222
+ ### 2. Production Mode (NPM Registry)
223
+
224
+ If no local tarball is found, the CLI downloads from NPM:
225
+
226
+ ```bash
227
+ npm pack agnosticui-core@${version}
228
+ ```
229
+
230
+ **Package Names:**
231
+
232
+ - **Development tarball**: `agnosticui-local-v*.tar.gz` (built locally)
233
+ - **NPM package**: `agnosticui-core` (published to registry)
234
+
235
+ ### Usage Examples
236
+
237
+ **Local Development:**
238
+
239
+ ```bash
240
+ # Build local tarball first
241
+ cd v2
242
+ ./scripts/build-local-tarball.sh
243
+
244
+ # Use in test project
245
+ npx ag init --framework react --tarball /path/to/v2/dist/agnosticui-local-v2.0.0-alpha.tar.gz
246
+ ```
247
+
248
+ **Production (After Publishing):**
249
+
250
+ ```bash
251
+ # Downloads agnosticui-core@alpha from NPM
252
+ npx ag init --framework react
253
+
254
+ # Or specify a version
255
+ npx ag init --framework react --version latest
256
+ npx ag init --framework react --version 2.0.0
257
+ ```
258
+
259
+ ## Testing After NPM Publication
260
+
261
+ **CRITICAL: Follow these steps to verify the published package works correctly**
262
+
263
+ ### 1. Publish to NPM (Covered in Phase 4 below)
264
+
265
+ ```bash
266
+ cd v2/cli
267
+ npm publish --tag alpha
268
+ ```
269
+
270
+ ### 2. Wait for NPM Propagation
271
+
272
+ Wait 1-2 minutes for NPM to propagate the package globally.
273
+
274
+ ### 3. Verify in a Fresh Environment
275
+
276
+ ```bash
277
+ # Create a completely fresh test directory
278
+ mkdir /tmp/test-agui-npm-$(date +%s)
279
+ cd /tmp/test-agui-npm-$(date +%s)
280
+
281
+ # Initialize a basic project
282
+ npm init -y
283
+
284
+ # Test global installation
285
+ npm install -g agnosticui-cli@alpha
286
+
287
+ # Verify CLI is available
288
+ ag --version # Should show: 2.0.0-alpha.1
289
+
290
+ # CRITICAL TEST: Initialize WITHOUT --tarball flag
291
+ # This forces NPM download of agnosticui-core
292
+ ag init --framework react
293
+
294
+ # Verify the package was downloaded
295
+ ls -la agnosticui/ # Should contain extracted library
296
+
297
+ # Add a component
298
+ ag add button
299
+
300
+ # Verify component files exist
301
+ ls -la src/components/ag/Button/
302
+ ```
303
+
304
+ ### 4. Test with npx (No Global Install)
305
+
306
+ ```bash
307
+ # Create another fresh test directory
308
+ mkdir /tmp/test-npx-$(date +%s)
309
+ cd /tmp/test-npx-$(date +%s)
310
+ npm init -y
311
+
312
+ # CRITICAL: This should work without ANY prior installation
313
+ npx agnosticui-cli@alpha init --framework vue
314
+ npx agnosticui-cli@alpha add button input
315
+ ```
316
+
317
+ ### 5. Test Different Version Tags
318
+
319
+ ```bash
320
+ # Test specific version
321
+ ag init --framework react --version 2.0.0-alpha.1
322
+
323
+ # Test 'latest' tag (after stable release)
324
+ ag init --framework react --version latest
325
+ ```
326
+
327
+ ### 6. Verification Checklist
328
+
329
+ After publishing, verify:
330
+
331
+ - [ ] `npm info agnosticui-cli` shows correct version
332
+ - [ ] `npm info agnosticui-core` shows correct version
333
+ - [ ] `ag init` downloads from NPM (without --tarball flag)
334
+ - [ ] Fresh install in `/tmp` directory works
335
+ - [ ] `npx agnosticui-cli@alpha init` works without global install
336
+ - [ ] Components are correctly copied to project
337
+ - [ ] Config file is created properly
338
+
339
+ ### Troubleshooting Published Package
340
+
341
+ **Problem: "Failed to download agnosticui-core from NPM"**
342
+
343
+ ```bash
344
+ # Check if package is published
345
+ npm info agnosticui-core@alpha
346
+
347
+ # Check if you can manually download it
348
+ npm pack agnosticui-core@alpha
349
+ tar -tzf agnosticui-core-*.tgz # Should show package contents
350
+ ```
351
+
352
+ **Problem: CLI not found after global install**
353
+
354
+ ```bash
355
+ # Check install location
356
+ npm list -g agnosticui-cli
357
+
358
+ # Verify bin path
359
+ npm bin -g
360
+
361
+ # Reinstall
362
+ npm uninstall -g agnosticui-cli
363
+ npm install -g agnosticui-cli@alpha
364
+ ```
365
+
366
+ ## Development Notes
367
+
368
+ - All file operations preserve the structure: `core/` + `framework/`
369
+ - `npm pack` is more reliable than `npm link` for local testing
370
+ - Remember to rebuild (`npm run build`) and repack after making CLI changes
371
+ - The temp download directory `.tmp-ag-download` is automatically cleaned up after init
372
+
373
+ # AgnosticUI v2 - Publishing & Transition Guide
374
+
375
+ ## Package Naming Decision
376
+
377
+ Since `@agnosticui` organization is unavailable on npm, we'll use non-scoped packages matching your v1 pattern:
378
+
379
+ - **v1 packages**: `agnostic-angular`, `agnostic-react`, `agnostic-vue`, `agnostic-svelte`
380
+ - **v2 packages**: `agnosticui-core`, `agnosticui-cli`
381
+
382
+ This maintains consistency and leverages your existing npm namespace.
383
+
384
+ ---
385
+
386
+ ## CORRECTED EXECUTION ORDER
387
+
388
+ ### Phase 1: Repository Restructuring (DO THIS FIRST!)
389
+
390
+ **Why first?** Clean up the repo structure before publishing. Publishing is the final validation step.
391
+
392
+ #### 1.1 Create Safety Backups
393
+
394
+ ```bash
395
+ # Ensure you're on the latest master
396
+ git checkout master
397
+ git pull origin master
398
+
399
+ # Create backup branch
400
+ git branch backup-before-v2-transition
401
+ git push origin backup-before-v2-transition
402
+
403
+ # Create v1-legacy branch for historical reference
404
+ git checkout -b v1-legacy
405
+ git push origin v1-legacy
406
+ ```
407
+
408
+ #### 1.2 Protect v1-legacy Branch (GitHub Settings)
409
+
410
+ - Go to: Settings β†’ Branches β†’ Add branch protection rule
411
+ - Branch name: `v1-legacy`
412
+ - Enable: "Lock branch" (read-only)
413
+ - Save
414
+
415
+ #### 1.3 Clean Master Branch
416
+
417
+ ```bash
418
+ # Return to master
419
+ git checkout master
420
+
421
+ # Document what's being removed
422
+ ls -la | grep -E "(agnostic-|site)" > v1-directories-removed.txt
423
+ git add v1-directories-removed.txt
424
+ git commit -m "docs: record v1 directories before removal"
425
+
426
+ # Remove v1 directories
427
+ git rm -rf agnostic-angular/
428
+ git rm -rf agnostic-react/
429
+ git rm -rf agnostic-vue/
430
+ git rm -rf agnostic-svelte/
431
+ git rm -rf site/
432
+ git rm -rf agnostic-astro/ # if exists
433
+ git rm -rf agnostic-preact/ # if exists
434
+ # Remove any other v1-specific directories
435
+
436
+ git commit -m "chore: remove v1 directories, preparing for v2 as primary"
437
+ ```
438
+
439
+ #### 1.4 Merge v2 into Master
440
+
441
+ ```bash
442
+ # Merge v2 feature branch
443
+ git merge feature/agnosticui-v2-integration --no-ff -m "feat: merge AgnosticUI v2
444
+
445
+ - Complete rewrite with CLI-first approach
446
+ - Web Components architecture
447
+ - Support for React, Vue, Lit, Svelte
448
+ - Local component management
449
+ - Zero runtime dependencies"
450
+
451
+ # Push to master
452
+ git push origin master
453
+ ```
454
+
455
+ #### 1.5 Update Root Files
456
+
457
+ **Root README.md:**
458
+
459
+ ````markdown
460
+ # AgnosticUI v2
461
+
462
+ > The UI component kit that lives in your codebase
463
+
464
+ AgnosticUI v2 is a CLI-based UI component library that copies components directly into your project. You own the code, customize it freely, and avoid dependency lock-in.
465
+
466
+ ## Installation
467
+
468
+ ```bash
469
+ # Install CLI globally
470
+ npm install -g agnosticui-cli@alpha
471
+
472
+ # Or use with npx
473
+ npx agnosticui-cli@alpha init
474
+ ```
475
+ ````
476
+
477
+ ## Quick Start
478
+
479
+ ```bash
480
+ # Initialize in your project
481
+ ag init --framework react
482
+
483
+ # Add components
484
+ ag add button input card
485
+
486
+ # The components are now in your src/ - customize freely!
487
+ ```
488
+
489
+ ## Features
490
+
491
+ - 🎯 **CLI-First**: Copy components directly to your project
492
+ - πŸ”§ **You Own It**: Full control, no black boxes
493
+ - 🌐 **Framework Agnostic**: React, Vue, Lit, Svelte support
494
+ - 🎨 **Design Token System**: Consistent theming
495
+ - πŸ“¦ **Zero Runtime Deps**: Components work standalone
496
+ - β™Ώ **Accessible**: WCAG 2.1 AA compliant
497
+
498
+ ## Documentation
499
+
500
+ Visit [your-docs-url] for full documentation.
501
+
502
+ ## Looking for v1?
503
+
504
+ AgnosticUI v1 packages are available on the `v1-legacy` branch and still published on npm:
505
+
506
+ - `agnostic-angular`
507
+ - `agnostic-react`
508
+ - `agnostic-vue`
509
+ - `agnostic-svelte`
510
+
511
+ [View v1 Documentation](link-to-v1-docs)
512
+
513
+ ## License
514
+
515
+ MIT
516
+
517
+ ````
518
+
519
+ **Root package.json:**
520
+
521
+ ```json
522
+ {
523
+ "name": "agnosticui-monorepo",
524
+ "version": "2.0.0-alpha.1",
525
+ "private": true,
526
+ "description": "AgnosticUI v2 - The UI kit that lives in your codebase",
527
+ "workspaces": [
528
+ "v2/lib",
529
+ "v2/cli",
530
+ "v2/docs"
531
+ ],
532
+ "scripts": {
533
+ "build": "npm run build --workspaces",
534
+ "test": "npm run test --workspaces",
535
+ "docs:dev": "npm run dev --workspace=v2/docs",
536
+ "docs:build": "npm run build --workspace=v2/docs"
537
+ },
538
+ "repository": {
539
+ "type": "git",
540
+ "url": "https://github.com/yourusername/agnosticui.git"
541
+ },
542
+ "keywords": ["ui", "components", "cli", "design-system", "web-components"],
543
+ "author": "Your Name",
544
+ "license": "MIT"
545
+ }
546
+ ````
547
+
548
+ #### 1.6 Delete Feature Branch (After Verification)
549
+
550
+ ```bash
551
+ # Verify everything looks good on master
552
+ git log --oneline -10
553
+ git status
554
+
555
+ # Delete local feature branch
556
+ git branch -d feature/agnosticui-v2-integration
557
+
558
+ # Delete remote feature branch
559
+ git push origin --delete feature/agnosticui-v2-integration
560
+ ```
561
+
562
+ ---
563
+
564
+ ### Phase 2: Update Package Names for Non-Scoped Publishing
565
+
566
+ #### 2.1 Update Core Library package.json
567
+
568
+ **File: `v2/lib/package.json`**
569
+
570
+ ```json
571
+ {
572
+ "name": "agnosticui-core",
573
+ "version": "2.0.0-alpha.1",
574
+ "description": "AgnosticUI v2 Core - Web Components and framework adapters",
575
+ "main": "./dist/index.js",
576
+ "types": "./dist/index.d.ts",
577
+ "files": ["dist", "src", "README.md", "LICENSE"],
578
+ "publishConfig": {
579
+ "access": "public"
580
+ },
581
+ "keywords": [
582
+ "agnosticui",
583
+ "ui-components",
584
+ "web-components",
585
+ "design-system",
586
+ "react",
587
+ "vue",
588
+ "svelte",
589
+ "lit"
590
+ ],
591
+ "repository": {
592
+ "type": "git",
593
+ "url": "https://github.com/yourusername/agnosticui.git",
594
+ "directory": "v2/lib"
595
+ },
596
+ "author": "Rob Levin <rlevin@example.com>",
597
+ "license": "MIT",
598
+ "scripts": {
599
+ "build": "tsc",
600
+ "prepublishOnly": "npm run build"
601
+ }
602
+ }
603
+ ```
604
+
605
+ #### 2.2 Update CLI package.json
606
+
607
+ **File: `v2/cli/package.json`**
608
+
609
+ ```json
610
+ {
611
+ "name": "agnosticui-cli",
612
+ "version": "2.0.0-alpha.1",
613
+ "description": "AgnosticUI v2 CLI - Copy components directly to your project",
614
+ "bin": {
615
+ "ag": "./dist/cli.js"
616
+ },
617
+ "main": "./dist/index.js",
618
+ "types": "./dist/index.d.ts",
619
+ "files": ["dist", "README.md", "LICENSE"],
620
+ "publishConfig": {
621
+ "access": "public"
622
+ },
623
+ "keywords": [
624
+ "agnosticui",
625
+ "cli",
626
+ "ui-components",
627
+ "code-generator",
628
+ "component-library"
629
+ ],
630
+ "repository": {
631
+ "type": "git",
632
+ "url": "https://github.com/yourusername/agnosticui.git",
633
+ "directory": "v2/cli"
634
+ },
635
+ "author": "Rob Levin <rlevin@example.com>",
636
+ "license": "MIT",
637
+ "dependencies": {
638
+ "commander": "^12.0.0",
639
+ "ora": "^8.0.0",
640
+ "chalk": "^5.3.0",
641
+ "prompts": "^2.4.2",
642
+ "tar": "^7.0.0"
643
+ },
644
+ "scripts": {
645
+ "build": "tsc",
646
+ "prepublishOnly": "npm run build"
647
+ }
648
+ }
649
+ ```
650
+
651
+ #### 2.3 Update CLI to Reference New Package Name
652
+
653
+ **File: `v2/cli/src/commands/init.ts`**
654
+
655
+ Find and replace all references:
656
+
657
+ - `@agnosticui/core` β†’ `agnosticui-core`
658
+ - `@agnosticui/cli` β†’ `agnosticui-cli`
659
+
660
+ ```typescript
661
+ // Example: Update determineTarballPath() function
662
+ async function determineTarballPath(
663
+ version: string = "alpha"
664
+ ): Promise<string | null> {
665
+ try {
666
+ const { execSync } = await import("child_process");
667
+ const tmpDir = path.join(process.cwd(), ".tmp-ag-download");
668
+ await ensureDir(tmpDir);
669
+
670
+ // Download package - UPDATED PACKAGE NAME
671
+ execSync(`npm pack agnosticui-core@${version}`, {
672
+ cwd: tmpDir,
673
+ stdio: "pipe",
674
+ });
675
+
676
+ const files = await readdir(tmpDir);
677
+ const tarball = files.find(
678
+ (f) => f.startsWith("agnosticui-core-") && f.endsWith(".tgz")
679
+ );
680
+
681
+ if (tarball) {
682
+ return path.join(tmpDir, tarball);
683
+ }
684
+ } catch (error) {
685
+ logger.error("Failed to download agnosticui-core from npm");
686
+ }
687
+
688
+ return null;
689
+ }
690
+ ```
691
+
692
+ #### 2.4 Update Documentation References
693
+
694
+ Search and replace in all documentation files:
695
+
696
+ - `@agnosticui/core` β†’ `agnosticui-core`
697
+ - `@agnosticui/cli` β†’ `agnosticui-cli`
698
+
699
+ ---
700
+
701
+ ### Phase 3: Pre-Publishing Preparation
702
+
703
+ #### 3.1 Build and Verify Both Packages
704
+
705
+ ```bash
706
+ # Build core library
707
+ cd v2/lib
708
+ rm -rf dist/
709
+ npm install
710
+ npm run build
711
+ ls -la dist/ # Verify output
712
+
713
+ # Build CLI
714
+ cd v2/cli
715
+ rm -rf dist/
716
+ npm install
717
+ npm run build
718
+ ls -la dist/ # Verify output
719
+ node dist/cli.js --version # Should show 2.0.0-alpha.1
720
+ ```
721
+ And so we need to update src/cli.ts when version bumps.
722
+
723
+ #### 3.2 Test Locally with Pack
724
+
725
+ ```bash
726
+ # Test core library
727
+ cd v2/lib
728
+ npm pack --dry-run # Preview
729
+ npm pack # Creates: agnosticui-core-2.0.0-alpha.1.tgz
730
+ tar -tzf agnosticui-core-2.0.0-alpha.1.tgz # Inspect contents
731
+
732
+ # Test CLI
733
+ cd v2/cli
734
+ npm pack --dry-run
735
+ npm pack # Creates: agnosticui-cli-2.0.0-alpha.1.tgz
736
+ tar -tzf agnosticui-cli-2.0.0-alpha.1.tgz
737
+ ```
738
+
739
+ #### 3.3 Commit All Changes
740
+
741
+ ```bash
742
+ # From repo root
743
+ git status
744
+ git add .
745
+ git commit -m "chore: prepare v2.0.0-alpha.1 for npm publication
746
+
747
+ - Update package names to agnosticui-core and agnosticui-cli
748
+ - Configure publishConfig for public access
749
+ - Update CLI to reference new package names
750
+ - Update all documentation"
751
+
752
+ git push origin master
753
+ ```
754
+
755
+ #### 3.4 Verify v2/examples/{lit|react|vue}-test
756
+
757
+ Uninstall then reintall the CLI via local tarball then sync the core tarball:
758
+
759
+ ```shell
760
+ npm uninstall @agnosticui/cli
761
+ npm i ../../cli/agnosticui-cli-VERSION.tgz
762
+ npx ag sync --tarball ../lib/agnosticui-core-VERSION.tgz
763
+ # Test npx ag add COMPONENT(s) --force
764
+ npm run dev
765
+ ```
766
+
767
+ ---
768
+
769
+ ### Phase 4: Publish to npm
770
+
771
+ #### 4.1 Verify npm Login
772
+
773
+ ```bash
774
+ npm whoami # Should show: rlevin
775
+ ```
776
+
777
+ #### 4.2 Publish Core Library First
778
+
779
+ ```bash
780
+ cd v2/lib
781
+
782
+ # Final dry-run check
783
+ npm publish --dry-run --tag alpha
784
+
785
+ # Publish!
786
+ npm publish --tag alpha
787
+ ```
788
+
789
+ **Expected output:**
790
+
791
+ ```
792
+ + agnosticui-core@2.0.0-alpha.1
793
+ ```
794
+
795
+ #### 4.2b
796
+
797
+ I noticed the README.md had junk in it so I unfortunately did: npm unpublish, then fixed that and then went to publish but NPM will not let you republish within 24 hours, and, according to AI will require version bump.
798
+
799
+ TLDR:
800
+ 1) I learned my lesson about dangers of `unpublish`
801
+ 2) I'll just wait 24 hours
802
+ 3) Use `2.0.0-alpha.2` and continue to bump versions from there.
803
+
804
+ #### 4.3 Verify Core Publication
805
+
806
+ ```bash
807
+ npm info agnosticui-core
808
+ npm view agnosticui-core@alpha
809
+
810
+ agnosticui-core@2.0.0-alpha.2 | Proprietary | deps: 3 | versions: 1
811
+ AgnosticUI Core Library - Framework-agnostic, upgrade-safe web components built with Lit.
812
+
813
+ dependencies:
814
+ @floating-ui/dom: ^1.7.4 @lit/react: ^1.0.8 focus-trap: ^7.6.5
815
+
816
+ maintainers:
817
+ - rlevin <roblevinillustration@gmail.com>
818
+
819
+ dist-tags:
820
+ alpha: 2.0.0-alpha.1 latest: 2.0.0-alpha.1
821
+
822
+ published 48 seconds ago by rlevin <roblevinillustration@gmail.com>
823
+ npm view agnosticui-core dist-tags
824
+
825
+ # Visit on web
826
+ open https://www.npmjs.com/package/agnosticui-core
827
+ ```
828
+
829
+ #### 4.4 Publish CLI
830
+
831
+ ```bash
832
+ cd v2/cli
833
+
834
+ # Dry-run
835
+ npm publish --dry-run --tag alpha
836
+
837
+ # Publish!
838
+ npm publish --tag alpha
839
+ ```
840
+
841
+ **Expected output:**
842
+
843
+ ```
844
+ + agnosticui-cli@2.0.0-alpha.1
845
+ ```
846
+
847
+ #### 4.5 Verify CLI Publication
848
+
849
+ ```bash
850
+ npm info agnosticui-cli
851
+ npm view agnosticui-cli@alpha
852
+
853
+ open https://www.npmjs.com/package/agnosticui-cli
854
+ ```
855
+
856
+ ---
857
+
858
+ ### Phase 5: End-to-End Testing
859
+
860
+ #### 5.1 Test Installation Flow
861
+
862
+ ```bash
863
+ # Create fresh test directory
864
+ mkdir /tmp/test-agui-v2 && cd /tmp/test-agui-v2
865
+ npm init -y
866
+
867
+ # Install CLI globally
868
+ npm install -g agnosticui-cli@alpha
869
+
870
+ # Verify installation
871
+ ag --version
872
+ which ag
873
+
874
+ # Initialize project
875
+ ag init --framework vue
876
+
877
+ # Verify core was downloaded
878
+ ls -la agnosticui/
879
+
880
+ # Add components
881
+ ag add button
882
+ ag add input
883
+
884
+ # Verify components copied
885
+ ls -la src/components/ag/Button/
886
+ ls -la src/components/ag/Input/
887
+ ```
888
+
889
+ #### 5.2 Test with npx (No Installation)
890
+
891
+ ```bash
892
+ mkdir /tmp/test-npx && cd /tmp/test-npx
893
+ npm init -y
894
+
895
+ # Should work without global install
896
+ npx agnosticui-cli@alpha init --framework react
897
+ npx agnosticui-cli@alpha add button
898
+ ```
899
+
900
+ #### 5.3 Test with Different Package Managers
901
+
902
+ ```bash
903
+ # pnpm
904
+ pnpm add -g agnosticui-cli@alpha
905
+ ag init --framework svelte
906
+
907
+ # yarn
908
+ yarn global add agnosticui-cli@alpha
909
+ ag init --framework lit
910
+
911
+ # bun
912
+ bun add -g agnosticui-cli@alpha
913
+ ag init --framework react
914
+ ```
915
+
916
+ ---
917
+
918
+ ### Phase 6: Create Git Release
919
+
920
+ #### 6.1 Tag the Release
921
+
922
+ ```bash
923
+ # Create annotated tag
924
+ git tag -a v2.0.0-alpha.1 -m "AgnosticUI v2.0.0-alpha.1
925
+
926
+ First alpha release of AgnosticUI v2
927
+
928
+ Breaking Changes:
929
+ - Complete rewrite with CLI-first approach
930
+ - Web Components architecture instead of framework-specific packages
931
+
932
+ New Features:
933
+ - CLI for local component management
934
+ - Support for React, Vue, Lit, Svelte
935
+ - Design token system
936
+ - Zero runtime dependencies
937
+ - You own the code - customize freely
938
+
939
+ Published packages:
940
+ - agnosticui-core@2.0.0-alpha.1
941
+ - agnosticui-cli@2.0.0-alpha.1"
942
+
943
+ # Push tag
944
+ git push origin v2.0.0-alpha.1
945
+ ```
946
+
947
+ #### 6.2 Create GitHub Release
948
+
949
+ Go to: `https://github.com/yourusername/agnosticui/releases/new`
950
+
951
+ - **Tag**: `v2.0.0-alpha.1`
952
+ - **Title**: `AgnosticUI v2.0.0-alpha.1 - First Alpha Release πŸŽ‰`
953
+ - **Description**:
954
+
955
+ ````markdown
956
+ # AgnosticUI v2.0.0-alpha.1 πŸŽ‰
957
+
958
+ This is the first alpha release of AgnosticUI v2 - a complete rewrite with a CLI-first approach.
959
+
960
+ ## Installation
961
+
962
+ ```bash
963
+ npm install -g agnosticui-cli@alpha
964
+ ag init --framework react
965
+ ag add button input card
966
+ ```
967
+ ````
968
+
969
+ ## What's New in v2
970
+
971
+ - **CLI-First Approach**: Components are copied directly to your project
972
+ - **You Own the Code**: Full control, no black boxes
973
+ - **Web Components Core**: Framework-agnostic architecture
974
+ - **Multi-Framework Support**: React, Vue, Lit, Svelte
975
+ - **Design Token System**: Consistent theming across components
976
+ - **Zero Runtime Dependencies**: Components work standalone
977
+
978
+ ## Breaking Changes from v1
979
+
980
+ AgnosticUI v2 is a complete rewrite and is not compatible with v1. If you need v1, it remains available:
981
+
982
+ - Packages: `agnostic-angular`, `agnostic-react`, `agnostic-vue`, `agnostic-svelte`
983
+ - Branch: `v1-legacy`
984
+
985
+ ## Alpha Status
986
+
987
+ This is an **alpha release** for early testing and feedback. APIs may change before stable release.
988
+
989
+ ## Published Packages
990
+
991
+ - [agnosticui-core@2.0.0-alpha.1](https://www.npmjs.com/package/agnosticui-core)
992
+ - [agnosticui-cli@2.0.0-alpha.1](https://www.npmjs.com/package/agnosticui-cli)
993
+
994
+ ## Documentation
995
+
996
+ [Link to your docs]
997
+
998
+ ## Feedback
999
+
1000
+ Please report issues or provide feedback in [GitHub Discussions](link) or [Issues](link).
1001
+
1002
+ ````
1003
+
1004
+ - **Check**: "This is a pre-release"
1005
+ - Click "Publish release"
1006
+
1007
+ ---
1008
+
1009
+ ### Phase 7: Update Documentation
1010
+
1011
+ #### 7.1 Update Installation Guide
1012
+
1013
+ **File: `v2/docs/installation.md`**
1014
+
1015
+ ```markdown
1016
+ # Installation
1017
+
1018
+ ## Install the CLI
1019
+
1020
+ AgnosticUI v2 uses a CLI to copy components directly into your project.
1021
+
1022
+ ### Global Installation (Recommended)
1023
+
1024
+ ```bash
1025
+ npm install -g agnosticui-cli@alpha
1026
+ ````
1027
+
1028
+ ### Using npx (No Installation)
1029
+
1030
+ ```bash
1031
+ npx agnosticui-cli@alpha init
1032
+ ```
1033
+
1034
+ ### Other Package Managers
1035
+
1036
+ ```bash
1037
+ # pnpm
1038
+ pnpm add -g agnosticui-cli@alpha
1039
+
1040
+ # yarn
1041
+ yarn global add agnosticui-cli@alpha
1042
+
1043
+ # bun
1044
+ bun add -g agnosticui-cli@alpha
1045
+ ```
1046
+
1047
+ ## Initialize Your Project
1048
+
1049
+ ```bash
1050
+ # Interactive mode
1051
+ ag init
1052
+
1053
+ # Specify framework
1054
+ ag init --framework react
1055
+ ag init --framework vue
1056
+ ag init --framework svelte
1057
+ ag init --framework lit
1058
+ ```
1059
+
1060
+ This downloads `agnosticui-core` and sets up the reference library in `./agnosticui/`.
1061
+
1062
+ ## Add Components
1063
+
1064
+ ```bash
1065
+ # Add individual components
1066
+ ag add button
1067
+ ag add input card
1068
+
1069
+ # Add multiple at once
1070
+ ag add button input card dialog
1071
+ ```
1072
+
1073
+ Components are copied to `src/components/ag/` by default.
1074
+
1075
+ ## What Gets Installed?
1076
+
1077
+ - **Reference Library**: `./agnosticui/` contains the source components
1078
+ - **Your Components**: `src/components/ag/` contains copies you can modify
1079
+ - **No Dependencies**: Components work standalone, no runtime deps
1080
+
1081
+ ## Next Steps
1082
+
1083
+ - [Quick Start Guide](./quick-start.md)
1084
+ - [Component Customization](./customization.md)
1085
+ - [Design Tokens](./design-tokens.md)
1086
+
1087
+ ````
1088
+
1089
+ #### 7.2 Create Migration Guide
1090
+
1091
+ **File: `v2/docs/migration-v1-to-v2.md`**
1092
+
1093
+ ```markdown
1094
+ # Migrating from AgnosticUI v1 to v2
1095
+
1096
+ AgnosticUI v2 is a complete rewrite with a fundamentally different approach.
1097
+
1098
+ ## Key Differences
1099
+
1100
+ | Aspect | v1 | v2 |
1101
+ |--------|----|----|
1102
+ | **Installation** | `npm install agnostic-react` | `npm install -g agnosticui-cli` |
1103
+ | **Usage** | Import from package | Copy components to your project |
1104
+ | **Updates** | `npm update` | `ag sync` (opt-in) |
1105
+ | **Customization** | Limited | Full control - you own the code |
1106
+ | **Dependencies** | Runtime dependencies | Zero runtime deps |
1107
+ | **Architecture** | Framework-specific | Web Components + adapters |
1108
+
1109
+ ## Should You Migrate?
1110
+
1111
+ **Stick with v1 if:**
1112
+ - You have a production app working fine
1113
+ - You prefer traditional npm packages
1114
+ - You don't need heavy customization
1115
+
1116
+ **Consider v2 if:**
1117
+ - You want full control over components
1118
+ - You need extensive customization
1119
+ - You want to avoid dependency lock-in
1120
+ - You're starting a new project
1121
+
1122
+ ## Migration Steps
1123
+
1124
+ There's no automatic migration path. You'll need to:
1125
+
1126
+ 1. Install v2 CLI: `npm install -g agnosticui-cli@alpha`
1127
+ 2. Initialize in new directory: `ag init --framework [your-framework]`
1128
+ 3. Add components: `ag add button input card`
1129
+ 4. Port your customizations from v1 components
1130
+ 5. Update imports in your application
1131
+
1132
+ ## v1 Support
1133
+
1134
+ v1 packages remain available and supported:
1135
+ - Packages: `agnostic-angular`, `agnostic-react`, `agnostic-vue`, `agnostic-svelte`
1136
+ - Documentation: [v1 docs link]
1137
+ - Branch: `v1-legacy`
1138
+ ````
1139
+
1140
+ ---
1141
+
1142
+ ### Phase 8: Announce and Monitor
1143
+
1144
+ #### 8.1 Create GitHub Discussion
1145
+
1146
+ Go to your repo's Discussions β†’ Create new
1147
+
1148
+ **Title**: "AgnosticUI v2.0.0-alpha.1 Released! πŸŽ‰"
1149
+
1150
+ ````markdown
1151
+ Hi everyone! πŸ‘‹
1152
+
1153
+ I'm excited to announce the first alpha release of AgnosticUI v2!
1154
+
1155
+ ## What is AgnosticUI v2?
1156
+
1157
+ A CLI-based UI component library that copies components directly into your project. You own the code, customize it freely, and avoid dependency lock-in.
1158
+
1159
+ ## Try it out
1160
+
1161
+ ```bash
1162
+ npm install -g agnosticui-cli@alpha
1163
+ ag init --framework react
1164
+ ag add button input
1165
+ ```
1166
+ ````
1167
+
1168
+ ## This is Alpha
1169
+
1170
+ This is an early alpha for testing and feedback. APIs may change. Please:
1171
+
1172
+ - Report bugs in [Issues](link)
1173
+ - Share feedback here in Discussions
1174
+ - Test with your favorite framework
1175
+
1176
+ ## Links
1177
+
1178
+ - [Documentation](link)
1179
+ - [npm: agnosticui-cli](https://www.npmjs.com/package/agnosticui-cli)
1180
+ - [npm: agnosticui-core](https://www.npmjs.com/package/agnosticui-core)
1181
+
1182
+ Thanks for your interest! Looking forward to your feedback. πŸ™
1183
+
1184
+ ````
1185
+
1186
+ #### 8.2 Monitor
1187
+
1188
+ - Watch GitHub Issues for bugs
1189
+ - Check npm download stats: `npm info agnosticui-cli`
1190
+ - Respond to feedback promptly
1191
+ - Take notes for alpha.2 improvements
1192
+
1193
+ ---
1194
+
1195
+ ## Quick Reference: Commands
1196
+
1197
+ ```bash
1198
+ # Phase 1: Restructure repo
1199
+ git checkout master && git pull
1200
+ git branch backup-before-v2-transition
1201
+ git branch v1-legacy && git push origin v1-legacy
1202
+ git rm -rf agnostic-*/ site/
1203
+ git merge feature/agnosticui-v2-integration
1204
+ git push origin master
1205
+
1206
+ # Phase 2 & 3: Update and build
1207
+ # (Edit package.json files manually)
1208
+ cd v2/lib && npm install && npm run build && npm pack
1209
+ cd v2/cli && npm install && npm run build && npm pack
1210
+
1211
+ # Phase 4: Publish
1212
+ cd v2/lib && npm publish --tag alpha
1213
+ cd v2/cli && npm publish --tag alpha
1214
+
1215
+ # Phase 5: Test
1216
+ mkdir /tmp/test && cd /tmp/test
1217
+ npm install -g agnosticui-cli@alpha
1218
+ ag init --framework vue
1219
+ ag add button
1220
+
1221
+ # Phase 6: Release
1222
+ git tag -a v2.0.0-alpha.1 -m "Release v2.0.0-alpha.1"
1223
+ git push origin v2.0.0-alpha.1
1224
+ ````
1225
+
1226
+ ---
1227
+
1228
+ ## Future Alpha Releases
1229
+
1230
+ When ready for alpha.2:
1231
+
1232
+ ```bash
1233
+ # Increment versions
1234
+ cd v2/lib
1235
+ npm version prerelease --preid=alpha # 2.0.0-alpha.1 β†’ alpha.2
1236
+
1237
+ cd v2/cli
1238
+ npm version prerelease --preid=alpha
1239
+
1240
+ # Publish
1241
+ cd v2/lib && npm publish --tag alpha
1242
+ cd v2/cli && npm publish --tag alpha
1243
+
1244
+ # Tag git
1245
+ git tag -a v2.0.0-alpha.2 -m "Release v2.0.0-alpha.2"
1246
+ git push --tags
1247
+ ```
1248
+
1249
+ ---
1250
+
1251
+ ## Troubleshooting
1252
+
1253
+ ### "Package name already taken"
1254
+
1255
+ Non-scoped packages (`agnosticui-core`, `agnosticui-cli`) should be available since you already use the `agnostic-*` namespace. If someone squatted them:
1256
+
1257
+ 1. Check: `npm info agnosticui-core` and `npm info agnosticui-cli`
1258
+ 2. If truly taken, consider: `agnostic-ui-core`, `agnostic-ui-cli`
1259
+ 3. Or use scoped: `@rlevin/agnosticui-core`, `@rlevin/agnosticui-cli`
1260
+
1261
+ ### CLI can't download core package
1262
+
1263
+ ```bash
1264
+ # Test manually
1265
+ npm pack agnosticui-core@alpha
1266
+
1267
+ # If that works, check CLI code in init.ts
1268
+ ```