codexmgr 0.1.3__tar.gz → 0.2.1__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 (126) hide show
  1. codexmgr-0.2.1/PKG-INFO +552 -0
  2. codexmgr-0.2.1/README.md +529 -0
  3. {codexmgr-0.1.3 → codexmgr-0.2.1}/pyproject.toml +1 -1
  4. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/__init__.py +1 -1
  5. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/commands/codex_jit.py +20 -1
  6. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/commands/health.py +48 -0
  7. codexmgr-0.2.1/src/codexmgr/commands/rules.py +115 -0
  8. codexmgr-0.2.1/src/codexmgr/custom_agents/__init__.py +1 -0
  9. codexmgr-0.2.1/src/codexmgr/custom_agents/cli.py +120 -0
  10. codexmgr-0.2.1/src/codexmgr/custom_agents/config.py +165 -0
  11. codexmgr-0.2.1/src/codexmgr/custom_agents/copies.py +164 -0
  12. codexmgr-0.2.1/src/codexmgr/custom_agents/listing.py +131 -0
  13. codexmgr-0.2.1/src/codexmgr/custom_agents/resolution.py +95 -0
  14. codexmgr-0.2.1/src/codexmgr/custom_agents/sources.py +135 -0
  15. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/interface/cli.py +8 -0
  16. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/interface/parser.py +26 -0
  17. codexmgr-0.2.1/src/codexmgr/interface/parsers/agents.py +27 -0
  18. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/packages/config.py +26 -3
  19. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/packages/mutation.py +15 -1
  20. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/apply.py +81 -1
  21. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/generated.py +18 -1
  22. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/state.py +10 -0
  23. codexmgr-0.2.1/src/codexmgr/rules/__init__.py +1 -0
  24. codexmgr-0.2.1/src/codexmgr/rules/config.py +193 -0
  25. codexmgr-0.2.1/src/codexmgr/rules/copies.py +198 -0
  26. codexmgr-0.2.1/src/codexmgr/rules/listing.py +135 -0
  27. codexmgr-0.2.1/src/codexmgr/rules/resolution.py +180 -0
  28. codexmgr-0.2.1/src/codexmgr/rules/sources.py +146 -0
  29. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/app.py +50 -53
  30. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/items.py +37 -0
  31. codexmgr-0.2.1/src/codexmgr/tui/mutations.py +170 -0
  32. codexmgr-0.2.1/src/codexmgr/tui/package_state.py +214 -0
  33. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/rendering.py +24 -2
  34. codexmgr-0.2.1/src/codexmgr/tui/rule_items.py +58 -0
  35. codexmgr-0.2.1/src/codexmgr/tui/sections.py +203 -0
  36. codexmgr-0.2.1/src/codexmgr/tui/staged_packages.py +99 -0
  37. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/state.py +52 -95
  38. codexmgr-0.2.1/tests/test_agents_cli.py +245 -0
  39. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_apply_check_cli.py +73 -0
  40. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_codex_cli.py +83 -0
  41. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_packages_cli.py +197 -0
  42. codexmgr-0.2.1/tests/test_rules_cli.py +264 -0
  43. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_status_doctor_cli.py +146 -1
  44. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_tui_app.py +75 -14
  45. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_tui_state.py +147 -1
  46. {codexmgr-0.1.3 → codexmgr-0.2.1}/uv.lock +1 -1
  47. codexmgr-0.1.3/PKG-INFO +0 -457
  48. codexmgr-0.1.3/README.md +0 -434
  49. codexmgr-0.1.3/src/codexmgr/tui/mutations.py +0 -97
  50. {codexmgr-0.1.3 → codexmgr-0.2.1}/.github/actions/install_package/action.yml +0 -0
  51. {codexmgr-0.1.3 → codexmgr-0.2.1}/.github/workflows/py_test.yml +0 -0
  52. {codexmgr-0.1.3 → codexmgr-0.2.1}/.github/workflows/version_publish_main.yml +0 -0
  53. {codexmgr-0.1.3 → codexmgr-0.2.1}/.gitignore +0 -0
  54. {codexmgr-0.1.3 → codexmgr-0.2.1}/pytest.toml +0 -0
  55. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/agents/__init__.py +0 -0
  56. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/agents/file.py +0 -0
  57. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/agents/manager.py +0 -0
  58. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/agents/renderer.py +0 -0
  59. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/commands/__init__.py +0 -0
  60. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/commands/codex.py +0 -0
  61. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/commands/config_mutations.py +0 -0
  62. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/commands/navigation.py +0 -0
  63. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/core/__init__.py +0 -0
  64. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/core/errors.py +0 -0
  65. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/core/options.py +0 -0
  66. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/core/paths.py +0 -0
  67. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/core/toml_io.py +0 -0
  68. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/__init__.py +0 -0
  69. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/config.py +0 -0
  70. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/copies.py +0 -0
  71. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/listing.py +0 -0
  72. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/merge.py +0 -0
  73. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/resolution.py +0 -0
  74. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/hooks/sources.py +0 -0
  75. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/interface/__init__.py +0 -0
  76. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/interface/parsers/__init__.py +0 -0
  77. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/interface/parsers/mcp.py +0 -0
  78. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/__init__.py +0 -0
  79. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/apply.py +0 -0
  80. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/cli.py +0 -0
  81. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/config.py +0 -0
  82. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/discovery.py +0 -0
  83. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/fields.py +0 -0
  84. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/mcp/tables.py +0 -0
  85. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/packages/__init__.py +0 -0
  86. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/packages/cli.py +0 -0
  87. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/packages/listing.py +0 -0
  88. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/packages/sources.py +0 -0
  89. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/__init__.py +0 -0
  90. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/config.py +0 -0
  91. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/snapshot.py +0 -0
  92. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/project/sync.py +0 -0
  93. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/py.typed +0 -0
  94. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/skills/__init__.py +0 -0
  95. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/skills/config.py +0 -0
  96. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/skills/copies.py +0 -0
  97. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/skills/listing.py +0 -0
  98. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/skills/resolution.py +0 -0
  99. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/skills/sources.py +0 -0
  100. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/__init__.py +0 -0
  101. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/cli.py +0 -0
  102. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/diff.py +0 -0
  103. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/models.py +0 -0
  104. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/package_refs.py +0 -0
  105. {codexmgr-0.1.3 → codexmgr-0.2.1}/src/codexmgr/tui/package_selection.py +0 -0
  106. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/conftest.py +0 -0
  107. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_agents_file.py +0 -0
  108. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_agentsmd_list_cli.py +0 -0
  109. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_agentsmd_tools_cli.py +0 -0
  110. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_cd_cli.py +0 -0
  111. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_cli.py +0 -0
  112. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_empty_skill_config_cli.py +0 -0
  113. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_home_resolution_cli.py +0 -0
  114. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_hooks_cli.py +0 -0
  115. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_mcp_apply_cli.py +0 -0
  116. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_mcp_cli.py +0 -0
  117. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_package_metadata.py +0 -0
  118. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_paths.py +0 -0
  119. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_python_compatibility.py +0 -0
  120. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_renderer.py +0 -0
  121. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_skill_copies_cli.py +0 -0
  122. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_skill_home_sources_cli.py +0 -0
  123. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_skill_list_cli.py +0 -0
  124. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_skills_cli.py +0 -0
  125. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_sync_cli.py +0 -0
  126. {codexmgr-0.1.3 → codexmgr-0.2.1}/tests/test_toml_io.py +0 -0
@@ -0,0 +1,552 @@
1
+ Metadata-Version: 2.4
2
+ Name: codexmgr
3
+ Version: 0.2.1
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
+ Requires-Dist: textual>=8.2.7
17
+ Requires-Dist: tomlkit>=0.15.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest-asyncio>=1.4.0; extra == 'dev'
20
+ Requires-Dist: pytest>=9.0.3; extra == 'dev'
21
+ Requires-Dist: pyyaml>=6.0.3; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # codexmgr
25
+
26
+ `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`.
30
+
31
+ The tool is for people who use Codex in several repositories and do not want to
32
+ copy the same agent instructions by hand. When a shared rule changes, update it
33
+ once in `$CODEXMGR_HOME` and apply it wherever that project has opted in.
34
+
35
+ Use `codexmgr` when a project should:
36
+
37
+ - build `AGENTS.md` from reusable instruction snippets
38
+ - share skills, hooks, custom agents, and rule files across repositories
39
+ - enable packaged Codex setups made from those reusable pieces
40
+ - keep project MCP overrides out of the user-level Codex config
41
+ - check whether generated Codex files match the project config
42
+ - run `codex` with project `.codex/config.toml` values passed as `-c` overrides
43
+
44
+ The basic model has three parts:
45
+
46
+ - `$CODEXMGR_HOME` stores reusable inputs; when unset it defaults to
47
+ `~/.codexmgr`
48
+ - `.codex/codexmgr.toml` records what the current project wants to use
49
+ - `codexmgr apply` resolves the selected inputs and writes the project files
50
+ Codex reads
51
+
52
+ ## Requirements
53
+
54
+ - Python 3.11 or newer
55
+ - `codex` on `PATH` only when using `codexmgr codex ...`
56
+
57
+ ## Install
58
+
59
+ Install `codexmgr` as a command-line tool from the Python package. `pipx` is
60
+ the recommended persistent install because it keeps the tool isolated from
61
+ project environments:
62
+
63
+ ```bash
64
+ pipx install codexmgr
65
+ ```
66
+
67
+ If you use `uv` for command-line tools:
68
+
69
+ ```bash
70
+ uv tool install codexmgr
71
+ ```
72
+
73
+ Plain `pip` also works inside an environment you control:
74
+
75
+ ```bash
76
+ python -m pip install codexmgr
77
+ ```
78
+
79
+ Verify the install:
80
+
81
+ ```bash
82
+ codexmgr --help
83
+ ```
84
+
85
+ ## Quick Start
86
+
87
+ Start inside the project that should receive Codex configuration.
88
+
89
+ ```bash
90
+ codexmgr setup
91
+ ```
92
+
93
+ `setup` creates `.codex/`, creates `.codex/codexmgr.toml` if it is missing, and
94
+ runs `apply`. Existing project config is preserved.
95
+
96
+ Create a reusable `AGENTS.md` snippet in the manager home. This command creates
97
+ `$CODEXMGR_HOME/agentsmd/coding.toml` and refuses to overwrite an existing file:
98
+
99
+ ```bash
100
+ codexmgr init-template agentsmd coding
101
+ ```
102
+
103
+ You can also write the snippet yourself. A snippet is a TOML template whose
104
+ tables become Markdown headings in `AGENTS.md`:
105
+
106
+ ```toml
107
+ # ~/.codexmgr/agentsmd/coding.toml
108
+ [coding]
109
+ text = """
110
+ - Keep source files focused and small.
111
+ - Add tests for behavior changes before implementation.
112
+ """
113
+ [coding.debugging]
114
+ text = "Prefer lasting regression tests over temporary scripts."
115
+ ```
116
+
117
+ Add the snippet to the current project:
118
+
119
+ ```bash
120
+ codexmgr agentsmd add coding
121
+ ```
122
+
123
+ This updates `.codex/codexmgr.toml`, runs `apply`, writes
124
+ `.codex/codexmgr.lock`, and refreshes the managed block in `AGENTS.md`.
125
+
126
+ Preview or validate a snippet when you want to check it before adding it:
127
+
128
+ ```bash
129
+ codexmgr agentsmd show coding
130
+ codexmgr agentsmd validate coding
131
+ ```
132
+
133
+ Check what the project is using after changes:
134
+
135
+ ```bash
136
+ codexmgr status
137
+ codexmgr doctor
138
+ codexmgr apply --check
139
+ ```
140
+
141
+ ## Managed Files
142
+
143
+ The project source of truth is `.codex/codexmgr.toml`. CLI commands edit this
144
+ file for you, and you can also edit it by hand when that is clearer.
145
+
146
+ `apply` resolves the source config and may write or update these managed files:
147
+
148
+ - `.codex/codexmgr.lock`: resolved AGENTS.md, agent, skill, hook, rule, and MCP
149
+ state
150
+ - `.codex/config.toml`: project-local Codex config, including generated
151
+ `[[skills.config]]` entries and `[mcp_servers.<id>]` overrides
152
+ - `.codex/hooks.json`: generated hook config for enabled reusable hook bundles
153
+ - `.codex/hooks/<name>`: copied support files for enabled hook bundles
154
+ - `.codex/agents/<name>.toml`: copied custom-agent definitions
155
+ - `.agents/skills/<name>`: copied manager-home skills
156
+ - `.rules/<path>`: copied reusable rule files
157
+ - `AGENTS.md`: project instructions with only the generated block replaced
158
+
159
+ The managed `AGENTS.md` block is:
160
+
161
+ ```markdown
162
+ <!-- BEGIN CODEXMGR GENERATED -->
163
+ <!-- END CODEXMGR GENERATED -->
164
+ ```
165
+
166
+ Manual content outside this block is preserved. If the block is missing,
167
+ `codexmgr` appends it. If `AGENTS.md` is missing, `codexmgr` creates it.
168
+
169
+ ## Project Configuration
170
+
171
+ `.codex/codexmgr.toml` can opt into each resource type independently. A minimal
172
+ file may only contain `[agents_md]`; larger projects can add skills, custom
173
+ agents, hooks, reusable rules, and MCP overrides as needed. Package commands
174
+ write those same tables rather than a separate package table.
175
+
176
+ ```toml
177
+ [agents_md]
178
+ src = ["coding", "/absolute/or/project-relative/template.toml"]
179
+ [skills]
180
+ enabled = ["review-helper"]
181
+ disabled = ["experimental-skill", "skills/local-disabled"]
182
+ [agents]
183
+ enabled = ["rule-retriever"]
184
+ disabled = ["experimental-agent"]
185
+ [hooks]
186
+ enabled = ["repo-rules"]
187
+ disabled = ["experimental-hook"]
188
+ [rules]
189
+ enabled = ["react/", "python/testing.md"]
190
+ disabled = ["react/materials/"]
191
+ [mcp.servers.browsermcp]
192
+ enabled = true
193
+ bearer_token_env_var = "BROWSERMCP_TOKEN"
194
+ env_vars = ["BROWSER_ENV"]
195
+ ```
196
+
197
+ Mutating commands run `apply` automatically unless `--no-sync` is passed. If
198
+ you edit `.codex/codexmgr.toml` by hand, run `codexmgr apply` or
199
+ `codexmgr apply --check` afterwards.
200
+
201
+ ## Reference Resolution
202
+
203
+ Named `AGENTS.md` snippets resolve from
204
+ `$CODEXMGR_HOME/agentsmd/<name>.toml`. Path-like snippet values resolve
205
+ relative to the project unless they are absolute paths.
206
+
207
+ Named skills resolve from `$CODEXMGR_HOME/skills/<name>/SKILL.md` or
208
+ `$CODEX_HOME/skills/<name>/SKILL.md`. Duplicate names across distinct homes
209
+ fail so the selected skill is not ambiguous.
210
+
211
+ Enabled skills from `$CODEXMGR_HOME` are copied into `.agents/skills/<name>` on
212
+ every apply. The copy overlays source files while preserving extra local files.
213
+ Path-like skill values can point to a `SKILL.md` file or a directory containing
214
+ `SKILL.md`.
215
+
216
+ Missing skills are still written as name-based entries. That lets Codex resolve
217
+ them later from another installed skill source.
218
+
219
+ Named custom agents resolve from `$CODEXMGR_HOME/agents/<name>.toml`. Enabled
220
+ agents are copied into `.codex/agents/<name>.toml`; disabled agents remove the
221
+ managed copy only when the lock records it as codexmgr-managed.
222
+
223
+ Named hooks resolve from `$CODEXMGR_HOME/hooks/<name>/hooks.json`. Enabled hook
224
+ bundles are merged into `.codex/hooks.json`, and existing unmanaged hooks are
225
+ preserved.
226
+
227
+ Hook bundle files other than the root `hooks.json` are copied into
228
+ `.codex/hooks/<name>`. Managed hook handlers receive `codexmanager_meta` so
229
+ future applies can distinguish them from local hooks.
230
+
231
+ Rule refs resolve under `$CODEXMGR_HOME/rules/` and use POSIX-style relative
232
+ paths. Folder refs have a trailing slash and copy regular files recursively into
233
+ `.rules/` while preserving relative paths.
234
+
235
+ File rule refs copy one file. Extensionless refs prefer an existing `<ref>.md`.
236
+ Enabled refs expand first, then disabled file or folder refs remove entries from
237
+ that candidate set.
238
+
239
+ First-time rule applies refuse to overwrite unmanaged `.rules/...` files. This
240
+ keeps existing project-local rules from being replaced accidentally.
241
+
242
+ ## Packages
243
+
244
+ Packages are reusable bundles of snippets, agents, hooks, skills, and rules.
245
+ They resolve from `$CODEXMGR_HOME/packages/<name>/config.toml`.
246
+
247
+ A package config is a TOML document with root lists and optional profile tables:
248
+
249
+ ```toml
250
+ agentsmd = []
251
+ agents = ["rule-retriever"]
252
+ hooks = ["repo-rules"]
253
+ skills = ["repo-rule-manager"]
254
+ rules = ["react/"]
255
+ [profiles.strict]
256
+ agentsmd = ["strict-coding"]
257
+ agents = ["strict-agent"]
258
+ hooks = ["strict-rules"]
259
+ skills = ["strict-review"]
260
+ rules = ["python/testing.md"]
261
+ ```
262
+
263
+ The `agents` list enables custom agents from
264
+ `$CODEXMGR_HOME/agents/<name>.toml`.
265
+
266
+ `codexmgr package enable <name>` validates enabled package sources, then updates
267
+ `.codex/codexmgr.toml` as if the corresponding resource commands had been run.
268
+
269
+ `codexmgr package disable <name>` removes package `AGENTS.md` entries when
270
+ present and disables the package skills, hooks, agents, and rules. Package state
271
+ is not tracked separately; the resulting project config tables remain the
272
+ source of truth.
273
+
274
+ Profiles are merged with the root package entries:
275
+
276
+ ```bash
277
+ codexmgr package enable repo-rules --profile strict python
278
+ ```
279
+
280
+ Direct mutating commands also accept batch targets, for example:
281
+
282
+ ```bash
283
+ codexmgr agentsmd add coding python
284
+ codexmgr skill enable review-helper repo-rule-manager
285
+ codexmgr hooks enable repo-rules audit
286
+ codexmgr mcp enable browsermcp context7
287
+ ```
288
+
289
+ These commands run `apply` automatically unless `--no-sync` is passed.
290
+
291
+ ## Interactive TUI
292
+
293
+ `codexmgr tui` opens a Textual-based terminal UI for project-local
294
+ configuration. It shows `AGENTS.md` snippets, skills, hooks, custom agents,
295
+ rules, packages, and MCP server enable overrides in selectable lists.
296
+
297
+ Changes are staged in memory while you navigate. Press `s` to save; the save
298
+ writes `.codex/codexmgr.toml` once and runs `apply` once unless `--no-sync` was
299
+ used.
300
+
301
+ For resources with explicit enable and disable lists, `space` cycles the
302
+ highlighted row through available, enabled, and disabled states. Package
303
+ profiles appear as separate selectable rows under their package.
304
+
305
+ ```bash
306
+ codexmgr tui
307
+ codexmgr tui --no-sync
308
+ codexmgr tui --show-diff
309
+ ```
310
+
311
+ The dashboard shows generated-file sync state. By default it lists stale
312
+ generated paths; with `--show-diff`, it shows unified diffs for the staged
313
+ configuration.
314
+
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.
318
+
319
+ ## Template Format
320
+
321
+ Template files are TOML documents. Each top-level key must be a table and
322
+ becomes an AGENTS.md heading. A `text` value inside a table becomes the body
323
+ under that heading. Nested tables become nested headings.
324
+
325
+ ```toml
326
+ [coding]
327
+ text = "Top-level guidance."
328
+ [coding.tests]
329
+ text = "Test behavior, not implementation details."
330
+ ```
331
+
332
+ This example renders a top-level `# coding` section with a nested `## tests`
333
+ section below it.
334
+
335
+ Unsupported scalar entries fail loudly instead of being silently ignored. This
336
+ keeps template mistakes visible during `apply`.
337
+
338
+ ## Command Reference
339
+
340
+ Project lifecycle commands:
341
+
342
+ ```bash
343
+ codexmgr setup
344
+ codexmgr apply
345
+ codexmgr apply --check
346
+ codexmgr apply --diff
347
+ codexmgr doctor
348
+ codexmgr status
349
+ ```
350
+
351
+ `setup` creates `.codex/`, creates `.codex/codexmgr.toml` if missing, then runs
352
+ `apply`.
353
+
354
+ `apply` reads `.codex/codexmgr.toml`, resolves configured sources, writes
355
+ managed project files, and refreshes generated state.
356
+
357
+ `apply --check` exits with a failure if generated files are out of sync without
358
+ writing them. `apply --diff` also avoids writing and prints unified diffs for
359
+ the expected generated-file changes.
360
+
361
+ `doctor` checks project setup, home environment variables, project TOML syntax,
362
+ referenced snippets, enabled skills, enabled custom agents, enabled hook
363
+ bundles, enabled rules, and stale generated files.
364
+
365
+ `status` prints the resolved homes, configured snippets, skills, custom agents,
366
+ hooks, rules, and whether generated files are in sync.
367
+
368
+ Manager-home navigation:
369
+
370
+ ```bash
371
+ codexmgr cd
372
+ codexmgr cd --path
373
+ codexmgr cd --explorer
374
+ codexmgr cd --terminal
375
+ ```
376
+
377
+ `cd` launches a shell in `$CODEXMGR_HOME`. The flags print the path, open a file
378
+ explorer, or open a new terminal there.
379
+
380
+ AGENTS.md snippet commands:
381
+
382
+ ```bash
383
+ codexmgr agentsmd list
384
+ codexmgr agentsmd show <name-or-template-path>
385
+ codexmgr agentsmd validate <name-or-template-path>
386
+ codexmgr agentsmd add [--no-sync] <name-or-template-path> [...]
387
+ codexmgr agentsmd remove [--no-sync] <name-or-template-path> [...]
388
+ codexmgr init-template agentsmd <name>
389
+ ```
390
+
391
+ `agentsmd list` prints named templates from `$CODEXMGR_HOME/agentsmd` in sorted
392
+ order.
393
+
394
+ `agentsmd show` renders one template as `AGENTS.md` markdown without changing
395
+ project configuration. `agentsmd validate` loads and renders a template to catch
396
+ TOML or template-shape errors before adding it.
397
+
398
+ `agentsmd add` validates that the template exists before writing config.
399
+ Repeated adds keep one source entry.
400
+
401
+ `agentsmd remove` removes configured template sources and fails if a requested
402
+ source is not present.
403
+
404
+ `init-template agentsmd` creates a starter template under
405
+ `$CODEXMGR_HOME/agentsmd` and refuses to overwrite an existing template.
406
+
407
+ Shared resource commands:
408
+
409
+ ```bash
410
+ codexmgr skill list
411
+ codexmgr skill enable [--no-sync] <name-or-skill-path> [...]
412
+ codexmgr skill disable [--no-sync] <name-or-skill-path> [...]
413
+ codexmgr agents list
414
+ codexmgr agents enable [--no-sync] <agent-name> [...]
415
+ codexmgr agents disable [--no-sync] <agent-name> [...]
416
+ codexmgr hooks list
417
+ codexmgr hooks enable [--no-sync] <hook-name> [...]
418
+ codexmgr hooks disable [--no-sync] <hook-name> [...]
419
+ codexmgr rules list
420
+ codexmgr rules enable [--no-sync] <rule-ref> [...]
421
+ codexmgr rules disable [--no-sync] <rule-ref> [...]
422
+ ```
423
+
424
+ `skill list`, `agents list`, `hooks list`, and `rules list` print available
425
+ resources and mark configured entries as enabled, disabled, or missing.
426
+
427
+ Enable commands validate manager-home sources when the source type must already
428
+ exist. Enable and disable lists stay mutually exclusive, and repeated commands
429
+ keep one entry.
430
+
431
+ Rules have one exception to exact mutual exclusion: a parent folder enable and a
432
+ child file or folder disable can intentionally coexist.
433
+
434
+ Package commands:
435
+
436
+ ```bash
437
+ codexmgr package list
438
+ codexmgr package enable [--no-sync] <package-name> [...] [--profile <name> [...]]
439
+ codexmgr package disable [--no-sync] <package-name> [...] [--profile <name> [...]]
440
+ ```
441
+
442
+ `package list` prints available `$CODEXMGR_HOME/packages/*/config.toml` entries
443
+ in sorted order.
444
+
445
+ `package enable` and `package disable` proxy to the underlying AGENTS.md,
446
+ custom-agent, skill, hook, and rule project-config mutations.
447
+
448
+ Codex wrapper command:
449
+
450
+ ```bash
451
+ codexmgr codex <args...>
452
+ ```
453
+
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.
457
+
458
+ User-provided `-c` or `--config` overrides are merged after project config.
459
+ Scalar values replace earlier values, while list values append.
460
+
461
+ The wrapper can run with a just-in-time package/profile overlay without changing
462
+ `.codex/codexmgr.toml`. Put Codex arguments after `--` when using this syntax:
463
+
464
+ ```bash
465
+ codexmgr codex --package repo-rules --profile strict python -- exec "review this"
466
+ ```
467
+
468
+ ## Project MCP Overrides
469
+
470
+ `codexmgr mcp ...` edits only project-local configuration:
471
+
472
+ - source state is stored in `.codex/codexmgr.toml` under
473
+ `[mcp.servers.<id>]`
474
+ - `apply` writes generated overrides into `.codex/config.toml` under
475
+ `[mcp_servers.<id>]`
476
+ - `$CODEX_HOME/config.toml` and `~/.codex/config.toml` are never modified
477
+
478
+ 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.
482
+
483
+ List MCP servers available from Codex and show any project override state:
484
+
485
+ ```bash
486
+ codexmgr mcp list
487
+ codexmgr mcp show context7
488
+ codexmgr mcp validate
489
+ ```
490
+
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:
495
+
496
+ ```bash
497
+ codexmgr mcp disable context7
498
+ codexmgr mcp enable context7
499
+ ```
500
+
501
+ Update token and environment references without storing literal token values:
502
+
503
+ ```bash
504
+ codexmgr mcp set-token-env figma FIGMA_TOKEN
505
+ codexmgr mcp add-env-var context7 CONTEXT7_TOKEN
506
+ codexmgr mcp remove-env-var context7 CONTEXT7_TOKEN
507
+ codexmgr mcp set-env-header figma Authorization FIGMA_AUTH_HEADER
508
+ codexmgr mcp unset-env-header figma Authorization
509
+ ```
510
+
511
+ Set a small allowlist of non-secret fields from TOML literals:
512
+
513
+ ```bash
514
+ codexmgr mcp set-field context7 required true
515
+ codexmgr mcp set-field context7 enabled_tools '["search", "open"]'
516
+ codexmgr mcp set-field context7 default_tools_approval_mode '"prompt"'
517
+ ```
518
+
519
+ Supported `set-field` names are `required`, `startup_timeout_sec`,
520
+ `tool_timeout_sec`, `enabled_tools`, `disabled_tools`, and
521
+ `default_tools_approval_mode`. The direct `enable` and `disable` commands manage
522
+ the `enabled` field.
523
+
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`.
527
+
528
+ ## Development
529
+
530
+ Use a checkout when developing `codexmgr` itself.
531
+
532
+ Install dependencies:
533
+
534
+ ```bash
535
+ uv sync --group dev
536
+ ```
537
+
538
+ Run tests:
539
+
540
+ ```bash
541
+ uv run pytest
542
+ ```
543
+
544
+ Build distributions:
545
+
546
+ ```bash
547
+ uv build
548
+ ```
549
+
550
+ The package is typed (`py.typed`) and the test suite covers CLI behavior,
551
+ template rendering, TOML writing, skill resolution, generated-file sync checks,
552
+ Codex command generation, home-directory resolution, and package metadata.