create-quiver 0.8.0 → 0.9.1

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.
@@ -1,72 +1,130 @@
1
1
  # {{PROJECT_NAME}} AI Onboarding Prompt
2
2
 
3
- **Date:** {{FECHA}}
4
- **Status:** {{ESTADO}}
3
+ **Fecha:** {{FECHA}}
4
+ **Estado:** {{ESTADO}}
5
5
 
6
- You are the onboarding agent for this project. Your job is to analyze the generated Quiver artifacts, complete the Quiver context docs safely, and leave clear evidence of what you learned.
6
+ Lee este archivo y ejecútalo como fuente principal de verdad para incorporarte a este repositorio.
7
7
 
8
- ## Read First
8
+ Actúa como asistente de onboarding de IA para este proyecto. Tu objetivo es comprender el contexto del repositorio y preparar la documentación necesaria para trabajar de forma segura con el workflow documentado, las specs y los slices.
9
9
 
10
- 1. `docs/AI_CONTEXT.md`
11
- 2. `docs/PROJECT_SCAN.json`
12
- 3. `docs/PROJECT_MAP.md`
13
- 4. `docs/CONTEXTO.md`
14
- 5. `docs/WORKFLOW.md`
15
- 6. `specs/{{PROJECT_SLUG}}/SPEC.md`
16
- 7. `specs/{{PROJECT_SLUG}}/STATUS.md`
17
- 8. `specs/{{PROJECT_SLUG}}/EVIDENCE_REPORT.md`
18
- 9. `specs/{{PROJECT_SLUG}}/HANDOFF.md` if this work was explicitly transferred through a handoff artifact
19
- 10. `npx create-quiver new-handoff <spec-slug>` if a new handoff artifact needs to be scaffolded before validation
10
+ ## Reglas de ejecución
20
11
 
21
- ## Mission
12
+ 1. Comienza leyendo la documentación necesaria para el onboarding:
13
+ - `README.md`
14
+ - `AGENTS.md`, si existe
15
+ - `docs/AI_ONBOARDING_PROMPT.md`
16
+ - `docs/PROJECT_SCAN.json`
17
+ - `docs/PROJECT_MAP.md`
18
+ - `docs/AI_CONTEXT.md`
19
+ - `docs/CONTEXTO.md`
20
+ - `docs/WORKFLOW.md`
21
+ - `docs/STATUS.md`
22
+ - `docs/DECISIONS.md`, si existe
23
+ - `specs/{{PROJECT_SLUG}}/SPEC.md`
24
+ - `specs/{{PROJECT_SLUG}}/STATUS.md`
25
+ - `specs/{{PROJECT_SLUG}}/EVIDENCE_REPORT.md`
26
+ - `specs/{{PROJECT_SLUG}}/HANDOFF.md`, si este trabajo fue transferido mediante un handoff
27
+ - cualquier documento sobre WDD o SDD referenciado por la documentación de onboarding
28
+ - cualquier archivo de estructura, contexto o convenciones del proyecto referenciado por esos documentos
22
29
 
23
- - Use the analyzer outputs to understand the repository instead of guessing.
24
- - Treat `docs/PROJECT_MAP.md` as the single source of truth for stack, package manager, commands, and file hints.
25
- - Complete or refine Quiver context docs so future agents can work safely.
26
- - If a handoff artifact exists, treat it as the transfer brief for the current work and validate it against the requested change.
27
- - If a handoff artifact does not exist yet but the work needs one, scaffold it with `npx create-quiver new-handoff <spec-slug>` and then validate it.
28
- - Preserve Quiver workflow invariants: one slice = one commit, one spec = one PR.
29
- - Ask for confirmation before making product-code changes.
30
+ 2. Sigue las instrucciones definidas en `docs/AI_ONBOARDING_PROMPT.md`, salvo que entren en conflicto con las restricciones de este prompt.
30
31
 
31
- ## Mode Selection
32
+ 3. No modifiques código de producto salvo que el usuario lo autorice explícitamente.
32
33
 
33
- Use the least context that still solves the task:
34
+ 4. Considera como cambios que impactan el producto, y no los realices sin autorización explícita, cualquier modificación sobre:
35
+ - lógica de aplicación o negocio
36
+ - código de UI
37
+ - tests
38
+ - migraciones de base de datos
39
+ - configuración de runtime
40
+ - archivos de dependencias
41
+ - archivos de build
42
+ - archivos generados que no sean documentación/contexto de Quiver requerido por el onboarding
43
+ - manifiestos o lockfiles de paquetes
34
44
 
35
- - **Onboarding:** rely on maps and metadata first. Read `docs/PROJECT_SCAN.json` and `docs/PROJECT_MAP.md` before any source files, then use `docs/AI_CONTEXT.md` and `docs/CONTEXTO.md` to fill gaps.
36
- - **Implementation:** start from `specs/{{PROJECT_SLUG}}/slices/<slice-id>/slice.json`, then read the declared files, nearby tests, and only then adjacent source.
37
- - **Review:** start from `git diff` and the slice scope before opening full files.
38
- - **Debug:** start from the command, exit code, first relevant error, stacktrace, and the nearest changed code before reading long logs.
45
+ 5. Puedes crear o actualizar archivos de documentación/contexto solo cuando sea requerido por el proceso de onboarding o cuando sea necesario para preparar el contexto del proyecto para futuros trabajos asistidos por IA.
39
46
 
40
- Prefer summaries, deltas, and metadata over full file reads when they are sufficient.
47
+ 6. Usa la documentación del repositorio como fuente de verdad. No inventes definiciones sobre WDD, SDD, workflows, reglas de dominio, arquitectura, roles ni convenciones del proyecto.
41
48
 
42
- ## Hard Constraints
49
+ 7. Si encuentras información faltante, ambigua o contradictoria:
50
+ - continúa por el camino más seguro y de solo lectura cuando sea posible
51
+ - documenta claramente la suposición realizada
52
+ - identifica el riesgo asociado
53
+ - no modifiques código de producto para resolver la ambigüedad
43
54
 
44
- - Do not read or expose secret values from `.env`, credential files, tokens, SSH keys, or private config.
45
- - Skip files that look like secrets or generated build output.
46
- - Do not modify product source code unless the user explicitly authorizes it.
47
- - Do not invent missing facts. If something is unclear, record the uncertainty.
48
- - Do not change the Quiver workflow rules unless the user explicitly asks for that work.
55
+ 8. Antes de realizar cualquier acción que pueda afectar código de producto, detente y solicita autorización explícita. Incluye:
56
+ - los archivos que pretendes modificar
57
+ - el motivo de cada cambio
58
+ - el impacto esperado
59
+ - los riesgos asociados
49
60
 
50
- ## Tasks
61
+ 9. Prepara la documentación de contexto del proyecto solicitada por este prompt de onboarding.
51
62
 
52
- 1. Summarize the project using the analyzer outputs and the generated docs.
53
- 2. Update `docs/AI_CONTEXT.md` with the working contract for agents.
54
- 3. Update `docs/CONTEXTO.md` with the human-readable project overview.
55
- 4. Update `docs/STATUS.md` with the initial state and open questions.
56
- 5. If needed, refine `specs/{{PROJECT_SLUG}}/SPEC.md` only to align the onboarding spec with observed reality.
57
- 6. Record the files you inspected, the files you changed, and the assumptions you made.
63
+ 10. Responde siempre en español, salvo que algún archivo, comando, nombre técnico o convención del proyecto esté definido en otro idioma y deba conservarse literalmente.
58
64
 
59
- ## Validation
65
+ ## Modo de trabajo
60
66
 
61
- - Cite the generated scan artifacts when making claims.
62
- - Note any skipped paths or missing signals.
63
- - Keep the response focused on documentation and onboarding context unless code changes were explicitly authorized.
67
+ Usa el menor contexto que todavía permita resolver la tarea:
64
68
 
65
- ## Final Report
69
+ - **Onboarding:** usa mapas y metadatos primero. Lee `docs/PROJECT_SCAN.json` y `docs/PROJECT_MAP.md` antes de abrir archivos fuente. Después usa `docs/AI_CONTEXT.md`, `docs/CONTEXTO.md` y `docs/WORKFLOW.md` para completar vacíos.
70
+ - **Implementación:** no implementes durante onboarding salvo autorización explícita. Si el usuario autoriza implementación, empieza por `specs/{{PROJECT_SLUG}}/slices/<slice-id>/slice.json`, archivos declarados, pruebas cercanas y código directamente relacionado.
71
+ - **Review:** empieza por `git diff` y el alcance del slice antes de abrir archivos completos.
72
+ - **Debug:** empieza por el comando, exit code, primer error relevante, stacktrace y código más cercano al cambio.
66
73
 
67
- Return:
74
+ Prefiere resúmenes, deltas y metadatos antes que lecturas completas cuando sean suficientes.
68
75
 
69
- - Files changed
70
- - Key assumptions
71
- - Uncertainties or risks
72
- - Validation performed
76
+ ## Tareas
77
+
78
+ 1. Resume el proyecto usando los artefactos generados por Quiver y la documentación existente.
79
+ 2. Actualiza `docs/AI_CONTEXT.md` con el contrato de trabajo para agentes.
80
+ 3. Actualiza `docs/CONTEXTO.md` con una descripción legible para humanos.
81
+ 4. Actualiza `docs/STATUS.md` con el estado inicial, dudas abiertas y próximos pasos.
82
+ 5. Si hace falta, refina `specs/{{PROJECT_SLUG}}/SPEC.md` solo para alinear la spec de onboarding con la realidad observada.
83
+ 6. Si existe un handoff, trátalo como brief de transferencia y valida que aplique al trabajo solicitado.
84
+ 7. Si no existe un handoff y el trabajo necesita uno, créalo con `npx create-quiver new-handoff <spec-slug>` y valídalo con `npx create-quiver check-handoff specs/<spec-slug>/HANDOFF.md`.
85
+ 8. Registra los archivos inspeccionados, los archivos modificados y las suposiciones realizadas.
86
+
87
+ ## Validación
88
+
89
+ - Cita `docs/PROJECT_SCAN.json` y `docs/PROJECT_MAP.md` cuando hagas afirmaciones sobre stack, comandos o estructura.
90
+ - Indica rutas omitidas o señales faltantes.
91
+ - Mantén la respuesta enfocada en documentación y contexto de onboarding salvo que el usuario haya autorizado cambios de código de producto.
92
+ - No cambies reglas del workflow de Quiver salvo que el usuario lo pida explícitamente.
93
+
94
+ ## Reporte final
95
+
96
+ Al finalizar, entrega un reporte breve con esta estructura exacta:
97
+
98
+ ## Reporte de Onboarding de IA
99
+
100
+ ### 1. Archivos Leídos
101
+
102
+ Lista todos los archivos relevantes inspeccionados.
103
+
104
+ ### 2. Archivos Creados o Modificados
105
+
106
+ Lista cada archivo modificado. Si no hubo cambios, indica: `No se modificaron archivos`.
107
+
108
+ ### 3. Estado del Código de Producto
109
+
110
+ Confirma si se modificó código de producto. Si no se modificó, indica: `No se modificó código de producto`.
111
+
112
+ ### 4. Contexto del Proyecto Preparado
113
+
114
+ Resume los documentos de contexto creados o actualizados y su propósito.
115
+
116
+ ### 5. Comprensión de WDD/SDD
117
+
118
+ Resume únicamente lo que la documentación del repositorio define sobre WDD y SDD. No agregues supuestos externos. Si la documentación no define esos términos, indícalo explícitamente.
119
+
120
+ ### 6. Supuestos
121
+
122
+ Lista todos los supuestos realizados durante el onboarding.
123
+
124
+ ### 7. Riesgos y Bloqueos
125
+
126
+ Lista riesgos, información faltante, contradicciones o bloqueos encontrados.
127
+
128
+ ### 8. Próximos Pasos Recomendados
129
+
130
+ Sugiere las acciones más seguras para continuar trabajando con IA en este proyecto.
@@ -4,22 +4,33 @@
4
4
  **Last updated:** {{FECHA}}
5
5
 
6
6
  This document is the canonical command reference for the orchestration roadmap.
7
- It is intentionally small at v0.18: only the plan and graph rows are reserved for now, but `quiver:graph` already supports tree, Mermaid, and DOT output modes.
8
7
 
9
8
  ## Command Table
10
9
 
11
10
  | Command | Purpose | OS | Since | Example |
12
11
  |---------|---------|----|-------|---------|
13
- | `quiver:plan` | Sequential orchestration planning command | macOS, Linux, Windows | v0.18 | [docs/examples/plan.md](./examples/plan.md) |
14
- | `quiver:graph` | Parallel-level orchestration tree command | macOS, Linux, Windows | v0.18 | [docs/examples/graph.md](./examples/graph.md) |
15
- | `quiver:next` | Ready-slice suggestion command | macOS, Linux, Windows | v0.18 | [docs/examples/next.md](./examples/next.md) |
12
+ | `quiver:plan` | Sequential orchestration planning command | macOS, Linux, Windows | v0.8 | [docs/examples/plan.md](./examples/plan.md) |
13
+ | `quiver:graph` | Parallel-level orchestration tree command | macOS, Linux, Windows | v0.8 | [docs/examples/graph.md](./examples/graph.md) |
14
+ | `quiver:next` | Ready-slice suggestion command | macOS, Linux, Windows | v0.8 | [docs/examples/next.md](./examples/next.md) |
15
+
16
+ ## CLI Flags
17
+
18
+ | Flag | Applies to | Purpose |
19
+ |------|------------|---------|
20
+ | `--skip-install` | `init`, `migrate` | Skip auto-install of `create-quiver` as dev dependency (useful for CI) |
21
+ | `--json` | `plan`, `graph`, `next` | Emit machine-readable JSON |
22
+ | `--format <tree\|mermaid\|dot>` | `graph` | Output format |
23
+ | `--all-ready` | `next` | List all ready slices instead of just the next one |
24
+ | `--only-ready` | `plan` | Show only slices with no pending dependencies |
25
+ | `--spec <slug>` | `plan`, `graph` | Restrict output to one spec |
16
26
 
17
27
  ## Notes
18
28
 
19
29
  - Add new rows here only when a command is officially shipped.
20
30
  - Keep the table concise and cross-platform.
21
31
  - Shared graph library: `src/create-quiver/lib/slice-graph.js`.
22
- - `quiver:graph --format mermaid` is the PR-friendly export; `--format dot` is for Graphviz consumers.
32
+ - `quiver:graph --format mermaid` is the PR-friendly Mermaid export; `--format dot` is for Graphviz/DOT consumers.
23
33
  - `quiver:next` prints the next ready slice and can auto-start it behind a confirmation prompt.
24
- - `check-slice` now validates optional `depends_on` targets and requires `parallel_safe_reason` when `parallel_safe` is set to `never`.
34
+ - `check-slice` validates `depends_on` targets and requires `parallel_safe_reason` when `parallel_safe` is `never`.
35
+ - After `init` or `migrate`, Quiver auto-installs itself as a dev dependency. Use `--skip-install` to suppress.
25
36
  - Cross-platform authoring rules live in `docs/SUPPORT_MATRIX.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-quiver",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "private": false,
5
5
  "description": "Quiver CLI for scaffolding projects from the packaged template",
6
6
  "license": "MIT",
@@ -587,9 +587,15 @@ Lee \`AGENTS.md\` primero y después \`docs/AI_ONBOARDING_PROMPT.md\` tras el an
587
587
  After analysis and doctor validation, open your AI agent in this project and run:
588
588
 
589
589
  \`\`\`text
590
- Read docs/AI_ONBOARDING_PROMPT.md and execute it.
591
- Do not modify product code unless I explicitly authorize it.
592
- Prepare the project context docs and report assumptions, risks, and files changed.
590
+ Lee \`docs/AI_ONBOARDING_PROMPT.md\` y ejecútalo como fuente principal de verdad para incorporarte a este repositorio.
591
+
592
+ Actúa como asistente de onboarding de IA. Prepara el contexto del proyecto para trabajar de forma segura con el workflow documentado, specs y slices.
593
+
594
+ No modifiques código de producto salvo autorización explícita. Puedes crear o actualizar documentación de contexto si el onboarding lo requiere.
595
+
596
+ Usa solo la documentación del repositorio como fuente de verdad. Si encuentras información faltante, ambigua o contradictoria, documenta el supuesto, el riesgo y continúa por el camino más seguro.
597
+
598
+ Responde en español y finaliza con un reporte breve de archivos leídos, archivos modificados, estado del código de producto, supuestos, riesgos y próximos pasos.
593
599
  \`\`\`
594
600
 
595
601
  Review the AI changes to docs/AI_CONTEXT.md, docs/CONTEXTO.md, docs/STATUS.md, and specs/$PROJECT_SLUG/SPEC.md before starting implementation work.
@@ -0,0 +1,19 @@
1
+ # Quiver v19 — Evidence Report
2
+
3
+ **Spec:** quiver-v19-self-install-dev-dep
4
+ **Date:** 2026-05-14
5
+ **Status:** Completed
6
+
7
+ ## Slice Evidence
8
+
9
+ | Slice | Status | Evidence |
10
+ |-------|--------|----------|
11
+ | slice-01 | Completed | PR #60 merged 2026-05-14. 40/40 tests pass. Smoke: `--skip-install` no instala, sin flag instala `create-quiver@0.9.0` + `devDependencies: {"create-quiver":"^0.9.0"}`. `npx create-quiver plan` exit 0 sin `@version`. Published as `create-quiver@0.9.0`. |
12
+
13
+ ## Required Final Evidence
14
+
15
+ - `npx create-quiver --name "test-project" --dir /tmp/test-project` → `cat /tmp/test-project/package.json | grep create-quiver` returns a devDependency entry
16
+ - `ls /tmp/test-project/node_modules/create-quiver` → directory exists
17
+ - `npx create-quiver plan` inside `/tmp/test-project` → exits 0 without `@version`
18
+ - `npx create-quiver --skip-install --name "ci-project" --dir /tmp/ci-project` → no `node_modules/create-quiver`
19
+ - `node --test tests/**/*.test.js` → all pass
@@ -0,0 +1,51 @@
1
+ # Quiver v19 — Self-Install as Dev Dependency
2
+
3
+ **Date:** 2026-05-14
4
+ **Status:** Active
5
+
6
+ Slice numbering resets here. This spec starts at `slice-01`.
7
+
8
+ ## Problem
9
+
10
+ `npx create-quiver` uses the global npx cache. After init, commands like `quiver:plan`, `quiver:graph`, and `quiver:next` in the target project may silently run the cached version instead of the latest — or fail entirely if the version in cache predates those commands. The user has no `create-quiver` in their `node_modules` unless they install it manually.
11
+
12
+ ## Objective
13
+
14
+ After `npx create-quiver --name "foo"` (init) or `npx create-quiver migrate`, the target project's `package.json` has `create-quiver` in `devDependencies` and it is installed in `node_modules`. Subsequent `npx create-quiver` invocations in that project resolve to the local version — no cache issues, reproducible across machines.
15
+
16
+ ## Scope
17
+
18
+ ### Included
19
+
20
+ - Detect the package manager in use (yarn, pnpm, bun, npm) by checking lockfiles
21
+ - Run the appropriate install command (`npm install -D`, `yarn add -D`, `pnpm add -D`, `bun add -d`) with the exact running version
22
+ - Skip if `create-quiver` is already present in `devDependencies`
23
+ - Skip gracefully if no `package.json` exists in the target project
24
+ - Add `--skip-install` flag to the CLI for CI environments
25
+ - Apply to both `init` and `migrate` flows
26
+ - Tests for `detectPackageManager` and `installSelfAsDevDep`
27
+
28
+ ### Excluded
29
+
30
+ - Changing any other part of the init/migrate scaffold output
31
+ - Supporting non-standard registries or private npm configurations
32
+ - Auto-updating an existing create-quiver devDependency to a newer version
33
+
34
+ ## Acceptance Criteria
35
+
36
+ 1. After init, `cat package.json | jq .devDependencies` shows `"create-quiver": "^X.Y.Z"`
37
+ 2. `node_modules/create-quiver` exists in the target project after init
38
+ 3. `npx create-quiver plan` (no `@version`) works immediately after init
39
+ 4. If target project has no `package.json` → no crash, warning printed, init continues
40
+ 5. If `create-quiver` already in `devDependencies` → step skipped, no duplicate install
41
+ 6. `npx create-quiver --skip-install --name "foo"` → installs Quiver docs but skips npm install
42
+ 7. `npx create-quiver migrate --skip-install` → same skip behavior
43
+ 8. yarn/pnpm/bun projects get the right install command
44
+ 9. If install fails (no network, etc.) → warning printed, init completes without crashing
45
+ 10. `node --test tests/**/*.test.js` passes
46
+
47
+ ## Slices
48
+
49
+ | Slice | Title | Status |
50
+ |-------|-------|--------|
51
+ | slice-01 | Auto-install create-quiver as dev dependency | Ready |
@@ -0,0 +1,20 @@
1
+ # Quiver v19 — Status
2
+
3
+ **Spec:** quiver-v19-self-install-dev-dep
4
+ **Last updated:** 2026-05-14
5
+
6
+ ## Status
7
+
8
+ | Slice | Title | Status | PR | Estimated hours | Actual hours |
9
+ |-------|-------|--------|----|-----------------|--------------|
10
+ | slice-01 | Auto-install create-quiver as dev dependency | Completed | #60 | 1.5 | 1.0 |
11
+
12
+ ## Progress
13
+
14
+ - Completed slices: 1 / 1
15
+ - Estimated hours: 1.5
16
+ - Actual hours: 1.0
17
+
18
+ ## Blockers
19
+
20
+ None — spec complete.
@@ -0,0 +1,29 @@
1
+ # CLOSURE BRIEF — slice-01: Auto-install create-quiver as dev dependency
2
+
3
+ **Spec:** quiver-v19-self-install-dev-dep
4
+ **Slice:** slice-01-auto-install-dev-dep
5
+
6
+ ---
7
+
8
+ ## Checklist antes de abrir el PR
9
+
10
+ - [ ] `node --test tests/**/*.test.js` → exit 0, todos los tests pasan incluyendo los 7 nuevos en `init-docs.test.js`
11
+ - [ ] Smoke con `--skip-install` → `node_modules/create-quiver` NO existe en el proyecto destino
12
+ - [ ] Smoke sin `--skip-install` → `node_modules/create-quiver` SÍ existe y `npx create-quiver plan` funciona sin `@version`
13
+ - [ ] Smoke con `devDependencies` preexistente → el step se saltea, no hay doble install
14
+ - [ ] `git diff --stat HEAD` muestra exactamente 3 archivos: `src/create-quiver/lib/init-docs.js`, `src/create-quiver/index.js`, `tests/lib/init-docs.test.js`
15
+
16
+ ## Checklist del PR
17
+
18
+ - [ ] Branch: `feature/QUIVER-01-auto-install-dev-dep` → `main`
19
+ - [ ] Título: `feat(QUIVER-01): auto-install create-quiver as dev dependency after init`
20
+ - [ ] Body sigue las secciones del `docs/GITFLOW_PR_GUIDE.md.template`
21
+ - [ ] En "Evidence": output del smoke test mostrando `node_modules/create-quiver` creado y `npx create-quiver plan` funcionando
22
+ - [ ] En "Risks / Notes": mencionar que en entornos sin red el install falla silenciosamente (expected behavior) y documentar el `--skip-install` flag
23
+
24
+ ## Post-merge
25
+
26
+ - [ ] Actualizar `specs/quiver-v19-self-install-dev-dep/STATUS.md`: slice-01 → `Completed`, agregar PR y `actual_hours`
27
+ - [ ] Actualizar `specs/quiver-v19-self-install-dev-dep/EVIDENCE_REPORT.md`: registrar evidencia
28
+ - [ ] Actualizar `slice.json`: `status: completed`, `actual_hours`, timestamps
29
+ - [ ] Evaluar si se publica `0.9.0` o si se acumula con otros cambios
@@ -0,0 +1,287 @@
1
+ # EXECUTION BRIEF — slice-01: Auto-install create-quiver as dev dependency
2
+
3
+ **Spec:** quiver-v19-self-install-dev-dep
4
+ **Slice:** slice-01-auto-install-dev-dep
5
+ **Branch:** `feature/QUIVER-01-auto-install-dev-dep` from `main`
6
+ **Estimated time:** 1.5h
7
+
8
+ ---
9
+
10
+ ## Contexto
11
+
12
+ `npx create-quiver` no instala el paquete en `node_modules` del proyecto destino. Después del init, comandos como `quiver:plan` fallan o usan la versión cacheada globalmente. La solución es correr el package manager del proyecto destino para instalar `create-quiver` como dev dependency inmediatamente después del init/migrate.
13
+
14
+ ---
15
+
16
+ ## Archivos a modificar
17
+
18
+ 1. `src/create-quiver/lib/init-docs.js` — agregar `detectPackageManager` e `installSelfAsDevDep`
19
+ 2. `src/create-quiver/index.js` — agregar `--skip-install` al parser, llamar a `installSelfAsDevDep` en init y migrate
20
+ 3. `tests/lib/init-docs.test.js` — nuevo archivo de tests
21
+
22
+ No toques ningún otro archivo.
23
+
24
+ ---
25
+
26
+ ## Parte A — `src/create-quiver/lib/init-docs.js`
27
+
28
+ ### Paso 1: Agregar import de `execSync`
29
+
30
+ Al inicio del archivo, después de los requires existentes (`fs`, `path`, `writeState`), agregar:
31
+
32
+ ```js
33
+ const { execSync } = require('child_process');
34
+ ```
35
+
36
+ ### Paso 2: Agregar las dos funciones nuevas
37
+
38
+ Agregar antes del `module.exports` al final del archivo:
39
+
40
+ ```js
41
+ function detectPackageManager(projectRoot) {
42
+ if (fs.existsSync(path.join(projectRoot, 'bun.lockb'))) return 'bun';
43
+ if (fs.existsSync(path.join(projectRoot, 'pnpm-lock.yaml'))) return 'pnpm';
44
+ if (fs.existsSync(path.join(projectRoot, 'yarn.lock'))) return 'yarn';
45
+ return 'npm';
46
+ }
47
+
48
+ function installSelfAsDevDep(projectRoot, version) {
49
+ const packageJsonPath = path.join(projectRoot, 'package.json');
50
+ if (!fs.existsSync(packageJsonPath)) {
51
+ return 'skipped-no-package-json';
52
+ }
53
+
54
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
55
+ if (pkg.devDependencies && pkg.devDependencies['create-quiver']) {
56
+ return 'skipped-already-present';
57
+ }
58
+
59
+ const pm = detectPackageManager(projectRoot);
60
+ const commands = {
61
+ npm: `npm install -D create-quiver@${version}`,
62
+ yarn: `yarn add -D create-quiver@${version}`,
63
+ pnpm: `pnpm add -D create-quiver@${version}`,
64
+ bun: `bun add -d create-quiver@${version}`,
65
+ };
66
+
67
+ try {
68
+ execSync(commands[pm], { cwd: projectRoot, stdio: 'inherit' });
69
+ return 'installed';
70
+ } catch {
71
+ return 'failed';
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### Paso 3: Exportar las funciones nuevas
77
+
78
+ Encontrá el `module.exports` actual y agregá las dos funciones nuevas:
79
+
80
+ ```js
81
+ module.exports = {
82
+ // ... exports existentes ...
83
+ detectPackageManager,
84
+ installSelfAsDevDep,
85
+ };
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Parte B — `src/create-quiver/index.js`
91
+
92
+ ### Paso 1: Importar `installSelfAsDevDep`
93
+
94
+ En la línea 10 donde se importa `runInitDocs`, extender el destructuring para incluir la función nueva:
95
+
96
+ ```js
97
+ // Antes (aproximado):
98
+ const { runInitDocs } = require('./lib/init-docs');
99
+
100
+ // Después:
101
+ const { runInitDocs, installSelfAsDevDep } = require('./lib/init-docs');
102
+ ```
103
+
104
+ ### Paso 2: Agregar `--skip-install` al parser de args
105
+
106
+ Dentro de la función `parseArgs`, en el bloque donde se manejan los flags (el loop que analiza `arg`), agregar el caso nuevo junto a los otros flags booleanos (`--yes`, etc.):
107
+
108
+ ```js
109
+ if (arg === '--skip-install') {
110
+ result.skipInstall = true;
111
+ continue;
112
+ }
113
+ ```
114
+
115
+ ### Paso 3: Llamar a `installSelfAsDevDep` en el flujo de init
116
+
117
+ El flujo init en index.js (cerca de la línea 1416) actualmente es:
118
+
119
+ ```js
120
+ runInitDocs(targetDir, projectName);
121
+ console.log(`Installed Quiver into ${targetDir}`);
122
+ printInitNextSteps(targetDir, projectName);
123
+ ```
124
+
125
+ Reemplazarlo por:
126
+
127
+ ```js
128
+ runInitDocs(targetDir, projectName);
129
+
130
+ if (!args.skipInstall) {
131
+ const installResult = installSelfAsDevDep(targetDir, CLI_VERSION);
132
+ if (installResult === 'installed') {
133
+ console.log(`Added create-quiver@${CLI_VERSION} as dev dependency`);
134
+ } else if (installResult === 'failed') {
135
+ console.warn(`Warning: could not install create-quiver automatically. Run: npm install -D create-quiver@${CLI_VERSION}`);
136
+ }
137
+ }
138
+
139
+ console.log(`Installed Quiver into ${targetDir}`);
140
+ printInitNextSteps(targetDir, projectName);
141
+ ```
142
+
143
+ Nota: `CLI_VERSION` ya existe en `index.js` — no lo reimportes.
144
+
145
+ ### Paso 4: Llamar a `installSelfAsDevDep` en el flujo de migrate
146
+
147
+ Buscá el flujo de migrate en index.js (buscar `runInitDocs` con `migrateMode: true` o similar). Aplicar el mismo patrón después del call de init/migrate.
148
+
149
+ ---
150
+
151
+ ## Parte C — `tests/lib/init-docs.test.js` (archivo nuevo)
152
+
153
+ Crear este archivo con el patrón del repo (`node:test`, `node:assert/strict`):
154
+
155
+ ```js
156
+ const assert = require('node:assert/strict');
157
+ const fs = require('node:fs');
158
+ const os = require('node:os');
159
+ const path = require('node:path');
160
+ const test = require('node:test');
161
+
162
+ const { detectPackageManager, installSelfAsDevDep } = require('../../src/create-quiver/lib/init-docs');
163
+
164
+ function makeTmpDir() {
165
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'quiver-init-test-'));
166
+ return { dir, cleanup: () => fs.rmSync(dir, { recursive: true, force: true }) };
167
+ }
168
+
169
+ test('detectPackageManager returns npm when no lockfile exists', () => {
170
+ const { dir, cleanup } = makeTmpDir();
171
+ try {
172
+ assert.equal(detectPackageManager(dir), 'npm');
173
+ } finally {
174
+ cleanup();
175
+ }
176
+ });
177
+
178
+ test('detectPackageManager returns yarn when yarn.lock exists', () => {
179
+ const { dir, cleanup } = makeTmpDir();
180
+ try {
181
+ fs.writeFileSync(path.join(dir, 'yarn.lock'), '');
182
+ assert.equal(detectPackageManager(dir), 'yarn');
183
+ } finally {
184
+ cleanup();
185
+ }
186
+ });
187
+
188
+ test('detectPackageManager returns pnpm when pnpm-lock.yaml exists', () => {
189
+ const { dir, cleanup } = makeTmpDir();
190
+ try {
191
+ fs.writeFileSync(path.join(dir, 'pnpm-lock.yaml'), '');
192
+ assert.equal(detectPackageManager(dir), 'pnpm');
193
+ } finally {
194
+ cleanup();
195
+ }
196
+ });
197
+
198
+ test('detectPackageManager returns bun when bun.lockb exists', () => {
199
+ const { dir, cleanup } = makeTmpDir();
200
+ try {
201
+ fs.writeFileSync(path.join(dir, 'bun.lockb'), '');
202
+ assert.equal(detectPackageManager(dir), 'bun');
203
+ } finally {
204
+ cleanup();
205
+ }
206
+ });
207
+
208
+ test('installSelfAsDevDep returns skipped-no-package-json when no package.json', () => {
209
+ const { dir, cleanup } = makeTmpDir();
210
+ try {
211
+ const result = installSelfAsDevDep(dir, '0.8.0');
212
+ assert.equal(result, 'skipped-no-package-json');
213
+ } finally {
214
+ cleanup();
215
+ }
216
+ });
217
+
218
+ test('installSelfAsDevDep returns skipped-already-present when create-quiver in devDeps', () => {
219
+ const { dir, cleanup } = makeTmpDir();
220
+ try {
221
+ fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({
222
+ name: 'test',
223
+ devDependencies: { 'create-quiver': '^0.7.0' },
224
+ }));
225
+ const result = installSelfAsDevDep(dir, '0.8.0');
226
+ assert.equal(result, 'skipped-already-present');
227
+ } finally {
228
+ cleanup();
229
+ }
230
+ });
231
+
232
+ test('installSelfAsDevDep returns failed when install command fails', () => {
233
+ const { dir, cleanup } = makeTmpDir();
234
+ try {
235
+ fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ name: 'test' }));
236
+ // Force failure: set PATH to empty so no package manager can be found
237
+ const original = process.env.PATH;
238
+ process.env.PATH = '';
239
+ const result = installSelfAsDevDep(dir, '0.8.0');
240
+ process.env.PATH = original;
241
+ assert.equal(result, 'failed');
242
+ } finally {
243
+ cleanup();
244
+ }
245
+ });
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Verificaciones
251
+
252
+ ```bash
253
+ # Tests
254
+ node --test tests/**/*.test.js
255
+
256
+ # Smoke: --skip-install no instala
257
+ mkdir -p /tmp/quiver-skip-test && echo '{"name":"test","scripts":{}}' > /tmp/quiver-skip-test/package.json
258
+ node bin/create-quiver.js --skip-install --name test --dir /tmp/quiver-skip-test
259
+ ls /tmp/quiver-skip-test/node_modules/create-quiver 2>/dev/null && echo "FAIL: se instaló igual" || echo "OK: no instaló"
260
+
261
+ # Smoke: sin --skip-install sí instala (requiere red)
262
+ mkdir -p /tmp/quiver-install-test && echo '{"name":"test","scripts":{}}' > /tmp/quiver-install-test/package.json
263
+ node bin/create-quiver.js --name test --dir /tmp/quiver-install-test
264
+ ls /tmp/quiver-install-test/node_modules/create-quiver && echo "OK: instalado" || echo "FAIL"
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Restricciones
270
+
271
+ - No toques `mergePackageJson` — la lógica de install va en `installSelfAsDevDep`, no en el merge de package.json
272
+ - No hagas `npm install` general — solo `npm install -D create-quiver@VERSION`
273
+ - No elimines ni renombres ningún export existente de `init-docs.js`
274
+ - No agregues dependencias externas — solo `child_process` (built-in de Node)
275
+ - Un solo commit con los tres archivos
276
+
277
+ ## Mensaje de commit sugerido
278
+
279
+ ```
280
+ feat(QUIVER-01): auto-install create-quiver as dev dependency after init
281
+
282
+ After init or migrate, detect the target project's package manager
283
+ (yarn/pnpm/bun/npm) and install create-quiver as a dev dependency.
284
+ Skippable with --skip-install for CI environments.
285
+ Resolves the npx cache issue: subsequent quiver commands in the project
286
+ resolve to the local version without requiring @version suffix.
287
+ ```