Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Project

`ucode` is a Python CLI that configures and launches coding agents through Databricks AI Gateway.
Unity Gateway (`ug`) is a Python CLI that configures and launches coding agents through Databricks
AI Gateway. Its internal Python package remains named `ucode` for backward compatibility.

The package code lives in `src/ucode/`.
Tests live in `tests/`.
Expand All @@ -13,14 +14,14 @@ Tests live in `tests/`.
- Run focused tests with `uv run pytest tests/<file>.py`.
- Run e2e tests with `UCODE_TEST_WORKSPACE=<db_workspace_url> uv run pytest tests/test_e2e.py -v`.
- Run lint with `uv run ruff check .`.
- Run the CLI from the current checkout with `uv run ucode ...`.
- Reinstall the local checkout as the `ucode` tool with `uv tool install --reinstall .`.
- Run the CLI from the current checkout with `uv run ug ...`.
- Reinstall the local checkout as the Unity Gateway tool with `uv tool install --reinstall .`.

## Development

- Use Python 3.12+.
- Keep changes scoped to the requested behavior.
- Follow the existing module boundaries: CLI orchestration in `cli.py`, agent-specific behavior in `agents/<name>.py`, shared agent dispatch in `agents/__init__.py`, Databricks calls in `databricks.py`, skill download (UC fetch client + on-disk writer + download orchestration) in `skills_download.py`, MCP-connection state glue in `mcp.py`, and presentation helpers in `ui.py`. Skill download persists no disk state — it writes files to `--path` (or the home dir) and registers only the schema-less skills MCP connection. `ucode configure skills` with no `--location` (or `--mcp` with no `--location`) registers that schema-less connection without downloading anything.
- Follow the existing module boundaries: CLI orchestration in `cli.py`, agent-specific behavior in `agents/<name>.py`, shared agent dispatch in `agents/__init__.py`, Databricks calls in `databricks.py`, skill download (UC fetch client + on-disk writer + download orchestration) in `skills_download.py`, MCP-connection state glue in `mcp.py`, and presentation helpers in `ui.py`. Skill download persists no disk state — it writes files to `--path` (or the home dir) and registers only the schema-less skills MCP connection. `ug configure skills` with no `--location` (or `--mcp` with no `--location`) registers that schema-less connection without downloading anything.
- Prefer existing helpers for config file writes, state persistence, UI messages, and Databricks authentication.
- Add or update focused tests for behavior changes.
- Do not modify generated or lock files unless the dependency graph intentionally changes.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GitHub Copilot CLI, and Pi through Databricks.
## Installation

```bash
uv tool install git+https://github.com/databricks/ucode
uv tool install git+https://github.com/databricks/unity-gateway
```

Check your version with `ug --version`. Between releases this looks like
Expand Down Expand Up @@ -433,8 +433,8 @@ Contributions are welcome.
### Getting started

```bash
git clone https://github.com/databricks/ucode
cd ucode
git clone https://github.com/databricks/unity-gateway
cd unity-gateway
uv sync
```

Expand Down
4 changes: 2 additions & 2 deletions src/ucode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3401,7 +3401,7 @@ def upgrade_cmd() -> None:
"""Upgrade ug to the latest version from GitHub."""
legacy_distribution = "ucode"
current_distribution = "unity-gateway"
git_url = "git+https://github.com/databricks/ucode"
git_url = "git+https://github.com/databricks/unity-gateway"
installed_distribution = _installed_cli_distribution()
upgrade_requirement = f"{installed_distribution} @ {git_url}"
migrated = False
Expand Down Expand Up @@ -3478,7 +3478,7 @@ def _installed_cli_distribution() -> str:
continue
return distribution_name
# Source checkouts and unusual installers may expose neither distribution.
# The repository is still named ucode when this bridge ships, so use the
# The distribution remains named ucode until the Phase 3 cutover, so use the
# non-destructive legacy upgrade path and let uv report an actionable error.
return "ucode"

Expand Down
2 changes: 1 addition & 1 deletion src/ucode/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# warns when its own token and one of these are both set, so we surface them.
_CLAUDE_TOKEN_ENV_VARS = ("ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_API_KEY")

UCODE_GIT_URL = "git+https://github.com/databricks/ucode"
UCODE_GIT_URL = "git+https://github.com/databricks/unity-gateway"

# status -> (glyph, status_badge kind). "info" is a healthy line that still
# carries an optional suggestion (e.g. the ucode self-upgrade).
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _which(command: str) -> str:

@staticmethod
def _requirement(distribution: str) -> str:
return f"{distribution} @ git+https://github.com/databricks/ucode"
return f"{distribution} @ git+https://github.com/databricks/unity-gateway"

def test_before_cutover_upgrades_ucode_normally_without_verification(self):
with (
Expand All @@ -159,7 +159,7 @@ def test_before_cutover_upgrades_ucode_normally_without_verification(self):
assert "ucode upgraded" in result.output

def test_cutover_migrates_legacy_distribution_and_verifies_commands(self):
git_url = "git+https://github.com/databricks/ucode"
git_url = "git+https://github.com/databricks/unity-gateway"
rename_failure = subprocess.CompletedProcess(
[],
1,
Expand Down Expand Up @@ -269,7 +269,7 @@ def test_cutover_install_failure_has_recovery_command(self):

assert result.exit_code == 1
assert "legacy `ucode` tool was removed" in result.output
assert "uv tool install --force git+https://github.com/databricks/ucode" in re.sub(
assert "uv tool install --force git+https://github.com/databricks/unity-gateway" in re.sub(
r"\s+", " ", result.output
)

Expand Down
20 changes: 20 additions & 0 deletions tests/test_doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,26 @@ def test_warn_and_install_suggestion_when_missing(self):
assert check.suggestion is not None


class TestUcodeCheck:
def test_upgrade_uses_renamed_repository(self):
with (
patch.object(doctor_mod.shutil, "which", return_value="/usr/bin/uv"),
patch.object(doctor_mod.subprocess, "run") as run,
):
assert doctor_mod._upgrade_ucode()

run.assert_called_once_with(
[
"uv",
"tool",
"install",
"--reinstall",
"git+https://github.com/databricks/unity-gateway",
],
check=True,
)


class TestDoctorFlow:
def _only(self, checks: list[Check]):
"""Run doctor() with a fixed set of checks and a stubbed prompter."""
Expand Down
Loading