@usalyt/cli 0.0.0-stage → 0.0.1
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 +15 -0
- package/LICENSE +674 -0
- package/NOTICE +32 -0
- package/README.md +241 -2
- package/THIRD_PARTY_NOTICES.md +446 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +653 -0
- package/package.json +46 -3
- package/src/commands/add.ts +199 -0
- package/src/commands/init.ts +103 -0
- package/src/commands/list.ts +54 -0
- package/src/index.ts +20 -0
- package/src/lib/config.ts +111 -0
- package/src/lib/imports.ts +92 -0
- package/src/lib/install.ts +225 -0
- package/src/lib/output.ts +7 -0
- package/src/lib/paths.ts +99 -0
- package/src/lib/registry.ts +120 -0
- package/tsdown.config.ts +9 -0
package/NOTICE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Usalyt licensing notice
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2026 Pablo Pincay Alvarez, Ricardo Villamar and Usalyt contributors.
|
|
4
|
+
|
|
5
|
+
The `usalyt` workspace and five of its public packages are distributed under the GNU General Public License, version 3 only (`GPL-3.0-only`). `@usalyt/tsconfig` is the package-scoped exception and is licensed under the MIT License. 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` | `GPL-3.0-only` |
|
|
12
|
+
| `@usalyt/registry` | `GPL-3.0-only` |
|
|
13
|
+
| `@usalyt/cli` | `GPL-3.0-only` |
|
|
14
|
+
| `@usalyt/mcp-server` | `GPL-3.0-only` |
|
|
15
|
+
| `@usalyt/eslint-config` | `GPL-3.0-only` |
|
|
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 the corresponding object code. The project repository referenced by the package metadata is `https://github.com/Usalyt/ui` (`usalyt/` directory). The source included in each public package tarball also remains available to its recipients.
|
|
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
|
+
- `packages/tsconfig` retains its original `MIT` declaration by explicit owner decision. The preserved baseline manifest declared `MIT`; no upstream copyright notice or provenance record was found in the checked-in files. This notice does not identify an upstream author, claim new ownership, or assert permissions beyond the MIT text in that package's `LICENSE`.
|
|
31
|
+
- 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.
|
|
32
|
+
- This notice records the available evidence. It is not a legal certification.
|
package/README.md
CHANGED
|
@@ -1,3 +1,242 @@
|
|
|
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.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
usalyt init # prompt for aliases when the terminal is interactive
|
|
44
|
+
usalyt init --yes # accept the default aliases without prompting
|
|
45
|
+
usalyt init --overwrite
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Defaults:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"style": "default",
|
|
53
|
+
"rsc": true,
|
|
54
|
+
"tsx": true,
|
|
55
|
+
"tailwind": {
|
|
56
|
+
"config": "",
|
|
57
|
+
"css": "src/styles/globals.css",
|
|
58
|
+
"baseColor": "neutral"
|
|
59
|
+
},
|
|
60
|
+
"aliases": {
|
|
61
|
+
"components": "@/src/components/ui",
|
|
62
|
+
"utils": "@/src/lib/utils"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If `usalyt.json` already exists, `init` exits non-zero and leaves the file
|
|
68
|
+
byte-identical. `--overwrite` replaces it explicitly. The command does not write
|
|
69
|
+
a hosted `$schema` URL.
|
|
70
|
+
|
|
71
|
+
### `usalyt add`
|
|
72
|
+
|
|
73
|
+
Installs one or more registry items, plus every transitive
|
|
74
|
+
`registryDependencies` entry (including the shared `utils` item).
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
usalyt add button
|
|
78
|
+
usalyt add button badge dialog
|
|
79
|
+
usalyt add auth-form
|
|
80
|
+
usalyt add --all
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Flags:
|
|
84
|
+
|
|
85
|
+
| Flag | Behavior |
|
|
86
|
+
| ----------------- | ------------------------------------------------------------------------ |
|
|
87
|
+
| `--all`, `-a` | Install every registry item. |
|
|
88
|
+
| `--overwrite`, `-o` | Replace existing destination files. Without it, any conflict aborts the whole command before writing. |
|
|
89
|
+
| `--install` | Run the printed `pnpm add ...` command after confirming consent. |
|
|
90
|
+
| `--yes`, `-y` | Confirm dependency installation without an interactive prompt. |
|
|
91
|
+
|
|
92
|
+
For every planned file the CLI:
|
|
93
|
+
|
|
94
|
+
1. Resolves the destination from the configured alias and normalizes it
|
|
95
|
+
against the consumer root.
|
|
96
|
+
2. Rejects absolute aliases and any destination that resolves outside the root,
|
|
97
|
+
including through an existing symbolic link.
|
|
98
|
+
3. Rewrites registry-internal relative imports so they point at the installed
|
|
99
|
+
files.
|
|
100
|
+
4. Detects existing files before writing anything. Any conflict without
|
|
101
|
+
`--overwrite` exits non-zero and leaves the project unchanged.
|
|
102
|
+
|
|
103
|
+
Unknown component names also exit non-zero and write nothing.
|
|
104
|
+
|
|
105
|
+
#### Aliases and import rewriting
|
|
106
|
+
|
|
107
|
+
Aliases are destination paths relative to the consumer root. A leading `@/` or
|
|
108
|
+
`~/` is accepted for readability and is equivalent to the consumer root:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"aliases": {
|
|
113
|
+
"components": "@/components/ui",
|
|
114
|
+
"utils": "@/lib/utils"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- `components` is the directory that receives one subdirectory per item.
|
|
120
|
+
- `utils` is the destination file for the shared `cn()` helper. The CLI appends
|
|
121
|
+
`.ts` when the alias has no file extension.
|
|
122
|
+
- Registry-internal relative imports are rewritten to relative imports between
|
|
123
|
+
the installed files, so the generated source resolves without relying on the
|
|
124
|
+
consumer's TypeScript path mapping.
|
|
125
|
+
|
|
126
|
+
#### Dependencies
|
|
127
|
+
|
|
128
|
+
`add` collects the npm dependencies of every installed item, including
|
|
129
|
+
transitive registry dependencies, and prints one exact command:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
Dependencies: pnpm add @base-ui/react class-variance-authority clsx lucide-react tailwind-merge
|
|
133
|
+
Dependencies were not installed. Run the command above, or pass --install --yes to execute it.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The CLI never runs npm or yarn. `--install` without `--yes` asks for
|
|
137
|
+
confirmation when the terminal is interactive; in a non-interactive session it
|
|
138
|
+
prints the command and skips execution. `--install --yes` executes
|
|
139
|
+
`pnpm add ...` in the consumer root without prompting.
|
|
140
|
+
|
|
141
|
+
Example session:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
$ usalyt init --yes
|
|
145
|
+
Created usalyt.json at /home/user/app/usalyt.json
|
|
146
|
+
components: @/src/components/ui
|
|
147
|
+
utils: @/src/lib/utils
|
|
148
|
+
|
|
149
|
+
$ usalyt add button
|
|
150
|
+
Installed 2 item(s) (1 requested, 1 registry dependencies):
|
|
151
|
+
+ src/lib/utils.ts
|
|
152
|
+
+ src/components/ui/button/button.tsx
|
|
153
|
+
+ src/components/ui/button/index.ts
|
|
154
|
+
Dependencies: pnpm add @base-ui/react class-variance-authority clsx lucide-react tailwind-merge
|
|
155
|
+
Dependencies were not installed. Run the command above, or pass --install --yes to execute it.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### `usalyt list`
|
|
159
|
+
|
|
160
|
+
Lists the items in the packaged registry.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
usalyt list
|
|
164
|
+
usalyt list --json
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`--json` prints a single JSON document with `name`, `version`, `count`, and an
|
|
168
|
+
`items` array (`name`, `type`, `title`, `description`, `license`,
|
|
169
|
+
`dependencies`, `registryDependencies`). No human-readable text is mixed into
|
|
170
|
+
the JSON output.
|
|
171
|
+
|
|
172
|
+
## Exit status
|
|
173
|
+
|
|
174
|
+
- `0`: the command completed as requested.
|
|
175
|
+
- non-zero: invalid usage, an unknown item, a missing registry, a write
|
|
176
|
+
conflict without `--overwrite`, an unsafe destination, or a failed
|
|
177
|
+
dependency installation.
|
|
178
|
+
|
|
179
|
+
Failures are reported on stderr. Rejected `add` requests do not write any files.
|
|
180
|
+
|
|
181
|
+
## Registry resolution
|
|
182
|
+
|
|
183
|
+
The CLI resolves `@usalyt/registry/registry.json` with Node package resolution
|
|
184
|
+
(`createRequire(import.meta.url).resolve(...)`) and reads it at runtime. If the
|
|
185
|
+
packaged registry cannot be found, the command exits non-zero with an
|
|
186
|
+
actionable message instead of silently using an empty catalog. A
|
|
187
|
+
monorepo-relative path exists only as a development fallback.
|
|
188
|
+
|
|
189
|
+
## License and source availability
|
|
190
|
+
|
|
191
|
+
`@usalyt/cli` is licensed `GPL-3.0-only`; the full text is in `LICENSE`. The
|
|
192
|
+
package ships the TypeScript source and build configuration needed to rebuild
|
|
193
|
+
the executable, so the corresponding source is distributed with the package.
|
|
194
|
+
The source repository is recorded in `package.json`. Third-party dependency
|
|
195
|
+
licenses are recorded in `THIRD_PARTY_NOTICES.md`; the inventory is an audit of
|
|
196
|
+
declared licenses, not a legal certification. The commercial Berkeley Mono font
|
|
197
|
+
is not bundled.
|
|
198
|
+
|
|
199
|
+
## Version 0.0.1 changelog
|
|
200
|
+
|
|
201
|
+
- Initial Usalyt release candidate under the `@usalyt/cli` identity and the
|
|
202
|
+
`usalyt` executable.
|
|
203
|
+
- Packaged registry resolution through `@usalyt/registry`, independent of the
|
|
204
|
+
current working directory.
|
|
205
|
+
- `init` creates `usalyt.json` and refuses implicit replacement.
|
|
206
|
+
- `add` resolves transitive registry dependencies, rewrites relative imports,
|
|
207
|
+
enforces consumer-root containment (including symlink escapes), refuses
|
|
208
|
+
overwrite conflicts before writing, and requires explicit consent before
|
|
209
|
+
installing npm dependencies.
|
|
210
|
+
- `list` supports human-readable and `--json` output.
|
|
211
|
+
- `GPL-3.0-only` license, notices, and source-availability guidance.
|
|
212
|
+
|
|
213
|
+
See `CHANGELOG.md` for the maintained changelog. This is an initial `0.0.1`
|
|
214
|
+
release candidate, not a stability or compatibility guarantee.
|
|
215
|
+
|
|
216
|
+
## Development
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
pnpm --filter @usalyt/cli build
|
|
220
|
+
node --test packages/cli/tests/cli.test.mjs
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Tests run the built `dist/index.mjs` against isolated consumers under
|
|
224
|
+
`packages/cli/.tmp/` and never install dependencies.
|
|
225
|
+
|
|
226
|
+
## Package layout
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
packages/cli/
|
|
230
|
+
├── src/
|
|
231
|
+
│ ├── commands/ # init, add, list
|
|
232
|
+
│ ├── lib/ # registry, config, path containment, install plan
|
|
233
|
+
│ └── index.ts # executable entry point (dist/index.mjs)
|
|
234
|
+
├── tests/ # node --test public-interface tests
|
|
235
|
+
├── dist/ # built executable
|
|
236
|
+
├── tsdown.config.ts
|
|
237
|
+
├── LICENSE
|
|
238
|
+
├── NOTICE
|
|
239
|
+
├── THIRD_PARTY_NOTICES.md
|
|
240
|
+
├── CHANGELOG.md
|
|
241
|
+
└── README.md
|
|
242
|
+
```
|