tryAGI / tryAGI/AutoSDK

CLI gen: tri-state nullable bool option parser (--flag / --flag false / absent)

Open
#347 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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 body
  • true → set field true
  • false → 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

  1. Emit Option<bool?> with custom parser for properties typed bool? (or bool with nullable: true):
    • parser accepts: nothing after the flag → true; true/yes/1true; false/no/0false; anything else → parse error.
  2. Helper factory in CliRuntime: CreateNullableBoolOption(string name, string? description) to keep the per-property emission concise.
  3. Help text: "true/false; presence alone implies true; omit to inherit".
  4. Plain bool properties (non-nullable, default false) stay as Option<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 false works end-to-end after regen.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.