oy-cli 0.4.0__tar.gz → 0.4.2__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.
- {oy_cli-0.4.0 → oy_cli-0.4.2}/PKG-INFO +27 -15
- {oy_cli-0.4.0 → oy_cli-0.4.2}/README.md +24 -13
- oy_cli-0.4.2/oy_cli/README.md +233 -0
- oy_cli-0.4.0/oy_cli.py → oy_cli-0.4.2/oy_cli/__init__.py +737 -277
- {oy_cli-0.4.0 → oy_cli-0.4.2/oy_cli}/providers.py +236 -903
- {oy_cli-0.4.0 → oy_cli-0.4.2/oy_cli}/shim.py +19 -92
- {oy_cli-0.4.0 → oy_cli-0.4.2}/oy_cli.egg-info/PKG-INFO +27 -15
- {oy_cli-0.4.0 → oy_cli-0.4.2}/oy_cli.egg-info/SOURCES.txt +4 -3
- {oy_cli-0.4.0 → oy_cli-0.4.2}/oy_cli.egg-info/requires.txt +1 -0
- oy_cli-0.4.2/oy_cli.egg-info/top_level.txt +1 -0
- {oy_cli-0.4.0 → oy_cli-0.4.2}/pyproject.toml +11 -3
- {oy_cli-0.4.0 → oy_cli-0.4.2}/tests/test_async_cleanup.py +12 -10
- {oy_cli-0.4.0 → oy_cli-0.4.2}/tests/test_oy_cli.py +153 -25
- {oy_cli-0.4.0 → oy_cli-0.4.2}/tests/test_shim.py +97 -9
- oy_cli-0.4.0/oy_cli.egg-info/top_level.txt +0 -3
- {oy_cli-0.4.0 → oy_cli-0.4.2}/LICENSE +0 -0
- {oy_cli-0.4.0 → oy_cli-0.4.2}/oy_cli.egg-info/dependency_links.txt +0 -0
- {oy_cli-0.4.0 → oy_cli-0.4.2}/oy_cli.egg-info/entry_points.txt +0 -0
- {oy_cli-0.4.0 → oy_cli-0.4.2}/setup.cfg +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oy-cli
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Tiny local coding CLI with a small tool surface
|
|
5
5
|
Author: oy-cli contributors
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/wagov-dtt/oy-cli
|
|
8
8
|
Project-URL: Repository, https://github.com/wagov-dtt/oy-cli
|
|
9
9
|
Project-URL: Issues, https://github.com/wagov-dtt/oy-cli/issues
|
|
10
|
-
Requires-Python: >=3.
|
|
10
|
+
Requires-Python: >=3.13
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
Requires-Dist: boto3>=1.35.0
|
|
@@ -19,6 +19,7 @@ Requires-Dist: tiktoken>=0.7.0
|
|
|
19
19
|
Requires-Dist: tenacity>=9.0.0
|
|
20
20
|
Requires-Dist: msgspec>=0.20.0
|
|
21
21
|
Requires-Dist: headroom-ai>=0.4.6
|
|
22
|
+
Requires-Dist: prompt-toolkit>=3.0.50
|
|
22
23
|
Dynamic: license-file
|
|
23
24
|
|
|
24
25
|
# oy-cli
|
|
@@ -75,9 +76,18 @@ The system prompt is short. Tool semantics live with the tool definitions; the s
|
|
|
75
76
|
|
|
76
77
|
```markdown
|
|
77
78
|
You are oy, a coding cli with tools.
|
|
78
|
-
Inspect before editing with `read` for file content, `search` for regex
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
Inspect before editing with `read` for file content, `search` for regex
|
|
80
|
+
matches, and `list` for path discovery. For existing code changes, prefer
|
|
81
|
+
syntax-aware edits via `ast-grep` run through `bash`. Keep edits small,
|
|
82
|
+
auditable, and verified with `read`, `git diff`, and batch independent tool
|
|
83
|
+
calls.
|
|
84
|
+
Keep going until done or blocked; if blocked, say what you tried and next
|
|
85
|
+
steps.
|
|
86
|
+
Use grugbrain.dev approach for maintainability/simplicity, OWASP-minded
|
|
87
|
+
judgment for security, and performance-aware programming (Computer, Enhance!).
|
|
88
|
+
Use `webfetch` to pull in documentation or references when needed.
|
|
89
|
+
Use `todowrite` at the start of multi-step work to plan, and update it as
|
|
90
|
+
you go — it persists across context compaction so you won't lose your place.
|
|
81
91
|
```
|
|
82
92
|
|
|
83
93
|
### Interactive Appendix
|
|
@@ -100,9 +110,11 @@ Each tool description is passed directly to the model:
|
|
|
100
110
|
|------|-------------|
|
|
101
111
|
| `list` | List paths by calling `Path.glob(path)`. Defaults to `path: "*"`. Use `src/*` or `src/**/*.py` exactly like pathlib glob patterns. Returns sorted entries, one per line, with / for directories. |
|
|
102
112
|
| `read` | Read a file or directory. Files return line-numbered text. Directories return sorted entries, one per line, with / for directories. Use `offset` and `limit` for large files. |
|
|
103
|
-
| `bash` | Shell commands are easy to run. For edits, prefer `ast-grep` for precise search/replace, `scc` for code-count analysis, and `xh` for web/API interaction; pipe to `rg` or `yq` for filtering when useful. These tools are effective for their niches, guaranteed to be available during an `oy` run, and their current usage docs can be checked with `--help`. For inspection, prefer the `search` tool. Returns structured results with `command`, `exit_code`, `ok`, `output_format`, `output`, and `truncated`. JSON output is parsed when possible. |
|
|
113
|
+
| `bash` | Shell commands are easy to run. For edits, prefer `ast-grep` for precise search/replace, `scc` for code-count analysis, and `xh` for web/API interaction (or use the `webfetch` tool directly for simple fetches); pipe to `rg` or `yq` for filtering when useful. These tools are effective for their niches, guaranteed to be available during an `oy` run, and their current usage docs can be checked with `--help`. For inspection, prefer the `search` tool. Returns structured results with `command`, `exit_code`, `ok`, `output_format`, `output`, and `truncated`. JSON output is parsed when possible. |
|
|
104
114
|
| `search` | Search with ripgrep JSON output. Takes `pattern` and `path`, then passes any extra ripgrep flags from `args`, for example `pattern: 'needle', path: 'src', args: ['--glob', '*.py', '-i']`. `limit` only limits displayed results after ripgrep runs. |
|
|
105
115
|
| `ask` | Ask the user a question in interactive runs. Use for ambiguity or decisions. Provide choices. |
|
|
116
|
+
| `webfetch` | Fetch a URL over the web. Takes `url`, optional `method` (GET/HEAD/OPTIONS, default GET), and optional `headers` dict. Built on `xh`. Restricted to public addresses only (no localhost/private IPs) for safety. Returns response headers and body. Use for fetching documentation, APIs, or web content. |
|
|
117
|
+
| `todowrite` | Update the in-memory todo list. Takes `todos`: a list of `{id, task, status}` objects (status: pending/in_progress/done). Replaces the full list each call. Use to plan multi-step work, track progress, and stay on course — the list persists in context even when earlier messages are compacted. Returns the current list. |
|
|
106
118
|
|
|
107
119
|
**Output truncation:** tool output is clipped to preserve context window; `bash` summarizes output into a single `output` field and marks truncation with one `truncated` flag. When clipped, narrow the next query or use `search` with a tighter `path` instead of re-running broad inspection.
|
|
108
120
|
|
|
@@ -119,14 +131,15 @@ Each tool description is passed directly to the model:
|
|
|
119
131
|
```markdown
|
|
120
132
|
Audit the repo for security, unnecessary complexity, and major
|
|
121
133
|
performance issues, preserving project and human context.
|
|
134
|
+
Use `todowrite` to plan audit steps and track progress.
|
|
122
135
|
First read key markdown docs, then refresh or generate an audit
|
|
123
136
|
header at the top of ISSUES.md that includes the current date,
|
|
124
137
|
the latest Git commit reference, and a codebase summary
|
|
125
138
|
using tools like `scc`. Next, fetch the current OWASP
|
|
126
139
|
ASVS (or MASVS if more relevant) and grugbrain.dev guidelines
|
|
127
|
-
using `
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
using `webfetch`, inspect the codebase against these, and write or
|
|
141
|
+
merge prioritised findings (max 10-15) into the ISSUES.md file. Check
|
|
142
|
+
each link or reference carefully to make sure ids and links are accurate.
|
|
130
143
|
Ensure each finding is formatted to include its location, category
|
|
131
144
|
(security, complexity, or performance), standard reference, a clear
|
|
132
145
|
recommendation, and has a Status, if existing findings have been
|
|
@@ -146,7 +159,7 @@ OY_ROOT=./src oy audit # Audit specific directory
|
|
|
146
159
|
| Variable | Purpose |
|
|
147
160
|
|----------|---------|
|
|
148
161
|
| `OY_MODEL` | Override model for this session (bare name or `shim:model`) |
|
|
149
|
-
| `OY_SHIM` | Force a specific shim: `openai`, `codex`, `
|
|
162
|
+
| `OY_SHIM` | Force a specific shim: `openai`, `codex`, `copilot`, `bedrock`, or `bedrock-mantle` |
|
|
150
163
|
| `OY_NON_INTERACTIVE` | Set to `1` to disable checkpoints |
|
|
151
164
|
| `OY_ROOT` | Run against different workspace |
|
|
152
165
|
| `OY_SYSTEM_FILE` | Append extra system instructions |
|
|
@@ -172,12 +185,11 @@ is a reference.
|
|
|
172
185
|
|
|
173
186
|
## Requirements
|
|
174
187
|
|
|
175
|
-
- Python 3.
|
|
188
|
+
- Python 3.13+
|
|
176
189
|
- `bash`
|
|
177
190
|
- `mise` installed and activated in the shell before launching `oy`
|
|
178
191
|
- (Optional helper CLIs; `oy` auto-installs them on demand via `mise`): `rg` (ripgrep), `ast-grep`, `scc`, `xh`, `yq`
|
|
179
|
-
- OpenAI API key or Codex local auth **OR**
|
|
180
|
-
(`~/.gemini/oauth_creds.json`) **OR** Claude Code local auth **OR**
|
|
192
|
+
- OpenAI API key or Codex local auth **OR**
|
|
181
193
|
AWS CLI configured for Bedrock
|
|
182
194
|
|
|
183
195
|
## Installation
|
|
@@ -200,7 +212,7 @@ export OPENAI_BASE_URL=https://your-endpoint.example/v1
|
|
|
200
212
|
export OPENAI_API_KEY=...
|
|
201
213
|
```
|
|
202
214
|
|
|
203
|
-
|
|
215
|
+
Copilot and Codex (OpenAI) creds are introspected
|
|
204
216
|
and used, if creds are available `oy model` will show them in the model list.
|
|
205
217
|
|
|
206
218
|
**AWS Bedrock:** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
|
|
@@ -212,7 +224,7 @@ export AWS_REGION=us-west-2
|
|
|
212
224
|
## Troubleshooting
|
|
213
225
|
|
|
214
226
|
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`,
|
|
215
|
-
|
|
227
|
+
or configure AWS CLI (`aws configure`). For Bedrock:
|
|
216
228
|
ensure your profile has `bedrock:InvokeModel` permission.
|
|
217
229
|
|
|
218
230
|
**"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
|
|
@@ -52,9 +52,18 @@ The system prompt is short. Tool semantics live with the tool definitions; the s
|
|
|
52
52
|
|
|
53
53
|
```markdown
|
|
54
54
|
You are oy, a coding cli with tools.
|
|
55
|
-
Inspect before editing with `read` for file content, `search` for regex
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
Inspect before editing with `read` for file content, `search` for regex
|
|
56
|
+
matches, and `list` for path discovery. For existing code changes, prefer
|
|
57
|
+
syntax-aware edits via `ast-grep` run through `bash`. Keep edits small,
|
|
58
|
+
auditable, and verified with `read`, `git diff`, and batch independent tool
|
|
59
|
+
calls.
|
|
60
|
+
Keep going until done or blocked; if blocked, say what you tried and next
|
|
61
|
+
steps.
|
|
62
|
+
Use grugbrain.dev approach for maintainability/simplicity, OWASP-minded
|
|
63
|
+
judgment for security, and performance-aware programming (Computer, Enhance!).
|
|
64
|
+
Use `webfetch` to pull in documentation or references when needed.
|
|
65
|
+
Use `todowrite` at the start of multi-step work to plan, and update it as
|
|
66
|
+
you go — it persists across context compaction so you won't lose your place.
|
|
58
67
|
```
|
|
59
68
|
|
|
60
69
|
### Interactive Appendix
|
|
@@ -77,9 +86,11 @@ Each tool description is passed directly to the model:
|
|
|
77
86
|
|------|-------------|
|
|
78
87
|
| `list` | List paths by calling `Path.glob(path)`. Defaults to `path: "*"`. Use `src/*` or `src/**/*.py` exactly like pathlib glob patterns. Returns sorted entries, one per line, with / for directories. |
|
|
79
88
|
| `read` | Read a file or directory. Files return line-numbered text. Directories return sorted entries, one per line, with / for directories. Use `offset` and `limit` for large files. |
|
|
80
|
-
| `bash` | Shell commands are easy to run. For edits, prefer `ast-grep` for precise search/replace, `scc` for code-count analysis, and `xh` for web/API interaction; pipe to `rg` or `yq` for filtering when useful. These tools are effective for their niches, guaranteed to be available during an `oy` run, and their current usage docs can be checked with `--help`. For inspection, prefer the `search` tool. Returns structured results with `command`, `exit_code`, `ok`, `output_format`, `output`, and `truncated`. JSON output is parsed when possible. |
|
|
89
|
+
| `bash` | Shell commands are easy to run. For edits, prefer `ast-grep` for precise search/replace, `scc` for code-count analysis, and `xh` for web/API interaction (or use the `webfetch` tool directly for simple fetches); pipe to `rg` or `yq` for filtering when useful. These tools are effective for their niches, guaranteed to be available during an `oy` run, and their current usage docs can be checked with `--help`. For inspection, prefer the `search` tool. Returns structured results with `command`, `exit_code`, `ok`, `output_format`, `output`, and `truncated`. JSON output is parsed when possible. |
|
|
81
90
|
| `search` | Search with ripgrep JSON output. Takes `pattern` and `path`, then passes any extra ripgrep flags from `args`, for example `pattern: 'needle', path: 'src', args: ['--glob', '*.py', '-i']`. `limit` only limits displayed results after ripgrep runs. |
|
|
82
91
|
| `ask` | Ask the user a question in interactive runs. Use for ambiguity or decisions. Provide choices. |
|
|
92
|
+
| `webfetch` | Fetch a URL over the web. Takes `url`, optional `method` (GET/HEAD/OPTIONS, default GET), and optional `headers` dict. Built on `xh`. Restricted to public addresses only (no localhost/private IPs) for safety. Returns response headers and body. Use for fetching documentation, APIs, or web content. |
|
|
93
|
+
| `todowrite` | Update the in-memory todo list. Takes `todos`: a list of `{id, task, status}` objects (status: pending/in_progress/done). Replaces the full list each call. Use to plan multi-step work, track progress, and stay on course — the list persists in context even when earlier messages are compacted. Returns the current list. |
|
|
83
94
|
|
|
84
95
|
**Output truncation:** tool output is clipped to preserve context window; `bash` summarizes output into a single `output` field and marks truncation with one `truncated` flag. When clipped, narrow the next query or use `search` with a tighter `path` instead of re-running broad inspection.
|
|
85
96
|
|
|
@@ -96,14 +107,15 @@ Each tool description is passed directly to the model:
|
|
|
96
107
|
```markdown
|
|
97
108
|
Audit the repo for security, unnecessary complexity, and major
|
|
98
109
|
performance issues, preserving project and human context.
|
|
110
|
+
Use `todowrite` to plan audit steps and track progress.
|
|
99
111
|
First read key markdown docs, then refresh or generate an audit
|
|
100
112
|
header at the top of ISSUES.md that includes the current date,
|
|
101
113
|
the latest Git commit reference, and a codebase summary
|
|
102
114
|
using tools like `scc`. Next, fetch the current OWASP
|
|
103
115
|
ASVS (or MASVS if more relevant) and grugbrain.dev guidelines
|
|
104
|
-
using `
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
using `webfetch`, inspect the codebase against these, and write or
|
|
117
|
+
merge prioritised findings (max 10-15) into the ISSUES.md file. Check
|
|
118
|
+
each link or reference carefully to make sure ids and links are accurate.
|
|
107
119
|
Ensure each finding is formatted to include its location, category
|
|
108
120
|
(security, complexity, or performance), standard reference, a clear
|
|
109
121
|
recommendation, and has a Status, if existing findings have been
|
|
@@ -123,7 +135,7 @@ OY_ROOT=./src oy audit # Audit specific directory
|
|
|
123
135
|
| Variable | Purpose |
|
|
124
136
|
|----------|---------|
|
|
125
137
|
| `OY_MODEL` | Override model for this session (bare name or `shim:model`) |
|
|
126
|
-
| `OY_SHIM` | Force a specific shim: `openai`, `codex`, `
|
|
138
|
+
| `OY_SHIM` | Force a specific shim: `openai`, `codex`, `copilot`, `bedrock`, or `bedrock-mantle` |
|
|
127
139
|
| `OY_NON_INTERACTIVE` | Set to `1` to disable checkpoints |
|
|
128
140
|
| `OY_ROOT` | Run against different workspace |
|
|
129
141
|
| `OY_SYSTEM_FILE` | Append extra system instructions |
|
|
@@ -149,12 +161,11 @@ is a reference.
|
|
|
149
161
|
|
|
150
162
|
## Requirements
|
|
151
163
|
|
|
152
|
-
- Python 3.
|
|
164
|
+
- Python 3.13+
|
|
153
165
|
- `bash`
|
|
154
166
|
- `mise` installed and activated in the shell before launching `oy`
|
|
155
167
|
- (Optional helper CLIs; `oy` auto-installs them on demand via `mise`): `rg` (ripgrep), `ast-grep`, `scc`, `xh`, `yq`
|
|
156
|
-
- OpenAI API key or Codex local auth **OR**
|
|
157
|
-
(`~/.gemini/oauth_creds.json`) **OR** Claude Code local auth **OR**
|
|
168
|
+
- OpenAI API key or Codex local auth **OR**
|
|
158
169
|
AWS CLI configured for Bedrock
|
|
159
170
|
|
|
160
171
|
## Installation
|
|
@@ -177,7 +188,7 @@ export OPENAI_BASE_URL=https://your-endpoint.example/v1
|
|
|
177
188
|
export OPENAI_API_KEY=...
|
|
178
189
|
```
|
|
179
190
|
|
|
180
|
-
|
|
191
|
+
Copilot and Codex (OpenAI) creds are introspected
|
|
181
192
|
and used, if creds are available `oy model` will show them in the model list.
|
|
182
193
|
|
|
183
194
|
**AWS Bedrock:** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
|
|
@@ -189,7 +200,7 @@ export AWS_REGION=us-west-2
|
|
|
189
200
|
## Troubleshooting
|
|
190
201
|
|
|
191
202
|
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`,
|
|
192
|
-
|
|
203
|
+
or configure AWS CLI (`aws configure`). For Bedrock:
|
|
193
204
|
ensure your profile has `bedrock:InvokeModel` permission.
|
|
194
205
|
|
|
195
206
|
**"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# oy-cli
|
|
2
|
+
|
|
3
|
+
[](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
|
+
## System Prompts
|
|
48
|
+
|
|
49
|
+
The system prompt is short. Tool semantics live with the tool definitions; the system prompt focuses on operating rules and judgment:
|
|
50
|
+
|
|
51
|
+
### Base Prompt
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
You are oy, a coding cli with tools.
|
|
55
|
+
Inspect before editing with `read` for file content, `search` for regex
|
|
56
|
+
matches, and `list` for path discovery. For existing code changes, prefer
|
|
57
|
+
syntax-aware edits via `ast-grep` run through `bash`. Keep edits small,
|
|
58
|
+
auditable, and verified with `read`, `git diff`, and batch independent tool
|
|
59
|
+
calls.
|
|
60
|
+
Keep going until done or blocked; if blocked, say what you tried and next
|
|
61
|
+
steps.
|
|
62
|
+
Use grugbrain.dev approach for maintainability/simplicity, OWASP-minded
|
|
63
|
+
judgment for security, and performance-aware programming (Computer, Enhance!).
|
|
64
|
+
Use `webfetch` to pull in documentation or references when needed.
|
|
65
|
+
Use `todowrite` at the start of multi-step work to plan, and update it as
|
|
66
|
+
you go — it persists across context compaction so you won't lose your place.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Interactive Appendix
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
Use ask only when clarification or direction is needed.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Non-Interactive Appendix
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
Non-interactive mode: do not pause for approval.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Tools
|
|
82
|
+
|
|
83
|
+
Each tool description is passed directly to the model:
|
|
84
|
+
|
|
85
|
+
| Tool | Description |
|
|
86
|
+
|------|-------------|
|
|
87
|
+
| `list` | List paths by calling `Path.glob(path)`. Defaults to `path: "*"`. Use `src/*` or `src/**/*.py` exactly like pathlib glob patterns. Returns sorted entries, one per line, with / for directories. |
|
|
88
|
+
| `read` | Read a file or directory. Files return line-numbered text. Directories return sorted entries, one per line, with / for directories. Use `offset` and `limit` for large files. |
|
|
89
|
+
| `bash` | Shell commands are easy to run. For edits, prefer `ast-grep` for precise search/replace, `scc` for code-count analysis, and `xh` for web/API interaction (or use the `webfetch` tool directly for simple fetches); pipe to `rg` or `yq` for filtering when useful. These tools are effective for their niches, guaranteed to be available during an `oy` run, and their current usage docs can be checked with `--help`. For inspection, prefer the `search` tool. Returns structured results with `command`, `exit_code`, `ok`, `output_format`, `output`, and `truncated`. JSON output is parsed when possible. |
|
|
90
|
+
| `search` | Search with ripgrep JSON output. Takes `pattern` and `path`, then passes any extra ripgrep flags from `args`, for example `pattern: 'needle', path: 'src', args: ['--glob', '*.py', '-i']`. `limit` only limits displayed results after ripgrep runs. |
|
|
91
|
+
| `ask` | Ask the user a question in interactive runs. Use for ambiguity or decisions. Provide choices. |
|
|
92
|
+
| `webfetch` | Fetch a URL over the web. Takes `url`, optional `method` (GET/HEAD/OPTIONS, default GET), and optional `headers` dict. Built on `xh`. Restricted to public addresses only (no localhost/private IPs) for safety. Returns response headers and body. Use for fetching documentation, APIs, or web content. |
|
|
93
|
+
| `todowrite` | Update the in-memory todo list. Takes `todos`: a list of `{id, task, status}` objects (status: pending/in_progress/done). Replaces the full list each call. Use to plan multi-step work, track progress, and stay on course — the list persists in context even when earlier messages are compacted. Returns the current list. |
|
|
94
|
+
|
|
95
|
+
**Output truncation:** tool output is clipped to preserve context window; `bash` summarizes output into a single `output` field and marks truncation with one `truncated` flag. When clipped, narrow the next query or use `search` with a tighter `path` instead of re-running broad inspection.
|
|
96
|
+
|
|
97
|
+
**Conversation compaction:** interactive chat compresses prepared context with [Headroom](https://github.com/chopratejas/headroom) before each model request, then falls back to omitting the oldest messages if the transcript still does not fit.
|
|
98
|
+
|
|
99
|
+
**Parallel tool calls:** `oy` can execute multiple tool calls returned in a single assistant turn. Explicit provider flags for parallel tool calls are only sent where the upstream API supports them directly today; other providers rely on their native tool-calling behavior.
|
|
100
|
+
|
|
101
|
+
## Audit Command
|
|
102
|
+
|
|
103
|
+
`oy audit` runs the agent with a dedicated system prompt:
|
|
104
|
+
|
|
105
|
+
### Audit Prompt
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
Audit the repo for security, unnecessary complexity, and major
|
|
109
|
+
performance issues, preserving project and human context.
|
|
110
|
+
Use `todowrite` to plan audit steps and track progress.
|
|
111
|
+
First read key markdown docs, then refresh or generate an audit
|
|
112
|
+
header at the top of ISSUES.md that includes the current date,
|
|
113
|
+
the latest Git commit reference, and a codebase summary
|
|
114
|
+
using tools like `scc`. Next, fetch the current OWASP
|
|
115
|
+
ASVS (or MASVS if more relevant) and grugbrain.dev guidelines
|
|
116
|
+
using `webfetch`, inspect the codebase against these, and write or
|
|
117
|
+
merge prioritised findings (max 10-15) into the ISSUES.md file. Check
|
|
118
|
+
each link or reference carefully to make sure ids and links are accurate.
|
|
119
|
+
Ensure each finding is formatted to include its location, category
|
|
120
|
+
(security, complexity, or performance), standard reference, a clear
|
|
121
|
+
recommendation, and has a Status, if existing findings have been
|
|
122
|
+
resolved, summarise and note them in a short log at the end.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
oy audit # Full audit
|
|
127
|
+
oy audit "focus on auth" # With focus area
|
|
128
|
+
OY_ROOT=./src oy audit # Audit specific directory
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
**Environment variables:**
|
|
134
|
+
|
|
135
|
+
| Variable | Purpose |
|
|
136
|
+
|----------|---------|
|
|
137
|
+
| `OY_MODEL` | Override model for this session (bare name or `shim:model`) |
|
|
138
|
+
| `OY_SHIM` | Force a specific shim: `openai`, `codex`, `copilot`, `bedrock`, or `bedrock-mantle` |
|
|
139
|
+
| `OY_NON_INTERACTIVE` | Set to `1` to disable checkpoints |
|
|
140
|
+
| `OY_ROOT` | Run against different workspace |
|
|
141
|
+
| `OY_SYSTEM_FILE` | Append extra system instructions |
|
|
142
|
+
| `OY_CONFIG` | Override config path (default: `~/.config/oy/config.json`) |
|
|
143
|
+
|
|
144
|
+
**Config file** (`~/.config/oy/config.json`):
|
|
145
|
+
```json
|
|
146
|
+
{"shim": "openai", "model": "glm-5"}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The `shim` field pins which backend to use regardless of what else is signed in.
|
|
150
|
+
Use `oy model <filter>` to pick interactively; it merges models from available
|
|
151
|
+
signed-in shims into a single list using `shim:model` prefixes.
|
|
152
|
+
|
|
153
|
+
On first run, if no model is configured, `oy` prompts you to pick one from
|
|
154
|
+
the available backends. Set `OY_MODEL`, `OY_SHIM`, or save a config with
|
|
155
|
+
`oy model` to pin behavior.
|
|
156
|
+
|
|
157
|
+
**Model notes:** From testing, `glm-5` balances intelligence,
|
|
158
|
+
cost, and tool-use ability. `kimi-k2.5` is another option.
|
|
159
|
+
The [Artificial Analysis Comparison of Open Source Models](https://artificialanalysis.ai/models/open-source)
|
|
160
|
+
is a reference.
|
|
161
|
+
|
|
162
|
+
## Requirements
|
|
163
|
+
|
|
164
|
+
- Python 3.13+
|
|
165
|
+
- `bash`
|
|
166
|
+
- `mise` installed and activated in the shell before launching `oy`
|
|
167
|
+
- (Optional helper CLIs; `oy` auto-installs them on demand via `mise`): `rg` (ripgrep), `ast-grep`, `scc`, `xh`, `yq`
|
|
168
|
+
- OpenAI API key or Codex local auth **OR**
|
|
169
|
+
AWS CLI configured for Bedrock
|
|
170
|
+
|
|
171
|
+
## Installation
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
uv tool install oy-cli # Preferred
|
|
175
|
+
pip install oy-cli # Alternative
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Authentication
|
|
179
|
+
|
|
180
|
+
**OpenAI:**
|
|
181
|
+
```bash
|
|
182
|
+
export OPENAI_API_KEY=sk-...
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
For OpenAI-compatible endpoints:
|
|
186
|
+
```bash
|
|
187
|
+
export OPENAI_BASE_URL=https://your-endpoint.example/v1
|
|
188
|
+
export OPENAI_API_KEY=...
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Copilot and Codex (OpenAI) creds are introspected
|
|
192
|
+
and used, if creds are available `oy model` will show them in the model list.
|
|
193
|
+
|
|
194
|
+
**AWS Bedrock:** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
|
|
195
|
+
```bash
|
|
196
|
+
export AWS_PROFILE=my-profile
|
|
197
|
+
export AWS_REGION=us-west-2
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Troubleshooting
|
|
201
|
+
|
|
202
|
+
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`,
|
|
203
|
+
or configure AWS CLI (`aws configure`). For Bedrock:
|
|
204
|
+
ensure your profile has `bedrock:InvokeModel` permission.
|
|
205
|
+
|
|
206
|
+
**"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
|
|
207
|
+
|
|
208
|
+
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser`.
|
|
209
|
+
|
|
210
|
+
**"Missing helper tool"** -> Install or activate `mise`, then rerun `oy`; `oy` assumes a working `mise` shell activation and auto-installs missing helper CLIs together through `mise`.
|
|
211
|
+
|
|
212
|
+
**"`mise` is required; install and activate `mise` before running `oy`."** -> Install `mise`, activate it in your shell, then relaunch `oy`.
|
|
213
|
+
|
|
214
|
+
## Security
|
|
215
|
+
|
|
216
|
+
`oy` can run shell commands and modify files with your permissions. Treat it like any other local automation tool.
|
|
217
|
+
|
|
218
|
+
Recommended:
|
|
219
|
+
- run in a repo or workspace you trust
|
|
220
|
+
- mount only needed directories in containers
|
|
221
|
+
- avoid exposing long-lived secrets in the environment
|
|
222
|
+
- review generated changes before shipping
|
|
223
|
+
|
|
224
|
+
**Protections:** workspace-bound file access for built-in file tools and native boto3 credential resolution for Bedrock.
|
|
225
|
+
|
|
226
|
+
## Links
|
|
227
|
+
|
|
228
|
+
- [Issues](ISSUES.md) - Known issues and audit findings
|
|
229
|
+
- [Contributing](CONTRIBUTING.md) - Development and release notes
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
Apache License 2.0
|