cueloop 0.1.0-alpha.16 → 0.1.0-alpha.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cueloop",
3
- "version": "0.1.0-alpha.16",
3
+ "version": "0.1.0-alpha.18",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,9 +10,9 @@
10
10
  ".": "./src/main.ts"
11
11
  },
12
12
  "dependencies": {
13
- "@cueloop/schema": "0.1.0-alpha.16",
14
- "@cueloop/daemon": "0.1.0-alpha.16",
15
- "@cueloop/client": "0.1.0-alpha.16"
13
+ "@cueloop/schema": "0.1.0-alpha.18",
14
+ "@cueloop/daemon": "0.1.0-alpha.18",
15
+ "@cueloop/client": "0.1.0-alpha.18"
16
16
  },
17
17
  "publishConfig": {
18
18
  "access": "public"
package/src/args.ts CHANGED
@@ -9,16 +9,16 @@ export function parseArgs(argv: string[]): ParsedArgs {
9
9
  const positional: string[] = [];
10
10
  const flags: Record<string, string | boolean> = {};
11
11
  for (let i = 0; i < argv.length; i++) {
12
- const a = argv[i]!;
13
- if (!a.startsWith("--")) {
14
- positional.push(a);
12
+ const argument = argv[i]!;
13
+ if (!argument.startsWith("--")) {
14
+ positional.push(argument);
15
15
  continue;
16
16
  }
17
- const eq = a.indexOf("=");
18
- if (eq !== -1) {
19
- flags[a.slice(2, eq)] = a.slice(eq + 1);
17
+ const equalsIndex = argument.indexOf("=");
18
+ if (equalsIndex !== -1) {
19
+ flags[argument.slice(2, equalsIndex)] = argument.slice(equalsIndex + 1);
20
20
  } else {
21
- const key = a.slice(2);
21
+ const key = argument.slice(2);
22
22
  const next = argv[i + 1];
23
23
  if (next !== undefined && !next.startsWith("--")) {
24
24
  flags[key] = next;
@@ -31,7 +31,7 @@ export function parseArgs(argv: string[]): ParsedArgs {
31
31
  return { positional, flags };
32
32
  }
33
33
 
34
- export function flagStr(flags: Record<string, string | boolean>, key: string): string | undefined {
35
- const v = flags[key];
36
- return typeof v === "string" ? v : undefined;
34
+ export function stringFlag(flags: Record<string, string | boolean>, key: string): string | undefined {
35
+ const value = flags[key];
36
+ return typeof value === "string" ? value : undefined;
37
37
  }
package/src/main.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env bun
2
2
  /**
3
- * cueloop entry points (#18): `cueloop` opens the TUI on the inbox,
3
+ * cueloop entry points: `cueloop` opens the TUI on the inbox,
4
4
  * `cueloop diff` reviews the working tree, `cueloop review <pr>` a PR,
5
5
  * `cueloop session *` mirrors the daemon API for agents and scripts,
6
6
  * `cueloop serve` shares a session over ssh (read-only observers),
7
7
  * `cueloop daemon` runs the daemon in the foreground.
8
8
  */
9
9
 
10
- import { parseArgs, flagStr } from "./args";
11
- import { sessionCommand } from "./session-cmds";
10
+ import { parseArgs, stringFlag } from "./args";
11
+ import { sessionCommand } from "./session-commands";
12
12
  import { workingTreeDiff } from "./working-tree";
13
13
  import { DaemonClient } from "@cueloop/daemon/client";
14
14
  import { openReview, resolveWorkspace } from "@cueloop/daemon/review";
@@ -51,11 +51,11 @@ async function main(): Promise<number> {
51
51
  }
52
52
  case "serve": {
53
53
  const { positional, flags } = parseArgs(argv.slice(1));
54
- const port = flagStr(flags, "port");
54
+ const port = stringFlag(flags, "port");
55
55
  const { serveClient } = await import("@cueloop/client");
56
56
  const handle = await serveClient({
57
57
  port: port !== undefined ? Number(port) : undefined,
58
- host: flagStr(flags, "host"),
58
+ host: stringFlag(flags, "host"),
59
59
  sessionId: positional[0],
60
60
  });
61
61
  console.log(
package/src/pr.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * PR review entry (#18): `cueloop review <pr>` fetches the PR diff through the
2
+ * PR review entry: `cueloop review <pr>` fetches the PR diff through the
3
3
  * user's `gh` CLI (auth fully delegated), opens a diff session, and posts the
4
4
  * verdict back to the PR as a real review when the session resolves.
5
5
  * `cueloop review-post <session-id> <pr>` is the non-interactive post-back
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `cueloop session *` - mirrors the daemon socket API 1:1 (#14). One surface,
2
+ * `cueloop session *` - mirrors the daemon socket API 1:1. One surface,
3
3
  * three consumers: agent adapters, the dev loop, and integrations. Output is
4
4
  * JSON on stdout; exit code 0 unless the daemon returned an error.
5
5
  */
@@ -7,7 +7,7 @@
7
7
  import { newAnnotationId, type ArtifactType, type VerdictKind } from "@cueloop/schema";
8
8
  import { DaemonClient } from "@cueloop/daemon/client";
9
9
  import { openReview, verdictResponse, type ReviewNote } from "@cueloop/daemon/review";
10
- import { parseArgs, flagStr } from "./args";
10
+ import { parseArgs, stringFlag } from "./args";
11
11
 
12
12
  async function readStdin(): Promise<string> {
13
13
  return await new Response(Bun.stdin.stream()).text();
@@ -24,19 +24,19 @@ export async function sessionCommand(argv: string[]): Promise<number> {
24
24
  try {
25
25
  switch (verb) {
26
26
  case "create": {
27
- const contentFile = flagStr(flags, "content-file");
27
+ const contentFile = stringFlag(flags, "content-file");
28
28
  const content = contentFile ? await Bun.file(contentFile).text() : await readStdin();
29
29
  // per-file agent notes for diff sessions: a JSON array of { path, body }
30
- const notesFile = flagStr(flags, "notes-file");
30
+ const notesFile = stringFlag(flags, "notes-file");
31
31
  const notes = notesFile ? (JSON.parse(await Bun.file(notesFile).text()) as ReviewNote[]) : undefined;
32
32
  const review = await openReview(client, {
33
- type: (flagStr(flags, "type") ?? "plan") as ArtifactType,
33
+ type: (stringFlag(flags, "type") ?? "plan") as ArtifactType,
34
34
  content,
35
- cwd: flagStr(flags, "cwd"),
36
- agent: flagStr(flags, "agent"),
37
- agentSessionId: flagStr(flags, "agent-session-id"),
38
- planPath: flagStr(flags, "plan-path"),
39
- title: flagStr(flags, "title"),
35
+ cwd: stringFlag(flags, "cwd"),
36
+ agent: stringFlag(flags, "agent"),
37
+ agentSessionId: stringFlag(flags, "agent-session-id"),
38
+ planPath: stringFlag(flags, "plan-path"),
39
+ title: stringFlag(flags, "title"),
40
40
  notes,
41
41
  });
42
42
  out(review.session);
@@ -47,13 +47,13 @@ export async function sessionCommand(argv: string[]): Promise<number> {
47
47
  return 0;
48
48
  }
49
49
  case "list": {
50
- const status = flagStr(flags, "status") as "pending" | "resolved" | undefined;
50
+ const status = stringFlag(flags, "status") as "pending" | "resolved" | undefined;
51
51
  out(await client.sessionList(status ? { status } : undefined));
52
52
  return 0;
53
53
  }
54
54
  case "wait": {
55
55
  const id = required(positional[1], "session id");
56
- const timeoutMs = Number(flagStr(flags, "timeout-ms") ?? "60000");
56
+ const timeoutMs = Number(stringFlag(flags, "timeout-ms") ?? "60000");
57
57
  const session = await client.sessionWait(id, timeoutMs);
58
58
  if (session === null) {
59
59
  out({ status: "pending" });
@@ -65,16 +65,16 @@ export async function sessionCommand(argv: string[]): Promise<number> {
65
65
  }
66
66
  case "annotate": {
67
67
  const id = required(positional[1], "session id");
68
- const body = flagStr(flags, "body") ?? "";
69
- const quote = required(flagStr(flags, "quote"), "--quote");
68
+ const body = stringFlag(flags, "body") ?? "";
69
+ const quote = required(stringFlag(flags, "quote"), "--quote");
70
70
  out(
71
71
  await client.sessionAnnotate(id, {
72
- id: flagStr(flags, "annotation-id") ?? newAnnotationId(),
73
- kind: flagStr(flags, "kind") ?? "comment",
72
+ id: stringFlag(flags, "annotation-id") ?? newAnnotationId(),
73
+ kind: stringFlag(flags, "kind") ?? "comment",
74
74
  anchor: {
75
75
  quote,
76
- prefix: flagStr(flags, "prefix") ?? "",
77
- suffix: flagStr(flags, "suffix") ?? "",
76
+ prefix: stringFlag(flags, "prefix") ?? "",
77
+ suffix: stringFlag(flags, "suffix") ?? "",
78
78
  },
79
79
  body,
80
80
  }),
@@ -83,13 +83,13 @@ export async function sessionCommand(argv: string[]): Promise<number> {
83
83
  }
84
84
  case "resolve": {
85
85
  const id = required(positional[1], "session id");
86
- const kind = required(flagStr(flags, "verdict"), "--verdict") as VerdictKind;
87
- out(await client.sessionResolve(id, kind, flagStr(flags, "summary") ?? ""));
86
+ const kind = required(stringFlag(flags, "verdict"), "--verdict") as VerdictKind;
87
+ out(await client.sessionResolve(id, kind, stringFlag(flags, "summary") ?? ""));
88
88
  return 0;
89
89
  }
90
90
  case "submit-revision": {
91
91
  const id = required(positional[1], "session id");
92
- const contentFile = flagStr(flags, "content-file");
92
+ const contentFile = stringFlag(flags, "content-file");
93
93
  const content = contentFile ? await Bun.file(contentFile).text() : await readStdin();
94
94
  out(await client.sessionSubmitRevision(id, content));
95
95
  return 0;
@@ -105,7 +105,7 @@ export async function sessionCommand(argv: string[]): Promise<number> {
105
105
  }
106
106
  }
107
107
 
108
- function required<T>(v: T | undefined, what: string): T {
109
- if (v === undefined) throw new Error(`missing ${what}`);
110
- return v;
108
+ function required<T>(value: T | undefined, description: string): T {
109
+ if (value === undefined) throw new Error(`missing ${description}`);
110
+ return value;
111
111
  }
@@ -9,7 +9,7 @@ async function git(args: string[], cwd: string): Promise<string | null> {
9
9
 
10
10
  export async function workingTreeDiff(cwd = process.cwd()): Promise<string> {
11
11
  const tracked = (await git(["diff", "HEAD"], cwd)) ?? "";
12
- // untracked files included by default (map note: changed-first)
12
+ // untracked files included by default
13
13
  const untrackedList = (await git(["ls-files", "--others", "--exclude-standard"], cwd)) ?? "";
14
14
  let untracked = "";
15
15
  for (const file of untrackedList.split("\n").filter(Boolean)) {