agentmux 1.0.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.
- agentmux-1.0.0/.github/workflows/ci.yml +44 -0
- agentmux-1.0.0/.github/workflows/publish.yml +76 -0
- agentmux-1.0.0/.gitignore +207 -0
- agentmux-1.0.0/AGENTS.md +212 -0
- agentmux-1.0.0/LICENSE +21 -0
- agentmux-1.0.0/PKG-INFO +193 -0
- agentmux-1.0.0/README.md +135 -0
- agentmux-1.0.0/pyproject.toml +103 -0
- agentmux-1.0.0/src/agentmux/__init__.py +1 -0
- agentmux-1.0.0/src/agentmux/adapters/__init__.py +3 -0
- agentmux-1.0.0/src/agentmux/adapters/base.py +155 -0
- agentmux-1.0.0/src/agentmux/adapters/claude_code.py +231 -0
- agentmux-1.0.0/src/agentmux/adapters/cursor.py +110 -0
- agentmux-1.0.0/src/agentmux/adapters/gemini.py +126 -0
- agentmux-1.0.0/src/agentmux/adapters/opencode.py +180 -0
- agentmux-1.0.0/src/agentmux/cli/__init__.py +0 -0
- agentmux-1.0.0/src/agentmux/cli/main.py +1356 -0
- agentmux-1.0.0/src/agentmux/core/__init__.py +0 -0
- agentmux-1.0.0/src/agentmux/core/component.py +197 -0
- agentmux-1.0.0/src/agentmux/core/registry.py +232 -0
- agentmux-1.0.0/src/agentmux/core/rollback.py +129 -0
- agentmux-1.0.0/src/agentmux/core/setup.py +512 -0
- agentmux-1.0.0/src/agentmux/core/sync.py +382 -0
- agentmux-1.0.0/src/agentmux/core/templates.py +264 -0
- agentmux-1.0.0/src/agentmux/utils/__init__.py +1 -0
- agentmux-1.0.0/src/agentmux/utils/frontmatter.py +41 -0
- agentmux-1.0.0/src/agentmux/utils/git.py +191 -0
- agentmux-1.0.0/src/agentmux/utils/symlink.py +122 -0
- agentmux-1.0.0/tests/__init__.py +0 -0
- agentmux-1.0.0/tests/conftest.py +40 -0
- agentmux-1.0.0/tests/test_adapters/__init__.py +0 -0
- agentmux-1.0.0/tests/test_adapters/test_claude_code.py +485 -0
- agentmux-1.0.0/tests/test_adapters/test_cursor.py +220 -0
- agentmux-1.0.0/tests/test_adapters/test_gemini.py +240 -0
- agentmux-1.0.0/tests/test_adapters/test_opencode.py +376 -0
- agentmux-1.0.0/tests/test_adapters/test_plugin_discovery.py +257 -0
- agentmux-1.0.0/tests/test_cli.py +2847 -0
- agentmux-1.0.0/tests/test_component.py +271 -0
- agentmux-1.0.0/tests/test_frontmatter.py +124 -0
- agentmux-1.0.0/tests/test_git.py +419 -0
- agentmux-1.0.0/tests/test_registry.py +392 -0
- agentmux-1.0.0/tests/test_rollback.py +376 -0
- agentmux-1.0.0/tests/test_setup.py +973 -0
- agentmux-1.0.0/tests/test_symlink.py +213 -0
- agentmux-1.0.0/tests/test_sync.py +1086 -0
- agentmux-1.0.0/tests/test_templates.py +221 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Lint (ruff check)
|
|
28
|
+
run: ruff check src/
|
|
29
|
+
|
|
30
|
+
- name: Format check (ruff format)
|
|
31
|
+
run: ruff format --check src/
|
|
32
|
+
|
|
33
|
+
- name: Type check (mypy)
|
|
34
|
+
run: mypy src/
|
|
35
|
+
|
|
36
|
+
- name: Run tests with coverage
|
|
37
|
+
run: pytest --cov=agentmux --cov-report=xml --cov-report=term-missing
|
|
38
|
+
|
|
39
|
+
- name: Upload coverage report
|
|
40
|
+
uses: actions/upload-artifact@v4
|
|
41
|
+
if: matrix.python-version == '3.12'
|
|
42
|
+
with:
|
|
43
|
+
name: coverage-report
|
|
44
|
+
path: coverage.xml
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
validate:
|
|
9
|
+
name: Validate before publish
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: pip install -e ".[dev]"
|
|
21
|
+
|
|
22
|
+
- name: Lint
|
|
23
|
+
run: ruff check src/
|
|
24
|
+
|
|
25
|
+
- name: Format check
|
|
26
|
+
run: ruff format --check src/
|
|
27
|
+
|
|
28
|
+
- name: Type check
|
|
29
|
+
run: mypy src/
|
|
30
|
+
|
|
31
|
+
- name: Run tests
|
|
32
|
+
run: pytest --cov=agentmux --cov-report=term-missing
|
|
33
|
+
|
|
34
|
+
build:
|
|
35
|
+
name: Build distribution
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
needs: validate
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
uses: actions/setup-python@v5
|
|
43
|
+
with:
|
|
44
|
+
python-version: "3.12"
|
|
45
|
+
|
|
46
|
+
- name: Install build tools
|
|
47
|
+
run: pip install build twine
|
|
48
|
+
|
|
49
|
+
- name: Build wheel and sdist
|
|
50
|
+
run: python -m build
|
|
51
|
+
|
|
52
|
+
- name: Check distribution
|
|
53
|
+
run: twine check dist/*
|
|
54
|
+
|
|
55
|
+
- name: Upload distribution artifacts
|
|
56
|
+
uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
publish:
|
|
62
|
+
name: Publish to PyPI
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
needs: build
|
|
65
|
+
environment: pypi
|
|
66
|
+
permissions:
|
|
67
|
+
id-token: write
|
|
68
|
+
steps:
|
|
69
|
+
- name: Download distribution artifacts
|
|
70
|
+
uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: dist
|
|
73
|
+
path: dist/
|
|
74
|
+
|
|
75
|
+
- name: Publish to PyPI
|
|
76
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,207 @@
|
|
|
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
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
agentmux-1.0.0/AGENTS.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# agentmux Developer Guide
|
|
2
|
+
|
|
3
|
+
Canonical reference for AI coding agents and contributors working in this repository.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Project Overview
|
|
8
|
+
|
|
9
|
+
**agentmux** is a Python CLI tool that manages AI coding agent configurations (agents, commands,
|
|
10
|
+
skills, rules, instructions, MCP configs) across multiple tools (Cursor, Gemini CLI, etc.) from a
|
|
11
|
+
single canonical format (Markdown + YAML frontmatter). It is written in Python 3.10+, uses Pydantic
|
|
12
|
+
v2 for data models, Click for the CLI, and Rich for terminal output.
|
|
13
|
+
|
|
14
|
+
Package layout follows the `src/` convention:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
src/agentmux/
|
|
18
|
+
adapters/ — Tool-specific adapters (Cursor, Gemini, …)
|
|
19
|
+
cli/ — Click CLI commands
|
|
20
|
+
core/ — Data models (component.py), config parser (setup.py), sync engine (sync.py)
|
|
21
|
+
utils/ — Frontmatter parser, symlink/file helpers
|
|
22
|
+
tests/ — pytest test suite mirroring src layout
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Environment Setup
|
|
28
|
+
|
|
29
|
+
This project uses a `.venv` virtual environment. Activate it before running any commands:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
source .venv/bin/activate
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If it doesn't exist, create and populate it:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python -m venv .venv
|
|
39
|
+
source .venv/bin/activate
|
|
40
|
+
pip install -e ".[dev]"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
### Run all tests
|
|
48
|
+
```bash
|
|
49
|
+
pytest --cov=agentmux --cov-report=term-missing
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Run a single test file
|
|
53
|
+
```bash
|
|
54
|
+
pytest tests/test_sync.py
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Run a single test by name
|
|
58
|
+
```bash
|
|
59
|
+
pytest tests/test_sync.py::test_sync_cursor_creates_agent
|
|
60
|
+
pytest -k "test_deep_merge_nested"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Lint (check only)
|
|
64
|
+
```bash
|
|
65
|
+
ruff check src/
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Format (auto-fix)
|
|
69
|
+
```bash
|
|
70
|
+
ruff format src/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Lint + format together
|
|
74
|
+
```bash
|
|
75
|
+
ruff check src/ && ruff format src/
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Type checking
|
|
79
|
+
```bash
|
|
80
|
+
mypy src/
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Run full quality check (do this before committing)
|
|
84
|
+
```bash
|
|
85
|
+
ruff check src/ && ruff format --check src/ && mypy src/ && pytest --cov=agentmux
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Code Style
|
|
91
|
+
|
|
92
|
+
### Formatting
|
|
93
|
+
- Line length: **100 characters** (configured in `pyproject.toml`; E501 is ignored so ruff won't
|
|
94
|
+
error on it, but keep lines within 100 for readability).
|
|
95
|
+
- Indentation: 4 spaces, no tabs.
|
|
96
|
+
- Formatter: `ruff format` (Black-compatible).
|
|
97
|
+
|
|
98
|
+
### Imports
|
|
99
|
+
- **Absolute imports only** — never relative (`from agentmux.core.component import X`, not
|
|
100
|
+
`from .component import X`).
|
|
101
|
+
- **Named imports** — no wildcard imports (`from module import *` is forbidden).
|
|
102
|
+
- Declare `__all__` in every module that has a public API.
|
|
103
|
+
- Use `TYPE_CHECKING` guards for imports that are only needed for type annotations to avoid
|
|
104
|
+
circular imports at runtime.
|
|
105
|
+
- Lazy imports inside function bodies are acceptable in CLI commands to defer heavy loading.
|
|
106
|
+
- Annotate untyped third-party packages with `# type: ignore[import-untyped]` (specific error
|
|
107
|
+
code, not a blanket `# type: ignore`).
|
|
108
|
+
|
|
109
|
+
### Naming Conventions
|
|
110
|
+
|
|
111
|
+
| Entity | Convention | Examples |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| Classes | `PascalCase` | `CursorAdapter`, `SyncAction`, `MCPConfig` |
|
|
114
|
+
| Functions / methods | `snake_case` | `from_file()`, `sync_setup()`, `create_symlink()` |
|
|
115
|
+
| Variables | `snake_case` | `raw_meta`, `mcp_path`, `sync_action` |
|
|
116
|
+
| Module-private constants | `_SCREAMING_SNAKE` | `_FRONTMATTER_RE`, `_MAX_BACKUPS` |
|
|
117
|
+
| Public Enum values | `SCREAMING_SNAKE` | `ComponentType.AGENT`, `InstallStrategy.SYMLINK` |
|
|
118
|
+
| Private helpers | Leading `_` | `_deep_merge()`, `_deploy()`, `_cleanup_backups()` |
|
|
119
|
+
| Type aliases | `PascalCase` | `Component = Agent \| Command \| ...` |
|
|
120
|
+
|
|
121
|
+
Variable names must be **descriptive** — `raw_response_payload` not `data`; `user_index` not `x`.
|
|
122
|
+
|
|
123
|
+
### Typing
|
|
124
|
+
- Python 3.10+ union syntax: `Path | None`, `str | int`, not `Optional[str]` or `Union[str, int]`.
|
|
125
|
+
- All public functions must have explicit **parameter and return type annotations**.
|
|
126
|
+
- Use concrete generics throughout: `dict[str, Any]`, `list[str]`, `tuple[ToolAdapter, ...]`.
|
|
127
|
+
- Mypy runs in **strict mode** — `disallow_untyped_defs` and all other strict flags are active.
|
|
128
|
+
New code must pass `mypy src/` cleanly with zero new errors.
|
|
129
|
+
- Use `@dataclass` for internal data-transfer objects (no validation needed).
|
|
130
|
+
- Use **Pydantic v2** models for all user-facing data with validation requirements.
|
|
131
|
+
- Use `Literal["value"]` for constrained string fields instead of plain `str`.
|
|
132
|
+
- Enums should inherit from `(str, Enum)` to make values directly JSON-serializable.
|
|
133
|
+
- `Any` is acceptable in `dict[str, Any]` for unstructured YAML/JSON data, but document why.
|
|
134
|
+
|
|
135
|
+
### Error Handling
|
|
136
|
+
- **Fail loudly with context.** Wrap exceptions with human-readable messages before re-raising:
|
|
137
|
+
```python
|
|
138
|
+
raise ValueError(f"Failed to load agent '{path}': {exc}") from exc
|
|
139
|
+
```
|
|
140
|
+
- **Always use `from exc` chaining** to preserve the original cause.
|
|
141
|
+
- **Guard clauses over deep nesting.** Validate inputs at the top of a function and return/raise
|
|
142
|
+
early rather than wrapping the happy path in `if/else` blocks.
|
|
143
|
+
- Use `click.UsageError` for user-facing config errors in CLI commands (produces clean output).
|
|
144
|
+
- Use `sys.exit(1)` in CLI on unrecoverable errors — do not let raw exceptions propagate to the
|
|
145
|
+
user.
|
|
146
|
+
- Broad `except Exception` is acceptable only when the intent is to record a structured error
|
|
147
|
+
result (e.g., `SyncAction("error", ...)`) rather than silently swallow failures.
|
|
148
|
+
- Pydantic validation errors caught during `load_components()` must be re-raised as `ValueError`
|
|
149
|
+
with context.
|
|
150
|
+
|
|
151
|
+
### Code Organisation
|
|
152
|
+
- **Single Responsibility per module** — if a module does two things, split it.
|
|
153
|
+
- Prefer **dispatch tables** (`dict[ComponentType, Callable]`) over long `if/elif` chains.
|
|
154
|
+
- Keep adapter implementations fully self-contained — no shared mutable state between adapters.
|
|
155
|
+
- `AdapterRegistry` uses class-level state; provide a `reset()` method for test teardown.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Testing
|
|
160
|
+
|
|
161
|
+
### Framework and tools
|
|
162
|
+
- **pytest** with built-in `tmp_path` fixture for filesystem isolation.
|
|
163
|
+
- `click.testing.CliRunner` for CLI command tests.
|
|
164
|
+
- `monkeypatch` for patching (no external mocking libraries — `unittest.mock` is acceptable but
|
|
165
|
+
prefer `monkeypatch.setattr`).
|
|
166
|
+
- `conftest.py` autouse fixture `reset_adapter_registry` clears the registry after every test.
|
|
167
|
+
|
|
168
|
+
### Test organisation
|
|
169
|
+
- Mirror the source layout: `tests/test_adapters/test_cursor.py` ↔
|
|
170
|
+
`src/agentmux/adapters/cursor.py`.
|
|
171
|
+
- TOML fixture strings are **module-level constants** (e.g. `TOML_CURSOR_ONLY`), not inline.
|
|
172
|
+
|
|
173
|
+
### Naming
|
|
174
|
+
```
|
|
175
|
+
test_<unit>_<what_it_verifies>
|
|
176
|
+
# e.g.
|
|
177
|
+
test_agent_from_file_with_frontmatter
|
|
178
|
+
test_deep_merge_nested
|
|
179
|
+
test_sync_cursor_creates_agent
|
|
180
|
+
```
|
|
181
|
+
Add a docstring on tests where the intent is not obvious from the name.
|
|
182
|
+
|
|
183
|
+
### Assertions
|
|
184
|
+
- Direct equality: `assert agent.name == "My Agent"`
|
|
185
|
+
- Content checks: `assert "name: Helper" in content`
|
|
186
|
+
- Error paths: `pytest.raises(ValueError, match="pattern")` — always supply `match`.
|
|
187
|
+
- Boolean checks: `assert x` / `assert not x` — never `assertEqual`.
|
|
188
|
+
|
|
189
|
+
### Before adding a test
|
|
190
|
+
Check that coverage for the intended behaviour does not already exist. Search with:
|
|
191
|
+
```bash
|
|
192
|
+
rg "test_<keyword>" tests/
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### After any code change
|
|
196
|
+
Always run the full test suite to confirm nothing regressed:
|
|
197
|
+
```bash
|
|
198
|
+
pytest
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Architecture Decisions
|
|
204
|
+
|
|
205
|
+
- **Adapter pattern** is the extension point. Each tool adapter implements the `ToolAdapter` ABC.
|
|
206
|
+
New tool support = new file in `src/agentmux/adapters/`, registered via `AdapterRegistry`.
|
|
207
|
+
- **Canonical format** is Markdown + YAML frontmatter. Adapters are responsible for all
|
|
208
|
+
format translation; the core never writes tool-specific syntax.
|
|
209
|
+
- **`agentmux.toml`** is the user-facing config. `Setup.from_toml()` is the single parse entry
|
|
210
|
+
point; never read TOML elsewhere.
|
|
211
|
+
- The sync engine returns structured `SyncAction` objects — it does not print or `sys.exit`.
|
|
212
|
+
Only the CLI layer surfaces results to the user.
|
agentmux-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Omer Sadeh
|
|
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.
|