sagex-cli 1.0.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.
- sagex_cli-1.0.0/LICENSE +21 -0
- sagex_cli-1.0.0/PKG-INFO +210 -0
- sagex_cli-1.0.0/README.md +172 -0
- sagex_cli-1.0.0/pyproject.toml +86 -0
- sagex_cli-1.0.0/sagex/__init__.py +3 -0
- sagex_cli-1.0.0/sagex/__main__.py +2907 -0
- sagex_cli-1.0.0/sagex/_env.py +7 -0
- sagex_cli-1.0.0/sagex/api/__init__.py +3 -0
- sagex_cli-1.0.0/sagex/api/client.py +195 -0
- sagex_cli-1.0.0/sagex/api/resources.py +763 -0
- sagex_cli-1.0.0/sagex/api/store.py +52 -0
- sagex_cli-1.0.0/sagex/app.py +378 -0
- sagex_cli-1.0.0/sagex/app.tcss +63 -0
- sagex_cli-1.0.0/sagex/config.py +88 -0
- sagex_cli-1.0.0/sagex/copier.py +277 -0
- sagex_cli-1.0.0/sagex/formatting.py +126 -0
- sagex_cli-1.0.0/sagex/pusher.py +350 -0
- sagex_cli-1.0.0/sagex/render.py +1046 -0
- sagex_cli-1.0.0/sagex/runner.py +198 -0
- sagex_cli-1.0.0/sagex/runview.py +247 -0
- sagex_cli-1.0.0/sagex/shell.py +231 -0
- sagex_cli-1.0.0/sagex/widgets/__init__.py +1 -0
- sagex_cli-1.0.0/sagex/widgets/activity.py +56 -0
- sagex_cli-1.0.0/sagex/widgets/message.py +78 -0
- sagex_cli-1.0.0/sagex/widgets/prompt_input.py +54 -0
- sagex_cli-1.0.0/sagex/widgets/run_graph.py +58 -0
- sagex_cli-1.0.0/sagex_cli.egg-info/PKG-INFO +210 -0
- sagex_cli-1.0.0/sagex_cli.egg-info/SOURCES.txt +34 -0
- sagex_cli-1.0.0/sagex_cli.egg-info/dependency_links.txt +1 -0
- sagex_cli-1.0.0/sagex_cli.egg-info/entry_points.txt +2 -0
- sagex_cli-1.0.0/sagex_cli.egg-info/requires.txt +10 -0
- sagex_cli-1.0.0/sagex_cli.egg-info/top_level.txt +1 -0
- sagex_cli-1.0.0/setup.cfg +4 -0
- sagex_cli-1.0.0/setup.py +77 -0
- sagex_cli-1.0.0/tests/test_cli.py +123 -0
- sagex_cli-1.0.0/tests/test_tui.py +26 -0
sagex_cli-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lagnajit Moharana
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
sagex_cli-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sagex-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Autosage in your terminal: build, run and watch workflows, scripts, vaults and triggers from a TUI or one-shot commands.
|
|
5
|
+
Author: Lagnajit Moharana
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Lagnajit09/sagex
|
|
8
|
+
Project-URL: Documentation, https://autosagexdocs.web.app
|
|
9
|
+
Project-URL: Repository, https://github.com/Lagnajit09/sagex
|
|
10
|
+
Project-URL: Issues, https://github.com/Lagnajit09/sagex/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/Lagnajit09/sagex/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: autosage,sagex,automation,workflow,cli,tui,devops,ssh,winrm
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: System Administrators
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: textual<9,>=8.2.8
|
|
29
|
+
Requires-Dist: rich<16,>=15.0.0
|
|
30
|
+
Requires-Dist: httpx<0.29,>=0.28.1
|
|
31
|
+
Requires-Dist: keyring<26,>=25.7.0
|
|
32
|
+
Requires-Dist: typer<0.28,>=0.27.2
|
|
33
|
+
Requires-Dist: cron-descriptor<3,>=2.1.0
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: textual-dev==1.8.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# sagex
|
|
40
|
+
|
|
41
|
+
**Autosage in your terminal.** Build, run and watch your [Autosage](https://autosagex.web.app) workflows, scripts, vaults and triggers from a full-screen terminal app or one-shot commands. Everything the web app does, minus the mouse.
|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/sagex-cli/)
|
|
44
|
+
[](https://pypi.org/project/sagex-cli/)
|
|
45
|
+
[](https://github.com/Lagnajit09/sagex/blob/main/LICENSE)
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
$ sagex list workflow
|
|
49
|
+
┌──────────────────────┬──────────────────────────────────────┬──────────┐
|
|
50
|
+
│ name │ id │ modified │
|
|
51
|
+
├──────────────────────┼──────────────────────────────────────┼──────────┤
|
|
52
|
+
│ Nightly Disk Cleanup │ 46a2ba05-3bed-40b6-a967-2a3b0dc2b657 │ 2d ago │
|
|
53
|
+
│ Deploy │ 3ee4dd1f-8865-4144-bcec-5aaa36df0b30 │ 5d ago │
|
|
54
|
+
└──────────────────────┴──────────────────────────────────────┴──────────┘
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **Early access.** sagex is invite-only for now. Your account needs an API key: [request one here](https://autosagex.web.app/contact).
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
**macOS / Linux**
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
curl -LsSf https://raw.githubusercontent.com/Lagnajit09/sagex/main/scripts/install.sh | sh
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Windows (PowerShell)**
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
irm https://raw.githubusercontent.com/Lagnajit09/sagex/main/scripts/install.ps1 | iex
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The installer uses [uv](https://docs.astral.sh/uv/) to install sagex as an isolated tool, and fetches Python 3.11+ for you if needed. Set `SAGEX_VERSION=1.0.0` before running it to pin a version.
|
|
74
|
+
|
|
75
|
+
**Already have a Python tool manager?** Any of these works (Python 3.11 or newer):
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
uv tool install sagex-cli
|
|
79
|
+
pipx install sagex-cli
|
|
80
|
+
pip install sagex-cli
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Quick start
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
sagex auth login # paste your API key (stored in your OS keychain)
|
|
87
|
+
sagex # open the terminal app
|
|
88
|
+
sagex list workflow # or run single commands
|
|
89
|
+
sagex run workflow "Deploy" # run a workflow and follow it live, node by node
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## The terminal app
|
|
93
|
+
|
|
94
|
+
Run `sagex` with no arguments to open it.
|
|
95
|
+
|
|
96
|
+
- **Left:** your **Resources**: Workflows, Scripts, Vault, recent Runs (with ✓ / ✗ / ⟳ status) and Triggers (● on / ○ off). Press **F3** to switch to your local **Workspace** folder instead.
|
|
97
|
+
- **Right:** a terminal-style transcript. Start a line with `!` to run any command, such as `!sagex run workflow Deploy` or `!git status`. Output streams in live, and workflow runs draw a live node graph.
|
|
98
|
+
|
|
99
|
+
| Key | Action |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `!command` | Run a shell or sagex command |
|
|
102
|
+
| `Esc` | Stop the running command |
|
|
103
|
+
| `↑` / `↓` | Command history |
|
|
104
|
+
| `F2` | Switch shell (PowerShell / cmd / WSL on Windows, bash / sh elsewhere) |
|
|
105
|
+
| `F3` | Switch between server resources and the local workspace |
|
|
106
|
+
| `F5` | Refresh |
|
|
107
|
+
| `Ctrl+Q` | Quit |
|
|
108
|
+
|
|
109
|
+
Chatting with Autobot from the terminal is coming in **sagex v2**. Until then, use Autobot in the [web app](https://autosagex.web.app/ai/autobot).
|
|
110
|
+
|
|
111
|
+
## Commands
|
|
112
|
+
|
|
113
|
+
Resources can be referred to by **name or id**. An id prefix works for runs. Most read commands take `--json` for scripting. Run `sagex <group> --help` for every option.
|
|
114
|
+
|
|
115
|
+
| Group | Commands | What it does |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `auth` | `login` · `status` · `logout` | Store, check or remove your API key |
|
|
118
|
+
| `list` | `workflow` · `script` · `run` · `trigger` · `vault` · `server` · `key` | Compact tables of your resources |
|
|
119
|
+
| `show` | `workflow` · `script` · `run` · `trigger` · `vault` · `server` · `key` | One resource in detail; `show run --logs` prints node output, `show key --reveal` shows secrets after confirming |
|
|
120
|
+
| `render` | `workflow` | Draw a workflow as a flow tree (from the server, or a local file with `--file`) |
|
|
121
|
+
| `run` | `script` · `workflow` | Run now and stream output live. `Ctrl+C` stops it. Pass inputs with `-p NAME=VALUE` |
|
|
122
|
+
| `trigger` | `create` · `fire` · `poll` · `watch` · `invoke` · `enable` · `disable` · `regenerate` | HTTP webhooks and cron schedules: set up, fire, follow and rotate |
|
|
123
|
+
| `new` | `workflow` · `script` | Scaffold a local file, ready to edit |
|
|
124
|
+
| `push` | `workflow` · `script` | Create on the server from a local file, or update after confirming (scripts show a diff) |
|
|
125
|
+
| `copy` | `workflow` · `script` · `run` | Download to your workspace (`--all`, or `copy run --since 7days`) |
|
|
126
|
+
| `create` | `vault` · `server` · `key` | Create vault resources |
|
|
127
|
+
| `update` | `vault` · `server` · `key` | Change them, or rotate a key's secret |
|
|
128
|
+
| `rename` | `workflow` · `script` · `vault` · `server` · `key` | Rename in place |
|
|
129
|
+
| `delete` | `workflow` · `script` · `vault` · `server` · `key` · `trigger` | Delete, after confirming |
|
|
130
|
+
| `workspace` | `set` · `show` | Choose the local folder sagex reads from and writes to |
|
|
131
|
+
| `syntax` | `trigger` · `script` · `email` · `decision` · `edge` · `decision-edge` | Print a copy-paste JSON snippet for a workflow node or edge |
|
|
132
|
+
|
|
133
|
+
### A typical loop
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
sagex new script disk_check --lang shell # scripts/disk_check.sh
|
|
137
|
+
sagex push script disk_check # create it on the server
|
|
138
|
+
sagex run script disk_check.sh -s web-1 # run it on a vault server
|
|
139
|
+
|
|
140
|
+
sagex new workflow "Disk Check" # workflows/Disk_Check.json
|
|
141
|
+
sagex syntax script # snippet for an action node
|
|
142
|
+
sagex render workflow --file "Disk Check" # preview the flow locally
|
|
143
|
+
sagex push workflow "Disk Check"
|
|
144
|
+
sagex trigger create "Disk Check" -t schedule --cron "0 2 * * *"
|
|
145
|
+
sagex trigger watch "Disk Check" # wait for the next firing, then follow it
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Your workspace
|
|
149
|
+
|
|
150
|
+
sagex keeps local files in one folder: your **workspace**. It defaults to the current directory; set it with `sagex workspace set <path>`.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
workflows/ workflow JSON (sagex new / copy / push)
|
|
154
|
+
scripts/ script files (sagex new / copy / push)
|
|
155
|
+
runs/ run metadata + logs (sagex copy run)
|
|
156
|
+
logs/script/<id>/ saved by sagex run script
|
|
157
|
+
logs/workflow/<run_id>/ saved by sagex run workflow / trigger fire
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Security
|
|
161
|
+
|
|
162
|
+
- Your API key is stored in the **OS keychain** (Windows Credential Manager, macOS Keychain or Linux Secret Service), never in a plain file.
|
|
163
|
+
- Secrets are **never accepted as command-line flags**, so they never show up in shell history. Passwords, SSH keys and passphrases are typed at a hidden prompt or read from a file you point to.
|
|
164
|
+
- Vault credentials **can't be copied** to disk, and `show key` hides secret values unless you pass `--reveal` and confirm.
|
|
165
|
+
- An HTTP trigger's secret is shown **once**, when it's created or rotated.
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
| Setting | Purpose |
|
|
170
|
+
|---|---|
|
|
171
|
+
| `SAGEX_API_KEY` | Use this API key instead of the keychain. Useful for CI or machines without a keychain |
|
|
172
|
+
| `SAGEX_API_URL` | Point sagex at a different Autosage server |
|
|
173
|
+
| `SAGEX_DEBUG=1` | Add connection details to network errors |
|
|
174
|
+
| `~/.sagex/config.json` | Saved preferences (workspace, shell) |
|
|
175
|
+
|
|
176
|
+
## Update or uninstall
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
uv tool upgrade sagex-cli # or: pipx upgrade sagex-cli / pip install -U sagex-cli
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
To uninstall, run `sagex auth logout` first (it removes your key from the keychain), then `uv tool uninstall sagex-cli` (or `pipx uninstall` / `pip uninstall`).
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
git clone https://github.com/Lagnajit09/sagex && cd sagex
|
|
188
|
+
cp .env.example .env # then fill in the server URLs
|
|
189
|
+
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
190
|
+
pip install -e ".[dev]"
|
|
191
|
+
pytest
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`.env` holds build settings (server URLs). They're baked into the package when it's built, so they ship publicly: never put secrets there. After editing `.env`, re-run `pip install -e .`.
|
|
195
|
+
|
|
196
|
+
## Roadmap
|
|
197
|
+
|
|
198
|
+
- **v1.1:** see your sagex sessions on your Autosage profile.
|
|
199
|
+
- **v2:** Autobot in the terminal: chat, generate, run and fix, with your last command's output as context.
|
|
200
|
+
|
|
201
|
+
## Links
|
|
202
|
+
|
|
203
|
+
- Autosage: https://autosagex.web.app
|
|
204
|
+
- Documentation: https://autosagexdocs.web.app
|
|
205
|
+
- Issues: https://github.com/Lagnajit09/sagex/issues
|
|
206
|
+
- Changelog: https://github.com/Lagnajit09/sagex/blob/main/CHANGELOG.md
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
[MIT](https://github.com/Lagnajit09/sagex/blob/main/LICENSE)
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# sagex
|
|
2
|
+
|
|
3
|
+
**Autosage in your terminal.** Build, run and watch your [Autosage](https://autosagex.web.app) workflows, scripts, vaults and triggers from a full-screen terminal app or one-shot commands. Everything the web app does, minus the mouse.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/sagex-cli/)
|
|
6
|
+
[](https://pypi.org/project/sagex-cli/)
|
|
7
|
+
[](https://github.com/Lagnajit09/sagex/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ sagex list workflow
|
|
11
|
+
┌──────────────────────┬──────────────────────────────────────┬──────────┐
|
|
12
|
+
│ name │ id │ modified │
|
|
13
|
+
├──────────────────────┼──────────────────────────────────────┼──────────┤
|
|
14
|
+
│ Nightly Disk Cleanup │ 46a2ba05-3bed-40b6-a967-2a3b0dc2b657 │ 2d ago │
|
|
15
|
+
│ Deploy │ 3ee4dd1f-8865-4144-bcec-5aaa36df0b30 │ 5d ago │
|
|
16
|
+
└──────────────────────┴──────────────────────────────────────┴──────────┘
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> **Early access.** sagex is invite-only for now. Your account needs an API key: [request one here](https://autosagex.web.app/contact).
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
**macOS / Linux**
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
curl -LsSf https://raw.githubusercontent.com/Lagnajit09/sagex/main/scripts/install.sh | sh
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Windows (PowerShell)**
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
irm https://raw.githubusercontent.com/Lagnajit09/sagex/main/scripts/install.ps1 | iex
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The installer uses [uv](https://docs.astral.sh/uv/) to install sagex as an isolated tool, and fetches Python 3.11+ for you if needed. Set `SAGEX_VERSION=1.0.0` before running it to pin a version.
|
|
36
|
+
|
|
37
|
+
**Already have a Python tool manager?** Any of these works (Python 3.11 or newer):
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
uv tool install sagex-cli
|
|
41
|
+
pipx install sagex-cli
|
|
42
|
+
pip install sagex-cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
sagex auth login # paste your API key (stored in your OS keychain)
|
|
49
|
+
sagex # open the terminal app
|
|
50
|
+
sagex list workflow # or run single commands
|
|
51
|
+
sagex run workflow "Deploy" # run a workflow and follow it live, node by node
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## The terminal app
|
|
55
|
+
|
|
56
|
+
Run `sagex` with no arguments to open it.
|
|
57
|
+
|
|
58
|
+
- **Left:** your **Resources**: Workflows, Scripts, Vault, recent Runs (with ✓ / ✗ / ⟳ status) and Triggers (● on / ○ off). Press **F3** to switch to your local **Workspace** folder instead.
|
|
59
|
+
- **Right:** a terminal-style transcript. Start a line with `!` to run any command, such as `!sagex run workflow Deploy` or `!git status`. Output streams in live, and workflow runs draw a live node graph.
|
|
60
|
+
|
|
61
|
+
| Key | Action |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `!command` | Run a shell or sagex command |
|
|
64
|
+
| `Esc` | Stop the running command |
|
|
65
|
+
| `↑` / `↓` | Command history |
|
|
66
|
+
| `F2` | Switch shell (PowerShell / cmd / WSL on Windows, bash / sh elsewhere) |
|
|
67
|
+
| `F3` | Switch between server resources and the local workspace |
|
|
68
|
+
| `F5` | Refresh |
|
|
69
|
+
| `Ctrl+Q` | Quit |
|
|
70
|
+
|
|
71
|
+
Chatting with Autobot from the terminal is coming in **sagex v2**. Until then, use Autobot in the [web app](https://autosagex.web.app/ai/autobot).
|
|
72
|
+
|
|
73
|
+
## Commands
|
|
74
|
+
|
|
75
|
+
Resources can be referred to by **name or id**. An id prefix works for runs. Most read commands take `--json` for scripting. Run `sagex <group> --help` for every option.
|
|
76
|
+
|
|
77
|
+
| Group | Commands | What it does |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `auth` | `login` · `status` · `logout` | Store, check or remove your API key |
|
|
80
|
+
| `list` | `workflow` · `script` · `run` · `trigger` · `vault` · `server` · `key` | Compact tables of your resources |
|
|
81
|
+
| `show` | `workflow` · `script` · `run` · `trigger` · `vault` · `server` · `key` | One resource in detail; `show run --logs` prints node output, `show key --reveal` shows secrets after confirming |
|
|
82
|
+
| `render` | `workflow` | Draw a workflow as a flow tree (from the server, or a local file with `--file`) |
|
|
83
|
+
| `run` | `script` · `workflow` | Run now and stream output live. `Ctrl+C` stops it. Pass inputs with `-p NAME=VALUE` |
|
|
84
|
+
| `trigger` | `create` · `fire` · `poll` · `watch` · `invoke` · `enable` · `disable` · `regenerate` | HTTP webhooks and cron schedules: set up, fire, follow and rotate |
|
|
85
|
+
| `new` | `workflow` · `script` | Scaffold a local file, ready to edit |
|
|
86
|
+
| `push` | `workflow` · `script` | Create on the server from a local file, or update after confirming (scripts show a diff) |
|
|
87
|
+
| `copy` | `workflow` · `script` · `run` | Download to your workspace (`--all`, or `copy run --since 7days`) |
|
|
88
|
+
| `create` | `vault` · `server` · `key` | Create vault resources |
|
|
89
|
+
| `update` | `vault` · `server` · `key` | Change them, or rotate a key's secret |
|
|
90
|
+
| `rename` | `workflow` · `script` · `vault` · `server` · `key` | Rename in place |
|
|
91
|
+
| `delete` | `workflow` · `script` · `vault` · `server` · `key` · `trigger` | Delete, after confirming |
|
|
92
|
+
| `workspace` | `set` · `show` | Choose the local folder sagex reads from and writes to |
|
|
93
|
+
| `syntax` | `trigger` · `script` · `email` · `decision` · `edge` · `decision-edge` | Print a copy-paste JSON snippet for a workflow node or edge |
|
|
94
|
+
|
|
95
|
+
### A typical loop
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
sagex new script disk_check --lang shell # scripts/disk_check.sh
|
|
99
|
+
sagex push script disk_check # create it on the server
|
|
100
|
+
sagex run script disk_check.sh -s web-1 # run it on a vault server
|
|
101
|
+
|
|
102
|
+
sagex new workflow "Disk Check" # workflows/Disk_Check.json
|
|
103
|
+
sagex syntax script # snippet for an action node
|
|
104
|
+
sagex render workflow --file "Disk Check" # preview the flow locally
|
|
105
|
+
sagex push workflow "Disk Check"
|
|
106
|
+
sagex trigger create "Disk Check" -t schedule --cron "0 2 * * *"
|
|
107
|
+
sagex trigger watch "Disk Check" # wait for the next firing, then follow it
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Your workspace
|
|
111
|
+
|
|
112
|
+
sagex keeps local files in one folder: your **workspace**. It defaults to the current directory; set it with `sagex workspace set <path>`.
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
workflows/ workflow JSON (sagex new / copy / push)
|
|
116
|
+
scripts/ script files (sagex new / copy / push)
|
|
117
|
+
runs/ run metadata + logs (sagex copy run)
|
|
118
|
+
logs/script/<id>/ saved by sagex run script
|
|
119
|
+
logs/workflow/<run_id>/ saved by sagex run workflow / trigger fire
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Security
|
|
123
|
+
|
|
124
|
+
- Your API key is stored in the **OS keychain** (Windows Credential Manager, macOS Keychain or Linux Secret Service), never in a plain file.
|
|
125
|
+
- Secrets are **never accepted as command-line flags**, so they never show up in shell history. Passwords, SSH keys and passphrases are typed at a hidden prompt or read from a file you point to.
|
|
126
|
+
- Vault credentials **can't be copied** to disk, and `show key` hides secret values unless you pass `--reveal` and confirm.
|
|
127
|
+
- An HTTP trigger's secret is shown **once**, when it's created or rotated.
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
| Setting | Purpose |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `SAGEX_API_KEY` | Use this API key instead of the keychain. Useful for CI or machines without a keychain |
|
|
134
|
+
| `SAGEX_API_URL` | Point sagex at a different Autosage server |
|
|
135
|
+
| `SAGEX_DEBUG=1` | Add connection details to network errors |
|
|
136
|
+
| `~/.sagex/config.json` | Saved preferences (workspace, shell) |
|
|
137
|
+
|
|
138
|
+
## Update or uninstall
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
uv tool upgrade sagex-cli # or: pipx upgrade sagex-cli / pip install -U sagex-cli
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
To uninstall, run `sagex auth logout` first (it removes your key from the keychain), then `uv tool uninstall sagex-cli` (or `pipx uninstall` / `pip uninstall`).
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
git clone https://github.com/Lagnajit09/sagex && cd sagex
|
|
150
|
+
cp .env.example .env # then fill in the server URLs
|
|
151
|
+
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
152
|
+
pip install -e ".[dev]"
|
|
153
|
+
pytest
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`.env` holds build settings (server URLs). They're baked into the package when it's built, so they ship publicly: never put secrets there. After editing `.env`, re-run `pip install -e .`.
|
|
157
|
+
|
|
158
|
+
## Roadmap
|
|
159
|
+
|
|
160
|
+
- **v1.1:** see your sagex sessions on your Autosage profile.
|
|
161
|
+
- **v2:** Autobot in the terminal: chat, generate, run and fix, with your last command's output as context.
|
|
162
|
+
|
|
163
|
+
## Links
|
|
164
|
+
|
|
165
|
+
- Autosage: https://autosagex.web.app
|
|
166
|
+
- Documentation: https://autosagexdocs.web.app
|
|
167
|
+
- Issues: https://github.com/Lagnajit09/sagex/issues
|
|
168
|
+
- Changelog: https://github.com/Lagnajit09/sagex/blob/main/CHANGELOG.md
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
[MIT](https://github.com/Lagnajit09/sagex/blob/main/LICENSE)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Packaging for sagex-cli.
|
|
2
|
+
#
|
|
3
|
+
# pip install -e ".[dev]" -> editable dev install (source stays live)
|
|
4
|
+
# uv build -> sdist + wheel in dist/ (what the release workflow publishes)
|
|
5
|
+
# sagex -> the console command, from [project.scripts] below
|
|
6
|
+
|
|
7
|
+
[build-system]
|
|
8
|
+
# >=77 for PEP 639 `license` / `license-files` metadata.
|
|
9
|
+
requires = ["setuptools>=77"]
|
|
10
|
+
build-backend = "setuptools.build_meta"
|
|
11
|
+
|
|
12
|
+
[project]
|
|
13
|
+
name = "sagex-cli"
|
|
14
|
+
description = "Autosage in your terminal: build, run and watch workflows, scripts, vaults and triggers from a TUI or one-shot commands."
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
license-files = ["LICENSE"]
|
|
18
|
+
authors = [{ name = "Lagnajit Moharana" }]
|
|
19
|
+
# 3.11 is the floor: the server sends ISO timestamps ending in "Z", which
|
|
20
|
+
# datetime.fromisoformat() only accepts from 3.11.
|
|
21
|
+
requires-python = ">=3.11"
|
|
22
|
+
# Version isn't written here — it's read from sagex/__init__.py (see [tool.setuptools.dynamic]),
|
|
23
|
+
# so there's a single source of truth. The release workflow checks the git tag matches it.
|
|
24
|
+
dynamic = ["version"]
|
|
25
|
+
keywords = ["autosage", "sagex", "automation", "workflow", "cli", "tui", "devops", "ssh", "winrm"]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 5 - Production/Stable",
|
|
28
|
+
"Environment :: Console",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"Intended Audience :: System Administrators",
|
|
31
|
+
"Operating System :: OS Independent",
|
|
32
|
+
"Programming Language :: Python :: 3",
|
|
33
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
34
|
+
"Programming Language :: Python :: 3.11",
|
|
35
|
+
"Programming Language :: Python :: 3.12",
|
|
36
|
+
"Programming Language :: Python :: 3.13",
|
|
37
|
+
"Topic :: System :: Systems Administration",
|
|
38
|
+
"Topic :: Utilities",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
# Runtime dependencies — what a user needs just to RUN sagex. Compatible ranges
|
|
42
|
+
# rather than exact pins, so `pip install` into a shared environment doesn't fight
|
|
43
|
+
# other packages; the upper bounds stop a breaking major (or, for 0.x, minor) release.
|
|
44
|
+
dependencies = [
|
|
45
|
+
"textual>=8.2.8,<9",
|
|
46
|
+
"rich>=15.0.0,<16",
|
|
47
|
+
"httpx>=0.28.1,<0.29",
|
|
48
|
+
"keyring>=25.7.0,<26",
|
|
49
|
+
"typer>=0.27.2,<0.28",
|
|
50
|
+
"cron-descriptor>=2.1.0,<3",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.optional-dependencies]
|
|
54
|
+
# Installed only with `pip install -e ".[dev]"` — the Textual dev console etc.
|
|
55
|
+
dev = [
|
|
56
|
+
"textual-dev==1.8.0",
|
|
57
|
+
"pytest>=8",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[project.urls]
|
|
61
|
+
Homepage = "https://github.com/Lagnajit09/sagex"
|
|
62
|
+
Documentation = "https://autosagexdocs.web.app"
|
|
63
|
+
Repository = "https://github.com/Lagnajit09/sagex"
|
|
64
|
+
Issues = "https://github.com/Lagnajit09/sagex/issues"
|
|
65
|
+
Changelog = "https://github.com/Lagnajit09/sagex/blob/main/CHANGELOG.md"
|
|
66
|
+
|
|
67
|
+
[project.scripts]
|
|
68
|
+
# This is the line that creates the `sagex` command. It points at the Typer
|
|
69
|
+
# `app` object in sagex/__main__.py; running `sagex ...` calls app(...).
|
|
70
|
+
sagex = "sagex.__main__:app"
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.dynamic]
|
|
73
|
+
# Read the version from the module attribute, so __init__.py stays authoritative.
|
|
74
|
+
version = { attr = "sagex.__version__" }
|
|
75
|
+
|
|
76
|
+
[tool.setuptools.packages.find]
|
|
77
|
+
# Ship the sagex package (and its subpackages: api, widgets), nothing else.
|
|
78
|
+
include = ["sagex*"]
|
|
79
|
+
|
|
80
|
+
[tool.setuptools.package-data]
|
|
81
|
+
# app.tcss isn't a .py file, so it wouldn't be packaged by default. Include it
|
|
82
|
+
# so CSS_PATH still resolves in a real (non-editable) wheel install.
|
|
83
|
+
sagex = ["*.tcss"]
|
|
84
|
+
|
|
85
|
+
[tool.pytest.ini_options]
|
|
86
|
+
testpaths = ["tests"]
|