@nshiab/setup-data-project 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -24
- package/dist/main.mjs +849 -0
- package/dist/main.mjs.map +1 -0
- package/package.json +29 -18
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/helpers/createFolderStructure.d.ts +0 -2
- package/esm/helpers/createFolderStructure.d.ts.map +0 -1
- package/esm/helpers/createFolderStructure.js +0 -40
- package/esm/helpers/ensureAgents.d.ts +0 -3
- package/esm/helpers/ensureAgents.d.ts.map +0 -1
- package/esm/helpers/ensureAgents.js +0 -176
- package/esm/helpers/ensureEnvFile.d.ts +0 -2
- package/esm/helpers/ensureEnvFile.d.ts.map +0 -1
- package/esm/helpers/ensureEnvFile.js +0 -8
- package/esm/helpers/ensureGitignore.d.ts +0 -3
- package/esm/helpers/ensureGitignore.d.ts.map +0 -1
- package/esm/helpers/ensureGitignore.js +0 -24
- package/esm/helpers/ensureManagedSection.d.ts +0 -9
- package/esm/helpers/ensureManagedSection.d.ts.map +0 -1
- package/esm/helpers/ensureManagedSection.js +0 -33
- package/esm/helpers/ensureReadme.d.ts +0 -2
- package/esm/helpers/ensureReadme.d.ts.map +0 -1
- package/esm/helpers/ensureReadme.js +0 -61
- package/esm/helpers/fetchPackageDocs.d.ts +0 -8
- package/esm/helpers/fetchPackageDocs.d.ts.map +0 -1
- package/esm/helpers/fetchPackageDocs.js +0 -75
- package/esm/helpers/getInstalledPackageVersions.d.ts +0 -2
- package/esm/helpers/getInstalledPackageVersions.d.ts.map +0 -1
- package/esm/helpers/getInstalledPackageVersions.js +0 -91
- package/esm/helpers/getProjectTasks.d.ts +0 -6
- package/esm/helpers/getProjectTasks.d.ts.map +0 -1
- package/esm/helpers/getProjectTasks.js +0 -17
- package/esm/helpers/getRuntime.d.ts +0 -5
- package/esm/helpers/getRuntime.d.ts.map +0 -1
- package/esm/helpers/getRuntime.js +0 -19
- package/esm/helpers/gitignoreEntries.d.ts +0 -2
- package/esm/helpers/gitignoreEntries.d.ts.map +0 -1
- package/esm/helpers/gitignoreEntries.js +0 -10
- package/esm/helpers/installPackages.d.ts +0 -7
- package/esm/helpers/installPackages.d.ts.map +0 -1
- package/esm/helpers/installPackages.js +0 -59
- package/esm/helpers/packageOptions.d.ts +0 -6
- package/esm/helpers/packageOptions.d.ts.map +0 -1
- package/esm/helpers/packageOptions.js +0 -6
- package/esm/helpers/packageRegistry.d.ts +0 -9
- package/esm/helpers/packageRegistry.d.ts.map +0 -1
- package/esm/helpers/packageRegistry.js +0 -84
- package/esm/helpers/projectManifest.d.ts +0 -12
- package/esm/helpers/projectManifest.d.ts.map +0 -1
- package/esm/helpers/projectManifest.js +0 -80
- package/esm/helpers/syncPackageDocs.d.ts +0 -3
- package/esm/helpers/syncPackageDocs.d.ts.map +0 -1
- package/esm/helpers/syncPackageDocs.js +0 -46
- package/esm/main.d.ts +0 -3
- package/esm/main.d.ts.map +0 -1
- package/esm/main.js +0 -94
- package/esm/package.json +0 -3
- package/script/_dnt.shims.d.ts +0 -2
- package/script/_dnt.shims.d.ts.map +0 -1
- package/script/_dnt.shims.js +0 -60
- package/script/helpers/createFolderStructure.d.ts +0 -2
- package/script/helpers/createFolderStructure.d.ts.map +0 -1
- package/script/helpers/createFolderStructure.js +0 -43
- package/script/helpers/ensureAgents.d.ts +0 -3
- package/script/helpers/ensureAgents.d.ts.map +0 -1
- package/script/helpers/ensureAgents.js +0 -179
- package/script/helpers/ensureEnvFile.d.ts +0 -2
- package/script/helpers/ensureEnvFile.d.ts.map +0 -1
- package/script/helpers/ensureEnvFile.js +0 -11
- package/script/helpers/ensureGitignore.d.ts +0 -3
- package/script/helpers/ensureGitignore.d.ts.map +0 -1
- package/script/helpers/ensureGitignore.js +0 -28
- package/script/helpers/ensureManagedSection.d.ts +0 -9
- package/script/helpers/ensureManagedSection.d.ts.map +0 -1
- package/script/helpers/ensureManagedSection.js +0 -36
- package/script/helpers/ensureReadme.d.ts +0 -2
- package/script/helpers/ensureReadme.d.ts.map +0 -1
- package/script/helpers/ensureReadme.js +0 -64
- package/script/helpers/fetchPackageDocs.d.ts +0 -8
- package/script/helpers/fetchPackageDocs.d.ts.map +0 -1
- package/script/helpers/fetchPackageDocs.js +0 -78
- package/script/helpers/getInstalledPackageVersions.d.ts +0 -2
- package/script/helpers/getInstalledPackageVersions.d.ts.map +0 -1
- package/script/helpers/getInstalledPackageVersions.js +0 -94
- package/script/helpers/getProjectTasks.d.ts +0 -6
- package/script/helpers/getProjectTasks.d.ts.map +0 -1
- package/script/helpers/getProjectTasks.js +0 -20
- package/script/helpers/getRuntime.d.ts +0 -5
- package/script/helpers/getRuntime.d.ts.map +0 -1
- package/script/helpers/getRuntime.js +0 -59
- package/script/helpers/gitignoreEntries.d.ts +0 -2
- package/script/helpers/gitignoreEntries.d.ts.map +0 -1
- package/script/helpers/gitignoreEntries.js +0 -13
- package/script/helpers/installPackages.d.ts +0 -7
- package/script/helpers/installPackages.d.ts.map +0 -1
- package/script/helpers/installPackages.js +0 -96
- package/script/helpers/packageOptions.d.ts +0 -6
- package/script/helpers/packageOptions.d.ts.map +0 -1
- package/script/helpers/packageOptions.js +0 -9
- package/script/helpers/packageRegistry.d.ts +0 -9
- package/script/helpers/packageRegistry.d.ts.map +0 -1
- package/script/helpers/packageRegistry.js +0 -88
- package/script/helpers/projectManifest.d.ts +0 -12
- package/script/helpers/projectManifest.d.ts.map +0 -1
- package/script/helpers/projectManifest.js +0 -84
- package/script/helpers/syncPackageDocs.d.ts +0 -3
- package/script/helpers/syncPackageDocs.d.ts.map +0 -1
- package/script/helpers/syncPackageDocs.js +0 -49
- package/script/main.d.ts +0 -3
- package/script/main.d.ts.map +0 -1
- package/script/main.js +0 -99
- package/script/package.json +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.mjs","names":["process","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","../src/helpers/ensureTooling.ts","../src/helpers/ensureVscode.ts","../package.json","../src/helpers/getProjectTasks.ts","../src/helpers/createFolderStructure.ts","../src/helpers/ensureEnvFile.ts","../src/helpers/ensureAgents.ts","../src/helpers/jsonObject.ts","../src/helpers/projectManifest.ts","../src/helpers/fetchPackageDocs.ts","../src/helpers/combinePlotDocs.ts","../src/helpers/plotDocPages.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 { log } from \"@clack/prompts\";\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 log.info(`${stats === undefined ? \"Created\" : \"Updated\"} ${path}`);\n}\n","import { log } from \"@clack/prompts\";\nimport { 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 = `<!-- Do not remove / setup-data-project:${options.name}:start -->`;\n const endMarker = `<!-- Do not remove / setup-data-project:${options.name}:end -->`;\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 = currentContent.indexOf(startMarker);\n const end = currentContent.indexOf(endMarker);\n\n if (start === -1 || end === -1 || end < start) {\n log.warn(\n `${options.path} was not updated because its setup-data-project markers ` +\n `were not found. Add ${startMarker} and ${endMarker}, then rerun the ` +\n \"script.\",\n );\n return \"missing-markers\";\n }\n\n const nextContent =\n currentContent.slice(0, start) + section + currentContent.slice(end + endMarker.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` : \"\"}Use sda/main.ts to process source data from sda/data/ and write results to sda/output/. Both data folders are ignored by Git. Put reusable helpers in sda/helpers/ and tests in sda/tests/. Import test utilities from \\`vite-plus/test\\`.\n\n- \\`${run} sda\\`: run the analysis and watch for changes.\n- \\`${run} test\\`: run tests; the default command also succeeds when no tests exist.\n- \\`${run} all-tests\\`: check types, lint, formatting, and tests.\n- \\`${run} fix\\`: apply formatting and automatic fixes.\n- \\`${run} docs\\`: refresh documentation for the installed library versions.\n- \\`${run} clean\\`: delete cached results and temporary files in .sda-cache/, .journalism-cache/, and .tmp/.\n\nIn VS Code, install the recommended Vite+ extension pack for Oxc formatting and linting and the Vitest test runner. Generated .vscode/settings.json enables formatting and lint fixes on save, plus visual line wrapping. Existing VS Code configuration files are preserved.\n\nThe generated docs/ folder is ignored by Git. Refresh it after cloning or updating dependencies. See AGENTS.md for documentation pointers.`,\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\";\nconst tools = [\"vite-plus\", \"typescript\", \"@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 runtimeTools.filter((pkg) => !installed.includes(pkg)).map((pkg) => `${pkg}@latest`),\n { development: true },\n );\n if (\n ![\n \"vite.config.ts\",\n \"vite.config.js\",\n \"vite.config.mts\",\n \"vite.config.mjs\",\n \"vite.config.cts\",\n \"vite.config.cjs\",\n ].some((file) => existsSync(file))\n ) {\n writeFileSync(\n \"vite.config.ts\",\n `import { defineConfig, loadEnv } from \"vite-plus\";\n\nexport default defineConfig({\n test: { env: loadEnv(\"test\", process.cwd(), \"\") },\n lint: { options: { typeAware: true, typeCheck: true } },\n fmt: { ignorePatterns: [\"docs/**\", \"sda/data/**\", \"sda/output/**\"] },\n});\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\", \"vite.config.*\"]\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\": { recommendations: [\"VoidZero.vite-plus-extension-pack\"] },\n \"settings.json\": {\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 };\n for (const [name, config] of Object.entries(files)) {\n const path = `.vscode/${name}`;\n if (!existsSync(path)) writeFileSync(path, `${JSON.stringify(config, null, 2)}\\n`);\n }\n}\n","","import { getRuntime, type Runtime } from \"./getRuntime.ts\";\nimport metadata from \"../../package.json\" with { type: \"json\" };\nexport function getProjectTasks(runtime: Runtime = getRuntime()) {\n const vp = runtime === \"bun\" ? \"bun run --bun vp\" : \"vp\";\n return {\n sda:\n runtime === \"bun\"\n ? \"bun run --watch sda/main.ts\"\n : \"node --env-file-if-exists=.env --watch sda/main.ts\",\n test: `${vp} test --passWithNoTests`,\n \"all-tests\": `${vp} check && ${runtime === \"bun\" ? \"bun\" : \"npm\"} run test`,\n clean: \"rm -rf .sda-cache .journalism-cache .tmp\",\n fix: `${vp} check --fix`,\n docs: `${runtime === \"bun\" ? \"bunx --bun\" : \"npx\"} @nshiab/setup-data-project@${metadata.version} --docs`,\n };\n}\n","import { existsSync, lstatSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { log } from \"@clack/prompts\";\n\nexport function createFolderStructure(selectedPackages: string[]) {\n const sdaFolder = \"sda\";\n const folders = [\"data\", \"helpers\", \"output\", \"tests\"];\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 log.info(`Created ${mainTsPath}`);\n }\n\n return sdaFolder;\n}\n","import { lstatSync, writeFileSync } from \"node:fs\";\nimport { log } from \"@clack/prompts\";\n\nexport function ensureEnvFile() {\n if (lstatSync(\".env\", { throwIfNoEntry: false }) === undefined) {\n writeFileSync(\".env\", \"\");\n log.info(\"Created .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 command =\n runtime === \"bun\" ? \"bun run sda/main.ts\" : \"node --env-file-if-exists=.env sda/main.ts\";\n const links = getInstalledPackageConfigs(installedPackages).map((pkg) => {\n if (pkg.value === \"@observablehq/plot\")\n return `- Observable Plot charts and maps: read \\`docs/observable-plot/llm.md\\` 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 package.json for the installed libraries and scripts. Prefer the installed data libraries when they cover the task.\n\nUse sda/main.ts as the entry point and sda/helpers/ for reusable helpers. Put tests in sda/tests/, source data in sda/data/, and results in sda/output/. Import test utilities from \\`vite-plus/test\\`.\n\nFor a single execution, run \\`${command}\\`. The sda script watches for changes. Before handing off code changes, run \\`${run} all-tests\\` and resolve failures.\n\nThe clean script removes cached results and temporary files. Run it only when those cached results can be discarded.\n\nLibrary documentation in docs/ is generated and ignored by Git. Run \\`${run} docs\\` when documentation is missing or after dependency changes; resolve refresh failures before using possibly stale references. Edit project source files rather than downloaded documentation.\n\n${links.join(\"\\n\")}`,\n });\n}\n","export function isObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\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","import { posix } from \"node:path\";\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 source = `https://github.com/observablehq/plot/tree/v${version}/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 =\n \"https://raw.githubusercontent.com/observablehq/plot/\" + `refs/tags/v${version}/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 `# Observable Plot ${version}\\n\\nPackage: \\`@observablehq/plot@${version}\\`. Source: [v${version}](${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. Vue components and plot fences are retained as source examples. 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\nfunction proseLines(content: string, transform: (line: string, number: number) => string): 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 { log } from \"@clack/prompts\";\nimport { mkdirSync, renameSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { combinePlotDocs } from \"./combinePlotDocs.ts\";\nimport { PLOT_DOC_PAGES } from \"./plotDocPages.ts\";\nimport type { PackageDocs } from \"./fetchPackageDocs.ts\";\n\n// Publish one reference only after every tagged page has been fetched.\nexport async function fetchPlotDocs(\n version: string,\n options: { preferStored?: boolean } = {},\n): Promise<PackageDocs> {\n const tag = `v${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 generateReference(version);\n mkdirSync(directory, { recursive: true });\n const temporaryPath = join(directory, \".llm.md.tmp\");\n try {\n writeFileSync(temporaryPath, llm);\n renameSync(temporaryPath, join(directory, \"llm.md\"));\n } finally {\n rmSync(temporaryPath, { force: true });\n }\n return { llm, 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\nasync function generateReference(version: string): Promise<string> {\n const tag = `v${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 return combinePlotDocs(version, documents);\n}\n\nfunction isStoredReference(content: string, version: string): boolean {\n const source = `https://github.com/observablehq/plot/tree/v${version}/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: [v${version}](${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 keep existing versions and 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)) {\n if (cliOptions.packages.length > 0) continue;\n\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);\n }\n } else {\n packagesToInstall.push(pkg);\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(\"✅ Package installation complete.\");\n\n projectManifest.reload();\n projectManifest.updateTasks(getProjectTasks());\n execFileSync(process.execPath, [\"node_modules/vite-plus/bin/vp\", \"fmt\", \"package.json\"], {\n stdio: \"pipe\",\n });\n\n const finalInstalledPackages = getInstalledPackageConfigs(\n projectManifest.getInstalledPackages(),\n ).map((pkg) => pkg.value);\n const docsMapping = await refreshDocs(projectManifest);\n\n createFolderStructure(finalInstalledPackages);\n\n ensureGitignore();\n\n ensureEnvFile();\n\n ensureVscode();\n\n ensureReadme(runtime, finalInstalledPackages);\n\n ensureAgents(docsMapping, runtime, finalInstalledPackages);\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 mapping = await syncPackageDocs(\n packages,\n getInstalledPackageVersions(manifest.getInstalledPackageSpecifiers()),\n );\n if (Object.keys(mapping).length !== packages.length) {\n console.error(\"Documentation refresh incomplete. See the warnings above.\");\n process.exitCode = 1;\n }\n return mapping;\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,OAAO;EACP,MAAM;EACN,MAAM;CACR;AACF;AAGA,MAAa,sBAAuC;CAClD,GAAG;CACH;EAAE,OAAO;EAAsB,OAAO;EAA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,MACEA,UAAQ,WACJ,2DACA,qBACN;AACF;AAEA,eAAe,YAAY,UAA2B;CACpD,MAAM,WAAW,2BAA2B,SAAS,qBAAqB,CAAC,CAAC,CAAC,KAC1E,QAAQ,IAAI,KACf;CACA,MAAM,UAAU,MAAM,gBACpB,UACA,4BAA4B,SAAS,8BAA8B,CAAC,CACtE;CACA,IAAI,OAAO,KAAK,OAAO,CAAC,CAAC,WAAW,SAAS,QAAQ;EACnD,QAAQ,MAAM,2DAA2D;EACzE,UAAQ,WAAW;CACrB;CACA,OAAO;AACT;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,29 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nshiab/setup-data-project",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Quickly kick off a project using simple-data-analysis-core, simple-data-analysis, and journalism libraries.",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "https://github.com/nshiab/setup-data-project"
|
|
8
|
-
},
|
|
9
5
|
"license": "MIT",
|
|
10
|
-
"
|
|
11
|
-
"module": "./esm/main.js",
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"import": "./esm/main.js",
|
|
15
|
-
"require": "./script/main.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"scripts": {},
|
|
6
|
+
"repository": "https://github.com/nshiab/setup-data-project",
|
|
19
7
|
"bin": {
|
|
20
|
-
"setup-data-project": "./
|
|
8
|
+
"setup-data-project": "./dist/main.mjs"
|
|
21
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
22
16
|
"publishConfig": {
|
|
23
17
|
"access": "public"
|
|
24
18
|
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"fix": "vp check --fix",
|
|
21
|
+
"all-tests": "vp check && vp test && vp pack",
|
|
22
|
+
"preversion": "node scripts/check-release-branch.ts && npm run all-tests",
|
|
23
|
+
"postversion": "git push --atomic origin HEAD \"v$npm_package_version\"",
|
|
24
|
+
"patch": "npm version patch",
|
|
25
|
+
"minor": "npm version minor",
|
|
26
|
+
"major": "npm version major"
|
|
27
|
+
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@clack/prompts": "^1.3.0"
|
|
29
|
+
"@clack/prompts": "^1.3.0",
|
|
30
|
+
"tar": "^7.5.11"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "24.19.2",
|
|
34
|
+
"typescript": "6.0.3",
|
|
35
|
+
"vite-plus": "1.2.0"
|
|
27
36
|
},
|
|
28
|
-
"
|
|
29
|
-
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=24.21.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/esm/_dnt.shims.d.ts
DELETED
package/esm/_dnt.shims.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
package/esm/_dnt.shims.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const dntGlobals = {};
|
|
2
|
-
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
3
|
-
function createMergeProxy(baseObj, extObj) {
|
|
4
|
-
return new Proxy(baseObj, {
|
|
5
|
-
get(_target, prop, _receiver) {
|
|
6
|
-
if (prop in extObj) {
|
|
7
|
-
return extObj[prop];
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return baseObj[prop];
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
set(_target, prop, value) {
|
|
14
|
-
if (prop in extObj) {
|
|
15
|
-
delete extObj[prop];
|
|
16
|
-
}
|
|
17
|
-
baseObj[prop] = value;
|
|
18
|
-
return true;
|
|
19
|
-
},
|
|
20
|
-
deleteProperty(_target, prop) {
|
|
21
|
-
let success = false;
|
|
22
|
-
if (prop in extObj) {
|
|
23
|
-
delete extObj[prop];
|
|
24
|
-
success = true;
|
|
25
|
-
}
|
|
26
|
-
if (prop in baseObj) {
|
|
27
|
-
delete baseObj[prop];
|
|
28
|
-
success = true;
|
|
29
|
-
}
|
|
30
|
-
return success;
|
|
31
|
-
},
|
|
32
|
-
ownKeys(_target) {
|
|
33
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
34
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
35
|
-
const extKeysSet = new Set(extKeys);
|
|
36
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
37
|
-
},
|
|
38
|
-
defineProperty(_target, prop, desc) {
|
|
39
|
-
if (prop in extObj) {
|
|
40
|
-
delete extObj[prop];
|
|
41
|
-
}
|
|
42
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
43
|
-
return true;
|
|
44
|
-
},
|
|
45
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
46
|
-
if (prop in extObj) {
|
|
47
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
has(_target, prop) {
|
|
54
|
-
return prop in extObj || prop in baseObj;
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFolderStructure.d.ts","sourceRoot":"","sources":["../../src/helpers/createFolderStructure.ts"],"names":[],"mappings":"AAIA,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,EAAE,UA6C/D"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { existsSync, lstatSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { log } from "@clack/prompts";
|
|
4
|
-
export function createFolderStructure(selectedPackages) {
|
|
5
|
-
const sdaFolder = "sda";
|
|
6
|
-
const folders = ["data", "helpers", "output", "tests"];
|
|
7
|
-
if (!existsSync(sdaFolder)) {
|
|
8
|
-
mkdirSync(sdaFolder, { recursive: true });
|
|
9
|
-
}
|
|
10
|
-
for (const folder of folders) {
|
|
11
|
-
const path = join(sdaFolder, folder);
|
|
12
|
-
if (!existsSync(path)) {
|
|
13
|
-
mkdirSync(path, { recursive: true });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const mainTsPath = join(sdaFolder, "main.ts");
|
|
17
|
-
let mainTsContent = 'console.log("Hello simple-data-analysis!");\n';
|
|
18
|
-
if (selectedPackages.includes("@nshiab/simple-data-analysis") ||
|
|
19
|
-
selectedPackages.includes("@nshiab/simple-data-analysis-core")) {
|
|
20
|
-
const pkg = selectedPackages.includes("@nshiab/simple-data-analysis")
|
|
21
|
-
? "@nshiab/simple-data-analysis"
|
|
22
|
-
: "@nshiab/simple-data-analysis-core";
|
|
23
|
-
mainTsContent = `import { SimpleDB } from "${pkg}";
|
|
24
|
-
|
|
25
|
-
const sdb = new SimpleDB();
|
|
26
|
-
const table = sdb.newTable();
|
|
27
|
-
|
|
28
|
-
await table
|
|
29
|
-
.loadArray([{ message: "Hello simple-data-analysis!" }])
|
|
30
|
-
.log();
|
|
31
|
-
|
|
32
|
-
await sdb.close();
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
35
|
-
if (lstatSync(mainTsPath, { throwIfNoEntry: false }) === undefined) {
|
|
36
|
-
writeFileSync(mainTsPath, mainTsContent);
|
|
37
|
-
log.info(`Created ${mainTsPath}`);
|
|
38
|
-
}
|
|
39
|
-
return sdaFolder;
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureAgents.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureAgents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOzD,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACxC,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAA6B,QAqLvD"}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { log } from "@clack/prompts";
|
|
2
|
-
import { ensureManagedSection } from "./ensureManagedSection.js";
|
|
3
|
-
import { getInstalledPackageConfigs, SUPPORTED_PACKAGES, } from "./packageRegistry.js";
|
|
4
|
-
export function ensureAgents(docsMapping, runtime, installedPackages = Object.keys(docsMapping)) {
|
|
5
|
-
let journalismFunctions = "";
|
|
6
|
-
let sdaClassesAndMethods = "";
|
|
7
|
-
let sdaDocsPath = "";
|
|
8
|
-
let sdaReadmePath = "";
|
|
9
|
-
let sdaLibraryName = "";
|
|
10
|
-
const journalismFunctionsByPackage = new Map();
|
|
11
|
-
for (const [pkg, docs] of Object.entries(docsMapping)) {
|
|
12
|
-
const pkgConfig = SUPPORTED_PACKAGES.find((p) => p.value === pkg);
|
|
13
|
-
const pkgType = pkgConfig?.type || "other";
|
|
14
|
-
const doc = docs.llm;
|
|
15
|
-
if (doc === undefined)
|
|
16
|
-
continue;
|
|
17
|
-
if (pkgType === "journalism") {
|
|
18
|
-
const repoName = pkg.split("/")[1];
|
|
19
|
-
const functions = doc
|
|
20
|
-
.split("\n")
|
|
21
|
-
.filter((line) => line.trim().startsWith("#"))
|
|
22
|
-
.filter((line) => {
|
|
23
|
-
const depth = line.match(/^#+/)?.[0].length || 0;
|
|
24
|
-
return depth === 2;
|
|
25
|
-
})
|
|
26
|
-
.map((line) => line.replace(/^#+\s+/, "").trim());
|
|
27
|
-
journalismFunctionsByPackage.set(pkg, functions);
|
|
28
|
-
journalismFunctions += `\n### ${repoName}\n\n`;
|
|
29
|
-
journalismFunctions += functions.map((name) => `- ${name}`).join("\n") +
|
|
30
|
-
"\n";
|
|
31
|
-
}
|
|
32
|
-
else if (pkgType === "sda") {
|
|
33
|
-
const repoName = pkg.split("/")[1];
|
|
34
|
-
sdaDocsPath = `./docs/${repoName}/llm.md`;
|
|
35
|
-
sdaReadmePath = docs.readme === undefined
|
|
36
|
-
? ""
|
|
37
|
-
: `./docs/${repoName}/README.md`;
|
|
38
|
-
sdaLibraryName = pkgConfig?.label || repoName;
|
|
39
|
-
sdaClassesAndMethods = doc
|
|
40
|
-
.split("\n")
|
|
41
|
-
.filter((line) => line.trim().startsWith("#"))
|
|
42
|
-
.filter((line) => {
|
|
43
|
-
const depth = line.match(/^#+/)?.[0].length || 0;
|
|
44
|
-
if (depth === 2)
|
|
45
|
-
return true;
|
|
46
|
-
if (depth !== 4)
|
|
47
|
-
return false;
|
|
48
|
-
const heading = line.replace(/^#+\s+/, "").replaceAll("`", "")
|
|
49
|
-
.trim();
|
|
50
|
-
return heading !== "Parameters";
|
|
51
|
-
})
|
|
52
|
-
.map((line) => {
|
|
53
|
-
const depth = line.match(/^#+/)?.[0].length || 0;
|
|
54
|
-
if (depth === 2) {
|
|
55
|
-
return "\n" + line.replace(/^#+\s+/, "").trim();
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
return line.replace(/^#+\s+/, " - ")
|
|
59
|
-
.replaceAll("`", "");
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
.join("\n");
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const configFile = runtime === "deno" ? "deno.json" : "package.json";
|
|
66
|
-
const runSdaOnce = runtime === "deno"
|
|
67
|
-
? "deno run -A --env --check sda/main.ts"
|
|
68
|
-
: runtime === "bun"
|
|
69
|
-
? "bun run sda/main.ts"
|
|
70
|
-
: "node --env-file-if-exists=.env --experimental-strip-types sda/main.ts";
|
|
71
|
-
const runClean = runtime === "deno" ? "deno task clean" : "npm run clean";
|
|
72
|
-
const runAllTests = runtime === "deno"
|
|
73
|
-
? "deno task all-tests"
|
|
74
|
-
: runtime === "bun"
|
|
75
|
-
? "bun run all-tests"
|
|
76
|
-
: "npm run all-tests";
|
|
77
|
-
const installedPackageConfigs = getInstalledPackageConfigs(installedPackages);
|
|
78
|
-
const importExamples = installedPackageConfigs.flatMap((pkg) => {
|
|
79
|
-
if (pkg.type === "sda") {
|
|
80
|
-
return [`import { SimpleDB } from "${pkg.value}";`];
|
|
81
|
-
}
|
|
82
|
-
const functionName = journalismFunctionsByPackage.get(pkg.value)
|
|
83
|
-
?.map((name) => name.replaceAll("`", ""))
|
|
84
|
-
.find((name) => /^[A-Za-z_$][\w$]*$/.test(name));
|
|
85
|
-
return functionName
|
|
86
|
-
? [`import { ${functionName} } from "${pkg.value}";`]
|
|
87
|
-
: [];
|
|
88
|
-
});
|
|
89
|
-
let libraryGuidance = "";
|
|
90
|
-
if (installedPackageConfigs.length > 0) {
|
|
91
|
-
const libraryNames = installedPackageConfigs.map((pkg) => `"${pkg.value}"`)
|
|
92
|
-
.join(", ");
|
|
93
|
-
const libraryNoun = installedPackageConfigs.length === 1
|
|
94
|
-
? "library"
|
|
95
|
-
: "libraries";
|
|
96
|
-
libraryGuidance = `
|
|
97
|
-
Always prioritize the installed ${libraryNames} ${libraryNoun} when relevant.
|
|
98
|
-
`;
|
|
99
|
-
const documentationGuidance = installedPackageConfigs.flatMap((pkg) => {
|
|
100
|
-
const docs = docsMapping[pkg.value];
|
|
101
|
-
if (!docs)
|
|
102
|
-
return [];
|
|
103
|
-
const repoName = pkg.value.split("/")[1];
|
|
104
|
-
const availableDocs = [
|
|
105
|
-
docs.readme === undefined
|
|
106
|
-
? ""
|
|
107
|
-
: `overview and practical examples at \`./docs/${repoName}/README.md\``,
|
|
108
|
-
docs.llm === undefined
|
|
109
|
-
? ""
|
|
110
|
-
: `complete API documentation at \`./docs/${repoName}/llm.md\``,
|
|
111
|
-
].filter(Boolean);
|
|
112
|
-
return availableDocs.length === 0
|
|
113
|
-
? []
|
|
114
|
-
: [`- \`${pkg.value}\`: ${availableDocs.join("; ")}`];
|
|
115
|
-
});
|
|
116
|
-
if (documentationGuidance.length > 0) {
|
|
117
|
-
libraryGuidance += `
|
|
118
|
-
The following documentation was fetched for the exact installed library versions. Consult it when relevant:
|
|
119
|
-
|
|
120
|
-
${documentationGuidance.join("\n")}
|
|
121
|
-
`;
|
|
122
|
-
}
|
|
123
|
-
if (importExamples.length > 0) {
|
|
124
|
-
libraryGuidance += `APIs can be imported with named imports like this:
|
|
125
|
-
\`\`\`typescript
|
|
126
|
-
${importExamples.join("\n")}
|
|
127
|
-
\`\`\`
|
|
128
|
-
`;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
let content = `Always verify if there is a ${configFile} file in the root of the project and familiarize yourself with the scripts available in it and the libraries already installed in the project.
|
|
132
|
-
|
|
133
|
-
Run \`sda/main.ts\` with \`${runSdaOnce}\`. Do not use the \`sda\` task for agent-driven checks because it runs in watch mode and will keep waiting for file changes.
|
|
134
|
-
|
|
135
|
-
Before handing off your work, always run \`${runAllTests}\`, even if no tests have been added yet. Fix any errors or warnings it reports.
|
|
136
|
-
|
|
137
|
-
The \`clean\` task (e.g. \`${runClean}\`) removes caches and other temporary files. Do not run it routinely. Cached results can be especially valuable for computationally expensive operations or API calls. If you are unsure whether the caches should be removed, ask the user first.
|
|
138
|
-
|
|
139
|
-
Always use "sda/main.ts" as the entry point.
|
|
140
|
-
|
|
141
|
-
If you need to create other TypeScript files, create them in the "sda/helpers" folder. Prioritize the use of helper functions to keep the code well organized and maintainable, with one helper function per file, with the file named after the function. Prioritize default exports for helper functions.
|
|
142
|
-
|
|
143
|
-
Put tests in the "sda/tests" folder. Write focused tests for reusable helpers and important data transformations when appropriate. When testing a helper from "sda/helpers/functionName.ts", name its test file "sda/tests/functionName.test.ts".
|
|
144
|
-
|
|
145
|
-
If you need to download data, always put the files in the "sda/data" folder, which is ignored by Git.
|
|
146
|
-
|
|
147
|
-
If you need to output data to a file, always put the file in the "sda/output" folder, which is also ignored by Git.
|
|
148
|
-
${libraryGuidance}`;
|
|
149
|
-
if (journalismFunctions !== "") {
|
|
150
|
-
content += `
|
|
151
|
-
Here are the functions available in the "journalism" libraries. If one of the functions might be relevant, search its complete API documentation in the corresponding \`./docs/<library-name>/llm.md\` file to properly use it.
|
|
152
|
-
${journalismFunctions}`;
|
|
153
|
-
}
|
|
154
|
-
if (sdaClassesAndMethods !== "") {
|
|
155
|
-
const readmeGuidance = sdaReadmePath === ""
|
|
156
|
-
? ""
|
|
157
|
-
: ` An overview and practical examples are available at "${sdaReadmePath}".`;
|
|
158
|
-
content += `
|
|
159
|
-
Here are the classes and their methods available in the "${sdaLibraryName}" library.${readmeGuidance} If one of the classes or methods might be relevant, search the complete API documentation at "${sdaDocsPath}" to properly use it.
|
|
160
|
-
|
|
161
|
-
Most data-loading and transformation methods are synchronous, chainable builders. Await the final asynchronous observer or export method, such as \`log()\`, \`getData()\`, or \`writeData()\`, to execute the queued operations. If a chain ends without an observer, call \`run()\`. Always call \`await sdb.close()\` when the database is no longer needed. Methods that return an answer or export to an external service can be asynchronous, so verify their documentation before calling them.
|
|
162
|
-
${sdaClassesAndMethods}`;
|
|
163
|
-
}
|
|
164
|
-
const status = ensureManagedSection({
|
|
165
|
-
path: "AGENTS.md",
|
|
166
|
-
name: "agents",
|
|
167
|
-
content,
|
|
168
|
-
createContent: (managedSection) => managedSection,
|
|
169
|
-
});
|
|
170
|
-
if (status === "created") {
|
|
171
|
-
log.info("Created AGENTS.md");
|
|
172
|
-
}
|
|
173
|
-
else if (status === "updated") {
|
|
174
|
-
log.info("Updated AGENTS.md");
|
|
175
|
-
}
|
|
176
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureEnvFile.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureEnvFile.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,SAK5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureGitignore.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureGitignore.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,4DAC4B,CAAC;AAE5D,wBAAgB,eAAe,SA0B9B"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { lstatSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { log } from "@clack/prompts";
|
|
3
|
-
import { GITIGNORE_ENTRIES } from "./gitignoreEntries.js";
|
|
4
|
-
export const GITIGNORE_SENTINEL = "# Added by setup-data-project. Do not remove this line.";
|
|
5
|
-
export function ensureGitignore() {
|
|
6
|
-
const path = ".gitignore";
|
|
7
|
-
const stats = lstatSync(path, { throwIfNoEntry: false });
|
|
8
|
-
if (stats?.isSymbolicLink()) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const content = stats === undefined ? "" : readFileSync(path, "utf-8");
|
|
12
|
-
const hasSentinel = content.split("\n").some((line) => line.trim() === GITIGNORE_SENTINEL);
|
|
13
|
-
if (hasSentinel) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const separator = content === ""
|
|
17
|
-
? ""
|
|
18
|
-
: content.endsWith("\n")
|
|
19
|
-
? "\n"
|
|
20
|
-
: "\n\n";
|
|
21
|
-
const block = `${GITIGNORE_SENTINEL}\n${GITIGNORE_ENTRIES.join("\n")}\n`;
|
|
22
|
-
writeFileSync(path, content + separator + block);
|
|
23
|
-
log.info(`${stats === undefined ? "Created" : "Updated"} ${path}`);
|
|
24
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface ManagedSectionOptions {
|
|
2
|
-
path: string;
|
|
3
|
-
name: string;
|
|
4
|
-
content: string;
|
|
5
|
-
createContent: (section: string) => string;
|
|
6
|
-
}
|
|
7
|
-
export declare function ensureManagedSection(options: ManagedSectionOptions): "created" | "updated" | "unchanged" | "missing-markers";
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=ensureManagedSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureManagedSection.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureManagedSection.ts"],"names":[],"mappings":"AAGA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,iBAAiB,CAwCzD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { log } from "@clack/prompts";
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
export function ensureManagedSection(options) {
|
|
4
|
-
const startMarker = `<!-- Do not remove / setup-data-project:${options.name}:start -->`;
|
|
5
|
-
const endMarker = `<!-- Do not remove / setup-data-project:${options.name}:end -->`;
|
|
6
|
-
const trimmedContent = options.content.trim();
|
|
7
|
-
const section = trimmedContent === ""
|
|
8
|
-
? `${startMarker}\n${endMarker}`
|
|
9
|
-
: `${startMarker}\n${trimmedContent}\n${endMarker}`;
|
|
10
|
-
if (!existsSync(options.path)) {
|
|
11
|
-
writeFileSync(options.path, ensureFinalNewline(options.createContent(section)));
|
|
12
|
-
return "created";
|
|
13
|
-
}
|
|
14
|
-
const currentContent = readFileSync(options.path, "utf-8");
|
|
15
|
-
const start = currentContent.indexOf(startMarker);
|
|
16
|
-
const end = currentContent.indexOf(endMarker);
|
|
17
|
-
if (start === -1 || end === -1 || end < start) {
|
|
18
|
-
log.warn(`${options.path} was not updated because its setup-data-project markers ` +
|
|
19
|
-
`were not found. Add ${startMarker} and ${endMarker}, then rerun the ` +
|
|
20
|
-
"script.");
|
|
21
|
-
return "missing-markers";
|
|
22
|
-
}
|
|
23
|
-
const nextContent = currentContent.slice(0, start) + section +
|
|
24
|
-
currentContent.slice(end + endMarker.length);
|
|
25
|
-
if (nextContent === currentContent) {
|
|
26
|
-
return "unchanged";
|
|
27
|
-
}
|
|
28
|
-
writeFileSync(options.path, ensureFinalNewline(nextContent));
|
|
29
|
-
return "updated";
|
|
30
|
-
}
|
|
31
|
-
function ensureFinalNewline(content) {
|
|
32
|
-
return content.endsWith("\n") ? content : content + "\n";
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureReadme.d.ts","sourceRoot":"","sources":["../../src/helpers/ensureReadme.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,iBAAiB,GAAE,MAAM,EAAO,QAsEjC"}
|