ojiichan 0.1.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.
- ojiichan-0.1.0/.gitignore +173 -0
- ojiichan-0.1.0/LICENSE +21 -0
- ojiichan-0.1.0/PKG-INFO +180 -0
- ojiichan-0.1.0/README.md +132 -0
- ojiichan-0.1.0/locke.json +28 -0
- ojiichan-0.1.0/pyproject.toml +62 -0
- ojiichan-0.1.0/src/ojiichan/__init__.py +16 -0
- ojiichan-0.1.0/src/ojiichan/beads.py +29 -0
- ojiichan-0.1.0/src/ojiichan/bugsink.py +111 -0
- ojiichan-0.1.0/src/ojiichan/cli.py +134 -0
- ojiichan-0.1.0/src/ojiichan/config.py +98 -0
- ojiichan-0.1.0/src/ojiichan/credentials.py +73 -0
- ojiichan-0.1.0/src/ojiichan/elk.py +207 -0
- ojiichan-0.1.0/src/ojiichan/sentry.py +58 -0
- ojiichan-0.1.0/src/ojiichan_mcp/__init__.py +1 -0
- ojiichan-0.1.0/src/ojiichan_mcp/server.py +217 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
### Python template
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
111
|
+
.pdm.toml
|
|
112
|
+
.pdm-python
|
|
113
|
+
.pdm-build/
|
|
114
|
+
|
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
116
|
+
__pypackages__/
|
|
117
|
+
|
|
118
|
+
# Celery stuff
|
|
119
|
+
celerybeat-schedule
|
|
120
|
+
celerybeat.pid
|
|
121
|
+
|
|
122
|
+
# SageMath parsed files
|
|
123
|
+
*.sage.py
|
|
124
|
+
|
|
125
|
+
# Environments
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# Pyre type checker
|
|
150
|
+
.pyre/
|
|
151
|
+
|
|
152
|
+
# pytype static type analyzer
|
|
153
|
+
.pytype/
|
|
154
|
+
|
|
155
|
+
# Cython debug symbols
|
|
156
|
+
cython_debug/
|
|
157
|
+
|
|
158
|
+
# IDE
|
|
159
|
+
.idea/
|
|
160
|
+
.vscode/
|
|
161
|
+
*.swp
|
|
162
|
+
*.swo
|
|
163
|
+
|
|
164
|
+
# Ruff
|
|
165
|
+
.ruff_cache/
|
|
166
|
+
|
|
167
|
+
# Environments / secrets
|
|
168
|
+
.env.*
|
|
169
|
+
.locke/config.json
|
|
170
|
+
|
|
171
|
+
# Local hook/debug outputs
|
|
172
|
+
/hook_outputs/
|
|
173
|
+
**/hook_outputs/
|
ojiichan-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Martin Wieser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ojiichan-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ojiichan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pseekoo diagnostics toolkit for ELK, Bugsink/Sentry, and issue handoff workflows.
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/pseekoo/ojiichan
|
|
6
|
+
Project-URL: Repository, https://gitlab.com/pseekoo/ojiichan
|
|
7
|
+
Project-URL: Issues, https://gitlab.com/pseekoo/ojiichan/-/issues
|
|
8
|
+
Author-email: Martin Wieser <martin.wieser@pseekoo.com>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Martin Wieser
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
37
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
38
|
+
Classifier: Topic :: System :: Logging
|
|
39
|
+
Requires-Python: >=3.11
|
|
40
|
+
Requires-Dist: elasticsearch<9.0,>=8.0
|
|
41
|
+
Requires-Dist: httpx>=0.27
|
|
42
|
+
Requires-Dist: mcp>=1.0
|
|
43
|
+
Requires-Dist: python-dotenv>=1.0
|
|
44
|
+
Requires-Dist: sentry-sdk>=2.22
|
|
45
|
+
Provides-Extra: vault
|
|
46
|
+
Requires-Dist: locke>=0.5.2; extra == 'vault'
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
|
|
49
|
+
# ojiichan
|
|
50
|
+
|
|
51
|
+
Pseekoo diagnostics toolkit for projects that report to **ELK** and **Bugsink/Sentry**.
|
|
52
|
+
|
|
53
|
+
It provides both:
|
|
54
|
+
|
|
55
|
+
- a Python library (`ojiichan`) for structured ELK events and Sentry/Bugsink setup;
|
|
56
|
+
- a CLI (`ojiichan`) for health checks, recent logs, and test event emission.
|
|
57
|
+
|
|
58
|
+
It standardizes the same observability workflow across Python services.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv add ojiichan
|
|
64
|
+
# with Locke/Vaultwarden credential support:
|
|
65
|
+
uv add "ojiichan[vault]"
|
|
66
|
+
# or for development:
|
|
67
|
+
uv sync
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Configuration and credentials
|
|
71
|
+
|
|
72
|
+
Ojiichan resolves explicit environment variables first, then Locke/Vaultwarden secrets when installed with the `vault` extra. The checked-in `locke.json` documents the expected Vaultwarden paths; no sample env file with secret-shaped values is needed.
|
|
73
|
+
|
|
74
|
+
Default vault folder: `ojiichan`.
|
|
75
|
+
Override it with `OJIICHAN_VAULT_FOLDER` when needed.
|
|
76
|
+
|
|
77
|
+
Non-secret options can still be set as env vars, for example `ELASTICSEARCH_PORT`, `ELASTICSEARCH_USE_SSL`, `ELASTICSEARCH_VERIFY_CERTS`, `ELASTICSEARCH_TIMEOUT`, and `BUGSINK_TIMEOUT`.
|
|
78
|
+
|
|
79
|
+
## CLI
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
ojiichan health --hours 6
|
|
83
|
+
ojiichan logs --hours 2 --topic matrix --failures-only
|
|
84
|
+
ojiichan emit matrix_exchange_failed --topic auth --level error --failure \
|
|
85
|
+
--data '{"operation":"matrix_exchange","room_id":"!abc"}'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Library
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from ojiichan import ElkClient, init_sentry
|
|
92
|
+
|
|
93
|
+
init_sentry(service="stoz3n-chat-agent", environment="development")
|
|
94
|
+
|
|
95
|
+
elk = ElkClient(service="stoz3n-chat-agent")
|
|
96
|
+
elk.log_event(
|
|
97
|
+
"matrix_exchange_start",
|
|
98
|
+
{"operation": "matrix_exchange", "user_id": "@user:example.org"},
|
|
99
|
+
topic="auth",
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For exception paths:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
try:
|
|
107
|
+
...
|
|
108
|
+
except Exception as exc:
|
|
109
|
+
elk.log_event(
|
|
110
|
+
"matrix_exchange_failed",
|
|
111
|
+
{"operation": "matrix_exchange", "error": str(exc)},
|
|
112
|
+
level="error",
|
|
113
|
+
topic="auth",
|
|
114
|
+
failure=True,
|
|
115
|
+
)
|
|
116
|
+
raise
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## MCP server
|
|
120
|
+
|
|
121
|
+
Ojiichan also ships a local stdio MCP server so coding agents can query diagnostics and run repeatable test/build checks without hardcoding shell snippets.
|
|
122
|
+
|
|
123
|
+
Run it manually:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
uv run ojiichan-mcp
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Example MCP client config:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"mcpServers": {
|
|
134
|
+
"ojiichan": {
|
|
135
|
+
"command": "uv",
|
|
136
|
+
"args": [
|
|
137
|
+
"run",
|
|
138
|
+
"--with",
|
|
139
|
+
"ojiichan[vault]",
|
|
140
|
+
"ojiichan-mcp"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Exposed tools:
|
|
148
|
+
|
|
149
|
+
- `elk_health`
|
|
150
|
+
- `elk_logs`
|
|
151
|
+
- `emit_elk_event`
|
|
152
|
+
- `bugsink_health`
|
|
153
|
+
- `bugsink_issues`
|
|
154
|
+
- `create_bead_from_issue`
|
|
155
|
+
- `xcode_build`
|
|
156
|
+
- `xcode_test`
|
|
157
|
+
|
|
158
|
+
For Xcode projects, an agent can call `xcode_test` with a local `project_path`, `scheme`, and `destination`.
|
|
159
|
+
|
|
160
|
+
## Release
|
|
161
|
+
|
|
162
|
+
Publishing is handled by GitLab CI in the public `pseekoo/ojiichan` repository:
|
|
163
|
+
|
|
164
|
+
- pushes to the default branch publish a PEP 440 dev build to the GitLab PyPI registry;
|
|
165
|
+
- tags matching `vX.Y.Z` publish the release to the GitLab PyPI registry and to pypi.org;
|
|
166
|
+
- tagged releases require `PYPI_API_TOKEN` in GitLab CI variables.
|
|
167
|
+
|
|
168
|
+
To release the current version:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
git tag v0.1.0
|
|
172
|
+
git push origin main --tags
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Notes
|
|
176
|
+
|
|
177
|
+
- Bugsink ingestion uses the normal Sentry SDK via `SENTRY_DSN`.
|
|
178
|
+
- Bugsink issue reads use the canonical read API at `/api/canonical/0/issues/` and require `BUGSINK_API_TOKEN`.
|
|
179
|
+
- Beads integration is intentionally optional; `ojiichan.beads` shells out only when `bead`/`beads` is installed.
|
|
180
|
+
- The public distribution and import package are both `ojiichan`; the GitLab repository can live under the `pseekoo` group without changing Python names.
|
ojiichan-0.1.0/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# ojiichan
|
|
2
|
+
|
|
3
|
+
Pseekoo diagnostics toolkit for projects that report to **ELK** and **Bugsink/Sentry**.
|
|
4
|
+
|
|
5
|
+
It provides both:
|
|
6
|
+
|
|
7
|
+
- a Python library (`ojiichan`) for structured ELK events and Sentry/Bugsink setup;
|
|
8
|
+
- a CLI (`ojiichan`) for health checks, recent logs, and test event emission.
|
|
9
|
+
|
|
10
|
+
It standardizes the same observability workflow across Python services.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uv add ojiichan
|
|
16
|
+
# with Locke/Vaultwarden credential support:
|
|
17
|
+
uv add "ojiichan[vault]"
|
|
18
|
+
# or for development:
|
|
19
|
+
uv sync
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Configuration and credentials
|
|
23
|
+
|
|
24
|
+
Ojiichan resolves explicit environment variables first, then Locke/Vaultwarden secrets when installed with the `vault` extra. The checked-in `locke.json` documents the expected Vaultwarden paths; no sample env file with secret-shaped values is needed.
|
|
25
|
+
|
|
26
|
+
Default vault folder: `ojiichan`.
|
|
27
|
+
Override it with `OJIICHAN_VAULT_FOLDER` when needed.
|
|
28
|
+
|
|
29
|
+
Non-secret options can still be set as env vars, for example `ELASTICSEARCH_PORT`, `ELASTICSEARCH_USE_SSL`, `ELASTICSEARCH_VERIFY_CERTS`, `ELASTICSEARCH_TIMEOUT`, and `BUGSINK_TIMEOUT`.
|
|
30
|
+
|
|
31
|
+
## CLI
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
ojiichan health --hours 6
|
|
35
|
+
ojiichan logs --hours 2 --topic matrix --failures-only
|
|
36
|
+
ojiichan emit matrix_exchange_failed --topic auth --level error --failure \
|
|
37
|
+
--data '{"operation":"matrix_exchange","room_id":"!abc"}'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Library
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from ojiichan import ElkClient, init_sentry
|
|
44
|
+
|
|
45
|
+
init_sentry(service="stoz3n-chat-agent", environment="development")
|
|
46
|
+
|
|
47
|
+
elk = ElkClient(service="stoz3n-chat-agent")
|
|
48
|
+
elk.log_event(
|
|
49
|
+
"matrix_exchange_start",
|
|
50
|
+
{"operation": "matrix_exchange", "user_id": "@user:example.org"},
|
|
51
|
+
topic="auth",
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For exception paths:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
try:
|
|
59
|
+
...
|
|
60
|
+
except Exception as exc:
|
|
61
|
+
elk.log_event(
|
|
62
|
+
"matrix_exchange_failed",
|
|
63
|
+
{"operation": "matrix_exchange", "error": str(exc)},
|
|
64
|
+
level="error",
|
|
65
|
+
topic="auth",
|
|
66
|
+
failure=True,
|
|
67
|
+
)
|
|
68
|
+
raise
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## MCP server
|
|
72
|
+
|
|
73
|
+
Ojiichan also ships a local stdio MCP server so coding agents can query diagnostics and run repeatable test/build checks without hardcoding shell snippets.
|
|
74
|
+
|
|
75
|
+
Run it manually:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uv run ojiichan-mcp
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Example MCP client config:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"ojiichan": {
|
|
87
|
+
"command": "uv",
|
|
88
|
+
"args": [
|
|
89
|
+
"run",
|
|
90
|
+
"--with",
|
|
91
|
+
"ojiichan[vault]",
|
|
92
|
+
"ojiichan-mcp"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Exposed tools:
|
|
100
|
+
|
|
101
|
+
- `elk_health`
|
|
102
|
+
- `elk_logs`
|
|
103
|
+
- `emit_elk_event`
|
|
104
|
+
- `bugsink_health`
|
|
105
|
+
- `bugsink_issues`
|
|
106
|
+
- `create_bead_from_issue`
|
|
107
|
+
- `xcode_build`
|
|
108
|
+
- `xcode_test`
|
|
109
|
+
|
|
110
|
+
For Xcode projects, an agent can call `xcode_test` with a local `project_path`, `scheme`, and `destination`.
|
|
111
|
+
|
|
112
|
+
## Release
|
|
113
|
+
|
|
114
|
+
Publishing is handled by GitLab CI in the public `pseekoo/ojiichan` repository:
|
|
115
|
+
|
|
116
|
+
- pushes to the default branch publish a PEP 440 dev build to the GitLab PyPI registry;
|
|
117
|
+
- tags matching `vX.Y.Z` publish the release to the GitLab PyPI registry and to pypi.org;
|
|
118
|
+
- tagged releases require `PYPI_API_TOKEN` in GitLab CI variables.
|
|
119
|
+
|
|
120
|
+
To release the current version:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
git tag v0.1.0
|
|
124
|
+
git push origin main --tags
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Notes
|
|
128
|
+
|
|
129
|
+
- Bugsink ingestion uses the normal Sentry SDK via `SENTRY_DSN`.
|
|
130
|
+
- Bugsink issue reads use the canonical read API at `/api/canonical/0/issues/` and require `BUGSINK_API_TOKEN`.
|
|
131
|
+
- Beads integration is intentionally optional; `ojiichan.beads` shells out only when `bead`/`beads` is installed.
|
|
132
|
+
- The public distribution and import package are both `ojiichan`; the GitLab repository can live under the `pseekoo` group without changing Python names.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"project": "ojiichan",
|
|
4
|
+
"tenant": "default",
|
|
5
|
+
"keys": {
|
|
6
|
+
"_comment": "Ojiichan credential registry. Secret values live in Locke/Vaultwarden, not in sample env files.",
|
|
7
|
+
"vault": {
|
|
8
|
+
"_comment": "Path format: {project}/{tenant}/{name}. Ojiichan also supports OJIICHAN_VAULT_FOLDER to override the folder prefix.",
|
|
9
|
+
"ojiichan/elasticsearch-host": "Elasticsearch host or base URL",
|
|
10
|
+
"ojiichan/elasticsearch-username": "Elasticsearch username",
|
|
11
|
+
"ojiichan/elasticsearch-password": "Elasticsearch password",
|
|
12
|
+
"ojiichan/elasticsearch-index-prefix": "Default Elasticsearch index prefix",
|
|
13
|
+
"ojiichan/sentry-dsn": "Sentry/Bugsink ingest DSN",
|
|
14
|
+
"ojiichan/bugsink-api-token": "Bugsink API token for issue reads",
|
|
15
|
+
"ojiichan/bugsink-host": "Bugsink host when not derivable from DSN",
|
|
16
|
+
"ojiichan/bugsink-project-id": "Bugsink project id when not derivable from DSN"
|
|
17
|
+
},
|
|
18
|
+
"env": {
|
|
19
|
+
"_comment": "Non-secret runtime options or explicit local overrides.",
|
|
20
|
+
"OJIICHAN_VAULT_FOLDER": "Optional Vaultwarden folder prefix; defaults to ojiichan",
|
|
21
|
+
"ELASTICSEARCH_PORT": "Elasticsearch port; defaults to 443",
|
|
22
|
+
"ELASTICSEARCH_USE_SSL": "true/false; defaults to true",
|
|
23
|
+
"ELASTICSEARCH_VERIFY_CERTS": "true/false; defaults to true",
|
|
24
|
+
"ELASTICSEARCH_TIMEOUT": "Elasticsearch timeout seconds; defaults to 10",
|
|
25
|
+
"BUGSINK_TIMEOUT": "Bugsink API timeout seconds; defaults to 10"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "ojiichan"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Pseekoo diagnostics toolkit for ELK, Bugsink/Sentry, and issue handoff workflows."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { file = "LICENSE" }
|
|
7
|
+
authors = [{ name = "Martin Wieser", email = "martin.wieser@pseekoo.com" }]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3",
|
|
11
|
+
"Programming Language :: Python :: 3.11",
|
|
12
|
+
"Programming Language :: Python :: 3.12",
|
|
13
|
+
"Programming Language :: Python :: 3.13",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Topic :: System :: Logging",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"elasticsearch>=8.0,<9.0",
|
|
21
|
+
"httpx>=0.27",
|
|
22
|
+
"mcp>=1.0",
|
|
23
|
+
"python-dotenv>=1.0",
|
|
24
|
+
"sentry-sdk>=2.22",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
vault = [
|
|
29
|
+
"locke>=0.5.2",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://gitlab.com/pseekoo/ojiichan"
|
|
34
|
+
Repository = "https://gitlab.com/pseekoo/ojiichan"
|
|
35
|
+
Issues = "https://gitlab.com/pseekoo/ojiichan/-/issues"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
ojiichan = "ojiichan.cli:main"
|
|
39
|
+
ojiichan-mcp = "ojiichan_mcp.server:main"
|
|
40
|
+
|
|
41
|
+
[dependency-groups]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8",
|
|
44
|
+
"ruff>=0.8",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[tool.ruff]
|
|
48
|
+
line-length = 100
|
|
49
|
+
target-version = "py311"
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint]
|
|
52
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
53
|
+
|
|
54
|
+
[build-system]
|
|
55
|
+
requires = ["hatchling"]
|
|
56
|
+
build-backend = "hatchling.build"
|
|
57
|
+
|
|
58
|
+
[tool.hatch.build.targets.wheel]
|
|
59
|
+
packages = ["src/ojiichan", "src/ojiichan_mcp"]
|
|
60
|
+
|
|
61
|
+
[tool.hatch.build.targets.sdist]
|
|
62
|
+
include = ["src/ojiichan", "src/ojiichan_mcp", "README.md", "LICENSE", "locke.json", "pyproject.toml"]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Ojiichan diagnostics toolkit."""
|
|
2
|
+
|
|
3
|
+
from .bugsink import BugsinkClient, BugsinkIssue, check_bugsink
|
|
4
|
+
from .elk import ElkClient, check_elk, query_elk_logs
|
|
5
|
+
from .sentry import capture_exception, init_sentry
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"BugsinkClient",
|
|
9
|
+
"BugsinkIssue",
|
|
10
|
+
"ElkClient",
|
|
11
|
+
"capture_exception",
|
|
12
|
+
"check_bugsink",
|
|
13
|
+
"check_elk",
|
|
14
|
+
"init_sentry",
|
|
15
|
+
"query_elk_logs",
|
|
16
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Optional Beads issue-tracker handoff helpers.
|
|
2
|
+
|
|
3
|
+
This intentionally shells out to `bead`/`beads` when present instead of taking a
|
|
4
|
+
hard dependency on a Python API, so ojiichan remains reusable in projects that do
|
|
5
|
+
not use Beads.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import shutil
|
|
11
|
+
import subprocess
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def beads_available() -> bool:
|
|
15
|
+
return bool(shutil.which("bead") or shutil.which("beads"))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def create_bead(title: str, body: str, *, labels: list[str] | None = None) -> bool:
|
|
19
|
+
exe = shutil.which("bead") or shutil.which("beads")
|
|
20
|
+
if not exe:
|
|
21
|
+
return False
|
|
22
|
+
cmd = [exe, "create", title, "--body", body]
|
|
23
|
+
for label in labels or []:
|
|
24
|
+
cmd.extend(["--label", label])
|
|
25
|
+
try:
|
|
26
|
+
subprocess.run(cmd, check=True)
|
|
27
|
+
return True
|
|
28
|
+
except Exception:
|
|
29
|
+
return False
|