Commit Graph

21 Commits

Author SHA1 Message Date
02020309eb test: rebuild the view-skeleton suite on ADR 0009 tiers (task 0003)
Guard the CLI entry's program.parse() behind import.meta.main so the
command module can be imported without running the CLI, then rebuild the
deleted suite across the three tiers ADR 0009 defines:

- unit: parse (core) and render (bin), asserted on return values
- integration: the view command function, asserted on its Result
- e2e: the kitchen binary as a subprocess (exit codes, streams, ANSI
  suppression, errors, --help)

Drop the stale test-support.ts coverage ignore and refresh the task's
implementation notes to describe the tiered suite.
2026-07-28 22:41:59 -04:00
e16f3f957d docs: record testing tiers (ADR 0009), link from 0008 (task 0003)
Add ADR 0009 defining the unit / integration / e2e tiers by the seam
each exercises, with the value-returning vs process-side-effecting line
as the boundary between in-process and e2e-only. Add one line to ADR
0008 noting the Result seam is what makes error propagation assertable
in-process, cross-linking 0009.
2026-07-28 22:24:42 -04:00
4aec705f2b test: remove all test files for a clean restart (task 0003)
Temporary: clear the entire test suite (unit, subprocess, the shared
helper, and the parser-integration placeholder) so the tests can be
rebuilt from scratch. Fixtures and the test tooling (bunfig, report
script) are kept. Note: `bun test` now errors on an empty suite, so the
flake's tests check is red until tests return.
2026-07-28 21:43:41 -04:00
ae542893da refactor: model bin errors as neverthrow Result values (task 0003)
Split the view command out of the entry point and make its failure a
value rather than an exception. index.ts is now scaffolding plus
dispatch; view.ts owns the behaviour, returning Result<string, ViewError>
(a plain-data tagged union) via neverthrow, with try/catch confined to a
readFile adapter. The entry point matches the Result at the boundary.

Because viewFile is a pure in-process function it is now unit-tested
directly (and counted by coverage), while the subprocess tests stay as
the end-to-end check. ADR 0008 records the errors-as-values convention.
2026-07-28 21:21:23 -04:00
313a5b60b7 test: remove roadmap todos from parse_test.ts (task 0003)
Drop the scaffolded test.todo placeholders (and the describe blocks left
empty by their removal), keeping only the six real parser tests. The
behaviours they enumerated live in the core-parser spec and tasks
0004-0007, which write their tests fresh when implemented.
2026-07-28 20:46:51 -04:00
11866a0dd5 feat: scope test report to given paths, default all (task 0003)
Forward any positional arguments to `bun test` as path filters, so
`bun run test:report packages/core` reports just core while a bare
`bun run test:report` still covers the whole repo. The report's header
records the scope.
2026-07-27 22:55:01 -04:00
0b6a52452a build: add test report generator (task 0003)
Add scripts/test-report.ts (bun run test:report): it runs the full suite
with JUnit + lcov output, then renders a gitignored reports/test-report.md
— a summary, a describe-grouped inventory (pass/todo/fail), and a
coverage table. The report is written even when tests fail and the script
exits with the test run's own status, so CI can gate on it later. Adds
fast-xml-parser (dev) for robust JUnit parsing; lcov is parsed by hand.
2026-07-27 22:51:30 -04:00
3d81d1c76e build: set up test coverage via bun (task 0003)
Add a bunfig.toml enabling coverage with text + lcov reporters, a
test:coverage script, and gitignore the coverage/ output. Test files and
the test-support helper are excluded so the numbers reflect product code
only.
2026-07-27 22:23:43 -04:00
e32b71ebf3 test: move parser tests to parse_test.ts, off the barrel (task 0003)
packages/core/src/index.ts is a pure re-export barrel with no behavior
of its own, so its behavior tests belonged next to the module they
exercise. Relocate the parser tests (and their roadmap todos) into a
co-located parse_test.ts importing parse from ./parse.ts, and drop
index_test.ts. A broken re-export is still caught by typecheck and by
the bin package importing parse through the public entrypoint.
2026-07-27 22:15:32 -04:00
8687b7501a refactor: trim Diagnostic to fields produced this slice (task 0003)
Drop the Point/Position types and the source/position fields from
Diagnostic. Nothing constructs a diagnostic yet — diagnostics is always
empty until task 0007 emits the first invalid-frontmatter warning, which
adds the locator fields back additively alongside its own tests.
2026-07-27 17:41:23 -04:00
97ecc86d63 test: add prose-fixture end-to-end smoke for kitchen view (task 0003)
Pull a reduced end-to-end smoke forward into the slice so the view flow
is exercised over a real on-disk recipe, not just a temp file.

Add fixtures/prose.md — a recipe using only this slice's modelled
constructs (frontmatter, headings, plain paragraphs) so it renders
losslessly. integration_test now runs `kitchen view fixtures/prose.md`
as a subprocess and asserts the frontmatter, separator, headings,
paragraphs, and flat document order end-to-end. smoke_test covers
`kitchen --help` exiting 0 with the view command listed.

The full fixtures/basic.md smoke remains task 0007, which needs 0004's
richer nodes before that fixture renders losslessly.
2026-07-26 08:19:26 -04:00
d1c1f330c5 feat: add kitchen view command and parser skeleton (task 0003)
Cut the first complete thread through both layers with the smallest set
of node types.

@kitchen-md/core gains a pure, total `parse` returning a
`DocumentAST` of `{ frontmatter, blocks, diagnostics }`, built from a
minimal remark pipeline (remark-parse + remark-frontmatter) with an
internal translation layer to core's own types. This slice models
frontmatter passthrough, HeadingBlock, ParagraphBlock, and TextNode;
remark's mdast does not surface in the public API.

@kitchen-md/bin gains the `view` subcommand (commander) that reads a
file, calls `parse`, and passes the AST to a pure `render` that returns
an ANSI-styled string via chalk (auto-suppressed off a TTY). Frontmatter
prints as raw YAML followed by a separator, headings styled distinctly
by level, paragraphs as prose. A missing argument prints usage and a
missing/unreadable file a human-readable error, both exiting 1.

Richer blocks/inline plus raw fallbacks are task 0004; malformed
frontmatter diagnostics and the basic.md smoke test are task 0007.
2026-07-26 07:24:32 -04:00
fdede89e0c feat: add flake app, dev shell, direnv, and checks
Layer the remaining flake outputs onto the build: a default app pointing at
the compiled binary, a dev shell exposing the pinned Bun, biome, and bun2nix,
a `use flake` .envrc for direnv, and a checks set aggregating the Bun test
tiers, a build-seam smoke check against the Nix-built binary, and biome lint
through the treefmt-nix flake-parts module.

The dev shell and the build share the one pinned nixpkgs-bun input so Bun
cannot drift between them. treefmt's biome reuses the repo's biome.json with
VCS disabled for the sandbox, and packages/core/src/index_test.ts is
reformatted by biome so the new lint gate is green.
2026-07-25 22:28:10 -04:00
8fd2e53c53 build: package the kitchen CLI as a Nix flake
Add a flake-parts flake whose default package Bun-compiles the kitchen
CLI into a self-contained native binary, built in the sandbox with
dependencies vendored by bun2nix.

Bun is pinned via a dedicated nixpkgs-bun input (Bun 1.3.13) that
bun2nix follows, so nixpkgs can track unstable without moving the
compile toolchain onto a release that emits empty binaries.

bun2nix is both a flake input and an npm devDependency, and a
postinstall hook keeps the checked-in bun.nix in sync with the lockfile.
2026-07-25 22:28:10 -04:00
1af090caa3 docs: add nix flake packaging spec and ADR
Replace the stale Bun-only project-scaffold spec with a Nix-aware
packaging spec, and record the flake-parts + bun2nix + pinned-Bun
decision as ADR 0007.
2026-07-25 20:25:19 -04:00
9958b6e6d5 docs: sync core-parser spec and add unit normalisation
Bring core-parser.md in line with the resolved design in CONTEXT.md and
ADRs 0004/0005, and promote a new decision to normalise ingredient/cookware
units.

- Full sync of the core-parser spec: diagnostics/total-function channel,
  container blocks (ListItemBlock, BlockquoteBlock), RawInline alongside
  RawBlock via position-slicing, the unified WikilinkNode/TransclusionNode
  shape as two typed nodes, and the minimal remark plugin set.
- New ADR 0006: normalise ingredient/cookware units via a known-alias table
  with passthrough, case-insensitive, canonical-only; align Timer matching
  to case-insensitive too.
- SPEC.md: units are normalised (new Units section, alias table); Timer table
  marked case-insensitive.
- CONTEXT.md: add Unit Normalisation entry, resolve the open item.
- fixtures/basic.md: add a blockquote (callout) carrying an annotation and a
  non-canonical unit so the integration test exercises containers and
  normalisation.
- Expand the core test.todo checklists to cover the new behaviour (containers,
  raw fallbacks, diagnostics, unit normalisation, wikilink/transclusion
  variants); still pending, suite stays green.
2026-07-14 21:55:09 -04:00
3ffd2b3f9f docs: resolve core parser design decisions
Capture the design decisions reached while grilling the core-parser spec:

- Parser is a total function; invalid frontmatter YAML surfaces through a
  new Document AST `diagnostics` channel instead of throwing (ADR 0004).
- Parse all of OFM losslessly via `RawBlock`/`RawInline` fallbacks with
  position-sliced verbatim source and a minimal plugin set (ADR 0005).
- Grammar-driven (not last-space) quantity/unit split, fixing the
  mixed-number collision, with trimming and multi-word unit rules.
- Container blocks nest `Block[]` so annotations surface inside
  blockquotes and list items; unified wikilink/transclusion shape.

Update SPEC.md and CONTEXT.md accordingly; no parser code yet.
2026-07-14 20:52:15 -04:00
66bb497aca test: enrich fixtures with full OFM feature coverage
Expand fixtures/basic.md beyond prose-only annotations to exercise the
OFM features the parser must model: unordered and ordered lists,
emphasis and strong, a code span, a fenced code block (proving
annotations inside code are ignored), a thematic break, and a
transclusion. Also adds an empty-braces ingredient (@black pepper{}).

Add fixtures/combined.md, a Combined Recipe demonstrating Step
References in both sectioned (#Batter:1) and headingless (#2) forms,
which do not fit cleanly into a standalone recipe file.
2026-07-14 19:50:44 -04:00
5841ae5de8 chore: add Biome and document design decisions from grill session
- Add @biomejs/biome 2.5.3 with 2-space indent, double quotes, trailing commas
- Add lint and format scripts to root package.json
- Update CONTEXT.md: resolve Structured Output shape, add Document AST, Block, Inline Node terms
- Add ADR 0002 (remark as internal Markdown parser)
- Add ADR 0003 (core defines own AST types)
- Add spec: core-parser (Parser implementation and Document AST)
- Add spec: cli-view (kitchen view <file> command)
2026-07-08 23:29:09 -04:00
d37988ec59 docs: add language spec, domain glossary, and fixture update 2026-07-08 22:35:35 -04:00
220f73d8f7 chore: scaffold Bun workspace monorepo
Sets up the initial project structure: two packages (@kitchen-md/core
and @kitchen-md/bin), shared tsconfig, shared fixtures, per-package
test stubs (unit, integration, smoke), .gitignore, and project
CLAUDE.md with Conventional Commits convention.
2026-07-08 21:33:20 -04:00