Skip to content

Commit e3d9b68

Browse files
committed
v0.9!
1 parent 7cfa667 commit e3d9b68

File tree

22 files changed

+1134
-562
lines changed

22 files changed

+1134
-562
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ cdp
33
.env
44
cdp.json
55
dist/
6+
bin/
7+
.crush
8+
.claude
69
.DS_Store

agents.md

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Commands are organized in the `cmd/` directory:
3030
Coolify API client implementation:
3131
- `client.go` - HTTP client with authentication
3232
- `applications.go` - Application CRUD operations
33-
- `deployments.go` - Deployment management
33+
- `deployments.go` - Deployment management, log parsing, health checks
3434
- `projects.go` - Project management
3535
- `servers.go` - Server listing
3636
- `types.go` - API request/response types
@@ -49,9 +49,9 @@ Framework detection:
4949
#### `internal/deploy/`
5050
Deployment orchestration:
5151
- `setup.go` - First-time project setup wizard
52-
- `git.go` - Git-based deployment logic
53-
- `docker.go` - Docker-based deployment logic
54-
- `watcher.go` - File watcher for development mode
52+
- `git.go` - Git-based deployment logic with verbose output support
53+
- `docker.go` - Docker-based deployment logic with verbose output support
54+
- `watcher.go` - Deployment status watcher with log streaming
5555

5656
#### `internal/docker/`
5757
Docker operations:
@@ -61,12 +61,12 @@ Docker operations:
6161

6262
#### `internal/git/`
6363
Git operations:
64-
- `repo.go` - Git repository management (init, commit, push)
64+
- `repo.go` - Git repository management (init, commit, push, log)
6565
- `github.go` - GitHub API client for repository creation
6666

6767
#### `internal/ui/`
6868
User interface:
69-
- `ui.go` - Terminal UI helpers (spinners, prompts, colors)
69+
- `ui.go` - Terminal UI helpers (prompts, colors, output formatting) using survey library
7070
- `task_runner.go` - BubbleTea task runner for async operations with spinner feedback
7171
- `messages.go` - Message types for BubbleTea communication
7272

@@ -157,6 +157,42 @@ The task runner:
157157
- Can run in verbose mode (no spinner, immediate output)
158158
- Uses BubbleTea for terminal UI management
159159

160+
### Verbose Mode
161+
162+
The CLI supports a global `--verbose` / `-v` flag that enables detailed output:
163+
- Disables spinners in favor of immediate streaming output
164+
- Git operations (`CommitVerbose`, `PushWithTokenVerbose`) stream stdout/stderr in dimmed format
165+
- Deployment operations show real-time progress
166+
- Access verbose state via `cmd.IsVerbose()` from any command
167+
168+
### Debug Mode
169+
170+
Set `CDP_DEBUG=1` environment variable for internal debugging:
171+
- Shows binary hash on startup
172+
- Enables trace output in UI functions
173+
- Shows detailed deployment watcher status
174+
- Logs API call details and error information
175+
176+
### Deployment Watcher Pattern
177+
178+
For monitoring deployments, use `deploy.WatchDeployment()`:
179+
180+
```go
181+
success := deploy.WatchDeployment(client, appUUID)
182+
if success {
183+
ui.Success("Deployment complete")
184+
} else {
185+
ui.Error("Deployment failed")
186+
}
187+
```
188+
189+
The watcher:
190+
- Polls Coolify API for deployment status
191+
- Streams build logs in real-time (dimmed output)
192+
- Handles various Coolify API response formats
193+
- Timeouts after ~4 minutes with configurable polling
194+
- Gracefully handles API errors and missing deployments
195+
160196
## Common Tasks
161197

162198
### Adding a New Command
@@ -181,18 +217,23 @@ The task runner:
181217
### UI Feedback
182218

183219
Always use `internal/ui` helpers:
184-
- `ui.Info()` - Informational messages
185-
- `ui.Success()` - Success messages
186-
- `ui.Warn()` - Warnings
187-
- `ui.Error()` - Error messages
188-
- `ui.Select()` / `ui.Input()` - User prompts
220+
- `ui.Info()` - Informational messages (cyan dot prefix)
221+
- `ui.Success()` - Success messages (green dash prefix)
222+
- `ui.Warning()` - Warnings (yellow exclamation prefix)
223+
- `ui.Error()` - Error messages (red X prefix)
224+
- `ui.Dim()` - Dimmed/muted output
225+
- `ui.Bold()` - Bold text
226+
- `ui.Select()` / `ui.Input()` - User prompts (GitHub CLI style via survey library)
227+
- `ui.Confirm()` - Yes/no prompts
228+
- `ui.Password()` - Secure password input
229+
- `ui.LogChoice()` - Log auto-selected choices without user interaction
189230
- `ui.RunTasks()` - Execute async operations with spinner feedback
190-
- `ui.StepProgress()` - Display step progress (e.g., "Step 1/5")
191-
- `ui.Divider()` - Visual separator
192231
- `ui.Spacer()` - Vertical spacing
193-
- `ui.KeyValue()` - Display key-value pairs
232+
- `ui.KeyValue()` - Display key-value pairs (dimmed, indented)
194233
- `ui.List()` - Display bulleted lists
234+
- `ui.Table()` - Display tabular data
195235
- `ui.NextSteps()` - Display next steps to user
236+
- `ui.DimStyle` - Lipgloss style for dimmed log output
196237

197238
## Important Considerations
198239

@@ -258,11 +299,13 @@ The project includes a Makefile for build automation:
258299
- `make test` - Run tests
259300
- `make help` - Show available targets
260301

302+
**Build Workflow:** Always run `make build && make install` together when making changes to ensure the CLI is updated both in the bin directory and in the system path.
303+
261304
## Dependencies
262305

263306
Key external packages:
264307
- `github.com/spf13/cobra` - CLI framework
265-
- `github.com/charmbracelet/huh` - Interactive prompts
308+
- `github.com/AlecAivazis/survey/v2` - Interactive prompts (GitHub CLI style)
266309
- `github.com/charmbracelet/bubbletea` - Terminal UI framework for task runner
267310
- `github.com/charmbracelet/lipgloss` - Terminal styling
268311
- `github.com/charmbracelet/bubbles` - BubbleTea components (spinner)

cmd/deploy.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55
"os"
6+
"strings"
67

78
"github.com/dropalltables/cdp/internal/api"
89
"github.com/dropalltables/cdp/internal/config"
@@ -48,11 +49,12 @@ func runDeploy() error {
4849

4950
// First-time setup if no project config exists
5051
if projectCfg == nil {
51-
ui.Section("New Project Setup")
52-
ui.Dim("Let's configure your project for deployment")
53-
5452
projectCfg, err = deploy.FirstTimeSetup(client, globalCfg)
5553
if err != nil {
54+
// Exit silently on interrupt
55+
if strings.Contains(err.Error(), "interrupted") {
56+
return nil
57+
}
5658
return err
5759
}
5860
isFirstDeploy = true
@@ -63,24 +65,18 @@ func runDeploy() error {
6365
prNumber := 0
6466
deploymentType := "production"
6567

66-
ui.Spacer()
67-
6868
// Confirm deployments (except first deploy)
6969
if !isFirstDeploy {
7070
confirmed, err := ui.Confirm("Deploy to production?")
7171
if err != nil {
7272
return err
7373
}
7474
if !confirmed {
75-
ui.Dim("Deployment cancelled")
7675
return nil
7776
}
78-
// Confirmation already leaves a blank line, so just show the title
79-
ui.Bold("Deploy")
80-
ui.Spacer()
81-
} else {
82-
ui.Section("Deploy")
8377
}
78+
79+
ui.Spacer()
8480
ui.KeyValue("Project", projectCfg.Name)
8581
ui.KeyValue("Type", deploymentType)
8682
ui.KeyValue("Method", projectCfg.DeployMethod)

0 commit comments

Comments
 (0)