Skip to content
Draft
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
84 changes: 84 additions & 0 deletions docs/dir/directory-cli-reference.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,89 @@
# Directory CLI Command Reference

## Daemon Operations

The daemon commands run a self-contained local directory server that bundles the gRPC apiserver and reconciler into a single process with embedded SQLite and a filesystem OCI store. All state is stored under `~/.agntcy/dir/` by default.

### `dirctl daemon start`

Starts the local directory daemon in the foreground. The process blocks until `SIGINT` or `SIGTERM` is received.

The daemon starts a gRPC apiserver on `localhost:8888` and runs all reconciler tasks (regsync, indexer, name resolution, signature verification) in-process. It uses SQLite for persistence and a local filesystem OCI store, so no external dependencies (PostgreSQL, container registry, etc.) are required.

A PID file is written to the data directory to prevent multiple instances from running simultaneously.

| Flag | Description | Default |
|------|-------------|---------|
| `--data-dir` | Data directory for daemon state | `~/.agntcy/dir/` |

??? example

```bash
# Start the daemon (foreground, blocks until signal)
dirctl daemon start

# Start with a custom data directory
dirctl daemon start --data-dir /path/to/data

# Run in the background using shell job control
dirctl daemon start &
```

**Data directory layout:**

```
~/.agntcy/dir/
├── dir.db # SQLite database
├── store/ # Filesystem OCI store
├── routing/ # DHT routing datastore
└── daemon.pid # PID file for lifecycle management
```

### `dirctl daemon stop`

Stops a running daemon by sending `SIGTERM` to the process recorded in the PID file. The command waits for the process to exit gracefully and cleans up the PID file.

| Flag | Description | Default |
|------|-------------|---------|
| `--data-dir` | Data directory for daemon state | `~/.agntcy/dir/` |

??? example

```bash
# Stop the running daemon
dirctl daemon stop

# Stop a daemon using a custom data directory
dirctl daemon stop --data-dir /path/to/data
```

### `dirctl daemon status`

Checks whether the daemon is currently running by inspecting the PID file.

| Flag | Description | Default |
|------|-------------|---------|
| `--data-dir` | Data directory for daemon state | `~/.agntcy/dir/` |

??? example

```bash
# Check daemon status
dirctl daemon status
```

Example output when running:

```
Daemon is running (PID 12345)
```

Example output when stopped:

```
Daemon is not running
```

## Storage Operations

### `dirctl push <file>`
Expand Down
26 changes: 26 additions & 0 deletions docs/dir/directory-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ The Directory CLI can be installed in the following ways:

## Quick Start

### Local Daemon (No External Dependencies)

The fastest way to get a fully functional local directory is to run the built-in daemon:

```bash
# Start the daemon (runs apiserver + reconciler in one process)
dirctl daemon start
```

This starts a gRPC server on `localhost:8888` with embedded SQLite and a filesystem OCI store. All data is stored under `~/.agntcy/dir/` by default. No PostgreSQL, Docker, or external registry required.

Once the daemon is running, use any `dirctl` command against it:

```bash
dirctl --server-addr localhost:8888 push my-agent.json
```

To stop the daemon:

```bash
dirctl daemon stop
```

### Using an Existing Server

The following example demonstrates how to store, publish, search, and retrieve a record using the Directory CLI:

1. Store a record
Expand Down Expand Up @@ -442,6 +467,7 @@ dirctl --spiffe-socket-path /run/spire/sockets/agent.sock routing list

The CLI follows a clear service-based organization:

- **Daemon**: Local directory server (`daemon start`, `daemon stop`, `daemon status`).
- **Auth**: GitHub OAuth authentication (`auth login`, `auth logout`, `auth status`).
- **Storage**: Direct record management (`push`, `pull`, `delete`, `info`).
- **Import**: Batch imports from external registries (`import`).
Expand Down
Loading