pgedgecli

package module
v0.5.1-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: PostgreSQL Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

pgEdge Labs

pgEdge CLI

CI

With pgedge, you work with the pgEdge product suite from one command-line interface. Its command shape is pgedge <module> <resource> <verb>.

The CLI has two modules:

  • starfleet: pgEdge Starfleet authentication and account resources, plus the nested byoc and managed infrastructure sub-trees.
  • controlplane: the Control Plane.

Installing the CLI

pgEdge publishes each release on GitHub Releases. To ask a question or report a problem, open a GitHub issue. Getting started covers your first steps.

Each install method suits a different platform and update routine:

Method Platforms Also needs Updates with
AI agent Linux, macOS curl, and Node.js for the skills step pgedge self update
Install script Linux, macOS curl, tar, and sha256sum or shasum pgedge self update
GitHub Actions Linux and macOS runners Nothing else A new tag in uses:
Homebrew Linux, macOS Homebrew brew upgrade pgedge
npm Linux, macOS, Windows Node.js 18 or newer Re-run npm install -g
go install Linux, macOS, Windows Go 1.27.3 or newer Re-run go install
Release by hand Linux, macOS, Windows tar, and sha256sum or shasum pgedge self update
Build from source Linux, macOS Go 1.27.3 or newer, make git pull && make build
Handing the Install to an AI Agent

A coding agent can install the CLI for you, set up shell completion, and add the agent skills for the products you use. The agent asks you which products those are along the way. The install needs curl, plus Node.js for the skills step. If the CLI install fails, the agent stops. If the completion or skills step fails, or you decline it, the agent carries on. Paste this prompt into your coding agent, such as Claude Code or Cursor:

Install the pgEdge CLI on this machine and set up its agent skills.
Follow these steps exactly, in order, and do not improvise an
alternative to any of them. Step 2 installs the CLI: if it fails,
stop and show me the error. Steps 3 and 4 are optional: if one
fails, or I decline it, tell me why and carry on with the next step.

1. Preflight: check `curl` and `npx` exist. If `curl` is missing,
   stop and tell me it is needed for step 2. If `npx` is missing,
   tell me Node.js is needed for step 4, and skip step 4.
2. Install the CLI (no sudo, ever): run
   `curl -fsSL https://raw.githubusercontent.com/pgEdge/pgedge-cli/main/install.sh | sh`.
   The script verifies the release before installing it. Its
   `Installed pgedge <tag> to <path>` line names the binary's full
   path: use that path for `pgedge` in the rest of these steps. If
   the script warns that the directory is not on my PATH, append the
   `export PATH=...` line it prints to the rc file of my login shell
   (`~/.zshrc` for zsh, `~/.bashrc` for bash, creating it if missing,
   and skipping if the line is already there), and tell me you did.
3. Shell completion: the script runs `pgedge completion install`,
   unless `CI` is set. If its output says a line still needs adding
   to my rc file, add that line once.
4. Ask me this question and wait for my answer. Do not guess it:
   "Which pgEdge products do you use: Starfleet, Control Plane,
   both, or neither?" For neither, skip this step. Otherwise install
   the matching agent skills for my user, so every project has
   them. Replace `<tag>` with the tag from step 2's `Installed`
   line, so the skills match the binary:
   - starfleet: `npx -y skills add 'pgEdge/pgedge-cli#<tag>' -g -s pgedge -s pgedge-starfleet -s pgedge-byoc -s pgedge-managed -y`
   - control plane: `npx -y skills add 'pgEdge/pgedge-cli#<tag>' -g -s pgedge -s pgedge-controlplane -y`
   - both: `npx -y skills add 'pgEdge/pgedge-cli#<tag>' -g -y`
5. Verify, and show me the output of each: `pgedge version` and
   `pgedge doctor` (both at the full path from step 2), and
   `npx -y skills list -g` if step 4 ran. A doctor warning about
   missing credentials is expected on a fresh install. If step 4
   ran, tell me the skills load in a new agent session, or after
   `/reload-plugins` in Claude Code. List each
   step you skipped, with the command that completes it later. The
   next step after this setup is `pgedge starfleet auth login`
   (starfleet) or reading `pgedge llms controlplane` (control
   plane).
Installing with the Script (Linux, macOS)

The install script downloads the latest release for your platform and verifies its checksum. When cosign is installed, the script also verifies the release's cosign signature. It installs to /usr/local/bin, and falls back to ~/.local/bin. Run the script:

curl -fsSL https://raw.githubusercontent.com/pgEdge/pgedge-cli/main/install.sh | sh

At a terminal, the script then names the coding agents it finds, such as Claude Code or Cursor, and offers to install the agent skills for your user. The skills are pinned to the release it installed. In CI, when an agent runs the script, or when it finds no agent, it prints that command instead. When the skills are already installed, it says so and asks nothing.

To install one release instead of the newest, set PGEDGE_VERSION to its tag:

curl -fsSL https://raw.githubusercontent.com/pgEdge/pgedge-cli/main/install.sh | PGEDGE_VERSION=<release-tag> sh
Installing in GitHub Actions

On Linux and macOS runners, the action installs the release that its own tag names, and verifies that release's signature. Add this step to your workflow:

- uses: pgEdge/pgedge-cli@v0.5.1-beta.1

CI and automation shows a full pipeline.

Installing with Homebrew (Linux, macOS)

Install from the pgEdge tap with one command:

brew install pgEdge/tap/pgedge

Homebrew then prints the command that installs the agent skills for this release.

Installing with npm

The @pgedge/cli package installs the native binary for your platform. Pre-releases publish under the beta tag, so name the tag to install one:

npm install -g @pgedge/cli@beta

To update, run the same command again. pgedge self update refuses an npm install, because npm owns that binary.

Installing with go install

Go builds the CLI from source at the main branch:

go install github.com/pgEdge/pgedge-cli/cmd/pgedge@main

To build a release instead, put its tag in place of @main. A binary installed this way reports its version as dev.

Downloading a Release by Hand

Download the archive for your platform from GitHub Releases, then verify and extract it:

# verify integrity
sha256sum -c checksums.txt --ignore-missing

# verify authenticity (optional, requires cosign)
cosign verify-blob \
    --bundle checksums.txt.sigstore.json \
    --certificate-identity-regexp \
        '^https://github\.com/pgEdge/pgedge-cli/\.github/workflows/release\.yml@refs/tags/' \
    --certificate-oidc-issuer \
        'https://token.actions.githubusercontent.com' \
    checksums.txt

tar -xzf pgedge_*.tar.gz
install pgedge /usr/local/bin/

If you cannot write to /usr/local/bin, run the install command with sudo, or install to a directory you own on your PATH, such as ~/.local/bin.

pgEdge publishes builds for linux and darwin (amd64, arm64) and windows (amd64, arm64). Archive names are lowercase and use Go's spelling for each architecture. The output of uname maps to those names irregularly across platforms and shells, so take the archive name from the releases page. Windows archives are .zip, and all others are .tar.gz.

Building from Source

Build the binary in a checkout and run it:

make build
./pgedge --help

Updating the CLI

A downloaded release binary updates itself:

pgedge self update           # verify the newest release and swap it in
pgedge self update --check   # just say whether one exists

The command checks the download against the release's Sigstore signature and checksum. It does this before the download touches the installed binary. Afterward, it regenerates an installed completion script. A Homebrew or npm install, or a binary inside a git checkout, stays in place, and the command names the one to run instead: brew upgrade pgedge, npm install -g @pgedge/cli@beta or make build. pgedge doctor also reports the latest release. Updating the CLI has the details.

Setting Up Shell Completion

Enable Tab completion for commands, subcommands and flags:

pgedge completion install

The command detects your shell: bash, zsh, fish or PowerShell. The install script runs it for you, and a Homebrew install ships completion for bash, zsh and fish. The command sets up completion in one of two ways:

  • File install (default). It writes a completion script into the directory your shell loads completions from. Then it prints any step that remains, such as a zsh fpath line or a PowerShell profile line. Your shell loads the script like any other completion file. pgedge self update regenerates the script, so it keeps up with the binary.
  • rc line (--rc-only). It adds one line to your shell's startup file in place of the script. The installed binary makes the completions at every shell start, so they always match it.

To take the second route, run:

pgedge completion install --rc-only

To add the line by hand instead, use the one for your shell:

# ~/.bashrc
eval "$(pgedge completion bash)"

# ~/.zshrc
eval "$(pgedge completion zsh)"

# ~/.config/fish/config.fish
pgedge completion fish | source

# PowerShell $PROFILE
pgedge completion powershell | Out-String | Invoke-Expression

pgedge completion uninstall removes whichever of the two is in place.

To wire up a shell by hand, print its script on its own:

pgedge completion fish
pgedge completion powershell

Release archives also ship a completions/ directory with a script for each shell. It includes pgedge.ps1 for Windows zip users who prefer to wire it up by hand.

Installing the AI-Agent Skills

pgEdge ships five agent skills in plugins/pgedge/skills/. They teach a coding agent to run pgedge correctly. The install script offers to install them when it runs at a terminal. To install them yourself, for your user, run:

npx skills add pgEdge/pgedge-cli --global

That one command serves Claude Code, Codex, Cursor, Copilot, Amp, Antigravity and a dozen others. The repository is also a plugin marketplace. In Claude Code, install the pgedge plugin:

/plugin install pgedge --marketplace pgEdge/pgedge-cli

In Codex, add the marketplace, then install the plugin:

codex plugin marketplace add pgEdge/pgedge-cli
codex plugin add pgedge@pgedge-cli

Installing the Agent Skills covers every route, pinning the skills to a release, and installing without Node.js.

Running the Quickstart

Print the command tree, then sign in:

pgedge --help
pgedge starfleet auth login

Finding the Documentation

The docs/ tree holds the guides and the generated command reference:

AI agents should run pgedge llms instead. It prints the same reference, which is embedded in the binary.

Checking the Version

pgedge version reports the launcher version, plus one version for each module. What its first line reads depends on how the binary was built. Versions, uninstall and support has the details.

Uninstalling the CLI

pgedge completion uninstall removes the shell completion script. Versions, uninstall and support lists everything else the CLI put on the machine, and where.

Developing the CLI

Build, test and lint the checkout:

make build test lint

See CONTRIBUTING.md.

Documentation

Overview

Package pgedgecli embeds the AI-facing index and the root's own pages, so the binary serves them without a checkout.

Each module embeds its own reference alongside its code (internal/<module>/llms.txt), printed by `pgedge llms <module>`. A single llms-full.txt covering every module cost an agent roughly 40k tokens to look up one flag, and left module scope for the doc gates to infer rather than read off the file.

Agent skills in plugins/pgedge/skills/ are distributed by external installers (see the README), not embedded.

Index

Constants

View Source
const IndexSizeBudget = 28 * 1024

IndexSizeBudget bounds the size of the top-level llms.txt index.

Every section added to the index makes it more like the monolith it replaced (the module references totalled 406 KB on 2026-09-24). The budget is the size at the time plus headroom, to make growth deliberate rather than force a rewrite; raise it on purpose, in a commit that says why.

The module references are exempt: an agent reaches one only after the index has told it which, so its size is paid by a caller who already wanted that module.

Variables

View Source
var LLMS []byte

LLMS is the AI-agent index (llms.txt), printed by `pgedge llms`.

Functions

func Pages

func Pages() ([]module.Document, error)

Pages returns the root's own pages, one per top-level command group (`pgedge llms inspect`), without the index. They keep the index small: a task pays for a command's page only when it runs it.

Types

This section is empty.

Directories

Path Synopsis
cmd
caskpatch command
Command caskpatch adds a postflight_steps block to the Homebrew cask goreleaser writes, so a brew-installed macOS binary has its quarantine attribute cleared.
Command caskpatch adds a postflight_steps block to the Homebrew cask goreleaser writes, so a brew-installed macOS binary has its quarantine attribute cleared.
gendocs command
Command gendocs regenerates the AI-agent reference documents from the live cobra tree.
Command gendocs regenerates the AI-agent reference documents from the live cobra tree.
npmpack command
Command npmpack stages the npm packages for a release from that release's published archives: one package per platform holding that platform's binary, and @pgedge/cli, whose launcher finds and runs it.
Command npmpack stages the npm packages for a release from that release's published archives: one package per platform holding that platform's binary, and @pgedge/cli, whose launcher finds and runs it.
pgedge command
vendorspec command
Command vendorspec captures the published per-product OpenAPI contracts into openapi/.
Command vendorspec captures the published per-product OpenAPI contracts into openapi/.
internal
apicall
Package apicall is the raw request behind `pgedge starfleet api` and `pgedge controlplane api`: one HTTP call to a path under the module's API base, over the module's own authenticated client, with the module's own status-to-exit mapping and the CLI's output formats.
Package apicall is the raw request behind `pgedge starfleet api` and `pgedge controlplane api`: one HTTP call to a path under the module's API base, over the module's own authenticated client, with the module's own status-to-exit mapping and the CLI's output formats.
apidefaults
Package apidefaults owns platform-level API defaults: the pgEdge Starfleet base URL and its resolution rule (flag > profile > default).
Package apidefaults owns platform-level API defaults: the pgEdge Starfleet base URL and its resolution rule (flag > profile > default).
atomicfile
Package atomicfile replaces a file in one step, so a reader arriving mid-write sees the whole old file or the whole new one and never a truncated one.
Package atomicfile replaces a file in one step, so a reader arriving mid-write sees the whole old file or the whole new one and never a truncated one.
auth
Package auth resolves API credentials and manages cached access tokens per profile and module under ~/.pgedge/cli/cache/.
Package auth resolves API credentials and manages cached access tokens per profile and module under ~/.pgedge/cli/cache/.
cli
clitest
Package clitest assembles the full pgedge command tree for build-gate tests.
Package clitest assembles the full pgedge command tree for build-gate tests.
config
Package config loads and saves the pgedge CLI configuration at ~/.pgedge/cli/config.yaml with named profiles carrying per-module sections.
Package config loads and saves the pgedge CLI configuration at ~/.pgedge/cli/config.yaml with named profiles carrying per-module sections.
controlplane
Package controlplane implements the pgEdge Control Plane module of the unified pgedge CLI.
Package controlplane implements the pgEdge Control Plane module of the unified pgedge CLI.
controlplane/api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
controlplane/cmd
Package cmd wires the pgEdge Control Plane command tree: the module root, its persistent connection flags, and the HTTP API client shared by every resource command.
Package cmd wires the pgEdge Control Plane command tree: the module root, its persistent connection flags, and the HTTP API client shared by every resource command.
controlplane/svccfg
Package svccfg is a hand-written mirror of the Control Plane's per-service-type config key sets (mcp, rag, postgrest) at the CP release KeysFloor names.
Package svccfg is a hand-written mirror of the Control Plane's per-service-type config key sets (mcp, rag, postgrest) at the CP release KeysFloor names.
docgen
Package docgen renders the command reference, the llms pages and the docs/reference pages, from the live cobra tree.
Package docgen renders the command reference, the llms pages and the docs/reference pages, from the live cobra tree.
dotenv
Package dotenv sets one variable in a .env file, leaving every other line as it was.
Package dotenv sets one variable in a .env file, leaving every other line as it was.
dryrun
Package dryrun records what a mutating command WOULD have sent, and stops it from being sent.
Package dryrun records what a mutating command WOULD have sent, and stops it from being sent.
errbody
Package errbody repairs one specific lie an upstream proxy tells: an error response whose body is not JSON, served under a JSON Content-Type.
Package errbody repairs one specific lie an upstream proxy tells: an error response whose body is not JSON, served under a JSON Content-Type.
httplog
Package httplog renders HTTP requests and responses to a diagnostic stream at an ordered level, and is the one place in this CLI that decides what must never be printed.
Package httplog renders HTTP requests and responses to a diagnostic stream at an ordered level, and is the one place in this CLI that decides what must never be printed.
inspect
Package inspect runs read-only diagnostic queries against a Postgres database and renders the rows.
Package inspect runs read-only diagnostic queries against a Postgres database and renders the rows.
inspect/inspecttest
Package inspecttest is a database/sql driver that answers queries from a script, so a command that runs an inspect analysis can be tested without a Postgres.
Package inspecttest is a database/sql driver that answers queries from a script, so a command that runs an inspect analysis can be tested without a Postgres.
keychain
Package keychain stores the Starfleet client secret in the operating system's credential store: macOS Keychain, the Secret Service on Linux, Credential Manager on Windows.
Package keychain stores the Starfleet client secret in the operating system's credential store: macOS Keychain, the Secret Service on Linux, Credential Manager on Windows.
metricfmt
Package metricfmt renders metric samples for text tables.
Package metricfmt renders metric samples for text tables.
module
Package module defines the contract between the base pgedge CLI and its modules.
Package module defines the contract between the base pgedge CLI and its modules.
projectlink
Package projectlink reads and writes .pgedge/link.yaml, the file that ties a project folder to one database.
Package projectlink reads and writes .pgedge/link.yaml, the file that ties a project folder to one database.
reference
Package reference derives a module's reference pages from the files it embeds, and answers the routing questions `pgedge llms` and the generator ask of them.
Package reference derives a module's reference pages from the files it embeds, and answers the routing questions `pgedge llms` and the generator ask of them.
selfupdate
Package selfupdate implements `pgedge self update`: resolving a release tag from a fetched release list, verifying the downloaded asset, and swapping it into place.
Package selfupdate implements `pgedge self update`: resolving a release tag from a fetched release list, verifying the downloaded asset, and swapping it into place.
starfleet
Package starfleet is the pgEdge Starfleet module: one product, one connection, three faces (account-level resources, byoc, managed).
Package starfleet is the pgEdge Starfleet module: one product, one connection, three faces (account-level resources, byoc, managed).
starfleet/account/api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
starfleet/account/cmd
Package cmd wires the account-level commands of the pgedge starfleet tree: authentication, API clients, tenants, invites and memberships — everything the accounts half of the Starfleet API owns.
Package cmd wires the account-level commands of the pgedge starfleet tree: authentication, API clients, tenants, invites and memberships — everything the accounts half of the Starfleet API owns.
starfleet/byoc
Package byoc holds the byoc sub-tree of the starfleet module: its generated API client, its command tree and its reference pages.
Package byoc holds the byoc sub-tree of the starfleet module: its generated API client, its command tree and its reference pages.
starfleet/byoc/api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
starfleet/byoc/cmd
Package cmd wires the pgEdge BYOC command tree: the module root, its persistent flags, and the authenticated API client shared by every resource command.
Package cmd wires the pgEdge BYOC command tree: the module root, its persistent flags, and the authenticated API client shared by every resource command.
starfleet/cmd
Package cmd wires the pgedge starfleet command tree: the starfleet root, its persistent connection flags, the account-level commands (auth, doctor, tenant, client, invite, membership), and the byoc and managed sub-trees.
Package cmd wires the pgedge starfleet command tree: the starfleet root, its persistent connection flags, the account-level commands (auth, doctor, tenant, client, invite, membership), and the byoc and managed sub-trees.
starfleet/conn
Package conn owns the single pgEdge Starfleet API connection: base-URL and credential precedence, the token exchange and cache, the shared HTTP client, and the exit codes every Starfleet module reports.
Package conn owns the single pgEdge Starfleet API connection: base-URL and credential precedence, the token exchange and cache, the shared HTTP client, and the exit codes every Starfleet module reports.
starfleet/connstr
Package connstr assembles a libpq connection string from the parts a database GET returns, for the managed and byoc connection-string verbs.
Package connstr assembles a libpq connection string from the parts a database GET returns, for the managed and byoc connection-string verbs.
starfleet/managed
Package managed holds the managed sub-tree of the starfleet module: its generated API client, its command tree and its reference pages.
Package managed holds the managed sub-tree of the starfleet module: its generated API client, its command tree and its reference pages.
starfleet/managed/api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
starfleet/managed/cmd
Package cmd wires the pgEdge Managed command tree: the module root, its persistent flags, and the authenticated API client shared by every resource command.
Package cmd wires the pgEdge Managed command tree: the module root, its persistent flags, and the authenticated API client shared by every resource command.
starfleet/settle
Package settle is the end of a Starfleet --wait: after a write's task succeeds, it re-reads the subject until the subject's status says the write is done.
Package settle is the end of a Starfleet --wait: after a write's task succeeds, it re-reads the subject until the subject's status says the write is done.
starfleet/signin
Package signin runs the Auth0 half of a pgEdge Starfleet sign-in: an authorization-code flow with PKCE, its redirect caught on a loopback listener, or the device authorization grant.
Package signin runs the Auth0 half of a pgEdge Starfleet sign-in: an authorization-code flow with PKCE, its redirect caught on a loopback listener, or the device authorization grant.
testsupport
Package testsupport holds the test fixtures every Starfleet module's command tree needs: an isolated Runtime, the stub token/resource server, and the authenticated-command runner.
Package testsupport holds the test fixtures every Starfleet module's command tree needs: an isolated Runtime, the stub token/resource server, and the authenticated-command runner.
useragent
Package useragent names the CLI to the APIs it calls, so server-side analytics can tell its traffic apart from the console's and from other Go clients, which all send Go's default Go-http-client/1.1.
Package useragent names the CLI to the APIs it calls, so server-side analytics can tell its traffic apart from the console's and from other Go clients, which all send Go's default Go-http-client/1.1.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL