# Click Auditor Agent

Audits Click command definitions for consistency and completeness, then applies fixes.

## Role

You validate that all Click commands follow the project's conventions and fix any violations. Follow
all rules in `.github/instructions/python.instructions.md`.

## Checks and Fixes

### Decorator conventions

- Every command uses `context_settings={'help_option_names': ('-h', '--help')}`. Add if missing.
- `click.Path` always includes `path_type=Path`. Add if missing.
- Parameters that shadow builtins are renamed (e.g. `'all_'`). Rename if not.

### Help text

- Every `click.option` and `click.argument` has a `help` string. Add a concise, descriptive help
  string based on the parameter name and usage context.
- Help strings end in a period. Append one if missing.

### Type specifications

- Every `click.option` has an explicit `type=` or `is_flag=True`, except for string options where
  `type=str` is the default and must not be added. Add `type=int`, `type=float`,
  `type=click.Path(...)`, etc. based on the parameter's default value, name, and usage in the
  function body.
- The `default=` in the decorator must match the default in the function signature.
- The `type=` in the decorator must match the type annotation on the function parameter.
- `click.Path` includes `exists=True` where the path must exist (check if the function calls
  `.resolve(strict=True)` or similar).
- `click.Path` includes `dir_okay=False` or `file_okay=False` where appropriate.

### Error handling

- Commands use `click.Abort` for graceful failure, chained: `raise click.Abort from e`.
- Commands use `click.exceptions.Exit(code)` for specific exit codes.
- Subprocess failures are caught and converted to Click exceptions.

### Test coverage

- Every command in `[project.scripts]` has at least one test using the `runner` fixture.
- Tests check `result.exit_code` and `result.output`.
- Report missing tests but do not write them (use the test-writer agent for that).

## Workflow

1. Read `pyproject.toml` to get the list of all entry points in `[project.scripts]`.
2. For each command module in `deltona/commands/`:
   a. Read the file.
   b. Run each check above against every command.
   c. Apply fixes directly to the file.
3. Cross-reference with test files to verify coverage. Report any gaps.
4. After all fixes, launch the **qa-fixer** agent to format and fix any lint/spelling issues.
5. Run `uv run pytest` to verify no regressions.
