Skip to content

feat(cli): uteke doc export --front-matter (#1470 a) - #1647

Merged
ajianaz merged 1 commit into
developfrom
feat/doc-export-front-matter
Nov 3, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/doc-export-front-matter

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

What

uteke doc export --front-matter (#1470 item a, plan docs/plans/2026-10-29-dx-bundle-1470.md section 2). Each Markdown document gets a YAML block first:

---
slug: "chapter-1"
title: "Chapter 1: \"Getting started\""
tags: ["guide", "draft"]
parent: "book"
---
  • parent is the parent slug ("" for a root). A parent outside the exported set is looked up once so it is still named.
  • Values are JSON-quoted strings, which are valid YAML double-quoted scalars, so :, #, quotes and newlines need no extra escaping.
  • Off by default: the plain export is byte-identical. Ignored with --json (the JSON already carries these fields).
  • There is no doc import, so nothing reads the front-matter back. docs/cli-reference.md says so and points to uteke export --full / import --full for a lossless round trip.
  • Docs: CLI reference, both skill copies (the doc export row was stale: it said JSON), CHANGELOG.
  • Dev-dependency yaml-rust2 (test only) to parse the front-matter as real YAML.

Why

So a vault or static-site import keeps the document hierarchy (#1470).

Testing

Tests written first (failed to compile against the old signature), then:

  • front_matter_keeps_the_bodies_byte_identical: with the front-matter removed, the output equals the plain export.
  • front_matter_parses_as_yaml_with_awkward_titles: title with :, double and single quotes, #, newline, tab, backslash; tags a:b, #hash, - dash; parsed with yaml-rust2 and compared exactly.
  • front_matter_names_the_parent_slug_for_nested_documents: three levels, parents "", book, chapter-1.
  • json_export_ignores_the_front_matter_flag.
  • Round trip: not applicable (no doc import), documented instead.
  • Manual run on a scratch store: nested book/ch1 with an awkward title and a body containing ---; plain bodies identical to the front-matter bodies.
  • cargo fmt --check, cargo clippy -p uteke-cli --all-targets -D warnings, cargo test -p uteke-cli all pass.

Refs #1470

Prefixes each Markdown document with YAML front-matter (slug, title,
tags, parent slug) so a vault import keeps the hierarchy. Values are
JSON-quoted strings, valid YAML double-quoted scalars. Off by default:
the plain export is byte-identical; ignored with --json. No doc import
reads it back, documented in the CLI reference.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 56d989b into develop Nov 3, 2026
15 checks passed
@ajianaz
ajianaz deleted the feat/doc-export-front-matter branch November 4, 2026 06:46
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