Skip to content

Conversation

@fmueller
Copy link
Owner

Motivation

  • Provide a CLI workflow step to improve an existing draft against a validated SEO brief and optional feedback so the content is ready for meta and translate.
  • Allow writers to refine only selected sections and control rewrite aggressiveness and evidence requirements via --section, --intensity, and --evidence options.
  • Keep refinements grounded in the original note when provided to avoid inventing facts and preserve Markdown structure where possible.
  • Offer optional prompt artifact saving and a concise changelog to aid review and auditing of edits.

Description

  • Add a new command scribae refine (registered in src/scribae/main.py) implemented in src/scribae/refine_cli.py with flags matching the design (--in, --brief, --note, --feedback, --section, --intensity, --evidence, --out, --dry-run, --apply-feedback, --changelog, --preserve-anchors, --save-prompt).
  • Implement core refinement logic in src/scribae/refine.py including draft parsing (parse_draft), section mapping to the SeoBrief outline, snippet selection via snippets.build_snippet_block, LLM invocation, evidence handling, intensity modes, prompt artifact saving, and optional changelog generation.
  • Add prompt templates in src/scribae/prompts/refine.py with SYSTEM_PROMPT, per-section user prompt builder, and changelog prompt builder; update src/scribae/prompts/__init__.py accordingly.
  • Add tests and fixtures: tests/fixtures/draft.md and tests/unit/refine_cli_test.py exercising full refine flow, section-range behavior, evidence handling, dry-run feedback inclusion, and changelog output.

Testing

  • Ran uv run ruff check and fixed style issues; result: passed.
  • Ran uv run pytest and observed all tests passing: 121 passed.
  • Ran uv run mypy which reported type-check failures due to missing torch stubs in src/scribae/translate/mt.py and is therefore not green.
  • Manual smoke behavior verified via unit tests that scribae refine --in draft.md --brief brief.json --out refined.md produces refined markdown and respects --section, --intensity, --evidence, --dry-run, and --changelog options.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants