Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.53 KB

File metadata and controls

53 lines (41 loc) · 1.53 KB

Extension SDK

xfetch-extension-api provides the public types that extension authors are expected to use. Extensions are standalone binaries that communicate with xfetch over a stdin/stdout JSON protocol, separate from the plugin system.

Core Types

  • ConfigProviderRequest
  • ConfigProviderResponse
  • ExtensionKind

Runtime Model

xfetch writes one ConfigProviderRequest JSON to stdin (the fully resolved config plus optional args), the extension modifies it, and writes one ConfigProviderResponse JSON to stdout with the new config.

{
  "version": 1,
  "kind": "config_provider",
  "config": { "show_colors": true, "modules": ["os", "cpu"] },
  "args": { "strategy": "random" }
}

Response

{
  "config": { "show_colors": false, "modules": ["cpu", "memory"] }
}

Error Handling

Extensions should write errors to stderr and exit with a non-zero code; the core skips the extension and keeps the previous config.

Design Notes

  • The crate owns the shared wire protocol, not end-user config files.
  • Extensions run at config load time and can modify or replace the effective config.
  • Official extensions are expected to use the same public SDK as third-party extensions.