Skip to content

Add public schema package and park schema command - #11

Merged
polymorcodeus merged 3 commits into
mainfrom
fm-schema
Aug 31, 2026
Merged

polymorcodeus merged 3 commits into
mainfrom
fm-schema

Conversation

@polymorcodeus

Copy link
Copy Markdown
Owner

Summary

Adds a public schema package that owns the canonical frontmatter contract and exposes it through park schema and park schema --json. This lets downstream tooling import the contract instead of re-deriving field names, categories, and the write template.

What's new

  • Public schema package - canonical Frontmatter struct, category enum (inbox, projects, areas, archive), SchemaVersion, date format, and write template; stdlib only so other tools can import it.
  • internal/note uses the contract - note.Metadata is now an alias to schema.Frontmatter; note.Write and note.Today read the template and date format from schema.
  • Config and TUI reference the enum - default categories use schema.Category* constants and internal/model/assist.go parses dates with schema.DateFormat.
  • park schema command - human-readable and JSON output surfaces the contract for scripts and downstream consumers.

Usage

Command Purpose
park schema print the human-readable frontmatter contract
park schema --json print the machine-readable contract

Behavior changes / guardrails

  • schema is a pure leaf package with no internal or Bubble Tea dependencies, so importing it from other modules is safe.
  • park schema runs through the normal Before hook but falls back to default config when no config file exists, so it works on a fresh install.
  • schema_version starts at 1 and increments only on breaking contract changes.

Testing

  • Unit tests in schema/schema_test.go cover categories, Frontmatter completeness, Render, Describe, and JSON round-tripping.
  • Existing tests across internal/note, internal/config, internal/model, and internal/store continue to pass against the aliased Metadata.
  • make check runs fmt, vet, lint, and tests; all green.

@polymorcodeus
polymorcodeus merged commit dc43880 into main Aug 31, 2026
4 checks passed
@polymorcodeus
polymorcodeus deleted the fm-schema branch August 31, 2026 14:45
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