@trac3er/oh-my-god 2.0.0 → 2.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 +8 -8
- package/.claude-plugin/plugin.json +5 -4
- package/.claude-plugin/scripts/uninstall.sh +74 -3
- package/.claude-plugin/scripts/update.sh +78 -3
- package/.coveragerc +26 -0
- package/.mcp.json +4 -4
- package/CHANGELOG.md +14 -0
- package/CODE_OF_CONDUCT.md +27 -0
- package/CONTRIBUTING.md +62 -0
- package/OMG-setup.sh +1201 -355
- package/README.md +77 -56
- package/SECURITY.md +25 -0
- package/agents/__init__.py +1 -0
- package/agents/model_roles.py +196 -0
- package/agents/omg-architect-mode.md +3 -5
- package/agents/omg-backend-engineer.md +3 -5
- package/agents/omg-database-engineer.md +3 -5
- package/agents/omg-frontend-designer.md +4 -5
- package/agents/omg-implement-mode.md +4 -5
- package/agents/omg-infra-engineer.md +3 -5
- package/agents/omg-research-mode.md +4 -6
- package/agents/omg-security-auditor.md +3 -5
- package/agents/omg-testing-engineer.md +3 -5
- package/build/lib/yaml.py +321 -0
- package/commands/OMG:ai-commit.md +101 -14
- package/commands/OMG:arch.md +302 -19
- package/commands/OMG:ccg.md +12 -7
- package/commands/OMG:compat.md +25 -17
- package/commands/OMG:cost.md +173 -13
- package/commands/OMG:crazy.md +1 -1
- package/commands/OMG:create-agent.md +170 -20
- package/commands/OMG:deps.md +235 -17
- package/commands/OMG:domain-init.md +1 -1
- package/commands/OMG:escalate.md +41 -12
- package/commands/OMG:health-check.md +37 -13
- package/commands/OMG:init.md +122 -14
- package/commands/OMG:project-init.md +1 -1
- package/commands/OMG:session-branch.md +76 -9
- package/commands/OMG:session-fork.md +42 -5
- package/commands/OMG:session-merge.md +124 -8
- package/commands/OMG:setup.md +69 -12
- package/commands/OMG:stats.md +215 -14
- package/commands/OMG:teams.md +19 -10
- package/config/lsp_languages.yaml +8 -0
- package/hooks/__init__.py +0 -0
- package/hooks/_agent_registry.py +423 -0
- package/hooks/_analytics.py +291 -0
- package/hooks/_budget.py +31 -0
- package/hooks/_common.py +569 -0
- package/hooks/_compression_optimizer.py +119 -0
- package/hooks/_cost_ledger.py +176 -0
- package/hooks/_learnings.py +126 -0
- package/hooks/_memory.py +103 -0
- package/hooks/_protected_context.py +150 -0
- package/hooks/_token_counter.py +221 -0
- package/hooks/branch_manager.py +236 -0
- package/hooks/budget_governor.py +232 -0
- package/hooks/circuit-breaker.py +270 -0
- package/hooks/compression_feedback.py +254 -0
- package/hooks/config-guard.py +216 -0
- package/hooks/context_pressure.py +53 -0
- package/hooks/credential_store.py +1020 -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 +505 -0
- package/hooks/post-tool-failure.py +19 -0
- package/hooks/post-write.py +219 -0
- package/hooks/post_write.py +46 -0
- package/hooks/pre-compact.py +398 -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/query.py +512 -0
- package/hooks/secret-guard.py +61 -0
- package/hooks/secret_audit.py +144 -0
- package/hooks/session-end-capture.py +137 -0
- package/hooks/session-start.py +277 -0
- package/hooks/setup_wizard.py +582 -0
- package/hooks/shadow_manager.py +297 -0
- package/hooks/state_migration.py +225 -0
- package/hooks/stop-gate.py +7 -0
- package/hooks/stop_dispatcher.py +945 -0
- package/hooks/test-validator.py +361 -0
- package/hooks/test_generator_hook.py +123 -0
- package/hooks/todo-state-tracker.py +114 -0
- package/hooks/tool-ledger.py +149 -0
- package/hooks/trust_review.py +585 -0
- package/hud/omg-hud.mjs +31 -1
- package/lab/__init__.py +1 -0
- package/lab/pipeline.py +75 -0
- package/lab/policies.py +52 -0
- package/package.json +7 -18
- package/plugins/README.md +33 -61
- package/plugins/advanced/commands/OMG:deep-plan.md +3 -3
- package/plugins/advanced/commands/OMG:learn.md +1 -1
- package/plugins/advanced/commands/OMG:security-review.md +3 -3
- package/plugins/advanced/commands/OMG:ship.md +1 -1
- package/plugins/advanced/plugin.json +1 -1
- package/plugins/core/plugin.json +8 -3
- package/plugins/dephealth/__init__.py +0 -0
- package/plugins/dephealth/cve_scanner.py +188 -0
- package/plugins/dephealth/license_checker.py +135 -0
- package/plugins/dephealth/manifest_detector.py +423 -0
- package/plugins/dephealth/vuln_analyzer.py +169 -0
- package/plugins/testgen/__init__.py +0 -0
- package/plugins/testgen/codamosa_engine.py +402 -0
- package/plugins/testgen/edge_case_synthesizer.py +184 -0
- package/plugins/testgen/framework_detector.py +271 -0
- package/plugins/testgen/skeleton_generator.py +219 -0
- package/plugins/viz/__init__.py +0 -0
- package/plugins/viz/ast_parser.py +139 -0
- package/plugins/viz/diagram_generator.py +192 -0
- package/plugins/viz/graph_builder.py +444 -0
- package/plugins/viz/native_parsers.py +259 -0
- package/plugins/viz/regex_parser.py +112 -0
- package/pyproject.toml +81 -0
- package/rules/contextual/write-verify.md +2 -2
- package/rules/core/00-truth.md +1 -1
- package/rules/core/01-surgical.md +1 -1
- package/rules/core/02-circuit-breaker.md +2 -2
- package/rules/core/03-ensemble.md +3 -3
- package/rules/core/04-testing.md +3 -3
- 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/adoption.py +212 -0
- package/runtime/business_workflow.py +220 -0
- package/runtime/cli_provider.py +85 -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/mcp_config_writers.py +115 -0
- package/runtime/mcp_lifecycle.py +153 -0
- package/runtime/mcp_memory_server.py +135 -0
- package/runtime/memory_parsers/__init__.py +0 -0
- package/runtime/memory_parsers/chatgpt_parser.py +257 -0
- package/runtime/memory_parsers/claude_import.py +107 -0
- package/runtime/memory_parsers/export.py +97 -0
- package/runtime/memory_parsers/gemini_import.py +91 -0
- package/runtime/memory_parsers/kimi_import.py +91 -0
- package/runtime/memory_store.py +215 -0
- package/runtime/omc_compat.py +7 -0
- package/runtime/providers/__init__.py +0 -0
- package/runtime/providers/codex_provider.py +112 -0
- package/runtime/providers/gemini_provider.py +128 -0
- package/runtime/providers/kimi_provider.py +151 -0
- package/runtime/providers/opencode_provider.py +144 -0
- package/runtime/subagent_dispatcher.py +362 -0
- package/runtime/team_router.py +1167 -0
- package/runtime/tmux_session_manager.py +169 -0
- package/scripts/check-omg-compat-contract-snapshot.py +137 -0
- package/scripts/check-omg-contract-snapshot.py +12 -0
- package/scripts/check-omg-public-ready.py +193 -0
- package/scripts/check-omg-standalone-clean.py +103 -0
- package/scripts/legacy_to_omg_migrate.py +29 -0
- package/scripts/migrate-legacy.py +464 -0
- package/scripts/omc_to_omg_migrate.py +12 -0
- package/scripts/omg.py +492 -0
- package/scripts/settings-merge.py +283 -0
- package/scripts/verify-standalone.sh +8 -4
- package/settings.json +126 -29
- package/templates/profile.yaml +1 -1
- 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 +347 -0
- package/tools/commit_splitter.py +746 -0
- package/tools/config_discovery.py +151 -0
- package/tools/config_merger.py +449 -0
- package/tools/dashboard_generator.py +300 -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/pr_generator.py +404 -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
- package/yaml.py +321 -0
- package/.claude-plugin/scripts/install.sh +0 -9
- package/bun.lock +0 -23
- package/bunfig.toml +0 -3
- package/hooks/_budget.ts +0 -1
- package/hooks/_common.ts +0 -63
- package/hooks/circuit-breaker.ts +0 -101
- package/hooks/config-guard.ts +0 -4
- package/hooks/firewall.ts +0 -20
- package/hooks/policy_engine.ts +0 -156
- package/hooks/post-tool-failure.ts +0 -22
- package/hooks/post-write.ts +0 -4
- package/hooks/pre-tool-inject.ts +0 -4
- package/hooks/prompt-enhancer.ts +0 -46
- package/hooks/quality-runner.ts +0 -24
- package/hooks/secret-guard.ts +0 -4
- package/hooks/session-end-capture.ts +0 -19
- package/hooks/session-start.ts +0 -19
- package/hooks/shadow_manager.ts +0 -81
- package/hooks/stop-gate.ts +0 -22
- package/hooks/stop_dispatcher.ts +0 -147
- package/hooks/test-generator-hook.ts +0 -4
- package/hooks/tool-ledger.ts +0 -27
- package/hooks/trust_review.ts +0 -175
- package/lab/pipeline.ts +0 -75
- package/lab/policies.ts +0 -68
- package/runtime/common.ts +0 -111
- package/runtime/compat.ts +0 -174
- package/runtime/dispatcher.ts +0 -25
- package/runtime/ecosystem.ts +0 -186
- package/runtime/provider_bootstrap.ts +0 -99
- package/runtime/provider_smoke.ts +0 -34
- package/runtime/release_readiness.ts +0 -186
- package/runtime/team_router.ts +0 -144
- package/scripts/check-omg-compat-contract-snapshot.ts +0 -20
- package/scripts/check-omg-standalone-clean.ts +0 -12
- package/scripts/check-runtime-clean.ts +0 -94
- package/scripts/omg.ts +0 -352
- package/scripts/settings-merge.ts +0 -93
- package/tools/commit_splitter.ts +0 -23
- package/tools/git_inspector.ts +0 -18
- package/tools/session_snapshot.ts +0 -47
- package/trac3er-oh-my-god-2.0.0.tgz +0 -0
- package/tsconfig.json +0 -15
package/commands/OMG:arch.md
CHANGED
|
@@ -1,30 +1,313 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
3
|
-
allowed-tools: Read,
|
|
4
|
-
argument-hint: "[
|
|
2
|
+
description: "Codebase visualization — dependency graphs and architecture diagrams."
|
|
3
|
+
allowed-tools: Read, Bash(python*:*), Grep
|
|
4
|
+
argument-hint: "[render|module-name|stats|--native]"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# /OMG:arch
|
|
7
|
+
# /OMG:arch — Architecture Visualization
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Visualize project dependency graphs as Mermaid diagrams, render to PNG, zoom into specific modules, and inspect graph statistics.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
13
|
+
```
|
|
14
|
+
/OMG:arch
|
|
15
|
+
/OMG:arch render
|
|
16
|
+
/OMG:arch <module-name>
|
|
17
|
+
/OMG:arch stats
|
|
18
|
+
/OMG:arch --native
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Sub-Commands
|
|
22
|
+
|
|
23
|
+
### `/OMG:arch` (default)
|
|
24
|
+
|
|
25
|
+
Full project dependency graph as Mermaid text output, embeddable in Markdown.
|
|
26
|
+
|
|
27
|
+
Scans all Python (.py), JavaScript/TypeScript (.js/.jsx/.ts/.tsx), and Go (.go) files. Python files are parsed via AST; JS/TS/Go files use regex-based import detection (~70% accuracy).
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from plugins.viz.graph_builder import build_project_graph
|
|
31
|
+
from plugins.viz.diagram_generator import generate_mermaid
|
|
32
|
+
|
|
33
|
+
result = build_project_graph(".")
|
|
34
|
+
graph = result.get("graph", {})
|
|
35
|
+
|
|
36
|
+
mermaid_text = generate_mermaid(graph)
|
|
37
|
+
if mermaid_text:
|
|
38
|
+
print("```mermaid")
|
|
39
|
+
print(mermaid_text)
|
|
40
|
+
print("```")
|
|
41
|
+
else:
|
|
42
|
+
print("No dependencies detected.")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `/OMG:arch render`
|
|
46
|
+
|
|
47
|
+
Render the dependency graph to a PNG image via the mermaid.ink public API. Saves output to `.omg/state/arch-diagram.png`.
|
|
48
|
+
|
|
49
|
+
Requires network access to `https://mermaid.ink`.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import os
|
|
53
|
+
from plugins.viz.graph_builder import build_project_graph
|
|
54
|
+
from plugins.viz.diagram_generator import generate_mermaid, render_to_png
|
|
55
|
+
|
|
56
|
+
result = build_project_graph(".")
|
|
57
|
+
graph = result.get("graph", {})
|
|
58
|
+
mermaid_text = generate_mermaid(graph)
|
|
59
|
+
|
|
60
|
+
output_path = os.path.join(".omg", "state", "arch-diagram.png")
|
|
61
|
+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
62
|
+
|
|
63
|
+
if render_to_png(mermaid_text, output_path):
|
|
64
|
+
print(f"Diagram rendered to {output_path}")
|
|
65
|
+
else:
|
|
66
|
+
print("Render failed — check network access or graph size.")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `/OMG:arch <module-name>`
|
|
70
|
+
|
|
71
|
+
Zoomed subgraph for a specific module. Shows only the named module and its direct dependencies.
|
|
72
|
+
|
|
73
|
+
Replace `<module-name>` with the dotted module path (e.g. `plugins.viz.graph_builder`).
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from plugins.viz.graph_builder import build_project_graph
|
|
77
|
+
from plugins.viz.diagram_generator import generate_mermaid
|
|
78
|
+
|
|
79
|
+
result = build_project_graph(".")
|
|
80
|
+
graph = result.get("graph", {})
|
|
81
|
+
|
|
82
|
+
# Zoom into a specific module
|
|
83
|
+
module_name = "<module-name>" # e.g. "plugins.viz.graph_builder"
|
|
84
|
+
mermaid_text = generate_mermaid(graph, zoom=module_name)
|
|
85
|
+
|
|
86
|
+
if mermaid_text:
|
|
87
|
+
print(f"Dependencies for: {module_name}")
|
|
88
|
+
print()
|
|
89
|
+
print("```mermaid")
|
|
90
|
+
print(mermaid_text)
|
|
91
|
+
print("```")
|
|
92
|
+
else:
|
|
93
|
+
print(f"Module '{module_name}' not found in dependency graph.")
|
|
94
|
+
print()
|
|
95
|
+
print("Available modules:")
|
|
96
|
+
for mod in sorted(graph.keys()):
|
|
97
|
+
print(f" - {mod}")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### `/OMG:arch stats`
|
|
101
|
+
|
|
102
|
+
Graph statistics: module count, edge count, max depth, circular dependencies, and coupling score.
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from plugins.viz.graph_builder import build_project_graph
|
|
106
|
+
|
|
107
|
+
result = build_project_graph(".")
|
|
108
|
+
metrics = result.get("metrics", {})
|
|
109
|
+
|
|
110
|
+
module_count = metrics.get("module_count", 0)
|
|
111
|
+
edge_count = metrics.get("edge_count", 0)
|
|
112
|
+
max_depth = metrics.get("max_depth", 0)
|
|
113
|
+
circular_deps = metrics.get("circular_deps", [])
|
|
114
|
+
coupling_score = metrics.get("coupling_score", 0.0)
|
|
115
|
+
|
|
116
|
+
print(f"Modules: {module_count}")
|
|
117
|
+
print(f"Edges: {edge_count}")
|
|
118
|
+
print(f"Max depth: {max_depth}")
|
|
119
|
+
print(f"Circular deps: {len(circular_deps)}")
|
|
120
|
+
print(f"Coupling score: {coupling_score:.2f}")
|
|
121
|
+
|
|
122
|
+
if circular_deps:
|
|
123
|
+
print()
|
|
124
|
+
print("Circular dependency cycles:")
|
|
125
|
+
for cycle in circular_deps:
|
|
126
|
+
print(f" {' → '.join(cycle)}")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### `/OMG:arch --native`
|
|
130
|
+
|
|
131
|
+
Use native language toolchains for higher-accuracy dependency parsing (~95% vs ~70% with regex).
|
|
132
|
+
|
|
133
|
+
Supported toolchains:
|
|
134
|
+
- **Go**: `go list -json ./...` — requires `go` on PATH
|
|
135
|
+
- **TypeScript**: `tsc --listFiles --noEmit` — requires `tsc` on PATH
|
|
136
|
+
- **Rust**: `cargo metadata --format-version=1 --no-deps` — requires `cargo` on PATH
|
|
18
137
|
|
|
19
|
-
|
|
138
|
+
Falls back to regex parsing when a toolchain is not available.
|
|
20
139
|
|
|
21
|
-
```
|
|
22
|
-
|
|
140
|
+
```python
|
|
141
|
+
from plugins.viz.native_parsers import (
|
|
142
|
+
is_toolchain_available,
|
|
143
|
+
parse_go_native,
|
|
144
|
+
parse_typescript_native,
|
|
145
|
+
parse_rust_native,
|
|
146
|
+
)
|
|
147
|
+
from plugins.viz.graph_builder import build_project_graph
|
|
148
|
+
from plugins.viz.diagram_generator import generate_mermaid
|
|
149
|
+
|
|
150
|
+
# Check available toolchains
|
|
151
|
+
toolchains = {
|
|
152
|
+
"go": is_toolchain_available("go"),
|
|
153
|
+
"tsc": is_toolchain_available("tsc"),
|
|
154
|
+
"cargo": is_toolchain_available("cargo"),
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
print("Toolchain availability:")
|
|
158
|
+
for tc, available in toolchains.items():
|
|
159
|
+
status = "available" if available else "not found"
|
|
160
|
+
print(f" {tc}: {status}")
|
|
161
|
+
print()
|
|
162
|
+
|
|
163
|
+
# Parse with native toolchains where available
|
|
164
|
+
native_graphs = {}
|
|
165
|
+
if toolchains["go"]:
|
|
166
|
+
go_result = parse_go_native(".")
|
|
167
|
+
if "error" not in go_result:
|
|
168
|
+
native_graphs.update(go_result["graph"])
|
|
169
|
+
print(f"Go: {len(go_result['graph'])} packages (native-95% accuracy)")
|
|
170
|
+
|
|
171
|
+
if toolchains["tsc"]:
|
|
172
|
+
ts_result = parse_typescript_native(".")
|
|
173
|
+
if "error" not in ts_result:
|
|
174
|
+
native_graphs.update(ts_result["graph"])
|
|
175
|
+
print(f"TypeScript: {len(ts_result['graph'])} modules (native-95% accuracy)")
|
|
176
|
+
|
|
177
|
+
if toolchains["cargo"]:
|
|
178
|
+
rust_result = parse_rust_native(".")
|
|
179
|
+
if "error" not in rust_result:
|
|
180
|
+
native_graphs.update(rust_result["graph"])
|
|
181
|
+
print(f"Rust: {len(rust_result['graph'])} crates (native-95% accuracy)")
|
|
182
|
+
|
|
183
|
+
# Fall back to regex-based graph for remaining files
|
|
184
|
+
result = build_project_graph(".")
|
|
185
|
+
graph = result.get("graph", {})
|
|
186
|
+
|
|
187
|
+
# Merge: native results override regex results
|
|
188
|
+
merged = {**graph, **native_graphs}
|
|
189
|
+
|
|
190
|
+
mermaid_text = generate_mermaid(merged)
|
|
191
|
+
if mermaid_text:
|
|
192
|
+
print()
|
|
193
|
+
print("```mermaid")
|
|
194
|
+
print(mermaid_text)
|
|
195
|
+
print("```")
|
|
23
196
|
```
|
|
24
197
|
|
|
25
|
-
|
|
198
|
+
## Feature Flag
|
|
199
|
+
|
|
200
|
+
- **Flag name**: `OMG_CODEBASE_VIZ_ENABLED`
|
|
201
|
+
- **Default**: `False` (disabled)
|
|
202
|
+
- **Enable**: `export OMG_CODEBASE_VIZ_ENABLED=1`
|
|
203
|
+
|
|
204
|
+
Or set in `settings.json`:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"_omg": {
|
|
209
|
+
"features": {
|
|
210
|
+
"CODEBASE_VIZ": true
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Output Example
|
|
217
|
+
|
|
218
|
+
### `/OMG:arch` output
|
|
219
|
+
|
|
220
|
+
````
|
|
221
|
+
```mermaid
|
|
222
|
+
graph TD
|
|
223
|
+
hooks_budget_governor["hooks.budget_governor"]
|
|
224
|
+
hooks__common["hooks._common"]
|
|
225
|
+
hooks__cost_ledger["hooks._cost_ledger"]
|
|
226
|
+
plugins_viz_graph_builder["plugins.viz.graph_builder"]
|
|
227
|
+
plugins_viz_ast_parser["plugins.viz.ast_parser"]
|
|
228
|
+
plugins_viz_regex_parser["plugins.viz.regex_parser"]
|
|
229
|
+
hooks_budget_governor --> hooks__common
|
|
230
|
+
hooks_budget_governor --> hooks__cost_ledger
|
|
231
|
+
plugins_viz_graph_builder --> plugins_viz_ast_parser
|
|
232
|
+
plugins_viz_graph_builder --> plugins_viz_regex_parser
|
|
233
|
+
```
|
|
234
|
+
````
|
|
235
|
+
|
|
236
|
+
### `/OMG:arch stats` output
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
============================================================
|
|
240
|
+
OMG Architecture — Graph Statistics
|
|
241
|
+
============================================================
|
|
26
242
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
243
|
+
Modules: 42
|
|
244
|
+
Edges: 87
|
|
245
|
+
Max depth: 6
|
|
246
|
+
Circular deps: 1
|
|
247
|
+
Coupling score: 2.07
|
|
248
|
+
|
|
249
|
+
Circular dependency cycles:
|
|
250
|
+
hooks._common → hooks.query → hooks._common
|
|
251
|
+
|
|
252
|
+
============================================================
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### `/OMG:arch --native` accuracy comparison
|
|
256
|
+
|
|
257
|
+
| Method | Accuracy | Requires |
|
|
258
|
+
|--------|----------|----------|
|
|
259
|
+
| Regex (default) | ~70% | No external tools |
|
|
260
|
+
| Native toolchain | ~95% | `go`, `tsc`, or `cargo` on PATH |
|
|
261
|
+
|
|
262
|
+
## Supported Languages
|
|
263
|
+
|
|
264
|
+
| Language | Extensions | Default Parser | Native Parser |
|
|
265
|
+
|----------|-----------|----------------|---------------|
|
|
266
|
+
| Python | `.py` | AST (`ast` stdlib) | — |
|
|
267
|
+
| JavaScript/TypeScript | `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs` | Regex | `tsc --listFiles` |
|
|
268
|
+
| Go | `.go` | Regex | `go list -json` |
|
|
269
|
+
| Rust | `.rs` (via Cargo) | — | `cargo metadata` |
|
|
270
|
+
|
|
271
|
+
## Safety
|
|
272
|
+
|
|
273
|
+
- **Read-only**: All sub-commands only read source files and query external APIs (mermaid.ink for PNG render)
|
|
274
|
+
- **Feature-gated**: Requires `CODEBASE_VIZ` flag enabled
|
|
275
|
+
- **No mutations**: Never modifies source code, dependencies, or project configuration
|
|
276
|
+
- **Crash-isolated**: All operations return empty/false on failure (never raise to caller)
|
|
277
|
+
- **Cache**: Graph cached to `.omg/state/dependency-graph.json` with mtime-based incremental updates
|
|
278
|
+
- **Network**: `/arch render` requires internet access for mermaid.ink API
|
|
279
|
+
- **Subprocess safety**: Native parsers use argv lists (never `shell=True`) with 30s timeout
|
|
280
|
+
|
|
281
|
+
## API
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
from plugins.viz.graph_builder import build_project_graph
|
|
285
|
+
from plugins.viz.diagram_generator import generate_mermaid, generate_d2, render_to_png
|
|
286
|
+
from plugins.viz.native_parsers import (
|
|
287
|
+
parse_go_native,
|
|
288
|
+
parse_typescript_native,
|
|
289
|
+
parse_rust_native,
|
|
290
|
+
is_toolchain_available,
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
# Build full dependency graph (regex + AST)
|
|
294
|
+
result = build_project_graph(".")
|
|
295
|
+
# result = {"graph": {...}, "metrics": {...}}
|
|
296
|
+
|
|
297
|
+
# Generate Mermaid diagram text
|
|
298
|
+
mermaid_text = generate_mermaid(result["graph"])
|
|
299
|
+
|
|
300
|
+
# Generate Mermaid for a single module (zoomed)
|
|
301
|
+
zoomed = generate_mermaid(result["graph"], zoom="plugins.viz.graph_builder")
|
|
302
|
+
|
|
303
|
+
# Generate D2 diagram text
|
|
304
|
+
d2_text = generate_d2(result["graph"])
|
|
305
|
+
|
|
306
|
+
# Render Mermaid to PNG via mermaid.ink
|
|
307
|
+
success = render_to_png(mermaid_text, ".omg/state/arch-diagram.png")
|
|
308
|
+
|
|
309
|
+
# Native toolchain parsing (higher accuracy)
|
|
310
|
+
go_deps = parse_go_native(".")
|
|
311
|
+
ts_deps = parse_typescript_native(".")
|
|
312
|
+
rs_deps = parse_rust_native(".")
|
|
313
|
+
```
|
package/commands/OMG:ccg.md
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: OMG CCG mode (tri-track synthesis) in standalone
|
|
3
|
-
allowed-tools: Read, Grep, Glob, Bash(
|
|
2
|
+
description: OMG CCG mode (tri-track synthesis) in standalone mode.
|
|
3
|
+
allowed-tools: Read, Grep, Glob, Bash(python3:*), Bash(git:*), Bash(rg:*), Bash(find:*), Bash(cat:*)
|
|
4
4
|
argument-hint: "problem statement"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# /OMG:ccg
|
|
7
|
+
# /OMG:ccg — Standalone CCG
|
|
8
8
|
|
|
9
9
|
Runs OMG internal tri-track routing and returns merged actions.
|
|
10
10
|
|
|
11
|
+
CCG execution standard:
|
|
12
|
+
- launch backend/frontend/architecture analysis in parallel sub-agents
|
|
13
|
+
- collect all tracks with `background_output`
|
|
14
|
+
- run `sequential-thinking` to merge tracks into one execution order
|
|
15
|
+
|
|
11
16
|
```bash
|
|
12
|
-
OMG_CLI="${OMG_CLI_PATH:-$HOME/.claude/omg-runtime/scripts/omg.
|
|
13
|
-
if [ ! -f "$OMG_CLI" ] && [ -f "scripts/omg.
|
|
14
|
-
|
|
17
|
+
OMG_CLI="${OMG_CLI_PATH:-$HOME/.claude/omg-runtime/scripts/omg.py}"
|
|
18
|
+
if [ ! -f "$OMG_CLI" ] && [ -f "scripts/omg.py" ]; then OMG_CLI="scripts/omg.py"; fi
|
|
19
|
+
python3 "$OMG_CLI" ccg --problem "[problem]"
|
|
15
20
|
```
|
|
16
21
|
|
|
17
|
-
Use this when backend
|
|
22
|
+
Use this when backend+frontend+architecture are coupled.
|
package/commands/OMG:compat.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Run legacy skill names on OMG standalone via
|
|
3
|
-
allowed-tools: Read, Grep, Glob, Bash(
|
|
2
|
+
description: Run legacy skill names on OMG standalone via compatibility dispatcher.
|
|
3
|
+
allowed-tools: Read, Grep, Glob, Bash(python3:*), Bash(rg:*), Bash(find:*), Bash(cat:*)
|
|
4
4
|
argument-hint: "<skill-name> [optional problem]"
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -9,41 +9,49 @@ argument-hint: "<skill-name> [optional problem]"
|
|
|
9
9
|
Use this when migrating legacy workflows to OMG standalone.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
OMG_CLI="${OMG_CLI_PATH:-$HOME/.claude/omg-runtime/scripts/omg.
|
|
13
|
-
if [ ! -f "$OMG_CLI" ] && [ -f "scripts/omg.
|
|
12
|
+
OMG_CLI="${OMG_CLI_PATH:-$HOME/.claude/omg-runtime/scripts/omg.py}"
|
|
13
|
+
if [ ! -f "$OMG_CLI" ] && [ -f "scripts/omg.py" ]; then OMG_CLI="scripts/omg.py"; fi
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## List supported skills
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
|
|
19
|
+
python3 "$OMG_CLI" compat list
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
## Inspect contracts
|
|
22
|
+
## Inspect contracts
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
python3 "$OMG_CLI" compat contract --all
|
|
26
|
+
python3 "$OMG_CLI" compat contract --skill omg-teams
|
|
27
|
+
python3 "$OMG_CLI" compat snapshot --output runtime/omg_compat_contract_snapshot.json
|
|
28
|
+
python3 scripts/check-omg-compat-contract-snapshot.py --strict-version
|
|
29
|
+
python3 scripts/check-omg-standalone-clean.py
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Generate
|
|
32
|
+
## Generate compatibility gap report
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
|
|
35
|
+
python3 "$OMG_CLI" compat gap-report
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
## Enforce
|
|
38
|
+
## Enforce GA gate (CI/local)
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
python3 "$OMG_CLI" compat gate --max-bridge 0
|
|
42
|
+
python3 "$OMG_CLI" compat gate --max-bridge 0 --output .omg/evidence/omg-compat-gap.json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Run a legacy skill
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
|
|
48
|
+
python3 "$OMG_CLI" compat run --skill "<skill-name>" --problem "$ARGUMENTS"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Examples:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 "$OMG_CLI" compat run --skill omg-teams --problem "review auth flow"
|
|
55
|
+
python3 "$OMG_CLI" compat run --skill plan --problem "ship secure release"
|
|
56
|
+
python3 "$OMG_CLI" compat run --skill pipeline --problem "train model"
|
|
49
57
|
```
|
package/commands/OMG:cost.md
CHANGED
|
@@ -1,21 +1,181 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
3
|
-
allowed-tools: Read,
|
|
4
|
-
argument-hint: "[
|
|
2
|
+
description: "Display session cost tracking, budget status, and usage history."
|
|
3
|
+
allowed-tools: Read, Bash(python*:*), Grep
|
|
4
|
+
argument-hint: "[history|budget|reset]"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# /OMG:cost
|
|
7
|
+
# /OMG:cost — Cost Tracker
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Display session cost tracking, budget status, and usage history.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
```
|
|
14
|
+
/OMG:cost
|
|
15
|
+
/OMG:cost history
|
|
16
|
+
/OMG:cost budget
|
|
17
|
+
/OMG:cost reset
|
|
18
|
+
```
|
|
16
19
|
|
|
17
|
-
##
|
|
20
|
+
## Sub-Commands
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
### `/OMG:cost` (default)
|
|
23
|
+
|
|
24
|
+
Show current session cost summary: total tokens, total USD spent, and remaining budget percentage.
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from hooks._cost_ledger import read_cost_summary
|
|
28
|
+
summary = read_cost_summary(".")
|
|
29
|
+
print(f"Total tokens: {summary['total_tokens']}")
|
|
30
|
+
print(f"Total cost: ${summary['total_cost_usd']:.4f}")
|
|
31
|
+
print(f"Entries: {summary['entry_count']}")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `/OMG:cost history`
|
|
35
|
+
|
|
36
|
+
Show cost breakdown by tool and by session. Lists top consumers and per-session aggregates.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from hooks._cost_ledger import read_cost_summary
|
|
40
|
+
summary = read_cost_summary(".")
|
|
41
|
+
|
|
42
|
+
# By tool
|
|
43
|
+
for tool, stats in sorted(summary["by_tool"].items(), key=lambda x: x[1]["cost_usd"], reverse=True):
|
|
44
|
+
print(f" {tool}: {stats['count']} calls, {stats['tokens']} tokens, ${stats['cost_usd']:.4f}")
|
|
45
|
+
|
|
46
|
+
# By session
|
|
47
|
+
for sid, stats in summary["by_session"].items():
|
|
48
|
+
print(f" {sid}: {stats['count']} calls, ${stats['cost_usd']:.4f}")
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### `/OMG:cost budget`
|
|
52
|
+
|
|
53
|
+
Show budget configuration and threshold status. Reads from `_omg.cost_budget` in `settings.json`.
|
|
54
|
+
|
|
55
|
+
Displays:
|
|
56
|
+
- Session budget limit (USD)
|
|
57
|
+
- Current spend vs limit
|
|
58
|
+
- Remaining budget percentage
|
|
59
|
+
- Threshold levels and which have been triggered
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import json
|
|
63
|
+
with open("settings.json") as f:
|
|
64
|
+
config = json.load(f)
|
|
65
|
+
budget = config.get("_omg", {}).get("cost_budget", {})
|
|
66
|
+
print(f"Session limit: ${budget.get('session_limit_usd', 5.0):.2f}")
|
|
67
|
+
print(f"Thresholds: {budget.get('thresholds', [50, 80, 95])}")
|
|
68
|
+
print(f"Pricing: ${budget.get('pricing', {}).get('input_per_mtok', 3.0)}/Mtok in, ${budget.get('pricing', {}).get('output_per_mtok', 15.0)}/Mtok out")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `/OMG:cost reset`
|
|
72
|
+
|
|
73
|
+
Clear the cost ledger and threshold state for a fresh start.
|
|
74
|
+
|
|
75
|
+
Removes:
|
|
76
|
+
- `.omg/state/ledger/cost-ledger.jsonl`
|
|
77
|
+
- `.omg/state/.cost-threshold-state.json`
|
|
78
|
+
|
|
79
|
+
## Feature Flag
|
|
80
|
+
|
|
81
|
+
- **Flag name**: `OMG_COST_TRACKING_ENABLED`
|
|
82
|
+
- **Default**: `False` (disabled)
|
|
83
|
+
- **Enable**: `export OMG_COST_TRACKING_ENABLED=1`
|
|
84
|
+
|
|
85
|
+
Or set in `settings.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"_omg": {
|
|
90
|
+
"features": {
|
|
91
|
+
"COST_TRACKING": true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Budget Configuration
|
|
98
|
+
|
|
99
|
+
Configure in `settings.json` under `_omg.cost_budget`:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"_omg": {
|
|
104
|
+
"cost_budget": {
|
|
105
|
+
"session_limit_usd": 5.0,
|
|
106
|
+
"thresholds": [50, 80, 95],
|
|
107
|
+
"pricing": {
|
|
108
|
+
"input_per_mtok": 3.0,
|
|
109
|
+
"output_per_mtok": 15.0
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Setting | Default | Description |
|
|
117
|
+
|---------|---------|-------------|
|
|
118
|
+
| `session_limit_usd` | `5.0` | Maximum spend per session in USD |
|
|
119
|
+
| `thresholds` | `[50, 80, 95]` | Budget percentage thresholds for alerts |
|
|
120
|
+
| `pricing.input_per_mtok` | `3.0` | Cost per million input tokens |
|
|
121
|
+
| `pricing.output_per_mtok` | `15.0` | Cost per million output tokens |
|
|
122
|
+
|
|
123
|
+
## Output Example
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
============================================================
|
|
127
|
+
OMG Cost Tracker — Session Summary
|
|
128
|
+
============================================================
|
|
129
|
+
|
|
130
|
+
Total tokens: 124,350
|
|
131
|
+
Total cost: $0.4821
|
|
132
|
+
Budget remaining: 90.4% ($4.52 of $5.00)
|
|
133
|
+
Tool calls: 47
|
|
134
|
+
|
|
135
|
+
Top consumers:
|
|
136
|
+
Bash: 23 calls, 68,200 tokens, $0.2644
|
|
137
|
+
Read: 12 calls, 34,100 tokens, $0.1322
|
|
138
|
+
Write: 8 calls, 15,050 tokens, $0.0583
|
|
139
|
+
Edit: 4 calls, 7,000 tokens, $0.0272
|
|
140
|
+
|
|
141
|
+
============================================================
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Hook Integration
|
|
145
|
+
|
|
146
|
+
The `budget_governor.py` PostToolUse hook automatically tracks costs when `COST_TRACKING` is enabled. It:
|
|
147
|
+
|
|
148
|
+
1. Estimates token usage for each tool call (Tier 2 calibrated model)
|
|
149
|
+
2. Appends cost entries to `.omg/state/ledger/cost-ledger.jsonl`
|
|
150
|
+
3. Injects budget status into Claude's context via `additionalContext`
|
|
151
|
+
4. Fires threshold alerts at 50%, 80%, and 95% budget usage
|
|
152
|
+
|
|
153
|
+
## Safety
|
|
154
|
+
|
|
155
|
+
- **Read-only** (default): `/cost`, `/cost history`, `/cost budget` only read data
|
|
156
|
+
- **Feature-gated**: Hook and command require `COST_TRACKING` flag enabled
|
|
157
|
+
- **Advisory-only**: Budget governor never blocks tool execution
|
|
158
|
+
- **Crash-isolated**: All operations exit 0 on failure
|
|
159
|
+
|
|
160
|
+
## API
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from hooks._cost_ledger import read_cost_summary, append_cost_entry, rotate_cost_ledger
|
|
164
|
+
|
|
165
|
+
# Get aggregated cost summary
|
|
166
|
+
summary = read_cost_summary(".")
|
|
167
|
+
|
|
168
|
+
# Append a cost entry
|
|
169
|
+
append_cost_entry(".", {
|
|
170
|
+
"ts": "2026-03-04T12:00:00Z",
|
|
171
|
+
"tool": "Bash",
|
|
172
|
+
"tokens_in": 500,
|
|
173
|
+
"tokens_out": 200,
|
|
174
|
+
"cost_usd": 0.0045,
|
|
175
|
+
"model": "claude-opus-4-6",
|
|
176
|
+
"session_id": "ses_abc123"
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
# Rotate ledger when > 5MB
|
|
180
|
+
rotate_cost_ledger(".")
|
|
181
|
+
```
|
package/commands/OMG:crazy.md
CHANGED
|
@@ -34,7 +34,7 @@ CRAZY mode must use parallel sub-agent dispatch for worker tracks.
|
|
|
34
34
|
|
|
35
35
|
### Mandatory parallel launch pattern
|
|
36
36
|
|
|
37
|
-
```
|
|
37
|
+
```python
|
|
38
38
|
task(subagent_type="explore", run_in_background=true, load_skills=[], description="Architect track", prompt="...")
|
|
39
39
|
task(subagent_type="explore", run_in_background=true, load_skills=[], description="Backend track", prompt="...")
|
|
40
40
|
task(subagent_type="explore", run_in_background=true, load_skills=[], description="Frontend track", prompt="...")
|