nexakit 0.9.0 → 0.10.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.
@@ -13,8 +13,8 @@ const NODE_VALUES = new Map([
13
13
  ['--test-skip-pattern', /^[A-Za-z0-9_./:@%+=,-]+$/u],
14
14
  ]);
15
15
  const isRecord = value => value !== null && typeof value === 'object' && !Array.isArray(value);
16
- const quote = token => `'${token.replaceAll("'", "'\"'\"'")}'`;
17
- const safeAbsolute = value => typeof value === 'string' && posix.isAbsolute(value) &&
16
+ export const quoteShell = token => `'${token.replaceAll("'", "'\"'\"'")}'`;
17
+ export const safeAbsolutePath = value => typeof value === 'string' && posix.isAbsolute(value) &&
18
18
  value.length <= 4096 && !/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/u.test(value);
19
19
 
20
20
  function nodeTests(argv) {
@@ -36,7 +36,7 @@ function nodeTests(argv) {
36
36
  return true;
37
37
  }
38
38
 
39
- function approved(argv) {
39
+ export function approvedOutputCommand(argv) {
40
40
  // Conservative bypass: preserve interactive and structured-output commands intact.
41
41
  if (argv.some(token => /watch|inspect|interactive|tty|background/iu.test(token) ||
42
42
  /^(?:-w|-i|-t|-it|-ti|--ui|--open|--debug)(?:=|$)/u.test(token) ||
@@ -47,26 +47,39 @@ function approved(argv) {
47
47
  (argv[0] === 'yarn' && TASKS.has(argv[1]));
48
48
  }
49
49
 
50
+ export function buildOutputWrapperCommand(command, {
51
+ executable = process.execPath,
52
+ entrypoint = ENTRYPOINT,
53
+ agent = 'codex',
54
+ tempEnv = 'NEXAKIT_CODEX_TEMP_OUTPUT=1',
55
+ platform = process.platform,
56
+ environment = process.env,
57
+ } = {}) {
58
+ if (platform === 'win32' || environment.NEXAKIT_SALIDA === 'completa') return null;
59
+ if (typeof command !== 'string' || command.length > 16 * 1024 ||
60
+ !/^[A-Za-z0-9_./:@%+=, -]+$/u.test(command)) return null;
61
+ const argv = command.trim().split(/ +/u);
62
+ if (!approvedOutputCommand(argv)) return null;
63
+ if (!safeAbsolutePath(executable) || !safeAbsolutePath(entrypoint)) return null;
64
+ return `${tempEnv} ${[executable, entrypoint, agent, 'ejecutar', '--', ...argv].map(quoteShell).join(' ')}`;
65
+ }
66
+
50
67
  /** Pure, synchronous PreToolUse rewrite. Unknown inputs always retain their original route. */
51
68
  export function rewriteCodexToolInput(payload, options = {}) {
52
- if ((options.platform ?? process.platform) === 'win32' ||
53
- (options.environment ?? process.env).NEXAKIT_SALIDA === 'completa' ||
54
- !isRecord(payload) || payload.hook_event_name !== 'PreToolUse' || payload.tool_name !== 'Bash' ||
69
+ if (!isRecord(payload) || payload.hook_event_name !== 'PreToolUse' || payload.tool_name !== 'Bash' ||
55
70
  !isRecord(payload.tool_input)) return {};
56
71
  const input = payload.tool_input;
57
72
  if (('sandbox_permissions' in input && input.sandbox_permissions !== 'use_default') ||
58
73
  ['tty', 'interactive', 'background', 'run_in_background'].some(key => input[key])) return {};
59
- const command = input.command;
60
- // ASCII-only grammar makes this length limit also a byte limit. Only literal spaces separate tokens.
61
- if (typeof command !== 'string' || command.length > 16 * 1024 ||
62
- !/^[A-Za-z0-9_./:@%+=, -]+$/u.test(command)) return {};
63
- const argv = command.trim().split(/ +/u);
64
- if (!approved(argv)) return {};
65
- const executable = options.executable ?? process.execPath;
66
- const entrypoint = options.entrypoint ?? ENTRYPOINT;
67
- if (!safeAbsolute(executable) || !safeAbsolute(entrypoint)) return {};
68
- const wrapper = 'NEXAKIT_CODEX_TEMP_OUTPUT=1 ' +
69
- [executable, entrypoint, 'codex', 'ejecutar', '--', ...argv].map(quote).join(' ');
74
+ const wrapper = buildOutputWrapperCommand(input.command, {
75
+ executable: options.executable,
76
+ entrypoint: options.entrypoint,
77
+ agent: 'codex',
78
+ tempEnv: 'NEXAKIT_CODEX_TEMP_OUTPUT=1',
79
+ platform: options.platform ?? process.platform,
80
+ environment: options.environment ?? process.env,
81
+ });
82
+ if (!wrapper) return {};
70
83
  return { hookSpecificOutput: {
71
84
  hookEventName: 'PreToolUse',
72
85
  permissionDecision: 'allow',
@@ -15,7 +15,7 @@ o plan ya aprobado. Antes de un PR, quality-gate. Modo tutor (la persona
15
15
  escribe el código, un paso verificable cada vez) solo si lo pide.
16
16
 
17
17
  Orquesta: tú entiendes, planificas, decides e integras; delega la ejecución en
18
- subagentes de nivel (Claude: niveles:nivel-<nivel>; Codex: nivel_<nivel>):
18
+ subagentes de nivel (Claude: niveles:nivel-<nivel>; Codex: nivel_<nivel>; Antigravity: nivel-<nivel>):
19
19
  ligero para comandos, búsquedas y cambios mecánicos; normal para implementar
20
20
  con diseño claro; exigente para pruebas, casos borde o un fallo acotado; alto
21
21
  para un fallo sutil, seguridad o lo que exigente no resolvió. Trabaja tú solo
@@ -3,6 +3,7 @@ import { runCli } from './cli.js';
3
3
  import { runModelCommand } from './model-command.js';
4
4
  import { runAhorroCommand } from './ahorro-command.js';
5
5
  import { runCodexCommand } from './codex-command.js';
6
+ import { runAntigravityCommand } from './antigravity-command.js';
6
7
  import { runLeccionesCommand } from './lecciones-command.js';
7
8
  import { runRevisionCommand } from './revision.js';
8
9
  import path from 'node:path';
@@ -41,6 +42,7 @@ const HELP = `Uso: npx nexakit [--project <ruta>] [--si]
41
42
  nexakit revision --con <ia> --modelo <m> --esfuerzo <e> --encargo <archivo> [--base <rama>]
42
43
  nexakit modelo [--nivel <nivel>] [--ia claude|codex|antigravity] [--perfil-codex <nombre>]
43
44
  nexakit codex auditar|preparar|agentes|actividad|consumo|recomendar|hook|ejecutar|comparar [opciones]
45
+ nexakit antigravity barra|preparar|agentes|recomendar|hook|ejecutar [opciones]
44
46
  nexakit ahorro [--json]
45
47
  nexakit lecciones [--json | --descartar]
46
48
  npx nexakit recommend [--project <ruta>] [--profile frontend|backend|mcp|security] [--client codex|claude] [--dry-run] [--json]
@@ -100,6 +102,7 @@ export async function runToolkitCli(
100
102
  const [command, ...rest] = argv;
101
103
  if (command === 'modelo') return runModelCommand(rest, { out, err }, options);
102
104
  if (command === 'codex') return runCodexCommand(rest, { out, err, input, output }, options);
105
+ if (command === 'antigravity') return runAntigravityCommand(rest, { out, err, input, output }, options);
103
106
  if (command === 'ahorro') return runAhorroCommand(rest, { out, err }, options);
104
107
  if (command === 'lecciones') return runLeccionesCommand(rest, { out, err }, options);
105
108
  if (command === 'revision') return runRevisionCommand(rest, { out, err }, { options });