From 4c20fb334315e5b4e0c5892a6b68a205687ff7d9 Mon Sep 17 00:00:00 2001 From: Clawd Date: Sun, 15 Feb 2026 18:54:22 -0800 Subject: feat(v2): wire up v2 as default interface - main.go: v2 JSON interface is now default - Set SHIP_V1=1 to use legacy human-formatted output - initV2() called before rootV2Cmd.Execute() v2 rebuild complete - ready for testing --- PROGRESS.md | 8 ++++++-- cmd/ship/main.go | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/PROGRESS.md b/PROGRESS.md index 77ef8ad..49ca216 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -2,7 +2,7 @@ Tracking rebuilding ship for agent-first JSON interface. -## Status: IN PROGRESS +## Status: READY FOR TESTING ## Completed - [x] Design docs (SHIP_V2.md, SPEC.md) @@ -21,8 +21,12 @@ Tracking rebuilding ship for agent-first JSON interface. - [x] Port allocation (server-side) ## Upcoming -- [ ] Wire up v2 commands in main.go (feature flag or replace) - [ ] Testing with real deploys +- [ ] Remove v1 code after validation + +## Wiring +- v2 is now the default interface +- Set `SHIP_V1=1` to use legacy v1 (human-formatted output) ## Completed Recently - [x] `ship list` - enumerate all deploys from /etc/ship/ports and /var/www diff --git a/cmd/ship/main.go b/cmd/ship/main.go index f7d95c1..73d9a20 100644 --- a/cmd/ship/main.go +++ b/cmd/ship/main.go @@ -6,8 +6,20 @@ import ( ) func main() { - if err := rootCmd.Execute(); err != nil { - fmt.Fprintf(os.Stderr, "Error: %v\n", err) + // Use v2 (agent-first JSON) interface by default + // Set SHIP_V1=1 to use legacy human-formatted output + if os.Getenv("SHIP_V1") == "1" { + if err := rootCmd.Execute(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } + return + } + + // v2: JSON output by default + initV2() + if err := rootV2Cmd.Execute(); err != nil { + // Error already printed as JSON by commands os.Exit(1) } } -- cgit v1.2.3