Skip to content

feat(cli): kai command + rename distribution to kai-security#100

Open
aktasbatuhan wants to merge 1 commit into
kai/reportfrom
kai/cli
Open

feat(cli): kai command + rename distribution to kai-security#100
aktasbatuhan wants to merge 1 commit into
kai/reportfrom
kai/cli

Conversation

@aktasbatuhan

@aktasbatuhan aktasbatuhan commented Jun 8, 2026

Copy link
Copy Markdown
Member

Stacked on #99#98. Retarget to master as the stack lands.

What this does

Adds the unified kai command and the packaging/naming setup.

CLI

A thin dispatcher (kai.cli:main) over existing modules — no logic duplicated:

Command Does Wraps
kai audit <repo> setup → exploit pipeline kai.main pipeline
kai view <run_dir> interactive HTML viewer (findings + trace) kai.viewer (#98)
kai report <run_dir> [--format html] findings report (Markdown / styled HTML) kai.report (#99)

kai pipeline / kai agent remain as direct aliases; python -m kai.main … still works.

Packaging

  • Distribution renamed kaikai-security; the import packages and the command stay kai.
  • The wheel ships BOTH kai (domain) and ra (framework) via [tool.uv.build-backend] module-name = ["kai", "ra"]. This is required — kai imports ra, so a wheel containing only kai is broken. (Caught by building the wheel and importing it; the prior single-module config would have published an uninstallable package.)
  • Bare kai on PyPI is reserved for the future umbrella dispatcher.

Verification

  • uv buildkai_security-0.1.0 wheel; confirmed top-level packages are kai + ra (incl. ra/viewer).
  • uv run kai --help / view / report / audit -h all work; unknown command → exit 2.
  • ty / ruff clean; pytest green (CLI dispatcher tests).

@eren23

eren23 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

this one lgtm

Comment thread src/kai/cli.py
Add a unified `kai` console entry point that dispatches the friendly verbs
over the existing modules:

  kai audit <repo>     -> setup -> exploit pipeline (kai.main pipeline)
  kai view <run_dir>   -> interactive HTML run viewer (kai.viewer)
  kai report <run_dir> -> findings report, Markdown or --format html (kai.report)

`kai pipeline` / `kai agent` remain as direct aliases into kai.main.

Packaging: publish the distribution as `kai-security` while keeping the import
package and the command named `kai` (uv build-backend module-name override).
The bare `kai` name on PyPI is reserved for the future umbrella dispatcher.

Document the CLI in the README and add dispatcher tests.
@aktasbatuhan

Copy link
Copy Markdown
Member Author

@andthattoo it already supports the full set: kai audit / pipeline / agent are a thin pass-through — the dispatcher forwards all remaining argv straight to the existing kai.main parser, so every flag (--skip-fixer, --no-iterative, --threat-context, --save-rollouts, --state-dir, --instructions, --log-structured, …) works unchanged, and kai audit -h lists them. Nothing is re-declared, so the param list can't drift out of sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants