build: one tsc -b build and a source export condition (P2.1)

- tsconfig.build.json references the nine in-scope packages; each package
  is composite and references the workspace packages it depends on.
  build:packages is now `tsc -b tsconfig.build.json` instead of a chain
  of cd commands.
- Every in-scope package exports its TypeScript entry under a `source`
  condition next to the dist/ entries. Vitest, tsx (dev:server, the
  Tauri dev launch, the e2e server), the sidecar and launcher bundles and
  the web app resolve it, so none of them needs build:packages first or
  can pick up a stale dist/. The vitest src aliases remain only for the
  excluded packages that have no source export.
- Published packages with a files list (agent, cli, marketplace) pack
  src/ too, so the source condition never points at a missing file.
- tsconfig.tests.json and `npm run typecheck:tests` type-check the test
  suites of the in-scope packages. They report 426 existing errors, so
  the CI step is advisory for now.
- The root test run leaves out the excluded and postponed packages
  (hive-mind-*, memory-mcp, wiki-compiler, team-server, waggle-dance,
  worker, weaver); they are not built either.
- CI runs the test job on Ubuntu, macOS and Windows with Node 22.23.2
  (ADR-0008), and no longer builds the hook runtime and the memory MCP
  server.
This commit is contained in:
shumeiko.it
2026-10-24 17:14:29 +02:00
parent bbfb3c7f82
commit 23431550ae
32 changed files with 205 additions and 103 deletions

View File

@@ -173,23 +173,11 @@ try {
format: 'esm',
outfile: outFile,
external: EXTERNAL,
// P4/D12: workspace package metadata can resolve to gitignored dist/.
// Alias all bundled first-party packages to their tracked source entry.
// Without these aliases the bundle silently embeds whatever dist/ was
// last compiled — the same stale-server-in-the-binary class D12 exists
// to kill — and a clean checkout can't build at all without
// build:packages. Alias to source so the bundle ALWAYS compiles from
// src, like the vitest aliases do. Exact subpath aliases must precede
// their package root so esbuild never appends a subpath to index.ts.
alias: {
'@waggle/agent/external-process-env': path.join(root, 'packages', 'agent', 'src', 'external-process-env.ts'),
'@waggle/agent': path.join(root, 'packages', 'agent', 'src', 'index.ts'),
'@waggle/core': path.join(root, 'packages', 'core', 'src', 'index.ts'),
'@waggle/marketplace': path.join(root, 'packages', 'marketplace', 'src', 'index.ts'),
'@waggle/memory-contract': path.join(root, 'packages', 'memory-contract', 'src', 'index.ts'),
'@waggle/memory-mem0': path.join(root, 'packages', 'memory-mem0', 'src', 'index.ts'),
'@waggle/shared': path.join(root, 'packages', 'shared', 'src', 'index.ts'),
},
// P4/D12: workspace packages publish dist/ entries, which are gitignored
// and can be stale. Every first-party package also exports its source
// under the `source` condition, so the bundle always compiles from src/
// and a clean checkout builds without build:packages.
conditions: ['source'],
sourcemap: false,
minify: true,
// metafile lets stage-sidecar-deps.mjs enumerate exactly which of the