@kamilio/wire 0.1.27 → 0.1.28

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.
@@ -2,12 +2,13 @@ import { UserError, defineCommand, defineGroup, S, type Group } from "toolcraft"
2
2
 
3
3
  import { defaultWireBackend, registryPathForBackend, type JsonObject, type FetchedDocument, type InitializedWire, type Resource, type SwitchedWireBackend, type Wire, type WireBackend, type WireResult, type WireWatchSession } from "wire-core";
4
4
  import type { listAsanaProjects, listAsanaTasks, moveAsanaTask, showAsanaProject } from "provider-asana";
5
+ import type { zoomProvider } from "provider-zoom";
5
6
  import type { SlackSentMessage } from "provider-slack";
6
7
  import type { Auth, AuthResult, AuthService } from "../auth.js";
7
8
 
8
9
  export type WireRoot = Group;
9
10
  export type TextInputReader = () => Promise<string>;
10
- export type WireRootOptions = Readonly<{ allowPaste: boolean }>;
11
+ export type WireRootOptions = Readonly<{ allowPaste: boolean; scrapeZoom?: () => ReturnType<typeof zoomProvider.scrape> }>;
11
12
 
12
13
  const authServices = ["asana", "chatgpt", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
13
14
  const removedCliCommandNames = Object.freeze({
@@ -208,6 +209,7 @@ function wireUserErrorMessage(message: string): boolean {
208
209
  || /^Asana API /.test(message)
209
210
  || /^(GET|POST|PUT|DELETE) \/.* failed: \d+ /.test(message)
210
211
  || /^(Invalid Asana project heading|Asana section appears|Asana milestone appears|Asana task appears|Asana subtask appears|Unsupported Asana Markdown|Duplicate Asana identity|Missing Asana project heading|Asana project identity changed|Unknown Asana identity|Conflicting Asana edits)/.test(message)
212
+ || /^Zoom Hub rate limited; retry after /.test(message)
211
213
  || /^ChatGPT conversation download failed\. Run `wire chatgpt login`\./.test(message)
212
214
  || /^Gmail API .+ failed: HTTP \d+ /.test(message)
213
215
  || /^Slack API [\w.]+ failed: /.test(message)
@@ -557,6 +559,11 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
557
559
  render: render<JsonObject>((comment) => `Updated comment ${comment["gid"]}`),
558
560
  })] })] : []),
559
561
  ] });
562
+ if (service === "zoom" && options.scrapeZoom) return defineGroup({ ...group, children: [...group.children, defineCommand({
563
+ name: "scrape", scope: ["cli"], description: "Sync available Zoom Hub transcripts into ./zoom without deleting existing files.", params: S.Object({}),
564
+ handler: () => userFacing(options.scrapeZoom!),
565
+ render: render<Awaited<ReturnType<typeof zoomProvider.scrape>>>(v => `Zoom: ${v.downloaded} downloaded, ${v.unchanged} unchanged, ${v.unavailable} unavailable, ${v.locallyModified} locally modified.`),
566
+ })] });
560
567
  if (service !== "slack") return users.length === 0 ? group : defineGroup({ ...group, children: [...group.children, ...users] });
561
568
  return defineGroup({ name: "slack", description: "Read Slack channels, DMs, and threads, send Markdown, and manage login.", children: [preview, defaultAttach, sync, ...group.children, ...users, ...(sendSlack === undefined ? [] : [defineCommand({
562
569
  name: "send",
package/src/cli.ts CHANGED
@@ -243,6 +243,7 @@ function excessPositionals(argv: readonly string[]): Readonly<{ commandPath: str
243
243
  if (command === "slack" && slackResourceCommands.has(words[1]!)) return { commandPath: `slack ${words[1]}`, expected: 1, received: words.length - 2 };
244
244
  if ((command === "slack" || command === "notion" || command === "asana") && words[1] === "users" && words[2] === "lookup") return { commandPath: `${command} users lookup`, expected: 1, received: words.length - 3 };
245
245
  if (command === "slack" && (words[1] === "send" || words[1] === "edit")) return { commandPath: `slack ${words[1]}`, expected: 2, received: words.length - 2 };
246
+ if (command === "zoom" && words[1] === "scrape") return { commandPath: "zoom scrape", expected: 0, received: words.length - 2 };
246
247
  if (authServices.has(command)) {
247
248
  const authCommand = words[1];
248
249
  if (authCommand === undefined || !authCommands.has(authCommand)) return null;
@@ -297,7 +298,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
297
298
  function renderUnknownAuthCommand(argv: readonly string[]): boolean {
298
299
  if (hasRootSeparator(argv)) return false;
299
300
  const words = positionalWords(argv);
300
- if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(words[1]!) || 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;
301
+ if (words === null || words.length < 2 || !authServices.has(words[0]!) || authCommands.has(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;
301
302
  renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
302
303
  return true;
303
304
  }
package/src/executable.ts CHANGED
@@ -5,6 +5,7 @@ import { dirname, isAbsolute, join, resolve } from "node:path";
5
5
  import { addAsanaComment, createAsanaTask, editAsanaComment, editAsanaTask, listAsanaProjects, listAsanaTasks, lookupAsanaUsers, moveAsanaTask, showAsanaProject, showAsanaTask } from "provider-asana";
6
6
  import { sendSlackMessage, editSlackMessage, lookupSlackUsers } from "provider-slack";
7
7
 
8
+ import { zoomProvider } from "provider-zoom";
8
9
  import { lookupNotionUsers } from "provider-notion";
9
10
 
10
11
  import { createRoot } from "./adapters/root.js";
@@ -130,7 +131,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
130
131
  switchBackend: baseWire.switchBackend,
131
132
  });
132
133
  const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
133
- return createRoot(wire, currentDirectory, auth, readStandardInput, options, (destination, markdown) => sendSlackMessage(runtime, destination, markdown), (query) => lookupSlackUsers(runtime, query), (url, markdown) => editSlackMessage(runtime, url, markdown), (query) => lookupNotionUsers(runtime, query), {
134
+ return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, 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), {
134
135
  lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
135
136
  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) },
136
137
  });