Source Installer
oprt does two jobs. This page covers the first: copying source into a project, and upgrading it to a new release. The second is serving agents: init, search, component and mcp are on Set Up an Agent, and check is on Check and Measure.
oprt copies source from the registry that ships beside it
(dist/registry.json) without a network connection. Install dependencies
separately.
Run the CLI
From a built repository:
pnpm build
node packages/cli/dist/bin.js listTo test a packed release in another project, install its tarball and invoke the executable through your package manager:
pnpm add -D /path/to/oprt-cli-VERSION.tgz
pnpm exec oprt listnpx @oprt/cli list (or pnpm dlx @oprt/cli list) runs it without installing.
A build from the repository between releases keeps the last release's version while its copied
source changes. The oprt.json it writes can record texts no release shipped, and a published
oprt that does not ship them stops on it with ERR_RECEIPT_INVALID. Copy with a published
release into a project you will keep.
Preview and copy source
Run from the destination project root. Names accept PascalCase or kebab-case.
Use list to inspect the bundled components and recipes.
pnpm exec oprt list --json
pnpm exec oprt add button dialog --out src/operator --dry-run --json
pnpm exec oprt add button dialog --out src/operator --dry-run
pnpm exec oprt add button dialog --out src/operator
pnpm exec oprt add operations-map asset-management --out src/operatorThe default destination is src/components/operator. Files retain their folder
structure, required local helpers and component dependencies. Copied TSX includes
a React client boundary.
Recipes preserve their relative helper imports and their @oprt/react
package imports. Copying a recipe does not redirect it to a separately copied
core component; change those imports explicitly if you want that relationship.
Existing files and dependencies
Identical files are reused. Changed files require --overwrite; inspect a dry
run before replacing customized source. A file that is an older OPERATOR release
is not treated as a change: add stops with ERR_UPGRADE_REQUIRED and names
oprt upgrade, which keeps your edits where --overwrite would discard them.
Output paths must remain inside the current project. Absolute paths, traversal, and symbolic-link destinations are rejected. A dry run creates no directories or files.
The CLI prints the packages required by the selected sources, each with the
version range the sources were verified against. Packages that the copied source
imports only for their types, such as React Aria for a text input, are listed
separately as dev dependencies. The six recipes import only @oprt/react,
react and, for the two map recipes, ol.
The setup a copy needs
After the dependencies it prints the rest of the setup, which is the same for every copy (Tailwind CSS 4.3.3 or a later 4.x, which has no presets):
- Install
@oprt/tokensandreact-dom, and as dev dependenciestailwindcssand@oprt/tailwind. - In the stylesheet that imports Tailwind, add
@plugin "@oprt/tailwind";. This is what turns the tokens into utilities; without it they do not exist and the build does not say so. - A recipe also imports
@oprt/react, whose compiled components Tailwind does not scan on its own. Add@source "../node_modules/@oprt/react/dist";(the path is relative to the stylesheet) or they render unstyled. Source copied into your project is scanned without an@sourceline, so a copied component needs no such line. - Import
@oprt/tokensonce at the application root, from JavaScript and before the stylesheet, not with an@importinside it.
@oprt/tokens-operational, the C2 and industrial icon packages and a Tailwind
config file are not needed by any copied source; add them only for your own
screens. In --json, the setup is data.setup, so an agent reads the same
steps as data. It is drawn from one maintained source (the setup in
packages/manifest/scripts/guidance.mjs), and a test keeps this page, the
installation guide, the READMEs and the agent guides in step with it.
The installer does not modify your package manifest, install dependencies, or change your stylesheet or Tailwind setup. See the installation guide for the full steps and troubleshooting.
Upgrading
oprt upgrade and oprt.json are new in @oprt/cli 0.5.0; the 0.4.0 CLI has
neither. A project copied with an earlier oprt has no oprt.json, and its
folders are found from their files.
When OPERATOR releases a new version, source you copied and code that uses the
components both fall behind. oprt upgrade brings them up to the installed
release. It never installs packages and never changes your stylesheet. Commit
first: the dry run is the review step, and the command has no version control
integration.
pnpm add @oprt/react@<react-version> && pnpm add -D @oprt/cli@<cli-version>
pnpm exec oprt upgrade
pnpm exec oprt upgrade --applyBump @oprt/react and @oprt/cli together, to matching releases: the two are
released together, and their version numbers need not be the same. If the
installed @oprt/react is not
the release this oprt carries, the command stops with ERR_CONTRACT_MISMATCH:
it says to install @oprt/react@<version> when the package is older, and to run
npx @oprt/cli@<installed> upgrade when it is newer. Without --apply the
command is a dry run. It writes nothing and reports each file's action, the
codemods that would run, the contract check and the agent files. --apply writes
the files and then oprt.json, last, so a run that stops part way can be run
again.
Copied source
Every copied folder moves to the new release as a whole or not at all. For each file the command compares three texts: the base (what OPERATOR shipped when you copied it), yours, and the target (this release).
| Action | Meaning |
|---|---|
unchanged | Yours already equals the target. |
update | Yours equals the base; the target is written. |
kept | OPERATOR did not change the file; your edit stays. |
merge | Both changed, in different places; the merged text is written. |
formatted | Yours differs from the base only in layout; the target is written and you run your formatter. |
conflict | Both changed the same lines. |
create | A new file an installed component now needs. |
deleted_locally | You deleted it; it is reported and not recreated. |
orphan | No longer in OPERATOR; left in place. --prune deletes it only if you never edited it. |
unknown_base | Matches no release and has no known base. |
prune | --prune removes an orphan you never edited. |
unresolved_conflict | Still has conflict markers, from an earlier run or written by this one. |
"Only in layout" means the two files parse to the same syntax tree, ignoring layout and trailing commas. Comments, quotes, literals and JSX text count, and so does whether a comment has a line of its own or ends a line of code, so re-indented JSX text is merged, not replaced. A region taken from OPERATOR's side is a conflict when it would restore a line you deleted that appears once in the base.
A folder with a conflict or an unknown_base is held. --apply writes none
of its files, because a file at the new release could import a shared file left
at the old one. Resolve the file and run again, or use one of these flags:
-
--conflict-markerswrites every file of a folder whose only problem is conflicts, with these markers in the conflicting ones, and moves the folder to the new release:<<<<<<< yours ||||||| OPERATOR <base release> ======= >>>>>>> OPERATOR <this release>The same run reports those files as
UNRESOLVED_CONFLICTopen items, so it ends with exit code 1. Any one of the marker lines left in a file keeps itunresolved_conflict. On the next run, a file whose markers are all still there and close with the current release does not hold its folder; markers naming another release, or a conflict left half resolved, do. -
--base <release>names theoprtrelease an edited file was copied from (0.1.0,0.3.0and so on). Use it for anunknown_basefile. A releaseoprtdoes not know isERR_UNKNOWN_VERSION.
A folder copied before oprt.json existed is recognized from its files when it is
in the default folder (src/components/operator) or the one --out names: each
file whose text matches a shipped release is adopted, and the oldest matching
release is recorded. An entry counts as copied when every file it ships is there,
or a file only it ships is; many entries, such as Button, have no file of their
own. If you copied with --out, pass the same --out; when no copied folder is
found, the result says where the command looked. The same check runs when a
receipt exists but does not list a file. --out <dir> limits the run to one
folder.
oprt.json
oprt add and oprt init write oprt.json in the project root. Commit it. It
records, per copied folder, the release each file came from and its hash, and the
agent files init wrote a block into. oprt upgrade adds the contract version
the code was last migrated to (package.migrated_to); add and init never
write it. When you move a copied folder, edit its out in oprt.json to the new
path; until then the folder is reported INSTALL_MISSING and skipped. A file OPERATOR no longer ships (an orphan) that is gone
from disk is dropped from it; a receipt that cannot be read is ERR_RECEIPT_INVALID.
Codemods
Codemods update code that uses the components, in files that import from
@oprt/react or from a copied folder (aliases, namespace imports, relative paths
and tsconfig paths are followed), directly or through one file of your own
that re-exports them from there. They scan .ts, .tsx, .js, .jsx,
.mjs and .cjs files, tests and stories included. They skip node_modules,
.git and the usual framework caches anywhere, and dist, build and out only
beside a package.json; other folders, .storybook included, are scanned.
Edits keep your formatting, and running a codemod again changes nothing.
oprt upgrade --list shows the codemods this oprt carries. --path <dir>
limits the scan to one folder; the result's scan says which and how many files.
A call site of a held copied folder is not edited (CALL_SITE_HELD), because the
component there is still the old one. A spread prop, a computed value, an import
that points into a copied folder at a file OPERATOR does not ship, and an
OPERATOR name re-exported by a file of your own from anywhere else, such as
another file of your own (UNRESOLVED_IMPORT), are limitations: they are listed,
never guessed at, and do not fail the run. The text output lists each codemod with
the files it edits, and each held call site and limitation with its place.
Codemods run from --from <contract version>, else from the earlier of the
migrated_to in oprt.json and the oldest release among the copied files. Only
files copied from a release older than this oprt count: the files oprt add
writes are at its own release and say nothing about your other code. Neither
does a file OPERATOR no longer ships (an orphan), which keeps the release it came
from. With none of these, codemods are skipped (CODEMODS_SKIPPED, detail
ERR_VERSION_REQUIRED): a project that only uses the package, or whose only
copied files were written by this oprt add, passes --from once, on its first
upgrade. A start later than the target is ERR_DOWNGRADE.
migrated_to moves to the new release only after a run over the whole project
with nothing held, skipped or unparseable (--path . counts as the whole
project). Otherwise, when the starting version is known and oprt.json has none,
or a later one, it records that version as a floor, so the next run starts there.
A dry run computes the same value; only writing it needs --apply.
The contract check
The command runs oprt check on the files as they were, under the old contract,
and as they will be, under the new one. A finding that appears only afterward was
introduced by the upgrade and is an open item (INTRODUCED_FINDING). Findings
that were already there are listed apart and do not change the status. Findings
are matched by file, code, component, prop and value (the invalid option, the
unknown export name or the misplaced child), falling back to the message, and not
by line. When check read some files only in part, the result counts them
(partial) and the text says "in what it could read". As in oprt check, only
.tsx and .jsx files are read and a copied import is recognized by its path,
so a removed export imported from a copied folder is not caught.
Agent instructions
The block oprt init wrote into AGENTS.md, CLAUDE.md or a Cursor rule is
replaced when its text differs from the one this release renders. Only the block
changes; the rest of the file and its line endings stay. A file that is a symbolic
link or not UTF-8 is skipped with a reason and never stops the run; a recorded
file that no longer exists is absent.
Result, statuses and exit codes
--json answers with type: "upgrade". data holds dry_run, from, to,
copied, codemods, check, agent_blocks, receipt, open_items, notes,
limitations, scan and upgrade_status.
upgrade_status | Meaning | Exit |
|---|---|---|
up_to_date | Nothing to change, no open items. | 0 |
ready | Dry run; everything planned can be applied. | 0 |
ready_with_open_items | Dry run; some things stay for a person. | 1 |
applied | Everything planned was written. | 0 |
applied_with_open_items | What could be written was; open items remain. | 1 |
not_evaluated | Nothing could be read. | 1 |
Manual notes and introduced warnings fail the run only with --strict. A usage
error exits 2.
| Open item | Meaning |
|---|---|
CONFLICT | You and OPERATOR changed the same lines of a file. |
UNKNOWN_BASE | An edited file matches no release; pass --base. |
INSTALL_HELD | A folder was left as it is until its files are resolved. |
UNRESOLVED_CONFLICT | A file has conflict markers, written now or earlier. |
INSTALL_MISSING | A recorded or named folder does not exist; fix out in oprt.json. |
SYNTAX_ERROR | A file did not parse and was not edited. |
CODEMODS_SKIPPED | No starting version; pass --from. |
CALL_SITE_HELD | A call site of a held folder was not edited. |
INTRODUCED_FINDING | check finds something after the upgrade that it did not before. |
| Error code | Meaning | Exit |
|---|---|---|
ERR_UPGRADE_REQUIRED | add found files from an older release; run oprt upgrade first. | 1 |
ERR_CONTRACT_MISMATCH | The installed @oprt/react is not the release this oprt carries. | 1 |
ERR_DOWNGRADE | The receipt or --from is later than this oprt's release. | 1 for the receipt, 2 for --from |
ERR_VERSION_PRUNED | The recorded release is no longer carried; the message names the CLI to run first. | 1 |
ERR_UNKNOWN_VERSION | --base names a release oprt does not know. | 2 |
ERR_RECEIPT_INVALID | oprt.json cannot be read. | 1 |
ERR_VERSION_REQUIRED | No starting version for the codemods (the detail of CODEMODS_SKIPPED). | none; an open item, so the status exits 1 |
Machine-readable output
list, add, upgrade and the commands for agents take --json and answer in the same
envelope, with the CLI version, the
contract version and digest, and the schema version in identity. For list the
data is { version, entries, ranges }; for add it is the install result
(outputDirectory, entries, dependencies, devDependencies, ranges, files,
dryRun) with the setup above. A failure is { apiVersion, error, code, suggestions, identity }. Exit codes are 0 for success, 2 for a usage error, an unknown
name or a path that does not exist, and 1 for file conflicts and other
failures. check has exit codes of its own, on Check and Measure.
TypeScript setup
Copied sources use bundler module resolution and the React JSX transform. Match
the repository with strict: true, exactOptionalPropertyTypes: true, and
skipLibCheck: true. The last option skips third-party declaration checking;
React Aria 1.20 currently has declaration conflicts under exact optional property
types. Your copied application source remains typechecked. The release consumer
check separately validates OPERATOR’s packaged declarations with library checking
enabled.
Copied sources type-check against React 18 and React 19's types, with or without
@types/node (a test in @oprt/react compiles every shipped file with no ambient
types, against both).