@oprt/cli 0.1.0 → 0.4.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/README.md CHANGED
@@ -28,20 +28,39 @@ oprt mcp
28
28
  `init` writes a block of instructions (house rules, one line per component, the recipes)
29
29
  into the file an agent reads on every turn: `AGENTS.md` by default, `CLAUDE.md` or
30
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.
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
+ a parser that ships inside this package (Babel's, in TypeScript and JSX mode), so it works in any
35
+ project: no TypeScript, or any version of it, is needed. It reports invalid option values, unknown
36
+ exports, forbidden nesting, missing required props and breaks of the house rules. `doctor` says
37
+ whether lookups and code checking can run here, one at a time, which parser checking reads with, and
38
+ why checking is blocked if the parser file is ever missing. `mcp` serves the lookups and the check
39
+ over the Model Context Protocol on stdin and stdout, with no dependencies to install.
38
40
 
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.
41
+ `check` says how much it read. `evaluation_status` is `evaluated_clean` only when every file was
42
+ read in full and nothing was found; otherwise it is `evaluated_with_findings`,
43
+ `partially_evaluated` (a spread or computed option value it could not read is a limit, recorded
44
+ with its place; or some files did not parse), `not_evaluated` (no file parsed) or
45
+ `no_files_evaluated` (nothing was read, for example a Markdown file). A file that does not parse
46
+ is reported as `SYNTAX_ERROR` findings and is never clean. Types and rendering are not checked.
47
+ Exit codes: `0` when what was read has no errors (warnings fail only with `--strict`; limits do not
48
+ fail the run), `1` for an error, a file that did not parse, no file read, or a parser that cannot be loaded,
49
+ `2` for a usage error or a path that does not exist.
50
+
51
+ Every command takes `--json`, `list` and `add` included, and answers
52
+ `{ "apiVersion": 2, "type": "…", "identity": {…}, "data": … }`. `identity` keeps four things
53
+ apart: `cli_version` (this package), `contract_version` (the `@oprt/react` version the contract
54
+ describes), `contract_digest` (`sha256:` of `dist/contract.json`) and `schema_version` (this
55
+ result format, the same number as `apiVersion`). A failure is
56
+ `{ "apiVersion": 2, "error": "…", "code": "ERR_…", "suggestions": […], "identity": {…} }`; codes
57
+ are stable and only ever added to. `component --dense --json` is a compact form of the same data.
58
+ `oprt mcp` returns the same envelope as each tool's structured result, with an `outputSchema` on
59
+ 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
60
+ error result. All of it is drawn from `dist/contract.json`, which ships beside the registry: the
61
+ component contract, its guidance and the names `@oprt/react` exports. `@oprt/cli/read` exports
62
+ the readers without the registry, for building pages from the same contract. The library exports
63
+ the schemas of every answer as `RESULT_SCHEMAS`.
45
64
 
46
65
  ## Copying source
47
66
 
@@ -62,21 +81,28 @@ The package ships its registry once, as `dist/registry.json`, and `bin.js` and
62
81
  the library read it from beside themselves. The executable therefore needs
63
82
  neither this repository nor the network, but it cannot be copied away from that
64
83
  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
84
+ sources were verified against, and then the setup (Tailwind CSS 4, which has no
85
+ presets): install `@oprt/tokens` and `react-dom`, and as dev dependencies `tailwindcss` and
86
+ `@oprt/tailwind`; add `@plugin "@oprt/tailwind";` to the stylesheet that imports Tailwind;
87
+ import `@oprt/tokens` once at the application root. A recipe also imports `@oprt/react`, so its
88
+ stylesheet needs `@source "../node_modules/@oprt/react/dist";` (relative to the stylesheet) or the
89
+ components render unstyled; source copied into your project needs no `@source` line. No copied source needs `@oprt/tokens-operational`. Packages that
66
90
  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.
91
+ listed separately as dev dependencies. Install missing dependencies yourself. The
92
+ installer does not run package managers or change your package configuration or stylesheet.
93
+ The same setup is `data.setup` in `add --json`. Recipe imports from `@oprt/react` remain package
94
+ imports.
72
95
 
73
- `list --json` returns `{ "version": "…", "entries": […], "ranges": {…} }`. Each
96
+ `list --json` answers in the common envelope; its `data` is
97
+ `{ "version": "…", "entries": […], "ranges": {…} }`. Each
74
98
  entry includes `name`, `slug`, `kind` (`component` or `recipe`), `description`,
75
99
  `files`, `dependencies` (every external package its source imports) and
76
100
  `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.
101
+ external package to its version range. `add --json` answers with the install result
102
+ (`outputDirectory`, `entries`, `dependencies`, `devDependencies`, `ranges`, `files`, `dryRun`)
103
+ and the `setup`. `--version` prints the package version. Exit codes are `0` for
104
+ success, `2` for usage errors, unknown entries or a path that does not exist, and `1` for file
105
+ conflicts or other execution failures; `check` has its own, above.
80
106
 
81
107
  The library exports `registry`, `VERSION`, `parseArgs`, `resolveEntries`, and
82
108
  `install`, with their TypeScript contracts. `install(options, { cwd })` supports