feat: Unattended install#216
Merged
Merged
Conversation
Adds non-interactive install flags for sandboxed/scripted environments (closes #212), e.g. `semble install --agent pi --type subagent --yes`.
…lection run() previously took the unattended branch whenever agent_ids was not None, including an empty list, printing a blank plan and returning success. Mirror the interactive path's guard.
Matches the existing ContentType(str, Enum) pattern in types.py, giving mypy real coverage on run()'s integration_ids for direct API callers instead of an unconstrained list[str].
An explicit empty list previously fell through to "all integrations" because of a falsy check; it should exit like agent_ids=[] does. The CLI can't trigger this (argparse requires nargs="+"), but direct API callers could.
… IntegrationType conversion --yes alone still hits the interactive checkbox path (hangs in non-TTY), so document that. Also strengthen the unattended-flags test to check the CLI actually converts --type strings to IntegrationType, not just equal-by-value strings.
…ions _exit() previously always used code 0, so scripts checking $? after an unattended run() call would see success even when nothing matched --agent/--type. The interactive cancel/nothing-selected paths keep exiting 0 since those reflect a deliberate user choice, not an error.
- test_run_unattended_skips_prompts now also asserts _checkbox is never called, not just questionary.confirm, so a branching regression that fell through to the interactive path would be caught. - Drop the integration_ids=["nonexistent"] case: it's unreachable via the typed API (IntegrationType is a closed enum; only an empty list can yield zero matches), so it tested runtime string handling rather than the real contract.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Confidence Score: 5/5This looks safe to merge after tightening one CLI edge case.
src/semble/cli.py Reviews (1): Last reviewed commit: "test: tighten unattended-path tests" | Re-trigger Greptile |
Comment on lines
+232
to
+237
| if args.type and not args.agent: | ||
| parser.error("--type requires --agent") | ||
|
|
||
| from semble.installer import run | ||
|
|
||
| run(args.command) | ||
| integration_ids = None if not args.type or "all" in args.type else [IntegrationType(t) for t in args.type] |
There was a problem hiding this comment.
Mixed All Ignores Specific Types
When --type all subagent or another mixed all invocation is passed, this branch turns the selection into None, so the installer applies every integration and silently ignores the extra specific values. Since --type accepts multiple values, this can install or remove a wider scope than the caller requested.
Suggested change
| if args.type and not args.agent: | |
| parser.error("--type requires --agent") | |
| from semble.installer import run | |
| run(args.command) | |
| integration_ids = None if not args.type or "all" in args.type else [IntegrationType(t) for t in args.type] | |
| if args.type and not args.agent: | |
| parser.error("--type requires --agent") | |
| if args.type and "all" in args.type and len(args.type) > 1: | |
| parser.error("--type all cannot be combined with other types") | |
| from semble.installer import run | |
| integration_ids = None if not args.type or "all" in args.type else [IntegrationType(t) for t in args.type] |
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.
This PR adds non-interactive flags to semble install/uninstall for sandboxed/scripted environments, e.g. semble install --agent claude --type subagent --yes. Closes #212.