@evex-dev/linejs-cli 0.1.3 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"cli-CitLKLHn.mjs","names":["callCommand","result","statusCommand","tokenCommand","createCommand","updateCommand","joinCommand","inviteCommand","kickCommand","listCommand","getCommand","createCommand","leaveCommand","renameCommand","listCommand","getCommand","searchCommand","renameCommand","tokenCommand","shareCommand","reactCommand","message","extensionForMime","uploadCommand","downloadCommand","getCommand","updateCommand","listCommand","getCommand","listCommand","getCommand","result","deleteCommand","pkg.version"],"sources":["../src/args.ts","../src/context.ts","../src/command.ts","../src/files.ts","../src/output.ts","../src/qr.ts","../src/profile-storage.ts","../src/paths.ts","../src/profile-store.ts","../src/session.ts","../src/commands/shared.ts","../src/commands/api.ts","../src/commands/auth.ts","../src/commands/birthday.ts","../src/commands/call.ts","../src/commands/chats.ts","../src/commands/contacts.ts","../src/commands/liff.ts","../src/commands/listen.ts","../src/commands/messages.ts","../src/commands/media.ts","../src/commands/moa.ts","../src/commands/mcp.ts","../src/commands/profile.ts","../src/commands/square.ts","../src/commands/storage.ts","../src/commands/timeline.ts","../src/commands/voom.ts","../src/registry.ts","../package.json","../src/version.ts","../src/help.ts","../src/cli.ts"],"sourcesContent":["import { UsageError } from \"./errors.ts\";\n\nexport type OptionType = \"boolean\" | \"string\" | \"number\" | \"array\";\n\nexport interface OptionSpec {\n\tname: string;\n\tshort?: string;\n\ttype: OptionType;\n\tdescription: string;\n\tvalueName?: string;\n\tchoices?: readonly string[];\n\tdefault?: string | number | boolean;\n\thidden?: boolean;\n}\n\nexport type OptionValue = string | number | boolean | string[];\nexport type ParsedOptions = Record<string, OptionValue>;\n\nexport interface ParsedArguments {\n\toptions: ParsedOptions;\n\tpositionals: string[];\n}\n\n/** Options accepted before and after every command. */\nexport const GLOBAL_OPTIONS: readonly OptionSpec[] = [\n\t{\n\t\tname: \"json\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Print the command result as JSON (machine readable).\",\n\t},\n\t{\n\t\tname: \"check-session\",\n\t\ttype: \"boolean\",\n\t\tdescription:\n\t\t\t\"Verify the saved auth token with getProfile() before running. Auth commands always check; other commands use the cached profile unless this flag is set.\",\n\t},\n\t{\n\t\tname: \"profile\",\n\t\ttype: \"string\",\n\t\tvalueName: \"name|path\",\n\t\tdescription:\n\t\t\t\"Profile name under ~/.linejs, or a path to a profile JSON file. Defaults to default.\",\n\t},\n\t{\n\t\tname: \"device\",\n\t\ttype: \"string\",\n\t\tvalueName: \"device\",\n\t\tdescription:\n\t\t\t\"Override the emulated device (DESKTOPWIN, DESKTOPMAC, ANDROID, ANDROIDSECONDARY, IOS, IOSIPAD, WATCHOS, WEAROS).\",\n\t},\n\t{\n\t\tname: \"app-version\",\n\t\ttype: \"string\",\n\t\tvalueName: \"version\",\n\t\tdescription: \"Override the emulated LINE app version.\",\n\t},\n\t{\n\t\tname: \"endpoint\",\n\t\ttype: \"string\",\n\t\tvalueName: \"host\",\n\t\tdescription: \"Override the LEGY endpoint (advanced).\",\n\t},\n\t{\n\t\tname: \"timeout\",\n\t\ttype: \"number\",\n\t\tvalueName: \"ms\",\n\t\tdescription: \"Request timeout in milliseconds (default: 30000).\",\n\t},\n\t{\n\t\tname: \"verbose\",\n\t\tshort: \"v\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Write LINEJS request logs to stderr.\",\n\t},\n\t{\n\t\tname: \"color\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Colorize human output. Use --no-color to disable.\",\n\t},\n\t{\n\t\tname: \"help\",\n\t\tshort: \"h\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Show help for the command.\",\n\t},\n\t{\n\t\tname: \"version\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Print the CLI version.\",\n\t},\n];\n\nfunction buildLongMap(specs: readonly OptionSpec[]): Map<string, OptionSpec> {\n\tconst map = new Map<string, OptionSpec>();\n\tfor (const spec of specs) map.set(spec.name, spec);\n\treturn map;\n}\n\nfunction buildShortMap(specs: readonly OptionSpec[]): Map<string, OptionSpec> {\n\tconst map = new Map<string, OptionSpec>();\n\tfor (const spec of specs) {\n\t\tif (spec.short) map.set(spec.short, spec);\n\t}\n\treturn map;\n}\n\nfunction isNegativeNumber(value: string): boolean {\n\treturn /^-?\\d+(?:\\.\\d+)?$/.test(value);\n}\n\n/** True for `--foo`, `--no-foo`, and `-x`, but not for `-` or negative numbers. */\nexport function isOptionToken(token: string): boolean {\n\treturn token.length > 1 && token.startsWith(\"-\") && !isNegativeNumber(token);\n}\n\nfunction splitLongToken(token: string): { name: string; value?: string; negated: boolean } {\n\tlet body = token.slice(2);\n\tlet value: string | undefined;\n\tconst equals = body.indexOf(\"=\");\n\tif (equals !== -1) {\n\t\tvalue = body.slice(equals + 1);\n\t\tbody = body.slice(0, equals);\n\t}\n\tif (body.startsWith(\"no-\")) {\n\t\treturn { name: body.slice(3), value, negated: true };\n\t}\n\treturn { name: body, value, negated: false };\n}\n\nfunction parseBoolean(value: string, flag: string): boolean {\n\tswitch (value.toLowerCase()) {\n\t\tcase \"1\":\n\t\tcase \"true\":\n\t\tcase \"yes\":\n\t\tcase \"on\":\n\t\t\treturn true;\n\t\tcase \"0\":\n\t\tcase \"false\":\n\t\tcase \"no\":\n\t\tcase \"off\":\n\t\t\treturn false;\n\t\tdefault:\n\t\t\tthrow new UsageError(`Invalid boolean for ${flag}: ${value}`);\n\t}\n}\n\nfunction convertValue(spec: OptionSpec, raw: string): string | number {\n\tif (spec.choices && !spec.choices.includes(raw)) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid value for --${spec.name}: ${raw} (expected ${spec.choices.join(\", \")})`,\n\t\t);\n\t}\n\tif (spec.type === \"number\") {\n\t\tconst value = Number(raw);\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow new UsageError(`Invalid number for --${spec.name}: ${raw}`);\n\t\t}\n\t\treturn value;\n\t}\n\treturn raw;\n}\n\nfunction setOption(options: ParsedOptions, spec: OptionSpec, value: OptionValue): void {\n\tif (spec.type === \"array\") {\n\t\tconst current = options[spec.name];\n\t\tconst list = Array.isArray(current) ? current : [];\n\t\tconst additions = Array.isArray(value) ? value : [String(value)];\n\t\toptions[spec.name] = [...list, ...additions];\n\t\treturn;\n\t}\n\toptions[spec.name] = value;\n}\n\n/**\n * Parse command arguments. Values beginning with `-` are accepted as option\n * values (use `--opt=value` when the value itself looks like an option).\n */\nexport function parseOptions(\n\ttokens: readonly string[],\n\tspecs: readonly OptionSpec[],\n): ParsedArguments {\n\tconst longMap = buildLongMap(specs);\n\tconst shortMap = buildShortMap(specs);\n\tconst options: ParsedOptions = {};\n\tconst positionals: string[] = [];\n\n\tfor (let index = 0; index < tokens.length; index += 1) {\n\t\tconst token = tokens[index]!;\n\t\tif (token === \"--\") {\n\t\t\tpositionals.push(...tokens.slice(index + 1));\n\t\t\tbreak;\n\t\t}\n\t\tif (!isOptionToken(token)) {\n\t\t\tpositionals.push(token);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (token.startsWith(\"--\")) {\n\t\t\tconst { name, value, negated } = splitLongToken(token);\n\t\t\tconst spec = longMap.get(name);\n\t\t\tif (!spec) {\n\t\t\t\tthrow new UsageError(`Unknown option: --${name}`);\n\t\t\t}\n\t\t\tif (spec.type === \"boolean\") {\n\t\t\t\tif (negated) {\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\tthrow new UsageError(`--no-${spec.name} does not accept a value`);\n\t\t\t\t\t}\n\t\t\t\t\tsetOption(options, spec, false);\n\t\t\t\t} else if (value === undefined) {\n\t\t\t\t\tsetOption(options, spec, true);\n\t\t\t\t} else {\n\t\t\t\t\tsetOption(options, spec, parseBoolean(value, `--${spec.name}`));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (negated) {\n\t\t\t\tthrow new UsageError(`--no-${spec.name} is only valid for boolean options`);\n\t\t\t}\n\t\t\tlet raw = value;\n\t\t\tif (raw === undefined) {\n\t\t\t\traw = tokens[index + 1];\n\t\t\t\tif (raw === undefined) {\n\t\t\t\t\tthrow new UsageError(`Missing value for --${spec.name}`);\n\t\t\t\t}\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tif (spec.type === \"array\") {\n\t\t\t\tsetOption(\n\t\t\t\t\toptions,\n\t\t\t\t\tspec,\n\t\t\t\t\traw\n\t\t\t\t\t\t.split(\",\")\n\t\t\t\t\t\t.map((entry) => entry.trim())\n\t\t\t\t\t\t.filter(Boolean),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsetOption(options, spec, convertValue(spec, raw));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst shortBody = token.slice(1);\n\t\tconst shortName = shortBody[0]!;\n\t\tconst spec = shortMap.get(shortName);\n\t\tif (!spec) {\n\t\t\tthrow new UsageError(`Unknown option: -${shortName}`);\n\t\t}\n\t\tif (spec.type === \"boolean\") {\n\t\t\tif (shortBody.length > 1) {\n\t\t\t\tthrow new UsageError(`Combined short options are not supported: ${token}`);\n\t\t\t}\n\t\t\tsetOption(options, spec, true);\n\t\t\tcontinue;\n\t\t}\n\t\tlet raw = shortBody.slice(1);\n\t\tif (raw.startsWith(\"=\")) raw = raw.slice(1);\n\t\tif (!raw) {\n\t\t\traw = tokens[index + 1];\n\t\t\tif (raw === undefined) {\n\t\t\t\tthrow new UsageError(`Missing value for -${shortName}`);\n\t\t\t}\n\t\t\tindex += 1;\n\t\t}\n\t\tif (spec.type === \"array\") {\n\t\t\tsetOption(\n\t\t\t\toptions,\n\t\t\t\tspec,\n\t\t\t\traw\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.map((entry) => entry.trim())\n\t\t\t\t\t.filter(Boolean),\n\t\t\t);\n\t\t} else {\n\t\t\tsetOption(options, spec, convertValue(spec, raw));\n\t\t}\n\t}\n\n\treturn { options, positionals };\n}\n\n/**\n * Remove global options that appear before the command path so the path can be\n * resolved. The tokens are re-parsed with the command's full option set later.\n */\nexport function splitLeadingGlobalOptions(tokens: readonly string[]): {\n\tleading: string[];\n\trest: string[];\n} {\n\tconst specs = [...GLOBAL_OPTIONS];\n\tlet index = 0;\n\twhile (index < tokens.length) {\n\t\tconst token = tokens[index]!;\n\t\tif (token === \"--\" || !isOptionToken(token)) break;\n\t\tconst { next } = consumeOptionToken(tokens, index, specs);\n\t\tindex = next;\n\t}\n\treturn { leading: tokens.slice(0, index), rest: tokens.slice(index) };\n}\n\nfunction consumeOptionToken(\n\ttokens: readonly string[],\n\tindex: number,\n\tspecs: readonly OptionSpec[],\n): { leading: string[]; next: number } {\n\tconst longMap = buildLongMap(specs);\n\tconst shortMap = buildShortMap(specs);\n\tconst token = tokens[index]!;\n\tif (token.startsWith(\"--\")) {\n\t\tconst { name, value, negated } = splitLongToken(token);\n\t\tconst spec = longMap.get(name);\n\t\tif (!spec) throw new UsageError(`Unknown option: --${name}`);\n\t\tif (spec.type === \"boolean\" || value !== undefined) {\n\t\t\treturn { leading: [token], next: index + 1 };\n\t\t}\n\t\tif (negated) return { leading: [token], next: index + 1 };\n\t\tif (tokens[index + 1] === undefined) {\n\t\t\tthrow new UsageError(`Missing value for --${spec.name}`);\n\t\t}\n\t\treturn { leading: [token, tokens[index + 1]!], next: index + 2 };\n\t}\n\tconst shortName = token[1]!;\n\tconst spec = shortMap.get(shortName);\n\tif (!spec) throw new UsageError(`Unknown option: -${shortName}`);\n\tif (spec.type === \"boolean\") return { leading: [token], next: index + 1 };\n\tif (token.length > 2) return { leading: [token], next: index + 1 };\n\tif (tokens[index + 1] === undefined) {\n\t\tthrow new UsageError(`Missing value for -${shortName}`);\n\t}\n\treturn { leading: [token, tokens[index + 1]!], next: index + 2 };\n}\n","import type { ParsedOptions } from \"./args.ts\";\nimport { CliError, UsageError } from \"./errors.ts\";\nimport type { Output } from \"./output.ts\";\nimport type { ProfileLocation } from \"./paths.ts\";\n\nexport interface CliSettings {\n\tprofile: ProfileLocation;\n\tdevice?: string;\n\tappVersion?: string;\n\tendpoint?: string;\n\ttimeout?: number;\n\tverbose: boolean;\n\tjson: boolean;\n\tinteractive: boolean;\n\tmcp: boolean;\n\tcheckSession: boolean;\n\tenv: NodeJS.ProcessEnv;\n\tcwd: string;\n\tsignal: AbortSignal;\n}\n\nexport class CommandContext {\n\treadonly options: ParsedOptions;\n\treadonly positionals: readonly string[];\n\treadonly output: Output;\n\treadonly settings: CliSettings;\n\n\tconstructor(init: {\n\t\toptions: ParsedOptions;\n\t\tpositionals: readonly string[];\n\t\toutput: Output;\n\t\tsettings: CliSettings;\n\t}) {\n\t\tthis.options = init.options;\n\t\tthis.positionals = init.positionals;\n\t\tthis.output = init.output;\n\t\tthis.settings = init.settings;\n\t}\n\n\tget json(): boolean {\n\t\treturn this.settings.json;\n\t}\n\n\tget interactive(): boolean {\n\t\treturn this.settings.interactive;\n\t}\n\n\tget signal(): AbortSignal {\n\t\treturn this.settings.signal;\n\t}\n\n\thas(name: string): boolean {\n\t\treturn this.options[name] !== undefined;\n\t}\n\n\tgetString(name: string): string | undefined {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return undefined;\n\t\tif (typeof value !== \"string\") return String(value);\n\t\treturn value;\n\t}\n\n\trequireString(name: string, message = `Missing required option --${name}`): string {\n\t\tconst value = this.getString(name);\n\t\tif (value === undefined || value === \"\") throw new UsageError(message);\n\t\treturn value;\n\t}\n\n\tgetNumber(name: string): number | undefined {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return undefined;\n\t\tconst number = typeof value === \"number\" ? value : Number(value);\n\t\tif (!Number.isFinite(number)) throw new UsageError(`Invalid number for --${name}`);\n\t\treturn number;\n\t}\n\n\tgetBool(name: string, defaultValue = false): boolean {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return defaultValue;\n\t\tif (typeof value === \"boolean\") return value;\n\t\tif (typeof value === \"string\") return value === \"true\" || value === \"1\";\n\t\treturn Boolean(value);\n\t}\n\n\tgetArray(name: string): string[] {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return [];\n\t\tconst list = Array.isArray(value) ? value : [String(value)];\n\t\treturn list\n\t\t\t.flatMap((entry) => entry.split(\",\"))\n\t\t\t.map((entry) => entry.trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tgetJson<T = unknown>(name: string): T | undefined {\n\t\tconst value = this.getString(name);\n\t\tif (value === undefined) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(value) as T;\n\t\t} catch (error) {\n\t\t\tthrow new UsageError(`--${name} is not valid JSON`, {\n\t\t\t\tcause: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\n\targ(index: number): string | undefined {\n\t\treturn this.positionals[index];\n\t}\n\n\trequireArg(index: number, name: string): string {\n\t\tconst value = this.positionals[index];\n\t\tif (value === undefined || value === \"\") {\n\t\t\tthrow new UsageError(`Missing required argument <${name}>`);\n\t\t}\n\t\treturn value;\n\t}\n\n\trest(index: number): string {\n\t\treturn this.positionals.slice(index).join(\" \");\n\t}\n\n\trequireRest(index: number, name: string): string {\n\t\tconst value = this.rest(index);\n\t\tif (!value) throw new UsageError(`Missing required argument <${name}>`);\n\t\treturn value;\n\t}\n}\n\nexport function requireConfirmation(context: CommandContext, message: string, yes: boolean): void {\n\tif (yes) return;\n\tif (!context.interactive) {\n\t\tthrow new CliError(\"CONFIRMATION_REQUIRED\", `${message} (pass --yes to confirm)`, {\n\t\t\tdetails: { hint: \"This command is destructive; re-run with --yes.\" },\n\t\t});\n\t}\n}\n","import type { OptionSpec } from \"./args.ts\";\nimport type { CommandContext } from \"./context.ts\";\n\nexport interface CommandArgument {\n\tname: string;\n\tdescription: string;\n\trequired?: boolean;\n\tvariadic?: boolean;\n}\n\nexport interface CommandSpec {\n\t/** Space-separated command path, e.g. \"auth login\". */\n\tname: string;\n\tsummary: string;\n\tdescription?: string;\n\tcategory: string;\n\targs?: readonly CommandArgument[];\n\toptions?: readonly OptionSpec[];\n\t/** Requires an existing profile with an auth token. */\n\tauth?: boolean;\n\t/** The command blocks forever (listen, mcp). */\n\tlongRunning?: boolean;\n\t/** Defaults to true. Set false to reject the command from MCP. */\n\tmcp?: boolean;\n\t/** Do not print the command result (streaming/protocol commands). */\n\tsilent?: boolean;\n\texamples?: readonly string[];\n\trun(context: CommandContext): Promise<unknown>;\n\t/** Human-readable formatter. Defaults to pretty JSON. */\n\tformat?(value: unknown, context: CommandContext): string;\n}\n\nexport function commandUsage(command: CommandSpec): string {\n\tconst args = (command.args ?? [])\n\t\t.map((arg) =>\n\t\t\targ.variadic\n\t\t\t\t? `${arg.required ? \"\" : \"[\"}${arg.name}...${arg.required ? \"\" : \"]\"}`\n\t\t\t\t: arg.required\n\t\t\t\t\t? `<${arg.name}>`\n\t\t\t\t\t: `[${arg.name}]`,\n\t\t)\n\t\t.join(\" \");\n\tconst options = command.options?.length ? \" [options]\" : \"\";\n\treturn `line ${command.name}${args ? ` ${args}` : \"\"}${options}`;\n}\n\nexport function commandOptions(command: CommandSpec): readonly OptionSpec[] {\n\treturn command.options ?? [];\n}\n\nexport function isMcpExecutable(command: CommandSpec): boolean {\n\treturn command.mcp !== false && !command.longRunning;\n}\n\nexport interface CommandMetadata {\n\tname: string;\n\tsummary: string;\n\tdescription?: string;\n\tcategory: string;\n\tusage: string;\n\targs: readonly CommandArgument[];\n\toptions: readonly OptionSpec[];\n\tauth: boolean;\n\tlongRunning: boolean;\n\tmcpExecutable: boolean;\n\tsilent: boolean;\n\texamples: readonly string[];\n}\n\nexport function commandMetadata(command: CommandSpec, includeOptions = true): CommandMetadata {\n\treturn {\n\t\tname: command.name,\n\t\tsummary: command.summary,\n\t\t...(command.description ? { description: command.description } : {}),\n\t\tcategory: command.category,\n\t\tusage: commandUsage(command),\n\t\targs: command.args ?? [],\n\t\toptions: includeOptions ? commandOptions(command) : [],\n\t\tauth: Boolean(command.auth),\n\t\tlongRunning: Boolean(command.longRunning),\n\t\tmcpExecutable: isMcpExecutable(command),\n\t\tsilent: Boolean(command.silent),\n\t\texamples: command.examples ?? [],\n\t};\n}\n\nexport function groupNames(commands: readonly CommandSpec[]): string[] {\n\tconst groups = new Set<string>();\n\tfor (const command of commands) {\n\t\tconst first = command.name.split(\" \")[0]!;\n\t\tif (command.name.includes(\" \")) groups.add(first);\n\t}\n\treturn [...groups];\n}\n\nexport function commandsInGroup(commands: readonly CommandSpec[], group: string): CommandSpec[] {\n\treturn commands.filter((command) => command.name.split(\" \")[0] === group);\n}\n","import { readFile, stat, writeFile } from \"node:fs/promises\";\nimport { extname, resolve } from \"node:path\";\nimport { CliError, UsageError } from \"./errors.ts\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n\t\".jpg\": \"image/jpeg\",\n\t\".jpeg\": \"image/jpeg\",\n\t\".png\": \"image/png\",\n\t\".gif\": \"image/gif\",\n\t\".webp\": \"image/webp\",\n\t\".heic\": \"image/heic\",\n\t\".mp4\": \"video/mp4\",\n\t\".mov\": \"video/quicktime\",\n\t\".m4v\": \"video/mp4\",\n\t\".webm\": \"video/webm\",\n\t\".mp3\": \"audio/mpeg\",\n\t\".m4a\": \"audio/mp4\",\n\t\".aac\": \"audio/aac\",\n\t\".wav\": \"audio/wav\",\n\t\".ogg\": \"audio/ogg\",\n\t\".pdf\": \"application/pdf\",\n\t\".txt\": \"text/plain\",\n\t\".json\": \"application/json\",\n\t\".zip\": \"application/zip\",\n};\n\nexport function mimeFromFilename(filename: string): string {\n\treturn MIME_BY_EXTENSION[extname(filename).toLowerCase()] ?? \"application/octet-stream\";\n}\n\nexport function resolveInputPath(path: string, cwd: string): string {\n\treturn path === \"-\" ? \"-\" : resolve(cwd, path);\n}\n\nexport async function readTextInput(\n\tpath: string | undefined,\n\tcwd: string,\n\tstdin: NodeJS.ReadableStream = process.stdin,\n): Promise<string> {\n\tif (path === undefined || path === \"-\") {\n\t\tlet text = \"\";\n\t\tfor await (const chunk of stdin) {\n\t\t\ttext += typeof chunk === \"string\" ? chunk : Buffer.from(chunk).toString(\"utf8\");\n\t\t}\n\t\treturn text;\n\t}\n\treturn await readFile(resolve(cwd, path), \"utf8\");\n}\n\nexport async function readFileAsBlob(\n\tpath: string,\n\tcwd: string,\n): Promise<{ blob: Blob; filename: string; path: string }> {\n\tconst resolved = resolve(cwd, path);\n\tlet info;\n\ttry {\n\t\tinfo = await stat(resolved);\n\t} catch (error) {\n\t\tthrow new CliError(\"NOT_FOUND\", `File not found: ${resolved}`, { cause: error });\n\t}\n\tif (!info.isFile()) throw new UsageError(`Not a file: ${resolved}`);\n\tconst data = await readFile(resolved);\n\tconst filename = resolved.split(/[\\\\/]/).at(-1) ?? \"file\";\n\treturn {\n\t\tblob: new Blob([data], { type: mimeFromFilename(filename) }),\n\t\tfilename,\n\t\tpath: resolved,\n\t};\n}\n\nexport async function writeBinaryFile(\n\tpath: string,\n\tdata: Blob | Uint8Array | ArrayBuffer,\n\tcwd: string,\n): Promise<{ path: string; size: number }> {\n\tconst resolved = resolve(cwd, path);\n\tconst bytes =\n\t\tdata instanceof Blob\n\t\t\t? new Uint8Array(await data.arrayBuffer())\n\t\t\t: data instanceof ArrayBuffer\n\t\t\t\t? new Uint8Array(data)\n\t\t\t\t: data;\n\tawait writeFile(resolved, bytes);\n\treturn { path: resolved, size: bytes.byteLength };\n}\n","import { inspect } from \"node:util\";\n\nexport interface SerializeOptions {\n\t/** Include stacks in Error objects. Defaults to false. */\n\tincludeStack?: boolean;\n}\n\n/**\n * Convert a LINEJS result into a JSON-safe value. LINE uses a mix of string\n * ids, 64-bit integers, Dates, and binary blobs, so plain JSON.stringify is not\n * enough for `--json`.\n */\nexport function serialize(value: unknown, options: SerializeOptions = {}): unknown {\n\tconst seen = new WeakSet<object>();\n\n\tconst walk = (input: unknown): unknown => {\n\t\tif (input === null || typeof input === \"string\" || typeof input === \"boolean\") {\n\t\t\treturn input;\n\t\t}\n\t\tif (typeof input === \"number\") {\n\t\t\treturn Number.isFinite(input) ? input : String(input);\n\t\t}\n\t\tif (typeof input === \"bigint\") {\n\t\t\treturn input.toString();\n\t\t}\n\t\tif (typeof input === \"undefined\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (typeof input === \"function\") {\n\t\t\treturn `[Function ${input.name || \"anonymous\"}]`;\n\t\t}\n\t\tif (typeof input === \"symbol\") {\n\t\t\treturn input.toString();\n\t\t}\n\n\t\tif (input instanceof Date) return input.toISOString();\n\t\tif (input instanceof Error) {\n\t\t\treturn {\n\t\t\t\tname: input.name,\n\t\t\t\tmessage: input.message,\n\t\t\t\t...(input.cause === undefined ? {} : { cause: walk(input.cause) }),\n\t\t\t\t...(\"code\" in input && typeof input.code === \"string\" ? { code: input.code } : {}),\n\t\t\t\t...(\"details\" in input && input.details !== undefined\n\t\t\t\t\t? { details: walk(input.details) }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.includeStack && input.stack ? { stack: input.stack } : {}),\n\t\t\t};\n\t\t}\n\t\tif (typeof Blob !== \"undefined\" && input instanceof Blob) {\n\t\t\treturn {\n\t\t\t\ttype: input.type || \"application/octet-stream\",\n\t\t\t\tsize: input.size,\n\t\t\t\t...(typeof File !== \"undefined\" && input instanceof File ? { name: input.name } : {}),\n\t\t\t};\n\t\t}\n\t\tif (input instanceof ArrayBuffer) {\n\t\t\treturn { type: \"ArrayBuffer\", byteLength: input.byteLength };\n\t\t}\n\t\tif (ArrayBuffer.isView(input)) {\n\t\t\treturn {\n\t\t\t\ttype: input.constructor.name,\n\t\t\t\tbyteLength: input.byteLength,\n\t\t\t};\n\t\t}\n\n\t\tif (typeof input !== \"object\") return String(input);\n\t\tif (seen.has(input)) return \"[Circular]\";\n\t\tseen.add(input);\n\n\t\ttry {\n\t\t\tif (input instanceof Map) {\n\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t[...input.entries()].map(([key, value]) => [String(key), walk(value)]),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (input instanceof Set) {\n\t\t\t\treturn [...input].map(walk);\n\t\t\t}\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\treturn input.map(walk);\n\t\t\t}\n\t\t\tconst output: Record<string, unknown> = {};\n\t\t\tfor (const [key, value] of Object.entries(input as Record<string, unknown>)) {\n\t\t\t\tconst converted = walk(value);\n\t\t\t\tif (converted !== undefined) output[key] = converted;\n\t\t\t}\n\t\t\treturn output;\n\t\t} finally {\n\t\t\tseen.delete(input);\n\t\t}\n\t};\n\n\treturn walk(value);\n}\n\nexport function formatJson(value: unknown): string {\n\treturn JSON.stringify(serialize(value), null, 2);\n}\n\n/** Compact one-line rendering for tables and key/value output. */\nexport function humanValue(value: unknown): string {\n\tif (value === null) return \"null\";\n\tif (value === undefined) return \"\";\n\tif (typeof value === \"string\") return value;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"bigint\") return value.toString();\n\tif (value instanceof Date) return value.toISOString();\n\tif (Array.isArray(value)) return value.map(humanValue).join(\", \");\n\tif (typeof value === \"object\") return inspect(value, { depth: 2, breakLength: Infinity });\n\treturn String(value);\n}\n\nexport interface OutputStreams {\n\tstdout(chunk: string): void;\n\tstderr(chunk: string): void;\n}\n\nexport interface OutputOptions {\n\tjson: boolean;\n\tcolor?: boolean;\n}\n\nexport interface TableColumn {\n\tkey: string;\n\tlabel?: string;\n\tmaxWidth?: number;\n}\n\nexport class Output {\n\treadonly streams: OutputStreams;\n\treadonly json: boolean;\n\treadonly color: boolean;\n\n\tconstructor(streams: OutputStreams, options: OutputOptions) {\n\t\tthis.streams = streams;\n\t\tthis.json = options.json;\n\t\tthis.color = options.color ?? false;\n\t}\n\n\twrite(text: string): void {\n\t\tthis.streams.stdout(text);\n\t}\n\n\twriteLine(text = \"\"): void {\n\t\tthis.streams.stdout(`${text}\\n`);\n\t}\n\n\twriteErr(text: string): void {\n\t\tthis.streams.stderr(text);\n\t}\n\n\twriteErrLine(text = \"\"): void {\n\t\tthis.streams.stderr(`${text}\\n`);\n\t}\n\n\tstyle(style: \"bold\" | \"dim\" | \"red\" | \"green\" | \"yellow\" | \"cyan\", text: string): string {\n\t\tif (!this.color) return text;\n\t\tconst codes = {\n\t\t\tbold: [\"1\", \"22\"],\n\t\t\tdim: [\"2\", \"22\"],\n\t\t\tred: [\"31\", \"39\"],\n\t\t\tgreen: [\"32\", \"39\"],\n\t\t\tyellow: [\"33\", \"39\"],\n\t\t\tcyan: [\"36\", \"39\"],\n\t\t} as const;\n\t\tconst [open, close] = codes[style];\n\t\treturn `\\u001b[${open}m${text}\\u001b[${close}m`;\n\t}\n\n\t/** Emit a command result: JSON in --json mode, otherwise the formatter. */\n\tresult(value: unknown, formatter?: (value: unknown) => string): void {\n\t\tif (this.json) {\n\t\t\tthis.writeLine(formatJson(value));\n\t\t\treturn;\n\t\t}\n\t\tconst text = formatter ? formatter(value) : formatJson(value);\n\t\tif (text.length) this.writeLine(text);\n\t}\n\n\tjsonLine(value: unknown): void {\n\t\tthis.writeLine(JSON.stringify(serialize(value)));\n\t}\n\n\theading(text: string): void {\n\t\tthis.writeLine(this.style(\"bold\", text));\n\t}\n\n\tdim(text: string): string {\n\t\treturn this.style(\"dim\", text);\n\t}\n\n\tkeyValue(values: Record<string, unknown>): void {\n\t\tconst entries = Object.entries(values).filter(([, value]) => value !== undefined);\n\t\tif (!entries.length) return;\n\t\tconst width = Math.max(...entries.map(([key]) => key.length));\n\t\tfor (const [key, value] of entries) {\n\t\t\tthis.writeLine(`${key.padEnd(width)} ${humanValue(value)}`);\n\t\t}\n\t}\n\n\ttable(rows: readonly Record<string, unknown>[], columns: readonly TableColumn[]): void {\n\t\tif (!rows.length) {\n\t\t\tthis.writeLine(this.dim(\"(empty)\"));\n\t\t\treturn;\n\t\t}\n\t\tconst values = rows.map((row) =>\n\t\t\tcolumns.map((column) => humanValue(row[column.key]).replace(/\\s+/g, \" \").trim()),\n\t\t);\n\t\tconst widths = columns.map((column, index) => {\n\t\t\tconst max = column.maxWidth ?? 48;\n\t\t\tconst contentWidth = Math.max(\n\t\t\t\tcolumn.label?.length ?? column.key.length,\n\t\t\t\t...values.map((row) => row[index]!.length),\n\t\t\t);\n\t\t\treturn Math.min(contentWidth, max);\n\t\t});\n\t\tconst header = columns\n\t\t\t.map((column, index) => (column.label ?? column.key).padEnd(widths[index]!))\n\t\t\t.join(\" \");\n\t\tthis.writeLine(this.style(\"bold\", header.trimEnd()));\n\t\tfor (const row of values) {\n\t\t\tthis.writeLine(\n\t\t\t\trow\n\t\t\t\t\t.map((cell, index) => {\n\t\t\t\t\t\tconst width = widths[index]!;\n\t\t\t\t\t\tconst clipped =\n\t\t\t\t\t\t\tcell.length > width ? `${cell.slice(0, Math.max(0, width - 1))}…` : cell;\n\t\t\t\t\t\treturn clipped.padEnd(width);\n\t\t\t\t\t})\n\t\t\t\t\t.join(\" \")\n\t\t\t\t\t.trimEnd(),\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function formatErrorText(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\treturn humanValue(error);\n}\n","import { encode, renderANSI, renderUnicode, renderUnicodeCompact } from \"uqr\";\nimport type { CommandContext } from \"./context.ts\";\n\nexport type QrFormat = \"compact\" | \"unicode\" | \"ansi\" | \"ascii\" | \"none\";\n\nexport const QR_FORMATS: readonly QrFormat[] = [\"compact\", \"unicode\", \"ansi\", \"ascii\", \"none\"];\n\nexport function renderQr(text: string, format: QrFormat = \"compact\"): string {\n\tswitch (format) {\n\t\tcase \"none\":\n\t\t\treturn \"\";\n\t\tcase \"ansi\":\n\t\t\treturn renderANSI(text, { ecc: \"M\", border: 2 });\n\t\tcase \"unicode\":\n\t\t\treturn renderUnicode(text, { ecc: \"M\", border: 2 });\n\t\tcase \"ascii\": {\n\t\t\tconst { data } = encode(text, { ecc: \"M\", border: 2 });\n\t\t\treturn data.map((row) => row.map((filled) => (filled ? \"██\" : \" \")).join(\"\")).join(\"\\n\");\n\t\t}\n\t\tcase \"compact\":\n\t\tdefault:\n\t\t\treturn renderUnicodeCompact(text, { ecc: \"M\", border: 2 });\n\t}\n}\n\nexport function qrFormat(context: CommandContext): QrFormat {\n\tconst value = (context.getString(\"qr-format\") ?? \"compact\") as QrFormat;\n\treturn QR_FORMATS.includes(value) ? value : \"compact\";\n}\n\n/** QR codes and PINs travel on stderr so `--json` stdout stays valid. */\nexport function printQr(context: CommandContext, url: string): void {\n\tconst format = qrFormat(context);\n\tconst qr = renderQr(url, format);\n\tcontext.output.writeErrLine(\"\");\n\tif (qr) {\n\t\tcontext.output.writeErrLine(qr);\n\t\tcontext.output.writeErrLine(\"\");\n\t}\n\tcontext.output.writeErrLine(context.output.style(\"bold\", \"Scan this URL with LINE:\"));\n\tcontext.output.writeErrLine(url);\n\tcontext.output.writeErrLine(\"\");\n}\n\nexport function printPin(context: CommandContext, pin: string): void {\n\tcontext.output.writeErrLine(\"\");\n\tcontext.output.writeErrLine(context.output.style(\"bold\", \"Enter this PIN in the LINE app:\"));\n\tcontext.output.writeErrLine(` ${pin}`);\n\tcontext.output.writeErrLine(\"\");\n}\n","import { BaseStorage, type Storage } from \"@evex-dev/linejs/storage\";\nimport type { ProfileStore, StorageValue } from \"./profile-store.ts\";\n\n/**\n * LINEJS storage backed by the same JSON file as the profile. Keeping the\n * E2EE keys, refresh token, and reqseq counter in one profile makes\n * `~/.linejs/<profile>.json` self-contained and portable.\n */\nexport class ProfileStorage extends BaseStorage {\n\treadonly store: ProfileStore;\n\n\tconstructor(store: ProfileStore) {\n\t\tsuper();\n\t\tthis.store = store;\n\t}\n\n\tasync set(key: Storage[\"Key\"], value: Storage[\"Value\"]): Promise<void> {\n\t\tawait this.store.setStorage(key, value as StorageValue);\n\t}\n\n\tasync get(key: Storage[\"Key\"]): Promise<Storage[\"Value\"] | undefined> {\n\t\treturn this.store.getStorage(key) as Storage[\"Value\"] | undefined;\n\t}\n\n\tasync delete(key: Storage[\"Key\"]): Promise<void> {\n\t\tawait this.store.deleteStorage(key);\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait this.store.clearStorage();\n\t}\n\n\tasync migrate(storage: BaseStorage): Promise<void> {\n\t\tfor (const [key, value] of Object.entries(this.store.data.storage)) {\n\t\t\tawait storage.set(key, value);\n\t\t}\n\t}\n}\n","import { homedir } from \"node:os\";\nimport { basename, isAbsolute, join, resolve, sep } from \"node:path\";\n\nexport interface ProfileLocation {\n\t/** Absolute path of the profile JSON file. */\n\tpath: string;\n\t/** Profile name used for display. */\n\tname: string;\n\t/** Root directory used for named profiles. */\n\thome: string;\n\t/** True when the user supplied an explicit path instead of a name. */\n\texplicitPath: boolean;\n}\n\nexport function linejsHome(env: NodeJS.ProcessEnv = process.env): string {\n\tconst configured = env.LINEJS_HOME?.trim();\n\tif (configured) return resolve(configured);\n\treturn join(homedir(), \".linejs\");\n}\n\nfunction expandHome(value: string): string {\n\tif (value === \"~\") return homedir();\n\tif (value.startsWith(`~${sep}`) || value.startsWith(\"~/\")) {\n\t\treturn join(homedir(), value.slice(2));\n\t}\n\treturn value;\n}\n\nfunction looksLikePath(value: string): boolean {\n\treturn (\n\t\tisAbsolute(value) ||\n\t\tvalue.startsWith(\".\") ||\n\t\tvalue.startsWith(\"~\") ||\n\t\tvalue.includes(\"/\") ||\n\t\tvalue.includes(\"\\\\\")\n\t);\n}\n\nfunction profileNameFromPath(path: string): string {\n\tconst file = basename(path);\n\treturn file.endsWith(\".json\") ? file.slice(0, -\".json\".length) : file;\n}\n\n/**\n * Resolve --profile:\n * default / profile2 -> ~/.linejs/<name>.json\n * profile2.json -> ~/.linejs/profile2.json\n * ./profiles/work.json -> <cwd>/profiles/work.json\n * /tmp/line.json -> /tmp/line.json\n */\nexport function resolveProfileLocation(\n\tprofile: string | undefined,\n\tenv: NodeJS.ProcessEnv = process.env,\n\tcwd: string = process.cwd(),\n): ProfileLocation {\n\tconst home = linejsHome(env);\n\tconst value = (profile ?? env.LINEJS_PROFILE ?? \"default\").trim();\n\tif (!value) throw new Error(\"Profile name must not be empty\");\n\tif (value.includes(\"\\0\")) throw new Error(\"Profile name must not contain NUL bytes\");\n\tif (value === \".\" || value === \"..\") {\n\t\tthrow new Error(`Invalid profile name: ${value}`);\n\t}\n\n\tif (looksLikePath(value)) {\n\t\tconst expanded = expandHome(value);\n\t\tconst path = isAbsolute(expanded) ? resolve(expanded) : resolve(cwd, expanded);\n\t\treturn { path, name: profileNameFromPath(path), home, explicitPath: true };\n\t}\n\n\tconst file = value.endsWith(\".json\") ? value : `${value}.json`;\n\tconst path = join(home, file);\n\treturn { path, name: profileNameFromPath(path), home, explicitPath: false };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { CliError } from \"./errors.ts\";\nimport { serialize } from \"./output.ts\";\nimport { linejsHome } from \"./paths.ts\";\n\nexport type StorageValue = string | number | boolean | null | Record<string, unknown>;\n\nexport const PROFILE_VERSION = 1;\n\nexport interface ProfileAccount {\n\tmid?: string;\n\tdisplayName?: string;\n\tstatusMessage?: string;\n}\n\nexport interface ProfileLogin {\n\tmethod: \"qr\" | \"password\" | \"token\";\n\tat: string;\n}\n\nexport interface ProfileFile {\n\tversion: number;\n\tname: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tdevice: string;\n\tappVersion?: string;\n\tendpoint?: string;\n\tauthToken?: string;\n\taccount?: ProfileAccount;\n\t/** Last successfully fetched LINE profile, used when --check-session is off. */\n\tprofile?: Record<string, unknown>;\n\tprofileUpdatedAt?: string;\n\tlogin?: ProfileLogin;\n\tstorage: Record<string, StorageValue>;\n\t[key: string]: unknown;\n}\n\nexport interface ProfileSummary {\n\tname: string;\n\tpath: string;\n\tdevice?: string;\n\tappVersion?: string;\n\tendpoint?: string;\n\tauthToken: boolean;\n\tprofileCached: boolean;\n\tprofileUpdatedAt?: string;\n\tmid?: string;\n\tdisplayName?: string;\n\tcreatedAt?: string;\n\tupdatedAt?: string;\n\tlogin?: ProfileLogin;\n}\n\nfunction ensureObject(value: unknown, path: string): Record<string, unknown> {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new CliError(\"PROFILE_INVALID\", `Profile is not a JSON object: ${path}`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nfunction ensureStorage(value: unknown, path: string): Record<string, StorageValue> {\n\tif (value === undefined) return {};\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new CliError(\"PROFILE_INVALID\", `Profile storage is not an object: ${path}`);\n\t}\n\treturn value as Record<string, StorageValue>;\n}\n\nfunction tokenExpiry(storage: Record<string, StorageValue>): {\n\texpiresAt: string | null;\n\texpired: boolean | null;\n} {\n\tconst raw = storage.expire;\n\tconst value = typeof raw === \"string\" ? Number(raw) : typeof raw === \"number\" ? raw : NaN;\n\tif (!Number.isFinite(value) || value <= 0) return { expiresAt: null, expired: null };\n\t// LINE stores epoch seconds; also accept epoch milliseconds.\n\tconst milliseconds = value < 1e12 ? value * 1000 : value;\n\tconst date = new Date(milliseconds);\n\tif (Number.isNaN(date.getTime())) return { expiresAt: null, expired: null };\n\treturn { expiresAt: date.toISOString(), expired: Date.now() >= milliseconds };\n}\n\nexport class ProfileStore {\n\treadonly path: string;\n\treadonly name: string;\n\tdata: ProfileFile;\n\t#chain: Promise<void> = Promise.resolve();\n\t#lastError: unknown;\n\n\tprivate constructor(path: string, name: string, data: ProfileFile) {\n\t\tthis.path = path;\n\t\tthis.name = name;\n\t\tthis.data = data;\n\t}\n\n\tstatic async open(\n\t\tpath: string,\n\t\toptions: { create?: boolean; name?: string } = {},\n\t): Promise<ProfileStore> {\n\t\tconst now = new Date().toISOString();\n\t\tlet data: ProfileFile;\n\t\ttry {\n\t\t\tconst text = await readFile(path, \"utf8\");\n\t\t\tconst raw = ensureObject(JSON.parse(text), path);\n\t\t\tconst storage = ensureStorage(raw.storage, path);\n\t\t\tdata = {\n\t\t\t\t...raw,\n\t\t\t\tversion: typeof raw.version === \"number\" ? raw.version : PROFILE_VERSION,\n\t\t\t\tname: typeof raw.name === \"string\" ? raw.name : (options.name ?? \"default\"),\n\t\t\t\tcreatedAt: typeof raw.createdAt === \"string\" ? raw.createdAt : now,\n\t\t\t\tupdatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : now,\n\t\t\t\tdevice: typeof raw.device === \"string\" ? raw.device : \"ANDROIDSECONDARY\",\n\t\t\t\tauthToken: typeof raw.authToken === \"string\" ? raw.authToken : undefined,\n\t\t\t\tstorage,\n\t\t\t} as ProfileFile;\n\t\t} catch (error) {\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\") {\n\t\t\t\tif (error instanceof CliError) throw error;\n\t\t\t\tthrow new CliError(\"PROFILE_INVALID\", `Could not read profile: ${path}`, {\n\t\t\t\t\tcause: error,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!options.create) {\n\t\t\t\tthrow new CliError(\"PROFILE_NOT_FOUND\", `Profile not found: ${path}`, {\n\t\t\t\t\tdetails: { path, hint: \"Run `line auth login` first.\" },\n\t\t\t\t});\n\t\t\t}\n\t\t\tdata = {\n\t\t\t\tversion: PROFILE_VERSION,\n\t\t\t\tname: options.name ?? \"default\",\n\t\t\t\tcreatedAt: now,\n\t\t\t\tupdatedAt: now,\n\t\t\t\tdevice: \"ANDROIDSECONDARY\",\n\t\t\t\tstorage: {},\n\t\t\t};\n\t\t}\n\t\treturn new ProfileStore(path, data.name, data);\n\t}\n\n\t#scheduleWrite(): Promise<void> {\n\t\tconst snapshot = JSON.stringify(this.data, null, \"\\t\");\n\t\tconst run = this.#chain.then(async () => {\n\t\t\tconst directory = dirname(this.path);\n\t\t\tawait mkdir(directory, { recursive: true, mode: 0o700 });\n\t\t\tconst temporary = join(directory, `.${this.name}.${process.pid}.${randomUUID()}.tmp`);\n\t\t\tawait writeFile(temporary, `${snapshot}\\n`, { encoding: \"utf8\", mode: 0o600 });\n\t\t\tawait rename(temporary, this.path);\n\t\t\tawait chmod(this.path, 0o600).catch(() => {});\n\t\t});\n\t\tthis.#chain = run.catch((error) => {\n\t\t\tthis.#lastError = error;\n\t\t});\n\t\treturn run;\n\t}\n\n\tasync save(): Promise<void> {\n\t\tthis.data.updatedAt = new Date().toISOString();\n\t\tawait this.#scheduleWrite();\n\t}\n\n\tasync flush(): Promise<void> {\n\t\tawait this.#chain;\n\t\tif (this.#lastError) {\n\t\t\tconst error = this.#lastError;\n\t\t\tthis.#lastError = undefined;\n\t\t\tthrow new CliError(\"INTERNAL\", `Could not write profile: ${this.path}`, {\n\t\t\t\tcause: error,\n\t\t\t});\n\t\t}\n\t}\n\n\tsetAuthToken(token: string): Promise<void> {\n\t\tthis.data.authToken = token;\n\t\treturn this.save();\n\t}\n\n\tsetAccount(account: ProfileAccount): Promise<void> {\n\t\tthis.data.account = { ...this.data.account, ...account };\n\t\treturn this.save();\n\t}\n\n\t/** Cache the full profile so non-checking commands can work offline. */\n\tsetCachedProfile(profile: Record<string, unknown>, account?: ProfileAccount): Promise<void> {\n\t\tthis.data.profile = serialize(profile) as Record<string, unknown>;\n\t\tthis.data.profileUpdatedAt = new Date().toISOString();\n\t\tif (account) this.data.account = { ...this.data.account, ...account };\n\t\treturn this.save();\n\t}\n\n\tsetLogin(method: ProfileLogin[\"method\"]): Promise<void> {\n\t\tthis.data.login = { method, at: new Date().toISOString() };\n\t\treturn this.save();\n\t}\n\n\tsetDevice(device: string, appVersion?: string): Promise<void> {\n\t\tthis.data.device = device;\n\t\tif (appVersion) this.data.appVersion = appVersion;\n\t\treturn this.save();\n\t}\n\n\tgetStorage(key: string): StorageValue | undefined {\n\t\treturn this.data.storage[key];\n\t}\n\n\tasync setStorage(key: string, value: StorageValue): Promise<void> {\n\t\tthis.data.storage[key] = value;\n\t\tawait this.save();\n\t}\n\n\tasync deleteStorage(key: string): Promise<void> {\n\t\tdelete this.data.storage[key];\n\t\tawait this.save();\n\t}\n\n\tasync clearStorage(): Promise<void> {\n\t\tthis.data.storage = {};\n\t\tawait this.save();\n\t}\n\n\tget authToken(): string | undefined {\n\t\treturn this.data.authToken;\n\t}\n\n\ttokenExpiry(): { expiresAt: string | null; expired: boolean | null } {\n\t\treturn tokenExpiry(this.data.storage);\n\t}\n\n\tsummary(): ProfileSummary {\n\t\treturn {\n\t\t\tname: this.data.name,\n\t\t\tpath: this.path,\n\t\t\tdevice: this.data.device,\n\t\t\tappVersion: this.data.appVersion,\n\t\t\tendpoint: this.data.endpoint,\n\t\t\tauthToken: Boolean(this.data.authToken),\n\t\t\tprofileCached: Boolean(this.data.profile),\n\t\t\tprofileUpdatedAt: this.data.profileUpdatedAt,\n\t\t\tmid: this.data.account?.mid,\n\t\t\tdisplayName: this.data.account?.displayName,\n\t\t\tcreatedAt: this.data.createdAt,\n\t\t\tupdatedAt: this.data.updatedAt,\n\t\t\tlogin: this.data.login,\n\t\t};\n\t}\n\n\tasync delete(): Promise<void> {\n\t\tawait rm(this.path, { force: true });\n\t}\n}\n\nexport interface ProfileListEntry extends ProfileSummary {\n\tfile: string;\n\terror?: string;\n}\n\nexport async function listProfiles(\n\tenv: NodeJS.ProcessEnv = process.env,\n): Promise<{ home: string; profiles: ProfileListEntry[] }> {\n\tconst home = linejsHome(env);\n\tlet files: string[];\n\ttry {\n\t\tfiles = await readdir(home);\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n\t\t\treturn { home, profiles: [] };\n\t\t}\n\t\tthrow error;\n\t}\n\tconst profiles: ProfileListEntry[] = [];\n\tfor (const file of files.filter((entry) => entry.endsWith(\".json\")).sort()) {\n\t\tconst path = join(home, file);\n\t\ttry {\n\t\t\tconst store = await ProfileStore.open(path, { name: file.slice(0, -5) });\n\t\t\tprofiles.push({ ...store.summary(), file });\n\t\t} catch (error) {\n\t\t\tprofiles.push({\n\t\t\t\tname: file.slice(0, -5),\n\t\t\t\tpath,\n\t\t\t\tauthToken: false,\n\t\t\t\tprofileCached: false,\n\t\t\t\tfile,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\treturn { home, profiles };\n}\n","import { rm } from \"node:fs/promises\";\nimport { Client } from \"@evex-dev/linejs\";\nimport { BaseClient, type Device } from \"@evex-dev/linejs/base\";\nimport { type BaseStorage, MemoryStorage } from \"@evex-dev/linejs/storage\";\nimport type { Profile } from \"@evex-dev/linejs-types\";\nimport type { CommandContext } from \"./context.ts\";\nimport { CliError, UsageError, errorMessage } from \"./errors.ts\";\nimport { printPin, printQr } from \"./qr.ts\";\nimport { ProfileStorage } from \"./profile-storage.ts\";\nimport { type ProfileAccount, ProfileStore } from \"./profile-store.ts\";\n\nexport const DEVICES: readonly Device[] = [\n\t\"DESKTOPWIN\",\n\t\"DESKTOPMAC\",\n\t\"ANDROID\",\n\t\"ANDROIDSECONDARY\",\n\t\"IOS\",\n\t\"IOSIPAD\",\n\t\"WATCHOS\",\n\t\"WEAROS\",\n];\n\nexport interface ConnectedSession {\n\tclient: Client;\n\tbase: BaseClient;\n\tstore: ProfileStore;\n\t/** True when connect() verified the token with getProfile(). */\n\tcheckedSession: boolean;\n}\n\nexport interface LoginSession {\n\tclient: Client;\n\tbase: BaseClient;\n\tstore?: ProfileStore;\n\tauthToken: string;\n\tsaved: boolean;\n\tpath: string;\n\tmethod: LoginOptions[\"method\"];\n\taccount: ProfileAccount;\n}\n\nexport function validateDevice(value: string): Device {\n\tif (!DEVICES.includes(value as Device)) {\n\t\tthrow new UsageError(`Unsupported device: ${value} (expected ${DEVICES.join(\", \")})`);\n\t}\n\treturn value as Device;\n}\n\nexport function resolveDevice(context: CommandContext, fallback: string): Device {\n\treturn validateDevice(context.settings.device ?? fallback);\n}\n\nfunction accountFromProfile(base: BaseClient): ProfileAccount {\n\tconst profile = base.profile;\n\tif (!profile) return {};\n\treturn {\n\t\t...(profile.mid ? { mid: profile.mid } : {}),\n\t\t...(profile.displayName ? { displayName: profile.displayName } : {}),\n\t\t...(profile.statusMessage ? { statusMessage: profile.statusMessage } : {}),\n\t};\n}\n\nfunction attachLogging(context: CommandContext, base: BaseClient): void {\n\tif (!context.settings.verbose) return;\n\tbase.on(\"log\", (entry) => {\n\t\tlet data = \"\";\n\t\ttry {\n\t\t\tdata = JSON.stringify(entry.data, BaseClient.jsonReplacer);\n\t\t} catch {\n\t\t\tdata = String(entry.data);\n\t\t}\n\t\tif (data.length > 4000) data = `${data.slice(0, 4000)}…`;\n\t\tcontext.output.writeErrLine(`[linejs] ${entry.type}: ${data}`);\n\t});\n}\n\nfunction createBase(\n\tcontext: CommandContext,\n\tstore: ProfileStore | undefined,\n\tstorage: BaseStorage,\n\tdevice: Device,\n): BaseClient {\n\tconst base = new BaseClient({\n\t\tdevice,\n\t\tstorage,\n\t\tversion: context.settings.appVersion ?? store?.data.appVersion,\n\t\tendpoint: context.settings.endpoint ?? store?.data.endpoint,\n\t});\n\tif (context.settings.timeout !== undefined) {\n\t\tif (context.settings.timeout <= 0) throw new UsageError(\"--timeout must be positive\");\n\t\tbase.config.timeout = context.settings.timeout;\n\t\tbase.config.longTimeout = Math.max(base.config.longTimeout, context.settings.timeout);\n\t}\n\tattachLogging(context, base);\n\treturn base;\n}\n\n/**\n * Restore the in-memory profile from the last successful getProfile() or the\n * cached account fields, so commands can run without the preflight request.\n */\nfunction hydrateProfile(base: BaseClient, store: ProfileStore): void {\n\tconst snapshot = store.data.profile;\n\tif (snapshot && typeof snapshot === \"object\") {\n\t\tbase.profile = snapshot as unknown as Profile;\n\t\treturn;\n\t}\n\tconst account = store.data.account;\n\tif (account?.mid) {\n\t\tbase.profile = {\n\t\t\tmid: account.mid,\n\t\t\tdisplayName: account.displayName ?? \"\",\n\t\t\tstatusMessage: account.statusMessage ?? \"\",\n\t\t} as Profile;\n\t}\n}\n\nfunction authFailure(error: unknown): CliError {\n\tif (error instanceof CliError) return error;\n\treturn new CliError(\"AUTH_FAILED\", `LINE authentication failed: ${errorMessage(error)}`, {\n\t\tcause: error,\n\t\tdetails: {\n\t\t\thint: \"The auth token may have expired or been revoked. Run `line auth login --profile <name> --force` to sign in again.\",\n\t\t},\n\t});\n}\n\n/** Load the active profile, restore the LINE session, and return a Client. */\nexport async function connect(context: CommandContext): Promise<ConnectedSession> {\n\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\tname: context.settings.profile.name,\n\t});\n\tif (!store.authToken) {\n\t\tthrow new CliError(\"AUTH_REQUIRED\", \"This profile has no auth token\", {\n\t\t\tdetails: {\n\t\t\t\tpath: store.path,\n\t\t\t\thint: `Run \\`line auth login --profile ${store.path}\\` first.`,\n\t\t\t},\n\t\t});\n\t}\n\n\tconst device = resolveDevice(context, store.data.device);\n\tconst storage = new ProfileStorage(store);\n\tconst base = createBase(context, store, storage, device);\n\thydrateProfile(base, store);\n\n\tlet pending: Promise<void> = Promise.resolve();\n\tlet saveError: unknown;\n\tbase.on(\"update:authtoken\", (token) => {\n\t\tbase.authToken = token;\n\t\tif (store.authToken === token) return;\n\t\tpending = pending\n\t\t\t.then(() => store.setAuthToken(token))\n\t\t\t.catch((error) => {\n\t\t\t\tsaveError = error;\n\t\t\t});\n\t});\n\n\ttry {\n\t\tawait base.loginProcess.login({\n\t\t\tauthToken: store.authToken,\n\t\t\tskipCheck: !context.settings.checkSession,\n\t\t});\n\t} catch (error) {\n\t\tthrow authFailure(error);\n\t}\n\tawait pending;\n\tif (saveError) {\n\t\tthrow new CliError(\"INTERNAL\", `Could not save the refreshed auth token to ${store.path}`, {\n\t\t\tcause: saveError,\n\t\t});\n\t}\n\n\tif (context.settings.checkSession && base.profile) {\n\t\tawait store.setCachedProfile(\n\t\t\tbase.profile as unknown as Record<string, unknown>,\n\t\t\taccountFromProfile(base),\n\t\t);\n\t}\n\tawait store.flush();\n\n\treturn {\n\t\tclient: new Client(base),\n\t\tbase,\n\t\tstore,\n\t\tcheckedSession: context.settings.checkSession,\n\t};\n}\n\nexport interface LoginOptions {\n\tmethod: \"qr\" | \"password\" | \"token\";\n\temail?: string;\n\tpassword?: string;\n\tpincode?: string;\n\ttoken?: string;\n\tsave?: boolean;\n\tforce?: boolean;\n}\n\n/** Run a fresh login and (unless save=false) persist it to the profile file. */\nexport async function login(context: CommandContext, options: LoginOptions): Promise<LoginSession> {\n\tconst path = context.settings.profile.path;\n\tconst save = options.save !== false;\n\tlet existed = false;\n\tif (save) {\n\t\ttry {\n\t\t\tawait ProfileStore.open(path, { name: context.settings.profile.name });\n\t\t\texisted = true;\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof CliError) || error.code !== \"PROFILE_NOT_FOUND\") {\n\t\t\t\tif (!options.force) throw error;\n\t\t\t\t// --force may replace a corrupt profile. Remove it so the store can\n\t\t\t\t// start from a clean file; a valid profile keeps its E2EE storage.\n\t\t\t\tawait rm(path, { force: true });\n\t\t\t}\n\t\t}\n\n\t\tif (existed && !options.force) {\n\t\t\tthrow new CliError(\"PROFILE_EXISTS\", `Profile already exists: ${path}`, {\n\t\t\t\tdetails: {\n\t\t\t\t\tpath,\n\t\t\t\t\thint: \"Pass --force to replace it, or choose another --profile.\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\tconst store = save\n\t\t? await ProfileStore.open(path, { create: true, name: context.settings.profile.name })\n\t\t: undefined;\n\tconst storage: BaseStorage = store ? new ProfileStorage(store) : new MemoryStorage();\n\tconst device = resolveDevice(context, store?.data.device ?? \"ANDROIDSECONDARY\");\n\tconst base = createBase(context, store, storage, device);\n\n\tlet pending: Promise<void> = Promise.resolve();\n\tlet saveError: unknown;\n\tbase.on(\"update:authtoken\", (token) => {\n\t\tbase.authToken = token;\n\t\tif (!store || store.authToken === token) return;\n\t\tpending = pending\n\t\t\t.then(() => store.setAuthToken(token))\n\t\t\t.catch((error) => {\n\t\t\t\tsaveError = error;\n\t\t\t});\n\t});\n\tbase.on(\"qrcall\", (url) => {\n\t\tprintQr(context, url);\n\t});\n\tbase.on(\"pincall\", (pin) => {\n\t\tprintPin(context, pin);\n\t});\n\n\ttry {\n\t\tif (options.method === \"token\") {\n\t\t\tconst token = options.token?.trim();\n\t\t\tif (!token) throw new UsageError(\"Missing --token\");\n\t\t\tawait base.loginProcess.login({ authToken: token });\n\t\t} else if (options.method === \"password\") {\n\t\t\tif (!options.email) throw new UsageError(\"Password login requires --email\");\n\t\t\tconst password = options.password;\n\t\t\tif (!password) throw new UsageError(\"Password login requires --password or --password-stdin\");\n\t\t\tawait base.loginProcess.login({\n\t\t\t\temail: options.email,\n\t\t\t\tpassword,\n\t\t\t\t...(options.pincode ? { pincode: options.pincode } : {}),\n\t\t\t});\n\t\t} else {\n\t\t\tawait base.loginProcess.login({ qr: true });\n\t\t}\n\t} catch (error) {\n\t\tif (store && !existed) await store.delete().catch(() => {});\n\t\tthrow authFailure(error);\n\t}\n\n\tawait pending;\n\tif (saveError) {\n\t\tthrow new CliError(\"INTERNAL\", `Could not save the auth token to ${path}`, {\n\t\t\tcause: saveError,\n\t\t});\n\t}\n\n\tconst authToken = base.authToken;\n\tif (!authToken) {\n\t\tthrow new CliError(\"AUTH_FAILED\", \"Login completed without an auth token\");\n\t}\n\tconst account = accountFromProfile(base);\n\tif (store) {\n\t\tawait store.setDevice(device, context.settings.appVersion);\n\t\tif (context.settings.endpoint) {\n\t\t\tstore.data.endpoint = context.settings.endpoint;\n\t\t\tawait store.save();\n\t\t}\n\t\tif (base.profile) {\n\t\t\tawait store.setCachedProfile(base.profile as unknown as Record<string, unknown>, account);\n\t\t} else {\n\t\t\tawait store.setAccount(account);\n\t\t}\n\t\tawait store.setLogin(options.method);\n\t\tawait store.flush();\n\t}\n\n\treturn {\n\t\tclient: new Client(base),\n\t\tbase,\n\t\tstore,\n\t\tauthToken,\n\t\tsaved: Boolean(store),\n\t\tpath,\n\t\tmethod: options.method,\n\t\taccount,\n\t};\n}\n\n/** Run `fn` with a connected client and always flush profile writes. */\nexport async function withClient<T>(\n\tcontext: CommandContext,\n\tfn: (session: ConnectedSession) => Promise<T>,\n): Promise<T> {\n\tconst session = await connect(context);\n\ttry {\n\t\treturn await fn(session);\n\t} finally {\n\t\tawait session.store.flush();\n\t}\n}\n","import type { MessageReactionType } from \"@evex-dev/linejs-types\";\nimport {\n\tTalkMessage,\n\ttype Chat,\n\ttype Client,\n\ttype Square,\n\ttype SquareChat,\n\ttype SquareMessage,\n\ttype User,\n} from \"@evex-dev/linejs\";\nimport type { CommandContext } from \"../context.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport type { OptionSpec } from \"../args.ts\";\nimport { humanValue } from \"../output.ts\";\n\nexport const YES_OPTION: OptionSpec = {\n\tname: \"yes\",\n\ttype: \"boolean\",\n\tdescription: \"Confirm a destructive action without prompting.\",\n};\n\nexport function limitOption(defaultValue: number): OptionSpec {\n\treturn {\n\t\tname: \"limit\",\n\t\tshort: \"n\",\n\t\ttype: \"number\",\n\t\tvalueName: \"count\",\n\t\tdescription: `Maximum number of results (default: ${defaultValue}).`,\n\t};\n}\n\nexport function outOption(description = \"Write the result to this file.\"): OptionSpec {\n\treturn {\n\t\tname: \"out\",\n\t\ttype: \"string\",\n\t\tvalueName: \"path\",\n\t\tdescription,\n\t};\n}\n\nexport function pickString(record: unknown, key: string): string | undefined {\n\tif (!record || typeof record !== \"object\") return undefined;\n\tconst value = (record as Record<string, unknown>)[key];\n\treturn typeof value === \"string\" ? value : undefined;\n}\n\nexport function pickNumber(record: unknown, key: string): number | undefined {\n\tif (!record || typeof record !== \"object\") return undefined;\n\tconst value = (record as Record<string, unknown>)[key];\n\treturn typeof value === \"number\" ? value : undefined;\n}\n\nexport function asRecord(value: unknown): Record<string, unknown> {\n\treturn value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n}\n\n/**\n * User (1:1) mids start with \"u\". `talk.getChat` only serves group/room\n * chats, so user mids must go through the message-box APIs instead.\n */\nexport function isUserMid(mid: string): boolean {\n\treturn mid.startsWith(\"u\");\n}\n\nexport function userChatSummary(mid: string): Record<string, unknown> {\n\treturn {\n\t\tmid,\n\t\ttype: \"USER\",\n\t};\n}\n\n/**\n * Fetch recent talk messages for a 1:1 (user) mid via the message-box APIs.\n * Group/room mids keep using `Chat.fetchMessages`; this is the user-mid\n * counterpart that `client.getChat` cannot serve.\n */\nexport async function fetchUserTalkMessages(\n\tclient: Client,\n\tuserMid: string,\n\tlimit: number,\n): Promise<TalkMessage[]> {\n\tconst boxes = await client.base.talk.getMessageBoxes({\n\t\tmessageBoxListRequest: {},\n\t});\n\tconst box = boxes.messageBoxes.find((entry) => entry.id === userMid);\n\tif (!box) {\n\t\tthrow new CliError(\"NOT_FOUND\", `Message box ${userMid} was not found`, {\n\t\t\tdetails: {\n\t\t\t\tchatMid: userMid,\n\t\t\t\thint: \"Open the 1:1 chat once in an official client, then retry.\",\n\t\t\t},\n\t\t});\n\t}\n\tconst raws = await client.base.talk.getPreviousMessagesV2WithRequest({\n\t\trequest: {\n\t\t\tmessageBoxId: box.id,\n\t\t\tendMessageId: {\n\t\t\t\tmessageId: box.lastDeliveredMessageId.messageId,\n\t\t\t\tdeliveredTime: box.lastDeliveredMessageId.deliveredTime,\n\t\t\t},\n\t\t\tmessagesCount: limit,\n\t\t},\n\t});\n\treturn await Promise.all(raws.map((raw) => TalkMessage.fromRawTalk(raw, client)));\n}\n\n/**\n * Fetch recent talk messages for any talk mid. User (1:1) mids go through\n * the message-box path; group/room mids keep the existing `getChat` path.\n */\nexport async function fetchTalkMessages(\n\tclient: Client,\n\tchatMid: string,\n\tlimit: number,\n): Promise<TalkMessage[]> {\n\tif (!isUserMid(chatMid)) {\n\t\tconst chat = await client.getChat(chatMid);\n\t\treturn chat.fetchMessages(limit);\n\t}\n\treturn fetchUserTalkMessages(client, chatMid, limit);\n}\n\nexport function chatSummary(chat: Chat, includeRaw = false): Record<string, unknown> {\n\tconst raw = asRecord(chat.raw);\n\treturn {\n\t\tmid: chat.mid,\n\t\tname: chat.name,\n\t\ttype: raw.type,\n\t\tmemberCount: raw.memberCount ?? raw.extra,\n\t\tnotificationDisabled: raw.notificationDisabled,\n\t\tpicturePath: raw.picturePath,\n\t\tcreatedTime: raw.createdTime,\n\t\t...(includeRaw ? { raw: chat.raw } : {}),\n\t};\n}\n\nexport function userSummary(user: User, includeRaw = false): Record<string, unknown> {\n\tconst profile = asRecord(asRecord(user.raw).targetProfileDetail);\n\tconst status = asRecord(profile.statusMessage);\n\treturn {\n\t\tmid: user.mid,\n\t\tdisplayName: profile.profileName,\n\t\tstatusMessage: status.value,\n\t\tpictureStatus: profile.pictureStatus,\n\t\tpicturePath: profile.picturePath,\n\t\tmusicProfile: profile.musicProfile,\n\t\thiddenFromList: profile.hiddenFromList,\n\t\t...(includeRaw ? { raw: user.raw } : {}),\n\t};\n}\n\nexport function squareSummary(square: Square, includeRaw = false): Record<string, unknown> {\n\treturn {\n\t\tmid: square.mid,\n\t\tname: square.name,\n\t\tjoinMethod: square.raw.joinMethod,\n\t\tstate: square.raw.state,\n\t\t...(includeRaw ? { raw: square.raw } : {}),\n\t};\n}\n\nexport function squareChatSummary(\n\tsquareChat: SquareChat,\n\tincludeRaw = false,\n): Record<string, unknown> {\n\treturn {\n\t\tmid: squareChat.mid,\n\t\tname: squareChat.name,\n\t\tsquareMid: squareChat.raw.squareMid,\n\t\ttype: squareChat.raw.type,\n\t\tstate: squareChat.raw.state,\n\t\tmaxMemberCount: squareChat.raw.maxMemberCount,\n\t\t...(includeRaw ? { raw: squareChat.raw } : {}),\n\t};\n}\n\nexport function talkMessageSummary(\n\tmessage: TalkMessage,\n\tincludeRaw = false,\n): Record<string, unknown> {\n\tconst raw = asRecord(message.raw);\n\treturn {\n\t\tid: raw.id,\n\t\tchatMid: message.to.id,\n\t\tfrom: message.from.id,\n\t\tto: message.to.id,\n\t\ttoType: raw.toType,\n\t\tcontentType: raw.contentType,\n\t\ttext: message.text,\n\t\tcreatedTime: raw.createdTime,\n\t\tdeliveredTime: raw.deliveredTime,\n\t\trelatedMessageId: raw.relatedMessageId,\n\t\tisEdited: message.isEdited,\n\t\tupdatedTime: message.updatedTime,\n\t\t...(includeRaw ? { raw: message.raw } : {}),\n\t};\n}\n\nexport function squareMessageSummary(\n\tmessage: SquareMessage,\n\tincludeRaw = false,\n): Record<string, unknown> {\n\tconst raw = asRecord(message.raw);\n\tconst inner = asRecord(raw.message);\n\treturn {\n\t\tid: inner.id,\n\t\tchatMid: message.to.id,\n\t\tfrom: message.from.id,\n\t\tfromType: raw.fromType,\n\t\tcontentType: inner.contentType,\n\t\ttext: message.text,\n\t\tcreatedTime: inner.createdTime,\n\t\tdeliveredTime: inner.deliveredTime,\n\t\trelatedMessageId: inner.relatedMessageId,\n\t\t...(includeRaw ? { raw: message.raw } : {}),\n\t};\n}\n\nexport function resolveReaction(value: string): MessageReactionType {\n\tconst normalized = value.trim().toUpperCase();\n\tif (/^[0-7]$/.test(normalized)) return Number(normalized) as MessageReactionType;\n\tconst allowed = [\"ALL\", \"UNDO\", \"NICE\", \"LOVE\", \"FUN\", \"AMAZING\", \"SAD\", \"OMG\"] as const;\n\tif ((allowed as readonly string[]).includes(normalized)) {\n\t\treturn normalized as MessageReactionType;\n\t}\n\tthrow new UsageError(`Unknown reaction: ${value} (expected ${allowed.join(\", \")})`);\n}\n\nconst CONTENT_TYPES = [\n\t\"NONE\",\n\t\"IMAGE\",\n\t\"VIDEO\",\n\t\"AUDIO\",\n\t\"HTML\",\n\t\"PDF\",\n\t\"CALL\",\n\t\"STICKER\",\n\t\"PRESENCE\",\n\t\"GIFT\",\n\t\"GROUPBOARD\",\n\t\"APPLINK\",\n\t\"LINK\",\n\t\"CONTACT\",\n\t\"FILE\",\n\t\"LOCATION\",\n\t\"POSTNOTIFICATION\",\n\t\"RICH\",\n\t\"CHATEVENT\",\n\t\"MUSIC\",\n\t\"PAYMENT\",\n] as const;\n\nexport function resolveContentType(value: string | undefined): string | undefined {\n\tif (value === undefined) return undefined;\n\tconst normalized = value.toUpperCase();\n\tif (!(CONTENT_TYPES as readonly string[]).includes(normalized)) {\n\t\tthrow new UsageError(`Unknown content type: ${value}`);\n\t}\n\treturn normalized;\n}\n\nexport function requireJsonObject<T>(context: CommandContext, option: string): T | undefined {\n\tconst value = context.getJson<T>(option);\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new UsageError(`--${option} must be a JSON object`);\n\t}\n\treturn value;\n}\n\nexport function requireStringRecord(\n\tcontext: CommandContext,\n\toption: string,\n): Record<string, string> | undefined {\n\tconst value = requireJsonObject<Record<string, unknown>>(context, option);\n\tif (value === undefined) return undefined;\n\tconst output: Record<string, string> = {};\n\tfor (const [key, entry] of Object.entries(value)) {\n\t\tif (typeof entry !== \"string\") {\n\t\t\tthrow new UsageError(`--${option}.${key} must be a string`);\n\t\t}\n\t\toutput[key] = entry;\n\t}\n\treturn output;\n}\n\nexport function joinOrEmpty(values: readonly string[] | undefined): string {\n\treturn values?.length ? values.join(\", \") : \"\";\n}\n\nexport function printOk(context: CommandContext, message: string): Record<string, unknown> {\n\tif (!context.json) context.output.writeLine(message);\n\treturn { ok: true };\n}\n\nexport function summaryLine(values: Record<string, unknown>): string {\n\treturn Object.entries(values)\n\t\t.filter(([, value]) => value !== undefined && value !== \"\" && value !== null)\n\t\t.map(([key, value]) => `${key}=${humanValue(value)}`)\n\t\t.join(\" \");\n}\n","import type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readTextInput, writeBinaryFile } from \"../files.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient, type ConnectedSession } from \"../session.ts\";\nimport { outOption } from \"./shared.ts\";\n\ntype AnyFunction = (...args: unknown[]) => unknown;\n\nfunction resolveTarget(session: ConnectedSession, name: string): Record<string, unknown> {\n\tif (name === \"client\") return session.client as unknown as Record<string, unknown>;\n\tif (name === \"base\") return session.base as unknown as Record<string, unknown>;\n\tconst base = session.base as unknown as Record<string, unknown>;\n\tconst target = base[name];\n\tif (target === undefined) {\n\t\tthrow new CliError(\"NOT_FOUND\", `Unknown service: ${name}`, {\n\t\t\tdetails: { hint: \"Run `line api services` to list services.\" },\n\t\t});\n\t}\n\tif (!target || (typeof target !== \"object\" && typeof target !== \"function\")) {\n\t\tthrow new CliError(\"NOT_FOUND\", `Service is not an object: ${name}`);\n\t}\n\treturn target as Record<string, unknown>;\n}\n\nfunction methodNames(target: Record<string, unknown>): string[] {\n\tconst names = new Set<string>();\n\tlet current: object | null = target;\n\twhile (current && current !== Object.prototype) {\n\t\tfor (const name of Object.getOwnPropertyNames(current)) {\n\t\t\tif (name === \"constructor\" || name.startsWith(\"_\") || name.startsWith(\"#\")) continue;\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(current, name);\n\t\t\tif (!descriptor) continue;\n\t\t\tif (typeof descriptor.value === \"function\") names.add(name);\n\t\t\tif (typeof descriptor.get === \"function\") {\n\t\t\t\ttry {\n\t\t\t\t\tconst value = (target as Record<string, unknown>)[name];\n\t\t\t\t\tif (typeof value === \"function\") names.add(name);\n\t\t\t\t} catch {\n\t\t\t\t\t// A getter can require login state; skip it.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcurrent = Object.getPrototypeOf(current) as object | null;\n\t}\n\treturn [...names].sort();\n}\n\nconst servicesCommand: CommandSpec = {\n\tname: \"api services\",\n\tsummary: \"List LINEJS services exposed by the raw API bridge.\",\n\tcategory: \"Advanced\",\n\texamples: [\"line api services\", \"line api services --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base, client }) => {\n\t\t\tconst names = new Set<string>([\"client\", \"base\"]);\n\t\t\tfor (const name of Object.keys(base)) {\n\t\t\t\tif (name.startsWith(\"_\") || name.startsWith(\"#\")) continue;\n\t\t\t\tconst value = (base as unknown as Record<string, unknown>)[name];\n\t\t\t\tif (value && typeof value === \"object\") names.add(name);\n\t\t\t}\n\t\t\tconst services = [...names].sort().map((name) => {\n\t\t\t\tlet methods: string[] = [];\n\t\t\t\ttry {\n\t\t\t\t\tconst target =\n\t\t\t\t\t\tname === \"client\"\n\t\t\t\t\t\t\t? (client as unknown as Record<string, unknown>)\n\t\t\t\t\t\t\t: name === \"base\"\n\t\t\t\t\t\t\t\t? (base as unknown as Record<string, unknown>)\n\t\t\t\t\t\t\t\t: ((base as unknown as Record<string, unknown>)[name] as Record<string, unknown>);\n\t\t\t\t\tmethods = methodNames(target);\n\t\t\t\t} catch {\n\t\t\t\t\tmethods = [];\n\t\t\t\t}\n\t\t\t\treturn { name, methodCount: methods.length };\n\t\t\t});\n\t\t\treturn { services };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { services: Array<{ name: string; methodCount: number }> }).services\n\t\t\t.map((service) => `${service.name.padEnd(16)} ${service.methodCount} methods`)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst methodsCommand: CommandSpec = {\n\tname: \"api methods\",\n\tsummary: \"List public methods on a service.\",\n\tcategory: \"Advanced\",\n\targs: [\n\t\t{\n\t\t\tname: \"service\",\n\t\t\tdescription: \"Service name (talk, square, relation, client, ...).\",\n\t\t\trequired: true,\n\t\t},\n\t],\n\texamples: [\"line api methods talk\", \"line api methods obs\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst service = context.requireArg(0, \"service\");\n\t\treturn await withClient(context, async (session) => {\n\t\t\tconst target = resolveTarget(session, service);\n\t\t\treturn { service, methods: methodNames(target) };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { methods: string[] }).methods.join(\"\\n\");\n\t},\n};\n\nconst callCommand: CommandSpec = {\n\tname: \"api call\",\n\tsummary: \"Call any LINEJS service method directly with JSON arguments.\",\n\tdescription:\n\t\t\"This is the escape hatch for APIs without a dedicated command. A JSON object is passed as one argument; a JSON array is spread as multiple arguments. No shell is involved.\",\n\tcategory: \"Advanced\",\n\targs: [\n\t\t{ name: \"service\", description: \"Service name.\", required: true },\n\t\t{ name: \"method\", description: \"Method name.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"args\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"JSON arguments (object or array).\",\n\t\t},\n\t\t{\n\t\t\tname: \"args-file\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"path\",\n\t\t\tdescription: \"Read JSON arguments from a file (use - for stdin).\",\n\t\t},\n\t\toutOption(\"Save a Blob/Uint8Array result to this file.\"),\n\t],\n\texamples: [\n\t\t\"line api call talk getProfile --args '{}'\",\n\t\t`line api call square getSquare --args '{\"squareMid\":\"s...\"}'`,\n\t\t`line api call obs downloadObjectForService --args '[{\"obsPath\":\"talk/m/...\",\"oid\":\"...\"}]' --out ./file.bin`,\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst service = context.requireArg(0, \"service\");\n\t\tconst method = context.requireArg(1, \"method\");\n\t\tconst argsOption = context.getString(\"args\");\n\t\tconst fileOption = context.getString(\"args-file\");\n\t\tif (argsOption !== undefined && fileOption !== undefined) {\n\t\t\tthrow new UsageError(\"Use either --args or --args-file, not both\");\n\t\t}\n\t\tlet parsed: unknown;\n\t\tif (argsOption !== undefined) {\n\t\t\tparsed = parseJson(argsOption, \"--args\");\n\t\t} else if (fileOption !== undefined) {\n\t\t\tparsed = parseJson(await readTextInput(fileOption, context.settings.cwd), fileOption);\n\t\t}\n\t\tconst callArgs = parsed === undefined ? [] : Array.isArray(parsed) ? parsed : [parsed];\n\n\t\treturn await withClient(context, async (session) => {\n\t\t\tconst target = resolveTarget(session, service);\n\t\t\tconst fn = target[method];\n\t\t\tif (typeof fn !== \"function\") {\n\t\t\t\tthrow new CliError(\"NOT_FOUND\", `Method not found: ${service}.${method}`, {\n\t\t\t\t\tdetails: { hint: \"Run `line api methods <service>` to list methods.\" },\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst result = await (fn as AnyFunction).apply(target, callArgs);\n\t\t\tconst out = context.getString(\"out\");\n\t\t\tif (\n\t\t\t\tout &&\n\t\t\t\t(result instanceof Blob || result instanceof Uint8Array || result instanceof ArrayBuffer)\n\t\t\t) {\n\t\t\t\tconst written = await writeBinaryFile(out, result, context.settings.cwd);\n\t\t\t\treturn {\n\t\t\t\t\tok: true,\n\t\t\t\t\t...written,\n\t\t\t\t\ttype: result instanceof Blob ? result.type : undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { ok: true, result: result === undefined ? null : result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { result: unknown };\n\t\treturn formatJson(result.result);\n\t},\n};\n\nfunction parseJson(text: string, source: string): unknown {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch (error) {\n\t\tthrow new UsageError(`Invalid JSON in ${source}`, {\n\t\t\tcause: error instanceof Error ? error.message : String(error),\n\t\t});\n\t}\n}\n\nexport const apiCommands: CommandSpec[] = [servicesCommand, methodsCommand, callCommand];\n","import { rm } from \"node:fs/promises\";\nimport type { CommandSpec } from \"../command.ts\";\nimport type { CommandContext } from \"../context.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readTextInput } from \"../files.ts\";\nimport { listProfiles, ProfileStore } from \"../profile-store.ts\";\nimport { QR_FORMATS } from \"../qr.ts\";\nimport { login, withClient } from \"../session.ts\";\nimport { YES_OPTION } from \"./shared.ts\";\n\nfunction authLoginResult(session: Awaited<ReturnType<typeof login>>) {\n\treturn {\n\t\tok: true,\n\t\tsaved: session.saved,\n\t\tprofile: session.store?.name ?? \"memory\",\n\t\tpath: session.path,\n\t\tmethod: session.method,\n\t\taccount: session.account,\n\t\t...(session.saved ? {} : { authToken: session.authToken }),\n\t};\n}\n\nfunction formatLogin(value: unknown): string {\n\tconst result = value as ReturnType<typeof authLoginResult>;\n\tconst name = result.account.displayName ?? \"(unknown)\";\n\tconst mid = result.account.mid ?? \"(unknown mid)\";\n\tconst lines = [\n\t\t`Logged in as ${name} (${mid})`,\n\t\t`Method: ${result.method ?? \"unknown\"}`,\n\t\t`Profile: ${result.saved ? result.path : \"(not saved; --no-save)\"}`,\n\t];\n\tif (!result.saved && result.authToken) {\n\t\tlines.push(\"\", \"Auth token:\");\n\t\tlines.push(result.authToken);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nasync function readPassword(context: CommandContext): Promise<string | undefined> {\n\tconst direct = context.getString(\"password\");\n\tconst useStdin = context.getBool(\"password-stdin\");\n\tif (direct && useStdin) {\n\t\tthrow new UsageError(\"Use either --password or --password-stdin, not both\");\n\t}\n\tif (direct) return direct;\n\tif (useStdin) {\n\t\tconst text = await readTextInput(undefined, context.settings.cwd);\n\t\treturn text.replace(/\\r?\\n$/, \"\");\n\t}\n\treturn undefined;\n}\n\nconst loginCommand: CommandSpec = {\n\tname: \"auth login\",\n\tsummary: \"Sign in with a QR code, email/password, or an existing auth token.\",\n\tdescription:\n\t\t\"QR login is the default. Credentials are never written to disk; only the resulting auth token and LINEJS storage (E2EE keys, refresh token, reqseq) are saved to the profile file.\",\n\tcategory: \"Authentication\",\n\targs: [],\n\toptions: [\n\t\t{ name: \"qr\", type: \"boolean\", description: \"Use QR login (the default).\" },\n\t\t{\n\t\t\tname: \"email\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"address\",\n\t\t\tdescription: \"Email address for password login.\",\n\t\t},\n\t\t{\n\t\t\tname: \"password\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"password\",\n\t\t\tdescription: \"Password for email login (visible in shell history; prefer --password-stdin).\",\n\t\t},\n\t\t{\n\t\t\tname: \"password-stdin\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Read the password from stdin.\",\n\t\t},\n\t\t{\n\t\t\tname: \"token\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"token\",\n\t\t\tdescription: \"Reuse an existing LINE auth token instead of logging in.\",\n\t\t},\n\t\t{\n\t\t\tname: \"pincode\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"digits\",\n\t\t\tdescription: \"Constant 6-digit pincode for password login.\",\n\t\t},\n\t\t{\n\t\t\tname: \"qr-format\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"format\",\n\t\t\tchoices: QR_FORMATS,\n\t\t\tdescription: \"QR rendering: compact (default), unicode, ansi, ascii, or none.\",\n\t\t},\n\t\t{\n\t\t\tname: \"save\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Save the session to the profile file (use --no-save to disable).\",\n\t\t\tdefault: true,\n\t\t},\n\t\t{\n\t\t\tname: \"force\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Overwrite an existing profile.\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line auth login\",\n\t\t\"line auth login --profile work --qr-format compact\",\n\t\t\"line auth login --email me@example.com --password-stdin --force\",\n\t\t\"line auth login --token 'TOKEN' --profile ./backup.json\",\n\t],\n\tauth: false,\n\tasync run(context) {\n\t\tconst token = context.getString(\"token\");\n\t\tconst email = context.getString(\"email\");\n\t\tconst explicitQr = context.has(\"qr\") && context.getBool(\"qr\");\n\t\tif (token && (email || explicitQr)) {\n\t\t\tthrow new UsageError(\"Use only one of --token, --email, or --qr\");\n\t\t}\n\t\tif (explicitQr && email) {\n\t\t\tthrow new UsageError(\"Use only one of --qr or --email\");\n\t\t}\n\t\tconst passwordRequested =\n\t\t\tcontext.has(\"password\") || context.has(\"password-stdin\") || context.has(\"pincode\");\n\t\tif (!token && !email && passwordRequested) {\n\t\t\tthrow new UsageError(\"--email is required for password login options\");\n\t\t}\n\n\t\tlet method: \"qr\" | \"password\" | \"token\" = \"qr\";\n\t\tlet password: string | undefined;\n\t\tlet pincode: string | undefined;\n\t\tif (token) {\n\t\t\tmethod = \"token\";\n\t\t} else if (email) {\n\t\t\tmethod = \"password\";\n\t\t\tpassword = await readPassword(context);\n\t\t\tif (!password) {\n\t\t\t\tconst { promptSecret } = await import(\"../prompt.ts\");\n\t\t\t\tpassword = await promptSecret(\"Password: \", context);\n\t\t\t}\n\t\t\tpincode = context.getString(\"pincode\");\n\t\t\tif (pincode && !/^\\d{6}$/.test(pincode)) {\n\t\t\t\tthrow new UsageError(\"--pincode must be exactly 6 digits\");\n\t\t\t}\n\t\t}\n\n\t\tconst session = await login(context, {\n\t\t\tmethod,\n\t\t\temail,\n\t\t\tpassword,\n\t\t\tpincode,\n\t\t\ttoken,\n\t\t\tsave: context.getBool(\"save\", true),\n\t\t\tforce: context.getBool(\"force\"),\n\t\t});\n\t\treturn authLoginResult(session);\n\t},\n\tformat: formatLogin,\n};\n\nconst statusCommand: CommandSpec = {\n\tname: \"auth status\",\n\tsummary: \"Show the active profile, account, and token expiry.\",\n\tcategory: \"Authentication\",\n\toptions: [\n\t\t{\n\t\t\tname: \"verify\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Call the LINE API to verify the token and refresh the cached profile.\",\n\t\t},\n\t],\n\texamples: [\"line auth status\", \"line auth status --verify --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\t\tname: context.settings.profile.name,\n\t\t});\n\t\tconst summary = store.summary();\n\t\tconst expiry = store.tokenExpiry();\n\t\tconst base = {\n\t\t\t...summary,\n\t\t\tauthenticated: Boolean(store.authToken),\n\t\t\t...expiry,\n\t\t};\n\t\tif (!context.getBool(\"verify\")) return base;\n\t\tif (!store.authToken) {\n\t\t\tthrow new CliError(\"AUTH_REQUIRED\", \"This profile has no auth token\", {\n\t\t\t\tdetails: { path: store.path, hint: \"Run `line auth login` first.\" },\n\t\t\t});\n\t\t}\n\t\treturn await withClient(context, async (session) => {\n\t\t\t// connect() restores the session with getProfile(), so reuse it.\n\t\t\tconst profile = session.base.profile ?? (await session.client.getMyProfile());\n\t\t\treturn {\n\t\t\t\t...base,\n\t\t\t\tverified: true,\n\t\t\t\taccount: {\n\t\t\t\t\tmid: profile.mid,\n\t\t\t\t\tdisplayName: profile.displayName,\n\t\t\t\t\tstatusMessage: profile.statusMessage,\n\t\t\t\t},\n\t\t\t\tprofile,\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as Record<string, unknown> & {\n\t\t\tprofile?: { displayName?: string; mid?: string; statusMessage?: string };\n\t\t};\n\t\tconst lines = [\n\t\t\t`Profile: ${String(result.name)} (${String(result.path)})`,\n\t\t\t`Device: ${String(result.device ?? \"unknown\")}`,\n\t\t];\n\t\tif (result.endpoint) lines.push(`Endpoint: ${String(result.endpoint)}`);\n\t\tif (result.profile) {\n\t\t\tlines.push(`Account: ${result.profile.displayName ?? \"?\"} (${result.profile.mid ?? \"?\"})`);\n\t\t\tif (result.profile.statusMessage) lines.push(`Status: ${result.profile.statusMessage}`);\n\t\t} else if (result.displayName || result.mid) {\n\t\t\tlines.push(`Account: ${String(result.displayName ?? \"?\")} (${String(result.mid ?? \"?\")})`);\n\t\t}\n\t\tlines.push(`Token: ${result.authenticated ? \"saved\" : \"missing\"}`);\n\t\tif (result.expiresAt) {\n\t\t\tlines.push(`Expires: ${String(result.expiresAt)}${result.expired ? \" (expired)\" : \"\"}`);\n\t\t}\n\t\tif (result.verified) lines.push(\"Verified: yes\");\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst tokenCommand: CommandSpec = {\n\tname: \"auth token\",\n\tsummary: \"Print the saved auth token.\",\n\tdescription:\n\t\t\"Treat the output as a secret. LINE auth tokens grant full account access until revoked.\",\n\tcategory: \"Authentication\",\n\texamples: [\"line auth token\", \"line auth token --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\t\tname: context.settings.profile.name,\n\t\t});\n\t\tif (!store.authToken) {\n\t\t\tthrow new CliError(\"AUTH_REQUIRED\", \"This profile has no auth token\", {\n\t\t\t\tdetails: { path: store.path, hint: \"Run `line auth login` first.\" },\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tauthToken: store.authToken,\n\t\t\tprofile: store.name,\n\t\t\tpath: store.path,\n\t\t\t...store.tokenExpiry(),\n\t\t};\n\t},\n\tformat(value) {\n\t\treturn (value as { authToken: string }).authToken;\n\t},\n};\n\nconst logoutCommand: CommandSpec = {\n\tname: \"auth logout\",\n\tsummary: \"Delete the active profile (or every profile with --all).\",\n\tcategory: \"Authentication\",\n\toptions: [\n\t\tYES_OPTION,\n\t\t{\n\t\t\tname: \"all\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Delete every profile in the LINEJS home directory.\",\n\t\t},\n\t],\n\texamples: [\"line auth logout --yes\", \"line auth logout --all --yes\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst yes = context.getBool(\"yes\");\n\t\tif (context.getBool(\"all\")) {\n\t\t\tconst { profiles } = await listProfiles(context.settings.env);\n\t\t\tif (!profiles.length) return { removed: [] };\n\t\t\tif (!yes) {\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"CONFIRMATION_REQUIRED\",\n\t\t\t\t\t`This deletes ${profiles.length} profile(s). Re-run with --yes.`,\n\t\t\t\t\t{ details: { profiles: profiles.map((profile) => profile.path) } },\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const profile of profiles) {\n\t\t\t\tawait rm(profile.path, { force: true });\n\t\t\t}\n\t\t\treturn { removed: profiles.map((profile) => profile.path) };\n\t\t}\n\t\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\t\tname: context.settings.profile.name,\n\t\t});\n\t\tif (!yes) {\n\t\t\tthrow new CliError(\n\t\t\t\t\"CONFIRMATION_REQUIRED\",\n\t\t\t\t`This deletes ${store.path}. Re-run with --yes.`,\n\t\t\t\t{ details: { path: store.path } },\n\t\t\t);\n\t\t}\n\t\tawait store.delete();\n\t\treturn { removed: [store.path] };\n\t},\n\tformat(value) {\n\t\tconst removed = (value as { removed: string[] }).removed;\n\t\treturn removed.length\n\t\t\t? removed.map((path) => `Deleted ${path}`).join(\"\\n\")\n\t\t\t: \"No profiles found.\";\n\t},\n};\n\nconst profilesCommand: CommandSpec = {\n\tname: \"auth profiles\",\n\tsummary: \"List saved profiles under ~/.linejs.\",\n\tcategory: \"Authentication\",\n\texamples: [\"line auth profiles\", \"line auth profiles --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst { home, profiles } = await listProfiles(context.settings.env);\n\t\treturn {\n\t\t\thome,\n\t\t\tactive: context.settings.profile.path,\n\t\t\tprofiles,\n\t\t};\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\thome: string;\n\t\t\tactive: string;\n\t\t\tprofiles: Array<Record<string, unknown>>;\n\t\t};\n\t\tif (!result.profiles.length) return `No profiles in ${result.home}`;\n\t\tconst rows = result.profiles.map((profile) => ({\n\t\t\tname: profile.name,\n\t\t\taccount: profile.displayName ? `${profile.displayName} (${profile.mid ?? \"?\"})` : profile.mid,\n\t\t\tdevice: profile.device,\n\t\t\ttoken: profile.authToken ? \"yes\" : \"no\",\n\t\t\tupdated: profile.updatedAt,\n\t\t\tactive: profile.path === result.active ? \"*\" : \"\",\n\t\t\terror: profile.error,\n\t\t}));\n\t\tconst lines = [`Profiles in ${result.home}:`, \"\"];\n\t\tconst header = [\"\", \"NAME\", \"ACCOUNT\", \"DEVICE\", \"TOKEN\"];\n\t\tconst data = rows.map((row) => [\n\t\t\tString(row.active),\n\t\t\tString(row.name),\n\t\t\tString(row.account ?? \"\"),\n\t\t\tString(row.device ?? \"\"),\n\t\t\tString(row.token),\n\t\t]);\n\t\tconst widths = header.map((label, index) =>\n\t\t\tMath.max(label.length, ...data.map((row) => row[index]!.length)),\n\t\t);\n\t\tlines.push(\n\t\t\theader\n\t\t\t\t.map((label, index) => label.padEnd(widths[index]!))\n\t\t\t\t.join(\" \")\n\t\t\t\t.trimEnd(),\n\t\t);\n\t\tfor (const row of data) {\n\t\t\tlines.push(\n\t\t\t\trow\n\t\t\t\t\t.map((cell, index) => cell.padEnd(widths[index]!))\n\t\t\t\t\t.join(\" \")\n\t\t\t\t\t.trimEnd(),\n\t\t\t);\n\t\t}\n\t\tfor (const row of rows) {\n\t\t\tif (row.error) lines.push(` ! ${row.name}: ${row.error}`);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nexport const authCommands: CommandSpec[] = [\n\tloginCommand,\n\tstatusCommand,\n\ttokenCommand,\n\tlogoutCommand,\n\tprofilesCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\nconst cardOptions = [\n\t{\n\t\tname: \"celebrator\",\n\t\ttype: \"string\",\n\t\tvalueName: \"mid\",\n\t\tdescription: \"Celebrator MID (required when creating).\",\n\t},\n\t{ name: \"from\", type: \"string\", valueName: \"name\", description: \"From enum name.\" },\n\t{ name: \"template\", type: \"string\", valueName: \"id\", description: \"Card template id.\" },\n\t{\n\t\tname: \"card-status\",\n\t\ttype: \"string\",\n\t\tvalueName: \"status\",\n\t\tdescription: \"Card status (default PUBLIC).\",\n\t},\n] as const;\n\nfunction cardInput(\n\tcontext: import(\"../context.ts\").CommandContext,\n\tboardId: string,\n\ttextIndex: number,\n) {\n\tconst text = context.rest(textIndex);\n\treturn {\n\t\tboardId,\n\t\tcardStatus: context.getString(\"card-status\") ?? \"PUBLIC\",\n\t\ttext,\n\t\tcelebratorMid: context.getString(\"celebrator\"),\n\t\tfrom: context.getString(\"from\"),\n\t\ttemplateId: context.getString(\"template\"),\n\t};\n}\n\nfunction formatBirthday(value: unknown): string {\n\tconst result = value as { code?: number; message?: string; result?: unknown };\n\tif (result.code !== undefined && result.code !== 0) {\n\t\treturn `Birthday Board error ${result.code}: ${result.message ?? \"\"}`;\n\t}\n\treturn result.result === undefined || result.result === null ? \"OK\" : formatJson(result.result);\n}\n\nconst boardIdCommand: CommandSpec = {\n\tname: \"birthday board-id\",\n\tsummary: \"Get the birthday board id for a home/chat.\",\n\tcategory: \"Birthday Board\",\n\targs: [{ name: \"homeId\", description: \"Home or chat MID.\", required: true }],\n\texamples: [\"line birthday board-id cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.getBoardId(homeId);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst boardCommand: CommandSpec = {\n\tname: \"birthday board\",\n\tsummary: \"Get a birthday board.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"cardId\", description: \"Optional card id.\", required: false },\n\t],\n\texamples: [\"line birthday board BOARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.getBoard(boardId, context.arg(1));\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst cardsCommand: CommandSpec = {\n\tname: \"birthday cards\",\n\tsummary: \"List birthday cards.\",\n\tcategory: \"Birthday Board\",\n\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\toptions: [\n\t\t{ name: \"scroll\", type: \"string\", valueName: \"scrollId\", description: \"Pagination scroll id.\" },\n\t],\n\texamples: [\"line birthday cards BOARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCards({\n\t\t\t\tboardId,\n\t\t\t\tscrollId: context.getString(\"scroll\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst celebrationsCommand: CommandSpec = {\n\tname: \"birthday celebrations\",\n\tsummary: \"List birthday celebrations.\",\n\tcategory: \"Birthday Board\",\n\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\toptions: [\n\t\t{ name: \"scroll\", type: \"string\", valueName: \"scrollId\", description: \"Pagination scroll id.\" },\n\t],\n\texamples: [\"line birthday celebrations BOARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCelebrations({\n\t\t\t\tboardId,\n\t\t\t\tscrollId: context.getString(\"scroll\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst likesCommand: CommandSpec = {\n\tname: \"birthday likes\",\n\tsummary: \"List likes on a birthday card.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t],\n\texamples: [\"line birthday likes BOARD CARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\tconst cardId = context.requireArg(1, \"cardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCardLikes(boardId, cardId);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst templatesCommand: CommandSpec = {\n\tname: \"birthday templates\",\n\tsummary: \"List birthday card templates.\",\n\tcategory: \"Birthday Board\",\n\texamples: [\"line birthday templates\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCardTemplates();\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst createCommand: CommandSpec = {\n\tname: \"birthday create\",\n\tsummary: \"Create a birthday card.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"text\", description: \"Card text.\", required: true },\n\t],\n\toptions: cardOptions,\n\texamples: [\"line birthday create BOARD 'Happy birthday!' --celebrator uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst input = cardInput(context, boardId, 1);\n\t\t\treturn await client.birthdayBoard.createCard(input as never);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst updateCommand: CommandSpec = {\n\tname: \"birthday update\",\n\tsummary: \"Update a birthday card.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t{ name: \"text\", description: \"Card text.\", required: true },\n\t],\n\toptions: cardOptions,\n\texamples: [\"line birthday update BOARD CARD 'Edited'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\tconst cardId = context.requireArg(1, \"cardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst input = cardInput(context, boardId, 2);\n\t\t\treturn await client.birthdayBoard.updateCard({ ...input, cardId } as never);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nfunction simpleCommand(options: {\n\tname: string;\n\tsummary: string;\n\targs: CommandSpec[\"args\"];\n\taction: (\n\t\tboard: import(\"@evex-dev/linejs\").Client[\"birthdayBoard\"],\n\t\tcontext: import(\"../context.ts\").CommandContext,\n\t) => Promise<unknown>;\n\tneedsYes?: boolean;\n}): CommandSpec {\n\treturn {\n\t\tname: options.name,\n\t\tsummary: options.summary,\n\t\tcategory: \"Birthday Board\",\n\t\targs: options.args,\n\t\toptions: options.needsYes\n\t\t\t? [{ name: \"yes\", type: \"boolean\", description: \"Confirm the destructive action.\" }]\n\t\t\t: [],\n\t\texamples: [`line ${options.name} BOARD`],\n\t\tauth: true,\n\t\tasync run(context) {\n\t\t\tif (options.needsYes && !context.getBool(\"yes\")) {\n\t\t\t\tthrow new UsageError(\"Pass --yes to confirm this destructive action\");\n\t\t\t}\n\t\t\treturn await withClient(context, async ({ client }) => {\n\t\t\t\treturn await options.action(client.birthdayBoard, context);\n\t\t\t});\n\t\t},\n\t\tformat: formatBirthday,\n\t};\n}\n\nexport const birthdayCommands: CommandSpec[] = [\n\tboardIdCommand,\n\tboardCommand,\n\tcardsCommand,\n\tcelebrationsCommand,\n\tlikesCommand,\n\ttemplatesCommand,\n\tcreateCommand,\n\tupdateCommand,\n\tsimpleCommand({\n\t\tname: \"birthday delete\",\n\t\tsummary: \"Delete a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\tneedsYes: true,\n\t\taction: (board, context) =>\n\t\t\tboard.deleteCard(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday delete-board\",\n\t\tsummary: \"Delete a birthday board.\",\n\t\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\t\tneedsYes: true,\n\t\taction: (board, context) => board.deleteBoard(context.requireArg(0, \"boardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday permission\",\n\t\tsummary: \"Update birthday board read permission.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"count\", description: \"Read permission count.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.updateReadPermission(\n\t\t\t\tcontext.requireArg(0, \"boardId\"),\n\t\t\t\tNumber(context.requireArg(1, \"count\")),\n\t\t\t),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday like\",\n\t\tsummary: \"Like a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.createCardLike(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday unlike\",\n\t\tsummary: \"Remove a like from a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.cancelCardLike(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday celebrate\",\n\t\tsummary: \"Celebrate a birthday board.\",\n\t\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\t\taction: (board, context) => board.celebrate(context.requireArg(0, \"boardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday cancel-celebration\",\n\t\tsummary: \"Cancel a birthday board celebration.\",\n\t\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\t\taction: (board, context) => board.cancelCelebration(context.requireArg(0, \"boardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday report\",\n\t\tsummary: \"Report a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.reportCard(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\nfunction formatCall(value: unknown): string {\n\treturn formatJson(value);\n}\n\nconst routeCommand: CommandSpec = {\n\tname: \"call route\",\n\tsummary: \"Acquire a 1:1 call route.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"to\", description: \"Peer user MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"call-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"AUDIO\", \"VIDEO\"],\n\t\t\tdescription: \"Call type (default AUDIO).\",\n\t\t},\n\t],\n\texamples: [\"line call route uxxxxxxxx --call-type AUDIO\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.call.acquireRoute({\n\t\t\t\tto,\n\t\t\t\tcallType: (context.getString(\"call-type\") ?? \"AUDIO\") as never,\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst groupRouteCommand: CommandSpec = {\n\tname: \"call group-route\",\n\tsummary: \"Acquire a group call route.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"chatMid\", description: \"Group chat MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"media-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"AUDIO\", \"VIDEO\"],\n\t\t\tdescription: \"Media type (default AUDIO).\",\n\t\t},\n\t\t{ name: \"initial-host\", type: \"boolean\", description: \"Request host capability.\" },\n\t\t{\n\t\t\tname: \"capability\",\n\t\t\ttype: \"array\",\n\t\t\tvalueName: \"cap\",\n\t\t\tdescription: \"Capability (repeatable).\",\n\t\t},\n\t],\n\texamples: [\"line call group-route cxxxxxxxx --media-type AUDIO --initial-host\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst capabilities = context.getArray(\"capability\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.acquireGroupCallRoute({\n\t\t\t\tchatMid,\n\t\t\t\tmediaType: (context.getString(\"media-type\") ?? \"AUDIO\") as never,\n\t\t\t\tisInitialHost: context.getBool(\"initial-host\"),\n\t\t\t\tcapabilities: capabilities.length ? capabilities : [\"AUDIO\", \"VIDEO\"],\n\t\t\t} as never);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst groupCommand: CommandSpec = {\n\tname: \"call group\",\n\tsummary: \"Show the current group call state.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"chatMid\", description: \"Group chat MID.\", required: true }],\n\texamples: [\"line call group cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.call.getGroupCall(chatMid);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlListCommand: CommandSpec = {\n\tname: \"call url list\",\n\tsummary: \"List group call URLs.\",\n\tcategory: \"Calls\",\n\texamples: [\"line call url list\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.getGroupCallUrls({} as never);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlCreateCommand: CommandSpec = {\n\tname: \"call url create\",\n\tsummary: \"Create a group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"title\", description: \"URL title.\", required: true }],\n\texamples: [\"line call url create 'Team standup'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst title = context.rest(0);\n\t\tif (!title) throw new UsageError(\"Missing URL title\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.createGroupCallUrl({ request: { title } });\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlGetCommand: CommandSpec = {\n\tname: \"call url get\",\n\tsummary: \"Get information about a group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"ticket\", description: \"Group call URL ticket.\", required: true }],\n\texamples: [\"line call url get TICKET\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst ticket = context.requireArg(0, \"ticket\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.call.getGroupCallUrl(ticket);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlUpdateCommand: CommandSpec = {\n\tname: \"call url update\",\n\tsummary: \"Update a group call URL.\",\n\tcategory: \"Calls\",\n\toptions: [\n\t\t{ name: \"url-id\", type: \"string\", valueName: \"id\", description: \"Group call URL id.\" },\n\t\t{\n\t\t\tname: \"target-attribute\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"attr\",\n\t\t\tdescription: \"Attribute to update.\",\n\t\t},\n\t],\n\texamples: [\"line call url update --url-id ID --target-attribute TITLE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst urlId = context.requireString(\"url-id\", \"Missing --url-id\");\n\t\tconst targetAttribute = context.requireString(\"target-attribute\", \"Missing --target-attribute\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.updateGroupCallUrl({\n\t\t\t\trequest: { urlId, targetAttribute: targetAttribute as never },\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlDeleteCommand: CommandSpec = {\n\tname: \"call url delete\",\n\tsummary: \"Delete a group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"urlId\", description: \"Group call URL id.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm deletion.\" }],\n\texamples: [\"line call url delete ID --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst urlId = context.requireArg(0, \"urlId\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm deletion\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.deleteGroupCallUrl({ request: { urlId } });\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst joinCommand: CommandSpec = {\n\tname: \"call join\",\n\tsummary: \"Join a chat by group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"urlId\", description: \"Group call URL id.\", required: true }],\n\texamples: [\"line call join ID\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst urlId = context.requireArg(0, \"urlId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.joinChatByCallUrl({\n\t\t\t\trequest: { urlId, reqSeq: await base.getReqseq() },\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst inviteCommand: CommandSpec = {\n\tname: \"call invite\",\n\tsummary: \"Invite users to a group call.\",\n\tcategory: \"Calls\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Group chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID(s).\", required: true, variadic: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"media-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"AUDIO\", \"VIDEO\"],\n\t\t\tdescription: \"Media type (default AUDIO).\",\n\t\t},\n\t],\n\texamples: [\"line call invite cxxxxxxxx uxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst memberMids = context.positionals.slice(1);\n\t\tif (!memberMids.length) throw new UsageError(\"Pass at least one user MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.call.inviteIntoGroupCall({\n\t\t\t\tchatMid,\n\t\t\t\tmemberMids,\n\t\t\t\tmediaType: (context.getString(\"media-type\") ?? \"AUDIO\") as never,\n\t\t\t} as never);\n\t\t\treturn { ok: true, chatMid, memberMids };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; memberMids: string[] };\n\t\treturn `Invited ${result.memberMids.join(\", \")} to the call in ${result.chatMid}`;\n\t},\n};\n\nconst kickCommand: CommandSpec = {\n\tname: \"call kick\",\n\tsummary: \"Remove users from a group call.\",\n\tcategory: \"Calls\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Group chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID(s).\", required: true, variadic: true },\n\t],\n\texamples: [\"line call kick cxxxxxxxx uxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst targetMids = context.positionals.slice(1);\n\t\tif (!targetMids.length) throw new UsageError(\"Pass at least one user MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.kickoutFromGroupCall({\n\t\t\t\tkickoutFromGroupCallRequest: { chatMid, targetMids },\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nexport const callCommands: CommandSpec[] = [\n\trouteCommand,\n\tgroupRouteCommand,\n\tgroupCommand,\n\turlListCommand,\n\turlCreateCommand,\n\turlGetCommand,\n\turlUpdateCommand,\n\turlDeleteCommand,\n\tjoinCommand,\n\tinviteCommand,\n\tkickCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { readFileAsBlob } from \"../files.ts\";\nimport { serialize } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport {\n\tchatSummary,\n\tfetchUserTalkMessages,\n\tisUserMid,\n\tlimitOption,\n\trequireJsonObject,\n\trequireStringRecord,\n\tresolveContentType,\n\ttalkMessageSummary,\n\tuserChatSummary,\n} from \"./shared.ts\";\n\nconst listCommand: CommandSpec = {\n\tname: \"chats list\",\n\tsummary: \"List group and room chats.\",\n\tcategory: \"Chats\",\n\toptions: [\n\t\t{ name: \"name\", type: \"string\", valueName: \"text\", description: \"Filter by chat name.\" },\n\t],\n\texamples: [\"line chats list\", \"line chats list --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chats = await client.fetchJoinedChats();\n\t\t\tconst filter = context.getString(\"name\")?.toLowerCase();\n\t\t\tconst rows = chats\n\t\t\t\t.map((chat) => chatSummary(chat, context.json))\n\t\t\t\t.filter(\n\t\t\t\t\t(row) =>\n\t\t\t\t\t\t!filter ||\n\t\t\t\t\t\tString(row.name ?? \"\")\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.includes(filter),\n\t\t\t\t);\n\t\t\treturn { chats: rows };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chats = (value as { chats: Array<Record<string, unknown>> }).chats;\n\t\tif (!chats.length) return \"No chats.\";\n\t\tconst lines = [\"MID NAME TYPE\"];\n\t\tfor (const chat of chats) {\n\t\t\tlines.push(\n\t\t\t\t`${String(chat.mid ?? \"\")} ${String(chat.name ?? \"\")} ${String(chat.type ?? \"\")}`,\n\t\t\t);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"chats get\",\n\tsummary: \"Show one chat and its members.\",\n\tcategory: \"Chats\",\n\targs: [{ name: \"chatMid\", description: \"Chat MID (c... or r...).\", required: true }],\n\texamples: [\"line chats get cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\treturn chatSummary(chat, true);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chat = value as Record<string, unknown>;\n\t\tconst raw = (chat.raw ?? {}) as Record<string, unknown>;\n\t\tconst lines = [\n\t\t\t`MID: ${String(chat.mid ?? \"\")}`,\n\t\t\t`Name: ${String(chat.name ?? \"\")}`,\n\t\t\t`Type: ${String(chat.type ?? \"\")}`,\n\t\t];\n\t\tif (Array.isArray(raw.members)) lines.push(`Members: ${raw.members.length}`);\n\t\tif (Array.isArray(raw.invitees)) lines.push(`Invitees: ${raw.invitees.length}`);\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst messagesCommand: CommandSpec = {\n\tname: \"chats messages\",\n\tsummary: \"Fetch recent messages from a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t],\n\toptions: [limitOption(20)],\n\texamples: [\"line chats messages cxxxxxxxx -n 50\", \"line chats messages cxxxxxxxx --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 20;\n\t\tif (limit <= 0) throw new UsageError(\"--limit must be positive\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (isUserMid(chatMid)) {\n\t\t\t\tconst messages = await fetchUserTalkMessages(client, chatMid, limit);\n\t\t\t\treturn {\n\t\t\t\t\tchat: userChatSummary(chatMid),\n\t\t\t\t\tmessages: messages.map((message) => talkMessageSummary(message, context.json)),\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\tconst messages = await chat.fetchMessages(limit);\n\t\t\treturn {\n\t\t\t\tchat: chatSummary(chat),\n\t\t\t\tmessages: messages.map((message) => talkMessageSummary(message, context.json)),\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tchat: { name?: string };\n\t\t\tmessages: Array<Record<string, unknown>>;\n\t\t};\n\t\tif (!result.messages.length) return `No messages in ${result.chat.name ?? \"chat\"}.`;\n\t\treturn result.messages\n\t\t\t.map(\n\t\t\t\t(message) =>\n\t\t\t\t\t`[${String(message.createdTime ?? \"\")}] ${String(message.from ?? \"\")}: ${String(\n\t\t\t\t\t\tmessage.text ?? `(${String(message.contentType ?? \"message\")})`,\n\t\t\t\t\t)} (${String(message.id ?? \"\")})`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst sendCommand: CommandSpec = {\n\tname: \"chats send\",\n\tsummary: \"Send a text message to a user or chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID (u... user, c... group, r... room).\", required: true },\n\t\t{ name: \"text\", description: \"Message text (or use --text).\", required: false, variadic: true },\n\t],\n\toptions: [\n\t\t{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Message text.\" },\n\t\t{\n\t\t\tname: \"e2ee\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Use end-to-end encryption (default). Use --no-e2ee to disable.\",\n\t\t},\n\t\t{\n\t\t\tname: \"reply-to\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"messageId\",\n\t\t\tdescription: \"Related message id (reply).\",\n\t\t},\n\t\t{\n\t\t\tname: \"content-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tdescription: \"LINE ContentType (default NONE).\",\n\t\t},\n\t\t{\n\t\t\tname: \"metadata\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"contentMetadata JSON object.\",\n\t\t},\n\t\t{ name: \"location\", type: \"string\", valueName: \"json\", description: \"Location JSON object.\" },\n\t\t{\n\t\t\tname: \"chunk\",\n\t\t\ttype: \"array\",\n\t\t\tvalueName: \"chunk\",\n\t\t\tdescription: \"Pre-encrypted chunk (repeatable; advanced).\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line chats send uxxxxxxxx 'Hello from linejs'\",\n\t\t'line chats send cxxxxxxxx --text \"Hi\" --no-e2ee',\n\t\t'line chats send cxxxxxxxx \"reply\" --reply-to 123456789',\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(1);\n\t\tconst metadata = requireStringRecord(context, \"metadata\");\n\t\tconst location = requireJsonObject<Record<string, unknown>>(context, \"location\");\n\t\tconst chunks = context.getArray(\"chunk\");\n\t\tconst contentType = resolveContentType(context.getString(\"content-type\"));\n\t\tif (!text && !metadata && !location && !chunks.length) {\n\t\t\tthrow new UsageError(\"Nothing to send. Pass message text or content options.\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst message = await base.talk.sendMessage({\n\t\t\t\tto,\n\t\t\t\ttext: text || undefined,\n\t\t\t\te2ee: context.getBool(\"e2ee\", true),\n\t\t\t\tcontentType: contentType as never,\n\t\t\t\tcontentMetadata: metadata,\n\t\t\t\trelatedMessageId: context.getString(\"reply-to\"),\n\t\t\t\tlocation: location as never,\n\t\t\t\tchunks: chunks.length ? chunks : undefined,\n\t\t\t});\n\t\t\treturn { ok: true, message };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst message = (value as { message: Record<string, unknown> }).message;\n\t\treturn `Sent message ${String(message.id ?? \"\")} to ${String(message.to ?? \"\")}`;\n\t},\n};\n\nconst sendMediaCommand: CommandSpec = {\n\tname: \"chats send-media\",\n\tsummary: \"Send an E2EE image, video, audio, file, or GIF to a user or chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID (u... or c...).\", required: true },\n\t\t{ name: \"file\", description: \"File to upload.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\", \"audio\", \"file\", \"gif\"],\n\t\t\tdescription: \"Media type. Defaults from the file extension.\",\n\t\t},\n\t\t{ name: \"preview\", type: \"string\", valueName: \"path\", description: \"Preview/thumbnail image.\" },\n\t\t{\n\t\t\tname: \"duration-ms\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"ms\",\n\t\t\tdescription: \"Video/audio duration in milliseconds.\",\n\t\t},\n\t\t{ name: \"filename\", type: \"string\", valueName: \"name\", description: \"Display filename.\" },\n\t],\n\texamples: [\n\t\t\"line chats send-media uxxxxxxxx ./photo.jpg\",\n\t\t\"line chats send-media cxxxxxxxx ./clip.mp4 --type video --duration-ms 12000\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tif (!(to.startsWith(\"u\") || to.startsWith(\"c\"))) {\n\t\t\tthrow new UsageError(\"E2EE media can only be sent to u... or c... MIDs\");\n\t\t}\n\t\tconst file = await readFileAsBlob(context.requireArg(1, \"file\"), context.settings.cwd);\n\t\tconst preview = context.getString(\"preview\")\n\t\t\t? await readFileAsBlob(context.getString(\"preview\")!, context.settings.cwd)\n\t\t\t: undefined;\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\")\n\t\t\t\t? \"video\"\n\t\t\t\t: file.blob.type.startsWith(\"audio/\")\n\t\t\t\t\t? \"audio\"\n\t\t\t\t\t: file.blob.type === \"image/gif\"\n\t\t\t\t\t\t? \"gif\"\n\t\t\t\t\t\t: file.blob.type.startsWith(\"image/\")\n\t\t\t\t\t\t\t? \"image\"\n\t\t\t\t\t\t\t: \"file\")) as \"image\" | \"video\" | \"audio\" | \"file\" | \"gif\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst message = await base.obs.uploadMediaByE2EE({\n\t\t\t\tdata: file.blob,\n\t\t\t\toType: type,\n\t\t\t\tto,\n\t\t\t\tfilename: context.getString(\"filename\") ?? file.filename,\n\t\t\t\tpreview: preview?.blob,\n\t\t\t\tdurationMs: context.getNumber(\"duration-ms\"),\n\t\t\t});\n\t\t\treturn { ok: true, message, type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { message: Record<string, unknown>; type: string };\n\t\treturn `Sent ${result.type} as message ${String(result.message.id ?? \"\")}`;\n\t},\n};\n\nconst compactCommand: CommandSpec = {\n\tname: \"chats compact\",\n\tsummary: \"Send a compact (/CA5 or /ECA5) text message.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID.\", required: true },\n\t\t{ name: \"text\", description: \"Message text.\", required: false, variadic: true },\n\t],\n\toptions: [{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Message text.\" }],\n\texamples: [\"line chats compact uxxxxxxxx 'hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(1);\n\t\tif (!text) throw new UsageError(\"Missing message text\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst response = await client.sendCompactMessage(to, text);\n\t\t\treturn { ok: true, response };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent compact message: ${JSON.stringify(serialize(value))}`;\n\t},\n};\n\nconst createCommand: CommandSpec = {\n\tname: \"chats create\",\n\tsummary: \"Create a group or room chat.\",\n\tcategory: \"Chats\",\n\toptions: [\n\t\t{ name: \"mid\", type: \"array\", valueName: \"mid\", description: \"Target user MID (repeatable).\" },\n\t\t{ name: \"name\", type: \"string\", valueName: \"name\", description: \"Chat name.\" },\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"GROUP\", \"ROOM\"],\n\t\t\tdescription: \"Chat type (default GROUP).\",\n\t\t},\n\t\t{\n\t\t\tname: \"picture-path\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"path\",\n\t\t\tdescription: \"Chat picture OBS path.\",\n\t\t},\n\t],\n\texamples: [\"line chats create --mid uxxxx --mid uyyyy --name 'Project'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mids = context.getArray(\"mid\");\n\t\tif (!mids.length) throw new UsageError(\"Pass at least one --mid\");\n\t\tconst type = context.getString(\"type\") ?? \"GROUP\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.createChat({\n\t\t\t\trequest: {\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t\ttargetUserMids: mids,\n\t\t\t\t\ttype: type as never,\n\t\t\t\t\tname: context.getString(\"name\"),\n\t\t\t\t\tpicturePath: context.getString(\"picture-path\"),\n\t\t\t\t},\n\t\t\t} as never);\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = (value as { result: Record<string, unknown> }).result;\n\t\treturn `Created chat ${String(result.chatMid ?? JSON.stringify(serialize(result)))}`;\n\t},\n};\n\nconst inviteCommand: CommandSpec = {\n\tname: \"chats invite\",\n\tsummary: \"Invite users to a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID(s) to invite.\", required: true, variadic: true },\n\t],\n\texamples: [\"line chats invite cxxxxxxxx uxxxx uyyyy\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst mids = context.positionals.slice(1);\n\t\tif (!mids.length) throw new UsageError(\"Pass at least one user MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.inviteIntoChat({ chatMid, targetUserMids: mids });\n\t\t\treturn { ok: true, chatMid, mids, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; mids: string[] };\n\t\treturn `Invited ${result.mids.join(\", \")} to ${result.chatMid}`;\n\t},\n};\n\nconst kickCommand: CommandSpec = {\n\tname: \"chats kick\",\n\tsummary: \"Remove a user from a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID to remove.\", required: true },\n\t],\n\texamples: [\"line chats kick cxxxxxxxx uxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst mid = context.requireArg(1, \"mid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.deleteOtherFromChat({\n\t\t\t\trequest: {\n\t\t\t\t\tchatMid,\n\t\t\t\t\ttargetUserMids: [mid],\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, mid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; mid: string };\n\t\treturn `Removed ${result.mid} from ${result.chatMid}`;\n\t},\n};\n\nconst leaveCommand: CommandSpec = {\n\tname: \"chats leave\",\n\tsummary: \"Leave a chat.\",\n\tcategory: \"Chats\",\n\targs: [{ name: \"chatMid\", description: \"Chat MID.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Skip the confirmation prompt.\" }],\n\texamples: [\"line chats leave cxxxxxxxx --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tif (!context.getBool(\"yes\")) {\n\t\t\tthrow new UsageError(\"Pass --yes to confirm leaving the chat\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.deleteSelfFromChat({\n\t\t\t\trequest: { chatMid, reqSeq: await base.getReqseq() },\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Left ${(value as { chatMid: string }).chatMid}`;\n\t},\n};\n\nconst renameCommand: CommandSpec = {\n\tname: \"chats rename\",\n\tsummary: \"Rename a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"name\", description: \"New chat name.\", required: true },\n\t],\n\texamples: [\"line chats rename cxxxxxxxx 'New name'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst name = context.rest(1);\n\t\tif (!name) throw new UsageError(\"Missing chat name\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.updateChat({\n\t\t\t\trequest: {\n\t\t\t\t\tupdatedAttribute: \"NAME\",\n\t\t\t\t\tchat: { chatMid, chatName: name },\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, name, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; name: string };\n\t\treturn `Renamed ${result.chatMid} to ${result.name}`;\n\t},\n};\n\nconst bgmGetCommand: CommandSpec = {\n\tname: \"chats bgm get\",\n\tsummary: \"Show the BGM set on a chat.\",\n\tcategory: \"Chats\",\n\targs: [{ name: \"chatMid\", description: \"Chat MID.\", required: true }],\n\texamples: [\"line chats bgm get cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\tconst bgm = await chat.getBgm();\n\t\t\treturn { chatMid, bgm: bgm ?? null };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; bgm: Record<string, unknown> | null };\n\t\treturn result.bgm\n\t\t\t? `BGM for ${result.chatMid}: ${String(result.bgm.chatRoomBGMInfo ?? \"\")}`\n\t\t\t: `No BGM set on ${result.chatMid}.`;\n\t},\n};\n\nconst bgmSetCommand: CommandSpec = {\n\tname: \"chats bgm set\",\n\tsummary: \"Set or clear the BGM on a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"info\", description: \"BGM info (LINE MUSIC id); omit with --clear.\", required: false },\n\t],\n\toptions: [{ name: \"clear\", type: \"boolean\", description: \"Clear the BGM.\" }],\n\texamples: [\"line chats bgm set cxxxxxxxx 'bgm-info'\", \"line chats bgm set cxxxxxxxx --clear\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst clear = context.getBool(\"clear\");\n\t\tconst info = context.arg(1);\n\t\tif (!clear && !info) throw new UsageError(\"Pass BGM info or --clear\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\tconst bgm = await chat.setBgm(clear ? null : info!);\n\t\t\treturn { ok: true, chatMid, bgm };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Updated BGM for ${(value as { chatMid: string }).chatMid}`;\n\t},\n};\n\nexport const chatsCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\tmessagesCommand,\n\tsendCommand,\n\tsendMediaCommand,\n\tcompactCommand,\n\tcreateCommand,\n\tinviteCommand,\n\tkickCommand,\n\tleaveCommand,\n\trenameCommand,\n\tbgmGetCommand,\n\tbgmSetCommand,\n];\n","import type { User } from \"@evex-dev/linejs\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { withClient } from \"../session.ts\";\nimport { asRecord, summaryLine, userSummary } from \"./shared.ts\";\n\nfunction contactSummaryFromRaw(raw: unknown): Record<string, unknown> {\n\tconst record = asRecord(raw);\n\tconst profile = asRecord(record.targetProfileDetail);\n\tconst status = asRecord(profile.statusMessage);\n\treturn {\n\t\tmid: record.targetUserMid ?? record.mid,\n\t\tdisplayName: profile.profileName ?? record.displayName,\n\t\tstatusMessage: status.value ?? record.statusMessage,\n\t\tpicturePath: profile.picturePath ?? record.picturePath,\n\t\tpictureStatus: profile.pictureStatus ?? record.pictureStatus,\n\t\tmusicProfile: profile.musicProfile ?? record.musicProfile,\n\t\thiddenFromList: profile.hiddenFromList ?? record.hiddenFromList,\n\t};\n}\n\nconst listCommand: CommandSpec = {\n\tname: \"contacts list\",\n\tsummary: \"List friends.\",\n\tcategory: \"Contacts\",\n\toptions: [\n\t\t{\n\t\t\tname: \"status\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"text\",\n\t\t\tdescription: \"Filter by text in name or status.\",\n\t\t},\n\t],\n\texamples: [\"line contacts list\", \"line contacts list --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst users = await client.fetchUsers();\n\t\t\tconst filter = context.getString(\"status\")?.toLowerCase();\n\t\t\tconst rows = users\n\t\t\t\t.map((user) => userSummary(user, context.json))\n\t\t\t\t.filter((row) => {\n\t\t\t\t\tif (!filter) return true;\n\t\t\t\t\treturn (\n\t\t\t\t\t\tString(row.displayName ?? \"\")\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.includes(filter) ||\n\t\t\t\t\t\tString(row.statusMessage ?? \"\")\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.includes(filter)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\treturn { contacts: rows };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst rows = (value as { contacts: Array<Record<string, unknown>> }).contacts;\n\t\tif (!rows.length) return \"No contacts.\";\n\t\tconst lines = [\"MID DISPLAY NAME STATUS\"];\n\t\tfor (const row of rows) {\n\t\t\tlines.push(\n\t\t\t\t`${String(row.mid ?? \"\")} ${String(row.displayName ?? \"\")} ${String(row.statusMessage ?? \"\")}`,\n\t\t\t);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"contacts get\",\n\tsummary: \"Show one contact by MID.\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID (u...).\", required: true }],\n\texamples: [\"line contacts get uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst user = await client.getUser(mid);\n\t\t\treturn userSummary(user, context.json);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst record = value as Record<string, unknown>;\n\t\treturn [\n\t\t\t`MID: ${String(record.mid ?? \"\")}`,\n\t\t\t`Name: ${String(record.displayName ?? \"\")}`,\n\t\t\t`Status: ${String(record.statusMessage ?? \"\")}`,\n\t\t\t`Picture: ${String(record.pictureStatus ?? \"\")}`,\n\t\t].join(\"\\n\");\n\t},\n};\n\nconst addCommand: CommandSpec = {\n\tname: \"contacts add\",\n\tsummary: \"Add a friend by MID, LINE ID, or phone number.\",\n\tcategory: \"Contacts\",\n\toptions: [\n\t\t{ name: \"mid\", type: \"string\", valueName: \"mid\", description: \"Target user MID.\" },\n\t\t{\n\t\t\tname: \"user-id\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"id\",\n\t\t\tdescription: \"LINE ID (include @ for official accounts).\",\n\t\t},\n\t\t{\n\t\t\tname: \"phone\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"e164\",\n\t\t\tdescription: \"Phone number in E.164 form.\",\n\t\t},\n\t\t{\n\t\t\tname: \"reference\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"Tracking reference JSON for MID adds.\",\n\t\t},\n\t\t{\n\t\t\tname: \"tracking-meta-hint\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"hint\",\n\t\t\tdescription: \"Tracking meta hint for MID adds.\",\n\t\t},\n\t\t{\n\t\t\tname: \"tracking-meta-type\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"n\",\n\t\t\tdescription: \"Tracking meta type for MID adds.\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line contacts add --mid uxxxxxxxx\",\n\t\t'line contacts add --user-id \"@livecast\"',\n\t\t\"line contacts add --phone +819012345678\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.getString(\"mid\");\n\t\tconst userId = context.getString(\"user-id\");\n\t\tconst phone = context.getString(\"phone\");\n\t\tconst selected = [mid, userId, phone].filter(Boolean);\n\t\tif (selected.length !== 1) {\n\t\t\tthrow new UsageError(\"Pass exactly one of --mid, --user-id, or --phone\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (mid) {\n\t\t\t\tconst result = await base.relation.addFriendByMid({\n\t\t\t\t\tmid,\n\t\t\t\t\t...(context.getString(\"reference\") ? { reference: context.getString(\"reference\")! } : {}),\n\t\t\t\t\t...(context.getString(\"tracking-meta-hint\")\n\t\t\t\t\t\t? { trackingMetaHint: context.getString(\"tracking-meta-hint\")! }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(context.getNumber(\"tracking-meta-type\") !== undefined\n\t\t\t\t\t\t? { trackingMetaType: context.getNumber(\"tracking-meta-type\")! }\n\t\t\t\t\t\t: {}),\n\t\t\t\t});\n\t\t\t\treturn { ok: true, target: { mid }, result };\n\t\t\t}\n\t\t\tif (userId) {\n\t\t\t\tconst result = await base.relation.addFriendByUserId({ userId });\n\t\t\t\treturn { ok: true, target: { userId }, result };\n\t\t\t}\n\t\t\tconst result = await base.relation.addFriendByPhone({ phone: phone! });\n\t\t\treturn { ok: true, target: { phone }, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Friend request sent: ${summaryLine((value as { target: Record<string, unknown> }).target)}`;\n\t},\n};\n\nconst searchCommand: CommandSpec = {\n\tname: \"contacts search\",\n\tsummary: \"Look up a contact by LINE ID or phone number.\",\n\tcategory: \"Contacts\",\n\toptions: [\n\t\t{ name: \"id\", type: \"string\", valueName: \"searchId\", description: \"LINE ID or ticket.\" },\n\t\t{\n\t\t\tname: \"phone\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"e164\",\n\t\t\tdescription: \"Phone number in E.164 form.\",\n\t\t},\n\t],\n\texamples: ['line contacts search --id \"@livecast\"', \"line contacts search --phone +819012345678\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst id = context.getString(\"id\");\n\t\tconst phone = context.getString(\"phone\");\n\t\tif (Boolean(id) === Boolean(phone)) {\n\t\t\tthrow new UsageError(\"Pass exactly one of --id or --phone\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (id) {\n\t\t\t\tconst contact = await base.relation.findContactBySearchIdOrTicketV3({ searchId: id });\n\t\t\t\treturn { contact: contactSummaryFromRaw(contact), raw: context.json ? contact : undefined };\n\t\t\t}\n\t\t\tconst contact = await base.relation.findContactByPhoneV3({ phone: phone! });\n\t\t\treturn { contact: contactSummaryFromRaw(contact), raw: context.json ? contact : undefined };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst contact = (value as { contact: Record<string, unknown> }).contact;\n\t\treturn [\n\t\t\t`MID: ${String(contact.mid ?? \"\")}`,\n\t\t\t`Name: ${String(contact.displayName ?? \"\")}`,\n\t\t\t`Status: ${String(contact.statusMessage ?? \"\")}`,\n\t\t].join(\"\\n\");\n\t},\n};\n\nconst renameCommand: CommandSpec = {\n\tname: \"contacts rename\",\n\tsummary: \"Set or clear a display-name override for a contact.\",\n\tcategory: \"Contacts\",\n\targs: [\n\t\t{ name: \"mid\", description: \"User MID.\", required: true },\n\t\t{ name: \"name\", description: \"New display name (omit with --clear).\", required: false },\n\t],\n\toptions: [{ name: \"clear\", type: \"boolean\", description: \"Remove the display-name override.\" }],\n\texamples: [\"line contacts rename uxxxxxxxx Alice\", \"line contacts rename uxxxxxxxx --clear\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\tconst clear = context.getBool(\"clear\");\n\t\tconst name = context.rest(1);\n\t\tif (!clear && !name) throw new UsageError(\"Pass a display name or --clear\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst user = await client.getUser(mid);\n\t\t\tawait user.rename(clear ? null : name!);\n\t\t\treturn { ok: true, mid, name: clear ? null : name };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { mid: string; name: string | null };\n\t\treturn result.name === null\n\t\t\t? `Cleared display-name override for ${result.mid}`\n\t\t\t: `Renamed ${result.mid} to ${result.name}`;\n\t},\n};\n\nfunction toggleCommand(options: {\n\tname: string;\n\tsummary: string;\n\taction: (user: User, enabled: boolean) => Promise<void>;\n\toptionDescription: string;\n\tformat: (mid: string, enabled: boolean) => string;\n}): CommandSpec {\n\treturn {\n\t\tname: options.name,\n\t\tsummary: options.summary,\n\t\tcategory: \"Contacts\",\n\t\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\t\toptions: [{ name: \"off\", type: \"boolean\", description: options.optionDescription }],\n\t\texamples: [`line ${options.name} uxxxxxxxx`, `line ${options.name} uxxxxxxxx --off`],\n\t\tauth: true,\n\t\tasync run(context) {\n\t\t\tconst mid = context.requireArg(0, \"mid\");\n\t\t\tconst enabled = !context.getBool(\"off\");\n\t\t\treturn await withClient(context, async ({ client }) => {\n\t\t\t\tconst user = await client.getUser(mid);\n\t\t\t\tawait options.action(user, enabled);\n\t\t\t\treturn { ok: true, mid, enabled };\n\t\t\t});\n\t\t},\n\t\tformat(value) {\n\t\t\tconst result = value as { mid: string; enabled: boolean };\n\t\t\treturn options.format(result.mid, result.enabled);\n\t\t},\n\t};\n}\n\nconst favoriteCommand = toggleCommand({\n\tname: \"contacts favorite\",\n\tsummary: \"Mark or unmark a contact as a favorite.\",\n\taction: (user, enabled) => user.setFavorite(enabled),\n\toptionDescription: \"Remove the favorite mark.\",\n\tformat: (mid, enabled) => (enabled ? `Favorited ${mid}` : `Unfavorited ${mid}`),\n});\n\nconst muteCommand = toggleCommand({\n\tname: \"contacts mute\",\n\tsummary: \"Mute or unmute notifications for a contact.\",\n\taction: (user, enabled) => user.setNotificationDisabled(enabled),\n\toptionDescription: \"Unmute instead of mute.\",\n\tformat: (mid, enabled) => (enabled ? `Muted ${mid}` : `Unmuted ${mid}`),\n});\n\nconst hideCommand = toggleCommand({\n\tname: \"contacts hide\",\n\tsummary: \"Hide or unhide a contact from the friend list.\",\n\taction: (user, enabled) => user.setHidden(enabled),\n\toptionDescription: \"Unhide instead of hide.\",\n\tformat: (mid, enabled) => (enabled ? `Hid ${mid}` : `Unhid ${mid}`),\n});\n\nconst calendarCommand: CommandSpec = {\n\tname: \"contacts calendar\",\n\tsummary: \"Fetch a contact's calendar events (for example birthdays).\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"event-kind\",\n\t\t\ttype: \"array\",\n\t\t\tvalueName: \"kind\",\n\t\t\tdescription: \"Filter event kinds (repeatable).\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line contacts calendar uxxxxxxxx\",\n\t\t\"line contacts calendar uxxxxxxxx --event-kind BIRTHDAY\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\tconst kinds = context.getArray(\"event-kind\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst user = await client.getUser(mid);\n\t\t\tconst events = await user.fetchCalendarEvents((kinds.length ? kinds : undefined) as never);\n\t\t\treturn { mid, events };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { mid: string; events: Array<Record<string, unknown>> };\n\t\tif (!result.events.length) return `No calendar events for ${result.mid}.`;\n\t\treturn result.events\n\t\t\t.map((event) =>\n\t\t\t\tsummaryLine({\n\t\t\t\t\tid: event.id,\n\t\t\t\t\tstate: event.state,\n\t\t\t\t\tdate: `${String(event.year)}-${String(event.month)}-${String(event.day)}`,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst blockCommand: CommandSpec = {\n\tname: \"contacts block\",\n\tsummary: \"Block a contact.\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\texamples: [\"line contacts block uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.blockContact({ reqSeq: await base.getReqseq(), id: mid } as never);\n\t\t\treturn { ok: true, mid, blocked: true };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Blocked ${(value as { mid: string }).mid}`;\n\t},\n};\n\nconst unblockCommand: CommandSpec = {\n\tname: \"contacts unblock\",\n\tsummary: \"Unblock a contact.\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\texamples: [\"line contacts unblock uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.unblockContact({\n\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\tid: mid,\n\t\t\t\treference: undefined,\n\t\t\t} as never);\n\t\t\treturn { ok: true, mid, blocked: false };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Unblocked ${(value as { mid: string }).mid}`;\n\t},\n};\n\nconst blockedCommand: CommandSpec = {\n\tname: \"contacts blocked\",\n\tsummary: \"List blocked contacts.\",\n\tcategory: \"Contacts\",\n\texamples: [\"line contacts blocked\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst mids = await base.talk.getBlockedContactIds();\n\t\t\treturn { mids };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst mids = (value as { mids: string[] }).mids;\n\t\treturn mids.length ? mids.join(\"\\n\") : \"No blocked contacts.\";\n\t},\n};\n\nexport const contactsCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\taddCommand,\n\tsearchCommand,\n\trenameCommand,\n\tfavoriteCommand,\n\tmuteCommand,\n\thideCommand,\n\tcalendarCommand,\n\tblockCommand,\n\tunblockCommand,\n\tblockedCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { serialize } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\nconst commonOptions = [\n\t{ name: \"chat-mid\", type: \"string\", valueName: \"mid\", description: \"Chat MID context.\" },\n\t{\n\t\tname: \"liff-id\",\n\t\ttype: \"string\",\n\t\tvalueName: \"id\",\n\t\tdescription: \"LIFF id (default: LINEJS default).\",\n\t},\n\t{ name: \"lang\", type: \"string\", valueName: \"lang\", description: \"Language (default ja_JP).\" },\n] as const;\n\nconst tokenCommand: CommandSpec = {\n\tname: \"liff token\",\n\tsummary: \"Get a LIFF access token.\",\n\tcategory: \"LIFF\",\n\toptions: commonOptions,\n\texamples: [\n\t\t\"line liff token --chat-mid cxxxxxxxx\",\n\t\t\"line liff token --liff-id 2006747340-AoraPvdD\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\tconst token = await client.liff.getToken({\n\t\t\t\tchatMid: context.getString(\"chat-mid\"),\n\t\t\t\tlang: context.getString(\"lang\"),\n\t\t\t});\n\t\t\treturn { token };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { token: string }).token;\n\t},\n};\n\nconst viewCommand: CommandSpec = {\n\tname: \"liff view\",\n\tsummary: \"Issue a LIFF view URL.\",\n\tcategory: \"LIFF\",\n\toptions: commonOptions,\n\texamples: [\"line liff view --chat-mid cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\treturn await client.liff.issueView({\n\t\t\t\tchatMid: context.getString(\"chat-mid\"),\n\t\t\t\tlang: context.getString(\"lang\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as Record<string, unknown>;\n\t\treturn String(result.viewUrl ?? result.liffViewUrl ?? JSON.stringify(serialize(result)));\n\t},\n};\n\nconst shareCommand: CommandSpec = {\n\tname: \"liff share\",\n\tsummary: \"Share one or more LIFF messages to a chat.\",\n\tcategory: \"LIFF\",\n\targs: [{ name: \"to\", description: \"Target chat MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"message\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"One LIFF message as JSON.\",\n\t\t},\n\t\t{\n\t\t\tname: \"messages\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"Array of LIFF messages as JSON.\",\n\t\t},\n\t\t{ name: \"liff-id\", type: \"string\", valueName: \"id\", description: \"LIFF id.\" },\n\t\t{ name: \"force\", type: \"boolean\", description: \"Force a new LIFF token.\" },\n\t],\n\texamples: ['line liff share cxxxxxxxx --message \\'{\"type\":\"text\",\"text\":\"Hello\"}\\''],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst one = context.getJson<Record<string, unknown>>(\"message\");\n\t\tconst many = context.getJson<Array<Record<string, unknown>>>(\"messages\");\n\t\tconst messages = many ?? (one ? [one] : undefined);\n\t\tif (!messages?.length) throw new UsageError(\"Pass --message or --messages\");\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\tconst result = await client.liff.shareMessages(to, messages as never, {\n\t\t\t\tforceIssue: context.getBool(\"force\"),\n\t\t\t});\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Shared LIFF message: ${JSON.stringify(serialize((value as { result: unknown }).result))}`;\n\t},\n};\n\nconst shareTextCommand: CommandSpec = {\n\tname: \"liff share-text\",\n\tsummary: \"Share a plain text LIFF message.\",\n\tcategory: \"LIFF\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target chat MID.\", required: true },\n\t\t{ name: \"text\", description: \"Text to share.\", required: true, variadic: true },\n\t],\n\toptions: [\n\t\t{ name: \"liff-id\", type: \"string\", valueName: \"id\", description: \"LIFF id.\" },\n\t\t{ name: \"force\", type: \"boolean\", description: \"Force a new LIFF token.\" },\n\t],\n\texamples: [\"line liff share-text cxxxxxxxx 'Hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst text = context.rest(1);\n\t\tif (!text) throw new UsageError(\"Missing text\");\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\tconst result = await client.liff.shareMessage(\n\t\t\t\tto,\n\t\t\t\t{ type: \"text\", text },\n\t\t\t\t{ forceIssue: context.getBool(\"force\") },\n\t\t\t);\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Shared LIFF text: ${JSON.stringify(serialize((value as { result: unknown }).result))}`;\n\t},\n};\n\nexport const liffCommands: CommandSpec[] = [\n\ttokenCommand,\n\tviewCommand,\n\tshareCommand,\n\tshareTextCommand,\n];\n","import type { SquareMessage, TalkMessage } from \"@evex-dev/linejs\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { withClient } from \"../session.ts\";\nimport { squareMessageSummary, talkMessageSummary } from \"./shared.ts\";\n\nfunction now(): string {\n\treturn new Date().toISOString();\n}\n\nconst listenCommand: CommandSpec = {\n\tname: \"listen\",\n\tsummary: \"Stream incoming talk/OpenChat events until interrupted.\",\n\tdescription:\n\t\t\"In --json mode every event is written as one JSON object per line (NDJSON), followed by a final summary object. QR/media and diagnostics go to stderr.\",\n\tcategory: \"Events\",\n\toptions: [\n\t\t{\n\t\t\tname: \"talk\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Listen to talk messages (default: true, or false when only --square is given).\",\n\t\t},\n\t\t{ name: \"square\", type: \"boolean\", description: \"Listen to OpenChat events (default: false).\" },\n\t\t{ name: \"events\", type: \"boolean\", description: \"Include raw protocol events.\" },\n\t\t{ name: \"count\", type: \"number\", valueName: \"n\", description: \"Stop after N messages.\" },\n\t\t{\n\t\t\tname: \"duration\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"seconds\",\n\t\t\tdescription: \"Stop after N seconds.\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line listen\",\n\t\t\"line listen --talk --square --count 10\",\n\t\t\"line listen --json --duration 60\",\n\t],\n\tauth: true,\n\tlongRunning: true,\n\tmcp: false,\n\tasync run(context) {\n\t\tconst square = context.getBool(\"square\", false);\n\t\tconst talk = context.has(\"talk\") ? context.getBool(\"talk\") : !square;\n\t\tconst includeEvents = context.getBool(\"events\");\n\t\tconst countLimit = context.getNumber(\"count\");\n\t\tconst duration = context.getNumber(\"duration\");\n\t\tif (!talk && !square) throw new UsageError(\"Enable at least one of --talk or --square\");\n\t\tif (countLimit !== undefined && (!Number.isInteger(countLimit) || countLimit <= 0)) {\n\t\t\tthrow new UsageError(\"--count must be a positive integer\");\n\t\t}\n\t\tif (duration !== undefined && (!Number.isFinite(duration) || duration <= 0)) {\n\t\t\tthrow new UsageError(\"--duration must be a positive number of seconds\");\n\t\t}\n\n\t\treturn await withClient(context, async ({ client, store }) => {\n\t\t\tconst controller = new AbortController();\n\t\t\tconst abort = () => controller.abort();\n\t\t\tif (context.signal.aborted) controller.abort();\n\t\t\tcontext.signal.addEventListener(\"abort\", abort, { once: true });\n\n\t\t\tlet messages = 0;\n\t\t\tlet edits = 0;\n\t\t\tlet events = 0;\n\t\t\tlet timer: NodeJS.Timeout | undefined;\n\t\t\tif (duration !== undefined) {\n\t\t\t\ttimer = setTimeout(() => controller.abort(), duration * 1000);\n\t\t\t\ttimer.unref?.();\n\t\t\t}\n\n\t\t\tconst emit = (type: string, data: Record<string, unknown>, human: string) => {\n\t\t\t\tif (context.json) {\n\t\t\t\t\tcontext.output.jsonLine({ type, at: now(), ...data });\n\t\t\t\t} else {\n\t\t\t\t\tcontext.output.writeLine(`${context.output.dim(now())} ${human}`);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst onMessage = (message: TalkMessage) => {\n\t\t\t\tmessages += 1;\n\t\t\t\tconst summary = talkMessageSummary(message, false);\n\t\t\t\tconst text = message.text || `(${String(summary.contentType ?? \"message\")})`;\n\t\t\t\temit(\"talk\", summary, `talk ${String(summary.from)}: ${text}`);\n\t\t\t\tif (countLimit !== undefined && messages >= countLimit) controller.abort();\n\t\t\t};\n\t\t\tconst onEdit = (message: TalkMessage) => {\n\t\t\t\tedits += 1;\n\t\t\t\tconst summary = talkMessageSummary(message, false);\n\t\t\t\temit(\n\t\t\t\t\t\"talk:edit\",\n\t\t\t\t\tsummary,\n\t\t\t\t\t`talk:edit ${String(summary.from)}: ${message.text || \"(edited message)\"}`,\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst onSquareMessage = (message: SquareMessage) => {\n\t\t\t\tmessages += 1;\n\t\t\t\tconst summary = squareMessageSummary(message, false);\n\t\t\t\tconst text = message.text || `(${String(summary.contentType ?? \"message\")})`;\n\t\t\t\temit(\"square\", summary, `square ${String(summary.from)}: ${text}`);\n\t\t\t\tif (countLimit !== undefined && messages >= countLimit) controller.abort();\n\t\t\t};\n\t\t\tconst onEvent = (event: unknown) => {\n\t\t\t\tevents += 1;\n\t\t\t\tif (includeEvents) {\n\t\t\t\t\tconst type =\n\t\t\t\t\t\tevent && typeof event === \"object\" && \"type\" in event\n\t\t\t\t\t\t\t? String((event as { type: unknown }).type)\n\t\t\t\t\t\t\t: \"unknown\";\n\t\t\t\t\temit(\"talk:event\", { event }, `talk:event ${type}`);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst onSquareEvent = (event: unknown) => {\n\t\t\t\tevents += 1;\n\t\t\t\tif (includeEvents) {\n\t\t\t\t\tconst type =\n\t\t\t\t\t\tevent && typeof event === \"object\" && \"type\" in event\n\t\t\t\t\t\t\t? String((event as { type: unknown }).type)\n\t\t\t\t\t\t\t: \"unknown\";\n\t\t\t\t\temit(\"square:event\", { event }, `square:event ${type}`);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst onIncoming = (event: unknown) => {\n\t\t\t\temit(\"call:incoming\", { event }, \"call:incoming\");\n\t\t\t};\n\t\t\tconst onCancel = (event: unknown) => {\n\t\t\t\temit(\"call:cancel\", { event }, \"call:cancel\");\n\t\t\t};\n\n\t\t\tclient.on(\"message\", onMessage);\n\t\t\tclient.on(\"message:edit\", onEdit);\n\t\t\tclient.on(\"square:message\", onSquareMessage);\n\t\t\tclient.on(\"event\", onEvent);\n\t\t\tclient.on(\"square:event\", onSquareEvent);\n\t\t\tclient.on(\"call:incoming\", onIncoming);\n\t\t\tclient.on(\"call:cancel\", onCancel);\n\n\t\t\tconst stopped = new Promise<void>((resolve) => {\n\t\t\t\tcontroller.signal.addEventListener(\"abort\", () => resolve(), { once: true });\n\t\t\t});\n\n\t\t\tclient.listen({ talk, square, signal: controller.signal });\n\t\t\tif (!context.json) {\n\t\t\t\tcontext.output.writeErrLine(\n\t\t\t\t\t`Listening (talk=${talk}, square=${square}). Press Ctrl+C to stop.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait stopped;\n\t\t\tif (timer) clearTimeout(timer);\n\t\t\tcontext.signal.removeEventListener(\"abort\", abort);\n\t\t\t// Give the polling/push loops a moment to observe the abort.\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\t\t\tclient.off(\"message\", onMessage);\n\t\t\tclient.off(\"message:edit\", onEdit);\n\t\t\tclient.off(\"square:message\", onSquareMessage);\n\t\t\tclient.off(\"event\", onEvent);\n\t\t\tclient.off(\"square:event\", onSquareEvent);\n\t\t\tclient.off(\"call:incoming\", onIncoming);\n\t\t\tclient.off(\"call:cancel\", onCancel);\n\t\t\tawait store.flush();\n\n\t\t\tconst summary = { type: \"summary\", listening: false, messages, edits, events };\n\t\t\tif (!context.json) {\n\t\t\t\tcontext.output.writeErrLine(\n\t\t\t\t\t`Stopped. ${messages} message(s), ${edits} edit(s), ${events} event(s).`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn summary;\n\t\t});\n\t},\n\tformat() {\n\t\treturn \"\";\n\t},\n};\n\nexport const listenCommands: CommandSpec[] = [listenCommand];\n","import type { Client } from \"@evex-dev/linejs\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { writeBinaryFile } from \"../files.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport {\n\tfetchTalkMessages,\n\tlimitOption,\n\toutOption,\n\tresolveReaction,\n\ttalkMessageSummary,\n} from \"./shared.ts\";\n\nfunction bigIntId(value: string): bigint {\n\tif (!/^\\d+$/.test(value)) throw new UsageError(`Invalid message id: ${value}`);\n\treturn BigInt(value);\n}\n\nasync function resolveTalkMessage(client: Client, chatMid: string, messageId: string, limit = 100) {\n\tconst messages = await fetchTalkMessages(client, chatMid, limit);\n\tconst message = messages.find((entry) => entry.raw.id === messageId);\n\tif (!message) {\n\t\tthrow new CliError(\n\t\t\t\"NOT_FOUND\",\n\t\t\t`Message ${messageId} was not found in the last ${limit} messages`,\n\t\t\t{\n\t\t\t\tdetails: {\n\t\t\t\t\tchatMid,\n\t\t\t\t\tmessageId,\n\t\t\t\t\tlimit,\n\t\t\t\t\thint: \"Increase --limit or use the raw API command.\",\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t}\n\treturn message;\n}\n\nconst reactCommand: CommandSpec = {\n\tname: \"messages react\",\n\tsummary: \"React to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"messageId\", description: \"Message id (decimal).\", required: true },\n\t\t{\n\t\t\tname: \"reaction\",\n\t\t\tdescription: \"ALL, UNDO, NICE, LOVE, FUN, AMAZING, SAD, OMG, or 0-7.\",\n\t\t\trequired: true,\n\t\t},\n\t],\n\texamples: [\"line messages react 123456789 NICE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst messageId = bigIntId(context.requireArg(0, \"messageId\"));\n\t\tconst reaction = resolveReaction(context.requireArg(1, \"reaction\"));\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.react({ id: messageId, reaction });\n\t\t\treturn { ok: true, messageId: messageId.toString(), reaction };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { messageId: string; reaction: string };\n\t\treturn `Reacted to ${result.messageId} with ${result.reaction}`;\n\t},\n};\n\nconst cancelReactionCommand: CommandSpec = {\n\tname: \"messages cancel-reaction\",\n\tsummary: \"Remove your reaction from a message.\",\n\tcategory: \"Messages\",\n\targs: [{ name: \"messageId\", description: \"Message id.\", required: true }],\n\texamples: [\"line messages cancel-reaction 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst messageId = bigIntId(context.requireArg(0, \"messageId\"));\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.cancelReaction({\n\t\t\t\tcancelReactionRequest: {\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t\tmessageId,\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, messageId: messageId.toString() };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Canceled reaction on ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nconst unsendCommand: CommandSpec = {\n\tname: \"messages unsend\",\n\tsummary: \"Unsend one of your messages.\",\n\tcategory: \"Messages\",\n\targs: [{ name: \"messageId\", description: \"Message id.\", required: true }],\n\texamples: [\"line messages unsend 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst messageId = context.requireArg(0, \"messageId\");\n\t\tbigIntId(messageId);\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.unsendMessage({ messageId });\n\t\t\treturn { ok: true, messageId };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Unsents ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nconst readCommand: CommandSpec = {\n\tname: \"messages read\",\n\tsummary: \"Mark a chat as read up to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Last read message id.\", required: true },\n\t],\n\texamples: [\"line messages read cxxxxxxxx 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst lastMessageId = context.requireArg(1, \"messageId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.sendChatChecked({\n\t\t\t\tchatMid,\n\t\t\t\tlastMessageId,\n\t\t\t\tseq: await base.getReqseq(),\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, lastMessageId };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; lastMessageId: string };\n\t\treturn `Marked ${result.chatMid} read up to ${result.lastMessageId}`;\n\t},\n};\n\nconst replyCommand: CommandSpec = {\n\tname: \"messages reply\",\n\tsummary: \"Reply to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id to reply to.\", required: true },\n\t\t{ name: \"text\", description: \"Reply text.\", required: false, variadic: true },\n\t],\n\toptions: [\n\t\t{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Reply text.\" },\n\t\t{ name: \"e2ee\", type: \"boolean\", description: \"Use E2EE (default). Use --no-e2ee to disable.\" },\n\t],\n\texamples: [\"line messages reply cxxxxxxxx 123456789 'Thanks!'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst relatedMessageId = context.requireArg(1, \"messageId\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(2);\n\t\tif (!text) throw new UsageError(\"Missing reply text\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst message = await base.talk.sendMessage({\n\t\t\t\tto,\n\t\t\t\ttext,\n\t\t\t\trelatedMessageId,\n\t\t\t\te2ee: context.getBool(\"e2ee\", true),\n\t\t\t});\n\t\t\treturn { ok: true, message };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent reply ${String((value as { message: Record<string, unknown> }).message.id ?? \"\")}`;\n\t},\n};\n\nconst showCommand: CommandSpec = {\n\tname: \"messages show\",\n\tsummary: \"Show a message with stickers, mentions, flex, and reply metadata.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [limitOption(100)],\n\texamples: [\"line messages show cxxxxxxxx 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 100;\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst message = await resolveTalkMessage(client, chatMid, messageId, limit);\n\t\t\tconst extra: Record<string, unknown> = {};\n\t\t\ttry {\n\t\t\t\textra.stickerUrl = message.getStickerURL();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.emojiUrls = message.collectEmojiURLs();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.mentions = message.getMentions();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.decorations = message.getTextDecorations();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.sharedContact = message.getSharedContact();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.flex = message.getFlex();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.replyTarget = message.getReplyTarget()?.id;\n\t\t\t} catch {}\n\t\t\treturn {\n\t\t\t\t...talkMessageSummary(message, context.json),\n\t\t\t\t...extra,\n\t\t\t\t...(context.json ? { raw: message.raw } : {}),\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst message = value as Record<string, unknown>;\n\t\treturn formatJson(message);\n\t},\n};\n\nconst pinCommand: CommandSpec = {\n\tname: \"messages pin\",\n\tsummary: \"Pin a message as a chat announcement.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [limitOption(100)],\n\texamples: [\"line messages pin cxxxxxxxx 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 100;\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst message = await resolveTalkMessage(client, chatMid, messageId, limit);\n\t\t\tawait message.announce();\n\t\t\treturn { ok: true, chatMid, messageId };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; messageId: string };\n\t\treturn `Pinned ${result.messageId} in ${result.chatMid}`;\n\t},\n};\n\nfunction extensionForMime(type: string): string {\n\tconst map: Record<string, string> = {\n\t\t\"image/jpeg\": \"jpg\",\n\t\t\"image/png\": \"png\",\n\t\t\"image/gif\": \"gif\",\n\t\t\"video/mp4\": \"mp4\",\n\t\t\"audio/mp4\": \"m4a\",\n\t\t\"audio/mpeg\": \"mp3\",\n\t\t\"application/pdf\": \"pdf\",\n\t};\n\treturn map[type] ?? \"bin\";\n}\n\nexport async function downloadTalkMessageData(context: import(\"../context.ts\").CommandContext) {\n\tconst chatMid = context.requireArg(0, \"chatMid\");\n\tconst messageId = context.requireArg(1, \"messageId\");\n\tconst limit = context.getNumber(\"limit\") ?? 100;\n\treturn await withClient(context, async ({ client }) => {\n\t\tconst message = await resolveTalkMessage(client, chatMid, messageId, limit);\n\t\tconst blob = await message.getData(context.getBool(\"preview\"));\n\t\tconst out =\n\t\t\tcontext.getString(\"out\") ??\n\t\t\t`line-${messageId}.${extensionForMime(blob.type || \"application/octet-stream\")}`;\n\t\tconst written = await writeBinaryFile(out, blob, context.settings.cwd);\n\t\treturn { ok: true, ...written, type: blob.type, messageId, chatMid };\n\t});\n}\n\nconst dataOptions = [\n\toutOption(\"Output file (default: line-<messageId>.<ext>).\"),\n\t{\n\t\tname: \"preview\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Download the preview instead of the original.\",\n\t},\n\tlimitOption(100),\n] as const;\n\nconst dataCommand: CommandSpec = {\n\tname: \"messages data\",\n\tsummary: \"Download the media attached to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: dataOptions,\n\texamples: [\"line messages data cxxxxxxxx 123456789 --out ./photo.jpg\"],\n\tauth: true,\n\trun: downloadTalkMessageData,\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number; type: string };\n\t\treturn `Saved ${result.size} bytes (${result.type}) to ${result.path}`;\n\t},\n};\n\nexport const messagesCommands: CommandSpec[] = [\n\treactCommand,\n\tcancelReactionCommand,\n\tunsendCommand,\n\treadCommand,\n\treplyCommand,\n\tshowCommand,\n\tpinCommand,\n\tdataCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { readFileAsBlob, writeBinaryFile } from \"../files.ts\";\nimport { withClient } from \"../session.ts\";\nimport { downloadTalkMessageData } from \"./messages.ts\";\nimport { limitOption, outOption } from \"./shared.ts\";\n\nconst uploadCommand: CommandSpec = {\n\tname: \"media upload\",\n\tsummary: \"Upload a file to a chat, optionally with E2EE.\",\n\tcategory: \"Media\",\n\targs: [{ name: \"file\", description: \"File to upload.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"to\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"mid\",\n\t\t\tdescription: \"Target user/chat MID (required).\",\n\t\t},\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\", \"audio\", \"file\", \"gif\"],\n\t\t\tdescription: \"Media type (default: inferred).\",\n\t\t},\n\t\t{ name: \"filename\", type: \"string\", valueName: \"name\", description: \"Display filename.\" },\n\t\t{ name: \"duration-ms\", type: \"number\", valueName: \"ms\", description: \"Video/audio duration.\" },\n\t\t{\n\t\t\tname: \"e2ee\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Encrypt with LINE E2EE (default: true for u.../c... MIDs).\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line media upload ./photo.jpg --to uxxxxxxxx\",\n\t\t\"line media upload ./file.pdf --to cxxxxxxxx --type file --no-e2ee\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireString(\"to\", \"Missing --to\");\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\")\n\t\t\t\t? \"video\"\n\t\t\t\t: file.blob.type.startsWith(\"audio/\")\n\t\t\t\t\t? \"audio\"\n\t\t\t\t\t: file.blob.type === \"image/gif\"\n\t\t\t\t\t\t? \"gif\"\n\t\t\t\t\t\t: file.blob.type.startsWith(\"image/\")\n\t\t\t\t\t\t\t? \"image\"\n\t\t\t\t\t\t\t: \"file\")) as \"image\" | \"video\" | \"audio\" | \"file\" | \"gif\";\n\t\tconst useE2ee = context.getBool(\"e2ee\", to.startsWith(\"u\") || to.startsWith(\"c\"));\n\t\tif (useE2ee && !(to.startsWith(\"u\") || to.startsWith(\"c\"))) {\n\t\t\tthrow new UsageError(\"E2EE media can only be sent to u... or c... MIDs\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (useE2ee) {\n\t\t\t\tconst message = await base.obs.uploadMediaByE2EE({\n\t\t\t\t\tdata: file.blob,\n\t\t\t\t\toType: type,\n\t\t\t\t\tto,\n\t\t\t\t\tfilename: context.getString(\"filename\") ?? file.filename,\n\t\t\t\t\tdurationMs: context.getNumber(\"duration-ms\"),\n\t\t\t\t});\n\t\t\t\treturn { ok: true, e2ee: true, type, message };\n\t\t\t}\n\t\t\tconst result = await base.obs.uploadObjTalk(\n\t\t\t\tto,\n\t\t\t\ttype,\n\t\t\t\tfile.blob,\n\t\t\t\tundefined,\n\t\t\t\tcontext.getString(\"filename\") ?? file.filename,\n\t\t\t\tcontext.getNumber(\"duration-ms\"),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\te2ee: false,\n\t\t\t\ttype,\n\t\t\t\tobjId: result.objId,\n\t\t\t\tobjHash: result.objHash,\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\te2ee: boolean;\n\t\t\ttype: string;\n\t\t\tmessage?: Record<string, unknown>;\n\t\t\tobjId?: string;\n\t\t};\n\t\treturn result.e2ee\n\t\t\t? `Sent E2EE ${result.type} as message ${String(result.message?.id ?? \"\")}`\n\t\t\t: `Uploaded ${result.type} object ${result.objId ?? \"\"}`;\n\t},\n};\n\nconst downloadCommand: CommandSpec = {\n\tname: \"media download\",\n\tsummary: \"Download media attached to a message.\",\n\tcategory: \"Media\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [\n\t\toutOption(\"Output file (default: line-<messageId>.<ext>).\"),\n\t\t{\n\t\t\tname: \"preview\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Download the preview instead of the original.\",\n\t\t},\n\t\tlimitOption(100),\n\t],\n\texamples: [\"line media download cxxxxxxxx 123456789 --out ./photo.jpg\"],\n\tauth: true,\n\trun: downloadTalkMessageData,\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number; type: string };\n\t\treturn `Saved ${result.size} bytes (${result.type}) to ${result.path}`;\n\t},\n};\n\nconst objectCommand: CommandSpec = {\n\tname: \"media object\",\n\tsummary: \"Download an OBS object by path and object id.\",\n\tcategory: \"Media\",\n\toptions: [\n\t\t{\n\t\t\tname: \"path\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"obsPath\",\n\t\t\tdescription: \"OBS path (for example talk/m/...).\",\n\t\t},\n\t\t{ name: \"oid\", type: \"string\", valueName: \"oid\", description: \"Object id.\" },\n\t\toutOption(\"Output file (required).\"),\n\t],\n\texamples: [\"line media object --path talk/m/... --oid abc --out ./file.bin\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst obsPath = context.requireString(\"path\", \"Missing --path\");\n\t\tconst oid = context.requireString(\"oid\", \"Missing --oid\");\n\t\tconst out = context.requireString(\"out\", \"Missing --out\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst blob = await base.obs.downloadObjectForService({ obsPath, oid });\n\t\t\tconst written = await writeBinaryFile(out, blob, context.settings.cwd);\n\t\t\treturn { ok: true, ...written, type: blob.type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number };\n\t\treturn `Saved ${result.size} bytes to ${result.path}`;\n\t},\n};\n\nexport const mediaCommands: CommandSpec[] = [uploadCommand, downloadCommand, objectCommand];\n","import type { CommandSpec } from \"../command.ts\";\nimport { writeBinaryFile } from \"../files.ts\";\nimport { withClient } from \"../session.ts\";\nimport { outOption } from \"./shared.ts\";\n\nconst albumsCommand: CommandSpec = {\n\tname: \"moa albums\",\n\tsummary: \"List LINE Album (Moa) albums.\",\n\tcategory: \"Album (Moa)\",\n\toptions: [\n\t\t{ name: \"cursor\", type: \"string\", valueName: \"cursor\", description: \"Pagination cursor.\" },\n\t\t{\n\t\t\tname: \"order-by\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"order\",\n\t\t\tdescription: \"Order (default createTimeDesc).\",\n\t\t},\n\t\t{\n\t\t\tname: \"include\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"fields\",\n\t\t\tdescription: \"Additional fields to include.\",\n\t\t},\n\t],\n\texamples: [\"line moa albums\", \"line moa albums --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.moa.getAlbums({\n\t\t\t\tcursor: context.getString(\"cursor\"),\n\t\t\t\torderBy: context.getString(\"order-by\"),\n\t\t\t\tinclude: context.getString(\"include\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tresult?: { albums?: Array<Record<string, unknown>> };\n\t\t\tcode?: number;\n\t\t\tmessage?: string;\n\t\t};\n\t\tif (result.code !== undefined && result.code !== 0) {\n\t\t\treturn `Moa error ${result.code}: ${result.message ?? \"\"}`;\n\t\t}\n\t\tconst albums = result.result?.albums ?? [];\n\t\tif (!albums.length) return \"No albums.\";\n\t\treturn albums\n\t\t\t.map(\n\t\t\t\t(album) =>\n\t\t\t\t\t`${String(album.albumId ?? \"\")} ${String(album.title ?? \"\")} (${String(\n\t\t\t\t\t\talbum.photoCount ?? 0,\n\t\t\t\t\t)} photos, chat ${String(album.chatId ?? \"\")})`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst photosCommand: CommandSpec = {\n\tname: \"moa photos\",\n\tsummary: \"List photos in a LINE Album album.\",\n\tcategory: \"Album (Moa)\",\n\toptions: [\n\t\t{\n\t\t\tname: \"chat-id\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"mid\",\n\t\t\tdescription: \"Chat MID owning the album.\",\n\t\t},\n\t\t{ name: \"album-id\", type: \"string\", valueName: \"id\", description: \"Album id.\" },\n\t\t{ name: \"cursor\", type: \"string\", valueName: \"cursor\", description: \"Pagination cursor.\" },\n\t\t{ name: \"page-size\", type: \"number\", valueName: \"n\", description: \"Page size (default 100).\" },\n\t\t{\n\t\t\tname: \"order-by\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"order\",\n\t\t\tdescription: \"Order (default createTimeDesc).\",\n\t\t},\n\t\t{\n\t\t\tname: \"include\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"fields\",\n\t\t\tdescription: \"Fields to include (default all).\",\n\t\t},\n\t\t{ name: \"filter-type\", type: \"string\", valueName: \"type\", description: \"Filter type.\" },\n\t\t{\n\t\t\tname: \"target-user\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"mid\",\n\t\t\tdescription: \"Filter by uploader MID.\",\n\t\t},\n\t],\n\texamples: [\"line moa photos --chat-id cxxxxxxxx --album-id 123\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatId = context.requireString(\"chat-id\", \"Missing --chat-id\");\n\t\tconst albumId = context.requireString(\"album-id\", \"Missing --album-id\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.moa.getPhotos({\n\t\t\t\tchatId,\n\t\t\t\talbumId,\n\t\t\t\tcursor: context.getString(\"cursor\"),\n\t\t\t\tpageSize: context.getNumber(\"page-size\"),\n\t\t\t\torderBy: context.getString(\"order-by\"),\n\t\t\t\tinclude: context.getString(\"include\"),\n\t\t\t\tfilterType: context.getString(\"filter-type\"),\n\t\t\t\ttargetUser: context.getString(\"target-user\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tresult?: { photos?: Array<Record<string, unknown>> };\n\t\t\tcode?: number;\n\t\t\tmessage?: string;\n\t\t};\n\t\tif (result.code !== undefined && result.code !== 0) {\n\t\t\treturn `Moa error ${result.code}: ${result.message ?? \"\"}`;\n\t\t}\n\t\tconst photos = result.result?.photos ?? [];\n\t\tif (!photos.length) return \"No photos.\";\n\t\treturn photos\n\t\t\t.map(\n\t\t\t\t(photo) =>\n\t\t\t\t\t`${String(photo.oid ?? photo.photoId ?? photo.id ?? \"\")} ${String(\n\t\t\t\t\t\tphoto.createUserMid ?? \"\",\n\t\t\t\t\t)} ${String(photo.shotTime ?? \"\")}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst downloadCommand: CommandSpec = {\n\tname: \"moa download\",\n\tsummary: \"Download an original photo or video from a LINE Album.\",\n\tcategory: \"Album (Moa)\",\n\toptions: [\n\t\t{ name: \"chat-id\", type: \"string\", valueName: \"mid\", description: \"Chat MID.\" },\n\t\t{ name: \"album-id\", type: \"string\", valueName: \"id\", description: \"Album id.\" },\n\t\t{ name: \"oid\", type: \"string\", valueName: \"oid\", description: \"Object id.\" },\n\t\t{\n\t\t\tname: \"prefix\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"prefix\",\n\t\t\tchoices: [\"album/a\", \"album/v\"],\n\t\t\tdescription: \"Resource prefix (album/a for images, album/v for videos).\",\n\t\t},\n\t\toutOption(\"Output file.\"),\n\t],\n\texamples: [\"line moa download --chat-id cxxxxxxxx --album-id 123 --oid abc --out ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatId = context.requireString(\"chat-id\", \"Missing --chat-id\");\n\t\tconst albumId = context.requireString(\"album-id\", \"Missing --album-id\");\n\t\tconst oid = context.requireString(\"oid\", \"Missing --oid\");\n\t\tconst out = context.requireString(\"out\", \"Missing --out\");\n\t\tconst prefix = (context.getString(\"prefix\") ?? \"album/a\") as \"album/a\" | \"album/v\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst data = await base.moa.downloadPhoto({ chatId, albumId, oid, prefix });\n\t\t\tconst written = await writeBinaryFile(out, data, context.settings.cwd);\n\t\t\treturn { ok: true, ...written };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number };\n\t\treturn `Saved ${result.size} bytes to ${result.path}`;\n\t},\n};\n\nexport const moaCommands: CommandSpec[] = [albumsCommand, photosCommand, downloadCommand];\n","import type { CommandSpec } from \"../command.ts\";\n\nconst mcpCommand: CommandSpec = {\n\tname: \"mcp\",\n\tsummary: \"Run the LINEJS CLI as an MCP server over stdio.\",\n\tdescription:\n\t\t\"Exposes two tools: list_linejs_cli (all commands and their metadata) and execute_linejs_cli (argv execution without a shell). Long-running commands such as listen and mcp are not executable through the tools. Also implements MCP Events (webhook delivery): events/list, events/subscribe, and events/unsubscribe.\",\n\tcategory: \"MCP\",\n\toptions: [\n\t\t{\n\t\t\tname: \"transport\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"transport\",\n\t\t\tchoices: [\"stdio\"],\n\t\t\tdescription: \"MCP transport (only stdio is supported).\",\n\t\t},\n\t],\n\texamples: [\"line mcp\"],\n\tauth: false,\n\tlongRunning: true,\n\tmcp: false,\n\tsilent: true,\n\tasync run(context) {\n\t\tconst { runMcpServer } = await import(\"../mcp/server.ts\");\n\t\tconst exitCode = await runMcpServer({\n\t\t\tinput: process.stdin,\n\t\t\toutput: process.stdout,\n\t\t\terror: process.stderr,\n\t\t\tsignal: context.signal,\n\t\t\tprincipal: `stdio:${context.settings.profile.path}`,\n\t\t\tprofile: context.settings.profile.path,\n\t\t});\n\t\treturn { exitCode };\n\t},\n};\n\nexport const mcpCommands: CommandSpec[] = [mcpCommand];\n","import type { Profile } from \"@evex-dev/linejs-types\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readFileAsBlob } from \"../files.ts\";\nimport { withClient } from \"../session.ts\";\n\nconst getCommand: CommandSpec = {\n\tname: \"profile get\",\n\tsummary: \"Show the signed-in user's cached profile.\",\n\tdescription:\n\t\t\"Uses the profile cached by the last login or --check-session. Pass --check-session to refresh it with getProfile().\",\n\tcategory: \"Account\",\n\texamples: [\"line profile get\", \"line --check-session profile get\", \"line profile get --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (!base.profile) {\n\t\t\t\tthrow new CliError(\"AUTH_FAILED\", \"No cached profile is available\", {\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\thint: \"Run `line --check-session profile get` (or `line auth login`) once.\",\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn base.profile;\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst profile = value as Record<string, unknown>;\n\t\tconst lines = [\n\t\t\t`Display name: ${profile.displayName ?? \"\"}`,\n\t\t\t`MID: ${profile.mid ?? \"\"}`,\n\t\t\t`User ID: ${profile.userid || \"(not set)\"}`,\n\t\t\t`Status: ${profile.statusMessage ?? \"\"}`,\n\t\t\t`Phone: ${profile.phone || \"(not set)\"}`,\n\t\t\t`Email: ${profile.email || \"(not set)\"}`,\n\t\t\t`Region: ${profile.regionCode ?? \"\"}`,\n\t\t\t`Searchable: userid=${String(profile.allowSearchByUserid)} email=${String(profile.allowSearchByEmail)}`,\n\t\t];\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst updateCommand: CommandSpec = {\n\tname: \"profile update\",\n\tsummary: \"Update display name, status message, and profile settings.\",\n\tcategory: \"Account\",\n\toptions: [\n\t\t{ name: \"display-name\", type: \"string\", valueName: \"name\", description: \"Display name.\" },\n\t\t{ name: \"status-message\", type: \"string\", valueName: \"text\", description: \"Status message.\" },\n\t\t{ name: \"phonetic-name\", type: \"string\", valueName: \"name\", description: \"Phonetic name.\" },\n\t\t{ name: \"music-profile\", type: \"string\", valueName: \"text\", description: \"Music profile.\" },\n\t\t{\n\t\t\tname: \"allow-search-by-userid\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Allow being found by LINE ID (use --no-allow-search-by-userid to disable).\",\n\t\t},\n\t\t{\n\t\t\tname: \"allow-search-by-email\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Allow being found by email (use --no-allow-search-by-email to disable).\",\n\t\t},\n\t\t{\n\t\t\tname: \"hidden-from-list\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Hide from friend lists (use --no-hidden-from-list to show).\",\n\t\t},\n\t],\n\texamples: [\n\t\t'line profile update --display-name \"New name\" --status-message \"Hello\"',\n\t\t\"line profile update --no-allow-search-by-userid\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst update = {\n\t\t\t...(context.has(\"display-name\")\n\t\t\t\t? { displayName: context.getString(\"display-name\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"status-message\")\n\t\t\t\t? { statusMessage: context.getString(\"status-message\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"phonetic-name\")\n\t\t\t\t? { phoneticName: context.getString(\"phonetic-name\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"music-profile\")\n\t\t\t\t? { musicProfile: context.getString(\"music-profile\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"allow-search-by-userid\")\n\t\t\t\t? { allowSearchByUserid: context.getBool(\"allow-search-by-userid\") }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"allow-search-by-email\")\n\t\t\t\t? { allowSearchByEmail: context.getBool(\"allow-search-by-email\") }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"hidden-from-list\")\n\t\t\t\t? { hiddenFromList: context.getBool(\"hidden-from-list\") }\n\t\t\t\t: {}),\n\t\t};\n\t\tif (!Object.keys(update).length) {\n\t\t\tthrow new UsageError(\"Nothing to update. Pass at least one profile option.\");\n\t\t}\n\t\treturn await withClient(context, async ({ client, base, store }) => {\n\t\t\tawait client.updateMyProfile(update);\n\t\t\tconst merged = {\n\t\t\t\t...(base.profile ?? store.data.profile),\n\t\t\t\t...update,\n\t\t\t} as Record<string, unknown>;\n\t\t\tbase.profile = merged as unknown as Profile;\n\t\t\tawait store.setCachedProfile(merged, {\n\t\t\t\t...(typeof merged.mid === \"string\" ? { mid: merged.mid } : {}),\n\t\t\t\t...(typeof merged.displayName === \"string\" ? { displayName: merged.displayName } : {}),\n\t\t\t\t...(typeof merged.statusMessage === \"string\"\n\t\t\t\t\t? { statusMessage: merged.statusMessage }\n\t\t\t\t\t: {}),\n\t\t\t});\n\t\t\treturn { ok: true, update, profile: merged };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { update: Record<string, unknown> };\n\t\tconst lines = [\"Profile updated.\"];\n\t\tfor (const [key, entry] of Object.entries(result.update)) {\n\t\t\tlines.push(` ${key}: ${String(entry)}`);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst imageCommand: CommandSpec = {\n\tname: \"profile image\",\n\tsummary: \"Upload a new profile picture.\",\n\tcategory: \"Account\",\n\targs: [{ name: \"file\", description: \"Image file (JPEG or PNG).\", required: true }],\n\texamples: [\"line profile image ./avatar.png\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst result = await client.uploadMyProfileImage(file.blob);\n\t\t\treturn { ok: true, ...result, file: file.path, mime: file.blob.type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { objId: string; objHash: string };\n\t\treturn `Profile image uploaded (objId=${result.objId}, hash=${result.objHash})`;\n\t},\n};\n\nconst backgroundCommand: CommandSpec = {\n\tname: \"profile background\",\n\tsummary: \"Upload a new profile background (cover) image.\",\n\tcategory: \"Account\",\n\targs: [{ name: \"file\", description: \"Image file.\", required: true }],\n\texamples: [\"line profile background ./cover.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst result = await client.uploadMyProfileBackground(file.blob);\n\t\t\treturn { ok: true, ...result, file: file.path, mime: file.blob.type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { objId: string; objHash: string };\n\t\treturn `Profile background uploaded (objId=${result.objId}, hash=${result.objHash})`;\n\t},\n};\n\nexport const profileCommands: CommandSpec[] = [\n\tgetCommand,\n\tupdateCommand,\n\timageCommand,\n\tbackgroundCommand,\n];\n","import { SquareMessage } from \"@evex-dev/linejs\";\nimport { enums } from \"@evex-dev/linejs-types\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readFileAsBlob, writeBinaryFile } from \"../files.ts\";\nimport { serialize } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport {\n\tlimitOption,\n\tresolveReaction,\n\tsquareChatSummary,\n\tsquareMessageSummary,\n\tsquareSummary,\n} from \"./shared.ts\";\n\nconst listCommand: CommandSpec = {\n\tname: \"square list\",\n\tsummary: \"List joined OpenChat squares.\",\n\tcategory: \"OpenChat (Square)\",\n\texamples: [\"line square list\", \"line square list --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst squares = await client.fetchJoinedSquares();\n\t\t\treturn { squares: squares.map((square) => squareSummary(square, context.json)) };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst squares = (value as { squares: Array<Record<string, unknown>> }).squares;\n\t\tif (!squares.length) return \"No squares.\";\n\t\treturn squares\n\t\t\t.map((square) => `${String(square.mid ?? \"\")} ${String(square.name ?? \"\")}`)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"square get\",\n\tsummary: \"Show an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareMid\", description: \"Square MID.\", required: true }],\n\texamples: [\"line square get sxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst square = await client.getSquare(squareMid);\n\t\t\treturn squareSummary(square, true);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst square = value as Record<string, unknown>;\n\t\treturn `${String(square.name ?? \"\")} (${String(square.mid ?? \"\")})`;\n\t},\n};\n\nconst chatsCommand: CommandSpec = {\n\tname: \"square chats\",\n\tsummary: \"List joined OpenChat chats.\",\n\tcategory: \"OpenChat (Square)\",\n\texamples: [\"line square chats\", \"line square chats --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chats = await client.fetchJoinedSquareChats();\n\t\t\treturn { chats: chats.map((chat) => squareChatSummary(chat, context.json)) };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chats = (value as { chats: Array<Record<string, unknown>> }).chats;\n\t\tif (!chats.length) return \"No OpenChat chats.\";\n\t\treturn chats\n\t\t\t.map(\n\t\t\t\t(chat) =>\n\t\t\t\t\t`${String(chat.mid ?? \"\")} ${String(chat.name ?? \"\")} (square ${String(chat.squareMid ?? \"\")})`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst chatGetCommand: CommandSpec = {\n\tname: \"square chat-get\",\n\tsummary: \"Show one OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\texamples: [\"line square chat-get mxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\treturn squareChatSummary(chat, true);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chat = value as Record<string, unknown>;\n\t\treturn `${String(chat.name ?? \"\")} (${String(chat.mid ?? \"\")})`;\n\t},\n};\n\nconst chatMembersCommand: CommandSpec = {\n\tname: \"square chat-members\",\n\tsummary: \"List members of an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\texamples: [\"line square chat-members mxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst members = await chat.getMembers();\n\t\t\treturn { squareChatMid, members };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst members = (value as { members: Array<Record<string, unknown>> }).members;\n\t\tif (!members.length) return \"No members.\";\n\t\treturn members\n\t\t\t.map(\n\t\t\t\t(member) =>\n\t\t\t\t\t`${String(member.squareMemberMid ?? \"\")} state=${String(member.membershipState ?? \"\")}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst chatSendCommand: CommandSpec = {\n\tname: \"square chat-send\",\n\tsummary: \"Send a message to an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"text\", description: \"Message text.\", required: false, variadic: true },\n\t],\n\toptions: [{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Message text.\" }],\n\texamples: [\"line square chat-send mxxxxxxxx 'hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(1);\n\t\tif (!text) throw new UsageError(\"Missing message text\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst response = await chat.sendMessage(text);\n\t\t\treturn { ok: true, response };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst response = (value as { response: Record<string, unknown> }).response;\n\t\treturn `Sent OpenChat message: ${JSON.stringify(serialize(response))}`;\n\t},\n};\n\nconst chatMediaCommand: CommandSpec = {\n\tname: \"square chat-media\",\n\tsummary: \"Send an image, video, or audio message to an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"file\", description: \"File to upload.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\", \"audio\"],\n\t\t\tdescription: \"Media type (default: inferred).\",\n\t\t},\n\t\t{\n\t\t\tname: \"duration-ms\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"ms\",\n\t\t\tdescription: \"Duration for video/audio.\",\n\t\t},\n\t],\n\texamples: [\"line square chat-media mxxxxxxxx ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst file = await readFileAsBlob(context.requireArg(1, \"file\"), context.settings.cwd);\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\")\n\t\t\t\t? \"video\"\n\t\t\t\t: file.blob.type.startsWith(\"audio/\")\n\t\t\t\t\t? \"audio\"\n\t\t\t\t\t: \"image\")) as \"image\" | \"video\" | \"audio\";\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst result =\n\t\t\t\ttype === \"image\"\n\t\t\t\t\t? await chat.sendImage(file.blob, file.filename)\n\t\t\t\t\t: type === \"video\"\n\t\t\t\t\t\t? await chat.sendVideo(file.blob, file.filename, context.getNumber(\"duration-ms\"))\n\t\t\t\t\t\t: await chat.sendAudio(file.blob, file.filename, context.getNumber(\"duration-ms\"));\n\t\t\treturn { ok: true, type, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent ${(value as { type: string }).type} to OpenChat`;\n\t},\n};\n\nconst chatRenameCommand: CommandSpec = {\n\tname: \"square chat-rename\",\n\tsummary: \"Rename an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"name\", description: \"New name.\", required: true },\n\t],\n\texamples: [\"line square chat-rename mxxxxxxxx 'New name'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst name = context.rest(1);\n\t\tif (!name) throw new UsageError(\"Missing square name\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst result = await chat.updateName(name);\n\t\t\treturn { ok: true, squareChatMid, name, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Renamed ${(value as { squareChatMid: string }).squareChatMid}`;\n\t},\n};\n\nconst chatInviteCommand: CommandSpec = {\n\tname: \"square chat-invite\",\n\tsummary: \"Invite users to an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"Invitee MID(s).\", required: true, variadic: true },\n\t],\n\texamples: [\"line square chat-invite mxxxxxxxx uxxxx uyyyy\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst inviteeMids = context.positionals.slice(1);\n\t\tif (!inviteeMids.length) throw new UsageError(\"Pass at least one invitee MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.inviteIntoSquareChat({\n\t\t\t\trequest: { inviteeMids, squareChatMid },\n\t\t\t});\n\t\t\treturn { ok: true, squareChatMid, inviteeMids, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { squareChatMid: string; inviteeMids: string[] };\n\t\treturn `Invited ${result.inviteeMids.join(\", \")} to ${result.squareChatMid}`;\n\t},\n};\n\nconst chatLeaveCommand: CommandSpec = {\n\tname: \"square chat-leave\",\n\tsummary: \"Leave an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"goodbye\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Send a goodbye message (default: true). Use --no-goodbye to skip.\",\n\t\t},\n\t\t{ name: \"yes\", type: \"boolean\", description: \"Confirm leaving the chat.\" },\n\t],\n\texamples: [\"line square chat-leave mxxxxxxxx --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm leaving the chat\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.leaveSquareChat({\n\t\t\t\trequest: {\n\t\t\t\t\tsquareChatMid,\n\t\t\t\t\tsayGoodbye: context.getBool(\"goodbye\", true),\n\t\t\t\t\tsquareChatMemberRevision: 0,\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, squareChatMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Left ${(value as { squareChatMid: string }).squareChatMid}`;\n\t},\n};\n\nconst joinCommand: CommandSpec = {\n\tname: \"square join\",\n\tsummary: \"Join an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareMid\", description: \"Square MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"display-name\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"name\",\n\t\t\tdescription: \"Display name in the square.\",\n\t\t},\n\t\t{ name: \"passcode\", type: \"string\", valueName: \"code\", description: \"Join passcode.\" },\n\t\t{ name: \"message\", type: \"string\", valueName: \"text\", description: \"Join request message.\" },\n\t],\n\texamples: [\"line square join sxxxxxxxx\", \"line square join sxxxxxxxx --passcode 1234\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst displayName =\n\t\t\t\tcontext.getString(\"display-name\") ?? base.profile?.displayName ?? \"linejs\";\n\t\t\tconst result = await base.square.joinSquare({\n\t\t\t\tsquareMid,\n\t\t\t\tdisplayName,\n\t\t\t\tpassCode: context.getString(\"passcode\"),\n\t\t\t\tjoinMessage: context.getString(\"message\"),\n\t\t\t});\n\t\t\treturn { ok: true, squareMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Joined ${(value as { squareMid: string }).squareMid}`;\n\t},\n};\n\nconst leaveCommand: CommandSpec = {\n\tname: \"square leave\",\n\tsummary: \"Leave an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareMid\", description: \"Square MID.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm leaving the square.\" }],\n\texamples: [\"line square leave sxxxxxxxx --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm leaving the square\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.leaveSquare({ request: { squareMid } });\n\t\t\treturn { ok: true, squareMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Left ${(value as { squareMid: string }).squareMid}`;\n\t},\n};\n\nconst createCommand: CommandSpec = {\n\tname: \"square create\",\n\tsummary: \"Create a new OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\toptions: [\n\t\t{ name: \"name\", type: \"string\", valueName: \"name\", description: \"Square name.\" },\n\t\t{\n\t\t\tname: \"display-name\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"name\",\n\t\t\tdescription: \"Your display name in the square.\",\n\t\t},\n\t\t{ name: \"description\", type: \"string\", valueName: \"text\", description: \"Square description.\" },\n\t\t{ name: \"searchable\", type: \"boolean\", description: \"Allow search (default: true).\" },\n\t\t{ name: \"cover\", type: \"string\", valueName: \"obsHash\", description: \"Cover image OBS hash.\" },\n\t],\n\texamples: [\"line square create --name 'My square' --description 'Hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst name = context.requireString(\"name\", \"Missing --name\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.createSquare({\n\t\t\t\tsquareName: name,\n\t\t\t\tdisplayName: context.getString(\"display-name\") ?? base.profile?.displayName ?? \"linejs\",\n\t\t\t\tdescription: context.getString(\"description\"),\n\t\t\t\tsearchable: context.getBool(\"searchable\", true),\n\t\t\t\tprofileImageObsHash: context.getString(\"cover\"),\n\t\t\t});\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = (value as { result: Record<string, unknown> }).result;\n\t\tconst square = result.square as Record<string, unknown> | undefined;\n\t\treturn `Created square ${String(square?.mid ?? JSON.stringify(serialize(result)))}`;\n\t},\n};\n\nconst searchCommand: CommandSpec = {\n\tname: \"square search\",\n\tsummary: \"Search OpenChat squares.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"query\", description: \"Search query.\", required: true }],\n\toptions: [limitOption(20)],\n\texamples: [\"line square search 'music'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst query = context.requireArg(0, \"query\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 20;\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.searchSquares({\n\t\t\t\trequest: { query, continuationToken: \"\", limit },\n\t\t\t});\n\t\t\treturn result;\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { squares?: Array<Record<string, unknown>> };\n\t\tif (!result.squares?.length) return \"No squares found.\";\n\t\treturn result.squares\n\t\t\t.map((square) => `${String(square.mid ?? \"\")} ${String(square.name ?? \"\")}`)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst eventsCommand: CommandSpec = {\n\tname: \"square events\",\n\tsummary: \"Fetch recent events (and messages) for an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\toptions: [limitOption(50)],\n\texamples: [\"line square events mxxxxxxxx -n 50\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 50;\n\t\treturn await withClient(context, async ({ base, client }) => {\n\t\t\tconst response = await base.square.fetchSquareChatEvents({ squareChatMid, limit });\n\t\t\tconst messages: SquareMessage[] = [];\n\t\t\tfor (const event of response.events) {\n\t\t\t\tconst raw =\n\t\t\t\t\tevent.type === \"SEND_MESSAGE\"\n\t\t\t\t\t\t? event.payload.sendMessage?.squareMessage\n\t\t\t\t\t\t: event.type === \"RECEIVE_MESSAGE\"\n\t\t\t\t\t\t\t? event.payload.receiveMessage?.squareMessage\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\tif (!raw) continue;\n\t\t\t\ttry {\n\t\t\t\t\tmessages.push(SquareMessage.fromRawTalk(raw as never, client));\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsyncToken: response.syncToken,\n\t\t\t\tevents: response.events,\n\t\t\t\tmessages: messages.map((message) => squareMessageSummary(message, context.json)),\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { messages: Array<Record<string, unknown>> };\n\t\tif (!result.messages.length) return \"No messages.\";\n\t\treturn result.messages\n\t\t\t.map(\n\t\t\t\t(message) =>\n\t\t\t\t\t`[${String(message.createdTime ?? \"\")}] ${String(message.from ?? \"\")}: ${String(\n\t\t\t\t\t\tmessage.text ?? `(${String(message.contentType ?? \"message\")})`,\n\t\t\t\t\t)}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nfunction extensionForMime(type: string): string {\n\tconst map: Record<string, string> = {\n\t\t\"image/jpeg\": \"jpg\",\n\t\t\"image/png\": \"png\",\n\t\t\"image/gif\": \"gif\",\n\t\t\"video/mp4\": \"mp4\",\n\t\t\"audio/mp4\": \"m4a\",\n\t\t\"audio/mpeg\": \"mp3\",\n\t\t\"application/pdf\": \"pdf\",\n\t};\n\treturn map[type] ?? \"bin\";\n}\n\nconst messageDataCommand: CommandSpec = {\n\tname: \"square message-data\",\n\tsummary: \"Download media attached to an OpenChat message.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"out\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"path\",\n\t\t\tdescription: \"Output file (default: square-<id>.<ext>).\",\n\t\t},\n\t\t{\n\t\t\tname: \"preview\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Download the preview instead of the original.\",\n\t\t},\n\t\tlimitOption(100),\n\t],\n\texamples: [\"line square message-data mxxxxxxxx 123 --out ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 100;\n\t\treturn await withClient(context, async ({ base, client }) => {\n\t\t\tconst response = await base.square.fetchSquareChatEvents({ squareChatMid, limit });\n\t\t\tlet target: SquareMessage | undefined;\n\t\t\tfor (const event of response.events) {\n\t\t\t\tconst raw =\n\t\t\t\t\tevent.type === \"SEND_MESSAGE\"\n\t\t\t\t\t\t? event.payload.sendMessage?.squareMessage\n\t\t\t\t\t\t: event.type === \"RECEIVE_MESSAGE\"\n\t\t\t\t\t\t\t? event.payload.receiveMessage?.squareMessage\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\tif (!raw) continue;\n\t\t\t\tconst message = SquareMessage.fromRawTalk(raw as never, client);\n\t\t\t\tif (message.raw.message.id === messageId) {\n\t\t\t\t\ttarget = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!target) {\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"NOT_FOUND\",\n\t\t\t\t\t`Message ${messageId} was not found in the last ${limit} events`,\n\t\t\t\t\t{\n\t\t\t\t\t\tdetails: { squareChatMid, messageId, limit },\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst blob = await target.getData(context.getBool(\"preview\"));\n\t\t\tconst out =\n\t\t\t\tcontext.getString(\"out\") ??\n\t\t\t\t`square-${messageId}.${extensionForMime(blob.type || \"application/octet-stream\")}`;\n\t\t\tconst written = await writeBinaryFile(out, blob, context.settings.cwd);\n\t\t\treturn { ok: true, ...written, type: blob.type, messageId, squareChatMid };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number; type: string };\n\t\treturn `Saved ${result.size} bytes (${result.type}) to ${result.path}`;\n\t},\n};\n\nconst reactCommand: CommandSpec = {\n\tname: \"square react\",\n\tsummary: \"React to an OpenChat message.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t\t{ name: \"reaction\", description: \"Reaction name or number.\", required: true },\n\t],\n\texamples: [\"line square react mxxxxxxxx 123 NICE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst resolved = resolveReaction(context.requireArg(2, \"reaction\"));\n\t\tconst reaction =\n\t\t\ttypeof resolved === \"number\" ? resolved : (enums.MessageReactionType[resolved] as number);\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.reactToMessage({\n\t\t\t\trequest: {\n\t\t\t\t\treqSeq: await base.getReqseq(\"sq\"),\n\t\t\t\t\treactionType: reaction,\n\t\t\t\t\tmessageId,\n\t\t\t\t\tsquareChatMid,\n\t\t\t\t},\n\t\t\t} as never);\n\t\t\treturn { ok: true, squareChatMid, messageId, reaction, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { messageId: string; reaction: number };\n\t\treturn `Reacted to ${result.messageId} with ${result.reaction}`;\n\t},\n};\n\nconst renameCommand: CommandSpec = {\n\tname: \"square rename\",\n\tsummary: \"Rename an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareMid\", description: \"Square MID.\", required: true },\n\t\t{ name: \"name\", description: \"New square name.\", required: true },\n\t],\n\texamples: [\"line square rename sxxxxxxxx 'New name'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\tconst name = context.rest(1);\n\t\tif (!name) throw new UsageError(\"Missing square name\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst square = await client.getSquare(squareMid);\n\t\t\tconst result = await square.updateName(name);\n\t\t\treturn { ok: true, squareMid, name, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Renamed ${(value as { squareMid: string }).squareMid}`;\n\t},\n};\n\nconst replyMessageCommand: CommandSpec = {\n\tname: \"square message-reply\",\n\tsummary: \"Reply to an OpenChat message.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t\t{ name: \"text\", description: \"Reply text.\", required: true, variadic: true },\n\t],\n\texamples: [\"line square message-reply mxxxxxxxx 123 'Thanks!'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst relatedMessageId = context.requireArg(1, \"messageId\");\n\t\tconst text = context.rest(2);\n\t\tif (!text) throw new UsageError(\"Missing reply text\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.sendMessage({\n\t\t\t\tsquareChatMid,\n\t\t\t\ttext,\n\t\t\t\trelatedMessageId,\n\t\t\t});\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent OpenChat reply: ${JSON.stringify(serialize((value as { result: unknown }).result))}`;\n\t},\n};\n\nconst readMessageCommand: CommandSpec = {\n\tname: \"square message-read\",\n\tsummary: \"Mark an OpenChat message as read.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\texamples: [\"line square message-read mxxxxxxxx 123\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.markAsRead({\n\t\t\t\trequest: { squareChatMid, messageId, threadMid: \"\" },\n\t\t\t});\n\t\t\treturn { ok: true, squareChatMid, messageId, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Marked ${(value as { messageId: string }).messageId} read`;\n\t},\n};\n\nconst unsendMessageCommand: CommandSpec = {\n\tname: \"square message-unsend\",\n\tsummary: \"Unsend one of your OpenChat messages.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\texamples: [\"line square message-unsend mxxxxxxxx 123\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.unsendMessage({ squareChatMid, messageId });\n\t\t\treturn { ok: true, squareChatMid, messageId, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Unsents ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nconst destroyMessageCommand: CommandSpec = {\n\tname: \"square message-destroy\",\n\tsummary: \"Destroy an OpenChat message (moderation).\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm the destructive action.\" }],\n\texamples: [\"line square message-destroy mxxxxxxxx 123 --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tif (!context.getBool(\"yes\"))\n\t\t\tthrow new UsageError(\"Pass --yes to confirm destroying the message\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.destroyMessage({ squareChatMid, messageId });\n\t\t\treturn { ok: true, squareChatMid, messageId, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Destroyed ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nexport const squareCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\tchatsCommand,\n\tchatGetCommand,\n\tchatMembersCommand,\n\tchatSendCommand,\n\tchatMediaCommand,\n\tchatRenameCommand,\n\tchatInviteCommand,\n\tchatLeaveCommand,\n\tjoinCommand,\n\tleaveCommand,\n\tcreateCommand,\n\tsearchCommand,\n\teventsCommand,\n\treactCommand,\n\trenameCommand,\n\treplyMessageCommand,\n\treadMessageCommand,\n\tunsendMessageCommand,\n\tdestroyMessageCommand,\n\tmessageDataCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { writeBinaryFile } from \"../files.ts\";\nimport { ProfileStore } from \"../profile-store.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { outOption } from \"./shared.ts\";\n\nasync function openStore(context: import(\"../context.ts\").CommandContext): Promise<ProfileStore> {\n\treturn await ProfileStore.open(context.settings.profile.path, {\n\t\tname: context.settings.profile.name,\n\t});\n}\n\nconst listCommand: CommandSpec = {\n\tname: \"storage list\",\n\tsummary: \"List keys in the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\toptions: [\n\t\t{ name: \"values\", type: \"boolean\", description: \"Include values (may contain secrets).\" },\n\t],\n\texamples: [\"line storage list\", \"line storage list --values --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst includeValues = context.getBool(\"values\");\n\t\tconst entries = Object.entries(store.data.storage).map(([key, value]) => ({\n\t\t\tkey,\n\t\t\ttype: typeof value,\n\t\t\t...(includeValues ? { value } : {}),\n\t\t}));\n\t\treturn {\n\t\t\tprofile: store.name,\n\t\t\tpath: store.path,\n\t\t\tkeys: entries,\n\t\t};\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tprofile: string;\n\t\t\tpath: string;\n\t\t\tkeys: Array<{ key: string; type: string; value?: unknown }>;\n\t\t};\n\t\tif (!result.keys.length) return `No storage keys in ${result.profile}.`;\n\t\treturn result.keys\n\t\t\t.map((entry) =>\n\t\t\t\tentry.value === undefined\n\t\t\t\t\t? `${entry.key} (${entry.type})`\n\t\t\t\t\t: `${entry.key} (${entry.type}) = ${JSON.stringify(entry.value)}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"storage get\",\n\tsummary: \"Read one value from the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\targs: [{ name: \"key\", description: \"Storage key.\", required: true }],\n\texamples: [\"line storage get reqseq\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst key = context.requireArg(0, \"key\");\n\t\treturn { key, value: store.getStorage(key) ?? null };\n\t},\n\tformat(value) {\n\t\tconst result = value as { key: string; value: unknown };\n\t\treturn formatJson(result.value);\n\t},\n};\n\nconst setCommand: CommandSpec = {\n\tname: \"storage set\",\n\tsummary: \"Write one value to the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\targs: [\n\t\t{ name: \"key\", description: \"Storage key.\", required: true },\n\t\t{\n\t\t\tname: \"value\",\n\t\t\tdescription: \"Value (JSON when parseable, otherwise a string).\",\n\t\t\trequired: true,\n\t\t\tvariadic: true,\n\t\t},\n\t],\n\texamples: [\"line storage set myKey 'hello'\", \"line storage set myJson '{\\\"a\\\":1}'\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst key = context.requireArg(0, \"key\");\n\t\tconst raw = context.rest(1);\n\t\tif (!raw) throw new UsageError(\"Missing value\");\n\t\tlet value: unknown;\n\t\ttry {\n\t\t\tvalue = JSON.parse(raw);\n\t\t} catch {\n\t\t\tvalue = raw;\n\t\t}\n\t\tawait store.setStorage(key, value as never);\n\t\tawait store.flush();\n\t\treturn { ok: true, key, value };\n\t},\n\tformat(value) {\n\t\tconst result = value as { key: string; value: unknown };\n\t\treturn `Set ${result.key} = ${JSON.stringify(result.value)}`;\n\t},\n};\n\nconst deleteCommand: CommandSpec = {\n\tname: \"storage delete\",\n\tsummary: \"Delete one key from the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\targs: [{ name: \"key\", description: \"Storage key.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm deletion.\" }],\n\texamples: [\"line storage delete myKey --yes\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst key = context.requireArg(0, \"key\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm deletion\");\n\t\tawait store.deleteStorage(key);\n\t\tawait store.flush();\n\t\treturn { ok: true, key };\n\t},\n\tformat(value) {\n\t\treturn `Deleted ${(value as { key: string }).key}`;\n\t},\n};\n\nconst clearCommand: CommandSpec = {\n\tname: \"storage clear\",\n\tsummary: \"Delete every key from the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm clearing storage.\" }],\n\texamples: [\"line storage clear --yes\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tif (!context.getBool(\"yes\")) {\n\t\t\tthrow new UsageError(\"Pass --yes to confirm clearing storage (this deletes E2EE keys)\");\n\t\t}\n\t\tawait store.clearStorage();\n\t\tawait store.flush();\n\t\treturn { ok: true };\n\t},\n\tformat() {\n\t\treturn \"Cleared profile storage.\";\n\t},\n};\n\nconst exportCommand: CommandSpec = {\n\tname: \"storage export\",\n\tsummary: \"Export the profile's LINEJS storage to a JSON file.\",\n\tcategory: \"Storage\",\n\toptions: [outOption(\"Output file (required).\")],\n\texamples: [\"line storage export --out ./storage.json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst out = context.requireString(\"out\", \"Missing --out\");\n\t\tconst text = JSON.stringify(store.data.storage, null, 2);\n\t\tconst written = await writeBinaryFile(\n\t\t\tout,\n\t\t\tnew TextEncoder().encode(text),\n\t\t\tcontext.settings.cwd,\n\t\t);\n\t\treturn { ok: true, ...written };\n\t},\n\tformat(value) {\n\t\treturn `Exported storage to ${(value as { path: string }).path}`;\n\t},\n};\n\nexport const storageCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\tsetCommand,\n\tdeleteCommand,\n\tclearCommand,\n\texportCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { readFileAsBlob } from \"../files.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport { YES_OPTION } from \"./shared.ts\";\n\nconst postOptions = [\n\t{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Post text.\" },\n\t{\n\t\tname: \"text-size-mode\",\n\t\ttype: \"string\",\n\t\tvalueName: \"mode\",\n\t\tchoices: [\"AUTO\", \"NORMAL\"],\n\t\tdescription: \"Text size mode.\",\n\t},\n\t{\n\t\tname: \"background-color\",\n\t\ttype: \"string\",\n\t\tvalueName: \"hex\",\n\t\tdescription: \"Background color (for example #FFFFFF).\",\n\t},\n\t{\n\t\tname: \"text-animation\",\n\t\ttype: \"string\",\n\t\tvalueName: \"animation\",\n\t\tchoices: [\"NONE\", \"SLIDE\", \"ZOOM\", \"BUZZ\", \"BOUNCE\", \"BLINK\"],\n\t\tdescription: \"Text animation.\",\n\t},\n\t{\n\t\tname: \"read-permission\",\n\t\ttype: \"string\",\n\t\tvalueName: \"type\",\n\t\tchoices: [\"ALL\", \"FRIEND\", \"GROUP\", \"EVENT\", \"NONE\"],\n\t\tdescription: \"Read permission.\",\n\t},\n\t{\n\t\tname: \"shared-post-id\",\n\t\ttype: \"string\",\n\t\tvalueName: \"postId\",\n\t\tdescription: \"Share an existing post.\",\n\t},\n\t{\n\t\tname: \"media-object-id\",\n\t\ttype: \"array\",\n\t\tvalueName: \"objId\",\n\t\tdescription: \"Media object id (repeatable).\",\n\t},\n\t{\n\t\tname: \"media-object-type\",\n\t\ttype: \"array\",\n\t\tvalueName: \"type\",\n\t\tdescription: \"Media object type (repeatable; PHOTO or VIDEO).\",\n\t},\n\t{ name: \"sticker-id\", type: \"array\", valueName: \"id\", description: \"Sticker id (repeatable).\" },\n\t{\n\t\tname: \"sticker-package-id\",\n\t\ttype: \"array\",\n\t\tvalueName: \"id\",\n\t\tdescription: \"Sticker package id (repeatable).\",\n\t},\n\t{\n\t\tname: \"location-latitude\",\n\t\ttype: \"array\",\n\t\tvalueName: \"n\",\n\t\tdescription: \"Location latitude (repeatable).\",\n\t},\n\t{\n\t\tname: \"location-longitude\",\n\t\ttype: \"array\",\n\t\tvalueName: \"n\",\n\t\tdescription: \"Location longitude (repeatable).\",\n\t},\n\t{\n\t\tname: \"location-name\",\n\t\ttype: \"array\",\n\t\tvalueName: \"name\",\n\t\tdescription: \"Location name (repeatable).\",\n\t},\n\t{\n\t\tname: \"source-type\",\n\t\ttype: \"string\",\n\t\tvalueName: \"type\",\n\t\tdescription: \"Source type (default TIMELINE).\",\n\t},\n\t{ name: \"holding-time\", type: \"number\", valueName: \"ms\", description: \"Holding time.\" },\n] as const;\n\nfunction postInput(\n\tcontext: import(\"../context.ts\").CommandContext,\n\thomeId: string,\n\ttextStart: number,\n) {\n\tconst text = context.getString(\"text\") ?? context.rest(textStart);\n\tconst mediaObjectIds = context.getArray(\"media-object-id\");\n\tconst mediaObjectTypes = context.getArray(\"media-object-type\");\n\tif (mediaObjectIds.length && mediaObjectIds.length !== mediaObjectTypes.length) {\n\t\tthrow new UsageError(\"--media-object-id and --media-object-type must have the same length\");\n\t}\n\tconst input: Record<string, unknown> = { homeId };\n\tconst set = (key: string, value: unknown) => {\n\t\tif (value === undefined) return;\n\t\tif (Array.isArray(value) && value.length === 0) return;\n\t\tinput[key] = value;\n\t};\n\tset(\"text\", text || undefined);\n\tset(\"textSizeMode\", context.getString(\"text-size-mode\"));\n\tset(\"backgroundColor\", context.getString(\"background-color\"));\n\tset(\"textAnimation\", context.getString(\"text-animation\"));\n\tset(\"readPermissionType\", context.getString(\"read-permission\"));\n\tset(\"sharedPostId\", context.getString(\"shared-post-id\"));\n\tset(\"mediaObjectIds\", mediaObjectIds);\n\tset(\"mediaObjectTypes\", mediaObjectTypes);\n\tset(\"stickerIds\", context.getArray(\"sticker-id\"));\n\tset(\"stickerPackageIds\", context.getArray(\"sticker-package-id\"));\n\tset(\"locationLatitudes\", context.getArray(\"location-latitude\").map(Number));\n\tset(\"locationLongitudes\", context.getArray(\"location-longitude\").map(Number));\n\tset(\"locationNames\", context.getArray(\"location-name\"));\n\tset(\"sourceType\", context.getString(\"source-type\"));\n\tset(\"holdingTime\", context.getNumber(\"holding-time\"));\n\treturn input;\n}\n\nconst postCommand: CommandSpec = {\n\tname: \"timeline post\",\n\tsummary: \"Create a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group chat MID (c...) or square MID (s...).\", required: true },\n\t\t{ name: \"text\", description: \"Post text.\", required: false, variadic: true },\n\t],\n\toptions: postOptions,\n\texamples: [\"line timeline post cxxxxxxxx 'Hello!'\", \"line note post cxxxxxxxx --text 'Hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.timeline.createPost(postInput(context, homeId, 1) as never);\n\t\t\treturn result;\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { code?: number; message?: string };\n\t\treturn result.code === 0 || result.code === undefined\n\t\t\t? \"Post created.\"\n\t\t\t: `Timeline error ${result.code}: ${result.message ?? \"\"}`;\n\t},\n};\n\nconst listCommand: CommandSpec = {\n\tname: \"timeline list\",\n\tsummary: \"List timeline/Note posts.\",\n\tcategory: \"Timeline / Note\",\n\targs: [{ name: \"homeId\", description: \"Group or square MID.\", required: true }],\n\toptions: [\n\t\t{ name: \"post-id\", type: \"string\", valueName: \"postId\", description: \"Fetch one post.\" },\n\t\t{ name: \"updated-time\", type: \"number\", valueName: \"ms\", description: \"Updated-time cursor.\" },\n\t\t{ name: \"source-type\", type: \"string\", valueName: \"type\", description: \"Source type.\" },\n\t],\n\texamples: [\"line timeline list cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.timeline.listPost({\n\t\t\t\thomeId,\n\t\t\t\tpostId: context.getString(\"post-id\"),\n\t\t\t\tupdatedTime: context.getNumber(\"updated-time\"),\n\t\t\t\tsourceType: context.getString(\"source-type\"),\n\t\t\t});\n\t\t\treturn result;\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"timeline get\",\n\tsummary: \"Fetch one timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\texamples: [\"line timeline get cxxxxxxxx 123456\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.getPost({ homeId, postId });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst updateCommand: CommandSpec = {\n\tname: \"timeline update\",\n\tsummary: \"Update a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\toptions: postOptions,\n\texamples: [\"line timeline update cxxxxxxxx 123456 --text 'Edited'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\tconst input = postInput(context, homeId, 2);\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.updatePost({ ...input, postId } as never);\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst deleteCommand: CommandSpec = {\n\tname: \"timeline delete\",\n\tsummary: \"Delete a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\toptions: [YES_OPTION],\n\texamples: [\"line timeline delete cxxxxxxxx 123456 --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm deleting the post\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.deletePost({ homeId, postId });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst shareCommand: CommandSpec = {\n\tname: \"timeline share\",\n\tsummary: \"Share a timeline/Note post to a chat.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t\t{ name: \"chatMid\", description: \"Destination chat MID.\", required: true },\n\t],\n\texamples: [\"line timeline share cxxxxxxxx 123456 cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\tconst chatMid = context.requireArg(2, \"chatMid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.sharePost({ homeId, postId, chatMid });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst likeCommand: CommandSpec = {\n\tname: \"timeline like\",\n\tsummary: \"Like a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"code\",\n\t\t\tchoices: [\"1003\", \"1001\", \"1002\", \"1004\", \"1006\", \"1005\"],\n\t\t\tdescription: \"Like type (default 1003 GOOD).\",\n\t\t},\n\t],\n\texamples: [\"line timeline like cxxxxxxxx 123456 --type 1001\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst contentId = context.requireArg(1, \"postId\");\n\t\tconst likeType = (context.getString(\"type\") ?? \"1003\") as never;\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.likePost({ homeId, contentId, likeType });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst commentCommand: CommandSpec = {\n\tname: \"timeline comment\",\n\tsummary: \"Comment on a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t\t{ name: \"text\", description: \"Comment text.\", required: true, variadic: true },\n\t],\n\texamples: [\"line timeline comment cxxxxxxxx 123456 'Nice!'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst contentId = context.requireArg(1, \"postId\");\n\t\tconst commentText = context.rest(2);\n\t\tif (!commentText) throw new UsageError(\"Missing comment text\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.createComment({ homeId, contentId, commentText });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst uploadCommand: CommandSpec = {\n\tname: \"timeline upload\",\n\tsummary: \"Upload an image or video for a Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [{ name: \"file\", description: \"Image or video file.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\"],\n\t\t\tdescription: \"Media type (default: inferred).\",\n\t\t},\n\t],\n\texamples: [\"line timeline upload ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\") ? \"video\" : \"image\")) as \"image\" | \"video\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.timeline.uploadNoteMedia(type, file.blob);\n\t\t\treturn { ...result, type, file: file.path };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { objId: string; objHash: string };\n\t\treturn `Uploaded ${result.objId} (${result.objHash})`;\n\t},\n};\n\nfunction formatTimeline(value: unknown): string {\n\tconst result = value as {\n\t\tcode?: number;\n\t\tmessage?: string;\n\t\tresult?: { posts?: Array<Record<string, unknown>> };\n\t};\n\tif (result.code !== undefined && result.code !== 0) {\n\t\treturn `Timeline error ${result.code}: ${result.message ?? \"\"}`;\n\t}\n\tconst posts = result.result?.posts;\n\tif (Array.isArray(posts)) {\n\t\tif (!posts.length) return \"No posts.\";\n\t\treturn posts\n\t\t\t.map((post) => `${String(post.id ?? post.postId ?? \"\")} ${String(post.text ?? \"\")}`)\n\t\t\t.join(\"\\n\");\n\t}\n\treturn formatJson(value);\n}\n\nexport const timelineCommands: CommandSpec[] = [\n\tpostCommand,\n\tlistCommand,\n\tgetCommand,\n\tupdateCommand,\n\tdeleteCommand,\n\tshareCommand,\n\tlikeCommand,\n\tcommentCommand,\n\tuploadCommand,\n];\n\nexport const noteCommands: CommandSpec[] = timelineCommands\n\t.filter((command) => command.name !== \"timeline upload\")\n\t.map((command) => ({\n\t\t...command,\n\t\tname: command.name.replace(/^timeline/, \"note\"),\n\t\tcategory: \"Timeline / Note\",\n\t\tsummary: command.summary.replace(\"timeline/Note\", \"Note\"),\n\t\texamples: (command.examples ?? []).map((example) =>\n\t\t\texample.replace(/^line timeline/, \"line note\"),\n\t\t),\n\t}));\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\n/** Mirrors VoomChannelId exported by the client feature module. */\nconst VOOM_CHANNELS = {\n\tTIMELINE: \"1341209950\",\n\tHOME: \"1341209850\",\n\tHOME26: \"2007835442\",\n\tNOTE: \"1655599932\",\n\tSQUARE_NOTE: \"1657618623\",\n\tALBUM: \"1375220249\",\n} as const;\ntype VoomChannel = keyof typeof VOOM_CHANNELS;\nconst channels = Object.keys(VOOM_CHANNELS) as VoomChannel[];\n\nfunction requireChannel(value: string | undefined): VoomChannel {\n\tif (!value) throw new UsageError(`Missing channel (${channels.join(\", \")})`);\n\tif (!(value in VOOM_CHANNELS)) {\n\t\tthrow new UsageError(`Unknown channel: ${value} (expected ${channels.join(\", \")})`);\n\t}\n\treturn value as VoomChannel;\n}\n\nconst tokenCommand: CommandSpec = {\n\tname: \"voom token\",\n\tsummary: \"Issue a VOOM channel token.\",\n\tcategory: \"VOOM\",\n\targs: [{ name: \"channel\", description: channels.join(\", \"), required: true }],\n\texamples: [\"line voom token TIMELINE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst channel = requireChannel(context.requireArg(0, \"channel\"));\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst token = await client.voom.getToken(channel);\n\t\t\treturn { channel, token };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { token: string }).token;\n\t},\n};\n\nconst feedCommand: CommandSpec = {\n\tname: \"voom feed\",\n\tsummary: \"Fetch the VOOM timeline feed.\",\n\tcategory: \"VOOM\",\n\toptions: [\n\t\t{\n\t\t\tname: \"post-limit\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"n\",\n\t\t\tdescription: \"Posts per page (default 10).\",\n\t\t},\n\t\t{\n\t\t\tname: \"following-max-page\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"n\",\n\t\t\tdescription: \"Following pages (default 2).\",\n\t\t},\n\t],\n\texamples: [\"line voom feed\", \"line voom feed --post-limit 20\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.voom.feed({\n\t\t\t\tpostLimit: context.getNumber(\"post-limit\"),\n\t\t\t\tfollowingMaxPage: context.getNumber(\"following-max-page\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn formatJson(value);\n\t},\n};\n\nconst statusCommand: CommandSpec = {\n\tname: \"voom status\",\n\tsummary: \"Fetch the VOOM timeline status.\",\n\tcategory: \"VOOM\",\n\texamples: [\"line voom status\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.voom.timelineStatus();\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn formatJson(value);\n\t},\n};\n\nconst callCommand: CommandSpec = {\n\tname: \"voom call\",\n\tsummary: \"Call an arbitrary VOOM REST endpoint.\",\n\tcategory: \"VOOM\",\n\targs: [{ name: \"channel\", description: channels.join(\", \"), required: true }],\n\toptions: [\n\t\t{ name: \"path\", type: \"string\", valueName: \"path\", description: \"REST path (required).\" },\n\t\t{\n\t\t\tname: \"routing\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"prefix\",\n\t\t\tchoices: [\n\t\t\t\t\"MYHOME\",\n\t\t\t\t\"MYHOME_RENEWAL\",\n\t\t\t\t\"TIMELINE\",\n\t\t\t\t\"TIMELINE_GATEWAY\",\n\t\t\t\t\"NOTE\",\n\t\t\t\t\"HOMEAPI\",\n\t\t\t\t\"SQUARE_NOTE\",\n\t\t\t\t\"ALBUM\",\n\t\t\t\t\"STORY\",\n\t\t\t\t\"SOCIAL_NOTIFICATION\",\n\t\t\t\t\"TRANSLATION\",\n\t\t\t],\n\t\t\tdescription: \"Routing prefix.\",\n\t\t},\n\t\t{\n\t\t\tname: \"method\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"method\",\n\t\t\tchoices: [\"GET\", \"POST\", \"PUT\", \"DELETE\"],\n\t\t\tdescription: \"HTTP method.\",\n\t\t},\n\t\t{ name: \"body\", type: \"string\", valueName: \"json\", description: \"JSON request body.\" },\n\t\t{ name: \"host\", type: \"string\", valueName: \"host\", description: \"Host override.\" },\n\t],\n\texamples: [\"line voom call TIMELINE --path /api/v57/timeline/tab/status.json --routing TIMELINE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst channel = requireChannel(context.requireArg(0, \"channel\"));\n\t\tconst path = context.requireString(\"path\", \"Missing --path\");\n\t\tconst body = context.getJson(\"body\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.voom.call(channel, {\n\t\t\t\tpath,\n\t\t\t\trouting: context.getString(\"routing\") as never,\n\t\t\t\tmethod: context.getString(\"method\") as never,\n\t\t\t\tbody,\n\t\t\t\thost: context.getString(\"host\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn formatJson(value);\n\t},\n};\n\nexport const voomCommands: CommandSpec[] = [tokenCommand, feedCommand, statusCommand, callCommand];\n","import type { CommandSpec } from \"./command.ts\";\nimport { apiCommands } from \"./commands/api.ts\";\nimport { authCommands } from \"./commands/auth.ts\";\nimport { birthdayCommands } from \"./commands/birthday.ts\";\nimport { callCommands } from \"./commands/call.ts\";\nimport { chatsCommands } from \"./commands/chats.ts\";\nimport { contactsCommands } from \"./commands/contacts.ts\";\nimport { liffCommands } from \"./commands/liff.ts\";\nimport { listenCommands } from \"./commands/listen.ts\";\nimport { mediaCommands } from \"./commands/media.ts\";\nimport { messagesCommands } from \"./commands/messages.ts\";\nimport { moaCommands } from \"./commands/moa.ts\";\nimport { mcpCommands } from \"./commands/mcp.ts\";\nimport { profileCommands } from \"./commands/profile.ts\";\nimport { squareCommands } from \"./commands/square.ts\";\nimport { storageCommands } from \"./commands/storage.ts\";\nimport { timelineCommands, noteCommands } from \"./commands/timeline.ts\";\nimport { voomCommands } from \"./commands/voom.ts\";\n\nexport const allCommands: readonly CommandSpec[] = [\n\t...authCommands,\n\t...profileCommands,\n\t...contactsCommands,\n\t...chatsCommands,\n\t...messagesCommands,\n\t...squareCommands,\n\t...timelineCommands,\n\t...noteCommands,\n\t...moaCommands,\n\t...mediaCommands,\n\t...callCommands,\n\t...liffCommands,\n\t...voomCommands,\n\t...birthdayCommands,\n\t...storageCommands,\n\t...apiCommands,\n\t...listenCommands,\n\t...mcpCommands,\n].sort((a, b) => a.name.localeCompare(b.name));\n\nexport interface CommandResolution {\n\tcommand?: CommandSpec;\n\t/** Resolved command path tokens. */\n\tpath: string[];\n\t/** Tokens left after the command path. */\n\tremaining: string[];\n\t/** Set when the path names a command group instead of an exact command. */\n\tgroup?: string;\n\tgroupCommands?: CommandSpec[];\n\tunknown?: string;\n}\n\n/**\n * Resolve the command path from the first tokens. Command paths are contiguous;\n * parsing stops at the first option or unmatched token.\n */\nexport function resolveCommandTokens(tokens: readonly string[]): CommandResolution {\n\tconst first = tokens[0];\n\tif (!first || first.startsWith(\"-\")) return { path: [], remaining: [] };\n\tconst path = [first];\n\tconst known = allCommands.filter(\n\t\t(command) => command.name === first || command.name.startsWith(`${first} `),\n\t);\n\tif (!known.length) {\n\t\treturn { path, remaining: tokens.slice(1), unknown: first };\n\t}\n\n\tlet index = 1;\n\twhile (index < tokens.length) {\n\t\tconst token = tokens[index]!;\n\t\tif (token.startsWith(\"-\")) break;\n\t\tconst candidate = [...path, token].join(\" \");\n\t\tconst matches = allCommands.filter(\n\t\t\t(command) => command.name === candidate || command.name.startsWith(`${candidate} `),\n\t\t);\n\t\tif (!matches.length) break;\n\t\tpath.push(token);\n\t\tindex += 1;\n\t}\n\n\tconst name = path.join(\" \");\n\tconst exact = allCommands.find((command) => command.name === name);\n\tif (exact) {\n\t\treturn { command: exact, path, remaining: tokens.slice(index) };\n\t}\n\tconst groupCommands = allCommands.filter((command) => command.name.startsWith(`${name} `));\n\treturn {\n\t\tpath,\n\t\tremaining: tokens.slice(index),\n\t\tgroup: name,\n\t\tgroupCommands,\n\t};\n}\n\nexport function findCommandByName(name: string): CommandSpec | undefined {\n\treturn allCommands.find((command) => command.name === name);\n}\n","","import pkg from \"../package.json\" with { type: \"json\" };\n\n/**\n * Version reported by `line --version` and the MCP server.\n *\n * Single-sourced from package.json so a release bump (the publish workflow\n * rewrites the manifest) never needs a second edit here.\n */\nexport const VERSION: string = pkg.version;\n","import { GLOBAL_OPTIONS, type OptionSpec } from \"./args.ts\";\nimport { type CommandSpec, commandMetadata, commandUsage } from \"./command.ts\";\nimport { allCommands } from \"./registry.ts\";\nimport { VERSION } from \"./version.ts\";\n\nexport function describeOption(spec: OptionSpec): string {\n\tconst value =\n\t\tspec.type === \"boolean\"\n\t\t\t? \"\"\n\t\t\t: ` <${spec.valueName ?? (spec.type === \"array\" ? \"value\" : \"value\")}>`;\n\tconst choices = spec.choices?.length ? ` (${spec.choices.join(\"|\")})` : \"\";\n\tconst short = spec.short ? `-${spec.short}, ` : \" \";\n\treturn `${short}--${spec.name}${value}${choices}`;\n}\n\nfunction optionLines(specs: readonly OptionSpec[]): string[] {\n\tconst visible = specs.filter((spec) => !spec.hidden);\n\tconst width = Math.max(...visible.map((spec) => describeOption(spec).length), 0);\n\treturn visible.map((spec) => ` ${describeOption(spec).padEnd(width)} ${spec.description}`);\n}\n\nexport function rootHelp(commands: readonly CommandSpec[] = allCommands): string {\n\tconst lines = [\n\t\t`@evex-dev/linejs-cli ${VERSION}`,\n\t\t\"LINEJS command-line interface\",\n\t\t\"\",\n\t\t\"Usage:\",\n\t\t\" line <command> [options]\",\n\t\t\" line help [command]\",\n\t\t\" line commands [--json]\",\n\t\t\"\",\n\t];\n\tconst categories = new Map<string, CommandSpec[]>();\n\tfor (const command of commands) {\n\t\tconst list = categories.get(command.category) ?? [];\n\t\tlist.push(command);\n\t\tcategories.set(command.category, list);\n\t}\n\tfor (const [category, entries] of categories) {\n\t\tlines.push(`${category}:`);\n\t\tconst width = Math.max(...entries.map((entry) => entry.name.length));\n\t\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tlines.push(` ${entry.name.padEnd(width)} ${entry.summary}`);\n\t\t}\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"Global options:\");\n\tlines.push(...optionLines(GLOBAL_OPTIONS));\n\tlines.push(\"\");\n\tlines.push(\"Environment:\");\n\tlines.push(\" LINEJS_HOME Profile directory (default: ~/.linejs)\");\n\tlines.push(\" LINEJS_PROFILE Default profile name/path when --profile is omitted\");\n\tlines.push(\" NO_COLOR Disable ANSI colors\");\n\tlines.push(\"\");\n\tlines.push(\"Run `line help <command>` for details.\");\n\treturn lines.join(\"\\n\");\n}\n\nexport function groupHelp(group: string, commands: readonly CommandSpec[]): string {\n\tconst entries = commands.filter(\n\t\t(command) => command.name === group || command.name.startsWith(`${group} `),\n\t);\n\tconst lines = [`Usage: line ${group} <command> [options]`, \"\", `${group} commands:`];\n\tconst width = Math.max(...entries.map((entry) => entry.name.length));\n\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\tlines.push(` ${entry.name.padEnd(width)} ${entry.summary}`);\n\t}\n\tlines.push(\"\");\n\tlines.push(\"Global options:\");\n\tlines.push(...optionLines(GLOBAL_OPTIONS));\n\tlines.push(\"\");\n\tlines.push(`Run \\`line help ${group} <command>\\` for details.`);\n\treturn lines.join(\"\\n\");\n}\n\nexport function commandHelp(command: CommandSpec): string {\n\tconst lines = [commandUsage(command), \"\", command.summary];\n\tif (command.description) {\n\t\tlines.push(\"\", command.description);\n\t}\n\tif (command.args?.length) {\n\t\tlines.push(\"\", \"Arguments:\");\n\t\tconst width = Math.max(...command.args.map((arg) => arg.name.length));\n\t\tfor (const arg of command.args) {\n\t\t\tlines.push(\n\t\t\t\t` ${arg.name.padEnd(width)} ${arg.description}${arg.required ? \"\" : \" (optional)\"}${arg.variadic ? \" (multiple)\" : \"\"}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst options = [...(command.options ?? []), ...GLOBAL_OPTIONS];\n\tif (options.length) {\n\t\tlines.push(\"\", \"Options:\");\n\t\tlines.push(...optionLines(options));\n\t}\n\tif (command.examples?.length) {\n\t\tlines.push(\"\", \"Examples:\");\n\t\tfor (const example of command.examples) lines.push(` ${example}`);\n\t}\n\tlines.push(\n\t\t\"\",\n\t\tcommand.auth\n\t\t\t? \"Authentication: requires a logged-in profile.\"\n\t\t\t: \"Authentication: not required.\",\n\t);\n\tif (command.mcp === false || command.longRunning) {\n\t\tlines.push(\"MCP: not executable through execute_linejs_cli (long-running).\");\n\t} else {\n\t\tlines.push(\"MCP: executable through execute_linejs_cli.\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport function commandsMetadata(commands: readonly CommandSpec[] = allCommands): unknown[] {\n\treturn commands.map((command) => commandMetadata(command));\n}\n","import {\n\tGLOBAL_OPTIONS,\n\ttype OptionSpec,\n\tparseOptions,\n\tsplitLeadingGlobalOptions,\n} from \"./args.ts\";\nimport type { CommandSpec } from \"./command.ts\";\nimport { CommandContext, type CliSettings } from \"./context.ts\";\nimport { CliError, UsageError, errorMessage, toErrorPayload } from \"./errors.ts\";\nimport { commandHelp, commandsMetadata, groupHelp, rootHelp } from \"./help.ts\";\nimport { Output } from \"./output.ts\";\nimport { resolveProfileLocation } from \"./paths.ts\";\nimport { allCommands, resolveCommandTokens } from \"./registry.ts\";\nimport { VERSION } from \"./version.ts\";\n\nexport interface RunCliOptions {\n\tstdout?: (chunk: string) => void;\n\tstderr?: (chunk: string) => void;\n\tenv?: NodeJS.ProcessEnv;\n\tcwd?: string;\n\tinteractive?: boolean;\n\tcolor?: boolean;\n\tmcp?: boolean;\n\tsignal?: AbortSignal;\n\thandleSignals?: boolean;\n}\n\nexport interface RunCliResult {\n\texitCode: number;\n}\n\nconst COMMANDS_OPTIONS: OptionSpec[] = [\n\t...GLOBAL_OPTIONS,\n\t{\n\t\tname: \"category\",\n\t\ttype: \"string\",\n\t\tvalueName: \"category\",\n\t\tdescription: \"Filter by category or command name.\",\n\t},\n];\n\nfunction detectJson(argv: readonly string[]): boolean {\n\tfor (const token of argv) {\n\t\tif (token === \"--json\") return true;\n\t\tif (token === \"--json=true\" || token === \"--json=1\") return true;\n\t\tif (token === \"--json=false\" || token === \"--json=0\") return false;\n\t\tif (token === \"--\") break;\n\t}\n\treturn false;\n}\n\nfunction reportError(error: unknown, output: Output, json: boolean, verbose: boolean): void {\n\tconst payload = toErrorPayload(error);\n\tif (json) {\n\t\toutput.writeErrLine(JSON.stringify({ error: payload }));\n\t} else {\n\t\toutput.writeErrLine(`${output.style(\"red\", \"error:\")} ${payload.message}`);\n\t\tconst details = payload.details;\n\t\tif (details && typeof details === \"object\" && \"hint\" in details) {\n\t\t\toutput.writeErrLine(`${output.style(\"dim\", \"hint:\")} ${String(details.hint)}`);\n\t\t}\n\t\tif (error instanceof CliError && error.code === \"USAGE\") {\n\t\t\toutput.writeErrLine(output.dim(\"Run `line help` to list commands.\"));\n\t\t}\n\t\tif (verbose && error instanceof Error && error.stack) {\n\t\t\toutput.writeErrLine(error.stack);\n\t\t}\n\t}\n}\n\nfunction suggest(name: string): string[] {\n\tconst lower = name.toLowerCase();\n\tconst candidates = allCommands\n\t\t.map((command) => command.name)\n\t\t.filter(\n\t\t\t(command) => command.toLowerCase().includes(lower) || lower.includes(command.split(\" \")[0]!),\n\t\t);\n\treturn candidates.slice(0, 5);\n}\n\nfunction uniqueOptions(\n\tprimary: readonly OptionSpec[],\n\tsecondary: readonly OptionSpec[],\n): OptionSpec[] {\n\tconst seen = new Set<string>();\n\tconst output: OptionSpec[] = [];\n\tfor (const spec of [...primary, ...secondary]) {\n\t\tif (seen.has(spec.name)) continue;\n\t\tseen.add(spec.name);\n\t\toutput.push(spec);\n\t}\n\treturn output;\n}\n\nfunction commandTable(output: Output, commands: readonly CommandSpec[]): void {\n\toutput.table(\n\t\tcommands.map((command) => ({\n\t\t\tname: command.name,\n\t\t\tcategory: command.category,\n\t\t\tsummary: command.summary,\n\t\t})),\n\t\t[\n\t\t\t{ key: \"name\", label: \"COMMAND\", maxWidth: 34 },\n\t\t\t{ key: \"category\", label: \"CATEGORY\", maxWidth: 20 },\n\t\t\t{ key: \"summary\", label: \"SUMMARY\", maxWidth: 80 },\n\t\t],\n\t);\n}\n\nasync function runMetaCommand(\n\targv: readonly string[],\n\toutput: Output,\n\tjson: boolean,\n\toptions: { help: boolean; version: boolean },\n): Promise<RunCliResult> {\n\tif (options.version) {\n\t\toutput.writeLine(VERSION);\n\t\treturn { exitCode: 0 };\n\t}\n\tif (argv[0] === \"help\") {\n\t\tconst helpArgs = argv.slice(1);\n\t\tconst { leading, rest } = splitLeadingGlobalOptions(helpArgs);\n\t\tconst parsed = parseOptions(leading, GLOBAL_OPTIONS);\n\t\tconst helpJson = Boolean(parsed.options.json) || json;\n\t\tconst target = resolveCommandTokens(rest);\n\t\tif (target.unknown) {\n\t\t\tthrow new UsageError(`Unknown command: ${target.unknown}`, {\n\t\t\t\thint: suggest(target.unknown).join(\", \"),\n\t\t\t});\n\t\t}\n\t\tif (target.command) {\n\t\t\tif (helpJson) {\n\t\t\t\toutput.writeLine(JSON.stringify(commandsMetadata([target.command])[0], null, 2));\n\t\t\t} else {\n\t\t\t\toutput.writeLine(commandHelp(target.command));\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (target.group) {\n\t\t\tif (helpJson) {\n\t\t\t\tconst entries = target.groupCommands ?? [];\n\t\t\t\toutput.writeLine(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgroup: target.group,\n\t\t\t\t\t\t\tcommands: commandsMetadata(entries),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t2,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toutput.writeLine(groupHelp(target.group, target.groupCommands ?? []));\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (helpJson) {\n\t\t\toutput.writeLine(JSON.stringify({ version: VERSION, commands: commandsMetadata() }, null, 2));\n\t\t} else {\n\t\t\toutput.writeLine(rootHelp());\n\t\t}\n\t\treturn { exitCode: 0 };\n\t}\n\n\tif (argv[0] === \"commands\") {\n\t\tconst parsed = parseOptions(argv.slice(1), COMMANDS_OPTIONS);\n\t\tconst effectiveJson = Boolean(parsed.options.json) || json;\n\t\tconst filter = String(parsed.options.category ?? \"\")\n\t\t\t.trim()\n\t\t\t.toLowerCase();\n\t\tconst commands = allCommands.filter((command) => {\n\t\t\tif (!filter) return true;\n\t\t\treturn (\n\t\t\t\tcommand.category.toLowerCase().includes(filter) ||\n\t\t\t\tcommand.name.toLowerCase().includes(filter)\n\t\t\t);\n\t\t});\n\t\tif (effectiveJson) {\n\t\t\toutput.writeLine(\n\t\t\t\tJSON.stringify(\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandCount: commands.length,\n\t\t\t\t\t\tcommands: commandsMetadata(commands),\n\t\t\t\t\t},\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tcommandTable(output, commands);\n\t\t}\n\t\treturn { exitCode: 0 };\n\t}\n\n\tif (json) {\n\t\toutput.writeLine(JSON.stringify({ version: VERSION, commands: commandsMetadata() }, null, 2));\n\t} else {\n\t\toutput.writeLine(rootHelp());\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runCli(\n\targv: readonly string[],\n\toptions: RunCliOptions = {},\n): Promise<RunCliResult> {\n\tconst env = options.env ?? process.env;\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst stdout = options.stdout ?? ((chunk: string) => process.stdout.write(chunk));\n\tconst stderr = options.stderr ?? ((chunk: string) => process.stderr.write(chunk));\n\tconst jsonHint = detectJson(argv);\n\tconst color =\n\t\toptions.color ??\n\t\t(!options.stdout && Boolean(process.stdout.isTTY) && !env.NO_COLOR && env.TERM !== \"dumb\");\n\n\tlet output = new Output({ stdout, stderr }, { json: jsonHint, color });\n\tlet json = jsonHint;\n\tlet verbose = argv.includes(\"--verbose\") || argv.includes(\"-v\");\n\n\ttry {\n\t\tconst { leading, rest } = splitLeadingGlobalOptions(argv);\n\t\tconst leadingParsed = parseOptions(leading, GLOBAL_OPTIONS);\n\t\tverbose = Boolean(leadingParsed.options.verbose);\n\t\tif (leadingParsed.options.version) {\n\t\t\toutput.writeLine(VERSION);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (!rest.length) {\n\t\t\treturn await runMetaCommand([], output, Boolean(leadingParsed.options.json), {\n\t\t\t\thelp: true,\n\t\t\t\tversion: false,\n\t\t\t});\n\t\t}\n\t\tif (rest[0] === \"help\" || rest[0] === \"commands\") {\n\t\t\tconst result = await runMetaCommand(rest, output, Boolean(leadingParsed.options.json), {\n\t\t\t\thelp: rest[0] === \"help\",\n\t\t\t\tversion: false,\n\t\t\t});\n\t\t\treturn result;\n\t\t}\n\n\t\tconst resolution = resolveCommandTokens(rest);\n\t\tif (resolution.unknown) {\n\t\t\tconst suggestions = suggest(resolution.unknown);\n\t\t\tthrow new UsageError(\n\t\t\t\t`Unknown command: ${resolution.unknown}`,\n\t\t\t\tsuggestions.length ? { hint: `Did you mean: ${suggestions.join(\", \")}?` } : undefined,\n\t\t\t);\n\t\t}\n\t\tif (!resolution.command) {\n\t\t\tconst nonOption = resolution.remaining.find((token) => !token.startsWith(\"-\"));\n\t\t\tif (nonOption && resolution.group) {\n\t\t\t\tthrow new UsageError(`Unknown ${resolution.group} subcommand: ${nonOption}`, {\n\t\t\t\t\thint: `Run \\`line help ${resolution.group}\\` for the available subcommands.`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst entries = resolution.groupCommands ?? allCommands;\n\t\t\tlet groupJson = Boolean(leadingParsed.options.json);\n\t\t\ttry {\n\t\t\t\tgroupJson =\n\t\t\t\t\tgroupJson || Boolean(parseOptions(resolution.remaining, GLOBAL_OPTIONS).options.json);\n\t\t\t} catch {\n\t\t\t\t// Unknown options are reported after a real command is selected.\n\t\t\t}\n\t\t\tif (groupJson) {\n\t\t\t\toutput.writeLine(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgroup: resolution.group ?? null,\n\t\t\t\t\t\t\tcommands: commandsMetadata(entries),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t2,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toutput.writeLine(\n\t\t\t\t\tresolution.group ? groupHelp(resolution.group, entries) : rootHelp(entries),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tconst command = resolution.command;\n\t\tconst specs = uniqueOptions(command.options ?? [], GLOBAL_OPTIONS);\n\t\tconst parsed = parseOptions([...leading, ...resolution.remaining], specs);\n\t\tjson = Boolean(parsed.options.json);\n\t\tverbose = Boolean(parsed.options.verbose);\n\t\toutput = new Output({ stdout, stderr }, { json, color });\n\n\t\tif (parsed.options.version) {\n\t\t\toutput.writeLine(VERSION);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (parsed.options.help) {\n\t\t\toutput.writeLine(\n\t\t\t\tjson ? JSON.stringify(commandsMetadata([command])[0], null, 2) : commandHelp(command),\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tlet profile;\n\t\ttry {\n\t\t\tprofile = resolveProfileLocation(\n\t\t\t\ttypeof parsed.options.profile === \"string\" ? parsed.options.profile : undefined,\n\t\t\t\tenv,\n\t\t\t\tcwd,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow new UsageError(errorMessage(error));\n\t\t}\n\n\t\tconst timeout = typeof parsed.options.timeout === \"number\" ? parsed.options.timeout : undefined;\n\t\tif (timeout !== undefined && timeout <= 0) throw new UsageError(\"--timeout must be positive\");\n\n\t\tconst interactive =\n\t\t\toptions.interactive ??\n\t\t\t(Boolean(process.stdin.isTTY) &&\n\t\t\t\tBoolean(process.stdout.isTTY) &&\n\t\t\t\t!env.LINEJS_NONINTERACTIVE &&\n\t\t\t\t!options.mcp);\n\n\t\tconst controller = new AbortController();\n\t\tconst linkAbort = () => controller.abort();\n\t\tif (options.signal) {\n\t\t\tif (options.signal.aborted) controller.abort();\n\t\t\telse options.signal.addEventListener(\"abort\", linkAbort, { once: true });\n\t\t}\n\n\t\tconst handleSignals = options.handleSignals ?? !options.mcp;\n\t\tlet interrupts = 0;\n\t\tconst onSigint = () => {\n\t\t\tinterrupts += 1;\n\t\t\tif (interrupts === 1) {\n\t\t\t\toutput.writeErrLine(output.dim(\"Interrupting (press Ctrl+C again to force).\"));\n\t\t\t\tcontroller.abort();\n\t\t\t} else {\n\t\t\t\tprocess.exit(130);\n\t\t\t}\n\t\t};\n\t\tif (handleSignals) process.on(\"SIGINT\", onSigint);\n\n\t\tconst checkSession =\n\t\t\tBoolean(parsed.options[\"check-session\"]) || command.name.startsWith(\"auth \");\n\t\tconst settings: CliSettings = {\n\t\t\tprofile,\n\t\t\tdevice: typeof parsed.options.device === \"string\" ? parsed.options.device : undefined,\n\t\t\tappVersion:\n\t\t\t\ttypeof parsed.options[\"app-version\"] === \"string\"\n\t\t\t\t\t? parsed.options[\"app-version\"]\n\t\t\t\t\t: undefined,\n\t\t\tendpoint: typeof parsed.options.endpoint === \"string\" ? parsed.options.endpoint : undefined,\n\t\t\ttimeout,\n\t\t\tverbose,\n\t\t\tjson,\n\t\t\tinteractive,\n\t\t\tmcp: Boolean(options.mcp),\n\t\t\tcheckSession,\n\t\t\tenv,\n\t\t\tcwd,\n\t\t\tsignal: controller.signal,\n\t\t};\n\t\tconst context = new CommandContext({\n\t\t\toptions: parsed.options,\n\t\t\tpositionals: parsed.positionals,\n\t\t\toutput,\n\t\t\tsettings,\n\t\t});\n\n\t\ttry {\n\t\t\tconst result = await command.run(context);\n\t\t\tif (!command.silent) {\n\t\t\t\tconst value = result === undefined ? { ok: true } : result;\n\t\t\t\toutput.result(\n\t\t\t\t\tvalue,\n\t\t\t\t\tcommand.format ? (input) => command.format!(input, context) : undefined,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t} finally {\n\t\t\tif (handleSignals) process.off(\"SIGINT\", onSigint);\n\t\t\toptions.signal?.removeEventListener(\"abort\", linkAbort);\n\t\t}\n\t} catch (error) {\n\t\treportError(error, output, json, verbose);\n\t\treturn { exitCode: error instanceof CliError ? error.exitCode : 1 };\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAwBA,MAAa,iBAAwC;CACpD;EACC,MAAM;EACN,MAAM;EACN,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,aACC;CACF;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aACC;CACF;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aACC;CACF;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aAAa;CACd;CACA;EACC,MAAM;EACN,OAAO;EACP,MAAM;EACN,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,aAAa;CACd;CACA;EACC,MAAM;EACN,OAAO;EACP,MAAM;EACN,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,aAAa;CACd;AACD;AAEA,SAAS,aAAa,OAAuD;CAC5E,MAA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,MAAM,QAAQ,WAAW,KAAA,IAAY,EAAE,IAAI,KAAK,IAAI;IACpD,OAAO,OACN,OACA,QAAQ,UAAU,UAAU,QAAQ,OAAQ,OAAO,OAAO,IAAI,KAAA,CAC/D;GACD;GACA,OAAO,EAAE,UAAU,EAAE;EACtB,UAAU;GACT,IAAI,eAAe,QAAQ,IAAI,UAAU,QAAQ;GACjD,QAAQ,QAAQ,oBAAoB,SAAS,SAAS;EACvD;CACD,SAAS,OAAO;EACf,YAAY,OAAO,QAAQ,MAAM,OAAO;EACxC,OAAO,EAAE,UAAU,iBAAiB,WAAW,MAAM,WAAW,EAAE;CACnE;AACD"}
1
+ {"version":3,"file":"cli-B-byNdKi.mjs","names":["callCommand","result","statusCommand","tokenCommand","createCommand","updateCommand","joinCommand","inviteCommand","kickCommand","listCommand","getCommand","createCommand","leaveCommand","renameCommand","listCommand","getCommand","searchCommand","renameCommand","tokenCommand","shareCommand","reactCommand","message","extensionForMime","uploadCommand","downloadCommand","getCommand","updateCommand","listCommand","getCommand","listCommand","getCommand","result","deleteCommand","pkg.version"],"sources":["../src/args.ts","../src/context.ts","../src/command.ts","../src/files.ts","../src/output.ts","../src/qr.ts","../src/profile-storage.ts","../src/paths.ts","../src/profile-store.ts","../src/session.ts","../src/commands/shared.ts","../src/commands/api.ts","../src/commands/auth.ts","../src/commands/birthday.ts","../src/commands/call.ts","../src/commands/chats.ts","../src/commands/contacts.ts","../src/commands/liff.ts","../src/commands/listen.ts","../src/commands/messages.ts","../src/commands/media.ts","../src/commands/moa.ts","../src/commands/mcp.ts","../src/commands/profile.ts","../src/commands/square.ts","../src/commands/storage.ts","../src/commands/timeline.ts","../src/commands/voom.ts","../src/registry.ts","../package.json","../src/version.ts","../src/help.ts","../src/cli.ts"],"sourcesContent":["import { UsageError } from \"./errors.ts\";\n\nexport type OptionType = \"boolean\" | \"string\" | \"number\" | \"array\";\n\nexport interface OptionSpec {\n\tname: string;\n\tshort?: string;\n\ttype: OptionType;\n\tdescription: string;\n\tvalueName?: string;\n\tchoices?: readonly string[];\n\tdefault?: string | number | boolean;\n\thidden?: boolean;\n}\n\nexport type OptionValue = string | number | boolean | string[];\nexport type ParsedOptions = Record<string, OptionValue>;\n\nexport interface ParsedArguments {\n\toptions: ParsedOptions;\n\tpositionals: string[];\n}\n\n/** Options accepted before and after every command. */\nexport const GLOBAL_OPTIONS: readonly OptionSpec[] = [\n\t{\n\t\tname: \"json\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Print the command result as JSON (machine readable).\",\n\t},\n\t{\n\t\tname: \"check-session\",\n\t\ttype: \"boolean\",\n\t\tdescription:\n\t\t\t\"Verify the saved auth token with getProfile() before running. Auth commands always check; other commands use the cached profile unless this flag is set.\",\n\t},\n\t{\n\t\tname: \"profile\",\n\t\ttype: \"string\",\n\t\tvalueName: \"name|path\",\n\t\tdescription:\n\t\t\t\"Profile name under ~/.linejs, or a path to a profile JSON file. Defaults to default.\",\n\t},\n\t{\n\t\tname: \"device\",\n\t\ttype: \"string\",\n\t\tvalueName: \"device\",\n\t\tdescription:\n\t\t\t\"Override the emulated device (DESKTOPWIN, DESKTOPMAC, ANDROID, ANDROIDSECONDARY, IOS, IOSIPAD, WATCHOS, WEAROS).\",\n\t},\n\t{\n\t\tname: \"app-version\",\n\t\ttype: \"string\",\n\t\tvalueName: \"version\",\n\t\tdescription: \"Override the emulated LINE app version.\",\n\t},\n\t{\n\t\tname: \"endpoint\",\n\t\ttype: \"string\",\n\t\tvalueName: \"host\",\n\t\tdescription: \"Override the LEGY endpoint (advanced).\",\n\t},\n\t{\n\t\tname: \"timeout\",\n\t\ttype: \"number\",\n\t\tvalueName: \"ms\",\n\t\tdescription: \"Request timeout in milliseconds (default: 30000).\",\n\t},\n\t{\n\t\tname: \"verbose\",\n\t\tshort: \"v\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Write LINEJS request logs to stderr.\",\n\t},\n\t{\n\t\tname: \"color\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Colorize human output. Use --no-color to disable.\",\n\t},\n\t{\n\t\tname: \"help\",\n\t\tshort: \"h\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Show help for the command.\",\n\t},\n\t{\n\t\tname: \"version\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Print the CLI version.\",\n\t},\n];\n\nfunction buildLongMap(specs: readonly OptionSpec[]): Map<string, OptionSpec> {\n\tconst map = new Map<string, OptionSpec>();\n\tfor (const spec of specs) map.set(spec.name, spec);\n\treturn map;\n}\n\nfunction buildShortMap(specs: readonly OptionSpec[]): Map<string, OptionSpec> {\n\tconst map = new Map<string, OptionSpec>();\n\tfor (const spec of specs) {\n\t\tif (spec.short) map.set(spec.short, spec);\n\t}\n\treturn map;\n}\n\nfunction isNegativeNumber(value: string): boolean {\n\treturn /^-?\\d+(?:\\.\\d+)?$/.test(value);\n}\n\n/** True for `--foo`, `--no-foo`, and `-x`, but not for `-` or negative numbers. */\nexport function isOptionToken(token: string): boolean {\n\treturn token.length > 1 && token.startsWith(\"-\") && !isNegativeNumber(token);\n}\n\nfunction splitLongToken(token: string): { name: string; value?: string; negated: boolean } {\n\tlet body = token.slice(2);\n\tlet value: string | undefined;\n\tconst equals = body.indexOf(\"=\");\n\tif (equals !== -1) {\n\t\tvalue = body.slice(equals + 1);\n\t\tbody = body.slice(0, equals);\n\t}\n\tif (body.startsWith(\"no-\")) {\n\t\treturn { name: body.slice(3), value, negated: true };\n\t}\n\treturn { name: body, value, negated: false };\n}\n\nfunction parseBoolean(value: string, flag: string): boolean {\n\tswitch (value.toLowerCase()) {\n\t\tcase \"1\":\n\t\tcase \"true\":\n\t\tcase \"yes\":\n\t\tcase \"on\":\n\t\t\treturn true;\n\t\tcase \"0\":\n\t\tcase \"false\":\n\t\tcase \"no\":\n\t\tcase \"off\":\n\t\t\treturn false;\n\t\tdefault:\n\t\t\tthrow new UsageError(`Invalid boolean for ${flag}: ${value}`);\n\t}\n}\n\nfunction convertValue(spec: OptionSpec, raw: string): string | number {\n\tif (spec.choices && !spec.choices.includes(raw)) {\n\t\tthrow new UsageError(\n\t\t\t`Invalid value for --${spec.name}: ${raw} (expected ${spec.choices.join(\", \")})`,\n\t\t);\n\t}\n\tif (spec.type === \"number\") {\n\t\tconst value = Number(raw);\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow new UsageError(`Invalid number for --${spec.name}: ${raw}`);\n\t\t}\n\t\treturn value;\n\t}\n\treturn raw;\n}\n\nfunction setOption(options: ParsedOptions, spec: OptionSpec, value: OptionValue): void {\n\tif (spec.type === \"array\") {\n\t\tconst current = options[spec.name];\n\t\tconst list = Array.isArray(current) ? current : [];\n\t\tconst additions = Array.isArray(value) ? value : [String(value)];\n\t\toptions[spec.name] = [...list, ...additions];\n\t\treturn;\n\t}\n\toptions[spec.name] = value;\n}\n\n/**\n * Parse command arguments. Values beginning with `-` are accepted as option\n * values (use `--opt=value` when the value itself looks like an option).\n */\nexport function parseOptions(\n\ttokens: readonly string[],\n\tspecs: readonly OptionSpec[],\n): ParsedArguments {\n\tconst longMap = buildLongMap(specs);\n\tconst shortMap = buildShortMap(specs);\n\tconst options: ParsedOptions = {};\n\tconst positionals: string[] = [];\n\n\tfor (let index = 0; index < tokens.length; index += 1) {\n\t\tconst token = tokens[index]!;\n\t\tif (token === \"--\") {\n\t\t\tpositionals.push(...tokens.slice(index + 1));\n\t\t\tbreak;\n\t\t}\n\t\tif (!isOptionToken(token)) {\n\t\t\tpositionals.push(token);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (token.startsWith(\"--\")) {\n\t\t\tconst { name, value, negated } = splitLongToken(token);\n\t\t\tconst spec = longMap.get(name);\n\t\t\tif (!spec) {\n\t\t\t\tthrow new UsageError(`Unknown option: --${name}`);\n\t\t\t}\n\t\t\tif (spec.type === \"boolean\") {\n\t\t\t\tif (negated) {\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\tthrow new UsageError(`--no-${spec.name} does not accept a value`);\n\t\t\t\t\t}\n\t\t\t\t\tsetOption(options, spec, false);\n\t\t\t\t} else if (value === undefined) {\n\t\t\t\t\tsetOption(options, spec, true);\n\t\t\t\t} else {\n\t\t\t\t\tsetOption(options, spec, parseBoolean(value, `--${spec.name}`));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (negated) {\n\t\t\t\tthrow new UsageError(`--no-${spec.name} is only valid for boolean options`);\n\t\t\t}\n\t\t\tlet raw = value;\n\t\t\tif (raw === undefined) {\n\t\t\t\traw = tokens[index + 1];\n\t\t\t\tif (raw === undefined) {\n\t\t\t\t\tthrow new UsageError(`Missing value for --${spec.name}`);\n\t\t\t\t}\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tif (spec.type === \"array\") {\n\t\t\t\tsetOption(\n\t\t\t\t\toptions,\n\t\t\t\t\tspec,\n\t\t\t\t\traw\n\t\t\t\t\t\t.split(\",\")\n\t\t\t\t\t\t.map((entry) => entry.trim())\n\t\t\t\t\t\t.filter(Boolean),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsetOption(options, spec, convertValue(spec, raw));\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst shortBody = token.slice(1);\n\t\tconst shortName = shortBody[0]!;\n\t\tconst spec = shortMap.get(shortName);\n\t\tif (!spec) {\n\t\t\tthrow new UsageError(`Unknown option: -${shortName}`);\n\t\t}\n\t\tif (spec.type === \"boolean\") {\n\t\t\tif (shortBody.length > 1) {\n\t\t\t\tthrow new UsageError(`Combined short options are not supported: ${token}`);\n\t\t\t}\n\t\t\tsetOption(options, spec, true);\n\t\t\tcontinue;\n\t\t}\n\t\tlet raw = shortBody.slice(1);\n\t\tif (raw.startsWith(\"=\")) raw = raw.slice(1);\n\t\tif (!raw) {\n\t\t\traw = tokens[index + 1];\n\t\t\tif (raw === undefined) {\n\t\t\t\tthrow new UsageError(`Missing value for -${shortName}`);\n\t\t\t}\n\t\t\tindex += 1;\n\t\t}\n\t\tif (spec.type === \"array\") {\n\t\t\tsetOption(\n\t\t\t\toptions,\n\t\t\t\tspec,\n\t\t\t\traw\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.map((entry) => entry.trim())\n\t\t\t\t\t.filter(Boolean),\n\t\t\t);\n\t\t} else {\n\t\t\tsetOption(options, spec, convertValue(spec, raw));\n\t\t}\n\t}\n\n\treturn { options, positionals };\n}\n\n/**\n * Remove global options that appear before the command path so the path can be\n * resolved. The tokens are re-parsed with the command's full option set later.\n */\nexport function splitLeadingGlobalOptions(tokens: readonly string[]): {\n\tleading: string[];\n\trest: string[];\n} {\n\tconst specs = [...GLOBAL_OPTIONS];\n\tlet index = 0;\n\twhile (index < tokens.length) {\n\t\tconst token = tokens[index]!;\n\t\tif (token === \"--\" || !isOptionToken(token)) break;\n\t\tconst { next } = consumeOptionToken(tokens, index, specs);\n\t\tindex = next;\n\t}\n\treturn { leading: tokens.slice(0, index), rest: tokens.slice(index) };\n}\n\nfunction consumeOptionToken(\n\ttokens: readonly string[],\n\tindex: number,\n\tspecs: readonly OptionSpec[],\n): { leading: string[]; next: number } {\n\tconst longMap = buildLongMap(specs);\n\tconst shortMap = buildShortMap(specs);\n\tconst token = tokens[index]!;\n\tif (token.startsWith(\"--\")) {\n\t\tconst { name, value, negated } = splitLongToken(token);\n\t\tconst spec = longMap.get(name);\n\t\tif (!spec) throw new UsageError(`Unknown option: --${name}`);\n\t\tif (spec.type === \"boolean\" || value !== undefined) {\n\t\t\treturn { leading: [token], next: index + 1 };\n\t\t}\n\t\tif (negated) return { leading: [token], next: index + 1 };\n\t\tif (tokens[index + 1] === undefined) {\n\t\t\tthrow new UsageError(`Missing value for --${spec.name}`);\n\t\t}\n\t\treturn { leading: [token, tokens[index + 1]!], next: index + 2 };\n\t}\n\tconst shortName = token[1]!;\n\tconst spec = shortMap.get(shortName);\n\tif (!spec) throw new UsageError(`Unknown option: -${shortName}`);\n\tif (spec.type === \"boolean\") return { leading: [token], next: index + 1 };\n\tif (token.length > 2) return { leading: [token], next: index + 1 };\n\tif (tokens[index + 1] === undefined) {\n\t\tthrow new UsageError(`Missing value for -${shortName}`);\n\t}\n\treturn { leading: [token, tokens[index + 1]!], next: index + 2 };\n}\n","import type { ParsedOptions } from \"./args.ts\";\nimport { CliError, UsageError } from \"./errors.ts\";\nimport type { Output } from \"./output.ts\";\nimport type { ProfileLocation } from \"./paths.ts\";\n\nexport interface CliSettings {\n\tprofile: ProfileLocation;\n\tdevice?: string;\n\tappVersion?: string;\n\tendpoint?: string;\n\ttimeout?: number;\n\tverbose: boolean;\n\tjson: boolean;\n\tinteractive: boolean;\n\tmcp: boolean;\n\tcheckSession: boolean;\n\tenv: NodeJS.ProcessEnv;\n\tcwd: string;\n\tsignal: AbortSignal;\n}\n\nexport class CommandContext {\n\treadonly options: ParsedOptions;\n\treadonly positionals: readonly string[];\n\treadonly output: Output;\n\treadonly settings: CliSettings;\n\n\tconstructor(init: {\n\t\toptions: ParsedOptions;\n\t\tpositionals: readonly string[];\n\t\toutput: Output;\n\t\tsettings: CliSettings;\n\t}) {\n\t\tthis.options = init.options;\n\t\tthis.positionals = init.positionals;\n\t\tthis.output = init.output;\n\t\tthis.settings = init.settings;\n\t}\n\n\tget json(): boolean {\n\t\treturn this.settings.json;\n\t}\n\n\tget interactive(): boolean {\n\t\treturn this.settings.interactive;\n\t}\n\n\tget signal(): AbortSignal {\n\t\treturn this.settings.signal;\n\t}\n\n\thas(name: string): boolean {\n\t\treturn this.options[name] !== undefined;\n\t}\n\n\tgetString(name: string): string | undefined {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return undefined;\n\t\tif (typeof value !== \"string\") return String(value);\n\t\treturn value;\n\t}\n\n\trequireString(name: string, message = `Missing required option --${name}`): string {\n\t\tconst value = this.getString(name);\n\t\tif (value === undefined || value === \"\") throw new UsageError(message);\n\t\treturn value;\n\t}\n\n\tgetNumber(name: string): number | undefined {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return undefined;\n\t\tconst number = typeof value === \"number\" ? value : Number(value);\n\t\tif (!Number.isFinite(number)) throw new UsageError(`Invalid number for --${name}`);\n\t\treturn number;\n\t}\n\n\tgetBool(name: string, defaultValue = false): boolean {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return defaultValue;\n\t\tif (typeof value === \"boolean\") return value;\n\t\tif (typeof value === \"string\") return value === \"true\" || value === \"1\";\n\t\treturn Boolean(value);\n\t}\n\n\tgetArray(name: string): string[] {\n\t\tconst value = this.options[name];\n\t\tif (value === undefined) return [];\n\t\tconst list = Array.isArray(value) ? value : [String(value)];\n\t\treturn list\n\t\t\t.flatMap((entry) => entry.split(\",\"))\n\t\t\t.map((entry) => entry.trim())\n\t\t\t.filter(Boolean);\n\t}\n\n\tgetJson<T = unknown>(name: string): T | undefined {\n\t\tconst value = this.getString(name);\n\t\tif (value === undefined) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(value) as T;\n\t\t} catch (error) {\n\t\t\tthrow new UsageError(`--${name} is not valid JSON`, {\n\t\t\t\tcause: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\n\targ(index: number): string | undefined {\n\t\treturn this.positionals[index];\n\t}\n\n\trequireArg(index: number, name: string): string {\n\t\tconst value = this.positionals[index];\n\t\tif (value === undefined || value === \"\") {\n\t\t\tthrow new UsageError(`Missing required argument <${name}>`);\n\t\t}\n\t\treturn value;\n\t}\n\n\trest(index: number): string {\n\t\treturn this.positionals.slice(index).join(\" \");\n\t}\n\n\trequireRest(index: number, name: string): string {\n\t\tconst value = this.rest(index);\n\t\tif (!value) throw new UsageError(`Missing required argument <${name}>`);\n\t\treturn value;\n\t}\n}\n\nexport function requireConfirmation(context: CommandContext, message: string, yes: boolean): void {\n\tif (yes) return;\n\tif (!context.interactive) {\n\t\tthrow new CliError(\"CONFIRMATION_REQUIRED\", `${message} (pass --yes to confirm)`, {\n\t\t\tdetails: { hint: \"This command is destructive; re-run with --yes.\" },\n\t\t});\n\t}\n}\n","import type { OptionSpec } from \"./args.ts\";\nimport type { CommandContext } from \"./context.ts\";\n\nexport interface CommandArgument {\n\tname: string;\n\tdescription: string;\n\trequired?: boolean;\n\tvariadic?: boolean;\n}\n\nexport interface CommandSpec {\n\t/** Space-separated command path, e.g. \"auth login\". */\n\tname: string;\n\tsummary: string;\n\tdescription?: string;\n\tcategory: string;\n\targs?: readonly CommandArgument[];\n\toptions?: readonly OptionSpec[];\n\t/** Requires an existing profile with an auth token. */\n\tauth?: boolean;\n\t/** The command blocks forever (listen, mcp). */\n\tlongRunning?: boolean;\n\t/** Defaults to true. Set false to reject the command from MCP. */\n\tmcp?: boolean;\n\t/** Do not print the command result (streaming/protocol commands). */\n\tsilent?: boolean;\n\texamples?: readonly string[];\n\trun(context: CommandContext): Promise<unknown>;\n\t/** Human-readable formatter. Defaults to pretty JSON. */\n\tformat?(value: unknown, context: CommandContext): string;\n}\n\nexport function commandUsage(command: CommandSpec): string {\n\tconst args = (command.args ?? [])\n\t\t.map((arg) =>\n\t\t\targ.variadic\n\t\t\t\t? `${arg.required ? \"\" : \"[\"}${arg.name}...${arg.required ? \"\" : \"]\"}`\n\t\t\t\t: arg.required\n\t\t\t\t\t? `<${arg.name}>`\n\t\t\t\t\t: `[${arg.name}]`,\n\t\t)\n\t\t.join(\" \");\n\tconst options = command.options?.length ? \" [options]\" : \"\";\n\treturn `line ${command.name}${args ? ` ${args}` : \"\"}${options}`;\n}\n\nexport function commandOptions(command: CommandSpec): readonly OptionSpec[] {\n\treturn command.options ?? [];\n}\n\nexport function isMcpExecutable(command: CommandSpec): boolean {\n\treturn command.mcp !== false && !command.longRunning;\n}\n\nexport interface CommandMetadata {\n\tname: string;\n\tsummary: string;\n\tdescription?: string;\n\tcategory: string;\n\tusage: string;\n\targs: readonly CommandArgument[];\n\toptions: readonly OptionSpec[];\n\tauth: boolean;\n\tlongRunning: boolean;\n\tmcpExecutable: boolean;\n\tsilent: boolean;\n\texamples: readonly string[];\n}\n\nexport function commandMetadata(command: CommandSpec, includeOptions = true): CommandMetadata {\n\treturn {\n\t\tname: command.name,\n\t\tsummary: command.summary,\n\t\t...(command.description ? { description: command.description } : {}),\n\t\tcategory: command.category,\n\t\tusage: commandUsage(command),\n\t\targs: command.args ?? [],\n\t\toptions: includeOptions ? commandOptions(command) : [],\n\t\tauth: Boolean(command.auth),\n\t\tlongRunning: Boolean(command.longRunning),\n\t\tmcpExecutable: isMcpExecutable(command),\n\t\tsilent: Boolean(command.silent),\n\t\texamples: command.examples ?? [],\n\t};\n}\n\nexport function groupNames(commands: readonly CommandSpec[]): string[] {\n\tconst groups = new Set<string>();\n\tfor (const command of commands) {\n\t\tconst first = command.name.split(\" \")[0]!;\n\t\tif (command.name.includes(\" \")) groups.add(first);\n\t}\n\treturn [...groups];\n}\n\nexport function commandsInGroup(commands: readonly CommandSpec[], group: string): CommandSpec[] {\n\treturn commands.filter((command) => command.name.split(\" \")[0] === group);\n}\n","import { readFile, stat, writeFile } from \"node:fs/promises\";\nimport { extname, resolve } from \"node:path\";\nimport { CliError, UsageError } from \"./errors.ts\";\n\nconst MIME_BY_EXTENSION: Record<string, string> = {\n\t\".jpg\": \"image/jpeg\",\n\t\".jpeg\": \"image/jpeg\",\n\t\".png\": \"image/png\",\n\t\".gif\": \"image/gif\",\n\t\".webp\": \"image/webp\",\n\t\".heic\": \"image/heic\",\n\t\".mp4\": \"video/mp4\",\n\t\".mov\": \"video/quicktime\",\n\t\".m4v\": \"video/mp4\",\n\t\".webm\": \"video/webm\",\n\t\".mp3\": \"audio/mpeg\",\n\t\".m4a\": \"audio/mp4\",\n\t\".aac\": \"audio/aac\",\n\t\".wav\": \"audio/wav\",\n\t\".ogg\": \"audio/ogg\",\n\t\".pdf\": \"application/pdf\",\n\t\".txt\": \"text/plain\",\n\t\".json\": \"application/json\",\n\t\".zip\": \"application/zip\",\n};\n\nexport function mimeFromFilename(filename: string): string {\n\treturn MIME_BY_EXTENSION[extname(filename).toLowerCase()] ?? \"application/octet-stream\";\n}\n\nexport function resolveInputPath(path: string, cwd: string): string {\n\treturn path === \"-\" ? \"-\" : resolve(cwd, path);\n}\n\nexport async function readTextInput(\n\tpath: string | undefined,\n\tcwd: string,\n\tstdin: NodeJS.ReadableStream = process.stdin,\n): Promise<string> {\n\tif (path === undefined || path === \"-\") {\n\t\tlet text = \"\";\n\t\tfor await (const chunk of stdin) {\n\t\t\ttext += typeof chunk === \"string\" ? chunk : Buffer.from(chunk).toString(\"utf8\");\n\t\t}\n\t\treturn text;\n\t}\n\treturn await readFile(resolve(cwd, path), \"utf8\");\n}\n\nexport async function readFileAsBlob(\n\tpath: string,\n\tcwd: string,\n): Promise<{ blob: Blob; filename: string; path: string }> {\n\tconst resolved = resolve(cwd, path);\n\tlet info;\n\ttry {\n\t\tinfo = await stat(resolved);\n\t} catch (error) {\n\t\tthrow new CliError(\"NOT_FOUND\", `File not found: ${resolved}`, { cause: error });\n\t}\n\tif (!info.isFile()) throw new UsageError(`Not a file: ${resolved}`);\n\tconst data = await readFile(resolved);\n\tconst filename = resolved.split(/[\\\\/]/).at(-1) ?? \"file\";\n\treturn {\n\t\tblob: new Blob([data], { type: mimeFromFilename(filename) }),\n\t\tfilename,\n\t\tpath: resolved,\n\t};\n}\n\nexport async function writeBinaryFile(\n\tpath: string,\n\tdata: Blob | Uint8Array | ArrayBuffer,\n\tcwd: string,\n): Promise<{ path: string; size: number }> {\n\tconst resolved = resolve(cwd, path);\n\tconst bytes =\n\t\tdata instanceof Blob\n\t\t\t? new Uint8Array(await data.arrayBuffer())\n\t\t\t: data instanceof ArrayBuffer\n\t\t\t\t? new Uint8Array(data)\n\t\t\t\t: data;\n\tawait writeFile(resolved, bytes);\n\treturn { path: resolved, size: bytes.byteLength };\n}\n","import { inspect } from \"node:util\";\n\nexport interface SerializeOptions {\n\t/** Include stacks in Error objects. Defaults to false. */\n\tincludeStack?: boolean;\n}\n\n/**\n * Convert a LINEJS result into a JSON-safe value. LINE uses a mix of string\n * ids, 64-bit integers, Dates, and binary blobs, so plain JSON.stringify is not\n * enough for `--json`.\n */\nexport function serialize(value: unknown, options: SerializeOptions = {}): unknown {\n\tconst seen = new WeakSet<object>();\n\n\tconst walk = (input: unknown): unknown => {\n\t\tif (input === null || typeof input === \"string\" || typeof input === \"boolean\") {\n\t\t\treturn input;\n\t\t}\n\t\tif (typeof input === \"number\") {\n\t\t\treturn Number.isFinite(input) ? input : String(input);\n\t\t}\n\t\tif (typeof input === \"bigint\") {\n\t\t\treturn input.toString();\n\t\t}\n\t\tif (typeof input === \"undefined\") {\n\t\t\treturn undefined;\n\t\t}\n\t\tif (typeof input === \"function\") {\n\t\t\treturn `[Function ${input.name || \"anonymous\"}]`;\n\t\t}\n\t\tif (typeof input === \"symbol\") {\n\t\t\treturn input.toString();\n\t\t}\n\n\t\tif (input instanceof Date) return input.toISOString();\n\t\tif (input instanceof Error) {\n\t\t\treturn {\n\t\t\t\tname: input.name,\n\t\t\t\tmessage: input.message,\n\t\t\t\t...(input.cause === undefined ? {} : { cause: walk(input.cause) }),\n\t\t\t\t...(\"code\" in input && typeof input.code === \"string\" ? { code: input.code } : {}),\n\t\t\t\t...(\"details\" in input && input.details !== undefined\n\t\t\t\t\t? { details: walk(input.details) }\n\t\t\t\t\t: {}),\n\t\t\t\t...(options.includeStack && input.stack ? { stack: input.stack } : {}),\n\t\t\t};\n\t\t}\n\t\tif (typeof Blob !== \"undefined\" && input instanceof Blob) {\n\t\t\treturn {\n\t\t\t\ttype: input.type || \"application/octet-stream\",\n\t\t\t\tsize: input.size,\n\t\t\t\t...(typeof File !== \"undefined\" && input instanceof File ? { name: input.name } : {}),\n\t\t\t};\n\t\t}\n\t\tif (input instanceof ArrayBuffer) {\n\t\t\treturn { type: \"ArrayBuffer\", byteLength: input.byteLength };\n\t\t}\n\t\tif (ArrayBuffer.isView(input)) {\n\t\t\treturn {\n\t\t\t\ttype: input.constructor.name,\n\t\t\t\tbyteLength: input.byteLength,\n\t\t\t};\n\t\t}\n\n\t\tif (typeof input !== \"object\") return String(input);\n\t\tif (seen.has(input)) return \"[Circular]\";\n\t\tseen.add(input);\n\n\t\ttry {\n\t\t\tif (input instanceof Map) {\n\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t[...input.entries()].map(([key, value]) => [String(key), walk(value)]),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (input instanceof Set) {\n\t\t\t\treturn [...input].map(walk);\n\t\t\t}\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\treturn input.map(walk);\n\t\t\t}\n\t\t\tconst output: Record<string, unknown> = {};\n\t\t\tfor (const [key, value] of Object.entries(input as Record<string, unknown>)) {\n\t\t\t\tconst converted = walk(value);\n\t\t\t\tif (converted !== undefined) output[key] = converted;\n\t\t\t}\n\t\t\treturn output;\n\t\t} finally {\n\t\t\tseen.delete(input);\n\t\t}\n\t};\n\n\treturn walk(value);\n}\n\nexport function formatJson(value: unknown): string {\n\treturn JSON.stringify(serialize(value), null, 2);\n}\n\n/** Compact one-line rendering for tables and key/value output. */\nexport function humanValue(value: unknown): string {\n\tif (value === null) return \"null\";\n\tif (value === undefined) return \"\";\n\tif (typeof value === \"string\") return value;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"bigint\") return value.toString();\n\tif (value instanceof Date) return value.toISOString();\n\tif (Array.isArray(value)) return value.map(humanValue).join(\", \");\n\tif (typeof value === \"object\") return inspect(value, { depth: 2, breakLength: Infinity });\n\treturn String(value);\n}\n\nexport interface OutputStreams {\n\tstdout(chunk: string): void;\n\tstderr(chunk: string): void;\n}\n\nexport interface OutputOptions {\n\tjson: boolean;\n\tcolor?: boolean;\n}\n\nexport interface TableColumn {\n\tkey: string;\n\tlabel?: string;\n\tmaxWidth?: number;\n}\n\nexport class Output {\n\treadonly streams: OutputStreams;\n\treadonly json: boolean;\n\treadonly color: boolean;\n\n\tconstructor(streams: OutputStreams, options: OutputOptions) {\n\t\tthis.streams = streams;\n\t\tthis.json = options.json;\n\t\tthis.color = options.color ?? false;\n\t}\n\n\twrite(text: string): void {\n\t\tthis.streams.stdout(text);\n\t}\n\n\twriteLine(text = \"\"): void {\n\t\tthis.streams.stdout(`${text}\\n`);\n\t}\n\n\twriteErr(text: string): void {\n\t\tthis.streams.stderr(text);\n\t}\n\n\twriteErrLine(text = \"\"): void {\n\t\tthis.streams.stderr(`${text}\\n`);\n\t}\n\n\tstyle(style: \"bold\" | \"dim\" | \"red\" | \"green\" | \"yellow\" | \"cyan\", text: string): string {\n\t\tif (!this.color) return text;\n\t\tconst codes = {\n\t\t\tbold: [\"1\", \"22\"],\n\t\t\tdim: [\"2\", \"22\"],\n\t\t\tred: [\"31\", \"39\"],\n\t\t\tgreen: [\"32\", \"39\"],\n\t\t\tyellow: [\"33\", \"39\"],\n\t\t\tcyan: [\"36\", \"39\"],\n\t\t} as const;\n\t\tconst [open, close] = codes[style];\n\t\treturn `\\u001b[${open}m${text}\\u001b[${close}m`;\n\t}\n\n\t/** Emit a command result: JSON in --json mode, otherwise the formatter. */\n\tresult(value: unknown, formatter?: (value: unknown) => string): void {\n\t\tif (this.json) {\n\t\t\tthis.writeLine(formatJson(value));\n\t\t\treturn;\n\t\t}\n\t\tconst text = formatter ? formatter(value) : formatJson(value);\n\t\tif (text.length) this.writeLine(text);\n\t}\n\n\tjsonLine(value: unknown): void {\n\t\tthis.writeLine(JSON.stringify(serialize(value)));\n\t}\n\n\theading(text: string): void {\n\t\tthis.writeLine(this.style(\"bold\", text));\n\t}\n\n\tdim(text: string): string {\n\t\treturn this.style(\"dim\", text);\n\t}\n\n\tkeyValue(values: Record<string, unknown>): void {\n\t\tconst entries = Object.entries(values).filter(([, value]) => value !== undefined);\n\t\tif (!entries.length) return;\n\t\tconst width = Math.max(...entries.map(([key]) => key.length));\n\t\tfor (const [key, value] of entries) {\n\t\t\tthis.writeLine(`${key.padEnd(width)} ${humanValue(value)}`);\n\t\t}\n\t}\n\n\ttable(rows: readonly Record<string, unknown>[], columns: readonly TableColumn[]): void {\n\t\tif (!rows.length) {\n\t\t\tthis.writeLine(this.dim(\"(empty)\"));\n\t\t\treturn;\n\t\t}\n\t\tconst values = rows.map((row) =>\n\t\t\tcolumns.map((column) => humanValue(row[column.key]).replace(/\\s+/g, \" \").trim()),\n\t\t);\n\t\tconst widths = columns.map((column, index) => {\n\t\t\tconst max = column.maxWidth ?? 48;\n\t\t\tconst contentWidth = Math.max(\n\t\t\t\tcolumn.label?.length ?? column.key.length,\n\t\t\t\t...values.map((row) => row[index]!.length),\n\t\t\t);\n\t\t\treturn Math.min(contentWidth, max);\n\t\t});\n\t\tconst header = columns\n\t\t\t.map((column, index) => (column.label ?? column.key).padEnd(widths[index]!))\n\t\t\t.join(\" \");\n\t\tthis.writeLine(this.style(\"bold\", header.trimEnd()));\n\t\tfor (const row of values) {\n\t\t\tthis.writeLine(\n\t\t\t\trow\n\t\t\t\t\t.map((cell, index) => {\n\t\t\t\t\t\tconst width = widths[index]!;\n\t\t\t\t\t\tconst clipped =\n\t\t\t\t\t\t\tcell.length > width ? `${cell.slice(0, Math.max(0, width - 1))}…` : cell;\n\t\t\t\t\t\treturn clipped.padEnd(width);\n\t\t\t\t\t})\n\t\t\t\t\t.join(\" \")\n\t\t\t\t\t.trimEnd(),\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport function formatErrorText(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\treturn humanValue(error);\n}\n","import { encode, renderANSI, renderUnicode, renderUnicodeCompact } from \"uqr\";\nimport type { CommandContext } from \"./context.ts\";\n\nexport type QrFormat = \"compact\" | \"unicode\" | \"ansi\" | \"ascii\" | \"none\";\n\nexport const QR_FORMATS: readonly QrFormat[] = [\"compact\", \"unicode\", \"ansi\", \"ascii\", \"none\"];\n\nexport function renderQr(text: string, format: QrFormat = \"compact\"): string {\n\tswitch (format) {\n\t\tcase \"none\":\n\t\t\treturn \"\";\n\t\tcase \"ansi\":\n\t\t\treturn renderANSI(text, { ecc: \"M\", border: 2 });\n\t\tcase \"unicode\":\n\t\t\treturn renderUnicode(text, { ecc: \"M\", border: 2 });\n\t\tcase \"ascii\": {\n\t\t\tconst { data } = encode(text, { ecc: \"M\", border: 2 });\n\t\t\treturn data.map((row) => row.map((filled) => (filled ? \"██\" : \" \")).join(\"\")).join(\"\\n\");\n\t\t}\n\t\tcase \"compact\":\n\t\tdefault:\n\t\t\treturn renderUnicodeCompact(text, { ecc: \"M\", border: 2 });\n\t}\n}\n\nexport function qrFormat(context: CommandContext): QrFormat {\n\tconst value = (context.getString(\"qr-format\") ?? \"compact\") as QrFormat;\n\treturn QR_FORMATS.includes(value) ? value : \"compact\";\n}\n\n/** QR codes and PINs travel on stderr so `--json` stdout stays valid. */\nexport function printQr(context: CommandContext, url: string): void {\n\tconst format = qrFormat(context);\n\tconst qr = renderQr(url, format);\n\tcontext.output.writeErrLine(\"\");\n\tif (qr) {\n\t\tcontext.output.writeErrLine(qr);\n\t\tcontext.output.writeErrLine(\"\");\n\t}\n\tcontext.output.writeErrLine(context.output.style(\"bold\", \"Scan this URL with LINE:\"));\n\tcontext.output.writeErrLine(url);\n\tcontext.output.writeErrLine(\"\");\n}\n\nexport function printPin(context: CommandContext, pin: string): void {\n\tcontext.output.writeErrLine(\"\");\n\tcontext.output.writeErrLine(context.output.style(\"bold\", \"Enter this PIN in the LINE app:\"));\n\tcontext.output.writeErrLine(` ${pin}`);\n\tcontext.output.writeErrLine(\"\");\n}\n","import { BaseStorage, type Storage } from \"@evex-dev/linejs/storage\";\nimport type { ProfileStore, StorageValue } from \"./profile-store.ts\";\n\n/**\n * LINEJS storage backed by the same JSON file as the profile. Keeping the\n * E2EE keys, refresh token, and reqseq counter in one profile makes\n * `~/.linejs/<profile>.json` self-contained and portable.\n */\nexport class ProfileStorage extends BaseStorage {\n\treadonly store: ProfileStore;\n\n\tconstructor(store: ProfileStore) {\n\t\tsuper();\n\t\tthis.store = store;\n\t}\n\n\tasync set(key: Storage[\"Key\"], value: Storage[\"Value\"]): Promise<void> {\n\t\tawait this.store.setStorage(key, value as StorageValue);\n\t}\n\n\tasync get(key: Storage[\"Key\"]): Promise<Storage[\"Value\"] | undefined> {\n\t\treturn this.store.getStorage(key) as Storage[\"Value\"] | undefined;\n\t}\n\n\tasync delete(key: Storage[\"Key\"]): Promise<void> {\n\t\tawait this.store.deleteStorage(key);\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait this.store.clearStorage();\n\t}\n\n\tasync migrate(storage: BaseStorage): Promise<void> {\n\t\tfor (const [key, value] of Object.entries(this.store.data.storage)) {\n\t\t\tawait storage.set(key, value);\n\t\t}\n\t}\n}\n","import { homedir } from \"node:os\";\nimport { basename, isAbsolute, join, resolve, sep } from \"node:path\";\n\nexport interface ProfileLocation {\n\t/** Absolute path of the profile JSON file. */\n\tpath: string;\n\t/** Profile name used for display. */\n\tname: string;\n\t/** Root directory used for named profiles. */\n\thome: string;\n\t/** True when the user supplied an explicit path instead of a name. */\n\texplicitPath: boolean;\n}\n\nexport function linejsHome(env: NodeJS.ProcessEnv = process.env): string {\n\tconst configured = env.LINEJS_HOME?.trim();\n\tif (configured) return resolve(configured);\n\treturn join(homedir(), \".linejs\");\n}\n\nfunction expandHome(value: string): string {\n\tif (value === \"~\") return homedir();\n\tif (value.startsWith(`~${sep}`) || value.startsWith(\"~/\")) {\n\t\treturn join(homedir(), value.slice(2));\n\t}\n\treturn value;\n}\n\nfunction looksLikePath(value: string): boolean {\n\treturn (\n\t\tisAbsolute(value) ||\n\t\tvalue.startsWith(\".\") ||\n\t\tvalue.startsWith(\"~\") ||\n\t\tvalue.includes(\"/\") ||\n\t\tvalue.includes(\"\\\\\")\n\t);\n}\n\nfunction profileNameFromPath(path: string): string {\n\tconst file = basename(path);\n\treturn file.endsWith(\".json\") ? file.slice(0, -\".json\".length) : file;\n}\n\n/**\n * Resolve --profile:\n * default / profile2 -> ~/.linejs/<name>.json\n * profile2.json -> ~/.linejs/profile2.json\n * ./profiles/work.json -> <cwd>/profiles/work.json\n * /tmp/line.json -> /tmp/line.json\n */\nexport function resolveProfileLocation(\n\tprofile: string | undefined,\n\tenv: NodeJS.ProcessEnv = process.env,\n\tcwd: string = process.cwd(),\n): ProfileLocation {\n\tconst home = linejsHome(env);\n\tconst value = (profile ?? env.LINEJS_PROFILE ?? \"default\").trim();\n\tif (!value) throw new Error(\"Profile name must not be empty\");\n\tif (value.includes(\"\\0\")) throw new Error(\"Profile name must not contain NUL bytes\");\n\tif (value === \".\" || value === \"..\") {\n\t\tthrow new Error(`Invalid profile name: ${value}`);\n\t}\n\n\tif (looksLikePath(value)) {\n\t\tconst expanded = expandHome(value);\n\t\tconst path = isAbsolute(expanded) ? resolve(expanded) : resolve(cwd, expanded);\n\t\treturn { path, name: profileNameFromPath(path), home, explicitPath: true };\n\t}\n\n\tconst file = value.endsWith(\".json\") ? value : `${value}.json`;\n\tconst path = join(home, file);\n\treturn { path, name: profileNameFromPath(path), home, explicitPath: false };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { CliError } from \"./errors.ts\";\nimport { serialize } from \"./output.ts\";\nimport { linejsHome } from \"./paths.ts\";\n\nexport type StorageValue = string | number | boolean | null | Record<string, unknown>;\n\nexport const PROFILE_VERSION = 1;\n\nexport interface ProfileAccount {\n\tmid?: string;\n\tdisplayName?: string;\n\tstatusMessage?: string;\n}\n\nexport interface ProfileLogin {\n\tmethod: \"qr\" | \"password\" | \"token\";\n\tat: string;\n}\n\nexport interface ProfileFile {\n\tversion: number;\n\tname: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n\tdevice: string;\n\tappVersion?: string;\n\tendpoint?: string;\n\tauthToken?: string;\n\taccount?: ProfileAccount;\n\t/** Last successfully fetched LINE profile, used when --check-session is off. */\n\tprofile?: Record<string, unknown>;\n\tprofileUpdatedAt?: string;\n\tlogin?: ProfileLogin;\n\tstorage: Record<string, StorageValue>;\n\t[key: string]: unknown;\n}\n\nexport interface ProfileSummary {\n\tname: string;\n\tpath: string;\n\tdevice?: string;\n\tappVersion?: string;\n\tendpoint?: string;\n\tauthToken: boolean;\n\tprofileCached: boolean;\n\tprofileUpdatedAt?: string;\n\tmid?: string;\n\tdisplayName?: string;\n\tcreatedAt?: string;\n\tupdatedAt?: string;\n\tlogin?: ProfileLogin;\n}\n\nfunction ensureObject(value: unknown, path: string): Record<string, unknown> {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new CliError(\"PROFILE_INVALID\", `Profile is not a JSON object: ${path}`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nfunction ensureStorage(value: unknown, path: string): Record<string, StorageValue> {\n\tif (value === undefined) return {};\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new CliError(\"PROFILE_INVALID\", `Profile storage is not an object: ${path}`);\n\t}\n\treturn value as Record<string, StorageValue>;\n}\n\nfunction tokenExpiry(storage: Record<string, StorageValue>): {\n\texpiresAt: string | null;\n\texpired: boolean | null;\n} {\n\tconst raw = storage.expire;\n\tconst value = typeof raw === \"string\" ? Number(raw) : typeof raw === \"number\" ? raw : NaN;\n\tif (!Number.isFinite(value) || value <= 0) return { expiresAt: null, expired: null };\n\t// LINE stores epoch seconds; also accept epoch milliseconds.\n\tconst milliseconds = value < 1e12 ? value * 1000 : value;\n\tconst date = new Date(milliseconds);\n\tif (Number.isNaN(date.getTime())) return { expiresAt: null, expired: null };\n\treturn { expiresAt: date.toISOString(), expired: Date.now() >= milliseconds };\n}\n\nexport class ProfileStore {\n\treadonly path: string;\n\treadonly name: string;\n\tdata: ProfileFile;\n\t#chain: Promise<void> = Promise.resolve();\n\t#lastError: unknown;\n\n\tprivate constructor(path: string, name: string, data: ProfileFile) {\n\t\tthis.path = path;\n\t\tthis.name = name;\n\t\tthis.data = data;\n\t}\n\n\tstatic async open(\n\t\tpath: string,\n\t\toptions: { create?: boolean; name?: string } = {},\n\t): Promise<ProfileStore> {\n\t\tconst now = new Date().toISOString();\n\t\tlet data: ProfileFile;\n\t\ttry {\n\t\t\tconst text = await readFile(path, \"utf8\");\n\t\t\tconst raw = ensureObject(JSON.parse(text), path);\n\t\t\tconst storage = ensureStorage(raw.storage, path);\n\t\t\tdata = {\n\t\t\t\t...raw,\n\t\t\t\tversion: typeof raw.version === \"number\" ? raw.version : PROFILE_VERSION,\n\t\t\t\tname: typeof raw.name === \"string\" ? raw.name : (options.name ?? \"default\"),\n\t\t\t\tcreatedAt: typeof raw.createdAt === \"string\" ? raw.createdAt : now,\n\t\t\t\tupdatedAt: typeof raw.updatedAt === \"string\" ? raw.updatedAt : now,\n\t\t\t\tdevice: typeof raw.device === \"string\" ? raw.device : \"ANDROIDSECONDARY\",\n\t\t\t\tauthToken: typeof raw.authToken === \"string\" ? raw.authToken : undefined,\n\t\t\t\tstorage,\n\t\t\t} as ProfileFile;\n\t\t} catch (error) {\n\t\t\tif ((error as NodeJS.ErrnoException).code !== \"ENOENT\") {\n\t\t\t\tif (error instanceof CliError) throw error;\n\t\t\t\tthrow new CliError(\"PROFILE_INVALID\", `Could not read profile: ${path}`, {\n\t\t\t\t\tcause: error,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!options.create) {\n\t\t\t\tthrow new CliError(\"PROFILE_NOT_FOUND\", `Profile not found: ${path}`, {\n\t\t\t\t\tdetails: { path, hint: \"Run `line auth login` first.\" },\n\t\t\t\t});\n\t\t\t}\n\t\t\tdata = {\n\t\t\t\tversion: PROFILE_VERSION,\n\t\t\t\tname: options.name ?? \"default\",\n\t\t\t\tcreatedAt: now,\n\t\t\t\tupdatedAt: now,\n\t\t\t\tdevice: \"ANDROIDSECONDARY\",\n\t\t\t\tstorage: {},\n\t\t\t};\n\t\t}\n\t\treturn new ProfileStore(path, data.name, data);\n\t}\n\n\t#scheduleWrite(): Promise<void> {\n\t\tconst snapshot = JSON.stringify(this.data, null, \"\\t\");\n\t\tconst run = this.#chain.then(async () => {\n\t\t\tconst directory = dirname(this.path);\n\t\t\tawait mkdir(directory, { recursive: true, mode: 0o700 });\n\t\t\tconst temporary = join(directory, `.${this.name}.${process.pid}.${randomUUID()}.tmp`);\n\t\t\tawait writeFile(temporary, `${snapshot}\\n`, { encoding: \"utf8\", mode: 0o600 });\n\t\t\tawait rename(temporary, this.path);\n\t\t\tawait chmod(this.path, 0o600).catch(() => {});\n\t\t});\n\t\tthis.#chain = run.catch((error) => {\n\t\t\tthis.#lastError = error;\n\t\t});\n\t\treturn run;\n\t}\n\n\tasync save(): Promise<void> {\n\t\tthis.data.updatedAt = new Date().toISOString();\n\t\tawait this.#scheduleWrite();\n\t}\n\n\tasync flush(): Promise<void> {\n\t\tawait this.#chain;\n\t\tif (this.#lastError) {\n\t\t\tconst error = this.#lastError;\n\t\t\tthis.#lastError = undefined;\n\t\t\tthrow new CliError(\"INTERNAL\", `Could not write profile: ${this.path}`, {\n\t\t\t\tcause: error,\n\t\t\t});\n\t\t}\n\t}\n\n\tsetAuthToken(token: string): Promise<void> {\n\t\tthis.data.authToken = token;\n\t\treturn this.save();\n\t}\n\n\tsetAccount(account: ProfileAccount): Promise<void> {\n\t\tthis.data.account = { ...this.data.account, ...account };\n\t\treturn this.save();\n\t}\n\n\t/** Cache the full profile so non-checking commands can work offline. */\n\tsetCachedProfile(profile: Record<string, unknown>, account?: ProfileAccount): Promise<void> {\n\t\tthis.data.profile = serialize(profile) as Record<string, unknown>;\n\t\tthis.data.profileUpdatedAt = new Date().toISOString();\n\t\tif (account) this.data.account = { ...this.data.account, ...account };\n\t\treturn this.save();\n\t}\n\n\tsetLogin(method: ProfileLogin[\"method\"]): Promise<void> {\n\t\tthis.data.login = { method, at: new Date().toISOString() };\n\t\treturn this.save();\n\t}\n\n\tsetDevice(device: string, appVersion?: string): Promise<void> {\n\t\tthis.data.device = device;\n\t\tif (appVersion) this.data.appVersion = appVersion;\n\t\treturn this.save();\n\t}\n\n\tgetStorage(key: string): StorageValue | undefined {\n\t\treturn this.data.storage[key];\n\t}\n\n\tasync setStorage(key: string, value: StorageValue): Promise<void> {\n\t\tthis.data.storage[key] = value;\n\t\tawait this.save();\n\t}\n\n\tasync deleteStorage(key: string): Promise<void> {\n\t\tdelete this.data.storage[key];\n\t\tawait this.save();\n\t}\n\n\tasync clearStorage(): Promise<void> {\n\t\tthis.data.storage = {};\n\t\tawait this.save();\n\t}\n\n\tget authToken(): string | undefined {\n\t\treturn this.data.authToken;\n\t}\n\n\ttokenExpiry(): { expiresAt: string | null; expired: boolean | null } {\n\t\treturn tokenExpiry(this.data.storage);\n\t}\n\n\tsummary(): ProfileSummary {\n\t\treturn {\n\t\t\tname: this.data.name,\n\t\t\tpath: this.path,\n\t\t\tdevice: this.data.device,\n\t\t\tappVersion: this.data.appVersion,\n\t\t\tendpoint: this.data.endpoint,\n\t\t\tauthToken: Boolean(this.data.authToken),\n\t\t\tprofileCached: Boolean(this.data.profile),\n\t\t\tprofileUpdatedAt: this.data.profileUpdatedAt,\n\t\t\tmid: this.data.account?.mid,\n\t\t\tdisplayName: this.data.account?.displayName,\n\t\t\tcreatedAt: this.data.createdAt,\n\t\t\tupdatedAt: this.data.updatedAt,\n\t\t\tlogin: this.data.login,\n\t\t};\n\t}\n\n\tasync delete(): Promise<void> {\n\t\tawait rm(this.path, { force: true });\n\t}\n}\n\nexport interface ProfileListEntry extends ProfileSummary {\n\tfile: string;\n\terror?: string;\n}\n\nexport async function listProfiles(\n\tenv: NodeJS.ProcessEnv = process.env,\n): Promise<{ home: string; profiles: ProfileListEntry[] }> {\n\tconst home = linejsHome(env);\n\tlet files: string[];\n\ttry {\n\t\tfiles = await readdir(home);\n\t} catch (error) {\n\t\tif ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n\t\t\treturn { home, profiles: [] };\n\t\t}\n\t\tthrow error;\n\t}\n\tconst profiles: ProfileListEntry[] = [];\n\tfor (const file of files.filter((entry) => entry.endsWith(\".json\")).sort()) {\n\t\tconst path = join(home, file);\n\t\ttry {\n\t\t\tconst store = await ProfileStore.open(path, { name: file.slice(0, -5) });\n\t\t\tprofiles.push({ ...store.summary(), file });\n\t\t} catch (error) {\n\t\t\tprofiles.push({\n\t\t\t\tname: file.slice(0, -5),\n\t\t\t\tpath,\n\t\t\t\tauthToken: false,\n\t\t\t\tprofileCached: false,\n\t\t\t\tfile,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\treturn { home, profiles };\n}\n","import { rm } from \"node:fs/promises\";\nimport { Client } from \"@evex-dev/linejs\";\nimport { BaseClient, type Device } from \"@evex-dev/linejs/base\";\nimport { type BaseStorage, MemoryStorage } from \"@evex-dev/linejs/storage\";\nimport type { Profile } from \"@evex-dev/linejs-types\";\nimport type { CommandContext } from \"./context.ts\";\nimport { CliError, UsageError, errorMessage } from \"./errors.ts\";\nimport { printPin, printQr } from \"./qr.ts\";\nimport { ProfileStorage } from \"./profile-storage.ts\";\nimport { type ProfileAccount, ProfileStore } from \"./profile-store.ts\";\n\nexport const DEVICES: readonly Device[] = [\n\t\"DESKTOPWIN\",\n\t\"DESKTOPMAC\",\n\t\"ANDROID\",\n\t\"ANDROIDSECONDARY\",\n\t\"IOS\",\n\t\"IOSIPAD\",\n\t\"WATCHOS\",\n\t\"WEAROS\",\n];\n\nexport interface ConnectedSession {\n\tclient: Client;\n\tbase: BaseClient;\n\tstore: ProfileStore;\n\t/** True when connect() verified the token with getProfile(). */\n\tcheckedSession: boolean;\n}\n\nexport interface LoginSession {\n\tclient: Client;\n\tbase: BaseClient;\n\tstore?: ProfileStore;\n\tauthToken: string;\n\tsaved: boolean;\n\tpath: string;\n\tmethod: LoginOptions[\"method\"];\n\taccount: ProfileAccount;\n}\n\nexport function validateDevice(value: string): Device {\n\tif (!DEVICES.includes(value as Device)) {\n\t\tthrow new UsageError(`Unsupported device: ${value} (expected ${DEVICES.join(\", \")})`);\n\t}\n\treturn value as Device;\n}\n\nexport function resolveDevice(context: CommandContext, fallback: string): Device {\n\treturn validateDevice(context.settings.device ?? fallback);\n}\n\nfunction accountFromProfile(base: BaseClient): ProfileAccount {\n\tconst profile = base.profile;\n\tif (!profile) return {};\n\treturn {\n\t\t...(profile.mid ? { mid: profile.mid } : {}),\n\t\t...(profile.displayName ? { displayName: profile.displayName } : {}),\n\t\t...(profile.statusMessage ? { statusMessage: profile.statusMessage } : {}),\n\t};\n}\n\nfunction attachLogging(context: CommandContext, base: BaseClient): void {\n\tif (!context.settings.verbose) return;\n\tbase.on(\"log\", (entry) => {\n\t\tlet data = \"\";\n\t\ttry {\n\t\t\tdata = JSON.stringify(entry.data, BaseClient.jsonReplacer);\n\t\t} catch {\n\t\t\tdata = String(entry.data);\n\t\t}\n\t\tif (data.length > 4000) data = `${data.slice(0, 4000)}…`;\n\t\tcontext.output.writeErrLine(`[linejs] ${entry.type}: ${data}`);\n\t});\n}\n\nfunction createBase(\n\tcontext: CommandContext,\n\tstore: ProfileStore | undefined,\n\tstorage: BaseStorage,\n\tdevice: Device,\n): BaseClient {\n\tconst base = new BaseClient({\n\t\tdevice,\n\t\tstorage,\n\t\tversion: context.settings.appVersion ?? store?.data.appVersion,\n\t\tendpoint: context.settings.endpoint ?? store?.data.endpoint,\n\t});\n\tif (context.settings.timeout !== undefined) {\n\t\tif (context.settings.timeout <= 0) throw new UsageError(\"--timeout must be positive\");\n\t\tbase.config.timeout = context.settings.timeout;\n\t\tbase.config.longTimeout = Math.max(base.config.longTimeout, context.settings.timeout);\n\t}\n\tattachLogging(context, base);\n\treturn base;\n}\n\n/**\n * Restore the in-memory profile from the last successful getProfile() or the\n * cached account fields, so commands can run without the preflight request.\n */\nfunction hydrateProfile(base: BaseClient, store: ProfileStore): void {\n\tconst snapshot = store.data.profile;\n\tif (snapshot && typeof snapshot === \"object\") {\n\t\tbase.profile = snapshot as unknown as Profile;\n\t\treturn;\n\t}\n\tconst account = store.data.account;\n\tif (account?.mid) {\n\t\tbase.profile = {\n\t\t\tmid: account.mid,\n\t\t\tdisplayName: account.displayName ?? \"\",\n\t\t\tstatusMessage: account.statusMessage ?? \"\",\n\t\t} as Profile;\n\t}\n}\n\nfunction authFailure(error: unknown): CliError {\n\tif (error instanceof CliError) return error;\n\treturn new CliError(\"AUTH_FAILED\", `LINE authentication failed: ${errorMessage(error)}`, {\n\t\tcause: error,\n\t\tdetails: {\n\t\t\thint: \"The auth token may have expired or been revoked. Run `line auth login --profile <name> --force` to sign in again.\",\n\t\t},\n\t});\n}\n\n/** Load the active profile, restore the LINE session, and return a Client. */\nexport async function connect(context: CommandContext): Promise<ConnectedSession> {\n\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\tname: context.settings.profile.name,\n\t});\n\tif (!store.authToken) {\n\t\tthrow new CliError(\"AUTH_REQUIRED\", \"This profile has no auth token\", {\n\t\t\tdetails: {\n\t\t\t\tpath: store.path,\n\t\t\t\thint: `Run \\`line auth login --profile ${store.path}\\` first.`,\n\t\t\t},\n\t\t});\n\t}\n\n\tconst device = resolveDevice(context, store.data.device);\n\tconst storage = new ProfileStorage(store);\n\tconst base = createBase(context, store, storage, device);\n\thydrateProfile(base, store);\n\n\tlet pending: Promise<void> = Promise.resolve();\n\tlet saveError: unknown;\n\tbase.on(\"update:authtoken\", (token) => {\n\t\tbase.authToken = token;\n\t\tif (store.authToken === token) return;\n\t\tpending = pending\n\t\t\t.then(() => store.setAuthToken(token))\n\t\t\t.catch((error) => {\n\t\t\t\tsaveError = error;\n\t\t\t});\n\t});\n\n\ttry {\n\t\tawait base.loginProcess.login({\n\t\t\tauthToken: store.authToken,\n\t\t\tskipCheck: !context.settings.checkSession,\n\t\t});\n\t} catch (error) {\n\t\tthrow authFailure(error);\n\t}\n\tawait pending;\n\tif (saveError) {\n\t\tthrow new CliError(\"INTERNAL\", `Could not save the refreshed auth token to ${store.path}`, {\n\t\t\tcause: saveError,\n\t\t});\n\t}\n\n\tif (context.settings.checkSession && base.profile) {\n\t\tawait store.setCachedProfile(\n\t\t\tbase.profile as unknown as Record<string, unknown>,\n\t\t\taccountFromProfile(base),\n\t\t);\n\t}\n\tawait store.flush();\n\n\treturn {\n\t\tclient: new Client(base),\n\t\tbase,\n\t\tstore,\n\t\tcheckedSession: context.settings.checkSession,\n\t};\n}\n\nexport interface LoginOptions {\n\tmethod: \"qr\" | \"password\" | \"token\";\n\temail?: string;\n\tpassword?: string;\n\tpincode?: string;\n\ttoken?: string;\n\tsave?: boolean;\n\tforce?: boolean;\n}\n\n/** Run a fresh login and (unless save=false) persist it to the profile file. */\nexport async function login(context: CommandContext, options: LoginOptions): Promise<LoginSession> {\n\tconst path = context.settings.profile.path;\n\tconst save = options.save !== false;\n\tlet existed = false;\n\tif (save) {\n\t\ttry {\n\t\t\tawait ProfileStore.open(path, { name: context.settings.profile.name });\n\t\t\texisted = true;\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof CliError) || error.code !== \"PROFILE_NOT_FOUND\") {\n\t\t\t\tif (!options.force) throw error;\n\t\t\t\t// --force may replace a corrupt profile. Remove it so the store can\n\t\t\t\t// start from a clean file; a valid profile keeps its E2EE storage.\n\t\t\t\tawait rm(path, { force: true });\n\t\t\t}\n\t\t}\n\n\t\tif (existed && !options.force) {\n\t\t\tthrow new CliError(\"PROFILE_EXISTS\", `Profile already exists: ${path}`, {\n\t\t\t\tdetails: {\n\t\t\t\t\tpath,\n\t\t\t\t\thint: \"Pass --force to replace it, or choose another --profile.\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\tconst store = save\n\t\t? await ProfileStore.open(path, { create: true, name: context.settings.profile.name })\n\t\t: undefined;\n\tconst storage: BaseStorage = store ? new ProfileStorage(store) : new MemoryStorage();\n\tconst device = resolveDevice(context, store?.data.device ?? \"ANDROIDSECONDARY\");\n\tconst base = createBase(context, store, storage, device);\n\n\tlet pending: Promise<void> = Promise.resolve();\n\tlet saveError: unknown;\n\tbase.on(\"update:authtoken\", (token) => {\n\t\tbase.authToken = token;\n\t\tif (!store || store.authToken === token) return;\n\t\tpending = pending\n\t\t\t.then(() => store.setAuthToken(token))\n\t\t\t.catch((error) => {\n\t\t\t\tsaveError = error;\n\t\t\t});\n\t});\n\tbase.on(\"qrcall\", (url) => {\n\t\tprintQr(context, url);\n\t});\n\tbase.on(\"pincall\", (pin) => {\n\t\tprintPin(context, pin);\n\t});\n\n\ttry {\n\t\tif (options.method === \"token\") {\n\t\t\tconst token = options.token?.trim();\n\t\t\tif (!token) throw new UsageError(\"Missing --token\");\n\t\t\tawait base.loginProcess.login({ authToken: token });\n\t\t} else if (options.method === \"password\") {\n\t\t\tif (!options.email) throw new UsageError(\"Password login requires --email\");\n\t\t\tconst password = options.password;\n\t\t\tif (!password) throw new UsageError(\"Password login requires --password or --password-stdin\");\n\t\t\tawait base.loginProcess.login({\n\t\t\t\temail: options.email,\n\t\t\t\tpassword,\n\t\t\t\t...(options.pincode ? { pincode: options.pincode } : {}),\n\t\t\t});\n\t\t} else {\n\t\t\tawait base.loginProcess.login({ qr: true });\n\t\t}\n\t} catch (error) {\n\t\tif (store && !existed) await store.delete().catch(() => {});\n\t\tthrow authFailure(error);\n\t}\n\n\tawait pending;\n\tif (saveError) {\n\t\tthrow new CliError(\"INTERNAL\", `Could not save the auth token to ${path}`, {\n\t\t\tcause: saveError,\n\t\t});\n\t}\n\n\tconst authToken = base.authToken;\n\tif (!authToken) {\n\t\tthrow new CliError(\"AUTH_FAILED\", \"Login completed without an auth token\");\n\t}\n\tconst account = accountFromProfile(base);\n\tif (store) {\n\t\tawait store.setDevice(device, context.settings.appVersion);\n\t\tif (context.settings.endpoint) {\n\t\t\tstore.data.endpoint = context.settings.endpoint;\n\t\t\tawait store.save();\n\t\t}\n\t\tif (base.profile) {\n\t\t\tawait store.setCachedProfile(base.profile as unknown as Record<string, unknown>, account);\n\t\t} else {\n\t\t\tawait store.setAccount(account);\n\t\t}\n\t\tawait store.setLogin(options.method);\n\t\tawait store.flush();\n\t}\n\n\treturn {\n\t\tclient: new Client(base),\n\t\tbase,\n\t\tstore,\n\t\tauthToken,\n\t\tsaved: Boolean(store),\n\t\tpath,\n\t\tmethod: options.method,\n\t\taccount,\n\t};\n}\n\n/** Run `fn` with a connected client and always flush profile writes. */\nexport async function withClient<T>(\n\tcontext: CommandContext,\n\tfn: (session: ConnectedSession) => Promise<T>,\n): Promise<T> {\n\tconst session = await connect(context);\n\ttry {\n\t\treturn await fn(session);\n\t} finally {\n\t\tawait session.store.flush();\n\t}\n}\n","import type { MessageReactionType } from \"@evex-dev/linejs-types\";\nimport {\n\tTalkMessage,\n\ttype Chat,\n\ttype Client,\n\ttype Square,\n\ttype SquareChat,\n\ttype SquareMessage,\n\ttype User,\n} from \"@evex-dev/linejs\";\nimport type { CommandContext } from \"../context.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport type { OptionSpec } from \"../args.ts\";\nimport { humanValue } from \"../output.ts\";\n\nexport const YES_OPTION: OptionSpec = {\n\tname: \"yes\",\n\ttype: \"boolean\",\n\tdescription: \"Confirm a destructive action without prompting.\",\n};\n\nexport function limitOption(defaultValue: number): OptionSpec {\n\treturn {\n\t\tname: \"limit\",\n\t\tshort: \"n\",\n\t\ttype: \"number\",\n\t\tvalueName: \"count\",\n\t\tdescription: `Maximum number of results (default: ${defaultValue}).`,\n\t};\n}\n\nexport function outOption(description = \"Write the result to this file.\"): OptionSpec {\n\treturn {\n\t\tname: \"out\",\n\t\ttype: \"string\",\n\t\tvalueName: \"path\",\n\t\tdescription,\n\t};\n}\n\nexport function pickString(record: unknown, key: string): string | undefined {\n\tif (!record || typeof record !== \"object\") return undefined;\n\tconst value = (record as Record<string, unknown>)[key];\n\treturn typeof value === \"string\" ? value : undefined;\n}\n\nexport function pickNumber(record: unknown, key: string): number | undefined {\n\tif (!record || typeof record !== \"object\") return undefined;\n\tconst value = (record as Record<string, unknown>)[key];\n\treturn typeof value === \"number\" ? value : undefined;\n}\n\nexport function asRecord(value: unknown): Record<string, unknown> {\n\treturn value && typeof value === \"object\" ? (value as Record<string, unknown>) : {};\n}\n\n/**\n * User (1:1) mids start with \"u\". `talk.getChat` only serves group/room\n * chats, so user mids must go through the message-box APIs instead.\n */\nexport function isUserMid(mid: string): boolean {\n\treturn mid.startsWith(\"u\");\n}\n\nexport function userChatSummary(mid: string): Record<string, unknown> {\n\treturn {\n\t\tmid,\n\t\ttype: \"USER\",\n\t};\n}\n\n/**\n * Fetch recent talk messages for a 1:1 (user) mid via the message-box APIs.\n * Group/room mids keep using `Chat.fetchMessages`; this is the user-mid\n * counterpart that `client.getChat` cannot serve.\n */\nexport async function fetchUserTalkMessages(\n\tclient: Client,\n\tuserMid: string,\n\tlimit: number,\n): Promise<TalkMessage[]> {\n\tconst boxes = await client.base.talk.getMessageBoxes({\n\t\tmessageBoxListRequest: {},\n\t});\n\tconst box = boxes.messageBoxes.find((entry) => entry.id === userMid);\n\tif (!box) {\n\t\tthrow new CliError(\"NOT_FOUND\", `Message box ${userMid} was not found`, {\n\t\t\tdetails: {\n\t\t\t\tchatMid: userMid,\n\t\t\t\thint: \"Open the 1:1 chat once in an official client, then retry.\",\n\t\t\t},\n\t\t});\n\t}\n\tconst raws = await client.base.talk.getPreviousMessagesV2WithRequest({\n\t\trequest: {\n\t\t\tmessageBoxId: box.id,\n\t\t\tendMessageId: {\n\t\t\t\tmessageId: box.lastDeliveredMessageId.messageId,\n\t\t\t\tdeliveredTime: box.lastDeliveredMessageId.deliveredTime,\n\t\t\t},\n\t\t\tmessagesCount: limit,\n\t\t},\n\t});\n\treturn await Promise.all(raws.map((raw) => TalkMessage.fromRawTalk(raw, client)));\n}\n\n/**\n * Fetch recent talk messages for any talk mid. User (1:1) mids go through\n * the message-box path; group/room mids keep the existing `getChat` path.\n */\nexport async function fetchTalkMessages(\n\tclient: Client,\n\tchatMid: string,\n\tlimit: number,\n): Promise<TalkMessage[]> {\n\tif (!isUserMid(chatMid)) {\n\t\tconst chat = await client.getChat(chatMid);\n\t\treturn chat.fetchMessages(limit);\n\t}\n\treturn fetchUserTalkMessages(client, chatMid, limit);\n}\n\nexport function chatSummary(chat: Chat, includeRaw = false): Record<string, unknown> {\n\tconst raw = asRecord(chat.raw);\n\treturn {\n\t\tmid: chat.mid,\n\t\tname: chat.name,\n\t\ttype: raw.type,\n\t\tmemberCount: raw.memberCount ?? raw.extra,\n\t\tnotificationDisabled: raw.notificationDisabled,\n\t\tpicturePath: raw.picturePath,\n\t\tcreatedTime: raw.createdTime,\n\t\t...(includeRaw ? { raw: chat.raw } : {}),\n\t};\n}\n\nexport function userSummary(user: User, includeRaw = false): Record<string, unknown> {\n\tconst profile = asRecord(asRecord(user.raw).targetProfileDetail);\n\tconst status = asRecord(profile.statusMessage);\n\treturn {\n\t\tmid: user.mid,\n\t\tdisplayName: profile.profileName,\n\t\tstatusMessage: status.value,\n\t\tpictureStatus: profile.pictureStatus,\n\t\tpicturePath: profile.picturePath,\n\t\tmusicProfile: profile.musicProfile,\n\t\thiddenFromList: profile.hiddenFromList,\n\t\t...(includeRaw ? { raw: user.raw } : {}),\n\t};\n}\n\nexport function squareSummary(square: Square, includeRaw = false): Record<string, unknown> {\n\treturn {\n\t\tmid: square.mid,\n\t\tname: square.name,\n\t\tjoinMethod: square.raw.joinMethod,\n\t\tstate: square.raw.state,\n\t\t...(includeRaw ? { raw: square.raw } : {}),\n\t};\n}\n\nexport function squareChatSummary(\n\tsquareChat: SquareChat,\n\tincludeRaw = false,\n): Record<string, unknown> {\n\treturn {\n\t\tmid: squareChat.mid,\n\t\tname: squareChat.name,\n\t\tsquareMid: squareChat.raw.squareMid,\n\t\ttype: squareChat.raw.type,\n\t\tstate: squareChat.raw.state,\n\t\tmaxMemberCount: squareChat.raw.maxMemberCount,\n\t\t...(includeRaw ? { raw: squareChat.raw } : {}),\n\t};\n}\n\nexport function talkMessageSummary(\n\tmessage: TalkMessage,\n\tincludeRaw = false,\n): Record<string, unknown> {\n\tconst raw = asRecord(message.raw);\n\treturn {\n\t\tid: raw.id,\n\t\tchatMid: message.to.id,\n\t\tfrom: message.from.id,\n\t\tto: message.to.id,\n\t\ttoType: raw.toType,\n\t\tcontentType: raw.contentType,\n\t\ttext: message.text,\n\t\tcreatedTime: raw.createdTime,\n\t\tdeliveredTime: raw.deliveredTime,\n\t\trelatedMessageId: raw.relatedMessageId,\n\t\tisEdited: message.isEdited,\n\t\tupdatedTime: message.updatedTime,\n\t\t...(includeRaw ? { raw: message.raw } : {}),\n\t};\n}\n\nexport function squareMessageSummary(\n\tmessage: SquareMessage,\n\tincludeRaw = false,\n): Record<string, unknown> {\n\tconst raw = asRecord(message.raw);\n\tconst inner = asRecord(raw.message);\n\treturn {\n\t\tid: inner.id,\n\t\tchatMid: message.to.id,\n\t\tfrom: message.from.id,\n\t\tfromType: raw.fromType,\n\t\tcontentType: inner.contentType,\n\t\ttext: message.text,\n\t\tcreatedTime: inner.createdTime,\n\t\tdeliveredTime: inner.deliveredTime,\n\t\trelatedMessageId: inner.relatedMessageId,\n\t\t...(includeRaw ? { raw: message.raw } : {}),\n\t};\n}\n\nexport function resolveReaction(value: string): MessageReactionType {\n\tconst normalized = value.trim().toUpperCase();\n\tif (/^[0-7]$/.test(normalized)) return Number(normalized) as MessageReactionType;\n\tconst allowed = [\"ALL\", \"UNDO\", \"NICE\", \"LOVE\", \"FUN\", \"AMAZING\", \"SAD\", \"OMG\"] as const;\n\tif ((allowed as readonly string[]).includes(normalized)) {\n\t\treturn normalized as MessageReactionType;\n\t}\n\tthrow new UsageError(`Unknown reaction: ${value} (expected ${allowed.join(\", \")})`);\n}\n\nconst CONTENT_TYPES = [\n\t\"NONE\",\n\t\"IMAGE\",\n\t\"VIDEO\",\n\t\"AUDIO\",\n\t\"HTML\",\n\t\"PDF\",\n\t\"CALL\",\n\t\"STICKER\",\n\t\"PRESENCE\",\n\t\"GIFT\",\n\t\"GROUPBOARD\",\n\t\"APPLINK\",\n\t\"LINK\",\n\t\"CONTACT\",\n\t\"FILE\",\n\t\"LOCATION\",\n\t\"POSTNOTIFICATION\",\n\t\"RICH\",\n\t\"CHATEVENT\",\n\t\"MUSIC\",\n\t\"PAYMENT\",\n] as const;\n\nexport function resolveContentType(value: string | undefined): string | undefined {\n\tif (value === undefined) return undefined;\n\tconst normalized = value.toUpperCase();\n\tif (!(CONTENT_TYPES as readonly string[]).includes(normalized)) {\n\t\tthrow new UsageError(`Unknown content type: ${value}`);\n\t}\n\treturn normalized;\n}\n\nexport function requireJsonObject<T>(context: CommandContext, option: string): T | undefined {\n\tconst value = context.getJson<T>(option);\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new UsageError(`--${option} must be a JSON object`);\n\t}\n\treturn value;\n}\n\nexport function requireStringRecord(\n\tcontext: CommandContext,\n\toption: string,\n): Record<string, string> | undefined {\n\tconst value = requireJsonObject<Record<string, unknown>>(context, option);\n\tif (value === undefined) return undefined;\n\tconst output: Record<string, string> = {};\n\tfor (const [key, entry] of Object.entries(value)) {\n\t\tif (typeof entry !== \"string\") {\n\t\t\tthrow new UsageError(`--${option}.${key} must be a string`);\n\t\t}\n\t\toutput[key] = entry;\n\t}\n\treturn output;\n}\n\nexport function joinOrEmpty(values: readonly string[] | undefined): string {\n\treturn values?.length ? values.join(\", \") : \"\";\n}\n\nexport function printOk(context: CommandContext, message: string): Record<string, unknown> {\n\tif (!context.json) context.output.writeLine(message);\n\treturn { ok: true };\n}\n\nexport function summaryLine(values: Record<string, unknown>): string {\n\treturn Object.entries(values)\n\t\t.filter(([, value]) => value !== undefined && value !== \"\" && value !== null)\n\t\t.map(([key, value]) => `${key}=${humanValue(value)}`)\n\t\t.join(\" \");\n}\n","import type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readTextInput, writeBinaryFile } from \"../files.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient, type ConnectedSession } from \"../session.ts\";\nimport { outOption } from \"./shared.ts\";\n\ntype AnyFunction = (...args: unknown[]) => unknown;\n\nfunction resolveTarget(session: ConnectedSession, name: string): Record<string, unknown> {\n\tif (name === \"client\") return session.client as unknown as Record<string, unknown>;\n\tif (name === \"base\") return session.base as unknown as Record<string, unknown>;\n\tconst base = session.base as unknown as Record<string, unknown>;\n\tconst target = base[name];\n\tif (target === undefined) {\n\t\tthrow new CliError(\"NOT_FOUND\", `Unknown service: ${name}`, {\n\t\t\tdetails: { hint: \"Run `line api services` to list services.\" },\n\t\t});\n\t}\n\tif (!target || (typeof target !== \"object\" && typeof target !== \"function\")) {\n\t\tthrow new CliError(\"NOT_FOUND\", `Service is not an object: ${name}`);\n\t}\n\treturn target as Record<string, unknown>;\n}\n\nfunction methodNames(target: Record<string, unknown>): string[] {\n\tconst names = new Set<string>();\n\tlet current: object | null = target;\n\twhile (current && current !== Object.prototype) {\n\t\tfor (const name of Object.getOwnPropertyNames(current)) {\n\t\t\tif (name === \"constructor\" || name.startsWith(\"_\") || name.startsWith(\"#\")) continue;\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(current, name);\n\t\t\tif (!descriptor) continue;\n\t\t\tif (typeof descriptor.value === \"function\") names.add(name);\n\t\t\tif (typeof descriptor.get === \"function\") {\n\t\t\t\ttry {\n\t\t\t\t\tconst value = (target as Record<string, unknown>)[name];\n\t\t\t\t\tif (typeof value === \"function\") names.add(name);\n\t\t\t\t} catch {\n\t\t\t\t\t// A getter can require login state; skip it.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcurrent = Object.getPrototypeOf(current) as object | null;\n\t}\n\treturn [...names].sort();\n}\n\nconst servicesCommand: CommandSpec = {\n\tname: \"api services\",\n\tsummary: \"List LINEJS services exposed by the raw API bridge.\",\n\tcategory: \"Advanced\",\n\texamples: [\"line api services\", \"line api services --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base, client }) => {\n\t\t\tconst names = new Set<string>([\"client\", \"base\"]);\n\t\t\tfor (const name of Object.keys(base)) {\n\t\t\t\tif (name.startsWith(\"_\") || name.startsWith(\"#\")) continue;\n\t\t\t\tconst value = (base as unknown as Record<string, unknown>)[name];\n\t\t\t\tif (value && typeof value === \"object\") names.add(name);\n\t\t\t}\n\t\t\tconst services = [...names].sort().map((name) => {\n\t\t\t\tlet methods: string[] = [];\n\t\t\t\ttry {\n\t\t\t\t\tconst target =\n\t\t\t\t\t\tname === \"client\"\n\t\t\t\t\t\t\t? (client as unknown as Record<string, unknown>)\n\t\t\t\t\t\t\t: name === \"base\"\n\t\t\t\t\t\t\t\t? (base as unknown as Record<string, unknown>)\n\t\t\t\t\t\t\t\t: ((base as unknown as Record<string, unknown>)[name] as Record<string, unknown>);\n\t\t\t\t\tmethods = methodNames(target);\n\t\t\t\t} catch {\n\t\t\t\t\tmethods = [];\n\t\t\t\t}\n\t\t\t\treturn { name, methodCount: methods.length };\n\t\t\t});\n\t\t\treturn { services };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { services: Array<{ name: string; methodCount: number }> }).services\n\t\t\t.map((service) => `${service.name.padEnd(16)} ${service.methodCount} methods`)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst methodsCommand: CommandSpec = {\n\tname: \"api methods\",\n\tsummary: \"List public methods on a service.\",\n\tcategory: \"Advanced\",\n\targs: [\n\t\t{\n\t\t\tname: \"service\",\n\t\t\tdescription: \"Service name (talk, square, relation, client, ...).\",\n\t\t\trequired: true,\n\t\t},\n\t],\n\texamples: [\"line api methods talk\", \"line api methods obs\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst service = context.requireArg(0, \"service\");\n\t\treturn await withClient(context, async (session) => {\n\t\t\tconst target = resolveTarget(session, service);\n\t\t\treturn { service, methods: methodNames(target) };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { methods: string[] }).methods.join(\"\\n\");\n\t},\n};\n\nconst callCommand: CommandSpec = {\n\tname: \"api call\",\n\tsummary: \"Call any LINEJS service method directly with JSON arguments.\",\n\tdescription:\n\t\t\"This is the escape hatch for APIs without a dedicated command. A JSON object is passed as one argument; a JSON array is spread as multiple arguments. No shell is involved.\",\n\tcategory: \"Advanced\",\n\targs: [\n\t\t{ name: \"service\", description: \"Service name.\", required: true },\n\t\t{ name: \"method\", description: \"Method name.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"args\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"JSON arguments (object or array).\",\n\t\t},\n\t\t{\n\t\t\tname: \"args-file\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"path\",\n\t\t\tdescription: \"Read JSON arguments from a file (use - for stdin).\",\n\t\t},\n\t\toutOption(\"Save a Blob/Uint8Array result to this file.\"),\n\t],\n\texamples: [\n\t\t\"line api call talk getProfile --args '{}'\",\n\t\t`line api call square getSquare --args '{\"squareMid\":\"s...\"}'`,\n\t\t`line api call obs downloadObjectForService --args '[{\"obsPath\":\"talk/m/...\",\"oid\":\"...\"}]' --out ./file.bin`,\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst service = context.requireArg(0, \"service\");\n\t\tconst method = context.requireArg(1, \"method\");\n\t\tconst argsOption = context.getString(\"args\");\n\t\tconst fileOption = context.getString(\"args-file\");\n\t\tif (argsOption !== undefined && fileOption !== undefined) {\n\t\t\tthrow new UsageError(\"Use either --args or --args-file, not both\");\n\t\t}\n\t\tlet parsed: unknown;\n\t\tif (argsOption !== undefined) {\n\t\t\tparsed = parseJson(argsOption, \"--args\");\n\t\t} else if (fileOption !== undefined) {\n\t\t\tparsed = parseJson(await readTextInput(fileOption, context.settings.cwd), fileOption);\n\t\t}\n\t\tconst callArgs = parsed === undefined ? [] : Array.isArray(parsed) ? parsed : [parsed];\n\n\t\treturn await withClient(context, async (session) => {\n\t\t\tconst target = resolveTarget(session, service);\n\t\t\tconst fn = target[method];\n\t\t\tif (typeof fn !== \"function\") {\n\t\t\t\tthrow new CliError(\"NOT_FOUND\", `Method not found: ${service}.${method}`, {\n\t\t\t\t\tdetails: { hint: \"Run `line api methods <service>` to list methods.\" },\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst result = await (fn as AnyFunction).apply(target, callArgs);\n\t\t\tconst out = context.getString(\"out\");\n\t\t\tif (\n\t\t\t\tout &&\n\t\t\t\t(result instanceof Blob || result instanceof Uint8Array || result instanceof ArrayBuffer)\n\t\t\t) {\n\t\t\t\tconst written = await writeBinaryFile(out, result, context.settings.cwd);\n\t\t\t\treturn {\n\t\t\t\t\tok: true,\n\t\t\t\t\t...written,\n\t\t\t\t\ttype: result instanceof Blob ? result.type : undefined,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { ok: true, result: result === undefined ? null : result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { result: unknown };\n\t\treturn formatJson(result.result);\n\t},\n};\n\nfunction parseJson(text: string, source: string): unknown {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch (error) {\n\t\tthrow new UsageError(`Invalid JSON in ${source}`, {\n\t\t\tcause: error instanceof Error ? error.message : String(error),\n\t\t});\n\t}\n}\n\nexport const apiCommands: CommandSpec[] = [servicesCommand, methodsCommand, callCommand];\n","import { rm } from \"node:fs/promises\";\nimport type { CommandSpec } from \"../command.ts\";\nimport type { CommandContext } from \"../context.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readTextInput } from \"../files.ts\";\nimport { listProfiles, ProfileStore } from \"../profile-store.ts\";\nimport { QR_FORMATS } from \"../qr.ts\";\nimport { login, withClient } from \"../session.ts\";\nimport { YES_OPTION } from \"./shared.ts\";\n\nfunction authLoginResult(session: Awaited<ReturnType<typeof login>>) {\n\treturn {\n\t\tok: true,\n\t\tsaved: session.saved,\n\t\tprofile: session.store?.name ?? \"memory\",\n\t\tpath: session.path,\n\t\tmethod: session.method,\n\t\taccount: session.account,\n\t\t...(session.saved ? {} : { authToken: session.authToken }),\n\t};\n}\n\nfunction formatLogin(value: unknown): string {\n\tconst result = value as ReturnType<typeof authLoginResult>;\n\tconst name = result.account.displayName ?? \"(unknown)\";\n\tconst mid = result.account.mid ?? \"(unknown mid)\";\n\tconst lines = [\n\t\t`Logged in as ${name} (${mid})`,\n\t\t`Method: ${result.method ?? \"unknown\"}`,\n\t\t`Profile: ${result.saved ? result.path : \"(not saved; --no-save)\"}`,\n\t];\n\tif (!result.saved && result.authToken) {\n\t\tlines.push(\"\", \"Auth token:\");\n\t\tlines.push(result.authToken);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nasync function readPassword(context: CommandContext): Promise<string | undefined> {\n\tconst direct = context.getString(\"password\");\n\tconst useStdin = context.getBool(\"password-stdin\");\n\tif (direct && useStdin) {\n\t\tthrow new UsageError(\"Use either --password or --password-stdin, not both\");\n\t}\n\tif (direct) return direct;\n\tif (useStdin) {\n\t\tconst text = await readTextInput(undefined, context.settings.cwd);\n\t\treturn text.replace(/\\r?\\n$/, \"\");\n\t}\n\treturn undefined;\n}\n\nconst loginCommand: CommandSpec = {\n\tname: \"auth login\",\n\tsummary: \"Sign in with a QR code, email/password, or an existing auth token.\",\n\tdescription:\n\t\t\"QR login is the default. Credentials are never written to disk; only the resulting auth token and LINEJS storage (E2EE keys, refresh token, reqseq) are saved to the profile file.\",\n\tcategory: \"Authentication\",\n\targs: [],\n\toptions: [\n\t\t{ name: \"qr\", type: \"boolean\", description: \"Use QR login (the default).\" },\n\t\t{\n\t\t\tname: \"email\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"address\",\n\t\t\tdescription: \"Email address for password login.\",\n\t\t},\n\t\t{\n\t\t\tname: \"password\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"password\",\n\t\t\tdescription: \"Password for email login (visible in shell history; prefer --password-stdin).\",\n\t\t},\n\t\t{\n\t\t\tname: \"password-stdin\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Read the password from stdin.\",\n\t\t},\n\t\t{\n\t\t\tname: \"token\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"token\",\n\t\t\tdescription: \"Reuse an existing LINE auth token instead of logging in.\",\n\t\t},\n\t\t{\n\t\t\tname: \"pincode\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"digits\",\n\t\t\tdescription: \"Constant 6-digit pincode for password login.\",\n\t\t},\n\t\t{\n\t\t\tname: \"qr-format\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"format\",\n\t\t\tchoices: QR_FORMATS,\n\t\t\tdescription: \"QR rendering: compact (default), unicode, ansi, ascii, or none.\",\n\t\t},\n\t\t{\n\t\t\tname: \"save\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Save the session to the profile file (use --no-save to disable).\",\n\t\t\tdefault: true,\n\t\t},\n\t\t{\n\t\t\tname: \"force\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Overwrite an existing profile.\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line auth login\",\n\t\t\"line auth login --profile work --qr-format compact\",\n\t\t\"line auth login --email me@example.com --password-stdin --force\",\n\t\t\"line auth login --token 'TOKEN' --profile ./backup.json\",\n\t],\n\tauth: false,\n\tasync run(context) {\n\t\tconst token = context.getString(\"token\");\n\t\tconst email = context.getString(\"email\");\n\t\tconst explicitQr = context.has(\"qr\") && context.getBool(\"qr\");\n\t\tif (token && (email || explicitQr)) {\n\t\t\tthrow new UsageError(\"Use only one of --token, --email, or --qr\");\n\t\t}\n\t\tif (explicitQr && email) {\n\t\t\tthrow new UsageError(\"Use only one of --qr or --email\");\n\t\t}\n\t\tconst passwordRequested =\n\t\t\tcontext.has(\"password\") || context.has(\"password-stdin\") || context.has(\"pincode\");\n\t\tif (!token && !email && passwordRequested) {\n\t\t\tthrow new UsageError(\"--email is required for password login options\");\n\t\t}\n\n\t\tlet method: \"qr\" | \"password\" | \"token\" = \"qr\";\n\t\tlet password: string | undefined;\n\t\tlet pincode: string | undefined;\n\t\tif (token) {\n\t\t\tmethod = \"token\";\n\t\t} else if (email) {\n\t\t\tmethod = \"password\";\n\t\t\tpassword = await readPassword(context);\n\t\t\tif (!password) {\n\t\t\t\tconst { promptSecret } = await import(\"../prompt.ts\");\n\t\t\t\tpassword = await promptSecret(\"Password: \", context);\n\t\t\t}\n\t\t\tpincode = context.getString(\"pincode\");\n\t\t\tif (pincode && !/^\\d{6}$/.test(pincode)) {\n\t\t\t\tthrow new UsageError(\"--pincode must be exactly 6 digits\");\n\t\t\t}\n\t\t}\n\n\t\tconst session = await login(context, {\n\t\t\tmethod,\n\t\t\temail,\n\t\t\tpassword,\n\t\t\tpincode,\n\t\t\ttoken,\n\t\t\tsave: context.getBool(\"save\", true),\n\t\t\tforce: context.getBool(\"force\"),\n\t\t});\n\t\treturn authLoginResult(session);\n\t},\n\tformat: formatLogin,\n};\n\nconst statusCommand: CommandSpec = {\n\tname: \"auth status\",\n\tsummary: \"Show the active profile, account, and token expiry.\",\n\tcategory: \"Authentication\",\n\toptions: [\n\t\t{\n\t\t\tname: \"verify\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Call the LINE API to verify the token and refresh the cached profile.\",\n\t\t},\n\t],\n\texamples: [\"line auth status\", \"line auth status --verify --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\t\tname: context.settings.profile.name,\n\t\t});\n\t\tconst summary = store.summary();\n\t\tconst expiry = store.tokenExpiry();\n\t\tconst base = {\n\t\t\t...summary,\n\t\t\tauthenticated: Boolean(store.authToken),\n\t\t\t...expiry,\n\t\t};\n\t\tif (!context.getBool(\"verify\")) return base;\n\t\tif (!store.authToken) {\n\t\t\tthrow new CliError(\"AUTH_REQUIRED\", \"This profile has no auth token\", {\n\t\t\t\tdetails: { path: store.path, hint: \"Run `line auth login` first.\" },\n\t\t\t});\n\t\t}\n\t\treturn await withClient(context, async (session) => {\n\t\t\t// connect() restores the session with getProfile(), so reuse it.\n\t\t\tconst profile = session.base.profile ?? (await session.client.getMyProfile());\n\t\t\treturn {\n\t\t\t\t...base,\n\t\t\t\tverified: true,\n\t\t\t\taccount: {\n\t\t\t\t\tmid: profile.mid,\n\t\t\t\t\tdisplayName: profile.displayName,\n\t\t\t\t\tstatusMessage: profile.statusMessage,\n\t\t\t\t},\n\t\t\t\tprofile,\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as Record<string, unknown> & {\n\t\t\tprofile?: { displayName?: string; mid?: string; statusMessage?: string };\n\t\t};\n\t\tconst lines = [\n\t\t\t`Profile: ${String(result.name)} (${String(result.path)})`,\n\t\t\t`Device: ${String(result.device ?? \"unknown\")}`,\n\t\t];\n\t\tif (result.endpoint) lines.push(`Endpoint: ${String(result.endpoint)}`);\n\t\tif (result.profile) {\n\t\t\tlines.push(`Account: ${result.profile.displayName ?? \"?\"} (${result.profile.mid ?? \"?\"})`);\n\t\t\tif (result.profile.statusMessage) lines.push(`Status: ${result.profile.statusMessage}`);\n\t\t} else if (result.displayName || result.mid) {\n\t\t\tlines.push(`Account: ${String(result.displayName ?? \"?\")} (${String(result.mid ?? \"?\")})`);\n\t\t}\n\t\tlines.push(`Token: ${result.authenticated ? \"saved\" : \"missing\"}`);\n\t\tif (result.expiresAt) {\n\t\t\tlines.push(`Expires: ${String(result.expiresAt)}${result.expired ? \" (expired)\" : \"\"}`);\n\t\t}\n\t\tif (result.verified) lines.push(\"Verified: yes\");\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst tokenCommand: CommandSpec = {\n\tname: \"auth token\",\n\tsummary: \"Print the saved auth token.\",\n\tdescription:\n\t\t\"Treat the output as a secret. LINE auth tokens grant full account access until revoked.\",\n\tcategory: \"Authentication\",\n\texamples: [\"line auth token\", \"line auth token --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\t\tname: context.settings.profile.name,\n\t\t});\n\t\tif (!store.authToken) {\n\t\t\tthrow new CliError(\"AUTH_REQUIRED\", \"This profile has no auth token\", {\n\t\t\t\tdetails: { path: store.path, hint: \"Run `line auth login` first.\" },\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tauthToken: store.authToken,\n\t\t\tprofile: store.name,\n\t\t\tpath: store.path,\n\t\t\t...store.tokenExpiry(),\n\t\t};\n\t},\n\tformat(value) {\n\t\treturn (value as { authToken: string }).authToken;\n\t},\n};\n\nconst logoutCommand: CommandSpec = {\n\tname: \"auth logout\",\n\tsummary: \"Delete the active profile (or every profile with --all).\",\n\tcategory: \"Authentication\",\n\toptions: [\n\t\tYES_OPTION,\n\t\t{\n\t\t\tname: \"all\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Delete every profile in the LINEJS home directory.\",\n\t\t},\n\t],\n\texamples: [\"line auth logout --yes\", \"line auth logout --all --yes\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst yes = context.getBool(\"yes\");\n\t\tif (context.getBool(\"all\")) {\n\t\t\tconst { profiles } = await listProfiles(context.settings.env);\n\t\t\tif (!profiles.length) return { removed: [] };\n\t\t\tif (!yes) {\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"CONFIRMATION_REQUIRED\",\n\t\t\t\t\t`This deletes ${profiles.length} profile(s). Re-run with --yes.`,\n\t\t\t\t\t{ details: { profiles: profiles.map((profile) => profile.path) } },\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const profile of profiles) {\n\t\t\t\tawait rm(profile.path, { force: true });\n\t\t\t}\n\t\t\treturn { removed: profiles.map((profile) => profile.path) };\n\t\t}\n\t\tconst store = await ProfileStore.open(context.settings.profile.path, {\n\t\t\tname: context.settings.profile.name,\n\t\t});\n\t\tif (!yes) {\n\t\t\tthrow new CliError(\n\t\t\t\t\"CONFIRMATION_REQUIRED\",\n\t\t\t\t`This deletes ${store.path}. Re-run with --yes.`,\n\t\t\t\t{ details: { path: store.path } },\n\t\t\t);\n\t\t}\n\t\tawait store.delete();\n\t\treturn { removed: [store.path] };\n\t},\n\tformat(value) {\n\t\tconst removed = (value as { removed: string[] }).removed;\n\t\treturn removed.length\n\t\t\t? removed.map((path) => `Deleted ${path}`).join(\"\\n\")\n\t\t\t: \"No profiles found.\";\n\t},\n};\n\nconst profilesCommand: CommandSpec = {\n\tname: \"auth profiles\",\n\tsummary: \"List saved profiles under ~/.linejs.\",\n\tcategory: \"Authentication\",\n\texamples: [\"line auth profiles\", \"line auth profiles --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst { home, profiles } = await listProfiles(context.settings.env);\n\t\treturn {\n\t\t\thome,\n\t\t\tactive: context.settings.profile.path,\n\t\t\tprofiles,\n\t\t};\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\thome: string;\n\t\t\tactive: string;\n\t\t\tprofiles: Array<Record<string, unknown>>;\n\t\t};\n\t\tif (!result.profiles.length) return `No profiles in ${result.home}`;\n\t\tconst rows = result.profiles.map((profile) => ({\n\t\t\tname: profile.name,\n\t\t\taccount: profile.displayName ? `${profile.displayName} (${profile.mid ?? \"?\"})` : profile.mid,\n\t\t\tdevice: profile.device,\n\t\t\ttoken: profile.authToken ? \"yes\" : \"no\",\n\t\t\tupdated: profile.updatedAt,\n\t\t\tactive: profile.path === result.active ? \"*\" : \"\",\n\t\t\terror: profile.error,\n\t\t}));\n\t\tconst lines = [`Profiles in ${result.home}:`, \"\"];\n\t\tconst header = [\"\", \"NAME\", \"ACCOUNT\", \"DEVICE\", \"TOKEN\"];\n\t\tconst data = rows.map((row) => [\n\t\t\tString(row.active),\n\t\t\tString(row.name),\n\t\t\tString(row.account ?? \"\"),\n\t\t\tString(row.device ?? \"\"),\n\t\t\tString(row.token),\n\t\t]);\n\t\tconst widths = header.map((label, index) =>\n\t\t\tMath.max(label.length, ...data.map((row) => row[index]!.length)),\n\t\t);\n\t\tlines.push(\n\t\t\theader\n\t\t\t\t.map((label, index) => label.padEnd(widths[index]!))\n\t\t\t\t.join(\" \")\n\t\t\t\t.trimEnd(),\n\t\t);\n\t\tfor (const row of data) {\n\t\t\tlines.push(\n\t\t\t\trow\n\t\t\t\t\t.map((cell, index) => cell.padEnd(widths[index]!))\n\t\t\t\t\t.join(\" \")\n\t\t\t\t\t.trimEnd(),\n\t\t\t);\n\t\t}\n\t\tfor (const row of rows) {\n\t\t\tif (row.error) lines.push(` ! ${row.name}: ${row.error}`);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nexport const authCommands: CommandSpec[] = [\n\tloginCommand,\n\tstatusCommand,\n\ttokenCommand,\n\tlogoutCommand,\n\tprofilesCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\nconst cardOptions = [\n\t{\n\t\tname: \"celebrator\",\n\t\ttype: \"string\",\n\t\tvalueName: \"mid\",\n\t\tdescription: \"Celebrator MID (required when creating).\",\n\t},\n\t{ name: \"from\", type: \"string\", valueName: \"name\", description: \"From enum name.\" },\n\t{ name: \"template\", type: \"string\", valueName: \"id\", description: \"Card template id.\" },\n\t{\n\t\tname: \"card-status\",\n\t\ttype: \"string\",\n\t\tvalueName: \"status\",\n\t\tdescription: \"Card status (default PUBLIC).\",\n\t},\n] as const;\n\nfunction cardInput(\n\tcontext: import(\"../context.ts\").CommandContext,\n\tboardId: string,\n\ttextIndex: number,\n) {\n\tconst text = context.rest(textIndex);\n\treturn {\n\t\tboardId,\n\t\tcardStatus: context.getString(\"card-status\") ?? \"PUBLIC\",\n\t\ttext,\n\t\tcelebratorMid: context.getString(\"celebrator\"),\n\t\tfrom: context.getString(\"from\"),\n\t\ttemplateId: context.getString(\"template\"),\n\t};\n}\n\nfunction formatBirthday(value: unknown): string {\n\tconst result = value as { code?: number; message?: string; result?: unknown };\n\tif (result.code !== undefined && result.code !== 0) {\n\t\treturn `Birthday Board error ${result.code}: ${result.message ?? \"\"}`;\n\t}\n\treturn result.result === undefined || result.result === null ? \"OK\" : formatJson(result.result);\n}\n\nconst boardIdCommand: CommandSpec = {\n\tname: \"birthday board-id\",\n\tsummary: \"Get the birthday board id for a home/chat.\",\n\tcategory: \"Birthday Board\",\n\targs: [{ name: \"homeId\", description: \"Home or chat MID.\", required: true }],\n\texamples: [\"line birthday board-id cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.getBoardId(homeId);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst boardCommand: CommandSpec = {\n\tname: \"birthday board\",\n\tsummary: \"Get a birthday board.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"cardId\", description: \"Optional card id.\", required: false },\n\t],\n\texamples: [\"line birthday board BOARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.getBoard(boardId, context.arg(1));\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst cardsCommand: CommandSpec = {\n\tname: \"birthday cards\",\n\tsummary: \"List birthday cards.\",\n\tcategory: \"Birthday Board\",\n\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\toptions: [\n\t\t{ name: \"scroll\", type: \"string\", valueName: \"scrollId\", description: \"Pagination scroll id.\" },\n\t],\n\texamples: [\"line birthday cards BOARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCards({\n\t\t\t\tboardId,\n\t\t\t\tscrollId: context.getString(\"scroll\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst celebrationsCommand: CommandSpec = {\n\tname: \"birthday celebrations\",\n\tsummary: \"List birthday celebrations.\",\n\tcategory: \"Birthday Board\",\n\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\toptions: [\n\t\t{ name: \"scroll\", type: \"string\", valueName: \"scrollId\", description: \"Pagination scroll id.\" },\n\t],\n\texamples: [\"line birthday celebrations BOARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCelebrations({\n\t\t\t\tboardId,\n\t\t\t\tscrollId: context.getString(\"scroll\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst likesCommand: CommandSpec = {\n\tname: \"birthday likes\",\n\tsummary: \"List likes on a birthday card.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t],\n\texamples: [\"line birthday likes BOARD CARD\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\tconst cardId = context.requireArg(1, \"cardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCardLikes(boardId, cardId);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst templatesCommand: CommandSpec = {\n\tname: \"birthday templates\",\n\tsummary: \"List birthday card templates.\",\n\tcategory: \"Birthday Board\",\n\texamples: [\"line birthday templates\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.birthdayBoard.listCardTemplates();\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst createCommand: CommandSpec = {\n\tname: \"birthday create\",\n\tsummary: \"Create a birthday card.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"text\", description: \"Card text.\", required: true },\n\t],\n\toptions: cardOptions,\n\texamples: [\"line birthday create BOARD 'Happy birthday!' --celebrator uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst input = cardInput(context, boardId, 1);\n\t\t\treturn await client.birthdayBoard.createCard(input as never);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nconst updateCommand: CommandSpec = {\n\tname: \"birthday update\",\n\tsummary: \"Update a birthday card.\",\n\tcategory: \"Birthday Board\",\n\targs: [\n\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t{ name: \"text\", description: \"Card text.\", required: true },\n\t],\n\toptions: cardOptions,\n\texamples: [\"line birthday update BOARD CARD 'Edited'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst boardId = context.requireArg(0, \"boardId\");\n\t\tconst cardId = context.requireArg(1, \"cardId\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst input = cardInput(context, boardId, 2);\n\t\t\treturn await client.birthdayBoard.updateCard({ ...input, cardId } as never);\n\t\t});\n\t},\n\tformat: formatBirthday,\n};\n\nfunction simpleCommand(options: {\n\tname: string;\n\tsummary: string;\n\targs: CommandSpec[\"args\"];\n\taction: (\n\t\tboard: import(\"@evex-dev/linejs\").Client[\"birthdayBoard\"],\n\t\tcontext: import(\"../context.ts\").CommandContext,\n\t) => Promise<unknown>;\n\tneedsYes?: boolean;\n}): CommandSpec {\n\treturn {\n\t\tname: options.name,\n\t\tsummary: options.summary,\n\t\tcategory: \"Birthday Board\",\n\t\targs: options.args,\n\t\toptions: options.needsYes\n\t\t\t? [{ name: \"yes\", type: \"boolean\", description: \"Confirm the destructive action.\" }]\n\t\t\t: [],\n\t\texamples: [`line ${options.name} BOARD`],\n\t\tauth: true,\n\t\tasync run(context) {\n\t\t\tif (options.needsYes && !context.getBool(\"yes\")) {\n\t\t\t\tthrow new UsageError(\"Pass --yes to confirm this destructive action\");\n\t\t\t}\n\t\t\treturn await withClient(context, async ({ client }) => {\n\t\t\t\treturn await options.action(client.birthdayBoard, context);\n\t\t\t});\n\t\t},\n\t\tformat: formatBirthday,\n\t};\n}\n\nexport const birthdayCommands: CommandSpec[] = [\n\tboardIdCommand,\n\tboardCommand,\n\tcardsCommand,\n\tcelebrationsCommand,\n\tlikesCommand,\n\ttemplatesCommand,\n\tcreateCommand,\n\tupdateCommand,\n\tsimpleCommand({\n\t\tname: \"birthday delete\",\n\t\tsummary: \"Delete a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\tneedsYes: true,\n\t\taction: (board, context) =>\n\t\t\tboard.deleteCard(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday delete-board\",\n\t\tsummary: \"Delete a birthday board.\",\n\t\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\t\tneedsYes: true,\n\t\taction: (board, context) => board.deleteBoard(context.requireArg(0, \"boardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday permission\",\n\t\tsummary: \"Update birthday board read permission.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"count\", description: \"Read permission count.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.updateReadPermission(\n\t\t\t\tcontext.requireArg(0, \"boardId\"),\n\t\t\t\tNumber(context.requireArg(1, \"count\")),\n\t\t\t),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday like\",\n\t\tsummary: \"Like a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.createCardLike(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday unlike\",\n\t\tsummary: \"Remove a like from a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.cancelCardLike(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday celebrate\",\n\t\tsummary: \"Celebrate a birthday board.\",\n\t\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\t\taction: (board, context) => board.celebrate(context.requireArg(0, \"boardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday cancel-celebration\",\n\t\tsummary: \"Cancel a birthday board celebration.\",\n\t\targs: [{ name: \"boardId\", description: \"Board id.\", required: true }],\n\t\taction: (board, context) => board.cancelCelebration(context.requireArg(0, \"boardId\")),\n\t}),\n\tsimpleCommand({\n\t\tname: \"birthday report\",\n\t\tsummary: \"Report a birthday card.\",\n\t\targs: [\n\t\t\t{ name: \"boardId\", description: \"Board id.\", required: true },\n\t\t\t{ name: \"cardId\", description: \"Card id.\", required: true },\n\t\t],\n\t\taction: (board, context) =>\n\t\t\tboard.reportCard(context.requireArg(0, \"boardId\"), context.requireArg(1, \"cardId\")),\n\t}),\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\nfunction formatCall(value: unknown): string {\n\treturn formatJson(value);\n}\n\nconst routeCommand: CommandSpec = {\n\tname: \"call route\",\n\tsummary: \"Acquire a 1:1 call route.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"to\", description: \"Peer user MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"call-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"AUDIO\", \"VIDEO\"],\n\t\t\tdescription: \"Call type (default AUDIO).\",\n\t\t},\n\t],\n\texamples: [\"line call route uxxxxxxxx --call-type AUDIO\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.call.acquireRoute({\n\t\t\t\tto,\n\t\t\t\tcallType: (context.getString(\"call-type\") ?? \"AUDIO\") as never,\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst groupRouteCommand: CommandSpec = {\n\tname: \"call group-route\",\n\tsummary: \"Acquire a group call route.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"chatMid\", description: \"Group chat MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"media-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"AUDIO\", \"VIDEO\"],\n\t\t\tdescription: \"Media type (default AUDIO).\",\n\t\t},\n\t\t{ name: \"initial-host\", type: \"boolean\", description: \"Request host capability.\" },\n\t\t{\n\t\t\tname: \"capability\",\n\t\t\ttype: \"array\",\n\t\t\tvalueName: \"cap\",\n\t\t\tdescription: \"Capability (repeatable).\",\n\t\t},\n\t],\n\texamples: [\"line call group-route cxxxxxxxx --media-type AUDIO --initial-host\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst capabilities = context.getArray(\"capability\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.acquireGroupCallRoute({\n\t\t\t\tchatMid,\n\t\t\t\tmediaType: (context.getString(\"media-type\") ?? \"AUDIO\") as never,\n\t\t\t\tisInitialHost: context.getBool(\"initial-host\"),\n\t\t\t\tcapabilities: capabilities.length ? capabilities : [\"AUDIO\", \"VIDEO\"],\n\t\t\t} as never);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst groupCommand: CommandSpec = {\n\tname: \"call group\",\n\tsummary: \"Show the current group call state.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"chatMid\", description: \"Group chat MID.\", required: true }],\n\texamples: [\"line call group cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.call.getGroupCall(chatMid);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlListCommand: CommandSpec = {\n\tname: \"call url list\",\n\tsummary: \"List group call URLs.\",\n\tcategory: \"Calls\",\n\texamples: [\"line call url list\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.getGroupCallUrls({} as never);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlCreateCommand: CommandSpec = {\n\tname: \"call url create\",\n\tsummary: \"Create a group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"title\", description: \"URL title.\", required: true }],\n\texamples: [\"line call url create 'Team standup'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst title = context.rest(0);\n\t\tif (!title) throw new UsageError(\"Missing URL title\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.createGroupCallUrl({ request: { title } });\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlGetCommand: CommandSpec = {\n\tname: \"call url get\",\n\tsummary: \"Get information about a group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"ticket\", description: \"Group call URL ticket.\", required: true }],\n\texamples: [\"line call url get TICKET\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst ticket = context.requireArg(0, \"ticket\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.call.getGroupCallUrl(ticket);\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlUpdateCommand: CommandSpec = {\n\tname: \"call url update\",\n\tsummary: \"Update a group call URL.\",\n\tcategory: \"Calls\",\n\toptions: [\n\t\t{ name: \"url-id\", type: \"string\", valueName: \"id\", description: \"Group call URL id.\" },\n\t\t{\n\t\t\tname: \"target-attribute\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"attr\",\n\t\t\tdescription: \"Attribute to update.\",\n\t\t},\n\t],\n\texamples: [\"line call url update --url-id ID --target-attribute TITLE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst urlId = context.requireString(\"url-id\", \"Missing --url-id\");\n\t\tconst targetAttribute = context.requireString(\"target-attribute\", \"Missing --target-attribute\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.updateGroupCallUrl({\n\t\t\t\trequest: { urlId, targetAttribute: targetAttribute as never },\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst urlDeleteCommand: CommandSpec = {\n\tname: \"call url delete\",\n\tsummary: \"Delete a group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"urlId\", description: \"Group call URL id.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm deletion.\" }],\n\texamples: [\"line call url delete ID --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst urlId = context.requireArg(0, \"urlId\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm deletion\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.deleteGroupCallUrl({ request: { urlId } });\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst joinCommand: CommandSpec = {\n\tname: \"call join\",\n\tsummary: \"Join a chat by group call URL.\",\n\tcategory: \"Calls\",\n\targs: [{ name: \"urlId\", description: \"Group call URL id.\", required: true }],\n\texamples: [\"line call join ID\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst urlId = context.requireArg(0, \"urlId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.joinChatByCallUrl({\n\t\t\t\trequest: { urlId, reqSeq: await base.getReqseq() },\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nconst inviteCommand: CommandSpec = {\n\tname: \"call invite\",\n\tsummary: \"Invite users to a group call.\",\n\tcategory: \"Calls\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Group chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID(s).\", required: true, variadic: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"media-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"AUDIO\", \"VIDEO\"],\n\t\t\tdescription: \"Media type (default AUDIO).\",\n\t\t},\n\t],\n\texamples: [\"line call invite cxxxxxxxx uxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst memberMids = context.positionals.slice(1);\n\t\tif (!memberMids.length) throw new UsageError(\"Pass at least one user MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.call.inviteIntoGroupCall({\n\t\t\t\tchatMid,\n\t\t\t\tmemberMids,\n\t\t\t\tmediaType: (context.getString(\"media-type\") ?? \"AUDIO\") as never,\n\t\t\t} as never);\n\t\t\treturn { ok: true, chatMid, memberMids };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; memberMids: string[] };\n\t\treturn `Invited ${result.memberMids.join(\", \")} to the call in ${result.chatMid}`;\n\t},\n};\n\nconst kickCommand: CommandSpec = {\n\tname: \"call kick\",\n\tsummary: \"Remove users from a group call.\",\n\tcategory: \"Calls\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Group chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID(s).\", required: true, variadic: true },\n\t],\n\texamples: [\"line call kick cxxxxxxxx uxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst targetMids = context.positionals.slice(1);\n\t\tif (!targetMids.length) throw new UsageError(\"Pass at least one user MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.call.kickoutFromGroupCall({\n\t\t\t\tkickoutFromGroupCallRequest: { chatMid, targetMids },\n\t\t\t});\n\t\t});\n\t},\n\tformat: formatCall,\n};\n\nexport const callCommands: CommandSpec[] = [\n\trouteCommand,\n\tgroupRouteCommand,\n\tgroupCommand,\n\turlListCommand,\n\turlCreateCommand,\n\turlGetCommand,\n\turlUpdateCommand,\n\turlDeleteCommand,\n\tjoinCommand,\n\tinviteCommand,\n\tkickCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { readFileAsBlob } from \"../files.ts\";\nimport { serialize } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport {\n\tchatSummary,\n\tfetchUserTalkMessages,\n\tisUserMid,\n\tlimitOption,\n\trequireJsonObject,\n\trequireStringRecord,\n\tresolveContentType,\n\ttalkMessageSummary,\n\tuserChatSummary,\n} from \"./shared.ts\";\n\nconst listCommand: CommandSpec = {\n\tname: \"chats list\",\n\tsummary: \"List group and room chats.\",\n\tcategory: \"Chats\",\n\toptions: [\n\t\t{ name: \"name\", type: \"string\", valueName: \"text\", description: \"Filter by chat name.\" },\n\t],\n\texamples: [\"line chats list\", \"line chats list --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chats = await client.fetchJoinedChats();\n\t\t\tconst filter = context.getString(\"name\")?.toLowerCase();\n\t\t\tconst rows = chats\n\t\t\t\t.map((chat) => chatSummary(chat, context.json))\n\t\t\t\t.filter(\n\t\t\t\t\t(row) =>\n\t\t\t\t\t\t!filter ||\n\t\t\t\t\t\tString(row.name ?? \"\")\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.includes(filter),\n\t\t\t\t);\n\t\t\treturn { chats: rows };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chats = (value as { chats: Array<Record<string, unknown>> }).chats;\n\t\tif (!chats.length) return \"No chats.\";\n\t\tconst lines = [\"MID NAME TYPE\"];\n\t\tfor (const chat of chats) {\n\t\t\tlines.push(\n\t\t\t\t`${String(chat.mid ?? \"\")} ${String(chat.name ?? \"\")} ${String(chat.type ?? \"\")}`,\n\t\t\t);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"chats get\",\n\tsummary: \"Show one chat and its members.\",\n\tcategory: \"Chats\",\n\targs: [{ name: \"chatMid\", description: \"Chat MID (c... or r...).\", required: true }],\n\texamples: [\"line chats get cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\treturn chatSummary(chat, true);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chat = value as Record<string, unknown>;\n\t\tconst raw = (chat.raw ?? {}) as Record<string, unknown>;\n\t\tconst lines = [\n\t\t\t`MID: ${String(chat.mid ?? \"\")}`,\n\t\t\t`Name: ${String(chat.name ?? \"\")}`,\n\t\t\t`Type: ${String(chat.type ?? \"\")}`,\n\t\t];\n\t\tif (Array.isArray(raw.members)) lines.push(`Members: ${raw.members.length}`);\n\t\tif (Array.isArray(raw.invitees)) lines.push(`Invitees: ${raw.invitees.length}`);\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst messagesCommand: CommandSpec = {\n\tname: \"chats messages\",\n\tsummary: \"Fetch recent messages from a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t],\n\toptions: [limitOption(20)],\n\texamples: [\"line chats messages cxxxxxxxx -n 50\", \"line chats messages cxxxxxxxx --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 20;\n\t\tif (limit <= 0) throw new UsageError(\"--limit must be positive\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (isUserMid(chatMid)) {\n\t\t\t\tconst messages = await fetchUserTalkMessages(client, chatMid, limit);\n\t\t\t\treturn {\n\t\t\t\t\tchat: userChatSummary(chatMid),\n\t\t\t\t\tmessages: messages.map((message) => talkMessageSummary(message, context.json)),\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\tconst messages = await chat.fetchMessages(limit);\n\t\t\treturn {\n\t\t\t\tchat: chatSummary(chat),\n\t\t\t\tmessages: messages.map((message) => talkMessageSummary(message, context.json)),\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tchat: { name?: string };\n\t\t\tmessages: Array<Record<string, unknown>>;\n\t\t};\n\t\tif (!result.messages.length) return `No messages in ${result.chat.name ?? \"chat\"}.`;\n\t\treturn result.messages\n\t\t\t.map(\n\t\t\t\t(message) =>\n\t\t\t\t\t`[${String(message.createdTime ?? \"\")}] ${String(message.from ?? \"\")}: ${String(\n\t\t\t\t\t\tmessage.text ?? `(${String(message.contentType ?? \"message\")})`,\n\t\t\t\t\t)} (${String(message.id ?? \"\")})`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst sendCommand: CommandSpec = {\n\tname: \"chats send\",\n\tsummary: \"Send a text message to a user or chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID (u... user, c... group, r... room).\", required: true },\n\t\t{ name: \"text\", description: \"Message text (or use --text).\", required: false, variadic: true },\n\t],\n\toptions: [\n\t\t{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Message text.\" },\n\t\t{\n\t\t\tname: \"e2ee\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Use end-to-end encryption (default). Use --no-e2ee to disable.\",\n\t\t},\n\t\t{\n\t\t\tname: \"reply-to\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"messageId\",\n\t\t\tdescription: \"Related message id (reply).\",\n\t\t},\n\t\t{\n\t\t\tname: \"content-type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tdescription: \"LINE ContentType (default NONE).\",\n\t\t},\n\t\t{\n\t\t\tname: \"metadata\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"contentMetadata JSON object.\",\n\t\t},\n\t\t{ name: \"location\", type: \"string\", valueName: \"json\", description: \"Location JSON object.\" },\n\t\t{\n\t\t\tname: \"chunk\",\n\t\t\ttype: \"array\",\n\t\t\tvalueName: \"chunk\",\n\t\t\tdescription: \"Pre-encrypted chunk (repeatable; advanced).\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line chats send uxxxxxxxx 'Hello from linejs'\",\n\t\t'line chats send cxxxxxxxx --text \"Hi\" --no-e2ee',\n\t\t'line chats send cxxxxxxxx \"reply\" --reply-to 123456789',\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(1);\n\t\tconst metadata = requireStringRecord(context, \"metadata\");\n\t\tconst location = requireJsonObject<Record<string, unknown>>(context, \"location\");\n\t\tconst chunks = context.getArray(\"chunk\");\n\t\tconst contentType = resolveContentType(context.getString(\"content-type\"));\n\t\tif (!text && !metadata && !location && !chunks.length) {\n\t\t\tthrow new UsageError(\"Nothing to send. Pass message text or content options.\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst message = await base.talk.sendMessage({\n\t\t\t\tto,\n\t\t\t\ttext: text || undefined,\n\t\t\t\te2ee: context.getBool(\"e2ee\", true),\n\t\t\t\tcontentType: contentType as never,\n\t\t\t\tcontentMetadata: metadata,\n\t\t\t\trelatedMessageId: context.getString(\"reply-to\"),\n\t\t\t\tlocation: location as never,\n\t\t\t\tchunks: chunks.length ? chunks : undefined,\n\t\t\t});\n\t\t\treturn { ok: true, message };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst message = (value as { message: Record<string, unknown> }).message;\n\t\treturn `Sent message ${String(message.id ?? \"\")} to ${String(message.to ?? \"\")}`;\n\t},\n};\n\nconst sendMediaCommand: CommandSpec = {\n\tname: \"chats send-media\",\n\tsummary: \"Send an E2EE image, video, audio, file, or GIF to a user or chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID (u... or c...).\", required: true },\n\t\t{ name: \"file\", description: \"File to upload.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\", \"audio\", \"file\", \"gif\"],\n\t\t\tdescription: \"Media type. Defaults from the file extension.\",\n\t\t},\n\t\t{ name: \"preview\", type: \"string\", valueName: \"path\", description: \"Preview/thumbnail image.\" },\n\t\t{\n\t\t\tname: \"duration-ms\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"ms\",\n\t\t\tdescription: \"Video/audio duration in milliseconds.\",\n\t\t},\n\t\t{ name: \"filename\", type: \"string\", valueName: \"name\", description: \"Display filename.\" },\n\t],\n\texamples: [\n\t\t\"line chats send-media uxxxxxxxx ./photo.jpg\",\n\t\t\"line chats send-media cxxxxxxxx ./clip.mp4 --type video --duration-ms 12000\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tif (!(to.startsWith(\"u\") || to.startsWith(\"c\"))) {\n\t\t\tthrow new UsageError(\"E2EE media can only be sent to u... or c... MIDs\");\n\t\t}\n\t\tconst file = await readFileAsBlob(context.requireArg(1, \"file\"), context.settings.cwd);\n\t\tconst preview = context.getString(\"preview\")\n\t\t\t? await readFileAsBlob(context.getString(\"preview\")!, context.settings.cwd)\n\t\t\t: undefined;\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\")\n\t\t\t\t? \"video\"\n\t\t\t\t: file.blob.type.startsWith(\"audio/\")\n\t\t\t\t\t? \"audio\"\n\t\t\t\t\t: file.blob.type === \"image/gif\"\n\t\t\t\t\t\t? \"gif\"\n\t\t\t\t\t\t: file.blob.type.startsWith(\"image/\")\n\t\t\t\t\t\t\t? \"image\"\n\t\t\t\t\t\t\t: \"file\")) as \"image\" | \"video\" | \"audio\" | \"file\" | \"gif\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst message = await base.obs.uploadMediaByE2EE({\n\t\t\t\tdata: file.blob,\n\t\t\t\toType: type,\n\t\t\t\tto,\n\t\t\t\tfilename: context.getString(\"filename\") ?? file.filename,\n\t\t\t\tpreview: preview?.blob,\n\t\t\t\tdurationMs: context.getNumber(\"duration-ms\"),\n\t\t\t});\n\t\t\treturn { ok: true, message, type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { message: Record<string, unknown>; type: string };\n\t\treturn `Sent ${result.type} as message ${String(result.message.id ?? \"\")}`;\n\t},\n};\n\nconst compactCommand: CommandSpec = {\n\tname: \"chats compact\",\n\tsummary: \"Send a compact (/CA5 or /ECA5) text message.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID.\", required: true },\n\t\t{ name: \"text\", description: \"Message text.\", required: false, variadic: true },\n\t],\n\toptions: [{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Message text.\" }],\n\texamples: [\"line chats compact uxxxxxxxx 'hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(1);\n\t\tif (!text) throw new UsageError(\"Missing message text\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst response = await client.sendCompactMessage(to, text);\n\t\t\treturn { ok: true, response };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent compact message: ${JSON.stringify(serialize(value))}`;\n\t},\n};\n\nconst createCommand: CommandSpec = {\n\tname: \"chats create\",\n\tsummary: \"Create a group or room chat.\",\n\tcategory: \"Chats\",\n\toptions: [\n\t\t{ name: \"mid\", type: \"array\", valueName: \"mid\", description: \"Target user MID (repeatable).\" },\n\t\t{ name: \"name\", type: \"string\", valueName: \"name\", description: \"Chat name.\" },\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"GROUP\", \"ROOM\"],\n\t\t\tdescription: \"Chat type (default GROUP).\",\n\t\t},\n\t\t{\n\t\t\tname: \"picture-path\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"path\",\n\t\t\tdescription: \"Chat picture OBS path.\",\n\t\t},\n\t],\n\texamples: [\"line chats create --mid uxxxx --mid uyyyy --name 'Project'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mids = context.getArray(\"mid\");\n\t\tif (!mids.length) throw new UsageError(\"Pass at least one --mid\");\n\t\tconst type = context.getString(\"type\") ?? \"GROUP\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.createChat({\n\t\t\t\trequest: {\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t\ttargetUserMids: mids,\n\t\t\t\t\ttype: type as never,\n\t\t\t\t\tname: context.getString(\"name\"),\n\t\t\t\t\tpicturePath: context.getString(\"picture-path\"),\n\t\t\t\t},\n\t\t\t} as never);\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = (value as { result: Record<string, unknown> }).result;\n\t\treturn `Created chat ${String(result.chatMid ?? JSON.stringify(serialize(result)))}`;\n\t},\n};\n\nconst inviteCommand: CommandSpec = {\n\tname: \"chats invite\",\n\tsummary: \"Invite users to a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID(s) to invite.\", required: true, variadic: true },\n\t],\n\texamples: [\"line chats invite cxxxxxxxx uxxxx uyyyy\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst mids = context.positionals.slice(1);\n\t\tif (!mids.length) throw new UsageError(\"Pass at least one user MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.inviteIntoChat({ chatMid, targetUserMids: mids });\n\t\t\treturn { ok: true, chatMid, mids, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; mids: string[] };\n\t\treturn `Invited ${result.mids.join(\", \")} to ${result.chatMid}`;\n\t},\n};\n\nconst kickCommand: CommandSpec = {\n\tname: \"chats kick\",\n\tsummary: \"Remove a user from a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"User MID to remove.\", required: true },\n\t],\n\texamples: [\"line chats kick cxxxxxxxx uxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst mid = context.requireArg(1, \"mid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.deleteOtherFromChat({\n\t\t\t\trequest: {\n\t\t\t\t\tchatMid,\n\t\t\t\t\ttargetUserMids: [mid],\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, mid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; mid: string };\n\t\treturn `Removed ${result.mid} from ${result.chatMid}`;\n\t},\n};\n\nconst leaveCommand: CommandSpec = {\n\tname: \"chats leave\",\n\tsummary: \"Leave a chat.\",\n\tcategory: \"Chats\",\n\targs: [{ name: \"chatMid\", description: \"Chat MID.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Skip the confirmation prompt.\" }],\n\texamples: [\"line chats leave cxxxxxxxx --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tif (!context.getBool(\"yes\")) {\n\t\t\tthrow new UsageError(\"Pass --yes to confirm leaving the chat\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.deleteSelfFromChat({\n\t\t\t\trequest: { chatMid, reqSeq: await base.getReqseq() },\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Left ${(value as { chatMid: string }).chatMid}`;\n\t},\n};\n\nconst renameCommand: CommandSpec = {\n\tname: \"chats rename\",\n\tsummary: \"Rename a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"name\", description: \"New chat name.\", required: true },\n\t],\n\texamples: [\"line chats rename cxxxxxxxx 'New name'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst name = context.rest(1);\n\t\tif (!name) throw new UsageError(\"Missing chat name\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.talk.updateChat({\n\t\t\t\trequest: {\n\t\t\t\t\tupdatedAttribute: \"NAME\",\n\t\t\t\t\tchat: { chatMid, chatName: name },\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, name, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; name: string };\n\t\treturn `Renamed ${result.chatMid} to ${result.name}`;\n\t},\n};\n\nconst bgmGetCommand: CommandSpec = {\n\tname: \"chats bgm get\",\n\tsummary: \"Show the BGM set on a chat.\",\n\tcategory: \"Chats\",\n\targs: [{ name: \"chatMid\", description: \"Chat MID.\", required: true }],\n\texamples: [\"line chats bgm get cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\tconst bgm = await chat.getBgm();\n\t\t\treturn { chatMid, bgm: bgm ?? null };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; bgm: Record<string, unknown> | null };\n\t\treturn result.bgm\n\t\t\t? `BGM for ${result.chatMid}: ${String(result.bgm.chatRoomBGMInfo ?? \"\")}`\n\t\t\t: `No BGM set on ${result.chatMid}.`;\n\t},\n};\n\nconst bgmSetCommand: CommandSpec = {\n\tname: \"chats bgm set\",\n\tsummary: \"Set or clear the BGM on a chat.\",\n\tcategory: \"Chats\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"info\", description: \"BGM info (LINE MUSIC id); omit with --clear.\", required: false },\n\t],\n\toptions: [{ name: \"clear\", type: \"boolean\", description: \"Clear the BGM.\" }],\n\texamples: [\"line chats bgm set cxxxxxxxx 'bgm-info'\", \"line chats bgm set cxxxxxxxx --clear\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst clear = context.getBool(\"clear\");\n\t\tconst info = context.arg(1);\n\t\tif (!clear && !info) throw new UsageError(\"Pass BGM info or --clear\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getChat(chatMid);\n\t\t\tconst bgm = await chat.setBgm(clear ? null : info!);\n\t\t\treturn { ok: true, chatMid, bgm };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Updated BGM for ${(value as { chatMid: string }).chatMid}`;\n\t},\n};\n\nexport const chatsCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\tmessagesCommand,\n\tsendCommand,\n\tsendMediaCommand,\n\tcompactCommand,\n\tcreateCommand,\n\tinviteCommand,\n\tkickCommand,\n\tleaveCommand,\n\trenameCommand,\n\tbgmGetCommand,\n\tbgmSetCommand,\n];\n","import type { User } from \"@evex-dev/linejs\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { withClient } from \"../session.ts\";\nimport { asRecord, summaryLine, userSummary } from \"./shared.ts\";\n\nfunction contactSummaryFromRaw(raw: unknown): Record<string, unknown> {\n\tconst record = asRecord(raw);\n\tconst profile = asRecord(record.targetProfileDetail);\n\tconst status = asRecord(profile.statusMessage);\n\treturn {\n\t\tmid: record.targetUserMid ?? record.mid,\n\t\tdisplayName: profile.profileName ?? record.displayName,\n\t\tstatusMessage: status.value ?? record.statusMessage,\n\t\tpicturePath: profile.picturePath ?? record.picturePath,\n\t\tpictureStatus: profile.pictureStatus ?? record.pictureStatus,\n\t\tmusicProfile: profile.musicProfile ?? record.musicProfile,\n\t\thiddenFromList: profile.hiddenFromList ?? record.hiddenFromList,\n\t};\n}\n\nconst listCommand: CommandSpec = {\n\tname: \"contacts list\",\n\tsummary: \"List friends.\",\n\tcategory: \"Contacts\",\n\toptions: [\n\t\t{\n\t\t\tname: \"status\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"text\",\n\t\t\tdescription: \"Filter by text in name or status.\",\n\t\t},\n\t],\n\texamples: [\"line contacts list\", \"line contacts list --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst users = await client.fetchUsers();\n\t\t\tconst filter = context.getString(\"status\")?.toLowerCase();\n\t\t\tconst rows = users\n\t\t\t\t.map((user) => userSummary(user, context.json))\n\t\t\t\t.filter((row) => {\n\t\t\t\t\tif (!filter) return true;\n\t\t\t\t\treturn (\n\t\t\t\t\t\tString(row.displayName ?? \"\")\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.includes(filter) ||\n\t\t\t\t\t\tString(row.statusMessage ?? \"\")\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.includes(filter)\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\treturn { contacts: rows };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst rows = (value as { contacts: Array<Record<string, unknown>> }).contacts;\n\t\tif (!rows.length) return \"No contacts.\";\n\t\tconst lines = [\"MID DISPLAY NAME STATUS\"];\n\t\tfor (const row of rows) {\n\t\t\tlines.push(\n\t\t\t\t`${String(row.mid ?? \"\")} ${String(row.displayName ?? \"\")} ${String(row.statusMessage ?? \"\")}`,\n\t\t\t);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"contacts get\",\n\tsummary: \"Show one contact by MID.\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID (u...).\", required: true }],\n\texamples: [\"line contacts get uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst user = await client.getUser(mid);\n\t\t\treturn userSummary(user, context.json);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst record = value as Record<string, unknown>;\n\t\treturn [\n\t\t\t`MID: ${String(record.mid ?? \"\")}`,\n\t\t\t`Name: ${String(record.displayName ?? \"\")}`,\n\t\t\t`Status: ${String(record.statusMessage ?? \"\")}`,\n\t\t\t`Picture: ${String(record.pictureStatus ?? \"\")}`,\n\t\t].join(\"\\n\");\n\t},\n};\n\nconst addCommand: CommandSpec = {\n\tname: \"contacts add\",\n\tsummary: \"Add a friend by MID, LINE ID, or phone number.\",\n\tcategory: \"Contacts\",\n\toptions: [\n\t\t{ name: \"mid\", type: \"string\", valueName: \"mid\", description: \"Target user MID.\" },\n\t\t{\n\t\t\tname: \"user-id\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"id\",\n\t\t\tdescription: \"LINE ID (include @ for official accounts).\",\n\t\t},\n\t\t{\n\t\t\tname: \"phone\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"e164\",\n\t\t\tdescription: \"Phone number in E.164 form.\",\n\t\t},\n\t\t{\n\t\t\tname: \"reference\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"Tracking reference JSON for MID adds.\",\n\t\t},\n\t\t{\n\t\t\tname: \"tracking-meta-hint\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"hint\",\n\t\t\tdescription: \"Tracking meta hint for MID adds.\",\n\t\t},\n\t\t{\n\t\t\tname: \"tracking-meta-type\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"n\",\n\t\t\tdescription: \"Tracking meta type for MID adds.\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line contacts add --mid uxxxxxxxx\",\n\t\t'line contacts add --user-id \"@livecast\"',\n\t\t\"line contacts add --phone +819012345678\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.getString(\"mid\");\n\t\tconst userId = context.getString(\"user-id\");\n\t\tconst phone = context.getString(\"phone\");\n\t\tconst selected = [mid, userId, phone].filter(Boolean);\n\t\tif (selected.length !== 1) {\n\t\t\tthrow new UsageError(\"Pass exactly one of --mid, --user-id, or --phone\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (mid) {\n\t\t\t\tconst result = await base.relation.addFriendByMid({\n\t\t\t\t\tmid,\n\t\t\t\t\t...(context.getString(\"reference\") ? { reference: context.getString(\"reference\")! } : {}),\n\t\t\t\t\t...(context.getString(\"tracking-meta-hint\")\n\t\t\t\t\t\t? { trackingMetaHint: context.getString(\"tracking-meta-hint\")! }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(context.getNumber(\"tracking-meta-type\") !== undefined\n\t\t\t\t\t\t? { trackingMetaType: context.getNumber(\"tracking-meta-type\")! }\n\t\t\t\t\t\t: {}),\n\t\t\t\t});\n\t\t\t\treturn { ok: true, target: { mid }, result };\n\t\t\t}\n\t\t\tif (userId) {\n\t\t\t\tconst result = await base.relation.addFriendByUserId({ userId });\n\t\t\t\treturn { ok: true, target: { userId }, result };\n\t\t\t}\n\t\t\tconst result = await base.relation.addFriendByPhone({ phone: phone! });\n\t\t\treturn { ok: true, target: { phone }, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Friend request sent: ${summaryLine((value as { target: Record<string, unknown> }).target)}`;\n\t},\n};\n\nconst searchCommand: CommandSpec = {\n\tname: \"contacts search\",\n\tsummary: \"Look up a contact by LINE ID or phone number.\",\n\tcategory: \"Contacts\",\n\toptions: [\n\t\t{ name: \"id\", type: \"string\", valueName: \"searchId\", description: \"LINE ID or ticket.\" },\n\t\t{\n\t\t\tname: \"phone\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"e164\",\n\t\t\tdescription: \"Phone number in E.164 form.\",\n\t\t},\n\t],\n\texamples: ['line contacts search --id \"@livecast\"', \"line contacts search --phone +819012345678\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst id = context.getString(\"id\");\n\t\tconst phone = context.getString(\"phone\");\n\t\tif (Boolean(id) === Boolean(phone)) {\n\t\t\tthrow new UsageError(\"Pass exactly one of --id or --phone\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (id) {\n\t\t\t\tconst contact = await base.relation.findContactBySearchIdOrTicketV3({ searchId: id });\n\t\t\t\treturn { contact: contactSummaryFromRaw(contact), raw: context.json ? contact : undefined };\n\t\t\t}\n\t\t\tconst contact = await base.relation.findContactByPhoneV3({ phone: phone! });\n\t\t\treturn { contact: contactSummaryFromRaw(contact), raw: context.json ? contact : undefined };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst contact = (value as { contact: Record<string, unknown> }).contact;\n\t\treturn [\n\t\t\t`MID: ${String(contact.mid ?? \"\")}`,\n\t\t\t`Name: ${String(contact.displayName ?? \"\")}`,\n\t\t\t`Status: ${String(contact.statusMessage ?? \"\")}`,\n\t\t].join(\"\\n\");\n\t},\n};\n\nconst renameCommand: CommandSpec = {\n\tname: \"contacts rename\",\n\tsummary: \"Set or clear a display-name override for a contact.\",\n\tcategory: \"Contacts\",\n\targs: [\n\t\t{ name: \"mid\", description: \"User MID.\", required: true },\n\t\t{ name: \"name\", description: \"New display name (omit with --clear).\", required: false },\n\t],\n\toptions: [{ name: \"clear\", type: \"boolean\", description: \"Remove the display-name override.\" }],\n\texamples: [\"line contacts rename uxxxxxxxx Alice\", \"line contacts rename uxxxxxxxx --clear\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\tconst clear = context.getBool(\"clear\");\n\t\tconst name = context.rest(1);\n\t\tif (!clear && !name) throw new UsageError(\"Pass a display name or --clear\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst user = await client.getUser(mid);\n\t\t\tawait user.rename(clear ? null : name!);\n\t\t\treturn { ok: true, mid, name: clear ? null : name };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { mid: string; name: string | null };\n\t\treturn result.name === null\n\t\t\t? `Cleared display-name override for ${result.mid}`\n\t\t\t: `Renamed ${result.mid} to ${result.name}`;\n\t},\n};\n\nfunction toggleCommand(options: {\n\tname: string;\n\tsummary: string;\n\taction: (user: User, enabled: boolean) => Promise<void>;\n\toptionDescription: string;\n\tformat: (mid: string, enabled: boolean) => string;\n}): CommandSpec {\n\treturn {\n\t\tname: options.name,\n\t\tsummary: options.summary,\n\t\tcategory: \"Contacts\",\n\t\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\t\toptions: [{ name: \"off\", type: \"boolean\", description: options.optionDescription }],\n\t\texamples: [`line ${options.name} uxxxxxxxx`, `line ${options.name} uxxxxxxxx --off`],\n\t\tauth: true,\n\t\tasync run(context) {\n\t\t\tconst mid = context.requireArg(0, \"mid\");\n\t\t\tconst enabled = !context.getBool(\"off\");\n\t\t\treturn await withClient(context, async ({ client }) => {\n\t\t\t\tconst user = await client.getUser(mid);\n\t\t\t\tawait options.action(user, enabled);\n\t\t\t\treturn { ok: true, mid, enabled };\n\t\t\t});\n\t\t},\n\t\tformat(value) {\n\t\t\tconst result = value as { mid: string; enabled: boolean };\n\t\t\treturn options.format(result.mid, result.enabled);\n\t\t},\n\t};\n}\n\nconst favoriteCommand = toggleCommand({\n\tname: \"contacts favorite\",\n\tsummary: \"Mark or unmark a contact as a favorite.\",\n\taction: (user, enabled) => user.setFavorite(enabled),\n\toptionDescription: \"Remove the favorite mark.\",\n\tformat: (mid, enabled) => (enabled ? `Favorited ${mid}` : `Unfavorited ${mid}`),\n});\n\nconst muteCommand = toggleCommand({\n\tname: \"contacts mute\",\n\tsummary: \"Mute or unmute notifications for a contact.\",\n\taction: (user, enabled) => user.setNotificationDisabled(enabled),\n\toptionDescription: \"Unmute instead of mute.\",\n\tformat: (mid, enabled) => (enabled ? `Muted ${mid}` : `Unmuted ${mid}`),\n});\n\nconst hideCommand = toggleCommand({\n\tname: \"contacts hide\",\n\tsummary: \"Hide or unhide a contact from the friend list.\",\n\taction: (user, enabled) => user.setHidden(enabled),\n\toptionDescription: \"Unhide instead of hide.\",\n\tformat: (mid, enabled) => (enabled ? `Hid ${mid}` : `Unhid ${mid}`),\n});\n\nconst calendarCommand: CommandSpec = {\n\tname: \"contacts calendar\",\n\tsummary: \"Fetch a contact's calendar events (for example birthdays).\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"event-kind\",\n\t\t\ttype: \"array\",\n\t\t\tvalueName: \"kind\",\n\t\t\tdescription: \"Filter event kinds (repeatable).\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line contacts calendar uxxxxxxxx\",\n\t\t\"line contacts calendar uxxxxxxxx --event-kind BIRTHDAY\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\tconst kinds = context.getArray(\"event-kind\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst user = await client.getUser(mid);\n\t\t\tconst events = await user.fetchCalendarEvents((kinds.length ? kinds : undefined) as never);\n\t\t\treturn { mid, events };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { mid: string; events: Array<Record<string, unknown>> };\n\t\tif (!result.events.length) return `No calendar events for ${result.mid}.`;\n\t\treturn result.events\n\t\t\t.map((event) =>\n\t\t\t\tsummaryLine({\n\t\t\t\t\tid: event.id,\n\t\t\t\t\tstate: event.state,\n\t\t\t\t\tdate: `${String(event.year)}-${String(event.month)}-${String(event.day)}`,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst blockCommand: CommandSpec = {\n\tname: \"contacts block\",\n\tsummary: \"Block a contact.\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\texamples: [\"line contacts block uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.blockContact({ reqSeq: await base.getReqseq(), id: mid } as never);\n\t\t\treturn { ok: true, mid, blocked: true };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Blocked ${(value as { mid: string }).mid}`;\n\t},\n};\n\nconst unblockCommand: CommandSpec = {\n\tname: \"contacts unblock\",\n\tsummary: \"Unblock a contact.\",\n\tcategory: \"Contacts\",\n\targs: [{ name: \"mid\", description: \"User MID.\", required: true }],\n\texamples: [\"line contacts unblock uxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst mid = context.requireArg(0, \"mid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.unblockContact({\n\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\tid: mid,\n\t\t\t\treference: undefined,\n\t\t\t} as never);\n\t\t\treturn { ok: true, mid, blocked: false };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Unblocked ${(value as { mid: string }).mid}`;\n\t},\n};\n\nconst blockedCommand: CommandSpec = {\n\tname: \"contacts blocked\",\n\tsummary: \"List blocked contacts.\",\n\tcategory: \"Contacts\",\n\texamples: [\"line contacts blocked\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst mids = await base.talk.getBlockedContactIds();\n\t\t\treturn { mids };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst mids = (value as { mids: string[] }).mids;\n\t\treturn mids.length ? mids.join(\"\\n\") : \"No blocked contacts.\";\n\t},\n};\n\nexport const contactsCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\taddCommand,\n\tsearchCommand,\n\trenameCommand,\n\tfavoriteCommand,\n\tmuteCommand,\n\thideCommand,\n\tcalendarCommand,\n\tblockCommand,\n\tunblockCommand,\n\tblockedCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { serialize } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\nconst commonOptions = [\n\t{ name: \"chat-mid\", type: \"string\", valueName: \"mid\", description: \"Chat MID context.\" },\n\t{\n\t\tname: \"liff-id\",\n\t\ttype: \"string\",\n\t\tvalueName: \"id\",\n\t\tdescription: \"LIFF id (default: LINEJS default).\",\n\t},\n\t{ name: \"lang\", type: \"string\", valueName: \"lang\", description: \"Language (default ja_JP).\" },\n] as const;\n\nconst tokenCommand: CommandSpec = {\n\tname: \"liff token\",\n\tsummary: \"Get a LIFF access token.\",\n\tcategory: \"LIFF\",\n\toptions: commonOptions,\n\texamples: [\n\t\t\"line liff token --chat-mid cxxxxxxxx\",\n\t\t\"line liff token --liff-id 2006747340-AoraPvdD\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\tconst token = await client.liff.getToken({\n\t\t\t\tchatMid: context.getString(\"chat-mid\"),\n\t\t\t\tlang: context.getString(\"lang\"),\n\t\t\t});\n\t\t\treturn { token };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { token: string }).token;\n\t},\n};\n\nconst viewCommand: CommandSpec = {\n\tname: \"liff view\",\n\tsummary: \"Issue a LIFF view URL.\",\n\tcategory: \"LIFF\",\n\toptions: commonOptions,\n\texamples: [\"line liff view --chat-mid cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\treturn await client.liff.issueView({\n\t\t\t\tchatMid: context.getString(\"chat-mid\"),\n\t\t\t\tlang: context.getString(\"lang\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as Record<string, unknown>;\n\t\treturn String(result.viewUrl ?? result.liffViewUrl ?? JSON.stringify(serialize(result)));\n\t},\n};\n\nconst shareCommand: CommandSpec = {\n\tname: \"liff share\",\n\tsummary: \"Share one or more LIFF messages to a chat.\",\n\tcategory: \"LIFF\",\n\targs: [{ name: \"to\", description: \"Target chat MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"message\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"One LIFF message as JSON.\",\n\t\t},\n\t\t{\n\t\t\tname: \"messages\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"json\",\n\t\t\tdescription: \"Array of LIFF messages as JSON.\",\n\t\t},\n\t\t{ name: \"liff-id\", type: \"string\", valueName: \"id\", description: \"LIFF id.\" },\n\t\t{ name: \"force\", type: \"boolean\", description: \"Force a new LIFF token.\" },\n\t],\n\texamples: ['line liff share cxxxxxxxx --message \\'{\"type\":\"text\",\"text\":\"Hello\"}\\''],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst one = context.getJson<Record<string, unknown>>(\"message\");\n\t\tconst many = context.getJson<Array<Record<string, unknown>>>(\"messages\");\n\t\tconst messages = many ?? (one ? [one] : undefined);\n\t\tif (!messages?.length) throw new UsageError(\"Pass --message or --messages\");\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\tconst result = await client.liff.shareMessages(to, messages as never, {\n\t\t\t\tforceIssue: context.getBool(\"force\"),\n\t\t\t});\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Shared LIFF message: ${JSON.stringify(serialize((value as { result: unknown }).result))}`;\n\t},\n};\n\nconst shareTextCommand: CommandSpec = {\n\tname: \"liff share-text\",\n\tsummary: \"Share a plain text LIFF message.\",\n\tcategory: \"LIFF\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target chat MID.\", required: true },\n\t\t{ name: \"text\", description: \"Text to share.\", required: true, variadic: true },\n\t],\n\toptions: [\n\t\t{ name: \"liff-id\", type: \"string\", valueName: \"id\", description: \"LIFF id.\" },\n\t\t{ name: \"force\", type: \"boolean\", description: \"Force a new LIFF token.\" },\n\t],\n\texamples: [\"line liff share-text cxxxxxxxx 'Hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst text = context.rest(1);\n\t\tif (!text) throw new UsageError(\"Missing text\");\n\t\tconst liffId = context.getString(\"liff-id\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tif (liffId) client.liff.setDefaultLiffId(liffId);\n\t\t\tconst result = await client.liff.shareMessage(\n\t\t\t\tto,\n\t\t\t\t{ type: \"text\", text },\n\t\t\t\t{ forceIssue: context.getBool(\"force\") },\n\t\t\t);\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Shared LIFF text: ${JSON.stringify(serialize((value as { result: unknown }).result))}`;\n\t},\n};\n\nexport const liffCommands: CommandSpec[] = [\n\ttokenCommand,\n\tviewCommand,\n\tshareCommand,\n\tshareTextCommand,\n];\n","import type { SquareMessage, TalkMessage } from \"@evex-dev/linejs\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { withClient } from \"../session.ts\";\nimport { squareMessageSummary, talkMessageSummary } from \"./shared.ts\";\n\nfunction now(): string {\n\treturn new Date().toISOString();\n}\n\nconst listenCommand: CommandSpec = {\n\tname: \"listen\",\n\tsummary: \"Stream incoming talk/OpenChat events until interrupted.\",\n\tdescription:\n\t\t\"In --json mode every event is written as one JSON object per line (NDJSON), followed by a final summary object. QR/media and diagnostics go to stderr.\",\n\tcategory: \"Events\",\n\toptions: [\n\t\t{\n\t\t\tname: \"talk\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Listen to talk messages (default: true, or false when only --square is given).\",\n\t\t},\n\t\t{ name: \"square\", type: \"boolean\", description: \"Listen to OpenChat events (default: false).\" },\n\t\t{ name: \"events\", type: \"boolean\", description: \"Include raw protocol events.\" },\n\t\t{ name: \"count\", type: \"number\", valueName: \"n\", description: \"Stop after N messages.\" },\n\t\t{\n\t\t\tname: \"duration\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"seconds\",\n\t\t\tdescription: \"Stop after N seconds.\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line listen\",\n\t\t\"line listen --talk --square --count 10\",\n\t\t\"line listen --json --duration 60\",\n\t],\n\tauth: true,\n\tlongRunning: true,\n\tmcp: false,\n\tasync run(context) {\n\t\tconst square = context.getBool(\"square\", false);\n\t\tconst talk = context.has(\"talk\") ? context.getBool(\"talk\") : !square;\n\t\tconst includeEvents = context.getBool(\"events\");\n\t\tconst countLimit = context.getNumber(\"count\");\n\t\tconst duration = context.getNumber(\"duration\");\n\t\tif (!talk && !square) throw new UsageError(\"Enable at least one of --talk or --square\");\n\t\tif (countLimit !== undefined && (!Number.isInteger(countLimit) || countLimit <= 0)) {\n\t\t\tthrow new UsageError(\"--count must be a positive integer\");\n\t\t}\n\t\tif (duration !== undefined && (!Number.isFinite(duration) || duration <= 0)) {\n\t\t\tthrow new UsageError(\"--duration must be a positive number of seconds\");\n\t\t}\n\n\t\treturn await withClient(context, async ({ client, store }) => {\n\t\t\tconst controller = new AbortController();\n\t\t\tconst abort = () => controller.abort();\n\t\t\tif (context.signal.aborted) controller.abort();\n\t\t\tcontext.signal.addEventListener(\"abort\", abort, { once: true });\n\n\t\t\tlet messages = 0;\n\t\t\tlet edits = 0;\n\t\t\tlet events = 0;\n\t\t\tlet timer: NodeJS.Timeout | undefined;\n\t\t\tif (duration !== undefined) {\n\t\t\t\ttimer = setTimeout(() => controller.abort(), duration * 1000);\n\t\t\t\ttimer.unref?.();\n\t\t\t}\n\n\t\t\tconst emit = (type: string, data: Record<string, unknown>, human: string) => {\n\t\t\t\tif (context.json) {\n\t\t\t\t\tcontext.output.jsonLine({ type, at: now(), ...data });\n\t\t\t\t} else {\n\t\t\t\t\tcontext.output.writeLine(`${context.output.dim(now())} ${human}`);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst onMessage = (message: TalkMessage) => {\n\t\t\t\tmessages += 1;\n\t\t\t\tconst summary = talkMessageSummary(message, false);\n\t\t\t\tconst text = message.text || `(${String(summary.contentType ?? \"message\")})`;\n\t\t\t\temit(\"talk\", summary, `talk ${String(summary.from)}: ${text}`);\n\t\t\t\tif (countLimit !== undefined && messages >= countLimit) controller.abort();\n\t\t\t};\n\t\t\tconst onEdit = (message: TalkMessage) => {\n\t\t\t\tedits += 1;\n\t\t\t\tconst summary = talkMessageSummary(message, false);\n\t\t\t\temit(\n\t\t\t\t\t\"talk:edit\",\n\t\t\t\t\tsummary,\n\t\t\t\t\t`talk:edit ${String(summary.from)}: ${message.text || \"(edited message)\"}`,\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst onSquareMessage = (message: SquareMessage) => {\n\t\t\t\tmessages += 1;\n\t\t\t\tconst summary = squareMessageSummary(message, false);\n\t\t\t\tconst text = message.text || `(${String(summary.contentType ?? \"message\")})`;\n\t\t\t\temit(\"square\", summary, `square ${String(summary.from)}: ${text}`);\n\t\t\t\tif (countLimit !== undefined && messages >= countLimit) controller.abort();\n\t\t\t};\n\t\t\tconst onEvent = (event: unknown) => {\n\t\t\t\tevents += 1;\n\t\t\t\tif (includeEvents) {\n\t\t\t\t\tconst type =\n\t\t\t\t\t\tevent && typeof event === \"object\" && \"type\" in event\n\t\t\t\t\t\t\t? String((event as { type: unknown }).type)\n\t\t\t\t\t\t\t: \"unknown\";\n\t\t\t\t\temit(\"talk:event\", { event }, `talk:event ${type}`);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst onSquareEvent = (event: unknown) => {\n\t\t\t\tevents += 1;\n\t\t\t\tif (includeEvents) {\n\t\t\t\t\tconst type =\n\t\t\t\t\t\tevent && typeof event === \"object\" && \"type\" in event\n\t\t\t\t\t\t\t? String((event as { type: unknown }).type)\n\t\t\t\t\t\t\t: \"unknown\";\n\t\t\t\t\temit(\"square:event\", { event }, `square:event ${type}`);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst onIncoming = (event: unknown) => {\n\t\t\t\temit(\"call:incoming\", { event }, \"call:incoming\");\n\t\t\t};\n\t\t\tconst onCancel = (event: unknown) => {\n\t\t\t\temit(\"call:cancel\", { event }, \"call:cancel\");\n\t\t\t};\n\n\t\t\tclient.on(\"message\", onMessage);\n\t\t\tclient.on(\"message:edit\", onEdit);\n\t\t\tclient.on(\"square:message\", onSquareMessage);\n\t\t\tclient.on(\"event\", onEvent);\n\t\t\tclient.on(\"square:event\", onSquareEvent);\n\t\t\tclient.on(\"call:incoming\", onIncoming);\n\t\t\tclient.on(\"call:cancel\", onCancel);\n\n\t\t\tconst stopped = new Promise<void>((resolve) => {\n\t\t\t\tcontroller.signal.addEventListener(\"abort\", () => resolve(), { once: true });\n\t\t\t});\n\n\t\t\tclient.listen({ talk, square, signal: controller.signal });\n\t\t\tif (!context.json) {\n\t\t\t\tcontext.output.writeErrLine(\n\t\t\t\t\t`Listening (talk=${talk}, square=${square}). Press Ctrl+C to stop.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tawait stopped;\n\t\t\tif (timer) clearTimeout(timer);\n\t\t\tcontext.signal.removeEventListener(\"abort\", abort);\n\t\t\t// Give the polling/push loops a moment to observe the abort.\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, 100));\n\t\t\tclient.off(\"message\", onMessage);\n\t\t\tclient.off(\"message:edit\", onEdit);\n\t\t\tclient.off(\"square:message\", onSquareMessage);\n\t\t\tclient.off(\"event\", onEvent);\n\t\t\tclient.off(\"square:event\", onSquareEvent);\n\t\t\tclient.off(\"call:incoming\", onIncoming);\n\t\t\tclient.off(\"call:cancel\", onCancel);\n\t\t\tawait store.flush();\n\n\t\t\tconst summary = { type: \"summary\", listening: false, messages, edits, events };\n\t\t\tif (!context.json) {\n\t\t\t\tcontext.output.writeErrLine(\n\t\t\t\t\t`Stopped. ${messages} message(s), ${edits} edit(s), ${events} event(s).`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn summary;\n\t\t});\n\t},\n\tformat() {\n\t\treturn \"\";\n\t},\n};\n\nexport const listenCommands: CommandSpec[] = [listenCommand];\n","import type { Client } from \"@evex-dev/linejs\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { writeBinaryFile } from \"../files.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport {\n\tfetchTalkMessages,\n\tlimitOption,\n\toutOption,\n\tresolveReaction,\n\ttalkMessageSummary,\n} from \"./shared.ts\";\n\nfunction bigIntId(value: string): bigint {\n\tif (!/^\\d+$/.test(value)) throw new UsageError(`Invalid message id: ${value}`);\n\treturn BigInt(value);\n}\n\nasync function resolveTalkMessage(client: Client, chatMid: string, messageId: string, limit = 100) {\n\tconst messages = await fetchTalkMessages(client, chatMid, limit);\n\tconst message = messages.find((entry) => entry.raw.id === messageId);\n\tif (!message) {\n\t\tthrow new CliError(\n\t\t\t\"NOT_FOUND\",\n\t\t\t`Message ${messageId} was not found in the last ${limit} messages`,\n\t\t\t{\n\t\t\t\tdetails: {\n\t\t\t\t\tchatMid,\n\t\t\t\t\tmessageId,\n\t\t\t\t\tlimit,\n\t\t\t\t\thint: \"Increase --limit or use the raw API command.\",\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t}\n\treturn message;\n}\n\nconst reactCommand: CommandSpec = {\n\tname: \"messages react\",\n\tsummary: \"React to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"messageId\", description: \"Message id (decimal).\", required: true },\n\t\t{\n\t\t\tname: \"reaction\",\n\t\t\tdescription: \"ALL, UNDO, NICE, LOVE, FUN, AMAZING, SAD, OMG, or 0-7.\",\n\t\t\trequired: true,\n\t\t},\n\t],\n\texamples: [\"line messages react 123456789 NICE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst messageId = bigIntId(context.requireArg(0, \"messageId\"));\n\t\tconst reaction = resolveReaction(context.requireArg(1, \"reaction\"));\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.react({ id: messageId, reaction });\n\t\t\treturn { ok: true, messageId: messageId.toString(), reaction };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { messageId: string; reaction: string };\n\t\treturn `Reacted to ${result.messageId} with ${result.reaction}`;\n\t},\n};\n\nconst cancelReactionCommand: CommandSpec = {\n\tname: \"messages cancel-reaction\",\n\tsummary: \"Remove your reaction from a message.\",\n\tcategory: \"Messages\",\n\targs: [{ name: \"messageId\", description: \"Message id.\", required: true }],\n\texamples: [\"line messages cancel-reaction 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst messageId = bigIntId(context.requireArg(0, \"messageId\"));\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.cancelReaction({\n\t\t\t\tcancelReactionRequest: {\n\t\t\t\t\treqSeq: await base.getReqseq(),\n\t\t\t\t\tmessageId,\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, messageId: messageId.toString() };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Canceled reaction on ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nconst unsendCommand: CommandSpec = {\n\tname: \"messages unsend\",\n\tsummary: \"Unsend one of your messages.\",\n\tcategory: \"Messages\",\n\targs: [{ name: \"messageId\", description: \"Message id.\", required: true }],\n\texamples: [\"line messages unsend 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst messageId = context.requireArg(0, \"messageId\");\n\t\tbigIntId(messageId);\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.unsendMessage({ messageId });\n\t\t\treturn { ok: true, messageId };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Unsents ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nconst readCommand: CommandSpec = {\n\tname: \"messages read\",\n\tsummary: \"Mark a chat as read up to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Last read message id.\", required: true },\n\t],\n\texamples: [\"line messages read cxxxxxxxx 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst lastMessageId = context.requireArg(1, \"messageId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tawait base.talk.sendChatChecked({\n\t\t\t\tchatMid,\n\t\t\t\tlastMessageId,\n\t\t\t\tseq: await base.getReqseq(),\n\t\t\t});\n\t\t\treturn { ok: true, chatMid, lastMessageId };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; lastMessageId: string };\n\t\treturn `Marked ${result.chatMid} read up to ${result.lastMessageId}`;\n\t},\n};\n\nconst replyCommand: CommandSpec = {\n\tname: \"messages reply\",\n\tsummary: \"Reply to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"to\", description: \"Target MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id to reply to.\", required: true },\n\t\t{ name: \"text\", description: \"Reply text.\", required: false, variadic: true },\n\t],\n\toptions: [\n\t\t{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Reply text.\" },\n\t\t{ name: \"e2ee\", type: \"boolean\", description: \"Use E2EE (default). Use --no-e2ee to disable.\" },\n\t],\n\texamples: [\"line messages reply cxxxxxxxx 123456789 'Thanks!'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireArg(0, \"to\");\n\t\tconst relatedMessageId = context.requireArg(1, \"messageId\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(2);\n\t\tif (!text) throw new UsageError(\"Missing reply text\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst message = await base.talk.sendMessage({\n\t\t\t\tto,\n\t\t\t\ttext,\n\t\t\t\trelatedMessageId,\n\t\t\t\te2ee: context.getBool(\"e2ee\", true),\n\t\t\t});\n\t\t\treturn { ok: true, message };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent reply ${String((value as { message: Record<string, unknown> }).message.id ?? \"\")}`;\n\t},\n};\n\nconst showCommand: CommandSpec = {\n\tname: \"messages show\",\n\tsummary: \"Show a message with stickers, mentions, flex, and reply metadata.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [limitOption(100)],\n\texamples: [\"line messages show cxxxxxxxx 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 100;\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst message = await resolveTalkMessage(client, chatMid, messageId, limit);\n\t\t\tconst extra: Record<string, unknown> = {};\n\t\t\ttry {\n\t\t\t\textra.stickerUrl = message.getStickerURL();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.emojiUrls = message.collectEmojiURLs();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.mentions = message.getMentions();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.decorations = message.getTextDecorations();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.sharedContact = message.getSharedContact();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.flex = message.getFlex();\n\t\t\t} catch {}\n\t\t\ttry {\n\t\t\t\textra.replyTarget = message.getReplyTarget()?.id;\n\t\t\t} catch {}\n\t\t\treturn {\n\t\t\t\t...talkMessageSummary(message, context.json),\n\t\t\t\t...extra,\n\t\t\t\t...(context.json ? { raw: message.raw } : {}),\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst message = value as Record<string, unknown>;\n\t\treturn formatJson(message);\n\t},\n};\n\nconst pinCommand: CommandSpec = {\n\tname: \"messages pin\",\n\tsummary: \"Pin a message as a chat announcement.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [limitOption(100)],\n\texamples: [\"line messages pin cxxxxxxxx 123456789\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatMid = context.requireArg(0, \"chatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 100;\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst message = await resolveTalkMessage(client, chatMid, messageId, limit);\n\t\t\tawait message.announce();\n\t\t\treturn { ok: true, chatMid, messageId };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { chatMid: string; messageId: string };\n\t\treturn `Pinned ${result.messageId} in ${result.chatMid}`;\n\t},\n};\n\nfunction extensionForMime(type: string): string {\n\tconst map: Record<string, string> = {\n\t\t\"image/jpeg\": \"jpg\",\n\t\t\"image/png\": \"png\",\n\t\t\"image/gif\": \"gif\",\n\t\t\"video/mp4\": \"mp4\",\n\t\t\"audio/mp4\": \"m4a\",\n\t\t\"audio/mpeg\": \"mp3\",\n\t\t\"application/pdf\": \"pdf\",\n\t};\n\treturn map[type] ?? \"bin\";\n}\n\nexport async function downloadTalkMessageData(context: import(\"../context.ts\").CommandContext) {\n\tconst chatMid = context.requireArg(0, \"chatMid\");\n\tconst messageId = context.requireArg(1, \"messageId\");\n\tconst limit = context.getNumber(\"limit\") ?? 100;\n\treturn await withClient(context, async ({ client }) => {\n\t\tconst message = await resolveTalkMessage(client, chatMid, messageId, limit);\n\t\tconst blob = await message.getData(context.getBool(\"preview\"));\n\t\tconst out =\n\t\t\tcontext.getString(\"out\") ??\n\t\t\t`line-${messageId}.${extensionForMime(blob.type || \"application/octet-stream\")}`;\n\t\tconst written = await writeBinaryFile(out, blob, context.settings.cwd);\n\t\treturn { ok: true, ...written, type: blob.type, messageId, chatMid };\n\t});\n}\n\nconst dataOptions = [\n\toutOption(\"Output file (default: line-<messageId>.<ext>).\"),\n\t{\n\t\tname: \"preview\",\n\t\ttype: \"boolean\",\n\t\tdescription: \"Download the preview instead of the original.\",\n\t},\n\tlimitOption(100),\n] as const;\n\nconst dataCommand: CommandSpec = {\n\tname: \"messages data\",\n\tsummary: \"Download the media attached to a message.\",\n\tcategory: \"Messages\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID (c..., r..., or u... for 1:1).\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: dataOptions,\n\texamples: [\"line messages data cxxxxxxxx 123456789 --out ./photo.jpg\"],\n\tauth: true,\n\trun: downloadTalkMessageData,\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number; type: string };\n\t\treturn `Saved ${result.size} bytes (${result.type}) to ${result.path}`;\n\t},\n};\n\nexport const messagesCommands: CommandSpec[] = [\n\treactCommand,\n\tcancelReactionCommand,\n\tunsendCommand,\n\treadCommand,\n\treplyCommand,\n\tshowCommand,\n\tpinCommand,\n\tdataCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { readFileAsBlob, writeBinaryFile } from \"../files.ts\";\nimport { withClient } from \"../session.ts\";\nimport { downloadTalkMessageData } from \"./messages.ts\";\nimport { limitOption, outOption } from \"./shared.ts\";\n\nconst uploadCommand: CommandSpec = {\n\tname: \"media upload\",\n\tsummary: \"Upload a file to a chat, optionally with E2EE.\",\n\tcategory: \"Media\",\n\targs: [{ name: \"file\", description: \"File to upload.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"to\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"mid\",\n\t\t\tdescription: \"Target user/chat MID (required).\",\n\t\t},\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\", \"audio\", \"file\", \"gif\"],\n\t\t\tdescription: \"Media type (default: inferred).\",\n\t\t},\n\t\t{ name: \"filename\", type: \"string\", valueName: \"name\", description: \"Display filename.\" },\n\t\t{ name: \"duration-ms\", type: \"number\", valueName: \"ms\", description: \"Video/audio duration.\" },\n\t\t{\n\t\t\tname: \"e2ee\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Encrypt with LINE E2EE (default: true for u.../c... MIDs).\",\n\t\t},\n\t],\n\texamples: [\n\t\t\"line media upload ./photo.jpg --to uxxxxxxxx\",\n\t\t\"line media upload ./file.pdf --to cxxxxxxxx --type file --no-e2ee\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst to = context.requireString(\"to\", \"Missing --to\");\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\")\n\t\t\t\t? \"video\"\n\t\t\t\t: file.blob.type.startsWith(\"audio/\")\n\t\t\t\t\t? \"audio\"\n\t\t\t\t\t: file.blob.type === \"image/gif\"\n\t\t\t\t\t\t? \"gif\"\n\t\t\t\t\t\t: file.blob.type.startsWith(\"image/\")\n\t\t\t\t\t\t\t? \"image\"\n\t\t\t\t\t\t\t: \"file\")) as \"image\" | \"video\" | \"audio\" | \"file\" | \"gif\";\n\t\tconst useE2ee = context.getBool(\"e2ee\", to.startsWith(\"u\") || to.startsWith(\"c\"));\n\t\tif (useE2ee && !(to.startsWith(\"u\") || to.startsWith(\"c\"))) {\n\t\t\tthrow new UsageError(\"E2EE media can only be sent to u... or c... MIDs\");\n\t\t}\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (useE2ee) {\n\t\t\t\tconst message = await base.obs.uploadMediaByE2EE({\n\t\t\t\t\tdata: file.blob,\n\t\t\t\t\toType: type,\n\t\t\t\t\tto,\n\t\t\t\t\tfilename: context.getString(\"filename\") ?? file.filename,\n\t\t\t\t\tdurationMs: context.getNumber(\"duration-ms\"),\n\t\t\t\t});\n\t\t\t\treturn { ok: true, e2ee: true, type, message };\n\t\t\t}\n\t\t\tconst result = await base.obs.uploadObjTalk(\n\t\t\t\tto,\n\t\t\t\ttype,\n\t\t\t\tfile.blob,\n\t\t\t\tundefined,\n\t\t\t\tcontext.getString(\"filename\") ?? file.filename,\n\t\t\t\tcontext.getNumber(\"duration-ms\"),\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\te2ee: false,\n\t\t\t\ttype,\n\t\t\t\tobjId: result.objId,\n\t\t\t\tobjHash: result.objHash,\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\te2ee: boolean;\n\t\t\ttype: string;\n\t\t\tmessage?: Record<string, unknown>;\n\t\t\tobjId?: string;\n\t\t};\n\t\treturn result.e2ee\n\t\t\t? `Sent E2EE ${result.type} as message ${String(result.message?.id ?? \"\")}`\n\t\t\t: `Uploaded ${result.type} object ${result.objId ?? \"\"}`;\n\t},\n};\n\nconst downloadCommand: CommandSpec = {\n\tname: \"media download\",\n\tsummary: \"Download media attached to a message.\",\n\tcategory: \"Media\",\n\targs: [\n\t\t{ name: \"chatMid\", description: \"Chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [\n\t\toutOption(\"Output file (default: line-<messageId>.<ext>).\"),\n\t\t{\n\t\t\tname: \"preview\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Download the preview instead of the original.\",\n\t\t},\n\t\tlimitOption(100),\n\t],\n\texamples: [\"line media download cxxxxxxxx 123456789 --out ./photo.jpg\"],\n\tauth: true,\n\trun: downloadTalkMessageData,\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number; type: string };\n\t\treturn `Saved ${result.size} bytes (${result.type}) to ${result.path}`;\n\t},\n};\n\nconst objectCommand: CommandSpec = {\n\tname: \"media object\",\n\tsummary: \"Download an OBS object by path and object id.\",\n\tcategory: \"Media\",\n\toptions: [\n\t\t{\n\t\t\tname: \"path\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"obsPath\",\n\t\t\tdescription: \"OBS path (for example talk/m/...).\",\n\t\t},\n\t\t{ name: \"oid\", type: \"string\", valueName: \"oid\", description: \"Object id.\" },\n\t\toutOption(\"Output file (required).\"),\n\t],\n\texamples: [\"line media object --path talk/m/... --oid abc --out ./file.bin\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst obsPath = context.requireString(\"path\", \"Missing --path\");\n\t\tconst oid = context.requireString(\"oid\", \"Missing --oid\");\n\t\tconst out = context.requireString(\"out\", \"Missing --out\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst blob = await base.obs.downloadObjectForService({ obsPath, oid });\n\t\t\tconst written = await writeBinaryFile(out, blob, context.settings.cwd);\n\t\t\treturn { ok: true, ...written, type: blob.type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number };\n\t\treturn `Saved ${result.size} bytes to ${result.path}`;\n\t},\n};\n\nexport const mediaCommands: CommandSpec[] = [uploadCommand, downloadCommand, objectCommand];\n","import type { CommandSpec } from \"../command.ts\";\nimport { writeBinaryFile } from \"../files.ts\";\nimport { withClient } from \"../session.ts\";\nimport { outOption } from \"./shared.ts\";\n\nconst albumsCommand: CommandSpec = {\n\tname: \"moa albums\",\n\tsummary: \"List LINE Album (Moa) albums.\",\n\tcategory: \"Album (Moa)\",\n\toptions: [\n\t\t{ name: \"cursor\", type: \"string\", valueName: \"cursor\", description: \"Pagination cursor.\" },\n\t\t{\n\t\t\tname: \"order-by\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"order\",\n\t\t\tdescription: \"Order (default createTimeDesc).\",\n\t\t},\n\t\t{\n\t\t\tname: \"include\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"fields\",\n\t\t\tdescription: \"Additional fields to include.\",\n\t\t},\n\t],\n\texamples: [\"line moa albums\", \"line moa albums --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.moa.getAlbums({\n\t\t\t\tcursor: context.getString(\"cursor\"),\n\t\t\t\torderBy: context.getString(\"order-by\"),\n\t\t\t\tinclude: context.getString(\"include\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tresult?: { albums?: Array<Record<string, unknown>> };\n\t\t\tcode?: number;\n\t\t\tmessage?: string;\n\t\t};\n\t\tif (result.code !== undefined && result.code !== 0) {\n\t\t\treturn `Moa error ${result.code}: ${result.message ?? \"\"}`;\n\t\t}\n\t\tconst albums = result.result?.albums ?? [];\n\t\tif (!albums.length) return \"No albums.\";\n\t\treturn albums\n\t\t\t.map(\n\t\t\t\t(album) =>\n\t\t\t\t\t`${String(album.albumId ?? \"\")} ${String(album.title ?? \"\")} (${String(\n\t\t\t\t\t\talbum.photoCount ?? 0,\n\t\t\t\t\t)} photos, chat ${String(album.chatId ?? \"\")})`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst photosCommand: CommandSpec = {\n\tname: \"moa photos\",\n\tsummary: \"List photos in a LINE Album album.\",\n\tcategory: \"Album (Moa)\",\n\toptions: [\n\t\t{\n\t\t\tname: \"chat-id\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"mid\",\n\t\t\tdescription: \"Chat MID owning the album.\",\n\t\t},\n\t\t{ name: \"album-id\", type: \"string\", valueName: \"id\", description: \"Album id.\" },\n\t\t{ name: \"cursor\", type: \"string\", valueName: \"cursor\", description: \"Pagination cursor.\" },\n\t\t{ name: \"page-size\", type: \"number\", valueName: \"n\", description: \"Page size (default 100).\" },\n\t\t{\n\t\t\tname: \"order-by\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"order\",\n\t\t\tdescription: \"Order (default createTimeDesc).\",\n\t\t},\n\t\t{\n\t\t\tname: \"include\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"fields\",\n\t\t\tdescription: \"Fields to include (default all).\",\n\t\t},\n\t\t{ name: \"filter-type\", type: \"string\", valueName: \"type\", description: \"Filter type.\" },\n\t\t{\n\t\t\tname: \"target-user\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"mid\",\n\t\t\tdescription: \"Filter by uploader MID.\",\n\t\t},\n\t],\n\texamples: [\"line moa photos --chat-id cxxxxxxxx --album-id 123\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatId = context.requireString(\"chat-id\", \"Missing --chat-id\");\n\t\tconst albumId = context.requireString(\"album-id\", \"Missing --album-id\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.moa.getPhotos({\n\t\t\t\tchatId,\n\t\t\t\talbumId,\n\t\t\t\tcursor: context.getString(\"cursor\"),\n\t\t\t\tpageSize: context.getNumber(\"page-size\"),\n\t\t\t\torderBy: context.getString(\"order-by\"),\n\t\t\t\tinclude: context.getString(\"include\"),\n\t\t\t\tfilterType: context.getString(\"filter-type\"),\n\t\t\t\ttargetUser: context.getString(\"target-user\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tresult?: { photos?: Array<Record<string, unknown>> };\n\t\t\tcode?: number;\n\t\t\tmessage?: string;\n\t\t};\n\t\tif (result.code !== undefined && result.code !== 0) {\n\t\t\treturn `Moa error ${result.code}: ${result.message ?? \"\"}`;\n\t\t}\n\t\tconst photos = result.result?.photos ?? [];\n\t\tif (!photos.length) return \"No photos.\";\n\t\treturn photos\n\t\t\t.map(\n\t\t\t\t(photo) =>\n\t\t\t\t\t`${String(photo.oid ?? photo.photoId ?? photo.id ?? \"\")} ${String(\n\t\t\t\t\t\tphoto.createUserMid ?? \"\",\n\t\t\t\t\t)} ${String(photo.shotTime ?? \"\")}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst downloadCommand: CommandSpec = {\n\tname: \"moa download\",\n\tsummary: \"Download an original photo or video from a LINE Album.\",\n\tcategory: \"Album (Moa)\",\n\toptions: [\n\t\t{ name: \"chat-id\", type: \"string\", valueName: \"mid\", description: \"Chat MID.\" },\n\t\t{ name: \"album-id\", type: \"string\", valueName: \"id\", description: \"Album id.\" },\n\t\t{ name: \"oid\", type: \"string\", valueName: \"oid\", description: \"Object id.\" },\n\t\t{\n\t\t\tname: \"prefix\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"prefix\",\n\t\t\tchoices: [\"album/a\", \"album/v\"],\n\t\t\tdescription: \"Resource prefix (album/a for images, album/v for videos).\",\n\t\t},\n\t\toutOption(\"Output file.\"),\n\t],\n\texamples: [\"line moa download --chat-id cxxxxxxxx --album-id 123 --oid abc --out ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst chatId = context.requireString(\"chat-id\", \"Missing --chat-id\");\n\t\tconst albumId = context.requireString(\"album-id\", \"Missing --album-id\");\n\t\tconst oid = context.requireString(\"oid\", \"Missing --oid\");\n\t\tconst out = context.requireString(\"out\", \"Missing --out\");\n\t\tconst prefix = (context.getString(\"prefix\") ?? \"album/a\") as \"album/a\" | \"album/v\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst data = await base.moa.downloadPhoto({ chatId, albumId, oid, prefix });\n\t\t\tconst written = await writeBinaryFile(out, data, context.settings.cwd);\n\t\t\treturn { ok: true, ...written };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number };\n\t\treturn `Saved ${result.size} bytes to ${result.path}`;\n\t},\n};\n\nexport const moaCommands: CommandSpec[] = [albumsCommand, photosCommand, downloadCommand];\n","import type { CommandSpec } from \"../command.ts\";\n\nconst mcpCommand: CommandSpec = {\n\tname: \"mcp\",\n\tsummary: \"Run the LINEJS CLI as an MCP server over stdio.\",\n\tdescription:\n\t\t\"Exposes two tools: list_linejs_cli (all commands and their metadata) and execute_linejs_cli (argv execution without a shell). Long-running commands such as listen and mcp are not executable through the tools. Also implements MCP Events (webhook delivery): events/list, events/subscribe, and events/unsubscribe.\",\n\tcategory: \"MCP\",\n\toptions: [\n\t\t{\n\t\t\tname: \"transport\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"transport\",\n\t\t\tchoices: [\"stdio\"],\n\t\t\tdescription: \"MCP transport (only stdio is supported).\",\n\t\t},\n\t],\n\texamples: [\"line mcp\"],\n\tauth: false,\n\tlongRunning: true,\n\tmcp: false,\n\tsilent: true,\n\tasync run(context) {\n\t\tconst { runMcpServer } = await import(\"../mcp/server.ts\");\n\t\tconst exitCode = await runMcpServer({\n\t\t\tinput: process.stdin,\n\t\t\toutput: process.stdout,\n\t\t\terror: process.stderr,\n\t\t\tsignal: context.signal,\n\t\t\tprincipal: `stdio:${context.settings.profile.path}`,\n\t\t\tprofile: context.settings.profile.path,\n\t\t});\n\t\treturn { exitCode };\n\t},\n};\n\nexport const mcpCommands: CommandSpec[] = [mcpCommand];\n","import type { Profile } from \"@evex-dev/linejs-types\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readFileAsBlob } from \"../files.ts\";\nimport { withClient } from \"../session.ts\";\n\nconst getCommand: CommandSpec = {\n\tname: \"profile get\",\n\tsummary: \"Show the signed-in user's cached profile.\",\n\tdescription:\n\t\t\"Uses the profile cached by the last login or --check-session. Pass --check-session to refresh it with getProfile().\",\n\tcategory: \"Account\",\n\texamples: [\"line profile get\", \"line --check-session profile get\", \"line profile get --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tif (!base.profile) {\n\t\t\t\tthrow new CliError(\"AUTH_FAILED\", \"No cached profile is available\", {\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\thint: \"Run `line --check-session profile get` (or `line auth login`) once.\",\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn base.profile;\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst profile = value as Record<string, unknown>;\n\t\tconst lines = [\n\t\t\t`Display name: ${profile.displayName ?? \"\"}`,\n\t\t\t`MID: ${profile.mid ?? \"\"}`,\n\t\t\t`User ID: ${profile.userid || \"(not set)\"}`,\n\t\t\t`Status: ${profile.statusMessage ?? \"\"}`,\n\t\t\t`Phone: ${profile.phone || \"(not set)\"}`,\n\t\t\t`Email: ${profile.email || \"(not set)\"}`,\n\t\t\t`Region: ${profile.regionCode ?? \"\"}`,\n\t\t\t`Searchable: userid=${String(profile.allowSearchByUserid)} email=${String(profile.allowSearchByEmail)}`,\n\t\t];\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst updateCommand: CommandSpec = {\n\tname: \"profile update\",\n\tsummary: \"Update display name, status message, and profile settings.\",\n\tcategory: \"Account\",\n\toptions: [\n\t\t{ name: \"display-name\", type: \"string\", valueName: \"name\", description: \"Display name.\" },\n\t\t{ name: \"status-message\", type: \"string\", valueName: \"text\", description: \"Status message.\" },\n\t\t{ name: \"phonetic-name\", type: \"string\", valueName: \"name\", description: \"Phonetic name.\" },\n\t\t{ name: \"music-profile\", type: \"string\", valueName: \"text\", description: \"Music profile.\" },\n\t\t{\n\t\t\tname: \"allow-search-by-userid\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Allow being found by LINE ID (use --no-allow-search-by-userid to disable).\",\n\t\t},\n\t\t{\n\t\t\tname: \"allow-search-by-email\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Allow being found by email (use --no-allow-search-by-email to disable).\",\n\t\t},\n\t\t{\n\t\t\tname: \"hidden-from-list\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Hide from friend lists (use --no-hidden-from-list to show).\",\n\t\t},\n\t],\n\texamples: [\n\t\t'line profile update --display-name \"New name\" --status-message \"Hello\"',\n\t\t\"line profile update --no-allow-search-by-userid\",\n\t],\n\tauth: true,\n\tasync run(context) {\n\t\tconst update = {\n\t\t\t...(context.has(\"display-name\")\n\t\t\t\t? { displayName: context.getString(\"display-name\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"status-message\")\n\t\t\t\t? { statusMessage: context.getString(\"status-message\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"phonetic-name\")\n\t\t\t\t? { phoneticName: context.getString(\"phonetic-name\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"music-profile\")\n\t\t\t\t? { musicProfile: context.getString(\"music-profile\") ?? \"\" }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"allow-search-by-userid\")\n\t\t\t\t? { allowSearchByUserid: context.getBool(\"allow-search-by-userid\") }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"allow-search-by-email\")\n\t\t\t\t? { allowSearchByEmail: context.getBool(\"allow-search-by-email\") }\n\t\t\t\t: {}),\n\t\t\t...(context.has(\"hidden-from-list\")\n\t\t\t\t? { hiddenFromList: context.getBool(\"hidden-from-list\") }\n\t\t\t\t: {}),\n\t\t};\n\t\tif (!Object.keys(update).length) {\n\t\t\tthrow new UsageError(\"Nothing to update. Pass at least one profile option.\");\n\t\t}\n\t\treturn await withClient(context, async ({ client, base, store }) => {\n\t\t\tawait client.updateMyProfile(update);\n\t\t\tconst merged = {\n\t\t\t\t...(base.profile ?? store.data.profile),\n\t\t\t\t...update,\n\t\t\t} as Record<string, unknown>;\n\t\t\tbase.profile = merged as unknown as Profile;\n\t\t\tawait store.setCachedProfile(merged, {\n\t\t\t\t...(typeof merged.mid === \"string\" ? { mid: merged.mid } : {}),\n\t\t\t\t...(typeof merged.displayName === \"string\" ? { displayName: merged.displayName } : {}),\n\t\t\t\t...(typeof merged.statusMessage === \"string\"\n\t\t\t\t\t? { statusMessage: merged.statusMessage }\n\t\t\t\t\t: {}),\n\t\t\t});\n\t\t\treturn { ok: true, update, profile: merged };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { update: Record<string, unknown> };\n\t\tconst lines = [\"Profile updated.\"];\n\t\tfor (const [key, entry] of Object.entries(result.update)) {\n\t\t\tlines.push(` ${key}: ${String(entry)}`);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t},\n};\n\nconst imageCommand: CommandSpec = {\n\tname: \"profile image\",\n\tsummary: \"Upload a new profile picture.\",\n\tcategory: \"Account\",\n\targs: [{ name: \"file\", description: \"Image file (JPEG or PNG).\", required: true }],\n\texamples: [\"line profile image ./avatar.png\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst result = await client.uploadMyProfileImage(file.blob);\n\t\t\treturn { ok: true, ...result, file: file.path, mime: file.blob.type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { objId: string; objHash: string };\n\t\treturn `Profile image uploaded (objId=${result.objId}, hash=${result.objHash})`;\n\t},\n};\n\nconst backgroundCommand: CommandSpec = {\n\tname: \"profile background\",\n\tsummary: \"Upload a new profile background (cover) image.\",\n\tcategory: \"Account\",\n\targs: [{ name: \"file\", description: \"Image file.\", required: true }],\n\texamples: [\"line profile background ./cover.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst result = await client.uploadMyProfileBackground(file.blob);\n\t\t\treturn { ok: true, ...result, file: file.path, mime: file.blob.type };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { objId: string; objHash: string };\n\t\treturn `Profile background uploaded (objId=${result.objId}, hash=${result.objHash})`;\n\t},\n};\n\nexport const profileCommands: CommandSpec[] = [\n\tgetCommand,\n\tupdateCommand,\n\timageCommand,\n\tbackgroundCommand,\n];\n","import { SquareMessage } from \"@evex-dev/linejs\";\nimport { enums } from \"@evex-dev/linejs-types\";\nimport type { CommandSpec } from \"../command.ts\";\nimport { CliError, UsageError } from \"../errors.ts\";\nimport { readFileAsBlob, writeBinaryFile } from \"../files.ts\";\nimport { serialize } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport {\n\tlimitOption,\n\tresolveReaction,\n\tsquareChatSummary,\n\tsquareMessageSummary,\n\tsquareSummary,\n} from \"./shared.ts\";\n\nconst listCommand: CommandSpec = {\n\tname: \"square list\",\n\tsummary: \"List joined OpenChat squares.\",\n\tcategory: \"OpenChat (Square)\",\n\texamples: [\"line square list\", \"line square list --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst squares = await client.fetchJoinedSquares();\n\t\t\treturn { squares: squares.map((square) => squareSummary(square, context.json)) };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst squares = (value as { squares: Array<Record<string, unknown>> }).squares;\n\t\tif (!squares.length) return \"No squares.\";\n\t\treturn squares\n\t\t\t.map((square) => `${String(square.mid ?? \"\")} ${String(square.name ?? \"\")}`)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"square get\",\n\tsummary: \"Show an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareMid\", description: \"Square MID.\", required: true }],\n\texamples: [\"line square get sxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst square = await client.getSquare(squareMid);\n\t\t\treturn squareSummary(square, true);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst square = value as Record<string, unknown>;\n\t\treturn `${String(square.name ?? \"\")} (${String(square.mid ?? \"\")})`;\n\t},\n};\n\nconst chatsCommand: CommandSpec = {\n\tname: \"square chats\",\n\tsummary: \"List joined OpenChat chats.\",\n\tcategory: \"OpenChat (Square)\",\n\texamples: [\"line square chats\", \"line square chats --json\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chats = await client.fetchJoinedSquareChats();\n\t\t\treturn { chats: chats.map((chat) => squareChatSummary(chat, context.json)) };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chats = (value as { chats: Array<Record<string, unknown>> }).chats;\n\t\tif (!chats.length) return \"No OpenChat chats.\";\n\t\treturn chats\n\t\t\t.map(\n\t\t\t\t(chat) =>\n\t\t\t\t\t`${String(chat.mid ?? \"\")} ${String(chat.name ?? \"\")} (square ${String(chat.squareMid ?? \"\")})`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst chatGetCommand: CommandSpec = {\n\tname: \"square chat-get\",\n\tsummary: \"Show one OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\texamples: [\"line square chat-get mxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\treturn squareChatSummary(chat, true);\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst chat = value as Record<string, unknown>;\n\t\treturn `${String(chat.name ?? \"\")} (${String(chat.mid ?? \"\")})`;\n\t},\n};\n\nconst chatMembersCommand: CommandSpec = {\n\tname: \"square chat-members\",\n\tsummary: \"List members of an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\texamples: [\"line square chat-members mxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst members = await chat.getMembers();\n\t\t\treturn { squareChatMid, members };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst members = (value as { members: Array<Record<string, unknown>> }).members;\n\t\tif (!members.length) return \"No members.\";\n\t\treturn members\n\t\t\t.map(\n\t\t\t\t(member) =>\n\t\t\t\t\t`${String(member.squareMemberMid ?? \"\")} state=${String(member.membershipState ?? \"\")}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst chatSendCommand: CommandSpec = {\n\tname: \"square chat-send\",\n\tsummary: \"Send a message to an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"text\", description: \"Message text.\", required: false, variadic: true },\n\t],\n\toptions: [{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Message text.\" }],\n\texamples: [\"line square chat-send mxxxxxxxx 'hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst text = context.getString(\"text\") ?? context.rest(1);\n\t\tif (!text) throw new UsageError(\"Missing message text\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst response = await chat.sendMessage(text);\n\t\t\treturn { ok: true, response };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst response = (value as { response: Record<string, unknown> }).response;\n\t\treturn `Sent OpenChat message: ${JSON.stringify(serialize(response))}`;\n\t},\n};\n\nconst chatMediaCommand: CommandSpec = {\n\tname: \"square chat-media\",\n\tsummary: \"Send an image, video, or audio message to an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"file\", description: \"File to upload.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\", \"audio\"],\n\t\t\tdescription: \"Media type (default: inferred).\",\n\t\t},\n\t\t{\n\t\t\tname: \"duration-ms\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"ms\",\n\t\t\tdescription: \"Duration for video/audio.\",\n\t\t},\n\t],\n\texamples: [\"line square chat-media mxxxxxxxx ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst file = await readFileAsBlob(context.requireArg(1, \"file\"), context.settings.cwd);\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\")\n\t\t\t\t? \"video\"\n\t\t\t\t: file.blob.type.startsWith(\"audio/\")\n\t\t\t\t\t? \"audio\"\n\t\t\t\t\t: \"image\")) as \"image\" | \"video\" | \"audio\";\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst result =\n\t\t\t\ttype === \"image\"\n\t\t\t\t\t? await chat.sendImage(file.blob, file.filename)\n\t\t\t\t\t: type === \"video\"\n\t\t\t\t\t\t? await chat.sendVideo(file.blob, file.filename, context.getNumber(\"duration-ms\"))\n\t\t\t\t\t\t: await chat.sendAudio(file.blob, file.filename, context.getNumber(\"duration-ms\"));\n\t\t\treturn { ok: true, type, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent ${(value as { type: string }).type} to OpenChat`;\n\t},\n};\n\nconst chatRenameCommand: CommandSpec = {\n\tname: \"square chat-rename\",\n\tsummary: \"Rename an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"name\", description: \"New name.\", required: true },\n\t],\n\texamples: [\"line square chat-rename mxxxxxxxx 'New name'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst name = context.rest(1);\n\t\tif (!name) throw new UsageError(\"Missing square name\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst chat = await client.getSquareChat(squareChatMid);\n\t\t\tconst result = await chat.updateName(name);\n\t\t\treturn { ok: true, squareChatMid, name, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Renamed ${(value as { squareChatMid: string }).squareChatMid}`;\n\t},\n};\n\nconst chatInviteCommand: CommandSpec = {\n\tname: \"square chat-invite\",\n\tsummary: \"Invite users to an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"mid\", description: \"Invitee MID(s).\", required: true, variadic: true },\n\t],\n\texamples: [\"line square chat-invite mxxxxxxxx uxxxx uyyyy\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst inviteeMids = context.positionals.slice(1);\n\t\tif (!inviteeMids.length) throw new UsageError(\"Pass at least one invitee MID\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.inviteIntoSquareChat({\n\t\t\t\trequest: { inviteeMids, squareChatMid },\n\t\t\t});\n\t\t\treturn { ok: true, squareChatMid, inviteeMids, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { squareChatMid: string; inviteeMids: string[] };\n\t\treturn `Invited ${result.inviteeMids.join(\", \")} to ${result.squareChatMid}`;\n\t},\n};\n\nconst chatLeaveCommand: CommandSpec = {\n\tname: \"square chat-leave\",\n\tsummary: \"Leave an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"goodbye\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Send a goodbye message (default: true). Use --no-goodbye to skip.\",\n\t\t},\n\t\t{ name: \"yes\", type: \"boolean\", description: \"Confirm leaving the chat.\" },\n\t],\n\texamples: [\"line square chat-leave mxxxxxxxx --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm leaving the chat\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.leaveSquareChat({\n\t\t\t\trequest: {\n\t\t\t\t\tsquareChatMid,\n\t\t\t\t\tsayGoodbye: context.getBool(\"goodbye\", true),\n\t\t\t\t\tsquareChatMemberRevision: 0,\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { ok: true, squareChatMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Left ${(value as { squareChatMid: string }).squareChatMid}`;\n\t},\n};\n\nconst joinCommand: CommandSpec = {\n\tname: \"square join\",\n\tsummary: \"Join an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareMid\", description: \"Square MID.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"display-name\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"name\",\n\t\t\tdescription: \"Display name in the square.\",\n\t\t},\n\t\t{ name: \"passcode\", type: \"string\", valueName: \"code\", description: \"Join passcode.\" },\n\t\t{ name: \"message\", type: \"string\", valueName: \"text\", description: \"Join request message.\" },\n\t],\n\texamples: [\"line square join sxxxxxxxx\", \"line square join sxxxxxxxx --passcode 1234\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst displayName =\n\t\t\t\tcontext.getString(\"display-name\") ?? base.profile?.displayName ?? \"linejs\";\n\t\t\tconst result = await base.square.joinSquare({\n\t\t\t\tsquareMid,\n\t\t\t\tdisplayName,\n\t\t\t\tpassCode: context.getString(\"passcode\"),\n\t\t\t\tjoinMessage: context.getString(\"message\"),\n\t\t\t});\n\t\t\treturn { ok: true, squareMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Joined ${(value as { squareMid: string }).squareMid}`;\n\t},\n};\n\nconst leaveCommand: CommandSpec = {\n\tname: \"square leave\",\n\tsummary: \"Leave an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareMid\", description: \"Square MID.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm leaving the square.\" }],\n\texamples: [\"line square leave sxxxxxxxx --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm leaving the square\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.leaveSquare({ request: { squareMid } });\n\t\t\treturn { ok: true, squareMid, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Left ${(value as { squareMid: string }).squareMid}`;\n\t},\n};\n\nconst createCommand: CommandSpec = {\n\tname: \"square create\",\n\tsummary: \"Create a new OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\toptions: [\n\t\t{ name: \"name\", type: \"string\", valueName: \"name\", description: \"Square name.\" },\n\t\t{\n\t\t\tname: \"display-name\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"name\",\n\t\t\tdescription: \"Your display name in the square.\",\n\t\t},\n\t\t{ name: \"description\", type: \"string\", valueName: \"text\", description: \"Square description.\" },\n\t\t{ name: \"searchable\", type: \"boolean\", description: \"Allow search (default: true).\" },\n\t\t{ name: \"cover\", type: \"string\", valueName: \"obsHash\", description: \"Cover image OBS hash.\" },\n\t],\n\texamples: [\"line square create --name 'My square' --description 'Hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst name = context.requireString(\"name\", \"Missing --name\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.createSquare({\n\t\t\t\tsquareName: name,\n\t\t\t\tdisplayName: context.getString(\"display-name\") ?? base.profile?.displayName ?? \"linejs\",\n\t\t\t\tdescription: context.getString(\"description\"),\n\t\t\t\tsearchable: context.getBool(\"searchable\", true),\n\t\t\t\tprofileImageObsHash: context.getString(\"cover\"),\n\t\t\t});\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = (value as { result: Record<string, unknown> }).result;\n\t\tconst square = result.square as Record<string, unknown> | undefined;\n\t\treturn `Created square ${String(square?.mid ?? JSON.stringify(serialize(result)))}`;\n\t},\n};\n\nconst searchCommand: CommandSpec = {\n\tname: \"square search\",\n\tsummary: \"Search OpenChat squares.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"query\", description: \"Search query.\", required: true }],\n\toptions: [limitOption(20)],\n\texamples: [\"line square search 'music'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst query = context.requireArg(0, \"query\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 20;\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.searchSquares({\n\t\t\t\trequest: { query, continuationToken: \"\", limit },\n\t\t\t});\n\t\t\treturn result;\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { squares?: Array<Record<string, unknown>> };\n\t\tif (!result.squares?.length) return \"No squares found.\";\n\t\treturn result.squares\n\t\t\t.map((square) => `${String(square.mid ?? \"\")} ${String(square.name ?? \"\")}`)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst eventsCommand: CommandSpec = {\n\tname: \"square events\",\n\tsummary: \"Fetch recent events (and messages) for an OpenChat chat.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true }],\n\toptions: [limitOption(50)],\n\texamples: [\"line square events mxxxxxxxx -n 50\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 50;\n\t\treturn await withClient(context, async ({ base, client }) => {\n\t\t\tconst response = await base.square.fetchSquareChatEvents({ squareChatMid, limit });\n\t\t\tconst messages: SquareMessage[] = [];\n\t\t\tfor (const event of response.events) {\n\t\t\t\tconst raw =\n\t\t\t\t\tevent.type === \"SEND_MESSAGE\"\n\t\t\t\t\t\t? event.payload.sendMessage?.squareMessage\n\t\t\t\t\t\t: event.type === \"RECEIVE_MESSAGE\"\n\t\t\t\t\t\t\t? event.payload.receiveMessage?.squareMessage\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\tif (!raw) continue;\n\t\t\t\ttry {\n\t\t\t\t\tmessages.push(SquareMessage.fromRawTalk(raw as never, client));\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tsyncToken: response.syncToken,\n\t\t\t\tevents: response.events,\n\t\t\t\tmessages: messages.map((message) => squareMessageSummary(message, context.json)),\n\t\t\t};\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { messages: Array<Record<string, unknown>> };\n\t\tif (!result.messages.length) return \"No messages.\";\n\t\treturn result.messages\n\t\t\t.map(\n\t\t\t\t(message) =>\n\t\t\t\t\t`[${String(message.createdTime ?? \"\")}] ${String(message.from ?? \"\")}: ${String(\n\t\t\t\t\t\tmessage.text ?? `(${String(message.contentType ?? \"message\")})`,\n\t\t\t\t\t)}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nfunction extensionForMime(type: string): string {\n\tconst map: Record<string, string> = {\n\t\t\"image/jpeg\": \"jpg\",\n\t\t\"image/png\": \"png\",\n\t\t\"image/gif\": \"gif\",\n\t\t\"video/mp4\": \"mp4\",\n\t\t\"audio/mp4\": \"m4a\",\n\t\t\"audio/mpeg\": \"mp3\",\n\t\t\"application/pdf\": \"pdf\",\n\t};\n\treturn map[type] ?? \"bin\";\n}\n\nconst messageDataCommand: CommandSpec = {\n\tname: \"square message-data\",\n\tsummary: \"Download media attached to an OpenChat message.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"out\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"path\",\n\t\t\tdescription: \"Output file (default: square-<id>.<ext>).\",\n\t\t},\n\t\t{\n\t\t\tname: \"preview\",\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Download the preview instead of the original.\",\n\t\t},\n\t\tlimitOption(100),\n\t],\n\texamples: [\"line square message-data mxxxxxxxx 123 --out ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst limit = context.getNumber(\"limit\") ?? 100;\n\t\treturn await withClient(context, async ({ base, client }) => {\n\t\t\tconst response = await base.square.fetchSquareChatEvents({ squareChatMid, limit });\n\t\t\tlet target: SquareMessage | undefined;\n\t\t\tfor (const event of response.events) {\n\t\t\t\tconst raw =\n\t\t\t\t\tevent.type === \"SEND_MESSAGE\"\n\t\t\t\t\t\t? event.payload.sendMessage?.squareMessage\n\t\t\t\t\t\t: event.type === \"RECEIVE_MESSAGE\"\n\t\t\t\t\t\t\t? event.payload.receiveMessage?.squareMessage\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\tif (!raw) continue;\n\t\t\t\tconst message = SquareMessage.fromRawTalk(raw as never, client);\n\t\t\t\tif (message.raw.message.id === messageId) {\n\t\t\t\t\ttarget = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!target) {\n\t\t\t\tthrow new CliError(\n\t\t\t\t\t\"NOT_FOUND\",\n\t\t\t\t\t`Message ${messageId} was not found in the last ${limit} events`,\n\t\t\t\t\t{\n\t\t\t\t\t\tdetails: { squareChatMid, messageId, limit },\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst blob = await target.getData(context.getBool(\"preview\"));\n\t\t\tconst out =\n\t\t\t\tcontext.getString(\"out\") ??\n\t\t\t\t`square-${messageId}.${extensionForMime(blob.type || \"application/octet-stream\")}`;\n\t\t\tconst written = await writeBinaryFile(out, blob, context.settings.cwd);\n\t\t\treturn { ok: true, ...written, type: blob.type, messageId, squareChatMid };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { path: string; size: number; type: string };\n\t\treturn `Saved ${result.size} bytes (${result.type}) to ${result.path}`;\n\t},\n};\n\nconst reactCommand: CommandSpec = {\n\tname: \"square react\",\n\tsummary: \"React to an OpenChat message.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t\t{ name: \"reaction\", description: \"Reaction name or number.\", required: true },\n\t],\n\texamples: [\"line square react mxxxxxxxx 123 NICE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tconst resolved = resolveReaction(context.requireArg(2, \"reaction\"));\n\t\tconst reaction =\n\t\t\ttypeof resolved === \"number\" ? resolved : (enums.MessageReactionType[resolved] as number);\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.reactToMessage({\n\t\t\t\trequest: {\n\t\t\t\t\treqSeq: await base.getReqseq(\"sq\"),\n\t\t\t\t\treactionType: reaction,\n\t\t\t\t\tmessageId,\n\t\t\t\t\tsquareChatMid,\n\t\t\t\t},\n\t\t\t} as never);\n\t\t\treturn { ok: true, squareChatMid, messageId, reaction, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { messageId: string; reaction: number };\n\t\treturn `Reacted to ${result.messageId} with ${result.reaction}`;\n\t},\n};\n\nconst renameCommand: CommandSpec = {\n\tname: \"square rename\",\n\tsummary: \"Rename an OpenChat square.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareMid\", description: \"Square MID.\", required: true },\n\t\t{ name: \"name\", description: \"New square name.\", required: true },\n\t],\n\texamples: [\"line square rename sxxxxxxxx 'New name'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareMid = context.requireArg(0, \"squareMid\");\n\t\tconst name = context.rest(1);\n\t\tif (!name) throw new UsageError(\"Missing square name\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst square = await client.getSquare(squareMid);\n\t\t\tconst result = await square.updateName(name);\n\t\t\treturn { ok: true, squareMid, name, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Renamed ${(value as { squareMid: string }).squareMid}`;\n\t},\n};\n\nconst replyMessageCommand: CommandSpec = {\n\tname: \"square message-reply\",\n\tsummary: \"Reply to an OpenChat message.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t\t{ name: \"text\", description: \"Reply text.\", required: true, variadic: true },\n\t],\n\texamples: [\"line square message-reply mxxxxxxxx 123 'Thanks!'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst relatedMessageId = context.requireArg(1, \"messageId\");\n\t\tconst text = context.rest(2);\n\t\tif (!text) throw new UsageError(\"Missing reply text\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.sendMessage({\n\t\t\t\tsquareChatMid,\n\t\t\t\ttext,\n\t\t\t\trelatedMessageId,\n\t\t\t});\n\t\t\treturn { ok: true, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Sent OpenChat reply: ${JSON.stringify(serialize((value as { result: unknown }).result))}`;\n\t},\n};\n\nconst readMessageCommand: CommandSpec = {\n\tname: \"square message-read\",\n\tsummary: \"Mark an OpenChat message as read.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\texamples: [\"line square message-read mxxxxxxxx 123\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.markAsRead({\n\t\t\t\trequest: { squareChatMid, messageId, threadMid: \"\" },\n\t\t\t});\n\t\t\treturn { ok: true, squareChatMid, messageId, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Marked ${(value as { messageId: string }).messageId} read`;\n\t},\n};\n\nconst unsendMessageCommand: CommandSpec = {\n\tname: \"square message-unsend\",\n\tsummary: \"Unsend one of your OpenChat messages.\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\texamples: [\"line square message-unsend mxxxxxxxx 123\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.unsendMessage({ squareChatMid, messageId });\n\t\t\treturn { ok: true, squareChatMid, messageId, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Unsents ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nconst destroyMessageCommand: CommandSpec = {\n\tname: \"square message-destroy\",\n\tsummary: \"Destroy an OpenChat message (moderation).\",\n\tcategory: \"OpenChat (Square)\",\n\targs: [\n\t\t{ name: \"squareChatMid\", description: \"Square chat MID.\", required: true },\n\t\t{ name: \"messageId\", description: \"Message id.\", required: true },\n\t],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm the destructive action.\" }],\n\texamples: [\"line square message-destroy mxxxxxxxx 123 --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst squareChatMid = context.requireArg(0, \"squareChatMid\");\n\t\tconst messageId = context.requireArg(1, \"messageId\");\n\t\tif (!context.getBool(\"yes\"))\n\t\t\tthrow new UsageError(\"Pass --yes to confirm destroying the message\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.square.destroyMessage({ squareChatMid, messageId });\n\t\t\treturn { ok: true, squareChatMid, messageId, result };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn `Destroyed ${(value as { messageId: string }).messageId}`;\n\t},\n};\n\nexport const squareCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\tchatsCommand,\n\tchatGetCommand,\n\tchatMembersCommand,\n\tchatSendCommand,\n\tchatMediaCommand,\n\tchatRenameCommand,\n\tchatInviteCommand,\n\tchatLeaveCommand,\n\tjoinCommand,\n\tleaveCommand,\n\tcreateCommand,\n\tsearchCommand,\n\teventsCommand,\n\treactCommand,\n\trenameCommand,\n\treplyMessageCommand,\n\treadMessageCommand,\n\tunsendMessageCommand,\n\tdestroyMessageCommand,\n\tmessageDataCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { writeBinaryFile } from \"../files.ts\";\nimport { ProfileStore } from \"../profile-store.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { outOption } from \"./shared.ts\";\n\nasync function openStore(context: import(\"../context.ts\").CommandContext): Promise<ProfileStore> {\n\treturn await ProfileStore.open(context.settings.profile.path, {\n\t\tname: context.settings.profile.name,\n\t});\n}\n\nconst listCommand: CommandSpec = {\n\tname: \"storage list\",\n\tsummary: \"List keys in the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\toptions: [\n\t\t{ name: \"values\", type: \"boolean\", description: \"Include values (may contain secrets).\" },\n\t],\n\texamples: [\"line storage list\", \"line storage list --values --json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst includeValues = context.getBool(\"values\");\n\t\tconst entries = Object.entries(store.data.storage).map(([key, value]) => ({\n\t\t\tkey,\n\t\t\ttype: typeof value,\n\t\t\t...(includeValues ? { value } : {}),\n\t\t}));\n\t\treturn {\n\t\t\tprofile: store.name,\n\t\t\tpath: store.path,\n\t\t\tkeys: entries,\n\t\t};\n\t},\n\tformat(value) {\n\t\tconst result = value as {\n\t\t\tprofile: string;\n\t\t\tpath: string;\n\t\t\tkeys: Array<{ key: string; type: string; value?: unknown }>;\n\t\t};\n\t\tif (!result.keys.length) return `No storage keys in ${result.profile}.`;\n\t\treturn result.keys\n\t\t\t.map((entry) =>\n\t\t\t\tentry.value === undefined\n\t\t\t\t\t? `${entry.key} (${entry.type})`\n\t\t\t\t\t: `${entry.key} (${entry.type}) = ${JSON.stringify(entry.value)}`,\n\t\t\t)\n\t\t\t.join(\"\\n\");\n\t},\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"storage get\",\n\tsummary: \"Read one value from the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\targs: [{ name: \"key\", description: \"Storage key.\", required: true }],\n\texamples: [\"line storage get reqseq\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst key = context.requireArg(0, \"key\");\n\t\treturn { key, value: store.getStorage(key) ?? null };\n\t},\n\tformat(value) {\n\t\tconst result = value as { key: string; value: unknown };\n\t\treturn formatJson(result.value);\n\t},\n};\n\nconst setCommand: CommandSpec = {\n\tname: \"storage set\",\n\tsummary: \"Write one value to the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\targs: [\n\t\t{ name: \"key\", description: \"Storage key.\", required: true },\n\t\t{\n\t\t\tname: \"value\",\n\t\t\tdescription: \"Value (JSON when parseable, otherwise a string).\",\n\t\t\trequired: true,\n\t\t\tvariadic: true,\n\t\t},\n\t],\n\texamples: [\"line storage set myKey 'hello'\", \"line storage set myJson '{\\\"a\\\":1}'\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst key = context.requireArg(0, \"key\");\n\t\tconst raw = context.rest(1);\n\t\tif (!raw) throw new UsageError(\"Missing value\");\n\t\tlet value: unknown;\n\t\ttry {\n\t\t\tvalue = JSON.parse(raw);\n\t\t} catch {\n\t\t\tvalue = raw;\n\t\t}\n\t\tawait store.setStorage(key, value as never);\n\t\tawait store.flush();\n\t\treturn { ok: true, key, value };\n\t},\n\tformat(value) {\n\t\tconst result = value as { key: string; value: unknown };\n\t\treturn `Set ${result.key} = ${JSON.stringify(result.value)}`;\n\t},\n};\n\nconst deleteCommand: CommandSpec = {\n\tname: \"storage delete\",\n\tsummary: \"Delete one key from the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\targs: [{ name: \"key\", description: \"Storage key.\", required: true }],\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm deletion.\" }],\n\texamples: [\"line storage delete myKey --yes\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst key = context.requireArg(0, \"key\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm deletion\");\n\t\tawait store.deleteStorage(key);\n\t\tawait store.flush();\n\t\treturn { ok: true, key };\n\t},\n\tformat(value) {\n\t\treturn `Deleted ${(value as { key: string }).key}`;\n\t},\n};\n\nconst clearCommand: CommandSpec = {\n\tname: \"storage clear\",\n\tsummary: \"Delete every key from the profile's LINEJS storage.\",\n\tcategory: \"Storage\",\n\toptions: [{ name: \"yes\", type: \"boolean\", description: \"Confirm clearing storage.\" }],\n\texamples: [\"line storage clear --yes\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tif (!context.getBool(\"yes\")) {\n\t\t\tthrow new UsageError(\"Pass --yes to confirm clearing storage (this deletes E2EE keys)\");\n\t\t}\n\t\tawait store.clearStorage();\n\t\tawait store.flush();\n\t\treturn { ok: true };\n\t},\n\tformat() {\n\t\treturn \"Cleared profile storage.\";\n\t},\n};\n\nconst exportCommand: CommandSpec = {\n\tname: \"storage export\",\n\tsummary: \"Export the profile's LINEJS storage to a JSON file.\",\n\tcategory: \"Storage\",\n\toptions: [outOption(\"Output file (required).\")],\n\texamples: [\"line storage export --out ./storage.json\"],\n\tauth: false,\n\tasync run(context) {\n\t\tconst store = await openStore(context);\n\t\tconst out = context.requireString(\"out\", \"Missing --out\");\n\t\tconst text = JSON.stringify(store.data.storage, null, 2);\n\t\tconst written = await writeBinaryFile(\n\t\t\tout,\n\t\t\tnew TextEncoder().encode(text),\n\t\t\tcontext.settings.cwd,\n\t\t);\n\t\treturn { ok: true, ...written };\n\t},\n\tformat(value) {\n\t\treturn `Exported storage to ${(value as { path: string }).path}`;\n\t},\n};\n\nexport const storageCommands: CommandSpec[] = [\n\tlistCommand,\n\tgetCommand,\n\tsetCommand,\n\tdeleteCommand,\n\tclearCommand,\n\texportCommand,\n];\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { readFileAsBlob } from \"../files.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\nimport { YES_OPTION } from \"./shared.ts\";\n\nconst postOptions = [\n\t{ name: \"text\", type: \"string\", valueName: \"text\", description: \"Post text.\" },\n\t{\n\t\tname: \"text-size-mode\",\n\t\ttype: \"string\",\n\t\tvalueName: \"mode\",\n\t\tchoices: [\"AUTO\", \"NORMAL\"],\n\t\tdescription: \"Text size mode.\",\n\t},\n\t{\n\t\tname: \"background-color\",\n\t\ttype: \"string\",\n\t\tvalueName: \"hex\",\n\t\tdescription: \"Background color (for example #FFFFFF).\",\n\t},\n\t{\n\t\tname: \"text-animation\",\n\t\ttype: \"string\",\n\t\tvalueName: \"animation\",\n\t\tchoices: [\"NONE\", \"SLIDE\", \"ZOOM\", \"BUZZ\", \"BOUNCE\", \"BLINK\"],\n\t\tdescription: \"Text animation.\",\n\t},\n\t{\n\t\tname: \"read-permission\",\n\t\ttype: \"string\",\n\t\tvalueName: \"type\",\n\t\tchoices: [\"ALL\", \"FRIEND\", \"GROUP\", \"EVENT\", \"NONE\"],\n\t\tdescription: \"Read permission.\",\n\t},\n\t{\n\t\tname: \"shared-post-id\",\n\t\ttype: \"string\",\n\t\tvalueName: \"postId\",\n\t\tdescription: \"Share an existing post.\",\n\t},\n\t{\n\t\tname: \"media-object-id\",\n\t\ttype: \"array\",\n\t\tvalueName: \"objId\",\n\t\tdescription: \"Media object id (repeatable).\",\n\t},\n\t{\n\t\tname: \"media-object-type\",\n\t\ttype: \"array\",\n\t\tvalueName: \"type\",\n\t\tdescription: \"Media object type (repeatable; PHOTO or VIDEO).\",\n\t},\n\t{ name: \"sticker-id\", type: \"array\", valueName: \"id\", description: \"Sticker id (repeatable).\" },\n\t{\n\t\tname: \"sticker-package-id\",\n\t\ttype: \"array\",\n\t\tvalueName: \"id\",\n\t\tdescription: \"Sticker package id (repeatable).\",\n\t},\n\t{\n\t\tname: \"location-latitude\",\n\t\ttype: \"array\",\n\t\tvalueName: \"n\",\n\t\tdescription: \"Location latitude (repeatable).\",\n\t},\n\t{\n\t\tname: \"location-longitude\",\n\t\ttype: \"array\",\n\t\tvalueName: \"n\",\n\t\tdescription: \"Location longitude (repeatable).\",\n\t},\n\t{\n\t\tname: \"location-name\",\n\t\ttype: \"array\",\n\t\tvalueName: \"name\",\n\t\tdescription: \"Location name (repeatable).\",\n\t},\n\t{\n\t\tname: \"source-type\",\n\t\ttype: \"string\",\n\t\tvalueName: \"type\",\n\t\tdescription: \"Source type (default TIMELINE).\",\n\t},\n\t{ name: \"holding-time\", type: \"number\", valueName: \"ms\", description: \"Holding time.\" },\n] as const;\n\nfunction postInput(\n\tcontext: import(\"../context.ts\").CommandContext,\n\thomeId: string,\n\ttextStart: number,\n) {\n\tconst text = context.getString(\"text\") ?? context.rest(textStart);\n\tconst mediaObjectIds = context.getArray(\"media-object-id\");\n\tconst mediaObjectTypes = context.getArray(\"media-object-type\");\n\tif (mediaObjectIds.length && mediaObjectIds.length !== mediaObjectTypes.length) {\n\t\tthrow new UsageError(\"--media-object-id and --media-object-type must have the same length\");\n\t}\n\tconst input: Record<string, unknown> = { homeId };\n\tconst set = (key: string, value: unknown) => {\n\t\tif (value === undefined) return;\n\t\tif (Array.isArray(value) && value.length === 0) return;\n\t\tinput[key] = value;\n\t};\n\tset(\"text\", text || undefined);\n\tset(\"textSizeMode\", context.getString(\"text-size-mode\"));\n\tset(\"backgroundColor\", context.getString(\"background-color\"));\n\tset(\"textAnimation\", context.getString(\"text-animation\"));\n\tset(\"readPermissionType\", context.getString(\"read-permission\"));\n\tset(\"sharedPostId\", context.getString(\"shared-post-id\"));\n\tset(\"mediaObjectIds\", mediaObjectIds);\n\tset(\"mediaObjectTypes\", mediaObjectTypes);\n\tset(\"stickerIds\", context.getArray(\"sticker-id\"));\n\tset(\"stickerPackageIds\", context.getArray(\"sticker-package-id\"));\n\tset(\"locationLatitudes\", context.getArray(\"location-latitude\").map(Number));\n\tset(\"locationLongitudes\", context.getArray(\"location-longitude\").map(Number));\n\tset(\"locationNames\", context.getArray(\"location-name\"));\n\tset(\"sourceType\", context.getString(\"source-type\"));\n\tset(\"holdingTime\", context.getNumber(\"holding-time\"));\n\treturn input;\n}\n\nconst postCommand: CommandSpec = {\n\tname: \"timeline post\",\n\tsummary: \"Create a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group chat MID (c...) or square MID (s...).\", required: true },\n\t\t{ name: \"text\", description: \"Post text.\", required: false, variadic: true },\n\t],\n\toptions: postOptions,\n\texamples: [\"line timeline post cxxxxxxxx 'Hello!'\", \"line note post cxxxxxxxx --text 'Hello'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.timeline.createPost(postInput(context, homeId, 1) as never);\n\t\t\treturn result;\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { code?: number; message?: string };\n\t\treturn result.code === 0 || result.code === undefined\n\t\t\t? \"Post created.\"\n\t\t\t: `Timeline error ${result.code}: ${result.message ?? \"\"}`;\n\t},\n};\n\nconst listCommand: CommandSpec = {\n\tname: \"timeline list\",\n\tsummary: \"List timeline/Note posts.\",\n\tcategory: \"Timeline / Note\",\n\targs: [{ name: \"homeId\", description: \"Group or square MID.\", required: true }],\n\toptions: [\n\t\t{ name: \"post-id\", type: \"string\", valueName: \"postId\", description: \"Fetch one post.\" },\n\t\t{ name: \"updated-time\", type: \"number\", valueName: \"ms\", description: \"Updated-time cursor.\" },\n\t\t{ name: \"source-type\", type: \"string\", valueName: \"type\", description: \"Source type.\" },\n\t],\n\texamples: [\"line timeline list cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.timeline.listPost({\n\t\t\t\thomeId,\n\t\t\t\tpostId: context.getString(\"post-id\"),\n\t\t\t\tupdatedTime: context.getNumber(\"updated-time\"),\n\t\t\t\tsourceType: context.getString(\"source-type\"),\n\t\t\t});\n\t\t\treturn result;\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst getCommand: CommandSpec = {\n\tname: \"timeline get\",\n\tsummary: \"Fetch one timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\texamples: [\"line timeline get cxxxxxxxx 123456\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.getPost({ homeId, postId });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst updateCommand: CommandSpec = {\n\tname: \"timeline update\",\n\tsummary: \"Update a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\toptions: postOptions,\n\texamples: [\"line timeline update cxxxxxxxx 123456 --text 'Edited'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\tconst input = postInput(context, homeId, 2);\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.updatePost({ ...input, postId } as never);\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst deleteCommand: CommandSpec = {\n\tname: \"timeline delete\",\n\tsummary: \"Delete a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\toptions: [YES_OPTION],\n\texamples: [\"line timeline delete cxxxxxxxx 123456 --yes\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\tif (!context.getBool(\"yes\")) throw new UsageError(\"Pass --yes to confirm deleting the post\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.deletePost({ homeId, postId });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst shareCommand: CommandSpec = {\n\tname: \"timeline share\",\n\tsummary: \"Share a timeline/Note post to a chat.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t\t{ name: \"chatMid\", description: \"Destination chat MID.\", required: true },\n\t],\n\texamples: [\"line timeline share cxxxxxxxx 123456 cxxxxxxxx\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst postId = context.requireArg(1, \"postId\");\n\t\tconst chatMid = context.requireArg(2, \"chatMid\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.sharePost({ homeId, postId, chatMid });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst likeCommand: CommandSpec = {\n\tname: \"timeline like\",\n\tsummary: \"Like a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"code\",\n\t\t\tchoices: [\"1003\", \"1001\", \"1002\", \"1004\", \"1006\", \"1005\"],\n\t\t\tdescription: \"Like type (default 1003 GOOD).\",\n\t\t},\n\t],\n\texamples: [\"line timeline like cxxxxxxxx 123456 --type 1001\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst contentId = context.requireArg(1, \"postId\");\n\t\tconst likeType = (context.getString(\"type\") ?? \"1003\") as never;\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.likePost({ homeId, contentId, likeType });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst commentCommand: CommandSpec = {\n\tname: \"timeline comment\",\n\tsummary: \"Comment on a timeline/Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [\n\t\t{ name: \"homeId\", description: \"Group or square MID.\", required: true },\n\t\t{ name: \"postId\", description: \"Post id.\", required: true },\n\t\t{ name: \"text\", description: \"Comment text.\", required: true, variadic: true },\n\t],\n\texamples: [\"line timeline comment cxxxxxxxx 123456 'Nice!'\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst homeId = context.requireArg(0, \"homeId\");\n\t\tconst contentId = context.requireArg(1, \"postId\");\n\t\tconst commentText = context.rest(2);\n\t\tif (!commentText) throw new UsageError(\"Missing comment text\");\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\treturn await base.timeline.createComment({ homeId, contentId, commentText });\n\t\t});\n\t},\n\tformat: formatTimeline,\n};\n\nconst uploadCommand: CommandSpec = {\n\tname: \"timeline upload\",\n\tsummary: \"Upload an image or video for a Note post.\",\n\tcategory: \"Timeline / Note\",\n\targs: [{ name: \"file\", description: \"Image or video file.\", required: true }],\n\toptions: [\n\t\t{\n\t\t\tname: \"type\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"type\",\n\t\t\tchoices: [\"image\", \"video\"],\n\t\t\tdescription: \"Media type (default: inferred).\",\n\t\t},\n\t],\n\texamples: [\"line timeline upload ./photo.jpg\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst file = await readFileAsBlob(context.requireArg(0, \"file\"), context.settings.cwd);\n\t\tconst type = (context.getString(\"type\") ??\n\t\t\t(file.blob.type.startsWith(\"video/\") ? \"video\" : \"image\")) as \"image\" | \"video\";\n\t\treturn await withClient(context, async ({ base }) => {\n\t\t\tconst result = await base.timeline.uploadNoteMedia(type, file.blob);\n\t\t\treturn { ...result, type, file: file.path };\n\t\t});\n\t},\n\tformat(value) {\n\t\tconst result = value as { objId: string; objHash: string };\n\t\treturn `Uploaded ${result.objId} (${result.objHash})`;\n\t},\n};\n\nfunction formatTimeline(value: unknown): string {\n\tconst result = value as {\n\t\tcode?: number;\n\t\tmessage?: string;\n\t\tresult?: { posts?: Array<Record<string, unknown>> };\n\t};\n\tif (result.code !== undefined && result.code !== 0) {\n\t\treturn `Timeline error ${result.code}: ${result.message ?? \"\"}`;\n\t}\n\tconst posts = result.result?.posts;\n\tif (Array.isArray(posts)) {\n\t\tif (!posts.length) return \"No posts.\";\n\t\treturn posts\n\t\t\t.map((post) => `${String(post.id ?? post.postId ?? \"\")} ${String(post.text ?? \"\")}`)\n\t\t\t.join(\"\\n\");\n\t}\n\treturn formatJson(value);\n}\n\nexport const timelineCommands: CommandSpec[] = [\n\tpostCommand,\n\tlistCommand,\n\tgetCommand,\n\tupdateCommand,\n\tdeleteCommand,\n\tshareCommand,\n\tlikeCommand,\n\tcommentCommand,\n\tuploadCommand,\n];\n\nexport const noteCommands: CommandSpec[] = timelineCommands\n\t.filter((command) => command.name !== \"timeline upload\")\n\t.map((command) => ({\n\t\t...command,\n\t\tname: command.name.replace(/^timeline/, \"note\"),\n\t\tcategory: \"Timeline / Note\",\n\t\tsummary: command.summary.replace(\"timeline/Note\", \"Note\"),\n\t\texamples: (command.examples ?? []).map((example) =>\n\t\t\texample.replace(/^line timeline/, \"line note\"),\n\t\t),\n\t}));\n","import type { CommandSpec } from \"../command.ts\";\nimport { UsageError } from \"../errors.ts\";\nimport { formatJson } from \"../output.ts\";\nimport { withClient } from \"../session.ts\";\n\n/** Mirrors VoomChannelId exported by the client feature module. */\nconst VOOM_CHANNELS = {\n\tTIMELINE: \"1341209950\",\n\tHOME: \"1341209850\",\n\tHOME26: \"2007835442\",\n\tNOTE: \"1655599932\",\n\tSQUARE_NOTE: \"1657618623\",\n\tALBUM: \"1375220249\",\n} as const;\ntype VoomChannel = keyof typeof VOOM_CHANNELS;\nconst channels = Object.keys(VOOM_CHANNELS) as VoomChannel[];\n\nfunction requireChannel(value: string | undefined): VoomChannel {\n\tif (!value) throw new UsageError(`Missing channel (${channels.join(\", \")})`);\n\tif (!(value in VOOM_CHANNELS)) {\n\t\tthrow new UsageError(`Unknown channel: ${value} (expected ${channels.join(\", \")})`);\n\t}\n\treturn value as VoomChannel;\n}\n\nconst tokenCommand: CommandSpec = {\n\tname: \"voom token\",\n\tsummary: \"Issue a VOOM channel token.\",\n\tcategory: \"VOOM\",\n\targs: [{ name: \"channel\", description: channels.join(\", \"), required: true }],\n\texamples: [\"line voom token TIMELINE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst channel = requireChannel(context.requireArg(0, \"channel\"));\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\tconst token = await client.voom.getToken(channel);\n\t\t\treturn { channel, token };\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn (value as { token: string }).token;\n\t},\n};\n\nconst feedCommand: CommandSpec = {\n\tname: \"voom feed\",\n\tsummary: \"Fetch the VOOM timeline feed.\",\n\tcategory: \"VOOM\",\n\toptions: [\n\t\t{\n\t\t\tname: \"post-limit\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"n\",\n\t\t\tdescription: \"Posts per page (default 10).\",\n\t\t},\n\t\t{\n\t\t\tname: \"following-max-page\",\n\t\t\ttype: \"number\",\n\t\t\tvalueName: \"n\",\n\t\t\tdescription: \"Following pages (default 2).\",\n\t\t},\n\t],\n\texamples: [\"line voom feed\", \"line voom feed --post-limit 20\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.voom.feed({\n\t\t\t\tpostLimit: context.getNumber(\"post-limit\"),\n\t\t\t\tfollowingMaxPage: context.getNumber(\"following-max-page\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn formatJson(value);\n\t},\n};\n\nconst statusCommand: CommandSpec = {\n\tname: \"voom status\",\n\tsummary: \"Fetch the VOOM timeline status.\",\n\tcategory: \"VOOM\",\n\texamples: [\"line voom status\"],\n\tauth: true,\n\tasync run(context) {\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.voom.timelineStatus();\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn formatJson(value);\n\t},\n};\n\nconst callCommand: CommandSpec = {\n\tname: \"voom call\",\n\tsummary: \"Call an arbitrary VOOM REST endpoint.\",\n\tcategory: \"VOOM\",\n\targs: [{ name: \"channel\", description: channels.join(\", \"), required: true }],\n\toptions: [\n\t\t{ name: \"path\", type: \"string\", valueName: \"path\", description: \"REST path (required).\" },\n\t\t{\n\t\t\tname: \"routing\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"prefix\",\n\t\t\tchoices: [\n\t\t\t\t\"MYHOME\",\n\t\t\t\t\"MYHOME_RENEWAL\",\n\t\t\t\t\"TIMELINE\",\n\t\t\t\t\"TIMELINE_GATEWAY\",\n\t\t\t\t\"NOTE\",\n\t\t\t\t\"HOMEAPI\",\n\t\t\t\t\"SQUARE_NOTE\",\n\t\t\t\t\"ALBUM\",\n\t\t\t\t\"STORY\",\n\t\t\t\t\"SOCIAL_NOTIFICATION\",\n\t\t\t\t\"TRANSLATION\",\n\t\t\t],\n\t\t\tdescription: \"Routing prefix.\",\n\t\t},\n\t\t{\n\t\t\tname: \"method\",\n\t\t\ttype: \"string\",\n\t\t\tvalueName: \"method\",\n\t\t\tchoices: [\"GET\", \"POST\", \"PUT\", \"DELETE\"],\n\t\t\tdescription: \"HTTP method.\",\n\t\t},\n\t\t{ name: \"body\", type: \"string\", valueName: \"json\", description: \"JSON request body.\" },\n\t\t{ name: \"host\", type: \"string\", valueName: \"host\", description: \"Host override.\" },\n\t],\n\texamples: [\"line voom call TIMELINE --path /api/v57/timeline/tab/status.json --routing TIMELINE\"],\n\tauth: true,\n\tasync run(context) {\n\t\tconst channel = requireChannel(context.requireArg(0, \"channel\"));\n\t\tconst path = context.requireString(\"path\", \"Missing --path\");\n\t\tconst body = context.getJson(\"body\");\n\t\treturn await withClient(context, async ({ client }) => {\n\t\t\treturn await client.voom.call(channel, {\n\t\t\t\tpath,\n\t\t\t\trouting: context.getString(\"routing\") as never,\n\t\t\t\tmethod: context.getString(\"method\") as never,\n\t\t\t\tbody,\n\t\t\t\thost: context.getString(\"host\"),\n\t\t\t});\n\t\t});\n\t},\n\tformat(value) {\n\t\treturn formatJson(value);\n\t},\n};\n\nexport const voomCommands: CommandSpec[] = [tokenCommand, feedCommand, statusCommand, callCommand];\n","import type { CommandSpec } from \"./command.ts\";\nimport { apiCommands } from \"./commands/api.ts\";\nimport { authCommands } from \"./commands/auth.ts\";\nimport { birthdayCommands } from \"./commands/birthday.ts\";\nimport { callCommands } from \"./commands/call.ts\";\nimport { chatsCommands } from \"./commands/chats.ts\";\nimport { contactsCommands } from \"./commands/contacts.ts\";\nimport { liffCommands } from \"./commands/liff.ts\";\nimport { listenCommands } from \"./commands/listen.ts\";\nimport { mediaCommands } from \"./commands/media.ts\";\nimport { messagesCommands } from \"./commands/messages.ts\";\nimport { moaCommands } from \"./commands/moa.ts\";\nimport { mcpCommands } from \"./commands/mcp.ts\";\nimport { profileCommands } from \"./commands/profile.ts\";\nimport { squareCommands } from \"./commands/square.ts\";\nimport { storageCommands } from \"./commands/storage.ts\";\nimport { timelineCommands, noteCommands } from \"./commands/timeline.ts\";\nimport { voomCommands } from \"./commands/voom.ts\";\n\nexport const allCommands: readonly CommandSpec[] = [\n\t...authCommands,\n\t...profileCommands,\n\t...contactsCommands,\n\t...chatsCommands,\n\t...messagesCommands,\n\t...squareCommands,\n\t...timelineCommands,\n\t...noteCommands,\n\t...moaCommands,\n\t...mediaCommands,\n\t...callCommands,\n\t...liffCommands,\n\t...voomCommands,\n\t...birthdayCommands,\n\t...storageCommands,\n\t...apiCommands,\n\t...listenCommands,\n\t...mcpCommands,\n].sort((a, b) => a.name.localeCompare(b.name));\n\nexport interface CommandResolution {\n\tcommand?: CommandSpec;\n\t/** Resolved command path tokens. */\n\tpath: string[];\n\t/** Tokens left after the command path. */\n\tremaining: string[];\n\t/** Set when the path names a command group instead of an exact command. */\n\tgroup?: string;\n\tgroupCommands?: CommandSpec[];\n\tunknown?: string;\n}\n\n/**\n * Resolve the command path from the first tokens. Command paths are contiguous;\n * parsing stops at the first option or unmatched token.\n */\nexport function resolveCommandTokens(tokens: readonly string[]): CommandResolution {\n\tconst first = tokens[0];\n\tif (!first || first.startsWith(\"-\")) return { path: [], remaining: [] };\n\tconst path = [first];\n\tconst known = allCommands.filter(\n\t\t(command) => command.name === first || command.name.startsWith(`${first} `),\n\t);\n\tif (!known.length) {\n\t\treturn { path, remaining: tokens.slice(1), unknown: first };\n\t}\n\n\tlet index = 1;\n\twhile (index < tokens.length) {\n\t\tconst token = tokens[index]!;\n\t\tif (token.startsWith(\"-\")) break;\n\t\tconst candidate = [...path, token].join(\" \");\n\t\tconst matches = allCommands.filter(\n\t\t\t(command) => command.name === candidate || command.name.startsWith(`${candidate} `),\n\t\t);\n\t\tif (!matches.length) break;\n\t\tpath.push(token);\n\t\tindex += 1;\n\t}\n\n\tconst name = path.join(\" \");\n\tconst exact = allCommands.find((command) => command.name === name);\n\tif (exact) {\n\t\treturn { command: exact, path, remaining: tokens.slice(index) };\n\t}\n\tconst groupCommands = allCommands.filter((command) => command.name.startsWith(`${name} `));\n\treturn {\n\t\tpath,\n\t\tremaining: tokens.slice(index),\n\t\tgroup: name,\n\t\tgroupCommands,\n\t};\n}\n\nexport function findCommandByName(name: string): CommandSpec | undefined {\n\treturn allCommands.find((command) => command.name === name);\n}\n","","import pkg from \"../package.json\" with { type: \"json\" };\n\n/**\n * Version reported by `line --version` and the MCP server.\n *\n * Single-sourced from package.json so a release bump (the publish workflow\n * rewrites the manifest) never needs a second edit here.\n */\nexport const VERSION: string = pkg.version;\n","import { GLOBAL_OPTIONS, type OptionSpec } from \"./args.ts\";\nimport { type CommandSpec, commandMetadata, commandUsage } from \"./command.ts\";\nimport { allCommands } from \"./registry.ts\";\nimport { VERSION } from \"./version.ts\";\n\nexport function describeOption(spec: OptionSpec): string {\n\tconst value =\n\t\tspec.type === \"boolean\"\n\t\t\t? \"\"\n\t\t\t: ` <${spec.valueName ?? (spec.type === \"array\" ? \"value\" : \"value\")}>`;\n\tconst choices = spec.choices?.length ? ` (${spec.choices.join(\"|\")})` : \"\";\n\tconst short = spec.short ? `-${spec.short}, ` : \" \";\n\treturn `${short}--${spec.name}${value}${choices}`;\n}\n\nfunction optionLines(specs: readonly OptionSpec[]): string[] {\n\tconst visible = specs.filter((spec) => !spec.hidden);\n\tconst width = Math.max(...visible.map((spec) => describeOption(spec).length), 0);\n\treturn visible.map((spec) => ` ${describeOption(spec).padEnd(width)} ${spec.description}`);\n}\n\nexport function rootHelp(commands: readonly CommandSpec[] = allCommands): string {\n\tconst lines = [\n\t\t`@evex-dev/linejs-cli ${VERSION}`,\n\t\t\"LINEJS command-line interface\",\n\t\t\"\",\n\t\t\"Usage:\",\n\t\t\" line <command> [options]\",\n\t\t\" line help [command]\",\n\t\t\" line commands [--json]\",\n\t\t\"\",\n\t];\n\tconst categories = new Map<string, CommandSpec[]>();\n\tfor (const command of commands) {\n\t\tconst list = categories.get(command.category) ?? [];\n\t\tlist.push(command);\n\t\tcategories.set(command.category, list);\n\t}\n\tfor (const [category, entries] of categories) {\n\t\tlines.push(`${category}:`);\n\t\tconst width = Math.max(...entries.map((entry) => entry.name.length));\n\t\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tlines.push(` ${entry.name.padEnd(width)} ${entry.summary}`);\n\t\t}\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"Global options:\");\n\tlines.push(...optionLines(GLOBAL_OPTIONS));\n\tlines.push(\"\");\n\tlines.push(\"Environment:\");\n\tlines.push(\" LINEJS_HOME Profile directory (default: ~/.linejs)\");\n\tlines.push(\" LINEJS_PROFILE Default profile name/path when --profile is omitted\");\n\tlines.push(\" NO_COLOR Disable ANSI colors\");\n\tlines.push(\"\");\n\tlines.push(\"Run `line help <command>` for details.\");\n\treturn lines.join(\"\\n\");\n}\n\nexport function groupHelp(group: string, commands: readonly CommandSpec[]): string {\n\tconst entries = commands.filter(\n\t\t(command) => command.name === group || command.name.startsWith(`${group} `),\n\t);\n\tconst lines = [`Usage: line ${group} <command> [options]`, \"\", `${group} commands:`];\n\tconst width = Math.max(...entries.map((entry) => entry.name.length));\n\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\tlines.push(` ${entry.name.padEnd(width)} ${entry.summary}`);\n\t}\n\tlines.push(\"\");\n\tlines.push(\"Global options:\");\n\tlines.push(...optionLines(GLOBAL_OPTIONS));\n\tlines.push(\"\");\n\tlines.push(`Run \\`line help ${group} <command>\\` for details.`);\n\treturn lines.join(\"\\n\");\n}\n\nexport function commandHelp(command: CommandSpec): string {\n\tconst lines = [commandUsage(command), \"\", command.summary];\n\tif (command.description) {\n\t\tlines.push(\"\", command.description);\n\t}\n\tif (command.args?.length) {\n\t\tlines.push(\"\", \"Arguments:\");\n\t\tconst width = Math.max(...command.args.map((arg) => arg.name.length));\n\t\tfor (const arg of command.args) {\n\t\t\tlines.push(\n\t\t\t\t` ${arg.name.padEnd(width)} ${arg.description}${arg.required ? \"\" : \" (optional)\"}${arg.variadic ? \" (multiple)\" : \"\"}`,\n\t\t\t);\n\t\t}\n\t}\n\tconst options = [...(command.options ?? []), ...GLOBAL_OPTIONS];\n\tif (options.length) {\n\t\tlines.push(\"\", \"Options:\");\n\t\tlines.push(...optionLines(options));\n\t}\n\tif (command.examples?.length) {\n\t\tlines.push(\"\", \"Examples:\");\n\t\tfor (const example of command.examples) lines.push(` ${example}`);\n\t}\n\tlines.push(\n\t\t\"\",\n\t\tcommand.auth\n\t\t\t? \"Authentication: requires a logged-in profile.\"\n\t\t\t: \"Authentication: not required.\",\n\t);\n\tif (command.mcp === false || command.longRunning) {\n\t\tlines.push(\"MCP: not executable through execute_linejs_cli (long-running).\");\n\t} else {\n\t\tlines.push(\"MCP: executable through execute_linejs_cli.\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport function commandsMetadata(commands: readonly CommandSpec[] = allCommands): unknown[] {\n\treturn commands.map((command) => commandMetadata(command));\n}\n","import {\n\tGLOBAL_OPTIONS,\n\ttype OptionSpec,\n\tparseOptions,\n\tsplitLeadingGlobalOptions,\n} from \"./args.ts\";\nimport type { CommandSpec } from \"./command.ts\";\nimport { CommandContext, type CliSettings } from \"./context.ts\";\nimport { CliError, UsageError, errorMessage, toErrorPayload } from \"./errors.ts\";\nimport { commandHelp, commandsMetadata, groupHelp, rootHelp } from \"./help.ts\";\nimport { Output } from \"./output.ts\";\nimport { resolveProfileLocation } from \"./paths.ts\";\nimport { allCommands, resolveCommandTokens } from \"./registry.ts\";\nimport { VERSION } from \"./version.ts\";\n\nexport interface RunCliOptions {\n\tstdout?: (chunk: string) => void;\n\tstderr?: (chunk: string) => void;\n\tenv?: NodeJS.ProcessEnv;\n\tcwd?: string;\n\tinteractive?: boolean;\n\tcolor?: boolean;\n\tmcp?: boolean;\n\tsignal?: AbortSignal;\n\thandleSignals?: boolean;\n}\n\nexport interface RunCliResult {\n\texitCode: number;\n}\n\nconst COMMANDS_OPTIONS: OptionSpec[] = [\n\t...GLOBAL_OPTIONS,\n\t{\n\t\tname: \"category\",\n\t\ttype: \"string\",\n\t\tvalueName: \"category\",\n\t\tdescription: \"Filter by category or command name.\",\n\t},\n];\n\nfunction detectJson(argv: readonly string[]): boolean {\n\tfor (const token of argv) {\n\t\tif (token === \"--json\") return true;\n\t\tif (token === \"--json=true\" || token === \"--json=1\") return true;\n\t\tif (token === \"--json=false\" || token === \"--json=0\") return false;\n\t\tif (token === \"--\") break;\n\t}\n\treturn false;\n}\n\nfunction reportError(error: unknown, output: Output, json: boolean, verbose: boolean): void {\n\tconst payload = toErrorPayload(error);\n\tif (json) {\n\t\toutput.writeErrLine(JSON.stringify({ error: payload }));\n\t} else {\n\t\toutput.writeErrLine(`${output.style(\"red\", \"error:\")} ${payload.message}`);\n\t\tconst details = payload.details;\n\t\tif (details && typeof details === \"object\" && \"hint\" in details) {\n\t\t\toutput.writeErrLine(`${output.style(\"dim\", \"hint:\")} ${String(details.hint)}`);\n\t\t}\n\t\tif (error instanceof CliError && error.code === \"USAGE\") {\n\t\t\toutput.writeErrLine(output.dim(\"Run `line help` to list commands.\"));\n\t\t}\n\t\tif (verbose && error instanceof Error && error.stack) {\n\t\t\toutput.writeErrLine(error.stack);\n\t\t}\n\t}\n}\n\nfunction suggest(name: string): string[] {\n\tconst lower = name.toLowerCase();\n\tconst candidates = allCommands\n\t\t.map((command) => command.name)\n\t\t.filter(\n\t\t\t(command) => command.toLowerCase().includes(lower) || lower.includes(command.split(\" \")[0]!),\n\t\t);\n\treturn candidates.slice(0, 5);\n}\n\nfunction uniqueOptions(\n\tprimary: readonly OptionSpec[],\n\tsecondary: readonly OptionSpec[],\n): OptionSpec[] {\n\tconst seen = new Set<string>();\n\tconst output: OptionSpec[] = [];\n\tfor (const spec of [...primary, ...secondary]) {\n\t\tif (seen.has(spec.name)) continue;\n\t\tseen.add(spec.name);\n\t\toutput.push(spec);\n\t}\n\treturn output;\n}\n\nfunction commandTable(output: Output, commands: readonly CommandSpec[]): void {\n\toutput.table(\n\t\tcommands.map((command) => ({\n\t\t\tname: command.name,\n\t\t\tcategory: command.category,\n\t\t\tsummary: command.summary,\n\t\t})),\n\t\t[\n\t\t\t{ key: \"name\", label: \"COMMAND\", maxWidth: 34 },\n\t\t\t{ key: \"category\", label: \"CATEGORY\", maxWidth: 20 },\n\t\t\t{ key: \"summary\", label: \"SUMMARY\", maxWidth: 80 },\n\t\t],\n\t);\n}\n\nasync function runMetaCommand(\n\targv: readonly string[],\n\toutput: Output,\n\tjson: boolean,\n\toptions: { help: boolean; version: boolean },\n): Promise<RunCliResult> {\n\tif (options.version) {\n\t\toutput.writeLine(VERSION);\n\t\treturn { exitCode: 0 };\n\t}\n\tif (argv[0] === \"help\") {\n\t\tconst helpArgs = argv.slice(1);\n\t\tconst { leading, rest } = splitLeadingGlobalOptions(helpArgs);\n\t\tconst parsed = parseOptions(leading, GLOBAL_OPTIONS);\n\t\tconst helpJson = Boolean(parsed.options.json) || json;\n\t\tconst target = resolveCommandTokens(rest);\n\t\tif (target.unknown) {\n\t\t\tthrow new UsageError(`Unknown command: ${target.unknown}`, {\n\t\t\t\thint: suggest(target.unknown).join(\", \"),\n\t\t\t});\n\t\t}\n\t\tif (target.command) {\n\t\t\tif (helpJson) {\n\t\t\t\toutput.writeLine(JSON.stringify(commandsMetadata([target.command])[0], null, 2));\n\t\t\t} else {\n\t\t\t\toutput.writeLine(commandHelp(target.command));\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (target.group) {\n\t\t\tif (helpJson) {\n\t\t\t\tconst entries = target.groupCommands ?? [];\n\t\t\t\toutput.writeLine(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgroup: target.group,\n\t\t\t\t\t\t\tcommands: commandsMetadata(entries),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t2,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toutput.writeLine(groupHelp(target.group, target.groupCommands ?? []));\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (helpJson) {\n\t\t\toutput.writeLine(JSON.stringify({ version: VERSION, commands: commandsMetadata() }, null, 2));\n\t\t} else {\n\t\t\toutput.writeLine(rootHelp());\n\t\t}\n\t\treturn { exitCode: 0 };\n\t}\n\n\tif (argv[0] === \"commands\") {\n\t\tconst parsed = parseOptions(argv.slice(1), COMMANDS_OPTIONS);\n\t\tconst effectiveJson = Boolean(parsed.options.json) || json;\n\t\tconst filter = String(parsed.options.category ?? \"\")\n\t\t\t.trim()\n\t\t\t.toLowerCase();\n\t\tconst commands = allCommands.filter((command) => {\n\t\t\tif (!filter) return true;\n\t\t\treturn (\n\t\t\t\tcommand.category.toLowerCase().includes(filter) ||\n\t\t\t\tcommand.name.toLowerCase().includes(filter)\n\t\t\t);\n\t\t});\n\t\tif (effectiveJson) {\n\t\t\toutput.writeLine(\n\t\t\t\tJSON.stringify(\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandCount: commands.length,\n\t\t\t\t\t\tcommands: commandsMetadata(commands),\n\t\t\t\t\t},\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tcommandTable(output, commands);\n\t\t}\n\t\treturn { exitCode: 0 };\n\t}\n\n\tif (json) {\n\t\toutput.writeLine(JSON.stringify({ version: VERSION, commands: commandsMetadata() }, null, 2));\n\t} else {\n\t\toutput.writeLine(rootHelp());\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runCli(\n\targv: readonly string[],\n\toptions: RunCliOptions = {},\n): Promise<RunCliResult> {\n\tconst env = options.env ?? process.env;\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst stdout = options.stdout ?? ((chunk: string) => process.stdout.write(chunk));\n\tconst stderr = options.stderr ?? ((chunk: string) => process.stderr.write(chunk));\n\tconst jsonHint = detectJson(argv);\n\tconst color =\n\t\toptions.color ??\n\t\t(!options.stdout && Boolean(process.stdout.isTTY) && !env.NO_COLOR && env.TERM !== \"dumb\");\n\n\tlet output = new Output({ stdout, stderr }, { json: jsonHint, color });\n\tlet json = jsonHint;\n\tlet verbose = argv.includes(\"--verbose\") || argv.includes(\"-v\");\n\n\ttry {\n\t\tconst { leading, rest } = splitLeadingGlobalOptions(argv);\n\t\tconst leadingParsed = parseOptions(leading, GLOBAL_OPTIONS);\n\t\tverbose = Boolean(leadingParsed.options.verbose);\n\t\tif (leadingParsed.options.version) {\n\t\t\toutput.writeLine(VERSION);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (!rest.length) {\n\t\t\treturn await runMetaCommand([], output, Boolean(leadingParsed.options.json), {\n\t\t\t\thelp: true,\n\t\t\t\tversion: false,\n\t\t\t});\n\t\t}\n\t\tif (rest[0] === \"help\" || rest[0] === \"commands\") {\n\t\t\tconst result = await runMetaCommand(rest, output, Boolean(leadingParsed.options.json), {\n\t\t\t\thelp: rest[0] === \"help\",\n\t\t\t\tversion: false,\n\t\t\t});\n\t\t\treturn result;\n\t\t}\n\n\t\tconst resolution = resolveCommandTokens(rest);\n\t\tif (resolution.unknown) {\n\t\t\tconst suggestions = suggest(resolution.unknown);\n\t\t\tthrow new UsageError(\n\t\t\t\t`Unknown command: ${resolution.unknown}`,\n\t\t\t\tsuggestions.length ? { hint: `Did you mean: ${suggestions.join(\", \")}?` } : undefined,\n\t\t\t);\n\t\t}\n\t\tif (!resolution.command) {\n\t\t\tconst nonOption = resolution.remaining.find((token) => !token.startsWith(\"-\"));\n\t\t\tif (nonOption && resolution.group) {\n\t\t\t\tthrow new UsageError(`Unknown ${resolution.group} subcommand: ${nonOption}`, {\n\t\t\t\t\thint: `Run \\`line help ${resolution.group}\\` for the available subcommands.`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst entries = resolution.groupCommands ?? allCommands;\n\t\t\tlet groupJson = Boolean(leadingParsed.options.json);\n\t\t\ttry {\n\t\t\t\tgroupJson =\n\t\t\t\t\tgroupJson || Boolean(parseOptions(resolution.remaining, GLOBAL_OPTIONS).options.json);\n\t\t\t} catch {\n\t\t\t\t// Unknown options are reported after a real command is selected.\n\t\t\t}\n\t\t\tif (groupJson) {\n\t\t\t\toutput.writeLine(\n\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgroup: resolution.group ?? null,\n\t\t\t\t\t\t\tcommands: commandsMetadata(entries),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t2,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toutput.writeLine(\n\t\t\t\t\tresolution.group ? groupHelp(resolution.group, entries) : rootHelp(entries),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tconst command = resolution.command;\n\t\tconst specs = uniqueOptions(command.options ?? [], GLOBAL_OPTIONS);\n\t\tconst parsed = parseOptions([...leading, ...resolution.remaining], specs);\n\t\tjson = Boolean(parsed.options.json);\n\t\tverbose = Boolean(parsed.options.verbose);\n\t\toutput = new Output({ stdout, stderr }, { json, color });\n\n\t\tif (parsed.options.version) {\n\t\t\toutput.writeLine(VERSION);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t\tif (parsed.options.help) {\n\t\t\toutput.writeLine(\n\t\t\t\tjson ? JSON.stringify(commandsMetadata([command])[0], null, 2) : commandHelp(command),\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tlet profile;\n\t\ttry {\n\t\t\tprofile = resolveProfileLocation(\n\t\t\t\ttypeof parsed.options.profile === \"string\" ? parsed.options.profile : undefined,\n\t\t\t\tenv,\n\t\t\t\tcwd,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthrow new UsageError(errorMessage(error));\n\t\t}\n\n\t\tconst timeout = typeof parsed.options.timeout === \"number\" ? parsed.options.timeout : undefined;\n\t\tif (timeout !== undefined && timeout <= 0) throw new UsageError(\"--timeout must be positive\");\n\n\t\tconst interactive =\n\t\t\toptions.interactive ??\n\t\t\t(Boolean(process.stdin.isTTY) &&\n\t\t\t\tBoolean(process.stdout.isTTY) &&\n\t\t\t\t!env.LINEJS_NONINTERACTIVE &&\n\t\t\t\t!options.mcp);\n\n\t\tconst controller = new AbortController();\n\t\tconst linkAbort = () => controller.abort();\n\t\tif (options.signal) {\n\t\t\tif (options.signal.aborted) controller.abort();\n\t\t\telse options.signal.addEventListener(\"abort\", linkAbort, { once: true });\n\t\t}\n\n\t\tconst handleSignals = options.handleSignals ?? !options.mcp;\n\t\tlet interrupts = 0;\n\t\tconst onSigint = () => {\n\t\t\tinterrupts += 1;\n\t\t\tif (interrupts === 1) {\n\t\t\t\toutput.writeErrLine(output.dim(\"Interrupting (press Ctrl+C again to force).\"));\n\t\t\t\tcontroller.abort();\n\t\t\t} else {\n\t\t\t\tprocess.exit(130);\n\t\t\t}\n\t\t};\n\t\tif (handleSignals) process.on(\"SIGINT\", onSigint);\n\n\t\tconst checkSession =\n\t\t\tBoolean(parsed.options[\"check-session\"]) || command.name.startsWith(\"auth \");\n\t\tconst settings: CliSettings = {\n\t\t\tprofile,\n\t\t\tdevice: typeof parsed.options.device === \"string\" ? parsed.options.device : undefined,\n\t\t\tappVersion:\n\t\t\t\ttypeof parsed.options[\"app-version\"] === \"string\"\n\t\t\t\t\t? parsed.options[\"app-version\"]\n\t\t\t\t\t: undefined,\n\t\t\tendpoint: typeof parsed.options.endpoint === \"string\" ? parsed.options.endpoint : undefined,\n\t\t\ttimeout,\n\t\t\tverbose,\n\t\t\tjson,\n\t\t\tinteractive,\n\t\t\tmcp: Boolean(options.mcp),\n\t\t\tcheckSession,\n\t\t\tenv,\n\t\t\tcwd,\n\t\t\tsignal: controller.signal,\n\t\t};\n\t\tconst context = new CommandContext({\n\t\t\toptions: parsed.options,\n\t\t\tpositionals: parsed.positionals,\n\t\t\toutput,\n\t\t\tsettings,\n\t\t});\n\n\t\ttry {\n\t\t\tconst result = await command.run(context);\n\t\t\tif (!command.silent) {\n\t\t\t\tconst value = result === undefined ? { ok: true } : result;\n\t\t\t\toutput.result(\n\t\t\t\t\tvalue,\n\t\t\t\t\tcommand.format ? (input) => command.format!(input, context) : undefined,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: 0 };\n\t\t} finally {\n\t\t\tif (handleSignals) process.off(\"SIGINT\", onSigint);\n\t\t\toptions.signal?.removeEventListener(\"abort\", linkAbort);\n\t\t}\n\t} catch (error) {\n\t\treportError(error, output, json, verbose);\n\t\treturn { exitCode: error instanceof CliError ? error.exitCode : 1 };\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAwBA,MAAa,iBAAwC;CACpD;EACC,MAAM;EACN,MAAM;EACN,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,aACC;CACF;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aACC;CACF;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aACC;CACF;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aAAa;CACd;CACA;EACC,MAAM;EACN,MAAM;EACN,WAAW;EACX,aAAa;CACd;CACA;EACC,MA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