{"record":{"id":"2d6a4a2956902541","repo":"can1357/oh-my-pi","slug":"compress-requires-at-least-one-file-or-glob-patter","errorCode":null,"errorMessage":"compress requires at least one file or glob pattern","messagePattern":"compress requires at least one file or glob pattern","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/commands/compress.ts","lineNumber":31,"sourceCode":"\t\tout: Flags.string({ char: \"o\", description: \"Write the approved text here instead of stdout (single file)\" }),\n\t\tinPlace: Flags.boolean({ char: \"i\", description: \"Overwrite each source file with its approved text\" }),\n\t\trounds: Flags.integer({ char: \"r\", description: \"Maximum drafts per file before giving up\", default: 3 }),\n\t\tagents: Flags.integer({ char: \"n\", description: \"Files compressed concurrently\", default: 4 }),\n\t\tmodel: Flags.string({ char: \"m\", description: \"Model selector\" }),\n\t};\n\n\tstatic examples = [\n\t\t\"omp compress prompts/tools/read.md\",\n\t\t\"omp compress notes.md -o notes.compressed.md\",\n\t\t\"omp compress 'src/prompts/**/*.md' -i\",\n\t\t\"omp compress a.md b.md c.md -i -n 8\",\n\t\t\"omp compress spec.md -r 5 -m opus\",\n\t];\n\n\tasync run(): Promise<void> {\n\t\tconst { args, flags } = await this.parse(Compress);\n\t\tconst files = args.files ?? [];\n\t\tif (files.length === 0) throw new CliUsageError(\"compress requires at least one file or glob pattern\");\n\t\tif (flags.rounds <= 0) throw new CliUsageError(\"--rounds must be a positive integer\");\n\t\tif (flags.agents <= 0) throw new CliUsageError(\"--agents must be a positive integer\");\n\t\tif (flags.inPlace && flags.out) throw new CliUsageError(\"--in-place and --out are mutually exclusive\");\n\t\tconst result = await runCompressCommand({\n\t\t\tfiles,\n\t\t\tmodel: flags.model,\n\t\t\tmaxRounds: flags.rounds,\n\t\t\tconcurrency: flags.agents,\n\t\t\toutput: flags.out,\n\t\t\tinPlace: flags.inPlace,\n\t\t});\n\t\tawait postmortem.quit(result.exitCode);\n\t}\n}\n","sourceCodeStart":13,"sourceCodeEnd":46,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/commands/compress.ts#L13-L46","documentation":"omp compress reduces token usage across one or more files; it accepts file paths or glob patterns as positional args. With no positional arguments there is nothing to compress, so the command throws a CliUsageError immediately after parsing.","triggerScenarios":"Running bare 'omp compress' or 'omp compress -r 5 -m opus' with flags but no files; invoking programmatically with args.files undefined or an empty array (the code normalizes undefined to [] and checks length === 0).","commonSituations":"Shell glob failing to expand (nullglob or no matching files leaves zero args); wrapping script dropping positional args; composing a command where flags were added but the file list was forgotten.","solutions":["Pass at least one file or glob: omp compress spec.md or omp compress 'docs/**/*.md'","Quote globs so the shell does not pre-expand them incorrectly","Check that your wrapper script actually forwards \"$@\" or the file list"],"exampleFix":"// before\nomp compress -r 5\n// after\nomp compress spec.md -r 5","handlingStrategy":"validation","validationCode":"const files = (args.files ?? []).filter(Boolean);\nif (files.length === 0) {\n  throw new Error('compress requires at least one file or glob pattern');\n}","typeGuard":"function hasFiles(a) { return Array.isArray(a?.files) && a.files.length > 0; }","tryCatchPattern":"try {\n  await Compress.run(rawArgs);\n} catch (err) {\n  if (err instanceof CliUsageError && err.message.includes('at least one file')) {\n    console.error('Usage: omp compress <files...> [--rounds N]');\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Always quote globs: omp compress 'docs/**/*.md'","Forward positional args in wrappers with \"$@\"","Check glob expansion count before invoking"],"tags":["cli","usage","arguments"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}