Skip to content

Add dor identify: cmux-inspired JSON identity dump#210

Open
nedtwigg wants to merge 3 commits into
mainfrom
dor-identify
Open

Add dor identify: cmux-inspired JSON identity dump#210
nedtwigg wants to merge 3 commits into
mainfrom
dor-identify

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Jul 5, 2026

Copy link
Copy Markdown
Member

Summary

Adds a dor identify command: a JSON dump of where the invoking terminal sits within Dormouse and which app is hosting it.

{
  caller: {
    is_browser_surface: false,
    pane_ref: pane:1,
    surface_ref: surface:1,
    surface_type: terminal,
    window_ref: window:1,
    workspace_ref: workspace:1
  },
  cli_js_path: /path/to/dor-cli/dist/dor.js,
  focused: { ... },
  host: vscode,
  host_workspace: /path/to/project,
  node_path: /path/to/node
}

Design decisions

  • No new control method — composes over the existing surface.list, which already carries ids, refs, focus, and workspace/window refs; the caller is matched locally against DORMOUSE_SURFACE_ID.
  • Always JSON, alphabetical snake_case keys. --id-format refs|uuids|both per the handle-model invariant.
  • Host identity via new public PTY envDORMOUSE_HOST (vscode | standalone) injected by each host, and DORMOUSE_HOST_WORKSPACE (VS Code only: the owning window''s .code-workspace file when loaded, else its first workspace folder).
  • No socket in the output — the CLI is the public API and the control socket is private host plumbing; unlike cmux there is no socket API to advertise. A snapshot test proves the field stays absent even when DORMOUSE_CONTROL_SOCKET is set.
  • Nullable fieldscaller is null when the invoking surface is not visible (e.g. minimized to a Door); env-derived fields are null when the variable is absent (e.g. an older host).

Also fixes scripts/spec-lint.mjs on Windows (pre-existing): URL.pathname produced C:\C:\... roots, and backslash joins broke the index-completeness comparison against forward-slash paths in the markdown.

Testing

  • 4 CLI output tests + snapshots (json, --id-format both, no-env, invisible caller); help snapshots regenerated — all 68 dor tests pass.
  • pnpm lint:specs passes (now also on Windows); vscode-ext build and cargo check pass.
  • Verified end-to-end against a live Dormouse VS Code host: caller/focused resolved over the real control socket.

🤖 Generated with Claude Code

nedtwigg and others added 2 commits July 4, 2026 20:41
Composes over the existing surface.list control method (no new host
plumbing): the caller surface is matched locally against
DORMOUSE_SURFACE_ID, focused comes from the list, and the control
endpoint paths are read from the terminal's injected env. Supports
--id-format per the handle-model invariant; caller/focused/path fields
are null when unresolvable.

Also fixes scripts/spec-lint.mjs on Windows (pre-existing): fileURLToPath
for ROOT instead of URL.pathname, and POSIX-form repo-relative spec paths
so the index-completeness check matches the markdown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`find` on an undefined DORMOUSE_SURFACE_ID already misses every surface,
so the guard ternary duplicated what `?? null` provides; now symmetric
with the adjacent focused lookup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nedtwigg nedtwigg changed the title Add dor identify: cmux-inspired JSON identity dump Add dor identify: cmux-inspired JSON identity dump Jul 5, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: b87cf8b
Status: ✅  Deploy successful!
Preview URL: https://2e23a2ed.mouseterm.pages.dev
Branch Preview URL: https://dor-identify.mouseterm.pages.dev

View logs

- New public PTY env: DORMOUSE_HOST (vscode | standalone) injected by
  each host, and DORMOUSE_HOST_WORKSPACE (VS Code only: the window's
  .code-workspace file, else its first workspace folder).
- `dor identify` now emits host / host_workspace and no longer echoes
  the control socket path: the CLI is the public API and the socket is
  private host plumbing (there is no socket API to advertise).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants