pactkit-opencode 2.9.0__tar.gz → 2.9.2__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_opencode-2.9.0 → pactkit_opencode-2.9.2}/PKG-INFO +1 -1
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/pyproject.toml +1 -1
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode/deployer.py +10 -24
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/PKG-INFO +1 -1
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_bug035_opencode_dual_layer.py +22 -5
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story071_opencode_config_parity.py +15 -6
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story073_command_model_routing.py +21 -21
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/README.md +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/setup.cfg +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode/__init__.py +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/SOURCES.txt +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/dependency_links.txt +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/entry_points.txt +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/requires.txt +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/top_level.txt +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_deploy_opencode_parity.py +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story069_opencode_format.py +0 -0
- {pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story070_opencode_compliance.py +0 -0
|
@@ -113,7 +113,7 @@ class OpenCodeDeployer(DeployerBase):
|
|
|
113
113
|
if replaced != content:
|
|
114
114
|
atomic_write(cmd_md, replaced)
|
|
115
115
|
|
|
116
|
-
n_rules = _deploy_rules(opencode_root, enabled_rules)
|
|
116
|
+
n_rules = _deploy_rules(opencode_root, enabled_rules, profile=self.profile)
|
|
117
117
|
self._deploy_agents_md_inline(opencode_root)
|
|
118
118
|
|
|
119
119
|
providers = self._load_opencode_providers(opencode_root)
|
|
@@ -297,33 +297,19 @@ class OpenCodeDeployer(DeployerBase):
|
|
|
297
297
|
config["instructions"] = existing
|
|
298
298
|
|
|
299
299
|
# OpenCode auto-discovers commands from commands/*.md directory.
|
|
300
|
-
# opencode.json "command"
|
|
301
|
-
#
|
|
300
|
+
# opencode.json "command" section requires BOTH "model" AND "template" fields.
|
|
301
|
+
# Since we don't control template content (it's inline prompt text, not a file path),
|
|
302
|
+
# we must NOT write model-only entries — they cause OpenCode validation errors.
|
|
303
|
+
# Clean up any PactKit-managed command entries that lack template.
|
|
302
304
|
cmd_config = config.get("command", {})
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
for k in stale_keys:
|
|
307
|
-
del cmd_config[k]
|
|
308
|
-
# Remove legacy "template" fields (was incorrectly treated as file path)
|
|
309
|
-
for cmd_name in list(cmd_config):
|
|
310
|
-
if cmd_name.startswith("project-") and "template" in cmd_config[cmd_name]:
|
|
311
|
-
del cmd_config[cmd_name]["template"]
|
|
312
|
-
# Remove entry entirely if only template was present
|
|
313
|
-
if not cmd_config[cmd_name]:
|
|
314
|
-
del cmd_config[cmd_name]
|
|
315
|
-
|
|
316
|
-
# Apply model routing
|
|
317
|
-
if command_models and providers:
|
|
318
|
-
for cmd_name, model_short in command_models.items():
|
|
319
|
-
model_id = OpenCodeDeployer._resolve_opencode_model_id(model_short, providers)
|
|
320
|
-
if model_id:
|
|
321
|
-
if cmd_name not in cmd_config:
|
|
322
|
-
cmd_config[cmd_name] = {}
|
|
323
|
-
cmd_config[cmd_name]["model"] = model_id
|
|
305
|
+
for cmd_name in list(cmd_config):
|
|
306
|
+
if cmd_name.startswith("project-") and "template" not in cmd_config[cmd_name]:
|
|
307
|
+
del cmd_config[cmd_name]
|
|
324
308
|
|
|
325
309
|
if cmd_config:
|
|
326
310
|
config["command"] = cmd_config
|
|
311
|
+
else:
|
|
312
|
+
config.pop("command", None)
|
|
327
313
|
|
|
328
314
|
content = json.dumps(config, indent=2, ensure_ascii=False) + "\n"
|
|
329
315
|
atomic_write(json_path, content)
|
|
@@ -60,18 +60,35 @@ class TestR3ProjectInitOpencodeDetection:
|
|
|
60
60
|
"""R3: /project-init playbook must detect OpenCode environment."""
|
|
61
61
|
|
|
62
62
|
def test_project_init_contains_opencode_detection(self):
|
|
63
|
-
"""project-init.md contains OpenCode
|
|
63
|
+
"""project-init.md rendered for OpenCode contains 'OpenCode' and 'opencode'.
|
|
64
|
+
|
|
65
|
+
After STORY-slim-074 DIP refactor, the raw template uses {DISPLAY_NAME} /
|
|
66
|
+
{FORMAT_NAME} placeholders. The rendered output (via _render_prompt) is
|
|
67
|
+
what gets deployed and must contain the format-specific strings.
|
|
68
|
+
"""
|
|
69
|
+
from pactkit.generators.deployer import _render_prompt
|
|
70
|
+
from pactkit.profiles import get_profile
|
|
64
71
|
from pactkit.prompts.commands import COMMANDS_CONTENT
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
profile = get_profile("opencode")
|
|
74
|
+
content = _render_prompt(COMMANDS_CONTENT["project-init.md"], profile)
|
|
67
75
|
assert "opencode" in content.lower() or "OpenCode" in content
|
|
68
76
|
|
|
69
77
|
def test_project_init_contains_opencode_json_generation(self):
|
|
70
|
-
"""project-init.md
|
|
78
|
+
"""project-init.md template references format config via {PACTKIT_YAML} placeholder.
|
|
79
|
+
|
|
80
|
+
After STORY-slim-074 DIP refactor, opencode-specific paths are expressed as
|
|
81
|
+
template variables ({PACTKIT_YAML}, {FORMAT_NAME}) rather than hardcoded strings.
|
|
82
|
+
The rendered output for opencode will contain '.opencode/pactkit.yaml'.
|
|
83
|
+
"""
|
|
84
|
+
from pactkit.generators.deployer import _render_prompt
|
|
85
|
+
from pactkit.profiles import get_profile
|
|
71
86
|
from pactkit.prompts.commands import COMMANDS_CONTENT
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
profile = get_profile("opencode")
|
|
89
|
+
content = _render_prompt(COMMANDS_CONTENT["project-init.md"], profile)
|
|
90
|
+
# {PACTKIT_YAML} renders to '.opencode/pactkit.yaml' for opencode format
|
|
91
|
+
assert ".opencode/pactkit.yaml" in content or "pactkit.yaml" in content
|
|
75
92
|
|
|
76
93
|
|
|
77
94
|
# ===========================================================================
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story071_opencode_config_parity.py
RENAMED
|
@@ -91,16 +91,25 @@ class TestAC3PreserveFields:
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
class TestAC4PlaybookPactkitYaml:
|
|
94
|
-
"""AC4: project-init playbook explains pactkit.yaml stays in .claude
|
|
94
|
+
"""AC4: project-init playbook explains pactkit.yaml stays in .claude/ (classic) or .opencode/ (OpenCode)."""
|
|
95
95
|
|
|
96
96
|
def test_playbook_mentions_pactkit_yaml_location(self):
|
|
97
|
-
"""project-init playbook references pactkit.yaml in .claude
|
|
97
|
+
"""project-init playbook rendered for classic format references pactkit.yaml in .claude/.
|
|
98
|
+
|
|
99
|
+
After STORY-slim-074 DIP refactor, config paths are expressed as {PACTKIT_YAML} and
|
|
100
|
+
{PROJECT_CONFIG_DIR} template variables. The raw template always contains 'pactkit.yaml'
|
|
101
|
+
(as part of the {PACTKIT_YAML} placeholder), and the rendered classic output contains '.claude'.
|
|
102
|
+
"""
|
|
103
|
+
from pactkit.generators.deployer import _render_prompt
|
|
104
|
+
from pactkit.profiles import get_profile
|
|
98
105
|
from pactkit.prompts import COMMANDS_CONTENT
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
raw_content = COMMANDS_CONTENT["project-init.md"]
|
|
108
|
+
# Raw template always references pactkit.yaml via the {PACTKIT_YAML} variable name
|
|
109
|
+
assert "pactkit.yaml" in raw_content
|
|
110
|
+
# Rendered for classic: {PROJECT_CONFIG_DIR} → '.claude', {PACTKIT_YAML} → '.claude/pactkit.yaml'
|
|
111
|
+
classic_content = _render_prompt(raw_content, get_profile("classic"))
|
|
112
|
+
assert ".claude" in classic_content
|
|
104
113
|
|
|
105
114
|
|
|
106
115
|
# ===========================================================================
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story073_command_model_routing.py
RENAMED
|
@@ -40,26 +40,16 @@ class TestAC1CommandModel:
|
|
|
40
40
|
deploy(format="opencode", target=str(out))
|
|
41
41
|
return out
|
|
42
42
|
|
|
43
|
-
def
|
|
44
|
-
"""
|
|
43
|
+
def test_no_model_only_entries_in_opencode_json(self, tmp_path):
|
|
44
|
+
"""Model-only command entries must NOT be written — OpenCode requires both model AND template."""
|
|
45
45
|
out = self._deploy_with_providers(tmp_path)
|
|
46
46
|
data = json.loads((out / "opencode.json").read_text())
|
|
47
47
|
cmd_config = data.get("command", {})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"""project-done model routing is in opencode.json command section."""
|
|
54
|
-
out = self._deploy_with_providers(tmp_path)
|
|
55
|
-
data = json.loads((out / "opencode.json").read_text())
|
|
56
|
-
assert "project-done" in data.get("command", {})
|
|
57
|
-
|
|
58
|
-
def test_check_model_in_opencode_json(self, tmp_path):
|
|
59
|
-
"""project-check model routing is in opencode.json command section."""
|
|
60
|
-
out = self._deploy_with_providers(tmp_path)
|
|
61
|
-
data = json.loads((out / "opencode.json").read_text())
|
|
62
|
-
assert "project-check" in data.get("command", {})
|
|
48
|
+
for cmd_name, cmd_val in cmd_config.items():
|
|
49
|
+
if cmd_name.startswith("project-"):
|
|
50
|
+
assert "template" in cmd_val, (
|
|
51
|
+
f"command.{cmd_name} has model but no template — OpenCode validation will fail"
|
|
52
|
+
)
|
|
63
53
|
|
|
64
54
|
def test_frontmatter_has_no_model(self, tmp_path):
|
|
65
55
|
"""Command frontmatter should NOT contain model: (routing is in opencode.json)."""
|
|
@@ -137,16 +127,26 @@ class TestAC3ClassicNoModel:
|
|
|
137
127
|
|
|
138
128
|
|
|
139
129
|
class TestAC4InitConditional:
|
|
140
|
-
"""AC4: project-init
|
|
130
|
+
"""AC4: project-init rendered per-format references the correct instructions file."""
|
|
141
131
|
|
|
142
132
|
def test_init_has_conditional(self):
|
|
143
|
-
"""project-init playbook
|
|
133
|
+
"""project-init playbook rendered for OpenCode contains 'OpenCode' and 'AGENTS.md'.
|
|
134
|
+
|
|
135
|
+
After STORY-slim-074 DIP refactor, the raw template uses {DISPLAY_NAME} and
|
|
136
|
+
{INSTRUCTIONS_FILE} placeholders instead of hardcoded format-specific strings.
|
|
137
|
+
_render_prompt() injects the correct values at deploy time.
|
|
138
|
+
"""
|
|
139
|
+
from pactkit.generators.deployer import _render_prompt
|
|
140
|
+
from pactkit.profiles import get_profile
|
|
144
141
|
from pactkit.prompts import COMMANDS_CONTENT
|
|
145
142
|
|
|
146
|
-
|
|
143
|
+
profile = get_profile("opencode")
|
|
144
|
+
init_content = _render_prompt(COMMANDS_CONTENT["project-init.md"], profile)
|
|
147
145
|
assert "OpenCode" in init_content
|
|
148
146
|
assert "AGENTS.md" in init_content
|
|
149
|
-
|
|
147
|
+
# Rendered for classic: {DISPLAY_NAME} → 'Claude Code', {PROJECT_CONFIG_DIR} → '.claude'
|
|
148
|
+
classic_content = _render_prompt(COMMANDS_CONTENT["project-init.md"], get_profile("classic"))
|
|
149
|
+
assert "Claude Code" in classic_content or ".claude" in classic_content
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
# ===========================================================================
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/requires.txt
RENAMED
|
File without changes
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/src/pactkit_opencode.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pactkit_opencode-2.9.0 → pactkit_opencode-2.9.2}/tests/test_story070_opencode_compliance.py
RENAMED
|
File without changes
|