SKY-A104 · AI-code defects
Public CLI surface drift
A command-line tool's flags, such as --dry-run, are a public interface: scripts, CI jobs and other people's muscle memory depend on them. SKY-A104 reports a change that removes or renames a flag without keeping the old spelling.
- Languages
- Python (argparse, Click, Typer)
- Turned on by
skylos . --ai-defects --diff origin/main(or-a) on a change- Quality gate
- counted toward the gate limits (full and diff scans). Counts toward
max_ai_defectswhen the scan has a change to compare. - Finding type
- review
Why it matters
A renamed flag breaks every script that still passes the old one, often only when that script next runs in production or CI. Coding agents rename flags while tidying code and rarely mention it in the summary.
What Skylos flags
import argparse def build_parser(): parser = argparse.ArgumentParser(prog="invoicer") parser.add_argument("--input", required=True)Removed: parser.add_argument("--dry-run", action="store_true")Added: parser.add_argument("--preview", action="store_true") return parserWhat Skylos leaves alone
import argparse def build_parser(): parser = argparse.ArgumentParser(prog="invoicer") parser.add_argument("--input", required=True)Removed: parser.add_argument("--dry-run", action="store_true")Added: parser.add_argument("--preview", "--dry-run", action="store_true") return parserWhy Skylos leaves it alone
The new name was added and the old spelling kept as an alias, so scripts that pass --dry-run still work.
More languages
Python
Flagged
import click @click.command()Removed: @click.option("--force", is_flag=True)@click.option("--limit", type=int, default=100)Removed: def sync(force, limit):Removed: click.echo(f"syncing {limit} invoices (force={force})")Added: def sync(limit):Added: click.echo(f"syncing {limit} invoices")Not flagged
import click @click.command()Removed: @click.option("--force", is_flag=True)Added: @click.option("--force/--no-force", default=False)@click.option("--limit", type=int, default=100)def sync(force, limit): click.echo(f"syncing {limit} invoices (force={force})")Why Skylos leaves it alone
The option line changed, but --force is still on the new line (now with a --no-force partner), so nothing callers use was removed.
How Skylos decides
- Runs with
--ai-defectswhen there is a change to compare: in a diff scan (--diffor--diff-base), or in a full scan of a Git checkout with uncommitted changes. It reads the Git diff of each changed file against the base. - Reads a file when it looks like a command-line module: named
cli.py,commands.pyormain.py, under acli/orcommands/folder, or withadd_argument(,click.option(,typer.Option(orOption(anywhere in its diff. - Collects the
--flagnames on removed and added lines that hold one of those option calls. Commented-out lines are skipped. - Reports each flag that was on a removed line and is on no added line in the same file, once per flag. The line is the removed line's number in the base version.
How to fix it
Keep the old spelling working: add it as an alias next to the new name, and remove it only in a release whose notes say so. If the flag really must go, say so in the pull request so the reviewer can check callers.
import argparse def build_parser(): parser = argparse.ArgumentParser(prog="invoicer") parser.add_argument("--input", required=True)Removed: parser.add_argument("--preview", action="store_true")Added: parser.add_argument("--preview", "--dry-run", action="store_true") return parserWhen it can be wrong
- A deliberate removal of a deprecated flag is reported. That is intended: the finding asks the reviewer to confirm the break.
- A flag moved to a different file in the same change is reported, because added and removed flags are compared within one file.
- A flag removed by deleting its whole line is reported at that line's number in the base version. A
--diffscan keeps only findings on changed lines of the new file, so it usually drops this one; a full scan of a checkout with uncommitted changes, or-awithout--diff, reports it. The Click example above is checked that way. - Only Python option calls are read. Command-line flags declared in other languages, a removed subcommand or a changed default are not seen.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
An inline
# skylos: ignore[SKY-A104]comment does not silence it in Skylos 5.6.0: this rule reports a path relative to the project, and the inline-ignore lookup does not match it. Use the setting below.Python parser.add_argument("--preview", action="store_true") # skylos: ignore[SKY-A104][tool.skylos] ignore = ["SKY-A104"]turns the rule off for the project.