Skip to content

Add CLI support for the new app and ai_cost_model hives#308

Merged
maximelb merged 2 commits into
masterfrom
solve/cli-new-hives-5e552cd3969
Jun 20, 2026
Merged

Add CLI support for the new app and ai_cost_model hives#308
maximelb merged 2 commits into
masterfrom
solve/cli-new-hives-5e552cd3969

Conversation

@maximelb

Copy link
Copy Markdown
Contributor

What was asked

Review the last couple of weeks of changes to the backend hive config schema and determine whether the CLI tool in this repo needs corresponding changes.

What was done

Two hives were recently added on the backend:

  • app — AI-generated iframe web apps.
  • ai_cost_model — per-org AI cost/savings economic model (cost profiles).

The CLI was only partially caught up:

  • app already had a shortcut command (added during the cli-v2 sync) but was missing from the hive discoverability lists.
  • ai_cost_model had no CLI presence at all.

Changes:

  • limacharlie/commands/hive.py — add app and ai_cost_model to _KNOWN_HIVE_TYPES and to the hive list explain text, so both are discoverable via the generic hive command.
  • limacharlie/commands/ai_cost_model.py (new) — ai-cost-model shortcut command built on the make_hive_group factory, bringing it to parity with the other config-like hive shortcuts (sop, note, app, …). The set help is field-accurate to the backend record (label, loaded_hourly_rate, minutes_per_investigation, rate_source_note).
  • limacharlie/cli.py — register ai-cost-model in the lazy-loading command map.
  • limacharlie/help_topics.py — list app and ai-cost-model wrappers in the hive help topic.
  • tests/unit/test_cli_lazy_loading_regression.py — update the CLI-surface snapshot (top-level commands, module map, subcommands, shortcut-load loop).

Intentionally out of scope

The IaC sync set (Configs.ALL_HIVES and the sync _HIVE_FLAG_MAP) is left unchanged. It is a curated subset tied to backend ext-infrastructure support and already excludes several existing hives (app, sop, org_notes, …), so adding these there would require confirming backend sync support first.

Testing

Run with the repo .venv:

  • pytest tests/unit/test_cli_lazy_loading_regression.py tests/unit/test_discovery.py1003 passed, 2 skipped (skips are pre-existing, environment-conditional).
  • Functional smoke test via CliRunner: ai-cost-model --help, ai-cost-model set --help, and help topic hive all render correctly.
  • The full tests/unit run shows ~111 pre-existing failures unrelated to this change — all in test_search_*, caused by the toon_format package shipping a NotImplementedError stub in this environment. None touch the code changed here.

🤖 Generated with Claude Code

Two hives were recently added on the backend: `app` (AI-generated
iframe web apps) and `ai_cost_model` (per-org AI cost/savings economic
model). The CLI was only partially caught up: `app` had a shortcut
command but was missing from the hive discoverability lists, and
`ai_cost_model` had no CLI presence at all.

- hive.py: add `app` and `ai_cost_model` to `_KNOWN_HIVE_TYPES` and the
  `hive list` explain text so both are discoverable via the generic
  `hive` command.
- ai_cost_model.py: new `ai-cost-model` shortcut command (via the
  make_hive_group factory), bringing it to parity with the other
  config-like hive shortcuts (sop, note, app, ...). Field-accurate
  set help (label, loaded_hourly_rate, minutes_per_investigation,
  rate_source_note) per the backend record definition.
- cli.py: register `ai-cost-model` in the lazy-loading command map.
- help_topics.py: list `app` and `ai-cost-model` wrappers in the hive
  help topic.
- Update the lazy-loading regression test snapshot accordingly.

The IaC sync set (Configs.ALL_HIVES / sync `_HIVE_FLAG_MAP`) is left
unchanged: it is a curated subset tied to ext-infrastructure backend
support (it already excludes app, sop, org_notes, etc.), so adding
these there is out of scope for this change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EfrssJQLhNEFhvaUr1EPzv
lcbill
lcbill previously approved these changes Jun 20, 2026
Comment thread limacharlie/commands/ai_cost_model.py Outdated
Comment thread limacharlie/commands/ai_cost_model.py
Comment thread limacharlie/commands/hive.py

@maximelb maximelb left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review summary — PR #308

I reviewed the diff, compared against the existing hive-shortcut pattern (_hive_shortcut.py, sop.py, note.py, app.py), verified the new help text against the backend record definition, ran the regression test, and did a public-repo hygiene pass.

Verdict: correct and well-scoped. No defects found. Findings are minor/informational only.

Verified

  • Field accuracy: ai-cost-model set help matches the backend record exactly — label (optional), loaded_hourly_rate (required), minutes_per_investigation (required), rate_source_note (optional). Required/optional and non-negative constraints all align.
  • Pattern consistency: built on make_hive_group like the other shortcuts; overrides list/get/set/delete explains, falls back to generic enable/disable/tag — identical to app.py/sop.py/note.py. --value correctly absent (structured data). Pluralization renders cleanly ("AI cost models").
  • Wiring: cli.py _COMMAND_MODULE_MAP entry, hive.py _KNOWN_HIVE_TYPES + explain text, and help_topics.py all updated. app (which was already a registered shortcut but missing from discovery lists) is now also added to the discovery lists.
  • Regression test: snapshot updates are complete and consistent across all four surfaces (top-level commands, module map, subcommands, shortcut load loop). pytest tests/unit/test_cli_lazy_loading_regression.py993 passed, 2 skipped (skips pre-existing/env-conditional). Verified at runtime that explain overrides take effect and --help renders.
  • Out-of-scope claim is justified: Configs.ALL_HIVES / sync _HIVE_FLAG_MAP are a curated subset that already excludes app, sop, org_notes, etc., so leaving them unchanged is correct.
  • Public-repo hygiene: ✅ no private repo name, no customer names, no PII in the diff or commit message. Backend is referred to generically.

Minor / informational (non-blocking)

  1. set help omits the backend's upper bounds (both inputs capped at 100000). "non-negative" is stated; the ceiling isn't. Optional polish.
  2. Pre-existing gap (not this PR): extension_definition, extension_subscription, investigation are real backend hives still absent from _KNOWN_HIVE_TYPES. Possible follow-up if "fully caught up" is the goal.

Not approving via GitHub's button per instructions; this is a comment-only review.

@maximelb

Copy link
Copy Markdown
Contributor Author

✅ AI-APPROVED

The backend validator rejects loaded_hourly_rate or
minutes_per_investigation above 100000; make the help say so instead of
the vaguer "outside the allowed range".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EfrssJQLhNEFhvaUr1EPzv
@maximelb

Copy link
Copy Markdown
Contributor Author

✅ AI-APPROVED

@maximelb maximelb marked this pull request as ready for review June 20, 2026 00:19
@maximelb maximelb merged commit c775829 into master Jun 20, 2026
7 checks passed
@maximelb maximelb deleted the solve/cli-new-hives-5e552cd3969 branch June 20, 2026 00:19
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.

2 participants