Removes the retained-worktree store end to end: the daemon's state-dir store, GET/DELETE /api/worktrees, `maestro worktrees list|reclaim`, the TUI overlay behind `w`, and the web `#/worktrees` view and header link. The kill guard stays. A forced kill and a dirty natural exit now leave the worktree on disk untouched instead of parking it in a store, so removing one is an ordinary `git worktree remove`. A pristine tree is still removed on exit. DELETE /api/sessions/:id always answers 204. The header's debug button also goes; Ctrl+Shift+D and `?hud` still toggle the HUD. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
// Mirror of `maestro-protocol::routes`. Keep in sync with
|
|
// crates/maestro-protocol/src/routes.rs.
|
|
|
|
import type { Uuid } from "./types.js";
|
|
|
|
export const API_PREFIX = "/api";
|
|
|
|
export const SESSIONS = "/api/sessions";
|
|
export const INFO = "/api/info";
|
|
export const DIRS = "/api/dirs";
|
|
export const RECENT_DIRS = "/api/recent-dirs";
|
|
export const PROJECTS = "/api/projects";
|
|
export const GITROOT = "/api/gitroot";
|
|
export const NAMES = "/api/names";
|
|
export const BRANCHES = "/api/branches";
|
|
export const EVENTS = "/api/events";
|
|
|
|
/** Name of the query parameter `DIRS` and `GITROOT` both take. */
|
|
export const PATH_QUERY = "path";
|
|
|
|
/** Name of the query parameter `NAMES` takes. */
|
|
export const COUNT_QUERY = "count";
|
|
|
|
export function session(id: Uuid): string {
|
|
return `${SESSIONS}/${encodeURIComponent(id)}`;
|
|
}
|
|
|
|
export function attach(id: Uuid): string {
|
|
return `${API_PREFIX}/attach/${encodeURIComponent(id)}`;
|
|
}
|
|
|
|
/** Append the `path` query parameter `DIRS` and `GITROOT` accept. */
|
|
export function withPathQuery(route: string, value: string): string {
|
|
return `${route}?${PATH_QUERY}=${encodeURIComponent(value)}`;
|
|
}
|
|
|
|
/** Same-origin WebSocket base — `wss:` under TLS, `ws:` otherwise. */
|
|
export function wsBase(): string {
|
|
const proto = location.protocol === "https:" ? "wss:" : "ws:";
|
|
return `${proto}//${location.host}`;
|
|
}
|
|
|
|
export function eventsWsUrl(): string {
|
|
return `${wsBase()}${EVENTS}`;
|
|
}
|
|
|
|
export function attachWsUrl(id: Uuid): string {
|
|
return `${wsBase()}${attach(id)}`;
|
|
}
|