@trac3er/oh-my-god 2.0.3 → 2.0.5
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/algorithms/SKILL.md +11 -0
- package/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/.agents/skills/omg/api-twin/openai.yaml +12 -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/data-lineage/SKILL.md +11 -0
- package/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/.agents/skills/omg/health/SKILL.md +11 -0
- package/.agents/skills/omg/health/openai.yaml +11 -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/incident-replay/SKILL.md +11 -0
- package/.agents/skills/omg/incident-replay/openai.yaml +12 -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/preflight/SKILL.md +11 -0
- package/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/.agents/skills/omg/vision/SKILL.md +11 -0
- package/.agents/skills/omg/vision/openai.yaml +11 -0
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/.claude-plugin/scripts/uninstall.sh +2 -2
- package/.mcp.json +20 -4
- package/CHANGELOG.md +10 -0
- package/OMG-setup.sh +9 -3
- package/OMG_COMPAT_CONTRACT.md +92 -0
- package/README.md +24 -4
- 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/__init__.py +1 -0
- package/control_plane/__init__.py +2 -0
- package/control_plane/openapi.yaml +228 -0
- package/control_plane/server.py +123 -0
- package/control_plane/service.py +185 -0
- package/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/dist/enterprise/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -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/data-lineage/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/health/openai.yaml +11 -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/incident-replay/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -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/preflight/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/robotics/openai.yaml +11 -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/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/dist/enterprise/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/vision/openai.yaml +11 -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/registry/bundles/algorithms.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +61 -0
- package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/health.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/dist/enterprise/bundle/registry/bundles/preflight.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/dist/enterprise/bundle/registry/bundles/robotics.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/dist/enterprise/bundle/registry/bundles/security-check.yaml +50 -0
- package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/vision.yaml +45 -0
- package/dist/enterprise/bundle/registry/omg-capability.schema.json +80 -0
- package/dist/enterprise/bundle/settings.json +381 -0
- package/dist/enterprise/manifest.json +255 -0
- package/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/dist/public/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -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/data-lineage/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/health/openai.yaml +11 -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/incident-replay/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -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/preflight/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/robotics/openai.yaml +11 -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/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/dist/public/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/vision/openai.yaml +11 -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/registry/bundles/algorithms.yaml +45 -0
- package/dist/public/bundle/registry/bundles/api-twin.yaml +48 -0
- package/dist/public/bundle/registry/bundles/control-plane.yaml +61 -0
- package/dist/public/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/dist/public/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/dist/public/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/dist/public/bundle/registry/bundles/health.yaml +45 -0
- package/dist/public/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/dist/public/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/dist/public/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/dist/public/bundle/registry/bundles/preflight.yaml +48 -0
- package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/dist/public/bundle/registry/bundles/robotics.yaml +45 -0
- package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/dist/public/bundle/registry/bundles/security-check.yaml +50 -0
- package/dist/public/bundle/registry/bundles/tracebank.yaml +47 -0
- package/dist/public/bundle/registry/bundles/vision.yaml +45 -0
- package/dist/public/bundle/registry/omg-capability.schema.json +80 -0
- package/dist/public/bundle/settings.json +379 -0
- package/dist/public/manifest.json +255 -0
- package/docs/assets/omg-hud.svg +32 -0
- package/docs/install/claude-code.md +31 -0
- package/docs/install/codex.md +29 -0
- package/docs/migration/native-adoption.md +57 -0
- package/docs/proof.md +55 -0
- package/docs/release-checklist.md +38 -0
- package/docs/transcripts/crazy.md +17 -0
- package/docs/transcripts/setup.md +25 -0
- package/hooks/policy_engine.py +38 -7
- package/hooks/post-write.py +1 -1
- package/hooks/prompt-enhancer.py +1 -1
- package/hooks/security_validators.py +75 -0
- package/hooks/setup_wizard.py +43 -8
- package/hooks/shadow_manager.py +28 -2
- package/package.json +1 -1
- package/plugins/README.md +3 -1
- package/plugins/__init__.py +1 -0
- 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 +38 -2
- package/registry/__init__.py +1 -0
- package/registry/bundles/algorithms.yaml +45 -0
- package/registry/bundles/api-twin.yaml +48 -0
- package/registry/bundles/control-plane.yaml +61 -0
- package/registry/bundles/data-lineage.yaml +47 -0
- package/registry/bundles/delta-classifier.yaml +47 -0
- package/registry/bundles/eval-gate.yaml +47 -0
- package/registry/bundles/health.yaml +45 -0
- package/registry/bundles/hook-governor.yaml +97 -0
- package/registry/bundles/incident-replay.yaml +47 -0
- package/registry/bundles/lsp-pack.yaml +48 -0
- package/registry/bundles/mcp-fabric.yaml +53 -0
- package/registry/bundles/preflight.yaml +48 -0
- package/registry/bundles/remote-supervisor.yaml +49 -0
- package/registry/bundles/robotics.yaml +45 -0
- package/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/registry/bundles/security-check.yaml +50 -0
- package/registry/bundles/tracebank.yaml +47 -0
- package/registry/bundles/vision.yaml +45 -0
- package/registry/omg-capability.schema.json +80 -0
- package/registry/verify_artifact.py +90 -0
- package/runtime/adapters/claude.py +3 -0
- package/runtime/adapters/gpt.py +3 -0
- package/runtime/adapters/local.py +3 -0
- package/runtime/adoption.py +1 -1
- package/runtime/api_twin.py +179 -0
- package/runtime/asset_loader.py +62 -0
- package/runtime/compat.py +24 -3
- package/runtime/contract_compiler.py +847 -0
- package/runtime/data_lineage.py +73 -0
- package/runtime/delta_classifier.py +81 -0
- package/runtime/domain_packs.py +46 -0
- package/runtime/ecosystem.py +1 -1
- package/runtime/eval_gate.py +50 -0
- package/runtime/guide_assert.py +45 -0
- package/runtime/incident_replay.py +47 -0
- package/runtime/mcp_config_writers.py +147 -30
- package/runtime/mcp_memory_server.py +1 -1
- package/runtime/omg_compat_contract_snapshot.json +9 -8
- package/runtime/omg_contract_snapshot.json +9 -8
- package/runtime/omg_mcp_server.py +207 -0
- package/runtime/preflight.py +73 -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/remote_supervisor.py +64 -0
- package/runtime/runtime_profile.py +61 -0
- package/runtime/security_check.py +464 -0
- package/runtime/subagent_dispatcher.py +117 -10
- package/runtime/team_router.py +3 -1
- package/runtime/tracebank.py +53 -0
- package/runtime/untrusted_content.py +102 -0
- package/scripts/omg.py +360 -2
- package/settings.json +81 -18
- package/tools/python_repl.py +33 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
id: secure-worktree-pipeline
|
|
2
|
+
kind: runtime
|
|
3
|
+
version: 2.0.5
|
|
4
|
+
title: OMG Secure Worktree Pipeline
|
|
5
|
+
description: Ephemeral worktree execution and supervisor-safe worker dispatch for production jobs.
|
|
6
|
+
hosts:
|
|
7
|
+
- claude
|
|
8
|
+
- codex
|
|
9
|
+
assets:
|
|
10
|
+
references:
|
|
11
|
+
- runtime/subagent_dispatcher.py
|
|
12
|
+
- hooks/branch_manager.py
|
|
13
|
+
invocation_policy:
|
|
14
|
+
user_invocable: false
|
|
15
|
+
model_invocable: true
|
|
16
|
+
allow_implicit_invocation: false
|
|
17
|
+
tool_policy:
|
|
18
|
+
side_effect_level: high
|
|
19
|
+
allowed_tools:
|
|
20
|
+
claude:
|
|
21
|
+
- Read
|
|
22
|
+
- Bash(git:*)
|
|
23
|
+
codex:
|
|
24
|
+
- Read
|
|
25
|
+
- Bash(git:*)
|
|
26
|
+
lifecycle_hooks:
|
|
27
|
+
native:
|
|
28
|
+
- SessionStart
|
|
29
|
+
- Stop
|
|
30
|
+
emulated:
|
|
31
|
+
- WorktreeCreate
|
|
32
|
+
- WorktreeRemove
|
|
33
|
+
- SubagentStart
|
|
34
|
+
- SubagentStop
|
|
35
|
+
- TaskCompleted
|
|
36
|
+
mcp_contract:
|
|
37
|
+
servers:
|
|
38
|
+
- omg-control
|
|
39
|
+
lsp_contract:
|
|
40
|
+
languages:
|
|
41
|
+
- python
|
|
42
|
+
evidence_outputs:
|
|
43
|
+
artifacts:
|
|
44
|
+
- .omg/evidence/subagents/*.json
|
|
45
|
+
execution_contract:
|
|
46
|
+
modes:
|
|
47
|
+
- automation
|
|
48
|
+
- ephemeral_worktree
|
|
49
|
+
- local_supervisor
|
|
50
|
+
channel_overrides:
|
|
51
|
+
public:
|
|
52
|
+
worker_policy: local-only
|
|
53
|
+
enterprise:
|
|
54
|
+
worker_policy: managed-local
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
id: security-check
|
|
2
|
+
kind: security
|
|
3
|
+
version: 2.0.5
|
|
4
|
+
title: OMG Security Check
|
|
5
|
+
description: Canonical security audit bundle with provenance, trust scoring, and deterministic evidence.
|
|
6
|
+
hosts:
|
|
7
|
+
- claude
|
|
8
|
+
- codex
|
|
9
|
+
assets:
|
|
10
|
+
references:
|
|
11
|
+
- runtime/security_check.py
|
|
12
|
+
- commands/OMG:security-check.md
|
|
13
|
+
invocation_policy:
|
|
14
|
+
user_invocable: true
|
|
15
|
+
model_invocable: true
|
|
16
|
+
allow_implicit_invocation: false
|
|
17
|
+
tool_policy:
|
|
18
|
+
side_effect_level: medium
|
|
19
|
+
allowed_tools:
|
|
20
|
+
claude:
|
|
21
|
+
- Read
|
|
22
|
+
- Grep
|
|
23
|
+
- Bash(python3:*)
|
|
24
|
+
codex:
|
|
25
|
+
- Read
|
|
26
|
+
- Grep
|
|
27
|
+
- Bash(python3:*)
|
|
28
|
+
lifecycle_hooks:
|
|
29
|
+
native:
|
|
30
|
+
- PostToolUse
|
|
31
|
+
emulated:
|
|
32
|
+
- TaskCompleted
|
|
33
|
+
mcp_contract:
|
|
34
|
+
servers:
|
|
35
|
+
- omg-control
|
|
36
|
+
lsp_contract:
|
|
37
|
+
languages:
|
|
38
|
+
- python
|
|
39
|
+
evidence_outputs:
|
|
40
|
+
artifacts:
|
|
41
|
+
- .omg/evidence/security-check-*.json
|
|
42
|
+
execution_contract:
|
|
43
|
+
modes:
|
|
44
|
+
- embedded
|
|
45
|
+
- local_supervisor
|
|
46
|
+
channel_overrides:
|
|
47
|
+
public:
|
|
48
|
+
posture: self-serve
|
|
49
|
+
enterprise:
|
|
50
|
+
posture: managed
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
id: tracebank
|
|
2
|
+
kind: evidence
|
|
3
|
+
version: 2.0.5
|
|
4
|
+
title: OMG Tracebank
|
|
5
|
+
description: Structured plan-to-patch-to-verify trace capture for OMG routes.
|
|
6
|
+
hosts:
|
|
7
|
+
- claude
|
|
8
|
+
- codex
|
|
9
|
+
assets:
|
|
10
|
+
references:
|
|
11
|
+
- runtime/tracebank.py
|
|
12
|
+
invocation_policy:
|
|
13
|
+
user_invocable: true
|
|
14
|
+
model_invocable: true
|
|
15
|
+
allow_implicit_invocation: true
|
|
16
|
+
tool_policy:
|
|
17
|
+
side_effect_level: medium
|
|
18
|
+
allowed_tools:
|
|
19
|
+
claude:
|
|
20
|
+
- Read
|
|
21
|
+
- Bash(python3:*)
|
|
22
|
+
codex:
|
|
23
|
+
- Read
|
|
24
|
+
- Bash(python3:*)
|
|
25
|
+
lifecycle_hooks:
|
|
26
|
+
native:
|
|
27
|
+
- PostToolUse
|
|
28
|
+
emulated:
|
|
29
|
+
- TaskCompleted
|
|
30
|
+
mcp_contract:
|
|
31
|
+
servers:
|
|
32
|
+
- omg-control
|
|
33
|
+
lsp_contract:
|
|
34
|
+
languages:
|
|
35
|
+
- python
|
|
36
|
+
evidence_outputs:
|
|
37
|
+
artifacts:
|
|
38
|
+
- .omg/tracebank/events.jsonl
|
|
39
|
+
execution_contract:
|
|
40
|
+
modes:
|
|
41
|
+
- embedded
|
|
42
|
+
- local_supervisor
|
|
43
|
+
channel_overrides:
|
|
44
|
+
public:
|
|
45
|
+
retention: project-local
|
|
46
|
+
enterprise:
|
|
47
|
+
retention: policy-managed
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
id: vision
|
|
2
|
+
kind: domain-pack
|
|
3
|
+
version: 2.0.5
|
|
4
|
+
title: OMG Vision Pack
|
|
5
|
+
description: Vision-specific lineage, drift, and replay attachments.
|
|
6
|
+
hosts:
|
|
7
|
+
- claude
|
|
8
|
+
- codex
|
|
9
|
+
assets:
|
|
10
|
+
references:
|
|
11
|
+
- runtime/domain_packs.py
|
|
12
|
+
invocation_policy:
|
|
13
|
+
user_invocable: true
|
|
14
|
+
model_invocable: true
|
|
15
|
+
allow_implicit_invocation: false
|
|
16
|
+
tool_policy:
|
|
17
|
+
side_effect_level: medium
|
|
18
|
+
allowed_tools:
|
|
19
|
+
claude:
|
|
20
|
+
- Read
|
|
21
|
+
codex:
|
|
22
|
+
- Read
|
|
23
|
+
lifecycle_hooks:
|
|
24
|
+
native:
|
|
25
|
+
- PostToolUse
|
|
26
|
+
emulated:
|
|
27
|
+
- TaskCompleted
|
|
28
|
+
mcp_contract:
|
|
29
|
+
servers:
|
|
30
|
+
- omg-control
|
|
31
|
+
lsp_contract:
|
|
32
|
+
languages:
|
|
33
|
+
- python
|
|
34
|
+
evidence_outputs:
|
|
35
|
+
artifacts:
|
|
36
|
+
- .omg/lineage/*.json
|
|
37
|
+
execution_contract:
|
|
38
|
+
modes:
|
|
39
|
+
- embedded
|
|
40
|
+
- local_supervisor
|
|
41
|
+
channel_overrides:
|
|
42
|
+
public:
|
|
43
|
+
drift_checks: advisory
|
|
44
|
+
enterprise:
|
|
45
|
+
drift_checks: required
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/trac3er00/OMG/registry/omg-capability.schema.json",
|
|
4
|
+
"title": "OMG Capability Bundle",
|
|
5
|
+
"version": "2.0.5",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"id",
|
|
9
|
+
"kind",
|
|
10
|
+
"version",
|
|
11
|
+
"title",
|
|
12
|
+
"description",
|
|
13
|
+
"hosts",
|
|
14
|
+
"assets",
|
|
15
|
+
"invocation_policy",
|
|
16
|
+
"tool_policy",
|
|
17
|
+
"lifecycle_hooks",
|
|
18
|
+
"mcp_contract",
|
|
19
|
+
"lsp_contract",
|
|
20
|
+
"evidence_outputs",
|
|
21
|
+
"execution_contract",
|
|
22
|
+
"channel_overrides"
|
|
23
|
+
],
|
|
24
|
+
"properties": {
|
|
25
|
+
"id": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"kind": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"version": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"title": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"description": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"hosts": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"enum": [
|
|
45
|
+
"claude",
|
|
46
|
+
"codex"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"minItems": 1
|
|
50
|
+
},
|
|
51
|
+
"assets": {
|
|
52
|
+
"type": "object"
|
|
53
|
+
},
|
|
54
|
+
"invocation_policy": {
|
|
55
|
+
"type": "object"
|
|
56
|
+
},
|
|
57
|
+
"tool_policy": {
|
|
58
|
+
"type": "object"
|
|
59
|
+
},
|
|
60
|
+
"lifecycle_hooks": {
|
|
61
|
+
"type": "object"
|
|
62
|
+
},
|
|
63
|
+
"mcp_contract": {
|
|
64
|
+
"type": "object"
|
|
65
|
+
},
|
|
66
|
+
"lsp_contract": {
|
|
67
|
+
"type": "object"
|
|
68
|
+
},
|
|
69
|
+
"evidence_outputs": {
|
|
70
|
+
"type": "object"
|
|
71
|
+
},
|
|
72
|
+
"execution_contract": {
|
|
73
|
+
"type": "object"
|
|
74
|
+
},
|
|
75
|
+
"channel_overrides": {
|
|
76
|
+
"type": "object"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"additionalProperties": true
|
|
80
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""OMG v1 supply-chain verification with Warn-and-Run semantics."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class SupplyArtifact:
|
|
10
|
+
id: str
|
|
11
|
+
signer: str | None
|
|
12
|
+
checksum: str | None
|
|
13
|
+
permissions: list[str]
|
|
14
|
+
static_scan: list[dict[str, Any]]
|
|
15
|
+
risk_level: str = "low"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _normalize(artifact: dict[str, Any]) -> SupplyArtifact:
|
|
19
|
+
return SupplyArtifact(
|
|
20
|
+
id=str(artifact.get("id", "unknown")),
|
|
21
|
+
signer=artifact.get("signer"),
|
|
22
|
+
checksum=artifact.get("checksum"),
|
|
23
|
+
permissions=[str(p) for p in artifact.get("permissions", [])],
|
|
24
|
+
static_scan=[f for f in artifact.get("static_scan", []) if isinstance(f, dict)],
|
|
25
|
+
risk_level=str(artifact.get("risk_level", "low")).lower(),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def verify_artifact(artifact: dict[str, Any], mode: str = "warn_and_run") -> dict[str, Any]:
|
|
30
|
+
a = _normalize(artifact)
|
|
31
|
+
reasons: list[str] = []
|
|
32
|
+
controls: list[str] = []
|
|
33
|
+
|
|
34
|
+
for finding in a.static_scan:
|
|
35
|
+
sev = str(finding.get("severity", "")).lower()
|
|
36
|
+
if sev == "critical":
|
|
37
|
+
reasons.append("critical static scan finding")
|
|
38
|
+
return {
|
|
39
|
+
"action": "deny",
|
|
40
|
+
"risk_level": "critical",
|
|
41
|
+
"reason": "; ".join(reasons),
|
|
42
|
+
"controls": ["block-execution"],
|
|
43
|
+
"trusted": False,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
perm_blob = " ".join(a.permissions).lower()
|
|
47
|
+
if any(token in perm_blob for token in ["sudo", "rm -rf", "--privileged", "curl |", "wget |"]):
|
|
48
|
+
return {
|
|
49
|
+
"action": "deny",
|
|
50
|
+
"risk_level": "critical",
|
|
51
|
+
"reason": "critical permission profile",
|
|
52
|
+
"controls": ["block-execution"],
|
|
53
|
+
"trusted": False,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if not a.signer or not a.checksum:
|
|
57
|
+
reasons.append("missing signer/checksum")
|
|
58
|
+
controls.extend(["isolate-network", "read-only-fs", "manual-approval"])
|
|
59
|
+
if mode == "warn_and_run":
|
|
60
|
+
return {
|
|
61
|
+
"action": "ask",
|
|
62
|
+
"risk_level": "high",
|
|
63
|
+
"reason": "; ".join(reasons),
|
|
64
|
+
"controls": controls,
|
|
65
|
+
"trusted": False,
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
"action": "deny",
|
|
69
|
+
"risk_level": "high",
|
|
70
|
+
"reason": "; ".join(reasons),
|
|
71
|
+
"controls": ["block-execution"],
|
|
72
|
+
"trusted": False,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if any(str(f.get("severity", "")).lower() == "high" for f in a.static_scan):
|
|
76
|
+
return {
|
|
77
|
+
"action": "ask",
|
|
78
|
+
"risk_level": "high",
|
|
79
|
+
"reason": "high severity findings present",
|
|
80
|
+
"controls": ["manual-approval"],
|
|
81
|
+
"trusted": False,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
"action": "allow",
|
|
86
|
+
"risk_level": a.risk_level if a.risk_level in {"low", "med", "high", "critical"} else "low",
|
|
87
|
+
"reason": "artifact verified",
|
|
88
|
+
"controls": [],
|
|
89
|
+
"trusted": True,
|
|
90
|
+
}
|
|
@@ -27,6 +27,7 @@ class ClaudeAdapter:
|
|
|
27
27
|
"runtime": self.runtime,
|
|
28
28
|
"phase": "execute",
|
|
29
29
|
"status": "executed",
|
|
30
|
+
"worker_mode": "stub",
|
|
30
31
|
"operations": [
|
|
31
32
|
"apply-plan",
|
|
32
33
|
"collect-diff",
|
|
@@ -43,6 +44,7 @@ class ClaudeAdapter:
|
|
|
43
44
|
"checks": [
|
|
44
45
|
{"name": "tests", "passed": True},
|
|
45
46
|
{"name": "security", "passed": True},
|
|
47
|
+
{"name": "worker_implementation", "passed": False, "mode": "stub"},
|
|
46
48
|
],
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -57,4 +59,5 @@ class ClaudeAdapter:
|
|
|
57
59
|
"diff_summary": {},
|
|
58
60
|
"reproducibility": {"seed": "deterministic"},
|
|
59
61
|
"unresolved_risks": [],
|
|
62
|
+
"worker_mode": "stub",
|
|
60
63
|
}
|
package/runtime/adapters/gpt.py
CHANGED
|
@@ -23,6 +23,7 @@ class GPTAdapter:
|
|
|
23
23
|
"runtime": self.runtime,
|
|
24
24
|
"phase": "execute",
|
|
25
25
|
"status": "executed",
|
|
26
|
+
"worker_mode": "stub",
|
|
26
27
|
"operations": ["apply-plan", "collect-diff"],
|
|
27
28
|
"errors": [],
|
|
28
29
|
}
|
|
@@ -36,6 +37,7 @@ class GPTAdapter:
|
|
|
36
37
|
"checks": [
|
|
37
38
|
{"name": "tests", "passed": True},
|
|
38
39
|
{"name": "security", "passed": True},
|
|
40
|
+
{"name": "worker_implementation", "passed": False, "mode": "stub"},
|
|
39
41
|
],
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -50,4 +52,5 @@ class GPTAdapter:
|
|
|
50
52
|
"diff_summary": {},
|
|
51
53
|
"reproducibility": {"seed": "deterministic"},
|
|
52
54
|
"unresolved_risks": [],
|
|
55
|
+
"worker_mode": "stub",
|
|
53
56
|
}
|
|
@@ -23,6 +23,7 @@ class LocalAdapter:
|
|
|
23
23
|
"runtime": self.runtime,
|
|
24
24
|
"phase": "execute",
|
|
25
25
|
"status": "executed",
|
|
26
|
+
"worker_mode": "stub",
|
|
26
27
|
"operations": ["apply-plan", "collect-diff"],
|
|
27
28
|
"errors": [],
|
|
28
29
|
}
|
|
@@ -36,6 +37,7 @@ class LocalAdapter:
|
|
|
36
37
|
"checks": [
|
|
37
38
|
{"name": "tests", "passed": True},
|
|
38
39
|
{"name": "security", "passed": True},
|
|
40
|
+
{"name": "worker_implementation", "passed": False, "mode": "stub"},
|
|
39
41
|
],
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -50,4 +52,5 @@ class LocalAdapter:
|
|
|
50
52
|
"diff_summary": {},
|
|
51
53
|
"reproducibility": {"seed": "deterministic"},
|
|
52
54
|
"unresolved_risks": [],
|
|
55
|
+
"worker_mode": "stub",
|
|
53
56
|
}
|
package/runtime/adoption.py
CHANGED
|
@@ -11,7 +11,7 @@ CANONICAL_REPO_URL = "https://github.com/trac3er00/OMG"
|
|
|
11
11
|
CANONICAL_PACKAGE_NAME = "@trac3er/oh-my-god"
|
|
12
12
|
CANONICAL_PLUGIN_ID = "omg"
|
|
13
13
|
CANONICAL_MARKETPLACE_ID = "omg"
|
|
14
|
-
CANONICAL_VERSION = "2.0.
|
|
14
|
+
CANONICAL_VERSION = "2.0.5"
|
|
15
15
|
|
|
16
16
|
VALID_ADOPTION_MODES = ("omg-only", "coexist")
|
|
17
17
|
VALID_PRESETS = ("safe", "balanced", "interop", "labs")
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""Fixture-based API twin state and replay helpers."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import time
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
STATE_REL_PATH = Path(".omg") / "state" / "api_twin.json"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def ingest_contract(project_dir: str, *, name: str, source_path: str) -> dict[str, Any]:
|
|
14
|
+
state = _load_state(project_dir)
|
|
15
|
+
contract_path = Path(source_path)
|
|
16
|
+
contract = {
|
|
17
|
+
"name": name,
|
|
18
|
+
"source_path": str(contract_path),
|
|
19
|
+
"content": contract_path.read_text(encoding="utf-8"),
|
|
20
|
+
"fidelity": "schema-only",
|
|
21
|
+
}
|
|
22
|
+
state.setdefault("contracts", {})[name] = contract
|
|
23
|
+
_save_state(project_dir, state)
|
|
24
|
+
return {
|
|
25
|
+
"schema": "ApiTwinContract",
|
|
26
|
+
"name": name,
|
|
27
|
+
"fidelity": "schema-only",
|
|
28
|
+
"source_path": str(contract_path),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def record_fixture(
|
|
33
|
+
project_dir: str,
|
|
34
|
+
*,
|
|
35
|
+
name: str,
|
|
36
|
+
endpoint: str = "default",
|
|
37
|
+
cassette_version: str = "v1",
|
|
38
|
+
request: dict[str, Any],
|
|
39
|
+
response: dict[str, Any],
|
|
40
|
+
validated: bool,
|
|
41
|
+
redactions: dict[str, str] | None = None,
|
|
42
|
+
) -> dict[str, Any]:
|
|
43
|
+
state = _load_state(project_dir)
|
|
44
|
+
fixture = {
|
|
45
|
+
"name": name,
|
|
46
|
+
"endpoint": endpoint,
|
|
47
|
+
"cassette_version": cassette_version,
|
|
48
|
+
"request": request,
|
|
49
|
+
"response": response,
|
|
50
|
+
"fidelity": "recorded-validated" if validated else "recorded",
|
|
51
|
+
"validated": validated,
|
|
52
|
+
"redactions": redactions or {},
|
|
53
|
+
}
|
|
54
|
+
fixtures = state.setdefault("fixtures", {}).setdefault(name, {})
|
|
55
|
+
fixtures[_fixture_key(endpoint, cassette_version)] = fixture
|
|
56
|
+
_save_state(project_dir, state)
|
|
57
|
+
return {
|
|
58
|
+
"schema": "ApiTwinFixture",
|
|
59
|
+
"name": name,
|
|
60
|
+
"endpoint": endpoint,
|
|
61
|
+
"cassette_version": cassette_version,
|
|
62
|
+
"fidelity": fixture["fidelity"],
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def serve_fixture(
|
|
67
|
+
project_dir: str,
|
|
68
|
+
*,
|
|
69
|
+
name: str,
|
|
70
|
+
endpoint: str = "default",
|
|
71
|
+
cassette_version: str = "v1",
|
|
72
|
+
latency_ms: int = 0,
|
|
73
|
+
failure_mode: str = "",
|
|
74
|
+
schema_drift: bool = False,
|
|
75
|
+
) -> dict[str, Any]:
|
|
76
|
+
state = _load_state(project_dir)
|
|
77
|
+
fixture = _fixture(state, name, endpoint=endpoint, cassette_version=cassette_version)
|
|
78
|
+
response = dict(fixture.get("response", {}))
|
|
79
|
+
fidelity = str(fixture.get("fidelity", "recorded"))
|
|
80
|
+
if latency_ms > 0:
|
|
81
|
+
time.sleep(max(latency_ms, 0) / 1000)
|
|
82
|
+
if schema_drift:
|
|
83
|
+
response["__schema_drift__"] = True
|
|
84
|
+
fidelity = "stale"
|
|
85
|
+
if failure_mode:
|
|
86
|
+
response = {"error": failure_mode}
|
|
87
|
+
fidelity = "stale"
|
|
88
|
+
return {
|
|
89
|
+
"schema": "ApiTwinServeResult",
|
|
90
|
+
"name": name,
|
|
91
|
+
"endpoint": endpoint,
|
|
92
|
+
"cassette_version": cassette_version,
|
|
93
|
+
"latency_ms": latency_ms,
|
|
94
|
+
"failure_mode": failure_mode,
|
|
95
|
+
"fidelity": fidelity,
|
|
96
|
+
"response": response,
|
|
97
|
+
"report": {
|
|
98
|
+
"saved_live_calls": 1,
|
|
99
|
+
"saved_cost_estimate": round(len(json.dumps(response)) * 0.0001, 4),
|
|
100
|
+
"redactions": fixture.get("redactions", {}),
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def verify_fixture(
|
|
106
|
+
project_dir: str,
|
|
107
|
+
*,
|
|
108
|
+
name: str,
|
|
109
|
+
endpoint: str = "default",
|
|
110
|
+
cassette_version: str = "v1",
|
|
111
|
+
live_response: dict[str, Any],
|
|
112
|
+
) -> dict[str, Any]:
|
|
113
|
+
state = _load_state(project_dir)
|
|
114
|
+
fixture = _fixture(state, name, endpoint=endpoint, cassette_version=cassette_version)
|
|
115
|
+
matches_live = fixture.get("response", {}) == live_response
|
|
116
|
+
fidelity = "recorded-validated" if matches_live else "stale"
|
|
117
|
+
fixture["fidelity"] = fidelity
|
|
118
|
+
fixture["validated"] = matches_live
|
|
119
|
+
state.setdefault("fixtures", {}).setdefault(name, {})[_fixture_key(endpoint, cassette_version)] = fixture
|
|
120
|
+
_save_state(project_dir, state)
|
|
121
|
+
return {
|
|
122
|
+
"schema": "ApiTwinVerifyResult",
|
|
123
|
+
"name": name,
|
|
124
|
+
"endpoint": endpoint,
|
|
125
|
+
"cassette_version": cassette_version,
|
|
126
|
+
"fidelity": fidelity,
|
|
127
|
+
"matches_live": matches_live,
|
|
128
|
+
"live_verification_required": True,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def _state_path(project_dir: str) -> Path:
|
|
133
|
+
return Path(project_dir) / STATE_REL_PATH
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _load_state(project_dir: str) -> dict[str, Any]:
|
|
137
|
+
path = _state_path(project_dir)
|
|
138
|
+
if not path.exists():
|
|
139
|
+
return {"schema": "ApiTwinState", "version": "2.0.5", "contracts": {}, "fixtures": {}}
|
|
140
|
+
try:
|
|
141
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
142
|
+
except (OSError, json.JSONDecodeError):
|
|
143
|
+
return {"schema": "ApiTwinState", "version": "2.0.5", "contracts": {}, "fixtures": {}}
|
|
144
|
+
if not isinstance(payload, dict):
|
|
145
|
+
return {"schema": "ApiTwinState", "version": "2.0.5", "contracts": {}, "fixtures": {}}
|
|
146
|
+
payload.setdefault("schema", "ApiTwinState")
|
|
147
|
+
payload.setdefault("version", "2.0.5")
|
|
148
|
+
payload.setdefault("contracts", {})
|
|
149
|
+
payload.setdefault("fixtures", {})
|
|
150
|
+
return payload
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _save_state(project_dir: str, payload: dict[str, Any]) -> None:
|
|
154
|
+
path = _state_path(project_dir)
|
|
155
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
156
|
+
path.write_text(json.dumps(payload, indent=2, ensure_ascii=True) + "\n", encoding="utf-8")
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _fixture_key(endpoint: str, cassette_version: str) -> str:
|
|
160
|
+
return f"{endpoint}::{cassette_version}"
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _fixture(
|
|
164
|
+
state: dict[str, Any],
|
|
165
|
+
name: str,
|
|
166
|
+
*,
|
|
167
|
+
endpoint: str = "default",
|
|
168
|
+
cassette_version: str = "v1",
|
|
169
|
+
) -> dict[str, Any]:
|
|
170
|
+
fixtures = state.get("fixtures", {})
|
|
171
|
+
if not isinstance(fixtures, dict) or name not in fixtures:
|
|
172
|
+
raise ValueError(f"Unknown API twin fixture: {name}")
|
|
173
|
+
fixture_group = fixtures[name]
|
|
174
|
+
if not isinstance(fixture_group, dict):
|
|
175
|
+
raise ValueError(f"Invalid API twin fixture: {name}")
|
|
176
|
+
fixture = fixture_group.get(_fixture_key(endpoint, cassette_version))
|
|
177
|
+
if not isinstance(fixture, dict):
|
|
178
|
+
raise ValueError(f"Unknown API twin cassette: {name} {endpoint} {cassette_version}")
|
|
179
|
+
return fixture
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Helpers for locating packaged OMG assets from source checkouts or installs."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from importlib import metadata
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
_DIST_NAMES = ("oh-my-god", "oh_my_god")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def project_root() -> Path:
|
|
12
|
+
return Path(__file__).resolve().parents[1]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def resolve_asset(rel_path: str | Path) -> Path:
|
|
16
|
+
rel = Path(rel_path)
|
|
17
|
+
candidate = project_root() / rel
|
|
18
|
+
if candidate.exists():
|
|
19
|
+
return candidate
|
|
20
|
+
|
|
21
|
+
rel_posix = rel.as_posix()
|
|
22
|
+
for dist_name in _DIST_NAMES:
|
|
23
|
+
try:
|
|
24
|
+
dist = metadata.distribution(dist_name)
|
|
25
|
+
except metadata.PackageNotFoundError:
|
|
26
|
+
continue
|
|
27
|
+
for file in dist.files or []:
|
|
28
|
+
if str(file).endswith(rel_posix):
|
|
29
|
+
located = Path(dist.locate_file(file))
|
|
30
|
+
if located.exists():
|
|
31
|
+
return located
|
|
32
|
+
|
|
33
|
+
raise FileNotFoundError(f"Unable to resolve packaged OMG asset: {rel_posix}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def resolve_assets(prefix: str | Path, suffix: str = "") -> list[Path]:
|
|
37
|
+
prefix_path = Path(prefix)
|
|
38
|
+
root_candidate = project_root() / prefix_path
|
|
39
|
+
if root_candidate.exists():
|
|
40
|
+
if root_candidate.is_dir():
|
|
41
|
+
if suffix:
|
|
42
|
+
return sorted(path for path in root_candidate.rglob("*") if path.is_file() and path.name.endswith(suffix))
|
|
43
|
+
return sorted(path for path in root_candidate.rglob("*") if path.is_file())
|
|
44
|
+
return [root_candidate]
|
|
45
|
+
|
|
46
|
+
prefix_posix = prefix_path.as_posix().rstrip("/")
|
|
47
|
+
matched: list[Path] = []
|
|
48
|
+
for dist_name in _DIST_NAMES:
|
|
49
|
+
try:
|
|
50
|
+
dist = metadata.distribution(dist_name)
|
|
51
|
+
except metadata.PackageNotFoundError:
|
|
52
|
+
continue
|
|
53
|
+
for file in dist.files or []:
|
|
54
|
+
file_text = str(file)
|
|
55
|
+
if not file_text.startswith(prefix_posix):
|
|
56
|
+
continue
|
|
57
|
+
if suffix and not file_text.endswith(suffix):
|
|
58
|
+
continue
|
|
59
|
+
located = Path(dist.locate_file(file))
|
|
60
|
+
if located.exists() and located.is_file():
|
|
61
|
+
matched.append(located)
|
|
62
|
+
return sorted(matched)
|