@trac3er/oh-my-god 2.0.2 → 2.0.4
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.
- package/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/.agents/skills/omg/codex-mcp.toml +4 -0
- package/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/.mcp.json +20 -4
- package/CHANGELOG.md +16 -0
- package/OMG-setup.sh +9 -3
- package/OMG_COMPAT_CONTRACT.md +92 -0
- package/README.md +26 -8
- package/SECURITY.md +6 -0
- package/commands/OMG:api-twin.md +22 -0
- package/commands/OMG:preflight.md +26 -0
- package/commands/OMG:security-check.md +28 -0
- package/commands/OMG:setup.md +1 -2
- package/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/dist/enterprise/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
- package/dist/enterprise/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/dist/enterprise/bundle/.claude-plugin/marketplace.json +36 -0
- package/dist/enterprise/bundle/.claude-plugin/plugin.json +23 -0
- package/dist/enterprise/bundle/.mcp.json +40 -0
- package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +92 -0
- package/dist/enterprise/bundle/settings.json +366 -0
- package/dist/enterprise/manifest.json +99 -0
- package/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/dist/public/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
- package/dist/public/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/dist/public/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/dist/public/bundle/.claude-plugin/marketplace.json +36 -0
- package/dist/public/bundle/.claude-plugin/plugin.json +23 -0
- package/dist/public/bundle/.mcp.json +40 -0
- package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +92 -0
- package/dist/public/bundle/settings.json +366 -0
- package/dist/public/manifest.json +99 -0
- package/hooks/policy_engine.py +38 -7
- package/hooks/post-write.py +1 -1
- package/hooks/prompt-enhancer.py +2 -2
- package/hooks/security_validators.py +75 -0
- package/hooks/setup_wizard.py +44 -20
- package/hooks/shadow_manager.py +22 -2
- package/package.json +1 -1
- package/plugins/README.md +4 -2
- package/plugins/advanced/commands/OMG:deep-plan.md +1 -1
- package/plugins/advanced/commands/OMG:security-review.md +10 -113
- package/plugins/advanced/commands/OMG:ship.md +1 -1
- package/plugins/advanced/plugin.json +1 -10
- package/plugins/core/plugin.json +25 -2
- package/pyproject.toml +1 -1
- package/runtime/adoption.py +1 -1
- package/runtime/api_twin.py +130 -0
- package/runtime/compat.py +21 -1
- package/runtime/contract_compiler.py +698 -0
- package/runtime/domain_packs.py +34 -0
- package/runtime/guide_assert.py +45 -0
- package/runtime/mcp_config_writers.py +145 -39
- package/runtime/omg_compat_contract_snapshot.json +8 -7
- package/runtime/omg_contract_snapshot.json +8 -7
- package/runtime/omg_mcp_server.py +205 -0
- package/runtime/preflight.py +52 -0
- package/runtime/providers/codex_provider.py +2 -12
- package/runtime/providers/gemini_provider.py +2 -21
- package/runtime/providers/kimi_provider.py +2 -21
- package/runtime/runtime_profile.py +61 -0
- package/runtime/security_check.py +347 -0
- package/runtime/subagent_dispatcher.py +117 -10
- package/runtime/team_router.py +3 -3
- package/runtime/untrusted_content.py +102 -0
- package/scripts/omg.py +174 -1
- package/settings.json +66 -18
- package/tools/python_repl.py +33 -3
- package/runtime/providers/opencode_provider.py +0 -144
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"""OpenCode CLI provider -- implements CLIProvider for the ``opencode`` binary."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import json
|
|
6
|
-
import logging
|
|
7
|
-
import os
|
|
8
|
-
import shlex
|
|
9
|
-
import shutil
|
|
10
|
-
import subprocess
|
|
11
|
-
import uuid
|
|
12
|
-
from typing import Any
|
|
13
|
-
|
|
14
|
-
from runtime.cli_provider import CLIProvider, register_provider
|
|
15
|
-
from runtime.tmux_session_manager import TmuxSessionManager
|
|
16
|
-
|
|
17
|
-
_logger = logging.getLogger(__name__)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class OpenCodeProvider(CLIProvider):
|
|
21
|
-
"""CLIProvider implementation for the OpenCode CLI (``opencode``)."""
|
|
22
|
-
|
|
23
|
-
# -- identity -----------------------------------------------------------
|
|
24
|
-
|
|
25
|
-
def get_name(self) -> str: # noqa: D401
|
|
26
|
-
"""Return the canonical provider name."""
|
|
27
|
-
return "opencode"
|
|
28
|
-
|
|
29
|
-
# -- detection ----------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
def detect(self) -> bool:
|
|
32
|
-
"""Return ``True`` when the ``opencode`` binary is available on PATH."""
|
|
33
|
-
return shutil.which("opencode") is not None
|
|
34
|
-
|
|
35
|
-
# -- authentication -----------------------------------------------------
|
|
36
|
-
|
|
37
|
-
def check_auth(self) -> tuple[bool | None, str]:
|
|
38
|
-
"""Check OpenCode authentication status via ``opencode auth list``."""
|
|
39
|
-
try:
|
|
40
|
-
result = self.run_tool(["opencode", "auth", "list"], timeout=30)
|
|
41
|
-
if result.returncode == 0:
|
|
42
|
-
return True, result.stdout.strip()
|
|
43
|
-
return False, result.stderr.strip() or result.stdout.strip()
|
|
44
|
-
except Exception as exc:
|
|
45
|
-
return None, f"opencode auth check failed: {exc}"
|
|
46
|
-
|
|
47
|
-
# -- invocation ---------------------------------------------------------
|
|
48
|
-
|
|
49
|
-
def invoke(self, prompt: str, project_dir: str, timeout: int = 120) -> dict[str, Any]: # pyright: ignore[reportExplicitAny]
|
|
50
|
-
"""Invoke ``opencode run`` via subprocess."""
|
|
51
|
-
try:
|
|
52
|
-
result = self.run_tool(
|
|
53
|
-
["opencode", "run", prompt],
|
|
54
|
-
timeout=timeout,
|
|
55
|
-
)
|
|
56
|
-
return {
|
|
57
|
-
"model": "opencode-cli",
|
|
58
|
-
"output": result.stdout,
|
|
59
|
-
"exit_code": result.returncode,
|
|
60
|
-
}
|
|
61
|
-
except subprocess.TimeoutExpired:
|
|
62
|
-
return {"error": "opencode-cli timeout", "fallback": "claude"}
|
|
63
|
-
except FileNotFoundError:
|
|
64
|
-
return {"error": "opencode-cli not found", "fallback": "claude"}
|
|
65
|
-
except Exception as exc:
|
|
66
|
-
return {"error": str(exc), "fallback": "claude"}
|
|
67
|
-
|
|
68
|
-
def invoke_json(self, prompt: str, project_dir: str, timeout: int = 120) -> dict[str, Any]: # pyright: ignore[reportExplicitAny]
|
|
69
|
-
"""Invoke ``opencode run --format json`` for raw JSON event stream output."""
|
|
70
|
-
try:
|
|
71
|
-
result = self.run_tool(
|
|
72
|
-
["opencode", "run", "--format", "json", prompt],
|
|
73
|
-
timeout=timeout,
|
|
74
|
-
)
|
|
75
|
-
return {
|
|
76
|
-
"model": "opencode-cli",
|
|
77
|
-
"output": result.stdout,
|
|
78
|
-
"exit_code": result.returncode,
|
|
79
|
-
}
|
|
80
|
-
except subprocess.TimeoutExpired:
|
|
81
|
-
return {"error": "opencode-cli timeout", "fallback": "claude"}
|
|
82
|
-
except FileNotFoundError:
|
|
83
|
-
return {"error": "opencode-cli not found", "fallback": "claude"}
|
|
84
|
-
except Exception as exc:
|
|
85
|
-
return {"error": str(exc), "fallback": "claude"}
|
|
86
|
-
|
|
87
|
-
def invoke_tmux(self, prompt: str, project_dir: str, timeout: int = 120) -> dict[str, Any]: # pyright: ignore[reportExplicitAny]
|
|
88
|
-
"""Invoke ``opencode run`` via a persistent tmux session.
|
|
89
|
-
|
|
90
|
-
Falls back to :meth:`invoke` on failure.
|
|
91
|
-
"""
|
|
92
|
-
try:
|
|
93
|
-
mgr = TmuxSessionManager()
|
|
94
|
-
session_name = mgr.make_session_name("opencode", unique_id=str(uuid.uuid4())[:8])
|
|
95
|
-
session = mgr.get_or_create_session(session_name)
|
|
96
|
-
output = mgr.send_command(session, f"opencode run {shlex.quote(prompt)}", timeout=timeout)
|
|
97
|
-
mgr.kill_session(session)
|
|
98
|
-
return {"model": "opencode-cli", "output": output, "exit_code": 0}
|
|
99
|
-
except Exception as exc:
|
|
100
|
-
_logger.warning("tmux opencode invocation failed, falling back to subprocess: %s", exc)
|
|
101
|
-
return self.invoke(prompt, project_dir, timeout=timeout)
|
|
102
|
-
|
|
103
|
-
# -- command helpers ----------------------------------------------------
|
|
104
|
-
|
|
105
|
-
def get_non_interactive_cmd(self, prompt: str) -> list[str]:
|
|
106
|
-
"""Return the non-interactive command for opencode."""
|
|
107
|
-
return ["opencode", "run", prompt]
|
|
108
|
-
|
|
109
|
-
# -- configuration ------------------------------------------------------
|
|
110
|
-
|
|
111
|
-
def get_config_path(self) -> str:
|
|
112
|
-
"""Return the OpenCode configuration file path."""
|
|
113
|
-
return os.path.expanduser("~/.config/opencode/opencode.json")
|
|
114
|
-
|
|
115
|
-
def write_mcp_config(self, server_url: str, server_name: str = "memory-server") -> None:
|
|
116
|
-
"""Write an MCP server entry to ``~/.config/opencode/opencode.json``.
|
|
117
|
-
|
|
118
|
-
Uses JSON format with ``mcp`` key, ``type: "remote"``, and ``url`` field,
|
|
119
|
-
merging into any existing configuration.
|
|
120
|
-
"""
|
|
121
|
-
config_path = self.get_config_path()
|
|
122
|
-
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
|
123
|
-
|
|
124
|
-
# Load existing config or start fresh
|
|
125
|
-
existing: dict[str, Any] = {} # pyright: ignore[reportExplicitAny]
|
|
126
|
-
if os.path.exists(config_path):
|
|
127
|
-
with open(config_path) as fh:
|
|
128
|
-
try:
|
|
129
|
-
existing = json.load(fh)
|
|
130
|
-
except (json.JSONDecodeError, ValueError):
|
|
131
|
-
existing = {}
|
|
132
|
-
|
|
133
|
-
# Ensure mcp dict exists
|
|
134
|
-
if "mcp" not in existing:
|
|
135
|
-
existing["mcp"] = {}
|
|
136
|
-
|
|
137
|
-
existing["mcp"][server_name] = {"type": "remote", "url": server_url}
|
|
138
|
-
|
|
139
|
-
with open(config_path, "w") as fh:
|
|
140
|
-
json.dump(existing, fh, indent=2)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
# -- auto-register on import -----------------------------------------------
|
|
144
|
-
register_provider(OpenCodeProvider())
|