oshell 0.1.1__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.
- oshell-0.1.1/.github/ISSUE_TEMPLATE/bug_report.yml +64 -0
- oshell-0.1.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
- oshell-0.1.1/.github/ISSUE_TEMPLATE/feature_request.yml +27 -0
- oshell-0.1.1/.github/PULL_REQUEST_TEMPLATE.md +21 -0
- oshell-0.1.1/.github/workflows/ci.yml +38 -0
- oshell-0.1.1/.github/workflows/publish.yml +29 -0
- oshell-0.1.1/.gitignore +27 -0
- oshell-0.1.1/CHANGELOG.md +42 -0
- oshell-0.1.1/CONTRIBUTING.md +58 -0
- oshell-0.1.1/LICENSE +21 -0
- oshell-0.1.1/PKG-INFO +286 -0
- oshell-0.1.1/README.md +260 -0
- oshell-0.1.1/demo.gif +0 -0
- oshell-0.1.1/demo.tape +49 -0
- oshell-0.1.1/pyproject.toml +48 -0
- oshell-0.1.1/src/oshell/__init__.py +3 -0
- oshell-0.1.1/src/oshell/agent.py +146 -0
- oshell-0.1.1/src/oshell/cli.py +836 -0
- oshell-0.1.1/src/oshell/config.py +91 -0
- oshell-0.1.1/src/oshell/history.py +57 -0
- oshell-0.1.1/src/oshell/media.py +188 -0
- oshell-0.1.1/src/oshell/media_agent.py +55 -0
- oshell-0.1.1/src/oshell/personas.py +90 -0
- oshell-0.1.1/src/oshell/providers.py +275 -0
- oshell-0.1.1/src/oshell/retrieval.py +180 -0
- oshell-0.1.1/src/oshell/storyboard.py +163 -0
- oshell-0.1.1/src/oshell/tools.py +150 -0
- oshell-0.1.1/tests/conftest.py +9 -0
- oshell-0.1.1/tests/test_agent.py +93 -0
- oshell-0.1.1/tests/test_config.py +60 -0
- oshell-0.1.1/tests/test_personas.py +64 -0
- oshell-0.1.1/tests/test_providers.py +56 -0
- oshell-0.1.1/tests/test_retrieval.py +36 -0
- oshell-0.1.1/tests/test_storyboard.py +35 -0
- oshell-0.1.1/tests/test_tools.py +74 -0
- oshell-0.1.1/tools/make_demo.py +190 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report something that isn't working
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["bug"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: Thanks for taking the time to file a bug report!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: what-happened
|
|
11
|
+
attributes:
|
|
12
|
+
label: What happened?
|
|
13
|
+
description: A clear description of the bug.
|
|
14
|
+
placeholder: When I run `ai ...`, I get ...
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: reproduce
|
|
19
|
+
attributes:
|
|
20
|
+
label: Steps to reproduce
|
|
21
|
+
placeholder: |
|
|
22
|
+
1. Run `ai ...`
|
|
23
|
+
2. ...
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: expected
|
|
28
|
+
attributes:
|
|
29
|
+
label: Expected behavior
|
|
30
|
+
validations:
|
|
31
|
+
required: true
|
|
32
|
+
- type: dropdown
|
|
33
|
+
id: provider
|
|
34
|
+
attributes:
|
|
35
|
+
label: Provider
|
|
36
|
+
options:
|
|
37
|
+
- Ollama
|
|
38
|
+
- OpenAI
|
|
39
|
+
- Groq
|
|
40
|
+
- Gemini
|
|
41
|
+
- Anthropic
|
|
42
|
+
- Other / not sure
|
|
43
|
+
validations:
|
|
44
|
+
required: true
|
|
45
|
+
- type: input
|
|
46
|
+
id: version
|
|
47
|
+
attributes:
|
|
48
|
+
label: oshell version
|
|
49
|
+
description: Output of `ai --version` (or the version in pyproject.toml).
|
|
50
|
+
placeholder: "0.1.0"
|
|
51
|
+
validations:
|
|
52
|
+
required: true
|
|
53
|
+
- type: input
|
|
54
|
+
id: os
|
|
55
|
+
attributes:
|
|
56
|
+
label: OS and Python version
|
|
57
|
+
placeholder: "Windows 11, Python 3.12"
|
|
58
|
+
validations:
|
|
59
|
+
required: true
|
|
60
|
+
- type: textarea
|
|
61
|
+
id: logs
|
|
62
|
+
attributes:
|
|
63
|
+
label: Logs / traceback
|
|
64
|
+
render: shell
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an idea for oshell
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
id: problem
|
|
8
|
+
attributes:
|
|
9
|
+
label: What problem does this solve?
|
|
10
|
+
description: Describe the use case or pain point.
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: solution
|
|
15
|
+
attributes:
|
|
16
|
+
label: Proposed solution
|
|
17
|
+
description: What would you like oshell to do?
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: alternatives
|
|
22
|
+
attributes:
|
|
23
|
+
label: Alternatives considered
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: context
|
|
26
|
+
attributes:
|
|
27
|
+
label: Additional context
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What does this PR change and why? -->
|
|
4
|
+
|
|
5
|
+
## Related issue
|
|
6
|
+
|
|
7
|
+
<!-- e.g. Closes #123 -->
|
|
8
|
+
|
|
9
|
+
## Type of change
|
|
10
|
+
|
|
11
|
+
- [ ] Bug fix
|
|
12
|
+
- [ ] New feature
|
|
13
|
+
- [ ] Documentation
|
|
14
|
+
- [ ] Refactor / chore
|
|
15
|
+
|
|
16
|
+
## Checklist
|
|
17
|
+
|
|
18
|
+
- [ ] Tests pass (`pytest`)
|
|
19
|
+
- [ ] Added/updated tests where relevant
|
|
20
|
+
- [ ] Updated `CHANGELOG.md`
|
|
21
|
+
- [ ] Updated docs/README if behavior changed
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test (Python ${{ matrix.python-version }} / ${{ matrix.os }})
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
17
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install package + dev deps
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
python -m pip install -e ".[dev]"
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: pytest -q
|
|
34
|
+
|
|
35
|
+
- name: Smoke-test the CLI
|
|
36
|
+
run: |
|
|
37
|
+
oshell --version
|
|
38
|
+
oshell persona list
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment:
|
|
11
|
+
name: pypi
|
|
12
|
+
url: https://pypi.org/p/oshell
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write # for trusted publishing (no API token needed)
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Build distributions
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip build
|
|
26
|
+
python -m build
|
|
27
|
+
|
|
28
|
+
- name: Publish to PyPI
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
oshell-0.1.1/.gitignore
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.venv/
|
|
9
|
+
venv/
|
|
10
|
+
env/
|
|
11
|
+
|
|
12
|
+
# Packaging
|
|
13
|
+
*.whl
|
|
14
|
+
|
|
15
|
+
# Testing
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# IDE / OS
|
|
21
|
+
.vscode/
|
|
22
|
+
.idea/
|
|
23
|
+
.DS_Store
|
|
24
|
+
|
|
25
|
+
# oshell local data (in case run from repo)
|
|
26
|
+
sessions/
|
|
27
|
+
config.json
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.1] - 2026-06-12
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Renamed the project to **oshell**; install with `pip install oshell`.
|
|
14
|
+
- CLI commands are now `oshell` and the shortcut `ai`.
|
|
15
|
+
- Environment variables renamed to `OSHELL_PROVIDER` / `OSHELL_MODEL`.
|
|
16
|
+
- Repository moved to https://github.com/djaferiurim/oshell.
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-06-11
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **Chat** β streaming terminal chat with live Markdown rendering, history, slash
|
|
22
|
+
commands, and stdin pipe support.
|
|
23
|
+
- **Coding agent** β sandboxed ReAct agent (`ai agent`) with read/write/list/run
|
|
24
|
+
tools, approval prompts, and `--yolo` auto-approve.
|
|
25
|
+
- **Interactive agent mode** (`ai agent -i`) β keeps conversation state across
|
|
26
|
+
tasks so follow-ups remember earlier work.
|
|
27
|
+
- **Media generation** β `ai image` and `ai video` with an LLM prompt-enhancing
|
|
28
|
+
media agent.
|
|
29
|
+
- **Storyboard mode** (`ai storyboard`) β plans scenes, renders an image per
|
|
30
|
+
scene, and stitches them into an MP4 via ffmpeg.
|
|
31
|
+
- **Providers** β Ollama, OpenAI, Groq, Gemini, and Anthropic.
|
|
32
|
+
- **Personas** β built-in presets plus custom user personas.
|
|
33
|
+
- **Natural-language shell** (`ai do`) β turns plain English into shell commands
|
|
34
|
+
with confirmation.
|
|
35
|
+
- **Local RAG** β `ai index` / `ai ask` over your files with pure-Python cosine
|
|
36
|
+
search.
|
|
37
|
+
- Test suite (pytest), GitHub Actions CI matrix, PyPI publish workflow, demo
|
|
38
|
+
tape, and contributing guide.
|
|
39
|
+
|
|
40
|
+
[Unreleased]: https://github.com/djaferiurim/oshell/compare/v0.1.1...HEAD
|
|
41
|
+
[0.1.1]: https://github.com/djaferiurim/oshell/compare/v0.1.0...v0.1.1
|
|
42
|
+
[0.1.0]: https://github.com/djaferiurim/oshell/releases/tag/v0.1.0
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Contributing to oshell
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in making oshell better! π
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/djaferiurim/oshell
|
|
9
|
+
cd oshell
|
|
10
|
+
pip install -e ".[dev]"
|
|
11
|
+
pytest # make sure the suite is green
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Project layout
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
src/oshell/
|
|
18
|
+
cli.py # Typer commands & entry point
|
|
19
|
+
config.py # config loading / persistence
|
|
20
|
+
providers.py # LLM backends (OpenAI, Ollama, Anthropic, Groq, Gemini)
|
|
21
|
+
agent.py # autonomous coding agent (ReAct loop)
|
|
22
|
+
tools.py # sandboxed file/command tools for the agent
|
|
23
|
+
media.py # image (OpenAI) + video (Replicate) generation
|
|
24
|
+
media_agent.py # LLM prompt-enhancement for media
|
|
25
|
+
storyboard.py # multi-scene story β images β stitched video
|
|
26
|
+
retrieval.py # local RAG (index + search)
|
|
27
|
+
personas.py # system-prompt presets
|
|
28
|
+
tests/ # pytest suite
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## How to contribute
|
|
32
|
+
|
|
33
|
+
1. **Open an issue first** for anything non-trivial so we can align on the approach.
|
|
34
|
+
2. Create a branch: `git checkout -b feature/my-thing`.
|
|
35
|
+
3. Make your change with a focused commit history.
|
|
36
|
+
4. Add or update tests in `tests/`.
|
|
37
|
+
5. Run `pytest` and make sure everything passes.
|
|
38
|
+
6. Open a pull request describing the *why*, not just the *what*.
|
|
39
|
+
|
|
40
|
+
## Guidelines
|
|
41
|
+
|
|
42
|
+
- Keep dependencies minimal β oshell's appeal is being lightweight.
|
|
43
|
+
- Match the existing style (type hints, short docstrings, `rich` for output).
|
|
44
|
+
- New network calls should fail gracefully with a clear, actionable message.
|
|
45
|
+
- Anything that writes files or runs commands must respect the approval flow.
|
|
46
|
+
|
|
47
|
+
## Good first issues
|
|
48
|
+
|
|
49
|
+
- π¨ Add a new built-in **persona** preset.
|
|
50
|
+
- π Add another **provider adapter** (e.g. Mistral, Cohere, OpenRouter).
|
|
51
|
+
- π§° Add a new **agent tool** (e.g. `apply_patch`, `search_files`).
|
|
52
|
+
- π¬ Add a new **slash command** to the interactive chat.
|
|
53
|
+
- π§ͺ Increase **test coverage** for `cli.py` helpers.
|
|
54
|
+
- π Improve docs, examples, or the demo tape.
|
|
55
|
+
|
|
56
|
+
## Code of conduct
|
|
57
|
+
|
|
58
|
+
Be kind and constructive. We're all here to build something fun and useful.
|
oshell-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 djaferiurim
|
|
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.
|
oshell-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: oshell
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A fast, beautiful terminal chat for any LLM β OpenAI or local Ollama. Zero config.
|
|
5
|
+
Project-URL: Homepage, https://github.com/djaferiurim/oshell
|
|
6
|
+
Project-URL: Issues, https://github.com/djaferiurim/oshell/issues
|
|
7
|
+
Author: djaferiurim
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai,chat,chatgpt,cli,llm,ollama,openai,terminal
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Utilities
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Requires-Dist: httpx>=0.27
|
|
19
|
+
Requires-Dist: platformdirs>=4.0
|
|
20
|
+
Requires-Dist: rich>=13.7
|
|
21
|
+
Requires-Dist: typer>=0.12
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
|
|
29
|
+
# π oshell
|
|
30
|
+
|
|
31
|
+
### Chat with any LLM, right from your terminal. Local or cloud. Zero config.
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/oshell/)
|
|
34
|
+
[](https://www.python.org/)
|
|
35
|
+
[](https://github.com/djaferiurim/oshell/actions/workflows/ci.yml)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
[](#contributing)
|
|
38
|
+
|
|
39
|
+
**One command. Streaming answers. Markdown rendering. Pipe-friendly. Works offline with [Ollama](https://ollama.com) or online with OpenAI.**
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
$ ai "explain monads like I'm five"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> A monad is like a **box** π¦ you put a value in. The box knows how to
|
|
52
|
+
> open itself, do something with the value, and put the result back β
|
|
53
|
+
> so you never have to unwrap it by handβ¦
|
|
54
|
+
|
|
55
|
+
*(answer streams in live, rendered as Markdown)*
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## β¨ Why oshell?
|
|
60
|
+
|
|
61
|
+
- π **Instant** β ask a question without leaving your shell
|
|
62
|
+
- π€ **Coding agent** β it can read, write, and run code to finish a task for you
|
|
63
|
+
- π¬ **Media agent** β generate images & video, or a multi-scene storyboard
|
|
64
|
+
- π§ **Chat with your files** β index a folder and ask questions (local RAG)
|
|
65
|
+
- πͺ **`ai do`** β turn plain English into a shell command, then run it
|
|
66
|
+
- π **Personas** β swap the assistant's style with named presets
|
|
67
|
+
- π **Provider-agnostic** β OpenAI, Anthropic, Groq, Gemini, or local Ollama
|
|
68
|
+
- π **Private by default** β runs fully offline with Ollama, nothing leaves your machine
|
|
69
|
+
- π¨ **Beautiful** β live streaming + rich Markdown in the terminal
|
|
70
|
+
- πͺ **Pipe-friendly** β `cat error.log | ai "what broke?"`
|
|
71
|
+
- πΎ **Remembers** β every chat is saved as a session you can revisit
|
|
72
|
+
- πͺΆ **Tiny** β pure Python, four small dependencies, no Node, no Docker
|
|
73
|
+
|
|
74
|
+
## π¦ Install
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install oshell
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
That's it. You get two commands: `oshell` and the shortcut `ai`.
|
|
81
|
+
|
|
82
|
+
## β‘ Quickstart
|
|
83
|
+
|
|
84
|
+
### Option A β fully local & free (Ollama)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 1. Install Ollama: https://ollama.com
|
|
88
|
+
ollama pull llama3.2
|
|
89
|
+
|
|
90
|
+
# 2. Chat!
|
|
91
|
+
ai "write a haiku about garbage collection"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Option B β OpenAI
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
export OPENAI_API_KEY="sk-..."
|
|
98
|
+
ai --provider openai --model gpt-4o-mini "refactor this regex: ^\d{4}-\d{2}$"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## π§βπ» Usage
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Interactive chat (type /help inside for commands)
|
|
105
|
+
ai
|
|
106
|
+
|
|
107
|
+
# One-shot question
|
|
108
|
+
ai "what's the time complexity of quicksort?"
|
|
109
|
+
|
|
110
|
+
# Pipe context in from anything
|
|
111
|
+
cat main.py | ai "find the bug"
|
|
112
|
+
git diff | ai "write a commit message"
|
|
113
|
+
|
|
114
|
+
# Pick a provider / model on the fly
|
|
115
|
+
ai -p openai -m gpt-4o "summarize the news"
|
|
116
|
+
ai -p anthropic -m claude-3-5-sonnet-latest "explain this"
|
|
117
|
+
ai -p groq -m llama-3.3-70b-versatile "fast answer please"
|
|
118
|
+
ai -p ollama -m qwen2.5-coder "optimize this loop"
|
|
119
|
+
|
|
120
|
+
# List available models
|
|
121
|
+
ai models
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Inside an interactive session
|
|
125
|
+
|
|
126
|
+
| Command | What it does |
|
|
127
|
+
| --------------- | ---------------------------------- |
|
|
128
|
+
| `/help` | Show available commands |
|
|
129
|
+
| `/clear` | Forget the conversation so far |
|
|
130
|
+
| `/system <txt>` | Change the system prompt on the go |
|
|
131
|
+
| `/exit` | Quit |
|
|
132
|
+
|
|
133
|
+
## π€ Coding agent
|
|
134
|
+
|
|
135
|
+
oshell ships with an autonomous **coding agent** that can read your files,write new ones, and run commands to complete a task β all sandboxed to the
|
|
136
|
+
current directory, and asking before each write or command.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Let the agent build something for you
|
|
140
|
+
ai agent "create a FastAPI hello-world app with a /health endpoint"
|
|
141
|
+
|
|
142
|
+
# Point it at a specific folder
|
|
143
|
+
ai agent -d ./my-project "add unit tests for utils.py and run them"
|
|
144
|
+
|
|
145
|
+
# Skip confirmations (use with care!)
|
|
146
|
+
ai agent --yolo "fix the failing tests"
|
|
147
|
+
|
|
148
|
+
# Interactive mode β keep giving follow-up tasks, agent remembers context
|
|
149
|
+
ai agent -i
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
How it works: the agent thinks step-by-step and uses a small set of tools β
|
|
153
|
+
`read_file`, `write_file`, `list_dir`, and `run_command`. Every file write and
|
|
154
|
+
shell command shows you a preview and waits for your **yes** (unless `--yolo`).
|
|
155
|
+
It's confined to the workspace root, so it can't touch files elsewhere.
|
|
156
|
+
|
|
157
|
+
> π **Safety first.** The agent cannot escape the workspace directory, and
|
|
158
|
+
> mutating actions require your approval by default.
|
|
159
|
+
|
|
160
|
+
## π¬ Media agent
|
|
161
|
+
|
|
162
|
+
Turn a one-line brief into polished media. The agent first uses the chat LLM
|
|
163
|
+
to **enhance** your brief into a detailed, model-ready prompt (composition,
|
|
164
|
+
lighting, camera, moodβ¦), then generates the image or video.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Images (OpenAI gpt-image-1 / DALLΒ·E 3)
|
|
168
|
+
ai image "a fox in a misty forest at dawn"
|
|
169
|
+
ai image -n 3 -s 1024x1536 "retro sci-fi book cover"
|
|
170
|
+
ai image --raw "exact prompt, no LLM rewrite"
|
|
171
|
+
|
|
172
|
+
# Video (Replicate text-to-video models)
|
|
173
|
+
ai video "a drone shot flying over a neon cyberpunk city at night"
|
|
174
|
+
ai video -m minimax/video-01 "timelapse of a blooming flower"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Generated files are saved to your Pictures folder under `oshell/` (configurable
|
|
178
|
+
via `media_output_dir`).
|
|
179
|
+
|
|
180
|
+
**Setup**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Images reuse your OpenAI key:
|
|
184
|
+
export OPENAI_API_KEY="sk-..."
|
|
185
|
+
|
|
186
|
+
# Video uses Replicate:
|
|
187
|
+
export REPLICATE_API_TOKEN="r8_..."
|
|
188
|
+
# or: ai config set replicate_api_token r8_...
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
> π‘ Any text-to-video model on [Replicate](https://replicate.com/explore) works β
|
|
192
|
+
> just set `video_model` (e.g. `minimax/video-01`, `luma/ray`, etc.).
|
|
193
|
+
|
|
194
|
+
### π₯ Storyboard mode
|
|
195
|
+
|
|
196
|
+
Turn a one-line story into a multi-scene video. The LLM acts as a **director**,
|
|
197
|
+
breaking your brief into scenes, generating an image for each, then stitching
|
|
198
|
+
them into an MP4 (requires `ffmpeg` for the final stitch).
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
ai storyboard "a seed growing into a giant tree across the seasons"
|
|
202
|
+
ai storyboard -n 6 --seconds 3 "the history of computing in 6 frames"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Each scene image is saved too, so you get usable output even without ffmpeg.
|
|
206
|
+
|
|
207
|
+
## π§ Chat with your files (RAG)
|
|
208
|
+
|
|
209
|
+
Index a folder once, then ask questions answered from *your* content. Embeddings
|
|
210
|
+
run locally through Ollama (or OpenAI), and the vector store is plain JSON β no
|
|
211
|
+
heavy dependencies.
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# With Ollama, grab an embedding model first (one time):
|
|
215
|
+
ollama pull nomic-embed-text
|
|
216
|
+
|
|
217
|
+
ai index ./docs # build the index
|
|
218
|
+
ai ask "how do I configure logging?"
|
|
219
|
+
ai ask -k 8 "summarize the auth flow"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## πͺ Natural-language shell (`ai do`)
|
|
223
|
+
|
|
224
|
+
Describe what you want; oshell suggests the exact command and runs it after you
|
|
225
|
+
confirm.
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
ai do "compress all PNGs in this folder"
|
|
229
|
+
ai do "find the 5 largest files under /var/log"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
> The command is always shown and requires your **yes** before running.
|
|
233
|
+
|
|
234
|
+
## π Personas
|
|
235
|
+
|
|
236
|
+
Swap the assistant's behaviour with named presets (built-ins: `reviewer`,
|
|
237
|
+
`teacher`, `shell`, `rubber-duck`, `concise`, `pirate`).
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
ai --persona reviewer "look at this function" # one-off
|
|
241
|
+
ai persona list # see them all
|
|
242
|
+
ai persona use teacher # set a default
|
|
243
|
+
ai persona add legal "You are a contracts expert. Be precise."
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## βοΈ Configuration
|
|
247
|
+
|
|
248
|
+
Set defaults once and forget them:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
ai config set provider openai
|
|
252
|
+
ai config set model gpt-4o-mini
|
|
253
|
+
ai config set openai_api_key sk-...
|
|
254
|
+
ai config show
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Or use environment variables: `OPENAI_API_KEY`, `OPENAI_BASE_URL`,
|
|
258
|
+
`ANTHROPIC_API_KEY`, `GROQ_API_KEY`, `GEMINI_API_KEY`, `REPLICATE_API_TOKEN`,
|
|
259
|
+
`OLLAMA_HOST`, `OSHELL_PROVIDER`, `OSHELL_MODEL`.
|
|
260
|
+
|
|
261
|
+
> π‘ Because oshell speaks the OpenAI API, you can point `OPENAI_BASE_URL`
|
|
262
|
+
> at **any** compatible endpoint (Groq, Together, LM Studio, vLLMβ¦).
|
|
263
|
+
|
|
264
|
+
## π οΈ Development
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
git clone https://github.com/djaferiurim/oshell
|
|
268
|
+
cd oshell
|
|
269
|
+
pip install -e ".[dev]"
|
|
270
|
+
ai --version
|
|
271
|
+
|
|
272
|
+
# Run the test suite
|
|
273
|
+
pytest
|
|
274
|
+
|
|
275
|
+
# Regenerate the demo GIF (pure Python, no extra tools)
|
|
276
|
+
python tools/make_demo.py demo.gif
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## π€ Contributing
|
|
280
|
+
|
|
281
|
+
PRs and ideas welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, project
|
|
282
|
+
layout, and good first issues. Release notes live in [CHANGELOG.md](CHANGELOG.md).
|
|
283
|
+
|
|
284
|
+
## π License
|
|
285
|
+
|
|
286
|
+
MIT Β© djaferiurim
|