contextbridge-agents 0.1.0__tar.gz
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_agents-0.1.0/.gitignore +42 -0
- contextbridge_agents-0.1.0/AGENTS.md +24 -0
- contextbridge_agents-0.1.0/CHANGELOG.md +20 -0
- contextbridge_agents-0.1.0/CODE_OF_CONDUCT.md +40 -0
- contextbridge_agents-0.1.0/CONTRIBUTING.md +51 -0
- contextbridge_agents-0.1.0/LICENSE +21 -0
- contextbridge_agents-0.1.0/PKG-INFO +309 -0
- contextbridge_agents-0.1.0/README.md +265 -0
- contextbridge_agents-0.1.0/README.pt-BR.md +265 -0
- contextbridge_agents-0.1.0/SECURITY.md +36 -0
- contextbridge_agents-0.1.0/docs/ARCHITECTURE.md +104 -0
- contextbridge_agents-0.1.0/docs/COMPATIBILITY.md +44 -0
- contextbridge_agents-0.1.0/docs/CONTEXT_FORMAT.md +298 -0
- contextbridge_agents-0.1.0/docs/PROVIDER_ARCHITECTURE.md +300 -0
- contextbridge_agents-0.1.0/docs/PROVIDER_COMPATIBILITY.md +77 -0
- contextbridge_agents-0.1.0/docs/RELEASE_NOTES_v0.1.0.md +30 -0
- contextbridge_agents-0.1.0/docs/RESEARCH.md +92 -0
- contextbridge_agents-0.1.0/docs/ROADMAP.md +75 -0
- contextbridge_agents-0.1.0/docs/TEST_COVERAGE_PLAN.md +69 -0
- contextbridge_agents-0.1.0/docs/assets/banner.svg +77 -0
- contextbridge_agents-0.1.0/docs/assets/demo.gif +0 -0
- contextbridge_agents-0.1.0/docs/assets/logo-dark.svg +31 -0
- contextbridge_agents-0.1.0/docs/assets/logo-light.svg +32 -0
- contextbridge_agents-0.1.0/docs/assets/logo.svg +25 -0
- contextbridge_agents-0.1.0/examples/demo.py +221 -0
- contextbridge_agents-0.1.0/examples/sample-skill/SKILL.md +19 -0
- contextbridge_agents-0.1.0/examples/sample-skill/references/checklist.md +7 -0
- contextbridge_agents-0.1.0/examples/sample-skill/scripts/check_env.py +14 -0
- contextbridge_agents-0.1.0/pyproject.toml +151 -0
- contextbridge_agents-0.1.0/src/contextbridge/__init__.py +15 -0
- contextbridge_agents-0.1.0/src/contextbridge/__main__.py +8 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/__init__.py +22 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/antigravity.py +112 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/base.py +175 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/claude.py +85 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/codex.py +90 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/cursor.py +136 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/gemini_cli.py +110 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/opencode.py +121 -0
- contextbridge_agents-0.1.0/src/contextbridge/adapters/registry.py +47 -0
- contextbridge_agents-0.1.0/src/contextbridge/backup/__init__.py +3 -0
- contextbridge_agents-0.1.0/src/contextbridge/backup/manager.py +476 -0
- contextbridge_agents-0.1.0/src/contextbridge/cli.py +676 -0
- contextbridge_agents-0.1.0/src/contextbridge/core/__init__.py +14 -0
- contextbridge_agents-0.1.0/src/contextbridge/core/discovery.py +145 -0
- contextbridge_agents-0.1.0/src/contextbridge/core/doctor.py +304 -0
- contextbridge_agents-0.1.0/src/contextbridge/core/exceptions.py +83 -0
- contextbridge_agents-0.1.0/src/contextbridge/core/paths.py +80 -0
- contextbridge_agents-0.1.0/src/contextbridge/models/__init__.py +63 -0
- contextbridge_agents-0.1.0/src/contextbridge/models/agent.py +81 -0
- contextbridge_agents-0.1.0/src/contextbridge/models/backup.py +67 -0
- contextbridge_agents-0.1.0/src/contextbridge/models/doctor.py +53 -0
- contextbridge_agents-0.1.0/src/contextbridge/models/migration.py +74 -0
- contextbridge_agents-0.1.0/src/contextbridge/models/skill.py +118 -0
- contextbridge_agents-0.1.0/src/contextbridge/py.typed +0 -0
- contextbridge_agents-0.1.0/src/contextbridge/security/__init__.py +30 -0
- contextbridge_agents-0.1.0/src/contextbridge/security/archive.py +150 -0
- contextbridge_agents-0.1.0/src/contextbridge/security/audit.py +120 -0
- contextbridge_agents-0.1.0/src/contextbridge/security/limits.py +22 -0
- contextbridge_agents-0.1.0/src/contextbridge/security/paths.py +360 -0
- contextbridge_agents-0.1.0/src/contextbridge/security/secrets.py +216 -0
- contextbridge_agents-0.1.0/src/contextbridge/skills/__init__.py +3 -0
- contextbridge_agents-0.1.0/src/contextbridge/skills/exporter.py +162 -0
- contextbridge_agents-0.1.0/src/contextbridge/skills/migrator.py +394 -0
- contextbridge_agents-0.1.0/src/contextbridge/skills/parser.py +325 -0
- contextbridge_agents-0.1.0/src/contextbridge/skills/validator.py +417 -0
- contextbridge_agents-0.1.0/src/contextbridge/utils/__init__.py +22 -0
- contextbridge_agents-0.1.0/src/contextbridge/utils/console.py +76 -0
- contextbridge_agents-0.1.0/src/contextbridge/utils/fs.py +84 -0
- contextbridge_agents-0.1.0/src/contextbridge/utils/hashing.py +22 -0
- contextbridge_agents-0.1.0/tests/conftest.py +94 -0
- contextbridge_agents-0.1.0/tests/fixtures/skills/invalid-yaml-skill/SKILL.md +6 -0
- contextbridge_agents-0.1.0/tests/fixtures/skills/valid-skill/SKILL.md +14 -0
- contextbridge_agents-0.1.0/tests/fixtures/skills/valid-skill/references/guide.md +3 -0
- contextbridge_agents-0.1.0/tests/fixtures/skills/valid-skill/scripts/helper.py +5 -0
- contextbridge_agents-0.1.0/tests/integration/test_cli.py +184 -0
- contextbridge_agents-0.1.0/tests/integration/test_cli_subprocess.py +232 -0
- contextbridge_agents-0.1.0/tests/integration/test_discovery_dedup.py +63 -0
- contextbridge_agents-0.1.0/tests/integration/test_doctor.py +61 -0
- contextbridge_agents-0.1.0/tests/integration/test_exporter.py +66 -0
- contextbridge_agents-0.1.0/tests/integration/test_migrator.py +210 -0
- contextbridge_agents-0.1.0/tests/integration/test_phase2a_cli_paths.py +165 -0
- contextbridge_agents-0.1.0/tests/unit/test_adapters.py +104 -0
- contextbridge_agents-0.1.0/tests/unit/test_archive_security.py +78 -0
- contextbridge_agents-0.1.0/tests/unit/test_backup_manager.py +147 -0
- contextbridge_agents-0.1.0/tests/unit/test_parser_and_validator.py +117 -0
- contextbridge_agents-0.1.0/tests/unit/test_paths_and_security.py +116 -0
- contextbridge_agents-0.1.0/tests/unit/test_phase2a_security_and_backup.py +440 -0
- contextbridge_agents-0.1.0/tests/unit/test_phase2a_skills_and_core.py +441 -0
- contextbridge_agents-0.1.0/tests/unit/test_secrets_and_audit.py +74 -0
- contextbridge_agents-0.1.0/tests/unit/test_security_audit_regressions.py +459 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
.eggs/
|
|
12
|
+
|
|
13
|
+
# Virtual environments
|
|
14
|
+
.venv/
|
|
15
|
+
venv/
|
|
16
|
+
ENV/
|
|
17
|
+
|
|
18
|
+
# Testing and coverage
|
|
19
|
+
.pytest_cache/
|
|
20
|
+
.coverage
|
|
21
|
+
coverage.xml
|
|
22
|
+
coverage.json
|
|
23
|
+
htmlcov/
|
|
24
|
+
|
|
25
|
+
# Linters & type checkers
|
|
26
|
+
.ruff_cache/
|
|
27
|
+
.mypy_cache/
|
|
28
|
+
|
|
29
|
+
# IDE & OS files
|
|
30
|
+
.vscode/
|
|
31
|
+
.idea/
|
|
32
|
+
.DS_Store
|
|
33
|
+
Thumbs.db
|
|
34
|
+
|
|
35
|
+
# Local ContextBridge scratch/backups and secrets
|
|
36
|
+
.contextbridge/
|
|
37
|
+
.env
|
|
38
|
+
.env.*
|
|
39
|
+
!.env.example
|
|
40
|
+
*.zip
|
|
41
|
+
*.log
|
|
42
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AGENTS.md — Guidelines for AI Coding Agents
|
|
2
|
+
|
|
3
|
+
This repository contains **ContextBridge**, a local open-source CLI tool for managing and porting Agent Skills across AI coding agents.
|
|
4
|
+
|
|
5
|
+
## Project Rules
|
|
6
|
+
|
|
7
|
+
1. **Stack**: Python 3.11+, Typer, Rich, Pydantic v2, PyYAML (`safe_load` only), Pytest, Ruff, Mypy (`strict = true`), Hatchling.
|
|
8
|
+
2. **Safety First**:
|
|
9
|
+
- Never execute scripts or code found inside user skills.
|
|
10
|
+
- Never touch real agent configuration directories in automated tests—always inject a mock `EnvironmentContext` backed by `tmp_path`.
|
|
11
|
+
- Never log or print matched secret values.
|
|
12
|
+
- Reject path traversal, symlinks/junctions, ZIP Slip, ZIP bombs, and silent overwrites.
|
|
13
|
+
- Read-only commands (`scan`, `skills list`, `skills validate`, `doctor`, `backup list`) must never create directories or modify files.
|
|
14
|
+
3. **Accuracy**:
|
|
15
|
+
- Do not fabricate agent paths, flags, or compatibility claims. Keep `docs/COMPATIBILITY.md` and `docs/RESEARCH.md` aligned with verified adapter definitions.
|
|
16
|
+
4. **Verification**:
|
|
17
|
+
Run all checks after any code change:
|
|
18
|
+
```bash
|
|
19
|
+
python -m pytest
|
|
20
|
+
python -m ruff check .
|
|
21
|
+
python -m ruff format --check .
|
|
22
|
+
python -m mypy src
|
|
23
|
+
python -m build
|
|
24
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **ContextBridge** are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Read-only agent detection (`contextbridge scan`) supporting **Claude Code**, **OpenAI Codex**, **Google Antigravity**, **OpenCode**, **Gemini CLI**, and **Cursor**, distinguishing installed binaries, existing config directories, and missing paths.
|
|
13
|
+
- Physically deduplicated skill listing (`contextbridge skills list`, `--agent`, `--scope`, `--json`) preventing double-counting of shared directories such as `.agents/skills`.
|
|
14
|
+
- Official Agent Skills specification (`agentskills.io`) validator (`contextbridge skills validate`) with safe `yaml.safe_load` parsing, local Markdown reference checks, directory structure validation, and static heuristic security auditing.
|
|
15
|
+
- Portable ZIP exporter (`contextbridge skills export <path> --format zip`) preserving `SKILL.md`, `scripts/`, `references/`, and `assets/` with deterministic metadata, ZIP safety verification, and credential/symlink blocking.
|
|
16
|
+
- 10-step skill migration workflow (`contextbridge skills migrate <skill> --from <src> --to <dst>`) with dry-run preview by default, explicit `--apply` confirmation, conflict protection (`--overwrite`), automatic SHA-256 backups, post-write integrity verification, and atomic rollback on write failures.
|
|
17
|
+
- Local backup management (`contextbridge backup list`, `contextbridge backup restore <id>`) with SHA-256 manifests, tamper detection, preview mode, and atomic restoration.
|
|
18
|
+
- Read-only environment diagnostics (`contextbridge doctor`) checking runtime, permissions, invalid skills, duplicate skill conflicts, cross-agent frontmatter caveats, and local backup integrity.
|
|
19
|
+
- Security hardening against path traversal, ZIP Slip, ZIP bombs, symlinks and Windows junctions, unsafe YAML deserialization, secret/credential exposure, oversized files, and silent overwrites.
|
|
20
|
+
- Bilingual documentation (`README.md`, `README.pt-BR.md`), architecture and research docs (`docs/`), example skill (`examples/sample-skill`), and multi-OS GitHub Actions CI matrix.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in the
|
|
6
|
+
ContextBridge community a harassment-free experience for everyone, regardless of
|
|
7
|
+
age, body size, visible or invisible disability, ethnicity, sex characteristics,
|
|
8
|
+
gender identity and expression, level of experience, education, socio-economic
|
|
9
|
+
status, nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to a positive environment:
|
|
15
|
+
|
|
16
|
+
- Demonstrating empathy and kindness toward other people
|
|
17
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
18
|
+
- Giving and gracefully accepting constructive feedback
|
|
19
|
+
- Accepting responsibility and apologizing to those affected by our mistakes
|
|
20
|
+
- Focusing on what is best for the overall community
|
|
21
|
+
|
|
22
|
+
Examples of unacceptable behavior:
|
|
23
|
+
|
|
24
|
+
- The use of sexualized language or imagery, and sexual attention or advances
|
|
25
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
26
|
+
- Public or private harassment
|
|
27
|
+
- Publishing others' private information without explicit permission
|
|
28
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
29
|
+
|
|
30
|
+
## Enforcement
|
|
31
|
+
|
|
32
|
+
Project maintainers are responsible for clarifying and enforcing our standards of
|
|
33
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
34
|
+
response to any behavior that they deem inappropriate, threatening, offensive, or
|
|
35
|
+
harmful.
|
|
36
|
+
|
|
37
|
+
## Attribution
|
|
38
|
+
|
|
39
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 2.1,
|
|
40
|
+
available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Contributing to ContextBridge
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **ContextBridge**!
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
ContextBridge targets **Python 3.11+**.
|
|
8
|
+
|
|
9
|
+
**Windows (PowerShell)**
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
python -m venv .venv
|
|
13
|
+
.\.venv\Scripts\Activate.ps1
|
|
14
|
+
python -m pip install -e ".[dev]"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Linux / macOS**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python3 -m venv .venv
|
|
21
|
+
source .venv/bin/activate
|
|
22
|
+
python -m pip install -e ".[dev]"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quality Checks
|
|
26
|
+
|
|
27
|
+
Before opening a pull request, please ensure all checks pass locally:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python -m pytest
|
|
31
|
+
python -m ruff check .
|
|
32
|
+
python -m ruff format --check .
|
|
33
|
+
python -m mypy src
|
|
34
|
+
python -m build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Coding & Architecture Guidelines
|
|
38
|
+
|
|
39
|
+
- Keep logic modular: separate models, adapters, security guards, skills processing, backup management, and CLI presentation.
|
|
40
|
+
- **Never invent** agent paths, compatibility claims, or installation mechanisms—cite official documentation in `docs/RESEARCH.md` and `docs/COMPATIBILITY.md`.
|
|
41
|
+
- Maintain **read-only safety**: inspection commands (`scan`, `skills list`, `skills validate`, `doctor`, `backup list`) must never create or modify files.
|
|
42
|
+
- Keep tests isolated using `tmp_path` and injected `EnvironmentContext`; never touch real user agent configurations in tests.
|
|
43
|
+
- Follow the security principles documented in `SECURITY.md`.
|
|
44
|
+
|
|
45
|
+
## Adding a New Agent Adapter
|
|
46
|
+
|
|
47
|
+
1. Verify official paths across Windows, Linux, and macOS (global and project scopes) and document sources in `docs/RESEARCH.md`.
|
|
48
|
+
2. Subclass `BaseAgentAdapter` in `src/contextbridge/adapters/`.
|
|
49
|
+
3. Register the adapter in `src/contextbridge/adapters/registry.py`.
|
|
50
|
+
4. Add unit and integration tests covering detection, skill discovery, deduplication, and migration compatibility.
|
|
51
|
+
5. Update `docs/COMPATIBILITY.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ContextBridge Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: contextbridge-agents
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Your context. Any agent. No lock-in. Universal local CLI for managing and porting AI coding agent skills.
|
|
5
|
+
Project-URL: Homepage, https://github.com/AlemaoBoy/ContextBridge
|
|
6
|
+
Project-URL: Repository, https://github.com/AlemaoBoy/ContextBridge
|
|
7
|
+
Project-URL: Documentation, https://github.com/AlemaoBoy/ContextBridge/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/AlemaoBoy/ContextBridge/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/AlemaoBoy/ContextBridge/blob/main/CHANGELOG.md
|
|
10
|
+
Author: ContextBridge Contributors
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agent-skills,ai-agents,antigravity,claude-code,cli,codex,cursor,gemini-cli,opencode,portability
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
27
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
28
|
+
Classifier: Topic :: Utilities
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.11
|
|
31
|
+
Requires-Dist: pydantic>=2.7.0
|
|
32
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
33
|
+
Requires-Dist: rich>=13.7.0
|
|
34
|
+
Requires-Dist: typer>=0.12.0
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: build>=1.2.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: mypy>=1.11.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: twine>=5.0.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: types-pyyaml>=6.0.12; extra == 'dev'
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="docs/assets/banner.svg" alt="ContextBridge — Your context. Any agent. No lock-in." width="100%" />
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-38BDF8.svg" alt="License: MIT" /></a>
|
|
51
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/baseline-0.1.0-818CF8.svg" alt="Baseline 0.1.0" /></a>
|
|
52
|
+
<a href="https://github.com/AlemaoBoy/ContextBridge/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/AlemaoBoy/ContextBridge/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI on main" /></a>
|
|
53
|
+
<a href="https://github.com/AlemaoBoy/ContextBridge/actions/workflows/ci.yml?query=branch%3Adevelop"><img src="https://github.com/AlemaoBoy/ContextBridge/actions/workflows/ci.yml/badge.svg?branch=develop" alt="CI on develop" /></a>
|
|
54
|
+
<a href="pyproject.toml"><img src="https://img.shields.io/badge/python-3.11%2B-38BDF8.svg" alt="Python 3.11+" /></a>
|
|
55
|
+
<a href="SECURITY.md"><img src="https://img.shields.io/badge/telemetry-none-0D1117.svg" alt="Telemetry: None" /></a>
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<strong>English</strong> · <a href="README.pt-BR.md">Português (Brasil)</a> ·
|
|
60
|
+
<a href="docs/ARCHITECTURE.md">Architecture</a> ·
|
|
61
|
+
<a href="docs/COMPATIBILITY.md">Compatibility</a> ·
|
|
62
|
+
<a href="docs/RESEARCH.md">Research</a> ·
|
|
63
|
+
<a href="docs/ROADMAP.md">Roadmap</a> ·
|
|
64
|
+
<a href="SECURITY.md">Security</a>
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
**ContextBridge** is a universal, cross-platform, 100% local open-source CLI tool for discovering, validating, packaging, and safely migrating **Agent Skills** (`SKILL.md`) across AI coding agents—without telemetry, cloud accounts, or vendor lock-in.
|
|
70
|
+
|
|
71
|
+
> **Non-Affiliation Notice:** ContextBridge is an independent open-source project and is **not** officially affiliated with, endorsed by, or sponsored by Anthropic, OpenAI, Google, Cursor, or OpenCode.
|
|
72
|
+
|
|
73
|
+
## Live Demo (Synthetic Workspace)
|
|
74
|
+
|
|
75
|
+
<p align="center">
|
|
76
|
+
<img src="docs/assets/demo.gif" alt="ContextBridge synthetic CLI demo" width="900" />
|
|
77
|
+
</p>
|
|
78
|
+
|
|
79
|
+
Reproduce this exact demo locally in an isolated temporary directory (never touching real agent configurations):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
python examples/demo.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
ContextBridge requires **Python 3.11 or newer**.
|
|
88
|
+
|
|
89
|
+
The `main` branch contains the v0.1.0 baseline with Phase 2A quality hardening. The [`develop` branch](https://github.com/AlemaoBoy/ContextBridge/tree/develop) contains unreleased v0.2.0 development.
|
|
90
|
+
|
|
91
|
+
The distribution name is **`contextbridge-agents`**. See [GitHub Releases](https://github.com/AlemaoBoy/ContextBridge/releases) for published artifacts.
|
|
92
|
+
|
|
93
|
+
Clone the repository and enter the directory.
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/AlemaoBoy/ContextBridge.git
|
|
97
|
+
cd ContextBridge
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Use the block for your system to install from source.
|
|
101
|
+
|
|
102
|
+
**Windows (PowerShell)**
|
|
103
|
+
|
|
104
|
+
```powershell
|
|
105
|
+
python -m venv .venv
|
|
106
|
+
.\.venv\Scripts\Activate.ps1
|
|
107
|
+
python -m pip install -e .
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If PowerShell policy blocks activation, use `.\.venv\Scripts\python.exe -m pip install -e .` and run the CLI as `.\.venv\Scripts\contextbridge.exe`.
|
|
111
|
+
|
|
112
|
+
**Linux / macOS**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python3 -m venv .venv
|
|
116
|
+
source .venv/bin/activate
|
|
117
|
+
python -m pip install -e .
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Verify the installation on any system.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
contextbridge --version
|
|
124
|
+
contextbridge scan
|
|
125
|
+
contextbridge doctor
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Install development tools in the virtual environment with the following command.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
python -m pip install -e ".[dev]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Why ContextBridge?
|
|
135
|
+
|
|
136
|
+
Developers increasingly work across multiple AI coding agents—**Claude Code**, **OpenAI Codex**, **Google Antigravity**, **OpenCode**, **Gemini CLI**, and **Cursor**. While the open [Agent Skills specification](https://agentskills.io) standardizes `SKILL.md`, day-to-day management still has sharp edges:
|
|
137
|
+
|
|
138
|
+
- Each agent scans different native and compatibility directories (`.claude/skills`, `.agents/skills`, `.gemini/skills`, `.cursor/skills`, `.opencode/skills`, `~/.gemini/config/skills`).
|
|
139
|
+
- Shared directories cause duplicate counts and hidden precedence conflicts.
|
|
140
|
+
- Agent-specific frontmatter fields (such as Claude Code's `context: fork` or `disable-model-invocation`) may be silently ignored elsewhere.
|
|
141
|
+
- Manual folder copying risks silent overwrites, broken local links, symlink traps, or accidental leakage of `.env` files and credentials.
|
|
142
|
+
|
|
143
|
+
## Understanding Shared Directories & Physical Deduplication
|
|
144
|
+
|
|
145
|
+
Several agents scan the same physical directory on disk—most notably `<project>/.agents/skills` and `~/.agents/skills`, as well as `.claude/skills` compatibility paths read by OpenCode and Cursor.
|
|
146
|
+
|
|
147
|
+
- **Without deduplication**, a single skill stored in `~/.agents/skills/my-skill` would be counted up to **5 times** across Codex, Antigravity, OpenCode, Gemini CLI, and Cursor.
|
|
148
|
+
- **With ContextBridge**, skills are resolved to their canonical physical path and reported **once**, showing both primary/native agents and compatibility-only agents.
|
|
149
|
+
- **No-op detection**: If you migrate between two agents whose primary target resolves to the exact same physical directory, ContextBridge detects it cleanly as a no-op instead of self-overwriting.
|
|
150
|
+
|
|
151
|
+
## Command Reference
|
|
152
|
+
|
|
153
|
+
### 1. Detect Agents (Read-Only)
|
|
154
|
+
|
|
155
|
+
Distinguishes `installed + configured`, `installed (no config)`, `config found (CLI not on PATH)`, and `not found` without ever creating missing directories:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
contextbridge scan
|
|
159
|
+
contextbridge scan --project-dir /path/to/repo
|
|
160
|
+
contextbridge scan --json
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 2. List Skills (Deduplicated, Read-Only)
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
contextbridge skills list
|
|
167
|
+
contextbridge skills list --agent claude
|
|
168
|
+
contextbridge skills list --scope project
|
|
169
|
+
contextbridge skills list --json
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 3. Validate a Skill (Agent Skills Spec + Heuristics)
|
|
173
|
+
|
|
174
|
+
Validates `SKILL.md` frontmatter, naming rules, directory match, local Markdown references, directory safety, and heuristic security checks without executing any scripts:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
contextbridge skills validate ./examples/sample-skill
|
|
178
|
+
contextbridge skills validate ./my-skill --json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### 4. Export Portable ZIP Archive
|
|
182
|
+
|
|
183
|
+
Packages `SKILL.md`, `scripts/`, `references/`, and `assets/` into a deterministic, ZIP-safety-verified archive while blocking secrets, sensitive files, symlinks, and silent overwrites:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
contextbridge skills export ./examples/sample-skill --format zip
|
|
187
|
+
contextbridge skills export ./examples/sample-skill --format zip --output ./sample-skill.zip
|
|
188
|
+
contextbridge skills export ./examples/sample-skill --format zip --output ./sample-skill.zip --overwrite
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
> **Format honesty:** Exports produce a standard Agent Skills ZIP layout for extraction into a target agent's skills directory. ContextBridge does not claim native one-click ZIP import where an agent does not officially document it.
|
|
192
|
+
|
|
193
|
+
### 5. Safe Dry-Run & Migration
|
|
194
|
+
|
|
195
|
+
Dry-run preview is **always the default**. Applying changes requires `--apply` plus interactive confirmation (or `--yes` in scripts), and replacing an existing destination requires `--overwrite` (always creating a verified local backup first):
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Step 1 — Preview plan (default dry-run; modifies nothing)
|
|
199
|
+
contextbridge skills migrate release-checklist --from claude --to codex
|
|
200
|
+
|
|
201
|
+
# Step 2 — Apply with interactive confirmation
|
|
202
|
+
contextbridge skills migrate release-checklist --from claude --to codex --apply
|
|
203
|
+
|
|
204
|
+
# Step 3 — Replace an existing destination safely (creates local backup first)
|
|
205
|
+
contextbridge skills migrate release-checklist --from claude --to codex --apply --overwrite --yes
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
> **Portability vs. runtime behavior:** Porting skill files preserves the Agent Skills directory structure, but does **not** guarantee identical runtime behavior, tool permissions, or invocation triggers across different agents.
|
|
209
|
+
|
|
210
|
+
### 6. Local Backups & Restoration
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
contextbridge backup list
|
|
214
|
+
contextbridge backup restore <BACKUP_ID> # Dry-run preview + SHA-256 check
|
|
215
|
+
contextbridge backup restore <BACKUP_ID> --apply # Atomic restore with pre-restore snapshot
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 7. Read-Only Diagnostics
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
contextbridge doctor
|
|
222
|
+
contextbridge doctor --json
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Compatibility Matrix (v0.1.0)
|
|
226
|
+
|
|
227
|
+
| Agent | Adapter ID | Project Skills Paths | Global Skills Paths | Env Override |
|
|
228
|
+
| --- | --- | --- | --- | --- |
|
|
229
|
+
| **Claude Code** | `claude` | `.claude/skills` | `~/.claude/skills` | `CLAUDE_CONFIG_DIR` |
|
|
230
|
+
| **OpenAI Codex** | `codex` | `.agents/skills` | `~/.agents/skills`, `~/.codex/skills` | `CODEX_HOME` |
|
|
231
|
+
| **Google Antigravity** | `antigravity` | `.agents/skills`, `.agent/skills` | `~/.gemini/config/skills`, `~/.gemini/antigravity/skills`, `~/.agents/skills` | — |
|
|
232
|
+
| **OpenCode** | `opencode` | `.opencode/skills`, `.agents/skills`, `.claude/skills` | `~/.config/opencode/skills`, `~/.agents/skills`, `~/.claude/skills` | `OPENCODE_CONFIG_DIR`, `XDG_CONFIG_HOME` |
|
|
233
|
+
| **Gemini CLI** | `gemini-cli` | `.gemini/skills`, `.agents/skills` | `~/.gemini/skills`, `~/.agents/skills` | `GEMINI_CLI_HOME` |
|
|
234
|
+
| **Cursor** | `cursor` | `.cursor/skills`, `.agents/skills`, `.claude/skills`, `.codex/skills` | `~/.cursor/skills`, `~/.agents/skills`, `~/.claude/skills`, `~/.codex/skills` | — |
|
|
235
|
+
|
|
236
|
+
See [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md) for verified details, frontmatter portability, and pending items.
|
|
237
|
+
|
|
238
|
+
## Architecture
|
|
239
|
+
|
|
240
|
+
```mermaid
|
|
241
|
+
flowchart TD
|
|
242
|
+
CLI["CLI Layer (Typer + Rich / JSON)"] --> Core["Core Services (discovery, doctor)"]
|
|
243
|
+
CLI --> Skills["Skills Engine (parser, validator, exporter, migrator)"]
|
|
244
|
+
CLI --> Backup["Backup Manager (manifest.json + payload + rollback)"]
|
|
245
|
+
|
|
246
|
+
Core --> Adapters["Agent Adapters (claude, codex, antigravity, opencode, gemini-cli, cursor)"]
|
|
247
|
+
Skills --> Adapters
|
|
248
|
+
Skills --> Backup
|
|
249
|
+
|
|
250
|
+
Core --> Security["Security Guards (paths, ADS, symlinks, secrets, archive, audit)"]
|
|
251
|
+
Skills --> Security
|
|
252
|
+
Backup --> Security
|
|
253
|
+
|
|
254
|
+
Adapters --> Models["Pydantic v2 Models & EnvironmentContext"]
|
|
255
|
+
Security --> Utils["Atomic FS & SHA-256 Utilities"]
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for full module boundaries and exit codes.
|
|
259
|
+
|
|
260
|
+
## Security Mechanisms
|
|
261
|
+
|
|
262
|
+
ContextBridge is **safe by default** and operates **100% locally with zero telemetry**:
|
|
263
|
+
|
|
264
|
+
- **Zero execution of untrusted content**: Never runs scripts in `scripts/`, never starts MCP servers, and never loads external plugins as Python code.
|
|
265
|
+
- **Strict filesystem & archive guards**: Rejects path traversal (`..`), symlinks and Windows junctions, NTFS Alternate Data Streams (`:`), Windows reserved device names (`CON`, `NUL`, `COM1..9`, `LPT1..9`), trailing dot/space filename tricks, case-insensitive path collisions, ZIP Slip, ZIP bombs, and oversized files.
|
|
266
|
+
- **Hardened YAML parsing**: Uses a strict `yaml.SafeLoader` subclass that rejects duplicate mapping keys, excessive nesting depth, and alias/anchor expansion bombs.
|
|
267
|
+
- **Credential & secret blocking**: Blocks sensitive files/directories (`.env`, `.ssh/*`, `.aws/*`, `.git-credentials`, `*.pem`, `*.key`, `credentials.json`, etc.) and alerts on heuristic token patterns **without ever printing or logging matched values**.
|
|
268
|
+
- **Authorized restore boundaries & TOCTOU protection**: Restores enforce authorized destination rules independently of `manifest.json` (blocking tampered manifests, skills root directories, ancestors, system paths, and non-empty non-skill directories). Migrations re-verify both source and destination state between planning and applying, and preserve displaced/backup files if rollback itself fails.
|
|
269
|
+
|
|
270
|
+
> **Important Security Disclaimers:**
|
|
271
|
+
> 1. Static secret and command checks are **heuristic aids only** and cannot guarantee that an untrusted skill is free of malicious intent or prompt injection.
|
|
272
|
+
> 2. Local SHA-256 digests in `manifest.json` verify **integrity against corruption, partial writes, and drift**; because manifests are unsigned, they are **not** a cryptographic authenticity guarantee against an attacker who already holds local write access to `~/.contextbridge/backups`.
|
|
273
|
+
|
|
274
|
+
See [SECURITY.md](SECURITY.md) for responsible disclosure guidance.
|
|
275
|
+
|
|
276
|
+
## Transparent Limitations (v0.1.0)
|
|
277
|
+
|
|
278
|
+
- **Platform verification**. GitHub Actions tested the v0.1.0 code on Windows, Ubuntu, and macOS with Python 3.11–3.15. Local verification used Windows.
|
|
279
|
+
- **Custom agent manifests not parsed yet**: Codex `[[skills.config]]` in `config.toml`, Antigravity `skills.json` / `_agents/`, Cursor nested monorepo `.cursor/skills`, and Gemini CLI `/trust` / extension-bundled skills are documented as pending.
|
|
280
|
+
- **Read-only permission check on Windows**: `doctor` uses non-mutating `os.access` checks, which are best-effort on Windows NTFS ACLs.
|
|
281
|
+
- **File portability ≠ identical runtime behavior**: Agents enforce different tool approval flows and frontmatter extensions.
|
|
282
|
+
|
|
283
|
+
## Roadmap
|
|
284
|
+
|
|
285
|
+
### Implemented in v0.1.0
|
|
286
|
+
- Read-only detection for 6 AI coding agents (`scan`)
|
|
287
|
+
- Physically deduplicated skill listing (`skills list`)
|
|
288
|
+
- Official Agent Skills specification validator + static heuristic audit (`skills validate`)
|
|
289
|
+
- Safe deterministic ZIP export (`skills export --format zip`)
|
|
290
|
+
- Transactional 10-step migration with dry-run default, TOCTOU guards, backup, and rollback (`skills migrate`)
|
|
291
|
+
- Local backups with SHA-256 integrity checks and authorized restoration (`backup list`, `backup restore`)
|
|
292
|
+
- Read-only diagnostics (`doctor`)
|
|
293
|
+
|
|
294
|
+
### Planned for Future Versions (Not Implemented in v0.1.0)
|
|
295
|
+
- MCP server configuration migration
|
|
296
|
+
- Conversion between `AGENTS.md`, `CLAUDE.md`, and `GEMINI.md`
|
|
297
|
+
- Cross-agent synchronization & redundancy detection
|
|
298
|
+
- Context compaction & cross-session context transfer
|
|
299
|
+
- Profile management, advanced static security auditing, and optional GUI
|
|
300
|
+
|
|
301
|
+
See [docs/ROADMAP.md](docs/ROADMAP.md) for details.
|
|
302
|
+
|
|
303
|
+
## Contributing
|
|
304
|
+
|
|
305
|
+
Contributions are welcome! Please review [CONTRIBUTING.md](CONTRIBUTING.md), [AGENTS.md](AGENTS.md), and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before opening an issue or pull request.
|
|
306
|
+
|
|
307
|
+
## License
|
|
308
|
+
|
|
309
|
+
Licensed under the [MIT License](LICENSE).
|