From 90991fee325f76eaac97555a15ebcd69ddf45537 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 22 Sep 2026 21:29:31 -0700 Subject: [PATCH] docs: terminal file viewer structure and capability census Add CLAUDE.md structure notes for the viewer/ frontend and file_viewer/ backend, plus a Key Conventions reminder that a new local window needs its own capability file and lib.rs's on_window_event guard. Extend default.json's threat-model census to name file-viewer.json and its allow-destroy grant. Tighten the capability test in file_viewer/mod.rs from a substring check to a parsed serde_json assertion of the exact windows list and permission set for both capability files, per Task 12's controller ruling. Co-Authored-By: Claude Opus 5.5 (1M context) --- CLAUDE.md | 15 +++++++ app/src-tauri/capabilities/default.json | 2 +- app/src-tauri/gen/schemas/capabilities.json | 2 +- app/src-tauri/src/file_viewer/mod.rs | 50 ++++++++++++++++++++- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 256ba7f..1da6f56 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -73,6 +73,12 @@ docker exec stdout → tokio task → emit("terminal-output-{sessionId}") → li - **`hooks/`** — All Tauri IPC calls are encapsulated in hooks (`useTerminal`, `useProjects`, `useDocker`, `useSettings`) - **`lib/tauri-commands.ts`** — Typed `invoke()` wrappers; TypeScript types in `lib/types.ts` must match Rust models - **`components/terminal/TerminalView.tsx`** — xterm.js integration with WebGL rendering, URL detection for OAuth flow +- **`viewer/`** — the terminal file viewer's window (second Vite entry `viewer.html` → + `src/viewer/main.tsx`; CodeMirror 6). `lib/filePathLinks.ts` decides what a path is; + `components/terminal/filePathLinkProvider.ts` registers it with xterm. The OSC 8 handler now + runs with `allowNonHttpProtocols` on and dispatches `file:` to the viewer, so every other scheme + must be refused *there*. `viewer.html` must never carry an inline `