@kill-switch/cli 0.1.0 → 0.1.1
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.
- package/README.md +178 -0
- package/package.json +9 -2
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# @kill-switch/cli
|
|
2
|
+
|
|
3
|
+
Stop runaway cloud bills from the terminal. Monitor Cloudflare, GCP, and AWS spending with automatic kill switches that shut down services before they drain your account.
|
|
4
|
+
|
|
5
|
+
Born from a [$91K Cloudflare bill](https://kill-switch.net).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g @kill-switch/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This gives you two commands: `kill-switch` and `ks` (short alias).
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
# 1. Get an API key from https://app.kill-switch.net (Settings > API Keys)
|
|
19
|
+
ks auth login --api-key ks_live_your_key_here
|
|
20
|
+
|
|
21
|
+
# 2. Connect your cloud provider and apply protection
|
|
22
|
+
ks onboard --provider cloudflare \
|
|
23
|
+
--account-id YOUR_ACCOUNT_ID \
|
|
24
|
+
--token YOUR_API_TOKEN \
|
|
25
|
+
--name "Production" \
|
|
26
|
+
--shields cost-runaway,ddos
|
|
27
|
+
|
|
28
|
+
# 3. Check your accounts
|
|
29
|
+
ks check
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## One-Command Setup
|
|
33
|
+
|
|
34
|
+
The `onboard` command connects a provider, applies shield presets, and configures alerts in one step:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
# Cloudflare
|
|
38
|
+
ks onboard --provider cloudflare \
|
|
39
|
+
--account-id YOUR_CF_ACCOUNT_ID \
|
|
40
|
+
--token YOUR_CF_API_TOKEN \
|
|
41
|
+
--name "Production" \
|
|
42
|
+
--shields cost-runaway,ddos \
|
|
43
|
+
--alert-email you@example.com
|
|
44
|
+
|
|
45
|
+
# AWS
|
|
46
|
+
ks onboard --provider aws \
|
|
47
|
+
--access-key AKIA... \
|
|
48
|
+
--secret-key wJalr... \
|
|
49
|
+
--region us-east-1 \
|
|
50
|
+
--shields aws-cost-runaway,gpu-runaway
|
|
51
|
+
|
|
52
|
+
# GCP
|
|
53
|
+
ks onboard --provider gcp \
|
|
54
|
+
--project-id my-project-123 \
|
|
55
|
+
--service-account "$(cat key.json)" \
|
|
56
|
+
--shields cost-runaway
|
|
57
|
+
|
|
58
|
+
# Interactive mode (prompts for everything)
|
|
59
|
+
ks onboard
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Don't know where to find your credentials? Run:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
ks onboard --help-provider cloudflare
|
|
66
|
+
ks onboard --help-provider aws
|
|
67
|
+
ks onboard --help-provider gcp
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Shields (Quick Protect)
|
|
71
|
+
|
|
72
|
+
Apply preset protection rules with one command:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
ks shield cost-runaway # Kill services exceeding daily cost limit
|
|
76
|
+
ks shield ddos # Kill services getting excessive requests
|
|
77
|
+
ks shield gpu-runaway # Stop unexpected GPU instances
|
|
78
|
+
ks shield lambda-loop # Throttle recursive Lambda invocations
|
|
79
|
+
ks shield aws-cost-runaway # Emergency stop on AWS daily spend spike
|
|
80
|
+
ks shield brute-force # Rotate creds on mass auth failures
|
|
81
|
+
ks shield exfiltration # Isolate on unusual egress
|
|
82
|
+
ks shield error-storm # Scale down on sustained high error rate
|
|
83
|
+
|
|
84
|
+
# List all shields
|
|
85
|
+
ks shield --list
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Commands
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---------|-------------|
|
|
92
|
+
| `ks onboard` | One-command setup: connect + shields + alerts |
|
|
93
|
+
| `ks auth login` | Authenticate with API key |
|
|
94
|
+
| `ks auth status` | Show auth status |
|
|
95
|
+
| `ks accounts list` | List connected cloud accounts |
|
|
96
|
+
| `ks accounts add` | Connect a cloud provider |
|
|
97
|
+
| `ks accounts check <id>` | Run manual check on an account |
|
|
98
|
+
| `ks check` | Check all accounts |
|
|
99
|
+
| `ks shield <preset>` | Apply a protection preset |
|
|
100
|
+
| `ks rules list` | List active rules |
|
|
101
|
+
| `ks alerts list` | List alert channels |
|
|
102
|
+
| `ks analytics` | Cost analytics overview |
|
|
103
|
+
| `ks config list` | Show configuration |
|
|
104
|
+
|
|
105
|
+
## AI Agent Usage
|
|
106
|
+
|
|
107
|
+
The CLI is designed for AI coding agents (Claude Code, Cursor, Windsurf) to set up cloud monitoring on behalf of users without interactive prompts.
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
# Set API key via env var
|
|
111
|
+
export KILL_SWITCH_API_KEY=ks_live_your_key
|
|
112
|
+
|
|
113
|
+
# Non-interactive setup with JSON output
|
|
114
|
+
ks onboard \
|
|
115
|
+
--provider cloudflare \
|
|
116
|
+
--account-id CF_ACCOUNT_ID \
|
|
117
|
+
--token CF_API_TOKEN \
|
|
118
|
+
--name "Production" \
|
|
119
|
+
--shields cost-runaway,ddos \
|
|
120
|
+
--json
|
|
121
|
+
|
|
122
|
+
# All commands support --json for machine-readable output
|
|
123
|
+
ks accounts list --json
|
|
124
|
+
ks check --json
|
|
125
|
+
ks analytics --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### CLAUDE.md Integration
|
|
129
|
+
|
|
130
|
+
Add this to your project's `CLAUDE.md` so your AI agent knows how to manage Kill Switch:
|
|
131
|
+
|
|
132
|
+
```markdown
|
|
133
|
+
## Kill Switch (Cloud Cost Protection)
|
|
134
|
+
- CLI: `ks` (alias for `kill-switch`)
|
|
135
|
+
- Auth: KILL_SWITCH_API_KEY env var or `ks auth login --api-key KEY`
|
|
136
|
+
- Setup: `ks onboard --provider cloudflare --account-id ID --token TOKEN`
|
|
137
|
+
- Check: `ks check --json`
|
|
138
|
+
- Docs: `ks onboard --help-provider cloudflare`
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Authentication
|
|
142
|
+
|
|
143
|
+
The CLI uses personal API keys (prefixed with `ks_live_`). Create one from [app.kill-switch.net](https://app.kill-switch.net) under Settings > API Keys.
|
|
144
|
+
|
|
145
|
+
**Auth resolution order:**
|
|
146
|
+
1. `KILL_SWITCH_API_KEY` environment variable (best for CI/CD and AI agents)
|
|
147
|
+
2. `--api-key` flag on any command
|
|
148
|
+
3. `~/.kill-switch/config.json` (set by `ks auth login`)
|
|
149
|
+
|
|
150
|
+
## Global Options
|
|
151
|
+
|
|
152
|
+
| Flag | Description |
|
|
153
|
+
|------|-------------|
|
|
154
|
+
| `--json` | Output raw JSON (for automation/scripting/AI agents) |
|
|
155
|
+
| `--api-key <key>` | Override API key for this command |
|
|
156
|
+
| `--api-url <url>` | Override API URL |
|
|
157
|
+
| `-V, --version` | Show version |
|
|
158
|
+
| `-h, --help` | Show help |
|
|
159
|
+
|
|
160
|
+
## Exit Codes
|
|
161
|
+
|
|
162
|
+
| Code | Meaning |
|
|
163
|
+
|------|---------|
|
|
164
|
+
| `0` | Success |
|
|
165
|
+
| `1` | Client error (bad arguments, API error) |
|
|
166
|
+
| `2` | Authentication error (invalid/missing API key) |
|
|
167
|
+
|
|
168
|
+
## Links
|
|
169
|
+
|
|
170
|
+
- [Website](https://kill-switch.net)
|
|
171
|
+
- [Dashboard](https://app.kill-switch.net)
|
|
172
|
+
- [API Docs](https://kill-switch.net/docs)
|
|
173
|
+
- [CLI Docs](https://kill-switch.net/docs/cli.html)
|
|
174
|
+
- [GitHub](https://github.com/AiExpanse/kill-switch)
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kill-switch/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Kill Switch CLI — monitor cloud spending, kill runaway services from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=18"
|
|
25
25
|
},
|
|
26
|
-
"files": ["dist"],
|
|
26
|
+
"files": ["dist", "README.md"],
|
|
27
|
+
"keywords": ["cloud", "kill-switch", "cost-monitoring", "cloudflare", "aws", "gcp", "finops", "billing", "cli", "devops"],
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/AiExpanse/kill-switch",
|
|
31
|
+
"directory": "packages/cli"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://kill-switch.net",
|
|
27
34
|
"license": "MIT"
|
|
28
35
|
}
|