From c900df882da5a84233485c2cca9e7344a7e2a51a Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 11:47:34 +0000 Subject: [PATCH 1/4] refactor: migrate from commander to @commander-js/extra-typings Replace all imports from "commander" to "@commander-js/extra-typings" to enable enhanced TypeScript type inference for command options, arguments, and action handler parameters. Changes: - Add @commander-js/extra-typings@12.1.0 to devDependencies - Update imports in 14 source files and 1 test file - No code changes required - extra-typings is a drop-in replacement Co-authored-by: Kfir Stri --- package.json | 1 + src/cli/commands/agents/index.ts | 2 +- src/cli/commands/agents/pull.ts | 2 +- src/cli/commands/agents/push.ts | 2 +- src/cli/commands/auth/login.ts | 2 +- src/cli/commands/auth/logout.ts | 2 +- src/cli/commands/auth/whoami.ts | 2 +- src/cli/commands/entities/push.ts | 2 +- src/cli/commands/functions/deploy.ts | 2 +- src/cli/commands/project/create.ts | 2 +- src/cli/commands/project/dashboard.ts | 2 +- src/cli/commands/project/deploy.ts | 2 +- src/cli/commands/project/link.ts | 2 +- src/cli/commands/site/deploy.ts | 2 +- src/cli/program.ts | 2 +- src/cli/telemetry/commander-hooks.ts | 2 +- tests/cli/testkit/CLITestkit.ts | 2 +- 17 files changed, 17 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index a2265eeb..edfa4e6b 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "devDependencies": { "@clack/prompts": "^0.11.0", + "@commander-js/extra-typings": "^12.1.0", "@stylistic/eslint-plugin": "^5.6.1", "@types/ejs": "^3.1.5", "@types/lodash.kebabcase": "^4.1.9", diff --git a/src/cli/commands/agents/index.ts b/src/cli/commands/agents/index.ts index 464e0571..0ec769e0 100644 --- a/src/cli/commands/agents/index.ts +++ b/src/cli/commands/agents/index.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import type { CLIContext } from "@/cli/types.js"; import { getAgentsPushCommand } from "./push.js"; import { getAgentsPullCommand } from "./pull.js"; diff --git a/src/cli/commands/agents/pull.ts b/src/cli/commands/agents/pull.ts index 4d9a8d07..53013bb3 100644 --- a/src/cli/commands/agents/pull.ts +++ b/src/cli/commands/agents/pull.ts @@ -1,5 +1,5 @@ import { join, dirname } from "node:path"; -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import { log } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; import { fetchAgents, writeAgents } from "@/core/resources/agent/index.js"; diff --git a/src/cli/commands/agents/push.ts b/src/cli/commands/agents/push.ts index d4a27183..9fd31e2c 100644 --- a/src/cli/commands/agents/push.ts +++ b/src/cli/commands/agents/push.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import { log } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; import { pushAgents } from "@/core/resources/agent/index.js"; diff --git a/src/cli/commands/auth/login.ts b/src/cli/commands/auth/login.ts index 623d1d11..c95600f3 100644 --- a/src/cli/commands/auth/login.ts +++ b/src/cli/commands/auth/login.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import type { CLIContext } from "@/cli/types.js"; import { runCommand } from "@/cli/utils/index.js"; import { login } from "./login-flow.js"; diff --git a/src/cli/commands/auth/logout.ts b/src/cli/commands/auth/logout.ts index 1fc2cde8..43a5f9dc 100644 --- a/src/cli/commands/auth/logout.ts +++ b/src/cli/commands/auth/logout.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import type { CLIContext } from "@/cli/types.js"; import { deleteAuth } from "@/core/auth/index.js"; import { runCommand } from "@/cli/utils/index.js"; diff --git a/src/cli/commands/auth/whoami.ts b/src/cli/commands/auth/whoami.ts index b45aa69a..4858aeb8 100644 --- a/src/cli/commands/auth/whoami.ts +++ b/src/cli/commands/auth/whoami.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import type { CLIContext } from "@/cli/types.js"; import { readAuth } from "@/core/auth/index.js"; import { runCommand, theme } from "@/cli/utils/index.js"; diff --git a/src/cli/commands/entities/push.ts b/src/cli/commands/entities/push.ts index 22077bfe..181c11f3 100644 --- a/src/cli/commands/entities/push.ts +++ b/src/cli/commands/entities/push.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import { log } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; import { pushEntities } from "@/core/resources/entity/index.js"; diff --git a/src/cli/commands/functions/deploy.ts b/src/cli/commands/functions/deploy.ts index 718bbe30..932039d7 100644 --- a/src/cli/commands/functions/deploy.ts +++ b/src/cli/commands/functions/deploy.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import { log } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; import { pushFunctions } from "@/core/resources/function/index.js"; diff --git a/src/cli/commands/project/create.ts b/src/cli/commands/project/create.ts index 9b83d71d..0aeaf699 100644 --- a/src/cli/commands/project/create.ts +++ b/src/cli/commands/project/create.ts @@ -1,6 +1,6 @@ import { resolve, join, basename } from "node:path"; import { execa } from "execa"; -import { Argument, Command } from "commander"; +import { Argument, Command } from "@commander-js/extra-typings"; import { log, group, text, select, confirm, isCancel } from "@clack/prompts"; import type { Option } from "@clack/prompts"; import kebabCase from "lodash.kebabcase"; diff --git a/src/cli/commands/project/dashboard.ts b/src/cli/commands/project/dashboard.ts index 7174ac9e..a1a4d91f 100644 --- a/src/cli/commands/project/dashboard.ts +++ b/src/cli/commands/project/dashboard.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import open from "open"; import type { CLIContext } from "@/cli/types.js"; import { runCommand, getDashboardUrl } from "@/cli/utils/index.js"; diff --git a/src/cli/commands/project/deploy.ts b/src/cli/commands/project/deploy.ts index 93ac3980..c76b351a 100644 --- a/src/cli/commands/project/deploy.ts +++ b/src/cli/commands/project/deploy.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import { confirm, isCancel, log } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; import { diff --git a/src/cli/commands/project/link.ts b/src/cli/commands/project/link.ts index fdad9793..6d09b740 100644 --- a/src/cli/commands/project/link.ts +++ b/src/cli/commands/project/link.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import type { Option } from "@clack/prompts"; import { log, group, text, select, isCancel, cancel } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; diff --git a/src/cli/commands/site/deploy.ts b/src/cli/commands/site/deploy.ts index b33efa6b..7f158357 100644 --- a/src/cli/commands/site/deploy.ts +++ b/src/cli/commands/site/deploy.ts @@ -1,5 +1,5 @@ import { resolve } from "node:path"; -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import { confirm, isCancel } from "@clack/prompts"; import type { CLIContext } from "@/cli/types.js"; import { readProjectConfig } from "@/core/project/index.js"; diff --git a/src/cli/program.ts b/src/cli/program.ts index 77474222..39d710e5 100644 --- a/src/cli/program.ts +++ b/src/cli/program.ts @@ -1,4 +1,4 @@ -import { Command } from "commander"; +import { Command } from "@commander-js/extra-typings"; import type { CLIContext } from "./types.js"; import { getLoginCommand } from "@/cli/commands/auth/login.js"; import { getWhoamiCommand } from "@/cli/commands/auth/whoami.js"; diff --git a/src/cli/telemetry/commander-hooks.ts b/src/cli/telemetry/commander-hooks.ts index 16b18805..aef80dd7 100644 --- a/src/cli/telemetry/commander-hooks.ts +++ b/src/cli/telemetry/commander-hooks.ts @@ -1,4 +1,4 @@ -import type { Command } from "commander"; +import type { Command } from "@commander-js/extra-typings"; import type { ErrorReporter } from "./error-reporter.js"; /** diff --git a/tests/cli/testkit/CLITestkit.ts b/tests/cli/testkit/CLITestkit.ts index 8e16cee2..9d51ce3c 100644 --- a/tests/cli/testkit/CLITestkit.ts +++ b/tests/cli/testkit/CLITestkit.ts @@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url"; import { mkdir, writeFile, cp, readFile } from "node:fs/promises"; import { vi } from "vitest"; import { dir } from "tmp-promise"; -import type { Command } from "commander"; +import type { Command } from "@commander-js/extra-typings"; import { CLIResultMatcher } from "./CLIResultMatcher.js"; import { Base44APIMock } from "./Base44APIMock.js"; import type { CLIResult } from "./CLIResultMatcher.js"; From 7dbd4c7f59a9b15179e62a60efe09577fb88e0b4 Mon Sep 17 00:00:00 2001 From: Kfir Strikovsky Date: Sun, 1 Feb 2026 13:55:16 +0200 Subject: [PATCH 2/4] update package log --- package-lock.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/package-lock.json b/package-lock.json index da6d7429..3aa8dcfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ }, "devDependencies": { "@clack/prompts": "^0.11.0", + "@commander-js/extra-typings": "^12.1.0", "@stylistic/eslint-plugin": "^5.6.1", "@types/ejs": "^3.1.5", "@types/lodash.kebabcase": "^4.1.9", @@ -145,6 +146,16 @@ "sisteransi": "^1.0.5" } }, + "node_modules/@commander-js/extra-typings": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@commander-js/extra-typings/-/extra-typings-12.1.0.tgz", + "integrity": "sha512-wf/lwQvWAA0goIghcb91dQYpkLBcyhOhQNqG/VgWhnKzgt+UOMvra7EX/2fv70arm5RW+PUHoQHHDa6/p77Eqg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "commander": "~12.1.0" + } + }, "node_modules/@emnapi/core": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.8.1.tgz", From ddad12bea8d4be8e60ec3dbc2116fc8532d834b6 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 12:03:38 +0000 Subject: [PATCH 3/4] fix: add proper type annotations for @commander-js/extra-typings Updated Command types in create.ts, link.ts, and commander-hooks.ts to properly leverage the enhanced type inference provided by @commander-js/extra-typings. - Added Command<[string | undefined], CreateOptions> type to create.ts - Added Command<[], LinkOptions> type to link.ts - Changed commander-hooks.ts to use CommandUnknownOpts and generic Command These changes fix TypeScript errors that were exposed by the stricter type checking in @commander-js/extra-typings. Co-authored-by: Kfir Stri --- src/cli/commands/project/create.ts | 6 +++--- src/cli/commands/project/link.ts | 6 +++--- src/cli/telemetry/commander-hooks.ts | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cli/commands/project/create.ts b/src/cli/commands/project/create.ts index 0aeaf699..5f8420d6 100644 --- a/src/cli/commands/project/create.ts +++ b/src/cli/commands/project/create.ts @@ -45,8 +45,8 @@ async function getTemplateById(templateId: string): Promise