devhelm 0.1.0 → 0.1.2
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 +106 -34
- package/dist/commands/alert-channels/create.js +4 -0
- package/dist/commands/alert-channels/create.js.map +1 -0
- package/dist/commands/alert-channels/delete.js +4 -0
- package/dist/commands/alert-channels/delete.js.map +1 -0
- package/dist/commands/alert-channels/get.js +4 -0
- package/dist/commands/alert-channels/get.js.map +1 -0
- package/dist/commands/alert-channels/list.js +4 -0
- package/dist/commands/alert-channels/list.js.map +1 -0
- package/dist/commands/alert-channels/test.js +19 -0
- package/dist/commands/alert-channels/test.js.map +1 -0
- package/dist/commands/alert-channels/update.js +4 -0
- package/dist/commands/alert-channels/update.js.map +1 -0
- package/dist/commands/api-keys/create.js +4 -0
- package/dist/commands/api-keys/create.js.map +1 -0
- package/dist/commands/api-keys/delete.js +4 -0
- package/dist/commands/api-keys/delete.js.map +1 -0
- package/dist/commands/api-keys/get.js +4 -0
- package/dist/commands/api-keys/get.js.map +1 -0
- package/dist/commands/api-keys/list.js +4 -0
- package/dist/commands/api-keys/list.js.map +1 -0
- package/dist/commands/api-keys/revoke.js +17 -0
- package/dist/commands/api-keys/revoke.js.map +1 -0
- package/dist/commands/auth/context/create.js +20 -0
- package/dist/commands/auth/context/create.js.map +1 -0
- package/dist/commands/auth/context/delete.js +18 -0
- package/dist/commands/auth/context/delete.js.map +1 -0
- package/dist/commands/auth/context/index.js +18 -0
- package/dist/commands/auth/context/index.js.map +1 -0
- package/dist/commands/auth/context/list.js +29 -0
- package/dist/commands/auth/context/list.js.map +1 -0
- package/dist/commands/auth/context/use.js +18 -0
- package/dist/commands/auth/context/use.js.map +1 -0
- package/dist/commands/auth/login.js +51 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.js +19 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/token.js +17 -0
- package/dist/commands/auth/token.js.map +1 -0
- package/dist/commands/data/services/status.js +19 -0
- package/dist/commands/data/services/status.js.map +1 -0
- package/dist/commands/data/services/uptime.js +29 -0
- package/dist/commands/data/services/uptime.js.map +1 -0
- package/dist/commands/dependencies/delete.js +4 -0
- package/dist/commands/dependencies/delete.js.map +1 -0
- package/dist/commands/dependencies/get.js +4 -0
- package/dist/commands/dependencies/get.js.map +1 -0
- package/dist/commands/dependencies/list.js +4 -0
- package/dist/commands/dependencies/list.js.map +1 -0
- package/dist/commands/dependencies/track.js +19 -0
- package/dist/commands/dependencies/track.js.map +1 -0
- package/dist/commands/environments/create.js +4 -0
- package/dist/commands/environments/create.js.map +1 -0
- package/dist/commands/environments/delete.js +4 -0
- package/dist/commands/environments/delete.js.map +1 -0
- package/dist/commands/environments/get.js +4 -0
- package/dist/commands/environments/get.js.map +1 -0
- package/dist/commands/environments/list.js +4 -0
- package/dist/commands/environments/list.js.map +1 -0
- package/dist/commands/environments/update.js +4 -0
- package/dist/commands/environments/update.js.map +1 -0
- package/dist/commands/incidents/create.js +4 -0
- package/dist/commands/incidents/create.js.map +1 -0
- package/dist/commands/incidents/delete.js +4 -0
- package/dist/commands/incidents/delete.js.map +1 -0
- package/dist/commands/incidents/get.js +4 -0
- package/dist/commands/incidents/get.js.map +1 -0
- package/dist/commands/incidents/list.js +4 -0
- package/dist/commands/incidents/list.js.map +1 -0
- package/dist/commands/incidents/resolve.js +25 -0
- package/dist/commands/incidents/resolve.js.map +1 -0
- package/dist/commands/incidents/update.js +4 -0
- package/dist/commands/incidents/update.js.map +1 -0
- package/dist/commands/init.js +61 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/monitors/create.js +4 -0
- package/dist/commands/monitors/create.js.map +1 -0
- package/dist/commands/monitors/delete.js +4 -0
- package/dist/commands/monitors/delete.js.map +1 -0
- package/dist/commands/monitors/get.js +4 -0
- package/dist/commands/monitors/get.js.map +1 -0
- package/dist/commands/monitors/list.js +3 -33
- package/dist/commands/monitors/list.js.map +1 -1
- package/dist/commands/monitors/pause.js +19 -0
- package/dist/commands/monitors/pause.js.map +1 -0
- package/dist/commands/monitors/results.js +29 -0
- package/dist/commands/monitors/results.js.map +1 -0
- package/dist/commands/monitors/resume.js +19 -0
- package/dist/commands/monitors/resume.js.map +1 -0
- package/dist/commands/monitors/test.js +20 -0
- package/dist/commands/monitors/test.js.map +1 -0
- package/dist/commands/monitors/update.js +4 -0
- package/dist/commands/monitors/update.js.map +1 -0
- package/dist/commands/notification-policies/create.js +4 -0
- package/dist/commands/notification-policies/create.js.map +1 -0
- package/dist/commands/notification-policies/delete.js +4 -0
- package/dist/commands/notification-policies/delete.js.map +1 -0
- package/dist/commands/notification-policies/get.js +4 -0
- package/dist/commands/notification-policies/get.js.map +1 -0
- package/dist/commands/notification-policies/list.js +4 -0
- package/dist/commands/notification-policies/list.js.map +1 -0
- package/dist/commands/notification-policies/test.js +17 -0
- package/dist/commands/notification-policies/test.js.map +1 -0
- package/dist/commands/notification-policies/update.js +4 -0
- package/dist/commands/notification-policies/update.js.map +1 -0
- package/dist/commands/resource-groups/create.js +4 -0
- package/dist/commands/resource-groups/create.js.map +1 -0
- package/dist/commands/resource-groups/delete.js +4 -0
- package/dist/commands/resource-groups/delete.js.map +1 -0
- package/dist/commands/resource-groups/get.js +4 -0
- package/dist/commands/resource-groups/get.js.map +1 -0
- package/dist/commands/resource-groups/list.js +4 -0
- package/dist/commands/resource-groups/list.js.map +1 -0
- package/dist/commands/resource-groups/update.js +4 -0
- package/dist/commands/resource-groups/update.js.map +1 -0
- package/dist/commands/secrets/create.js +4 -0
- package/dist/commands/secrets/create.js.map +1 -0
- package/dist/commands/secrets/delete.js +4 -0
- package/dist/commands/secrets/delete.js.map +1 -0
- package/dist/commands/secrets/list.js +4 -0
- package/dist/commands/secrets/list.js.map +1 -0
- package/dist/commands/secrets/update.js +4 -0
- package/dist/commands/secrets/update.js.map +1 -0
- package/dist/commands/status.js +35 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/tags/create.js +4 -0
- package/dist/commands/tags/create.js.map +1 -0
- package/dist/commands/tags/delete.js +4 -0
- package/dist/commands/tags/delete.js.map +1 -0
- package/dist/commands/tags/get.js +4 -0
- package/dist/commands/tags/get.js.map +1 -0
- package/dist/commands/tags/list.js +4 -0
- package/dist/commands/tags/list.js.map +1 -0
- package/dist/commands/tags/update.js +4 -0
- package/dist/commands/tags/update.js.map +1 -0
- package/dist/commands/validate.js +63 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/version.js.map +1 -1
- package/dist/commands/webhooks/create.js +4 -0
- package/dist/commands/webhooks/create.js.map +1 -0
- package/dist/commands/webhooks/delete.js +4 -0
- package/dist/commands/webhooks/delete.js.map +1 -0
- package/dist/commands/webhooks/get.js +4 -0
- package/dist/commands/webhooks/get.js.map +1 -0
- package/dist/commands/webhooks/list.js +4 -0
- package/dist/commands/webhooks/list.js.map +1 -0
- package/dist/commands/webhooks/test.js +19 -0
- package/dist/commands/webhooks/test.js.map +1 -0
- package/dist/commands/webhooks/update.js +4 -0
- package/dist/commands/webhooks/update.js.map +1 -0
- package/dist/lib/api-client.js +51 -28
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/api.generated.js +6 -0
- package/dist/lib/api.generated.js.map +1 -0
- package/dist/lib/auth.js +20 -0
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/base-command.js +27 -0
- package/dist/lib/base-command.js.map +1 -0
- package/dist/lib/crud-commands.js +111 -0
- package/dist/lib/crud-commands.js.map +1 -0
- package/dist/lib/descriptions.generated.js +210 -0
- package/dist/lib/descriptions.generated.js.map +1 -0
- package/dist/lib/errors.js +33 -8
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/output.js +53 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/resources.js +361 -0
- package/dist/lib/resources.js.map +1 -0
- package/oclif.manifest.json +5187 -10
- package/package.json +10 -3
- package/dist/commands/monitors/list.d.ts +0 -10
- package/dist/commands/monitors/list.d.ts.map +0 -1
- package/dist/commands/version.d.ts +0 -7
- package/dist/commands/version.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/api-client.d.ts +0 -12
- package/dist/lib/api-client.d.ts.map +0 -1
- package/dist/lib/auth.d.ts +0 -14
- package/dist/lib/auth.d.ts.map +0 -1
- package/dist/lib/errors.d.ts +0 -12
- package/dist/lib/errors.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,58 +1,134 @@
|
|
|
1
1
|
# DevHelm CLI
|
|
2
2
|
|
|
3
|
-
The official command-line interface for [DevHelm](https://devhelm.io) — manage monitors,
|
|
3
|
+
The official command-line interface for [DevHelm](https://devhelm.io) — manage uptime monitors, incidents, alert channels, and infrastructure as code from your terminal.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
- **Monitoring as code** — define monitors in `devhelm.yml` and deploy them from CI or your terminal
|
|
6
|
+
- **Full API coverage** — monitors, incidents, alert channels, notification policies, environments, secrets, tags, resource groups, webhooks, dependencies, and status data
|
|
7
|
+
- **Multiple output formats** — table, JSON, or YAML for easy scripting and piping
|
|
8
|
+
- **Auth context model** — switch between environments with named contexts, or use `DEVHELM_API_TOKEN` for CI
|
|
9
|
+
- **Works with AI agents** — pair with the [DevHelm MCP server](https://github.com/devhelmhq/mcp-server) or [Agent Skill](https://github.com/devhelmhq/skill) for AI-driven monitoring workflows
|
|
10
10
|
|
|
11
|
-
## Quick
|
|
11
|
+
## Quick Example
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# Authenticate
|
|
15
|
-
devhelm auth login
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
$ devhelm auth login --token sk_live_...
|
|
16
|
+
Authenticated as you@company.com
|
|
17
|
+
Context 'default' saved to ~/.devhelm/contexts.json
|
|
18
|
+
|
|
19
|
+
# List your monitors
|
|
20
|
+
$ devhelm monitors list
|
|
21
|
+
┌────┬─────────────────────┬──────┬────────┬──────────────────────────┬──────────┐
|
|
22
|
+
│ ID │ NAME │ TYPE │ STATUS │ URL │ INTERVAL │
|
|
23
|
+
├────┼─────────────────────┼──────┼────────┼──────────────────────────┼──────────┤
|
|
24
|
+
│ 1 │ Website Health │ HTTP │ UP │ https://example.com │ 60 │
|
|
25
|
+
│ 2 │ API Endpoint │ HTTP │ UP │ https://api.example.com │ 30 │
|
|
26
|
+
│ 3 │ DNS Check │ DNS │ UP │ example.com │ 300 │
|
|
27
|
+
└────┴─────────────────────┴──────┴────────┴──────────────────────────┴──────────┘
|
|
28
|
+
|
|
29
|
+
# Create a monitor
|
|
30
|
+
$ devhelm monitors create --name "Checkout API" --type HTTP --url https://api.example.com/checkout --interval 30
|
|
31
|
+
|
|
32
|
+
# Scaffold a config file and validate it
|
|
33
|
+
$ devhelm init
|
|
34
|
+
Created devhelm.yml
|
|
35
|
+
|
|
36
|
+
$ devhelm validate
|
|
37
|
+
devhelm.yml: valid (3 monitors)
|
|
38
|
+
```
|
|
19
39
|
|
|
20
|
-
|
|
21
|
-
devhelm validate devhelm.yml
|
|
40
|
+
## Installation
|
|
22
41
|
|
|
23
|
-
|
|
24
|
-
devhelm
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g devhelm
|
|
25
44
|
```
|
|
26
45
|
|
|
46
|
+
Requires Node.js 18+.
|
|
47
|
+
|
|
27
48
|
## Authentication
|
|
28
49
|
|
|
29
50
|
The CLI resolves credentials in this order:
|
|
30
51
|
|
|
31
|
-
1. `
|
|
32
|
-
2.
|
|
52
|
+
1. `--api-token` flag (highest priority)
|
|
53
|
+
2. `DEVHELM_API_TOKEN` environment variable
|
|
54
|
+
3. Active auth context from `~/.devhelm/contexts.json`
|
|
33
55
|
|
|
34
56
|
```bash
|
|
35
|
-
# Interactive login
|
|
57
|
+
# Interactive login
|
|
36
58
|
devhelm auth login
|
|
37
59
|
|
|
38
|
-
#
|
|
39
|
-
|
|
60
|
+
# Or set a token directly
|
|
61
|
+
export DEVHELM_API_TOKEN=sk_live_...
|
|
62
|
+
|
|
63
|
+
# Manage multiple environments
|
|
64
|
+
devhelm auth context create staging --api-url https://staging-api.devhelm.io --token sk_test_...
|
|
40
65
|
devhelm auth context use staging
|
|
41
66
|
devhelm auth context list
|
|
42
67
|
```
|
|
43
68
|
|
|
44
69
|
## Commands
|
|
45
70
|
|
|
71
|
+
### Core Workflow
|
|
72
|
+
|
|
46
73
|
| Command | Description |
|
|
47
74
|
|---------|-------------|
|
|
75
|
+
| `devhelm init` | Scaffold a `devhelm.yml` configuration file |
|
|
76
|
+
| `devhelm validate [file]` | Validate a configuration file |
|
|
77
|
+
| `devhelm status` | Show dashboard overview |
|
|
48
78
|
| `devhelm version` | Print CLI version |
|
|
49
|
-
| `devhelm monitors list` | List all monitors |
|
|
50
|
-
| `devhelm monitors get <id>` | Get monitor details |
|
|
51
|
-
| `devhelm validate [file]` | Validate devhelm.yml |
|
|
52
|
-
| `devhelm deploy` | Deploy configuration |
|
|
53
|
-
| `devhelm status` | Show deployment status |
|
|
54
79
|
|
|
55
|
-
|
|
80
|
+
### Resources
|
|
81
|
+
|
|
82
|
+
Every resource supports `list`, `get`, `create`, `update`, and `delete` subcommands. Add `--output json` for machine-readable output.
|
|
83
|
+
|
|
84
|
+
| Resource | Commands | API Path |
|
|
85
|
+
|----------|----------|----------|
|
|
86
|
+
| `monitors` | list, get, create, update, delete, pause, resume, test, results | `/api/v1/monitors` |
|
|
87
|
+
| `incidents` | list, get, create, update, delete, resolve | `/api/v1/incidents` |
|
|
88
|
+
| `alert-channels` | list, get, create, update, delete, test | `/api/v1/alert-channels` |
|
|
89
|
+
| `notification-policies` | list, get, create, update, delete, test | `/api/v1/notification-policies` |
|
|
90
|
+
| `environments` | list, get, create, update, delete | `/api/v1/environments` |
|
|
91
|
+
| `secrets` | list, create, update, delete | `/api/v1/secrets` |
|
|
92
|
+
| `tags` | list, get, create, update, delete | `/api/v1/tags` |
|
|
93
|
+
| `resource-groups` | list, get, create, update, delete | `/api/v1/resource-groups` |
|
|
94
|
+
| `webhooks` | list, get, create, update, delete, test | `/api/v1/webhooks` |
|
|
95
|
+
| `api-keys` | list, get, create, delete, revoke | `/api/v1/api-keys` |
|
|
96
|
+
| `dependencies` | list, get, track, delete | `/api/v1/service-subscriptions` |
|
|
97
|
+
| `data services` | status, uptime | `/api/v1/services` |
|
|
98
|
+
|
|
99
|
+
### Global Flags
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
--output, -o Output format: table, json, yaml (default: table)
|
|
103
|
+
--api-url Override API base URL
|
|
104
|
+
--api-token Override API token
|
|
105
|
+
--verbose, -v Show verbose output
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## AI Agents & Coding Assistants
|
|
109
|
+
|
|
110
|
+
DevHelm is designed to work seamlessly with AI coding agents:
|
|
111
|
+
|
|
112
|
+
- **[MCP Server](https://github.com/devhelmhq/mcp-server)** — full API access from Cursor, Claude Desktop, or any MCP-compatible client
|
|
113
|
+
- **[Agent Skill](https://github.com/devhelmhq/skill)** — structured instructions for Claude Code, Cursor, Codex, and other AI agents
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Install the MCP server
|
|
117
|
+
npm install -g @devhelm/mcp-server
|
|
118
|
+
|
|
119
|
+
# Or add the skill to your project
|
|
120
|
+
npx skills add devhelmhq/skill
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Documentation
|
|
124
|
+
|
|
125
|
+
Full documentation at [docs.devhelm.io](https://docs.devhelm.io).
|
|
126
|
+
|
|
127
|
+
## Need Help?
|
|
128
|
+
|
|
129
|
+
- [Getting Started Guide](https://docs.devhelm.io/cli/quickstart)
|
|
130
|
+
- [GitHub Issues](https://github.com/devhelmhq/cli/issues)
|
|
131
|
+
- [Community Discussions](https://github.com/devhelmhq/cli/discussions)
|
|
56
132
|
|
|
57
133
|
## Development
|
|
58
134
|
|
|
@@ -66,14 +142,10 @@ npm run build
|
|
|
66
142
|
node bin/dev.js version
|
|
67
143
|
node bin/dev.js monitors list
|
|
68
144
|
|
|
69
|
-
#
|
|
70
|
-
npm
|
|
71
|
-
|
|
72
|
-
#
|
|
73
|
-
npm run lint
|
|
74
|
-
|
|
75
|
-
# Type check
|
|
76
|
-
npm run typecheck
|
|
145
|
+
# Checks
|
|
146
|
+
npm run lint # ESLint
|
|
147
|
+
npm run typecheck # TypeScript
|
|
148
|
+
npm test # Vitest
|
|
77
149
|
```
|
|
78
150
|
|
|
79
151
|
## License
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/alert-channels/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAErD,eAAe,mBAAmB,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/alert-channels/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAErD,eAAe,mBAAmB,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/alert-channels/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAErD,eAAe,gBAAgB,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/alert-channels/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAErD,eAAe,iBAAiB,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command, Args } from '@oclif/core';
|
|
2
|
+
import { globalFlags, buildClient } from '../../lib/base-command.js';
|
|
3
|
+
import { checkedFetch } from '../../lib/api-client.js';
|
|
4
|
+
export default class AlertChannelsTest extends Command {
|
|
5
|
+
static description = 'Send a test notification to an alert channel';
|
|
6
|
+
static examples = ['<%= config.bin %> alert-channels test <id>'];
|
|
7
|
+
static args = { id: Args.string({ description: 'Alert channel ID', required: true }) };
|
|
8
|
+
static flags = { ...globalFlags };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(AlertChannelsTest);
|
|
11
|
+
const client = buildClient(flags);
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
const resp = await checkedFetch(client.POST(`/api/v1/alert-channels/${args.id}/test`, {}));
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const result = resp?.data ?? resp;
|
|
16
|
+
this.log(result.success ? 'Test notification sent successfully.' : 'Test notification failed.');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/commands/alert-channels/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAA;AAEpD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,MAAM,CAAC,WAAW,GAAG,8CAA8C,CAAA;IACnE,MAAM,CAAC,QAAQ,GAAG,CAAC,4CAA4C,CAAC,CAAA;IAChE,MAAM,CAAC,IAAI,GAAG,EAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAClF,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACzD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QACjC,8DAA8D;QAC9D,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,EAAE,OAAc,EAAE,EAAS,CAAC,CAAC,CAAA;QACxG,8DAA8D;QAC9D,MAAM,MAAM,GAAI,IAAY,EAAE,IAAI,IAAI,IAAI,CAAA;QAC1C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAA;IACjG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/alert-channels/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAA;AAErD,eAAe,mBAAmB,CAAC,cAAc,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/api-keys/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAE/C,eAAe,mBAAmB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/api-keys/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAE/C,eAAe,mBAAmB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/api-keys/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAE/C,eAAe,gBAAgB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/api-keys/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAE/C,eAAe,iBAAiB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command, Args } from '@oclif/core';
|
|
2
|
+
import { globalFlags, buildClient } from '../../lib/base-command.js';
|
|
3
|
+
import { checkedFetch } from '../../lib/api-client.js';
|
|
4
|
+
export default class ApiKeysRevoke extends Command {
|
|
5
|
+
static description = 'Revoke an API key';
|
|
6
|
+
static examples = ['<%= config.bin %> api-keys revoke <id>'];
|
|
7
|
+
static args = { id: Args.string({ description: 'API key ID', required: true }) };
|
|
8
|
+
static flags = { ...globalFlags };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(ApiKeysRevoke);
|
|
11
|
+
const client = buildClient(flags);
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
await checkedFetch(client.POST(`/api/v1/api-keys/${args.id}/revoke`, {}));
|
|
14
|
+
this.log(`API key '${args.id}' revoked.`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=revoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revoke.js","sourceRoot":"","sources":["../../../src/commands/api-keys/revoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,2BAA2B,CAAA;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAA;AAEpD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAChD,MAAM,CAAC,WAAW,GAAG,mBAAmB,CAAA;IACxC,MAAM,CAAC,QAAQ,GAAG,CAAC,wCAAwC,CAAC,CAAA;IAC5D,MAAM,CAAC,IAAI,GAAG,EAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAC5E,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QACrD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QACjC,8DAA8D;QAC9D,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,EAAE,SAAgB,EAAE,EAAS,CAAC,CAAC,CAAA;QACvF,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,EAAE,YAAY,CAAC,CAAA;IAC3C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command, Args, Flags } from '@oclif/core';
|
|
2
|
+
import { globalFlags } from '../../../lib/base-command.js';
|
|
3
|
+
import { saveContext } from '../../../lib/auth.js';
|
|
4
|
+
export default class AuthContextCreate extends Command {
|
|
5
|
+
static description = 'Create a new auth context';
|
|
6
|
+
static examples = ['<%= config.bin %> auth context create staging --api-url https://staging-api.devhelm.io --token sk_...'];
|
|
7
|
+
static args = { name: Args.string({ description: 'Context name', required: true }) };
|
|
8
|
+
static flags = {
|
|
9
|
+
...globalFlags,
|
|
10
|
+
token: Flags.string({ description: 'API token', required: true }),
|
|
11
|
+
'set-current': Flags.boolean({ description: 'Set as current context', default: true }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { args, flags } = await this.parse(AuthContextCreate);
|
|
15
|
+
const apiUrl = flags['api-url'] || 'https://api.devhelm.io';
|
|
16
|
+
saveContext({ name: args.name, apiUrl, token: flags.token }, flags['set-current']);
|
|
17
|
+
this.log(`Context '${args.name}' created.${flags['set-current'] ? ' (active)' : ''}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/auth/context/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAA;AAEhD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,MAAM,CAAC,WAAW,GAAG,2BAA2B,CAAA;IAChD,MAAM,CAAC,QAAQ,GAAG,CAAC,uGAAuG,CAAC,CAAA;IAC3H,MAAM,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAChF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,WAAW;QACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;QAC/D,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,EAAC,WAAW,EAAE,wBAAwB,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;KACrF,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACzD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,wBAAwB,CAAA;QAC3D,WAAW,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAA;QAChF,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,IAAI,aAAa,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACvF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command, Args } from '@oclif/core';
|
|
2
|
+
import { globalFlags } from '../../../lib/base-command.js';
|
|
3
|
+
import { removeContext } from '../../../lib/auth.js';
|
|
4
|
+
export default class AuthContextDelete extends Command {
|
|
5
|
+
static description = 'Delete an auth context';
|
|
6
|
+
static examples = ['<%= config.bin %> auth context delete staging'];
|
|
7
|
+
static args = { name: Args.string({ description: 'Context name to delete', required: true }) };
|
|
8
|
+
static flags = { ...globalFlags };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args } = await this.parse(AuthContextDelete);
|
|
11
|
+
const ok = removeContext(args.name);
|
|
12
|
+
if (!ok) {
|
|
13
|
+
this.error(`Context '${args.name}' not found.`, { exit: 1 });
|
|
14
|
+
}
|
|
15
|
+
this.log(`Context '${args.name}' deleted.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/auth/context/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAElD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,OAAO;IACpD,MAAM,CAAC,WAAW,GAAG,wBAAwB,CAAA;IAC7C,MAAM,CAAC,QAAQ,GAAG,CAAC,+CAA+C,CAAC,CAAA;IACnE,MAAM,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,wBAAwB,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAC1F,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QAClD,MAAM,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,CAAC,EAAE,EAAE,CAAC;YAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,cAAc,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;QAAC,CAAC;QACvE,IAAI,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,IAAI,YAAY,CAAC,CAAA;IAC7C,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { globalFlags, display } from '../../../lib/base-command.js';
|
|
3
|
+
import { getCurrentContext } from '../../../lib/auth.js';
|
|
4
|
+
export default class AuthContext extends Command {
|
|
5
|
+
static description = 'Show the current auth context';
|
|
6
|
+
static examples = ['<%= config.bin %> auth context'];
|
|
7
|
+
static flags = { ...globalFlags };
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags } = await this.parse(AuthContext);
|
|
10
|
+
const ctx = getCurrentContext();
|
|
11
|
+
if (!ctx) {
|
|
12
|
+
this.log('No active context. Run `devhelm auth login` to create one.');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
display(this, { name: ctx.name, 'api-url': ctx.apiUrl, token: ctx.token.slice(0, 8) + '...' + ctx.token.slice(-4) }, flags.output);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/auth/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAA;AAEtD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,MAAM,CAAC,WAAW,GAAG,+BAA+B,CAAA;IACpD,MAAM,CAAC,QAAQ,GAAG,CAAC,gCAAgC,CAAC,CAAA;IACpD,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QAC7C,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAA;QAC/B,IAAI,CAAC,GAAG,EAAE,CAAC;YAAC,IAAI,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;YAAC,OAAM;QAAC,CAAC;QAC5F,OAAO,CAAC,IAAI,EAAE,EAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAClI,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { globalFlags, display } from '../../../lib/base-command.js';
|
|
3
|
+
import { listContexts } from '../../../lib/auth.js';
|
|
4
|
+
export default class AuthContextList extends Command {
|
|
5
|
+
static description = 'List all auth contexts';
|
|
6
|
+
static examples = ['<%= config.bin %> auth context list'];
|
|
7
|
+
static flags = { ...globalFlags };
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags } = await this.parse(AuthContextList);
|
|
10
|
+
const { current, contexts } = listContexts();
|
|
11
|
+
if (contexts.length === 0) {
|
|
12
|
+
this.log('No contexts found. Run `devhelm auth login` to create one.');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const data = contexts.map((ctx) => ({
|
|
16
|
+
current: ctx.name === current ? '*' : '',
|
|
17
|
+
name: ctx.name,
|
|
18
|
+
'api-url': ctx.apiUrl,
|
|
19
|
+
token: ctx.token.slice(0, 8) + '...' + ctx.token.slice(-4),
|
|
20
|
+
}));
|
|
21
|
+
display(this, data, flags.output, [
|
|
22
|
+
{ header: '', get: (r) => r.current ?? '' },
|
|
23
|
+
{ header: 'NAME', get: (r) => r.name ?? '' },
|
|
24
|
+
{ header: 'API URL', get: (r) => r['api-url'] ?? '' },
|
|
25
|
+
{ header: 'TOKEN', get: (r) => r.token ?? '' },
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/auth/context/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;AAEjD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAC,WAAW,GAAG,wBAAwB,CAAA;IAC7C,MAAM,CAAC,QAAQ,GAAG,CAAC,qCAAqC,CAAC,CAAA;IACzD,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACjD,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAC,GAAG,YAAY,EAAE,CAAA;QAC1C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAAC,IAAI,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;YAAC,OAAM;QAAC,CAAC;QAC7G,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAClC,OAAO,EAAE,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACxC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,SAAS,EAAE,GAAG,CAAC,MAAM;YACrB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,CAAC,CAAC,CAAA;QACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE;YAChC,EAAC,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,EAAC;YACjE,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,EAAC;YAClE,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,EAAC;YAC3E,EAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,EAAC;SACrE,CAAC,CAAA;IACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command, Args } from '@oclif/core';
|
|
2
|
+
import { globalFlags } from '../../../lib/base-command.js';
|
|
3
|
+
import { setCurrentContext } from '../../../lib/auth.js';
|
|
4
|
+
export default class AuthContextUse extends Command {
|
|
5
|
+
static description = 'Switch to a different auth context';
|
|
6
|
+
static examples = ['<%= config.bin %> auth context use staging'];
|
|
7
|
+
static args = { name: Args.string({ description: 'Context name to activate', required: true }) };
|
|
8
|
+
static flags = { ...globalFlags };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args } = await this.parse(AuthContextUse);
|
|
11
|
+
const ok = setCurrentContext(args.name);
|
|
12
|
+
if (!ok) {
|
|
13
|
+
this.error(`Context '${args.name}' not found.`, { exit: 1 });
|
|
14
|
+
}
|
|
15
|
+
this.log(`Switched to context '${args.name}'.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=use.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../../src/commands/auth/context/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAA;AAEtD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,MAAM,CAAC,WAAW,GAAG,oCAAoC,CAAA;IACzD,MAAM,CAAC,QAAQ,GAAG,CAAC,4CAA4C,CAAC,CAAA;IAChE,MAAM,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAC5F,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAC/C,MAAM,EAAE,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,IAAI,CAAC,EAAE,EAAE,CAAC;YAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,cAAc,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;QAAC,CAAC;QACvE,IAAI,CAAC,GAAG,CAAC,wBAAwB,IAAI,CAAC,IAAI,IAAI,CAAC,CAAA;IACjD,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { globalFlags } from '../../lib/base-command.js';
|
|
3
|
+
import { createApiClient, checkedFetch } from '../../lib/api-client.js';
|
|
4
|
+
import { saveContext, resolveApiUrl } from '../../lib/auth.js';
|
|
5
|
+
import * as readline from 'node:readline';
|
|
6
|
+
export default class AuthLogin extends Command {
|
|
7
|
+
static description = 'Authenticate with the DevHelm API';
|
|
8
|
+
static examples = ['<%= config.bin %> auth login', '<%= config.bin %> auth login --token sk_live_...'];
|
|
9
|
+
static flags = {
|
|
10
|
+
...globalFlags,
|
|
11
|
+
token: Flags.string({ description: 'API token (skips interactive prompt)' }),
|
|
12
|
+
name: Flags.string({ description: 'Context name', default: 'default' }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(AuthLogin);
|
|
16
|
+
let token = flags.token;
|
|
17
|
+
if (!token) {
|
|
18
|
+
token = await this.promptForToken();
|
|
19
|
+
}
|
|
20
|
+
const apiUrl = flags['api-url'] || resolveApiUrl();
|
|
21
|
+
this.log('Validating token...');
|
|
22
|
+
const client = createApiClient({ baseUrl: apiUrl, token });
|
|
23
|
+
try {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
const me = await checkedFetch(client.GET('/platform/me', {}));
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const email = me?.data?.email ?? me?.email;
|
|
28
|
+
saveContext({ name: flags.name, apiUrl, token }, true);
|
|
29
|
+
this.log(`\nAuthenticated as ${email}`);
|
|
30
|
+
this.log(`Context '${flags.name}' saved to ~/.devhelm/contexts.json`);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
this.error('Invalid token. Authentication failed.', { exit: 2 });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
promptForToken() {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
39
|
+
rl.question('Enter your DevHelm API token: ', (answer) => {
|
|
40
|
+
rl.close();
|
|
41
|
+
const trimmed = answer.trim();
|
|
42
|
+
if (!trimmed) {
|
|
43
|
+
reject(new Error('Token cannot be empty'));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
resolve(trimmed);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { globalFlags } from '../../lib/base-command.js';
|
|
3
|
+
import { getCurrentContext, removeContext } from '../../lib/auth.js';
|
|
4
|
+
export default class AuthLogout extends Command {
|
|
5
|
+
static description = 'Remove the current auth context';
|
|
6
|
+
static examples = ['<%= config.bin %> auth logout'];
|
|
7
|
+
static flags = { ...globalFlags };
|
|
8
|
+
async run() {
|
|
9
|
+
await this.parse(AuthLogout);
|
|
10
|
+
const ctx = getCurrentContext();
|
|
11
|
+
if (!ctx) {
|
|
12
|
+
this.log('No active context. Already logged out.');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
removeContext(ctx.name);
|
|
16
|
+
this.log(`Removed context '${ctx.name}'. Logged out.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,iBAAiB,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAA;AAElE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,MAAM,CAAC,WAAW,GAAG,iCAAiC,CAAA;IACtD,MAAM,CAAC,QAAQ,GAAG,CAAC,+BAA+B,CAAC,CAAA;IACnD,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QAC5B,MAAM,GAAG,GAAG,iBAAiB,EAAE,CAAA;QAC/B,IAAI,CAAC,GAAG,EAAE,CAAC;YAAC,IAAI,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;YAAC,OAAM;QAAC,CAAC;QACxE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACvB,IAAI,CAAC,GAAG,CAAC,oBAAoB,GAAG,CAAC,IAAI,gBAAgB,CAAC,CAAA;IACxD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { globalFlags } from '../../lib/base-command.js';
|
|
3
|
+
import { resolveToken } from '../../lib/auth.js';
|
|
4
|
+
export default class AuthToken extends Command {
|
|
5
|
+
static description = 'Print the current API token';
|
|
6
|
+
static examples = ['<%= config.bin %> auth token'];
|
|
7
|
+
static flags = { ...globalFlags };
|
|
8
|
+
async run() {
|
|
9
|
+
const { flags } = await this.parse(AuthToken);
|
|
10
|
+
const token = flags['api-token'] || resolveToken();
|
|
11
|
+
if (!token) {
|
|
12
|
+
this.error('No token found. Run `devhelm auth login` first.', { exit: 2 });
|
|
13
|
+
}
|
|
14
|
+
this.log(token);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/commands/auth/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAE9C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAC,WAAW,GAAG,6BAA6B,CAAA;IAClD,MAAM,CAAC,QAAQ,GAAG,CAAC,8BAA8B,CAAC,CAAA;IAClD,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,YAAY,EAAE,CAAA;QAClD,IAAI,CAAC,KAAK,EAAE,CAAC;YAAC,IAAI,CAAC,KAAK,CAAC,iDAAiD,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;QAAC,CAAC;QACxF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACjB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command, Args } from '@oclif/core';
|
|
2
|
+
import { globalFlags, buildClient, display } from '../../../lib/base-command.js';
|
|
3
|
+
import { checkedFetch } from '../../../lib/api-client.js';
|
|
4
|
+
export default class DataServicesStatus extends Command {
|
|
5
|
+
static description = 'Get the current status of a service';
|
|
6
|
+
static examples = ['<%= config.bin %> data services status aws-ec2'];
|
|
7
|
+
static args = { slug: Args.string({ description: 'Service slug', required: true }) };
|
|
8
|
+
static flags = { ...globalFlags };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(DataServicesStatus);
|
|
11
|
+
const client = buildClient(flags);
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
const resp = await checkedFetch(client.GET(`/api/v1/services/${args.slug}`, {}));
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const service = resp?.data ?? resp;
|
|
16
|
+
display(this, service, flags.output);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/commands/data/services/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AACzC,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAA;AAEvD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IACrD,MAAM,CAAC,WAAW,GAAG,qCAAqC,CAAA;IAC1D,MAAM,CAAC,QAAQ,GAAG,CAAC,gDAAgD,CAAC,CAAA;IACpE,MAAM,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAChF,MAAM,CAAC,KAAK,GAAG,EAAC,GAAG,WAAW,EAAC,CAAA;IAE/B,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAC1D,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QACjC,8DAA8D;QAC9D,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,IAAI,EAAS,EAAE,EAAS,CAAC,CAAC,CAAA;QAC9F,8DAA8D;QAC9D,MAAM,OAAO,GAAI,IAAY,EAAE,IAAI,IAAI,IAAI,CAAA;QAC3C,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACtC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command, Args, Flags } from '@oclif/core';
|
|
2
|
+
import { globalFlags, buildClient, display } from '../../../lib/base-command.js';
|
|
3
|
+
import { checkedFetch } from '../../../lib/api-client.js';
|
|
4
|
+
export default class DataServicesUptime extends Command {
|
|
5
|
+
static description = 'Get uptime data for a service';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> data services uptime aws-ec2',
|
|
8
|
+
'<%= config.bin %> data services uptime aws-ec2 --period 30d',
|
|
9
|
+
];
|
|
10
|
+
static args = { slug: Args.string({ description: 'Service slug', required: true }) };
|
|
11
|
+
static flags = {
|
|
12
|
+
...globalFlags,
|
|
13
|
+
period: Flags.string({ description: 'Time period (7d, 30d, 90d)', default: '30d' }),
|
|
14
|
+
granularity: Flags.string({ description: 'Data granularity (hourly, daily)' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { args, flags } = await this.parse(DataServicesUptime);
|
|
18
|
+
const client = buildClient(flags);
|
|
19
|
+
let path = `/api/v1/services/${args.slug}/uptime?period=${flags.period}`;
|
|
20
|
+
if (flags.granularity)
|
|
21
|
+
path += `&granularity=${flags.granularity}`;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
const resp = await checkedFetch(client.GET(path, {}));
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
const uptime = resp?.data ?? resp;
|
|
26
|
+
display(this, uptime, flags.output);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=uptime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uptime.js","sourceRoot":"","sources":["../../../../src/commands/data/services/uptime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAA;AAEvD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,OAAO;IACrD,MAAM,CAAC,WAAW,GAAG,+BAA+B,CAAA;IACpD,MAAM,CAAC,QAAQ,GAAG;QAChB,gDAAgD;QAChD,6DAA6D;KAC9D,CAAA;IACD,MAAM,CAAC,IAAI,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAC,CAAA;IAChF,MAAM,CAAC,KAAK,GAAG;QACb,GAAG,WAAW;QACd,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,4BAA4B,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC;QACjF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAC,WAAW,EAAE,kCAAkC,EAAC,CAAC;KAC7E,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAC1D,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QACjC,IAAI,IAAI,GAAG,oBAAoB,IAAI,CAAC,IAAI,kBAAkB,KAAK,CAAC,MAAM,EAAE,CAAA;QACxE,IAAI,KAAK,CAAC,WAAW;YAAE,IAAI,IAAI,gBAAgB,KAAK,CAAC,WAAW,EAAE,CAAA;QAClE,8DAA8D;QAC9D,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,IAAW,EAAE,EAAS,CAAC,CAAC,CAAA;QACnE,8DAA8D;QAC9D,MAAM,MAAM,GAAI,IAAY,EAAE,IAAI,IAAI,IAAI,CAAA;QAC1C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACrC,CAAC"}
|