@kamilio/wire 0.1.37 → 0.1.39
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/README.md +2 -2
- package/dist/adapters/ashby.d.ts +4 -0
- package/dist/adapters/ashby.d.ts.map +1 -0
- package/dist/adapters/ashby.js +228 -0
- package/dist/adapters/ashby.js.map +1 -0
- package/dist/adapters/drive-pdf.d.ts +1 -0
- package/dist/adapters/drive-pdf.d.ts.map +1 -1
- package/dist/adapters/drive-pdf.js +102 -1
- package/dist/adapters/drive-pdf.js.map +1 -1
- package/dist/adapters/gdrive.d.ts.map +1 -1
- package/dist/adapters/gdrive.js +25 -4
- package/dist/adapters/gdrive.js.map +1 -1
- package/dist/adapters/root.d.ts +1 -0
- package/dist/adapters/root.d.ts.map +1 -1
- package/dist/adapters/root.js +17 -4
- package/dist/adapters/root.js.map +1 -1
- package/dist/auth.d.ts +2 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +4 -2
- package/dist/auth.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/executable.d.ts.map +1 -1
- package/dist/executable.js +2 -1
- package/dist/executable.js.map +1 -1
- package/node_modules/provider-notion/dist/notion-sync.js +5 -5
- package/node_modules/provider-notion/dist/notion-sync.js.map +1 -1
- package/node_modules/provider-notion/src/notion-sync.ts +5 -5
- package/node_modules/wire-core/dist/ports.d.ts +1 -1
- package/node_modules/wire-core/dist/ports.d.ts.map +1 -1
- package/node_modules/wire-core/dist/runtime/cookies.d.ts.map +1 -1
- package/node_modules/wire-core/dist/runtime/cookies.js +3 -1
- package/node_modules/wire-core/dist/runtime/cookies.js.map +1 -1
- package/node_modules/wire-core/dist/runtime/node.js +2 -2
- package/node_modules/wire-core/dist/runtime/node.js.map +1 -1
- package/node_modules/wire-core/src/ports.ts +1 -1
- package/node_modules/wire-core/src/runtime/cookies.ts +2 -1
- package/node_modules/wire-core/src/runtime/node.ts +2 -2
- package/package.json +1 -1
- package/src/adapters/ashby.ts +334 -0
- package/src/adapters/drive-pdf.ts +120 -1
- package/src/adapters/gdrive.ts +24 -4
- package/src/adapters/root.ts +18 -5
- package/src/auth.ts +7 -3
- package/src/cli.ts +2 -2
- package/src/executable.ts +2 -1
package/src/adapters/gdrive.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
-
import { lstat, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { lstat, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, extname, join } from "node:path";
|
|
4
4
|
import type { RuntimeCapabilities } from "wire-core";
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ const formats: Record<string, [string, string]> = {
|
|
|
11
11
|
drawing: [".svg", "image/svg+xml"],
|
|
12
12
|
};
|
|
13
13
|
type File = { id: string; name: string; mimeType: string; version: string };
|
|
14
|
-
type Entry = { id: string; version?: string; hash?: string; noText?: true };
|
|
14
|
+
type Entry = { id: string; version?: string; hash?: string; noText?: true; markdownOnly?: true };
|
|
15
15
|
type State = { folder: string; entries: Record<string, Entry> };
|
|
16
16
|
const digest = (data: Uint8Array) => createHash("sha256").update(data).digest("hex");
|
|
17
17
|
async function stat(path: string) {
|
|
@@ -116,7 +116,8 @@ export async function scrapeDrive(runtime: DriveRuntime, cwd: string, url?: stri
|
|
|
116
116
|
if (!match) await drive(runtime, "/" + encodeURIComponent(state.folder), { fields: "id", supportsAllDrives: "true" });
|
|
117
117
|
if (match && state.folder !== match[1]) throw new Error("This directory tracks a different Drive folder.");
|
|
118
118
|
let downloaded = 0,
|
|
119
|
-
unchanged = 0
|
|
119
|
+
unchanged = 0,
|
|
120
|
+
removed = 0;
|
|
120
121
|
const errors: string[] = [],
|
|
121
122
|
skipped: string[] = [],
|
|
122
123
|
images: string[] = [];
|
|
@@ -156,17 +157,34 @@ export async function scrapeDrive(runtime: DriveRuntime, cwd: string, url?: stri
|
|
|
156
157
|
await visit(f.id, path);
|
|
157
158
|
continue;
|
|
158
159
|
}
|
|
160
|
+
const original = state.entries[key(path)];
|
|
161
|
+
const removeVerified = async (bytes: Uint8Array, md: Buffer) => {
|
|
162
|
+
const { verifiedPdf } = await import("./drive-pdf.js");
|
|
163
|
+
if (!verifiedPdf(bytes, md.toString("utf8"))) return;
|
|
164
|
+
// Recheck both local files after verification, before removing the managed copy.
|
|
165
|
+
for (const p of paths()) {
|
|
166
|
+
const local = join(cwd, p);
|
|
167
|
+
if (!(await lstat(local)).isFile() || digest(await readFile(local)) !== state.entries[key(p)]?.hash)
|
|
168
|
+
throw new Error("Local file changed: " + p);
|
|
169
|
+
}
|
|
170
|
+
await unlink(full);
|
|
171
|
+
state.entries[key(path)]!.markdownOnly = true;
|
|
172
|
+
removed++;
|
|
173
|
+
};
|
|
159
174
|
let current = true;
|
|
160
175
|
for (const p of paths()) {
|
|
161
|
-
if (p !== path && state.entries[key(path)]?.noText) continue;
|
|
162
176
|
const entry = state.entries[key(p)],
|
|
163
177
|
info = await stat(join(cwd, p));
|
|
178
|
+
if (!info && p !== path && original?.noText) continue;
|
|
179
|
+
if (!info && p === path && original?.markdownOnly && original.version === f.version) continue;
|
|
164
180
|
if (info && (!info.isFile() || digest(await readFile(join(cwd, p))) !== entry?.hash))
|
|
165
181
|
throw new Error("Local file changed: " + p);
|
|
166
182
|
if (!info || entry?.version !== f.version) current = false;
|
|
167
183
|
}
|
|
168
184
|
if (current) {
|
|
169
185
|
if (state.entries[key(path)]?.noText) images.push(path);
|
|
186
|
+
if (pdf && !original?.noText && (await stat(full)))
|
|
187
|
+
await removeVerified(await readFile(full), await readFile(full + ".md"));
|
|
170
188
|
unchanged++;
|
|
171
189
|
continue;
|
|
172
190
|
}
|
|
@@ -188,6 +206,7 @@ export async function scrapeDrive(runtime: DriveRuntime, cwd: string, url?: stri
|
|
|
188
206
|
const md = Buffer.from(text);
|
|
189
207
|
await save(full + ".md", md);
|
|
190
208
|
state.entries[key(path + ".md")] = { id: f.id, version: f.version, hash: digest(md) };
|
|
209
|
+
await removeVerified(bytes, md);
|
|
191
210
|
}
|
|
192
211
|
downloaded++;
|
|
193
212
|
} catch (e) {
|
|
@@ -206,6 +225,7 @@ export async function scrapeDrive(runtime: DriveRuntime, cwd: string, url?: stri
|
|
|
206
225
|
" downloaded, " +
|
|
207
226
|
unchanged +
|
|
208
227
|
" unchanged." +
|
|
228
|
+
(removed ? " Verified Markdown; removed " + removed + " local PDF copies." : "") +
|
|
209
229
|
(images.length ? "\nPDFs with no text layer (originals kept): " + images.join(", ") : "") +
|
|
210
230
|
(skipped.length ? "\nUnsupported Drive items: " + skipped.join(", ") : "");
|
|
211
231
|
if (errors.length) throw new Error(summary + "\n" + errors.join("\n"));
|
package/src/adapters/root.ts
CHANGED
|
@@ -10,9 +10,9 @@ import { formatAgenda, type readAgenda } from "./calendar.js";
|
|
|
10
10
|
|
|
11
11
|
export type WireRoot = Group;
|
|
12
12
|
export type TextInputReader = () => Promise<string>;
|
|
13
|
-
export type WireRootOptions = Readonly<{ allowPaste: boolean; previewDrive?: (url: string) => Promise<string>; scrapeDrive?: (url?: string) => 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> }>;
|
|
13
|
+
export type WireRootOptions = Readonly<{ allowPaste: boolean; ashby?: (action: string, arg?: string) => Promise<string>; previewDrive?: (url: string) => Promise<string>; scrapeDrive?: (url?: string) => 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
14
|
|
|
15
|
-
const authServices = ["asana", "chatgpt", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
|
|
15
|
+
const authServices = ["ashby", "asana", "chatgpt", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
|
|
16
16
|
const removedCliCommandNames = Object.freeze({
|
|
17
17
|
create: "Use `wire attach <url>` or `wire <url>`.",
|
|
18
18
|
fetch: "Use `wire download <url>`.",
|
|
@@ -207,7 +207,7 @@ function wireUserErrorMessage(message: string): boolean {
|
|
|
207
207
|
|| /^Resource (path |identifier |URL )?not found: /.test(message)
|
|
208
208
|
|| /^Ambiguous resource path /.test(message)
|
|
209
209
|
|| /^Login not saved$/.test(message)
|
|
210
|
-
|| /authentication (is missing|is missing or expired|failed|expired).*Run `wire (asana|chatgpt|gmail|google-docs|notion|slack|zoom) login`/i.test(message)
|
|
210
|
+
|| /authentication (is missing|is missing or expired|failed|expired).*Run `wire (ashby|asana|chatgpt|gmail|google-docs|notion|slack|zoom) login`/i.test(message)
|
|
211
211
|
|| /^Asana API /.test(message)
|
|
212
212
|
|| /^(GET|POST|PUT|DELETE) \/.* failed: \d+ /.test(message)
|
|
213
213
|
|| /^(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)
|
|
@@ -246,7 +246,7 @@ function wireUserErrorDisplayMessage(message: string): string {
|
|
|
246
246
|
if (unsupportedSource !== null) return `unsupported source\nurl: ${lineText(unsupportedSource[1]!)}\nsupported: Asana, ChatGPT, Gmail, Google Docs/Sheets/Slides/Forms, Notion, Slack, Zoom`;
|
|
247
247
|
const existingWorkspace = /^Wire workspace already initialized with (sqlite|files) registry at ([\s\S]+)\. Existing registries are not overwritten\.$/.exec(message);
|
|
248
248
|
if (existingWorkspace !== null) return `workspace already initialized\nbackend: ${existingWorkspace[1]!}\nregistry: ${lineText(existingWorkspace[2]!)}\nkept: existing registry`;
|
|
249
|
-
const authentication = /authentication (is missing or expired|is missing|failed|expired).*Run `wire (asana|chatgpt|gmail|google-docs|notion|slack|zoom) login`/i.exec(message);
|
|
249
|
+
const authentication = /authentication (is missing or expired|is missing|failed|expired).*Run `wire (ashby|asana|chatgpt|gmail|google-docs|notion|slack|zoom) login`/i.exec(message);
|
|
250
250
|
if (authentication !== null) return `login required\nservice: ${serviceTitle(authentication[2] as AuthService)}\nrun: wire ${authentication[2]} login`;
|
|
251
251
|
const asanaApi = /^Asana API ([^\s]+) failed: HTTP (\d+)(?: ([\s\S]+))?$/.exec(message);
|
|
252
252
|
if (asanaApi !== null) return `api failed\nservice: Asana\nrequest: ${lineText(asanaApi[1]!)}\nstatus: HTTP ${asanaApi[2]!}${asanaApi[3] === undefined ? "" : `\ndetail: ${lineText(asanaApi[3]!)}`}`;
|
|
@@ -345,6 +345,7 @@ function userFacing<T>(operation: () => Promise<T>): Promise<T> {
|
|
|
345
345
|
|
|
346
346
|
function serviceTitle(service: AuthService): string {
|
|
347
347
|
return {
|
|
348
|
+
ashby: "Ashby",
|
|
348
349
|
asana: "Asana",
|
|
349
350
|
chatgpt: "ChatGPT",
|
|
350
351
|
gmail: "Gmail",
|
|
@@ -410,7 +411,7 @@ export const wirePresentation: WirePresentation = Object.freeze({
|
|
|
410
411
|
function authGroup(service: AuthService, description: string, loginDescription: string, auth: Auth, readInput: TextInputReader | undefined, options: WireRootOptions): Group {
|
|
411
412
|
const login = async (paste: boolean | undefined) => {
|
|
412
413
|
if (paste === true && !options.allowPaste) throw new UserError("Cookie paste is CLI-only.");
|
|
413
|
-
return paste === true ? auth.pasteCookies(service, await readInput!()) : service === "asana" ? auth.extractAsana() : service === "chatgpt" ? auth.extractChatgpt() : service === "gmail" ? auth.extractGmail() : service === "google-docs" ? auth.extractGoogleDocs() : service === "notion" ? auth.extractNotion() : service === "slack" ? auth.extractSlack() : auth.extractZoom();
|
|
414
|
+
return paste === true ? auth.pasteCookies(service, await readInput!()) : service === "ashby" ? auth.extractAshby() : service === "asana" ? auth.extractAsana() : service === "chatgpt" ? auth.extractChatgpt() : service === "gmail" ? auth.extractGmail() : service === "google-docs" ? auth.extractGoogleDocs() : service === "notion" ? auth.extractNotion() : service === "slack" ? auth.extractSlack() : auth.extractZoom();
|
|
414
415
|
};
|
|
415
416
|
const title = serviceTitle(service);
|
|
416
417
|
return defineGroup({ name: service, description, children: [
|
|
@@ -561,6 +562,18 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
|
|
|
561
562
|
render: render<JsonObject>((comment) => `Updated comment ${comment["gid"]}`),
|
|
562
563
|
})] })] : []),
|
|
563
564
|
] });
|
|
565
|
+
if (service === "ashby" && options.ashby) {
|
|
566
|
+
const run = options.ashby;
|
|
567
|
+
return defineGroup({ ...group, description: "Read your interviews and sync feedback drafts.", children: [...group.children,
|
|
568
|
+
...([["interviews","List your upcoming interviews."],["pending","List interviews awaiting your feedback."],["latest","Read your most recently submitted feedback."]] as const).map(([name,description])=>defineCommand({
|
|
569
|
+
name,description,params:S.Object({}),handler:()=>userFacing(()=>run(name)),render:render<string>(v=>v),
|
|
570
|
+
})),
|
|
571
|
+
...([["prep","Read the interview briefing and candidate background."],["template","Print your editable Markdown feedback draft."]] as const).map(([name,description])=>defineCommand({
|
|
572
|
+
name,description,positional:["url"],params:S.Object({url:S.String({description:"Interview briefing URL."})}),handler:({params})=>userFacing(()=>run(name,params.url)),render:render<string>(v=>v),
|
|
573
|
+
})),
|
|
574
|
+
defineCommand({name:"sync",description:"Save edited Markdown sections as drafts. Blank answers are skipped. Final submission is manual.",positional:["file"],params:S.Object({file:S.String({description:"Markdown file created with ashby template."})}),handler:({params})=>userFacing(()=>run("sync",params.file)),render:render<string>(v=>v)}),
|
|
575
|
+
]});
|
|
576
|
+
}
|
|
564
577
|
if (service === "zoom" && options.scrapeZoom) return defineGroup({ ...group, children: [...group.children, defineCommand({
|
|
565
578
|
name: "scrape", scope: ["cli"], description: "Sync available Zoom Hub transcripts into ./zoom without deleting existing files.", params: S.Object({}),
|
|
566
579
|
handler: () => userFacing(options.scrapeZoom!),
|
package/src/auth.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { parsePastedCookieMetadata, parsePastedCookies, type ChromeCookieExtraction, type ChromeCookieResult, type Cookie, type NodeEnvironment, type RuntimeCapabilities } from "wire-core";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { ashbySession } from "./adapters/ashby.js";
|
|
4
|
+
|
|
5
|
+
export type AuthService = "ashby" | "asana" | "chatgpt" | "gmail" | "google-docs" | "notion" | "slack" | "zoom";
|
|
4
6
|
export type CookieAuthService = AuthService;
|
|
5
7
|
|
|
6
8
|
export interface AuthResult {
|
|
@@ -227,6 +229,7 @@ export interface Auth {
|
|
|
227
229
|
readonly status: (service: AuthService) => Promise<AuthResult>;
|
|
228
230
|
readonly pasteCookies: (service: AuthService, contents: string) => Promise<AuthResult>;
|
|
229
231
|
readonly logout: (service: AuthService) => Promise<{ readonly service: AuthService; readonly deleted: true }>;
|
|
232
|
+
readonly extractAshby: () => Promise<AuthResult>;
|
|
230
233
|
readonly extractAsana: () => Promise<AuthResult>;
|
|
231
234
|
readonly extractChatgpt: () => Promise<AuthResult>;
|
|
232
235
|
readonly extractGmail: () => Promise<AuthResult>;
|
|
@@ -239,8 +242,8 @@ export interface Auth {
|
|
|
239
242
|
export type CookieExtractor = (environment: NodeEnvironment, extraction: ChromeCookieExtraction) => Promise<ChromeCookieResult>;
|
|
240
243
|
|
|
241
244
|
export function composeAuth(runtime: RuntimeCapabilities, environment: NodeEnvironment, extractCookies: CookieExtractor): Auth {
|
|
242
|
-
const cookieDomains: Readonly<Record<AuthService, string>> = Object.freeze({ asana: ".asana.com", chatgpt: ".chatgpt.com", gmail: ".google.com", "google-docs": ".google.com", notion: ".notion.so", slack: ".slack.com", zoom: ".zoom.us" });
|
|
243
|
-
const verifyCookies = (service: AuthService, cookies: readonly Cookie[], metadata: Readonly<Record<string, string>>) => service === "asana" ? verifyAsana(runtime, cookies) : service === "chatgpt" ? verifyChatgpt(runtime, cookies) : service === "gmail" ? verifyGmailCookies(runtime, cookies) : service === "google-docs" ? verifyGoogleDocsCookies(runtime, cookies) : service === "notion" ? verifyNotion(runtime, cookies) : service === "slack" ? verifySlack(runtime, cookies, metadata) : verifyZoom(runtime, cookies);
|
|
245
|
+
const cookieDomains: Readonly<Record<AuthService, string>> = Object.freeze({ ashby: ".ashbyhq.com", asana: ".asana.com", chatgpt: ".chatgpt.com", gmail: ".google.com", "google-docs": ".google.com", notion: ".notion.so", slack: ".slack.com", zoom: ".zoom.us" });
|
|
246
|
+
const verifyCookies = (service: AuthService, cookies: readonly Cookie[], metadata: Readonly<Record<string, string>>) => service === "ashby" ? ashbySession(runtime,cookies).then(q=>q("query { sessionUser { id } }")).then(d=>d.sessionUser ? {service,identity:{user_id:d.sessionUser.id}} : null).catch(()=>null) : service === "asana" ? verifyAsana(runtime, cookies) : service === "chatgpt" ? verifyChatgpt(runtime, cookies) : service === "gmail" ? verifyGmailCookies(runtime, cookies) : service === "google-docs" ? verifyGoogleDocsCookies(runtime, cookies) : service === "notion" ? verifyNotion(runtime, cookies) : service === "slack" ? verifySlack(runtime, cookies, metadata) : verifyZoom(runtime, cookies);
|
|
244
247
|
const verifyCookieState = async (service: AuthService, cookies: readonly Cookie[], metadata: Readonly<Record<string, string>>) => {
|
|
245
248
|
if (service === "zoom") return verifyZoomCookieState(runtime, cookies, metadata);
|
|
246
249
|
return Object.freeze({ result: await verifyCookies(service, cookies, metadata), cookies, metadata, changed: false });
|
|
@@ -286,6 +289,7 @@ export function composeAuth(runtime: RuntimeCapabilities, environment: NodeEnvir
|
|
|
286
289
|
await runtime.cookies.delete(service);
|
|
287
290
|
return Object.freeze({ service, deleted: true });
|
|
288
291
|
},
|
|
292
|
+
extractAshby: () => extract("ashby", "https://app.ashbyhq.com/", ["ashbyhq.com"], values => values.length > 0),
|
|
289
293
|
extractAsana: () => extract("asana", "https://app.asana.com/", ["asana.com"], (values) => values.some((cookie) => cookie.domain === ".asana.com" || cookie.domain.endsWith(".asana.com"))),
|
|
290
294
|
extractChatgpt: () => extract("chatgpt", "https://chatgpt.com/", ["chatgpt.com", "openai.com"], (values) => values.some((cookie) => cookie.name === "oai-did") && values.some((cookie) => cookie.name === "__Secure-next-auth.session-token" || cookie.name === "__Secure-next-auth.session-token.0"), undefined, true),
|
|
291
295
|
extractGmail: () => extract("gmail", "https://mail.google.com/mail/u/0/", ["google.com"], googleReady),
|
package/src/cli.ts
CHANGED
|
@@ -120,7 +120,7 @@ const fixedCommandPositionals = Object.freeze({
|
|
|
120
120
|
"sync-all": Object.freeze({ expected: 0, name: "" }),
|
|
121
121
|
watch: Object.freeze({ expected: 1, name: "file" }),
|
|
122
122
|
});
|
|
123
|
-
const authServices = new Set(["asana", "chatgpt", "gmail", "google-docs", "notion", "slack", "zoom"]);
|
|
123
|
+
const authServices = new Set(["ashby", "asana", "chatgpt", "gmail", "google-docs", "notion", "slack", "zoom"]);
|
|
124
124
|
const slackResourceCommands = new Set(["preview", "attach", "sync"]);
|
|
125
125
|
const authCommands = new Set(["login", "logout", "status"]);
|
|
126
126
|
const removedCommandNames = Object.freeze({
|
|
@@ -299,7 +299,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
|
|
|
299
299
|
function renderUnknownAuthCommand(argv: readonly string[]): boolean {
|
|
300
300
|
if (hasRootSeparator(argv)) return false;
|
|
301
301
|
const words = positionalWords(argv);
|
|
302
|
-
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;
|
|
302
|
+
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;
|
|
303
303
|
renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
|
|
304
304
|
return true;
|
|
305
305
|
}
|
package/src/executable.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { zoomProvider } from "provider-zoom";
|
|
|
10
10
|
import { lookupNotionUsers } from "provider-notion";
|
|
11
11
|
|
|
12
12
|
import { previewDrive, scrapeDrive } from "./adapters/gdrive.js";
|
|
13
|
+
import { ashby } from "./adapters/ashby.js";
|
|
13
14
|
import { readAgenda } from "./adapters/calendar.js";
|
|
14
15
|
import { createRoot } from "./adapters/root.js";
|
|
15
16
|
import { composeAuth } from "./auth.js";
|
|
@@ -140,7 +141,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
|
|
|
140
141
|
switchBackend: baseWire.switchBackend,
|
|
141
142
|
});
|
|
142
143
|
const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
|
|
143
|
-
return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, previewDrive: url => previewDrive(runtime,url), scrapeDrive: url => scrapeDrive(runtime, currentDirectory, url), 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), {
|
|
144
|
+
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 => scrapeDrive(runtime, currentDirectory, url), 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), {
|
|
144
145
|
lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
|
|
145
146
|
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) },
|
|
146
147
|
}, async () => {
|