{"record":{"id":"4d009fa069dcc28e","repo":"can1357/oh-my-pi","slug":"usage-export-themes-path","errorCode":null,"errorMessage":"Usage: /export [--themes] [path]","messagePattern":"Usage: /export \\[--themes\\] \\[path\\]","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/export/html/args.ts","lineNumber":18,"sourceCode":"/**\n * `/export` argument parsing, split from `./index.ts` so slash-command\n * registries can parse arguments without eagerly loading the export module's\n * embedded template/tool-view text.\n */\n\n/** Dark and light TUI theme names bundled into a dual-theme export. */\nexport interface ExportThemeNames {\n\tdark: string;\n\tlight: string;\n}\n\n/** Parse `/export [--themes] [path]`; paths containing spaces were never supported. */\nexport function parseExportArgs(args: string): { outputPath?: string; useUserThemes: boolean } {\n\tconst parts = args.trim().split(/\\s+/).filter(Boolean);\n\tconst useUserThemes = parts.includes(\"--themes\");\n\tconst paths = parts.filter(part => part !== \"--themes\");\n\tif (paths.length > 1) throw new Error(\"Usage: /export [--themes] [path]\");\n\treturn { outputPath: paths[0], useUserThemes };\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/export/html/args.ts#L1-L21","documentation":"parseExportArgs parses the /export command arguments, which accept at most one optional path plus the --themes flag. Passing more than one non-flag token is rejected with this usage error because paths containing spaces were never supported — the parser splits on whitespace and cannot disambiguate multi-word paths.","triggerScenarios":"Running `/export my folder/out.html` (two whitespace-separated tokens) or `/export ~/a ~/b`; any input where filtering out --themes leaves 2+ path parts.","commonSituations":"Unquoted paths with spaces pasted into the command; accidentally pasting a path twice; assuming quote support that the parser doesn't implement.","solutions":["Use a single path with no spaces (rename the target or use a path without spaces).","Run `/export` with no arguments and let the default output path be chosen.","Export to a spaces-free temp path, then move/rename the file.","If a spaces-containing path is essential, export programmatically via exportSessionToHtml rather than the slash command."],"exampleFix":"// before\n/export my reports/session.html\n// after\n/export my-reports/session.html  # then mv to 'my reports/'","handlingStrategy":"validation","validationCode":"const parts = args.trim().split(/\\s+/).filter(Boolean).filter(p => p !== \"--themes\");\nif (parts.length > 1) {\n  throw new Error(\"/export accepts at most one path; quote-free paths with spaces are unsupported\");\n}","typeGuard":"null","tryCatchPattern":"try {\n  const { outputPath } = parseExportArgs(userInput);\n} catch (err) {\n  ui.showHint(\"Usage: /export [--themes] [path] — one space-free path only\");\n}","preventionTips":["Never paste paths containing spaces into /export; rename or export to a temp path first.","Pass at most one path token; use /export with no args to use the default output.","Remember the parser does not handle quotes — quoting won't help."],"tags":["cli","argument-parsing","usage"],"backgroundTag":"invalid-command-arguments","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}