oy-cli 0.4.2__tar.gz → 0.4.3b2__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 (33) hide show
  1. oy_cli-0.4.3b2/PKG-INFO +196 -0
  2. oy_cli-0.4.3b2/README.md +171 -0
  3. oy_cli-0.4.3b2/oy_cli/__init__.py +5 -0
  4. oy_cli-0.4.3b2/oy_cli/__main__.py +3 -0
  5. oy_cli-0.4.3b2/oy_cli/agent.py +486 -0
  6. oy_cli-0.4.3b2/oy_cli/aws_sigv4.py +123 -0
  7. oy_cli-0.4.3b2/oy_cli/cli.py +756 -0
  8. oy_cli-0.4.3b2/oy_cli/providers.py +1968 -0
  9. oy_cli-0.4.3b2/oy_cli/runtime.py +1086 -0
  10. oy_cli-0.4.3b2/oy_cli/session_text.toml +67 -0
  11. oy_cli-0.4.3b2/oy_cli/tools.py +1628 -0
  12. oy_cli-0.4.3b2/oy_cli.egg-info/PKG-INFO +196 -0
  13. {oy_cli-0.4.2 → oy_cli-0.4.3b2}/oy_cli.egg-info/SOURCES.txt +8 -5
  14. oy_cli-0.4.3b2/oy_cli.egg-info/entry_points.txt +2 -0
  15. oy_cli-0.4.3b2/oy_cli.egg-info/requires.txt +11 -0
  16. {oy_cli-0.4.2 → oy_cli-0.4.3b2}/pyproject.toml +14 -12
  17. oy_cli-0.4.3b2/tests/test_suite.py +656 -0
  18. oy_cli-0.4.2/PKG-INFO +0 -257
  19. oy_cli-0.4.2/README.md +0 -233
  20. oy_cli-0.4.2/oy_cli/README.md +0 -233
  21. oy_cli-0.4.2/oy_cli/__init__.py +0 -2690
  22. oy_cli-0.4.2/oy_cli/providers.py +0 -2018
  23. oy_cli-0.4.2/oy_cli/shim.py +0 -286
  24. oy_cli-0.4.2/oy_cli.egg-info/PKG-INFO +0 -257
  25. oy_cli-0.4.2/oy_cli.egg-info/entry_points.txt +0 -2
  26. oy_cli-0.4.2/oy_cli.egg-info/requires.txt +0 -10
  27. oy_cli-0.4.2/tests/test_async_cleanup.py +0 -83
  28. oy_cli-0.4.2/tests/test_oy_cli.py +0 -820
  29. oy_cli-0.4.2/tests/test_shim.py +0 -463
  30. {oy_cli-0.4.2 → oy_cli-0.4.3b2}/LICENSE +0 -0
  31. {oy_cli-0.4.2 → oy_cli-0.4.3b2}/oy_cli.egg-info/dependency_links.txt +0 -0
  32. {oy_cli-0.4.2 → oy_cli-0.4.3b2}/oy_cli.egg-info/top_level.txt +0 -0
  33. {oy_cli-0.4.2 → oy_cli-0.4.3b2}/setup.cfg +0 -0
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.4
2
+ Name: oy-cli
3
+ Version: 0.4.3b2
4
+ Summary: Tiny local coding CLI with a small tool surface
5
+ Author: oy-cli contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/wagov-dtt/oy-cli
8
+ Project-URL: Repository, https://github.com/wagov-dtt/oy-cli
9
+ Project-URL: Issues, https://github.com/wagov-dtt/oy-cli/issues
10
+ Requires-Python: >=3.13
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: defopt>=7.0.0
14
+ Requires-Dist: markdownify>=1.2.0
15
+ Requires-Dist: pygments>=2.19.0
16
+ Requires-Dist: tiktoken>=0.7.0
17
+ Requires-Dist: tenacity>=9.0.0
18
+ Requires-Dist: toons>=0.5.3
19
+ Requires-Dist: prompt-toolkit>=3.0.50
20
+ Requires-Dist: regex>=2026.0.0
21
+ Requires-Dist: pathspec>=0.12.1
22
+ Requires-Dist: zstandard>=0.23.0
23
+ Requires-Dist: pygount>=3.0.0
24
+ Dynamic: license-file
25
+
26
+ # oy-cli
27
+
28
+ [![PyPI](https://img.shields.io/pypi/v/oy-cli)](https://pypi.org/project/oy-cli/)
29
+
30
+ **AI coding assistant for your shell.** Reads files, searches content, and runs commands.
31
+
32
+ ```bash
33
+ uv tool install oy-cli
34
+ oy "add docstrings to public functions"
35
+ ```
36
+
37
+ ## Examples
38
+
39
+ ```bash
40
+ # Basic usage
41
+ oy "inspect the main module and suggest improvements"
42
+
43
+ # Work in a specific directory
44
+ OY_ROOT=./my-project oy "fix the failing tests"
45
+
46
+ # Non-interactive mode (CI/pipelines)
47
+ echo "update the changelog" | OY_NON_INTERACTIVE=1 oy
48
+
49
+ # Security audit
50
+ oy audit
51
+ oy audit "focus on authentication"
52
+ ```
53
+
54
+ ## Commands
55
+
56
+ ```bash
57
+ oy "prompt" # Run with a prompt (default)
58
+ oy chat # Interactive multi-turn session
59
+ oy audit # Security audit against OWASP ASVS/MASVS
60
+ oy model # Show current model, pick model from available endpoints
61
+ oy --help # Show all commands
62
+ ```
63
+
64
+ ## Why This Exists
65
+
66
+ `oy` is small, auditable, and built around a narrow tool surface.
67
+
68
+ **Design goals:** small auditable codebase, minimal tool surface,
69
+ OpenAI-completions-focused CLI loop, multiple backends behind shims,
70
+ new session each run, and explicit checkpoints when needed.
71
+
72
+ ## Session Text and Prompts
73
+
74
+ All text that is sent as part of model sessions lives in [`oy_cli/session_text.toml`](oy_cli/session_text.toml).
75
+
76
+ That includes:
77
+
78
+ - base system prompt text
79
+ - interactive/non-interactive prompt suffixes
80
+ - audit prompt text
81
+ - research-only `/ask` suffix
82
+ - transcript compaction text (`Current todo list`, omitted-history note, TOON packed-history note)
83
+ - built-in tool descriptions exposed to the model
84
+
85
+ Code that reads and composes this content now lives mainly in [`oy_cli/runtime.py`](oy_cli/runtime.py), with transcript/agent flow in [`oy_cli/agent.py`](oy_cli/agent.py) and CLI entrypoints in [`oy_cli/cli.py`](oy_cli/cli.py).
86
+
87
+ ## Configuration
88
+
89
+ **Environment variables:**
90
+
91
+ | Variable | Purpose |
92
+ |----------|---------|
93
+ | `OY_MODEL` | Override model for this session (bare name or `shim:model`) |
94
+ | `OY_SHIM` | Force a specific shim: `openai`, `codex`, `copilot`, `opencode`, `opencode-go`, or `bedrock-mantle` |
95
+ | `OY_NON_INTERACTIVE` | Set to `1` to disable approval/checkpoint pauses |
96
+ | `OY_ROOT` | Run against different workspace |
97
+ | `OY_SYSTEM_FILE` | Append extra system instructions |
98
+ | `OY_CONFIG` | Override config path (default: `~/.config/oy/config.json`) |
99
+
100
+ **Config file** (`~/.config/oy/config.json`):
101
+ ```json
102
+ {"shim": "openai", "model": "glm-5"}
103
+ ```
104
+
105
+ The `shim` field pins which backend to use regardless of what else is signed in.
106
+ Use `oy model <filter>` to pick interactively; it merges models from available
107
+ signed-in shims into a single list using `shim:model` prefixes.
108
+
109
+ On first run, if no model is configured, `oy` prompts you to pick one from
110
+ the available backends. Set `OY_MODEL`, `OY_SHIM`, or save a config with
111
+ `oy model` to pin behavior.
112
+
113
+ **Model notes:** From testing, `glm-5` balances intelligence,
114
+ cost, and tool-use ability. `kimi-k2.5` is another option.
115
+ The [Artificial Analysis Comparison of Open Source Models](https://artificialanalysis.ai/models/open-source)
116
+ is a reference.
117
+
118
+ ## Requirements
119
+
120
+ - Python 3.13+
121
+ - `bash`
122
+ - OpenAI API key or compatible endpoint credentials, Codex local auth, Copilot auth, OpenCode auth, or AWS CLI configured for Bedrock Mantle
123
+
124
+ ## Installation
125
+
126
+ ```bash
127
+ uv tool install oy-cli # Preferred
128
+ pip install oy-cli # Alternative
129
+ ```
130
+
131
+ ## Development
132
+
133
+ For local development, linting, tests, and builds, use `uv`.
134
+ Do not run bare `pytest`, `ruff`, or `pip install -e .` commands in this repo.
135
+
136
+ ```bash
137
+ uv sync
138
+ uv run ruff format .
139
+ uv run ruff check .
140
+ uv run python -m pytest tests/ -v
141
+ uv run oy --help
142
+ uv build
143
+ ```
144
+
145
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the contributor workflow.
146
+
147
+ ## Authentication
148
+
149
+ **OpenAI:**
150
+ ```bash
151
+ export OPENAI_API_KEY=sk-...
152
+ ```
153
+
154
+ For OpenAI-compatible endpoints:
155
+ ```bash
156
+ export OPENAI_BASE_URL=https://your-endpoint.example/v1
157
+ export OPENAI_API_KEY=...
158
+ ```
159
+
160
+ Copilot and Codex (OpenAI) creds are introspected
161
+ and used, if creds are available `oy model` will show them in the model list.
162
+
163
+ **AWS Bedrock Mantle:** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
164
+ ```bash
165
+ export AWS_PROFILE=my-profile
166
+ export AWS_REGION=us-west-2
167
+ ```
168
+
169
+ ## Troubleshooting
170
+
171
+ **"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`, authenticate `gh` for Copilot, run `opencode auth`, or configure AWS CLI (`aws configure`) for Bedrock Mantle.
172
+
173
+ **"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
174
+
175
+ **"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser`.
176
+
177
+ ## Security
178
+
179
+ `oy` can run shell commands and modify files with your permissions. Treat it like any other local automation tool.
180
+
181
+ Recommended:
182
+ - run in a repo or workspace you trust
183
+ - mount only needed directories in containers
184
+ - avoid exposing long-lived secrets in the environment
185
+ - review generated changes before shipping
186
+
187
+ **Protections:** workspace-bound file access for built-in file tools and default SDK credential flows for supported providers.
188
+
189
+ ## Links
190
+
191
+ - [Issues](ISSUES.md) - Known issues and audit findings
192
+ - [Contributing](CONTRIBUTING.md) - Development and release notes
193
+
194
+ ## License
195
+
196
+ Apache License 2.0
@@ -0,0 +1,171 @@
1
+ # oy-cli
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/oy-cli)](https://pypi.org/project/oy-cli/)
4
+
5
+ **AI coding assistant for your shell.** Reads files, searches content, and runs commands.
6
+
7
+ ```bash
8
+ uv tool install oy-cli
9
+ oy "add docstrings to public functions"
10
+ ```
11
+
12
+ ## Examples
13
+
14
+ ```bash
15
+ # Basic usage
16
+ oy "inspect the main module and suggest improvements"
17
+
18
+ # Work in a specific directory
19
+ OY_ROOT=./my-project oy "fix the failing tests"
20
+
21
+ # Non-interactive mode (CI/pipelines)
22
+ echo "update the changelog" | OY_NON_INTERACTIVE=1 oy
23
+
24
+ # Security audit
25
+ oy audit
26
+ oy audit "focus on authentication"
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ ```bash
32
+ oy "prompt" # Run with a prompt (default)
33
+ oy chat # Interactive multi-turn session
34
+ oy audit # Security audit against OWASP ASVS/MASVS
35
+ oy model # Show current model, pick model from available endpoints
36
+ oy --help # Show all commands
37
+ ```
38
+
39
+ ## Why This Exists
40
+
41
+ `oy` is small, auditable, and built around a narrow tool surface.
42
+
43
+ **Design goals:** small auditable codebase, minimal tool surface,
44
+ OpenAI-completions-focused CLI loop, multiple backends behind shims,
45
+ new session each run, and explicit checkpoints when needed.
46
+
47
+ ## Session Text and Prompts
48
+
49
+ All text that is sent as part of model sessions lives in [`oy_cli/session_text.toml`](oy_cli/session_text.toml).
50
+
51
+ That includes:
52
+
53
+ - base system prompt text
54
+ - interactive/non-interactive prompt suffixes
55
+ - audit prompt text
56
+ - research-only `/ask` suffix
57
+ - transcript compaction text (`Current todo list`, omitted-history note, TOON packed-history note)
58
+ - built-in tool descriptions exposed to the model
59
+
60
+ Code that reads and composes this content now lives mainly in [`oy_cli/runtime.py`](oy_cli/runtime.py), with transcript/agent flow in [`oy_cli/agent.py`](oy_cli/agent.py) and CLI entrypoints in [`oy_cli/cli.py`](oy_cli/cli.py).
61
+
62
+ ## Configuration
63
+
64
+ **Environment variables:**
65
+
66
+ | Variable | Purpose |
67
+ |----------|---------|
68
+ | `OY_MODEL` | Override model for this session (bare name or `shim:model`) |
69
+ | `OY_SHIM` | Force a specific shim: `openai`, `codex`, `copilot`, `opencode`, `opencode-go`, or `bedrock-mantle` |
70
+ | `OY_NON_INTERACTIVE` | Set to `1` to disable approval/checkpoint pauses |
71
+ | `OY_ROOT` | Run against different workspace |
72
+ | `OY_SYSTEM_FILE` | Append extra system instructions |
73
+ | `OY_CONFIG` | Override config path (default: `~/.config/oy/config.json`) |
74
+
75
+ **Config file** (`~/.config/oy/config.json`):
76
+ ```json
77
+ {"shim": "openai", "model": "glm-5"}
78
+ ```
79
+
80
+ The `shim` field pins which backend to use regardless of what else is signed in.
81
+ Use `oy model <filter>` to pick interactively; it merges models from available
82
+ signed-in shims into a single list using `shim:model` prefixes.
83
+
84
+ On first run, if no model is configured, `oy` prompts you to pick one from
85
+ the available backends. Set `OY_MODEL`, `OY_SHIM`, or save a config with
86
+ `oy model` to pin behavior.
87
+
88
+ **Model notes:** From testing, `glm-5` balances intelligence,
89
+ cost, and tool-use ability. `kimi-k2.5` is another option.
90
+ The [Artificial Analysis Comparison of Open Source Models](https://artificialanalysis.ai/models/open-source)
91
+ is a reference.
92
+
93
+ ## Requirements
94
+
95
+ - Python 3.13+
96
+ - `bash`
97
+ - OpenAI API key or compatible endpoint credentials, Codex local auth, Copilot auth, OpenCode auth, or AWS CLI configured for Bedrock Mantle
98
+
99
+ ## Installation
100
+
101
+ ```bash
102
+ uv tool install oy-cli # Preferred
103
+ pip install oy-cli # Alternative
104
+ ```
105
+
106
+ ## Development
107
+
108
+ For local development, linting, tests, and builds, use `uv`.
109
+ Do not run bare `pytest`, `ruff`, or `pip install -e .` commands in this repo.
110
+
111
+ ```bash
112
+ uv sync
113
+ uv run ruff format .
114
+ uv run ruff check .
115
+ uv run python -m pytest tests/ -v
116
+ uv run oy --help
117
+ uv build
118
+ ```
119
+
120
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the contributor workflow.
121
+
122
+ ## Authentication
123
+
124
+ **OpenAI:**
125
+ ```bash
126
+ export OPENAI_API_KEY=sk-...
127
+ ```
128
+
129
+ For OpenAI-compatible endpoints:
130
+ ```bash
131
+ export OPENAI_BASE_URL=https://your-endpoint.example/v1
132
+ export OPENAI_API_KEY=...
133
+ ```
134
+
135
+ Copilot and Codex (OpenAI) creds are introspected
136
+ and used, if creds are available `oy model` will show them in the model list.
137
+
138
+ **AWS Bedrock Mantle:** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
139
+ ```bash
140
+ export AWS_PROFILE=my-profile
141
+ export AWS_REGION=us-west-2
142
+ ```
143
+
144
+ ## Troubleshooting
145
+
146
+ **"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`, authenticate `gh` for Copilot, run `opencode auth`, or configure AWS CLI (`aws configure`) for Bedrock Mantle.
147
+
148
+ **"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
149
+
150
+ **"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser`.
151
+
152
+ ## Security
153
+
154
+ `oy` can run shell commands and modify files with your permissions. Treat it like any other local automation tool.
155
+
156
+ Recommended:
157
+ - run in a repo or workspace you trust
158
+ - mount only needed directories in containers
159
+ - avoid exposing long-lived secrets in the environment
160
+ - review generated changes before shipping
161
+
162
+ **Protections:** workspace-bound file access for built-in file tools and default SDK credential flows for supported providers.
163
+
164
+ ## Links
165
+
166
+ - [Issues](ISSUES.md) - Known issues and audit findings
167
+ - [Contributing](CONTRIBUTING.md) - Development and release notes
168
+
169
+ ## License
170
+
171
+ Apache License 2.0
@@ -0,0 +1,5 @@
1
+ from __future__ import annotations
2
+
3
+ from . import agent, cli, providers, runtime, tools
4
+
5
+ __all__ = ["agent", "cli", "providers", "runtime", "tools"]
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())