pactkit-codex 4.4.1__tar.gz → 5.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pactkit_codex-4.4.1/src/pactkit_codex.egg-info → pactkit_codex-5.0.0}/PKG-INFO +2 -2
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/pyproject.toml +2 -2
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex/deployer.py +96 -50
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0/src/pactkit_codex.egg-info}/PKG-INFO +2 -2
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex.egg-info/requires.txt +1 -1
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/LICENSE +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/README.md +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/setup.cfg +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex/__init__.py +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex/declarations.py +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex/enforcement.py +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex.egg-info/SOURCES.txt +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex.egg-info/dependency_links.txt +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex.egg-info/entry_points.txt +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/src/pactkit_codex.egg-info/top_level.txt +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/tests/test_capability_contract.py +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/tests/test_host_body_snapshot.py +0 -0
- {pactkit_codex-4.4.1 → pactkit_codex-5.0.0}/tests/test_profile_contract.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pactkit-codex
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.0
|
|
4
4
|
Summary: PactKit adapter for OpenAI Codex CLI
|
|
5
5
|
Author: Slim
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: pactkit<
|
|
24
|
+
Requires-Dist: pactkit<5.1.0,>=5.0.0
|
|
25
25
|
Requires-Dist: tomli>=1.1.0; python_version < "3.11"
|
|
26
26
|
Dynamic: license-file
|
|
27
27
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pactkit-codex"
|
|
7
|
-
version = "
|
|
7
|
+
version = "5.0.0"
|
|
8
8
|
description = "PactKit adapter for OpenAI Codex CLI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -14,7 +14,7 @@ dependencies = [
|
|
|
14
14
|
# `pactkit.managed_docs.upsert_managed_block`, which first ships in
|
|
15
15
|
# core 4.1.3. The previous floor (>=4.1.0) allowed a released-core
|
|
16
16
|
# combination whose deploy raises ImportError.
|
|
17
|
-
"pactkit>=
|
|
17
|
+
"pactkit>=5.0.0,<5.1.0",
|
|
18
18
|
"tomli>=1.1.0; python_version < '3.11'",
|
|
19
19
|
]
|
|
20
20
|
|
|
@@ -158,14 +158,22 @@ class CodexDeployer(DeployerBase):
|
|
|
158
158
|
"trust_review_command": None,
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
def deploy(self, config=None, target=None, project_root=None, no_redetect=False
|
|
161
|
+
def deploy(self, config=None, target=None, project_root=None, no_redetect=False,
|
|
162
|
+
global_only=False, project_only=False):
|
|
162
163
|
"""Deploy PactKit configuration for Codex CLI.
|
|
163
164
|
|
|
164
165
|
``project_root`` is **not** the deploy root (``~/.codex`` is): it names
|
|
165
166
|
the project whose config and overlay are read, which used to resolve
|
|
166
167
|
from the caller's cwd. ``no_redetect`` is accepted because Core passes
|
|
167
168
|
it alongside; it is a no-op here — the stack probe only reads.
|
|
169
|
+
|
|
170
|
+
``global_only`` (STORY-slim-20261125f4db76f08fc5): a global Host
|
|
171
|
+
deployment must not read or write any project file. ``project_only``
|
|
172
|
+
(R3, ``pactkit integrate``) is the inverse: write only project files,
|
|
173
|
+
never re-deploy the machine-global Codex components other projects load.
|
|
168
174
|
"""
|
|
175
|
+
if global_only and project_only:
|
|
176
|
+
raise ValueError("global_only and project_only are mutually exclusive")
|
|
169
177
|
codex_root = Path(target) if target else Path.home() / ".codex"
|
|
170
178
|
project_root = Path(project_root) if project_root is not None else Path.cwd()
|
|
171
179
|
|
|
@@ -173,7 +181,7 @@ class CodexDeployer(DeployerBase):
|
|
|
173
181
|
|
|
174
182
|
from pactkit.config import find_pactkit_yaml
|
|
175
183
|
|
|
176
|
-
project_yaml = find_pactkit_yaml(project_root)
|
|
184
|
+
project_yaml = None if global_only else find_pactkit_yaml(project_root)
|
|
177
185
|
if config is not None:
|
|
178
186
|
cfg = config
|
|
179
187
|
elif project_yaml is not None:
|
|
@@ -183,61 +191,71 @@ class CodexDeployer(DeployerBase):
|
|
|
183
191
|
cfg = load_config(project_yaml)
|
|
184
192
|
else:
|
|
185
193
|
cfg = {}
|
|
186
|
-
|
|
194
|
+
if not global_only:
|
|
195
|
+
cfg = activate_pactkit_maintainer_overlay(cfg, project_root)
|
|
187
196
|
|
|
188
197
|
enabled_skills = cfg.get("skills", sorted(VALID_SKILLS))
|
|
189
198
|
enabled_commands = cfg.get("commands")
|
|
190
199
|
|
|
191
|
-
|
|
192
|
-
#
|
|
193
|
-
#
|
|
194
|
-
|
|
195
|
-
codex_root, enabled_skills, enabled_commands, cfg.get("rules", sorted(DEFAULT_RULE_IDS)),
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
transaction_root = project_root if target is None else None # rollback scope
|
|
200
|
+
n_skills = n_commands = 0
|
|
201
|
+
# A global-only deployment never touches the project, so the rollback
|
|
202
|
+
# scope must not include project paths either.
|
|
203
|
+
transaction_root = project_root if (target is None and not global_only) else None
|
|
199
204
|
with rollback_paths(self._transaction_paths(codex_root, transaction_root)):
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
205
|
+
# Project-only integration writes NO machine-global Codex components
|
|
206
|
+
# (R3): integrating a project must not re-select what other projects
|
|
207
|
+
# load. Only the default mixed path deploys global components.
|
|
208
|
+
if not project_only:
|
|
209
|
+
# Validate the complete generated artifact set before touching the
|
|
210
|
+
# current installation. A rejected rule, command, skill, or AGENTS
|
|
211
|
+
# document must preserve the prior usable Codex deployment.
|
|
212
|
+
self._preflight_deploy_artifacts(
|
|
213
|
+
codex_root, enabled_skills, enabled_commands, cfg.get("rules", sorted(DEFAULT_RULE_IDS)),
|
|
214
|
+
config=cfg,
|
|
215
|
+
)
|
|
216
|
+
self._cleanup_stale_command_references(
|
|
217
|
+
codex_root, enabled_commands,
|
|
218
|
+
cfg.get("rules", sorted(DEFAULT_RULE_IDS)),
|
|
219
|
+
)
|
|
220
|
+
skills_dir = codex_root / "skills"
|
|
221
|
+
skills_dir.mkdir(parents=True, exist_ok=True)
|
|
222
|
+
_cleanup_legacy_portable_methods(skills_dir, self.profile)
|
|
223
|
+
n_skills = self.deploy_codex_skills(skills_dir, enabled_skills, self.profile)
|
|
224
|
+
n_commands = self.deploy_codex_command_skills(
|
|
225
|
+
skills_dir, self.profile, enabled_commands=enabled_commands,
|
|
226
|
+
maintainer_overlay=cfg.get("_pactkit_self_development", False),
|
|
227
|
+
enabled_rules=cfg.get("rules", sorted(DEFAULT_RULE_IDS)),
|
|
228
|
+
config=cfg,
|
|
229
|
+
)
|
|
230
|
+
_cleanup_legacy(skills_dir)
|
|
231
|
+
# Legacy prompt/playbook directories have no ownership manifest.
|
|
232
|
+
# Their names alone are not deletion authority, so leave them for
|
|
233
|
+
# explicit user review instead of recursively deleting user content.
|
|
234
|
+
|
|
235
|
+
rules_dir = codex_root / "rules"
|
|
236
|
+
rules_dir.mkdir(parents=True, exist_ok=True)
|
|
237
|
+
self.deploy_codex_rules(
|
|
238
|
+
rules_dir, self.profile, enabled_commands=enabled_commands,
|
|
239
|
+
enabled_rules=cfg.get("rules", sorted(DEFAULT_RULE_IDS)),
|
|
240
|
+
)
|
|
241
|
+
self.deploy_codex_agents_md(
|
|
242
|
+
codex_root, self.profile, enabled_commands=enabled_commands,
|
|
243
|
+
enabled_rules=cfg.get("rules", sorted(DEFAULT_RULE_IDS)),
|
|
244
|
+
)
|
|
245
|
+
self.generate_codex_config_toml(codex_root)
|
|
246
|
+
self.remove_legacy_stop_hook(codex_root)
|
|
230
247
|
|
|
231
248
|
# Gate on `target is None`, not on `project_root is not None`: the
|
|
232
249
|
# two coincided only while `project_root` was *derived* from this
|
|
233
250
|
# condition, making it a flag as much as an identity. Separate them
|
|
234
251
|
# and `-C` reaches the identity while an explicit `-t` install still
|
|
235
252
|
# touches nothing outside its target (measured 2026-10-02).
|
|
236
|
-
if target is None:
|
|
253
|
+
if target is None and not global_only:
|
|
237
254
|
self.generate_codex_project_files(project_root)
|
|
238
255
|
|
|
239
|
-
|
|
240
|
-
|
|
256
|
+
if not project_only:
|
|
257
|
+
self.write_version_marker(codex_root)
|
|
258
|
+
self._write_deployment_manifest(codex_root, cfg)
|
|
241
259
|
|
|
242
260
|
print(
|
|
243
261
|
f"\n✅ Codex CLI: {n_skills} Skills, {n_commands} Commands → {codex_root}"
|
|
@@ -461,7 +479,7 @@ class CodexDeployer(DeployerBase):
|
|
|
461
479
|
json.dumps(manifest, indent=2, ensure_ascii=False) + "\n",
|
|
462
480
|
)
|
|
463
481
|
|
|
464
|
-
def _preflight_deploy_artifacts(self, codex_root, enabled_skills, enabled_commands, enabled_rules):
|
|
482
|
+
def _preflight_deploy_artifacts(self, codex_root, enabled_skills, enabled_commands, enabled_rules, config=None):
|
|
465
483
|
"""Render all managed artifacts in isolation before live deployment."""
|
|
466
484
|
codex_root.parent.mkdir(parents=True, exist_ok=True)
|
|
467
485
|
stage_root = Path(tempfile.mkdtemp(prefix=".pactkit-stage-", dir=codex_root.parent))
|
|
@@ -472,6 +490,7 @@ class CodexDeployer(DeployerBase):
|
|
|
472
490
|
skills_dir, self.profile, enabled_commands=enabled_commands,
|
|
473
491
|
maintainer_overlay=enabled_rules and "pactkit-maintainer" in enabled_rules,
|
|
474
492
|
enabled_rules=enabled_rules,
|
|
493
|
+
config=config,
|
|
475
494
|
)
|
|
476
495
|
self.deploy_codex_rules(
|
|
477
496
|
stage_root / "rules", self.profile, enabled_commands=enabled_commands,
|
|
@@ -735,12 +754,18 @@ class CodexDeployer(DeployerBase):
|
|
|
735
754
|
raw_content = _truncate_agents_md(raw_content, MAX_SIZE)
|
|
736
755
|
|
|
737
756
|
_enforce_deploy_integrity(raw_content, profile, "AGENTS.md")
|
|
738
|
-
|
|
757
|
+
# Global AGENTS.md is a user document with a PactKit-managed region;
|
|
758
|
+
# merge-semantics preserve user content (STORY-slim-20261120528a3b6615d3).
|
|
759
|
+
# No ownership gate here: the deploy transaction (rollback_paths) provides
|
|
760
|
+
# atomicity, and a project-scoped ownership record would escape it.
|
|
761
|
+
from pactkit.managed_docs import RUNTIME_INDEX_VERSION_RE, upsert_managed_block
|
|
762
|
+
upsert_managed_block(codex_root / "AGENTS.md", raw_content,
|
|
763
|
+
legacy_version_pattern=RUNTIME_INDEX_VERSION_RE)
|
|
739
764
|
|
|
740
765
|
@staticmethod
|
|
741
766
|
def deploy_codex_command_skills(
|
|
742
767
|
skills_dir, profile, enabled_commands=None, maintainer_overlay=False,
|
|
743
|
-
enabled_rules=None,
|
|
768
|
+
enabled_rules=None, config=None,
|
|
744
769
|
):
|
|
745
770
|
"""Deploy PDCA commands as skills/{name}/SKILL.md (unified with Claude Code)."""
|
|
746
771
|
deployed = 0
|
|
@@ -796,6 +821,8 @@ class CodexDeployer(DeployerBase):
|
|
|
796
821
|
description = line.split(":", 1)[1].strip().strip('"')
|
|
797
822
|
content = parts[2].lstrip("\n")
|
|
798
823
|
|
|
824
|
+
from pactkit.generators.deployer import _strip_disabled_conditional_body
|
|
825
|
+
content = _strip_disabled_conditional_body(content, cmd_name, enabled_rule_ids)
|
|
799
826
|
content = render_prompt(content, profile)
|
|
800
827
|
if cmd_name == "project-sprint":
|
|
801
828
|
description = "Sequential PDCA in the current Codex session"
|
|
@@ -831,9 +858,15 @@ class CodexDeployer(DeployerBase):
|
|
|
831
858
|
# Compose selected phase/shared rules into SKILL.md at build time.
|
|
832
859
|
# Codex does not document Claude-style Markdown @imports, so the
|
|
833
860
|
# activated skill must carry its complete operational contract.
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
861
|
+
# Unified rule selection (STORY-slim-202611230d9bcb6df0cc): honor
|
|
862
|
+
# command_rules overrides via the core selector, like the other hosts.
|
|
863
|
+
if config is not None:
|
|
864
|
+
from pactkit.generators.deployer import _get_command_rules
|
|
865
|
+
rule_keys = _get_command_rules(cmd_name, config)
|
|
866
|
+
else:
|
|
867
|
+
rule_keys = COMMAND_RULES_MAP.get(cmd_name, ["runtime"])
|
|
868
|
+
if maintainer_overlay:
|
|
869
|
+
rule_keys = [*rule_keys, "pactkit-maintainer"]
|
|
837
870
|
inline_rules = []
|
|
838
871
|
for key in rule_keys:
|
|
839
872
|
if key == "runtime":
|
|
@@ -891,6 +924,19 @@ class CodexDeployer(DeployerBase):
|
|
|
891
924
|
for filename, guide_content in GUIDES_FILES.items()
|
|
892
925
|
})
|
|
893
926
|
references_by_command[cmd_name] = command_references
|
|
927
|
+
# R4 (STORY-slim-202611230d9bcb6df0cc): a generated command must not
|
|
928
|
+
# reference a file the deployment does not produce. Fail before write
|
|
929
|
+
# so the preflight rejects and the prior usable deployment survives.
|
|
930
|
+
from pactkit.generators.deployer import (
|
|
931
|
+
DeployIntegrityError,
|
|
932
|
+
_dangling_command_references,
|
|
933
|
+
)
|
|
934
|
+
dangling = _dangling_command_references(skill_content, command_references)
|
|
935
|
+
if dangling:
|
|
936
|
+
raise DeployIntegrityError(
|
|
937
|
+
f"command_skill:{cmd_name}",
|
|
938
|
+
[f"dangling reference: references/{d}" for d in dangling],
|
|
939
|
+
)
|
|
894
940
|
|
|
895
941
|
# Rendering/validation succeeded. Capture the previous ownership but
|
|
896
942
|
# do not delete anything until selected commands and their new manifest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pactkit-codex
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.0
|
|
4
4
|
Summary: PactKit adapter for OpenAI Codex CLI
|
|
5
5
|
Author: Slim
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: pactkit<
|
|
24
|
+
Requires-Dist: pactkit<5.1.0,>=5.0.0
|
|
25
25
|
Requires-Dist: tomli>=1.1.0; python_version < "3.11"
|
|
26
26
|
Dynamic: license-file
|
|
27
27
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|