AgentSkillsCN

xyte-cli

适用于 @xyte/cli 的各项操作:首次运行配置、租户/密钥认证、受保护的端点调用、检查/报告生成、仅限 JSON 的无头 TUI 截屏,以及提供经过 Schema 验证输出的 MCP 工具服务。

SKILL.md
--- frontmatter
name: xyte-cli
description: "Use for @xyte/cli operations: first-run setup, tenant/key auth, guarded endpoint calls, inspect/report generation, JSON-only headless TUI snapshots, and MCP tool serving with schema-validated outputs."

XYTE Skill Router (One-Stop, Agent-Native)

Last updated: 2026-02-15

This skill is the entrypoint for deterministic Xyte operations via xyte-cli.

Invocation Rules

  • Use xyte-cli commands directly.
  • Do not use source/dev entrypoints (npx, tsx, src/*, dist/*, bin/*).
  • If xyte-cli is unavailable, ask the user to install @xyte/cli globally instead of improvising an entrypoint.
  • Command option correctness:
    • xyte-cli tenant list has no --format.
    • xyte-cli setup status supports --format json|text.

Purpose and Trigger Conditions

Use when the request involves any of:

  • setup/readiness for Xyte access
  • tenant/key-slot management
  • endpoint discovery or endpoint invocation
  • fleet inspection/deep-dive/reporting
  • headless TUI JSON frame consumption
  • MCP tool bridge for external agents

Non-Goals

  • Do not use this skill for arbitrary product strategy or generic markdown authoring.
  • Do not perform writes by default.
  • Do not use headless text output; headless is JSON-only.

Mandatory Safety Rules

  • Default to read-only.
  • Require explicit user intent before writes.
  • Non-read endpoint calls must include --allow-write.
  • Destructive endpoint calls must include --confirm <endpoint-key>.
  • In automation, always pass --tenant <tenant-id>.

Deterministic Execution Order

  1. Setup/readiness:
  • xyte-cli doctor install --format json
  • xyte-cli setup status --tenant <tenant-id> --format json
  • xyte-cli config doctor --tenant <tenant-id> --format json
  1. Auth/tenant (if missing/incomplete):
  • xyte-cli setup run --non-interactive --tenant <tenant-id> --key <value>
  • xyte-cli tenant use <tenant-id>
  • xyte-cli auth key list --tenant <tenant-id> --format json
  1. Endpoint operations:
  • xyte-cli list-endpoints --tenant <tenant-id>
  • xyte-cli describe-endpoint <endpoint-key>
  • xyte-cli call <endpoint-key> --tenant <tenant-id> ...
  1. Insights/reports:
  • xyte-cli inspect fleet --tenant <tenant-id> --format json
  • xyte-cli inspect deep-dive --tenant <tenant-id> --window <hours> --format json
  • xyte-cli report generate --tenant <tenant-id> --input <deep-dive.json> --out <report.pdf>
  1. Headless and MCP:
  • xyte-cli tui --headless --screen <screen> --format json --once --tenant <tenant-id>
  • xyte-cli mcp serve

Workflow Selector

IntentPrimary command
First-time onboarding (interactive)xyte-cli
Setup non-interactivexyte-cli setup run --non-interactive --tenant <tenant-id> --key <value>
Readiness snapshotxyte-cli setup status --tenant <tenant-id> --format json
Connectivity diagnosticsxyte-cli config doctor --tenant <tenant-id> --format json
Read endpoint call + envelopexyte-cli call <endpoint-key> --tenant <tenant-id> --output-mode envelope --strict-json
Guarded write endpoint callxyte-cli call <endpoint-key> --tenant <tenant-id> --allow-write ...
Guarded delete endpoint callxyte-cli call <endpoint-key> --tenant <tenant-id> --allow-write --confirm <endpoint-key> ...
Fleet summaryxyte-cli inspect fleet --tenant <tenant-id> --format json
Deep-dive analyticsxyte-cli inspect deep-dive --tenant <tenant-id> --window <hours> --format json
PDF report generationxyte-cli report generate --tenant <tenant-id> --input <deep-dive.json> --out <path>.pdf
Headless snapshot (JSON NDJSON)xyte-cli tui --headless --screen <screen> --format json --once --tenant <tenant-id>
Continuous headless monitoringxyte-cli tui --headless --screen <screen> --format json --follow --interval-ms <ms> --tenant <tenant-id>
MCP tool bridgexyte-cli mcp serve

Minimal Command Recipes

Read call:

bash
xyte-cli call organization.devices.getDevices --tenant <tenant-id> --output-mode envelope --strict-json

Write call (guarded):

bash
xyte-cli call organization.commands.sendCommand \
  --tenant <tenant-id> \
  --allow-write \
  --path-json '{"device_id":"<device-id>"}' \
  --body-json '{"name":"reboot"}'

Delete call (guarded):

bash
xyte-cli call organization.commands.cancelCommand \
  --tenant <tenant-id> \
  --allow-write \
  --confirm organization.commands.cancelCommand \
  --path-json '{"device_id":"<device-id>","command_id":"<command-id>"}'

Headless:

bash
xyte-cli tui --headless --screen dashboard --format json --once --tenant <tenant-id>

Inspect + report:

bash
xyte-cli inspect deep-dive --tenant <tenant-id> --window 24 --format json > /tmp/deep-dive.json
xyte-cli report generate --tenant <tenant-id> --input /tmp/deep-dive.json --out /tmp/xyte-findings.pdf

Contract IDs and Schemas

Schema/version IDs:

  • call envelope: xyte.call.envelope.v1
  • headless frame: xyte.headless.frame.v1
  • inspect fleet: xyte.inspect.fleet.v1
  • inspect deep dive: xyte.inspect.deep-dive.v1
  • report metadata: xyte.report.v1

Canonical schemas:

  • docs/schemas/call-envelope.v1.schema.json
  • docs/schemas/headless-frame.v1.schema.json
  • docs/schemas/inspect-fleet.v1.schema.json
  • docs/schemas/inspect-deep-dive.v1.schema.json
  • docs/schemas/report.v1.schema.json

MCP Tool Surface (Current)

Current tool names:

  • xyte_setup_status
  • xyte_config_doctor
  • xyte_list_endpoints
  • xyte_describe_endpoint
  • xyte_call
  • xyte_inspect_fleet
  • xyte_report_generate

Guard semantics in MCP mirror CLI:

  • write endpoints require allow_write: true
  • destructive endpoints require matching confirm

Troubleshooting Entrypoints

  • First-run/setup issues:
    • xyte-cli
    • xyte-cli setup run --non-interactive --tenant <tenant-id> --key <value>
  • Readiness/connectivity:
    • xyte-cli setup status --tenant <tenant-id> --format json
    • xyte-cli config doctor --tenant <tenant-id> --format json
  • TUI crash diagnostics:
bash
XYTE_TUI_DEBUG=1 XYTE_TUI_DEBUG_LOG=/tmp/xyte-tui-debug.log xyte-cli tui --tenant <tenant-id>
  • Headless errors:
    • ensure --headless --format json (no text format in headless)
    • parse NDJSON and use the last runtime frame (meta.startup != true)

References (Load As Needed)

  • references/endpoints.md
  • references/tui-flows.md
  • references/headless-contract.md

Notes for Agents

  • Keep this file short in-context; use references for deep procedures.
  • Keep tenant explicit in automation (--tenant <tenant-id>).