Skip to content

Commit 3bef3ef

Browse files
authored
Merge pull request #78 from Lyken17/main
Add support for XML-style <cmt>comment</cmt> <comment>comment</comment> formats in refine-plan
2 parents 28813b6 + 027bf0b commit 3bef3ef

5 files changed

Lines changed: 259 additions & 110 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ A Claude Code plugin that provides iterative development with independent AI rev
2525

2626
The loop has two phases: **Implementation** (Claude works, Codex reviews summaries) and **Code Review** (Codex checks code quality with severity markers). Issues feed back into implementation until resolved.
2727

28+
2829
## Install
2930

3031
```bash
@@ -45,7 +46,7 @@ Requires [codex CLI](https://github.com/openai/codex) for review. See the full [
4546
/humanize:gen-plan --input draft.md --output docs/plan.md
4647
```
4748

48-
2. **Refine an annotated plan** before implementation when reviewers add `CMT:` ... `ENDCMT` comments:
49+
2. **Refine an annotated plan** before implementation when reviewers add comments (`CMT:` ... `ENDCMT`, `<cmt>` ... `</cmt>`, or `<comment>` ... `</comment>`):
4950
```bash
5051
/humanize:refine-plan --input docs/plan.md
5152
```

commands/refine-plan.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The refined plan MUST reuse the existing `gen-plan` schema. Do not invent new to
3434
1. **Execution Mode Setup**: Parse CLI arguments and derive output paths
3535
2. **Load Project Config**: Resolve `alternative_plan_language` and mode defaults using `config-loader.sh` semantics
3636
3. **IO Validation**: Run `validate-refine-plan-io.sh`
37-
4. **Comment Extraction**: Scan the annotated plan and extract valid `CMT:` / `ENDCMT` blocks
37+
4. **Comment Extraction**: Scan the annotated plan and extract valid comment blocks (`CMT:`/`ENDCMT`, `<cmt>`/`</cmt>`, `<comment>`/`</comment>`)
3838
5. **Comment Classification**: Classify each extracted comment for downstream handling
3939
6. **Comment Processing**: Answer questions, apply requested plan edits, and perform targeted research
4040
7. **Plan Refinement**: Produce the comment-free refined plan while preserving the `gen-plan` structure
@@ -167,7 +167,7 @@ Handle exit codes exactly:
167167
- Exit code 0: Continue to Phase 2
168168
- Exit code 1: Report `Input file not found` and stop
169169
- Exit code 2: Report `Input file is empty` and stop
170-
- Exit code 3: Report `Input file has no CMT:/ENDCMT blocks` and stop
170+
- Exit code 3: Report `Input file has no comment blocks` and stop
171171
- Exit code 4: Report `Input file is missing required gen-plan sections` and stop
172172
- Exit code 5: Report `Output directory does not exist or is not writable - please fix it` and stop
173173
- Exit code 6: Report `QA directory is not writable` and stop
@@ -196,17 +196,32 @@ Track these states while scanning the validated input in document order:
196196

197197
Extraction rules:
198198

199-
1. Recognize `CMT:` as the start marker and `ENDCMT` as the end marker.
200-
2. Support both inline and multi-line blocks:
199+
1. Support three comment formats:
200+
- Classic: `CMT:` as start marker and `ENDCMT` as end marker
201+
- Short tag: `<cmt>` as start marker and `</cmt>` as end marker
202+
- Long tag: `<comment>` as start marker and `</comment>` as end marker
203+
2. Support both inline and multi-line blocks for all formats:
201204
- Inline: `Text before CMT: comment text ENDCMT text after`
205+
- Inline: `Text before <cmt>comment text</cmt> text after`
206+
- Inline: `Text before <comment>comment text</comment> text after`
202207
- Multi-line:
203208
```markdown
204209
CMT:
205210
comment text
206211
ENDCMT
207212
```
208-
3. Ignore `CMT:` and `ENDCMT` sequences inside fenced code blocks.
209-
4. Ignore `CMT:` and `ENDCMT` sequences inside HTML comments.
213+
```markdown
214+
<cmt>
215+
comment text
216+
</cmt>
217+
```
218+
```markdown
219+
<comment>
220+
comment text
221+
</comment>
222+
```
223+
3. Ignore comment markers inside fenced code blocks.
224+
4. Ignore comment markers inside HTML comments.
210225
5. Update `NEAREST_HEADING` whenever a Markdown heading is encountered outside fenced code and HTML comments.
211226
6. Preserve surrounding non-comment text when removing inline comment blocks from the working plan text.
212227
7. Assign raw comment IDs in document order as `CMT-1`, `CMT-2`, ... only for non-empty blocks.
@@ -217,7 +232,7 @@ Extraction rules:
217232
For each non-empty comment block, capture:
218233

219234
- `id` (`CMT-N`)
220-
- `original_text` exactly as written between `CMT:` and `ENDCMT`
235+
- `original_text` exactly as written between the comment markers
221236
- `normalized_text` with surrounding whitespace trimmed
222237
- `start_line`, `start_column`
223238
- `end_line`, `end_column`
@@ -230,8 +245,8 @@ For each non-empty comment block, capture:
230245

231246
These are fatal extraction errors:
232247

233-
1. Nested `CMT:` while already inside a comment block
234-
2. `ENDCMT` encountered while not inside a comment block
248+
1. Nested comment start marker while already inside a comment block
249+
2. Comment end marker encountered while not inside a comment block or wrong end marker for the format
235250
3. End of file reached while still inside a comment block
236251

237252
Every fatal parse error MUST report:
@@ -243,9 +258,9 @@ Every fatal parse error MUST report:
243258

244259
Examples of acceptable messages:
245260

246-
- `Comment parse error: nested CMT block at line 48, column 3 near "## Acceptance Criteria" (context: "CMT: split AC-2...")`
247-
- `Comment parse error: stray ENDCMT at line 109, column 1 near "## Task Breakdown" (context: "ENDCMT")`
248-
- `Comment parse error: missing ENDCMT for block opened at line 72, column 5 near "## Dependencies and Sequence"`
261+
- `Comment parse error: nested comment block at line 48, column 3 near "## Acceptance Criteria" (context: "<cmt>split AC-2...")`
262+
- `Comment parse error: stray comment end marker at line 109, column 1 near "## Task Breakdown" (context: "</comment>")`
263+
- `Comment parse error: missing end marker for block opened at line 72, column 5 near "## Dependencies and Sequence"`
249264

250265
### Outputs from Phase 2
251266

@@ -403,7 +418,7 @@ Optional sections that MUST be preserved when present in the input:
403418

404419
### Refinement Rules
405420

406-
1. Remove every resolved `CMT:` / `ENDCMT` tag and all enclosed comment text from the refined plan.
421+
1. Remove every resolved comment marker and all enclosed comment text from the refined plan.
407422
2. Do not add any new top-level schema section.
408423
3. Preserve `AC-X` / `AC-X.Y` formatting.
409424
4. Preserve task IDs unless a comment explicitly requests a structural change.
@@ -429,7 +444,7 @@ Rules:
429444
Before generating the QA document, verify:
430445

431446
1. All required sections are still present
432-
2. No `CMT:` or `ENDCMT` markers remain
447+
2. No comment markers remain
433448
3. Every referenced `AC-*` exists
434449
4. Every task dependency references an existing task ID or `-`
435450
5. Every task row has exactly one valid routing tag: `coding` or `analyze`

docs/usage.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The quiz is advisory, not a gate. You always have the option to proceed. But tha
4646
```bash
4747
/humanize:gen-plan --input draft.md --output docs/plan.md
4848
```
49-
2. If the plan is reviewed with `CMT:` ... `ENDCMT` annotations, refine it and generate a QA ledger:
49+
2. If the plan is reviewed with comment annotations, refine it and generate a QA ledger:
5050
```bash
5151
/humanize:refine-plan --input docs/plan.md
5252
```
@@ -125,7 +125,7 @@ Workflow:
125125
5. Generates a structured plan.md with acceptance criteria
126126
6. Optionally starts `/humanize:start-rlcr-loop` if `--auto-start-rlcr-if-converged` conditions are met
127127

128-
If reviewers later annotate the generated plan with `CMT:` ... `ENDCMT` blocks, run
128+
If reviewers later annotate the generated plan with comment blocks, run
129129
`/humanize:refine-plan --input <plan.md>` before starting or resuming implementation.
130130

131131
### refine-plan
@@ -167,9 +167,10 @@ how each comment was handled.
167167

168168
**Annotated comment block format:**
169169

170-
`refine-plan` looks for reviewer comments wrapped in `CMT:` and `ENDCMT` markers. Both inline
171-
and multi-line comment blocks are supported:
170+
`refine-plan` supports three comment formats for reviewer annotations. Both inline
171+
and multi-line comment blocks are supported in all formats:
172172

173+
**Classic format (CMT:/ENDCMT):**
173174
```markdown
174175
Text before CMT: clarify why AC-3 is split here ENDCMT text after
175176
```
@@ -181,11 +182,36 @@ If the dependency is unclear, add a pending decision instead of guessing.
181182
ENDCMT
182183
```
183184

185+
**Short tag format (<cmt></cmt>):**
186+
```markdown
187+
Text before <cmt>clarify why AC-3 is split here</cmt> text after
188+
```
189+
190+
```markdown
191+
<cmt>
192+
Please investigate whether this task should depend on task4 or task5.
193+
If the dependency is unclear, add a pending decision instead of guessing.
194+
</cmt>
195+
```
196+
197+
**Long tag format (<comment></comment>):**
198+
```markdown
199+
Text before <comment>clarify why AC-3 is split here</comment> text after
200+
```
201+
202+
```markdown
203+
<comment>
204+
Please investigate whether this task should depend on task4 or task5.
205+
If the dependency is unclear, add a pending decision instead of guessing.
206+
</comment>
207+
```
208+
184209
Rules:
185-
- At least one non-empty `CMT:` block must exist in the input file.
186-
- `CMT:` and `ENDCMT` markers inside fenced code blocks or HTML comments are ignored.
210+
- At least one non-empty comment block must exist in the input file.
211+
- Comment markers inside fenced code blocks or HTML comments are ignored.
187212
- Empty comment blocks are removed but do not create QA ledger entries.
188213
- The input plan must still follow the `gen-plan` section schema.
214+
- All three formats can be mixed within the same file.
189215

190216
**QA output structure:**
191217

0 commit comments

Comments
 (0)