Skip to content

feat: open a run's database in Postico (CLI + dashboard button)#123

Open
david-aurel wants to merge 2 commits into
prosperity-solutions:mainfrom
david-aurel:feat/postico-command
Open

feat: open a run's database in Postico (CLI + dashboard button)#123
david-aurel wants to merge 2 commits into
prosperity-solutions:mainfrom
david-aurel:feat/postico-command

Conversation

@david-aurel

@david-aurel david-aurel commented Jun 16, 2026

Copy link
Copy Markdown

Adds two ways to open a running environment's database in Postico (macOS) with the connection pre-filled — no copying the rotating clone port or password by hand.

1. CLI — veld postico

veld postico                  # auto-pick the run + database node
veld postico --name dev       # target a specific run
veld postico --node database  # disambiguate when several nodes expose DB outputs
veld postico --print          # print the postgresql:// URL instead of opening (e.g. for psql)
veld postico --json           # connection details as JSON (does not open)

Reads DB_HOST/DB_PORT/DB_USER/DB_PASS/DB_NAME from a node's live outputs, auto-detects the database node (--node to pick), builds a percent-encoded postgresql:// URL, and opens Postico (open -a Postico, falling back to the default postgresql:// handler, then an actionable error; non-macOS prints the URL). Run resolution reuses resolve_run_name. --print/--json keep stdout to the payload only.

Mirrors urls.rs (state read) and ui.rs (host open). Handlers return i32; output via crate::output.

2. Dashboard button (veld ui)

The management dashboard now shows a Postico button on the database row of each running environment.

  • New daemon endpoint POST /api/environments/{run}/postico delegates to veld postico --name <run> via the existing run_veld_command path (same as stop/restart). Credentials never reach the browser — the daemon hands off to the CLI.
  • NodeInfo gains a server-computed database: bool flag so the UI knows which row is a database; node outputs/sensitive_keys remain unserialized to the browser.
  • Gated by the same X-Veld-Request CSRF check + validate_run_name; project root resolved server-side.

Shared logic

Database detection lives in veld_core::state::NodeState::exposes_database() (+ DATABASE_OUTPUT_KEYS), used by both the CLI command and the dashboard so they agree on what counts as a database node.

Docs (per AGENTS.md checklist)

README.md CLI table, skills/veld/SKILL.md (Postico section incl. the dashboard button), website/llms-full.txt + website/agents.html CLI tables. (docs/configuration.md / schema n/a — no config field.)

Test plan

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings (veld-core/veld/veld-daemon), and cargo test all green. New unit tests: build_connection_url/find_db_node (CLI) and exposes_database (veld-core).
  • Frontend tsc --noEmit + vitest (396 tests) green on Node 24.
  • Manual E2E (CLI): --print/--json clean; unknown --node errors; default invocation opened Postico against a live dblab clone.
  • CI green on upstream runners.
  • Dashboard button verified live (requires installing the new daemon + CLI).

Opened from a fork (david-aurel/veld) — no push access to upstream.

🤖 Generated with Claude Code

david-aurel and others added 2 commits June 16, 2026 17:47
`veld postico` reads a running environment's database connection details
from the node's live outputs (DB_HOST/DB_PORT/DB_USER/DB_PASS/DB_NAME) and
opens the Postico macOS app with the connection pre-filled — no copying the
rotating clone port or password by hand.

- Auto-detects the node exposing DB_* outputs; `--node` disambiguates when
  several do. Run selection reuses `resolve_run_name` (one active run is used
  automatically; several require `--name`).
- `--print` emits the postgresql:// URL (e.g. for psql); `--json` emits the
  connection details. Both keep stdout to the payload only.
- Falls back to the default postgresql:// handler if Postico isn't found, and
  prints an actionable error otherwise. Non-macOS prints the URL to connect.

Mirrors the urls.rs (state read) and ui.rs (host open) patterns. Userinfo is
percent-encoded so credentials with special characters can't corrupt the URL.

Docs: README CLI table, skills/veld/SKILL.md, website/llms-full.txt + agents.html.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The management dashboard (`veld ui`) now shows a "Postico" button on the
database row of each running environment. Clicking it opens the database in
Postico with the connection pre-filled.

- New daemon endpoint `POST /api/environments/{run}/postico` delegates to
  `veld postico --name <run>` via the existing `run_veld_command` path (the
  same one stop/restart use). The credentials never reach the browser — the
  daemon hands off to the CLI, which builds the URL and opens the app.
- `NodeInfo` gains a `database: bool` flag (computed server-side) so the UI
  knows which row is a database; node `outputs`/`sensitive_keys` are still
  never serialized to the browser.
- Database detection is hoisted into `veld_core::state::NodeState`
  (`exposes_database()` + `DATABASE_OUTPUT_KEYS`) so the CLI command and the
  dashboard share one definition. The `veld postico` command now uses it.

Endpoint is gated by the same `X-Veld-Request` CSRF check and `validate_run_name`
as the other mutating endpoints; the project root is resolved server-side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@david-aurel david-aurel changed the title feat: add veld postico to open a run's database in Postico feat: open a run's database in Postico (CLI + dashboard button) Jun 16, 2026
@david-aurel david-aurel marked this pull request as ready for review June 16, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant