mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-07 06:48:37 +02:00
test: export downloadFile, parsePdfFromFile, extractCwdFromJsonl
These three internal helpers are now imported by regression tests landing in the next commits (PR #1169 follow-up). Pattern matches the existing normalizeRemoteUrl export in gstack-global-discover.ts which test/global-discover.test.ts already imports side-effect-free. No change to runtime behavior; gstack has no public package entrypoint that would re-export these, so the in-repo surface is unchanged for callers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
7dc60076ec
commit
f75f891512
@@ -273,7 +273,7 @@ function resolveClaudeCodeCwd(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractCwdFromJsonl(filePath: string): string | null {
|
export function extractCwdFromJsonl(filePath: string): string | null {
|
||||||
// Read a capped prefix so huge JSONL files don't blow up memory. 64KB
|
// Read a capped prefix so huge JSONL files don't blow up memory. 64KB
|
||||||
// comfortably fits the largest observed session headers; the old 8KB cap
|
// comfortably fits the largest observed session headers; the old 8KB cap
|
||||||
// would sometimes fall inside a single long line and silently drop the
|
// would sometimes fall inside a single long line and silently drop the
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ function parsePdfArgs(args: string[]): ParsedPdfArgs {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parsePdfFromFile(payloadPath: string): ParsedPdfArgs {
|
export function parsePdfFromFile(payloadPath: string): ParsedPdfArgs {
|
||||||
// Parity with load-html --from-file (browse/src/write-commands.ts) and
|
// Parity with load-html --from-file (browse/src/write-commands.ts) and
|
||||||
// the direct load-html <file> path: every caller-supplied file path
|
// the direct load-html <file> path: every caller-supplied file path
|
||||||
// must pass validateReadPath so the safe-dirs policy can't be skirted
|
// must pass validateReadPath so the safe-dirs policy can't be skirted
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export function getClassifierStatus(): ClassifierStatus {
|
|||||||
|
|
||||||
// ─── Model download + staging ────────────────────────────────
|
// ─── Model download + staging ────────────────────────────────
|
||||||
|
|
||||||
async function downloadFile(url: string, dest: string): Promise<void> {
|
export async function downloadFile(url: string, dest: string): Promise<void> {
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
if (!res.ok || !res.body) {
|
if (!res.ok || !res.body) {
|
||||||
throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
|
throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user