codexmgr 0.2.1__tar.gz → 0.4.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.
Files changed (141) hide show
  1. {codexmgr-0.2.1 → codexmgr-0.4.0}/PKG-INFO +95 -44
  2. {codexmgr-0.2.1 → codexmgr-0.4.0}/README.md +93 -43
  3. {codexmgr-0.2.1 → codexmgr-0.4.0}/pyproject.toml +4 -1
  4. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/__init__.py +1 -1
  5. codexmgr-0.4.0/src/codexmgr/agents/file.py +43 -0
  6. codexmgr-0.4.0/src/codexmgr/commands/codex.py +114 -0
  7. codexmgr-0.4.0/src/codexmgr/commands/codex_launch.py +98 -0
  8. codexmgr-0.4.0/src/codexmgr/core/managed_text.py +78 -0
  9. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/core/paths.py +12 -0
  10. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/interface/cli.py +10 -2
  11. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/interface/parsers/mcp.py +8 -8
  12. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/mcp/__init__.py +38 -0
  13. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/mcp/apply.py +16 -9
  14. codexmgr-0.4.0/src/codexmgr/mcp/cli.py +242 -0
  15. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/mcp/fields.py +9 -20
  16. codexmgr-0.4.0/src/codexmgr/mcp/project.py +181 -0
  17. codexmgr-0.4.0/src/codexmgr/mcp/resolution.py +112 -0
  18. codexmgr-0.4.0/src/codexmgr/mcp/sources.py +186 -0
  19. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/apply.py +31 -137
  20. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/generated.py +12 -7
  21. codexmgr-0.4.0/src/codexmgr/project/gitignore.py +43 -0
  22. codexmgr-0.4.0/src/codexmgr/project/resolution.py +180 -0
  23. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/rules/listing.py +21 -13
  24. codexmgr-0.4.0/src/codexmgr/rules/tree.py +206 -0
  25. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/app.py +79 -90
  26. codexmgr-0.4.0/src/codexmgr/tui/focus.py +182 -0
  27. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/items.py +1 -57
  28. codexmgr-0.4.0/src/codexmgr/tui/mcp_items.py +50 -0
  29. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/mutations.py +14 -0
  30. codexmgr-0.4.0/src/codexmgr/tui/panels.py +113 -0
  31. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/rendering.py +5 -0
  32. codexmgr-0.4.0/src/codexmgr/tui/rule_items.py +56 -0
  33. codexmgr-0.4.0/src/codexmgr/tui/rule_tree.py +141 -0
  34. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/sections.py +1 -1
  35. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/state.py +17 -14
  36. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_codex_cli.py +142 -73
  37. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_mcp_apply_cli.py +81 -6
  38. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_mcp_cli.py +190 -96
  39. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_package_metadata.py +8 -0
  40. codexmgr-0.4.0/tests/test_project_gitignore.py +155 -0
  41. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_rules_cli.py +59 -3
  42. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_tui_app.py +125 -0
  43. codexmgr-0.4.0/tests/test_tui_selection_focus.py +142 -0
  44. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_tui_state.py +44 -13
  45. {codexmgr-0.2.1 → codexmgr-0.4.0}/uv.lock +1 -1
  46. codexmgr-0.2.1/src/codexmgr/agents/file.py +0 -95
  47. codexmgr-0.2.1/src/codexmgr/commands/codex.py +0 -224
  48. codexmgr-0.2.1/src/codexmgr/mcp/cli.py +0 -197
  49. codexmgr-0.2.1/src/codexmgr/tui/rule_items.py +0 -58
  50. {codexmgr-0.2.1 → codexmgr-0.4.0}/.github/actions/install_package/action.yml +0 -0
  51. {codexmgr-0.2.1 → codexmgr-0.4.0}/.github/workflows/py_test.yml +0 -0
  52. {codexmgr-0.2.1 → codexmgr-0.4.0}/.github/workflows/version_publish_main.yml +0 -0
  53. {codexmgr-0.2.1 → codexmgr-0.4.0}/.gitignore +0 -0
  54. {codexmgr-0.2.1 → codexmgr-0.4.0}/pytest.toml +0 -0
  55. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/agents/__init__.py +0 -0
  56. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/agents/manager.py +0 -0
  57. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/agents/renderer.py +0 -0
  58. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/commands/__init__.py +0 -0
  59. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/commands/codex_jit.py +0 -0
  60. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/commands/config_mutations.py +0 -0
  61. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/commands/health.py +0 -0
  62. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/commands/navigation.py +0 -0
  63. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/commands/rules.py +0 -0
  64. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/core/__init__.py +0 -0
  65. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/core/errors.py +0 -0
  66. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/core/options.py +0 -0
  67. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/core/toml_io.py +0 -0
  68. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/__init__.py +0 -0
  69. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/cli.py +0 -0
  70. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/config.py +0 -0
  71. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/copies.py +0 -0
  72. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/listing.py +0 -0
  73. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/resolution.py +0 -0
  74. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/custom_agents/sources.py +0 -0
  75. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/__init__.py +0 -0
  76. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/config.py +0 -0
  77. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/copies.py +0 -0
  78. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/listing.py +0 -0
  79. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/merge.py +0 -0
  80. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/resolution.py +0 -0
  81. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/hooks/sources.py +0 -0
  82. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/interface/__init__.py +0 -0
  83. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/interface/parser.py +0 -0
  84. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/interface/parsers/__init__.py +0 -0
  85. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/interface/parsers/agents.py +0 -0
  86. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/mcp/config.py +0 -0
  87. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/mcp/discovery.py +0 -0
  88. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/mcp/tables.py +0 -0
  89. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/packages/__init__.py +0 -0
  90. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/packages/cli.py +0 -0
  91. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/packages/config.py +0 -0
  92. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/packages/listing.py +0 -0
  93. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/packages/mutation.py +0 -0
  94. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/packages/sources.py +0 -0
  95. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/__init__.py +0 -0
  96. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/config.py +0 -0
  97. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/snapshot.py +0 -0
  98. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/state.py +0 -0
  99. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/project/sync.py +0 -0
  100. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/py.typed +0 -0
  101. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/rules/__init__.py +0 -0
  102. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/rules/config.py +0 -0
  103. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/rules/copies.py +0 -0
  104. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/rules/resolution.py +0 -0
  105. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/rules/sources.py +0 -0
  106. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/skills/__init__.py +0 -0
  107. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/skills/config.py +0 -0
  108. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/skills/copies.py +0 -0
  109. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/skills/listing.py +0 -0
  110. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/skills/resolution.py +0 -0
  111. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/skills/sources.py +0 -0
  112. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/__init__.py +0 -0
  113. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/cli.py +0 -0
  114. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/diff.py +0 -0
  115. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/models.py +0 -0
  116. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/package_refs.py +0 -0
  117. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/package_selection.py +0 -0
  118. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/package_state.py +0 -0
  119. {codexmgr-0.2.1 → codexmgr-0.4.0}/src/codexmgr/tui/staged_packages.py +0 -0
  120. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/conftest.py +0 -0
  121. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_agents_cli.py +0 -0
  122. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_agents_file.py +0 -0
  123. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_agentsmd_list_cli.py +0 -0
  124. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_agentsmd_tools_cli.py +0 -0
  125. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_apply_check_cli.py +0 -0
  126. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_cd_cli.py +0 -0
  127. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_cli.py +0 -0
  128. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_empty_skill_config_cli.py +0 -0
  129. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_home_resolution_cli.py +0 -0
  130. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_hooks_cli.py +0 -0
  131. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_packages_cli.py +0 -0
  132. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_paths.py +0 -0
  133. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_python_compatibility.py +0 -0
  134. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_renderer.py +0 -0
  135. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_skill_copies_cli.py +0 -0
  136. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_skill_home_sources_cli.py +0 -0
  137. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_skill_list_cli.py +0 -0
  138. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_skills_cli.py +0 -0
  139. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_status_doctor_cli.py +0 -0
  140. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_sync_cli.py +0 -0
  141. {codexmgr-0.2.1 → codexmgr-0.4.0}/tests/test_toml_io.py +0 -0
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codexmgr
3
- Version: 0.2.1
3
+ Version: 0.4.0
4
4
  Summary: Manage project-local Codex configuration from reusable templates
5
+ Project-URL: Repository, https://github.com/JulianKimmig/codexmgr/
5
6
  Keywords: agents,cli,codex,configuration,skills
6
7
  Classifier: Development Status :: 4 - Beta
7
8
  Classifier: Environment :: Console
@@ -24,9 +25,9 @@ Description-Content-Type: text/markdown
24
25
  # codexmgr
25
26
 
26
27
  `codexmgr` manages reusable Codex project setup. Keep shared `AGENTS.md`
27
- snippets, skills, hooks, custom agents, rule files, packages, and safe MCP
28
- overrides in one manager home, then sync the selected pieces into each project
29
- from `.codex/codexmgr.toml`.
28
+ snippets, skills, hooks, custom agents, rule files, packages, and reusable MCP
29
+ source files in one manager home, then sync the selected pieces into each
30
+ project from `.codex/codexmgr.toml`.
30
31
 
31
32
  The tool is for people who use Codex in several repositories and do not want to
32
33
  copy the same agent instructions by hand. When a shared rule changes, update it
@@ -37,9 +38,9 @@ Use `codexmgr` when a project should:
37
38
  - build `AGENTS.md` from reusable instruction snippets
38
39
  - share skills, hooks, custom agents, and rule files across repositories
39
40
  - enable packaged Codex setups made from those reusable pieces
40
- - keep project MCP overrides out of the user-level Codex config
41
+ - keep reusable MCP server definitions out of the user-level Codex config
41
42
  - check whether generated Codex files match the project config
42
- - run `codex` with project `.codex/config.toml` values passed as `-c` overrides
43
+ - run `codex` with the project `.codex` directory as its local Codex home
43
44
 
44
45
  The basic model has three parts:
45
46
 
@@ -91,7 +92,8 @@ codexmgr setup
91
92
  ```
92
93
 
93
94
  `setup` creates `.codex/`, creates `.codex/codexmgr.toml` if it is missing, and
94
- runs `apply`. Existing project config is preserved.
95
+ runs `apply`. Existing project config is preserved. Apply also creates or
96
+ refreshes codexmgr's managed block in `.codex/.gitignore`.
95
97
 
96
98
  Create a reusable `AGENTS.md` snippet in the manager home. This command creates
97
99
  `$CODEXMGR_HOME/agentsmd/coding.toml` and refuses to overwrite an existing file:
@@ -145,10 +147,13 @@ file for you, and you can also edit it by hand when that is clearer.
145
147
 
146
148
  `apply` resolves the source config and may write or update these managed files:
147
149
 
150
+ - `.codex/.gitignore`: preserves manual rules outside its managed block,
151
+ ignores every unknown `.codex` entry by default, and explicitly exposes the
152
+ codexmgr-owned files and directories listed below
148
153
  - `.codex/codexmgr.lock`: resolved AGENTS.md, agent, skill, hook, rule, and MCP
149
154
  state
150
155
  - `.codex/config.toml`: project-local Codex config, including generated
151
- `[[skills.config]]` entries and `[mcp_servers.<id>]` overrides
156
+ `[[skills.config]]` entries and `[mcp_servers.<id>]` server definitions
152
157
  - `.codex/hooks.json`: generated hook config for enabled reusable hook bundles
153
158
  - `.codex/hooks/<name>`: copied support files for enabled hook bundles
154
159
  - `.codex/agents/<name>.toml`: copied custom-agent definitions
@@ -170,7 +175,7 @@ Manual content outside this block is preserved. If the block is missing,
170
175
 
171
176
  `.codex/codexmgr.toml` can opt into each resource type independently. A minimal
172
177
  file may only contain `[agents_md]`; larger projects can add skills, custom
173
- agents, hooks, reusable rules, and MCP overrides as needed. Package commands
178
+ agents, hooks, reusable rules, and MCP sources or overlays as needed. Package commands
174
179
  write those same tables rather than a separate package table.
175
180
 
176
181
  ```toml
@@ -188,6 +193,8 @@ disabled = ["experimental-hook"]
188
193
  [rules]
189
194
  enabled = ["react/", "python/testing.md"]
190
195
  disabled = ["react/materials/"]
196
+ [mcp]
197
+ enabled = ["browsermcp"]
191
198
  [mcp.servers.browsermcp]
192
199
  enabled = true
193
200
  bearer_token_env_var = "BROWSERMCP_TOKEN"
@@ -232,6 +239,9 @@ Rule refs resolve under `$CODEXMGR_HOME/rules/` and use POSIX-style relative
232
239
  paths. Folder refs have a trailing slash and copy regular files recursively into
233
240
  `.rules/` while preserving relative paths.
234
241
 
242
+ Rule listings are grouped by folder. `codexmgr rules list` prints an indented
243
+ tree, while the TUI Rules screen shows the same refs in a collapsible tree.
244
+
235
245
  File rule refs copy one file. Extensionless refs prefer an existing `<ref>.md`.
236
246
  Enabled refs expand first, then disabled file or folder refs remove entries from
237
247
  that candidate set.
@@ -292,7 +302,8 @@ These commands run `apply` automatically unless `--no-sync` is passed.
292
302
 
293
303
  `codexmgr tui` opens a Textual-based terminal UI for project-local
294
304
  configuration. It shows `AGENTS.md` snippets, skills, hooks, custom agents,
295
- rules, packages, and MCP server enable overrides in selectable lists.
305
+ packages, and reusable MCP sources in selectable lists. Rules are shown
306
+ in a collapsible folder tree.
296
307
 
297
308
  Changes are staged in memory while you navigate. Press `s` to save; the save
298
309
  writes `.codex/codexmgr.toml` once and runs `apply` once unless `--no-sync` was
@@ -300,7 +311,9 @@ used.
300
311
 
301
312
  For resources with explicit enable and disable lists, `space` cycles the
302
313
  highlighted row through available, enabled, and disabled states. Package
303
- profiles appear as separate selectable rows under their package.
314
+ profiles appear as separate selectable rows under their package. In the Rules
315
+ tree, cycling a file or folder node updates the full canonical rule ref behind
316
+ that basename label.
304
317
 
305
318
  ```bash
306
319
  codexmgr tui
@@ -312,9 +325,10 @@ The dashboard shows generated-file sync state. By default it lists stale
312
325
  generated paths; with `--show-diff`, it shows unified diffs for the staged
313
326
  configuration.
314
327
 
315
- MCP editing in the TUI is intentionally limited to the project-local `enabled`
316
- override. Advanced MCP fields remain available through the `codexmgr mcp ...`
317
- commands.
328
+ MCP editing in the TUI is intentionally limited to loading and unloading
329
+ reusable `$CODEXMGR_HOME/mcp/*.toml` sources. Advanced per-server overlay fields
330
+ remain available through the `codexmgr mcp ...` commands or direct
331
+ `.codex/codexmgr.toml` edits.
318
332
 
319
333
  ## Template Format
320
334
 
@@ -358,6 +372,12 @@ managed project files, and refreshes generated state.
358
372
  writing them. `apply --diff` also avoids writing and prints unified diffs for
359
373
  the expected generated-file changes.
360
374
 
375
+ The `.codex/.gitignore` managed block uses a default-ignore rule rather than a
376
+ list of known runtime filenames. New caches, databases, sessions, and other
377
+ state created by future Codex versions therefore remain outside Git without a
378
+ codexmgr update. Project configuration, custom agents, and hook support files
379
+ remain visible to Git.
380
+
361
381
  `doctor` checks project setup, home environment variables, project TOML syntax,
362
382
  referenced snippets, enabled skills, enabled custom agents, enabled hook
363
383
  bundles, enabled rules, and stale generated files.
@@ -421,8 +441,9 @@ codexmgr rules enable [--no-sync] <rule-ref> [...]
421
441
  codexmgr rules disable [--no-sync] <rule-ref> [...]
422
442
  ```
423
443
 
424
- `skill list`, `agents list`, `hooks list`, and `rules list` print available
425
- resources and mark configured entries as enabled, disabled, or missing.
444
+ `skill list`, `agents list`, and `hooks list` print available resources and
445
+ mark configured entries as enabled, disabled, or missing. `rules list` prints
446
+ the same state in an indented folder hierarchy.
426
447
 
427
448
  Enable commands validate manager-home sources when the source type must already
428
449
  exist. Enable and disable lists stay mutually exclusive, and repeated commands
@@ -449,14 +470,23 @@ Codex wrapper command:
449
470
 
450
471
  ```bash
451
472
  codexmgr codex <args...>
473
+ codexmgr codex --simple <args...>
452
474
  ```
453
475
 
454
- `codexmgr codex` applies the current project config, flattens
455
- `.codex/config.toml` into `-c key=value` overrides, and forwards the remaining
456
- arguments to the real `codex` command.
476
+ By default, `codexmgr codex` applies the current project config, launches the
477
+ real `codex` command with `CODEX_HOME` set to `<project>/.codex`, and forwards
478
+ Codex arguments unchanged. Codex reads `.codex/config.toml` directly, so
479
+ user-provided `-c` and `--config` arguments retain their normal Codex behavior.
480
+
481
+ The wrapper links the global authentication file into `.codex/auth.json`. It
482
+ uses `CODEX_GLOBAL_AUTH` when that variable is non-empty and otherwise uses
483
+ `$HOME/.codex/auth.json`. A missing auth source produces a warning but does not
484
+ stop Codex, which can then authenticate normally.
457
485
 
458
- User-provided `-c` or `--config` overrides are merged after project config.
459
- Scalar values replace earlier values, while list values append.
486
+ Use `--simple` immediately after `codex` to run the basic command without
487
+ applying project state, changing the child `CODEX_HOME`, or managing an auth
488
+ link. This launch wrapper is intentionally CLI-only because the TUI does not
489
+ embed or proxy external terminal sessions.
460
490
 
461
491
  The wrapper can run with a just-in-time package/profile overlay without changing
462
492
  `.codex/codexmgr.toml`. Put Codex arguments after `--` when using this syntax:
@@ -465,40 +495,62 @@ The wrapper can run with a just-in-time package/profile overlay without changing
465
495
  codexmgr codex --package repo-rules --profile strict python -- exec "review this"
466
496
  ```
467
497
 
468
- ## Project MCP Overrides
498
+ ## Project MCP Sources
469
499
 
470
- `codexmgr mcp ...` edits only project-local configuration:
500
+ `codexmgr mcp ...` loads reusable MCP definitions from `$CODEXMGR_HOME/mcp`
501
+ into project-local configuration:
471
502
 
472
- - source state is stored in `.codex/codexmgr.toml` under
473
- `[mcp.servers.<id>]`
474
- - `apply` writes generated overrides into `.codex/config.toml` under
503
+ - reusable source state is stored in `.codex/codexmgr.toml` under `[mcp]`
504
+ - per-project server overlays are stored under `[mcp.servers.<id>]`
505
+ - `apply` writes generated server definitions into `.codex/config.toml` under
475
506
  `[mcp_servers.<id>]`
476
507
  - `$CODEX_HOME/config.toml` and `~/.codex/config.toml` are never modified
477
508
 
478
509
  Mutating MCP commands require a project `.codex/` directory and run `apply`
479
- automatically unless `--no-sync` is passed. They do not create or remove MCP
480
- server definitions; use `codex mcp add` or direct Codex config editing for the
481
- base server setup.
510
+ automatically unless `--no-sync` is passed.
482
511
 
483
- List MCP servers available from Codex and show any project override state:
512
+ Create reusable source files in the same `mcp_servers` shape Codex reads from
513
+ `config.toml`:
514
+
515
+ ```toml
516
+ # ~/.codexmgr/mcp/browsermcp.toml
517
+ [mcp_servers.browsermcp]
518
+ command = "browsermcp"
519
+ args = ["--port", "3000"]
520
+ env_vars = ["BROWSERMCP_TOKEN"]
521
+ ```
522
+
523
+ List reusable sources and show project state:
484
524
 
485
525
  ```bash
486
526
  codexmgr mcp list
487
- codexmgr mcp show context7
527
+ codexmgr mcp show browsermcp
488
528
  codexmgr mcp validate
489
529
  ```
490
530
 
491
- `codexmgr mcp list` shells out to `codex mcp list --json` for read-only
492
- discovery. It does not edit user configuration.
493
-
494
- Enable or disable an existing server without deleting its definition:
531
+ Enable or disable reusable sources for the current project:
495
532
 
496
533
  ```bash
497
- codexmgr mcp disable context7
498
- codexmgr mcp enable context7
534
+ codexmgr mcp enable browsermcp context7
535
+ codexmgr mcp disable browsermcp
536
+ ```
537
+
538
+ `disable` unloads the source from `[mcp].enabled`. It does not keep a generated
539
+ server definition with `enabled = false`.
540
+
541
+ Use `[mcp.servers.<id>]` for project-local overlays. Overlays merge after source
542
+ files, so they can override or add fields:
543
+
544
+ ```toml
545
+ [mcp]
546
+ enabled = ["browsermcp"]
547
+
548
+ [mcp.servers.browsermcp]
549
+ enabled = false
550
+ bearer_token_env_var = "BROWSERMCP_TOKEN"
499
551
  ```
500
552
 
501
- Update token and environment references without storing literal token values:
553
+ Update common token and environment references from the CLI:
502
554
 
503
555
  ```bash
504
556
  codexmgr mcp set-token-env figma FIGMA_TOKEN
@@ -508,7 +560,7 @@ codexmgr mcp set-env-header figma Authorization FIGMA_AUTH_HEADER
508
560
  codexmgr mcp unset-env-header figma Authorization
509
561
  ```
510
562
 
511
- Set a small allowlist of non-secret fields from TOML literals:
563
+ Set a small allowlist of overlay fields from TOML literals:
512
564
 
513
565
  ```bash
514
566
  codexmgr mcp set-field context7 required true
@@ -518,12 +570,11 @@ codexmgr mcp set-field context7 default_tools_approval_mode '"prompt"'
518
570
 
519
571
  Supported `set-field` names are `required`, `startup_timeout_sec`,
520
572
  `tool_timeout_sec`, `enabled_tools`, `disabled_tools`, and
521
- `default_tools_approval_mode`. The direct `enable` and `disable` commands manage
522
- the `enabled` field.
573
+ `default_tools_approval_mode`.
523
574
 
524
- Literal API token writes are intentionally not part of this command surface;
525
- prefer environment variable references such as `bearer_token_env_var`,
526
- `env_vars`, and `env_http_headers`.
575
+ Source files and hand-written overlays can use the full Codex `mcp_servers`
576
+ shape. Prefer environment variable references such as `bearer_token_env_var`,
577
+ `env_vars`, and `env_http_headers` for secrets.
527
578
 
528
579
  ## Development
529
580
 
@@ -1,9 +1,9 @@
1
1
  # codexmgr
2
2
 
3
3
  `codexmgr` manages reusable Codex project setup. Keep shared `AGENTS.md`
4
- snippets, skills, hooks, custom agents, rule files, packages, and safe MCP
5
- overrides in one manager home, then sync the selected pieces into each project
6
- from `.codex/codexmgr.toml`.
4
+ snippets, skills, hooks, custom agents, rule files, packages, and reusable MCP
5
+ source files in one manager home, then sync the selected pieces into each
6
+ project from `.codex/codexmgr.toml`.
7
7
 
8
8
  The tool is for people who use Codex in several repositories and do not want to
9
9
  copy the same agent instructions by hand. When a shared rule changes, update it
@@ -14,9 +14,9 @@ Use `codexmgr` when a project should:
14
14
  - build `AGENTS.md` from reusable instruction snippets
15
15
  - share skills, hooks, custom agents, and rule files across repositories
16
16
  - enable packaged Codex setups made from those reusable pieces
17
- - keep project MCP overrides out of the user-level Codex config
17
+ - keep reusable MCP server definitions out of the user-level Codex config
18
18
  - check whether generated Codex files match the project config
19
- - run `codex` with project `.codex/config.toml` values passed as `-c` overrides
19
+ - run `codex` with the project `.codex` directory as its local Codex home
20
20
 
21
21
  The basic model has three parts:
22
22
 
@@ -68,7 +68,8 @@ codexmgr setup
68
68
  ```
69
69
 
70
70
  `setup` creates `.codex/`, creates `.codex/codexmgr.toml` if it is missing, and
71
- runs `apply`. Existing project config is preserved.
71
+ runs `apply`. Existing project config is preserved. Apply also creates or
72
+ refreshes codexmgr's managed block in `.codex/.gitignore`.
72
73
 
73
74
  Create a reusable `AGENTS.md` snippet in the manager home. This command creates
74
75
  `$CODEXMGR_HOME/agentsmd/coding.toml` and refuses to overwrite an existing file:
@@ -122,10 +123,13 @@ file for you, and you can also edit it by hand when that is clearer.
122
123
 
123
124
  `apply` resolves the source config and may write or update these managed files:
124
125
 
126
+ - `.codex/.gitignore`: preserves manual rules outside its managed block,
127
+ ignores every unknown `.codex` entry by default, and explicitly exposes the
128
+ codexmgr-owned files and directories listed below
125
129
  - `.codex/codexmgr.lock`: resolved AGENTS.md, agent, skill, hook, rule, and MCP
126
130
  state
127
131
  - `.codex/config.toml`: project-local Codex config, including generated
128
- `[[skills.config]]` entries and `[mcp_servers.<id>]` overrides
132
+ `[[skills.config]]` entries and `[mcp_servers.<id>]` server definitions
129
133
  - `.codex/hooks.json`: generated hook config for enabled reusable hook bundles
130
134
  - `.codex/hooks/<name>`: copied support files for enabled hook bundles
131
135
  - `.codex/agents/<name>.toml`: copied custom-agent definitions
@@ -147,7 +151,7 @@ Manual content outside this block is preserved. If the block is missing,
147
151
 
148
152
  `.codex/codexmgr.toml` can opt into each resource type independently. A minimal
149
153
  file may only contain `[agents_md]`; larger projects can add skills, custom
150
- agents, hooks, reusable rules, and MCP overrides as needed. Package commands
154
+ agents, hooks, reusable rules, and MCP sources or overlays as needed. Package commands
151
155
  write those same tables rather than a separate package table.
152
156
 
153
157
  ```toml
@@ -165,6 +169,8 @@ disabled = ["experimental-hook"]
165
169
  [rules]
166
170
  enabled = ["react/", "python/testing.md"]
167
171
  disabled = ["react/materials/"]
172
+ [mcp]
173
+ enabled = ["browsermcp"]
168
174
  [mcp.servers.browsermcp]
169
175
  enabled = true
170
176
  bearer_token_env_var = "BROWSERMCP_TOKEN"
@@ -209,6 +215,9 @@ Rule refs resolve under `$CODEXMGR_HOME/rules/` and use POSIX-style relative
209
215
  paths. Folder refs have a trailing slash and copy regular files recursively into
210
216
  `.rules/` while preserving relative paths.
211
217
 
218
+ Rule listings are grouped by folder. `codexmgr rules list` prints an indented
219
+ tree, while the TUI Rules screen shows the same refs in a collapsible tree.
220
+
212
221
  File rule refs copy one file. Extensionless refs prefer an existing `<ref>.md`.
213
222
  Enabled refs expand first, then disabled file or folder refs remove entries from
214
223
  that candidate set.
@@ -269,7 +278,8 @@ These commands run `apply` automatically unless `--no-sync` is passed.
269
278
 
270
279
  `codexmgr tui` opens a Textual-based terminal UI for project-local
271
280
  configuration. It shows `AGENTS.md` snippets, skills, hooks, custom agents,
272
- rules, packages, and MCP server enable overrides in selectable lists.
281
+ packages, and reusable MCP sources in selectable lists. Rules are shown
282
+ in a collapsible folder tree.
273
283
 
274
284
  Changes are staged in memory while you navigate. Press `s` to save; the save
275
285
  writes `.codex/codexmgr.toml` once and runs `apply` once unless `--no-sync` was
@@ -277,7 +287,9 @@ used.
277
287
 
278
288
  For resources with explicit enable and disable lists, `space` cycles the
279
289
  highlighted row through available, enabled, and disabled states. Package
280
- profiles appear as separate selectable rows under their package.
290
+ profiles appear as separate selectable rows under their package. In the Rules
291
+ tree, cycling a file or folder node updates the full canonical rule ref behind
292
+ that basename label.
281
293
 
282
294
  ```bash
283
295
  codexmgr tui
@@ -289,9 +301,10 @@ The dashboard shows generated-file sync state. By default it lists stale
289
301
  generated paths; with `--show-diff`, it shows unified diffs for the staged
290
302
  configuration.
291
303
 
292
- MCP editing in the TUI is intentionally limited to the project-local `enabled`
293
- override. Advanced MCP fields remain available through the `codexmgr mcp ...`
294
- commands.
304
+ MCP editing in the TUI is intentionally limited to loading and unloading
305
+ reusable `$CODEXMGR_HOME/mcp/*.toml` sources. Advanced per-server overlay fields
306
+ remain available through the `codexmgr mcp ...` commands or direct
307
+ `.codex/codexmgr.toml` edits.
295
308
 
296
309
  ## Template Format
297
310
 
@@ -335,6 +348,12 @@ managed project files, and refreshes generated state.
335
348
  writing them. `apply --diff` also avoids writing and prints unified diffs for
336
349
  the expected generated-file changes.
337
350
 
351
+ The `.codex/.gitignore` managed block uses a default-ignore rule rather than a
352
+ list of known runtime filenames. New caches, databases, sessions, and other
353
+ state created by future Codex versions therefore remain outside Git without a
354
+ codexmgr update. Project configuration, custom agents, and hook support files
355
+ remain visible to Git.
356
+
338
357
  `doctor` checks project setup, home environment variables, project TOML syntax,
339
358
  referenced snippets, enabled skills, enabled custom agents, enabled hook
340
359
  bundles, enabled rules, and stale generated files.
@@ -398,8 +417,9 @@ codexmgr rules enable [--no-sync] <rule-ref> [...]
398
417
  codexmgr rules disable [--no-sync] <rule-ref> [...]
399
418
  ```
400
419
 
401
- `skill list`, `agents list`, `hooks list`, and `rules list` print available
402
- resources and mark configured entries as enabled, disabled, or missing.
420
+ `skill list`, `agents list`, and `hooks list` print available resources and
421
+ mark configured entries as enabled, disabled, or missing. `rules list` prints
422
+ the same state in an indented folder hierarchy.
403
423
 
404
424
  Enable commands validate manager-home sources when the source type must already
405
425
  exist. Enable and disable lists stay mutually exclusive, and repeated commands
@@ -426,14 +446,23 @@ Codex wrapper command:
426
446
 
427
447
  ```bash
428
448
  codexmgr codex <args...>
449
+ codexmgr codex --simple <args...>
429
450
  ```
430
451
 
431
- `codexmgr codex` applies the current project config, flattens
432
- `.codex/config.toml` into `-c key=value` overrides, and forwards the remaining
433
- arguments to the real `codex` command.
452
+ By default, `codexmgr codex` applies the current project config, launches the
453
+ real `codex` command with `CODEX_HOME` set to `<project>/.codex`, and forwards
454
+ Codex arguments unchanged. Codex reads `.codex/config.toml` directly, so
455
+ user-provided `-c` and `--config` arguments retain their normal Codex behavior.
456
+
457
+ The wrapper links the global authentication file into `.codex/auth.json`. It
458
+ uses `CODEX_GLOBAL_AUTH` when that variable is non-empty and otherwise uses
459
+ `$HOME/.codex/auth.json`. A missing auth source produces a warning but does not
460
+ stop Codex, which can then authenticate normally.
434
461
 
435
- User-provided `-c` or `--config` overrides are merged after project config.
436
- Scalar values replace earlier values, while list values append.
462
+ Use `--simple` immediately after `codex` to run the basic command without
463
+ applying project state, changing the child `CODEX_HOME`, or managing an auth
464
+ link. This launch wrapper is intentionally CLI-only because the TUI does not
465
+ embed or proxy external terminal sessions.
437
466
 
438
467
  The wrapper can run with a just-in-time package/profile overlay without changing
439
468
  `.codex/codexmgr.toml`. Put Codex arguments after `--` when using this syntax:
@@ -442,40 +471,62 @@ The wrapper can run with a just-in-time package/profile overlay without changing
442
471
  codexmgr codex --package repo-rules --profile strict python -- exec "review this"
443
472
  ```
444
473
 
445
- ## Project MCP Overrides
474
+ ## Project MCP Sources
446
475
 
447
- `codexmgr mcp ...` edits only project-local configuration:
476
+ `codexmgr mcp ...` loads reusable MCP definitions from `$CODEXMGR_HOME/mcp`
477
+ into project-local configuration:
448
478
 
449
- - source state is stored in `.codex/codexmgr.toml` under
450
- `[mcp.servers.<id>]`
451
- - `apply` writes generated overrides into `.codex/config.toml` under
479
+ - reusable source state is stored in `.codex/codexmgr.toml` under `[mcp]`
480
+ - per-project server overlays are stored under `[mcp.servers.<id>]`
481
+ - `apply` writes generated server definitions into `.codex/config.toml` under
452
482
  `[mcp_servers.<id>]`
453
483
  - `$CODEX_HOME/config.toml` and `~/.codex/config.toml` are never modified
454
484
 
455
485
  Mutating MCP commands require a project `.codex/` directory and run `apply`
456
- automatically unless `--no-sync` is passed. They do not create or remove MCP
457
- server definitions; use `codex mcp add` or direct Codex config editing for the
458
- base server setup.
486
+ automatically unless `--no-sync` is passed.
459
487
 
460
- List MCP servers available from Codex and show any project override state:
488
+ Create reusable source files in the same `mcp_servers` shape Codex reads from
489
+ `config.toml`:
490
+
491
+ ```toml
492
+ # ~/.codexmgr/mcp/browsermcp.toml
493
+ [mcp_servers.browsermcp]
494
+ command = "browsermcp"
495
+ args = ["--port", "3000"]
496
+ env_vars = ["BROWSERMCP_TOKEN"]
497
+ ```
498
+
499
+ List reusable sources and show project state:
461
500
 
462
501
  ```bash
463
502
  codexmgr mcp list
464
- codexmgr mcp show context7
503
+ codexmgr mcp show browsermcp
465
504
  codexmgr mcp validate
466
505
  ```
467
506
 
468
- `codexmgr mcp list` shells out to `codex mcp list --json` for read-only
469
- discovery. It does not edit user configuration.
470
-
471
- Enable or disable an existing server without deleting its definition:
507
+ Enable or disable reusable sources for the current project:
472
508
 
473
509
  ```bash
474
- codexmgr mcp disable context7
475
- codexmgr mcp enable context7
510
+ codexmgr mcp enable browsermcp context7
511
+ codexmgr mcp disable browsermcp
512
+ ```
513
+
514
+ `disable` unloads the source from `[mcp].enabled`. It does not keep a generated
515
+ server definition with `enabled = false`.
516
+
517
+ Use `[mcp.servers.<id>]` for project-local overlays. Overlays merge after source
518
+ files, so they can override or add fields:
519
+
520
+ ```toml
521
+ [mcp]
522
+ enabled = ["browsermcp"]
523
+
524
+ [mcp.servers.browsermcp]
525
+ enabled = false
526
+ bearer_token_env_var = "BROWSERMCP_TOKEN"
476
527
  ```
477
528
 
478
- Update token and environment references without storing literal token values:
529
+ Update common token and environment references from the CLI:
479
530
 
480
531
  ```bash
481
532
  codexmgr mcp set-token-env figma FIGMA_TOKEN
@@ -485,7 +536,7 @@ codexmgr mcp set-env-header figma Authorization FIGMA_AUTH_HEADER
485
536
  codexmgr mcp unset-env-header figma Authorization
486
537
  ```
487
538
 
488
- Set a small allowlist of non-secret fields from TOML literals:
539
+ Set a small allowlist of overlay fields from TOML literals:
489
540
 
490
541
  ```bash
491
542
  codexmgr mcp set-field context7 required true
@@ -495,12 +546,11 @@ codexmgr mcp set-field context7 default_tools_approval_mode '"prompt"'
495
546
 
496
547
  Supported `set-field` names are `required`, `startup_timeout_sec`,
497
548
  `tool_timeout_sec`, `enabled_tools`, `disabled_tools`, and
498
- `default_tools_approval_mode`. The direct `enable` and `disable` commands manage
499
- the `enabled` field.
549
+ `default_tools_approval_mode`.
500
550
 
501
- Literal API token writes are intentionally not part of this command surface;
502
- prefer environment variable references such as `bearer_token_env_var`,
503
- `env_vars`, and `env_http_headers`.
551
+ Source files and hand-written overlays can use the full Codex `mcp_servers`
552
+ shape. Prefer environment variable references such as `bearer_token_env_var`,
553
+ `env_vars`, and `env_http_headers` for secrets.
504
554
 
505
555
  ## Development
506
556
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codexmgr"
3
- version = "0.2.1"
3
+ version = "0.4.0"
4
4
  description = "Manage project-local Codex configuration from reusable templates"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -21,6 +21,9 @@ classifiers = [
21
21
  "Typing :: Typed",
22
22
  ]
23
23
 
24
+ [project.urls]
25
+ Repository = "https://github.com/JulianKimmig/codexmgr/"
26
+
24
27
  [project.scripts]
25
28
  codexmgr = "codexmgr.interface.cli:entrypoint"
26
29
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.2.1"
5
+ __version__ = "0.4.0"
@@ -0,0 +1,43 @@
1
+ """Helpers for preserving manual AGENTS.md content around a managed block."""
2
+
3
+ from pathlib import Path
4
+
5
+ from ..core.managed_text import render_managed_block
6
+
7
+ BEGIN_MARKER = "<!-- BEGIN CODEXMGR GENERATED -->"
8
+ END_MARKER = "<!-- END CODEXMGR GENERATED -->"
9
+
10
+
11
+ def write_managed_agents_md(path: Path, generated_markdown: str) -> None:
12
+ """Write generated markdown into the CODEXMGR managed block.
13
+
14
+ Args:
15
+ path: Project AGENTS.md path to create or update.
16
+ generated_markdown: Markdown content to place inside the managed block.
17
+
18
+ Returns:
19
+ None. The file is written with UTF-8 encoding.
20
+ """
21
+ current = path.read_text(encoding="utf-8") if path.exists() else ""
22
+ updated = render_managed_agents_md(current, generated_markdown)
23
+ path.write_text(updated, encoding="utf-8")
24
+
25
+
26
+ def render_managed_agents_md(current: str, generated_markdown: str) -> str:
27
+ """Render AGENTS.md content with an updated managed block.
28
+
29
+ Args:
30
+ current: Existing AGENTS.md content, or an empty string for a new file.
31
+ generated_markdown: Markdown content for the managed block.
32
+
33
+ Returns:
34
+ Full AGENTS.md content with the codexmgr managed block replaced or
35
+ appended.
36
+ """
37
+ return render_managed_block(
38
+ current,
39
+ generated_markdown,
40
+ begin_marker=BEGIN_MARKER,
41
+ end_marker=END_MARKER,
42
+ artifact_name="AGENTS.md",
43
+ )