@camerontaylor/paseo-cli 0.11.2-fork.2 → 0.12.0-beta.1.fork.1

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.
Files changed (35) hide show
  1. package/dist/cli.js +2 -0
  2. package/dist/commands/agent/logs.d.ts +19 -2
  3. package/dist/commands/agent/logs.js +143 -12
  4. package/dist/commands/agent/ls.d.ts +17 -2
  5. package/dist/commands/agent/ls.js +24 -6
  6. package/dist/commands/agent/run.d.ts +3 -14
  7. package/dist/commands/agent/run.js +20 -29
  8. package/dist/commands/agent/send.js +4 -1
  9. package/dist/commands/permit/allow.d.ts +17 -2
  10. package/dist/commands/permit/allow.js +96 -82
  11. package/dist/commands/permit/deny.d.ts +3 -2
  12. package/dist/commands/permit/deny.js +85 -71
  13. package/dist/commands/usage/index.d.ts +29 -0
  14. package/dist/commands/usage/index.js +62 -0
  15. package/dist/commands/usage/presentation.d.ts +4 -0
  16. package/dist/commands/usage/presentation.js +122 -0
  17. package/dist/commands/workspace/create.d.ts +1 -0
  18. package/dist/commands/workspace/create.js +4 -0
  19. package/dist/commands/workspace/index.js +7 -2
  20. package/dist/commands/workspace/ls.d.ts +5 -2
  21. package/dist/commands/workspace/ls.js +7 -2
  22. package/dist/commands/workspace/shared.d.ts +3 -0
  23. package/dist/commands/workspace/shared.js +9 -0
  24. package/dist/commands/worktree/archive.d.ts +1 -0
  25. package/dist/commands/worktree/archive.js +3 -1
  26. package/dist/commands/worktree/index.js +6 -2
  27. package/dist/commands/worktree/ls.d.ts +1 -0
  28. package/dist/commands/worktree/ls.js +3 -1
  29. package/dist/commands/worktree/repository-directory.d.ts +6 -0
  30. package/dist/commands/worktree/repository-directory.js +9 -0
  31. package/dist/utils/caller-agent.d.ts +14 -0
  32. package/dist/utils/caller-agent.js +16 -0
  33. package/dist/utils/timeline.d.ts +1 -0
  34. package/dist/utils/timeline.js +6 -1
  35. package/package.json +4 -4
@@ -1,8 +1,11 @@
1
1
  import type { Command } from "commander";
2
2
  import type { ListResult } from "../../output/index.js";
3
3
  import { type WorkspaceRow } from "./shared.js";
4
- export declare function runLsCommand(options: {
4
+ export interface WorkspaceLsOptions {
5
5
  host?: string;
6
6
  daemonTarget: import("../../utils/daemon-target.js").DaemonTarget;
7
- }, _command: Command): Promise<ListResult<WorkspaceRow>>;
7
+ /** --background: Include background workspaces */
8
+ background?: boolean;
9
+ }
10
+ export declare function runLsCommand(options: WorkspaceLsOptions, _command: Command): Promise<ListResult<WorkspaceRow>>;
8
11
  //# sourceMappingURL=ls.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
2
- import { toWorkspaceRow, workspaceSchema } from "./shared.js";
2
+ import { toWorkspaceRow, workspaceSchema, workspaceWithBackgroundSchema, } from "./shared.js";
3
3
  export async function runLsCommand(options, _command) {
4
4
  const host = getDaemonHost({ target: options.daemonTarget });
5
5
  const client = await connectToDaemon({ target: options.daemonTarget }).catch((error) => {
@@ -14,12 +14,17 @@ export async function runLsCommand(options, _command) {
14
14
  let cursor;
15
15
  do {
16
16
  const payload = await client.fetchWorkspaces({
17
+ ...(options.background ? { filter: { includeBackground: true } } : {}),
17
18
  page: { limit: 200, ...(cursor ? { cursor } : {}) },
18
19
  });
19
20
  workspaces.push(...payload.entries.map(toWorkspaceRow));
20
21
  cursor = payload.pageInfo.nextCursor ?? undefined;
21
22
  } while (cursor);
22
- return { type: "list", data: workspaces, schema: workspaceSchema };
23
+ return {
24
+ type: "list",
25
+ data: workspaces,
26
+ schema: options.background ? workspaceWithBackgroundSchema : workspaceSchema,
27
+ };
23
28
  }
24
29
  finally {
25
30
  await client.close().catch(() => undefined);
@@ -6,7 +6,10 @@ export interface WorkspaceRow {
6
6
  name: string;
7
7
  isolation: "local" | "worktree";
8
8
  cwd: string;
9
+ background: boolean;
9
10
  }
10
11
  export declare const workspaceSchema: OutputSchema<WorkspaceRow>;
12
+ /** `--background` listings add a column so hidden workspaces stand out. */
13
+ export declare const workspaceWithBackgroundSchema: OutputSchema<WorkspaceRow>;
11
14
  export declare function toWorkspaceRow(workspace: WorkspaceDescriptorPayload): WorkspaceRow;
12
15
  //# sourceMappingURL=shared.d.ts.map
@@ -8,6 +8,14 @@ export const workspaceSchema = {
8
8
  { header: "CWD", field: "cwd", width: 42 },
9
9
  ],
10
10
  };
11
+ /** `--background` listings add a column so hidden workspaces stand out. */
12
+ export const workspaceWithBackgroundSchema = {
13
+ ...workspaceSchema,
14
+ columns: [
15
+ ...workspaceSchema.columns,
16
+ { header: "BACKGROUND", field: (row) => (row.background ? "yes" : ""), width: 8 },
17
+ ],
18
+ };
11
19
  export function toWorkspaceRow(workspace) {
12
20
  return {
13
21
  workspaceId: workspace.id,
@@ -15,6 +23,7 @@ export function toWorkspaceRow(workspace) {
15
23
  name: workspace.name,
16
24
  isolation: workspace.workspaceKind === "worktree" ? "worktree" : "local",
17
25
  cwd: workspace.workspaceDirectory,
26
+ background: workspace.background === true,
18
27
  };
19
28
  }
20
29
  //# sourceMappingURL=shared.js.map
@@ -11,6 +11,7 @@ export interface WorktreeArchiveResult {
11
11
  export declare const archiveSchema: OutputSchema<WorktreeArchiveResult>;
12
12
  export interface WorktreeArchiveOptions extends CommandOptions {
13
13
  host?: string;
14
+ cwd?: string;
14
15
  }
15
16
  export type WorktreeArchiveCommandResult = SingleResult<WorktreeArchiveResult>;
16
17
  export declare function runArchiveCommand(nameArg: string, options: WorktreeArchiveOptions, _command: Command): Promise<WorktreeArchiveCommandResult>;
@@ -1,5 +1,6 @@
1
1
  import path from "path";
2
2
  import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
3
+ import { resolveRepositoryDirectory } from "./repository-directory.js";
3
4
  /** Schema for archive command output */
4
5
  export const archiveSchema = {
5
6
  idField: "name",
@@ -17,6 +18,7 @@ export async function runArchiveCommand(nameArg, options, _command) {
17
18
  }
18
19
  export async function runArchiveCommandWithDeps(nameArg, options, deps) {
19
20
  const host = getDaemonHost({ target: options.daemonTarget });
21
+ const cwd = resolveRepositoryDirectory(options);
20
22
  // Validate arguments
21
23
  if (!nameArg || nameArg.trim().length === 0) {
22
24
  const error = {
@@ -43,7 +45,7 @@ export async function runArchiveCommandWithDeps(nameArg, options, deps) {
43
45
  }
44
46
  try {
45
47
  // Get the list of worktrees first to resolve the name
46
- const listResponse = await client.getPaseoWorktreeList({});
48
+ const listResponse = await client.getPaseoWorktreeList({ cwd });
47
49
  if (listResponse.error) {
48
50
  const error = {
49
51
  code: "WORKTREE_LIST_FAILED",
@@ -6,7 +6,10 @@ import { withOutput } from "../../output/index.js";
6
6
  import { addJsonAndDaemonHostOptions } from "../../utils/command-options.js";
7
7
  export function createWorktreeCommand() {
8
8
  const worktree = new Command("worktree").description("Manage Paseo-managed git worktrees");
9
- addJsonAndDaemonHostOptions(worktree.command("ls").description("List Paseo-managed git worktrees")).action(withOutput(runLsCommand));
9
+ addJsonAndDaemonHostOptions(worktree
10
+ .command("ls")
11
+ .description("List Paseo-managed git worktrees")
12
+ .option("--cwd <path>", "Repository directory (default: current)")).action(withOutput(runLsCommand));
10
13
  addJsonAndDaemonHostOptions(worktree
11
14
  .command("create")
12
15
  .description("Create a Paseo-managed git worktree")
@@ -19,7 +22,8 @@ export function createWorktreeCommand() {
19
22
  addJsonAndDaemonHostOptions(worktree
20
23
  .command("archive")
21
24
  .description("Archive a worktree (removes worktree and associated branch)")
22
- .argument("<name>", "Worktree name or branch name")).action(withOutput(runArchiveCommand));
25
+ .argument("<name>", "Worktree name or branch name")
26
+ .option("--cwd <path>", "Repository directory (default: current)")).action(withOutput(runArchiveCommand));
23
27
  return worktree;
24
28
  }
25
29
  //# sourceMappingURL=index.js.map
@@ -12,6 +12,7 @@ export declare const worktreeLsSchema: OutputSchema<WorktreeListItem>;
12
12
  export type WorktreeLsResult = ListResult<WorktreeListItem>;
13
13
  export interface WorktreeLsOptions extends CommandOptions {
14
14
  host?: string;
15
+ cwd?: string;
15
16
  }
16
17
  export declare function runLsCommand(options: WorktreeLsOptions, _command: Command): Promise<WorktreeLsResult>;
17
18
  //# sourceMappingURL=ls.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { basename } from "node:path";
2
2
  import { connectToDaemon } from "../../utils/client.js";
3
+ import { resolveRepositoryDirectory } from "./repository-directory.js";
3
4
  /** Shorten home directory in path */
4
5
  function shortenPath(path) {
5
6
  const home = process.env.HOME;
@@ -23,12 +24,13 @@ export const worktreeLsSchema = {
23
24
  ],
24
25
  };
25
26
  export async function runLsCommand(options, _command) {
27
+ const cwd = resolveRepositoryDirectory(options);
26
28
  const client = await connectToDaemon({ target: options.daemonTarget });
27
29
  try {
28
30
  const agentsPayload = await client.fetchAgents({ filter: { includeArchived: true } });
29
31
  const agents = agentsPayload.entries.map((entry) => entry.agent);
30
32
  // Get worktree list from daemon
31
- const response = await client.getPaseoWorktreeList({});
33
+ const response = await client.getPaseoWorktreeList({ cwd });
32
34
  await client.close();
33
35
  if (response.error) {
34
36
  const error = {
@@ -0,0 +1,6 @@
1
+ import type { DaemonTarget } from "../../utils/daemon-target.js";
2
+ export declare function resolveRepositoryDirectory(options: {
3
+ cwd?: string;
4
+ daemonTarget: DaemonTarget;
5
+ }): string;
6
+ //# sourceMappingURL=repository-directory.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { resolve } from "node:path";
2
+ export function resolveRepositoryDirectory(options) {
3
+ const cwd = options.cwd ?? process.cwd();
4
+ if (options.daemonTarget.kind === "instance") {
5
+ return resolve(cwd);
6
+ }
7
+ return cwd;
8
+ }
9
+ //# sourceMappingURL=repository-directory.js.map
@@ -0,0 +1,14 @@
1
+ interface CallerLookupClient {
2
+ fetchAgent(options: {
3
+ agentId: string;
4
+ }): Promise<{
5
+ agent: {
6
+ id: string;
7
+ };
8
+ } | null>;
9
+ }
10
+ export declare function resolveCallerAgentId(client: CallerLookupClient, env?: {
11
+ PASEO_AGENT_ID?: string;
12
+ }): Promise<string | undefined>;
13
+ export {};
14
+ //# sourceMappingURL=caller-agent.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { DaemonConnectionError } from "@camerontaylor/paseo-client/internal/daemon-client";
2
+ // PASEO_AGENT_ID belongs to the daemon that launched this shell. Commands
3
+ // targeting another daemon (--host or --home) have no caller on that daemon.
4
+ export async function resolveCallerAgentId(client, env = process.env) {
5
+ const agentId = env.PASEO_AGENT_ID?.trim();
6
+ if (!agentId)
7
+ return undefined;
8
+ const caller = await client.fetchAgent({ agentId }).catch((error) => {
9
+ // A missing agent is a daemon answer; a lost or timed-out connection is not.
10
+ if (error instanceof DaemonConnectionError)
11
+ throw error;
12
+ return null;
13
+ });
14
+ return caller?.agent.id === agentId ? agentId : undefined;
15
+ }
16
+ //# sourceMappingURL=caller-agent.js.map
@@ -5,6 +5,7 @@ interface FetchProjectedTimelineItemsInput {
5
5
  client: DaemonClient;
6
6
  agentId: string;
7
7
  timeoutMs?: number;
8
+ sinceTimestampMs?: number;
8
9
  }
9
10
  export declare function fetchProjectedTimelineItems(input: FetchProjectedTimelineItemsInput): Promise<AgentTimelineItem[]>;
10
11
  export {};
@@ -6,6 +6,11 @@ export async function fetchProjectedTimelineItems(input) {
6
6
  projection: "projected",
7
7
  timeout: input.timeoutMs,
8
8
  });
9
- return timeline.entries.map((entry) => entry.item);
9
+ let entries = timeline.entries;
10
+ const sinceTimestampMs = input.sinceTimestampMs;
11
+ if (sinceTimestampMs !== undefined) {
12
+ entries = entries.filter((entry) => Date.parse(entry.timestamp) >= sinceTimestampMs);
13
+ }
14
+ return entries.map((entry) => entry.item);
10
15
  }
11
16
  //# sourceMappingURL=timeline.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camerontaylor/paseo-cli",
3
- "version": "0.11.2-fork.2",
3
+ "version": "0.12.0-beta.1.fork.1",
4
4
  "description": "Paseo CLI - control your AI coding agents from the command line",
5
5
  "bin": {
6
6
  "paseo": "bin/paseo"
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clack/prompts": "^1.0.0",
31
- "@camerontaylor/paseo-client": "0.11.2-fork.2",
32
- "@camerontaylor/paseo-protocol": "0.11.2-fork.2",
33
- "@camerontaylor/paseo-server": "0.11.2-fork.2",
31
+ "@camerontaylor/paseo-client": "0.12.0-beta.1.fork.1",
32
+ "@camerontaylor/paseo-protocol": "0.12.0-beta.1.fork.1",
33
+ "@camerontaylor/paseo-server": "0.12.0-beta.1.fork.1",
34
34
  "chalk": "^5.3.0",
35
35
  "commander": "^12.0.0",
36
36
  "mime-types": "^2.1.35",