T-AZKG-harden-vendored-augmented-ts-packages
Status: closed/done · Impact: medium · Complexity: small
The augmented_books adoption (T-LVLY, merged #911) vendored packages into
packages/ts/, and the consuming Nuxt apps (T-6C0Z, T-KTGF) surfaced
four packaging gaps in those vendored packages. Close all four so the packages
build cleanly through moon and don’t dirty consumer worktrees.
| Location | Role today |
|---|---|
packages/ts/*/moon.yml | Vendored packages have test/check tasks but no build task, so moon run <consumer>:build can’t build the dependency subgraph (^:build) |
.gitignore | No ignore for packages/ts/*/dist/; building a package leaves untracked artifacts that dirty the worktree |
packages/ts/render/src/wikilinks/plugin.ts | Line 87 has a real TS2322 (string assigned to hast’s Properties.className, typed string[]); tsc emits dist anyway |
packages/ts/entity/package.json | exports["."] points at dist/index.js, but src/ has no index.ts, so the main export is broken (build emits dist/entity/…) |
Proposed
Section titled “Proposed”Each vendored packages/ts/* package with a build script has a moon build
task with deps: ['^:build']; packages/ts/*/dist/ is gitignored; render
typechecks clean; and @augmented/entity’s . export resolves.
Approach
Section titled “Approach”- Add a
buildmoon task (command: 'bun run build',deps: ['^:build'],toolchains: 'system') to each vendored package that carries abuildscript. - Add
packages/ts/*/dist/to the root.gitignore(verify nothing is currently tracked there first). - Fix
render’sclassNameto a token array ([cssClass]) — the idiomatic hast shape, not a cast. - Add
packages/ts/entity/src/index.tsre-exporting the package’s v1 public barrel so the build emitsdist/index.js.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
packages/ts/books/moon.yml | modify | Add build task (+ 9 sibling packages) |
.gitignore | modify | Ignore packages/ts/*/dist/ |
packages/ts/render/src/wikilinks/plugin.ts | modify | className: [cssClass] |
packages/ts/entity/src/index.ts | new | Re-export the v1 public barrel |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: Each vendored
packages/ts/*package with abuildscript has a moonbuildtask withdeps: ['^:build']. - AC-2:
packages/ts/*/dist/is gitignored and nodist/is untracked after building. - AC-3:
bunx tsc --noEmitinpackages/ts/renderis clean. - AC-4:
@augmented/entity’s.export resolves (import … from '@augmented/entity'yields the public API). - AC-5: Root
bunx tsc --noEmitis clean; all vendored packages build in dependency order.
Out of scope
Section titled “Out of scope”- Migrating
apps/augmented_web/apps/vimit_prototypeoff the legacy moon-1.x schema that breaksmoon runrepo-wide — a separate follow-up (see post-mortem). - The h3 v1/v2 skew (
T-CTJF).
Dependencies
Section titled “Dependencies”- none — the vendored packages are already on
origin/main(#911).
Discovery context
Section titled “Discovery context”- Surfaced by
T-6C0Z’s post-mortem while buildinglearn_web(which consumes 8 of these packages).
Post-mortem
Section titled “Post-mortem”Captured by /sdlc:task-work on 2026-07-19. PR: pending.
Acceptance criteria coverage
Section titled “Acceptance criteria coverage”- AC-1: agent-manual —
buildtask added to 9 packages (books, context, entity, hierarchy, logging, render, utils, json-canvas-core, json-canvas-vue);test-vue-componentskipped (no build script). A tenth (obsidian-bases-augment) was covered here but dropped when the merge withmainpicked up 09d8f775, which deletes that vendored fork wholesale. No existingpackages/ts/*build task to mirror (build tasks lived only inapps/*), so modeled on the siblingtest/checktasks + the app^:buildconvention. - AC-2: auto —
packages/ts/*/dist/added to root.gitignore;git ls-files 'packages/ts/*/dist'was empty (nothing tracked); post-buildgit statusshows nodist. - AC-3: auto —
renderclassName: cssClass→[cssClass](hastProperties.classNameisstring[]);tsc --noEmitin render exits 0. - AC-4: agent-manual — added
packages/ts/entity/src/index.ts(export * from "./entity/v1/index.js"); build emitsdist/index.js+.d.ts;import … from '@augmented/entity'resolvedcreateServicefrom a consumer. - AC-5: auto — all packages build in topological order
(utils/logging/context/hierarchy/render/json-canvas-core →
entity/json-canvas-vue → books), each exit 0; root
bunx tsc --noEmitexit 0.
What worked
Section titled “What worked”- The
^:builddependency ordering the new moon tasks declare matches the real build graph (e.g.entityresolves@augmented/utilsonly onceutils/distexists). - The two package bugs (
rendertype,entityexport) were both small, correct fixes — not casts or workarounds.
Friction and automation gaps
Section titled “Friction and automation gaps”moon runis broken repo-wide (new follow-up):apps/augmented_web/moon.yml(from #925) andapps/vimit_prototype/moon.yml(from #926) carry legacy moon-1.x schema (type: application,local: true) that moon 2.4.3 rejects during global project-graph parse, somoon run <anything>aborts before running. Present onmain. The newbuildtasks here are therefore validated structurally + by building each package in dependency order, not viamoon run. Fix: migrate those two appmoon.ymlfiles to the moon 2.x schema (layer:/stack:/language:; drop/portlocal:) — worth its own task.- No
packages/ts/*package shipped a moonbuildtask from the vendor, and theirdist/wasn’t gitignored — both should be part of the adoption recipe for vendoring a buildable TS package.