orbit-cli 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 (89) hide show
  1. orbit_cli-0.1.0/.github/workflows/ci.yml +37 -0
  2. orbit_cli-0.1.0/.github/workflows/publish.yml +29 -0
  3. orbit_cli-0.1.0/.gitignore +38 -0
  4. orbit_cli-0.1.0/LICENSE +190 -0
  5. orbit_cli-0.1.0/PKG-INFO +182 -0
  6. orbit_cli-0.1.0/README.md +127 -0
  7. orbit_cli-0.1.0/orbit/__init__.py +1 -0
  8. orbit_cli-0.1.0/orbit/agent/__init__.py +0 -0
  9. orbit_cli-0.1.0/orbit/agent/ask.py +35 -0
  10. orbit_cli-0.1.0/orbit/agent/budget.py +58 -0
  11. orbit_cli-0.1.0/orbit/agent/executor.py +99 -0
  12. orbit_cli-0.1.0/orbit/agent/loop.py +129 -0
  13. orbit_cli-0.1.0/orbit/agent/observer.py +40 -0
  14. orbit_cli-0.1.0/orbit/agent/planner.py +112 -0
  15. orbit_cli-0.1.0/orbit/agent/wtf.py +101 -0
  16. orbit_cli-0.1.0/orbit/cli.py +243 -0
  17. orbit_cli-0.1.0/orbit/config.py +127 -0
  18. orbit_cli-0.1.0/orbit/context/__init__.py +0 -0
  19. orbit_cli-0.1.0/orbit/context/docker_ctx.py +48 -0
  20. orbit_cli-0.1.0/orbit/context/filesystem_ctx.py +81 -0
  21. orbit_cli-0.1.0/orbit/context/git_ctx.py +50 -0
  22. orbit_cli-0.1.0/orbit/context/k8s_ctx.py +53 -0
  23. orbit_cli-0.1.0/orbit/context/scanner.py +84 -0
  24. orbit_cli-0.1.0/orbit/context/system_ctx.py +37 -0
  25. orbit_cli-0.1.0/orbit/llm/__init__.py +34 -0
  26. orbit_cli-0.1.0/orbit/llm/anthropic_provider.py +41 -0
  27. orbit_cli-0.1.0/orbit/llm/base.py +40 -0
  28. orbit_cli-0.1.0/orbit/llm/ollama_provider.py +131 -0
  29. orbit_cli-0.1.0/orbit/llm/openai_provider.py +41 -0
  30. orbit_cli-0.1.0/orbit/memory/__init__.py +0 -0
  31. orbit_cli-0.1.0/orbit/memory/history.py +88 -0
  32. orbit_cli-0.1.0/orbit/memory/rag.py +59 -0
  33. orbit_cli-0.1.0/orbit/memory/runbooks.py +49 -0
  34. orbit_cli-0.1.0/orbit/modules/__init__.py +0 -0
  35. orbit_cli-0.1.0/orbit/modules/base.py +28 -0
  36. orbit_cli-0.1.0/orbit/modules/docker_mod.py +47 -0
  37. orbit_cli-0.1.0/orbit/modules/filesystem_mod.py +35 -0
  38. orbit_cli-0.1.0/orbit/modules/git_mod.py +50 -0
  39. orbit_cli-0.1.0/orbit/modules/k8s_mod.py +48 -0
  40. orbit_cli-0.1.0/orbit/modules/registry.py +39 -0
  41. orbit_cli-0.1.0/orbit/modules/shell.py +35 -0
  42. orbit_cli-0.1.0/orbit/router/__init__.py +0 -0
  43. orbit_cli-0.1.0/orbit/router/context_budget.py +49 -0
  44. orbit_cli-0.1.0/orbit/router/decomposer.py +59 -0
  45. orbit_cli-0.1.0/orbit/router/model_registry.py +91 -0
  46. orbit_cli-0.1.0/orbit/router/model_selector.py +47 -0
  47. orbit_cli-0.1.0/orbit/safety/__init__.py +0 -0
  48. orbit_cli-0.1.0/orbit/safety/classifier.py +44 -0
  49. orbit_cli-0.1.0/orbit/safety/patterns.py +317 -0
  50. orbit_cli-0.1.0/orbit/safety/rollback.py +94 -0
  51. orbit_cli-0.1.0/orbit/schemas/__init__.py +23 -0
  52. orbit_cli-0.1.0/orbit/schemas/analysis.py +11 -0
  53. orbit_cli-0.1.0/orbit/schemas/context.py +30 -0
  54. orbit_cli-0.1.0/orbit/schemas/execution.py +21 -0
  55. orbit_cli-0.1.0/orbit/schemas/plan.py +41 -0
  56. orbit_cli-0.1.0/orbit/schemas/runbook.py +23 -0
  57. orbit_cli-0.1.0/orbit/schemas/safety.py +18 -0
  58. orbit_cli-0.1.0/orbit/ui/__init__.py +0 -0
  59. orbit_cli-0.1.0/orbit/ui/confirmations.py +83 -0
  60. orbit_cli-0.1.0/orbit/ui/console.py +6 -0
  61. orbit_cli-0.1.0/orbit/ui/panels.py +109 -0
  62. orbit_cli-0.1.0/orbit/ui/themes.py +23 -0
  63. orbit_cli-0.1.0/pyproject.toml +80 -0
  64. orbit_cli-0.1.0/testing/orbit/main +0 -0
  65. orbit_cli-0.1.0/testing/orbit/main.rs +1 -0
  66. orbit_cli-0.1.0/tests/__init__.py +0 -0
  67. orbit_cli-0.1.0/tests/conftest.py +67 -0
  68. orbit_cli-0.1.0/tests/test_agent/__init__.py +0 -0
  69. orbit_cli-0.1.0/tests/test_agent/test_budget.py +72 -0
  70. orbit_cli-0.1.0/tests/test_agent/test_modules.py +98 -0
  71. orbit_cli-0.1.0/tests/test_agent/test_observer.py +76 -0
  72. orbit_cli-0.1.0/tests/test_cli.py +123 -0
  73. orbit_cli-0.1.0/tests/test_config.py +101 -0
  74. orbit_cli-0.1.0/tests/test_context/__init__.py +0 -0
  75. orbit_cli-0.1.0/tests/test_context/test_collectors.py +110 -0
  76. orbit_cli-0.1.0/tests/test_context/test_context_budget.py +60 -0
  77. orbit_cli-0.1.0/tests/test_context/test_scanner.py +111 -0
  78. orbit_cli-0.1.0/tests/test_llm.py +128 -0
  79. orbit_cli-0.1.0/tests/test_memory/__init__.py +0 -0
  80. orbit_cli-0.1.0/tests/test_memory/test_history.py +81 -0
  81. orbit_cli-0.1.0/tests/test_memory/test_rag.py +10 -0
  82. orbit_cli-0.1.0/tests/test_memory/test_runbooks.py +81 -0
  83. orbit_cli-0.1.0/tests/test_router/__init__.py +0 -0
  84. orbit_cli-0.1.0/tests/test_router/test_model_registry.py +65 -0
  85. orbit_cli-0.1.0/tests/test_router/test_model_selector.py +63 -0
  86. orbit_cli-0.1.0/tests/test_safety/__init__.py +0 -0
  87. orbit_cli-0.1.0/tests/test_safety/test_classifier.py +188 -0
  88. orbit_cli-0.1.0/tests/test_safety/test_rollback.py +58 -0
  89. orbit_cli-0.1.0/tests/test_schemas.py +138 -0
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: pip install -e ".[dev]"
26
+
27
+ - name: Lint
28
+ run: ruff check orbit/ tests/
29
+
30
+ - name: Format check
31
+ run: ruff format --check orbit/ tests/
32
+
33
+ - name: Type check
34
+ run: mypy orbit/
35
+
36
+ - name: Test
37
+ run: pytest
@@ -0,0 +1,29 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build tools
23
+ run: pip install build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Publish to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,38 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+
7
+ # Distribution
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+ *.egg
12
+
13
+ # Virtual environments
14
+ venv/
15
+ .venv/
16
+ env/
17
+
18
+ # Tools
19
+ .mypy_cache/
20
+ .pytest_cache/
21
+ .ruff_cache/
22
+
23
+ # IDE
24
+ .idea/
25
+ .vscode/
26
+ *.swp
27
+ *.swo
28
+
29
+ # Environment
30
+ .env
31
+ .env.*
32
+
33
+ # Claude
34
+ .claude/
35
+
36
+ # OS
37
+ .DS_Store
38
+ Thumbs.db
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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
+ Copyright 2024 Abhimanyu Bhagwati
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: orbit-cli
3
+ Version: 0.1.0
4
+ Summary: Local-first, multi-model DevOps CLI agent
5
+ Project-URL: Homepage, https://github.com/abhimanyubhagwati/orbit-cli
6
+ Project-URL: Repository, https://github.com/abhimanyubhagwati/orbit-cli
7
+ Project-URL: Issues, https://github.com/abhimanyubhagwati/orbit-cli/issues
8
+ Author: Abhimanyu Bhagwati
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: agent,automation,cli,devops,llm,ollama
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: httpx>=0.27
26
+ Requires-Dist: ollama>=0.4
27
+ Requires-Dist: pydantic-settings>=2.0
28
+ Requires-Dist: pydantic>=2.0
29
+ Requires-Dist: pyyaml>=6.0
30
+ Requires-Dist: rich>=13
31
+ Requires-Dist: tomli-w>=1.0
32
+ Requires-Dist: typer>=0.12
33
+ Provides-Extra: all
34
+ Requires-Dist: anthropic>=0.30; extra == 'all'
35
+ Requires-Dist: chromadb>=0.5; extra == 'all'
36
+ Requires-Dist: mypy>=1.10; extra == 'all'
37
+ Requires-Dist: openai>=1.0; extra == 'all'
38
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'all'
39
+ Requires-Dist: pytest>=8.0; extra == 'all'
40
+ Requires-Dist: ruff>=0.4; extra == 'all'
41
+ Requires-Dist: types-pyyaml>=6.0; extra == 'all'
42
+ Provides-Extra: anthropic
43
+ Requires-Dist: anthropic>=0.30; extra == 'anthropic'
44
+ Provides-Extra: dev
45
+ Requires-Dist: mypy>=1.10; extra == 'dev'
46
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
47
+ Requires-Dist: pytest>=8.0; extra == 'dev'
48
+ Requires-Dist: ruff>=0.4; extra == 'dev'
49
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
50
+ Provides-Extra: openai
51
+ Requires-Dist: openai>=1.0; extra == 'openai'
52
+ Provides-Extra: rag
53
+ Requires-Dist: chromadb>=0.5; extra == 'rag'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # Orbit
57
+
58
+ **Local-first, multi-model DevOps CLI agent.**
59
+
60
+ [![PyPI version](https://img.shields.io/pypi/v/orbit-cli.svg)](https://pypi.org/project/orbit-cli/)
61
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
62
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
63
+
64
+ Orbit turns natural language into safe, observable DevOps actions. It decomposes goals into plans, picks the best local model for each step, and executes with a 4-tier safety system — all running against your own Ollama instance.
65
+
66
+ ## Features
67
+
68
+ - **Multi-model routing** — automatically selects the best locally-available model for each subtask (coding, ops, analysis)
69
+ - **4-tier safety system** — every command is classified as safe, caution, destructive, or nuclear before execution
70
+ - **Auto-replan** — observes command output and adjusts the plan when things go wrong
71
+ - **Context-aware** — scans your git state, Docker containers, Kubernetes clusters, and system environment
72
+ - **Command history** — searchable SQLite-backed history of every action taken
73
+ - **Runbook capture** — record successful workflows as replayable YAML runbooks
74
+ - **Streaming output** — real-time LLM and subprocess output in a Rich terminal UI
75
+
76
+ ## Installation
77
+
78
+ ```bash
79
+ pip install orbit-cli
80
+ ```
81
+
82
+ ### Requirements
83
+
84
+ - Python 3.11+
85
+ - [Ollama](https://ollama.ai) running locally with at least one model pulled (e.g. `ollama pull qwen2.5:7b`)
86
+
87
+ ## Quick Start
88
+
89
+ ### Execute a goal
90
+
91
+ ```bash
92
+ orbit do "find large files in this repo and show disk usage by directory"
93
+ ```
94
+
95
+ Orbit will decompose the goal, build a plan, ask for confirmation on risky steps, execute, and replan if needed.
96
+
97
+ ### Scan your environment
98
+
99
+ ```bash
100
+ orbit sense
101
+ ```
102
+
103
+ Collects context from git, Docker, Kubernetes, and system — shows what Orbit sees before planning.
104
+
105
+ ### Debug the last failure
106
+
107
+ ```bash
108
+ orbit wtf
109
+ ```
110
+
111
+ Analyzes the most recent failed command with full context and suggests fixes.
112
+
113
+ ### Ask a question
114
+
115
+ ```bash
116
+ orbit ask "what Kubernetes pods are in CrashLoopBackOff and why?"
117
+ ```
118
+
119
+ One-shot question answering with environment context.
120
+
121
+ ### Check configuration
122
+
123
+ ```bash
124
+ orbit config doctor
125
+ ```
126
+
127
+ Verifies Ollama connectivity, available models, and configuration health.
128
+
129
+ ## Safety Tiers
130
+
131
+ | Tier | Behavior | Examples |
132
+ |------|----------|---------|
133
+ | **safe** | Execute silently | `ls`, `cat`, `kubectl get`, `docker ps` |
134
+ | **caution** | Single confirmation | `git push`, `docker build`, `kubectl apply` |
135
+ | **destructive** | Impact analysis + double confirm | `rm`, `kubectl delete`, `git reset --hard` |
136
+ | **nuclear** | Type confirmation + cooldown | Destructive in production context |
137
+
138
+ Production detection automatically escalates destructive commands to nuclear when it detects a production environment (main/master branch, prod namespace, etc.).
139
+
140
+ ## Configuration
141
+
142
+ Orbit stores its configuration at `~/.orbit/config.toml`. Run `orbit config doctor` to check your setup.
143
+
144
+ Key settings:
145
+
146
+ ```toml
147
+ [llm]
148
+ provider = "ollama" # ollama, openai, or anthropic
149
+ base_url = "http://localhost:11434"
150
+
151
+ [safety]
152
+ default_tier = "caution" # for unrecognized commands
153
+
154
+ [agent]
155
+ max_steps = 15 # hard budget per goal
156
+ max_replans = 3 # retries per step
157
+ max_llm_calls = 25 # total LLM calls per goal
158
+ ```
159
+
160
+ ## Optional Extras
161
+
162
+ ```bash
163
+ pip install orbit-cli[rag] # ChromaDB for semantic memory
164
+ pip install orbit-cli[openai] # OpenAI provider
165
+ pip install orbit-cli[anthropic] # Anthropic provider
166
+ pip install orbit-cli[all] # everything
167
+ ```
168
+
169
+ ## Development
170
+
171
+ ```bash
172
+ git clone https://github.com/abhimanyubhagwati/orbit-cli.git
173
+ cd orbit-cli
174
+ pip install -e ".[dev]"
175
+ pytest
176
+ ruff check orbit/ tests/
177
+ mypy orbit/
178
+ ```
179
+
180
+ ## License
181
+
182
+ Apache 2.0 — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,127 @@
1
+ # Orbit
2
+
3
+ **Local-first, multi-model DevOps CLI agent.**
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/orbit-cli.svg)](https://pypi.org/project/orbit-cli/)
6
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
7
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
8
+
9
+ Orbit turns natural language into safe, observable DevOps actions. It decomposes goals into plans, picks the best local model for each step, and executes with a 4-tier safety system — all running against your own Ollama instance.
10
+
11
+ ## Features
12
+
13
+ - **Multi-model routing** — automatically selects the best locally-available model for each subtask (coding, ops, analysis)
14
+ - **4-tier safety system** — every command is classified as safe, caution, destructive, or nuclear before execution
15
+ - **Auto-replan** — observes command output and adjusts the plan when things go wrong
16
+ - **Context-aware** — scans your git state, Docker containers, Kubernetes clusters, and system environment
17
+ - **Command history** — searchable SQLite-backed history of every action taken
18
+ - **Runbook capture** — record successful workflows as replayable YAML runbooks
19
+ - **Streaming output** — real-time LLM and subprocess output in a Rich terminal UI
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install orbit-cli
25
+ ```
26
+
27
+ ### Requirements
28
+
29
+ - Python 3.11+
30
+ - [Ollama](https://ollama.ai) running locally with at least one model pulled (e.g. `ollama pull qwen2.5:7b`)
31
+
32
+ ## Quick Start
33
+
34
+ ### Execute a goal
35
+
36
+ ```bash
37
+ orbit do "find large files in this repo and show disk usage by directory"
38
+ ```
39
+
40
+ Orbit will decompose the goal, build a plan, ask for confirmation on risky steps, execute, and replan if needed.
41
+
42
+ ### Scan your environment
43
+
44
+ ```bash
45
+ orbit sense
46
+ ```
47
+
48
+ Collects context from git, Docker, Kubernetes, and system — shows what Orbit sees before planning.
49
+
50
+ ### Debug the last failure
51
+
52
+ ```bash
53
+ orbit wtf
54
+ ```
55
+
56
+ Analyzes the most recent failed command with full context and suggests fixes.
57
+
58
+ ### Ask a question
59
+
60
+ ```bash
61
+ orbit ask "what Kubernetes pods are in CrashLoopBackOff and why?"
62
+ ```
63
+
64
+ One-shot question answering with environment context.
65
+
66
+ ### Check configuration
67
+
68
+ ```bash
69
+ orbit config doctor
70
+ ```
71
+
72
+ Verifies Ollama connectivity, available models, and configuration health.
73
+
74
+ ## Safety Tiers
75
+
76
+ | Tier | Behavior | Examples |
77
+ |------|----------|---------|
78
+ | **safe** | Execute silently | `ls`, `cat`, `kubectl get`, `docker ps` |
79
+ | **caution** | Single confirmation | `git push`, `docker build`, `kubectl apply` |
80
+ | **destructive** | Impact analysis + double confirm | `rm`, `kubectl delete`, `git reset --hard` |
81
+ | **nuclear** | Type confirmation + cooldown | Destructive in production context |
82
+
83
+ Production detection automatically escalates destructive commands to nuclear when it detects a production environment (main/master branch, prod namespace, etc.).
84
+
85
+ ## Configuration
86
+
87
+ Orbit stores its configuration at `~/.orbit/config.toml`. Run `orbit config doctor` to check your setup.
88
+
89
+ Key settings:
90
+
91
+ ```toml
92
+ [llm]
93
+ provider = "ollama" # ollama, openai, or anthropic
94
+ base_url = "http://localhost:11434"
95
+
96
+ [safety]
97
+ default_tier = "caution" # for unrecognized commands
98
+
99
+ [agent]
100
+ max_steps = 15 # hard budget per goal
101
+ max_replans = 3 # retries per step
102
+ max_llm_calls = 25 # total LLM calls per goal
103
+ ```
104
+
105
+ ## Optional Extras
106
+
107
+ ```bash
108
+ pip install orbit-cli[rag] # ChromaDB for semantic memory
109
+ pip install orbit-cli[openai] # OpenAI provider
110
+ pip install orbit-cli[anthropic] # Anthropic provider
111
+ pip install orbit-cli[all] # everything
112
+ ```
113
+
114
+ ## Development
115
+
116
+ ```bash
117
+ git clone https://github.com/abhimanyubhagwati/orbit-cli.git
118
+ cd orbit-cli
119
+ pip install -e ".[dev]"
120
+ pytest
121
+ ruff check orbit/ tests/
122
+ mypy orbit/
123
+ ```
124
+
125
+ ## License
126
+
127
+ Apache 2.0 — see [LICENSE](LICENSE) for details.
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
File without changes
@@ -0,0 +1,35 @@
1
+ from __future__ import annotations
2
+
3
+ from orbit.config import get_config
4
+ from orbit.context.scanner import scan
5
+ from orbit.llm.ollama_provider import OllamaProvider
6
+ from orbit.ui.console import console
7
+
8
+ ASK_SYSTEM_PROMPT = """You are a helpful DevOps assistant. Answer questions about the user's
9
+ environment based on the provided context. Be concise and specific.
10
+ If you're not sure, say so. Do not execute any commands."""
11
+
12
+
13
+ async def ask(question: str) -> None:
14
+ """Answer a question about the environment. No execution."""
15
+ config = get_config()
16
+ provider = OllamaProvider(host=config.ollama_host, port=config.ollama_port)
17
+
18
+ console.print("[orbit.blue]Scanning environment...[/]")
19
+ env = await scan()
20
+
21
+ context_parts = [f"[{slot.source}]\n{slot.content}" for slot in env.slots if slot.available]
22
+ context_text = "\n\n".join(context_parts) if context_parts else "No context available."
23
+
24
+ messages = [
25
+ {"role": "system", "content": ASK_SYSTEM_PROMPT},
26
+ {"role": "user", "content": f"Environment:\n{context_text}\n\nQuestion: {question}"},
27
+ ]
28
+
29
+ try:
30
+ # Stream the response
31
+ response = provider.chat(model=config.default_model, messages=messages, temperature=0.3)
32
+ console.print()
33
+ console.print(str(response))
34
+ except Exception as e:
35
+ console.print(f"[orbit.error]Error: {e}[/]")