Files

51 lines
2.0 KiB
Markdown

# Launching sessions
**Status:** Implemented · **Code:** `Scripts/launch.js`
Prepares the command that starts or resumes a Claude Code session and puts it on
the clipboard.
## Why the clipboard
**Nova exposes no terminal API to extensions.** Verified three ways: no terminal
type in `@types/nova-editor-node`, nothing in the API reference, and in the Nova
14 binary `newTerminal:` is an Objective-C menu selector with no JS bridge. An
extension cannot open a terminal tab, cannot target an existing one, and cannot
type into either.
The options were an external terminal app (a separate window, outside Nova) or
the clipboard. The clipboard keeps everything in Nova at the cost of one paste.
If Panic ever ships a terminal API, `copyCommand()` is the only function that
changes.
## The command
```
cd <workspace> && claude [--resume <id>] [--remote-control] [configured flags]
```
- `cd` is included so a terminal opened anywhere lands in the project.
- The executable is spelled `claude` when it resolves to a standard install
location (which interactive shells have on `PATH`) and as an absolute path
otherwise — a version-manager shim or a configured path is not guaranteed to
be on the shell's `PATH`.
- Configured flags come from settings: `--model`, `--effort`,
`--permission-mode`, plus `claudenova.extraArgs`. A launched session therefore
matches what the sidebar says it will be.
- Everything is escaped with `shellQuote()` — paths with spaces are common
enough to matter.
## Remote Control
`--remote-control` is offered as a separate action per session. It is the CLI's
own flag for driving a session from elsewhere; because the extension launches an
ordinary CLI session, nothing extra is needed to support it.
## Gotchas
- The notification is a courtesy — the clipboard write is the actual outcome, so
a failed notification is logged and ignored.
- Do not name a specific Nova menu path in user-facing copy; the terminal's
location in the menus has not been verified from here.