contextbridge-agents 0.1.0__py3-none-any.whl
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.
- contextbridge/__init__.py +15 -0
- contextbridge/__main__.py +8 -0
- contextbridge/adapters/__init__.py +22 -0
- contextbridge/adapters/antigravity.py +112 -0
- contextbridge/adapters/base.py +175 -0
- contextbridge/adapters/claude.py +85 -0
- contextbridge/adapters/codex.py +90 -0
- contextbridge/adapters/cursor.py +136 -0
- contextbridge/adapters/gemini_cli.py +110 -0
- contextbridge/adapters/opencode.py +121 -0
- contextbridge/adapters/registry.py +47 -0
- contextbridge/backup/__init__.py +3 -0
- contextbridge/backup/manager.py +476 -0
- contextbridge/cli.py +676 -0
- contextbridge/core/__init__.py +14 -0
- contextbridge/core/discovery.py +145 -0
- contextbridge/core/doctor.py +304 -0
- contextbridge/core/exceptions.py +83 -0
- contextbridge/core/paths.py +80 -0
- contextbridge/models/__init__.py +63 -0
- contextbridge/models/agent.py +81 -0
- contextbridge/models/backup.py +67 -0
- contextbridge/models/doctor.py +53 -0
- contextbridge/models/migration.py +74 -0
- contextbridge/models/skill.py +118 -0
- contextbridge/py.typed +0 -0
- contextbridge/security/__init__.py +30 -0
- contextbridge/security/archive.py +150 -0
- contextbridge/security/audit.py +120 -0
- contextbridge/security/limits.py +22 -0
- contextbridge/security/paths.py +360 -0
- contextbridge/security/secrets.py +216 -0
- contextbridge/skills/__init__.py +3 -0
- contextbridge/skills/exporter.py +162 -0
- contextbridge/skills/migrator.py +394 -0
- contextbridge/skills/parser.py +325 -0
- contextbridge/skills/validator.py +417 -0
- contextbridge/utils/__init__.py +22 -0
- contextbridge/utils/console.py +76 -0
- contextbridge/utils/fs.py +84 -0
- contextbridge/utils/hashing.py +22 -0
- contextbridge_agents-0.1.0.dist-info/METADATA +309 -0
- contextbridge_agents-0.1.0.dist-info/RECORD +46 -0
- contextbridge_agents-0.1.0.dist-info/WHEEL +4 -0
- contextbridge_agents-0.1.0.dist-info/entry_points.txt +2 -0
- contextbridge_agents-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""ContextBridge — Your context. Any agent. No lock-in."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__app_name__ = "ContextBridge"
|
|
6
|
+
__distribution_name__ = "contextbridge-agents"
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
__slogan__ = "Your context. Any agent. No lock-in."
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"__app_name__",
|
|
12
|
+
"__distribution_name__",
|
|
13
|
+
"__slogan__",
|
|
14
|
+
"__version__",
|
|
15
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""AI coding agent adapters."""
|
|
2
|
+
|
|
3
|
+
from contextbridge.adapters.antigravity import AntigravityAdapter
|
|
4
|
+
from contextbridge.adapters.base import BaseAgentAdapter
|
|
5
|
+
from contextbridge.adapters.claude import ClaudeCodeAdapter
|
|
6
|
+
from contextbridge.adapters.codex import CodexAdapter
|
|
7
|
+
from contextbridge.adapters.cursor import CursorAdapter
|
|
8
|
+
from contextbridge.adapters.gemini_cli import GeminiCliAdapter
|
|
9
|
+
from contextbridge.adapters.opencode import OpenCodeAdapter
|
|
10
|
+
from contextbridge.adapters.registry import get_adapter, list_adapters
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"AntigravityAdapter",
|
|
14
|
+
"BaseAgentAdapter",
|
|
15
|
+
"ClaudeCodeAdapter",
|
|
16
|
+
"CodexAdapter",
|
|
17
|
+
"CursorAdapter",
|
|
18
|
+
"GeminiCliAdapter",
|
|
19
|
+
"OpenCodeAdapter",
|
|
20
|
+
"get_adapter",
|
|
21
|
+
"list_adapters",
|
|
22
|
+
]
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"""Google Antigravity agent adapter."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from contextbridge.adapters.base import BaseAgentAdapter
|
|
8
|
+
from contextbridge.core.paths import EnvironmentContext
|
|
9
|
+
from contextbridge.models.agent import (
|
|
10
|
+
AgentCapabilities,
|
|
11
|
+
AgentId,
|
|
12
|
+
AgentScope,
|
|
13
|
+
SkillDirectorySpec,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AntigravityAdapter(BaseAgentAdapter):
|
|
18
|
+
"""Adapter for Google Antigravity."""
|
|
19
|
+
|
|
20
|
+
agent_id = AgentId.ANTIGRAVITY
|
|
21
|
+
display_name = "Google Antigravity"
|
|
22
|
+
aliases = ("antigravity", "agy", "google-antigravity")
|
|
23
|
+
executable_names = ("agy", "antigravity")
|
|
24
|
+
capabilities = AgentCapabilities(
|
|
25
|
+
supports_agent_skills_spec=True,
|
|
26
|
+
supports_global_scope=True,
|
|
27
|
+
supports_project_scope=True,
|
|
28
|
+
supports_zip_import_documented=False,
|
|
29
|
+
zip_install_note=(
|
|
30
|
+
"Extract the Agent Skills ZIP into ~/.gemini/config/skills/ (global) or "
|
|
31
|
+
".agents/skills/ (project)."
|
|
32
|
+
),
|
|
33
|
+
extra_frontmatter_fields=(),
|
|
34
|
+
limitations=(
|
|
35
|
+
"Workspace skills may also live in legacy .agent/skills, _agents/skills, or "
|
|
36
|
+
"explicit skills.json declarations; v0.1.0 scans .agents/skills and .agent/skills.",
|
|
37
|
+
"Global path varies between ~/.gemini/config/skills (current customization guide) "
|
|
38
|
+
"and ~/.gemini/antigravity/skills (app data layouts).",
|
|
39
|
+
),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def extra_executable_candidates(self, env: EnvironmentContext) -> list[Path]:
|
|
43
|
+
candidates: list[Path] = []
|
|
44
|
+
if env.is_macos:
|
|
45
|
+
candidates.append(Path("/Applications/Antigravity.app"))
|
|
46
|
+
elif env.is_windows:
|
|
47
|
+
local_appdata = env.resolve_env_path("LOCALAPPDATA")
|
|
48
|
+
if local_appdata is not None:
|
|
49
|
+
candidates.append(local_appdata / "Programs" / "Antigravity" / "Antigravity.exe")
|
|
50
|
+
return candidates
|
|
51
|
+
|
|
52
|
+
def config_directories(self, env: EnvironmentContext) -> list[Path]:
|
|
53
|
+
return [
|
|
54
|
+
env.home_dir / ".gemini" / "config",
|
|
55
|
+
env.home_dir / ".gemini" / "antigravity",
|
|
56
|
+
env.project_dir / ".agent",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
def skill_directories(
|
|
60
|
+
self,
|
|
61
|
+
env: EnvironmentContext,
|
|
62
|
+
scope: AgentScope | None = None,
|
|
63
|
+
) -> list[SkillDirectorySpec]:
|
|
64
|
+
specs: list[SkillDirectorySpec] = []
|
|
65
|
+
if scope in (None, AgentScope.PROJECT):
|
|
66
|
+
specs.append(
|
|
67
|
+
SkillDirectorySpec(
|
|
68
|
+
path=env.project_dir / ".agents" / "skills",
|
|
69
|
+
scope=AgentScope.PROJECT,
|
|
70
|
+
is_primary=True,
|
|
71
|
+
is_shared_standard=True,
|
|
72
|
+
note="Current Antigravity workspace skills directory (shared standard).",
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
specs.append(
|
|
76
|
+
SkillDirectorySpec(
|
|
77
|
+
path=env.project_dir / ".agent" / "skills",
|
|
78
|
+
scope=AgentScope.PROJECT,
|
|
79
|
+
is_primary=False,
|
|
80
|
+
is_compatibility_alias=True,
|
|
81
|
+
note="Antigravity backward-compatibility workspace skills directory.",
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
if scope in (None, AgentScope.GLOBAL):
|
|
85
|
+
specs.append(
|
|
86
|
+
SkillDirectorySpec(
|
|
87
|
+
path=env.home_dir / ".gemini" / "config" / "skills",
|
|
88
|
+
scope=AgentScope.GLOBAL,
|
|
89
|
+
is_primary=True,
|
|
90
|
+
note="Antigravity global customization skills directory.",
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
specs.append(
|
|
94
|
+
SkillDirectorySpec(
|
|
95
|
+
path=env.home_dir / ".gemini" / "antigravity" / "skills",
|
|
96
|
+
scope=AgentScope.GLOBAL,
|
|
97
|
+
is_primary=False,
|
|
98
|
+
is_compatibility_alias=True,
|
|
99
|
+
note="Antigravity app-data global skills path variant.",
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
specs.append(
|
|
103
|
+
SkillDirectorySpec(
|
|
104
|
+
path=env.home_dir / ".agents" / "skills",
|
|
105
|
+
scope=AgentScope.GLOBAL,
|
|
106
|
+
is_primary=False,
|
|
107
|
+
is_shared_standard=True,
|
|
108
|
+
is_compatibility_alias=True,
|
|
109
|
+
note="Shared CLI global skills directory.",
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
return specs
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Base abstract adapter defining cross-platform detection and skill directory resolution."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from contextbridge.core.paths import EnvironmentContext
|
|
9
|
+
from contextbridge.models.agent import (
|
|
10
|
+
AgentCapabilities,
|
|
11
|
+
AgentDetectionResult,
|
|
12
|
+
AgentId,
|
|
13
|
+
AgentScope,
|
|
14
|
+
DetectionStatus,
|
|
15
|
+
SkillDirectorySpec,
|
|
16
|
+
)
|
|
17
|
+
from contextbridge.models.skill import SkillFrontmatter
|
|
18
|
+
from contextbridge.utils.fs import canonical_path_key, is_readable_dir, is_symlink_or_junction
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BaseAgentAdapter(ABC):
|
|
22
|
+
"""Contract implemented by every supported AI coding agent adapter."""
|
|
23
|
+
|
|
24
|
+
agent_id: AgentId
|
|
25
|
+
display_name: str
|
|
26
|
+
aliases: tuple[str, ...] = ()
|
|
27
|
+
executable_names: tuple[str, ...] = ()
|
|
28
|
+
capabilities: AgentCapabilities = AgentCapabilities()
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
def config_directories(self, env: EnvironmentContext) -> list[Path]:
|
|
32
|
+
"""Return known configuration root directories for this agent (read-only)."""
|
|
33
|
+
|
|
34
|
+
@abstractmethod
|
|
35
|
+
def skill_directories(
|
|
36
|
+
self,
|
|
37
|
+
env: EnvironmentContext,
|
|
38
|
+
scope: AgentScope | None = None,
|
|
39
|
+
) -> list[SkillDirectorySpec]:
|
|
40
|
+
"""Return known skill directories for this agent (read-only, never creates dirs)."""
|
|
41
|
+
|
|
42
|
+
def extra_executable_candidates(self, env: EnvironmentContext) -> list[Path]:
|
|
43
|
+
"""Optional OS-specific desktop/app install locations checked read-only."""
|
|
44
|
+
return []
|
|
45
|
+
|
|
46
|
+
def find_executables(self, env: EnvironmentContext) -> list[Path]:
|
|
47
|
+
"""Locate installed CLI binaries or desktop executables without running them."""
|
|
48
|
+
found: list[Path] = []
|
|
49
|
+
seen: set[str] = set()
|
|
50
|
+
for cmd in self.executable_names:
|
|
51
|
+
located = env.which(cmd)
|
|
52
|
+
if located:
|
|
53
|
+
p = Path(located)
|
|
54
|
+
key = canonical_path_key(p)
|
|
55
|
+
if key not in seen:
|
|
56
|
+
seen.add(key)
|
|
57
|
+
found.append(p)
|
|
58
|
+
for candidate in self.extra_executable_candidates(env):
|
|
59
|
+
if candidate.exists():
|
|
60
|
+
key = canonical_path_key(candidate)
|
|
61
|
+
if key not in seen:
|
|
62
|
+
seen.add(key)
|
|
63
|
+
found.append(candidate)
|
|
64
|
+
return found
|
|
65
|
+
|
|
66
|
+
def primary_write_directory(
|
|
67
|
+
self,
|
|
68
|
+
env: EnvironmentContext,
|
|
69
|
+
scope: AgentScope,
|
|
70
|
+
) -> Path:
|
|
71
|
+
"""Return the canonical target skills directory used when migrating into this agent."""
|
|
72
|
+
dirs = self.skill_directories(env, scope=scope)
|
|
73
|
+
for spec in dirs:
|
|
74
|
+
if spec.is_primary:
|
|
75
|
+
return spec.path
|
|
76
|
+
if dirs:
|
|
77
|
+
return dirs[0].path
|
|
78
|
+
raise ValueError(f"Agent {self.agent_id} does not support scope {scope}.")
|
|
79
|
+
|
|
80
|
+
def _populate_spec_fs_state(self, spec: SkillDirectorySpec) -> SkillDirectorySpec:
|
|
81
|
+
exists = spec.path.exists() and spec.path.is_dir()
|
|
82
|
+
readable = is_readable_dir(spec.path) if exists else False
|
|
83
|
+
return spec.model_copy(update={"exists": exists, "readable": readable})
|
|
84
|
+
|
|
85
|
+
def count_skills_in_dirs(self, specs: list[SkillDirectorySpec]) -> int:
|
|
86
|
+
"""Count unique physical skill directories visible to this agent."""
|
|
87
|
+
seen: set[str] = set()
|
|
88
|
+
for spec in specs:
|
|
89
|
+
if not spec.exists or not spec.readable:
|
|
90
|
+
continue
|
|
91
|
+
try:
|
|
92
|
+
for entry in sorted(spec.path.iterdir()):
|
|
93
|
+
if not entry.is_dir() or is_symlink_or_junction(entry):
|
|
94
|
+
continue
|
|
95
|
+
if (entry / "SKILL.md").is_file():
|
|
96
|
+
seen.add(canonical_path_key(entry))
|
|
97
|
+
except OSError:
|
|
98
|
+
continue
|
|
99
|
+
return len(seen)
|
|
100
|
+
|
|
101
|
+
def detect(self, env: EnvironmentContext) -> AgentDetectionResult:
|
|
102
|
+
"""Detect installation status, config dirs, skill dirs, and skill counts (read-only)."""
|
|
103
|
+
executables = self.find_executables(env)
|
|
104
|
+
existing_configs = [p for p in self.config_directories(env) if p.exists()]
|
|
105
|
+
skill_specs = [self._populate_spec_fs_state(s) for s in self.skill_directories(env)]
|
|
106
|
+
native_existing_skill_dirs = [
|
|
107
|
+
s
|
|
108
|
+
for s in skill_specs
|
|
109
|
+
if s.exists and not s.is_shared_standard and not s.is_compatibility_alias
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
has_binary = len(executables) > 0
|
|
113
|
+
has_config = len(existing_configs) > 0 or len(native_existing_skill_dirs) > 0
|
|
114
|
+
|
|
115
|
+
if has_binary and has_config:
|
|
116
|
+
status = DetectionStatus.INSTALLED_AND_CONFIGURED
|
|
117
|
+
elif has_binary:
|
|
118
|
+
status = DetectionStatus.INSTALLED_NO_CONFIG
|
|
119
|
+
elif has_config:
|
|
120
|
+
status = DetectionStatus.CONFIG_ONLY
|
|
121
|
+
else:
|
|
122
|
+
status = DetectionStatus.NOT_FOUND
|
|
123
|
+
|
|
124
|
+
supported_scopes: list[AgentScope] = []
|
|
125
|
+
if self.capabilities.supports_project_scope:
|
|
126
|
+
supported_scopes.append(AgentScope.PROJECT)
|
|
127
|
+
if self.capabilities.supports_global_scope:
|
|
128
|
+
supported_scopes.append(AgentScope.GLOBAL)
|
|
129
|
+
|
|
130
|
+
skills_count = self.count_skills_in_dirs(skill_specs)
|
|
131
|
+
|
|
132
|
+
notes: list[str] = []
|
|
133
|
+
if any(s.is_shared_standard and s.exists for s in skill_specs):
|
|
134
|
+
notes.append("Reads shared .agents/skills standard directory.")
|
|
135
|
+
if status == DetectionStatus.NOT_FOUND and skills_count > 0:
|
|
136
|
+
notes.append(
|
|
137
|
+
"Skills detected only via shared/compatibility directories; agent not installed."
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return AgentDetectionResult(
|
|
141
|
+
agent_id=self.agent_id,
|
|
142
|
+
display_name=self.display_name,
|
|
143
|
+
status=status,
|
|
144
|
+
executable_paths=executables,
|
|
145
|
+
config_directories=existing_configs,
|
|
146
|
+
skill_directories=skill_specs,
|
|
147
|
+
supported_scopes=supported_scopes,
|
|
148
|
+
skills_found=skills_count,
|
|
149
|
+
limitations=list(self.capabilities.limitations),
|
|
150
|
+
notes=notes,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def compatibility_warnings_for_skill(
|
|
154
|
+
self,
|
|
155
|
+
frontmatter: SkillFrontmatter | None,
|
|
156
|
+
) -> list[str]:
|
|
157
|
+
"""Evaluate frontmatter compatibility when targeting this agent."""
|
|
158
|
+
warnings: list[str] = []
|
|
159
|
+
if frontmatter is None:
|
|
160
|
+
return warnings
|
|
161
|
+
|
|
162
|
+
supported_extras = set(self.capabilities.extra_frontmatter_fields)
|
|
163
|
+
for key in sorted(frontmatter.extra_fields()):
|
|
164
|
+
if key not in supported_extras:
|
|
165
|
+
warnings.append(
|
|
166
|
+
f"Non-standard frontmatter field '{key}' may be ignored by {self.display_name}."
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
if frontmatter.allowed_tools is not None and "allowed-tools" not in supported_extras:
|
|
170
|
+
warnings.append(
|
|
171
|
+
"Experimental 'allowed-tools' field support is not confirmed for "
|
|
172
|
+
f"{self.display_name}."
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
return warnings
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Claude Code agent adapter."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from contextbridge.adapters.base import BaseAgentAdapter
|
|
8
|
+
from contextbridge.core.paths import EnvironmentContext
|
|
9
|
+
from contextbridge.models.agent import (
|
|
10
|
+
AgentCapabilities,
|
|
11
|
+
AgentId,
|
|
12
|
+
AgentScope,
|
|
13
|
+
SkillDirectorySpec,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ClaudeCodeAdapter(BaseAgentAdapter):
|
|
18
|
+
"""Adapter for Anthropic Claude Code."""
|
|
19
|
+
|
|
20
|
+
agent_id = AgentId.CLAUDE
|
|
21
|
+
display_name = "Claude Code"
|
|
22
|
+
aliases = ("claude", "claude-code", "claudecode")
|
|
23
|
+
executable_names = ("claude",)
|
|
24
|
+
capabilities = AgentCapabilities(
|
|
25
|
+
supports_agent_skills_spec=True,
|
|
26
|
+
supports_global_scope=True,
|
|
27
|
+
supports_project_scope=True,
|
|
28
|
+
supports_zip_import_documented=False,
|
|
29
|
+
zip_install_note=(
|
|
30
|
+
"Extract the Agent Skills ZIP into ~/.claude/skills/ (global) or "
|
|
31
|
+
".claude/skills/ (project)."
|
|
32
|
+
),
|
|
33
|
+
extra_frontmatter_fields=(
|
|
34
|
+
"disable-model-invocation",
|
|
35
|
+
"user-invocable",
|
|
36
|
+
"context",
|
|
37
|
+
"agent",
|
|
38
|
+
"argument-hint",
|
|
39
|
+
"allowed-tools",
|
|
40
|
+
"model",
|
|
41
|
+
),
|
|
42
|
+
limitations=(
|
|
43
|
+
"Does not natively scan .agents/skills without symlinks or plugins.",
|
|
44
|
+
"Claude-specific frontmatter fields (context: fork, agent, disable-model-invocation) "
|
|
45
|
+
"are not portable to other agents.",
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def _global_config_root(self, env: EnvironmentContext) -> Path:
|
|
50
|
+
override = env.resolve_env_path("CLAUDE_CONFIG_DIR")
|
|
51
|
+
if override is not None:
|
|
52
|
+
return override
|
|
53
|
+
return env.home_dir / ".claude"
|
|
54
|
+
|
|
55
|
+
def config_directories(self, env: EnvironmentContext) -> list[Path]:
|
|
56
|
+
return [
|
|
57
|
+
self._global_config_root(env),
|
|
58
|
+
env.project_dir / ".claude",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
def skill_directories(
|
|
62
|
+
self,
|
|
63
|
+
env: EnvironmentContext,
|
|
64
|
+
scope: AgentScope | None = None,
|
|
65
|
+
) -> list[SkillDirectorySpec]:
|
|
66
|
+
specs: list[SkillDirectorySpec] = []
|
|
67
|
+
if scope in (None, AgentScope.PROJECT):
|
|
68
|
+
specs.append(
|
|
69
|
+
SkillDirectorySpec(
|
|
70
|
+
path=env.project_dir / ".claude" / "skills",
|
|
71
|
+
scope=AgentScope.PROJECT,
|
|
72
|
+
is_primary=True,
|
|
73
|
+
note="Native Claude Code project skills directory.",
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
if scope in (None, AgentScope.GLOBAL):
|
|
77
|
+
specs.append(
|
|
78
|
+
SkillDirectorySpec(
|
|
79
|
+
path=self._global_config_root(env) / "skills",
|
|
80
|
+
scope=AgentScope.GLOBAL,
|
|
81
|
+
is_primary=True,
|
|
82
|
+
note="Native Claude Code global skills directory (honors CLAUDE_CONFIG_DIR).",
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
return specs
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""OpenAI Codex CLI agent adapter."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from contextbridge.adapters.base import BaseAgentAdapter
|
|
8
|
+
from contextbridge.core.paths import EnvironmentContext
|
|
9
|
+
from contextbridge.models.agent import (
|
|
10
|
+
AgentCapabilities,
|
|
11
|
+
AgentId,
|
|
12
|
+
AgentScope,
|
|
13
|
+
SkillDirectorySpec,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CodexAdapter(BaseAgentAdapter):
|
|
18
|
+
"""Adapter for OpenAI Codex CLI."""
|
|
19
|
+
|
|
20
|
+
agent_id = AgentId.CODEX
|
|
21
|
+
display_name = "OpenAI Codex"
|
|
22
|
+
aliases = ("codex", "openai-codex", "codex-cli")
|
|
23
|
+
executable_names = ("codex",)
|
|
24
|
+
capabilities = AgentCapabilities(
|
|
25
|
+
supports_agent_skills_spec=True,
|
|
26
|
+
supports_global_scope=True,
|
|
27
|
+
supports_project_scope=True,
|
|
28
|
+
supports_zip_import_documented=False,
|
|
29
|
+
zip_install_note=(
|
|
30
|
+
"Extract the Agent Skills ZIP into ~/.agents/skills/ (global) or "
|
|
31
|
+
".agents/skills/ (project)."
|
|
32
|
+
),
|
|
33
|
+
extra_frontmatter_fields=(),
|
|
34
|
+
limitations=(
|
|
35
|
+
"Uses shared .agents/skills standard directory; skills placed there are also visible "
|
|
36
|
+
"to other agents that scan .agents/skills.",
|
|
37
|
+
"Custom [[skills.config]] entries inside ~/.codex/config.toml are not parsed "
|
|
38
|
+
"in v0.1.0.",
|
|
39
|
+
),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def _codex_home(self, env: EnvironmentContext) -> Path:
|
|
43
|
+
override = env.resolve_env_path("CODEX_HOME")
|
|
44
|
+
if override is not None:
|
|
45
|
+
return override
|
|
46
|
+
return env.home_dir / ".codex"
|
|
47
|
+
|
|
48
|
+
def config_directories(self, env: EnvironmentContext) -> list[Path]:
|
|
49
|
+
return [
|
|
50
|
+
self._codex_home(env),
|
|
51
|
+
env.project_dir / ".codex",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
def skill_directories(
|
|
55
|
+
self,
|
|
56
|
+
env: EnvironmentContext,
|
|
57
|
+
scope: AgentScope | None = None,
|
|
58
|
+
) -> list[SkillDirectorySpec]:
|
|
59
|
+
specs: list[SkillDirectorySpec] = []
|
|
60
|
+
if scope in (None, AgentScope.PROJECT):
|
|
61
|
+
specs.append(
|
|
62
|
+
SkillDirectorySpec(
|
|
63
|
+
path=env.project_dir / ".agents" / "skills",
|
|
64
|
+
scope=AgentScope.PROJECT,
|
|
65
|
+
is_primary=True,
|
|
66
|
+
is_shared_standard=True,
|
|
67
|
+
note="Official Codex repository skills directory (shared standard).",
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
if scope in (None, AgentScope.GLOBAL):
|
|
71
|
+
specs.append(
|
|
72
|
+
SkillDirectorySpec(
|
|
73
|
+
path=env.home_dir / ".agents" / "skills",
|
|
74
|
+
scope=AgentScope.GLOBAL,
|
|
75
|
+
is_primary=True,
|
|
76
|
+
is_shared_standard=True,
|
|
77
|
+
note="Official Codex user-level skills directory (shared standard).",
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
codex_skills = self._codex_home(env) / "skills"
|
|
81
|
+
specs.append(
|
|
82
|
+
SkillDirectorySpec(
|
|
83
|
+
path=codex_skills,
|
|
84
|
+
scope=AgentScope.GLOBAL,
|
|
85
|
+
is_primary=False,
|
|
86
|
+
is_compatibility_alias=True,
|
|
87
|
+
note="CODEX_HOME skills path (commonly configured via ~/.codex/skills).",
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
return specs
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Cursor agent adapter."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from contextbridge.adapters.base import BaseAgentAdapter
|
|
8
|
+
from contextbridge.core.paths import EnvironmentContext
|
|
9
|
+
from contextbridge.models.agent import (
|
|
10
|
+
AgentCapabilities,
|
|
11
|
+
AgentId,
|
|
12
|
+
AgentScope,
|
|
13
|
+
SkillDirectorySpec,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CursorAdapter(BaseAgentAdapter):
|
|
18
|
+
"""Adapter for Cursor editor / agent."""
|
|
19
|
+
|
|
20
|
+
agent_id = AgentId.CURSOR
|
|
21
|
+
display_name = "Cursor"
|
|
22
|
+
aliases = ("cursor", "cursor-ide", "cursor-agent")
|
|
23
|
+
executable_names = ("cursor", "cursor-agent")
|
|
24
|
+
capabilities = AgentCapabilities(
|
|
25
|
+
supports_agent_skills_spec=True,
|
|
26
|
+
supports_global_scope=True,
|
|
27
|
+
supports_project_scope=True,
|
|
28
|
+
supports_zip_import_documented=False,
|
|
29
|
+
zip_install_note=(
|
|
30
|
+
"Extract the Agent Skills ZIP into ~/.cursor/skills/ (global) or "
|
|
31
|
+
".cursor/skills/ (project)."
|
|
32
|
+
),
|
|
33
|
+
extra_frontmatter_fields=(),
|
|
34
|
+
limitations=(
|
|
35
|
+
"Nested monorepo skill folders (e.g., apps/web/.cursor/skills) are not walked "
|
|
36
|
+
"in v0.1.0.",
|
|
37
|
+
"Also reads .agents/skills, .claude/skills, and .codex/skills compatibility "
|
|
38
|
+
"directories.",
|
|
39
|
+
),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def extra_executable_candidates(self, env: EnvironmentContext) -> list[Path]:
|
|
43
|
+
candidates: list[Path] = []
|
|
44
|
+
if env.is_macos:
|
|
45
|
+
candidates.append(Path("/Applications/Cursor.app"))
|
|
46
|
+
elif env.is_windows:
|
|
47
|
+
local_appdata = env.resolve_env_path("LOCALAPPDATA")
|
|
48
|
+
if local_appdata is not None:
|
|
49
|
+
candidates.append(local_appdata / "Programs" / "cursor" / "Cursor.exe")
|
|
50
|
+
return candidates
|
|
51
|
+
|
|
52
|
+
def config_directories(self, env: EnvironmentContext) -> list[Path]:
|
|
53
|
+
return [
|
|
54
|
+
env.home_dir / ".cursor",
|
|
55
|
+
env.project_dir / ".cursor",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
def skill_directories(
|
|
59
|
+
self,
|
|
60
|
+
env: EnvironmentContext,
|
|
61
|
+
scope: AgentScope | None = None,
|
|
62
|
+
) -> list[SkillDirectorySpec]:
|
|
63
|
+
specs: list[SkillDirectorySpec] = []
|
|
64
|
+
if scope in (None, AgentScope.PROJECT):
|
|
65
|
+
specs.append(
|
|
66
|
+
SkillDirectorySpec(
|
|
67
|
+
path=env.project_dir / ".cursor" / "skills",
|
|
68
|
+
scope=AgentScope.PROJECT,
|
|
69
|
+
is_primary=True,
|
|
70
|
+
note="Native Cursor project skills directory.",
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
specs.append(
|
|
74
|
+
SkillDirectorySpec(
|
|
75
|
+
path=env.project_dir / ".agents" / "skills",
|
|
76
|
+
scope=AgentScope.PROJECT,
|
|
77
|
+
is_primary=False,
|
|
78
|
+
is_shared_standard=True,
|
|
79
|
+
note="Shared multi-agent project skills directory.",
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
specs.append(
|
|
83
|
+
SkillDirectorySpec(
|
|
84
|
+
path=env.project_dir / ".claude" / "skills",
|
|
85
|
+
scope=AgentScope.PROJECT,
|
|
86
|
+
is_primary=False,
|
|
87
|
+
is_compatibility_alias=True,
|
|
88
|
+
note="Claude Code compatibility project skills directory.",
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
specs.append(
|
|
92
|
+
SkillDirectorySpec(
|
|
93
|
+
path=env.project_dir / ".codex" / "skills",
|
|
94
|
+
scope=AgentScope.PROJECT,
|
|
95
|
+
is_primary=False,
|
|
96
|
+
is_compatibility_alias=True,
|
|
97
|
+
note="Codex compatibility project skills directory.",
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
if scope in (None, AgentScope.GLOBAL):
|
|
101
|
+
specs.append(
|
|
102
|
+
SkillDirectorySpec(
|
|
103
|
+
path=env.home_dir / ".cursor" / "skills",
|
|
104
|
+
scope=AgentScope.GLOBAL,
|
|
105
|
+
is_primary=True,
|
|
106
|
+
note="Native Cursor global skills directory.",
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
specs.append(
|
|
110
|
+
SkillDirectorySpec(
|
|
111
|
+
path=env.home_dir / ".agents" / "skills",
|
|
112
|
+
scope=AgentScope.GLOBAL,
|
|
113
|
+
is_primary=False,
|
|
114
|
+
is_shared_standard=True,
|
|
115
|
+
note="Shared multi-agent global skills directory.",
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
specs.append(
|
|
119
|
+
SkillDirectorySpec(
|
|
120
|
+
path=env.home_dir / ".claude" / "skills",
|
|
121
|
+
scope=AgentScope.GLOBAL,
|
|
122
|
+
is_primary=False,
|
|
123
|
+
is_compatibility_alias=True,
|
|
124
|
+
note="Claude Code compatibility global skills directory.",
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
specs.append(
|
|
128
|
+
SkillDirectorySpec(
|
|
129
|
+
path=env.home_dir / ".codex" / "skills",
|
|
130
|
+
scope=AgentScope.GLOBAL,
|
|
131
|
+
is_primary=False,
|
|
132
|
+
is_compatibility_alias=True,
|
|
133
|
+
note="Codex compatibility global skills directory.",
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
return specs
|