wraith-cli 1.0.0__py3-none-any.whl
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.
wraith_cli/__init__.py
ADDED
|
File without changes
|
wraith_cli/main.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import subprocess
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import requests
|
|
6
|
+
import typer
|
|
7
|
+
from dotenv import load_dotenv
|
|
8
|
+
|
|
9
|
+
load_dotenv()
|
|
10
|
+
|
|
11
|
+
app = typer.Typer(help="Wraith Sovereign CLI", rich_markup_mode="rich")
|
|
12
|
+
|
|
13
|
+
# --- Sanitised Configuration ---
|
|
14
|
+
VIKING_URL = os.getenv("VIKING_BASE_URL", "http://127.0.0.1:1933/api/v1")
|
|
15
|
+
VIKING_URL = VIKING_URL.rstrip("/")
|
|
16
|
+
GITEA_PATH = os.getenv("GITEA_COMPOSE_PATH")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@app.command()
|
|
20
|
+
def status():
|
|
21
|
+
"""Check the heartbeat of the OpenViking Stack."""
|
|
22
|
+
url = f"{VIKING_URL}/health"
|
|
23
|
+
try:
|
|
24
|
+
response = requests.get(url, timeout=3)
|
|
25
|
+
if response.status_code == 200:
|
|
26
|
+
typer.secho("🟢 OpenViking: Online", fg=typer.colors.GREEN)
|
|
27
|
+
else:
|
|
28
|
+
typer.secho(
|
|
29
|
+
f"🟡 OpenViking: Warning ({response.status_code})",
|
|
30
|
+
fg=typer.colors.YELLOW,
|
|
31
|
+
)
|
|
32
|
+
except Exception:
|
|
33
|
+
# Reverted to match your test expectations: " OpenViking: Offline"
|
|
34
|
+
typer.secho("🔴 OpenViking: Offline", fg=typer.colors.RED)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@app.command()
|
|
38
|
+
def ps(
|
|
39
|
+
simple: bool = typer.Option(False, "--simple", "-s"),
|
|
40
|
+
all: bool = typer.Option(False, "--all", "-a"),
|
|
41
|
+
):
|
|
42
|
+
"""View Docker process list."""
|
|
43
|
+
cmd = ["docker", "ps"]
|
|
44
|
+
if all:
|
|
45
|
+
cmd.append("-a")
|
|
46
|
+
|
|
47
|
+
if simple:
|
|
48
|
+
# Multi-line string to satisfy Ruff E501
|
|
49
|
+
fmt = (
|
|
50
|
+
"table {{.Names}}\t{{.Status}}\t"
|
|
51
|
+
'{{.Label "com.docker.compose.project"}}'
|
|
52
|
+
)
|
|
53
|
+
else:
|
|
54
|
+
fmt = "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"
|
|
55
|
+
|
|
56
|
+
cmd.extend(["--format", fmt])
|
|
57
|
+
subprocess.run(cmd)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@app.command()
|
|
61
|
+
def runner_reset():
|
|
62
|
+
"""Resets the Gitea Action Runner."""
|
|
63
|
+
if not GITEA_PATH:
|
|
64
|
+
msg = "❌ Error: GITEA_COMPOSE_PATH not set in .env"
|
|
65
|
+
typer.secho(msg, fg=typer.colors.RED)
|
|
66
|
+
raise typer.Exit(1)
|
|
67
|
+
|
|
68
|
+
compose_path = Path(GITEA_PATH)
|
|
69
|
+
docker_file = compose_path / "docker-compose.yml"
|
|
70
|
+
runner_data = compose_path / "data/act_runner/.runner"
|
|
71
|
+
|
|
72
|
+
if not docker_file.exists():
|
|
73
|
+
typer.secho(f"❌ Compose file not found at: {docker_file}", fg="red")
|
|
74
|
+
raise typer.Exit(1)
|
|
75
|
+
|
|
76
|
+
typer.echo("👻 Wraith-CLI: Killing Gitea Runner...")
|
|
77
|
+
subprocess.run(["docker", "compose", "-f", str(docker_file), "stop"])
|
|
78
|
+
|
|
79
|
+
if runner_data.exists():
|
|
80
|
+
typer.echo(f"🧹 Wiping registration: {runner_data}")
|
|
81
|
+
subprocess.run(["sudo", "rm", "-f", str(runner_data)])
|
|
82
|
+
|
|
83
|
+
typer.echo("🚀 Restarting Runner...")
|
|
84
|
+
subprocess.run(["docker", "compose", "-f", str(docker_file), "up", "-d"])
|
|
85
|
+
typer.secho("✅ Runner state reset.", fg=typer.colors.GREEN, bold=True)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == "__main__":
|
|
89
|
+
app()
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wraith-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Sovereign Command Centre for a Ghost Stack
|
|
5
|
+
Project-URL: Homepage, https://git.thomaspeoples.com/thomaspeoples/wraith-cli
|
|
6
|
+
Project-URL: Documentation, https://www.thomaspeoples.com/gitea-repos/wraith-cli/
|
|
7
|
+
Project-URL: Repository, https://git.thomaspeoples.com/thomaspeoples/wraith-cli.git
|
|
8
|
+
Project-URL: Issues, https://git.thomaspeoples.com/thomaspeoples/wraith-cli/issues
|
|
9
|
+
Author-email: Thomas Peoples <junk@thomaspeoples.com>
|
|
10
|
+
License: Copyright © `2026` `Thomas Peoples`
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person
|
|
13
|
+
obtaining a copy of this software and associated documentation
|
|
14
|
+
files (the “Software”), to deal in the Software without
|
|
15
|
+
restriction, including without limitation the rights to use,
|
|
16
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the
|
|
18
|
+
Software is furnished to do so, subject to the following
|
|
19
|
+
conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be
|
|
22
|
+
included in all copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Keywords: automation,cli,ghost-stack,gitea,sovereign
|
|
27
|
+
Classifier: Environment :: Console
|
|
28
|
+
Classifier: Intended Audience :: System Administrators
|
|
29
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
30
|
+
Classifier: Operating System :: OS Independent
|
|
31
|
+
Classifier: Programming Language :: Python :: 3
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
34
|
+
Requires-Python: >=3.12
|
|
35
|
+
Requires-Dist: python-dotenv
|
|
36
|
+
Requires-Dist: requests
|
|
37
|
+
Requires-Dist: rich>=13.0.0
|
|
38
|
+
Requires-Dist: typer>=0.9.0
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: commitizen; extra == 'dev'
|
|
41
|
+
Requires-Dist: genbadge[coverage]>=1.1.1; extra == 'dev'
|
|
42
|
+
Requires-Dist: mkdocs-material>=9.5.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: mkdocs>=1.6.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
45
|
+
Requires-Dist: pymdown-extensions>=10.7.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
48
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+
[](https://www.thomaspeoples.com/gitea-repos/wraith-cli/)
|
|
52
|
+

|
|
53
|
+

|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# 👻 Wraith-CLI
|
|
58
|
+
### *Sovereign Orchestration for the Ghost Stack*
|
|
59
|
+
|
|
60
|
+
**Wraith-CLI** is the nervous system of the Ghost Stack. It bridges the gap between high-level containers and bare-metal reality.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🚀 Installation
|
|
65
|
+
|
|
66
|
+
**Wraith-CLI** can be installed via `uv` (recommended) or `pip`:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Recommended for CLI tools
|
|
70
|
+
uv tool install wraith-cli
|
|
71
|
+
|
|
72
|
+
# Standard pip
|
|
73
|
+
pip install wraith-cli
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> **Note:** Ensure ~/.local/bin is in your $PATH.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 🛠️ Operational Manual
|
|
81
|
+
|
|
82
|
+
| Command | Description |
|
|
83
|
+
| :--- | :--- |
|
|
84
|
+
| wraith ps | Shows all Docker processes in a neat table |
|
|
85
|
+
| wraith status | Heartbeat check for OpenViking (Port 1933). |
|
|
86
|
+
| wraith runner-reset | Wipes and re-registers the Gitea Action Runner. |
|
|
87
|
+
| wraith --help | View the full manifest of available commands. |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 🏗️ Developer Workspace
|
|
92
|
+
|
|
93
|
+
We use uv for hermetic environment management.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
### 1. Initialise the Environment
|
|
97
|
+
uv sync --all-extras
|
|
98
|
+
uv run pre-commit install
|
|
99
|
+
|
|
100
|
+
### 2. The Quality Gate
|
|
101
|
+
uv run pytest
|
|
102
|
+
|
|
103
|
+
### 3. Sovereign Deployment
|
|
104
|
+
chmod +x bin/build.sh
|
|
105
|
+
./bin/build.sh
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 🔐 Environment Configuration
|
|
111
|
+
|
|
112
|
+
Defined in `~/.bashrc` or `.env.private`:
|
|
113
|
+
|
|
114
|
+
| Variable | Purpose | Default |
|
|
115
|
+
| :--- | :--- | :--- |
|
|
116
|
+
| VIKING_BASE_URL | The API endpoint for the heartbeat check. | http://127.0.0.1:1933/api/v1 |
|
|
117
|
+
| GITEA_COMPOSE_PATH | Path to your Gitea Docker Compose directory. | Required for runner-reset |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 📜 Sovereign Principles
|
|
122
|
+
1. **Distributed Sovereignty:** Available on PyPI for the world, but optimised for local-first, private-registry mirrors
|
|
123
|
+
2. **Atomic Execution:** Use uv run to ensure consistency.
|
|
124
|
+
3. **Hardware First:** Prioritise bare-metal health and container stability.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
wraith_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
wraith_cli/main.py,sha256=y2DfWXsy9COp-XGPLHrTg4iv1GIkohzQt-NaK7RTPy0,2637
|
|
3
|
+
wraith_cli-1.0.0.dist-info/METADATA,sha256=Dzx-kaqns0FstFXP9yO19fST3a9IzNeEeuFz3FLZEOY,4746
|
|
4
|
+
wraith_cli-1.0.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
5
|
+
wraith_cli-1.0.0.dist-info/entry_points.txt,sha256=EkRBpiOXRX2gjMnWP9OVUryXUbW293ZUv7dQ0oTa1QQ,47
|
|
6
|
+
wraith_cli-1.0.0.dist-info/licenses/LICENSE,sha256=_F3WuwINEfCmsuq52tuGSIV955rgS05wv4ALwFVFOYc,1070
|
|
7
|
+
wraith_cli-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Copyright © `2026` `Thomas Peoples`
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the “Software”), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|