Skip to content
agntcyPublic

About

TUI to access and manage records in DIR

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

lazydir

GitHub Release CI Coverage License

A terminal user interface (TUI) for browsing and managing records in AGNTCY Directory instances — inspired by lazygit and lazydocker.

Overview

lazydir lets you explore AGNTCY Directory nodes without memorizing dirctl commands. It presents the directory's contents in three navigable panels on the left and a live preview panel on the right:

┌────────────────────────┬──────────────────────────────────────────────┐
│ [1] Connections        │ [0] Preview                                  │
│  ● Directory: localh…  │                                              │
│  ● OASF: schema.oasf…  │  Syntax-highlighted JSON of the              │
├────────────────────────│  selected record                             │
│ [2] Filters            │                                              │
│  ▶ Skills              │                                              │
│      natural_language… │                                              │
│  ▶ Domains             │                                              │
│  ▶ Modules             │                                              │
│  ▶ OASF version        │                                              │
│  ▶ Author              │                                              │
│  ▶ Trusted / Verified… │                                              │
├────────────────────────│                                              │
│ [3] Records  /filter   │                                              │
│  > cisco.com/agent  v1 │                                              │
│    example.com/bot  v2 │                                              │
│    …                   │                                              │
└────────────────────────┴──────────────────────────────────────────────┘
  navigate: ↑↓  focus: tab  filter records: /  expand: enter  ?: help

Features by panel

[1] Connections — live status for Directory and OASF endpoints; switch servers with c/o; view connection details with i.

[2] Filters — collapsible categories (Skills, Domains, Modules, OASF version, Author, Trusted / Verified / Safe); toggle options with enter/space (include, then exclude); selected values within one category are combined with OR (two skills match records with either), categories with AND, and an excluded value drops every record that carries it; the trusted, verified, and safe options are separate checks and combine with AND, where "safe" matches records that every security scanner reported safe and excluding it shows the records a scanner flagged as unsafe (records that were never scanned match neither); / to search across all categories by name, caption, or ID; i to open a popup with the OASF class hierarchy and description.

[3] Records — filtered list showing name, version, and trust badges (T trusted, V verified, S safe, a red ! when a scanner flagged the record unsafe, · when unset or not scanned; badges move to a second line when the panel is too narrow); filtering is server-side and paginated, and the filter option lists come from the server's ListFilterValues RPC (only values actually present are offered); records load page by page as you scroll, and the panel title shows the total count; records are a flat list ordered by recency, one row per record version; / for live name filtering; i for record info popup (CID, annotations, schema version, created-at, trusted / verified / safe marks); y to yank/copy CID or full JSON; r to refetch records and filter options from the server; space selects records and ctrl+a selects every loaded record (records not yet loaded by scrolling are not included), and while a selection exists d, P, and U delete, publish, or unpublish the selected records instead of the highlighted one, skipping records that are still syncing or that the action does not apply to; changing filters, the name filter, or the server clears the selection, as does esc.

[0] Preview — syntax-highlighted JSON of the selected record; scrollable when focused.

Network mode

Select the Mode line in Connections and press c to switch between browsing this node (green dot) and discovering records across the network (yellow dot). In network mode the Filters and Records panels run a routing search, the same search as dirctl routing search: one query per selected value, results ranked by match score, and + / - to raise or lower the minimum score (default 1).

  • Filters offer values from the OASF taxonomy for Skills, Domains and Modules; the OASF version you pick decides which taxonomy is shown. Author and Trusted / Verified / Safe are not available, there is no exclude, and x clears the selected values and versions.
  • Records lists CIDs only, up to 100 results (the title notes when the list may be truncated). enter previews a record straight from the peer that announced it, when the peer is reachable. S syncs the highlighted record into this node, or every selected record (space, ctrl+a); i on a failed row shows why the sync failed; esc clears the selection; r reruns the search.
  • Keys that change local records (d, P, U, C, V, X, y, /) do nothing in network mode.

Prerequisites

  • Go 1.27.3+
  • A running AGNTCY Directory server (local daemon or remote), >= v1.9.0. lazydir lists records with ListRecordSummaries and fills the filter options with ListFilterValues; against a server older than v1.8.0 the Records panel shows an error asking for v1.9.0 or newer. The trust badges and the info popup's trust status come from the trusted, verified and safe fields v1.9.0 added to ListRecordSummaries; a v1.8.x server still lists records but does not send them, so every record there shows as not trusted, not verified and not scanned.

To start a local daemon for testing:

dirctl daemon start

Installation

Homebrew

brew tap agntcy/lazydir https://github.com/agntcy/lazydir
brew install lazydir

Go install

go install github.com/agntcy/lazydir@latest

Build from source

Using go build:

git clone https://github.com/agntcy/lazydir
cd lazydir
go build -o lazydir .

Or using Task:

git clone https://github.com/agntcy/lazydir
cd lazydir
task build        # downloads deps and builds into .bin/lazydir

Development workflow

Command Description
task deps Download Go module dependencies
task build Build the binary into .bin/lazydir (incremental)
task run Build and immediately start lazydir
task fmt Format Go source files (gofmt -s)
task vet Run go vet
task lint Run golangci-lint (must be installed)
task test:unit Run unit/integration tests in internal/* (includes mocked OASF coverage)
task test:e2e Run end-to-end tests against a local DIR daemon
task test:e2e:network Run network-mode end-to-end tests against two peered daemons in temp dirs
task dev:network / task dev:network:stop Start (and seed) or stop two peered DIR daemons for trying network mode: main on localhost:8878, peer on localhost:8898
task check Run fmt + vet + lint + test:unit + test:e2e + build in one step

OASF behavior is validated in the internal/oasf test suite using a mocked server.

Usage

lazydir

All configuration is read from the config file (see Configuration below) and environment variables. Run lazydir --help for a quick reminder.

Environment variables

Variable Description
DIRECTORY_CLIENT_SERVER_ADDRESS Override the Directory server address from config
OASF_SERVER_ADDRESS Override the OASF schema server URL from config
DEBUG Set to any value to write a lazydir_debug.log file

Configuration

lazydir reads an optional config file from ~/.config/lazydir/config.yml (or config.yaml). The XDG_CONFIG_HOME environment variable is respected. See config.example.yml for a complete annotated template.

Theme colors

The TUI uses 10 abstract color slots that default to base16 terminal colors. Each slot can be overridden with a color name, a 256-color index, or a hex true-color value:

gui:
  theme:
    color1: "yellow"        # skills, annotations
    color2: "cyan"          # domains, class tree, accents
    color3: "magenta"       # modules, timestamps
    color4: "green"         # connected indicator, OASF version, loading
    color5: "blue"          # options bar, popup labels
    color6: "red"           # disconnected indicator, unsafe badge
    color7: "brightRed"     # author filter
    color8: "brightYellow"  # trusted / verified / safe filter
    color9: "brightGreen"   # trust badges and info popup marks
    color10: "brightBlack"  # dim/muted text (IDs, unset badges)
    activeBorderColor: "green"    # focused panel border + cursor
    selectedRowBgColor: "8"       # highlighted row background (256-color)

Accepted value formats:

Format Example Applies to
Color name red, brightCyan, yellow all color fields
256-color index 42, 208 all color fields
Hex true-color #ff8800 color1–color10 only

Available color names: black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite.

GUI options

gui:
  scrollStep: 3           # lines per scroll keypress (default: 3)
  splitRatio: 0.33        # left panel width as fraction of terminal (default: 0.33)
  inputDebounceDelay: 150 # ms before live filter fires (default: 150)
  dimLevel: 0.6           # preview dimming when a popup overlays it (0 = off, 1 = invisible)

Server defaults

Config-file defaults for server addresses and timeouts. CLI flags and environment variables still take precedence. Multiple predefined servers can be listed; the first entry is used as the default, and all entries appear in the in-app server selection popup.

server:
  # dirctlConfigPath: "~/.config/dirctl/config.yaml"  # import contexts from dirctl (opt-in)
  directoryServers:
    - address: "localhost:8888"
    - address: "dir.example.com:443"
      oidcIssuer: "https://auth.example.com"
      oidcClientID: "lazydir"
  oasfServers:
    - "https://schema.oasf.outshift.com"
  oasfTimeout: 10  # seconds for OASF HTTP requests (default: 10)

Servers with oidcIssuer and oidcClientID trigger an OIDC device-flow login when no cached token is available. The TUI displays the authorization URL and code inline.

Local daemon

When the selected server is the loopback address the daemon listens on (by default localhost:8888; host and port must match exactly, so 127.0.0.1:8888 needs address: "127.0.0.1:8888") using plain insecure gRPC and it is unreachable, lazydir can start a local daemon for you with dirctl daemon start. If dirctl cannot be found, lazydir shows the hint "Start one with: dirctl daemon start" instead.

server:
  localDaemon:
    mode: ask          # ask (default) | auto | never
    # dirctlPath: "/usr/local/bin/dirctl"  # default: look up dirctl on PATH
    # dataDir: "~/.agntcy/dir"             # passed to dirctl --data-dir
    # address: "localhost:8888"            # where the daemon listens (default)
  • address should match the daemon's server.listen_address; lazydir only offers to start a daemon for a selected server at exactly that host and port.
  • ask prompts before starting the daemon, auto starts it without asking, and never disables the feature.
  • The daemon's output is written to <user cache dir>/lazydir/daemon.log (see os.UserCacheDir(); ~/Library/Caches on macOS, ~/.cache on Linux).
  • A daemon that lazydir started is stopped when lazydir quits, or when the terminal tab closes. A daemon you started yourself is never stopped by lazydir.

Importing dirctl contexts

If you use dirctl, you can point dirctlConfigPath at your dirctl config file to import its named contexts as directory server entries. This avoids duplicating server definitions across both tools.

server:
  dirctlConfigPath: "~/.config/dirctl/config.yaml"

Imported contexts appear in the server selection popup with their context name as a label (e.g. prod (ads.outshift.io:443)). If a manually configured entry in directoryServers has the same address as an imported context, it replaces the imported version in-place (keeping the imported ordering); entries with new addresses are appended after the imported ones. If the dirctl file is missing or unreadable, lazydir prints a warning to stderr and continues with only the manually configured servers.

Pagination

Controls how many records are fetched per page from the directory server.

pagination:
  pageSize: 50  # records per page (default: 50)

stream.firstPageSize is deprecated but still honoured when pagination.pageSize is not set; stream.batchSize is ignored.

Architecture

lazydir/
├── main.go                        # Entry point; flag parsing; config loading
├── go.mod / go.sum
├── internal/
│   ├── config/
│   │   ├── config.go              # Config file loading; color name resolution
│   │   └── dirctl.go              # Parsing dirctl contexts into DirectoryEntry list
│   ├── gui/
│   │   ├── gui.go                 # Top-level Gui struct; gocui init; async helpers
│   │   ├── theme.go               # Color palette (Theme); defaults; config integration
│   │   ├── layout.go              # Panel layout; frame drawing; status bar
│   │   ├── views.go               # Render functions for filters, records, and preview
│   │   ├── keybindings.go         # Key handlers; focus cycling; panel actions
│   │   ├── filters.go             # Filter state; category aggregation; query building
│   │   └── hints.go               # Options-bar and help-popup text generation
│   ├── dirclient/
│   │   └── wrapper.go             # Thin wrapper around github.com/agntcy/dir/client
│   └── oasf/
│       └── fetch.go               # HTTP fetch of OASF class descriptions; in-memory cache

Data sources

Data Source
Record list SearchRecords gRPC call via github.com/agntcy/dir/client
Record JSON Pull gRPC call (by CID)
Record info Pull gRPC call (by CID), decoded to extract metadata
Skill / Domain / Module descriptions OASF SDK schema client via oasf-sdk/pkg/schema

Technology

  • gocui — Terminal UI library (jesseduffield fork, as used by lazygit)
  • Chroma v2 — JSON syntax highlighting
  • agntcy/dir client — gRPC client for Directory API

Contributing

Pull requests and issues are welcome. Please open an issue first to discuss significant changes.

License

Apache-2.0 — see LICENSE.

About

TUI to access and manage records in DIR

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages