agim-orchestrator 1.1.3 → 1.1.4
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.
- package/CHANGELOG.md +17 -0
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/agim-cli.cjs +41 -7
- package/scripts/bootstrap-init.cjs +14 -12
- package/scripts/sync-agents-md.cjs +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,23 @@ e este projeto adere ao [Versionamento Semântico](https://semver.org/lang/pt-BR
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## [1.1.4] - 2026-10-29
|
|
18
|
+
|
|
19
|
+
### Adicionado
|
|
20
|
+
- **`--json` em todos os comandos** — `sync`, `graph`, `rag:rebuild`, `core:link` agora suportam saída estruturada para CI/CD e integração com ferramentas externas.
|
|
21
|
+
- **`agim init` com RAG por padrão** — tenta criar índice do projeto se `@xenova/transformers` estiver disponível; caso contrário, orienta como instalar.
|
|
22
|
+
|
|
23
|
+
### Corrigido
|
|
24
|
+
- **`agim sync --json`** — saída estruturada para automação.
|
|
25
|
+
- **`agim graph --json`** — captura saída do Graphify e retorna JSON.
|
|
26
|
+
- **`agim rag:rebuild --json`** — output estruturado (sucesso/erro).
|
|
27
|
+
- **`agim core:link --json`** — resultado estruturado do link.
|
|
28
|
+
|
|
29
|
+
### Alterado
|
|
30
|
+
- `agim init` não pula mais RAG silenciosamente — tenta criar índice do projeto por padrão.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
17
34
|
## [1.1.3] - 2026-10-29
|
|
18
35
|
|
|
19
36
|
### Adicionado
|
package/README.en.md
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
package/scripts/agim-cli.cjs
CHANGED
|
@@ -153,13 +153,14 @@ const COMMANDS = {
|
|
|
153
153
|
|
|
154
154
|
graph: {
|
|
155
155
|
description: 'Consulta o grafo de código com Graphify (se instalado)',
|
|
156
|
-
usage: 'agim graph "pergunta" [--cwd <dir>]',
|
|
157
|
-
run: ({ positional, values }) => {
|
|
156
|
+
usage: 'agim graph "pergunta" [--json] [--cwd <dir>]',
|
|
157
|
+
run: ({ positional, flags, values }) => {
|
|
158
158
|
const pergunta = positional.slice(1).join(' ').trim();
|
|
159
159
|
if (!pergunta) {
|
|
160
160
|
console.log('Uso: agim graph "pergunta sobre o código"');
|
|
161
161
|
return { ok: false };
|
|
162
162
|
}
|
|
163
|
+
const asJson = flags.has('json');
|
|
163
164
|
|
|
164
165
|
const cwd = cwdFrom(values);
|
|
165
166
|
const isWindows = process.platform === 'win32';
|
|
@@ -185,8 +186,12 @@ const COMMANDS = {
|
|
|
185
186
|
|
|
186
187
|
const result = spawnSync(cmd, [...prefix, 'query', pergunta], {
|
|
187
188
|
cwd,
|
|
188
|
-
stdio: 'inherit'
|
|
189
|
+
stdio: asJson ? 'pipe' : 'inherit',
|
|
190
|
+
encoding: 'utf8'
|
|
189
191
|
});
|
|
192
|
+
if (asJson) {
|
|
193
|
+
console.log(JSON.stringify({ ok: result.status === 0, output: result.stdout?.trim() || '', error: result.stderr?.trim() || '' }, null, 2));
|
|
194
|
+
}
|
|
190
195
|
return { ok: result.status === 0 };
|
|
191
196
|
}
|
|
192
197
|
},
|
|
@@ -240,17 +245,46 @@ const ALIASES = {
|
|
|
240
245
|
const { validate } = require('./config-schema.cjs');
|
|
241
246
|
return { ok: validate(values && values.cwd ? path.resolve(values.cwd) : process.cwd()).valid };
|
|
242
247
|
},
|
|
243
|
-
'rag:rebuild': () =>
|
|
244
|
-
|
|
248
|
+
'rag:rebuild': ({ flags } = {}) => {
|
|
249
|
+
const script = path.join(__dirname, 'bible-rag-index.js');
|
|
250
|
+
const asJson = flags?.has('json') || process.argv.includes('--json');
|
|
251
|
+
if (!hasDependency('@xenova/transformers')) {
|
|
252
|
+
if (asJson) {
|
|
253
|
+
console.log(JSON.stringify({ ok: false, reason: 'missing-dependency', message: 'Dependência opcional ausente: @xenova/transformers' }, null, 2));
|
|
254
|
+
} else {
|
|
255
|
+
console.log('⚠️ Dependência opcional ausente: @xenova/transformers');
|
|
256
|
+
console.log(' Instale com: npm install -g @xenova/transformers');
|
|
257
|
+
}
|
|
258
|
+
return { ok: false, reason: 'missing-dependency' };
|
|
259
|
+
}
|
|
260
|
+
const result = spawnSync(process.execPath, [script, '--rebuild'], {
|
|
261
|
+
stdio: asJson ? 'pipe' : 'inherit',
|
|
262
|
+
encoding: 'utf8'
|
|
263
|
+
});
|
|
264
|
+
if (asJson) {
|
|
265
|
+
console.log(JSON.stringify({ ok: result.status === 0, output: result.stdout?.trim() || '', error: result.stderr?.trim() || '' }, null, 2));
|
|
266
|
+
}
|
|
267
|
+
return { ok: result.status === 0 };
|
|
268
|
+
},
|
|
269
|
+
'core:link': ({ flags, values } = {}) => {
|
|
270
|
+
const asJson = flags?.has('json') || process.argv.includes('--json');
|
|
245
271
|
const { ensureCore, createCoreLink } = require('./core-link.cjs');
|
|
246
272
|
const ensured = ensureCore();
|
|
247
273
|
if (!ensured.ok) {
|
|
248
|
-
|
|
274
|
+
if (asJson) {
|
|
275
|
+
console.log(JSON.stringify({ ok: false, reason: 'core-unavailable', message: ensured.reason }, null, 2));
|
|
276
|
+
} else {
|
|
277
|
+
console.log(`❌ Core indisponível: ${ensured.reason}`);
|
|
278
|
+
}
|
|
249
279
|
return { ok: false };
|
|
250
280
|
}
|
|
251
|
-
|
|
281
|
+
const result = createCoreLink(values && values.cwd ? path.resolve(values.cwd) : process.cwd(), {
|
|
252
282
|
force: process.argv.includes('--force')
|
|
253
283
|
});
|
|
284
|
+
if (asJson) {
|
|
285
|
+
console.log(JSON.stringify({ ok: result.ok, ...result }, null, 2));
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
254
288
|
}
|
|
255
289
|
};
|
|
256
290
|
|
|
@@ -291,21 +291,23 @@ function initRAG(cwd, skipRag = false) {
|
|
|
291
291
|
return { skipped: true, reason: 'índice do projeto já existe', indexFile: projectIndex };
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
const globalIndex = path.join(
|
|
295
|
-
process.env.USERPROFILE || process.env.HOME || '',
|
|
296
|
-
'.agent-bible',
|
|
297
|
-
'rag_index',
|
|
298
|
-
'bible-index.json'
|
|
299
|
-
);
|
|
300
|
-
if (fs.existsSync(globalIndex)) {
|
|
301
|
-
return { skipped: true, reason: 'índice global existe (use `agim rag:rebuild` para criar do projeto)', indexFile: globalIndex };
|
|
302
|
-
}
|
|
303
|
-
|
|
304
294
|
// Tentar criar índice do projeto se @xenova/transformers estiver disponível
|
|
305
295
|
try {
|
|
306
296
|
require.resolve('@xenova/transformers');
|
|
307
|
-
// Dep disponível -
|
|
308
|
-
|
|
297
|
+
// Dep disponível - criar índice do projeto
|
|
298
|
+
const script = path.join(__dirname, 'bible-rag-index.js');
|
|
299
|
+
if (fs.existsSync(script)) {
|
|
300
|
+
const { spawnSync } = require('child_process');
|
|
301
|
+
const result = spawnSync(process.execPath, [script, '--rebuild', '--project', cwd], {
|
|
302
|
+
stdio: 'inherit',
|
|
303
|
+
timeout: 300000
|
|
304
|
+
});
|
|
305
|
+
if (result.status === 0 && fs.existsSync(projectIndex)) {
|
|
306
|
+
return { skipped: false, reason: 'índice do projeto criado', indexFile: projectIndex };
|
|
307
|
+
}
|
|
308
|
+
return { skipped: true, reason: 'falha ao criar índice do projeto (rode `agim rag:rebuild`)' };
|
|
309
|
+
}
|
|
310
|
+
return { skipped: true, reason: 'script de RAG não encontrado' };
|
|
309
311
|
} catch {
|
|
310
312
|
return {
|
|
311
313
|
skipped: true,
|
|
@@ -37,7 +37,8 @@ function sync(options = {}) {
|
|
|
37
37
|
const cwd = options.cwd || process.cwd();
|
|
38
38
|
const check = options.check === true;
|
|
39
39
|
const force = options.force === true;
|
|
40
|
-
const
|
|
40
|
+
const asJson = options.asJson === true;
|
|
41
|
+
const log = options.quiet === true || asJson ? () => {} : console.log;
|
|
41
42
|
const agentsPath = path.join(cwd, 'AGENTS.md');
|
|
42
43
|
|
|
43
44
|
log('═'.repeat(50));
|
|
@@ -101,7 +102,8 @@ if (require.main === module) {
|
|
|
101
102
|
const args = process.argv.slice(2);
|
|
102
103
|
const cwdIndex = args.indexOf('--cwd');
|
|
103
104
|
const cwd = cwdIndex !== -1 && args[cwdIndex + 1] ? args[cwdIndex + 1] : process.cwd();
|
|
104
|
-
const result = sync({ cwd, check: args.includes('--check'), force: args.includes('--force') });
|
|
105
|
+
const result = sync({ cwd, check: args.includes('--check'), force: args.includes('--force'), asJson: args.includes('--json') });
|
|
106
|
+
if (args.includes('--json')) console.log(JSON.stringify(result, null, 2));
|
|
105
107
|
if (args.includes('--check') && result.drift) process.exit(1);
|
|
106
108
|
if (result.synced === false && result.reason && result.reason !== 'missing-markers') process.exit(1);
|
|
107
109
|
}
|