@rollupdate/hctl 0.0.0-stage → 3.0.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.
- package/LICENSE +21 -0
- package/README.md +1066 -2
- package/dist/auction/cache.d.ts +6 -0
- package/dist/auction/cache.js +55 -0
- package/dist/auction/client.d.ts +24 -0
- package/dist/auction/client.js +236 -0
- package/dist/auction/commands.d.ts +2 -0
- package/dist/auction/commands.js +440 -0
- package/dist/auction/diff-formatter.d.ts +3 -0
- package/dist/auction/diff-formatter.js +61 -0
- package/dist/auction/diff.d.ts +11 -0
- package/dist/auction/diff.js +28 -0
- package/dist/auction/formatter.d.ts +21 -0
- package/dist/auction/formatter.js +182 -0
- package/dist/auction/store.d.ts +24 -0
- package/dist/auction/store.js +177 -0
- package/dist/auction/types.d.ts +74 -0
- package/dist/auction/types.js +5 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +74 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +4 -0
- package/dist/cloud/browser-bootstrap.d.ts +16 -0
- package/dist/cloud/browser-bootstrap.js +438 -0
- package/dist/cloud/client.d.ts +520 -0
- package/dist/cloud/client.js +755 -0
- package/dist/cloud/commands/certificate.d.ts +2 -0
- package/dist/cloud/commands/certificate.js +108 -0
- package/dist/cloud/commands/context.d.ts +2 -0
- package/dist/cloud/commands/context.js +133 -0
- package/dist/cloud/commands/datacenter.d.ts +2 -0
- package/dist/cloud/commands/datacenter.js +24 -0
- package/dist/cloud/commands/firewall.d.ts +2 -0
- package/dist/cloud/commands/firewall.js +142 -0
- package/dist/cloud/commands/floating-ip.d.ts +2 -0
- package/dist/cloud/commands/floating-ip.js +138 -0
- package/dist/cloud/commands/image.d.ts +2 -0
- package/dist/cloud/commands/image.js +98 -0
- package/dist/cloud/commands/index.d.ts +2 -0
- package/dist/cloud/commands/index.js +47 -0
- package/dist/cloud/commands/inventory.d.ts +2 -0
- package/dist/cloud/commands/inventory.js +13 -0
- package/dist/cloud/commands/iso.d.ts +2 -0
- package/dist/cloud/commands/iso.js +27 -0
- package/dist/cloud/commands/load-balancer-type.d.ts +2 -0
- package/dist/cloud/commands/load-balancer-type.js +24 -0
- package/dist/cloud/commands/load-balancer.d.ts +2 -0
- package/dist/cloud/commands/load-balancer.js +269 -0
- package/dist/cloud/commands/location.d.ts +2 -0
- package/dist/cloud/commands/location.js +24 -0
- package/dist/cloud/commands/network.d.ts +2 -0
- package/dist/cloud/commands/network.js +157 -0
- package/dist/cloud/commands/placement-group.d.ts +2 -0
- package/dist/cloud/commands/placement-group.js +79 -0
- package/dist/cloud/commands/pricing.d.ts +2 -0
- package/dist/cloud/commands/pricing.js +15 -0
- package/dist/cloud/commands/primary-ip.d.ts +2 -0
- package/dist/cloud/commands/primary-ip.js +139 -0
- package/dist/cloud/commands/server-type.d.ts +2 -0
- package/dist/cloud/commands/server-type.js +24 -0
- package/dist/cloud/commands/server.d.ts +2 -0
- package/dist/cloud/commands/server.js +346 -0
- package/dist/cloud/commands/ssh-key.d.ts +2 -0
- package/dist/cloud/commands/ssh-key.js +94 -0
- package/dist/cloud/commands/volume.d.ts +2 -0
- package/dist/cloud/commands/volume.js +138 -0
- package/dist/cloud/context.d.ts +34 -0
- package/dist/cloud/context.js +215 -0
- package/dist/cloud/formatter.d.ts +40 -0
- package/dist/cloud/formatter.js +824 -0
- package/dist/cloud/helpers.d.ts +27 -0
- package/dist/cloud/helpers.js +67 -0
- package/dist/cloud/inventory.d.ts +100 -0
- package/dist/cloud/inventory.js +229 -0
- package/dist/cloud/pricing.d.ts +27 -0
- package/dist/cloud/pricing.js +103 -0
- package/dist/cloud/token-instructions.d.ts +2 -0
- package/dist/cloud/token-instructions.js +21 -0
- package/dist/cloud/types.d.ts +437 -0
- package/dist/cloud/types.js +5 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -0
- package/dist/formatter.d.ts +3 -0
- package/dist/formatter.js +6 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +21 -0
- package/dist/robot/client.d.ts +246 -0
- package/dist/robot/client.js +719 -0
- package/dist/robot/commands/auth.d.ts +2 -0
- package/dist/robot/commands/auth.js +54 -0
- package/dist/robot/commands/boot.d.ts +2 -0
- package/dist/robot/commands/boot.js +76 -0
- package/dist/robot/commands/cancel.d.ts +2 -0
- package/dist/robot/commands/cancel.js +37 -0
- package/dist/robot/commands/failover.d.ts +2 -0
- package/dist/robot/commands/failover.js +46 -0
- package/dist/robot/commands/firewall.d.ts +2 -0
- package/dist/robot/commands/firewall.js +72 -0
- package/dist/robot/commands/index.d.ts +2 -0
- package/dist/robot/commands/index.js +36 -0
- package/dist/robot/commands/interactive.d.ts +2 -0
- package/dist/robot/commands/interactive.js +152 -0
- package/dist/robot/commands/ip.d.ts +2 -0
- package/dist/robot/commands/ip.js +55 -0
- package/dist/robot/commands/key.d.ts +2 -0
- package/dist/robot/commands/key.js +68 -0
- package/dist/robot/commands/order.d.ts +2 -0
- package/dist/robot/commands/order.js +33 -0
- package/dist/robot/commands/rdns.d.ts +2 -0
- package/dist/robot/commands/rdns.js +41 -0
- package/dist/robot/commands/reset.d.ts +2 -0
- package/dist/robot/commands/reset.js +77 -0
- package/dist/robot/commands/server.d.ts +2 -0
- package/dist/robot/commands/server.js +32 -0
- package/dist/robot/commands/storagebox.d.ts +2 -0
- package/dist/robot/commands/storagebox.js +126 -0
- package/dist/robot/commands/subnet.d.ts +2 -0
- package/dist/robot/commands/subnet.js +24 -0
- package/dist/robot/commands/traffic.d.ts +2 -0
- package/dist/robot/commands/traffic.js +23 -0
- package/dist/robot/commands/vswitch.d.ts +2 -0
- package/dist/robot/commands/vswitch.js +65 -0
- package/dist/robot/commands/wol.d.ts +2 -0
- package/dist/robot/commands/wol.js +20 -0
- package/dist/robot/formatter.d.ts +56 -0
- package/dist/robot/formatter.js +546 -0
- package/dist/robot/types.d.ts +353 -0
- package/dist/robot/types.js +5 -0
- package/dist/shared/config.d.ts +86 -0
- package/dist/shared/config.js +289 -0
- package/dist/shared/formatter.d.ts +29 -0
- package/dist/shared/formatter.js +121 -0
- package/dist/shared/helpers.d.ts +39 -0
- package/dist/shared/helpers.js +86 -0
- package/dist/shared/init.d.ts +2 -0
- package/dist/shared/init.js +107 -0
- package/dist/shared/reference.d.ts +5 -0
- package/dist/shared/reference.js +688 -0
- package/dist/shared/schemas.d.ts +1 -0
- package/dist/shared/schemas.js +1022 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -0
- package/package.json +131 -4
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// LLM-Optimized CLI Reference
|
|
3
|
+
// Outputs a structured, verbose plaintext document designed for easy parsing
|
|
4
|
+
// by language models (Claude, GPT, etc.) while remaining human-readable.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
import { createRequire } from "node:module";
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const { version: packageVersion } = require("../../package.json");
|
|
9
|
+
const createPreamble = (version) => `\
|
|
10
|
+
# HCTL — COMPLETE REFERENCE
|
|
11
|
+
# =================================
|
|
12
|
+
# Version: ${version}
|
|
13
|
+
# Binary: hctl
|
|
14
|
+
# Install: npm install -g @rollupdate/hctl
|
|
15
|
+
# Source: https://github.com/p8-public/hetzner-cli
|
|
16
|
+
#
|
|
17
|
+
# This CLI manages three Hetzner APIs:
|
|
18
|
+
# 1. Robot API — dedicated server management (requires Robot web service credentials)
|
|
19
|
+
# 2. Cloud API — cloud server/resource management (requires Cloud API token)
|
|
20
|
+
# 3. Auction API — public server auction browser (no authentication required)
|
|
21
|
+
#
|
|
22
|
+
# OUTPUT MODES:
|
|
23
|
+
# All commands default to human-readable formatted tables.
|
|
24
|
+
# Add --json to any command to get machine-readable JSON output.
|
|
25
|
+
# Add --output-schema to print the TypeScript type of the --json output (no API call).
|
|
26
|
+
# Example: hctl server list --json | jq '.[].server.server_ip'
|
|
27
|
+
# Example: hctl server list --output-schema
|
|
28
|
+
#
|
|
29
|
+
# SECTIONS: Use "hctl reference --section robot|cloud|auction" to show only one section.
|
|
30
|
+
#
|
|
31
|
+
# FIRST-TIME SETUP:
|
|
32
|
+
# hctl init — interactive wizard for Robot + Cloud credentials
|
|
33
|
+
# (alias: hctl setup; shows links to where each credential is created)
|
|
34
|
+
# Robot credentials are created in Robot; Cloud tokens are created in Cloud Console.
|
|
35
|
+
`;
|
|
36
|
+
const AUTHENTICATION = `\
|
|
37
|
+
# ============================================================================
|
|
38
|
+
# AUTHENTICATION
|
|
39
|
+
# ============================================================================
|
|
40
|
+
#
|
|
41
|
+
# ROBOT API — Credential Resolution Order:
|
|
42
|
+
# Created in Robot UI: https://robot.hetzner.com
|
|
43
|
+
# These are web service credentials, not Cloud Console API tokens.
|
|
44
|
+
# 1. CLI flags: --user <username> --password <password>
|
|
45
|
+
# 2. Environment: HETZNER_ROBOT_USER and HETZNER_ROBOT_PASSWORD
|
|
46
|
+
# 3. System keychain: stored by "hctl auth login" (uses keytar)
|
|
47
|
+
# 4. Config file: ~/.hctl/config.json
|
|
48
|
+
# 5. Interactive: prompts for username/password at runtime
|
|
49
|
+
#
|
|
50
|
+
# Password from stdin (keeps password out of shell history):
|
|
51
|
+
# echo "$PASSWORD" | hctl server list -u myuser -p -
|
|
52
|
+
#
|
|
53
|
+
# With 1Password:
|
|
54
|
+
# op read "op://vault/item/password" | hctl server list -u $(op read "op://vault/item/user") -p -
|
|
55
|
+
#
|
|
56
|
+
# CLOUD API — Token Resolution Order:
|
|
57
|
+
# Created in Cloud Console per project: https://console.hetzner.cloud
|
|
58
|
+
# These are project-scoped API tokens, not Robot web service credentials.
|
|
59
|
+
# 1. CLI flag: --token <token> (per command)
|
|
60
|
+
# 2. Environment: HETZNER_CLOUD_TOKEN
|
|
61
|
+
# 3. Active context: ~/.hctl/cloud-contexts.json (set via "hctl cloud context use <name>")
|
|
62
|
+
#
|
|
63
|
+
# AUCTION API — No authentication required.
|
|
64
|
+
|
|
65
|
+
# ============================================================================
|
|
66
|
+
# GLOBAL OPTIONS (apply to all commands)
|
|
67
|
+
# ============================================================================
|
|
68
|
+
|
|
69
|
+
hctl [command] [options]
|
|
70
|
+
-u, --user <username> Robot API username
|
|
71
|
+
-p, --password <password> Robot API password (use "-" to read from stdin)
|
|
72
|
+
--json Output raw JSON instead of formatted tables
|
|
73
|
+
--output-schema Print TypeScript type for --json output and exit (no API call)
|
|
74
|
+
-V, --version Show version number
|
|
75
|
+
-h, --help Show help for any command`;
|
|
76
|
+
const SECTION_ROBOT = `\
|
|
77
|
+
# ============================================================================
|
|
78
|
+
# ROBOT API COMMANDS — Dedicated Server Management
|
|
79
|
+
# ============================================================================
|
|
80
|
+
# All robot commands require Robot API credentials (see AUTHENTICATION above).
|
|
81
|
+
# Robot API docs: https://robot.hetzner.com/doc/webservice/en.html
|
|
82
|
+
|
|
83
|
+
# --- init: First-Time Setup Wizard ---
|
|
84
|
+
hctl init # Interactive wizard: configures Robot + Cloud credentials
|
|
85
|
+
hctl setup # Alias for init
|
|
86
|
+
# Shows the exact URLs where Robot and Cloud credentials are created.
|
|
87
|
+
# Skips an API if it is already configured.
|
|
88
|
+
|
|
89
|
+
# --- auth: Credential Management ---
|
|
90
|
+
hctl auth login # Interactive login, saves credentials
|
|
91
|
+
hctl auth logout # Clear saved credentials from keychain and config
|
|
92
|
+
hctl auth status # Show current auth status (which credential source is active)
|
|
93
|
+
hctl auth test # Test credentials against the API
|
|
94
|
+
|
|
95
|
+
# --- server: Dedicated Server Management ---
|
|
96
|
+
hctl server list # List all servers (alias: ls)
|
|
97
|
+
hctl server get <server> # Get server details by ID or IP (alias: show)
|
|
98
|
+
hctl server rename <server> <name> # Rename a server
|
|
99
|
+
|
|
100
|
+
# --- reset: Server Reset Operations ---
|
|
101
|
+
hctl reset options [server] # Show available reset types for server(s)
|
|
102
|
+
hctl reset execute <servers...> # Reset one or more servers (alias: run)
|
|
103
|
+
-t, --type <type> # Reset type: sw (software, default), hw (hardware), man (manual), power, power_long
|
|
104
|
+
-i, --interactive # Interactively select reset type per server
|
|
105
|
+
-y, --yes # Skip confirmation prompt
|
|
106
|
+
|
|
107
|
+
# --- boot: Boot Configuration ---
|
|
108
|
+
hctl boot status <server> # Show all boot configuration (rescue, linux, vnc, windows, etc.)
|
|
109
|
+
|
|
110
|
+
# boot rescue: Rescue System
|
|
111
|
+
hctl boot rescue activate <server> # Activate rescue system
|
|
112
|
+
-o, --os <os> # OS: linux (default), linuxold, vkvm
|
|
113
|
+
-a, --arch <arch> # Architecture: 64 (default), 32
|
|
114
|
+
-k, --keys <fingerprints...> # SSH key fingerprints to authorize
|
|
115
|
+
hctl boot rescue deactivate <server> # Deactivate rescue system
|
|
116
|
+
hctl boot rescue last <server> # Show last rescue activation (including password if recent)
|
|
117
|
+
|
|
118
|
+
# boot linux: Linux Installation
|
|
119
|
+
hctl boot linux activate <server> # Activate Linux installation
|
|
120
|
+
-d, --dist <dist> # Distribution name (required), e.g. "Debian-1210-bookworm-amd64-base"
|
|
121
|
+
-a, --arch <arch> # Architecture: 64 (default), 32
|
|
122
|
+
-l, --lang <lang> # Language: en (default)
|
|
123
|
+
-k, --keys <fingerprints...> # SSH key fingerprints to authorize
|
|
124
|
+
hctl boot linux deactivate <server> # Deactivate pending Linux installation
|
|
125
|
+
hctl boot linux options <server> # Show available Linux distributions for this server
|
|
126
|
+
|
|
127
|
+
# --- ip: IP Address Management ---
|
|
128
|
+
hctl ip list # List all IP addresses (alias: ls)
|
|
129
|
+
hctl ip get <ip> # Get IP details (alias: show)
|
|
130
|
+
hctl ip update <ip> # Update IP traffic warning settings
|
|
131
|
+
--warnings <enabled> # Enable/disable warnings: true/false
|
|
132
|
+
--hourly <mb> # Hourly traffic warning threshold in MB
|
|
133
|
+
--daily <mb> # Daily traffic warning threshold in MB
|
|
134
|
+
--monthly <gb> # Monthly traffic warning threshold in GB
|
|
135
|
+
|
|
136
|
+
# ip mac: Separate MAC Addresses
|
|
137
|
+
hctl ip mac get <ip> # Get separate MAC address for IP
|
|
138
|
+
hctl ip mac generate <ip> # Generate a new separate MAC address
|
|
139
|
+
hctl ip mac delete <ip> # Delete separate MAC address
|
|
140
|
+
|
|
141
|
+
# --- subnet: Subnet Management ---
|
|
142
|
+
hctl subnet list # List all subnets (alias: ls)
|
|
143
|
+
hctl subnet get <subnet> # Get subnet details (alias: show)
|
|
144
|
+
|
|
145
|
+
# --- failover: Failover IP Management ---
|
|
146
|
+
hctl failover list # List all failover IPs (alias: ls)
|
|
147
|
+
hctl failover get <ip> # Get failover IP details (alias: show)
|
|
148
|
+
hctl failover switch <failover-ip> <target-server-ip> # Switch failover routing
|
|
149
|
+
-y, --yes # Skip confirmation
|
|
150
|
+
hctl failover delete <ip> # Delete failover IP routing
|
|
151
|
+
-y, --yes # Skip confirmation
|
|
152
|
+
|
|
153
|
+
# --- rdns: Reverse DNS Management ---
|
|
154
|
+
hctl rdns list # List all reverse DNS entries (alias: ls)
|
|
155
|
+
hctl rdns get <ip> # Get reverse DNS for IP (alias: show)
|
|
156
|
+
hctl rdns set <ip> <ptr> # Create or update reverse DNS entry
|
|
157
|
+
hctl rdns delete <ip> # Delete reverse DNS entry
|
|
158
|
+
|
|
159
|
+
# --- key: SSH Key Management ---
|
|
160
|
+
hctl key list # List all SSH keys (alias: ls)
|
|
161
|
+
hctl key get <fingerprint> # Get SSH key details (alias: show)
|
|
162
|
+
hctl key add <name> # Add new SSH key (prompts for key data if no flags)
|
|
163
|
+
-f, --file <path> # Path to public key file (e.g. ~/.ssh/id_rsa.pub)
|
|
164
|
+
-d, --data <key> # Public key data as string
|
|
165
|
+
hctl key rename <fingerprint> <name> # Rename an SSH key
|
|
166
|
+
hctl key delete <fingerprint> # Delete an SSH key (alias: rm)
|
|
167
|
+
-y, --yes # Skip confirmation
|
|
168
|
+
|
|
169
|
+
# --- firewall: Firewall Management ---
|
|
170
|
+
hctl firewall get <server> # Get firewall configuration (alias: show)
|
|
171
|
+
hctl firewall enable <server> # Enable firewall
|
|
172
|
+
hctl firewall disable <server> # Disable firewall
|
|
173
|
+
hctl firewall delete <server> # Delete all firewall rules
|
|
174
|
+
-y, --yes # Skip confirmation
|
|
175
|
+
|
|
176
|
+
# firewall template: Firewall Templates
|
|
177
|
+
hctl firewall template list # List firewall templates (alias: ls)
|
|
178
|
+
hctl firewall template get <id> # Get template details (alias: show)
|
|
179
|
+
hctl firewall template delete <id> # Delete template (alias: rm)
|
|
180
|
+
-y, --yes # Skip confirmation
|
|
181
|
+
|
|
182
|
+
# --- vswitch: vSwitch Management ---
|
|
183
|
+
hctl vswitch list # List all vSwitches (alias: ls)
|
|
184
|
+
hctl vswitch get <id> # Get vSwitch details (alias: show)
|
|
185
|
+
hctl vswitch create <name> <vlan> # Create a new vSwitch
|
|
186
|
+
hctl vswitch update <id> # Update vSwitch
|
|
187
|
+
-n, --name <name> # New name
|
|
188
|
+
-v, --vlan <vlan> # New VLAN ID
|
|
189
|
+
hctl vswitch delete <id> # Delete vSwitch (alias: rm)
|
|
190
|
+
-y, --yes # Skip confirmation
|
|
191
|
+
--date <date> # Cancellation date (YYYY-MM-DD format)
|
|
192
|
+
hctl vswitch add-server <vswitch-id> <server> # Add server to vSwitch
|
|
193
|
+
hctl vswitch remove-server <vswitch-id> <server> # Remove server from vSwitch
|
|
194
|
+
|
|
195
|
+
# --- storagebox: Storage Box Management (alias: storage) ---
|
|
196
|
+
hctl storagebox list # List all storage boxes (alias: ls)
|
|
197
|
+
hctl storagebox get <id> # Get storage box details (alias: show)
|
|
198
|
+
hctl storagebox update <id> # Update storage box settings
|
|
199
|
+
-n, --name <name> # Storage box name
|
|
200
|
+
--webdav <enabled> # Enable/disable WebDAV: true/false
|
|
201
|
+
--samba <enabled> # Enable/disable Samba: true/false
|
|
202
|
+
--ssh <enabled> # Enable/disable SSH/SFTP: true/false
|
|
203
|
+
--external <enabled> # Enable/disable external reachability: true/false
|
|
204
|
+
--zfs <enabled> # Enable/disable ZFS: true/false
|
|
205
|
+
hctl storagebox reset-password <id> # Reset storage box password
|
|
206
|
+
|
|
207
|
+
# storagebox snapshot: Snapshot Management
|
|
208
|
+
hctl storagebox snapshot list <box-id> # List snapshots (alias: ls)
|
|
209
|
+
hctl storagebox snapshot create <box-id> # Create a new snapshot
|
|
210
|
+
hctl storagebox snapshot delete <box-id> <name> # Delete a snapshot (alias: rm)
|
|
211
|
+
-y, --yes # Skip confirmation
|
|
212
|
+
hctl storagebox snapshot revert <box-id> <name> # Revert to a snapshot
|
|
213
|
+
-y, --yes # Skip confirmation
|
|
214
|
+
|
|
215
|
+
# storagebox subaccount: Subaccount Management
|
|
216
|
+
hctl storagebox subaccount list <box-id> # List subaccounts (alias: ls)
|
|
217
|
+
hctl storagebox subaccount create <box-id> <home-directory> # Create subaccount
|
|
218
|
+
--samba <enabled> # Enable Samba: true/false
|
|
219
|
+
--ssh <enabled> # Enable SSH: true/false
|
|
220
|
+
--webdav <enabled> # Enable WebDAV: true/false
|
|
221
|
+
--external <enabled> # Enable external access: true/false
|
|
222
|
+
--readonly <enabled> # Read-only mode: true/false
|
|
223
|
+
--comment <comment> # Comment
|
|
224
|
+
hctl storagebox subaccount delete <box-id> <username> # Delete subaccount (alias: rm)
|
|
225
|
+
-y, --yes # Skip confirmation
|
|
226
|
+
|
|
227
|
+
# --- traffic: Traffic Analytics ---
|
|
228
|
+
hctl traffic query # Query traffic data
|
|
229
|
+
-i, --ip <ips...> # IP addresses to query
|
|
230
|
+
-s, --subnet <subnets...> # Subnets to query
|
|
231
|
+
--from <date> # Start date (YYYY-MM-DD)
|
|
232
|
+
--to <date> # End date (YYYY-MM-DD)
|
|
233
|
+
-t, --type <type> # Query type: day, month (default), year
|
|
234
|
+
|
|
235
|
+
# --- wol: Wake on LAN ---
|
|
236
|
+
hctl wol status <server> # Check WoL status for server
|
|
237
|
+
hctl wol send <server> # Send Wake on LAN packet
|
|
238
|
+
|
|
239
|
+
# --- cancel: Server Cancellation ---
|
|
240
|
+
hctl cancel status <server> # Get cancellation status
|
|
241
|
+
hctl cancel request <server> # Request server cancellation
|
|
242
|
+
--date <date> # Cancellation date (YYYY-MM-DD)
|
|
243
|
+
--reason <reasons...> # Cancellation reasons
|
|
244
|
+
-y, --yes # Skip confirmation
|
|
245
|
+
hctl cancel revoke <server> # Revoke pending cancellation
|
|
246
|
+
|
|
247
|
+
# --- order: Server Ordering ---
|
|
248
|
+
hctl order products # List available server products
|
|
249
|
+
hctl order market # List server market/auction products (authenticated API)
|
|
250
|
+
hctl order transactions # List order transactions
|
|
251
|
+
hctl order transaction <id> # Get order transaction details
|
|
252
|
+
|
|
253
|
+
# --- interactive: Interactive Mode (alias: i) ---
|
|
254
|
+
hctl interactive # Launch menu-driven interface for common operations
|
|
255
|
+
hctl i # Short alias
|
|
256
|
+
|
|
257
|
+
# --- Robot API Examples ---
|
|
258
|
+
# List all dedicated servers:
|
|
259
|
+
# hctl server list
|
|
260
|
+
#
|
|
261
|
+
# Get server details as JSON:
|
|
262
|
+
# hctl server get 123456 --json
|
|
263
|
+
#
|
|
264
|
+
# Hardware reset a server:
|
|
265
|
+
# hctl reset execute 123456 -t hw -y
|
|
266
|
+
#
|
|
267
|
+
# Activate rescue mode with SSH key:
|
|
268
|
+
# hctl boot rescue activate 123456 -k ab:cd:ef:12:34:56
|
|
269
|
+
#
|
|
270
|
+
# Switch failover IP:
|
|
271
|
+
# hctl failover switch 1.2.3.4 5.6.7.8 -y
|
|
272
|
+
#
|
|
273
|
+
# Query monthly traffic:
|
|
274
|
+
# hctl traffic query --ip 1.2.3.4 --from 2025-01-01 --to 2025-01-31`;
|
|
275
|
+
const SECTION_CLOUD = `\
|
|
276
|
+
# ============================================================================
|
|
277
|
+
# CLOUD API COMMANDS — hctl cloud <resource> <action>
|
|
278
|
+
# ============================================================================
|
|
279
|
+
# All cloud commands require a Cloud API token (see AUTHENTICATION above).
|
|
280
|
+
# Cloud API docs: https://docs.hetzner.cloud/
|
|
281
|
+
|
|
282
|
+
# --- cloud context: Context/Token Management ---
|
|
283
|
+
hctl cloud context create <name> # Create a new cloud context (saves token)
|
|
284
|
+
-t, --token <token> # API token (prompts interactively if omitted)
|
|
285
|
+
--no-verify # Skip validation with api.hetzner.cloud
|
|
286
|
+
hctl cloud context test # Validate the resolved Cloud API token
|
|
287
|
+
-t, --token <token> # Validate this token instead of resolving one
|
|
288
|
+
hctl cloud context bootstrap <name> # Explicit browser-assisted token creation
|
|
289
|
+
--project <name> # Cloud project name
|
|
290
|
+
--create-project # Guide through creating the project first
|
|
291
|
+
--token-name <name> # API token name to use in Hetzner Console
|
|
292
|
+
--permission <permission> # read or read-write (default: read-write)
|
|
293
|
+
--write-env [path] # Also write HETZNER_CLOUD_TOKEN to .env or path
|
|
294
|
+
--no-verify # Skip validation with api.hetzner.cloud
|
|
295
|
+
hctl cloud context use <name> # Switch to a cloud context (sets it as active)
|
|
296
|
+
hctl cloud context delete <name> # Delete a cloud context (alias: rm)
|
|
297
|
+
hctl cloud context list # List all cloud contexts (alias: ls)
|
|
298
|
+
hctl cloud context active # Show the currently active cloud context
|
|
299
|
+
|
|
300
|
+
# --- cloud server: Cloud Server Management ---
|
|
301
|
+
hctl cloud server list # List all cloud servers (alias: ls)
|
|
302
|
+
-l, --label-selector <selector> # Filter by label (e.g. "env=prod")
|
|
303
|
+
-n, --name <name> # Filter by name
|
|
304
|
+
-s, --sort <field> # Sort by field (e.g. "name", "created")
|
|
305
|
+
--status <status> # Filter by status (e.g. "running", "off")
|
|
306
|
+
hctl cloud server describe <id> # Show server details
|
|
307
|
+
hctl cloud server create # Create a new server
|
|
308
|
+
--name <name> # Server name (REQUIRED)
|
|
309
|
+
--type <type> # Server type, e.g. cx22 (REQUIRED)
|
|
310
|
+
--image <image> # Image name or ID, e.g. ubuntu-22.04 (REQUIRED)
|
|
311
|
+
--location <location> # Location: fsn1, nbg1, hel1, ash, hil
|
|
312
|
+
--ssh-key <keys...> # SSH key IDs or names
|
|
313
|
+
--user-data <data> # Cloud-init user data
|
|
314
|
+
--start-after-create # Start server immediately (default: true)
|
|
315
|
+
--no-start-after-create # Create without starting
|
|
316
|
+
hctl cloud server delete <id> # Delete a server
|
|
317
|
+
-y, --yes # Skip confirmation
|
|
318
|
+
hctl cloud server update <id> # Update server
|
|
319
|
+
--name <name> # New server name
|
|
320
|
+
hctl cloud server poweron <id> # Power on a server
|
|
321
|
+
hctl cloud server poweroff <id> # Power off a server (hard power off)
|
|
322
|
+
hctl cloud server reboot <id> # Soft reboot a server (ACPI)
|
|
323
|
+
hctl cloud server reset <id> # Hard reset a server
|
|
324
|
+
hctl cloud server shutdown <id> # Graceful shutdown (ACPI signal)
|
|
325
|
+
hctl cloud server rebuild <id> # Rebuild server with new image
|
|
326
|
+
--image <image> # Image to rebuild with (REQUIRED)
|
|
327
|
+
hctl cloud server change-type <id> # Change server type (resize)
|
|
328
|
+
--type <type> # New server type (REQUIRED)
|
|
329
|
+
--upgrade-disk # Also upgrade disk (irreversible)
|
|
330
|
+
hctl cloud server enable-rescue <id> # Enable rescue mode
|
|
331
|
+
--type <type> # Rescue type: linux64 (default)
|
|
332
|
+
--ssh-key <keys...> # SSH key IDs
|
|
333
|
+
hctl cloud server disable-rescue <id> # Disable rescue mode
|
|
334
|
+
hctl cloud server enable-backup <id> # Enable automatic backups
|
|
335
|
+
hctl cloud server disable-backup <id> # Disable automatic backups
|
|
336
|
+
hctl cloud server create-image <id> # Create snapshot from server
|
|
337
|
+
--description <desc> # Image description
|
|
338
|
+
--type <type> # Image type: snapshot (default), backup
|
|
339
|
+
hctl cloud server attach-iso <id> # Attach ISO to server
|
|
340
|
+
--iso <iso> # ISO name or ID (REQUIRED)
|
|
341
|
+
hctl cloud server detach-iso <id> # Detach ISO from server
|
|
342
|
+
hctl cloud server reset-password <id> # Reset root password
|
|
343
|
+
hctl cloud server set-rdns <id> # Set reverse DNS
|
|
344
|
+
--ip <ip> # IP address (REQUIRED)
|
|
345
|
+
--dns-ptr <ptr> # DNS pointer record (REQUIRED)
|
|
346
|
+
hctl cloud server enable-protection <id> # Enable protection
|
|
347
|
+
--delete # Delete protection (default: true)
|
|
348
|
+
--rebuild # Rebuild protection (default: false)
|
|
349
|
+
hctl cloud server disable-protection <id> # Disable all protection
|
|
350
|
+
hctl cloud server request-console <id> # Get WebSocket VNC console URL + password
|
|
351
|
+
hctl cloud server attach-to-network <id> # Attach to network
|
|
352
|
+
--network <network> # Network ID (REQUIRED)
|
|
353
|
+
--ip <ip> # IP address in network (optional)
|
|
354
|
+
hctl cloud server detach-from-network <id> # Detach from network
|
|
355
|
+
--network <network> # Network ID (REQUIRED)
|
|
356
|
+
hctl cloud server add-label <id> <label> # Add label (format: key=value)
|
|
357
|
+
hctl cloud server remove-label <id> <key> # Remove label by key
|
|
358
|
+
|
|
359
|
+
# --- cloud network: Network Management ---
|
|
360
|
+
hctl cloud network list # List all networks (alias: ls)
|
|
361
|
+
hctl cloud network describe <id> # Show network details
|
|
362
|
+
hctl cloud network create # Create a network
|
|
363
|
+
--name <name> # Network name (REQUIRED)
|
|
364
|
+
--ip-range <cidr> # IP range in CIDR notation (REQUIRED)
|
|
365
|
+
hctl cloud network delete <id> # Delete a network
|
|
366
|
+
-y, --yes # Skip confirmation
|
|
367
|
+
|
|
368
|
+
# --- cloud firewall: Cloud Firewall Management ---
|
|
369
|
+
hctl cloud firewall list # List all firewalls (alias: ls)
|
|
370
|
+
hctl cloud firewall describe <id> # Show firewall details
|
|
371
|
+
hctl cloud firewall create # Create a firewall
|
|
372
|
+
--name <name> # Firewall name (REQUIRED)
|
|
373
|
+
hctl cloud firewall delete <id> # Delete a firewall
|
|
374
|
+
-y, --yes # Skip confirmation
|
|
375
|
+
|
|
376
|
+
# --- cloud floating-ip: Floating IP Management ---
|
|
377
|
+
hctl cloud floating-ip list # List all floating IPs (alias: ls)
|
|
378
|
+
hctl cloud floating-ip describe <id> # Show floating IP details
|
|
379
|
+
hctl cloud floating-ip create # Create a floating IP
|
|
380
|
+
--type <type> # IP type: ipv4, ipv6 (REQUIRED)
|
|
381
|
+
--home-location <location> # Home location (REQUIRED)
|
|
382
|
+
--description <desc> # Description
|
|
383
|
+
hctl cloud floating-ip delete <id> # Delete a floating IP
|
|
384
|
+
-y, --yes # Skip confirmation
|
|
385
|
+
|
|
386
|
+
# --- cloud primary-ip: Primary IP Management ---
|
|
387
|
+
hctl cloud primary-ip list # List all primary IPs (alias: ls)
|
|
388
|
+
hctl cloud primary-ip describe <id> # Show primary IP details
|
|
389
|
+
hctl cloud primary-ip create # Create a primary IP
|
|
390
|
+
--type <type> # IP type: ipv4, ipv6 (REQUIRED)
|
|
391
|
+
--name <name> # Name (REQUIRED)
|
|
392
|
+
--location <location> # Location, e.g. fsn1 (required unless --assignee-id is set)
|
|
393
|
+
--assignee-id <id> # Server to assign to
|
|
394
|
+
--auto-delete # Auto-delete with server
|
|
395
|
+
hctl cloud primary-ip delete <id> # Delete a primary IP
|
|
396
|
+
-y, --yes # Skip confirmation
|
|
397
|
+
|
|
398
|
+
# --- cloud volume: Volume Management ---
|
|
399
|
+
hctl cloud volume list # List all volumes (alias: ls)
|
|
400
|
+
hctl cloud volume describe <id> # Show volume details
|
|
401
|
+
hctl cloud volume create # Create a volume
|
|
402
|
+
--name <name> # Volume name (REQUIRED)
|
|
403
|
+
--size <gb> # Size in GB (REQUIRED)
|
|
404
|
+
--location <location> # Location
|
|
405
|
+
--server <id> # Attach to server immediately
|
|
406
|
+
hctl cloud volume delete <id> # Delete a volume
|
|
407
|
+
-y, --yes # Skip confirmation
|
|
408
|
+
|
|
409
|
+
# --- cloud load-balancer: Load Balancer Management ---
|
|
410
|
+
hctl cloud load-balancer list # List all load balancers (alias: ls)
|
|
411
|
+
hctl cloud load-balancer describe <id> # Show load balancer details
|
|
412
|
+
hctl cloud load-balancer create # Create a load balancer
|
|
413
|
+
--name <name> # Load balancer name (REQUIRED)
|
|
414
|
+
--type <type> # Load balancer type (REQUIRED)
|
|
415
|
+
--location <location> # Location
|
|
416
|
+
hctl cloud load-balancer delete <id> # Delete a load balancer
|
|
417
|
+
-y, --yes # Skip confirmation
|
|
418
|
+
|
|
419
|
+
# --- cloud image: Image Management ---
|
|
420
|
+
hctl cloud image list # List all images (alias: ls)
|
|
421
|
+
-l, --label-selector <selector> # Filter by label
|
|
422
|
+
-s, --sort <field> # Sort by field
|
|
423
|
+
--type <type> # Filter: system, snapshot, backup, app
|
|
424
|
+
--architecture <arch> # Filter: x86, arm
|
|
425
|
+
--status <status> # Filter by status
|
|
426
|
+
hctl cloud image describe <id> # Show image details
|
|
427
|
+
hctl cloud image update <id> # Update image
|
|
428
|
+
--description <desc> # New description
|
|
429
|
+
--type <type> # New type
|
|
430
|
+
hctl cloud image delete <id> # Delete an image
|
|
431
|
+
-y, --yes # Skip confirmation
|
|
432
|
+
|
|
433
|
+
# --- cloud ssh-key: Cloud SSH Key Management ---
|
|
434
|
+
hctl cloud ssh-key list # List all SSH keys (alias: ls)
|
|
435
|
+
hctl cloud ssh-key describe <id> # Show SSH key details
|
|
436
|
+
hctl cloud ssh-key create # Create an SSH key
|
|
437
|
+
--name <name> # Key name (REQUIRED)
|
|
438
|
+
--public-key <key> # Public key data (REQUIRED)
|
|
439
|
+
hctl cloud ssh-key delete <id> # Delete an SSH key
|
|
440
|
+
-y, --yes # Skip confirmation
|
|
441
|
+
|
|
442
|
+
# --- cloud certificate: TLS Certificate Management ---
|
|
443
|
+
hctl cloud certificate list # List all certificates (alias: ls)
|
|
444
|
+
hctl cloud certificate describe <id> # Show certificate details
|
|
445
|
+
hctl cloud certificate create # Create/upload a certificate
|
|
446
|
+
--name <name> # Certificate name (REQUIRED)
|
|
447
|
+
--certificate <cert> # PEM certificate data
|
|
448
|
+
--private-key <key> # PEM private key data
|
|
449
|
+
hctl cloud certificate delete <id> # Delete a certificate
|
|
450
|
+
-y, --yes # Skip confirmation
|
|
451
|
+
|
|
452
|
+
# --- cloud placement-group: Placement Group Management ---
|
|
453
|
+
hctl cloud placement-group list # List all placement groups (alias: ls)
|
|
454
|
+
hctl cloud placement-group describe <id> # Show placement group details
|
|
455
|
+
hctl cloud placement-group create # Create a placement group
|
|
456
|
+
--name <name> # Group name (REQUIRED)
|
|
457
|
+
--type <type> # Type: spread (REQUIRED)
|
|
458
|
+
hctl cloud placement-group delete <id> # Delete a placement group
|
|
459
|
+
-y, --yes # Skip confirmation
|
|
460
|
+
|
|
461
|
+
# --- cloud datacenter: Datacenter Information (read-only) ---
|
|
462
|
+
hctl cloud datacenter list # List all datacenters (alias: ls)
|
|
463
|
+
hctl cloud datacenter describe <id> # Show datacenter details
|
|
464
|
+
|
|
465
|
+
# --- cloud location: Location Information (read-only) ---
|
|
466
|
+
hctl cloud location list # List all locations (alias: ls)
|
|
467
|
+
hctl cloud location describe <id> # Show location details
|
|
468
|
+
|
|
469
|
+
# --- cloud server-type: Server Type Information (read-only) ---
|
|
470
|
+
hctl cloud server-type list # List all server types (alias: ls)
|
|
471
|
+
hctl cloud server-type describe <id> # Show server type details
|
|
472
|
+
|
|
473
|
+
# --- cloud load-balancer-type: Load Balancer Type Information (read-only) ---
|
|
474
|
+
hctl cloud load-balancer-type list # List all load balancer types (alias: ls)
|
|
475
|
+
hctl cloud load-balancer-type describe <id> # Show load balancer type details
|
|
476
|
+
|
|
477
|
+
# --- cloud iso: ISO Image Information ---
|
|
478
|
+
hctl cloud iso list # List all ISO images (alias: ls)
|
|
479
|
+
-n, --name <name> # Filter by name
|
|
480
|
+
-a, --architecture <arch> # Filter by architecture
|
|
481
|
+
hctl cloud iso describe <id> # Show ISO details
|
|
482
|
+
|
|
483
|
+
# --- Cloud API Examples ---
|
|
484
|
+
# Set up cloud authentication:
|
|
485
|
+
# hctl init
|
|
486
|
+
# Or create an additional named context:
|
|
487
|
+
# hctl cloud context create production -t hcloud_xxxxx
|
|
488
|
+
# hctl cloud context use production
|
|
489
|
+
#
|
|
490
|
+
# Create a cloud server:
|
|
491
|
+
# hctl cloud server create --name web1 --type cx22 --image ubuntu-22.04 --location fsn1 --ssh-key my-key
|
|
492
|
+
#
|
|
493
|
+
# List cloud servers filtered by label:
|
|
494
|
+
# hctl cloud server list -l "env=prod" --json
|
|
495
|
+
#
|
|
496
|
+
# Snapshot a server:
|
|
497
|
+
# hctl cloud server create-image 12345 --description "before upgrade"
|
|
498
|
+
#
|
|
499
|
+
# Resize a server:
|
|
500
|
+
# hctl cloud server change-type 12345 --type cx32`;
|
|
501
|
+
const SECTION_AUCTION = `\
|
|
502
|
+
# ============================================================================
|
|
503
|
+
# AUCTION COMMANDS — Public Server Auction Browser
|
|
504
|
+
# ============================================================================
|
|
505
|
+
# No authentication required. Data from hosted 15-minute cache by default:
|
|
506
|
+
# https://auction.hctl.dev/live_data_sb_EUR.json
|
|
507
|
+
# Use --direct to fetch from Hetzner's public endpoint instead:
|
|
508
|
+
# https://www.hetzner.com/_resources/app/data/app/live_data_sb_EUR.json
|
|
509
|
+
# Returns the current public auction inventory. All filtering and sorting is done client-side.
|
|
510
|
+
# Human output includes auction freshness timestamps. JSON output stays parseable on stdout.
|
|
511
|
+
# When offline, "auction list" and "auction show" can use the last local cache and mark it stale.
|
|
512
|
+
# "auction diff" and "auction watch" require current data and do not snapshot stale local fallback data.
|
|
513
|
+
# Use "hctl auction status --json" before automation when freshness matters.
|
|
514
|
+
#
|
|
515
|
+
# TYPICAL DATA RANGES (approximate, changes continuously):
|
|
516
|
+
# Price: 35 - 450 EUR/month
|
|
517
|
+
# Hourly: 0.04 - 0.72 EUR/hour
|
|
518
|
+
# RAM: 32 - 1024 GB
|
|
519
|
+
# Disk total: 240 - 230,000+ GB
|
|
520
|
+
# Disk count: 1 - 16 drives
|
|
521
|
+
# CPU models: Intel (i7, Xeon) and AMD (Ryzen, EPYC)
|
|
522
|
+
# Datacenters: FSN1-DC* (Falkenstein), HEL1-DC* (Helsinki), NBG1-DC* (Nuremberg)
|
|
523
|
+
# Specials: ECC, GPU, IPv4, iNIC (Intel NIC)
|
|
524
|
+
|
|
525
|
+
# --- auction list: List and Filter Auction Servers ---
|
|
526
|
+
hctl auction list # List all auction servers (alias: ls)
|
|
527
|
+
|
|
528
|
+
# PRICE FILTERS:
|
|
529
|
+
--min-price <n> # Minimum monthly price (EUR/USD)
|
|
530
|
+
--max-price <n> # Maximum monthly price
|
|
531
|
+
--max-hourly-price <n> # Maximum hourly price
|
|
532
|
+
--max-setup-price <n> # Maximum setup fee
|
|
533
|
+
--no-setup-fee # Only servers with zero setup fee (shorthand for --max-setup-price 0)
|
|
534
|
+
--fixed-price # Only fixed-price servers (price won't change)
|
|
535
|
+
--auction-only # Only auction servers (price decreases over time)
|
|
536
|
+
|
|
537
|
+
# HARDWARE FILTERS:
|
|
538
|
+
--cpu <text> # CPU model substring match, case-insensitive
|
|
539
|
+
# Examples: "Ryzen", "EPYC", "i7-6700", "Xeon"
|
|
540
|
+
--min-cpu-count <n> # Minimum CPU/socket count
|
|
541
|
+
--max-cpu-count <n> # Maximum CPU/socket count
|
|
542
|
+
--min-ram <gb> # Minimum RAM in GB
|
|
543
|
+
--max-ram <gb> # Maximum RAM in GB
|
|
544
|
+
--ecc # Only ECC RAM servers
|
|
545
|
+
|
|
546
|
+
# DISK FILTERS:
|
|
547
|
+
--min-disk-size <gb> # Minimum total disk capacity in GB (sum across all drives)
|
|
548
|
+
--max-disk-size <gb> # Maximum total disk capacity in GB
|
|
549
|
+
--min-disk-count <n> # Minimum number of physical drives
|
|
550
|
+
--max-disk-count <n> # Maximum number of physical drives
|
|
551
|
+
--disk-type <type> # Only servers with this disk type: nvme, sata, hdd
|
|
552
|
+
# Note: server may have OTHER types too; this checks presence
|
|
553
|
+
|
|
554
|
+
# NETWORK FILTERS:
|
|
555
|
+
--datacenter <text> # Datacenter substring match, case-insensitive
|
|
556
|
+
# Examples: "FSN" (all Falkenstein), "HEL1-DC2" (specific), "NBG"
|
|
557
|
+
--min-bandwidth <mbit> # Minimum bandwidth in Mbit/s
|
|
558
|
+
|
|
559
|
+
# FEATURE FILTERS:
|
|
560
|
+
--gpu # Only GPU servers
|
|
561
|
+
--inic # Only servers with Intel NIC
|
|
562
|
+
--highio # Only high I/O servers
|
|
563
|
+
--specials <text> # Filter by any special feature, substring match
|
|
564
|
+
# Examples: "GPU", "ECC", "iNIC", "IPv4"
|
|
565
|
+
|
|
566
|
+
# TEXT SEARCH:
|
|
567
|
+
--search <text> # Free-text search across server description lines
|
|
568
|
+
# Searches the description array (CPU, RAM, disk details, NIC info)
|
|
569
|
+
|
|
570
|
+
# SORTING:
|
|
571
|
+
--sort <field> # Sort field (default: price). Choices:
|
|
572
|
+
# price — monthly price
|
|
573
|
+
# hourly — hourly price
|
|
574
|
+
# setup — setup fee
|
|
575
|
+
# ram — RAM size in GB
|
|
576
|
+
# disk — total disk capacity (sum of all drives)
|
|
577
|
+
# disk_count — number of physical drives
|
|
578
|
+
# cpu — CPU model name (alphabetical)
|
|
579
|
+
# cpu_count — number of CPU sockets
|
|
580
|
+
# datacenter — datacenter name (alphabetical)
|
|
581
|
+
# bandwidth — bandwidth in Mbit/s
|
|
582
|
+
# next_reduce — minutes until next price reduction (auction servers only)
|
|
583
|
+
--desc # Sort in descending order (default: ascending)
|
|
584
|
+
|
|
585
|
+
# OUTPUT:
|
|
586
|
+
--currency <currency> # EUR (default) or USD
|
|
587
|
+
--direct # Fetch directly from Hetzner instead of hosted cache
|
|
588
|
+
--limit <n> # Limit number of results shown
|
|
589
|
+
--json # Output raw JSON array
|
|
590
|
+
|
|
591
|
+
# --- auction show: Show Auction Server Details ---
|
|
592
|
+
hctl auction show <id> # Show full details for a specific auction server
|
|
593
|
+
--currency <currency> # EUR (default) or USD
|
|
594
|
+
--direct # Fetch directly from Hetzner instead of hosted cache
|
|
595
|
+
--json # Output raw JSON object
|
|
596
|
+
|
|
597
|
+
# --- auction status: Show Auction Freshness and Cache State ---
|
|
598
|
+
hctl auction status # Show hosted/local cache freshness
|
|
599
|
+
--currency <currency> # EUR (default) or USD
|
|
600
|
+
--direct # Check Hetzner direct instead of hosted cache
|
|
601
|
+
--json # Output machine-readable freshness JSON
|
|
602
|
+
# Includes: updatedAt, ageSeconds, stale, source,
|
|
603
|
+
# serverCount, endpointUrl, localCache, usingLocalFallback
|
|
604
|
+
|
|
605
|
+
# --- Auction API Examples ---
|
|
606
|
+
# Browse all auction servers sorted by price:
|
|
607
|
+
# hctl auction list
|
|
608
|
+
#
|
|
609
|
+
# Find cheap AMD EPYC servers with NVMe and ECC in Helsinki:
|
|
610
|
+
# hctl auction list --cpu epyc --disk-type nvme --ecc --datacenter HEL --sort price
|
|
611
|
+
#
|
|
612
|
+
# Find GPU servers under 150 EUR:
|
|
613
|
+
# hctl auction list --gpu --max-price 150
|
|
614
|
+
#
|
|
615
|
+
# Find servers with at least 256 GB RAM and 4+ drives:
|
|
616
|
+
# hctl auction list --min-ram 256 --min-disk-count 4 --sort ram --desc
|
|
617
|
+
#
|
|
618
|
+
# Find the cheapest fixed-price servers with NVMe:
|
|
619
|
+
# hctl auction list --fixed-price --disk-type nvme --sort price --limit 10
|
|
620
|
+
#
|
|
621
|
+
# Find auction servers about to drop in price (sorted by nearest reduction):
|
|
622
|
+
# hctl auction list --auction-only --sort next_reduce --limit 20
|
|
623
|
+
#
|
|
624
|
+
# Get full details for a specific auction server:
|
|
625
|
+
# hctl auction show 2919866
|
|
626
|
+
#
|
|
627
|
+
# Export filtered results as JSON for scripting:
|
|
628
|
+
# hctl auction list --max-price 60 --ecc --json | jq '.[].id'
|
|
629
|
+
#
|
|
630
|
+
# Check freshness before an agent relies on auction data:
|
|
631
|
+
# hctl auction status --json
|
|
632
|
+
#
|
|
633
|
+
# Bypass the hosted cache:
|
|
634
|
+
# hctl auction list --direct --max-price 60
|
|
635
|
+
#
|
|
636
|
+
# Compare EUR vs USD pricing:
|
|
637
|
+
# hctl auction list --currency USD --max-price 50`;
|
|
638
|
+
const POSTAMBLE = `\
|
|
639
|
+
# ============================================================================
|
|
640
|
+
# CONFIGURATION FILES
|
|
641
|
+
# ============================================================================
|
|
642
|
+
# ~/.hctl/config.json Robot API credentials (file-based fallback)
|
|
643
|
+
# ~/.hctl/cloud-contexts.json Cloud API contexts and tokens
|
|
644
|
+
#
|
|
645
|
+
# System keychain (via keytar): Robot API credentials (preferred, secure)
|
|
646
|
+
# Service name: "hctl"
|
|
647
|
+
# Account key: "robot-api"
|
|
648
|
+
#
|
|
649
|
+
# Environment variables:
|
|
650
|
+
# HETZNER_ROBOT_USER Robot API username
|
|
651
|
+
# HETZNER_ROBOT_PASSWORD Robot API password
|
|
652
|
+
# HETZNER_CLOUD_TOKEN Cloud API token (overrides context)
|
|
653
|
+
# HCTL_AUCTION_SOURCE Set to "direct" to bypass hosted auction cache
|
|
654
|
+
# HCTL_AUCTION_CACHE_URL Override hosted auction cache base URL
|
|
655
|
+
|
|
656
|
+
# ============================================================================
|
|
657
|
+
# PROGRAMMATIC (LIBRARY) USAGE
|
|
658
|
+
# ============================================================================
|
|
659
|
+
# This package can also be imported as a Node.js/TypeScript library:
|
|
660
|
+
#
|
|
661
|
+
# import { HetznerRobotClient } from '@rollupdate/hctl';
|
|
662
|
+
# import { fetchAuctionData, fetchAuctionServers, filterAuctionServers, sortAuctionServers } from '@rollupdate/hctl';
|
|
663
|
+
#
|
|
664
|
+
# Robot Client:
|
|
665
|
+
# const client = new HetznerRobotClient(username, password);
|
|
666
|
+
# const servers = await client.listServers();
|
|
667
|
+
# const details = await client.getServer(123456);
|
|
668
|
+
# await client.resetServer(123456, 'sw');
|
|
669
|
+
#
|
|
670
|
+
# Auction Client (no auth):
|
|
671
|
+
# const { data, metadata } = await fetchAuctionData('EUR');
|
|
672
|
+
# const { server: servers } = data;
|
|
673
|
+
# console.log(metadata.updatedAt, metadata.ageSeconds, metadata.source);
|
|
674
|
+
# const filtered = filterAuctionServers(servers, { maxPrice: 50, ecc: true });
|
|
675
|
+
# const sorted = sortAuctionServers(filtered, 'price', false);`;
|
|
676
|
+
const SECTIONS = {
|
|
677
|
+
robot: SECTION_ROBOT,
|
|
678
|
+
cloud: SECTION_CLOUD,
|
|
679
|
+
auction: SECTION_AUCTION,
|
|
680
|
+
};
|
|
681
|
+
export function generateReference(section, options = {}) {
|
|
682
|
+
const preamble = `${createPreamble(options.version ?? packageVersion)}\n${AUTHENTICATION}`;
|
|
683
|
+
if (section) {
|
|
684
|
+
const body = SECTIONS[section];
|
|
685
|
+
return `${preamble}\n\n${body}`;
|
|
686
|
+
}
|
|
687
|
+
return `${preamble}\n\n${SECTION_ROBOT}\n\n${SECTION_CLOUD}\n\n${SECTION_AUCTION}\n\n${POSTAMBLE}`;
|
|
688
|
+
}
|