hactl 0.9.0 → 0.10.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/README.md +70 -10
- package/dist/cli.js +1927 -730
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# hactl
|
|
2
2
|
|
|
3
|
-
Manage Home Assistant instances from the command line.
|
|
3
|
+
Manage Home Assistant instances from the command line. Designed for AI agents and for
|
|
4
|
+
running commands directly, with machine-readable results and built-in help.
|
|
4
5
|
|
|
5
6
|
## Install
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
The standalone binary does not require Node.js. It is available for macOS (Apple silicon)
|
|
9
|
+
and Linux (x64 and arm64; requires libatomic, packaged as `libatomic1` on Debian and Ubuntu).
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
12
|
curl -fsSL https://raw.githubusercontent.com/houfio/hactl/main/install.sh | sh
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
The installer checks the download against the SHA-256 digest published by GitHub and installs
|
|
16
|
+
to `~/.local/bin` by default. Add that directory to your `PATH` if needed.
|
|
17
|
+
Set `HACTL_INSTALL_DIR` on the `sh` side of the pipe to install elsewhere, or set
|
|
18
|
+
`HACTL_VERSION` there to install a specific release (for example, `| HACTL_VERSION=0.9.0 sh`).
|
|
19
|
+
To update the standalone binary, run `hactl upgrade`.
|
|
14
20
|
|
|
15
21
|
To check that a binary was built by this repository's release workflow, use the GitHub CLI:
|
|
16
22
|
|
|
@@ -18,26 +24,80 @@ To check that a binary was built by this repository's release workflow, use the
|
|
|
18
24
|
gh attestation verify ~/.local/bin/hactl --repo houfio/hactl
|
|
19
25
|
```
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
On macOS or Linux with Node.js 26 or later, you can install from npm instead. Use the
|
|
28
|
+
same npm command to update it; `hactl upgrade` only updates standalone release binaries.
|
|
22
29
|
|
|
23
30
|
```bash
|
|
24
31
|
npm install -g hactl@latest
|
|
25
32
|
```
|
|
26
33
|
|
|
27
|
-
##
|
|
34
|
+
## Quick start
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
Create a long-lived access token in your Home Assistant profile. Use an admin user's token
|
|
37
|
+
if you want to read logs or check the YAML configuration. For the keychain setup below,
|
|
38
|
+
Linux needs a running Secret Service and `secret-tool` (`libsecret-tools` on Debian and Ubuntu).
|
|
39
|
+
|
|
40
|
+
Create a named connection profile (context), paste the token at the hidden prompt, then
|
|
41
|
+
select and verify the context:
|
|
30
42
|
|
|
31
43
|
```bash
|
|
32
44
|
hactl ctx set home --url https://ha.example.ts.net --install haos
|
|
33
45
|
hactl ctx token-set home
|
|
34
46
|
hactl ctx use home
|
|
47
|
+
hactl ctx verify
|
|
48
|
+
```
|
|
35
49
|
|
|
36
|
-
|
|
50
|
+
Replace the example URL with your own. For a Home Assistant Container installation, use
|
|
51
|
+
`--install docker --container <name>` instead of `--install haos`.
|
|
52
|
+
A non-empty `HACTL_CONTEXT` takes precedence over the nearest `.hactl.json`, which can override
|
|
53
|
+
the global choice. Use `hactl ctx list` to see the active context and how it was selected.
|
|
54
|
+
|
|
55
|
+
`ctx verify` checks the HTTP connection and install type, WebSocket authentication, and SSH
|
|
56
|
+
if configured. Use `overview` for the instance's version, state, and resource counts.
|
|
57
|
+
Use `search` to find resource IDs and pass an ID to `related` to see its relationships.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
hactl overview
|
|
61
|
+
hactl search kitchen --type entity
|
|
62
|
+
hactl related entity light.kitchen
|
|
63
|
+
hactl get entities --domain light --limit 5
|
|
37
64
|
hactl query todo.get_items --entity todo.shopping
|
|
38
65
|
hactl template "{{ states('light.kitchen') }}"
|
|
39
|
-
hactl call light.turn_on --entity light.kitchen
|
|
40
|
-
|
|
66
|
+
hactl call light.turn_on --entity light.kitchen --dry-run
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Replace the example entity IDs with ones from your instance. `call --dry-run` previews
|
|
70
|
+
targets without running the service. `query` runs only services that Home Assistant marks
|
|
71
|
+
as requiring a response; whether a service makes changes depends on its integration.
|
|
72
|
+
Results are JSON, except logs and string results from templates, which are plain text.
|
|
73
|
+
|
|
74
|
+
### Troubleshoot
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
hactl get integrations --status setup_error
|
|
78
|
+
hactl get repairs --severity critical
|
|
79
|
+
hactl diagnose
|
|
80
|
+
hactl check
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`get integrations` lists config entries; `get repairs` lists issues reported by Repairs.
|
|
84
|
+
`diagnose` summarizes instance health, or accepts an entity ID, `--device` or `--integration`
|
|
85
|
+
for a targeted bundle. `check` validates YAML without applying it. To stream Core logs,
|
|
86
|
+
run `hactl logs --follow` and press Ctrl+C to stop.
|
|
87
|
+
|
|
88
|
+
### Headless runs
|
|
89
|
+
|
|
90
|
+
Create the context with `hactl ctx set` first. Instead of `ctx token-set` and `ctx use`,
|
|
91
|
+
provide the context name and token through the environment. A non-empty `HACTL_TOKEN`
|
|
92
|
+
applies only to the context named by `HACTL_CONTEXT` and bypasses the keychain for that
|
|
93
|
+
context. In CI, inject the token from the secret store rather than putting it in a script;
|
|
94
|
+
anything that can read the process environment can read the token.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
export HACTL_CONTEXT=home
|
|
98
|
+
export HACTL_TOKEN="$HA_TOKEN" # HA_TOKEN is supplied by the secret store.
|
|
99
|
+
|
|
100
|
+
hactl get entities --domain light
|
|
41
101
|
```
|
|
42
102
|
|
|
43
|
-
|
|
103
|
+
Start with `hactl --help`, or add `--help` to any command or command group for details.
|