Skip to content

feat: add output dir short alias#132

Open
ulises-jeremias wants to merge 7 commits into
alphacrack:mainfrom
ulises-jeremias:feat/output-dir-short-alias-13
Open

feat: add output dir short alias#132
ulises-jeremias wants to merge 7 commits into
alphacrack:mainfrom
ulises-jeremias:feat/output-dir-short-alias-13

Conversation

@ulises-jeremias

Copy link
Copy Markdown
Contributor

What this changes

Adds -o as a short alias for readme2demo run --output-dir and covers it in the run command help output. Closes #13.

The grounding invariant

The LLM never publishes anything a fresh container didn't independently
execute. Grounding is enforced in code, not prompts.

  • This change does not let an unverified command reach tutorial.md,
    step_by_step.md, commands.sh, or the demo tape — or it adds a
    code-level check (not just a prompt rule) that keeps that true.
  • Sandbox hardening flags in sandbox.py are unchanged (or the change is
    explicitly discussed in the PR body).

Tests

  • python -m pytest tests/ -q passes locally.
  • Bug fixes carry a regression test named for the failure/run that found it.
    N/A — CLI enhancement.
  • parse_transcript / normalize.py changes stayed pure and
    deterministic (no LLM calls; testable against fixtures). N/A — untouched.

Prompt changes (if any)

  • N/A — this PR doesn't touch prompts/*.md.
  • Included a before/after transcript or run report as evidence.

Housekeeping

  • One concern per PR.
  • Type hints + docstrings on new/changed public functions. N/A — no public function changes.
  • If stages or boundaries moved, architecture/README.md and CLAUDE.md
    are updated to match. N/A — no stage or boundary changes.

Validation

  • PYENV_VERSION=3.13.11 python -m ruff check src/ tests/
  • /home/ulisesjcf/.pyenv/versions/3.13.11/bin/python -m pytest tests/ -q — 282 passed

@alphacrack alphacrack left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — the -o alias itself is exactly what #13 asked for, the change is conflict-free against main, and the full suite passes locally at your head merged with main. But CI is legitimately red on all four Python jobs, and it's the new test, not the feature.

test_run_help_includes_output_dir_short_alias asserts that one raw help line contains the contiguous substring --output-dir. On GitHub Actions, Rich detects GITHUB_ACTIONS=true and force-enables ANSI, so the option renders as \x1b[1;36m-\x1b[0m\x1b[1;36m-output\x1b[0m\x1b[1;36m-dir\x1b[0m — the substring never appears contiguously and the assert fails in CI while passing on any local terminal. Reproducible locally with env -u TERM GITHUB_ACTIONS=true CI=true python -m pytest tests/test_cli.py::test_run_help_includes_output_dir_short_alias. A rebase won't help; it fails the same way merged with current main.

Two robust replacements (either is fine):

  1. Introspect the click params instead of rendered text:
import typer.main

def test_run_output_dir_has_short_alias():
    cmd = typer.main.get_command(app)
    opts = {o for p in cmd.commands["run"].params for o in p.opts + p.secondary_opts}
    assert "-o" in opts and "--output-dir" in opts
  1. Or strip ANSI before asserting: plain = re.sub(r"\x1b\[[0-9;]*m", "", result.output).

Side note: as written the "-o" in line conjunct is vacuous — --output-dir already contains -o as a substring — so option 1 also makes the test actually check the alias. Once CI is green this is good to merge.

test_run_help_includes_output_dir_short_alias asserted on rendered
--help output, but Rich force-enables ANSI in CI (GITHUB_ACTIONS=true),
breaking the contiguous --output-dir string match.
Replace with typer.main.get_command to introspect click params directly:
no rendering dependency, and the alias assertion is no longer vacuous.
@ulises-jeremias

ulises-jeremias commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@alphacrack Fixed the ANSI rendering issue from the review. Replaced the help-text parse with typer.main.get_command(app) click param introspection, no rendering dependency, and the alias assertion is no longer vacuous. CI is green now 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add -o short alias for --output-dir

2 participants