imbue-mngr-opencode 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imbue_mngr_opencode-0.2.0/.gitignore +274 -0
- imbue_mngr_opencode-0.2.0/PKG-INFO +43 -0
- imbue_mngr_opencode-0.2.0/README.md +35 -0
- imbue_mngr_opencode-0.2.0/conftest.py +15 -0
- imbue_mngr_opencode-0.2.0/imbue/mngr_opencode/__init__.py +0 -0
- imbue_mngr_opencode-0.2.0/imbue/mngr_opencode/plugin.py +55 -0
- imbue_mngr_opencode-0.2.0/imbue/mngr_opencode/plugin_test.py +25 -0
- imbue_mngr_opencode-0.2.0/imbue/mngr_opencode/test_ratchets.py +255 -0
- imbue_mngr_opencode-0.2.0/pyproject.toml +71 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
.venv-*
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
174
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
175
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
176
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
177
|
+
.idea/
|
|
178
|
+
|
|
179
|
+
# Abstra
|
|
180
|
+
# Abstra is an AI-powered process automation framework.
|
|
181
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
182
|
+
# Learn more at https://abstra.io/docs
|
|
183
|
+
.abstra/
|
|
184
|
+
|
|
185
|
+
# Visual Studio Code
|
|
186
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
187
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
189
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
190
|
+
# .vscode/
|
|
191
|
+
|
|
192
|
+
# Ruff stuff:
|
|
193
|
+
.ruff_cache/
|
|
194
|
+
|
|
195
|
+
# PyPI configuration file
|
|
196
|
+
.pypirc
|
|
197
|
+
|
|
198
|
+
# Cursor
|
|
199
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
200
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
201
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
202
|
+
.cursorignore
|
|
203
|
+
.cursorindexingignore
|
|
204
|
+
|
|
205
|
+
# Marimo
|
|
206
|
+
marimo/_static/
|
|
207
|
+
marimo/_lsp/
|
|
208
|
+
__marimo__/
|
|
209
|
+
|
|
210
|
+
# task folders for local custom claude workflow
|
|
211
|
+
*/*/_tasks/
|
|
212
|
+
.sesskey
|
|
213
|
+
|
|
214
|
+
# Node.js
|
|
215
|
+
node_modules/
|
|
216
|
+
|
|
217
|
+
# Frontend build artifacts
|
|
218
|
+
frontend-dist/
|
|
219
|
+
|
|
220
|
+
# Claude Code local settings (session-specific permissions)
|
|
221
|
+
.claude/settings.local.json
|
|
222
|
+
|
|
223
|
+
# PR status and URL files written by main_claude_stop_hook.sh for status line display
|
|
224
|
+
.claude/pr_url
|
|
225
|
+
.claude/pr_status
|
|
226
|
+
|
|
227
|
+
# Local Claude settings backup files
|
|
228
|
+
.claude/*.bak
|
|
229
|
+
|
|
230
|
+
# Local mngr settings (not committed)
|
|
231
|
+
.mngr/settings.local.toml
|
|
232
|
+
|
|
233
|
+
# so the user can make their own notification script
|
|
234
|
+
scripts/notify_user.local.sh
|
|
235
|
+
|
|
236
|
+
# Test output files (slow tests, coverage summaries)
|
|
237
|
+
.test_output/
|
|
238
|
+
|
|
239
|
+
# TMR output directories (reports + test outputs)
|
|
240
|
+
tmr_*/
|
|
241
|
+
|
|
242
|
+
# Active session marker file (used to detect interrupted sessions)
|
|
243
|
+
.claude/active
|
|
244
|
+
|
|
245
|
+
# we stick the image build artifacts here
|
|
246
|
+
.mngr/dev/build/
|
|
247
|
+
.mngr/dev/secrets/
|
|
248
|
+
|
|
249
|
+
# Offload caches and local files
|
|
250
|
+
.offload/**
|
|
251
|
+
test-results
|
|
252
|
+
current.tar.gz
|
|
253
|
+
|
|
254
|
+
# Minds deploy-time build artifacts
|
|
255
|
+
.minds/
|
|
256
|
+
|
|
257
|
+
# Autofix session artifacts
|
|
258
|
+
.autofix/
|
|
259
|
+
.reviewer/outputs/
|
|
260
|
+
.reviewer/settings.local.json
|
|
261
|
+
**/.reviewer/.stop_hook_consecutive_blocks
|
|
262
|
+
.reviews/
|
|
263
|
+
|
|
264
|
+
# Stuck agent tracking (stop hook escape valve)
|
|
265
|
+
.claude/blocked_stop_commits
|
|
266
|
+
|
|
267
|
+
# Demo recordings (asciinema .cast, .txt, and scripts)
|
|
268
|
+
.demos/
|
|
269
|
+
|
|
270
|
+
# for git worktrees from other repos
|
|
271
|
+
.external_worktrees/
|
|
272
|
+
|
|
273
|
+
# ignore coverage files generated within subprojects
|
|
274
|
+
cov.xml
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: imbue-mngr-opencode
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: OpenCode agent type plugin for mngr
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: imbue-mngr==0.2.0
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# imbue-mngr-opencode
|
|
10
|
+
|
|
11
|
+
Plugin that registers the `opencode` agent type for mngr.
|
|
12
|
+
|
|
13
|
+
[OpenCode](https://github.com/sst/opencode) is an open-source terminal-based AI coding assistant. This plugin lets you run it as an mngr agent.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
mngr create my-agent opencode
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Pass arguments to the opencode command with `--`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
mngr create my-agent opencode -- --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration
|
|
28
|
+
|
|
29
|
+
Define a custom variant in your mngr config (`mngr config edit`):
|
|
30
|
+
|
|
31
|
+
```toml
|
|
32
|
+
[agent_types.my_opencode]
|
|
33
|
+
parent_type = "opencode"
|
|
34
|
+
cli_args = "--some-flag"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then create agents with your custom type:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
mngr create my-agent my_opencode
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See the [mngr agent types documentation](https://github.com/imbue-ai/mngr/blob/main/libs/mngr/docs/concepts/agent_types.md) for more details.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# imbue-mngr-opencode
|
|
2
|
+
|
|
3
|
+
Plugin that registers the `opencode` agent type for mngr.
|
|
4
|
+
|
|
5
|
+
[OpenCode](https://github.com/sst/opencode) is an open-source terminal-based AI coding assistant. This plugin lets you run it as an mngr agent.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
mngr create my-agent opencode
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Pass arguments to the opencode command with `--`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
mngr create my-agent opencode -- --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configuration
|
|
20
|
+
|
|
21
|
+
Define a custom variant in your mngr config (`mngr config edit`):
|
|
22
|
+
|
|
23
|
+
```toml
|
|
24
|
+
[agent_types.my_opencode]
|
|
25
|
+
parent_type = "opencode"
|
|
26
|
+
cli_args = "--some-flag"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then create agents with your custom type:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
mngr create my-agent my_opencode
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
See the [mngr agent types documentation](https://github.com/imbue-ai/mngr/blob/main/libs/mngr/docs/concepts/agent_types.md) for more details.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Project-level conftest for mngr-opencode.
|
|
2
|
+
|
|
3
|
+
When running tests from libs/mngr_opencode/, this conftest provides the common pytest hooks
|
|
4
|
+
that would otherwise come from the monorepo root conftest.py (which is not discovered
|
|
5
|
+
when pytest runs from a subdirectory).
|
|
6
|
+
|
|
7
|
+
When running from the monorepo root, the root conftest.py registers the hooks first,
|
|
8
|
+
and this file's register_conftest_hooks() call is a no-op (guarded by a module-level flag).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from imbue.imbue_common.conftest_hooks import register_conftest_hooks
|
|
12
|
+
from imbue.mngr.utils.logging import suppress_warnings
|
|
13
|
+
|
|
14
|
+
suppress_warnings()
|
|
15
|
+
register_conftest_hooks(globals())
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from pydantic import Field
|
|
2
|
+
|
|
3
|
+
from imbue.mngr import hookimpl
|
|
4
|
+
from imbue.mngr.config.data_types import AgentTypeConfig
|
|
5
|
+
from imbue.mngr.errors import ConfigParseError
|
|
6
|
+
from imbue.mngr.interfaces.agent import AgentInterface
|
|
7
|
+
from imbue.mngr.primitives import CommandString
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class OpenCodeAgentConfig(AgentTypeConfig):
|
|
11
|
+
"""Config for the opencode agent type."""
|
|
12
|
+
|
|
13
|
+
command: CommandString = Field(
|
|
14
|
+
default=CommandString("opencode"),
|
|
15
|
+
description="Command to run opencode agent",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def merge_with(self, override: AgentTypeConfig) -> AgentTypeConfig:
|
|
19
|
+
"""
|
|
20
|
+
Merge this config with an override config.
|
|
21
|
+
|
|
22
|
+
Important note: despite the type signatures, any of these fields may be None in the override--this means that they were NOT set in the toml (and thus should be ignored)
|
|
23
|
+
"""
|
|
24
|
+
if not isinstance(override, OpenCodeAgentConfig):
|
|
25
|
+
raise ConfigParseError("Cannot merge OpenCodeAgentConfig with different agent config type")
|
|
26
|
+
|
|
27
|
+
# Merge parent_type (scalar - override wins if not None)
|
|
28
|
+
merged_parent_type = override.parent_type if override.parent_type is not None else self.parent_type
|
|
29
|
+
|
|
30
|
+
# Merge command (scalar - override wins if not None)
|
|
31
|
+
merged_command = self.command
|
|
32
|
+
if hasattr(override, "command") and override.command is not None:
|
|
33
|
+
merged_command = override.command
|
|
34
|
+
|
|
35
|
+
# Merge cli_args (concatenate both tuples)
|
|
36
|
+
merged_cli_args = self.cli_args + override.cli_args if override.cli_args else self.cli_args
|
|
37
|
+
|
|
38
|
+
# Merge permissions (list - concatenate if override is not None)
|
|
39
|
+
merged_permissions = self.permissions
|
|
40
|
+
if override.permissions is not None:
|
|
41
|
+
merged_permissions = list(self.permissions) + list(override.permissions)
|
|
42
|
+
|
|
43
|
+
return self.__class__(
|
|
44
|
+
parent_type=merged_parent_type,
|
|
45
|
+
cli_args=merged_cli_args,
|
|
46
|
+
command=merged_command,
|
|
47
|
+
permissions=merged_permissions,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Module-level hook implementation for pluggy entry point discovery
|
|
52
|
+
@hookimpl
|
|
53
|
+
def register_agent_type() -> tuple[str, type[AgentInterface] | None, type[AgentTypeConfig]]:
|
|
54
|
+
"""Register the opencode agent type."""
|
|
55
|
+
return ("opencode", None, OpenCodeAgentConfig)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Unit tests for OpenCodeAgentConfig."""
|
|
2
|
+
|
|
3
|
+
from imbue.mngr_opencode.plugin import OpenCodeAgentConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_opencode_agent_config_has_correct_defaults() -> None:
|
|
7
|
+
"""Verify that OpenCodeAgentConfig has the expected default values."""
|
|
8
|
+
config = OpenCodeAgentConfig()
|
|
9
|
+
|
|
10
|
+
assert str(config.command) == "opencode"
|
|
11
|
+
assert config.cli_args == ()
|
|
12
|
+
assert config.permissions == []
|
|
13
|
+
assert config.parent_type is None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_opencode_agent_config_merge_with_override() -> None:
|
|
17
|
+
"""Verify that merge_with works correctly for OpenCodeAgentConfig."""
|
|
18
|
+
base = OpenCodeAgentConfig()
|
|
19
|
+
override = OpenCodeAgentConfig(cli_args=("--verbose",))
|
|
20
|
+
|
|
21
|
+
merged = base.merge_with(override)
|
|
22
|
+
|
|
23
|
+
assert isinstance(merged, OpenCodeAgentConfig)
|
|
24
|
+
assert merged.cli_args == ("--verbose",)
|
|
25
|
+
assert str(merged.command) == "opencode"
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from inline_snapshot import snapshot
|
|
5
|
+
|
|
6
|
+
from imbue.imbue_common.ratchet_testing import standard_ratchet_checks as rc
|
|
7
|
+
from imbue.imbue_common.ratchet_testing.ratchets import check_no_ruff_errors
|
|
8
|
+
from imbue.imbue_common.ratchet_testing.ratchets import check_no_type_errors
|
|
9
|
+
|
|
10
|
+
_DIR = Path(__file__).parent.parent.parent
|
|
11
|
+
|
|
12
|
+
pytestmark = pytest.mark.xdist_group(name="ratchets")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# --- Code safety ---
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_prevent_todos() -> None:
|
|
19
|
+
rc.check_todos(_DIR, snapshot(0))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_prevent_exec_usage() -> None:
|
|
23
|
+
rc.check_exec(_DIR, snapshot(0))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_prevent_eval_usage() -> None:
|
|
27
|
+
rc.check_eval(_DIR, snapshot(0))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_prevent_while_true() -> None:
|
|
31
|
+
rc.check_while_true(_DIR, snapshot(0))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_prevent_time_sleep() -> None:
|
|
35
|
+
rc.check_time_sleep(_DIR, snapshot(0))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_prevent_global_keyword() -> None:
|
|
39
|
+
rc.check_global_keyword(_DIR, snapshot(0))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_prevent_bare_print() -> None:
|
|
43
|
+
rc.check_bare_print(_DIR, snapshot(0))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# --- Exception handling ---
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_prevent_bare_except() -> None:
|
|
50
|
+
rc.check_bare_except(_DIR, snapshot(0))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_prevent_broad_exception_catch() -> None:
|
|
54
|
+
rc.check_broad_exception_catch(_DIR, snapshot(0))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_prevent_base_exception_catch() -> None:
|
|
58
|
+
rc.check_base_exception_catch(_DIR, snapshot(0))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_prevent_builtin_exception_raises() -> None:
|
|
62
|
+
rc.check_builtin_exception_raises(_DIR, snapshot(0))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# --- Import style ---
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_prevent_inline_imports() -> None:
|
|
69
|
+
rc.check_inline_imports(_DIR, snapshot(0))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_prevent_relative_imports() -> None:
|
|
73
|
+
rc.check_relative_imports(_DIR, snapshot(0))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_prevent_import_datetime() -> None:
|
|
77
|
+
rc.check_import_datetime(_DIR, snapshot(0))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_prevent_importlib_import_module() -> None:
|
|
81
|
+
rc.check_importlib_import_module(_DIR, snapshot(0))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_prevent_getattr() -> None:
|
|
85
|
+
rc.check_getattr(_DIR, snapshot(0))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_prevent_setattr() -> None:
|
|
89
|
+
rc.check_setattr(_DIR, snapshot(0))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# --- Banned libraries and patterns ---
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_prevent_asyncio_import() -> None:
|
|
96
|
+
rc.check_asyncio_import(_DIR, snapshot(0))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def test_prevent_pandas_import() -> None:
|
|
100
|
+
rc.check_pandas_import(_DIR, snapshot(0))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_prevent_dataclasses_import() -> None:
|
|
104
|
+
rc.check_dataclasses_import(_DIR, snapshot(0))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def test_prevent_namedtuple_usage() -> None:
|
|
108
|
+
rc.check_namedtuple(_DIR, snapshot(0))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def test_prevent_yaml_usage() -> None:
|
|
112
|
+
rc.check_yaml_usage(_DIR, snapshot(0))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def test_prevent_functools_partial() -> None:
|
|
116
|
+
rc.check_functools_partial(_DIR, snapshot(0))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# --- Naming conventions ---
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def test_prevent_num_prefix() -> None:
|
|
123
|
+
rc.check_num_prefix(_DIR, snapshot(0))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# --- Documentation ---
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def test_prevent_trailing_comments() -> None:
|
|
130
|
+
rc.check_trailing_comments(_DIR, snapshot(0))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_prevent_init_docstrings() -> None:
|
|
134
|
+
rc.check_init_docstrings(_DIR, snapshot(0))
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@pytest.mark.timeout(10)
|
|
138
|
+
def test_prevent_args_in_docstrings() -> None:
|
|
139
|
+
rc.check_args_in_docstrings(_DIR, snapshot(0))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@pytest.mark.timeout(10)
|
|
143
|
+
def test_prevent_returns_in_docstrings() -> None:
|
|
144
|
+
rc.check_returns_in_docstrings(_DIR, snapshot(0))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# --- Type safety ---
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_prevent_literal_with_multiple_options() -> None:
|
|
151
|
+
rc.check_literal_with_multiple_options(_DIR, snapshot(0))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def test_prevent_bare_generic_types() -> None:
|
|
155
|
+
rc.check_bare_generic_types(_DIR, snapshot(0))
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def test_prevent_typing_builtin_imports() -> None:
|
|
159
|
+
rc.check_typing_builtin_imports(_DIR, snapshot(0))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def test_prevent_short_uuid_ids() -> None:
|
|
163
|
+
rc.check_short_uuid_ids(_DIR, snapshot(0))
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# --- Pydantic / models ---
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def test_prevent_model_copy() -> None:
|
|
170
|
+
rc.check_model_copy(_DIR, snapshot(0))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# --- Logging ---
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def test_prevent_fstring_logging() -> None:
|
|
177
|
+
rc.check_fstring_logging(_DIR, snapshot(0))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_prevent_click_echo() -> None:
|
|
181
|
+
rc.check_click_echo(_DIR, snapshot(0))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# --- Testing conventions ---
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def test_prevent_unittest_mock_imports() -> None:
|
|
188
|
+
rc.check_unittest_mock_imports(_DIR, snapshot(0))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def test_prevent_monkeypatch_setattr() -> None:
|
|
192
|
+
rc.check_monkeypatch_setattr(_DIR, snapshot(0))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def test_prevent_test_container_classes() -> None:
|
|
196
|
+
rc.check_test_container_classes(_DIR, snapshot(0))
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def test_prevent_pytest_mark_integration() -> None:
|
|
200
|
+
rc.check_pytest_mark_integration(_DIR, snapshot(0))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# --- Process management ---
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def test_prevent_os_fork() -> None:
|
|
207
|
+
rc.check_os_fork(_DIR, snapshot(0))
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def test_prevent_direct_subprocess_usage() -> None:
|
|
211
|
+
rc.check_direct_subprocess(_DIR, snapshot(0))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# --- AST-based ratchets ---
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def test_prevent_if_elif_without_else() -> None:
|
|
218
|
+
rc.check_if_elif_without_else(_DIR, snapshot(0))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def test_prevent_inline_functions_in_non_test_code() -> None:
|
|
222
|
+
rc.check_inline_functions(_DIR, snapshot(0))
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def test_prevent_importing_underscore_prefixed_names_in_non_test_code() -> None:
|
|
226
|
+
rc.check_underscore_imports(_DIR, snapshot(0))
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def test_prevent_init_methods_in_non_exception_classes() -> None:
|
|
230
|
+
rc.check_init_methods_in_non_exception_classes(_DIR, snapshot(0))
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def test_prevent_cast_usage() -> None:
|
|
234
|
+
rc.check_cast_usage(_DIR, snapshot(0))
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def test_prevent_assert_isinstance_usage() -> None:
|
|
238
|
+
rc.check_assert_isinstance(_DIR, snapshot(0))
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
# --- Project-level checks ---
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def test_prevent_code_in_init_files() -> None:
|
|
245
|
+
rc.check_code_in_init_files(_DIR, snapshot(0))
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def test_no_type_errors() -> None:
|
|
249
|
+
"""Ensure the codebase has zero type errors."""
|
|
250
|
+
check_no_type_errors(_DIR)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def test_no_ruff_errors() -> None:
|
|
254
|
+
"""Ensure the codebase has zero ruff linting errors."""
|
|
255
|
+
check_no_ruff_errors(_DIR)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "imbue-mngr-opencode"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "OpenCode agent type plugin for mngr"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"imbue-mngr==0.2.0",
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
[project.entry-points.mngr]
|
|
12
|
+
opencode = "imbue.mngr_opencode.plugin"
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["hatchling"]
|
|
16
|
+
build-backend = "hatchling.build"
|
|
17
|
+
|
|
18
|
+
[tool.hatch.build.targets.wheel]
|
|
19
|
+
packages = ["imbue"]
|
|
20
|
+
|
|
21
|
+
[tool.uv.sources]
|
|
22
|
+
imbue-mngr = { workspace = true }
|
|
23
|
+
|
|
24
|
+
# Shared pytest settings (markers, filterwarnings, coverage report config)
|
|
25
|
+
# are centralized in:
|
|
26
|
+
# libs/imbue_common/imbue/imbue_common/conftest_hooks.py
|
|
27
|
+
# The settings below remain here because they are read from pyproject.toml
|
|
28
|
+
# before any hooks run: addopts, coverage.run, inline-snapshot, timeout_func_only.
|
|
29
|
+
[tool.pytest.ini_options]
|
|
30
|
+
timeout_func_only = true
|
|
31
|
+
junit_family = "xunit1"
|
|
32
|
+
testpaths = ["."]
|
|
33
|
+
addopts = [
|
|
34
|
+
"-n 4",
|
|
35
|
+
"--dist=worksteal",
|
|
36
|
+
"--cov=imbue.mngr_opencode",
|
|
37
|
+
"--cov-report=term-missing",
|
|
38
|
+
"--cov-report=html",
|
|
39
|
+
"--cov-report=xml",
|
|
40
|
+
"--cov-fail-under=90",
|
|
41
|
+
"--durations=20",
|
|
42
|
+
"--timeout=10",
|
|
43
|
+
"--timeout-method=signal",
|
|
44
|
+
"--max-worker-restart=0",
|
|
45
|
+
"-m not acceptance and not release",
|
|
46
|
+
"--slow-tests-to-file",
|
|
47
|
+
"--coverage-to-file",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[tool.coverage.run]
|
|
51
|
+
parallel = true
|
|
52
|
+
concurrency = ["multiprocessing", "thread"]
|
|
53
|
+
omit = [
|
|
54
|
+
"*_test.py",
|
|
55
|
+
"test_*.py",
|
|
56
|
+
"*/tests/*",
|
|
57
|
+
"*/conftest.py",
|
|
58
|
+
"*/utils/testing.py",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[tool.inline-snapshot]
|
|
62
|
+
default-flags=["report"]
|
|
63
|
+
default-flags-tui=["report"]
|
|
64
|
+
default-flags-ide=["report"]
|
|
65
|
+
format-command="uv run ruff format --force-exclude --config pyproject.toml --stdin-filename {filename}"
|
|
66
|
+
|
|
67
|
+
[tool.pyright]
|
|
68
|
+
venvPath = "../.."
|
|
69
|
+
venv = ".venv"
|
|
70
|
+
pythonVersion = "3.11"
|
|
71
|
+
strict = ["**/*.py"]
|