main
claude/code-feature-parity-q003hm
claude/elegant-carson-l1menh
claude/sigit-acp-local-chat-cx6380
claude/sigit-cloud-agent-expansion-reox0a
claude/tool-permission-system
claude/zen-feynman-0u78dk
development
feature/agent-tools-multiedit-glob-todos-remember
feature/background-commands
feature/commit-coauthor-attribution
feature/headless-mode
feature/init-command
feature/load-local-model-explicitly
feature/session-persistence-compaction
feature/sigit-code-cloud
feature/subagent-tool
feature/tool-permission-system
feature/tui-repo-tabs
feature/tui-tabs
main
release/v1.3.1
| 1 | #!/usr/bin/env node |
| 2 | |
| 3 | const fs = require("fs"); |
| 4 | const path = require("path"); |
| 5 | |
| 6 | const [packageName, version, operatingSystem, architecture] = |
| 7 | process.argv.slice(2); |
| 8 | |
| 9 | if (!packageName || !version || !operatingSystem || !architecture) { |
| 10 | throw new Error( |
| 11 | "Usage: render-platform-package.cjs <package-name> <version> <os> <arch>", |
| 12 | ); |
| 13 | } |
| 14 | |
| 15 | const npmRoot = path.resolve(__dirname, ".."); |
| 16 | const packageDirectory = path.resolve(npmRoot, packageName); |
| 17 | |
| 18 | fs.mkdirSync(packageDirectory, { recursive: true }); |
| 19 | |
| 20 | // Variable map for template interpolation |
| 21 | const vars = { |
| 22 | node_pkg: packageName, |
| 23 | node_version: version, |
| 24 | node_os: operatingSystem, |
| 25 | node_arch: architecture, |
| 26 | }; |
| 27 | |
| 28 | /** |
| 29 | * Replace every `${key}` in the template with the corresponding value from vars. |
| 30 | */ |
| 31 | function interpolate(template, variables) { |
| 32 | return template.replace(/\$\{(\w+)\}/g, (match, key) => { |
| 33 | if (key in variables) return variables[key]; |
| 34 | return match; |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | // Read and interpolate package.json.tmpl |
| 39 | const packageTemplate = fs.readFileSync( |
| 40 | path.join(npmRoot, "package.json.tmpl"), |
| 41 | "utf-8", |
| 42 | ); |
| 43 | fs.writeFileSync( |
| 44 | path.join(packageDirectory, "package.json"), |
| 45 | interpolate(packageTemplate, vars), |
| 46 | ); |
| 47 | |
| 48 | // Read and interpolate README.md.tmpl |
| 49 | const readmeTemplate = fs.readFileSync( |
| 50 | path.join(npmRoot, "README.md.tmpl"), |
| 51 | "utf-8", |
| 52 | ); |
| 53 | fs.writeFileSync( |
| 54 | path.join(packageDirectory, "README.md"), |
| 55 | interpolate(readmeTemplate, vars), |
| 56 | ); |