Skip to content

Specify drawer/0.2 and printer/0.2, with dunnage check - #10

Merged
XDGFX merged 2 commits into
mainfrom
worktree-2-format-spec
Oct 2, 2026
Merged

XDGFX merged 2 commits into
mainfrom
worktree-2-format-spec

Conversation

@XDGFX

@XDGFX XDGFX commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Closes #2

What

  • Spec and JSON Schema in docs/format/: README.md (versions, checking, editors), drawer.md, printer.md, and drawer-0.2.schema.json / printer-0.2.schema.json.
  • One source for the schema. The schemas are TypeBox in src/core/schema.ts, giving the core its types. bun run schema writes the JSON; a test fails if it's stale, and Ajv validates the fixtures against the published JSON as an outside reader would.
  • Core check(text) / load(text). It runs YAML, then the format line, then the schema, then the checks a schema can't express:
    • ids resolve: items, zones, holders' holds, and review on / act.aside;
    • ids are unique;
    • poses are valid, and only the first one stacks;
    • things fit inside the walls, edge margin included, and under the drawer's height, stacks included;
    • things don't overlap obstructions or each other, with turned outlines, handles and spouts;
    • holders hold real things, each thing once, in a way the base allows.
  • Errors an agent can act on. Each problem has a path such as layout[3].at and a line and column. Union errors are narrowed to the branch the author meant: a holder is judged by its method and an item by box or cylinder, and a bad value gets a list of the values allowed.
  • dunnage check prints file:line:col: path: message and exits 1 on any problem. --json gives agents the same as JSON. The CLI also checks that the printer: profile is beside the drawer.
  • The format version is separate from the tool's. migrate steps older files up through MIGRATIONS, which is empty because 0.2 is the first published format. Newer files are refused, with versions compared numerically.

Worth knowing

  • The check found real bugs in the coffee fixture. Unquoted commas inside flow mappings ({ why: …, left to right. }) had been parsed as extra keys. They're quoted now. Hailey's prototype copy has the same bug.
  • Bumps the tool version to 0.2.0, a feature release under AGENTS.md. This is unrelated to the format version.
  • Not checked yet, because they depend on holder shapes that don't exist yet (listed in drawer.md):
    • holder floors in the height check;
    • the gap rule;
    • locked holders' shapes;
    • fitting holders to the bed;
    • Gridfinity and pegboard placement.

Tests

bun run typecheck, bun run test (54 passing), bun run build and bun run validate all pass. The built CLI also runs on Node.

🤖 Generated with Claude Code

XDGFX and others added 2 commits October 2, 2026 11:40
The formats now have a written spec and a JSON Schema in docs/format/. The
schemas are TypeBox in src/core/schema.ts, so the core's types and the
published JSON come from one place; a test fails if the JSON is stale, and
Ajv validates the fixtures against it as an outside reader would.

Core check() reads a file through YAML, the format line (older versions
migrate, newer ones are refused), the schema and then what the schema
can't say: ids resolve, things fit the drawer and miss each other, and
holders hold real things in a way the base allows. Each problem carries a
path and a line, and union errors are narrowed to the branch the author
meant. dunnage check prints them one per line, or as JSON with --json.

The check found unquoted commas in the coffee fixture's flow mappings,
which YAML had been reading as extra keys; they're quoted now.

Closes #2

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Define the id pattern and format versions in one place each, refuse
versions with leading zeros, always stamp a migrated file's format, and
describe box poses and tilts by axis, not by which edge is longer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@XDGFX
XDGFX merged commit cb99dbe into main Oct 2, 2026
3 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.

Specify drawer/0.2 and printer/0.2 as a spec and JSON Schema, with dunnage check

1 participant