diff options
| author | Clawd <ai@clawd.bot> | 2026-02-15 18:54:22 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-15 18:54:22 -0800 |
| commit | 4c20fb334315e5b4e0c5892a6b68a205687ff7d9 (patch) | |
| tree | 2c56b30209b6822bfee1b202917753eddbcdc996 | |
| parent | d6740a0be72a776db555d4bb6ccfa4a04da6570a (diff) | |
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
| -rw-r--r-- | PROGRESS.md | 8 | ||||
| -rw-r--r-- | 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 @@ | |||
| 2 | 2 | ||
| 3 | Tracking rebuilding ship for agent-first JSON interface. | 3 | Tracking rebuilding ship for agent-first JSON interface. |
| 4 | 4 | ||
| 5 | ## Status: IN PROGRESS | 5 | ## Status: READY FOR TESTING |
| 6 | 6 | ||
| 7 | ## Completed | 7 | ## Completed |
| 8 | - [x] Design docs (SHIP_V2.md, SPEC.md) | 8 | - [x] Design docs (SHIP_V2.md, SPEC.md) |
| @@ -21,8 +21,12 @@ Tracking rebuilding ship for agent-first JSON interface. | |||
| 21 | - [x] Port allocation (server-side) | 21 | - [x] Port allocation (server-side) |
| 22 | 22 | ||
| 23 | ## Upcoming | 23 | ## Upcoming |
| 24 | - [ ] Wire up v2 commands in main.go (feature flag or replace) | ||
| 25 | - [ ] Testing with real deploys | 24 | - [ ] Testing with real deploys |
| 25 | - [ ] Remove v1 code after validation | ||
| 26 | |||
| 27 | ## Wiring | ||
| 28 | - v2 is now the default interface | ||
| 29 | - Set `SHIP_V1=1` to use legacy v1 (human-formatted output) | ||
| 26 | 30 | ||
| 27 | ## Completed Recently | 31 | ## Completed Recently |
| 28 | - [x] `ship list` - enumerate all deploys from /etc/ship/ports and /var/www | 32 | - [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 ( | |||
| 6 | ) | 6 | ) |
| 7 | 7 | ||
| 8 | func main() { | 8 | func main() { |
| 9 | if err := rootCmd.Execute(); err != nil { | 9 | // Use v2 (agent-first JSON) interface by default |
| 10 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) | 10 | // Set SHIP_V1=1 to use legacy human-formatted output |
| 11 | if os.Getenv("SHIP_V1") == "1" { | ||
| 12 | if err := rootCmd.Execute(); err != nil { | ||
| 13 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) | ||
| 14 | os.Exit(1) | ||
| 15 | } | ||
| 16 | return | ||
| 17 | } | ||
| 18 | |||
| 19 | // v2: JSON output by default | ||
| 20 | initV2() | ||
| 21 | if err := rootV2Cmd.Execute(); err != nil { | ||
| 22 | // Error already printed as JSON by commands | ||
| 11 | os.Exit(1) | 23 | os.Exit(1) |
| 12 | } | 24 | } |
| 13 | } | 25 | } |
