Download writers/make-packet.mjs from PulseOS/budgetbench: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/datasets/PulseOS/budgetbench/resolve/main/writers/make-packet.mjs
- Command line
-
hf download hf://datasets/PulseOS/budgetbench/writers/make-packet.mjs
-
curl -L -o make-packet.mjs https://huggingface.co/datasets/PulseOS/budgetbench/resolve/main/writers/make-packet.mjs
1.9 kB
| // Build a writer's packet: everything a writer may see, and nothing else, in a folder OUTSIDE the repository (so a | |
| // writer started there sees no project instructions, no app code and no other split). | |
| // node budgetbench/writers/make-packet.mjs <household dir> <persona.md> <packet dir> | |
| import fs from "node:fs"; | |
| import path from "node:path"; | |
| import {fileURLToPath} from "node:url"; | |
| const HERE = path.dirname(fileURLToPath(import.meta.url)); | |
| const [hh, persona, out] = process.argv.slice(2); | |
| if (!out) { console.error("usage: make-packet.mjs <household dir> <persona.md> <packet dir>"); process.exit(2); } | |
| fs.rmSync(out, {recursive: true, force: true}); | |
| fs.mkdirSync(path.join(out, "household/truth"), {recursive: true}); | |
| fs.mkdirSync(path.join(out, "tools"), {recursive: true}); | |
| for (const f of ["ledger.csv", "setup.json", "merchants.json"]) fs.copyFileSync(path.join(hh, "truth", f), path.join(out, "household/truth", f)); | |
| // (the setup's load list names the source files, which are not in the packet: drop it) | |
| const setup = JSON.parse(fs.readFileSync(path.join(out, "household/truth/setup.json"), "utf8")); | |
| delete setup.load; delete setup.shape; delete setup.region; | |
| fs.writeFileSync(path.join(out, "household/truth/setup.json"), JSON.stringify(setup, null, 1) + "\n"); | |
| fs.copyFileSync(path.join(HERE, "BRIEF.md"), path.join(out, "BRIEF.md")); | |
| fs.copyFileSync(path.join(HERE, "../help/HELP.md"), path.join(out, "HELP.md")); | |
| fs.copyFileSync(persona, path.join(out, "PERSONA.md")); | |
| fs.copyFileSync(path.join(HERE, "validate.mjs"), path.join(out, "tools/validate.mjs")); | |
| fs.copyFileSync(path.join(HERE, "../households/csv.mjs"), path.join(out, "tools/csv.mjs")); | |
| fs.writeFileSync(path.join(out, "tools/oracle.mjs"), fs.readFileSync(path.join(HERE, "../oracle/oracle.mjs"), "utf8").replace('"../households/csv.mjs"', '"./csv.mjs"')); | |
| console.log(`packet ready: ${out}`); | |