Skip to content
Open
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
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/agents/index.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/agents/pull.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/agents/push.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/auth/login.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/auth/logout.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/auth/whoami.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/entities/push.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/functions/deploy.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
9 changes: 5 additions & 4 deletions src/cli/commands/project/create.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -26,6 +26,7 @@ interface CreateOptions {
template?: string;
deploy?: boolean;
skills?: boolean;
[key: string]: unknown;
}

async function getTemplateById(templateId: string): Promise<Template> {
Expand All @@ -45,8 +46,8 @@ async function getTemplateById(templateId: string): Promise<Template> {
return template;
}

function validateNonInteractiveFlags(command: Command): void {
const { path } = command.opts<CreateOptions>();
function validateNonInteractiveFlags(command: Command<[string | undefined], CreateOptions>): void {
const { path } = command.opts();

if (path && !command.args.length) {
command.error("Non-interactive mode requires all flags: --name, --path");
Expand Down Expand Up @@ -255,7 +256,7 @@ async function executeCreate({
return { outroMessage: "Your project is set up and ready to use" };
}

export function getCreateCommand(context: CLIContext): Command {
export function getCreateCommand(context: CLIContext): Command<[string | undefined], CreateOptions> {
return new Command("create")
.description("Create a new Base44 project")
.addArgument(new Argument('name', 'Project name').argOptional())
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/project/dashboard.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/project/deploy.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions src/cli/commands/project/link.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -27,12 +27,13 @@ interface LinkOptions {
name?: string;
description?: string;
projectId?: string;
[key: string]: unknown;
}

type LinkAction = "create" | "choose";

function validateNonInteractiveFlags(command: Command): void {
const { create, name, projectId } = command.opts<LinkOptions>();
function validateNonInteractiveFlags(command: Command<[], LinkOptions>): void {
const { create, name, projectId } = command.opts();

if (create && projectId) {
command.error("--create and --projectId cannot be used together");
Expand Down Expand Up @@ -226,7 +227,7 @@ async function link(options: LinkOptions): Promise<RunCommandResult> {
return { outroMessage: "Project linked" };
}

export function getLinkCommand(context: CLIContext): Command {
export function getLinkCommand(context: CLIContext): Command<[], LinkOptions> {
return new Command("link")
.description("Link a local project to a Base44 project (create new or link existing)")
.option("-c, --create", "Create a new project (skip selection prompt)")
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/site/deploy.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/cli/program.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
8 changes: 4 additions & 4 deletions src/cli/telemetry/commander-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Command } from "commander";
import type { Command, CommandUnknownOpts } from "@commander-js/extra-typings";
import type { ErrorReporter } from "./error-reporter.js";

/**
* Get the full command name by traversing parent commands.
* e.g., "base44 entities push" → "entities push"
*/
function getFullCommandName(command: Command): string {
function getFullCommandName(command: CommandUnknownOpts): string {
const parts: string[] = [];
let current: Command | null = command;
let current: CommandUnknownOpts | null = command;

while (current) {
const name = current.name();
Expand All @@ -21,7 +21,7 @@ function getFullCommandName(command: Command): string {
return parts.join(" ");
}

export function addCommandInfoToErrorReporter(program: Command, errorReporter: ErrorReporter): void {
export function addCommandInfoToErrorReporter(program: Command<any, any>, errorReporter: ErrorReporter): void {
program.hook("preAction", (_, actionCommand) => {
const fullCommandName = getFullCommandName(actionCommand);

Expand Down
2 changes: 1 addition & 1 deletion tests/cli/testkit/CLITestkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down