AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
fix(cli): compile the CLI with strict TypeScript (#16118)
Abdul611efc78440d
diff --git a/bun.lock b/bun.lockindex ee381839394..e39d84a1098 100644--- a/bun.lock+++ b/bun.lock@@ -93,6 +93,8 @@},"devDependencies": {"@types/autocannon": "7.12.7",+ "@types/inquirer": "8.2.13",+ "@types/jsonwebtoken": "9.0.10","@types/node": "24.11.0",},},@@ -14575,6 +14577,8 @@"@types/http-errors": ["@types/[email protected]", "", {}, "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg=="],+ "@types/inquirer": ["@types/[email protected]", "", { "dependencies": { "@types/through": "*", "rxjs": "^7.2.0" } }, "sha512-shSvl3mn4Z8AK627kA1vx8PYkyH6CdIjV5NYYj7a0xIxzmG3ZgzEpzCi3CWfktjAlq+0Z0wHJGtWNiACaYpeOg=="],+"@types/is-url": ["@types/[email protected]", "", {}, "sha512-46VLdbWI8Sc+hPexQ6NLNR2YpoDyDZIpASHkJQ2Yr+Kf9Giw6LdCTkwOdsnHKPQeh7xTjTmSnxbE8qpxYuCiHA=="],"@types/js-cookie": ["@types/[email protected]", "", {}, "sha512-aLkWa0C0vO5b4Sr798E26QgOkss68Un0bLjs7u9qxzPT5CG+8DuNTffWES58YzJs3hrVAOs1wonycqEBqNJubA=="],@@ -14681,6 +14685,8 @@"@types/symlink-or-copy": ["@types/[email protected]", "", {}, "sha512-MQ1AnmTLOncwEf9IVU+B2e4Hchrku5N67NkgcAHW0p3sdzPe0FNMANxEm6OJUzPniEQGkeT3OROLlCwZJLWFZA=="],+ "@types/through": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ=="],+"@types/tinycolor2": ["@types/[email protected]", "", {}, "sha512-uLJijDHN5E6j5n1qefF9oaeplgszXglWXWTviMoFr/YxgvbyrkFil20yDT7ljhCiTQ/BfCYtxfJS81LdTro5DQ=="],"@types/tough-cookie": ["@types/[email protected]", "", {}, "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA=="],diff --git a/packages/cli/package.json b/packages/cli/package.jsonindex 4e145770d8c..5f4a9eb273c 100644--- a/packages/cli/package.json+++ b/packages/cli/package.json@@ -30,6 +30,8 @@},"devDependencies": {"@types/autocannon": "7.12.7",+ "@types/inquirer": "8.2.13",+ "@types/jsonwebtoken": "9.0.10","@types/node": "24.11.0"}}diff --git a/packages/cli/src/lib/commands/build-piece.ts b/packages/cli/src/lib/commands/build-piece.tsindex 1f4e81aeab4..13710b058a6 100644--- a/packages/cli/src/lib/commands/build-piece.ts+++ b/packages/cli/src/lib/commands/build-piece.ts@@ -1,10 +1,11 @@import { Command } from "commander";-import { buildPiece, findPiece } from '../utils/piece-utils';+import { assertPieceExists, buildPiece, findPiece } from '../utils/piece-utils';import chalk from "chalk";import inquirer from "inquirer";async function buildPieces(pieceName: string) {const pieceFolder = await findPiece(pieceName);+ assertPieceExists(pieceFolder);const { outputFolder } = await buildPiece(pieceFolder);console.info(chalk.green(`Piece '${pieceName}' built and packed successfully at ${outputFolder}.`));}diff --git a/packages/cli/src/lib/commands/generate-translation-file-for-piece.ts b/packages/cli/src/lib/commands/generate-translation-file-for-piece.tsindex aa044081a4f..5b6d0c49325 100644--- a/packages/cli/src/lib/commands/generate-translation-file-for-piece.ts+++ b/packages/cli/src/lib/commands/generate-translation-file-for-piece.ts@@ -1,9 +1,9 @@import { writeFile } from 'node:fs/promises';import chalk from 'chalk';import { Command } from 'commander';-import { buildPackage, findPiece, findPieces } from '../utils/piece-utils';+import { assertPieceExists, buildPackage, findPiece, findPieces } from '../utils/piece-utils';import { makeFolderRecursive, readPackageJson } from '../utils/files';-import { join } from 'node:path';+import { basename, join } from 'node:path';import { exec } from '../utils/exec';import { pieceTranslation } from '@activepieces/pieces-framework';import { MAX_KEY_LENGTH_FOR_CORWDIN } from '@activepieces/shared';@@ -66,6 +66,7 @@ const generateTranslationFileFromPiece = (piece: Record<string, unknown>) => { cconst generateTranslationFile = async (pieceName: string) => {const pieceRoot = await findPiece(pieceName)+ assertPieceExists(pieceRoot)const packageJson = await readPackageJson(pieceRoot)await buildPackage(packageJson.name)try{@@ -94,7 +95,7 @@ export const generateTranslationFileForPieceCommand = new Command('generate-tran.requiredOption('--shard-total <shardTotal>', 'Total number of shards', (value) => parseInt(value, 10)).action(async ({shardIndex, shardTotal}: { shardIndex: number; shardTotal: number }) => {const piecesDirectory = join(process.cwd(), 'packages', 'pieces', 'community')- const pieces = (await findPieces(piecesDirectory)).map(piece => piece.split('/').pop());+ const pieces = (await findPieces(piecesDirectory)).map(piece => basename(piece));let totalTime = 0let indexAcrossAllPieces = 0for (const piece of pieces) {diff --git a/packages/cli/src/lib/commands/sync-pieces.ts b/packages/cli/src/lib/commands/sync-pieces.tsindex fc5cbc5bfe6..1308da841f5 100644--- a/packages/cli/src/lib/commands/sync-pieces.ts+++ b/packages/cli/src/lib/commands/sync-pieces.ts@@ -7,7 +7,7 @@ async function syncPieces(params:{apiUrl: string,apiKey: string,- pieces: string[] | null,+ pieces: string[] | undefined,failOnError: boolean,}) {const piecesDirectory = join(process.cwd(), 'packages', 'pieces', 'custom')@@ -28,7 +28,7 @@ export const syncPieceCommand = new Command('sync').option('-f, --fail-on-error', 'Exit the process if an error occurs while syncing a piece', false).action(async (options) => {const apiKey = process.env.AP_API_KEY;- const pieces = options.pieces ? [...new Set<string>(options.pieces)] : null;+ const pieces = options.pieces ? [...new Set<string>(options.pieces)] : undefined;const failOnError = options.failOnError;if (!apiKey) {console.error(chalk.red('AP_API_KEY environment variable is required'));diff --git a/packages/cli/src/lib/utils/piece-utils.ts b/packages/cli/src/lib/utils/piece-utils.tsindex 2c72ab9a619..37e5f695208 100644--- a/packages/cli/src/lib/utils/piece-utils.ts+++ b/packages/cli/src/lib/utils/piece-utils.ts@@ -120,7 +120,7 @@ export async function publishPieceFromFolder(}}} else {- console.error(chalk.red(`Unexpected error: ${error.message}`));+ console.error(chalk.red(`Unexpected error: ${error instanceof Error ? error.message : String(error)}`));if (failOnError) {console.info(chalk.yellow(`Terminating process due to unexpected error for piece '${packageJson.name}' (fail-on-error is enabled)`));process.exit(1);@@ -165,12 +165,12 @@ export function displayNameToCamelCase(input: string): string {return camelCaseWords.join('');}-export const assertPieceExists = async (pieceName: string | null) => {+export function assertPieceExists(pieceName: string | null): asserts pieceName is string {if (!pieceName) {console.error(chalk.red(`🚨 Piece ${pieceName} not found`));process.exit(1);}- };+ }export const removeStartingSlashes = (str: string) => {diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.jsonindex 35b8169b216..54426b2de1e 100644--- a/packages/cli/tsconfig.json+++ b/packages/cli/tsconfig.json@@ -2,6 +2,7 @@"extends": "../../tsconfig.base.json","compilerOptions": {"module": "commonjs",+ "strict": true,},"files": [],"include": [],