From d80cfbd59d6988b0ad7ca089548504d2559ce2ff Mon Sep 17 00:00:00 2001 From: Curtis Man Date: Mon, 11 May 2026 15:23:54 -0700 Subject: [PATCH 1/2] fix(ts): avoid pnpm workspace bin link warnings before build --- docs/content/setup/setup-WSL2.md | 2 ++ .../actionGrammar/bin/generate-grammar.js | 19 +++++++++++++++++++ ts/packages/actionGrammar/bin/test-grammar.js | 19 +++++++++++++++++++ ts/packages/actionGrammar/package.json | 4 ++-- ts/packages/coderWrapper/bin/coder-wrapper.js | 19 +++++++++++++++++++ ts/packages/coderWrapper/package.json | 2 +- ts/packages/kp/bin/kp-test.js | 19 +++++++++++++++++++ ts/packages/kp/package.json | 2 +- .../mcpValidation/bin/mcp-plan-validation.js | 19 +++++++++++++++++++ .../security/mcpValidation/package.json | 2 +- 10 files changed, 102 insertions(+), 5 deletions(-) create mode 100755 ts/packages/actionGrammar/bin/generate-grammar.js create mode 100755 ts/packages/actionGrammar/bin/test-grammar.js create mode 100755 ts/packages/coderWrapper/bin/coder-wrapper.js create mode 100755 ts/packages/kp/bin/kp-test.js create mode 100755 ts/packages/security/mcpValidation/bin/mcp-plan-validation.js diff --git a/docs/content/setup/setup-WSL2.md b/docs/content/setup/setup-WSL2.md index 13972b2f29..c81b054975 100644 --- a/docs/content/setup/setup-WSL2.md +++ b/docs/content/setup/setup-WSL2.md @@ -17,6 +17,8 @@ This is a list of step-by-step instructions to set up a WSL2 environment from _s - `\. "$HOME/.nvm/nvm.sh"` - Install Node - `nvm install --lts` +- Setup Node native module build tools: + - `sudo apt install -y make build-essential` - Clone and build: - `git clone https://github.com/microsoft/TypeAgent ~/src/TypeAgent` (Note: you can clone this to any location and does not have to be ~/src) - `cd ~/src/TypeAgent/ts` diff --git a/ts/packages/actionGrammar/bin/generate-grammar.js b/ts/packages/actionGrammar/bin/generate-grammar.js new file mode 100755 index 0000000000..e21fc14966 --- /dev/null +++ b/ts/packages/actionGrammar/bin/generate-grammar.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +import { existsSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const cliPath = path.resolve(__dirname, "../dist/generation/generate-grammar-cli.js"); + +if (!existsSync(cliPath)) { + console.error("action-grammar has not been built yet."); + console.error("Run `pnpm -C ts/packages/actionGrammar build` or `pnpm -C ts run build` first."); + process.exit(1); +} + +await import(cliPath); diff --git a/ts/packages/actionGrammar/bin/test-grammar.js b/ts/packages/actionGrammar/bin/test-grammar.js new file mode 100755 index 0000000000..55cc14b5a8 --- /dev/null +++ b/ts/packages/actionGrammar/bin/test-grammar.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +import { existsSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const cliPath = path.resolve(__dirname, "../dist/generation/test-grammar-cli.js"); + +if (!existsSync(cliPath)) { + console.error("action-grammar has not been built yet."); + console.error("Run `pnpm -C ts/packages/actionGrammar build` or `pnpm -C ts run build` first."); + process.exit(1); +} + +await import(cliPath); diff --git a/ts/packages/actionGrammar/package.json b/ts/packages/actionGrammar/package.json index 2e2bc13190..10aade0e51 100644 --- a/ts/packages/actionGrammar/package.json +++ b/ts/packages/actionGrammar/package.json @@ -19,8 +19,8 @@ "./generation": "./dist/generation/index.js" }, "bin": { - "generate-grammar": "./dist/generation/generate-grammar-cli.js", - "test-grammar": "./dist/generation/test-grammar-cli.js" + "generate-grammar": "./bin/generate-grammar.js", + "test-grammar": "./bin/test-grammar.js" }, "files": [ "dist", diff --git a/ts/packages/coderWrapper/bin/coder-wrapper.js b/ts/packages/coderWrapper/bin/coder-wrapper.js new file mode 100755 index 0000000000..862dd0e55b --- /dev/null +++ b/ts/packages/coderWrapper/bin/coder-wrapper.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +import { existsSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const cliPath = path.resolve(__dirname, "../dist/cli.js"); + +if (!existsSync(cliPath)) { + console.error("coder-wrapper has not been built yet."); + console.error("Run `pnpm -C ts/packages/coderWrapper build` or `pnpm -C ts run build` first."); + process.exit(1); +} + +await import(cliPath); diff --git a/ts/packages/coderWrapper/package.json b/ts/packages/coderWrapper/package.json index 2e5128f771..9d4a74ff34 100644 --- a/ts/packages/coderWrapper/package.json +++ b/ts/packages/coderWrapper/package.json @@ -17,7 +17,7 @@ }, "types": "./dist/index.d.ts", "bin": { - "coder-wrapper": "./dist/cli.js" + "coder-wrapper": "./bin/coder-wrapper.js" }, "scripts": { "build": "npm run tsc", diff --git a/ts/packages/kp/bin/kp-test.js b/ts/packages/kp/bin/kp-test.js new file mode 100755 index 0000000000..af48c632f9 --- /dev/null +++ b/ts/packages/kp/bin/kp-test.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +import { existsSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const cliPath = path.resolve(__dirname, "../dist/testDriver.js"); + +if (!existsSync(cliPath)) { + console.error("kp has not been built yet."); + console.error("Run `pnpm -C ts/packages/kp build` or `pnpm -C ts run build` first."); + process.exit(1); +} + +await import(cliPath); diff --git a/ts/packages/kp/package.json b/ts/packages/kp/package.json index 421f676372..a34a110cd6 100644 --- a/ts/packages/kp/package.json +++ b/ts/packages/kp/package.json @@ -17,7 +17,7 @@ }, "types": "./dist/index.d.ts", "bin": { - "kp-test": "./dist/testDriver.js" + "kp-test": "./bin/kp-test.js" }, "files": [ "dist", diff --git a/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js b/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js new file mode 100755 index 0000000000..482418465b --- /dev/null +++ b/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + + +import { existsSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const cliPath = path.resolve(__dirname, "../dist/cli.js"); + +if (!existsSync(cliPath)) { + console.error("mcp-plan-validation has not been built yet."); + console.error("Run `pnpm -C ts/packages/security/mcpValidation build` or `pnpm -C ts run build` first."); + process.exit(1); +} + +await import(cliPath); diff --git a/ts/packages/security/mcpValidation/package.json b/ts/packages/security/mcpValidation/package.json index ab5fa53728..cf66648f72 100644 --- a/ts/packages/security/mcpValidation/package.json +++ b/ts/packages/security/mcpValidation/package.json @@ -25,7 +25,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "bin": { - "mcp-plan-validation": "dist/cli.js" + "mcp-plan-validation": "./bin/mcp-plan-validation.js" }, "files": [ "dist", From 69f4bbee1484cc92b5df4b941fd904a4d36efa11 Mon Sep 17 00:00:00 2001 From: Curtis Man Date: Mon, 11 May 2026 18:06:58 -0700 Subject: [PATCH 2/2] lint --- ts/packages/actionGrammar/bin/generate-grammar.js | 10 +++++++--- ts/packages/actionGrammar/bin/test-grammar.js | 10 +++++++--- ts/packages/coderWrapper/bin/coder-wrapper.js | 5 +++-- ts/packages/kp/bin/kp-test.js | 5 +++-- .../security/mcpValidation/bin/mcp-plan-validation.js | 5 +++-- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ts/packages/actionGrammar/bin/generate-grammar.js b/ts/packages/actionGrammar/bin/generate-grammar.js index e21fc14966..d3b0ac75b9 100755 --- a/ts/packages/actionGrammar/bin/generate-grammar.js +++ b/ts/packages/actionGrammar/bin/generate-grammar.js @@ -2,17 +2,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - import { existsSync } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const cliPath = path.resolve(__dirname, "../dist/generation/generate-grammar-cli.js"); +const cliPath = path.resolve( + __dirname, + "../dist/generation/generate-grammar-cli.js", +); if (!existsSync(cliPath)) { console.error("action-grammar has not been built yet."); - console.error("Run `pnpm -C ts/packages/actionGrammar build` or `pnpm -C ts run build` first."); + console.error( + "Run `pnpm -C ts/packages/actionGrammar build` or `pnpm -C ts run build` first.", + ); process.exit(1); } diff --git a/ts/packages/actionGrammar/bin/test-grammar.js b/ts/packages/actionGrammar/bin/test-grammar.js index 55cc14b5a8..0267b96643 100755 --- a/ts/packages/actionGrammar/bin/test-grammar.js +++ b/ts/packages/actionGrammar/bin/test-grammar.js @@ -2,17 +2,21 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - import { existsSync } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const cliPath = path.resolve(__dirname, "../dist/generation/test-grammar-cli.js"); +const cliPath = path.resolve( + __dirname, + "../dist/generation/test-grammar-cli.js", +); if (!existsSync(cliPath)) { console.error("action-grammar has not been built yet."); - console.error("Run `pnpm -C ts/packages/actionGrammar build` or `pnpm -C ts run build` first."); + console.error( + "Run `pnpm -C ts/packages/actionGrammar build` or `pnpm -C ts run build` first.", + ); process.exit(1); } diff --git a/ts/packages/coderWrapper/bin/coder-wrapper.js b/ts/packages/coderWrapper/bin/coder-wrapper.js index 862dd0e55b..9c62193529 100755 --- a/ts/packages/coderWrapper/bin/coder-wrapper.js +++ b/ts/packages/coderWrapper/bin/coder-wrapper.js @@ -2,7 +2,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - import { existsSync } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; @@ -12,7 +11,9 @@ const cliPath = path.resolve(__dirname, "../dist/cli.js"); if (!existsSync(cliPath)) { console.error("coder-wrapper has not been built yet."); - console.error("Run `pnpm -C ts/packages/coderWrapper build` or `pnpm -C ts run build` first."); + console.error( + "Run `pnpm -C ts/packages/coderWrapper build` or `pnpm -C ts run build` first.", + ); process.exit(1); } diff --git a/ts/packages/kp/bin/kp-test.js b/ts/packages/kp/bin/kp-test.js index af48c632f9..a3dba23397 100755 --- a/ts/packages/kp/bin/kp-test.js +++ b/ts/packages/kp/bin/kp-test.js @@ -2,7 +2,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - import { existsSync } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; @@ -12,7 +11,9 @@ const cliPath = path.resolve(__dirname, "../dist/testDriver.js"); if (!existsSync(cliPath)) { console.error("kp has not been built yet."); - console.error("Run `pnpm -C ts/packages/kp build` or `pnpm -C ts run build` first."); + console.error( + "Run `pnpm -C ts/packages/kp build` or `pnpm -C ts run build` first.", + ); process.exit(1); } diff --git a/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js b/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js index 482418465b..ddb7e02359 100755 --- a/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js +++ b/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js @@ -2,7 +2,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - import { existsSync } from "node:fs"; import { fileURLToPath } from "node:url"; import path from "node:path"; @@ -12,7 +11,9 @@ const cliPath = path.resolve(__dirname, "../dist/cli.js"); if (!existsSync(cliPath)) { console.error("mcp-plan-validation has not been built yet."); - console.error("Run `pnpm -C ts/packages/security/mcpValidation build` or `pnpm -C ts run build` first."); + console.error( + "Run `pnpm -C ts/packages/security/mcpValidation build` or `pnpm -C ts run build` first.", + ); process.exit(1); }