feat(cli): untell humanize --html — per-span lock HTML report (Closes #30) - #44
Open
ssamba1 wants to merge 1 commit into
Open
feat(cli): untell humanize --html — per-span lock HTML report (Closes #30)#44ssamba1 wants to merge 1 commit into
ssamba1 wants to merge 1 commit into
Conversation
… per-span lock explanations (Closes #30)
There was a problem hiding this comment.
Pull request overview
Adds a new untell humanize --html output mode to emit a deterministic, self-contained HTML report (optionally wrapped in a JSON envelope), including unified diff data and per-span lock annotations derived from the existing explain/lock machinery.
Changes:
- Introduces
--htmlCLI flag plus--html --jsonenvelope output alongside existing--diff/--jsonbehavior. - Adds an HTML renderer (
render_humanize_html) that formats before/after text, scores, diff hunks, and locked-span annotations with escaping and inline CSS. - Adds a dedicated test suite for determinism, escaping, self-containment, and CLI contract behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
untell/scripts/run.py |
Adds the --html flag, suppresses progress on stdout for full-document modes, and emits either HTML or a JSON envelope containing HTML + diff. |
untell/rich_output.py |
Implements HTML report rendering and supporting helpers (escaping, score/verdict formatting, diff/lock sections). |
tests/test_humanize_html.py |
Adds tests for determinism, injection/escaping safety, self-containment expectations, and CLI surface contract for --html. |
.claude/human-queue.md |
Records the new CLI surface as an AMBER queue entry with run evidence. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+565
to
+573
| def _score_cell(score: dict, key: str, fmt: str = "{:.2f}") -> str: | ||
| """A score dict value rendered safely, or \"—\" when absent/non-numeric.""" | ||
| value = (score or {}).get(key) | ||
| if isinstance(value, (int, float)): | ||
| try: | ||
| return fmt.format(value) | ||
| except (ValueError, TypeError): # non-finite -> the dash, not a crash | ||
| return "—" | ||
| return "—" |
Comment on lines
+78
to
+79
| for marker in ("<script", "</script>", "<link ", "<img ", "src=", "href=", "http://", "https://"): | ||
| assert marker not in html, f"external-asset marker {marker!r} present in a self-contained report" |
Comment on lines
+641
to
+643
| " .badge{display:inline-block;padding:1px 8px;border-radius:999px;font-size:12px;}" | ||
| " .badge.ok{background:var(--add);color:var(--addink);}" | ||
| " .badge.no{background:var(--del);color:var(--delink);}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements issue #30:
untell humanize --htmlwrites a self-contained, deterministic HTML report of the loop run to stdout — before/after text, pre/post scores, seed, whether it rewrote, the unified --diff payload, and a per-span lock annotation (via the explain/lock machinery, the same single source of truth as lock()).--html --jsonemits a machine-readable envelope (formatuntell-html, version 1): report string + diff payload + pre/post + seed + rewrote; the --json error path stays parseable.... --html > r.htmlyields a valid page.htmlas CLI-only).Proof: 15/15 html tests, 119 targeted (diff/explain/surface), 135 CLI/enumeration, conformance humanize/loop, ruff whole-tree clean, real CLI subprocess produced a valid HTML doc (demo_report.html). Commit: 9dd4fcf — 'Closes #30'.