Skip to content

Commit 38d972b

Browse files
authored
refactor(python): rename navigator module to openshell and migrate config to gateway paths (#220)
1 parent 7901b03 commit 38d972b

39 files changed

+232
-225
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Default gateway name used by `openshell` commands in this repo when `--gateway`
1515
# is not provided. Usually matches CLUSTER_NAME.
16-
#OPENSHELL_CLUSTER=openshell-c
16+
#OPENSHELL_GATEWAY=openshell-c
1717

1818
# ---------- Ports ----------
1919

.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# diffs, stats, and language detection.
33

44
# Generated Python protobuf stubs
5-
python/navigator/_proto/*_pb2.py linguist-generated
6-
python/navigator/_proto/*_pb2_grpc.py linguist-generated
7-
python/navigator/_proto/*_pb2.pyi linguist-generated
5+
python/openshell/_proto/*_pb2.py linguist-generated
6+
python/openshell/_proto/*_pb2_grpc.py linguist-generated
7+
python/openshell/_proto/*_pb2.pyi linguist-generated
88

99
# Generated Rust protobuf code (excludes hand-written mod.rs)
1010
crates/navigator-core/src/proto/navigator.*.rs linguist-generated

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ dmypy.json
9696
cython_debug/
9797

9898
# Generated Python protobuf stubs (keep package marker)
99-
python/navigator/_proto/*
100-
!python/navigator/_proto/__init__.py
99+
python/openshell/_proto/*
100+
!python/openshell/_proto/__init__.py
101101

102102
# =============================================================================
103103
# IDE / Editor

TESTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mise run ci # Everything: lint, compile checks, and tests
1313
```
1414
crates/*/src/ # Inline #[cfg(test)] modules
1515
crates/*/tests/ # Rust integration tests
16-
python/navigator/ # Python unit tests (*_test.py suffix)
16+
python/openshell/ # Python unit tests (*_test.py suffix)
1717
e2e/python/ # Python E2E tests (test_*.py prefix)
1818
e2e/rust/ # Rust CLI E2E tests
1919
```
@@ -49,7 +49,7 @@ mise run test:rust # cargo test --workspace
4949
## Python Unit Tests
5050

5151
Python unit tests use the `*_test.py` suffix convention (not `test_*` prefix)
52-
and live alongside the source in `python/navigator/`. They use mock-based
52+
and live alongside the source in `python/openshell/`. They use mock-based
5353
patterns with fake gRPC stubs:
5454

5555
```python
@@ -167,4 +167,4 @@ The harness (`e2e/rust/src/harness/`) provides:
167167

168168
| Variable | Purpose |
169169
|---|---|
170-
| `OPENSHELL_CLUSTER` | Override active cluster name for E2E tests |
170+
| `OPENSHELL_GATEWAY` | Override active gateway name for E2E tests |

architecture/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ The CLI is the primary way users interact with the platform. It provides command
238238
- **Provider management** (`openshell provider`): Create, update, list, and delete external service credentials.
239239
- **Inference management** (`openshell cluster inference`): Configure cluster-level inference by specifying a provider and model. The gateway resolves endpoint and credential details from the named provider record.
240240

241-
The CLI resolves which cluster to operate on through a priority chain: explicit `--gateway` flag, then the `OPENSHELL_CLUSTER` environment variable, then the active cluster set by `openshell gateway select`. It supports TLS client certificates for mutual authentication with the gateway.
241+
The CLI resolves which gateway to operate on through a priority chain: explicit `--gateway` flag, then the `OPENSHELL_GATEWAY` environment variable, then the active gateway set by `openshell gateway select`. It supports TLS client certificates for mutual authentication with the gateway.
242242

243243
## How Users Get Started
244244

architecture/build-containers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The sandbox container runs inside each sandbox pod. It contains the sandbox supe
7272

7373
- Multi-user isolation: `supervisor` (runs the sandbox supervisor) and `sandbox` (runs the restricted agent process).
7474
- Policy files are mounted at `/var/navigator/policy.rego` (rules) and `/var/navigator/data.yaml` (data) when running in file-based policy mode.
75-
- The Python SDK is copied directly into the venv's site-packages at `/app/.venv/lib/python3.12/site-packages/navigator/`.
75+
- The Python SDK is copied directly into the venv's site-packages at `/app/.venv/lib/python3.12/site-packages/openshell/`.
7676

7777
### Gateway Image (`openshell/server`)
7878

architecture/gateway-deploy-connect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ When any CLI command needs to talk to the gateway, it resolves the target throug
1212

1313
1. `--gateway-endpoint <URL>` flag (direct URL, reusing stored metadata when the gateway is known).
1414
2. `--cluster <NAME>` / `-g <NAME>` flag.
15-
3. `OPENSHELL_CLUSTER` environment variable.
16-
4. Active cluster from `~/.config/openshell/active_cluster`.
15+
3. `OPENSHELL_GATEWAY` environment variable.
16+
4. Active gateway from `~/.config/openshell/active_gateway`.
1717

1818
Resolution loads `ClusterMetadata` from disk to get the `gateway_endpoint` URL and `auth_mode`. When `--gateway-endpoint` is used, the CLI still tries to match the URL to stored metadata so edge auth tokens and TLS bundles continue to resolve by cluster name.
1919

architecture/tui.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ The TUI is a subcommand of the OpenShell CLI, so it inherits all your existing c
1010
openshell term # launch against the active gateway
1111
nav term # dev alias (builds from source)
1212
nav term --gateway prod # target a specific gateway
13-
OPENSHELL_CLUSTER=prod nav term # same thing, via environment variable
13+
OPENSHELL_GATEWAY=prod nav term # same thing, via environment variable
1414
```
1515

1616
Gateway resolution follows the same priority as the rest of the CLI:
1717

1818
1. `--gateway` flag (if provided)
19-
2. `OPENSHELL_CLUSTER` environment variable
20-
3. Active gateway from `~/.config/openshell/active_cluster`
19+
2. `OPENSHELL_GATEWAY` environment variable
20+
3. Active gateway from `~/.config/openshell/active_gateway`
2121

2222
No separate configuration files or authentication are needed.
2323

crates/navigator-cli/src/tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn tls_dir_for_gateway(name: &str) -> Option<PathBuf> {
113113
///
114114
/// Used when no gateway name is set (e.g., `SshProxy` which receives a raw URL).
115115
fn default_tls_dir(server: &str) -> Option<PathBuf> {
116-
let mut name = std::env::var("OPENSHELL_GATEWAY_NAME")
116+
let mut name = std::env::var("OPENSHELL_GATEWAY")
117117
.ok()
118118
.filter(|value| !value.trim().is_empty());
119119

crates/navigator-cli/tests/mtls_integration.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,9 @@ async fn cli_requires_client_cert_for_https() {
347347
let addr = run_server(server_cert, server_key, ca_cert.clone()).await;
348348

349349
let dir = tempdir().unwrap();
350-
let cluster_name = dir
351-
.path()
352-
.file_name()
353-
.unwrap()
354-
.to_string_lossy()
355-
.to_string();
356-
let _env = EnvVarGuard::set("OPENSHELL_CLUSTER_NAME", &cluster_name);
350+
// Point XDG_CONFIG_HOME at the isolated temp dir so that default_tls_dir
351+
// cannot discover real client certs from the developer's machine.
352+
let _xdg_env = EnvVarGuard::set("XDG_CONFIG_HOME", &dir.path().to_string_lossy());
357353
let ca_path = dir.path().join("ca.crt");
358354
std::fs::write(&ca_path, ca_cert).unwrap();
359355

0 commit comments

Comments
 (0)