-
Notifications
You must be signed in to change notification settings - Fork 54
Split ucode setup into per-section commands + apply diff + wizard UX
#341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,15 @@ | |
| recommended_agent, | ||
| resolve_state, | ||
| ) | ||
| from ucode.managed_wizard import apply_command, setup_command, show_command | ||
| from ucode.managed_wizard import ( | ||
| apply_command, | ||
| setup_budget_policy_command, | ||
| setup_command, | ||
| setup_help_command, | ||
| setup_mcp_command, | ||
| setup_skills_command, | ||
| show_command, | ||
| ) | ||
| from ucode.mcp import ( | ||
| MCP_CLIENTS, | ||
| SKILLS_MCP_KIND, | ||
|
|
@@ -265,8 +273,9 @@ def _maybe_offer_admin_setup(workspace: str, profile: str | None) -> None: | |
| if not is_admin: | ||
| return | ||
| print_note( | ||
| "✨ New: as a workspace admin you can publish a managed config with `ucode setup` — set " | ||
| "the agents, models, MCPs, and skills once, and every developer picks them up automatically." | ||
| "✨ New: as a workspace admin you can publish a managed config with `ucode setup` — set the " | ||
| "agents and models once (then MCP servers and skills with `ucode setup mcp` / `skills`), and " | ||
| "every developer picks them up automatically." | ||
| ) | ||
| if prompt_yes_no("Set one up now with `ucode setup`?"): | ||
| # Launch the setup flow in place rather than telling them to re-run a command. Reuse the | ||
|
|
@@ -716,7 +725,7 @@ def _use_databricks() -> dict: | |
| return _use_databricks() | ||
|
|
||
| choice = prompt_for_selection( | ||
| f"How should {display} be configured?", | ||
| f"How should {display} get its models?", | ||
| [ | ||
| ("databricks", "Databricks Hosted"), | ||
| ("mps", "External Models"), | ||
|
|
@@ -1047,7 +1056,9 @@ def revert() -> int: | |
| app.add_typer(mcp_app, name="mcp", help="MCP servers exposed by ucode.") | ||
| setup_app = typer.Typer(add_completion=False, no_args_is_help=False) | ||
| app.add_typer( | ||
| setup_app, name="setup", help="Author the workspace's managed coding config (admins only)." | ||
| setup_app, | ||
| name="setup", | ||
| help="Author the workspace's managed coding config (admins only). See `ucode setup help`.", | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -2661,7 +2672,10 @@ def setup( | |
| ), | ||
| ] = None, | ||
| ) -> None: | ||
| """Author the managed coding config for your workspace (workspace admins only).""" | ||
| """Choose the agents and models for your workspace's managed config (admins only). | ||
|
|
||
| MCP servers, skills, and the budget policy have their own commands — see `ucode setup help`. | ||
| """ | ||
| if ctx.invoked_subcommand is not None: | ||
| return | ||
| # `typer.Exit` subclasses RuntimeError, so it must be raised outside the try — inside, the | ||
|
|
@@ -2679,6 +2693,80 @@ def setup( | |
| raise typer.Exit(code) | ||
|
|
||
|
|
||
| @setup_app.command("mcp") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can this be "mcps" instead of "mcp" for consistency on plurality? bc skills is plural |
||
| def setup_mcp_cmd() -> None: | ||
| """Choose the MCP servers the managed config gives developers (admins only).""" | ||
| # Same `typer.Exit`/RuntimeError ordering trap as the `setup` callback above. | ||
| try: | ||
| install_databricks_cli() | ||
| code = setup_mcp_command() | ||
| except RuntimeError as exc: | ||
| print_err(str(exc)) | ||
| raise typer.Exit(1) from None | ||
| except KeyboardInterrupt: | ||
| print_err("Interrupted.") | ||
| raise typer.Exit(130) from None | ||
| if code: | ||
| raise typer.Exit(code) | ||
|
|
||
|
|
||
| @setup_app.command("skills") | ||
| def setup_skills_cmd( | ||
| location: Annotated[ | ||
| str | None, | ||
| typer.Option( | ||
| "--location", | ||
| help="Skill schemas to publish as `<catalog>.<schema>` (comma-separated for several). " | ||
| "Skips the prompt.", | ||
| ), | ||
| ] = None, | ||
| ) -> None: | ||
| """Choose the skills the managed config gives developers (admins only).""" | ||
| try: | ||
| install_databricks_cli() | ||
| # None means "prompt"; an explicit `--location` is parsed to the list to publish. | ||
| locations = None if location is None else _parse_skill_locations(location) | ||
| code = setup_skills_command(locations) | ||
| except RuntimeError as exc: | ||
| print_err(str(exc)) | ||
| raise typer.Exit(1) from None | ||
| except KeyboardInterrupt: | ||
| print_err("Interrupted.") | ||
| raise typer.Exit(130) from None | ||
| if code: | ||
| raise typer.Exit(code) | ||
|
|
||
|
|
||
| @setup_app.command("budget-policy") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spend-tiers? |
||
| def setup_budget_policy_cmd() -> None: | ||
| """Route developers to cheaper agents as the workspace spends its budget (admins only).""" | ||
| try: | ||
| install_databricks_cli() | ||
| code = setup_budget_policy_command() | ||
| except RuntimeError as exc: | ||
| print_err(str(exc)) | ||
| raise typer.Exit(1) from None | ||
| except KeyboardInterrupt: | ||
| print_err("Interrupted.") | ||
| raise typer.Exit(130) from None | ||
| if code: | ||
| raise typer.Exit(code) | ||
|
|
||
|
|
||
| @setup_app.command("help") | ||
| def setup_help_cmd() -> None: | ||
| """Walk through the managed-config setup: every command, in order, and what's already done.""" | ||
| # No auth and no CLI install: this reads the local draft only, so it works before `ucode | ||
| # configure` and on a machine without the Databricks CLI. | ||
| try: | ||
| code = setup_help_command() | ||
| except RuntimeError as exc: | ||
| print_err(str(exc)) | ||
| raise typer.Exit(1) from None | ||
| if code: | ||
| raise typer.Exit(code) | ||
|
|
||
|
|
||
| @setup_app.command("show") | ||
| def setup_show_cmd() -> None: | ||
| """Print the authored managed config and the payload `ucode apply` would publish.""" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think it should be
ucode setup applyinstead ofucode apply? with apply at the root level, it shows up inucode --helpfor developers as well and i don't think we want to expose the config at all to the developer, only the admin. it's kind of weird as well to have 2 admin-only commands at the root level that are related to each other.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about adding an "apply? y/n" prompt at the end of each
ucode setup,ucode setup mcps,ucode setup skills,ucode setup spend-tiersso users can apply incrementally? otherwise i might forget, runucode setupagain and then lose my original intended settings. i assume you want the admin to build everything all at once...but it's a bit clunky to have to run a whole new command each time i want to persist my changesUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also if we're going to prompt with "publish this config", maybe it should just be called
ucode setup publish