@kamilio/wire 0.1.73 → 0.1.74
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 +1 -1
- package/dist/adapters/claude.d.ts +3 -2
- package/dist/adapters/claude.d.ts.map +1 -1
- package/dist/adapters/claude.js +92 -77
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/root.d.ts.map +1 -1
- package/dist/adapters/root.js +9 -7
- 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 +8 -2
- package/dist/auth.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/executable.js +1 -1
- package/dist/executable.js.map +1 -1
- package/node_modules/wire-core/dist/runtime/chrome.d.ts.map +1 -1
- package/node_modules/wire-core/dist/runtime/chrome.js +13 -6
- package/node_modules/wire-core/dist/runtime/chrome.js.map +1 -1
- package/node_modules/wire-core/dist/runtime/cookies.js +1 -1
- package/node_modules/wire-core/dist/runtime/cookies.js.map +1 -1
- package/node_modules/wire-core/src/runtime/chrome.ts +13 -5
- package/node_modules/wire-core/src/runtime/cookies.ts +1 -1
- package/package.json +1 -1
- package/src/adapters/claude.ts +76 -61
- package/src/adapters/root.ts +8 -7
- package/src/auth.ts +10 -3
- package/src/cli.ts +2 -2
- package/src/executable.ts +1 -1
package/src/adapters/claude.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import type { ProcessCapability } from "wire-core";
|
|
5
|
+
import type { Cookie, ProcessCapability, RuntimeCapabilities } from "wire-core";
|
|
6
6
|
|
|
7
7
|
type Summary = { uuid: string; name: string; created_at: string; updated_at: string };
|
|
8
8
|
type Message = { sender: string; text: string; content: { type: string; text?: string }[]; attachments: { file_name: string }[]; files: { file_name: string }[] };
|
|
@@ -26,86 +26,101 @@ export function claudeMarkdown(chat: Chat) {
|
|
|
26
26
|
return lines.join("\n").trimEnd() + "\n";
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export async function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const scratch = await mkdtemp(join(originals, ".download-"));
|
|
29
|
+
export async function claudeSession<T>(process: ProcessCapability, cookies: readonly Cookie[], directory: string, action: (get: <R>(paths: string[]) => Promise<R[]>) => Promise<T>): Promise<T> {
|
|
30
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
31
|
+
const scratch = await mkdtemp(join(directory, ".claude-session-"));
|
|
33
32
|
const args = ["-s=wire-claude-" + randomUUID(), "--raw"];
|
|
34
33
|
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
34
|
async function get<T>(paths: string[]): Promise<T[]> {
|
|
38
35
|
const path = join(scratch, "response.json");
|
|
39
36
|
await rm(path, { force: true });
|
|
40
|
-
|
|
41
|
-
if(location.origin !== "https://claude.ai") throw Error("
|
|
37
|
+
await run("eval", `async () => {
|
|
38
|
+
if(location.origin !== "https://claude.ai") throw Error("Run wire claude login to sign in.");
|
|
42
39
|
return Promise.all(${JSON.stringify(paths)}.map(async path => {
|
|
43
40
|
const r = await fetch(path);
|
|
44
|
-
if (!r.ok) throw Error("Claude HTTP " + r.status
|
|
41
|
+
if (!r.ok) throw Error("Claude HTTP " + r.status + ". Run wire claude login if the session expired.");
|
|
45
42
|
return r.json();
|
|
46
43
|
}));
|
|
47
44
|
}`, "--filename=" + path);
|
|
48
|
-
if (!existsSync(path)) throw new Error("Claude
|
|
45
|
+
if (!existsSync(path)) throw new Error("Claude request failed. Run `wire claude login` to refresh the saved session.");
|
|
49
46
|
return JSON.parse(await readFile(path, "utf8"));
|
|
50
47
|
}
|
|
51
48
|
try {
|
|
52
|
-
|
|
49
|
+
const state = join(scratch, "state.json");
|
|
50
|
+
await writeFile(state, JSON.stringify({ cookies: cookies.map(cookie => ({
|
|
51
|
+
name: cookie.name, value: cookie.value, domain: cookie.domain, path: cookie.path,
|
|
52
|
+
expires: cookie.expires === 0 ? -1 : cookie.expires, httpOnly: cookie.httpOnly, secure: cookie.secure, sameSite: "Lax",
|
|
53
|
+
})), origins: [] }), { mode: 0o600 });
|
|
54
|
+
await run("open", "about:blank", "--browser=chrome", "--profile=" + join(scratch, "chrome"));
|
|
53
55
|
try {
|
|
54
|
-
await run("
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
56
|
+
await run("state-load", state);
|
|
57
|
+
await run("goto", "https://claude.ai/");
|
|
58
|
+
return await action(get);
|
|
59
|
+
} finally { await run("close"); }
|
|
60
|
+
} finally { await rm(scratch, { recursive: true, force: true }); }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function scrapeClaude(runtime: RuntimeCapabilities, directory: string) {
|
|
64
|
+
const cookies = await runtime.cookies.loadSaved("claude");
|
|
65
|
+
if (cookies === null) throw new Error("claude cookie authentication is missing or expired. Run `wire claude login` once; other commands reuse saved cookies.");
|
|
66
|
+
const root = join(directory, "claude"), originals = join(root, ".originals");
|
|
67
|
+
await mkdir(originals, { recursive: true, mode: 0o700 });
|
|
68
|
+
const scratch = await mkdtemp(join(originals, ".download-"));
|
|
69
|
+
let saved = 0, unchanged = 0, edited = 0;
|
|
70
|
+
try {
|
|
71
|
+
await claudeSession(runtime.process, cookies, originals, async get => {
|
|
72
|
+
const [orgs] = await get<{ uuid: string; capabilities: string[] }[]>(["/api/organizations"]);
|
|
73
|
+
const chats = orgs!.filter(org => org.capabilities.includes("chat"));
|
|
74
|
+
if (!chats.length) throw new Error("No Claude chat workspace found. Run `wire claude login` to sign in.");
|
|
75
|
+
for (const org of chats) {
|
|
76
|
+
if (!uuid.test(org.uuid)) throw new Error("Invalid Claude workspace ID.");
|
|
77
|
+
const base = "/api/organizations/" + org.uuid;
|
|
78
|
+
const seen = new Set<string>();
|
|
79
|
+
for (const archived of [false, true]) {
|
|
80
|
+
for (let offset = 0; ;) {
|
|
81
|
+
const [page] = await get<{ data: Summary[]; has_more: boolean }>([base + "/chat_conversations_v2?limit=100&archived=" + archived + "&offset=" + offset]);
|
|
82
|
+
const pending: Summary[] = [];
|
|
83
|
+
const before = seen.size;
|
|
84
|
+
for (const summary of page!.data) {
|
|
85
|
+
if (!uuid.test(summary.uuid)) throw new Error("Invalid Claude conversation ID.");
|
|
86
|
+
if (seen.has(summary.uuid)) continue;
|
|
87
|
+
seen.add(summary.uuid);
|
|
88
|
+
const raw = join(originals, summary.uuid + ".json");
|
|
89
|
+
if (existsSync(raw)) {
|
|
90
|
+
const old: Chat = JSON.parse(await readFile(raw, "utf8"));
|
|
91
|
+
if (old.updated_at === summary.updated_at && existsSync(join(root, noteName(old)))) { unchanged++; continue; }
|
|
78
92
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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++;
|
|
93
|
+
pending.push(summary);
|
|
94
|
+
}
|
|
95
|
+
for (let i = 0; i < pending.length; i += 4) {
|
|
96
|
+
const batch = pending.slice(i, i + 4);
|
|
97
|
+
const details = await get<Chat>(batch.map(s => base + "/chat_conversations/" + s.uuid + "?tree=True&rendering_mode=messages&render_all_tools=true"));
|
|
98
|
+
for (const [j, chat] of details.entries()) {
|
|
99
|
+
if (chat.uuid !== batch[j]!.uuid) throw new Error("Claude conversation ID mismatch.");
|
|
100
|
+
const raw = join(originals, chat.uuid + ".json"), path = join(root, noteName(chat));
|
|
101
|
+
const old: Chat | undefined = existsSync(raw) ? JSON.parse(await readFile(raw, "utf8")) : undefined;
|
|
102
|
+
const oldPath = old && join(root, noteName(old));
|
|
103
|
+
const markdown = claudeMarkdown(chat);
|
|
104
|
+
if (existsSync(path) && path !== oldPath && await readFile(path, "utf8") !== markdown) { edited++; continue; }
|
|
105
|
+
if (old && oldPath && existsSync(oldPath)) {
|
|
106
|
+
const local = await readFile(oldPath, "utf8");
|
|
107
|
+
if (local !== claudeMarkdown(old) && !(oldPath === path && local === markdown)) { edited++; continue; }
|
|
99
108
|
}
|
|
109
|
+
await writeFile(join(scratch, "note"), markdown, { mode: 0o600 });
|
|
110
|
+
await writeFile(join(scratch, "original"), JSON.stringify(chat, null, 2), { mode: 0o600 });
|
|
111
|
+
await rename(join(scratch, "note"), path);
|
|
112
|
+
await rename(join(scratch, "original"), raw);
|
|
113
|
+
if (oldPath && oldPath !== path) await rm(oldPath, { force: true });
|
|
114
|
+
saved++;
|
|
100
115
|
}
|
|
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
116
|
}
|
|
117
|
+
if (!page!.has_more) break;
|
|
118
|
+
if (before === seen.size) throw new Error("Claude history pagination stopped advancing.");
|
|
119
|
+
offset += page!.data.length;
|
|
105
120
|
}
|
|
106
121
|
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
109
124
|
} finally { await rm(scratch, { recursive: true, force: true }); }
|
|
110
125
|
return `Claude: ${saved} saved, ${unchanged} unchanged, ${edited} locally edited and skipped.\n${root}`;
|
|
111
126
|
}
|
package/src/adapters/root.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type WireRoot = Group;
|
|
|
17
17
|
export type TextInputReader = () => Promise<string>;
|
|
18
18
|
export type WireRootOptions = Readonly<{ allowPaste: boolean; searchNotion?: (query: string, options: Parameters<typeof searchNotion>[2]) => ReturnType<typeof searchNotion>; codeSignalEdit?: (url: string, path: string, file: string) => ReturnType<typeof editCodeSignal>; codeSignalRun?: (url: string) => ReturnType<typeof runCodeSignal>; 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> }>;
|
|
19
19
|
|
|
20
|
-
const authServices = ["ashby", "asana", "chatgpt", "codesignal", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
|
|
20
|
+
const authServices = ["ashby", "asana", "chatgpt", "claude", "codesignal", "gmail", "google-docs", "notion", "slack", "zoom"] as const;
|
|
21
21
|
const removedCliCommandNames = Object.freeze({
|
|
22
22
|
create: "Use `wire attach <url>` or `wire <url>`.",
|
|
23
23
|
fetch: "Use `wire download <url>`.",
|
|
@@ -360,6 +360,7 @@ function serviceTitle(service: AuthService): string {
|
|
|
360
360
|
ashby: "Ashby",
|
|
361
361
|
asana: "Asana",
|
|
362
362
|
chatgpt: "ChatGPT",
|
|
363
|
+
claude: "Claude",
|
|
363
364
|
codesignal: "CodeSignal",
|
|
364
365
|
gmail: "Gmail",
|
|
365
366
|
"google-docs": "Google Docs/Sheets/Slides",
|
|
@@ -424,7 +425,7 @@ export const wirePresentation: WirePresentation = Object.freeze({
|
|
|
424
425
|
function authGroup(service: AuthService, description: string, loginDescription: string, auth: Auth, readInput: TextInputReader | undefined, options: WireRootOptions): Group {
|
|
425
426
|
const login = async (paste: boolean | undefined) => {
|
|
426
427
|
if (paste === true && !options.allowPaste) throw new UserError("Cookie paste is CLI-only.");
|
|
427
|
-
return paste === true ? auth.pasteCookies(service, await readInput!()) : service === "ashby" ? auth.extractAshby() : service === "asana" ? auth.extractAsana() : service === "chatgpt" ? auth.extractChatgpt() : service === "codesignal" ? auth.extractCodeSignal() : service === "gmail" ? auth.extractGmail() : service === "google-docs" ? auth.extractGoogleDocs() : service === "notion" ? auth.extractNotion() : service === "slack" ? auth.extractSlack() : auth.extractZoom();
|
|
428
|
+
return paste === true ? auth.pasteCookies(service, await readInput!()) : service === "ashby" ? auth.extractAshby() : service === "asana" ? auth.extractAsana() : service === "chatgpt" ? auth.extractChatgpt() : service === "claude" ? auth.extractClaude() : service === "codesignal" ? auth.extractCodeSignal() : service === "gmail" ? auth.extractGmail() : service === "google-docs" ? auth.extractGoogleDocs() : service === "notion" ? auth.extractNotion() : service === "slack" ? auth.extractSlack() : auth.extractZoom();
|
|
428
429
|
};
|
|
429
430
|
const title = serviceTitle(service);
|
|
430
431
|
return defineGroup({ name: service, description, children: [
|
|
@@ -518,6 +519,11 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
|
|
|
518
519
|
const authCommand = (service: (typeof authServices)[number]) => {
|
|
519
520
|
const title = serviceTitle(service);
|
|
520
521
|
const group = authGroup(service, `Manage ${title} login.`, "Capture cookies once; normal commands reuse saved cookies.", auth!, readInput, options);
|
|
522
|
+
if (service === "claude" && options.scrapeClaude) return defineGroup({ ...group, description: "Archive Claude.ai conversations and manage a separate login.", children: [...group.children,
|
|
523
|
+
defineCommand({ name: "scrape", description: "Save active and archived conversations from all your Claude chat workspaces into ./claude using your saved Wire login.", scope: ["cli"], params: S.Object({}),
|
|
524
|
+
handler: () => userFacing(options.scrapeClaude!), render: render<string>(v => v),
|
|
525
|
+
}),
|
|
526
|
+
] });
|
|
521
527
|
if (service === "codesignal" && options.codeSignalEdit && options.codeSignalRun) return defineGroup({ ...group,
|
|
522
528
|
description: "Read, edit, and run live interview code, and manage login.", children: [...group.children,
|
|
523
529
|
defineCommand({ name: "edit", description: "Replace a file in the current filesystem coding question from a local UTF-8 file.", positional: ["url", "path"],
|
|
@@ -724,11 +730,6 @@ export function createRoot(wire: Wire, currentDirectory: string, auth?: Auth, re
|
|
|
724
730
|
scope: ["cli", "mcp", "sdk"],
|
|
725
731
|
children: [
|
|
726
732
|
defaultAttach,
|
|
727
|
-
...(options.scrapeClaude ? [defineGroup({ name: "claude", description: "Archive Claude.ai conversations.", scope: ["cli"], children: [
|
|
728
|
-
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({}),
|
|
729
|
-
handler: () => userFacing(options.scrapeClaude!), render: render<string>(v => v),
|
|
730
|
-
}),
|
|
731
|
-
] })] : []),
|
|
732
733
|
...(options.scrapeDrive ? [defineGroup({ name: "gdrive", description: "Download Google Drive folders and spreadsheets.", scope: ["cli"], children: [
|
|
733
734
|
...(options.previewDrive ? [defineCommand({ name: "preview", description: "List a Drive folder or read a file without saving it.", scope: ["cli"], positional: ["url"],
|
|
734
735
|
params: S.Object({ url: S.String({description: "Google Drive folder or file URL."}) }),
|
package/src/auth.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { parsePastedCookieMetadata, parsePastedCookies, type ChromeCookieExtraction, type ChromeCookieResult, type Cookie, type NodeEnvironment, type RuntimeCapabilities } from "wire-core";
|
|
2
2
|
|
|
3
|
+
import { claudeSession } from "./adapters/claude.js";
|
|
3
4
|
import { verifyCodeSignal } from "./adapters/codesignal.js";
|
|
4
5
|
import { ashbySession } from "./adapters/ashby.js";
|
|
5
6
|
|
|
6
|
-
export type AuthService = "ashby" | "asana" | "chatgpt" | "codesignal" | "gmail" | "google-docs" | "notion" | "slack" | "zoom";
|
|
7
|
+
export type AuthService = "ashby" | "asana" | "chatgpt" | "claude" | "codesignal" | "gmail" | "google-docs" | "notion" | "slack" | "zoom";
|
|
7
8
|
export type CookieAuthService = AuthService;
|
|
8
9
|
|
|
9
10
|
export interface AuthResult {
|
|
@@ -232,6 +233,7 @@ export interface Auth {
|
|
|
232
233
|
readonly logout: (service: AuthService) => Promise<{ readonly service: AuthService; readonly deleted: true }>;
|
|
233
234
|
readonly extractAshby: () => Promise<AuthResult>;
|
|
234
235
|
readonly extractAsana: () => Promise<AuthResult>;
|
|
236
|
+
readonly extractClaude: () => Promise<AuthResult>;
|
|
235
237
|
readonly extractChatgpt: () => Promise<AuthResult>;
|
|
236
238
|
readonly extractCodeSignal: () => Promise<AuthResult>;
|
|
237
239
|
readonly extractGmail: () => Promise<AuthResult>;
|
|
@@ -244,8 +246,12 @@ export interface Auth {
|
|
|
244
246
|
export type CookieExtractor = (environment: NodeEnvironment, extraction: ChromeCookieExtraction) => Promise<ChromeCookieResult>;
|
|
245
247
|
|
|
246
248
|
export function composeAuth(runtime: RuntimeCapabilities, environment: NodeEnvironment, extractCookies: CookieExtractor): Auth {
|
|
247
|
-
const cookieDomains: Readonly<Record<AuthService, string>> = Object.freeze({ ashby: ".ashbyhq.com", asana: ".asana.com", chatgpt: ".chatgpt.com", codesignal: ".codesignal.com", gmail: ".google.com", "google-docs": ".google.com", notion: ".notion.so", slack: ".slack.com", zoom: ".zoom.us" });
|
|
248
|
-
const verifyCookies = (service: AuthService, cookies: readonly Cookie[], metadata: Readonly<Record<string, string>>) => service === "
|
|
249
|
+
const cookieDomains: Readonly<Record<AuthService, string>> = Object.freeze({ ashby: ".ashbyhq.com", asana: ".asana.com", chatgpt: ".chatgpt.com", claude: ".claude.ai", codesignal: ".codesignal.com", gmail: ".google.com", "google-docs": ".google.com", notion: ".notion.so", slack: ".slack.com", zoom: ".zoom.us" });
|
|
250
|
+
const verifyCookies = (service: AuthService, cookies: readonly Cookie[], metadata: Readonly<Record<string, string>>) => service === "claude" ? claudeSession(runtime.process, cookies, `${environment["HOME"]}/.wire/auth`, async get => {
|
|
251
|
+
const [organizations] = await get<{uuid: string; name: string; capabilities: string[]}[]>(["/api/organizations"]);
|
|
252
|
+
const workspaces = organizations!.filter(org => org.capabilities.includes("chat")).map(org => ({id: org.uuid, name: org.name}));
|
|
253
|
+
return workspaces.length ? { service, identity: { workspaces } } : null;
|
|
254
|
+
}) : service === "codesignal" ? (metadata.token ? verifyCodeSignal(metadata.token) : null) : 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);
|
|
249
255
|
const verifyCookieState = async (service: AuthService, cookies: readonly Cookie[], metadata: Readonly<Record<string, string>>) => {
|
|
250
256
|
if (service === "zoom") return verifyZoomCookieState(runtime, cookies, metadata);
|
|
251
257
|
return Object.freeze({ result: await verifyCookies(service, cookies, metadata), cookies, metadata, changed: false });
|
|
@@ -293,6 +299,7 @@ export function composeAuth(runtime: RuntimeCapabilities, environment: NodeEnvir
|
|
|
293
299
|
},
|
|
294
300
|
extractAshby: () => extract("ashby", "https://app.ashbyhq.com/", ["ashbyhq.com"], values => values.length > 0),
|
|
295
301
|
extractAsana: () => extract("asana", "https://app.asana.com/", ["asana.com"], (values) => values.some((cookie) => cookie.domain === ".asana.com" || cookie.domain.endsWith(".asana.com"))),
|
|
302
|
+
extractClaude: () => extract("claude", "https://claude.ai/login", ["claude.ai"], requiredReady(["sessionKey"]), `(() => location.origin === "https://claude.ai" && location.pathname === "/new" ? { url: location.href } : {})()`),
|
|
296
303
|
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),
|
|
297
304
|
extractCodeSignal: () => extract("codesignal", "https://app.codesignal.com/", ["codesignal.com"], () => true, `(() => { const token = location.origin === "https://app.codesignal.com" && localStorage.getItem("Meteor.loginToken"); return token ? {token} : {}; })()`),
|
|
298
305
|
extractGmail: () => extract("gmail", "https://mail.google.com/mail/u/0/", ["google.com"], googleReady),
|
package/src/cli.ts
CHANGED
|
@@ -126,7 +126,7 @@ const fixedCommandPositionals = Object.freeze({
|
|
|
126
126
|
"sync-all": Object.freeze({ expected: 0, name: "" }),
|
|
127
127
|
watch: Object.freeze({ expected: 1, name: "file" }),
|
|
128
128
|
});
|
|
129
|
-
const authServices = new Set(["ashby", "asana", "chatgpt", "codesignal", "gmail", "google-docs", "notion", "slack", "zoom"]);
|
|
129
|
+
const authServices = new Set(["ashby", "asana", "chatgpt", "claude", "codesignal", "gmail", "google-docs", "notion", "slack", "zoom"]);
|
|
130
130
|
const slackResourceCommands = new Set(["preview", "attach", "sync"]);
|
|
131
131
|
const authCommands = new Set(["login", "logout", "status"]);
|
|
132
132
|
const removedCommandNames = Object.freeze({
|
|
@@ -310,7 +310,7 @@ function renderRemovedCommand(argv: readonly string[]): boolean {
|
|
|
310
310
|
function renderUnknownAuthCommand(argv: readonly string[]): boolean {
|
|
311
311
|
if (hasRootSeparator(argv)) return false;
|
|
312
312
|
const words = positionalWords(argv);
|
|
313
|
-
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] === "codesignal" && ["edit", "run"].includes(words[1]!)) || (words[0] === "notion" && words[1] === "search") || (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;
|
|
313
|
+
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] === "codesignal" && ["edit", "run"].includes(words[1]!)) || (words[0] === "notion" && words[1] === "search") || (words[0] === "google-docs" && words[1] === "comments") || ((words[0] === "zoom" || words[0] === "claude") && 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;
|
|
314
314
|
renderCliError(argv, `Unknown command: ${words[1]}`, `wire ${words[0]} --help`, `Unknown command: ${cliValue(words[1]!)}`);
|
|
315
315
|
return true;
|
|
316
316
|
}
|
package/src/executable.ts
CHANGED
|
@@ -150,7 +150,7 @@ export function createExecutableRoot(environment: NodeEnvironment, currentDirect
|
|
|
150
150
|
switchBackend: baseWire.switchBackend,
|
|
151
151
|
});
|
|
152
152
|
const wire = withWireHooks(configuredWire, { currentDirectory, home, environment: configuredEnvironment() });
|
|
153
|
-
return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, searchNotion: (query, searchOptions) => searchNotion(runtime, query, searchOptions), codeSignalEdit: async (url,path,file) => editCodeSignal(runtime,url,path,await filesystem.readText(resolve(currentDirectory,file))), codeSignalRun: url => runCodeSignal(runtime,url), shareNotionWithOrg: id => shareNotionWithOrg(runtime, id), scrapeClaude: () => scrapeClaude(
|
|
153
|
+
return createRoot(wire, currentDirectory, auth, readStandardInput, { ...options, searchNotion: (query, searchOptions) => searchNotion(runtime, query, searchOptions), codeSignalEdit: async (url,path,file) => editCodeSignal(runtime,url,path,await filesystem.readText(resolve(currentDirectory,file))), codeSignalRun: url => runCodeSignal(runtime,url), shareNotionWithOrg: id => shareNotionWithOrg(runtime, id), scrapeClaude: () => scrapeClaude(runtime, 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), {
|
|
154
154
|
lookup: (query) => lookupAsanaUsers(runtime, query), projects: () => listAsanaProjects(runtime), project: (project) => showAsanaProject(runtime, project), tasks: (project) => listAsanaTasks(runtime, project), show: (task) => showAsanaTask(runtime, task),
|
|
155
155
|
writes: { depend: (task, dependency) => addAsanaDependency(runtime, task, dependency), 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) },
|
|
156
156
|
}, async () => {
|