create-quiver 0.17.4 → 0.17.5

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/docs/CLI_UX_GUIDE.md +7 -0
  3. package/docs/TROUBLESHOOTING.md +10 -0
  4. package/docs/reference/commands.md +13 -0
  5. package/package.json +1 -1
  6. package/specs/quiver-v56-analyze-project-usable-doc-merge/EVIDENCE_REPORT.md +11 -0
  7. package/specs/quiver-v56-analyze-project-usable-doc-merge/EXECUTION_PLAN.md +28 -0
  8. package/specs/quiver-v56-analyze-project-usable-doc-merge/SPEC.md +96 -0
  9. package/specs/quiver-v56-analyze-project-usable-doc-merge/STATUS.md +26 -0
  10. package/specs/quiver-v56-analyze-project-usable-doc-merge/pr.md +56 -0
  11. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/CLOSURE_BRIEF.md +61 -0
  12. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/EXECUTION_BRIEF.md +59 -0
  13. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/pr.md +61 -0
  14. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/slice.json +71 -0
  15. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/CLOSURE_BRIEF.md +30 -0
  16. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/EXECUTION_BRIEF.md +39 -0
  17. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/pr.md +62 -0
  18. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/slice.json +80 -0
  19. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/CLOSURE_BRIEF.md +29 -0
  20. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/EXECUTION_BRIEF.md +32 -0
  21. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/pr.md +61 -0
  22. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/slice.json +79 -0
  23. package/src/create-quiver/commands/ai.js +36 -1
  24. package/src/create-quiver/lib/ai/analyze-project-docs.js +284 -4
  25. package/src/create-quiver/lib/ai/analyze-project-proposal.js +11 -0
  26. package/src/create-quiver/lib/ai/analyze-project-validation.js +26 -0
package/CHANGELOG.md CHANGED
@@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file.
28
28
 
29
29
  ### Changed
30
30
 
31
+ - `ai analyze-project` human output now reports compact merge decisions so users can see scaffold replacement, human-content preservation, old `context-prep` cleanup, and warnings without opening manifests.
31
32
  - Existing-project docs now recommend the simple `--apply-docs` flow instead of forcing users into the advanced `--review` editor path.
32
33
  - English and Spanish CLI help now explain analyze-project docs apply options while preserving commands, flags, paths, providers, and model ids exactly.
33
34
  - `ai analyze-project --deep` now builds safer provider context by summarizing lockfiles as metadata, excluding generated/runtime directories, and prioritizing product source over Quiver-generated docs.
@@ -48,6 +49,7 @@ All notable changes to this project will be documented in this file.
48
49
 
49
50
  ### Fixed
50
51
 
52
+ - `ai analyze-project` now replaces visible Quiver scaffold placeholders and old template `context-prep` blocks when a valid project proposal is available, with nika-erp style regression coverage for `NIKA_ERP`/`stockflow`/`StockFlow` naming conflicts.
51
53
  - `ai analyze-project --deep` now repairs common safe provider schema drift, retries with compact schema feedback, records redacted raw artifacts, and fails closed without final doc writes when JSON remains invalid.
52
54
  - `doctor --fix` now gives an actionable repair path for existing `AGENTS.md` files that are missing Quiver contract sections while preserving manual content.
53
55
  - `ai analyze-project` now shows human TTY progress while provider analysis runs and reports schema validation issues with actionable detail.
@@ -139,6 +139,13 @@ Opciones de aplicacion:
139
139
  - `ai analyze-project apply --run <run-id>` aplica una propuesta guardada sin ejecutar proveedor ni requerir `--provider` o `--model`.
140
140
  - `--review` se mantiene como modo avanzado: abre la propuesta JSON en editor y revalida el JSON editado antes de escribir.
141
141
 
142
+ Feedback de merge:
143
+
144
+ - Cuando hay docs modificados, la salida humana muestra `Merge decisions`.
145
+ - Cada item informa estrategia, clasificacion, placeholders reemplazados, contenido humano preservado y bloques `context-prep` removidos cuando aplica.
146
+ - La salida debe ser compacta; el detalle auditable queda en `.quiver/runs/<run-id>/proposal/manifest.json` y `.quiver/runs/<run-id>/writes/analyze-project-doc-writes.json`.
147
+ - Conflictos de nombres o facts se muestran en `Post-write validation` como warnings o errores con `--strict`.
148
+
142
149
  Modo deterministico:
143
150
 
144
151
  ```bash
@@ -147,6 +147,14 @@ los docs finales siguen con placeholders o falta `docs/ARCHITECTURE.md`.
147
147
 
148
148
  En versiones actuales, ese comando debe escribir documentación final validada. Si los docs siguen con placeholders, el flujo se bloqueó antes de escribir o la propuesta IA no incluyó contenido útil para esos paths.
149
149
 
150
+ Quiver clasifica cada doc antes de escribir:
151
+
152
+ - `scaffold`: reemplaza el contenido visible de template y conserva frontmatter válido.
153
+ - `partial_scaffold` o `mixed`: elimina placeholders críticos, conserva contenido humano real y consolida bloques gestionados.
154
+ - `human_content`: conserva el contenido humano y agrega/actualiza el bloque `quiver:analyze-project`.
155
+
156
+ Los bloques antiguos `quiver:context-prep` que todavía contienen placeholders se eliminan durante `analyze-project` para que no compitan con el contexto nuevo. Si hay conflicto de nombres, por ejemplo `NIKA_ERP`, `stockflow` y `StockFlow`, Quiver lo reporta como warning o error en `--strict` en vez de ocultarlo.
157
+
150
158
  ### Qué hacer
151
159
 
152
160
  Revisá el error mostrado y los artifacts del run. Los caminos seguros son:
@@ -160,3 +168,5 @@ npx --yes create-quiver@latest ai analyze-project apply --run <run-id>
160
168
  - el comando normal aplica docs después de validar JSON, proposal, snapshot y post-write;
161
169
  - `--save-proposal` guarda `.quiver/runs/<run-id>/proposal/*` sin tocar docs finales.
162
170
  - `apply --run <run-id>` aplica una propuesta guardada sin ejecutar proveedor ni pedir `--provider` o `--model`.
171
+
172
+ Si venís de una versión anterior y tus docs tienen placeholders arriba y un bloque `quiver:analyze-project` útil abajo, volvé a ejecutar el comando normal. La salida debe mostrar `Merge decisions`, el strategy aplicado, si reemplazó scaffold, si preservó contenido humano y si removió `context-prep`.
@@ -206,6 +206,16 @@ npx --yes create-quiver@latest ai analyze-project apply --run <run-id>
206
206
 
207
207
  El modo con proveedor exige JSON validado por schema, evidencia por conclusión, niveles `confirmed`, `inferred`, `unknown` o `conflict`, artifacts auditados en `.quiver/runs`, diff, snapshot previo cuando se escribe y validación post-write. `--strict` convierte conflictos importantes de docs en error. El resultado puede quedar como `unknown` o `needs_confirmation` cuando el código no prueba una conclusión.
208
208
 
209
+ Al escribir docs, Quiver no pega la respuesta del proveedor sin más. Primero clasifica el contenido existente y aplica un merge determinístico:
210
+
211
+ - reemplaza scaffolds con placeholders críticos en español o inglés;
212
+ - preserva contenido humano real;
213
+ - reemplaza un bloque `quiver:analyze-project` previo en lugar de duplicarlo;
214
+ - remueve bloques `quiver:context-prep` viejos cuando todavía son template;
215
+ - reporta `Merge decisions` con estrategia, placeholders reemplazados, contenido humano preservado y warnings.
216
+
217
+ Los conflictos de nombres o facts, por ejemplo `NIKA_ERP`, `stockflow` y `StockFlow`, se reportan en la validación post-write. En modo normal aparecen como warnings; con `--strict` bloquean la ejecución.
218
+
209
219
  Garantías del flujo con proveedor:
210
220
 
211
221
  - `--dry-run` no escribe archivos ni ejecuta proveedor.
@@ -223,6 +233,7 @@ Garantías del flujo con proveedor:
223
233
  - `ai analyze-project apply --run <run-id>` aplica una propuesta guardada sin ejecutar proveedor ni requerir `--provider` o `--model`.
224
234
  - `--review` queda como modo avanzado para editar manualmente una propuesta JSON antes de escribir.
225
235
  - Las escrituras aprobadas crean snapshot con hashes y se escriben con rename atómico.
236
+ - El write manifest guarda `merge_report` por archivo y el proposal manifest guarda `merge_plan` para auditoría.
226
237
 
227
238
  Benchmark recomendado:
228
239
 
@@ -252,6 +263,8 @@ Evidencia esperada:
252
263
  - `--save-proposal` debe crear `.quiver/runs/<run-id>/proposal/*` sin modificar docs finales.
253
264
  - `--apply-docs` debe mostrar selector explicado en TTY o requerir `--yes` en automatización.
254
265
  - `apply --run <run-id>` debe aplicar la propuesta guardada sin volver a ejecutar proveedor.
266
+ - La salida humana debe mostrar `Merge decisions` cuando haya docs modificados.
267
+ - En fixtures tipo `nika-erp`, `docs/CONTEXTO.md` no debe conservar placeholders visibles ni bloques `quiver:context-prep` de template después de aplicar.
255
268
 
256
269
  Rollback de release:
257
270
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-quiver",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "private": false,
5
5
  "description": "Quiver CLI for scaffolding projects from the packaged template",
6
6
  "license": "MIT",
@@ -0,0 +1,11 @@
1
+ # Evidence Report - Quiver v56 Analyze Project Usable Doc Merge
2
+
3
+ Evidence is recorded per slice closure.
4
+
5
+ ## Slice Evidence
6
+
7
+ | Slice | Evidence |
8
+ |---|---|
9
+ | slice-01-document-classification-merge-engine | `node --test tests/lib/ai-analyze-project-docs.test.js`; `node --test tests/commands/ai-analyze-project-provider.test.js`; `node --test tests/commands/ai-analyze-project-review.test.js`; `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`; `git diff --check` |
10
+ | slice-02-apply-integration-validation-contract | `node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js`; `node --test tests/lib/ai-analyze-project-docs.test.js tests/lib/ai-analyze-project-validation.test.js`; `node --test tests/lib/ai-analyze-project-proposal.test.js`; `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`; `git diff --check` |
11
+ | slice-03-cli-docs-real-fixture-smoke | `node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js`; `npm run docs:check`; `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`; `git diff --check` |
@@ -0,0 +1,28 @@
1
+ # Execution Plan - Quiver v56 Analyze Project Usable Doc Merge
2
+
3
+ ## Order
4
+
5
+ 1. `slice-01-document-classification-merge-engine`
6
+ 2. `slice-02-apply-integration-validation-contract`
7
+ 3. `slice-03-cli-docs-real-fixture-smoke`
8
+
9
+ ## Parallelism
10
+
11
+ - Slice 01 is sequential and blocks everything else.
12
+ - Slice 02 is sequential after Slice 01.
13
+ - Slice 03 docs can draft after Slice 01, but final smoke and output validation depend on Slice 02.
14
+
15
+ ## PR Strategy
16
+
17
+ - PR 1: Slice 01.
18
+ - PR 2: Slice 02.
19
+ - PR 3: Slice 03.
20
+
21
+ ## Validation Gates
22
+
23
+ Each PR must run its focused tests plus:
24
+
25
+ ```bash
26
+ git diff --check
27
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
28
+ ```
@@ -0,0 +1,96 @@
1
+ # Quiver v56 - Analyze Project Usable Doc Merge
2
+
3
+ **Date:** 2026-06-17
4
+ **Status:** Completed
5
+ **Source:** User-approved requirement, production review, stricter second-pass review, and execution plan for `ai analyze-project` usable documentation output.
6
+
7
+ ## Problem
8
+
9
+ `ai analyze-project --deep --provider codex --model gpt-5.5` now writes documentation by default, but real projects can still end with unusable docs. In `nika-erp`, Quiver wrote a valid `quiver:analyze-project` block, but preserved scaffold placeholders at the top of `docs/CONTEXTO.md`, plus an older `quiver:context-prep` block. The command reported success even though the first visible content still looked unmodified.
10
+
11
+ ## Objective
12
+
13
+ Make analyze-project doc writes produce usable human-facing context files by applying a deterministic documentation merge contract:
14
+
15
+ ```text
16
+ classify existing doc -> merge by classification -> preserve real human content -> replace scaffold placeholders -> consolidate managed blocks -> validate visible output
17
+ ```
18
+
19
+ ## Scope
20
+
21
+ ### Included
22
+
23
+ - Document classification contract for scaffold, partial scaffold, human content, managed-only, mixed, and unknown docs.
24
+ - Deterministic merge strategy for `docs/CONTEXTO.md`, `docs/AI_CONTEXT.md`, and `docs/ARCHITECTURE.md`.
25
+ - Critical placeholder detection in English and Spanish.
26
+ - Idempotent managed block replacement.
27
+ - Safe handling of old `quiver:context-prep` blocks.
28
+ - Integration with live apply, saved proposal apply, review, JSON, and strict validation.
29
+ - Human output, manifests, docs, troubleshooting, and nika-erp regression fixture/smoke.
30
+
31
+ ### Excluded
32
+
33
+ - Product-code changes in analyzed repositories.
34
+ - Writing outside the existing analyze-project documentation allowlist.
35
+ - Automatic spec generation from project analysis.
36
+ - Relaxing provider schema validation.
37
+ - Translating technical evidence or provider claims semantically.
38
+
39
+ ## Requirements
40
+
41
+ 1. Quiver must not preserve critical scaffold placeholders as primary visible content when a valid proposal can replace them.
42
+ 2. Quiver must not delete real human content without preserving it or reporting a warning.
43
+ 3. Existing frontmatter must be preserved when it is parseable.
44
+ 4. If frontmatter is ambiguous, Quiver must preserve it and warn.
45
+ 5. `quiver:analyze-project` must be replaced in place on repeated runs, never duplicated.
46
+ 6. `quiver:context-prep` scaffold content must not remain as confusing primary content after analyze-project applies.
47
+ 7. The merge must be idempotent for the same proposal and input.
48
+ 8. `apply --run` and live provider apply must use the same merge engine.
49
+ 9. `--save-proposal` must persist a merge plan or enough metadata to preview the eventual write result.
50
+ 10. `--review` must show the final post-merge diff, not only raw provider Markdown.
51
+ 11. `--json` must expose merge strategy and warnings without removing existing fields.
52
+ 12. `--strict` must fail when critical placeholders remain in primary visible content.
53
+ 13. Name conflicts such as `NIKA_ERP`, `stockflow`, and `StockFlow` must be reported, not silently hidden.
54
+
55
+ ## Classification Contract
56
+
57
+ | Classification | Condition | Action |
58
+ |---|---|---|
59
+ | `scaffold` | Quiver/template signals plus known placeholders, with no significant human text | Replace primary content while preserving frontmatter |
60
+ | `partial_scaffold` | Some sections are placeholder-only and other sections have human text | Replace placeholder sections and preserve completed sections |
61
+ | `human_content` | Significant non-placeholder text outside managed markers | Preserve human text and insert generated summary visibly |
62
+ | `managed_only` | File is empty or only contains Quiver managed blocks | Replace managed content |
63
+ | `mixed` | Human text plus Quiver blocks plus placeholders | Preserve human text, remove/replace scaffold portions, consolidate blocks |
64
+ | `unknown` | Not safely classifiable | Preserve content, insert generated block visibly, warn |
65
+
66
+ ## Slice Roadmap
67
+
68
+ | Slice | Title | Status | Dependencies | Parallel Guidance |
69
+ |---|---|---|---|---|
70
+ | slice-01-document-classification-merge-engine | Document Classification + Merge Engine | completed | none | sequential first |
71
+ | slice-02-apply-integration-validation-contract | Apply Integration + Validation Contract | completed | slice-01 | sequential after slice-01 |
72
+ | slice-03-cli-docs-real-fixture-smoke | CLI UX + Docs + Real Fixture Smoke | completed | slice-02 | final hardening; docs can draft after slice-01 |
73
+
74
+ ## Validation Strategy
75
+
76
+ ```bash
77
+ node --test tests/lib/ai-analyze-project-docs.test.js
78
+ node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js
79
+ npm run docs:check
80
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
81
+ git diff --check
82
+ ```
83
+
84
+ ## Production Guardrails
85
+
86
+ - Snapshot before writes remains mandatory.
87
+ - Writes remain atomic.
88
+ - Path allowlist remains unchanged.
89
+ - Provider output remains untrusted until schema validation passes.
90
+ - Merge decisions must be recorded in the write plan/report.
91
+ - Critical placeholder validation checks primary visible content, not only managed blocks.
92
+
93
+ ## Open Questions
94
+
95
+ - Whether `token_cost` should be recalculated immediately in v56 or deferred to a metadata cleanup.
96
+ - Whether old `context-prep` human notes should be moved into a named preserved section or only marked as superseded.
@@ -0,0 +1,26 @@
1
+ # Status - Quiver v56 Analyze Project Usable Doc Merge
2
+
3
+ **Status:** Completed
4
+ **Last updated:** 2026-06-17
5
+
6
+ ## Current State
7
+
8
+ The requirement, acceptance criteria, production review, second stricter review, and execution plan are approved. All slices are complete.
9
+
10
+ ## Slice Status
11
+
12
+ | Slice | Status | Notes |
13
+ |---|---|---|
14
+ | slice-01-document-classification-merge-engine | completed | Deterministic classification and merge engine implemented with unit and analyze-project flow tests. |
15
+ | slice-02-apply-integration-validation-contract | completed | Merge metadata is exposed in JSON/write reports, proposal/write manifests persist merge plan/report, review diff uses post-merge output, and strict validation fails visible scaffold placeholders. |
16
+ | slice-03-cli-docs-real-fixture-smoke | completed | Human output reports merge decisions, docs explain placeholder recovery, and deterministic nika-erp style fixture validates visible placeholder cleanup plus name-conflict warnings. |
17
+
18
+ ## Blockers
19
+
20
+ - None.
21
+
22
+ ## Next Command
23
+
24
+ ```bash
25
+ node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js
26
+ ```
@@ -0,0 +1,56 @@
1
+ ## Title
2
+
3
+ Quiver v56 analyze-project usable doc merge
4
+
5
+ ## Summary
6
+
7
+ Implements a deterministic document merge contract so `ai analyze-project` replaces scaffold placeholders, preserves real human content, consolidates managed blocks, and validates that final docs are usable.
8
+
9
+ ## PR Policy
10
+
11
+ Individual PRs by slice. Runtime behavior changes must not be grouped with unrelated docs-only work.
12
+
13
+ ## Scope
14
+
15
+ See the active slice `pr.md`.
16
+
17
+ ## Files
18
+
19
+ See the active slice `slice.json`.
20
+
21
+ ## How to Test (DETAILED - REQUIRED)
22
+
23
+ ### Required Environment
24
+
25
+ Node.js/npm and local checkout.
26
+
27
+ ### Worktree Access
28
+
29
+ Use the branch created for the active slice.
30
+
31
+ ### Run the Project
32
+
33
+ No dev server is required.
34
+
35
+ ### Use Cases
36
+
37
+ See active slice.
38
+
39
+ ### Technical Verification
40
+
41
+ ```bash
42
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
43
+ git diff --check
44
+ ```
45
+
46
+ ## Evidence
47
+
48
+ See active slice closure.
49
+
50
+ ## Rollback
51
+
52
+ Revert the slice PR.
53
+
54
+ ## Risks / Notes
55
+
56
+ This spec changes doc merge behavior for `ai analyze-project`; preserve snapshots and allowlist protections.
@@ -0,0 +1,61 @@
1
+ # CLOSURE_BRIEF - slice-01 Document Classification + Merge Engine
2
+
3
+ ## Summary
4
+
5
+ Implemented the Slice 01 merge engine contract for analyze-project docs.
6
+
7
+ The engine now:
8
+
9
+ - classifies existing docs as scaffold, partial scaffold, human content, managed-only, mixed, or unknown;
10
+ - detects known critical Quiver scaffold placeholders in English and Spanish;
11
+ - preserves parseable frontmatter;
12
+ - replaces scaffold primary content with proposed analyze-project content;
13
+ - preserves significant human content in partial/mixed docs;
14
+ - replaces existing `quiver:analyze-project` blocks without duplication;
15
+ - removes scaffold-only `quiver:context-prep` content when analyze-project content is applied;
16
+ - exposes `merge_report` metadata on write plan items;
17
+ - remains idempotent for the same proposal.
18
+
19
+ ## Evidence
20
+
21
+ ```bash
22
+ node --test tests/lib/ai-analyze-project-docs.test.js
23
+ ```
24
+
25
+ Result: 10 tests passed, 0 failed.
26
+
27
+ ```bash
28
+ node --test tests/commands/ai-analyze-project-provider.test.js
29
+ ```
30
+
31
+ Result: 23 tests passed, 0 failed.
32
+
33
+ ```bash
34
+ node --test tests/commands/ai-analyze-project-review.test.js
35
+ ```
36
+
37
+ Result: 20 tests passed, 0 failed.
38
+
39
+ ## Validation
40
+
41
+ ```bash
42
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
43
+ git diff --check
44
+ ```
45
+
46
+ Result: passed.
47
+
48
+ ## Acceptance Coverage
49
+
50
+ - Scaffold docs no longer keep critical placeholders as primary visible content: covered by `mergeAnalyzeProjectDoc replaces Spanish Quiver scaffold primary content`.
51
+ - Partial scaffold docs preserve completed human sections: covered by `mergeAnalyzeProjectDoc preserves completed human sections in partial scaffold`.
52
+ - Human docs preserve human text: covered by `mergeAnalyzeProjectDoc preserves human docs and replaces existing analyze-project block`.
53
+ - Existing analyze-project block is replaced in place: covered by unit test and provider/review command tests.
54
+ - Context-prep scaffold does not remain confusing primary content: covered by `mergeAnalyzeProjectDoc removes scaffold context-prep block when applying analyze-project content`.
55
+ - Same input/proposal is stable: covered by `mergeAnalyzeProjectDoc is idempotent for the same proposal`.
56
+ - Write plan items include classification/strategy metadata: covered by `write plan preserves human content and snapshot manifest records hashes`.
57
+
58
+ ## Risks / Follow-ups
59
+
60
+ - Slice 02 must wire this metadata into JSON/output and strict visible-placeholder validation.
61
+ - Slice 03 must add the nika-erp style fixture and user-facing docs/output polish.
@@ -0,0 +1,59 @@
1
+ # EXECUTION_BRIEF - slice-01 Document Classification + Merge Engine
2
+
3
+ ## Objective
4
+
5
+ Implement the deterministic merge engine for analyze-project docs.
6
+
7
+ ## Context
8
+
9
+ The current `mergeManagedBlock` preserves the whole document and appends/replaces only the `quiver:analyze-project` block. This leaves scaffold placeholders visible above generated content. Slice 01 must solve the core merge contract before any CLI/output integration.
10
+
11
+ ## Scope
12
+
13
+ - Add explicit critical placeholder detection for EN/ES Quiver scaffold text.
14
+ - Add classification for existing docs.
15
+ - Preserve parseable frontmatter.
16
+ - Replace scaffold primary content with proposed Markdown.
17
+ - Preserve human content.
18
+ - Replace existing `quiver:analyze-project` block idempotently.
19
+ - Remove or supersede scaffold-only `quiver:context-prep` blocks.
20
+ - Add merge metadata to write plan items.
21
+
22
+ ## Acceptance Criteria
23
+
24
+ - Scaffold docs no longer keep critical placeholders as primary visible content.
25
+ - Partial scaffold docs preserve human-completed sections.
26
+ - Human docs preserve human text.
27
+ - Existing analyze-project block is replaced in place.
28
+ - Context-prep scaffold does not remain as confusing primary content.
29
+ - Same input/proposal produces stable output across repeated merges.
30
+ - Unit tests cover the above.
31
+
32
+ ## Expected Files
33
+
34
+ - `src/create-quiver/lib/ai/analyze-project-docs.js`
35
+ - `tests/lib/ai-analyze-project-docs.test.js`
36
+ - `specs/quiver-v56-analyze-project-usable-doc-merge/**`
37
+
38
+ ## Validation
39
+
40
+ ```bash
41
+ node --test tests/lib/ai-analyze-project-docs.test.js
42
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
43
+ git diff --check
44
+ ```
45
+
46
+ ## Completion Checklist
47
+
48
+ - Classification helpers implemented and exported for tests.
49
+ - Merge engine replaces scaffold primary content safely.
50
+ - Merge engine preserves human content.
51
+ - Idempotency tests pass.
52
+ - Slice closure brief records validation evidence.
53
+
54
+ ## Constraints
55
+
56
+ - Do not change provider schema.
57
+ - Do not widen the analyze-project doc path allowlist.
58
+ - Do not change CLI output in this slice except what write plan metadata naturally exposes to tests.
59
+ - Do not implement post-write strict placeholder validation here; that belongs to Slice 02.
@@ -0,0 +1,61 @@
1
+ ## Title
2
+
3
+ QUIVER-56-01 document classification merge engine
4
+
5
+ ## Summary
6
+
7
+ Implements deterministic document classification and merge behavior for analyze-project docs.
8
+
9
+ ## PR Policy
10
+
11
+ Individual PR required because this changes CLI write behavior internals.
12
+
13
+ ## Scope
14
+
15
+ Slice 01 only.
16
+
17
+ ## Files
18
+
19
+ - `src/create-quiver/lib/ai/analyze-project-docs.js`
20
+ - `tests/lib/ai-analyze-project-docs.test.js`
21
+ - `specs/quiver-v56-analyze-project-usable-doc-merge/**`
22
+
23
+ ## How to Test (DETAILED - REQUIRED)
24
+
25
+ ### Required Environment
26
+
27
+ Node.js/npm.
28
+
29
+ ### Worktree Access
30
+
31
+ Use the slice branch.
32
+
33
+ ### Run the Project
34
+
35
+ No dev server required.
36
+
37
+ ### Use Cases
38
+
39
+ Validate scaffold replacement, partial scaffold preservation, human content preservation, context-prep cleanup, and idempotency.
40
+
41
+ ### Technical Verification
42
+
43
+ ```bash
44
+ node --test tests/lib/ai-analyze-project-docs.test.js
45
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
46
+ git diff --check
47
+ ```
48
+
49
+ ## Evidence
50
+
51
+ - `node --test tests/lib/ai-analyze-project-docs.test.js`: passed.
52
+ - `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`: passed.
53
+ - `git diff --check`: passed.
54
+
55
+ ## Rollback
56
+
57
+ Revert the PR.
58
+
59
+ ## Risks / Notes
60
+
61
+ Later slices integrate this engine into all apply/review/strict CLI paths.
@@ -0,0 +1,71 @@
1
+ {
2
+ "slice_id": "slice-01-document-classification-merge-engine",
3
+ "ticket": "QUIVER-56-01",
4
+ "type": "feature",
5
+ "title": "Document Classification + Merge Engine",
6
+ "objective": "Implement deterministic document classification and merge behavior for analyze-project docs without integrating every CLI path yet.",
7
+ "description": "Adds a shared merge engine that classifies existing docs, replaces scaffold placeholders when safe, preserves human content, consolidates managed analyze-project blocks, handles context-prep scaffolds, and records merge metadata in the write plan.",
8
+ "git": {
9
+ "branch_type": "feature",
10
+ "base_branch": "main",
11
+ "branch_slug": "v56-doc-classification-merge-engine",
12
+ "branch_name": "feature/QUIVER-56-01-v56-doc-classification-merge-engine"
13
+ },
14
+ "files": [
15
+ "src/create-quiver/lib/ai/analyze-project-docs.js",
16
+ "tests/lib/ai-analyze-project-docs.test.js",
17
+ "specs/quiver-v56-analyze-project-usable-doc-merge/**"
18
+ ],
19
+ "expected_read_paths": [
20
+ "src/create-quiver/lib/ai/analyze-project-docs.js",
21
+ "src/create-quiver/lib/ai/analyze-project-validation.js",
22
+ "tests/lib/ai-analyze-project-docs.test.js",
23
+ "specs/quiver-v56-analyze-project-usable-doc-merge/SPEC.md"
24
+ ],
25
+ "allowed_write_paths": [
26
+ "src/create-quiver/lib/ai/analyze-project-docs.js",
27
+ "tests/lib/ai-analyze-project-docs.test.js",
28
+ "specs/quiver-v56-analyze-project-usable-doc-merge/**"
29
+ ],
30
+ "depends_on": [],
31
+ "parallel_safe": "never",
32
+ "parallel_safe_reason": "This slice defines the shared merge contract that every later integration path must use.",
33
+ "must": [
34
+ "Classify docs as scaffold, partial_scaffold, human_content, managed_only, mixed, or unknown.",
35
+ "Detect critical placeholders in English and Spanish using explicit known patterns only.",
36
+ "Preserve parseable frontmatter.",
37
+ "Replace scaffold primary content with proposed content.",
38
+ "Preserve human content and avoid deleting significant non-placeholder text.",
39
+ "Replace existing analyze-project block instead of duplicating it.",
40
+ "Handle context-prep scaffold blocks so they do not remain as confusing primary content.",
41
+ "Expose merge metadata on write plan items.",
42
+ "Keep the merge idempotent for the same input and proposal."
43
+ ],
44
+ "not_included": [
45
+ "CLI output copy changes.",
46
+ "Post-write strict validation changes.",
47
+ "Review selector changes.",
48
+ "Saved proposal merge-plan persistence.",
49
+ "Live nika-erp smoke."
50
+ ],
51
+ "acceptance": [
52
+ "A Quiver scaffold CONTEXTO.md with Spanish placeholders is replaced as primary visible content.",
53
+ "A partial scaffold preserves completed human sections and replaces placeholder sections.",
54
+ "Human content remains present after merge.",
55
+ "Existing analyze-project block is replaced, not duplicated.",
56
+ "Context-prep scaffold content is removed or superseded when analyze-project content is applied.",
57
+ "Two consecutive merges with the same proposal are stable.",
58
+ "Write plan items include classification and strategy metadata."
59
+ ],
60
+ "tests": [
61
+ "node --test tests/lib/ai-analyze-project-docs.test.js",
62
+ "node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict",
63
+ "git diff --check"
64
+ ],
65
+ "estimated_hours": 5,
66
+ "actual_hours": 5,
67
+ "status": "completed",
68
+ "blocked_reason": null,
69
+ "started_at": "2026-06-17T00:00:00.000Z",
70
+ "completed_at": "2026-06-17T00:00:00.000Z"
71
+ }
@@ -0,0 +1,30 @@
1
+ # CLOSURE_BRIEF - slice-02 Apply Integration + Validation Contract
2
+
3
+ ## Status
4
+
5
+ Completed.
6
+
7
+ ## Summary
8
+
9
+ Integrated the Slice 01 merge engine metadata into analyze-project apply, saved proposal, review, JSON, proposal manifest, write manifest, and post-write validation paths.
10
+
11
+ Key outcomes:
12
+
13
+ - Live auto-apply and `apply --run` continue to use the same `buildAnalyzeProjectWritePlan` merge engine.
14
+ - JSON/write-plan summaries now include `merge_report`.
15
+ - Saved proposal manifests now include a `merge_plan` with merge strategy metadata.
16
+ - Write manifests now persist per-action `merge_report`.
17
+ - Review output continues to show the final post-merge diff preview.
18
+ - Post-write validation now checks primary visible content and makes `--strict` fail if critical scaffold placeholders remain outside managed blocks.
19
+
20
+ ## Evidence
21
+
22
+ - `node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js`
23
+ - `node --test tests/lib/ai-analyze-project-docs.test.js tests/lib/ai-analyze-project-validation.test.js`
24
+ - `node --test tests/lib/ai-analyze-project-proposal.test.js`
25
+ - `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`
26
+ - `git diff --check`
27
+
28
+ ## Validation
29
+
30
+ Passed.
@@ -0,0 +1,39 @@
1
+ # EXECUTION_BRIEF - slice-02 Apply Integration + Validation Contract
2
+
3
+ ## Context
4
+
5
+ Slice 02 depends on the Slice 01 merge engine and wires it into every analyze-project write path.
6
+
7
+ ## Objective
8
+
9
+ Integrate the Slice 01 merge engine across all analyze-project write paths and validation reports.
10
+
11
+ ## Acceptance Criteria
12
+
13
+ - Live auto-apply and `apply --run` use the same merge logic.
14
+ - `--save-proposal` persists merge metadata or final estimated diff.
15
+ - `--review` shows final post-merge diff.
16
+ - `--json` includes merge strategy/warnings without breaking existing fields.
17
+ - `--strict` fails on critical visible placeholders.
18
+
19
+ ## Constraints
20
+
21
+ - Do not change provider schema.
22
+ - Do not widen path allowlist.
23
+ - Do not implement final nika-erp smoke here.
24
+
25
+ ## Validation
26
+
27
+ ```bash
28
+ node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js
29
+ node --test tests/lib/ai-analyze-project-docs.test.js tests/lib/ai-analyze-project-validation.test.js
30
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
31
+ git diff --check
32
+ ```
33
+
34
+ ## Completion Checklist
35
+
36
+ - Live apply and apply --run use the same merge engine.
37
+ - JSON reports expose merge metadata without breaking existing fields.
38
+ - Strict validation handles critical visible placeholders.
39
+ - Review diff reflects final post-merge content.