@statechange/xano-cli 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +251 -0
  2. package/dist/auth.d.ts +22 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +94 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/commands/audit.d.ts +6 -0
  7. package/dist/commands/audit.d.ts.map +1 -0
  8. package/dist/commands/audit.js +316 -0
  9. package/dist/commands/audit.js.map +1 -0
  10. package/dist/commands/auth.d.ts +6 -0
  11. package/dist/commands/auth.d.ts.map +1 -0
  12. package/dist/commands/auth.js +179 -0
  13. package/dist/commands/auth.js.map +1 -0
  14. package/dist/commands/health.d.ts +6 -0
  15. package/dist/commands/health.d.ts.map +1 -0
  16. package/dist/commands/health.js +115 -0
  17. package/dist/commands/health.js.map +1 -0
  18. package/dist/commands/history.d.ts +6 -0
  19. package/dist/commands/history.d.ts.map +1 -0
  20. package/dist/commands/history.js +250 -0
  21. package/dist/commands/history.js.map +1 -0
  22. package/dist/commands/inventory.d.ts +6 -0
  23. package/dist/commands/inventory.d.ts.map +1 -0
  24. package/dist/commands/inventory.js +282 -0
  25. package/dist/commands/inventory.js.map +1 -0
  26. package/dist/commands/logs.d.ts +6 -0
  27. package/dist/commands/logs.d.ts.map +1 -0
  28. package/dist/commands/logs.js +411 -0
  29. package/dist/commands/logs.js.map +1 -0
  30. package/dist/commands/performance.d.ts +6 -0
  31. package/dist/commands/performance.d.ts.map +1 -0
  32. package/dist/commands/performance.js +520 -0
  33. package/dist/commands/performance.js.map +1 -0
  34. package/dist/commands/secure.d.ts +6 -0
  35. package/dist/commands/secure.d.ts.map +1 -0
  36. package/dist/commands/secure.js +52 -0
  37. package/dist/commands/secure.js.map +1 -0
  38. package/dist/commands/xanoscript.d.ts +6 -0
  39. package/dist/commands/xanoscript.d.ts.map +1 -0
  40. package/dist/commands/xanoscript.js +216 -0
  41. package/dist/commands/xanoscript.js.map +1 -0
  42. package/dist/commands/xray.d.ts +6 -0
  43. package/dist/commands/xray.d.ts.map +1 -0
  44. package/dist/commands/xray.js +194 -0
  45. package/dist/commands/xray.js.map +1 -0
  46. package/dist/format.d.ts +10 -0
  47. package/dist/format.d.ts.map +1 -0
  48. package/dist/format.js +59 -0
  49. package/dist/format.js.map +1 -0
  50. package/dist/index.d.ts +7 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +43 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/performance/load-analysis.d.ts +33 -0
  55. package/dist/performance/load-analysis.d.ts.map +1 -0
  56. package/dist/performance/load-analysis.js +290 -0
  57. package/dist/performance/load-analysis.js.map +1 -0
  58. package/dist/performance/stack-rollup.d.ts +57 -0
  59. package/dist/performance/stack-rollup.d.ts.map +1 -0
  60. package/dist/performance/stack-rollup.js +108 -0
  61. package/dist/performance/stack-rollup.js.map +1 -0
  62. package/dist/registry-client.d.ts +81 -0
  63. package/dist/registry-client.d.ts.map +1 -0
  64. package/dist/registry-client.js +333 -0
  65. package/dist/registry-client.js.map +1 -0
  66. package/dist/xano-client.d.ts +103 -0
  67. package/dist/xano-client.d.ts.map +1 -0
  68. package/dist/xano-client.js +399 -0
  69. package/dist/xano-client.js.map +1 -0
  70. package/package.json +49 -0
  71. package/skills/performance-analysis/SKILL.md +135 -0
  72. package/skills/xano-cli/SKILL.md +158 -0
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: sc-xano
3
+ description: Interact with Xano workspaces via the StateChange CLI. Use when the user wants to list workspace objects, analyze performance, generate XanoScript, browse execution history, audit security, or manage log retention settings from the command line.
4
+ ---
5
+
6
+ # StateChange Xano CLI (`sc-xano`)
7
+
8
+ Run commands with `npx @statechange/xano-cli <command>` (or `sc-xano` if installed globally).
9
+
10
+ Once authenticated, instance/workspace/token auto-resolve. No extra flags needed for single-instance users.
11
+
12
+ ## Authentication
13
+
14
+ ```bash
15
+ npx @statechange/xano-cli auth init # Interactive API key setup
16
+ npx @statechange/xano-cli auth init --api-key <key> # Direct API key setup
17
+ npx @statechange/xano-cli auth whoami # Show auth status and instances
18
+ npx @statechange/xano-cli auth set-instance <host> # Save default instance
19
+ ```
20
+
21
+ ## Command Reference
22
+
23
+ ### Inventory (list workspace objects)
24
+
25
+ ```bash
26
+ npx @statechange/xano-cli inventory workspace # Object counts summary
27
+ npx @statechange/xano-cli inventory functions # List functions with tags
28
+ npx @statechange/xano-cli inventory tables # List database tables
29
+ npx @statechange/xano-cli inventory tasks # List background tasks
30
+ npx @statechange/xano-cli inventory triggers # List triggers
31
+ npx @statechange/xano-cli inventory addons # List addons
32
+ npx @statechange/xano-cli inventory middleware # List middleware
33
+ npx @statechange/xano-cli inventory mcp-servers # List MCP/toolset servers
34
+ ```
35
+
36
+ ### X-Ray Analysis
37
+
38
+ ```bash
39
+ npx @statechange/xano-cli xray function --id <id> # Analyze single function
40
+ npx @statechange/xano-cli xray scan-workspace # Scan all functions for errors
41
+ npx @statechange/xano-cli xray scan-workspace --include-warnings
42
+ ```
43
+
44
+ ### Performance
45
+
46
+ ```bash
47
+ npx @statechange/xano-cli performance top-endpoints # Slowest endpoints (last 24h)
48
+ npx @statechange/xano-cli performance top-endpoints --lookback 48 # Custom lookback
49
+ npx @statechange/xano-cli performance scan-functions # Find nested slow steps
50
+ npx @statechange/xano-cli performance trace endpoint <query-id> # Aggregate stack analysis
51
+ npx @statechange/xano-cli performance deep-dive <request-id> # Single request stack expansion
52
+ ```
53
+
54
+ ### Audit
55
+
56
+ ```bash
57
+ npx @statechange/xano-cli audit workspace # Audit API configurations
58
+ npx @statechange/xano-cli audit swagger # Find unsecured Swagger
59
+ npx @statechange/xano-cli audit database # Audit table schemas and indexes
60
+ npx @statechange/xano-cli audit middleware
61
+ npx @statechange/xano-cli audit addons
62
+ npx @statechange/xano-cli audit tasks
63
+ npx @statechange/xano-cli audit triggers
64
+ npx @statechange/xano-cli audit mcp-servers
65
+ ```
66
+
67
+ ### Security
68
+
69
+ ```bash
70
+ npx @statechange/xano-cli secure swagger --app-id <id> --disable # Disable Swagger
71
+ npx @statechange/xano-cli secure swagger --app-id <id> --require-token # Secure Swagger with token
72
+ ```
73
+
74
+ ### Execution History
75
+
76
+ ```bash
77
+ npx @statechange/xano-cli history requests # Recent API requests
78
+ npx @statechange/xano-cli history requests --page 2 # Paginate
79
+ npx @statechange/xano-cli history request <request-id> # Detailed request info
80
+ npx @statechange/xano-cli history tasks <task-id> # Task execution history
81
+ npx @statechange/xano-cli history task-run <task-id> <run-id> # Detailed task run
82
+ npx @statechange/xano-cli history triggers <trigger-id> # Trigger history
83
+ npx @statechange/xano-cli history mcp-servers <tool-id> # MCP server history
84
+ ```
85
+
86
+ ### Log Retention
87
+
88
+ ```bash
89
+ npx @statechange/xano-cli logs show # All objects' retention settings
90
+ npx @statechange/xano-cli logs show --custom-only # Only non-default settings
91
+ npx @statechange/xano-cli logs show endpoint <id> # Single endpoint with parent app context
92
+ npx @statechange/xano-cli logs show app <id> # App + all its endpoints
93
+ npx @statechange/xano-cli logs set endpoint <id> --limit -1 # Set to unlimited
94
+ npx @statechange/xano-cli logs set endpoint <id> --limit 100 # Set to default
95
+ npx @statechange/xano-cli logs watch endpoint <id> # Poll for new executions
96
+ ```
97
+
98
+ ### XanoScript
99
+
100
+ ```bash
101
+ npx @statechange/xano-cli xanoscript generate function <id>
102
+ npx @statechange/xano-cli xanoscript generate table <id>
103
+ npx @statechange/xano-cli xanoscript generate api <id>
104
+ npx @statechange/xano-cli xanoscript export-all --type function
105
+ npx @statechange/xano-cli xanoscript convert myfunction.xs
106
+ ```
107
+
108
+ ### Instance Health (Master API)
109
+
110
+ ```bash
111
+ npx @statechange/xano-cli health instances
112
+ npx @statechange/xano-cli health database --instance-id <id>
113
+ npx @statechange/xano-cli health clear-history --instance-id <id>
114
+ npx @statechange/xano-cli health restart-tasks --instance-id <id>
115
+ ```
116
+
117
+ ### Cache
118
+
119
+ ```bash
120
+ npx @statechange/xano-cli flush # Clear cached sink data
121
+ ```
122
+
123
+ ## Common Flags
124
+
125
+ These flags work on most commands but are usually auto-resolved:
126
+
127
+ | Flag | Description |
128
+ |------|-------------|
129
+ | `--instance <host>` | Xano instance hostname |
130
+ | `--workspace <id>` | Workspace ID |
131
+ | `--branch <id>` | Branch ID (default: 0) |
132
+ | `--token <token>` | Xano API token |
133
+ | `--api-key <key>` | StateChange API key |
134
+ | `--format <fmt>` | Output: `table` (default), `json`, or `yaml` |
135
+
136
+ Use `--format yaml` when feeding output to an AI/LLM — it is the most token-efficient structured format.
137
+
138
+ ## Typical Workflows
139
+
140
+ ### "What's in my workspace?"
141
+ ```bash
142
+ npx @statechange/xano-cli inventory workspace
143
+ ```
144
+
145
+ ### "Why is my API slow?"
146
+ ```bash
147
+ npx @statechange/xano-cli performance top-endpoints --lookback 24 --format yaml
148
+ npx @statechange/xano-cli performance trace endpoint <worst-id> --format yaml
149
+ npx @statechange/xano-cli performance deep-dive <request-id> --format yaml
150
+ npx @statechange/xano-cli xray function --id <function-id> --format yaml
151
+ ```
152
+
153
+ ### "Audit my workspace security"
154
+ ```bash
155
+ npx @statechange/xano-cli audit swagger
156
+ npx @statechange/xano-cli audit workspace
157
+ npx @statechange/xano-cli audit database
158
+ ```