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

@@ -7,16 +7,19 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./external-process-env": {
"source": "./src/external-process-env.ts",
"types": "./dist/external-process-env.d.ts",
"import": "./dist/external-process-env.js"
}
},
"files": [
"dist"
"dist",
"src"
],
"scripts": {
"build": "tsc --build --force && node ../../scripts/stage-agent-pptx-runtime.mjs",

View File

@@ -20,6 +20,8 @@
"exclude": ["node_modules", "dist", "tests"],
"references": [
{ "path": "../core" },
{ "path": "../memory-contract" }
{ "path": "../marketplace" },
{ "path": "../memory-contract" },
{ "path": "../shared" }
]
}

View File

@@ -7,6 +7,7 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
@@ -16,6 +17,7 @@
},
"files": [
"dist",
"src",
"bin"
],
"license": "MIT",
@@ -46,7 +48,7 @@
"scripts": {
"build": "tsc",
"test": "node ../../node_modules/vitest/vitest.mjs run --root ../.. --config vitest.config.ts packages/cli/tests/commands.test.ts packages/cli/tests/admin.test.ts packages/cli/tests/renderer.test.ts packages/cli/tests/memory-persistence-hard.test.ts packages/cli/tests/auth.test.ts packages/cli/tests/mode-detector.test.ts packages/cli/tests/comprehensive-e2e.test.ts packages/cli/tests/cli-runtime.test.ts",
"dev": "tsx src/index.ts"
"dev": "tsx --conditions=source src/index.ts"
},
"dependencies": {
"@waggle/core": "*",

View File

@@ -19,8 +19,8 @@
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "tests"],
"references": [
{ "path": "../core" },
{ "path": "../agent" },
{ "path": "../core" },
{ "path": "../memory-contract" },
{ "path": "../memory-mem0" }
]

View File

@@ -7,6 +7,7 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}

View File

@@ -19,6 +19,7 @@
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "tests"],
"references": [
{ "path": "../memory-contract" }
{ "path": "../memory-contract" },
{ "path": "../shared" }
]
}

View File

@@ -18,7 +18,7 @@
},
"scripts": {
"build": "tsup",
"start": "tsx src/cli.ts",
"start": "tsx --conditions=source src/cli.ts",
"test": "node ../../node_modules/vitest/vitest.mjs run --root ../.. --config vitest.config.ts packages/launcher/tests/cli.test.ts",
"prepublishOnly": "npm run build"
},

View File

@@ -12,6 +12,10 @@ export default defineConfig({
// Inline all @waggle/* workspace packages into the bundle.
// Third-party npm packages stay external (installed as dependencies).
noExternal: [/^@waggle\//],
// Build the workspace packages from their source export, not a stale dist/.
esbuildOptions(options) {
options.conditions = ['source'];
},
// Runtime packages that cannot be bundled safely.
external: [
'@huggingface/transformers',

View File

@@ -7,6 +7,7 @@
"types": "dist/index.d.ts",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
@@ -41,6 +42,7 @@
},
"files": [
"dist/",
"src/",
"README.md"
],
"keywords": [

View File

@@ -113,9 +113,11 @@ describe('marketplace CLI runtime UX', () => {
expect(pkg.main).toBe('dist/index.js');
expect(pkg.types).toBe('dist/index.d.ts');
expect(pkg.exports['.']).toEqual({
source: './src/index.ts',
import: './dist/index.js',
types: './dist/index.d.ts',
});
expect(packedFiles.has('src/index.ts')).toBe(true);
expect(packedFiles.has('dist/index.js')).toBe(true);
expect(packedFiles.has('dist/index.d.ts')).toBe(true);
expect(packedFiles.has('dist/cli.js')).toBe(true);

View File

@@ -14,7 +14,8 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true
"isolatedModules": true,
"composite": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]

View File

@@ -6,6 +6,7 @@
"type": "module",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}

View File

@@ -6,6 +6,7 @@
"type": "module",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}

View File

@@ -17,5 +17,8 @@
"composite": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "tests"]
"exclude": ["node_modules", "dist", "tests"],
"references": [
{ "path": "../memory-contract" }
]
}

View File

@@ -6,7 +6,11 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./src/index.ts"
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"license": "MIT",
"scripts": {

View File

@@ -17,5 +17,8 @@
"composite": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "tests"]
"exclude": ["node_modules", "dist", "tests"],
"references": [
{ "path": "../shared" }
]
}

View File

@@ -3,15 +3,27 @@
"version": "0.1.0",
"type": "module",
"exports": {
"./local": "./src/local/index.ts",
"./local/service": "./src/local/service.ts",
"./local/routes/*": "./src/local/routes/*.ts"
"./local": {
"source": "./src/local/index.ts",
"types": "./dist/local/index.d.ts",
"import": "./dist/local/index.js"
},
"./local/service": {
"source": "./src/local/service.ts",
"types": "./dist/local/service.d.ts",
"import": "./dist/local/service.js"
},
"./local/routes/*": {
"source": "./src/local/routes/*.ts",
"types": "./dist/local/routes/*.d.ts",
"import": "./dist/local/routes/*.js"
}
},
"scripts": {
"dev": "tsx watch src/local/start.ts",
"dev": "tsx watch --conditions=source src/local/start.ts",
"build": "tsc",
"test": "node ../../node_modules/vitest/vitest.mjs run --root ../.. --config vitest.config.ts packages/server/tests --maxWorkers=1 --silent",
"start:local": "tsx src/local/start.ts"
"start:local": "tsx --conditions=source src/local/start.ts"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.78.0",

View File

@@ -16,9 +16,15 @@
"sourceMap": true,
"composite": true
},
"references": [
{ "path": "../shared" }
],
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "tests"]
"exclude": ["node_modules", "dist", "tests"],
"references": [
{ "path": "../agent" },
{ "path": "../core" },
{ "path": "../marketplace" },
{ "path": "../memory-contract" },
{ "path": "../memory-mem0" },
{ "path": "../sdk" },
{ "path": "../shared" }
]
}

View File

@@ -4,6 +4,7 @@
"type": "module",
"exports": {
".": {
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}