@nebulaos/cli 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +310 -298
- package/dist/bin/nebulaos.js +133 -17
- package/dist/bin/nebulaos.js.map +1 -1
- package/dist/index.js +135 -19
- package/dist/index.js.map +1 -1
- package/package.json +59 -59
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/program.ts","../src/lib/flags.ts","../src/lib/errors.ts","../src/commands/auth/index.ts","../src/commands/auth/login.ts","../src/lib/config.ts","../src/commands/auth/logout.ts","../src/commands/auth/status.ts","../src/lib/output.ts","../src/commands/orgs/index.ts","../src/commands/orgs/list.ts","../src/lib/api.ts","../src/commands/orgs/get.ts","../src/commands/orgs/switch.ts","../src/commands/clients/index.ts","../src/commands/clients/list.ts","../src/commands/clients/get.ts","../src/commands/clients/create.ts","../src/commands/clients/api-keys/index.ts","../src/commands/clients/api-keys/list.ts","../src/commands/clients/api-keys/create.ts","../src/commands/clients/api-keys/revoke.ts","../src/commands/resources/index.ts","../src/commands/resources/list.ts","../src/commands/resources/get.ts","../src/commands/resources/archive.ts","../src/commands/resources/unarchive.ts","../src/commands/resources/promote.ts","../src/commands/execution/index.ts","../src/commands/execution/run.ts","../src/commands/execution/list.ts","../src/commands/execution/get.ts","../src/commands/execution/logs.ts","../src/commands/rag/index.ts","../src/commands/rag/connections/index.ts","../src/commands/rag/connections/list.ts","../src/commands/rag/connections/get.ts","../src/commands/rag/connections/create.ts","../src/commands/rag/connections/update.ts","../src/commands/rag/connections/delete.ts","../src/commands/rag/connections/test.ts","../src/commands/rag/search.ts","../src/commands/features/index.ts","../src/commands/features/catalog.ts","../src/commands/features/list.ts","../src/commands/features/get.ts","../src/commands/features/enable.ts","../src/commands/features/disable.ts","../src/commands/features/config.ts","../src/commands/observability/index.ts","../src/commands/observability/traces/index.ts","../src/commands/observability/traces/search.ts","../src/commands/observability/traces/get.ts","../src/commands/observability/metrics.ts","../src/commands/config/index.ts","../src/commands/config/get.ts","../src/commands/config/set.ts","../src/commands/config/list.ts","../src/commands/llm-gateway/index.ts","../src/commands/llm-gateway/routes/index.ts","../src/commands/llm-gateway/routes/list.ts","../src/commands/llm-gateway/routes/get.ts","../src/commands/llm-gateway/routes/create.ts","../src/commands/llm-gateway/routes/update.ts","../src/commands/llm-gateway/routes/delete.ts","../src/commands/llm-gateway/keys/index.ts","../src/commands/llm-gateway/keys/list.ts","../src/commands/llm-gateway/keys/create.ts","../src/commands/llm-gateway/keys/revoke.ts","../src/commands/llm-gateway/requests.ts","../src/commands/llm-gateway/usage.ts","../src/commands/llm-gateway/catalog.ts","../src/lib/pagination.ts","../src/lib/truncate.ts","../src/lib/auth.ts"],"sourcesContent":["import { Command } from \"commander\";\r\nimport { addGlobalFlags } from \"./lib/flags.js\";\r\nimport { handleError } from \"./lib/errors.js\";\r\nimport { createAuthCommand } from \"./commands/auth/index.js\";\r\nimport { createOrgsCommand } from \"./commands/orgs/index.js\";\r\nimport { createClientsCommand } from \"./commands/clients/index.js\";\r\nimport { createResourcesCommand } from \"./commands/resources/index.js\";\r\nimport { createExecutionCommand } from \"./commands/execution/index.js\";\r\nimport { createRagCommand } from \"./commands/rag/index.js\";\r\nimport { createFeaturesCommand } from \"./commands/features/index.js\";\r\nimport { createObservabilityCommand } from \"./commands/observability/index.js\";\r\nimport { createConfigCommand } from \"./commands/config/index.js\";\r\nimport { createLlmGatewayCommand } from \"./commands/llm-gateway/index.js\";\r\n\r\nexport function createProgram(): Command {\r\n const program = new Command();\r\n\r\n program\r\n .name(\"nebulaos\")\r\n .description(\"NebulaOS CLI - Manage your AI agents, workflows, and resources\")\r\n .version(\"0.1.0\")\r\n .configureHelp({\r\n sortSubcommands: true,\r\n sortOptions: true,\r\n });\r\n\r\n addGlobalFlags(program);\r\n\r\n program.exitOverride();\r\n\r\n program.hook(\"preAction\", (_thisCommand, actionCommand) => {\r\n const opts = actionCommand.optsWithGlobals();\r\n\r\n if (opts.noColor) {\r\n process.env.NO_COLOR = \"1\";\r\n }\r\n\r\n if (opts.verbose) {\r\n process.env.NEBULAOS_VERBOSE = \"1\";\r\n }\r\n });\r\n\r\n // Register commands\r\n program.addCommand(createAuthCommand());\r\n program.addCommand(createOrgsCommand());\r\n program.addCommand(createClientsCommand());\r\n program.addCommand(createResourcesCommand());\r\n program.addCommand(createExecutionCommand());\r\n program.addCommand(createRagCommand());\r\n program.addCommand(createFeaturesCommand());\r\n program.addCommand(createObservabilityCommand());\r\n program.addCommand(createConfigCommand());\r\n program.addCommand(createLlmGatewayCommand());\r\n\r\n process.on(\"uncaughtException\", handleError);\r\n process.on(\"unhandledRejection\", (reason) => handleError(reason));\r\n\r\n return program;\r\n}\r\n","import { type Command, Option } from \"commander\";\r\n\r\nexport function addGlobalFlags(program: Command): Command {\r\n program\r\n .addOption(\r\n new Option(\"-o, --output <format>\", \"Output format\")\r\n .choices([\"table\", \"json\", \"yaml\", \"quiet\"])\r\n .env(\"NEBULAOS_OUTPUT\"),\r\n )\r\n .addOption(\r\n new Option(\"--context <name>\", \"Use a specific context\")\r\n .env(\"NEBULAOS_CONTEXT\"),\r\n )\r\n .addOption(\r\n new Option(\"--api-url <url>\", \"Override API URL\")\r\n .env(\"NEBULAOS_API_URL\"),\r\n )\r\n .addOption(\r\n new Option(\"--token <token>\", \"Override authentication token\")\r\n .env(\"NEBULAOS_TOKEN\"),\r\n )\r\n .addOption(\r\n new Option(\"--org-id <id>\", \"Override organization ID\")\r\n .env(\"NEBULAOS_ORG_ID\"),\r\n )\r\n .addOption(\r\n new Option(\"--no-color\", \"Disable colored output\"),\r\n )\r\n .addOption(\r\n new Option(\"--verbose\", \"Enable verbose output\"),\r\n );\r\n\r\n return program;\r\n}\r\n\r\nexport function addPaginationFlags(command: Command): Command {\r\n command\r\n .addOption(\r\n new Option(\"--page <number>\", \"Page number\").argParser(parseInt),\r\n )\r\n .addOption(\r\n new Option(\"--page-size <number>\", \"Items per page\").argParser(parseInt),\r\n );\r\n\r\n return command;\r\n}\r\n","export enum ExitCode {\r\n Success = 0,\r\n GeneralError = 1,\r\n InvalidArgument = 2,\r\n AuthenticationError = 3,\r\n AuthorizationError = 4,\r\n NotFound = 5,\r\n ConflictError = 6,\r\n ValidationError = 7,\r\n NetworkError = 8,\r\n TimeoutError = 9,\r\n ServerError = 10,\r\n ConfigError = 11,\r\n}\r\n\r\nexport class CLIError extends Error {\r\n constructor(\r\n message: string,\r\n public readonly exitCode: ExitCode = ExitCode.GeneralError,\r\n public readonly hint?: string,\r\n ) {\r\n super(message);\r\n this.name = \"CLIError\";\r\n }\r\n}\r\n\r\nexport class AuthenticationError extends CLIError {\r\n constructor(message = \"Authentication required. Run `nebulaos auth login` first.\") {\r\n super(message, ExitCode.AuthenticationError);\r\n }\r\n}\r\n\r\nexport class AuthorizationError extends CLIError {\r\n constructor(message = \"Insufficient permissions for this operation.\") {\r\n super(message, ExitCode.AuthorizationError);\r\n }\r\n}\r\n\r\nexport class NotFoundError extends CLIError {\r\n constructor(resource: string, identifier: string) {\r\n super(`${resource} '${identifier}' not found.`, ExitCode.NotFound);\r\n }\r\n}\r\n\r\nexport class ValidationError extends CLIError {\r\n constructor(message: string) {\r\n super(message, ExitCode.ValidationError);\r\n }\r\n}\r\n\r\nexport class NetworkError extends CLIError {\r\n constructor(message = \"Unable to connect to NebulaOS API. Check your network and API URL.\") {\r\n super(message, ExitCode.NetworkError);\r\n }\r\n}\r\n\r\nexport class ConfigError extends CLIError {\r\n constructor(message: string) {\r\n super(message, ExitCode.ConfigError);\r\n }\r\n}\r\n\r\nexport function handleError(error: unknown): never {\r\n if (error instanceof CLIError) {\r\n console.error(`Error: ${error.message}`);\r\n if (error.hint) {\r\n console.error(`Hint: ${error.hint}`);\r\n }\r\n process.exit(error.exitCode);\r\n }\r\n\r\n if (error instanceof Error) {\r\n console.error(`Error: ${error.message}`);\r\n process.exit(ExitCode.GeneralError);\r\n }\r\n\r\n console.error(\"An unexpected error occurred.\");\r\n process.exit(ExitCode.GeneralError);\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createLoginCommand } from \"./login.js\";\r\nimport { createLogoutCommand } from \"./logout.js\";\r\nimport { createStatusCommand } from \"./status.js\";\r\n\r\nexport function createAuthCommand(): Command {\r\n const auth = new Command(\"auth\")\r\n .description(\"Authenticate with NebulaOS and manage credentials\");\r\n\r\n auth.addCommand(createLoginCommand());\r\n auth.addCommand(createLogoutCommand());\r\n auth.addCommand(createStatusCommand());\r\n\r\n return auth;\r\n}\r\n","import { Command } from \"commander\";\r\nimport axios from \"axios\";\r\nimport chalk from \"chalk\";\r\nimport { password, input } from \"@inquirer/prompts\";\r\nimport { setContext, useContext } from \"../../lib/config.js\";\r\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\r\n\r\ninterface VerifyResponse {\r\n valid: boolean;\r\n admin?: {\r\n id: string;\r\n email: string;\r\n fullName: string;\r\n role: string;\r\n };\r\n organization?: {\r\n id: string;\r\n name: string;\r\n slug: string;\r\n };\r\n workspaceId?: string;\r\n scopes?: string[] | null;\r\n error?: string;\r\n}\r\n\r\nasync function verifyToken(apiUrl: string, token: string): Promise<VerifyResponse> {\r\n try {\r\n const response = await axios.post<VerifyResponse>(\r\n `${apiUrl}/auth/personal-tokens/verify`,\r\n { token },\r\n { timeout: 10_000 },\r\n );\r\n return response.data;\r\n } catch (error) {\r\n if (axios.isAxiosError(error)) {\r\n if (!error.response) {\r\n throw new CLIError(\r\n `Unable to connect to ${apiUrl}. Check the URL and your network.`,\r\n ExitCode.NetworkError,\r\n );\r\n }\r\n throw new CLIError(\r\n `API returned ${error.response.status}: ${error.response.data?.message || \"Unknown error\"}`,\r\n ExitCode.ServerError,\r\n );\r\n }\r\n throw error;\r\n }\r\n}\r\n\r\nexport function createLoginCommand(): Command {\r\n const cmd = new Command(\"login\")\r\n .description(\"Authenticate with NebulaOS using a Personal Access Token\")\r\n .option(\"-t, --token <token>\", \"Personal Access Token (PAT)\")\r\n .option(\"-u, --api-url <url>\", \"API URL (default: http://localhost:4100)\")\r\n .option(\"-n, --context-name <name>\", \"Name for this context\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos auth login Interactive login (prompts for token)\r\n $ nebulaos auth login -t neb_pat_abc123 Login with a token directly\r\n $ nebulaos auth login -u https://api.starya.com Login to a custom API URL\r\n $ nebulaos auth login -t neb_pat_abc123 -n production Login and name the context \"production\"\r\n\r\nNote: Personal Access Tokens are tied to a specific workspace.\r\n Create tokens in the NebulaOS dashboard for the workspace you want to access.\r\n`)\r\n .action(async (options) => {\r\n try {\r\n console.log(chalk.bold(\"NebulaOS Login\\n\"));\r\n\r\n // Prompt for API URL if not provided via flag\r\n let apiUrl = options.apiUrl || options.parent?.opts()?.apiUrl;\r\n if (!apiUrl) {\r\n apiUrl = await input({\r\n message: \"NebulaOS API URL:\",\r\n default: \"http://localhost:4100\",\r\n validate: (value) => {\r\n if (!value) return \"API URL is required\";\r\n try {\r\n new URL(value);\r\n return true;\r\n } catch {\r\n return \"Invalid URL format. Example: https://api.starya.com\";\r\n }\r\n },\r\n });\r\n }\r\n\r\n // Prompt for token if not provided via flag\r\n let token = options.token;\r\n if (!token) {\r\n console.log(\"\\nGenerate a Personal Access Token at your NebulaOS dashboard.\\n\");\r\n\r\n token = await password({\r\n message: \"Personal Access Token (PAT):\",\r\n mask: \"*\",\r\n validate: (value) => {\r\n if (!value) return \"Token is required\";\r\n if (!value.startsWith(\"neb_pat_\")) return \"Invalid token format. Tokens start with 'neb_pat_'\";\r\n return true;\r\n },\r\n });\r\n }\r\n\r\n if (!token.startsWith(\"neb_pat_\")) {\r\n throw new CLIError(\r\n \"Invalid token format. Personal Access Tokens start with 'neb_pat_'.\",\r\n ExitCode.ValidationError,\r\n );\r\n }\r\n\r\n console.log(\"\\nVerifying token...\");\r\n\r\n const result = await verifyToken(apiUrl, token);\r\n\r\n if (!result.valid) {\r\n throw new CLIError(\r\n `Token verification failed: ${result.error || \"Unknown error\"}`,\r\n ExitCode.AuthenticationError,\r\n );\r\n }\r\n\r\n const contextName =\r\n options.contextName ||\r\n result.organization?.slug ||\r\n \"default\";\r\n\r\n setContext(contextName, {\r\n name: contextName,\r\n apiUrl,\r\n token,\r\n organizationId: result.organization?.id,\r\n });\r\n useContext(contextName);\r\n\r\n console.log(chalk.green(\"\\nAuthenticated successfully!\"));\r\n console.log(` Admin: ${result.admin?.fullName} (${result.admin?.email})`);\r\n console.log(` Organization: ${result.organization?.name} (${result.organization?.slug})`);\r\n if (result.workspaceId) {\r\n console.log(` Workspace: ${result.workspaceId}`);\r\n }\r\n console.log(` Context: ${contextName}`);\r\n\r\n if (result.scopes && result.scopes.length > 0) {\r\n console.log(` Scopes: ${result.scopes.join(\", \")}`);\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import Conf from \"conf\";\r\nimport { ConfigError } from \"./errors.js\";\r\n\r\nexport interface ContextConfig {\r\n name: string;\r\n apiUrl: string;\r\n token: string;\r\n organizationId?: string;\r\n}\r\n\r\nexport interface CLIConfig {\r\n contexts: Record<string, ContextConfig>;\r\n currentContext: string | null;\r\n defaults: {\r\n output: \"table\" | \"json\" | \"yaml\" | \"quiet\";\r\n pageSize: number;\r\n };\r\n}\r\n\r\nconst schema = {\r\n contexts: {\r\n type: \"object\" as const,\r\n default: {},\r\n },\r\n currentContext: {\r\n type: [\"string\", \"null\"] as const,\r\n default: null,\r\n },\r\n defaults: {\r\n type: \"object\" as const,\r\n default: {\r\n output: \"table\",\r\n pageSize: 20,\r\n },\r\n properties: {\r\n output: {\r\n type: \"string\" as const,\r\n enum: [\"table\", \"json\", \"yaml\", \"quiet\"],\r\n default: \"table\",\r\n },\r\n pageSize: {\r\n type: \"number\" as const,\r\n default: 20,\r\n minimum: 1,\r\n maximum: 100,\r\n },\r\n },\r\n },\r\n};\r\n\r\nconst config = new Conf<CLIConfig>({\r\n projectName: \"nebulaos\",\r\n schema,\r\n});\r\n\r\nexport function getConfig(): CLIConfig {\r\n return {\r\n contexts: config.get(\"contexts\"),\r\n currentContext: config.get(\"currentContext\"),\r\n defaults: config.get(\"defaults\"),\r\n };\r\n}\r\n\r\nexport function getCurrentContext(): ContextConfig {\r\n const currentName = config.get(\"currentContext\");\r\n if (!currentName) {\r\n throw new ConfigError(\r\n \"No active context. Run `nebulaos auth login` or `nebulaos config use-context <name>` first.\",\r\n );\r\n }\r\n\r\n const contexts = config.get(\"contexts\");\r\n const ctx = contexts[currentName];\r\n if (!ctx) {\r\n throw new ConfigError(\r\n `Context '${currentName}' not found. Run \\`nebulaos config get-contexts\\` to see available contexts.`,\r\n );\r\n }\r\n\r\n return ctx;\r\n}\r\n\r\nexport function setContext(name: string, context: ContextConfig): void {\r\n const contexts = config.get(\"contexts\");\r\n contexts[name] = context;\r\n config.set(\"contexts\", contexts);\r\n}\r\n\r\nexport function removeContext(name: string): void {\r\n const contexts = config.get(\"contexts\");\r\n if (!contexts[name]) {\r\n throw new ConfigError(`Context '${name}' not found.`);\r\n }\r\n\r\n delete contexts[name];\r\n config.set(\"contexts\", contexts);\r\n\r\n if (config.get(\"currentContext\") === name) {\r\n config.set(\"currentContext\", null);\r\n }\r\n}\r\n\r\nexport function useContext(name: string): void {\r\n const contexts = config.get(\"contexts\");\r\n if (!contexts[name]) {\r\n throw new ConfigError(\r\n `Context '${name}' not found. Run \\`nebulaos config get-contexts\\` to see available contexts.`,\r\n );\r\n }\r\n\r\n config.set(\"currentContext\", name);\r\n}\r\n\r\nexport function listContexts(): Array<ContextConfig & { active: boolean }> {\r\n const contexts = config.get(\"contexts\");\r\n const currentName = config.get(\"currentContext\");\r\n\r\n return Object.entries(contexts).map(([name, ctx]) => ({\r\n ...ctx,\r\n name,\r\n active: name === currentName,\r\n }));\r\n}\r\n\r\nexport function setDefault<K extends keyof CLIConfig[\"defaults\"]>(\r\n key: K,\r\n value: CLIConfig[\"defaults\"][K],\r\n): void {\r\n const defaults = config.get(\"defaults\");\r\n defaults[key] = value;\r\n config.set(\"defaults\", defaults);\r\n}\r\n\r\nexport function getConfigPath(): string {\r\n return config.path;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { confirm } from \"@inquirer/prompts\";\r\nimport { getConfig, removeContext } from \"../../lib/config.js\";\r\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createLogoutCommand(): Command {\r\n const cmd = new Command(\"logout\")\r\n .description(\"Remove authentication credentials for the current or specified context\")\r\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\r\n .option(\"--context <name>\", \"Context to log out from (default: current)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos auth logout Log out from the current context\r\n $ nebulaos auth logout -y Log out without confirmation\r\n $ nebulaos auth logout --context staging Log out from a specific context\r\n`)\r\n .action(async (options) => {\r\n try {\r\n const config = getConfig();\r\n const contextName = options.context || config.currentContext;\r\n\r\n if (!contextName) {\r\n throw new CLIError(\"No active context. Nothing to log out from.\", ExitCode.ConfigError);\r\n }\r\n\r\n if (!config.contexts[contextName]) {\r\n throw new CLIError(`Context '${contextName}' not found.`, ExitCode.NotFound);\r\n }\r\n\r\n if (!options.yes) {\r\n const shouldProceed = await confirm({\r\n message: `Remove credentials for context '${contextName}'?`,\r\n default: false,\r\n });\r\n\r\n if (!shouldProceed) {\r\n console.log(\"Cancelled.\");\r\n return;\r\n }\r\n }\r\n\r\n removeContext(contextName);\r\n console.log(chalk.green(`Logged out from context '${contextName}'.`));\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getConfig, getCurrentContext } from \"../../lib/config.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { ConfigError, handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createStatusCommand(): Command {\r\n const cmd = new Command(\"status\")\r\n .description(\"Show current authentication status and context information\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos auth status Show current auth status\r\n $ nebulaos auth status -o json Show auth status as JSON\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const config = getConfig();\r\n\r\n if (!config.currentContext) {\r\n if (format === \"json\") {\r\n console.log(JSON.stringify({ authenticated: false }));\r\n } else if (format === \"yaml\") {\r\n console.log(\"authenticated: false\");\r\n } else {\r\n console.log(chalk.yellow(\"Not authenticated. Run `nebulaos auth login` to get started.\"));\r\n }\r\n return;\r\n }\r\n\r\n let context;\r\n try {\r\n context = getCurrentContext();\r\n } catch (e) {\r\n if (e instanceof ConfigError) {\r\n console.log(chalk.yellow(e.message));\r\n return;\r\n }\r\n throw e;\r\n }\r\n\r\n const statusData = {\r\n authenticated: true,\r\n context: config.currentContext,\r\n apiUrl: context.apiUrl,\r\n organizationId: context.organizationId || null,\r\n hasToken: !!context.token,\r\n };\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Authentication Status\\n\"));\r\n printDetail(\"Context\", config.currentContext);\r\n printDetail(\"API URL\", context.apiUrl);\r\n printDetail(\"Authenticated\", context.token ? chalk.green(\"Yes\") : chalk.red(\"No\"));\r\n if (context.organizationId) {\r\n printDetail(\"Organization ID\", context.organizationId);\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: statusData,\r\n ids: [config.currentContext],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import Table from \"cli-table3\";\r\nimport chalk from \"chalk\";\r\nimport { stringify as yamlStringify } from \"yaml\";\r\nimport { getConfig } from \"./config.js\";\r\n\r\nexport type OutputFormat = \"table\" | \"json\" | \"yaml\" | \"quiet\";\r\n\r\nexport function resolveFormat(flagValue?: string): OutputFormat {\r\n if (flagValue) return flagValue as OutputFormat;\r\n return getConfig().defaults.output;\r\n}\r\n\r\nexport interface TableOptions {\r\n headers: string[];\r\n rows: string[][];\r\n}\r\n\r\nexport function printTable({ headers, rows }: TableOptions): void {\r\n const table = new Table({\r\n head: headers.map((h) => chalk.bold(h)),\r\n style: { head: [], border: [] },\r\n });\r\n\r\n for (const row of rows) {\r\n table.push(row);\r\n }\r\n\r\n console.log(table.toString());\r\n}\r\n\r\nexport function printJson(data: unknown): void {\r\n console.log(JSON.stringify(data, null, 2));\r\n}\r\n\r\nexport function printYaml(data: unknown): void {\r\n console.log(yamlStringify(data));\r\n}\r\n\r\nexport function printQuiet(ids: string[]): void {\r\n for (const id of ids) {\r\n console.log(id);\r\n }\r\n}\r\n\r\nexport interface OutputData {\r\n table: TableOptions;\r\n data: unknown;\r\n ids: string[];\r\n}\r\n\r\nexport function output(format: OutputFormat, outputData: OutputData): void {\r\n switch (format) {\r\n case \"table\":\r\n printTable(outputData.table);\r\n break;\r\n case \"json\":\r\n printJson(outputData.data);\r\n break;\r\n case \"yaml\":\r\n printYaml(outputData.data);\r\n break;\r\n case \"quiet\":\r\n printQuiet(outputData.ids);\r\n break;\r\n }\r\n}\r\n\r\nexport function printSuccess(message: string): void {\r\n console.log(chalk.green(message));\r\n}\r\n\r\nexport function printWarning(message: string): void {\r\n console.error(chalk.yellow(`Warning: ${message}`));\r\n}\r\n\r\nexport function printDetail(label: string, value: string): void {\r\n console.log(`${chalk.bold(label)}: ${value}`);\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createOrgsListCommand } from \"./list.js\";\r\nimport { createOrgsGetCommand } from \"./get.js\";\r\nimport { createOrgsSwitchCommand } from \"./switch.js\";\r\n\r\nexport function createOrgsCommand(): Command {\r\n const orgs = new Command(\"orgs\")\r\n .description(\"List, inspect, and switch between organizations\");\r\n\r\n orgs.addCommand(createOrgsListCommand());\r\n orgs.addCommand(createOrgsGetCommand());\r\n orgs.addCommand(createOrgsSwitchCommand());\r\n\r\n return orgs;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\nimport { addPaginationFlags } from \"../../lib/flags.js\";\r\n\r\ninterface Organization {\r\n id: string;\r\n name: string;\r\n slug: string;\r\n isActive: boolean;\r\n createdAt: string;\r\n}\r\n\r\nexport function createOrgsListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List organizations accessible to the current admin\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos orgs list List all accessible organizations\r\n $ nebulaos orgs list -o json Output as JSON\r\n $ nebulaos orgs list --page 2 Show page 2 of results\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const params: Record<string, unknown> = {};\r\n if (globalOpts.page) params.page = globalOpts.page;\r\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\r\n\r\n const { data } = await api.get<Organization[]>(\"/organizations\", { params });\r\n\r\n const orgs = Array.isArray(data) ? data : [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Name\", \"Slug\", \"Active\", \"Created At\"],\r\n rows: orgs.map((o) => [\r\n o.id,\r\n o.name,\r\n o.slug,\r\n o.isActive ? \"Yes\" : \"No\",\r\n new Date(o.createdAt).toLocaleDateString(),\r\n ]),\r\n },\r\n data: orgs,\r\n ids: orgs.map((o) => o.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n addPaginationFlags(cmd);\r\n\r\n return cmd;\r\n}\r\n","import axios, { AxiosError, type AxiosInstance } from \"axios\";\r\nimport { getCurrentContext } from \"./config.js\";\r\nimport {\r\n AuthenticationError,\r\n AuthorizationError,\r\n CLIError,\r\n ExitCode,\r\n NetworkError,\r\n NotFoundError,\r\n} from \"./errors.js\";\r\n\r\nlet client: AxiosInstance | null = null;\r\n\r\nexport function getApiClient(): AxiosInstance {\r\n if (client) return client;\r\n\r\n const context = getCurrentContext();\r\n\r\n client = axios.create({\r\n baseURL: context.apiUrl,\r\n timeout: 30_000,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n },\r\n });\r\n\r\n client.interceptors.request.use((config) => {\r\n const ctx = getCurrentContext();\r\n\r\n if (ctx.token) {\r\n config.headers.Authorization = `Bearer ${ctx.token}`;\r\n }\r\n\r\n if (ctx.organizationId) {\r\n config.headers[\"X-Organization-Id\"] = ctx.organizationId;\r\n }\r\n\r\n return config;\r\n });\r\n\r\n client.interceptors.response.use(\r\n (response) => response,\r\n (error: AxiosError<{ message?: string; statusCode?: number }>) => {\r\n if (!error.response) {\r\n if (error.code === \"ECONNREFUSED\" || error.code === \"ENOTFOUND\") {\r\n throw new NetworkError();\r\n }\r\n if (error.code === \"ECONNABORTED\" || error.code === \"ETIMEDOUT\") {\r\n throw new CLIError(\r\n \"Request timed out. The server may be unavailable.\",\r\n ExitCode.TimeoutError,\r\n );\r\n }\r\n throw new NetworkError(error.message);\r\n }\r\n\r\n const { status, data } = error.response;\r\n const message = data?.message || error.message;\r\n\r\n switch (status) {\r\n case 401:\r\n throw new AuthenticationError();\r\n case 403:\r\n throw new AuthorizationError();\r\n case 404:\r\n throw new NotFoundError(\"Resource\", message);\r\n case 409:\r\n throw new CLIError(message, ExitCode.ConflictError);\r\n case 422:\r\n throw new CLIError(message, ExitCode.ValidationError);\r\n default:\r\n if (status >= 500) {\r\n throw new CLIError(\r\n `Server error (${status}): ${message}`,\r\n ExitCode.ServerError,\r\n );\r\n }\r\n throw new CLIError(message, ExitCode.GeneralError);\r\n }\r\n },\r\n );\r\n\r\n return client;\r\n}\r\n\r\nexport function resetApiClient(): void {\r\n client = null;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface Organization {\r\n id: string;\r\n name: string;\r\n slug: string;\r\n isActive: boolean;\r\n createdAt: string;\r\n updatedAt: string;\r\n}\r\n\r\nexport function createOrgsGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get details of an organization by ID or slug\")\r\n .argument(\"<id>\", \"Organization ID or slug\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos orgs get my-org Get organization by slug\r\n $ nebulaos orgs get 550e8400-e29b-41d4... Get organization by ID\r\n $ nebulaos orgs get my-org -o json Output as JSON\r\n`)\r\n .action(async (id, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const { data: org } = await api.get<Organization>(`/organizations/${id}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Organization Details\\n\"));\r\n printDetail(\"ID\", org.id);\r\n printDetail(\"Name\", org.name);\r\n printDetail(\"Slug\", org.slug);\r\n printDetail(\"Active\", org.isActive ? chalk.green(\"Yes\") : chalk.red(\"No\"));\r\n printDetail(\"Created\", new Date(org.createdAt).toLocaleString());\r\n printDetail(\"Updated\", new Date(org.updatedAt).toLocaleString());\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: org,\r\n ids: [org.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { getCurrentContext, setContext, useContext } from \"../../lib/config.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface Organization {\r\n id: string;\r\n name: string;\r\n slug: string;\r\n}\r\n\r\nexport function createOrgsSwitchCommand(): Command {\r\n const cmd = new Command(\"switch\")\r\n .description(\"Switch the active organization context to a different organization\")\r\n .argument(\"<slug>\", \"Organization slug to switch to\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos orgs switch my-org Switch to the \"my-org\" organization\r\n $ nebulaos orgs switch production Switch to the \"production\" organization\r\n`)\r\n .action(async (slug) => {\r\n try {\r\n const api = getApiClient();\r\n const currentContext = getCurrentContext();\r\n\r\n // Verify the organization exists and is accessible\r\n const { data: org } = await api.get<Organization>(`/organizations/${slug}`);\r\n\r\n const contextName = org.slug;\r\n\r\n setContext(contextName, {\r\n name: contextName,\r\n apiUrl: currentContext.apiUrl,\r\n token: currentContext.token,\r\n organizationId: org.id,\r\n });\r\n useContext(contextName);\r\n\r\n console.log(chalk.green(`Switched to organization '${org.name}' (${org.slug}).`));\r\n console.log(` Context: ${contextName}`);\r\n console.log(` Organization ID: ${org.id}`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createClientsListCommand } from \"./list.js\";\r\nimport { createClientsGetCommand } from \"./get.js\";\r\nimport { createClientsCreateCommand } from \"./create.js\";\r\nimport { createApiKeysCommand } from \"./api-keys/index.js\";\r\n\r\nexport function createClientsCommand(): Command {\r\n const clients = new Command(\"clients\")\r\n .description(\"Register and manage clients and their API keys\");\r\n\r\n clients.addCommand(createClientsListCommand());\r\n clients.addCommand(createClientsGetCommand());\r\n clients.addCommand(createClientsCreateCommand());\r\n clients.addCommand(createApiKeysCommand());\r\n\r\n return clients;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\nimport { addPaginationFlags } from \"../../lib/flags.js\";\r\n\r\ninterface Client {\r\n id: string;\r\n clientId: string;\r\n isOnline: boolean;\r\n lastSeenAt: string | null;\r\n registeredAt: string;\r\n}\r\n\r\nexport function createClientsListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List registered clients in the current organization\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos clients list List all clients\r\n $ nebulaos clients list -o json Output as JSON\r\n $ nebulaos clients list --page-size 5 Show 5 clients per page\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const params: Record<string, unknown> = {};\r\n if (globalOpts.page) params.page = globalOpts.page;\r\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\r\n\r\n const { data } = await api.get<Client[]>(\"/clients\", { params });\r\n\r\n const clients = Array.isArray(data) ? data : [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Client ID\", \"Status\", \"Last Seen\", \"Registered At\"],\r\n rows: clients.map((c) => [\r\n c.id,\r\n c.clientId,\r\n c.isOnline ? \"Online\" : \"Offline\",\r\n c.lastSeenAt ? new Date(c.lastSeenAt).toLocaleString() : \"-\",\r\n c.registeredAt ? new Date(c.registeredAt).toLocaleDateString() : \"-\",\r\n ]),\r\n },\r\n data: clients,\r\n ids: clients.map((c) => c.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n addPaginationFlags(cmd);\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface Client {\r\n id: string;\r\n clientId: string;\r\n isOnline: boolean;\r\n lastSeenAt: string | null;\r\n registeredAt: string;\r\n updatedAt: string;\r\n agents?: Array<{ name: string; kind: string }>;\r\n workflows?: Array<{ id: string; name: string }>;\r\n}\r\n\r\nexport function createClientsGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get details of a client, including its registered agents and workflows\")\r\n .argument(\"<id>\", \"Client ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos clients get 550e8400-e29b-41d4... Get client details by ID\r\n $ nebulaos clients get my-client -o json Output as JSON\r\n`)\r\n .action(async (id, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const { data: client } = await api.get<Client>(`/clients/${id}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Client Details\\n\"));\r\n printDetail(\"ID\", client.id);\r\n printDetail(\"Client ID\", client.clientId);\r\n printDetail(\"Status\", client.isOnline ? \"Online\" : \"Offline\");\r\n printDetail(\"Last Seen\", client.lastSeenAt ? new Date(client.lastSeenAt).toLocaleString() : \"-\");\r\n printDetail(\"Registered\", client.registeredAt ? new Date(client.registeredAt).toLocaleString() : \"-\");\r\n printDetail(\"Updated\", client.updatedAt ? new Date(client.updatedAt).toLocaleString() : \"-\");\r\n\r\n if (client.agents && client.agents.length > 0) {\r\n console.log(chalk.bold(\"\\nAgents:\"));\r\n for (const agent of client.agents) {\r\n console.log(` - ${agent.name} (${agent.kind})`);\r\n }\r\n }\r\n\r\n if (client.workflows && client.workflows.length > 0) {\r\n console.log(chalk.bold(\"\\nWorkflows:\"));\r\n for (const wf of client.workflows) {\r\n console.log(` - ${wf.name} (${wf.id})`);\r\n }\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: client,\r\n ids: [client.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface Client {\r\n id: string;\r\n clientId: string;\r\n isOnline: boolean;\r\n registeredAt: string;\r\n}\r\n\r\nexport function createClientsCreateCommand(): Command {\r\n const cmd = new Command(\"create\")\r\n .description(\"Register a new client in the current organization\")\r\n .requiredOption(\"--client-id <clientId>\", \"Unique client identifier\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos clients create --client-id my-agent-server Create a new client\r\n $ nebulaos clients create --client-id worker-1 -o json Create and output as JSON\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const { data: client } = await api.post<Client>(\"/clients\", {\r\n clientId: options.clientId,\r\n });\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.green(\"Client created successfully.\\n\"));\r\n printDetail(\"ID\", client.id);\r\n printDetail(\"Client ID\", client.clientId);\r\n printDetail(\"Status\", client.isOnline ? \"Online\" : \"Offline\");\r\n printDetail(\"Registered\", client.registeredAt ? new Date(client.registeredAt).toLocaleString() : \"-\");\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: client,\r\n ids: [client.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createApiKeysListCommand } from \"./list.js\";\r\nimport { createApiKeysCreateCommand } from \"./create.js\";\r\nimport { createApiKeysRevokeCommand } from \"./revoke.js\";\r\n\r\nexport function createApiKeysCommand(): Command {\r\n const apiKeys = new Command(\"api-keys\")\r\n .description(\"Create, list, and revoke API keys for clients\");\r\n\r\n apiKeys.addCommand(createApiKeysListCommand());\r\n apiKeys.addCommand(createApiKeysCreateCommand());\r\n apiKeys.addCommand(createApiKeysRevokeCommand());\r\n\r\n return apiKeys;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\ninterface ApiKey {\r\n id: string;\r\n key: string;\r\n isActive: boolean;\r\n expiresAt: string | null;\r\n lastUsedAt: string | null;\r\n createdAt: string;\r\n}\r\n\r\nexport function createApiKeysListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List all API keys for a specific client\")\r\n .argument(\"<clientId>\", \"Client ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos clients api-keys list 550e8400-e29b... List keys for a client\r\n $ nebulaos clients api-keys list my-client -o json Output as JSON\r\n`)\r\n .action(async (clientId, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const { data } = await api.get<ApiKey[]>(`/clients/${clientId}/api-keys`);\r\n\r\n const keys = Array.isArray(data) ? data : [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Key\", \"Active\", \"Expires At\", \"Last Used\", \"Created At\"],\r\n rows: keys.map((k) => [\r\n k.id,\r\n k.key,\r\n k.isActive ? \"Yes\" : \"No\",\r\n k.expiresAt ? new Date(k.expiresAt).toLocaleString() : \"-\",\r\n k.lastUsedAt ? new Date(k.lastUsedAt).toLocaleString() : \"-\",\r\n new Date(k.createdAt).toLocaleDateString(),\r\n ]),\r\n },\r\n data: keys,\r\n ids: keys.map((k) => k.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\ninterface ApiKey {\r\n id: string;\r\n key: string;\r\n isActive: boolean;\r\n expiresAt: string | null;\r\n createdAt: string;\r\n}\r\n\r\nexport function createApiKeysCreateCommand(): Command {\r\n const cmd = new Command(\"create\")\r\n .description(\"Generate a new API key for a client (shown only once)\")\r\n .argument(\"<clientId>\", \"Client ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos clients api-keys create 550e8400-e29b... Create a new API key\r\n $ nebulaos clients api-keys create my-client -o json Output as JSON\r\n\r\nNote: The API key is displayed only once after creation. Save it securely.\r\n`)\r\n .action(async (clientId, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const api = getApiClient();\r\n const { data: apiKey } = await api.post<ApiKey>(`/clients/${clientId}/api-keys`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.green(\"API key created successfully.\\n\"));\r\n printDetail(\"ID\", apiKey.id);\r\n printDetail(\"Key\", apiKey.key);\r\n printDetail(\"Active\", apiKey.isActive ? \"Yes\" : \"No\");\r\n printDetail(\"Expires At\", apiKey.expiresAt ? new Date(apiKey.expiresAt).toLocaleString() : \"-\");\r\n printDetail(\"Created\", new Date(apiKey.createdAt).toLocaleString());\r\n console.log(chalk.yellow(\"\\nSave this key now. It will not be shown again.\"));\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: apiKey,\r\n ids: [apiKey.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { confirm } from \"@inquirer/prompts\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\n\r\nexport function createApiKeysRevokeCommand(): Command {\r\n const cmd = new Command(\"revoke\")\r\n .description(\"Permanently revoke an API key for a client\")\r\n .argument(\"<clientId>\", \"Client ID\")\r\n .argument(\"<keyId>\", \"API Key ID to revoke\")\r\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos clients api-keys revoke my-client key-123 Revoke with confirmation\r\n $ nebulaos clients api-keys revoke my-client key-123 -y Revoke without confirmation\r\n`)\r\n .action(async (clientId, keyId, options) => {\r\n try {\r\n if (!options.yes) {\r\n const shouldProceed = await confirm({\r\n message: `Revoke API key '${keyId}' for client '${clientId}'?`,\r\n default: false,\r\n });\r\n\r\n if (!shouldProceed) {\r\n console.log(\"Cancelled.\");\r\n return;\r\n }\r\n }\r\n\r\n const api = getApiClient();\r\n await api.delete(`/clients/${clientId}/api-keys/${keyId}`);\r\n\r\n printSuccess(`API key '${keyId}' revoked successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createResourcesListCommand } from \"./list.js\";\r\nimport { createResourcesGetCommand } from \"./get.js\";\r\nimport { createResourcesArchiveCommand } from \"./archive.js\";\r\nimport { createResourcesUnarchiveCommand } from \"./unarchive.js\";\r\nimport { createResourcesPromoteCommand } from \"./promote.js\";\r\n\r\nexport function createResourcesCommand(): Command {\r\n const resources = new Command(\"resources\")\r\n .description(\"List, inspect, archive, and promote resources (agents, workflows, tools)\");\r\n\r\n resources.addCommand(createResourcesListCommand());\r\n resources.addCommand(createResourcesGetCommand());\r\n resources.addCommand(createResourcesArchiveCommand());\r\n resources.addCommand(createResourcesUnarchiveCommand());\r\n resources.addCommand(createResourcesPromoteCommand());\r\n\r\n return resources;\r\n}\r\n","import { Command, Option } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { addPaginationFlags } from \"../../lib/flags.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createResourcesListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List registered resources (agents, workflows, tools) with optional filters\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos resources list List all resources\r\n $ nebulaos resources list --type agent List only agents\r\n $ nebulaos resources list --status official List official resources\r\n $ nebulaos resources list --type workflow -o json List workflows as JSON\r\n`)\r\n .addOption(\r\n new Option(\"--type <type>\", \"Filter by resource type\")\r\n .choices([\"agent\", \"workflow\", \"tool\"]),\r\n )\r\n .addOption(\r\n new Option(\"--status <status>\", \"Filter by resource status\")\r\n .choices([\"discovered\", \"official\"]),\r\n )\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, string> = {};\r\n if (options.type) params.type = options.type;\r\n if (options.status) params.status = options.status;\r\n if (globalOpts.page) params.page = String(globalOpts.page);\r\n if (globalOpts.pageSize) params.pageSize = String(globalOpts.pageSize);\r\n\r\n const { data } = await api.get(\"/resources\", { params });\r\n\r\n const resources = Array.isArray(data) ? data : data.data ?? [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Name\", \"Type\", \"Status\", \"Online\", \"Created At\"],\r\n rows: resources.map((r: any) => [\r\n r.id,\r\n r.displayName || r.name || \"-\",\r\n r.type,\r\n r.lifecycleStatus || r.status || \"-\",\r\n r.isOnline ? \"Yes\" : \"No\",\r\n r.firstSeenAt || r.createdAt ? new Date(r.firstSeenAt || r.createdAt).toLocaleString() : \"-\",\r\n ]),\r\n },\r\n data: resources,\r\n ids: resources.map((r: any) => r.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n addPaginationFlags(cmd);\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\nimport chalk from \"chalk\";\r\n\r\nexport function createResourcesGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get detailed information about a specific resource\")\r\n .argument(\"<id>\", \"Resource ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos resources get 550e8400-e29b-41d4... View resource details\r\n $ nebulaos resources get my-resource -o json Output as JSON\r\n`)\r\n .action(async (id, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data: resource } = await api.get(`/resources/${id}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Resource Details\\n\"));\r\n printDetail(\"ID\", resource.id);\r\n printDetail(\"Name\", resource.displayName || resource.name || \"-\");\r\n printDetail(\"Type\", resource.type);\r\n printDetail(\"Status\", resource.lifecycleStatus || resource.status || \"-\");\r\n if (resource.kind) printDetail(\"Kind\", resource.kind);\r\n if (resource.description) printDetail(\"Description\", resource.description);\r\n if (resource.clientId) printDetail(\"Client ID\", resource.clientId);\r\n if (resource.runtimeResourceId) printDetail(\"Runtime ID\", resource.runtimeResourceId);\r\n printDetail(\"Online\", resource.isOnline ? \"Yes\" : \"No\");\r\n printDetail(\"Created At\", resource.createdAt ? new Date(resource.createdAt).toLocaleString() : \"-\");\r\n printDetail(\"Updated At\", resource.updatedAt ? new Date(resource.updatedAt).toLocaleString() : \"-\");\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: resource,\r\n ids: [resource.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { printSuccess } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createResourcesArchiveCommand(): Command {\r\n const cmd = new Command(\"archive\")\r\n .description(\"Archive a resource to hide it from active listings\")\r\n .argument(\"<id>\", \"Resource ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos resources archive 550e8400-e29b... Archive a resource by ID\r\n\r\nArchived resources can be restored with the 'unarchive' command.\r\n`)\r\n .action(async (id) => {\r\n try {\r\n const api = getApiClient();\r\n await api.patch(`/resources/${id}/archive`);\r\n printSuccess(`Resource '${id}' archived successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { printSuccess } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createResourcesUnarchiveCommand(): Command {\r\n const cmd = new Command(\"unarchive\")\r\n .description(\"Restore an archived resource back to active status\")\r\n .argument(\"<id>\", \"Resource ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos resources unarchive 550e8400-e29b... Restore an archived resource\r\n`)\r\n .action(async (id) => {\r\n try {\r\n const api = getApiClient();\r\n await api.patch(`/resources/${id}/unarchive`);\r\n printSuccess(`Resource '${id}' unarchived successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { printSuccess } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createResourcesPromoteCommand(): Command {\r\n const cmd = new Command(\"promote\")\r\n .description(\"Promote a discovered resource to official status\")\r\n .argument(\"<id>\", \"Resource ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos resources promote 550e8400-e29b... Promote a resource to official\r\n\r\nDiscovered resources are auto-registered by clients. Promoting makes them official.\r\n`)\r\n .action(async (id) => {\r\n try {\r\n const api = getApiClient();\r\n await api.patch(`/resources/${id}/promote`);\r\n printSuccess(`Resource '${id}' promoted to official.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createExecutionRunCommand } from \"./run.js\";\r\nimport { createExecutionListCommand } from \"./list.js\";\r\nimport { createExecutionGetCommand } from \"./get.js\";\r\nimport { createExecutionLogsCommand } from \"./logs.js\";\r\n\r\nexport function createExecutionCommand(): Command {\r\n const execution = new Command(\"execution\")\r\n .alias(\"exec\")\r\n .description(\"Run agents/workflows and inspect execution results and logs\");\r\n\r\n execution.addCommand(createExecutionRunCommand());\r\n execution.addCommand(createExecutionListCommand());\r\n execution.addCommand(createExecutionGetCommand());\r\n execution.addCommand(createExecutionLogsCommand());\r\n\r\n return execution;\r\n}\r\n","import { Command } from \"commander\";\r\nimport ora from \"ora\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\r\nimport chalk from \"chalk\";\r\n\r\nexport function createExecutionRunCommand(): Command {\r\n const cmd = new Command(\"run\")\r\n .description(\"Trigger execution of an agent or workflow by resource ID\")\r\n .argument(\"<resourceId>\", \"Resource ID to execute\")\r\n .option(\"-i, --input <json>\", \"Input data as JSON string\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos exec run 550e8400-e29b... Run a resource\r\n $ nebulaos exec run my-agent -i '{\"prompt\":\"Hello\"}' Run with JSON input\r\n $ nebulaos exec run my-workflow -i '{\"data\":[1,2,3]}' -o json Run and output as JSON\r\n`)\r\n .action(async (resourceId, options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n let input: unknown;\r\n if (options.input) {\r\n try {\r\n input = JSON.parse(options.input);\r\n } catch {\r\n throw new CLIError(\r\n \"Invalid JSON input. Provide valid JSON with --input.\",\r\n ExitCode.ValidationError,\r\n );\r\n }\r\n }\r\n\r\n const spinner = ora(\"Starting execution...\").start();\r\n\r\n const { data: execution } = await api.post(\"/execution\", {\r\n resourceId,\r\n input,\r\n });\r\n\r\n spinner.succeed(\"Execution started.\");\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"\\nExecution Details\\n\"));\r\n printDetail(\"Execution ID\", execution.id);\r\n printDetail(\"Resource ID\", execution.resourceId || resourceId);\r\n printDetail(\"Status\", execution.status);\r\n if (execution.result !== undefined) {\r\n printDetail(\"Result\", JSON.stringify(execution.result));\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: execution,\r\n ids: [execution.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command, Option } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { addPaginationFlags } from \"../../lib/flags.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createExecutionListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List past and ongoing executions with optional status filter\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos exec list List recent executions\r\n $ nebulaos exec list --status running Show only running executions\r\n $ nebulaos exec list --limit 5 Show last 5 executions\r\n $ nebulaos exec list -o json Output as JSON\r\n`)\r\n .addOption(\r\n new Option(\"--status <status>\", \"Filter by execution status\"),\r\n )\r\n .addOption(\r\n new Option(\"--limit <number>\", \"Limit number of results\")\r\n .argParser(parseInt),\r\n )\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, string> = {};\r\n if (options.status) params.status = options.status;\r\n if (options.limit) params.limit = String(options.limit);\r\n if (globalOpts.page) params.page = String(globalOpts.page);\r\n if (globalOpts.pageSize) params.pageSize = String(globalOpts.pageSize);\r\n\r\n const { data } = await api.get(\"/execution\", { params });\r\n\r\n const executions = Array.isArray(data) ? data : data.items ?? data.data ?? [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Resource\", \"Status\", \"Started At\", \"Duration\"],\r\n rows: executions.map((e: any) => [\r\n e.id,\r\n e.targetName,\r\n e.status,\r\n e.startedAt ? new Date(e.startedAt).toLocaleString() : \"-\",\r\n e.completedAt && e.startedAt ? `${new Date(e.completedAt).getTime() - new Date(e.startedAt).getTime()}ms` : \"-\",\r\n ]),\r\n },\r\n data: executions,\r\n ids: executions.map((e: any) => e.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n addPaginationFlags(cmd);\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\nimport chalk from \"chalk\";\r\n\r\nexport function createExecutionGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get detailed status and result of a specific execution\")\r\n .argument(\"<id>\", \"Execution ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos exec get 550e8400-e29b-41d4... View execution details\r\n $ nebulaos exec get my-exec-id -o json Output as JSON\r\n`)\r\n .action(async (id, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data: execution } = await api.get(`/execution/${id}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Execution Details\\n\"));\r\n printDetail(\"ID\", execution.id);\r\n if (execution.resourceId) printDetail(\"Resource ID\", execution.resourceId);\r\n if (execution.resourceName) printDetail(\"Resource\", execution.resourceName);\r\n printDetail(\"Status\", execution.status);\r\n if (execution.startedAt) printDetail(\"Started At\", new Date(execution.startedAt).toLocaleString());\r\n if (execution.completedAt) printDetail(\"Completed At\", new Date(execution.completedAt).toLocaleString());\r\n if (execution.duration) printDetail(\"Duration\", `${execution.duration}ms`);\r\n if (execution.error) printDetail(\"Error\", execution.error);\r\n if (execution.result !== undefined) {\r\n printDetail(\"Result\", JSON.stringify(execution.result, null, 2));\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: execution,\r\n ids: [execution.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\nimport chalk from \"chalk\";\r\n\r\nexport function createExecutionLogsCommand(): Command {\r\n const cmd = new Command(\"logs\")\r\n .description(\"View execution cost items and LLM calls for a specific execution\")\r\n .argument(\"<id>\", \"Execution ID\")\r\n .option(\"-l, --limit <n>\", \"Limit number of items\", \"50\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos exec logs 550e8400-e29b... View execution cost items\r\n $ nebulaos exec logs my-exec-id --limit 10 Show last 10 items\r\n $ nebulaos exec logs my-exec-id -o json Output as JSON\r\n`)\r\n .action(async (id, options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get(`/execution/${id}/cost-items`, {\r\n params: { limit: options.limit },\r\n });\r\n\r\n const items = Array.isArray(data) ? data : data.data ?? [];\r\n\r\n if (format === \"table\") {\r\n if (items.length === 0) {\r\n console.log(chalk.gray(\"No cost items available for this execution.\"));\r\n return;\r\n }\r\n\r\n console.log(chalk.bold(\"\\nExecution Cost Items\\n\"));\r\n\r\n for (const item of items) {\r\n const timestamp = item.createdAt\r\n ? chalk.gray(new Date(item.createdAt).toLocaleTimeString())\r\n : \"\";\r\n const type = formatType(item.type);\r\n const model = item.model ? chalk.cyan(`[${item.model}]`) : \"\";\r\n const tokens = item.inputTokens || item.outputTokens\r\n ? chalk.yellow(`(${item.inputTokens || 0}→${item.outputTokens || 0} tokens)`)\r\n : \"\";\r\n const cost = item.totalCost\r\n ? chalk.green(`$${item.totalCost.toFixed(6)}`)\r\n : \"\";\r\n\r\n console.log(`${timestamp} ${type} ${model} ${tokens} ${cost}`);\r\n\r\n if (item.input && globalOpts.verbose) {\r\n console.log(chalk.gray(` Input: ${truncate(JSON.stringify(item.input), 100)}`));\r\n }\r\n if (item.output && globalOpts.verbose) {\r\n console.log(chalk.gray(` Output: ${truncate(JSON.stringify(item.output), 100)}`));\r\n }\r\n }\r\n\r\n console.log(chalk.gray(`\\nShowing ${items.length} items. Use --limit to see more.`));\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: items,\r\n ids: items.map((i: any) => i.id ?? \"\"),\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n\r\nfunction formatType(type?: string): string {\r\n switch (type?.toLowerCase()) {\r\n case \"llm_call\":\r\n case \"llm\":\r\n return chalk.blue(\"[LLM] \");\r\n case \"tool_call\":\r\n case \"tool\":\r\n return chalk.magenta(\"[TOOL] \");\r\n case \"embedding\":\r\n return chalk.cyan(\"[EMBED]\");\r\n default:\r\n return chalk.gray(\"[ITEM] \");\r\n }\r\n}\r\n\r\nfunction truncate(str: string, maxLen: number): string {\r\n if (str.length <= maxLen) return str;\r\n return str.slice(0, maxLen - 3) + \"...\";\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createConnectionsCommand } from \"./connections/index.js\";\r\nimport { createRagSearchCommand } from \"./search.js\";\r\n\r\nexport function createRagCommand(): Command {\r\n const rag = new Command(\"rag\")\r\n .description(\"Manage RAG connections and perform semantic searches\");\r\n\r\n rag.addCommand(createConnectionsCommand());\r\n rag.addCommand(createRagSearchCommand());\r\n\r\n return rag;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createConnectionsListCommand } from \"./list.js\";\r\nimport { createConnectionsGetCommand } from \"./get.js\";\r\nimport { createConnectionsCreateCommand } from \"./create.js\";\r\nimport { createConnectionsUpdateCommand } from \"./update.js\";\r\nimport { createConnectionsDeleteCommand } from \"./delete.js\";\r\nimport { createConnectionsTestCommand } from \"./test.js\";\r\n\r\nexport function createConnectionsCommand(): Command {\r\n const connections = new Command(\"connections\")\r\n .description(\"Create, configure, and test RAG vector store connections\");\r\n\r\n connections.addCommand(createConnectionsListCommand());\r\n connections.addCommand(createConnectionsGetCommand());\r\n connections.addCommand(createConnectionsCreateCommand());\r\n connections.addCommand(createConnectionsUpdateCommand());\r\n connections.addCommand(createConnectionsDeleteCommand());\r\n connections.addCommand(createConnectionsTestCommand());\r\n\r\n return connections;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../../lib/output.js\";\r\nimport { addPaginationFlags } from \"../../../lib/flags.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createConnectionsListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List all configured RAG connections\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag connections list List all connections\r\n $ nebulaos rag connections list -o json Output as JSON\r\n $ nebulaos rag connections list --page 2 Show page 2\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, unknown> = {};\r\n if (globalOpts.page) params.page = globalOpts.page;\r\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\r\n\r\n const { data } = await api.get(\"/rag/openai-connections\", { params });\r\n const connections = Array.isArray(data) ? data : data.data || [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Name\", \"Type\", \"Status\", \"Created At\"],\r\n rows: connections.map((c: Record<string, string>) => [\r\n c.id,\r\n c.name || \"-\",\r\n c.type || \"-\",\r\n c.status || \"-\",\r\n c.createdAt || \"-\",\r\n ]),\r\n },\r\n data: connections,\r\n ids: connections.map((c: Record<string, string>) => c.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n addPaginationFlags(cmd);\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\nimport chalk from \"chalk\";\r\n\r\nexport function createConnectionsGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get detailed information about a RAG connection\")\r\n .argument(\"<id>\", \"Connection ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag connections get conn-123 View connection details\r\n $ nebulaos rag connections get conn-123 -o json Output as JSON\r\n`)\r\n .action(async (id, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get(`/rag/openai-connections/${id}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"RAG Connection\\n\"));\r\n printDetail(\"ID\", data.id);\r\n printDetail(\"Name\", data.name || \"-\");\r\n printDetail(\"Type\", data.type || \"-\");\r\n printDetail(\"Status\", data.status || \"-\");\r\n if (data.baseUrl) printDetail(\"Base URL\", data.baseUrl);\r\n if (data.model) printDetail(\"Model\", data.model);\r\n printDetail(\"Created At\", data.createdAt || \"-\");\r\n printDetail(\"Updated At\", data.updatedAt || \"-\");\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [data.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output, printSuccess, printDetail } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createConnectionsCreateCommand(): Command {\r\n const cmd = new Command(\"create\")\r\n .description(\"Create a new RAG connection to a vector store provider\")\r\n .requiredOption(\"--name <name>\", \"Connection name\")\r\n .requiredOption(\"--type <type>\", \"Connection type (e.g., openai, azure)\")\r\n .option(\"--base-url <url>\", \"Base URL for the connection\")\r\n .option(\"--api-key <key>\", \"API key for the connection\")\r\n .option(\"--model <model>\", \"Model name\")\r\n .option(\"--dimensions <number>\", \"Embedding dimensions\", parseInt)\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag connections create --name my-store --type openai \\\\\r\n --api-key sk-... --model text-embedding-3-small\r\n $ nebulaos rag connections create --name azure-store --type azure \\\\\r\n --base-url https://my-resource.openai.azure.com --api-key abc123 \\\\\r\n --dimensions 1536\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const body: Record<string, unknown> = {\r\n name: options.name,\r\n type: options.type,\r\n };\r\n if (options.baseUrl) body.baseUrl = options.baseUrl;\r\n if (options.apiKey) body.apiKey = options.apiKey;\r\n if (options.model) body.model = options.model;\r\n if (options.dimensions) body.dimensions = options.dimensions;\r\n\r\n const { data } = await api.post(\"/rag/openai-connections\", body);\r\n\r\n if (format === \"table\") {\r\n printSuccess(\"RAG connection created successfully.\");\r\n printDetail(\"ID\", data.id);\r\n printDetail(\"Name\", data.name);\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [data.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output, printSuccess, printDetail } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createConnectionsUpdateCommand(): Command {\r\n const cmd = new Command(\"update\")\r\n .description(\"Update an existing RAG connection's configuration\")\r\n .argument(\"<id>\", \"Connection ID\")\r\n .option(\"--name <name>\", \"Connection name\")\r\n .option(\"--base-url <url>\", \"Base URL for the connection\")\r\n .option(\"--api-key <key>\", \"API key for the connection\")\r\n .option(\"--model <model>\", \"Model name\")\r\n .option(\"--dimensions <number>\", \"Embedding dimensions\", parseInt)\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag connections update conn-123 --name new-name Rename connection\r\n $ nebulaos rag connections update conn-123 --api-key sk-new... Rotate API key\r\n $ nebulaos rag connections update conn-123 --model text-embedding-3-large\r\n`)\r\n .action(async (id, options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const body: Record<string, unknown> = {};\r\n if (options.name) body.name = options.name;\r\n if (options.baseUrl) body.baseUrl = options.baseUrl;\r\n if (options.apiKey) body.apiKey = options.apiKey;\r\n if (options.model) body.model = options.model;\r\n if (options.dimensions) body.dimensions = options.dimensions;\r\n\r\n const { data } = await api.patch(`/rag/openai-connections/${id}`, body);\r\n\r\n if (format === \"table\") {\r\n printSuccess(\"RAG connection updated successfully.\");\r\n printDetail(\"ID\", data.id);\r\n printDetail(\"Name\", data.name);\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [data.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { confirm } from \"@inquirer/prompts\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createConnectionsDeleteCommand(): Command {\r\n const cmd = new Command(\"delete\")\r\n .description(\"Permanently delete a RAG connection\")\r\n .argument(\"<id>\", \"Connection ID\")\r\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag connections delete conn-123 Delete with confirmation\r\n $ nebulaos rag connections delete conn-123 -y Delete without confirmation\r\n`)\r\n .action(async (id, options) => {\r\n try {\r\n if (!options.yes) {\r\n const shouldProceed = await confirm({\r\n message: `Delete RAG connection '${id}'?`,\r\n default: false,\r\n });\r\n if (!shouldProceed) {\r\n console.log(\"Cancelled.\");\r\n return;\r\n }\r\n }\r\n\r\n const api = getApiClient();\r\n await api.delete(`/rag/openai-connections/${id}`);\r\n printSuccess(`RAG connection '${id}' deleted.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createConnectionsTestCommand(): Command {\r\n const cmd = new Command(\"test\")\r\n .description(\"Test connectivity and authentication of a RAG connection\")\r\n .argument(\"<id>\", \"Connection ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag connections test conn-123 Test a connection\r\n $ nebulaos rag connections test conn-123 -o json Output result as JSON\r\n`)\r\n .action(async (id, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n console.log(\"Testing connection...\");\r\n const { data } = await api.post(`/rag/openai-connections/${id}/test`);\r\n\r\n if (format === \"table\") {\r\n if (data.success) {\r\n console.log(chalk.green(\"Connection test passed.\"));\r\n } else {\r\n console.log(chalk.red(`Connection test failed: ${data.error || \"Unknown error\"}`));\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createRagSearchCommand(): Command {\r\n const cmd = new Command(\"search\")\r\n .description(\"Perform a semantic search against a RAG connection\")\r\n .requiredOption(\"--connection <id>\", \"Connection ID to search against\")\r\n .requiredOption(\"--query <query>\", \"Search query\")\r\n .option(\"--limit <number>\", \"Maximum number of results\", parseInt)\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos rag search --connection conn-123 --query \"patient intake process\"\r\n $ nebulaos rag search --connection conn-123 --query \"billing codes\" --limit 5\r\n $ nebulaos rag search --connection conn-123 --query \"diagnosis\" -o json\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const body: Record<string, unknown> = {\r\n connectionId: options.connection,\r\n query: options.query,\r\n };\r\n if (options.limit) body.limit = options.limit;\r\n\r\n const { data } = await api.post(\"/rag/search\", body);\r\n const results = Array.isArray(data) ? data : data.results || [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"#\", \"Score\", \"Content\"],\r\n rows: results.map((r: Record<string, unknown>, i: number) => [\r\n String(i + 1),\r\n String(r.score ?? \"-\"),\r\n String(r.content || r.text || \"-\").slice(0, 100),\r\n ]),\r\n },\r\n data: results,\r\n ids: results.map((_: unknown, i: number) => String(i + 1)),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createFeaturesCatalogCommand } from \"./catalog.js\";\r\nimport { createFeaturesListCommand } from \"./list.js\";\r\nimport { createFeaturesGetCommand } from \"./get.js\";\r\nimport { createFeaturesEnableCommand } from \"./enable.js\";\r\nimport { createFeaturesDisableCommand } from \"./disable.js\";\r\nimport { createFeaturesConfigCommand } from \"./config.js\";\r\n\r\nexport function createFeaturesCommand(): Command {\r\n const features = new Command(\"features\")\r\n .description(\"Browse, enable, disable, and configure platform feature flags\");\r\n\r\n features.addCommand(createFeaturesCatalogCommand());\r\n features.addCommand(createFeaturesListCommand());\r\n features.addCommand(createFeaturesGetCommand());\r\n features.addCommand(createFeaturesEnableCommand());\r\n features.addCommand(createFeaturesDisableCommand());\r\n features.addCommand(createFeaturesConfigCommand());\r\n\r\n return features;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createFeaturesCatalogCommand(): Command {\r\n const cmd = new Command(\"catalog\")\r\n .description(\"List all available features in the platform catalog\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos features catalog Browse all available features\r\n $ nebulaos features catalog -o json Output as JSON\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get(\"/features/catalog\");\r\n const features = Array.isArray(data) ? data : data.data || [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Key\", \"Name\", \"Description\", \"Category\"],\r\n rows: features.map((f: Record<string, string>) => [\r\n f.key,\r\n f.name || \"-\",\r\n f.description || \"-\",\r\n f.category || \"-\",\r\n ]),\r\n },\r\n data: features,\r\n ids: features.map((f: Record<string, string>) => f.key),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createFeaturesListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List features enabled for the current organization\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos features list List enabled features\r\n $ nebulaos features list -o json Output as JSON\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get(\"/features\");\r\n const features = Array.isArray(data) ? data : data.data || [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Key\", \"Name\", \"Enabled\", \"Updated At\"],\r\n rows: features.map((f: Record<string, string | boolean>) => [\r\n String(f.key),\r\n String(f.name || \"-\"),\r\n String(f.enabled ?? f.isEnabled ?? \"-\"),\r\n String(f.updatedAt || \"-\"),\r\n ]),\r\n },\r\n data: features,\r\n ids: features.map((f: Record<string, string>) => f.key),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createFeaturesGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get details and configuration of a specific feature\")\r\n .argument(\"<key>\", \"Feature key\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos features get llm-gateway View feature details\r\n $ nebulaos features get rag -o json Output as JSON\r\n`)\r\n .action(async (key, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get(`/features/${key}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Feature\\n\"));\r\n printDetail(\"Key\", data.key);\r\n printDetail(\"Name\", data.name || \"-\");\r\n printDetail(\"Description\", data.description || \"-\");\r\n printDetail(\"Enabled\", data.enabled ?? data.isEnabled ? \"true\" : \"false\");\r\n if (data.config) {\r\n printDetail(\"Config\", JSON.stringify(data.config, null, 2));\r\n }\r\n printDetail(\"Updated At\", data.updatedAt || \"-\");\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [data.key],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { printSuccess } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createFeaturesEnableCommand(): Command {\r\n const cmd = new Command(\"enable\")\r\n .description(\"Enable a feature for the current organization\")\r\n .argument(\"<key>\", \"Feature key\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos features enable llm-gateway Enable the LLM gateway feature\r\n $ nebulaos features enable rag Enable the RAG feature\r\n`)\r\n .action(async (key) => {\r\n try {\r\n const api = getApiClient();\r\n await api.post(`/features/${key}/enable`);\r\n printSuccess(`Feature '${key}' enabled.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { printSuccess } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createFeaturesDisableCommand(): Command {\r\n const cmd = new Command(\"disable\")\r\n .description(\"Disable a feature for the current organization\")\r\n .argument(\"<key>\", \"Feature key\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos features disable llm-gateway Disable the LLM gateway feature\r\n $ nebulaos features disable rag Disable the RAG feature\r\n`)\r\n .action(async (key) => {\r\n try {\r\n const api = getApiClient();\r\n await api.post(`/features/${key}/disable`);\r\n printSuccess(`Feature '${key}' disabled.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output, printSuccess } from \"../../lib/output.js\";\r\nimport { handleError, CLIError, ExitCode } from \"../../lib/errors.js\";\r\n\r\nexport function createFeaturesConfigCommand(): Command {\r\n const cmd = new Command(\"config\")\r\n .description(\"View or update key-value configuration for a feature\")\r\n .argument(\"<key>\", \"Feature key\")\r\n .option(\"--set <entries...>\", \"Set config values (key=value)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos features config llm-gateway View current config\r\n $ nebulaos features config llm-gateway --set max_tokens=4096 Update a config value\r\n $ nebulaos features config rag --set provider=openai model=text-embedding-3-small\r\n $ nebulaos features config llm-gateway -o json Output as JSON\r\n`)\r\n .action(async (key, options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n if (options.set && options.set.length > 0) {\r\n const configValues: Record<string, string> = {};\r\n for (const entry of options.set) {\r\n const eqIndex = entry.indexOf(\"=\");\r\n if (eqIndex === -1) {\r\n throw new CLIError(\r\n `Invalid config entry '${entry}'. Use key=value format.`,\r\n ExitCode.ValidationError,\r\n );\r\n }\r\n const k = entry.slice(0, eqIndex);\r\n const v = entry.slice(eqIndex + 1);\r\n configValues[k] = v;\r\n }\r\n\r\n await api.patch(`/features/${key}/config`, configValues);\r\n printSuccess(`Feature '${key}' configuration updated.`);\r\n } else {\r\n const { data } = await api.get(`/features/${key}`);\r\n const featureConfig = data.config || {};\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(`Feature '${key}' Configuration\\n`));\r\n const entries = Object.entries(featureConfig);\r\n if (entries.length === 0) {\r\n console.log(\"No configuration set.\");\r\n } else {\r\n for (const [k, v] of entries) {\r\n console.log(` ${chalk.bold(k)}: ${v}`);\r\n }\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: featureConfig,\r\n ids: Object.keys(featureConfig),\r\n });\r\n }\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createTracesCommand } from \"./traces/index.js\";\r\nimport { createMetricsCommand } from \"./metrics.js\";\r\n\r\nexport function createObservabilityCommand(): Command {\r\n const observability = new Command(\"observability\")\r\n .alias(\"obs\")\r\n .description(\"Inspect traces and metrics from your agents and workflows\");\r\n\r\n observability.addCommand(createTracesCommand());\r\n observability.addCommand(createMetricsCommand());\r\n\r\n return observability;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createTracesSearchCommand } from \"./search.js\";\r\nimport { createTracesGetCommand } from \"./get.js\";\r\n\r\nexport function createTracesCommand(): Command {\r\n const traces = new Command(\"traces\")\r\n .description(\"Search and inspect distributed traces from agent executions\");\r\n\r\n traces.addCommand(createTracesSearchCommand());\r\n traces.addCommand(createTracesGetCommand());\r\n\r\n return traces;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../../lib/output.js\";\r\nimport { addPaginationFlags } from \"../../../lib/flags.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createTracesSearchCommand(): Command {\r\n const cmd = new Command(\"search\")\r\n .description(\"Search traces by status, agent, or time range\")\r\n .option(\"--status <status>\", \"Filter by status\")\r\n .option(\"--limit <number>\", \"Maximum number of results\", parseInt)\r\n .option(\"--agent <name>\", \"Filter by agent name\")\r\n .option(\"--from <date>\", \"Start date (ISO format)\")\r\n .option(\"--to <date>\", \"End date (ISO format)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos obs traces search List recent traces\r\n $ nebulaos obs traces search --agent my-agent Filter by agent\r\n $ nebulaos obs traces search --status error --limit 10 Find error traces\r\n $ nebulaos obs traces search --from 2026-01-01 --to 2026-01-31 -o json\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, unknown> = {};\r\n if (options.status) params.status = options.status;\r\n if (options.limit) params.limit = options.limit;\r\n if (options.agent) params.agent = options.agent;\r\n if (options.from) params.from = options.from;\r\n if (options.to) params.to = options.to;\r\n if (globalOpts.page) params.page = globalOpts.page;\r\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\r\n\r\n const { data } = await api.get(\"/observability/traces/search\", { params });\r\n const traces = Array.isArray(data) ? data : data.data || [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Trace ID\", \"Status\", \"Duration\", \"Agent\", \"Started At\"],\r\n rows: traces.map((t: Record<string, string>) => [\r\n t.traceId || t.id || \"-\",\r\n t.status || \"-\",\r\n t.duration ? `${t.duration}ms` : \"-\",\r\n t.agent || t.agentName || \"-\",\r\n t.startedAt || t.createdAt || \"-\",\r\n ]),\r\n },\r\n data: traces,\r\n ids: traces.map((t: Record<string, string>) => t.traceId || t.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n addPaginationFlags(cmd);\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createTracesGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get detailed trace information including all spans\")\r\n .argument(\"[traceId]\", \"Trace ID\")\r\n .option(\"--execution-id <executionId>\", \"Lookup trace by execution ID\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos obs traces get abc123-def456... View trace by trace ID\r\n $ nebulaos obs traces get --execution-id exec-789... View trace by execution ID\r\n $ nebulaos obs traces get abc123 -o json Output as JSON\r\n`)\r\n .action(async (traceId, options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n if (!traceId && !options.executionId) {\r\n console.error(\"Error: provide either a <traceId> argument or --execution-id <executionId>\");\r\n process.exit(1);\r\n }\r\n\r\n const url = options.executionId\r\n ? `/observability/executions/${options.executionId}/trace`\r\n : `/observability/traces/${traceId}`;\r\n const { data } = await api.get(url);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Trace\\n\"));\r\n printDetail(\"Trace ID\", data.traceId || data.id || \"-\");\r\n printDetail(\"Status\", data.status || \"-\");\r\n printDetail(\"Duration\", data.duration ? `${data.duration}ms` : \"-\");\r\n printDetail(\"Agent\", data.agent || data.agentName || \"-\");\r\n printDetail(\"Started At\", data.startedAt || data.createdAt || \"-\");\r\n printDetail(\"Ended At\", data.endedAt || \"-\");\r\n\r\n if (data.spans && data.spans.length > 0) {\r\n console.log(chalk.bold(\"\\nSpans:\"));\r\n for (const span of data.spans) {\r\n console.log(` ${span.spanId} - ${span.name || span.operationName || \"unknown\"} (${span.duration ? span.duration + \"ms\" : \"-\"})`);\r\n }\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [data.traceId || data.id],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createMetricsCommand(): Command {\r\n const cmd = new Command(\"metrics\")\r\n .description(\"View observability metrics with optional time range and type filters\")\r\n .option(\"--type <type>\", \"Metric type filter\")\r\n .option(\"--from <date>\", \"Start date (ISO format)\")\r\n .option(\"--to <date>\", \"End date (ISO format)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos obs metrics List all metrics\r\n $ nebulaos obs metrics --type latency Filter by metric type\r\n $ nebulaos obs metrics --from 2026-01-01 --to 2026-01-31 Filter by date range\r\n $ nebulaos obs metrics -o json Output as JSON\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, unknown> = {};\r\n if (options.type) params.type = options.type;\r\n if (options.from) params.from = options.from;\r\n if (options.to) params.to = options.to;\r\n\r\n const { data } = await api.get(\"/observability/metrics\", { params });\r\n const metrics = Array.isArray(data) ? data : data.data || [];\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Name\", \"Type\", \"Value\", \"Timestamp\"],\r\n rows: metrics.map((m: Record<string, string>) => [\r\n m.name || \"-\",\r\n m.type || \"-\",\r\n String(m.value ?? \"-\"),\r\n m.timestamp || \"-\",\r\n ]),\r\n },\r\n data: metrics,\r\n ids: metrics.map((m: Record<string, string>) => m.name || m.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createConfigGetCommand } from \"./get.js\";\r\nimport { createConfigSetCommand } from \"./set.js\";\r\nimport { createConfigListCommand } from \"./list.js\";\r\n\r\nexport function createConfigCommand(): Command {\r\n const config = new Command(\"config\")\r\n .description(\"View and modify CLI configuration (output format, page size, contexts)\");\r\n\r\n config.addCommand(createConfigGetCommand());\r\n config.addCommand(createConfigSetCommand());\r\n config.addCommand(createConfigListCommand());\r\n\r\n return config;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getConfig } from \"../../lib/config.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createConfigGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get the current value of a configuration key\")\r\n .argument(\"<key>\", \"Configuration key (e.g., defaults.output, defaults.pageSize)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos config get defaults.output Get default output format\r\n $ nebulaos config get defaults.pageSize Get default page size\r\n $ nebulaos config get currentContext Get active context name\r\n`)\r\n .action(async (key, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const config = getConfig();\r\n\r\n const parts = key.split(\".\");\r\n let value: unknown = config;\r\n for (const part of parts) {\r\n if (value && typeof value === \"object\" && part in value) {\r\n value = (value as Record<string, unknown>)[part];\r\n } else {\r\n throw new CLIError(`Configuration key '${key}' not found.`, ExitCode.NotFound);\r\n }\r\n }\r\n\r\n if (format === \"table\") {\r\n printDetail(key, String(value));\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: { key, value },\r\n ids: [key],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { setDefault, type CLIConfig } from \"../../lib/config.js\";\r\nimport { resolveFormat, output, printSuccess } from \"../../lib/output.js\";\r\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\r\n\r\nconst VALID_KEYS: Record<string, (v: string) => unknown> = {\r\n \"defaults.output\": (v) => {\r\n const valid = [\"table\", \"json\", \"yaml\", \"quiet\"];\r\n if (!valid.includes(v)) {\r\n throw new CLIError(\r\n `Invalid output format '${v}'. Valid values: ${valid.join(\", \")}`,\r\n ExitCode.ValidationError,\r\n );\r\n }\r\n return v;\r\n },\r\n \"defaults.pageSize\": (v) => {\r\n const n = parseInt(v, 10);\r\n if (isNaN(n) || n < 1 || n > 100) {\r\n throw new CLIError(\r\n \"Page size must be a number between 1 and 100.\",\r\n ExitCode.ValidationError,\r\n );\r\n }\r\n return n;\r\n },\r\n};\r\n\r\nexport function createConfigSetCommand(): Command {\r\n const cmd = new Command(\"set\")\r\n .description(\"Set a CLI configuration value\")\r\n .argument(\"<key>\", \"Configuration key (e.g., defaults.output, defaults.pageSize)\")\r\n .argument(\"<value>\", \"Configuration value\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos config set defaults.output json Set default output to JSON\r\n $ nebulaos config set defaults.output table Set default output to table\r\n $ nebulaos config set defaults.pageSize 25 Set default page size to 25\r\n\r\nValid keys:\r\n defaults.output Output format (table, json, yaml, quiet)\r\n defaults.pageSize Number of items per page (1-100)\r\n`)\r\n .action(async (key, value, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n\r\n const parser = VALID_KEYS[key];\r\n if (!parser) {\r\n throw new CLIError(\r\n `Unknown configuration key '${key}'. Valid keys: ${Object.keys(VALID_KEYS).join(\", \")}`,\r\n ExitCode.ValidationError,\r\n );\r\n }\r\n\r\n const parsed = parser(value);\r\n const parts = key.split(\".\");\r\n if (parts[0] === \"defaults\" && parts.length === 2) {\r\n setDefault(parts[1] as keyof CLIConfig[\"defaults\"], parsed as never);\r\n }\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Key\", \"Value\"],\r\n rows: [[key, String(parsed)]],\r\n },\r\n data: { key, value: parsed },\r\n ids: [key],\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getConfig, getConfigPath } from \"../../lib/config.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\nexport function createConfigListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"Display all configuration values and registered contexts\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos config list Show all config and contexts\r\n $ nebulaos config list -o json Output as JSON\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const config = getConfig();\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(\"Configuration\\n\"));\r\n printDetail(\"Config File\", getConfigPath());\r\n printDetail(\"Current Context\", config.currentContext || \"(none)\");\r\n printDetail(\"Output Format\", config.defaults.output);\r\n printDetail(\"Page Size\", String(config.defaults.pageSize));\r\n\r\n const contextNames = Object.keys(config.contexts);\r\n if (contextNames.length > 0) {\r\n console.log(chalk.bold(\"\\nContexts:\"));\r\n for (const name of contextNames) {\r\n const ctx = config.contexts[name];\r\n const active = name === config.currentContext ? chalk.green(\" (active)\") : \"\";\r\n console.log(` ${name}${active} - ${ctx.apiUrl}`);\r\n }\r\n }\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data: config,\r\n ids: Object.keys(config.contexts),\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createRoutesCommand } from \"./routes/index.js\";\r\nimport { createKeysCommand } from \"./keys/index.js\";\r\nimport { createRequestsCommand } from \"./requests.js\";\r\nimport { createUsageCommand } from \"./usage.js\";\r\nimport { createCatalogCommand } from \"./catalog.js\";\r\n\r\nexport function createLlmGatewayCommand(): Command {\r\n const llmGateway = new Command(\"llm-gateway\")\r\n .alias(\"llm\")\r\n .description(\"Manage LLM Gateway routes, API keys, model catalog, and usage\");\r\n\r\n llmGateway.addCommand(createRoutesCommand());\r\n llmGateway.addCommand(createKeysCommand());\r\n llmGateway.addCommand(createRequestsCommand());\r\n llmGateway.addCommand(createUsageCommand());\r\n llmGateway.addCommand(createCatalogCommand());\r\n\r\n return llmGateway;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createRoutesListCommand } from \"./list.js\";\r\nimport { createRoutesGetCommand } from \"./get.js\";\r\nimport { createRoutesCreateCommand } from \"./create.js\";\r\nimport { createRoutesUpdateCommand } from \"./update.js\";\r\nimport { createRoutesDeleteCommand } from \"./delete.js\";\r\n\r\nexport function createRoutesCommand(): Command {\r\n const routes = new Command(\"routes\")\r\n .description(\"Create, update, and manage LLM gateway routes (model configurations)\");\r\n\r\n routes.addCommand(createRoutesListCommand());\r\n routes.addCommand(createRoutesGetCommand());\r\n routes.addCommand(createRoutesCreateCommand());\r\n routes.addCommand(createRoutesUpdateCommand());\r\n routes.addCommand(createRoutesDeleteCommand());\r\n\r\n return routes;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\ninterface RouteItem {\r\n name: string;\r\n description: string;\r\n primaryModel: string;\r\n status: string;\r\n provisioningStatus: string;\r\n updatedAt: string;\r\n}\r\n\r\nexport function createRoutesListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List all configured LLM gateway routes\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm routes list List all routes\r\n $ nebulaos llm routes list -o json Output as JSON\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get<RouteItem[]>(\"/llm-gateway/routes\");\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Alias\", \"Description\", \"Model\", \"Status\", \"Provisioning\", \"Updated\"],\r\n rows: data.map((r) => [\r\n r.name,\r\n r.description || \"-\",\r\n r.primaryModel,\r\n r.status,\r\n r.provisioningStatus,\r\n r.updatedAt ? new Date(r.updatedAt).toLocaleString() : \"-\",\r\n ]),\r\n },\r\n data,\r\n ids: data.map((r) => r.name),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\ninterface RouteDetail {\r\n name: string;\r\n description: string;\r\n primaryModel: string;\r\n fallbackChain: string[];\r\n status: string;\r\n provisioningStatus: string;\r\n provider: string | null;\r\n modelName: string | null;\r\n maxTokens: number | null;\r\n timeoutMs: number | null;\r\n retries: number | null;\r\n updatedAt: string;\r\n}\r\n\r\nexport function createRoutesGetCommand(): Command {\r\n const cmd = new Command(\"get\")\r\n .description(\"Get full details of an LLM gateway route including fallback chain\")\r\n .argument(\"<alias>\", \"Route alias\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm routes get my-route View route details\r\n $ nebulaos llm routes get my-route -o json Output as JSON\r\n`)\r\n .action(async (alias, _options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get<RouteDetail>(`/llm-gateway/routes/${alias}`);\r\n\r\n if (format === \"table\") {\r\n console.log(chalk.bold(`Route: ${data.name}\\n`));\r\n printDetail(\"Alias\", data.name);\r\n printDetail(\"Description\", data.description || \"-\");\r\n printDetail(\"Provider\", data.provider || \"-\");\r\n printDetail(\"Model\", data.modelName || data.primaryModel);\r\n printDetail(\"Status\", data.status);\r\n printDetail(\"Provisioning\", data.provisioningStatus);\r\n if (data.maxTokens) printDetail(\"Max Tokens\", String(data.maxTokens));\r\n if (data.timeoutMs) printDetail(\"Timeout (ms)\", String(data.timeoutMs));\r\n if (data.retries) printDetail(\"Retries\", String(data.retries));\r\n if (data.fallbackChain?.length) {\r\n printDetail(\"Fallback Chain\", data.fallbackChain.join(\" -> \"));\r\n }\r\n printDetail(\"Updated\", data.updatedAt ? new Date(data.updatedAt).toLocaleString() : \"-\");\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: [data.name],\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { input } from \"@inquirer/prompts\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createRoutesCreateCommand(): Command {\r\n const cmd = new Command(\"create\")\r\n .description(\"Create a new LLM gateway route (interactive or via flags)\")\r\n .option(\"--alias <alias>\", \"Route alias\")\r\n .option(\"--provider <provider>\", \"LLM provider (e.g. openai, anthropic, azure)\")\r\n .option(\"--model <model>\", \"Model name (e.g. gpt-4o, claude-3-opus)\")\r\n .option(\"--description <description>\", \"Route description\")\r\n .option(\"--max-tokens <number>\", \"Max tokens limit\", parseInt)\r\n .option(\"--timeout <ms>\", \"Timeout in milliseconds\", parseInt)\r\n .option(\"--retries <count>\", \"Retry count\", parseInt)\r\n .option(\"--credential <key=value>\", \"Credential key=value pair (repeatable)\", collectKeyValue, {})\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm routes create Interactive mode\r\n $ nebulaos llm routes create --alias gpt4 --provider openai --model gpt-4o\r\n $ nebulaos llm routes create --alias claude --provider anthropic --model claude-3-opus \\\\\r\n --credential api_key=sk-...\r\n $ nebulaos llm routes create --alias fast --provider openai --model gpt-4o-mini \\\\\r\n --max-tokens 4096 --timeout 30000 --retries 2\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const api = getApiClient();\r\n\r\n const alias = options.alias || await input({ message: \"Route alias:\" });\r\n const provider = options.provider || await input({ message: \"Provider (e.g. openai, anthropic, azure):\" });\r\n const modelName = options.model || await input({ message: \"Model name:\" });\r\n const description = options.description || await input({ message: \"Description (optional):\", default: \"\" });\r\n\r\n let credentials = options.credential;\r\n if (Object.keys(credentials).length === 0) {\r\n const apiKey = await input({ message: \"API key for provider:\" });\r\n credentials = { api_key: apiKey };\r\n }\r\n\r\n const body: Record<string, unknown> = {\r\n alias,\r\n provider,\r\n modelName,\r\n credentials,\r\n };\r\n\r\n if (description) body.description = description;\r\n if (options.maxTokens) body.maxTokens = options.maxTokens;\r\n if (options.timeout) body.timeoutMs = options.timeout;\r\n if (options.retries) body.retryCount = options.retries;\r\n\r\n await api.post(\"/llm-gateway/routes\", body);\r\n printSuccess(`Route '${alias}' created successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n\r\nfunction collectKeyValue(value: string, previous: Record<string, string>): Record<string, string> {\r\n const [k, ...rest] = value.split(\"=\");\r\n if (k && rest.length > 0) {\r\n previous[k] = rest.join(\"=\");\r\n }\r\n return previous;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createRoutesUpdateCommand(): Command {\r\n const cmd = new Command(\"update\")\r\n .description(\"Update an existing LLM gateway route configuration\")\r\n .argument(\"<alias>\", \"Route alias\")\r\n .option(\"--description <description>\", \"Route description\")\r\n .option(\"--provider <provider>\", \"LLM provider\")\r\n .option(\"--model <model>\", \"Model name\")\r\n .option(\"--max-tokens <number>\", \"Max tokens limit\", parseInt)\r\n .option(\"--timeout <ms>\", \"Timeout in milliseconds\", parseInt)\r\n .option(\"--retries <count>\", \"Retry count\", parseInt)\r\n .option(\"--credential <key=value>\", \"Credential key=value pair (repeatable)\", collectKeyValue, {})\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm routes update my-route --model gpt-4o-mini Change model\r\n $ nebulaos llm routes update my-route --max-tokens 8192 Update token limit\r\n $ nebulaos llm routes update my-route --credential api_key=sk-new... Update credentials\r\n $ nebulaos llm routes update my-route --timeout 60000 --retries 3 Update timeouts\r\n`)\r\n .action(async (alias, options, command) => {\r\n try {\r\n const api = getApiClient();\r\n\r\n const body: Record<string, unknown> = {};\r\n\r\n if (options.description !== undefined) body.description = options.description;\r\n if (options.provider) body.provider = options.provider;\r\n if (options.model) body.modelName = options.model;\r\n if (options.maxTokens) body.maxTokens = options.maxTokens;\r\n if (options.timeout) body.timeoutMs = options.timeout;\r\n if (options.retries) body.retryCount = options.retries;\r\n if (Object.keys(options.credential).length > 0) body.credentials = options.credential;\r\n\r\n await api.put(`/llm-gateway/routes/${alias}`, body);\r\n printSuccess(`Route '${alias}' updated successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n\r\nfunction collectKeyValue(value: string, previous: Record<string, string>): Record<string, string> {\r\n const [k, ...rest] = value.split(\"=\");\r\n if (k && rest.length > 0) {\r\n previous[k] = rest.join(\"=\");\r\n }\r\n return previous;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { confirm } from \"@inquirer/prompts\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createRoutesDeleteCommand(): Command {\r\n const cmd = new Command(\"delete\")\r\n .description(\"Permanently delete an LLM gateway route\")\r\n .argument(\"<alias>\", \"Route alias\")\r\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm routes delete my-route Delete with confirmation prompt\r\n $ nebulaos llm routes delete my-route -y Delete without confirmation\r\n`)\r\n .action(async (alias, options) => {\r\n try {\r\n if (!options.yes) {\r\n const shouldProceed = await confirm({\r\n message: `Delete route '${alias}'? This cannot be undone.`,\r\n default: false,\r\n });\r\n\r\n if (!shouldProceed) {\r\n console.log(\"Cancelled.\");\r\n return;\r\n }\r\n }\r\n\r\n const api = getApiClient();\r\n await api.delete(`/llm-gateway/routes/${alias}`);\r\n printSuccess(`Route '${alias}' deleted successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { createKeysListCommand } from \"./list.js\";\r\nimport { createKeysCreateCommand } from \"./create.js\";\r\nimport { createKeysRevokeCommand } from \"./revoke.js\";\r\n\r\nexport function createKeysCommand(): Command {\r\n const keys = new Command(\"keys\")\r\n .description(\"Create, list, and revoke LLM gateway API keys\");\r\n\r\n keys.addCommand(createKeysListCommand());\r\n keys.addCommand(createKeysCreateCommand());\r\n keys.addCommand(createKeysRevokeCommand());\r\n\r\n return keys;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\ninterface KeyItem {\r\n id: string;\r\n name: string;\r\n description: string;\r\n user: string;\r\n status: string;\r\n allowedRoutes: string[];\r\n lastUsedAt: string | null;\r\n}\r\n\r\nexport function createKeysListCommand(): Command {\r\n const cmd = new Command(\"list\")\r\n .description(\"List all LLM gateway API keys and their allowed routes\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm keys list List all gateway API keys\r\n $ nebulaos llm keys list -o json Output as JSON\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get<KeyItem[]>(\"/llm-gateway/keys\");\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"ID\", \"Name\", \"User\", \"Status\", \"Allowed Routes\", \"Last Used\"],\r\n rows: data.map((k) => [\r\n k.id,\r\n k.name,\r\n k.user,\r\n k.status,\r\n k.allowedRoutes?.length ? k.allowedRoutes.join(\", \") : \"all\",\r\n k.lastUsedAt ? new Date(k.lastUsedAt).toLocaleString() : \"never\",\r\n ]),\r\n },\r\n data,\r\n ids: data.map((k) => k.id),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { input, select } from \"@inquirer/prompts\";\r\nimport chalk from \"chalk\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createKeysCreateCommand(): Command {\r\n const cmd = new Command(\"create\")\r\n .description(\"Create a new LLM gateway API key (interactive or via flags)\")\r\n .option(\"--name <name>\", \"Key name\")\r\n .option(\"--type <type>\", \"Key type (personal or service)\")\r\n .option(\"--allowed-routes <routes>\", \"Comma-separated list of allowed route aliases\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm keys create Interactive mode\r\n $ nebulaos llm keys create --name my-key --type personal Create personal key\r\n $ nebulaos llm keys create --name svc-key --type service \\\\\r\n --allowed-routes gpt4,claude Restrict to specific routes\r\n\r\nNote: The API key is displayed only once after creation. Save it securely.\r\n`)\r\n .action(async (options) => {\r\n try {\r\n const api = getApiClient();\r\n\r\n const name = options.name || await input({ message: \"Key name:\" });\r\n const type = options.type || await select({\r\n message: \"Key type:\",\r\n choices: [\r\n { name: \"personal\", value: \"personal\" },\r\n { name: \"service\", value: \"service\" },\r\n ],\r\n });\r\n\r\n const body: Record<string, unknown> = { name, type };\r\n\r\n if (options.allowedRoutes) {\r\n body.allowedRoutes = options.allowedRoutes.split(\",\").map((s: string) => s.trim());\r\n }\r\n\r\n const { data } = await api.post<{ key: string }>(\"/llm-gateway/keys\", body);\r\n\r\n printSuccess(`API key '${name}' created successfully.`);\r\n console.log(`\\n${chalk.bold(\"Key:\")} ${data.key}`);\r\n console.log(chalk.yellow(\"\\nSave this key now. It will not be shown again.\"));\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { confirm } from \"@inquirer/prompts\";\r\nimport { getApiClient } from \"../../../lib/api.js\";\r\nimport { printSuccess } from \"../../../lib/output.js\";\r\nimport { handleError } from \"../../../lib/errors.js\";\r\n\r\nexport function createKeysRevokeCommand(): Command {\r\n const cmd = new Command(\"revoke\")\r\n .description(\"Permanently revoke an LLM gateway API key\")\r\n .argument(\"<keyId>\", \"API key ID\")\r\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm keys revoke key-123 Revoke with confirmation prompt\r\n $ nebulaos llm keys revoke key-123 -y Revoke without confirmation\r\n`)\r\n .action(async (keyId, options) => {\r\n try {\r\n if (!options.yes) {\r\n const shouldProceed = await confirm({\r\n message: `Revoke API key '${keyId}'? This cannot be undone.`,\r\n default: false,\r\n });\r\n\r\n if (!shouldProceed) {\r\n console.log(\"Cancelled.\");\r\n return;\r\n }\r\n }\r\n\r\n const api = getApiClient();\r\n await api.delete(`/llm-gateway/keys/${keyId}`);\r\n printSuccess(`API key '${keyId}' revoked successfully.`);\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface RequestItem {\r\n requestId: string;\r\n timestamp: string;\r\n routeAlias: string;\r\n apiKeyName: string;\r\n modelFinal: string;\r\n totalTokens: number | null;\r\n durationMs: number | null;\r\n status: string;\r\n costUsd: number | null;\r\n}\r\n\r\nexport function createRequestsCommand(): Command {\r\n const cmd = new Command(\"requests\")\r\n .description(\"List recent LLM gateway requests with token usage and cost details\")\r\n .option(\"--limit <number>\", \"Maximum number of requests to return\", parseInt)\r\n .option(\"--route <alias>\", \"Filter by route alias\")\r\n .option(\"--status <status>\", \"Filter by status (success or error)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm requests List recent requests\r\n $ nebulaos llm requests --limit 10 Show last 10 requests\r\n $ nebulaos llm requests --route my-route Filter by route\r\n $ nebulaos llm requests --status error Show only failed requests\r\n $ nebulaos llm requests -o json Output as JSON\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, string> = {};\r\n if (options.limit) params.limit = String(options.limit);\r\n if (options.route) params.routeAlias = options.route;\r\n if (options.status) params.status = options.status;\r\n\r\n const { data } = await api.get<RequestItem[]>(\"/llm-gateway/requests\", { params });\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Request ID\", \"Timestamp\", \"Route\", \"Model\", \"Tokens\", \"Duration (ms)\", \"Status\", \"Cost\"],\r\n rows: data.map((r) => [\r\n r.requestId.substring(0, 12) + \"...\",\r\n new Date(r.timestamp).toLocaleString(),\r\n r.routeAlias,\r\n r.modelFinal,\r\n r.totalTokens != null ? String(r.totalTokens) : \"-\",\r\n r.durationMs != null ? String(r.durationMs) : \"-\",\r\n r.status,\r\n r.costUsd != null ? `$${r.costUsd.toFixed(4)}` : \"-\",\r\n ]),\r\n },\r\n data,\r\n ids: data.map((r) => r.requestId),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface UsageItem {\r\n date: string;\r\n route: string;\r\n model: string;\r\n tokens: number;\r\n costUsd: number | null;\r\n status: string;\r\n}\r\n\r\nexport function createUsageCommand(): Command {\r\n const cmd = new Command(\"usage\")\r\n .description(\"Show aggregated LLM gateway usage statistics (tokens and costs)\")\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm usage Show usage summary\r\n $ nebulaos llm usage -o json Output as JSON\r\n $ nebulaos llm usage -o yaml Output as YAML\r\n`)\r\n .action(async (_options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const { data } = await api.get<UsageItem[]>(\"/llm-gateway/usage\");\r\n\r\n output(format, {\r\n table: {\r\n headers: [\"Date\", \"Route\", \"Model\", \"Tokens\", \"Cost\", \"Status\"],\r\n rows: data.map((u) => [\r\n u.date,\r\n u.route,\r\n u.model,\r\n String(u.tokens),\r\n u.costUsd != null ? `$${u.costUsd.toFixed(4)}` : \"-\",\r\n u.status,\r\n ]),\r\n },\r\n data,\r\n ids: data.map((u) => `${u.date}-${u.route}`),\r\n });\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import { Command } from \"commander\";\r\nimport { getApiClient } from \"../../lib/api.js\";\r\nimport { resolveFormat, output } from \"../../lib/output.js\";\r\nimport { handleError } from \"../../lib/errors.js\";\r\n\r\ninterface CatalogItem {\r\n model: string;\r\n provider: string;\r\n modality: string;\r\n priceInput: number | null;\r\n priceOutput: number | null;\r\n status: string;\r\n}\r\n\r\ninterface CatalogPage {\r\n items: CatalogItem[];\r\n page: number;\r\n limit: number;\r\n total: number;\r\n}\r\n\r\nexport function createCatalogCommand(): Command {\r\n const cmd = new Command(\"catalog\")\r\n .description(\"Browse available LLM models with pricing and provider info\")\r\n .option(\"--search <query>\", \"Search models by name\")\r\n .option(\"--provider <provider>\", \"Filter by provider\")\r\n .option(\"--page <number>\", \"Page number\", parseInt)\r\n .option(\"--limit <number>\", \"Items per page\", parseInt)\r\n .addHelpText(\"after\", `\r\nExamples:\r\n $ nebulaos llm catalog List all available models\r\n $ nebulaos llm catalog --search gpt-4 Search for GPT-4 models\r\n $ nebulaos llm catalog --provider openai Show only OpenAI models\r\n $ nebulaos llm catalog --provider anthropic -o json Output Anthropic models as JSON\r\n`)\r\n .action(async (options, command) => {\r\n try {\r\n const globalOpts = command.optsWithGlobals();\r\n const format = resolveFormat(globalOpts.output);\r\n const api = getApiClient();\r\n\r\n const params: Record<string, string> = {};\r\n if (options.search) params.q = options.search;\r\n if (options.provider) params.provider = options.provider;\r\n if (options.page) params.page = String(options.page);\r\n if (options.limit) params.limit = String(options.limit);\r\n\r\n const { data } = await api.get<CatalogPage>(\"/llm-gateway/catalog\", { params });\r\n\r\n if (format === \"table\") {\r\n output(format, {\r\n table: {\r\n headers: [\"Model\", \"Provider\", \"Modality\", \"Input Price\", \"Output Price\", \"Status\"],\r\n rows: data.items.map((m) => [\r\n m.model,\r\n m.provider,\r\n m.modality,\r\n m.priceInput != null ? `$${m.priceInput}` : \"-\",\r\n m.priceOutput != null ? `$${m.priceOutput}` : \"-\",\r\n m.status,\r\n ]),\r\n },\r\n data: data.items,\r\n ids: data.items.map((m) => m.model),\r\n });\r\n console.log(`\\nPage ${data.page} of ${Math.ceil(data.total / data.limit)} (${data.total} total models)`);\r\n } else {\r\n output(format, {\r\n table: { headers: [], rows: [] },\r\n data,\r\n ids: data.items.map((m) => m.model),\r\n });\r\n }\r\n } catch (error) {\r\n handleError(error);\r\n }\r\n });\r\n\r\n return cmd;\r\n}\r\n","import chalk from \"chalk\";\r\n\r\nexport interface PaginationMeta {\r\n page: number;\r\n pageSize: number;\r\n total: number;\r\n totalPages: number;\r\n}\r\n\r\nexport function printPaginationInfo(meta: PaginationMeta): void {\r\n if (meta.totalPages <= 1) return;\r\n\r\n console.log(\r\n chalk.dim(\r\n `\\nPage ${meta.page}/${meta.totalPages} (${meta.total} total). ` +\r\n `Use --page and --page-size to navigate.`,\r\n ),\r\n );\r\n}\r\n\r\nexport function buildPaginationParams(options: {\r\n page?: number;\r\n pageSize?: number;\r\n}): Record<string, number> {\r\n const params: Record<string, number> = {};\r\n\r\n if (options.page) params.page = options.page;\r\n if (options.pageSize) params.pageSize = options.pageSize;\r\n\r\n return params;\r\n}\r\n","const DEFAULT_LIMITS: Record<string, number> = {\r\n id: 36,\r\n name: 30,\r\n description: 50,\r\n url: 60,\r\n status: 15,\r\n date: 20,\r\n default: 40,\r\n};\r\n\r\nexport function truncate(\r\n text: string | null | undefined,\r\n maxLength?: number,\r\n type?: string,\r\n): string {\r\n if (!text) return \"-\";\r\n\r\n const limit = maxLength ?? DEFAULT_LIMITS[type ?? \"default\"] ?? DEFAULT_LIMITS.default;\r\n\r\n if (text.length <= limit) return text;\r\n\r\n return text.slice(0, limit - 3) + \"...\";\r\n}\r\n\r\nexport function truncateId(id: string): string {\r\n if (!id) return \"-\";\r\n if (id.length <= 8) return id;\r\n return id.slice(0, 8) + \"...\";\r\n}\r\n\r\nexport function formatDate(date: string | null | undefined): string {\r\n if (!date) return \"-\";\r\n\r\n const d = new Date(date);\r\n return d.toLocaleDateString(\"en-US\", {\r\n year: \"numeric\",\r\n month: \"short\",\r\n day: \"numeric\",\r\n hour: \"2-digit\",\r\n minute: \"2-digit\",\r\n });\r\n}\r\n","import { getCurrentContext, type ContextConfig } from \"./config.js\";\r\nimport { AuthenticationError } from \"./errors.js\";\r\n\r\nexport function withAuth<T>(fn: (context: ContextConfig) => Promise<T>): () => Promise<T> {\r\n return async () => {\r\n const context = getCurrentContext();\r\n\r\n if (!context.token) {\r\n throw new AuthenticationError();\r\n }\r\n\r\n return fn(context);\r\n };\r\n}\r\n\r\nexport function requireAuth(): ContextConfig {\r\n const context = getCurrentContext();\r\n\r\n if (!context.token) {\r\n throw new AuthenticationError();\r\n }\r\n\r\n return context;\r\n}\r\n"],"mappings":";AAAA,SAAS,WAAAA,iBAAe;;;ACAxB,SAAuB,cAAc;AAE9B,SAAS,eAAe,SAA2B;AACxD,UACG;AAAA,IACC,IAAI,OAAO,yBAAyB,eAAe,EAChD,QAAQ,CAAC,SAAS,QAAQ,QAAQ,OAAO,CAAC,EAC1C,IAAI,iBAAiB;AAAA,EAC1B,EACC;AAAA,IACC,IAAI,OAAO,oBAAoB,wBAAwB,EACpD,IAAI,kBAAkB;AAAA,EAC3B,EACC;AAAA,IACC,IAAI,OAAO,mBAAmB,kBAAkB,EAC7C,IAAI,kBAAkB;AAAA,EAC3B,EACC;AAAA,IACC,IAAI,OAAO,mBAAmB,+BAA+B,EAC1D,IAAI,gBAAgB;AAAA,EACzB,EACC;AAAA,IACC,IAAI,OAAO,iBAAiB,0BAA0B,EACnD,IAAI,iBAAiB;AAAA,EAC1B,EACC;AAAA,IACC,IAAI,OAAO,cAAc,wBAAwB;AAAA,EACnD,EACC;AAAA,IACC,IAAI,OAAO,aAAa,uBAAuB;AAAA,EACjD;AAEF,SAAO;AACT;AAEO,SAAS,mBAAmB,SAA2B;AAC5D,UACG;AAAA,IACC,IAAI,OAAO,mBAAmB,aAAa,EAAE,UAAU,QAAQ;AAAA,EACjE,EACC;AAAA,IACC,IAAI,OAAO,wBAAwB,gBAAgB,EAAE,UAAU,QAAQ;AAAA,EACzE;AAEF,SAAO;AACT;;;AC7CO,IAAK,WAAL,kBAAKC,cAAL;AACL,EAAAA,oBAAA,aAAU,KAAV;AACA,EAAAA,oBAAA,kBAAe,KAAf;AACA,EAAAA,oBAAA,qBAAkB,KAAlB;AACA,EAAAA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Q,SAAU,QAAO,WAAW,QAAQ;AAEhD,SAAO;AACT;;;AC9BA,IAAM,iBAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AACX;AAEO,SAASC,UACd,MACA,WACA,MACQ;AACR,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,QAAQ,aAAa,eAAe,QAAQ,SAAS,KAAK,eAAe;AAE/E,MAAI,KAAK,UAAU,MAAO,QAAO;AAEjC,SAAO,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI;AACpC;AAEO,SAAS,WAAW,IAAoB;AAC7C,MAAI,CAAC,GAAI,QAAO;AAChB,MAAI,GAAG,UAAU,EAAG,QAAO;AAC3B,SAAO,GAAG,MAAM,GAAG,CAAC,IAAI;AAC1B;AAEO,SAAS,WAAW,MAAyC;AAClE,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,SAAO,EAAE,mBAAmB,SAAS;AAAA,IACnC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACH;;;ACtCO,SAAS,SAAY,IAA8D;AACxF,SAAO,YAAY;AACjB,UAAM,UAAU,kBAAkB;AAElC,QAAI,CAAC,QAAQ,OAAO;AAClB,YAAM,IAAI,oBAAoB;AAAA,IAChC;AAEA,WAAO,GAAG,OAAO;AAAA,EACnB;AACF;AAEO,SAAS,cAA6B;AAC3C,QAAM,UAAU,kBAAkB;AAElC,MAAI,CAAC,QAAQ,OAAO;AAClB,UAAM,IAAI,oBAAoB;AAAA,EAChC;AAEA,SAAO;AACT;","names":["Command","ExitCode","Command","Command","chalk","Command","config","chalk","Command","chalk","chalk","chalk","Command","config","chalk","Command","Command","Command","axios","axios","config","Command","Command","chalk","Command","chalk","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","chalk","Command","client","chalk","Command","chalk","Command","client","chalk","Command","Command","Command","Command","chalk","Command","chalk","Command","confirm","Command","confirm","Command","Command","Command","Command","Option","Command","Option","Command","chalk","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","Command","input","Command","Option","Command","Option","Command","chalk","Command","Command","chalk","Command","Command","Command","Command","Command","Command","Command","chalk","Command","Command","Command","Command","Command","Command","confirm","Command","confirm","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","Command","config","Command","Command","Command","chalk","Command","config","chalk","config","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","input","Command","input","Command","Command","collectKeyValue","Command","confirm","Command","confirm","Command","Command","Command","Command","Command","input","chalk","Command","input","chalk","Command","confirm","Command","confirm","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","truncate"]}
|
|
1
|
+
{"version":3,"sources":["../src/program.ts","../src/lib/flags.ts","../src/lib/errors.ts","../src/commands/auth/index.ts","../src/commands/auth/login.ts","../src/lib/config.ts","../src/commands/auth/logout.ts","../src/commands/auth/status.ts","../src/lib/output.ts","../src/commands/orgs/index.ts","../src/commands/orgs/list.ts","../src/lib/api.ts","../src/commands/orgs/get.ts","../src/commands/orgs/switch.ts","../src/commands/clients/index.ts","../src/commands/clients/list.ts","../src/commands/clients/get.ts","../src/commands/clients/create.ts","../src/commands/clients/api-keys/index.ts","../src/commands/clients/api-keys/list.ts","../src/commands/clients/api-keys/create.ts","../src/commands/clients/api-keys/revoke.ts","../src/commands/resources/index.ts","../src/commands/resources/list.ts","../src/commands/resources/get.ts","../src/commands/resources/archive.ts","../src/commands/resources/unarchive.ts","../src/commands/resources/promote.ts","../src/commands/execution/index.ts","../src/commands/execution/run.ts","../src/commands/execution/list.ts","../src/commands/execution/get.ts","../src/commands/execution/logs.ts","../src/commands/rag/index.ts","../src/commands/rag/connections/index.ts","../src/commands/rag/connections/list.ts","../src/commands/rag/connections/get.ts","../src/commands/rag/connections/create.ts","../src/commands/rag/connections/update.ts","../src/commands/rag/connections/delete.ts","../src/commands/rag/connections/test.ts","../src/commands/rag/search.ts","../src/commands/features/index.ts","../src/commands/features/catalog.ts","../src/commands/features/list.ts","../src/commands/features/get.ts","../src/commands/features/enable.ts","../src/commands/features/disable.ts","../src/commands/features/config.ts","../src/commands/observability/index.ts","../src/commands/observability/traces/index.ts","../src/commands/observability/traces/search.ts","../src/commands/observability/traces/get.ts","../src/commands/observability/metrics.ts","../src/commands/config/index.ts","../src/commands/config/get.ts","../src/commands/config/set.ts","../src/commands/config/list.ts","../src/commands/llm-gateway/index.ts","../src/commands/llm-gateway/routes/index.ts","../src/commands/llm-gateway/routes/list.ts","../src/commands/llm-gateway/routes/get.ts","../src/commands/llm-gateway/routes/create.ts","../src/commands/llm-gateway/routes/update.ts","../src/commands/llm-gateway/routes/delete.ts","../src/commands/llm-gateway/keys/index.ts","../src/commands/llm-gateway/keys/list.ts","../src/commands/llm-gateway/keys/create.ts","../src/commands/llm-gateway/keys/revoke.ts","../src/commands/llm-gateway/requests.ts","../src/commands/llm-gateway/usage.ts","../src/commands/llm-gateway/catalog.ts","../src/commands/init/index.ts","../src/lib/pagination.ts","../src/lib/truncate.ts","../src/lib/auth.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { addGlobalFlags } from \"./lib/flags.js\";\nimport { handleError } from \"./lib/errors.js\";\nimport { createAuthCommand } from \"./commands/auth/index.js\";\nimport { createOrgsCommand } from \"./commands/orgs/index.js\";\nimport { createClientsCommand } from \"./commands/clients/index.js\";\nimport { createResourcesCommand } from \"./commands/resources/index.js\";\nimport { createExecutionCommand } from \"./commands/execution/index.js\";\nimport { createRagCommand } from \"./commands/rag/index.js\";\nimport { createFeaturesCommand } from \"./commands/features/index.js\";\nimport { createObservabilityCommand } from \"./commands/observability/index.js\";\nimport { createConfigCommand } from \"./commands/config/index.js\";\nimport { createLlmGatewayCommand } from \"./commands/llm-gateway/index.js\";\nimport { createInitCommand } from \"./commands/init/index.js\";\n\nexport function createProgram(): Command {\n const program = new Command();\n\n program\n .name(\"nebulaos\")\n .description(\"NebulaOS CLI - Manage your AI agents, workflows, and resources\")\n .version(\"0.1.0\")\n .configureHelp({\n sortSubcommands: true,\n sortOptions: true,\n });\n\n addGlobalFlags(program);\n\n program.exitOverride();\n\n program.hook(\"preAction\", (_thisCommand, actionCommand) => {\n const opts = actionCommand.optsWithGlobals();\n\n if (opts.noColor) {\n process.env.NO_COLOR = \"1\";\n }\n\n if (opts.verbose) {\n process.env.NEBULAOS_VERBOSE = \"1\";\n }\n });\n\n // Register commands\n program.addCommand(createInitCommand());\n program.addCommand(createAuthCommand());\n program.addCommand(createOrgsCommand());\n program.addCommand(createClientsCommand());\n program.addCommand(createResourcesCommand());\n program.addCommand(createExecutionCommand());\n program.addCommand(createRagCommand());\n program.addCommand(createFeaturesCommand());\n program.addCommand(createObservabilityCommand());\n program.addCommand(createConfigCommand());\n program.addCommand(createLlmGatewayCommand());\n\n process.on(\"uncaughtException\", handleError);\n process.on(\"unhandledRejection\", (reason) => handleError(reason));\n\n return program;\n}\n","import { type Command, Option } from \"commander\";\n\nexport function addGlobalFlags(program: Command): Command {\n program\n .addOption(\n new Option(\"-o, --output <format>\", \"Output format\")\n .choices([\"table\", \"json\", \"yaml\", \"quiet\"])\n .env(\"NEBULAOS_OUTPUT\"),\n )\n .addOption(\n new Option(\"--context <name>\", \"Use a specific context\")\n .env(\"NEBULAOS_CONTEXT\"),\n )\n .addOption(\n new Option(\"--api-url <url>\", \"Override API URL\")\n .env(\"NEBULAOS_API_URL\"),\n )\n .addOption(\n new Option(\"--token <token>\", \"Override authentication token\")\n .env(\"NEBULAOS_TOKEN\"),\n )\n .addOption(\n new Option(\"--org-id <id>\", \"Override organization ID\")\n .env(\"NEBULAOS_ORG_ID\"),\n )\n .addOption(\n new Option(\"--no-color\", \"Disable colored output\"),\n )\n .addOption(\n new Option(\"--verbose\", \"Enable verbose output\"),\n );\n\n return program;\n}\n\nexport function addPaginationFlags(command: Command): Command {\n command\n .addOption(\n new Option(\"--page <number>\", \"Page number\").argParser(parseInt),\n )\n .addOption(\n new Option(\"--page-size <number>\", \"Items per page\").argParser(parseInt),\n );\n\n return command;\n}\n","export enum ExitCode {\n Success = 0,\n GeneralError = 1,\n InvalidArgument = 2,\n AuthenticationError = 3,\n AuthorizationError = 4,\n NotFound = 5,\n ConflictError = 6,\n ValidationError = 7,\n NetworkError = 8,\n TimeoutError = 9,\n ServerError = 10,\n ConfigError = 11,\n}\n\nexport class CLIError extends Error {\n constructor(\n message: string,\n public readonly exitCode: ExitCode = ExitCode.GeneralError,\n public readonly hint?: string,\n ) {\n super(message);\n this.name = \"CLIError\";\n }\n}\n\nexport class AuthenticationError extends CLIError {\n constructor(message = \"Authentication required. Run `nebulaos auth login` first.\") {\n super(message, ExitCode.AuthenticationError);\n }\n}\n\nexport class AuthorizationError extends CLIError {\n constructor(message = \"Insufficient permissions for this operation.\") {\n super(message, ExitCode.AuthorizationError);\n }\n}\n\nexport class NotFoundError extends CLIError {\n constructor(resource: string, identifier: string) {\n super(`${resource} '${identifier}' not found.`, ExitCode.NotFound);\n }\n}\n\nexport class ValidationError extends CLIError {\n constructor(message: string) {\n super(message, ExitCode.ValidationError);\n }\n}\n\nexport class NetworkError extends CLIError {\n constructor(message = \"Unable to connect to NebulaOS API. Check your network and API URL.\") {\n super(message, ExitCode.NetworkError);\n }\n}\n\nexport class ConfigError extends CLIError {\n constructor(message: string) {\n super(message, ExitCode.ConfigError);\n }\n}\n\nexport function handleError(error: unknown): never {\n if (error instanceof CLIError) {\n console.error(`Error: ${error.message}`);\n if (error.hint) {\n console.error(`Hint: ${error.hint}`);\n }\n process.exit(error.exitCode);\n }\n\n if (error instanceof Error) {\n console.error(`Error: ${error.message}`);\n process.exit(ExitCode.GeneralError);\n }\n\n console.error(\"An unexpected error occurred.\");\n process.exit(ExitCode.GeneralError);\n}\n","import { Command } from \"commander\";\nimport { createLoginCommand } from \"./login.js\";\nimport { createLogoutCommand } from \"./logout.js\";\nimport { createStatusCommand } from \"./status.js\";\n\nexport function createAuthCommand(): Command {\n const auth = new Command(\"auth\")\n .description(\"Authenticate with NebulaOS and manage credentials\");\n\n auth.addCommand(createLoginCommand());\n auth.addCommand(createLogoutCommand());\n auth.addCommand(createStatusCommand());\n\n return auth;\n}\n","import { Command } from \"commander\";\nimport axios from \"axios\";\nimport chalk from \"chalk\";\nimport { password, input } from \"@inquirer/prompts\";\nimport { setContext, useContext } from \"../../lib/config.js\";\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\n\ninterface VerifyResponse {\n valid: boolean;\n admin?: {\n id: string;\n email: string;\n fullName: string;\n role: string;\n };\n organization?: {\n id: string;\n name: string;\n slug: string;\n };\n workspaceId?: string;\n scopes?: string[] | null;\n error?: string;\n}\n\nasync function verifyToken(apiUrl: string, token: string): Promise<VerifyResponse> {\n try {\n const response = await axios.post<VerifyResponse>(\n `${apiUrl}/auth/personal-tokens/verify`,\n { token },\n { timeout: 10_000 },\n );\n return response.data;\n } catch (error) {\n if (axios.isAxiosError(error)) {\n if (!error.response) {\n throw new CLIError(\n `Unable to connect to ${apiUrl}. Check the URL and your network.`,\n ExitCode.NetworkError,\n );\n }\n throw new CLIError(\n `API returned ${error.response.status}: ${error.response.data?.message || \"Unknown error\"}`,\n ExitCode.ServerError,\n );\n }\n throw error;\n }\n}\n\nexport function createLoginCommand(): Command {\n const cmd = new Command(\"login\")\n .description(\"Authenticate with NebulaOS using a Personal Access Token\")\n .option(\"-t, --token <token>\", \"Personal Access Token (PAT)\")\n .option(\"-u, --api-url <url>\", \"API URL (default: http://localhost:4100)\")\n .option(\"-n, --context-name <name>\", \"Name for this context\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos auth login Interactive login (prompts for token)\n $ nebulaos auth login -t neb_pat_abc123 Login with a token directly\n $ nebulaos auth login -u https://api.starya.com Login to a custom API URL\n $ nebulaos auth login -t neb_pat_abc123 -n production Login and name the context \"production\"\n\nNote: Personal Access Tokens are tied to a specific workspace.\n Create tokens in the NebulaOS dashboard for the workspace you want to access.\n`)\n .action(async (options) => {\n try {\n console.log(chalk.bold(\"NebulaOS Login\\n\"));\n\n // Prompt for API URL if not provided via flag\n let apiUrl = options.apiUrl || options.parent?.opts()?.apiUrl;\n if (!apiUrl) {\n apiUrl = await input({\n message: \"NebulaOS API URL:\",\n default: \"http://localhost:4100\",\n validate: (value) => {\n if (!value) return \"API URL is required\";\n try {\n new URL(value);\n return true;\n } catch {\n return \"Invalid URL format. Example: https://api.starya.com\";\n }\n },\n });\n }\n\n // Prompt for token if not provided via flag\n let token = options.token;\n if (!token) {\n console.log(\"\\nGenerate a Personal Access Token at your NebulaOS dashboard.\\n\");\n\n token = await password({\n message: \"Personal Access Token (PAT):\",\n mask: \"*\",\n validate: (value) => {\n if (!value) return \"Token is required\";\n if (!value.startsWith(\"neb_pat_\")) return \"Invalid token format. Tokens start with 'neb_pat_'\";\n return true;\n },\n });\n }\n\n if (!token.startsWith(\"neb_pat_\")) {\n throw new CLIError(\n \"Invalid token format. Personal Access Tokens start with 'neb_pat_'.\",\n ExitCode.ValidationError,\n );\n }\n\n console.log(\"\\nVerifying token...\");\n\n const result = await verifyToken(apiUrl, token);\n\n if (!result.valid) {\n throw new CLIError(\n `Token verification failed: ${result.error || \"Unknown error\"}`,\n ExitCode.AuthenticationError,\n );\n }\n\n const contextName =\n options.contextName ||\n result.organization?.slug ||\n \"default\";\n\n setContext(contextName, {\n name: contextName,\n apiUrl,\n token,\n organizationId: result.organization?.id,\n });\n useContext(contextName);\n\n console.log(chalk.green(\"\\nAuthenticated successfully!\"));\n console.log(` Admin: ${result.admin?.fullName} (${result.admin?.email})`);\n console.log(` Organization: ${result.organization?.name} (${result.organization?.slug})`);\n if (result.workspaceId) {\n console.log(` Workspace: ${result.workspaceId}`);\n }\n console.log(` Context: ${contextName}`);\n\n if (result.scopes && result.scopes.length > 0) {\n console.log(` Scopes: ${result.scopes.join(\", \")}`);\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import Conf from \"conf\";\nimport { ConfigError } from \"./errors.js\";\n\nexport interface ContextConfig {\n name: string;\n apiUrl: string;\n token: string;\n organizationId?: string;\n}\n\nexport interface CLIConfig {\n contexts: Record<string, ContextConfig>;\n currentContext: string | null;\n defaults: {\n output: \"table\" | \"json\" | \"yaml\" | \"quiet\";\n pageSize: number;\n };\n}\n\nconst schema = {\n contexts: {\n type: \"object\" as const,\n default: {},\n },\n currentContext: {\n type: [\"string\", \"null\"] as const,\n default: null,\n },\n defaults: {\n type: \"object\" as const,\n default: {\n output: \"table\",\n pageSize: 20,\n },\n properties: {\n output: {\n type: \"string\" as const,\n enum: [\"table\", \"json\", \"yaml\", \"quiet\"],\n default: \"table\",\n },\n pageSize: {\n type: \"number\" as const,\n default: 20,\n minimum: 1,\n maximum: 100,\n },\n },\n },\n};\n\nconst config = new Conf<CLIConfig>({\n projectName: \"nebulaos\",\n schema,\n});\n\nexport function getConfig(): CLIConfig {\n return {\n contexts: config.get(\"contexts\"),\n currentContext: config.get(\"currentContext\"),\n defaults: config.get(\"defaults\"),\n };\n}\n\nexport function getCurrentContext(): ContextConfig {\n const currentName = config.get(\"currentContext\");\n if (!currentName) {\n throw new ConfigError(\n \"No active context. Run `nebulaos auth login` or `nebulaos config use-context <name>` first.\",\n );\n }\n\n const contexts = config.get(\"contexts\");\n const ctx = contexts[currentName];\n if (!ctx) {\n throw new ConfigError(\n `Context '${currentName}' not found. Run \\`nebulaos config get-contexts\\` to see available contexts.`,\n );\n }\n\n return ctx;\n}\n\nexport function setContext(name: string, context: ContextConfig): void {\n const contexts = config.get(\"contexts\");\n contexts[name] = context;\n config.set(\"contexts\", contexts);\n}\n\nexport function removeContext(name: string): void {\n const contexts = config.get(\"contexts\");\n if (!contexts[name]) {\n throw new ConfigError(`Context '${name}' not found.`);\n }\n\n delete contexts[name];\n config.set(\"contexts\", contexts);\n\n if (config.get(\"currentContext\") === name) {\n config.set(\"currentContext\", null);\n }\n}\n\nexport function useContext(name: string): void {\n const contexts = config.get(\"contexts\");\n if (!contexts[name]) {\n throw new ConfigError(\n `Context '${name}' not found. Run \\`nebulaos config get-contexts\\` to see available contexts.`,\n );\n }\n\n config.set(\"currentContext\", name);\n}\n\nexport function listContexts(): Array<ContextConfig & { active: boolean }> {\n const contexts = config.get(\"contexts\");\n const currentName = config.get(\"currentContext\");\n\n return Object.entries(contexts).map(([name, ctx]) => ({\n ...ctx,\n name,\n active: name === currentName,\n }));\n}\n\nexport function setDefault<K extends keyof CLIConfig[\"defaults\"]>(\n key: K,\n value: CLIConfig[\"defaults\"][K],\n): void {\n const defaults = config.get(\"defaults\");\n defaults[key] = value;\n config.set(\"defaults\", defaults);\n}\n\nexport function getConfigPath(): string {\n return config.path;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { confirm } from \"@inquirer/prompts\";\nimport { getConfig, removeContext } from \"../../lib/config.js\";\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\n\nexport function createLogoutCommand(): Command {\n const cmd = new Command(\"logout\")\n .description(\"Remove authentication credentials for the current or specified context\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--context <name>\", \"Context to log out from (default: current)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos auth logout Log out from the current context\n $ nebulaos auth logout -y Log out without confirmation\n $ nebulaos auth logout --context staging Log out from a specific context\n`)\n .action(async (options) => {\n try {\n const config = getConfig();\n const contextName = options.context || config.currentContext;\n\n if (!contextName) {\n throw new CLIError(\"No active context. Nothing to log out from.\", ExitCode.ConfigError);\n }\n\n if (!config.contexts[contextName]) {\n throw new CLIError(`Context '${contextName}' not found.`, ExitCode.NotFound);\n }\n\n if (!options.yes) {\n const shouldProceed = await confirm({\n message: `Remove credentials for context '${contextName}'?`,\n default: false,\n });\n\n if (!shouldProceed) {\n console.log(\"Cancelled.\");\n return;\n }\n }\n\n removeContext(contextName);\n console.log(chalk.green(`Logged out from context '${contextName}'.`));\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getConfig, getCurrentContext } from \"../../lib/config.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { ConfigError, handleError } from \"../../lib/errors.js\";\n\nexport function createStatusCommand(): Command {\n const cmd = new Command(\"status\")\n .description(\"Show current authentication status and context information\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos auth status Show current auth status\n $ nebulaos auth status -o json Show auth status as JSON\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const config = getConfig();\n\n if (!config.currentContext) {\n if (format === \"json\") {\n console.log(JSON.stringify({ authenticated: false }));\n } else if (format === \"yaml\") {\n console.log(\"authenticated: false\");\n } else {\n console.log(chalk.yellow(\"Not authenticated. Run `nebulaos auth login` to get started.\"));\n }\n return;\n }\n\n let context;\n try {\n context = getCurrentContext();\n } catch (e) {\n if (e instanceof ConfigError) {\n console.log(chalk.yellow(e.message));\n return;\n }\n throw e;\n }\n\n const statusData = {\n authenticated: true,\n context: config.currentContext,\n apiUrl: context.apiUrl,\n organizationId: context.organizationId || null,\n hasToken: !!context.token,\n };\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Authentication Status\\n\"));\n printDetail(\"Context\", config.currentContext);\n printDetail(\"API URL\", context.apiUrl);\n printDetail(\"Authenticated\", context.token ? chalk.green(\"Yes\") : chalk.red(\"No\"));\n if (context.organizationId) {\n printDetail(\"Organization ID\", context.organizationId);\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: statusData,\n ids: [config.currentContext],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import Table from \"cli-table3\";\nimport chalk from \"chalk\";\nimport { stringify as yamlStringify } from \"yaml\";\nimport { getConfig } from \"./config.js\";\n\nexport type OutputFormat = \"table\" | \"json\" | \"yaml\" | \"quiet\";\n\nexport function resolveFormat(flagValue?: string): OutputFormat {\n if (flagValue) return flagValue as OutputFormat;\n return getConfig().defaults.output;\n}\n\nexport interface TableOptions {\n headers: string[];\n rows: string[][];\n}\n\nexport function printTable({ headers, rows }: TableOptions): void {\n const table = new Table({\n head: headers.map((h) => chalk.bold(h)),\n style: { head: [], border: [] },\n });\n\n for (const row of rows) {\n table.push(row);\n }\n\n console.log(table.toString());\n}\n\nexport function printJson(data: unknown): void {\n console.log(JSON.stringify(data, null, 2));\n}\n\nexport function printYaml(data: unknown): void {\n console.log(yamlStringify(data));\n}\n\nexport function printQuiet(ids: string[]): void {\n for (const id of ids) {\n console.log(id);\n }\n}\n\nexport interface OutputData {\n table: TableOptions;\n data: unknown;\n ids: string[];\n}\n\nexport function output(format: OutputFormat, outputData: OutputData): void {\n switch (format) {\n case \"table\":\n printTable(outputData.table);\n break;\n case \"json\":\n printJson(outputData.data);\n break;\n case \"yaml\":\n printYaml(outputData.data);\n break;\n case \"quiet\":\n printQuiet(outputData.ids);\n break;\n }\n}\n\nexport function printSuccess(message: string): void {\n console.log(chalk.green(message));\n}\n\nexport function printWarning(message: string): void {\n console.error(chalk.yellow(`Warning: ${message}`));\n}\n\nexport function printDetail(label: string, value: string): void {\n console.log(`${chalk.bold(label)}: ${value}`);\n}\n","import { Command } from \"commander\";\nimport { createOrgsListCommand } from \"./list.js\";\nimport { createOrgsGetCommand } from \"./get.js\";\nimport { createOrgsSwitchCommand } from \"./switch.js\";\n\nexport function createOrgsCommand(): Command {\n const orgs = new Command(\"orgs\")\n .description(\"List, inspect, and switch between organizations\");\n\n orgs.addCommand(createOrgsListCommand());\n orgs.addCommand(createOrgsGetCommand());\n orgs.addCommand(createOrgsSwitchCommand());\n\n return orgs;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\nimport { addPaginationFlags } from \"../../lib/flags.js\";\n\ninterface Organization {\n id: string;\n name: string;\n slug: string;\n isActive: boolean;\n createdAt: string;\n}\n\nexport function createOrgsListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List organizations accessible to the current admin\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos orgs list List all accessible organizations\n $ nebulaos orgs list -o json Output as JSON\n $ nebulaos orgs list --page 2 Show page 2 of results\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const params: Record<string, unknown> = {};\n if (globalOpts.page) params.page = globalOpts.page;\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\n\n const { data } = await api.get<Organization[]>(\"/organizations\", { params });\n\n const orgs = Array.isArray(data) ? data : [];\n\n output(format, {\n table: {\n headers: [\"ID\", \"Name\", \"Slug\", \"Active\", \"Created At\"],\n rows: orgs.map((o) => [\n o.id,\n o.name,\n o.slug,\n o.isActive ? \"Yes\" : \"No\",\n new Date(o.createdAt).toLocaleDateString(),\n ]),\n },\n data: orgs,\n ids: orgs.map((o) => o.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n addPaginationFlags(cmd);\n\n return cmd;\n}\n","import axios, { AxiosError, type AxiosInstance } from \"axios\";\nimport { getCurrentContext } from \"./config.js\";\nimport {\n AuthenticationError,\n AuthorizationError,\n CLIError,\n ExitCode,\n NetworkError,\n NotFoundError,\n} from \"./errors.js\";\n\nlet client: AxiosInstance | null = null;\n\nexport function getApiClient(): AxiosInstance {\n if (client) return client;\n\n const context = getCurrentContext();\n\n client = axios.create({\n baseURL: context.apiUrl,\n timeout: 30_000,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n });\n\n client.interceptors.request.use((config) => {\n const ctx = getCurrentContext();\n\n if (ctx.token) {\n config.headers.Authorization = `Bearer ${ctx.token}`;\n }\n\n if (ctx.organizationId) {\n config.headers[\"X-Organization-Id\"] = ctx.organizationId;\n }\n\n return config;\n });\n\n client.interceptors.response.use(\n (response) => response,\n (error: AxiosError<{ message?: string; statusCode?: number }>) => {\n if (!error.response) {\n if (error.code === \"ECONNREFUSED\" || error.code === \"ENOTFOUND\") {\n throw new NetworkError();\n }\n if (error.code === \"ECONNABORTED\" || error.code === \"ETIMEDOUT\") {\n throw new CLIError(\n \"Request timed out. The server may be unavailable.\",\n ExitCode.TimeoutError,\n );\n }\n throw new NetworkError(error.message);\n }\n\n const { status, data } = error.response;\n const message = data?.message || error.message;\n\n switch (status) {\n case 401:\n throw new AuthenticationError();\n case 403:\n throw new AuthorizationError();\n case 404:\n throw new NotFoundError(\"Resource\", message);\n case 409:\n throw new CLIError(message, ExitCode.ConflictError);\n case 422:\n throw new CLIError(message, ExitCode.ValidationError);\n default:\n if (status >= 500) {\n throw new CLIError(\n `Server error (${status}): ${message}`,\n ExitCode.ServerError,\n );\n }\n throw new CLIError(message, ExitCode.GeneralError);\n }\n },\n );\n\n return client;\n}\n\nexport function resetApiClient(): void {\n client = null;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface Organization {\n id: string;\n name: string;\n slug: string;\n isActive: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\nexport function createOrgsGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get details of an organization by ID or slug\")\n .argument(\"<id>\", \"Organization ID or slug\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos orgs get my-org Get organization by slug\n $ nebulaos orgs get 550e8400-e29b-41d4... Get organization by ID\n $ nebulaos orgs get my-org -o json Output as JSON\n`)\n .action(async (id, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const { data: org } = await api.get<Organization>(`/organizations/${id}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Organization Details\\n\"));\n printDetail(\"ID\", org.id);\n printDetail(\"Name\", org.name);\n printDetail(\"Slug\", org.slug);\n printDetail(\"Active\", org.isActive ? chalk.green(\"Yes\") : chalk.red(\"No\"));\n printDetail(\"Created\", new Date(org.createdAt).toLocaleString());\n printDetail(\"Updated\", new Date(org.updatedAt).toLocaleString());\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: org,\n ids: [org.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { getCurrentContext, setContext, useContext } from \"../../lib/config.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface Organization {\n id: string;\n name: string;\n slug: string;\n}\n\nexport function createOrgsSwitchCommand(): Command {\n const cmd = new Command(\"switch\")\n .description(\"Switch the active organization context to a different organization\")\n .argument(\"<slug>\", \"Organization slug to switch to\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos orgs switch my-org Switch to the \"my-org\" organization\n $ nebulaos orgs switch production Switch to the \"production\" organization\n`)\n .action(async (slug) => {\n try {\n const api = getApiClient();\n const currentContext = getCurrentContext();\n\n // Verify the organization exists and is accessible\n const { data: org } = await api.get<Organization>(`/organizations/${slug}`);\n\n const contextName = org.slug;\n\n setContext(contextName, {\n name: contextName,\n apiUrl: currentContext.apiUrl,\n token: currentContext.token,\n organizationId: org.id,\n });\n useContext(contextName);\n\n console.log(chalk.green(`Switched to organization '${org.name}' (${org.slug}).`));\n console.log(` Context: ${contextName}`);\n console.log(` Organization ID: ${org.id}`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createClientsListCommand } from \"./list.js\";\nimport { createClientsGetCommand } from \"./get.js\";\nimport { createClientsCreateCommand } from \"./create.js\";\nimport { createApiKeysCommand } from \"./api-keys/index.js\";\n\nexport function createClientsCommand(): Command {\n const clients = new Command(\"clients\")\n .description(\"Register and manage clients and their API keys\");\n\n clients.addCommand(createClientsListCommand());\n clients.addCommand(createClientsGetCommand());\n clients.addCommand(createClientsCreateCommand());\n clients.addCommand(createApiKeysCommand());\n\n return clients;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\nimport { addPaginationFlags } from \"../../lib/flags.js\";\n\ninterface Client {\n id: string;\n clientId: string;\n isOnline: boolean;\n lastSeenAt: string | null;\n registeredAt: string;\n}\n\nexport function createClientsListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List registered clients in the current organization\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos clients list List all clients\n $ nebulaos clients list -o json Output as JSON\n $ nebulaos clients list --page-size 5 Show 5 clients per page\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const params: Record<string, unknown> = {};\n if (globalOpts.page) params.page = globalOpts.page;\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\n\n const { data } = await api.get<Client[]>(\"/clients\", { params });\n\n const clients = Array.isArray(data) ? data : [];\n\n output(format, {\n table: {\n headers: [\"ID\", \"Client ID\", \"Status\", \"Last Seen\", \"Registered At\"],\n rows: clients.map((c) => [\n c.id,\n c.clientId,\n c.isOnline ? \"Online\" : \"Offline\",\n c.lastSeenAt ? new Date(c.lastSeenAt).toLocaleString() : \"-\",\n c.registeredAt ? new Date(c.registeredAt).toLocaleDateString() : \"-\",\n ]),\n },\n data: clients,\n ids: clients.map((c) => c.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n addPaginationFlags(cmd);\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface Client {\n id: string;\n clientId: string;\n isOnline: boolean;\n lastSeenAt: string | null;\n registeredAt: string;\n updatedAt: string;\n agents?: Array<{ name: string; kind: string }>;\n workflows?: Array<{ id: string; name: string }>;\n}\n\nexport function createClientsGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get details of a client, including its registered agents and workflows\")\n .argument(\"<id>\", \"Client ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos clients get 550e8400-e29b-41d4... Get client details by ID\n $ nebulaos clients get my-client -o json Output as JSON\n`)\n .action(async (id, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const { data: client } = await api.get<Client>(`/clients/${id}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Client Details\\n\"));\n printDetail(\"ID\", client.id);\n printDetail(\"Client ID\", client.clientId);\n printDetail(\"Status\", client.isOnline ? \"Online\" : \"Offline\");\n printDetail(\"Last Seen\", client.lastSeenAt ? new Date(client.lastSeenAt).toLocaleString() : \"-\");\n printDetail(\"Registered\", client.registeredAt ? new Date(client.registeredAt).toLocaleString() : \"-\");\n printDetail(\"Updated\", client.updatedAt ? new Date(client.updatedAt).toLocaleString() : \"-\");\n\n if (client.agents && client.agents.length > 0) {\n console.log(chalk.bold(\"\\nAgents:\"));\n for (const agent of client.agents) {\n console.log(` - ${agent.name} (${agent.kind})`);\n }\n }\n\n if (client.workflows && client.workflows.length > 0) {\n console.log(chalk.bold(\"\\nWorkflows:\"));\n for (const wf of client.workflows) {\n console.log(` - ${wf.name} (${wf.id})`);\n }\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: client,\n ids: [client.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface Client {\n id: string;\n clientId: string;\n isOnline: boolean;\n registeredAt: string;\n}\n\nexport function createClientsCreateCommand(): Command {\n const cmd = new Command(\"create\")\n .description(\"Register a new client in the current organization\")\n .requiredOption(\"--client-id <clientId>\", \"Unique client identifier\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos clients create --client-id my-agent-server Create a new client\n $ nebulaos clients create --client-id worker-1 -o json Create and output as JSON\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const { data: client } = await api.post<Client>(\"/clients\", {\n clientId: options.clientId,\n });\n\n if (format === \"table\") {\n console.log(chalk.green(\"Client created successfully.\\n\"));\n printDetail(\"ID\", client.id);\n printDetail(\"Client ID\", client.clientId);\n printDetail(\"Status\", client.isOnline ? \"Online\" : \"Offline\");\n printDetail(\"Registered\", client.registeredAt ? new Date(client.registeredAt).toLocaleString() : \"-\");\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: client,\n ids: [client.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createApiKeysListCommand } from \"./list.js\";\nimport { createApiKeysCreateCommand } from \"./create.js\";\nimport { createApiKeysRevokeCommand } from \"./revoke.js\";\n\nexport function createApiKeysCommand(): Command {\n const apiKeys = new Command(\"api-keys\")\n .description(\"Create, list, and revoke API keys for clients\");\n\n apiKeys.addCommand(createApiKeysListCommand());\n apiKeys.addCommand(createApiKeysCreateCommand());\n apiKeys.addCommand(createApiKeysRevokeCommand());\n\n return apiKeys;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\ninterface ApiKey {\n id: string;\n key: string;\n isActive: boolean;\n expiresAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n}\n\nexport function createApiKeysListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List all API keys for a specific client\")\n .argument(\"<clientId>\", \"Client ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos clients api-keys list 550e8400-e29b... List keys for a client\n $ nebulaos clients api-keys list my-client -o json Output as JSON\n`)\n .action(async (clientId, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const { data } = await api.get<ApiKey[]>(`/clients/${clientId}/api-keys`);\n\n const keys = Array.isArray(data) ? data : [];\n\n output(format, {\n table: {\n headers: [\"ID\", \"Key\", \"Active\", \"Expires At\", \"Last Used\", \"Created At\"],\n rows: keys.map((k) => [\n k.id,\n k.key,\n k.isActive ? \"Yes\" : \"No\",\n k.expiresAt ? new Date(k.expiresAt).toLocaleString() : \"-\",\n k.lastUsedAt ? new Date(k.lastUsedAt).toLocaleString() : \"-\",\n new Date(k.createdAt).toLocaleDateString(),\n ]),\n },\n data: keys,\n ids: keys.map((k) => k.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\ninterface ApiKey {\n id: string;\n key: string;\n isActive: boolean;\n expiresAt: string | null;\n createdAt: string;\n}\n\nexport function createApiKeysCreateCommand(): Command {\n const cmd = new Command(\"create\")\n .description(\"Generate a new API key for a client (shown only once)\")\n .argument(\"<clientId>\", \"Client ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos clients api-keys create 550e8400-e29b... Create a new API key\n $ nebulaos clients api-keys create my-client -o json Output as JSON\n\nNote: The API key is displayed only once after creation. Save it securely.\n`)\n .action(async (clientId, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const api = getApiClient();\n const { data: apiKey } = await api.post<ApiKey>(`/clients/${clientId}/api-keys`);\n\n if (format === \"table\") {\n console.log(chalk.green(\"API key created successfully.\\n\"));\n printDetail(\"ID\", apiKey.id);\n printDetail(\"Key\", apiKey.key);\n printDetail(\"Active\", apiKey.isActive ? \"Yes\" : \"No\");\n printDetail(\"Expires At\", apiKey.expiresAt ? new Date(apiKey.expiresAt).toLocaleString() : \"-\");\n printDetail(\"Created\", new Date(apiKey.createdAt).toLocaleString());\n console.log(chalk.yellow(\"\\nSave this key now. It will not be shown again.\"));\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: apiKey,\n ids: [apiKey.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { confirm } from \"@inquirer/prompts\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { handleError } from \"../../../lib/errors.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\n\nexport function createApiKeysRevokeCommand(): Command {\n const cmd = new Command(\"revoke\")\n .description(\"Permanently revoke an API key for a client\")\n .argument(\"<clientId>\", \"Client ID\")\n .argument(\"<keyId>\", \"API Key ID to revoke\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos clients api-keys revoke my-client key-123 Revoke with confirmation\n $ nebulaos clients api-keys revoke my-client key-123 -y Revoke without confirmation\n`)\n .action(async (clientId, keyId, options) => {\n try {\n if (!options.yes) {\n const shouldProceed = await confirm({\n message: `Revoke API key '${keyId}' for client '${clientId}'?`,\n default: false,\n });\n\n if (!shouldProceed) {\n console.log(\"Cancelled.\");\n return;\n }\n }\n\n const api = getApiClient();\n await api.delete(`/clients/${clientId}/api-keys/${keyId}`);\n\n printSuccess(`API key '${keyId}' revoked successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createResourcesListCommand } from \"./list.js\";\nimport { createResourcesGetCommand } from \"./get.js\";\nimport { createResourcesArchiveCommand } from \"./archive.js\";\nimport { createResourcesUnarchiveCommand } from \"./unarchive.js\";\nimport { createResourcesPromoteCommand } from \"./promote.js\";\n\nexport function createResourcesCommand(): Command {\n const resources = new Command(\"resources\")\n .description(\"List, inspect, archive, and promote resources (agents, workflows, tools)\");\n\n resources.addCommand(createResourcesListCommand());\n resources.addCommand(createResourcesGetCommand());\n resources.addCommand(createResourcesArchiveCommand());\n resources.addCommand(createResourcesUnarchiveCommand());\n resources.addCommand(createResourcesPromoteCommand());\n\n return resources;\n}\n","import { Command, Option } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { addPaginationFlags } from \"../../lib/flags.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createResourcesListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List registered resources (agents, workflows, tools) with optional filters\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos resources list List all resources\n $ nebulaos resources list --type agent List only agents\n $ nebulaos resources list --status official List official resources\n $ nebulaos resources list --type workflow -o json List workflows as JSON\n`)\n .addOption(\n new Option(\"--type <type>\", \"Filter by resource type\")\n .choices([\"agent\", \"workflow\", \"tool\"]),\n )\n .addOption(\n new Option(\"--status <status>\", \"Filter by resource status\")\n .choices([\"discovered\", \"official\"]),\n )\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, string> = {};\n if (options.type) params.type = options.type;\n if (options.status) params.status = options.status;\n if (globalOpts.page) params.page = String(globalOpts.page);\n if (globalOpts.pageSize) params.pageSize = String(globalOpts.pageSize);\n\n const { data } = await api.get(\"/resources\", { params });\n\n const resources = Array.isArray(data) ? data : data.data ?? [];\n\n output(format, {\n table: {\n headers: [\"ID\", \"Name\", \"Type\", \"Status\", \"Online\", \"Created At\"],\n rows: resources.map((r: any) => [\n r.id,\n r.displayName || r.name || \"-\",\n r.type,\n r.lifecycleStatus || r.status || \"-\",\n r.isOnline ? \"Yes\" : \"No\",\n r.firstSeenAt || r.createdAt ? new Date(r.firstSeenAt || r.createdAt).toLocaleString() : \"-\",\n ]),\n },\n data: resources,\n ids: resources.map((r: any) => r.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n addPaginationFlags(cmd);\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\nimport chalk from \"chalk\";\n\nexport function createResourcesGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get detailed information about a specific resource\")\n .argument(\"<id>\", \"Resource ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos resources get 550e8400-e29b-41d4... View resource details\n $ nebulaos resources get my-resource -o json Output as JSON\n`)\n .action(async (id, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data: resource } = await api.get(`/resources/${id}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Resource Details\\n\"));\n printDetail(\"ID\", resource.id);\n printDetail(\"Name\", resource.displayName || resource.name || \"-\");\n printDetail(\"Type\", resource.type);\n printDetail(\"Status\", resource.lifecycleStatus || resource.status || \"-\");\n if (resource.kind) printDetail(\"Kind\", resource.kind);\n if (resource.description) printDetail(\"Description\", resource.description);\n if (resource.clientId) printDetail(\"Client ID\", resource.clientId);\n if (resource.runtimeResourceId) printDetail(\"Runtime ID\", resource.runtimeResourceId);\n printDetail(\"Online\", resource.isOnline ? \"Yes\" : \"No\");\n printDetail(\"Created At\", resource.createdAt ? new Date(resource.createdAt).toLocaleString() : \"-\");\n printDetail(\"Updated At\", resource.updatedAt ? new Date(resource.updatedAt).toLocaleString() : \"-\");\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: resource,\n ids: [resource.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { printSuccess } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createResourcesArchiveCommand(): Command {\n const cmd = new Command(\"archive\")\n .description(\"Archive a resource to hide it from active listings\")\n .argument(\"<id>\", \"Resource ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos resources archive 550e8400-e29b... Archive a resource by ID\n\nArchived resources can be restored with the 'unarchive' command.\n`)\n .action(async (id) => {\n try {\n const api = getApiClient();\n await api.patch(`/resources/${id}/archive`);\n printSuccess(`Resource '${id}' archived successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { printSuccess } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createResourcesUnarchiveCommand(): Command {\n const cmd = new Command(\"unarchive\")\n .description(\"Restore an archived resource back to active status\")\n .argument(\"<id>\", \"Resource ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos resources unarchive 550e8400-e29b... Restore an archived resource\n`)\n .action(async (id) => {\n try {\n const api = getApiClient();\n await api.patch(`/resources/${id}/unarchive`);\n printSuccess(`Resource '${id}' unarchived successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { printSuccess } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createResourcesPromoteCommand(): Command {\n const cmd = new Command(\"promote\")\n .description(\"Promote a discovered resource to official status\")\n .argument(\"<id>\", \"Resource ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos resources promote 550e8400-e29b... Promote a resource to official\n\nDiscovered resources are auto-registered by clients. Promoting makes them official.\n`)\n .action(async (id) => {\n try {\n const api = getApiClient();\n await api.patch(`/resources/${id}/promote`);\n printSuccess(`Resource '${id}' promoted to official.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createExecutionRunCommand } from \"./run.js\";\nimport { createExecutionListCommand } from \"./list.js\";\nimport { createExecutionGetCommand } from \"./get.js\";\nimport { createExecutionLogsCommand } from \"./logs.js\";\n\nexport function createExecutionCommand(): Command {\n const execution = new Command(\"execution\")\n .alias(\"exec\")\n .description(\"Run agents/workflows and inspect execution results and logs\");\n\n execution.addCommand(createExecutionRunCommand());\n execution.addCommand(createExecutionListCommand());\n execution.addCommand(createExecutionGetCommand());\n execution.addCommand(createExecutionLogsCommand());\n\n return execution;\n}\n","import { Command } from \"commander\";\nimport ora from \"ora\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\nimport chalk from \"chalk\";\n\nexport function createExecutionRunCommand(): Command {\n const cmd = new Command(\"run\")\n .description(\"Trigger execution of an agent or workflow by resource ID\")\n .argument(\"<resourceId>\", \"Resource ID to execute\")\n .option(\"-i, --input <json>\", \"Input data as JSON string\")\n .option(\"-m, --memory-key <key>\", \"Memory partition key for conversation context\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos exec run 550e8400-e29b... Run a resource\n $ nebulaos exec run my-agent -i '{\"prompt\":\"Hello\"}' Run with JSON input\n $ nebulaos exec run my-workflow -i '{\"data\":[1,2,3]}' -o json Run and output as JSON\n $ nebulaos exec run my-agent -i '\"Oi\"' -m user-123 Run with memory context\n`)\n .action(async (resourceId, options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n let input: unknown;\n if (options.input) {\n try {\n input = JSON.parse(options.input);\n } catch {\n throw new CLIError(\n \"Invalid JSON input. Provide valid JSON with --input.\",\n ExitCode.ValidationError,\n );\n }\n }\n\n const spinner = ora(\"Starting execution...\").start();\n\n const executionOptions = options.memoryKey\n ? { memoryKey: options.memoryKey }\n : undefined;\n\n const { data: execution } = await api.post(\"/execution\", {\n resourceId,\n input,\n options: executionOptions,\n });\n\n spinner.succeed(\"Execution started.\");\n\n if (format === \"table\") {\n console.log(chalk.bold(\"\\nExecution Details\\n\"));\n printDetail(\"Execution ID\", execution.id);\n printDetail(\"Resource ID\", execution.resourceId || resourceId);\n printDetail(\"Status\", execution.status);\n if (execution.result !== undefined) {\n printDetail(\"Result\", JSON.stringify(execution.result));\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: execution,\n ids: [execution.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command, Option } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { addPaginationFlags } from \"../../lib/flags.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createExecutionListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List past and ongoing executions with optional status filter\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos exec list List recent executions\n $ nebulaos exec list --status running Show only running executions\n $ nebulaos exec list --limit 5 Show last 5 executions\n $ nebulaos exec list -o json Output as JSON\n`)\n .addOption(\n new Option(\"--status <status>\", \"Filter by execution status\"),\n )\n .addOption(\n new Option(\"--limit <number>\", \"Limit number of results\")\n .argParser(parseInt),\n )\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, string> = {};\n if (options.status) params.status = options.status;\n if (options.limit) params.limit = String(options.limit);\n if (globalOpts.page) params.page = String(globalOpts.page);\n if (globalOpts.pageSize) params.pageSize = String(globalOpts.pageSize);\n\n const { data } = await api.get(\"/execution\", { params });\n\n const executions = Array.isArray(data) ? data : data.items ?? data.data ?? [];\n\n output(format, {\n table: {\n headers: [\"ID\", \"Resource\", \"Status\", \"Started At\", \"Duration\"],\n rows: executions.map((e: any) => [\n e.id,\n e.targetName,\n e.status,\n e.startedAt ? new Date(e.startedAt).toLocaleString() : \"-\",\n e.completedAt && e.startedAt ? `${new Date(e.completedAt).getTime() - new Date(e.startedAt).getTime()}ms` : \"-\",\n ]),\n },\n data: executions,\n ids: executions.map((e: any) => e.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n addPaginationFlags(cmd);\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\nimport chalk from \"chalk\";\n\nexport function createExecutionGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get detailed status and result of a specific execution\")\n .argument(\"<id>\", \"Execution ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos exec get 550e8400-e29b-41d4... View execution details\n $ nebulaos exec get my-exec-id -o json Output as JSON\n`)\n .action(async (id, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data: execution } = await api.get(`/execution/${id}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Execution Details\\n\"));\n printDetail(\"ID\", execution.id);\n if (execution.resourceId) printDetail(\"Resource ID\", execution.resourceId);\n if (execution.resourceName) printDetail(\"Resource\", execution.resourceName);\n printDetail(\"Status\", execution.status);\n if (execution.startedAt) printDetail(\"Started At\", new Date(execution.startedAt).toLocaleString());\n if (execution.completedAt) printDetail(\"Completed At\", new Date(execution.completedAt).toLocaleString());\n if (execution.duration) printDetail(\"Duration\", `${execution.duration}ms`);\n if (execution.error) printDetail(\"Error\", execution.error);\n if (execution.result !== undefined) {\n printDetail(\"Result\", JSON.stringify(execution.result, null, 2));\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: execution,\n ids: [execution.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\nimport chalk from \"chalk\";\n\nexport function createExecutionLogsCommand(): Command {\n const cmd = new Command(\"logs\")\n .description(\"View execution cost items and LLM calls for a specific execution\")\n .argument(\"<id>\", \"Execution ID\")\n .option(\"-l, --limit <n>\", \"Limit number of items\", \"50\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos exec logs 550e8400-e29b... View execution cost items\n $ nebulaos exec logs my-exec-id --limit 10 Show last 10 items\n $ nebulaos exec logs my-exec-id -o json Output as JSON\n`)\n .action(async (id, options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get(`/execution/${id}/cost-items`, {\n params: { limit: options.limit },\n });\n\n const items = Array.isArray(data) ? data : data.data ?? [];\n\n if (format === \"table\") {\n if (items.length === 0) {\n console.log(chalk.gray(\"No cost items available for this execution.\"));\n return;\n }\n\n console.log(chalk.bold(\"\\nExecution Cost Items\\n\"));\n\n for (const item of items) {\n const timestamp = item.createdAt\n ? chalk.gray(new Date(item.createdAt).toLocaleTimeString())\n : \"\";\n const type = formatType(item.type);\n const model = item.model ? chalk.cyan(`[${item.model}]`) : \"\";\n const tokens = item.inputTokens || item.outputTokens\n ? chalk.yellow(`(${item.inputTokens || 0}→${item.outputTokens || 0} tokens)`)\n : \"\";\n const cost = item.totalCost\n ? chalk.green(`$${item.totalCost.toFixed(6)}`)\n : \"\";\n\n console.log(`${timestamp} ${type} ${model} ${tokens} ${cost}`);\n\n if (item.input && globalOpts.verbose) {\n console.log(chalk.gray(` Input: ${truncate(JSON.stringify(item.input), 100)}`));\n }\n if (item.output && globalOpts.verbose) {\n console.log(chalk.gray(` Output: ${truncate(JSON.stringify(item.output), 100)}`));\n }\n }\n\n console.log(chalk.gray(`\\nShowing ${items.length} items. Use --limit to see more.`));\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: items,\n ids: items.map((i: any) => i.id ?? \"\"),\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n\nfunction formatType(type?: string): string {\n switch (type?.toLowerCase()) {\n case \"llm_call\":\n case \"llm\":\n return chalk.blue(\"[LLM] \");\n case \"tool_call\":\n case \"tool\":\n return chalk.magenta(\"[TOOL] \");\n case \"embedding\":\n return chalk.cyan(\"[EMBED]\");\n default:\n return chalk.gray(\"[ITEM] \");\n }\n}\n\nfunction truncate(str: string, maxLen: number): string {\n if (str.length <= maxLen) return str;\n return str.slice(0, maxLen - 3) + \"...\";\n}\n","import { Command } from \"commander\";\nimport { createConnectionsCommand } from \"./connections/index.js\";\nimport { createRagSearchCommand } from \"./search.js\";\n\nexport function createRagCommand(): Command {\n const rag = new Command(\"rag\")\n .description(\"Manage RAG connections and perform semantic searches\");\n\n rag.addCommand(createConnectionsCommand());\n rag.addCommand(createRagSearchCommand());\n\n return rag;\n}\n","import { Command } from \"commander\";\nimport { createConnectionsListCommand } from \"./list.js\";\nimport { createConnectionsGetCommand } from \"./get.js\";\nimport { createConnectionsCreateCommand } from \"./create.js\";\nimport { createConnectionsUpdateCommand } from \"./update.js\";\nimport { createConnectionsDeleteCommand } from \"./delete.js\";\nimport { createConnectionsTestCommand } from \"./test.js\";\n\nexport function createConnectionsCommand(): Command {\n const connections = new Command(\"connections\")\n .description(\"Create, configure, and test RAG vector store connections\");\n\n connections.addCommand(createConnectionsListCommand());\n connections.addCommand(createConnectionsGetCommand());\n connections.addCommand(createConnectionsCreateCommand());\n connections.addCommand(createConnectionsUpdateCommand());\n connections.addCommand(createConnectionsDeleteCommand());\n connections.addCommand(createConnectionsTestCommand());\n\n return connections;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output } from \"../../../lib/output.js\";\nimport { addPaginationFlags } from \"../../../lib/flags.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createConnectionsListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List all configured RAG connections\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag connections list List all connections\n $ nebulaos rag connections list -o json Output as JSON\n $ nebulaos rag connections list --page 2 Show page 2\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, unknown> = {};\n if (globalOpts.page) params.page = globalOpts.page;\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\n\n const { data } = await api.get(\"/rag-openai/connections\", { params });\n const connections = Array.isArray(data) ? data : data.data || [];\n\n output(format, {\n table: {\n headers: [\"ID\", \"Name\", \"Type\", \"Status\", \"Created At\"],\n rows: connections.map((c: Record<string, string>) => [\n c.id,\n c.name || \"-\",\n c.type || \"-\",\n c.status || \"-\",\n c.createdAt || \"-\",\n ]),\n },\n data: connections,\n ids: connections.map((c: Record<string, string>) => c.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n addPaginationFlags(cmd);\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\nimport chalk from \"chalk\";\n\nexport function createConnectionsGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get detailed information about a RAG connection\")\n .argument(\"<id>\", \"Connection ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag connections get conn-123 View connection details\n $ nebulaos rag connections get conn-123 -o json Output as JSON\n`)\n .action(async (id, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get(`/rag-openai/connections/${id}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"RAG Connection\\n\"));\n printDetail(\"ID\", data.id);\n printDetail(\"Name\", data.name || \"-\");\n printDetail(\"Type\", data.type || \"-\");\n printDetail(\"Status\", data.status || \"-\");\n if (data.baseUrl) printDetail(\"Base URL\", data.baseUrl);\n if (data.model) printDetail(\"Model\", data.model);\n printDetail(\"Created At\", data.createdAt || \"-\");\n printDetail(\"Updated At\", data.updatedAt || \"-\");\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [data.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output, printSuccess, printDetail } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createConnectionsCreateCommand(): Command {\n const cmd = new Command(\"create\")\n .description(\"Create a new RAG connection to a vector store provider\")\n .requiredOption(\"--name <name>\", \"Connection name\")\n .requiredOption(\"--type <type>\", \"Connection type (e.g., openai, azure)\")\n .option(\"--base-url <url>\", \"Base URL for the connection\")\n .option(\"--api-key <key>\", \"API key for the connection\")\n .option(\"--model <model>\", \"Model name\")\n .option(\"--dimensions <number>\", \"Embedding dimensions\", parseInt)\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag connections create --name my-store --type openai \\\\\n --api-key sk-... --model text-embedding-3-small\n $ nebulaos rag connections create --name azure-store --type azure \\\\\n --base-url https://my-resource.openai.azure.com --api-key abc123 \\\\\n --dimensions 1536\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const body: Record<string, unknown> = {\n name: options.name,\n type: options.type,\n };\n if (options.baseUrl) body.baseUrl = options.baseUrl;\n if (options.apiKey) body.apiKey = options.apiKey;\n if (options.model) body.model = options.model;\n if (options.dimensions) body.dimensions = options.dimensions;\n\n const { data } = await api.post(\"/rag-openai/connections\", body);\n\n if (format === \"table\") {\n printSuccess(\"RAG connection created successfully.\");\n printDetail(\"ID\", data.id);\n printDetail(\"Name\", data.name);\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [data.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output, printSuccess, printDetail } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createConnectionsUpdateCommand(): Command {\n const cmd = new Command(\"update\")\n .description(\"Update an existing RAG connection's configuration\")\n .argument(\"<id>\", \"Connection ID\")\n .option(\"--name <name>\", \"Connection name\")\n .option(\"--base-url <url>\", \"Base URL for the connection\")\n .option(\"--api-key <key>\", \"API key for the connection\")\n .option(\"--model <model>\", \"Model name\")\n .option(\"--dimensions <number>\", \"Embedding dimensions\", parseInt)\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag connections update conn-123 --name new-name Rename connection\n $ nebulaos rag connections update conn-123 --api-key sk-new... Rotate API key\n $ nebulaos rag connections update conn-123 --model text-embedding-3-large\n`)\n .action(async (id, options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const body: Record<string, unknown> = {};\n if (options.name) body.name = options.name;\n if (options.baseUrl) body.baseUrl = options.baseUrl;\n if (options.apiKey) body.apiKey = options.apiKey;\n if (options.model) body.model = options.model;\n if (options.dimensions) body.dimensions = options.dimensions;\n\n const { data } = await api.patch(`/rag-openai/connections/${id}`, body);\n\n if (format === \"table\") {\n printSuccess(\"RAG connection updated successfully.\");\n printDetail(\"ID\", data.id);\n printDetail(\"Name\", data.name);\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [data.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { confirm } from \"@inquirer/prompts\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createConnectionsDeleteCommand(): Command {\n const cmd = new Command(\"delete\")\n .description(\"Permanently delete a RAG connection\")\n .argument(\"<id>\", \"Connection ID\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag connections delete conn-123 Delete with confirmation\n $ nebulaos rag connections delete conn-123 -y Delete without confirmation\n`)\n .action(async (id, options) => {\n try {\n if (!options.yes) {\n const shouldProceed = await confirm({\n message: `Delete RAG connection '${id}'?`,\n default: false,\n });\n if (!shouldProceed) {\n console.log(\"Cancelled.\");\n return;\n }\n }\n\n const api = getApiClient();\n await api.delete(`/rag-openai/connections/${id}`);\n printSuccess(`RAG connection '${id}' deleted.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createConnectionsTestCommand(): Command {\n const cmd = new Command(\"test\")\n .description(\"Test connectivity and authentication of a RAG connection\")\n .argument(\"<id>\", \"Connection ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag connections test conn-123 Test a connection\n $ nebulaos rag connections test conn-123 -o json Output result as JSON\n`)\n .action(async (id, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n console.log(\"Testing connection...\");\n const { data } = await api.post(`/rag-openai/connections/${id}/test`);\n\n if (format === \"table\") {\n if (data.success) {\n console.log(chalk.green(\"Connection test passed.\"));\n } else {\n console.log(chalk.red(`Connection test failed: ${data.error || \"Unknown error\"}`));\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createRagSearchCommand(): Command {\n const cmd = new Command(\"search\")\n .description(\"Perform a semantic search against a RAG connection\")\n .requiredOption(\"--connection <id>\", \"Connection ID to search against\")\n .requiredOption(\"--query <query>\", \"Search query\")\n .option(\"--limit <number>\", \"Maximum number of results\", parseInt)\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos rag search --connection conn-123 --query \"patient intake process\"\n $ nebulaos rag search --connection conn-123 --query \"billing codes\" --limit 5\n $ nebulaos rag search --connection conn-123 --query \"diagnosis\" -o json\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const body: Record<string, unknown> = {\n connectionId: options.connection,\n query: options.query,\n };\n if (options.limit) body.limit = options.limit;\n\n const { data } = await api.post(\"/rag/search\", body);\n const results = Array.isArray(data) ? data : data.results || [];\n\n output(format, {\n table: {\n headers: [\"#\", \"Score\", \"Content\"],\n rows: results.map((r: Record<string, unknown>, i: number) => [\n String(i + 1),\n String(r.score ?? \"-\"),\n String(r.content || r.text || \"-\").slice(0, 100),\n ]),\n },\n data: results,\n ids: results.map((_: unknown, i: number) => String(i + 1)),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createFeaturesCatalogCommand } from \"./catalog.js\";\nimport { createFeaturesListCommand } from \"./list.js\";\nimport { createFeaturesGetCommand } from \"./get.js\";\nimport { createFeaturesEnableCommand } from \"./enable.js\";\nimport { createFeaturesDisableCommand } from \"./disable.js\";\nimport { createFeaturesConfigCommand } from \"./config.js\";\n\nexport function createFeaturesCommand(): Command {\n const features = new Command(\"features\")\n .description(\"Browse, enable, disable, and configure platform feature flags\");\n\n features.addCommand(createFeaturesCatalogCommand());\n features.addCommand(createFeaturesListCommand());\n features.addCommand(createFeaturesGetCommand());\n features.addCommand(createFeaturesEnableCommand());\n features.addCommand(createFeaturesDisableCommand());\n features.addCommand(createFeaturesConfigCommand());\n\n return features;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createFeaturesCatalogCommand(): Command {\n const cmd = new Command(\"catalog\")\n .description(\"List all available features in the platform catalog\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos features catalog Browse all available features\n $ nebulaos features catalog -o json Output as JSON\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get(\"/ai-features/catalog\");\n const features = Array.isArray(data) ? data : data.data || [];\n\n output(format, {\n table: {\n headers: [\"Key\", \"Name\", \"Description\", \"Category\"],\n rows: features.map((f: Record<string, string>) => [\n f.key,\n f.name || \"-\",\n f.description || \"-\",\n f.category || \"-\",\n ]),\n },\n data: features,\n ids: features.map((f: Record<string, string>) => f.key),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createFeaturesListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List features enabled for the current organization\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos features list List enabled features\n $ nebulaos features list -o json Output as JSON\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get(\"/ai-features\");\n const features = Array.isArray(data) ? data : data.data || [];\n\n output(format, {\n table: {\n headers: [\"Key\", \"Name\", \"Enabled\", \"Updated At\"],\n rows: features.map((f: Record<string, string | boolean>) => [\n String(f.key),\n String(f.name || \"-\"),\n String(f.enabled ?? f.isEnabled ?? \"-\"),\n String(f.updatedAt || \"-\"),\n ]),\n },\n data: features,\n ids: features.map((f: Record<string, string>) => f.key),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createFeaturesGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get details and configuration of a specific feature\")\n .argument(\"<key>\", \"Feature key\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos features get llm-gateway View feature details\n $ nebulaos features get rag -o json Output as JSON\n`)\n .action(async (key, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get(`/ai-features/${key}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Feature\\n\"));\n printDetail(\"Key\", data.key);\n printDetail(\"Name\", data.name || \"-\");\n printDetail(\"Description\", data.description || \"-\");\n printDetail(\"Enabled\", data.enabled ?? data.isEnabled ? \"true\" : \"false\");\n if (data.config) {\n printDetail(\"Config\", JSON.stringify(data.config, null, 2));\n }\n printDetail(\"Updated At\", data.updatedAt || \"-\");\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [data.key],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { printSuccess } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createFeaturesEnableCommand(): Command {\n const cmd = new Command(\"enable\")\n .description(\"Enable a feature for the current organization\")\n .argument(\"<key>\", \"Feature key\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos features enable llm-gateway Enable the LLM gateway feature\n $ nebulaos features enable rag Enable the RAG feature\n`)\n .action(async (key) => {\n try {\n const api = getApiClient();\n await api.post(`/ai-features/${key}/enable`);\n printSuccess(`Feature '${key}' enabled.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { printSuccess } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createFeaturesDisableCommand(): Command {\n const cmd = new Command(\"disable\")\n .description(\"Disable a feature for the current organization\")\n .argument(\"<key>\", \"Feature key\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos features disable llm-gateway Disable the LLM gateway feature\n $ nebulaos features disable rag Disable the RAG feature\n`)\n .action(async (key) => {\n try {\n const api = getApiClient();\n await api.post(`/ai-features/${key}/disable`);\n printSuccess(`Feature '${key}' disabled.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output, printSuccess } from \"../../lib/output.js\";\nimport { handleError, CLIError, ExitCode } from \"../../lib/errors.js\";\n\nexport function createFeaturesConfigCommand(): Command {\n const cmd = new Command(\"config\")\n .description(\"View or update key-value configuration for a feature\")\n .argument(\"<key>\", \"Feature key\")\n .option(\"--set <entries...>\", \"Set config values (key=value)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos features config llm-gateway View current config\n $ nebulaos features config llm-gateway --set max_tokens=4096 Update a config value\n $ nebulaos features config rag --set provider=openai model=text-embedding-3-small\n $ nebulaos features config llm-gateway -o json Output as JSON\n`)\n .action(async (key, options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n if (options.set && options.set.length > 0) {\n const configValues: Record<string, string> = {};\n for (const entry of options.set) {\n const eqIndex = entry.indexOf(\"=\");\n if (eqIndex === -1) {\n throw new CLIError(\n `Invalid config entry '${entry}'. Use key=value format.`,\n ExitCode.ValidationError,\n );\n }\n const k = entry.slice(0, eqIndex);\n const v = entry.slice(eqIndex + 1);\n configValues[k] = v;\n }\n\n await api.patch(`/ai-features/${key}/config`, configValues);\n printSuccess(`Feature '${key}' configuration updated.`);\n } else {\n const { data } = await api.get(`/ai-features/${key}`);\n const featureConfig = data.config || {};\n\n if (format === \"table\") {\n console.log(chalk.bold(`Feature '${key}' Configuration\\n`));\n const entries = Object.entries(featureConfig);\n if (entries.length === 0) {\n console.log(\"No configuration set.\");\n } else {\n for (const [k, v] of entries) {\n console.log(` ${chalk.bold(k)}: ${v}`);\n }\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: featureConfig,\n ids: Object.keys(featureConfig),\n });\n }\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createTracesCommand } from \"./traces/index.js\";\nimport { createMetricsCommand } from \"./metrics.js\";\n\nexport function createObservabilityCommand(): Command {\n const observability = new Command(\"observability\")\n .alias(\"obs\")\n .description(\"Inspect traces and metrics from your agents and workflows\");\n\n observability.addCommand(createTracesCommand());\n observability.addCommand(createMetricsCommand());\n\n return observability;\n}\n","import { Command } from \"commander\";\nimport { createTracesSearchCommand } from \"./search.js\";\nimport { createTracesGetCommand } from \"./get.js\";\n\nexport function createTracesCommand(): Command {\n const traces = new Command(\"traces\")\n .description(\"Search and inspect distributed traces from agent executions\");\n\n traces.addCommand(createTracesSearchCommand());\n traces.addCommand(createTracesGetCommand());\n\n return traces;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output } from \"../../../lib/output.js\";\nimport { addPaginationFlags } from \"../../../lib/flags.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createTracesSearchCommand(): Command {\n const cmd = new Command(\"search\")\n .description(\"Search traces by status, agent, or time range\")\n .option(\"--status <status>\", \"Filter by status\")\n .option(\"--limit <number>\", \"Maximum number of results\", parseInt)\n .option(\"--agent <name>\", \"Filter by agent name\")\n .option(\"--from <date>\", \"Start date (ISO format)\")\n .option(\"--to <date>\", \"End date (ISO format)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos obs traces search List recent traces\n $ nebulaos obs traces search --agent my-agent Filter by agent\n $ nebulaos obs traces search --status error --limit 10 Find error traces\n $ nebulaos obs traces search --from 2026-01-01 --to 2026-01-31 -o json\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, unknown> = {};\n if (options.status) params.status = options.status;\n if (options.limit) params.limit = options.limit;\n if (options.agent) params.agent = options.agent;\n if (options.from) params.from = options.from;\n if (options.to) params.to = options.to;\n if (globalOpts.page) params.page = globalOpts.page;\n if (globalOpts.pageSize) params.pageSize = globalOpts.pageSize;\n\n const { data } = await api.get(\"/observability/traces/search\", { params });\n const traces = Array.isArray(data) ? data : data.data || [];\n\n output(format, {\n table: {\n headers: [\"Trace ID\", \"Status\", \"Duration\", \"Agent\", \"Started At\"],\n rows: traces.map((t: Record<string, string>) => [\n t.traceId || t.id || \"-\",\n t.status || \"-\",\n t.duration ? `${t.duration}ms` : \"-\",\n t.agent || t.agentName || \"-\",\n t.startedAt || t.createdAt || \"-\",\n ]),\n },\n data: traces,\n ids: traces.map((t: Record<string, string>) => t.traceId || t.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n addPaginationFlags(cmd);\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createTracesGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get detailed trace information including all spans\")\n .argument(\"[traceId]\", \"Trace ID\")\n .option(\"--execution-id <executionId>\", \"Lookup trace by execution ID\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos obs traces get abc123-def456... View trace by trace ID\n $ nebulaos obs traces get --execution-id exec-789... View trace by execution ID\n $ nebulaos obs traces get abc123 -o json Output as JSON\n`)\n .action(async (traceId, options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n if (!traceId && !options.executionId) {\n console.error(\"Error: provide either a <traceId> argument or --execution-id <executionId>\");\n process.exit(1);\n }\n\n const url = options.executionId\n ? `/observability/executions/${options.executionId}/trace`\n : `/observability/traces/${traceId}`;\n const { data } = await api.get(url);\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Trace\\n\"));\n printDetail(\"Trace ID\", data.traceId || data.id || \"-\");\n printDetail(\"Status\", data.status || \"-\");\n printDetail(\"Duration\", data.duration ? `${data.duration}ms` : \"-\");\n printDetail(\"Agent\", data.agent || data.agentName || \"-\");\n printDetail(\"Started At\", data.startedAt || data.createdAt || \"-\");\n printDetail(\"Ended At\", data.endedAt || \"-\");\n\n if (data.spans && data.spans.length > 0) {\n console.log(chalk.bold(\"\\nSpans:\"));\n for (const span of data.spans) {\n console.log(` ${span.spanId} - ${span.name || span.operationName || \"unknown\"} (${span.duration ? span.duration + \"ms\" : \"-\"})`);\n }\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [data.traceId || data.id],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createMetricsCommand(): Command {\n const cmd = new Command(\"metrics\")\n .description(\"View observability metrics with optional time range and type filters\")\n .option(\"--type <type>\", \"Metric type filter\")\n .option(\"--from <date>\", \"Start date (ISO format)\")\n .option(\"--to <date>\", \"End date (ISO format)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos obs metrics List all metrics\n $ nebulaos obs metrics --type latency Filter by metric type\n $ nebulaos obs metrics --from 2026-01-01 --to 2026-01-31 Filter by date range\n $ nebulaos obs metrics -o json Output as JSON\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, unknown> = {};\n if (options.type) params.type = options.type;\n if (options.from) params.from = options.from;\n if (options.to) params.to = options.to;\n\n const { data } = await api.get(\"/observability/metrics\", { params });\n const metrics = Array.isArray(data) ? data : data.data || [];\n\n output(format, {\n table: {\n headers: [\"Name\", \"Type\", \"Value\", \"Timestamp\"],\n rows: metrics.map((m: Record<string, string>) => [\n m.name || \"-\",\n m.type || \"-\",\n String(m.value ?? \"-\"),\n m.timestamp || \"-\",\n ]),\n },\n data: metrics,\n ids: metrics.map((m: Record<string, string>) => m.name || m.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createConfigGetCommand } from \"./get.js\";\nimport { createConfigSetCommand } from \"./set.js\";\nimport { createConfigListCommand } from \"./list.js\";\n\nexport function createConfigCommand(): Command {\n const config = new Command(\"config\")\n .description(\"View and modify CLI configuration (output format, page size, contexts)\");\n\n config.addCommand(createConfigGetCommand());\n config.addCommand(createConfigSetCommand());\n config.addCommand(createConfigListCommand());\n\n return config;\n}\n","import { Command } from \"commander\";\nimport { getConfig } from \"../../lib/config.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\n\nexport function createConfigGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get the current value of a configuration key\")\n .argument(\"<key>\", \"Configuration key (e.g., defaults.output, defaults.pageSize)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos config get defaults.output Get default output format\n $ nebulaos config get defaults.pageSize Get default page size\n $ nebulaos config get currentContext Get active context name\n`)\n .action(async (key, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const config = getConfig();\n\n const parts = key.split(\".\");\n let value: unknown = config;\n for (const part of parts) {\n if (value && typeof value === \"object\" && part in value) {\n value = (value as Record<string, unknown>)[part];\n } else {\n throw new CLIError(`Configuration key '${key}' not found.`, ExitCode.NotFound);\n }\n }\n\n if (format === \"table\") {\n printDetail(key, String(value));\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: { key, value },\n ids: [key],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { setDefault, type CLIConfig } from \"../../lib/config.js\";\nimport { resolveFormat, output, printSuccess } from \"../../lib/output.js\";\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\n\nconst VALID_KEYS: Record<string, (v: string) => unknown> = {\n \"defaults.output\": (v) => {\n const valid = [\"table\", \"json\", \"yaml\", \"quiet\"];\n if (!valid.includes(v)) {\n throw new CLIError(\n `Invalid output format '${v}'. Valid values: ${valid.join(\", \")}`,\n ExitCode.ValidationError,\n );\n }\n return v;\n },\n \"defaults.pageSize\": (v) => {\n const n = parseInt(v, 10);\n if (isNaN(n) || n < 1 || n > 100) {\n throw new CLIError(\n \"Page size must be a number between 1 and 100.\",\n ExitCode.ValidationError,\n );\n }\n return n;\n },\n};\n\nexport function createConfigSetCommand(): Command {\n const cmd = new Command(\"set\")\n .description(\"Set a CLI configuration value\")\n .argument(\"<key>\", \"Configuration key (e.g., defaults.output, defaults.pageSize)\")\n .argument(\"<value>\", \"Configuration value\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos config set defaults.output json Set default output to JSON\n $ nebulaos config set defaults.output table Set default output to table\n $ nebulaos config set defaults.pageSize 25 Set default page size to 25\n\nValid keys:\n defaults.output Output format (table, json, yaml, quiet)\n defaults.pageSize Number of items per page (1-100)\n`)\n .action(async (key, value, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n\n const parser = VALID_KEYS[key];\n if (!parser) {\n throw new CLIError(\n `Unknown configuration key '${key}'. Valid keys: ${Object.keys(VALID_KEYS).join(\", \")}`,\n ExitCode.ValidationError,\n );\n }\n\n const parsed = parser(value);\n const parts = key.split(\".\");\n if (parts[0] === \"defaults\" && parts.length === 2) {\n setDefault(parts[1] as keyof CLIConfig[\"defaults\"], parsed as never);\n }\n\n output(format, {\n table: {\n headers: [\"Key\", \"Value\"],\n rows: [[key, String(parsed)]],\n },\n data: { key, value: parsed },\n ids: [key],\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getConfig, getConfigPath } from \"../../lib/config.js\";\nimport { resolveFormat, output, printDetail } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\nexport function createConfigListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"Display all configuration values and registered contexts\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos config list Show all config and contexts\n $ nebulaos config list -o json Output as JSON\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const config = getConfig();\n\n if (format === \"table\") {\n console.log(chalk.bold(\"Configuration\\n\"));\n printDetail(\"Config File\", getConfigPath());\n printDetail(\"Current Context\", config.currentContext || \"(none)\");\n printDetail(\"Output Format\", config.defaults.output);\n printDetail(\"Page Size\", String(config.defaults.pageSize));\n\n const contextNames = Object.keys(config.contexts);\n if (contextNames.length > 0) {\n console.log(chalk.bold(\"\\nContexts:\"));\n for (const name of contextNames) {\n const ctx = config.contexts[name];\n const active = name === config.currentContext ? chalk.green(\" (active)\") : \"\";\n console.log(` ${name}${active} - ${ctx.apiUrl}`);\n }\n }\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data: config,\n ids: Object.keys(config.contexts),\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createRoutesCommand } from \"./routes/index.js\";\nimport { createKeysCommand } from \"./keys/index.js\";\nimport { createRequestsCommand } from \"./requests.js\";\nimport { createUsageCommand } from \"./usage.js\";\nimport { createCatalogCommand } from \"./catalog.js\";\n\nexport function createLlmGatewayCommand(): Command {\n const llmGateway = new Command(\"llm-gateway\")\n .alias(\"llm\")\n .description(\"Manage LLM Gateway routes, API keys, model catalog, and usage\");\n\n llmGateway.addCommand(createRoutesCommand());\n llmGateway.addCommand(createKeysCommand());\n llmGateway.addCommand(createRequestsCommand());\n llmGateway.addCommand(createUsageCommand());\n llmGateway.addCommand(createCatalogCommand());\n\n return llmGateway;\n}\n","import { Command } from \"commander\";\nimport { createRoutesListCommand } from \"./list.js\";\nimport { createRoutesGetCommand } from \"./get.js\";\nimport { createRoutesCreateCommand } from \"./create.js\";\nimport { createRoutesUpdateCommand } from \"./update.js\";\nimport { createRoutesDeleteCommand } from \"./delete.js\";\n\nexport function createRoutesCommand(): Command {\n const routes = new Command(\"routes\")\n .description(\"Create, update, and manage LLM gateway routes (model configurations)\");\n\n routes.addCommand(createRoutesListCommand());\n routes.addCommand(createRoutesGetCommand());\n routes.addCommand(createRoutesCreateCommand());\n routes.addCommand(createRoutesUpdateCommand());\n routes.addCommand(createRoutesDeleteCommand());\n\n return routes;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\ninterface RouteItem {\n name: string;\n description: string;\n primaryModel: string;\n status: string;\n provisioningStatus: string;\n updatedAt: string;\n}\n\nexport function createRoutesListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List all configured LLM gateway routes\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm routes list List all routes\n $ nebulaos llm routes list -o json Output as JSON\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get<RouteItem[]>(\"/llm-gateway/routes\");\n\n output(format, {\n table: {\n headers: [\"Alias\", \"Description\", \"Model\", \"Status\", \"Provisioning\", \"Updated\"],\n rows: data.map((r) => [\n r.name,\n r.description || \"-\",\n r.primaryModel,\n r.status,\n r.provisioningStatus,\n r.updatedAt ? new Date(r.updatedAt).toLocaleString() : \"-\",\n ]),\n },\n data,\n ids: data.map((r) => r.name),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output, printDetail } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\ninterface RouteDetail {\n name: string;\n description: string;\n primaryModel: string;\n fallbackChain: string[];\n status: string;\n provisioningStatus: string;\n provider: string | null;\n modelName: string | null;\n maxTokens: number | null;\n timeoutMs: number | null;\n retries: number | null;\n updatedAt: string;\n}\n\nexport function createRoutesGetCommand(): Command {\n const cmd = new Command(\"get\")\n .description(\"Get full details of an LLM gateway route including fallback chain\")\n .argument(\"<alias>\", \"Route alias\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm routes get my-route View route details\n $ nebulaos llm routes get my-route -o json Output as JSON\n`)\n .action(async (alias, _options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get<RouteDetail>(`/llm-gateway/routes/${alias}`);\n\n if (format === \"table\") {\n console.log(chalk.bold(`Route: ${data.name}\\n`));\n printDetail(\"Alias\", data.name);\n printDetail(\"Description\", data.description || \"-\");\n printDetail(\"Provider\", data.provider || \"-\");\n printDetail(\"Model\", data.modelName || data.primaryModel);\n printDetail(\"Status\", data.status);\n printDetail(\"Provisioning\", data.provisioningStatus);\n if (data.maxTokens) printDetail(\"Max Tokens\", String(data.maxTokens));\n if (data.timeoutMs) printDetail(\"Timeout (ms)\", String(data.timeoutMs));\n if (data.retries) printDetail(\"Retries\", String(data.retries));\n if (data.fallbackChain?.length) {\n printDetail(\"Fallback Chain\", data.fallbackChain.join(\" -> \"));\n }\n printDetail(\"Updated\", data.updatedAt ? new Date(data.updatedAt).toLocaleString() : \"-\");\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: [data.name],\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { input } from \"@inquirer/prompts\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createRoutesCreateCommand(): Command {\n const cmd = new Command(\"create\")\n .description(\"Create a new LLM gateway route (interactive or via flags)\")\n .option(\"--alias <alias>\", \"Route alias\")\n .option(\"--provider <provider>\", \"LLM provider (e.g. openai, anthropic, azure)\")\n .option(\"--model <model>\", \"Model name (e.g. gpt-4o, claude-3-opus)\")\n .option(\"--description <description>\", \"Route description\")\n .option(\"--max-tokens <number>\", \"Max tokens limit\", parseInt)\n .option(\"--timeout <ms>\", \"Timeout in milliseconds\", parseInt)\n .option(\"--retries <count>\", \"Retry count\", parseInt)\n .option(\"--credential <key=value>\", \"Credential key=value pair (repeatable)\", collectKeyValue, {})\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm routes create Interactive mode\n $ nebulaos llm routes create --alias gpt4 --provider openai --model gpt-4o\n $ nebulaos llm routes create --alias claude --provider anthropic --model claude-3-opus \\\\\n --credential api_key=sk-...\n $ nebulaos llm routes create --alias fast --provider openai --model gpt-4o-mini \\\\\n --max-tokens 4096 --timeout 30000 --retries 2\n`)\n .action(async (options, command) => {\n try {\n const api = getApiClient();\n\n const alias = options.alias || await input({ message: \"Route alias:\" });\n const provider = options.provider || await input({ message: \"Provider (e.g. openai, anthropic, azure):\" });\n const modelName = options.model || await input({ message: \"Model name:\" });\n const description = options.description || await input({ message: \"Description (optional):\", default: \"\" });\n\n let credentials = options.credential;\n if (Object.keys(credentials).length === 0) {\n const apiKey = await input({ message: \"API key for provider:\" });\n credentials = { api_key: apiKey };\n }\n\n const body: Record<string, unknown> = {\n alias,\n provider,\n modelName,\n credentials,\n };\n\n if (description) body.description = description;\n if (options.maxTokens) body.maxTokens = options.maxTokens;\n if (options.timeout) body.timeoutMs = options.timeout;\n if (options.retries) body.retryCount = options.retries;\n\n await api.post(\"/llm-gateway/routes\", body);\n printSuccess(`Route '${alias}' created successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n\nfunction collectKeyValue(value: string, previous: Record<string, string>): Record<string, string> {\n const [k, ...rest] = value.split(\"=\");\n if (k && rest.length > 0) {\n previous[k] = rest.join(\"=\");\n }\n return previous;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createRoutesUpdateCommand(): Command {\n const cmd = new Command(\"update\")\n .description(\"Update an existing LLM gateway route configuration\")\n .argument(\"<alias>\", \"Route alias\")\n .option(\"--description <description>\", \"Route description\")\n .option(\"--provider <provider>\", \"LLM provider\")\n .option(\"--model <model>\", \"Model name\")\n .option(\"--max-tokens <number>\", \"Max tokens limit\", parseInt)\n .option(\"--timeout <ms>\", \"Timeout in milliseconds\", parseInt)\n .option(\"--retries <count>\", \"Retry count\", parseInt)\n .option(\"--credential <key=value>\", \"Credential key=value pair (repeatable)\", collectKeyValue, {})\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm routes update my-route --model gpt-4o-mini Change model\n $ nebulaos llm routes update my-route --max-tokens 8192 Update token limit\n $ nebulaos llm routes update my-route --credential api_key=sk-new... Update credentials\n $ nebulaos llm routes update my-route --timeout 60000 --retries 3 Update timeouts\n`)\n .action(async (alias, options, command) => {\n try {\n const api = getApiClient();\n\n const body: Record<string, unknown> = {};\n\n if (options.description !== undefined) body.description = options.description;\n if (options.provider) body.provider = options.provider;\n if (options.model) body.modelName = options.model;\n if (options.maxTokens) body.maxTokens = options.maxTokens;\n if (options.timeout) body.timeoutMs = options.timeout;\n if (options.retries) body.retryCount = options.retries;\n if (Object.keys(options.credential).length > 0) body.credentials = options.credential;\n\n await api.put(`/llm-gateway/routes/${alias}`, body);\n printSuccess(`Route '${alias}' updated successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n\nfunction collectKeyValue(value: string, previous: Record<string, string>): Record<string, string> {\n const [k, ...rest] = value.split(\"=\");\n if (k && rest.length > 0) {\n previous[k] = rest.join(\"=\");\n }\n return previous;\n}\n","import { Command } from \"commander\";\nimport { confirm } from \"@inquirer/prompts\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createRoutesDeleteCommand(): Command {\n const cmd = new Command(\"delete\")\n .description(\"Permanently delete an LLM gateway route\")\n .argument(\"<alias>\", \"Route alias\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm routes delete my-route Delete with confirmation prompt\n $ nebulaos llm routes delete my-route -y Delete without confirmation\n`)\n .action(async (alias, options) => {\n try {\n if (!options.yes) {\n const shouldProceed = await confirm({\n message: `Delete route '${alias}'? This cannot be undone.`,\n default: false,\n });\n\n if (!shouldProceed) {\n console.log(\"Cancelled.\");\n return;\n }\n }\n\n const api = getApiClient();\n await api.delete(`/llm-gateway/routes/${alias}`);\n printSuccess(`Route '${alias}' deleted successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { createKeysListCommand } from \"./list.js\";\nimport { createKeysCreateCommand } from \"./create.js\";\nimport { createKeysRevokeCommand } from \"./revoke.js\";\n\nexport function createKeysCommand(): Command {\n const keys = new Command(\"keys\")\n .description(\"Create, list, and revoke LLM gateway API keys\");\n\n keys.addCommand(createKeysListCommand());\n keys.addCommand(createKeysCreateCommand());\n keys.addCommand(createKeysRevokeCommand());\n\n return keys;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { resolveFormat, output } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\ninterface KeyItem {\n id: string;\n name: string;\n description: string;\n user: string;\n status: string;\n allowedRoutes: string[];\n lastUsedAt: string | null;\n}\n\nexport function createKeysListCommand(): Command {\n const cmd = new Command(\"list\")\n .description(\"List all LLM gateway API keys and their allowed routes\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm keys list List all gateway API keys\n $ nebulaos llm keys list -o json Output as JSON\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get<KeyItem[]>(\"/llm-gateway/keys\");\n\n output(format, {\n table: {\n headers: [\"ID\", \"Name\", \"User\", \"Status\", \"Allowed Routes\", \"Last Used\"],\n rows: data.map((k) => [\n k.id,\n k.name,\n k.user,\n k.status,\n k.allowedRoutes?.length ? k.allowedRoutes.join(\", \") : \"all\",\n k.lastUsedAt ? new Date(k.lastUsedAt).toLocaleString() : \"never\",\n ]),\n },\n data,\n ids: data.map((k) => k.id),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { input, select } from \"@inquirer/prompts\";\nimport chalk from \"chalk\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createKeysCreateCommand(): Command {\n const cmd = new Command(\"create\")\n .description(\"Create a new LLM gateway API key (interactive or via flags)\")\n .option(\"--name <name>\", \"Key name\")\n .option(\"--type <type>\", \"Key type (personal or service)\")\n .option(\"--allowed-routes <routes>\", \"Comma-separated list of allowed route aliases\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm keys create Interactive mode\n $ nebulaos llm keys create --name my-key --type personal Create personal key\n $ nebulaos llm keys create --name svc-key --type service \\\\\n --allowed-routes gpt4,claude Restrict to specific routes\n\nNote: The API key is displayed only once after creation. Save it securely.\n`)\n .action(async (options) => {\n try {\n const api = getApiClient();\n\n const name = options.name || await input({ message: \"Key name:\" });\n const type = options.type || await select({\n message: \"Key type:\",\n choices: [\n { name: \"personal\", value: \"personal\" },\n { name: \"service\", value: \"service\" },\n ],\n });\n\n const body: Record<string, unknown> = { name, type };\n\n if (options.allowedRoutes) {\n body.allowedRoutes = options.allowedRoutes.split(\",\").map((s: string) => s.trim());\n }\n\n const { data } = await api.post<{ key: string }>(\"/llm-gateway/keys\", body);\n\n printSuccess(`API key '${name}' created successfully.`);\n console.log(`\\n${chalk.bold(\"Key:\")} ${data.key}`);\n console.log(chalk.yellow(\"\\nSave this key now. It will not be shown again.\"));\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { confirm } from \"@inquirer/prompts\";\nimport { getApiClient } from \"../../../lib/api.js\";\nimport { printSuccess } from \"../../../lib/output.js\";\nimport { handleError } from \"../../../lib/errors.js\";\n\nexport function createKeysRevokeCommand(): Command {\n const cmd = new Command(\"revoke\")\n .description(\"Permanently revoke an LLM gateway API key\")\n .argument(\"<keyId>\", \"API key ID\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm keys revoke key-123 Revoke with confirmation prompt\n $ nebulaos llm keys revoke key-123 -y Revoke without confirmation\n`)\n .action(async (keyId, options) => {\n try {\n if (!options.yes) {\n const shouldProceed = await confirm({\n message: `Revoke API key '${keyId}'? This cannot be undone.`,\n default: false,\n });\n\n if (!shouldProceed) {\n console.log(\"Cancelled.\");\n return;\n }\n }\n\n const api = getApiClient();\n await api.delete(`/llm-gateway/keys/${keyId}`);\n printSuccess(`API key '${keyId}' revoked successfully.`);\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface RequestItem {\n requestId: string;\n timestamp: string;\n routeAlias: string;\n apiKeyName: string;\n modelFinal: string;\n totalTokens: number | null;\n durationMs: number | null;\n status: string;\n costUsd: number | null;\n}\n\nexport function createRequestsCommand(): Command {\n const cmd = new Command(\"requests\")\n .description(\"List recent LLM gateway requests with token usage and cost details\")\n .option(\"--limit <number>\", \"Maximum number of requests to return\", parseInt)\n .option(\"--route <alias>\", \"Filter by route alias\")\n .option(\"--status <status>\", \"Filter by status (success or error)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm requests List recent requests\n $ nebulaos llm requests --limit 10 Show last 10 requests\n $ nebulaos llm requests --route my-route Filter by route\n $ nebulaos llm requests --status error Show only failed requests\n $ nebulaos llm requests -o json Output as JSON\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, string> = {};\n if (options.limit) params.limit = String(options.limit);\n if (options.route) params.routeAlias = options.route;\n if (options.status) params.status = options.status;\n\n const { data } = await api.get<RequestItem[]>(\"/llm-gateway/requests\", { params });\n\n output(format, {\n table: {\n headers: [\"Request ID\", \"Timestamp\", \"Route\", \"Model\", \"Tokens\", \"Duration (ms)\", \"Status\", \"Cost\"],\n rows: data.map((r) => [\n r.requestId.substring(0, 12) + \"...\",\n new Date(r.timestamp).toLocaleString(),\n r.routeAlias,\n r.modelFinal,\n r.totalTokens != null ? String(r.totalTokens) : \"-\",\n r.durationMs != null ? String(r.durationMs) : \"-\",\n r.status,\n r.costUsd != null ? `$${r.costUsd.toFixed(4)}` : \"-\",\n ]),\n },\n data,\n ids: data.map((r) => r.requestId),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface UsageItem {\n date: string;\n route: string;\n model: string;\n tokens: number;\n costUsd: number | null;\n status: string;\n}\n\nexport function createUsageCommand(): Command {\n const cmd = new Command(\"usage\")\n .description(\"Show aggregated LLM gateway usage statistics (tokens and costs)\")\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm usage Show usage summary\n $ nebulaos llm usage -o json Output as JSON\n $ nebulaos llm usage -o yaml Output as YAML\n`)\n .action(async (_options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const { data } = await api.get<UsageItem[]>(\"/llm-gateway/usage\");\n\n output(format, {\n table: {\n headers: [\"Date\", \"Route\", \"Model\", \"Tokens\", \"Cost\", \"Status\"],\n rows: data.map((u) => [\n u.date,\n u.route,\n u.model,\n String(u.tokens),\n u.costUsd != null ? `$${u.costUsd.toFixed(4)}` : \"-\",\n u.status,\n ]),\n },\n data,\n ids: data.map((u) => `${u.date}-${u.route}`),\n });\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { getApiClient } from \"../../lib/api.js\";\nimport { resolveFormat, output } from \"../../lib/output.js\";\nimport { handleError } from \"../../lib/errors.js\";\n\ninterface CatalogItem {\n model: string;\n provider: string;\n modality: string;\n priceInput: number | null;\n priceOutput: number | null;\n status: string;\n}\n\ninterface CatalogPage {\n items: CatalogItem[];\n page: number;\n limit: number;\n total: number;\n}\n\nexport function createCatalogCommand(): Command {\n const cmd = new Command(\"catalog\")\n .description(\"Browse available LLM models with pricing and provider info\")\n .option(\"--search <query>\", \"Search models by name\")\n .option(\"--provider <provider>\", \"Filter by provider\")\n .option(\"--page <number>\", \"Page number\", parseInt)\n .option(\"--limit <number>\", \"Items per page\", parseInt)\n .addHelpText(\"after\", `\nExamples:\n $ nebulaos llm catalog List all available models\n $ nebulaos llm catalog --search gpt-4 Search for GPT-4 models\n $ nebulaos llm catalog --provider openai Show only OpenAI models\n $ nebulaos llm catalog --provider anthropic -o json Output Anthropic models as JSON\n`)\n .action(async (options, command) => {\n try {\n const globalOpts = command.optsWithGlobals();\n const format = resolveFormat(globalOpts.output);\n const api = getApiClient();\n\n const params: Record<string, string> = {};\n if (options.search) params.q = options.search;\n if (options.provider) params.provider = options.provider;\n if (options.page) params.page = String(options.page);\n if (options.limit) params.limit = String(options.limit);\n\n const { data } = await api.get<CatalogPage>(\"/llm-gateway/catalog\", { params });\n\n if (format === \"table\") {\n output(format, {\n table: {\n headers: [\"Model\", \"Provider\", \"Modality\", \"Input Price\", \"Output Price\", \"Status\"],\n rows: data.items.map((m) => [\n m.model,\n m.provider,\n m.modality,\n m.priceInput != null ? `$${m.priceInput}` : \"-\",\n m.priceOutput != null ? `$${m.priceOutput}` : \"-\",\n m.status,\n ]),\n },\n data: data.items,\n ids: data.items.map((m) => m.model),\n });\n console.log(`\\nPage ${data.page} of ${Math.ceil(data.total / data.limit)} (${data.total} total models)`);\n } else {\n output(format, {\n table: { headers: [], rows: [] },\n data,\n ids: data.items.map((m) => m.model),\n });\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { execSync, spawnSync } from \"child_process\";\nimport { existsSync, cpSync, readFileSync, writeFileSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { CLIError, ExitCode, handleError } from \"../../lib/errors.js\";\n\nconst TEMPLATE_REPO = \"nebulaos/template\";\nconst TEMPLATE_REPO_URL = `https://github.com/${TEMPLATE_REPO}`;\n\nexport function createInitCommand(): Command {\n const cmd = new Command(\"init\")\n .description(\"Create a new NebulaOS project from template\")\n .argument(\"<name>\", \"Project name (will create a directory with this name)\")\n .option(\"-t, --template <template>\", \"Template to use\", \"default\")\n .option(\"--from <path>\", \"Use local template path instead of remote\")\n .option(\"--skip-install\", \"Skip installing dependencies\")\n .addHelpText(\n \"after\",\n `\nExamples:\n $ nebulaos init my-project Create a new project\n $ nebulaos init my-project --skip-install Create without installing deps\n\nAfter creating your project:\n $ cd my-project\n $ cp .env.example .env\n $ # Edit .env with your API keys\n $ pnpm dev\n`,\n )\n .action(async (name, options) => {\n try {\n const targetDir = resolve(process.cwd(), name);\n\n // Check if directory exists\n if (existsSync(targetDir)) {\n throw new CLIError(\n `Directory '${name}' already exists. Choose a different name or delete the existing directory.`,\n ExitCode.ConflictError,\n );\n }\n\n console.log();\n console.log(chalk.bold(\"Creating NebulaOS project...\"));\n console.log();\n\n // Clone template\n const spinner = ora(options.from ? \"Copying template...\" : \"Downloading template...\").start();\n\n try {\n if (options.from) {\n // Copy from local path\n const sourcePath = resolve(process.cwd(), options.from);\n if (!existsSync(sourcePath)) {\n throw new Error(`Template path not found: ${sourcePath}`);\n }\n cpSync(sourcePath, targetDir, { recursive: true });\n // Remove .git if exists\n const gitDir = join(targetDir, \".git\");\n if (existsSync(gitDir)) {\n execSync(`rm -rf \"${gitDir}\"`, { stdio: \"pipe\" });\n }\n } else {\n // Use npx degit to clone without git history\n execSync(`npx degit ${TEMPLATE_REPO} ${name}`, {\n stdio: \"pipe\",\n cwd: process.cwd(),\n });\n }\n spinner.succeed(options.from ? \"Template copied\" : \"Template downloaded\");\n } catch (error) {\n spinner.fail(options.from ? \"Failed to copy template\" : \"Failed to download template\");\n if (options.from) {\n throw new CLIError(\n `Failed to copy template from ${options.from}. Make sure the path exists.`,\n ExitCode.NotFound,\n );\n }\n throw new CLIError(\n `Failed to download template from ${TEMPLATE_REPO}. Make sure you have internet access.`,\n ExitCode.NetworkError,\n );\n }\n\n // Update package.json with project name\n const packageJsonPath = join(targetDir, \"package.json\");\n if (existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n packageJson.name = name;\n writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + \"\\n\");\n }\n\n // Install dependencies\n if (!options.skipInstall) {\n const installSpinner = ora(\"Installing dependencies...\").start();\n try {\n // Detect package manager\n const usesPnpm = existsSync(join(targetDir, \"pnpm-lock.yaml\"));\n const usesYarn = existsSync(join(targetDir, \"yarn.lock\"));\n const pm = usesPnpm ? \"pnpm\" : usesYarn ? \"yarn\" : \"npm\";\n\n execSync(`${pm} install`, {\n stdio: \"pipe\",\n cwd: targetDir,\n });\n installSpinner.succeed(\"Dependencies installed\");\n } catch {\n installSpinner.warn(\"Failed to install dependencies. Run 'pnpm install' manually.\");\n }\n }\n\n // Success message\n console.log();\n console.log(chalk.green(\"✓ Project created successfully!\"));\n console.log();\n console.log(\"Next steps:\");\n console.log();\n console.log(chalk.cyan(` cd ${name}`));\n console.log(chalk.cyan(\" cp .env.example .env\"));\n console.log(chalk.dim(\" # Edit .env with your API keys\"));\n console.log(chalk.cyan(\" pnpm dev\"));\n console.log();\n console.log(\"Get your API keys:\");\n console.log(chalk.dim(\" nebulaos clients api-keys create <client-id>\"));\n console.log(chalk.dim(\" nebulaos llm keys create --name my-key --type personal\"));\n console.log();\n console.log(\"Documentation:\");\n console.log(chalk.dim(\" https://docs.nebulaos.dev\"));\n console.log();\n } catch (error) {\n handleError(error);\n }\n });\n\n return cmd;\n}\n","import chalk from \"chalk\";\n\nexport interface PaginationMeta {\n page: number;\n pageSize: number;\n total: number;\n totalPages: number;\n}\n\nexport function printPaginationInfo(meta: PaginationMeta): void {\n if (meta.totalPages <= 1) return;\n\n console.log(\n chalk.dim(\n `\\nPage ${meta.page}/${meta.totalPages} (${meta.total} total). ` +\n `Use --page and --page-size to navigate.`,\n ),\n );\n}\n\nexport function buildPaginationParams(options: {\n page?: number;\n pageSize?: number;\n}): Record<string, number> {\n const params: Record<string, number> = {};\n\n if (options.page) params.page = options.page;\n if (options.pageSize) params.pageSize = options.pageSize;\n\n return params;\n}\n","const DEFAULT_LIMITS: Record<string, number> = {\n id: 36,\n name: 30,\n description: 50,\n url: 60,\n status: 15,\n date: 20,\n default: 40,\n};\n\nexport function truncate(\n text: string | null | undefined,\n maxLength?: number,\n type?: string,\n): string {\n if (!text) return \"-\";\n\n const limit = maxLength ?? DEFAULT_LIMITS[type ?? \"default\"] ?? DEFAULT_LIMITS.default;\n\n if (text.length <= limit) return text;\n\n return text.slice(0, limit - 3) + \"...\";\n}\n\nexport function truncateId(id: string): string {\n if (!id) return \"-\";\n if (id.length <= 8) return id;\n return id.slice(0, 8) + \"...\";\n}\n\nexport function formatDate(date: string | null | undefined): string {\n if (!date) return \"-\";\n\n const d = new Date(date);\n return d.toLocaleDateString(\"en-US\", {\n year: \"numeric\",\n month: \"short\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n}\n","import { getCurrentContext, type ContextConfig } from \"./config.js\";\nimport { AuthenticationError } from \"./errors.js\";\n\nexport function withAuth<T>(fn: (context: ContextConfig) => Promise<T>): () => Promise<T> {\n return async () => {\n const context = getCurrentContext();\n\n if (!context.token) {\n throw new AuthenticationError();\n }\n\n return fn(context);\n };\n}\n\nexport function requireAuth(): ContextConfig {\n const context = getCurrentContext();\n\n if (!context.token) {\n throw new AuthenticationError();\n }\n\n return context;\n}\n"],"mappings":";AAAA,SAAS,WAAAA,iBAAe;;;ACAxB,SAAuB,cAAc;AAE9B,SAAS,eAAe,SAA2B;AACxD,UACG;AAAA,IACC,IAAI,OAAO,yBAAyB,eAAe,EAChD,QAAQ,CAAC,SAAS,QAAQ,QAAQ,OAAO,CAAC,EAC1C,IAAI,iBAAiB;AAAA,EAC1B,EACC;AAAA,IACC,IAAI,OAAO,oBAAoB,wBAAwB,EACpD,IAAI,kBAAkB;AAAA,EAC3B,EACC;AAAA,IACC,IAAI,OAAO,mBAAmB,kBAAkB,EAC7C,IAAI,kBAAkB;AAAA,EAC3B,EACC;AAAA,IACC,IAAI,OAAO,mBAAmB,+BAA+B,EAC1D,IAAI,gBAAgB;AAAA,EACzB,EACC;AAAA,IACC,IAAI,OAAO,iBAAiB,0BAA0B,EACnD,IAAI,iBAAiB;AAAA,EAC1B,EACC;AAAA,IACC,IAAI,OAAO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I;AAAA,EACJ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AACX;AAEO,SAASC,UACd,MACA,WACA,MACQ;AACR,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,QAAQ,aAAa,eAAe,QAAQ,SAAS,KAAK,eAAe;AAE/E,MAAI,KAAK,UAAU,MAAO,QAAO;AAEjC,SAAO,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI;AACpC;AAEO,SAAS,WAAW,IAAoB;AAC7C,MAAI,CAAC,GAAI,QAAO;AAChB,MAAI,GAAG,UAAU,EAAG,QAAO;AAC3B,SAAO,GAAG,MAAM,GAAG,CAAC,IAAI;AAC1B;AAEO,SAAS,WAAW,MAAyC;AAClE,MAAI,CAAC,KAAM,QAAO;AAElB,QAAM,IAAI,IAAI,KAAK,IAAI;AACvB,SAAO,EAAE,mBAAmB,SAAS;AAAA,IACnC,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,CAAC;AACH;;;ACtCO,SAAS,SAAY,IAA8D;AACxF,SAAO,YAAY;AACjB,UAAM,UAAU,kBAAkB;AAElC,QAAI,CAAC,QAAQ,OAAO;AAClB,YAAM,IAAI,oBAAoB;AAAA,IAChC;AAEA,WAAO,GAAG,OAAO;AAAA,EACnB;AACF;AAEO,SAAS,cAA6B;AAC3C,QAAM,UAAU,kBAAkB;AAElC,MAAI,CAAC,QAAQ,OAAO;AAClB,UAAM,IAAI,oBAAoB;AAAA,EAChC;AAEA,SAAO;AACT;","names":["Command","ExitCode","Command","Command","chalk","Command","config","chalk","Command","chalk","chalk","chalk","Command","config","chalk","Command","Command","Command","axios","axios","config","Command","Command","chalk","Command","chalk","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","chalk","Command","client","chalk","Command","chalk","Command","client","chalk","Command","Command","Command","Command","chalk","Command","chalk","Command","confirm","Command","confirm","Command","Command","Command","Command","Option","Command","Option","Command","chalk","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","Command","input","Command","Option","Command","Option","Command","chalk","Command","Command","chalk","Command","Command","Command","Command","Command","Command","Command","chalk","Command","Command","Command","Command","Command","Command","confirm","Command","confirm","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","Command","config","Command","Command","Command","chalk","Command","config","chalk","config","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","Command","input","Command","input","Command","Command","collectKeyValue","Command","confirm","Command","confirm","Command","Command","Command","Command","Command","input","chalk","Command","input","chalk","Command","confirm","Command","confirm","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","ora","Command","chalk","ora","Command","chalk","truncate"]}
|