@oprt/cli 0.0.0-stage → 0.3.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 +116 -2
- package/dist/bin.js +2730 -0
- package/dist/contract.json +1 -0
- package/dist/index.cjs +2530 -0
- package/dist/index.d.cts +380 -0
- package/dist/index.d.ts +380 -0
- package/dist/index.js +2473 -0
- package/dist/read-C7rE5UlY.d.cts +273 -0
- package/dist/read-C7rE5UlY.d.ts +273 -0
- package/dist/read.cjs +284 -0
- package/dist/read.d.cts +1 -0
- package/dist/read.d.ts +1 -0
- package/dist/read.js +251 -0
- package/dist/registry.json +1 -0
- package/package.json +65 -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,117 @@
|
|
|
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
|
+
(`--limit` is a whole number from 1 to 50). `component` prints one component's props, what each
|
|
33
|
+
option value is for, its nesting rules and its example. `check` reads `.tsx` and `.jsx` files with
|
|
34
|
+
the project's own TypeScript (5 or 6; TypeScript 7 has no JavaScript syntax API to read with) and
|
|
35
|
+
reports invalid option values, unknown exports, forbidden nesting, missing required props and breaks
|
|
36
|
+
of the house rules. `doctor` says whether lookups and code checking can run here, one at a time,
|
|
37
|
+
and why checking is blocked when it is. `mcp` serves the lookups and the check over the Model
|
|
38
|
+
Context Protocol on stdin and stdout, with no dependencies.
|
|
39
|
+
|
|
40
|
+
`check` says how much it read. `evaluation_status` is `evaluated_clean` only when every file was
|
|
41
|
+
read in full and nothing was found; otherwise it is `evaluated_with_findings`,
|
|
42
|
+
`partially_evaluated` (a spread or computed option value it could not read is a limit, recorded
|
|
43
|
+
with its place; or some files did not parse), `not_evaluated` (no file parsed) or
|
|
44
|
+
`no_files_evaluated` (nothing was read, for example a Markdown file). A file that does not parse
|
|
45
|
+
is reported as `SYNTAX_ERROR` findings and is never clean. Types and rendering are not checked.
|
|
46
|
+
Exit codes: `0` when what was read has no errors (warnings fail only with `--strict`; limits do not
|
|
47
|
+
fail the run), `1` for an error, a file that did not parse, no file read, or no usable TypeScript,
|
|
48
|
+
`2` for a usage error or a path that does not exist.
|
|
49
|
+
|
|
50
|
+
Every command takes `--json`, `list` and `add` included, and answers
|
|
51
|
+
`{ "apiVersion": 1, "type": "…", "identity": {…}, "data": … }`. `identity` keeps four things
|
|
52
|
+
apart: `cli_version` (this package), `contract_version` (the `@oprt/react` version the contract
|
|
53
|
+
describes), `contract_digest` (`sha256:` of `dist/contract.json`) and `schema_version` (this
|
|
54
|
+
result format, the same number as `apiVersion`). A failure is
|
|
55
|
+
`{ "apiVersion": 1, "error": "…", "code": "ERR_…", "suggestions": […], "identity": {…} }`; codes
|
|
56
|
+
are stable and only ever added to. `component --dense --json` is a compact form of the same data.
|
|
57
|
+
`oprt mcp` returns the same envelope as each tool's structured result, with an `outputSchema` on
|
|
58
|
+
every tool (a summary of the full schema, so the tool list is about 5.4 KB); a check that finds problems is a successful call, and a call that could not run is an
|
|
59
|
+
error result. All of it is drawn from `dist/contract.json`, which ships beside the registry: the
|
|
60
|
+
component contract, its guidance and the names `@oprt/react` exports. `@oprt/cli/read` exports
|
|
61
|
+
the readers without the registry, for building pages from the same contract. The library exports
|
|
62
|
+
the schemas of every answer as `RESULT_SCHEMAS`.
|
|
63
|
+
|
|
64
|
+
## Copying source
|
|
65
|
+
|
|
66
|
+
Names accept PascalCase or kebab-case. The default output directory is
|
|
67
|
+
`src/components/operator`. For example, `add button --out src/operator` creates
|
|
68
|
+
`src/operator/Button/Button.tsx`, its index and manifest, and the support files it
|
|
69
|
+
imports. Multiple requested entries share one deduplicated set of source files.
|
|
70
|
+
Copied TSX files retain or receive a `"use client"` boundary.
|
|
71
|
+
|
|
72
|
+
Run the command from the consumer project. Output must be a relative directory
|
|
73
|
+
inside that working directory. Absolute paths, traversal, and symlink ancestors
|
|
74
|
+
or file targets are rejected. The complete request is checked before writes:
|
|
75
|
+
different existing files cause an error unless `--overwrite` is set; identical
|
|
76
|
+
files are skipped. `--dry-run` reports the planned files without creating files
|
|
77
|
+
or directories, and still reports conflicts that would prevent installation.
|
|
78
|
+
|
|
79
|
+
The package ships its registry once, as `dist/registry.json`, and `bin.js` and
|
|
80
|
+
the library read it from beside themselves. The executable therefore needs
|
|
81
|
+
neither this repository nor the network, but it cannot be copied away from that
|
|
82
|
+
file. It reports external source dependencies, each with the version range the
|
|
83
|
+
sources were verified against, and then the setup (Tailwind CSS 4, which has no
|
|
84
|
+
presets): install `@oprt/tokens` and `react-dom`, and as dev dependencies `tailwindcss` and
|
|
85
|
+
`@oprt/tailwind`; add `@plugin "@oprt/tailwind";` to the stylesheet that imports Tailwind;
|
|
86
|
+
import `@oprt/tokens` once at the application root. A recipe also imports `@oprt/react`, so its
|
|
87
|
+
stylesheet needs `@source "../node_modules/@oprt/react/dist";` (relative to the stylesheet) or the
|
|
88
|
+
components render unstyled; source copied into your project needs no `@source` line. No copied source needs `@oprt/tokens-operational`. Packages that
|
|
89
|
+
the copied source imports only for their types (React Aria, for a text input) are
|
|
90
|
+
listed separately as dev dependencies. Install missing dependencies yourself. The
|
|
91
|
+
installer does not run package managers or change your package configuration or stylesheet.
|
|
92
|
+
The same setup is `data.setup` in `add --json`. Recipe imports from `@oprt/react` remain package
|
|
93
|
+
imports.
|
|
94
|
+
|
|
95
|
+
`list --json` answers in the common envelope; its `data` is
|
|
96
|
+
`{ "version": "…", "entries": […], "ranges": {…} }`. Each
|
|
97
|
+
entry includes `name`, `slug`, `kind` (`component` or `recipe`), `description`,
|
|
98
|
+
`files`, `dependencies` (every external package its source imports) and
|
|
99
|
+
`devDependencies` (the subset imported only for types). `ranges` maps each
|
|
100
|
+
external package to its version range. `add --json` answers with the install result
|
|
101
|
+
(`outputDirectory`, `entries`, `dependencies`, `devDependencies`, `ranges`, `files`, `dryRun`)
|
|
102
|
+
and the `setup`. `--version` prints the package version. Exit codes are `0` for
|
|
103
|
+
success, `2` for usage errors, unknown entries or a path that does not exist, and `1` for file
|
|
104
|
+
conflicts or other execution failures; `check` has its own, above.
|
|
105
|
+
|
|
106
|
+
The library exports `registry`, `VERSION`, `parseArgs`, `resolveEntries`, and
|
|
107
|
+
`install`, with their TypeScript contracts. `install(options, { cwd })` supports
|
|
108
|
+
the same names, output directory, dry-run, and overwrite options as the command.
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
The build consumes the aggregated manifest and current React sources. Run the
|
|
113
|
+
workspace build to prepare those inputs, then use this package's `build`, `test`,
|
|
114
|
+
`typecheck`, and `lint` scripts. Registry generation follows actual relative
|
|
115
|
+
imports and exports, includes each dependency family's index and manifest, and
|
|
116
|
+
validates each recipe's local source bundle. Tests execute the built binary from
|
|
117
|
+
temporary consumer directories.
|