Commit 17e7ecf
authored
CLI Pinning (#911)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR introduces **CLI version pinning**: the CLI now clones and
checks out the exact git tag matching `CARGO_PKG_VERSION` when caching
the Helix repository for builds, ensuring the compiled database binary
always matches the CLI version. It also adds a new `helix config`
command for inspecting and switching workspace/project/cluster defaults,
and consolidates previously duplicated cloud-API types from `sync.rs`
and `workspace_flow.rs` into a shared `cloud_api.rs` module.
- **Version-pinned repo cache** (`build.rs`): `git clone --branch vX.Y.Z
--depth 1` and `git fetch/checkout refs/tags/vX.Y.Z` replace the old
`main`-branch clone; a test hardcodes `"v2.3.5"` which will break on
every future version bump.
- **New `helix config` command** (`config.rs`, `lib.rs`, `main.rs`):
sub-commands for listing, showing, and switching workspaces, projects,
and clusters with `--format json/human` support.
- **`cloud_api.rs` extraction**: ~300 lines of duplicated API types and
HTTP helpers are unified into a single module; the Clippy CI workflow
(`clippy_check.yml`) is deleted without a visible replacement.
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| helix-cli/src/commands/build.rs | Adds version-pinned git
clone/fetch/checkout helpers; introduces a brittle test that hardcodes
"v2.3.5" and an OnceLock missing the required const-block wrapper. |
| helix-cli/src/commands/cloud_api.rs | New module centralising all
cloud API types and HTTP helpers previously scattered across sync.rs and
workspace_flow.rs; contains a pre-existing inconsistency in min/max
fallback logic for enterprise cluster count helpers. |
| helix-cli/src/commands/config.rs | New config command implementing
workspace/project/cluster list, show and switch sub-commands with JSON
and human output formats. |
| helix-cli/src/commands/workspace_flow.rs | Refactored to use shared
cloud_api helpers; new project_id_hint path for workspace inference
introduces a duplicate fetch_workspaces call on the fallback path. |
| helix-cli/src/commands/update.rs | Adds v3 upgrade warning before the
self-update proceeds; warning message wording is ambiguous about which
DB format will be unavailable after upgrade. |
| .github/workflows/clippy_check.yml | Deleted — removes the only
automated Clippy CI gate across macOS/Linux/Windows with no apparent
replacement. |
</details>
</details>
<details><summary><h3>Flowchart</h3></summary>
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[helix build / helix sync / helix push] --> B[ensure_helix_repo_cached]
B --> C{cache exists?}
C -- no --> D[create_git_cache\ngit clone --branch vX.Y.Z --depth 1]
C -- yes stale --> E[recreate_helix_cache\nremove + create_git_cache]
C -- yes current --> F[update_git_cache\ngit fetch refs/tags/vX.Y.Z\ngit checkout --detach refs/tags/vX.Y.Z]
D --> G[repo cache pinned to CARGO_PKG_VERSION]
E --> G
F --> G
H[helix config workspace/project/cluster] --> I[cloud_api helpers]
J[helix sync / helix push] --> K[workspace_flow::select_or_load_workspace]
K --> L{project_id_hint?}
L -- yes --> M[fetch_project_details → resolve workspace]
L -- no/unresolved --> N[resolve_current_workspace]
```
</details>
<!-- greptile_failed_comments -->
<details><summary><h3>Comments Outside Diff (1)</h3></summary>
1. `.github/workflows/clippy_check.yml`
<a href="#"><img alt="P2"
src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=7"
align="top"></a> **Clippy CI workflow removed without a replacement**
The `clippy_check.yml` workflow was the only automated enforcement of
Clippy lints across macOS, Linux, and Windows. Removing it means future
PRs can introduce `OnceLock::new()` without `const { }` blocks, `docker
compose` invocations via `Command::new("docker compose")`, and other
patterns caught by the custom rules without any CI gate. If the workflow
is intentionally replaced by a different pipeline, please confirm it
covers the same matrix.
</details>
<!-- /greptile_failed_comments -->
<sub>Reviews (1): Last reviewed commit: ["Remove deprecated Clippy check
workflow
..."](58488f3)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=31971960)</sub>
> Greptile also left **3 inline comments** on this PR.
<!-- /greptile_comment -->29 files changed
Lines changed: 2569 additions & 1398 deletions
File tree
- .github/workflows
- helix-cli
- src
- commands
- logs
- tests
- helix-db/src
- helix_engine
- tests/traversal_tests
- traversal_core/ops
- source
- util
- helix_gateway
- helixc
- analyzer/methods
- parser
This file was deleted.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments