claude-dev-env 8.64.0 → 8.65.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.
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: mod-playbooks
3
+ description: >-
4
+ Map of playbooks for driving a Claude Code mod (plugin) and seeing its screen: press keys, open menus and drawers, hover a reply to show its action row, click a dropdown, type in a field, fire a toast or a question card, and capture each screen as text and PNG. Use when an agent must test a mod, check a fix by looking at it, or show a mod to the operator on their own desktop.
5
+ ---
6
+
7
+ # Mod playbooks
8
+
9
+ ## Principle
10
+
11
+ An agent proves a mod works by driving it and reading the screen. It needs no person for that. A
12
+ cloud session runs Claude Code in a pseudo-terminal, plays the steps, and reads each capture. The
13
+ operator's desktop comes last, when a person wants to look.
14
+
15
+ ## Pick the route
16
+
17
+ | Goal | Route | Reference |
18
+ | --- | --- | --- |
19
+ | Test a mod, or check a fix, with no person | Drive it in a pseudo-terminal and read the captures | [cloud-drive.md](references/cloud-drive.md) |
20
+ | Let the operator watch the mod on their own screen | Open a desktop window from a Remote Control session | [desktop-window.md](references/desktop-window.md) |
21
+ | Prove what the operator's window shows | Capture that window to a PNG | [desktop-capture.md](references/desktop-capture.md) |
22
+
23
+ When the mod's repository ships a driver and playbooks, use them first. Look for a `drive.mjs` beside
24
+ a `playbooks/` folder and a playbook guide in its docs. Read the guide, run the matching playbook, and
25
+ add a playbook for any new screen you test.
26
+
27
+ ## Playbook map
28
+
29
+ Each row is one thing an agent does to a mod, and the input that does it. The bytes are in
30
+ [cloud-drive.md](references/cloud-drive.md).
31
+
32
+ | Do this | Input | Check on screen |
33
+ | --- | --- | --- |
34
+ | Send a prompt | Type the text, then Enter | The scripted reply |
35
+ | Open a slash-command menu or pane | Type the command, then Enter | The pane's title |
36
+ | Open a pane from a footer pill | Click the pill's label | The pane's title |
37
+ | Move between buttons in a pane | Tab forward, Shift+Tab back, Enter to press | The focused button |
38
+ | Toggle a control | Click its label | The control's new state |
39
+ | Close a pane | Escape | The prompt again |
40
+ | Show a reply's action row | Hover the reply text; the row draws only under the pointer | The action labels |
41
+ | Pick from a dropdown | Click the action, click the choice, click the confirm button | The confirm line |
42
+ | Type in a text field | Click the field label, type, then Enter | The saved text |
43
+ | Fire a toast | Script a tool turn the mod watches, and allow that tool | The toast's words, top right |
44
+ | Raise a question card | Script a question tool turn, then click an option | The answered line |
45
+
46
+ ## Self-resolve loop
47
+
48
+ 1. Change the mod.
49
+ 2. Run the playbook for the screen you changed.
50
+ 3. Read the `.txt` capture for words, and open the `.png` for color and layout.
51
+ 4. On a failed step, read `failure.png`, fix the cause, and run again.
52
+ 5. Keep the passing captures as the proof, then show the operator if they asked to see it.
53
+
54
+ ## Limits
55
+
56
+ - The cloud route proves the mod's screens. It runs a mock model, so it proves nothing about model output.
57
+ - Drive input with the mod repository's driver, in the cloud or on the operator's PC. The desktop window is for looking only.
58
+ - A screen that needs the operator's account, files or network stays on the desktop route.
@@ -0,0 +1,47 @@
1
+ # Drive a mod in a pseudo-terminal
2
+
3
+ A cloud session can run Claude Code with a mod loaded, press keys, click, hover, and capture the screen,
4
+ with no PC and no person. Use the mod repository's own driver when it ships one. Build on the same parts
5
+ when it does not.
6
+
7
+ ## The parts
8
+
9
+ | Part | Job |
10
+ | --- | --- |
11
+ | `node-pty` | Runs `claude --plugin-dir <mod>` in a pseudo-terminal. |
12
+ | `@xterm/headless` | Mirrors the output into a cell buffer, so the screen reads as text with colors. |
13
+ | A local mock of the Messages API | Scripts each model turn, so the model calls the tool that fires the mod. Point `ANTHROPIC_BASE_URL` at it. |
14
+ | A throwaway home and config folder | Seeds onboarding, API key approval and folder trust, so the first screen is the prompt. |
15
+ | A renderer | Paints the cells to HTML and screenshots it with Playwright Chromium, so the capture is a PNG. |
16
+
17
+ ## Input bytes
18
+
19
+ | Action | Bytes written to the terminal |
20
+ | --- | --- |
21
+ | Enter | `\r` |
22
+ | Tab, Shift+Tab | `\t`, `\x1b[Z` |
23
+ | Escape | `\x1b` |
24
+ | Arrow up, down, right, left | `\x1b[A`, `\x1b[B`, `\x1b[C`, `\x1b[D` |
25
+ | Clear the prompt line | `\x15` |
26
+ | Left click at column `c`, row `r` (1-based) | `\x1b[<0;c;rM` then `\x1b[<0;c;rm` |
27
+ | Hover at column `c`, row `r` | `\x1b[<35;c;rM` |
28
+
29
+ Find `c` and `r` by searching the cell buffer for the text to point at. Search from the bottom row up,
30
+ so a click lands on the newest copy of a label. Skip zero-width cells when you join a row, or wide
31
+ characters shift every column after them.
32
+
33
+ ## The loop
34
+
35
+ 1. Write the steps: the scripted turns, then each key, click or hover, the text to wait for, and a capture.
36
+ 2. Run them. Wait for each step's text, then for the screen to stop changing, before the next step.
37
+ 3. Read the text capture for words, and open the PNG for color and layout.
38
+ 4. Fix the mod, run again, and keep the passing captures as the proof.
39
+
40
+ ## Gotchas
41
+
42
+ - A tool the scripted turn calls needs `--allowedTools <tool>`, or a permission prompt stops the run.
43
+ - Check the request body for your tool id, so the second request ends the turn with text.
44
+ - A mod can refuse to draw a pane below a minimum width. Run at 180 columns unless the steps need less.
45
+ - A toast draws in the top-right corner, over the header rows.
46
+ - A PNG renderer can paint a wide emoji over the next cell. The text capture holds the characters as drawn.
47
+ - A step that runs a script from the project folder fails in the sandbox, because that folder is empty.
@@ -0,0 +1,41 @@
1
+ # Capture a desktop window
2
+
3
+ Run this on the operator's PC after the mod fires. It asks the window to paint itself into a bitmap
4
+ with `PrintWindow`, so another window on top does not spoil the image. Open the demo with
5
+ `wt.exe -w new` and `--suppressApplicationTitle`, so its window keeps the demo title and the block
6
+ below can find it by that title.
7
+
8
+ ```powershell
9
+ Add-Type -AssemblyName System.Drawing
10
+ Add-Type @"
11
+ using System; using System.Runtime.InteropServices;
12
+ public struct RECT { public int Left, Top, Right, Bottom; }
13
+ public static class W {
14
+ [DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
15
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
16
+ [DllImport("user32.dll")] public static extern bool PrintWindow(IntPtr h, IntPtr hdc, uint flags);
17
+ }
18
+ "@
19
+ [W]::SetProcessDPIAware() | Out-Null
20
+ $window = Get-Process WindowsTerminal | Where-Object MainWindowTitle -like '*Mod demo*' | Select-Object -First 1
21
+ $rect = New-Object RECT
22
+ [W]::GetWindowRect($window.MainWindowHandle, [ref]$rect) | Out-Null
23
+ $bitmap = New-Object System.Drawing.Bitmap ($rect.Right - $rect.Left), ($rect.Bottom - $rect.Top)
24
+ $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
25
+ $hdc = $graphics.GetHdc()
26
+ [W]::PrintWindow($window.MainWindowHandle, $hdc, 2) | Out-Null
27
+ $graphics.ReleaseHdc($hdc)
28
+ $bitmap.Save((Join-Path $env:TEMP 'mod-demo.png'))
29
+ ```
30
+
31
+ Report the path and size, and say whether the image shows color and the mod's output. The PNG stays on
32
+ the PC; a cloud session that needs to see it stages the file through the device folder tools, or has
33
+ the PC session post it. A toast fades, so capture while it shows, or capture twice.
34
+
35
+ ## What went wrong before
36
+
37
+ | Capture | Result |
38
+ | --- | --- |
39
+ | `CopyFromScreen` on the window rectangle, demo opened with `new-tab` | 1752 x 936 in color, but it showed the active tab and missed the toast. |
40
+ | `CopyFromScreen` without `SetProcessDPIAware` | The image held the wrong region, with other windows in it. |
41
+ | `SetProcessDPIAware`, then `PrintWindow` with flag 2 (`PW_RENDERFULLCONTENT`) | 2520 x 936 in full color, as reported by the PC session. |
@@ -0,0 +1,79 @@
1
+ # Open a mod on the operator's desktop
2
+
3
+ A toast, pane or status line shows only in the Claude Code window that loads the mod. A Remote Control
4
+ session has no window the operator can see. So the session opens a new desktop window that loads the
5
+ mod, and the operator only looks at it.
6
+
7
+ ## Gotchas
8
+
9
+ - A mod loaded inside the Remote Control session fires its toast there. The operator sees nothing.
10
+ - `/plugin install` plus hot reload asks the operator to click "Enable for this session". `--plugin-dir` on a new window skips that prompt.
11
+ - A child window inherits `NO_COLOR=1` and `CLAUDE_CODE_CHILD_SESSION=1` from the Remote Control process. The window then runs black and white. Remove both variables in the child before `claude` starts.
12
+ - `Start-Process pwsh` opens the old console host. Launch through `wt.exe` to get Windows Terminal.
13
+ - `wt.exe new-tab` lands in an existing Windows Terminal window. A screen capture then shows whichever tab is active. Use `wt.exe -w new` for a window of its own.
14
+ - `wt.exe` is an app execution alias. Call it by its full path under `%LOCALAPPDATA%\Microsoft\WindowsApps`.
15
+ - When the operator already has the same plugin installed, both copies load. A `--settings` file with `{"enabledPlugins":{"<plugin>@<marketplace>":false}}` turned off the installed copy for that one session.
16
+ - A shell or program can rename the tab, and the window title follows it. Pass `--suppressApplicationTitle` so the capture can find the window by its demo title.
17
+
18
+ ## The auto mode safety check
19
+
20
+ The Remote Control session runs in auto mode, and its classifier reads the operator's message that
21
+ started the session. Two launches with the same commands went two ways:
22
+
23
+ | Seed message | Result |
24
+ | --- | --- |
25
+ | The operator asked to see the mod run: "can i see it in action? build the mod and show me" | The window opened. |
26
+ | The operator described a design change and asked for no run | The first step, writing the launcher script, was refused: `Permission for this action was denied by the Claude Code auto mode classifier. Reason: [Auto-Mode Bypass].` |
27
+
28
+ The likely rule, inferred from these two cases: start the session on the operator's own message that asks
29
+ to see or run the mod, and quote that ask in the instructions. When no such message exists, ask the
30
+ operator in one line whether to open the window, and start the session on the answer. A refused
31
+ step is final for that session; report the refusal text and stop.
32
+
33
+ ## Steps
34
+
35
+ 1. Start a Remote Control session, on the operator's message that asks to see the mod, in a folder on
36
+ the operator's PC that is already approved.
37
+ 2. Clone the mod's branch to a fresh temporary folder:
38
+
39
+ ```powershell
40
+ $dir = Join-Path $env:TEMP ('mod-demo-' + (Get-Date -Format 'HHmmss'))
41
+ git clone -q --depth 1 -b <branch> <repo-url> $dir
42
+ ```
43
+
44
+ 3. Write a launcher script that clears the inherited variables and starts Claude Code with the mod:
45
+
46
+ ```powershell
47
+ $script = Join-Path $env:TEMP 'mod-demo.ps1'
48
+ @"
49
+ Remove-Item env:NO_COLOR, env:CLAUDE_CODE_CHILD_SESSION -ErrorAction SilentlyContinue
50
+ Set-Location `$env:USERPROFILE
51
+ claude --plugin-dir '$dir\plugins\<mod>' '<one harmless prompt that fires the mod>'
52
+ "@ | Set-Content -Encoding utf8 $script
53
+ ```
54
+
55
+ 4. Open it in its own Windows Terminal window with PowerShell 7:
56
+
57
+ ```powershell
58
+ $wt = Join-Path $env:LOCALAPPDATA 'Microsoft\WindowsApps\wt.exe'
59
+ Start-Process $wt -ArgumentList "-w new new-tab --title `"Mod demo`" --suppressApplicationTitle pwsh -NoExit -File `"$script`""
60
+ ```
61
+
62
+ 5. Capture the window with [desktop-capture.md](desktop-capture.md) and check the PNG yourself.
63
+ 6. Tell the operator the window is open and what to look at. Hand over a pasteable command only when
64
+ the launch failed, and say why it failed.
65
+
66
+ ## Input on the operator's PC
67
+
68
+ To click, hover or type into a mod on the operator's PC, run the mod repository's driver there from the
69
+ Remote Control session, for example `node tools/visual-test/drive.mjs <playbook> <capture-folder>`.
70
+ The driver owns its pseudo-terminal, so no input goes to a desktop window, and the auto mode check has
71
+ nothing to refuse. One PC run of the drawer playbook passed with no refusal, where a session that sent
72
+ operating-system keystrokes to a demo window was refused. Post the driver's PNG captures.
73
+ Never send operating-system keystrokes or clicks to the demo window.
74
+
75
+ ## Verification
76
+
77
+ - The operator sees the window without any click.
78
+ - The window shows color and runs in Windows Terminal with PowerShell 7.
79
+ - The mod loads with no failure line, and its toast or pane appears.
@@ -99,6 +99,7 @@ export const EVER_SHIPPED_SKILL_NAMES = new Set([
99
99
  'second-account-workers',
100
100
  'session-continuity',
101
101
  'session-log',
102
+ 'mod-playbooks',
102
103
  'session-tidy',
103
104
  'pr-shared-extraction',
104
105
  'show',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "8.64.0",
3
+ "version": "8.65.0",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {