@esquadrao/cli 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import os from 'node:os';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { execSync } from 'node:child_process';
6
+ import { ensureBundledPath, binaryReport } from '../binaries.js';
6
7
 
7
8
  function checkBinary(name) {
8
9
  try {
@@ -14,20 +15,11 @@ function checkBinary(name) {
14
15
  }
15
16
  }
16
17
 
18
+ // Zero config: o ffmpeg vem como optionalDependency do pacote. Nada de brew,
19
+ // winget ou sudo; apenas expomos os binários no PATH do processo.
17
20
  export function tryAutoInstallFfmpeg() {
18
- if (checkBinary('ffmpeg') && checkBinary('ffprobe')) return true;
19
- try {
20
- if (process.platform === 'darwin') {
21
- execSync('brew install ffmpeg', { stdio: 'ignore', timeout: 60000 });
22
- } else if (process.platform === 'win32') {
23
- execSync('winget install Gyan.FFmpeg --accept-package-agreements --accept-source-agreements', { stdio: 'ignore', timeout: 60000 });
24
- } else {
25
- execSync('which apt-get && (apt-get update -qq && apt-get install -y -qq ffmpeg) || sudo apt-get update -qq && sudo apt-get install -y -qq ffmpeg', { stdio: 'ignore', timeout: 60000 });
26
- }
27
- return checkBinary('ffmpeg') && checkBinary('ffprobe');
28
- } catch {
29
- return false;
30
- }
21
+ ensureBundledPath();
22
+ return checkBinary('ffmpeg') && checkBinary('ffprobe');
31
23
  }
32
24
 
33
25
  const SKILLS = [
@@ -64,6 +56,14 @@ export async function run({ positionals = [], flags = {} } = {}) {
64
56
  const destDir = destArg || path.join(cwd, '.agents', 'skills');
65
57
 
66
58
  fs.mkdirSync(destDir, { recursive: true });
59
+ // RAG local: o catálogo semântico vai para o workspace, separado das skills.
60
+ const workspaceDir = destArg ? path.resolve(destArg) : cwd;
61
+ const catalogSrc = path.join(rootDir, 'assets', 'broll-catalog.json');
62
+ const catalogDest = path.join(workspaceDir, '.esquadrao', 'broll-catalog.json');
63
+ if (fs.existsSync(catalogSrc)) {
64
+ fs.mkdirSync(path.dirname(catalogDest), { recursive: true });
65
+ fs.copyFileSync(catalogSrc, catalogDest);
66
+ }
67
67
  const installed = [];
68
68
  for (const item of [...SKILLS, 'scripts']) {
69
69
  const src = path.join(rootDir, item);
@@ -143,17 +143,14 @@ export async function run({ positionals = [], flags = {} } = {}) {
143
143
  const nodeOk = nodeMajor >= 18;
144
144
 
145
145
  let hasFfmpeg = checkBinary('ffmpeg') && checkBinary('ffprobe');
146
- let autoInstalledFfmpeg = false;
147
- if (!hasFfmpeg) {
148
- autoInstalledFfmpeg = tryAutoInstallFfmpeg();
149
- hasFfmpeg = checkBinary('ffmpeg') && checkBinary('ffprobe');
150
- }
146
+ if (!hasFfmpeg) hasFfmpeg = tryAutoInstallFfmpeg();
147
+ const binaries = binaryReport();
151
148
 
152
149
  const report = {
153
150
  status: nodeOk ? 'ok' : 'degraded',
154
151
  prerequisites: {
155
152
  node: { version: process.version, valid: nodeOk },
156
- ffmpeg: { valid: hasFfmpeg, auto_installed: autoInstalledFfmpeg }
153
+ ffmpeg: { valid: hasFfmpeg, source: binaries.ffmpeg.source }
157
154
  },
158
155
  installation: { destination: destDir, installed },
159
156
  harnesses,
@@ -164,7 +161,12 @@ export async function run({ positionals = [], flags = {} } = {}) {
164
161
  } else {
165
162
  console.log(`Esquadrão Setup: ${report.status.toUpperCase()}`);
166
163
  console.log(`- Node.js: ${process.version} (${nodeOk ? 'OK' : 'Requires >= 18'})`);
167
- console.log(`- FFmpeg & ffprobe: ${hasFfmpeg ? (autoInstalledFfmpeg ? 'Instalado automaticamente com sucesso!' : 'OK') : 'Pendente (peça ao seu agente de IA: "instale o ffmpeg para mim")'}`);
164
+ const ffmpegLabel = !hasFfmpeg
165
+ ? 'indisponível (rode "npm install" novamente para restaurar o binário embutido)'
166
+ : binaries.ffmpeg.source === 'bundled'
167
+ ? 'embutido no pacote (nada a instalar)'
168
+ : 'OK (binário do sistema)';
169
+ console.log(`- FFmpeg & ffprobe: ${ffmpegLabel}`);
168
170
  console.log(`- Installed ${installed.length} items to ${destDir}`);
169
171
  if (harnesses.length) console.log(`- Harnesses detected: ${harnesses.join(', ')}`);
170
172
  }