Skip to content

refactor: deepen the Task document - #44

Merged
frantufro merged 1 commit into
mainfrom
refactor/deepen-task-document
Nov 13, 2026
Merged

frantufro merged 1 commit into
mainfrom
refactor/deepen-task-document

Conversation

@frantufro

Copy link
Copy Markdown
Owner

Summary

Adds core/task_doc.rs, a Task document module that parses and renders the whole Task file.

  • Interface: TaskDoc::new(title, body, date), TaskDoc::parse(text), .title(), .meta(), .render(). Parse then render is lossless.
  • core/frontmatter.rs is absorbed. Its parse and render functions are now private to the module; TaskMeta stays public.
  • The H1 title rule (first_h1, titled_body) lives only in task_doc.rs. parse_top_heading moved out of core/roadmap.rs.
  • read_body was duplicated in commands/new.rs and commands/roadmap/new.rs; both now call the shared one. Roadmap new uses titled_body (no frontmatter).
  • commands/list.rs reads metadata through TaskDoc::parse.
  • read_task_title in core/roadmap.rs is now a thin call to TaskDoc::title, so the Roadmap module work can drop it.
  • File output is byte-identical. One edge difference: title() searches the body after the frontmatter, so a # line inside frontmatter is no longer taken as the title.
  • Task deepen-the-task-document moved to done.

Pairing with the Roadmap module PR

The task depends on deepen-the-roadmap-module, which is not merged. Likely conflicts with that PR: src/core/roadmap.rs (read_task_title, extract_first_h1, extract_roadmap_title, removed parse_top_heading and its tests, a new use) and src/commands/roadmap/new.rs. The sibling table/JSON PR may touch src/commands/list.rs, and the Task store PR may touch src/commands/new.rs and src/core/slug.rs imports.

Verification

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings -W clippy::pedantic (local stable toolchain, not the pinned 1.98.0)
  • cargo test --locked (unit tests plus tests/new.rs, tests/roadmap.rs and the rest all pass)

@frantufro
frantufro force-pushed the refactor/deepen-task-document branch from 7b29216 to 038d1a7 Compare November 13, 2026 13:00
TaskDoc parses and renders frontmatter, the H1 title and the body.
core/frontmatter.rs moves into core/task_doc.rs, the H1 rule and
read_body are shared by both new commands, and list reads metadata
through TaskDoc. File output is unchanged.
@frantufro
frantufro force-pushed the refactor/deepen-task-document branch from 038d1a7 to 1ef22bf Compare November 13, 2026 13:18
@frantufro
frantufro merged commit b72c2c5 into main Nov 13, 2026
5 checks passed
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.

1 participant