Problem
src/commands/actors/search.ts declares two enum flags with an options: key:
'sort-by': Flags.string({
description: 'Sort order for the results.',
options: ['relevance', 'popularity', 'newest', 'lastUpdate'],
default: 'relevance',
}),
'pricing-model': Flags.string({
description: 'Filter by pricing model.',
options: ['FREE', 'FLAT_PRICE_PER_MONTH', 'PRICE_PER_DATASET_ITEM', 'PAY_PER_EVENT'],
}),
The flag framework only reads choices — src/lib/command-framework/flags.ts:115 is the sole consumer. options is silently ignored.
TypeScript doesn't catch it: stringFlag takes options: T & { choices?: Choices } with T inferred from the literal, so the excess property passes.
Impact
- No validation.
--pricing-model BOGUS skips the APIFY_INVALID_CHOICE check at src/lib/command-framework/apify-command.ts:593 and goes straight to the API.
- Help and docs hide the allowed values.
src/lib/command-framework/help/CommandHelp.ts:276 renders <option> and appends an <options: …> line only when choices is set.
- Flag types are
string instead of the literal union, so nothing downstream is type-checked.
Current generated docs (docs/reference.md:717):
--pricing-model=<value> Filter by pricing model.
--sort-by=<value> Sort order for the results.
What a correct choices: flag renders (docs/reference.md:1314):
--format=<option> The format of the returned output. By
default, it is set to 'json'.
<options: json|jsonl|csv|html|rss|xml|xlsx>
Reproduce
apify actors search "scraper" --pricing-model BOGUS
Expected: Invalid choice listing the four pricing models. Actual: the value is forwarded to GET /v2/store.
Fix
Rename options: → choices: in both flags, then run pnpm run update-docs and commit the regenerated docs/.
Values match the API (store-get), so no list changes needed.
Follow-up (optional)
Make the framework reject the mistake instead of swallowing it — tighten StringFlagOptions so an unknown key fails to compile, or add options?: never as a cheap trap. Nothing today stops the next person from writing options: again.
🤖 Generated with Claude Code
Problem
src/commands/actors/search.tsdeclares two enum flags with anoptions:key:The flag framework only reads
choices—src/lib/command-framework/flags.ts:115is the sole consumer.optionsis silently ignored.TypeScript doesn't catch it:
stringFlagtakesoptions: T & { choices?: Choices }withTinferred from the literal, so the excess property passes.Impact
--pricing-model BOGUSskips theAPIFY_INVALID_CHOICEcheck atsrc/lib/command-framework/apify-command.ts:593and goes straight to the API.src/lib/command-framework/help/CommandHelp.ts:276renders<option>and appends an<options: …>line only whenchoicesis set.stringinstead of the literal union, so nothing downstream is type-checked.Current generated docs (
docs/reference.md:717):What a correct
choices:flag renders (docs/reference.md:1314):Reproduce
apify actors search "scraper" --pricing-model BOGUSExpected:
Invalid choicelisting the four pricing models. Actual: the value is forwarded toGET /v2/store.Fix
Rename
options:→choices:in both flags, then runpnpm run update-docsand commit the regenerateddocs/.Values match the API (store-get), so no list changes needed.
Follow-up (optional)
Make the framework reject the mistake instead of swallowing it — tighten
StringFlagOptionsso an unknown key fails to compile, or addoptions?: neveras a cheap trap. Nothing today stops the next person from writingoptions:again.🤖 Generated with Claude Code