@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 +49 -23
- package/dist/babel-parser.cjs +14339 -0
- package/dist/bin.js +1950 -743
- package/dist/contract.json +1 -1
- package/dist/index.cjs +1662 -459
- package/dist/index.d.cts +250 -97
- package/dist/index.d.ts +250 -97
- package/dist/index.js +1652 -461
- package/dist/{read-8a9euzJx.d.cts → read-C7rE5UlY.d.cts} +48 -21
- package/dist/{read-8a9euzJx.d.ts → read-C7rE5UlY.d.ts} +48 -21
- package/dist/read.cjs +2 -1
- package/dist/read.d.cts +1 -1
- package/dist/read.d.ts +1 -1
- package/dist/read.js +2 -1
- package/dist/registry.json +1 -1
- package/package.json +4 -1
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
|
|
33
|
-
and its example. `check` reads `.tsx` and `.jsx` files with
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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`
|
|
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.
|
|
78
|
-
|
|
79
|
-
|
|
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
|