sharetribe-cli 1.15.1 → 1.16.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.
- package/dist/index.js +12 -9
- package/dist/index.js.map +3 -3
- package/package.json +5 -3
- package/src/commands/assets/index.ts +372 -85
- package/src/commands/debug.ts +6 -16
- package/src/commands/search/index.ts +19 -7
- package/test/assets.test.ts +156 -0
- package/test/help-comparison.test.ts +29 -0
- package/test/strict-comparison.test.ts +13 -2
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/commands/version.ts", "../src/commands/login.ts", "../src/commands/logout.ts", "../src/commands/process/list.ts", "../src/util/output.ts", "../src/commands/process/create.ts", "../src/commands/process/push.ts", "../src/commands/process/pull.ts", "../src/commands/process/aliases.ts", "../src/commands/process/combined.ts", "../src/commands/process/index.ts", "../src/commands/search/index.ts", "../src/commands/assets/index.ts", "../src/commands/notifications/index.ts", "../src/commands/listing-approval.ts", "../src/commands/events/index.ts", "../src/commands/stripe/index.ts", "../src/commands/debug.ts", "../src/util/help-formatter.ts", "../src/util/command-router.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Sharetribe CLI - Unofficial 100% compatible implementation\n *\n * Main entry point for the CLI application\n */\n\nimport { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, join } from 'node:path';\nimport { version } from './commands/version.js';\nimport { login } from './commands/login.js';\nimport { logout } from './commands/logout.js';\nimport { registerProcessCommands } from './commands/process/index.js';\nimport { registerSearchCommands } from './commands/search/index.js';\nimport { registerAssetsCommands } from './commands/assets/index.js';\nimport { registerNotificationsCommands } from './commands/notifications/index.js';\nimport { registerListingApprovalCommand } from './commands/listing-approval.js';\nimport { registerEventsCommand } from './commands/events/index.js';\nimport { registerStripeCommands } from './commands/stripe/index.js';\nimport { debug } from './commands/debug.js';\nimport { configureHelp } from './util/help-formatter.js';\nimport { routeProcessCommand } from './util/command-router.js';\n\n// Get package.json for version info\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst packageJson = JSON.parse(\n readFileSync(join(__dirname, '../package.json'), 'utf-8')\n);\n\n// Route argv to handle process subcommands\nconst routedArgv = routeProcessCommand(process.argv);\n\nconst program = new Command();\n\n// Configure custom help formatter to match flex-cli\nconfigureHelp(program);\n\n// Configure output to add trailing newline (flex-cli behavior)\nprogram.configureOutput({\n writeOut: (str) => process.stdout.write(str + '\\n'),\n writeErr: (str) => process.stderr.write(str + '\\n'),\n});\n\n// Configure the main program\nprogram\n .name('sharetribe-cli')\n .description('CLI to interact with Sharetribe Flex')\n .version(packageJson.version, '-V', 'output the version number')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier');\n\n// Register commands\n\n// version command\nprogram\n .command('version')\n .description('show version')\n .action(() => {\n version();\n });\n\n// login command\nprogram\n .command('login')\n .description('log in with API key')\n .action(async () => {\n await login();\n });\n\n// logout command\nprogram\n .command('logout')\n .description('logout')\n .action(async () => {\n await logout();\n });\n\n// debug command\nprogram\n .command('debug')\n .description('display debug info')\n .action(() => {\n debug();\n });\n\n// Register process commands\nregisterProcessCommands(program);\n\n// Register search commands\nregisterSearchCommands(program);\n\n// Register assets commands\nregisterAssetsCommands(program);\n\n// Register notifications commands\nregisterNotificationsCommands(program);\n\n// Register listing-approval command\nregisterListingApprovalCommand(program);\n\n// Register events command\nregisterEventsCommand(program);\n\n// Register stripe commands\nregisterStripeCommands(program);\n\n// Register custom help command (to support \"help process list\" syntax)\nprogram\n .command('help [command...]')\n .description('display help for Flex CLI')\n .action((commandPath: string[]) => {\n if (!commandPath || commandPath.length === 0) {\n program.outputHelp();\n return;\n }\n\n // Navigate to the nested command\n let targetCmd: Command = program;\n for (const cmdName of commandPath) {\n const subCmd = targetCmd.commands.find(c => c.name() === cmdName);\n if (!subCmd) {\n console.error(`Unknown command: ${commandPath.join(' ')}`);\n process.exit(1);\n }\n targetCmd = subCmd;\n }\n\n // Show help for the target command\n targetCmd.outputHelp();\n });\n\n// If no command specified, show help and exit with status 0\nif (!routedArgv.slice(2).length) {\n program.outputHelp();\n // Don't call process.exit() - let Commander handle it naturally with exitOverride\n} else {\n // Parse command line arguments with routed argv\n program.parse(routedArgv);\n}\n", "/**\n * Version command - displays the CLI version\n *\n * Must match flex-cli output format exactly\n */\n\nimport { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, join } from 'node:path';\n\n/**\n * Finds package.json by traversing up from current file\n */\nfunction findPackageJson(): string {\n const __filename = fileURLToPath(import.meta.url);\n let currentDir = dirname(__filename);\n\n // Traverse up to find package.json\n while (currentDir !== '/') {\n try {\n const pkgPath = join(currentDir, 'package.json');\n const content = readFileSync(pkgPath, 'utf-8');\n return content;\n } catch {\n currentDir = dirname(currentDir);\n }\n }\n\n throw new Error('Could not find package.json');\n}\n\n/**\n * Displays the version of the CLI\n *\n * Output must match flex-cli exactly\n */\nexport function version(): void {\n const packageJson = JSON.parse(findPackageJson());\n console.log(packageJson.version);\n}\n", "/**\n * Login command - interactive API key authentication\n *\n * Must match flex-cli behavior exactly:\n * - Prompt for API key\n * - Store in ~/.config/flex-cli/auth.edn\n * - Display admin email on success\n */\n\nimport inquirer from 'inquirer';\nimport { writeAuth } from 'sharetribe-flex-build-sdk';\n\n/**\n * Executes the login command\n *\n * Prompts for API key and stores it in auth.edn\n */\nexport async function login(): Promise<void> {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n name: 'apiKey',\n message: 'Enter API key:',\n mask: '*',\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return 'API key cannot be empty';\n }\n return true;\n },\n },\n ]);\n\n // Store the API key\n writeAuth({ apiKey: answers.apiKey });\n\n // TODO: Validate API key by making a test request to get admin email\n // For now, just confirm storage\n console.log('Successfully logged in.');\n\n // Note: flex-cli displays admin email after successful login\n // We'll need to implement API client to fetch this\n}\n", "/**\n * Logout command - clears authentication\n *\n * Must match flex-cli behavior exactly\n */\n\nimport { clearAuth } from 'sharetribe-flex-build-sdk';\n\n/**\n * Executes the logout command\n *\n * Clears auth.edn file\n */\nexport async function logout(): Promise<void> {\n await clearAuth();\n console.log('Successfully logged out.');\n}\n", "/**\n * Process list command - lists all transaction processes\n */\n\nimport {\n listProcesses as sdkListProcesses,\n listProcessVersions as sdkListProcessVersions,\n} from 'sharetribe-flex-build-sdk';\nimport { printTable, printError } from '../../util/output.js';\n\n\n/**\n * Formats timestamp to match flex-cli format for process list\n */\nfunction formatProcessTimestamp(timestamp: string): string {\n try {\n const date = new Date(timestamp);\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n const timeString = date.toLocaleTimeString('en-US');\n\n return `${year}-${month}-${day} ${timeString}`;\n } catch {\n return timestamp;\n }\n}\n\n/**\n * Lists all processes for a marketplace\n */\nexport async function listProcesses(marketplace: string, processName?: string): Promise<void> {\n try {\n // If processName is specified, show version history for that process\n if (processName) {\n const versions = await sdkListProcessVersions(undefined, marketplace, processName);\n\n if (versions.length === 0) {\n console.log(`No versions found for process: ${processName}`);\n return;\n }\n\n const versionRows = versions.map((v) => ({\n 'Created': formatProcessTimestamp(v.createdAt),\n 'Version': v.version.toString(),\n 'Aliases': v.aliases?.join(', ') || '',\n 'Transactions': v.transactionCount?.toString() || '0',\n }));\n\n printTable(['Created', 'Version', 'Aliases', 'Transactions'], versionRows);\n } else {\n // List all processes\n const processes = await sdkListProcesses(undefined, marketplace);\n\n if (processes.length === 0) {\n console.log('No processes found.');\n return;\n }\n\n const processRows = processes.map((p) => ({\n 'Name': p.name,\n 'Latest version': p.version?.toString() || '',\n }));\n\n printTable(['Name', 'Latest version'], processRows);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to list processes');\n }\n process.exit(1);\n }\n}\n", "/**\n * Output formatting utilities\n *\n * Must match flex-cli output format exactly\n */\n\nimport chalk from 'chalk';\n\n/**\n * Prints a table with headers and rows\n *\n * Matches flex-cli table formatting exactly\n */\nexport function printTable(headers: string[], rows: Array<Record<string, string>>): void {\n if (rows.length === 0) {\n return;\n }\n\n // Calculate column widths\n // flex-cli uses keywords (e.g., :version) which when stringified include the ':' prefix\n // To match flex-cli widths, we add 1 to header length to simulate the ':' prefix\n const widths: Record<string, number> = {};\n for (const header of headers) {\n widths[header] = header.length + 1; // +1 to match flex-cli keyword string behavior\n }\n\n for (const row of rows) {\n for (const header of headers) {\n const value = row[header] || '';\n widths[header] = Math.max(widths[header] || 0, value.length);\n }\n }\n\n // Print empty line before table (like flex-cli)\n console.log('');\n\n // Print header with bold formatting\n // flex-cli format: each column padded to (max_width + 1), with single space separator between columns\n // Last column: padding but no separator (interpose doesn't add separator after last element)\n const headerParts = headers.map((h, i) => {\n const width = widths[h] || 0;\n const padded = h.padEnd(width + 1);\n return i === headers.length - 1 ? padded : padded + ' ';\n });\n const headerRow = headerParts.join('');\n console.log(chalk.bold.black(headerRow));\n\n // Print rows with same formatting\n for (const row of rows) {\n const rowParts = headers.map((h, i) => {\n const value = row[h] || '';\n const width = widths[h] || 0;\n const padded = value.padEnd(width + 1);\n return i === headers.length - 1 ? padded : padded + ' ';\n });\n const rowStr = rowParts.join('');\n console.log(rowStr);\n }\n\n // Print empty line after table (like flex-cli)\n console.log('');\n}\n\n/**\n * Prints an error message\n */\nexport function printError(message: string): void {\n console.error(chalk.red(`Error: ${message}`));\n}\n\n/**\n * Prints a success message\n */\nexport function printSuccess(message: string): void {\n console.log(chalk.green(message));\n}\n\n/**\n * Prints a warning message\n */\nexport function printWarning(message: string): void {\n console.log(chalk.yellow(`Warning: ${message}`));\n}\n", "/**\n * Process create command\n */\n\nimport { createProcess as sdkCreateProcess } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Creates a new transaction process\n */\nexport async function createProcess(\n marketplace: string,\n processName: string,\n path: string\n): Promise<void> {\n try {\n const processFilePath = join(path, 'process.edn');\n const processContent = readFileSync(processFilePath, 'utf-8');\n\n const result = await sdkCreateProcess(undefined, marketplace, processName, processContent);\n\n printSuccess(\n `Process ${result.name} successfully created with version ${result.version}.`\n );\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to create process');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process push command\n */\n\nimport { pushProcess as sdkPushProcess } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { readFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Reads email templates from the templates directory\n */\nfunction readTemplates(path: string): Array<{ name: string; html: string; subject: string }> {\n const templatesDir = join(path, 'templates');\n const templates: Array<{ name: string; html: string; subject: string }> = [];\n\n try {\n const templateDirs = readdirSync(templatesDir);\n for (const templateName of templateDirs) {\n const templatePath = join(templatesDir, templateName);\n const htmlFile = join(templatePath, `${templateName}-html.html`);\n const subjectFile = join(templatePath, `${templateName}-subject.txt`);\n\n try {\n const html = readFileSync(htmlFile, 'utf-8');\n const subject = readFileSync(subjectFile, 'utf-8');\n templates.push({ name: templateName, html, subject });\n } catch {\n // Skip if files don't exist\n }\n }\n } catch {\n // No templates directory - return empty array\n }\n\n return templates;\n}\n\n/**\n * Pushes a new version of an existing process\n */\nexport async function pushProcess(\n marketplace: string,\n processName: string,\n path: string\n): Promise<void> {\n try {\n const processFilePath = join(path, 'process.edn');\n const processContent = readFileSync(processFilePath, 'utf-8');\n const templates = readTemplates(path);\n\n const result = await sdkPushProcess(undefined, marketplace, processName, processContent, templates);\n\n if (result.noChanges) {\n console.log('No changes');\n } else {\n printSuccess(`Version ${result.version} successfully saved for process ${processName}.`);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to push process');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process pull command\n */\n\nimport { getProcess } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { writeFileSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Pulls a process from the server\n */\nexport async function pullProcess(\n marketplace: string,\n processName: string,\n path: string,\n version?: string,\n alias?: string\n): Promise<void> {\n try {\n const process = await getProcess(undefined, marketplace, processName, { version, alias });\n\n if (!process.definition) {\n throw new Error('No process definition in response');\n }\n\n // Ensure directory exists (print message if creating new directory)\n const { existsSync } = await import('node:fs');\n const dirExists = existsSync(path);\n mkdirSync(path, { recursive: true });\n\n if (!dirExists) {\n console.error(`Creating a new directory: ${path}`);\n }\n\n // Write process.edn file\n const processFilePath = join(path, 'process.edn');\n writeFileSync(processFilePath, process.definition, 'utf-8');\n\n // Write email templates if they exist\n const templates = process.emailTemplates || [];\n\n if (templates && Array.isArray(templates) && templates.length > 0) {\n const templatesDir = join(path, 'templates');\n mkdirSync(templatesDir, { recursive: true });\n\n for (const template of templates) {\n const templateName = template.name;\n const htmlContent = template.html;\n const subjectContent = template.subject;\n\n if (templateName) {\n // Create subdirectory for this template\n const templateSubdir = join(templatesDir, templateName);\n mkdirSync(templateSubdir, { recursive: true });\n\n // Write HTML file\n if (htmlContent) {\n const htmlPath = join(templateSubdir, `${templateName}-html.html`);\n writeFileSync(htmlPath, htmlContent, 'utf-8');\n }\n\n // Write subject file\n if (subjectContent) {\n const subjectPath = join(templateSubdir, `${templateName}-subject.txt`);\n writeFileSync(subjectPath, subjectContent, 'utf-8');\n }\n }\n }\n }\n\n console.error(`Saved process to ${path}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to pull process');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process alias commands\n */\n\nimport {\n createAlias as sdkCreateAlias,\n updateAlias as sdkUpdateAlias,\n deleteAlias as sdkDeleteAlias\n} from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\n\n/**\n * Creates a process alias\n */\nexport async function createAlias(\n marketplace: string,\n processName: string,\n version: number,\n alias: string\n): Promise<void> {\n try {\n const result = await sdkCreateAlias(undefined, marketplace, processName, version, alias);\n\n printSuccess(\n `Alias ${result.alias} successfully created to point to version ${result.version}.`\n );\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to create alias');\n }\n process.exit(1);\n }\n}\n\n/**\n * Updates a process alias\n */\nexport async function updateAlias(\n marketplace: string,\n processName: string,\n version: number,\n alias: string\n): Promise<void> {\n try {\n const result = await sdkUpdateAlias(undefined, marketplace, processName, version, alias);\n\n printSuccess(\n `Alias ${result.alias} successfully updated to point to version ${result.version}.`\n );\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to update alias');\n }\n process.exit(1);\n }\n}\n\n/**\n * Deletes a process alias\n */\nexport async function deleteAlias(\n marketplace: string,\n processName: string,\n alias: string\n): Promise<void> {\n try {\n const result = await sdkDeleteAlias(undefined, marketplace, processName, alias);\n\n printSuccess(`Alias ${result.alias} successfully deleted.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to delete alias');\n }\n process.exit(1);\n }\n}\n", "/**\n * Combined process command - create-or-push-and-create-or-update-alias\n *\n * This is the enhanced \"superset\" feature that combines multiple operations\n * into one atomic command\n */\n\nimport { deployProcess as sdkDeployProcess, parseProcessFile } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Creates or pushes a process and creates or updates an alias\n *\n * This is an atomic operation that:\n * 1. Tries to push a new version (create-version)\n * 2. If process doesn't exist, creates it\n * 3. Then creates or updates the alias\n */\nexport async function createOrPushAndCreateOrUpdateAlias(\n marketplace: string,\n processName: string,\n path: string,\n alias: string\n): Promise<void> {\n try {\n const processFilePath = join(path, 'process.edn');\n const processContent = readFileSync(processFilePath, 'utf-8');\n const processDefinition = parseProcessFile(processContent);\n\n const result = await sdkDeployProcess(\n undefined, // Use auth from file\n marketplace,\n {\n process: processName,\n alias,\n path: processFilePath,\n processDefinition,\n }\n );\n\n if (result.processCreated) {\n printSuccess(`Process ${processName} successfully created.`);\n }\n\n printSuccess(`Version ${result.version} successfully saved for process ${processName}.`);\n\n if (result.aliasCreated) {\n printSuccess(`Alias ${result.alias} successfully created to point to version ${result.version}.`);\n } else {\n printSuccess(`Alias ${result.alias} successfully updated to point to version ${result.version}.`);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to create/push process and alias');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process command - main entry point for process subcommands\n */\n\nimport { Command } from 'commander';\nimport { listProcesses } from './list.js';\nimport { createProcess } from './create.js';\nimport { pushProcess } from './push.js';\nimport { pullProcess } from './pull.js';\nimport { createAlias, updateAlias, deleteAlias } from './aliases.js';\nimport { createOrPushAndCreateOrUpdateAlias } from './combined.js';\n\n/**\n * Registers all process subcommands\n */\nexport function registerProcessCommands(program: Command): void {\n // Register the parent 'process' command for help display\n const processCmd = program\n .command('process')\n .description('describe a process file')\n .option('--path <PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('--transition <TRANSITION_NAME>', 'transition name, e.g. transition/request to get more details of it')\n .action(async (options) => {\n // Process describe functionality\n if (options.path) {\n console.log(`Describing process at: ${options.path}`);\n if (options.transition) {\n console.log(`Transition: ${options.transition}`);\n }\n // TODO: Implement actual process file parsing and description\n console.log('Process description not yet implemented');\n } else {\n // If no options, show help\n processCmd.outputHelp();\n }\n });\n\n // Register subcommands - these are registered as BOTH subcommands (for help) and top-level (for routing)\n\n // process list (as subcommand)\n processCmd\n .command('list')\n .description('list all transaction processes')\n .option('--process <PROCESS_NAME>', 'print version and alias info of a specific process')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await listProcesses(marketplace, options.process);\n });\n\n // process create\n processCmd\n .command('create')\n .description('create a new transaction process')\n .requiredOption('--process <PROCESS_NAME>', 'name for the new process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createProcess(marketplace, options.process, options.path);\n });\n\n // process push\n processCmd\n .command('push')\n .description('push a process file to the remote')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pushProcess(marketplace, options.process, options.path);\n });\n\n // process pull\n processCmd\n .command('pull')\n .description('fetch a process file')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path where to save the process')\n .option('--version <VERSION_NUM>', 'version number')\n .option('--alias <PROCESS_ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pullProcess(marketplace, options.process, options.path, options.version, options.alias);\n });\n\n // process create-alias\n processCmd\n .command('create-alias')\n .description('create a new alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .allowUnknownOption(false)\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n // process update-alias\n processCmd\n .command('update-alias')\n .description('update an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await updateAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n // process delete-alias\n processCmd\n .command('delete-alias')\n .description('delete an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await deleteAlias(marketplace, options.process, options.alias);\n });\n\n // process deploy (combined command: create-or-push-and-create-or-update-alias)\n processCmd\n .command('deploy')\n .description('deploy a process file with alias (create/push + alias create/update)')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory with the process files')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createOrPushAndCreateOrUpdateAlias(\n marketplace,\n options.process,\n options.path,\n options.alias\n );\n });\n\n // Register top-level command aliases for routing (hidden from help)\n // These handle the routed commands like 'process-pull' that avoid Commander's parent/child option conflicts\n\n program\n .command('process-list', { hidden: true })\n .description('list all transaction processes')\n .option('--process <PROCESS_NAME>', 'print version and alias info of a specific process')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await listProcesses(marketplace, options.process);\n });\n\n program\n .command('process-create', { hidden: true })\n .description('create a new transaction process')\n .requiredOption('--process <PROCESS_NAME>', 'name for the new process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createProcess(marketplace, options.process, options.path);\n });\n\n program\n .command('process-push', { hidden: true })\n .description('push a process file to the remote')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pushProcess(marketplace, options.process, options.path);\n });\n\n program\n .command('process-pull', { hidden: true })\n .description('fetch a process file')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path where to save the process')\n .option('--version <VERSION_NUM>', 'version number')\n .option('--alias <PROCESS_ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pullProcess(marketplace, options.process, options.path, options.version, options.alias);\n });\n\n program\n .command('process-create-alias', { hidden: true })\n .description('create a new alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n program\n .command('process-update-alias', { hidden: true })\n .description('update an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await updateAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n program\n .command('process-delete-alias', { hidden: true })\n .description('delete an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await deleteAlias(marketplace, options.process, options.alias);\n });\n\n program\n .command('process-deploy', { hidden: true })\n .description('deploy a process file with alias (create/push + alias create/update)')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory with the process files')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createOrPushAndCreateOrUpdateAlias(\n marketplace,\n options.process,\n options.path,\n options.alias\n );\n });\n}\n", "/**\n * Search command - manage search schemas\n */\n\nimport { Command } from 'commander';\nimport {\n listSearchSchemas as sdkListSearchSchemas,\n setSearchSchema as sdkSetSearchSchema,\n unsetSearchSchema as sdkUnsetSearchSchema,\n} from 'sharetribe-flex-build-sdk';\nimport { printTable, printError } from '../../util/output.js';\n\ninterface SetSchemaOptions {\n key: string;\n scope: string;\n type: string;\n doc?: string;\n default?: string;\n schemaFor?: string;\n}\n\ninterface UnsetSchemaOptions {\n key: string;\n scope: string;\n schemaFor?: string;\n}\n\n/**\n * Scope label mapping\n */\nconst SCOPE_LABELS: Record<string, string> = {\n metadata: 'Metadata',\n private: 'Private data',\n protected: 'Protected data',\n public: 'Public data',\n};\n\n/**\n * Sets a search schema field\n */\nasync function setSearchSchema(marketplace: string, opts: SetSchemaOptions): Promise<void> {\n try {\n await sdkSetSearchSchema(undefined, marketplace, {\n key: opts.key,\n scope: opts.scope,\n type: opts.type,\n doc: opts.doc,\n defaultValue: opts.default,\n schemaFor: opts.schemaFor,\n });\n\n const schemaFor = opts.schemaFor || 'listing';\n const scopeLabel = SCOPE_LABELS[opts.scope] || opts.scope;\n console.log(`${scopeLabel} schema, ${opts.key} is successfully set for ${schemaFor}.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to set search schema');\n }\n process.exit(1);\n }\n}\n\n/**\n * Unsets a search schema field\n */\nasync function unsetSearchSchema(marketplace: string, opts: UnsetSchemaOptions): Promise<void> {\n try {\n await sdkUnsetSearchSchema(undefined, marketplace, {\n key: opts.key,\n scope: opts.scope,\n schemaFor: opts.schemaFor,\n });\n\n const schemaFor = opts.schemaFor || 'listing';\n const scopeLabel = SCOPE_LABELS[opts.scope] || opts.scope;\n console.log(`${scopeLabel} schema, ${opts.key} is successfully unset for ${schemaFor}.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to unset search schema');\n }\n process.exit(1);\n }\n}\n\n/**\n * Converts default value to display string\n */\nfunction getDefaultValueLabel(value: unknown): string {\n if (value === undefined || value === null) {\n return '';\n }\n\n if (Array.isArray(value)) {\n return value.join(', ');\n }\n\n return String(value);\n}\n\n/**\n * Lists all search schemas\n */\nasync function listSearchSchemas(marketplace: string): Promise<void> {\n try {\n const schemas = await sdkListSearchSchemas(undefined, marketplace);\n\n if (schemas.length === 0) {\n console.log('No search schemas found.');\n return;\n }\n\n // Map and sort the data (by schema-for, scope, key)\n const rows = schemas\n .map((s) => ({\n 'Schema for': s.schemaFor,\n 'Scope': s.scope,\n 'Key': s.key,\n 'Type': s.type,\n 'Default value': getDefaultValueLabel(s.defaultValue),\n 'Doc': s.doc || '',\n }))\n .sort((a, b) => {\n // Sort by schema-for, then scope, then key\n if (a['Schema for'] !== b['Schema for']) {\n return a['Schema for'].localeCompare(b['Schema for']);\n }\n if (a['Scope'] !== b['Scope']) {\n return a['Scope'].localeCompare(b['Scope']);\n }\n return a['Key'].localeCompare(b['Key']);\n });\n\n // Print table using flex-cli compatible formatting\n const headers = ['Schema for', 'Scope', 'Key', 'Type', 'Default value', 'Doc'];\n\n // Calculate column widths\n // flex-cli uses keywords (e.g., :version) which when stringified include the ':' prefix\n // To match flex-cli widths, we add 1 to header length to simulate the ':' prefix\n const widths: Record<string, number> = {};\n for (const h of headers) {\n widths[h] = h.length + 1;\n }\n for (const row of rows) {\n for (const h of headers) {\n const value = row[h] || '';\n widths[h] = Math.max(widths[h], value.length);\n }\n }\n\n // Print empty line before table\n console.log('');\n\n // Print header\n // flex-cli search format: each column padded to max_width, with 2 space separator between columns\n // Last column: padding with trailing space\n const headerParts = headers.map((h, i) => {\n const width = widths[h] || 0;\n const padded = h.padEnd(width);\n return i === headers.length - 1 ? padded + ' ' : padded + ' ';\n });\n console.log(headerParts.join(''));\n\n // Print rows\n for (const row of rows) {\n const rowParts = headers.map((h, i) => {\n const value = row[h] || '';\n const width = widths[h] || 0;\n const padded = value.padEnd(width);\n return i === headers.length - 1 ? padded + ' ' : padded + ' ';\n });\n console.log(rowParts.join(''));\n }\n\n // Print empty line after table\n console.log('');\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to list search schemas');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers search commands\n */\nexport function registerSearchCommands(program: Command): void {\n const searchCmd = program\n .command('search')\n .description('list all search schemas')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await listSearchSchemas(marketplace);\n });\n\n // search set\n searchCmd\n .command('set')\n .description('set search schema')\n .requiredOption('--key <KEY>', 'schema key')\n .requiredOption('--scope <SCOPE>', 'schema scope')\n .requiredOption('--type <TYPE>', 'value type (enum, multi-enum, boolean, long, or text)')\n .option('--doc <DOC>', 'description of the schema')\n .option('--default <DEFAULT>', 'default value for search if value is not set')\n .option('--schema-for <SCHEMA_FOR>', 'subject of the schema (listing, userProfile, or transaction)')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await setSearchSchema(marketplace, {\n key: opts.key,\n scope: opts.scope,\n type: opts.type,\n doc: opts.doc,\n default: opts.default,\n schemaFor: opts.schemaFor,\n });\n });\n\n // search unset\n searchCmd\n .command('unset')\n .description('unset search schema')\n .requiredOption('--key <KEY>', 'schema key')\n .requiredOption('--scope <SCOPE>', 'schema scope')\n .option('--schema-for <SCHEMA_FOR>', 'subject of the schema (listing, userProfile, or transaction)')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await unsetSearchSchema(marketplace, {\n key: opts.key,\n scope: opts.scope,\n schemaFor: opts.schemaFor,\n });\n });\n}\n", "/**\n * Assets commands - manage marketplace assets\n */\n\nimport { Command } from 'commander';\nimport {\n pullAssets as sdkPullAssets,\n pushAssets as sdkPushAssets,\n} from 'sharetribe-flex-build-sdk';\nimport { printError } from '../../util/output.js';\nimport { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, statSync, unlinkSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { createHash } from 'node:crypto';\nimport chalk from 'chalk';\nimport edn from 'jsedn';\n\n\ninterface AssetMetadata {\n version: string;\n assets: Array<{ path: string; 'content-hash': string }>;\n}\n\n/**\n * Reads asset metadata from .flex-cli/asset-meta.edn\n */\nfunction readAssetMetadata(basePath: string): AssetMetadata | null {\n const metaPath = join(basePath, '.flex-cli', 'asset-meta.edn');\n if (!existsSync(metaPath)) {\n return null;\n }\n\n try {\n const content = readFileSync(metaPath, 'utf-8');\n const parsed = edn.parse(content);\n\n // Convert EDN map to JavaScript object\n const version = parsed.at(edn.kw(':version'));\n const assets = parsed.at(edn.kw(':assets'));\n\n const assetList: Array<{ path: string; 'content-hash': string }> = [];\n if (assets && assets.val) {\n for (const asset of assets.val) {\n assetList.push({\n path: asset.at(edn.kw(':path')),\n 'content-hash': asset.at(edn.kw(':content-hash')),\n });\n }\n }\n\n return { version, assets: assetList };\n } catch {\n return null;\n }\n}\n\n/**\n * Writes asset metadata to .flex-cli/asset-meta.edn\n */\nfunction writeAssetMetadata(basePath: string, metadata: AssetMetadata): void {\n const metaDir = join(basePath, '.flex-cli');\n if (!existsSync(metaDir)) {\n mkdirSync(metaDir, { recursive: true });\n }\n\n const assets = metadata.assets.map(a =>\n new edn.Map([\n edn.kw(':path'), a.path,\n edn.kw(':content-hash'), a['content-hash']\n ])\n );\n\n const ednMap = new edn.Map([\n edn.kw(':version'), metadata.version,\n edn.kw(':assets'), new edn.Vector(assets)\n ]);\n\n const metaPath = join(basePath, '.flex-cli', 'asset-meta.edn');\n writeFileSync(metaPath, edn.encode(ednMap), 'utf-8');\n}\n\n/**\n * Calculates SHA-1 hash of file content\n */\nfunction calculateHash(data: Buffer): string {\n const prefix = Buffer.from(`${data.length}|`, 'utf-8');\n return createHash('sha1').update(prefix).update(data).digest('hex');\n}\n\n/**\n * Reads all assets from a directory\n */\nfunction readLocalAssets(basePath: string): Array<{ path: string; data: Buffer; hash: string }> {\n const assets: Array<{ path: string; data: Buffer; hash: string }> = [];\n\n function scanDir(dir: string, relativePath: string = '') {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n if (entry === '.flex-cli') continue; // Skip metadata directory\n\n const fullPath = join(dir, entry);\n const relPath = relativePath ? join(relativePath, entry) : entry;\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n scanDir(fullPath, relPath);\n } else if (stat.isFile()) {\n const data = readFileSync(fullPath);\n const hash = calculateHash(data);\n assets.push({ path: relPath, data, hash });\n }\n }\n }\n\n scanDir(basePath);\n return assets;\n}\n\n/**\n * Validates JSON files\n */\nfunction validateJsonAssets(assets: Array<{ path: string; data: Buffer }>): void {\n for (const asset of assets) {\n if (asset.path.endsWith('.json')) {\n try {\n JSON.parse(asset.data.toString('utf-8'));\n } catch (error) {\n throw new Error(`Invalid JSON in ${asset.path}: ${error}`);\n }\n }\n }\n}\n\n/**\n * Pulls assets from remote\n */\nasync function pullAssets(\n marketplace: string,\n path: string,\n version?: string,\n prune?: boolean\n): Promise<void> {\n try {\n // Validate path\n if (!existsSync(path)) {\n mkdirSync(path, { recursive: true });\n }\n\n const stat = statSync(path);\n if (!stat.isDirectory()) {\n throw new Error(`${path} is not a directory`);\n }\n\n // Fetch assets from API\n const result = await sdkPullAssets(undefined, marketplace, version ? { version } : undefined);\n const remoteVersion = result.version;\n\n // Read current metadata\n const currentMeta = readAssetMetadata(path);\n\n // Check if up to date\n if (currentMeta && currentMeta.version === remoteVersion && result.assets.length === currentMeta.assets.length) {\n console.log('Assets are up to date.');\n return;\n }\n\n // Write assets to disk\n const newAssets: Array<{ path: string; 'content-hash': string }> = [];\n for (const asset of result.assets) {\n const assetPath = join(path, asset.path);\n const assetDir = dirname(assetPath);\n\n if (!existsSync(assetDir)) {\n mkdirSync(assetDir, { recursive: true });\n }\n\n // Decode base64 data\n const data = Buffer.from(asset.dataRaw, 'base64');\n writeFileSync(assetPath, data);\n\n const hash = calculateHash(data);\n newAssets.push({ path: asset.path, 'content-hash': asset.contentHash || hash });\n }\n\n // Prune deleted assets if requested\n if (prune && currentMeta) {\n const remotePaths = new Set(result.assets.map(a => a.path));\n for (const localAsset of currentMeta.assets) {\n if (!remotePaths.has(localAsset.path)) {\n const assetPath = join(path, localAsset.path);\n if (existsSync(assetPath)) {\n unlinkSync(assetPath);\n }\n }\n }\n }\n\n // Update metadata\n writeAssetMetadata(path, {\n version: remoteVersion,\n assets: newAssets,\n });\n\n console.log(`Version ${remoteVersion} successfully pulled.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to pull assets');\n }\n process.exit(1);\n }\n}\n\n/**\n * Pushes assets to remote\n */\nasync function pushAssets(\n marketplace: string,\n path: string,\n prune?: boolean\n): Promise<void> {\n try {\n // Validate path\n if (!existsSync(path) || !statSync(path).isDirectory()) {\n throw new Error(`${path} is not a valid directory`);\n }\n\n // Read current metadata\n const currentMeta = readAssetMetadata(path);\n const currentVersion = currentMeta?.version || 'nil';\n\n // Read local assets\n const localAssets = readLocalAssets(path);\n\n // Validate JSON files\n validateJsonAssets(localAssets);\n\n // Build operations\n const operations: Array<{\n path: string;\n op: 'upsert' | 'delete';\n data?: Buffer;\n }> = [];\n\n // Find assets to upsert (new or changed)\n const localAssetMap = new Map(localAssets.map(a => [a.path, a]));\n const currentAssetMap = new Map((currentMeta?.assets || []).map(a => [a.path, a['content-hash']]));\n\n for (const [assetPath, asset] of localAssetMap) {\n const currentHash = currentAssetMap.get(assetPath);\n if (!currentHash || currentHash !== asset.hash) {\n operations.push({\n path: assetPath,\n op: 'upsert',\n data: asset.data,\n });\n }\n }\n\n // Find assets to delete (if prune enabled)\n if (prune && currentMeta) {\n for (const currentAsset of currentMeta.assets) {\n if (!localAssetMap.has(currentAsset.path)) {\n operations.push({\n path: currentAsset.path,\n op: 'delete',\n });\n }\n }\n }\n\n // Check if there are any changes\n if (operations.length === 0) {\n console.log('Assets are up to date.');\n return;\n }\n\n const changedAssetPaths = operations\n .filter(op => op.op === 'upsert')\n .map(op => op.path);\n if (changedAssetPaths.length > 0) {\n console.log(chalk.green(`Uploading changed assets: ${changedAssetPaths.join(', ')}`));\n }\n\n // Upload to API\n const result = await sdkPushAssets(undefined, marketplace, currentVersion, operations);\n\n // Update local metadata\n writeAssetMetadata(path, {\n version: result.version,\n assets: result.assets.map(a => ({\n path: a.path,\n 'content-hash': a.contentHash,\n })),\n });\n\n console.log(`New version ${result.version} successfully created.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to push assets');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers assets commands\n */\nexport function registerAssetsCommands(program: Command): void {\n const assetsCmd = program.command('assets').description('manage marketplace assets');\n\n // assets pull\n assetsCmd\n .command('pull')\n .description('pull assets from remote')\n .requiredOption('--path <PATH>', 'path to directory where assets will be stored')\n .option('--version <VERSION>', 'version of assets to pull')\n .option('--prune', 'delete local files no longer present as remote assets')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pullAssets(marketplace, opts.path, opts.version, opts.prune);\n });\n\n // assets push\n assetsCmd\n .command('push')\n .description('push assets to remote')\n .requiredOption('--path <PATH>', 'path to directory with assets')\n .option('--prune', 'delete remote assets no longer present locally')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pushAssets(marketplace, opts.path, opts.prune);\n });\n}\n", "/**\n * Notifications commands - manage email notifications\n */\n\nimport { Command } from 'commander';\nimport {\n sendNotification as sdkSendNotification,\n previewNotification as sdkPreviewNotification,\n} from 'sharetribe-flex-build-sdk';\nimport { printError } from '../../util/output.js';\nimport { readFileSync, existsSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { createServer, IncomingMessage, ServerResponse } from 'node:http';\n\n\n/**\n * Reads a notification template from a directory\n */\nfunction readTemplate(templatePath: string): { html: string; subject: string } {\n if (!existsSync(templatePath) || !statSync(templatePath).isDirectory()) {\n throw new Error(`Template directory not found: ${templatePath}`);\n }\n\n const htmlPath = join(templatePath, 'template.html');\n const subjectPath = join(templatePath, 'template-subject.txt');\n\n if (!existsSync(htmlPath)) {\n throw new Error(`template.html not found in ${templatePath}`);\n }\n\n if (!existsSync(subjectPath)) {\n throw new Error(`template-subject.txt not found in ${templatePath}`);\n }\n\n const html = readFileSync(htmlPath, 'utf-8');\n const subject = readFileSync(subjectPath, 'utf-8').trim();\n\n return { html, subject };\n}\n\n/**\n * Reads template context JSON file\n */\nfunction readContext(contextPath?: string): unknown {\n if (!contextPath) {\n return undefined;\n }\n\n if (!existsSync(contextPath)) {\n throw new Error(`Context file not found: ${contextPath}`);\n }\n\n const content = readFileSync(contextPath, 'utf-8');\n try {\n return JSON.parse(content);\n } catch (error) {\n throw new Error(`Invalid JSON in context file: ${error}`);\n }\n}\n\n/**\n * Sends a preview email to the marketplace admin\n */\nasync function sendNotification(\n marketplace: string,\n templatePath: string,\n contextPath?: string\n): Promise<void> {\n try {\n const template = readTemplate(templatePath);\n const context = readContext(contextPath);\n\n const result = await sdkSendNotification(undefined, marketplace, { template, context });\n\n console.log(`Preview successfully sent to ${result.adminEmail}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to send notification');\n }\n process.exit(1);\n }\n}\n\n/**\n * Previews a notification in the browser\n */\nasync function previewNotification(\n marketplace: string,\n templatePath: string,\n contextPath?: string\n): Promise<void> {\n try {\n const template = readTemplate(templatePath);\n const context = readContext(contextPath);\n\n console.log(`Template: ${templatePath}`);\n console.log(`Subject: ${template.subject}`);\n console.log('');\n console.log('Starting preview server at http://localhost:3535');\n console.log('Press Ctrl+C to stop');\n console.log('');\n\n let previewHtml: string | null = null;\n\n // Fetch preview from API\n const fetchPreview = async () => {\n try {\n const result = await sdkPreviewNotification(undefined, marketplace, { template, context });\n\n // Inject title into HTML\n const html = result.html;\n const titleTag = `<title>${template.subject}</title>`;\n\n if (html.includes('<head>')) {\n previewHtml = html.replace('<head>', `<head>\\n${titleTag}`);\n } else if (html.includes('<html>')) {\n previewHtml = html.replace('<html>', `<html>\\n<head>${titleTag}</head>`);\n } else {\n previewHtml = `<html><head>${titleTag}</head><body>${html}</body></html>`;\n }\n } catch (error) {\n const errorMessage = error && typeof error === 'object' && 'message' in error\n ? (error.message as string)\n : 'Failed to preview notification';\n\n previewHtml = `\n <html>\n <head><title>Error</title></head>\n <body style=\"font-family: sans-serif; padding: 20px;\">\n <h1 style=\"color: #d32f2f;\">Error</h1>\n <pre style=\"background: #f5f5f5; padding: 15px; border-radius: 4px;\">${errorMessage}</pre>\n </body>\n </html>\n `;\n }\n };\n\n // Initial fetch\n await fetchPreview();\n\n // Create HTTP server\n const server = createServer(async (req: IncomingMessage, res: ServerResponse) => {\n if (req.url === '/' || req.url === '') {\n // Refresh preview on each request\n await fetchPreview();\n\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.end(previewHtml);\n } else {\n res.writeHead(404, { 'Content-Type': 'text/plain' });\n res.end('Not Found');\n }\n });\n\n server.listen(3535, () => {\n console.log('Preview server started. Open http://localhost:3535 in your browser.');\n });\n\n // Handle graceful shutdown\n const shutdown = () => {\n console.log('\\nShutting down preview server...');\n server.close(() => {\n process.exit(0);\n });\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to preview notification');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers notifications commands\n */\nexport function registerNotificationsCommands(program: Command): void {\n const notificationsCmd = program\n .command('notifications')\n .description('manage email notifications');\n\n // notifications preview\n notificationsCmd\n .command('preview')\n .description('render a preview of an email template')\n .requiredOption('--template <TEMPLATE_DIR>', 'path to template directory')\n .option('--context <CONTEXT_FILE>', 'path to email rendering context JSON file')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await previewNotification(marketplace, opts.template, opts.context);\n });\n\n // notifications send\n notificationsCmd\n .command('send')\n .description('send a preview of an email template to the logged in admin')\n .requiredOption('--template <TEMPLATE_DIR>', 'path to template directory')\n .option('--context <CONTEXT_FILE>', 'path to email rendering context JSON file')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await sendNotification(marketplace, opts.template, opts.context);\n });\n}\n", "/**\n * Listing approval command - DEPRECATED\n *\n * This command is deprecated and should not be used.\n * Use the Sharetribe Console instead.\n */\n\nimport { Command } from 'commander';\nimport {\n getListingApprovalStatus as sdkGetStatus,\n enableListingApproval as sdkEnable,\n disableListingApproval as sdkDisable,\n} from 'sharetribe-flex-build-sdk';\nimport { printError } from '../util/output.js';\n\n/**\n * Gets current listing approval status\n */\nasync function getStatus(marketplace: string): Promise<void> {\n try {\n const result = await sdkGetStatus(undefined, marketplace);\n\n if (result.enabled) {\n console.log(`Listing approvals are enabled in ${marketplace}`);\n } else {\n console.log(`Listing approvals are disabled in ${marketplace}`);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to get listing approval status');\n }\n process.exit(1);\n }\n}\n\n/**\n * Enables listing approvals\n */\nasync function enableApprovals(marketplace: string): Promise<void> {\n try {\n await sdkEnable(undefined, marketplace);\n console.log(`Successfully enabled listing approvals in ${marketplace}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to enable listing approvals');\n }\n process.exit(1);\n }\n}\n\n/**\n * Disables listing approvals\n */\nasync function disableApprovals(marketplace: string): Promise<void> {\n try {\n await sdkDisable(undefined, marketplace);\n console.log(`Successfully disabled listing approvals in ${marketplace}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to disable listing approvals');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers listing-approval command\n */\nexport function registerListingApprovalCommand(program: Command): void {\n const cmd = program\n .command('listing-approval')\n .description('manage listing approvals (DEPRECATED - use Console instead)')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier');\n\n // Default action - show status\n cmd.action(async (opts) => {\n console.warn('Warning: CLI command `listing-approval` is deprecated. Use Console instead.');\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await getStatus(marketplace);\n });\n\n // Enable subcommand\n cmd\n .command('enable')\n .description('enable listing approvals')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n console.warn('Warning: CLI command `listing-approval` is deprecated. Use Console instead.');\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await enableApprovals(marketplace);\n });\n\n // Disable subcommand\n cmd\n .command('disable')\n .description('disable listing approvals')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n console.warn('Warning: CLI command `listing-approval` is deprecated. Use Console instead.');\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await disableApprovals(marketplace);\n });\n}\n", "/**\n * Events command - query marketplace events\n */\n\nimport { Command } from 'commander';\nimport { printTable, printError } from '../../util/output.js';\nimport {\n queryEvents as sdkQueryEvents,\n pollEvents as sdkPollEvents,\n type EventData as SdkEventData\n} from 'sharetribe-flex-build-sdk';\n\ninterface EventsQueryOptions {\n resourceId?: string;\n relatedResourceId?: string;\n eventTypes?: string;\n sequenceId?: number;\n afterSeqId?: number;\n beforeSeqId?: number;\n afterTs?: string;\n beforeTs?: string;\n limit?: number;\n json?: boolean;\n jsonPretty?: boolean;\n}\n\n/**\n * Validates query parameters\n */\nfunction validateParams(opts: EventsQueryOptions): void {\n const exclusiveParams = [\n opts.sequenceId !== undefined,\n opts.afterSeqId !== undefined,\n opts.beforeSeqId !== undefined,\n opts.afterTs !== undefined,\n opts.beforeTs !== undefined,\n ];\n\n if (exclusiveParams.filter(Boolean).length > 1) {\n throw new Error(\n 'Only one of --seqid, --after-seqid, --before-seqid, --after-ts, or --before-ts can be specified'\n );\n }\n\n if (opts.resourceId && opts.relatedResourceId) {\n throw new Error('Only one of --resource or --related-resource can be specified');\n }\n}\n\n/**\n * Formats timestamp to match flex-cli format: YYYY-MM-DD H:MM:SS AM/PM\n */\nfunction formatTimestamp(timestamp: string): string {\n try {\n const date = new Date(timestamp);\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n const timeString = date.toLocaleTimeString('en-US');\n\n return `${year}-${month}-${day} ${timeString}`;\n } catch {\n return timestamp;\n }\n}\n\n/**\n * Queries events from API\n */\nasync function queryEvents(\n marketplace: string,\n opts: EventsQueryOptions\n): Promise<void> {\n try {\n validateParams(opts);\n\n const events = await sdkQueryEvents(\n undefined, // Use auth from file\n marketplace,\n {\n resourceId: opts.resourceId,\n relatedResourceId: opts.relatedResourceId,\n eventTypes: opts.eventTypes,\n sequenceId: opts.sequenceId,\n afterSeqId: opts.afterSeqId,\n beforeSeqId: opts.beforeSeqId,\n afterTs: opts.afterTs,\n beforeTs: opts.beforeTs,\n limit: opts.limit,\n }\n );\n\n if (events.length === 0) {\n console.log('No events found.');\n return;\n }\n\n // Output format\n if (opts.json) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails));\n }\n } else if (opts.jsonPretty) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails, null, 2));\n }\n } else {\n printTable(\n ['Seq ID', 'Resource ID', 'Event type', 'Created at local time', 'Source', 'Actor'],\n events.map((event) => {\n const actor = event.auditEmails?.userEmail || event.auditEmails?.adminEmail || '';\n const source = event.source?.replace('source/', '') || '';\n\n return {\n 'Seq ID': event.sequenceId.toString(),\n 'Resource ID': event.resourceId,\n 'Event type': event.eventType,\n 'Created at local time': formatTimestamp(event.createdAt),\n 'Source': source,\n 'Actor': actor,\n };\n })\n );\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to query events');\n }\n process.exit(1);\n }\n}\n\n/**\n * Tails events (live streaming)\n */\nasync function tailEvents(\n marketplace: string,\n opts: EventsQueryOptions\n): Promise<void> {\n try {\n validateParams(opts);\n\n console.log('Tailing events... Press Ctrl+C to stop');\n console.log('');\n\n const stopPolling = sdkPollEvents(\n undefined, // Use auth from file\n marketplace,\n {\n resourceId: opts.resourceId,\n relatedResourceId: opts.relatedResourceId,\n eventTypes: opts.eventTypes,\n limit: opts.limit || 10,\n },\n (events: SdkEventData[]) => {\n // Output events\n if (opts.json) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails));\n }\n } else if (opts.jsonPretty) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails, null, 2));\n }\n } else {\n printTable(\n ['Seq ID', 'Resource ID', 'Event type', 'Created at local time', 'Source', 'Actor'],\n events.map((event) => {\n const actor = event.auditEmails?.userEmail || event.auditEmails?.adminEmail || '';\n const source = event.source?.replace('source/', '') || '';\n\n return {\n 'Seq ID': event.sequenceId.toString(),\n 'Resource ID': event.resourceId,\n 'Event type': event.eventType,\n 'Created at local time': formatTimestamp(event.createdAt),\n 'Source': source,\n 'Actor': actor,\n };\n })\n );\n }\n },\n 5000 // 5 second poll interval\n );\n\n // Handle graceful shutdown\n const shutdown = () => {\n console.log('\\nStopping tail...');\n stopPolling();\n process.exit(0);\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to tail events');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers events command\n */\nexport function registerEventsCommand(program: Command): void {\n const cmd = program\n .command('events')\n .description('Get a list of events.')\n .option('--resource <RESOURCE_ID>', 'show events for specific resource ID')\n .option('--related-resource <RELATED_RESOURCE_ID>', 'show events related to specific resource ID')\n .option('--filter <EVENT_TYPES>', 'filter by event types (comma-separated)')\n .option('--seqid <SEQUENCE_ID>', 'get event with specific sequence ID', parseInt)\n .option('--after-seqid <SEQUENCE_ID>', 'show events after sequence ID (exclusive)', parseInt)\n .option('--before-seqid <SEQUENCE_ID>', 'show events before sequence ID (exclusive)', parseInt)\n .option('--after-ts <TIMESTAMP>', 'show events after timestamp')\n .option('--before-ts <TIMESTAMP>', 'show events before timestamp')\n .option('-l, --limit <NUMBER>', 'limit results (default: 100, max: 100)', parseInt)\n .option('--json', 'output as single-line JSON strings')\n .option('--json-pretty', 'output as indented multi-line JSON')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier');\n\n // Default action - query\n cmd.action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Could not parse arguments:');\n console.error('--marketplace is required');\n process.exit(1);\n }\n\n await queryEvents(marketplace, {\n resourceId: opts.resource,\n relatedResourceId: opts.relatedResource,\n eventTypes: opts.filter,\n sequenceId: opts.seqid,\n afterSeqId: opts.afterSeqid,\n beforeSeqId: opts.beforeSeqid,\n afterTs: opts.afterTs,\n beforeTs: opts.beforeTs,\n limit: opts.limit || 100,\n json: opts.json,\n jsonPretty: opts.jsonPretty,\n });\n });\n\n // tail subcommand\n cmd\n .command('tail')\n .description('Tail events live as they happen')\n .option('--resource <RESOURCE_ID>', 'show events for specific resource ID')\n .option('--related-resource <RELATED_RESOURCE_ID>', 'show events related to specific resource ID')\n .option('--filter <EVENT_TYPES>', 'filter by event types (comma-separated)')\n .option('-l, --limit <NUMBER>', 'limit results per poll (default: 10, max: 100)', parseInt)\n .option('--json', 'output as single-line JSON strings')\n .option('--json-pretty', 'output as indented multi-line JSON')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Could not parse arguments:');\n console.error('--marketplace is required');\n process.exit(1);\n }\n\n await tailEvents(marketplace, {\n resourceId: opts.resource,\n relatedResourceId: opts.relatedResource,\n eventTypes: opts.filter,\n limit: opts.limit || 10,\n json: opts.json,\n jsonPretty: opts.jsonPretty,\n });\n });\n}\n", "/**\n * Stripe command - manage Stripe integration\n */\n\nimport { Command } from 'commander';\nimport { updateStripeVersion as sdkUpdateStripeVersion, SUPPORTED_STRIPE_VERSIONS } from 'sharetribe-flex-build-sdk';\nimport { printError } from '../../util/output.js';\nimport inquirer from 'inquirer';\n\n\n/**\n * Prompts for version selection\n */\nasync function promptForVersion(): Promise<string> {\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'version',\n message: 'Select Stripe API version:',\n choices: [...SUPPORTED_STRIPE_VERSIONS],\n },\n ]);\n\n return answers.version;\n}\n\n/**\n * Prompts for confirmation\n */\nasync function promptForConfirmation(): Promise<boolean> {\n console.log('');\n console.log('WARNING: Changing Stripe API version may affect your integration.');\n console.log('');\n console.log('After updating the Stripe API version, you may need to:');\n console.log('- Handle new Capabilities requirements');\n console.log('- Update identity verification settings');\n console.log('');\n console.log('See Stripe documentation for details:');\n console.log('https://stripe.com/docs/connect/capabilities-overview');\n console.log('https://stripe.com/docs/connect/identity-verification');\n console.log('');\n\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'confirmed',\n message: 'Do you want to continue?',\n default: false,\n },\n ]);\n\n return answers.confirmed;\n}\n\n/**\n * Updates Stripe API version\n */\nasync function updateStripeVersion(\n marketplace: string,\n version?: string,\n force?: boolean\n): Promise<void> {\n try {\n // Get version if not provided\n let selectedVersion = version;\n if (!selectedVersion) {\n selectedVersion = await promptForVersion();\n }\n\n // Get confirmation unless --force flag is used\n if (!force) {\n const confirmed = await promptForConfirmation();\n if (!confirmed) {\n console.log('Cancelled.');\n process.exit(0);\n }\n }\n\n // Update via API (SDK validates version)\n await sdkUpdateStripeVersion(undefined, marketplace, selectedVersion);\n\n console.log(`Stripe API version successfully changed to ${selectedVersion}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to update Stripe API version');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers stripe commands\n */\nexport function registerStripeCommands(program: Command): void {\n const stripeCmd = program.command('stripe').description('manage Stripe integration');\n\n // stripe update-version\n stripeCmd\n .command('update-version')\n .description('update Stripe API version in use')\n .option('--version <VERSION>', 'Stripe API version to update to')\n .option('-f, --force', 'skip confirmation prompt and force update')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await updateStripeVersion(marketplace, opts.version, opts.force);\n });\n}\n", "/**\n * Debug command - display config and auth info\n */\n\nimport edn from 'jsedn';\nimport { getConfigMap, readAuth } from 'sharetribe-flex-build-sdk';\n\nfunction maskLast4(value: string): string {\n if (value.length <= 4) {\n return `...${value}`;\n }\n return `...${value.slice(-4)}`;\n}\n\nfunction toEdnMap(record: Record<string, string>): edn.Map {\n const entries: Array<unknown> = [];\n for (const [key, value] of Object.entries(record)) {\n entries.push(edn.kw(`:${key}`), value);\n }\n return new edn.Map(entries);\n}\n\nexport function debug(): void {\n const auth = readAuth();\n const apiKey = auth?.apiKey ? maskLast4(auth.apiKey) : 'No API key set';\n const confMap = getConfigMap();\n\n const payload = new edn.Map([\n edn.kw(':api-key'),\n apiKey,\n edn.kw(':conf-map'),\n toEdnMap(confMap),\n ]);\n\n console.log(edn.encode(payload));\n}\n", "/**\n * Custom help formatter to match flex-cli output exactly\n */\n\nimport { Command, Help } from 'commander';\nimport chalk from 'chalk';\n\n/**\n * Formats help text to match flex-cli style\n *\n * flex-cli format:\n * - Description (no label)\n * - VERSION section (for main help only)\n * - USAGE section\n * - COMMANDS section (flattened list of all leaf commands)\n * - OPTIONS section (for subcommands only, not main)\n * - Subcommand help instructions\n *\n * @param cmd - Commander command instance\n * @returns Formatted help text matching flex-cli\n */\nexport function formatHelp(cmd: Command): string {\n const parts: string[] = [];\n const isRootCommand = !cmd.parent;\n\n // Description (no label, just the text)\n const description = cmd.description();\n if (description) {\n parts.push(description);\n parts.push('');\n }\n\n // VERSION section (only for root command)\n if (isRootCommand) {\n const version = cmd.version();\n if (version) {\n parts.push('VERSION');\n parts.push(` ${version}`);\n parts.push('');\n }\n }\n\n // USAGE section\n parts.push('USAGE');\n const usage = formatUsage(cmd);\n parts.push(` $ ${usage}`);\n parts.push('');\n\n // COMMANDS section\n // Note: If command has an action (options), don't show COMMANDS section (like flex-cli)\n const allCommands = collectAllLeafCommands(cmd);\n const hasAction = cmd.options.length > 0 && !isRootCommand;\n\n if (allCommands.length > 0 && !hasAction) {\n parts.push('COMMANDS');\n\n // Calculate max command name length for alignment\n const maxLength = Math.max(...allCommands.map(c => c.name.length));\n\n for (const cmdInfo of allCommands) {\n const paddedName = cmdInfo.name.padEnd(maxLength + 2);\n parts.push(` ${paddedName}${cmdInfo.description}`);\n }\n parts.push('');\n }\n\n // OPTIONS section (only for subcommands, not root)\n if (!isRootCommand) {\n const options = cmd.options;\n if (options.length > 0) {\n parts.push('OPTIONS');\n\n // Calculate max option flags length for alignment\n const maxFlagsLength = Math.max(...options.map(opt => formatOptionFlags(opt).length));\n\n for (const opt of options) {\n const flags = formatOptionFlags(opt);\n const paddedFlags = flags.padEnd(maxFlagsLength + 2);\n const desc = opt.description || '';\n parts.push(` ${paddedFlags}${desc}`);\n }\n parts.push('');\n }\n }\n\n // Subcommand help instructions (only for main and group commands without actions)\n if (allCommands.length > 0 && !hasAction) {\n parts.push('Subcommand help:');\n const cmdName = getCommandName(cmd);\n parts.push(` $ ${cmdName} help [COMMAND]`);\n }\n\n // Always add empty line at end to match flex-cli\n parts.push('');\n\n return parts.join('\\n');\n}\n\n/**\n * Recursively collects all commands (both parent and leaf commands)\n *\n * flex-cli shows ALL commands, including parent commands that have their own actions\n * Example: both \"events\" and \"events tail\" are shown\n *\n * @param cmd - Commander command instance\n * @returns Array of command info objects with name and description\n */\nfunction collectAllLeafCommands(cmd: Command): Array<{ name: string; description: string }> {\n const results: Array<{ name: string; description: string }> = [];\n const commands = cmd.commands.filter(c => !c._hidden && c.name() !== 'help');\n\n for (const subCmd of commands) {\n const fullName = getCommandFullName(subCmd);\n const subCommands = subCmd.commands.filter(c => !c._hidden);\n\n // Add this command if it has an action or description\n if (subCmd.description()) {\n results.push({\n name: fullName,\n description: subCmd.description() || ''\n });\n }\n\n // If it has subcommands, recurse and add those too\n if (subCommands.length > 0) {\n const subResults = collectAllLeafCommands(subCmd);\n for (const sub of subResults) {\n results.push(sub);\n }\n }\n }\n\n // Add \"help\" command at the beginning if this is root\n if (!cmd.parent) {\n results.unshift({\n name: 'help',\n description: 'display help for Flex CLI'\n });\n }\n\n // Sort alphabetically by command name\n results.sort((a, b) => a.name.localeCompare(b.name));\n\n return results;\n}\n\n/**\n * Gets the command name for usage (flex-cli vs sharetribe-cli)\n *\n * @param cmd - Commander command instance\n * @returns Command name (e.g., \"sharetribe-cli\" or \"sharetribe-cli process\")\n */\nfunction getCommandName(cmd: Command): string {\n const names: string[] = [];\n let current: Command | null = cmd;\n\n while (current) {\n if (current.name()) {\n names.unshift(current.name());\n }\n current = current.parent;\n }\n\n // Replace first name with \"sharetribe-cli\" (or \"flex-cli\" for reference)\n if (names.length > 0) {\n names[0] = 'sharetribe-cli';\n }\n\n return names.join(' ');\n}\n\n/**\n * Formats the USAGE line\n *\n * @param cmd - Commander command instance\n * @returns Usage string (e.g., \"sharetribe-cli [COMMAND]\" or \"sharetribe-cli process list\")\n */\nfunction formatUsage(cmd: Command): string {\n const cmdName = getCommandName(cmd);\n const commands = cmd.commands.filter(c => !c._hidden);\n const hasOptions = cmd.options.length > 0;\n const isRoot = !cmd.parent;\n\n // Root command always shows [COMMAND] if it has subcommands\n if (isRoot && commands.length > 0) {\n return `${cmdName} [COMMAND]`;\n }\n\n // If command has options (its own action), don't show [COMMAND] even if it has subcommands\n // This matches flex-cli behavior for commands like \"process\" which have both action and subcommands\n if (commands.length > 0 && !hasOptions) {\n // Has subcommands but no action\n return `${cmdName} [COMMAND]`;\n } else {\n // Leaf command or command with action - just show the command path\n return cmdName;\n }\n}\n\n/**\n * Gets the full command name including parent path\n *\n * @param cmd - Commander command instance\n * @returns Full command name (e.g., \"process list\" or \"events tail\")\n */\nfunction getCommandFullName(cmd: Command): string {\n const names: string[] = [];\n let current: Command | null = cmd;\n\n while (current && current.parent) {\n if (current.name()) {\n names.unshift(current.name());\n }\n current = current.parent;\n }\n\n return names.join(' ');\n}\n\n/**\n * Formats option flags for display\n *\n * @param opt - Commander option instance\n * @returns Formatted flags string (e.g., \"-m, --marketplace=MARKETPLACE_ID\")\n */\nfunction formatOptionFlags(opt: any): string {\n // Commander option flags are in opt.flags (e.g., \"-m, --marketplace <MARKETPLACE_ID>\")\n // We need to parse and reformat this to match flex-cli style\n const flagsStr = opt.flags || '';\n\n // Parse the flags string\n // Format: \"-m, --marketplace <VALUE>\" or \"--flag\" or \"-f\"\n const parts = flagsStr.split(/,\\s*/);\n const formatted: string[] = [];\n\n for (const part of parts) {\n const trimmed = part.trim();\n\n // Check if it has a value placeholder (angle brackets or square brackets)\n const valueMatch = trimmed.match(/^((?:-{1,2}[\\w-]+))\\s*[<\\[]([^\\]>]+)[\\]>]/);\n if (valueMatch) {\n // Has a value: \"-m <MARKETPLACE_ID>\" or \"--marketplace <MARKETPLACE_ID>\"\n const flag = valueMatch[1];\n const valueName = valueMatch[2];\n formatted.push(`${flag}=${valueName}`);\n } else {\n // No value: just the flag\n formatted.push(trimmed);\n }\n }\n\n return formatted.join(', ');\n}\n\n/**\n * Configures Commander.js to use custom help formatter\n *\n * @param program - Commander program instance\n */\nexport function configureHelp(program: Command): void {\n program.configureHelp({\n formatHelp: (cmd: Command, helper: Help) => {\n return formatHelp(cmd);\n }\n });\n}\n", "/**\n * Custom command router to handle Commander.js limitations\n *\n * Commander.js cannot handle parent and child commands with the same option names.\n * This router intercepts argv and routes to the correct command handler.\n */\n\n/**\n * Routes process subcommands to avoid Commander parent/child option conflicts\n *\n * This is necessary because Commander validates parent command options before\n * subcommand actions run, causing conflicts when both use --path.\n */\nexport function routeProcessCommand(argv: string[]): string[] {\n // Check if this is a process subcommand\n const processIndex = argv.findIndex(arg => arg === 'process');\n if (processIndex === -1) {\n return argv;\n }\n\n // Check for subcommands\n const nextArg = argv[processIndex + 1];\n const subcommands = ['list', 'create', 'push', 'pull', 'create-alias', 'update-alias', 'delete-alias', 'deploy'];\n\n if (nextArg && subcommands.includes(nextArg)) {\n // This is a subcommand - remove 'process' from argv and make the subcommand top-level\n // e.g. ['node', 'cli', 'process', 'pull', ...] => ['node', 'cli', 'process-pull', ...]\n const newArgv = [\n ...argv.slice(0, processIndex),\n `process-${nextArg}`,\n ...argv.slice(processIndex + 2)\n ];\n\n // Special handling: If this is an alias command with --version option,\n // we need to filter out the global --version flag from program\n // by ensuring the routed command is properly isolated\n return newArgv;\n }\n\n return argv;\n}\n"],
|
|
5
|
-
"mappings": ";;AAMA,OAAS,WAAAA,OAAe,YACxB,OAAS,gBAAAC,OAAoB,UAC7B,OAAS,iBAAAC,OAAqB,WAC9B,OAAS,WAAAC,GAAS,QAAAC,OAAY,YCH9B,OAAS,gBAAAC,OAAoB,UAC7B,OAAS,iBAAAC,OAAqB,WAC9B,OAAS,WAAAC,EAAS,QAAAC,OAAY,YAK9B,SAASC,IAA0B,CACjC,IAAMC,EAAaJ,GAAc,YAAY,GAAG,EAC5CK,EAAaJ,EAAQG,CAAU,EAGnC,KAAOC,IAAe,KACpB,GAAI,CACF,IAAMC,EAAUJ,GAAKG,EAAY,cAAc,EAE/C,OADgBN,GAAaO,EAAS,OAAO,CAE/C,MAAQ,CACND,EAAaJ,EAAQI,CAAU,CACjC,CAGF,MAAM,IAAI,MAAM,6BAA6B,CAC/C,CAOO,SAASE,GAAgB,CAC9B,IAAMC,EAAc,KAAK,MAAML,GAAgB,CAAC,EAChD,QAAQ,IAAIK,EAAY,OAAO,CACjC,CC9BA,OAAOC,OAAc,WACrB,OAAS,aAAAC,OAAiB,4BAO1B,eAAsBC,GAAuB,CAC3C,IAAMC,EAAU,MAAMH,GAAS,OAAO,CACpC,CACE,KAAM,WACN,KAAM,SACN,QAAS,iBACT,KAAM,IACN,SAAWI,GACL,CAACA,GAASA,EAAM,KAAK,EAAE,SAAW,EAC7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wBAAwB,EAKxEK,EACG,QAAQ,SAAS,EACjB,YAAY,cAAc,EAC1B,OAAO,IAAM,CACZI,EAAQ,CACV,CAAC,EAGHJ,EACG,QAAQ,OAAO,EACf,YAAY,qBAAqB,EACjC,OAAO,SAAY,CAClB,MAAMK,EAAM,CACd,CAAC,EAGHL,EACG,QAAQ,QAAQ,EAChB,YAAY,QAAQ,EACpB,OAAO,SAAY,CAClB,MAAMM,EAAO,CACf,CAAC,EAGHN,EACG,QAAQ,OAAO,EACf,YAAY,oBAAoB,EAChC,OAAO,IAAM,CACZO,GAAM,CACR,CAAC,EAGHC,EAAwBR,CAAO,EAG/BS,EAAuBT,CAAO,EAG9BU,GAAuBV,CAAO,EAG9BW,GAA8BX,CAAO,EAGrCY,GAA+BZ,CAAO,EAGtCa,GAAsBb,CAAO,EAG7Bc,GAAuBd,CAAO,EAG9BA,EACG,QAAQ,mBAAmB,EAC3B,YAAY,2BAA2B,EACvC,OAAQe,GAA0B,CACjC,GAAI,CAACA,GAAeA,EAAY,SAAW,EAAG,CAC5Cf,EAAQ,WAAW,EACnB,MACF,CAGA,IAAIgB,EAAqBhB,EACzB,QAAWiB,KAAWF,EAAa,CACjC,IAAMG,EAASF,EAAU,SAAS,KAAKG,GAAKA,EAAE,KAAK,IAAMF,CAAO,EAC3DC,IACH,QAAQ,MAAM,oBAAoBH,EAAY,KAAK,GAAG,CAAC,EAAE,EACzD,QAAQ,KAAK,CAAC,GAEhBC,EAAYE,CACd,CAGAF,EAAU,WAAW,CACvB,CAAC,EAGElB,GAAW,MAAM,CAAC,EAAE,OAKvBE,EAAQ,MAAMF,EAAU,EAJxBE,EAAQ,WAAW",
|
|
6
|
-
"names": ["Command", "readFileSync", "fileURLToPath", "dirname", "join", "readFileSync", "fileURLToPath", "dirname", "join", "findPackageJson", "__filename", "currentDir", "pkgPath", "version", "packageJson", "inquirer", "writeAuth", "login", "answers", "input", "clearAuth", "logout", "sdkListProcesses", "sdkListProcessVersions", "chalk", "printTable", "headers", "rows", "widths", "header", "row", "value", "headerRow", "h", "width", "padded", "rowStr", "i", "printError", "message", "printSuccess", "formatProcessTimestamp", "timestamp", "date", "year", "month", "day", "timeString", "listProcesses", "marketplace", "processName", "versions", "sdkListProcessVersions", "versionRows", "v", "printTable", "processes", "sdkListProcesses", "processRows", "p", "error", "printError", "sdkCreateProcess", "readFileSync", "join", "createProcess", "marketplace", "processName", "path", "processFilePath", "processContent", "result", "sdkCreateProcess", "printSuccess", "error", "printError", "sdkPushProcess", "readFileSync", "readdirSync", "join", "readTemplates", "path", "templatesDir", "templates", "templateDirs", "templateName", "templatePath", "htmlFile", "subjectFile", "html", "subject", "pushProcess", "marketplace", "processName", "processFilePath", "processContent", "result", "sdkPushProcess", "printSuccess", "error", "printError", "getProcess", "writeFileSync", "mkdirSync", "join", "pullProcess", "marketplace", "processName", "path", "version", "alias", "process", "getProcess", "existsSync", "dirExists", "processFilePath", "templates", "templatesDir", "template", "templateName", "htmlContent", "subjectContent", "templateSubdir", "htmlPath", "subjectPath", "error", "printError", "sdkCreateAlias", "sdkUpdateAlias", "sdkDeleteAlias", "createAlias", "marketplace", "processName", "version", "alias", "result", "sdkCreateAlias", "printSuccess", "error", "printError", "updateAlias", "sdkUpdateAlias", "deleteAlias", "sdkDeleteAlias", "sdkDeployProcess", "parseProcessFile", "readFileSync", "join", "createOrPushAndCreateOrUpdateAlias", "marketplace", "processName", "path", "alias", "processFilePath", "processContent", "processDefinition", "parseProcessFile", "result", "sdkDeployProcess", "printSuccess", "error", "printError", "registerProcessCommands", "program", "processCmd", "options", "marketplace", "listProcesses", "createProcess", "pushProcess", "pullProcess", "createAlias", "updateAlias", "deleteAlias", "createOrPushAndCreateOrUpdateAlias", "sdkListSearchSchemas", "sdkSetSearchSchema", "sdkUnsetSearchSchema", "SCOPE_LABELS", "setSearchSchema", "marketplace", "opts", "sdkSetSearchSchema", "schemaFor", "scopeLabel", "error", "printError", "unsetSearchSchema", "sdkUnsetSearchSchema", "getDefaultValueLabel", "value", "listSearchSchemas", "schemas", "sdkListSearchSchemas", "rows", "s", "a", "b", "headers", "widths", "h", "row", "headerParts", "i", "width", "padded", "rowParts", "registerSearchCommands", "program", "searchCmd", "options", "
|
|
4
|
+
"sourcesContent": ["/**\n * Sharetribe CLI - Unofficial 100% compatible implementation\n *\n * Main entry point for the CLI application\n */\n\nimport { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, join } from 'node:path';\nimport { version } from './commands/version.js';\nimport { login } from './commands/login.js';\nimport { logout } from './commands/logout.js';\nimport { registerProcessCommands } from './commands/process/index.js';\nimport { registerSearchCommands } from './commands/search/index.js';\nimport { registerAssetsCommands } from './commands/assets/index.js';\nimport { registerNotificationsCommands } from './commands/notifications/index.js';\nimport { registerListingApprovalCommand } from './commands/listing-approval.js';\nimport { registerEventsCommand } from './commands/events/index.js';\nimport { registerStripeCommands } from './commands/stripe/index.js';\nimport { debug } from './commands/debug.js';\nimport { configureHelp } from './util/help-formatter.js';\nimport { routeProcessCommand } from './util/command-router.js';\n\n// Get package.json for version info\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst packageJson = JSON.parse(\n readFileSync(join(__dirname, '../package.json'), 'utf-8')\n);\n\n// Route argv to handle process subcommands\nconst routedArgv = routeProcessCommand(process.argv);\n\nconst program = new Command();\n\n// Configure custom help formatter to match flex-cli\nconfigureHelp(program);\n\n// Configure output to add trailing newline (flex-cli behavior)\nprogram.configureOutput({\n writeOut: (str) => process.stdout.write(str + '\\n'),\n writeErr: (str) => process.stderr.write(str + '\\n'),\n});\n\n// Configure the main program\nprogram\n .name('sharetribe-cli')\n .description('CLI to interact with Sharetribe Flex')\n .version(packageJson.version, '-V', 'output the version number')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier');\n\n// Register commands\n\n// version command\nprogram\n .command('version')\n .description('show version')\n .action(() => {\n version();\n });\n\n// login command\nprogram\n .command('login')\n .description('log in with API key')\n .action(async () => {\n await login();\n });\n\n// logout command\nprogram\n .command('logout')\n .description('logout')\n .action(async () => {\n await logout();\n });\n\n// debug command\nprogram\n .command('debug')\n .description('display debug info')\n .action(() => {\n debug();\n });\n\n// Register process commands\nregisterProcessCommands(program);\n\n// Register search commands\nregisterSearchCommands(program);\n\n// Register assets commands\nregisterAssetsCommands(program);\n\n// Register notifications commands\nregisterNotificationsCommands(program);\n\n// Register listing-approval command\nregisterListingApprovalCommand(program);\n\n// Register events command\nregisterEventsCommand(program);\n\n// Register stripe commands\nregisterStripeCommands(program);\n\n// Register custom help command (to support \"help process list\" syntax)\nprogram\n .command('help [command...]')\n .description('display help for Flex CLI')\n .action((commandPath: string[]) => {\n if (!commandPath || commandPath.length === 0) {\n program.outputHelp();\n return;\n }\n\n // Navigate to the nested command\n let targetCmd: Command = program;\n for (const cmdName of commandPath) {\n const subCmd = targetCmd.commands.find(c => c.name() === cmdName);\n if (!subCmd) {\n console.error(`Unknown command: ${commandPath.join(' ')}`);\n process.exit(1);\n }\n targetCmd = subCmd;\n }\n\n // Show help for the target command\n targetCmd.outputHelp();\n });\n\n// If no command specified, show help and exit with status 0\nif (!routedArgv.slice(2).length) {\n program.outputHelp();\n // Don't call process.exit() - let Commander handle it naturally with exitOverride\n} else {\n // Parse command line arguments with routed argv\n program.parse(routedArgv);\n}\n", "/**\n * Version command - displays the CLI version\n *\n * Must match flex-cli output format exactly\n */\n\nimport { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, join } from 'node:path';\n\n/**\n * Finds package.json by traversing up from current file\n */\nfunction findPackageJson(): string {\n const __filename = fileURLToPath(import.meta.url);\n let currentDir = dirname(__filename);\n\n // Traverse up to find package.json\n while (currentDir !== '/') {\n try {\n const pkgPath = join(currentDir, 'package.json');\n const content = readFileSync(pkgPath, 'utf-8');\n return content;\n } catch {\n currentDir = dirname(currentDir);\n }\n }\n\n throw new Error('Could not find package.json');\n}\n\n/**\n * Displays the version of the CLI\n *\n * Output must match flex-cli exactly\n */\nexport function version(): void {\n const packageJson = JSON.parse(findPackageJson());\n console.log(packageJson.version);\n}\n", "/**\n * Login command - interactive API key authentication\n *\n * Must match flex-cli behavior exactly:\n * - Prompt for API key\n * - Store in ~/.config/flex-cli/auth.edn\n * - Display admin email on success\n */\n\nimport inquirer from 'inquirer';\nimport { writeAuth } from 'sharetribe-flex-build-sdk';\n\n/**\n * Executes the login command\n *\n * Prompts for API key and stores it in auth.edn\n */\nexport async function login(): Promise<void> {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n name: 'apiKey',\n message: 'Enter API key:',\n mask: '*',\n validate: (input: string) => {\n if (!input || input.trim().length === 0) {\n return 'API key cannot be empty';\n }\n return true;\n },\n },\n ]);\n\n // Store the API key\n writeAuth({ apiKey: answers.apiKey });\n\n // TODO: Validate API key by making a test request to get admin email\n // For now, just confirm storage\n console.log('Successfully logged in.');\n\n // Note: flex-cli displays admin email after successful login\n // We'll need to implement API client to fetch this\n}\n", "/**\n * Logout command - clears authentication\n *\n * Must match flex-cli behavior exactly\n */\n\nimport { clearAuth } from 'sharetribe-flex-build-sdk';\n\n/**\n * Executes the logout command\n *\n * Clears auth.edn file\n */\nexport async function logout(): Promise<void> {\n await clearAuth();\n console.log('Successfully logged out.');\n}\n", "/**\n * Process list command - lists all transaction processes\n */\n\nimport {\n listProcesses as sdkListProcesses,\n listProcessVersions as sdkListProcessVersions,\n} from 'sharetribe-flex-build-sdk';\nimport { printTable, printError } from '../../util/output.js';\n\n\n/**\n * Formats timestamp to match flex-cli format for process list\n */\nfunction formatProcessTimestamp(timestamp: string): string {\n try {\n const date = new Date(timestamp);\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n const timeString = date.toLocaleTimeString('en-US');\n\n return `${year}-${month}-${day} ${timeString}`;\n } catch {\n return timestamp;\n }\n}\n\n/**\n * Lists all processes for a marketplace\n */\nexport async function listProcesses(marketplace: string, processName?: string): Promise<void> {\n try {\n // If processName is specified, show version history for that process\n if (processName) {\n const versions = await sdkListProcessVersions(undefined, marketplace, processName);\n\n if (versions.length === 0) {\n console.log(`No versions found for process: ${processName}`);\n return;\n }\n\n const versionRows = versions.map((v) => ({\n 'Created': formatProcessTimestamp(v.createdAt),\n 'Version': v.version.toString(),\n 'Aliases': v.aliases?.join(', ') || '',\n 'Transactions': v.transactionCount?.toString() || '0',\n }));\n\n printTable(['Created', 'Version', 'Aliases', 'Transactions'], versionRows);\n } else {\n // List all processes\n const processes = await sdkListProcesses(undefined, marketplace);\n\n if (processes.length === 0) {\n console.log('No processes found.');\n return;\n }\n\n const processRows = processes.map((p) => ({\n 'Name': p.name,\n 'Latest version': p.version?.toString() || '',\n }));\n\n printTable(['Name', 'Latest version'], processRows);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to list processes');\n }\n process.exit(1);\n }\n}\n", "/**\n * Output formatting utilities\n *\n * Must match flex-cli output format exactly\n */\n\nimport chalk from 'chalk';\n\n/**\n * Prints a table with headers and rows\n *\n * Matches flex-cli table formatting exactly\n */\nexport function printTable(headers: string[], rows: Array<Record<string, string>>): void {\n if (rows.length === 0) {\n return;\n }\n\n // Calculate column widths\n // flex-cli uses keywords (e.g., :version) which when stringified include the ':' prefix\n // To match flex-cli widths, we add 1 to header length to simulate the ':' prefix\n const widths: Record<string, number> = {};\n for (const header of headers) {\n widths[header] = header.length + 1; // +1 to match flex-cli keyword string behavior\n }\n\n for (const row of rows) {\n for (const header of headers) {\n const value = row[header] || '';\n widths[header] = Math.max(widths[header] || 0, value.length);\n }\n }\n\n // Print empty line before table (like flex-cli)\n console.log('');\n\n // Print header with bold formatting\n // flex-cli format: each column padded to (max_width + 1), with single space separator between columns\n // Last column: padding but no separator (interpose doesn't add separator after last element)\n const headerParts = headers.map((h, i) => {\n const width = widths[h] || 0;\n const padded = h.padEnd(width + 1);\n return i === headers.length - 1 ? padded : padded + ' ';\n });\n const headerRow = headerParts.join('');\n console.log(chalk.bold.black(headerRow));\n\n // Print rows with same formatting\n for (const row of rows) {\n const rowParts = headers.map((h, i) => {\n const value = row[h] || '';\n const width = widths[h] || 0;\n const padded = value.padEnd(width + 1);\n return i === headers.length - 1 ? padded : padded + ' ';\n });\n const rowStr = rowParts.join('');\n console.log(rowStr);\n }\n\n // Print empty line after table (like flex-cli)\n console.log('');\n}\n\n/**\n * Prints an error message\n */\nexport function printError(message: string): void {\n console.error(chalk.red(`Error: ${message}`));\n}\n\n/**\n * Prints a success message\n */\nexport function printSuccess(message: string): void {\n console.log(chalk.green(message));\n}\n\n/**\n * Prints a warning message\n */\nexport function printWarning(message: string): void {\n console.log(chalk.yellow(`Warning: ${message}`));\n}\n", "/**\n * Process create command\n */\n\nimport { createProcess as sdkCreateProcess } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Creates a new transaction process\n */\nexport async function createProcess(\n marketplace: string,\n processName: string,\n path: string\n): Promise<void> {\n try {\n const processFilePath = join(path, 'process.edn');\n const processContent = readFileSync(processFilePath, 'utf-8');\n\n const result = await sdkCreateProcess(undefined, marketplace, processName, processContent);\n\n printSuccess(\n `Process ${result.name} successfully created with version ${result.version}.`\n );\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to create process');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process push command\n */\n\nimport { pushProcess as sdkPushProcess } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { readFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Reads email templates from the templates directory\n */\nfunction readTemplates(path: string): Array<{ name: string; html: string; subject: string }> {\n const templatesDir = join(path, 'templates');\n const templates: Array<{ name: string; html: string; subject: string }> = [];\n\n try {\n const templateDirs = readdirSync(templatesDir);\n for (const templateName of templateDirs) {\n const templatePath = join(templatesDir, templateName);\n const htmlFile = join(templatePath, `${templateName}-html.html`);\n const subjectFile = join(templatePath, `${templateName}-subject.txt`);\n\n try {\n const html = readFileSync(htmlFile, 'utf-8');\n const subject = readFileSync(subjectFile, 'utf-8');\n templates.push({ name: templateName, html, subject });\n } catch {\n // Skip if files don't exist\n }\n }\n } catch {\n // No templates directory - return empty array\n }\n\n return templates;\n}\n\n/**\n * Pushes a new version of an existing process\n */\nexport async function pushProcess(\n marketplace: string,\n processName: string,\n path: string\n): Promise<void> {\n try {\n const processFilePath = join(path, 'process.edn');\n const processContent = readFileSync(processFilePath, 'utf-8');\n const templates = readTemplates(path);\n\n const result = await sdkPushProcess(undefined, marketplace, processName, processContent, templates);\n\n if (result.noChanges) {\n console.log('No changes');\n } else {\n printSuccess(`Version ${result.version} successfully saved for process ${processName}.`);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to push process');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process pull command\n */\n\nimport { getProcess } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { writeFileSync, mkdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Pulls a process from the server\n */\nexport async function pullProcess(\n marketplace: string,\n processName: string,\n path: string,\n version?: string,\n alias?: string\n): Promise<void> {\n try {\n const process = await getProcess(undefined, marketplace, processName, { version, alias });\n\n if (!process.definition) {\n throw new Error('No process definition in response');\n }\n\n // Ensure directory exists (print message if creating new directory)\n const { existsSync } = await import('node:fs');\n const dirExists = existsSync(path);\n mkdirSync(path, { recursive: true });\n\n if (!dirExists) {\n console.error(`Creating a new directory: ${path}`);\n }\n\n // Write process.edn file\n const processFilePath = join(path, 'process.edn');\n writeFileSync(processFilePath, process.definition, 'utf-8');\n\n // Write email templates if they exist\n const templates = process.emailTemplates || [];\n\n if (templates && Array.isArray(templates) && templates.length > 0) {\n const templatesDir = join(path, 'templates');\n mkdirSync(templatesDir, { recursive: true });\n\n for (const template of templates) {\n const templateName = template.name;\n const htmlContent = template.html;\n const subjectContent = template.subject;\n\n if (templateName) {\n // Create subdirectory for this template\n const templateSubdir = join(templatesDir, templateName);\n mkdirSync(templateSubdir, { recursive: true });\n\n // Write HTML file\n if (htmlContent) {\n const htmlPath = join(templateSubdir, `${templateName}-html.html`);\n writeFileSync(htmlPath, htmlContent, 'utf-8');\n }\n\n // Write subject file\n if (subjectContent) {\n const subjectPath = join(templateSubdir, `${templateName}-subject.txt`);\n writeFileSync(subjectPath, subjectContent, 'utf-8');\n }\n }\n }\n }\n\n console.error(`Saved process to ${path}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to pull process');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process alias commands\n */\n\nimport {\n createAlias as sdkCreateAlias,\n updateAlias as sdkUpdateAlias,\n deleteAlias as sdkDeleteAlias\n} from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\n\n/**\n * Creates a process alias\n */\nexport async function createAlias(\n marketplace: string,\n processName: string,\n version: number,\n alias: string\n): Promise<void> {\n try {\n const result = await sdkCreateAlias(undefined, marketplace, processName, version, alias);\n\n printSuccess(\n `Alias ${result.alias} successfully created to point to version ${result.version}.`\n );\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to create alias');\n }\n process.exit(1);\n }\n}\n\n/**\n * Updates a process alias\n */\nexport async function updateAlias(\n marketplace: string,\n processName: string,\n version: number,\n alias: string\n): Promise<void> {\n try {\n const result = await sdkUpdateAlias(undefined, marketplace, processName, version, alias);\n\n printSuccess(\n `Alias ${result.alias} successfully updated to point to version ${result.version}.`\n );\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to update alias');\n }\n process.exit(1);\n }\n}\n\n/**\n * Deletes a process alias\n */\nexport async function deleteAlias(\n marketplace: string,\n processName: string,\n alias: string\n): Promise<void> {\n try {\n const result = await sdkDeleteAlias(undefined, marketplace, processName, alias);\n\n printSuccess(`Alias ${result.alias} successfully deleted.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to delete alias');\n }\n process.exit(1);\n }\n}\n", "/**\n * Combined process command - create-or-push-and-create-or-update-alias\n *\n * This is the enhanced \"superset\" feature that combines multiple operations\n * into one atomic command\n */\n\nimport { deployProcess as sdkDeployProcess, parseProcessFile } from 'sharetribe-flex-build-sdk';\nimport { printError, printSuccess } from '../../util/output.js';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Creates or pushes a process and creates or updates an alias\n *\n * This is an atomic operation that:\n * 1. Tries to push a new version (create-version)\n * 2. If process doesn't exist, creates it\n * 3. Then creates or updates the alias\n */\nexport async function createOrPushAndCreateOrUpdateAlias(\n marketplace: string,\n processName: string,\n path: string,\n alias: string\n): Promise<void> {\n try {\n const processFilePath = join(path, 'process.edn');\n const processContent = readFileSync(processFilePath, 'utf-8');\n const processDefinition = parseProcessFile(processContent);\n\n const result = await sdkDeployProcess(\n undefined, // Use auth from file\n marketplace,\n {\n process: processName,\n alias,\n path: processFilePath,\n processDefinition,\n }\n );\n\n if (result.processCreated) {\n printSuccess(`Process ${processName} successfully created.`);\n }\n\n printSuccess(`Version ${result.version} successfully saved for process ${processName}.`);\n\n if (result.aliasCreated) {\n printSuccess(`Alias ${result.alias} successfully created to point to version ${result.version}.`);\n } else {\n printSuccess(`Alias ${result.alias} successfully updated to point to version ${result.version}.`);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to create/push process and alias');\n }\n process.exit(1);\n }\n}\n", "/**\n * Process command - main entry point for process subcommands\n */\n\nimport { Command } from 'commander';\nimport { listProcesses } from './list.js';\nimport { createProcess } from './create.js';\nimport { pushProcess } from './push.js';\nimport { pullProcess } from './pull.js';\nimport { createAlias, updateAlias, deleteAlias } from './aliases.js';\nimport { createOrPushAndCreateOrUpdateAlias } from './combined.js';\n\n/**\n * Registers all process subcommands\n */\nexport function registerProcessCommands(program: Command): void {\n // Register the parent 'process' command for help display\n const processCmd = program\n .command('process')\n .description('describe a process file')\n .option('--path <PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('--transition <TRANSITION_NAME>', 'transition name, e.g. transition/request to get more details of it')\n .action(async (options) => {\n // Process describe functionality\n if (options.path) {\n console.log(`Describing process at: ${options.path}`);\n if (options.transition) {\n console.log(`Transition: ${options.transition}`);\n }\n // TODO: Implement actual process file parsing and description\n console.log('Process description not yet implemented');\n } else {\n // If no options, show help\n processCmd.outputHelp();\n }\n });\n\n // Register subcommands - these are registered as BOTH subcommands (for help) and top-level (for routing)\n\n // process list (as subcommand)\n processCmd\n .command('list')\n .description('list all transaction processes')\n .option('--process <PROCESS_NAME>', 'print version and alias info of a specific process')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await listProcesses(marketplace, options.process);\n });\n\n // process create\n processCmd\n .command('create')\n .description('create a new transaction process')\n .requiredOption('--process <PROCESS_NAME>', 'name for the new process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createProcess(marketplace, options.process, options.path);\n });\n\n // process push\n processCmd\n .command('push')\n .description('push a process file to the remote')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pushProcess(marketplace, options.process, options.path);\n });\n\n // process pull\n processCmd\n .command('pull')\n .description('fetch a process file')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path where to save the process')\n .option('--version <VERSION_NUM>', 'version number')\n .option('--alias <PROCESS_ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pullProcess(marketplace, options.process, options.path, options.version, options.alias);\n });\n\n // process create-alias\n processCmd\n .command('create-alias')\n .description('create a new alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .allowUnknownOption(false)\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n // process update-alias\n processCmd\n .command('update-alias')\n .description('update an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await updateAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n // process delete-alias\n processCmd\n .command('delete-alias')\n .description('delete an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await deleteAlias(marketplace, options.process, options.alias);\n });\n\n // process deploy (combined command: create-or-push-and-create-or-update-alias)\n processCmd\n .command('deploy')\n .description('deploy a process file with alias (create/push + alias create/update)')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory with the process files')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createOrPushAndCreateOrUpdateAlias(\n marketplace,\n options.process,\n options.path,\n options.alias\n );\n });\n\n // Register top-level command aliases for routing (hidden from help)\n // These handle the routed commands like 'process-pull' that avoid Commander's parent/child option conflicts\n\n program\n .command('process-list', { hidden: true })\n .description('list all transaction processes')\n .option('--process <PROCESS_NAME>', 'print version and alias info of a specific process')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await listProcesses(marketplace, options.process);\n });\n\n program\n .command('process-create', { hidden: true })\n .description('create a new transaction process')\n .requiredOption('--process <PROCESS_NAME>', 'name for the new process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createProcess(marketplace, options.process, options.path);\n });\n\n program\n .command('process-push', { hidden: true })\n .description('push a process file to the remote')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory where the process.edn file is')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pushProcess(marketplace, options.process, options.path);\n });\n\n program\n .command('process-pull', { hidden: true })\n .description('fetch a process file')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path where to save the process')\n .option('--version <VERSION_NUM>', 'version number')\n .option('--alias <PROCESS_ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pullProcess(marketplace, options.process, options.path, options.version, options.alias);\n });\n\n program\n .command('process-create-alias', { hidden: true })\n .description('create a new alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n program\n .command('process-update-alias', { hidden: true })\n .description('update an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--version <VERSION_NUM>', 'version number')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await updateAlias(marketplace, options.process, parseInt(options.version), options.alias);\n });\n\n program\n .command('process-delete-alias', { hidden: true })\n .description('delete an existing alias')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await deleteAlias(marketplace, options.process, options.alias);\n });\n\n program\n .command('process-deploy', { hidden: true })\n .description('deploy a process file with alias (create/push + alias create/update)')\n .requiredOption('--process <PROCESS_NAME>', 'name of the process')\n .requiredOption('--path <LOCAL_PROCESS_DIR>', 'path to the directory with the process files')\n .requiredOption('--alias <ALIAS>', 'alias name')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await createOrPushAndCreateOrUpdateAlias(\n marketplace,\n options.process,\n options.path,\n options.alias\n );\n });\n}\n", "/**\n * Search command - manage search schemas\n */\n\nimport { Command } from 'commander';\nimport {\n listSearchSchemas as sdkListSearchSchemas,\n setSearchSchema as sdkSetSearchSchema,\n unsetSearchSchema as sdkUnsetSearchSchema,\n} from 'sharetribe-flex-build-sdk';\nimport { printTable, printError } from '../../util/output.js';\n\ninterface SetSchemaOptions {\n key: string;\n scope: string;\n type: string;\n doc?: string;\n default?: string;\n schemaFor?: string;\n}\n\ninterface UnsetSchemaOptions {\n key: string;\n scope: string;\n schemaFor?: string;\n}\n\n/**\n * Scope label mapping\n */\nconst SCOPE_LABELS: Record<string, string> = {\n metadata: 'Metadata',\n private: 'Private data',\n protected: 'Protected data',\n public: 'Public data',\n};\n\n/**\n * Sets a search schema field\n */\nasync function setSearchSchema(marketplace: string, opts: SetSchemaOptions): Promise<void> {\n try {\n await sdkSetSearchSchema(undefined, marketplace, {\n key: opts.key,\n scope: opts.scope,\n type: opts.type,\n doc: opts.doc,\n defaultValue: opts.default,\n schemaFor: opts.schemaFor,\n });\n\n const schemaFor = opts.schemaFor || 'listing';\n const scopeLabel = SCOPE_LABELS[opts.scope] || opts.scope;\n console.log(`${scopeLabel} schema, ${opts.key} is successfully set for ${schemaFor}.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to set search schema');\n }\n process.exit(1);\n }\n}\n\n/**\n * Unsets a search schema field\n */\nasync function unsetSearchSchema(marketplace: string, opts: UnsetSchemaOptions): Promise<void> {\n try {\n await sdkUnsetSearchSchema(undefined, marketplace, {\n key: opts.key,\n scope: opts.scope,\n schemaFor: opts.schemaFor,\n });\n\n const schemaFor = opts.schemaFor || 'listing';\n const scopeLabel = SCOPE_LABELS[opts.scope] || opts.scope;\n console.log(`${scopeLabel} schema, ${opts.key} is successfully unset for ${schemaFor}.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to unset search schema');\n }\n process.exit(1);\n }\n}\n\n/**\n * Converts default value to display string\n */\nfunction getDefaultValueLabel(value: unknown): string {\n if (value === undefined || value === null) {\n return '';\n }\n\n if (Array.isArray(value)) {\n return value.join(', ');\n }\n\n return String(value);\n}\n\n/**\n * Lists all search schemas\n */\nasync function listSearchSchemas(marketplace: string): Promise<void> {\n try {\n const schemas = await sdkListSearchSchemas(undefined, marketplace);\n\n if (schemas.length === 0) {\n console.log('No search schemas found.');\n return;\n }\n\n // Map and sort the data (by schema-for, scope, key)\n const rows = schemas\n .map((s) => ({\n 'Schema for': s.schemaFor,\n 'Scope': s.scope,\n 'Key': s.key,\n 'Type': s.type,\n 'Default value': getDefaultValueLabel(s.defaultValue),\n 'Doc': s.doc || '',\n }))\n .sort((a, b) => {\n // Sort by schema-for, then scope, then key\n if (a['Schema for'] !== b['Schema for']) {\n return a['Schema for'].localeCompare(b['Schema for']);\n }\n if (a['Scope'] !== b['Scope']) {\n return a['Scope'].localeCompare(b['Scope']);\n }\n return a['Key'].localeCompare(b['Key']);\n });\n\n // Print table using flex-cli compatible formatting\n const headers = ['Schema for', 'Scope', 'Key', 'Type', 'Default value', 'Doc'];\n\n // Calculate column widths\n // flex-cli uses keywords (e.g., :version) which when stringified include the ':' prefix\n // To match flex-cli widths, we add 1 to header length to simulate the ':' prefix\n const widths: Record<string, number> = {};\n for (const h of headers) {\n widths[h] = h.length + 1;\n }\n for (const row of rows) {\n for (const h of headers) {\n const value = row[h] || '';\n widths[h] = Math.max(widths[h], value.length);\n }\n }\n\n // Print empty line before table\n console.log('');\n\n // Print header\n // flex-cli search format: each column padded to max_width, with 2 space separator between columns\n // Last column: padding with trailing space\n const headerParts = headers.map((h, i) => {\n const width = widths[h] || 0;\n const padded = h.padEnd(width);\n return i === headers.length - 1 ? padded + ' ' : padded + ' ';\n });\n console.log(headerParts.join(''));\n\n // Print rows\n for (const row of rows) {\n const rowParts = headers.map((h, i) => {\n const value = row[h] || '';\n const width = widths[h] || 0;\n const padded = value.padEnd(width);\n return i === headers.length - 1 ? padded + ' ' : padded + ' ';\n });\n console.log(rowParts.join(''));\n }\n\n // Print empty line after table\n console.log('');\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to list search schemas');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers search commands\n */\nexport function registerSearchCommands(program: Command): void {\n const searchCmd = program\n .command('search')\n .description('list all search schemas')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (options) => {\n const marketplace = options.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await listSearchSchemas(marketplace);\n });\n\n // search set\n searchCmd\n .command('set')\n .description('set search schema')\n .requiredOption('--key <KEY>', 'key name')\n .requiredOption(\n '--scope <SCOPE>',\n 'extended data scope (either metadata or public for listing schema, metadata, private, protected or public for userProfile schema, metadata or protected for transaction schema)'\n )\n .requiredOption('--type <TYPE>', 'value type (either enum, multi-enum, boolean, long or text)')\n .option('--doc <DOC>', 'description of the schema')\n .option('--default <DEFAULT>', 'default value for search if value is not set')\n .option(\n '--schema-for <SCHEMA_FOR>',\n 'Subject of the schema (either listing, userProfile or transaction, defaults to listing)'\n )\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await setSearchSchema(marketplace, {\n key: opts.key,\n scope: opts.scope,\n type: opts.type,\n doc: opts.doc,\n default: opts.default,\n schemaFor: opts.schemaFor,\n });\n });\n\n // search unset\n searchCmd\n .command('unset')\n .description('unset search schema')\n .requiredOption('--key <KEY>', 'key name')\n .requiredOption(\n '--scope <SCOPE>',\n 'extended data scope (either metadata or public for listing schema, metadata, private, protected or public for userProfile schema, metadata or protected for transaction schema)'\n )\n .option(\n '--schema-for <SCHEMA_FOR>',\n 'Subject of the schema (either listing, userProfile or transaction, defaults to listing)'\n )\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await unsetSearchSchema(marketplace, {\n key: opts.key,\n scope: opts.scope,\n schemaFor: opts.schemaFor,\n });\n });\n}\n", "/**\n * Assets commands - manage marketplace assets\n */\n\nimport { Command } from 'commander';\nimport {\n pushAssets as sdkPushAssets,\n stageAsset as sdkStageAsset,\n getApiBaseUrl,\n readAuth,\n} from 'sharetribe-flex-build-sdk';\nimport { printError } from '../../util/output.js';\nimport {\n readFileSync,\n writeFileSync,\n existsSync,\n mkdirSync,\n readdirSync,\n statSync,\n unlinkSync,\n createWriteStream,\n} from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { createHash } from 'node:crypto';\nimport * as http from 'node:http';\nimport * as https from 'node:https';\nimport { tmpdir } from 'node:os';\nimport { pipeline } from 'node:stream/promises';\nimport chalk from 'chalk';\nimport edn from 'jsedn';\nimport yauzl from 'yauzl';\n\n\ninterface AssetMetadata {\n version: string;\n assets: Array<{ path: string; 'content-hash': string }>;\n}\n\nconst ASSET_META_FILENAME = 'meta/asset-meta.edn';\nconst ASSETS_DIR = 'assets/';\nconst CLEAR_LINE = '\\x1b[K';\nconst CARRIAGE_RETURN = '\\r';\n\nfunction parseAssetMetadataEdn(content: string): AssetMetadata | null {\n try {\n const parsed = edn.parse(content);\n const version = parsed.at(edn.kw(':version')) || parsed.at(edn.kw(':aliased-version'));\n const assets = parsed.at(edn.kw(':assets'));\n\n const assetList: Array<{ path: string; 'content-hash': string }> = [];\n if (assets && assets.val) {\n for (const asset of assets.val) {\n assetList.push({\n path: asset.at(edn.kw(':path')),\n 'content-hash': asset.at(edn.kw(':content-hash')),\n });\n }\n }\n\n if (!version) {\n return null;\n }\n\n return { version, assets: assetList };\n } catch {\n return null;\n }\n}\n\n/**\n * Reads asset metadata from .flex-cli/asset-meta.edn\n */\nfunction readAssetMetadata(basePath: string): AssetMetadata | null {\n const metaPath = join(basePath, '.flex-cli', 'asset-meta.edn');\n if (!existsSync(metaPath)) {\n return null;\n }\n\n try {\n const content = readFileSync(metaPath, 'utf-8');\n return parseAssetMetadataEdn(content);\n } catch {\n return null;\n }\n}\n\n/**\n * Writes asset metadata to .flex-cli/asset-meta.edn\n */\nfunction writeAssetMetadata(basePath: string, metadata: AssetMetadata): void {\n const metaDir = join(basePath, '.flex-cli');\n if (!existsSync(metaDir)) {\n mkdirSync(metaDir, { recursive: true });\n }\n\n const assets = metadata.assets.map(a =>\n new edn.Map([\n edn.kw(':path'), a.path,\n edn.kw(':content-hash'), a['content-hash']\n ])\n );\n\n const ednMap = new edn.Map([\n edn.kw(':version'), metadata.version,\n edn.kw(':assets'), new edn.Vector(assets)\n ]);\n\n const metaPath = join(basePath, '.flex-cli', 'asset-meta.edn');\n writeFileSync(metaPath, edn.encode(ednMap), 'utf-8');\n}\n\n/**\n * Calculates SHA-1 hash of file content matching backend convention\n * Content is prefixed with `${byte-count}|` before hashing\n */\nfunction calculateHash(data: Buffer): string {\n const prefix = Buffer.from(`${data.length}|`, 'utf-8');\n return createHash('sha1').update(prefix).update(data).digest('hex');\n}\n\n/**\n * Reads all assets from a directory\n */\nfunction readLocalAssets(basePath: string): Array<{ path: string; data: Buffer; hash: string }> {\n const assets: Array<{ path: string; data: Buffer; hash: string }> = [];\n\n function scanDir(dir: string, relativePath: string = '') {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n if (entry === '.flex-cli') continue; // Skip metadata directory\n if (entry === '.DS_Store') continue; // Skip .DS_Store files\n\n const fullPath = join(dir, entry);\n const relPath = relativePath ? join(relativePath, entry) : entry;\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n scanDir(fullPath, relPath);\n } else if (stat.isFile()) {\n const data = readFileSync(fullPath);\n const hash = calculateHash(data);\n assets.push({ path: relPath, data, hash });\n }\n }\n }\n\n scanDir(basePath);\n return assets;\n}\n\n/**\n * Lists local asset paths without reading file data\n */\nfunction listLocalAssetPaths(basePath: string): string[] {\n const assets: string[] = [];\n\n function scanDir(dir: string, relativePath: string = '') {\n const entries = readdirSync(dir);\n\n for (const entry of entries) {\n if (entry === '.flex-cli') continue;\n if (entry === '.DS_Store') continue;\n\n const fullPath = join(dir, entry);\n const relPath = relativePath ? join(relativePath, entry) : entry;\n const stat = statSync(fullPath);\n\n if (stat.isDirectory()) {\n scanDir(fullPath, relPath);\n } else if (stat.isFile()) {\n assets.push(relPath);\n }\n }\n }\n\n scanDir(basePath);\n return assets;\n}\n\n/**\n * Validates JSON files\n */\nfunction validateJsonAssets(assets: Array<{ path: string; data: Buffer }>): void {\n for (const asset of assets) {\n if (asset.path.endsWith('.json')) {\n try {\n JSON.parse(asset.data.toString('utf-8'));\n } catch (error) {\n throw new Error(`Invalid JSON in ${asset.path}: ${error}`);\n }\n }\n }\n}\n\nfunction formatDownloadProgress(bytes: number): string {\n const mb = bytes / 1024 / 1024;\n return `${CARRIAGE_RETURN}${CLEAR_LINE}Downloaded ${mb.toFixed(2)}MB`;\n}\n\nfunction printDownloadProgress(stream: NodeJS.ReadableStream): void {\n let downloaded = 0;\n const printProgress = (): void => {\n process.stderr.write(formatDownloadProgress(downloaded));\n };\n const interval = setInterval(printProgress, 100);\n\n stream.on('data', (chunk: Buffer) => {\n downloaded += chunk.length;\n });\n\n stream.on('end', () => {\n clearInterval(interval);\n printProgress();\n process.stderr.write('\\nFinished downloading assets\\n');\n });\n}\n\nfunction getApiKeyOrThrow(): string {\n const auth = readAuth();\n if (!auth?.apiKey) {\n throw new Error('Not logged in. Please provide apiKey or run: sharetribe-cli login');\n }\n return auth.apiKey;\n}\n\nfunction getAssetsPullUrl(marketplace: string, version?: string): URL {\n const url = new URL(getApiBaseUrl() + '/assets/pull');\n url.searchParams.set('marketplace', marketplace);\n if (version) {\n url.searchParams.set('version', version);\n } else {\n url.searchParams.set('version-alias', 'latest');\n }\n return url;\n}\n\nfunction getErrorMessage(body: string, statusCode: number): string {\n try {\n const parsed = JSON.parse(body) as { errors?: Array<{ message?: string }> };\n const message = parsed.errors?.[0]?.message;\n if (message) {\n return message;\n }\n } catch {\n // Ignore JSON parse errors\n }\n return body || `HTTP ${statusCode}`;\n}\n\nasync function getAssetsZipStream(\n marketplace: string,\n version?: string\n): Promise<http.IncomingMessage> {\n const url = getAssetsPullUrl(marketplace, version);\n const apiKey = getApiKeyOrThrow();\n const isHttps = url.protocol === 'https:';\n const client = isHttps ? https : http;\n\n return new Promise((resolve, reject) => {\n const req = client.request(\n {\n method: 'GET',\n hostname: url.hostname,\n port: url.port || (isHttps ? 443 : 80),\n path: url.pathname + url.search,\n headers: {\n Authorization: `Apikey ${apiKey}`,\n Accept: 'application/zip',\n },\n },\n (res) => {\n const statusCode = res.statusCode || 0;\n if (statusCode < 200 || statusCode >= 300) {\n const chunks: Buffer[] = [];\n res.on('data', (chunk: Buffer) => chunks.push(chunk));\n res.on('end', () => {\n const body = Buffer.concat(chunks).toString('utf-8');\n reject(new Error(getErrorMessage(body, statusCode)));\n });\n return;\n }\n resolve(res);\n }\n );\n\n req.setTimeout(120000, () => {\n req.destroy(new Error('Request timeout'));\n });\n req.on('error', reject);\n req.end();\n });\n}\n\nfunction createTempZipPath(): string {\n return join(tmpdir(), `assets-${Date.now()}.zip`);\n}\n\nfunction removeAssetsDir(filename: string): string {\n if (filename.startsWith(ASSETS_DIR)) {\n return filename.slice(ASSETS_DIR.length);\n }\n return filename;\n}\n\nfunction readStreamToString(stream: NodeJS.ReadableStream): Promise<string> {\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n stream.on('data', (chunk: Buffer) => chunks.push(chunk));\n stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));\n stream.on('error', reject);\n });\n}\n\nasync function unzipAssets(zipPath: string, basePath: string): Promise<AssetMetadata> {\n return new Promise((resolve, reject) => {\n yauzl.open(zipPath, { lazyEntries: true }, (err, zipfile) => {\n if (err || !zipfile) {\n reject(err || new Error('Failed to open zip file'));\n return;\n }\n\n let assetMeta: AssetMetadata | null = null;\n\n zipfile.on('error', reject);\n zipfile.on('end', () => {\n if (!assetMeta) {\n reject(new Error('Asset metadata not found in zip'));\n return;\n }\n resolve(assetMeta);\n });\n\n zipfile.readEntry();\n zipfile.on('entry', (entry) => {\n if (entry.fileName.endsWith('/')) {\n zipfile.readEntry();\n return;\n }\n\n zipfile.openReadStream(entry, (streamErr, readStream) => {\n if (streamErr || !readStream) {\n reject(streamErr || new Error('Failed to read zip entry'));\n return;\n }\n\n if (entry.fileName === ASSET_META_FILENAME) {\n readStreamToString(readStream)\n .then((content) => {\n assetMeta = parseAssetMetadataEdn(content);\n if (!assetMeta) {\n reject(new Error('Invalid asset metadata'));\n return;\n }\n zipfile.readEntry();\n })\n .catch(reject);\n return;\n }\n\n const assetPath = join(basePath, removeAssetsDir(entry.fileName));\n const assetDir = dirname(assetPath);\n if (!existsSync(assetDir)) {\n mkdirSync(assetDir, { recursive: true });\n }\n\n pipeline(readStream, createWriteStream(assetPath))\n .then(() => zipfile.readEntry())\n .catch(reject);\n });\n });\n });\n });\n}\n\n/**\n * Pulls assets from remote\n */\nasync function pullAssets(\n marketplace: string,\n path: string,\n version?: string,\n prune?: boolean\n): Promise<void> {\n try {\n // Create directory if it doesn't exist\n if (!existsSync(path)) {\n mkdirSync(path, { recursive: true });\n }\n\n const stat = statSync(path);\n if (!stat.isDirectory()) {\n throw new Error(`${path} is not a directory`);\n }\n\n const localAssets = prune ? listLocalAssetPaths(path) : [];\n const currentMeta = readAssetMetadata(path);\n const tempZipPath = createTempZipPath();\n\n try {\n const zipStream = await getAssetsZipStream(marketplace, version);\n printDownloadProgress(zipStream);\n await pipeline(zipStream, createWriteStream(tempZipPath));\n\n const newAssetMeta = await unzipAssets(tempZipPath, path);\n const remoteVersion = newAssetMeta.version;\n\n const deletedPaths = prune\n ? new Set(localAssets.filter(p => !newAssetMeta.assets.some(a => a.path === p)))\n : new Set<string>();\n\n const updated = currentMeta?.version !== remoteVersion;\n const shouldReportUpdate = updated || deletedPaths.size > 0;\n\n if (deletedPaths.size > 0) {\n for (const assetPath of deletedPaths) {\n const fullPath = join(path, assetPath);\n if (existsSync(fullPath)) {\n unlinkSync(fullPath);\n }\n }\n }\n\n if (shouldReportUpdate) {\n writeAssetMetadata(path, {\n version: remoteVersion,\n assets: newAssetMeta.assets,\n });\n console.log(`Version ${remoteVersion} successfully pulled.`);\n } else {\n console.log('Assets are up to date.');\n }\n } finally {\n if (existsSync(tempZipPath)) {\n unlinkSync(tempZipPath);\n }\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to pull assets');\n }\n process.exit(1);\n }\n}\n\n/**\n * Filters assets to only those that have changed\n */\nfunction filterChangedAssets(\n existingMeta: Array<{ path: string; 'content-hash': string }>,\n localAssets: Array<{ path: string; hash: string }>\n): Array<{ path: string; data: Buffer; hash: string }> {\n const hashByPath = new Map(existingMeta.map(a => [a.path, a['content-hash']]));\n \n return localAssets.filter(asset => {\n const storedHash = hashByPath.get(asset.path);\n // Assets without stored metadata are treated as changed\n return !storedHash || storedHash !== asset.hash;\n });\n}\n\n/**\n * Pushes assets to remote\n */\nasync function pushAssets(\n marketplace: string,\n path: string,\n prune?: boolean\n): Promise<void> {\n try {\n // Validate path\n if (!existsSync(path) || !statSync(path).isDirectory()) {\n throw new Error(`${path} is not a valid directory`);\n }\n\n // Read current metadata\n const currentMeta = readAssetMetadata(path);\n const currentVersion = currentMeta?.version || 'nil';\n\n // Read local assets\n const localAssets = readLocalAssets(path);\n\n // Validate JSON files\n validateJsonAssets(localAssets);\n\n // Filter to only changed assets\n const changedAssets = filterChangedAssets(currentMeta?.assets || [], localAssets);\n\n // Separate JSON and non-JSON assets\n const isJsonAsset = (assetPath: string): boolean => {\n return assetPath.toLowerCase().endsWith('.json');\n };\n\n const stageableAssets = changedAssets.filter(a => !isJsonAsset(a.path));\n\n // Find assets to delete (if prune enabled)\n const localAssetMap = new Map(localAssets.map(a => [a.path, a]));\n const deleteOperations: Array<{ path: string; op: 'delete' }> = [];\n if (prune && currentMeta) {\n for (const currentAsset of currentMeta.assets) {\n if (!localAssetMap.has(currentAsset.path)) {\n deleteOperations.push({\n path: currentAsset.path,\n op: 'delete',\n });\n }\n }\n }\n\n // Check if there are any changes\n const noOps = changedAssets.length === 0 && deleteOperations.length === 0;\n if (noOps) {\n console.log('Assets are up to date.');\n return;\n }\n\n // Log changed assets\n if (changedAssets.length > 0) {\n const paths = changedAssets.map(a => a.path).join(', ');\n console.log(chalk.green(`Uploading changed assets: ${paths}`));\n }\n\n // Stage non-JSON assets\n const stagedByPath = new Map<string, string>();\n if (stageableAssets.length > 0) {\n const paths = stageableAssets.map(a => a.path).join(', ');\n console.log(chalk.green(`Staging assets: ${paths}`));\n\n for (const asset of stageableAssets) {\n try {\n const stagingResult = await sdkStageAsset(\n undefined,\n marketplace,\n asset.data,\n asset.path\n );\n stagedByPath.set(asset.path, stagingResult.stagingId);\n } catch (error) {\n if (error && typeof error === 'object' && 'code' in error && error.code === 'asset-invalid-content') {\n const detail = 'message' in error ? error.message : 'The file is missing or uses an unsupported format.';\n throw new Error(`Failed to stage image ${asset.path}: ${detail}\\nFix the file and rerun assets push to retry staging.`);\n }\n throw error;\n }\n }\n }\n\n // Build upsert operations\n const upsertOperations = changedAssets.map(asset => {\n const stagingId = stagedByPath.get(asset.path);\n return {\n path: asset.path,\n op: 'upsert' as const,\n ...(stagingId\n ? { stagingId }\n : { data: asset.data, filename: asset.path }),\n };\n });\n\n // Upload to API\n const result = await sdkPushAssets(\n undefined,\n marketplace,\n currentVersion,\n [...upsertOperations, ...deleteOperations]\n );\n\n // Update local metadata\n writeAssetMetadata(path, {\n version: result.version,\n assets: result.assets.map(a => ({\n path: a.path,\n 'content-hash': a.contentHash,\n })),\n });\n\n console.log(`New version ${result.version} successfully created.`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to push assets');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers assets commands\n */\nexport function registerAssetsCommands(program: Command): void {\n const assetsCmd = program.command('assets').description('manage marketplace assets');\n\n // assets pull\n assetsCmd\n .command('pull')\n .description('pull assets from remote')\n .requiredOption('--path <PATH>', 'path to directory where assets will be stored')\n .option('--version <VERSION>', 'version of assets to pull')\n .option('--prune', 'delete local files no longer present as remote assets')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pullAssets(marketplace, opts.path, opts.version, opts.prune);\n });\n\n // assets push\n assetsCmd\n .command('push')\n .description('push assets to remote')\n .requiredOption('--path <PATH>', 'path to directory with assets')\n .option('--prune', 'delete remote assets no longer present locally')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await pushAssets(marketplace, opts.path, opts.prune);\n });\n}\n\nexport const __test__ = {\n formatDownloadProgress,\n removeAssetsDir,\n parseAssetMetadataEdn,\n};\n", "/**\n * Notifications commands - manage email notifications\n */\n\nimport { Command } from 'commander';\nimport {\n sendNotification as sdkSendNotification,\n previewNotification as sdkPreviewNotification,\n} from 'sharetribe-flex-build-sdk';\nimport { printError } from '../../util/output.js';\nimport { readFileSync, existsSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { createServer, IncomingMessage, ServerResponse } from 'node:http';\n\n\n/**\n * Reads a notification template from a directory\n */\nfunction readTemplate(templatePath: string): { html: string; subject: string } {\n if (!existsSync(templatePath) || !statSync(templatePath).isDirectory()) {\n throw new Error(`Template directory not found: ${templatePath}`);\n }\n\n const htmlPath = join(templatePath, 'template.html');\n const subjectPath = join(templatePath, 'template-subject.txt');\n\n if (!existsSync(htmlPath)) {\n throw new Error(`template.html not found in ${templatePath}`);\n }\n\n if (!existsSync(subjectPath)) {\n throw new Error(`template-subject.txt not found in ${templatePath}`);\n }\n\n const html = readFileSync(htmlPath, 'utf-8');\n const subject = readFileSync(subjectPath, 'utf-8').trim();\n\n return { html, subject };\n}\n\n/**\n * Reads template context JSON file\n */\nfunction readContext(contextPath?: string): unknown {\n if (!contextPath) {\n return undefined;\n }\n\n if (!existsSync(contextPath)) {\n throw new Error(`Context file not found: ${contextPath}`);\n }\n\n const content = readFileSync(contextPath, 'utf-8');\n try {\n return JSON.parse(content);\n } catch (error) {\n throw new Error(`Invalid JSON in context file: ${error}`);\n }\n}\n\n/**\n * Sends a preview email to the marketplace admin\n */\nasync function sendNotification(\n marketplace: string,\n templatePath: string,\n contextPath?: string\n): Promise<void> {\n try {\n const template = readTemplate(templatePath);\n const context = readContext(contextPath);\n\n const result = await sdkSendNotification(undefined, marketplace, { template, context });\n\n console.log(`Preview successfully sent to ${result.adminEmail}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to send notification');\n }\n process.exit(1);\n }\n}\n\n/**\n * Previews a notification in the browser\n */\nasync function previewNotification(\n marketplace: string,\n templatePath: string,\n contextPath?: string\n): Promise<void> {\n try {\n const template = readTemplate(templatePath);\n const context = readContext(contextPath);\n\n console.log(`Template: ${templatePath}`);\n console.log(`Subject: ${template.subject}`);\n console.log('');\n console.log('Starting preview server at http://localhost:3535');\n console.log('Press Ctrl+C to stop');\n console.log('');\n\n let previewHtml: string | null = null;\n\n // Fetch preview from API\n const fetchPreview = async () => {\n try {\n const result = await sdkPreviewNotification(undefined, marketplace, { template, context });\n\n // Inject title into HTML\n const html = result.html;\n const titleTag = `<title>${template.subject}</title>`;\n\n if (html.includes('<head>')) {\n previewHtml = html.replace('<head>', `<head>\\n${titleTag}`);\n } else if (html.includes('<html>')) {\n previewHtml = html.replace('<html>', `<html>\\n<head>${titleTag}</head>`);\n } else {\n previewHtml = `<html><head>${titleTag}</head><body>${html}</body></html>`;\n }\n } catch (error) {\n const errorMessage = error && typeof error === 'object' && 'message' in error\n ? (error.message as string)\n : 'Failed to preview notification';\n\n previewHtml = `\n <html>\n <head><title>Error</title></head>\n <body style=\"font-family: sans-serif; padding: 20px;\">\n <h1 style=\"color: #d32f2f;\">Error</h1>\n <pre style=\"background: #f5f5f5; padding: 15px; border-radius: 4px;\">${errorMessage}</pre>\n </body>\n </html>\n `;\n }\n };\n\n // Initial fetch\n await fetchPreview();\n\n // Create HTTP server\n const server = createServer(async (req: IncomingMessage, res: ServerResponse) => {\n if (req.url === '/' || req.url === '') {\n // Refresh preview on each request\n await fetchPreview();\n\n res.writeHead(200, { 'Content-Type': 'text/html' });\n res.end(previewHtml);\n } else {\n res.writeHead(404, { 'Content-Type': 'text/plain' });\n res.end('Not Found');\n }\n });\n\n server.listen(3535, () => {\n console.log('Preview server started. Open http://localhost:3535 in your browser.');\n });\n\n // Handle graceful shutdown\n const shutdown = () => {\n console.log('\\nShutting down preview server...');\n server.close(() => {\n process.exit(0);\n });\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to preview notification');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers notifications commands\n */\nexport function registerNotificationsCommands(program: Command): void {\n const notificationsCmd = program\n .command('notifications')\n .description('manage email notifications');\n\n // notifications preview\n notificationsCmd\n .command('preview')\n .description('render a preview of an email template')\n .requiredOption('--template <TEMPLATE_DIR>', 'path to template directory')\n .option('--context <CONTEXT_FILE>', 'path to email rendering context JSON file')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await previewNotification(marketplace, opts.template, opts.context);\n });\n\n // notifications send\n notificationsCmd\n .command('send')\n .description('send a preview of an email template to the logged in admin')\n .requiredOption('--template <TEMPLATE_DIR>', 'path to template directory')\n .option('--context <CONTEXT_FILE>', 'path to email rendering context JSON file')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await sendNotification(marketplace, opts.template, opts.context);\n });\n}\n", "/**\n * Listing approval command - DEPRECATED\n *\n * This command is deprecated and should not be used.\n * Use the Sharetribe Console instead.\n */\n\nimport { Command } from 'commander';\nimport {\n getListingApprovalStatus as sdkGetStatus,\n enableListingApproval as sdkEnable,\n disableListingApproval as sdkDisable,\n} from 'sharetribe-flex-build-sdk';\nimport { printError } from '../util/output.js';\n\n/**\n * Gets current listing approval status\n */\nasync function getStatus(marketplace: string): Promise<void> {\n try {\n const result = await sdkGetStatus(undefined, marketplace);\n\n if (result.enabled) {\n console.log(`Listing approvals are enabled in ${marketplace}`);\n } else {\n console.log(`Listing approvals are disabled in ${marketplace}`);\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to get listing approval status');\n }\n process.exit(1);\n }\n}\n\n/**\n * Enables listing approvals\n */\nasync function enableApprovals(marketplace: string): Promise<void> {\n try {\n await sdkEnable(undefined, marketplace);\n console.log(`Successfully enabled listing approvals in ${marketplace}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to enable listing approvals');\n }\n process.exit(1);\n }\n}\n\n/**\n * Disables listing approvals\n */\nasync function disableApprovals(marketplace: string): Promise<void> {\n try {\n await sdkDisable(undefined, marketplace);\n console.log(`Successfully disabled listing approvals in ${marketplace}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to disable listing approvals');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers listing-approval command\n */\nexport function registerListingApprovalCommand(program: Command): void {\n const cmd = program\n .command('listing-approval')\n .description('manage listing approvals (DEPRECATED - use Console instead)')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier');\n\n // Default action - show status\n cmd.action(async (opts) => {\n console.warn('Warning: CLI command `listing-approval` is deprecated. Use Console instead.');\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await getStatus(marketplace);\n });\n\n // Enable subcommand\n cmd\n .command('enable')\n .description('enable listing approvals')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n console.warn('Warning: CLI command `listing-approval` is deprecated. Use Console instead.');\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await enableApprovals(marketplace);\n });\n\n // Disable subcommand\n cmd\n .command('disable')\n .description('disable listing approvals')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n console.warn('Warning: CLI command `listing-approval` is deprecated. Use Console instead.');\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await disableApprovals(marketplace);\n });\n}\n", "/**\n * Events command - query marketplace events\n */\n\nimport { Command } from 'commander';\nimport { printTable, printError } from '../../util/output.js';\nimport {\n queryEvents as sdkQueryEvents,\n pollEvents as sdkPollEvents,\n type EventData as SdkEventData\n} from 'sharetribe-flex-build-sdk';\n\ninterface EventsQueryOptions {\n resourceId?: string;\n relatedResourceId?: string;\n eventTypes?: string;\n sequenceId?: number;\n afterSeqId?: number;\n beforeSeqId?: number;\n afterTs?: string;\n beforeTs?: string;\n limit?: number;\n json?: boolean;\n jsonPretty?: boolean;\n}\n\n/**\n * Validates query parameters\n */\nfunction validateParams(opts: EventsQueryOptions): void {\n const exclusiveParams = [\n opts.sequenceId !== undefined,\n opts.afterSeqId !== undefined,\n opts.beforeSeqId !== undefined,\n opts.afterTs !== undefined,\n opts.beforeTs !== undefined,\n ];\n\n if (exclusiveParams.filter(Boolean).length > 1) {\n throw new Error(\n 'Only one of --seqid, --after-seqid, --before-seqid, --after-ts, or --before-ts can be specified'\n );\n }\n\n if (opts.resourceId && opts.relatedResourceId) {\n throw new Error('Only one of --resource or --related-resource can be specified');\n }\n}\n\n/**\n * Formats timestamp to match flex-cli format: YYYY-MM-DD H:MM:SS AM/PM\n */\nfunction formatTimestamp(timestamp: string): string {\n try {\n const date = new Date(timestamp);\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n const timeString = date.toLocaleTimeString('en-US');\n\n return `${year}-${month}-${day} ${timeString}`;\n } catch {\n return timestamp;\n }\n}\n\n/**\n * Queries events from API\n */\nasync function queryEvents(\n marketplace: string,\n opts: EventsQueryOptions\n): Promise<void> {\n try {\n validateParams(opts);\n\n const events = await sdkQueryEvents(\n undefined, // Use auth from file\n marketplace,\n {\n resourceId: opts.resourceId,\n relatedResourceId: opts.relatedResourceId,\n eventTypes: opts.eventTypes,\n sequenceId: opts.sequenceId,\n afterSeqId: opts.afterSeqId,\n beforeSeqId: opts.beforeSeqId,\n afterTs: opts.afterTs,\n beforeTs: opts.beforeTs,\n limit: opts.limit,\n }\n );\n\n if (events.length === 0) {\n console.log('No events found.');\n return;\n }\n\n // Output format\n if (opts.json) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails));\n }\n } else if (opts.jsonPretty) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails, null, 2));\n }\n } else {\n printTable(\n ['Seq ID', 'Resource ID', 'Event type', 'Created at local time', 'Source', 'Actor'],\n events.map((event) => {\n const actor = event.auditEmails?.userEmail || event.auditEmails?.adminEmail || '';\n const source = event.source?.replace('source/', '') || '';\n\n return {\n 'Seq ID': event.sequenceId.toString(),\n 'Resource ID': event.resourceId,\n 'Event type': event.eventType,\n 'Created at local time': formatTimestamp(event.createdAt),\n 'Source': source,\n 'Actor': actor,\n };\n })\n );\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to query events');\n }\n process.exit(1);\n }\n}\n\n/**\n * Tails events (live streaming)\n */\nasync function tailEvents(\n marketplace: string,\n opts: EventsQueryOptions\n): Promise<void> {\n try {\n validateParams(opts);\n\n console.log('Tailing events... Press Ctrl+C to stop');\n console.log('');\n\n const stopPolling = sdkPollEvents(\n undefined, // Use auth from file\n marketplace,\n {\n resourceId: opts.resourceId,\n relatedResourceId: opts.relatedResourceId,\n eventTypes: opts.eventTypes,\n limit: opts.limit || 10,\n },\n (events: SdkEventData[]) => {\n // Output events\n if (opts.json) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails));\n }\n } else if (opts.jsonPretty) {\n for (const event of events) {\n // Exclude auditEmails to match flex-cli JSON format\n const { auditEmails, ...eventWithoutEmails } = event;\n console.log(JSON.stringify(eventWithoutEmails, null, 2));\n }\n } else {\n printTable(\n ['Seq ID', 'Resource ID', 'Event type', 'Created at local time', 'Source', 'Actor'],\n events.map((event) => {\n const actor = event.auditEmails?.userEmail || event.auditEmails?.adminEmail || '';\n const source = event.source?.replace('source/', '') || '';\n\n return {\n 'Seq ID': event.sequenceId.toString(),\n 'Resource ID': event.resourceId,\n 'Event type': event.eventType,\n 'Created at local time': formatTimestamp(event.createdAt),\n 'Source': source,\n 'Actor': actor,\n };\n })\n );\n }\n },\n 5000 // 5 second poll interval\n );\n\n // Handle graceful shutdown\n const shutdown = () => {\n console.log('\\nStopping tail...');\n stopPolling();\n process.exit(0);\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to tail events');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers events command\n */\nexport function registerEventsCommand(program: Command): void {\n const cmd = program\n .command('events')\n .description('Get a list of events.')\n .option('--resource <RESOURCE_ID>', 'show events for specific resource ID')\n .option('--related-resource <RELATED_RESOURCE_ID>', 'show events related to specific resource ID')\n .option('--filter <EVENT_TYPES>', 'filter by event types (comma-separated)')\n .option('--seqid <SEQUENCE_ID>', 'get event with specific sequence ID', parseInt)\n .option('--after-seqid <SEQUENCE_ID>', 'show events after sequence ID (exclusive)', parseInt)\n .option('--before-seqid <SEQUENCE_ID>', 'show events before sequence ID (exclusive)', parseInt)\n .option('--after-ts <TIMESTAMP>', 'show events after timestamp')\n .option('--before-ts <TIMESTAMP>', 'show events before timestamp')\n .option('-l, --limit <NUMBER>', 'limit results (default: 100, max: 100)', parseInt)\n .option('--json', 'output as single-line JSON strings')\n .option('--json-pretty', 'output as indented multi-line JSON')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier');\n\n // Default action - query\n cmd.action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Could not parse arguments:');\n console.error('--marketplace is required');\n process.exit(1);\n }\n\n await queryEvents(marketplace, {\n resourceId: opts.resource,\n relatedResourceId: opts.relatedResource,\n eventTypes: opts.filter,\n sequenceId: opts.seqid,\n afterSeqId: opts.afterSeqid,\n beforeSeqId: opts.beforeSeqid,\n afterTs: opts.afterTs,\n beforeTs: opts.beforeTs,\n limit: opts.limit || 100,\n json: opts.json,\n jsonPretty: opts.jsonPretty,\n });\n });\n\n // tail subcommand\n cmd\n .command('tail')\n .description('Tail events live as they happen')\n .option('--resource <RESOURCE_ID>', 'show events for specific resource ID')\n .option('--related-resource <RELATED_RESOURCE_ID>', 'show events related to specific resource ID')\n .option('--filter <EVENT_TYPES>', 'filter by event types (comma-separated)')\n .option('-l, --limit <NUMBER>', 'limit results per poll (default: 10, max: 100)', parseInt)\n .option('--json', 'output as single-line JSON strings')\n .option('--json-pretty', 'output as indented multi-line JSON')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Could not parse arguments:');\n console.error('--marketplace is required');\n process.exit(1);\n }\n\n await tailEvents(marketplace, {\n resourceId: opts.resource,\n relatedResourceId: opts.relatedResource,\n eventTypes: opts.filter,\n limit: opts.limit || 10,\n json: opts.json,\n jsonPretty: opts.jsonPretty,\n });\n });\n}\n", "/**\n * Stripe command - manage Stripe integration\n */\n\nimport { Command } from 'commander';\nimport { updateStripeVersion as sdkUpdateStripeVersion, SUPPORTED_STRIPE_VERSIONS } from 'sharetribe-flex-build-sdk';\nimport { printError } from '../../util/output.js';\nimport inquirer from 'inquirer';\n\n\n/**\n * Prompts for version selection\n */\nasync function promptForVersion(): Promise<string> {\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'version',\n message: 'Select Stripe API version:',\n choices: [...SUPPORTED_STRIPE_VERSIONS],\n },\n ]);\n\n return answers.version;\n}\n\n/**\n * Prompts for confirmation\n */\nasync function promptForConfirmation(): Promise<boolean> {\n console.log('');\n console.log('WARNING: Changing Stripe API version may affect your integration.');\n console.log('');\n console.log('After updating the Stripe API version, you may need to:');\n console.log('- Handle new Capabilities requirements');\n console.log('- Update identity verification settings');\n console.log('');\n console.log('See Stripe documentation for details:');\n console.log('https://stripe.com/docs/connect/capabilities-overview');\n console.log('https://stripe.com/docs/connect/identity-verification');\n console.log('');\n\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'confirmed',\n message: 'Do you want to continue?',\n default: false,\n },\n ]);\n\n return answers.confirmed;\n}\n\n/**\n * Updates Stripe API version\n */\nasync function updateStripeVersion(\n marketplace: string,\n version?: string,\n force?: boolean\n): Promise<void> {\n try {\n // Get version if not provided\n let selectedVersion = version;\n if (!selectedVersion) {\n selectedVersion = await promptForVersion();\n }\n\n // Get confirmation unless --force flag is used\n if (!force) {\n const confirmed = await promptForConfirmation();\n if (!confirmed) {\n console.log('Cancelled.');\n process.exit(0);\n }\n }\n\n // Update via API (SDK validates version)\n await sdkUpdateStripeVersion(undefined, marketplace, selectedVersion);\n\n console.log(`Stripe API version successfully changed to ${selectedVersion}`);\n } catch (error) {\n if (error && typeof error === 'object' && 'message' in error) {\n printError(error.message as string);\n } else {\n printError('Failed to update Stripe API version');\n }\n process.exit(1);\n }\n}\n\n/**\n * Registers stripe commands\n */\nexport function registerStripeCommands(program: Command): void {\n const stripeCmd = program.command('stripe').description('manage Stripe integration');\n\n // stripe update-version\n stripeCmd\n .command('update-version')\n .description('update Stripe API version in use')\n .option('--version <VERSION>', 'Stripe API version to update to')\n .option('-f, --force', 'skip confirmation prompt and force update')\n .option('-m, --marketplace <MARKETPLACE_ID>', 'marketplace identifier')\n .action(async (opts) => {\n const marketplace = opts.marketplace || program.opts().marketplace;\n if (!marketplace) {\n console.error('Error: --marketplace is required');\n process.exit(1);\n }\n await updateStripeVersion(marketplace, opts.version, opts.force);\n });\n}\n", "/**\n * Debug command - display config and auth info\n */\n\nimport { getConfigMap, readAuth } from 'sharetribe-flex-build-sdk';\n\nfunction maskLast4(value: string): string {\n if (value.length <= 4) {\n return `...${value}`;\n }\n return `...${value.slice(-4)}`;\n}\n\nexport function debug(): void {\n const auth = readAuth();\n const apiKey = auth?.apiKey ? maskLast4(auth.apiKey) : 'No API key set';\n const confMap = getConfigMap();\n\n const confMapEntries = Object.keys(confMap)\n .sort()\n .map((key) => `:${key} ${confMap[key]}`)\n .join(' ');\n const confMapFormatted = confMapEntries ? `{${confMapEntries}}` : '{}';\n\n console.log(`{:api-key ${apiKey}, :conf-map ${confMapFormatted}}`);\n}\n", "/**\n * Custom help formatter to match flex-cli output exactly\n */\n\nimport { Command, Help } from 'commander';\nimport chalk from 'chalk';\n\n/**\n * Formats help text to match flex-cli style\n *\n * flex-cli format:\n * - Description (no label)\n * - VERSION section (for main help only)\n * - USAGE section\n * - COMMANDS section (flattened list of all leaf commands)\n * - OPTIONS section (for subcommands only, not main)\n * - Subcommand help instructions\n *\n * @param cmd - Commander command instance\n * @returns Formatted help text matching flex-cli\n */\nexport function formatHelp(cmd: Command): string {\n const parts: string[] = [];\n const isRootCommand = !cmd.parent;\n\n // Description (no label, just the text)\n const description = cmd.description();\n if (description) {\n parts.push(description);\n parts.push('');\n }\n\n // VERSION section (only for root command)\n if (isRootCommand) {\n const version = cmd.version();\n if (version) {\n parts.push('VERSION');\n parts.push(` ${version}`);\n parts.push('');\n }\n }\n\n // USAGE section\n parts.push('USAGE');\n const usage = formatUsage(cmd);\n parts.push(` $ ${usage}`);\n parts.push('');\n\n // COMMANDS section\n // Note: If command has an action (options), don't show COMMANDS section (like flex-cli)\n const allCommands = collectAllLeafCommands(cmd);\n const hasAction = cmd.options.length > 0 && !isRootCommand;\n\n if (allCommands.length > 0 && !hasAction) {\n parts.push('COMMANDS');\n\n // Calculate max command name length for alignment\n const maxLength = Math.max(...allCommands.map(c => c.name.length));\n\n for (const cmdInfo of allCommands) {\n const paddedName = cmdInfo.name.padEnd(maxLength + 2);\n parts.push(` ${paddedName}${cmdInfo.description}`);\n }\n parts.push('');\n }\n\n // OPTIONS section (only for subcommands, not root)\n if (!isRootCommand) {\n const options = cmd.options;\n if (options.length > 0) {\n parts.push('OPTIONS');\n\n // Calculate max option flags length for alignment\n const maxFlagsLength = Math.max(...options.map(opt => formatOptionFlags(opt).length));\n\n for (const opt of options) {\n const flags = formatOptionFlags(opt);\n const paddedFlags = flags.padEnd(maxFlagsLength + 2);\n const desc = opt.description || '';\n parts.push(` ${paddedFlags}${desc}`);\n }\n parts.push('');\n }\n }\n\n // Subcommand help instructions (only for main and group commands without actions)\n if (allCommands.length > 0 && !hasAction) {\n parts.push('Subcommand help:');\n const cmdName = getCommandName(cmd);\n parts.push(` $ ${cmdName} help [COMMAND]`);\n }\n\n // Always add empty line at end to match flex-cli\n parts.push('');\n\n return parts.join('\\n');\n}\n\n/**\n * Recursively collects all commands (both parent and leaf commands)\n *\n * flex-cli shows ALL commands, including parent commands that have their own actions\n * Example: both \"events\" and \"events tail\" are shown\n *\n * @param cmd - Commander command instance\n * @returns Array of command info objects with name and description\n */\nfunction collectAllLeafCommands(cmd: Command): Array<{ name: string; description: string }> {\n const results: Array<{ name: string; description: string }> = [];\n const commands = cmd.commands.filter(c => !c._hidden && c.name() !== 'help');\n\n for (const subCmd of commands) {\n const fullName = getCommandFullName(subCmd);\n const subCommands = subCmd.commands.filter(c => !c._hidden);\n\n // Add this command if it has an action or description\n if (subCmd.description()) {\n results.push({\n name: fullName,\n description: subCmd.description() || ''\n });\n }\n\n // If it has subcommands, recurse and add those too\n if (subCommands.length > 0) {\n const subResults = collectAllLeafCommands(subCmd);\n for (const sub of subResults) {\n results.push(sub);\n }\n }\n }\n\n // Add \"help\" command at the beginning if this is root\n if (!cmd.parent) {\n results.unshift({\n name: 'help',\n description: 'display help for Flex CLI'\n });\n }\n\n // Sort alphabetically by command name\n results.sort((a, b) => a.name.localeCompare(b.name));\n\n return results;\n}\n\n/**\n * Gets the command name for usage (flex-cli vs sharetribe-cli)\n *\n * @param cmd - Commander command instance\n * @returns Command name (e.g., \"sharetribe-cli\" or \"sharetribe-cli process\")\n */\nfunction getCommandName(cmd: Command): string {\n const names: string[] = [];\n let current: Command | null = cmd;\n\n while (current) {\n if (current.name()) {\n names.unshift(current.name());\n }\n current = current.parent;\n }\n\n // Replace first name with \"sharetribe-cli\" (or \"flex-cli\" for reference)\n if (names.length > 0) {\n names[0] = 'sharetribe-cli';\n }\n\n return names.join(' ');\n}\n\n/**\n * Formats the USAGE line\n *\n * @param cmd - Commander command instance\n * @returns Usage string (e.g., \"sharetribe-cli [COMMAND]\" or \"sharetribe-cli process list\")\n */\nfunction formatUsage(cmd: Command): string {\n const cmdName = getCommandName(cmd);\n const commands = cmd.commands.filter(c => !c._hidden);\n const hasOptions = cmd.options.length > 0;\n const isRoot = !cmd.parent;\n\n // Root command always shows [COMMAND] if it has subcommands\n if (isRoot && commands.length > 0) {\n return `${cmdName} [COMMAND]`;\n }\n\n // If command has options (its own action), don't show [COMMAND] even if it has subcommands\n // This matches flex-cli behavior for commands like \"process\" which have both action and subcommands\n if (commands.length > 0 && !hasOptions) {\n // Has subcommands but no action\n return `${cmdName} [COMMAND]`;\n } else {\n // Leaf command or command with action - just show the command path\n return cmdName;\n }\n}\n\n/**\n * Gets the full command name including parent path\n *\n * @param cmd - Commander command instance\n * @returns Full command name (e.g., \"process list\" or \"events tail\")\n */\nfunction getCommandFullName(cmd: Command): string {\n const names: string[] = [];\n let current: Command | null = cmd;\n\n while (current && current.parent) {\n if (current.name()) {\n names.unshift(current.name());\n }\n current = current.parent;\n }\n\n return names.join(' ');\n}\n\n/**\n * Formats option flags for display\n *\n * @param opt - Commander option instance\n * @returns Formatted flags string (e.g., \"-m, --marketplace=MARKETPLACE_ID\")\n */\nfunction formatOptionFlags(opt: any): string {\n // Commander option flags are in opt.flags (e.g., \"-m, --marketplace <MARKETPLACE_ID>\")\n // We need to parse and reformat this to match flex-cli style\n const flagsStr = opt.flags || '';\n\n // Parse the flags string\n // Format: \"-m, --marketplace <VALUE>\" or \"--flag\" or \"-f\"\n const parts = flagsStr.split(/,\\s*/);\n const formatted: string[] = [];\n\n for (const part of parts) {\n const trimmed = part.trim();\n\n // Check if it has a value placeholder (angle brackets or square brackets)\n const valueMatch = trimmed.match(/^((?:-{1,2}[\\w-]+))\\s*[<\\[]([^\\]>]+)[\\]>]/);\n if (valueMatch) {\n // Has a value: \"-m <MARKETPLACE_ID>\" or \"--marketplace <MARKETPLACE_ID>\"\n const flag = valueMatch[1];\n const valueName = valueMatch[2];\n formatted.push(`${flag}=${valueName}`);\n } else {\n // No value: just the flag\n formatted.push(trimmed);\n }\n }\n\n return formatted.join(', ');\n}\n\n/**\n * Configures Commander.js to use custom help formatter\n *\n * @param program - Commander program instance\n */\nexport function configureHelp(program: Command): void {\n program.configureHelp({\n formatHelp: (cmd: Command, helper: Help) => {\n return formatHelp(cmd);\n }\n });\n}\n", "/**\n * Custom command router to handle Commander.js limitations\n *\n * Commander.js cannot handle parent and child commands with the same option names.\n * This router intercepts argv and routes to the correct command handler.\n */\n\n/**\n * Routes process subcommands to avoid Commander parent/child option conflicts\n *\n * This is necessary because Commander validates parent command options before\n * subcommand actions run, causing conflicts when both use --path.\n */\nexport function routeProcessCommand(argv: string[]): string[] {\n // Check if this is a process subcommand\n const processIndex = argv.findIndex(arg => arg === 'process');\n if (processIndex === -1) {\n return argv;\n }\n\n // Check for subcommands\n const nextArg = argv[processIndex + 1];\n const subcommands = ['list', 'create', 'push', 'pull', 'create-alias', 'update-alias', 'delete-alias', 'deploy'];\n\n if (nextArg && subcommands.includes(nextArg)) {\n // This is a subcommand - remove 'process' from argv and make the subcommand top-level\n // e.g. ['node', 'cli', 'process', 'pull', ...] => ['node', 'cli', 'process-pull', ...]\n const newArgv = [\n ...argv.slice(0, processIndex),\n `process-${nextArg}`,\n ...argv.slice(processIndex + 2)\n ];\n\n // Special handling: If this is an alias command with --version option,\n // we need to filter out the global --version flag from program\n // by ensuring the routed command is properly isolated\n return newArgv;\n }\n\n return argv;\n}\n"],
|
|
5
|
+
"mappings": ";;AAMA,OAAS,WAAAA,OAAe,YACxB,OAAS,gBAAAC,OAAoB,UAC7B,OAAS,iBAAAC,OAAqB,WAC9B,OAAS,WAAAC,GAAS,QAAAC,OAAY,YCH9B,OAAS,gBAAAC,OAAoB,UAC7B,OAAS,iBAAAC,OAAqB,WAC9B,OAAS,WAAAC,EAAS,QAAAC,OAAY,YAK9B,SAASC,IAA0B,CACjC,IAAMC,EAAaJ,GAAc,YAAY,GAAG,EAC5CK,EAAaJ,EAAQG,CAAU,EAGnC,KAAOC,IAAe,KACpB,GAAI,CACF,IAAMC,EAAUJ,GAAKG,EAAY,cAAc,EAE/C,OADgBN,GAAaO,EAAS,OAAO,CAE/C,MAAQ,CACND,EAAaJ,EAAQI,CAAU,CACjC,CAGF,MAAM,IAAI,MAAM,6BAA6B,CAC/C,CAOO,SAASE,GAAgB,CAC9B,IAAMC,EAAc,KAAK,MAAML,GAAgB,CAAC,EAChD,QAAQ,IAAIK,EAAY,OAAO,CACjC,CC9BA,OAAOC,OAAc,WACrB,OAAS,aAAAC,OAAiB,4BAO1B,eAAsBC,GAAuB,CAC3C,IAAMC,EAAU,MAAMH,GAAS,OAAO,CACpC,CACE,KAAM,WACN,KAAM,SACN,QAAS,iBACT,KAAM,IACN,SAAWI,GACL,CAACA,GAASA,EAAM,KAAK,EAAE,SAAW,EAC7B,0BAEF,EAEX,CACF,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GElB,GAAW,MAAM,CAAC,EAAE,OAKvBE,EAAQ,MAAMF,EAAU,EAJxBE,EAAQ,WAAW",
|
|
6
|
+
"names": ["Command", "readFileSync", "fileURLToPath", "dirname", "join", "readFileSync", "fileURLToPath", "dirname", "join", "findPackageJson", "__filename", "currentDir", "pkgPath", "version", "packageJson", "inquirer", "writeAuth", "login", "answers", "input", "clearAuth", "logout", "sdkListProcesses", "sdkListProcessVersions", "chalk", "printTable", "headers", "rows", "widths", "header", "row", "value", "headerRow", "h", "width", "padded", "rowStr", "i", "printError", "message", "printSuccess", "formatProcessTimestamp", "timestamp", "date", "year", "month", "day", "timeString", "listProcesses", "marketplace", "processName", "versions", "sdkListProcessVersions", "versionRows", "v", "printTable", "processes", "sdkListProcesses", "processRows", "p", "error", "printError", "sdkCreateProcess", "readFileSync", "join", "createProcess", "marketplace", "processName", "path", "processFilePath", "processContent", "result", "sdkCreateProcess", "printSuccess", "error", "printError", "sdkPushProcess", "readFileSync", "readdirSync", "join", "readTemplates", "path", "templatesDir", "templates", "templateDirs", "templateName", "templatePath", "htmlFile", "subjectFile", "html", "subject", "pushProcess", "marketplace", "processName", "processFilePath", "processContent", "result", "sdkPushProcess", "printSuccess", "error", "printError", "getProcess", "writeFileSync", "mkdirSync", "join", "pullProcess", "marketplace", "processName", "path", "version", "alias", "process", "getProcess", "existsSync", "dirExists", "processFilePath", "templates", "templatesDir", "template", "templateName", "htmlContent", "subjectContent", "templateSubdir", "htmlPath", "subjectPath", "error", "printError", "sdkCreateAlias", "sdkUpdateAlias", "sdkDeleteAlias", "createAlias", "marketplace", "processName", "version", "alias", "result", "sdkCreateAlias", "printSuccess", "error", "printError", "updateAlias", "sdkUpdateAlias", "deleteAlias", "sdkDeleteAlias", "sdkDeployProcess", "parseProcessFile", "readFileSync", "join", "createOrPushAndCreateOrUpdateAlias", "marketplace", "processName", "path", "alias", "processFilePath", "processContent", "processDefinition", "parseProcessFile", "result", "sdkDeployProcess", "printSuccess", "error", "printError", "registerProcessCommands", "program", "processCmd", "options", "marketplace", "listProcesses", "createProcess", "pushProcess", "pullProcess", "createAlias", "updateAlias", "deleteAlias", "createOrPushAndCreateOrUpdateAlias", "sdkListSearchSchemas", "sdkSetSearchSchema", "sdkUnsetSearchSchema", "SCOPE_LABELS", "setSearchSchema", "marketplace", "opts", "sdkSetSearchSchema", "schemaFor", "scopeLabel", "error", "printError", "unsetSearchSchema", "sdkUnsetSearchSchema", "getDefaultValueLabel", "value", "listSearchSchemas", "schemas", "sdkListSearchSchemas", "rows", "s", "a", "b", "headers", "widths", "h", "row", "headerParts", "i", "width", "padded", "rowParts", "registerSearchCommands", "program", "searchCmd", "options", "sdkPushAssets", "sdkStageAsset", "getApiBaseUrl", "readAuth", "readFileSync", "writeFileSync", "existsSync", "mkdirSync", "readdirSync", "statSync", "unlinkSync", "createWriteStream", "join", "dirname", "createHash", "http", "https", "tmpdir", "pipeline", "chalk", "edn", "yauzl", "ASSET_META_FILENAME", "ASSETS_DIR", "CLEAR_LINE", "CARRIAGE_RETURN", "parseAssetMetadataEdn", "content", "parsed", "version", "assets", "assetList", "asset", "readAssetMetadata", "basePath", "metaPath", "writeAssetMetadata", "metadata", "metaDir", "a", "ednMap", "calculateHash", "data", "prefix", "readLocalAssets", "scanDir", "dir", "relativePath", "entries", "entry", "fullPath", "relPath", "stat", "hash", "listLocalAssetPaths", "validateJsonAssets", "error", "formatDownloadProgress", "bytes", "mb", "printDownloadProgress", "stream", "downloaded", "printProgress", "interval", "chunk", "getApiKeyOrThrow", "auth", "readAuth", "getAssetsPullUrl", "marketplace", "url", "getApiBaseUrl", "getErrorMessage", "body", "statusCode", "message", "getAssetsZipStream", "apiKey", "isHttps", "client", "resolve", "reject", "req", "res", "chunks", "createTempZipPath", "removeAssetsDir", "filename", "readStreamToString", "unzipAssets", "zipPath", "err", "zipfile", "assetMeta", "streamErr", "readStream", "assetPath", "assetDir", "pullAssets", "path", "prune", "localAssets", "currentMeta", "tempZipPath", "zipStream", "newAssetMeta", "remoteVersion", "deletedPaths", "p", "shouldReportUpdate", "printError", "filterChangedAssets", "existingMeta", "hashByPath", "storedHash", "pushAssets", "currentVersion", "changedAssets", "isJsonAsset", "stageableAssets", "localAssetMap", "deleteOperations", "currentAsset", "paths", "stagedByPath", "stagingResult", "sdkStageAsset", "detail", "upsertOperations", "stagingId", "result", "sdkPushAssets", "registerAssetsCommands", "program", "assetsCmd", "opts", "sdkSendNotification", "sdkPreviewNotification", "readFileSync", "existsSync", "statSync", "join", "createServer", "readTemplate", "templatePath", "htmlPath", "subjectPath", "html", "subject", "readContext", "contextPath", "content", "error", "sendNotification", "marketplace", "template", "context", "result", "sdkSendNotification", "printError", "previewNotification", "previewHtml", "fetchPreview", "sdkPreviewNotification", "titleTag", "server", "req", "res", "shutdown", "registerNotificationsCommands", "program", "notificationsCmd", "opts", "sdkGetStatus", "sdkEnable", "sdkDisable", "getStatus", "marketplace", "sdkGetStatus", "error", "printError", "enableApprovals", "sdkEnable", "disableApprovals", "sdkDisable", "registerListingApprovalCommand", "program", "cmd", "opts", "sdkQueryEvents", "sdkPollEvents", "validateParams", "opts", "formatTimestamp", "timestamp", "date", "year", "month", "day", "timeString", "queryEvents", "marketplace", "events", "event", "auditEmails", "eventWithoutEmails", "printTable", "actor", "source", "error", "printError", "tailEvents", "stopPolling", "shutdown", "registerEventsCommand", "program", "cmd", "sdkUpdateStripeVersion", "SUPPORTED_STRIPE_VERSIONS", "inquirer", "promptForVersion", "SUPPORTED_STRIPE_VERSIONS", "promptForConfirmation", "updateStripeVersion", "marketplace", "version", "force", "selectedVersion", "sdkUpdateStripeVersion", "error", "printError", "registerStripeCommands", "program", "opts", "getConfigMap", "readAuth", "maskLast4", "value", "debug", "auth", "apiKey", "confMap", "confMapEntries", "key", "confMapFormatted", "formatHelp", "cmd", "parts", "isRootCommand", "description", "version", "usage", "formatUsage", "allCommands", "collectAllLeafCommands", "hasAction", "maxLength", "c", "cmdInfo", "paddedName", "options", "maxFlagsLength", "opt", "formatOptionFlags", "paddedFlags", "desc", "cmdName", "getCommandName", "results", "commands", "subCmd", "fullName", "getCommandFullName", "subCommands", "subResults", "sub", "a", "b", "names", "current", "hasOptions", "formatted", "part", "trimmed", "valueMatch", "flag", "valueName", "configureHelp", "program", "helper", "routeProcessCommand", "argv", "processIndex", "arg", "nextArg", "__filename", "fileURLToPath", "__dirname", "dirname", "packageJson", "readFileSync", "join", "routedArgv", "routeProcessCommand", "program", "Command", "configureHelp", "str", "version", "login", "logout", "debug", "registerProcessCommands", "registerSearchCommands", "registerAssetsCommands", "registerNotificationsCommands", "registerListingApprovalCommand", "registerEventsCommand", "registerStripeCommands", "commandPath", "targetCmd", "cmdName", "subCmd", "c"]
|
|
7
7
|
}
|