@kamilio/wire 0.1.64 → 0.1.66

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.
@@ -13,7 +13,7 @@ import { formatDocComments, type listDocComments, type changeDocComment } from "
13
13
  type Comments = { comments?: Awaited<ReturnType<typeof listDocComments>> };
14
14
  export type WireRoot = Group;
15
15
  export type TextInputReader = () => Promise<string>;
16
- export type WireRootOptions = Readonly<{ allowPaste: boolean; 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> }>;
16
+ export type WireRootOptions = Readonly<{ allowPaste: boolean; shareNotionWithOrg?: (id: string) => Promise<string>; 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> }>;
17
17
 
18
18
  const authServices = ["ashby", "asana", "chatgpt", "codesignal", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
19
19
  const removedCliCommandNames = Object.freeze({
@@ -538,6 +538,16 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
538
538
  return service === "slack" ? `${user["id"]} ${user["real_name"] ?? user["name"]} ${profile?.["email"] ?? ""}` : `${user["userId"]} ${user["name"] ?? ""} ${(user["aliases"] as readonly string[] | undefined ?? []).join(", ")}`;
539
539
  }).join("\n")),
540
540
  })] })];
541
+ if (service === "notion" && options.shareNotionWithOrg) return defineGroup({ ...group, children: [...group.children, ...users, defineCommand({
542
+ name: "share-org", description: "Give workspace members view access to a tracked Notion page.", positional: ["resource"],
543
+ params: S.Object({ resource: S.String({ description: "Tracked Notion file or URL." }) }),
544
+ handler: ({ params }) => userFacing(async () => {
545
+ const resource = await wire.showResource(params.resource, currentDirectory);
546
+ const notion = resource.identifiers.find(id => id.service === "notion");
547
+ if (!notion) throw new UserError("Expected a tracked Notion page");
548
+ return options.shareNotionWithOrg!(notion.identifier);
549
+ }), render: render((url: string) => "Workspace members can view " + url),
550
+ })] });
541
551
  const writes = asana?.writes;
542
552
  const createTask = writes?.create;
543
553
  if (service === "asana" && asana !== undefined) return defineGroup({ ...group, description: "Browse Asana projects, edit tasks and comments, and manage login.", children: [...group.children, ...users,
@@ -657,6 +667,11 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
657
667
  scope: ["cli", "mcp", "sdk"],
658
668
  children: [
659
669
  defaultAttach,
670
+ ...(options.scrapeClaude ? [defineGroup({ name: "claude", description: "Archive Claude.ai conversations.", scope: ["cli"], children: [
671
+ 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({}),
672
+ handler: () => userFacing(options.scrapeClaude!), render: render<string>(v => v),
673
+ }),
674
+ ] })] : []),
660
675
  ...(options.scrapeDrive ? [defineGroup({ name: "gdrive", description: "Download Google Drive folders and spreadsheets.", scope: ["cli"], children: [
661
676
  ...(options.previewDrive ? [defineCommand({ name: "preview", description: "List a Drive folder or read a file without saving it.", scope: ["cli"], positional: ["url"],
662
677
  params: S.Object({ url: S.String({description: "Google Drive folder or file URL."}) }),
package/src/cli.ts CHANGED
@@ -246,9 +246,11 @@ function excessPositionals(argv: readonly string[]): Readonly<{ commandPath: str
246
246
  const command = words[0]!;
247
247
  if (command in fixedCommandPositionals) return Object.freeze({ commandPath: command, expected: fixedCommandPositionals[command as keyof typeof fixedCommandPositionals].expected, received: words.length - 1 });
248
248
  if (command === "asana" && (words[1] === "projects" || words[1] === "tasks") && (words[2] === "list" || words[2] === "show")) return { commandPath: words.slice(0, 3).join(" "), expected: words[1] === "projects" && words[2] === "list" ? 0 : 1, received: words.length - 3 };
249
+ if (command === "notion" && words[1] === "share-org") return { commandPath: "notion share-org", expected: 1, received: words.length - 2 };
249
250
  if (command === "slack" && slackResourceCommands.has(words[1]!)) return { commandPath: `slack ${words[1]}`, expected: 1, received: words.length - 2 };
250
251
  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
252
  if (command === "slack" && (words[1] === "send" || words[1] === "edit")) return { commandPath: `slack ${words[1]}`, expected: 2, received: words.length - 2 };
253
+ if (command === "claude" && words[1] === "scrape") return { commandPath: "claude scrape", expected: 0, received: words.length - 2 };
252
254
  if (command === "gdrive" && (words[1] === "scrape" || words[1] === "preview")) return { commandPath: `gdrive ${words[1]}`, expected: 1, received: words.length - 2 };
253
255
  if (command === "zoom" && words[1] === "scrape") return { commandPath: "zoom scrape", expected: 0, received: words.length - 2 };
254
256
  if (authServices.has(command)) {
@@ -267,6 +269,7 @@ function missingPositionals(argv: readonly string[]): Readonly<{ commandPath: st
267
269
  const command = words[0]!;
268
270
  if (command === "asana" && words[1] === "projects" && words[2] === "show" && words.length === 3) return { commandPath: words.join(" "), name: "project" };
269
271
  if (command === "asana" && words[1] === "tasks" && (words[2] === "list" || words[2] === "show") && words.length === 3) return { commandPath: words.join(" "), name: words[2] === "list" ? "project" : "task" };
272
+ if (command === "notion" && words[1] === "share-org" && words.length < 3) return { commandPath: "notion share-org", name: "resource" };
270
273
  if (command === "slack" && slackResourceCommands.has(words[1]!) && words.length < 3) return { commandPath: `slack ${words[1]}`, name: words[1] === "sync" ? "resource" : "url" };
271
274
  if ((command === "slack" || command === "notion" || command === "asana") && words[1] === "users" && words[2] === "lookup" && words.length < 4) return { commandPath: `${command} users lookup`, name: "query" };
272
275
  if (command === "slack" && (words[1] === "send" || words[1] === "edit") && words.length < 4) return { commandPath: `slack ${words[1]}`, name: words.length === 2 ? words[1] === "send" ? "destination" : "url" : "markdown" };
@@ -305,7 +308,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
305
308
  function renderUnknownAuthCommand(argv: readonly string[]): boolean {
306
309
  if (hasRootSeparator(argv)) return false;
307
310
  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] === "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;
311
+ 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] === "notion" && words[1] === "share-org") || (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
312
  renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
310
313
  return true;
311
314
  }
@@ -368,7 +371,7 @@ function renderUnknownRootInput(argv: readonly string[]): boolean {
368
371
  const words = positionalWords(argv);
369
372
  if (words === null || words.length === 0) return false;
370
373
  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;
374
+ 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
375
  if (isSourceLikeWithoutScheme(command)) {
373
376
  renderCliError(argv, expectedSourceMessage("Expected source URL or command", command), "wire --help", expectedSourceMessage("Expected source URL or command", cliValue(command)));
374
377
  return true;
package/src/executable.ts CHANGED
@@ -7,12 +7,13 @@ import { sendSlackMessage, editSlackMessage, lookupSlackUsers } from "provider-s
7
7
 
8
8
  import { listLatticeReviewRequests, latticeReviewDraft, syncLatticeDrafts } from "provider-lattice";
9
9
  import { zoomProvider } from "provider-zoom";
10
- import { lookupNotionUsers } from "provider-notion";
10
+ import { lookupNotionUsers, shareNotionWithOrg } from "provider-notion";
11
11
 
12
12
  import { changeDocComment, listDocComments } from "./adapters/doc-comments.js";
13
13
  import { previewDrive, scrapeDrive } from "./adapters/gdrive.js";
14
14
  import { codeSignalInterviewId, previewCodeSignal } from "./adapters/codesignal.js";
15
15
  import { ashby } from "./adapters/ashby.js";
16
+ import { scrapeClaude } from "./adapters/claude.js";
16
17
  import { readAgenda } from "./adapters/calendar.js";
17
18
  import { createRoot } from "./adapters/root.js";
18
19
  import { composeAuth } from "./auth.js";
@@ -143,7 +144,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
143
144
  switchBackend: baseWire.switchBackend,
144
145
  });
145
146
  const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
146
- return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, 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), {
147
+ return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, shareNotionWithOrg: id => shareNotionWithOrg(runtime, id), 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), {
147
148
  lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
148
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) },
149
150
  }, async () => {