@kamilio/wire 0.1.63 → 0.1.65

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.
@@ -0,0 +1,111 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { existsSync } from "node:fs";
3
+ import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
4
+ import { join } from "node:path";
5
+ import type { ProcessCapability } from "wire-core";
6
+
7
+ type Summary = { uuid: string; name: string; created_at: string; updated_at: string };
8
+ type Message = { sender: string; text: string; content: { type: string; text?: string }[]; attachments: { file_name: string }[]; files: { file_name: string }[] };
9
+ type Chat = Summary & { chat_messages: Message[] };
10
+ const uuid = /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i;
11
+
12
+ function noteName(chat: Summary) {
13
+ if (!uuid.test(chat.uuid)) throw new Error("Invalid Claude conversation ID.");
14
+ const title = (chat.name || "Untitled").replace(/[\p{C}<>:"/\\|?*#[\]^]/gu, " ").replace(/\s+/g, " ").trim();
15
+ return chat.created_at.slice(0, 10).replace(/[^0-9-]/g, "") + " " + Array.from(title).slice(0, 44).join("") + " " + chat.uuid + ".md";
16
+ }
17
+
18
+ export function claudeMarkdown(chat: Chat) {
19
+ const lines = ["# " + (chat.name || "Untitled"), "", `[Open in Claude](https://claude.ai/chat/${chat.uuid}) · [Original JSON](.originals/${chat.uuid}.json)`, "", "Created: " + chat.created_at, "Updated: " + chat.updated_at];
20
+ for (const message of chat.chat_messages) {
21
+ const text = message.content.filter(block => block.type === "text").map(block => block.text).join("\n\n");
22
+ lines.push("", "## " + (message.sender === "human" ? "You" : message.sender === "assistant" ? "Claude" : message.sender), "", text || message.text || "_See original JSON for message content._");
23
+ const files = [...new Set([...message.attachments, ...message.files].map(f => f.file_name).filter(Boolean))];
24
+ if (files.length) lines.push("", "Attachments: " + files.join(", "));
25
+ }
26
+ return lines.join("\n").trimEnd() + "\n";
27
+ }
28
+
29
+ export async function scrapeClaude(process: ProcessCapability, directory: string) {
30
+ const root = join(directory, "claude"), originals = join(root, ".originals");
31
+ await mkdir(originals, { recursive: true, mode: 0o700 });
32
+ const scratch = await mkdtemp(join(originals, ".download-"));
33
+ const args = ["-s=wire-claude-" + randomUUID(), "--raw"];
34
+ const run = (...cmd: string[]) => process.execute("playwright-cli", [...args, ...cmd]);
35
+ let saved = 0, unchanged = 0, edited = 0;
36
+ // Use a file for responses: a single conversation can exceed the subprocess stdout limit.
37
+ async function get<T>(paths: string[]): Promise<T[]> {
38
+ const path = join(scratch, "response.json");
39
+ await rm(path, { force: true });
40
+ const result = await run("eval", `async () => {
41
+ if(location.origin !== "https://claude.ai") throw Error("Sign in to claude.ai in Chrome.");
42
+ return Promise.all(${JSON.stringify(paths)}.map(async path => {
43
+ const r = await fetch(path);
44
+ if (!r.ok) throw Error("Claude HTTP " + r.status());
45
+ return r.json();
46
+ }));
47
+ }`, "--filename=" + path);
48
+ if (!existsSync(path)) throw new Error("Claude download failed: " + result.stdout.slice(0, 220));
49
+ return JSON.parse(await readFile(path, "utf8"));
50
+ }
51
+ try {
52
+ await process.execute("hey-browser", ["run", "--", "playwright-cli", ...args, "attach", "--extension=chrome"]);
53
+ try {
54
+ await run("tab-new", "https://claude.ai/");
55
+ try {
56
+ const [orgs] = await get<{ uuid: string; capabilities: string[] }[]>(["/api/organizations"]);
57
+ const chats = orgs!.filter(org => org.capabilities.includes("chat"));
58
+ if (!chats.length) throw new Error("No Claude chat workspace found. Sign in to claude.ai in Chrome.");
59
+ for (const org of chats) {
60
+ if (!uuid.test(org.uuid)) throw new Error("Invalid Claude workspace ID.");
61
+ const base = "/api/organizations/" + org.uuid;
62
+ const seen = new Set<string>();
63
+ for (const archived of [false, true]) {
64
+ for (let offset = 0; ;) {
65
+ const [page] = await get<{ data: Summary[]; has_more: boolean }>([base + "/chat_conversations_v2?limit=100&archived=" + archived + "&offset=" + offset]);
66
+ const pending: Summary[] = [];
67
+ const before = seen.size;
68
+ for (const summary of page!.data) {
69
+ if (!uuid.test(summary.uuid)) throw new Error("Invalid Claude conversation ID.");
70
+ if (seen.has(summary.uuid)) continue;
71
+ seen.add(summary.uuid);
72
+ const raw = join(originals, summary.uuid + ".json");
73
+ if (existsSync(raw)) {
74
+ const old: Chat = JSON.parse(await readFile(raw, "utf8"));
75
+ if (old.updated_at === summary.updated_at && existsSync(join(root, noteName(old)))) { unchanged++; continue; }
76
+ }
77
+ pending.push(summary);
78
+ }
79
+ for (let i = 0; i < pending.length; i += 4) {
80
+ const batch = pending.slice(i, i + 4);
81
+ const details = await get<Chat>(batch.map(s => base + "/chat_conversations/" + s.uuid + "?tree=True&rendering_mode=messages&render_all_tools=true"));
82
+ for (const [j, chat] of details.entries()) {
83
+ if (chat.uuid !== batch[j]!.uuid) throw new Error("Claude conversation ID mismatch.");
84
+ const raw = join(originals, chat.uuid + ".json"), path = join(root, noteName(chat));
85
+ const old: Chat | undefined = existsSync(raw) ? JSON.parse(await readFile(raw, "utf8")) : undefined;
86
+ const oldPath = old && join(root, noteName(old));
87
+ const markdown = claudeMarkdown(chat);
88
+ if (existsSync(path) && path !== oldPath && await readFile(path, "utf8") !== markdown) { edited++; continue; }
89
+ if (old && oldPath && existsSync(oldPath)) {
90
+ const local = await readFile(oldPath, "utf8");
91
+ if (local !== claudeMarkdown(old) && !(oldPath === path && local === markdown)) { edited++; continue; }
92
+ }
93
+ await writeFile(join(scratch, "note"), markdown, { mode: 0o600 });
94
+ await writeFile(join(scratch, "original"), JSON.stringify(chat, null, 2), { mode: 0o600 });
95
+ await rename(join(scratch, "note"), path);
96
+ await rename(join(scratch, "original"), raw);
97
+ if (oldPath && oldPath !== path) await rm(oldPath, { force: true });
98
+ saved++;
99
+ }
100
+ }
101
+ if (!page!.has_more) break;
102
+ if (before === seen.size) throw new Error("Claude history pagination stopped advancing.");
103
+ offset += page!.data.length;
104
+ }
105
+ }
106
+ }
107
+ } finally { await run("tab-close"); }
108
+ } finally { await run("detach"); }
109
+ } finally { await rm(scratch, { recursive: true, force: true }); }
110
+ return `Claude: ${saved} saved, ${unchanged} unchanged, ${edited} locally edited and skipped.\n${root}`;
111
+ }
@@ -0,0 +1,63 @@
1
+ import { decodeHTML } from "entities";
2
+ import { drive } from "./gdrive.js";
3
+
4
+ type Runtime = Parameters<typeof drive>[0];
5
+ type Reply = { author: { displayName: string }; content?: string; action?: string };
6
+ type Thread = Reply & { id: string; resolved: boolean; quotedFileContent?: { mimeType: string; value: string }; replies: Reply[] };
7
+ type ListedThread = Thread & { url: string };
8
+
9
+ function documentId(url: string) {
10
+ const id = /^https:\/\/docs\.google\.com\/document\/(?:u\/\d+\/)?d\/([\w-]+)(?:[/?#]|$)/.exec(url)?.[1];
11
+ if (!id) throw new Error("Expected a Google Docs document URL.");
12
+ return id;
13
+ }
14
+
15
+ export async function listDocComments(runtime: Runtime, url: string) {
16
+ const id = documentId(url), threads: ListedThread[] = [];
17
+ let pageToken = "";
18
+ do {
19
+ const page = await (await drive(runtime, "/" + id + "/comments", {
20
+ fields: "nextPageToken,comments(id,resolved,content,author(displayName),quotedFileContent,replies(content,action,author(displayName)))",
21
+ pageSize: "100", ...(pageToken && { pageToken }),
22
+ })).json() as { comments: Thread[]; nextPageToken?: string };
23
+ for (const c of page.comments) threads.push({ ...c, url: threadUrl(id, c.id) });
24
+ pageToken = page.nextPageToken ?? "";
25
+ } while (pageToken);
26
+ return threads;
27
+ }
28
+
29
+ function threadUrl(id: string, thread: string) {
30
+ if (!/^[\w.-]+$/.test(thread) || thread === "." || thread === "..") throw new Error("Expected a Google Docs comment link with ?disco=<comment-id>.");
31
+ return "https://docs.google.com/document/d/" + id + "/edit?disco=" + thread;
32
+ }
33
+
34
+ export function formatDocComments(threads: ListedThread[]) {
35
+ return ["## Comments", ...threads.map(c => [
36
+ (c.resolved ? "Resolved" : "Open") + " · " + c.url,
37
+ ...(c.quotedFileContent?.value ? [(c.quotedFileContent.mimeType === "text/html" ? decodeHTML(c.quotedFileContent.value) : c.quotedFileContent.value).replace(/^/gm, "> ")] : []),
38
+ ...[c, ...c.replies].map(r => r.author.displayName + ": " + [r.content, r.action && "(" + r.action + ")"].filter(Boolean).join(" ")),
39
+ ].join("\n")), ...(threads.length ? [] : ["No comments."])].join("\n\n");
40
+ }
41
+
42
+ export async function changeDocComment(runtime: Runtime, action: "reply" | "resolve" | "reopen" | "delete-reply", link: string, value?: string) {
43
+ const id = documentId(link), thread = new URL(link).searchParams.get("disco") ?? "";
44
+ const url = threadUrl(id, thread), path = "/" + id + "/comments/" + thread;
45
+ if (action === "delete-reply") {
46
+ if (!value || !/^[\w.-]+$/.test(value) || value === "." || value === "..") throw new Error("Invalid reply ID.");
47
+ await drive(runtime, path + "/replies/" + value, {}, { method: "DELETE" });
48
+ return { message: "Deleted reply.", url };
49
+ }
50
+ if (action === "reply" && !value?.trim()) throw new Error("Reply cannot be blank.");
51
+ if (action !== "reply") {
52
+ const state = await (await drive(runtime, path, { fields: "resolved" })).json();
53
+ if (state.resolved === (action === "resolve")) return { message: "Thread is already " + (state.resolved ? "resolved." : "open."), url };
54
+ }
55
+ const reply = await (await drive(runtime, path + "/replies", { fields: "id" }, {
56
+ method: "POST", headers: { "content-type": "application/json" },
57
+ body: JSON.stringify(action === "reply" ? { content: value } : { action }),
58
+ })).json() as { id: string };
59
+ const command = "wire google-docs comments ";
60
+ return { message: { reply: "Replied.", resolve: "Resolved.", reopen: "Reopened." }[action], url, replyId: reply.id,
61
+ undo: command + (action === "reply" ? "delete-reply" : action === "resolve" ? "reopen" : "resolve") + " '" + url + "'" +
62
+ (action === "reply" ? " " + "'" + reply.id.replaceAll("'", "'\\''") + "'" : "") };
63
+ }
@@ -94,12 +94,12 @@ type DriveRuntime = Pick<RuntimeCapabilities, "googleFormsTokens" | "http">;
94
94
  const folderUrl = /^https:\/\/drive\.google\.com\/drive\/(?:u\/\d+\/)?folders\/([\w-]+)\/?(?:[?#].*)?$/;
95
95
  const sheetUrl = /^https:\/\/docs\.google\.com\/spreadsheets\/(?:u\/\d+\/)?d\/([\w-]+)(?:[/?#].*)?$/;
96
96
  const safeName = (name: string) => name.replace(/[/\\:\x00-\x1f]/g, "_").replace(/^\.+/, "_") || "_";
97
- async function drive(runtime: DriveRuntime, path: string, params: Record<string, string>) {
97
+ export async function drive(runtime: DriveRuntime, path: string, params: Record<string, string>, init?: RequestInit) {
98
98
  const token = await runtime.googleFormsTokens.load();
99
99
  const response = await runtime.http.request(
100
100
  "https://www.googleapis.com/drive/v3/files" + path + "?" + new URLSearchParams(params),
101
101
  {
102
- headers: { authorization: "Bearer " + token.token },
102
+ ...init, headers: { ...init?.headers, authorization: "Bearer " + token.token },
103
103
  },
104
104
  );
105
105
  if (!response.ok) throw new Error("Drive HTTP " + response.status + ": " + (await response.text()).slice(0, 600));
@@ -8,9 +8,12 @@ import type { Auth, AuthResult, AuthService } from "../auth.js";
8
8
 
9
9
  import { formatAgenda, type readAgenda } from "./calendar.js";
10
10
 
11
+ import { formatDocComments, type listDocComments, type changeDocComment } from "./doc-comments.js";
12
+
13
+ type Comments = { comments?: Awaited<ReturnType<typeof listDocComments>> };
11
14
  export type WireRoot = Group;
12
15
  export type TextInputReader = () => Promise<string>;
13
- export type WireRootOptions = Readonly<{ allowPaste: boolean; ashby?: (action: string, arg?: string) => Promise<string>; previewDrive?: (url: string) => Promise<string>; scrapeDrive?: (url?: string, deleteVerifiedPdfs?: boolean, deleteVerifiedDocx?: boolean) => Promise<string>; calendarAgenda?: (date?: string, calendarId?: string) => ReturnType<typeof readAgenda>; latticeSync?: (url: string | undefined, file?: string) => Promise<string>; latticeRequests?: (url: string) => Promise<string>; latticeTemplate?: (url: string) => Promise<string>; latticeFill?: (url: string, file: string) => Promise<string>; scrapeZoom?: () => ReturnType<typeof zoomProvider.scrape> }>;
16
+ export type WireRootOptions = Readonly<{ allowPaste: boolean; scrapeClaude?: () => Promise<string>; listDocComments?: (url: string) => ReturnType<typeof listDocComments>; changeDocComment?: (action: Parameters<typeof changeDocComment>[1], url: string, value?: string) => ReturnType<typeof changeDocComment>; ashby?: (action: string, arg?: string) => Promise<string>; previewDrive?: (url: string) => Promise<string>; scrapeDrive?: (url?: string, deleteVerifiedPdfs?: boolean, deleteVerifiedDocx?: boolean) => Promise<string>; calendarAgenda?: (date?: string, calendarId?: string) => ReturnType<typeof readAgenda>; latticeSync?: (url: string | undefined, file?: string) => Promise<string>; latticeRequests?: (url: string) => Promise<string>; latticeTemplate?: (url: string) => Promise<string>; latticeFill?: (url: string, file: string) => Promise<string>; scrapeZoom?: () => ReturnType<typeof zoomProvider.scrape> }>;
14
17
 
15
18
  const authServices = ["ashby", "asana", "chatgpt", "codesignal", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
16
19
  const removedCliCommandNames = Object.freeze({
@@ -461,21 +464,39 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
461
464
  handler: ({ params }) => attachFromCliUrl(params.url, params["editor-receipts"]),
462
465
  render: wirePresentation.attach,
463
466
  });
467
+ const comments = S.Optional(S.Boolean({ description: "Show Google Docs comment threads and replies, including resolved threads." }));
468
+ const readComments = async (url: string) => {
469
+ if (!options.listDocComments) throw new UserError("Google Docs comments unavailable.");
470
+ return options.listDocComments(url);
471
+ };
472
+ const commentText = (v: Comments) => v.comments ? "\n\n" + formatDocComments(v.comments) : "";
464
473
  const preview = defineCommand({
465
474
  name: "preview",
466
475
  description: "Preview a source URL without writing files.",
467
476
  positional: ["url"],
468
- params: S.Object({ url: S.String({ description: "Supported source URL to preview." }) }),
469
- handler: ({ params }) => userFacing(() => wire.view(params.url)),
470
- render: wirePresentation.view,
477
+ params: S.Object({ url: S.String({ description: "Supported source URL to preview." }), comments }),
478
+ handler: ({ params }) => userFacing(async () => {
479
+ const threads = params.comments ? await readComments(params.url) : undefined;
480
+ const doc = await wire.view(params.url);
481
+ return threads ? { ...doc, comments: threads } : doc;
482
+ }),
483
+ render: render((v: FetchedDocument & Comments) => v.markdown + commentText(v)),
471
484
  });
472
485
  const sync = defineCommand({
473
486
  name: "sync",
474
487
  description: "Two-way sync one registered resource.",
475
488
  positional: ["resource"],
476
- params: S.Object({ resource: S.String({ description: "Registered resource URL, resource ID, or Markdown path." }) }),
477
- handler: ({ params }) => userFacing(() => wire.sync(params.resource, currentDirectory)),
478
- render: wirePresentation.sync,
489
+ params: S.Object({ resource: S.String({ description: "Registered resource URL, resource ID, or Markdown path." }), comments }),
490
+ handler: ({ params }) => userFacing(async () => {
491
+ const threads = params.comments ? await readComments((await wire.showResource(params.resource, currentDirectory)).urls[0]!) : undefined;
492
+ const result = await wire.sync(params.resource, currentDirectory);
493
+ return threads ? { ...result, comments: threads } : result;
494
+ }),
495
+ render: {
496
+ json: (v: WireResult & Comments) => ({ ...wireResultJson(v), ...(v.comments && { comments: v.comments }) }),
497
+ markdown: (v: WireResult & Comments) => formatWireResult(v) + commentText(v),
498
+ rich: (v: WireResult & Comments, p: any) => richText(formatWireResultRich(v, p) + commentText(v), p),
499
+ },
479
500
  });
480
501
  const resource = S.String({ description: "Registered resource URL, resource ID, or Markdown path." });
481
502
  type RevisionList = Awaited<ReturnType<Wire["historyLog"]>>;
@@ -491,6 +512,19 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
491
512
  const authCommand = (service: (typeof authServices)[number]) => {
492
513
  const title = serviceTitle(service);
493
514
  const group = authGroup(service, `Manage ${title} login.`, "Capture cookies once; normal commands reuse saved cookies.", auth!, readInput, options);
515
+ if (service === "google-docs" && options.changeDocComment) {
516
+ const thread = S.String({ description: "Google Docs thread URL from --comments." });
517
+ return defineGroup({ ...group, children: [...group.children, defineGroup({ name: "comments", description: "Reply to, resolve, or reopen Google Docs threads.", children:
518
+ (["reply", "resolve", "reopen", "delete-reply"] as const).map(action => defineCommand({
519
+ name: action, description: { reply: "Reply to a thread.", resolve: "Resolve a thread and print its undo command.",
520
+ reopen: "Reopen a resolved thread.", "delete-reply": "Delete your own reply by ID." }[action],
521
+ positional: action === "delete-reply" ? ["thread", "reply"] : ["thread"],
522
+ params: S.Object({ thread, ...(action === "reply" && { body: S.String({ description: "Reply text." }) }),
523
+ ...(action === "delete-reply" && { reply: S.String({ description: "Reply ID." }) }) }),
524
+ handler: ({params}) => userFacing(() => options.changeDocComment!(action, params.thread, params.body ?? params.reply)),
525
+ render: render((v: Awaited<ReturnType<typeof changeDocComment>>) => v.message + " " + v.url + (v.undo ? "\nUndo: " + v.undo : "")),
526
+ })) })] });
527
+ }
494
528
  const lookup = service === "slack" ? lookupSlack : service === "notion" ? lookupNotion : service === "asana" ? asana?.lookup : undefined;
495
529
  const users = lookup === undefined ? [] : [defineGroup({ name: "users", description: "Find people by email or name.", children: [defineCommand({
496
530
  name: "lookup",
@@ -623,6 +657,11 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
623
657
  scope: ["cli", "mcp", "sdk"],
624
658
  children: [
625
659
  defaultAttach,
660
+ ...(options.scrapeClaude ? [defineGroup({ name: "claude", description: "Archive Claude.ai conversations.", scope: ["cli"], children: [
661
+ defineCommand({ name: "scrape", description: "Save active and archived conversations from all your Claude chat workspaces into ./claude using signed-in Chrome.", scope: ["cli"], params: S.Object({}),
662
+ handler: () => userFacing(options.scrapeClaude!), render: render<string>(v => v),
663
+ }),
664
+ ] })] : []),
626
665
  ...(options.scrapeDrive ? [defineGroup({ name: "gdrive", description: "Download Google Drive folders and spreadsheets.", scope: ["cli"], children: [
627
666
  ...(options.previewDrive ? [defineCommand({ name: "preview", description: "List a Drive folder or read a file without saving it.", scope: ["cli"], positional: ["url"],
628
667
  params: S.Object({ url: S.String({description: "Google Drive folder or file URL."}) }),
package/src/cli.ts CHANGED
@@ -249,6 +249,7 @@ function excessPositionals(argv: readonly string[]): Readonly<{ commandPath: str
249
249
  if (command === "slack" && slackResourceCommands.has(words[1]!)) return { commandPath: `slack ${words[1]}`, expected: 1, received: words.length - 2 };
250
250
  if ((command === "slack" || command === "notion" || command === "asana") && words[1] === "users" && words[2] === "lookup") return { commandPath: `${command} users lookup`, expected: 1, received: words.length - 3 };
251
251
  if (command === "slack" && (words[1] === "send" || words[1] === "edit")) return { commandPath: `slack ${words[1]}`, expected: 2, received: words.length - 2 };
252
+ if (command === "claude" && words[1] === "scrape") return { commandPath: "claude scrape", expected: 0, received: words.length - 2 };
252
253
  if (command === "gdrive" && (words[1] === "scrape" || words[1] === "preview")) return { commandPath: `gdrive ${words[1]}`, expected: 1, received: words.length - 2 };
253
254
  if (command === "zoom" && words[1] === "scrape") return { commandPath: "zoom scrape", expected: 0, received: words.length - 2 };
254
255
  if (authServices.has(command)) {
@@ -305,7 +306,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
305
306
  function renderUnknownAuthCommand(argv: readonly string[]): boolean {
306
307
  if (hasRootSeparator(argv)) return false;
307
308
  const words = positionalWords(argv);
308
- if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || (words[0] === "ashby" && ["interviews","pending","latest","prep","template","sync"].includes(words[1]!)) || (words[0] === "zoom" && words[1] === "scrape") || words[0] === "asana" && (words[1] === "projects" || words[1] === "tasks" || words[1] === "comments") || (words[0] === "slack" || words[0] === "notion" || words[0] === "asana") && words[1] === "users" || words[0] === "slack" && (words[1] === "send" || words[1] === "edit" || slackResourceCommands.has(words[1]!))) return false;
309
+ if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || (words[0] === "ashby" && ["interviews","pending","latest","prep","template","sync"].includes(words[1]!)) || (words[0] === "google-docs" && words[1] === "comments") || (words[0] === "zoom" && words[1] === "scrape") || words[0] === "asana" && (words[1] === "projects" || words[1] === "tasks" || words[1] === "comments") || (words[0] === "slack" || words[0] === "notion" || words[0] === "asana") && words[1] === "users" || words[0] === "slack" && (words[1] === "send" || words[1] === "edit" || slackResourceCommands.has(words[1]!))) return false;
309
310
  renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
310
311
  return true;
311
312
  }
@@ -368,7 +369,7 @@ function renderUnknownRootInput(argv: readonly string[]): boolean {
368
369
  const words = positionalWords(argv);
369
370
  if (words === null || words.length === 0) return false;
370
371
  const command = words[0]!;
371
- if ((!hasRootSeparator(argv) && (command in fixedCommandPositionals || command === "lattice" || command === "google-calendar" || command === "gdrive" || authServices.has(command) || command in removedCommandNames)) || isSourceUrl(command)) return false;
372
+ if ((!hasRootSeparator(argv) && (command in fixedCommandPositionals || command === "lattice" || command === "google-calendar" || command === "claude" || command === "gdrive" || authServices.has(command) || command in removedCommandNames)) || isSourceUrl(command)) return false;
372
373
  if (isSourceLikeWithoutScheme(command)) {
373
374
  renderCliError(argv, expectedSourceMessage("Expected source URL or command", command), "wire --help", expectedSourceMessage("Expected source URL or command", cliValue(command)));
374
375
  return true;
package/src/executable.ts CHANGED
@@ -9,9 +9,11 @@ import { listLatticeReviewRequests, latticeReviewDraft, syncLatticeDrafts } from
9
9
  import { zoomProvider } from "provider-zoom";
10
10
  import { lookupNotionUsers } from "provider-notion";
11
11
 
12
+ import { changeDocComment, listDocComments } from "./adapters/doc-comments.js";
12
13
  import { previewDrive, scrapeDrive } from "./adapters/gdrive.js";
13
14
  import { codeSignalInterviewId, previewCodeSignal } from "./adapters/codesignal.js";
14
15
  import { ashby } from "./adapters/ashby.js";
16
+ import { scrapeClaude } from "./adapters/claude.js";
15
17
  import { readAgenda } from "./adapters/calendar.js";
16
18
  import { createRoot } from "./adapters/root.js";
17
19
  import { composeAuth } from "./auth.js";
@@ -142,7 +144,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
142
144
  switchBackend: baseWire.switchBackend,
143
145
  });
144
146
  const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
145
- return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, ashby: (action,arg) => ashby(runtime,action,action === "sync" ? resolve(currentDirectory,arg!) : arg), previewDrive: url => previewDrive(runtime,url), scrapeDrive: (url, deleteVerifiedPdfs, deleteVerifiedDocx) => scrapeDrive(runtime, currentDirectory, url, deleteVerifiedPdfs, deleteVerifiedDocx), calendarAgenda: (date, id) => readAgenda(processCapability, configuration.get("WIRE_REPOSITORY_ROOT"), date, id), latticeSync: (url,file) => syncLatticeDrafts(runtime,url,currentDirectory,file), latticeRequests: url => listLatticeReviewRequests(runtime,url), latticeTemplate: url => latticeReviewDraft(runtime,url), latticeFill: async (url,file) => latticeReviewDraft(runtime,url,await runtime.filesystem.readText(resolve(currentDirectory,file))), scrapeZoom: () => zoomProvider.scrape(runtime, currentDirectory) }, (destination, markdown) => sendSlackMessage(runtime, destination, markdown), (query) => lookupSlackUsers(runtime, query), (url, markdown) => editSlackMessage(runtime, url, markdown), (query) => lookupNotionUsers(runtime, query), {
147
+ return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, scrapeClaude: () => scrapeClaude(processCapability, currentDirectory), listDocComments: url => listDocComments(runtime,url), changeDocComment: (action,url,value) => changeDocComment(runtime,action,url,value), ashby: (action,arg) => ashby(runtime,action,action === "sync" ? resolve(currentDirectory,arg!) : arg), previewDrive: url => previewDrive(runtime,url), scrapeDrive: (url, deleteVerifiedPdfs, deleteVerifiedDocx) => scrapeDrive(runtime, currentDirectory, url, deleteVerifiedPdfs, deleteVerifiedDocx), calendarAgenda: (date, id) => readAgenda(processCapability, configuration.get("WIRE_REPOSITORY_ROOT"), date, id), latticeSync: (url,file) => syncLatticeDrafts(runtime,url,currentDirectory,file), latticeRequests: url => listLatticeReviewRequests(runtime,url), latticeTemplate: url => latticeReviewDraft(runtime,url), latticeFill: async (url,file) => latticeReviewDraft(runtime,url,await runtime.filesystem.readText(resolve(currentDirectory,file))), scrapeZoom: () => zoomProvider.scrape(runtime, currentDirectory) }, (destination, markdown) => sendSlackMessage(runtime, destination, markdown), (query) => lookupSlackUsers(runtime, query), (url, markdown) => editSlackMessage(runtime, url, markdown), (query) => lookupNotionUsers(runtime, query), {
146
148
  lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
147
149
  writes: { move: (task, project, section) => moveAsanaTask(runtime, task, project, section), create: (project, title, section, body, assignee) => createAsanaTask(runtime, project, title, section, body, assignee), edit: (task, fields) => editAsanaTask(runtime, task, fields), comment: (task, body) => addAsanaComment(runtime, task, body), editComment: (comment, body) => editAsanaComment(runtime, comment, body) },
148
150
  }, async () => {