Add CLI support for the new app and ai_cost_model hives#308
Merged
Conversation
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
previously approved these changes
Jun 20, 2026
maximelb
commented
Jun 20, 2026
maximelb
commented
Jun 20, 2026
maximelb
commented
Jun 20, 2026
maximelb
commented
Jun 20, 2026
maximelb
left a comment
Contributor
Author
There was a problem hiding this comment.
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 sethelp 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_grouplike the other shortcuts; overrides list/get/set/delete explains, falls back to generic enable/disable/tag — identical toapp.py/sop.py/note.py.--valuecorrectly absent (structured data). Pluralization renders cleanly ("AI cost models"). - Wiring:
cli.py_COMMAND_MODULE_MAPentry,hive.py_KNOWN_HIVE_TYPES+ explain text, andhelp_topics.pyall 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.py→ 993 passed, 2 skipped (skips pre-existing/env-conditional). Verified at runtime that explain overrides take effect and--helprenders. - Out-of-scope claim is justified:
Configs.ALL_HIVES/ sync_HIVE_FLAG_MAPare a curated subset that already excludesapp,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)
sethelp omits the backend's upper bounds (both inputs capped at 100000). "non-negative" is stated; the ceiling isn't. Optional polish.- Pre-existing gap (not this PR):
extension_definition,extension_subscription,investigationare 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.
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
lcbill
approved these changes
Jun 20, 2026
Contributor
Author
|
✅ AI-APPROVED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
appalready had a shortcut command (added during the cli-v2 sync) but was missing from the hive discoverability lists.ai_cost_modelhad no CLI presence at all.Changes:
limacharlie/commands/hive.py— addappandai_cost_modelto_KNOWN_HIVE_TYPESand to thehive listexplain text, so both are discoverable via the generichivecommand.limacharlie/commands/ai_cost_model.py(new) —ai-cost-modelshortcut command built on themake_hive_groupfactory, bringing it to parity with the other config-like hive shortcuts (sop,note,app, …). Thesethelp is field-accurate to the backend record (label,loaded_hourly_rate,minutes_per_investigation,rate_source_note).limacharlie/cli.py— registerai-cost-modelin the lazy-loading command map.limacharlie/help_topics.py— listappandai-cost-modelwrappers in thehivehelp 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_HIVESand the sync_HIVE_FLAG_MAP) is left unchanged. It is a curated subset tied to backendext-infrastructuresupport 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.py→ 1003 passed, 2 skipped (skips are pre-existing, environment-conditional).CliRunner:ai-cost-model --help,ai-cost-model set --help, andhelp topic hiveall render correctly.tests/unitrun shows ~111 pre-existing failures unrelated to this change — all intest_search_*, caused by thetoon_formatpackage shipping aNotImplementedErrorstub in this environment. None touch the code changed here.🤖 Generated with Claude Code