Skip to content

cli: add --enabled/--disabled flag to hive set commands#296

Merged
maximelb merged 1 commit into
cli-v2from
cli-v2-set-enabled-flag
May 21, 2026
Merged

cli: add --enabled/--disabled flag to hive set commands#296
maximelb merged 1 commit into
cli-v2from
cli-v2-set-enabled-flag

Conversation

@maximelb
Copy link
Copy Markdown
Contributor

Summary

Hive records are created disabled by defaultsecret, lookup, playbook, ai_skill, cloud_sensor, external_adapter, fp, sop, dr-general, etc. Operators (and LLMs) routinely run secret set (or similar) and expect the record to be live, then can't figure out why nothing happens. This adds an --enabled/--disabled flag to the three entry points that create hive records so the record can be created and enabled in one shot:

limacharlie secret set --key foo --input-file foo.yaml --enabled
limacharlie lookup set --key bar --input-file bar.yaml --enabled
limacharlie hive   set --hive-name lookup --key baz --input-file f --enabled
limacharlie dr     set --key my-rule --input-file rule.yaml --enabled

When passed, the flag overrides any usr_mtd.enabled value in the input file. When omitted, behavior is unchanged (input file value if any, else server-side default).

Scope

Three entry points cover every shortcut:

  • limacharlie/commands/_hive_shortcut.py — the factory used by secret, lookup, playbook, ai-skill, cloud-adapter, external-adapter, fp, note, sop
  • limacharlie/commands/hive.py — generic hive set
  • limacharlie/commands/dr.pydr set

Help text on each updated to call out the disabled-by-default behavior and the new flag.

Test plan

  • Unit tests added for shortcut set, hive set, and dr set covering: --enabled creates enabled, --disabled creates disabled, flag overrides input-file usr_mtd.enabled, omission leaves enabled unset, no-flag preserves input-file value
  • Full unit suite: 3138 passed, 9 new tests pass. The 44 pre-existing failures on cli-v2 (toon/search-checkpoint/click-compat) are unrelated and unchanged by this PR
  • Manual smoke against a real org once approved

🤖 Generated with Claude Code

Hive records are created disabled by default, which surprises operators
(and LLMs) who run e.g. `secret set` and expect the record to be live.

Add an `--enabled/--disabled` flag to the create/update commands so a
record can be created and enabled in one shot:

  limacharlie secret set --key foo --input-file foo.yaml --enabled
  limacharlie lookup set --key bar --input-file bar.yaml --enabled
  limacharlie hive   set --hive-name lookup --key baz --input-file f --enabled
  limacharlie dr     set --key my-rule --input-file rule.yaml --enabled

When passed, the flag overrides any usr_mtd.enabled value in the input
file. When omitted, behavior is unchanged: the input file's value (if
any) is preserved, otherwise the server-side default applies.

The change is scoped to the three entry points that create hive
records:
- `_hive_shortcut.py` — covers secret, lookup, playbook, ai-skill,
  cloud-adapter, external-adapter, fp, note, sop
- `hive.py` — generic `hive set`
- `dr.py` — `dr set`

Help text on each updated to call out the disabled-by-default
behavior and the new flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maximelb maximelb requested a review from dzimine-lc May 21, 2026 15:07
@maximelb maximelb marked this pull request as ready for review May 21, 2026 15:07
maximelb added a commit to refractionPOINT/lc-ai that referenced this pull request May 21, 2026
Surfaces a common foot-gun where operators (and LLMs) call e.g.
`secret set` or `lookup set` and expect the record to be live, then
spend time debugging why nothing happens — the record was created
disabled and silently does nothing.

Adds a top-level "Hive Records Are Disabled By Default" section to
both lc-essentials and lc-fundamentals AUTOINIT.md, listing the
affected resources and the three create-and-enable paths in order
of preference:

  1. --enabled on the `set` command (one-shot, preferred)
  2. usr_mtd.enabled: true in the input file
  3. matching `enable` subcommand after the `set`

The --enabled flag itself is being added to python-limacharlie in
refractionPOINT/python-limacharlie#296. Until that lands, paths 2
and 3 still apply.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
maximelb added a commit to refractionPOINT/documentation that referenced this pull request May 21, 2026
Every new Hive record (D&R rules, FP rules, secrets, lookups, YARA
sources, cloud sensors, AI skills, playbooks, …) is created disabled
unless usr_mtd.enabled is explicitly set to true. Several create/update
examples in the docs omit this and would silently produce a disabled
record — most painful for secrets and lookups, where the record is
stored normally but its consumers (outputs, D&R rules) skip it.

- config-hive/index.md: new top-level admonition listing the three
  create-and-enable paths (CLI --enabled flag, usr_mtd.enabled in body,
  SDK enabled=True / Enabled: &enabled).
- secrets.md and lookups.md: Create/Update examples now set enabled
  across REST, Python, Go, and CLI tabs.
- dr-rules.md, false-positives.md, detection-response/index.md,
  writing-testing-rules.md tutorial: CLI examples updated to include
  --enabled. (The REST/Python/Go tabs in those docs already set it.)
- yara.md: Python SDK example now passes enabled=True.
- python-sdk.md: "Create or update a rule" snippet now sets enabled.
- skills.md: CLI ai-skill set examples and Python SDK example now
  enable the skill at creation.

The CLI --enabled / --disabled flag referenced here is being added to
python-limacharlie in refractionPOINT/python-limacharlie#296. Until
that lands, the SDK/REST patterns still apply, and the CLI path
remains "set + enable" two-step.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maximelb maximelb merged commit 856de91 into cli-v2 May 21, 2026
7 checks passed
@maximelb maximelb deleted the cli-v2-set-enabled-flag branch May 21, 2026 15:39
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.

1 participant