🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@torknetwork/cli

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@torknetwork/cli

Tork Governance CLI — govern your AI agents from the terminal

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
9
-50%
Maintainers
1
Weekly downloads
 
Created
Source

Tork CLI

Command-line interface for Tork Governance — authenticate, wire the Tork SDK into your project, and send governed test requests from the terminal.

$ tork test
✔ Governance decision: redact
  receipt: rcpt_01hxyz…
  latency: 214 ms

Install

# npx (no install)
npx @tork/cli --help

# Homebrew
brew install torkjacobs/tap/tork

Requires Node.js 20 or newer.

Quickstart

tork login    # 1. authenticate with your tork_ API key
tork init     # 2. install the SDK + write tork.config.json in your project
tork test     # 3. send a synthetic governed request end to end
tork doctor   # 4. verify the whole setup

Commands

All commands support --json for machine-readable output (CI, scripts, AI agents).

tork login

Authenticate the CLI. Prompts for your API key with masked input, validates it live against the API, and stores it in ~/.tork/config.json (created with 600 permissions).

FlagDescription
--key <key>Provide the key non-interactively (CI, scripts)
--jsonMachine-readable result

tork init

Set up Tork in the current project. Detects your stack (Node via package.json, Python via requirements.txt/pyproject.toml), flags known AI dependencies (openai, @anthropic-ai/sdk, anthropic, langchain, @langchain/*), installs the tork-governance SDK with the matching package manager, and writes tork.config.json:

{
  "org_id": "",
  "agent_id": "default-agent",
  "agent_role": "assistant",
  "session_tracking": true,
  "base_url": "https://tork.network"
}

An existing tork.config.json is never overwritten — you get a diff-style notice instead. If both ecosystems are present you are asked which to use; if neither is found the command exits 1 with guidance.

FlagDescription
--lang node|pythonSkip stack detection
--yes, -ySkip prompts (defaults to Node when both stacks are present)
--jsonMachine-readable result

tork test

Send a synthetic governed request through POST /api/v1/govern (fake SSN + fake email — never real data) and print the policy decision, receipt id and round-trip latency. Uses agent_id/agent_role/session_tracking from tork.config.json when present. Exits 0 on any valid governance decision, 1 with a diagnostic otherwise.

FlagDescription
--content "<text>"Govern custom content instead of the synthetic sample
--jsonFull response, decision and latency as JSON

tork doctor

Run all setup checks sequentially and keep going through failures:

  • Config file exists with 600 permissions
  • API key present and format-valid
  • DNS + TLS reachability of the base URL
  • /api/v1/health reports healthy
  • Key accepted by the server
  • tork.config.json present in the current directory (warn only)
  • tork-governance SDK installed in the project, with version (warn only)
  • Node.js version ≥ 20

Ends with N passed, N warnings, N failed and exits 1 if anything failed.

FlagDescription
--json{checks: [...], summary: {...}} for CI and AI agents

tork whoami

Print the active key (masked to tork_****last4), organisation (fetched live when possible), base URL, and config path.

Environment variables

VariableEffect
TORK_API_KEYOverrides the stored key — nothing is written to disk (ideal for CI)
TORK_BASE_URLOverrides the API base URL (default https://tork.network)
TORK_CONFIG_DIROverrides ~/.tork (tests / sandboxes)
NO_COLORDisables colored output

CI usage

# .github/workflows/governance-check.yml
jobs:
  governance:
    runs-on: ubuntu-latest
    env:
      TORK_API_KEY: ${{ secrets.TORK_API_KEY }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: {node-version: 20}
      - run: npx @tork/cli doctor --json
      - run: npx @tork/cli test --json

Troubleshooting

SymptomLikely causeFix
Invalid key formatKey doesn't start with tork_Copy the full key from your Tork dashboard
Invalid API key: the server rejected…Key revoked or wrong environmentGenerate a new key, run tork login again
Network error: Could not reach…Offline, firewall, or bad TORK_BASE_URLCheck connectivity; unset TORK_BASE_URL
Request … timed out after 10sSlow network or API incidentRetry; check status via tork doctor
permissions 644, expected 600Config file perms driftedchmod 600 ~/.tork/config.json
No Node or Python project detectedRan tork init outside a projectcd into your project, or use --lang
SDK check warns not installedInstall failed or skippednpm install tork-governance / pip install tork-governance
Colored output breaks log parsingANSI codes in CI logsSet NO_COLOR=1 or use --json

Development

npm install
npm run build     # tsc → dist/
npm test          # vitest
npm run coverage  # coverage for src/lib (threshold 80%)
npm link          # try the `tork` binary locally

Built with oclif; future command packs (e.g. tork chat) ship as separate oclif plugins.

FAQs

Package last updated on 14 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts