@usalyt/cli 0.0.0-stage → 0.0.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.
- package/CHANGELOG.md +23 -0
- package/LICENSE +21 -0
- package/NOTICE +31 -0
- package/README.md +255 -2
- package/THIRD_PARTY_NOTICES.md +446 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +2068 -0
- package/package.json +46 -3
- package/src/commands/add.ts +229 -0
- package/src/commands/diff.ts +130 -0
- package/src/commands/init.ts +271 -0
- package/src/commands/list.ts +54 -0
- package/src/commands/theme.ts +194 -0
- package/src/index.ts +25 -0
- package/src/lib/config.ts +141 -0
- package/src/lib/imports.ts +118 -0
- package/src/lib/install.ts +297 -0
- package/src/lib/output.ts +7 -0
- package/src/lib/paths.ts +125 -0
- package/src/lib/project.ts +218 -0
- package/src/lib/registry.ts +120 -0
- package/src/lib/theme.ts +161 -0
- package/tsdown.config.ts +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this package are recorded here. The Usalyt package set uses the fixed `0.0.1` version group until a deliberate versioning change is approved.
|
|
4
|
+
|
|
5
|
+
## [0.0.2](https://github.com/Usalyt/ui/compare/cli-v0.0.1...cli-v0.0.2) (2026-11-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **cli:** add theme injection, transitive dep skip, alias resolution, and diff ([090516c](https://github.com/Usalyt/ui/commit/090516c7621cdb5267df9e653e4e8808cf563605))
|
|
11
|
+
* **themes:** add parametric tokens, interactive docs Theme Studio, and CLI preset engine ([e932e53](https://github.com/Usalyt/ui/commit/e932e53fd25ca6c98afc56d69282509275b73b7b))
|
|
12
|
+
|
|
13
|
+
## 0.0.1 — 2026-11-07
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Initial Usalyt release candidate for `@usalyt/cli`.
|
|
18
|
+
- `GPL-3.0-only` license text and source-availability documentation.
|
|
19
|
+
- Package README with installation, supported imports, and release notes.
|
|
20
|
+
|
|
21
|
+
### Notes
|
|
22
|
+
|
|
23
|
+
- This is an initial `0.0.1` release candidate. It is not a stability or compatibility guarantee.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pablo Pincay Alvarez, Ricardo Villamar and Usalyt contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Usalyt licensing notice
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2026 Pablo Pincay Alvarez, Ricardo Villamar and Usalyt contributors.
|
|
4
|
+
|
|
5
|
+
The `usalyt` workspace and all six of its public packages are distributed under the MIT License (`MIT`). The complete license text for each package is in its own `LICENSE` file. There is no warranty, to the extent permitted by law.
|
|
6
|
+
|
|
7
|
+
## Package license map
|
|
8
|
+
|
|
9
|
+
| Package | License |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `@usalyt/ui` | `MIT` |
|
|
12
|
+
| `@usalyt/registry` | `MIT` |
|
|
13
|
+
| `@usalyt/cli` | `MIT` |
|
|
14
|
+
| `@usalyt/mcp-server` | `MIT` |
|
|
15
|
+
| `@usalyt/eslint-config` | `MIT` |
|
|
16
|
+
| `@usalyt/tsconfig` | `MIT` |
|
|
17
|
+
|
|
18
|
+
## Source availability
|
|
19
|
+
|
|
20
|
+
Each public package tarball includes its source entry points and build inputs so recipients can rebuild and customize the package. The project repository referenced by the package metadata is `https://github.com/Usalyt/ui`.
|
|
21
|
+
|
|
22
|
+
## Scope
|
|
23
|
+
|
|
24
|
+
This notice covers the `usalyt` workspace and its npm release workflow.
|
|
25
|
+
|
|
26
|
+
## Provenance
|
|
27
|
+
|
|
28
|
+
- Components and distribution patterns are derived from the shadcn/ui approach (MIT). The MIT notice for shadcn/ui is preserved in `THIRD_PARTY_NOTICES.md`.
|
|
29
|
+
- Base UI, React, Tailwind CSS, and the other direct dependencies keep their own licenses as listed in `THIRD_PARTY_NOTICES.md`.
|
|
30
|
+
- The Inter font is distributed under the SIL Open Font License 1.1 and is attributed in `THIRD_PARTY_NOTICES.md`. Berkeley Mono is a commercial typeface and is not bundled; the stylesheet only references a locally installed copy and documents the substitution.
|
|
31
|
+
- This notice records the available evidence. It is not a legal certification.
|
package/README.md
CHANGED
|
@@ -1,3 +1,256 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @usalyt/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Component distribution CLI for the Usalyt component platform. It installs the
|
|
4
|
+
registry source of Usalyt primitives and blocks into a consumer project, so the
|
|
5
|
+
installed code stays readable and editable.
|
|
6
|
+
|
|
7
|
+
- Registry data comes from the installed `@usalyt/registry` package. The CLI
|
|
8
|
+
does not read a sibling checkout or depend on the current working directory.
|
|
9
|
+
- Consumer configuration lives in `usalyt.json`.
|
|
10
|
+
- The executable is named `usalyt`.
|
|
11
|
+
- Every write is confined to the consumer root, and existing files are
|
|
12
|
+
preserved unless `--overwrite` is passed.
|
|
13
|
+
- Dependency installation is never implicit. The CLI prints the exact
|
|
14
|
+
`pnpm add ...` command and only runs it with `--install` plus confirmed
|
|
15
|
+
consent.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Node.js 20 or newer
|
|
20
|
+
- pnpm for dependency installation in the consumer project
|
|
21
|
+
|
|
22
|
+
## Run
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Recommended: run the published binary without a global install
|
|
26
|
+
pnpm dlx @usalyt/cli --help
|
|
27
|
+
|
|
28
|
+
# npm-compatible invocation
|
|
29
|
+
npx @usalyt/cli --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Both commands resolve the packaged registry through the installed
|
|
33
|
+
`@usalyt/registry` dependency.
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
### `usalyt init`
|
|
38
|
+
|
|
39
|
+
Creates `usalyt.json` in the current directory with component and utility
|
|
40
|
+
aliases, writes `usalyt-theme.css` next to the detected Tailwind CSS entry, and
|
|
41
|
+
adds `@import "./usalyt-theme.css";` so copied components have working design
|
|
42
|
+
tokens without installing `@usalyt/ui`. When `tsconfig.json` defines wildcard
|
|
43
|
+
path aliases (such as `"@/*": ["./src/*"]`), `init` aligns aliases to match.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
usalyt init # prompt for aliases and CSS entry when interactive
|
|
47
|
+
usalyt init --yes # accept detected defaults without prompting
|
|
48
|
+
usalyt init --no-theme # create usalyt.json without writing theme CSS
|
|
49
|
+
usalyt init --overwrite
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Defaults:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"style": "default",
|
|
57
|
+
"rsc": true,
|
|
58
|
+
"tsx": true,
|
|
59
|
+
"tailwind": {
|
|
60
|
+
"config": "",
|
|
61
|
+
"css": "src/styles/globals.css",
|
|
62
|
+
"baseColor": "neutral"
|
|
63
|
+
},
|
|
64
|
+
"aliases": {
|
|
65
|
+
"components": "@/src/components/ui",
|
|
66
|
+
"utils": "@/src/lib/utils"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If `usalyt.json` already exists, `init` exits non-zero and leaves the file
|
|
72
|
+
byte-identical. `--overwrite` replaces it explicitly. The command does not write
|
|
73
|
+
a hosted `$schema` URL.
|
|
74
|
+
|
|
75
|
+
### `usalyt add`
|
|
76
|
+
|
|
77
|
+
Installs one or more registry items, plus every transitive
|
|
78
|
+
`registryDependencies` entry (including the shared `utils` item).
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
usalyt add button
|
|
82
|
+
usalyt add button badge dialog
|
|
83
|
+
usalyt add auth-form
|
|
84
|
+
usalyt add --all
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Flags:
|
|
88
|
+
|
|
89
|
+
| Flag | Behavior |
|
|
90
|
+
| ----------------- | ------------------------------------------------------------------------ |
|
|
91
|
+
| `--all`, `-a` | Install every registry item. |
|
|
92
|
+
| `--overwrite`, `-o` | Replace existing destination files. Without it, existing transitive dependencies are skipped while conflicts on directly requested items abort before writing. |
|
|
93
|
+
| `--install` | Install missing npm dependencies using the detected package manager (`pnpm`, `npm`, `yarn`, or `bun`) after confirming consent. |
|
|
94
|
+
| `--yes`, `-y` | Confirm dependency installation without an interactive prompt. |
|
|
95
|
+
|
|
96
|
+
### `usalyt diff`
|
|
97
|
+
|
|
98
|
+
Compares locally installed components against the packaged registry (including
|
|
99
|
+
import rewriting and `rsc` settings) without overwriting local edits.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
usalyt diff # check all installed registry files
|
|
103
|
+
usalyt diff button # check a specific component
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For every planned file the CLI:
|
|
107
|
+
|
|
108
|
+
1. Resolves the destination from the configured alias and normalizes it
|
|
109
|
+
against the consumer root.
|
|
110
|
+
2. Rejects absolute aliases and any destination that resolves outside the root,
|
|
111
|
+
including through an existing symbolic link.
|
|
112
|
+
3. Rewrites registry-internal relative imports so they point at the installed
|
|
113
|
+
files.
|
|
114
|
+
4. Detects existing files before writing anything. Any conflict without
|
|
115
|
+
`--overwrite` exits non-zero and leaves the project unchanged.
|
|
116
|
+
|
|
117
|
+
Unknown component names also exit non-zero and write nothing.
|
|
118
|
+
|
|
119
|
+
#### Aliases and import rewriting
|
|
120
|
+
|
|
121
|
+
Aliases are destination paths relative to the consumer root. A leading `@/` or
|
|
122
|
+
`~/` is accepted for readability and is equivalent to the consumer root:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"aliases": {
|
|
127
|
+
"components": "@/components/ui",
|
|
128
|
+
"utils": "@/lib/utils"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- `components` is the directory that receives one subdirectory per item.
|
|
134
|
+
- `utils` is the destination file for the shared `cn()` helper. The CLI appends
|
|
135
|
+
`.ts` when the alias has no file extension.
|
|
136
|
+
- Registry-internal relative imports are rewritten to relative imports between
|
|
137
|
+
the installed files, so the generated source resolves without relying on the
|
|
138
|
+
consumer's TypeScript path mapping.
|
|
139
|
+
|
|
140
|
+
#### Dependencies
|
|
141
|
+
|
|
142
|
+
`add` collects the npm dependencies of every installed item, including
|
|
143
|
+
transitive registry dependencies, and prints one exact command:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
Dependencies: pnpm add @base-ui/react class-variance-authority clsx lucide-react tailwind-merge
|
|
147
|
+
Dependencies were not installed. Run the command above, or pass --install --yes to execute it.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The CLI never runs npm or yarn. `--install` without `--yes` asks for
|
|
151
|
+
confirmation when the terminal is interactive; in a non-interactive session it
|
|
152
|
+
prints the command and skips execution. `--install --yes` executes
|
|
153
|
+
`pnpm add ...` in the consumer root without prompting.
|
|
154
|
+
|
|
155
|
+
Example session:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
$ usalyt init --yes
|
|
159
|
+
Created usalyt.json at /home/user/app/usalyt.json
|
|
160
|
+
components: @/src/components/ui
|
|
161
|
+
utils: @/src/lib/utils
|
|
162
|
+
|
|
163
|
+
$ usalyt add button
|
|
164
|
+
Installed 2 item(s) (1 requested, 1 registry dependencies):
|
|
165
|
+
+ src/lib/utils.ts
|
|
166
|
+
+ src/components/ui/button/button.tsx
|
|
167
|
+
+ src/components/ui/button/index.ts
|
|
168
|
+
Dependencies: pnpm add @base-ui/react class-variance-authority clsx lucide-react tailwind-merge
|
|
169
|
+
Dependencies were not installed. Run the command above, or pass --install --yes to execute it.
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `usalyt list`
|
|
173
|
+
|
|
174
|
+
Lists the items in the packaged registry.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
usalyt list
|
|
178
|
+
usalyt list --json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`--json` prints a single JSON document with `name`, `version`, `count`, and an
|
|
182
|
+
`items` array (`name`, `type`, `title`, `description`, `license`,
|
|
183
|
+
`dependencies`, `registryDependencies`). No human-readable text is mixed into
|
|
184
|
+
the JSON output.
|
|
185
|
+
|
|
186
|
+
## Exit status
|
|
187
|
+
|
|
188
|
+
- `0`: the command completed as requested.
|
|
189
|
+
- non-zero: invalid usage, an unknown item, a missing registry, a write
|
|
190
|
+
conflict without `--overwrite`, an unsafe destination, or a failed
|
|
191
|
+
dependency installation.
|
|
192
|
+
|
|
193
|
+
Failures are reported on stderr. Rejected `add` requests do not write any files.
|
|
194
|
+
|
|
195
|
+
## Registry resolution
|
|
196
|
+
|
|
197
|
+
The CLI resolves `@usalyt/registry/registry.json` with Node package resolution
|
|
198
|
+
(`createRequire(import.meta.url).resolve(...)`) and reads it at runtime. If the
|
|
199
|
+
packaged registry cannot be found, the command exits non-zero with an
|
|
200
|
+
actionable message instead of silently using an empty catalog. A
|
|
201
|
+
monorepo-relative path exists only as a development fallback.
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
`@usalyt/cli` is licensed `MIT`; the full text is in `LICENSE`. The
|
|
206
|
+
package ships the TypeScript source and build configuration needed to rebuild
|
|
207
|
+
the executable.
|
|
208
|
+
The source repository is recorded in `package.json`. Third-party dependency
|
|
209
|
+
licenses are recorded in `THIRD_PARTY_NOTICES.md`; the inventory is an audit of
|
|
210
|
+
declared licenses, not a legal certification. The commercial Berkeley Mono font
|
|
211
|
+
is not bundled.
|
|
212
|
+
|
|
213
|
+
## Version 0.0.1 changelog
|
|
214
|
+
|
|
215
|
+
- Initial Usalyt release candidate under the `@usalyt/cli` identity and the
|
|
216
|
+
`usalyt` executable.
|
|
217
|
+
- Packaged registry resolution through `@usalyt/registry`, independent of the
|
|
218
|
+
current working directory.
|
|
219
|
+
- `init` creates `usalyt.json` and refuses implicit replacement.
|
|
220
|
+
- `add` resolves transitive registry dependencies, rewrites relative imports,
|
|
221
|
+
enforces consumer-root containment (including symlink escapes), refuses
|
|
222
|
+
overwrite conflicts before writing, and requires explicit consent before
|
|
223
|
+
installing npm dependencies.
|
|
224
|
+
- `list` supports human-readable and `--json` output.
|
|
225
|
+
- `GPL-3.0-only` license, notices, and source-availability guidance.
|
|
226
|
+
|
|
227
|
+
See `CHANGELOG.md` for the maintained changelog. This is an initial `0.0.1`
|
|
228
|
+
release candidate, not a stability or compatibility guarantee.
|
|
229
|
+
|
|
230
|
+
## Development
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
pnpm --filter @usalyt/cli build
|
|
234
|
+
node --test packages/cli/tests/cli.test.mjs
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Tests run the built `dist/index.mjs` against isolated consumers under
|
|
238
|
+
`packages/cli/.tmp/` and never install dependencies.
|
|
239
|
+
|
|
240
|
+
## Package layout
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
packages/cli/
|
|
244
|
+
├── src/
|
|
245
|
+
│ ├── commands/ # init, add, list
|
|
246
|
+
│ ├── lib/ # registry, config, path containment, install plan
|
|
247
|
+
│ └── index.ts # executable entry point (dist/index.mjs)
|
|
248
|
+
├── tests/ # node --test public-interface tests
|
|
249
|
+
├── dist/ # built executable
|
|
250
|
+
├── tsdown.config.ts
|
|
251
|
+
├── LICENSE
|
|
252
|
+
├── NOTICE
|
|
253
|
+
├── THIRD_PARTY_NOTICES.md
|
|
254
|
+
├── CHANGELOG.md
|
|
255
|
+
└── README.md
|
|
256
|
+
```
|