@parity-app/cli 0.1.0 → 0.2.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 +87 -1
- package/dist/bin.mjs +1132 -272
- package/dist/client-Cf66-n3R.mjs +724 -0
- package/dist/index.d.mts +211 -17
- package/dist/index.mjs +1 -1
- package/dist/libraries/aria.lib.par +5 -5
- package/dist/libraries/baseui.lib.par +25 -25
- package/dist/libraries/chakra.lib.par +17 -17
- package/dist/libraries/fluent.lib.par +27 -27
- package/dist/libraries/luma.lib.par +20 -20
- package/dist/libraries/lyra.lib.par +20 -20
- package/dist/libraries/maia.lib.par +20 -20
- package/dist/libraries/mantine.lib.par +14 -14
- package/dist/libraries/mira.lib.par +20 -20
- package/dist/libraries/mui.lib.par +5 -5
- package/dist/libraries/nova.lib.par +20 -20
- package/dist/libraries/radix.lib.par +11 -11
- package/dist/libraries/rhea.lib.par +20 -20
- package/dist/libraries/sera.lib.par +20 -20
- package/dist/libraries/vega.lib.par +20 -20
- package/dist/{src-DYi23Ypb.mjs → src-BOUQtcWB.mjs} +1 -1
- package/dist/{src-FF8eY6EI.mjs → src-BRgxMRtE.mjs} +3 -2
- package/dist/{src-D9EMN48r.mjs → src-BZ1p_ip_.mjs} +125 -36
- package/dist/{src-DXZqtm6z.mjs → src-CAm6EBIK.mjs} +1 -1
- package/dist/{src-8MhDV_sA.mjs → src-CcWc-KsX.mjs} +498 -207
- package/package.json +8 -6
- package/skills/SKILL.md +61 -14
- package/skills/document.md +2 -1
- package/skills/execute.md +74 -8
- package/skills/guide/states-and-modes.md +5 -3
- package/LICENSE +0 -21
- package/dist/client-DsTLQ2lT.mjs +0 -286
package/README.md
CHANGED
|
@@ -21,15 +21,22 @@ or install it to get the `parity` command:
|
|
|
21
21
|
npm install --global @parity-app/cli
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Most commands act on a running Parity app
|
|
24
|
+
Most commands act on a project open in a running Parity app: the one `--tab` names, else the one the current folder is
|
|
25
|
+
in, else the active tab of the Parity window used last (`--tab active` names that one). `parity lib` runs without the
|
|
25
26
|
app.
|
|
26
27
|
|
|
28
|
+
Each running copy of the app writes where to reach it to `~/.parity/agents`, and each call goes to the copy that has its
|
|
29
|
+
project open; a project open in two copies goes to the one running longest. A copy started with `PARITY_AGENT_FILE`
|
|
30
|
+
writes only that file, and a CLI given the same file reaches only that copy.
|
|
31
|
+
|
|
27
32
|
## Commands
|
|
28
33
|
|
|
29
34
|
| Command | What it does |
|
|
30
35
|
| ---------------------------- | ------------------------------------------------------------------------------------------ |
|
|
31
36
|
| `parity tabs` | Lists the open projects. |
|
|
32
37
|
| `parity state` | A tab's designs, selection, modes, components and tokens. Start here. |
|
|
38
|
+
| `parity status` | Revision, unsaved files and token values, the last save, and undo and redo. |
|
|
39
|
+
| `parity modes [design]` | Viewports, modes and what each design shows; a design adds its frames' sizes. |
|
|
33
40
|
| `parity exec [file]` | Runs a JavaScript snippet against the designs, from a file or stdin, as one undoable step. |
|
|
34
41
|
| `parity screenshot <design>` | Renders a design in its states and modes, offscreen, as images. |
|
|
35
42
|
| `parity problems <design>` | Render errors, overflow, clipping and unknown components, per frame. |
|
|
@@ -60,6 +67,85 @@ Add the MCP server to your agent's configuration:
|
|
|
60
67
|
|
|
61
68
|
Then have the agent read the skill first, with the `read_skill` tool or `parity skill`.
|
|
62
69
|
|
|
70
|
+
## Execute contract
|
|
71
|
+
|
|
72
|
+
CLI `exec` and MCP `execute` share one operation. CLI file/stdin becomes MCP's `input`; `--label` becomes `description`;
|
|
73
|
+
`--tab`, `--edit-id` and parsed `--edits` have the same meaning in both. The default task label is `Edit designs`, and
|
|
74
|
+
an omitted tab uses the open project the current folder is in, else the active tab.
|
|
75
|
+
|
|
76
|
+
Send a nonblank snippet or a failed call's `editId`, not both. Retry patches need a nonempty `find`, a string `replace`
|
|
77
|
+
(which can be empty), and optional boolean `all`; omitted patches default to an empty list. Invalid requests are
|
|
78
|
+
rejected before reaching the desktop. Caller identity and session IDs travel separately from operation inputs.
|
|
79
|
+
|
|
80
|
+
CLI failures exit with 1; MCP failures set `isError` and include the same failure and retry details, as the structured
|
|
81
|
+
`error` below. CLI `--json` omits screenshot image data; MCP returns image content blocks.
|
|
82
|
+
|
|
83
|
+
## Shared operations
|
|
84
|
+
|
|
85
|
+
All desktop commands use the same operation contracts as their MCP counterparts:
|
|
86
|
+
|
|
87
|
+
| CLI | MCP |
|
|
88
|
+
| ------------------------ | --------------------- |
|
|
89
|
+
| `tabs` | `get_tabs` |
|
|
90
|
+
| `state` | `get_app_state` |
|
|
91
|
+
| `status` | `get_status` |
|
|
92
|
+
| `modes` | `get_modes` |
|
|
93
|
+
| `exec` | `execute` |
|
|
94
|
+
| `screenshot` | `screenshot` |
|
|
95
|
+
| `problems` | `find_problems` |
|
|
96
|
+
| `a11y` / `accessibility` | `check_accessibility` |
|
|
97
|
+
| `console` | `get_console` |
|
|
98
|
+
| `open` | `open_project` |
|
|
99
|
+
| `tokens` | `get_tokens` |
|
|
100
|
+
| `components` | `get_components` |
|
|
101
|
+
| `props` | `get_props` |
|
|
102
|
+
| `skill` | `read_skill` |
|
|
103
|
+
|
|
104
|
+
Screenshot scale defaults to 1 and must be a finite number from 0.25 to 3. Screenshot state and mode default to the
|
|
105
|
+
current state and primary mode. Audits default to every state and shown modes. State and mode accept a nonblank string
|
|
106
|
+
or a nonempty list of nonblank strings; one-item lists normalize to strings. `clear` for console and `all` for props
|
|
107
|
+
default to false. Requests with invalid input fail before contacting the app.
|
|
108
|
+
|
|
109
|
+
Screenshots that fail and audits that find issues exit with 1 in the CLI and set MCP `isError`, retaining the full
|
|
110
|
+
report. CLI JSON omits screenshot image data; MCP emits image blocks. CLI `open` resolves relative folders; MCP requires
|
|
111
|
+
an absolute path. Skill reading uses the same local reader and default `SKILL.md` in both transports. Library generation
|
|
112
|
+
and checking remain CLI commands; library checking runs its snippets through the shared execute operation.
|
|
113
|
+
|
|
114
|
+
## Structured results
|
|
115
|
+
|
|
116
|
+
Every command takes `--json` and prints the same data the MCP tool returns as `structuredContent`. `tools/list` doesn't
|
|
117
|
+
publish output schemas, since agents would pay for them in context; `operations.ts` and `execute.ts` hold them. Human
|
|
118
|
+
text and screenshot images stay beside it. A failure is
|
|
119
|
+
`{ "error": { code, message, retryable, path?, alternatives?, editId? } }` (with `--json` on stdout, and the message on
|
|
120
|
+
stderr), or, for `exec` and `screenshot`, the whole report with `error` in it:
|
|
121
|
+
|
|
122
|
+
- `code` is stable: `invalid_input`, `not_running`, `not_answering`, `unknown_tab`, `tab_not_ready`, `unknown_design`,
|
|
123
|
+
`unknown_node`, `ambiguous_reference`, `unknown_state`, `unknown_mode`, `unknown_viewport`, `unknown_component`,
|
|
124
|
+
`unknown_icon_set`, `unknown_edit_id`, `conflict`, `execution_failed` or `app_error`.
|
|
125
|
+
- `retryable` is true when the same request, unchanged, can succeed: the app is starting, or edits collided.
|
|
126
|
+
- `path` is a JSON pointer to the input at fault, in the transport's field names (`/design`, `/input`, `/edits/0/find`).
|
|
127
|
+
- `alternatives` lists up to 20 valid ids for an unknown or ambiguous one, closest first.
|
|
128
|
+
- `editId` retries a failed snippet with `edits`.
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
$ parity props Buton --json
|
|
132
|
+
{ "error": { "code": "unknown_component", "message": "\"Buton\" isn't one of the project's components. Check Components().",
|
|
133
|
+
"retryable": false, "path": "/component", "alternatives": ["Avatar", "Badge", "Button", "Card", …] } }
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`tokens` returns the first 100 unless `--limit` (up to 1000) says otherwise, and `console` the newest 50; both say
|
|
137
|
+
`total` and `truncated`. `tabs` is `{ "tabs": [...] }`.
|
|
138
|
+
|
|
63
139
|
## Licence
|
|
64
140
|
|
|
65
141
|
MIT. See [LICENSE](https://github.com/betterapps-hq/parity/blob/main/LICENSE).
|
|
142
|
+
|
|
143
|
+
## Caller name on the canvas
|
|
144
|
+
|
|
145
|
+
For CLI calls, set `PARITY_AGENT_NAME` to the name you want shown on cursors and badges (for example,
|
|
146
|
+
`DeepSeek Harness`). Without a nonblank name, calls show `Terminal`. Use `PARITY_AGENT_ID` to distinguish concurrent CLI
|
|
147
|
+
callers sharing a display name. `--label` names the task separately.
|
|
148
|
+
|
|
149
|
+
For MCP, Parity uses the client's declared `clientInfo.title`, then `clientInfo.name`, then `Agent` if neither is
|
|
150
|
+
nonblank. Names are trimmed and otherwise preserved; no list of known agents or tool environment detection is needed.
|
|
151
|
+
These display names are self-reported, not authentication.
|