diff --git a/.claude/docs/V1.2.1_STATUS.md b/.claude/docs/V1.2.1_STATUS.md index b790ca1a6..fab935c70 100644 --- a/.claude/docs/V1.2.1_STATUS.md +++ b/.claude/docs/V1.2.1_STATUS.md @@ -646,6 +646,13 @@ Then pushed `v1.2.1` to `origin` at the maintainer's request. **No merge and no **#256 (IDE), epic #253 (classic gaps after #163): PDF and image viewer tabs on a generic custom-editor seam** [confirmed: unit tests (`viewers.test.ts`: zoom steps and fit, find across pages and its item mapping, sizes, the resolver registry, `readDocument` limited to PDFs inside the folder including through a symlink), the gate, the smoke run, Playwright on Linux in both themes. That run covered a 12-page PDF drawn lazily with its text layer, Ctrl+F finding and highlighting "lazy" on page 3, zoom, an image with its size, a broken PDF reported, the split showing the PDF in both groups, a session restored with both, an external overwrite re-rendered (12 then 3 pages), a deletion shown in the tab, and Close Editor from the palette on an image tab.] - Main: `Workspace.readDocument` (PDF only, 64 MB cap, real path inside the folder) over IPC `codexr:workspace:read-document`; `readImage` also serves ICO and AVIF. - Renderer: + - `editor/customEditor.ts` (types), `editor/customEditorRegistry.ts` (DOM-free registry), and `editorGroup.openCustom` / `registerCustomEditor`. A custom tab is a document with an empty placeholder model under the `codexr-custom:` scheme plus one view per tab; text commands see no active document. + - `viewers/` (pdf.js viewer loaded lazily, image viewer, resolver). + - New command target `hasActiveTab` for close, split, keep, copy path and reveal. +- Dependency: `pdfjs-dist` 6.5.438 (Apache-2.0, notice added). +- Plugin: nothing to do, VS Code has its own viewers. +- The agent-first layout thread builds its chat tabs on the same seam. +- Not done: password-protected PDFs, the outline/thumbnails sidebar, printing, CJK PDFs without embedded fonts (no CMaps bundled). **#282 (IDE), epic #253: Markdown "Open Preview" as a tab (Ctrl+Shift+V)** [confirmed: the gate and Playwright on Linux. The palette offered the command, the "Preview guide.md" tab rendered the task list, table and code block, typing in the source updated it, and its link to `paper.pdf` opened the PDF viewer.] - A custom tab (`markdown-preview:`) registered inside `editorGroup.ts`. It reuses `createMarkdownPreview` with its header hidden, and follows the text model while the file is open, else the disk. @@ -658,13 +665,33 @@ Then pushed `v1.2.1` to `origin` at the maintainer's request. **No merge and no - `CustomEditorInput.alsoWatches` lets a tab follow a second file. - Commands: `workbench.files.action.compareWithSaved` (`Ctrl/Cmd+K D`), and tab menu entries. - Plugin: nothing to do, VS Code has both. - - `editor/customEditor.ts` (types), `editor/customEditorRegistry.ts` (DOM-free registry), and `editorGroup.openCustom` / `registerCustomEditor`. A custom tab is a document with an empty placeholder model under the `codexr-custom:` scheme plus one view per tab; text commands see no active document. - - `viewers/` (pdf.js viewer loaded lazily, image viewer, resolver). - - New command target `hasActiveTab` for close, split, keep, copy path and reveal. -- Dependency: `pdfjs-dist` 6.5.438 (Apache-2.0, notice added). -- Plugin: nothing to do, VS Code has its own viewers. -- The agent-first layout thread builds its chat tabs on the same seam. -- Not done: password-protected PDFs, the outline/thumbnails sidebar, printing, CJK PDFs without embedded fonts (no CMaps bundled). + +**#285 (IDE), epic #253 (classic gaps after #163): explorer file operations** [confirmed: unit tests (`workspaceCopyMove.test.ts`, 15 cases: copy and move of a file and of a folder, " copy" / " copy 2" / " copy 3" with the extension kept and a dotfile without one, a folder refused into itself and below itself, `..`, absolute paths and the root refused, a symlink leading out refused at either end, a link inside a copied folder kept when it stays in and left out when it leads out, the entry and size caps refusing before anything is written, a taken name refused on move, `revealablePath`/`terminalFolder` inside the folder only), `workspace.test.ts` still green after the root-refusal message changed, the IDE gate (`npm test`: typecheck, lint at `--max-warnings 0`, 683 tests, 0 failures), the smoke run under xvfb on Linux. Not driven by hand: the context menu, the keyboard shortcuts and the toolbar in the real window, Reveal and the terminal on Windows and macOS.] +- Main: `Workspace.copyEntry` / `moveEntry` (both ends by real path, never into itself, never overwriting; a copy is planned whole first and capped at 10,000 entries / 512 MB via `COPY_LIMITS`; a move across disks falls back to copy then remove), `revealablePath`, `terminalFolder`, and `freeCopyName`. IPC `codexr:workspace:copy-entry`, `move-entry`, `reveal-in-os` (`shell.showItemInFolder` on the checked real path); `terminal.create` takes an optional workspace path as its cwd, resolved by `terminalFolder` in main. The refusal of the root now says "renamed, moved, copied or deleted". +- Trust (#177): like create, rename and trash, copy and move work in Restricted Mode (they run nothing); Reveal and Open in Integrated Terminal follow "the terminal you open yourself", which also works either way. +- Renderer: the explorer's menu on files, folders and the tree's free space (Open, Reveal in File Explorer / Finder / File Manager by platform, Open in Integrated Terminal, Cut, Copy, Paste, Duplicate, Copy Path, Copy Relative Path, Rename, Delete, then the existing XR items for files); the clipboard lives in `explorer.ts` (a cut row gets `is-cut`, dimmed; it follows a rename and is dropped on trash); Ctrl/Cmd+C, X, V in the tree; toolbar Refresh Explorer and Collapse Folders in Explorer. A cut-and-paste move calls `onRenamed`, i.e. `editors.entryMoved`, so open tabs follow as they do a rename. +- Not done: drag and drop in the tree, multi-selection, the OS clipboard (copying files between the IDE and the file manager), undo of a paste, and a "replace?" prompt on a move over a taken name (refused instead). + +**#284 (IDE), Source Control remote operations: push, pull, fetch, sync, stash, delete branch** [confirmed: unit tests (`gitRemote.test.ts`, 18 tests: a local bare remote and two clones for publish with upstream, fetch then pull, a diverged sync merging then pushing, a rejected push explained, prune, the remote choice among several; stash, stash `-u`, apply, drop, pop restoring the change, bad indexes refused; delete of a merged branch, an unmerged one refused until forced, the current one refused; a local HTTP server answering 401 failing fast with the authentication hint, a missing path, a server that never answers stopped at a 1.5 s timeout and cancelled through an `AbortSignal`; the error-message mapping, `syncItem`, the pickers, the ten `git.*` command ids, the allow-listed channels), the gate (`cd apps/ide && npm test`: 687 tests, 686 pass, 1 skipped for debugpy, typecheck and lint clean), and the smoke run under xvfb on Linux, which now also checks that `git.remote`, `git.stash` and `git.deleteBranch` are refused in Restricted Mode. Not run: Windows and macOS, a real authenticated GitHub remote, Playwright on the new menu and status item.] +- Main: `GitService.push/pull/fetch/sync/remotes/stash/stashes/stashAction/deleteBranch`; remote calls run with `REMOTE_GIT_ENV` (`GIT_TERMINAL_PROMPT=0`, `GCM_INTERACTIVE=never`), a 120 s timeout and an `AbortSignal` (`GitCancelledError`); `remoteErrors.ts` prefixes git's message with what to do. Pull merges with `--no-rebase` unless a pull strategy is configured. Stash runs without `--literal-pathspecs`, which otherwise leaves `-u`'s untracked files in the work tree (git 2.43, reproduced). IPC: `codexr:git:remote`, `cancel-remote`, `stash`, `stashes`, `stash-apply/pop/drop`, `delete-branch`, all behind the Restricted Mode check; one remote operation per window, aborted on a folder or trust change. New Output channel `git`. +- Renderer: the "..." menu of the Source Control view, the palette's `git.*` commands (`renderer/git/gitCommands.ts`), the sync item beside the branch (the ahead/behind counts moved there from the branch label), a progress notification with Cancel (`ProgressUpdate.onCancel`), errors with Show Output; Delete Branch confirms before `-D`, Drop Stash confirms. +- Note: the smoke run shares its user-data folder between worktrees, so two smoke runs at once can read each other's tab session and fail the tabs check; it passed on reruns. +- Not done: choosing a remote branch to pull from, pull with rebase from the UI, fetch from all remotes as a separate command, stash with a message, the incoming/outgoing commit list. + +**#286 (IDE), epic #253: terminal find and links** [confirmed: unit tests (`terminalLinks.test.ts`: path, path:line and path:line:column, `a.js(12,5)`, Python tracebacks and Node stack frames (named, anonymous, `file://`, `node:` built-ins refused), absolute paths inside the folder made relative and paths outside it, `~/` and climbing `..` refused, Windows drive paths with either separator and any case, other drives, UNC and rooted paths refused, backslashes refused off Windows, URLs not taken for paths, wrapped rows and wide characters mapped to cells, the existence check with its cache and case rules; `smoke.test.ts`), the gate (`npm test` in `apps/ide`, lint at `--max-warnings 0`), `node scripts/build.mjs` (both addons land in the lazy `xtermView` chunk). The smoke run on Linux under xvfb: Ctrl+F in the terminal opened the widget and counted `codexr-smoke` ("1 of 2"), Escape closed it and gave the focus back, hovering `src/main/index.ts:3:1` in the output showed the link hint, Ctrl+click opened it at line 3, and Ctrl+F in that editor then opened Monaco's find, not the terminal's; no CSP violation. The smoke's only failure, `tabs.sessionSaved`, also fails on the unchanged `ide` branch in this container. Playwright on Linux in both themes: Enter / Shift+Enter moved between matches ("1 of 2", "2 of 2", "1 of 2"), the case toggle and the count followed, and Ctrl+click on a Python traceback's absolute path opened `scripts/build.mjs` at Ln 2.] +- Dependencies: `@xterm/addon-search` 0.16.0 and `@xterm/addon-web-links` 0.12.0, pinned, released with `@xterm/xterm` 6.0.0 (MIT, notice added). +- Renderer: `terminal/terminalLinks.ts` (pure parser, logical-line reader, `listDirectory`-based existence check), `terminal/terminalFind.ts` (the widget, one per panel, following the active terminal), `xtermView.ts` (addons, link provider, `find`/`clearFind`, `allowProposedApi: true` for the search addon's match count), the `terminal.find` command (`CmdOrCtrl+F`, enabled only while the focus is in the terminal panel). +- Not verified end to end: Ctrl+click on a URL launching the system browser (the handler calls `openExternalLink`, unchanged); macOS and Windows runs. +- Not done: links relative to a shell that changed directory (relative paths are read from the folder), paths with spaces outside quoted Python frames. + +**#287 (IDE), epic #21: references, rename, signature help, highlights, quick fixes and workspace symbols from the language servers** [confirmed: unit tests (`lspEdits.test.ts`: the new requests' rebuilt parameters and refusals, `WorkspaceEdit` mapping in both forms with edits outside the folder and create/rename/delete refused whole, code actions keeping only their edit, workspace symbols filtered to the folder, the renderer's URI guard, text edits applied across `\r\n`/`\n`/`\r` with overlaps refused, signature help/highlight/marker conversions, "#" in quick open and its debounced search), an end-to-end test (`lspRefactor.test.ts`) against the bundled typescript-language-server (references and rename across `a.ts` open and `b.ts` not open, written through `Workspace.writeFile` with the mtime check; signature help inside a call; the "Add import" quick fix; workspace symbols; a rename that would change `../shared/config.ts` refused) and against pyright-langserver 1.1.414 (references and rename across two files, one not open; signature help), skipped cleanly without a Python server on PATH, the gate (`npm test`, lint at 0 warnings) and the smoke run under Xvfb. Not driven by hand in the window: the rename box, the lightbulb, the Problems menu and Ctrl+T.] +- Bridge: seven more methods in `LSP_REQUEST_METHODS` (references, prepareRename, rename, signatureHelp, documentHighlight, codeAction, workspace/symbol), parameters rebuilt in `lspProtocol.ts`; answers mapped by the new `main/lsp/lspResults.ts`. `codeAction/resolve` is not needed: the client advertises no resolve or data support, so typescript-language-server sends each fix with its edit. +- Edits: the main process rebuilds a `WorkspaceEdit` as text edits per `codexr-file:` URI and refuses it whole when a file is outside the folder or when it creates, renames or deletes a file (`resourceOperations: []` is advertised too). The renderer (`renderer/lsp/lspEdits.ts`) checks the URIs again, then `EditorGroup.applyWorkspaceEdit` applies it: open files as one undoable edit each (left unsaved), the others read, edited and written through `workspace.readFile`/`writeFile` (real path inside the folder, refused if changed on disk), every file prepared first and the written ones put back if a later write fails. The status bar says "Renamed 'a' to 'b' in N files". +- Commands stay refused: code actions keep only their edit (typescript-language-server's `_typescript.applyCodeActionCommand` repeats the same edit), command-only actions (refactorings such as Extract Function) are left out, and `workspace/applyEdit` from a server stays refused, since a server only sends it while running a command the IDE never sends. +- Monaco: reference, rename (Monaco gets no edits; the editor group applies them), signature help, highlight and code action providers for every language with a server; Monaco's built-in TypeScript service has references, rename, signature help, highlights and code actions turned off. Quick fixes run a registered command (`codexr.lsp.applyWorkspaceEdit`), because Monaco's standalone bulk edit cannot reach a file without a model. +- Problems panel: a context menu per problem (Go to Problem, Quick Fix..., Copy Message; also Shift+F10); Quick Fix selects the range and runs `editor.action.quickFix`. Quick open: "#" lists `workspace/symbol` from every running server (`renderer/workspaceSymbols.ts`), and **Go to Symbol in Workspace…** (Ctrl/Cmd+T) opens it. +- Plugin: nothing to do, VS Code has all of these. +- Not done: the references peek shows no preview text for files that are not open (Monaco's standalone model service has no model for them; the list and opening work); the servers are not told about the files written behind them (`workspace/didChangeWatchedFiles`); pylsp is detected but was not available to test. **#176 (IDE), sixteenth PR of epic #163: tasks and Run Current File** [confirmed: unit tests (`tasks.test.ts`: package.json scripts and hooks, package manager by lock file, Makefile targets, `.codexr/tasks.json` with comments, matchers by command, interpreters by extension, PATH and PATHEXT lookup, quoting for bash/PowerShell/cmd, tsc and ESLint matchers, a command terminal's output and exit code), the smoke run (an untrusted folder lists its tasks as not trusted and refuses a run), Playwright on Linux: Run Task in Restricted Mode shows the explanation with Manage Workspace Trust; once trusted the picker lists the user task, `npm: hello` and `make: build`; each ran in its own tab with its exit code; the user task's tsc-shaped line reached the Problems panel; Run Current File ran `run me.py` (a space in the name) with python3]. `shared/tasks.ts` (pure), `main/tasks/taskHost.ts` + `problemMatchers.ts`, `TerminalService.createCommand` (the default profile's shell with `-c` or its equivalent, `shellInvocation` from the agents' command tool), `Workspace.runnableFile`, settings `run.pythonInterpreter` / `run.nodeInterpreter`, commands `workbench.action.tasks.runTask`, `workbench.action.tasks.configureTaskRunner`, `workbench.action.runCurrentFile` (`Ctrl/Cmd+F5`). Core: `ProblemOrigin` gains `task` (type only; the plugin never produces it). The user tasks file is `.codexr/tasks.json`, next to `.codexr/settings.json`, not the `.code-xr/` the issue wrote. Windows and macOS not run by hand: the quoting and PATHEXT paths are unit-tested and CI runs the gate on all three. Plugin: nothing to do, VS Code has tasks natively. diff --git a/apps/ide/README.md b/apps/ide/README.md index ef85f072a..6e73c516d 100644 --- a/apps/ide/README.md +++ b/apps/ide/README.md @@ -98,6 +98,8 @@ The renderer only reports the slot's bounds (`analysis.setSceneBounds`, sanitise **Editor tabs (#167).** A single click in the explorer opens a file in the *preview* tab (italic), which the next single click replaces; double-clicking the file or the tab, editing it, dragging it or **Keep Editor** (`Ctrl/Cmd+K Enter`) keeps it, and Enter in the explorer opens for keeps. Tabs drag to reorder, close with a middle click, cycle with `Ctrl+PageDown`/`Ctrl+PageUp` (or `Ctrl+Tab`/`Ctrl+Shift+Tab`), move with the arrow keys, Home and End when the strip has the focus, and scroll sideways with the wheel when they overflow. Right-click (or the context-menu key, `Shift+F10`) opens the tab menu: Close, Close Others, Close to the Right, Close Saved (`Ctrl/Cmd+K U`), Close All (`Ctrl/Cmd+K W`), Copy Path, Copy Relative Path (the main process checks the path and writes the clipboard; the renderer has no clipboard permission), Keep Open and Reveal in Explorer. A group close asks once, listing the unsaved tabs it would discard. The open tabs, their order, the preview, the active tab and each tab's view state (cursor, scroll, folding) are a session of the folder, saved in renderer storage under the folder's path and restored when it opens again; a file gone since is skipped (`editor/tabsModel.ts`, `contextMenu.ts`). +**Explorer operations (#285).** Right-click a file, a folder or the explorer's free space (the top folder) for: Open, **Reveal in File Explorer** / **Reveal in Finder** / **Reveal in File Manager** (by platform; `shell.showItemInFolder`), **Open in Integrated Terminal** (a new terminal in that folder, or in a file's folder), Cut, Copy, Paste, Duplicate, Copy Path, Copy Relative Path, Rename (F2) and Delete (to the OS trash). `Ctrl/Cmd+X`, `C` and `V` work while the tree has the focus. The clipboard is the explorer's own and names an entry, not its contents; a cut entry is dimmed until it is pasted. A paste over a taken name is named like VS Code's, `" copy"`, then `" copy 2"`..., before the extension (`a copy.ts`, `.env copy`); a cut-and-paste move over a taken name is refused, never overwritten, and its open tabs follow it as they follow a rename (`editors.entryMoved`). The toolbar adds **Refresh Explorer** and **Collapse Folders in Explorer**. The main process does the work (`Workspace.copyEntry`, `moveEntry`, `revealablePath`, `terminalFolder`): both ends are checked by real path inside the folder, a folder is never pasted into itself or below itself, and a copy is walked whole before anything is written and refused above 10,000 entries or 512 MB (`COPY_LIMITS`); a symlink inside a copied folder is copied as its target when that stays inside, and left out otherwise. The terminal's cwd is resolved in main from the workspace path, so the renderer never names a directory. Like create, rename and trash, these work in Restricted Mode (#177): they edit files and run nothing, and the terminal is one you open yourself. + **Split editor (#168).** **Split Editor Right** (`Ctrl/Cmd+\`, or Split Right in the tab menu) opens the file in a second editor group beside the first; `Ctrl/Cmd+1` and `Ctrl/Cmd+2` focus a group (the second is created on first use). Both groups share one Monaco model per file, so an edit in either shows in both and the file has a single dirty state; closing a file asks about unsaved changes only when its last tab goes. A tab dragged onto the other group's strip moves there with its view state. The sash between the groups drags (pointer or arrow keys) and resets on double-click; each group keeps at least 120 px, half the editor column's minimum, so the XR scene column keeps its width. The group that has the focus owns the breadcrumbs, the status bar and the commands. A group left without tabs closes. The second group, the split ratio and the focused group are part of the folder's tab session, so a restart restores them; a session saved before the split existed reads as one group (`editor/editorGroup.ts`, `editor/tabsModel.ts`). Not implemented: vertical splits and more than two groups. **Markdown preview (#179).** **Open Preview to the Side** (`Ctrl/Cmd+K V`, or the tab menu of a Markdown file) opens a pane to the right of the editor groups that renders the active Markdown file with GitHub-flavoured Markdown (headings, lists, task lists, tables, code blocks coloured by Monaco's own tokenizer, images). It re-renders as you type, follows the editor's scroll, takes over whichever Markdown file becomes active, and uses the workbench's colours, so it follows the theme. Its sash drags and resets on double-click like the split one. The preview is the only place in the renderer that inserts parsed markup, so it is fenced: DOMPurify sanitises everything (no script, no `