@hobui/viui-cli 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/cli.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @hobui/viui-cli
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
CLI to sync i-design-system `.cursor` (rules, skills, commands, plans) into consumer repos. Use this so Cursor/AI in the consumer repo follows the same design system rules, tokens, and BEM conventions.
|
|
4
5
|
|
|
5
|
-
**Scope:** Published
|
|
6
|
+
**Scope:** Published as `@hobui/viui-cli`. Consumer installs with `pnpm add @hobui/viui-cli`.
|
|
6
7
|
|
|
7
8
|
## One-command UX (recommended)
|
|
8
9
|
|
|
9
10
|
At the consumer repo root, run:
|
|
10
11
|
|
|
11
12
|
```bash
|
|
12
|
-
pnpm add @
|
|
13
|
+
pnpm add @hobui/viui-cli
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
After install, **postinstall** runs an interactive **setup wizard** (only when the terminal is interactive — not in CI):
|
|
@@ -24,7 +25,7 @@ No need to run `viui-cli init` or `pnpm add @viui/web` separately. To run the wi
|
|
|
24
25
|
|
|
25
26
|
| Command | Description |
|
|
26
27
|
| --------- | ----------- |
|
|
27
|
-
| `setup` | Interactive wizard: init/sync .cursor, install @viui/web, optional postinstall. Runs automatically after `pnpm add @
|
|
28
|
+
| `setup` | Interactive wizard: init/sync .cursor, install @viui/web, optional postinstall. Runs automatically after `pnpm add @hobui/viui-cli` (postinstall). |
|
|
28
29
|
| `init` | Create `.cursor/` at repo root and copy rules, skills, commands (and optionally plans). Run once when onboarding. |
|
|
29
30
|
| `sync` | Update existing `.cursor/` from the design system (overwrite). Use after design system updates. |
|
|
30
31
|
| `version` | Print CLI version and, if present, the synced design system version (from `.cursor/.design-system-version`). |
|
|
@@ -34,14 +35,14 @@ No need to run `viui-cli init` or `pnpm add @viui/web` separately. To run the wi
|
|
|
34
35
|
**From npm (after publish) — one command:**
|
|
35
36
|
|
|
36
37
|
```bash
|
|
37
|
-
pnpm add @
|
|
38
|
+
pnpm add @hobui/viui-cli
|
|
38
39
|
# then follow the setup wizard (Y/n per step)
|
|
39
40
|
```
|
|
40
41
|
|
|
41
42
|
**Manual steps (if you skip the wizard):**
|
|
42
43
|
|
|
43
44
|
```bash
|
|
44
|
-
pnpm add -D @
|
|
45
|
+
pnpm add -D @hobui/viui-cli
|
|
45
46
|
pnpm exec viui-cli init
|
|
46
47
|
pnpm add @viui/web
|
|
47
48
|
```
|
|
@@ -59,12 +60,12 @@ pnpm add @viui/web
|
|
|
59
60
|
|
|
60
61
|
```bash
|
|
61
62
|
node path/to/i-design-system/packages/cli/dist/cli.js init
|
|
62
|
-
# or: pnpm exec --prefix path/to/i-design-system/packages/cli @
|
|
63
|
+
# or: pnpm exec --prefix path/to/i-design-system/packages/cli @hobui/viui-cli init
|
|
63
64
|
```
|
|
64
65
|
|
|
65
66
|
Always run `init` or `sync` from the **consumer repo root** (CWD = root). If you run from another folder (e.g. i-design-system), the wrong `.cursor` will be updated. The CLI logs `Syncing .cursor at: <path>` so you can confirm the target.
|
|
66
67
|
|
|
67
|
-
**Auto-sync after install:** If the consumer has `@
|
|
68
|
+
**Auto-sync after install:** If the consumer has `@hobui/viui-cli` as a dependency (e.g. `"@hobui/viui-cli": "file:../../i-design-system/packages/cli"`), add a script so `.cursor` is synced automatically after each `pnpm install`:
|
|
68
69
|
|
|
69
70
|
```json
|
|
70
71
|
"scripts": {
|
|
@@ -133,4 +134,4 @@ Then import components: `import { ViButton, ViInput, ... } from '@viui/web'`. Se
|
|
|
133
134
|
pnpm build
|
|
134
135
|
```
|
|
135
136
|
|
|
136
|
-
Runs `tsc` and copies `.cursor` from repo root into `dist/assets/cursor/`, and writes `.design-system-version` from root `package.json`. Published package includes `dist/` so `npx @
|
|
137
|
+
Runs `tsc` and copies `.cursor` from repo root into `dist/assets/cursor/`, and writes `.design-system-version` from root `package.json`. Published package includes `dist/` so `npx @hobui/viui-cli init` works without the source repo.
|
package/dist/cli.js
CHANGED
|
@@ -250,7 +250,7 @@ async function runSetup(cwd, assetsDir, opts) {
|
|
|
250
250
|
return defaultYes;
|
|
251
251
|
return s === 'y' || s === 'yes';
|
|
252
252
|
};
|
|
253
|
-
console.log('
|
|
253
|
+
console.log(`\n${pkg.name ?? '@viui/cli'} — Setup i-design-system in this repo\n`);
|
|
254
254
|
const runNow = opts.yes || (await ask('Run setup now?', true));
|
|
255
255
|
if (!runNow) {
|
|
256
256
|
console.log('Skipped. Run later: pnpm exec viui-cli setup');
|
|
@@ -308,7 +308,7 @@ const { values } = result;
|
|
|
308
308
|
const positionals = result.positionals ?? [];
|
|
309
309
|
const [command] = positionals;
|
|
310
310
|
if (values.version && !command) {
|
|
311
|
-
console.log(
|
|
311
|
+
console.log(`${pkg.name ?? '@viui/cli'} ${pkg.version}`);
|
|
312
312
|
const cwd = process.cwd();
|
|
313
313
|
const versionFile = path.join(cwd, '.cursor', '.design-system-version');
|
|
314
314
|
if (fs.existsSync(versionFile)) {
|
|
@@ -318,14 +318,14 @@ if (values.version && !command) {
|
|
|
318
318
|
}
|
|
319
319
|
if (values.help || !command || command === 'help') {
|
|
320
320
|
console.log(`
|
|
321
|
-
@viui/cli — Sync design system .cursor into your repo
|
|
321
|
+
${pkg.name ?? '@viui/cli'} — Sync design system .cursor into your repo
|
|
322
322
|
|
|
323
323
|
Usage: viui-cli <command> [options]
|
|
324
324
|
|
|
325
325
|
Commands:
|
|
326
326
|
init Create .cursor and copy rules, skills, commands (run once at repo root)
|
|
327
327
|
sync Update .cursor from design system (overwrite)
|
|
328
|
-
setup Interactive setup: init/sync .cursor, install @viui/web, optional postinstall (runs after pnpm add @viui/cli)
|
|
328
|
+
setup Interactive setup: init/sync .cursor, install @viui/web, optional postinstall (runs after pnpm add ${pkg.name ?? '@viui/cli'})
|
|
329
329
|
version Print CLI and design system version
|
|
330
330
|
|
|
331
331
|
Setup options:
|
|
@@ -348,12 +348,12 @@ Global:
|
|
|
348
348
|
-h, --help Show this help
|
|
349
349
|
-v, --version Print version
|
|
350
350
|
|
|
351
|
-
One-command UX: pnpm add @viui/cli — then follow the setup steps. Or run: viui-cli setup
|
|
351
|
+
One-command UX: pnpm add ${pkg.name ?? '@viui/cli'} — then follow the setup steps. Or run: viui-cli setup
|
|
352
352
|
`);
|
|
353
353
|
process.exit(0);
|
|
354
354
|
}
|
|
355
355
|
if (command === 'version') {
|
|
356
|
-
console.log(
|
|
356
|
+
console.log(`${pkg.name ?? '@viui/cli'} ${pkg.version}`);
|
|
357
357
|
const cwd = process.cwd();
|
|
358
358
|
const versionFile = path.join(cwd, '.cursor', '.design-system-version');
|
|
359
359
|
if (fs.existsSync(versionFile)) {
|