@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.
Files changed (97) hide show
  1. package/.agents/skills/omg/AGENTS.fragment.md +5 -0
  2. package/.agents/skills/omg/codex-mcp.toml +4 -0
  3. package/.agents/skills/omg/control-plane/SKILL.md +11 -0
  4. package/.agents/skills/omg/control-plane/openai.yaml +14 -0
  5. package/.agents/skills/omg/hook-governor/SKILL.md +11 -0
  6. package/.agents/skills/omg/hook-governor/openai.yaml +11 -0
  7. package/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
  8. package/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
  9. package/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
  10. package/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
  11. package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
  12. package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
  13. package/.claude-plugin/marketplace.json +3 -3
  14. package/.claude-plugin/plugin.json +1 -1
  15. package/.mcp.json +20 -4
  16. package/CHANGELOG.md +16 -0
  17. package/OMG-setup.sh +9 -3
  18. package/OMG_COMPAT_CONTRACT.md +92 -0
  19. package/README.md +26 -8
  20. package/SECURITY.md +6 -0
  21. package/commands/OMG:api-twin.md +22 -0
  22. package/commands/OMG:preflight.md +26 -0
  23. package/commands/OMG:security-check.md +28 -0
  24. package/commands/OMG:setup.md +1 -2
  25. package/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
  26. package/dist/enterprise/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
  27. package/dist/enterprise/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
  28. package/dist/enterprise/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
  29. package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
  30. package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
  31. package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
  32. package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
  33. package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
  34. package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
  35. package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
  36. package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
  37. package/dist/enterprise/bundle/.claude-plugin/marketplace.json +36 -0
  38. package/dist/enterprise/bundle/.claude-plugin/plugin.json +23 -0
  39. package/dist/enterprise/bundle/.mcp.json +40 -0
  40. package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +92 -0
  41. package/dist/enterprise/bundle/settings.json +366 -0
  42. package/dist/enterprise/manifest.json +99 -0
  43. package/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
  44. package/dist/public/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
  45. package/dist/public/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
  46. package/dist/public/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
  47. package/dist/public/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
  48. package/dist/public/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
  49. package/dist/public/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
  50. package/dist/public/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
  51. package/dist/public/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
  52. package/dist/public/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
  53. package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
  54. package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
  55. package/dist/public/bundle/.claude-plugin/marketplace.json +36 -0
  56. package/dist/public/bundle/.claude-plugin/plugin.json +23 -0
  57. package/dist/public/bundle/.mcp.json +40 -0
  58. package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +92 -0
  59. package/dist/public/bundle/settings.json +366 -0
  60. package/dist/public/manifest.json +99 -0
  61. package/hooks/policy_engine.py +38 -7
  62. package/hooks/post-write.py +1 -1
  63. package/hooks/prompt-enhancer.py +2 -2
  64. package/hooks/security_validators.py +75 -0
  65. package/hooks/setup_wizard.py +44 -20
  66. package/hooks/shadow_manager.py +22 -2
  67. package/package.json +1 -1
  68. package/plugins/README.md +4 -2
  69. package/plugins/advanced/commands/OMG:deep-plan.md +1 -1
  70. package/plugins/advanced/commands/OMG:security-review.md +10 -113
  71. package/plugins/advanced/commands/OMG:ship.md +1 -1
  72. package/plugins/advanced/plugin.json +1 -10
  73. package/plugins/core/plugin.json +25 -2
  74. package/pyproject.toml +1 -1
  75. package/runtime/adoption.py +1 -1
  76. package/runtime/api_twin.py +130 -0
  77. package/runtime/compat.py +21 -1
  78. package/runtime/contract_compiler.py +698 -0
  79. package/runtime/domain_packs.py +34 -0
  80. package/runtime/guide_assert.py +45 -0
  81. package/runtime/mcp_config_writers.py +145 -39
  82. package/runtime/omg_compat_contract_snapshot.json +8 -7
  83. package/runtime/omg_contract_snapshot.json +8 -7
  84. package/runtime/omg_mcp_server.py +205 -0
  85. package/runtime/preflight.py +52 -0
  86. package/runtime/providers/codex_provider.py +2 -12
  87. package/runtime/providers/gemini_provider.py +2 -21
  88. package/runtime/providers/kimi_provider.py +2 -21
  89. package/runtime/runtime_profile.py +61 -0
  90. package/runtime/security_check.py +347 -0
  91. package/runtime/subagent_dispatcher.py +117 -10
  92. package/runtime/team_router.py +3 -3
  93. package/runtime/untrusted_content.py +102 -0
  94. package/scripts/omg.py +174 -1
  95. package/settings.json +66 -18
  96. package/tools/python_repl.py +33 -3
  97. 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())