create-quiver 0.17.3 → 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 (29) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/docs/CLI_UX_GUIDE.md +11 -4
  3. package/docs/TROUBLESHOOTING.md +17 -9
  4. package/docs/reference/commands.md +21 -9
  5. package/docs/workflows/existing-project.md +5 -5
  6. package/package.json +1 -1
  7. package/specs/quiver-v56-analyze-project-usable-doc-merge/EVIDENCE_REPORT.md +11 -0
  8. package/specs/quiver-v56-analyze-project-usable-doc-merge/EXECUTION_PLAN.md +28 -0
  9. package/specs/quiver-v56-analyze-project-usable-doc-merge/SPEC.md +96 -0
  10. package/specs/quiver-v56-analyze-project-usable-doc-merge/STATUS.md +26 -0
  11. package/specs/quiver-v56-analyze-project-usable-doc-merge/pr.md +56 -0
  12. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/CLOSURE_BRIEF.md +61 -0
  13. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/EXECUTION_BRIEF.md +59 -0
  14. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/pr.md +61 -0
  15. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/slice.json +71 -0
  16. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/CLOSURE_BRIEF.md +30 -0
  17. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/EXECUTION_BRIEF.md +39 -0
  18. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/pr.md +62 -0
  19. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/slice.json +80 -0
  20. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/CLOSURE_BRIEF.md +29 -0
  21. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/EXECUTION_BRIEF.md +32 -0
  22. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/pr.md +61 -0
  23. package/specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-03-cli-docs-real-fixture-smoke/slice.json +79 -0
  24. package/src/create-quiver/commands/ai.js +50 -2
  25. package/src/create-quiver/index.js +1 -1
  26. package/src/create-quiver/lib/ai/analyze-project-docs.js +300 -5
  27. package/src/create-quiver/lib/ai/analyze-project-proposal.js +11 -0
  28. package/src/create-quiver/lib/ai/analyze-project-validation.js +26 -0
  29. package/src/create-quiver/lib/i18n/messages/es.js +1 -1
@@ -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.
@@ -0,0 +1,62 @@
1
+ ## Title
2
+
3
+ QUIVER-56-02 apply integration validation contract
4
+
5
+ ## Summary
6
+
7
+ Integrates the merge engine into all analyze-project write paths and post-write validation.
8
+
9
+ ## PR Policy
10
+
11
+ Individual PR required.
12
+
13
+ ## Scope
14
+
15
+ Slice 02 only.
16
+
17
+ ## Files
18
+
19
+ See `slice.json`.
20
+
21
+ ## How to Test (DETAILED - REQUIRED)
22
+
23
+ ### Required Environment
24
+
25
+ Node.js/npm.
26
+
27
+ ### Worktree Access
28
+
29
+ Use the slice branch.
30
+
31
+ ### Run the Project
32
+
33
+ No dev server required.
34
+
35
+ ### Use Cases
36
+
37
+ Live apply, saved proposal apply, review diff, JSON output, strict validation.
38
+
39
+ ### Technical Verification
40
+
41
+ ```bash
42
+ node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js
43
+ node --test tests/lib/ai-analyze-project-docs.test.js tests/lib/ai-analyze-project-validation.test.js
44
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
45
+ git diff --check
46
+ ```
47
+
48
+ ## Evidence
49
+
50
+ - `node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js`: passed.
51
+ - `node --test tests/lib/ai-analyze-project-docs.test.js tests/lib/ai-analyze-project-validation.test.js`: passed.
52
+ - `node --test tests/lib/ai-analyze-project-proposal.test.js`: passed.
53
+ - `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`: passed.
54
+ - `git diff --check`: passed.
55
+
56
+ ## Rollback
57
+
58
+ Revert the PR.
59
+
60
+ ## Risks / Notes
61
+
62
+ Depends on Slice 01.
@@ -0,0 +1,80 @@
1
+ {
2
+ "slice_id": "slice-02-apply-integration-validation-contract",
3
+ "ticket": "QUIVER-56-02",
4
+ "type": "feature",
5
+ "title": "Apply Integration + Validation Contract",
6
+ "objective": "Integrate the merge engine across every analyze-project write path and validate visible output quality.",
7
+ "description": "Uses the shared merge engine in live auto-apply, --apply-docs, --save-proposal, --review, and apply --run paths; extends post-write validation for primary visible placeholders and exposes stable JSON merge metadata.",
8
+ "git": {
9
+ "branch_type": "feature",
10
+ "base_branch": "main",
11
+ "branch_slug": "v56-apply-integration-validation",
12
+ "branch_name": "feature/QUIVER-56-02-v56-apply-integration-validation"
13
+ },
14
+ "files": [
15
+ "src/create-quiver/commands/ai.js",
16
+ "src/create-quiver/lib/ai/analyze-project-apply.js",
17
+ "src/create-quiver/lib/ai/analyze-project-docs.js",
18
+ "src/create-quiver/lib/ai/analyze-project-proposal.js",
19
+ "src/create-quiver/lib/ai/analyze-project-validation.js",
20
+ "tests/commands/ai-analyze-project*.test.js",
21
+ "tests/lib/ai-analyze-project-*.test.js",
22
+ "specs/quiver-v56-analyze-project-usable-doc-merge/**"
23
+ ],
24
+ "expected_read_paths": [
25
+ "src/create-quiver/commands/ai.js",
26
+ "src/create-quiver/lib/ai/analyze-project-apply.js",
27
+ "src/create-quiver/lib/ai/analyze-project-proposal.js",
28
+ "src/create-quiver/lib/ai/analyze-project-validation.js",
29
+ "specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-01-document-classification-merge-engine/CLOSURE_BRIEF.md"
30
+ ],
31
+ "allowed_write_paths": [
32
+ "src/create-quiver/commands/ai.js",
33
+ "src/create-quiver/lib/ai/analyze-project-apply.js",
34
+ "src/create-quiver/lib/ai/analyze-project-docs.js",
35
+ "src/create-quiver/lib/ai/analyze-project-proposal.js",
36
+ "src/create-quiver/lib/ai/analyze-project-validation.js",
37
+ "tests/commands/ai-analyze-project-provider.test.js",
38
+ "tests/commands/ai-analyze-project-review.test.js",
39
+ "tests/lib/ai-analyze-project-docs.test.js",
40
+ "tests/lib/ai-analyze-project-validation.test.js",
41
+ "specs/quiver-v56-analyze-project-usable-doc-merge/**"
42
+ ],
43
+ "depends_on": [
44
+ "slice-01-document-classification-merge-engine"
45
+ ],
46
+ "parallel_safe": "never",
47
+ "parallel_safe_reason": "All write paths must share the same merge engine; integrating before slice 01 is complete would duplicate logic.",
48
+ "must": [
49
+ "Use the same merge engine in live apply and apply --run.",
50
+ "Expose merge metadata in JSON apply reports without removing existing fields.",
51
+ "Make --save-proposal include merge-plan metadata or final diff preview.",
52
+ "Make --review show final post-merge diff.",
53
+ "Detect critical placeholders in primary visible content.",
54
+ "Make --strict fail when critical visible placeholders remain."
55
+ ],
56
+ "not_included": [
57
+ "Final docs/troubleshooting polish.",
58
+ "Live provider smoke against nika-erp.",
59
+ "Changing provider prompt semantics."
60
+ ],
61
+ "acceptance": [
62
+ "Live auto-apply and apply --run produce the same result with the same proposal.",
63
+ "--json includes merge strategy and warnings.",
64
+ "--strict fails on critical visible placeholders.",
65
+ "--save-proposal artifacts include enough merge metadata to preview the final write.",
66
+ "--review diff reflects the final post-merge write."
67
+ ],
68
+ "tests": [
69
+ "node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/ai-analyze-project-review.test.js",
70
+ "node --test tests/lib/ai-analyze-project-docs.test.js tests/lib/ai-analyze-project-validation.test.js",
71
+ "node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict",
72
+ "git diff --check"
73
+ ],
74
+ "estimated_hours": 6,
75
+ "actual_hours": 3,
76
+ "status": "completed",
77
+ "blocked_reason": null,
78
+ "started_at": "2026-06-17",
79
+ "completed_at": "2026-06-17"
80
+ }
@@ -0,0 +1,29 @@
1
+ # CLOSURE_BRIEF - slice-03 CLI UX + Docs + Real Fixture Smoke
2
+
3
+ ## Status
4
+
5
+ Completed.
6
+
7
+ ## Summary
8
+
9
+ Finished the user-facing hardening for analyze-project usable doc merges.
10
+
11
+ Key outcomes:
12
+
13
+ - Human apply/save/review output now includes compact `Merge decisions`.
14
+ - Troubleshooting explains how upgraded users recover docs that still show scaffold placeholders.
15
+ - Command reference documents the deterministic merge contract and audit manifests.
16
+ - CLI UX guide documents the merge feedback contract.
17
+ - Changelog records the user-visible behavior change and nika-erp style regression coverage.
18
+ - Deterministic provider test covers a nika-erp style `CONTEXTO.md` with visible placeholders, an old `quiver:context-prep` block, and `NIKA_ERP`/`stockflow`/`StockFlow` naming conflict signals.
19
+
20
+ ## Evidence
21
+
22
+ - `node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js`
23
+ - `npm run docs:check`
24
+ - `node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict`
25
+ - `git diff --check`
26
+
27
+ ## Validation
28
+
29
+ Passed.
@@ -0,0 +1,32 @@
1
+ # EXECUTION_BRIEF - slice-03 CLI UX + Docs + Real Fixture Smoke
2
+
3
+ ## Context
4
+
5
+ Slice 03 depends on the integrated apply behavior from Slice 02 and focuses on user-facing output, docs, and regression evidence.
6
+
7
+ ## Objective
8
+
9
+ Finish the user-facing output, docs, and nika-erp regression coverage after Slice 02 integration.
10
+
11
+ ## Acceptance Criteria
12
+
13
+ - Output reports merge strategies and warnings.
14
+ - Docs/troubleshooting explain how to fix old placeholder-heavy docs.
15
+ - nika-erp style fixture proves final visible docs are usable.
16
+ - Name conflicts are reported.
17
+
18
+ ## Validation
19
+
20
+ ```bash
21
+ node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js
22
+ npm run docs:check
23
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
24
+ git diff --check
25
+ ```
26
+
27
+ ## Completion Checklist
28
+
29
+ - Output copy is compact and actionable.
30
+ - Docs and troubleshooting are updated.
31
+ - Command reference is synchronized.
32
+ - nika-erp style fixture proves visible placeholders are removed.
@@ -0,0 +1,61 @@
1
+ ## Title
2
+
3
+ QUIVER-56-03 CLI docs real fixture smoke
4
+
5
+ ## Summary
6
+
7
+ Adds user-facing output, docs, and fixture smoke evidence for the usable doc merge behavior.
8
+
9
+ ## PR Policy
10
+
11
+ Individual PR required.
12
+
13
+ ## Scope
14
+
15
+ Slice 03 only.
16
+
17
+ ## Files
18
+
19
+ See `slice.json`.
20
+
21
+ ## How to Test (DETAILED - REQUIRED)
22
+
23
+ ### Required Environment
24
+
25
+ Node.js/npm.
26
+
27
+ ### Worktree Access
28
+
29
+ Use the slice branch.
30
+
31
+ ### Run the Project
32
+
33
+ No dev server required.
34
+
35
+ ### Use Cases
36
+
37
+ CLI output, docs, troubleshooting, deterministic nika-erp style fixture.
38
+
39
+ ### Technical Verification
40
+
41
+ ```bash
42
+ node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js
43
+ npm run docs:check
44
+ node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict
45
+ git diff --check
46
+ ```
47
+
48
+ ## Evidence
49
+
50
+ - `node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js`: passed.
51
+ - `npm run docs:check`: 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
+ Depends on Slice 02.
@@ -0,0 +1,79 @@
1
+ {
2
+ "slice_id": "slice-03-cli-docs-real-fixture-smoke",
3
+ "ticket": "QUIVER-56-03",
4
+ "type": "hardening",
5
+ "title": "CLI UX + Docs + Real Fixture Smoke",
6
+ "objective": "Make the new merge behavior understandable to users and prove the nika-erp regression is covered.",
7
+ "description": "Updates human output, docs, troubleshooting, changelog guidance, and deterministic nika-erp style fixture/smoke evidence.",
8
+ "git": {
9
+ "branch_type": "feature",
10
+ "base_branch": "main",
11
+ "branch_slug": "v56-cli-docs-real-fixture-smoke",
12
+ "branch_name": "feature/QUIVER-56-03-v56-cli-docs-real-fixture-smoke"
13
+ },
14
+ "files": [
15
+ "src/create-quiver/commands/ai.js",
16
+ "src/create-quiver/lib/i18n/messages/en.js",
17
+ "src/create-quiver/lib/i18n/messages/es.js",
18
+ "tests/commands/ai-analyze-project*.test.js",
19
+ "tests/fixtures/analyze-project/**",
20
+ "docs/CLI_UX_GUIDE.md",
21
+ "docs/TROUBLESHOOTING.md",
22
+ "docs/reference/commands.md",
23
+ "CHANGELOG.md",
24
+ "specs/quiver-v56-analyze-project-usable-doc-merge/**"
25
+ ],
26
+ "expected_read_paths": [
27
+ "specs/quiver-v56-analyze-project-usable-doc-merge/slices/slice-02-apply-integration-validation-contract/CLOSURE_BRIEF.md",
28
+ "docs/TROUBLESHOOTING.md",
29
+ "docs/reference/commands.md"
30
+ ],
31
+ "allowed_write_paths": [
32
+ "src/create-quiver/commands/ai.js",
33
+ "src/create-quiver/lib/i18n/messages/en.js",
34
+ "src/create-quiver/lib/i18n/messages/es.js",
35
+ "tests/commands/ai-analyze-project-provider.test.js",
36
+ "tests/fixtures/analyze-project/**",
37
+ "docs/CLI_UX_GUIDE.md",
38
+ "docs/TROUBLESHOOTING.md",
39
+ "docs/reference/commands.md",
40
+ "CHANGELOG.md",
41
+ "specs/quiver-v56-analyze-project-usable-doc-merge/**"
42
+ ],
43
+ "depends_on": [
44
+ "slice-02-apply-integration-validation-contract"
45
+ ],
46
+ "parallel_safe": "after_dependencies",
47
+ "parallel_safe_reason": "Docs can draft after Slice 01, but final fixture smoke and output assertions depend on Slice 02.",
48
+ "must": [
49
+ "Human output reports replaced scaffold, preserved human content, placeholder counts, conflicts, snapshot, and manifest paths.",
50
+ "Troubleshooting explains re-running analyze-project after upgrading.",
51
+ "Docs explain the merge contract without overpromising.",
52
+ "Deterministic fixture covers NIKA_ERP scaffold plus stockflow/StockFlow conflict and old context-prep block.",
53
+ "Evidence proves final CONTEXTO.md has no critical visible placeholders."
54
+ ],
55
+ "not_included": [
56
+ "Provider prompt redesign.",
57
+ "Publishing npm.",
58
+ "Product repository changes."
59
+ ],
60
+ "acceptance": [
61
+ "CLI output is compact and actionable.",
62
+ "Docs and command reference are synchronized.",
63
+ "nika-erp style fixture passes without visible scaffold placeholders.",
64
+ "Name conflict warning is visible.",
65
+ "Release smoke guidance is updated."
66
+ ],
67
+ "tests": [
68
+ "node --test tests/commands/ai-analyze-project-provider.test.js tests/commands/cli-contract.test.js",
69
+ "npm run docs:check",
70
+ "node bin/create-quiver.js spec validate specs/quiver-v56-analyze-project-usable-doc-merge --strict",
71
+ "git diff --check"
72
+ ],
73
+ "estimated_hours": 4,
74
+ "actual_hours": 3,
75
+ "status": "completed",
76
+ "blocked_reason": null,
77
+ "started_at": "2026-06-17",
78
+ "completed_at": "2026-06-17"
79
+ }
@@ -528,6 +528,7 @@ function summarizeAnalyzeProjectWritePlan(writePlan = []) {
528
528
  before_sha256: item.before_sha256,
529
529
  after_sha256: item.after_sha256,
530
530
  reason: item.reason,
531
+ merge_report: item.merge_report,
531
532
  }));
532
533
  }
533
534
 
@@ -545,14 +546,46 @@ function formatAnalyzeProjectSavedProposalReport(report = {}) {
545
546
  `Proposal summary: ${artifacts.proposal_markdown || 'none'}`,
546
547
  `Proposal diff: ${artifacts.proposal_diff || 'none'}`,
547
548
  `Manifest: ${artifacts.manifest || 'none'}`,
549
+ ];
550
+ lines.push(...formatAnalyzeProjectMergeSummary(report.write_plan));
551
+ lines.push(
548
552
  '',
549
553
  'Next commands:',
550
554
  `- npx create-quiver ai analyze-project apply --run ${report.run_id || '<run-id>'}`,
551
555
  '- npx create-quiver ai analyze-project --deep --apply-docs --provider <provider> --model <model>',
552
- ];
556
+ );
553
557
  return `${lines.join('\n')}\n`;
554
558
  }
555
559
 
560
+ function formatAnalyzeProjectMergeSummary(writePlan = []) {
561
+ const changed = (Array.isArray(writePlan) ? writePlan : []).filter((item) => item.action !== 'skip');
562
+ if (changed.length === 0) {
563
+ return [];
564
+ }
565
+
566
+ const lines = ['', 'Merge decisions:'];
567
+ for (const item of changed.slice(0, 10)) {
568
+ const merge = item.merge_report || {};
569
+ const details = [
570
+ merge.classification ? `class=${merge.classification}` : '',
571
+ merge.scaffold_replaced ? 'scaffold replaced' : '',
572
+ merge.human_content_preserved ? 'human preserved' : '',
573
+ merge.context_prep_removed ? 'context-prep removed' : '',
574
+ Array.isArray(merge.critical_placeholders) && merge.critical_placeholders.length > 0
575
+ ? `placeholders=${merge.critical_placeholders.length}`
576
+ : '',
577
+ ].filter(Boolean);
578
+ lines.push(`- ${item.path}: ${merge.strategy || 'unknown'}${details.length > 0 ? ` (${details.join(', ')})` : ''}`);
579
+ for (const warning of Array.isArray(merge.warnings) ? merge.warnings.slice(0, 2) : []) {
580
+ lines.push(` warning: ${warning}`);
581
+ }
582
+ }
583
+ if (changed.length > 10) {
584
+ lines.push(`- ... ${changed.length - 10} more doc merge decision${changed.length - 10 === 1 ? '' : 's'}`);
585
+ }
586
+ return lines;
587
+ }
588
+
556
589
  function formatAnalyzeProjectPostWriteValidation(validation) {
557
590
  if (!validation) {
558
591
  return [];
@@ -592,6 +625,7 @@ function formatAnalyzeProjectReviewPlan({ writePlan, reviewPath, snapshot, writt
592
625
  for (const item of writePlan || []) {
593
626
  lines.push(`- ${item.path}: ${item.action}${item.reason ? ` (${item.reason})` : ''}`);
594
627
  }
628
+ lines.push(...formatAnalyzeProjectMergeSummary(writePlan));
595
629
  lines.push('', 'Final diff:');
596
630
  lines.push(...formatAnalyzeProjectDiffPreview(writePlan || []));
597
631
  lines.push('', 'Confirmation required before writing.');
@@ -617,6 +651,7 @@ function formatAnalyzeProjectApplyReport(report = {}) {
617
651
  `Proposal manifest: ${artifacts.manifest || 'none'}`,
618
652
  `Write manifest: ${writeManifest.path || 'none'}`,
619
653
  ].filter(Boolean);
654
+ lines.push(...formatAnalyzeProjectMergeSummary(report.write_plan));
620
655
  lines.push(...formatAnalyzeProjectPostWriteValidation(report.post_write_validation));
621
656
  return `${lines.join('\n')}\n`;
622
657
  }
@@ -2886,7 +2921,11 @@ async function runAnalyzeProject(repoRoot, options = {}) {
2886
2921
  run_status_path: path.join('.quiver', 'runs', auditRunId, 'status.json').split(path.sep).join('/'),
2887
2922
  selected_context_manifest: selectedContextManifest,
2888
2923
  };
2889
- const needsDocProposal = options.applyDocs === true || options.saveProposal === true || options.review === true;
2924
+ const autoApplyDocs = options.applyDocs !== true
2925
+ && options.saveProposal !== true
2926
+ && options.review !== true
2927
+ && options.json !== true;
2928
+ const needsDocProposal = autoApplyDocs || options.applyDocs === true || options.saveProposal === true || options.review === true;
2890
2929
  const docProposal = needsDocProposal ? buildAnalyzeProjectDocProposal(parsed.analysis) : null;
2891
2930
  const docWritePlan = docProposal ? buildAnalyzeProjectWritePlan(repoRoot, docProposal) : [];
2892
2931
  const docActionContext = {
@@ -2911,6 +2950,15 @@ async function runAnalyzeProject(repoRoot, options = {}) {
2911
2950
  return emitAnalyzeProjectApplyReport(applyReport, options);
2912
2951
  }
2913
2952
 
2953
+ if (autoApplyDocs) {
2954
+ const applyReport = applyAnalyzeProjectDocProposalReport(repoRoot, {
2955
+ ...docActionContext,
2956
+ allowDirtyDocs: true,
2957
+ interactiveAction: 'auto-apply',
2958
+ });
2959
+ return emitAnalyzeProjectApplyReport(applyReport, options);
2960
+ }
2961
+
2914
2962
  if (options.applyDocs === true) {
2915
2963
  return runAnalyzeProjectInteractiveApplySelector({
2916
2964
  report: completedReport,
@@ -230,7 +230,7 @@ const COMMAND_HELP_GROUPS = [
230
230
  ['ai active-slice status|reconcile', 'Inspect or dry-run reconcile local active-slice state from every supported source.'],
231
231
  ['ai status', 'Show current AI lifecycle phase, approved versions, blockers, and next command.'],
232
232
  ['ai resume', 'Resume guidance from the last valid lifecycle phase without chat memory.'],
233
- ['ai analyze-project', 'Analyze a bounded project sample and generate audited documentation proposals.'],
233
+ ['ai analyze-project', 'Analyze a bounded project sample and apply validated documentation updates.'],
234
234
  ['ai onboard', 'Run or print the planner onboarding prompt with a token-aware context pack.'],
235
235
  ['ai prepare-context', 'Preview or write docs-only AI context updates with assumptions and risks.'],
236
236
  ['ai agent set|list|show|doctor|repair', 'Manage, diagnose, and dry-run repair planner, executor, reviewer, and doctor provider profiles without secrets.'],