#!/usr/bin/env node
'use strict';

const path = require('path');
const fs = require('fs');

const binDir = path.join(__dirname, '..', 'bin');
const targetsDir = path.join(binDir, 'targets');
const expected = [
  'skill-cli-darwin-arm64',
  'skill-cli-darwin-x64',
  'skill-cli-linux-arm64',
  'skill-cli-linux-x64',
  'skill-cli-win32-x64.exe',
];

const missing = expected.filter((name) => !fs.existsSync(path.join(targetsDir, name)));

if (missing.length > 0) {
  console.error('skill-cli: missing bundled binaries for npm publish:');
  for (const name of missing) {
    console.error('  - ' + name);
  }
  console.error('Run: bash scripts/build-all.sh');
  process.exit(1);
}
