@hyperdrive.bot/paseo-cli 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/paseo +3 -0
- package/dist/classify.d.ts +19 -0
- package/dist/classify.js +49 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +119 -0
- package/dist/commands/agent/archive.d.ts +18 -0
- package/dist/commands/agent/archive.js +102 -0
- package/dist/commands/agent/attach.d.ts +11 -0
- package/dist/commands/agent/attach.js +159 -0
- package/dist/commands/agent/delete.d.ts +15 -0
- package/dist/commands/agent/delete.js +107 -0
- package/dist/commands/agent/import.d.ts +14 -0
- package/dist/commands/agent/import.js +122 -0
- package/dist/commands/agent/index.d.ts +3 -0
- package/dist/commands/agent/index.js +48 -0
- package/dist/commands/agent/inspect.d.ts +15 -0
- package/dist/commands/agent/inspect.js +209 -0
- package/dist/commands/agent/logs.d.ts +19 -0
- package/dist/commands/agent/logs.js +180 -0
- package/dist/commands/agent/ls.d.ts +44 -0
- package/dist/commands/agent/ls.js +204 -0
- package/dist/commands/agent/mode.d.ts +18 -0
- package/dist/commands/agent/mode.js +100 -0
- package/dist/commands/agent/reload.d.ts +15 -0
- package/dist/commands/agent/reload.js +75 -0
- package/dist/commands/agent/run.d.ts +44 -0
- package/dist/commands/agent/run.js +464 -0
- package/dist/commands/agent/send.d.ts +19 -0
- package/dist/commands/agent/send.js +187 -0
- package/dist/commands/agent/stop.d.ts +17 -0
- package/dist/commands/agent/stop.js +115 -0
- package/dist/commands/agent/update.d.ts +18 -0
- package/dist/commands/agent/update.js +139 -0
- package/dist/commands/agent/wait.d.ts +17 -0
- package/dist/commands/agent/wait.js +158 -0
- package/dist/commands/agent-hook.d.ts +7 -0
- package/dist/commands/agent-hook.js +67 -0
- package/dist/commands/chat/create.d.ts +9 -0
- package/dist/commands/chat/create.js +23 -0
- package/dist/commands/chat/delete.d.ts +6 -0
- package/dist/commands/chat/delete.js +20 -0
- package/dist/commands/chat/index.d.ts +3 -0
- package/dist/commands/chat/index.js +47 -0
- package/dist/commands/chat/inspect.d.ts +6 -0
- package/dist/commands/chat/inspect.js +20 -0
- package/dist/commands/chat/ls.d.ts +6 -0
- package/dist/commands/chat/ls.js +20 -0
- package/dist/commands/chat/post.d.ts +9 -0
- package/dist/commands/chat/post.js +28 -0
- package/dist/commands/chat/read.d.ts +11 -0
- package/dist/commands/chat/read.js +40 -0
- package/dist/commands/chat/schema.d.ts +36 -0
- package/dist/commands/chat/schema.js +81 -0
- package/dist/commands/chat/shared.d.ts +19 -0
- package/dist/commands/chat/shared.js +118 -0
- package/dist/commands/chat/wait.d.ts +9 -0
- package/dist/commands/chat/wait.js +45 -0
- package/dist/commands/daemon/index.d.ts +3 -0
- package/dist/commands/daemon/index.js +57 -0
- package/dist/commands/daemon/local-daemon.d.ts +78 -0
- package/dist/commands/daemon/local-daemon.js +544 -0
- package/dist/commands/daemon/pair.d.ts +9 -0
- package/dist/commands/daemon/pair.js +76 -0
- package/dist/commands/daemon/restart.d.ts +12 -0
- package/dist/commands/daemon/restart.js +99 -0
- package/dist/commands/daemon/runtime-toolchain.d.ts +6 -0
- package/dist/commands/daemon/runtime-toolchain.js +87 -0
- package/dist/commands/daemon/set-password.d.ts +17 -0
- package/dist/commands/daemon/set-password.js +82 -0
- package/dist/commands/daemon/start.d.ts +6 -0
- package/dist/commands/daemon/start.js +56 -0
- package/dist/commands/daemon/status.d.ts +10 -0
- package/dist/commands/daemon/status.js +338 -0
- package/dist/commands/daemon/stop.d.ts +15 -0
- package/dist/commands/daemon/stop.js +60 -0
- package/dist/commands/hooks.d.ts +19 -0
- package/dist/commands/hooks.js +89 -0
- package/dist/commands/loop/index.d.ts +3 -0
- package/dist/commands/loop/index.js +18 -0
- package/dist/commands/loop/inspect.d.ts +13 -0
- package/dist/commands/loop/inspect.js +100 -0
- package/dist/commands/loop/logs.d.ts +8 -0
- package/dist/commands/loop/logs.js +69 -0
- package/dist/commands/loop/ls.d.ts +18 -0
- package/dist/commands/loop/ls.js +62 -0
- package/dist/commands/loop/run.d.ts +30 -0
- package/dist/commands/loop/run.js +162 -0
- package/dist/commands/loop/stop.d.ts +15 -0
- package/dist/commands/loop/stop.js +56 -0
- package/dist/commands/loop/types.d.ts +138 -0
- package/dist/commands/loop/types.js +2 -0
- package/dist/commands/onboard.d.ts +10 -0
- package/dist/commands/onboard.js +416 -0
- package/dist/commands/open.d.ts +2 -0
- package/dist/commands/open.js +84 -0
- package/dist/commands/permit/allow.d.ts +20 -0
- package/dist/commands/permit/allow.js +133 -0
- package/dist/commands/permit/deny.d.ts +12 -0
- package/dist/commands/permit/deny.js +105 -0
- package/dist/commands/permit/index.d.ts +3 -0
- package/dist/commands/permit/index.js +27 -0
- package/dist/commands/permit/ls.d.ts +18 -0
- package/dist/commands/permit/ls.js +66 -0
- package/dist/commands/provider/index.d.ts +3 -0
- package/dist/commands/provider/index.js +16 -0
- package/dist/commands/provider/ls.d.ts +19 -0
- package/dist/commands/provider/ls.js +73 -0
- package/dist/commands/provider/models.d.ts +20 -0
- package/dist/commands/provider/models.js +53 -0
- package/dist/commands/schedule/create.d.ts +18 -0
- package/dist/commands/schedule/create.js +40 -0
- package/dist/commands/schedule/delete.d.ts +10 -0
- package/dist/commands/schedule/delete.js +32 -0
- package/dist/commands/schedule/index.d.ts +3 -0
- package/dist/commands/schedule/index.js +66 -0
- package/dist/commands/schedule/inspect.d.ts +6 -0
- package/dist/commands/schedule/inspect.js +24 -0
- package/dist/commands/schedule/logs.d.ts +6 -0
- package/dist/commands/schedule/logs.js +23 -0
- package/dist/commands/schedule/ls.d.ts +5 -0
- package/dist/commands/schedule/ls.js +23 -0
- package/dist/commands/schedule/pause.d.ts +5 -0
- package/dist/commands/schedule/pause.js +23 -0
- package/dist/commands/schedule/resume.d.ts +5 -0
- package/dist/commands/schedule/resume.js +23 -0
- package/dist/commands/schedule/run-once.d.ts +5 -0
- package/dist/commands/schedule/run-once.js +23 -0
- package/dist/commands/schedule/schema.d.ts +21 -0
- package/dist/commands/schedule/schema.js +67 -0
- package/dist/commands/schedule/shared.d.ts +56 -0
- package/dist/commands/schedule/shared.js +346 -0
- package/dist/commands/schedule/types.d.ts +168 -0
- package/dist/commands/schedule/types.js +2 -0
- package/dist/commands/schedule/update.d.ts +21 -0
- package/dist/commands/schedule/update.js +39 -0
- package/dist/commands/speech/index.d.ts +3 -0
- package/dist/commands/speech/index.js +5 -0
- package/dist/commands/terminal/capture.d.ts +10 -0
- package/dist/commands/terminal/capture.js +68 -0
- package/dist/commands/terminal/create.d.ts +10 -0
- package/dist/commands/terminal/create.js +38 -0
- package/dist/commands/terminal/index.d.ts +3 -0
- package/dist/commands/terminal/index.js +43 -0
- package/dist/commands/terminal/kill.d.ts +6 -0
- package/dist/commands/terminal/kill.js +36 -0
- package/dist/commands/terminal/ls.d.ts +10 -0
- package/dist/commands/terminal/ls.js +21 -0
- package/dist/commands/terminal/schema.d.ts +18 -0
- package/dist/commands/terminal/schema.js +23 -0
- package/dist/commands/terminal/send-keys.d.ts +7 -0
- package/dist/commands/terminal/send-keys.js +76 -0
- package/dist/commands/terminal/shared.d.ts +12 -0
- package/dist/commands/terminal/shared.js +61 -0
- package/dist/commands/workflow/get.d.ts +13 -0
- package/dist/commands/workflow/get.js +75 -0
- package/dist/commands/workflow/index.d.ts +10 -0
- package/dist/commands/workflow/index.js +21 -0
- package/dist/commands/workflow/start.d.ts +26 -0
- package/dist/commands/workflow/start.js +105 -0
- package/dist/commands/workflow/status.d.ts +17 -0
- package/dist/commands/workflow/status.js +57 -0
- package/dist/commands/worktree/archive.d.ts +20 -0
- package/dist/commands/worktree/archive.js +104 -0
- package/dist/commands/worktree/create-input.d.ts +15 -0
- package/dist/commands/worktree/create-input.js +56 -0
- package/dist/commands/worktree/create.d.ts +11 -0
- package/dist/commands/worktree/create.js +58 -0
- package/dist/commands/worktree/index.d.ts +3 -0
- package/dist/commands/worktree/index.js +25 -0
- package/dist/commands/worktree/ls.d.ts +19 -0
- package/dist/commands/worktree/ls.js +97 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/output/index.d.ts +45 -0
- package/dist/output/index.js +47 -0
- package/dist/output/json.d.ts +11 -0
- package/dist/output/json.js +37 -0
- package/dist/output/quiet.d.ts +9 -0
- package/dist/output/quiet.js +22 -0
- package/dist/output/render.d.ts +15 -0
- package/dist/output/render.js +83 -0
- package/dist/output/table.d.ts +13 -0
- package/dist/output/table.js +135 -0
- package/dist/output/types.d.ts +73 -0
- package/dist/output/types.js +8 -0
- package/dist/output/with-output.d.ts +41 -0
- package/dist/output/with-output.js +87 -0
- package/dist/output/yaml.d.ts +11 -0
- package/dist/output/yaml.js +38 -0
- package/dist/run.d.ts +14 -0
- package/dist/run.js +33 -0
- package/dist/utils/client-id.d.ts +2 -0
- package/dist/utils/client-id.js +37 -0
- package/dist/utils/client.d.ts +44 -0
- package/dist/utils/client.js +330 -0
- package/dist/utils/command-options.d.ts +6 -0
- package/dist/utils/command-options.js +17 -0
- package/dist/utils/duration.d.ts +7 -0
- package/dist/utils/duration.js +38 -0
- package/dist/utils/errors.d.ts +5 -0
- package/dist/utils/errors.js +10 -0
- package/dist/utils/hook-socket.d.ts +2 -0
- package/dist/utils/hook-socket.js +35 -0
- package/dist/utils/paths.d.ts +12 -0
- package/dist/utils/paths.js +22 -0
- package/dist/utils/provider-model.d.ts +11 -0
- package/dist/utils/provider-model.js +49 -0
- package/dist/utils/timeline.d.ts +11 -0
- package/dist/utils/timeline.js +11 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +10 -0
- package/package.json +48 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
2
|
+
export async function connectTerminalClient(host) {
|
|
3
|
+
const daemonHost = getDaemonHost({ host });
|
|
4
|
+
try {
|
|
5
|
+
const client = await connectToDaemon({ host });
|
|
6
|
+
return { client, daemonHost };
|
|
7
|
+
}
|
|
8
|
+
catch (err) {
|
|
9
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
10
|
+
const error = {
|
|
11
|
+
code: "DAEMON_NOT_RUNNING",
|
|
12
|
+
message: `Cannot connect to daemon at ${daemonHost}: ${message}`,
|
|
13
|
+
details: "Start the daemon with: paseo daemon start",
|
|
14
|
+
};
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function toTerminalCommandError(code, action, err) {
|
|
19
|
+
if (err && typeof err === "object" && "code" in err && "message" in err) {
|
|
20
|
+
return err;
|
|
21
|
+
}
|
|
22
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
23
|
+
const rpcCode = typeof err === "object" && err !== null && "code" in err && typeof err.code === "string"
|
|
24
|
+
? err.code
|
|
25
|
+
: undefined;
|
|
26
|
+
return {
|
|
27
|
+
code: rpcCode ?? code,
|
|
28
|
+
message: `Failed to ${action}: ${message}`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export async function resolveTerminalId(client, idOrName) {
|
|
32
|
+
const payload = await client.listTerminals();
|
|
33
|
+
return resolveTerminalIdentifier(idOrName, payload.terminals);
|
|
34
|
+
}
|
|
35
|
+
function resolveTerminalIdentifier(idOrName, terminals) {
|
|
36
|
+
if (!idOrName || terminals.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const query = idOrName.toLowerCase();
|
|
40
|
+
const exactMatch = terminals.find((terminal) => terminal.id === idOrName);
|
|
41
|
+
if (exactMatch) {
|
|
42
|
+
return exactMatch.id;
|
|
43
|
+
}
|
|
44
|
+
const prefixMatches = terminals.filter((terminal) => terminal.id.toLowerCase().startsWith(query));
|
|
45
|
+
if (prefixMatches.length === 1 && prefixMatches[0]) {
|
|
46
|
+
return prefixMatches[0].id;
|
|
47
|
+
}
|
|
48
|
+
if (prefixMatches.length > 1) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const nameMatches = terminals.filter((terminal) => terminal.name?.toLowerCase() === query);
|
|
52
|
+
if (nameMatches.length === 1 && nameMatches[0]) {
|
|
53
|
+
return nameMatches[0].id;
|
|
54
|
+
}
|
|
55
|
+
const partialNameMatches = terminals.filter((terminal) => terminal.name?.toLowerCase().includes(query));
|
|
56
|
+
if (partialNameMatches.length === 1 && partialNameMatches[0]) {
|
|
57
|
+
return partialNameMatches[0].id;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CommandOptions, ListResult } from "../../output/index.js";
|
|
3
|
+
interface DetailRow {
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowGetOptions extends CommandOptions {
|
|
8
|
+
}
|
|
9
|
+
export declare function addWorkflowGetOptions(command: Command): Command;
|
|
10
|
+
export type WorkflowGetResult = ListResult<DetailRow>;
|
|
11
|
+
export declare function runWorkflowGetCommand(id: string, options: WorkflowGetOptions, _command: Command): Promise<WorkflowGetResult>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
2
|
+
import { buildWorkflowStatusUrl } from "./start.js";
|
|
3
|
+
export function addWorkflowGetOptions(command) {
|
|
4
|
+
return command.description("Show a single workflow snapshot").argument("<id>", "Workflow ID");
|
|
5
|
+
}
|
|
6
|
+
function createDetailSchema(workflow) {
|
|
7
|
+
return {
|
|
8
|
+
idField: "key",
|
|
9
|
+
columns: [
|
|
10
|
+
{ header: "KEY", field: "key", width: 18 },
|
|
11
|
+
{ header: "VALUE", field: "value", width: 70 },
|
|
12
|
+
],
|
|
13
|
+
serialize: () => workflow,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function toRows(workflow, statusUrl) {
|
|
17
|
+
return [
|
|
18
|
+
{ key: "Id", value: workflow.id },
|
|
19
|
+
{ key: "Title", value: workflow.title ?? "null" },
|
|
20
|
+
{ key: "Status", value: workflow.status },
|
|
21
|
+
{ key: "Cwd", value: workflow.cwd },
|
|
22
|
+
{
|
|
23
|
+
key: "Stories",
|
|
24
|
+
value: `${workflow.completedStoryCount}/${workflow.totalStoryCount ?? workflow.childAgentIds.length}`,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "Phases",
|
|
28
|
+
value: workflow.phases.length === 0
|
|
29
|
+
? "[]"
|
|
30
|
+
: workflow.phases.map((p) => `${p.title}=${p.status}`).join(" | "),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "ChildAgents",
|
|
34
|
+
value: workflow.childAgentIds.length === 0 ? "[]" : workflow.childAgentIds.join(" "),
|
|
35
|
+
},
|
|
36
|
+
{ key: "CreatedAt", value: workflow.createdAt },
|
|
37
|
+
{ key: "UpdatedAt", value: workflow.updatedAt },
|
|
38
|
+
{ key: "StatusUrl", value: statusUrl || "(ipc — no http origin)" },
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
export async function runWorkflowGetCommand(id, options, _command) {
|
|
42
|
+
const host = getDaemonHost({ host: options.host });
|
|
43
|
+
let client;
|
|
44
|
+
try {
|
|
45
|
+
client = await connectToDaemon({ host: options.host });
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
49
|
+
throw {
|
|
50
|
+
code: "DAEMON_NOT_RUNNING",
|
|
51
|
+
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
52
|
+
details: "Start the daemon with: paseo daemon start",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const workflow = await client.getWorkflow(id);
|
|
57
|
+
await client.close();
|
|
58
|
+
if (!workflow) {
|
|
59
|
+
throw new Error(`Workflow not found: ${id}`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
type: "list",
|
|
63
|
+
data: toRows(workflow, buildWorkflowStatusUrl(host, workflow.id)),
|
|
64
|
+
schema: createDetailSchema(workflow),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
await client.close().catch(() => { });
|
|
69
|
+
throw {
|
|
70
|
+
code: "WORKFLOW_GET_FAILED",
|
|
71
|
+
message: error instanceof Error ? error.message : String(error),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* `paseo workflow` — the thin client for daemon-owned workflows (Epic 3, Story
|
|
4
|
+
* 3.3). It builds nothing: `start` hands a pre-built task-graph to the daemon via
|
|
5
|
+
* the `workflow.start` RPC, so the run lives in the always-on daemon and survives
|
|
6
|
+
* this CLI process exiting (G3/G8). `get`/`status` read the same `workflow.*`
|
|
7
|
+
* surfaces every other client uses.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createWorkflowCommand(): Command;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { withOutput } from "../../output/index.js";
|
|
3
|
+
import { addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
|
|
4
|
+
import { addWorkflowStartOptions, runWorkflowStartCommand } from "./start.js";
|
|
5
|
+
import { addWorkflowGetOptions, runWorkflowGetCommand } from "./get.js";
|
|
6
|
+
import { addWorkflowStatusOptions, runWorkflowStatusCommand } from "./status.js";
|
|
7
|
+
/**
|
|
8
|
+
* `paseo workflow` — the thin client for daemon-owned workflows (Epic 3, Story
|
|
9
|
+
* 3.3). It builds nothing: `start` hands a pre-built task-graph to the daemon via
|
|
10
|
+
* the `workflow.start` RPC, so the run lives in the always-on daemon and survives
|
|
11
|
+
* this CLI process exiting (G3/G8). `get`/`status` read the same `workflow.*`
|
|
12
|
+
* surfaces every other client uses.
|
|
13
|
+
*/
|
|
14
|
+
export function createWorkflowCommand() {
|
|
15
|
+
const workflow = new Command("workflow").description("Launch and inspect daemon-owned workflows (thin client)");
|
|
16
|
+
addJsonAndDaemonHostOptions(addWorkflowStartOptions(workflow.command("start"))).action(withOutput(runWorkflowStartCommand));
|
|
17
|
+
addJsonAndDaemonHostOptions(addWorkflowGetOptions(workflow.command("get"))).action(withOutput(runWorkflowGetCommand));
|
|
18
|
+
addJsonAndDaemonHostOptions(addWorkflowStatusOptions(workflow.command("status"))).action(withOutput(runWorkflowStatusCommand));
|
|
19
|
+
return workflow;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CommandOptions, SingleResult } from "../../output/index.js";
|
|
3
|
+
interface StartRow {
|
|
4
|
+
workflowId: string;
|
|
5
|
+
status: string;
|
|
6
|
+
childAgentIds: string[];
|
|
7
|
+
statusUrl: string;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkflowStartOptions extends CommandOptions {
|
|
10
|
+
provider?: string;
|
|
11
|
+
model?: string;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
detach?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function addWorkflowStartOptions(command: Command): Command;
|
|
17
|
+
/**
|
|
18
|
+
* Build the `GET /api/workflows/:id` status URL from the resolved daemon host.
|
|
19
|
+
* Plain `host:port` and `tcp://host:port` map to an HTTP base; IPC/unix sockets
|
|
20
|
+
* have no HTTP origin, so we return an empty string and the caller omits it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildWorkflowStatusUrl(host: string, workflowId: string): string;
|
|
23
|
+
export type WorkflowStartResult = SingleResult<StartRow>;
|
|
24
|
+
export declare function runWorkflowStartCommand(graphPath: string, options: WorkflowStartOptions, _command: Command): Promise<WorkflowStartResult>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=start.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { WorkflowTaskGraphSchema } from "@hyperdrive.bot/paseo-protocol/messages";
|
|
3
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
4
|
+
const startSchema = {
|
|
5
|
+
idField: "workflowId",
|
|
6
|
+
columns: [
|
|
7
|
+
{ header: "WORKFLOW ID", field: "workflowId", width: 38 },
|
|
8
|
+
{ header: "STATUS", field: "status", width: 10 },
|
|
9
|
+
{
|
|
10
|
+
header: "CHILDREN",
|
|
11
|
+
field: (row) => String(row.childAgentIds.length),
|
|
12
|
+
width: 10,
|
|
13
|
+
},
|
|
14
|
+
{ header: "STATUS URL", field: "statusUrl", width: 50 },
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
export function addWorkflowStartOptions(command) {
|
|
18
|
+
return command
|
|
19
|
+
.description("Launch a pre-built task-graph into the daemon (thin client)")
|
|
20
|
+
.argument("<graph>", "Path to a task-graph JSON file")
|
|
21
|
+
.option("--provider <provider>", "Agent provider each child runs (default: claude)")
|
|
22
|
+
.option("--model <model>", "Optional provider model each child is spawned with")
|
|
23
|
+
.option("--cwd <dir>", "Working directory all child agents inherit (default: cwd)")
|
|
24
|
+
.option("--title <title>", "Optional workflow display title")
|
|
25
|
+
.option("--detach", "Return immediately with the workflow id + status URL (the run keeps advancing in the daemon)");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build the `GET /api/workflows/:id` status URL from the resolved daemon host.
|
|
29
|
+
* Plain `host:port` and `tcp://host:port` map to an HTTP base; IPC/unix sockets
|
|
30
|
+
* have no HTTP origin, so we return an empty string and the caller omits it.
|
|
31
|
+
*/
|
|
32
|
+
export function buildWorkflowStatusUrl(host, workflowId) {
|
|
33
|
+
const trimmed = host.trim();
|
|
34
|
+
if (trimmed.startsWith("unix://") || trimmed.startsWith("pipe://")) {
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
let authority = trimmed;
|
|
38
|
+
if (authority.startsWith("tcp://")) {
|
|
39
|
+
authority = authority.slice("tcp://".length);
|
|
40
|
+
}
|
|
41
|
+
// Drop any query string (e.g. ?ssl=true&password=…) — not part of the origin.
|
|
42
|
+
authority = authority.split("?")[0] ?? authority;
|
|
43
|
+
if (!authority) {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
const scheme = trimmed.includes("ssl=true") ? "https" : "http";
|
|
47
|
+
return `${scheme}://${authority}/api/workflows/${workflowId}`;
|
|
48
|
+
}
|
|
49
|
+
export async function runWorkflowStartCommand(graphPath, options, _command) {
|
|
50
|
+
// Parse + validate the task-graph file client-side for a clean error message;
|
|
51
|
+
// the daemon re-validates against the same schema at the parse boundary.
|
|
52
|
+
let graph;
|
|
53
|
+
try {
|
|
54
|
+
const raw = readFileSync(graphPath, "utf-8");
|
|
55
|
+
graph = WorkflowTaskGraphSchema.parse(JSON.parse(raw));
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
throw {
|
|
59
|
+
code: "WORKFLOW_GRAPH_INVALID",
|
|
60
|
+
message: `Could not read/parse task graph at ${graphPath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
61
|
+
details: "Expected a JSON file matching the daemon's task-graph shape.",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const host = getDaemonHost({ host: options.host });
|
|
65
|
+
let client;
|
|
66
|
+
try {
|
|
67
|
+
client = await connectToDaemon({ host: options.host });
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
71
|
+
throw {
|
|
72
|
+
code: "DAEMON_NOT_RUNNING",
|
|
73
|
+
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
74
|
+
details: "Start the daemon with: paseo daemon start",
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const started = await client.startWorkflow({
|
|
79
|
+
graph,
|
|
80
|
+
provider: options.provider ?? "claude",
|
|
81
|
+
cwd: options.cwd ?? process.cwd(),
|
|
82
|
+
...(options.model ? { model: options.model } : {}),
|
|
83
|
+
...(options.title ? { title: options.title } : {}),
|
|
84
|
+
});
|
|
85
|
+
await client.close();
|
|
86
|
+
return {
|
|
87
|
+
type: "single",
|
|
88
|
+
data: {
|
|
89
|
+
workflowId: started.workflowId,
|
|
90
|
+
status: started.status,
|
|
91
|
+
childAgentIds: started.childAgentIds,
|
|
92
|
+
statusUrl: buildWorkflowStatusUrl(host, started.workflowId),
|
|
93
|
+
},
|
|
94
|
+
schema: startSchema,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
await client.close().catch(() => { });
|
|
99
|
+
throw {
|
|
100
|
+
code: "WORKFLOW_START_FAILED",
|
|
101
|
+
message: error instanceof Error ? error.message : String(error),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { CommandOptions, ListResult } from "../../output/index.js";
|
|
3
|
+
interface WorkflowListRow {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
status: string;
|
|
7
|
+
stories: string;
|
|
8
|
+
cwd: string;
|
|
9
|
+
updated: string;
|
|
10
|
+
}
|
|
11
|
+
export interface WorkflowStatusOptions extends CommandOptions {
|
|
12
|
+
}
|
|
13
|
+
export declare function addWorkflowStatusOptions(command: Command): Command;
|
|
14
|
+
export type WorkflowStatusResult = ListResult<WorkflowListRow>;
|
|
15
|
+
export declare function runWorkflowStatusCommand(options: WorkflowStatusOptions, _command: Command): Promise<WorkflowStatusResult>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
2
|
+
const statusSchema = {
|
|
3
|
+
idField: "id",
|
|
4
|
+
columns: [
|
|
5
|
+
{ header: "WORKFLOW ID", field: "id", width: 38 },
|
|
6
|
+
{ header: "TITLE", field: "title", width: 24 },
|
|
7
|
+
{ header: "STATUS", field: "status", width: 10 },
|
|
8
|
+
{ header: "STORIES", field: "stories", width: 8 },
|
|
9
|
+
{ header: "CWD", field: "cwd", width: 36 },
|
|
10
|
+
{ header: "UPDATED", field: "updated", width: 24 },
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
|
+
export function addWorkflowStatusOptions(command) {
|
|
14
|
+
return command.description("List every known workflow and its live status");
|
|
15
|
+
}
|
|
16
|
+
function toRow(workflow) {
|
|
17
|
+
return {
|
|
18
|
+
id: workflow.id,
|
|
19
|
+
title: workflow.title ?? "-",
|
|
20
|
+
status: workflow.status,
|
|
21
|
+
stories: `${workflow.completedStoryCount}/${workflow.totalStoryCount ?? workflow.childAgentIds.length}`,
|
|
22
|
+
cwd: workflow.cwd,
|
|
23
|
+
updated: workflow.updatedAt,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export async function runWorkflowStatusCommand(options, _command) {
|
|
27
|
+
const host = getDaemonHost({ host: options.host });
|
|
28
|
+
let client;
|
|
29
|
+
try {
|
|
30
|
+
client = await connectToDaemon({ host: options.host });
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
34
|
+
throw {
|
|
35
|
+
code: "DAEMON_NOT_RUNNING",
|
|
36
|
+
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
37
|
+
details: "Start the daemon with: paseo daemon start",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const workflows = await client.listWorkflows();
|
|
42
|
+
await client.close();
|
|
43
|
+
return {
|
|
44
|
+
type: "list",
|
|
45
|
+
data: workflows.map(toRow),
|
|
46
|
+
schema: statusSchema,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
await client.close().catch(() => { });
|
|
51
|
+
throw {
|
|
52
|
+
code: "WORKFLOW_STATUS_FAILED",
|
|
53
|
+
message: error instanceof Error ? error.message : String(error),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { connectToDaemon } from "../../utils/client.js";
|
|
3
|
+
import type { CommandOptions, SingleResult, OutputSchema } from "../../output/index.js";
|
|
4
|
+
/** Result type for worktree archive command */
|
|
5
|
+
export interface WorktreeArchiveResult {
|
|
6
|
+
name: string;
|
|
7
|
+
status: "archived";
|
|
8
|
+
removedAgents: string[];
|
|
9
|
+
}
|
|
10
|
+
/** Schema for archive command output */
|
|
11
|
+
export declare const archiveSchema: OutputSchema<WorktreeArchiveResult>;
|
|
12
|
+
export interface WorktreeArchiveOptions extends CommandOptions {
|
|
13
|
+
host?: string;
|
|
14
|
+
}
|
|
15
|
+
export type WorktreeArchiveCommandResult = SingleResult<WorktreeArchiveResult>;
|
|
16
|
+
export declare function runArchiveCommand(nameArg: string, options: WorktreeArchiveOptions, _command: Command): Promise<WorktreeArchiveCommandResult>;
|
|
17
|
+
export declare function runArchiveCommandWithDeps(nameArg: string, options: WorktreeArchiveOptions, deps: {
|
|
18
|
+
connectToDaemon: typeof connectToDaemon;
|
|
19
|
+
}): Promise<WorktreeArchiveCommandResult>;
|
|
20
|
+
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
3
|
+
/** Schema for archive command output */
|
|
4
|
+
export const archiveSchema = {
|
|
5
|
+
idField: "name",
|
|
6
|
+
columns: [
|
|
7
|
+
{ header: "NAME", field: "name" },
|
|
8
|
+
{ header: "STATUS", field: "status" },
|
|
9
|
+
{
|
|
10
|
+
header: "REMOVED AGENTS",
|
|
11
|
+
field: (item) => (item.removedAgents.length > 0 ? item.removedAgents.join(", ") : "-"),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
export async function runArchiveCommand(nameArg, options, _command) {
|
|
16
|
+
return runArchiveCommandWithDeps(nameArg, options, { connectToDaemon });
|
|
17
|
+
}
|
|
18
|
+
export async function runArchiveCommandWithDeps(nameArg, options, deps) {
|
|
19
|
+
const host = getDaemonHost({ host: options.host });
|
|
20
|
+
// Validate arguments
|
|
21
|
+
if (!nameArg || nameArg.trim().length === 0) {
|
|
22
|
+
const error = {
|
|
23
|
+
code: "MISSING_WORKTREE_NAME",
|
|
24
|
+
message: "Worktree name is required",
|
|
25
|
+
details: "Usage: paseo worktree archive <name>",
|
|
26
|
+
};
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
let client;
|
|
30
|
+
try {
|
|
31
|
+
client = await deps.connectToDaemon({ host: options.host });
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
35
|
+
const error = {
|
|
36
|
+
code: "DAEMON_NOT_RUNNING",
|
|
37
|
+
message: `Cannot connect to daemon at ${host}: ${message}`,
|
|
38
|
+
details: "Start the daemon with: paseo daemon start",
|
|
39
|
+
};
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
// Get the list of worktrees first to resolve the name
|
|
44
|
+
const listResponse = await client.getPaseoWorktreeList({});
|
|
45
|
+
if (listResponse.error) {
|
|
46
|
+
const error = {
|
|
47
|
+
code: "WORKTREE_LIST_FAILED",
|
|
48
|
+
message: `Failed to list worktrees: ${listResponse.error.message}`,
|
|
49
|
+
};
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
// Find the worktree by name or branch
|
|
53
|
+
const worktree = listResponse.worktrees.find((wt) => {
|
|
54
|
+
const name = path.basename(wt.worktreePath);
|
|
55
|
+
return name === nameArg || wt.branchName === nameArg;
|
|
56
|
+
});
|
|
57
|
+
if (!worktree) {
|
|
58
|
+
const error = {
|
|
59
|
+
code: "WORKTREE_NOT_FOUND",
|
|
60
|
+
message: `Worktree not found: ${nameArg}`,
|
|
61
|
+
details: 'Use "paseo worktree ls" to list available worktrees',
|
|
62
|
+
};
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
// Archive the worktree. scope:"worktree" archives every active workspace on
|
|
66
|
+
// the directory and then removes the directory (Paseo-owned gated).
|
|
67
|
+
const response = await client.archivePaseoWorktree({
|
|
68
|
+
worktreePath: worktree.worktreePath,
|
|
69
|
+
scope: "worktree",
|
|
70
|
+
});
|
|
71
|
+
await client.close();
|
|
72
|
+
if (response.error) {
|
|
73
|
+
const error = {
|
|
74
|
+
code: "WORKTREE_ARCHIVE_FAILED",
|
|
75
|
+
message: `Failed to archive worktree: ${response.error.message}`,
|
|
76
|
+
};
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
const worktreeName = path.basename(worktree.worktreePath) || nameArg;
|
|
80
|
+
return {
|
|
81
|
+
type: "single",
|
|
82
|
+
data: {
|
|
83
|
+
name: worktreeName,
|
|
84
|
+
status: "archived",
|
|
85
|
+
removedAgents: response.removedAgents ?? [],
|
|
86
|
+
},
|
|
87
|
+
schema: archiveSchema,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
await client.close().catch(() => { });
|
|
92
|
+
// Re-throw CommandError as-is
|
|
93
|
+
if (err && typeof err === "object" && "code" in err) {
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
97
|
+
const error = {
|
|
98
|
+
code: "WORKTREE_ARCHIVE_FAILED",
|
|
99
|
+
message: `Failed to archive worktree: ${message}`,
|
|
100
|
+
};
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DaemonClient } from "@hyperdrive.bot/paseo-client/internal/daemon-client";
|
|
2
|
+
import type { CommandOptions } from "../../output/index.js";
|
|
3
|
+
export interface WorktreeCreateOptions extends CommandOptions {
|
|
4
|
+
host?: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
mode?: string;
|
|
7
|
+
newBranch?: string;
|
|
8
|
+
base?: string;
|
|
9
|
+
branch?: string;
|
|
10
|
+
prNumber?: string;
|
|
11
|
+
}
|
|
12
|
+
type CreatePaseoWorktreeRequest = Parameters<DaemonClient["createPaseoWorktree"]>[0];
|
|
13
|
+
export declare function buildCreateWorktreeRequest(options: WorktreeCreateOptions, cwd: string): CreatePaseoWorktreeRequest;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=create-input.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const VALID_MODES = ["branch-off", "checkout-branch", "checkout-pr"];
|
|
2
|
+
export function buildCreateWorktreeRequest(options, cwd) {
|
|
3
|
+
const mode = options.mode;
|
|
4
|
+
if (!mode) {
|
|
5
|
+
throw cmdError("MISSING_MODE", "--mode is required", `Expected one of: ${VALID_MODES.join(", ")}`);
|
|
6
|
+
}
|
|
7
|
+
switch (mode) {
|
|
8
|
+
case "branch-off":
|
|
9
|
+
return buildBranchOffRequest(options, cwd);
|
|
10
|
+
case "checkout-branch":
|
|
11
|
+
return buildCheckoutBranchRequest(options, cwd);
|
|
12
|
+
case "checkout-pr":
|
|
13
|
+
return buildCheckoutPrRequest(options, cwd);
|
|
14
|
+
default:
|
|
15
|
+
throw cmdError("INVALID_MODE", `Invalid --mode: ${mode}`, `Expected one of: ${VALID_MODES.join(", ")}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function buildBranchOffRequest(options, cwd) {
|
|
19
|
+
if (!options.newBranch) {
|
|
20
|
+
throw cmdError("MISSING_NEW_BRANCH", "--new-branch is required for --mode branch-off");
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
cwd,
|
|
24
|
+
worktreeSlug: options.newBranch,
|
|
25
|
+
action: "branch-off",
|
|
26
|
+
...(options.base ? { refName: options.base } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function buildCheckoutBranchRequest(options, cwd) {
|
|
30
|
+
if (!options.branch) {
|
|
31
|
+
throw cmdError("MISSING_BRANCH", "--branch is required for --mode checkout-branch");
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
cwd,
|
|
35
|
+
action: "checkout",
|
|
36
|
+
refName: options.branch,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function buildCheckoutPrRequest(options, cwd) {
|
|
40
|
+
if (options.prNumber === undefined || options.prNumber === "") {
|
|
41
|
+
throw cmdError("MISSING_PR_NUMBER", "--pr-number is required for --mode checkout-pr");
|
|
42
|
+
}
|
|
43
|
+
const prNumber = Number(options.prNumber);
|
|
44
|
+
if (!Number.isInteger(prNumber) || prNumber <= 0) {
|
|
45
|
+
throw cmdError("INVALID_PR_NUMBER", `Invalid --pr-number: ${options.prNumber}`, "Expected a positive integer");
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
cwd,
|
|
49
|
+
action: "checkout",
|
|
50
|
+
githubPrNumber: prNumber,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function cmdError(code, message, details) {
|
|
54
|
+
return details ? { code, message, details } : { code, message };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=create-input.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { OutputSchema, SingleResult } from "../../output/index.js";
|
|
3
|
+
import { type WorktreeCreateOptions } from "./create-input.js";
|
|
4
|
+
export interface WorktreeCreateResult {
|
|
5
|
+
name: string;
|
|
6
|
+
branchName: string;
|
|
7
|
+
worktreePath: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const createSchema: OutputSchema<WorktreeCreateResult>;
|
|
10
|
+
export declare function runCreateCommand(options: WorktreeCreateOptions, _command: Command): Promise<SingleResult<WorktreeCreateResult>>;
|
|
11
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
|
|
3
|
+
import { buildCreateWorktreeRequest } from "./create-input.js";
|
|
4
|
+
export const createSchema = {
|
|
5
|
+
idField: "worktreePath",
|
|
6
|
+
columns: [
|
|
7
|
+
{ header: "NAME", field: "name", width: 24 },
|
|
8
|
+
{ header: "BRANCH", field: "branchName", width: 28 },
|
|
9
|
+
{ header: "PATH", field: "worktreePath", width: 50 },
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
function cmdError(code, message, details) {
|
|
13
|
+
return details ? { code, message, details } : { code, message };
|
|
14
|
+
}
|
|
15
|
+
export async function runCreateCommand(options, _command) {
|
|
16
|
+
const cwd = options.cwd ?? process.cwd();
|
|
17
|
+
const request = buildCreateWorktreeRequest(options, cwd);
|
|
18
|
+
const host = getDaemonHost({ host: options.host });
|
|
19
|
+
let client;
|
|
20
|
+
try {
|
|
21
|
+
client = await connectToDaemon({ host: options.host });
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
25
|
+
throw cmdError("DAEMON_NOT_RUNNING", `Cannot connect to daemon at ${host}: ${message}`, "Start the daemon with: paseo daemon start");
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = await client.createPaseoWorktree(request);
|
|
29
|
+
const workspace = response.workspace;
|
|
30
|
+
if (!workspace || response.error) {
|
|
31
|
+
throw cmdError("WORKTREE_CREATE_FAILED", `Failed to create worktree: ${response.error ?? "no workspace returned"}`);
|
|
32
|
+
}
|
|
33
|
+
if (!workspace.workspaceDirectory) {
|
|
34
|
+
throw cmdError("WORKTREE_CREATE_FAILED", "Failed to create worktree: workspace directory missing from daemon response");
|
|
35
|
+
}
|
|
36
|
+
const worktreePath = workspace.workspaceDirectory;
|
|
37
|
+
return {
|
|
38
|
+
type: "single",
|
|
39
|
+
data: {
|
|
40
|
+
name: path.basename(worktreePath),
|
|
41
|
+
branchName: workspace.name,
|
|
42
|
+
worktreePath,
|
|
43
|
+
},
|
|
44
|
+
schema: createSchema,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err && typeof err === "object" && "code" in err) {
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
52
|
+
throw cmdError("WORKTREE_CREATE_FAILED", `Failed to create worktree: ${message}`);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
await client.close().catch(() => { });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=create.js.map
|