Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(control): register the open-project verb in the model (inert)

enesa223ac3e8b1d
diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.ts
index f7329b5ae..d23098906 100644
--- a/src/main/canvas-control-core.test.ts
+++ b/src/main/canvas-control-core.test.ts
@@ -26,6 +26,25 @@ describe('parseControlRequest', () => {
expect(parseControlRequest('nuke', {})).toEqual({ error: 'Unknown verb: nuke' })
})
+ it('open-project requires --cwd (issue #338, PR 1)', () => {
+ expect(parseControlRequest('open-project', {})).toEqual({
+ error: 'open-project requires --cwd <abs-path>'
+ })
+ expect(parseControlRequest('open-project', { cwd: '/tmp/repo' })).toEqual({
+ verb: 'open-project',
+ args: { cwd: '/tmp/repo' }
+ })
+ })
+
+ it('open-project is NOT in DESTRUCTIVE_VERBS yet — that membership lands with PR 2', () => {
+ // Deliberate PR slicing, not an oversight: `control-destructive.test.ts` structurally
+ // requires every member's `Canvas.tsx` case to read `isDestructiveVerb(verb)`, and the
+ // dispatch case for open-project only exists in PR 2 (Task 2.2). Adding the verb to the set
+ // now would trip the set↔dispatch drift alarm with no dispatch to agree with. This test goes
+ // red the moment PR 2 adds the membership, which is the reminder to delete it.
+ expect(isDestructiveVerb('open-project')).toBe(false)
+ })
+
it('requires a target for write/close', () => {
expect(parseControlRequest('close', {})).toEqual({ error: 'close requires --node <id>' })
expect(parseControlRequest('write', { node: 'n1' })).toEqual({ error: 'write requires --text' })
diff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.ts
index 0dcf73a59..61391abf6 100644
--- a/src/main/canvas-control-core.ts
+++ b/src/main/canvas-control-core.ts
@@ -120,6 +120,7 @@ export type ControlVerb =
| 'notify'
| 'sticky'
| 'browser'
+ | 'open-project'
export interface ControlCommand {
verb: ControlVerb
@@ -155,7 +156,12 @@ const VERBS: ControlVerb[] = [
'reply',
'notify',
'sticky',
- 'browser'
+ 'browser',
+ // Issue #338 PR 1: registered in the model (parse + gates + the grant ledger run in main), but
+ // INERT until PR 2 adds the renderer dispatch case — today the renderer's `default:` answers
+ // `unknown verb: open-project`. Deliberately undocumented in the skill/instructions bodies until
+ // PR 2 makes it do something (spec §8: docs land in the same PR that makes the verb reachable).
+ 'open-project'
]
/**
@@ -226,6 +232,11 @@ export function parseControlRequest(
// enforced in hook-server before it ever reaches a handler) and refused by name on the Server
// Edition (control-unsupported-on-this-edition), where there is no webview to drive.
if (v === 'browser' && !args.node) return { error: 'browser: --node <id> is required' }
+ // `open-project` requires a cwd; everything else about the argument (absolute, exists, is a
+ // directory, resolved once) is validated in MAIN by `validateOpenProjectCwd`
+ // (src/main/project-grants.ts) — the caller's path is hostile input and this presence check is
+ // only the polite half.
+ if (v === 'open-project' && !args.cwd) return { error: 'open-project requires --cwd <abs-path>' }
return { verb: v, args }
}