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..d3b0ac75b9 --- /dev/null +++ b/ts/packages/actionGrammar/bin/generate-grammar.js @@ -0,0 +1,23 @@ +#!/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..0267b96643 --- /dev/null +++ b/ts/packages/actionGrammar/bin/test-grammar.js @@ -0,0 +1,23 @@ +#!/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..9c62193529 --- /dev/null +++ b/ts/packages/coderWrapper/bin/coder-wrapper.js @@ -0,0 +1,20 @@ +#!/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..a3dba23397 --- /dev/null +++ b/ts/packages/kp/bin/kp-test.js @@ -0,0 +1,20 @@ +#!/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..ddb7e02359 --- /dev/null +++ b/ts/packages/security/mcpValidation/bin/mcp-plan-validation.js @@ -0,0 +1,20 @@ +#!/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",