@oprt/cli 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +91 -2
- package/dist/bin.js +1653 -0
- package/dist/contract.json +1 -0
- package/dist/index.cjs +1445 -0
- package/dist/index.d.cts +211 -0
- package/dist/index.d.ts +211 -0
- package/dist/index.js +1400 -0
- package/dist/read-8a9euzJx.d.cts +246 -0
- package/dist/read-8a9euzJx.d.ts +246 -0
- package/dist/read.cjs +283 -0
- package/dist/read.d.cts +1 -0
- package/dist/read.d.ts +1 -0
- package/dist/read.js +250 -0
- package/dist/registry.json +1 -0
- package/package.json +64 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OPERATOR 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/README.md
CHANGED
|
@@ -1,3 +1,92 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OPERATOR source installer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@oprt/cli` provides the `oprt` executable for Node.js 22 and newer.
|
|
4
|
+
`npx @oprt/cli add button` runs it without installing anything.
|
|
5
|
+
It ships source bundles for every `@oprt/react` component family and every
|
|
6
|
+
operational recipe.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
oprt list
|
|
10
|
+
oprt list --json
|
|
11
|
+
oprt add button filter-bar --out src/operator
|
|
12
|
+
oprt add asset-management --dry-run
|
|
13
|
+
oprt add Button --out src/operator --overwrite
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## For coding agents
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
oprt init --agent claude
|
|
20
|
+
oprt search "table with selection"
|
|
21
|
+
oprt component DataGrid --dense
|
|
22
|
+
oprt component --list
|
|
23
|
+
oprt check src
|
|
24
|
+
oprt doctor
|
|
25
|
+
oprt mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`init` writes a block of instructions (house rules, one line per component, the recipes)
|
|
29
|
+
into the file an agent reads on every turn: `AGENTS.md` by default, `CLAUDE.md` or
|
|
30
|
+
`.cursor/rules/operator.mdc` with `--agent`, any file inside the project with `--path`.
|
|
31
|
+
Running it again replaces only the block. `search` ranks components and recipes by need.
|
|
32
|
+
`component` prints one component's props, what each option value is for, its nesting rules
|
|
33
|
+
and its example. `check` reads `.tsx` and `.jsx` files with the project's own TypeScript and
|
|
34
|
+
reports invalid option values, unknown exports, forbidden nesting, missing required props
|
|
35
|
+
and breaks of the house rules; it exits `1` on an error. `doctor` checks the project's
|
|
36
|
+
setup. `mcp` serves the lookups and the check over the Model Context Protocol on stdin and
|
|
37
|
+
stdout, with no dependencies.
|
|
38
|
+
|
|
39
|
+
Each of these takes `--json` and answers `{ "apiVersion": 1, "type": "…", "data": … }`. A
|
|
40
|
+
failure is `{ "apiVersion": 1, "error": "…", "code": "ERR_…", "suggestions": […] }`; codes
|
|
41
|
+
are stable and only ever added to. All of it is drawn from `dist/contract.json`, which ships
|
|
42
|
+
beside the registry: the component contract, its guidance and the names
|
|
43
|
+
`@oprt/react` exports. `@oprt/cli/read` exports the readers without the
|
|
44
|
+
registry, for building pages from the same contract.
|
|
45
|
+
|
|
46
|
+
## Copying source
|
|
47
|
+
|
|
48
|
+
Names accept PascalCase or kebab-case. The default output directory is
|
|
49
|
+
`src/components/operator`. For example, `add button --out src/operator` creates
|
|
50
|
+
`src/operator/Button/Button.tsx`, its index and manifest, and the support files it
|
|
51
|
+
imports. Multiple requested entries share one deduplicated set of source files.
|
|
52
|
+
Copied TSX files retain or receive a `"use client"` boundary.
|
|
53
|
+
|
|
54
|
+
Run the command from the consumer project. Output must be a relative directory
|
|
55
|
+
inside that working directory. Absolute paths, traversal, and symlink ancestors
|
|
56
|
+
or file targets are rejected. The complete request is checked before writes:
|
|
57
|
+
different existing files cause an error unless `--overwrite` is set; identical
|
|
58
|
+
files are skipped. `--dry-run` reports the planned files without creating files
|
|
59
|
+
or directories, and still reports conflicts that would prevent installation.
|
|
60
|
+
|
|
61
|
+
The package ships its registry once, as `dist/registry.json`, and `bin.js` and
|
|
62
|
+
the library read it from beside themselves. The executable therefore needs
|
|
63
|
+
neither this repository nor the network, but it cannot be copied away from that
|
|
64
|
+
file. It reports external source dependencies, each with the version range the
|
|
65
|
+
sources were verified against, and the React/Tailwind/token setup. Packages that
|
|
66
|
+
the copied source imports only for their types (React Aria, for a text input) are
|
|
67
|
+
listed separately as dev dependencies. Install missing dependencies yourself,
|
|
68
|
+
make sure Tailwind scans your output directory (Tailwind 4 does inside your
|
|
69
|
+
project; add an `@source` line for one outside it), and load OPERATOR's token CSS. The
|
|
70
|
+
installer does not run package managers or change your package configuration.
|
|
71
|
+
Recipe imports from `@oprt/react` remain package imports.
|
|
72
|
+
|
|
73
|
+
`list --json` returns `{ "version": "…", "entries": […], "ranges": {…} }`. Each
|
|
74
|
+
entry includes `name`, `slug`, `kind` (`component` or `recipe`), `description`,
|
|
75
|
+
`files`, `dependencies` (every external package its source imports) and
|
|
76
|
+
`devDependencies` (the subset imported only for types). `ranges` maps each
|
|
77
|
+
external package to its version range. `--version` uses the package version. Exit codes are `0` for
|
|
78
|
+
success, `2` for usage errors or unknown entries, and `1` for file conflicts or
|
|
79
|
+
other execution failures.
|
|
80
|
+
|
|
81
|
+
The library exports `registry`, `VERSION`, `parseArgs`, `resolveEntries`, and
|
|
82
|
+
`install`, with their TypeScript contracts. `install(options, { cwd })` supports
|
|
83
|
+
the same names, output directory, dry-run, and overwrite options as the command.
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
The build consumes the aggregated manifest and current React sources. Run the
|
|
88
|
+
workspace build to prepare those inputs, then use this package's `build`, `test`,
|
|
89
|
+
`typecheck`, and `lint` scripts. Registry generation follows actual relative
|
|
90
|
+
imports and exports, includes each dependency family's index and manifest, and
|
|
91
|
+
validates each recipe's local source bundle. Tests execute the built binary from
|
|
92
|
+
temporary consumer directories.
|