smoke.js 1.0 KB

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env node
  2. const fs = require('fs');
  3. const path = require('path');
  4. const { pathToFileURL } = require('url');
  5. const ROOT = path.resolve(__dirname, '..');
  6. const SKILL_DIR = path.join(ROOT, 'skills', 'fmode-vision');
  7. function fail(msg) { console.error('SMOKE FAIL: ' + msg); process.exit(1); }
  8. const required = [
  9. 'SKILL.md',
  10. 'scripts/vision-client.mjs',
  11. 'scripts/prompts/room-measurement.mjs'
  12. ];
  13. for (const rel of required) {
  14. if (!fs.existsSync(path.join(SKILL_DIR, rel))) fail('missing ' + rel);
  15. }
  16. (async () => {
  17. const mod = await import(pathToFileURL(path.join(SKILL_DIR, 'scripts', 'vision-client.mjs')).href);
  18. for (const fn of ['resolveApiToken', 'callVisionAPI', 'callMultiPass', 'extractJSON']) {
  19. if (typeof mod[fn] !== 'function') fail('export ' + fn + ' is not a function');
  20. }
  21. const { parsed } = mod.extractJSON('text {"a":1} tail');
  22. if (!parsed || parsed.a !== 1) fail('extractJSON did not parse JSON');
  23. console.log('SMOKE OK: fmode-vision package structure + module exports verified');
  24. })().catch(e => fail(e.message));