CLI gen: tri-state nullable bool option parser (--flag / --flag false / absent)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 92
- Forks
- 8
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 4
Description
Part of #338. Depends on gap #1 (per-parameter flags).
Today
System.CommandLine's default Option<bool> is binary: presence means true, absence means false. There's no way to express "explicitly false" — which matters whenever a generated flag corresponds to a nullable: true boolean in the schema:
null(absent) → don't override the loaded base bodytrue→ set field truefalse→ set field false
Without tri-state, --only-main-content (which means "yes") can't be distinguished from "omit" vs. "explicitly disable".
Target
firecrawl scrape <url> --only-main-content # → true
firecrawl scrape <url> --only-main-content false # → false
firecrawl scrape <url> # → null (don't override)
firecrawl scrape <url> --input base.json --only-main-content false # → override base to false
Proposed approach
- Emit
Option<bool?>with custom parser for properties typedbool?(orboolwithnullable: true):- parser accepts: nothing after the flag →
true;true/yes/1→true;false/no/0→false; anything else → parse error.
- parser accepts: nothing after the flag →
- Helper factory in
CliRuntime:CreateNullableBoolOption(string name, string? description)to keep the per-property emission concise. - Help text: "true/false; presence alone implies true; omit to inherit".
- Plain
boolproperties (non-nullable, default false) stay asOption<bool>— no behavior change.
Acceptance criteria
- Generated commands for nullable-bool body fields support all three states above.
- Snapshot test covers a spec with a nullable boolean property.
- Firecrawl
scrape --only-main-content falseworks end-to-end after regen.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at nullable-bool option emission and the proposed CliRuntime helper, comparing them with the existing plain-bool path. Add or extend the snapshot test for a spec with a nullable boolean, then regenerate the Firecrawl scrape command and verify its end-to-end behavior. Done means absent, true, and false inputs preserve the three intended states.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100