@nshiab/setup-data-project 4.0.16 → 4.0.18
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 +5 -5
- package/dist/main.mjs +51 -17
- package/dist/main.mjs.map +1 -1
- package/dist/preview.mjs +124 -0
- package/dist/preview.mjs.map +1 -0
- package/dist/sda.mjs +376 -107
- package/dist/sda.mjs.map +1 -1
- package/package.json +2 -1
package/dist/sda.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sda.mjs","names":["errorCode","delay","errorCode","delay"],"sources":["../src/helpers/sdaLock.ts","../src/helpers/sdaStatus.ts","../src/helpers/pipeFixOutput.ts","../src/helpers/fileChanges.ts","../src/sda.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n realpathSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { isObject } from \"./jsonObject.ts\";\n\nexport const SDA_LOCK_DIRECTORY = \".sda-cache/lock\";\n\ntype Claim = { id: string; pid: number; ticket: number; command?: string };\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\n// Bakery ordering: publish a unique claim before choosing a ticket, then wait for\n// concurrent ticket choices. Never replace/delete a shared lock during recovery.\n// https://www.microsoft.com/en-us/research/publication/new-solution-dijkstras-concurrent-programming-problem/\nexport async function acquireSdaLock(command: string): Promise<() => void> {\n const directory = resolve(SDA_LOCK_DIRECTORY);\n const id = `${process.pid}-${randomUUID()}`;\n const ownDirectory = join(directory, id);\n mkdirSync(directory, { recursive: true });\n mkdirSync(ownDirectory);\n const release = () => {\n rmSync(ownDirectory, { recursive: true, force: true });\n process.removeListener(\"exit\", release);\n };\n process.once(\"exit\", release);\n\n function readClaim(candidate: string): Claim | undefined {\n const match = /^(\\d+)-[\\da-f-]{36}$/.exec(candidate);\n if (!match) return;\n const pid = Number(match[1]);\n if (!Number.isInteger(pid) || pid <= 0 || pid > 2147483647) return;\n const path = join(directory, candidate);\n try {\n process.kill(pid, 0);\n } catch (error) {\n if (errorCode(error) !== \"ESRCH\") throw error;\n // Claim names are never reused, so another starter cannot acquire this path.\n rmSync(path, { recursive: true, force: true });\n return;\n }\n let record: unknown;\n try {\n record = JSON.parse(readFileSync(join(path, \"owner.json\"), \"utf8\"));\n } catch (error) {\n if (errorCode(error) !== \"ENOENT\") throw error;\n // A directory without a published ticket is still choosing, or has exited.\n return existsSync(path) ? { id: candidate, pid, ticket: 0 } : undefined;\n }\n if (\n !isObject(record) ||\n typeof record.ticket !== \"number\" ||\n !Number.isSafeInteger(record.ticket) ||\n record.ticket < 1 ||\n typeof record.command !== \"string\"\n )\n throw new Error(`Cannot read the SDA lock owned by process ${pid}.`);\n return { id: candidate, pid, ticket: record.ticket, command: record.command };\n }\n\n try {\n let ticket = 1;\n for (const candidate of readdirSync(directory)) {\n const claim = readClaim(candidate);\n if (claim) ticket = Math.max(ticket, claim.ticket + 1);\n }\n writeFileSync(\n join(ownDirectory, \"owner.tmp\"),\n JSON.stringify({ ticket, command, projectRoot: realpathSync(process.cwd()) }),\n );\n renameSync(join(ownDirectory, \"owner.tmp\"), join(ownDirectory, \"owner.json\"));\n const deadline = performance.now() + 5000;\n for (const candidate of readdirSync(directory)) {\n if (candidate === id) continue;\n let claim = readClaim(candidate);\n while (claim?.ticket === 0) {\n if (performance.now() >= deadline)\n throw new Error(\n `Another SDA command is still starting (PID ${claim.pid}). Wait for it to finish starting, then try again.`,\n );\n await delay(10);\n claim = readClaim(candidate);\n }\n if (claim && (claim.ticket < ticket || (claim.ticket === ticket && claim.id < id)))\n throw new Error(\n `${claim.command} is already running${claim.command?.endsWith(\"sda:watch\") ? \" and watching this project's files\" : \" an analysis for this project\"} (PID ${claim.pid}). Wait for it to finish or stop it with Ctrl+C in its terminal, then try again.`,\n );\n }\n return release;\n } catch (error) {\n release();\n throw error;\n }\n}\n","import { execFileSync } from \"node:child_process\";\nimport { readFileSync, readdirSync, realpathSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { isObject } from \"./jsonObject.ts\";\nimport { SDA_LOCK_DIRECTORY } from \"./sdaLock.ts\";\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\n// Status is read-only: a missing or dead owner is ignored, never removed.\nexport function printSdaStatus(): number {\n const run = `${process.versions.bun ? \"bun\" : \"npm\"} run`;\n const retry = `${run} sda:status`;\n try {\n const claims = new Map<number, string[]>();\n try {\n for (const name of readdirSync(SDA_LOCK_DIRECTORY)) {\n const match = /^(\\d+)-[\\da-f-]{36}$/.exec(name);\n if (match) {\n const pid = Number(match[1]);\n claims.set(pid, [...(claims.get(pid) ?? []), name]);\n }\n }\n } catch (error) {\n if (errorCode(error) !== \"ENOENT\") throw error;\n }\n const messages: string[] = [];\n for (const [pid, owners] of claims) {\n if (!Number.isInteger(pid) || pid <= 0 || pid > 2147483647)\n throw new Error(\"The recorded SDA PID is invalid.\");\n try {\n process.kill(pid, 0);\n } catch (error) {\n if (errorCode(error) === \"ESRCH\") continue;\n throw error;\n }\n let command: string;\n if (process.platform === \"win32\") {\n if (owners.length !== 1) throw new Error(`PID ${pid} has no unambiguous SDA owner record.`);\n const owner: unknown = JSON.parse(\n readFileSync(join(SDA_LOCK_DIRECTORY, owners[0], \"owner.json\"), \"utf8\"),\n );\n // WMI has no readable cwd. This is the claim's recorded project association,\n // not proof of the live process's cwd or protection against PID reuse.\n if (\n !isObject(owner) ||\n typeof owner.projectRoot !== \"string\" ||\n realpathSync(owner.projectRoot) !== realpathSync(process.cwd())\n )\n throw new Error(`PID ${pid} could not be verified as this project's SDA process.`);\n const result: unknown = JSON.parse(\n execFileSync(\n \"powershell.exe\",\n [\n \"-NoLogo\",\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false); \" +\n `(Get-CimInstance Win32_Process -Filter 'ProcessId = ${pid}' -ErrorAction Stop).CommandLine | ConvertTo-Json -Compress`,\n ],\n {\n encoding: \"utf8\",\n // A cold PowerShell/CIM startup can exceed five seconds on Windows.\n timeout: 10000,\n maxBuffer: 64 * 1024,\n windowsHide: true,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n ),\n );\n if (typeof result !== \"string\" || !result.trim())\n throw new Error(`PID ${pid} has no readable command line.`);\n command = result;\n } else if (process.platform === \"darwin\" || process.platform === \"linux\") {\n command = execFileSync(\"ps\", [\"-p\", String(pid), \"-o\", \"command=\"], {\n encoding: \"utf8\",\n timeout: 5000,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n }).trim();\n const cwd =\n process.platform === \"linux\"\n ? realpathSync(`/proc/${pid}/cwd`)\n : execFileSync(\"lsof\", [\"-a\", \"-p\", String(pid), \"-d\", \"cwd\", \"-Fn\"], {\n encoding: \"utf8\",\n timeout: 5000,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n })\n .split(\"\\n\")\n .find((line) => line.startsWith(\"n\"))\n ?.slice(1);\n if (!cwd || realpathSync(cwd) !== realpathSync(process.cwd()))\n throw new Error(`PID ${pid} could not be verified as this project's SDA process.`);\n } else {\n throw new Error(\"Active SDA processes cannot be verified on this platform.\");\n }\n const executable = process.argv[1];\n if (\n !executable ||\n (!command.includes(executable) &&\n !command.includes(realpathSync(executable)) &&\n !/(?:[\\\\/]@nshiab[\\\\/]setup-data-project[\\\\/]dist[\\\\/]sda\\.mjs|[\\\\/]node_modules[\\\\/]\\.bin[\\\\/]sda-run)(?:[\"\\s]|$)/.test(\n command,\n ))\n )\n throw new Error(`PID ${pid} could not be verified as this project's SDA process.`);\n messages.push(\n /(?:^|[\"\\s])--watch(?:[\"\\s]|$)/.test(command)\n ? `SDA watcher is running (${run} sda:watch, PID ${pid}). It automatically fixes files and reruns the analysis. If you are an agent, ask the user to stop it with Ctrl+C, then recheck with ${retry} before doing any work.`\n : `SDA analysis is running (${run} sda, PID ${pid}). Wait for it to finish. Recheck with ${retry} in 30 seconds before doing any work.`,\n );\n }\n for (const message of messages) console.log(message);\n if (messages.length) return 1;\n console.log(\"No active SDA process found. You can proceed.\");\n return 0;\n } catch (error) {\n console.error(\n `Unable to verify SDA status: ${error instanceof Error ? error.message : String(error)} If you are an agent, ask the user to confirm that neither ${run} sda nor ${run} sda:watch is running and that you may proceed, then wait for their confirmation before doing any work.`,\n );\n return 2;\n }\n}\n","import { createInterface } from \"node:readline\";\nimport type { Readable } from \"node:stream\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nexport function pipeFixOutput(output: Readable) {\n const lines = createInterface({ input: output, crlfDelay: Infinity });\n lines.on(\"line\", (line: string) => {\n const plain = stripVTControlCharacters(line);\n if (plain === \"Found 0 warnings and 0 errors.\") return;\n const timing = plain.match(\n /^Finished in ([\\d.]+)(ms|s) on \\d+ files?( with \\d+ rules)? using \\d+ threads?\\.$/,\n );\n if (timing) {\n const label = timing[3] ? \"Linting and type checking\" : \"Formatting\";\n console.log(styleText(\"blue\", `${label}: ${timing[1]} ${timing[2]}`));\n } else {\n // Forward diagnostics and unfamiliar output unchanged, including custom fix scripts.\n console.log(line);\n }\n });\n}\n","import { lstatSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\ntype Entry = { value: string | null; generation: number };\n// Reconcile the selected tree into one metadata index. Always start at the\n// selected roots: event paths can be incomplete or stale after a directory move.\nexport function createFileChanges(selected: string[], excluded: (path: string) => boolean) {\n const files = new Map<string, Entry>();\n let generation = 0;\n\n function check() {\n generation++;\n let changed = false;\n\n function update(path: string, value: string | null) {\n const previous = files.get(path);\n if (previous) {\n if (previous.value !== value) {\n previous.value = value;\n changed = true;\n }\n previous.generation = generation;\n } else {\n files.set(path, { value, generation });\n changed = true;\n }\n }\n\n function collect(path: string) {\n if (excluded(path) || files.get(path)?.generation === generation) return;\n try {\n const stat = lstatSync(path, { bigint: true });\n if (stat.isDirectory()) {\n const names = readdirSync(path);\n update(path, \"directory\");\n for (const name of names) collect(join(path, name));\n } else {\n update(path, [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(\":\"));\n }\n } catch (error) {\n if (\n !(error instanceof Error) ||\n !(\"code\" in error) ||\n (error.code !== \"ENOENT\" && error.code !== \"ENOTDIR\")\n )\n throw error;\n update(path, null);\n }\n }\n\n for (const path of selected) collect(path);\n // Remove entries not visited in this check without allocating a second map.\n for (const [path, entry] of files) {\n if (entry.generation !== generation) {\n files.delete(path);\n changed = true;\n }\n }\n return changed;\n }\n\n return { check };\n}\n","#!/usr/bin/env node\nimport { existsSync, lstatSync, type FSWatcher, readdirSync, rmSync, watch } from \"node:fs\";\nimport { spawn, spawnSync, type ChildProcess } from \"node:child_process\";\nimport { dirname, join, resolve, sep } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { parseArgs } from \"node:util\";\nimport { acquireSdaLock, SDA_LOCK_DIRECTORY } from \"./helpers/sdaLock.ts\";\nimport { printSdaStatus } from \"./helpers/sdaStatus.ts\";\nimport { pipeFixOutput } from \"./helpers/pipeFixOutput.ts\";\nimport { createFileChanges } from \"./helpers/fileChanges.ts\";\n\nconst {\n positionals: [entry, ...paths],\n values,\n} = parseArgs({\n allowPositionals: true,\n options: {\n clean: { type: \"boolean\", default: false },\n status: { type: \"boolean\", default: false },\n watch: { type: \"boolean\", default: false },\n \"watch-test\": { type: \"boolean\", default: false },\n ignore: { type: \"string\", multiple: true, default: [] },\n },\n});\nif (values.clean) {\n if (entry || values.status || values.watch || values[\"watch-test\"] || values.ignore.length) {\n console.error(\"Usage: sda-run --clean (without other options or paths)\");\n process.exit(1);\n }\n try {\n for (const path of [\".sda-cache\", \".journalism-cache\", \".tmp\"]) {\n if (path === \".sda-cache\") {\n const stat = lstatSync(path, { throwIfNoEntry: false });\n if (!stat) continue;\n if (!stat.isDirectory()) {\n rmSync(path, { force: true });\n continue;\n }\n // Keep the lock and its parent stable, including during concurrent starts.\n for (const name of readdirSync(path)) {\n const child = join(path, name);\n if (resolve(child) !== resolve(SDA_LOCK_DIRECTORY))\n rmSync(child, { recursive: true, force: true });\n }\n continue;\n }\n rmSync(path, { recursive: true, force: true });\n }\n } catch (error) {\n console.error(\"Could not clean caches: \" + errorMessage(error));\n process.exit(1);\n }\n process.exit(0);\n}\nif (values.status) process.exit(printSdaStatus());\nif (!entry) {\n console.error(\n \"Usage: sda-run --clean | --status | [--watch] <entry-file> [watch-paths...] [--ignore path] | --watch-test <watch-paths...> [--ignore path]\",\n );\n process.exit(1);\n}\nconst watchingTests = values[\"watch-test\"];\nconst watching = values.watch || watchingTests;\nconst selected = [entry, ...paths].map((path) => resolve(path));\nconst ignored = [SDA_LOCK_DIRECTORY, ...values.ignore].map((path) => resolve(path));\nconst within = (path: string, root: string) => path === root || path.startsWith(root + sep);\nconst excluded = (path: string) => ignored.some((root) => within(path, root));\nconst bun = Boolean(process.versions.bun);\nconst runCommand =\n (bun ? \"bun run \" : \"npm run \") +\n (watchingTests ? \"sda:test:watch\" : watching ? \"sda:watch\" : \"sda\");\nconst windows = process.platform === \"win32\";\ntype Job = { child: ChildProcess; done: Promise<number | null> };\nlet releaseLock: (() => void) | undefined;\nlet fixer: Job | undefined;\nlet running: Job | undefined;\nlet timer: ReturnType<typeof setTimeout> | undefined;\nlet checking = false;\nlet closing = false;\nlet needsCheck = true;\nconst changes = createFileChanges(selected, excluded);\nconst watchers = new Map<string, { watcher: FSWatcher; recursive: boolean }>();\n\nfunction launch(args: string[], command = process.execPath, summarize = false) {\n const child = spawn(command, args, {\n // Bun's Windows --bun shim is named node.exe; keep Bun CLI argument parsing.\n argv0: windows && bun && command === process.execPath ? \"bun\" : undefined,\n stdio: [\"inherit\", summarize ? \"pipe\" : \"inherit\", \"inherit\"],\n detached: !windows,\n shell: windows && command === \"npm.cmd\",\n });\n if (summarize && child.stdout) {\n const output = child.stdout;\n pipeFixOutput(output);\n child.once(\"exit\", () => {\n // Background descendants can inherit stdout; don't wait forever for their pipe to close.\n const timeout = setTimeout(() => output.destroy(), 1000);\n child.once(\"close\", () => clearTimeout(timeout));\n });\n }\n const done = new Promise<number | null>((resolve) => {\n child.once(\"error\", (error) => {\n console.error(errorMessage(error));\n resolve(1);\n });\n child.once(\"close\", resolve);\n });\n return { child, done };\n}\n\nfunction launchScript(script: string, summarize = false) {\n return launch(\n [\"run\", \"--silent\", script],\n bun ? process.execPath : windows ? \"npm.cmd\" : \"npm\",\n summarize,\n );\n}\n\nfunction announceWatchRun(message: string) {\n if (process.stdout.isTTY) process.stdout.write(\"\\u001b[2J\\u001b[H\");\n console.log(`Watching SDA for changes...\\n\\n${message}`);\n}\n\nfunction watchJob(job: Job, label: string, success: string) {\n running = job;\n void job.done.then((result) => {\n if (closing || checking || running !== job) return;\n const outcome =\n result === 0 ? success : result === null ? \"stopped\" : `failed (exit code ${result})`;\n console.log(`\\n${label} ${outcome}. Waiting for changes...`);\n });\n}\n\nfunction refreshWatchers() {\n const directories = new Map<string, boolean>();\n const add = (directory: string, recursive: boolean) => {\n directories.set(directory, recursive || directories.get(directory) || false);\n };\n for (const path of selected) {\n if (excluded(path)) continue;\n if (lstatSync(path, { throwIfNoEntry: false })?.isDirectory()) add(path, true);\n // Watch the parent too, so deleted files and folders can be restored.\n let parent = dirname(path);\n while (!existsSync(parent)) parent = dirname(parent);\n add(parent, parent !== dirname(path));\n }\n for (const [directory, state] of watchers) {\n if (directories.get(directory) !== state.recursive) {\n state.watcher.close();\n watchers.delete(directory);\n }\n }\n for (const [directory, recursive] of directories) {\n if (watchers.has(directory)) continue;\n const watcher = watch(directory, { recursive }, (_event, name) => {\n if (checking || closing) return;\n const changed = name && resolve(directory, name.toString());\n if (\n !changed ||\n (!excluded(changed) &&\n selected.some((path) => within(changed, path) || within(path, changed)))\n )\n schedule();\n });\n watcher.on(\"error\", fail);\n watchers.set(directory, { watcher, recursive });\n }\n}\n\nasync function stop(job: Job | undefined) {\n if (!job?.child.pid) return;\n const pid = job.child.pid;\n if (windows) {\n if (job.child.exitCode === null && job.child.signalCode === null) {\n spawnSync(\"taskkill\", [\"/pid\", String(job.child.pid), \"/T\", \"/F\"], { stdio: \"ignore\" });\n }\n await job.done;\n return;\n }\n const signal = (name: NodeJS.Signals | 0) => {\n try {\n process.kill(-pid, name);\n return true;\n } catch (error) {\n if (errorCode(error) !== \"ESRCH\") throw error;\n return false;\n }\n };\n signal(\"SIGTERM\");\n // The direct child can exit first; retain the grace period for its entire process group.\n const deadline = performance.now() + 1000;\n while (signal(0)) {\n if (performance.now() >= deadline) {\n signal(\"SIGKILL\");\n break;\n }\n await delay(25);\n }\n await job.done;\n}\n\nasync function check() {\n if (closing || checking) return;\n const changed = changes.check();\n if (!needsCheck && !changed) return;\n checking = true;\n needsCheck = false;\n await stop(running);\n running = undefined;\n if (closing) return;\n refreshWatchers();\n if (watchingTests) {\n // A fresh run sees edits made while the previous process was stopping.\n changes.check();\n announceWatchRun(\"Running SDA checks and tests...\");\n watchJob(launchScript(\"sda:test\"), \"SDA checks and tests\", \"passed\");\n checking = false;\n return;\n }\n announceWatchRun(\"Running SDA checks and analysis...\");\n fixer = launchScript(\"sda:fix\", true);\n const fixed = await fixer.done;\n if (closing) return;\n // Recheck edits made during fixes; ignore delayed events for unchanged file states.\n needsCheck = changes.check();\n refreshWatchers();\n fixer = undefined;\n checking = false;\n if (needsCheck) {\n schedule();\n } else if (fixed === 0) {\n console.log();\n watchJob(\n launch(bun ? [\"run\", entry] : [\"--env-file=.env\", entry]),\n \"SDA analysis\",\n \"completed\",\n );\n } else {\n console.log(\"Fix failed. Waiting for changes...\");\n }\n}\n\nfunction schedule() {\n clearTimeout(timer);\n timer = setTimeout(() => check().catch(fail), 0);\n}\n\nasync function shutdown(code: number) {\n if (closing) return;\n closing = true;\n clearTimeout(timer);\n for (const { watcher } of watchers.values()) watcher.close();\n await Promise.all([stop(fixer), stop(running)]);\n releaseLock?.();\n process.exit(code);\n}\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\nfunction errorMessage(error: unknown) {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction fail(error: unknown) {\n console.error(errorMessage(error));\n void shutdown(1);\n}\n\nprocess.on(\"SIGINT\", () => void shutdown(0));\nprocess.on(\"SIGTERM\", () => void shutdown(0));\n\nasync function runOnce() {\n fixer = launchScript(\"sda:fix\", true);\n const fixed = await fixer.done;\n if (closing) return;\n if (fixed !== 0) {\n await shutdown(fixed ?? 1);\n return;\n }\n await stop(fixer);\n fixer = undefined;\n if (closing) return;\n console.log();\n running = launch(bun ? [\"run\", entry] : [\"--env-file=.env\", entry]);\n const result = await running.done;\n await shutdown(result ?? 1);\n}\n\ntry {\n if (!watchingTests) releaseLock = await acquireSdaLock(runCommand);\n if (closing) releaseLock?.();\n else if (watching) {\n refreshWatchers();\n void check().catch(fail);\n } else {\n void runOnce().catch(fail);\n }\n} catch (error) {\n fail(new Error(\"Cannot start \" + runCommand + \": \" + errorMessage(error)));\n}\n"],"mappings":";;;;;;;;;;AAeA,MAAa,qBAAqB;AAIlC,SAASA,YAAU,OAAgB;CACjC,OAAO,iBAAiB,SAAS,UAAU,QAAQ,MAAM,OAAO,KAAA;AAClE;AAKA,eAAsB,eAAe,SAAsC;CACzE,MAAM,YAAY,QAAQ,kBAAkB;CAC5C,MAAM,KAAK,GAAG,QAAQ,IAAI,GAAG,WAAW;CACxC,MAAM,eAAe,KAAK,WAAW,EAAE;CACvC,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;CACxC,UAAU,YAAY;CACtB,MAAM,gBAAgB;EACpB,OAAO,cAAc;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACrD,QAAQ,eAAe,QAAQ,OAAO;CACxC;CACA,QAAQ,KAAK,QAAQ,OAAO;CAE5B,SAAS,UAAU,WAAsC;EACvD,MAAM,QAAQ,uBAAuB,KAAK,SAAS;EAC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AAC,CAAC;AAE5C,eAAe,UAAU;CACvB,QAAQ,aAAa,WAAW,IAAI;CACpC,MAAM,QAAQ,MAAM,MAAM;CAC1B,IAAI,SAAS;CACb,IAAI,UAAU,GAAG;EACf,MAAM,SAAS,SAAS,CAAC;EACzB;CACF;CACA,MAAM,KAAK,KAAK;CAChB,QAAQ,KAAA;CACR,IAAI,SAAS;CACb,QAAQ,IAAI;CACZ,UAAU,OAAO,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,mBAAmB,KAAK,CAAC;CAElE,MAAM,SAAS,MADM,QAAQ,QACJ,CAAC;AAC5B;AAEA,IAAI;CACF,IAAI,CAAC,eAAe,cAAc,MAAM,eAAe,UAAU;CACjE,IAAI,SAAS,cAAc;MACtB,IAAI,UAAU;EACjB,gBAAgB;EAChB,MAAW,CAAC,CAAC,MAAM,IAAI;CACzB,OACE,QAAa,CAAC,CAAC,MAAM,IAAI;AAE7B,SAAS,OAAO;CACd,qBAAK,IAAI,MAAM,kBAAkB,aAAa,OAAO,aAAa,KAAK,CAAC,CAAC;AAC3E"}
|
|
1
|
+
{"version":3,"file":"sda.mjs","names":["errorCode","delay","errorCode","errorCode","delay","delay"],"sources":["../src/helpers/sdaLock.ts","../src/helpers/sdaStatus.ts","../src/helpers/pipeFixOutput.ts","../src/helpers/fileChanges.ts","../src/helpers/sdaWatchRequests.ts","../src/sda.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n realpathSync,\n renameSync,\n rmSync,\n statSync,\n utimesSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { isObject } from \"./jsonObject.ts\";\n\nexport const SDA_LOCK_DIRECTORY = \".sda-cache/lock\";\nconst watcherHeartbeatInterval = 1000;\nconst watcherHeartbeatMaxAge = 5000;\n\ntype Claim = { id: string; pid: number; ticket: number; command?: string; watchEntry?: string };\n\nexport class SdaLockBusyError extends Error {\n readonly watcher?: { directory: string; pid: number; entry: string };\n\n constructor(claim: Claim, directory: string) {\n super(\n `${claim.command} is already running${claim.command?.endsWith(\"sda:watch\") ? \" and watching this project's files\" : \" an analysis for this project\"} (PID ${claim.pid}). Wait for it to finish or stop it with Ctrl+C in its terminal, then try again.`,\n );\n if (claim.watchEntry) this.watcher = { directory, pid: claim.pid, entry: claim.watchEntry };\n }\n}\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\nexport function hasFreshWatcherHeartbeat(directory: string): boolean {\n const file = join(directory, \"owner.json\");\n try {\n const info = statSync(file, { throwIfNoEntry: false });\n if (!info || Date.now() - info.mtimeMs >= watcherHeartbeatMaxAge) return false;\n const record: unknown = JSON.parse(readFileSync(file, \"utf8\"));\n return (\n isObject(record) &&\n record.watcherReady === true &&\n typeof record.watchEntry === \"string\" &&\n record.projectRoot === realpathSync(process.cwd())\n );\n } catch (error) {\n if (errorCode(error) === \"ENOENT\") return false;\n throw error;\n }\n}\n\n// Bakery ordering: publish a unique claim before choosing a ticket, then wait for\n// concurrent ticket choices. Never replace/delete a shared lock during recovery.\n// https://www.microsoft.com/en-us/research/publication/new-solution-dijkstras-concurrent-programming-problem/\nexport async function acquireSdaLock(command: string, watchEntry?: string) {\n const directory = resolve(SDA_LOCK_DIRECTORY);\n const id = `${process.pid}-${randomUUID()}`;\n const ownDirectory = join(directory, id);\n const ownerFile = join(ownDirectory, \"owner.json\");\n let heartbeat: ReturnType<typeof setInterval> | undefined;\n mkdirSync(directory, { recursive: true });\n mkdirSync(ownDirectory);\n const release = () => {\n clearInterval(heartbeat);\n rmSync(ownDirectory, { recursive: true, force: true });\n process.removeListener(\"exit\", release);\n };\n process.once(\"exit\", release);\n\n function readClaim(candidate: string): Claim | undefined {\n const match = /^(\\d+)-[\\da-f-]{36}$/.exec(candidate);\n if (!match) return;\n const pid = Number(match[1]);\n if (!Number.isInteger(pid) || pid <= 0 || pid > 2147483647) return;\n const path = join(directory, candidate);\n try {\n process.kill(pid, 0);\n } catch (error) {\n if (errorCode(error) === \"ESRCH\") {\n // Claim names are never reused, so another starter cannot acquire this path.\n rmSync(path, { recursive: true, force: true });\n return;\n }\n // A denied PID probe leaves the claim in contention. A watcher must still\n // acknowledge any run request before the caller can wait for its result.\n if (errorCode(error) !== \"EPERM\") throw error;\n }\n let record: unknown;\n try {\n record = JSON.parse(readFileSync(join(path, \"owner.json\"), \"utf8\"));\n } catch (error) {\n if (errorCode(error) !== \"ENOENT\") throw error;\n // A directory without a published ticket is still choosing, or has exited.\n return existsSync(path) ? { id: candidate, pid, ticket: 0 } : undefined;\n }\n if (\n !isObject(record) ||\n typeof record.ticket !== \"number\" ||\n !Number.isSafeInteger(record.ticket) ||\n record.ticket < 1 ||\n typeof record.command !== \"string\"\n )\n throw new Error(`Cannot read the SDA lock owned by process ${pid}.`);\n return {\n id: candidate,\n pid,\n ticket: record.ticket,\n command: record.command,\n watchEntry: typeof record.watchEntry === \"string\" ? record.watchEntry : undefined,\n };\n }\n\n try {\n let ticket = 1;\n for (const candidate of readdirSync(directory)) {\n const claim = readClaim(candidate);\n if (claim) ticket = Math.max(ticket, claim.ticket + 1);\n }\n const record = { ticket, command, projectRoot: realpathSync(process.cwd()), watchEntry };\n function publishOwner(watcherReady?: true) {\n const temporary = join(ownDirectory, \"owner.tmp\");\n writeFileSync(temporary, JSON.stringify({ ...record, watcherReady }));\n renameSync(temporary, ownerFile);\n }\n publishOwner();\n const deadline = performance.now() + 5000;\n let owner: Claim | undefined;\n for (const candidate of readdirSync(directory)) {\n if (candidate === id) continue;\n let claim = readClaim(candidate);\n while (claim?.ticket === 0) {\n if (performance.now() >= deadline)\n throw new Error(\n `Another SDA command is still starting (PID ${claim.pid}). Wait for it to finish starting, then try again.`,\n );\n await delay(10);\n claim = readClaim(candidate);\n }\n if (claim && (claim.ticket < ticket || (claim.ticket === ticket && claim.id < id))) {\n if (\n !owner ||\n claim.ticket < owner.ticket ||\n (claim.ticket === owner.ticket && claim.id < owner.id)\n )\n owner = claim;\n }\n }\n if (owner) throw new SdaLockBusyError(owner, join(directory, owner.id));\n function startWatcherHeartbeat(onError: (error: unknown) => void) {\n publishOwner(true);\n heartbeat = setInterval(() => {\n try {\n const now = new Date();\n utimesSync(ownerFile, now, now);\n } catch (error) {\n onError(error);\n }\n }, watcherHeartbeatInterval);\n }\n return { directory: ownDirectory, release, startWatcherHeartbeat };\n } catch (error) {\n release();\n throw error;\n }\n}\n","import { execFileSync } from \"node:child_process\";\nimport { readFileSync, readdirSync, realpathSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { isObject } from \"./jsonObject.ts\";\nimport { hasFreshWatcherHeartbeat, SDA_LOCK_DIRECTORY } from \"./sdaLock.ts\";\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\nfunction readProcessCommand(pid: number, owners: string[]) {\n let command: string;\n if (process.platform === \"win32\") {\n if (owners.length !== 1) throw new Error(`PID ${pid} has no unambiguous SDA owner record.`);\n const owner: unknown = JSON.parse(\n readFileSync(join(SDA_LOCK_DIRECTORY, owners[0], \"owner.json\"), \"utf8\"),\n );\n // WMI has no readable cwd. This is the claim's recorded project association,\n // not proof of the live process's cwd or protection against PID reuse.\n if (\n !isObject(owner) ||\n typeof owner.projectRoot !== \"string\" ||\n realpathSync(owner.projectRoot) !== realpathSync(process.cwd())\n )\n throw new Error(`PID ${pid} could not be verified as this project's SDA process.`);\n const result: unknown = JSON.parse(\n execFileSync(\n \"powershell.exe\",\n [\n \"-NoLogo\",\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false); \" +\n `(Get-CimInstance Win32_Process -Filter 'ProcessId = ${pid}' -ErrorAction Stop).CommandLine | ConvertTo-Json -Compress`,\n ],\n {\n encoding: \"utf8\",\n // A cold PowerShell/CIM startup can exceed five seconds on Windows.\n timeout: 10000,\n maxBuffer: 64 * 1024,\n windowsHide: true,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n ),\n );\n if (typeof result !== \"string\" || !result.trim())\n throw new Error(`PID ${pid} has no readable command line.`);\n command = result;\n } else if (process.platform === \"darwin\" || process.platform === \"linux\") {\n command = execFileSync(\"ps\", [\"-p\", String(pid), \"-o\", \"command=\"], {\n encoding: \"utf8\",\n timeout: 5000,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n }).trim();\n } else {\n throw new Error(\"Active SDA processes cannot be verified on this platform.\");\n }\n const executable = process.argv[1];\n if (\n !executable ||\n (!command.includes(executable) &&\n !command.includes(realpathSync(executable)) &&\n !/(?:[\\\\/]@nshiab[\\\\/]setup-data-project[\\\\/]dist[\\\\/]sda\\.mjs|[\\\\/]node_modules[\\\\/]\\.bin[\\\\/]sda-run)(?:[\"\\s]|$)/.test(\n command,\n ))\n )\n throw new Error(`PID ${pid} could not be verified as this project's SDA process.`);\n if (process.platform === \"darwin\" || process.platform === \"linux\") {\n const cwd =\n process.platform === \"linux\"\n ? realpathSync(`/proc/${pid}/cwd`)\n : execFileSync(\"lsof\", [\"-a\", \"-p\", String(pid), \"-d\", \"cwd\", \"-Fn\"], {\n encoding: \"utf8\",\n timeout: 5000,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n })\n .split(\"\\n\")\n .find((line) => line.startsWith(\"n\"))\n ?.slice(1);\n if (!cwd || realpathSync(cwd) !== realpathSync(process.cwd()))\n throw new Error(`PID ${pid} could not be verified as this project's SDA process.`);\n }\n return command;\n}\n\n// Status is read-only: a missing or dead owner is ignored, never removed.\nexport function printSdaStatus(): number {\n const run = `${process.versions.bun ? \"bun\" : \"npm\"} run`;\n const retry = `${run} sda:status`;\n const watcherGuidance = `you can keep editing. The watcher formats source files, applies lint fixes, and reruns the analysis after changes. The user is likely watching the results live in their terminal while you work. Re-read a file before editing it again because the watcher may have changed it. Run ${run} sda to request a run from the watcher and receive its output and exit code when it finishes. Before handing off analysis code changes, start with ${run} sda:test. If formatting or lint checks fail, use ${run} sda:fix for automatic fixes. Resolve any remaining failures and rerun ${run} sda:test until it passes.`;\n const watcherMessage = (pid: number) =>\n `An SDA watcher is running (${run} sda:watch, PID ${pid}). While it runs, ${watcherGuidance}`;\n try {\n const claims = new Map<number, string[]>();\n try {\n for (const name of readdirSync(SDA_LOCK_DIRECTORY)) {\n const match = /^(\\d+)-[\\da-f-]{36}$/.exec(name);\n if (match) {\n const pid = Number(match[1]);\n claims.set(pid, [...(claims.get(pid) ?? []), name]);\n }\n }\n } catch (error) {\n if (errorCode(error) !== \"ENOENT\") throw error;\n }\n const messages: string[] = [];\n for (const [pid, owners] of claims) {\n if (!Number.isInteger(pid) || pid <= 0 || pid > 2147483647)\n throw new Error(\"The recorded SDA PID is invalid.\");\n let command: string;\n try {\n process.kill(pid, 0);\n command = readProcessCommand(pid, owners);\n } catch (error) {\n const code = errorCode(error);\n if (code === \"ESRCH\") continue;\n if (\n (code === \"EPERM\" || code === \"EACCES\") &&\n owners.length === 1 &&\n hasFreshWatcherHeartbeat(join(SDA_LOCK_DIRECTORY, owners[0]))\n ) {\n messages.push(watcherMessage(pid));\n continue;\n }\n throw error;\n }\n messages.push(\n /(?:^|[\"\\s])--watch(?:[\"\\s]|$)/.test(command)\n ? watcherMessage(pid)\n : `SDA analysis is running (${run} sda, PID ${pid}). Wait for it to finish before editing. Recheck with ${retry} after 3 seconds. If it is still running, recheck after 9 seconds, then every 27 seconds until it finishes.`,\n );\n }\n for (const message of messages) console.log(message);\n if (messages.length) return 1;\n console.log(\"No active SDA process found. You can proceed.\");\n return 0;\n } catch (error) {\n console.error(\n `Unable to verify SDA status: ${error instanceof Error ? error.message : String(error)} If you are an agent, ask the user whether ${run} sda or ${run} sda:watch is running. Wait for a one-off analysis to finish. If a watcher is running, ${watcherGuidance}`,\n );\n return 2;\n }\n}\n","import { createInterface } from \"node:readline\";\nimport type { Readable } from \"node:stream\";\nimport { stripVTControlCharacters, styleText } from \"node:util\";\n\nexport function pipeFixOutput(output: Readable, writeLine: (line: string) => void = console.log) {\n const lines = createInterface({ input: output, crlfDelay: Infinity });\n lines.on(\"line\", (line: string) => {\n const plain = stripVTControlCharacters(line);\n if (plain === \"Found 0 warnings and 0 errors.\") return;\n const timing = plain.match(\n /^Finished in ([\\d.]+)(ms|s) on \\d+ files?( with \\d+ rules)? using \\d+ threads?\\.$/,\n );\n if (timing) {\n const label = timing[3] ? \"Linting and type checking\" : \"Formatting\";\n writeLine(styleText(\"blue\", `${label}: ${timing[1]} ${timing[2]}`));\n } else {\n // Forward diagnostics and unfamiliar output unchanged, including custom fix scripts.\n writeLine(line);\n }\n });\n}\n","import { lstatSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\ntype Entry = { value: string | null; generation: number };\n// Reconcile the selected tree into one metadata index. Always start at the\n// selected roots: event paths can be incomplete or stale after a directory move.\nexport function createFileChanges(selected: string[], excluded: (path: string) => boolean) {\n const files = new Map<string, Entry>();\n let generation = 0;\n\n function check() {\n generation++;\n let changed = false;\n\n function update(path: string, value: string | null) {\n const previous = files.get(path);\n if (previous) {\n if (previous.value !== value) {\n previous.value = value;\n changed = true;\n }\n previous.generation = generation;\n } else {\n files.set(path, { value, generation });\n changed = true;\n }\n }\n\n function collect(path: string) {\n if (excluded(path) || files.get(path)?.generation === generation) return;\n try {\n const stat = lstatSync(path, { bigint: true });\n if (stat.isDirectory()) {\n const names = readdirSync(path);\n update(path, \"directory\");\n for (const name of names) collect(join(path, name));\n } else {\n update(path, [stat.dev, stat.ino, stat.size, stat.mtimeNs, stat.ctimeNs].join(\":\"));\n }\n } catch (error) {\n if (\n !(error instanceof Error) ||\n !(\"code\" in error) ||\n (error.code !== \"ENOENT\" && error.code !== \"ENOTDIR\")\n )\n throw error;\n update(path, null);\n }\n }\n\n for (const path of selected) collect(path);\n // Remove entries not visited in this check without allocating a second map.\n for (const [path, entry] of files) {\n if (entry.generation !== generation) {\n files.delete(path);\n changed = true;\n }\n }\n return changed;\n }\n\n return { check };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { once } from \"node:events\";\nimport {\n appendFileSync,\n copyFileSync,\n createReadStream,\n existsSync,\n linkSync,\n mkdirSync,\n readdirSync,\n renameSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join } from \"node:path\";\nimport { createInterface } from \"node:readline\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { isObject } from \"./jsonObject.ts\";\n\nexport const WATCH_REQUEST_POLL_MS = 100;\nconst resultName = \"watch-result.jsonl\";\nconst requestName = /^request-(\\d+)-[\\da-f-]{36}$/;\nconst acknowledgeTimeout = 5000;\nconst heartbeatInterval = 1000;\nconst heartbeatTimeout = 10000;\n\nexport type WatchOutput = { stream: \"stdout\" | \"stderr\"; text: string };\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\nfunction processIsGone(pid: number) {\n try {\n process.kill(pid, 0);\n return false;\n } catch (error) {\n if (errorCode(error) === \"ESRCH\") return true;\n if (errorCode(error) === \"EPERM\") return false;\n throw error;\n }\n}\n\nfunction linkResult(source: string, target: string) {\n try {\n linkSync(source, target);\n } catch (error) {\n if (errorCode(error) === \"ENOENT\") return; // The requester left.\n // Some filesystems do not support hard links. Keep the copy only until this requester reads it.\n const temporary = target + \".tmp\";\n try {\n copyFileSync(source, temporary);\n renameSync(temporary, target);\n } catch (copyError) {\n if (errorCode(copyError) !== \"ENOENT\") throw copyError;\n }\n }\n}\n\nexport function createWatchRequests(directory: string) {\n const temporary = join(directory, \"watch-result.tmp\");\n const latest = join(directory, resultName);\n\n function pending() {\n const requests: string[] = [];\n for (const name of readdirSync(directory)) {\n const match = requestName.exec(name);\n if (!match) continue;\n const pid = Number(match[1]);\n if (!Number.isInteger(pid) || pid <= 0 || pid > 2147483647) continue;\n const request = join(directory, name);\n if (processIsGone(pid)) {\n rmSync(request, { recursive: true, force: true });\n continue;\n }\n if (existsSync(join(request, resultName))) continue;\n const heartbeat = join(request, \"heartbeat\");\n const last = statSync(heartbeat, { throwIfNoEntry: false });\n if (!last || Date.now() - last.mtimeMs >= heartbeatInterval) {\n try {\n writeFileSync(heartbeat, \"\");\n } catch (error) {\n if (errorCode(error) === \"ENOENT\") continue;\n throw error;\n }\n }\n requests.push(request);\n }\n return requests;\n }\n\n const start = () => writeFileSync(temporary, \"\");\n const record = (chunk: WatchOutput) => appendFileSync(temporary, JSON.stringify(chunk) + \"\\n\");\n\n function publish(requests: string[], code: number) {\n appendFileSync(temporary, JSON.stringify({ code }) + \"\\n\");\n renameSync(temporary, latest);\n for (const request of requests) linkResult(latest, join(request, resultName));\n }\n\n return { pending, start, record, publish };\n}\n\nasync function replay(result: string): Promise<number> {\n const input = createReadStream(result, { encoding: \"utf8\" });\n const lines = createInterface({ input, crlfDelay: Infinity });\n const closed = new Promise<void>((resolve) => input.once(\"close\", resolve));\n let readError: Error | undefined;\n input.on(\"error\", (error) => {\n readError = error;\n lines.close();\n });\n try {\n for await (const line of lines) {\n const value: unknown = JSON.parse(line);\n if (isObject(value)) {\n if (typeof value.code === \"number\" && Number.isInteger(value.code)) return value.code;\n if (\n typeof value.text === \"string\" &&\n (value.stream === \"stdout\" || value.stream === \"stderr\")\n ) {\n const output = process[value.stream];\n if (!output.write(value.text)) await once(output, \"drain\");\n continue;\n }\n }\n throw new Error(\"The SDA watcher returned invalid output.\");\n }\n if (readError) throw readError;\n throw new Error(\"The SDA watcher result is missing its exit code.\");\n } finally {\n lines.close();\n input.destroy();\n await closed;\n }\n}\n\nexport async function requestWatchRun(watcher: {\n directory: string;\n pid: number;\n}): Promise<number> {\n const request = join(watcher.directory, `request-${process.pid}-${randomUUID()}`);\n const result = join(request, resultName);\n const heartbeat = join(request, \"heartbeat\");\n const clean = () => rmSync(request, { recursive: true, force: true });\n mkdirSync(request);\n process.once(\"exit\", clean);\n console.log(`Requesting an analysis run from the SDA watcher (PID ${watcher.pid})...`);\n let lastHeartbeat: number | undefined;\n let deadline = performance.now() + acknowledgeTimeout;\n try {\n for (;;) {\n if (existsSync(result)) return await replay(result);\n if (!existsSync(request) || processIsGone(watcher.pid))\n throw new Error(\"The SDA watcher stopped before completing the requested run. Try again.\");\n\n const modified = statSync(heartbeat, { throwIfNoEntry: false })?.mtimeMs;\n if (modified !== undefined && modified !== lastHeartbeat) {\n lastHeartbeat = modified;\n deadline = performance.now() + heartbeatTimeout;\n }\n if (performance.now() >= deadline)\n throw new Error(\n \"The SDA watcher did not respond to the analysis request. Try again after checking the watcher.\",\n );\n await delay(WATCH_REQUEST_POLL_MS);\n }\n } finally {\n process.removeListener(\"exit\", clean);\n clean();\n }\n}\n","#!/usr/bin/env node\nimport { existsSync, lstatSync, type FSWatcher, readdirSync, rmSync, watch } from \"node:fs\";\nimport { spawn, spawnSync, type ChildProcess } from \"node:child_process\";\nimport { dirname, join, resolve, sep } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { parseArgs } from \"node:util\";\nimport { acquireSdaLock, SdaLockBusyError, SDA_LOCK_DIRECTORY } from \"./helpers/sdaLock.ts\";\nimport { printSdaStatus } from \"./helpers/sdaStatus.ts\";\nimport { pipeFixOutput } from \"./helpers/pipeFixOutput.ts\";\nimport { createFileChanges } from \"./helpers/fileChanges.ts\";\nimport {\n createWatchRequests,\n requestWatchRun,\n WATCH_REQUEST_POLL_MS,\n type WatchOutput,\n} from \"./helpers/sdaWatchRequests.ts\";\n\nconst {\n positionals: [entry, ...paths],\n values,\n} = parseArgs({\n allowPositionals: true,\n options: {\n clean: { type: \"boolean\", default: false },\n status: { type: \"boolean\", default: false },\n watch: { type: \"boolean\", default: false },\n \"watch-test\": { type: \"boolean\", default: false },\n ignore: { type: \"string\", multiple: true, default: [] },\n },\n});\nif (values.clean) {\n if (entry || values.status || values.watch || values[\"watch-test\"] || values.ignore.length) {\n console.error(\"Usage: sda-run --clean (without other options or paths)\");\n process.exit(1);\n }\n try {\n for (const path of [\".sda-cache\", \".journalism-cache\", \".tmp\"]) {\n if (path === \".sda-cache\") {\n const stat = lstatSync(path, { throwIfNoEntry: false });\n if (!stat) continue;\n if (!stat.isDirectory()) {\n rmSync(path, { force: true });\n continue;\n }\n // Keep the lock and its parent stable, including during concurrent starts.\n for (const name of readdirSync(path)) {\n const child = join(path, name);\n if (resolve(child) !== resolve(SDA_LOCK_DIRECTORY))\n rmSync(child, { recursive: true, force: true });\n }\n continue;\n }\n rmSync(path, { recursive: true, force: true });\n }\n } catch (error) {\n console.error(\"Could not clean caches: \" + errorMessage(error));\n process.exit(1);\n }\n process.exit(0);\n}\nif (values.status) process.exit(printSdaStatus());\nif (!entry) {\n console.error(\n \"Usage: sda-run --clean | --status | [--watch] <entry-file> [watch-paths...] [--ignore path] | --watch-test <watch-paths...> [--ignore path]\",\n );\n process.exit(1);\n}\nconst watchingTests = values[\"watch-test\"];\nconst watching = values.watch || watchingTests;\nconst selected = [entry, ...paths].map((path) => resolve(path));\nconst ignored = [SDA_LOCK_DIRECTORY, ...values.ignore].map((path) => resolve(path));\nconst within = (path: string, root: string) => path === root || path.startsWith(root + sep);\nconst excluded = (path: string) => ignored.some((root) => within(path, root));\nconst bun = Boolean(process.versions.bun);\nconst runCommand =\n (bun ? \"bun run \" : \"npm run \") +\n (watchingTests ? \"sda:test:watch\" : watching ? \"sda:watch\" : \"sda\");\nconst windows = process.platform === \"win32\";\ntype Job = { child: ChildProcess; done: Promise<number | null> };\ntype Report = (stream: WatchOutput[\"stream\"], text: string) => void;\nlet releaseLock: (() => void) | undefined;\nlet watchRequests: ReturnType<typeof createWatchRequests> | undefined;\nlet requestTimer: ReturnType<typeof setInterval> | undefined;\nlet fixer: Job | undefined;\nlet running: Job | undefined;\nlet runInProgress = false;\nlet timer: ReturnType<typeof setTimeout> | undefined;\nlet checking = false;\nlet closing = false;\nlet needsCheck = true;\nconst changes = createFileChanges(selected, excluded);\nconst watchers = new Map<string, { watcher: FSWatcher; recursive: boolean }>();\n\nfunction launch(args: string[], command = process.execPath, summarize = false, report?: Report) {\n const child = spawn(command, args, {\n // Bun's Windows --bun shim is named node.exe; keep Bun CLI argument parsing.\n argv0: windows && bun && command === process.execPath ? \"bun\" : undefined,\n stdio: [\"inherit\", summarize || report ? \"pipe\" : \"inherit\", report ? \"pipe\" : \"inherit\"],\n detached: !windows,\n shell: windows && command === \"npm.cmd\",\n });\n if (summarize && child.stdout) {\n pipeFixOutput(child.stdout, report && ((line) => report(\"stdout\", line + \"\\n\")));\n } else if (report) {\n child.stdout?.setEncoding(\"utf8\").on(\"data\", (text: string) => report(\"stdout\", text));\n }\n if (report)\n child.stderr?.setEncoding(\"utf8\").on(\"data\", (text: string) => report(\"stderr\", text));\n if (child.stdout || child.stderr) {\n child.once(\"exit\", () => {\n // Background descendants can inherit the pipes; don't wait forever for them to close.\n const timeout = setTimeout(() => {\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 1000);\n child.once(\"close\", () => clearTimeout(timeout));\n });\n }\n const done = new Promise<number | null>((resolve) => {\n child.once(\"error\", (error) => {\n if (report) report(\"stderr\", errorMessage(error) + \"\\n\");\n else console.error(errorMessage(error));\n resolve(1);\n });\n child.once(\"close\", resolve);\n });\n return { child, done };\n}\n\nfunction launchScript(script: string, summarize = false, report?: Report) {\n return launch(\n [\"run\", \"--silent\", script],\n bun ? process.execPath : windows ? \"npm.cmd\" : \"npm\",\n summarize,\n report,\n );\n}\n\nfunction announceWatchRun(message: string) {\n if (process.stdout.isTTY) {\n const clearScrollback = watchingTests ? \"\" : \"\\u001b[3J\";\n process.stdout.write(`\\u001b[2J${clearScrollback}\\u001b[H`);\n }\n console.log(`Watching SDA for changes...\\n\\n${message}`);\n}\n\nfunction watchJob(job: Job, label: string, success: string, complete?: (code: number) => void) {\n running = job;\n runInProgress = true;\n void job.done\n .then((result) => {\n if (closing || checking || running !== job) return;\n runInProgress = false;\n complete?.(result ?? 1);\n const outcome =\n result === 0 ? success : result === null ? \"stopped\" : `failed (exit code ${result})`;\n console.log(`\\n${label} ${outcome}. Waiting for changes...`);\n })\n .catch(fail);\n}\n\nfunction refreshWatchers() {\n const directories = new Map<string, boolean>();\n const add = (directory: string, recursive: boolean) => {\n directories.set(directory, recursive || directories.get(directory) || false);\n };\n for (const path of selected) {\n if (excluded(path)) continue;\n if (lstatSync(path, { throwIfNoEntry: false })?.isDirectory()) add(path, true);\n // Watch the parent too, so deleted files and folders can be restored.\n let parent = dirname(path);\n while (!existsSync(parent)) parent = dirname(parent);\n add(parent, parent !== dirname(path));\n }\n for (const [directory, state] of watchers) {\n if (directories.get(directory) !== state.recursive) {\n state.watcher.close();\n watchers.delete(directory);\n }\n }\n for (const [directory, recursive] of directories) {\n if (watchers.has(directory)) continue;\n const watcher = watch(directory, { recursive }, (_event, name) => {\n if (checking || closing) return;\n const changed = name && resolve(directory, name.toString());\n if (\n !changed ||\n (!excluded(changed) &&\n selected.some((path) => within(changed, path) || within(path, changed)))\n )\n schedule();\n });\n watcher.on(\"error\", fail);\n watchers.set(directory, { watcher, recursive });\n }\n}\n\nasync function stop(job: Job | undefined) {\n if (!job?.child.pid) return;\n const pid = job.child.pid;\n if (windows) {\n if (job.child.exitCode === null && job.child.signalCode === null) {\n spawnSync(\"taskkill\", [\"/pid\", String(job.child.pid), \"/T\", \"/F\"], { stdio: \"ignore\" });\n }\n await job.done;\n return;\n }\n const signal = (name: NodeJS.Signals | 0) => {\n try {\n process.kill(-pid, name);\n return true;\n } catch (error) {\n if (errorCode(error) !== \"ESRCH\") throw error;\n return false;\n }\n };\n signal(\"SIGTERM\");\n // The direct child can exit first; retain the grace period for its entire process group.\n const deadline = performance.now() + 1000;\n while (signal(0)) {\n if (performance.now() >= deadline) {\n signal(\"SIGKILL\");\n break;\n }\n await delay(25);\n }\n await job.done;\n}\n\nasync function check() {\n if (closing || checking) return;\n const changed = changes.check();\n needsCheck ||= changed;\n const requests = watchRequests?.pending();\n if (!needsCheck && (runInProgress || !requests?.length)) return;\n checking = true;\n needsCheck = false;\n await stop(running);\n running = undefined;\n runInProgress = false;\n if (closing) return;\n refreshWatchers();\n if (watchingTests) {\n // A fresh run sees edits made while the previous process was stopping.\n changes.check();\n announceWatchRun(\"Running SDA checks and tests...\");\n watchJob(launchScript(\"sda:test\"), \"SDA checks and tests\", \"passed\");\n checking = false;\n return;\n }\n announceWatchRun(\"Running SDA checks and analysis...\");\n watchRequests?.start();\n const report: Report = (stream, text) => {\n process[stream].write(text);\n if (closing) return;\n try {\n watchRequests?.record({ stream, text });\n } catch (error) {\n fail(error);\n }\n };\n fixer = launchScript(\"sda:fix\", true, report);\n const fixed = await fixer.done;\n if (closing) return;\n // Recheck edits made during fixes; ignore delayed events for unchanged file states.\n needsCheck = changes.check();\n refreshWatchers();\n fixer = undefined;\n checking = false;\n // Requests that arrived during fixes can use this run if the files are current.\n const batch = watchRequests?.pending() ?? [];\n const publish = (code: number) => watchRequests?.publish(batch, code);\n if (needsCheck) {\n schedule();\n } else if (fixed === 0) {\n console.log();\n watchJob(\n launch(bun ? [\"run\", entry] : [\"--env-file=.env\", entry], process.execPath, false, report),\n \"SDA analysis\",\n \"completed\",\n publish,\n );\n } else {\n publish(fixed ?? 1);\n console.log(\"Fix failed. Waiting for changes...\");\n }\n}\n\nfunction schedule() {\n clearTimeout(timer);\n timer = setTimeout(() => check().catch(fail), 0);\n}\n\nasync function shutdown(code: number) {\n if (closing) return;\n closing = true;\n clearTimeout(timer);\n clearInterval(requestTimer);\n for (const { watcher } of watchers.values()) watcher.close();\n await Promise.all([stop(fixer), stop(running)]);\n releaseLock?.();\n process.exit(code);\n}\n\nfunction errorCode(error: unknown) {\n return error instanceof Error && \"code\" in error ? error.code : undefined;\n}\n\nfunction errorMessage(error: unknown) {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction fail(error: unknown) {\n console.error(errorMessage(error));\n void shutdown(1);\n}\n\nprocess.on(\"SIGINT\", () => void shutdown(0));\nprocess.on(\"SIGTERM\", () => void shutdown(0));\n\nasync function runOnce() {\n fixer = launchScript(\"sda:fix\", true);\n const fixed = await fixer.done;\n if (closing) return;\n if (fixed !== 0) {\n await shutdown(fixed ?? 1);\n return;\n }\n await stop(fixer);\n fixer = undefined;\n if (closing) return;\n console.log();\n running = launch(bun ? [\"run\", entry] : [\"--env-file=.env\", entry]);\n const result = await running.done;\n await shutdown(result ?? 1);\n}\n\ntry {\n if (!watchingTests) {\n const lock = await acquireSdaLock(runCommand, watching ? resolve(entry) : undefined);\n releaseLock = lock.release;\n if (watching && !closing) {\n const requests = createWatchRequests(lock.directory);\n watchRequests = requests;\n requestTimer = setInterval(() => {\n if (closing) return;\n try {\n const pending = requests.pending();\n if (!checking && !runInProgress && (needsCheck || pending.length)) schedule();\n } catch (error) {\n fail(error);\n }\n }, WATCH_REQUEST_POLL_MS);\n lock.startWatcherHeartbeat(fail);\n }\n }\n if (closing) releaseLock?.();\n else if (watching) {\n refreshWatchers();\n void check().catch(fail);\n } else {\n void runOnce().catch(fail);\n }\n} catch (error) {\n if (!watching && error instanceof SdaLockBusyError && error.watcher?.entry === resolve(entry)) {\n try {\n process.exitCode = await requestWatchRun(error.watcher);\n } catch (requestError) {\n fail(requestError);\n }\n } else {\n fail(new Error(\"Cannot start \" + runCommand + \": \" + errorMessage(error)));\n }\n}\n"],"mappings":";;;;;;;;;;;AAiBA,MAAa,qBAAqB;AAClC,MAAM,2BAA2B;AACjC,MAAM,yBAAyB;AAI/B,IAAa,mBAAb,cAAsC,MAAM;CAC1C;CAEA,YAAY,OAAc,WAAmB;EAC3C,MACE,GAAG,MAAM,QAAQ,qBAAqB,MAAM,SAAS,SAAS,WAAW,IAAI,uCAAuC,gCAAgC,QAAQ,MAAM,IAAI,iFACxK;EACA,IAAI,MAAM,YAAY,KAAK,UAAU;GAAE;GAAW,KAAK,MAAM;GAAK,OAAO,MAAM;EAAW;CAC5F;AACF;AAEA,SAASA,YAAU,OAAgB;CACjC,OAAO,iBAAiB,SAAS,UAAU,QAAQ,MAAM,OAAO,KAAA;AAClE;AAEA,SAAgB,yBAAyB,WA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AAM,IAAI;AAE7B,SAAS,OAAO;CACd,IAAI,CAAC,YAAY,iBAAiB,oBAAoB,MAAM,SAAS,UAAU,QAAQ,KAAK,GAC1F,IAAI;EACF,QAAQ,WAAW,MAAM,gBAAgB,MAAM,OAAO;CACxD,SAAS,cAAc;EACrB,KAAK,YAAY;CACnB;MAEA,qBAAK,IAAI,MAAM,kBAAkB,aAAa,OAAO,aAAa,KAAK,CAAC,CAAC;AAE7E"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nshiab/setup-data-project",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.18",
|
|
4
4
|
"description": "Quickly kick off a project using simple-data-analysis-core, simple-data-analysis, and journalism libraries.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/nshiab/setup-data-project",
|
|
7
7
|
"bin": {
|
|
8
|
+
"sda-preview": "./dist/preview.mjs",
|
|
8
9
|
"sda-run": "./dist/sda.mjs",
|
|
9
10
|
"setup-data-project": "./dist/main.mjs"
|
|
10
11
|
},
|