@oprt/cli 0.1.0 → 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/README.md CHANGED
@@ -28,20 +28,38 @@ 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
+ 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.
38
39
 
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.
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`.
45
63
 
46
64
  ## Copying source
47
65
 
@@ -62,21 +80,28 @@ The package ships its registry once, as `dist/registry.json`, and `bin.js` and
62
80
  the library read it from beside themselves. The executable therefore needs
63
81
  neither this repository nor the network, but it cannot be copied away from that
64
82
  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
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
66
89
  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.
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.
72
94
 
73
- `list --json` returns `{ "version": "…", "entries": […], "ranges": {…} }`. Each
95
+ `list --json` answers in the common envelope; its `data` is
96
+ `{ "version": "…", "entries": […], "ranges": {…} }`. Each
74
97
  entry includes `name`, `slug`, `kind` (`component` or `recipe`), `description`,
75
98
  `files`, `dependencies` (every external package its source imports) and
76
99
  `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.
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.
80
105
 
81
106
  The library exports `registry`, `VERSION`, `parseArgs`, `resolveEntries`, and
82
107
  `install`, with their TypeScript contracts. `install(options, { cwd })` supports