From 75864eaf3d82fc625963dd58c983de425af8ee61 Mon Sep 17 00:00:00 2001 From: limiteinductive Date: Mon, 30 Mar 2026 09:19:58 +0200 Subject: [PATCH] colony ssh: SSH into colony-vm from the CLI, no bash scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - colony ssh — runs gcloud compute ssh under the hood - Removed scripts/ssh-vm.sh (bash scripts bad, Rust CLI good) - CLAUDE.md: "Avoid bash scripts — put commands in the Rust CLI instead" Co-Authored-By: Claude Opus 4.6 (1M context) --- CLAUDE.md | 2 +- crates/colony-cli/src/main.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 26d38c3..13eb18d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,7 +29,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - **GCP project is `apes-platform`.** Always pass `--project=apes-platform`. - **Region is `europe-west1`.** Zone `europe-west1-b` unless there's a reason to change. - **No split brains.** If two pieces of code represent the same thing, one must derive from the other. DB models and API types are separate Rust layers, but API types are the single source for the wire format. TypeScript types are generated from API types via `ts-rs`. SQL migrations are canonical for the DB. Never hand-write a type that can be derived. -- **Rust first.** Backend code is Rust. Type safety everywhere. If it compiles, it should work. +- **Rust first.** Backend code is Rust. Type safety everywhere. If it compiles, it should work. Avoid bash scripts — put commands in the Rust CLI instead. - **Always push.** After committing, push to origin immediately. Never ask the ape "should I push?" — just do it. Handle auth, firewall, DNS issues yourself. - **Document decisions.** When discussing architecture, features, or design with apes, write the spec to `docs/` as a markdown file. Conversations are ephemeral, docs persist. diff --git a/crates/colony-cli/src/main.rs b/crates/colony-cli/src/main.rs index c2132c6..6154b8c 100644 --- a/crates/colony-cli/src/main.rs +++ b/crates/colony-cli/src/main.rs @@ -71,6 +71,8 @@ enum Commands { #[arg(long)] quiet: bool, }, + /// SSH into colony-vm + Ssh, /// Initialize .colony.toml Init { #[arg(long)] @@ -87,6 +89,15 @@ async fn main() { let cli = Cli::parse(); match cli.command { + Commands::Ssh => { + let status = std::process::Command::new("gcloud") + .args(["compute", "ssh", "colony-vm", "--zone=europe-west1-b", "--project=apes-platform"]) + .status(); + match status { + Ok(s) => std::process::exit(s.code().unwrap_or(1)), + Err(e) => { eprintln!("failed to run gcloud: {}", e); std::process::exit(1); } + } + } Commands::Init { api_url, user, token } => { let config = Config { api_url, @@ -224,6 +235,7 @@ async fn run_command(cmd: Commands, client: &ColonyClient) { } } + Commands::Ssh => unreachable!(), Commands::Init { .. } => unreachable!(), } }