@nshiab/setup-data-project 4.0.19 → 4.0.21

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/dist/main.mjs CHANGED
@@ -224,7 +224,7 @@ async function installPackages(packages, options = {}) {
224
224
  //#endregion
225
225
  //#region package.json
226
226
  var name = "@nshiab/setup-data-project";
227
- var version = "4.0.19";
227
+ var version = "4.0.21";
228
228
  //#endregion
229
229
  //#region src/helpers/ensureTooling.ts
230
230
  const tools = [
@@ -362,27 +362,33 @@ function ensureAgents(docsMapping, runtime, installedPackages = Object.keys(docs
362
362
  const setup = `${runtime === "bun" ? "bunx --bun" : "npx"} @nshiab/setup-data-project`;
363
363
  const analysisPackage = ["@nshiab/simple-data-analysis", "@nshiab/simple-data-analysis-core"].find((pkg) => installedPackages.includes(pkg));
364
364
  const hasPlot = installedPackages.includes("@observablehq/plot");
365
- const analysisGuidance = analysisPackage ? `Use \`${analysisPackage}\` for loading, cleaning, joining, and aggregating data, and for other transformations.` : `If the task needs data processing or transformation, suggest \`${setup} --sda\` to install Simple Data Analysis${hasPlot ? "" : " with Observable Plot"} and download versioned documentation.`;
365
+ const analysisGuidance = analysisPackage ? `Use \`${analysisPackage}\` methods whenever they fit. Reserve custom queries for gaps in those methods. Explain the gap to the user and offer to open a GitHub issue in the library's repository.
366
+
367
+ For scripts using the default in-memory \`SimpleDB\`, let unexpected errors stop the run so the script can be rerun. Call \`await sdb.close()\` at the end of the normal execution path. Calling it from \`catch\` or \`finally\` after a failure can remove cached results for steps the script never reached. Add error handling when the code or the user requires it.` : `If the task needs data processing or transformation, suggest \`${setup} --sda\` to install Simple Data Analysis${hasPlot ? "" : " with Observable Plot"} and download versioned documentation.`;
366
368
  const chartGuidance = hasPlot ? `Otherwise, use the installed Observable Plot.
367
369
 
368
370
  When using Observable Plot, copy \`dist/plot.umd.min.js\` from the installed \`@observablehq/plot\` package and \`dist/d3.min.js\` from its installed \`d3\` dependency into the site folder. Look for both packages in \`node_modules/\`, including Plot's nested dependencies if D3 is not at the top level. Use relative script URLs to load D3 before Plot.` : `Otherwise, suggest \`${setup} --sda\` to install Simple Data Analysis with Observable Plot and download their documentation. Use native browser APIs if the user prefers to keep the current dependencies.`;
369
371
  const links = getInstalledPackageConfigs(installedPackages).map((pkg) => {
370
- if (pkg.value === "@observablehq/plot") return `- Observable Plot charts and maps: start at \`docs/observable-plot/llms.txt\`, then read the relevant pages for browser charts or for use with \`writeChart\` and \`writeMap\`.`;
371
- return `- \`${pkg.value}\`: start at \`docs/${pkg.value.slice(8)}/llms.txt\`, then read the relevant API pages and examples.`;
372
+ const name = pkg.value === "@observablehq/plot" ? "observable-plot" : pkg.value.slice(8);
373
+ return `- \`${pkg.value}\` — \`docs/${name}/llms.txt\``;
372
374
  });
373
375
  ensureManagedSection({
374
376
  path: "AGENTS.md",
375
377
  name: "agents",
376
- createContent: (section) => section,
377
- content: `Read README.md for project guidance and package.json for the installed libraries and scripts. Use the installed libraries. Ask the user before adding a dependency.
378
+ createContent: (section) => `# Project instructions\n\n${section}`,
379
+ content: `Read README.md for project guidance and package.json for the installed libraries and scripts. Ask the user before adding a dependency.
378
380
 
379
381
  Keep changes focused on the user's request. Update README.md only when the user explicitly asks.
380
382
 
381
- ${links.length ? `Documentation for these installed libraries is available locally:\n\n${links.join("\n")}\n\n` : ""}Before making changes or running project commands, run \`${run} sda:status\` and follow its instructions.
383
+ Before writing or changing code, search the documentation of relevant installed libraries. Prefer their classes, functions, and methods when they fit the task. If you find a missing feature or a bug, tell the user and offer to open a GitHub issue in the library's repository.
384
+
385
+ ${links.length ? `Local library documentation:\n\n${links.join("\n")}\n\n` : ""}Before making changes or running project commands, run \`${run} sda:status\` and follow its instructions.
382
386
 
383
387
  ## Data analysis
384
388
 
385
- Do data analysis and processing in \`sda/\`. ${analysisGuidance}
389
+ Do data analysis and processing in \`sda/\`. Prioritize code that is easy to understand and review.
390
+
391
+ ${analysisGuidance}
386
392
 
387
393
  Use \`sda/main.ts\` as the entry point and \`sda/helpers/\` for reusable helpers. Keep one function per helper file, with the file named after the function. Put source data in \`sda/data/\` and analysis results in \`sda/output/\`.
388
394
 
@@ -400,17 +406,19 @@ Before handing off analysis code changes, start with \`${run} sda:test\`. If for
400
406
 
401
407
  ## Web projects
402
408
 
403
- Default to a simple single page focused on the user's request. You don't need to build a full website; focus on the components that meet the user's needs.
409
+ If the user asks for a web page, dashboard, or interactive visualization, create \`src/site/\` for the site unless the project calls for a different folder. Put \`index.html\` at the root, keep all required assets in the site folder, and use relative URLs. Use HTML, CSS, and vanilla JavaScript with classic script tags unless the user specifies a different stack.
410
+
411
+ Default to one page. Use multiple pages when the user asks for them or when they make the site easier to navigate.
404
412
 
405
- If the user asks for a web page, dashboard, or interactive visualization, create \`src/site/\` for the site unless the project calls for a different folder. Put \`index.html\` at the root of the site folder, keep all site assets inside it, and use relative URLs for local files so the folder can be uploaded directly to a static host. Use HTML, CSS, and vanilla JavaScript unless the user specifies a different stack.
413
+ Show a “Last updated” timestamp near the top of each page and refresh it when the content or data changes. Ask which name and email to display as the public contact if the user hasn’t already provided them.
406
414
 
407
- When the site needs data, prepare it in \`sda/\` and export only the data the site needs into the site folder, in a browser-readable format such as JSON. Load that export from the page and use browser JavaScript to render it and handle interactions such as filtering or highlighting.
415
+ When the site needs data, prepare it in \`sda/\` and export only what the page needs as JSON to \`sda/output/\`. Generate a separate \`data.js\` in the site folder from that export and load it before the page code (so recipients can unzip the site and double-click \`index.html\` without a server).
408
416
 
409
417
  Add web dependencies only when the user explicitly requests them. For charts, use the user's chosen library. ${chartGuidance}
410
418
 
411
419
  In \`package.json\`, add a script that runs \`${run} sda:preview\`. Use \`sda:dash\` for a dashboard, \`sda:interactive\` for a standalone interactive visualization, or \`sda:web\` for other web pages. For a different site folder, pass its path with \`--dir\`, for example \`${previewOverride}\`. Reuse an existing alias if it runs the same command. If the preferred name is taken, preserve the existing script and choose an unused name.
412
420
 
413
- Run the alias to start the preview server, open the local URL it prints in a browser, and check the page and its interactions. The preview serves and watches only the site folder and refreshes the browser when its files change. Share the alias command and local URL with the user.
421
+ Run the alias to start the preview server. Check the page and its interactions at the local URL it prints. The preview serves and watches only the site folder and refreshes the browser when its files change. Share the alias command and local URL with the user.
414
422
 
415
423
  The \`sda:fix\`, \`sda:test\`, \`sda:watch\`, and \`sda:test:watch\` scripts target analysis code in \`sda/\`. Use the browser preview to verify web changes. When adding automated web tests at the user's request or to cover complex behavior, create \`src/test/\` and add a matching \`package.json\` script such as \`sda:dash:test\` that runs only the web tests using the project's test runner.`
416
424
  });
package/dist/main.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.mjs","names":["process","metadata.name","metadata.version","process"],"sources":["../src/helpers/getRuntime.ts","../src/helpers/packageRegistry.ts","../src/helpers/packageOptions.ts","../src/helpers/gitignoreEntries.ts","../src/helpers/ensureGitignore.ts","../src/helpers/ensureManagedSection.ts","../src/helpers/ensureReadme.ts","../src/helpers/installPackages.ts","../package.json","../src/helpers/ensureTooling.ts","../src/helpers/ensureVscode.ts","../src/helpers/getProjectTasks.ts","../src/helpers/createFolderStructure.ts","../src/helpers/ensureEnvFile.ts","../src/helpers/ensureAgents.ts","../src/helpers/projectManifest.ts","../src/helpers/fetchPackageDocs.ts","../src/helpers/cleanPlotMarkdown.ts","../src/helpers/getPlotTag.ts","../src/helpers/combinePlotDocs.ts","../src/helpers/plotDocPages.ts","../src/helpers/splitPlotDocs.ts","../src/helpers/fetchPlotDocs.ts","../src/helpers/syncPackageDocs.ts","../src/helpers/getInstalledPackageVersions.ts","../src/helpers/parseArguments.ts","../src/main.ts"],"sourcesContent":["import process from \"node:process\";\nexport type Runtime = \"node\" | \"bun\";\nexport function getRuntime(versions: { bun?: string; node?: string } = process.versions): Runtime {\n return versions.bun ? \"bun\" : \"node\";\n}\n","export interface PackageConfig {\n value: string;\n label: string;\n type: \"sda\" | \"journalism\" | \"other\";\n hint?: string;\n}\n\nexport const SUPPORTED_PACKAGES: PackageConfig[] = [\n {\n value: \"@nshiab/simple-data-analysis\",\n label: \"simple-data-analysis\",\n type: \"sda\",\n hint: \"All the core functionality, plus methods for dataviz, AI, Google sheets, etc.\",\n },\n {\n value: \"@nshiab/simple-data-analysis-core\",\n label: \"simple-data-analysis-core\",\n type: \"sda\",\n hint: \"No fluff. Great for constrained environments, like a cheap server.\",\n },\n {\n value: \"@nshiab/journalism-ai\",\n label: \"journalism-ai\",\n type: \"journalism\",\n hint: \"Easily use AI local models with Ollama or remote models with Gemini/Vertex.\",\n },\n {\n value: \"@nshiab/journalism-google\",\n label: \"journalism-google\",\n type: \"journalism\",\n hint: \"Push and retrieve data from Google Sheets, Google Bucket, and more.\",\n },\n {\n value: \"@nshiab/journalism-web-scraping\",\n label: \"journalism-web-scraping\",\n type: \"journalism\",\n hint: \"Retrieve data from Statistics Canada tables, HTML table, download files...\",\n },\n {\n value: \"@nshiab/journalism-finance\",\n label: \"journalism-finance\",\n type: \"journalism\",\n hint: \"Retrieve financial data, calculate Canadian mortgage payments and taxes...\",\n },\n {\n value: \"@nshiab/journalism-format\",\n label: \"journalism-format\",\n type: \"journalism\",\n hint: \"Easily format dates, numbers, currencies...\",\n },\n {\n value: \"@nshiab/journalism-climate\",\n label: \"journalism-climate\",\n type: \"journalism\",\n hint: \"Retrieve data from Environment Canada APIs and more.\",\n },\n {\n value: \"@nshiab/journalism-dataviz\",\n label: \"journalism-dataviz\",\n type: \"journalism\",\n hint: \"Render charts/maps with Observable Plot or directly in the terminal.\",\n },\n {\n value: \"@nshiab/journalism-geo\",\n label: \"journalism-geo\",\n type: \"journalism\",\n hint: \"Calculate distances, transform 2D coordinates to 3D, wrangle GeoTIFF files...\",\n },\n {\n value: \"@nshiab/journalism-statistics\",\n label: \"journalism-statistics\",\n type: \"journalism\",\n hint: \"Functions for statistical tests, clustering, random path generation...\",\n },\n {\n value: \"@nshiab/journalism-web\",\n label: \"journalism-web\",\n type: \"journalism\",\n hint: \"Web related functions, including downloading data as CSV, extracting ZIP files to URLs...\",\n },\n {\n value: \"@nshiab/journalism-extras\",\n label: \"journalism-extras\",\n type: \"journalism\",\n hint: \"Functions to zip/unzip, sleep, reencode files, create nested directories...\",\n },\n];\n\n// Plot is installed alongside charting libraries, but is not a setup menu option.\nexport const DOCUMENTED_PACKAGES: PackageConfig[] = [\n ...SUPPORTED_PACKAGES,\n { value: \"@nshiab/journalism\", label: \"journalism\", type: \"journalism\" },\n { value: \"@observablehq/plot\", label: \"Observable Plot\", type: \"other\" },\n];\n\nexport function getInstalledPackageConfigs(installedPackages: string[]): PackageConfig[] {\n const installedSet = new Set(installedPackages);\n return DOCUMENTED_PACKAGES.filter((pkg) => installedSet.has(pkg.value));\n}\n","import { SUPPORTED_PACKAGES } from \"./packageRegistry.ts\";\n\nexport const PACKAGE_OPTIONS = SUPPORTED_PACKAGES.map((pkg) => ({\n value: pkg.value,\n label: pkg.label,\n hint: pkg.hint,\n}));\n","export const GITIGNORE_ENTRIES = [\n \"node_modules\",\n \"docs/\",\n \".tmp\",\n \".sda-cache\",\n \".journalism-cache\",\n \"sda/data\",\n \"sda/output\",\n \".env\",\n \".DS_Store\",\n];\n","import { lstatSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { GITIGNORE_ENTRIES } from \"./gitignoreEntries.ts\";\n\nexport const GITIGNORE_SENTINEL = \"# Added by setup-data-project. Do not remove this line.\";\n\nexport function ensureGitignore() {\n const path = \".gitignore\";\n const stats = lstatSync(path, { throwIfNoEntry: false });\n\n if (stats?.isSymbolicLink()) {\n return;\n }\n\n const content = stats === undefined ? \"\" : readFileSync(path, \"utf-8\");\n const hasSentinel = content.split(\"\\n\").some((line) => line.trim() === GITIGNORE_SENTINEL);\n\n if (hasSentinel) {\n const entries = new Set(content.split(\"\\n\").map((line) => line.trim()));\n const missing = GITIGNORE_ENTRIES.filter((entry) => !entries.has(entry));\n if (missing.length)\n writeFileSync(\n path,\n content + (content.endsWith(\"\\n\") ? \"\" : \"\\n\") + missing.join(\"\\n\") + \"\\n\",\n );\n return;\n }\n\n const separator = content === \"\" ? \"\" : content.endsWith(\"\\n\") ? \"\\n\" : \"\\n\\n\";\n const block = `${GITIGNORE_SENTINEL}\\n${GITIGNORE_ENTRIES.join(\"\\n\")}\\n`;\n writeFileSync(path, content + separator + block);\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\n\ninterface ManagedSectionOptions {\n path: string;\n name: string;\n content: string;\n createContent: (section: string) => string;\n}\n\nexport function ensureManagedSection(\n options: ManagedSectionOptions,\n): \"created\" | \"updated\" | \"unchanged\" | \"missing-markers\" {\n const startMarker = `<!-- setup-data-project:${options.name}:start / Safe to remove if you don't want this generated section. -->`;\n const endMarker = `<!-- setup-data-project:${options.name}:end / End of generated section. -->`;\n const trimmedContent = options.content.trim();\n const section =\n trimmedContent === \"\"\n ? `${startMarker}\\n${endMarker}`\n : `${startMarker}\\n\\n${trimmedContent}\\n\\n${endMarker}`;\n\n if (!existsSync(options.path)) {\n writeFileSync(options.path, ensureFinalNewline(options.createContent(section)));\n return \"created\";\n }\n\n const currentContent = readFileSync(options.path, \"utf-8\");\n const start = new RegExp(\n `<!-- setup-data-project:${options.name}:start(?: / [^\\\\r\\\\n]*?)? -->`,\n ).exec(currentContent);\n const end = new RegExp(`<!-- setup-data-project:${options.name}:end(?: / [^\\\\r\\\\n]*?)? -->`).exec(\n currentContent,\n );\n\n if (!start || !end || end.index < start.index + start[0].length) {\n return \"missing-markers\";\n }\n\n const nextContent =\n currentContent.slice(0, start.index) +\n section +\n currentContent.slice(end.index + end[0].length);\n\n if (nextContent === currentContent) {\n return \"unchanged\";\n }\n\n writeFileSync(options.path, ensureFinalNewline(nextContent));\n return \"updated\";\n}\n\nfunction ensureFinalNewline(content: string): string {\n return content.endsWith(\"\\n\") ? content : content + \"\\n\";\n}\n","import { ensureManagedSection } from \"./ensureManagedSection.ts\";\nimport { getInstalledPackageConfigs } from \"./packageRegistry.ts\";\nimport type { Runtime } from \"./getRuntime.ts\";\nexport function ensureReadme(runtime: Runtime, installedPackages: string[] = []) {\n const run = runtime === \"bun\" ? \"bun run\" : \"npm run\";\n const libraries = getInstalledPackageConfigs(installedPackages)\n .map((pkg) => `\\`${pkg.value}\\``)\n .join(\", \");\n ensureManagedSection({\n path: \"README.md\",\n name: \"libraries\",\n createContent: (section) =>\n `# Data project\\n\\nCreated with [setup-data-project](https://github.com/nshiab/setup-data-project).\\n\\n${section}`,\n content: `${libraries ? `Installed libraries: ${libraries}.\\n\\n` : \"\"}## Data analysis\n\nUse \\`sda/main.ts\\` to process source data from \\`sda/data/\\` and write results to \\`sda/output/\\`. Git ignores both data folders. Put reusable helpers in \\`sda/helpers/\\`. Use \\`sda/test/\\` for analysis tests named \\`*.test.ts\\`.${runtime === \"bun\" ? \" Use Bun 1.3.1 or newer to run checks before adding your first test.\" : \"\"}\n\n- \\`${run} sda\\`: run \\`${run} sda:fix\\`, then run the analysis once if checks pass.\n- \\`${run} sda:fix\\`: format files, apply automatic lint fixes, and check types under sda/.\n- \\`${run} sda:watch\\`: rerun fixes and analysis when sda/ or .env changes, excluding sda/output/.\n- \\`${run} sda:status\\`: check whether an analysis run or analysis watcher is active.\n- \\`${run} sda:test\\`: check formatting, lint, and TypeScript types under sda/, then run its tests.\n- \\`${run} sda:test:watch\\`: rerun checks and tests when analysis files or project settings change, excluding sda/output/.\n- \\`${run} sda:clean\\`: delete cached results and temporary files in .sda-cache/, .journalism-cache/, and .tmp/.\n\n## Editor and documentation\n\nIn VS Code, install the recommended Oxc extension for formatting and linting. The generated \\`.vscode/settings.json\\` enables formatting on save, Oxc lint fixes on explicit saves, and word wrapping. Setup preserves existing VS Code configuration files.\n\nRun \\`${run} sda:docs\\` after installing or updating an SDA, journalism, or Observable Plot package. It refreshes the local docs for the versions installed in your project. Git ignores \\`docs/\\`.`,\n });\n}\n","import { execFile } from \"node:child_process\";\nimport { getRuntime } from \"./getRuntime.ts\";\nexport function runPackageManager(args: string[]): Promise<void> {\n const command = getRuntime() === \"bun\" ? \"bun\" : process.platform === \"win32\" ? \"npm.cmd\" : \"npm\";\n return new Promise((resolve, reject) => {\n execFile(\n command,\n args,\n { maxBuffer: 10 * 1024 * 1024, shell: process.platform === \"win32\" },\n (error, stdout, stderr) => {\n if (error)\n reject(\n new Error(`${command} ${args.join(\" \")} failed.\\n${stderr || stdout}`, {\n cause: error,\n }),\n );\n else resolve();\n },\n );\n });\n}\nexport async function installPackages(\n packages: string[],\n options: { development?: boolean } = {},\n): Promise<void> {\n if (packages.length === 0) return;\n const bun = getRuntime() === \"bun\";\n await runPackageManager([\n bun ? \"add\" : \"install\",\n ...(options.development ? (bun ? [\"--dev\"] : [\"--save-dev\"]) : []),\n ...packages,\n ]);\n}\n","","import { existsSync, writeFileSync } from \"node:fs\";\nimport { ProjectManifest } from \"./projectManifest.ts\";\nimport { getRuntime } from \"./getRuntime.ts\";\nimport { installPackages } from \"./installPackages.ts\";\nimport metadata from \"../../package.json\" with { type: \"json\" };\nconst tools = [\"oxfmt\", \"oxlint\", \"oxlint-tsgolint\", \"@types/node\"];\nexport async function ensureTooling(manifest: ProjectManifest): Promise<void> {\n const runtime = getRuntime();\n const runtimeTools = runtime === \"bun\" ? [...tools, \"@types/bun\"] : tools;\n const installed = manifest.getInstalledPackages();\n await installPackages(\n [\n ...runtimeTools.filter((pkg) => !installed.includes(pkg)).map((pkg) => `${pkg}@latest`),\n ...(installed.includes(metadata.name) ? [] : [`${metadata.name}@${metadata.version}`]),\n ],\n { development: true },\n );\n if (\n ![\".oxlintrc.json\", \".oxlintrc.jsonc\", \"oxlint.config.ts\", \"oxlint.config.mts\"].some((file) =>\n existsSync(file),\n )\n ) {\n writeFileSync(\n \".oxlintrc.json\",\n `{\n \"options\": { \"typeAware\": true, \"typeCheck\": true }\n}\n`,\n );\n }\n if (\n [\".oxfmtrc.json\", \".oxfmtrc.jsonc\", \"oxfmt.config.ts\", \"oxfmt.config.mts\"].every(\n (file) => !existsSync(file),\n )\n )\n writeFileSync(\n \".oxfmtrc.json\",\n `{\n \"ignorePatterns\": [\"docs/**\", \"sda/data/**\", \"sda/output/**\"]\n}\n`,\n );\n if (!existsSync(\"tsconfig.json\"))\n writeFileSync(\n \"tsconfig.json\",\n `{\n \"compilerOptions\": {\n \"target\": \"ES2023\",\n \"module\": \"NodeNext\",\n \"strict\": true,\n \"noEmit\": true,\n \"allowImportingTsExtensions\": true,\n \"erasableSyntaxOnly\": ${runtime === \"node\"},\n \"types\": ${runtime === \"bun\" ? '[\"node\", \"bun\"]' : '[\"node\"]'},\n \"skipLibCheck\": true\n },\n \"include\": [\"sda/**/*.ts\"]\n}\n`,\n );\n}\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\n\nexport function ensureVscode(): void {\n mkdirSync(\".vscode\", { recursive: true });\n const formatter = \"oxc.oxc-vscode\";\n const files = {\n \"extensions.json\": `{\n \"recommendations\": [\"oxc.oxc-vscode\"]\n}\n`,\n \"settings.json\": `${JSON.stringify(\n {\n \"editor.defaultFormatter\": formatter,\n \"[javascript]\": { \"editor.defaultFormatter\": formatter },\n \"[javascriptreact]\": { \"editor.defaultFormatter\": formatter },\n \"[typescript]\": { \"editor.defaultFormatter\": formatter },\n \"[typescriptreact]\": { \"editor.defaultFormatter\": formatter },\n \"oxc.disableNestedConfig\": true,\n \"oxc.fmt.disableNestedConfig\": true,\n \"editor.formatOnSave\": true,\n \"editor.formatOnSaveMode\": \"file\",\n \"editor.codeActionsOnSave\": { \"source.fixAll.oxc\": \"explicit\" },\n \"editor.wordWrap\": \"on\",\n },\n null,\n 2,\n )}\\n`,\n };\n for (const [name, config] of Object.entries(files)) {\n const path = `.vscode/${name}`;\n if (!existsSync(path)) writeFileSync(path, config);\n }\n}\n","import { getRuntime, type Runtime } from \"./getRuntime.ts\";\nexport function getProjectTasks(runtime: Runtime = getRuntime()) {\n const fmt = runtime === \"bun\" ? \"bun run --bun oxfmt\" : \"oxfmt\";\n const lint = `${runtime === \"bun\" ? \"bun run --bun oxlint\" : \"oxlint\"} --type-aware --type-check`;\n const prefix = runtime === \"bun\" ? \"bun run --bun --no-env-file \" : \"\";\n const runner = `${prefix}sda-run`;\n const tests =\n runtime === \"bun\"\n ? \"bun test --pass-with-no-tests ./sda/\"\n : 'node --env-file-if-exists=.env --test \"sda/**/*.test.ts\"';\n return {\n sda: `${runner} sda/main.ts`,\n \"sda:watch\": `${runner} --watch sda/main.ts sda .env --ignore sda/output`,\n \"sda:status\": `${runner} --status`,\n \"sda:test\": `${fmt} --check sda && ${lint} sda && ${tests}`,\n \"sda:test:watch\": `${runner} --watch-test sda .env tsconfig.json --ignore sda/output`,\n \"sda:clean\": `${runner} --clean`,\n \"sda:fix\": `${fmt} --write sda && ${lint} --fix --format default sda`,\n \"sda:docs\": `${prefix}setup-data-project --docs`,\n \"sda:preview\": `${prefix}sda-preview`,\n };\n}\n","import { existsSync, lstatSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport function createFolderStructure(selectedPackages: string[]) {\n const sdaFolder = \"sda\";\n const folders = [\"data\", \"helpers\", \"output\", \"test\"];\n\n if (!existsSync(sdaFolder)) {\n mkdirSync(sdaFolder, { recursive: true });\n }\n\n for (const folder of folders) {\n const path = join(sdaFolder, folder);\n if (!existsSync(path)) {\n mkdirSync(path, { recursive: true });\n }\n }\n\n const mainTsPath = join(sdaFolder, \"main.ts\");\n\n let mainTsContent = 'console.log(\"Hello simple-data-analysis!\");\\n';\n\n if (\n selectedPackages.includes(\"@nshiab/simple-data-analysis\") ||\n selectedPackages.includes(\"@nshiab/simple-data-analysis-core\")\n ) {\n const pkg = selectedPackages.includes(\"@nshiab/simple-data-analysis\")\n ? \"@nshiab/simple-data-analysis\"\n : \"@nshiab/simple-data-analysis-core\";\n mainTsContent = `import { SimpleDB } from \"${pkg}\";\n\nconst sdb = new SimpleDB();\nconst table = sdb.newTable();\n\nawait table.loadArray([{ message: \"Hello simple-data-analysis!\" }]).log();\n\nawait sdb.close();\n`;\n }\n\n if (lstatSync(mainTsPath, { throwIfNoEntry: false }) === undefined) {\n writeFileSync(mainTsPath, mainTsContent);\n }\n\n return sdaFolder;\n}\n","import { lstatSync, writeFileSync } from \"node:fs\";\n\nexport function ensureEnvFile() {\n if (lstatSync(\".env\", { throwIfNoEntry: false }) === undefined) {\n writeFileSync(\".env\", \"\");\n }\n}\n","import type { PackageDocs } from \"./fetchPackageDocs.ts\";\nimport { ensureManagedSection } from \"./ensureManagedSection.ts\";\nimport { getInstalledPackageConfigs } from \"./packageRegistry.ts\";\nimport type { Runtime } from \"./getRuntime.ts\";\nexport function ensureAgents(\n docsMapping: Record<string, PackageDocs>,\n runtime: Runtime,\n installedPackages: string[] = Object.keys(docsMapping),\n) {\n const run = runtime === \"bun\" ? \"bun run\" : \"npm run\";\n const previewOverride = `${run} sda:preview${runtime === \"node\" ? \" --\" : \"\"} --dir src/report`;\n const setup = `${runtime === \"bun\" ? \"bunx --bun\" : \"npx\"} @nshiab/setup-data-project`;\n const analysisPackage = [\n \"@nshiab/simple-data-analysis\",\n \"@nshiab/simple-data-analysis-core\",\n ].find((pkg) => installedPackages.includes(pkg));\n const hasPlot = installedPackages.includes(\"@observablehq/plot\");\n const analysisGuidance = analysisPackage\n ? `Use \\`${analysisPackage}\\` for loading, cleaning, joining, and aggregating data, and for other transformations.`\n : `If the task needs data processing or transformation, suggest \\`${setup} --sda\\` to install Simple Data Analysis${hasPlot ? \"\" : \" with Observable Plot\"} and download versioned documentation.`;\n const chartGuidance = hasPlot\n ? `Otherwise, use the installed Observable Plot.\n\nWhen using Observable Plot, copy \\`dist/plot.umd.min.js\\` from the installed \\`@observablehq/plot\\` package and \\`dist/d3.min.js\\` from its installed \\`d3\\` dependency into the site folder. Look for both packages in \\`node_modules/\\`, including Plot's nested dependencies if D3 is not at the top level. Use relative script URLs to load D3 before Plot.`\n : `Otherwise, suggest \\`${setup} --sda\\` to install Simple Data Analysis with Observable Plot and download their documentation. Use native browser APIs if the user prefers to keep the current dependencies.`;\n const links = getInstalledPackageConfigs(installedPackages).map((pkg) => {\n if (pkg.value === \"@observablehq/plot\")\n return `- Observable Plot charts and maps: start at \\`docs/observable-plot/llms.txt\\`, then read the relevant pages for browser charts or for use with \\`writeChart\\` and \\`writeMap\\`.`;\n return `- \\`${pkg.value}\\`: start at \\`docs/${pkg.value.slice(\"@nshiab/\".length)}/llms.txt\\`, then read the relevant API pages and examples.`;\n });\n ensureManagedSection({\n path: \"AGENTS.md\",\n name: \"agents\",\n createContent: (section) => section,\n content: `Read README.md for project guidance and package.json for the installed libraries and scripts. Use the installed libraries. Ask the user before adding a dependency.\n\nKeep changes focused on the user's request. Update README.md only when the user explicitly asks.\n\n${links.length ? `Documentation for these installed libraries is available locally:\\n\\n${links.join(\"\\n\")}\\n\\n` : \"\"}Before making changes or running project commands, run \\`${run} sda:status\\` and follow its instructions.\n\n## Data analysis\n\nDo data analysis and processing in \\`sda/\\`. ${analysisGuidance}\n\nUse \\`sda/main.ts\\` as the entry point and \\`sda/helpers/\\` for reusable helpers. Keep one function per helper file, with the file named after the function. Put source data in \\`sda/data/\\` and analysis results in \\`sda/output/\\`.\n\nSave static charts to \\`sda/output/\\` as \\`.png\\` files unless the user requests another format.\n\nAdd focused tests for error-prone transformations, reusable logic with meaningful edge cases, and bug fixes. Mirror source paths under sda/test/: for example, sda/helpers/cleanRows.ts maps to sda/test/helpers/cleanRows.test.ts. Prefer the runtime's built-in test runner.\n\nTo run the analysis once, use \\`${run} sda\\`. It fixes and checks code before running the analysis. If the analysis watcher is running, this command requests a run from the watcher and returns its output and exit code when it finishes.\n\nWatch mode captures analysis output through pipes and prints it live. Check whether the output stream is a terminal before using features such as cursor control or interactive progress displays.\n\nRun \\`${run} sda:clean\\` only when cached results and temporary files can be discarded.\n\nBefore 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\n## Web projects\n\nDefault to a simple single page focused on the user's request. You don't need to build a full website; focus on the components that meet the user's needs.\n\nIf the user asks for a web page, dashboard, or interactive visualization, create \\`src/site/\\` for the site unless the project calls for a different folder. Put \\`index.html\\` at the root of the site folder, keep all site assets inside it, and use relative URLs for local files so the folder can be uploaded directly to a static host. Use HTML, CSS, and vanilla JavaScript unless the user specifies a different stack.\n\nWhen the site needs data, prepare it in \\`sda/\\` and export only the data the site needs into the site folder, in a browser-readable format such as JSON. Load that export from the page and use browser JavaScript to render it and handle interactions such as filtering or highlighting.\n\nAdd web dependencies only when the user explicitly requests them. For charts, use the user's chosen library. ${chartGuidance}\n\nIn \\`package.json\\`, add a script that runs \\`${run} sda:preview\\`. Use \\`sda:dash\\` for a dashboard, \\`sda:interactive\\` for a standalone interactive visualization, or \\`sda:web\\` for other web pages. For a different site folder, pass its path with \\`--dir\\`, for example \\`${previewOverride}\\`. Reuse an existing alias if it runs the same command. If the preferred name is taken, preserve the existing script and choose an unused name.\n\nRun the alias to start the preview server, open the local URL it prints in a browser, and check the page and its interactions. The preview serves and watches only the site folder and refreshes the browser when its files change. Share the alias command and local URL with the user.\n\nThe \\`sda:fix\\`, \\`sda:test\\`, \\`sda:watch\\`, and \\`sda:test:watch\\` scripts target analysis code in \\`sda/\\`. Use the browser preview to verify web changes. When adding automated web tests at the user's request or to cover complex behavior, create \\`src/test/\\` and add a matching \\`package.json\\` script such as \\`sda:dash:test\\` that runs only the web tests using the project's test runner.`,\n });\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isObject } from \"./jsonObject.ts\";\nexport class ProjectManifest {\n #config: Record<string, unknown>;\n private constructor(config: Record<string, unknown>) {\n this.#config = config;\n }\n static open(): ProjectManifest {\n if (!existsSync(\"package.json\"))\n return new ProjectManifest({ name: \"data-project\", private: true, type: \"module\" });\n const config: unknown = JSON.parse(readFileSync(\"package.json\", \"utf8\"));\n if (!isObject(config)) throw new Error(\"package.json must contain a JSON object.\");\n return new ProjectManifest(config);\n }\n reload(): void {\n this.#config = ProjectManifest.open().#config;\n }\n getInstalledPackages(): string[] {\n return Object.keys(this.getInstalledPackageSpecifiers());\n }\n getInstalledPackageSpecifiers(): Record<string, string> {\n const packages: Record<string, string> = {};\n for (const key of [\"dependencies\", \"devDependencies\"]) {\n const dependencies = this.#config[key];\n if (isObject(dependencies))\n for (const [name, version] of Object.entries(dependencies)) {\n if (typeof version === \"string\") packages[name] = version;\n }\n }\n return packages;\n }\n updateTasks(tasks: Record<string, string>): void {\n if (this.#config.type === \"commonjs\") {\n throw new Error(\n 'Setup requires an ESM project. Set \"type\": \"module\" in package.json, or use --docs to refresh documentation only.',\n );\n }\n if (this.#config.type === undefined) this.#config.type = \"module\";\n const existing = this.#config.scripts;\n this.#config.scripts = { ...tasks, ...(isObject(existing) ? existing : {}) };\n writeFileSync(\"package.json\", JSON.stringify(this.#config, null, 2) + \"\\n\");\n }\n}\n","import { log } from \"@clack/prompts\";\nimport {\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join, posix } from \"node:path\";\nimport { x } from \"tar\";\nimport { DOCUMENTED_PACKAGES } from \"./packageRegistry.ts\";\nexport interface PackageDocs {\n readme?: string;\n index?: string;\n llm?: string;\n plot?: { version: string; pages: string[] };\n}\nexport async function fetchPackageDocs(pkg: string, version: string): Promise<PackageDocs> {\n const config = DOCUMENTED_PACKAGES.find(\n (item) => item.value === pkg && item.value.startsWith(\"@nshiab/\"),\n );\n if (!config || !/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(version))\n throw new Error(`Unsupported package or version: ${pkg}@${version}`);\n const repo = pkg.slice(\"@nshiab/\".length);\n mkdirSync(\"docs\", { recursive: true });\n const staging = mkdtempSync(join(\"docs\", \".download-\"));\n const contents = join(staging, \"contents\");\n const target = join(\"docs\", repo);\n const backup = join(staging, \"previous\");\n try {\n const url = `https://github.com/nshiab/${repo}/releases/download/v${version}/documentation.tar.gz`;\n const response = await fetch(url);\n if (!response.ok) throw new Error(`HTTP ${response.status} from ${url}`);\n const archive = join(staging, \"documentation.tar.gz\");\n writeFileSync(archive, Buffer.from(await response.arrayBuffer()));\n mkdirSync(contents);\n let unsafeEntry: string | undefined;\n await x({\n file: archive,\n cwd: contents,\n strict: true,\n preservePaths: false,\n filter(path, entry) {\n const normalized = posix.normalize(path);\n if (\n path.includes(\"\\\\\") ||\n path.startsWith(\"/\") ||\n normalized === \"..\" ||\n normalized.startsWith(\"../\") ||\n !(\"type\" in entry) ||\n ![\"File\", \"Directory\"].includes(entry.type)\n ) {\n unsafeEntry = path;\n return false;\n }\n return true;\n },\n });\n if (unsafeEntry !== undefined) throw new Error(`Unsafe archive entry: ${unsafeEntry}`);\n for (const path of [\"README.md\", \"LICENSE\", \"llms.txt\", \"docs\"]) {\n if (!existsSync(join(contents, path)))\n throw new Error(`Documentation archive is missing ${path}.`);\n }\n const readme = readFileSync(join(contents, \"README.md\"), \"utf8\");\n const index = readFileSync(join(contents, \"llms.txt\"), \"utf8\");\n if (existsSync(target)) renameSync(target, backup);\n try {\n renameSync(contents, target);\n } catch (error) {\n if (existsSync(backup)) renameSync(backup, target);\n throw error;\n }\n return { readme, index };\n } catch (error) {\n log.warn(\n `Could not refresh ${pkg}@${version}: ${String(error)} Existing documentation was preserved and may be stale. Run the docs script again after resolving the error.`,\n );\n return {};\n } finally {\n rmSync(staging, { recursive: true, force: true });\n }\n}\n","// Plot's source is VitePress Markdown. Keep examples as reference material,\n// but remove the website UI and turn its custom containers into ordinary text.\nexport function cleanPlotMarkdown(content: string): string {\n const preserved: string[] = [];\n const keep = (value: string) => {\n preserved.push(value);\n return `\\uE000PLOT${preserved.length - 1}\\uE000`;\n };\n const lines = content.split(\"\\n\");\n const prose: string[] = [];\n for (let index = 0; index < lines.length; index++) {\n if (/^\\s*<!--/.test(lines[index])) {\n const start = index;\n while (!lines[index].includes(\"-->\") && index + 1 < lines.length) index++;\n prose.push(lines.slice(start, index + 1).join(\"\\n\"));\n continue;\n }\n const opening = lines[index].match(/^ {0,3}(`{3,}|~{3,})(.*)$/);\n if (!opening) {\n prose.push(lines[index]);\n continue;\n }\n const start = index;\n while (++index < lines.length) {\n const closing = lines[index].match(/^ {0,3}(`{3,}|~{3,})\\s*$/);\n if (closing?.[1][0] === opening[1][0] && closing[1].length >= opening[1].length) break;\n }\n if (index >= lines.length) throw new Error(\"Unclosed Plot code fence.\");\n const block = lines.slice(start, index + 1);\n if (opening[2].trim() === \"js-vue\") {\n block[0] = `${opening[1]}text`;\n prose.push(\n keep(\n \"Interactive example template (values in `{{…}}` come from the upstream website):\\n\\n\" +\n block.join(\"\\n\"),\n ),\n );\n } else {\n prose.push(keep(block.join(\"\\n\")));\n }\n }\n let result = prose\n .join(\"\\n\")\n .replace(/<script\\b[^>]*>([\\s\\S]*?)<\\/script>/g, (_match: string, code: string) => {\n const fence = \"`\".repeat(\n Math.max(3, ...[...code.matchAll(/`+/g)].map((match) => match[0].length + 1)),\n );\n return keep(\n `**Upstream example setup.** This code may use Vue and sample data from the linked source page.\\n\\n${fence}js\\n${code.trim()}\\n${fence}`,\n );\n })\n .replace(/^[ \\t]*<!--(?!\\s*setup-data-project:)[\\s\\S]*?-->/gm, \"\")\n .replace(\n /<\\/?[A-Za-z](?:\"[^\"]*\"|'[^']*'|[^'\"><])*>|(`+)[^`\\n]*?\\1/g,\n (part: string, fence: string | undefined) => (fence ? keep(part) : part),\n )\n .replace(/<style\\b[^>]*>[\\s\\S]*?<\\/style>/g, \"\")\n .replace(/<p\\b[^>]*>([\\s\\S]*?)<\\/p>/g, (_match: string, body: string) =>\n /<(?:input|select|label)\\b/.test(body) ? \"\" : body,\n )\n .replace(/<PlotRender\\b[\\s\\S]*?\\/>/g, (component) => {\n const options = component.match(/:options=([\"'])([\\s\\S]*?)\\1/)?.[2];\n const method = component.match(/\\bmethod=[\"'](\\w+)[\"']/)?.[1] ?? \"plot\";\n if (!options) throw new Error(\"Unrecognized PlotRender example.\");\n return keep(`\\`\\`\\`js\\nPlot.${method}(${options});\\n\\`\\`\\``);\n })\n .replace(/<VersionBadge\\b[\\s\\S]*?\\/>/g, (badge) => {\n const version = badge.match(/\\bversion=[\"']([^\"']+)[\"']/)?.[1];\n return version ? `(since v${version})` : \"\";\n })\n .replace(/<\\/?span\\b(?:\"[^\"]*\"|'[^']*'|[^'\">])*>/g, \"\")\n .replace(/<svg\\b[\\s\\S]*?<\\/svg>/g, \"arrow\");\n result = result\n .replace(/^[ \\t]*:::plot\\b([^\\n]*)/gm, (_match: string, options: string) => {\n const url = options.match(/https?:\\/\\/\\S+/)?.[0];\n return url ? `[Interactive example](${url})\\n` : \"\";\n })\n .replace(\n /^([ \\t]*):::(tip|info|warning)\\b[ \\t]*/gm,\n (_match: string, indent: string, kind: string) =>\n `${indent}**${kind[0].toUpperCase() + kind.slice(1)}:** `,\n )\n .replace(/^[ \\t]*:::[ \\t]*$/gm, \"\")\n .replace(/[ \\t]+:::[ \\t]*$/gm, \"\")\n .replace(\n /\\{\\{([\\s\\S]*?)\\}\\}/g,\n (_match: string, expression: string) => `\\`${expression.trim().replace(/\\s+/g, \" \")}\\``,\n )\n .replace(/[ \\t]+$/gm, \"\")\n .replace(/\\n{3,}/g, \"\\n\\n\")\n .trim();\n return (\n result.replace(\n /\\uE000PLOT(\\d+)\\uE000/g,\n (_match: string, index: string) => preserved[Number(index)],\n ) + \"\\n\"\n );\n}\n","// This release was published with an extra dot in its Git tag.\n// Keep source links and downloads aligned with the actual upstream tag.\nexport function getPlotTag(version: string): string {\n return version === \"0.6.18\" ? `v.${version}` : `v${version}`;\n}\n","import { cleanPlotMarkdown } from \"./cleanPlotMarkdown.ts\";\nimport { posix } from \"node:path\";\nimport { getPlotTag } from \"./getPlotTag.ts\";\n\n// The Plot source uses ATX headings, explicit VitePress IDs, and Markdown fences.\n// Keep code verbatim; rewrite only prose links and anchors while joining pages.\nexport function combinePlotDocs(version: string, documents: Map<string, string>): string {\n const pages = [...documents.keys()].sort();\n const tag = getPlotTag(version);\n const source = `https://github.com/observablehq/plot/tree/${tag}/docs`;\n const anchors = new Map<string, Map<string, string>>();\n const sections = new Map<string, { line: number; title: string; id: string }[]>();\n const pageId = (page: string) => `plot-${page.replace(/\\.md$/, \"\").replaceAll(\"/\", \"--\")}`;\n\n for (const page of pages) {\n const ids = new Map<string, string>();\n const headings: { line: number; title: string; id: string }[] = [];\n const counts = new Map<string, number>();\n proseLines(documents.get(page) ?? \"\", (line, number) => {\n for (const match of line.matchAll(/\\bid=[\"']([^\"']+)[\"']/g)) {\n ids.set(match[1], `${pageId(page)}--${match[1]}`);\n }\n const heading = line.match(/^ {0,3}#{1,6}\\s+(.+?)\\s*#*\\s*$/);\n if (!heading) return line;\n const explicit = heading[1].match(/\\{#([^}]+)\\}/)?.[1];\n const title = heading[1].replace(/\\s*\\{#[^}]+\\}/g, \"\");\n const slug =\n explicit ??\n title\n .replace(/<[^>]*>/g, \"\")\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}_\\s-]/gu, \"\")\n .trim()\n .replace(/\\s+/g, \"-\");\n const count = counts.get(slug) ?? 0;\n counts.set(slug, count + 1);\n const localId = `${slug}${count ? `-${count}` : \"\"}`;\n const id = `${pageId(page)}--${localId}`;\n ids.set(localId, id);\n headings.push({ line: number, title, id });\n return line;\n });\n anchors.set(page, ids);\n sections.set(page, headings);\n }\n\n function link(target: string, page: string): string {\n if (/^(?:[a-z][a-z\\d+.-]*:|\\/\\/)/i.test(target)) return target;\n const [pathAndQuery, fragment] = target.split(\"#\", 2);\n const path = pathAndQuery.split(\"?\", 1)[0];\n const resolved =\n path === \"\"\n ? page\n : posix.normalize(\n path.startsWith(\"/\") ? path.slice(1) : posix.join(posix.dirname(page), path),\n );\n const markdown = [resolved, `${resolved}.md`, `${resolved}/index.md`].find((candidate) =>\n documents.has(candidate),\n );\n if (markdown) {\n const id = fragment\n ? anchors.get(markdown)?.get(decodeURIComponent(fragment))\n : pageId(markdown);\n if (id) return `#${id}`;\n // Preserve an upstream target when a fragment is not a known heading/ID.\n return `${source}/${markdown}${fragment ? `#${fragment}` : \"\"}`;\n }\n if (resolved.endsWith(\".md\")) {\n return `${source}/${resolved}${fragment ? `#${fragment}` : \"\"}`;\n }\n const base = \"https://raw.githubusercontent.com/observablehq/plot/\" + `refs/tags/${tag}/docs/`;\n return path.startsWith(\"/\")\n ? new URL(`public${target}`, base).href\n : new URL(target, `${base}${page}`).href;\n }\n\n const contents = pages\n .flatMap((page) => [\n `- [${page}](#${pageId(page)})`,\n ...(sections.get(page) ?? []).map(\n ({ title, id }) => ` - [${title.replace(/[[\\]]/g, \"\")}](#${id})`,\n ),\n ])\n .join(\"\\n\");\n const combined = pages\n .map((page) => {\n const headings = new Map(\n (sections.get(page) ?? []).map((heading) => [heading.line, heading]),\n );\n const body = proseLines(documents.get(page) ?? \"\", (line, number) => {\n const heading = headings.get(number);\n // Inline code also remains verbatim. Plot's prose links have simple destinations.\n line = line\n .split(/(`+[^`]*`+)/g)\n .map((part, index) => {\n if (index % 2) return part;\n return part\n .replace(\n /(\\]\\()([^\\s)]+)([^)]*\\))/g,\n (_match: string, before: string, target: string, after: string) =>\n `${before}${link(target, page)}${after}`,\n )\n .replace(\n /^( {0,3}\\[[^\\]]+\\]:\\s*)(\\S+)/,\n (_match: string, before: string, target: string) =>\n `${before}${link(target, page)}`,\n )\n .replace(\n /(?<!:)\\b(href|src)=([\"'])([^\"']+)\\2/g,\n (_match: string, attr: string, quote: string, target: string) =>\n `${attr}=${quote}${link(target, page)}${quote}`,\n )\n .replace(\n /\\bid=([\"'])([^\"']+)\\1/g,\n (_match: string, quote: string, id: string) =>\n `id=${quote}${anchors.get(page)?.get(id) ?? id}${quote}`,\n );\n })\n .join(\"\");\n return heading\n ? `<a id=\"${heading.id}\"></a>\\n\\n${line.replace(/\\s*\\{#[^}]+\\}/g, \"\")}`\n : line;\n });\n return `<a id=\"${pageId(page)}\"></a>\\n\\n# ${page}\\n\\nSource: ${source}/${page}\\n\\n${body}`;\n })\n .join(\"\\n\\n---\\n\\n\");\n return cleanPlotMarkdown(\n `# Observable Plot ${version}\\n\\nPackage: \\`@observablehq/plot@${version}\\`. Source: [${tag}](${source}).\\n\\nThis reference combines selected upstream documentation for static charts and maps. Introductory and site pages, interaction helpers, and the Auto and Tip marks are omitted. Website controls are omitted; upstream setup and interactive templates are labeled as reference code. Use the table of contents to find API signatures and examples; links to omitted pages lead to the tagged upstream documentation.\\n\\n## Table of contents\\n\\n${contents}\\n\\n---\\n\\n${combined}\\n\\n<!-- setup-data-project:observable-plot:${version}:complete -->\\n`,\n );\n}\n\nexport function proseLines(\n content: string,\n transform: (line: string, number: number) => string,\n): string {\n let fence: { character: string; length: number } | undefined;\n let script = false;\n return content\n .split(\"\\n\")\n .map((line, number) => {\n const marker = line.match(/^ {0,3}(`{3,}|~{3,})/);\n if (fence) {\n if (\n marker?.[1][0] === fence.character &&\n marker[1].length >= fence.length &&\n /^ {0,3}(?:`+|~+)\\s*$/.test(line)\n )\n fence = undefined;\n return line;\n }\n if (marker) {\n fence = { character: marker[1][0], length: marker[1].length };\n return line;\n }\n if (/^\\s*<script\\b/.test(line)) script = true;\n if (script) {\n if (/<\\/script>/.test(line)) script = false;\n return line;\n }\n return transform(line, number);\n })\n .join(\"\\n\");\n}\n","// Static chart creation references. Keep this explicit so new upstream pages do\n// not silently expand the installed agent reference.\nexport const PLOT_DOC_PAGES: string[] = [\n \"features/plots.md\",\n \"features/marks.md\",\n \"features/scales.md\",\n \"features/projections.md\",\n \"features/legends.md\",\n \"features/facets.md\",\n \"features/formats.md\",\n \"features/curves.md\",\n \"transforms/bin.md\",\n \"transforms/group.md\",\n \"transforms/stack.md\",\n \"transforms/normalize.md\",\n \"transforms/centroid.md\",\n \"transforms/sort.md\",\n \"marks/area.md\",\n \"marks/arrow.md\",\n \"marks/axis.md\",\n \"marks/bar.md\",\n \"marks/bollinger.md\",\n \"marks/box.md\",\n \"marks/cell.md\",\n \"marks/contour.md\",\n \"marks/delaunay.md\",\n \"marks/density.md\",\n \"marks/difference.md\",\n \"marks/dot.md\",\n \"marks/frame.md\",\n \"marks/geo.md\",\n \"marks/grid.md\",\n \"marks/hexgrid.md\",\n \"marks/image.md\",\n \"marks/line.md\",\n \"marks/linear-regression.md\",\n \"marks/link.md\",\n \"marks/raster.md\",\n \"marks/rect.md\",\n \"marks/rule.md\",\n \"marks/text.md\",\n \"marks/tick.md\",\n \"marks/tree.md\",\n \"marks/vector.md\",\n \"marks/waffle.md\",\n].sort();\n","import { cleanPlotMarkdown } from \"./cleanPlotMarkdown.ts\";\nimport { posix } from \"node:path\";\nimport { proseLines } from \"./combinePlotDocs.ts\";\nimport { PLOT_DOC_PAGES } from \"./plotDocPages.ts\";\nimport { getPlotTag } from \"./getPlotTag.ts\";\n\n// Split the cached format without changing code examples or heading anchors.\nexport function splitPlotDocs(reference: string, version: string): Map<string, string> {\n const sections = [\n ...reference.matchAll(\n /<a id=\"(plot-[^\"]+)\"><\\/a>\\n\\n# ([^\\n]+\\.md)\\n\\nSource:\\s+([^\\s]+)\\n\\n/g,\n ),\n ];\n const files = new Map<string, string>();\n const anchors = new Map<string, string>();\n const source = `https://github.com/observablehq/plot/tree/${getPlotTag(version)}/docs`;\n const completion = `<!-- setup-data-project:observable-plot:${version}:complete -->`;\n if (!reference.trimEnd().endsWith(completion)) throw new Error(\"Incomplete Plot reference.\");\n const end = reference.lastIndexOf(completion);\n const licenseStart = reference.lastIndexOf(\"\\n## Upstream license\\n\", end);\n for (let index = 0; index < sections.length; index++) {\n const section = sections[index];\n const page = section[2];\n if (!PLOT_DOC_PAGES.includes(page) || files.has(page) || section[3] !== `${source}/${page}`)\n throw new Error(`Invalid Plot page: ${page}`);\n const body = reference\n .slice(section.index, sections[index + 1]?.index ?? (licenseStart >= 0 ? licenseStart : end))\n .trimEnd()\n .replace(/\\n\\n---$/, \"\");\n files.set(page, body);\n proseLines(body, (line) => {\n for (const match of line.matchAll(/\\bid=[\"']([^\"']+)[\"']/g)) anchors.set(match[1], page);\n return line;\n });\n }\n if (files.size !== PLOT_DOC_PAGES.length) throw new Error(\"Incomplete Plot pages.\");\n\n for (const [page, body] of files) {\n const link = (id: string) => {\n const destination = anchors.get(id);\n return destination && destination !== page\n ? `${posix.relative(posix.dirname(page), destination)}#${id}`\n : `#${id}`;\n };\n files.set(\n page,\n cleanPlotMarkdown(\n proseLines(body, (line) =>\n line\n .split(/(`+[^`]*`+)/g)\n .map((part, index) =>\n index % 2\n ? part\n : part\n .replace(\n /(\\]\\()#([^\\s)]+)([^)]*\\))/g,\n (_match: string, before: string, id: string, after: string) =>\n `${before}${link(id)}${after}`,\n )\n .replace(\n /^( {0,3}\\[[^\\]]+\\]:\\s*)#(\\S+)/,\n (_match: string, before: string, id: string) => `${before}${link(id)}`,\n )\n .replace(\n /(?<!:)\\b(href|src)=([\"'])#([^\"']+)\\2/g,\n (_match: string, attr: string, quote: string, id: string) =>\n `${attr}=${quote}${link(id)}${quote}`,\n ),\n )\n .join(\"\"),\n ),\n ),\n );\n }\n const license =\n licenseStart >= 0\n ? reference.slice(licenseStart + \"\\n## Upstream license\\n\".length, end).trim()\n : undefined;\n if (license) files.set(\"LICENSE\", license + \"\\n\");\n const index =\n `# Observable Plot ${version}\\n\\n> Selected documentation for static charts and maps. Start here, then read the relevant pages.\\n\\n[Versioned upstream documentation](${source})${license ? \" · [License](./LICENSE)\" : \"\"}\\n\\n` +\n [\"features\", \"marks\", \"transforms\"]\n .map(\n (group) =>\n `## ${group[0].toUpperCase() + group.slice(1)}\\n\\n` +\n PLOT_DOC_PAGES.filter((page) => page.startsWith(`${group}/`))\n .map((page) => `- [${page}](./${page})`)\n .join(\"\\n\"),\n )\n .join(\"\\n\\n\") +\n \"\\n\";\n files.set(\"llms.txt\", index);\n return files;\n}\n","import { log } from \"@clack/prompts\";\nimport { existsSync, mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { splitPlotDocs } from \"./splitPlotDocs.ts\";\nimport { combinePlotDocs } from \"./combinePlotDocs.ts\";\nimport { PLOT_DOC_PAGES } from \"./plotDocPages.ts\";\nimport { getPlotTag } from \"./getPlotTag.ts\";\nimport type { PackageDocs } from \"./fetchPackageDocs.ts\";\n\n// Replace local documentation only after every page is ready.\nexport async function fetchPlotDocs(\n version: string,\n options: { preferStored?: boolean } = {},\n): Promise<PackageDocs> {\n const tag = getPlotTag(version);\n const directory = join(\"docs\", \"observable-plot\");\n try {\n let llm: string | undefined;\n if (options.preferStored !== false) {\n try {\n const response = await fetch(\n \"https://raw.githubusercontent.com/nshiab/setup-data-project/\" +\n `refs/heads/main/docs-cache/observable-plot/${version}/llm.md`,\n );\n if (response.ok) {\n const cached = await response.text();\n if (isStoredReference(cached, version)) llm = cached;\n }\n } catch {\n // A cache is an optimization. An unavailable cache never blocks the tag.\n }\n }\n if (llm === undefined) llm = await generatePlotReference(version);\n const files = splitPlotDocs(llm, version);\n mkdirSync(\"docs\", { recursive: true });\n const staging = mkdtempSync(join(\"docs\", \".plot-\"));\n const contents = join(staging, \"contents\");\n const backup = join(staging, \"previous\");\n try {\n for (const [page, content] of files) {\n const path = join(contents, page);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, content);\n }\n if (existsSync(directory)) renameSync(directory, backup);\n try {\n renameSync(contents, directory);\n } catch (error) {\n if (existsSync(backup)) renameSync(backup, directory);\n throw error;\n }\n } finally {\n rmSync(staging, { recursive: true, force: true });\n }\n return { llm, index: files.get(\"llms.txt\"), plot: { version, pages: [...PLOT_DOC_PAGES] } };\n } catch (error) {\n log.warn(\n `Could not fetch complete Observable Plot documentation for ${tag}. ` +\n \"Existing files were preserved, but may not match the installed \" +\n \"version. Resolve the refresh failure before using this reference. \" +\n String(error),\n );\n return {};\n }\n}\n\nexport async function generatePlotReference(version: string): Promise<string> {\n if (!/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$/.test(version))\n throw new Error(\"An exact Plot version is required.\");\n const tag = getPlotTag(version);\n const pages = PLOT_DOC_PAGES;\n const documents = new Map<string, string>();\n const failed: string[] = [];\n // Fetch in small batches to avoid overwhelming GitHub on the first run.\n for (let offset = 0; offset < pages.length; offset += 8) {\n await Promise.all(\n pages.slice(offset, offset + 8).map(async (page) => {\n try {\n const url =\n \"https://raw.githubusercontent.com/observablehq/plot/\" +\n `refs/tags/${tag}/docs/${page}`;\n const response = await fetch(url);\n if (!response.ok) throw new Error(`HTTP ${response.status}`);\n const content = await response.text();\n documents.set(page, content);\n } catch {\n failed.push(page);\n }\n }),\n );\n }\n\n if (failed.length > 0) {\n throw new Error(`Could not fetch ${failed.length} Markdown pages`);\n }\n const response = await fetch(\n `https://raw.githubusercontent.com/observablehq/plot/refs/tags/${tag}/LICENSE`,\n );\n if (!response.ok) throw new Error(`Could not fetch Plot's license: HTTP ${response.status}`);\n const license = await response.text();\n const completion = `<!-- setup-data-project:observable-plot:${version}:complete -->`;\n return combinePlotDocs(version, documents).replace(\n completion,\n `## Upstream license\\n\\n${license.trim()}\\n\\n${completion}`,\n );\n}\n\nfunction isStoredReference(content: string, version: string): boolean {\n const tag = getPlotTag(version);\n const source = `https://github.com/observablehq/plot/tree/${tag}/docs`;\n const metadata = content.split(/\\n\\s*\\n/)[1]?.replace(/\\s+/g, \" \");\n if (\n !content.startsWith(`# Observable Plot ${version}\\n\\n`) ||\n metadata !== `Package: \\`@observablehq/plot@${version}\\`. Source: [${tag}](${source}).` ||\n !content.trimEnd().endsWith(`<!-- setup-data-project:observable-plot:${version}:complete -->`)\n )\n return false;\n\n // Match actual page sections, not TOC entries. Require every selected page\n // exactly once and some upstream heading/content after its source record.\n const sections = [\n ...content.matchAll(/<a id=\"(plot-[^\"]+)\"><\\/a>\\n\\n# ([^\\n]+\\.md)\\n\\nSource:\\s+([^\\s]+)\\n\\n/g),\n ];\n if (sections.length !== PLOT_DOC_PAGES.length) return false;\n const found = new Set<string>();\n for (let index = 0; index < sections.length; index++) {\n const section = sections[index];\n const page = section[2];\n const id = `plot-${page.replace(/\\.md$/, \"\").replaceAll(\"/\", \"--\")}`;\n if (\n !PLOT_DOC_PAGES.includes(page) ||\n found.has(page) ||\n section[1] !== id ||\n section[3] !== `${source}/${page}`\n )\n return false;\n const body = content.slice(section.index + section[0].length, sections[index + 1]?.index);\n if (!/^#{1,6}\\s+\\S/m.test(body)) return false;\n found.add(page);\n }\n return true;\n}\n","import { log } from \"@clack/prompts\";\nimport { fetchPackageDocs, type PackageDocs } from \"./fetchPackageDocs.ts\";\nimport { fetchPlotDocs } from \"./fetchPlotDocs.ts\";\nimport { getInstalledPackageConfigs } from \"./packageRegistry.ts\";\nexport async function syncPackageDocs(\n installedPackages: string[],\n installedVersions: Record<string, string>,\n): Promise<Record<string, PackageDocs>> {\n const mapping: Record<string, PackageDocs> = {};\n for (const pkg of getInstalledPackageConfigs(installedPackages)) {\n const version = installedVersions[pkg.value];\n if (!version) {\n log.warn(\n `Could not determine the installed version of ${pkg.value}. Install the project dependencies, then run the docs script again. Existing documentation may be stale.`,\n );\n continue;\n }\n const docs =\n pkg.value === \"@observablehq/plot\"\n ? await fetchPlotDocs(version)\n : await fetchPackageDocs(pkg.value, version);\n if (docs.index !== undefined || docs.plot) mapping[pkg.value] = docs;\n }\n return mapping;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { isObject } from \"./jsonObject.ts\";\nexport function getInstalledPackageVersions(\n packageSpecifiers: Record<string, string>,\n): Record<string, string> {\n const versions: Record<string, string> = {};\n for (const pkg of Object.keys(packageSpecifiers)) {\n const path = join(\"node_modules\", pkg, \"package.json\");\n if (!existsSync(path)) continue;\n const config: unknown = JSON.parse(readFileSync(path, \"utf8\"));\n if (\n isObject(config) &&\n typeof config.version === \"string\" &&\n /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(config.version)\n )\n versions[pkg] = config.version;\n }\n return versions;\n}\n","import { SUPPORTED_PACKAGES } from \"./packageRegistry.ts\";\n\nexport interface CliOptions {\n help: boolean;\n docs: boolean;\n packages: string[];\n}\n\nconst packageFlags = new Map(\n SUPPORTED_PACKAGES.map((pkg) => [\n `--${pkg.label.replace(/^simple-data-analysis/, \"sda\").replace(/^journalism-/, \"\")}`,\n pkg.value,\n ]),\n);\n\nexport const CLI_HELP = `Usage: setup-data-project [library flags | --docs] [--help]\n\n${Array.from(packageFlags, ([flag, pkg]) => ` ${flag.padEnd(16)} Select ${pkg}.`).join(\"\\n\")}\n --docs Refresh documentation only for installed libraries.\n -h, --help Show this help and exit.\n\nWithout a package flag, choose packages interactively.\nCombine package flags to select libraries without prompting.\nPackage flags install or update selected libraries to latest without prompting,\nand still set up project files and docs.`;\n\nexport function parseArguments(args: string[]): CliOptions {\n const options: CliOptions = { help: false, docs: false, packages: [] };\n\n for (const arg of args) {\n const pkg = packageFlags.get(arg);\n if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (arg === \"--docs\") {\n options.docs = true;\n } else if (pkg) {\n if (!options.packages.includes(pkg)) options.packages.push(pkg);\n } else {\n throw new Error(`Unknown argument: ${arg}. Use --help for usage.`);\n }\n }\n\n if (options.docs && options.packages.length > 0)\n throw new Error(\"--docs cannot be combined with package flags.\");\n return options;\n}\n","#!/usr/bin/env node\nimport { cancel, intro, isCancel, multiselect, outro, select, spinner } from \"@clack/prompts\";\nimport process from \"node:process\";\nimport { execFileSync } from \"node:child_process\";\n\nimport { getRuntime } from \"./helpers/getRuntime.ts\";\nimport { PACKAGE_OPTIONS } from \"./helpers/packageOptions.ts\";\nimport { ensureGitignore } from \"./helpers/ensureGitignore.ts\";\nimport { ensureReadme } from \"./helpers/ensureReadme.ts\";\nimport { ensureTooling } from \"./helpers/ensureTooling.ts\";\nimport { ensureVscode } from \"./helpers/ensureVscode.ts\";\nimport { runPackageManager, installPackages } from \"./helpers/installPackages.ts\";\nimport { getProjectTasks } from \"./helpers/getProjectTasks.ts\";\nimport { createFolderStructure } from \"./helpers/createFolderStructure.ts\";\nimport { ensureEnvFile } from \"./helpers/ensureEnvFile.ts\";\nimport { ensureAgents } from \"./helpers/ensureAgents.ts\";\nimport { getInstalledPackageConfigs } from \"./helpers/packageRegistry.ts\";\nimport { ProjectManifest } from \"./helpers/projectManifest.ts\";\nimport { syncPackageDocs } from \"./helpers/syncPackageDocs.ts\";\nimport { getInstalledPackageVersions } from \"./helpers/getInstalledPackageVersions.ts\";\nimport { CLI_HELP, parseArguments } from \"./helpers/parseArguments.ts\";\n\nasync function main() {\n const cliOptions = parseArguments(process.argv.slice(2));\n if (cliOptions.help) {\n console.log(CLI_HELP);\n return;\n }\n\n const runtime = getRuntime();\n const projectManifest = ProjectManifest.open();\n if (cliOptions.docs) {\n await refreshDocs(projectManifest);\n return;\n }\n console.log();\n intro(`Hi! 👋 (Running on ${runtime})`);\n\n const installedPackages = projectManifest.getInstalledPackages();\n const options = PACKAGE_OPTIONS.map((opt) => ({\n ...opt,\n label: installedPackages.includes(opt.value)\n ? `${opt.label} \\x1b[2m(installed)\\x1b[22m`\n : opt.label,\n }));\n\n const selectedPackages =\n cliOptions.packages.length > 0\n ? cliOptions.packages\n : await multiselect({\n message:\n \"Which libraries would you like to install?\\n\\x1b[2m(space to select, arrows to navigate, enter to confirm)\\x1b[22m\\n\",\n options,\n required: false,\n });\n\n if (isCancel(selectedPackages)) {\n cancel(\"Installation cancelled.\");\n process.exit(0);\n }\n\n const alreadyInstalled = selectedPackages.filter((pkg) => installedPackages.includes(pkg));\n\n const packagesToInstall: string[] = [];\n\n for (const pkg of selectedPackages) {\n if (alreadyInstalled.includes(pkg) && cliOptions.packages.length === 0) {\n const action = await select({\n message: `${pkg} is already installed. What would you like to do?`,\n options: [\n { value: \"skip\", label: \"Keep existing version\" },\n { value: \"update\", label: \"Update to latest\" },\n ],\n });\n\n if (isCancel(action)) {\n cancel(\"Installation cancelled.\");\n process.exit(0);\n }\n\n if (action === \"update\") {\n packagesToInstall.push(`${pkg}@latest`);\n }\n } else {\n packagesToInstall.push(`${pkg}@latest`);\n }\n }\n\n projectManifest.updateTasks(getProjectTasks(runtime));\n\n const sInstall = spinner();\n sInstall.start(\"Installing packages...\");\n\n try {\n await installPackages(packagesToInstall);\n projectManifest.reload();\n const declared = projectManifest.getInstalledPackageSpecifiers();\n if (\n projectManifest\n .getInstalledPackages()\n .some((pkg) =>\n [\"@nshiab/simple-data-analysis\", \"@nshiab/journalism-dataviz\"].includes(pkg),\n ) &&\n !declared[\"@observablehq/plot\"]\n ) {\n await installPackages([\"@observablehq/plot\"]);\n projectManifest.reload();\n }\n await ensureTooling(projectManifest);\n // Reinstall declared dependencies when a project was cloned without node_modules.\n projectManifest.reload();\n const versions = getInstalledPackageVersions(projectManifest.getInstalledPackageSpecifiers());\n if (projectManifest.getInstalledPackages().some((pkg) => !versions[pkg]))\n await runPackageManager([\"install\"]);\n } catch (error) {\n sInstall.stop(\"Package installation failed.\");\n throw error;\n }\n sInstall.stop(\"Packages installed.\");\n\n projectManifest.reload();\n const finalInstalledPackages = getInstalledPackageConfigs(\n projectManifest.getInstalledPackages(),\n ).map((pkg) => pkg.value);\n const docsMapping = await refreshDocs(projectManifest);\n\n const sConfig = spinner();\n sConfig.start(\"Preparing project files and configuration...\");\n try {\n projectManifest.updateTasks(getProjectTasks());\n execFileSync(process.execPath, [\"node_modules/oxfmt/bin/oxfmt\", \"--write\", \"package.json\"], {\n stdio: \"pipe\",\n });\n\n createFolderStructure(finalInstalledPackages);\n ensureGitignore();\n ensureEnvFile();\n ensureVscode();\n ensureReadme(runtime, finalInstalledPackages);\n ensureAgents(docsMapping, runtime, finalInstalledPackages);\n } catch (error) {\n sConfig.stop(\"Project configuration failed.\");\n throw error;\n }\n sConfig.stop(\"Project files and configuration ready.\");\n\n outro(\n process.exitCode\n ? \"Project setup complete; documentation needs attention.\"\n : \"You are all set! 🙌\",\n );\n}\n\nasync function refreshDocs(manifest: ProjectManifest) {\n const packages = getInstalledPackageConfigs(manifest.getInstalledPackages()).map(\n (pkg) => pkg.value,\n );\n const sDocs = spinner();\n sDocs.start(\"Downloading documentation...\");\n try {\n const mapping = await syncPackageDocs(\n packages,\n getInstalledPackageVersions(manifest.getInstalledPackageSpecifiers()),\n );\n if (Object.keys(mapping).length !== packages.length) {\n sDocs.stop(\"Documentation incomplete. See the warnings above.\");\n process.exitCode = 1;\n } else {\n sDocs.stop(\n packages.length > 0 ? \"Documentation downloaded.\" : \"No library documentation to download.\",\n );\n }\n return mapping;\n } catch (error) {\n sDocs.stop(\"Documentation download failed.\");\n throw error;\n }\n}\n\nmain().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`❌ Error: ${message}`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;AAEA,SAAgB,WAAW,WAA4CA,UAAQ,UAAmB;CAChG,OAAO,SAAS,MAAM,QAAQ;AAChC;;;ACGA,MAAa,qBAAsC;CACjD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,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,8BAA8B,uCACtD;EAEF,OAAO;CACT,SAAS,OAAO;EACd,MAAM,KAAK,gCAAgC;EAC3C,MAAM;CACR;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,UAAU;CACtB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,QAAQ,MAAM,YAAY,SAAS;CACnC,UAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"main.mjs","names":["process","metadata.name","metadata.version","process"],"sources":["../src/helpers/getRuntime.ts","../src/helpers/packageRegistry.ts","../src/helpers/packageOptions.ts","../src/helpers/gitignoreEntries.ts","../src/helpers/ensureGitignore.ts","../src/helpers/ensureManagedSection.ts","../src/helpers/ensureReadme.ts","../src/helpers/installPackages.ts","../package.json","../src/helpers/ensureTooling.ts","../src/helpers/ensureVscode.ts","../src/helpers/getProjectTasks.ts","../src/helpers/createFolderStructure.ts","../src/helpers/ensureEnvFile.ts","../src/helpers/ensureAgents.ts","../src/helpers/projectManifest.ts","../src/helpers/fetchPackageDocs.ts","../src/helpers/cleanPlotMarkdown.ts","../src/helpers/getPlotTag.ts","../src/helpers/combinePlotDocs.ts","../src/helpers/plotDocPages.ts","../src/helpers/splitPlotDocs.ts","../src/helpers/fetchPlotDocs.ts","../src/helpers/syncPackageDocs.ts","../src/helpers/getInstalledPackageVersions.ts","../src/helpers/parseArguments.ts","../src/main.ts"],"sourcesContent":["import process from \"node:process\";\nexport type Runtime = \"node\" | \"bun\";\nexport function getRuntime(versions: { bun?: string; node?: string } = process.versions): Runtime {\n return versions.bun ? \"bun\" : \"node\";\n}\n","export interface PackageConfig {\n value: string;\n label: string;\n type: \"sda\" | \"journalism\" | \"other\";\n hint?: string;\n}\n\nexport const SUPPORTED_PACKAGES: PackageConfig[] = [\n {\n value: \"@nshiab/simple-data-analysis\",\n label: \"simple-data-analysis\",\n type: \"sda\",\n hint: \"All the core functionality, plus methods for dataviz, AI, Google sheets, etc.\",\n },\n {\n value: \"@nshiab/simple-data-analysis-core\",\n label: \"simple-data-analysis-core\",\n type: \"sda\",\n hint: \"No fluff. Great for constrained environments, like a cheap server.\",\n },\n {\n value: \"@nshiab/journalism-ai\",\n label: \"journalism-ai\",\n type: \"journalism\",\n hint: \"Easily use AI local models with Ollama or remote models with Gemini/Vertex.\",\n },\n {\n value: \"@nshiab/journalism-google\",\n label: \"journalism-google\",\n type: \"journalism\",\n hint: \"Push and retrieve data from Google Sheets, Google Bucket, and more.\",\n },\n {\n value: \"@nshiab/journalism-web-scraping\",\n label: \"journalism-web-scraping\",\n type: \"journalism\",\n hint: \"Retrieve data from Statistics Canada tables, HTML table, download files...\",\n },\n {\n value: \"@nshiab/journalism-finance\",\n label: \"journalism-finance\",\n type: \"journalism\",\n hint: \"Retrieve financial data, calculate Canadian mortgage payments and taxes...\",\n },\n {\n value: \"@nshiab/journalism-format\",\n label: \"journalism-format\",\n type: \"journalism\",\n hint: \"Easily format dates, numbers, currencies...\",\n },\n {\n value: \"@nshiab/journalism-climate\",\n label: \"journalism-climate\",\n type: \"journalism\",\n hint: \"Retrieve data from Environment Canada APIs and more.\",\n },\n {\n value: \"@nshiab/journalism-dataviz\",\n label: \"journalism-dataviz\",\n type: \"journalism\",\n hint: \"Render charts/maps with Observable Plot or directly in the terminal.\",\n },\n {\n value: \"@nshiab/journalism-geo\",\n label: \"journalism-geo\",\n type: \"journalism\",\n hint: \"Calculate distances, transform 2D coordinates to 3D, wrangle GeoTIFF files...\",\n },\n {\n value: \"@nshiab/journalism-statistics\",\n label: \"journalism-statistics\",\n type: \"journalism\",\n hint: \"Functions for statistical tests, clustering, random path generation...\",\n },\n {\n value: \"@nshiab/journalism-web\",\n label: \"journalism-web\",\n type: \"journalism\",\n hint: \"Web related functions, including downloading data as CSV, extracting ZIP files to URLs...\",\n },\n {\n value: \"@nshiab/journalism-extras\",\n label: \"journalism-extras\",\n type: \"journalism\",\n hint: \"Functions to zip/unzip, sleep, reencode files, create nested directories...\",\n },\n];\n\n// Plot is installed alongside charting libraries, but is not a setup menu option.\nexport const DOCUMENTED_PACKAGES: PackageConfig[] = [\n ...SUPPORTED_PACKAGES,\n { value: \"@nshiab/journalism\", label: \"journalism\", type: \"journalism\" },\n { value: \"@observablehq/plot\", label: \"Observable Plot\", type: \"other\" },\n];\n\nexport function getInstalledPackageConfigs(installedPackages: string[]): PackageConfig[] {\n const installedSet = new Set(installedPackages);\n return DOCUMENTED_PACKAGES.filter((pkg) => installedSet.has(pkg.value));\n}\n","import { SUPPORTED_PACKAGES } from \"./packageRegistry.ts\";\n\nexport const PACKAGE_OPTIONS = SUPPORTED_PACKAGES.map((pkg) => ({\n value: pkg.value,\n label: pkg.label,\n hint: pkg.hint,\n}));\n","export const GITIGNORE_ENTRIES = [\n \"node_modules\",\n \"docs/\",\n \".tmp\",\n \".sda-cache\",\n \".journalism-cache\",\n \"sda/data\",\n \"sda/output\",\n \".env\",\n \".DS_Store\",\n];\n","import { lstatSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { GITIGNORE_ENTRIES } from \"./gitignoreEntries.ts\";\n\nexport const GITIGNORE_SENTINEL = \"# Added by setup-data-project. Do not remove this line.\";\n\nexport function ensureGitignore() {\n const path = \".gitignore\";\n const stats = lstatSync(path, { throwIfNoEntry: false });\n\n if (stats?.isSymbolicLink()) {\n return;\n }\n\n const content = stats === undefined ? \"\" : readFileSync(path, \"utf-8\");\n const hasSentinel = content.split(\"\\n\").some((line) => line.trim() === GITIGNORE_SENTINEL);\n\n if (hasSentinel) {\n const entries = new Set(content.split(\"\\n\").map((line) => line.trim()));\n const missing = GITIGNORE_ENTRIES.filter((entry) => !entries.has(entry));\n if (missing.length)\n writeFileSync(\n path,\n content + (content.endsWith(\"\\n\") ? \"\" : \"\\n\") + missing.join(\"\\n\") + \"\\n\",\n );\n return;\n }\n\n const separator = content === \"\" ? \"\" : content.endsWith(\"\\n\") ? \"\\n\" : \"\\n\\n\";\n const block = `${GITIGNORE_SENTINEL}\\n${GITIGNORE_ENTRIES.join(\"\\n\")}\\n`;\n writeFileSync(path, content + separator + block);\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\n\ninterface ManagedSectionOptions {\n path: string;\n name: string;\n content: string;\n createContent: (section: string) => string;\n}\n\nexport function ensureManagedSection(\n options: ManagedSectionOptions,\n): \"created\" | \"updated\" | \"unchanged\" | \"missing-markers\" {\n const startMarker = `<!-- setup-data-project:${options.name}:start / Safe to remove if you don't want this generated section. -->`;\n const endMarker = `<!-- setup-data-project:${options.name}:end / End of generated section. -->`;\n const trimmedContent = options.content.trim();\n const section =\n trimmedContent === \"\"\n ? `${startMarker}\\n${endMarker}`\n : `${startMarker}\\n\\n${trimmedContent}\\n\\n${endMarker}`;\n\n if (!existsSync(options.path)) {\n writeFileSync(options.path, ensureFinalNewline(options.createContent(section)));\n return \"created\";\n }\n\n const currentContent = readFileSync(options.path, \"utf-8\");\n const start = new RegExp(\n `<!-- setup-data-project:${options.name}:start(?: / [^\\\\r\\\\n]*?)? -->`,\n ).exec(currentContent);\n const end = new RegExp(`<!-- setup-data-project:${options.name}:end(?: / [^\\\\r\\\\n]*?)? -->`).exec(\n currentContent,\n );\n\n if (!start || !end || end.index < start.index + start[0].length) {\n return \"missing-markers\";\n }\n\n const nextContent =\n currentContent.slice(0, start.index) +\n section +\n currentContent.slice(end.index + end[0].length);\n\n if (nextContent === currentContent) {\n return \"unchanged\";\n }\n\n writeFileSync(options.path, ensureFinalNewline(nextContent));\n return \"updated\";\n}\n\nfunction ensureFinalNewline(content: string): string {\n return content.endsWith(\"\\n\") ? content : content + \"\\n\";\n}\n","import { ensureManagedSection } from \"./ensureManagedSection.ts\";\nimport { getInstalledPackageConfigs } from \"./packageRegistry.ts\";\nimport type { Runtime } from \"./getRuntime.ts\";\nexport function ensureReadme(runtime: Runtime, installedPackages: string[] = []) {\n const run = runtime === \"bun\" ? \"bun run\" : \"npm run\";\n const libraries = getInstalledPackageConfigs(installedPackages)\n .map((pkg) => `\\`${pkg.value}\\``)\n .join(\", \");\n ensureManagedSection({\n path: \"README.md\",\n name: \"libraries\",\n createContent: (section) =>\n `# Data project\\n\\nCreated with [setup-data-project](https://github.com/nshiab/setup-data-project).\\n\\n${section}`,\n content: `${libraries ? `Installed libraries: ${libraries}.\\n\\n` : \"\"}## Data analysis\n\nUse \\`sda/main.ts\\` to process source data from \\`sda/data/\\` and write results to \\`sda/output/\\`. Git ignores both data folders. Put reusable helpers in \\`sda/helpers/\\`. Use \\`sda/test/\\` for analysis tests named \\`*.test.ts\\`.${runtime === \"bun\" ? \" Use Bun 1.3.1 or newer to run checks before adding your first test.\" : \"\"}\n\n- \\`${run} sda\\`: run \\`${run} sda:fix\\`, then run the analysis once if checks pass.\n- \\`${run} sda:fix\\`: format files, apply automatic lint fixes, and check types under sda/.\n- \\`${run} sda:watch\\`: rerun fixes and analysis when sda/ or .env changes, excluding sda/output/.\n- \\`${run} sda:status\\`: check whether an analysis run or analysis watcher is active.\n- \\`${run} sda:test\\`: check formatting, lint, and TypeScript types under sda/, then run its tests.\n- \\`${run} sda:test:watch\\`: rerun checks and tests when analysis files or project settings change, excluding sda/output/.\n- \\`${run} sda:clean\\`: delete cached results and temporary files in .sda-cache/, .journalism-cache/, and .tmp/.\n\n## Editor and documentation\n\nIn VS Code, install the recommended Oxc extension for formatting and linting. The generated \\`.vscode/settings.json\\` enables formatting on save, Oxc lint fixes on explicit saves, and word wrapping. Setup preserves existing VS Code configuration files.\n\nRun \\`${run} sda:docs\\` after installing or updating an SDA, journalism, or Observable Plot package. It refreshes the local docs for the versions installed in your project. Git ignores \\`docs/\\`.`,\n });\n}\n","import { execFile } from \"node:child_process\";\nimport { getRuntime } from \"./getRuntime.ts\";\nexport function runPackageManager(args: string[]): Promise<void> {\n const command = getRuntime() === \"bun\" ? \"bun\" : process.platform === \"win32\" ? \"npm.cmd\" : \"npm\";\n return new Promise((resolve, reject) => {\n execFile(\n command,\n args,\n { maxBuffer: 10 * 1024 * 1024, shell: process.platform === \"win32\" },\n (error, stdout, stderr) => {\n if (error)\n reject(\n new Error(`${command} ${args.join(\" \")} failed.\\n${stderr || stdout}`, {\n cause: error,\n }),\n );\n else resolve();\n },\n );\n });\n}\nexport async function installPackages(\n packages: string[],\n options: { development?: boolean } = {},\n): Promise<void> {\n if (packages.length === 0) return;\n const bun = getRuntime() === \"bun\";\n await runPackageManager([\n bun ? \"add\" : \"install\",\n ...(options.development ? (bun ? [\"--dev\"] : [\"--save-dev\"]) : []),\n ...packages,\n ]);\n}\n","","import { existsSync, writeFileSync } from \"node:fs\";\nimport { ProjectManifest } from \"./projectManifest.ts\";\nimport { getRuntime } from \"./getRuntime.ts\";\nimport { installPackages } from \"./installPackages.ts\";\nimport metadata from \"../../package.json\" with { type: \"json\" };\nconst tools = [\"oxfmt\", \"oxlint\", \"oxlint-tsgolint\", \"@types/node\"];\nexport async function ensureTooling(manifest: ProjectManifest): Promise<void> {\n const runtime = getRuntime();\n const runtimeTools = runtime === \"bun\" ? [...tools, \"@types/bun\"] : tools;\n const installed = manifest.getInstalledPackages();\n await installPackages(\n [\n ...runtimeTools.filter((pkg) => !installed.includes(pkg)).map((pkg) => `${pkg}@latest`),\n ...(installed.includes(metadata.name) ? [] : [`${metadata.name}@${metadata.version}`]),\n ],\n { development: true },\n );\n if (\n ![\".oxlintrc.json\", \".oxlintrc.jsonc\", \"oxlint.config.ts\", \"oxlint.config.mts\"].some((file) =>\n existsSync(file),\n )\n ) {\n writeFileSync(\n \".oxlintrc.json\",\n `{\n \"options\": { \"typeAware\": true, \"typeCheck\": true }\n}\n`,\n );\n }\n if (\n [\".oxfmtrc.json\", \".oxfmtrc.jsonc\", \"oxfmt.config.ts\", \"oxfmt.config.mts\"].every(\n (file) => !existsSync(file),\n )\n )\n writeFileSync(\n \".oxfmtrc.json\",\n `{\n \"ignorePatterns\": [\"docs/**\", \"sda/data/**\", \"sda/output/**\"]\n}\n`,\n );\n if (!existsSync(\"tsconfig.json\"))\n writeFileSync(\n \"tsconfig.json\",\n `{\n \"compilerOptions\": {\n \"target\": \"ES2023\",\n \"module\": \"NodeNext\",\n \"strict\": true,\n \"noEmit\": true,\n \"allowImportingTsExtensions\": true,\n \"erasableSyntaxOnly\": ${runtime === \"node\"},\n \"types\": ${runtime === \"bun\" ? '[\"node\", \"bun\"]' : '[\"node\"]'},\n \"skipLibCheck\": true\n },\n \"include\": [\"sda/**/*.ts\"]\n}\n`,\n );\n}\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\n\nexport function ensureVscode(): void {\n mkdirSync(\".vscode\", { recursive: true });\n const formatter = \"oxc.oxc-vscode\";\n const files = {\n \"extensions.json\": `{\n \"recommendations\": [\"oxc.oxc-vscode\"]\n}\n`,\n \"settings.json\": `${JSON.stringify(\n {\n \"editor.defaultFormatter\": formatter,\n \"[javascript]\": { \"editor.defaultFormatter\": formatter },\n \"[javascriptreact]\": { \"editor.defaultFormatter\": formatter },\n \"[typescript]\": { \"editor.defaultFormatter\": formatter },\n \"[typescriptreact]\": { \"editor.defaultFormatter\": formatter },\n \"oxc.disableNestedConfig\": true,\n \"oxc.fmt.disableNestedConfig\": true,\n \"editor.formatOnSave\": true,\n \"editor.formatOnSaveMode\": \"file\",\n \"editor.codeActionsOnSave\": { \"source.fixAll.oxc\": \"explicit\" },\n \"editor.wordWrap\": \"on\",\n },\n null,\n 2,\n )}\\n`,\n };\n for (const [name, config] of Object.entries(files)) {\n const path = `.vscode/${name}`;\n if (!existsSync(path)) writeFileSync(path, config);\n }\n}\n","import { getRuntime, type Runtime } from \"./getRuntime.ts\";\nexport function getProjectTasks(runtime: Runtime = getRuntime()) {\n const fmt = runtime === \"bun\" ? \"bun run --bun oxfmt\" : \"oxfmt\";\n const lint = `${runtime === \"bun\" ? \"bun run --bun oxlint\" : \"oxlint\"} --type-aware --type-check`;\n const prefix = runtime === \"bun\" ? \"bun run --bun --no-env-file \" : \"\";\n const runner = `${prefix}sda-run`;\n const tests =\n runtime === \"bun\"\n ? \"bun test --pass-with-no-tests ./sda/\"\n : 'node --env-file-if-exists=.env --test \"sda/**/*.test.ts\"';\n return {\n sda: `${runner} sda/main.ts`,\n \"sda:watch\": `${runner} --watch sda/main.ts sda .env --ignore sda/output`,\n \"sda:status\": `${runner} --status`,\n \"sda:test\": `${fmt} --check sda && ${lint} sda && ${tests}`,\n \"sda:test:watch\": `${runner} --watch-test sda .env tsconfig.json --ignore sda/output`,\n \"sda:clean\": `${runner} --clean`,\n \"sda:fix\": `${fmt} --write sda && ${lint} --fix --format default sda`,\n \"sda:docs\": `${prefix}setup-data-project --docs`,\n \"sda:preview\": `${prefix}sda-preview`,\n };\n}\n","import { existsSync, lstatSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport function createFolderStructure(selectedPackages: string[]) {\n const sdaFolder = \"sda\";\n const folders = [\"data\", \"helpers\", \"output\", \"test\"];\n\n if (!existsSync(sdaFolder)) {\n mkdirSync(sdaFolder, { recursive: true });\n }\n\n for (const folder of folders) {\n const path = join(sdaFolder, folder);\n if (!existsSync(path)) {\n mkdirSync(path, { recursive: true });\n }\n }\n\n const mainTsPath = join(sdaFolder, \"main.ts\");\n\n let mainTsContent = 'console.log(\"Hello simple-data-analysis!\");\\n';\n\n if (\n selectedPackages.includes(\"@nshiab/simple-data-analysis\") ||\n selectedPackages.includes(\"@nshiab/simple-data-analysis-core\")\n ) {\n const pkg = selectedPackages.includes(\"@nshiab/simple-data-analysis\")\n ? \"@nshiab/simple-data-analysis\"\n : \"@nshiab/simple-data-analysis-core\";\n mainTsContent = `import { SimpleDB } from \"${pkg}\";\n\nconst sdb = new SimpleDB();\nconst table = sdb.newTable();\n\nawait table.loadArray([{ message: \"Hello simple-data-analysis!\" }]).log();\n\nawait sdb.close();\n`;\n }\n\n if (lstatSync(mainTsPath, { throwIfNoEntry: false }) === undefined) {\n writeFileSync(mainTsPath, mainTsContent);\n }\n\n return sdaFolder;\n}\n","import { lstatSync, writeFileSync } from \"node:fs\";\n\nexport function ensureEnvFile() {\n if (lstatSync(\".env\", { throwIfNoEntry: false }) === undefined) {\n writeFileSync(\".env\", \"\");\n }\n}\n","import type { PackageDocs } from \"./fetchPackageDocs.ts\";\nimport { ensureManagedSection } from \"./ensureManagedSection.ts\";\nimport { getInstalledPackageConfigs } from \"./packageRegistry.ts\";\nimport type { Runtime } from \"./getRuntime.ts\";\nexport function ensureAgents(\n docsMapping: Record<string, PackageDocs>,\n runtime: Runtime,\n installedPackages: string[] = Object.keys(docsMapping),\n) {\n const run = runtime === \"bun\" ? \"bun run\" : \"npm run\";\n const previewOverride = `${run} sda:preview${runtime === \"node\" ? \" --\" : \"\"} --dir src/report`;\n const setup = `${runtime === \"bun\" ? \"bunx --bun\" : \"npx\"} @nshiab/setup-data-project`;\n const analysisPackage = [\n \"@nshiab/simple-data-analysis\",\n \"@nshiab/simple-data-analysis-core\",\n ].find((pkg) => installedPackages.includes(pkg));\n const hasPlot = installedPackages.includes(\"@observablehq/plot\");\n const analysisGuidance = analysisPackage\n ? `Use \\`${analysisPackage}\\` methods whenever they fit. Reserve custom queries for gaps in those methods. Explain the gap to the user and offer to open a GitHub issue in the library's repository.\n\nFor scripts using the default in-memory \\`SimpleDB\\`, let unexpected errors stop the run so the script can be rerun. Call \\`await sdb.close()\\` at the end of the normal execution path. Calling it from \\`catch\\` or \\`finally\\` after a failure can remove cached results for steps the script never reached. Add error handling when the code or the user requires it.`\n : `If the task needs data processing or transformation, suggest \\`${setup} --sda\\` to install Simple Data Analysis${hasPlot ? \"\" : \" with Observable Plot\"} and download versioned documentation.`;\n const chartGuidance = hasPlot\n ? `Otherwise, use the installed Observable Plot.\n\nWhen using Observable Plot, copy \\`dist/plot.umd.min.js\\` from the installed \\`@observablehq/plot\\` package and \\`dist/d3.min.js\\` from its installed \\`d3\\` dependency into the site folder. Look for both packages in \\`node_modules/\\`, including Plot's nested dependencies if D3 is not at the top level. Use relative script URLs to load D3 before Plot.`\n : `Otherwise, suggest \\`${setup} --sda\\` to install Simple Data Analysis with Observable Plot and download their documentation. Use native browser APIs if the user prefers to keep the current dependencies.`;\n const links = getInstalledPackageConfigs(installedPackages).map((pkg) => {\n const name =\n pkg.value === \"@observablehq/plot\" ? \"observable-plot\" : pkg.value.slice(\"@nshiab/\".length);\n return `- \\`${pkg.value}\\` — \\`docs/${name}/llms.txt\\``;\n });\n ensureManagedSection({\n path: \"AGENTS.md\",\n name: \"agents\",\n createContent: (section) => `# Project instructions\\n\\n${section}`,\n content: `Read README.md for project guidance and package.json for the installed libraries and scripts. Ask the user before adding a dependency.\n\nKeep changes focused on the user's request. Update README.md only when the user explicitly asks.\n\nBefore writing or changing code, search the documentation of relevant installed libraries. Prefer their classes, functions, and methods when they fit the task. If you find a missing feature or a bug, tell the user and offer to open a GitHub issue in the library's repository.\n\n${links.length ? `Local library documentation:\\n\\n${links.join(\"\\n\")}\\n\\n` : \"\"}Before making changes or running project commands, run \\`${run} sda:status\\` and follow its instructions.\n\n## Data analysis\n\nDo data analysis and processing in \\`sda/\\`. Prioritize code that is easy to understand and review.\n\n${analysisGuidance}\n\nUse \\`sda/main.ts\\` as the entry point and \\`sda/helpers/\\` for reusable helpers. Keep one function per helper file, with the file named after the function. Put source data in \\`sda/data/\\` and analysis results in \\`sda/output/\\`.\n\nSave static charts to \\`sda/output/\\` as \\`.png\\` files unless the user requests another format.\n\nAdd focused tests for error-prone transformations, reusable logic with meaningful edge cases, and bug fixes. Mirror source paths under sda/test/: for example, sda/helpers/cleanRows.ts maps to sda/test/helpers/cleanRows.test.ts. Prefer the runtime's built-in test runner.\n\nTo run the analysis once, use \\`${run} sda\\`. It fixes and checks code before running the analysis. If the analysis watcher is running, this command requests a run from the watcher and returns its output and exit code when it finishes.\n\nWatch mode captures analysis output through pipes and prints it live. Check whether the output stream is a terminal before using features such as cursor control or interactive progress displays.\n\nRun \\`${run} sda:clean\\` only when cached results and temporary files can be discarded.\n\nBefore 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\n## Web projects\n\nIf the user asks for a web page, dashboard, or interactive visualization, create \\`src/site/\\` for the site unless the project calls for a different folder. Put \\`index.html\\` at the root, keep all required assets in the site folder, and use relative URLs. Use HTML, CSS, and vanilla JavaScript with classic script tags unless the user specifies a different stack.\n\nDefault to one page. Use multiple pages when the user asks for them or when they make the site easier to navigate.\n\nShow a “Last updated” timestamp near the top of each page and refresh it when the content or data changes. Ask which name and email to display as the public contact if the user hasn’t already provided them.\n\nWhen the site needs data, prepare it in \\`sda/\\` and export only what the page needs as JSON to \\`sda/output/\\`. Generate a separate \\`data.js\\` in the site folder from that export and load it before the page code (so recipients can unzip the site and double-click \\`index.html\\` without a server).\n\nAdd web dependencies only when the user explicitly requests them. For charts, use the user's chosen library. ${chartGuidance}\n\nIn \\`package.json\\`, add a script that runs \\`${run} sda:preview\\`. Use \\`sda:dash\\` for a dashboard, \\`sda:interactive\\` for a standalone interactive visualization, or \\`sda:web\\` for other web pages. For a different site folder, pass its path with \\`--dir\\`, for example \\`${previewOverride}\\`. Reuse an existing alias if it runs the same command. If the preferred name is taken, preserve the existing script and choose an unused name.\n\nRun the alias to start the preview server. Check the page and its interactions at the local URL it prints. The preview serves and watches only the site folder and refreshes the browser when its files change. Share the alias command and local URL with the user.\n\nThe \\`sda:fix\\`, \\`sda:test\\`, \\`sda:watch\\`, and \\`sda:test:watch\\` scripts target analysis code in \\`sda/\\`. Use the browser preview to verify web changes. When adding automated web tests at the user's request or to cover complex behavior, create \\`src/test/\\` and add a matching \\`package.json\\` script such as \\`sda:dash:test\\` that runs only the web tests using the project's test runner.`,\n });\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isObject } from \"./jsonObject.ts\";\nexport class ProjectManifest {\n #config: Record<string, unknown>;\n private constructor(config: Record<string, unknown>) {\n this.#config = config;\n }\n static open(): ProjectManifest {\n if (!existsSync(\"package.json\"))\n return new ProjectManifest({ name: \"data-project\", private: true, type: \"module\" });\n const config: unknown = JSON.parse(readFileSync(\"package.json\", \"utf8\"));\n if (!isObject(config)) throw new Error(\"package.json must contain a JSON object.\");\n return new ProjectManifest(config);\n }\n reload(): void {\n this.#config = ProjectManifest.open().#config;\n }\n getInstalledPackages(): string[] {\n return Object.keys(this.getInstalledPackageSpecifiers());\n }\n getInstalledPackageSpecifiers(): Record<string, string> {\n const packages: Record<string, string> = {};\n for (const key of [\"dependencies\", \"devDependencies\"]) {\n const dependencies = this.#config[key];\n if (isObject(dependencies))\n for (const [name, version] of Object.entries(dependencies)) {\n if (typeof version === \"string\") packages[name] = version;\n }\n }\n return packages;\n }\n updateTasks(tasks: Record<string, string>): void {\n if (this.#config.type === \"commonjs\") {\n throw new Error(\n 'Setup requires an ESM project. Set \"type\": \"module\" in package.json, or use --docs to refresh documentation only.',\n );\n }\n if (this.#config.type === undefined) this.#config.type = \"module\";\n const existing = this.#config.scripts;\n this.#config.scripts = { ...tasks, ...(isObject(existing) ? existing : {}) };\n writeFileSync(\"package.json\", JSON.stringify(this.#config, null, 2) + \"\\n\");\n }\n}\n","import { log } from \"@clack/prompts\";\nimport {\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { join, posix } from \"node:path\";\nimport { x } from \"tar\";\nimport { DOCUMENTED_PACKAGES } from \"./packageRegistry.ts\";\nexport interface PackageDocs {\n readme?: string;\n index?: string;\n llm?: string;\n plot?: { version: string; pages: string[] };\n}\nexport async function fetchPackageDocs(pkg: string, version: string): Promise<PackageDocs> {\n const config = DOCUMENTED_PACKAGES.find(\n (item) => item.value === pkg && item.value.startsWith(\"@nshiab/\"),\n );\n if (!config || !/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(version))\n throw new Error(`Unsupported package or version: ${pkg}@${version}`);\n const repo = pkg.slice(\"@nshiab/\".length);\n mkdirSync(\"docs\", { recursive: true });\n const staging = mkdtempSync(join(\"docs\", \".download-\"));\n const contents = join(staging, \"contents\");\n const target = join(\"docs\", repo);\n const backup = join(staging, \"previous\");\n try {\n const url = `https://github.com/nshiab/${repo}/releases/download/v${version}/documentation.tar.gz`;\n const response = await fetch(url);\n if (!response.ok) throw new Error(`HTTP ${response.status} from ${url}`);\n const archive = join(staging, \"documentation.tar.gz\");\n writeFileSync(archive, Buffer.from(await response.arrayBuffer()));\n mkdirSync(contents);\n let unsafeEntry: string | undefined;\n await x({\n file: archive,\n cwd: contents,\n strict: true,\n preservePaths: false,\n filter(path, entry) {\n const normalized = posix.normalize(path);\n if (\n path.includes(\"\\\\\") ||\n path.startsWith(\"/\") ||\n normalized === \"..\" ||\n normalized.startsWith(\"../\") ||\n !(\"type\" in entry) ||\n ![\"File\", \"Directory\"].includes(entry.type)\n ) {\n unsafeEntry = path;\n return false;\n }\n return true;\n },\n });\n if (unsafeEntry !== undefined) throw new Error(`Unsafe archive entry: ${unsafeEntry}`);\n for (const path of [\"README.md\", \"LICENSE\", \"llms.txt\", \"docs\"]) {\n if (!existsSync(join(contents, path)))\n throw new Error(`Documentation archive is missing ${path}.`);\n }\n const readme = readFileSync(join(contents, \"README.md\"), \"utf8\");\n const index = readFileSync(join(contents, \"llms.txt\"), \"utf8\");\n if (existsSync(target)) renameSync(target, backup);\n try {\n renameSync(contents, target);\n } catch (error) {\n if (existsSync(backup)) renameSync(backup, target);\n throw error;\n }\n return { readme, index };\n } catch (error) {\n log.warn(\n `Could not refresh ${pkg}@${version}: ${String(error)} Existing documentation was preserved and may be stale. Run the docs script again after resolving the error.`,\n );\n return {};\n } finally {\n rmSync(staging, { recursive: true, force: true });\n }\n}\n","// Plot's source is VitePress Markdown. Keep examples as reference material,\n// but remove the website UI and turn its custom containers into ordinary text.\nexport function cleanPlotMarkdown(content: string): string {\n const preserved: string[] = [];\n const keep = (value: string) => {\n preserved.push(value);\n return `\\uE000PLOT${preserved.length - 1}\\uE000`;\n };\n const lines = content.split(\"\\n\");\n const prose: string[] = [];\n for (let index = 0; index < lines.length; index++) {\n if (/^\\s*<!--/.test(lines[index])) {\n const start = index;\n while (!lines[index].includes(\"-->\") && index + 1 < lines.length) index++;\n prose.push(lines.slice(start, index + 1).join(\"\\n\"));\n continue;\n }\n const opening = lines[index].match(/^ {0,3}(`{3,}|~{3,})(.*)$/);\n if (!opening) {\n prose.push(lines[index]);\n continue;\n }\n const start = index;\n while (++index < lines.length) {\n const closing = lines[index].match(/^ {0,3}(`{3,}|~{3,})\\s*$/);\n if (closing?.[1][0] === opening[1][0] && closing[1].length >= opening[1].length) break;\n }\n if (index >= lines.length) throw new Error(\"Unclosed Plot code fence.\");\n const block = lines.slice(start, index + 1);\n if (opening[2].trim() === \"js-vue\") {\n block[0] = `${opening[1]}text`;\n prose.push(\n keep(\n \"Interactive example template (values in `{{…}}` come from the upstream website):\\n\\n\" +\n block.join(\"\\n\"),\n ),\n );\n } else {\n prose.push(keep(block.join(\"\\n\")));\n }\n }\n let result = prose\n .join(\"\\n\")\n .replace(/<script\\b[^>]*>([\\s\\S]*?)<\\/script>/g, (_match: string, code: string) => {\n const fence = \"`\".repeat(\n Math.max(3, ...[...code.matchAll(/`+/g)].map((match) => match[0].length + 1)),\n );\n return keep(\n `**Upstream example setup.** This code may use Vue and sample data from the linked source page.\\n\\n${fence}js\\n${code.trim()}\\n${fence}`,\n );\n })\n .replace(/^[ \\t]*<!--(?!\\s*setup-data-project:)[\\s\\S]*?-->/gm, \"\")\n .replace(\n /<\\/?[A-Za-z](?:\"[^\"]*\"|'[^']*'|[^'\"><])*>|(`+)[^`\\n]*?\\1/g,\n (part: string, fence: string | undefined) => (fence ? keep(part) : part),\n )\n .replace(/<style\\b[^>]*>[\\s\\S]*?<\\/style>/g, \"\")\n .replace(/<p\\b[^>]*>([\\s\\S]*?)<\\/p>/g, (_match: string, body: string) =>\n /<(?:input|select|label)\\b/.test(body) ? \"\" : body,\n )\n .replace(/<PlotRender\\b[\\s\\S]*?\\/>/g, (component) => {\n const options = component.match(/:options=([\"'])([\\s\\S]*?)\\1/)?.[2];\n const method = component.match(/\\bmethod=[\"'](\\w+)[\"']/)?.[1] ?? \"plot\";\n if (!options) throw new Error(\"Unrecognized PlotRender example.\");\n return keep(`\\`\\`\\`js\\nPlot.${method}(${options});\\n\\`\\`\\``);\n })\n .replace(/<VersionBadge\\b[\\s\\S]*?\\/>/g, (badge) => {\n const version = badge.match(/\\bversion=[\"']([^\"']+)[\"']/)?.[1];\n return version ? `(since v${version})` : \"\";\n })\n .replace(/<\\/?span\\b(?:\"[^\"]*\"|'[^']*'|[^'\">])*>/g, \"\")\n .replace(/<svg\\b[\\s\\S]*?<\\/svg>/g, \"arrow\");\n result = result\n .replace(/^[ \\t]*:::plot\\b([^\\n]*)/gm, (_match: string, options: string) => {\n const url = options.match(/https?:\\/\\/\\S+/)?.[0];\n return url ? `[Interactive example](${url})\\n` : \"\";\n })\n .replace(\n /^([ \\t]*):::(tip|info|warning)\\b[ \\t]*/gm,\n (_match: string, indent: string, kind: string) =>\n `${indent}**${kind[0].toUpperCase() + kind.slice(1)}:** `,\n )\n .replace(/^[ \\t]*:::[ \\t]*$/gm, \"\")\n .replace(/[ \\t]+:::[ \\t]*$/gm, \"\")\n .replace(\n /\\{\\{([\\s\\S]*?)\\}\\}/g,\n (_match: string, expression: string) => `\\`${expression.trim().replace(/\\s+/g, \" \")}\\``,\n )\n .replace(/[ \\t]+$/gm, \"\")\n .replace(/\\n{3,}/g, \"\\n\\n\")\n .trim();\n return (\n result.replace(\n /\\uE000PLOT(\\d+)\\uE000/g,\n (_match: string, index: string) => preserved[Number(index)],\n ) + \"\\n\"\n );\n}\n","// This release was published with an extra dot in its Git tag.\n// Keep source links and downloads aligned with the actual upstream tag.\nexport function getPlotTag(version: string): string {\n return version === \"0.6.18\" ? `v.${version}` : `v${version}`;\n}\n","import { cleanPlotMarkdown } from \"./cleanPlotMarkdown.ts\";\nimport { posix } from \"node:path\";\nimport { getPlotTag } from \"./getPlotTag.ts\";\n\n// The Plot source uses ATX headings, explicit VitePress IDs, and Markdown fences.\n// Keep code verbatim; rewrite only prose links and anchors while joining pages.\nexport function combinePlotDocs(version: string, documents: Map<string, string>): string {\n const pages = [...documents.keys()].sort();\n const tag = getPlotTag(version);\n const source = `https://github.com/observablehq/plot/tree/${tag}/docs`;\n const anchors = new Map<string, Map<string, string>>();\n const sections = new Map<string, { line: number; title: string; id: string }[]>();\n const pageId = (page: string) => `plot-${page.replace(/\\.md$/, \"\").replaceAll(\"/\", \"--\")}`;\n\n for (const page of pages) {\n const ids = new Map<string, string>();\n const headings: { line: number; title: string; id: string }[] = [];\n const counts = new Map<string, number>();\n proseLines(documents.get(page) ?? \"\", (line, number) => {\n for (const match of line.matchAll(/\\bid=[\"']([^\"']+)[\"']/g)) {\n ids.set(match[1], `${pageId(page)}--${match[1]}`);\n }\n const heading = line.match(/^ {0,3}#{1,6}\\s+(.+?)\\s*#*\\s*$/);\n if (!heading) return line;\n const explicit = heading[1].match(/\\{#([^}]+)\\}/)?.[1];\n const title = heading[1].replace(/\\s*\\{#[^}]+\\}/g, \"\");\n const slug =\n explicit ??\n title\n .replace(/<[^>]*>/g, \"\")\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}_\\s-]/gu, \"\")\n .trim()\n .replace(/\\s+/g, \"-\");\n const count = counts.get(slug) ?? 0;\n counts.set(slug, count + 1);\n const localId = `${slug}${count ? `-${count}` : \"\"}`;\n const id = `${pageId(page)}--${localId}`;\n ids.set(localId, id);\n headings.push({ line: number, title, id });\n return line;\n });\n anchors.set(page, ids);\n sections.set(page, headings);\n }\n\n function link(target: string, page: string): string {\n if (/^(?:[a-z][a-z\\d+.-]*:|\\/\\/)/i.test(target)) return target;\n const [pathAndQuery, fragment] = target.split(\"#\", 2);\n const path = pathAndQuery.split(\"?\", 1)[0];\n const resolved =\n path === \"\"\n ? page\n : posix.normalize(\n path.startsWith(\"/\") ? path.slice(1) : posix.join(posix.dirname(page), path),\n );\n const markdown = [resolved, `${resolved}.md`, `${resolved}/index.md`].find((candidate) =>\n documents.has(candidate),\n );\n if (markdown) {\n const id = fragment\n ? anchors.get(markdown)?.get(decodeURIComponent(fragment))\n : pageId(markdown);\n if (id) return `#${id}`;\n // Preserve an upstream target when a fragment is not a known heading/ID.\n return `${source}/${markdown}${fragment ? `#${fragment}` : \"\"}`;\n }\n if (resolved.endsWith(\".md\")) {\n return `${source}/${resolved}${fragment ? `#${fragment}` : \"\"}`;\n }\n const base = \"https://raw.githubusercontent.com/observablehq/plot/\" + `refs/tags/${tag}/docs/`;\n return path.startsWith(\"/\")\n ? new URL(`public${target}`, base).href\n : new URL(target, `${base}${page}`).href;\n }\n\n const contents = pages\n .flatMap((page) => [\n `- [${page}](#${pageId(page)})`,\n ...(sections.get(page) ?? []).map(\n ({ title, id }) => ` - [${title.replace(/[[\\]]/g, \"\")}](#${id})`,\n ),\n ])\n .join(\"\\n\");\n const combined = pages\n .map((page) => {\n const headings = new Map(\n (sections.get(page) ?? []).map((heading) => [heading.line, heading]),\n );\n const body = proseLines(documents.get(page) ?? \"\", (line, number) => {\n const heading = headings.get(number);\n // Inline code also remains verbatim. Plot's prose links have simple destinations.\n line = line\n .split(/(`+[^`]*`+)/g)\n .map((part, index) => {\n if (index % 2) return part;\n return part\n .replace(\n /(\\]\\()([^\\s)]+)([^)]*\\))/g,\n (_match: string, before: string, target: string, after: string) =>\n `${before}${link(target, page)}${after}`,\n )\n .replace(\n /^( {0,3}\\[[^\\]]+\\]:\\s*)(\\S+)/,\n (_match: string, before: string, target: string) =>\n `${before}${link(target, page)}`,\n )\n .replace(\n /(?<!:)\\b(href|src)=([\"'])([^\"']+)\\2/g,\n (_match: string, attr: string, quote: string, target: string) =>\n `${attr}=${quote}${link(target, page)}${quote}`,\n )\n .replace(\n /\\bid=([\"'])([^\"']+)\\1/g,\n (_match: string, quote: string, id: string) =>\n `id=${quote}${anchors.get(page)?.get(id) ?? id}${quote}`,\n );\n })\n .join(\"\");\n return heading\n ? `<a id=\"${heading.id}\"></a>\\n\\n${line.replace(/\\s*\\{#[^}]+\\}/g, \"\")}`\n : line;\n });\n return `<a id=\"${pageId(page)}\"></a>\\n\\n# ${page}\\n\\nSource: ${source}/${page}\\n\\n${body}`;\n })\n .join(\"\\n\\n---\\n\\n\");\n return cleanPlotMarkdown(\n `# Observable Plot ${version}\\n\\nPackage: \\`@observablehq/plot@${version}\\`. Source: [${tag}](${source}).\\n\\nThis reference combines selected upstream documentation for static charts and maps. Introductory and site pages, interaction helpers, and the Auto and Tip marks are omitted. Website controls are omitted; upstream setup and interactive templates are labeled as reference code. Use the table of contents to find API signatures and examples; links to omitted pages lead to the tagged upstream documentation.\\n\\n## Table of contents\\n\\n${contents}\\n\\n---\\n\\n${combined}\\n\\n<!-- setup-data-project:observable-plot:${version}:complete -->\\n`,\n );\n}\n\nexport function proseLines(\n content: string,\n transform: (line: string, number: number) => string,\n): string {\n let fence: { character: string; length: number } | undefined;\n let script = false;\n return content\n .split(\"\\n\")\n .map((line, number) => {\n const marker = line.match(/^ {0,3}(`{3,}|~{3,})/);\n if (fence) {\n if (\n marker?.[1][0] === fence.character &&\n marker[1].length >= fence.length &&\n /^ {0,3}(?:`+|~+)\\s*$/.test(line)\n )\n fence = undefined;\n return line;\n }\n if (marker) {\n fence = { character: marker[1][0], length: marker[1].length };\n return line;\n }\n if (/^\\s*<script\\b/.test(line)) script = true;\n if (script) {\n if (/<\\/script>/.test(line)) script = false;\n return line;\n }\n return transform(line, number);\n })\n .join(\"\\n\");\n}\n","// Static chart creation references. Keep this explicit so new upstream pages do\n// not silently expand the installed agent reference.\nexport const PLOT_DOC_PAGES: string[] = [\n \"features/plots.md\",\n \"features/marks.md\",\n \"features/scales.md\",\n \"features/projections.md\",\n \"features/legends.md\",\n \"features/facets.md\",\n \"features/formats.md\",\n \"features/curves.md\",\n \"transforms/bin.md\",\n \"transforms/group.md\",\n \"transforms/stack.md\",\n \"transforms/normalize.md\",\n \"transforms/centroid.md\",\n \"transforms/sort.md\",\n \"marks/area.md\",\n \"marks/arrow.md\",\n \"marks/axis.md\",\n \"marks/bar.md\",\n \"marks/bollinger.md\",\n \"marks/box.md\",\n \"marks/cell.md\",\n \"marks/contour.md\",\n \"marks/delaunay.md\",\n \"marks/density.md\",\n \"marks/difference.md\",\n \"marks/dot.md\",\n \"marks/frame.md\",\n \"marks/geo.md\",\n \"marks/grid.md\",\n \"marks/hexgrid.md\",\n \"marks/image.md\",\n \"marks/line.md\",\n \"marks/linear-regression.md\",\n \"marks/link.md\",\n \"marks/raster.md\",\n \"marks/rect.md\",\n \"marks/rule.md\",\n \"marks/text.md\",\n \"marks/tick.md\",\n \"marks/tree.md\",\n \"marks/vector.md\",\n \"marks/waffle.md\",\n].sort();\n","import { cleanPlotMarkdown } from \"./cleanPlotMarkdown.ts\";\nimport { posix } from \"node:path\";\nimport { proseLines } from \"./combinePlotDocs.ts\";\nimport { PLOT_DOC_PAGES } from \"./plotDocPages.ts\";\nimport { getPlotTag } from \"./getPlotTag.ts\";\n\n// Split the cached format without changing code examples or heading anchors.\nexport function splitPlotDocs(reference: string, version: string): Map<string, string> {\n const sections = [\n ...reference.matchAll(\n /<a id=\"(plot-[^\"]+)\"><\\/a>\\n\\n# ([^\\n]+\\.md)\\n\\nSource:\\s+([^\\s]+)\\n\\n/g,\n ),\n ];\n const files = new Map<string, string>();\n const anchors = new Map<string, string>();\n const source = `https://github.com/observablehq/plot/tree/${getPlotTag(version)}/docs`;\n const completion = `<!-- setup-data-project:observable-plot:${version}:complete -->`;\n if (!reference.trimEnd().endsWith(completion)) throw new Error(\"Incomplete Plot reference.\");\n const end = reference.lastIndexOf(completion);\n const licenseStart = reference.lastIndexOf(\"\\n## Upstream license\\n\", end);\n for (let index = 0; index < sections.length; index++) {\n const section = sections[index];\n const page = section[2];\n if (!PLOT_DOC_PAGES.includes(page) || files.has(page) || section[3] !== `${source}/${page}`)\n throw new Error(`Invalid Plot page: ${page}`);\n const body = reference\n .slice(section.index, sections[index + 1]?.index ?? (licenseStart >= 0 ? licenseStart : end))\n .trimEnd()\n .replace(/\\n\\n---$/, \"\");\n files.set(page, body);\n proseLines(body, (line) => {\n for (const match of line.matchAll(/\\bid=[\"']([^\"']+)[\"']/g)) anchors.set(match[1], page);\n return line;\n });\n }\n if (files.size !== PLOT_DOC_PAGES.length) throw new Error(\"Incomplete Plot pages.\");\n\n for (const [page, body] of files) {\n const link = (id: string) => {\n const destination = anchors.get(id);\n return destination && destination !== page\n ? `${posix.relative(posix.dirname(page), destination)}#${id}`\n : `#${id}`;\n };\n files.set(\n page,\n cleanPlotMarkdown(\n proseLines(body, (line) =>\n line\n .split(/(`+[^`]*`+)/g)\n .map((part, index) =>\n index % 2\n ? part\n : part\n .replace(\n /(\\]\\()#([^\\s)]+)([^)]*\\))/g,\n (_match: string, before: string, id: string, after: string) =>\n `${before}${link(id)}${after}`,\n )\n .replace(\n /^( {0,3}\\[[^\\]]+\\]:\\s*)#(\\S+)/,\n (_match: string, before: string, id: string) => `${before}${link(id)}`,\n )\n .replace(\n /(?<!:)\\b(href|src)=([\"'])#([^\"']+)\\2/g,\n (_match: string, attr: string, quote: string, id: string) =>\n `${attr}=${quote}${link(id)}${quote}`,\n ),\n )\n .join(\"\"),\n ),\n ),\n );\n }\n const license =\n licenseStart >= 0\n ? reference.slice(licenseStart + \"\\n## Upstream license\\n\".length, end).trim()\n : undefined;\n if (license) files.set(\"LICENSE\", license + \"\\n\");\n const index =\n `# Observable Plot ${version}\\n\\n> Selected documentation for static charts and maps. Start here, then read the relevant pages.\\n\\n[Versioned upstream documentation](${source})${license ? \" · [License](./LICENSE)\" : \"\"}\\n\\n` +\n [\"features\", \"marks\", \"transforms\"]\n .map(\n (group) =>\n `## ${group[0].toUpperCase() + group.slice(1)}\\n\\n` +\n PLOT_DOC_PAGES.filter((page) => page.startsWith(`${group}/`))\n .map((page) => `- [${page}](./${page})`)\n .join(\"\\n\"),\n )\n .join(\"\\n\\n\") +\n \"\\n\";\n files.set(\"llms.txt\", index);\n return files;\n}\n","import { log } from \"@clack/prompts\";\nimport { existsSync, mkdirSync, mkdtempSync, renameSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { splitPlotDocs } from \"./splitPlotDocs.ts\";\nimport { combinePlotDocs } from \"./combinePlotDocs.ts\";\nimport { PLOT_DOC_PAGES } from \"./plotDocPages.ts\";\nimport { getPlotTag } from \"./getPlotTag.ts\";\nimport type { PackageDocs } from \"./fetchPackageDocs.ts\";\n\n// Replace local documentation only after every page is ready.\nexport async function fetchPlotDocs(\n version: string,\n options: { preferStored?: boolean } = {},\n): Promise<PackageDocs> {\n const tag = getPlotTag(version);\n const directory = join(\"docs\", \"observable-plot\");\n try {\n let llm: string | undefined;\n if (options.preferStored !== false) {\n try {\n const response = await fetch(\n \"https://raw.githubusercontent.com/nshiab/setup-data-project/\" +\n `refs/heads/main/docs-cache/observable-plot/${version}/llm.md`,\n );\n if (response.ok) {\n const cached = await response.text();\n if (isStoredReference(cached, version)) llm = cached;\n }\n } catch {\n // A cache is an optimization. An unavailable cache never blocks the tag.\n }\n }\n if (llm === undefined) llm = await generatePlotReference(version);\n const files = splitPlotDocs(llm, version);\n mkdirSync(\"docs\", { recursive: true });\n const staging = mkdtempSync(join(\"docs\", \".plot-\"));\n const contents = join(staging, \"contents\");\n const backup = join(staging, \"previous\");\n try {\n for (const [page, content] of files) {\n const path = join(contents, page);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, content);\n }\n if (existsSync(directory)) renameSync(directory, backup);\n try {\n renameSync(contents, directory);\n } catch (error) {\n if (existsSync(backup)) renameSync(backup, directory);\n throw error;\n }\n } finally {\n rmSync(staging, { recursive: true, force: true });\n }\n return { llm, index: files.get(\"llms.txt\"), plot: { version, pages: [...PLOT_DOC_PAGES] } };\n } catch (error) {\n log.warn(\n `Could not fetch complete Observable Plot documentation for ${tag}. ` +\n \"Existing files were preserved, but may not match the installed \" +\n \"version. Resolve the refresh failure before using this reference. \" +\n String(error),\n );\n return {};\n }\n}\n\nexport async function generatePlotReference(version: string): Promise<string> {\n if (!/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$/.test(version))\n throw new Error(\"An exact Plot version is required.\");\n const tag = getPlotTag(version);\n const pages = PLOT_DOC_PAGES;\n const documents = new Map<string, string>();\n const failed: string[] = [];\n // Fetch in small batches to avoid overwhelming GitHub on the first run.\n for (let offset = 0; offset < pages.length; offset += 8) {\n await Promise.all(\n pages.slice(offset, offset + 8).map(async (page) => {\n try {\n const url =\n \"https://raw.githubusercontent.com/observablehq/plot/\" +\n `refs/tags/${tag}/docs/${page}`;\n const response = await fetch(url);\n if (!response.ok) throw new Error(`HTTP ${response.status}`);\n const content = await response.text();\n documents.set(page, content);\n } catch {\n failed.push(page);\n }\n }),\n );\n }\n\n if (failed.length > 0) {\n throw new Error(`Could not fetch ${failed.length} Markdown pages`);\n }\n const response = await fetch(\n `https://raw.githubusercontent.com/observablehq/plot/refs/tags/${tag}/LICENSE`,\n );\n if (!response.ok) throw new Error(`Could not fetch Plot's license: HTTP ${response.status}`);\n const license = await response.text();\n const completion = `<!-- setup-data-project:observable-plot:${version}:complete -->`;\n return combinePlotDocs(version, documents).replace(\n completion,\n `## Upstream license\\n\\n${license.trim()}\\n\\n${completion}`,\n );\n}\n\nfunction isStoredReference(content: string, version: string): boolean {\n const tag = getPlotTag(version);\n const source = `https://github.com/observablehq/plot/tree/${tag}/docs`;\n const metadata = content.split(/\\n\\s*\\n/)[1]?.replace(/\\s+/g, \" \");\n if (\n !content.startsWith(`# Observable Plot ${version}\\n\\n`) ||\n metadata !== `Package: \\`@observablehq/plot@${version}\\`. Source: [${tag}](${source}).` ||\n !content.trimEnd().endsWith(`<!-- setup-data-project:observable-plot:${version}:complete -->`)\n )\n return false;\n\n // Match actual page sections, not TOC entries. Require every selected page\n // exactly once and some upstream heading/content after its source record.\n const sections = [\n ...content.matchAll(/<a id=\"(plot-[^\"]+)\"><\\/a>\\n\\n# ([^\\n]+\\.md)\\n\\nSource:\\s+([^\\s]+)\\n\\n/g),\n ];\n if (sections.length !== PLOT_DOC_PAGES.length) return false;\n const found = new Set<string>();\n for (let index = 0; index < sections.length; index++) {\n const section = sections[index];\n const page = section[2];\n const id = `plot-${page.replace(/\\.md$/, \"\").replaceAll(\"/\", \"--\")}`;\n if (\n !PLOT_DOC_PAGES.includes(page) ||\n found.has(page) ||\n section[1] !== id ||\n section[3] !== `${source}/${page}`\n )\n return false;\n const body = content.slice(section.index + section[0].length, sections[index + 1]?.index);\n if (!/^#{1,6}\\s+\\S/m.test(body)) return false;\n found.add(page);\n }\n return true;\n}\n","import { log } from \"@clack/prompts\";\nimport { fetchPackageDocs, type PackageDocs } from \"./fetchPackageDocs.ts\";\nimport { fetchPlotDocs } from \"./fetchPlotDocs.ts\";\nimport { getInstalledPackageConfigs } from \"./packageRegistry.ts\";\nexport async function syncPackageDocs(\n installedPackages: string[],\n installedVersions: Record<string, string>,\n): Promise<Record<string, PackageDocs>> {\n const mapping: Record<string, PackageDocs> = {};\n for (const pkg of getInstalledPackageConfigs(installedPackages)) {\n const version = installedVersions[pkg.value];\n if (!version) {\n log.warn(\n `Could not determine the installed version of ${pkg.value}. Install the project dependencies, then run the docs script again. Existing documentation may be stale.`,\n );\n continue;\n }\n const docs =\n pkg.value === \"@observablehq/plot\"\n ? await fetchPlotDocs(version)\n : await fetchPackageDocs(pkg.value, version);\n if (docs.index !== undefined || docs.plot) mapping[pkg.value] = docs;\n }\n return mapping;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { isObject } from \"./jsonObject.ts\";\nexport function getInstalledPackageVersions(\n packageSpecifiers: Record<string, string>,\n): Record<string, string> {\n const versions: Record<string, string> = {};\n for (const pkg of Object.keys(packageSpecifiers)) {\n const path = join(\"node_modules\", pkg, \"package.json\");\n if (!existsSync(path)) continue;\n const config: unknown = JSON.parse(readFileSync(path, \"utf8\"));\n if (\n isObject(config) &&\n typeof config.version === \"string\" &&\n /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(config.version)\n )\n versions[pkg] = config.version;\n }\n return versions;\n}\n","import { SUPPORTED_PACKAGES } from \"./packageRegistry.ts\";\n\nexport interface CliOptions {\n help: boolean;\n docs: boolean;\n packages: string[];\n}\n\nconst packageFlags = new Map(\n SUPPORTED_PACKAGES.map((pkg) => [\n `--${pkg.label.replace(/^simple-data-analysis/, \"sda\").replace(/^journalism-/, \"\")}`,\n pkg.value,\n ]),\n);\n\nexport const CLI_HELP = `Usage: setup-data-project [library flags | --docs] [--help]\n\n${Array.from(packageFlags, ([flag, pkg]) => ` ${flag.padEnd(16)} Select ${pkg}.`).join(\"\\n\")}\n --docs Refresh documentation only for installed libraries.\n -h, --help Show this help and exit.\n\nWithout a package flag, choose packages interactively.\nCombine package flags to select libraries without prompting.\nPackage flags install or update selected libraries to latest without prompting,\nand still set up project files and docs.`;\n\nexport function parseArguments(args: string[]): CliOptions {\n const options: CliOptions = { help: false, docs: false, packages: [] };\n\n for (const arg of args) {\n const pkg = packageFlags.get(arg);\n if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (arg === \"--docs\") {\n options.docs = true;\n } else if (pkg) {\n if (!options.packages.includes(pkg)) options.packages.push(pkg);\n } else {\n throw new Error(`Unknown argument: ${arg}. Use --help for usage.`);\n }\n }\n\n if (options.docs && options.packages.length > 0)\n throw new Error(\"--docs cannot be combined with package flags.\");\n return options;\n}\n","#!/usr/bin/env node\nimport { cancel, intro, isCancel, multiselect, outro, select, spinner } from \"@clack/prompts\";\nimport process from \"node:process\";\nimport { execFileSync } from \"node:child_process\";\n\nimport { getRuntime } from \"./helpers/getRuntime.ts\";\nimport { PACKAGE_OPTIONS } from \"./helpers/packageOptions.ts\";\nimport { ensureGitignore } from \"./helpers/ensureGitignore.ts\";\nimport { ensureReadme } from \"./helpers/ensureReadme.ts\";\nimport { ensureTooling } from \"./helpers/ensureTooling.ts\";\nimport { ensureVscode } from \"./helpers/ensureVscode.ts\";\nimport { runPackageManager, installPackages } from \"./helpers/installPackages.ts\";\nimport { getProjectTasks } from \"./helpers/getProjectTasks.ts\";\nimport { createFolderStructure } from \"./helpers/createFolderStructure.ts\";\nimport { ensureEnvFile } from \"./helpers/ensureEnvFile.ts\";\nimport { ensureAgents } from \"./helpers/ensureAgents.ts\";\nimport { getInstalledPackageConfigs } from \"./helpers/packageRegistry.ts\";\nimport { ProjectManifest } from \"./helpers/projectManifest.ts\";\nimport { syncPackageDocs } from \"./helpers/syncPackageDocs.ts\";\nimport { getInstalledPackageVersions } from \"./helpers/getInstalledPackageVersions.ts\";\nimport { CLI_HELP, parseArguments } from \"./helpers/parseArguments.ts\";\n\nasync function main() {\n const cliOptions = parseArguments(process.argv.slice(2));\n if (cliOptions.help) {\n console.log(CLI_HELP);\n return;\n }\n\n const runtime = getRuntime();\n const projectManifest = ProjectManifest.open();\n if (cliOptions.docs) {\n await refreshDocs(projectManifest);\n return;\n }\n console.log();\n intro(`Hi! 👋 (Running on ${runtime})`);\n\n const installedPackages = projectManifest.getInstalledPackages();\n const options = PACKAGE_OPTIONS.map((opt) => ({\n ...opt,\n label: installedPackages.includes(opt.value)\n ? `${opt.label} \\x1b[2m(installed)\\x1b[22m`\n : opt.label,\n }));\n\n const selectedPackages =\n cliOptions.packages.length > 0\n ? cliOptions.packages\n : await multiselect({\n message:\n \"Which libraries would you like to install?\\n\\x1b[2m(space to select, arrows to navigate, enter to confirm)\\x1b[22m\\n\",\n options,\n required: false,\n });\n\n if (isCancel(selectedPackages)) {\n cancel(\"Installation cancelled.\");\n process.exit(0);\n }\n\n const alreadyInstalled = selectedPackages.filter((pkg) => installedPackages.includes(pkg));\n\n const packagesToInstall: string[] = [];\n\n for (const pkg of selectedPackages) {\n if (alreadyInstalled.includes(pkg) && cliOptions.packages.length === 0) {\n const action = await select({\n message: `${pkg} is already installed. What would you like to do?`,\n options: [\n { value: \"skip\", label: \"Keep existing version\" },\n { value: \"update\", label: \"Update to latest\" },\n ],\n });\n\n if (isCancel(action)) {\n cancel(\"Installation cancelled.\");\n process.exit(0);\n }\n\n if (action === \"update\") {\n packagesToInstall.push(`${pkg}@latest`);\n }\n } else {\n packagesToInstall.push(`${pkg}@latest`);\n }\n }\n\n projectManifest.updateTasks(getProjectTasks(runtime));\n\n const sInstall = spinner();\n sInstall.start(\"Installing packages...\");\n\n try {\n await installPackages(packagesToInstall);\n projectManifest.reload();\n const declared = projectManifest.getInstalledPackageSpecifiers();\n if (\n projectManifest\n .getInstalledPackages()\n .some((pkg) =>\n [\"@nshiab/simple-data-analysis\", \"@nshiab/journalism-dataviz\"].includes(pkg),\n ) &&\n !declared[\"@observablehq/plot\"]\n ) {\n await installPackages([\"@observablehq/plot\"]);\n projectManifest.reload();\n }\n await ensureTooling(projectManifest);\n // Reinstall declared dependencies when a project was cloned without node_modules.\n projectManifest.reload();\n const versions = getInstalledPackageVersions(projectManifest.getInstalledPackageSpecifiers());\n if (projectManifest.getInstalledPackages().some((pkg) => !versions[pkg]))\n await runPackageManager([\"install\"]);\n } catch (error) {\n sInstall.stop(\"Package installation failed.\");\n throw error;\n }\n sInstall.stop(\"Packages installed.\");\n\n projectManifest.reload();\n const finalInstalledPackages = getInstalledPackageConfigs(\n projectManifest.getInstalledPackages(),\n ).map((pkg) => pkg.value);\n const docsMapping = await refreshDocs(projectManifest);\n\n const sConfig = spinner();\n sConfig.start(\"Preparing project files and configuration...\");\n try {\n projectManifest.updateTasks(getProjectTasks());\n execFileSync(process.execPath, [\"node_modules/oxfmt/bin/oxfmt\", \"--write\", \"package.json\"], {\n stdio: \"pipe\",\n });\n\n createFolderStructure(finalInstalledPackages);\n ensureGitignore();\n ensureEnvFile();\n ensureVscode();\n ensureReadme(runtime, finalInstalledPackages);\n ensureAgents(docsMapping, runtime, finalInstalledPackages);\n } catch (error) {\n sConfig.stop(\"Project configuration failed.\");\n throw error;\n }\n sConfig.stop(\"Project files and configuration ready.\");\n\n outro(\n process.exitCode\n ? \"Project setup complete; documentation needs attention.\"\n : \"You are all set! 🙌\",\n );\n}\n\nasync function refreshDocs(manifest: ProjectManifest) {\n const packages = getInstalledPackageConfigs(manifest.getInstalledPackages()).map(\n (pkg) => pkg.value,\n );\n const sDocs = spinner();\n sDocs.start(\"Downloading documentation...\");\n try {\n const mapping = await syncPackageDocs(\n packages,\n getInstalledPackageVersions(manifest.getInstalledPackageSpecifiers()),\n );\n if (Object.keys(mapping).length !== packages.length) {\n sDocs.stop(\"Documentation incomplete. See the warnings above.\");\n process.exitCode = 1;\n } else {\n sDocs.stop(\n packages.length > 0 ? \"Documentation downloaded.\" : \"No library documentation to download.\",\n );\n }\n return mapping;\n } catch (error) {\n sDocs.stop(\"Documentation download failed.\");\n throw error;\n }\n}\n\nmain().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`❌ Error: ${message}`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;AAEA,SAAgB,WAAW,WAA4CA,UAAQ,UAAmB;CAChG,OAAO,SAAS,MAAM,QAAQ;AAChC;;;ACGA,MAAa,qBAAsC;CACjD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MA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,8BAA8B,CAAC,CACtE;EACA,IAAI,OAAO,KAAK,OAAO,CAAC,CAAC,WAAW,SAAS,QAAQ;GACnD,MAAM,KAAK,mDAAmD;GAC9D,UAAQ,WAAW;EACrB,OACE,MAAM,KACJ,SAAS,SAAS,IAAI,8BAA8B,uCACtD;EAEF,OAAO;CACT,SAAS,OAAO;EACd,MAAM,KAAK,gCAAgC;EAC3C,MAAM;CACR;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,UAAU;CACtB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,QAAQ,MAAM,YAAY,SAAS;CACnC,UAAQ,WAAW;AACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nshiab/setup-data-project",
3
- "version": "4.0.19",
3
+ "version": "4.0.21",
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",