Files
sandwich-hime-tooling/scripts/package-release.js
T
gamertan 6df87bc958 feat: publish Sandwich Hime tooling preview
Publish the exact sanitized Agent Skill and VS Code preview source tree with independent license boundaries, deterministic provenance manifests, and no private development history. Material design and implementation assistance was provided by OpenAI Codex.

Signed-off-by: Cole Speelman <crspeelman@gmail.com>
2026-08-12 20:33:51 -04:00

38 lines
1.5 KiB
JavaScript

// SPDX-License-Identifier: AGPL-3.0-only
'use strict';
const childProcess = require('node:child_process');
const crypto = require('node:crypto');
const fs = require('node:fs');
const path = require('node:path');
const root = path.join(__dirname, '..');
const artifacts = path.join(root, 'artifacts');
const editor = path.join(root, 'editors', 'vscode');
fs.mkdirSync(artifacts, {recursive: true});
function run(command, args, cwd) {
const result = childProcess.spawnSync(command, args, {cwd, encoding: 'utf8'});
if (result.status !== 0) throw new Error(`${command} failed:\n${result.stderr || result.stdout}`);
}
run('go', ['run', './scripts/package-skill.go'], root);
run(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['run', 'package:vsix'], editor);
const sbom = childProcess.spawnSync('node', ['scripts/sbom.js'], {cwd: editor, encoding: 'utf8'});
if (sbom.status !== 0) throw new Error(`SBOM generation failed:\n${sbom.stderr}`);
const sbomName = 'sandwich-hime-0.1.0-preview.1.cdx.json';
fs.writeFileSync(path.join(artifacts, sbomName), sbom.stdout, {encoding: 'utf8', mode: 0o644});
const names = [
'sandwich-hime-skill-v0.1.0.zip',
'sandwich-hime-0.1.0-preview.1.vsix',
sbomName,
];
const sums = names.map((name) => {
const bytes = fs.readFileSync(path.join(artifacts, name));
return `${crypto.createHash('sha256').update(bytes).digest('hex')} ${name}`;
});
fs.writeFileSync(path.join(artifacts, 'SHA256SUMS'), `${sums.join('\n')}\n`, {encoding: 'utf8', mode: 0o644});
console.log(sums.join('\n'));