()
| 92 | } |
| 93 | |
| 94 | function parseArgs(): { |
| 95 | urls: string[]; |
| 96 | stdio: boolean; |
| 97 | useClientRoots: boolean; |
| 98 | enableInteract: boolean; |
| 99 | debug: boolean; |
| 100 | } { |
| 101 | const args = process.argv.slice(2); |
| 102 | const urls: string[] = []; |
| 103 | let stdio = false; |
| 104 | let useClientRoots = false; |
| 105 | let enableInteract = false; |
| 106 | let debug = false; |
| 107 | |
| 108 | for (const arg of args) { |
| 109 | if (arg === "--stdio") { |
| 110 | stdio = true; |
| 111 | } else if (arg === "--use-client-roots") { |
| 112 | useClientRoots = true; |
| 113 | } else if (arg === "--enable-interact") { |
| 114 | // Force-enable interact for HTTP mode. Only use when running a |
| 115 | // single long-lived server process (e.g. the e2e test harness) — |
| 116 | // the command queue is in-memory per-process, so stateless |
| 117 | // multi-instance deployments will drop commands. |
| 118 | enableInteract = true; |
| 119 | } else if (arg === "--debug") { |
| 120 | debug = true; |
| 121 | } else if (arg === "--writeable-uploads-root") { |
| 122 | // Claude Desktop mounts attachments under a dir root named "uploads"; |
| 123 | // by default we refuse to write there. This flag opts back in. |
| 124 | writeFlags.allowUploadsRoot = true; |
| 125 | } else if (!arg.startsWith("-")) { |
| 126 | // Convert local paths to file:// URLs, normalize arxiv URLs |
| 127 | let url = arg; |
| 128 | if ( |
| 129 | !arg.startsWith("http://") && |
| 130 | !arg.startsWith("https://") && |
| 131 | !arg.startsWith("file://") |
| 132 | ) { |
| 133 | url = pathToFileUrl(arg); |
| 134 | } else if (isArxivUrl(arg)) { |
| 135 | url = normalizeArxivUrl(arg); |
| 136 | } |
| 137 | urls.push(url); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | return { |
| 142 | urls: urls.length > 0 ? urls : [DEFAULT_PDF], |
| 143 | stdio, |
| 144 | useClientRoots, |
| 145 | enableInteract, |
| 146 | debug, |
| 147 | }; |
| 148 | } |
| 149 | |
| 150 | async function main() { |
| 151 | const { urls, stdio, useClientRoots, enableInteract, debug } = parseArgs(); |
no test coverage detected
searching dependent graphs…