ostacky 0.9.5 → 0.9.7

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/README.md CHANGED
@@ -109,16 +109,35 @@ npx ostacky
109
109
 
110
110
  Detecta automáticamente el directorio `.opencode/` del proyecto (o lo crea) y muestra un menú para elegir qué hacer.
111
111
 
112
- ### Instalar todo
112
+ ### Instalar todo (local, default)
113
113
 
114
114
  ```bash
115
- npx ostacky install # siempre local en <proyecto>/.opencode
116
- npx ostacky install --scope local # <proyecto>/.opencode (único scope soportado)
115
+ npx ostacky install # local en <proyecto>/.opencode (default)
116
+ npx ostacky install --scope local # <proyecto>/.opencode (explícito)
117
117
  ```
118
118
 
119
119
  Descarga todos los agentes y commands definidos en el manifest y los escribe en `<proyecto>/.opencode`. Además copia los plugins **Ostacky-owned** `ostacky-plugin.ts` + `engram.ts` en `.opencode/plugins/` (el legacy `ostacky-guard.ts` fue fusionado en `ostacky-plugin.ts` y ya no se instala; `ostacky-controller.ts` legacy se limpia automáticamente si quedó de una instalación previa) y asegura `.gitignore` con ` .opencode/tools/, .codegraph/, .opencode/cache/, ostacky-state.json*`.
120
120
 
121
- > **Instalación siempre local:** Ostacky vive por proyecto/worktree (CodeGraph index `.codegraph/` y `ostacky-state.json` aislados). Si ves `C:\Users\...\ .opencode\tools\codegraph` y esperabas `D:\mi-proyecto\.opencode`, es porque corriste `npx ostacky` desde tu home sin estar dentro del proyecto (sin `.git`). Hacé `cd` al proyecto y re-ejecutá; el log muestra `projectRoot` y `toolsDir` explícitos.
121
+ > **Instalación local (default):** Ostacky vive por proyecto/worktree (CodeGraph index `.codegraph/` y `ostacky-state.json` aislados). Si ves `C:\Users\...\ .opencode\tools\codegraph` y esperabas `D:\mi-proyecto\.opencode`, es porque corriste `npx ostacky` desde tu home sin estar dentro del proyecto (sin `.git`). Hacé `cd` al proyecto y re-ejecutá; el log muestra `projectRoot` y `toolsDir` explícitos.
122
+
123
+ ### Instalación global (opt-in)
124
+
125
+ ```bash
126
+ npx ostacky --scope global # menú interactivo global
127
+ npx ostacky install --scope global # núcleo global (agente + commands + skills + MCPs + plugins)
128
+ ```
129
+
130
+ Escribe el núcleo en el config dir global de OpenCode sin tocar ningún proyecto:
131
+
132
+ | SO | Dir global |
133
+ |---|---|
134
+ | Linux / macOS | `~/.config/opencode` (respeta `XDG_CONFIG_HOME`) |
135
+ | Windows | config dir global de OpenCode según SO |
136
+ | WSL | como Linux |
137
+
138
+ El stack de binarios (CodeGraph, Engram) es **siempre local por proyecto**: con `--scope global` se omite y se indica instalarlo por proyecto (`npx ostacky install-stack` dentro del proyecto). La config global acepta `opencode.json` o `opencode.jsonc`; si el proyecto define el mismo MCP, su objeto reemplaza al global (comportamiento v2), y en skills con mismo ID gana la del proyecto.
139
+
140
+ > **Migración v1 → v2:** `npx ostacky` (sin subcomando) busca la última versión publicada y, si detecta v1 instalada, ofrece desinstalar v1 e instalar v2 (siempre con confirmación; sin red o no-interactivo sigue al menú sin preguntar).
122
141
 
123
142
  ### Agregar agentes o commands individualmente
124
143
 
@@ -152,8 +171,9 @@ Solo descarga los items que cambiaron de versión.
152
171
  ### Desinstalar
153
172
 
154
173
  ```bash
155
- npx ostacky uninstall # qué borrar en <proyecto>/.opencode
174
+ npx ostacky uninstall # qué borrar en <proyecto>/.opencode (default local)
156
175
  npx ostacky uninstall --scope local # fuerza scope local
176
+ npx ostacky uninstall --scope global # qué borrar en el dir global
157
177
  ```
158
178
 
159
179
  **Safe-delete:** solo borra lo trackeado en `.opencode/ostacky-lock.json` (agentes, commands, skills, MCPs) — nunca toca componentes previos del usuario que no estén en el lockfile. Antes de borrar muestra preview con `Scope: <ruta>` + lista de paths y pide confirmación. Los plugins Ostacky-owned (`ostacky-plugin.ts`, `engram.ts` + legacy `ostacky-guard.ts`/`ostacky-controller.ts` si quedaron) se limpian automáticamente via allowlist, nunca se borran plugins custom.
@@ -250,37 +270,37 @@ Tras instalar (`--scope local`), el proyecto queda así:
250
270
 
251
271
  ```json
252
272
  {
253
- "version": "0.9.5",
273
+ "version": "0.9.7",
254
274
  "lockedAt": "2025-01-01T00:00:00.000Z",
255
275
  "repo": "JaimeHoracio/Ostacky",
256
- "tag": "v0.9.5",
276
+ "tag": "v0.9.7",
257
277
  "agents": {
258
278
  "ostacky": {
259
- "version": "0.9.5",
279
+ "version": "0.9.7",
260
280
  "installedAt": "2025-01-01T00:00:00.000Z",
261
281
  "sha256": "abc123..."
262
282
  }
263
283
  },
264
284
  "commands": {
265
285
  "install-stack": {
266
- "version": "0.9.5",
286
+ "version": "0.9.7",
267
287
  "installedAt": "2025-01-01T00:00:00.000Z",
268
288
  "sha256": "def456..."
269
289
  },
270
290
  "opsx-sync": {
271
- "version": "0.9.5",
291
+ "version": "0.9.7",
272
292
  "installedAt": "2025-01-01T00:00:00.000Z",
273
293
  "sha256": "ghi789..."
274
294
  }
275
295
  },
276
296
  "skills": {
277
- "brainstorming": { "version": "0.9.5", ... },
278
- "execution-mode-evaluation": { "version": "0.9.5", ... },
279
- "openspec-propose": { "version": "0.9.5", ... }
297
+ "brainstorming": { "version": "0.9.7", ... },
298
+ "execution-mode-evaluation": { "version": "0.9.7", ... },
299
+ "openspec-propose": { "version": "0.9.7", ... }
280
300
  },
281
301
  "mcpServers": {
282
- "ostacky-controller": { "version": "0.9.5", ... },
283
- "openspec": { "version": "0.9.5", ... }
302
+ "ostacky-controller": { "version": "0.9.7", ... },
303
+ "openspec": { "version": "0.9.7", ... }
284
304
  }
285
305
  }
286
306
  ```
@@ -312,7 +332,7 @@ Es opcional y solo necesario si algo falló durante la instalación o si querés
312
332
  ## Seguridad
313
333
 
314
334
  - `opencode.jsonc` se versiona en el repo para compartir permisos y MCP de forma reproducible.
315
- - Las URLs de descarga usan **tags de GitHub** (ej. `v0.9.5`), nunca `main` — instalaciones reproducibles
335
+ - Las URLs de descarga usan **tags de GitHub** (ej. `v0.9.7`), nunca `main` — instalaciones reproducibles
316
336
  - Cada path de archivo descargado es validado para prevenir **path traversal**
317
337
  - Los archivos incluyen **checksum SHA-256** opcional; si el manifest lo define, el contenido se verifica antes de escribir
318
338
  - El cache local (`.opencode/cache/`) también valida integridad al servir archivos cacheados
@@ -369,7 +389,7 @@ CodeGraph está instalado en `.opencode/tools/codegraph/bin/codegraph` y se conf
369
389
  | `.opencode/tools/codegraph/bin/codegraph status` | Muestra estado del index y archivos pendientes |
370
390
  | `.opencode/tools/codegraph/bin/codegraph install --target opencode --location local --yes` | Configura CodeGraph para OpenCode y genera AGENTS.md |
371
391
 
372
- > **Windows:** si ves `Command failed: cmd.exe /d /c call ... codegraph.cmd init -i` durante `npx ostacky install`, es un _warning_ no fatal — el binario se instaló pero el índice no se pudo crear. Reintentá con `npx ostacky install-stack --scope local` o ejecutá manualmente `.opencode\tools\codegraph\bin\codegraph.exe init -i` (o `codegraph.cmd` si no hay `.exe`) dentro del proyecto. Desde v0.9.5 el instalador usa el patrón resiliente de Engram (strip 0 + búsqueda recursiva) y loguea `projectRoot|toolsDir` para diagnosticar scope.
392
+ > **Windows:** si ves `Command failed: cmd.exe /d /c call ... codegraph.cmd init -i` durante `npx ostacky install`, es un _warning_ no fatal — el binario se instaló pero el índice no se pudo crear. Reintentá con `npx ostacky install-stack --scope local` o ejecutá manualmente `.opencode\tools\codegraph\bin\codegraph.exe init -i` (o `codegraph.cmd` si no hay `.exe`) dentro del proyecto. Desde v0.9.7 el instalador usa el patrón resiliente de Engram (strip 0 + búsqueda recursiva) y loguea `projectRoot|toolsDir` para diagnosticar scope.
373
393
 
374
394
  ## Licencia
375
395
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  description: Orquestador principal — rutea por nivel, orquesta CodeGraph + OpenSpec + Superpowers.
3
3
  mode: primary
4
- version: 0.9.5
4
+ version: 0.9.7
5
5
  ---
6
6
 
7
- Sos **Ostacky v0.9.5**, orquestás, no implementás. Interpretás, clasificás (0/0+1/1+), ruteás y coordinás.
7
+ Sos **Ostacky v0.9.7**, orquestás, no implementás. Interpretás, clasificás (0/0+1/1+), ruteás y coordinás.
8
8
 
9
- > **Versión:** `0.9.5` (sincronizada desde `package.json` vía `scripts/sync-version.ts`). Cuando te pregunten qué versión tenés, qué versión sos, o `¿qué versión tenés?` / `version` / `¿en qué versión estás?`, respondé exactamente: **"Ostacky v0.9.5"** (o `v0.9.5` si te piden solo el número). No inventes otra versión.
9
+ > **Versión:** `0.9.7` (sincronizada desde `package.json` vía `scripts/sync-version.ts`). Cuando te pregunten qué versión tenés, qué versión sos, o `¿qué versión tenés?` / `version` / `¿en qué versión estás?`, respondé exactamente: **"Ostacky v0.9.7"** (o `v0.9.7` si te piden solo el número). No inventes otra versión.
10
10
 
11
11
  ## Reglas innegociables
12
12
 
@@ -71,7 +71,7 @@ Si vago → preguntar. Si claro → `start_request`.
71
71
 
72
72
  `record_discovery({level,snapshot})` → `ROUTE_DECISION_PENDING` (`SPEC` si 1+, `DIRECT` si 0/0+1). `proceed_to_route` deprecated no-op.
73
73
 
74
- Preguntar nivel y `consume_route_decision`.
74
+ **Nivel 0 → DIRECT automático (sin pregunta de ruteo):** anunciar `Nivel 0 + archivos + qué se va a hacer` y proceder con `consume_route_decision(DIRECT)`; el veto del usuario vale (si objeta, se frena). Niveles `0+1`/`1+` → preguntar nivel y `consume_route_decision` (una pregunta por turno).
75
75
 
76
76
  ### 3. Specification (solo SPEC)
77
77
 
@@ -1,31 +1,31 @@
1
1
  ---
2
2
  description: Instala CodeGraph, skills curadas, OpenSpec y Engram localmente para OpenCode únicamente
3
3
  agent: build
4
+ subagent: false
4
5
  ---
5
6
 
6
7
  Instala el stack tecnológico de desarrollo para OpenCode. **IMPORTANTE:** las herramientas se instalan por separado (cada una con su propio CLI/comando). `npx ostacky install` solo instala el agente y commands de Ostacky en `.opencode/`. Este comando (`/install-stack`) es la guía de referencia para la instalación manual completa paso a paso.
7
8
 
8
- **Nota:** A partir de v0.9.5, `npx ostacky install` ya instala automáticamente el stack completo (CodeGraph, OpenSpec, Engram, MCPs bundleados) además del agente y skills. Este comando es útil para instalación manual, verificación, o cuando algo falló y necesita reinstalarse.
9
+ **Nota:** A partir de v0.9.7, `npx ostacky install` ya instala automáticamente el stack completo (CodeGraph, OpenSpec, Engram, MCPs bundleados) además del agente y skills. Este comando es útil para instalación manual, verificación, o cuando algo falló y necesita reinstalarse.
9
10
 
10
11
  **RESTRICCIÓN ABSOLUTA:** instalar ÚNICAMENTE para OpenCode. Está terminantemente prohibido crear o modificar archivos en `.claude/`, `.kiro/`, `.cursor/`, `.gemini/`, `.codex/`, `.antigravity/`, `.windsurf/` o cualquier otro directorio de plataformas externas.
11
12
 
12
13
  **Origen del set curado:** el set de 15 skills referenciado en `assets/agents/ostacky.md` está bundleado en `assets/skills/` dentro del paquete npm. La definición del set y su trazabilidad viven en `manifest.json` y `.opencode/ostacky-lock.json`.
13
14
 
14
- ## Scope de instalación — local vs global (desde v0.9.5)
15
+ ## Scope de instalación — local (default) vs global (opt-in)
15
16
 
16
- `npx ostacky install` soporta `--scope local|global|auto` (también `--scope=...`):
17
+ `npx ostacky install` soporta `--scope local|global` (también `--scope=...`):
17
18
 
18
- - `local` (recomendado): escribe en `<proyecto>/.opencode` (`opencode.json` local)
19
- - `global`: escribe en `~/.config/opencode` (Unix/WSL) o `%APPDATA%\opencode` (Windows); respeta `XDG_CONFIG_HOME`
20
- - `auto`: elige local si existe `.opencode` o `.git` (`.opencode` tiene prioridad), si no global
21
- - Sin flag: pregunta interactivamente (default local)
19
+ - `local` (default): escribe en `<proyecto>/.opencode` (`opencode.json` local). Sin flag asume local.
20
+ - `global`: escribe el núcleo (agente, commands, skills, MCPs, plugins) en el config dir global de OpenCode (`~/.config/opencode`, respeta `XDG_CONFIG_HOME`; en Windows el config dir global según SO). No toca `<proyecto>/.opencode`.
21
+ - `--scope auto` y `-g` son error educativo: usá `--scope local` o `--scope global` explícito.
22
22
 
23
- Herramientas (`tools/`) permanecen siempre en `<proyecto>/.opencode/tools` por reproducibilidad. `npx ostacky install-stack --scope global` bloquea con error claro — el stack debe instalarse por proyecto:
23
+ Herramientas (`tools/` CodeGraph/Engram) permanecen siempre en `<proyecto>/.opencode/tools` por reproducibilidad, también con `--scope global`. `npx ostacky install-stack --scope global` avisa y usa local — el stack se instala por proyecto:
24
24
 
25
25
  ```bash
26
- npx ostacky install --scope local
27
- npx ostacky install --scope global
28
- npx ostacky install-stack --scope auto # stack / proyecto
26
+ npx ostacky install # local (default)
27
+ npx ostacky install --scope global # núcleo global (sin stack)
28
+ npx ostacky install-stack # stack local por proyecto
29
29
  ```
30
30
 
31
31
  > **Windows con espacios** (ej. `C:\Users\Jaime Horacio\Desktop\Mi Proyecto`): la instalación es segura via invocación por arrays (libuv escapa cada argumento); no se aplica pre-quoting. `opencode.json` guarda `command` como array JSON.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Sincroniza el grafo de CodeGraph y luego los delta specs del change activo con la implementación
3
3
  agent: build
4
+ subagent: false
4
5
  ---
5
6
 
6
7
  Sincroniza primero el grafo y luego los delta specs (`proposal.md` / `design.md` / `tasks.md`) del change activo en `openspec/changes/<name>/` con el estado actual de la implementación.
@@ -2996,7 +2996,7 @@ function safeHandler(fn, options = {}) {
2996
2996
 
2997
2997
  const server = new McpServer({
2998
2998
  name: 'ostacky-controller',
2999
- version: '0.9.5',
2999
+ version: '0.9.7',
3000
3000
  });
3001
3001
 
3002
3002
  server.registerTool(
@@ -3598,7 +3598,7 @@ function setupGracefulShutdown(ctrl) {
3598
3598
  }
3599
3599
 
3600
3600
  async function main() {
3601
- log('Starting ostacky-controller MCP v0.9.5...');
3601
+ log('Starting ostacky-controller MCP v0.9.7...');
3602
3602
  log('State path:', { path: statePath });
3603
3603
  // Clean up stale tmp/lock files from previous runs
3604
3604
  cleanupTmpFiles(statePath);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ostacky-controller",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "dependencies": {
package/dist/cli.js CHANGED
@@ -222,6 +222,7 @@ import {
222
222
  renameSync
223
223
  } from "fs";
224
224
  import { createHash as createHash2 } from "crypto";
225
+ import { homedir } from "os";
225
226
  import { join, resolve, dirname, relative, basename } from "path";
226
227
  import { execFileSync } from "child_process";
227
228
  function findOpenCodeDir(startDir = process.cwd()) {
@@ -244,16 +245,7 @@ function findProjectRoot(startDir = process.cwd()) {
244
245
  if (out && existsSync(out))
245
246
  return resolve(out);
246
247
  } catch {}
247
- let current = resolve(startDir);
248
- while (true) {
249
- if (existsSync(join(current, ".opencode")) || existsSync(join(current, ".git"))) {
250
- return current;
251
- }
252
- const parent = dirname(current);
253
- if (parent === current)
254
- return resolve(startDir);
255
- current = parent;
256
- }
248
+ return resolve(startDir);
257
249
  }
258
250
  function isGitRepo(dir = process.cwd()) {
259
251
  try {
@@ -267,10 +259,26 @@ function isGitRepo(dir = process.cwd()) {
267
259
  return false;
268
260
  }
269
261
  }
262
+ function initGitRepo(dir) {
263
+ execFileSync("git", ["init"], { cwd: dir, stdio: "pipe" });
264
+ }
265
+ function getGlobalOpenCodeDir(opts) {
266
+ const platform = opts?.platform ?? process.platform;
267
+ const env = opts?.env ?? process.env;
268
+ const home = opts?.home ?? homedir();
269
+ const xdg = env.XDG_CONFIG_HOME?.trim();
270
+ if (xdg)
271
+ return join(xdg, "opencode");
272
+ if (platform === "win32") {
273
+ const appdata = env.APPDATA?.trim();
274
+ if (appdata)
275
+ return join(appdata, "opencode");
276
+ }
277
+ return join(home, ".config", "opencode");
278
+ }
270
279
  function getOpenCodeDirForScope(scope, cwd = process.cwd()) {
271
- const existing = findOpenCodeDir(cwd);
272
- if (existing)
273
- return existing;
280
+ if (scope === "global")
281
+ return getGlobalOpenCodeDir();
274
282
  return join(findProjectRoot(cwd), ".opencode");
275
283
  }
276
284
  function ensureOpenCodePaths(opencodeDir) {
@@ -633,48 +641,48 @@ var init_fs = __esm(() => {
633
641
  var manifest_default;
634
642
  var init_manifest = __esm(() => {
635
643
  manifest_default = {
636
- version: "0.9.5",
644
+ version: "0.9.7",
637
645
  repo: "JaimeHoracio/Ostacky",
638
- tag: "v0.9.5",
646
+ tag: "v0.9.7",
639
647
  agents: [
640
648
  {
641
649
  name: "ostacky",
642
650
  file: "assets/agents/ostacky.md",
643
- description: "Orquestador con recuperación automática (nunca se congela), ruteo por nivel de impacto, controller MCP con SDK oficial, edición segura con fallback inline, y delegación en OpenSpec + Superpowers. v0.9.5: prune de skills obsoletas, lastHandoff, getAvailableTransitions, consecutiveFailures real, mem_session_summary automático al cierre.",
644
- version: "0.9.5",
645
- sha256: "986c41356dcdea8d74fea6a17127a45e78e16a5cda43152efb5c7ffd11593b8c"
651
+ description: "Orquestador con recuperación automática (nunca se congela), ruteo por nivel de impacto, controller MCP con SDK oficial, edición segura con fallback inline, y delegación en OpenSpec + Superpowers. v0.9.7: prune de skills obsoletas, lastHandoff, getAvailableTransitions, consecutiveFailures real, mem_session_summary automático al cierre.",
652
+ version: "0.9.7",
653
+ sha256: "4481017881dadef3cabf516053d13930b5c948f879f8996fcb03ca5133073199"
646
654
  }
647
655
  ],
648
656
  commands: [
649
657
  {
650
658
  name: "install-stack",
651
659
  file: "assets/commands/install-stack.md",
652
- description: "Instala el stack tecnológico del proyecto (CodeGraph, skills, OpenSpec, Engram, controller plugin). v0.9.5: controller plugin como alma hard-gate, Context7 removido del stack.",
653
- version: "0.9.5",
654
- sha256: "e218ec7db404fc8bd5fa1d92312eef5ea517bb0940af054f8665048ec2e9da5f"
660
+ description: "Instala el stack tecnológico del proyecto (CodeGraph, skills, OpenSpec, Engram, controller plugin). v0.9.7: controller plugin como alma hard-gate, Context7 removido del stack.",
661
+ version: "0.9.7",
662
+ sha256: "0e1f52a236843fffbf166c1b381c52907abe19887e2472f667642ecbcb0f43a8"
655
663
  },
656
664
  {
657
665
  name: "opsx-sync",
658
666
  file: "assets/commands/opsx-sync.md",
659
667
  description: "Sincroniza delta specs del change activo sin inicializar CodeGraph si ya existe índice",
660
- version: "0.9.5",
661
- sha256: "fe0158478f2ca63b315037a85fc1632b77868532e319af6c7384285441767d64"
668
+ version: "0.9.7",
669
+ sha256: "f883f9ad96f7d75778631d5cc13d8a1a9c3e6ec41396bbce8ce13cff2e66fca2"
662
670
  }
663
671
  ],
664
672
  mcpServers: [
665
673
  {
666
674
  name: "ostacky-controller",
667
675
  file: "assets/mcp/ostacky-controller/",
668
- description: "Máquina de estados persistida con @modelcontextprotocol/server SDK. v0.9.5: 22 tools (incluye set_handoff, get_handoff, clear_handoff, get_available_transitions funcional). Bugfixes: consecutiveFailures real, lastHandoff state, defaultChoice persistido. Robustez: degraded mode automático tras 3 fallos, persistence condicional para Nivel 0, prune de skills obsoletas.",
669
- version: "0.9.5",
670
- sha256: "775f4b8b28a315e97f9192d71a9433fa28235fe84c29401451ace628829c7076"
676
+ description: "Máquina de estados persistida con @modelcontextprotocol/server SDK. v0.9.7: 22 tools (incluye set_handoff, get_handoff, clear_handoff, get_available_transitions funcional). Bugfixes: consecutiveFailures real, lastHandoff state, defaultChoice persistido. Robustez: degraded mode automático tras 3 fallos, persistence condicional para Nivel 0, prune de skills obsoletas.",
677
+ version: "0.9.7",
678
+ sha256: "41bfad0ddf21fac992c72e2a4e590445d075a5f8e8cb30a165728dff23a5d41a"
671
679
  },
672
680
  {
673
681
  name: "openspec",
674
682
  file: "assets/mcp/openspec/",
675
683
  description: "MCP server local para OpenSpec - proposal, apply, archive, sync de cambios",
676
- version: "0.9.5",
677
- sha256: "fa4be28bfc1e75db8f1a037e2580f04a60066c80e8e5934e90e1041020d04609"
684
+ version: "0.9.7",
685
+ sha256: "bdb283fe8ec2dfcba2ec4f38191f4039e58cd7ae12e44e66310783b42c827638"
678
686
  }
679
687
  ],
680
688
  skills: [
@@ -682,105 +690,105 @@ var init_manifest = __esm(() => {
682
690
  name: "brainstorming",
683
691
  file: "assets/skills/brainstorming/SKILL.md",
684
692
  description: "Skill unificado de pensamiento con dos modos: creative-design (producción de diseño → transición a implementación directa o openspec-propose) y open-exploration (exploración libre)",
685
- version: "0.9.5",
693
+ version: "0.9.7",
686
694
  sha256: "f1013a86a8f27914d85a716e23c7fd32db1786d93615e8b0834b13d184308549"
687
695
  },
688
696
  {
689
697
  name: "execution-mode-evaluation",
690
698
  file: "assets/skills/execution-mode-evaluation/SKILL.md",
691
699
  description: "Skill de análisis de modo de ejecución — output reconciliado con controller snapshot contract (recommendation field)",
692
- version: "0.9.5",
700
+ version: "0.9.7",
693
701
  sha256: "2158a6864c0912e868a9d720db7fd79441e6cc298e3320833d2527c9727c852e"
694
702
  },
695
703
  {
696
704
  name: "tdd",
697
705
  file: "assets/skills/tdd/SKILL.md",
698
706
  description: "Skill de test-driven development (Superpowers)",
699
- version: "0.9.5",
707
+ version: "0.9.7",
700
708
  sha256: "f0ebfbbc43a8868d31a3fd2df37ae7f60fe8add09c6475862395a68269e5ff7f"
701
709
  },
702
710
  {
703
711
  name: "subagent-driven-development",
704
712
  file: "assets/skills/subagent-driven-development/SKILL.md",
705
713
  description: "Skill de ejecución con subagentes (Superpowers) — ejecuta solo después de confirmación del coordinador Ostacky",
706
- version: "0.9.5",
714
+ version: "0.9.7",
707
715
  sha256: "1a42d714a9a13faf05f0bf7b580e8d837c2e77a5633839542ccce603023419e8"
708
716
  },
709
717
  {
710
718
  name: "dispatching-parallel-agents",
711
719
  file: "assets/skills/dispatching-parallel-agents/SKILL.md",
712
720
  description: "Skill de dispatch paralelo de agentes (Superpowers)",
713
- version: "0.9.5",
721
+ version: "0.9.7",
714
722
  sha256: "7e7b712ef742d5631e302e6a71583e2bbbd33094da9281abfb84b43505fc3ef1"
715
723
  },
716
724
  {
717
725
  name: "review",
718
726
  file: "assets/skills/review/SKILL.md",
719
727
  description: "Skill de revisión de código (Superpowers)",
720
- version: "0.9.5",
728
+ version: "0.9.7",
721
729
  sha256: "b19650ed4d1d4d9857a4dd5b7e08e91328a1a1fc9c45bcc2fb600fa9d0213279"
722
730
  },
723
731
  {
724
732
  name: "receiving-code-review",
725
733
  file: "assets/skills/receiving-code-review/SKILL.md",
726
734
  description: "Skill de recibir y procesar feedback de code review",
727
- version: "0.9.5",
735
+ version: "0.9.7",
728
736
  sha256: "d761e884e71d8d3476ac734d287cae403a4024506a7d12e7361a448217c0a831"
729
737
  },
730
738
  {
731
739
  name: "openspec-propose",
732
740
  file: "assets/skills/openspec-propose/SKILL.md",
733
741
  description: "Skill de generación de proposal (OpenSpec)",
734
- version: "0.9.5",
742
+ version: "0.9.7",
735
743
  sha256: "6a517f750f24c008208156a2d653e97ed30b1e53878aeac5ce394e573db0678f"
736
744
  },
737
745
  {
738
746
  name: "openspec-apply-change",
739
747
  file: "assets/skills/openspec-apply-change/SKILL.md",
740
748
  description: "Skill de aplicación de change (OpenSpec)",
741
- version: "0.9.5",
749
+ version: "0.9.7",
742
750
  sha256: "dfc823bf89fc7505e91ab6dee9c1f004be38a410bd3d88fb67b211b1b6cbb1d0"
743
751
  },
744
752
  {
745
753
  name: "openspec-archive-change",
746
754
  file: "assets/skills/openspec-archive-change/SKILL.md",
747
755
  description: "Skill de archivo de change (OpenSpec)",
748
- version: "0.9.5",
756
+ version: "0.9.7",
749
757
  sha256: "16e4b561de7747283663fed602e506abf502452c49a8d4b86d7a5539c40f0195"
750
758
  },
751
759
  {
752
760
  name: "openspec-explore",
753
761
  file: "assets/skills/openspec-explore/SKILL.md",
754
762
  description: "Modo explore para OpenSpec — thinking partner para explorar ideas, investigar problemas y clarificar requisitos antes/durante un cambio",
755
- version: "0.9.5",
763
+ version: "0.9.7",
756
764
  sha256: "9eafc3a8c693b8d9916867ef764d49e5222da717fde501c957bb3f6c312d2415"
757
765
  },
758
766
  {
759
767
  name: "using-git-worktrees",
760
768
  file: "assets/skills/using-git-worktrees/SKILL.md",
761
769
  description: "Skill de uso de git worktrees para aislamiento de trabajo",
762
- version: "0.9.5",
770
+ version: "0.9.7",
763
771
  sha256: "93341bc1b7c053618a8b6dc07e3615b77990d7b549a0201f5835d95fef67ce13"
764
772
  },
765
773
  {
766
774
  name: "using-superpowers",
767
775
  file: "assets/skills/using-superpowers/SKILL.md",
768
776
  description: "Skill de orquestación de Superpowers skills",
769
- version: "0.9.5",
777
+ version: "0.9.7",
770
778
  sha256: "7e54536f96d2a379185a10bfc1e970850caa2561b6d8aca7080f0defea0381a4"
771
779
  },
772
780
  {
773
781
  name: "writing-skills",
774
782
  file: "assets/skills/writing-skills/SKILL.md",
775
783
  description: "Skill de creación y edición de skills",
776
- version: "0.9.5",
784
+ version: "0.9.7",
777
785
  sha256: "3d76b906cee518a2b809febb70db95697a35b9f368986bb504b4120c3bfb437a"
778
786
  },
779
787
  {
780
788
  name: "graceful-degradation",
781
789
  file: "assets/skills/graceful-degradation/SKILL.md",
782
790
  description: "Skill de degradación graceful cuando múltiples tools están indisponibles",
783
- version: "0.9.5",
791
+ version: "0.9.7",
784
792
  sha256: "363449bd9e6f800a0a3168667cf78f767fb105d86e4a4adadcc649d418139303"
785
793
  }
786
794
  ]
@@ -1130,10 +1138,10 @@ var init_config = __esm(() => {
1130
1138
 
1131
1139
  // src/stack.ts
1132
1140
  import { chmodSync, copyFileSync as copyFileSync3, existsSync as existsSync6, mkdirSync as mkdirSync4, rmSync as rmSync4, unlinkSync as unlinkSync3 } from "fs";
1133
- import { basename as basename2, dirname as dirname5, join as join7, resolve as resolve2 } from "path";
1141
+ import { basename as basename2, dirname as dirname5, join as join7, resolve as resolve3 } from "path";
1134
1142
  import { execFileSync as execFileSync3 } from "child_process";
1135
1143
  function resolveToolInstallLocation(toolsDir) {
1136
- const resolvedToolsDir = resolve2(toolsDir ?? join7(findProjectRoot(), ".opencode", "tools"));
1144
+ const resolvedToolsDir = resolve3(toolsDir ?? join7(findProjectRoot(), ".opencode", "tools"));
1137
1145
  const possibleOpenCodeDir = dirname5(resolvedToolsDir);
1138
1146
  return {
1139
1147
  projectRoot: basename2(possibleOpenCodeDir) === ".opencode" ? dirname5(possibleOpenCodeDir) : findProjectRoot(),
@@ -1575,8 +1583,9 @@ function checkDoctorV2(projectRoot) {
1575
1583
  if (found) {
1576
1584
  try {
1577
1585
  const src = readFileSync6(found, "utf-8");
1578
- const isV2 = src.includes("Plugin.define") && src.includes("@opencode/plugin") && !src.includes("@opencode-ai/plugin");
1579
- if (isV2)
1586
+ const hasDefault = /export\s+default/.test(src);
1587
+ const hasLegacyPkg = src.includes("@opencode-ai/");
1588
+ if (hasDefault && !hasLegacyPkg)
1580
1589
  lines.push(`✅ controller: plugin V2 (${found})`);
1581
1590
  else
1582
1591
  lines.push(`⚠️ controller: plugin legacy V1 en ${found} — no corre en V2, reinstalá con ostacky`);
@@ -1656,12 +1665,40 @@ function checkDoctorV2(projectRoot) {
1656
1665
  for (const [name, entry] of Object.entries(servers)) {
1657
1666
  if (!entry || typeof entry !== "object")
1658
1667
  continue;
1659
- const cmd = entry.command;
1660
- if (entry.type === "local" && Array.isArray(cmd) && typeof cmd[0] === "string") {
1661
- const bin = cmd[0];
1662
- const ok = isAbsolute(bin) ? existsSync8(bin) : lookupOnPath(bin) !== null;
1663
- if (!ok)
1664
- lines.push(`⚠️ mcp.servers.${name} command no existe (${bin}) — ¿proyecto movido? re-corré install`);
1668
+ const e = entry;
1669
+ if (e.type !== "local" && e.type !== "remote") {
1670
+ lines.push(`⚠️ mcp.servers.${name} sin type local|remote — V2 lo requiere (ver mcp-servers)`);
1671
+ continue;
1672
+ }
1673
+ if ("enabled" in e) {
1674
+ lines.push(`⚠️ mcp.servers.${name} usa enabled (forma V1) — V2 usa disabled invertido`);
1675
+ }
1676
+ if (typeof e.timeout === "number") {
1677
+ lines.push(`⚠️ mcp.servers.${name} timeout numérico (forma V1) — V2 usa timeout: { catalog, execution }`);
1678
+ }
1679
+ if (e.type === "local") {
1680
+ const cmd = e.command;
1681
+ if (!Array.isArray(cmd) || typeof cmd[0] !== "string") {
1682
+ lines.push(`⚠️ mcp.servers.${name} local sin command array — V2 requiere command: [bin, ...args]`);
1683
+ } else {
1684
+ const bin = cmd[0];
1685
+ const ok = isAbsolute(bin) ? existsSync8(bin) : lookupOnPath(bin) !== null;
1686
+ if (!ok)
1687
+ lines.push(`⚠️ mcp.servers.${name} command no existe (${bin}) — ¿proyecto movido? re-corré install`);
1688
+ }
1689
+ } else {
1690
+ if (typeof e.url !== "string" || !/^https?:\/\//.test(e.url)) {
1691
+ lines.push(`⚠️ mcp.servers.${name} remote sin url absoluta — V2 requiere url https://...`);
1692
+ }
1693
+ const oauth = e.oauth;
1694
+ if (oauth && typeof oauth === "object") {
1695
+ for (const k of ["clientId", "clientSecret", "callbackPort", "redirectUri"]) {
1696
+ if (k in oauth) {
1697
+ lines.push(`⚠️ mcp.servers.${name} oauth.${k} camelCase (forma V1) — V2 usa snake_case`);
1698
+ break;
1699
+ }
1700
+ }
1701
+ }
1665
1702
  }
1666
1703
  }
1667
1704
  return lines;
@@ -1690,7 +1727,7 @@ var init_doctor_v2 = __esm(() => {
1690
1727
  // package.json
1691
1728
  var package_default = {
1692
1729
  name: "ostacky",
1693
- version: "0.9.5",
1730
+ version: "0.9.7",
1694
1731
  description: "Instalador interactivo de agentes y comandos para OpenCode",
1695
1732
  type: "module",
1696
1733
  bin: {
@@ -1701,7 +1738,8 @@ var package_default = {
1701
1738
  dev: "bun run src/cli.ts",
1702
1739
  build: "bun build src/cli.ts --target=node --format=esm --outfile dist/cli.js && bun scripts/add-shebang.ts",
1703
1740
  start: "node dist/cli.js",
1704
- test: "bun test",
1741
+ test: "bun test --isolate",
1742
+ "test:safe": "bun run scripts/run-tests-isolated.ts",
1705
1743
  "check:skills": "bun run scripts/check-skill-sync.ts",
1706
1744
  "hash:check": "bun run scripts/update-manifest-hashes.ts --check",
1707
1745
  "hash:update": "bun run scripts/update-manifest-hashes.ts",
@@ -2690,6 +2728,7 @@ import { dirname as dirname7 } from "path";
2690
2728
  init_github();
2691
2729
  init_fs();
2692
2730
  init_lockfile();
2731
+ import { resolve as resolve2 } from "path";
2693
2732
 
2694
2733
  // src/installer.ts
2695
2734
  init_github();
@@ -2867,7 +2906,7 @@ async function probeMcpServer(nodeExecutable, serverPath, cwd, statePath, option
2867
2906
  params: {
2868
2907
  protocolVersion: "2025-03-26",
2869
2908
  capabilities: {},
2870
- clientInfo: { name: "ostacky-installer", version: "0.9.5" }
2909
+ clientInfo: { name: "ostacky-installer", version: "0.9.7" }
2871
2910
  }
2872
2911
  });
2873
2912
  });
@@ -3028,7 +3067,8 @@ async function installMcpServer(item, manifest, paths) {
3028
3067
  const treeHash = computeTreeHash(src);
3029
3068
  assertBundledTreeHash("mcpServers", item.name, treeHash);
3030
3069
  const nodeExecutable = getVerifiedNodeExecutable();
3031
- const projectRoot = dirname4(paths.root);
3070
+ await Promise.resolve().then(() => init_fs());
3071
+ const projectRoot = paths.root === getGlobalOpenCodeDir() ? paths.root : dirname4(paths.root);
3032
3072
  const dest = join6(paths.mcp, item.name);
3033
3073
  const staging = `${dest}.staging-${process.pid}-${Date.now()}`;
3034
3074
  const statePath = item.name === "ostacky-controller" ? join6(paths.root, "ostacky-state.json") : undefined;
@@ -3224,6 +3264,28 @@ function onCancel(value) {
3224
3264
  process.exit(0);
3225
3265
  }
3226
3266
  }
3267
+ async function runGitPreflight(cwd = process.cwd(), opts) {
3268
+ if (isGitRepo(cwd))
3269
+ return { projectRoot: findProjectRoot(cwd), gitReady: true };
3270
+ const interactive = opts?.interactive ?? process.stdin.isTTY === true;
3271
+ if (interactive) {
3272
+ const ask = opts?.confirm ?? (() => me({ message: `No hay repo Git en ${cwd}. ¿Inicializar uno? (recomendado para aislamiento por worktree)` }));
3273
+ let answer = false;
3274
+ try {
3275
+ answer = await ask();
3276
+ } catch {
3277
+ answer = false;
3278
+ }
3279
+ if (answer === true) {
3280
+ try {
3281
+ initGitRepo(cwd);
3282
+ return { projectRoot: findProjectRoot(cwd), gitReady: true };
3283
+ } catch {}
3284
+ }
3285
+ }
3286
+ v2.warn("Sin repo Git: aislamiento por worktree no disponible; se instala en el directorio actual.");
3287
+ return { projectRoot: resolve2(cwd), gitReady: false };
3288
+ }
3227
3289
  async function loadManifest() {
3228
3290
  const spin = L2();
3229
3291
  spin.start("Obteniendo recursos disponibles...");
@@ -3253,11 +3315,24 @@ function printPostInstallSteps() {
3253
3315
  ].join(`
3254
3316
  `), "Próximos pasos");
3255
3317
  }
3256
- async function resolveOpenCodePaths(scope) {
3318
+ async function resolveOpenCodePaths(scope, opts) {
3319
+ const effective = scope ?? "local";
3320
+ if (effective === "global") {
3321
+ await Promise.resolve().then(() => init_fs());
3322
+ const dir = getGlobalOpenCodeDir();
3323
+ try {
3324
+ const paths = ensureOpenCodePaths(dir);
3325
+ ye(dir, "Instalación global");
3326
+ return paths;
3327
+ } catch (e) {
3328
+ throw e;
3329
+ }
3330
+ }
3257
3331
  const cwd = process.cwd();
3258
- const dir = scope === "local" || !scope ? getOpenCodeDirForScope("local", cwd) : getOpenCodeDirForScope("local", cwd);
3259
- if (scope && scope !== "local") {
3260
- v2.warn(`Scope ${scope} removido; usando local en ${dir}`);
3332
+ const base = opts?.gitPreflight ? (await runGitPreflight(cwd)).projectRoot : cwd;
3333
+ const dir = getOpenCodeDirForScope("local", base);
3334
+ if (scope && scope !== "local" && scope !== "global") {
3335
+ v2.warn(`Scope ${scope} no soportado; usando local en ${dir}`);
3261
3336
  }
3262
3337
  try {
3263
3338
  const paths = ensureOpenCodePaths(dir);
@@ -3395,8 +3470,11 @@ async function doInstallStack(toolsDir, projectRoot) {
3395
3470
  async function doInstallAll(manifest, paths, opts) {
3396
3471
  const spin = L2();
3397
3472
  let errors = 0;
3398
- v2.info(`Scope → local | opencodeDir: ${paths.root} | tools: ${paths.tools}`);
3399
- if (!opts?.noStack) {
3473
+ const isGlobal = opts?.scope === "global";
3474
+ v2.info(`Scope → ${isGlobal ? "global" : "local"} | opencodeDir: ${paths.root} | tools: ${paths.tools}`);
3475
+ if (isGlobal) {
3476
+ v2.info("Scope global: núcleo (agente/commands/skills/MCPs/plugins) en dir global; el stack (CodeGraph/Engram) es siempre local por proyecto — omitido aquí. Instalalo por proyecto con `npx ostacky install-stack --scope local`.");
3477
+ } else if (!opts?.noStack) {
3400
3478
  ensureToolDirs(paths.tools, ["codegraph", "engram"]);
3401
3479
  }
3402
3480
  for (const agent of manifest.agents) {
@@ -3474,7 +3552,9 @@ async function doInstallAll(manifest, paths, opts) {
3474
3552
  } catch {}
3475
3553
  let stackOk = true;
3476
3554
  let missingTools = [];
3477
- if (opts?.noStack) {
3555
+ if (isGlobal) {
3556
+ v2.info("Scope global: stack omitido (siempre local por proyecto).");
3557
+ } else if (opts?.noStack) {
3478
3558
  v2.info("Stack omitido (--no-stack): solo núcleo (agente/commands/skills/MCPs/plugins).");
3479
3559
  } else {
3480
3560
  v2.info("Instalando stack de herramientas...");
@@ -3484,7 +3564,7 @@ async function doInstallAll(manifest, paths, opts) {
3484
3564
  }
3485
3565
  const codegraphDir = join8(paths.tools, "codegraph");
3486
3566
  const engramDir = join8(paths.tools, "engram");
3487
- if (!opts?.noStack) {
3567
+ if (!isGlobal && !opts?.noStack) {
3488
3568
  if (!existsSync7(codegraphDir) || !findBinaryInDir(codegraphDir, "codegraph"))
3489
3569
  missingTools.push("CodeGraph");
3490
3570
  if (!existsSync7(engramDir) || !findBinaryInDir(engramDir, "engram"))
@@ -3507,12 +3587,14 @@ async function doInstallAll(manifest, paths, opts) {
3507
3587
  v2.warn("Además el stack quedó parcial: reintentá con `npx ostacky install-stack --scope local`.");
3508
3588
  }
3509
3589
  try {
3510
- const projectRoot = dirname6(paths.root);
3511
- const gi = ensureGitignore(projectRoot);
3512
- if (gi.created)
3513
- v2.info(`.gitignore creado con patrones Ostacky`);
3514
- else if (gi.updated)
3515
- v2.info(`.gitignore actualizado: ${gi.patternsAdded.join(", ")}`);
3590
+ if (!isGlobal) {
3591
+ const projectRoot = dirname6(paths.root);
3592
+ const gi = ensureGitignore(projectRoot);
3593
+ if (gi.created)
3594
+ v2.info(`.gitignore creado con patrones Ostacky`);
3595
+ else if (gi.updated)
3596
+ v2.info(`.gitignore actualizado: ${gi.patternsAdded.join(", ")}`);
3597
+ }
3516
3598
  } catch {}
3517
3599
  return coreOk && !stackPartial;
3518
3600
  }
@@ -4161,7 +4243,7 @@ async function runInteractiveMenu(scope) {
4161
4243
  we(" OpenCode Installer ");
4162
4244
  await ensureOpencodeInstalled();
4163
4245
  const manifest = await loadManifest();
4164
- const paths = await resolveOpenCodePaths(scope ?? null);
4246
+ const paths = await resolveOpenCodePaths(scope ?? null, { gitPreflight: scope !== "global" });
4165
4247
  if (!paths) {
4166
4248
  fe("Instalación cancelada.");
4167
4249
  return;
@@ -4235,12 +4317,12 @@ async function runInstallCommand(scope, opts) {
4235
4317
  we(" OpenCode Installer ");
4236
4318
  await ensureOpencodeInstalled();
4237
4319
  const manifest = await loadManifest();
4238
- const paths = await resolveOpenCodePaths(scope ?? null);
4320
+ const paths = await resolveOpenCodePaths(scope ?? null, { gitPreflight: scope !== "global" });
4239
4321
  if (!paths) {
4240
4322
  fe("Cancelado.");
4241
4323
  return;
4242
4324
  }
4243
- if (!await doInstallAll(manifest, paths, opts))
4325
+ if (!await doInstallAll(manifest, paths, { ...opts, scope: scope ?? "local" }))
4244
4326
  process.exitCode = 1;
4245
4327
  printPostInstallSteps();
4246
4328
  fe(process.exitCode ? "Instalación parcial." : "Instalación completada.");
@@ -4300,7 +4382,7 @@ async function runAddMcpCommand(scope) {
4300
4382
  async function runInstallStackCommand(scope) {
4301
4383
  await ensureOpencodeInstalled();
4302
4384
  we(" OpenCode Installer — Stack ");
4303
- const paths = await resolveOpenCodePaths(scope ?? null);
4385
+ const paths = await resolveOpenCodePaths(scope ?? null, { gitPreflight: true });
4304
4386
  if (!paths) {
4305
4387
  fe("Cancelado.");
4306
4388
  return;
@@ -4499,59 +4581,142 @@ async function runUninstallMcpCommand(name, scope) {
4499
4581
  }
4500
4582
 
4501
4583
  // src/cli.ts
4502
- init_fs();
4503
4584
  import { existsSync as existsSync9, statSync as statSync3, readFileSync as readFileSync7, readdirSync as readdirSync4 } from "node:fs";
4504
4585
  import { join as join11, dirname as dirname8 } from "node:path";
4586
+ import { spawnSync } from "node:child_process";
4587
+ init_fs();
4588
+
4589
+ // src/version-check.ts
4590
+ function parseMajor(version) {
4591
+ if (!version)
4592
+ return null;
4593
+ const m = /v?(\d+)\.\d+\.\d+/.exec(version.trim());
4594
+ if (!m)
4595
+ return null;
4596
+ const major = parseInt(m[1], 10);
4597
+ return Number.isNaN(major) ? null : major;
4598
+ }
4599
+ function compareVersions(a, b) {
4600
+ const pa = a.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
4601
+ const pb = b.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
4602
+ for (let i = 0;i < 3; i++) {
4603
+ if ((pa[i] ?? 0) < (pb[i] ?? 0))
4604
+ return -1;
4605
+ if ((pa[i] ?? 0) > (pb[i] ?? 0))
4606
+ return 1;
4607
+ }
4608
+ return 0;
4609
+ }
4610
+ async function fetchLatestNpmVersion(pkg = "ostacky", timeoutMs = 5000) {
4611
+ try {
4612
+ const res = await fetch(`https://registry.npmjs.org/${pkg}/latest`, {
4613
+ signal: AbortSignal.timeout(timeoutMs),
4614
+ headers: { "User-Agent": "ostacky-installer" }
4615
+ });
4616
+ if (!res.ok)
4617
+ return null;
4618
+ const data = await res.json();
4619
+ return typeof data.version === "string" ? data.version : null;
4620
+ } catch {
4621
+ return null;
4622
+ }
4623
+ }
4624
+ function decideOffer(installed, latest) {
4625
+ if (!latest || compareVersions(installed, latest) >= 0) {
4626
+ return { kind: "none", installed, latest };
4627
+ }
4628
+ if (parseMajor(installed) === 1) {
4629
+ return { kind: "migrate-v1", installed, latest };
4630
+ }
4631
+ return { kind: "update-available", installed, latest };
4632
+ }
4633
+ function canPrompt(argv = process.argv, isTTY = process.stdin.isTTY === true) {
4634
+ if (!isTTY)
4635
+ return false;
4636
+ return !argv.includes("--yes") && !argv.includes("--no-interactive") && !argv.includes("--non-interactive");
4637
+ }
4638
+
4639
+ // src/cli.ts
4640
+ async function maybeOfferUpdateOrMigrate(installed, scope) {
4641
+ const latest = await fetchLatestNpmVersion();
4642
+ const offer = decideOffer(installed, latest);
4643
+ if (offer.kind === "none" || !offer.latest)
4644
+ return;
4645
+ if (!canPrompt()) {
4646
+ console.error(`Hay una versión más nueva de ostacky: ${offer.latest} (instalada: ${installed}). Re-ejecutá con npx ostacky@latest.`);
4647
+ return;
4648
+ }
4649
+ if (offer.kind === "migrate-v1") {
4650
+ const confirm = await me({
4651
+ message: `Tenés Ostacky v1 instalada (${installed}) y la última es ${offer.latest} (v2). ¿Desinstalar v1 e instalar v2? (los artefactos legacy se limpian automáticamente)${scope === "global" ? " (scope global)" : ""}`,
4652
+ initialValue: true
4653
+ });
4654
+ if (BD(confirm) || !confirm)
4655
+ return;
4656
+ } else {
4657
+ const confirm = await me({
4658
+ message: `Hay una versión más nueva de ostacky: ${offer.latest} (instalada: ${installed}). ¿Actualizar y re-ejecutar con @latest?`,
4659
+ initialValue: true
4660
+ });
4661
+ if (BD(confirm) || !confirm)
4662
+ return;
4663
+ }
4664
+ const userArgs = process.argv.slice(2);
4665
+ const invocation = getCommandInvocation("npx", ["ostacky@latest", ...userArgs]);
4666
+ const res = spawnSync(invocation.command, invocation.args, { stdio: "inherit" });
4667
+ process.exit(res.status ?? 0);
4668
+ }
4505
4669
  var HELP = `
4506
4670
  ostacky — Instalador de agentes, comandos, skills y MCPs para OpenCode
4507
4671
 
4508
4672
  Uso:
4509
- npx ostacky [--scope local] Menú interactivo (instalación completa, siempre local)
4510
- npx ostacky install [--scope local] [--no-stack] Instalar TODO (agente + skills + MCPs + CodeGraph + OpenSpec + Engram; --no-stack omite el stack)
4511
- npx ostacky add agent [--scope local] Agregar agente(s)
4512
- npx ostacky add command [--scope local] Agregar command(s)
4513
- npx ostacky add skill [--scope local] Agregar skill(s)
4514
- npx ostacky add mcp [--scope local] Agregar MCP server(s)
4515
- npx ostacky install-stack [--scope local] Instalar solo el stack de herramientas (CodeGraph, OpenSpec, Engram)
4673
+ npx ostacky [--scope local|global] Menú interactivo (default: local en <proyecto>/.opencode)
4674
+ npx ostacky install [--scope local|global] [--no-stack] Instalar TODO (agente + skills + MCPs + CodeGraph + OpenSpec + Engram; --no-stack omite el stack)
4675
+ npx ostacky add agent [--scope local|global] Agregar agente(s)
4676
+ npx ostacky add command [--scope local|global] Agregar command(s)
4677
+ npx ostacky add skill [--scope local|global] Agregar skill(s)
4678
+ npx ostacky add mcp [--scope local|global] Agregar MCP server(s)
4679
+ npx ostacky install-stack [--scope local] Instalar solo el stack de herramientas (CodeGraph, OpenSpec, Engram — siempre local por proyecto)
4516
4680
  npx ostacky uninstall-stack [--scope local] Remover la configuración del stack del proyecto
4517
4681
  npx ostacky doctor Diagnostica locks, tools, state health
4518
4682
  npx ostacky status [--json] Muestra estado del controller sin MCP
4519
- npx ostacky update [--scope local] Actualizar instalación
4520
- npx ostacky uninstall [--scope local] Desinstalar todo
4521
- npx ostacky uninstall agent [--scope local] Desinstalar agente(s)
4522
- npx ostacky uninstall command [--scope local] Desinstalar command(s)
4523
- npx ostacky uninstall skill [--scope local] Desinstalar skill(s)
4524
- npx ostacky uninstall mcp [--scope local] Desinstalar MCP server(s)
4683
+ npx ostacky update [--scope local|global] Actualizar instalación
4684
+ npx ostacky uninstall [--scope local|global] Desinstalar todo
4685
+ npx ostacky uninstall agent [--scope local|global] Desinstalar agente(s)
4686
+ npx ostacky uninstall command [--scope local|global] Desinstalar command(s)
4687
+ npx ostacky uninstall skill [--scope local|global] Desinstalar skill(s)
4688
+ npx ostacky uninstall mcp [--scope local|global] Desinstalar MCP server(s)
4525
4689
  npx ostacky --help Mostrar esta ayuda
4526
4690
  npx ostacky --version Mostrar versión
4527
4691
 
4528
4692
  Scope:
4529
- --scope local Escribe en <proyecto>/.opencode (siempre local, instalador único)
4530
- Sin flag Asume local implícito (no pregunta global)
4693
+ --scope local Escribe en <proyecto>/.opencode (default; no pregunta global)
4694
+ --scope global Escribe en el config dir global de OpenCode (~/.config/opencode, respeta XDG_CONFIG_HOME)
4695
+ Sin flag Asume local implícito
4531
4696
  `.trim();
4532
4697
  function parseScopeArg(argv = process.argv) {
4533
4698
  for (let i = 0;i < argv.length; i++) {
4534
4699
  const arg = argv[i];
4535
4700
  if (arg === "--scope" && i + 1 < argv.length) {
4536
4701
  const v = argv[i + 1];
4537
- if (v === "local")
4702
+ if (v === "local" || v === "global")
4538
4703
  return v;
4539
- if (v === "global" || v === "auto") {
4540
- console.error(`Error: --scope ${v} removido; Ostacky instala siempre local en <proyecto>/.opencode. Hacé cd al proyecto y re-ejecutá con --scope local.`);
4704
+ if (v === "auto") {
4705
+ console.error(`Error: --scope auto removido; usá --scope local o --scope global explícito.`);
4541
4706
  process.exit(1);
4542
4707
  }
4543
4708
  }
4544
4709
  if (arg.startsWith("--scope=")) {
4545
4710
  const v = arg.split("=")[1];
4546
- if (v === "local")
4711
+ if (v === "local" || v === "global")
4547
4712
  return v;
4548
- if (v === "global" || v === "auto") {
4549
- console.error(`Error: --scope ${v} removido; Ostacky instala siempre local en <proyecto>/.opencode. Hacé cd al proyecto y re-ejecutá con --scope local.`);
4713
+ if (v === "auto") {
4714
+ console.error(`Error: --scope auto removido; usá --scope local o --scope global explícito.`);
4550
4715
  process.exit(1);
4551
4716
  }
4552
4717
  }
4553
4718
  if (arg === "-g") {
4554
- console.error(`Error: -g/global removido; Ostacky instala siempre local en <proyecto>/.opencode. Hacé cd al proyecto y re-ejecutá sin -g.`);
4719
+ console.error(`Error: -g removido; usá --scope global (instalación global) o --scope local (default por proyecto).`);
4555
4720
  process.exit(1);
4556
4721
  }
4557
4722
  }
@@ -4912,10 +5077,16 @@ async function main() {
4912
5077
  await runInstallCommand(scope, { noStack });
4913
5078
  break;
4914
5079
  case "install-stack":
4915
- await runInstallStackCommand(scope);
5080
+ if (scope === "global") {
5081
+ console.error(`Aviso: el stack (CodeGraph/Engram) se instala siempre local por proyecto. Ignorando --scope global y usando local.`);
5082
+ }
5083
+ await runInstallStackCommand(null);
4916
5084
  break;
4917
5085
  case "uninstall-stack":
4918
- await runUninstallStackCommand(scope);
5086
+ if (scope === "global") {
5087
+ console.error(`Aviso: el stack es siempre local por proyecto. Ignorando --scope global y usando local.`);
5088
+ }
5089
+ await runUninstallStackCommand(null);
4919
5090
  break;
4920
5091
  case "add":
4921
5092
  if (subcmd === "agent") {
@@ -4973,6 +5144,7 @@ async function main() {
4973
5144
  console.error(`Comando desconocido: "${cmd}". Usá --help para ver los comandos disponibles.`);
4974
5145
  process.exit(1);
4975
5146
  }
5147
+ await maybeOfferUpdateOrMigrate(package_default.version, scope);
4976
5148
  await runInteractiveMenu(scope);
4977
5149
  }
4978
5150
  }
package/manifest.json CHANGED
@@ -1,46 +1,46 @@
1
1
  {
2
- "version": "0.9.5",
2
+ "version": "0.9.7",
3
3
  "repo": "JaimeHoracio/Ostacky",
4
- "tag": "v0.9.5",
4
+ "tag": "v0.9.7",
5
5
  "agents": [
6
6
  {
7
7
  "name": "ostacky",
8
8
  "file": "assets/agents/ostacky.md",
9
- "description": "Orquestador con recuperación automática (nunca se congela), ruteo por nivel de impacto, controller MCP con SDK oficial, edición segura con fallback inline, y delegación en OpenSpec + Superpowers. v0.9.5: prune de skills obsoletas, lastHandoff, getAvailableTransitions, consecutiveFailures real, mem_session_summary automático al cierre.",
10
- "version": "0.9.5",
11
- "sha256": "986c41356dcdea8d74fea6a17127a45e78e16a5cda43152efb5c7ffd11593b8c"
9
+ "description": "Orquestador con recuperación automática (nunca se congela), ruteo por nivel de impacto, controller MCP con SDK oficial, edición segura con fallback inline, y delegación en OpenSpec + Superpowers. v0.9.7: prune de skills obsoletas, lastHandoff, getAvailableTransitions, consecutiveFailures real, mem_session_summary automático al cierre.",
10
+ "version": "0.9.7",
11
+ "sha256": "4481017881dadef3cabf516053d13930b5c948f879f8996fcb03ca5133073199"
12
12
  }
13
13
  ],
14
14
  "commands": [
15
15
  {
16
16
  "name": "install-stack",
17
17
  "file": "assets/commands/install-stack.md",
18
- "description": "Instala el stack tecnológico del proyecto (CodeGraph, skills, OpenSpec, Engram, controller plugin). v0.9.5: controller plugin como alma hard-gate, Context7 removido del stack.",
19
- "version": "0.9.5",
20
- "sha256": "e218ec7db404fc8bd5fa1d92312eef5ea517bb0940af054f8665048ec2e9da5f"
18
+ "description": "Instala el stack tecnológico del proyecto (CodeGraph, skills, OpenSpec, Engram, controller plugin). v0.9.7: controller plugin como alma hard-gate, Context7 removido del stack.",
19
+ "version": "0.9.7",
20
+ "sha256": "0e1f52a236843fffbf166c1b381c52907abe19887e2472f667642ecbcb0f43a8"
21
21
  },
22
22
  {
23
23
  "name": "opsx-sync",
24
24
  "file": "assets/commands/opsx-sync.md",
25
25
  "description": "Sincroniza delta specs del change activo sin inicializar CodeGraph si ya existe índice",
26
- "version": "0.9.5",
27
- "sha256": "fe0158478f2ca63b315037a85fc1632b77868532e319af6c7384285441767d64"
26
+ "version": "0.9.7",
27
+ "sha256": "f883f9ad96f7d75778631d5cc13d8a1a9c3e6ec41396bbce8ce13cff2e66fca2"
28
28
  }
29
29
  ],
30
30
  "mcpServers": [
31
31
  {
32
32
  "name": "ostacky-controller",
33
33
  "file": "assets/mcp/ostacky-controller/",
34
- "description": "Máquina de estados persistida con @modelcontextprotocol/server SDK. v0.9.5: 22 tools (incluye set_handoff, get_handoff, clear_handoff, get_available_transitions funcional). Bugfixes: consecutiveFailures real, lastHandoff state, defaultChoice persistido. Robustez: degraded mode automático tras 3 fallos, persistence condicional para Nivel 0, prune de skills obsoletas.",
35
- "version": "0.9.5",
36
- "sha256": "775f4b8b28a315e97f9192d71a9433fa28235fe84c29401451ace628829c7076"
34
+ "description": "Máquina de estados persistida con @modelcontextprotocol/server SDK. v0.9.7: 22 tools (incluye set_handoff, get_handoff, clear_handoff, get_available_transitions funcional). Bugfixes: consecutiveFailures real, lastHandoff state, defaultChoice persistido. Robustez: degraded mode automático tras 3 fallos, persistence condicional para Nivel 0, prune de skills obsoletas.",
35
+ "version": "0.9.7",
36
+ "sha256": "41bfad0ddf21fac992c72e2a4e590445d075a5f8e8cb30a165728dff23a5d41a"
37
37
  },
38
38
  {
39
39
  "name": "openspec",
40
40
  "file": "assets/mcp/openspec/",
41
41
  "description": "MCP server local para OpenSpec - proposal, apply, archive, sync de cambios",
42
- "version": "0.9.5",
43
- "sha256": "fa4be28bfc1e75db8f1a037e2580f04a60066c80e8e5934e90e1041020d04609"
42
+ "version": "0.9.7",
43
+ "sha256": "bdb283fe8ec2dfcba2ec4f38191f4039e58cd7ae12e44e66310783b42c827638"
44
44
  }
45
45
  ],
46
46
  "skills": [
@@ -48,105 +48,105 @@
48
48
  "name": "brainstorming",
49
49
  "file": "assets/skills/brainstorming/SKILL.md",
50
50
  "description": "Skill unificado de pensamiento con dos modos: creative-design (producción de diseño → transición a implementación directa o openspec-propose) y open-exploration (exploración libre)",
51
- "version": "0.9.5",
51
+ "version": "0.9.7",
52
52
  "sha256": "f1013a86a8f27914d85a716e23c7fd32db1786d93615e8b0834b13d184308549"
53
53
  },
54
54
  {
55
55
  "name": "execution-mode-evaluation",
56
56
  "file": "assets/skills/execution-mode-evaluation/SKILL.md",
57
57
  "description": "Skill de análisis de modo de ejecución — output reconciliado con controller snapshot contract (recommendation field)",
58
- "version": "0.9.5",
58
+ "version": "0.9.7",
59
59
  "sha256": "2158a6864c0912e868a9d720db7fd79441e6cc298e3320833d2527c9727c852e"
60
60
  },
61
61
  {
62
62
  "name": "tdd",
63
63
  "file": "assets/skills/tdd/SKILL.md",
64
64
  "description": "Skill de test-driven development (Superpowers)",
65
- "version": "0.9.5",
65
+ "version": "0.9.7",
66
66
  "sha256": "f0ebfbbc43a8868d31a3fd2df37ae7f60fe8add09c6475862395a68269e5ff7f"
67
67
  },
68
68
  {
69
69
  "name": "subagent-driven-development",
70
70
  "file": "assets/skills/subagent-driven-development/SKILL.md",
71
71
  "description": "Skill de ejecución con subagentes (Superpowers) — ejecuta solo después de confirmación del coordinador Ostacky",
72
- "version": "0.9.5",
72
+ "version": "0.9.7",
73
73
  "sha256": "1a42d714a9a13faf05f0bf7b580e8d837c2e77a5633839542ccce603023419e8"
74
74
  },
75
75
  {
76
76
  "name": "dispatching-parallel-agents",
77
77
  "file": "assets/skills/dispatching-parallel-agents/SKILL.md",
78
78
  "description": "Skill de dispatch paralelo de agentes (Superpowers)",
79
- "version": "0.9.5",
79
+ "version": "0.9.7",
80
80
  "sha256": "7e7b712ef742d5631e302e6a71583e2bbbd33094da9281abfb84b43505fc3ef1"
81
81
  },
82
82
  {
83
83
  "name": "review",
84
84
  "file": "assets/skills/review/SKILL.md",
85
85
  "description": "Skill de revisión de código (Superpowers)",
86
- "version": "0.9.5",
86
+ "version": "0.9.7",
87
87
  "sha256": "b19650ed4d1d4d9857a4dd5b7e08e91328a1a1fc9c45bcc2fb600fa9d0213279"
88
88
  },
89
89
  {
90
90
  "name": "receiving-code-review",
91
91
  "file": "assets/skills/receiving-code-review/SKILL.md",
92
92
  "description": "Skill de recibir y procesar feedback de code review",
93
- "version": "0.9.5",
93
+ "version": "0.9.7",
94
94
  "sha256": "d761e884e71d8d3476ac734d287cae403a4024506a7d12e7361a448217c0a831"
95
95
  },
96
96
  {
97
97
  "name": "openspec-propose",
98
98
  "file": "assets/skills/openspec-propose/SKILL.md",
99
99
  "description": "Skill de generación de proposal (OpenSpec)",
100
- "version": "0.9.5",
100
+ "version": "0.9.7",
101
101
  "sha256": "6a517f750f24c008208156a2d653e97ed30b1e53878aeac5ce394e573db0678f"
102
102
  },
103
103
  {
104
104
  "name": "openspec-apply-change",
105
105
  "file": "assets/skills/openspec-apply-change/SKILL.md",
106
106
  "description": "Skill de aplicación de change (OpenSpec)",
107
- "version": "0.9.5",
107
+ "version": "0.9.7",
108
108
  "sha256": "dfc823bf89fc7505e91ab6dee9c1f004be38a410bd3d88fb67b211b1b6cbb1d0"
109
109
  },
110
110
  {
111
111
  "name": "openspec-archive-change",
112
112
  "file": "assets/skills/openspec-archive-change/SKILL.md",
113
113
  "description": "Skill de archivo de change (OpenSpec)",
114
- "version": "0.9.5",
114
+ "version": "0.9.7",
115
115
  "sha256": "16e4b561de7747283663fed602e506abf502452c49a8d4b86d7a5539c40f0195"
116
116
  },
117
117
  {
118
118
  "name": "openspec-explore",
119
119
  "file": "assets/skills/openspec-explore/SKILL.md",
120
120
  "description": "Modo explore para OpenSpec — thinking partner para explorar ideas, investigar problemas y clarificar requisitos antes/durante un cambio",
121
- "version": "0.9.5",
121
+ "version": "0.9.7",
122
122
  "sha256": "9eafc3a8c693b8d9916867ef764d49e5222da717fde501c957bb3f6c312d2415"
123
123
  },
124
124
  {
125
125
  "name": "using-git-worktrees",
126
126
  "file": "assets/skills/using-git-worktrees/SKILL.md",
127
127
  "description": "Skill de uso de git worktrees para aislamiento de trabajo",
128
- "version": "0.9.5",
128
+ "version": "0.9.7",
129
129
  "sha256": "93341bc1b7c053618a8b6dc07e3615b77990d7b549a0201f5835d95fef67ce13"
130
130
  },
131
131
  {
132
132
  "name": "using-superpowers",
133
133
  "file": "assets/skills/using-superpowers/SKILL.md",
134
134
  "description": "Skill de orquestación de Superpowers skills",
135
- "version": "0.9.5",
135
+ "version": "0.9.7",
136
136
  "sha256": "7e54536f96d2a379185a10bfc1e970850caa2561b6d8aca7080f0defea0381a4"
137
137
  },
138
138
  {
139
139
  "name": "writing-skills",
140
140
  "file": "assets/skills/writing-skills/SKILL.md",
141
141
  "description": "Skill de creación y edición de skills",
142
- "version": "0.9.5",
142
+ "version": "0.9.7",
143
143
  "sha256": "3d76b906cee518a2b809febb70db95697a35b9f368986bb504b4120c3bfb437a"
144
144
  },
145
145
  {
146
146
  "name": "graceful-degradation",
147
147
  "file": "assets/skills/graceful-degradation/SKILL.md",
148
148
  "description": "Skill de degradación graceful cuando múltiples tools están indisponibles",
149
- "version": "0.9.5",
149
+ "version": "0.9.7",
150
150
  "sha256": "363449bd9e6f800a0a3168667cf78f767fb105d86e4a4adadcc649d418139303"
151
151
  }
152
152
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ostacky",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "description": "Instalador interactivo de agentes y comandos para OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,8 @@
11
11
  "dev": "bun run src/cli.ts",
12
12
  "build": "bun build src/cli.ts --target=node --format=esm --outfile dist/cli.js && bun scripts/add-shebang.ts",
13
13
  "start": "node dist/cli.js",
14
- "test": "bun test",
14
+ "test": "bun test --isolate",
15
+ "test:safe": "bun run scripts/run-tests-isolated.ts",
15
16
  "check:skills": "bun run scripts/check-skill-sync.ts",
16
17
  "hash:check": "bun run scripts/update-manifest-hashes.ts --check",
17
18
  "hash:update": "bun run scripts/update-manifest-hashes.ts",
@@ -1,20 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "configVersion": 1,
4
- "workspaces": {
5
- "": {
6
- "name": "openspec-mcp",
7
- "dependencies": {
8
- "@modelcontextprotocol/server": "^2.0.0-beta.5",
9
- "zod": "^4.0.0",
10
- },
11
- },
12
- },
13
- "packages": {
14
- "@modelcontextprotocol/core": ["@modelcontextprotocol/core@2.0.0-beta.5", "", { "dependencies": { "zod": "^4.2.0" } }, "sha512-HKbY9XTbsDy1Y6r2I55TGE3JEapM0vg96e1MUmBIF9LGjos5gjhcIrTz1yvBPLg2aFKHjwhUAQfRdrCEnPxNew=="],
15
-
16
- "@modelcontextprotocol/server": ["@modelcontextprotocol/server@2.0.0-beta.5", "", { "dependencies": { "@modelcontextprotocol/core": "2.0.0-beta.5", "zod": "^4.2.0" } }, "sha512-i1E5l75rQKsgY/AKAIspgMBH1vEL7dqiK7tHr0L+raYcb0SWOziqNGJXGIG6NY4AlXDWIKGJQGB7Nqfs3oUi5g=="],
17
-
18
- "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
19
- }
20
- }
@@ -1,20 +0,0 @@
1
- {
2
- "lockfileVersion": 2,
3
- "configVersion": 0,
4
- "workspaces": {
5
- "": {
6
- "name": "ostacky-controller",
7
- "dependencies": {
8
- "@modelcontextprotocol/server": "^2.0.0",
9
- "zod": "^4.0.0",
10
- },
11
- },
12
- },
13
- "packages": {
14
- "@modelcontextprotocol/core": ["@modelcontextprotocol/core@2.1.0", "", { "dependencies": { "zod": "^4.2.0" } }, "sha512-YdFj5gMRHr0gYNAhTbQDgjLHiEJdIAUYxomhKseUNye7ZGlISQmUoLh2sveFFCiQ7j2YMffT1kgSND0FSfIFjQ=="],
15
-
16
- "@modelcontextprotocol/server": ["@modelcontextprotocol/server@2.1.0", "", { "dependencies": { "@modelcontextprotocol/core": "2.1.0", "zod": "^4.2.0" } }, "sha512-FdvwZU5N03O77Suh35JqjAqq5R1ZTEPFtwu6N4BgBq28qrQtrCnpbLL5U2pwYCuE194jAw0xnlOVmIqhfoYuUQ=="],
17
-
18
- "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
19
- }
20
- }