hookstride-cli 0.2.0__tar.gz

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.
@@ -0,0 +1,14 @@
1
+ .env
2
+ .venv/
3
+ __pycache__/
4
+ *.py[cod]
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .coverage
8
+ htmlcov/
9
+ db.sqlite3
10
+ staticfiles/*
11
+ !staticfiles/.gitkeep
12
+ .DS_Store
13
+ .idea/
14
+ .vscode/
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.5
2
+ Name: hookstride-cli
3
+ Version: 0.2.0
4
+ Summary: Readable, project-scoped Hookstride Control API terminal client.
5
+ License: Proprietary
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: click<9,>=8.1
8
+ Requires-Dist: httpx<1,>=0.28
9
+ Requires-Dist: prompt-toolkit<4,>=3.0.52
10
+ Requires-Dist: rich<15,>=14
11
+ Requires-Dist: typer<1,>=0.20
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Hookstride CLI
15
+
16
+ A fast, colorful, read-only terminal for the Hookstride Control API. Inspired by the clarity of tools like Nmap, it keeps ordinary REST responses unchanged for apps and integrations.
17
+
18
+ ## Install
19
+
20
+ Once the first package release is available on PyPI, install with:
21
+
22
+ ```bash
23
+ uv tool install hookstride-cli
24
+ hookstride --version
25
+ hookstride console
26
+ ```
27
+
28
+ Alternative: `pipx install hookstride-cli`. Update with `uv tool upgrade hookstride-cli`.
29
+ Requires Python 3.11 or newer. No checkout or Django backend installation is needed.
30
+
31
+ ## Authentication
32
+
33
+ In the Hookstride dashboard, generate an MFA-verified **Control API / Management token**, beginning with `whrctl_`. Do **not** use a `whrk_` delivery API key, and never paste a token directly into commands or issue comments.
34
+
35
+ The CLI reads `HOOKSTRIDE_CONTROL_TOKEN` from your current shell; it **does not persist tokens** on disk. For a Bash/Zsh terminal, paste interactively without writing the token in your command history:
36
+
37
+ ```bash
38
+ printf "Control token: "
39
+ read -rs HOOKSTRIDE_CONTROL_TOKEN
40
+ printf "\\n"
41
+ export HOOKSTRIDE_CONTROL_TOKEN
42
+
43
+ hookstride auth status
44
+ ```
45
+
46
+ The token may remain in your shell environment until you run `unset HOOKSTRIDE_CONTROL_TOKEN`. Environment values may be inspectable by processes with the appropriate local privileges; use an ephemeral, limited-life management token. Avoid recording terminal sessions while entering secrets.
47
+
48
+ ## Explore development
49
+
50
+ ```bash
51
+ hookstride status
52
+ hookstride auth status
53
+ hookstride projects list
54
+ hookstride projects use 00000000-0000-0000-0000-000000000000
55
+
56
+ hookstride destinations list
57
+ hookstride keys list
58
+ hookstride incoming sources
59
+ hookstride incoming routes
60
+ hookstride incoming bindings
61
+ hookstride incoming registration-keys
62
+ hookstride events list --status failed
63
+ hookstride events show 00000000-0000-0000-0000-000000000000
64
+ hookstride stats
65
+ hookstride billing status
66
+ hookstride billing history
67
+ hookstride config show
68
+ ```
69
+
70
+ Replace the sample UUIDs with your own project/event IDs.
71
+
72
+ The CLI starts on `https://api-dev.hookstride.voteeasy.net`. Use `--env production` (before the command) to target `https://api.hookstride.voteeasy.net`; configure each environment with its own corresponding Control token. The apex `https://hookstride.voteeasy.net` serves the frontend. You can also use `--api-url https://your-api-host` for a custom origin, or HTTP on loopback for local testing.
73
+
74
+ **Project selection is environment-specific.** The only persisted data is a project UUID in `~/.config/hookstride/settings.json`, owner-readable; not your credentials. Override temporarily with `--project PROJECT_UUID`.
75
+
76
+ ## Development checks
77
+
78
+ When the GitHub Actions runner is unavailable, run the **same** CLI tests locally
79
+ without sending anything to the live Hookstride API:
80
+
81
+ ```bash
82
+ bash cli/scripts/check.sh
83
+ ```
84
+
85
+ This checks Python syntax, Ruff, isolated unit tests using mocked HTTP responses,
86
+ and basic commands. A successful local run is not a substitute for a live
87
+ read-only smoke test against the deployed development API.
88
+
89
+ Tables use compact, borderless columns. Identifiers and long URLs are shortened
90
+ only when necessary to fit the terminal; the actual API response is not changed.
91
+ Use `--json` to copy complete project IDs, payment references and destination URLs.
92
+
93
+ ## Interactive operator console (v0.2)
94
+
95
+ Start a lightweight, Metasploit-inspired, **read-only** interactive console:
96
+
97
+ ```bash
98
+ hookstride console
99
+ ```
100
+
101
+ The shell starts on the **development API** by default. Enter `help` for
102
+ available commands, use Tab for completion, Ctrl+C to cancel the current line,
103
+ and Ctrl+D or `exit` to close the console.
104
+
105
+ ```text
106
+ HOOKSTRIDE CONSOLE v0.2
107
+ hookstride [dev] > auth login
108
+ Control token (hidden):
109
+ ✓ Authenticated as developer@example.com
110
+ hookstride [dev] > show projects
111
+ Projects
112
+ ========
113
+ Name Workspace Role Plan Project ID
114
+ ---------- ------------ ----- ------ ------------------------------------
115
+ Production Beta Testing owner flex ddc21845-d0f1-49af-8d35-2719dc641f69
116
+
117
+ hookstride [dev] > use ddc21845-d0f1-49af-8d35-2719dc641f69
118
+ hookstride [dev:ddc21845] > show payments
119
+ hookstride [dev:ddc21845] > events list --status failed
120
+ hookstride [dev:ddc21845] > show destinations
121
+ hookstride [dev:ddc21845] > json events list
122
+ hookstride [dev:ddc21845] > back
123
+ hookstride [dev] > exit
124
+ ```
125
+
126
+ This console accepts the existing read-only CLI commands, plus convenient
127
+ `show` aliases, `set env dev|production`, `use UUID`,
128
+ `back`, `clear`, `history`, and `auth login|logout`.
129
+ `projects use UUID` and `use UUID` persist only the active project's UUID
130
+ in local settings. The console does not support a shell escape, external
131
+ processes, POST/DELETE operations, or purchases.
132
+
133
+ ### Token handling
134
+
135
+ `auth login` securely prompts for a Control API token via hidden input. Tokens
136
+ are kept **in memory for this console process only**, are discarded at exit,
137
+ are never written to a config or history file, and are never echoed. The
138
+ console stores only a **safe subset** of commands in volatile arrow-key history;
139
+ it never records tokens or arbitrary query/search strings.
140
+
141
+ You may also provide an existing token through environment variables:
142
+
143
+ ```bash
144
+ # Use a development token with the default development console
145
+ export HOOKSTRIDE_DEV_CONTROL_TOKEN="…" # do not put real secrets in shell history
146
+ hookstride console
147
+
148
+ # To start directly against production, explicitly select it
149
+ hookstride --env production console
150
+ ```
151
+
152
+ For safest handling, prefer `auth login` over typing tokens in shell commands.
153
+ For interactive environment changes, the generic legacy
154
+ `HOOKSTRIDE_CONTROL_TOKEN` is **never forwarded to another environment**.
155
+ Use `auth login` separately after `set env production`, or provide a
156
+ matching `HOOKSTRIDE_PRODUCTION_CONTROL_TOKEN` token. This prevents a dev
157
+ token from accidentally being sent to the production API.
158
+
159
+ The console requires a real interactive terminal and refuses `--json console`.
160
+ For CI and scripting, use ordinary commands such as
161
+ `hookstride --json events list` instead.
162
+
163
+ ## Output for scripts
164
+
165
+ Pass `--json` **before** the command:
166
+
167
+ ```bash
168
+ hookstride --json projects list | jq .
169
+ hookstride --json events list --status failed | jq '.results'
170
+ hookstride --env production --json billing history
171
+ ```
172
+
173
+ The raw structured response is printed to stdout without terminal formatting. Network and HTTP errors go to stderr and cause a nonzero exit status.
174
+
175
+ ## Scope
176
+
177
+ Version 0.2 includes interactive access to project, destination, incoming-source, delivery-stat, activity and billing **reads**. It does not yet create destinations, emit events, replay events, rotate credentials, or trigger payments. Those workflows require additional confirmation and integration tests before exposing them in a CLI. Server-side authorization, project scoping, and response redaction remain enforced by the Control API.
178
+
179
+ Do not store passwords, signing secrets, private keys, or Paystack keys in Hookstride CLI configuration.
@@ -0,0 +1,166 @@
1
+ # Hookstride CLI
2
+
3
+ A fast, colorful, read-only terminal for the Hookstride Control API. Inspired by the clarity of tools like Nmap, it keeps ordinary REST responses unchanged for apps and integrations.
4
+
5
+ ## Install
6
+
7
+ Once the first package release is available on PyPI, install with:
8
+
9
+ ```bash
10
+ uv tool install hookstride-cli
11
+ hookstride --version
12
+ hookstride console
13
+ ```
14
+
15
+ Alternative: `pipx install hookstride-cli`. Update with `uv tool upgrade hookstride-cli`.
16
+ Requires Python 3.11 or newer. No checkout or Django backend installation is needed.
17
+
18
+ ## Authentication
19
+
20
+ In the Hookstride dashboard, generate an MFA-verified **Control API / Management token**, beginning with `whrctl_`. Do **not** use a `whrk_` delivery API key, and never paste a token directly into commands or issue comments.
21
+
22
+ The CLI reads `HOOKSTRIDE_CONTROL_TOKEN` from your current shell; it **does not persist tokens** on disk. For a Bash/Zsh terminal, paste interactively without writing the token in your command history:
23
+
24
+ ```bash
25
+ printf "Control token: "
26
+ read -rs HOOKSTRIDE_CONTROL_TOKEN
27
+ printf "\\n"
28
+ export HOOKSTRIDE_CONTROL_TOKEN
29
+
30
+ hookstride auth status
31
+ ```
32
+
33
+ The token may remain in your shell environment until you run `unset HOOKSTRIDE_CONTROL_TOKEN`. Environment values may be inspectable by processes with the appropriate local privileges; use an ephemeral, limited-life management token. Avoid recording terminal sessions while entering secrets.
34
+
35
+ ## Explore development
36
+
37
+ ```bash
38
+ hookstride status
39
+ hookstride auth status
40
+ hookstride projects list
41
+ hookstride projects use 00000000-0000-0000-0000-000000000000
42
+
43
+ hookstride destinations list
44
+ hookstride keys list
45
+ hookstride incoming sources
46
+ hookstride incoming routes
47
+ hookstride incoming bindings
48
+ hookstride incoming registration-keys
49
+ hookstride events list --status failed
50
+ hookstride events show 00000000-0000-0000-0000-000000000000
51
+ hookstride stats
52
+ hookstride billing status
53
+ hookstride billing history
54
+ hookstride config show
55
+ ```
56
+
57
+ Replace the sample UUIDs with your own project/event IDs.
58
+
59
+ The CLI starts on `https://api-dev.hookstride.voteeasy.net`. Use `--env production` (before the command) to target `https://api.hookstride.voteeasy.net`; configure each environment with its own corresponding Control token. The apex `https://hookstride.voteeasy.net` serves the frontend. You can also use `--api-url https://your-api-host` for a custom origin, or HTTP on loopback for local testing.
60
+
61
+ **Project selection is environment-specific.** The only persisted data is a project UUID in `~/.config/hookstride/settings.json`, owner-readable; not your credentials. Override temporarily with `--project PROJECT_UUID`.
62
+
63
+ ## Development checks
64
+
65
+ When the GitHub Actions runner is unavailable, run the **same** CLI tests locally
66
+ without sending anything to the live Hookstride API:
67
+
68
+ ```bash
69
+ bash cli/scripts/check.sh
70
+ ```
71
+
72
+ This checks Python syntax, Ruff, isolated unit tests using mocked HTTP responses,
73
+ and basic commands. A successful local run is not a substitute for a live
74
+ read-only smoke test against the deployed development API.
75
+
76
+ Tables use compact, borderless columns. Identifiers and long URLs are shortened
77
+ only when necessary to fit the terminal; the actual API response is not changed.
78
+ Use `--json` to copy complete project IDs, payment references and destination URLs.
79
+
80
+ ## Interactive operator console (v0.2)
81
+
82
+ Start a lightweight, Metasploit-inspired, **read-only** interactive console:
83
+
84
+ ```bash
85
+ hookstride console
86
+ ```
87
+
88
+ The shell starts on the **development API** by default. Enter `help` for
89
+ available commands, use Tab for completion, Ctrl+C to cancel the current line,
90
+ and Ctrl+D or `exit` to close the console.
91
+
92
+ ```text
93
+ HOOKSTRIDE CONSOLE v0.2
94
+ hookstride [dev] > auth login
95
+ Control token (hidden):
96
+ ✓ Authenticated as developer@example.com
97
+ hookstride [dev] > show projects
98
+ Projects
99
+ ========
100
+ Name Workspace Role Plan Project ID
101
+ ---------- ------------ ----- ------ ------------------------------------
102
+ Production Beta Testing owner flex ddc21845-d0f1-49af-8d35-2719dc641f69
103
+
104
+ hookstride [dev] > use ddc21845-d0f1-49af-8d35-2719dc641f69
105
+ hookstride [dev:ddc21845] > show payments
106
+ hookstride [dev:ddc21845] > events list --status failed
107
+ hookstride [dev:ddc21845] > show destinations
108
+ hookstride [dev:ddc21845] > json events list
109
+ hookstride [dev:ddc21845] > back
110
+ hookstride [dev] > exit
111
+ ```
112
+
113
+ This console accepts the existing read-only CLI commands, plus convenient
114
+ `show` aliases, `set env dev|production`, `use UUID`,
115
+ `back`, `clear`, `history`, and `auth login|logout`.
116
+ `projects use UUID` and `use UUID` persist only the active project's UUID
117
+ in local settings. The console does not support a shell escape, external
118
+ processes, POST/DELETE operations, or purchases.
119
+
120
+ ### Token handling
121
+
122
+ `auth login` securely prompts for a Control API token via hidden input. Tokens
123
+ are kept **in memory for this console process only**, are discarded at exit,
124
+ are never written to a config or history file, and are never echoed. The
125
+ console stores only a **safe subset** of commands in volatile arrow-key history;
126
+ it never records tokens or arbitrary query/search strings.
127
+
128
+ You may also provide an existing token through environment variables:
129
+
130
+ ```bash
131
+ # Use a development token with the default development console
132
+ export HOOKSTRIDE_DEV_CONTROL_TOKEN="…" # do not put real secrets in shell history
133
+ hookstride console
134
+
135
+ # To start directly against production, explicitly select it
136
+ hookstride --env production console
137
+ ```
138
+
139
+ For safest handling, prefer `auth login` over typing tokens in shell commands.
140
+ For interactive environment changes, the generic legacy
141
+ `HOOKSTRIDE_CONTROL_TOKEN` is **never forwarded to another environment**.
142
+ Use `auth login` separately after `set env production`, or provide a
143
+ matching `HOOKSTRIDE_PRODUCTION_CONTROL_TOKEN` token. This prevents a dev
144
+ token from accidentally being sent to the production API.
145
+
146
+ The console requires a real interactive terminal and refuses `--json console`.
147
+ For CI and scripting, use ordinary commands such as
148
+ `hookstride --json events list` instead.
149
+
150
+ ## Output for scripts
151
+
152
+ Pass `--json` **before** the command:
153
+
154
+ ```bash
155
+ hookstride --json projects list | jq .
156
+ hookstride --json events list --status failed | jq '.results'
157
+ hookstride --env production --json billing history
158
+ ```
159
+
160
+ The raw structured response is printed to stdout without terminal formatting. Network and HTTP errors go to stderr and cause a nonzero exit status.
161
+
162
+ ## Scope
163
+
164
+ Version 0.2 includes interactive access to project, destination, incoming-source, delivery-stat, activity and billing **reads**. It does not yet create destinations, emit events, replay events, rotate credentials, or trigger payments. Those workflows require additional confirmation and integration tests before exposing them in a CLI. Server-side authorization, project scoping, and response redaction remain enforced by the Control API.
165
+
166
+ Do not store passwords, signing secrets, private keys, or Paystack keys in Hookstride CLI configuration.
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "hookstride-cli"
7
+ version = "0.2.0"
8
+ description = "Readable, project-scoped Hookstride Control API terminal client."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "Proprietary" }
12
+ dependencies = [
13
+ "click>=8.1,<9",
14
+ "httpx>=0.28,<1",
15
+ "prompt-toolkit>=3.0.52,<4",
16
+ "rich>=14,<15",
17
+ "typer>=0.20,<1",
18
+ ]
19
+
20
+ [project.scripts]
21
+ hookstride = "hookstride_cli.main:main"
22
+
23
+ [dependency-groups]
24
+ dev = [
25
+ "pytest>=8.4,<10",
26
+ "ruff>=0.12,<1",
27
+ ]
28
+
29
+ [tool.hatch.build.targets.wheel]
30
+ packages = ["src/hookstride_cli"]
31
+
32
+ [tool.ruff]
33
+ target-version = "py311"
34
+ line-length = 100
35
+
36
+ [tool.ruff.lint]
37
+ select = ["E", "F", "I", "UP", "B", "SIM"]
38
+ # Typer uses Option/Argument as intentional function defaults; long CLI lines
39
+ # are formatted where practical without enforcing an arbitrary terminal width.
40
+ ignore = ["B008", "E501"]
41
+
42
+ [tool.pytest.ini_options]
43
+ testpaths = ["tests"]
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ # Local CLI validation, independent of GitHub Actions runner availability.
3
+ set -euo pipefail
4
+
5
+ cd "$(dirname "${BASH_SOURCE[0]}")/../.."
6
+
7
+ echo "[1/5] Install/sync isolated CLI test dependencies"
8
+ uv sync --project cli --group dev
9
+
10
+ echo "[2/5] Static Python syntax check"
11
+ uv run --project cli python -m compileall -q cli/src cli/tests
12
+
13
+ echo "[3/5] Lint"
14
+ uv run --project cli ruff check cli/src cli/tests
15
+
16
+ echo "[4/5] Offline, mock-network tests (no live tokens)"
17
+ uv run --project cli pytest -c cli/pyproject.toml -q cli/tests
18
+
19
+ echo "[5/5] Command smoke tests"
20
+ uv run --project cli hookstride --version
21
+ uv run --project cli hookstride --help >/dev/null
22
+ uv run --project cli hookstride console --help >/dev/null
23
+ uv run --project cli hookstride --json config show
24
+
25
+ echo "CLI checks passed. No live account or payment data was modified."
@@ -0,0 +1,3 @@
1
+ """Hookstride developer CLI."""
2
+
3
+ __version__ = "0.2.0"