@kamilio/wire 0.1.65 → 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.
- package/dist/adapters/root.d.ts +1 -0
- package/dist/adapters/root.d.ts.map +1 -1
- package/dist/adapters/root.js +12 -0
- package/dist/adapters/root.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/executable.js +2 -2
- package/dist/executable.js.map +1 -1
- package/node_modules/provider-notion/dist/index.d.ts +1 -1
- package/node_modules/provider-notion/dist/index.d.ts.map +1 -1
- package/node_modules/provider-notion/dist/index.js +1 -1
- package/node_modules/provider-notion/dist/index.js.map +1 -1
- package/node_modules/provider-notion/dist/notion-sync.d.ts +1 -0
- package/node_modules/provider-notion/dist/notion-sync.d.ts.map +1 -1
- package/node_modules/provider-notion/dist/notion-sync.js +26 -5
- package/node_modules/provider-notion/dist/notion-sync.js.map +1 -1
- package/node_modules/provider-notion/src/index.ts +1 -1
- package/node_modules/provider-notion/src/notion-sync.ts +27 -5
- package/package.json +1 -1
- package/src/adapters/root.ts +11 -1
- package/src/cli.ts +3 -1
- package/src/executable.ts +2 -2
package/src/adapters/root.ts
CHANGED
|
@@ -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; 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> }>;
|
|
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,
|
package/src/cli.ts
CHANGED
|
@@ -246,6 +246,7 @@ 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 };
|
|
@@ -268,6 +269,7 @@ function missingPositionals(argv: readonly string[]): Readonly<{ commandPath: st
|
|
|
268
269
|
const command = words[0]!;
|
|
269
270
|
if (command === "asana" && words[1] === "projects" && words[2] === "show" && words.length === 3) return { commandPath: words.join(" "), name: "project" };
|
|
270
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" };
|
|
271
273
|
if (command === "slack" && slackResourceCommands.has(words[1]!) && words.length < 3) return { commandPath: `slack ${words[1]}`, name: words[1] === "sync" ? "resource" : "url" };
|
|
272
274
|
if ((command === "slack" || command === "notion" || command === "asana") && words[1] === "users" && words[2] === "lookup" && words.length < 4) return { commandPath: `${command} users lookup`, name: "query" };
|
|
273
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" };
|
|
@@ -306,7 +308,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
|
|
|
306
308
|
function renderUnknownAuthCommand(argv: readonly string[]): boolean {
|
|
307
309
|
if (hasRootSeparator(argv)) return false;
|
|
308
310
|
const words = positionalWords(argv);
|
|
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;
|
|
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;
|
|
310
312
|
renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
|
|
311
313
|
return true;
|
|
312
314
|
}
|
package/src/executable.ts
CHANGED
|
@@ -7,7 +7,7 @@ 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";
|
|
@@ -144,7 +144,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
|
|
|
144
144
|
switchBackend: baseWire.switchBackend,
|
|
145
145
|
});
|
|
146
146
|
const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
|
|
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), {
|
|
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), {
|
|
148
148
|
lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
|
|
149
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) },
|
|
150
150
|
}, async () => {
|