|
1 | | -# ScreenRig plugin agent guide |
| 1 | +# plugin |
2 | 2 |
|
3 | | -This repository owns the public ScreenRig Codex/Claude marketplace, canonical |
4 | | -skill source, plugin metadata, and generated bundle containing the current |
5 | | -`screenrig/cli` `main` CLI. It does not own the CLI source, players, backend, |
6 | | -site, or production deployment. The separately published `screenrig` npm |
7 | | -package is the official developer-shell distribution. It is never a substitute |
8 | | -for this plugin's bundled launcher in an agent workflow. |
| 3 | +This repository owns the public ScreenRig marketplace, canonical skill source, |
| 4 | +plugin metadata, and the generated bundle that contains the current |
| 5 | +`screenrig/cli` `main` CLI. |
| 6 | + |
| 7 | +It does not own the CLI source, Players, backend, site, or production |
| 8 | +deployment. The separately published `screenrig` npm package is the official |
| 9 | +developer-shell distribution. It is never a substitute for this plugin's |
| 10 | +bundled launcher in an agent workflow. |
| 11 | + |
| 12 | +The workspace [`../AGENTS.md`](../AGENTS.md) is the shared working agreement. |
| 13 | +This file outranks it on anything local here. |
9 | 14 |
|
10 | 15 | ## Sources of truth |
11 | 16 |
|
12 | 17 | - `skills/screenrig/`, `build/plugin.json`, root marketplace manifests, and |
13 | 18 | root public files are canonical inputs. |
14 | | -- `components.lock.json` is provenance of the CLI tarball just packed: |
15 | | - artifact filename and SHA-256, plus the commit that produced those bytes. |
16 | | - It is not a freeze of which SHA to fetch, not a rebuild input, and not a |
17 | | - product version. Pack sibling `../cli` or current `screenrig/cli` `main`. |
18 | | - Do not refetch a SHA from this file. Do not invent a digest; hash the |
19 | | - tarball you packed. |
20 | | -- Distributed plugin versions are CalVer `YY.MM.SERIAL` (UTC). Tags are |
21 | | - `vYY.MM.N`. Committed `.claude-plugin/marketplace.json` is the published |
22 | | - CalVer (currently `26.09.5`); CI stamps generated `plugin.json` in the |
23 | | - distributing artifact. Local and pull-request trees use `YY.MM.0-dev`. |
24 | | - Plugin CI packs `screenrig/cli` `main` and, when that HEAD is tagged |
25 | | - `vYY.MM.N`, applies the same stamp so the tarball hash is stable. |
26 | | -- `scripts/build-plugin.py` defines generation of `plugins/screenrig/`. |
27 | | - Locally it packs sibling `../cli` when that directory exists. CI clones |
28 | | - and packs `https://github.com/screenrig/cli` `main`. It never fetches a |
29 | | - commit recorded in `components.lock.json`. |
| 19 | +- `components.lock.json` is provenance of the CLI tarball just packed: filename |
| 20 | + and SHA-256, plus the commit that produced those bytes. It is not a freeze of |
| 21 | + which SHA to fetch. |
| 22 | +- `scripts/build-plugin.py` generates `plugins/screenrig/`. Locally it packs |
| 23 | + sibling `../cli` when that directory exists. CI clones and packs |
| 24 | + `https://github.com/screenrig/cli` `main`. |
30 | 25 | - `scripts/validate-plugin.py` and `scripts/check-public-repo.py` define the |
31 | | - public/reproducibility boundary. Skill Commands must exist in the bundled |
32 | | - CLI usage; `media generate` and `media download` are required. |
33 | | -- This repository publishes an artifact and never deploys ScreenRig. |
34 | | - **Deploys are independent** (operating rule): this repository's `main` |
35 | | - Action tags CalVer `vYY.MM.N` and publishes the stamped |
36 | | - `screenrig-plugin.tar.gz` CI artifact only. No |
37 | | - marketplace publish unless the user asks later. Do not pack siblings as |
38 | | - a deploy. Do not dispatch backend. Do not copy deploy tokens between repos. |
39 | | - Coordinated multi-repo deploy is rare and only for a breaking contract |
40 | | - change. Vendoring current CLI into `plugins/screenrig/cli` is how |
41 | | - marketplace git-clone installs get a CLI. |
| 26 | + public/reproducibility boundary. Skill commands must exist in the bundled CLI |
| 27 | + usage; `media generate` and `media download` are required. |
| 28 | +- Distributed plugin versions are CalVer `YY.MM.SERIAL` (UTC). Committed |
| 29 | + `.claude-plugin/marketplace.json` is the published CalVer. Local and |
| 30 | + pull-request trees use `YY.MM.0-dev`. |
42 | 31 |
|
43 | 32 | ## Edit and generation rules |
44 | 33 |
|
45 | 34 | - Never edit `plugins/screenrig/` independently. Change canonical inputs and |
46 | | - regenerate from current `screenrig/cli` `main` (or the sibling checkout). |
47 | | -- Local `build-plugin.py` packs sibling `../cli` when that directory exists. |
48 | | - After packing, write `components.lock.json` as provenance of that tarball. |
49 | | - Do not refetch a pinned CLI SHA. Rebuild from a packed tarball: |
50 | | - `python3 scripts/build-plugin.py --cli-artifact <tarball> --write-lock |
51 | | - --cli-commit <sha-that-produced-the-tarball>`. |
| 35 | + regenerate. |
| 36 | +- After packing, write `components.lock.json` as provenance of that tarball. |
| 37 | + Do not refetch a pinned CLI SHA. |
52 | 38 | - Keep Codex and Claude marketplace metadata, generated manifests, public |
53 | | - README, and skill behavior aligned at regeneration time. Canonical skill |
54 | | - source may lead the generated `plugins/screenrig/` copy until rebuild. |
55 | | - Never hand-edit `plugins/screenrig/` to close that gap. |
| 39 | + README, and skill behavior aligned at regeneration time. |
56 | 40 | - The launcher must preflight Node.js 20.11+ and prefer the package-relative |
57 | | - bundled `cli/dist/bin.js`. When that file is absent, resolve `cli/dist/bin.js` |
58 | | - from a plugin-root environment variable or a parent-directory walk so a |
59 | | - source checkout works without a marketplace install. |
60 | | -- Do not add global npm resolution to the launcher. The npm package is for an |
61 | | - operator's developer shell; a loaded agent uses the CLI bundled with |
62 | | - its installed plugin. |
| 41 | + bundled `cli/dist/bin.js`. Do not add global npm resolution to the launcher. |
63 | 42 | - The launcher preflights Node.js and nothing else. It must stay silent on |
64 | | - success: `scripts/check-public-repo.py` and `scripts/validate-plugin.py` both |
65 | | - require clean JSON on stdout and empty stderr. A dependency that only one |
66 | | - command needs, such as the media toolchain, belongs to that command in the |
67 | | - CLI, which can return a machine-readable envelope; it must never fail or warn |
68 | | - from this shared entry point. |
69 | | -- Preserve unrelated work. Do not commit, push, tag, publish, deploy, or change |
70 | | - marketplace/GitHub state unless explicitly authorized. |
| 43 | + success: stdout is clean JSON, stderr is empty. |
| 44 | +- Preserve unrelated work. Do not commit, push, tag, or publish unless asked. |
| 45 | + |
| 46 | +This repository's `main` Action tags CalVer and publishes |
| 47 | +`screenrig-plugin.tar.gz`. It does not deploy ScreenRig and does not publish a |
| 48 | +marketplace listing unless the user asks. |
71 | 49 |
|
72 | 50 | ## Product and security boundaries |
73 | 51 |
|
74 | | -- Teach only implemented product commands. Canonical skill source |
75 | | - `skills/screenrig/SKILL.md` is the operative marketplace skill. Official |
76 | | - install is this plugin: Claude, Codex, and Grok marketplace commands, with |
77 | | - Grok `--trust` named and `GROK_PLUGIN_ROOT` lookup. After install, prepend |
78 | | - `$SCREENRIG_PLUGIN_ROOT/skills/screenrig/scripts` to `PATH` once, then run |
79 | | - `screenrig --json version`, `screenrig-plugin-freshness --json`, `doctor`, |
80 | | - the playlist authoring tree, playlist, and `screen assign`. Refresh the |
81 | | - installed plugin when that helper reports `data.action` `refresh`. Do not |
82 | | - export `SR`. Teach choose by what the page is. |
83 | | - Compose is local unbilled stills for slide-deck-like pages. |
84 | | - Do not teach `agent enroll`, `screen pair`, `browser setup`, `screen |
85 | | - provision`, `ABC-234`, or playlist text-slot template tutorials. |
86 | | -- Keep `--json` envelopes. Never teach a token flag or pasted bearer. The |
87 | | - credential is a user-private file. |
88 | | -- Meter usage in credits. Standard is prepaid. HTTP 402 / `payment_required` |
89 | | - means do not retry billed commands; point money at |
90 | | - https://screenrig.ai/pricing/. Write in a feature-complete voice. |
91 | | -- Teach the playlist authoring tree. Choose by what the page is. Do not |
92 | | - generate an atmosphere plate and compose type onto it. Do not compose a |
93 | | - presentable poster as named regions + cards. |
94 | | - 1. Existing image or video → `media upload` and place `med_…`. No compose. |
95 | | - No generate. |
96 | | - 2. Anything presentable (posters, announcements, restaurant menus, event |
97 | | - art, product stills, public-facing rich static pages) → `media generate` |
98 | | - as the **whole page**. Put every fact and all copy in the prompt so the |
99 | | - image model typesets it. ScreenRig generate is the default. |
100 | | - Own-gen-then-upload remains valid only if |
101 | | - they already have a preferred model. Do not compose this page. Do not |
102 | | - generate atmosphere-only stills for later overlay. |
103 | | - 3. Slide-deck-like experiences (title/body/table slides, internal decks, |
104 | | - measured type that must stay editable as compose JSON) → local unbilled |
105 | | - `compose render`. |
106 | | - 4. Live objects (a playing video, iframe, or webapp as the page or as |
107 | | - playlist primitives) → write playlist primitives. Upload the video if |
108 | | - you have it. Do not local-render stills merely to attach `enter` / |
109 | | - `motion`. Animation is not a reason to compose. |
110 | | - `media generate` is billed per still by `--quality`: low $0.06 (600 credits) |
111 | | - for unimportant generated stills only, medium $0.12 (1200 credits) for most |
112 | | - cases (default), high $0.50 (5000 credits) for dense text and complex |
113 | | - posters. Quality changes the image and the price. Do not teach emitting |
114 | | - native `text`, `box`, or `line` on the playlist wire. Compose is local and |
115 | | - not billed. |
116 | | -- The category word is **primitive**, never placement, kind, or type. Four |
117 | | - wire primitives exist: static (`image`), motion (`video`), and web |
118 | | - (`iframe`, `application`). A page carries `pages[].primitives`, and each |
119 | | - entry is flat: a `primitive` field naming the family, that family's own |
120 | | - fields, then `rect`, `layer`, `content_fit`, and optional `enter`. There is |
121 | | - no nested content object. Image and video primitives take a `selector` |
122 | | - (`by` is `id`, `ids`, `all`, or `tag`); iframe and application do not. |
123 | | - `media list` filters with `--primitive`, the API parameter is `primitive`, |
124 | | - and the event field is `primitive_id`. MIME `--content-type`, `feedback |
125 | | - --kind`, and transition/enter/advance `type` are unrelated and stay. Teach |
126 | | - the primitive wire alone: no placement compat shim and no dual-read of the |
127 | | - retired vocabulary. |
128 | | -- Screenshotting is in v1. `screen screenshot <id>` blocks on a still WebP and |
129 | | - writes a file. Do not print pixels. |
130 | | -- Human `events list` and `events follow` print logfmt. `--json events list` |
131 | | - is one JSON page envelope. `--json events follow` is a JSON stream. |
132 | | -- `events follow` reconnects on disconnect or a transient connect failure, |
133 | | - with exponential backoff, and sends the last SSE `id` as `after`. |
134 | | - `--timeout` covers the whole follow, including backoff. 401, 403, 404, |
135 | | - and other non-transient 4xx problems stop the command. |
| 52 | +- Canonical skill source `skills/screenrig/SKILL.md` is the operative |
| 53 | + marketplace skill. Official install is this plugin: Claude, Codex, and Grok |
| 54 | + marketplace commands, with Grok `--trust` named and `GROK_PLUGIN_ROOT` |
| 55 | + lookup. |
| 56 | +- After install, prepend `$SCREENRIG_PLUGIN_ROOT/skills/screenrig/scripts` to |
| 57 | + `PATH` once, then run `screenrig --json version`, |
| 58 | + `screenrig-plugin-freshness --json`, `doctor`, then content work. Do not |
| 59 | + export `SR`. Do not teach `npm i -g screenrig`. |
| 60 | +- Do not teach `agent enroll`, `screen pair`, `browser setup`, |
| 61 | + `screen provision`, `ABC-234`, or playlist text-slot template tutorials. |
| 62 | +- Keep `--json` envelopes. Never teach a token flag or pasted bearer. |
| 63 | +- Never write MCP. `validate-plugin.py` rejects MCP manifests. |
| 64 | +- Teach the playlist authoring tree. Choose by what the page is: |
| 65 | + 1. Existing image or video → `media upload`. No compose. No generate. |
| 66 | + 2. Anything presentable → `media generate` as the whole page. |
| 67 | + 3. Slide-deck-like experiences → local unbilled `compose render`. |
| 68 | + 4. Live objects → write playlist primitives. Animation is not a reason to |
| 69 | + compose. |
| 70 | +- The category word is **primitive**. Four wire primitives: `image`, `video`, |
| 71 | + `iframe`, `application`. Image and video take a `selector`; iframe and |
| 72 | + application do not. |
| 73 | +- Screenshotting is in v1. Do not print pixels. |
| 74 | +- Root `README.md` is the public marketing face and is fact-gated. Required |
| 75 | + marketplace strings and forbidden patterns live in |
| 76 | + `scripts/validate-plugin.py`. Do not drop a required fact. Do not introduce |
| 77 | + enroll, pairing, MCP, global npm install, or “coming soon”. |
136 | 78 |
|
137 | 79 | ## Follow operation logs |
138 | 80 |
|
139 | | -This plugin does not emit the operation log. The CLI does, through optional |
140 | | -`log_socket` in the same user config as the token. Canonical skill source |
141 | | -teaches credential state in `skills/screenrig/SKILL.md` under Output, |
142 | | -configuration, and credential state. |
143 | | - |
144 | | -Players emit their own separate logs. The skill documents where each player |
145 | | -family writes (socket path and env override, Android log tag, Windows trace |
146 | | -output, browser console) so an agent can read `params.pairing_code` off a |
147 | | -`pairing.start` row where a player publishes it, and says to fall back to the |
148 | | -code on the glass where one does not. Keep that generic: no operator host |
149 | | -paths, no local listener service, no internal tooling names. |
150 | | - |
151 | | -Never print credentials, cookies, `Authorization` headers, signed URLs, |
152 | | -object keys, or pixels. |
| 81 | +This plugin does not emit the operation log. The bundled CLI does, through |
| 82 | +optional `log_socket` in the user config. Keep skill text generic: no operator |
| 83 | +host paths, no local listener service, no internal tooling names. |
153 | 84 |
|
154 | 85 | ## Verification |
155 | 86 |
|
156 | 87 | ```sh |
157 | 88 | python3 scripts/check-public-repo.py |
158 | 89 | plugins/screenrig/skills/screenrig/scripts/screenrig --json version |
159 | | -``` |
160 | | - |
161 | | -Bundle validation compares the committed `plugins/screenrig` tree to a rebuild |
162 | | -from current `screenrig/cli` `main` (or `--cli-artifact` of that pack): |
163 | | - |
164 | | -```sh |
165 | 90 | python3 scripts/build-plugin.py --check --cli-artifact <current-cli-tarball> |
166 | 91 | python3 scripts/validate-plugin.py --cli-artifact <current-cli-tarball> |
167 | 92 | python3 scripts/test-skill-commands.py |
168 | 93 | python3 scripts/test-plugin-freshness.py |
169 | 94 | ``` |
170 | 95 |
|
171 | | -`components.lock.json` must match the tarball just packed. That match is |
172 | | -provenance of this build, not a freeze of which SHA to fetch. These gates do |
173 | | -not prove marketplace installation/loading, live API use, native hardware, or |
174 | | -production deployment. |
| 96 | +These gates do not prove marketplace installation, live API use, native |
| 97 | +hardware, or production deployment. |
175 | 98 |
|
176 | 99 | ## Completion evidence |
177 | 100 |
|
178 | | -Report canonical and generated files changed, bundled CLI repository/commit/hash |
179 | | -(provenance), generation/validation results, stale-language scan, repository |
180 | | -status, and every skipped marketplace/live/backend/native gate. |
| 101 | +Report canonical and generated files changed, bundled CLI |
| 102 | +repository/commit/hash, generation/validation results, stale-language scan, |
| 103 | +repository status, skipped marketplace/live/native gates, and claim state. |
0 commit comments