@trac3er/oh-my-god 1.0.2
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/.claude-plugin/marketplace.json +36 -0
- package/.claude-plugin/plugin.json +23 -0
- package/.claude-plugin/scripts/install.sh +49 -0
- package/.claude-plugin/scripts/uninstall.sh +80 -0
- package/.claude-plugin/scripts/update.sh +84 -0
- package/.mcp.json +20 -0
- package/LICENSE +21 -0
- package/OMG-setup.sh +1093 -0
- package/README.md +335 -0
- package/THIRD_PARTY_NOTICES.md +24 -0
- package/UPSTREAM_DIFF.md +20 -0
- package/agents/__init__.py +1 -0
- package/agents/_model_roles.yaml +26 -0
- package/agents/designer.md +67 -0
- package/agents/explore.md +60 -0
- package/agents/model_roles.py +196 -0
- package/agents/omg-api-builder.md +23 -0
- package/agents/omg-architect-mode.md +43 -0
- package/agents/omg-architect.md +13 -0
- package/agents/omg-backend-engineer.md +43 -0
- package/agents/omg-critic.md +16 -0
- package/agents/omg-database-engineer.md +43 -0
- package/agents/omg-escalation-router.md +17 -0
- package/agents/omg-executor.md +12 -0
- package/agents/omg-frontend-designer.md +42 -0
- package/agents/omg-implement-mode.md +50 -0
- package/agents/omg-infra-engineer.md +43 -0
- package/agents/omg-qa-tester.md +16 -0
- package/agents/omg-research-mode.md +43 -0
- package/agents/omg-security-auditor.md +43 -0
- package/agents/omg-testing-engineer.md +43 -0
- package/agents/plan.md +80 -0
- package/agents/quick_task.md +64 -0
- package/agents/reviewer.md +83 -0
- package/agents/task.md +71 -0
- package/commands/OMG:ccg.md +22 -0
- package/commands/OMG:compat.md +57 -0
- package/commands/OMG:crazy.md +125 -0
- package/commands/OMG:domain-init.md +11 -0
- package/commands/OMG:escalate.md +52 -0
- package/commands/OMG:health-check.md +45 -0
- package/commands/OMG:init.md +134 -0
- package/commands/OMG:mode.md +44 -0
- package/commands/OMG:project-init.md +11 -0
- package/commands/OMG:ralph-start.md +43 -0
- package/commands/OMG:ralph-stop.md +23 -0
- package/commands/OMG:teams.md +39 -0
- package/commands/ai-commit.md +113 -0
- package/commands/ccg.md +9 -0
- package/commands/create-agent.md +183 -0
- package/commands/omc-teams.md +9 -0
- package/commands/session-branch.md +85 -0
- package/commands/session-fork.md +53 -0
- package/commands/session-merge.md +134 -0
- package/commands/theme.md +44 -0
- package/config/lsp_languages.yaml +324 -0
- package/config/themes/catppuccin-frappe.yaml +14 -0
- package/config/themes/catppuccin-latte.yaml +14 -0
- package/config/themes/catppuccin-macchiato.yaml +14 -0
- package/config/themes/catppuccin-mocha.yaml +14 -0
- package/config/themes/dracula.yaml +14 -0
- package/config/themes/gruvbox-dark.yaml +14 -0
- package/config/themes/nord.yaml +14 -0
- package/config/themes/one-dark.yaml +14 -0
- package/config/themes/solarized-dark.yaml +14 -0
- package/config/themes/tokyo-night.yaml +14 -0
- package/control_plane/__init__.py +2 -0
- package/control_plane/openapi.yaml +109 -0
- package/control_plane/server.py +107 -0
- package/control_plane/service.py +148 -0
- package/crates/omg-natives/Cargo.toml +17 -0
- package/crates/omg-natives/src/clipboard.rs +5 -0
- package/crates/omg-natives/src/glob.rs +15 -0
- package/crates/omg-natives/src/grep.rs +15 -0
- package/crates/omg-natives/src/highlight.rs +15 -0
- package/crates/omg-natives/src/html.rs +14 -0
- package/crates/omg-natives/src/image.rs +5 -0
- package/crates/omg-natives/src/keys.rs +5 -0
- package/crates/omg-natives/src/lib.rs +36 -0
- package/crates/omg-natives/src/prof.rs +5 -0
- package/crates/omg-natives/src/ps.rs +5 -0
- package/crates/omg-natives/src/shell.rs +5 -0
- package/crates/omg-natives/src/task.rs +5 -0
- package/crates/omg-natives/src/text.rs +14 -0
- package/hooks/_agent_registry.py +421 -0
- package/hooks/_budget.py +31 -0
- package/hooks/_common.py +476 -0
- package/hooks/_learnings.py +126 -0
- package/hooks/_memory.py +103 -0
- package/hooks/circuit-breaker.py +270 -0
- package/hooks/config-guard.py +163 -0
- package/hooks/context_pressure.py +53 -0
- package/hooks/credential_store.py +801 -0
- package/hooks/fetch-rate-limits.py +212 -0
- package/hooks/firewall.py +48 -0
- package/hooks/hashline-formatter-bridge.py +224 -0
- package/hooks/hashline-injector.py +273 -0
- package/hooks/hashline-validator.py +216 -0
- package/hooks/idle-detector.py +95 -0
- package/hooks/intentgate-keyword-detector.py +188 -0
- package/hooks/magic-keyword-router.py +195 -0
- package/hooks/policy_engine.py +310 -0
- package/hooks/post-tool-failure.py +19 -0
- package/hooks/post-write.py +199 -0
- package/hooks/pre-compact.py +204 -0
- package/hooks/pre-tool-inject.py +98 -0
- package/hooks/prompt-enhancer.py +672 -0
- package/hooks/quality-runner.py +191 -0
- package/hooks/secret-guard.py +47 -0
- package/hooks/session-end-capture.py +137 -0
- package/hooks/session-start.py +275 -0
- package/hooks/shadow_manager.py +297 -0
- package/hooks/state_migration.py +209 -0
- package/hooks/stop-gate.py +7 -0
- package/hooks/stop_dispatcher.py +929 -0
- package/hooks/test-validator.py +138 -0
- package/hooks/todo-state-tracker.py +114 -0
- package/hooks/tool-ledger.py +126 -0
- package/hooks/trust_review.py +524 -0
- package/install.sh +9 -0
- package/omg_natives/__init__.py +186 -0
- package/omg_natives/_bindings.py +165 -0
- package/omg_natives/clipboard.py +36 -0
- package/omg_natives/glob.py +42 -0
- package/omg_natives/grep.py +61 -0
- package/omg_natives/highlight.py +54 -0
- package/omg_natives/html.py +157 -0
- package/omg_natives/image.py +51 -0
- package/omg_natives/keys.py +46 -0
- package/omg_natives/prof.py +39 -0
- package/omg_natives/ps.py +93 -0
- package/omg_natives/shell.py +58 -0
- package/omg_natives/task.py +41 -0
- package/omg_natives/text.py +50 -0
- package/package.json +26 -0
- package/plugins/README.md +82 -0
- package/plugins/advanced/commands/OMG:code-review.md +114 -0
- package/plugins/advanced/commands/OMG:deep-plan.md +221 -0
- package/plugins/advanced/commands/OMG:handoff.md +115 -0
- package/plugins/advanced/commands/OMG:learn.md +110 -0
- package/plugins/advanced/commands/OMG:maintainer.md +31 -0
- package/plugins/advanced/commands/OMG:ralph-start.md +43 -0
- package/plugins/advanced/commands/OMG:ralph-stop.md +23 -0
- package/plugins/advanced/commands/OMG:security-review.md +119 -0
- package/plugins/advanced/commands/OMG:sequential-thinking.md +20 -0
- package/plugins/advanced/commands/OMG:ship.md +46 -0
- package/plugins/advanced/plugin.json +96 -0
- package/plugins/core/plugin.json +82 -0
- package/pytest.ini +5 -0
- package/registry/__init__.py +1 -0
- package/registry/verify_artifact.py +90 -0
- package/rules/contextual/architect-mode.md +9 -0
- package/rules/contextual/big-picture.md +20 -0
- package/rules/contextual/code-hygiene.md +26 -0
- package/rules/contextual/context-management.md +19 -0
- package/rules/contextual/context-minimization.md +32 -0
- package/rules/contextual/ddd-sdd.md +28 -0
- package/rules/contextual/dependency-safety.md +16 -0
- package/rules/contextual/doc-check.md +13 -0
- package/rules/contextual/implement-mode.md +9 -0
- package/rules/contextual/infra-safety.md +14 -0
- package/rules/contextual/outside-in.md +13 -0
- package/rules/contextual/persistent-mode.md +24 -0
- package/rules/contextual/research-mode.md +9 -0
- package/rules/contextual/security-domains.md +25 -0
- package/rules/contextual/vision-detection.md +27 -0
- package/rules/contextual/web-search.md +25 -0
- package/rules/contextual/write-verify.md +23 -0
- package/rules/core/00-truth.md +20 -0
- package/rules/core/01-surgical.md +19 -0
- package/rules/core/02-circuit-breaker.md +22 -0
- package/rules/core/03-ensemble.md +28 -0
- package/rules/core/04-testing.md +30 -0
- package/runtime/__init__.py +32 -0
- package/runtime/adapters/__init__.py +13 -0
- package/runtime/adapters/claude.py +60 -0
- package/runtime/adapters/gpt.py +53 -0
- package/runtime/adapters/local.py +53 -0
- package/runtime/business_workflow.py +220 -0
- package/runtime/compat.py +1299 -0
- package/runtime/custom_agent_loader.py +366 -0
- package/runtime/dispatcher.py +47 -0
- package/runtime/ecosystem.py +371 -0
- package/runtime/legacy_compat.py +7 -0
- package/runtime/omc_compat.py +7 -0
- package/runtime/omc_contract_snapshot.json +916 -0
- package/runtime/omg_compat_contract_snapshot.json +916 -0
- package/runtime/subagent_dispatcher.py +362 -0
- package/runtime/team_router.py +838 -0
- package/scripts/check-omc-contract-snapshot.py +12 -0
- package/scripts/check-omg-compat-contract-snapshot.py +137 -0
- package/scripts/check-omg-standalone-clean.py +102 -0
- package/scripts/legacy_to_omg_migrate.py +29 -0
- package/scripts/migrate-omc.py +464 -0
- package/scripts/omc_to_omg_migrate.py +12 -0
- package/scripts/omg.py +493 -0
- package/scripts/settings-merge.py +224 -0
- package/scripts/verify-no-omc.sh +5 -0
- package/scripts/verify-standalone.sh +21 -0
- package/templates/idea.yml +30 -0
- package/templates/policy.yaml +15 -0
- package/templates/profile.yaml +25 -0
- package/templates/runtime.yaml +12 -0
- package/templates/working-memory.md +17 -0
- package/tools/__init__.py +2 -0
- package/tools/browser_consent.py +289 -0
- package/tools/browser_stealth.py +481 -0
- package/tools/browser_tool.py +448 -0
- package/tools/changelog_generator.py +268 -0
- package/tools/commit_splitter.py +361 -0
- package/tools/config_discovery.py +151 -0
- package/tools/config_merger.py +449 -0
- package/tools/git_inspector.py +298 -0
- package/tools/lsp_client.py +275 -0
- package/tools/lsp_discovery.py +231 -0
- package/tools/lsp_operations.py +392 -0
- package/tools/python_repl.py +656 -0
- package/tools/python_sandbox.py +609 -0
- package/tools/search_providers/__init__.py +77 -0
- package/tools/search_providers/brave.py +115 -0
- package/tools/search_providers/exa.py +116 -0
- package/tools/search_providers/jina.py +104 -0
- package/tools/search_providers/perplexity.py +139 -0
- package/tools/search_providers/synthetic.py +74 -0
- package/tools/session_snapshot.py +736 -0
- package/tools/ssh_manager.py +912 -0
- package/tools/theme_engine.py +294 -0
- package/tools/theme_selector.py +137 -0
- package/tools/web_search.py +622 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""OMG Natives — html: HTML→Markdown and HTML→text conversion.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback for HTML processing.
|
|
4
|
+
Uses ``re`` only — avoids importing stdlib ``html`` to prevent circular
|
|
5
|
+
import issues (this file is named ``html.py`` which shadows the stdlib).
|
|
6
|
+
|
|
7
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import re
|
|
13
|
+
from typing import Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
from omg_natives._bindings import bind_function
|
|
16
|
+
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
# Minimal HTML entity unescaping (avoids importing stdlib html module)
|
|
19
|
+
# ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
_ENTITIES: Dict[str, str] = {
|
|
22
|
+
"&": "&",
|
|
23
|
+
"<": "<",
|
|
24
|
+
">": ">",
|
|
25
|
+
""": '"',
|
|
26
|
+
"'": "'",
|
|
27
|
+
"'": "'",
|
|
28
|
+
" ": " ",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_NUMERIC_ENTITY_RE = re.compile(r"&#x([0-9a-fA-F]+);|&#(\d+);")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _unescape(text: str) -> str:
|
|
35
|
+
"""Minimal HTML entity unescaping."""
|
|
36
|
+
for entity, char in _ENTITIES.items():
|
|
37
|
+
text = text.replace(entity, char)
|
|
38
|
+
|
|
39
|
+
def _replace_numeric(m: re.Match) -> str:
|
|
40
|
+
hex_val, dec_val = m.group(1), m.group(2)
|
|
41
|
+
try:
|
|
42
|
+
if hex_val:
|
|
43
|
+
return chr(int(hex_val, 16))
|
|
44
|
+
if dec_val:
|
|
45
|
+
return chr(int(dec_val))
|
|
46
|
+
except (ValueError, OverflowError):
|
|
47
|
+
pass
|
|
48
|
+
return m.group(0)
|
|
49
|
+
|
|
50
|
+
return _NUMERIC_ENTITY_RE.sub(_replace_numeric, text)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# ---------------------------------------------------------------------------
|
|
54
|
+
# Regex-based HTML→Markdown converter (avoids stdlib html.parser)
|
|
55
|
+
# ---------------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
_TAG_RE = re.compile(r"<(/?)(\w+)([^>]*)(/?)>", re.DOTALL)
|
|
58
|
+
_ATTR_RE = re.compile(r'(\w+)\s*=\s*["\']([^"\']*)["\']')
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _html_to_markdown(content: str) -> str:
|
|
62
|
+
"""Convert basic HTML to Markdown using regex."""
|
|
63
|
+
parts: List[str] = []
|
|
64
|
+
last_end = 0
|
|
65
|
+
pending_href: Optional[str] = None
|
|
66
|
+
|
|
67
|
+
for m in _TAG_RE.finditer(content):
|
|
68
|
+
text_before = content[last_end:m.start()]
|
|
69
|
+
if text_before:
|
|
70
|
+
parts.append(text_before)
|
|
71
|
+
last_end = m.end()
|
|
72
|
+
|
|
73
|
+
is_closing = m.group(1) == "/"
|
|
74
|
+
tag = m.group(2).lower()
|
|
75
|
+
attrs_str = m.group(3)
|
|
76
|
+
|
|
77
|
+
if not is_closing:
|
|
78
|
+
if tag in ("h1", "h2", "h3", "h4", "h5", "h6"):
|
|
79
|
+
level = int(tag[1])
|
|
80
|
+
parts.append("\n" + "#" * level + " ")
|
|
81
|
+
elif tag == "p":
|
|
82
|
+
parts.append("\n\n")
|
|
83
|
+
elif tag == "br":
|
|
84
|
+
parts.append("\n")
|
|
85
|
+
elif tag in ("strong", "b"):
|
|
86
|
+
parts.append("**")
|
|
87
|
+
elif tag in ("em", "i"):
|
|
88
|
+
parts.append("*")
|
|
89
|
+
elif tag == "a":
|
|
90
|
+
attrs = dict(_ATTR_RE.findall(attrs_str))
|
|
91
|
+
pending_href = attrs.get("href", "")
|
|
92
|
+
parts.append("[")
|
|
93
|
+
elif tag == "li":
|
|
94
|
+
parts.append("\n- ")
|
|
95
|
+
elif tag in ("ul", "ol"):
|
|
96
|
+
parts.append("\n")
|
|
97
|
+
elif tag == "code":
|
|
98
|
+
parts.append("`")
|
|
99
|
+
elif tag == "pre":
|
|
100
|
+
parts.append("\n```\n")
|
|
101
|
+
elif tag == "blockquote":
|
|
102
|
+
parts.append("\n> ")
|
|
103
|
+
elif tag == "hr":
|
|
104
|
+
parts.append("\n---\n")
|
|
105
|
+
else:
|
|
106
|
+
if tag in ("h1", "h2", "h3", "h4", "h5", "h6"):
|
|
107
|
+
parts.append("\n")
|
|
108
|
+
elif tag == "p":
|
|
109
|
+
parts.append("\n")
|
|
110
|
+
elif tag in ("strong", "b"):
|
|
111
|
+
parts.append("**")
|
|
112
|
+
elif tag in ("em", "i"):
|
|
113
|
+
parts.append("*")
|
|
114
|
+
elif tag == "a":
|
|
115
|
+
parts.append(f"]({pending_href or ''})")
|
|
116
|
+
pending_href = None
|
|
117
|
+
elif tag == "code":
|
|
118
|
+
parts.append("`")
|
|
119
|
+
elif tag == "pre":
|
|
120
|
+
parts.append("\n```\n")
|
|
121
|
+
|
|
122
|
+
if last_end < len(content):
|
|
123
|
+
parts.append(content[last_end:])
|
|
124
|
+
|
|
125
|
+
return "".join(parts).strip()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# ---------------------------------------------------------------------------
|
|
129
|
+
# Public API
|
|
130
|
+
# ---------------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def html(content: str, operation: str = "to_text") -> str:
|
|
134
|
+
"""Process HTML content.
|
|
135
|
+
|
|
136
|
+
Operations:
|
|
137
|
+
|
|
138
|
+
- ``"to_text"``: strip all HTML tags, return plain text.
|
|
139
|
+
- ``"to_markdown"``: convert basic HTML to Markdown
|
|
140
|
+
(h1→#, h2→##, p→newline, a→[text](href), strong→**, em→*).
|
|
141
|
+
"""
|
|
142
|
+
if operation == "to_text":
|
|
143
|
+
text = re.sub(r"<[^>]+>", "", content)
|
|
144
|
+
return _unescape(text).strip()
|
|
145
|
+
elif operation == "to_markdown":
|
|
146
|
+
return _html_to_markdown(content)
|
|
147
|
+
else:
|
|
148
|
+
return content
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Self-register with the global binding registry
|
|
152
|
+
bind_function(
|
|
153
|
+
name="html",
|
|
154
|
+
rust_symbol="omg_natives::html::html",
|
|
155
|
+
python_fallback=html,
|
|
156
|
+
type_hints={"content": "str", "operation": "str"},
|
|
157
|
+
)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""OMG Natives — image: image file info via stdlib.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback for image file metadata retrieval.
|
|
4
|
+
Uses ``os.path`` and ``pathlib`` — no PIL/Pillow dependency.
|
|
5
|
+
|
|
6
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
from omg_natives._bindings import bind_function
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def image(path: str, operation: str = "info") -> dict:
|
|
18
|
+
"""Get image file information.
|
|
19
|
+
|
|
20
|
+
Operations:
|
|
21
|
+
|
|
22
|
+
- ``"info"``: returns ``{"path": str, "size_bytes": int, "exists": bool, "extension": str}``
|
|
23
|
+
|
|
24
|
+
No PIL/Pillow dependency — stdlib only.
|
|
25
|
+
"""
|
|
26
|
+
if operation == "info":
|
|
27
|
+
p = Path(path)
|
|
28
|
+
exists = p.exists()
|
|
29
|
+
size_bytes = 0
|
|
30
|
+
if exists:
|
|
31
|
+
try:
|
|
32
|
+
size_bytes = os.path.getsize(path)
|
|
33
|
+
except OSError:
|
|
34
|
+
pass
|
|
35
|
+
return {
|
|
36
|
+
"path": str(p),
|
|
37
|
+
"size_bytes": size_bytes,
|
|
38
|
+
"exists": exists,
|
|
39
|
+
"extension": p.suffix,
|
|
40
|
+
}
|
|
41
|
+
else:
|
|
42
|
+
return {"path": path, "size_bytes": 0, "exists": False, "extension": ""}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Self-register with the global binding registry
|
|
46
|
+
bind_function(
|
|
47
|
+
name="image",
|
|
48
|
+
rust_symbol="omg_natives::image::image",
|
|
49
|
+
python_fallback=image,
|
|
50
|
+
type_hints={"path": "str", "operation": "str"},
|
|
51
|
+
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""OMG Natives — keys: keyboard protocol stubs.
|
|
2
|
+
|
|
3
|
+
Pure-Python stub for keyboard key listing and encoding.
|
|
4
|
+
No actual keyboard interaction — returns static data.
|
|
5
|
+
|
|
6
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from typing import List
|
|
12
|
+
|
|
13
|
+
from omg_natives._bindings import bind_function
|
|
14
|
+
|
|
15
|
+
# Common key names for the stub
|
|
16
|
+
_COMMON_KEYS: List[str] = [
|
|
17
|
+
"Enter", "Escape", "Tab", "Backspace", "Delete",
|
|
18
|
+
"ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight",
|
|
19
|
+
"Home", "End", "PageUp", "PageDown",
|
|
20
|
+
"F1", "F2", "F3", "F4", "F5", "F6",
|
|
21
|
+
"F7", "F8", "F9", "F10", "F11", "F12",
|
|
22
|
+
"Space", "Insert", "PrintScreen", "ScrollLock", "Pause",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def keys(operation: str = "list") -> list[str]:
|
|
27
|
+
"""Keyboard protocol stubs.
|
|
28
|
+
|
|
29
|
+
- ``"list"``: returns a list of common key names.
|
|
30
|
+
- ``"encode"``: returns an empty list (stub).
|
|
31
|
+
"""
|
|
32
|
+
if operation == "list":
|
|
33
|
+
return list(_COMMON_KEYS)
|
|
34
|
+
elif operation == "encode":
|
|
35
|
+
return []
|
|
36
|
+
else:
|
|
37
|
+
return []
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Self-register with the global binding registry
|
|
41
|
+
bind_function(
|
|
42
|
+
name="keys",
|
|
43
|
+
rust_symbol="omg_natives::keys::keys",
|
|
44
|
+
python_fallback=keys,
|
|
45
|
+
type_hints={"operation": "str"},
|
|
46
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""OMG Natives — prof: profiling wrapper.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback for simple function profiling.
|
|
4
|
+
Uses ``time.perf_counter`` for high-resolution timing.
|
|
5
|
+
|
|
6
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import time
|
|
12
|
+
from typing import Any, Callable
|
|
13
|
+
|
|
14
|
+
from omg_natives._bindings import bind_function
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def prof(fn: Callable[..., Any], *args: Any, **kwargs: Any) -> dict:
|
|
18
|
+
"""Profile the execution of *fn(*args, **kwargs)*.
|
|
19
|
+
|
|
20
|
+
Returns ``{"result": value, "elapsed_ms": float, "error": None}`` on success,
|
|
21
|
+
or ``{"result": None, "elapsed_ms": float, "error": str}`` on failure.
|
|
22
|
+
"""
|
|
23
|
+
start = time.perf_counter()
|
|
24
|
+
try:
|
|
25
|
+
result = fn(*args, **kwargs)
|
|
26
|
+
elapsed = (time.perf_counter() - start) * 1000.0
|
|
27
|
+
return {"result": result, "elapsed_ms": elapsed, "error": None}
|
|
28
|
+
except Exception as exc:
|
|
29
|
+
elapsed = (time.perf_counter() - start) * 1000.0
|
|
30
|
+
return {"result": None, "elapsed_ms": elapsed, "error": str(exc)}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Self-register with the global binding registry
|
|
34
|
+
bind_function(
|
|
35
|
+
name="prof",
|
|
36
|
+
rust_symbol="omg_natives::prof::prof",
|
|
37
|
+
python_fallback=prof,
|
|
38
|
+
type_hints={"fn": "callable"},
|
|
39
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""OMG Natives — ps: process listing.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback for process listing.
|
|
4
|
+
Uses ``os`` module — reads ``/proc`` on Linux, falls back to
|
|
5
|
+
``os.getpid()`` / ``os.getppid()`` on other platforms.
|
|
6
|
+
|
|
7
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
from typing import List
|
|
15
|
+
|
|
16
|
+
from omg_natives._bindings import bind_function
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def ps() -> list[dict]:
|
|
20
|
+
"""Return a list of process info dicts.
|
|
21
|
+
|
|
22
|
+
Each dict contains ``{"pid": int, "name": str, "status": str}``.
|
|
23
|
+
|
|
24
|
+
On Linux, reads ``/proc`` for process data. On other platforms,
|
|
25
|
+
returns at minimum the current process and parent process.
|
|
26
|
+
"""
|
|
27
|
+
processes: List[dict] = []
|
|
28
|
+
|
|
29
|
+
if sys.platform == "linux" and os.path.isdir("/proc"):
|
|
30
|
+
try:
|
|
31
|
+
for entry in os.listdir("/proc"):
|
|
32
|
+
if not entry.isdigit():
|
|
33
|
+
continue
|
|
34
|
+
pid = int(entry)
|
|
35
|
+
name = _read_proc_name(pid)
|
|
36
|
+
status = _read_proc_status(pid)
|
|
37
|
+
processes.append({"pid": pid, "name": name, "status": status})
|
|
38
|
+
except OSError:
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
# Always include at least the current and parent process
|
|
42
|
+
if not processes:
|
|
43
|
+
processes.append({
|
|
44
|
+
"pid": os.getpid(),
|
|
45
|
+
"name": _get_current_process_name(),
|
|
46
|
+
"status": "running",
|
|
47
|
+
})
|
|
48
|
+
ppid = os.getppid()
|
|
49
|
+
if ppid > 0:
|
|
50
|
+
processes.append({
|
|
51
|
+
"pid": ppid,
|
|
52
|
+
"name": "parent",
|
|
53
|
+
"status": "running",
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return processes
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _read_proc_name(pid: int) -> str:
|
|
60
|
+
"""Read the process name from /proc/<pid>/comm."""
|
|
61
|
+
try:
|
|
62
|
+
with open(f"/proc/{pid}/comm", "r") as f:
|
|
63
|
+
return f.read().strip()
|
|
64
|
+
except OSError:
|
|
65
|
+
return "unknown"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _read_proc_status(pid: int) -> str:
|
|
69
|
+
"""Read the process status from /proc/<pid>/status."""
|
|
70
|
+
try:
|
|
71
|
+
with open(f"/proc/{pid}/status", "r") as f:
|
|
72
|
+
for line in f:
|
|
73
|
+
if line.startswith("State:"):
|
|
74
|
+
return line.split(":", 1)[1].strip().split()[0]
|
|
75
|
+
except OSError:
|
|
76
|
+
pass
|
|
77
|
+
return "unknown"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _get_current_process_name() -> str:
|
|
81
|
+
"""Get the current process name."""
|
|
82
|
+
try:
|
|
83
|
+
return os.path.basename(sys.executable)
|
|
84
|
+
except Exception:
|
|
85
|
+
return "python"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Self-register with the global binding registry
|
|
89
|
+
bind_function(
|
|
90
|
+
name="ps",
|
|
91
|
+
rust_symbol="omg_natives::ps::ps",
|
|
92
|
+
python_fallback=ps,
|
|
93
|
+
)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""OMG Natives — shell: subprocess execution.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback for subprocess execution.
|
|
4
|
+
Uses ``subprocess.run`` with capture and timeout support.
|
|
5
|
+
|
|
6
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import subprocess
|
|
12
|
+
|
|
13
|
+
from omg_natives._bindings import bind_function
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def shell(cmd: str, timeout: int = 30) -> dict:
|
|
17
|
+
"""Execute *cmd* in a subprocess shell.
|
|
18
|
+
|
|
19
|
+
Returns ``{"stdout": str, "stderr": str, "returncode": int, "success": bool}``.
|
|
20
|
+
On timeout or other errors, ``returncode`` is ``-1`` and ``success`` is ``False``.
|
|
21
|
+
"""
|
|
22
|
+
try:
|
|
23
|
+
result = subprocess.run(
|
|
24
|
+
cmd,
|
|
25
|
+
shell=True,
|
|
26
|
+
capture_output=True,
|
|
27
|
+
text=True,
|
|
28
|
+
timeout=timeout,
|
|
29
|
+
)
|
|
30
|
+
return {
|
|
31
|
+
"stdout": result.stdout,
|
|
32
|
+
"stderr": result.stderr,
|
|
33
|
+
"returncode": result.returncode,
|
|
34
|
+
"success": result.returncode == 0,
|
|
35
|
+
}
|
|
36
|
+
except subprocess.TimeoutExpired:
|
|
37
|
+
return {
|
|
38
|
+
"stdout": "",
|
|
39
|
+
"stderr": f"Command timed out after {timeout}s",
|
|
40
|
+
"returncode": -1,
|
|
41
|
+
"success": False,
|
|
42
|
+
}
|
|
43
|
+
except OSError as exc:
|
|
44
|
+
return {
|
|
45
|
+
"stdout": "",
|
|
46
|
+
"stderr": str(exc),
|
|
47
|
+
"returncode": -1,
|
|
48
|
+
"success": False,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Self-register with the global binding registry
|
|
53
|
+
bind_function(
|
|
54
|
+
name="shell",
|
|
55
|
+
rust_symbol="omg_natives::shell::shell",
|
|
56
|
+
python_fallback=shell,
|
|
57
|
+
type_hints={"cmd": "str", "timeout": "int"},
|
|
58
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""OMG Natives — task: concurrent.futures thread pool execution.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback using ``concurrent.futures.ThreadPoolExecutor``
|
|
4
|
+
for running callables in a background thread with timeout support.
|
|
5
|
+
|
|
6
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from concurrent.futures import ThreadPoolExecutor, TimeoutError as FuturesTimeoutError
|
|
12
|
+
from typing import Any, Callable
|
|
13
|
+
|
|
14
|
+
from omg_natives._bindings import bind_function
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def task_run(fn: Callable[..., Any], *args: Any, timeout: float = 30.0) -> dict:
|
|
18
|
+
"""Run *fn(*args)* in a ``ThreadPoolExecutor``.
|
|
19
|
+
|
|
20
|
+
Returns ``{"result": value, "error": None}`` on success,
|
|
21
|
+
or ``{"result": None, "error": str}`` on failure.
|
|
22
|
+
"""
|
|
23
|
+
try:
|
|
24
|
+
with ThreadPoolExecutor(max_workers=1) as executor:
|
|
25
|
+
future = executor.submit(fn, *args)
|
|
26
|
+
result = future.result(timeout=timeout)
|
|
27
|
+
return {"result": result, "error": None}
|
|
28
|
+
except FuturesTimeoutError:
|
|
29
|
+
return {"result": None, "error": f"Task timed out after {timeout}s"}
|
|
30
|
+
except Exception as exc:
|
|
31
|
+
return {"result": None, "error": str(exc)}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# Self-register with the global binding registry
|
|
35
|
+
# Note: function is 'task_run' to avoid shadowing Python's 'task' concept
|
|
36
|
+
bind_function(
|
|
37
|
+
name="task_run",
|
|
38
|
+
rust_symbol="omg_natives::task::task_run",
|
|
39
|
+
python_fallback=task_run,
|
|
40
|
+
type_hints={"fn": "callable", "timeout": "float"},
|
|
41
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""OMG Natives — text: ANSI-aware text operations.
|
|
2
|
+
|
|
3
|
+
Pure-Python fallback for text normalization, ANSI stripping, and counting.
|
|
4
|
+
Uses ``re`` for ANSI escape code removal.
|
|
5
|
+
|
|
6
|
+
Feature flag: ``OMG_RUST_ENGINE_ENABLED`` (default: False)
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import re
|
|
12
|
+
|
|
13
|
+
from omg_natives._bindings import bind_function
|
|
14
|
+
|
|
15
|
+
# ANSI escape code pattern (covers CSI sequences, OSC, etc.)
|
|
16
|
+
_ANSI_RE = re.compile(r"\x1b\[[0-9;]*[a-zA-Z]|\x1b\].*?\x07|\x1b[^[\]()]")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def text(content: str, operation: str = "normalize") -> str:
|
|
20
|
+
"""Perform text operations on *content*.
|
|
21
|
+
|
|
22
|
+
Supported operations:
|
|
23
|
+
|
|
24
|
+
- ``"normalize"``: strip ANSI codes and normalize whitespace
|
|
25
|
+
- ``"strip_ansi"``: remove ANSI escape codes only
|
|
26
|
+
- ``"word_count"``: return word count as a string
|
|
27
|
+
- ``"line_count"``: return line count as a string
|
|
28
|
+
"""
|
|
29
|
+
if operation == "strip_ansi":
|
|
30
|
+
return _ANSI_RE.sub("", content)
|
|
31
|
+
elif operation == "normalize":
|
|
32
|
+
stripped = _ANSI_RE.sub("", content)
|
|
33
|
+
# Normalize whitespace: collapse runs, strip leading/trailing
|
|
34
|
+
return " ".join(stripped.split())
|
|
35
|
+
elif operation == "word_count":
|
|
36
|
+
clean = _ANSI_RE.sub("", content)
|
|
37
|
+
return str(len(clean.split()))
|
|
38
|
+
elif operation == "line_count":
|
|
39
|
+
return str(content.count("\n") + (1 if content and not content.endswith("\n") else 0))
|
|
40
|
+
else:
|
|
41
|
+
return content
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Self-register with the global binding registry
|
|
45
|
+
bind_function(
|
|
46
|
+
name="text",
|
|
47
|
+
rust_symbol="omg_natives::text::text",
|
|
48
|
+
python_fallback=text,
|
|
49
|
+
type_hints={"content": "str", "operation": "str"},
|
|
50
|
+
)
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trac3er/oh-my-god",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "OAL (Orchestration Abstraction Layer) — Multi-agent orchestration, intelligent model routing, and durable session state for Claude Code",
|
|
5
|
+
"main": "OMG-setup.sh",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"install": "./OMG-setup.sh install",
|
|
8
|
+
"update": "./OMG-setup.sh update",
|
|
9
|
+
"uninstall": "./OMG-setup.sh uninstall",
|
|
10
|
+
"test": "python3 -m pytest tests/ -x -q"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["claude", "claude-code", "orchestration", "multi-agent", "ai", "llm", "codex", "gemini"],
|
|
13
|
+
"author": "trac3er00",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/trac3er00/OAL.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/trac3er00/OAL/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/trac3er00/OAL#readme",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=14"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# OMG Commands
|
|
2
|
+
|
|
3
|
+
OMG (Oh My OpenCode Alternative) provides two tiers of commands:
|
|
4
|
+
|
|
5
|
+
## Core Commands (`commands/`)
|
|
6
|
+
|
|
7
|
+
Essential functionality available in all OMG installations:
|
|
8
|
+
|
|
9
|
+
| Command | Description |
|
|
10
|
+
|---------|-------------|
|
|
11
|
+
| `/OMG:init` | Initialize project or domain |
|
|
12
|
+
| `/OMG:escalate` | Route to Codex/Gemini/CCG |
|
|
13
|
+
| `/OMG:teams` | Team routing (standalone) |
|
|
14
|
+
| `/OMG:ccg` | Tri-track synthesis (Claude+Codex+Gemini) |
|
|
15
|
+
| `/OMG:crazy` | Parallel multi-agent orchestration |
|
|
16
|
+
| `/OMG:compat` | Legacy compatibility dispatcher |
|
|
17
|
+
| `/OMG:health-check` | Verify setup and tools |
|
|
18
|
+
| `/OMG:mode` | Set cognitive mode |
|
|
19
|
+
|
|
20
|
+
## Advanced Commands (`plugins/advanced/`)
|
|
21
|
+
|
|
22
|
+
Extended functionality for specialized workflows:
|
|
23
|
+
|
|
24
|
+
| Command | Category | Description |
|
|
25
|
+
|---------|----------|-------------|
|
|
26
|
+
| `/OMG:deep-plan` | Planning | Strategic planning with domain awareness |
|
|
27
|
+
| `/OMG:learn` | Knowledge | Create skills from patterns |
|
|
28
|
+
| `/OMG:code-review` | Quality | Deep code review |
|
|
29
|
+
| `/OMG:security-review` | Security | Security vulnerability scanning |
|
|
30
|
+
| `/OMG:ship` | Delivery | Ship pipeline (idea → PR) |
|
|
31
|
+
| `/OMG:handoff` | Collaboration | Session transfer |
|
|
32
|
+
| `/OMG:maintainer` | OSS | Open-source maintainer tools |
|
|
33
|
+
| `/OMG:sequential-thinking` | Thinking | Structured reasoning |
|
|
34
|
+
| `/OMG:ralph-start` | Automation | Start Ralph loop |
|
|
35
|
+
| `/OMG:ralph-stop` | Automation | Stop Ralph loop |
|
|
36
|
+
|
|
37
|
+
## Plugin Architecture
|
|
38
|
+
|
|
39
|
+
Commands are organized as plugins:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
plugins/
|
|
43
|
+
├── core/ # Essential commands
|
|
44
|
+
│ ├── commands/ # Command definitions
|
|
45
|
+
│ └── plugin.json # Plugin manifest
|
|
46
|
+
└── advanced/ # Extended commands
|
|
47
|
+
├── commands/
|
|
48
|
+
└── plugin.json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Using Advanced Commands
|
|
52
|
+
|
|
53
|
+
Advanced commands work the same as core commands:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
/OMG:deep-plan implement OAuth2 flow
|
|
57
|
+
/OMG:learn from this session
|
|
58
|
+
/OMG:code-review src/auth.ts
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Creating Custom Plugins
|
|
62
|
+
|
|
63
|
+
1. Create `plugins/my-plugin/plugin.json`
|
|
64
|
+
2. Add commands to `plugins/my-plugin/commands/`
|
|
65
|
+
3. OMG auto-discovers plugins on startup
|
|
66
|
+
|
|
67
|
+
See `plugins/advanced/` for examples.
|
|
68
|
+
|
|
69
|
+
## Migration from Superpowers
|
|
70
|
+
|
|
71
|
+
Advanced commands are OMG-native equivalents of superpowers capabilities:
|
|
72
|
+
|
|
73
|
+
| Superpowers | OMG Advanced |
|
|
74
|
+
|-------------|--------------|
|
|
75
|
+
| `writing-plans` | `/OMG:deep-plan` |
|
|
76
|
+
| `learner` | `/OMG:learn` |
|
|
77
|
+
| `requesting-code-review` | `/OMG:code-review` |
|
|
78
|
+
| `security-review` | `/OMG:security-review` |
|
|
79
|
+
| `finishing-a-development-branch` | `/OMG:ship` |
|
|
80
|
+
| `handoff` | `/OMG:handoff` |
|
|
81
|
+
|
|
82
|
+
OMG advanced commands are designed for OMG standalone mode without requiring external plugins.
|