Skip to content

Commit 4a5a5e7

Browse files
committed
feat: add Markdown rendering for plan docs and ADR confirmation flow
- Add render-plan-docs.py: programmatic JSON→Markdown conversion for prd.json, design_doc.json, and mega-plan.json (non-LLM, deterministic) - Enhance unified-review.py ADR display with context, decision, rationale, and alternatives - Add Step 5.45/5.6 to hybrid-auto.md: Markdown generation + two-tier ADR confirmation (accept-all / review-individually / discuss) - Add Step 5.4/9.5 to mega-plan.md: same Markdown + ADR flow - --no-confirm auto-accepts decisions for CI/automation use cases
1 parent 956e6e7 commit 4a5a5e7

File tree

4 files changed

+684
-2
lines changed

4 files changed

+684
-2
lines changed

commands/hybrid-auto.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,23 @@ If exit code is 1:
699699
- **Skip** — Keep both decisions as-is
700700
3. Apply the user's choices by modifying the relevant `design_doc.json` files
701701

702+
## Step 5.45: Generate Markdown Documents
703+
704+
**CRITICAL**: Generate human-readable Markdown files from the finalized JSON:
705+
706+
```bash
707+
uv run python "${CLAUDE_PLUGIN_ROOT}/skills/hybrid-ralph/scripts/render-plan-docs.py" \
708+
--mode hybrid \
709+
--project-root "$(pwd)"
710+
```
711+
712+
This produces:
713+
- `prd.md` — Human-readable PRD with stories, acceptance criteria, execution batches
714+
- `design_doc.md` — Technical design with components, patterns, and full ADR details
715+
716+
These files are programmatically generated from JSON (not LLM) and stay in sync.
717+
If the script fails, log a warning and continue — the Markdown files are supplementary.
718+
702719
## Step 5.5: Display Unified Review
703720

704721
**CRITICAL**: Use Bash to display the unified PRD + Design Document review:
@@ -722,16 +739,95 @@ If the script is not available, display a manual summary showing:
722739
- Flow configuration: {FLOW_LEVEL or "standard (default)"}
723740
- TDD mode: {TDD_MODE or "auto (default)"}
724741

742+
## Step 5.6: Confirm Architectural Decisions
743+
744+
After the unified review, display a decision summary and confirm with the user.
745+
746+
### 5.6.1: Display Decision Summary
747+
748+
Read `design_doc.json` and for each decision with status "accepted" or "proposed", display:
749+
750+
```
751+
============================================================
752+
ARCHITECTURAL DECISIONS — Summary
753+
============================================================
754+
755+
[ADR-F001] Decision Title
756+
Context: <context>
757+
Decision: <decision>
758+
Rationale: <rationale>
759+
Alternatives: <alt1>, <alt2>
760+
761+
[ADR-F002] ...
762+
763+
Total: N decisions
764+
============================================================
765+
```
766+
767+
### 5.6.2: Confirmation Flow
768+
769+
**If `NO_CONFIRM_MODE` is true** (i.e., `--no-confirm` was passed):
770+
- Skip interactive confirmation entirely
771+
- Auto-accept all decisions: set every decision's status to "accepted" in `design_doc.json`
772+
- Log: `"Auto-accepted N architectural decisions (--no-confirm mode)"`
773+
- Proceed to Step 6
774+
775+
**Otherwise** (interactive mode — the default):
776+
777+
Use `AskUserQuestion` with these options:
778+
779+
```
780+
Question: "These N architectural decisions will be used as the baseline for future conflict detection. Do you accept them?"
781+
782+
Options:
783+
1. "Accept All (Recommended)" — Accept all decisions as-is
784+
2. "Review Individually" — Review and confirm each decision one by one
785+
3. "Discuss" — Chat about specific decisions before confirming
786+
```
787+
788+
**If user selects "Accept All"**: Set all decision statuses to "accepted" in `design_doc.json`. Proceed to Step 6.
789+
790+
**If user selects "Discuss"**: Let the user discuss freely. After the discussion, repeat Step 5.6.2 (re-ask the question).
791+
792+
**If user selects "Review Individually"**: For each decision, use `AskUserQuestion`:
793+
794+
```
795+
Question: "[ADR-F001] <title>
796+
Context: <context>
797+
Decision: <decision>
798+
Rationale: <rationale>"
799+
800+
Options:
801+
1. "Accept" — Accept this decision
802+
2. "Reject" — Remove this decision
803+
3. "Modify" — Edit this decision before accepting
804+
4. "Discuss" — Chat about this decision
805+
```
806+
807+
- **Accept**: Mark status as "accepted"
808+
- **Reject**: Mark status as "rejected"
809+
- **Modify**: Let the user describe changes, update the decision in `design_doc.json`, then re-confirm this specific ADR
810+
- **Discuss**: Let the user chat, then re-ask for this specific ADR
811+
812+
After all decisions are reviewed, re-run Step 5.45 to regenerate the Markdown files:
813+
```bash
814+
uv run python "${CLAUDE_PLUGIN_ROOT}/skills/hybrid-ralph/scripts/render-plan-docs.py" \
815+
--mode hybrid \
816+
--project-root "$(pwd)"
817+
```
818+
725819
## Step 6: Confirm Generation Complete and Show Next Steps
726820

727-
After displaying the unified review, confirm and show how to proceed:
821+
After displaying the unified review and getting decision confirmation, show how to proceed:
728822

729823
```
730824
PRD and Design Document generated successfully!
731825
732826
Files created:
733827
- prd.json (product requirements document)
734828
- design_doc.json (technical design document)
829+
- prd.md (human-readable PRD)
830+
- design_doc.md (human-readable technical design)
735831
736832
============================================================
737833
EXECUTION CONFIGURATION

commands/mega-plan.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,23 @@ If exit code is 1:
548548
- **Skip** — Keep both decisions as-is
549549
3. Apply the user's choices by modifying the relevant `design_doc.json` files
550550

551+
### 5.4: Generate Markdown Documents
552+
553+
**CRITICAL**: Generate human-readable Markdown files from the finalized JSON:
554+
555+
```bash
556+
uv run python "${CLAUDE_PLUGIN_ROOT}/skills/hybrid-ralph/scripts/render-plan-docs.py" \
557+
--mode mega \
558+
--project-root "$(pwd)"
559+
```
560+
561+
This produces:
562+
- `mega-plan.md` — Human-readable project plan with features and execution batches
563+
- `design_doc.md` — Technical design with architecture, patterns, and full ADR details
564+
565+
These files are programmatically generated from JSON (not LLM) and stay in sync.
566+
If the script fails, log a warning and continue — the Markdown files are supplementary.
567+
551568
## Step 6: Create Supporting Files
552569

553570
Create `mega-findings.md`:
@@ -660,14 +677,93 @@ Batch 2 (After Batch 1):
660677
============================================================
661678
```
662679

680+
## Step 9.5: Confirm Architectural Decisions
681+
682+
After the unified review, display a decision summary and confirm with the user.
683+
684+
### 9.5.1: Display Decision Summary
685+
686+
Read `design_doc.json` and for each decision with status "accepted" or "proposed", display:
687+
688+
```
689+
============================================================
690+
ARCHITECTURAL DECISIONS — Summary
691+
============================================================
692+
693+
[ADR-001] Decision Title
694+
Context: <context>
695+
Decision: <decision>
696+
Rationale: <rationale>
697+
Alternatives: <alt1>, <alt2>
698+
699+
[ADR-002] ...
700+
701+
Total: N decisions
702+
============================================================
703+
```
704+
705+
### 9.5.2: Confirmation Flow
706+
707+
**If `NO_CONFIRM_MODE` is true** (i.e., `--no-confirm` was passed):
708+
- Skip interactive confirmation entirely
709+
- Auto-accept all decisions: set every decision's status to "accepted" in `design_doc.json`
710+
- Log: `"Auto-accepted N architectural decisions (--no-confirm mode)"`
711+
- Proceed to Step 10
712+
713+
**Otherwise** (interactive mode — the default):
714+
715+
Use `AskUserQuestion` with these options:
716+
717+
```
718+
Question: "These N architectural decisions will be used as the baseline for future conflict detection. Do you accept them?"
719+
720+
Options:
721+
1. "Accept All (Recommended)" — Accept all decisions as-is
722+
2. "Review Individually" — Review and confirm each decision one by one
723+
3. "Discuss" — Chat about specific decisions before confirming
724+
```
725+
726+
**If user selects "Accept All"**: Set all decision statuses to "accepted" in `design_doc.json`. Proceed to Step 10.
727+
728+
**If user selects "Discuss"**: Let the user discuss freely. After the discussion, repeat Step 9.5.2 (re-ask the question).
729+
730+
**If user selects "Review Individually"**: For each decision, use `AskUserQuestion`:
731+
732+
```
733+
Question: "[ADR-001] <title>
734+
Context: <context>
735+
Decision: <decision>
736+
Rationale: <rationale>"
737+
738+
Options:
739+
1. "Accept" — Accept this decision
740+
2. "Reject" — Remove this decision
741+
3. "Modify" — Edit this decision before accepting
742+
4. "Discuss" — Chat about this decision
743+
```
744+
745+
- **Accept**: Mark status as "accepted"
746+
- **Reject**: Mark status as "rejected"
747+
- **Modify**: Let the user describe changes, update the decision in `design_doc.json`, then re-confirm this specific ADR
748+
- **Discuss**: Let the user chat, then re-ask for this specific ADR
749+
750+
After all decisions are reviewed, re-run Step 5.4 to regenerate the Markdown files:
751+
```bash
752+
uv run python "${CLAUDE_PLUGIN_ROOT}/skills/hybrid-ralph/scripts/render-plan-docs.py" \
753+
--mode mega \
754+
--project-root "$(pwd)"
755+
```
756+
663757
## Step 10: Show Files Created and Next Steps
664758

665-
After unified review, confirm created files and show execution configuration:
759+
After unified review and getting decision confirmation, show created files and execution configuration:
666760

667761
```
668762
Files created:
669763
- mega-plan.json (project plan - in user data dir or project root)
670764
- design_doc.json (project-level technical design - in project root)
765+
- mega-plan.md (human-readable project plan)
766+
- design_doc.md (human-readable technical design)
671767
- mega-findings.md (shared findings - always in project root for visibility)
672768
- .mega-status.json (execution status - in .state/ dir or project root)
673769

0 commit comments

Comments
 (0)