codexmgr 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.
- codexmgr-0.1.0/.github/actions/install_package/action.yml +29 -0
- codexmgr-0.1.0/.github/workflows/py_test.yml +36 -0
- codexmgr-0.1.0/.github/workflows/version_publish_main.yml +94 -0
- codexmgr-0.1.0/.gitignore +11 -0
- codexmgr-0.1.0/PKG-INFO +222 -0
- codexmgr-0.1.0/README.md +203 -0
- codexmgr-0.1.0/pyproject.toml +42 -0
- codexmgr-0.1.0/pytest.toml +3 -0
- codexmgr-0.1.0/src/codexmgr/__init__.py +5 -0
- codexmgr-0.1.0/src/codexmgr/agents_file.py +80 -0
- codexmgr-0.1.0/src/codexmgr/agentsmd.py +96 -0
- codexmgr-0.1.0/src/codexmgr/cli.py +240 -0
- codexmgr-0.1.0/src/codexmgr/codex.py +197 -0
- codexmgr-0.1.0/src/codexmgr/errors.py +5 -0
- codexmgr-0.1.0/src/codexmgr/paths.py +137 -0
- codexmgr-0.1.0/src/codexmgr/project.py +74 -0
- codexmgr-0.1.0/src/codexmgr/project_config.py +70 -0
- codexmgr-0.1.0/src/codexmgr/py.typed +1 -0
- codexmgr-0.1.0/src/codexmgr/renderer.py +131 -0
- codexmgr-0.1.0/src/codexmgr/skills.py +286 -0
- codexmgr-0.1.0/src/codexmgr/toml_io.py +213 -0
- codexmgr-0.1.0/tests/conftest.py +148 -0
- codexmgr-0.1.0/tests/test_agents_file.py +52 -0
- codexmgr-0.1.0/tests/test_cli.py +297 -0
- codexmgr-0.1.0/tests/test_codex_cli.py +154 -0
- codexmgr-0.1.0/tests/test_empty_skill_config_cli.py +40 -0
- codexmgr-0.1.0/tests/test_home_resolution_cli.py +99 -0
- codexmgr-0.1.0/tests/test_package_metadata.py +21 -0
- codexmgr-0.1.0/tests/test_paths.py +35 -0
- codexmgr-0.1.0/tests/test_renderer.py +30 -0
- codexmgr-0.1.0/tests/test_skills_cli.py +269 -0
- codexmgr-0.1.0/tests/test_sync_cli.py +110 -0
- codexmgr-0.1.0/tests/test_toml_io.py +17 -0
- codexmgr-0.1.0/uv.lock +86 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: install_package
|
|
2
|
+
description: Install a package from local pyproject.toml
|
|
3
|
+
inputs:
|
|
4
|
+
python_version:
|
|
5
|
+
description: "Python version to install"
|
|
6
|
+
default: "3.12"
|
|
7
|
+
|
|
8
|
+
runs:
|
|
9
|
+
using: "composite"
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- name: Set up Python
|
|
13
|
+
uses: actions/setup-python@v5
|
|
14
|
+
id: setup_python
|
|
15
|
+
with:
|
|
16
|
+
python-version: ${{ inputs.python_version }}
|
|
17
|
+
|
|
18
|
+
- name: Install UV
|
|
19
|
+
shell: bash
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install --upgrade pip
|
|
22
|
+
pip install uv
|
|
23
|
+
echo "python-version=${{ steps.setup_python.outputs.python-version }}" >> "$GITHUB_OUTPUT"
|
|
24
|
+
|
|
25
|
+
- name: Install Dependencies
|
|
26
|
+
shell: bash
|
|
27
|
+
run: |
|
|
28
|
+
uv sync --group dev
|
|
29
|
+
echo "python-version=${{ steps.setup_python.outputs.python-version }}" >> "$GITHUB_OUTPUT"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# this is an autogenerated file, do not edit it directly or your changes might be lost.
|
|
2
|
+
name: Python Tests
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
- master
|
|
9
|
+
- dev
|
|
10
|
+
- test
|
|
11
|
+
pull_request:
|
|
12
|
+
branches:
|
|
13
|
+
- main
|
|
14
|
+
- master
|
|
15
|
+
- dev
|
|
16
|
+
- test
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
test:
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
24
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout Repository
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Install Package
|
|
31
|
+
uses: ./.github/actions/install_package
|
|
32
|
+
with:
|
|
33
|
+
python_version: ${{ matrix.python-version }}
|
|
34
|
+
|
|
35
|
+
- name: Run Tests
|
|
36
|
+
run: uv run pytest
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# this is an autogenerated file, do not edit it directly or your changes might be lost.
|
|
2
|
+
name: version_publish
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
- master
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
version_publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
pull-requests: read
|
|
16
|
+
id-token: write
|
|
17
|
+
environment:
|
|
18
|
+
name: main
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout Repository
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
|
|
25
|
+
- name: Install Package
|
|
26
|
+
uses: ./.github/actions/install_package
|
|
27
|
+
with:
|
|
28
|
+
python_version: 3.12
|
|
29
|
+
|
|
30
|
+
- name: Run Tests
|
|
31
|
+
run: uv run pytest
|
|
32
|
+
|
|
33
|
+
- name: Get current package version
|
|
34
|
+
shell: bash
|
|
35
|
+
id: get_version
|
|
36
|
+
run: |
|
|
37
|
+
CURRENT_VERSION=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')
|
|
38
|
+
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
|
|
39
|
+
echo "CURRENT_VERSION=${CURRENT_VERSION}"
|
|
40
|
+
|
|
41
|
+
- name: Get latest version from PyPI
|
|
42
|
+
shell: bash
|
|
43
|
+
id: get_pypi_version
|
|
44
|
+
run: |
|
|
45
|
+
PACKAGE_NAME=$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["name"])')
|
|
46
|
+
PYPI_JSON=$(curl -fsS "https://pypi.org/pypi/${PACKAGE_NAME}/json" || true)
|
|
47
|
+
if [ -z "$PYPI_JSON" ]; then
|
|
48
|
+
LATEST_VERSION=""
|
|
49
|
+
else
|
|
50
|
+
LATEST_VERSION=$(jq -r '.info.version // ""' <<< "$PYPI_JSON")
|
|
51
|
+
fi
|
|
52
|
+
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV
|
|
53
|
+
echo "LATEST_VERSION=${LATEST_VERSION}"
|
|
54
|
+
|
|
55
|
+
- name: Compare versions
|
|
56
|
+
shell: bash
|
|
57
|
+
id: compare_versions
|
|
58
|
+
run: |
|
|
59
|
+
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
|
|
60
|
+
echo "should_update=true" >> $GITHUB_OUTPUT
|
|
61
|
+
else
|
|
62
|
+
echo "should_update=false" >> $GITHUB_OUTPUT
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
- name: Package project
|
|
66
|
+
if: steps.compare_versions.outputs.should_update == 'true'
|
|
67
|
+
run: uv build
|
|
68
|
+
|
|
69
|
+
- name: Publish package distributions to PyPI
|
|
70
|
+
if: steps.compare_versions.outputs.should_update == 'true'
|
|
71
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
72
|
+
with:
|
|
73
|
+
verbose: true
|
|
74
|
+
|
|
75
|
+
- name: Check if tag exists
|
|
76
|
+
shell: bash
|
|
77
|
+
id: check_tag
|
|
78
|
+
if: steps.compare_versions.outputs.should_update == 'true'
|
|
79
|
+
run: |
|
|
80
|
+
TAG_EXISTS=$(git tag -l "v$CURRENT_VERSION")
|
|
81
|
+
if [ "$TAG_EXISTS" ]; then
|
|
82
|
+
echo "tag_exists=true" >> $GITHUB_OUTPUT
|
|
83
|
+
else
|
|
84
|
+
echo "tag_exists=false" >> $GITHUB_OUTPUT
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
- name: Create new tag
|
|
88
|
+
shell: bash
|
|
89
|
+
if: steps.compare_versions.outputs.should_update == 'true' && steps.check_tag.outputs.tag_exists == 'false'
|
|
90
|
+
run: |
|
|
91
|
+
git config --local user.name "${GITHUB_ACTOR}"
|
|
92
|
+
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
93
|
+
git tag -a v$CURRENT_VERSION -m "Release version $CURRENT_VERSION"
|
|
94
|
+
git push origin v$CURRENT_VERSION
|
codexmgr-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codexmgr
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Manage project-local Codex configuration from reusable templates
|
|
5
|
+
Keywords: agents,cli,codex,configuration,skills
|
|
6
|
+
Classifier: Development Status :: 4 - Beta
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Topic :: Software Development
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest>=9.0.3; extra == 'dev'
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# codexmgr
|
|
21
|
+
|
|
22
|
+
`codexmgr` manages project-local Codex configuration from reusable templates.
|
|
23
|
+
It keeps hand-written project instructions in `AGENTS.md` and generated Codex
|
|
24
|
+
configuration in `.codex/` synchronized from a small declarative
|
|
25
|
+
`.codex/codexmgr.toml` file.
|
|
26
|
+
|
|
27
|
+
The tool is intentionally narrow:
|
|
28
|
+
|
|
29
|
+
- compose reusable AGENTS.md instruction fragments
|
|
30
|
+
- enable or disable Codex skills per project
|
|
31
|
+
- write reproducible lock data for the resolved project configuration
|
|
32
|
+
- run `codex` with project `.codex/config.toml` values translated into `-c`
|
|
33
|
+
overrides
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- Python 3.11 or newer
|
|
38
|
+
- `uv` for local development
|
|
39
|
+
- `codex` on `PATH` only when using `codexmgr codex ...`
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
From a checkout:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv sync --group dev
|
|
47
|
+
uv run codexmgr --help
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For local command-line use from this repository:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv tool install .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
Create the project `.codex/` directory:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
codexmgr setup
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Create or install a named AGENTS.md template under
|
|
65
|
+
`$CODEXMGR_HOME/agentsmd/<name>.toml`. If `CODEXMGR_HOME` is unset,
|
|
66
|
+
`~/.codexmgr` is used.
|
|
67
|
+
|
|
68
|
+
```toml
|
|
69
|
+
[coding]
|
|
70
|
+
text = """
|
|
71
|
+
- Keep source files focused and small.
|
|
72
|
+
- Add tests for behavior changes before implementation.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
[coding.debugging]
|
|
76
|
+
text = "Prefer lasting regression tests over temporary scripts."
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Add the template to the current project:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
codexmgr agentsmd add coding
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This updates `.codex/codexmgr.toml`, runs `apply`, writes
|
|
86
|
+
`.codex/codexmgr.lock`, and refreshes the managed block in `AGENTS.md`.
|
|
87
|
+
|
|
88
|
+
## Managed Files
|
|
89
|
+
|
|
90
|
+
`codexmgr` reads and writes these project files:
|
|
91
|
+
|
|
92
|
+
- `.codex/codexmgr.toml`: source configuration edited by CLI commands or by
|
|
93
|
+
hand
|
|
94
|
+
- `.codex/codexmgr.lock`: resolved template and skill state written by `apply`
|
|
95
|
+
- `.codex/config.toml`: Codex config updated with `[[skills.config]]` entries
|
|
96
|
+
- `AGENTS.md`: project instructions, with only the managed block replaced
|
|
97
|
+
|
|
98
|
+
The managed AGENTS.md block is:
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
<!-- BEGIN CODEXMGR GENERATED -->
|
|
102
|
+
<!-- END CODEXMGR GENERATED -->
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Manual content outside this block is preserved. If the block is missing,
|
|
106
|
+
`codexmgr` appends it. If `AGENTS.md` is missing, `codexmgr` creates it.
|
|
107
|
+
|
|
108
|
+
## Project Configuration
|
|
109
|
+
|
|
110
|
+
`.codex/codexmgr.toml` supports AGENTS.md templates and skill state:
|
|
111
|
+
|
|
112
|
+
```toml
|
|
113
|
+
[agents_md]
|
|
114
|
+
src = ["coding", "/absolute/or/project-relative/template.toml"]
|
|
115
|
+
|
|
116
|
+
[skills]
|
|
117
|
+
enabled = ["review-helper"]
|
|
118
|
+
disabled = ["experimental-skill", "skills/local-disabled"]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Named AGENTS.md templates resolve from `$CODEXMGR_HOME/agentsmd/<name>.toml`.
|
|
122
|
+
Path-like template values resolve relative to the project unless they are
|
|
123
|
+
absolute paths.
|
|
124
|
+
|
|
125
|
+
Named skills resolve from `$CODEX_HOME/skills/<name>/SKILL.md`. If `CODEX_HOME`
|
|
126
|
+
is unset, `~/.codex` is used. Path-like skill values resolve to either a
|
|
127
|
+
`SKILL.md` file or a directory containing `SKILL.md`. Missing skills are written
|
|
128
|
+
as name-based entries so Codex can resolve them later.
|
|
129
|
+
|
|
130
|
+
Mutating commands run `apply` automatically unless `--no-sync` is passed.
|
|
131
|
+
Project guidelines require `apply` whenever `.codex/codexmgr.toml` changes,
|
|
132
|
+
unless `--no-sync` was explicitly requested.
|
|
133
|
+
|
|
134
|
+
## Template Format
|
|
135
|
+
|
|
136
|
+
Template files are TOML documents. Each top-level key must be a table and
|
|
137
|
+
becomes an AGENTS.md heading. A `text` value inside a table becomes the body
|
|
138
|
+
under that heading. Nested tables become nested headings.
|
|
139
|
+
|
|
140
|
+
```toml
|
|
141
|
+
[coding]
|
|
142
|
+
text = "Top-level guidance."
|
|
143
|
+
|
|
144
|
+
[coding.tests]
|
|
145
|
+
text = "Test behavior, not implementation details."
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
renders as:
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
# coding
|
|
152
|
+
Top-level guidance.
|
|
153
|
+
|
|
154
|
+
## tests
|
|
155
|
+
Test behavior, not implementation details.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Unsupported scalar entries fail loudly instead of being silently ignored. This
|
|
159
|
+
keeps template mistakes visible during `apply`.
|
|
160
|
+
|
|
161
|
+
## Commands
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
codexmgr setup
|
|
165
|
+
codexmgr apply
|
|
166
|
+
codexmgr agentsmd add [--no-sync] <name-or-template-path>
|
|
167
|
+
codexmgr agentsmd remove [--no-sync] <name-or-template-path>
|
|
168
|
+
codexmgr skill enable [--no-sync] <name-or-skill-path>
|
|
169
|
+
codexmgr skill disable [--no-sync] <name-or-skill-path>
|
|
170
|
+
codexmgr codex <args...>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`setup` creates `.codex/` in the current project.
|
|
174
|
+
|
|
175
|
+
`apply` reads `.codex/codexmgr.toml`, resolves configured sources, writes
|
|
176
|
+
`.codex/codexmgr.lock`, updates `.codex/config.toml` skill entries when a
|
|
177
|
+
`[skills]` table is configured, and refreshes the generated `AGENTS.md` block
|
|
178
|
+
when `[agents_md]` is configured.
|
|
179
|
+
|
|
180
|
+
`agentsmd add` validates that the template exists before writing config.
|
|
181
|
+
Repeated adds keep one source entry.
|
|
182
|
+
|
|
183
|
+
`agentsmd remove` removes a configured template source and fails if the source
|
|
184
|
+
is not present.
|
|
185
|
+
|
|
186
|
+
`skill enable` and `skill disable` keep enabled and disabled lists mutually
|
|
187
|
+
exclusive. Repeated commands keep one entry.
|
|
188
|
+
|
|
189
|
+
`codex` forwards arguments to the real `codex` command. Values from
|
|
190
|
+
`.codex/config.toml` are flattened into `-c key=value` overrides. User-provided
|
|
191
|
+
`-c` or `--config` overrides are merged after project config: scalar values
|
|
192
|
+
replace earlier values, while list values append.
|
|
193
|
+
|
|
194
|
+
## Development
|
|
195
|
+
|
|
196
|
+
Install dependencies:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
uv sync --group dev
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Run tests:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
uv run pytest
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Build distributions:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
uv build
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
The package is typed (`py.typed`) and the test suite covers CLI behavior,
|
|
215
|
+
template rendering, TOML writing, skill resolution, Codex command generation,
|
|
216
|
+
home-directory resolution, and package metadata.
|
|
217
|
+
|
|
218
|
+
## Release Notes
|
|
219
|
+
|
|
220
|
+
The GitHub workflow runs the test matrix on Python 3.11, 3.12, and 3.13 across
|
|
221
|
+
Linux, Windows, and macOS. The publish workflow builds and publishes to PyPI
|
|
222
|
+
when the version in `pyproject.toml` differs from the latest published version.
|
codexmgr-0.1.0/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# codexmgr
|
|
2
|
+
|
|
3
|
+
`codexmgr` manages project-local Codex configuration from reusable templates.
|
|
4
|
+
It keeps hand-written project instructions in `AGENTS.md` and generated Codex
|
|
5
|
+
configuration in `.codex/` synchronized from a small declarative
|
|
6
|
+
`.codex/codexmgr.toml` file.
|
|
7
|
+
|
|
8
|
+
The tool is intentionally narrow:
|
|
9
|
+
|
|
10
|
+
- compose reusable AGENTS.md instruction fragments
|
|
11
|
+
- enable or disable Codex skills per project
|
|
12
|
+
- write reproducible lock data for the resolved project configuration
|
|
13
|
+
- run `codex` with project `.codex/config.toml` values translated into `-c`
|
|
14
|
+
overrides
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Python 3.11 or newer
|
|
19
|
+
- `uv` for local development
|
|
20
|
+
- `codex` on `PATH` only when using `codexmgr codex ...`
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
From a checkout:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv sync --group dev
|
|
28
|
+
uv run codexmgr --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For local command-line use from this repository:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv tool install .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
Create the project `.codex/` directory:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
codexmgr setup
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Create or install a named AGENTS.md template under
|
|
46
|
+
`$CODEXMGR_HOME/agentsmd/<name>.toml`. If `CODEXMGR_HOME` is unset,
|
|
47
|
+
`~/.codexmgr` is used.
|
|
48
|
+
|
|
49
|
+
```toml
|
|
50
|
+
[coding]
|
|
51
|
+
text = """
|
|
52
|
+
- Keep source files focused and small.
|
|
53
|
+
- Add tests for behavior changes before implementation.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
[coding.debugging]
|
|
57
|
+
text = "Prefer lasting regression tests over temporary scripts."
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Add the template to the current project:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
codexmgr agentsmd add coding
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This updates `.codex/codexmgr.toml`, runs `apply`, writes
|
|
67
|
+
`.codex/codexmgr.lock`, and refreshes the managed block in `AGENTS.md`.
|
|
68
|
+
|
|
69
|
+
## Managed Files
|
|
70
|
+
|
|
71
|
+
`codexmgr` reads and writes these project files:
|
|
72
|
+
|
|
73
|
+
- `.codex/codexmgr.toml`: source configuration edited by CLI commands or by
|
|
74
|
+
hand
|
|
75
|
+
- `.codex/codexmgr.lock`: resolved template and skill state written by `apply`
|
|
76
|
+
- `.codex/config.toml`: Codex config updated with `[[skills.config]]` entries
|
|
77
|
+
- `AGENTS.md`: project instructions, with only the managed block replaced
|
|
78
|
+
|
|
79
|
+
The managed AGENTS.md block is:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
<!-- BEGIN CODEXMGR GENERATED -->
|
|
83
|
+
<!-- END CODEXMGR GENERATED -->
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Manual content outside this block is preserved. If the block is missing,
|
|
87
|
+
`codexmgr` appends it. If `AGENTS.md` is missing, `codexmgr` creates it.
|
|
88
|
+
|
|
89
|
+
## Project Configuration
|
|
90
|
+
|
|
91
|
+
`.codex/codexmgr.toml` supports AGENTS.md templates and skill state:
|
|
92
|
+
|
|
93
|
+
```toml
|
|
94
|
+
[agents_md]
|
|
95
|
+
src = ["coding", "/absolute/or/project-relative/template.toml"]
|
|
96
|
+
|
|
97
|
+
[skills]
|
|
98
|
+
enabled = ["review-helper"]
|
|
99
|
+
disabled = ["experimental-skill", "skills/local-disabled"]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Named AGENTS.md templates resolve from `$CODEXMGR_HOME/agentsmd/<name>.toml`.
|
|
103
|
+
Path-like template values resolve relative to the project unless they are
|
|
104
|
+
absolute paths.
|
|
105
|
+
|
|
106
|
+
Named skills resolve from `$CODEX_HOME/skills/<name>/SKILL.md`. If `CODEX_HOME`
|
|
107
|
+
is unset, `~/.codex` is used. Path-like skill values resolve to either a
|
|
108
|
+
`SKILL.md` file or a directory containing `SKILL.md`. Missing skills are written
|
|
109
|
+
as name-based entries so Codex can resolve them later.
|
|
110
|
+
|
|
111
|
+
Mutating commands run `apply` automatically unless `--no-sync` is passed.
|
|
112
|
+
Project guidelines require `apply` whenever `.codex/codexmgr.toml` changes,
|
|
113
|
+
unless `--no-sync` was explicitly requested.
|
|
114
|
+
|
|
115
|
+
## Template Format
|
|
116
|
+
|
|
117
|
+
Template files are TOML documents. Each top-level key must be a table and
|
|
118
|
+
becomes an AGENTS.md heading. A `text` value inside a table becomes the body
|
|
119
|
+
under that heading. Nested tables become nested headings.
|
|
120
|
+
|
|
121
|
+
```toml
|
|
122
|
+
[coding]
|
|
123
|
+
text = "Top-level guidance."
|
|
124
|
+
|
|
125
|
+
[coding.tests]
|
|
126
|
+
text = "Test behavior, not implementation details."
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
renders as:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
# coding
|
|
133
|
+
Top-level guidance.
|
|
134
|
+
|
|
135
|
+
## tests
|
|
136
|
+
Test behavior, not implementation details.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Unsupported scalar entries fail loudly instead of being silently ignored. This
|
|
140
|
+
keeps template mistakes visible during `apply`.
|
|
141
|
+
|
|
142
|
+
## Commands
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
codexmgr setup
|
|
146
|
+
codexmgr apply
|
|
147
|
+
codexmgr agentsmd add [--no-sync] <name-or-template-path>
|
|
148
|
+
codexmgr agentsmd remove [--no-sync] <name-or-template-path>
|
|
149
|
+
codexmgr skill enable [--no-sync] <name-or-skill-path>
|
|
150
|
+
codexmgr skill disable [--no-sync] <name-or-skill-path>
|
|
151
|
+
codexmgr codex <args...>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`setup` creates `.codex/` in the current project.
|
|
155
|
+
|
|
156
|
+
`apply` reads `.codex/codexmgr.toml`, resolves configured sources, writes
|
|
157
|
+
`.codex/codexmgr.lock`, updates `.codex/config.toml` skill entries when a
|
|
158
|
+
`[skills]` table is configured, and refreshes the generated `AGENTS.md` block
|
|
159
|
+
when `[agents_md]` is configured.
|
|
160
|
+
|
|
161
|
+
`agentsmd add` validates that the template exists before writing config.
|
|
162
|
+
Repeated adds keep one source entry.
|
|
163
|
+
|
|
164
|
+
`agentsmd remove` removes a configured template source and fails if the source
|
|
165
|
+
is not present.
|
|
166
|
+
|
|
167
|
+
`skill enable` and `skill disable` keep enabled and disabled lists mutually
|
|
168
|
+
exclusive. Repeated commands keep one entry.
|
|
169
|
+
|
|
170
|
+
`codex` forwards arguments to the real `codex` command. Values from
|
|
171
|
+
`.codex/config.toml` are flattened into `-c key=value` overrides. User-provided
|
|
172
|
+
`-c` or `--config` overrides are merged after project config: scalar values
|
|
173
|
+
replace earlier values, while list values append.
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
Install dependencies:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
uv sync --group dev
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Run tests:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
uv run pytest
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Build distributions:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
uv build
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The package is typed (`py.typed`) and the test suite covers CLI behavior,
|
|
196
|
+
template rendering, TOML writing, skill resolution, Codex command generation,
|
|
197
|
+
home-directory resolution, and package metadata.
|
|
198
|
+
|
|
199
|
+
## Release Notes
|
|
200
|
+
|
|
201
|
+
The GitHub workflow runs the test matrix on Python 3.11, 3.12, and 3.13 across
|
|
202
|
+
Linux, Windows, and macOS. The publish workflow builds and publishes to PyPI
|
|
203
|
+
when the version in `pyproject.toml` differs from the latest published version.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "codexmgr"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Manage project-local Codex configuration from reusable templates"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = []
|
|
8
|
+
keywords = ["codex", "cli", "configuration", "agents", "skills"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Software Development",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
codexmgr = "codexmgr.cli:entrypoint"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"pytest>=9.0.3",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["hatchling"]
|
|
31
|
+
build-backend = "hatchling.build"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/codexmgr"]
|
|
35
|
+
|
|
36
|
+
[dependency-groups]
|
|
37
|
+
dev = [
|
|
38
|
+
"codexmgr[dev]",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[tool.uv.sources]
|
|
42
|
+
codexmgr = { workspace = true }
|