@tailor-platform/sdk 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["packageJson","listCommand","getCommand","listCommand","createCommand","deleteCommand","listCommand","updateCommand","createCommand","deleteCommand","listCommand","updateCommand","createCommand","deleteCommand","listCommand","createCommand","deleteCommand","listCommand","setTimeout","fs","mimeLookup","listCommand","listCommand","fs","listCommand","listCommand","listCommand","getCommand","createCommand","deleteCommand","listCommand"],"sources":["../../src/cli/init.ts","../../src/cli/login.ts","../../src/cli/logout.ts","../../src/cli/machineuser/index.ts","../../src/cli/oauth2client/index.ts","../../src/cli/profile/create.ts","../../src/cli/profile/delete.ts","../../src/cli/profile/list.ts","../../src/cli/profile/update.ts","../../src/cli/profile/index.ts","../../src/cli/secret/args.ts","../../src/cli/secret/create.ts","../../src/cli/secret/delete.ts","../../src/cli/secret/list.ts","../../src/cli/secret/update.ts","../../src/cli/secret/vault/args.ts","../../src/cli/secret/vault/create.ts","../../src/cli/secret/vault/delete.ts","../../src/cli/secret/vault/list.ts","../../src/cli/secret/vault/index.ts","../../src/cli/secret/index.ts","../../src/cli/utils/progress.ts","../../src/cli/staticwebsite/deploy.ts","../../src/cli/staticwebsite/get.ts","../../src/cli/staticwebsite/list.ts","../../src/cli/staticwebsite/index.ts","../../src/cli/utils/resolve-cli-bin.ts","../../src/cli/tailordb/erd/schema.ts","../../src/cli/utils/beta.ts","../../src/cli/tailordb/erd/utils.ts","../../src/cli/tailordb/erd/export.ts","../../src/cli/tailordb/erd/deploy.ts","../../src/cli/tailordb/erd/serve.ts","../../src/cli/tailordb/erd/index.ts","../../src/cli/tailordb/truncate.ts","../../src/cli/tailordb/index.ts","../../src/cli/user/current.ts","../../src/cli/user/list.ts","../../src/cli/user/pat/transform.ts","../../src/cli/user/pat/create.ts","../../src/cli/user/pat/delete.ts","../../src/cli/user/pat/list.ts","../../src/cli/user/pat/update.ts","../../src/cli/user/pat/index.ts","../../src/cli/user/switch.ts","../../src/cli/user/index.ts","../../src/cli/workflow/index.ts","../../src/cli/workspace/index.ts","../../src/cli/index.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs } from \"./args\";\nimport { logger } from \"./utils/logger\";\nimport { readPackageJson } from \"./utils/package-json\";\n\nconst detectPackageManager = () => {\n const availablePMs = [\"npm\", \"yarn\", \"pnpm\"];\n const userAgent = process.env.npm_config_user_agent;\n if (!userAgent) return;\n const [name] = userAgent.split(\"/\");\n if (!availablePMs.includes(name)) return;\n return name;\n};\n\nexport const initCommand = defineCommand({\n meta: {\n name: \"init\",\n description: \"Initialize a new project using create-sdk\",\n },\n args: {\n ...commonArgs,\n name: {\n type: \"positional\",\n description: \"Project name\",\n required: false,\n },\n template: {\n type: \"string\",\n description: \"Template name\",\n required: false,\n alias: \"t\",\n },\n },\n run: withCommonArgs(async (args) => {\n const packageJson = await readPackageJson();\n const version =\n packageJson.version && packageJson.version !== \"0.0.0\" ? packageJson.version : \"latest\";\n\n let packageManager = detectPackageManager();\n if (!packageManager) {\n logger.warn(\"Could not detect package manager, defaulting to npm\");\n packageManager = \"npm\";\n }\n const initArgs = [\n \"create\",\n `@tailor-platform/sdk@${version}`,\n ...(args.name ? [args.name] : []),\n ...(packageManager === \"npm\" ? [\"--\"] : []),\n ...(args.template ? [\"--template\", args.template] : []),\n ];\n logger.log(`Running: ${packageManager} ${initArgs.join(\" \")}`);\n\n spawnSync(packageManager, initArgs, { stdio: \"inherit\" });\n }),\n});\n","import * as crypto from \"node:crypto\";\nimport * as http from \"node:http\";\nimport { generateCodeVerifier } from \"@badgateway/oauth2-client\";\nimport { defineCommand } from \"citty\";\nimport open from \"open\";\nimport { commonArgs, withCommonArgs } from \"./args\";\nimport { fetchUserInfo, initOAuth2Client } from \"./client\";\nimport { readPlatformConfig, writePlatformConfig } from \"./context\";\nimport { logger } from \"./utils/logger\";\n\nconst redirectPort = 8085;\nconst redirectUri = `http://localhost:${redirectPort}/callback`;\n\nfunction randomState() {\n return crypto.randomBytes(32).toString(\"base64url\");\n}\n\nconst startAuthServer = async () => {\n const client = initOAuth2Client();\n const state = randomState();\n const codeVerifier = await generateCodeVerifier();\n\n return new Promise<void>((resolve, reject) => {\n const server = http.createServer(async (req, res) => {\n try {\n if (!req.url?.startsWith(\"/callback\")) {\n throw new Error(\"Invalid callback URL\");\n }\n const tokens = await client.authorizationCode.getTokenFromCodeRedirect(\n `http://${req.headers.host}${req.url}`,\n {\n redirectUri: redirectUri,\n state,\n codeVerifier,\n },\n );\n const userInfo = await fetchUserInfo(tokens.accessToken);\n\n const pfConfig = readPlatformConfig();\n pfConfig.users = {\n ...pfConfig.users,\n [userInfo.email]: {\n access_token: tokens.accessToken,\n refresh_token: tokens.refreshToken!,\n token_expires_at: new Date(tokens.expiresAt!).toISOString(),\n },\n };\n pfConfig.current_user = userInfo.email;\n writePlatformConfig(pfConfig);\n\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n status: \"ok\",\n message: \"Successfully authenticated. Please close this window.\",\n }),\n );\n resolve();\n } catch (error) {\n res.writeHead(401);\n res.end(\"Authentication failed\");\n reject(error);\n } finally {\n // Close the server after handling one request.\n server.close();\n }\n });\n\n const timeout = setTimeout(\n () => {\n server.close();\n reject(new Error(\"Login timeout exceeded\"));\n },\n 5 * 60 * 1000,\n );\n\n server.on(\"close\", () => {\n clearTimeout(timeout);\n });\n\n server.on(\"error\", (error) => {\n reject(error);\n });\n\n server.listen(redirectPort, async () => {\n const authorizeUri = await client.authorizationCode.getAuthorizeUri({\n redirectUri,\n state,\n codeVerifier,\n });\n\n logger.info(`Opening browser for login:\\n\\n${authorizeUri}\\n`);\n try {\n await open(authorizeUri);\n } catch {\n logger.warn(\"Failed to open browser automatically. Please open the URL above manually.\");\n }\n });\n });\n};\n\nexport const loginCommand = defineCommand({\n meta: {\n name: \"login\",\n description: \"Login to Tailor Platform\",\n },\n args: commonArgs,\n run: withCommonArgs(async () => {\n await startAuthServer();\n logger.success(\"Successfully logged in to Tailor Platform.\");\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs } from \"./args\";\nimport { initOAuth2Client } from \"./client\";\nimport { readPlatformConfig, writePlatformConfig } from \"./context\";\nimport { logger } from \"./utils/logger\";\n\nexport const logoutCommand = defineCommand({\n meta: {\n name: \"logout\",\n description: \"Logout from Tailor Platform\",\n },\n args: commonArgs,\n run: withCommonArgs(async () => {\n const pfConfig = readPlatformConfig();\n const tokens = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : undefined;\n if (!tokens) {\n logger.info(\"You are not logged in.\");\n return;\n }\n\n const client = initOAuth2Client();\n client.revoke(\n {\n accessToken: tokens.access_token,\n refreshToken: tokens.refresh_token,\n expiresAt: Date.parse(tokens.token_expires_at),\n },\n \"refresh_token\",\n );\n\n delete pfConfig.users[pfConfig.current_user!];\n pfConfig.current_user = null;\n writePlatformConfig(pfConfig);\n logger.success(\"Successfully logged out from Tailor Platform.\");\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { listCommand } from \"./list\";\nimport { tokenCommand } from \"./token\";\n\nexport const machineuserCommand = defineCommand({\n meta: {\n name: \"machineuser\",\n description: \"Manage machine users\",\n },\n subCommands: {\n list: listCommand,\n token: tokenCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { getCommand } from \"./get\";\nimport { listCommand } from \"./list\";\n\nexport const oauth2clientCommand = defineCommand({\n meta: {\n name: \"oauth2client\",\n description: \"Manage OAuth2 clients\",\n },\n subCommands: {\n get: getCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { fetchLatestToken, readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport type { ProfileInfo } from \".\";\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create new profile\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Profile name\",\n required: true,\n },\n user: {\n type: \"string\",\n description: \"User email\",\n required: true,\n alias: \"u\",\n },\n \"workspace-id\": {\n type: \"string\",\n description: \"Workspace ID\",\n required: true,\n alias: \"w\",\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if profile already exists\n if (config.profiles[args.name]) {\n throw new Error(`Profile \"${args.name}\" already exists.`);\n }\n\n // Check if user exists\n const token = await fetchLatestToken(config, args.user);\n\n // Check if workspace exists\n const client = await initOperatorClient(token);\n const workspaces = await fetchAll(async (pageToken) => {\n const { workspaces, nextPageToken } = await client.listWorkspaces({\n pageToken,\n });\n return [workspaces, nextPageToken];\n });\n\n const workspace = workspaces.find((ws) => ws.id === args[\"workspace-id\"]);\n if (!workspace) {\n throw new Error(`Workspace \"${args[\"workspace-id\"]}\" not found.`);\n }\n\n // Create new profile\n config.profiles[args.name] = {\n user: args.user,\n workspace_id: args[\"workspace-id\"],\n };\n writePlatformConfig(config);\n\n if (!args.json) {\n logger.success(`Profile \"${args.name}\" created successfully.`);\n }\n\n // Show profile info\n const profileInfo: ProfileInfo = {\n name: args.name,\n user: args.user,\n workspaceId: args[\"workspace-id\"],\n };\n logger.out(profileInfo);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const deleteCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete profile\",\n },\n args: {\n ...commonArgs,\n name: {\n type: \"positional\",\n description: \"Profile name\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if profile exists\n if (!config.profiles[args.name]) {\n throw new Error(`Profile \"${args.name}\" not found.`);\n }\n\n // Delete profile\n delete config.profiles[args.name];\n writePlatformConfig(config);\n\n logger.success(`Profile \"${args.name}\" deleted successfully.`);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport type { ProfileInfo } from \".\";\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List all profiles\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n },\n run: withCommonArgs(async () => {\n const config = readPlatformConfig();\n\n const profiles = Object.entries(config.profiles);\n if (profiles.length === 0) {\n logger.info(ml`\n No profiles found.\n Please create a profile first using 'tailor-sdk profile create' command.\n `);\n return;\n }\n\n const profileInfos: ProfileInfo[] = profiles.map(([name, profile]) => ({\n name,\n user: profile!.user,\n workspaceId: profile!.workspace_id,\n }));\n logger.out(profileInfos);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { fetchLatestToken, readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport type { ProfileInfo } from \".\";\n\nexport const updateCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update profile properties\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Profile name\",\n required: true,\n },\n user: {\n type: \"string\",\n description: \"New user email\",\n alias: \"u\",\n },\n \"workspace-id\": {\n type: \"string\",\n description: \"New workspace ID\",\n alias: \"w\",\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if profile exists\n if (!config.profiles[args.name]) {\n throw new Error(`Profile \"${args.name}\" not found.`);\n }\n\n // Check if at least one property is provided\n if (!args.user && !args[\"workspace-id\"]) {\n throw new Error(\"Please provide at least one property to update.\");\n }\n\n const profile = config.profiles[args.name]!;\n const oldUser = profile.user;\n const newUser = args.user || oldUser;\n const oldWorkspaceId = profile.workspace_id;\n const newWorkspaceId = args[\"workspace-id\"] || oldWorkspaceId;\n\n // Check if user exists\n const token = await fetchLatestToken(config, newUser);\n\n // Check if workspace exists\n const client = await initOperatorClient(token);\n const workspaces = await fetchAll(async (pageToken) => {\n const { workspaces, nextPageToken } = await client.listWorkspaces({\n pageToken,\n });\n return [workspaces, nextPageToken];\n });\n const workspace = workspaces.find((ws) => ws.id === newWorkspaceId);\n if (!workspace) {\n throw new Error(`Workspace \"${newWorkspaceId}\" not found.`);\n }\n\n // Update properties\n profile.user = newUser;\n profile.workspace_id = newWorkspaceId;\n writePlatformConfig(config);\n if (!args.json) {\n logger.success(`Profile \"${args.name}\" updated successfully`);\n }\n\n // Show profile info\n const profileInfo: ProfileInfo = {\n name: args.name,\n user: newUser,\n workspaceId: newWorkspaceId,\n };\n logger.out(profileInfo);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { updateCommand } from \"./update\";\n\nexport interface ProfileInfo {\n name: string;\n user: string;\n workspaceId: string;\n}\n\nexport const profileCommand = defineCommand({\n meta: {\n name: \"profile\",\n description: \"Manage workspace profiles (user + workspace combinations)\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n update: updateCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","/**\n * Arguments for specify secret key\n */\nexport const vaultArgs = {\n \"vault-name\": {\n type: \"string\",\n description: \"Vault name\",\n alias: \"V\",\n required: true,\n },\n} as const;\n\n/**\n * Arguments for specify secret key\n */\nexport const secretIdentifyArgs = {\n ...vaultArgs,\n name: {\n type: \"string\",\n description: \"Secret name\",\n alias: \"n\",\n required: true,\n },\n} as const;\n\n/**\n * Arguments for specify secret key\n */\nexport const secretValueArgs = {\n ...secretIdentifyArgs,\n value: {\n type: \"string\",\n description: \"Secret value\",\n alias: \"v\",\n required: true,\n },\n} as const;\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { secretValueArgs } from \"./args\";\n\nexport const createSecretCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a secret in a vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...secretValueArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n try {\n await client.createSecretManagerSecret({\n workspaceId,\n secretmanagerVaultName: args[\"vault-name\"],\n secretmanagerSecretName: args.name,\n secretmanagerSecretValue: args.value,\n });\n } catch (error) {\n if (error instanceof ConnectError) {\n if (error.code === Code.NotFound) {\n throw new Error(`Vault \"${args[\"vault-name\"]}\" not found.`);\n }\n if (error.code === Code.AlreadyExists) {\n throw new Error(`Secret \"${args.name}\" already exists.`);\n }\n }\n throw error;\n }\n\n logger.success(`Secret: ${args.name} created in vault: ${args[\"vault-name\"]}`);\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, confirmationArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { secretIdentifyArgs } from \"./args\";\n\nexport const deleteSecretCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete a secret in a vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...secretIdentifyArgs,\n ...confirmationArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n if (!args.yes) {\n const confirmation = await logger.prompt(\n `Enter the secret name to confirm deletion (\"${args.name}\"): `,\n { type: \"text\" },\n );\n\n if (confirmation !== args.name) {\n logger.info(\"Secret deletion cancelled.\");\n return;\n }\n }\n\n try {\n await client.deleteSecretManagerSecret({\n workspaceId,\n secretmanagerVaultName: args[\"vault-name\"],\n secretmanagerSecretName: args.name,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Secret \"${args.name}\" not found in vault \"${args[\"vault-name\"]}\".`);\n }\n throw error;\n }\n\n logger.success(`Secret: ${args.name} deleted from vault: ${args[\"vault-name\"]}`);\n }),\n});\n","import { timestampDate } from \"@bufbuild/protobuf/wkt\";\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { vaultArgs } from \"./args\";\nimport type { SecretManagerSecret } from \"@tailor-proto/tailor/v1/secret_manager_resource_pb\";\n\nexport interface SecretListOptions {\n workspaceId?: string;\n profile?: string;\n vaultName: string;\n}\n\nexport interface SecretInfo {\n name: string;\n createdAt: string;\n updatedAt: string;\n}\n\nfunction secretInfo(secret: SecretManagerSecret): SecretInfo {\n return {\n name: secret.name,\n createdAt: secret.createTime ? timestampDate(secret.createTime).toISOString() : \"N/A\",\n updatedAt: secret.updateTime ? timestampDate(secret.updateTime).toISOString() : \"N/A\",\n };\n}\n\n/**\n * List secrets in a Secret Manager vault.\n * @param {SecretListOptions} options - Secret listing options\n * @returns {Promise<SecretInfo[]>} List of secrets\n */\nasync function secretList(options: SecretListOptions): Promise<SecretInfo[]> {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options.workspaceId,\n profile: options.profile,\n });\n\n const secrets = await fetchAll(async (pageToken) => {\n const { secrets, nextPageToken } = await client.listSecretManagerSecrets({\n workspaceId,\n secretmanagerVaultName: options.vaultName,\n pageToken,\n });\n return [secrets, nextPageToken];\n });\n\n return secrets.map(secretInfo);\n}\n\nexport const listSecretCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List secrets in a vault\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n ...vaultArgs,\n },\n run: withCommonArgs(async (args) => {\n try {\n const secrets = await secretList({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n vaultName: args[\"vault-name\"],\n });\n logger.out(secrets);\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Vault \"${args[\"vault-name\"]}\" not found.`);\n }\n throw error;\n }\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { secretValueArgs } from \"./args\";\n\nexport const updateSecretCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update a secret in a vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...secretValueArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n try {\n await client.updateSecretManagerSecret({\n workspaceId,\n secretmanagerVaultName: args[\"vault-name\"],\n secretmanagerSecretName: args.name,\n secretmanagerSecretValue: args.value,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Secret \"${args.name}\" not found in vault \"${args[\"vault-name\"]}\".`);\n }\n throw error;\n }\n\n logger.success(`Secret: ${args.name} updated in vault: ${args[\"vault-name\"]}`);\n }),\n});\n","export const nameArgs = {\n name: {\n type: \"positional\",\n description: \"Vault name\",\n required: true,\n },\n} as const;\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs, workspaceArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport { nameArgs } from \"./args\";\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a Secret Manager vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...nameArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n try {\n await client.createSecretManagerVault({\n workspaceId,\n secretmanagerVaultName: args.name,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.AlreadyExists) {\n throw new Error(`Vault \"${args.name}\" already exists.`);\n }\n throw error;\n }\n\n logger.success(`Vault: ${args.name} created`);\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, confirmationArgs, withCommonArgs, workspaceArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport { nameArgs } from \"./args\";\n\nexport const deleteCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete a Secret Manager vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...nameArgs,\n ...confirmationArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n if (!args.yes) {\n const confirmation = await logger.prompt(\n `Enter the vault name to confirm deletion (\"${args.name}\"): `,\n { type: \"text\" },\n );\n if (confirmation !== args.name) {\n logger.info(\"Vault deletion cancelled.\");\n return;\n }\n }\n\n try {\n await client.deleteSecretManagerVault({\n workspaceId,\n secretmanagerVaultName: args.name,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Vault \"${args.name}\" not found.`);\n }\n throw error;\n }\n\n logger.success(`Vault: ${args.name} deleted`);\n }),\n});\n","import { timestampDate } from \"@bufbuild/protobuf/wkt\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../../args\";\nimport { fetchAll, initOperatorClient } from \"../../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport type { SecretManagerVault } from \"@tailor-proto/tailor/v1/secret_manager_resource_pb\";\n\nexport interface VaultListOptions {\n workspaceId?: string;\n profile?: string;\n}\n\nexport interface VaultInfo {\n name: string;\n createdAt: string;\n updatedAt: string;\n}\n\nfunction vaultInfo(vault: SecretManagerVault): VaultInfo {\n return {\n name: vault.name,\n createdAt: vault.createTime ? timestampDate(vault.createTime).toISOString() : \"N/A\",\n updatedAt: vault.updateTime ? timestampDate(vault.updateTime).toISOString() : \"N/A\",\n };\n}\n\n/**\n * List Secret Manager vaults in the workspace.\n * @param {VaultListOptions} [options] - Vault listing options\n * @returns {Promise<VaultInfo[]>} List of vaults\n */\nasync function vaultList(options?: VaultListOptions): Promise<VaultInfo[]> {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options?.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options?.workspaceId,\n profile: options?.profile,\n });\n\n const vaults = await fetchAll(async (pageToken) => {\n const { vaults, nextPageToken } = await client.listSecretManagerVaults({\n workspaceId,\n pageToken,\n });\n return [vaults, nextPageToken];\n });\n\n return vaults.map(vaultInfo);\n}\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List Secret Manager vaults\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n },\n run: withCommonArgs(async (args) => {\n const vaults = await vaultList({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n logger.out(vaults);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\n\nexport const vaultCommand = defineCommand({\n meta: {\n name: \"vault\",\n description: \"Manage Secret Manager vaults\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createSecretCommand } from \"./create\";\nimport { deleteSecretCommand } from \"./delete\";\nimport { listSecretCommand } from \"./list\";\nimport { updateSecretCommand } from \"./update\";\nimport { vaultCommand } from \"./vault\";\n\nexport const secretCommand = defineCommand({\n meta: {\n name: \"secret\",\n description: \"Manage secrets and vaults\",\n },\n subCommands: {\n create: createSecretCommand,\n delete: deleteSecretCommand,\n list: listSecretCommand,\n update: updateSecretCommand,\n vault: vaultCommand,\n },\n async run() {\n await runCommand(vaultCommand, { rawArgs: [] });\n },\n});\n","import { setTimeout } from \"node:timers/promises\";\n\n/**\n * Create a simple progress reporter that writes updates to stderr.\n * @param {string} label - Label to prefix progress output\n * @param {number} total - Total number of steps\n * @returns {{ update: () => void; finish: () => void }} Progress helpers\n */\nexport function createProgress(label: string, total: number) {\n let current = 0;\n\n const update = () => {\n current += 1;\n const percent = Math.round((current / total) * 100);\n process.stderr.write(`\\r${label} ${current}/${total} (${percent}%)`);\n };\n\n const finish = () => {\n process.stderr.write(\"\\n\");\n };\n\n return { update, finish };\n}\n\n/**\n * Wrap a promise with a timeout, rejecting if the timeout elapses first.\n * @template T\n * @param {Promise<T>} p - Promise to await\n * @param {number} ms - Timeout in milliseconds\n * @param {string} message - Error message on timeout\n * @returns {Promise<T>} Result of the original promise if it completes in time\n */\nexport async function withTimeout<T>(p: Promise<T>, ms: number, message: string): Promise<T> {\n return await Promise.race([\n p,\n setTimeout(ms).then(() => {\n throw new Error(message);\n }),\n ]);\n}\n","import * as fs from \"fs\";\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { lookup as mimeLookup } from \"mime-types\";\nimport pLimit from \"p-limit\";\nimport * as path from \"pathe\";\nimport { withCommonArgs, commonArgs, jsonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient, type OperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { createProgress, withTimeout } from \"../utils/progress\";\nimport type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport type { UploadFileRequestSchema } from \"@tailor-proto/tailor/v1/staticwebsite_pb\";\n\nconst CHUNK_SIZE = 64 * 1024; // 64KB\nconst IGNORED_FILES = new Set([\".DS_Store\", \"thumbs.db\", \"desktop.ini\"]);\nfunction shouldIgnoreFile(filePath: string) {\n const fileName = path.basename(filePath).toLowerCase();\n return IGNORED_FILES.has(fileName);\n}\n\nexport type DeployResult = {\n url: string;\n skippedFiles: string[];\n};\n\n/**\n * Deploy a static website by creating a deployment, uploading files, and publishing it.\n * @param {OperatorClient} client - Operator client instance\n * @param {string} workspaceId - Workspace ID\n * @param {string} name - Static website name\n * @param {string} distDir - Directory containing static site files\n * @param {boolean} [showProgress=true] - Whether to show upload progress\n * @returns {Promise<DeployResult>} Deployment result with URL and skipped files\n */\nexport async function deployStaticWebsite(\n client: OperatorClient,\n workspaceId: string,\n name: string,\n distDir: string,\n showProgress: boolean = true,\n): Promise<DeployResult> {\n const { deploymentId } = await client.createDeployment({\n workspaceId,\n name,\n });\n\n if (!deploymentId) {\n throw new Error(\"createDeployment returned empty deploymentId\");\n }\n\n const skippedFiles = await uploadDirectory(\n client,\n workspaceId,\n deploymentId,\n distDir,\n showProgress,\n );\n\n const { url } = await client.publishDeployment({\n workspaceId,\n deploymentId,\n });\n\n if (!url) {\n throw new Error(\"publishDeployment returned empty url\");\n }\n\n return { url, skippedFiles };\n}\n\nasync function uploadDirectory(\n client: OperatorClient,\n workspaceId: string,\n deploymentId: string,\n rootDir: string,\n showProgress: boolean,\n): Promise<string[]> {\n const files = await collectFiles(rootDir);\n if (files.length === 0) {\n logger.warn(`No files found under ${rootDir}`);\n return [];\n }\n\n const concurrency = 5;\n const limit = pLimit(concurrency);\n\n const total = files.length;\n const progress = showProgress ? createProgress(\"Uploading files\", total) : undefined;\n const skippedFiles: string[] = [];\n\n await Promise.all(\n files.map((relativePath) =>\n limit(async () => {\n await uploadSingleFile(\n client,\n workspaceId,\n deploymentId,\n rootDir,\n relativePath,\n skippedFiles,\n );\n if (progress) {\n progress.update();\n }\n }),\n ),\n );\n\n if (progress) {\n progress.finish();\n }\n\n return skippedFiles;\n}\n\n/**\n * Recursively collect all deployable files under the given directory.\n * @param {string} rootDir - Root directory to scan\n * @param {string} [currentDir=\"\"] - Current relative directory (for recursion)\n * @returns {Promise<string[]>} List of file paths relative to rootDir\n */\nasync function collectFiles(rootDir: string, currentDir = \"\"): Promise<string[]> {\n const dirPath = path.join(rootDir, currentDir);\n\n const entries = await fs.promises.readdir(dirPath, {\n withFileTypes: true,\n });\n const files: string[] = [];\n\n for (const entry of entries) {\n const rel = path.join(currentDir, entry.name);\n if (entry.isDirectory()) {\n const sub = await collectFiles(rootDir, rel);\n files.push(...sub);\n } else if (entry.isFile() && !entry.isSymbolicLink() && !shouldIgnoreFile(rel)) {\n files.push(rel);\n }\n }\n\n return files;\n}\n\nasync function uploadSingleFile(\n client: OperatorClient,\n workspaceId: string,\n deploymentId: string,\n rootDir: string,\n filePath: string,\n skippedFiles: string[],\n): Promise<void> {\n const absPath = path.join(rootDir, filePath);\n\n const mime = mimeLookup(filePath);\n\n if (!mime) {\n skippedFiles.push(`${filePath} (unsupported content type; no MIME mapping found)`);\n return;\n }\n\n const contentType = mime;\n\n const readStream = fs.createReadStream(absPath, {\n highWaterMark: CHUNK_SIZE,\n });\n\n async function* requestStream(): AsyncIterable<MessageInitShape<typeof UploadFileRequestSchema>> {\n yield {\n payload: {\n case: \"initialMetadata\",\n value: {\n workspaceId,\n deploymentId,\n filePath,\n contentType,\n },\n },\n };\n for await (const chunk of readStream) {\n yield {\n payload: {\n case: \"chunkData\",\n value: chunk as Buffer,\n },\n };\n }\n }\n\n async function uploadWithLogging() {\n try {\n await client.uploadFile(requestStream());\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.InvalidArgument) {\n skippedFiles.push(`${filePath} (server rejected file as invalid: ${error.message})`);\n return;\n }\n // For non-validation errors, fail the deployment as before.\n throw error;\n }\n }\n\n await withTimeout(\n uploadWithLogging(),\n // 2 minutes per file\n 2 * 60_000,\n `Upload timed out for \"${filePath}\"`,\n );\n}\n\n/**\n * Log skipped files after a deployment, including reasons for skipping.\n * @param {string[]} skippedFiles - List of skipped file descriptions\n * @returns {void}\n */\nexport function logSkippedFiles(skippedFiles: string[]) {\n if (skippedFiles.length === 0) {\n return;\n }\n logger.warn(\n \"Deployment completed, but some files failed to upload. These files may have unsupported content types or other validation issues. Please review the list below:\",\n );\n for (const file of skippedFiles) {\n logger.log(` - ${file}`);\n }\n}\n\nexport const deployCommand = defineCommand({\n meta: {\n name: \"deploy\",\n description: \"Deploy a static website\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n name: {\n type: \"string\",\n description: \"Static website name\",\n alias: \"n\",\n required: true,\n },\n dir: {\n type: \"string\",\n description: \"Path to the static website files\",\n alias: \"d\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n logger.info(`Deploying static website \"${args.name}\" from directory: ${args.dir}`);\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n\n const name = args.name;\n const dir = path.resolve(process.cwd(), args.dir);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {\n throw new Error(`Directory not found or not a directory: ${dir}`);\n }\n\n const { url, skippedFiles } = await withTimeout(\n deployStaticWebsite(client, workspaceId, name, dir, !args.json),\n // 10 minutes\n 10 * 60_000,\n \"Deployment timed out after 10 minutes.\",\n );\n\n if (args.json) {\n logger.out({ name, workspaceId, url, skippedFiles });\n } else {\n logger.success(`Static website \"${name}\" deployed successfully. URL: ${url}`);\n logSkippedFiles(skippedFiles);\n }\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const getCommand = defineCommand({\n meta: {\n name: \"get\",\n description: \"Get static website details\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n name: {\n type: \"positional\",\n description: \"Static website name\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n const notFoundErrorMessage = `Static website \"${args.name}\" not found.`;\n\n try {\n const { staticwebsite } = await client.getStaticWebsite({\n workspaceId,\n name: args.name,\n });\n\n if (!staticwebsite) {\n throw new Error(notFoundErrorMessage);\n }\n\n const info = {\n workspaceId,\n name: staticwebsite.name,\n description: staticwebsite.description,\n url: staticwebsite.url,\n allowedIpAddresses: args.json\n ? staticwebsite.allowedIpAddresses\n : staticwebsite.allowedIpAddresses.join(\"\\n\"),\n };\n\n logger.out(info);\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(notFoundErrorMessage);\n }\n throw error;\n }\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport interface StaticWebsiteInfo {\n workspaceId: string;\n name: string;\n description: string;\n url: string;\n allowedIpAddresses: string[];\n}\n\n/**\n * List static websites in the workspace.\n * @param {{ workspaceId?: string; profile?: string }} [options] - Static website listing options\n * @param {string} [options.workspaceId] - Workspace ID\n * @param {string} [options.profile] - Workspace profile\n * @returns {Promise<StaticWebsiteInfo[]>} List of static websites\n */\nasync function listStaticWebsites(options?: {\n workspaceId?: string;\n profile?: string;\n}): Promise<StaticWebsiteInfo[]> {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options?.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options?.workspaceId,\n profile: options?.profile,\n });\n\n const websites = await fetchAll(async (pageToken) => {\n const { staticwebsites, nextPageToken } = await client.listStaticWebsites({\n workspaceId,\n pageToken,\n });\n return [staticwebsites, nextPageToken];\n });\n\n return websites.map((site) => ({\n workspaceId,\n name: site.name,\n description: site.description,\n url: site.url ?? \"\",\n allowedIpAddresses: site.allowedIpAddresses,\n }));\n}\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List static websites\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n },\n run: withCommonArgs(async (args) => {\n const websites = await listStaticWebsites({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n const formatted = args.json\n ? websites\n : websites.map(({ allowedIpAddresses, ...rest }) => {\n if (allowedIpAddresses.length === 0) {\n return {\n ...rest,\n allowedIpAddresses: \"No allowed IP addresses\",\n };\n }\n\n const count = allowedIpAddresses.length;\n const label = count === 1 ? \"1 IP address\" : `${count} IP addresses`;\n\n return {\n ...rest,\n allowedIpAddresses: label,\n };\n });\n\n logger.out(formatted);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { deployCommand } from \"./deploy\";\nimport { getCommand } from \"./get\";\nimport { listCommand } from \"./list\";\n\nexport const staticwebsiteCommand = defineCommand({\n meta: {\n name: \"staticwebsite\",\n description: \"Manage static websites\",\n },\n subCommands: {\n deploy: deployCommand,\n get: getCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { findUpSync } from \"find-up-simple\";\nimport * as path from \"pathe\";\n\ninterface CliPackageJson {\n bin?: Record<string, string>;\n}\n\ntype ResolveCliBinOptions = {\n cwd: string;\n packageName: string;\n binName: string;\n installHint: string;\n};\n\n/**\n * Resolve a CLI binary path from the caller's project dependencies.\n * @param {ResolveCliBinOptions} options - Resolution options for locating the CLI binary.\n * @returns {string} Absolute path to the CLI binary entry.\n */\nexport function resolveCliBinPath({\n cwd,\n packageName,\n binName,\n installHint,\n}: ResolveCliBinOptions): string {\n const projectPackageJsonPath = findUpSync(\"package.json\", { cwd });\n if (!projectPackageJsonPath) {\n throw new Error(`Failed to locate package.json from ${cwd}.`);\n }\n\n const requireFromProject = createRequire(projectPackageJsonPath);\n let pkgJsonPath: string;\n try {\n pkgJsonPath = requireFromProject.resolve(`${packageName}/package.json`);\n } catch {\n throw new Error(\n `Missing optional dependency \\`${packageName}\\`. Install it in your project (e.g. \\`${installHint}\\`).`,\n );\n }\n\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, \"utf8\")) as CliPackageJson;\n const binRelativePath = pkgJson.bin?.[binName];\n if (!binRelativePath) {\n throw new Error(`\\`${packageName}\\` does not expose a \\`${binName}\\` binary entry.`);\n }\n\n return path.resolve(path.dirname(pkgJsonPath), binRelativePath);\n}\n","import * as fs from \"node:fs\";\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport * as path from \"pathe\";\nimport { fetchAll } from \"../../client\";\nimport { logger } from \"../../utils/logger\";\nimport type {\n TblsColumn,\n TblsConstraint,\n TblsEnum,\n TblsRelation,\n TblsSchema,\n TblsTable,\n} from \"./types\";\nimport type { OperatorClient } from \"../../client\";\nimport type {\n TailorDBType as TailorDBProtoType,\n TailorDBType_FieldConfig,\n} from \"@tailor-proto/tailor/v1/tailordb_resource_pb\";\n\nexport interface TailorDBSchemaOptions {\n workspaceId: string;\n namespace: string;\n client: OperatorClient;\n}\n\n/**\n * Convert TailorDB field config to tbls column definition.\n * @param {string} fieldName - Field name\n * @param {TailorDBType_FieldConfig} fieldConfig - TailorDB field configuration\n * @returns {TblsColumn} tbls column definition\n */\nfunction toTblsColumn(fieldName: string, fieldConfig: TailorDBType_FieldConfig): TblsColumn {\n const baseType = fieldConfig.type || \"string\";\n const type = fieldConfig.array ? `${baseType}[]` : baseType;\n\n return {\n name: fieldName,\n type,\n nullable: !fieldConfig.required,\n comment: fieldConfig.description ?? \"\",\n };\n}\n\n/**\n * Build tbls schema JSON from TailorDB types.\n * @param {TailorDBProtoType[]} types - TailorDB types fetched from platform\n * @param {string} namespace - TailorDB namespace\n * @returns {TblsSchema} tbls-compatible schema representation\n */\nfunction buildTblsSchema(types: TailorDBProtoType[], namespace: string): TblsSchema {\n const tables: TblsTable[] = [];\n const relations: TblsRelation[] = [];\n const referencedByTable: Record<string, Set<string>> = {};\n const constraintsByTable: Record<string, TblsConstraint[]> = {};\n const enumsMap: Map<string, Set<string>> = new Map();\n\n for (const type of types) {\n const tableName = type.name;\n const schema = type.schema;\n\n const columns: TblsColumn[] = [];\n const tableConstraints: TblsConstraint[] = [];\n\n // Implicit primary key column\n columns.push({\n name: \"id\",\n type: \"uuid\",\n nullable: false,\n comment: \"\",\n });\n\n tableConstraints.push({\n name: `pk_${tableName}`,\n type: \"PRIMARY KEY\",\n def: \"\",\n table: tableName,\n columns: [\"id\"],\n });\n\n if (schema) {\n // Fields -> columns\n for (const [fieldName, fieldConfig] of Object.entries(schema.fields ?? {})) {\n columns.push(toTblsColumn(fieldName, fieldConfig));\n\n // Collect enum values\n if (fieldConfig.type === \"enum\" && fieldConfig.allowedValues.length > 0) {\n const enumName = `${tableName}_${fieldName}`;\n let values = enumsMap.get(enumName);\n if (!values) {\n values = new Set<string>();\n enumsMap.set(enumName, values);\n }\n for (const value of fieldConfig.allowedValues) {\n values.add(value.value);\n }\n }\n\n // Foreign key -> relation + constraint\n if (fieldConfig.foreignKey && fieldConfig.foreignKeyType) {\n const foreignTable = fieldConfig.foreignKeyType;\n const foreignColumn = fieldConfig.foreignKeyField || \"id\";\n\n // Cardinality:\n // - child side: exactly_one if non-nullable, zero_or_one if nullable FK\n // - parent side: zero_or_more (a parent can have many children)\n const childCardinality = fieldConfig.required ? \"exactly_one\" : \"zero_or_one\";\n const parentCardinality = \"zero_or_more\";\n\n // tbls RelationJSON:\n // - table/columns: child side (FK owner)\n // - parent_table/parent_columns: referenced side\n relations.push({\n table: tableName,\n columns: [fieldName],\n parent_table: foreignTable,\n parent_columns: [foreignColumn],\n cardinality: childCardinality,\n parent_cardinality: parentCardinality,\n def: \"\",\n });\n\n tableConstraints.push({\n name: `fk_${tableName}_${fieldName}`,\n type: \"FOREIGN KEY\",\n def: \"\",\n table: tableName,\n columns: [fieldName],\n referenced_table: foreignTable,\n referenced_columns: [foreignColumn],\n });\n\n if (!referencedByTable[tableName]) {\n referencedByTable[tableName] = new Set<string>();\n }\n referencedByTable[tableName].add(foreignTable);\n }\n }\n }\n\n constraintsByTable[tableName] = tableConstraints;\n\n tables.push({\n name: tableName,\n type: \"table\",\n comment: schema?.description ?? \"\",\n columns,\n indexes: [],\n constraints: constraintsByTable[tableName] ?? [],\n triggers: [],\n def: \"\",\n referenced_tables: [],\n });\n }\n\n // Populate referenced_tables from collected relations\n for (const table of tables) {\n const referenced = referencedByTable[table.name];\n table.referenced_tables = referenced ? Array.from(referenced) : [];\n }\n\n const enums: TblsEnum[] = [];\n for (const [name, values] of enumsMap.entries()) {\n enums.push({\n name,\n values: Array.from(values),\n });\n }\n\n return {\n name: namespace,\n tables,\n relations,\n enums,\n };\n}\n\n/**\n * Export apply-applied TailorDB schema for a namespace as tbls-compatible JSON.\n * @param {TailorDBSchemaOptions} options - Export options\n * @returns {Promise<TblsSchema>} tbls schema representation\n */\nasync function exportTailorDBSchema(options: TailorDBSchemaOptions): Promise<TblsSchema> {\n const { client, workspaceId, namespace } = options;\n\n const types = await fetchAll(async (pageToken) => {\n try {\n const { tailordbTypes, nextPageToken } = await client.listTailorDBTypes({\n workspaceId,\n namespaceName: namespace,\n pageToken,\n });\n return [tailordbTypes, nextPageToken];\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n return [[], \"\"];\n }\n throw error;\n }\n });\n\n if (types.length === 0) {\n logger.warn(`No TailorDB types found in namespace \"${namespace}\". Returning empty schema.`);\n }\n\n return buildTblsSchema(types, namespace);\n}\n\nexport interface WriteSchemaOptions extends TailorDBSchemaOptions {\n outputPath: string;\n}\n\n/**\n * Writes the TailorDB schema to a file in tbls-compatible JSON format.\n * @param {WriteSchemaOptions} options - The options for writing the schema file.\n */\nexport async function writeTblsSchemaToFile(options: WriteSchemaOptions): Promise<void> {\n const schema = await exportTailorDBSchema(options);\n const json = JSON.stringify(schema, null, 2);\n\n fs.mkdirSync(path.dirname(options.outputPath), { recursive: true });\n fs.writeFileSync(options.outputPath, json, \"utf8\");\n\n const relativePath = path.relative(process.cwd(), options.outputPath);\n logger.success(`Wrote ERD schema to ${relativePath}`);\n}\n","import { logger } from \"./logger\";\n\n/**\n * Warn that the ERD CLI is a beta feature.\n */\nexport function logErdBetaWarning(): void {\n logger.warn(\n \"The ERD command is a beta feature and may introduce breaking changes in future releases.\",\n );\n logger.newline();\n}\n","import { initOperatorClient } from \"../../client\";\nimport { loadConfig } from \"../../config-loader\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logErdBetaWarning } from \"../../utils/beta\";\nimport type { OperatorClient } from \"../../client\";\nimport type { AppConfig } from \"@/configure/config\";\n\nexport interface ErdCommandContext {\n client: OperatorClient;\n workspaceId: string;\n config: AppConfig;\n}\n\n/**\n * Initialize shared ERD command context.\n * @param {{ profile?: string; workspaceId?: string; config?: string }} args - CLI arguments.\n * @param {string | undefined} args.profile - Workspace profile.\n * @param {string | undefined} args.workspaceId - Workspace ID override.\n * @param {string | undefined} args.config - Config path override.\n * @returns {Promise<ErdCommandContext>} Initialized context.\n */\nexport async function initErdContext(args: {\n profile?: string;\n workspaceId?: string;\n config?: string;\n}): Promise<ErdCommandContext> {\n logErdBetaWarning();\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args.workspaceId,\n profile: args.profile,\n });\n const { config } = await loadConfig(args.config);\n\n return { client, workspaceId, config };\n}\n","import { spawn } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport { defineCommand } from \"citty\";\nimport * as path from \"pathe\";\nimport { commonArgs, deploymentArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { logger } from \"../../utils/logger\";\nimport { resolveCliBinPath } from \"../../utils/resolve-cli-bin\";\nimport { writeTblsSchemaToFile } from \"./schema\";\nimport { initErdContext } from \"./utils\";\nimport type { TailorDBSchemaOptions } from \"./schema\";\nimport type { OperatorClient } from \"../../client\";\nimport type { AppConfig } from \"@/configure/config\";\n\nconst DEFAULT_ERD_BASE_DIR = \".tailor-sdk/erd\";\n\n/**\n * Resolve TailorDB config and namespace.\n * @param {AppConfig} config - Loaded Tailor SDK config.\n * @param {string | undefined} explicitNamespace - Namespace override.\n * @returns {{ namespace: string; erdSite: string | undefined }} Resolved namespace and erdSite.\n */\nfunction resolveDbConfig(\n config: AppConfig,\n explicitNamespace?: string,\n): { namespace: string; erdSite: string | undefined } {\n const namespace = explicitNamespace ?? Object.keys(config.db ?? {})[0];\n\n if (!namespace) {\n throw new Error(\n \"No TailorDB namespaces found in config. Please define db services in tailor.config.ts or pass --namespace.\",\n );\n }\n\n const dbConfig = config.db?.[namespace];\n\n if (!dbConfig || typeof dbConfig !== \"object\" || \"external\" in dbConfig) {\n throw new Error(`TailorDB namespace \"${namespace}\" not found in config.db.`);\n }\n\n return { namespace, erdSite: dbConfig.erdSite };\n}\n\n/**\n * Get all namespaces with erdSite configured.\n * @param {AppConfig} config - Loaded Tailor SDK config.\n * @returns {Array<{ namespace: string; erdSite: string }>} Namespaces with erdSite.\n */\nfunction resolveAllErdSites(config: AppConfig): Array<{ namespace: string; erdSite: string }> {\n const results: Array<{ namespace: string; erdSite: string }> = [];\n\n for (const [namespace, dbConfig] of Object.entries(config.db ?? {})) {\n if (dbConfig && typeof dbConfig === \"object\" && !(\"external\" in dbConfig) && dbConfig.erdSite) {\n results.push({ namespace, erdSite: dbConfig.erdSite });\n }\n }\n\n return results;\n}\n\n/**\n * Run the liam CLI to build an ERD static site from a schema file.\n * @param {string} schemaPath - Path to the ERD schema JSON file\n * @param {string} cwd - Working directory where liam will run (dist is created here)\n * @returns {Promise<void>} Resolves when the build completes successfully\n */\nasync function runLiamBuild(schemaPath: string, cwd: string): Promise<void> {\n fs.mkdirSync(cwd, { recursive: true });\n\n return await new Promise<void>((resolve, reject) => {\n let liamBinPath: string;\n try {\n liamBinPath = resolveCliBinPath({\n cwd,\n packageName: \"@liam-hq/cli\",\n binName: \"liam\",\n installHint: \"npm i -D @liam-hq/cli\",\n });\n } catch (error) {\n logger.error(String(error));\n reject(error);\n return;\n }\n\n const child = spawn(\n process.execPath,\n [liamBinPath, \"erd\", \"build\", \"--format\", \"tbls\", \"--input\", schemaPath],\n {\n stdio: \"inherit\",\n cwd,\n },\n );\n\n child.on(\"error\", (error) => {\n logger.error(\"Failed to run `@liam-hq/cli`. Ensure it is installed in your project.\");\n reject(error);\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n logger.error(\n \"liam CLI exited with a non-zero code. Ensure `@liam-hq/cli erd build --format tbls --input schema.json` works in your project.\",\n );\n reject(new Error(`liam CLI exited with code ${code ?? 1}`));\n }\n });\n });\n}\n\n/**\n * Export TailorDB schema and build ERD artifacts via liam.\n * @param {TailorDBSchemaOptions & { outputPath: string; erdDir: string }} options - Build options.\n */\nasync function prepareErdBuild(\n options: TailorDBSchemaOptions & { outputPath: string; erdDir: string },\n): Promise<void> {\n await writeTblsSchemaToFile(options);\n\n await runLiamBuild(options.outputPath, options.erdDir);\n}\n\nexport interface ErdBuildResult {\n namespace: string;\n erdSite?: string;\n schemaOutputPath: string;\n distDir: string;\n erdDir: string;\n}\n\n/**\n * Prepare ERD builds for one or more namespaces.\n * @param {{ client: OperatorClient; workspaceId: string; config: AppConfig; namespace?: string; outputDir?: string }} options - Build options.\n * @param {OperatorClient} options.client - Operator client.\n * @param {string} options.workspaceId - Workspace ID.\n * @param {AppConfig} options.config - Loaded Tailor config.\n * @param {string | undefined} options.namespace - Namespace override.\n * @param {string | undefined} options.outputDir - Output directory override.\n * @returns {Promise<ErdBuildResult[]>} Build results by namespace.\n */\nexport async function prepareErdBuilds(options: {\n client: OperatorClient;\n workspaceId: string;\n config: AppConfig;\n namespace?: string;\n outputDir?: string;\n}): Promise<ErdBuildResult[]> {\n const { client, workspaceId, config } = options;\n const baseDir = options.outputDir ?? path.resolve(process.cwd(), DEFAULT_ERD_BASE_DIR);\n let targets: ErdBuildResult[];\n\n if (options.namespace) {\n const { namespace, erdSite } = resolveDbConfig(config, options.namespace);\n const erdDir = path.join(baseDir, namespace);\n targets = [\n {\n namespace,\n erdSite,\n schemaOutputPath: path.join(erdDir, \"schema.json\"),\n distDir: path.join(erdDir, \"dist\"),\n erdDir,\n },\n ];\n } else {\n const erdSites = resolveAllErdSites(config);\n if (erdSites.length === 0) {\n throw new Error(\n \"No namespaces with erdSite configured found. \" +\n 'Add erdSite: \"<static-website-name>\" to db.<namespace> in tailor.config.ts.',\n );\n }\n logger.info(`Found ${erdSites.length} namespace(s) with erdSite configured.`);\n targets = erdSites.map(({ namespace, erdSite }) => {\n const erdDir = path.join(baseDir, namespace);\n return {\n namespace,\n erdSite,\n schemaOutputPath: path.join(erdDir, \"schema.json\"),\n distDir: path.join(erdDir, \"dist\"),\n erdDir,\n };\n });\n }\n\n await Promise.all(\n targets.map((target) =>\n prepareErdBuild({\n namespace: target.namespace,\n client,\n workspaceId,\n outputPath: target.schemaOutputPath,\n erdDir: target.erdDir,\n }),\n ),\n );\n\n return targets;\n}\n\nexport const erdExportCommand = defineCommand({\n meta: {\n name: \"export\",\n description: \"Export Liam ERD dist from applied TailorDB schema (beta)\",\n },\n args: {\n ...commonArgs,\n ...deploymentArgs,\n ...jsonArgs,\n namespace: {\n type: \"string\",\n description: \"TailorDB namespace name (optional if only one namespace is defined in config)\",\n alias: \"n\",\n },\n output: {\n type: \"string\",\n description:\n \"Output directory path for tbls-compatible ERD JSON (writes to <outputDir>/<namespace>/schema.json)\",\n alias: \"o\",\n default: DEFAULT_ERD_BASE_DIR,\n },\n },\n run: withCommonArgs(async (args) => {\n const { client, workspaceId, config } = await initErdContext(args);\n const outputDir = path.resolve(process.cwd(), String(args.output));\n\n const results = await prepareErdBuilds({\n client,\n workspaceId,\n config,\n namespace: args.namespace,\n outputDir,\n });\n\n if (args.json) {\n logger.out(\n results.map((result) => ({\n namespace: result.namespace,\n distDir: result.distDir,\n schemaOutputPath: result.schemaOutputPath,\n })),\n );\n } else {\n for (const result of results) {\n logger.out(`Exported ERD for namespace \"${result.namespace}\"`);\n logger.out(` - Liam ERD dist: ${result.distDir}`);\n logger.out(` - tbls schema.json: ${result.schemaOutputPath}`);\n }\n }\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, deploymentArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { deployStaticWebsite, logSkippedFiles } from \"../../staticwebsite/deploy\";\nimport { logger } from \"../../utils/logger\";\nimport { prepareErdBuilds } from \"./export\";\nimport { initErdContext } from \"./utils\";\n\nexport const erdDeployCommand = defineCommand({\n meta: {\n name: \"deploy\",\n description: \"Deploy ERD static website for TailorDB namespace(s) (beta)\",\n },\n args: {\n ...commonArgs,\n ...deploymentArgs,\n ...jsonArgs,\n namespace: {\n type: \"string\",\n description:\n \"TailorDB namespace name (optional - deploys all namespaces with erdSite if omitted)\",\n alias: \"n\",\n },\n },\n run: withCommonArgs(async (args) => {\n const { client, workspaceId, config } = await initErdContext(args);\n const buildResults = await prepareErdBuilds({\n client,\n workspaceId,\n config,\n namespace: args.namespace,\n });\n\n const deployResults = await Promise.all(\n buildResults.map(async (result) => {\n if (!result.erdSite) {\n throw new Error(\n `No erdSite configured for namespace \"${result.namespace}\". ` +\n `Add erdSite: \"<static-website-name>\" to db.${result.namespace} in tailor.config.ts.`,\n );\n }\n\n if (!args.json) {\n logger.info(\n `Deploying ERD for namespace \"${result.namespace}\" to site \"${result.erdSite}\"...`,\n );\n }\n\n const { url, skippedFiles } = await deployStaticWebsite(\n client,\n workspaceId,\n result.erdSite,\n result.distDir,\n !args.json,\n );\n\n return {\n namespace: result.namespace,\n erdSite: result.erdSite,\n url,\n skippedFiles,\n };\n }),\n );\n\n if (args.json) {\n logger.out(deployResults);\n } else {\n for (const result of deployResults) {\n logger.success(`ERD site \"${result.erdSite}\" deployed successfully.`);\n logger.out(result.url);\n logSkippedFiles(result.skippedFiles);\n }\n }\n }),\n});\n","import { spawn } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, deploymentArgs, withCommonArgs } from \"../../args\";\nimport { logger } from \"../../utils/logger\";\nimport { resolveCliBinPath } from \"../../utils/resolve-cli-bin\";\nimport { prepareErdBuilds, type ErdBuildResult } from \"./export\";\nimport { initErdContext } from \"./utils\";\n\nfunction formatServeCommand(namespace: string): string {\n return `tailor-sdk tailordb erd serve --namespace ${namespace}`;\n}\n\nasync function runServeDist(results: ErdBuildResult[]): Promise<void> {\n if (results.length === 0) {\n throw new Error(\"No ERD build results found.\");\n }\n\n const [primary, ...rest] = results;\n\n logger.info(`Serving ERD for namespace \"${primary.namespace}\".`);\n if (rest.length > 0) {\n const commands = rest.map((result) => ` - ${formatServeCommand(result.namespace)}`).join(\"\\n\");\n logger.warn(`Multiple namespaces found. To serve another namespace, run:\\n${commands}`);\n }\n\n fs.mkdirSync(primary.erdDir, { recursive: true });\n\n return await new Promise<void>((resolve, reject) => {\n let serveBinPath: string;\n try {\n serveBinPath = resolveCliBinPath({\n cwd: primary.erdDir,\n packageName: \"serve\",\n binName: \"serve\",\n installHint: \"npm i -D serve\",\n });\n } catch (error) {\n logger.error(String(error));\n reject(error);\n return;\n }\n\n const child = spawn(process.execPath, [serveBinPath, \"dist\"], {\n stdio: \"inherit\",\n cwd: primary.erdDir,\n });\n\n child.on(\"error\", (error) => {\n logger.error(\"Failed to run `serve dist`. Ensure `serve` is installed in your project.\");\n reject(error);\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n logger.error(\n \"serve CLI exited with a non-zero code. Ensure `serve dist` works in your project.\",\n );\n reject(new Error(`serve CLI exited with code ${code ?? 1}`));\n }\n });\n });\n}\n\nexport const erdServeCommand = defineCommand({\n meta: {\n name: \"serve\",\n description: \"Generate and serve ERD (liam build + `serve dist`) (beta)\",\n },\n args: {\n ...commonArgs,\n ...deploymentArgs,\n namespace: {\n type: \"string\",\n description: \"TailorDB namespace name (uses first namespace in config if not specified)\",\n alias: \"n\",\n },\n },\n run: withCommonArgs(async (args) => {\n const { client, workspaceId, config } = await initErdContext(args);\n\n const results = await prepareErdBuilds({\n client,\n workspaceId,\n config,\n namespace: args.namespace,\n });\n\n await runServeDist(results);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { erdDeployCommand } from \"./deploy\";\nimport { erdExportCommand } from \"./export\";\nimport { erdServeCommand } from \"./serve\";\n\nexport const erdCommand = defineCommand({\n meta: {\n name: \"erd\",\n description: \"ERD utilities for TailorDB (beta)\",\n },\n subCommands: {\n export: erdExportCommand,\n serve: erdServeCommand,\n deploy: erdDeployCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, deploymentArgs, withCommonArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadConfig } from \"../config-loader\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport interface TruncateOptions {\n workspaceId?: string;\n profile?: string;\n configPath?: string;\n all?: boolean;\n namespace?: string;\n types?: string[];\n yes?: boolean;\n}\n\ninterface TruncateSingleTypeOptions {\n workspaceId: string;\n namespaceName: string;\n typeName: string;\n}\n\nasync function truncateSingleType(\n options: TruncateSingleTypeOptions,\n client: Awaited<ReturnType<typeof initOperatorClient>>,\n): Promise<void> {\n await client.truncateTailorDBType({\n workspaceId: options.workspaceId,\n namespaceName: options.namespaceName,\n tailordbTypeName: options.typeName,\n });\n\n logger.success(`Truncated type \"${options.typeName}\" in namespace \"${options.namespaceName}\"`);\n}\n\nasync function truncateNamespace(\n workspaceId: string,\n namespaceName: string,\n client: Awaited<ReturnType<typeof initOperatorClient>>,\n): Promise<void> {\n await client.truncateTailorDBTypes({\n workspaceId,\n namespaceName,\n });\n\n logger.success(`Truncated all types in namespace \"${namespaceName}\"`);\n}\n\nasync function getAllNamespaces(configPath?: string): Promise<string[]> {\n const { config } = await loadConfig(configPath);\n const namespaces = new Set<string>();\n\n // Collect namespace names from db configuration\n if (config.db) {\n for (const [namespaceName] of Object.entries(config.db)) {\n namespaces.add(namespaceName);\n }\n }\n\n return Array.from(namespaces);\n}\n\nasync function getTypeNamespace(\n workspaceId: string,\n typeName: string,\n client: Awaited<ReturnType<typeof initOperatorClient>>,\n configPath?: string,\n): Promise<string | null> {\n const namespaces = await getAllNamespaces(configPath);\n\n // Try to find the type in each namespace\n for (const namespace of namespaces) {\n try {\n const { tailordbTypes } = await client.listTailorDBTypes({\n workspaceId,\n namespaceName: namespace,\n });\n\n if (tailordbTypes.some((type) => type.name === typeName)) {\n return namespace;\n }\n } catch {\n // Continue to next namespace if error occurs\n continue;\n }\n }\n\n return null;\n}\n\n/**\n * Truncate TailorDB data based on the given options.\n * @param {TruncateOptions} [options] - Truncate options (all, namespace, or types)\n * @returns {Promise<void>} Promise that resolves when truncation completes\n */\nexport async function truncate(options?: TruncateOptions): Promise<void> {\n // Load and validate options\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options?.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options?.workspaceId,\n profile: options?.profile,\n });\n\n // Validate arguments\n const hasTypes = options?.types && options.types.length > 0;\n const hasNamespace = !!options?.namespace;\n const hasAll = !!options?.all;\n\n // All options are mutually exclusive\n const optionCount = [hasAll, hasNamespace, hasTypes].filter(Boolean).length;\n if (optionCount === 0) {\n throw new Error(\"Please specify one of: --all, --namespace <name>, or type names\");\n }\n if (optionCount > 1) {\n throw new Error(\n \"Options --all, --namespace, and type names are mutually exclusive. Please specify only one.\",\n );\n }\n\n // Validate config and get namespaces before confirmation\n const namespaces = await getAllNamespaces(options?.configPath);\n\n // Handle --all flag\n if (hasAll) {\n if (namespaces.length === 0) {\n logger.warn(\"No namespaces found in config file.\");\n return;\n }\n\n if (!options?.yes) {\n const namespaceList = namespaces.join(\", \");\n const confirmation = await logger.prompt(\n `This will truncate ALL tables in the following namespaces: ${namespaceList}. Continue? (yes/no)`,\n {\n type: \"confirm\",\n initial: false,\n },\n );\n if (!confirmation) {\n logger.info(\"Truncate cancelled.\");\n return;\n }\n }\n\n for (const namespace of namespaces) {\n await truncateNamespace(workspaceId, namespace, client);\n }\n logger.success(\"Truncated all tables in all namespaces\");\n return;\n }\n\n // Handle --namespace flag\n if (hasNamespace && options?.namespace) {\n const namespace = options.namespace;\n\n // Validate namespace exists in config\n if (!namespaces.includes(namespace)) {\n throw new Error(\n `Namespace \"${namespace}\" not found in config. Available namespaces: ${namespaces.join(\", \")}`,\n );\n }\n\n if (!options.yes) {\n const confirmation = await logger.prompt(\n `This will truncate ALL tables in namespace \"${namespace}\". Continue? (yes/no)`,\n {\n type: \"confirm\",\n initial: false,\n },\n );\n if (!confirmation) {\n logger.info(\"Truncate cancelled.\");\n return;\n }\n }\n\n await truncateNamespace(workspaceId, namespace, client);\n return;\n }\n\n // Handle specific types\n if (hasTypes && options?.types) {\n const typeNames = options.types;\n\n // Validate all types exist and get their namespaces before confirmation\n const typeNamespaceMap = new Map<string, string>();\n const notFoundTypes: string[] = [];\n\n for (const typeName of typeNames) {\n const namespace = await getTypeNamespace(workspaceId, typeName, client, options.configPath);\n\n if (namespace) {\n typeNamespaceMap.set(typeName, namespace);\n } else {\n notFoundTypes.push(typeName);\n }\n }\n\n if (notFoundTypes.length > 0) {\n throw new Error(\n `The following types were not found in any namespace: ${notFoundTypes.join(\", \")}`,\n );\n }\n\n if (!options.yes) {\n const typeList = typeNames.join(\", \");\n const confirmation = await logger.prompt(\n `This will truncate the following types: ${typeList}. Continue? (yes/no)`,\n {\n type: \"confirm\",\n initial: false,\n },\n );\n if (!confirmation) {\n logger.info(\"Truncate cancelled.\");\n return;\n }\n }\n\n for (const typeName of typeNames) {\n const namespace = typeNamespaceMap.get(typeName);\n if (!namespace) {\n continue;\n }\n\n await truncateSingleType(\n {\n workspaceId,\n namespaceName: namespace,\n typeName,\n },\n client,\n );\n }\n }\n}\n\nexport const truncateCommand = defineCommand({\n meta: {\n name: \"truncate\",\n description: \"Truncate TailorDB tables\",\n },\n args: {\n ...commonArgs,\n types: {\n type: \"positional\",\n description: \"Type names to truncate\",\n required: false,\n },\n all: {\n type: \"boolean\",\n description: \"Truncate all tables in all namespaces\",\n default: false,\n alias: \"a\",\n },\n namespace: {\n type: \"string\",\n description: \"Truncate all tables in specified namespace\",\n alias: \"n\",\n },\n yes: {\n type: \"boolean\",\n description: \"Skip confirmation prompt\",\n alias: \"y\",\n default: false,\n },\n ...deploymentArgs,\n },\n run: withCommonArgs(async (args) => {\n // Get type names from rest arguments (_)\n const types = args._.length > 0 ? args._.map((arg) => String(arg)).filter(Boolean) : undefined;\n await truncate({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n configPath: args.config,\n all: args.all,\n namespace: args.namespace,\n types,\n yes: args.yes,\n });\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { erdCommand } from \"./erd\";\nimport { truncateCommand } from \"./truncate\";\n\nexport const tailordbCommand = defineCommand({\n meta: {\n name: \"tailordb\",\n description: \"Manage TailorDB tables and data\",\n },\n subCommands: {\n erd: erdCommand,\n truncate: truncateCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const currentCommand = defineCommand({\n meta: {\n name: \"current\",\n description: \"Show current user\",\n },\n args: commonArgs,\n run: withCommonArgs(async () => {\n const config = readPlatformConfig();\n\n // Check if current user is set\n if (!config.current_user) {\n throw new Error(ml`\n Current user not set.\n Please login first using 'tailor-sdk login' command to register a user.\n `);\n }\n\n // Check if user exists\n if (!config.users[config.current_user]) {\n throw new Error(ml`\n Current user '${config.current_user}' not found in registered users.\n Please login again using 'tailor-sdk login' command to register the user.\n `);\n }\n\n logger.log(config.current_user);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List all users\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n const users = Object.keys(config.users);\n if (users.length === 0) {\n logger.info(ml`\n No users found.\n Please login first using 'tailor-sdk login' command to register a user.\n `);\n return;\n }\n\n if (args.json) {\n logger.out(users);\n return;\n }\n\n users.forEach((user) => {\n if (user === config.current_user) {\n logger.success(`${user} (current)`, { mode: \"plain\" });\n } else {\n logger.log(user);\n }\n });\n }),\n});\n","import { PATScope } from \"@tailor-proto/tailor/v1/auth_resource_pb\";\nimport ml from \"multiline-ts\";\nimport { logger } from \"../../utils/logger\";\nimport type { PersonalAccessToken } from \"@tailor-proto/tailor/v1/auth_resource_pb\";\n\nexport interface PersonalAccessTokenInfo {\n name: string;\n scopes: string[];\n}\n\nfunction patScopeToString(scope: PATScope): string {\n switch (scope) {\n case PATScope.PAT_SCOPE_READ:\n return \"read\";\n case PATScope.PAT_SCOPE_WRITE:\n return \"write\";\n default:\n return \"unknown\";\n }\n}\n\n/**\n * Transform a PersonalAccessToken into CLI-friendly info.\n * @param {PersonalAccessToken} pat - Personal access token resource\n * @returns {PersonalAccessTokenInfo} Flattened token info\n */\nexport function transformPersonalAccessToken(pat: PersonalAccessToken): PersonalAccessTokenInfo {\n return {\n name: pat.name,\n scopes: pat.scopes.map(patScopeToString),\n };\n}\n\n/**\n * Get PAT scopes from a write flag.\n * @param {boolean} write - Whether write access is required\n * @returns {PATScope[]} Scopes to apply to the token\n */\nexport function getScopesFromWriteFlag(write: boolean): PATScope[] {\n return write ? [PATScope.PAT_SCOPE_READ, PATScope.PAT_SCOPE_WRITE] : [PATScope.PAT_SCOPE_READ];\n}\n\nfunction getScopeStringsFromWriteFlag(write: boolean): string[] {\n return write ? [\"read\", \"write\"] : [\"read\"];\n}\n\n/**\n * Print the created or updated personal access token to the logger.\n * @param {string} name - Token name\n * @param {string} token - Token value\n * @param {boolean} write - Whether the token has write scope\n * @param {\"created\" | \"updated\"} action - Action performed\n * @returns {void}\n */\nexport function printCreatedToken(\n name: string,\n token: string,\n write: boolean,\n action: \"created\" | \"updated\",\n): void {\n const scopes = getScopeStringsFromWriteFlag(write);\n\n if (logger.jsonMode) {\n logger.out({ name, scopes, token });\n } else {\n logger.log(ml`\n Personal access token ${action} successfully.\n\n name: ${name}\n scopes: ${scopes.join(\"/\")}\n token: ${token}\n\n Please save this token in a secure location. You won't be able to see it again.\n `);\n }\n}\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { getScopesFromWriteFlag, printCreatedToken } from \"./transform\";\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create new personal access token\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Token name\",\n required: true,\n },\n write: {\n type: \"boolean\",\n description: \"Grant write permission (default: read-only)\",\n alias: \"W\",\n default: false,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n const scopes = getScopesFromWriteFlag(args.write);\n const result = await client.createPersonalAccessToken({\n name: args.name,\n scopes,\n });\n\n if (!result.accessToken) {\n throw new Error(\"Failed to create personal access token\");\n }\n\n printCreatedToken(args.name, result.accessToken, args.write, \"created\");\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, withCommonArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\n\nexport const deleteCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete personal access token\",\n },\n args: {\n ...commonArgs,\n name: {\n type: \"positional\",\n description: \"Token name\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n await client.deletePersonalAccessToken({\n name: args.name,\n });\n\n logger.success(`Personal access token \"${args.name}\" deleted successfully.`);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { fetchAll, initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport { transformPersonalAccessToken, type PersonalAccessTokenInfo } from \"./transform\";\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List all personal access tokens\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n const pats = await fetchAll(async (pageToken) => {\n const { personalAccessTokens, nextPageToken } = await client.listPersonalAccessTokens({\n pageToken,\n });\n return [personalAccessTokens, nextPageToken];\n });\n\n if (pats.length === 0) {\n logger.info(ml`\n No personal access tokens found.\n Please create a token using 'tailor-sdk user pat create' command.\n `);\n return;\n }\n\n if (args.json) {\n // JSON format with scopes as array\n const patInfos: PersonalAccessTokenInfo[] = pats.map(transformPersonalAccessToken);\n logger.out(patInfos);\n return;\n }\n\n // Text format: aligned list \"name: scope1/scope2\"\n const maxNameLength = Math.max(...pats.map((pat) => pat.name.length));\n\n pats.forEach((pat) => {\n const info = transformPersonalAccessToken(pat);\n const paddedName = info.name.padStart(maxNameLength);\n logger.log(`${paddedName}: ${info.scopes.join(\"/\")}`);\n });\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { getScopesFromWriteFlag, printCreatedToken } from \"./transform\";\n\nexport const updateCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update personal access token (delete and recreate)\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Token name\",\n required: true,\n },\n write: {\n type: \"boolean\",\n description: \"Grant write permission (if not specified, keeps read-only)\",\n alias: \"W\",\n default: false,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n // Delete the existing token\n await client.deletePersonalAccessToken({\n name: args.name,\n });\n\n // Create a new token with the same name\n const scopes = getScopesFromWriteFlag(args.write);\n const result = await client.createPersonalAccessToken({\n name: args.name,\n scopes,\n });\n\n if (!result.accessToken) {\n throw new Error(\"Failed to create personal access token\");\n }\n\n printCreatedToken(args.name, result.accessToken, args.write, \"updated\");\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { updateCommand } from \"./update\";\n\nexport const patCommand = defineCommand({\n meta: {\n name: \"pat\",\n description: \"Manage personal access tokens\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n update: updateCommand,\n },\n async run(context) {\n // Default to list when no subcommand is provided\n await runCommand(listCommand, {\n rawArgs: context.rawArgs || [],\n });\n },\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const switchCommand = defineCommand({\n meta: {\n name: \"switch\",\n description: \"Set current user\",\n },\n args: {\n ...commonArgs,\n user: {\n type: \"positional\",\n description: \"User email\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if user exists\n if (!config.users[args.user]) {\n throw new Error(ml`\n User \"${args.user}\" not found.\n Please login first using 'tailor-sdk login' command to register this user.\n `);\n }\n\n // Set current user\n config.current_user = args.user;\n writePlatformConfig(config);\n\n logger.success(`Current user set to \"${args.user}\" successfully.`);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { currentCommand } from \"./current\";\nimport { listCommand } from \"./list\";\nimport { patCommand } from \"./pat\";\nimport { switchCommand } from \"./switch\";\n\nexport const userCommand = defineCommand({\n meta: {\n name: \"user\",\n description: \"Manage Tailor Platform users\",\n },\n subCommands: {\n current: currentCommand,\n list: listCommand,\n pat: patCommand,\n switch: switchCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { executionsCommand } from \"./executions\";\nimport { getCommand } from \"./get\";\nimport { listCommand } from \"./list\";\nimport { resumeCommand } from \"./resume\";\nimport { startCommand } from \"./start\";\n\nexport const workflowCommand = defineCommand({\n meta: {\n name: \"workflow\",\n description: \"Manage workflows\",\n },\n subCommands: {\n list: listCommand,\n get: getCommand,\n start: startCommand,\n executions: executionsCommand,\n resume: resumeCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\n\nexport const workspaceCommand = defineCommand({\n meta: {\n name: \"workspace\",\n description: \"Manage Tailor Platform workspaces\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","#!/usr/bin/env node\n\nimport { register } from \"node:module\";\nimport { defineCommand, runMain } from \"citty\";\nimport { apiCommand } from \"./api\";\nimport { applyCommand } from \"./apply\";\nimport { generateCommand } from \"./generator\";\nimport { initCommand } from \"./init\";\nimport { loginCommand } from \"./login\";\nimport { logoutCommand } from \"./logout\";\nimport { machineuserCommand } from \"./machineuser\";\nimport { oauth2clientCommand } from \"./oauth2client\";\nimport { profileCommand } from \"./profile\";\nimport { removeCommand } from \"./remove\";\nimport { secretCommand } from \"./secret\";\nimport { showCommand } from \"./show\";\nimport { staticwebsiteCommand } from \"./staticwebsite\";\nimport { tailordbCommand } from \"./tailordb\";\nimport { userCommand } from \"./user\";\nimport { readPackageJson } from \"./utils/package-json\";\nimport { workflowCommand } from \"./workflow\";\nimport { workspaceCommand } from \"./workspace\";\n\nregister(\"tsx\", import.meta.url, { data: {} });\n\nconst packageJson = await readPackageJson();\n\nexport const mainCommand = defineCommand({\n meta: {\n name: Object.keys(packageJson.bin ?? {})[0] || \"tailor-sdk\",\n version: packageJson.version,\n description:\n packageJson.description || \"Tailor CLI for managing Tailor Platform SDK applications\",\n },\n subCommands: {\n api: apiCommand,\n apply: applyCommand,\n generate: generateCommand,\n init: initCommand,\n login: loginCommand,\n logout: logoutCommand,\n machineuser: machineuserCommand,\n oauth2client: oauth2clientCommand,\n profile: profileCommand,\n remove: removeCommand,\n secret: secretCommand,\n show: showCommand,\n staticwebsite: staticwebsiteCommand,\n tailordb: tailordbCommand,\n user: userCommand,\n workflow: workflowCommand,\n workspace: workspaceCommand,\n },\n});\n\nrunMain(mainCommand);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,6BAA6B;CACjC,MAAM,eAAe;EAAC;EAAO;EAAQ;EAAO;CAC5C,MAAM,YAAY,QAAQ,IAAI;AAC9B,KAAI,C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MAAM;EACN,aAAa;EACd;CACD,aAAa;EACX,QAAQE;EACR,QAAQC;EACR,MAAMC;EACP;CACD,MAAM,MAAM;AACV,QAAM,WAAWA,eAAa,EAAE,SAAS,EAAE,EAAE,CAAC;;CAEjD,CAAC;;;;ACKF,SAAS,OAAO,OAAO,KAAK,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC;AAE9C,MAAM,cAAc,MAAM,iBAAiB;AAE3C,MAAa,cAAc,cAAc;CACvC,MAAM;EACJ,MAAM,OAAO,KAAK,YAAY,OAAO,EAAE,CAAC,CAAC,MAAM;EAC/C,SAAS,YAAY;EACrB,aACE,YAAY,eAAe;EAC9B;CACD,aAAa;EACX,KAAK;EACL,OAAO;EACP,UAAU;EACV,MAAM;EACN,OAAO;EACP,QAAQ;EACR,aAAa;EACb,cAAc;EACd,SAAS;EACT,QAAQ;EACR,QAAQ;EACR,MAAM;EACN,eAAe;EACf,UAAU;EACV,MAAM;EACN,UAAU;EACV,WAAW;EACZ;CACF,CAAC;AAEF,QAAQ,YAAY"}
1
+ {"version":3,"file":"index.mjs","names":["packageJson","listCommand","getCommand","listCommand","createCommand","deleteCommand","listCommand","updateCommand","createCommand","deleteCommand","listCommand","updateCommand","createCommand","deleteCommand","listCommand","createCommand","deleteCommand","listCommand","setTimeout","fs","mimeLookup","listCommand","listCommand","fs","listCommand","listCommand","listCommand","getCommand","createCommand","deleteCommand","listCommand"],"sources":["../../src/cli/init.ts","../../src/cli/login.ts","../../src/cli/logout.ts","../../src/cli/machineuser/index.ts","../../src/cli/oauth2client/index.ts","../../src/cli/profile/create.ts","../../src/cli/profile/delete.ts","../../src/cli/profile/list.ts","../../src/cli/profile/update.ts","../../src/cli/profile/index.ts","../../src/cli/secret/args.ts","../../src/cli/secret/create.ts","../../src/cli/secret/delete.ts","../../src/cli/secret/list.ts","../../src/cli/secret/update.ts","../../src/cli/secret/vault/args.ts","../../src/cli/secret/vault/create.ts","../../src/cli/secret/vault/delete.ts","../../src/cli/secret/vault/list.ts","../../src/cli/secret/vault/index.ts","../../src/cli/secret/index.ts","../../src/cli/utils/progress.ts","../../src/cli/staticwebsite/deploy.ts","../../src/cli/staticwebsite/get.ts","../../src/cli/staticwebsite/list.ts","../../src/cli/staticwebsite/index.ts","../../src/cli/utils/resolve-cli-bin.ts","../../src/cli/tailordb/erd/schema.ts","../../src/cli/utils/beta.ts","../../src/cli/tailordb/erd/utils.ts","../../src/cli/tailordb/erd/export.ts","../../src/cli/tailordb/erd/deploy.ts","../../src/cli/tailordb/erd/serve.ts","../../src/cli/tailordb/erd/index.ts","../../src/cli/tailordb/index.ts","../../src/cli/user/current.ts","../../src/cli/user/list.ts","../../src/cli/user/pat/transform.ts","../../src/cli/user/pat/create.ts","../../src/cli/user/pat/delete.ts","../../src/cli/user/pat/list.ts","../../src/cli/user/pat/update.ts","../../src/cli/user/pat/index.ts","../../src/cli/user/switch.ts","../../src/cli/user/index.ts","../../src/cli/workflow/index.ts","../../src/cli/workspace/index.ts","../../src/cli/index.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs } from \"./args\";\nimport { logger } from \"./utils/logger\";\nimport { readPackageJson } from \"./utils/package-json\";\n\nconst detectPackageManager = () => {\n const availablePMs = [\"npm\", \"yarn\", \"pnpm\"];\n const userAgent = process.env.npm_config_user_agent;\n if (!userAgent) return;\n const [name] = userAgent.split(\"/\");\n if (!availablePMs.includes(name)) return;\n return name;\n};\n\nexport const initCommand = defineCommand({\n meta: {\n name: \"init\",\n description: \"Initialize a new project using create-sdk\",\n },\n args: {\n ...commonArgs,\n name: {\n type: \"positional\",\n description: \"Project name\",\n required: false,\n },\n template: {\n type: \"string\",\n description: \"Template name\",\n required: false,\n alias: \"t\",\n },\n },\n run: withCommonArgs(async (args) => {\n const packageJson = await readPackageJson();\n const version =\n packageJson.version && packageJson.version !== \"0.0.0\" ? packageJson.version : \"latest\";\n\n let packageManager = detectPackageManager();\n if (!packageManager) {\n logger.warn(\"Could not detect package manager, defaulting to npm\");\n packageManager = \"npm\";\n }\n const initArgs = [\n \"create\",\n `@tailor-platform/sdk@${version}`,\n ...(args.name ? [args.name] : []),\n ...(packageManager === \"npm\" ? [\"--\"] : []),\n ...(args.template ? [\"--template\", args.template] : []),\n ];\n logger.log(`Running: ${packageManager} ${initArgs.join(\" \")}`);\n\n spawnSync(packageManager, initArgs, { stdio: \"inherit\" });\n }),\n});\n","import * as crypto from \"node:crypto\";\nimport * as http from \"node:http\";\nimport { generateCodeVerifier } from \"@badgateway/oauth2-client\";\nimport { defineCommand } from \"citty\";\nimport open from \"open\";\nimport { commonArgs, withCommonArgs } from \"./args\";\nimport { fetchUserInfo, initOAuth2Client } from \"./client\";\nimport { readPlatformConfig, writePlatformConfig } from \"./context\";\nimport { logger } from \"./utils/logger\";\n\nconst redirectPort = 8085;\nconst redirectUri = `http://localhost:${redirectPort}/callback`;\n\nfunction randomState() {\n return crypto.randomBytes(32).toString(\"base64url\");\n}\n\nconst startAuthServer = async () => {\n const client = initOAuth2Client();\n const state = randomState();\n const codeVerifier = await generateCodeVerifier();\n\n return new Promise<void>((resolve, reject) => {\n const server = http.createServer(async (req, res) => {\n try {\n if (!req.url?.startsWith(\"/callback\")) {\n throw new Error(\"Invalid callback URL\");\n }\n const tokens = await client.authorizationCode.getTokenFromCodeRedirect(\n `http://${req.headers.host}${req.url}`,\n {\n redirectUri: redirectUri,\n state,\n codeVerifier,\n },\n );\n const userInfo = await fetchUserInfo(tokens.accessToken);\n\n const pfConfig = readPlatformConfig();\n pfConfig.users = {\n ...pfConfig.users,\n [userInfo.email]: {\n access_token: tokens.accessToken,\n refresh_token: tokens.refreshToken!,\n token_expires_at: new Date(tokens.expiresAt!).toISOString(),\n },\n };\n pfConfig.current_user = userInfo.email;\n writePlatformConfig(pfConfig);\n\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n res.end(\n JSON.stringify({\n status: \"ok\",\n message: \"Successfully authenticated. Please close this window.\",\n }),\n );\n resolve();\n } catch (error) {\n res.writeHead(401);\n res.end(\"Authentication failed\");\n reject(error);\n } finally {\n // Close the server after handling one request.\n server.close();\n }\n });\n\n const timeout = setTimeout(\n () => {\n server.close();\n reject(new Error(\"Login timeout exceeded\"));\n },\n 5 * 60 * 1000,\n );\n\n server.on(\"close\", () => {\n clearTimeout(timeout);\n });\n\n server.on(\"error\", (error) => {\n reject(error);\n });\n\n server.listen(redirectPort, async () => {\n const authorizeUri = await client.authorizationCode.getAuthorizeUri({\n redirectUri,\n state,\n codeVerifier,\n });\n\n logger.info(`Opening browser for login:\\n\\n${authorizeUri}\\n`);\n try {\n await open(authorizeUri);\n } catch {\n logger.warn(\"Failed to open browser automatically. Please open the URL above manually.\");\n }\n });\n });\n};\n\nexport const loginCommand = defineCommand({\n meta: {\n name: \"login\",\n description: \"Login to Tailor Platform\",\n },\n args: commonArgs,\n run: withCommonArgs(async () => {\n await startAuthServer();\n logger.success(\"Successfully logged in to Tailor Platform.\");\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs } from \"./args\";\nimport { initOAuth2Client } from \"./client\";\nimport { readPlatformConfig, writePlatformConfig } from \"./context\";\nimport { logger } from \"./utils/logger\";\n\nexport const logoutCommand = defineCommand({\n meta: {\n name: \"logout\",\n description: \"Logout from Tailor Platform\",\n },\n args: commonArgs,\n run: withCommonArgs(async () => {\n const pfConfig = readPlatformConfig();\n const tokens = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : undefined;\n if (!tokens) {\n logger.info(\"You are not logged in.\");\n return;\n }\n\n const client = initOAuth2Client();\n client.revoke(\n {\n accessToken: tokens.access_token,\n refreshToken: tokens.refresh_token,\n expiresAt: Date.parse(tokens.token_expires_at),\n },\n \"refresh_token\",\n );\n\n delete pfConfig.users[pfConfig.current_user!];\n pfConfig.current_user = null;\n writePlatformConfig(pfConfig);\n logger.success(\"Successfully logged out from Tailor Platform.\");\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { listCommand } from \"./list\";\nimport { tokenCommand } from \"./token\";\n\nexport const machineuserCommand = defineCommand({\n meta: {\n name: \"machineuser\",\n description: \"Manage machine users\",\n },\n subCommands: {\n list: listCommand,\n token: tokenCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { getCommand } from \"./get\";\nimport { listCommand } from \"./list\";\n\nexport const oauth2clientCommand = defineCommand({\n meta: {\n name: \"oauth2client\",\n description: \"Manage OAuth2 clients\",\n },\n subCommands: {\n get: getCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { fetchLatestToken, readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport type { ProfileInfo } from \".\";\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create new profile\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Profile name\",\n required: true,\n },\n user: {\n type: \"string\",\n description: \"User email\",\n required: true,\n alias: \"u\",\n },\n \"workspace-id\": {\n type: \"string\",\n description: \"Workspace ID\",\n required: true,\n alias: \"w\",\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if profile already exists\n if (config.profiles[args.name]) {\n throw new Error(`Profile \"${args.name}\" already exists.`);\n }\n\n // Check if user exists\n const token = await fetchLatestToken(config, args.user);\n\n // Check if workspace exists\n const client = await initOperatorClient(token);\n const workspaces = await fetchAll(async (pageToken) => {\n const { workspaces, nextPageToken } = await client.listWorkspaces({\n pageToken,\n });\n return [workspaces, nextPageToken];\n });\n\n const workspace = workspaces.find((ws) => ws.id === args[\"workspace-id\"]);\n if (!workspace) {\n throw new Error(`Workspace \"${args[\"workspace-id\"]}\" not found.`);\n }\n\n // Create new profile\n config.profiles[args.name] = {\n user: args.user,\n workspace_id: args[\"workspace-id\"],\n };\n writePlatformConfig(config);\n\n if (!args.json) {\n logger.success(`Profile \"${args.name}\" created successfully.`);\n }\n\n // Show profile info\n const profileInfo: ProfileInfo = {\n name: args.name,\n user: args.user,\n workspaceId: args[\"workspace-id\"],\n };\n logger.out(profileInfo);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const deleteCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete profile\",\n },\n args: {\n ...commonArgs,\n name: {\n type: \"positional\",\n description: \"Profile name\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if profile exists\n if (!config.profiles[args.name]) {\n throw new Error(`Profile \"${args.name}\" not found.`);\n }\n\n // Delete profile\n delete config.profiles[args.name];\n writePlatformConfig(config);\n\n logger.success(`Profile \"${args.name}\" deleted successfully.`);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport type { ProfileInfo } from \".\";\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List all profiles\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n },\n run: withCommonArgs(async () => {\n const config = readPlatformConfig();\n\n const profiles = Object.entries(config.profiles);\n if (profiles.length === 0) {\n logger.info(ml`\n No profiles found.\n Please create a profile first using 'tailor-sdk profile create' command.\n `);\n return;\n }\n\n const profileInfos: ProfileInfo[] = profiles.map(([name, profile]) => ({\n name,\n user: profile!.user,\n workspaceId: profile!.workspace_id,\n }));\n logger.out(profileInfos);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { fetchLatestToken, readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport type { ProfileInfo } from \".\";\n\nexport const updateCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update profile properties\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Profile name\",\n required: true,\n },\n user: {\n type: \"string\",\n description: \"New user email\",\n alias: \"u\",\n },\n \"workspace-id\": {\n type: \"string\",\n description: \"New workspace ID\",\n alias: \"w\",\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if profile exists\n if (!config.profiles[args.name]) {\n throw new Error(`Profile \"${args.name}\" not found.`);\n }\n\n // Check if at least one property is provided\n if (!args.user && !args[\"workspace-id\"]) {\n throw new Error(\"Please provide at least one property to update.\");\n }\n\n const profile = config.profiles[args.name]!;\n const oldUser = profile.user;\n const newUser = args.user || oldUser;\n const oldWorkspaceId = profile.workspace_id;\n const newWorkspaceId = args[\"workspace-id\"] || oldWorkspaceId;\n\n // Check if user exists\n const token = await fetchLatestToken(config, newUser);\n\n // Check if workspace exists\n const client = await initOperatorClient(token);\n const workspaces = await fetchAll(async (pageToken) => {\n const { workspaces, nextPageToken } = await client.listWorkspaces({\n pageToken,\n });\n return [workspaces, nextPageToken];\n });\n const workspace = workspaces.find((ws) => ws.id === newWorkspaceId);\n if (!workspace) {\n throw new Error(`Workspace \"${newWorkspaceId}\" not found.`);\n }\n\n // Update properties\n profile.user = newUser;\n profile.workspace_id = newWorkspaceId;\n writePlatformConfig(config);\n if (!args.json) {\n logger.success(`Profile \"${args.name}\" updated successfully`);\n }\n\n // Show profile info\n const profileInfo: ProfileInfo = {\n name: args.name,\n user: newUser,\n workspaceId: newWorkspaceId,\n };\n logger.out(profileInfo);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { updateCommand } from \"./update\";\n\nexport interface ProfileInfo {\n name: string;\n user: string;\n workspaceId: string;\n}\n\nexport const profileCommand = defineCommand({\n meta: {\n name: \"profile\",\n description: \"Manage workspace profiles (user + workspace combinations)\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n update: updateCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","/**\n * Arguments for specify secret key\n */\nexport const vaultArgs = {\n \"vault-name\": {\n type: \"string\",\n description: \"Vault name\",\n alias: \"V\",\n required: true,\n },\n} as const;\n\n/**\n * Arguments for specify secret key\n */\nexport const secretIdentifyArgs = {\n ...vaultArgs,\n name: {\n type: \"string\",\n description: \"Secret name\",\n alias: \"n\",\n required: true,\n },\n} as const;\n\n/**\n * Arguments for specify secret key\n */\nexport const secretValueArgs = {\n ...secretIdentifyArgs,\n value: {\n type: \"string\",\n description: \"Secret value\",\n alias: \"v\",\n required: true,\n },\n} as const;\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { secretValueArgs } from \"./args\";\n\nexport const createSecretCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a secret in a vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...secretValueArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n try {\n await client.createSecretManagerSecret({\n workspaceId,\n secretmanagerVaultName: args[\"vault-name\"],\n secretmanagerSecretName: args.name,\n secretmanagerSecretValue: args.value,\n });\n } catch (error) {\n if (error instanceof ConnectError) {\n if (error.code === Code.NotFound) {\n throw new Error(`Vault \"${args[\"vault-name\"]}\" not found.`);\n }\n if (error.code === Code.AlreadyExists) {\n throw new Error(`Secret \"${args.name}\" already exists.`);\n }\n }\n throw error;\n }\n\n logger.success(`Secret: ${args.name} created in vault: ${args[\"vault-name\"]}`);\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, confirmationArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { secretIdentifyArgs } from \"./args\";\n\nexport const deleteSecretCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete a secret in a vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...secretIdentifyArgs,\n ...confirmationArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n if (!args.yes) {\n const confirmation = await logger.prompt(\n `Enter the secret name to confirm deletion (\"${args.name}\"): `,\n { type: \"text\" },\n );\n\n if (confirmation !== args.name) {\n logger.info(\"Secret deletion cancelled.\");\n return;\n }\n }\n\n try {\n await client.deleteSecretManagerSecret({\n workspaceId,\n secretmanagerVaultName: args[\"vault-name\"],\n secretmanagerSecretName: args.name,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Secret \"${args.name}\" not found in vault \"${args[\"vault-name\"]}\".`);\n }\n throw error;\n }\n\n logger.success(`Secret: ${args.name} deleted from vault: ${args[\"vault-name\"]}`);\n }),\n});\n","import { timestampDate } from \"@bufbuild/protobuf/wkt\";\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { vaultArgs } from \"./args\";\nimport type { SecretManagerSecret } from \"@tailor-proto/tailor/v1/secret_manager_resource_pb\";\n\nexport interface SecretListOptions {\n workspaceId?: string;\n profile?: string;\n vaultName: string;\n}\n\nexport interface SecretInfo {\n name: string;\n createdAt: string;\n updatedAt: string;\n}\n\nfunction secretInfo(secret: SecretManagerSecret): SecretInfo {\n return {\n name: secret.name,\n createdAt: secret.createTime ? timestampDate(secret.createTime).toISOString() : \"N/A\",\n updatedAt: secret.updateTime ? timestampDate(secret.updateTime).toISOString() : \"N/A\",\n };\n}\n\n/**\n * List secrets in a Secret Manager vault.\n * @param options - Secret listing options\n * @returns List of secrets\n */\nasync function secretList(options: SecretListOptions): Promise<SecretInfo[]> {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options.workspaceId,\n profile: options.profile,\n });\n\n const secrets = await fetchAll(async (pageToken) => {\n const { secrets, nextPageToken } = await client.listSecretManagerSecrets({\n workspaceId,\n secretmanagerVaultName: options.vaultName,\n pageToken,\n });\n return [secrets, nextPageToken];\n });\n\n return secrets.map(secretInfo);\n}\n\nexport const listSecretCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List secrets in a vault\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n ...vaultArgs,\n },\n run: withCommonArgs(async (args) => {\n try {\n const secrets = await secretList({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n vaultName: args[\"vault-name\"],\n });\n logger.out(secrets);\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Vault \"${args[\"vault-name\"]}\" not found.`);\n }\n throw error;\n }\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { secretValueArgs } from \"./args\";\n\nexport const updateSecretCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update a secret in a vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...secretValueArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n try {\n await client.updateSecretManagerSecret({\n workspaceId,\n secretmanagerVaultName: args[\"vault-name\"],\n secretmanagerSecretName: args.name,\n secretmanagerSecretValue: args.value,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Secret \"${args.name}\" not found in vault \"${args[\"vault-name\"]}\".`);\n }\n throw error;\n }\n\n logger.success(`Secret: ${args.name} updated in vault: ${args[\"vault-name\"]}`);\n }),\n});\n","export const nameArgs = {\n name: {\n type: \"positional\",\n description: \"Vault name\",\n required: true,\n },\n} as const;\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, withCommonArgs, workspaceArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport { nameArgs } from \"./args\";\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a Secret Manager vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...nameArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n try {\n await client.createSecretManagerVault({\n workspaceId,\n secretmanagerVaultName: args.name,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.AlreadyExists) {\n throw new Error(`Vault \"${args.name}\" already exists.`);\n }\n throw error;\n }\n\n logger.success(`Vault: ${args.name} created`);\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, confirmationArgs, withCommonArgs, workspaceArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport { nameArgs } from \"./args\";\n\nexport const deleteCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete a Secret Manager vault\",\n },\n args: {\n ...commonArgs,\n ...workspaceArgs,\n ...nameArgs,\n ...confirmationArgs,\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n if (!args.yes) {\n const confirmation = await logger.prompt(\n `Enter the vault name to confirm deletion (\"${args.name}\"): `,\n { type: \"text\" },\n );\n if (confirmation !== args.name) {\n logger.info(\"Vault deletion cancelled.\");\n return;\n }\n }\n\n try {\n await client.deleteSecretManagerVault({\n workspaceId,\n secretmanagerVaultName: args.name,\n });\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(`Vault \"${args.name}\" not found.`);\n }\n throw error;\n }\n\n logger.success(`Vault: ${args.name} deleted`);\n }),\n});\n","import { timestampDate } from \"@bufbuild/protobuf/wkt\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../../args\";\nimport { fetchAll, initOperatorClient } from \"../../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport type { SecretManagerVault } from \"@tailor-proto/tailor/v1/secret_manager_resource_pb\";\n\nexport interface VaultListOptions {\n workspaceId?: string;\n profile?: string;\n}\n\nexport interface VaultInfo {\n name: string;\n createdAt: string;\n updatedAt: string;\n}\n\nfunction vaultInfo(vault: SecretManagerVault): VaultInfo {\n return {\n name: vault.name,\n createdAt: vault.createTime ? timestampDate(vault.createTime).toISOString() : \"N/A\",\n updatedAt: vault.updateTime ? timestampDate(vault.updateTime).toISOString() : \"N/A\",\n };\n}\n\n/**\n * List Secret Manager vaults in the workspace.\n * @param options - Vault listing options\n * @returns List of vaults\n */\nasync function vaultList(options?: VaultListOptions): Promise<VaultInfo[]> {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options?.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options?.workspaceId,\n profile: options?.profile,\n });\n\n const vaults = await fetchAll(async (pageToken) => {\n const { vaults, nextPageToken } = await client.listSecretManagerVaults({\n workspaceId,\n pageToken,\n });\n return [vaults, nextPageToken];\n });\n\n return vaults.map(vaultInfo);\n}\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List Secret Manager vaults\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n },\n run: withCommonArgs(async (args) => {\n const vaults = await vaultList({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n logger.out(vaults);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\n\nexport const vaultCommand = defineCommand({\n meta: {\n name: \"vault\",\n description: \"Manage Secret Manager vaults\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createSecretCommand } from \"./create\";\nimport { deleteSecretCommand } from \"./delete\";\nimport { listSecretCommand } from \"./list\";\nimport { updateSecretCommand } from \"./update\";\nimport { vaultCommand } from \"./vault\";\n\nexport const secretCommand = defineCommand({\n meta: {\n name: \"secret\",\n description: \"Manage secrets and vaults\",\n },\n subCommands: {\n create: createSecretCommand,\n delete: deleteSecretCommand,\n list: listSecretCommand,\n update: updateSecretCommand,\n vault: vaultCommand,\n },\n async run() {\n await runCommand(vaultCommand, { rawArgs: [] });\n },\n});\n","import { setTimeout } from \"node:timers/promises\";\n\n/**\n * Create a simple progress reporter that writes updates to stderr.\n * @param label - Label to prefix progress output\n * @param total - Total number of steps\n * @returns Progress helpers\n */\nexport function createProgress(label: string, total: number) {\n let current = 0;\n\n const update = () => {\n current += 1;\n const percent = Math.round((current / total) * 100);\n process.stderr.write(`\\r${label} ${current}/${total} (${percent}%)`);\n };\n\n const finish = () => {\n process.stderr.write(\"\\n\");\n };\n\n return { update, finish };\n}\n\n/**\n * Wrap a promise with a timeout, rejecting if the timeout elapses first.\n * @template T\n * @param p - Promise to await\n * @param ms - Timeout in milliseconds\n * @param message - Error message on timeout\n * @returns Result of the original promise if it completes in time\n */\nexport async function withTimeout<T>(p: Promise<T>, ms: number, message: string): Promise<T> {\n return await Promise.race([\n p,\n setTimeout(ms).then(() => {\n throw new Error(message);\n }),\n ]);\n}\n","import * as fs from \"fs\";\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { lookup as mimeLookup } from \"mime-types\";\nimport pLimit from \"p-limit\";\nimport * as path from \"pathe\";\nimport { withCommonArgs, commonArgs, jsonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient, type OperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\nimport { createProgress, withTimeout } from \"../utils/progress\";\nimport type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport type { UploadFileRequestSchema } from \"@tailor-proto/tailor/v1/staticwebsite_pb\";\n\nconst CHUNK_SIZE = 64 * 1024; // 64KB\nconst IGNORED_FILES = new Set([\".DS_Store\", \"thumbs.db\", \"desktop.ini\"]);\nfunction shouldIgnoreFile(filePath: string) {\n const fileName = path.basename(filePath).toLowerCase();\n return IGNORED_FILES.has(fileName);\n}\n\nexport type DeployResult = {\n url: string;\n skippedFiles: string[];\n};\n\n/**\n * Deploy a static website by creating a deployment, uploading files, and publishing it.\n * @param client - Operator client instance\n * @param workspaceId - Workspace ID\n * @param name - Static website name\n * @param distDir - Directory containing static site files\n * @param showProgress - Whether to show upload progress\n * @returns Deployment result with URL and skipped files\n */\nexport async function deployStaticWebsite(\n client: OperatorClient,\n workspaceId: string,\n name: string,\n distDir: string,\n showProgress: boolean = true,\n): Promise<DeployResult> {\n const { deploymentId } = await client.createDeployment({\n workspaceId,\n name,\n });\n\n if (!deploymentId) {\n throw new Error(\"createDeployment returned empty deploymentId\");\n }\n\n const skippedFiles = await uploadDirectory(\n client,\n workspaceId,\n deploymentId,\n distDir,\n showProgress,\n );\n\n const { url } = await client.publishDeployment({\n workspaceId,\n deploymentId,\n });\n\n if (!url) {\n throw new Error(\"publishDeployment returned empty url\");\n }\n\n return { url, skippedFiles };\n}\n\nasync function uploadDirectory(\n client: OperatorClient,\n workspaceId: string,\n deploymentId: string,\n rootDir: string,\n showProgress: boolean,\n): Promise<string[]> {\n const files = await collectFiles(rootDir);\n if (files.length === 0) {\n logger.warn(`No files found under ${rootDir}`);\n return [];\n }\n\n const concurrency = 5;\n const limit = pLimit(concurrency);\n\n const total = files.length;\n const progress = showProgress ? createProgress(\"Uploading files\", total) : undefined;\n const skippedFiles: string[] = [];\n\n await Promise.all(\n files.map((relativePath) =>\n limit(async () => {\n await uploadSingleFile(\n client,\n workspaceId,\n deploymentId,\n rootDir,\n relativePath,\n skippedFiles,\n );\n if (progress) {\n progress.update();\n }\n }),\n ),\n );\n\n if (progress) {\n progress.finish();\n }\n\n return skippedFiles;\n}\n\n/**\n * Recursively collect all deployable files under the given directory.\n * @param rootDir - Root directory to scan\n * @param currentDir - Current relative directory (for recursion)\n * @returns List of file paths relative to rootDir\n */\nasync function collectFiles(rootDir: string, currentDir = \"\"): Promise<string[]> {\n const dirPath = path.join(rootDir, currentDir);\n\n const entries = await fs.promises.readdir(dirPath, {\n withFileTypes: true,\n });\n const files: string[] = [];\n\n for (const entry of entries) {\n const rel = path.join(currentDir, entry.name);\n if (entry.isDirectory()) {\n const sub = await collectFiles(rootDir, rel);\n files.push(...sub);\n } else if (entry.isFile() && !entry.isSymbolicLink() && !shouldIgnoreFile(rel)) {\n files.push(rel);\n }\n }\n\n return files;\n}\n\nasync function uploadSingleFile(\n client: OperatorClient,\n workspaceId: string,\n deploymentId: string,\n rootDir: string,\n filePath: string,\n skippedFiles: string[],\n): Promise<void> {\n const absPath = path.join(rootDir, filePath);\n\n const mime = mimeLookup(filePath);\n\n if (!mime) {\n skippedFiles.push(`${filePath} (unsupported content type; no MIME mapping found)`);\n return;\n }\n\n const contentType = mime;\n\n const readStream = fs.createReadStream(absPath, {\n highWaterMark: CHUNK_SIZE,\n });\n\n async function* requestStream(): AsyncIterable<MessageInitShape<typeof UploadFileRequestSchema>> {\n yield {\n payload: {\n case: \"initialMetadata\",\n value: {\n workspaceId,\n deploymentId,\n filePath,\n contentType,\n },\n },\n };\n for await (const chunk of readStream) {\n yield {\n payload: {\n case: \"chunkData\",\n value: chunk as Buffer,\n },\n };\n }\n }\n\n async function uploadWithLogging() {\n try {\n await client.uploadFile(requestStream());\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.InvalidArgument) {\n skippedFiles.push(`${filePath} (server rejected file as invalid: ${error.message})`);\n return;\n }\n // For non-validation errors, fail the deployment as before.\n throw error;\n }\n }\n\n await withTimeout(\n uploadWithLogging(),\n // 2 minutes per file\n 2 * 60_000,\n `Upload timed out for \"${filePath}\"`,\n );\n}\n\n/**\n * Log skipped files after a deployment, including reasons for skipping.\n * @param skippedFiles - List of skipped file descriptions\n */\nexport function logSkippedFiles(skippedFiles: string[]) {\n if (skippedFiles.length === 0) {\n return;\n }\n logger.warn(\n \"Deployment completed, but some files failed to upload. These files may have unsupported content types or other validation issues. Please review the list below:\",\n );\n for (const file of skippedFiles) {\n logger.log(` - ${file}`);\n }\n}\n\nexport const deployCommand = defineCommand({\n meta: {\n name: \"deploy\",\n description: \"Deploy a static website\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n name: {\n type: \"string\",\n description: \"Static website name\",\n alias: \"n\",\n required: true,\n },\n dir: {\n type: \"string\",\n description: \"Path to the static website files\",\n alias: \"d\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n logger.info(`Deploying static website \"${args.name}\" from directory: ${args.dir}`);\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n\n const name = args.name;\n const dir = path.resolve(process.cwd(), args.dir);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {\n throw new Error(`Directory not found or not a directory: ${dir}`);\n }\n\n const { url, skippedFiles } = await withTimeout(\n deployStaticWebsite(client, workspaceId, name, dir, !args.json),\n // 10 minutes\n 10 * 60_000,\n \"Deployment timed out after 10 minutes.\",\n );\n\n if (args.json) {\n logger.out({ name, workspaceId, url, skippedFiles });\n } else {\n logger.success(`Static website \"${name}\" deployed successfully. URL: ${url}`);\n logSkippedFiles(skippedFiles);\n }\n }),\n});\n","import { Code, ConnectError } from \"@connectrpc/connect\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const getCommand = defineCommand({\n meta: {\n name: \"get\",\n description: \"Get static website details\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n name: {\n type: \"positional\",\n description: \"Static website name\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n const notFoundErrorMessage = `Static website \"${args.name}\" not found.`;\n\n try {\n const { staticwebsite } = await client.getStaticWebsite({\n workspaceId,\n name: args.name,\n });\n\n if (!staticwebsite) {\n throw new Error(notFoundErrorMessage);\n }\n\n const info = {\n workspaceId,\n name: staticwebsite.name,\n description: staticwebsite.description,\n url: staticwebsite.url,\n allowedIpAddresses: args.json\n ? staticwebsite.allowedIpAddresses\n : staticwebsite.allowedIpAddresses.join(\"\\n\"),\n };\n\n logger.out(info);\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n throw new Error(notFoundErrorMessage);\n }\n throw error;\n }\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, jsonArgs, withCommonArgs, workspaceArgs } from \"../args\";\nimport { fetchAll, initOperatorClient } from \"../client\";\nimport { loadAccessToken, loadWorkspaceId } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport interface StaticWebsiteInfo {\n workspaceId: string;\n name: string;\n description: string;\n url: string;\n allowedIpAddresses: string[];\n}\n\ntype StaticWebsiteListOptions = {\n workspaceId?: string;\n profile?: string;\n};\n\n/**\n * List static websites in the workspace.\n * @param options - Static website listing options\n * @returns List of static websites\n */\nasync function listStaticWebsites(\n options?: StaticWebsiteListOptions,\n): Promise<StaticWebsiteInfo[]> {\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: options?.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: options?.workspaceId,\n profile: options?.profile,\n });\n\n const websites = await fetchAll(async (pageToken) => {\n const { staticwebsites, nextPageToken } = await client.listStaticWebsites({\n workspaceId,\n pageToken,\n });\n return [staticwebsites, nextPageToken];\n });\n\n return websites.map((site) => ({\n workspaceId,\n name: site.name,\n description: site.description,\n url: site.url ?? \"\",\n allowedIpAddresses: site.allowedIpAddresses,\n }));\n}\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List static websites\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n ...workspaceArgs,\n },\n run: withCommonArgs(async (args) => {\n const websites = await listStaticWebsites({\n workspaceId: args[\"workspace-id\"],\n profile: args.profile,\n });\n\n const formatted = args.json\n ? websites\n : websites.map(({ allowedIpAddresses, ...rest }) => {\n if (allowedIpAddresses.length === 0) {\n return {\n ...rest,\n allowedIpAddresses: \"No allowed IP addresses\",\n };\n }\n\n const count = allowedIpAddresses.length;\n const label = count === 1 ? \"1 IP address\" : `${count} IP addresses`;\n\n return {\n ...rest,\n allowedIpAddresses: label,\n };\n });\n\n logger.out(formatted);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { deployCommand } from \"./deploy\";\nimport { getCommand } from \"./get\";\nimport { listCommand } from \"./list\";\n\nexport const staticwebsiteCommand = defineCommand({\n meta: {\n name: \"staticwebsite\",\n description: \"Manage static websites\",\n },\n subCommands: {\n deploy: deployCommand,\n get: getCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { findUpSync } from \"find-up-simple\";\nimport * as path from \"pathe\";\n\ninterface CliPackageJson {\n bin?: Record<string, string>;\n}\n\ntype ResolveCliBinOptions = {\n cwd: string;\n packageName: string;\n binName: string;\n installHint: string;\n};\n\n/**\n * Resolve a CLI binary path from the caller's project dependencies.\n * @param options - Resolution options for locating the CLI binary.\n * @returns Absolute path to the CLI binary entry.\n */\nexport function resolveCliBinPath(options: ResolveCliBinOptions): string {\n const { cwd, packageName, binName, installHint } = options;\n const projectPackageJsonPath = findUpSync(\"package.json\", { cwd });\n if (!projectPackageJsonPath) {\n throw new Error(`Failed to locate package.json from ${cwd}.`);\n }\n\n const requireFromProject = createRequire(projectPackageJsonPath);\n let pkgJsonPath: string;\n try {\n pkgJsonPath = requireFromProject.resolve(`${packageName}/package.json`);\n } catch {\n throw new Error(\n `Missing optional dependency \\`${packageName}\\`. Install it in your project (e.g. \\`${installHint}\\`).`,\n );\n }\n\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, \"utf8\")) as CliPackageJson;\n const binRelativePath = pkgJson.bin?.[binName];\n if (!binRelativePath) {\n throw new Error(`\\`${packageName}\\` does not expose a \\`${binName}\\` binary entry.`);\n }\n\n return path.resolve(path.dirname(pkgJsonPath), binRelativePath);\n}\n","import * as fs from \"node:fs\";\nimport { Code, ConnectError } from \"@connectrpc/connect\";\nimport * as path from \"pathe\";\nimport { fetchAll } from \"../../client\";\nimport { logger } from \"../../utils/logger\";\nimport type {\n TblsColumn,\n TblsConstraint,\n TblsEnum,\n TblsRelation,\n TblsSchema,\n TblsTable,\n} from \"./types\";\nimport type { OperatorClient } from \"../../client\";\nimport type {\n TailorDBType as TailorDBProtoType,\n TailorDBType_FieldConfig,\n} from \"@tailor-proto/tailor/v1/tailordb_resource_pb\";\n\nexport interface TailorDBSchemaOptions {\n workspaceId: string;\n namespace: string;\n client: OperatorClient;\n}\n\n/**\n * Convert TailorDB field config to tbls column definition.\n * @param fieldName - Field name\n * @param fieldConfig - TailorDB field configuration\n * @returns tbls column definition\n */\nfunction toTblsColumn(fieldName: string, fieldConfig: TailorDBType_FieldConfig): TblsColumn {\n const baseType = fieldConfig.type || \"string\";\n const type = fieldConfig.array ? `${baseType}[]` : baseType;\n\n return {\n name: fieldName,\n type,\n nullable: !fieldConfig.required,\n comment: fieldConfig.description ?? \"\",\n };\n}\n\n/**\n * Build tbls schema JSON from TailorDB types.\n * @param types - TailorDB types fetched from platform\n * @param namespace - TailorDB namespace\n * @returns tbls-compatible schema representation\n */\nfunction buildTblsSchema(types: TailorDBProtoType[], namespace: string): TblsSchema {\n const tables: TblsTable[] = [];\n const relations: TblsRelation[] = [];\n const referencedByTable: Record<string, Set<string>> = {};\n const constraintsByTable: Record<string, TblsConstraint[]> = {};\n const enumsMap: Map<string, Set<string>> = new Map();\n\n for (const type of types) {\n const tableName = type.name;\n const schema = type.schema;\n\n const columns: TblsColumn[] = [];\n const tableConstraints: TblsConstraint[] = [];\n\n // Implicit primary key column\n columns.push({\n name: \"id\",\n type: \"uuid\",\n nullable: false,\n comment: \"\",\n });\n\n tableConstraints.push({\n name: `pk_${tableName}`,\n type: \"PRIMARY KEY\",\n def: \"\",\n table: tableName,\n columns: [\"id\"],\n });\n\n if (schema) {\n // Fields -> columns\n for (const [fieldName, fieldConfig] of Object.entries(schema.fields ?? {})) {\n columns.push(toTblsColumn(fieldName, fieldConfig));\n\n // Collect enum values\n if (fieldConfig.type === \"enum\" && fieldConfig.allowedValues.length > 0) {\n const enumName = `${tableName}_${fieldName}`;\n let values = enumsMap.get(enumName);\n if (!values) {\n values = new Set<string>();\n enumsMap.set(enumName, values);\n }\n for (const value of fieldConfig.allowedValues) {\n values.add(value.value);\n }\n }\n\n // Foreign key -> relation + constraint\n if (fieldConfig.foreignKey && fieldConfig.foreignKeyType) {\n const foreignTable = fieldConfig.foreignKeyType;\n const foreignColumn = fieldConfig.foreignKeyField || \"id\";\n\n // Cardinality:\n // - child side: exactly_one if non-nullable, zero_or_one if nullable FK\n // - parent side: zero_or_more (a parent can have many children)\n const childCardinality = fieldConfig.required ? \"exactly_one\" : \"zero_or_one\";\n const parentCardinality = \"zero_or_more\";\n\n // tbls RelationJSON:\n // - table/columns: child side (FK owner)\n // - parent_table/parent_columns: referenced side\n relations.push({\n table: tableName,\n columns: [fieldName],\n parent_table: foreignTable,\n parent_columns: [foreignColumn],\n cardinality: childCardinality,\n parent_cardinality: parentCardinality,\n def: \"\",\n });\n\n tableConstraints.push({\n name: `fk_${tableName}_${fieldName}`,\n type: \"FOREIGN KEY\",\n def: \"\",\n table: tableName,\n columns: [fieldName],\n referenced_table: foreignTable,\n referenced_columns: [foreignColumn],\n });\n\n if (!referencedByTable[tableName]) {\n referencedByTable[tableName] = new Set<string>();\n }\n referencedByTable[tableName].add(foreignTable);\n }\n }\n }\n\n constraintsByTable[tableName] = tableConstraints;\n\n tables.push({\n name: tableName,\n type: \"table\",\n comment: schema?.description ?? \"\",\n columns,\n indexes: [],\n constraints: constraintsByTable[tableName] ?? [],\n triggers: [],\n def: \"\",\n referenced_tables: [],\n });\n }\n\n // Populate referenced_tables from collected relations\n for (const table of tables) {\n const referenced = referencedByTable[table.name];\n table.referenced_tables = referenced ? Array.from(referenced) : [];\n }\n\n const enums: TblsEnum[] = [];\n for (const [name, values] of enumsMap.entries()) {\n enums.push({\n name,\n values: Array.from(values),\n });\n }\n\n return {\n name: namespace,\n tables,\n relations,\n enums,\n };\n}\n\n/**\n * Export apply-applied TailorDB schema for a namespace as tbls-compatible JSON.\n * @param options - Export options\n * @returns tbls schema representation\n */\nasync function exportTailorDBSchema(options: TailorDBSchemaOptions): Promise<TblsSchema> {\n const { client, workspaceId, namespace } = options;\n\n const types = await fetchAll(async (pageToken) => {\n try {\n const { tailordbTypes, nextPageToken } = await client.listTailorDBTypes({\n workspaceId,\n namespaceName: namespace,\n pageToken,\n });\n return [tailordbTypes, nextPageToken];\n } catch (error) {\n if (error instanceof ConnectError && error.code === Code.NotFound) {\n return [[], \"\"];\n }\n throw error;\n }\n });\n\n if (types.length === 0) {\n logger.warn(`No TailorDB types found in namespace \"${namespace}\". Returning empty schema.`);\n }\n\n return buildTblsSchema(types, namespace);\n}\n\nexport interface WriteSchemaOptions extends TailorDBSchemaOptions {\n outputPath: string;\n}\n\n/**\n * Writes the TailorDB schema to a file in tbls-compatible JSON format.\n * @param options - The options for writing the schema file.\n */\nexport async function writeTblsSchemaToFile(options: WriteSchemaOptions): Promise<void> {\n const schema = await exportTailorDBSchema(options);\n const json = JSON.stringify(schema, null, 2);\n\n fs.mkdirSync(path.dirname(options.outputPath), { recursive: true });\n fs.writeFileSync(options.outputPath, json, \"utf8\");\n\n const relativePath = path.relative(process.cwd(), options.outputPath);\n logger.success(`Wrote ERD schema to ${relativePath}`);\n}\n","import { logger } from \"./logger\";\n\n/**\n * Warn that the ERD CLI is a beta feature.\n */\nexport function logErdBetaWarning(): void {\n logger.warn(\n \"The ERD command is a beta feature and may introduce breaking changes in future releases.\",\n );\n logger.newline();\n}\n","import { initOperatorClient } from \"../../client\";\nimport { loadConfig } from \"../../config-loader\";\nimport { loadAccessToken, loadWorkspaceId } from \"../../context\";\nimport { logErdBetaWarning } from \"../../utils/beta\";\nimport type { OperatorClient } from \"../../client\";\nimport type { AppConfig } from \"@/configure/config\";\n\nexport interface ErdCommandContext {\n client: OperatorClient;\n workspaceId: string;\n config: AppConfig;\n}\n\ntype ErdCommandOptions = {\n profile?: string;\n workspaceId?: string;\n config?: string;\n};\n\n/**\n * Initialize shared ERD command context.\n * @param args - CLI arguments.\n * @returns Initialized context.\n */\nexport async function initErdContext(args: ErdCommandOptions): Promise<ErdCommandContext> {\n logErdBetaWarning();\n const accessToken = await loadAccessToken({\n useProfile: true,\n profile: args.profile,\n });\n const client = await initOperatorClient(accessToken);\n const workspaceId = loadWorkspaceId({\n workspaceId: args.workspaceId,\n profile: args.profile,\n });\n const { config } = await loadConfig(args.config);\n\n return { client, workspaceId, config };\n}\n","import { spawn } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport { defineCommand } from \"citty\";\nimport * as path from \"pathe\";\nimport { commonArgs, deploymentArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { logger } from \"../../utils/logger\";\nimport { resolveCliBinPath } from \"../../utils/resolve-cli-bin\";\nimport { writeTblsSchemaToFile } from \"./schema\";\nimport { initErdContext } from \"./utils\";\nimport type { TailorDBSchemaOptions } from \"./schema\";\nimport type { OperatorClient } from \"../../client\";\nimport type { AppConfig } from \"@/configure/config\";\n\nconst DEFAULT_ERD_BASE_DIR = \".tailor-sdk/erd\";\n\n/**\n * Resolve TailorDB config and namespace.\n * @param config - Loaded Tailor SDK config.\n * @param explicitNamespace - Namespace override.\n * @returns Resolved namespace and erdSite.\n */\nfunction resolveDbConfig(\n config: AppConfig,\n explicitNamespace?: string,\n): { namespace: string; erdSite: string | undefined } {\n const namespace = explicitNamespace ?? Object.keys(config.db ?? {})[0];\n\n if (!namespace) {\n throw new Error(\n \"No TailorDB namespaces found in config. Please define db services in tailor.config.ts or pass --namespace.\",\n );\n }\n\n const dbConfig = config.db?.[namespace];\n\n if (!dbConfig || typeof dbConfig !== \"object\" || \"external\" in dbConfig) {\n throw new Error(`TailorDB namespace \"${namespace}\" not found in config.db.`);\n }\n\n return { namespace, erdSite: dbConfig.erdSite };\n}\n\n/**\n * Get all namespaces with erdSite configured.\n * @param config - Loaded Tailor SDK config.\n * @returns Namespaces with erdSite.\n */\nfunction resolveAllErdSites(config: AppConfig): Array<{ namespace: string; erdSite: string }> {\n const results: Array<{ namespace: string; erdSite: string }> = [];\n\n for (const [namespace, dbConfig] of Object.entries(config.db ?? {})) {\n if (dbConfig && typeof dbConfig === \"object\" && !(\"external\" in dbConfig) && dbConfig.erdSite) {\n results.push({ namespace, erdSite: dbConfig.erdSite });\n }\n }\n\n return results;\n}\n\n/**\n * Run the liam CLI to build an ERD static site from a schema file.\n * @param schemaPath - Path to the ERD schema JSON file\n * @param cwd - Working directory where liam will run (dist is created here)\n * @returns Resolves when the build completes successfully\n */\nasync function runLiamBuild(schemaPath: string, cwd: string): Promise<void> {\n fs.mkdirSync(cwd, { recursive: true });\n\n return await new Promise<void>((resolve, reject) => {\n let liamBinPath: string;\n try {\n liamBinPath = resolveCliBinPath({\n cwd,\n packageName: \"@liam-hq/cli\",\n binName: \"liam\",\n installHint: \"npm i -D @liam-hq/cli\",\n });\n } catch (error) {\n logger.error(String(error));\n reject(error);\n return;\n }\n\n const child = spawn(\n process.execPath,\n [liamBinPath, \"erd\", \"build\", \"--format\", \"tbls\", \"--input\", schemaPath],\n {\n stdio: \"inherit\",\n cwd,\n },\n );\n\n child.on(\"error\", (error) => {\n logger.error(\"Failed to run `@liam-hq/cli`. Ensure it is installed in your project.\");\n reject(error);\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n logger.error(\n \"liam CLI exited with a non-zero code. Ensure `@liam-hq/cli erd build --format tbls --input schema.json` works in your project.\",\n );\n reject(new Error(`liam CLI exited with code ${code ?? 1}`));\n }\n });\n });\n}\n\ntype ErdBuildOptions = TailorDBSchemaOptions & {\n outputPath: string;\n erdDir: string;\n};\n\ntype ErdBuildsOptions = {\n client: OperatorClient;\n workspaceId: string;\n config: AppConfig;\n namespace?: string;\n outputDir?: string;\n};\n\n/**\n * Export TailorDB schema and build ERD artifacts via liam.\n * @param options - Build options.\n */\nasync function prepareErdBuild(options: ErdBuildOptions): Promise<void> {\n await writeTblsSchemaToFile(options);\n\n await runLiamBuild(options.outputPath, options.erdDir);\n}\n\nexport interface ErdBuildResult {\n namespace: string;\n erdSite?: string;\n schemaOutputPath: string;\n distDir: string;\n erdDir: string;\n}\n\n/**\n * Prepare ERD builds for one or more namespaces.\n * @param options - Build options.\n * @returns Build results by namespace.\n */\nexport async function prepareErdBuilds(options: ErdBuildsOptions): Promise<ErdBuildResult[]> {\n const { client, workspaceId, config } = options;\n const baseDir = options.outputDir ?? path.resolve(process.cwd(), DEFAULT_ERD_BASE_DIR);\n let targets: ErdBuildResult[];\n\n if (options.namespace) {\n const { namespace, erdSite } = resolveDbConfig(config, options.namespace);\n const erdDir = path.join(baseDir, namespace);\n targets = [\n {\n namespace,\n erdSite,\n schemaOutputPath: path.join(erdDir, \"schema.json\"),\n distDir: path.join(erdDir, \"dist\"),\n erdDir,\n },\n ];\n } else {\n const erdSites = resolveAllErdSites(config);\n if (erdSites.length === 0) {\n throw new Error(\n \"No namespaces with erdSite configured found. \" +\n 'Add erdSite: \"<static-website-name>\" to db.<namespace> in tailor.config.ts.',\n );\n }\n logger.info(`Found ${erdSites.length} namespace(s) with erdSite configured.`);\n targets = erdSites.map(({ namespace, erdSite }) => {\n const erdDir = path.join(baseDir, namespace);\n return {\n namespace,\n erdSite,\n schemaOutputPath: path.join(erdDir, \"schema.json\"),\n distDir: path.join(erdDir, \"dist\"),\n erdDir,\n };\n });\n }\n\n await Promise.all(\n targets.map((target) =>\n prepareErdBuild({\n namespace: target.namespace,\n client,\n workspaceId,\n outputPath: target.schemaOutputPath,\n erdDir: target.erdDir,\n }),\n ),\n );\n\n return targets;\n}\n\nexport const erdExportCommand = defineCommand({\n meta: {\n name: \"export\",\n description: \"Export Liam ERD dist from applied TailorDB schema (beta)\",\n },\n args: {\n ...commonArgs,\n ...deploymentArgs,\n ...jsonArgs,\n namespace: {\n type: \"string\",\n description: \"TailorDB namespace name (optional if only one namespace is defined in config)\",\n alias: \"n\",\n },\n output: {\n type: \"string\",\n description:\n \"Output directory path for tbls-compatible ERD JSON (writes to <outputDir>/<namespace>/schema.json)\",\n alias: \"o\",\n default: DEFAULT_ERD_BASE_DIR,\n },\n },\n run: withCommonArgs(async (args) => {\n const { client, workspaceId, config } = await initErdContext(args);\n const outputDir = path.resolve(process.cwd(), String(args.output));\n\n const results = await prepareErdBuilds({\n client,\n workspaceId,\n config,\n namespace: args.namespace,\n outputDir,\n });\n\n if (args.json) {\n logger.out(\n results.map((result) => ({\n namespace: result.namespace,\n distDir: result.distDir,\n schemaOutputPath: result.schemaOutputPath,\n })),\n );\n } else {\n for (const result of results) {\n logger.out(`Exported ERD for namespace \"${result.namespace}\"`);\n logger.out(` - Liam ERD dist: ${result.distDir}`);\n logger.out(` - tbls schema.json: ${result.schemaOutputPath}`);\n }\n }\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { commonArgs, deploymentArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { deployStaticWebsite, logSkippedFiles } from \"../../staticwebsite/deploy\";\nimport { logger } from \"../../utils/logger\";\nimport { prepareErdBuilds } from \"./export\";\nimport { initErdContext } from \"./utils\";\n\nexport const erdDeployCommand = defineCommand({\n meta: {\n name: \"deploy\",\n description: \"Deploy ERD static website for TailorDB namespace(s) (beta)\",\n },\n args: {\n ...commonArgs,\n ...deploymentArgs,\n ...jsonArgs,\n namespace: {\n type: \"string\",\n description:\n \"TailorDB namespace name (optional - deploys all namespaces with erdSite if omitted)\",\n alias: \"n\",\n },\n },\n run: withCommonArgs(async (args) => {\n const { client, workspaceId, config } = await initErdContext(args);\n const buildResults = await prepareErdBuilds({\n client,\n workspaceId,\n config,\n namespace: args.namespace,\n });\n\n const deployResults = await Promise.all(\n buildResults.map(async (result) => {\n if (!result.erdSite) {\n throw new Error(\n `No erdSite configured for namespace \"${result.namespace}\". ` +\n `Add erdSite: \"<static-website-name>\" to db.${result.namespace} in tailor.config.ts.`,\n );\n }\n\n if (!args.json) {\n logger.info(\n `Deploying ERD for namespace \"${result.namespace}\" to site \"${result.erdSite}\"...`,\n );\n }\n\n const { url, skippedFiles } = await deployStaticWebsite(\n client,\n workspaceId,\n result.erdSite,\n result.distDir,\n !args.json,\n );\n\n return {\n namespace: result.namespace,\n erdSite: result.erdSite,\n url,\n skippedFiles,\n };\n }),\n );\n\n if (args.json) {\n logger.out(deployResults);\n } else {\n for (const result of deployResults) {\n logger.success(`ERD site \"${result.erdSite}\" deployed successfully.`);\n logger.out(result.url);\n logSkippedFiles(result.skippedFiles);\n }\n }\n }),\n});\n","import { spawn } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport { defineCommand } from \"citty\";\nimport { commonArgs, deploymentArgs, withCommonArgs } from \"../../args\";\nimport { logger } from \"../../utils/logger\";\nimport { resolveCliBinPath } from \"../../utils/resolve-cli-bin\";\nimport { prepareErdBuilds, type ErdBuildResult } from \"./export\";\nimport { initErdContext } from \"./utils\";\n\nfunction formatServeCommand(namespace: string): string {\n return `tailor-sdk tailordb erd serve --namespace ${namespace}`;\n}\n\nasync function runServeDist(results: ErdBuildResult[]): Promise<void> {\n if (results.length === 0) {\n throw new Error(\"No ERD build results found.\");\n }\n\n const [primary, ...rest] = results;\n\n logger.info(`Serving ERD for namespace \"${primary.namespace}\".`);\n if (rest.length > 0) {\n const commands = rest.map((result) => ` - ${formatServeCommand(result.namespace)}`).join(\"\\n\");\n logger.warn(`Multiple namespaces found. To serve another namespace, run:\\n${commands}`);\n }\n\n fs.mkdirSync(primary.erdDir, { recursive: true });\n\n return await new Promise<void>((resolve, reject) => {\n let serveBinPath: string;\n try {\n serveBinPath = resolveCliBinPath({\n cwd: primary.erdDir,\n packageName: \"serve\",\n binName: \"serve\",\n installHint: \"npm i -D serve\",\n });\n } catch (error) {\n logger.error(String(error));\n reject(error);\n return;\n }\n\n const child = spawn(process.execPath, [serveBinPath, \"dist\"], {\n stdio: \"inherit\",\n cwd: primary.erdDir,\n });\n\n child.on(\"error\", (error) => {\n logger.error(\"Failed to run `serve dist`. Ensure `serve` is installed in your project.\");\n reject(error);\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n } else {\n logger.error(\n \"serve CLI exited with a non-zero code. Ensure `serve dist` works in your project.\",\n );\n reject(new Error(`serve CLI exited with code ${code ?? 1}`));\n }\n });\n });\n}\n\nexport const erdServeCommand = defineCommand({\n meta: {\n name: \"serve\",\n description: \"Generate and serve ERD (liam build + `serve dist`) (beta)\",\n },\n args: {\n ...commonArgs,\n ...deploymentArgs,\n namespace: {\n type: \"string\",\n description: \"TailorDB namespace name (uses first namespace in config if not specified)\",\n alias: \"n\",\n },\n },\n run: withCommonArgs(async (args) => {\n const { client, workspaceId, config } = await initErdContext(args);\n\n const results = await prepareErdBuilds({\n client,\n workspaceId,\n config,\n namespace: args.namespace,\n });\n\n await runServeDist(results);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport { erdDeployCommand } from \"./deploy\";\nimport { erdExportCommand } from \"./export\";\nimport { erdServeCommand } from \"./serve\";\n\nexport const erdCommand = defineCommand({\n meta: {\n name: \"erd\",\n description: \"ERD utilities for TailorDB (beta)\",\n },\n subCommands: {\n export: erdExportCommand,\n serve: erdServeCommand,\n deploy: erdDeployCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport { erdCommand } from \"./erd\";\nimport { truncateCommand } from \"./truncate\";\n\nexport const tailordbCommand = defineCommand({\n meta: {\n name: \"tailordb\",\n description: \"Manage TailorDB tables and data\",\n },\n subCommands: {\n erd: erdCommand,\n truncate: truncateCommand,\n },\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const currentCommand = defineCommand({\n meta: {\n name: \"current\",\n description: \"Show current user\",\n },\n args: commonArgs,\n run: withCommonArgs(async () => {\n const config = readPlatformConfig();\n\n // Check if current user is set\n if (!config.current_user) {\n throw new Error(ml`\n Current user not set.\n Please login first using 'tailor-sdk login' command to register a user.\n `);\n }\n\n // Check if user exists\n if (!config.users[config.current_user]) {\n throw new Error(ml`\n Current user '${config.current_user}' not found in registered users.\n Please login again using 'tailor-sdk login' command to register the user.\n `);\n }\n\n logger.log(config.current_user);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List all users\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n const users = Object.keys(config.users);\n if (users.length === 0) {\n logger.info(ml`\n No users found.\n Please login first using 'tailor-sdk login' command to register a user.\n `);\n return;\n }\n\n if (args.json) {\n logger.out(users);\n return;\n }\n\n users.forEach((user) => {\n if (user === config.current_user) {\n logger.success(`${user} (current)`, { mode: \"plain\" });\n } else {\n logger.log(user);\n }\n });\n }),\n});\n","import { PATScope } from \"@tailor-proto/tailor/v1/auth_resource_pb\";\nimport ml from \"multiline-ts\";\nimport { logger } from \"../../utils/logger\";\nimport type { PersonalAccessToken } from \"@tailor-proto/tailor/v1/auth_resource_pb\";\n\nexport interface PersonalAccessTokenInfo {\n name: string;\n scopes: string[];\n}\n\nfunction patScopeToString(scope: PATScope): string {\n switch (scope) {\n case PATScope.PAT_SCOPE_READ:\n return \"read\";\n case PATScope.PAT_SCOPE_WRITE:\n return \"write\";\n default:\n return \"unknown\";\n }\n}\n\n/**\n * Transform a PersonalAccessToken into CLI-friendly info.\n * @param pat - Personal access token resource\n * @returns Flattened token info\n */\nexport function transformPersonalAccessToken(pat: PersonalAccessToken): PersonalAccessTokenInfo {\n return {\n name: pat.name,\n scopes: pat.scopes.map(patScopeToString),\n };\n}\n\n/**\n * Get PAT scopes from a write flag.\n * @param write - Whether write access is required\n * @returns Scopes to apply to the token\n */\nexport function getScopesFromWriteFlag(write: boolean): PATScope[] {\n return write ? [PATScope.PAT_SCOPE_READ, PATScope.PAT_SCOPE_WRITE] : [PATScope.PAT_SCOPE_READ];\n}\n\nfunction getScopeStringsFromWriteFlag(write: boolean): string[] {\n return write ? [\"read\", \"write\"] : [\"read\"];\n}\n\n/**\n * Print the created or updated personal access token to the logger.\n * @param name - Token name\n * @param token - Token value\n * @param write - Whether the token has write scope\n * @param action - Action performed\n */\nexport function printCreatedToken(\n name: string,\n token: string,\n write: boolean,\n action: \"created\" | \"updated\",\n): void {\n const scopes = getScopeStringsFromWriteFlag(write);\n\n if (logger.jsonMode) {\n logger.out({ name, scopes, token });\n } else {\n logger.log(ml`\n Personal access token ${action} successfully.\n\n name: ${name}\n scopes: ${scopes.join(\"/\")}\n token: ${token}\n\n Please save this token in a secure location. You won't be able to see it again.\n `);\n }\n}\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { getScopesFromWriteFlag, printCreatedToken } from \"./transform\";\n\nexport const createCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create new personal access token\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Token name\",\n required: true,\n },\n write: {\n type: \"boolean\",\n description: \"Grant write permission (default: read-only)\",\n alias: \"W\",\n default: false,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n const scopes = getScopesFromWriteFlag(args.write);\n const result = await client.createPersonalAccessToken({\n name: args.name,\n scopes,\n });\n\n if (!result.accessToken) {\n throw new Error(\"Failed to create personal access token\");\n }\n\n printCreatedToken(args.name, result.accessToken, args.write, \"created\");\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, withCommonArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\n\nexport const deleteCommand = defineCommand({\n meta: {\n name: \"delete\",\n description: \"Delete personal access token\",\n },\n args: {\n ...commonArgs,\n name: {\n type: \"positional\",\n description: \"Token name\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n await client.deletePersonalAccessToken({\n name: args.name,\n });\n\n logger.success(`Personal access token \"${args.name}\" deleted successfully.`);\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { fetchAll, initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { logger } from \"../../utils/logger\";\nimport { transformPersonalAccessToken, type PersonalAccessTokenInfo } from \"./transform\";\n\nexport const listCommand = defineCommand({\n meta: {\n name: \"list\",\n description: \"List all personal access tokens\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n const pats = await fetchAll(async (pageToken) => {\n const { personalAccessTokens, nextPageToken } = await client.listPersonalAccessTokens({\n pageToken,\n });\n return [personalAccessTokens, nextPageToken];\n });\n\n if (pats.length === 0) {\n logger.info(ml`\n No personal access tokens found.\n Please create a token using 'tailor-sdk user pat create' command.\n `);\n return;\n }\n\n if (args.json) {\n // JSON format with scopes as array\n const patInfos: PersonalAccessTokenInfo[] = pats.map(transformPersonalAccessToken);\n logger.out(patInfos);\n return;\n }\n\n // Text format: aligned list \"name: scope1/scope2\"\n const maxNameLength = Math.max(...pats.map((pat) => pat.name.length));\n\n pats.forEach((pat) => {\n const info = transformPersonalAccessToken(pat);\n const paddedName = info.name.padStart(maxNameLength);\n logger.log(`${paddedName}: ${info.scopes.join(\"/\")}`);\n });\n }),\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, jsonArgs, withCommonArgs } from \"../../args\";\nimport { initOperatorClient } from \"../../client\";\nimport { fetchLatestToken, readPlatformConfig } from \"../../context\";\nimport { getScopesFromWriteFlag, printCreatedToken } from \"./transform\";\n\nexport const updateCommand = defineCommand({\n meta: {\n name: \"update\",\n description: \"Update personal access token (delete and recreate)\",\n },\n args: {\n ...commonArgs,\n ...jsonArgs,\n name: {\n type: \"positional\",\n description: \"Token name\",\n required: true,\n },\n write: {\n type: \"boolean\",\n description: \"Grant write permission (if not specified, keeps read-only)\",\n alias: \"W\",\n default: false,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n if (!config.current_user) {\n throw new Error(ml`\n No user logged in.\n Please login first using 'tailor-sdk login' command.\n `);\n }\n\n const token = await fetchLatestToken(config, config.current_user);\n const client = await initOperatorClient(token);\n\n // Delete the existing token\n await client.deletePersonalAccessToken({\n name: args.name,\n });\n\n // Create a new token with the same name\n const scopes = getScopesFromWriteFlag(args.write);\n const result = await client.createPersonalAccessToken({\n name: args.name,\n scopes,\n });\n\n if (!result.accessToken) {\n throw new Error(\"Failed to create personal access token\");\n }\n\n printCreatedToken(args.name, result.accessToken, args.write, \"updated\");\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\nimport { updateCommand } from \"./update\";\n\nexport const patCommand = defineCommand({\n meta: {\n name: \"pat\",\n description: \"Manage personal access tokens\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n update: updateCommand,\n },\n async run(context) {\n // Default to list when no subcommand is provided\n await runCommand(listCommand, {\n rawArgs: context.rawArgs || [],\n });\n },\n});\n","import { defineCommand } from \"citty\";\nimport ml from \"multiline-ts\";\nimport { commonArgs, withCommonArgs } from \"../args\";\nimport { readPlatformConfig, writePlatformConfig } from \"../context\";\nimport { logger } from \"../utils/logger\";\n\nexport const switchCommand = defineCommand({\n meta: {\n name: \"switch\",\n description: \"Set current user\",\n },\n args: {\n ...commonArgs,\n user: {\n type: \"positional\",\n description: \"User email\",\n required: true,\n },\n },\n run: withCommonArgs(async (args) => {\n const config = readPlatformConfig();\n\n // Check if user exists\n if (!config.users[args.user]) {\n throw new Error(ml`\n User \"${args.user}\" not found.\n Please login first using 'tailor-sdk login' command to register this user.\n `);\n }\n\n // Set current user\n config.current_user = args.user;\n writePlatformConfig(config);\n\n logger.success(`Current user set to \"${args.user}\" successfully.`);\n }),\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { currentCommand } from \"./current\";\nimport { listCommand } from \"./list\";\nimport { patCommand } from \"./pat\";\nimport { switchCommand } from \"./switch\";\n\nexport const userCommand = defineCommand({\n meta: {\n name: \"user\",\n description: \"Manage Tailor Platform users\",\n },\n subCommands: {\n current: currentCommand,\n list: listCommand,\n pat: patCommand,\n switch: switchCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { executionsCommand } from \"./executions\";\nimport { getCommand } from \"./get\";\nimport { listCommand } from \"./list\";\nimport { resumeCommand } from \"./resume\";\nimport { startCommand } from \"./start\";\n\nexport const workflowCommand = defineCommand({\n meta: {\n name: \"workflow\",\n description: \"Manage workflows\",\n },\n subCommands: {\n list: listCommand,\n get: getCommand,\n start: startCommand,\n executions: executionsCommand,\n resume: resumeCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","import { defineCommand, runCommand } from \"citty\";\nimport { createCommand } from \"./create\";\nimport { deleteCommand } from \"./delete\";\nimport { listCommand } from \"./list\";\n\nexport const workspaceCommand = defineCommand({\n meta: {\n name: \"workspace\",\n description: \"Manage Tailor Platform workspaces\",\n },\n subCommands: {\n create: createCommand,\n delete: deleteCommand,\n list: listCommand,\n },\n async run() {\n await runCommand(listCommand, { rawArgs: [] });\n },\n});\n","#!/usr/bin/env node\n\nimport { register } from \"node:module\";\nimport { defineCommand, runMain } from \"citty\";\nimport { apiCommand } from \"./api\";\nimport { applyCommand } from \"./apply\";\nimport { generateCommand } from \"./generator\";\nimport { initCommand } from \"./init\";\nimport { loginCommand } from \"./login\";\nimport { logoutCommand } from \"./logout\";\nimport { machineuserCommand } from \"./machineuser\";\nimport { oauth2clientCommand } from \"./oauth2client\";\nimport { profileCommand } from \"./profile\";\nimport { removeCommand } from \"./remove\";\nimport { secretCommand } from \"./secret\";\nimport { showCommand } from \"./show\";\nimport { staticwebsiteCommand } from \"./staticwebsite\";\nimport { tailordbCommand } from \"./tailordb\";\nimport { userCommand } from \"./user\";\nimport { readPackageJson } from \"./utils/package-json\";\nimport { workflowCommand } from \"./workflow\";\nimport { workspaceCommand } from \"./workspace\";\n\nregister(\"tsx\", import.meta.url, { data: {} });\n\nconst packageJson = await readPackageJson();\n\nexport const mainCommand = defineCommand({\n meta: {\n name: Object.keys(packageJson.bin ?? {})[0] || \"tailor-sdk\",\n version: packageJson.version,\n description:\n packageJson.description || \"Tailor CLI for managing Tailor Platform SDK applications\",\n },\n subCommands: {\n api: apiCommand,\n apply: applyCommand,\n generate: generateCommand,\n init: initCommand,\n login: loginCommand,\n logout: logoutCommand,\n machineuser: machineuserCommand,\n oauth2client: oauth2clientCommand,\n profile: profileCommand,\n remove: removeCommand,\n secret: secretCommand,\n show: showCommand,\n staticwebsite: staticwebsiteCommand,\n tailordb: tailordbCommand,\n user: userCommand,\n workflow: workflowCommand,\n workspace: workspaceCommand,\n },\n});\n\nrunMain(mainCommand);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,6BAA6B;CACjC,MAAM,eAAe;EAAC;EAAO;EAAQ;EAAO;CAC5C,MAAM,YAAY,QAAQ,IAAI;AAC9B,KAAI,CAAC,UAAW;CAChB,MAAM,CAAC,QAAQ,UAAU,MAAM,IAAI;AACnC,KAAI,CAAC,aAAa,SAAS,KAAK,CAAE;AAClC,QAAO;;AAGT,MAAa,cAAc,cAAc;CACvC,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,GAAG;EACH,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;GACX;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,UAAU;GACV,OAAO;GACR;EACF;CACD,KAAK,eAAe,OAAO,SAAS;EAClC,MAAMA,gBAAc,MAAM,iBAAiB;EAC3C,MAAM,UACJA,cAAY,WAAWA,cAAY,YAAY,UAAUA,cAAY,UAAU;EAEjF,IAAI,iBAAiB,sBAAsB;A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