Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .agents/PROJECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ The package README documents the `kb.yaml` configuration schema and merge semant
**Root-level development (via `@williamthorsen/nmr`):**

- `pnpm install` - Install all dependencies
- `pnpm run bootstrap` - Build every package; required after install before the MCP server or CLI bins will run
- `nmr check` - Run typecheck, format check, lint check, and tests
- `nmr check:strict` - Strict checks including coverage and audit
- `nmr ci` - Full CI pipeline (strict checks + build)
Expand Down
2 changes: 1 addition & 1 deletion .config/wt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
[post-create]
direnv = "direnv allow"
deps = "pnpm install"
build = "nmr build"
bootstrap = "pnpm run bootstrap"
2 changes: 1 addition & 1 deletion .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
code-quality:
uses: williamthorsen/.github/.github/workflows/code-quality-pnpm-workflow.yaml@v7
with:
check-command: pnpm exec nmr build && pnpm exec nmr check:strict
check-command: pnpm exec nmr check:strict
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ See [`.agents/PROJECT.md`](.agents/PROJECT.md) for project structure, commands,

```bash
pnpm install
nmr check # Run all checks (typecheck, format, lint, test)
pnpm run bootstrap # Build every package; required before running the MCP server or CLI bins
pnpm exec nmr check # Run all checks (typecheck, format, lint, test)
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"scripts": {
"agents:install": "tsx packages/agents/src/cli.ts install",
"agents:install-launchers": "bash packages/agents/scripts/install-launchers.sh",
"bootstrap": "nmr build",
"ci:post": "pnpm --filter agents run test:sh",
"prepare": "lefthook install"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/agents/bin/codeassembly-agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const entryPoint = new URL('../dist/esm/cli.js', import.meta.url);
// module in the graph, so keying the build-first message off the error code would also
// fire when the build is present and one of its imports is missing.
if (!existsSync(entryPoint)) {
process.stderr.write('codeassembly-agents: build output not found — run `pnpm run build` first\n');
process.stderr.write('codeassembly-agents: build output not found — run `pnpm run bootstrap` first\n');
process.exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/kb/bin/kb.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const entryPoint = new URL('../dist/esm/cli/index.js', import.meta.url);
// module in the graph, so keying the build-first message off the error code would also
// fire when the build is present and one of its imports is missing.
if (!existsSync(entryPoint)) {
process.stderr.write('kb: build output not found — run `pnpm run build` first\n');
process.stderr.write('kb: build output not found — run `pnpm run bootstrap` first\n');
process.exit(1);
}

Expand Down
3 changes: 1 addition & 2 deletions packages/kb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@
"!dist/esm/test-utils"
],
"scripts": {
"build": "nmr compile",
"prepare": "nmr compile"
"build": "nmr compile"
},
"dependencies": {
"picomatch": "4.0.5",
Expand Down
3 changes: 1 addition & 2 deletions packages/lifecycle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"dist"
],
"scripts": {
"build": "nmr compile",
"prepare": "nmr compile"
"build": "nmr compile"
},
"devDependencies": {
"esbuild": "0.28.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/bin/codeassembly-mcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const entryPoint = new URL('../dist/esm/cli.js', import.meta.url);
// module in the graph, so keying the build-first message off the error code would also
// fire when the build is present and one of its imports is missing.
if (!existsSync(entryPoint)) {
process.stderr.write('codeassembly-mcp: build output not found — run `pnpm run build` first\n');
process.stderr.write('codeassembly-mcp: build output not found — run `pnpm run bootstrap` first\n');
process.exit(1);
}

Expand Down
3 changes: 1 addition & 2 deletions packages/mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"dist"
],
"scripts": {
"build": "nmr compile",
"prepare": "nmr compile"
"build": "nmr compile"
},
"dependencies": {
"@codeassembly/run-core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/__tests__/protocol-stdio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

import { Client } from '@modelcontextprotocol/sdk/client';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { describe, expect, it } from 'vitest';

import { isErrorResult, parseAndGetString } from './helpers.ts';
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/__tests__/protocol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { join } from 'node:path';

import { v3RunIndexSchema } from '@codeassembly/run-core';
import { Client } from '@modelcontextprotocol/sdk/client';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
import { afterEach, describe, expect, it } from 'vitest';

import { createServer } from '../server.ts';
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/__tests__/staleness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { join } from 'node:path';
import { pathToFileURL } from 'node:url';

import { Client } from '@modelcontextprotocol/sdk/client';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

import { isBuildStale } from '../staleness.ts';
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'node:process';

import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

import { createServer } from './server.ts';

Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';

import { isBuildStale } from './staleness.ts';
Expand Down
4 changes: 1 addition & 3 deletions packages/run-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ codeassembly-runs --path <dir> # override the base projects directory

### Bin wrapper pattern

The `bin` field in `package.json` points to `bin/codeassembly-runs.js`, a committed wrapper script that dynamically imports the build output at runtime. Do not point `bin` entries directly into `dist/` — pnpm creates bin symlinks during install, before lifecycle scripts like `prepare` run, so the target won't exist in a fresh worktree and `pnpm install` will emit confusing "Failed to create bin" warnings.

If invoked before building, the wrapper finds the entry file absent and tells the user to run `pnpm run build`. It checks for the file directly rather than keying off `ERR_MODULE_NOT_FOUND`, which Node raises for any unresolved module in the graph — including a missing dependency of a build output that is present, where advising a rebuild would be wrong. Any other load failure is reported verbatim.
The `bin` field in `package.json` points to `bin/codeassembly-runs.js`, a committed wrapper script that dynamically imports the build output at runtime. Do not point `bin` entries directly into `dist/` — pnpm creates bin symlinks during install, and nothing compiles until `pnpm run bootstrap` runs afterward, so the target won't exist in a fresh worktree and `pnpm install` will emit confusing "Failed to create bin" warnings.

Any new `bin` entry in this monorepo should follow the same pattern. See `bin/codeassembly-runs.js` for the template, and the `@williamthorsen/node-monorepo-tools` packages for the original rationale.
2 changes: 1 addition & 1 deletion packages/run-core/bin/codeassembly-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const entryPoint = new URL('../dist/esm/cli.js', import.meta.url);
// module in the graph, so keying the build-first message off the error code would also
// fire when the build is present and one of its imports is missing.
if (!existsSync(entryPoint)) {
process.stderr.write('codeassembly-runs: build output not found — run `pnpm run build` first\n');
process.stderr.write('codeassembly-runs: build output not found — run `pnpm run bootstrap` first\n');
process.exit(1);
}

Expand Down
3 changes: 1 addition & 2 deletions packages/run-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"dist"
],
"scripts": {
"build": "nmr compile",
"prepare": "nmr compile"
"build": "nmr compile"
},
"dependencies": {
"yaml": "2.9.0",
Expand Down
Loading