Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- **`cmd/`** - Binary entry points. Contains `ghost/main.go` (the main CLI binary, which sets up context/signal handling and delegates to the internal command infrastructure), `npm-publisher/` (a CI tool that generates and publishes npm packages for each platform), and `generate-docs/` (generates Markdown CLI reference docs to `docs/cli/`).
- **`internal/`** - All core application logic (non-public Go packages).
- **`internal/cmd/`** - Cobra command implementations for all CLI commands (create, fork, list, delete, pause, resume, connect, psql, sql, schema, logs, password, rename, status, feedback, api-key, login, logout, config, mcp, version, completion, payment). Each command lives in its own file, named to match the command in snake_case (e.g. `ghost payment list` → `payment_list.go`). Helper files like `completion.go`, `errors.go`, and `logger.go` contain shared utilities. Commands that are not yet ready for public release can be gated behind the `GHOST_EXPERIMENTAL` env var (see `internal/common/app.go`'s `App.Experimental` field).
- **`internal/cmd/`** - Cobra command implementations for all CLI commands (create, fork, list, delete, pause, resume, connect, psql, sql, schema, logs, password, rename, status, feedback, api-key, login, logout, config, mcp, version, upgrade, completion, payment). Each command lives in its own file, named to match the command in snake_case (e.g. `ghost payment list` → `payment_list.go`). Helper files like `completion.go`, `errors.go`, and `logger.go` contain shared utilities. Commands that are not yet ready for public release can be gated behind the `GHOST_EXPERIMENTAL` env var (see `internal/common/app.go`'s `App.Experimental` field).
- **`internal/api/`** - API client layer. Includes an OpenAPI-generated REST client (`client.go`, `types.go`), shared HTTP client singleton, and request/response types. **Do not edit `client.go` or `types.go` by hand** — they are generated from `openapi.yaml` (see [Code Generation](#code-generation)). The `mock/` subdirectory contains a generated mock of `ClientWithResponsesInterface` for use in tests.
- **`internal/config/`** - Configuration management. Handles config file loading (via Viper), credential storage (keyring with file fallback), and version checking.
- **`internal/common/`** - Shared business logic used across commands and MCP tools. Includes API client initialization, database connection/schema/query utilities, error handling with exit codes, and version update checks.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ ghost list # List all databases
| `schema` | Display database schema information |
| `sql` | Execute SQL query on a database |
| `status` | Show space usage |
| `upgrade` | Upgrade the ghost CLI to the latest version |
| `version` | Show version information |

Run `ghost [command] --help` for more information about a command.
Expand Down
1 change: 1 addition & 0 deletions docs/cli/ghost.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ Ghost is a command-line interface for managing PostgreSQL databases.
* [ghost schema](ghost_schema.md) - Display database schema information
* [ghost sql](ghost_sql.md) - Execute SQL query on a database
* [ghost status](ghost_status.md) - Show space usage
* [ghost upgrade](ghost_upgrade.md) - Upgrade the ghost CLI to the latest version
* [ghost version](ghost_version.md) - Show version information

39 changes: 39 additions & 0 deletions docs/cli/ghost_upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "ghost upgrade"
slug: "ghost_upgrade"
description: "CLI reference for ghost upgrade"
---

## ghost upgrade

Upgrade the ghost CLI to the latest version

### Synopsis

Download and install the latest published version of the ghost CLI, replacing the currently running binary.

If ghost was installed via a package manager (Homebrew, apt, yum/dnf), the upgrade will be refused with a suggestion to use that package manager instead.

```
ghost upgrade [flags]
```

### Options

```
-h, --help help for upgrade
```

### Options inherited from parent commands

```
--analytics enable/disable usage analytics (default true)
--color enable colored output (default true)
--config-dir string config directory (default "~/.config/ghost")
--version-check check for updates (default true)
```

### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 1 addition & 0 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func buildRootCmd() (*cobra.Command, *common.App, error) {
cmd.AddCommand(buildRenameCmd(app))
cmd.AddCommand(buildApiKeyCmd(app))
cmd.AddCommand(buildPaymentInteractiveCmd(app))
cmd.AddCommand(buildUpgradeCmd(app))
if app.Experimental {
cmd.AddCommand(buildInvoiceCmd(app))
}
Expand Down
Loading