Command map
Bridge currently exposes these subcommands:| Command | Purpose |
|---|---|
init | Create a bridge.yaml file in the current directory |
connect | Add or update a named provider in bridge.yaml |
remove | Remove a named provider from bridge.yaml |
status | Check the health of configured providers |
ls | List entries from a provider |
read | Read structured context from a provider |
completions | Generate shell completion scripts |
Command conventions
Most Bridge commands follow the same runtime pattern:- load
bridge.yamlfrom the current directory - resolve a named provider if the command needs one
- perform a provider operation inside the configured timeout
- print structured JSON on success
- successful commands print JSON to stdout
- failures print JSON to stderr
- failures exit with a non-zero status code
- exit code
1for most validation and provider errors - exit code
2for I/O, database, and timeout failures
Global options
All commands support the global--timeout flag:
| Flag | Default | Meaning |
|---|---|---|
--timeout <seconds> | 30 | Timeout for provider operations |
bridge --helpbridge --version
Typical workflow
Most teams use the commands in this order:bridge.yaml, connect with an environment variable name instead:
bridge init
Create a new bridge.yaml in the current directory.
Usage
What it does
- creates
bridge.yamlif it does not already exist - uses the current directory name as the default project
name - initializes
providersas an empty map
Success output
On first run:Typical use
bridge connect
Add a named provider connection to bridge.yaml.
Usage
<target> can be:
- a literal URI such as
file://./docsorpostgres://localhost:5432/mydb - a bare environment variable name such as
DATABASE_URL
Examples
What it does
- loads the current
bridge.yaml - interprets
<target>as either a literal URI or an environment variable name - infers the provider type from a literal URI scheme when possible
- inserts the provider under the given name
- saves the updated config back to disk
<target> is an environment variable name, bridge connect writes it into bridge.yaml as ${TARGET} and requires --type <provider>.
bridge connect validates the target format and supported provider type, but it does not verify that the backend is reachable before writing the config. The actual connection check happens later when you run bridge status, bridge ls, or bridge read.
Success output
Supported URI schemes
Current built-in inference supports:file://...→filesystempostgres://...→postgrespostgresql://...→postgres
invalid_uri.
Environment-variable targets
When you pass a bare environment variable name such asDATABASE_URL, Bridge:
- requires
--type - stores
uri: ${DATABASE_URL}inbridge.yaml - resolves the actual value later from the process environment when you run
status,ls, orread
.env file.
Common failure cases
bridge.yamlis missing<target>is neither a supported URI nor a valid environment variable name--typeis missing for an environment-variable target- an environment variable referenced by
bridge.yamlis not set later at runtime
bridge remove
Remove a named provider connection from bridge.yaml.
Usage
Example
Success output
Failure behavior
If the provider name does not exist, Bridge returns aprovider_not_found error and includes the currently available provider names.
bridge status
Check the health of all configured providers.
Usage
What it does
For each provider inbridge.yaml, Bridge:
- expands environment variables in the URI
- creates the provider
- connects to it
- runs that provider’s health check
Success output
Notes
- the filesystem provider reports a directory status
- the Postgres provider runs a lightweight health query
- URIs are redacted in status messages so passwords are not exposed
- provider status is reported per entry, so one broken provider does not stop Bridge from checking the others
bridge ls
List entries from a provider.
Usage
Examples
Success output
Filesystem example:Important runtime note
The current--help text says --from is optional, but the current implementation still requires it. If you omit --from, Bridge returns a provider error asking you to specify a provider name.
Typical use
Usels to discover valid paths before you call read.
Common failure cases
config_not_foundif there is nobridge.yamlin the current directoryprovider_not_foundif--fromnames a provider that is not configuredprovider_errorif the backend cannot connect or the configured root is invalidtimeoutif the provider does not respond before the configured timeout
bridge read
Read structured context from a provider.
Usage
Examples
Filesystem:Output
read always returns a structured ContextValue object with:
datametadata
Current path shapes
The meaning of<PATH> depends on the provider:
| Provider | Path shape | Example |
|---|---|---|
filesystem | relative file path under the provider root | README.md |
postgres | table name | users |
postgres | table plus primary key | users/42 |
--limit
--limit is relevant for database-backed reads that return multiple rows.
- default:
100 - applies to whole-table Postgres reads
- if omitted, Bridge falls back to
100
Path semantics depend on the provider
- Filesystem paths are file paths under the provider root
- Postgres paths are either
tableortable/primary_key
read, see Providers.
Common failure cases
provider_not_foundif the provider name passed to--fromis not configuredpath_traversalif a filesystem read escapes the provider rootprovider_errorif the file, table, or row does not existtimeoutif the provider does not finish the read before the timeout
bridge completions
Generate shell completion scripts for supported shells.
Usage
bashelvishfishpowershellzsh
Examples
What it outputs
bridge completions writes the completion script text to stdout. You can then save or source that output using your shell’s normal setup flow.
Unlike provider commands, completions does not need bridge.yaml and does not talk to any backend.
See Installation for the current installer behavior, completion file locations, and manual setup examples for each shell.
Common error codes
The most useful error codes to know when scripting Bridge are:config_not_foundinvalid_urienv_var_not_setprovider_not_foundprovider_errortimeoutpath_traversalinvalid_identifier
Choosing the right command
- Use
initonce per project - Use
connectwhen adding or updating a backend - Use
removewhen cleaning up provider aliases - Use
statuswhen debugging connectivity - Use
lswhen discovering valid paths - Use
readwhen you want the actual context payload - Use
completionswhen improving your shell workflow
Related pages
Installation
See install methods, PATH behavior, and how the official installers set up completions.
Configuration
Learn how
bridge.yaml is structured and how commands resolve provider names.Providers
See what
filesystem and postgres actually return for ls, read, and status.Security and errors
Understand timeout handling, error codes, secret redaction, and Bridge’s current guardrails.
CLI interface
See the higher-level JSON contract that sits behind these commands.