@fabricorg/cli 0.1.0 → 0.2.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/bin/fabric.ts","../src/commands/agents/index.ts","../src/lib/client.ts","../src/lib/config.ts","../src/lib/output.ts","../src/lib/context.ts","../src/commands/auth/keys.ts","../src/commands/auth/login.ts","../src/commands/auth/logout.ts","../src/commands/auth/whoami.ts","../src/commands/chats/index.ts","../src/commands/completion/index.ts","../src/commands/ctx/index.ts","../src/commands/features/index.ts","../src/commands/frames/index.ts","../src/commands/mcp/index.ts","../src/commands/orgs/index.ts","../src/commands/projects/index.ts","../src/commands/prompts/index.ts","../src/commands/reports/index.ts","../src/commands/skills/index.ts","../src/commands/workflows/index.ts","../src/commands/workspaces/index.ts"],"sourcesContent":["/**\n * @fabricorg/cli — fabric command\n *\n * Usage: fabric <command> [subcommand] [options]\n *\n * Exit codes:\n * 0 success\n * 1 general failure\n * 2 invalid usage / bad arguments\n * 3 auth failure\n * 4 not found\n * 5 forbidden\n * 6 rate limited\n * 7 validation error\n */\n\nimport { Command } from \"commander\";\nimport { buildAgentsCommand } from \"../commands/agents/index.js\";\nimport { buildKeysCommand } from \"../commands/auth/keys.js\";\nimport { buildLoginCommand } from \"../commands/auth/login.js\";\nimport { buildLogoutCommand } from \"../commands/auth/logout.js\";\nimport { buildWhoamiCommand } from \"../commands/auth/whoami.js\";\nimport { buildChatsCommand } from \"../commands/chats/index.js\";\nimport { buildCompletionCommand } from \"../commands/completion/index.js\";\nimport { buildCtxCommand } from \"../commands/ctx/index.js\";\nimport { buildFeaturesCommand } from \"../commands/features/index.js\";\nimport { buildFramesCommand } from \"../commands/frames/index.js\";\nimport { buildMcpCommand } from \"../commands/mcp/index.js\";\nimport { buildOrgsCommand } from \"../commands/orgs/index.js\";\nimport { buildProjectsCommand } from \"../commands/projects/index.js\";\nimport { buildPromptsCommand } from \"../commands/prompts/index.js\";\nimport { buildReportsCommand } from \"../commands/reports/index.js\";\nimport { buildSkillsCommand } from \"../commands/skills/index.js\";\nimport { buildWorkflowsCommand } from \"../commands/workflows/index.js\";\nimport { buildWorkspacesCommand } from \"../commands/workspaces/index.js\";\nimport { getConfigPath } from \"../lib/config.js\";\n\nconst program = new Command();\n\nprogram\n\t.name(\"fabric\")\n\t.description(\"Fabric AI platform CLI\")\n\t.version(\"0.1.0\")\n\t.option(\n\t\t\"--format <format>\",\n\t\t\"Output format: table|json|yaml|csv\",\n\t\tprocess.env.FABRIC_FORMAT ?? \"table\",\n\t);\n\n// ---------------------------------------------------------------------------\n// fabric auth\n// ---------------------------------------------------------------------------\nconst auth = new Command(\"auth\").description(\n\t\"Authenticate and manage API keys\",\n);\nauth.addCommand(buildLoginCommand());\nauth.addCommand(buildLogoutCommand());\nauth.addCommand(buildWhoamiCommand());\nauth.addCommand(buildKeysCommand());\nprogram.addCommand(auth);\n\n// ---------------------------------------------------------------------------\n// fabric ctx\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildCtxCommand());\n\n// ---------------------------------------------------------------------------\n// fabric orgs\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildOrgsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric projects\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildProjectsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric features\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildFeaturesCommand());\n\n// ---------------------------------------------------------------------------\n// fabric workflows\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildWorkflowsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric prompts\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildPromptsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric agents\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildAgentsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric skills\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildSkillsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric mcp\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildMcpCommand());\n\n// ---------------------------------------------------------------------------\n// fabric frames\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildFramesCommand());\n\n// ---------------------------------------------------------------------------\n// fabric workspaces\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildWorkspacesCommand());\n\n// ---------------------------------------------------------------------------\n// fabric chats\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildChatsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric reports\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildReportsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric completion\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildCompletionCommand());\n\n// ---------------------------------------------------------------------------\n// fabric config\n// ---------------------------------------------------------------------------\nconst config = new Command(\"config\").description(\"Show CLI configuration\");\nconfig\n\t.command(\"path\")\n\t.description(\"Print the path to the config file\")\n\t.action(() => {\n\t\tprocess.stdout.write(`${getConfigPath()}\\n`);\n\t});\nprogram.addCommand(config);\n\n// ---------------------------------------------------------------------------\n// Global error handler — structured JSON for --format json\n// ---------------------------------------------------------------------------\nprocess.on(\"unhandledRejection\", (reason) => {\n\tconst message = reason instanceof Error ? reason.message : String(reason);\n\tif (process.env.FABRIC_FORMAT === \"json\") {\n\t\tprocess.stderr.write(\n\t\t\tJSON.stringify({ error: { message, code: \"UNHANDLED_ERROR\" } }) +\n\t\t\t\t\"\\n\",\n\t\t);\n\t} else {\n\t\tprocess.stderr.write(`✗ ${message}\\n`);\n\t}\n\tprocess.exit(1);\n});\n\nprogram.parse(process.argv);\n","/**\n * fabric agents\n *\n * fabric agents list List agents\n * fabric agents show <id> Show agent details\n */\n\nimport type { FabricAgent } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildAgentsCommand(): Command {\n\tconst agents = new Command(\"agents\").description(\"Manage agents\");\n\n\t// -- list ----------------------------------------------------------------\n\tagents\n\t\t.command(\"list\")\n\t\t.description(\"List agents\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--status <status>\", \"Filter: ACTIVE|INACTIVE|DEPRECATED\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tstatus?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricAgent[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.agents.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| FabricAgent[\"status\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const a of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${a.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"displayName\",\n\t\t\t\t\t\t\"framework\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"createdAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tagents\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show agent details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet agent: FabricAgent;\n\t\t\t\ttry {\n\t\t\t\t\tagent = await client.agents.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(agent, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: agent.id,\n\t\t\t\t\t\"Agent ID\": agent.agentId,\n\t\t\t\t\tName: agent.name,\n\t\t\t\t\t\"Display name\": agent.displayName,\n\t\t\t\t\tFramework: agent.framework,\n\t\t\t\t\tStatus: agent.status,\n\t\t\t\t\t\"Deployment URL\": agent.deploymentUrl ?? \"(none)\",\n\t\t\t\t\tCreated: agent.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- execute -------------------------------------------------------------\n\tagents\n\t\t.command(\"execute <id>\")\n\t\t.description(\"Execute an agent\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--input <json>\", 'Input JSON (e.g. \\'{\"key\":\"value\"}\\')')\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tinput?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\n\t\t\t\tlet inputObj: Record<string, unknown> = {};\n\t\t\t\tif (opts.input) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputObj = JSON.parse(opts.input);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tprintError(\"--input must be valid JSON\", 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet result: import(\"@fabricorg/sdk\").FabricAgentExecution;\n\t\t\t\ttry {\n\t\t\t\t\tresult = await client.agents.execute(id, {\n\t\t\t\t\t\tinput: inputObj,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(result, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\t\"Task ID\": result.taskId,\n\t\t\t\t\t\"Workflow ID\": result.workflowId,\n\t\t\t\t\t\"Run ID\": result.runId ?? \"(pending)\",\n\t\t\t\t\tStatus: result.status,\n\t\t\t\t\t...(result.warning ? { Warning: result.warning } : {}),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn agents;\n}\n","/**\n * Returns a configured FabricClient for CLI commands.\n * Exits with a clear error if no API key is available.\n */\n\nimport { FabricAuthError, FabricClient } from \"@fabricorg/sdk\";\nimport { getApiKey, getBaseUrl } from \"./config.js\";\nimport { printError } from \"./output.js\";\n\nexport function getClient(): FabricClient {\n\tconst apiKey = getApiKey();\n\n\tif (!apiKey) {\n\t\tprintError(\n\t\t\t\"Not authenticated. Run:\\n fabric auth login --key <api-key>\",\n\t\t\t3,\n\t\t);\n\t}\n\n\ttry {\n\t\treturn new FabricClient({ apiKey, baseUrl: getBaseUrl() });\n\t} catch (err: unknown) {\n\t\tif (err instanceof FabricAuthError) {\n\t\t\tprintError(err.message, 3);\n\t\t}\n\t\tthrow err;\n\t}\n}\n","/**\n * Config storage for @fabricorg/cli\n *\n * Persists to XDG_CONFIG_HOME/fabricai/config.json (Linux/macOS)\n * or %APPDATA%\\fabricai\\config.json (Windows).\n *\n * The API key is stored as-is in the config file with 0600 permissions.\n * Future: migrate to system keychain.\n */\n\nimport Conf from \"conf\";\n\nexport interface CliConfig {\n\t/** Active profile name */\n\tactiveProfile: string;\n\tprofiles: Record<string, ProfileConfig>;\n\t/** Default output format */\n\tdefaultFormat: \"table\" | \"json\" | \"yaml\" | \"csv\";\n}\n\nexport interface ProfileConfig {\n\t/** API key for this profile */\n\tapiKey?: string;\n\t/** Override base URL (e.g. for self-hosted) */\n\tbaseUrl?: string;\n\t/** Default context for commands */\n\tdefaultContext?: ContextConfig;\n}\n\nexport type ContextConfig =\n\t| { type: \"personal\" }\n\t| { type: \"org\"; slug: string };\n\nconst DEFAULTS: CliConfig = {\n\tactiveProfile: \"default\",\n\tprofiles: {},\n\tdefaultFormat: \"table\",\n};\n\nlet _store: Conf<CliConfig> | undefined;\n\nfunction getStore(): Conf<CliConfig> {\n\tif (!_store) {\n\t\t_store = new Conf<CliConfig>({\n\t\t\tprojectName: \"fabricai\",\n\t\t\tdefaults: DEFAULTS,\n\t\t});\n\t}\n\treturn _store;\n}\n\nexport function getConfig(): CliConfig {\n\treturn getStore().store;\n}\n\nexport function getActiveProfile(): ProfileConfig {\n\tconst cfg = getConfig();\n\treturn cfg.profiles[cfg.activeProfile] ?? {};\n}\n\nexport function getApiKey(): string | undefined {\n\t// Env var takes precedence over stored config\n\tif (process.env.FABRIC_API_KEY) {\n\t\treturn process.env.FABRIC_API_KEY;\n\t}\n\treturn getActiveProfile().apiKey;\n}\n\nexport function getBaseUrl(): string | undefined {\n\tif (process.env.FABRIC_BASE_URL) {\n\t\treturn process.env.FABRIC_BASE_URL;\n\t}\n\treturn getActiveProfile().baseUrl;\n}\n\nexport function getDefaultContext(): ContextConfig | undefined {\n\t// Env var takes precedence\n\tif (process.env.FABRIC_ORG) {\n\t\treturn { type: \"org\", slug: process.env.FABRIC_ORG };\n\t}\n\tif (process.env.FABRIC_PERSONAL === \"1\") {\n\t\treturn { type: \"personal\" };\n\t}\n\treturn getActiveProfile().defaultContext;\n}\n\nexport function getOutputFormat(): \"table\" | \"json\" | \"yaml\" | \"csv\" {\n\tif (\n\t\tprocess.env.FABRIC_FORMAT === \"json\" ||\n\t\tprocess.env.FABRIC_FORMAT === \"yaml\" ||\n\t\tprocess.env.FABRIC_FORMAT === \"csv\"\n\t) {\n\t\treturn process.env.FABRIC_FORMAT as \"json\" | \"yaml\" | \"csv\";\n\t}\n\treturn getConfig().defaultFormat;\n}\n\nexport function saveApiKey(apiKey: string, profile = \"default\"): void {\n\tconst store = getStore();\n\tconst profiles = store.get(\"profiles\") as CliConfig[\"profiles\"];\n\tstore.set(\"profiles\", {\n\t\t...profiles,\n\t\t[profile]: { ...(profiles[profile] ?? {}), apiKey },\n\t});\n\tstore.set(\"activeProfile\", profile);\n}\n\nexport function clearApiKey(profile = \"default\"): void {\n\tconst store = getStore();\n\tconst profiles = store.get(\"profiles\") as CliConfig[\"profiles\"];\n\tconst { apiKey: _, ...rest } = profiles[profile] ?? {};\n\tstore.set(\"profiles\", { ...profiles, [profile]: rest });\n}\n\nexport function saveDefaultContext(ctx: ContextConfig, profile?: string): void {\n\tconst store = getStore();\n\tconst active = profile ?? (store.get(\"activeProfile\") as string);\n\tconst profiles = store.get(\"profiles\") as CliConfig[\"profiles\"];\n\tstore.set(\"profiles\", {\n\t\t...profiles,\n\t\t[active]: { ...(profiles[active] ?? {}), defaultContext: ctx },\n\t});\n}\n\nexport function getConfigPath(): string {\n\treturn getStore().path;\n}\n","/**\n * Output formatting for @fabricorg/cli\n *\n * Supports: table (default), json, yaml, csv, quiet (IDs only)\n */\n\nimport Table from \"cli-table3\";\nimport { getOutputFormat } from \"./config.js\";\n\nexport type OutputFormat = \"table\" | \"json\" | \"yaml\" | \"csv\" | \"quiet\";\n\nexport interface OutputOptions {\n\tformat?: OutputFormat;\n\t/** Column names to include in table/csv output (in order) */\n\tcolumns?: string[];\n\t/** Key to use for --quiet / IDs-only output */\n\tidKey?: string;\n}\n\n/** Print data to stdout in the selected format. */\nexport function printOutput(data: unknown, opts: OutputOptions = {}): void {\n\tconst format = opts.format ?? (getOutputFormat() as OutputFormat);\n\n\tif (format === \"json\") {\n\t\tprocess.stdout.write(`${JSON.stringify(data, null, 2)}\\n`);\n\t\treturn;\n\t}\n\n\tif (format === \"yaml\") {\n\t\tprocess.stdout.write(`${toYaml(data)}\\n`);\n\t\treturn;\n\t}\n\n\tif (format === \"quiet\") {\n\t\tconst rows = Array.isArray(data) ? data : [data];\n\t\tconst key = opts.idKey ?? \"id\";\n\t\tfor (const row of rows) {\n\t\t\tconst val = (row as Record<string, unknown>)[key];\n\t\t\tif (val !== undefined) {\n\t\t\t\tprocess.stdout.write(`${String(val)}\\n`);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tif (format === \"csv\") {\n\t\tconst rows = Array.isArray(data) ? data : [data];\n\t\tif (rows.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst cols = opts.columns ?? Object.keys(rows[0] as object);\n\t\tprocess.stdout.write(`${cols.map(csvEscape).join(\",\")}\\n`);\n\t\tfor (const row of rows) {\n\t\t\tprocess.stdout.write(\n\t\t\t\t`${cols\n\t\t\t\t\t.map((c) =>\n\t\t\t\t\t\tcsvEscape(\n\t\t\t\t\t\t\tString((row as Record<string, unknown>)[c] ?? \"\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\t.join(\",\")}\\n`,\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\t// Default: table\n\tconst rows = Array.isArray(data) ? data : [data];\n\tif (rows.length === 0) {\n\t\tprocess.stdout.write(\"(no results)\\n\");\n\t\treturn;\n\t}\n\tconst cols = opts.columns ?? Object.keys(rows[0] as object);\n\tconst table = new Table({ head: cols, style: { head: [\"cyan\"] } });\n\tfor (const row of rows) {\n\t\ttable.push(\n\t\t\tcols.map((c) => formatCell((row as Record<string, unknown>)[c])),\n\t\t);\n\t}\n\tprocess.stdout.write(`${table.toString()}\\n`);\n}\n\n/** Print a single key-value object as aligned pairs */\nexport function printRecord(\n\tdata: Record<string, unknown>,\n\topts: OutputOptions = {},\n): void {\n\tconst format = opts.format ?? (getOutputFormat() as OutputFormat);\n\tif (format === \"json\") {\n\t\tprintOutput(data, opts);\n\t\treturn;\n\t}\n\tif (format === \"yaml\") {\n\t\tprintOutput(data, opts);\n\t\treturn;\n\t}\n\tconst table = new Table({ style: { head: [\"cyan\"] } });\n\tfor (const [key, val] of Object.entries(data)) {\n\t\ttable.push({ [key]: formatCell(val) });\n\t}\n\tprocess.stdout.write(`${table.toString()}\\n`);\n}\n\n/** Print a success message to stdout */\nexport function printSuccess(message: string): void {\n\tprocess.stdout.write(`✓ ${message}\\n`);\n}\n\n/** Print an error message to stderr and exit with given code */\nexport function printError(message: string, exitCode = 1): never {\n\tprocess.stderr.write(`✗ ${message}\\n`);\n\tprocess.exit(exitCode);\n}\n\n/** Print a warning to stderr (no exit) */\nexport function printWarning(message: string): void {\n\tprocess.stderr.write(`⚠ ${message}\\n`);\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction formatCell(val: unknown): string {\n\tif (val === null || val === undefined) {\n\t\treturn \"\";\n\t}\n\tif (typeof val === \"boolean\") {\n\t\treturn val ? \"yes\" : \"no\";\n\t}\n\tif (typeof val === \"object\") {\n\t\treturn JSON.stringify(val);\n\t}\n\tconst s = String(val);\n\t// Truncate ISO dates to just the date portion for readability in tables\n\tif (/^\\d{4}-\\d{2}-\\d{2}T/.test(s)) {\n\t\treturn s.slice(0, 10);\n\t}\n\treturn s;\n}\n\nfunction csvEscape(s: string): string {\n\tif (s.includes(\",\") || s.includes('\"') || s.includes(\"\\n\")) {\n\t\treturn `\"${s.replace(/\"/g, '\"\"')}\"`;\n\t}\n\treturn s;\n}\n\n/** Minimal YAML serializer (no dependencies) */\nfunction toYaml(val: unknown, indent = 0): string {\n\tconst pad = \" \".repeat(indent);\n\tif (val === null || val === undefined) {\n\t\treturn \"~\";\n\t}\n\tif (typeof val === \"boolean\" || typeof val === \"number\") {\n\t\treturn String(val);\n\t}\n\tif (typeof val === \"string\") {\n\t\tif (val.includes(\"\\n\") || val.includes(\":\") || val.includes('\"')) {\n\t\t\treturn `\"${val.replace(/\"/g, '\\\\\"')}\"`;\n\t\t}\n\t\treturn val;\n\t}\n\tif (Array.isArray(val)) {\n\t\tif (val.length === 0) {\n\t\t\treturn \"[]\";\n\t\t}\n\t\treturn val\n\t\t\t.map((item) => `${pad}- ${toYaml(item, indent + 1)}`)\n\t\t\t.join(\"\\n\");\n\t}\n\tif (typeof val === \"object\") {\n\t\tconst entries = Object.entries(val as Record<string, unknown>);\n\t\tif (entries.length === 0) {\n\t\t\treturn \"{}\";\n\t\t}\n\t\treturn entries\n\t\t\t.map(([k, v]) => {\n\t\t\t\tconst valStr = toYaml(v, indent + 1);\n\t\t\t\tconst isMultiline = valStr.includes(\"\\n\");\n\t\t\t\treturn isMultiline\n\t\t\t\t\t? `${pad}${k}:\\n${valStr}`\n\t\t\t\t\t: `${pad}${k}: ${valStr}`;\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t}\n\treturn String(val);\n}\n","/**\n * Context resolution for @fabricorg/cli\n *\n * Every resource command must resolve an explicit tenant context\n * (personal or org) before making API calls. Ambiguity is an error.\n */\n\nimport type { ContextConfig } from \"./config.js\";\nimport { getDefaultContext } from \"./config.js\";\nimport { printError } from \"./output.js\";\n\nexport interface ResolvedContext {\n\ttype: \"personal\" | \"org\";\n\tslug?: string;\n}\n\n/**\n * Resolves tenant context from CLI flags, env vars, or stored default.\n * Exits with code 2 if context is ambiguous (neither set nor stored).\n *\n * @param personal - value of --personal flag\n * @param org - value of --org flag\n * @param required - if false, returns undefined when context is unset (for auth commands)\n */\nexport function resolveContext(\n\tpersonal: boolean | undefined,\n\torg: string | undefined,\n\trequired = true,\n): ResolvedContext | undefined {\n\tif (personal && org) {\n\t\tprintError(\"Cannot use --personal and --org together\", 2);\n\t}\n\n\tif (personal) {\n\t\treturn { type: \"personal\" };\n\t}\n\tif (org) {\n\t\treturn { type: \"org\", slug: org };\n\t}\n\n\t// Fall back to stored default\n\tconst stored: ContextConfig | undefined = getDefaultContext();\n\tif (stored) {\n\t\tif (stored.type === \"personal\") {\n\t\t\treturn { type: \"personal\" };\n\t\t}\n\t\tif (stored.type === \"org\") {\n\t\t\treturn { type: \"org\", slug: stored.slug };\n\t\t}\n\t}\n\n\tif (required) {\n\t\tprintError(\n\t\t\t\"Context is required. Use --personal, --org <slug>, or set a default with:\\n fabric ctx use personal\\n fabric ctx use org <slug>\",\n\t\t\t2,\n\t\t);\n\t}\n\n\treturn undefined;\n}\n\n/** Returns a human-readable label for the current context */\nexport function contextLabel(ctx: ResolvedContext): string {\n\treturn ctx.type === \"personal\" ? \"personal\" : `org:${ctx.slug}`;\n}\n","/**\n * fabric auth keys\n *\n * fabric auth keys list\n * fabric auth keys create --name \"CI deploy\" --scopes workflows:run,agents:read\n * fabric auth keys revoke <id>\n */\n\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { printError, printOutput, printSuccess } from \"../../lib/output.js\";\n\nexport function buildKeysCommand(): Command {\n\tconst keys = new Command(\"keys\").description(\"Manage API keys\");\n\n\t// -- list ----------------------------------------------------------------\n\tkeys.command(\"list\")\n\t\t.description(\"List your API keys\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.action(async (opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet list: Awaited<ReturnType<typeof client.auth.listKeys>>;\n\t\t\ttry {\n\t\t\t\tlist = await client.auth.listKeys();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\t\t\tprintOutput(list, {\n\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\tcolumns: [\n\t\t\t\t\t\"id\",\n\t\t\t\t\t\"name\",\n\t\t\t\t\t\"keyPrefix\",\n\t\t\t\t\t\"scopes\",\n\t\t\t\t\t\"lastUsedAt\",\n\t\t\t\t\t\"expiresAt\",\n\t\t\t\t\t\"createdAt\",\n\t\t\t\t],\n\t\t\t});\n\t\t});\n\n\t// -- create --------------------------------------------------------------\n\tkeys.command(\"create\")\n\t\t.description(\"Create a new API key (raw key shown only once)\")\n\t\t.requiredOption(\"-n, --name <name>\", \"Key name\")\n\t\t.option(\n\t\t\t\"-s, --scopes <scopes>\",\n\t\t\t\"Comma-separated scopes (e.g. projects:read,workflows:run)\",\n\t\t\t\"orgs:read\",\n\t\t)\n\t\t.option(\n\t\t\t\"-e, --expires <days>\",\n\t\t\t\"Days until expiry (1–365, omit for no expiry)\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\tname: string;\n\t\t\t\tscopes: string;\n\t\t\t\texpires?: string;\n\t\t\t\tformat: string;\n\t\t\t}) => {\n\t\t\t\tconst client = getClient();\n\t\t\t\tconst scopes = opts.scopes.split(\",\").map((s) => s.trim());\n\t\t\t\tconst expiresInDays = opts.expires\n\t\t\t\t\t? Number.parseInt(opts.expires, 10)\n\t\t\t\t\t: undefined;\n\n\t\t\t\tif (\n\t\t\t\t\texpiresInDays !== undefined &&\n\t\t\t\t\tNumber.isNaN(expiresInDays)\n\t\t\t\t) {\n\t\t\t\t\tprintError(\"--expires must be a number\", 2);\n\t\t\t\t}\n\n\t\t\t\tlet created: Awaited<ReturnType<typeof client.auth.createKey>>;\n\t\t\t\ttry {\n\t\t\t\t\tcreated = await client.auth.createKey({\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tscopes,\n\t\t\t\t\t\texpiresInDays,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(created, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprocess.stdout.write(\"\\n\");\n\t\t\t\tprintSuccess(`API key created: ${created.name}`);\n\t\t\t\tprocess.stdout.write(`\\n Key: ${created.rawKey}\\n`);\n\t\t\t\tprocess.stdout.write(` Prefix: ${created.keyPrefix}\\n`);\n\t\t\t\tprocess.stdout.write(\n\t\t\t\t\t` Scopes: ${created.scopes.join(\", \")}\\n`,\n\t\t\t\t);\n\t\t\t\tif (created.expiresAt) {\n\t\t\t\t\tprocess.stdout.write(\n\t\t\t\t\t\t` Expires: ${String(created.expiresAt).slice(0, 10)}\\n`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tprocess.stdout.write(\n\t\t\t\t\t\"\\n ⚠ Store this key now — it will never be shown again.\\n\\n\",\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\n\t// -- revoke --------------------------------------------------------------\n\tkeys.command(\"revoke <id>\")\n\t\t.description(\"Permanently revoke an API key\")\n\t\t.action(async (id: string) => {\n\t\t\tconst client = getClient();\n\t\t\ttry {\n\t\t\t\tawait client.auth.revokeKey(id);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\t\t\tprintSuccess(`API key ${id} revoked.`);\n\t\t});\n\n\treturn keys;\n}\n","/**\n * fabric auth login\n *\n * Stores an API key for subsequent commands.\n *\n * fabric auth login --key fab_...\n * fabric auth login (prompts interactively)\n */\n\nimport * as readline from \"node:readline\";\nimport { FabricClient } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getBaseUrl, saveApiKey } from \"../../lib/config.js\";\nimport { printError, printSuccess } from \"../../lib/output.js\";\n\nasync function promptApiKey(): Promise<string> {\n\tconst rl = readline.createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stdout,\n\t});\n\n\treturn new Promise((resolve) => {\n\t\t// Don't echo the key\n\t\tprocess.stdout.write(\"Fabric API Key: \");\n\t\tprocess.stdin.resume();\n\t\tprocess.stdin.setEncoding(\"utf8\");\n\n\t\tlet key = \"\";\n\t\tprocess.stdin.once(\"data\", (chunk) => {\n\t\t\tkey = String(chunk).trim();\n\t\t\tprocess.stdout.write(\"\\n\");\n\t\t\trl.close();\n\t\t\tresolve(key);\n\t\t});\n\t});\n}\n\nexport function buildLoginCommand(): Command {\n\treturn new Command(\"login\")\n\t\t.description(\"Authenticate with a Fabric API key\")\n\t\t.option(\"-k, --key <api-key>\", \"API key (fab_... or org_...)\")\n\t\t.option(\"--base-url <url>\", \"Override the Fabric base URL\")\n\t\t.action(async (opts: { key?: string; baseUrl?: string }) => {\n\t\t\tlet apiKey = opts.key?.trim();\n\n\t\t\tif (!apiKey) {\n\t\t\t\tapiKey = await promptApiKey();\n\t\t\t}\n\n\t\t\tif (!apiKey) {\n\t\t\t\tprintError(\"API key is required\", 2);\n\t\t\t}\n\n\t\t\tif (!apiKey.startsWith(\"fab_\") && !apiKey.startsWith(\"org_\")) {\n\t\t\t\tprintError(\n\t\t\t\t\t\"Invalid API key format. Keys must start with fab_ or org_\",\n\t\t\t\t\t2,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Verify the key works before saving\n\t\t\tconst baseUrl = opts.baseUrl ?? getBaseUrl();\n\t\t\tconst client = new FabricClient({ apiKey, baseUrl });\n\n\t\t\tlet name: string;\n\t\t\tlet email: string;\n\t\t\ttry {\n\t\t\t\tconst me = await client.auth.whoami();\n\t\t\t\tname = me.user.name ?? me.user.email;\n\t\t\t\temail = me.user.email;\n\t\t\t} catch {\n\t\t\t\tprintError(\n\t\t\t\t\t\"Authentication failed. Check that the key is valid and not expired.\",\n\t\t\t\t\t3,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsaveApiKey(apiKey);\n\t\t\tprintSuccess(`Authenticated as ${name} (${email})`);\n\t\t});\n}\n","/**\n * fabric auth logout\n * Removes the stored API key from config.\n */\n\nimport { Command } from \"commander\";\nimport { clearApiKey, getApiKey } from \"../../lib/config.js\";\nimport { printSuccess, printWarning } from \"../../lib/output.js\";\n\nexport function buildLogoutCommand(): Command {\n\treturn new Command(\"logout\")\n\t\t.description(\"Remove stored API key\")\n\t\t.action(() => {\n\t\t\tif (!getApiKey()) {\n\t\t\t\tprintWarning(\"No API key stored — already logged out.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tclearApiKey();\n\t\t\tprintSuccess(\"Logged out. API key removed.\");\n\t\t});\n}\n","/**\n * fabric auth whoami\n * Prints the authenticated identity and org memberships.\n */\n\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildWhoamiCommand(): Command {\n\treturn new Command(\"whoami\")\n\t\t.description(\"Show current authentication and identity\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(async (opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\n\t\t\tlet me: Awaited<ReturnType<typeof client.auth.whoami>>;\n\t\t\ttry {\n\t\t\t\tme = await client.auth.whoami();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message ?? \"Request failed\", 3);\n\t\t\t}\n\n\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\n\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\tprintOutput(me, { format: fmt });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Human-readable\n\t\t\tprintRecord({\n\t\t\t\tUser: me.user.name ?? \"(no name)\",\n\t\t\t\tEmail: me.user.email,\n\t\t\t\tRole: me.user.role,\n\t\t\t\t\"Key type\": me.keyType,\n\t\t\t\t\"Key prefix\": me.keyPrefix,\n\t\t\t\tScopes: me.scopes.join(\", \"),\n\t\t\t\t\"Orgs count\": String(me.orgs.length),\n\t\t\t\t\"Member since\": me.user.createdAt.slice(0, 10),\n\t\t\t});\n\n\t\t\tif (me.orgs.length > 0) {\n\t\t\t\tprocess.stdout.write(\"\\nOrganizations:\\n\");\n\t\t\t\tprintOutput(me.orgs, {\n\t\t\t\t\tformat: \"table\",\n\t\t\t\t\tcolumns: [\"name\", \"slug\", \"role\", \"joinedAt\"],\n\t\t\t\t});\n\t\t\t}\n\t\t});\n}\n","/**\n * fabric chats\n *\n * fabric chats list List AI chat sessions\n * fabric chats show <id> Show chat details\n */\n\nimport type { FabricChat } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildChatsCommand(): Command {\n\tconst chats = new Command(\"chats\").description(\"Manage AI chat sessions\");\n\n\tchats\n\t\t.command(\"list\")\n\t\t.description(\"List AI chat sessions\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricChat[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.chats.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const c of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${c.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"id\", \"title\", \"updatedAt\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\tchats\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show chat details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet chat: FabricChat;\n\t\t\t\ttry {\n\t\t\t\t\tchat = await client.chats.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(chat, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: chat.id,\n\t\t\t\t\tTitle: chat.title ?? \"(untitled)\",\n\t\t\t\t\tUpdated: chat.updatedAt.slice(0, 16).replace(\"T\", \" \"),\n\t\t\t\t\tCreated: chat.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn chats;\n}\n","/**\n * fabric completion\n *\n * fabric completion bash Output bash completion script\n * fabric completion zsh Output zsh completion script\n * fabric completion fish Output fish completion script\n */\n\nimport { Command } from \"commander\";\n\nconst BASH_COMPLETION = `\n# fabric bash completion\n_fabric_completion() {\n local cur prev words cword\n _init_completion || return\n\n local commands=\"auth ctx orgs projects features workflows prompts agents skills mcp frames workspaces chats reports config completion\"\n\n case \"$prev\" in\n fabric)\n COMPREPLY=($(compgen -W \"$commands\" -- \"$cur\"))\n return ;;\n auth)\n COMPREPLY=($(compgen -W \"login logout whoami keys\" -- \"$cur\"))\n return ;;\n keys)\n COMPREPLY=($(compgen -W \"list create revoke\" -- \"$cur\"))\n return ;;\n ctx)\n COMPREPLY=($(compgen -W \"current use\" -- \"$cur\"))\n return ;;\n orgs)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n projects)\n COMPREPLY=($(compgen -W \"list show create update\" -- \"$cur\"))\n return ;;\n features)\n COMPREPLY=($(compgen -W \"list show create update tasks\" -- \"$cur\"))\n return ;;\n workflows)\n COMPREPLY=($(compgen -W \"list show trigger status\" -- \"$cur\"))\n return ;;\n prompts)\n COMPREPLY=($(compgen -W \"list get create update\" -- \"$cur\"))\n return ;;\n agents)\n COMPREPLY=($(compgen -W \"list show execute\" -- \"$cur\"))\n return ;;\n skills)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n mcp)\n COMPREPLY=($(compgen -W \"servers configs\" -- \"$cur\"))\n return ;;\n configs)\n COMPREPLY=($(compgen -W \"list show delete\" -- \"$cur\"))\n return ;;\n frames)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n workspaces)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n chats)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n reports)\n COMPREPLY=($(compgen -W \"templates executions\" -- \"$cur\"))\n return ;;\n templates)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n executions)\n COMPREPLY=($(compgen -W \"list\" -- \"$cur\"))\n return ;;\n completion)\n COMPREPLY=($(compgen -W \"bash zsh fish\" -- \"$cur\"))\n return ;;\n esac\n\n COMPREPLY=($(compgen -W \"--format --org --personal --quiet --help\" -- \"$cur\"))\n}\n\ncomplete -F _fabric_completion fabric\n`.trim();\n\nconst ZSH_COMPLETION = `\n#compdef fabric\n\n_fabric() {\n local state\n\n _arguments \\\\\n '--format[Output format]:format:(table json yaml csv)' \\\\\n '--version[Show version]' \\\\\n '--help[Show help]' \\\\\n '1: :->command' \\\\\n '*: :->args'\n\n case $state in\n command)\n local commands=(\n 'auth:Authenticate and manage API keys'\n 'ctx:Manage active context'\n 'orgs:List organizations'\n 'projects:Manage projects'\n 'features:Manage project features'\n 'workflows:Manage workflows'\n 'prompts:Manage prompts'\n 'agents:Manage agents'\n 'skills:Browse skills'\n 'mcp:Manage MCP servers and configs'\n 'frames:Manage AI-generated frames'\n 'workspaces:Manage workspaces'\n 'chats:View AI chat history'\n 'reports:Manage reports'\n 'config:Show CLI configuration'\n 'completion:Output shell completion script'\n )\n _describe 'command' commands\n ;;\n args)\n case $words[2] in\n auth)\n local subcmds=('login:Log in' 'logout:Log out' 'whoami:Show current user' 'keys:Manage API keys')\n _describe 'subcommand' subcmds ;;\n projects)\n local subcmds=('list:List projects' 'show:Show project' 'create:Create project' 'update:Update project')\n _describe 'subcommand' subcmds ;;\n features)\n local subcmds=('list:List features' 'show:Show feature' 'create:Create feature' 'update:Update feature' 'tasks:List tasks')\n _describe 'subcommand' subcmds ;;\n workflows)\n local subcmds=('list:List workflows' 'show:Show workflow' 'trigger:Trigger workflow' 'status:Check status')\n _describe 'subcommand' subcmds ;;\n prompts)\n local subcmds=('list:List prompts' 'get:Get prompt' 'create:Create prompt' 'update:Update prompt')\n _describe 'subcommand' subcmds ;;\n agents)\n local subcmds=('list:List agents' 'show:Show agent' 'execute:Execute agent')\n _describe 'subcommand' subcmds ;;\n mcp)\n local subcmds=('servers:List MCP servers' 'configs:Manage MCP configs')\n _describe 'subcommand' subcmds ;;\n frames)\n local subcmds=('list:List frames' 'show:Show frame')\n _describe 'subcommand' subcmds ;;\n workspaces)\n local subcmds=('list:List workspaces' 'show:Show workspace')\n _describe 'subcommand' subcmds ;;\n skills)\n local subcmds=('list:List skills' 'show:Show skill')\n _describe 'subcommand' subcmds ;;\n chats)\n local subcmds=('list:List chats' 'show:Show chat')\n _describe 'subcommand' subcmds ;;\n reports)\n local subcmds=('templates:Manage report templates' 'executions:List report executions')\n _describe 'subcommand' subcmds ;;\n completion)\n local subcmds=('bash:Bash completion' 'zsh:Zsh completion' 'fish:Fish completion')\n _describe 'subcommand' subcmds ;;\n esac ;;\n esac\n}\n\n_fabric \"$@\"\n`.trim();\n\nconst FISH_COMPLETION = `\n# fabric fish completion\nset -l fabric_commands auth ctx orgs projects features workflows prompts agents skills mcp frames workspaces chats reports config completion\n\ncomplete -c fabric -f\n\n# Top-level commands\ncomplete -c fabric -n '__fish_use_subcommand' -a auth -d 'Authenticate and manage API keys'\ncomplete -c fabric -n '__fish_use_subcommand' -a ctx -d 'Manage active context'\ncomplete -c fabric -n '__fish_use_subcommand' -a orgs -d 'List organizations'\ncomplete -c fabric -n '__fish_use_subcommand' -a projects -d 'Manage projects'\ncomplete -c fabric -n '__fish_use_subcommand' -a features -d 'Manage project features'\ncomplete -c fabric -n '__fish_use_subcommand' -a workflows -d 'Manage workflows'\ncomplete -c fabric -n '__fish_use_subcommand' -a prompts -d 'Manage prompts'\ncomplete -c fabric -n '__fish_use_subcommand' -a agents -d 'Manage agents'\ncomplete -c fabric -n '__fish_use_subcommand' -a skills -d 'Browse skills'\ncomplete -c fabric -n '__fish_use_subcommand' -a mcp -d 'Manage MCP servers and configs'\ncomplete -c fabric -n '__fish_use_subcommand' -a frames -d 'Manage AI-generated frames'\ncomplete -c fabric -n '__fish_use_subcommand' -a workspaces -d 'Manage workspaces'\ncomplete -c fabric -n '__fish_use_subcommand' -a chats -d 'View AI chat history'\ncomplete -c fabric -n '__fish_use_subcommand' -a reports -d 'Manage reports'\ncomplete -c fabric -n '__fish_use_subcommand' -a config -d 'Show CLI configuration'\ncomplete -c fabric -n '__fish_use_subcommand' -a completion -d 'Output shell completion script'\n\n# Subcommands\ncomplete -c fabric -n '__fish_seen_subcommand_from auth' -a 'login logout whoami keys'\ncomplete -c fabric -n '__fish_seen_subcommand_from ctx' -a 'current use'\ncomplete -c fabric -n '__fish_seen_subcommand_from orgs' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from projects' -a 'list show create update'\ncomplete -c fabric -n '__fish_seen_subcommand_from features' -a 'list show create update tasks'\ncomplete -c fabric -n '__fish_seen_subcommand_from workflows' -a 'list show trigger status'\ncomplete -c fabric -n '__fish_seen_subcommand_from prompts' -a 'list get create update'\ncomplete -c fabric -n '__fish_seen_subcommand_from agents' -a 'list show execute'\ncomplete -c fabric -n '__fish_seen_subcommand_from skills' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from mcp' -a 'servers configs'\ncomplete -c fabric -n '__fish_seen_subcommand_from configs' -a 'list show delete'\ncomplete -c fabric -n '__fish_seen_subcommand_from frames' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from workspaces' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from chats' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from reports' -a 'templates executions'\ncomplete -c fabric -n '__fish_seen_subcommand_from templates' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from executions' -a 'list'\ncomplete -c fabric -n '__fish_seen_subcommand_from completion' -a 'bash zsh fish'\n\n# Common flags\ncomplete -c fabric -l format -d 'Output format' -a 'table json yaml csv'\ncomplete -c fabric -l org -d 'Organization context' -r\ncomplete -c fabric -l personal -d 'Personal context'\ncomplete -c fabric -s q -l quiet -d 'Quiet output'\ncomplete -c fabric -l help -d 'Show help'\n`.trim();\n\nexport function buildCompletionCommand(): Command {\n\tconst completion = new Command(\"completion\").description(\n\t\t\"Output shell completion script\",\n\t);\n\n\tcompletion\n\t\t.command(\"bash\")\n\t\t.description(\"Output bash completion script\")\n\t\t.action(() => {\n\t\t\tprocess.stdout.write(`${BASH_COMPLETION}\\n`);\n\t\t\tprocess.stderr.write(\n\t\t\t\t'# Add to ~/.bashrc:\\n# eval \"$(fabric completion bash)\"\\n',\n\t\t\t);\n\t\t});\n\n\tcompletion\n\t\t.command(\"zsh\")\n\t\t.description(\"Output zsh completion script\")\n\t\t.action(() => {\n\t\t\tprocess.stdout.write(`${ZSH_COMPLETION}\\n`);\n\t\t\tprocess.stderr.write(\n\t\t\t\t'# Add to ~/.zshrc:\\n# eval \"$(fabric completion zsh)\"\\n',\n\t\t\t);\n\t\t});\n\n\tcompletion\n\t\t.command(\"fish\")\n\t\t.description(\"Output fish completion script\")\n\t\t.action(() => {\n\t\t\tprocess.stdout.write(`${FISH_COMPLETION}\\n`);\n\t\t\tprocess.stderr.write(\n\t\t\t\t\"# Save to ~/.config/fish/completions/fabric.fish\\n\",\n\t\t\t);\n\t\t});\n\n\treturn completion;\n}\n","/**\n * fabric ctx\n *\n * fabric ctx current Show active context\n * fabric ctx use personal Set personal as default\n * fabric ctx use org <slug> Set an org as default\n */\n\nimport { Command } from \"commander\";\nimport { getDefaultContext, saveDefaultContext } from \"../../lib/config.js\";\nimport { printSuccess, printWarning } from \"../../lib/output.js\";\n\nexport function buildCtxCommand(): Command {\n\tconst ctx = new Command(\"ctx\").description(\n\t\t\"Manage tenant context (personal vs org)\",\n\t);\n\n\t// -- current ------------------------------------------------------------\n\tctx.command(\"current\")\n\t\t.description(\"Show the active default context\")\n\t\t.action(() => {\n\t\t\tconst stored = getDefaultContext();\n\t\t\tif (!stored) {\n\t\t\t\tprintWarning(\n\t\t\t\t\t\"No default context set. Use --personal or --org <slug> on each command, or run:\\n fabric ctx use personal\\n fabric ctx use org <slug>\",\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (stored.type === \"personal\") {\n\t\t\t\tprocess.stdout.write(\"Context: personal\\n\");\n\t\t\t} else {\n\t\t\t\tprocess.stdout.write(`Context: org:${stored.slug}\\n`);\n\t\t\t}\n\t\t});\n\n\t// -- use ----------------------------------------------------------------\n\tconst use = new Command(\"use\").description(\n\t\t\"Set the default context for commands\",\n\t);\n\n\tuse.command(\"personal\")\n\t\t.description(\"Use personal context by default\")\n\t\t.action(() => {\n\t\t\tsaveDefaultContext({ type: \"personal\" });\n\t\t\tprintSuccess(\"Default context set to: personal\");\n\t\t});\n\n\tuse.command(\"org <slug>\")\n\t\t.description(\"Use an org context by default\")\n\t\t.action((slug: string) => {\n\t\t\tsaveDefaultContext({ type: \"org\", slug });\n\t\t\tprintSuccess(`Default context set to: org:${slug}`);\n\t\t});\n\n\tctx.addCommand(use);\n\n\treturn ctx;\n}\n","/**\n * fabric features\n *\n * fabric features list --project <id> List features in a project\n * fabric features show --project <id> <id> Show feature details\n * fabric features create --project <id> <title> Create a feature\n */\n\nimport type { FabricFeature } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildFeaturesCommand(): Command {\n\tconst features = new Command(\"features\").description(\n\t\t\"Manage project features\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tfeatures\n\t\t.command(\"list\")\n\t\t.description(\"List features in a project\")\n\t\t.requiredOption(\"-p, --project <id>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\n\t\t\t\"--priority <priority>\",\n\t\t\t\"Filter: P0_CRITICAL|P1_HIGH|P2_MEDIUM|P3_LOW\",\n\t\t)\n\t\t.option(\"--search <query>\", \"Search by title\")\n\t\t.option(\"--limit <n>\", \"Max results (default 50)\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\tproject: string;\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tpriority?: string;\n\t\t\t\tsearch?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricFeature[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.projects.listFeatures(opts.project, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tpriority: opts.priority as\n\t\t\t\t\t\t\t| FabricFeature[\"priority\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const f of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${f.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"identifier\", \"title\", \"priority\", \"createdAt\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tfeatures\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show feature details\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\tproject: string;\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet feature: FabricFeature;\n\t\t\t\ttry {\n\t\t\t\t\tfeature = await client.projects.getFeature(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t\tpersonal:\n\t\t\t\t\t\t\t\tctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(feature, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: feature.id,\n\t\t\t\t\tIdentifier: feature.identifier,\n\t\t\t\t\tTitle: feature.title,\n\t\t\t\t\tPriority: feature.priority,\n\t\t\t\t\tDescription: feature.description ?? \"(none)\",\n\t\t\t\t\t\"Acceptance Criteria\":\n\t\t\t\t\t\tfeature.acceptanceCriteria ?? \"(none)\",\n\t\t\t\t\tProject: feature.projectId,\n\t\t\t\t\tAssignee: feature.assigneeId ?? \"(none)\",\n\t\t\t\t\tCreated: feature.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- create --------------------------------------------------------------\n\tfeatures\n\t\t.command(\"create <title>\")\n\t\t.description(\"Create a feature in a project\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"-d, --description <text>\", \"Feature description\")\n\t\t.option(\n\t\t\t\"--priority <priority>\",\n\t\t\t\"Priority: P0_CRITICAL|P1_HIGH|P2_MEDIUM|P3_LOW (default: P2_MEDIUM)\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\ttitle: string,\n\t\t\t\topts: {\n\t\t\t\t\tproject: string;\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tpriority?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet feature: FabricFeature;\n\t\t\t\ttry {\n\t\t\t\t\tfeature = await client.projects.createFeature(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\t\tpriority: opts.priority as\n\t\t\t\t\t\t\t\t| FabricFeature[\"priority\"]\n\t\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t\tpersonal:\n\t\t\t\t\t\t\t\tctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(feature, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(`Feature ${feature.identifier} created`);\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: feature.id,\n\t\t\t\t\tIdentifier: feature.identifier,\n\t\t\t\t\tTitle: feature.title,\n\t\t\t\t\tPriority: feature.priority,\n\t\t\t\t\tProject: feature.projectId,\n\t\t\t\t\tCreated: feature.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- tasks ---------------------------------------------------------------\n\tfeatures\n\t\t.command(\"tasks\")\n\t\t.description(\"List tasks (sub-items) for a feature\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.requiredOption(\"-f, --feature <featureId>\", \"Feature ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\tproject: string;\n\t\t\t\tfeature: string;\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet tasks: import(\"@fabricorg/sdk\").FabricTask[];\n\t\t\t\ttry {\n\t\t\t\t\ttasks = await client.projects.listTasks(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\topts.feature,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t\tpersonal:\n\t\t\t\t\t\t\t\tctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const t of tasks) {\n\t\t\t\t\t\tprocess.stdout.write(`${t.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(tasks, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"identifier\",\n\t\t\t\t\t\t\"title\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"estimatedHours\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- update --------------------------------------------------------------\n\tfeatures\n\t\t.command(\"update <id>\")\n\t\t.description(\"Update a feature\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--title <title>\", \"New title\")\n\t\t.option(\"-d, --description <text>\", \"New description\")\n\t\t.option(\n\t\t\t\"--priority <priority>\",\n\t\t\t\"Priority: P0_CRITICAL|P1_HIGH|P2_MEDIUM|P3_LOW\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\tproject: string;\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\ttitle?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tpriority?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet feature: FabricFeature;\n\t\t\t\ttry {\n\t\t\t\t\tfeature = await client.projects.updateFeature(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: opts.title,\n\t\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\t\tpriority: opts.priority as\n\t\t\t\t\t\t\t\t| FabricFeature[\"priority\"]\n\t\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t\tpersonal:\n\t\t\t\t\t\t\t\tctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(feature, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: feature.id,\n\t\t\t\t\tIdentifier: feature.identifier,\n\t\t\t\t\tTitle: feature.title,\n\t\t\t\t\tPriority: feature.priority,\n\t\t\t\t\tUpdated: feature.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn features;\n}\n","/**\n * fabric frames\n *\n * fabric frames list List frames and slideshows\n * fabric frames show <id> Show frame details\n */\n\nimport type { FabricFrame } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildFramesCommand(): Command {\n\tconst frames = new Command(\"frames\").description(\n\t\t\"Manage AI-generated frames and slideshows\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tframes\n\t\t.command(\"list\")\n\t\t.description(\"List frames and slideshows\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--limit <n>\", \"Max results (default 50)\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricFrame[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.frames.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const f of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${f.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"title\",\n\t\t\t\t\t\t\"fileType\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"isPublic\",\n\t\t\t\t\t\t\"updatedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tframes\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show frame details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet frame: FabricFrame;\n\t\t\t\ttry {\n\t\t\t\t\tframe = await client.frames.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(frame, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: frame.id,\n\t\t\t\t\tTitle: frame.title,\n\t\t\t\t\tKind: frame.kind ?? \"(none)\",\n\t\t\t\t\t\"File Type\": frame.fileType,\n\t\t\t\t\tStatus: frame.status,\n\t\t\t\t\tPublic: frame.isPublic ? \"yes\" : \"no\",\n\t\t\t\t\t\"Share Token\": frame.shareToken ?? \"(none)\",\n\t\t\t\t\tDescription: frame.description ?? \"(none)\",\n\t\t\t\t\tUpdated: frame.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn frames;\n}\n","/**\n * fabric mcp\n *\n * fabric mcp servers List accessible MCP servers\n * fabric mcp configs List your MCP configurations\n * fabric mcp configs show <id> Show a specific MCP configuration\n */\n\nimport type {\n\tFabricMcpConfig,\n\tFabricMcpConfigDetail,\n\tFabricMcpServer,\n} from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildMcpCommand(): Command {\n\tconst mcp = new Command(\"mcp\").description(\n\t\t\"Manage MCP servers and configurations\",\n\t);\n\n\t// -- servers -------------------------------------------------------------\n\tmcp.command(\"servers\")\n\t\t.description(\"List accessible MCP servers (system + custom)\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print server keys only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricMcpServer[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.mcp.listServers({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const s of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${s.key}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"key\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"transport\",\n\t\t\t\t\t\t\"category\",\n\t\t\t\t\t\t\"isSystemProvided\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- configs -------------------------------------------------------------\n\tconst configs = new Command(\"configs\").description(\n\t\t\"Manage MCP configurations\",\n\t);\n\n\tconfigs\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List your MCP configurations\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricMcpConfig[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.mcp.listConfigs({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const c of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${c.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"serverName\",\n\t\t\t\t\t\t\"displayName\",\n\t\t\t\t\t\t\"authType\",\n\t\t\t\t\t\t\"enabled\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\tconfigs\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show a specific MCP configuration\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet config: FabricMcpConfigDetail;\n\t\t\t\ttry {\n\t\t\t\t\tconfig = await client.mcp.getConfig(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(config, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: config.id,\n\t\t\t\t\tServer: config.serverName ?? config.mcpServerId,\n\t\t\t\t\t\"Server Key\": config.serverKey ?? \"(none)\",\n\t\t\t\t\t\"Display Name\": config.displayName ?? \"(none)\",\n\t\t\t\t\t\"Base URL\": config.baseUrl ?? \"(none)\",\n\t\t\t\t\tTransport: config.transport ?? \"(default)\",\n\t\t\t\t\t\"Auth Type\": config.authType,\n\t\t\t\t\tEnabled: config.enabled ? \"yes\" : \"no\",\n\t\t\t\t\tStatus: config.status,\n\t\t\t\t\t\"Last Health Check\":\n\t\t\t\t\t\tconfig.lastHealthCheckAt?.slice(0, 19) ?? \"(never)\",\n\t\t\t\t\tCreated: config.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\tconfigs\n\t\t.command(\"delete <id>\")\n\t\t.description(\"Delete an MCP configuration\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"-y, --yes\", \"Skip confirmation prompt\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; yes?: boolean },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\n\t\t\t\tif (!opts.yes) {\n\t\t\t\t\tprocess.stderr.write(\n\t\t\t\t\t\t`Delete MCP config ${id}? This cannot be undone. Pass --yes to confirm.\\n`,\n\t\t\t\t\t);\n\t\t\t\t\tprocess.exit(2);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait client.mcp.deleteConfig(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tprocess.stdout.write(`MCP config ${id} deleted.\\n`);\n\t\t\t},\n\t\t);\n\n\tmcp.addCommand(configs);\n\n\t// -- serve ---------------------------------------------------------------\n\tmcp.command(\"serve\")\n\t\t.description(\n\t\t\t\"Run a stdio MCP server exposing this workspace's whole integration catalog. \" +\n\t\t\t\t\"Point Claude Desktop, Cursor, or any MCP client at it.\",\n\t\t)\n\t\t.action(async () => {\n\t\t\t// Lazy import — avoids loading the MCP SDK when running other commands\n\t\t\t// and keeps the CLI binary cold-start fast.\n\t\t\tconst { runStdio } = await import(\"@fabricorg/sdk-mcp/stdio\");\n\t\t\tawait runStdio();\n\t\t});\n\n\treturn mcp;\n}\n","/**\n * fabric orgs\n *\n * fabric orgs list List orgs you belong to\n * fabric orgs show <slug> Show org details\n */\n\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildOrgsCommand(): Command {\n\tconst orgs = new Command(\"orgs\").description(\"Manage organizations\");\n\n\t// -- list ----------------------------------------------------------------\n\torgs.command(\"list\")\n\t\t.description(\"List organizations you belong to\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print slugs only\")\n\t\t.action(async (opts: { format: string; quiet?: boolean }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet list: Awaited<ReturnType<typeof client.orgs.list>>;\n\t\t\ttry {\n\t\t\t\tlist = await client.orgs.list();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\n\t\t\tif (opts.quiet) {\n\t\t\t\tfor (const org of list) {\n\t\t\t\t\tprocess.stdout.write(`${org.slug}\\n`);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprintOutput(list, {\n\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\tcolumns: [\"name\", \"slug\", \"role\", \"joinedAt\"],\n\t\t\t});\n\t\t});\n\n\t// -- show ----------------------------------------------------------------\n\torgs.command(\"show <slug>\")\n\t\t.description(\"Show details for an organization\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(async (slug: string, opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet list: Awaited<ReturnType<typeof client.orgs.list>>;\n\t\t\ttry {\n\t\t\t\tlist = await client.orgs.list();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\n\t\t\tconst org = list.find(\n\t\t\t\t(o: { slug: string; id: string }) =>\n\t\t\t\t\to.slug === slug || o.id === slug,\n\t\t\t);\n\t\t\tif (!org) {\n\t\t\t\tprintError(`Organization not found: ${slug}`, 4);\n\t\t\t}\n\n\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\tprintOutput(org, { format: fmt });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprintRecord({\n\t\t\t\tName: org.name,\n\t\t\t\tSlug: org.slug,\n\t\t\t\tRole: org.role,\n\t\t\t\t\"Joined at\": String(org.joinedAt).slice(0, 10),\n\t\t\t\tLogo: org.logo ?? \"(none)\",\n\t\t\t});\n\t\t});\n\n\treturn orgs;\n}\n","/**\n * fabric projects\n *\n * fabric projects list List projects\n * fabric projects show <id> Show project details\n * fabric projects create <name> Create a project\n */\n\nimport type { FabricProject } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildProjectsCommand(): Command {\n\tconst projects = new Command(\"projects\").description(\"Manage projects\");\n\n\t// -- list ----------------------------------------------------------------\n\tprojects\n\t\t.command(\"list\")\n\t\t.description(\"List projects\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\n\t\t\t\"--status <status>\",\n\t\t\t\"Filter by status: ACTIVE|DRAFT|COMPLETED|ARCHIVED\",\n\t\t)\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tstatus?: string;\n\t\t\t\tsearch?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricProject[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.projects.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| FabricProject[\"status\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const p of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${p.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"id\", \"name\", \"status\", \"createdAt\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tprojects\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show project details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet project: FabricProject;\n\t\t\t\ttry {\n\t\t\t\t\tproject = await client.projects.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(project, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: project.id,\n\t\t\t\t\tName: project.name,\n\t\t\t\t\tStatus: project.status,\n\t\t\t\t\tDescription: project.description ?? \"(none)\",\n\t\t\t\t\tRepository: project.repositoryUrl ?? \"(none)\",\n\t\t\t\t\tCreated: project.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- create --------------------------------------------------------------\n\tprojects\n\t\t.command(\"create <name>\")\n\t\t.description(\"Create a new project\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"-d, --description <text>\", \"Project description\")\n\t\t.option(\"--repo <url>\", \"Repository URL\")\n\t\t.option(\n\t\t\t\"--status <status>\",\n\t\t\t\"Initial status: DRAFT|ACTIVE (default: DRAFT)\",\n\t\t\t\"DRAFT\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tname: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\trepo?: string;\n\t\t\t\t\tstatus: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet project: FabricProject;\n\t\t\t\ttry {\n\t\t\t\t\tproject = await client.projects.create({\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\trepositoryUrl: opts.repo,\n\t\t\t\t\t\tstatus: opts.status as \"DRAFT\" | \"ACTIVE\",\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(project, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(`Project \"${project.name}\" created`);\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: project.id,\n\t\t\t\t\tName: project.name,\n\t\t\t\t\tStatus: project.status,\n\t\t\t\t\tDescription: project.description ?? \"(none)\",\n\t\t\t\t\tCreated: project.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- update --------------------------------------------------------------\n\tprojects\n\t\t.command(\"update <id>\")\n\t\t.description(\"Update a project\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--name <name>\", \"New name\")\n\t\t.option(\"-d, --description <text>\", \"New description\")\n\t\t.option(\"--repo <url>\", \"Repository URL\")\n\t\t.option(\"--status <status>\", \"Status: DRAFT|ACTIVE|COMPLETED|ARCHIVED\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tname?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\trepo?: string;\n\t\t\t\t\tstatus?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet project: FabricProject;\n\t\t\t\ttry {\n\t\t\t\t\tproject = await client.projects.update(id, {\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\trepositoryUrl: opts.repo,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| \"DRAFT\"\n\t\t\t\t\t\t\t| \"ACTIVE\"\n\t\t\t\t\t\t\t| \"COMPLETED\"\n\t\t\t\t\t\t\t| \"ARCHIVED\"\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(project, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: project.id,\n\t\t\t\t\tName: project.name,\n\t\t\t\t\tStatus: project.status,\n\t\t\t\t\tDescription: project.description ?? \"(none)\",\n\t\t\t\t\tUpdated: project.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn projects;\n}\n","/**\n * fabric prompts\n *\n * fabric prompts list List prompt templates\n * fabric prompts get <id> Get a prompt (prints latest version content)\n */\n\nimport type { FabricPrompt } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildPromptsCommand(): Command {\n\tconst prompts = new Command(\"prompts\").description(\n\t\t\"Manage prompt templates\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tprompts\n\t\t.command(\"list\")\n\t\t.description(\"List prompt templates\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--category <cat>\", \"Filter by category\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricPrompt[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.prompts.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const p of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${p.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"key\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"scope\",\n\t\t\t\t\t\t\"category\",\n\t\t\t\t\t\t\"updatedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- get -----------------------------------------------------------------\n\tprompts\n\t\t.command(\"get <id>\")\n\t\t.description(\"Get a prompt (prints latest version content by default)\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: raw|table|json|yaml (default: raw)\",\n\t\t\t\"raw\",\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet prompt: FabricPrompt;\n\t\t\t\ttry {\n\t\t\t\t\tprompt = await client.prompts.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"raw\" | \"table\" | \"json\" | \"yaml\";\n\n\t\t\t\tif (fmt === \"json\") {\n\t\t\t\t\tprintOutput(prompt, { format: \"json\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(prompt, { format: \"yaml\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst content = prompt.versions?.[0]?.content ?? \"(no content)\";\n\n\t\t\t\tif (fmt === \"raw\") {\n\t\t\t\t\tprocess.stdout.write(`${content}\\n`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// table: metadata + content block\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: prompt.id,\n\t\t\t\t\tKey: prompt.key,\n\t\t\t\t\tName: prompt.name,\n\t\t\t\t\tScope: prompt.scope,\n\t\t\t\t\tCategory: prompt.category ?? \"(none)\",\n\t\t\t\t\tTags: (prompt.tags ?? []).join(\", \") || \"(none)\",\n\t\t\t\t});\n\t\t\t\tprocess.stdout.write(`\\n--- Content ---\\n${content}\\n`);\n\t\t\t},\n\t\t);\n\n\t// -- create --------------------------------------------------------------\n\tprompts\n\t\t.command(\"create\")\n\t\t.description(\"Create a new prompt\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.requiredOption(\"--key <key>\", \"Prompt key (unique identifier)\")\n\t\t.requiredOption(\"--name <name>\", \"Prompt name\")\n\t\t.option(\"-d, --description <text>\", \"Prompt description\")\n\t\t.option(\"--content <text>\", \"Initial prompt content\")\n\t\t.option(\"--category <cat>\", \"Category\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tkey: string;\n\t\t\t\tname: string;\n\t\t\t\tdescription?: string;\n\t\t\t\tcontent?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tformat: string;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet prompt: FabricPrompt;\n\t\t\t\ttry {\n\t\t\t\t\tprompt = await client.prompts.create({\n\t\t\t\t\t\tkey: opts.key,\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\tcontent: opts.content,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(prompt, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(`Prompt \"${prompt.name}\" created`);\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: prompt.id,\n\t\t\t\t\tKey: prompt.key,\n\t\t\t\t\tName: prompt.name,\n\t\t\t\t\tScope: prompt.scope,\n\t\t\t\t\tCreated: prompt.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- update --------------------------------------------------------------\n\tprompts\n\t\t.command(\"update <id>\")\n\t\t.description(\"Update a prompt\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--name <name>\", \"New name\")\n\t\t.option(\"-d, --description <text>\", \"New description\")\n\t\t.option(\"--category <cat>\", \"Category\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tname?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tcategory?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet prompt: FabricPrompt;\n\t\t\t\ttry {\n\t\t\t\t\tprompt = await client.prompts.update(id, {\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(prompt, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: prompt.id,\n\t\t\t\t\tKey: prompt.key,\n\t\t\t\t\tName: prompt.name,\n\t\t\t\t\tScope: prompt.scope,\n\t\t\t\t\tUpdated: prompt.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn prompts;\n}\n","/**\n * fabric reports\n *\n * fabric reports templates list List report templates\n * fabric reports templates show <id> Show template details\n * fabric reports executions list List report executions\n */\n\nimport type {\n\tFabricReportExecution,\n\tFabricReportTemplate,\n} from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildReportsCommand(): Command {\n\tconst reports = new Command(\"reports\").description(\n\t\t\"Manage report templates and executions\",\n\t);\n\n\t// -- templates -----------------------------------------------------------\n\tconst templates = new Command(\"templates\").description(\n\t\t\"Manage report templates\",\n\t);\n\n\ttemplates\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List report templates\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--category <cat>\", \"Filter by category\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricReportTemplate[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.reports.listTemplates({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const t of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${t.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"templateType\",\n\t\t\t\t\t\t\"scope\",\n\t\t\t\t\t\t\"usageCount\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\ttemplates\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show report template details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet tmpl: FabricReportTemplate;\n\t\t\t\ttry {\n\t\t\t\t\ttmpl = await client.reports.getTemplate(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(tmpl, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: tmpl.id,\n\t\t\t\t\tName: tmpl.name,\n\t\t\t\t\tType: tmpl.templateType,\n\t\t\t\t\tScope: tmpl.scope,\n\t\t\t\t\tCategory: tmpl.category ?? \"(none)\",\n\t\t\t\t\tTags: tmpl.tags.join(\", \") || \"(none)\",\n\t\t\t\t\tPublic: tmpl.isPublic ? \"yes\" : \"no\",\n\t\t\t\t\t\"Use Count\": String(tmpl.usageCount),\n\t\t\t\t\tDescription: tmpl.description ?? \"(none)\",\n\t\t\t\t\tUpdated: tmpl.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treports.addCommand(templates);\n\n\t// -- executions ----------------------------------------------------------\n\tconst executions = new Command(\"executions\").description(\n\t\t\"View report executions\",\n\t);\n\n\texecutions\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List report executions\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricReportExecution[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.reports.listExecutions({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const e of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${e.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"templateId\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"startedAt\",\n\t\t\t\t\t\t\"completedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treports.addCommand(executions);\n\n\treturn reports;\n}\n","/**\n * fabric skills\n *\n * fabric skills list Browse skill definitions\n * fabric skills show <id> Show skill details\n */\n\nimport type { FabricSkill } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildSkillsCommand(): Command {\n\tconst skills = new Command(\"skills\").description(\n\t\t\"Browse skill definitions\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tskills\n\t\t.command(\"list\")\n\t\t.description(\"List skills\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--category <cat>\", \"Filter by category\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print slugs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricSkill[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.skills.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const s of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${s.slug}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"slug\", \"name\", \"category\", \"scope\", \"useCount\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tskills\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show skill details (accepts ID or slug)\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(async (id: string, opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet skill: FabricSkill;\n\t\t\ttry {\n\t\t\t\tskill = await client.skills.get(id);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\n\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\tprintOutput(skill, { format: fmt });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprintRecord({\n\t\t\t\tID: skill.id,\n\t\t\t\tSlug: skill.slug,\n\t\t\t\tName: skill.name,\n\t\t\t\tCategory: skill.category ?? \"(none)\",\n\t\t\t\tScope: skill.scope,\n\t\t\t\tTags: skill.tags.join(\", \") || \"(none)\",\n\t\t\t\tPublished: skill.isPublished ? \"yes\" : \"no\",\n\t\t\t\t\"Use Count\": String(skill.useCount),\n\t\t\t\tVersion: String(skill.version),\n\t\t\t\tDescription: skill.description,\n\t\t\t\tUpdated: skill.updatedAt.slice(0, 10),\n\t\t\t});\n\t\t});\n\n\treturn skills;\n}\n","/**\n * fabric workflows\n *\n * fabric workflows list List workflows\n * fabric workflows show <id> Show workflow details\n * fabric workflows trigger <id> Trigger a workflow execution\n * fabric workflows status <id> <execId> Get execution status\n */\n\nimport type { FabricExecution, FabricWorkflow } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildWorkflowsCommand(): Command {\n\tconst workflows = new Command(\"workflows\").description(\"Manage workflows\");\n\n\t// -- list ----------------------------------------------------------------\n\tworkflows\n\t\t.command(\"list\")\n\t\t.description(\"List workflows\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--status <status>\", \"Filter: DRAFT|ACTIVE|PAUSED|ARCHIVED\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tstatus?: string;\n\t\t\t\tsearch?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricWorkflow[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.workflows.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| FabricWorkflow[\"status\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const w of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${w.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"triggerType\",\n\t\t\t\t\t\t\"createdAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tworkflows\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show workflow details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet wf: FabricWorkflow;\n\t\t\t\ttry {\n\t\t\t\t\twf = await client.workflows.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(wf, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: wf.id,\n\t\t\t\t\tName: wf.name,\n\t\t\t\t\tStatus: wf.status,\n\t\t\t\t\tTrigger: wf.triggerType,\n\t\t\t\t\tVersion: String(wf.version),\n\t\t\t\t\tCreated: wf.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- trigger -------------------------------------------------------------\n\tworkflows\n\t\t.command(\"trigger <id>\")\n\t\t.description(\"Trigger a workflow execution\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--input <json>\", \"JSON input for triggerData\", \"{}\")\n\t\t.option(\"--vars <json>\", \"JSON variables\", \"{}\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tinput: string;\n\t\t\t\t\tvars: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\n\t\t\t\tlet triggerData: Record<string, unknown> = {};\n\t\t\t\tlet variables: Record<string, unknown> = {};\n\t\t\t\ttry {\n\t\t\t\t\ttriggerData = JSON.parse(opts.input);\n\t\t\t\t\tvariables = JSON.parse(opts.vars);\n\t\t\t\t} catch {\n\t\t\t\t\tprintError(\"--input and --vars must be valid JSON\", 2);\n\t\t\t\t}\n\n\t\t\t\tlet result: {\n\t\t\t\t\texecutionId: string;\n\t\t\t\t\tworkflowId: string;\n\t\t\t\t\tstatus: string;\n\t\t\t\t};\n\t\t\t\ttry {\n\t\t\t\t\tresult = await client.workflows.trigger(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\ttriggerData,\n\t\t\t\t\t\tvariables,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(\"Workflow triggered\");\n\t\t\t\tprocess.stdout.write(` Execution ID: ${result.executionId}\\n`);\n\t\t\t\tprocess.stdout.write(` Status: ${result.status}\\n`);\n\t\t\t},\n\t\t);\n\n\t// -- status --------------------------------------------------------------\n\tworkflows\n\t\t.command(\"status <id> <execId>\")\n\t\t.description(\"Get workflow execution status\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\texecId: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet exec: FabricExecution;\n\t\t\t\ttry {\n\t\t\t\t\texec = await client.workflows.getExecution(id, execId, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(exec, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: exec.id,\n\t\t\t\t\t\"Workflow ID\": exec.workflowId,\n\t\t\t\t\tStatus: exec.status,\n\t\t\t\t\t\"Trigger type\": exec.triggerType,\n\t\t\t\t\tStarted: exec.startedAt?.slice(0, 19) ?? \"(not started)\",\n\t\t\t\t\tCompleted: exec.completedAt?.slice(0, 19) ?? \"(running)\",\n\t\t\t\t\tError: exec.error ?? \"(none)\",\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn workflows;\n}\n","/**\n * fabric workspaces\n *\n * fabric workspaces list List workspaces\n * fabric workspaces show <id> Show workspace details\n */\n\nimport type { FabricWorkspace, FabricWorkspaceDetail } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildWorkspacesCommand(): Command {\n\tconst workspaces = new Command(\"workspaces\").description(\n\t\t\"Manage workspaces\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tworkspaces\n\t\t.command(\"list\")\n\t\t.description(\"List workspaces\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--status <status>\", \"Filter: ACTIVE|ARCHIVED\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tstatus?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricWorkspace[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.workspaces.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| \"ACTIVE\"\n\t\t\t\t\t\t\t| \"ARCHIVED\"\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const w of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${w.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"documentCount\",\n\t\t\t\t\t\t\"updatedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tworkspaces\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show workspace details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Personal context\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet ws: FabricWorkspaceDetail;\n\t\t\t\ttry {\n\t\t\t\t\tws = await client.workspaces.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpersonal: ctx?.type === \"personal\" ? true : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(ws, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: ws.id,\n\t\t\t\t\tName: ws.name,\n\t\t\t\t\tType: ws.type,\n\t\t\t\t\tStatus: ws.status,\n\t\t\t\t\tDescription: ws.description ?? \"(none)\",\n\t\t\t\t\tDocuments: String(ws.documentCount),\n\t\t\t\t\tConversations: String(ws.conversationCount),\n\t\t\t\t\tUpdated: ws.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn workspaces;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,WAAAA,iBAAe;;;ACRxB,SAAS,eAAe;;;ACHxB,SAAS,iBAAiB,oBAAoB;;;ACK9C,OAAO,UAAU;AAuBjB,IAAM,WAAsB;AAAA,EAC3B,eAAe;AAAA,EACf,UAAU,CAAC;AAAA,EACX,eAAe;AAChB;AAEA,IAAI;AAEJ,SAAS,WAA4B;AACpC,MAAI,CAAC,QAAQ;AACZ,aAAS,IAAI,KAAgB;AAAA,MAC5B,aAAa;AAAA,MACb,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AACA,SAAO;AACR;AAEO,SAAS,YAAuB;AACtC,SAAO,SAAS,EAAE;AACnB;AAEO,SAAS,mBAAkC;AAvDlD,MAAAC;AAwDC,QAAM,MAAM,UAAU;AACtB,UAAOA,MAAA,IAAI,SAAS,IAAI,aAAa,MAA9B,OAAAA,MAAmC,CAAC;AAC5C;AAEO,SAAS,YAAgC;AAE/C,MAAI,QAAQ,IAAI,gBAAgB;AAC/B,WAAO,QAAQ,IAAI;AAAA,EACpB;AACA,SAAO,iBAAiB,EAAE;AAC3B;AAEO,SAAS,aAAiC;AAChD,MAAI,QAAQ,IAAI,iBAAiB;AAChC,WAAO,QAAQ,IAAI;AAAA,EACpB;AACA,SAAO,iBAAiB,EAAE;AAC3B;AAEO,SAAS,oBAA+C;AAE9D,MAAI,QAAQ,IAAI,YAAY;AAC3B,WAAO,EAAE,MAAM,OAAO,MAAM,QAAQ,I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,WAAW,iBAAiB,CAAC;AAClC,QAAQ,WAAW,IAAI;AAKvB,QAAQ,WAAW,gBAAgB,CAAC;AAKpC,QAAQ,WAAW,iBAAiB,CAAC;AAKrC,QAAQ,WAAW,qBAAqB,CAAC;AAKzC,QAAQ,WAAW,qBAAqB,CAAC;AAKzC,QAAQ,WAAW,sBAAsB,CAAC;AAK1C,QAAQ,WAAW,oBAAoB,CAAC;AAKxC,QAAQ,WAAW,mBAAmB,CAAC;AAKvC,QAAQ,WAAW,mBAAmB,CAAC;AAKvC,QAAQ,WAAW,gBAAgB,CAAC;AAKpC,QAAQ,WAAW,mBAAmB,CAAC;AAKvC,QAAQ,WAAW,uBAAuB,CAAC;AAK3C,QAAQ,WAAW,kBAAkB,CAAC;AAKtC,QAAQ,WAAW,oBAAoB,CAAC;AAKxC,QAAQ,WAAW,uBAAuB,CAAC;AAK3C,IAAM,SAAS,IAAIA,UAAQ,QAAQ,EAAE,YAAY,wBAAwB;AACzE,OACE,QAAQ,MAAM,EACd,YAAY,mCAAmC,EAC/C,OAAO,MAAM;AACb,UAAQ,OAAO,MAAM,GAAG,cAAc,CAAC;AAAA,CAAI;AAC5C,CAAC;AACF,QAAQ,WAAW,MAAM;AAKzB,QAAQ,GAAG,sBAAsB,CAAC,WAAW;AAC5C,QAAM,UAAU,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;AACxE,MAAI,QAAQ,IAAI,kBAAkB,QAAQ;AACzC,YAAQ,OAAO;AAAA,MACd,KAAK,UAAU,EAAE,OAAO,EAAE,SAAS,MAAM,kBAAkB,EAAE,CAAC,IAC7D;AAAA,IACF;AAAA,EACD,OAAO;AACN,YAAQ,OAAO,MAAM,UAAK,OAAO;AAAA,CAAI;AAAA,EACtC;AACA,UAAQ,KAAK,CAAC;AACf,CAAC;AAED,QAAQ,MAAM,QAAQ,IAAI;","names":["Command","_a","_a","rows","cols","_a","Command","Command","FabricClient","Command","Command","_a","FabricClient","Command","Command","Command","Command","_a","Command","Command","_a","Command","Command","Command","Command","Command","_a","Command","Command","_a","Command","Command","_a","config","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command"]}
1
+ {"version":3,"sources":["../src/bin/fabric.ts","../src/commands/agents/index.ts","../src/lib/client.ts","../src/lib/config.ts","../src/lib/output.ts","../src/lib/context.ts","../src/commands/auth/keys.ts","../src/commands/auth/login.ts","../src/commands/auth/logout.ts","../src/commands/auth/whoami.ts","../src/commands/chats/index.ts","../src/commands/completion/index.ts","../src/commands/ctx/index.ts","../src/commands/features/index.ts","../src/commands/frames/index.ts","../src/commands/mcp/index.ts","../src/commands/orgs/index.ts","../src/commands/projects/index.ts","../src/commands/prompts/index.ts","../src/commands/reports/index.ts","../src/commands/skills/index.ts","../src/commands/workflows/index.ts","../src/commands/workspaces/index.ts"],"sourcesContent":["/**\n * @fabricorg/cli — fabric command\n *\n * Usage: fabric <command> [subcommand] [options]\n *\n * Exit codes:\n * 0 success\n * 1 general failure\n * 2 invalid usage / bad arguments\n * 3 auth failure\n * 4 not found\n * 5 forbidden\n * 6 rate limited\n * 7 validation error\n */\n\nimport { Command } from \"commander\";\nimport { buildAgentsCommand } from \"../commands/agents/index.js\";\nimport { buildKeysCommand } from \"../commands/auth/keys.js\";\nimport { buildLoginCommand } from \"../commands/auth/login.js\";\nimport { buildLogoutCommand } from \"../commands/auth/logout.js\";\nimport { buildWhoamiCommand } from \"../commands/auth/whoami.js\";\nimport { buildChatsCommand } from \"../commands/chats/index.js\";\nimport { buildCompletionCommand } from \"../commands/completion/index.js\";\nimport { buildCtxCommand } from \"../commands/ctx/index.js\";\nimport { buildFeaturesCommand } from \"../commands/features/index.js\";\nimport { buildFramesCommand } from \"../commands/frames/index.js\";\nimport { buildMcpCommand } from \"../commands/mcp/index.js\";\nimport { buildOrgsCommand } from \"../commands/orgs/index.js\";\nimport { buildProjectsCommand } from \"../commands/projects/index.js\";\nimport { buildPromptsCommand } from \"../commands/prompts/index.js\";\nimport { buildReportsCommand } from \"../commands/reports/index.js\";\nimport { buildSkillsCommand } from \"../commands/skills/index.js\";\nimport { buildWorkflowsCommand } from \"../commands/workflows/index.js\";\nimport { buildWorkspacesCommand } from \"../commands/workspaces/index.js\";\nimport { getConfigPath } from \"../lib/config.js\";\n\nconst program = new Command();\n\nprogram\n\t.name(\"fabric\")\n\t.description(\"Fabric AI platform CLI\")\n\t.version(\"0.1.0\")\n\t.option(\n\t\t\"--format <format>\",\n\t\t\"Output format: table|json|yaml|csv\",\n\t\tprocess.env.FABRIC_FORMAT ?? \"table\",\n\t);\n\n// ---------------------------------------------------------------------------\n// fabric auth\n// ---------------------------------------------------------------------------\nconst auth = new Command(\"auth\").description(\n\t\"Authenticate and manage API keys\",\n);\nauth.addCommand(buildLoginCommand());\nauth.addCommand(buildLogoutCommand());\nauth.addCommand(buildWhoamiCommand());\nauth.addCommand(buildKeysCommand());\nprogram.addCommand(auth);\n\n// ---------------------------------------------------------------------------\n// fabric ctx\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildCtxCommand());\n\n// ---------------------------------------------------------------------------\n// fabric orgs\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildOrgsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric projects\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildProjectsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric features\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildFeaturesCommand());\n\n// ---------------------------------------------------------------------------\n// fabric workflows\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildWorkflowsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric prompts\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildPromptsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric agents\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildAgentsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric skills\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildSkillsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric mcp\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildMcpCommand());\n\n// ---------------------------------------------------------------------------\n// fabric frames\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildFramesCommand());\n\n// ---------------------------------------------------------------------------\n// fabric workspaces\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildWorkspacesCommand());\n\n// ---------------------------------------------------------------------------\n// fabric chats\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildChatsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric reports\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildReportsCommand());\n\n// ---------------------------------------------------------------------------\n// fabric completion\n// ---------------------------------------------------------------------------\nprogram.addCommand(buildCompletionCommand());\n\n// ---------------------------------------------------------------------------\n// fabric config\n// ---------------------------------------------------------------------------\nconst config = new Command(\"config\").description(\"Show CLI configuration\");\nconfig\n\t.command(\"path\")\n\t.description(\"Print the path to the config file\")\n\t.action(() => {\n\t\tprocess.stdout.write(`${getConfigPath()}\\n`);\n\t});\nprogram.addCommand(config);\n\n// ---------------------------------------------------------------------------\n// Global error handler — structured JSON for --format json\n// ---------------------------------------------------------------------------\nprocess.on(\"unhandledRejection\", (reason) => {\n\tconst message = reason instanceof Error ? reason.message : String(reason);\n\tif (process.env.FABRIC_FORMAT === \"json\") {\n\t\tprocess.stderr.write(\n\t\t\tJSON.stringify({ error: { message, code: \"UNHANDLED_ERROR\" } }) +\n\t\t\t\t\"\\n\",\n\t\t);\n\t} else {\n\t\tprocess.stderr.write(`✗ ${message}\\n`);\n\t}\n\tprocess.exit(1);\n});\n\nprogram.parse(process.argv);\n","/**\n * fabric agents\n *\n * fabric agents list List agents\n * fabric agents show <id> Show agent details\n */\n\nimport type { FabricAgent } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildAgentsCommand(): Command {\n\tconst agents = new Command(\"agents\").description(\"Manage agents\");\n\n\t// -- list ----------------------------------------------------------------\n\tagents\n\t\t.command(\"list\")\n\t\t.description(\"List agents\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--status <status>\", \"Filter: ACTIVE|INACTIVE|DEPRECATED\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tstatus?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricAgent[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.agents.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| FabricAgent[\"status\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const a of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${a.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"displayName\",\n\t\t\t\t\t\t\"framework\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"createdAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tagents\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show agent details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet agent: FabricAgent;\n\t\t\t\ttry {\n\t\t\t\t\tagent = await client.agents.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(agent, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: agent.id,\n\t\t\t\t\t\"Agent ID\": agent.agentId,\n\t\t\t\t\tName: agent.name,\n\t\t\t\t\t\"Display name\": agent.displayName,\n\t\t\t\t\tFramework: agent.framework,\n\t\t\t\t\tStatus: agent.status,\n\t\t\t\t\t\"Deployment URL\": agent.deploymentUrl ?? \"(none)\",\n\t\t\t\t\tCreated: agent.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- execute -------------------------------------------------------------\n\tagents\n\t\t.command(\"execute <id>\")\n\t\t.description(\"Execute an agent\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--input <json>\", 'Input JSON (e.g. \\'{\"key\":\"value\"}\\')')\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tinput?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\n\t\t\t\tlet inputObj: Record<string, unknown> = {};\n\t\t\t\tif (opts.input) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputObj = JSON.parse(opts.input);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tprintError(\"--input must be valid JSON\", 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet result: import(\"@fabricorg/sdk\").FabricAgentExecution;\n\t\t\t\ttry {\n\t\t\t\t\tresult = await client.agents.execute(id, {\n\t\t\t\t\t\tinput: inputObj,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(result, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\t\"Task ID\": result.taskId,\n\t\t\t\t\t\"Workflow ID\": result.workflowId,\n\t\t\t\t\t\"Run ID\": result.runId ?? \"(pending)\",\n\t\t\t\t\tStatus: result.status,\n\t\t\t\t\t...(result.warning ? { Warning: result.warning } : {}),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn agents;\n}\n","/**\n * Returns a configured FabricClient for CLI commands.\n * Exits with a clear error if no API key is available.\n */\n\nimport { FabricAuthError, FabricClient } from \"@fabricorg/sdk\";\nimport { getApiKey, getBaseUrl } from \"./config.js\";\nimport { printError } from \"./output.js\";\n\nexport function getClient(): FabricClient {\n\tconst apiKey = getApiKey();\n\n\tif (!apiKey) {\n\t\tprintError(\n\t\t\t\"Not authenticated. Run:\\n fabric auth login --key <api-key>\",\n\t\t\t3,\n\t\t);\n\t}\n\n\ttry {\n\t\treturn new FabricClient({ apiKey, baseUrl: getBaseUrl() });\n\t} catch (err: unknown) {\n\t\tif (err instanceof FabricAuthError) {\n\t\t\tprintError(err.message, 3);\n\t\t}\n\t\tthrow err;\n\t}\n}\n","/**\n * Config storage for @fabricorg/cli\n *\n * Persists to XDG_CONFIG_HOME/fabricai/config.json (Linux/macOS)\n * or %APPDATA%\\fabricai\\config.json (Windows).\n *\n * The API key is stored as-is in the config file with 0600 permissions.\n * Future: migrate to system keychain.\n */\n\nimport Conf from \"conf\";\n\ninterface CliConfig {\n\t/** Active profile name */\n\tactiveProfile: string;\n\tprofiles: Record<string, ProfileConfig>;\n\t/** Default output format */\n\tdefaultFormat: \"table\" | \"json\" | \"yaml\" | \"csv\";\n}\n\ninterface ProfileConfig {\n\t/** API key for this profile */\n\tapiKey?: string;\n\t/** Override base URL (e.g. for self-hosted) */\n\tbaseUrl?: string;\n\t/** Default context for commands */\n\tdefaultContext?: ContextConfig;\n}\n\nexport type ContextConfig =\n\t| { type: \"personal\" }\n\t| { type: \"org\"; slug: string };\n\nconst DEFAULTS: CliConfig = {\n\tactiveProfile: \"default\",\n\tprofiles: {},\n\tdefaultFormat: \"table\",\n};\n\nlet _store: Conf<CliConfig> | undefined;\n\nfunction getStore(): Conf<CliConfig> {\n\tif (!_store) {\n\t\t_store = new Conf<CliConfig>({\n\t\t\tprojectName: \"fabricai\",\n\t\t\tdefaults: DEFAULTS,\n\t\t});\n\t}\n\treturn _store;\n}\n\nfunction getConfig(): CliConfig {\n\treturn getStore().store;\n}\n\nfunction getActiveProfile(): ProfileConfig {\n\tconst cfg = getConfig();\n\treturn cfg.profiles[cfg.activeProfile] ?? {};\n}\n\nexport function getApiKey(): string | undefined {\n\t// Env var takes precedence over stored config\n\tif (process.env.FABRIC_API_KEY) {\n\t\treturn process.env.FABRIC_API_KEY;\n\t}\n\treturn getActiveProfile().apiKey;\n}\n\nexport function getBaseUrl(): string | undefined {\n\tif (process.env.FABRIC_BASE_URL) {\n\t\treturn process.env.FABRIC_BASE_URL;\n\t}\n\treturn getActiveProfile().baseUrl;\n}\n\nexport function getDefaultContext(): ContextConfig | undefined {\n\t// Env var takes precedence\n\tif (process.env.FABRIC_ORG) {\n\t\treturn { type: \"org\", slug: process.env.FABRIC_ORG };\n\t}\n\tif (process.env.FABRIC_PERSONAL === \"1\") {\n\t\treturn { type: \"personal\" };\n\t}\n\treturn getActiveProfile().defaultContext;\n}\n\nexport function getOutputFormat(): \"table\" | \"json\" | \"yaml\" | \"csv\" {\n\tif (\n\t\tprocess.env.FABRIC_FORMAT === \"json\" ||\n\t\tprocess.env.FABRIC_FORMAT === \"yaml\" ||\n\t\tprocess.env.FABRIC_FORMAT === \"csv\"\n\t) {\n\t\treturn process.env.FABRIC_FORMAT as \"json\" | \"yaml\" | \"csv\";\n\t}\n\treturn getConfig().defaultFormat;\n}\n\nexport function saveApiKey(apiKey: string, profile = \"default\"): void {\n\tconst store = getStore();\n\tconst profiles = store.get(\"profiles\") as CliConfig[\"profiles\"];\n\tstore.set(\"profiles\", {\n\t\t...profiles,\n\t\t[profile]: { ...(profiles[profile] ?? {}), apiKey },\n\t});\n\tstore.set(\"activeProfile\", profile);\n}\n\nexport function clearApiKey(profile = \"default\"): void {\n\tconst store = getStore();\n\tconst profiles = store.get(\"profiles\") as CliConfig[\"profiles\"];\n\tconst { apiKey: _, ...rest } = profiles[profile] ?? {};\n\tstore.set(\"profiles\", { ...profiles, [profile]: rest });\n}\n\nexport function saveDefaultContext(ctx: ContextConfig, profile?: string): void {\n\tconst store = getStore();\n\tconst active = profile ?? (store.get(\"activeProfile\") as string);\n\tconst profiles = store.get(\"profiles\") as CliConfig[\"profiles\"];\n\tstore.set(\"profiles\", {\n\t\t...profiles,\n\t\t[active]: { ...(profiles[active] ?? {}), defaultContext: ctx },\n\t});\n}\n\nexport function getConfigPath(): string {\n\treturn getStore().path;\n}\n","/**\n * Output formatting for @fabricorg/cli\n *\n * Supports: table (default), json, yaml, csv, quiet (IDs only)\n */\n\nimport Table from \"cli-table3\";\nimport { getOutputFormat } from \"./config.js\";\n\ntype OutputFormat = \"table\" | \"json\" | \"yaml\" | \"csv\" | \"quiet\";\n\nexport interface OutputOptions {\n\tformat?: OutputFormat;\n\t/** Column names to include in table/csv output (in order) */\n\tcolumns?: string[];\n\t/** Key to use for --quiet / IDs-only output */\n\tidKey?: string;\n}\n\n/** Print data to stdout in the selected format. */\nexport function printOutput(data: unknown, opts: OutputOptions = {}): void {\n\tconst format = opts.format ?? (getOutputFormat() as OutputFormat);\n\n\tif (format === \"json\") {\n\t\tprocess.stdout.write(`${JSON.stringify(data, null, 2)}\\n`);\n\t\treturn;\n\t}\n\n\tif (format === \"yaml\") {\n\t\tprocess.stdout.write(`${toYaml(data)}\\n`);\n\t\treturn;\n\t}\n\n\tif (format === \"quiet\") {\n\t\tconst rows = Array.isArray(data) ? data : [data];\n\t\tconst key = opts.idKey ?? \"id\";\n\t\tfor (const row of rows) {\n\t\t\tconst val = (row as Record<string, unknown>)[key];\n\t\t\tif (val !== undefined) {\n\t\t\t\tprocess.stdout.write(`${String(val)}\\n`);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tif (format === \"csv\") {\n\t\tconst rows = Array.isArray(data) ? data : [data];\n\t\tif (rows.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst cols = opts.columns ?? Object.keys(rows[0] as object);\n\t\tprocess.stdout.write(`${cols.map(csvEscape).join(\",\")}\\n`);\n\t\tfor (const row of rows) {\n\t\t\tprocess.stdout.write(\n\t\t\t\t`${cols\n\t\t\t\t\t.map((c) =>\n\t\t\t\t\t\tcsvEscape(\n\t\t\t\t\t\t\tString((row as Record<string, unknown>)[c] ?? \"\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\t.join(\",\")}\\n`,\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\t// Default: table\n\tconst rows = Array.isArray(data) ? data : [data];\n\tif (rows.length === 0) {\n\t\tprocess.stdout.write(\"(no results)\\n\");\n\t\treturn;\n\t}\n\tconst cols = opts.columns ?? Object.keys(rows[0] as object);\n\tconst table = new Table({ head: cols, style: { head: [\"cyan\"] } });\n\tfor (const row of rows) {\n\t\ttable.push(\n\t\t\tcols.map((c) => formatCell((row as Record<string, unknown>)[c])),\n\t\t);\n\t}\n\tprocess.stdout.write(`${table.toString()}\\n`);\n}\n\n/** Print a single key-value object as aligned pairs */\nexport function printRecord(\n\tdata: Record<string, unknown>,\n\topts: OutputOptions = {},\n): void {\n\tconst format = opts.format ?? (getOutputFormat() as OutputFormat);\n\tif (format === \"json\") {\n\t\tprintOutput(data, opts);\n\t\treturn;\n\t}\n\tif (format === \"yaml\") {\n\t\tprintOutput(data, opts);\n\t\treturn;\n\t}\n\tconst table = new Table({ style: { head: [\"cyan\"] } });\n\tfor (const [key, val] of Object.entries(data)) {\n\t\ttable.push({ [key]: formatCell(val) });\n\t}\n\tprocess.stdout.write(`${table.toString()}\\n`);\n}\n\n/** Print a success message to stdout */\nexport function printSuccess(message: string): void {\n\tprocess.stdout.write(`✓ ${message}\\n`);\n}\n\n/** Print an error message to stderr and exit with given code */\nexport function printError(message: string, exitCode = 1): never {\n\tprocess.stderr.write(`✗ ${message}\\n`);\n\tprocess.exit(exitCode);\n}\n\n/** Print a warning to stderr (no exit) */\nexport function printWarning(message: string): void {\n\tprocess.stderr.write(`⚠ ${message}\\n`);\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction formatCell(val: unknown): string {\n\tif (val === null || val === undefined) {\n\t\treturn \"\";\n\t}\n\tif (typeof val === \"boolean\") {\n\t\treturn val ? \"yes\" : \"no\";\n\t}\n\tif (typeof val === \"object\") {\n\t\treturn JSON.stringify(val);\n\t}\n\tconst s = String(val);\n\t// Truncate ISO dates to just the date portion for readability in tables\n\tif (/^\\d{4}-\\d{2}-\\d{2}T/.test(s)) {\n\t\treturn s.slice(0, 10);\n\t}\n\treturn s;\n}\n\nfunction csvEscape(s: string): string {\n\tif (s.includes(\",\") || s.includes('\"') || s.includes(\"\\n\")) {\n\t\treturn `\"${s.replace(/\"/g, '\"\"')}\"`;\n\t}\n\treturn s;\n}\n\n/** Minimal YAML serializer (no dependencies) */\nfunction toYaml(val: unknown, indent = 0): string {\n\tconst pad = \" \".repeat(indent);\n\tif (val === null || val === undefined) {\n\t\treturn \"~\";\n\t}\n\tif (typeof val === \"boolean\" || typeof val === \"number\") {\n\t\treturn String(val);\n\t}\n\tif (typeof val === \"string\") {\n\t\tif (val.includes(\"\\n\") || val.includes(\":\") || val.includes('\"')) {\n\t\t\treturn `\"${val.replace(/\"/g, '\\\\\"')}\"`;\n\t\t}\n\t\treturn val;\n\t}\n\tif (Array.isArray(val)) {\n\t\tif (val.length === 0) {\n\t\t\treturn \"[]\";\n\t\t}\n\t\treturn val\n\t\t\t.map((item) => `${pad}- ${toYaml(item, indent + 1)}`)\n\t\t\t.join(\"\\n\");\n\t}\n\tif (typeof val === \"object\") {\n\t\tconst entries = Object.entries(val as Record<string, unknown>);\n\t\tif (entries.length === 0) {\n\t\t\treturn \"{}\";\n\t\t}\n\t\treturn entries\n\t\t\t.map(([k, v]) => {\n\t\t\t\tconst valStr = toYaml(v, indent + 1);\n\t\t\t\tconst isMultiline = valStr.includes(\"\\n\");\n\t\t\t\treturn isMultiline\n\t\t\t\t\t? `${pad}${k}:\\n${valStr}`\n\t\t\t\t\t: `${pad}${k}: ${valStr}`;\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t}\n\treturn String(val);\n}\n","/**\n * Context resolution for @fabricorg/cli\n *\n * Every resource command runs inside exactly one organization. Personal context\n * is gone (Fizzy #1875, PO-9): the flag, the environment variable and the\n * stored default that selected it are retired here.\n *\n * The stored shape still PARSES a personal default, and that is deliberate.\n * Configs written by earlier versions have one on disk, and a client that\n * crashed on its own config file would be a worse failure than the one being\n * fixed. It is read, recognised, and refused with a message that says how to\n * replace it — never silently treated as \"no default\", which would send the\n * user hunting for a setting they can see is set.\n */\n\nimport type { ContextConfig } from \"./config.js\";\nimport { getDefaultContext } from \"./config.js\";\nimport { printError } from \"./output.js\";\n\nexport interface ResolvedContext {\n\ttype: \"org\";\n\tslug: string;\n}\n\n/** What to do about a personal selection, wherever it came from. */\nfunction refusePersonal(source: string): never {\n\treturn printError(\n\t\t`${source} selects personal context, which no longer exists — every command runs inside an organization.\\n` +\n\t\t\t\"Name one with --org <slug>, or set a default with:\\n fabric ctx use org <slug>\",\n\t\t2,\n\t) as never;\n}\n\n/**\n * Resolves tenant context from CLI flags, env vars, or stored default.\n * Exits with code 2 when context is ambiguous or names a retired one.\n *\n * @param personal - value of the retired --personal flag\n * @param org - value of --org flag\n * @param required - if false, returns undefined when context is unset (for auth commands)\n */\nexport function resolveContext(\n\tpersonal: boolean | undefined,\n\torg: string | undefined,\n\trequired = true,\n): ResolvedContext | undefined {\n\t// Checked before the both-flags case on purpose: whichever way they were\n\t// combined, the useful thing to say is that one of them is retired.\n\tif (personal) {\n\t\trefusePersonal(\"--personal\");\n\t}\n\tif (org) {\n\t\treturn { type: \"org\", slug: org };\n\t}\n\n\t// Fall back to stored default, or the environment variable behind it.\n\tconst stored: ContextConfig | undefined = getDefaultContext();\n\tif (stored) {\n\t\tif (stored.type === \"personal\") {\n\t\t\t// Refused rather than ignored even when context is optional: a\n\t\t\t// default the user set and can still see is not the same as no\n\t\t\t// default, and treating it as one hides why their command behaves\n\t\t\t// differently from yesterday.\n\t\t\trefusePersonal(\n\t\t\t\tprocess.env.FABRIC_PERSONAL === \"1\"\n\t\t\t\t\t? \"FABRIC_PERSONAL=1\"\n\t\t\t\t\t: \"Your stored default context\",\n\t\t\t);\n\t\t}\n\t\tif (stored.type === \"org\") {\n\t\t\treturn { type: \"org\", slug: stored.slug };\n\t\t}\n\t}\n\n\tif (required) {\n\t\tprintError(\n\t\t\t\"Context is required. Use --org <slug>, or set a default with:\\n fabric ctx use org <slug>\",\n\t\t\t2,\n\t\t);\n\t}\n\n\treturn undefined;\n}\n","/**\n * fabric auth keys\n *\n * fabric auth keys list\n * fabric auth keys create --name \"CI deploy\" --scopes workflows:run,agents:read\n * fabric auth keys revoke <id>\n */\n\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { printError, printOutput, printSuccess } from \"../../lib/output.js\";\n\nexport function buildKeysCommand(): Command {\n\tconst keys = new Command(\"keys\").description(\"Manage API keys\");\n\n\t// -- list ----------------------------------------------------------------\n\tkeys.command(\"list\")\n\t\t.description(\"List your API keys\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.action(async (opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet list: Awaited<ReturnType<typeof client.auth.listKeys>>;\n\t\t\ttry {\n\t\t\t\tlist = await client.auth.listKeys();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\t\t\tprintOutput(list, {\n\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\tcolumns: [\n\t\t\t\t\t\"id\",\n\t\t\t\t\t\"name\",\n\t\t\t\t\t\"keyPrefix\",\n\t\t\t\t\t\"scopes\",\n\t\t\t\t\t\"lastUsedAt\",\n\t\t\t\t\t\"expiresAt\",\n\t\t\t\t\t\"createdAt\",\n\t\t\t\t],\n\t\t\t});\n\t\t});\n\n\t// -- create --------------------------------------------------------------\n\tkeys.command(\"create\")\n\t\t.description(\"Create a new API key (raw key shown only once)\")\n\t\t.requiredOption(\"-n, --name <name>\", \"Key name\")\n\t\t.option(\n\t\t\t\"-s, --scopes <scopes>\",\n\t\t\t\"Comma-separated scopes (e.g. projects:read,workflows:run)\",\n\t\t\t\"orgs:read\",\n\t\t)\n\t\t.option(\n\t\t\t\"-e, --expires <days>\",\n\t\t\t\"Days until expiry (1–365, omit for no expiry)\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\tname: string;\n\t\t\t\tscopes: string;\n\t\t\t\texpires?: string;\n\t\t\t\tformat: string;\n\t\t\t}) => {\n\t\t\t\tconst client = getClient();\n\t\t\t\tconst scopes = opts.scopes.split(\",\").map((s) => s.trim());\n\t\t\t\tconst expiresInDays = opts.expires\n\t\t\t\t\t? Number.parseInt(opts.expires, 10)\n\t\t\t\t\t: undefined;\n\n\t\t\t\tif (\n\t\t\t\t\texpiresInDays !== undefined &&\n\t\t\t\t\tNumber.isNaN(expiresInDays)\n\t\t\t\t) {\n\t\t\t\t\tprintError(\"--expires must be a number\", 2);\n\t\t\t\t}\n\n\t\t\t\tlet created: Awaited<ReturnType<typeof client.auth.createKey>>;\n\t\t\t\ttry {\n\t\t\t\t\tcreated = await client.auth.createKey({\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tscopes,\n\t\t\t\t\t\texpiresInDays,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(created, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprocess.stdout.write(\"\\n\");\n\t\t\t\tprintSuccess(`API key created: ${created.name}`);\n\t\t\t\tprocess.stdout.write(`\\n Key: ${created.rawKey}\\n`);\n\t\t\t\tprocess.stdout.write(` Prefix: ${created.keyPrefix}\\n`);\n\t\t\t\tprocess.stdout.write(\n\t\t\t\t\t` Scopes: ${created.scopes.join(\", \")}\\n`,\n\t\t\t\t);\n\t\t\t\tif (created.expiresAt) {\n\t\t\t\t\tprocess.stdout.write(\n\t\t\t\t\t\t` Expires: ${String(created.expiresAt).slice(0, 10)}\\n`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tprocess.stdout.write(\n\t\t\t\t\t\"\\n ⚠ Store this key now — it will never be shown again.\\n\\n\",\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\n\t// -- revoke --------------------------------------------------------------\n\tkeys.command(\"revoke <id>\")\n\t\t.description(\"Permanently revoke an API key\")\n\t\t.action(async (id: string) => {\n\t\t\tconst client = getClient();\n\t\t\ttry {\n\t\t\t\tawait client.auth.revokeKey(id);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\t\t\tprintSuccess(`API key ${id} revoked.`);\n\t\t});\n\n\treturn keys;\n}\n","/**\n * fabric auth login\n *\n * Stores an API key for subsequent commands.\n *\n * fabric auth login --key fab_...\n * fabric auth login (prompts interactively)\n */\n\nimport * as readline from \"node:readline\";\nimport { FabricClient } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getBaseUrl, saveApiKey } from \"../../lib/config.js\";\nimport { printError, printSuccess } from \"../../lib/output.js\";\n\nasync function promptApiKey(): Promise<string> {\n\tconst rl = readline.createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stdout,\n\t});\n\n\treturn new Promise((resolve) => {\n\t\t// Don't echo the key\n\t\tprocess.stdout.write(\"Fabric API Key: \");\n\t\tprocess.stdin.resume();\n\t\tprocess.stdin.setEncoding(\"utf8\");\n\n\t\tlet key = \"\";\n\t\tprocess.stdin.once(\"data\", (chunk) => {\n\t\t\tkey = String(chunk).trim();\n\t\t\tprocess.stdout.write(\"\\n\");\n\t\t\trl.close();\n\t\t\tresolve(key);\n\t\t});\n\t});\n}\n\nexport function buildLoginCommand(): Command {\n\treturn new Command(\"login\")\n\t\t.description(\"Authenticate with a Fabric API key\")\n\t\t.option(\"-k, --key <api-key>\", \"API key (fab_... or org_...)\")\n\t\t.option(\"--base-url <url>\", \"Override the Fabric base URL\")\n\t\t.action(async (opts: { key?: string; baseUrl?: string }) => {\n\t\t\tlet apiKey = opts.key?.trim();\n\n\t\t\tif (!apiKey) {\n\t\t\t\tapiKey = await promptApiKey();\n\t\t\t}\n\n\t\t\tif (!apiKey) {\n\t\t\t\tprintError(\"API key is required\", 2);\n\t\t\t}\n\n\t\t\tif (!apiKey.startsWith(\"fab_\") && !apiKey.startsWith(\"org_\")) {\n\t\t\t\tprintError(\n\t\t\t\t\t\"Invalid API key format. Keys must start with fab_ or org_\",\n\t\t\t\t\t2,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Verify the key works before saving\n\t\t\tconst baseUrl = opts.baseUrl ?? getBaseUrl();\n\t\t\tconst client = new FabricClient({ apiKey, baseUrl });\n\n\t\t\tlet name: string;\n\t\t\tlet email: string;\n\t\t\ttry {\n\t\t\t\tconst me = await client.auth.whoami();\n\t\t\t\tname = me.user.name ?? me.user.email;\n\t\t\t\temail = me.user.email;\n\t\t\t} catch {\n\t\t\t\tprintError(\n\t\t\t\t\t\"Authentication failed. Check that the key is valid and not expired.\",\n\t\t\t\t\t3,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsaveApiKey(apiKey);\n\t\t\tprintSuccess(`Authenticated as ${name} (${email})`);\n\t\t});\n}\n","/**\n * fabric auth logout\n * Removes the stored API key from config.\n */\n\nimport { Command } from \"commander\";\nimport { clearApiKey, getApiKey } from \"../../lib/config.js\";\nimport { printSuccess, printWarning } from \"../../lib/output.js\";\n\nexport function buildLogoutCommand(): Command {\n\treturn new Command(\"logout\")\n\t\t.description(\"Remove stored API key\")\n\t\t.action(() => {\n\t\t\tif (!getApiKey()) {\n\t\t\t\tprintWarning(\"No API key stored — already logged out.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tclearApiKey();\n\t\t\tprintSuccess(\"Logged out. API key removed.\");\n\t\t});\n}\n","/**\n * fabric auth whoami\n * Prints the authenticated identity and org memberships.\n */\n\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildWhoamiCommand(): Command {\n\treturn new Command(\"whoami\")\n\t\t.description(\"Show current authentication and identity\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(async (opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\n\t\t\tlet me: Awaited<ReturnType<typeof client.auth.whoami>>;\n\t\t\ttry {\n\t\t\t\tme = await client.auth.whoami();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message ?? \"Request failed\", 3);\n\t\t\t}\n\n\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\n\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\tprintOutput(me, { format: fmt });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Human-readable\n\t\t\tprintRecord({\n\t\t\t\tUser: me.user.name ?? \"(no name)\",\n\t\t\t\tEmail: me.user.email,\n\t\t\t\tRole: me.user.role,\n\t\t\t\t\"Key type\": me.keyType,\n\t\t\t\t\"Key prefix\": me.keyPrefix,\n\t\t\t\tScopes: me.scopes.join(\", \"),\n\t\t\t\t\"Orgs count\": String(me.orgs.length),\n\t\t\t\t\"Member since\": me.user.createdAt.slice(0, 10),\n\t\t\t});\n\n\t\t\tif (me.orgs.length > 0) {\n\t\t\t\tprocess.stdout.write(\"\\nOrganizations:\\n\");\n\t\t\t\tprintOutput(me.orgs, {\n\t\t\t\t\tformat: \"table\",\n\t\t\t\t\tcolumns: [\"name\", \"slug\", \"role\", \"joinedAt\"],\n\t\t\t\t});\n\t\t\t}\n\t\t});\n}\n","/**\n * fabric chats\n *\n * fabric chats list List AI chat sessions\n * fabric chats show <id> Show chat details\n */\n\nimport type { FabricChat } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildChatsCommand(): Command {\n\tconst chats = new Command(\"chats\").description(\"Manage AI chat sessions\");\n\n\tchats\n\t\t.command(\"list\")\n\t\t.description(\"List AI chat sessions\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricChat[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.chats.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const c of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${c.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"id\", \"title\", \"updatedAt\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\tchats\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show chat details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet chat: FabricChat;\n\t\t\t\ttry {\n\t\t\t\t\tchat = await client.chats.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(chat, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: chat.id,\n\t\t\t\t\tTitle: chat.title ?? \"(untitled)\",\n\t\t\t\t\tUpdated: chat.updatedAt.slice(0, 16).replace(\"T\", \" \"),\n\t\t\t\t\tCreated: chat.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn chats;\n}\n","/**\n * fabric completion\n *\n * fabric completion bash Output bash completion script\n * fabric completion zsh Output zsh completion script\n * fabric completion fish Output fish completion script\n */\n\nimport { Command } from \"commander\";\n\nconst BASH_COMPLETION = `\n# fabric bash completion\n_fabric_completion() {\n local cur prev words cword\n _init_completion || return\n\n local commands=\"auth ctx orgs projects features workflows prompts agents skills mcp frames workspaces chats reports config completion\"\n\n case \"$prev\" in\n fabric)\n COMPREPLY=($(compgen -W \"$commands\" -- \"$cur\"))\n return ;;\n auth)\n COMPREPLY=($(compgen -W \"login logout whoami keys\" -- \"$cur\"))\n return ;;\n keys)\n COMPREPLY=($(compgen -W \"list create revoke\" -- \"$cur\"))\n return ;;\n ctx)\n COMPREPLY=($(compgen -W \"current use\" -- \"$cur\"))\n return ;;\n orgs)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n projects)\n COMPREPLY=($(compgen -W \"list show create update\" -- \"$cur\"))\n return ;;\n features)\n COMPREPLY=($(compgen -W \"list show create update tasks\" -- \"$cur\"))\n return ;;\n workflows)\n COMPREPLY=($(compgen -W \"list show trigger status\" -- \"$cur\"))\n return ;;\n prompts)\n COMPREPLY=($(compgen -W \"list get create update\" -- \"$cur\"))\n return ;;\n agents)\n COMPREPLY=($(compgen -W \"list show execute\" -- \"$cur\"))\n return ;;\n skills)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n mcp)\n COMPREPLY=($(compgen -W \"servers configs\" -- \"$cur\"))\n return ;;\n configs)\n COMPREPLY=($(compgen -W \"list show delete\" -- \"$cur\"))\n return ;;\n frames)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n workspaces)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n chats)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n reports)\n COMPREPLY=($(compgen -W \"templates executions\" -- \"$cur\"))\n return ;;\n templates)\n COMPREPLY=($(compgen -W \"list show\" -- \"$cur\"))\n return ;;\n executions)\n COMPREPLY=($(compgen -W \"list\" -- \"$cur\"))\n return ;;\n completion)\n COMPREPLY=($(compgen -W \"bash zsh fish\" -- \"$cur\"))\n return ;;\n esac\n\n COMPREPLY=($(compgen -W \"--format --org --personal --quiet --help\" -- \"$cur\"))\n}\n\ncomplete -F _fabric_completion fabric\n`.trim();\n\nconst ZSH_COMPLETION = `\n#compdef fabric\n\n_fabric() {\n local state\n\n _arguments \\\\\n '--format[Output format]:format:(table json yaml csv)' \\\\\n '--version[Show version]' \\\\\n '--help[Show help]' \\\\\n '1: :->command' \\\\\n '*: :->args'\n\n case $state in\n command)\n local commands=(\n 'auth:Authenticate and manage API keys'\n 'ctx:Manage active context'\n 'orgs:List organizations'\n 'projects:Manage projects'\n 'features:Manage project features'\n 'workflows:Manage workflows'\n 'prompts:Manage prompts'\n 'agents:Manage agents'\n 'skills:Browse skills'\n 'mcp:Manage MCP servers and configs'\n 'frames:Manage AI-generated frames'\n 'workspaces:Manage workspaces'\n 'chats:View AI chat history'\n 'reports:Manage reports'\n 'config:Show CLI configuration'\n 'completion:Output shell completion script'\n )\n _describe 'command' commands\n ;;\n args)\n case $words[2] in\n auth)\n local subcmds=('login:Log in' 'logout:Log out' 'whoami:Show current user' 'keys:Manage API keys')\n _describe 'subcommand' subcmds ;;\n projects)\n local subcmds=('list:List projects' 'show:Show project' 'create:Create project' 'update:Update project')\n _describe 'subcommand' subcmds ;;\n features)\n local subcmds=('list:List features' 'show:Show feature' 'create:Create feature' 'update:Update feature' 'tasks:List tasks')\n _describe 'subcommand' subcmds ;;\n workflows)\n local subcmds=('list:List workflows' 'show:Show workflow' 'trigger:Trigger workflow' 'status:Check status')\n _describe 'subcommand' subcmds ;;\n prompts)\n local subcmds=('list:List prompts' 'get:Get prompt' 'create:Create prompt' 'update:Update prompt')\n _describe 'subcommand' subcmds ;;\n agents)\n local subcmds=('list:List agents' 'show:Show agent' 'execute:Execute agent')\n _describe 'subcommand' subcmds ;;\n mcp)\n local subcmds=('servers:List MCP servers' 'configs:Manage MCP configs')\n _describe 'subcommand' subcmds ;;\n frames)\n local subcmds=('list:List frames' 'show:Show frame')\n _describe 'subcommand' subcmds ;;\n workspaces)\n local subcmds=('list:List workspaces' 'show:Show workspace')\n _describe 'subcommand' subcmds ;;\n skills)\n local subcmds=('list:List skills' 'show:Show skill')\n _describe 'subcommand' subcmds ;;\n chats)\n local subcmds=('list:List chats' 'show:Show chat')\n _describe 'subcommand' subcmds ;;\n reports)\n local subcmds=('templates:Manage report templates' 'executions:List report executions')\n _describe 'subcommand' subcmds ;;\n completion)\n local subcmds=('bash:Bash completion' 'zsh:Zsh completion' 'fish:Fish completion')\n _describe 'subcommand' subcmds ;;\n esac ;;\n esac\n}\n\n_fabric \"$@\"\n`.trim();\n\nconst FISH_COMPLETION = `\n# fabric fish completion\nset -l fabric_commands auth ctx orgs projects features workflows prompts agents skills mcp frames workspaces chats reports config completion\n\ncomplete -c fabric -f\n\n# Top-level commands\ncomplete -c fabric -n '__fish_use_subcommand' -a auth -d 'Authenticate and manage API keys'\ncomplete -c fabric -n '__fish_use_subcommand' -a ctx -d 'Manage active context'\ncomplete -c fabric -n '__fish_use_subcommand' -a orgs -d 'List organizations'\ncomplete -c fabric -n '__fish_use_subcommand' -a projects -d 'Manage projects'\ncomplete -c fabric -n '__fish_use_subcommand' -a features -d 'Manage project features'\ncomplete -c fabric -n '__fish_use_subcommand' -a workflows -d 'Manage workflows'\ncomplete -c fabric -n '__fish_use_subcommand' -a prompts -d 'Manage prompts'\ncomplete -c fabric -n '__fish_use_subcommand' -a agents -d 'Manage agents'\ncomplete -c fabric -n '__fish_use_subcommand' -a skills -d 'Browse skills'\ncomplete -c fabric -n '__fish_use_subcommand' -a mcp -d 'Manage MCP servers and configs'\ncomplete -c fabric -n '__fish_use_subcommand' -a frames -d 'Manage AI-generated frames'\ncomplete -c fabric -n '__fish_use_subcommand' -a workspaces -d 'Manage workspaces'\ncomplete -c fabric -n '__fish_use_subcommand' -a chats -d 'View AI chat history'\ncomplete -c fabric -n '__fish_use_subcommand' -a reports -d 'Manage reports'\ncomplete -c fabric -n '__fish_use_subcommand' -a config -d 'Show CLI configuration'\ncomplete -c fabric -n '__fish_use_subcommand' -a completion -d 'Output shell completion script'\n\n# Subcommands\ncomplete -c fabric -n '__fish_seen_subcommand_from auth' -a 'login logout whoami keys'\ncomplete -c fabric -n '__fish_seen_subcommand_from ctx' -a 'current use'\ncomplete -c fabric -n '__fish_seen_subcommand_from orgs' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from projects' -a 'list show create update'\ncomplete -c fabric -n '__fish_seen_subcommand_from features' -a 'list show create update tasks'\ncomplete -c fabric -n '__fish_seen_subcommand_from workflows' -a 'list show trigger status'\ncomplete -c fabric -n '__fish_seen_subcommand_from prompts' -a 'list get create update'\ncomplete -c fabric -n '__fish_seen_subcommand_from agents' -a 'list show execute'\ncomplete -c fabric -n '__fish_seen_subcommand_from skills' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from mcp' -a 'servers configs'\ncomplete -c fabric -n '__fish_seen_subcommand_from configs' -a 'list show delete'\ncomplete -c fabric -n '__fish_seen_subcommand_from frames' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from workspaces' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from chats' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from reports' -a 'templates executions'\ncomplete -c fabric -n '__fish_seen_subcommand_from templates' -a 'list show'\ncomplete -c fabric -n '__fish_seen_subcommand_from executions' -a 'list'\ncomplete -c fabric -n '__fish_seen_subcommand_from completion' -a 'bash zsh fish'\n\n# Common flags\ncomplete -c fabric -l format -d 'Output format' -a 'table json yaml csv'\ncomplete -c fabric -l org -d 'Organization context' -r\ncomplete -c fabric -l personal -d 'Personal context'\ncomplete -c fabric -s q -l quiet -d 'Quiet output'\ncomplete -c fabric -l help -d 'Show help'\n`.trim();\n\nexport function buildCompletionCommand(): Command {\n\tconst completion = new Command(\"completion\").description(\n\t\t\"Output shell completion script\",\n\t);\n\n\tcompletion\n\t\t.command(\"bash\")\n\t\t.description(\"Output bash completion script\")\n\t\t.action(() => {\n\t\t\tprocess.stdout.write(`${BASH_COMPLETION}\\n`);\n\t\t\tprocess.stderr.write(\n\t\t\t\t'# Add to ~/.bashrc:\\n# eval \"$(fabric completion bash)\"\\n',\n\t\t\t);\n\t\t});\n\n\tcompletion\n\t\t.command(\"zsh\")\n\t\t.description(\"Output zsh completion script\")\n\t\t.action(() => {\n\t\t\tprocess.stdout.write(`${ZSH_COMPLETION}\\n`);\n\t\t\tprocess.stderr.write(\n\t\t\t\t'# Add to ~/.zshrc:\\n# eval \"$(fabric completion zsh)\"\\n',\n\t\t\t);\n\t\t});\n\n\tcompletion\n\t\t.command(\"fish\")\n\t\t.description(\"Output fish completion script\")\n\t\t.action(() => {\n\t\t\tprocess.stdout.write(`${FISH_COMPLETION}\\n`);\n\t\t\tprocess.stderr.write(\n\t\t\t\t\"# Save to ~/.config/fish/completions/fabric.fish\\n\",\n\t\t\t);\n\t\t});\n\n\treturn completion;\n}\n","/**\n * fabric ctx\n *\n * fabric ctx current Show active context\n * fabric ctx use org <slug> Set an org as default\n *\n * `use personal` is retired (Fizzy #1875, PO-9). It is still REGISTERED rather\n * than deleted, so someone who types it — or has it in a script — is told what\n * replaced it instead of meeting \"unknown command\". A config written by an\n * earlier version can still hold a personal default; `current` reports it as\n * needing replacing rather than printing it as if it still worked.\n */\n\nimport { Command } from \"commander\";\nimport { getDefaultContext, saveDefaultContext } from \"../../lib/config.js\";\nimport { printError, printSuccess, printWarning } from \"../../lib/output.js\";\n\nexport function buildCtxCommand(): Command {\n\tconst ctx = new Command(\"ctx\").description(\n\t\t\"Manage the organization commands run in\",\n\t);\n\n\t// -- current ------------------------------------------------------------\n\tctx.command(\"current\")\n\t\t.description(\"Show the active default context\")\n\t\t.action(() => {\n\t\t\tconst stored = getDefaultContext();\n\t\t\tif (!stored) {\n\t\t\t\tprintWarning(\n\t\t\t\t\t\"No default context set. Use --org <slug> on each command, or run:\\n fabric ctx use org <slug>\",\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (stored.type === \"personal\") {\n\t\t\t\t// Reported, not hidden: it is set, the user can see it is set,\n\t\t\t\t// and saying \"none\" would send them looking for a setting that\n\t\t\t\t// is right there.\n\t\t\t\tprintWarning(\n\t\t\t\t\t\"Context: personal — retired, and no command will accept it.\\nReplace it with:\\n fabric ctx use org <slug>\",\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprocess.stdout.write(`Context: org:${stored.slug}\\n`);\n\t\t});\n\n\t// -- use ----------------------------------------------------------------\n\tconst use = new Command(\"use\").description(\n\t\t\"Set the default organization for commands\",\n\t);\n\n\tuse.command(\"personal\")\n\t\t.description(\"Retired — context is organization-only\")\n\t\t.action(() => {\n\t\t\tprintError(\n\t\t\t\t\"Personal context no longer exists — every command runs inside an organization.\\nSet one with:\\n fabric ctx use org <slug>\",\n\t\t\t\t2,\n\t\t\t);\n\t\t});\n\n\tuse.command(\"org <slug>\")\n\t\t.description(\"Use an org context by default\")\n\t\t.action((slug: string) => {\n\t\t\tsaveDefaultContext({ type: \"org\", slug });\n\t\t\tprintSuccess(`Default context set to: org:${slug}`);\n\t\t});\n\n\tctx.addCommand(use);\n\n\treturn ctx;\n}\n","/**\n * fabric features\n *\n * fabric features list --project <id> List features in a project\n * fabric features show --project <id> <id> Show feature details\n * fabric features create --project <id> <title> Create a feature\n */\n\nimport type { FabricFeature } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildFeaturesCommand(): Command {\n\tconst features = new Command(\"features\").description(\n\t\t\"Manage project features\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tfeatures\n\t\t.command(\"list\")\n\t\t.description(\"List features in a project\")\n\t\t.requiredOption(\"-p, --project <id>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\n\t\t\t\"--priority <priority>\",\n\t\t\t\"Filter: P0_CRITICAL|P1_HIGH|P2_MEDIUM|P3_LOW\",\n\t\t)\n\t\t.option(\"--search <query>\", \"Search by title\")\n\t\t.option(\"--limit <n>\", \"Max results (default 50)\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\tproject: string;\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tpriority?: string;\n\t\t\t\tsearch?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricFeature[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.projects.listFeatures(opts.project, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tpriority: opts.priority as\n\t\t\t\t\t\t\t| FabricFeature[\"priority\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const f of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${f.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"identifier\", \"title\", \"priority\", \"createdAt\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tfeatures\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show feature details\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\tproject: string;\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet feature: FabricFeature;\n\t\t\t\ttry {\n\t\t\t\t\tfeature = await client.projects.getFeature(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(feature, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: feature.id,\n\t\t\t\t\tIdentifier: feature.identifier,\n\t\t\t\t\tTitle: feature.title,\n\t\t\t\t\tPriority: feature.priority,\n\t\t\t\t\tDescription: feature.description ?? \"(none)\",\n\t\t\t\t\t\"Acceptance Criteria\":\n\t\t\t\t\t\tfeature.acceptanceCriteria ?? \"(none)\",\n\t\t\t\t\tProject: feature.projectId,\n\t\t\t\t\tAssignee: feature.assigneeId ?? \"(none)\",\n\t\t\t\t\tCreated: feature.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- create --------------------------------------------------------------\n\tfeatures\n\t\t.command(\"create <title>\")\n\t\t.description(\"Create a feature in a project\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"-d, --description <text>\", \"Feature description\")\n\t\t.option(\n\t\t\t\"--priority <priority>\",\n\t\t\t\"Priority: P0_CRITICAL|P1_HIGH|P2_MEDIUM|P3_LOW (default: P2_MEDIUM)\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\ttitle: string,\n\t\t\t\topts: {\n\t\t\t\t\tproject: string;\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tpriority?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet feature: FabricFeature;\n\t\t\t\ttry {\n\t\t\t\t\tfeature = await client.projects.createFeature(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\t\tpriority: opts.priority as\n\t\t\t\t\t\t\t\t| FabricFeature[\"priority\"]\n\t\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(feature, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(`Feature ${feature.identifier} created`);\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: feature.id,\n\t\t\t\t\tIdentifier: feature.identifier,\n\t\t\t\t\tTitle: feature.title,\n\t\t\t\t\tPriority: feature.priority,\n\t\t\t\t\tProject: feature.projectId,\n\t\t\t\t\tCreated: feature.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- tasks ---------------------------------------------------------------\n\tfeatures\n\t\t.command(\"tasks\")\n\t\t.description(\"List tasks (sub-items) for a feature\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.requiredOption(\"-f, --feature <featureId>\", \"Feature ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\tproject: string;\n\t\t\t\tfeature: string;\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet tasks: import(\"@fabricorg/sdk\").FabricTask[];\n\t\t\t\ttry {\n\t\t\t\t\ttasks = await client.projects.listTasks(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\topts.feature,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const t of tasks) {\n\t\t\t\t\t\tprocess.stdout.write(`${t.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(tasks, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"identifier\",\n\t\t\t\t\t\t\"title\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"estimatedHours\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- update --------------------------------------------------------------\n\tfeatures\n\t\t.command(\"update <id>\")\n\t\t.description(\"Update a feature\")\n\t\t.requiredOption(\"-p, --project <projectId>\", \"Project ID\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--title <title>\", \"New title\")\n\t\t.option(\"-d, --description <text>\", \"New description\")\n\t\t.option(\n\t\t\t\"--priority <priority>\",\n\t\t\t\"Priority: P0_CRITICAL|P1_HIGH|P2_MEDIUM|P3_LOW\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\tproject: string;\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\ttitle?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tpriority?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet feature: FabricFeature;\n\t\t\t\ttry {\n\t\t\t\t\tfeature = await client.projects.updateFeature(\n\t\t\t\t\t\topts.project,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: opts.title,\n\t\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\t\tpriority: opts.priority as\n\t\t\t\t\t\t\t\t| FabricFeature[\"priority\"]\n\t\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(feature, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: feature.id,\n\t\t\t\t\tIdentifier: feature.identifier,\n\t\t\t\t\tTitle: feature.title,\n\t\t\t\t\tPriority: feature.priority,\n\t\t\t\t\tUpdated: feature.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn features;\n}\n","/**\n * fabric frames\n *\n * fabric frames list List frames and slideshows\n * fabric frames show <id> Show frame details\n */\n\nimport type { FabricFrame } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildFramesCommand(): Command {\n\tconst frames = new Command(\"frames\").description(\n\t\t\"Manage AI-generated frames and slideshows\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tframes\n\t\t.command(\"list\")\n\t\t.description(\"List frames and slideshows\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--limit <n>\", \"Max results (default 50)\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricFrame[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.frames.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const f of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${f.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"title\",\n\t\t\t\t\t\t\"fileType\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"isPublic\",\n\t\t\t\t\t\t\"updatedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tframes\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show frame details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet frame: FabricFrame;\n\t\t\t\ttry {\n\t\t\t\t\tframe = await client.frames.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(frame, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: frame.id,\n\t\t\t\t\tTitle: frame.title,\n\t\t\t\t\tKind: frame.kind ?? \"(none)\",\n\t\t\t\t\t\"File Type\": frame.fileType,\n\t\t\t\t\tStatus: frame.status,\n\t\t\t\t\tPublic: frame.isPublic ? \"yes\" : \"no\",\n\t\t\t\t\t\"Share Token\": frame.shareToken ?? \"(none)\",\n\t\t\t\t\tDescription: frame.description ?? \"(none)\",\n\t\t\t\t\tUpdated: frame.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn frames;\n}\n","/**\n * fabric mcp\n *\n * fabric mcp servers List accessible MCP servers\n * fabric mcp configs List your MCP configurations\n * fabric mcp configs show <id> Show a specific MCP configuration\n */\n\nimport type {\n\tFabricMcpConfig,\n\tFabricMcpConfigDetail,\n\tFabricMcpServer,\n} from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildMcpCommand(): Command {\n\tconst mcp = new Command(\"mcp\").description(\n\t\t\"Manage MCP servers and configurations\",\n\t);\n\n\t// -- servers -------------------------------------------------------------\n\tmcp.command(\"servers\")\n\t\t.description(\"List accessible MCP servers (system + custom)\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print server keys only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricMcpServer[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.mcp.listServers({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const s of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${s.key}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"key\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"transport\",\n\t\t\t\t\t\t\"category\",\n\t\t\t\t\t\t\"isSystemProvided\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- configs -------------------------------------------------------------\n\tconst configs = new Command(\"configs\").description(\n\t\t\"Manage MCP configurations\",\n\t);\n\n\tconfigs\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List your MCP configurations\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricMcpConfig[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.mcp.listConfigs({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const c of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${c.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"serverName\",\n\t\t\t\t\t\t\"displayName\",\n\t\t\t\t\t\t\"authType\",\n\t\t\t\t\t\t\"enabled\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\tconfigs\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show a specific MCP configuration\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet config: FabricMcpConfigDetail;\n\t\t\t\ttry {\n\t\t\t\t\tconfig = await client.mcp.getConfig(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(config, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: config.id,\n\t\t\t\t\tServer: config.serverName ?? config.mcpServerId,\n\t\t\t\t\t\"Server Key\": config.serverKey ?? \"(none)\",\n\t\t\t\t\t\"Display Name\": config.displayName ?? \"(none)\",\n\t\t\t\t\t\"Base URL\": config.baseUrl ?? \"(none)\",\n\t\t\t\t\tTransport: config.transport ?? \"(default)\",\n\t\t\t\t\t\"Auth Type\": config.authType,\n\t\t\t\t\tEnabled: config.enabled ? \"yes\" : \"no\",\n\t\t\t\t\tStatus: config.status,\n\t\t\t\t\t\"Last Health Check\":\n\t\t\t\t\t\tconfig.lastHealthCheckAt?.slice(0, 19) ?? \"(never)\",\n\t\t\t\t\tCreated: config.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\tconfigs\n\t\t.command(\"delete <id>\")\n\t\t.description(\"Delete an MCP configuration\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"-y, --yes\", \"Skip confirmation prompt\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; yes?: boolean },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\n\t\t\t\tif (!opts.yes) {\n\t\t\t\t\tprocess.stderr.write(\n\t\t\t\t\t\t`Delete MCP config ${id}? This cannot be undone. Pass --yes to confirm.\\n`,\n\t\t\t\t\t);\n\t\t\t\t\tprocess.exit(2);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait client.mcp.deleteConfig(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tprocess.stdout.write(`MCP config ${id} deleted.\\n`);\n\t\t\t},\n\t\t);\n\n\tmcp.addCommand(configs);\n\n\t// -- serve ---------------------------------------------------------------\n\tmcp.command(\"serve\")\n\t\t.description(\n\t\t\t\"Run a stdio MCP server exposing this workspace's whole integration catalog. \" +\n\t\t\t\t\"Point Claude Desktop, Cursor, or any MCP client at it.\",\n\t\t)\n\t\t.action(async () => {\n\t\t\t// Lazy import — avoids loading the MCP SDK when running other commands\n\t\t\t// and keeps the CLI binary cold-start fast.\n\t\t\tconst { runStdio } = await import(\"@fabricorg/sdk-mcp/stdio\");\n\t\t\tawait runStdio();\n\t\t});\n\n\treturn mcp;\n}\n","/**\n * fabric orgs\n *\n * fabric orgs list List orgs you belong to\n * fabric orgs show <slug> Show org details\n */\n\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildOrgsCommand(): Command {\n\tconst orgs = new Command(\"orgs\").description(\"Manage organizations\");\n\n\t// -- list ----------------------------------------------------------------\n\torgs.command(\"list\")\n\t\t.description(\"List organizations you belong to\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print slugs only\")\n\t\t.action(async (opts: { format: string; quiet?: boolean }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet list: Awaited<ReturnType<typeof client.orgs.list>>;\n\t\t\ttry {\n\t\t\t\tlist = await client.orgs.list();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\n\t\t\tif (opts.quiet) {\n\t\t\t\tfor (const org of list) {\n\t\t\t\t\tprocess.stdout.write(`${org.slug}\\n`);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprintOutput(list, {\n\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\tcolumns: [\"name\", \"slug\", \"role\", \"joinedAt\"],\n\t\t\t});\n\t\t});\n\n\t// -- show ----------------------------------------------------------------\n\torgs.command(\"show <slug>\")\n\t\t.description(\"Show details for an organization\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(async (slug: string, opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet list: Awaited<ReturnType<typeof client.orgs.list>>;\n\t\t\ttry {\n\t\t\t\tlist = await client.orgs.list();\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\n\t\t\tconst org = list.find(\n\t\t\t\t(o: { slug: string; id: string }) =>\n\t\t\t\t\to.slug === slug || o.id === slug,\n\t\t\t);\n\t\t\tif (!org) {\n\t\t\t\tprintError(`Organization not found: ${slug}`, 4);\n\t\t\t}\n\n\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\tprintOutput(org, { format: fmt });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprintRecord({\n\t\t\t\tName: org.name,\n\t\t\t\tSlug: org.slug,\n\t\t\t\tRole: org.role,\n\t\t\t\t\"Joined at\": String(org.joinedAt).slice(0, 10),\n\t\t\t\tLogo: org.logo ?? \"(none)\",\n\t\t\t});\n\t\t});\n\n\treturn orgs;\n}\n","/**\n * fabric projects\n *\n * fabric projects list List projects\n * fabric projects show <id> Show project details\n * fabric projects create <name> Create a project\n */\n\nimport type { FabricProject } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildProjectsCommand(): Command {\n\tconst projects = new Command(\"projects\").description(\"Manage projects\");\n\n\t// -- list ----------------------------------------------------------------\n\tprojects\n\t\t.command(\"list\")\n\t\t.description(\"List projects\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\n\t\t\t\"--status <status>\",\n\t\t\t\"Filter by status: ACTIVE|DRAFT|COMPLETED|ARCHIVED\",\n\t\t)\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tstatus?: string;\n\t\t\t\tsearch?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricProject[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.projects.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| FabricProject[\"status\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const p of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${p.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"id\", \"name\", \"status\", \"createdAt\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tprojects\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show project details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet project: FabricProject;\n\t\t\t\ttry {\n\t\t\t\t\tproject = await client.projects.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(project, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: project.id,\n\t\t\t\t\tName: project.name,\n\t\t\t\t\tStatus: project.status,\n\t\t\t\t\tDescription: project.description ?? \"(none)\",\n\t\t\t\t\tRepository: project.repositoryUrl ?? \"(none)\",\n\t\t\t\t\tCreated: project.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- create --------------------------------------------------------------\n\tprojects\n\t\t.command(\"create <name>\")\n\t\t.description(\"Create a new project\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"-d, --description <text>\", \"Project description\")\n\t\t.option(\"--repo <url>\", \"Repository URL\")\n\t\t.option(\n\t\t\t\"--status <status>\",\n\t\t\t\"Initial status: DRAFT|ACTIVE (default: DRAFT)\",\n\t\t\t\"DRAFT\",\n\t\t)\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tname: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\trepo?: string;\n\t\t\t\t\tstatus: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet project: FabricProject;\n\t\t\t\ttry {\n\t\t\t\t\tproject = await client.projects.create({\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\trepositoryUrl: opts.repo,\n\t\t\t\t\t\tstatus: opts.status as \"DRAFT\" | \"ACTIVE\",\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(project, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(`Project \"${project.name}\" created`);\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: project.id,\n\t\t\t\t\tName: project.name,\n\t\t\t\t\tStatus: project.status,\n\t\t\t\t\tDescription: project.description ?? \"(none)\",\n\t\t\t\t\tCreated: project.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- update --------------------------------------------------------------\n\tprojects\n\t\t.command(\"update <id>\")\n\t\t.description(\"Update a project\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--name <name>\", \"New name\")\n\t\t.option(\"-d, --description <text>\", \"New description\")\n\t\t.option(\"--repo <url>\", \"Repository URL\")\n\t\t.option(\"--status <status>\", \"Status: DRAFT|ACTIVE|COMPLETED|ARCHIVED\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tname?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\trepo?: string;\n\t\t\t\t\tstatus?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet project: FabricProject;\n\t\t\t\ttry {\n\t\t\t\t\tproject = await client.projects.update(id, {\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\trepositoryUrl: opts.repo,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| \"DRAFT\"\n\t\t\t\t\t\t\t| \"ACTIVE\"\n\t\t\t\t\t\t\t| \"COMPLETED\"\n\t\t\t\t\t\t\t| \"ARCHIVED\"\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(project, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: project.id,\n\t\t\t\t\tName: project.name,\n\t\t\t\t\tStatus: project.status,\n\t\t\t\t\tDescription: project.description ?? \"(none)\",\n\t\t\t\t\tUpdated: project.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn projects;\n}\n","/**\n * fabric prompts\n *\n * fabric prompts list List prompt templates\n * fabric prompts get <id> Get a prompt (prints latest version content)\n */\n\nimport type { FabricPrompt } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildPromptsCommand(): Command {\n\tconst prompts = new Command(\"prompts\").description(\n\t\t\"Manage prompt templates\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tprompts\n\t\t.command(\"list\")\n\t\t.description(\"List prompt templates\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--category <cat>\", \"Filter by category\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricPrompt[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.prompts.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const p of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${p.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"key\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"scope\",\n\t\t\t\t\t\t\"category\",\n\t\t\t\t\t\t\"updatedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- get -----------------------------------------------------------------\n\tprompts\n\t\t.command(\"get <id>\")\n\t\t.description(\"Get a prompt (prints latest version content by default)\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: raw|table|json|yaml (default: raw)\",\n\t\t\t\"raw\",\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet prompt: FabricPrompt;\n\t\t\t\ttry {\n\t\t\t\t\tprompt = await client.prompts.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"raw\" | \"table\" | \"json\" | \"yaml\";\n\n\t\t\t\tif (fmt === \"json\") {\n\t\t\t\t\tprintOutput(prompt, { format: \"json\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(prompt, { format: \"yaml\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst content = prompt.versions?.[0]?.content ?? \"(no content)\";\n\n\t\t\t\tif (fmt === \"raw\") {\n\t\t\t\t\tprocess.stdout.write(`${content}\\n`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// table: metadata + content block\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: prompt.id,\n\t\t\t\t\tKey: prompt.key,\n\t\t\t\t\tName: prompt.name,\n\t\t\t\t\tScope: prompt.scope,\n\t\t\t\t\tCategory: prompt.category ?? \"(none)\",\n\t\t\t\t\tTags: (prompt.tags ?? []).join(\", \") || \"(none)\",\n\t\t\t\t});\n\t\t\t\tprocess.stdout.write(`\\n--- Content ---\\n${content}\\n`);\n\t\t\t},\n\t\t);\n\n\t// -- create --------------------------------------------------------------\n\tprompts\n\t\t.command(\"create\")\n\t\t.description(\"Create a new prompt\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.requiredOption(\"--key <key>\", \"Prompt key (unique identifier)\")\n\t\t.requiredOption(\"--name <name>\", \"Prompt name\")\n\t\t.option(\"-d, --description <text>\", \"Prompt description\")\n\t\t.option(\"--content <text>\", \"Initial prompt content\")\n\t\t.option(\"--category <cat>\", \"Category\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tkey: string;\n\t\t\t\tname: string;\n\t\t\t\tdescription?: string;\n\t\t\t\tcontent?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tformat: string;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet prompt: FabricPrompt;\n\t\t\t\ttry {\n\t\t\t\t\tprompt = await client.prompts.create({\n\t\t\t\t\t\tkey: opts.key,\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\tcontent: opts.content,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(prompt, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(`Prompt \"${prompt.name}\" created`);\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: prompt.id,\n\t\t\t\t\tKey: prompt.key,\n\t\t\t\t\tName: prompt.name,\n\t\t\t\t\tScope: prompt.scope,\n\t\t\t\t\tCreated: prompt.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- update --------------------------------------------------------------\n\tprompts\n\t\t.command(\"update <id>\")\n\t\t.description(\"Update a prompt\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--name <name>\", \"New name\")\n\t\t.option(\"-d, --description <text>\", \"New description\")\n\t\t.option(\"--category <cat>\", \"Category\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tname?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tcategory?: string;\n\t\t\t\t\tformat: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet prompt: FabricPrompt;\n\t\t\t\ttry {\n\t\t\t\t\tprompt = await client.prompts.update(id, {\n\t\t\t\t\t\tname: opts.name,\n\t\t\t\t\t\tdescription: opts.description,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(prompt, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: prompt.id,\n\t\t\t\t\tKey: prompt.key,\n\t\t\t\t\tName: prompt.name,\n\t\t\t\t\tScope: prompt.scope,\n\t\t\t\t\tUpdated: prompt.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn prompts;\n}\n","/**\n * fabric reports\n *\n * fabric reports templates list List report templates\n * fabric reports templates show <id> Show template details\n * fabric reports executions list List report executions\n */\n\nimport type {\n\tFabricReportExecution,\n\tFabricReportTemplate,\n} from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildReportsCommand(): Command {\n\tconst reports = new Command(\"reports\").description(\n\t\t\"Manage report templates and executions\",\n\t);\n\n\t// -- templates -----------------------------------------------------------\n\tconst templates = new Command(\"templates\").description(\n\t\t\"Manage report templates\",\n\t);\n\n\ttemplates\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List report templates\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--category <cat>\", \"Filter by category\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricReportTemplate[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.reports.listTemplates({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const t of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${t.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"templateType\",\n\t\t\t\t\t\t\"scope\",\n\t\t\t\t\t\t\"usageCount\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\ttemplates\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show report template details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet tmpl: FabricReportTemplate;\n\t\t\t\ttry {\n\t\t\t\t\ttmpl = await client.reports.getTemplate(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(tmpl, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: tmpl.id,\n\t\t\t\t\tName: tmpl.name,\n\t\t\t\t\tType: tmpl.templateType,\n\t\t\t\t\tScope: tmpl.scope,\n\t\t\t\t\tCategory: tmpl.category ?? \"(none)\",\n\t\t\t\t\tTags: tmpl.tags.join(\", \") || \"(none)\",\n\t\t\t\t\tPublic: tmpl.isPublic ? \"yes\" : \"no\",\n\t\t\t\t\t\"Use Count\": String(tmpl.usageCount),\n\t\t\t\t\tDescription: tmpl.description ?? \"(none)\",\n\t\t\t\t\tUpdated: tmpl.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treports.addCommand(templates);\n\n\t// -- executions ----------------------------------------------------------\n\tconst executions = new Command(\"executions\").description(\n\t\t\"View report executions\",\n\t);\n\n\texecutions\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List report executions\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricReportExecution[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.reports.listExecutions({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const e of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${e.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"templateId\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"startedAt\",\n\t\t\t\t\t\t\"completedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treports.addCommand(executions);\n\n\treturn reports;\n}\n","/**\n * fabric skills\n *\n * fabric skills list Browse skill definitions\n * fabric skills show <id> Show skill details\n */\n\nimport type { FabricSkill } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildSkillsCommand(): Command {\n\tconst skills = new Command(\"skills\").description(\n\t\t\"Browse skill definitions\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tskills\n\t\t.command(\"list\")\n\t\t.description(\"List skills\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--category <cat>\", \"Filter by category\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"50\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print slugs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tcategory?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricSkill[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.skills.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tcategory: opts.category,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const s of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${s.slug}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\"slug\", \"name\", \"category\", \"scope\", \"useCount\"],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tskills\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show skill details (accepts ID or slug)\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(async (id: string, opts: { format: string }) => {\n\t\t\tconst client = getClient();\n\t\t\tlet skill: FabricSkill;\n\t\t\ttry {\n\t\t\t\tskill = await client.skills.get(id);\n\t\t\t} catch (err: unknown) {\n\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t}\n\n\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\tprintOutput(skill, { format: fmt });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tprintRecord({\n\t\t\t\tID: skill.id,\n\t\t\t\tSlug: skill.slug,\n\t\t\t\tName: skill.name,\n\t\t\t\tCategory: skill.category ?? \"(none)\",\n\t\t\t\tScope: skill.scope,\n\t\t\t\tTags: skill.tags.join(\", \") || \"(none)\",\n\t\t\t\tPublished: skill.isPublished ? \"yes\" : \"no\",\n\t\t\t\t\"Use Count\": String(skill.useCount),\n\t\t\t\tVersion: String(skill.version),\n\t\t\t\tDescription: skill.description,\n\t\t\t\tUpdated: skill.updatedAt.slice(0, 10),\n\t\t\t});\n\t\t});\n\n\treturn skills;\n}\n","/**\n * fabric workflows\n *\n * fabric workflows list List workflows\n * fabric workflows show <id> Show workflow details\n * fabric workflows trigger <id> Trigger a workflow execution\n * fabric workflows status <id> <execId> Get execution status\n */\n\nimport type { FabricExecution, FabricWorkflow } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport {\n\tprintError,\n\tprintOutput,\n\tprintRecord,\n\tprintSuccess,\n} from \"../../lib/output.js\";\n\nexport function buildWorkflowsCommand(): Command {\n\tconst workflows = new Command(\"workflows\").description(\"Manage workflows\");\n\n\t// -- list ----------------------------------------------------------------\n\tworkflows\n\t\t.command(\"list\")\n\t\t.description(\"List workflows\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--status <status>\", \"Filter: DRAFT|ACTIVE|PAUSED|ARCHIVED\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--limit <n>\", \"Max results\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tstatus?: string;\n\t\t\t\tsearch?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricWorkflow[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.workflows.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| FabricWorkflow[\"status\"]\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const w of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${w.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"triggerType\",\n\t\t\t\t\t\t\"createdAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tworkflows\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show workflow details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet wf: FabricWorkflow;\n\t\t\t\ttry {\n\t\t\t\t\twf = await client.workflows.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(wf, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: wf.id,\n\t\t\t\t\tName: wf.name,\n\t\t\t\t\tStatus: wf.status,\n\t\t\t\t\tTrigger: wf.triggerType,\n\t\t\t\t\tVersion: String(wf.version),\n\t\t\t\t\tCreated: wf.createdAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- trigger -------------------------------------------------------------\n\tworkflows\n\t\t.command(\"trigger <id>\")\n\t\t.description(\"Trigger a workflow execution\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--input <json>\", \"JSON input for triggerData\", \"{}\")\n\t\t.option(\"--vars <json>\", \"JSON variables\", \"{}\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: {\n\t\t\t\t\torg?: string;\n\t\t\t\t\tpersonal?: boolean;\n\t\t\t\t\tinput: string;\n\t\t\t\t\tvars: string;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\n\t\t\t\tlet triggerData: Record<string, unknown> = {};\n\t\t\t\tlet variables: Record<string, unknown> = {};\n\t\t\t\ttry {\n\t\t\t\t\ttriggerData = JSON.parse(opts.input);\n\t\t\t\t\tvariables = JSON.parse(opts.vars);\n\t\t\t\t} catch {\n\t\t\t\t\tprintError(\"--input and --vars must be valid JSON\", 2);\n\t\t\t\t}\n\n\t\t\t\tlet result: {\n\t\t\t\t\texecutionId: string;\n\t\t\t\t\tworkflowId: string;\n\t\t\t\t\tstatus: string;\n\t\t\t\t};\n\t\t\t\ttry {\n\t\t\t\t\tresult = await client.workflows.trigger(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\ttriggerData,\n\t\t\t\t\t\tvariables,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tprintSuccess(\"Workflow triggered\");\n\t\t\t\tprocess.stdout.write(` Execution ID: ${result.executionId}\\n`);\n\t\t\t\tprocess.stdout.write(` Status: ${result.status}\\n`);\n\t\t\t},\n\t\t);\n\n\t// -- status --------------------------------------------------------------\n\tworkflows\n\t\t.command(\"status <id> <execId>\")\n\t\t.description(\"Get workflow execution status\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\texecId: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet exec: FabricExecution;\n\t\t\t\ttry {\n\t\t\t\t\texec = await client.workflows.getExecution(id, execId, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(exec, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: exec.id,\n\t\t\t\t\t\"Workflow ID\": exec.workflowId,\n\t\t\t\t\tStatus: exec.status,\n\t\t\t\t\t\"Trigger type\": exec.triggerType,\n\t\t\t\t\tStarted: exec.startedAt?.slice(0, 19) ?? \"(not started)\",\n\t\t\t\t\tCompleted: exec.completedAt?.slice(0, 19) ?? \"(running)\",\n\t\t\t\t\tError: exec.error ?? \"(none)\",\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn workflows;\n}\n","/**\n * fabric workspaces\n *\n * fabric workspaces list List workspaces\n * fabric workspaces show <id> Show workspace details\n */\n\nimport type { FabricWorkspace, FabricWorkspaceDetail } from \"@fabricorg/sdk\";\nimport { Command } from \"commander\";\nimport { getClient } from \"../../lib/client.js\";\nimport { resolveContext } from \"../../lib/context.js\";\nimport { printError, printOutput, printRecord } from \"../../lib/output.js\";\n\nexport function buildWorkspacesCommand(): Command {\n\tconst workspaces = new Command(\"workspaces\").description(\n\t\t\"Manage workspaces\",\n\t);\n\n\t// -- list ----------------------------------------------------------------\n\tworkspaces\n\t\t.command(\"list\")\n\t\t.description(\"List workspaces\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--search <query>\", \"Search by name\")\n\t\t.option(\"--status <status>\", \"Filter: ACTIVE|ARCHIVED\")\n\t\t.option(\"--limit <n>\", \"Max results (default 20)\", \"20\")\n\t\t.option(\n\t\t\t\"--format <format>\",\n\t\t\t\"Output format: table|json|yaml|csv\",\n\t\t\t\"table\",\n\t\t)\n\t\t.option(\"-q, --quiet\", \"Print IDs only\")\n\t\t.action(\n\t\t\tasync (opts: {\n\t\t\t\torg?: string;\n\t\t\t\tpersonal?: boolean;\n\t\t\t\tsearch?: string;\n\t\t\t\tstatus?: string;\n\t\t\t\tlimit: string;\n\t\t\t\tformat: string;\n\t\t\t\tquiet?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet list: FabricWorkspace[];\n\t\t\t\ttry {\n\t\t\t\t\tlist = await client.workspaces.list({\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t\tsearch: opts.search,\n\t\t\t\t\t\tstatus: opts.status as\n\t\t\t\t\t\t\t| \"ACTIVE\"\n\t\t\t\t\t\t\t| \"ARCHIVED\"\n\t\t\t\t\t\t\t| undefined,\n\t\t\t\t\t\tlimit: Number(opts.limit),\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tif (opts.quiet) {\n\t\t\t\t\tfor (const w of list) {\n\t\t\t\t\t\tprocess.stdout.write(`${w.id}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintOutput(list, {\n\t\t\t\t\tformat: opts.format as \"table\" | \"json\" | \"yaml\" | \"csv\",\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t\"id\",\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t\t\"status\",\n\t\t\t\t\t\t\"documentCount\",\n\t\t\t\t\t\t\"updatedAt\",\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t// -- show ----------------------------------------------------------------\n\tworkspaces\n\t\t.command(\"show <id>\")\n\t\t.description(\"Show workspace details\")\n\t\t.option(\"--org <slug>\", \"Organization context\")\n\t\t.option(\"--personal\", \"Retired — context is organization-only\")\n\t\t.option(\"--format <format>\", \"Output format: table|json|yaml\", \"table\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tid: string,\n\t\t\t\topts: { org?: string; personal?: boolean; format: string },\n\t\t\t) => {\n\t\t\t\tconst ctx = resolveContext(opts.personal, opts.org, false);\n\t\t\t\tconst client = getClient();\n\t\t\t\tlet ws: FabricWorkspaceDetail;\n\t\t\t\ttry {\n\t\t\t\t\tws = await client.workspaces.get(id, {\n\t\t\t\t\t\torg: ctx?.type === \"org\" ? ctx.slug : undefined,\n\t\t\t\t\t});\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tprintError((err as Error).message, 1);\n\t\t\t\t}\n\n\t\t\t\tconst fmt = opts.format as \"table\" | \"json\" | \"yaml\";\n\t\t\t\tif (fmt === \"json\" || fmt === \"yaml\") {\n\t\t\t\t\tprintOutput(ws, { format: fmt });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprintRecord({\n\t\t\t\t\tID: ws.id,\n\t\t\t\t\tName: ws.name,\n\t\t\t\t\tType: ws.type,\n\t\t\t\t\tStatus: ws.status,\n\t\t\t\t\tDescription: ws.description ?? \"(none)\",\n\t\t\t\t\tDocuments: String(ws.documentCount),\n\t\t\t\t\tConversations: String(ws.conversationCount),\n\t\t\t\t\tUpdated: ws.updatedAt.slice(0, 10),\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\treturn workspaces;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,WAAAA,iBAAe;;;ACRxB,SAAS,eAAe;;;ACHxB,SAAS,iBAAiB,oBAAoB;;;ACK9C,OAAO,UAAU;AAuBjB,IAAM,WAAsB;AAAA,EAC3B,eAAe;AAAA,EACf,UAAU,CAAC;AAAA,EACX,eAAe;AAChB;AAEA,IAAI;AAEJ,SAAS,WAA4B;AACpC,MAAI,CAAC,QAAQ;AACZ,aAAS,IAAI,KAAgB;AAAA,MAC5B,aAAa;AAAA,MACb,UAAU;AAAA,IACX,CAAC;AAAA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;AACzC,YAAQ,OAAO;AAAA,MACd,KAAK,UAAU,EAAE,OAAO,EAAE,SAAS,MAAM,kBAAkB,EAAE,CAAC,IAC7D;AAAA,IACF;AAAA,EACD,OAAO;AACN,YAAQ,OAAO,MAAM,UAAK,OAAO;AAAA,CAAI;AAAA,EACtC;AACA,UAAQ,KAAK,CAAC;AACf,CAAC;AAED,QAAQ,MAAM,QAAQ,IAAI;","names":["Command","_a","_a","rows","cols","_a","Command","Command","FabricClient","Command","Command","_a","FabricClient","Command","Command","Command","Command","_a","Command","Command","_a","Command","Command","Command","Command","Command","_a","Command","Command","_a","Command","Command","_a","config","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command","Command","_a","Command"]}