@atollhq/cli 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/dist/index.js +652 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/config.ts","../src/index.ts","../src/commands/auth.ts","../src/lib/client.ts","../src/lib/output.ts","../src/commands/issue.ts","../src/lib/colors.ts","../src/lib/urls.ts","../src/commands/comment.ts","../src/commands/project.ts","../src/commands/milestone.ts","../src/commands/config.ts","../src/commands/webhook.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\n\nexport interface AtollConfig {\n apiKey?: string;\n orgSlug?: string;\n defaultTeam?: string;\n baseUrl?: string;\n activeProfile?: string;\n profiles?: Record<string, AtollProfile>;\n}\n\nexport interface AtollProfile {\n apiKey?: string;\n orgSlug?: string;\n defaultTeam?: string;\n baseUrl?: string;\n}\n\nexport interface ResolvedConfig extends AtollProfile {\n profile?: string;\n}\n\nconst CONFIG_DIR = join(homedir(), '.atoll');\nconst CONFIG_PATH = join(CONFIG_DIR, 'config.json');\n\nexport function readConfig(): AtollConfig {\n if (!existsSync(CONFIG_PATH)) return {};\n try {\n return JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));\n } catch {\n return {};\n }\n}\n\nexport function writeConfig(config: AtollConfig): void {\n if (!existsSync(CONFIG_DIR)) {\n mkdirSync(CONFIG_DIR, { recursive: true });\n }\n writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n}\n\nexport function deleteConfig(): void {\n if (existsSync(CONFIG_PATH)) {\n unlinkSync(CONFIG_PATH);\n }\n}\n\nexport function getActiveProfile(config = readConfig()): string | undefined {\n return process.env.ATOLL_PROFILE || config.activeProfile;\n}\n\nexport function getProfile(config: AtollConfig, profileName?: string): AtollProfile | undefined {\n if (!profileName) return undefined;\n return config.profiles?.[profileName];\n}\n\nexport function ensureProfile(config: AtollConfig, profileName: string): AtollProfile {\n config.profiles ??= {};\n config.profiles[profileName] ??= {};\n return config.profiles[profileName];\n}\n\nexport function resolveConfig(opts?: { profile?: string }): ResolvedConfig {\n const config = readConfig();\n const profileName = opts?.profile || getActiveProfile(config);\n const profile = getProfile(config, profileName);\n\n return {\n profile: profileName,\n apiKey: process.env.ATOLL_API_KEY || profile?.apiKey || (profileName ? undefined : config.apiKey),\n orgSlug: process.env.ATOLL_ORG || profile?.orgSlug || (profileName ? undefined : config.orgSlug),\n defaultTeam: process.env.ATOLL_TEAM || profile?.defaultTeam || (profileName ? undefined : config.defaultTeam),\n baseUrl: process.env.ATOLL_BASE_URL || profile?.baseUrl || (profileName ? undefined : config.baseUrl),\n };\n}\n\nexport function getApiKey(opts?: { profile?: string }): string | undefined {\n return resolveConfig(opts).apiKey;\n}\n","import { Command } from 'commander';\nimport { authCommand } from './commands/auth.js';\nimport { issueCommand } from './commands/issue.js';\nimport { commentCommand } from './commands/comment.js';\nimport { projectCommand } from './commands/project.js';\nimport { milestoneCommand } from './commands/milestone.js';\nimport { configCommand } from './commands/config.js';\nimport { webhookCommand } from './commands/webhook.js';\n\nconst program = new Command('atoll')\n .description('Atoll CLI — project management from the terminal')\n .version('0.1.0')\n .addHelpText('after', `\nExamples:\n $ atoll issue list\n $ atoll issue create --title \"Fix login bug\" --priority 1\n $ atoll issue view ATOLL-42\n $ atoll project list\n $ atoll milestone list --project <id>\n $ atoll config show`)\n // Global overrides — passed via env vars so sub-commands can pick them up\n .option('--profile <name>', 'Use a saved auth profile (env: ATOLL_PROFILE)')\n .option('--org <slug>', 'Override default org slug (env: ATOLL_ORG)')\n .option('--team <id>', 'Override default team slug/ID (env: ATOLL_TEAM)')\n .hook('preAction', (thisCommand) => {\n const opts = thisCommand.opts();\n if (opts.profile) {\n process.env.ATOLL_PROFILE = opts.profile;\n }\n if (opts.org) {\n process.env.ATOLL_ORG = opts.org;\n process.env.ATOLL_CLI_ORG = opts.org;\n }\n if (opts.team) {\n process.env.ATOLL_TEAM = opts.team;\n process.env.ATOLL_CLI_TEAM = opts.team;\n }\n });\n\nprogram.addCommand(authCommand);\nprogram.addCommand(issueCommand);\nprogram.addCommand(commentCommand);\nprogram.addCommand(projectCommand);\nprogram.addCommand(milestoneCommand);\nprogram.addCommand(configCommand);\nprogram.addCommand(webhookCommand);\n\n// ── atoll completion ────────────────────────────────────────────────────────\n\nconst completionCommand = new Command('completion')\n .description('Output shell completion scripts')\n .addHelpText('after', `\nExamples:\n $ atoll completion bash >> ~/.bashrc\n $ atoll completion zsh >> ~/.zshrc`);\n\ncompletionCommand\n .command('bash')\n .description('Output bash completion script')\n .action(() => {\n process.stdout.write(bashCompletion());\n });\n\ncompletionCommand\n .command('zsh')\n .description('Output zsh completion script')\n .action(() => {\n process.stdout.write(zshCompletion());\n });\n\nprogram.addCommand(completionCommand);\n\nprogram.parse();\n\n// ---------------------------------------------------------------------------\n// Completion script generators\n// ---------------------------------------------------------------------------\n\nfunction bashCompletion(): string {\n return `# Atoll CLI bash completion\n# Add to ~/.bashrc: source <(atoll completion bash)\n\n_atoll_completions() {\n local cur prev words cword\n _init_completion || return\n\n local commands=\"auth issue comment project milestone config webhook completion\"\n local issue_cmds=\"list view create update delete assign unassign\"\n local project_cmds=\"list create view\"\n local milestone_cmds=\"list create\"\n local config_cmds=\"show set-org set-team set-base-url\"\n local auth_cmds=\"login logout status profiles use\"\n local webhook_cmds=\"list create delete\"\n local completion_cmds=\"bash zsh\"\n\n if [ \"\\${COMP_CWORD}\" -eq 1 ]; then\n COMPREPLY=( $(compgen -W \"\\${commands}\" -- \"\\${cur}\") )\n return 0\n fi\n\n case \"\\${words[1]}\" in\n issue)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${issue_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n project)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${project_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n milestone)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${milestone_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n config)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${config_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n auth)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${auth_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n webhook)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${webhook_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n completion)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${completion_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n esac\n}\n\ncomplete -F _atoll_completions atoll\n`;\n}\n\nfunction zshCompletion(): string {\n return `#compdef atoll\n# Atoll CLI zsh completion\n# Add to ~/.zshrc: source <(atoll completion zsh)\n\n_atoll() {\n local state\n\n _arguments \\\\\n '1: :->command' \\\\\n '*: :->args'\n\n case \\$state in\n command)\n _values 'command' \\\\\n 'auth[Manage authentication]' \\\\\n 'issue[Manage issues]' \\\\\n 'comment[Manage comments]' \\\\\n 'project[Manage projects]' \\\\\n 'milestone[Manage milestones]' \\\\\n 'config[Manage CLI configuration]' \\\\\n 'webhook[Manage outbound webhooks]' \\\\\n 'completion[Output shell completion scripts]'\n ;;\n args)\n case \\$words[2] in\n issue)\n _values 'subcommand' \\\\\n 'list[List issues]' \\\\\n 'view[View issue details]' \\\\\n 'create[Create a new issue]' \\\\\n 'update[Update an issue]' \\\\\n 'delete[Delete an issue]' \\\\\n 'assign[Assign an issue]' \\\\\n 'unassign[Remove assignee]'\n ;;\n project)\n _values 'subcommand' \\\\\n 'list[List projects]' \\\\\n 'create[Create a project]' \\\\\n 'view[View project details]'\n ;;\n milestone)\n _values 'subcommand' \\\\\n 'list[List milestones]' \\\\\n 'create[Create a milestone]'\n ;;\n config)\n _values 'subcommand' \\\\\n 'show[Show configuration]' \\\\\n 'set-org[Set default org slug]' \\\\\n 'set-team[Set default team]' \\\\\n 'set-base-url[Set default API base URL]'\n ;;\n auth)\n _values 'subcommand' \\\\\n 'login[Log in]' \\\\\n 'logout[Log out]' \\\\\n 'status[Show auth status]' \\\\\n 'profiles[List auth profiles]' \\\\\n 'use[Set active auth profile]'\n ;;\n webhook)\n _values 'subcommand' \\\\\n 'list[List webhooks]' \\\\\n 'create[Create a webhook]' \\\\\n 'delete[Delete a webhook]'\n ;;\n completion)\n _values 'shell' 'bash' 'zsh'\n ;;\n esac\n ;;\n esac\n}\n\n_atoll \"\\$@\"\n`;\n}\n","import { Command } from 'commander';\nimport {\n ensureProfile,\n getProfile,\n readConfig,\n resolveConfig,\n writeConfig,\n} from '../lib/config.js';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\n\nexport const authCommand = new Command('auth')\n .description('Manage authentication');\n\nauthCommand\n .command('login')\n .description('Save an API key to ~/.atoll/config.json')\n .requiredOption('--key <API_KEY>', 'API key to store')\n .option('--profile <name>', 'Profile name to store this API key under')\n .option('--org <slug>', 'Default org slug for this profile')\n .option('--team <team>', 'Default team slug or ID for this profile')\n .option('--base-url <url>', 'Base URL for this profile')\n .action((opts: { key: string; profile?: string; org?: string; team?: string; baseUrl?: string }) => {\n const config = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || config.activeProfile;\n const orgSlug = opts.org ?? process.env.ATOLL_CLI_ORG;\n const defaultTeam = opts.team ?? process.env.ATOLL_CLI_TEAM;\n const baseUrl = opts.baseUrl;\n\n if (profileName) {\n const profile = ensureProfile(config, profileName);\n profile.apiKey = opts.key;\n if (orgSlug !== undefined) profile.orgSlug = orgSlug;\n if (defaultTeam !== undefined) profile.defaultTeam = defaultTeam;\n if (baseUrl !== undefined) profile.baseUrl = baseUrl;\n config.activeProfile = profileName;\n } else {\n config.apiKey = opts.key;\n if (orgSlug !== undefined) config.orgSlug = orgSlug;\n if (defaultTeam !== undefined) config.defaultTeam = defaultTeam;\n if (baseUrl !== undefined) config.baseUrl = baseUrl;\n }\n\n writeConfig(config);\n output(\n { status: 'ok', message: 'API key saved', profile: profileName ?? null },\n profileName\n ? `✓ API key saved to profile \"${profileName}\" in ~/.atoll/config.json`\n : '✓ API key saved to ~/.atoll/config.json',\n );\n });\n\nauthCommand\n .command('status')\n .description('Show current auth status and user info')\n .option('--profile <name>', 'Profile name to check')\n .action(async (opts: { profile?: string }) => {\n const resolved = resolveConfig({ profile: opts.profile });\n const apiKey = resolved.apiKey;\n if (!apiKey) {\n const suffix = resolved.profile ? ` for profile \"${resolved.profile}\"` : '';\n outputError(`Not authenticated${suffix}. Run \\`atoll auth login --key <API_KEY>\\` or set ATOLL_API_KEY.`);\n process.exit(1);\n }\n\n try {\n const client = new AtollClient({ apiKey, baseUrl: resolved.baseUrl, profile: opts.profile });\n const me = await client.get<{\n user?: { email?: string; name?: string };\n org?: { slug?: string; name?: string };\n }>('/api/auth/me');\n\n output(\n { status: 'authenticated', ...me },\n [\n '✓ Authenticated',\n resolved.profile ? ` Profile: ${resolved.profile}` : null,\n me.user?.name ? ` User: ${me.user.name}` : null,\n me.user?.email ? ` Email: ${me.user.email}` : null,\n me.org?.name ? ` Org: ${me.org.name} (${me.org.slug})` : null,\n ]\n .filter(Boolean)\n .join('\\n'),\n );\n } catch (err) {\n const msg = (err as Error).message || '';\n if (/API (401|403):/.test(msg)) {\n outputError('API key is invalid or expired');\n process.exit(1);\n }\n outputError(`Auth check failed: ${msg}`);\n process.exit(1);\n }\n });\n\nauthCommand\n .command('profiles')\n .description('List saved auth profiles')\n .action(() => {\n const config = readConfig();\n const activeProfile = config.activeProfile;\n const profiles = Object.entries(config.profiles ?? {})\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([name, profile]) => ({\n name,\n active: name === activeProfile,\n apiKeySet: !!profile.apiKey,\n orgSlug: profile.orgSlug ?? null,\n defaultTeam: profile.defaultTeam ?? null,\n baseUrl: profile.baseUrl ?? null,\n }));\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n output({ activeProfile: activeProfile ?? null, profiles }, '');\n return;\n }\n\n if (profiles.length === 0) {\n console.log('No profiles configured.');\n return;\n }\n\n for (const profile of profiles) {\n const marker = profile.active ? '*' : ' ';\n const parts = [\n `${marker} ${profile.name}`,\n profile.apiKeySet ? 'key=set' : 'key=not set',\n profile.orgSlug ? `org=${profile.orgSlug}` : null,\n profile.defaultTeam ? `team=${profile.defaultTeam}` : null,\n profile.baseUrl ? `baseUrl=${profile.baseUrl}` : null,\n ].filter(Boolean);\n console.log(parts.join(' '));\n }\n });\n\nauthCommand\n .command('use <profile>')\n .description('Set the active auth profile')\n .action((profileName: string) => {\n const config = readConfig();\n if (!getProfile(config, profileName)) {\n outputError(`Profile \"${profileName}\" not found. Run \\`atoll auth login --profile ${profileName} --key <API_KEY>\\` first.`);\n process.exit(1);\n }\n\n config.activeProfile = profileName;\n writeConfig(config);\n output(\n { activeProfile: profileName },\n `✓ Active profile set to \"${profileName}\"`,\n );\n });\n\nauthCommand\n .command('logout')\n .description('Remove stored API key')\n .option('--profile <name>', 'Profile name to log out')\n .action((opts: { profile?: string }) => {\n // Only clear the API key — preserve org/team config settings.\n const config = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || config.activeProfile;\n\n if (profileName) {\n const profile = getProfile(config, profileName);\n if (!profile) {\n outputError(`Profile \"${profileName}\" not found.`);\n process.exit(1);\n }\n delete profile.apiKey;\n } else {\n delete config.apiKey;\n }\n\n writeConfig(config);\n output(\n { status: 'ok', message: 'Logged out', profile: profileName ?? null },\n profileName\n ? `✓ Logged out of profile \"${profileName}\" — API key removed (org/team config preserved)`\n : '✓ Logged out — API key removed (org/team config preserved)',\n );\n });\n","import { resolveConfig } from './config.js';\nimport { outputError } from './output.js';\n\nconst DEFAULT_BASE_URL = 'https://atollhq.com';\n\nexport class AtollClient {\n readonly baseUrl: string;\n private apiKey: string;\n\n constructor(opts?: { baseUrl?: string; apiKey?: string; profile?: string }) {\n const config = resolveConfig({ profile: opts?.profile });\n this.baseUrl = opts?.baseUrl || config.baseUrl || DEFAULT_BASE_URL;\n\n const key = opts?.apiKey || config.apiKey;\n if (!key) {\n const suffix = config.profile ? ` for profile \"${config.profile}\"` : '';\n outputError(`No API key found${suffix}. Run \\`atoll auth login --key <API_KEY>\\` or set ATOLL_API_KEY.`);\n process.exit(1);\n }\n this.apiKey = key;\n }\n\n async request<T = unknown>(path: string, init?: RequestInit): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n const res = await fetch(url, {\n ...init,\n headers: {\n 'Authorization': `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n ...init?.headers,\n },\n });\n\n if (!res.ok) {\n const body = await res.text();\n throw new Error(`API ${res.status}: ${body}`);\n }\n\n return res.json() as Promise<T>;\n }\n\n async get<T = unknown>(path: string): Promise<T> {\n return this.request<T>(path, { method: 'GET' });\n }\n\n async post<T = unknown>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, {\n method: 'POST',\n body: body ? JSON.stringify(body) : undefined,\n });\n }\n\n async patch<T = unknown>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, {\n method: 'PATCH',\n body: body ? JSON.stringify(body) : undefined,\n });\n }\n\n async delete<T = unknown>(path: string): Promise<T> {\n return this.request<T>(path, { method: 'DELETE' });\n }\n}\n","export type OutputRecord = Record<string, unknown>;\n\nfunction isJsonMode(): boolean {\n if (process.env.OUTPUT_FORMAT === 'json') return true;\n return !process.stdout.isTTY;\n}\n\nexport function output(data: OutputRecord, humanReadable: string): void {\n if (isJsonMode()) {\n process.stdout.write(JSON.stringify(data) + '\\n');\n } else {\n console.log(humanReadable);\n }\n}\n\nexport function outputError(message: string): void {\n if (isJsonMode()) {\n process.stdout.write(JSON.stringify({ error: message }) + '\\n');\n } else {\n console.error(`Error: ${message}`);\n }\n}\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\nimport { bold, dim, gray, statusColor, priorityIcon, success } from '../lib/colors.js';\nimport { buildIssueUrl, derivePrefix } from '../lib/urls.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface Issue {\n id: string;\n title: string;\n description?: string | null;\n status: string;\n priority: number;\n number?: number | null;\n assignee_id?: string | null;\n team_id?: string | null;\n project_id?: string | null;\n due_date?: string | null;\n created_at?: string;\n updated_at?: string;\n sub_tasks?: unknown[];\n issue_labels?: { label_id: string; labels: { name: string; color: string } }[];\n}\n\ninterface ListResponse {\n issues: Issue[];\n total: number;\n limit: number;\n offset: number;\n}\n\ninterface SingleResponse {\n issue: Issue;\n}\n\ninterface Org {\n id: string;\n name: string;\n slug: string;\n}\n\ninterface ProjectSummary {\n id: string;\n name: string;\n slug?: string | null;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nexport function handleApiError(err: unknown): never {\n const msg = (err as Error).message ?? String(err);\n if (/API 401\\b/.test(msg)) {\n outputError('Session expired — run `atoll auth login` to re-authenticate.');\n } else if (/API 403\\b/.test(msg)) {\n outputError('Permission denied. You do not have access to this resource.');\n } else {\n outputError(msg);\n }\n process.exit(1);\n}\n\nconst VALID_STATUSES = ['backlog', 'todo', 'in_progress', 'done', 'cancelled'] as const;\nconst PRIORITY_LABELS: Record<number, string> = { 0: 'Urgent', 1: 'High', 2: 'Medium', 3: 'Low' };\n\nexport async function resolveOrg(client: AtollClient, orgSlugOverride?: string): Promise<Org> {\n const { orgs } = await client.get<{ orgs: Org[] }>('/api/orgs');\n if (!orgs || orgs.length === 0) {\n outputError('No organizations found. Create one first.');\n process.exit(1);\n }\n if (orgs.length === 1) return orgs[0];\n\n // Resolve slug: explicit override -> selected profile/env -> legacy config.\n const { resolveConfig } = await import('../lib/config.js');\n const config = resolveConfig();\n const slug = orgSlugOverride ?? config.orgSlug;\n\n if (slug) {\n const match = orgs.find((o) => o.slug === slug);\n if (match) return match;\n outputError(`Org \"${slug}\" not found. Available: ${orgs.map((o) => o.slug).join(', ')}`);\n process.exit(1);\n }\n outputError(`Multiple orgs found. Use --org <slug> or run \\`atoll config set-org <slug>\\`. Available: ${orgs.map((o) => o.slug).join(', ')}`);\n process.exit(1);\n}\n\nexport async function resolveOrgId(client: AtollClient, orgSlugOverride?: string): Promise<string> {\n return (await resolveOrg(client, orgSlugOverride)).id;\n}\n\n/**\n * Fetch the org's projects and return a map keyed by project id.\n * Used to derive PREFIX-NUMBER identifiers and canonical URLs for issues.\n */\nexport async function fetchProjectMap(\n client: AtollClient,\n orgId: string,\n): Promise<Map<string, ProjectSummary>> {\n const { projects } = await client.get<{ projects: ProjectSummary[] }>(\n `/api/orgs/${orgId}/projects`,\n );\n const map = new Map<string, ProjectSummary>();\n for (const p of projects ?? []) map.set(p.id, p);\n return map;\n}\n\nexport interface IssueWithUrl extends Issue {\n url: string | null;\n}\n\nexport function attachIssueUrl(\n issue: Issue,\n baseUrl: string,\n orgSlug: string,\n projects: Map<string, ProjectSummary>,\n): IssueWithUrl {\n const project = issue.project_id ? projects.get(issue.project_id) : undefined;\n return {\n ...issue,\n url: buildIssueUrl(baseUrl, orgSlug, project?.slug, issue.number ?? null),\n };\n}\n\n/**\n * Resolve a human-readable identifier (e.g. \"ATOLL-42\" or \"42\") to a UUID.\n * Falls back to treating the identifier as a UUID if it doesn't match the pattern.\n */\nexport async function resolveIssueId(client: AtollClient, orgId: string, identifier: string): Promise<string> {\n // If it looks like a UUID already, return as-is\n if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(identifier)) {\n return identifier;\n }\n\n // Extract number from PREFIX-NUMBER or plain number. Prefix may contain\n // digits (e.g. \"Q2-42\") since derivePrefix preserves alphanumerics.\n const match = identifier.match(/^(?:[A-Za-z0-9]+-)?(\\d+)$/);\n if (!match) {\n outputError(`Invalid identifier: \"${identifier}\". Use a UUID or PREFIX-NUMBER (e.g. ATOLL-42).`);\n process.exit(2);\n }\n\n const num = parseInt(match[1], 10);\n\n // Use number filter to avoid pagination issues with large issue lists\n const { issues } = await client.get<ListResponse>(\n `/api/orgs/${orgId}/issues?number=${num}&limit=1`,\n );\n if (issues.length > 0 && issues[0].number === num) {\n return issues[0].id;\n }\n\n // Fallback: paginate through all issues if the API doesn't support ?number= filtering\n let offset = 0;\n const pageSize = 100;\n while (true) {\n const page = await client.get<ListResponse>(\n `/api/orgs/${orgId}/issues?limit=${pageSize}&offset=${offset}`,\n );\n const found = page.issues.find((i) => i.number === num);\n if (found) return found.id;\n offset += pageSize;\n if (offset >= page.total) break;\n }\n\n outputError(`Issue #${num} not found.`);\n process.exit(1);\n}\n\nfunction formatIdentifier(issue: Issue, projects?: Map<string, ProjectSummary>): string {\n if (issue.number == null) return issue.id.slice(0, 8);\n if (projects && issue.project_id) {\n const project = projects.get(issue.project_id);\n if (project?.name) return `${derivePrefix(project.name)}-${issue.number}`;\n }\n return `ATOLL-${issue.number}`;\n}\n\nfunction padEnd(str: string, len: number): string {\n return str.length >= len ? str.slice(0, len) : str + ' '.repeat(len - str.length);\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport const issueCommand = new Command('issue')\n .description('Manage issues')\n .addHelpText('after', `\nExamples:\n $ atoll issue list\n $ atoll issue list --status in_progress --priority 1\n $ atoll issue view ATOLL-42\n $ atoll issue create --title \"Fix login\" --priority 1 --status todo\n $ atoll issue update ATOLL-42 --status done\n $ atoll issue assign ATOLL-42 --to <user-id>`);\n\n// ---- list ----\nissueCommand\n .command('list')\n .description('List issues')\n .option('--status <status>', `Filter by status (${VALID_STATUSES.join(', ')})`)\n .option('--assignee <user>', 'Filter by assignee ID')\n .option('--priority <n>', 'Filter by priority (0=urgent, 1=high, 2=medium, 3=low)', parseInt)\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .action(async (opts: { status?: string; assignee?: string; priority?: number; limit?: number }) => {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n\n const params = new URLSearchParams();\n if (opts.status) params.set('status', opts.status);\n if (opts.assignee) params.set('assigneeId', opts.assignee);\n if (opts.priority !== undefined) params.set('priority', String(opts.priority));\n if (opts.limit !== undefined) params.set('limit', String(opts.limit));\n\n const qs = params.toString();\n const [data, projects] = await Promise.all([\n client.get<ListResponse>(`/api/orgs/${org.id}/issues${qs ? `?${qs}` : ''}`),\n fetchProjectMap(client, org.id),\n ]);\n\n const enriched = data.issues.map((issue) =>\n attachIssueUrl(issue, client.baseUrl, org.slug, projects),\n );\n\n // JSON mode: NDJSON\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n for (const issue of enriched) {\n process.stdout.write(JSON.stringify(issue) + '\\n');\n }\n return;\n }\n\n // TTY: table\n if (enriched.length === 0) {\n console.log('No issues found.');\n return;\n }\n\n const header = bold(`${padEnd('ID', 10)} ${padEnd('STATUS', 14)} ${padEnd('PRI', 8)} TITLE`);\n console.log(header);\n console.log('─'.repeat(82));\n for (const issue of enriched) {\n const id = formatIdentifier(issue, projects);\n const pri = PRIORITY_LABELS[issue.priority] ?? String(issue.priority);\n const title = issue.title.length > 50 ? issue.title.slice(0, 47) + '…' : issue.title;\n const icon = priorityIcon(issue.priority);\n console.log(`${padEnd(id, 10)} ${statusColor(issue.status, padEnd(issue.status, 14))} ${icon} ${padEnd(pri, 8)} ${title}`);\n }\n console.log(dim(`${enriched.length} of ${data.total} issues`));\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- view ----\nissueCommand\n .command('view <identifier>')\n .description('View issue details (UUID or PREFIX-NUMBER e.g. ATOLL-42)')\n .action(async (identifier: string) => {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n const [{ issue }, projects] = await Promise.all([\n client.get<SingleResponse>(`/api/orgs/${org.id}/issues/${issueId}`),\n fetchProjectMap(client, org.id),\n ]);\n\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n // JSON mode\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n process.stdout.write(JSON.stringify(enriched) + '\\n');\n return;\n }\n\n // TTY: formatted detail\n const id = formatIdentifier(enriched, projects);\n const pri = PRIORITY_LABELS[enriched.priority] ?? String(enriched.priority);\n console.log(`${bold(id)} ${enriched.title}`);\n console.log(`Status: ${statusColor(enriched.status, enriched.status)} Priority: ${priorityIcon(enriched.priority)} ${pri}`);\n if (enriched.url) console.log(`URL: ${enriched.url}`);\n if (enriched.assignee_id) console.log(`Assignee: ${enriched.assignee_id}`);\n if (enriched.due_date) console.log(`Due: ${enriched.due_date}`);\n if (enriched.description) {\n console.log(`\\n${enriched.description}`);\n }\n if (enriched.issue_labels && enriched.issue_labels.length > 0) {\n const labels = enriched.issue_labels.map((l) => l.labels.name).join(', ');\n console.log(`Labels: ${labels}`);\n }\n if (enriched.sub_tasks && Array.isArray(enriched.sub_tasks) && enriched.sub_tasks.length > 0) {\n console.log(`\\nSubtasks: ${enriched.sub_tasks.length}`);\n }\n if (enriched.created_at) console.log(dim(`Created: ${enriched.created_at}`));\n if (enriched.updated_at) console.log(dim(`Updated: ${enriched.updated_at}`));\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- create ----\nissueCommand\n .command('create')\n .description('Create a new issue')\n .requiredOption('--title <title>', 'Issue title')\n .option('--description <text>', 'Issue description')\n .option('--status <status>', `Status (${VALID_STATUSES.join(', ')})`)\n .option('--priority <n>', 'Priority (0=urgent, 1=high, 2=medium, 3=low)', parseInt)\n .action(async (opts: { title: string; description?: string; status?: string; priority?: number }) => {\n try {\n if (opts.status && !VALID_STATUSES.includes(opts.status as typeof VALID_STATUSES[number])) {\n outputError(`Invalid status \"${opts.status}\". Must be one of: ${VALID_STATUSES.join(', ')}`);\n process.exit(2);\n }\n if (opts.priority !== undefined && ![0, 1, 2, 3].includes(opts.priority)) {\n outputError('Priority must be 0 (urgent), 1 (high), 2 (medium), or 3 (low).');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const org = await resolveOrg(client);\n\n const body: Record<string, unknown> = { title: opts.title };\n if (opts.description !== undefined) body.description = opts.description;\n if (opts.status) body.status = opts.status;\n if (opts.priority !== undefined) body.priority = opts.priority;\n\n const { issue } = await client.post<SingleResponse>(`/api/orgs/${org.id}/issues`, body);\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Created ${formatIdentifier(enriched, projects)}: ${enriched.title}${enriched.url ? `\\n${enriched.url}` : ''}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- update ----\nissueCommand\n .command('update <identifier>')\n .description('Update an issue')\n .option('--title <t>', 'New title')\n .option('--status <s>', `New status (${VALID_STATUSES.join(', ')})`)\n .option('--priority <p>', 'New priority (0-3)', parseInt)\n .action(async (identifier: string, opts: { title?: string; status?: string; priority?: number }) => {\n try {\n if (opts.status && !VALID_STATUSES.includes(opts.status as typeof VALID_STATUSES[number])) {\n outputError(`Invalid status \"${opts.status}\". Must be one of: ${VALID_STATUSES.join(', ')}`);\n process.exit(2);\n }\n if (opts.priority !== undefined && ![0, 1, 2, 3].includes(opts.priority)) {\n outputError('Priority must be 0-3.');\n process.exit(2);\n }\n\n const body: Record<string, unknown> = {};\n if (opts.title !== undefined) body.title = opts.title;\n if (opts.status) body.status = opts.status;\n if (opts.priority !== undefined) body.priority = opts.priority;\n\n if (Object.keys(body).length === 0) {\n outputError('No fields to update. Provide --title, --status, or --priority.');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n const { issue } = await client.patch<SingleResponse>(`/api/orgs/${org.id}/issues/${issueId}`, body);\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Updated ${formatIdentifier(enriched, projects)}: ${enriched.title}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- delete ----\nissueCommand\n .command('delete <identifier>')\n .description('Delete an issue (admin/owner only)')\n .action(async (identifier: string) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n await client.delete(`/api/orgs/${orgId}/issues/${issueId}`);\n\n output(\n { success: true, id: issueId },\n success(`Deleted issue ${identifier}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- assign ----\nissueCommand\n .command('assign <identifier>')\n .description('Assign an issue to a user or agent')\n .requiredOption('--to <user>', 'User/agent ID or \"self\" for yourself')\n .action(async (identifier: string, opts: { to: string }) => {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n let assigneeId = opts.to;\n if (assigneeId === 'self') {\n const me = await client.get<{ auth?: { userId?: string } }>('/api/auth/me');\n // For agent keys, auth.userId IS the org_members.id directly\n const callerUserId = me.auth?.userId;\n if (!callerUserId) {\n outputError('Could not resolve your user ID.');\n process.exit(1);\n }\n // Agent callers: userId is the member id — use directly\n // Human callers: userId is the supabase auth id — look up member id\n const { members } = await client.get<{ members: { id: string; user_id: string }[] }>(\n `/api/orgs/${org.id}/members`,\n );\n const member = members.find((m) => m.id === callerUserId || m.user_id === callerUserId);\n if (!member) {\n outputError('You are not a member of this organisation.');\n process.exit(1);\n }\n assigneeId = member.id;\n }\n\n const { issue } = await client.patch<SingleResponse>(\n `/api/orgs/${org.id}/issues/${issueId}`,\n { assignee_id: assigneeId },\n );\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Assigned ${formatIdentifier(enriched, projects)} to ${opts.to}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- unassign ----\nissueCommand\n .command('unassign <identifier>')\n .description('Remove assignee from an issue')\n .action(async (identifier: string) => {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n const { issue } = await client.patch<SingleResponse>(\n `/api/orgs/${org.id}/issues/${issueId}`,\n { assignee_id: null },\n );\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Unassigned ${formatIdentifier(enriched, projects)}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n","/**\n * TTY-aware ANSI color helpers.\n * Colors are only emitted when stdout is a TTY and OUTPUT_FORMAT !== 'json'.\n */\n\nfunction isTTY(): boolean {\n return process.stdout.isTTY === true && process.env.OUTPUT_FORMAT !== 'json';\n}\n\nfunction ansi(code: string, text: string): string {\n if (!isTTY()) return text;\n return `\\x1b[${code}m${text}\\x1b[0m`;\n}\n\n// Basic colors\nexport const bold = (t: string) => ansi('1', t);\nexport const dim = (t: string) => ansi('2', t);\nexport const red = (t: string) => ansi('31', t);\nexport const green = (t: string) => ansi('32', t);\nexport const yellow = (t: string) => ansi('33', t);\nexport const blue = (t: string) => ansi('34', t);\nexport const cyan = (t: string) => ansi('36', t);\nexport const gray = (t: string) => ansi('90', t);\nexport const white = (t: string) => ansi('37', t);\n\n// Status badge colors\nexport function statusColor(status: string, text: string): string {\n switch (status) {\n case 'done': return green(text);\n case 'in_progress': return yellow(text);\n case 'backlog':\n case 'todo': return gray(text);\n case 'cancelled': return red(text);\n default: return text;\n }\n}\n\n// Priority icons\nexport function priorityIcon(priority: number): string {\n switch (priority) {\n case 0: return red('⚠⚠⚠'); // urgent\n case 1: return yellow('▄▆█'); // high\n case 2: return cyan('▄▆'); // medium\n case 3: return dim('---'); // low\n default: return String(priority);\n }\n}\n\n// Helpers\nexport const success = (msg: string) => green(`✓ ${msg}`);\nexport const error = (msg: string) => red(`Error: ${msg}`);\n\n// Raw ANSI codes (for use in format strings where needed)\nexport const RESET = isTTY() ? '\\x1b[0m' : '';\nexport const BOLD = isTTY() ? '\\x1b[1m' : '';\nexport const DIM = isTTY() ? '\\x1b[2m' : '';\n","// URL builders for Atoll canonical web routes.\n// Mirrors the routing and identifier conventions in agent-pm.\n\n/**\n * Derive a short uppercase prefix from a project name.\n * Mirrors agent-pm/lib/issue-identifier.ts — keep in sync.\n */\nexport function derivePrefix(name: string): string {\n const cleaned = name.replace(/[^a-zA-Z0-9\\s]/g, ' ').trim();\n const words = cleaned.split(/\\s+/).filter(Boolean);\n\n if (words.length === 0) return 'TSK';\n\n if (words.length >= 2) {\n return words\n .slice(0, 5)\n .map((w) => w[0])\n .join('')\n .toUpperCase();\n }\n\n const word = words[0];\n if (word.length <= 4) return word.toUpperCase();\n return word.slice(0, 3).toUpperCase();\n}\n\nexport function issueIdentifier(\n projectName: string | null | undefined,\n issueNumber: number | null | undefined,\n): string | null {\n if (issueNumber == null) return null;\n const prefix = projectName ? derivePrefix(projectName) : 'TSK';\n return `${prefix}-${issueNumber}`;\n}\n\nfunction stripTrailingSlash(baseUrl: string): string {\n return baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n}\n\nexport function buildIssueUrl(\n baseUrl: string,\n orgSlug: string,\n projectSlug: string | null | undefined,\n issueNumber: number | null | undefined,\n): string | null {\n // Use the project-scoped route (/{org}/projects/{projectSlug}/issues/{number})\n // rather than the prefix-based identifier route. The prefix route is\n // ambiguous (two projects can derive the same prefix, and numeric-containing\n // prefixes like \"Q2\" fail the web app's [A-Z]{2,} regex).\n if (!orgSlug || !projectSlug || issueNumber == null) return null;\n return `${stripTrailingSlash(baseUrl)}/${orgSlug}/projects/${projectSlug}/issues/${issueNumber}`;\n}\n\nexport function buildProjectUrl(\n baseUrl: string,\n orgSlug: string,\n projectSlug: string | null | undefined,\n): string | null {\n if (!orgSlug || !projectSlug) return null;\n return `${stripTrailingSlash(baseUrl)}/${orgSlug}/projects/${projectSlug}`;\n}\n\nexport function buildInitiativeUrl(\n baseUrl: string,\n orgSlug: string,\n initiativeId: string | null | undefined,\n): string | null {\n if (!orgSlug || !initiativeId) return null;\n return `${stripTrailingSlash(baseUrl)}/${orgSlug}/initiatives/${initiativeId}`;\n}\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\nimport { handleApiError, resolveOrgId, resolveIssueId } from './issue.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface CommentAuthor {\n id: string;\n display_name: string;\n type: string;\n avatar_url?: string;\n}\n\ninterface Comment {\n id: string;\n body: string;\n author_id: string;\n author_type?: string;\n author?: CommentAuthor;\n created_at?: string;\n updated_at?: string;\n}\n\ninterface ListCommentsResponse {\n comments: Comment[];\n}\n\ninterface SingleCommentResponse {\n comment: Comment;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst BOLD = '\\x1b[1m';\nconst DIM = '\\x1b[2m';\nconst RESET = '\\x1b[0m';\nconst CYAN = '\\x1b[36m';\n\nfunction formatAuthor(comment: Comment): string {\n const name = comment.author?.display_name ?? comment.author_id;\n const badge = (comment.author?.type ?? comment.author_type) === 'agent' ? ' [agent]' : '';\n return `${name}${badge}`;\n}\n\nfunction formatTimestamp(ts?: string): string {\n if (!ts) return '';\n const d = new Date(ts);\n return d.toLocaleString();\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport const commentCommand = new Command('comment')\n .description('Manage issue comments');\n\n// ---- list ----\ncommentCommand\n .command('list <identifier>')\n .description('List comments on an issue (UUID or PREFIX-NUMBER e.g. ATOLL-42)')\n .action(async (identifier: string) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n const data = await client.get<ListCommentsResponse>(\n `/api/orgs/${orgId}/issues/${issueId}/comments`,\n );\n\n // JSON mode: NDJSON\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n for (const comment of data.comments) {\n process.stdout.write(JSON.stringify(comment) + '\\n');\n }\n return;\n }\n\n // TTY: human-readable\n if (data.comments.length === 0) {\n console.log('No comments found.');\n return;\n }\n\n for (const comment of data.comments) {\n const author = formatAuthor(comment);\n const time = formatTimestamp(comment.created_at);\n console.log(`${BOLD}${CYAN}${author}${RESET} ${DIM}${time}${RESET}`);\n console.log(comment.body);\n console.log();\n }\n console.log(`${DIM}${data.comments.length} comment(s)${RESET}`);\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- add ----\ncommentCommand\n .command('add <identifier>')\n .description('Add a comment to an issue')\n .requiredOption('--body <text>', 'Comment body')\n .action(async (identifier: string, opts: { body: string }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n const { comment } = await client.post<SingleCommentResponse>(\n `/api/orgs/${orgId}/issues/${issueId}/comments`,\n { body: opts.body },\n );\n\n output(\n { comment },\n `✓ Comment added to ${identifier}`,\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- update ----\ncommentCommand\n .command('update <comment-id>')\n .description('Update a comment')\n .requiredOption('--body <text>', 'New comment body')\n .requiredOption('--issue <identifier>', 'Issue identifier (e.g. UUID or PREFIX-NUMBER)')\n .action(async (commentId: string, opts: { body: string; issue: string }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, opts.issue);\n\n const { comment } = await client.patch<SingleCommentResponse>(\n `/api/orgs/${orgId}/issues/${issueId}/comments/${commentId}`,\n { body: opts.body },\n );\n\n output(\n { comment },\n `✓ Comment ${commentId} updated`,\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- delete ----\ncommentCommand\n .command('delete <comment-id>')\n .description('Delete a comment')\n .requiredOption('--issue <identifier>', 'Issue identifier (e.g. UUID or PREFIX-NUMBER)')\n .action(async (commentId: string, opts: { issue: string }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, opts.issue);\n\n await client.delete(`/api/orgs/${orgId}/issues/${issueId}/comments/${commentId}`);\n\n output(\n { success: true, id: commentId },\n `✓ Comment ${commentId} deleted`,\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\nimport { resolveOrg, handleApiError } from './issue.js';\nimport { bold, dim, cyan, green, success } from '../lib/colors.js';\nimport { buildProjectUrl } from '../lib/urls.js';\n\ninterface Project {\n id: string;\n name: string;\n slug?: string | null;\n description?: string | null;\n status: 'active' | 'archived';\n color: string;\n icon: string;\n issueCount?: number;\n completedCount?: number;\n progress?: number;\n created_at?: string;\n}\n\nfunction attachProjectUrl<T extends Project>(project: T, baseUrl: string, orgSlug: string): T & { url: string | null } {\n return { ...project, url: buildProjectUrl(baseUrl, orgSlug, project.slug) };\n}\n\ninterface Issue {\n id: string;\n title: string;\n status: string;\n priority: number;\n number?: number | null;\n}\n\nfunction progressBar(progress: number, width = 20): string {\n const filled = Math.round((progress / 100) * width);\n const empty = width - filled;\n return `[${'█'.repeat(filled)}${'░'.repeat(empty)}] ${progress}%`;\n}\n\nexport const projectCommand = new Command('project')\n .description('Manage projects')\n .addHelpText('after', `\nExamples:\n $ atoll project list\n $ atoll project create --name \"My Project\" --icon 🚀\n $ atoll project view <project-id>`);\n\n// ── atoll project list ──────────────────────────────────────────────────────\n\nprojectCommand\n .command('list')\n .description('List all projects with progress')\n .action(async () => {\n const client = new AtollClient();\n try {\n const org = await resolveOrg(client);\n const data = await client.get<{ projects: Project[] }>(`/api/orgs/${org.id}/projects`);\n const projects = (data.projects ?? []).map((p) => attachProjectUrl(p, client.baseUrl, org.slug));\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n for (const p of projects) {\n process.stdout.write(JSON.stringify(p) + '\\n');\n }\n return;\n }\n\n if (projects.length === 0) {\n console.log(dim('No projects found.'));\n return;\n }\n\n for (const p of projects) {\n const progress = p.progress ?? 0;\n const bar = progressBar(progress);\n console.log(`${bold(`${p.icon} ${p.name}`)} ${dim(`(${p.id})`)}`);\n if (p.description) console.log(` ${dim(p.description)}`);\n console.log(` ${cyan(bar)} ${p.issueCount ?? 0} issues, ${p.completedCount ?? 0} done`);\n if (p.url) console.log(` ${dim(p.url)}`);\n if (p.status === 'archived') console.log(` ${dim('[archived]')}`);\n console.log('');\n }\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ── atoll project create ────────────────────────────────────────────────────\n\nprojectCommand\n .command('create')\n .description('Create a new project')\n .requiredOption('--name <name>', 'Project name')\n .option('--description <desc>', 'Project description')\n .option('--color <color>', 'Project color (hex)', '#6366f1')\n .option('--icon <icon>', 'Project icon (emoji)', '📁')\n .action(async (opts) => {\n const client = new AtollClient();\n try {\n const org = await resolveOrg(client);\n const data = await client.post<{ project: Project }>(`/api/orgs/${org.id}/projects`, {\n name: opts.name,\n description: opts.description ?? null,\n color: opts.color,\n icon: opts.icon,\n });\n const project = attachProjectUrl(data.project, client.baseUrl, org.slug);\n\n output(\n { project },\n success(`Created project ${project.icon} ${project.name} (${dim(project.id)})${project.url ? `\\n${project.url}` : ''}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ── atoll project view ──────────────────────────────────────────────────────\n\nprojectCommand\n .command('view <projectId>')\n .description('View project details and issues')\n .action(async (projectId) => {\n const client = new AtollClient();\n try {\n const org = await resolveOrg(client);\n const data = await client.get<{ project: Project & { issues: Issue[] } }>(\n `/api/orgs/${org.id}/projects/${projectId}`,\n );\n const p = attachProjectUrl(data.project, client.baseUrl, org.slug);\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n process.stdout.write(JSON.stringify(p) + '\\n');\n return;\n }\n\n const progress = p.progress ?? 0;\n console.log(bold(`${p.icon} ${p.name}`));\n if (p.description) console.log(` ${p.description}`);\n if (p.url) console.log(` ${dim(p.url)}`);\n console.log(` ${cyan(progressBar(progress))}`);\n console.log(` ${(p.issueCount ?? 0)} issues · ${(p.completedCount ?? 0)} completed`);\n console.log('');\n\n const issues: Issue[] = (p as unknown as { issues?: Issue[] }).issues ?? [];\n if (issues.length === 0) {\n console.log(dim('No issues in this project.'));\n return;\n }\n\n console.log(bold('Issues'));\n for (const issue of issues) {\n const num = issue.number ? `#${issue.number}` : issue.id.slice(0, 8);\n console.log(` ${dim(num)} ${issue.title} ${dim(`[${issue.status}]`)}`);\n }\n } catch (err) {\n handleApiError(err);\n }\n });\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\nimport { resolveOrgId, handleApiError } from './issue.js';\nimport { bold, dim, cyan, red, success } from '../lib/colors.js';\n\ninterface Milestone {\n id: string;\n name: string;\n description?: string | null;\n due_date?: string | null;\n status: 'active' | 'closed';\n issueCount?: number;\n completedCount?: number;\n progress?: number;\n isOverdue?: boolean;\n}\n\nfunction progressBar(progress: number, width = 20): string {\n const filled = Math.round((progress / 100) * width);\n const empty = width - filled;\n return `[${'█'.repeat(filled)}${'░'.repeat(empty)}] ${progress}%`;\n}\n\nexport const milestoneCommand = new Command('milestone')\n .description('Manage milestones')\n .addHelpText('after', `\nExamples:\n $ atoll milestone list --project <project-id>\n $ atoll milestone create --project <project-id> --name \"v1.0\" --date 2026-06-01`);\n\n// ── atoll milestone list ────────────────────────────────────────────────────\n\nmilestoneCommand\n .command('list')\n .description('List milestones for a project')\n .requiredOption('--project <id>', 'Project ID')\n .action(async (opts) => {\n const client = new AtollClient();\n try {\n const orgId = await resolveOrgId(client);\n const data = await client.get<{ milestones: Milestone[] }>(\n `/api/orgs/${orgId}/projects/${opts.project}/milestones`,\n );\n const milestones = data.milestones ?? [];\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n for (const m of milestones) {\n process.stdout.write(JSON.stringify(m) + '\\n');\n }\n return;\n }\n\n if (milestones.length === 0) {\n console.log(dim('No milestones found.'));\n return;\n }\n\n for (const m of milestones) {\n const progress = m.progress ?? 0;\n const bar = progressBar(progress);\n const overdue = m.isOverdue ? ` ${red('[OVERDUE]')}` : '';\n console.log(`${bold(m.name)} ${dim(`(${m.id})`)}${overdue}`);\n if (m.due_date) console.log(` Due: ${m.due_date}`);\n if (m.description) console.log(` ${dim(m.description)}`);\n console.log(` ${cyan(bar)} ${m.issueCount ?? 0} issues, ${m.completedCount ?? 0} done`);\n if (m.status === 'closed') console.log(` ${dim('[closed]')}`);\n console.log('');\n }\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ── atoll milestone create ──────────────────────────────────────────────────\n\nmilestoneCommand\n .command('create')\n .description('Create a new milestone')\n .requiredOption('--project <id>', 'Project ID')\n .requiredOption('--name <name>', 'Milestone name')\n .option('--date <YYYY-MM-DD>', 'Due date')\n .option('--description <desc>', 'Description')\n .action(async (opts) => {\n const client = new AtollClient();\n try {\n const orgId = await resolveOrgId(client);\n const data = await client.post<{ milestone: Milestone }>(\n `/api/orgs/${orgId}/projects/${opts.project}/milestones`,\n {\n name: opts.name,\n description: opts.description ?? null,\n dueDate: opts.date ?? null,\n },\n );\n\n output(\n { milestone: data.milestone },\n success(`Milestone created: ${bold(data.milestone.name)} ${dim(`(${data.milestone.id})`)}`),\n );\n if (data.milestone.due_date) {\n console.log(` Due: ${data.milestone.due_date}`);\n }\n } catch (err) {\n handleApiError(err);\n }\n });\n","import { Command } from 'commander';\nimport { ensureProfile, readConfig, resolveConfig, writeConfig } from '../lib/config.js';\nimport { output } from '../lib/output.js';\nimport { success, bold, dim, gray } from '../lib/colors.js';\n\nexport const configCommand = new Command('config')\n .description('Manage CLI configuration (org, team, API key)')\n .addHelpText('after', `\nExamples:\n $ atoll config show\n $ atoll config set-org my-org\n $ atoll config set-team team-abc123\n $ atoll config set-base-url https://atollhq.com`);\n\n// ── atoll config show ───────────────────────────────────────────────────────\n\nconfigCommand\n .command('show')\n .description('Display current configuration')\n .option('--profile <name>', 'Profile name to show')\n .action((opts: { profile?: string }) => {\n const cfg = readConfig();\n const activeProfile = cfg.activeProfile;\n const resolved = resolveConfig({ profile: opts.profile });\n const apiKeySet = !!resolved.apiKey;\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n output(\n {\n activeProfile: activeProfile ?? null,\n selectedProfile: resolved.profile ?? null,\n orgSlug: resolved.orgSlug ?? null,\n defaultTeam: resolved.defaultTeam ?? null,\n baseUrl: resolved.baseUrl ?? null,\n apiKeySet,\n profiles: Object.keys(cfg.profiles ?? {}).sort(),\n },\n '',\n );\n return;\n }\n\n console.log(`${bold('Atoll CLI Configuration')}`);\n console.log(` ${dim('Active profile:')} ${activeProfile ? bold(activeProfile) : gray('(not set)')}`);\n console.log(` ${dim('Selected profile:')} ${resolved.profile ? bold(resolved.profile) : gray('(legacy config)')}`);\n console.log(` ${dim('Org slug:')} ${resolved.orgSlug ? bold(resolved.orgSlug) : gray('(not set)')}`);\n console.log(` ${dim('Default team:')} ${resolved.defaultTeam ? bold(resolved.defaultTeam) : gray('(not set)')}`);\n console.log(` ${dim('Base URL:')} ${resolved.baseUrl ? bold(resolved.baseUrl) : gray('(default)')}`);\n console.log(` ${dim('API key:')} ${apiKeySet ? bold('set') : gray('not set — run `atoll auth login`')}`);\n });\n\n// ── atoll config set-org ────────────────────────────────────────────────────\n\nconfigCommand\n .command('set-org <slug>')\n .description('Set the default organisation slug')\n .option('--profile <name>', 'Profile name to update')\n .action((slug: string, opts: { profile?: string }) => {\n const cfg = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || cfg.activeProfile;\n if (profileName) {\n ensureProfile(cfg, profileName).orgSlug = slug;\n } else {\n cfg.orgSlug = slug;\n }\n writeConfig(cfg);\n\n output(\n { orgSlug: slug, profile: profileName ?? null },\n profileName\n ? success(`Default org for profile \"${profileName}\" set to \"${slug}\"`)\n : success(`Default org set to \"${slug}\"`),\n );\n });\n\n// ── atoll config set-team ───────────────────────────────────────────────────\n\nconfigCommand\n .command('set-team <team>')\n .description('Set the default team slug or ID')\n .option('--profile <name>', 'Profile name to update')\n .action((team: string, opts: { profile?: string }) => {\n const cfg = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || cfg.activeProfile;\n if (profileName) {\n ensureProfile(cfg, profileName).defaultTeam = team;\n } else {\n cfg.defaultTeam = team;\n }\n writeConfig(cfg);\n\n output(\n { defaultTeam: team, profile: profileName ?? null },\n profileName\n ? success(`Default team for profile \"${profileName}\" set to \"${team}\"`)\n : success(`Default team set to \"${team}\"`),\n );\n });\n\n// ── atoll config set-base-url ───────────────────────────────────────────────\n\nconfigCommand\n .command('set-base-url <url>')\n .description('Set the default API base URL')\n .option('--profile <name>', 'Profile name to update')\n .action((url: string, opts: { profile?: string }) => {\n const cfg = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || cfg.activeProfile;\n if (profileName) {\n ensureProfile(cfg, profileName).baseUrl = url;\n } else {\n cfg.baseUrl = url;\n }\n writeConfig(cfg);\n\n output(\n { baseUrl: url, profile: profileName ?? null },\n profileName\n ? success(`Base URL for profile \"${profileName}\" set to \"${url}\"`)\n : success(`Base URL set to \"${url}\"`),\n );\n });\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\nimport { bold, dim, green, gray, success } from '../lib/colors.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface Webhook {\n id: string;\n url: string;\n events: string[];\n enabled: boolean;\n created_at: string;\n}\n\ninterface WebhookListResponse {\n webhooks: Webhook[];\n}\n\ninterface WebhookCreateResponse {\n webhook: Webhook;\n secret: string;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction handleApiError(err: unknown): never {\n const msg = (err as Error).message ?? String(err);\n if (/API 401\\b/.test(msg)) {\n outputError('Session expired — run `atoll auth login` to re-authenticate.');\n } else if (/API 403\\b/.test(msg)) {\n outputError('Permission denied. You do not have access to this resource.');\n } else {\n outputError(msg);\n }\n process.exit(1);\n}\n\nasync function resolveOrgId(client: AtollClient, orgSlugOverride?: string): Promise<string> {\n const { orgs } = await client.get<{ orgs: { id: string; slug: string }[] }>('/api/orgs');\n if (!orgs || orgs.length === 0) {\n outputError('No organizations found.');\n process.exit(1);\n }\n if (orgs.length === 1) return orgs[0].id;\n\n const { resolveConfig } = await import('../lib/config.js');\n const config = resolveConfig();\n const slug = orgSlugOverride ?? config.orgSlug;\n\n if (slug) {\n const match = orgs.find((o) => o.slug === slug);\n if (match) return match.id;\n outputError(`Org \"${slug}\" not found. Available: ${orgs.map((o) => o.slug).join(', ')}`);\n process.exit(1);\n }\n outputError(`Multiple orgs found. Use --org <slug>.`);\n process.exit(1);\n}\n\nfunction padEnd(str: string, len: number): string {\n return str.length >= len ? str.slice(0, len) : str + ' '.repeat(len - str.length);\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport const webhookCommand = new Command('webhook')\n .description('Manage outbound webhooks')\n .addHelpText('after', `\nExamples:\n $ atoll webhook list\n $ atoll webhook create --url https://example.com/hook --events issue.created,issue.updated\n $ atoll webhook delete <id>`);\n\n// ---- list ----\nwebhookCommand\n .command('list')\n .description('List webhooks for the current org')\n .action(async () => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n\n const data = await client.get<WebhookListResponse>(`/api/webhooks?orgId=${orgId}`);\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n for (const wh of data.webhooks) {\n process.stdout.write(JSON.stringify(wh) + '\\n');\n }\n return;\n }\n\n if (data.webhooks.length === 0) {\n console.log('No webhooks configured.');\n return;\n }\n\n const header = bold(`${padEnd('ID', 38)} ${padEnd('URL', 40)} ${padEnd('EVENTS', 20)} ACTIVE`);\n console.log(header);\n console.log('─'.repeat(100));\n for (const wh of data.webhooks) {\n const evts = wh.events.length === 0 ? 'all' : wh.events.join(',');\n const active = wh.enabled ? green('yes') : gray('no');\n const url = wh.url.length > 38 ? wh.url.slice(0, 35) + '…' : wh.url;\n const evtStr = evts.length > 18 ? evts.slice(0, 15) + '…' : evts;\n console.log(`${padEnd(wh.id.slice(0, 36), 38)} ${padEnd(url, 40)} ${padEnd(evtStr, 20)} ${active}`);\n }\n console.log(dim(`${data.webhooks.length} webhook(s)`));\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- create ----\nwebhookCommand\n .command('create')\n .description('Create a new webhook')\n .requiredOption('--url <url>', 'Payload URL (HTTPS)')\n .option('--events <events>', 'Comma-separated event types (default: all)', '')\n .action(async (opts: { url: string; events: string }) => {\n try {\n if (!opts.url.startsWith('https://')) {\n outputError('URL must use HTTPS.');\n process.exit(2);\n }\n\n const events = opts.events\n ? opts.events.split(',').map((e) => e.trim()).filter(Boolean)\n : [];\n\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n\n const data = await client.post<WebhookCreateResponse>(\n `/api/webhooks?orgId=${orgId}`,\n { url: opts.url, events },\n );\n\n output(\n { webhook: data.webhook, secret: data.secret },\n [\n success(`Created webhook ${data.webhook.id}`),\n '',\n bold('Signing secret (save this — shown only once):'),\n ` ${data.secret}`,\n ].join('\\n'),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- delete ----\nwebhookCommand\n .command('delete <id>')\n .description('Delete a webhook')\n .action(async (id: string) => {\n try {\n const client = new AtollClient();\n await client.delete(`/api/webhooks/${id}`);\n\n output(\n { success: true, id },\n success(`Deleted webhook ${id}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n"],"mappings":";;;;;;;;;;;;;AA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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8DT;AAEA,SAAS,gBAAwB;AAC/B,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6ET;","names":["import_commander","import_commander","resolveConfig","import_commander","BOLD","DIM","RESET","import_commander","import_commander","progressBar","import_commander","import_commander","handleApiError","resolveOrgId","resolveConfig","padEnd"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/config.ts","../src/index.ts","../src/commands/auth.ts","../src/lib/client.ts","../src/lib/output.ts","../src/commands/issue.ts","../src/lib/colors.ts","../src/lib/urls.ts","../src/commands/comment.ts","../src/commands/project.ts","../src/commands/milestone.ts","../src/commands/config.ts","../src/commands/webhook.ts","../src/commands/heartbeat.ts","../src/commands/agent-context.ts","../src/commands/feedback.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\n\nexport interface AtollConfig {\n apiKey?: string;\n orgSlug?: string;\n defaultTeam?: string;\n baseUrl?: string;\n activeProfile?: string;\n profiles?: Record<string, AtollProfile>;\n}\n\nexport interface AtollProfile {\n apiKey?: string;\n orgSlug?: string;\n defaultTeam?: string;\n baseUrl?: string;\n}\n\nexport interface ResolvedConfig extends AtollProfile {\n profile?: string;\n}\n\nconst CONFIG_DIR = join(homedir(), '.atoll');\nconst CONFIG_PATH = join(CONFIG_DIR, 'config.json');\n\nexport function readConfig(): AtollConfig {\n if (!existsSync(CONFIG_PATH)) return {};\n try {\n return JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));\n } catch {\n return {};\n }\n}\n\nexport function writeConfig(config: AtollConfig): void {\n if (!existsSync(CONFIG_DIR)) {\n mkdirSync(CONFIG_DIR, { recursive: true });\n }\n writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n}\n\nexport function deleteConfig(): void {\n if (existsSync(CONFIG_PATH)) {\n unlinkSync(CONFIG_PATH);\n }\n}\n\nexport function getActiveProfile(config = readConfig()): string | undefined {\n return process.env.ATOLL_PROFILE || config.activeProfile;\n}\n\nexport function getProfile(config: AtollConfig, profileName?: string): AtollProfile | undefined {\n if (!profileName) return undefined;\n return config.profiles?.[profileName];\n}\n\nexport function ensureProfile(config: AtollConfig, profileName: string): AtollProfile {\n config.profiles ??= {};\n config.profiles[profileName] ??= {};\n return config.profiles[profileName];\n}\n\nexport function resolveConfig(opts?: { profile?: string }): ResolvedConfig {\n const config = readConfig();\n const profileName = opts?.profile || getActiveProfile(config);\n const profile = getProfile(config, profileName);\n\n return {\n profile: profileName,\n apiKey: process.env.ATOLL_API_KEY || profile?.apiKey || (profileName ? undefined : config.apiKey),\n orgSlug: process.env.ATOLL_ORG || profile?.orgSlug || (profileName ? undefined : config.orgSlug),\n defaultTeam: process.env.ATOLL_TEAM || profile?.defaultTeam || (profileName ? undefined : config.defaultTeam),\n baseUrl: process.env.ATOLL_BASE_URL || profile?.baseUrl || (profileName ? undefined : config.baseUrl),\n };\n}\n\nexport function getApiKey(opts?: { profile?: string }): string | undefined {\n return resolveConfig(opts).apiKey;\n}\n","import { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { authCommand } from './commands/auth.js';\nimport { issueCommand } from './commands/issue.js';\nimport { commentCommand } from './commands/comment.js';\nimport { projectCommand } from './commands/project.js';\nimport { milestoneCommand } from './commands/milestone.js';\nimport { configCommand } from './commands/config.js';\nimport { webhookCommand } from './commands/webhook.js';\nimport { heartbeatCommand } from './commands/heartbeat.js';\nimport { agentContextCommand, skillPathCommand } from './commands/agent-context.js';\nimport { feedbackCommand } from './commands/feedback.js';\nimport { enableJsonMode } from './lib/output.js';\n\nfunction readCliVersion(): string {\n try {\n const packageJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')) as {\n version?: string;\n };\n return packageJson.version ?? '0.0.0';\n } catch {\n return '0.0.0';\n }\n}\n\nconst program = new Command('atoll')\n .description('Atoll CLI — project management from the terminal')\n .version(readCliVersion())\n .addHelpText('after', `\nExamples:\n $ atoll issue list\n $ atoll issue create --title \"Fix login bug\" --priority 1\n $ atoll issue view ATOLL-42\n $ atoll heartbeat\n $ atoll project list\n $ atoll milestone list --project <id>\n $ atoll config show`)\n // Global overrides — passed via env vars so sub-commands can pick them up\n .option('--profile <name>', 'Use a saved auth profile (env: ATOLL_PROFILE)')\n .option('--org <slug>', 'Override default org slug (env: ATOLL_ORG)')\n .option('--team <id>', 'Override default team slug/ID (env: ATOLL_TEAM)')\n .option('--json', 'Emit machine-readable JSON')\n .hook('preAction', (_thisCommand, actionCommand) => {\n const opts = actionCommand.optsWithGlobals();\n if (opts.json) {\n enableJsonMode();\n }\n if (opts.profile) {\n process.env.ATOLL_PROFILE = opts.profile;\n }\n if (opts.org) {\n process.env.ATOLL_ORG = opts.org;\n process.env.ATOLL_CLI_ORG = opts.org;\n }\n if (opts.team) {\n process.env.ATOLL_TEAM = opts.team;\n process.env.ATOLL_CLI_TEAM = opts.team;\n }\n });\n\nprogram.addCommand(authCommand);\nprogram.addCommand(issueCommand);\nprogram.addCommand(commentCommand);\nprogram.addCommand(projectCommand);\nprogram.addCommand(milestoneCommand);\nprogram.addCommand(configCommand);\nprogram.addCommand(webhookCommand);\nprogram.addCommand(heartbeatCommand);\nprogram.addCommand(agentContextCommand);\nprogram.addCommand(skillPathCommand);\nprogram.addCommand(feedbackCommand);\n\n// ── atoll completion ────────────────────────────────────────────────────────\n\nconst completionCommand = new Command('completion')\n .description('Output shell completion scripts')\n .addHelpText('after', `\nExamples:\n $ atoll completion bash >> ~/.bashrc\n $ atoll completion zsh >> ~/.zshrc`);\n\ncompletionCommand\n .command('bash')\n .description('Output bash completion script')\n .action(() => {\n process.stdout.write(bashCompletion());\n });\n\ncompletionCommand\n .command('zsh')\n .description('Output zsh completion script')\n .action(() => {\n process.stdout.write(zshCompletion());\n });\n\nprogram.addCommand(completionCommand);\n\naddJsonOptionToSubcommands(program);\n\nprogram.parse();\n\n// ---------------------------------------------------------------------------\n// Completion script generators\n// ---------------------------------------------------------------------------\n\nfunction bashCompletion(): string {\n return `# Atoll CLI bash completion\n# Add to ~/.bashrc: source <(atoll completion bash)\n\n_atoll_completions() {\n local cur prev words cword\n _init_completion || return\n\n local commands=\"auth issue comment project milestone config webhook heartbeat agent-context skill-path feedback completion\"\n local issue_cmds=\"list view get create update archive unarchive delete assign unassign\"\n local project_cmds=\"list create view get\"\n local milestone_cmds=\"list create\"\n local config_cmds=\"show set-org set-team set-base-url\"\n local auth_cmds=\"login logout status profiles use\"\n local webhook_cmds=\"list create delete\"\n local feedback_cmds=\"add list\"\n local completion_cmds=\"bash zsh\"\n\n if [ \"\\${COMP_CWORD}\" -eq 1 ]; then\n COMPREPLY=( $(compgen -W \"\\${commands}\" -- \"\\${cur}\") )\n return 0\n fi\n\n case \"\\${words[1]}\" in\n issue)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${issue_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n project)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${project_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n milestone)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${milestone_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n config)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${config_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n auth)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${auth_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n webhook)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${webhook_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n feedback)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${feedback_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n completion)\n if [ \"\\${COMP_CWORD}\" -eq 2 ]; then\n COMPREPLY=( $(compgen -W \"\\${completion_cmds}\" -- \"\\${cur}\") )\n fi\n ;;\n esac\n}\n\ncomplete -F _atoll_completions atoll\n`;\n}\n\nfunction zshCompletion(): string {\n return `#compdef atoll\n# Atoll CLI zsh completion\n# Add to ~/.zshrc: source <(atoll completion zsh)\n\n_atoll() {\n local state\n\n _arguments \\\\\n '1: :->command' \\\\\n '*: :->args'\n\n case \\$state in\n command)\n _values 'command' \\\\\n 'auth[Manage authentication]' \\\\\n 'issue[Manage issues]' \\\\\n 'comment[Manage comments]' \\\\\n 'project[Manage projects]' \\\\\n 'milestone[Manage milestones]' \\\\\n 'config[Manage CLI configuration]' \\\\\n 'webhook[Manage outbound webhooks]' \\\\\n 'heartbeat[Get agent heartbeat briefing]' \\\\\n 'agent-context[Output machine-readable CLI context]' \\\\\n 'skill-path[Output local Atoll skill manifest paths]' \\\\\n 'feedback[Record CLI or platform feedback]' \\\\\n 'completion[Output shell completion scripts]'\n ;;\n args)\n case \\$words[2] in\n issue)\n _values 'subcommand' \\\\\n 'list[List issues]' \\\\\n 'view[View issue details]' \\\\\n 'get[Get issue details]' \\\\\n 'create[Create a new issue]' \\\\\n 'archive[Archive an issue]' \\\\\n 'unarchive[Unarchive an issue]' \\\\\n 'update[Update an issue]' \\\\\n 'delete[Delete an issue]' \\\\\n 'assign[Assign an issue]' \\\\\n 'unassign[Remove assignee]'\n ;;\n project)\n _values 'subcommand' \\\\\n 'list[List projects]' \\\\\n 'create[Create a project]' \\\\\n 'view[View project details]' \\\\\n 'get[Get project details]'\n ;;\n milestone)\n _values 'subcommand' \\\\\n 'list[List milestones]' \\\\\n 'create[Create a milestone]'\n ;;\n config)\n _values 'subcommand' \\\\\n 'show[Show configuration]' \\\\\n 'set-org[Set default org slug]' \\\\\n 'set-team[Set default team]' \\\\\n 'set-base-url[Set default API base URL]'\n ;;\n auth)\n _values 'subcommand' \\\\\n 'login[Log in]' \\\\\n 'logout[Log out]' \\\\\n 'status[Show auth status]' \\\\\n 'profiles[List auth profiles]' \\\\\n 'use[Set active auth profile]'\n ;;\n webhook)\n _values 'subcommand' \\\\\n 'list[List webhooks]' \\\\\n 'create[Create a webhook]' \\\\\n 'delete[Delete a webhook]'\n ;;\n feedback)\n _values 'subcommand' \\\\\n 'add[Record feedback]' \\\\\n 'list[List local feedback]'\n ;;\n completion)\n _values 'shell' 'bash' 'zsh'\n ;;\n esac\n ;;\n esac\n}\n\n_atoll \"\\$@\"\n`;\n}\n\nfunction addJsonOptionToSubcommands(command: Command): void {\n for (const subcommand of command.commands) {\n if (!subcommand.options.some((option) => option.long === '--json')) {\n subcommand.option('--json', 'Emit machine-readable JSON');\n }\n addJsonOptionToSubcommands(subcommand);\n }\n}\n","import { Command } from 'commander';\nimport {\n ensureProfile,\n getProfile,\n readConfig,\n resolveConfig,\n writeConfig,\n} from '../lib/config.js';\nimport { AtollClient } from '../lib/client.js';\nimport { output, outputError } from '../lib/output.js';\n\nexport const authCommand = new Command('auth')\n .description('Manage authentication');\n\nauthCommand\n .command('login')\n .description('Save an API key to ~/.atoll/config.json')\n .requiredOption('--key <API_KEY>', 'API key to store')\n .option('--profile <name>', 'Profile name to store this API key under')\n .option('--org <slug>', 'Default org slug for this profile')\n .option('--team <team>', 'Default team slug or ID for this profile')\n .option('--base-url <url>', 'Base URL for this profile')\n .action((opts: { key: string; profile?: string; org?: string; team?: string; baseUrl?: string }) => {\n const config = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || config.activeProfile;\n const orgSlug = opts.org ?? process.env.ATOLL_CLI_ORG;\n const defaultTeam = opts.team ?? process.env.ATOLL_CLI_TEAM;\n const baseUrl = opts.baseUrl;\n\n if (profileName) {\n const profile = ensureProfile(config, profileName);\n profile.apiKey = opts.key;\n if (orgSlug !== undefined) profile.orgSlug = orgSlug;\n if (defaultTeam !== undefined) profile.defaultTeam = defaultTeam;\n if (baseUrl !== undefined) profile.baseUrl = baseUrl;\n config.activeProfile = profileName;\n } else {\n config.apiKey = opts.key;\n if (orgSlug !== undefined) config.orgSlug = orgSlug;\n if (defaultTeam !== undefined) config.defaultTeam = defaultTeam;\n if (baseUrl !== undefined) config.baseUrl = baseUrl;\n }\n\n writeConfig(config);\n output(\n { status: 'ok', message: 'API key saved', profile: profileName ?? null },\n profileName\n ? `✓ API key saved to profile \"${profileName}\" in ~/.atoll/config.json`\n : '✓ API key saved to ~/.atoll/config.json',\n );\n });\n\nauthCommand\n .command('status')\n .description('Show current auth status and user info')\n .option('--profile <name>', 'Profile name to check')\n .action(async (opts: { profile?: string }) => {\n const resolved = resolveConfig({ profile: opts.profile });\n const apiKey = resolved.apiKey;\n if (!apiKey) {\n const suffix = resolved.profile ? ` for profile \"${resolved.profile}\"` : '';\n outputError(`Not authenticated${suffix}. Run \\`atoll auth login --key <API_KEY>\\` or set ATOLL_API_KEY.`);\n process.exit(1);\n }\n\n try {\n const client = new AtollClient({ apiKey, baseUrl: resolved.baseUrl, profile: opts.profile });\n const me = await client.get<{\n user?: { email?: string; name?: string };\n org?: { slug?: string; name?: string };\n }>('/api/auth/me');\n\n output(\n { status: 'authenticated', ...me },\n [\n '✓ Authenticated',\n resolved.profile ? ` Profile: ${resolved.profile}` : null,\n me.user?.name ? ` User: ${me.user.name}` : null,\n me.user?.email ? ` Email: ${me.user.email}` : null,\n me.org?.name ? ` Org: ${me.org.name} (${me.org.slug})` : null,\n ]\n .filter(Boolean)\n .join('\\n'),\n );\n } catch (err) {\n const msg = (err as Error).message || '';\n if (/API (401|403):/.test(msg)) {\n outputError('API key is invalid or expired');\n process.exit(1);\n }\n outputError(`Auth check failed: ${msg}`);\n process.exit(1);\n }\n });\n\nauthCommand\n .command('profiles')\n .description('List saved auth profiles')\n .action(() => {\n const config = readConfig();\n const activeProfile = config.activeProfile;\n const profiles = Object.entries(config.profiles ?? {})\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([name, profile]) => ({\n name,\n active: name === activeProfile,\n apiKeySet: !!profile.apiKey,\n orgSlug: profile.orgSlug ?? null,\n defaultTeam: profile.defaultTeam ?? null,\n baseUrl: profile.baseUrl ?? null,\n }));\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n output({ activeProfile: activeProfile ?? null, profiles }, '');\n return;\n }\n\n if (profiles.length === 0) {\n console.log('No profiles configured.');\n return;\n }\n\n for (const profile of profiles) {\n const marker = profile.active ? '*' : ' ';\n const parts = [\n `${marker} ${profile.name}`,\n profile.apiKeySet ? 'key=set' : 'key=not set',\n profile.orgSlug ? `org=${profile.orgSlug}` : null,\n profile.defaultTeam ? `team=${profile.defaultTeam}` : null,\n profile.baseUrl ? `baseUrl=${profile.baseUrl}` : null,\n ].filter(Boolean);\n console.log(parts.join(' '));\n }\n });\n\nauthCommand\n .command('use <profile>')\n .description('Set the active auth profile')\n .action((profileName: string) => {\n const config = readConfig();\n if (!getProfile(config, profileName)) {\n outputError(`Profile \"${profileName}\" not found. Run \\`atoll auth login --profile ${profileName} --key <API_KEY>\\` first.`);\n process.exit(1);\n }\n\n config.activeProfile = profileName;\n writeConfig(config);\n output(\n { activeProfile: profileName },\n `✓ Active profile set to \"${profileName}\"`,\n );\n });\n\nauthCommand\n .command('logout')\n .description('Remove stored API key')\n .option('--profile <name>', 'Profile name to log out')\n .action((opts: { profile?: string }) => {\n // Only clear the API key — preserve org/team config settings.\n const config = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || config.activeProfile;\n\n if (profileName) {\n const profile = getProfile(config, profileName);\n if (!profile) {\n outputError(`Profile \"${profileName}\" not found.`);\n process.exit(1);\n }\n delete profile.apiKey;\n } else {\n delete config.apiKey;\n }\n\n writeConfig(config);\n output(\n { status: 'ok', message: 'Logged out', profile: profileName ?? null },\n profileName\n ? `✓ Logged out of profile \"${profileName}\" — API key removed (org/team config preserved)`\n : '✓ Logged out — API key removed (org/team config preserved)',\n );\n });\n","import { resolveConfig } from './config.js';\nimport { outputError } from './output.js';\n\nconst DEFAULT_BASE_URL = 'https://atollhq.com';\n\nexport class AtollClient {\n readonly baseUrl: string;\n private apiKey: string;\n\n constructor(opts?: { baseUrl?: string; apiKey?: string; profile?: string }) {\n const config = resolveConfig({ profile: opts?.profile });\n this.baseUrl = opts?.baseUrl || config.baseUrl || DEFAULT_BASE_URL;\n\n const key = opts?.apiKey || config.apiKey;\n if (!key) {\n const suffix = config.profile ? ` for profile \"${config.profile}\"` : '';\n outputError(`No API key found${suffix}. Run \\`atoll auth login --key <API_KEY>\\` or set ATOLL_API_KEY.`);\n process.exit(1);\n }\n this.apiKey = key;\n }\n\n async request<T = unknown>(path: string, init?: RequestInit): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n const res = await fetch(url, {\n ...init,\n headers: {\n 'Authorization': `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n ...init?.headers,\n },\n });\n\n if (!res.ok) {\n const body = await res.text();\n throw new Error(`API ${res.status}: ${body}`);\n }\n\n if (res.status === 204) return undefined as T;\n const text = await res.text();\n if (!text) return undefined as T;\n return JSON.parse(text) as T;\n }\n\n async get<T = unknown>(path: string): Promise<T> {\n return this.request<T>(path, { method: 'GET' });\n }\n\n async post<T = unknown>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, {\n method: 'POST',\n body: body ? JSON.stringify(body) : undefined,\n });\n }\n\n async patch<T = unknown>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, {\n method: 'PATCH',\n body: body ? JSON.stringify(body) : undefined,\n });\n }\n\n async delete<T = unknown>(path: string): Promise<T> {\n return this.request<T>(path, { method: 'DELETE' });\n }\n}\n","export type OutputRecord = Record<string, unknown>;\n\nexport function isJsonMode(): boolean {\n if (process.env.OUTPUT_FORMAT === 'json') return true;\n return !process.stdout.isTTY;\n}\n\nexport function enableJsonMode(): void {\n process.env.OUTPUT_FORMAT = 'json';\n}\n\nexport function output(data: OutputRecord, humanReadable: string): void {\n if (isJsonMode()) {\n process.stdout.write(JSON.stringify(data) + '\\n');\n } else {\n console.log(humanReadable);\n }\n}\n\nexport function outputJson(data: unknown): void {\n process.stdout.write(JSON.stringify(data) + '\\n');\n}\n\nexport function outputError(message: string): void {\n if (isJsonMode()) {\n process.stderr.write(JSON.stringify({ error: message }) + '\\n');\n } else {\n console.error(`Error: ${message}`);\n }\n}\n\nexport const DEFAULT_LIST_LIMIT = 25;\nexport const MAX_LIST_LIMIT = 100;\n\nexport function normalizeLimit(limit: number | undefined, defaultLimit = DEFAULT_LIST_LIMIT): number {\n if (limit === undefined || Number.isNaN(limit)) return defaultLimit;\n if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIST_LIMIT) {\n outputError(`--limit must be an integer from 1 to ${MAX_LIST_LIMIT} (got: \"${limit}\")`);\n process.exit(2);\n }\n return limit;\n}\n\nexport function normalizeOffset(offset: number | undefined): number {\n if (offset === undefined || Number.isNaN(offset)) return 0;\n if (!Number.isInteger(offset) || offset < 0) {\n outputError(`--offset must be a non-negative integer (got: \"${offset}\")`);\n process.exit(2);\n }\n return offset;\n}\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { isJsonMode, normalizeLimit, normalizeOffset, output, outputError, outputJson } from '../lib/output.js';\nimport { bold, dim, gray, statusColor, priorityIcon, success } from '../lib/colors.js';\nimport { buildIssueUrl, derivePrefix } from '../lib/urls.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface Issue {\n id: string;\n title: string;\n description?: string | null;\n status: string;\n priority: number;\n number?: number | null;\n assignee_id?: string | null;\n team_id?: string | null;\n project_id?: string | null;\n due_date?: string | null;\n created_at?: string;\n updated_at?: string;\n sub_tasks?: unknown[];\n issue_labels?: { label_id: string; labels: { name: string; color: string } }[];\n}\n\ninterface ListResponse {\n issues: Issue[];\n total: number;\n limit: number;\n offset: number;\n}\n\ninterface SingleResponse {\n issue: Issue;\n}\n\ninterface Org {\n id: string;\n name: string;\n slug: string;\n}\n\ninterface ProjectSummary {\n id: string;\n name: string;\n slug?: string | null;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nexport function handleApiError(err: unknown): never {\n const msg = (err as Error).message ?? String(err);\n if (/API 401\\b/.test(msg)) {\n outputError('Session expired — run `atoll auth login` to re-authenticate.');\n } else if (/API 403\\b/.test(msg)) {\n outputError('Permission denied. You do not have access to this resource.');\n } else {\n outputError(msg);\n }\n process.exit(1);\n}\n\nconst VALID_STATUSES = ['backlog', 'todo', 'in_progress', 'done', 'cancelled'] as const;\nconst PRIORITY_LABELS: Record<number, string> = { 0: 'Urgent', 1: 'High', 2: 'Medium', 3: 'Low' };\n\nexport async function resolveOrg(client: AtollClient, orgSlugOverride?: string): Promise<Org> {\n const { orgs } = await client.get<{ orgs: Org[] }>('/api/orgs');\n if (!orgs || orgs.length === 0) {\n outputError('No organizations found. Create one first.');\n process.exit(1);\n }\n if (orgs.length === 1) return orgs[0];\n\n // Resolve slug: explicit override -> selected profile/env -> legacy config.\n const { resolveConfig } = await import('../lib/config.js');\n const config = resolveConfig();\n const slug = orgSlugOverride ?? config.orgSlug;\n\n if (slug) {\n const match = orgs.find((o) => o.slug === slug);\n if (match) return match;\n outputError(`Org \"${slug}\" not found. Available: ${orgs.map((o) => o.slug).join(', ')}`);\n process.exit(1);\n }\n outputError(`Multiple orgs found. Use --org <slug> or run \\`atoll config set-org <slug>\\`. Available: ${orgs.map((o) => o.slug).join(', ')}`);\n process.exit(1);\n}\n\nexport async function resolveOrgId(client: AtollClient, orgSlugOverride?: string): Promise<string> {\n return (await resolveOrg(client, orgSlugOverride)).id;\n}\n\n/**\n * Fetch the org's projects and return a map keyed by project id.\n * Used to derive PREFIX-NUMBER identifiers and canonical URLs for issues.\n */\nexport async function fetchProjectMap(\n client: AtollClient,\n orgId: string,\n): Promise<Map<string, ProjectSummary>> {\n const { projects } = await client.get<{ projects: ProjectSummary[] }>(\n `/api/orgs/${orgId}/projects`,\n );\n const map = new Map<string, ProjectSummary>();\n for (const p of projects ?? []) map.set(p.id, p);\n return map;\n}\n\nexport interface IssueWithUrl extends Issue {\n url: string | null;\n}\n\nexport function attachIssueUrl(\n issue: Issue,\n baseUrl: string,\n orgSlug: string,\n projects: Map<string, ProjectSummary>,\n): IssueWithUrl {\n const project = issue.project_id ? projects.get(issue.project_id) : undefined;\n return {\n ...issue,\n url: buildIssueUrl(baseUrl, orgSlug, project?.slug, issue.number ?? null),\n };\n}\n\n/**\n * Resolve a human-readable identifier (e.g. \"ATOLL-42\" or \"42\") to a UUID.\n * Falls back to treating the identifier as a UUID if it doesn't match the pattern.\n */\nexport async function resolveIssueId(client: AtollClient, orgId: string, identifier: string): Promise<string> {\n // If it looks like a UUID already, return as-is\n if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(identifier)) {\n return identifier;\n }\n\n // Extract number from PREFIX-NUMBER or plain number. Prefix may contain\n // digits (e.g. \"Q2-42\") since derivePrefix preserves alphanumerics.\n const match = identifier.match(/^(?:[A-Za-z0-9]+-)?(\\d+)$/);\n if (!match) {\n outputError(`Invalid identifier: \"${identifier}\". Use a UUID or PREFIX-NUMBER (e.g. ATOLL-42).`);\n process.exit(2);\n }\n\n const num = parseInt(match[1], 10);\n\n // Use number filter to avoid pagination issues with large issue lists\n const { issues } = await client.get<ListResponse>(\n `/api/orgs/${orgId}/issues?number=${num}&limit=1`,\n );\n if (issues.length > 0 && issues[0].number === num) {\n return issues[0].id;\n }\n\n // Fallback: paginate through all issues if the API doesn't support ?number= filtering\n let offset = 0;\n const pageSize = 100;\n while (true) {\n const page = await client.get<ListResponse>(\n `/api/orgs/${orgId}/issues?limit=${pageSize}&offset=${offset}`,\n );\n const found = page.issues.find((i) => i.number === num);\n if (found) return found.id;\n offset += pageSize;\n if (offset >= page.total) break;\n }\n\n outputError(`Issue #${num} not found.`);\n process.exit(1);\n}\n\nfunction formatIdentifier(issue: Issue, projects?: Map<string, ProjectSummary>): string {\n if (issue.number == null) return issue.id.slice(0, 8);\n if (projects && issue.project_id) {\n const project = projects.get(issue.project_id);\n if (project?.name) return `${derivePrefix(project.name)}-${issue.number}`;\n }\n return `ATOLL-${issue.number}`;\n}\n\nfunction padEnd(str: string, len: number): string {\n return str.length >= len ? str.slice(0, len) : str + ' '.repeat(len - str.length);\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport const issueCommand = new Command('issue')\n .description('Manage issues')\n .addHelpText('after', `\nExamples:\n $ atoll issue list\n $ atoll issue list --status in_progress --priority 1\n $ atoll issue view ATOLL-42\n $ atoll issue create --title \"Fix login\" --priority 1 --status todo\n $ atoll issue update ATOLL-42 --status done\n $ atoll issue assign ATOLL-42 --to <user-id>`);\n\n// ---- list ----\nissueCommand\n .command('list')\n .description('List issues')\n .option('--status <status>', `Filter by status (${VALID_STATUSES.join(', ')})`)\n .option('--assignee <user>', 'Filter by assignee ID')\n .option('--priority <n>', 'Filter by priority (0=urgent, 1=high, 2=medium, 3=low)', parseInt)\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .option('--offset <n>', 'Results offset for pagination', parseInt)\n .action(async (opts: { status?: string; assignee?: string; priority?: number; limit?: number; offset?: number }) => {\n try {\n if (opts.status && !VALID_STATUSES.includes(opts.status as typeof VALID_STATUSES[number])) {\n outputError(`Invalid status \"${opts.status}\". Must be one of: ${VALID_STATUSES.join(', ')}`);\n process.exit(2);\n }\n if (opts.priority !== undefined && ![0, 1, 2, 3].includes(opts.priority)) {\n outputError('Priority must be 0 (urgent), 1 (high), 2 (medium), or 3 (low).');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const limit = normalizeLimit(opts.limit);\n const offset = normalizeOffset(opts.offset);\n\n const params = new URLSearchParams();\n if (opts.status) params.set('status', opts.status);\n if (opts.assignee) params.set('assigneeId', opts.assignee);\n if (opts.priority !== undefined) params.set('priority', String(opts.priority));\n params.set('limit', String(limit));\n if (offset > 0) params.set('offset', String(offset));\n\n const qs = params.toString();\n const [data, projects] = await Promise.all([\n client.get<ListResponse>(`/api/orgs/${org.id}/issues${qs ? `?${qs}` : ''}`),\n fetchProjectMap(client, org.id),\n ]);\n\n const enriched = data.issues.map((issue) =>\n attachIssueUrl(issue, client.baseUrl, org.slug, projects),\n );\n\n if (isJsonMode()) {\n outputJson({\n resource: 'issues',\n items: enriched,\n total: data.total,\n limit: data.limit,\n offset: data.offset,\n nextOffset: data.offset + data.limit < data.total ? data.offset + data.limit : null,\n truncated: data.offset + data.limit < data.total,\n hint: data.offset + data.limit < data.total ? 'Use --offset with nextOffset to continue.' : null,\n });\n return;\n }\n\n // TTY: table\n if (enriched.length === 0) {\n console.log('No issues found.');\n return;\n }\n\n const header = bold(`${padEnd('ID', 10)} ${padEnd('STATUS', 14)} ${padEnd('PRI', 8)} TITLE`);\n console.log(header);\n console.log('─'.repeat(82));\n for (const issue of enriched) {\n const id = formatIdentifier(issue, projects);\n const pri = PRIORITY_LABELS[issue.priority] ?? String(issue.priority);\n const title = issue.title.length > 50 ? issue.title.slice(0, 47) + '…' : issue.title;\n const icon = priorityIcon(issue.priority);\n console.log(`${padEnd(id, 10)} ${statusColor(issue.status, padEnd(issue.status, 14))} ${icon} ${padEnd(pri, 8)} ${title}`);\n }\n console.log(dim(`${enriched.length} of ${data.total} issues`));\n if (data.offset + data.limit < data.total) {\n console.log(dim(`Next: atoll issue list --offset ${data.offset + data.limit} --limit ${data.limit}`));\n }\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- view ----\nasync function viewIssue(identifier: string): Promise<void> {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n const [{ issue }, projects] = await Promise.all([\n client.get<SingleResponse>(`/api/orgs/${org.id}/issues/${issueId}`),\n fetchProjectMap(client, org.id),\n ]);\n\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n // JSON mode\n if (isJsonMode()) {\n outputJson(enriched);\n return;\n }\n\n // TTY: formatted detail\n const id = formatIdentifier(enriched, projects);\n const pri = PRIORITY_LABELS[enriched.priority] ?? String(enriched.priority);\n console.log(`${bold(id)} ${enriched.title}`);\n console.log(`Status: ${statusColor(enriched.status, enriched.status)} Priority: ${priorityIcon(enriched.priority)} ${pri}`);\n if (enriched.url) console.log(`URL: ${enriched.url}`);\n if (enriched.assignee_id) console.log(`Assignee: ${enriched.assignee_id}`);\n if (enriched.due_date) console.log(`Due: ${enriched.due_date}`);\n if (enriched.description) {\n console.log(`\\n${enriched.description}`);\n }\n if (enriched.issue_labels && enriched.issue_labels.length > 0) {\n const labels = enriched.issue_labels.map((l) => l.labels.name).join(', ');\n console.log(`Labels: ${labels}`);\n }\n if (enriched.sub_tasks && Array.isArray(enriched.sub_tasks) && enriched.sub_tasks.length > 0) {\n console.log(`\\nSubtasks: ${enriched.sub_tasks.length}`);\n }\n if (enriched.created_at) console.log(dim(`Created: ${enriched.created_at}`));\n if (enriched.updated_at) console.log(dim(`Updated: ${enriched.updated_at}`));\n } catch (err) {\n handleApiError(err);\n }\n}\n\nissueCommand\n .command('view <identifier>')\n .description('View issue details (UUID or PREFIX-NUMBER e.g. ATOLL-42)')\n .action(viewIssue);\n\nissueCommand\n .command('get <identifier>')\n .description('Get issue details (UUID or PREFIX-NUMBER e.g. ATOLL-42)')\n .action(viewIssue);\n\n// ---- create ----\nissueCommand\n .command('create')\n .description('Create a new issue')\n .requiredOption('--title <title>', 'Issue title')\n .option('--description <text>', 'Issue description')\n .option('--status <status>', `Status (${VALID_STATUSES.join(', ')})`)\n .option('--priority <n>', 'Priority (0=urgent, 1=high, 2=medium, 3=low)', parseInt)\n .action(async (opts: { title: string; description?: string; status?: string; priority?: number }) => {\n try {\n if (opts.status && !VALID_STATUSES.includes(opts.status as typeof VALID_STATUSES[number])) {\n outputError(`Invalid status \"${opts.status}\". Must be one of: ${VALID_STATUSES.join(', ')}`);\n process.exit(2);\n }\n if (opts.priority !== undefined && ![0, 1, 2, 3].includes(opts.priority)) {\n outputError('Priority must be 0 (urgent), 1 (high), 2 (medium), or 3 (low).');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const org = await resolveOrg(client);\n\n const body: Record<string, unknown> = { title: opts.title };\n if (opts.description !== undefined) body.description = opts.description;\n if (opts.status) body.status = opts.status;\n if (opts.priority !== undefined) body.priority = opts.priority;\n\n const { issue } = await client.post<SingleResponse>(`/api/orgs/${org.id}/issues`, body);\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Created ${formatIdentifier(enriched, projects)}: ${enriched.title}${enriched.url ? `\\n${enriched.url}` : ''}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- update ----\nissueCommand\n .command('update <identifier>')\n .description('Update an issue')\n .option('--title <t>', 'New title')\n .option('--status <s>', `New status (${VALID_STATUSES.join(', ')})`)\n .option('--priority <p>', 'New priority (0-3)', parseInt)\n .action(async (identifier: string, opts: { title?: string; status?: string; priority?: number }) => {\n try {\n if (opts.status && !VALID_STATUSES.includes(opts.status as typeof VALID_STATUSES[number])) {\n outputError(`Invalid status \"${opts.status}\". Must be one of: ${VALID_STATUSES.join(', ')}`);\n process.exit(2);\n }\n if (opts.priority !== undefined && ![0, 1, 2, 3].includes(opts.priority)) {\n outputError('Priority must be 0-3.');\n process.exit(2);\n }\n\n const body: Record<string, unknown> = {};\n if (opts.title !== undefined) body.title = opts.title;\n if (opts.status) body.status = opts.status;\n if (opts.priority !== undefined) body.priority = opts.priority;\n\n if (Object.keys(body).length === 0) {\n outputError('No fields to update. Provide --title, --status, or --priority.');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n const { issue } = await client.patch<SingleResponse>(`/api/orgs/${org.id}/issues/${issueId}`, body);\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Updated ${formatIdentifier(enriched, projects)}: ${enriched.title}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- delete ----\nissueCommand\n .command('delete <identifier>')\n .description('Delete an issue (admin/owner only)')\n .option('--force', 'Permanently delete the issue')\n .option('--dry-run', 'Show what would be deleted without changing anything')\n .action(async (identifier: string, opts: { force?: boolean; dryRun?: boolean }) => {\n try {\n if (!opts.dryRun && !opts.force) {\n outputError('Permanent issue deletion requires --force. Prefer `atoll issue archive <identifier>` for reversible removal.');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n if (opts.dryRun) {\n output(\n { dryRun: true, wouldDelete: { type: 'issue', id: issueId, identifier } },\n `Would permanently delete issue ${identifier} (${issueId})`,\n );\n return;\n }\n\n await client.delete(`/api/orgs/${orgId}/issues/${issueId}`);\n\n output(\n { success: true, id: issueId },\n success(`Deleted issue ${identifier}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- archive ----\nissueCommand\n .command('archive <identifier>')\n .description('Archive an issue (reversible soft delete)')\n .option('--dry-run', 'Show what would be archived without changing anything')\n .action(async (identifier: string, opts: { dryRun?: boolean }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n if (opts.dryRun) {\n output(\n { dryRun: true, wouldArchive: { type: 'issue', id: issueId, identifier } },\n `Would archive issue ${identifier} (${issueId})`,\n );\n return;\n }\n\n await client.post(`/api/orgs/${orgId}/issues/${issueId}/archive`);\n output(\n { success: true, id: issueId, archived: true },\n success(`Archived issue ${identifier}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- unarchive ----\nissueCommand\n .command('unarchive <identifier>')\n .description('Unarchive an issue')\n .option('--dry-run', 'Show what would be unarchived without changing anything')\n .action(async (identifier: string, opts: { dryRun?: boolean }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n if (opts.dryRun) {\n output(\n { dryRun: true, wouldUnarchive: { type: 'issue', id: issueId, identifier } },\n `Would unarchive issue ${identifier} (${issueId})`,\n );\n return;\n }\n\n await client.delete(`/api/orgs/${orgId}/issues/${issueId}/archive`);\n output(\n { success: true, id: issueId, archived: false },\n success(`Unarchived issue ${identifier}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- assign ----\nissueCommand\n .command('assign <identifier>')\n .description('Assign an issue to a user or agent')\n .requiredOption('--to <user>', 'User/agent ID or \"self\" for yourself')\n .action(async (identifier: string, opts: { to: string }) => {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n let assigneeId = opts.to;\n if (assigneeId === 'self') {\n const me = await client.get<{ auth?: { userId?: string } }>('/api/auth/me');\n // For agent keys, auth.userId IS the org_members.id directly\n const callerUserId = me.auth?.userId;\n if (!callerUserId) {\n outputError('Could not resolve your user ID.');\n process.exit(1);\n }\n // Agent callers: userId is the member id — use directly\n // Human callers: userId is the supabase auth id — look up member id\n const { members } = await client.get<{ members: { id: string; user_id: string }[] }>(\n `/api/orgs/${org.id}/members`,\n );\n const member = members.find((m) => m.id === callerUserId || m.user_id === callerUserId);\n if (!member) {\n outputError('You are not a member of this organisation.');\n process.exit(1);\n }\n assigneeId = member.id;\n }\n\n const { issue } = await client.patch<SingleResponse>(\n `/api/orgs/${org.id}/issues/${issueId}`,\n { assignee_id: assigneeId },\n );\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Assigned ${formatIdentifier(enriched, projects)} to ${opts.to}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- unassign ----\nissueCommand\n .command('unassign <identifier>')\n .description('Remove assignee from an issue')\n .action(async (identifier: string) => {\n try {\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const issueId = await resolveIssueId(client, org.id, identifier);\n\n const { issue } = await client.patch<SingleResponse>(\n `/api/orgs/${org.id}/issues/${issueId}`,\n { assignee_id: null },\n );\n const projects = await fetchProjectMap(client, org.id);\n const enriched = attachIssueUrl(issue, client.baseUrl, org.slug, projects);\n\n output(\n { issue: enriched },\n success(`Unassigned ${formatIdentifier(enriched, projects)}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n","/**\n * TTY-aware ANSI color helpers.\n * Colors are only emitted when stdout is a TTY and OUTPUT_FORMAT !== 'json'.\n */\n\nfunction isTTY(): boolean {\n return process.stdout.isTTY === true && process.env.OUTPUT_FORMAT !== 'json';\n}\n\nfunction ansi(code: string, text: string): string {\n if (!isTTY()) return text;\n return `\\x1b[${code}m${text}\\x1b[0m`;\n}\n\n// Basic colors\nexport const bold = (t: string) => ansi('1', t);\nexport const dim = (t: string) => ansi('2', t);\nexport const red = (t: string) => ansi('31', t);\nexport const green = (t: string) => ansi('32', t);\nexport const yellow = (t: string) => ansi('33', t);\nexport const blue = (t: string) => ansi('34', t);\nexport const cyan = (t: string) => ansi('36', t);\nexport const gray = (t: string) => ansi('90', t);\nexport const white = (t: string) => ansi('37', t);\n\n// Status badge colors\nexport function statusColor(status: string, text: string): string {\n switch (status) {\n case 'done': return green(text);\n case 'in_progress': return yellow(text);\n case 'backlog':\n case 'todo': return gray(text);\n case 'cancelled': return red(text);\n default: return text;\n }\n}\n\n// Priority icons\nexport function priorityIcon(priority: number): string {\n switch (priority) {\n case 0: return red('⚠⚠⚠'); // urgent\n case 1: return yellow('▄▆█'); // high\n case 2: return cyan('▄▆'); // medium\n case 3: return dim('---'); // low\n default: return String(priority);\n }\n}\n\n// Helpers\nexport const success = (msg: string) => green(`✓ ${msg}`);\nexport const error = (msg: string) => red(`Error: ${msg}`);\n\n// Raw ANSI codes (for use in format strings where needed)\nexport const RESET = isTTY() ? '\\x1b[0m' : '';\nexport const BOLD = isTTY() ? '\\x1b[1m' : '';\nexport const DIM = isTTY() ? '\\x1b[2m' : '';\n","// URL builders for Atoll canonical web routes.\n// Mirrors the routing and identifier conventions in agent-pm.\n\n/**\n * Derive a short uppercase prefix from a project name.\n * Mirrors agent-pm/lib/issue-identifier.ts — keep in sync.\n */\nexport function derivePrefix(name: string): string {\n const cleaned = name.replace(/[^a-zA-Z0-9\\s]/g, ' ').trim();\n const words = cleaned.split(/\\s+/).filter(Boolean);\n\n if (words.length === 0) return 'TSK';\n\n if (words.length >= 2) {\n return words\n .slice(0, 5)\n .map((w) => w[0])\n .join('')\n .toUpperCase();\n }\n\n const word = words[0];\n if (word.length <= 4) return word.toUpperCase();\n return word.slice(0, 3).toUpperCase();\n}\n\nexport function issueIdentifier(\n projectName: string | null | undefined,\n issueNumber: number | null | undefined,\n): string | null {\n if (issueNumber == null) return null;\n const prefix = projectName ? derivePrefix(projectName) : 'TSK';\n return `${prefix}-${issueNumber}`;\n}\n\nfunction stripTrailingSlash(baseUrl: string): string {\n return baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n}\n\nexport function buildIssueUrl(\n baseUrl: string,\n orgSlug: string,\n projectSlug: string | null | undefined,\n issueNumber: number | null | undefined,\n): string | null {\n // Use the project-scoped route (/{org}/projects/{projectSlug}/issues/{number})\n // rather than the prefix-based identifier route. The prefix route is\n // ambiguous (two projects can derive the same prefix, and numeric-containing\n // prefixes like \"Q2\" fail the web app's [A-Z]{2,} regex).\n if (!orgSlug || !projectSlug || issueNumber == null) return null;\n return `${stripTrailingSlash(baseUrl)}/${orgSlug}/projects/${projectSlug}/issues/${issueNumber}`;\n}\n\nexport function buildProjectUrl(\n baseUrl: string,\n orgSlug: string,\n projectSlug: string | null | undefined,\n): string | null {\n if (!orgSlug || !projectSlug) return null;\n return `${stripTrailingSlash(baseUrl)}/${orgSlug}/projects/${projectSlug}`;\n}\n\nexport function buildInitiativeUrl(\n baseUrl: string,\n orgSlug: string,\n initiativeId: string | null | undefined,\n): string | null {\n if (!orgSlug || !initiativeId) return null;\n return `${stripTrailingSlash(baseUrl)}/${orgSlug}/initiatives/${initiativeId}`;\n}\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { isJsonMode, normalizeLimit, output, outputError, outputJson } from '../lib/output.js';\nimport { handleApiError, resolveOrgId, resolveIssueId } from './issue.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface CommentAuthor {\n id: string;\n display_name: string;\n type: string;\n avatar_url?: string;\n}\n\ninterface Comment {\n id: string;\n body: string;\n author_id: string;\n author_type?: string;\n author?: CommentAuthor;\n created_at?: string;\n updated_at?: string;\n}\n\ninterface ListCommentsResponse {\n comments: Comment[];\n}\n\ninterface SingleCommentResponse {\n comment: Comment;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst BOLD = '\\x1b[1m';\nconst DIM = '\\x1b[2m';\nconst RESET = '\\x1b[0m';\nconst CYAN = '\\x1b[36m';\n\nfunction formatAuthor(comment: Comment): string {\n const name = comment.author?.display_name ?? comment.author_id;\n const badge = (comment.author?.type ?? comment.author_type) === 'agent' ? ' [agent]' : '';\n return `${name}${badge}`;\n}\n\nfunction formatTimestamp(ts?: string): string {\n if (!ts) return '';\n const d = new Date(ts);\n return d.toLocaleString();\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport const commentCommand = new Command('comment')\n .description('Manage issue comments');\n\n// ---- list ----\ncommentCommand\n .command('list <identifier>')\n .description('List comments on an issue (UUID or PREFIX-NUMBER e.g. ATOLL-42)')\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .action(async (identifier: string, opts: { limit?: number }) => {\n try {\n const limit = normalizeLimit(opts.limit);\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n const data = await client.get<ListCommentsResponse>(\n `/api/orgs/${orgId}/issues/${issueId}/comments`,\n );\n\n const allComments = data.comments ?? [];\n const comments = allComments.slice(0, limit);\n const truncated = allComments.length > comments.length;\n\n if (isJsonMode()) {\n outputJson({\n resource: 'comments',\n items: comments,\n total: allComments.length,\n limit,\n offset: 0,\n nextOffset: null,\n truncated,\n hint: truncated ? 'Increase --limit up to 100 to show more comments.' : null,\n });\n return;\n }\n\n // TTY: human-readable\n if (comments.length === 0) {\n console.log('No comments found.');\n return;\n }\n\n for (const comment of comments) {\n const author = formatAuthor(comment);\n const time = formatTimestamp(comment.created_at);\n console.log(`${BOLD}${CYAN}${author}${RESET} ${DIM}${time}${RESET}`);\n console.log(comment.body);\n console.log();\n }\n console.log(`${DIM}${comments.length} of ${allComments.length} comment(s)${RESET}`);\n if (truncated) console.log(`${DIM}${allComments.length - comments.length} more comment(s) hidden; increase --limit to show more.${RESET}`);\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- add ----\ncommentCommand\n .command('add <identifier>')\n .description('Add a comment to an issue')\n .requiredOption('--body <text>', 'Comment body')\n .action(async (identifier: string, opts: { body: string }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, identifier);\n\n const { comment } = await client.post<SingleCommentResponse>(\n `/api/orgs/${orgId}/issues/${issueId}/comments`,\n { body: opts.body },\n );\n\n output(\n { comment },\n `✓ Comment added to ${identifier}`,\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- update ----\ncommentCommand\n .command('update <comment-id>')\n .description('Update a comment')\n .requiredOption('--body <text>', 'New comment body')\n .requiredOption('--issue <identifier>', 'Issue identifier (e.g. UUID or PREFIX-NUMBER)')\n .action(async (commentId: string, opts: { body: string; issue: string }) => {\n try {\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, opts.issue);\n\n const { comment } = await client.patch<SingleCommentResponse>(\n `/api/orgs/${orgId}/issues/${issueId}/comments/${commentId}`,\n { body: opts.body },\n );\n\n output(\n { comment },\n `✓ Comment ${commentId} updated`,\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- delete ----\ncommentCommand\n .command('delete <comment-id>')\n .description('Delete a comment')\n .requiredOption('--issue <identifier>', 'Issue identifier (e.g. UUID or PREFIX-NUMBER)')\n .option('--force', 'Delete the comment')\n .option('--dry-run', 'Show what would be deleted without changing anything')\n .action(async (commentId: string, opts: { issue: string; force?: boolean; dryRun?: boolean }) => {\n try {\n if (!opts.dryRun && !opts.force) {\n outputError('Comment deletion requires --force.');\n process.exit(2);\n }\n\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n const issueId = await resolveIssueId(client, orgId, opts.issue);\n\n if (opts.dryRun) {\n output(\n { dryRun: true, wouldDelete: { type: 'comment', id: commentId, issueId } },\n `Would delete comment ${commentId} on ${opts.issue}`,\n );\n return;\n }\n\n await client.delete(`/api/orgs/${orgId}/issues/${issueId}/comments/${commentId}`);\n\n output(\n { success: true, id: commentId },\n `✓ Comment ${commentId} deleted`,\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { isJsonMode, normalizeLimit, output, outputError, outputJson } from '../lib/output.js';\nimport { resolveOrg, handleApiError } from './issue.js';\nimport { bold, dim, cyan, green, success } from '../lib/colors.js';\nimport { buildProjectUrl } from '../lib/urls.js';\n\ninterface Project {\n id: string;\n name: string;\n slug?: string | null;\n description?: string | null;\n status: 'active' | 'archived';\n color: string;\n icon: string;\n issueCount?: number;\n completedCount?: number;\n progress?: number;\n created_at?: string;\n}\n\nfunction attachProjectUrl<T extends Project>(project: T, baseUrl: string, orgSlug: string): T & { url: string | null } {\n return { ...project, url: buildProjectUrl(baseUrl, orgSlug, project.slug) };\n}\n\ninterface Issue {\n id: string;\n title: string;\n status: string;\n priority: number;\n number?: number | null;\n}\n\nfunction progressBar(progress: number, width = 20): string {\n const filled = Math.round((progress / 100) * width);\n const empty = width - filled;\n return `[${'█'.repeat(filled)}${'░'.repeat(empty)}] ${progress}%`;\n}\n\nexport const projectCommand = new Command('project')\n .description('Manage projects')\n .addHelpText('after', `\nExamples:\n $ atoll project list\n $ atoll project create --name \"My Project\" --icon 🚀\n $ atoll project view <project-id>`);\n\n// ── atoll project list ──────────────────────────────────────────────────────\n\nprojectCommand\n .command('list')\n .description('List all projects with progress')\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .action(async (opts: { limit?: number }) => {\n const client = new AtollClient();\n try {\n const limit = normalizeLimit(opts.limit);\n const org = await resolveOrg(client);\n const data = await client.get<{ projects: Project[] }>(`/api/orgs/${org.id}/projects`);\n const allProjects = (data.projects ?? []).map((p) => attachProjectUrl(p, client.baseUrl, org.slug));\n const projects = allProjects.slice(0, limit);\n const truncated = allProjects.length > projects.length;\n\n if (isJsonMode()) {\n outputJson({\n resource: 'projects',\n items: projects,\n total: allProjects.length,\n limit,\n offset: 0,\n nextOffset: null,\n truncated,\n hint: truncated ? 'Narrow the request in the API or increase --limit up to 100.' : null,\n });\n return;\n }\n\n if (projects.length === 0) {\n console.log(dim('No projects found.'));\n return;\n }\n\n for (const p of projects) {\n const progress = p.progress ?? 0;\n const bar = progressBar(progress);\n console.log(`${bold(`${p.icon} ${p.name}`)} ${dim(`(${p.id})`)}`);\n if (p.description) console.log(` ${dim(p.description)}`);\n console.log(` ${cyan(bar)} ${p.issueCount ?? 0} issues, ${p.completedCount ?? 0} done`);\n if (p.url) console.log(` ${dim(p.url)}`);\n if (p.status === 'archived') console.log(` ${dim('[archived]')}`);\n console.log('');\n }\n if (truncated) console.log(dim(`${allProjects.length - projects.length} more project(s) hidden; increase --limit to show more.`));\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ── atoll project create ────────────────────────────────────────────────────\n\nprojectCommand\n .command('create')\n .description('Create a new project')\n .requiredOption('--name <name>', 'Project name')\n .option('--description <desc>', 'Project description')\n .option('--color <color>', 'Project color (hex)', '#6366f1')\n .option('--icon <icon>', 'Project icon (emoji)', '📁')\n .action(async (opts) => {\n const client = new AtollClient();\n try {\n const org = await resolveOrg(client);\n const data = await client.post<{ project: Project }>(`/api/orgs/${org.id}/projects`, {\n name: opts.name,\n description: opts.description ?? null,\n color: opts.color,\n icon: opts.icon,\n });\n const project = attachProjectUrl(data.project, client.baseUrl, org.slug);\n\n output(\n { project },\n success(`Created project ${project.icon} ${project.name} (${dim(project.id)})${project.url ? `\\n${project.url}` : ''}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ── atoll project view ──────────────────────────────────────────────────────\n\nasync function viewProject(projectId: string): Promise<void> {\n const client = new AtollClient();\n try {\n const org = await resolveOrg(client);\n const data = await client.get<{ project: Project & { issues: Issue[] } }>(\n `/api/orgs/${org.id}/projects/${projectId}`,\n );\n const p = attachProjectUrl(data.project, client.baseUrl, org.slug);\n\n if (isJsonMode()) {\n outputJson(p);\n return;\n }\n\n const progress = p.progress ?? 0;\n console.log(bold(`${p.icon} ${p.name}`));\n if (p.description) console.log(` ${p.description}`);\n if (p.url) console.log(` ${dim(p.url)}`);\n console.log(` ${cyan(progressBar(progress))}`);\n console.log(` ${(p.issueCount ?? 0)} issues · ${(p.completedCount ?? 0)} completed`);\n console.log('');\n\n const issues: Issue[] = (p as unknown as { issues?: Issue[] }).issues ?? [];\n if (issues.length === 0) {\n console.log(dim('No issues in this project.'));\n return;\n }\n\n console.log(bold('Issues'));\n for (const issue of issues) {\n const num = issue.number ? `#${issue.number}` : issue.id.slice(0, 8);\n console.log(` ${dim(num)} ${issue.title} ${dim(`[${issue.status}]`)}`);\n }\n } catch (err) {\n handleApiError(err);\n }\n}\n\nprojectCommand\n .command('view <projectId>')\n .description('View project details and issues')\n .action(viewProject);\n\nprojectCommand\n .command('get <projectId>')\n .description('Get project details and issues')\n .action(viewProject);\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { isJsonMode, normalizeLimit, output, outputError, outputJson } from '../lib/output.js';\nimport { resolveOrgId, handleApiError } from './issue.js';\nimport { bold, dim, cyan, red, success } from '../lib/colors.js';\n\ninterface Milestone {\n id: string;\n name: string;\n description?: string | null;\n due_date?: string | null;\n status: 'active' | 'closed';\n issueCount?: number;\n completedCount?: number;\n progress?: number;\n isOverdue?: boolean;\n}\n\nfunction progressBar(progress: number, width = 20): string {\n const filled = Math.round((progress / 100) * width);\n const empty = width - filled;\n return `[${'█'.repeat(filled)}${'░'.repeat(empty)}] ${progress}%`;\n}\n\nexport const milestoneCommand = new Command('milestone')\n .description('Manage milestones')\n .addHelpText('after', `\nExamples:\n $ atoll milestone list --project <project-id>\n $ atoll milestone create --project <project-id> --name \"v1.0\" --date 2026-06-01`);\n\n// ── atoll milestone list ────────────────────────────────────────────────────\n\nmilestoneCommand\n .command('list')\n .description('List milestones for a project')\n .requiredOption('--project <id>', 'Project ID')\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .action(async (opts) => {\n const client = new AtollClient();\n try {\n const limit = normalizeLimit(opts.limit);\n const orgId = await resolveOrgId(client);\n const data = await client.get<{ milestones: Milestone[] }>(\n `/api/orgs/${orgId}/projects/${opts.project}/milestones`,\n );\n const allMilestones = data.milestones ?? [];\n const milestones = allMilestones.slice(0, limit);\n const truncated = allMilestones.length > milestones.length;\n\n if (isJsonMode()) {\n outputJson({\n resource: 'milestones',\n items: milestones,\n total: allMilestones.length,\n limit,\n offset: 0,\n nextOffset: null,\n truncated,\n hint: truncated ? 'Narrow the request by project or increase --limit up to 100.' : null,\n });\n return;\n }\n\n if (milestones.length === 0) {\n console.log(dim('No milestones found.'));\n return;\n }\n\n for (const m of milestones) {\n const progress = m.progress ?? 0;\n const bar = progressBar(progress);\n const overdue = m.isOverdue ? ` ${red('[OVERDUE]')}` : '';\n console.log(`${bold(m.name)} ${dim(`(${m.id})`)}${overdue}`);\n if (m.due_date) console.log(` Due: ${m.due_date}`);\n if (m.description) console.log(` ${dim(m.description)}`);\n console.log(` ${cyan(bar)} ${m.issueCount ?? 0} issues, ${m.completedCount ?? 0} done`);\n if (m.status === 'closed') console.log(` ${dim('[closed]')}`);\n console.log('');\n }\n if (truncated) console.log(dim(`${allMilestones.length - milestones.length} more milestone(s) hidden; increase --limit to show more.`));\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ── atoll milestone create ──────────────────────────────────────────────────\n\nmilestoneCommand\n .command('create')\n .description('Create a new milestone')\n .requiredOption('--project <id>', 'Project ID')\n .requiredOption('--name <name>', 'Milestone name')\n .option('--date <YYYY-MM-DD>', 'Due date')\n .option('--description <desc>', 'Description')\n .action(async (opts) => {\n const client = new AtollClient();\n try {\n const orgId = await resolveOrgId(client);\n const data = await client.post<{ milestone: Milestone }>(\n `/api/orgs/${orgId}/projects/${opts.project}/milestones`,\n {\n name: opts.name,\n description: opts.description ?? null,\n dueDate: opts.date ?? null,\n },\n );\n\n output(\n { milestone: data.milestone },\n success(`Milestone created: ${bold(data.milestone.name)} ${dim(`(${data.milestone.id})`)}`),\n );\n if (data.milestone.due_date) {\n console.log(` Due: ${data.milestone.due_date}`);\n }\n } catch (err) {\n handleApiError(err);\n }\n });\n","import { Command } from 'commander';\nimport { ensureProfile, readConfig, resolveConfig, writeConfig } from '../lib/config.js';\nimport { output } from '../lib/output.js';\nimport { success, bold, dim, gray } from '../lib/colors.js';\n\nexport const configCommand = new Command('config')\n .description('Manage CLI configuration (org, team, API key)')\n .addHelpText('after', `\nExamples:\n $ atoll config show\n $ atoll config set-org my-org\n $ atoll config set-team team-abc123\n $ atoll config set-base-url https://atollhq.com`);\n\n// ── atoll config show ───────────────────────────────────────────────────────\n\nconfigCommand\n .command('show')\n .description('Display current configuration')\n .option('--profile <name>', 'Profile name to show')\n .action((opts: { profile?: string }) => {\n const cfg = readConfig();\n const activeProfile = cfg.activeProfile;\n const resolved = resolveConfig({ profile: opts.profile });\n const apiKeySet = !!resolved.apiKey;\n\n if (!process.stdout.isTTY || process.env.OUTPUT_FORMAT === 'json') {\n output(\n {\n activeProfile: activeProfile ?? null,\n selectedProfile: resolved.profile ?? null,\n orgSlug: resolved.orgSlug ?? null,\n defaultTeam: resolved.defaultTeam ?? null,\n baseUrl: resolved.baseUrl ?? null,\n apiKeySet,\n profiles: Object.keys(cfg.profiles ?? {}).sort(),\n },\n '',\n );\n return;\n }\n\n console.log(`${bold('Atoll CLI Configuration')}`);\n console.log(` ${dim('Active profile:')} ${activeProfile ? bold(activeProfile) : gray('(not set)')}`);\n console.log(` ${dim('Selected profile:')} ${resolved.profile ? bold(resolved.profile) : gray('(legacy config)')}`);\n console.log(` ${dim('Org slug:')} ${resolved.orgSlug ? bold(resolved.orgSlug) : gray('(not set)')}`);\n console.log(` ${dim('Default team:')} ${resolved.defaultTeam ? bold(resolved.defaultTeam) : gray('(not set)')}`);\n console.log(` ${dim('Base URL:')} ${resolved.baseUrl ? bold(resolved.baseUrl) : gray('(default)')}`);\n console.log(` ${dim('API key:')} ${apiKeySet ? bold('set') : gray('not set — run `atoll auth login`')}`);\n });\n\n// ── atoll config set-org ────────────────────────────────────────────────────\n\nconfigCommand\n .command('set-org <slug>')\n .description('Set the default organisation slug')\n .option('--profile <name>', 'Profile name to update')\n .action((slug: string, opts: { profile?: string }) => {\n const cfg = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || cfg.activeProfile;\n if (profileName) {\n ensureProfile(cfg, profileName).orgSlug = slug;\n } else {\n cfg.orgSlug = slug;\n }\n writeConfig(cfg);\n\n output(\n { orgSlug: slug, profile: profileName ?? null },\n profileName\n ? success(`Default org for profile \"${profileName}\" set to \"${slug}\"`)\n : success(`Default org set to \"${slug}\"`),\n );\n });\n\n// ── atoll config set-team ───────────────────────────────────────────────────\n\nconfigCommand\n .command('set-team <team>')\n .description('Set the default team slug or ID')\n .option('--profile <name>', 'Profile name to update')\n .action((team: string, opts: { profile?: string }) => {\n const cfg = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || cfg.activeProfile;\n if (profileName) {\n ensureProfile(cfg, profileName).defaultTeam = team;\n } else {\n cfg.defaultTeam = team;\n }\n writeConfig(cfg);\n\n output(\n { defaultTeam: team, profile: profileName ?? null },\n profileName\n ? success(`Default team for profile \"${profileName}\" set to \"${team}\"`)\n : success(`Default team set to \"${team}\"`),\n );\n });\n\n// ── atoll config set-base-url ───────────────────────────────────────────────\n\nconfigCommand\n .command('set-base-url <url>')\n .description('Set the default API base URL')\n .option('--profile <name>', 'Profile name to update')\n .action((url: string, opts: { profile?: string }) => {\n const cfg = readConfig();\n const profileName = opts.profile || process.env.ATOLL_PROFILE || cfg.activeProfile;\n if (profileName) {\n ensureProfile(cfg, profileName).baseUrl = url;\n } else {\n cfg.baseUrl = url;\n }\n writeConfig(cfg);\n\n output(\n { baseUrl: url, profile: profileName ?? null },\n profileName\n ? success(`Base URL for profile \"${profileName}\" set to \"${url}\"`)\n : success(`Base URL set to \"${url}\"`),\n );\n });\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { isJsonMode, normalizeLimit, output, outputError, outputJson } from '../lib/output.js';\nimport { bold, dim, green, gray, success } from '../lib/colors.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ninterface Webhook {\n id: string;\n url: string;\n events: string[];\n enabled: boolean;\n created_at: string;\n}\n\ninterface WebhookListResponse {\n webhooks: Webhook[];\n}\n\ninterface WebhookCreateResponse {\n webhook: Webhook;\n secret: string;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction handleApiError(err: unknown): never {\n const msg = (err as Error).message ?? String(err);\n if (/API 401\\b/.test(msg)) {\n outputError('Session expired — run `atoll auth login` to re-authenticate.');\n } else if (/API 403\\b/.test(msg)) {\n outputError('Permission denied. You do not have access to this resource.');\n } else {\n outputError(msg);\n }\n process.exit(1);\n}\n\nasync function resolveOrgId(client: AtollClient, orgSlugOverride?: string): Promise<string> {\n const { orgs } = await client.get<{ orgs: { id: string; slug: string }[] }>('/api/orgs');\n if (!orgs || orgs.length === 0) {\n outputError('No organizations found.');\n process.exit(1);\n }\n if (orgs.length === 1) return orgs[0].id;\n\n const { resolveConfig } = await import('../lib/config.js');\n const config = resolveConfig();\n const slug = orgSlugOverride ?? config.orgSlug;\n\n if (slug) {\n const match = orgs.find((o) => o.slug === slug);\n if (match) return match.id;\n outputError(`Org \"${slug}\" not found. Available: ${orgs.map((o) => o.slug).join(', ')}`);\n process.exit(1);\n }\n outputError(`Multiple orgs found. Use --org <slug>.`);\n process.exit(1);\n}\n\nfunction padEnd(str: string, len: number): string {\n return str.length >= len ? str.slice(0, len) : str + ' '.repeat(len - str.length);\n}\n\n// ---------------------------------------------------------------------------\n// Commands\n// ---------------------------------------------------------------------------\n\nexport const webhookCommand = new Command('webhook')\n .description('Manage outbound webhooks')\n .addHelpText('after', `\nExamples:\n $ atoll webhook list\n $ atoll webhook create --url https://example.com/hook --events issue.created,issue.updated\n $ atoll webhook delete <id>`);\n\n// ---- list ----\nwebhookCommand\n .command('list')\n .description('List webhooks for the current org')\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .action(async (opts: { limit?: number }) => {\n try {\n const limit = normalizeLimit(opts.limit);\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n\n const data = await client.get<WebhookListResponse>(`/api/webhooks?orgId=${orgId}`);\n const allWebhooks = data.webhooks ?? [];\n const webhooks = allWebhooks.slice(0, limit);\n const truncated = allWebhooks.length > webhooks.length;\n\n if (isJsonMode()) {\n outputJson({\n resource: 'webhooks',\n items: webhooks,\n total: allWebhooks.length,\n limit,\n offset: 0,\n nextOffset: null,\n truncated,\n hint: truncated ? 'Increase --limit up to 100 to show more webhooks.' : null,\n });\n return;\n }\n\n if (webhooks.length === 0) {\n console.log('No webhooks configured.');\n return;\n }\n\n const header = bold(`${padEnd('ID', 38)} ${padEnd('URL', 40)} ${padEnd('EVENTS', 20)} ACTIVE`);\n console.log(header);\n console.log('─'.repeat(100));\n for (const wh of webhooks) {\n const evts = wh.events.length === 0 ? 'all' : wh.events.join(',');\n const active = wh.enabled ? green('yes') : gray('no');\n const url = wh.url.length > 38 ? wh.url.slice(0, 35) + '…' : wh.url;\n const evtStr = evts.length > 18 ? evts.slice(0, 15) + '…' : evts;\n console.log(`${padEnd(wh.id.slice(0, 36), 38)} ${padEnd(url, 40)} ${padEnd(evtStr, 20)} ${active}`);\n }\n console.log(dim(`${webhooks.length} of ${allWebhooks.length} webhook(s)`));\n if (truncated) console.log(dim(`${allWebhooks.length - webhooks.length} more webhook(s) hidden; increase --limit to show more.`));\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- create ----\nwebhookCommand\n .command('create')\n .description('Create a new webhook')\n .requiredOption('--url <url>', 'Payload URL (HTTPS)')\n .option('--events <events>', 'Comma-separated event types (default: all)', '')\n .action(async (opts: { url: string; events: string }) => {\n try {\n if (!opts.url.startsWith('https://')) {\n outputError('URL must use HTTPS.');\n process.exit(2);\n }\n\n const events = opts.events\n ? opts.events.split(',').map((e) => e.trim()).filter(Boolean)\n : [];\n\n const client = new AtollClient();\n const orgId = await resolveOrgId(client);\n\n const data = await client.post<WebhookCreateResponse>(\n `/api/webhooks?orgId=${orgId}`,\n { url: opts.url, events },\n );\n\n output(\n { webhook: data.webhook, secret: data.secret },\n [\n success(`Created webhook ${data.webhook.id}`),\n '',\n bold('Signing secret (save this — shown only once):'),\n ` ${data.secret}`,\n ].join('\\n'),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n\n// ---- delete ----\nwebhookCommand\n .command('delete <id>')\n .description('Delete a webhook')\n .option('--force', 'Delete the webhook')\n .option('--dry-run', 'Show what would be deleted without changing anything')\n .action(async (id: string, opts: { force?: boolean; dryRun?: boolean }) => {\n try {\n if (!opts.dryRun && !opts.force) {\n outputError('Webhook deletion requires --force.');\n process.exit(2);\n }\n\n const client = new AtollClient();\n if (opts.dryRun) {\n output(\n { dryRun: true, wouldDelete: { type: 'webhook', id } },\n `Would delete webhook ${id}`,\n );\n return;\n }\n await client.delete(`/api/webhooks/${id}`);\n\n output(\n { success: true, id },\n success(`Deleted webhook ${id}`),\n );\n } catch (err) {\n handleApiError(err);\n }\n });\n","import { Command } from 'commander';\nimport { AtollClient } from '../lib/client.js';\nimport { isJsonMode, outputError, outputJson } from '../lib/output.js';\nimport { bold, dim, red, yellow, gray, cyan } from '../lib/colors.js';\nimport { handleApiError, resolveOrg } from './issue.js';\n\ntype Severity = 'critical' | 'warning' | 'info';\n\ninterface HeartbeatSignal {\n type: string;\n severity: Severity;\n entity_id?: string;\n entity_type?: string;\n message: string;\n metadata?: Record<string, unknown>;\n}\n\ninterface HeartbeatIssue {\n id: string;\n title: string;\n status: string;\n priority: number;\n number?: number | null;\n}\n\ninterface HeartbeatKpiStatus {\n is_off_pace?: boolean;\n is_stale?: boolean;\n}\n\ninterface HeartbeatInitiativeContext {\n stalled_issues?: number;\n blocked_issues?: number;\n}\n\ninterface HeartbeatGoalContext {\n goal?: { title?: string };\n days_remaining?: number | null;\n kpis?: HeartbeatKpiStatus[];\n initiatives?: HeartbeatInitiativeContext[];\n}\n\ninterface HeartbeatContext {\n agent?: { id?: string; display_name?: string | null };\n timestamp?: string;\n goals?: HeartbeatGoalContext[];\n standalone_kpis?: HeartbeatKpiStatus[];\n assigned_issues?: HeartbeatIssue[];\n signals?: HeartbeatSignal[];\n}\n\nconst VALID_SEVERITIES = ['critical', 'warning', 'info'] as const;\n\nexport const heartbeatCommand = new Command('heartbeat')\n .description('Get the current agent heartbeat briefing')\n .option('--signals-only', 'Only show heartbeat signals')\n .option('--severity <severity>', `Filter signals by severity (${VALID_SEVERITIES.join(', ')})`)\n .action(async (opts: { signalsOnly?: boolean; severity?: string }) => {\n try {\n if (opts.severity && !VALID_SEVERITIES.includes(opts.severity)) {\n outputError(`Invalid severity \"${opts.severity}\". Must be one of: ${VALID_SEVERITIES.join(', ')}`);\n process.exit(2);\n }\n\n const client = new AtollClient();\n const org = await resolveOrg(client);\n const context = await client.get<HeartbeatContext>(`/api/orgs/${org.id}/heartbeat`);\n const signals = filterSignals(context.signals ?? [], opts.severity as Severity | undefined);\n\n if (isJsonMode()) {\n if (opts.signalsOnly) {\n outputJson({ signals });\n return;\n }\n outputJson({ ...context, signals });\n return;\n }\n\n renderHeartbeat(context, signals, opts.signalsOnly ?? false);\n } catch (err) {\n handleApiError(err);\n }\n });\n\nfunction filterSignals(signals: HeartbeatSignal[], severity?: Severity): HeartbeatSignal[] {\n if (!severity) return signals;\n return signals.filter((signal) => signal.severity === severity);\n}\n\nfunction renderHeartbeat(\n context: HeartbeatContext,\n signals: HeartbeatSignal[],\n signalsOnly: boolean,\n): void {\n const agentName = context.agent?.display_name || context.agent?.id || 'agent';\n console.log(bold(`Heartbeat for ${agentName}`));\n if (context.timestamp) console.log(dim(context.timestamp));\n console.log('');\n\n renderSignals(signals);\n\n if (signalsOnly) return;\n\n const assigned = context.assigned_issues ?? [];\n if (assigned.length > 0) {\n console.log('');\n console.log(bold('Assigned'));\n for (const issue of assigned.slice(0, 10)) {\n const id = issue.number == null ? issue.id.slice(0, 8) : `ATOLL-${issue.number}`;\n console.log(` ${pad(id, 10)} ${pad(issue.status, 13)} P${issue.priority} ${issue.title}`);\n }\n if (assigned.length > 10) console.log(dim(` ${assigned.length - 10} more assigned issue(s) hidden`));\n }\n\n const goals = context.goals ?? [];\n if (goals.length > 0) {\n console.log('');\n console.log(bold('Goals'));\n for (const goal of goals.slice(0, 5)) {\n const title = goal.goal?.title ?? '(untitled goal)';\n const days = goal.days_remaining == null ? 'no deadline' : `${goal.days_remaining} days left`;\n const kpis = goal.kpis ?? [];\n const initiatives = goal.initiatives ?? [];\n const offPace = kpis.filter((kpi) => kpi.is_off_pace).length;\n const stale = kpis.filter((kpi) => kpi.is_stale).length;\n const stalledOrBlocked = initiatives.filter(\n (initiative) => (initiative.stalled_issues ?? 0) > 0 || (initiative.blocked_issues ?? 0) > 0,\n ).length;\n console.log(` ${title} ${dim(days)}`);\n console.log(dim(` KPIs: ${offPace} off pace, ${stale} stale`));\n console.log(dim(` Initiatives: ${stalledOrBlocked} stalled/blocked`));\n }\n if (goals.length > 5) console.log(dim(` ${goals.length - 5} more goal(s) hidden`));\n }\n}\n\nfunction renderSignals(signals: HeartbeatSignal[]): void {\n if (signals.length === 0) {\n console.log(gray('No heartbeat signals.'));\n return;\n }\n\n const groups: [Severity, string][] = [\n ['critical', 'Critical'],\n ['warning', 'Warnings'],\n ['info', 'Info'],\n ];\n for (const [severity, label] of groups) {\n const group = signals.filter((signal) => signal.severity === severity);\n if (group.length === 0) continue;\n console.log(formatSeverityHeading(severity, label));\n for (const signal of group) {\n console.log(` ${pad(signal.type, 18)} ${signal.message}`);\n }\n if (severity !== 'info') console.log('');\n }\n}\n\nfunction formatSeverityHeading(severity: Severity, label: string): string {\n if (severity === 'critical') return red(bold(label));\n if (severity === 'warning') return yellow(bold(label));\n return cyan(bold(label));\n}\n\nfunction pad(value: string, length: number): string {\n return value.length >= length ? value.slice(0, length) : value + ' '.repeat(length - value.length);\n}\n","import { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { Command } from 'commander';\nimport { readConfig, resolveConfig } from '../lib/config.js';\nimport { outputJson } from '../lib/output.js';\n\nconst ISSUE_STATUSES = ['backlog', 'todo', 'in_progress', 'done', 'cancelled'];\nconst PRIORITIES = [0, 1, 2, 3];\nconst SEVERITIES = ['critical', 'warning', 'info'];\nconst SIGNAL_TYPES = [\n 'kpi_off_pace',\n 'kpi_stale',\n 'issue_stale',\n 'issue_blocked',\n 'milestone_overdue',\n 'initiative_stalled',\n 'webhook_failing',\n];\n\nexport const agentContextCommand = new Command('agent-context')\n .description('Output machine-readable CLI context for agents')\n .action(() => {\n const config = readConfig();\n const resolved = resolveConfig();\n const profiles = Object.entries(config.profiles ?? {})\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([name, profile]) => ({\n name,\n active: name === config.activeProfile,\n apiKeySet: Boolean(profile.apiKey),\n orgSlug: profile.orgSlug ?? null,\n defaultTeam: profile.defaultTeam ?? null,\n baseUrl: profile.baseUrl ?? null,\n }));\n\n outputJson({\n schema_version: '1',\n cli: {\n name: 'atoll',\n json_flag: '--json',\n output: {\n stdout: 'data',\n stderr: 'diagnostics_and_errors',\n list_shape: '{ resource, items, total, limit, offset, nextOffset, truncated, hint }',\n },\n },\n selected_context: {\n activeProfile: config.activeProfile ?? null,\n selectedProfile: resolved.profile ?? null,\n orgSlug: resolved.orgSlug ?? null,\n defaultTeam: resolved.defaultTeam ?? null,\n baseUrl: resolved.baseUrl ?? null,\n apiKeySet: Boolean(resolved.apiKey),\n },\n available_profiles: profiles,\n commands: buildCommandContext(),\n skill_manifests: findSkillManifests(),\n });\n });\n\nexport const skillPathCommand = new Command('skill-path')\n .description('Output local Atoll skill manifest paths when available')\n .action(() => {\n outputJson({ skill_manifests: findSkillManifests() });\n });\n\nfunction buildCommandContext(): Record<string, unknown> {\n return {\n heartbeat: {\n description: 'Primary agent orientation command. Reads current goals, KPI pace, initiative health, assigned work, and prioritized signals.',\n subcommands: {},\n flags: {\n '--signals-only': { type: 'boolean', default: false },\n '--severity': { type: 'enum', values: SEVERITIES },\n '--json': { type: 'boolean', default: false },\n },\n signal_types: SIGNAL_TYPES,\n },\n issue: {\n subcommands: {\n list: {\n flags: {\n '--status': { type: 'enum', values: ISSUE_STATUSES },\n '--assignee': { type: 'string' },\n '--priority': { type: 'enum', values: PRIORITIES },\n '--limit': { type: 'integer', min: 1, max: 100, default: 25 },\n '--offset': { type: 'integer', min: 0, default: 0 },\n '--json': { type: 'boolean', default: false },\n },\n },\n get: { alias_for: 'view', args: ['identifier'], flags: { '--json': { type: 'boolean', default: false } } },\n view: { args: ['identifier'], flags: { '--json': { type: 'boolean', default: false } } },\n create: {\n flags: {\n '--title': { type: 'string', required: true },\n '--description': { type: 'string' },\n '--status': { type: 'enum', values: ISSUE_STATUSES },\n '--priority': { type: 'enum', values: PRIORITIES },\n '--json': { type: 'boolean', default: false },\n },\n },\n update: {\n args: ['identifier'],\n flags: {\n '--title': { type: 'string' },\n '--status': { type: 'enum', values: ISSUE_STATUSES },\n '--priority': { type: 'enum', values: PRIORITIES },\n '--json': { type: 'boolean', default: false },\n },\n },\n archive: { args: ['identifier'], flags: { '--dry-run': { type: 'boolean' }, '--json': { type: 'boolean' } } },\n unarchive: { args: ['identifier'], flags: { '--dry-run': { type: 'boolean' }, '--json': { type: 'boolean' } } },\n delete: {\n args: ['identifier'],\n flags: {\n '--force': { type: 'boolean', required: true },\n '--dry-run': { type: 'boolean' },\n '--json': { type: 'boolean', default: false },\n },\n },\n assign: { args: ['identifier'], flags: { '--to': { type: 'string', required: true }, '--json': { type: 'boolean' } } },\n unassign: { args: ['identifier'], flags: { '--json': { type: 'boolean' } } },\n },\n },\n project: {\n subcommands: {\n list: { flags: { '--limit': { type: 'integer', min: 1, max: 100, default: 25 }, '--json': { type: 'boolean' } } },\n get: { alias_for: 'view', args: ['projectId'], flags: { '--json': { type: 'boolean' } } },\n view: { args: ['projectId'], flags: { '--json': { type: 'boolean' } } },\n create: {\n flags: {\n '--name': { type: 'string', required: true },\n '--description': { type: 'string' },\n '--color': { type: 'string', default: '#6366f1' },\n '--icon': { type: 'string', default: 'folder' },\n '--json': { type: 'boolean' },\n },\n },\n },\n },\n comment: {\n subcommands: {\n list: { args: ['identifier'], flags: { '--limit': { type: 'integer', min: 1, max: 100, default: 25 }, '--json': { type: 'boolean' } } },\n add: { args: ['identifier'], flags: { '--body': { type: 'string', required: true }, '--json': { type: 'boolean' } } },\n update: {\n args: ['comment-id'],\n flags: { '--issue': { type: 'string', required: true }, '--body': { type: 'string', required: true }, '--json': { type: 'boolean' } },\n },\n delete: {\n args: ['comment-id'],\n flags: {\n '--issue': { type: 'string', required: true },\n '--force': { type: 'boolean', required: true },\n '--dry-run': { type: 'boolean' },\n '--json': { type: 'boolean' },\n },\n },\n },\n },\n feedback: {\n description: 'Record CLI or platform friction locally and optionally submit it upstream.',\n subcommands: {\n add: {\n alias: 'feedback <text>',\n flags: {\n '--type': { type: 'enum', values: ['bug', 'feature'], default: 'bug' },\n '--url': { type: 'string' },\n '--send': { type: 'boolean', default: false },\n '--json': { type: 'boolean' },\n },\n },\n list: { flags: { '--limit': { type: 'integer', min: 1, max: 100, default: 25 }, '--json': { type: 'boolean' } } },\n },\n },\n };\n}\n\nfunction findSkillManifests(): { name: string; path: string; exists: boolean }[] {\n const repoRoot = resolve(__dirname, '..', '..', '..');\n const candidates = [\n ['codex', join(repoRoot, 'packages', 'skill-codex', 'skill', 'SKILL.md')],\n ['claude', join(repoRoot, 'packages', 'skill-claude', 'skill', 'SKILL.md')],\n ['gemini', join(repoRoot, 'packages', 'skill-gemini', 'skill', 'SKILL.md')],\n ['clawhub', join(repoRoot, 'clawhub', 'atoll-api', 'SKILL.md')],\n ] as const;\n return candidates.map(([name, path]) => ({ name, path, exists: existsSync(path) }));\n}\n","import { existsSync, mkdirSync, readFileSync, appendFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nimport { Command } from 'commander';\nimport { readConfig, resolveConfig } from '../lib/config.js';\nimport { isJsonMode, normalizeLimit, output, outputError, outputJson } from '../lib/output.js';\nimport { dim, success } from '../lib/colors.js';\n\ntype FeedbackType = 'bug' | 'feature';\n\ninterface FeedbackEntry {\n id: string;\n type: FeedbackType;\n description: string;\n url: string | null;\n created_at: string;\n sent_upstream: boolean;\n upstream_status: number | null;\n upstream_error: string | null;\n}\n\nconst CONFIG_DIR = join(homedir(), '.atoll');\nconst FEEDBACK_PATH = join(CONFIG_DIR, 'feedback.jsonl');\nconst VALID_TYPES = ['bug', 'feature'] as const;\nconst DEFAULT_BASE_URL = 'https://atollhq.com';\n\nexport const feedbackCommand = new Command('feedback')\n .description('Record CLI or platform feedback')\n .argument('[text...]', 'Feedback text')\n .option('--type <type>', `Feedback type (${VALID_TYPES.join(', ')})`, 'bug')\n .option('--url <url>', 'Related page or endpoint URL')\n .option('--send', 'Also submit to the configured Atoll feedback endpoint')\n .action(async (text: string[], opts: { type: string; url?: string; send?: boolean }) => {\n if (text.length === 0) {\n outputError('Feedback text is required. Usage: atoll feedback \"what went wrong\"');\n process.exit(2);\n }\n await recordFeedback(text.join(' '), opts);\n });\n\nfeedbackCommand\n .command('add <text...>')\n .description('Record feedback')\n .option('--type <type>', `Feedback type (${VALID_TYPES.join(', ')})`, 'bug')\n .option('--url <url>', 'Related page or endpoint URL')\n .option('--send', 'Also submit to the configured Atoll feedback endpoint')\n .action(async (text: string[], opts: { type: string; url?: string; send?: boolean }) => {\n await recordFeedback(text.join(' '), opts);\n });\n\nfeedbackCommand\n .command('list')\n .description('List locally recorded feedback')\n .option('--limit <n>', 'Max results (1-100)', parseInt)\n .action((opts: { limit?: number }) => {\n const limit = normalizeLimit(opts.limit);\n const entries = readFeedbackEntries().slice(-limit).reverse();\n\n if (isJsonMode()) {\n outputJson({\n resource: 'feedback',\n items: entries,\n total: readFeedbackEntries().length,\n limit,\n offset: 0,\n nextOffset: null,\n truncated: readFeedbackEntries().length > entries.length,\n hint: null,\n });\n return;\n }\n\n if (entries.length === 0) {\n console.log('No local feedback recorded.');\n return;\n }\n for (const entry of entries) {\n const sent = entry.sent_upstream ? `sent:${entry.upstream_status}` : 'local';\n console.log(`${entry.created_at} ${entry.type} ${sent}`);\n console.log(` ${entry.description}`);\n if (entry.url) console.log(dim(` ${entry.url}`));\n }\n });\n\nasync function recordFeedback(\n description: string,\n opts: { type: string; url?: string; send?: boolean },\n): Promise<void> {\n if (!VALID_TYPES.includes(opts.type as FeedbackType)) {\n outputError(`Invalid feedback type \"${opts.type}\". Must be one of: ${VALID_TYPES.join(', ')}`);\n process.exit(2);\n }\n\n const entry: FeedbackEntry = {\n id: makeId(),\n type: opts.type as FeedbackType,\n description,\n url: opts.url ?? null,\n created_at: new Date().toISOString(),\n sent_upstream: false,\n upstream_status: null,\n upstream_error: null,\n };\n\n const endpoint = process.env.ATOLL_FEEDBACK_ENDPOINT || (opts.send ? `${resolveConfig().baseUrl || DEFAULT_BASE_URL}/api/feedback` : null);\n if (endpoint) {\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n type: entry.type,\n description: entry.description,\n url: entry.url ?? undefined,\n userName: getReporterName(),\n }),\n });\n entry.sent_upstream = response.ok;\n entry.upstream_status = response.status;\n if (!response.ok) entry.upstream_error = await response.text();\n } catch (err) {\n entry.upstream_error = (err as Error).message ?? String(err);\n }\n }\n\n appendFeedbackEntry(entry);\n output(\n { feedback: entry },\n entry.sent_upstream\n ? success(`Feedback recorded locally and sent upstream (${entry.upstream_status})`)\n : success('Feedback recorded locally'),\n );\n}\n\nfunction readFeedbackEntries(): FeedbackEntry[] {\n if (!existsSync(FEEDBACK_PATH)) return [];\n return readFileSync(FEEDBACK_PATH, 'utf-8')\n .split('\\n')\n .filter(Boolean)\n .map((line) => JSON.parse(line) as FeedbackEntry);\n}\n\nfunction appendFeedbackEntry(entry: FeedbackEntry): void {\n if (!existsSync(CONFIG_DIR)) mkdirSync(CONFIG_DIR, { recursive: true });\n appendFileSync(FEEDBACK_PATH, JSON.stringify(entry) + '\\n', 'utf-8');\n}\n\nfunction getReporterName(): string | undefined {\n const config = readConfig();\n return process.env.ATOLL_PROFILE || config.activeProfile || undefined;\n}\n\nfunction makeId(): string {\n return `fb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BO,SAAS,aAA0B;AACxC,MAAI,KAAC,2BAAW,WAAW,EAAG,QAAO,CAAC;AACtC,MAAI;AACF,WAAO,KAAK,UAAM,6BAAa,aAAa,OAAO,CAAC;AAAA,EACtD,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAEO,SAAS,YAAY,QAA2B;AACrD,MAAI,KAAC,2BAAW,UAAU,GAAG;AAC3B,kCAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,EAC3C;AACA,oCAAc,aAAa,KAAK,UAAU,QAAQ,MAAM,CAAC,IAAI,MAAM,OAAO;AAC5E;AAEO,SAAS,eAAqB;AACnC,UAAI,2BAAW,WAAW,GAAG;AAC3B,mCAAW,WAAW;AAAA,EACxB;AACF;AAEO,SAAS,iBAAiB,SAAS,WAAW,GAAuB;AAC1E,SAAO,QAAQ,IAAI,iBAAiB,OAAO;AAC7C;AAEO,SAAS,WAAW,QAAqB,aAAgD;AAC9F,MAAI,CAAC,YAAa,QAAO;AACzB,SAAO,OAAO,WAAW,WAAW;AACtC;AAEO,SAAS,cAAc,QAAqB,aAAmC;AACpF,SAAO,aAAa,CAAC;AACrB,SAAO,SAAS,WAAW,MAAM,CAAC;AAClC,SAAO,OAAO,SAAS,WAAW;AACpC;AAEO,SAAS,cAAc,MAA6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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0FT;AAEA,SAAS,2BAA2B,SAAwB;AAC1D,aAAW,cAAc,QAAQ,UAAU;AACzC,QAAI,CAAC,WAAW,QAAQ,KAAK,CAAC,WAAW,OAAO,SAAS,QAAQ,GAAG;AAClE,iBAAW,OAAO,UAAU,4BAA4B;AAAA,IAC1D;AACA,+BAA2B,UAAU;AAAA,EACvC;AACF;","names":["import_commander","import_node_fs","import_node_path","import_commander","resolveConfig","import_commander","BOLD","DIM","RESET","import_commander","import_commander","progressBar","import_commander","import_commander","handleApiError","resolveOrgId","resolveConfig","padEnd","import_commander","import_node_fs","import_node_path","import_commander","import_node_fs","import_node_os","import_node_path","import_commander","CONFIG_DIR","DEFAULT_BASE_URL"]}
|