Skip to content

Keep both Playgrounds in packages - #9

Merged
rponeawa merged 3 commits into
mainfrom
refactor/playgrounds-into-packages
Aug 17, 2026
Merged

rponeawa merged 3 commits into
mainfrom
refactor/playgrounds-into-packages

Conversation

@rponeawa

Copy link
Copy Markdown
Member

Why

Both Playgrounds were already workspace packages — each has a manifest, sits in the workspace, and depends on other packages through workspace:*. Only their directory said otherwise.

packages/ is where the seven architectural layers live, and Layer 7 is Applications: cli and video-cli already sat there. The Playgrounds are Applications too. The layout guide already described this arrangement, naming tools/ as "boundary tests and build scripts" and the workspace as a single packages/* glob — the layout had drifted from the documentation rather than the reverse. tools/ now holds exactly what the guide says it holds.

What this buys

Three globs collapse into one: pnpm-workspace.yaml stops naming the two packages individually, tsconfig.json drops two include entries, and the root test script drops a pattern that no longer matches anything.

More usefully, the per-package import boundary in tools/repository-hygiene.test.mjs is scoped to packages/*/(src|test)/, so it could not see these two packages at all. It now reaches 36 previously unchecked files, and immediately found one: svml-playground read @narratage/runtime-local/config without declaring it, resolving only by walking up to the root install — the loophole the package guide warns about. Declared now.

Two pre-existing bugs, fixed in their own commits

Both were found by actually running the Playgrounds, and neither was caused by the move.

Paths resolved against the wrong directory. pnpm --filter … exec runs inside the package directory, so --source, --recipe and --font resolved relative to the Playground itself. The command in docs/guide/caption-playground.md could not start. The SVML Playground already handles this via INIT_CWD; the Caption Playground now does too.

Exports identified by a property nothing writes. The Playground admitted a Style by looking for a contract field inside the authored value. No package in the repository writes that field, so every Source was rejected — the documented example failed with base-caption is not narratage.caption-style@1. A Record carries its Type in TypedRecord.type, which inlineExport discarded. It now compares against captionTypes.style and narrativeTypes.captionDisplay, so a future rename becomes a type error rather than a request-time failure, and a mismatch names both Types.

Verification

Run in a clean worktree checked out from main, not in the authoring tree:

  • pnpm install --frozen-lockfile succeeds — the lockfile diff is only the two importer blocks relocating, plus the one new declaration
  • tsc -p tsconfig.json --noEmit clean
  • pnpm test — 527 tests, 0 failures, 15 environment-skipped; both Playground test files confirmed picked up by the packages/*/test/** glob
  • pnpm test:release — 4/4
  • Both Playgrounds launched: svml-playground compiles a real Source and /__svml/session returns real data; caption-playground now serves the documented command verbatim with relative paths and /__caption/session returns the authored Style

🤖 Generated with Claude Code

rponeawa and others added 3 commits August 17, 2026 18:36
The Playgrounds were already workspace packages: each has a manifest, sits in
the workspace, and depends on other packages through `workspace:*`. Only their
directory said otherwise, and it said so at a cost.

`packages/` is where the seven architectural layers live, and Layer 7 is
Applications: `cli` and `video-cli` already sat there. The Playgrounds are
Applications too, so they belong beside them. The repository layout guide
already described this arrangement, naming `tools/` as "boundary tests and
build scripts" and the workspace as a single `packages/*` glob; the layout had
drifted from the documentation rather than the reverse.

Moving them collapses three globs into one and lets the per-package import
boundary reach 36 files it could not see, because that check is scoped to
`packages/*/(src|test)/`. It immediately found one: svml-playground read
`@narratage/runtime-local/config` without declaring the dependency, which
resolved only by walking up to the root install. Declared now.

Co-Authored-By: Claude <[email protected]>
`pnpm --filter … exec` runs inside the package directory, so resolving
`--source`, `--recipe` and `--font` against the process working directory
pointed them at the Playground itself. The command the guide documents could
not start: every relative path became `packages/caption-playground/<path>`.

The SVML Playground already resolves against `INIT_CWD`, which pnpm sets to the
directory the author typed the command in. Do the same here.

Co-Authored-By: Claude <[email protected]>
The Playground admitted a Style and a display sequence by looking for a
`contract` property inside the authored value. Nothing in the repository writes
that property, so every Source was rejected: the documented example failed with
`base-caption is not narratage.caption-style@1`.

A Record carries its Type identity in `TypedRecord.type`, which `inlineExport`
discarded. Compare that Type against `captionTypes.style` and
`narrativeTypes.captionDisplay` instead of against a string this package
invented. Naming the two owners makes a future rename a type error here rather
than a request-time failure, and a mismatch now names both Types:
`caption-program is @narratage/caption@1 CaptionProgram, not
@narratage/caption@1 CaptionStyle`.

Co-Authored-By: Claude <[email protected]>
@rponeawa
rponeawa merged commit 5ba7807 into main Aug 17, 2026
1 check passed
@rponeawa
rponeawa deleted the refactor/playgrounds-into-packages branch August 17, 2026 10:41
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