diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 3cd5395b..78a1d5ac 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -4,6 +4,7 @@ import { AgenticApiClient } from '@agentic/platform-api-client' import { Command } from 'commander' import restoreCursor from 'restore-cursor' +import { registerDebugCommand } from './commands/debug' import { registerDeployCommand } from './commands/deploy' import { registerGetDeploymentCommand } from './commands/get' import { registerListDeploymentsCommand } from './commands/list' @@ -79,6 +80,7 @@ async function main() { registerPublishCommand(ctx) registerGetDeploymentCommand(ctx) registerListDeploymentsCommand(ctx) + registerDebugCommand(ctx) program.parse() } diff --git a/packages/cli/src/commands/debug.ts b/packages/cli/src/commands/debug.ts new file mode 100644 index 00000000..33f27697 --- /dev/null +++ b/packages/cli/src/commands/debug.ts @@ -0,0 +1,39 @@ +import { Command } from 'commander' +import { oraPromise } from 'ora' + +import type { Context } from '../types' +import { AuthStore } from '../lib/auth-store' +import { loadAgenticConfig } from '../lib/load-agentic-config' + +export function registerDebugCommand({ program, logger }: Context) { + const command = new Command('debug') + .description('Prints config for a local project.') + .option( + '-c, --cwd ', + 'The directory to load the Agentic project config from (defaults to cwd). This directory must contain an "agentic.config.{ts,js,json}" project file.' + ) + .action(async (opts) => { + AuthStore.requireAuth() + + // Load the Agentic project config, parse, and validate it. This will also + // validate any origin adapter config such as OpenAPI or MCP specs and + // embed them if they point to local files or URLs. Note that the server + // also performs validation; this is just a client-side convenience for + // failing fast and sharing 99% of the validation code between server and + // client. + const config = await oraPromise( + loadAgenticConfig({ + cwd: opts.cwd + }), + { + text: `Loading Agentic config from ${opts.cwd}`, + successText: `Agentic config loaded successfully.`, + failText: 'Failed to load Agentic config.' + } + ) + + logger.log(config) + }) + + program.addCommand(command) +} diff --git a/packages/cli/src/commands/get.ts b/packages/cli/src/commands/get.ts index 6e9898b8..b510ada6 100644 --- a/packages/cli/src/commands/get.ts +++ b/packages/cli/src/commands/get.ts @@ -10,7 +10,7 @@ export function registerGetDeploymentCommand({ logger }: Context) { const command = new Command('get') - .description('Gets details for a specific deployment') + .description('Gets details for a specific deployment.') .argument('', 'Deployment ID or identifier') .action(async (deploymentIdentifier) => { AuthStore.requireAuth() diff --git a/packages/cli/src/commands/list.ts b/packages/cli/src/commands/list.ts index 2ea8daff..41a6ba0b 100644 --- a/packages/cli/src/commands/list.ts +++ b/packages/cli/src/commands/list.ts @@ -14,7 +14,7 @@ export function registerListDeploymentsCommand({ }: Context) { const command = new Command('list') .alias('ls') - .description('Lists deployments') + .description('Lists deployments.') .argument('[projectIdentifier]', 'Optional project identifier') .option('-v, --verbose', 'Display full deployments', false) .action(async (projectIdentifier, opts) => { diff --git a/packages/cli/src/commands/signout.ts b/packages/cli/src/commands/signout.ts index 3976ad64..7c6ebf8a 100644 --- a/packages/cli/src/commands/signout.ts +++ b/packages/cli/src/commands/signout.ts @@ -6,7 +6,7 @@ import { AuthStore } from '../lib/auth-store' export function registerSignoutCommand({ client, program, logger }: Context) { const command = new Command('logout') .alias('signout') - .description('Signs the current user out') + .description('Signs the current user out.') .action(async () => { if (!client.isAuthenticated) { return diff --git a/packages/cli/src/commands/whoami.ts b/packages/cli/src/commands/whoami.ts index 64bb9b14..4b6c761d 100644 --- a/packages/cli/src/commands/whoami.ts +++ b/packages/cli/src/commands/whoami.ts @@ -5,7 +5,7 @@ import { AuthStore } from '../lib/auth-store' export function registerWhoAmICommand({ client, program, logger }: Context) { const command = new Command('whoami') - .description('Displays info about the current user') + .description('Displays info about the current user.') .action(async () => { AuthStore.requireAuth()