salt-tui 0.1.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.
Files changed (90) hide show
  1. salt_tui-0.1.0/.github/workflows/ci.yml +41 -0
  2. salt_tui-0.1.0/.github/workflows/release.yml +49 -0
  3. salt_tui-0.1.0/.gitignore +13 -0
  4. salt_tui-0.1.0/CHANGELOG.md +6 -0
  5. salt_tui-0.1.0/LICENSE +201 -0
  6. salt_tui-0.1.0/PKG-INFO +99 -0
  7. salt_tui-0.1.0/README.md +66 -0
  8. salt_tui-0.1.0/benchmarks/scale.py +96 -0
  9. salt_tui-0.1.0/docs/architecture.md +21 -0
  10. salt_tui-0.1.0/docs/dashboard.svg +218 -0
  11. salt_tui-0.1.0/docs/events.svg +233 -0
  12. salt_tui-0.1.0/docs/keys.md +36 -0
  13. salt_tui-0.1.0/docs/plugins.md +21 -0
  14. salt_tui-0.1.0/docs/releasing.md +25 -0
  15. salt_tui-0.1.0/docs/stage2.md +71 -0
  16. salt_tui-0.1.0/pyproject.toml +42 -0
  17. salt_tui-0.1.0/sample-config.toml +29 -0
  18. salt_tui-0.1.0/scripts/check_dist.py +52 -0
  19. salt_tui-0.1.0/scripts/check_release.py +32 -0
  20. salt_tui-0.1.0/src/salt_tui/__init__.py +8 -0
  21. salt_tui-0.1.0/src/salt_tui/__main__.py +7 -0
  22. salt_tui-0.1.0/src/salt_tui/analytics/__init__.py +1 -0
  23. salt_tui-0.1.0/src/salt_tui/analytics/comparison.py +35 -0
  24. salt_tui-0.1.0/src/salt_tui/analytics/failures.py +18 -0
  25. salt_tui-0.1.0/src/salt_tui/analytics/search.py +53 -0
  26. salt_tui-0.1.0/src/salt_tui/app.py +293 -0
  27. salt_tui-0.1.0/src/salt_tui/cli.py +45 -0
  28. salt_tui-0.1.0/src/salt_tui/config.py +56 -0
  29. salt_tui-0.1.0/src/salt_tui/diagnostics.py +71 -0
  30. salt_tui-0.1.0/src/salt_tui/export.py +64 -0
  31. salt_tui-0.1.0/src/salt_tui/models.py +87 -0
  32. salt_tui-0.1.0/src/salt_tui/plugins.py +50 -0
  33. salt_tui-0.1.0/src/salt_tui/salt/__init__.py +1 -0
  34. salt_tui-0.1.0/src/salt_tui/salt/client.py +132 -0
  35. salt_tui-0.1.0/src/salt_tui/salt/commands.py +83 -0
  36. salt_tui-0.1.0/src/salt_tui/salt/event_filters.py +63 -0
  37. salt_tui-0.1.0/src/salt_tui/salt/events.py +241 -0
  38. salt_tui-0.1.0/src/salt_tui/salt/jobs.py +41 -0
  39. salt_tui-0.1.0/src/salt_tui/salt/parser.py +56 -0
  40. salt_tui-0.1.0/src/salt_tui/salt/python_client.py +90 -0
  41. salt_tui-0.1.0/src/salt_tui/salt/redaction.py +61 -0
  42. salt_tui-0.1.0/src/salt_tui/sls/__init__.py +1 -0
  43. salt_tui-0.1.0/src/salt_tui/sls/dependencies.py +53 -0
  44. salt_tui-0.1.0/src/salt_tui/sls/explorer.py +27 -0
  45. salt_tui-0.1.0/src/salt_tui/sls/graph.py +173 -0
  46. salt_tui-0.1.0/src/salt_tui/sls/source_links.py +69 -0
  47. salt_tui-0.1.0/src/salt_tui/sls/syntax.py +25 -0
  48. salt_tui-0.1.0/src/salt_tui/storage/__init__.py +1 -0
  49. salt_tui-0.1.0/src/salt_tui/storage/comparison.py +33 -0
  50. salt_tui-0.1.0/src/salt_tui/storage/database.py +565 -0
  51. salt_tui-0.1.0/src/salt_tui/storage/migrations/001_initial.sql +35 -0
  52. salt_tui-0.1.0/src/salt_tui/storage/migrations/002_events.sql +30 -0
  53. salt_tui-0.1.0/src/salt_tui/storage/migrations/003_analytics.sql +4 -0
  54. salt_tui-0.1.0/src/salt_tui/storage/migrations/004_orchestration.sql +8 -0
  55. salt_tui-0.1.0/src/salt_tui/storage/migrations/005_targets.sql +5 -0
  56. salt_tui-0.1.0/src/salt_tui/storage/migrations/006_maintenance.sql +3 -0
  57. salt_tui-0.1.0/src/salt_tui/storage/migrations/007_matrix.sql +2 -0
  58. salt_tui-0.1.0/src/salt_tui/ui/__init__.py +1 -0
  59. salt_tui-0.1.0/src/salt_tui/ui/analytics.py +57 -0
  60. salt_tui-0.1.0/src/salt_tui/ui/graph.py +174 -0
  61. salt_tui-0.1.0/src/salt_tui/ui/live.py +206 -0
  62. salt_tui-0.1.0/src/salt_tui/ui/matrix.py +107 -0
  63. salt_tui-0.1.0/src/salt_tui/ui/runner.py +177 -0
  64. salt_tui-0.1.0/src/salt_tui/ui/screens.py +664 -0
  65. salt_tui-0.1.0/src/salt_tui/ui/targets.py +79 -0
  66. salt_tui-0.1.0/tests/fixtures/changed_highstate.json +1 -0
  67. salt_tui-0.1.0/tests/fixtures/events.jsonl +5 -0
  68. salt_tui-0.1.0/tests/fixtures/failed_highstate.json +13 -0
  69. salt_tui-0.1.0/tests/fixtures/highstate_output.json +1 -0
  70. salt_tui-0.1.0/tests/fixtures/jinja_error.txt +1 -0
  71. salt_tui-0.1.0/tests/fixtures/missing_requisite.json +1 -0
  72. salt_tui-0.1.0/tests/fixtures/nested_includes.sls +8 -0
  73. salt_tui-0.1.0/tests/fixtures/partial_minions.json +1 -0
  74. salt_tui-0.1.0/tests/fixtures/render_error.txt +1 -0
  75. salt_tui-0.1.0/tests/fixtures/show_low_sls.json +7 -0
  76. salt_tui-0.1.0/tests/fixtures/show_sls.json +1 -0
  77. salt_tui-0.1.0/tests/fixtures/successful_highstate.json +1 -0
  78. salt_tui-0.1.0/tests/test_analytics.py +58 -0
  79. salt_tui-0.1.0/tests/test_backend.py +30 -0
  80. salt_tui-0.1.0/tests/test_comparison.py +13 -0
  81. salt_tui-0.1.0/tests/test_core.py +79 -0
  82. salt_tui-0.1.0/tests/test_events.py +116 -0
  83. salt_tui-0.1.0/tests/test_export_diagnostics.py +32 -0
  84. salt_tui-0.1.0/tests/test_graph.py +46 -0
  85. salt_tui-0.1.0/tests/test_jobs_orchestration.py +34 -0
  86. salt_tui-0.1.0/tests/test_matrix.py +42 -0
  87. salt_tui-0.1.0/tests/test_packaging.py +21 -0
  88. salt_tui-0.1.0/tests/test_plugins.py +18 -0
  89. salt_tui-0.1.0/tests/test_safety.py +83 -0
  90. salt_tui-0.1.0/tests/test_ui.py +61 -0
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test-package:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.12"
16
+ - name: Install development dependencies
17
+ run: python -m pip install -e ".[dev]"
18
+ - name: Test
19
+ run: python -m pytest -q
20
+ - name: Build wheel and source distribution
21
+ run: python -m build
22
+ - name: Validate metadata and contents
23
+ run: |
24
+ python -m twine check dist/*
25
+ python scripts/check_dist.py
26
+ - name: Install wheel in a clean environment
27
+ run: |
28
+ python -m venv "$RUNNER_TEMP/salt-tui-install"
29
+ "$RUNNER_TEMP/salt-tui-install/bin/python" -m pip install dist/*.whl
30
+ cd "$RUNNER_TEMP"
31
+ "$RUNNER_TEMP/salt-tui-install/bin/salt-tui" --version
32
+ "$RUNNER_TEMP/salt-tui-install/bin/salt-tui" --help
33
+ "$RUNNER_TEMP/salt-tui-install/bin/python" -m salt_tui --version
34
+ - name: pipx smoke test
35
+ run: |
36
+ python -m pip install pipx
37
+ export PIPX_HOME="$RUNNER_TEMP/pipx-home"
38
+ export PIPX_BIN_DIR="$RUNNER_TEMP/pipx-bin"
39
+ python -m pipx install dist/*.whl
40
+ "$PIPX_BIN_DIR/salt-tui" --version
41
+ python -m pipx uninstall salt-tui
@@ -0,0 +1,49 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - name: Check tag and PyPI version
19
+ run: python scripts/check_release.py
20
+ - name: Install development dependencies
21
+ run: python -m pip install -e ".[dev]"
22
+ - name: Test
23
+ run: python -m pytest -q
24
+ - name: Build
25
+ run: python -m build
26
+ - name: Validate distributions
27
+ run: |
28
+ python -m twine check dist/*
29
+ python scripts/check_dist.py
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-distributions
33
+ path: dist/
34
+
35
+ publish:
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ environment:
39
+ name: pypi
40
+ permissions:
41
+ id-token: write
42
+ contents: read
43
+ steps:
44
+ - uses: actions/download-artifact@v4
45
+ with:
46
+ name: python-distributions
47
+ path: dist/
48
+ - name: Publish to PyPI using trusted publishing
49
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+ __pycache__/
6
+ .pytest_cache/
7
+ *.pyc
8
+ *.db
9
+ *.sqlite
10
+ *.sqlite3
11
+ *.log
12
+ .env
13
+ .env.*
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Initial packaged Salt TUI with CLI execution, history, events, state views, and diagnostics.
6
+ - Added wheel, source distribution, pipx validation, and trusted publishing workflows.
salt_tui-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.5
2
+ Name: salt-tui
3
+ Version: 0.1.0
4
+ Summary: A keyboard-driven SaltStack operations console
5
+ Project-URL: Homepage, https://github.com/pratik-anurag/salt-tui
6
+ Project-URL: Repository, https://github.com/pratik-anurag/salt-tui
7
+ Project-URL: Issues, https://github.com/pratik-anurag/salt-tui/issues
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: System :: Systems Administration
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: pygments>=2.16
21
+ Requires-Dist: pyyaml>=6
22
+ Requires-Dist: rich>=13.7
23
+ Requires-Dist: textual<8,>=1.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: build>=1.2; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
27
+ Requires-Dist: pytest>=8; extra == 'dev'
28
+ Requires-Dist: twine>=6; extra == 'dev'
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
31
+ Requires-Dist: pytest>=8; extra == 'test'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Salt TUI
35
+
36
+ A Textual frontend for Salt CLI operations, structured state returns, local history, and SLS exploration. Salt remains the source of truth for state rendering and execution.
37
+
38
+ ## Install
39
+
40
+ Python 3.11 or newer and `pipx` are required. The package uses an isolated pipx environment and does not install into Salt's Python runtime. Once a release is published on PyPI:
41
+
42
+ ```sh
43
+ pipx install salt-tui
44
+ salt-tui
45
+ ```
46
+
47
+ Upgrade with `pipx upgrade salt-tui` and uninstall with `pipx uninstall salt-tui`. Uninstalling leaves your configuration and history in your user directories. Check an installation without opening the TUI using `salt-tui --version` or `salt-tui --help`. Prereleases require an explicit request, such as `pipx install --pip-args='--pre' salt-tui`.
48
+
49
+ For a development checkout:
50
+
51
+ ```sh
52
+ git clone https://github.com/pratik-anurag/salt-tui.git
53
+ cd salt-tui
54
+ python -m venv .venv
55
+ . .venv/bin/activate
56
+ python -m pip install -e '.[dev]'
57
+ python -m pytest
58
+ salt-tui
59
+ python -m salt_tui --version
60
+ ```
61
+
62
+ To test a local release artifact, run `python -m build` and then `pipx install ./dist/salt_tui-0.1.0-py3-none-any.whl`. Use the wheel name for the version you built. Salt CLI executables are discovered at runtime on `PATH`; Salt is not a Python dependency of this package.
63
+
64
+ Without Salt binaries, the UI opens with capability information and retains local history and SLS browsing. With `salt`, master commands are available; `salt-call` enables local minion commands. The app also detects `salt-run` and `salt-key` for their supported views. Live Salt behavior depends on the installed Salt CLI and access to a Salt environment. This package has been exercised on macOS; Linux is used in CI.
65
+
66
+ ## Use
67
+
68
+ `c` opens the generic command runner. Enter a normal Salt command, review the exact command preview, then run it. For state changes, a confirmation displays target, action, environment, and test mode. `Test first` adds `test=True` to state functions. `Run Live` publishes a state job asynchronously and opens minion progress when the Salt event bus is available. `e` opens the event stream and `v` returns to the selected live run. `r` opens state results; `f` and `Shift+F` visit failed states. `h` opens persisted history; highlight one run and press `x`, then another and `x` to compare state results. `s` browses configured local file roots and invokes Salt's `state.show_sls` or `state.show_low_sls` for compiled views. `g` opens the compiled dependency graph, where `u` and `n` follow connected states and `o` opens source. `j` shows Salt runner job data.
69
+
70
+ `Ctrl+M` opens a paged state × minion matrix for the selected run, with fleet drift filters and per-state details.
71
+
72
+ Direct entry points open the corresponding screen:
73
+
74
+ ```sh
75
+ salt-tui sls nginx
76
+ salt-tui run state.highstate
77
+ salt-tui history
78
+ salt-tui failures
79
+ salt-tui events
80
+ salt-tui intelligence
81
+ salt-tui performance
82
+ salt-tui runner
83
+ salt-tui orchestration
84
+ salt-tui targets
85
+ salt-tui matrix
86
+ salt-tui diagnostics --output ./salt-tui-diagnostics.zip
87
+ ```
88
+
89
+ Configuration is read from `~/.config/salt-tui/config.toml` (or `$XDG_CONFIG_HOME/salt-tui/config.toml`). Copy `sample-config.toml` and adapt command paths and file roots. History defaults to `$XDG_DATA_HOME/salt-tui/history.db` or `~/.local/share/salt-tui/history.db`. It does not write into Salt's cache.
90
+
91
+ See [architecture](docs/architecture.md), [Stage 2 progress](docs/stage2.md), [plugin API](docs/plugins.md), [keyboard shortcuts](docs/keys.md), and the [release checklist](docs/releasing.md).
92
+
93
+ ![Dashboard preview](docs/dashboard.svg)
94
+
95
+ ![Event stream preview](docs/events.svg)
96
+
97
+ ## Scope and limitations
98
+
99
+ Stage 2 adds event streaming, live JID-correlated master state runs, compiled graph navigation, source links, combined history search, recurring failure patterns, slow-state analysis, runner execution, orchestration, and structured job inspection. Per-state progress requires Salt's `state_events` support. The TUI tries the Salt Python event API first, then `salt-run state.event`. If neither is available, the event screen reports that the bus is unavailable and `Run Live` is disabled. Rich minion metadata, broad target match counts, and full command autocomplete remain future work. The command runner supports arbitrary Salt CLI arguments; Salt-specific option ordering should be entered as a normal CLI line.
@@ -0,0 +1,66 @@
1
+ # Salt TUI
2
+
3
+ A Textual frontend for Salt CLI operations, structured state returns, local history, and SLS exploration. Salt remains the source of truth for state rendering and execution.
4
+
5
+ ## Install
6
+
7
+ Python 3.11 or newer and `pipx` are required. The package uses an isolated pipx environment and does not install into Salt's Python runtime. Once a release is published on PyPI:
8
+
9
+ ```sh
10
+ pipx install salt-tui
11
+ salt-tui
12
+ ```
13
+
14
+ Upgrade with `pipx upgrade salt-tui` and uninstall with `pipx uninstall salt-tui`. Uninstalling leaves your configuration and history in your user directories. Check an installation without opening the TUI using `salt-tui --version` or `salt-tui --help`. Prereleases require an explicit request, such as `pipx install --pip-args='--pre' salt-tui`.
15
+
16
+ For a development checkout:
17
+
18
+ ```sh
19
+ git clone https://github.com/pratik-anurag/salt-tui.git
20
+ cd salt-tui
21
+ python -m venv .venv
22
+ . .venv/bin/activate
23
+ python -m pip install -e '.[dev]'
24
+ python -m pytest
25
+ salt-tui
26
+ python -m salt_tui --version
27
+ ```
28
+
29
+ To test a local release artifact, run `python -m build` and then `pipx install ./dist/salt_tui-0.1.0-py3-none-any.whl`. Use the wheel name for the version you built. Salt CLI executables are discovered at runtime on `PATH`; Salt is not a Python dependency of this package.
30
+
31
+ Without Salt binaries, the UI opens with capability information and retains local history and SLS browsing. With `salt`, master commands are available; `salt-call` enables local minion commands. The app also detects `salt-run` and `salt-key` for their supported views. Live Salt behavior depends on the installed Salt CLI and access to a Salt environment. This package has been exercised on macOS; Linux is used in CI.
32
+
33
+ ## Use
34
+
35
+ `c` opens the generic command runner. Enter a normal Salt command, review the exact command preview, then run it. For state changes, a confirmation displays target, action, environment, and test mode. `Test first` adds `test=True` to state functions. `Run Live` publishes a state job asynchronously and opens minion progress when the Salt event bus is available. `e` opens the event stream and `v` returns to the selected live run. `r` opens state results; `f` and `Shift+F` visit failed states. `h` opens persisted history; highlight one run and press `x`, then another and `x` to compare state results. `s` browses configured local file roots and invokes Salt's `state.show_sls` or `state.show_low_sls` for compiled views. `g` opens the compiled dependency graph, where `u` and `n` follow connected states and `o` opens source. `j` shows Salt runner job data.
36
+
37
+ `Ctrl+M` opens a paged state × minion matrix for the selected run, with fleet drift filters and per-state details.
38
+
39
+ Direct entry points open the corresponding screen:
40
+
41
+ ```sh
42
+ salt-tui sls nginx
43
+ salt-tui run state.highstate
44
+ salt-tui history
45
+ salt-tui failures
46
+ salt-tui events
47
+ salt-tui intelligence
48
+ salt-tui performance
49
+ salt-tui runner
50
+ salt-tui orchestration
51
+ salt-tui targets
52
+ salt-tui matrix
53
+ salt-tui diagnostics --output ./salt-tui-diagnostics.zip
54
+ ```
55
+
56
+ Configuration is read from `~/.config/salt-tui/config.toml` (or `$XDG_CONFIG_HOME/salt-tui/config.toml`). Copy `sample-config.toml` and adapt command paths and file roots. History defaults to `$XDG_DATA_HOME/salt-tui/history.db` or `~/.local/share/salt-tui/history.db`. It does not write into Salt's cache.
57
+
58
+ See [architecture](docs/architecture.md), [Stage 2 progress](docs/stage2.md), [plugin API](docs/plugins.md), [keyboard shortcuts](docs/keys.md), and the [release checklist](docs/releasing.md).
59
+
60
+ ![Dashboard preview](docs/dashboard.svg)
61
+
62
+ ![Event stream preview](docs/events.svg)
63
+
64
+ ## Scope and limitations
65
+
66
+ Stage 2 adds event streaming, live JID-correlated master state runs, compiled graph navigation, source links, combined history search, recurring failure patterns, slow-state analysis, runner execution, orchestration, and structured job inspection. Per-state progress requires Salt's `state_events` support. The TUI tries the Salt Python event API first, then `salt-run state.event`. If neither is available, the event screen reports that the bus is unavailable and `Run Live` is disabled. Rich minion metadata, broad target match counts, and full command autocomplete remain future work. The command runner supports arbitrary Salt CLI arguments; Salt-specific option ordering should be entered as a normal CLI line.
@@ -0,0 +1,96 @@
1
+ """Synthetic scale benchmark; no Salt master required.
2
+
3
+ Run after `pip install -e .`:
4
+ python benchmarks/scale.py --minions 10000 --states 20000 --history 1000000
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import argparse
9
+ import asyncio
10
+ from pathlib import Path
11
+ import sqlite3
12
+ import tempfile
13
+ from time import perf_counter
14
+
15
+ from salt_tui.models import SaltEvent
16
+ from salt_tui.salt.events import EventMonitor
17
+ from salt_tui.sls.graph import StateGraph
18
+ from salt_tui.storage.database import Database
19
+
20
+
21
+ async def main() -> None:
22
+ parser = argparse.ArgumentParser()
23
+ parser.add_argument("--minions", type=int, default=10000)
24
+ parser.add_argument("--states", type=int, default=20000)
25
+ parser.add_argument("--history", type=int, default=1000000)
26
+ parser.add_argument("--events", type=int, default=100000)
27
+ args = parser.parse_args()
28
+ with tempfile.TemporaryDirectory() as temporary:
29
+ path = Path(temporary) / "scale.db"
30
+ db = Database(path)
31
+ await db.migrate()
32
+ chunks = []
33
+ for index in range(args.states):
34
+ chunk = {"__id__": f"state-{index}", "state": "test", "fun": "succeed_without_changes",
35
+ "__sls__": f"formula.module{index % 100}", "name": f"state-{index}"}
36
+ if index:
37
+ chunk["require"] = [{"test": f"state-{index - 1}"}]
38
+ chunks.append(chunk)
39
+ started = perf_counter()
40
+ graph = StateGraph.from_low(chunks)
41
+ build_seconds = perf_counter() - started
42
+ started = perf_counter()
43
+ diagnostics = graph.diagnostics()
44
+ diagnostic_seconds = perf_counter() - started
45
+ with sqlite3.connect(path) as con:
46
+ con.execute("INSERT INTO runs (uuid,started_at,command,argv_json,status) VALUES (?,?,?,?,?)",
47
+ ("scale", "2026-01-01T00:00:00+00:00", "synthetic", "[]", "success"))
48
+ run_id = con.execute("SELECT last_insert_rowid()").fetchone()[0]
49
+ con.executemany("INSERT INTO run_minion_progress (run_id,minion_id,status) VALUES (?,?,?)",
50
+ ((run_id, f"minion-{index:05d}", "success") for index in range(args.minions)))
51
+ started = perf_counter()
52
+ batch = []
53
+ for index in range(args.history):
54
+ batch.append((run_id, f"minion-{index % max(1,args.minions):05d}", f"formula.module{index % 100}",
55
+ f"state-{index % 1000}", "test", "succeed_without_changes", f"state-{index % 1000}",
56
+ 1, "{}", "ok", float(index % 1000)))
57
+ if len(batch) == 10000:
58
+ con.executemany("""INSERT INTO state_results (run_id,minion_id,sls,state_id,state_module,state_function,name,
59
+ result,changes_json,comment,duration_ms) VALUES (?,?,?,?,?,?,?,?,?,?,?)""", batch)
60
+ batch.clear()
61
+ if batch:
62
+ con.executemany("""INSERT INTO state_results (run_id,minion_id,sls,state_id,state_module,state_function,name,
63
+ result,changes_json,comment,duration_ms) VALUES (?,?,?,?,?,?,?,?,?,?,?)""", batch)
64
+ insert_seconds = perf_counter() - started
65
+ started = perf_counter()
66
+ minions = await db.progress(run_id)
67
+ progress_seconds = perf_counter() - started
68
+ started = perf_counter()
69
+ history = await db.slow_states(limit=50)
70
+ analytics_seconds = perf_counter() - started
71
+ started = perf_counter()
72
+ matrix = await db.matrix_summary(run_id, limit=200)
73
+ summary_seconds = perf_counter() - started
74
+ started = perf_counter()
75
+ visible_minions = await db.matrix_minions(run_id)
76
+ cells = await db.matrix_cells(run_id, visible_minions, [row["state_id"] for row in matrix])
77
+ cell_seconds = perf_counter() - started
78
+ monitor = EventMonitor(None, None, capacity=2000, queue_size=1000)
79
+ event = SaltEvent("2026-01-01T00:00:00+00:00", "salt/job/test/ret/web01", "job", {}, "test")
80
+ started = perf_counter()
81
+ for _ in range(args.events):
82
+ monitor.publish(event)
83
+ event_seconds = perf_counter() - started
84
+ print(f"Graph: {len(graph.nodes)} states, {len(graph.edges)} edges; build {build_seconds:.3f}s, diagnostics {diagnostic_seconds:.3f}s ({len(diagnostics)} hints)")
85
+ print(f"SQLite: {args.history} state rows inserted in {insert_seconds:.3f}s; {len(minions)} minion progress rows read in {progress_seconds:.3f}s")
86
+ print(f"Slow-state top {len(history)} groups: {analytics_seconds:.3f}s")
87
+ print(f"Matrix: {len(matrix)} state groups in {summary_seconds:.3f}s; {len(visible_minions)} minions, {len(cells)} visible cells in {cell_seconds:.3f}s")
88
+ print(f"Event ring: {args.events} synthetic events in {event_seconds:.3f}s; retained {len(monitor.recent)}")
89
+ with sqlite3.connect(path) as con:
90
+ for query in ("SELECT * FROM events WHERE jid='20261004150112345678' ORDER BY id DESC LIMIT 500",
91
+ "SELECT * FROM state_results WHERE sls='formula.module1' AND state_id='state-1' AND state_module='test' AND state_function='succeed_without_changes' ORDER BY duration_ms LIMIT 1"):
92
+ print("PLAN", *con.execute("EXPLAIN QUERY PLAN " + query).fetchall())
93
+
94
+
95
+ if __name__ == "__main__":
96
+ asyncio.run(main())
@@ -0,0 +1,21 @@
1
+ # Architecture
2
+
3
+ The application uses Textual screens over a Salt service layer. The UI sends `CommandSpec` values to `SubprocessSaltClient`, which builds argument arrays and invokes Salt with `asyncio.create_subprocess_exec`. It never invokes a shell. Salt's JSON output is kept raw and normalized into minion and state rows. `Database` stores a run and its related records in one transaction through `asyncio.to_thread` and uses SQLite WAL mode. The source explorer reads configured `file_roots` only; authoritative high/low data and requisites come from `salt-call state.show_sls` and `state.show_low_sls`.
4
+
5
+ Stage 2 Phase A adds an independent `EventSource` interface with a Salt Python adapter and a `salt-run state.event` adapter. `EventMonitor` owns subscription, reconnect, a bounded memory ring, and a bounded persistence queue. Migration 002 adds events and JID keyed run progress. Correlation uses exact JIDs only; it does not infer ownership from similar function names or time windows. See [Stage 2 plan](stage2.md).
6
+
7
+ ## Data flow
8
+
9
+ 1. User types a Salt CLI command. `parse_line` uses `shlex.split`, then `build_argv` adds JSON output where suitable.
10
+ 2. The command screen displays the exact generated command and requires confirmation for mutating commands.
11
+ 3. The service streams stdout/stderr into a bounded UI log and retains the full raw result.
12
+ 4. The parser extracts state return dictionaries; the database writes run, minion, state, failure, and log rows.
13
+ 5. History and state screens read indexed, paginated records and support failure navigation.
14
+
15
+ ## Boundaries
16
+
17
+ `SaltClient` is a protocol, so a Salt Python API or remote API backend can later replace the CLI client. UI code has no subprocess calls. SQLite schema changes use numbered SQL migrations. The source browser is a navigation aid; Salt's compiled output remains authoritative. Only local Salt CLI workflows are implemented in this milestone.
18
+
19
+ ## Reliability
20
+
21
+ The UI stays responsive through asyncio subprocesses and thread backed SQLite/file operations. History and log queries have limits. Normal test suite uses fixtures and a mocked subprocess and needs no Salt master. Errors retain the command, stdout, and stderr for reproduction.