FabricFabricSDK

CLI

fabric integrations — list, schema, auth, setup, watch-renew, run, generate, ui.

The fabric CLI ships under @fabricorg/cli. Install globally or use via pnpm dlx fabric.

pnpm add -g @fabricorg/cli
fabric integrations --help

Commands

fabric integrations list                       # Installed plugins
fabric integrations list-operations            # Endpoints across plugins
  [--plugin <name>]                            # Filter to one plugin

fabric integrations schema <pluginId.path>     # Dump operation Zod schema
                                               # (with did-you-mean hints)

fabric integrations auth                       # Interactive OAuth flow
  --plugin <name>
  [--tenant <id>]                              # default: user:cli
  [--port <n>]                                 # callback listener port

fabric integrations setup                      # Interactive credential prompt
  --plugin <name>
  [--tenant <id>]                              # default: user:cli
  [--backfill]

fabric integrations watch-renew                # Refresh OAuth tokens before expiry
  [--threshold-secs <n>]                       # default 600
  [--every-secs <n>]                           # default 60
  [--once]                                     # cron-friendly single pass

fabric integrations script                     # Run JS with `fabric` in scope
  --code '<js>'

fabric integrations ui                         # Open Fabric Studio (port 4317)
fabric integrations mcp                        # Start the MCP server (stdio)

fabric integrations generate <name>            # Scaffold a new plugin
  [--out <path>]

auth — interactive OAuth flow

Drives a real OAuth handshake from the terminal:

  1. Picks a free local port (or use --port)
  2. Prompts for client_id + client_secret (hidden input)
  3. Generates the auth URL via @fabricorg/integrations/oauth
  4. Opens it in your default browser
  5. Captures the /callback?code=...&state=... redirect
  6. Calls exchangeCodeForTokens
  7. Prints the resulting access_token / refresh_token / expires_in for you to paste into your config

Built-in OAuth registry covers slack, gmail, google-calendar, googlesheets, hubspot, github, notion, linear, asana. Add new providers by extending OAUTH_REGISTRY in packages/cli/src/commands/integrations/index.ts.

setup — credential prompt

Prompts for each field your plugin's auth type requires (e.g. botToken for Slack, email+apiToken+siteUrl for Jira). Secret fields use password input.

On completion, prints two artifacts:

  1. Factory call wired into a fabric.integrations.ts template with process.env.<UPPER_SNAKE_CASE> placeholders
  2. Shell exports to drop into .env or your shell rc
fabric integrations setup --plugin jira

 Credentials captured.

Wire them into your fabric.integrations.ts like this:

  import { jira } from '@fabricorg/integrations/plugins';

  const fabric = createFabric({
    plugins: [
      jira({
        email: process.env.JIRA_EMAIL,
        apiToken: process.env.JIRA_API_TOKEN,
        siteUrl: process.env.JIRA_SITE_URL,
      }),
    ],
  });

And export the values into your shell / .env:

  export JIRA_EMAIL='you@acme.com'
  export JIRA_API_TOKEN='ATATT...'
  export JIRA_SITE_URL='https://acme.atlassian.net'

schema — operation Zod schema dump

fabric integrations schema slack.channels.list
{
  "pluginId": "slack",
  "path": "channels.list",
  "riskLevel": "read",
  "description": "List channels in the workspace.",
  "input": {
    "limit": "number?",
    "cursor": "string?"
  },
  "output": "object"
}

Friendly "did you mean…" suggestion when the path is close to a valid one:

fabric integrations schema slack.cnannels.list
 Operation "slack.cnannels.list" not found.
Did you mean:
  slack.channels.list
  slack.channels.create
  slack.channels.archive

watch-renew — token refresh loop

fabric integrations watch-renew --threshold-secs 1200 --every-secs 60

Background loop that refreshes OAuth access_tokens expiring within --threshold-secs of now. Use --once for cron / systemd timer wiring.

generate — scaffold a new plugin

fabric integrations generate my-plugin

Writes packages/integrations-v2/src/plugins/my-plugin/index.ts with a working FabricPlugin factory:

  • typed Context with optional fetcher override
  • one demo endpoint (demo.get)
  • exhaustive endpointMeta typed via RequiredPluginEndpointMeta
  • factory export ready to add to the barrel

Replace the demo endpoint, export from src/plugins/index.ts, optionally add to BaseProviders in src/constants/index.ts for type-level discoverability, and you're done.