@xyteai/cli
v0.12.1
Published
Xyte CLI, TUI, skills, and headless contracts for zero-friction AI operations
Readme
xyte-cli
Built for shell-capable AI agents and automated terminal workflows. Manual terminal use is supported for setup, debugging, and local testing.
- npm: @xyteai/cli
- GitHub Page: docs/index.html
- Command reference: docs/commands.md
- Flows: docs/flows/agent-ops.md
- Schemas: docs/schemas
Install Flow
AI agent
Use this path for Codex, Claude Code/Desktop, GitHub Copilot CLI, VS Code Copilot Agent, and other shell-capable agents. Chat-only assistants can explain commands, but they cannot install the CLI.
Start with environment diagnostics. The report picks the right install mode for this environment and returns copy-pasteable commands in recommendations:
xyte-cli doctor environment --format jsonIf xyte-cli is missing:
npx -y @xyteai/cli@latest doctor environment --format jsonIf the report recommends workspace-local mode:
npm install --prefix ./.xyte-cli/runtime @xyteai/cli@latest
./.xyte-cli/runtime/node_modules/.bin/xyte-cli <command>PowerShell command path:
.\.xyte-cli\runtime\node_modules\.bin\xyte-cli.cmd <command>Before you start: in Xyte, open Settings → API Keys and create a key. Save it in a plain text file outside your project folder (for example xyte-api-key.txt on your Desktop) — any text editor works. Your agent will ask for the file's path. Do not paste API keys into chat. Do not store API keys inside the repo.
Agent prompt (copy/paste):
Use @xyteai/cli in this workspace.
Never print secrets. Do not invent IDs or outputs.
First run `xyte-cli doctor environment --format json`.
If `xyte-cli` is missing, run `npx -y @xyteai/cli@latest doctor environment --format json`.
Follow the report's recommendations.nextCommand and recommendations.commands.
If `xyte-cli setup status` shows no connected tenant, ask me for the path to my API key file (never the key itself) and connect it with the report's setupKeyFile recipe.
Do not ask me to paste API keys into chat.
Do not store API keys inside the repo.
After setup succeeds, offer to delete the key file, then run `xyte-cli init --scope project --agents all --force --no-setup`.
If this surface cannot run shell commands, stop and say I need a shell-capable terminal or agent.Detailed agent guidance: docs/agents.md.
CI / headless
- In Xyte, open Settings → API Keys and create a key.
- In your CI tool (GitHub Actions, GitLab CI, Jenkins), add a secret named
XYTE_CLI_KEYand paste the key as its value. - Make sure the job receives the secret as an environment variable — in GitHub Actions add
env: XYTE_CLI_KEY: ${{ secrets.XYTE_CLI_KEY }}to the step; GitLab CI passes variables automatically. - Add these commands to your pipeline (
acmeis just a name for this connection — use your company name):
npx -y @xyteai/cli@latest setup run --non-interactive --tenant acme --output json
npx -y @xyteai/cli@latest setup status --tenant acme --field tenantIdFor reproducible pipelines, replace @latest with a pinned version (e.g. @0.10.7).
Manual terminal
Install Node.js 22+ first if node --version is missing or below 22 (macOS: brew install node@22, Windows: winget install OpenJS.NodeJS.LTS).
npm install -g @xyteai/cli@latest
xyte-cli --version
xyte-cli setup run
xyte-cli setup status --field tenantId
xyte-cli init --no-setupIf your global npm bin is not on PATH, replace xyte-cli in the commands below with one of these published-package fallbacks:
npx -y @xyteai/cli@latest <command>
npm exec -- @xyteai/cli@latest <command>Use the setup status tenant value as <tenant-id> in the examples below. Persisted credentials default to secure OS-native storage: macOS Keychain, Windows DPAPI, Linux Secret Service. If native storage is unavailable, xyte-cli warns and falls back to file storage. For non-interactive automation and backend details, use the setup guidance in docs/getting-started.md.
Examples (Feature Catalog)
1) Endpoint discovery
xyte-cli api endpoints list
xyte-cli api endpoints describe organization.devices.getDevicesKey params:
api endpoints describe <endpoint-key>
2) Read endpoint call (safe)
xyte-cli api call organization.devices.getDevices \
--tenant <tenant-id> \
--query-json '{"page":1,"per_page":100}' \
--output-mode envelope
xyte-cli api call organization.notes.getDeviceNotes \
--tenant <tenant-id> \
--path-json '{"device_id":"<device-id>"}' \
--query-json '{"page":1,"per_page":100}'Key params:
--tenant <tenant-id>--output-mode envelopefor contract output--strict-jsonfor machine parsing- For
organization.devices.getDevices, incrementpageuntilnext_pageis null/absent or the response reportshas_next_page=false.
2b) Device or space notes
Create/delete note calls are writes; get explicit approval before running them.
xyte-cli api call organization.notes.createDeviceNote \
--tenant <tenant-id> \
--path-json '{"device_id":"<device-id>"}' \
--body-json '{"content":"Mounted behind the left panel."}'
xyte-cli api call organization.notes.deleteDeviceNote \
--tenant <tenant-id> \
--path-json '{"device_id":"<device-id>","id":"<note-id>"}'3) Incident watch (active incidents)
xyte-cli ops watch incidents --tenant <tenant-id> --profile incidents-active --once
xyte-cli ops watch incidents --tenant <tenant-id> --profile incidents-active --interval-ms 2000 --max-polls 10Key params:
- terminal output is human-readable by default; add
--output json --strict-jsonfor machine parsing --onceone snapshot poll and exit--interval-msminimum1000--max-pollsbounded polling
4) Flow discovery and guided remediation
xyte-cli flow list --format text
xyte-cli flow run flow.device-command --tenant <tenant-id> --plan --var device_id=<device-id> --var command=reboot
xyte-cli flow run flow.guided-remediation --tenant <tenant-id> --var incident_id=<incident-id> --var device_id=<device-id> --var command=reboot --var updated_device_name=<device-name>Key params:
flow rundefaults to plan mode--var key=valuefor runtime context- non-completed runs include
nextActionwith the safest next operator command - gate continuation is
--apply --resume <run-id-or-path>
5) Tenant and key slots
xyte-cli config tenant add <tenant-id> --name "Acme"
xyte-cli config tenant use <tenant-id>
xyte-cli config key add --tenant <tenant-id> --provider xyte-org --name primary --key-file ~/.config/xyte/acme.key --set-active
xyte-cli config key list --tenant <tenant-id> --output json
xyte-cli config tenant remove <tenant-id> --confirmKey params:
config tenant removerequires--confirm- prefer
--key-file,--key-stdin, or--key-commandover inline keys - pass
--provider xyte-org|xyte-partnerwhen you need deterministic routing
6) Write example
Primary read/setup/reporting workflows are shell-neutral. Advanced raw API examples like this one remain shell-specific because inline JSON quoting differs across PowerShell, CMD, Bash, and zsh.
xyte-cli flow run flow.device-command --tenant <tenant-id> --plan --var device_id=<device-id> --var command=reboot
xyte-cli api call organization.devices.getDevice \
--tenant <tenant-id> \
--path-json '{"device_id":"<device-id>"}'
xyte-cli edge models describe \
--tenant <tenant-id> \
--model-id <model-id-from-device>
xyte-cli api call organization.commands.sendCommand \
--tenant <tenant-id> \
--path-json '{"device_id":"<device-id>"}' \
--body-json '{"name":"reboot","extra_params":{}}'Behavior:
- prefer
flow.device-commandfor one-device command sends because it reads the device model, validatescommands[].nameand commandcustom_fields, and pauses before the write gate - use
organization.commands.getCommandsonly after sending when you need command queue/history evidence - the raw API call executes directly once you choose the write step
7) Fleet insights and deep-dive data
xyte-cli ops inspect fleet --tenant <tenant-id> --provider-scope auto --output json
xyte-cli ops inspect deep-dive --tenant <tenant-id> --provider-scope auto --window 24 --output json --out ./artifacts/deep-dive.jsonKey params:
--provider-scope organization|partner|auto--window <hours>for deep-dive--output jsonfor pipelines
8) Generate report artifacts
xyte-cli ops report generate --tenant <tenant-id> --input ./artifacts/deep-dive.json --render pdf --out ./reports/fleet-report.pdf
xyte-cli ops report generate --tenant <tenant-id> --input ./artifacts/deep-dive.json --render markdown --out ./reports/fleet-report.mdKey params:
--inputdeep-dive JSON--render markdown|pdffor artifact format--output text|jsoncontrols stdout, not report rendering
9) Headless console snapshots (for agents/automation)
xyte-cli ops console --headless --screen dashboard --once --tenant <tenant-id> --output json
xyte-cli ops console --headless --screen spaces --follow --interval-ms 2000 --tenant <tenant-id> --output jsonKey params:
--screen dashboard|spaces|...--oncesnapshot mode--followstream mode
10) Utility preprocessing + executable workflows
xyte-cli util list-actions --output text --mode friendly
xyte-cli util list-actions --output text --execution-support edge.claim-batch
xyte-cli util prepare \
--action space.import-tree \
--input ./raw-hierarchy.xlsx \
--output-dir ./prepared
xyte-cli util prepare \
--action organization.connectors.prepareSetup \
--input ./raw-connectors.csv \
--output-dir ./prepared
xyte-cli util prepare \
--action organization.teamAccess.groups \
--input ./raw-team.csv \
--output-dir ./prepared
xyte-cli util prepare \
--action organization.teamAccess.users \
--input ./raw-team.csv \
--output-dir ./prepared
xyte-cli util prepare \
--action organization.teamAccess.memberships \
--input ./raw-team.csv \
--output-dir ./prepared
xyte-cli util import-tree --tenant <tenant-id> --input ./prepared/space-import-tree.csv
xyte-cli util import-tree --tenant <tenant-id> --input ./prepared/space-import-tree.csv --apply --report ./reports/space-import.apply.ndjson
xyte-cli util match \
--source ./source-devices.json --target ./target-spaces.json \
--source-field name --target-field name \
--out ./device-moves.csv
xyte-cli util move-devices --tenant <tenant-id> --input ./device-moves.csv
xyte-cli util move-devices --tenant <tenant-id> --input ./device-moves.csv --apply --report ./reports/device-moves.apply.ndjsonKey params:
util prepare --action ... --input ... --output-dir ...util import-treeandutil move-devicesare dry-run unless--apply- dry-runs count validated rows under
totals.planned;totals.succeededis for apply mode - generated
.notes.mdfiles are the human review artifact for prepared data - connector and team-access prepare actions are prepare-only normalization utilities
--reportwrites an NDJSON row report
11) Claim devices
Use docs/claim-devices.md first when the claim path is not explicit. Native/direct, Edge, and C2C are different flows.
# Native / direct claim
xyte-cli api call organization.devices.claimDevice \
--tenant <tenant-id> \
--body-json '{"name":"<name>","space_id":<space-id>,"sn":"<sn>","mac":"<mac>","cloud_id":"<cloud-id>"}'
# Single Edge claim, plan first
xyte-cli edge models list --tenant <tenant-id> --page 1 --per-page 100
xyte-cli edge models describe --tenant <tenant-id> --model-id <device-model-id>
xyte-cli edge claim \
--tenant <tenant-id> \
--proxy-id <proxy-id> \
--device-ip <device-ip> \
--device-model-id <device-model-id> \
--space-id <space-id> \
--custom-parameters '{"SNMP community":"public","Port":"161"}' \
--plan
# Bulk Edge claim, plan first
xyte-cli util prepare --action organization.edge.startClaim --input ./edge-devices.xlsx --output-dir ./prepared
xyte-cli edge claim-batch --tenant <tenant-id> --input ./prepared/organization-edge-startclaim.csv --plan
xyte-cli edge claim-batch --tenant <tenant-id> --input ./prepared/organization-edge-startclaim.csv --apply --report ./reports/edge-claim.apply.ndjson --resume-artifact ./reports/edge-claim.resume.ndjson
# Already-claimed Edge custom parameters, plan first
xyte-cli edge update-params \
--tenant <tenant-id> \
--device-id <device-id> \
--set-json '{"Port":"161"}' \
--plan
xyte-cli util prepare --action edge.params.update --tenant <tenant-id> --input ./edge-params.xlsx --output-dir ./prepared
xyte-cli edge update-params-batch --tenant <tenant-id> --input ./prepared/edge-params-update.csv --plan --report ./reports/edge-params.plan.ndjsonKey params:
edge models listandedge models describeare read-only and are the source for Edge model ids and supported parameter labelsedge claim,edge claim-batch,edge update-params,edge update-params-batch, andedge pingare mutating; run--planfirstedge claimandedge claim-batchaccept optionalmacandsnfields when the source data provides themedge update-paramsandedge update-params-batchsend complete replacementcustom_parametersbodies after validation- blank or
skip_connectivity_check=falsebatch rows run a pre-claim ping beforestartClaim skip_connectivity_check=truerows skip that batch-owned ping- C2C claiming is not exposed through the public API; use the End Customer Portal
12) Edge diagnostics
xyte-cli edge claim-status --tenant <tenant-id> --proxy-id <proxy-id> --device-ip <device-ip>
xyte-cli edge ping --tenant <tenant-id> --proxy-id <proxy-id> --device-ip <device-ip> --plan
xyte-cli edge ping-status --tenant <tenant-id> --proxy-id <proxy-id> --device-ip <device-ip>Key params:
edge claim-statusandedge ping-statusare read-onlyedge pingis a standalone diagnostic command- batch claim owns its own pre-claim ping for rows that require connectivity verification
13) Upgrade flow
xyte-cli upgrade --check --output json
xyte-cli upgrade --yes --output jsonKey params:
--checkdry check--yesnon-interactive upgrade
14) Action logs and diagnostics
xyte-cli --log-actions --log-actions-path ./logs/xyte-cli.actions.ndjson status --tenant <tenant-id>
xyte-cli logs list --path ./logs/xyte-cli.actions.ndjson --limit 200
xyte-cli logs list --path ./logs/xyte-cli.actions.ndjson --session-id <session-id> --output json
xyte-cli logs show --path ./logs/xyte-cli.actions.ndjson --entry <sessionId>:<seq> --output json
xyte-cli logs show --path ./logs/xyte-cli.actions.ndjson --request-id <request-id> --output json
xyte-cli logs stats --path ./logs/xyte-cli.actions.ndjsonKey params:
--log-actionslifecycle NDJSONlogs list --session-idnarrows a runlogs show --entryandlogs show --request-idare exact non-interactive lookups
