oy-cli 0.3.1__tar.gz → 0.3.3__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.3.1 → oy_cli-0.3.3}/PKG-INFO +37 -65
- {oy_cli-0.3.1 → oy_cli-0.3.3}/README.md +35 -63
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.egg-info/PKG-INFO +37 -65
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.egg-info/requires.txt +1 -1
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.py +436 -102
- {oy_cli-0.3.1 → oy_cli-0.3.3}/pyproject.toml +2 -2
- {oy_cli-0.3.1 → oy_cli-0.3.3}/shim.py +84 -66
- {oy_cli-0.3.1 → oy_cli-0.3.3}/LICENSE +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.egg-info/SOURCES.txt +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.egg-info/dependency_links.txt +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.egg-info/entry_points.txt +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/oy_cli.egg-info/top_level.txt +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/setup.cfg +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/tests/test_oy_cli.py +0 -0
- {oy_cli-0.3.1 → oy_cli-0.3.3}/tests/test_shim.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oy-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
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
|
|
@@ -10,9 +10,9 @@ Project-URL: Issues, https://github.com/wagov-dtt/oy-cli/issues
|
|
|
10
10
|
Requires-Python: >=3.14
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Requires-Dist: boto3>=1.35.0
|
|
13
14
|
Requires-Dist: defopt>=7.0.0
|
|
14
15
|
Requires-Dist: httpx>=0.28.1
|
|
15
|
-
Requires-Dist: httpx-aws-auth>=4.1.1
|
|
16
16
|
Requires-Dist: markdownify>=1.2.0
|
|
17
17
|
Requires-Dist: openai>=1.68.0
|
|
18
18
|
Requires-Dist: rich>=14.3.0
|
|
@@ -23,6 +23,8 @@ Dynamic: license-file
|
|
|
23
23
|
|
|
24
24
|
# oy-cli
|
|
25
25
|
|
|
26
|
+
[](https://pypi.org/project/oy-cli/)
|
|
27
|
+
|
|
26
28
|
**Tiny AI coding assistant for your shell.** Reads files, runs commands, makes precise edits, and stays intentionally small.
|
|
27
29
|
|
|
28
30
|
```bash
|
|
@@ -53,9 +55,7 @@ oy audit "focus on authentication"
|
|
|
53
55
|
oy "prompt" # Run with a prompt (default)
|
|
54
56
|
oy chat # Interactive multi-turn session
|
|
55
57
|
oy audit # Security audit against OWASP ASVS/MASVS
|
|
56
|
-
oy model # Show current
|
|
57
|
-
oy model <filter> # Pick/save a model
|
|
58
|
-
oy model --token # Print Bedrock OpenAI env exports
|
|
58
|
+
oy model # Show current model, pick model from available endpoints
|
|
59
59
|
oy --help # Show all commands
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -65,18 +65,30 @@ Most AI coding tools are large, complex, or lock you into a single provider. `oy
|
|
|
65
65
|
|
|
66
66
|
**Design goals:** small auditable codebase, minimal tool surface, OpenAI-completions-focused CLI loop, multiple backends behind shims, fresh session each run, and explicit checkpoints when needed.
|
|
67
67
|
|
|
68
|
-
## System
|
|
68
|
+
## System Prompts
|
|
69
69
|
|
|
70
70
|
The system prompt is intentionally short. Tool semantics live with the tool definitions; the system prompt focuses on operating rules and judgment:
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
### Base Prompt
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
You are oy, a tiny coding cli with tools.
|
|
76
|
+
Work by inspecting first, then making explicit changes. Prefer simple auditable solutions.
|
|
77
|
+
Keep going until done or genuinely blocked; if blocked, say what you tried and next steps.
|
|
78
|
+
Use grugbrain-style simplicity for complexity, OWASP-minded judgment for security, and performance-aware judgment to avoid obvious waste.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Interactive Appendix
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
Use ask only when significant clarification or direction is needed.
|
|
85
|
+
```
|
|
76
86
|
|
|
77
|
-
|
|
87
|
+
### Non-Interactive Appendix
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
```markdown
|
|
90
|
+
Non-interactive mode: do not pause for approval.
|
|
91
|
+
```
|
|
80
92
|
|
|
81
93
|
## Tools
|
|
82
94
|
|
|
@@ -84,12 +96,12 @@ Each tool description is passed directly to the model. These are the exact descr
|
|
|
84
96
|
|
|
85
97
|
| Tool | Description |
|
|
86
98
|
|------|-------------|
|
|
87
|
-
| `list` | List a directory. Use this first on unfamiliar trees. Returns sorted entries, one per line, with
|
|
99
|
+
| `list` | List a directory. Use this first on unfamiliar trees. Returns sorted entries, one per line, with / for directories. |
|
|
88
100
|
| `read` | Read a file or directory. Use before editing. Files return line-numbered text; directories fall back to list. Use offset/limit for large files. |
|
|
89
101
|
| `apply` | Edit files inside the workspace. Operations: replace, write, move, delete. Read first and keep edits precise. |
|
|
90
102
|
| `bash` | Run shell commands for tests, builds, git, and scripts. Do not use for routine file inspection. Returns stdout and stderr together. |
|
|
91
103
|
| `grep` | Search file contents by text or regex. Use file_glob to narrow by filename pattern. Returns matching lines with file and line numbers. |
|
|
92
|
-
| `glob` | Find files by name pattern like
|
|
104
|
+
| `glob` | Find files by name pattern like '*.py' or 'src/**/*.js'. Use when you know the path shape. Supports *, ?, and **. |
|
|
93
105
|
| `httpx` | Fetch web pages or APIs over HTTP(S). Presets: page, json, post_json. Use json_path to extract nested fields. Sensitive headers are redacted. |
|
|
94
106
|
| `ask` | Ask the user a question in interactive runs. Use for significant ambiguity or decisions. Provide choices when useful. |
|
|
95
107
|
|
|
@@ -99,10 +111,11 @@ Each tool description is passed directly to the model. These are the exact descr
|
|
|
99
111
|
|
|
100
112
|
`oy audit` runs the agent with a dedicated system prompt:
|
|
101
113
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
### Audit Prompt
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
Audit the repo for security, unnecessary complexity, and major obvious performance issues, preserving project and human context. First read key markdown docs, then refresh or generate an audit header at the top of ISSUES.md that includes the current date, the latest Git commit reference, and a concise codebase summary using tools like `scc` or `tokei`. Next, fetch the current OWASP ASVS (or MASVS if more relevant) and grugbrain.dev guidelines using httpx, inspect the codebase against these, and write or merge prioritised findings (max 10-15) into the ISSUES.md file. Ensure each finding is formatted to include its location, category (security, complexity, or performance), standard reference, a clear recommendation, and has a Status, if existing findings have been resolved, summarise and note them in a short log at the end.
|
|
118
|
+
```
|
|
106
119
|
|
|
107
120
|
```bash
|
|
108
121
|
oy audit # Full audit
|
|
@@ -123,31 +136,16 @@ OY_ROOT=./src oy audit # Audit specific directory
|
|
|
123
136
|
| `OY_SYSTEM_FILE` | Append extra system instructions |
|
|
124
137
|
| `OY_CONFIG` | Override config path (default: `~/.config/oy/config.json`) |
|
|
125
138
|
|
|
126
|
-
**Tuning variables** (rarely needed):
|
|
127
|
-
|
|
128
|
-
| Variable | Default | Purpose |
|
|
129
|
-
|----------|---------|---------|
|
|
130
|
-
| `OY_MAX_TOOL_OUTPUT_TOKENS` | `4096` | Max tokens kept from tool output |
|
|
131
|
-
| `OY_MAX_TOOL_TAIL_TOKENS` | `1024` | Tail tokens preserved when output is clipped |
|
|
132
|
-
| `OY_MAX_BASH_CMD_BYTES` | `65536` | Max command size for `bash` tool |
|
|
133
|
-
| `OY_MAX_CONTEXT_TOKENS` | `131072` | Context window budget |
|
|
134
|
-
| `OY_MAX_MESSAGE_TOKENS` | `4096` | Per-message truncation limit |
|
|
135
|
-
| `OY_DEFAULT_MAX_STEPS` | `512` | Max LLM turns per run |
|
|
136
|
-
| `OY_DEFAULT_MAX_TOOL_CALLS` | `512` | Max tool invocations per run |
|
|
137
|
-
| `OY_DEFAULT_LINE_LIMIT` | `500` | Default line limit for `read`/`list`/`glob` |
|
|
138
|
-
| `OY_BEDROCK_READ_TIMEOUT` | `120` | HTTP read timeout for Bedrock (seconds) |
|
|
139
|
-
| `OY_BEDROCK_MAX_OUTPUT_TOKENS` | `4096` | Max output tokens for Bedrock Converse |
|
|
140
|
-
|
|
141
139
|
**Config file** (`~/.config/oy/config.json`):
|
|
142
140
|
```json
|
|
143
|
-
{"shim": "
|
|
141
|
+
{"shim": "openai", "model": "glm-5"}
|
|
144
142
|
```
|
|
145
143
|
|
|
146
144
|
The `shim` field pins which backend to use regardless of what else is signed in. Use `oy model <filter>` to pick interactively; it merges models from available signed-in shims into a single list using `shim:model` prefixes.
|
|
147
145
|
|
|
148
146
|
On first run, if no model is configured, `oy` prompts you to pick one from the available backends. Set `OY_MODEL`, `OY_SHIM`, or save a config with `oy model` to pin behavior.
|
|
149
147
|
|
|
150
|
-
**Recommended model:** From testing, `glm-5`
|
|
148
|
+
**Recommended model:** From testing, `glm-5` offers the best balance of intelligence, cost, and tool-use ability. `kimi-k2.5` is another strong option. The [Artificial Analysis Comparison of Open Source Models](https://artificialanalysis.ai/models/open-source) is a good reference.
|
|
151
149
|
|
|
152
150
|
## Requirements
|
|
153
151
|
|
|
@@ -176,27 +174,7 @@ export OPENAI_BASE_URL=https://your-endpoint.example/v1
|
|
|
176
174
|
export OPENAI_API_KEY=...
|
|
177
175
|
```
|
|
178
176
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
**Gemini CLI (automatic):** If you have the [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed and have run `gemini` at least once to authenticate, `oy` will pick up the OAuth credentials automatically from `~/.gemini/oauth_creds.json`. No extra setup needed.
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
# Install and authenticate the Gemini CLI once
|
|
185
|
-
npm install -g @google/gemini-cli
|
|
186
|
-
gemini # follow the login prompt
|
|
187
|
-
|
|
188
|
-
# Then just use oy — it auto-detects Gemini credentials
|
|
189
|
-
oy "refactor this function"
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Default model when using Gemini: `gemini-2.5-pro`. Use `oy model <filter>` or `OY_MODEL` to switch.
|
|
193
|
-
|
|
194
|
-
**Claude Code (automatic):** If you have already signed in with Claude Code, `oy` can use that local session directly through the `claude` shim. No Anthropic API key is required.
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
claude auth login
|
|
198
|
-
oy --model claude:sonnet "refactor this function"
|
|
199
|
-
```
|
|
177
|
+
Gemini, Claude, Codex (OpenAI) creds should be automatically introspected and used, if creds are available `oy model` will show them in the model list.
|
|
200
178
|
|
|
201
179
|
**AWS Bedrock (automatic):** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
|
|
202
180
|
```bash
|
|
@@ -206,17 +184,11 @@ export AWS_REGION=us-west-2
|
|
|
206
184
|
|
|
207
185
|
## Troubleshooting
|
|
208
186
|
|
|
209
|
-
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`,
|
|
187
|
+
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`, `gemini` or `claude`, or configure AWS CLI (`aws configure`). For Bedrock: ensure your profile has `bedrock:InvokeModel` permission.
|
|
210
188
|
|
|
211
189
|
**"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
|
|
212
190
|
|
|
213
|
-
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser
|
|
214
|
-
|
|
215
|
-
**"command timed out"** -> `bash` default timeout is 120s. Agent can increase `timeout_seconds` parameter.
|
|
216
|
-
|
|
217
|
-
**"replace target not found"** -> `apply` requires exact string match. Read file first, check whitespace.
|
|
218
|
-
|
|
219
|
-
**Output truncated** -> Tools clip at 4096 tokens by default. Agent auto-narrows queries, or guide explicitly: "read lines 100-200".
|
|
191
|
+
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser`.
|
|
220
192
|
|
|
221
193
|
## Security
|
|
222
194
|
|
|
@@ -228,7 +200,7 @@ Recommended:
|
|
|
228
200
|
- avoid exposing long-lived secrets in the environment
|
|
229
201
|
- review generated changes before shipping
|
|
230
202
|
|
|
231
|
-
**Automatic protections:** workspace-bound file access, structured edits through `apply`, sensitive header redaction in `httpx`, and
|
|
203
|
+
**Automatic protections:** workspace-bound file access, structured edits through `apply`, sensitive header redaction in `httpx`, and native boto3 credential resolution for Bedrock.
|
|
232
204
|
|
|
233
205
|
## Links
|
|
234
206
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# oy-cli
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/oy-cli/)
|
|
4
|
+
|
|
3
5
|
**Tiny AI coding assistant for your shell.** Reads files, runs commands, makes precise edits, and stays intentionally small.
|
|
4
6
|
|
|
5
7
|
```bash
|
|
@@ -30,9 +32,7 @@ oy audit "focus on authentication"
|
|
|
30
32
|
oy "prompt" # Run with a prompt (default)
|
|
31
33
|
oy chat # Interactive multi-turn session
|
|
32
34
|
oy audit # Security audit against OWASP ASVS/MASVS
|
|
33
|
-
oy model # Show current
|
|
34
|
-
oy model <filter> # Pick/save a model
|
|
35
|
-
oy model --token # Print Bedrock OpenAI env exports
|
|
35
|
+
oy model # Show current model, pick model from available endpoints
|
|
36
36
|
oy --help # Show all commands
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -42,18 +42,30 @@ Most AI coding tools are large, complex, or lock you into a single provider. `oy
|
|
|
42
42
|
|
|
43
43
|
**Design goals:** small auditable codebase, minimal tool surface, OpenAI-completions-focused CLI loop, multiple backends behind shims, fresh session each run, and explicit checkpoints when needed.
|
|
44
44
|
|
|
45
|
-
## System
|
|
45
|
+
## System Prompts
|
|
46
46
|
|
|
47
47
|
The system prompt is intentionally short. Tool semantics live with the tool definitions; the system prompt focuses on operating rules and judgment:
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
### Base Prompt
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
You are oy, a tiny coding cli with tools.
|
|
53
|
+
Work by inspecting first, then making explicit changes. Prefer simple auditable solutions.
|
|
54
|
+
Keep going until done or genuinely blocked; if blocked, say what you tried and next steps.
|
|
55
|
+
Use grugbrain-style simplicity for complexity, OWASP-minded judgment for security, and performance-aware judgment to avoid obvious waste.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Interactive Appendix
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
Use ask only when significant clarification or direction is needed.
|
|
62
|
+
```
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
### Non-Interactive Appendix
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
```markdown
|
|
67
|
+
Non-interactive mode: do not pause for approval.
|
|
68
|
+
```
|
|
57
69
|
|
|
58
70
|
## Tools
|
|
59
71
|
|
|
@@ -61,12 +73,12 @@ Each tool description is passed directly to the model. These are the exact descr
|
|
|
61
73
|
|
|
62
74
|
| Tool | Description |
|
|
63
75
|
|------|-------------|
|
|
64
|
-
| `list` | List a directory. Use this first on unfamiliar trees. Returns sorted entries, one per line, with
|
|
76
|
+
| `list` | List a directory. Use this first on unfamiliar trees. Returns sorted entries, one per line, with / for directories. |
|
|
65
77
|
| `read` | Read a file or directory. Use before editing. Files return line-numbered text; directories fall back to list. Use offset/limit for large files. |
|
|
66
78
|
| `apply` | Edit files inside the workspace. Operations: replace, write, move, delete. Read first and keep edits precise. |
|
|
67
79
|
| `bash` | Run shell commands for tests, builds, git, and scripts. Do not use for routine file inspection. Returns stdout and stderr together. |
|
|
68
80
|
| `grep` | Search file contents by text or regex. Use file_glob to narrow by filename pattern. Returns matching lines with file and line numbers. |
|
|
69
|
-
| `glob` | Find files by name pattern like
|
|
81
|
+
| `glob` | Find files by name pattern like '*.py' or 'src/**/*.js'. Use when you know the path shape. Supports *, ?, and **. |
|
|
70
82
|
| `httpx` | Fetch web pages or APIs over HTTP(S). Presets: page, json, post_json. Use json_path to extract nested fields. Sensitive headers are redacted. |
|
|
71
83
|
| `ask` | Ask the user a question in interactive runs. Use for significant ambiguity or decisions. Provide choices when useful. |
|
|
72
84
|
|
|
@@ -76,10 +88,11 @@ Each tool description is passed directly to the model. These are the exact descr
|
|
|
76
88
|
|
|
77
89
|
`oy audit` runs the agent with a dedicated system prompt:
|
|
78
90
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
### Audit Prompt
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
Audit the repo for security, unnecessary complexity, and major obvious performance issues, preserving project and human context. First read key markdown docs, then refresh or generate an audit header at the top of ISSUES.md that includes the current date, the latest Git commit reference, and a concise codebase summary using tools like `scc` or `tokei`. Next, fetch the current OWASP ASVS (or MASVS if more relevant) and grugbrain.dev guidelines using httpx, inspect the codebase against these, and write or merge prioritised findings (max 10-15) into the ISSUES.md file. Ensure each finding is formatted to include its location, category (security, complexity, or performance), standard reference, a clear recommendation, and has a Status, if existing findings have been resolved, summarise and note them in a short log at the end.
|
|
95
|
+
```
|
|
83
96
|
|
|
84
97
|
```bash
|
|
85
98
|
oy audit # Full audit
|
|
@@ -100,31 +113,16 @@ OY_ROOT=./src oy audit # Audit specific directory
|
|
|
100
113
|
| `OY_SYSTEM_FILE` | Append extra system instructions |
|
|
101
114
|
| `OY_CONFIG` | Override config path (default: `~/.config/oy/config.json`) |
|
|
102
115
|
|
|
103
|
-
**Tuning variables** (rarely needed):
|
|
104
|
-
|
|
105
|
-
| Variable | Default | Purpose |
|
|
106
|
-
|----------|---------|---------|
|
|
107
|
-
| `OY_MAX_TOOL_OUTPUT_TOKENS` | `4096` | Max tokens kept from tool output |
|
|
108
|
-
| `OY_MAX_TOOL_TAIL_TOKENS` | `1024` | Tail tokens preserved when output is clipped |
|
|
109
|
-
| `OY_MAX_BASH_CMD_BYTES` | `65536` | Max command size for `bash` tool |
|
|
110
|
-
| `OY_MAX_CONTEXT_TOKENS` | `131072` | Context window budget |
|
|
111
|
-
| `OY_MAX_MESSAGE_TOKENS` | `4096` | Per-message truncation limit |
|
|
112
|
-
| `OY_DEFAULT_MAX_STEPS` | `512` | Max LLM turns per run |
|
|
113
|
-
| `OY_DEFAULT_MAX_TOOL_CALLS` | `512` | Max tool invocations per run |
|
|
114
|
-
| `OY_DEFAULT_LINE_LIMIT` | `500` | Default line limit for `read`/`list`/`glob` |
|
|
115
|
-
| `OY_BEDROCK_READ_TIMEOUT` | `120` | HTTP read timeout for Bedrock (seconds) |
|
|
116
|
-
| `OY_BEDROCK_MAX_OUTPUT_TOKENS` | `4096` | Max output tokens for Bedrock Converse |
|
|
117
|
-
|
|
118
116
|
**Config file** (`~/.config/oy/config.json`):
|
|
119
117
|
```json
|
|
120
|
-
{"shim": "
|
|
118
|
+
{"shim": "openai", "model": "glm-5"}
|
|
121
119
|
```
|
|
122
120
|
|
|
123
121
|
The `shim` field pins which backend to use regardless of what else is signed in. Use `oy model <filter>` to pick interactively; it merges models from available signed-in shims into a single list using `shim:model` prefixes.
|
|
124
122
|
|
|
125
123
|
On first run, if no model is configured, `oy` prompts you to pick one from the available backends. Set `OY_MODEL`, `OY_SHIM`, or save a config with `oy model` to pin behavior.
|
|
126
124
|
|
|
127
|
-
**Recommended model:** From testing, `glm-5`
|
|
125
|
+
**Recommended model:** From testing, `glm-5` offers the best balance of intelligence, cost, and tool-use ability. `kimi-k2.5` is another strong option. The [Artificial Analysis Comparison of Open Source Models](https://artificialanalysis.ai/models/open-source) is a good reference.
|
|
128
126
|
|
|
129
127
|
## Requirements
|
|
130
128
|
|
|
@@ -153,27 +151,7 @@ export OPENAI_BASE_URL=https://your-endpoint.example/v1
|
|
|
153
151
|
export OPENAI_API_KEY=...
|
|
154
152
|
```
|
|
155
153
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
**Gemini CLI (automatic):** If you have the [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed and have run `gemini` at least once to authenticate, `oy` will pick up the OAuth credentials automatically from `~/.gemini/oauth_creds.json`. No extra setup needed.
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Install and authenticate the Gemini CLI once
|
|
162
|
-
npm install -g @google/gemini-cli
|
|
163
|
-
gemini # follow the login prompt
|
|
164
|
-
|
|
165
|
-
# Then just use oy — it auto-detects Gemini credentials
|
|
166
|
-
oy "refactor this function"
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Default model when using Gemini: `gemini-2.5-pro`. Use `oy model <filter>` or `OY_MODEL` to switch.
|
|
170
|
-
|
|
171
|
-
**Claude Code (automatic):** If you have already signed in with Claude Code, `oy` can use that local session directly through the `claude` shim. No Anthropic API key is required.
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
claude auth login
|
|
175
|
-
oy --model claude:sonnet "refactor this function"
|
|
176
|
-
```
|
|
154
|
+
Gemini, Claude, Codex (OpenAI) creds should be automatically introspected and used, if creds are available `oy model` will show them in the model list.
|
|
177
155
|
|
|
178
156
|
**AWS Bedrock (automatic):** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
|
|
179
157
|
```bash
|
|
@@ -183,17 +161,11 @@ export AWS_REGION=us-west-2
|
|
|
183
161
|
|
|
184
162
|
## Troubleshooting
|
|
185
163
|
|
|
186
|
-
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`,
|
|
164
|
+
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`, `gemini` or `claude`, or configure AWS CLI (`aws configure`). For Bedrock: ensure your profile has `bedrock:InvokeModel` permission.
|
|
187
165
|
|
|
188
166
|
**"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
|
|
189
167
|
|
|
190
|
-
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser
|
|
191
|
-
|
|
192
|
-
**"command timed out"** -> `bash` default timeout is 120s. Agent can increase `timeout_seconds` parameter.
|
|
193
|
-
|
|
194
|
-
**"replace target not found"** -> `apply` requires exact string match. Read file first, check whitespace.
|
|
195
|
-
|
|
196
|
-
**Output truncated** -> Tools clip at 4096 tokens by default. Agent auto-narrows queries, or guide explicitly: "read lines 100-200".
|
|
168
|
+
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser`.
|
|
197
169
|
|
|
198
170
|
## Security
|
|
199
171
|
|
|
@@ -205,7 +177,7 @@ Recommended:
|
|
|
205
177
|
- avoid exposing long-lived secrets in the environment
|
|
206
178
|
- review generated changes before shipping
|
|
207
179
|
|
|
208
|
-
**Automatic protections:** workspace-bound file access, structured edits through `apply`, sensitive header redaction in `httpx`, and
|
|
180
|
+
**Automatic protections:** workspace-bound file access, structured edits through `apply`, sensitive header redaction in `httpx`, and native boto3 credential resolution for Bedrock.
|
|
209
181
|
|
|
210
182
|
## Links
|
|
211
183
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oy-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
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
|
|
@@ -10,9 +10,9 @@ Project-URL: Issues, https://github.com/wagov-dtt/oy-cli/issues
|
|
|
10
10
|
Requires-Python: >=3.14
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Requires-Dist: boto3>=1.35.0
|
|
13
14
|
Requires-Dist: defopt>=7.0.0
|
|
14
15
|
Requires-Dist: httpx>=0.28.1
|
|
15
|
-
Requires-Dist: httpx-aws-auth>=4.1.1
|
|
16
16
|
Requires-Dist: markdownify>=1.2.0
|
|
17
17
|
Requires-Dist: openai>=1.68.0
|
|
18
18
|
Requires-Dist: rich>=14.3.0
|
|
@@ -23,6 +23,8 @@ Dynamic: license-file
|
|
|
23
23
|
|
|
24
24
|
# oy-cli
|
|
25
25
|
|
|
26
|
+
[](https://pypi.org/project/oy-cli/)
|
|
27
|
+
|
|
26
28
|
**Tiny AI coding assistant for your shell.** Reads files, runs commands, makes precise edits, and stays intentionally small.
|
|
27
29
|
|
|
28
30
|
```bash
|
|
@@ -53,9 +55,7 @@ oy audit "focus on authentication"
|
|
|
53
55
|
oy "prompt" # Run with a prompt (default)
|
|
54
56
|
oy chat # Interactive multi-turn session
|
|
55
57
|
oy audit # Security audit against OWASP ASVS/MASVS
|
|
56
|
-
oy model # Show current
|
|
57
|
-
oy model <filter> # Pick/save a model
|
|
58
|
-
oy model --token # Print Bedrock OpenAI env exports
|
|
58
|
+
oy model # Show current model, pick model from available endpoints
|
|
59
59
|
oy --help # Show all commands
|
|
60
60
|
```
|
|
61
61
|
|
|
@@ -65,18 +65,30 @@ Most AI coding tools are large, complex, or lock you into a single provider. `oy
|
|
|
65
65
|
|
|
66
66
|
**Design goals:** small auditable codebase, minimal tool surface, OpenAI-completions-focused CLI loop, multiple backends behind shims, fresh session each run, and explicit checkpoints when needed.
|
|
67
67
|
|
|
68
|
-
## System
|
|
68
|
+
## System Prompts
|
|
69
69
|
|
|
70
70
|
The system prompt is intentionally short. Tool semantics live with the tool definitions; the system prompt focuses on operating rules and judgment:
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
### Base Prompt
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
You are oy, a tiny coding cli with tools.
|
|
76
|
+
Work by inspecting first, then making explicit changes. Prefer simple auditable solutions.
|
|
77
|
+
Keep going until done or genuinely blocked; if blocked, say what you tried and next steps.
|
|
78
|
+
Use grugbrain-style simplicity for complexity, OWASP-minded judgment for security, and performance-aware judgment to avoid obvious waste.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Interactive Appendix
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
Use ask only when significant clarification or direction is needed.
|
|
85
|
+
```
|
|
76
86
|
|
|
77
|
-
|
|
87
|
+
### Non-Interactive Appendix
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
```markdown
|
|
90
|
+
Non-interactive mode: do not pause for approval.
|
|
91
|
+
```
|
|
80
92
|
|
|
81
93
|
## Tools
|
|
82
94
|
|
|
@@ -84,12 +96,12 @@ Each tool description is passed directly to the model. These are the exact descr
|
|
|
84
96
|
|
|
85
97
|
| Tool | Description |
|
|
86
98
|
|------|-------------|
|
|
87
|
-
| `list` | List a directory. Use this first on unfamiliar trees. Returns sorted entries, one per line, with
|
|
99
|
+
| `list` | List a directory. Use this first on unfamiliar trees. Returns sorted entries, one per line, with / for directories. |
|
|
88
100
|
| `read` | Read a file or directory. Use before editing. Files return line-numbered text; directories fall back to list. Use offset/limit for large files. |
|
|
89
101
|
| `apply` | Edit files inside the workspace. Operations: replace, write, move, delete. Read first and keep edits precise. |
|
|
90
102
|
| `bash` | Run shell commands for tests, builds, git, and scripts. Do not use for routine file inspection. Returns stdout and stderr together. |
|
|
91
103
|
| `grep` | Search file contents by text or regex. Use file_glob to narrow by filename pattern. Returns matching lines with file and line numbers. |
|
|
92
|
-
| `glob` | Find files by name pattern like
|
|
104
|
+
| `glob` | Find files by name pattern like '*.py' or 'src/**/*.js'. Use when you know the path shape. Supports *, ?, and **. |
|
|
93
105
|
| `httpx` | Fetch web pages or APIs over HTTP(S). Presets: page, json, post_json. Use json_path to extract nested fields. Sensitive headers are redacted. |
|
|
94
106
|
| `ask` | Ask the user a question in interactive runs. Use for significant ambiguity or decisions. Provide choices when useful. |
|
|
95
107
|
|
|
@@ -99,10 +111,11 @@ Each tool description is passed directly to the model. These are the exact descr
|
|
|
99
111
|
|
|
100
112
|
`oy audit` runs the agent with a dedicated system prompt:
|
|
101
113
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
### Audit Prompt
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
Audit the repo for security, unnecessary complexity, and major obvious performance issues, preserving project and human context. First read key markdown docs, then refresh or generate an audit header at the top of ISSUES.md that includes the current date, the latest Git commit reference, and a concise codebase summary using tools like `scc` or `tokei`. Next, fetch the current OWASP ASVS (or MASVS if more relevant) and grugbrain.dev guidelines using httpx, inspect the codebase against these, and write or merge prioritised findings (max 10-15) into the ISSUES.md file. Ensure each finding is formatted to include its location, category (security, complexity, or performance), standard reference, a clear recommendation, and has a Status, if existing findings have been resolved, summarise and note them in a short log at the end.
|
|
118
|
+
```
|
|
106
119
|
|
|
107
120
|
```bash
|
|
108
121
|
oy audit # Full audit
|
|
@@ -123,31 +136,16 @@ OY_ROOT=./src oy audit # Audit specific directory
|
|
|
123
136
|
| `OY_SYSTEM_FILE` | Append extra system instructions |
|
|
124
137
|
| `OY_CONFIG` | Override config path (default: `~/.config/oy/config.json`) |
|
|
125
138
|
|
|
126
|
-
**Tuning variables** (rarely needed):
|
|
127
|
-
|
|
128
|
-
| Variable | Default | Purpose |
|
|
129
|
-
|----------|---------|---------|
|
|
130
|
-
| `OY_MAX_TOOL_OUTPUT_TOKENS` | `4096` | Max tokens kept from tool output |
|
|
131
|
-
| `OY_MAX_TOOL_TAIL_TOKENS` | `1024` | Tail tokens preserved when output is clipped |
|
|
132
|
-
| `OY_MAX_BASH_CMD_BYTES` | `65536` | Max command size for `bash` tool |
|
|
133
|
-
| `OY_MAX_CONTEXT_TOKENS` | `131072` | Context window budget |
|
|
134
|
-
| `OY_MAX_MESSAGE_TOKENS` | `4096` | Per-message truncation limit |
|
|
135
|
-
| `OY_DEFAULT_MAX_STEPS` | `512` | Max LLM turns per run |
|
|
136
|
-
| `OY_DEFAULT_MAX_TOOL_CALLS` | `512` | Max tool invocations per run |
|
|
137
|
-
| `OY_DEFAULT_LINE_LIMIT` | `500` | Default line limit for `read`/`list`/`glob` |
|
|
138
|
-
| `OY_BEDROCK_READ_TIMEOUT` | `120` | HTTP read timeout for Bedrock (seconds) |
|
|
139
|
-
| `OY_BEDROCK_MAX_OUTPUT_TOKENS` | `4096` | Max output tokens for Bedrock Converse |
|
|
140
|
-
|
|
141
139
|
**Config file** (`~/.config/oy/config.json`):
|
|
142
140
|
```json
|
|
143
|
-
{"shim": "
|
|
141
|
+
{"shim": "openai", "model": "glm-5"}
|
|
144
142
|
```
|
|
145
143
|
|
|
146
144
|
The `shim` field pins which backend to use regardless of what else is signed in. Use `oy model <filter>` to pick interactively; it merges models from available signed-in shims into a single list using `shim:model` prefixes.
|
|
147
145
|
|
|
148
146
|
On first run, if no model is configured, `oy` prompts you to pick one from the available backends. Set `OY_MODEL`, `OY_SHIM`, or save a config with `oy model` to pin behavior.
|
|
149
147
|
|
|
150
|
-
**Recommended model:** From testing, `glm-5`
|
|
148
|
+
**Recommended model:** From testing, `glm-5` offers the best balance of intelligence, cost, and tool-use ability. `kimi-k2.5` is another strong option. The [Artificial Analysis Comparison of Open Source Models](https://artificialanalysis.ai/models/open-source) is a good reference.
|
|
151
149
|
|
|
152
150
|
## Requirements
|
|
153
151
|
|
|
@@ -176,27 +174,7 @@ export OPENAI_BASE_URL=https://your-endpoint.example/v1
|
|
|
176
174
|
export OPENAI_API_KEY=...
|
|
177
175
|
```
|
|
178
176
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
**Gemini CLI (automatic):** If you have the [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed and have run `gemini` at least once to authenticate, `oy` will pick up the OAuth credentials automatically from `~/.gemini/oauth_creds.json`. No extra setup needed.
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
# Install and authenticate the Gemini CLI once
|
|
185
|
-
npm install -g @google/gemini-cli
|
|
186
|
-
gemini # follow the login prompt
|
|
187
|
-
|
|
188
|
-
# Then just use oy — it auto-detects Gemini credentials
|
|
189
|
-
oy "refactor this function"
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Default model when using Gemini: `gemini-2.5-pro`. Use `oy model <filter>` or `OY_MODEL` to switch.
|
|
193
|
-
|
|
194
|
-
**Claude Code (automatic):** If you have already signed in with Claude Code, `oy` can use that local session directly through the `claude` shim. No Anthropic API key is required.
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
claude auth login
|
|
198
|
-
oy --model claude:sonnet "refactor this function"
|
|
199
|
-
```
|
|
177
|
+
Gemini, Claude, Codex (OpenAI) creds should be automatically introspected and used, if creds are available `oy model` will show them in the model list.
|
|
200
178
|
|
|
201
179
|
**AWS Bedrock (automatic):** Uses your default AWS profile/region. Supports auto-refresh of stale SSO sessions.
|
|
202
180
|
```bash
|
|
@@ -206,17 +184,11 @@ export AWS_REGION=us-west-2
|
|
|
206
184
|
|
|
207
185
|
## Troubleshooting
|
|
208
186
|
|
|
209
|
-
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`,
|
|
187
|
+
**"Missing API credentials"** -> Set `OPENAI_API_KEY`, sign in with `codex`, `gemini` or `claude`, or configure AWS CLI (`aws configure`). For Bedrock: ensure your profile has `bedrock:InvokeModel` permission.
|
|
210
188
|
|
|
211
189
|
**"stdin is not a TTY"** -> Piping input disables `ask`. Set `OY_NON_INTERACTIVE=1` to make explicit.
|
|
212
190
|
|
|
213
|
-
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser
|
|
214
|
-
|
|
215
|
-
**"command timed out"** -> `bash` default timeout is 120s. Agent can increase `timeout_seconds` parameter.
|
|
216
|
-
|
|
217
|
-
**"replace target not found"** -> `apply` requires exact string match. Read file first, check whitespace.
|
|
218
|
-
|
|
219
|
-
**Output truncated** -> Tools clip at 4096 tokens by default. Agent auto-narrows queries, or guide explicitly: "read lines 100-200".
|
|
191
|
+
**"AWS SSO session is stale"** -> Run `aws sso login --use-device-code --no-browser`.
|
|
220
192
|
|
|
221
193
|
## Security
|
|
222
194
|
|
|
@@ -228,7 +200,7 @@ Recommended:
|
|
|
228
200
|
- avoid exposing long-lived secrets in the environment
|
|
229
201
|
- review generated changes before shipping
|
|
230
202
|
|
|
231
|
-
**Automatic protections:** workspace-bound file access, structured edits through `apply`, sensitive header redaction in `httpx`, and
|
|
203
|
+
**Automatic protections:** workspace-bound file access, structured edits through `apply`, sensitive header redaction in `httpx`, and native boto3 credential resolution for Bedrock.
|
|
232
204
|
|
|
233
205
|
## Links
|
|
234
206
|
|