chp-adapter-git 0.11.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.
- chp_adapter_git-0.11.0/.gitignore +36 -0
- chp_adapter_git-0.11.0/PKG-INFO +69 -0
- chp_adapter_git-0.11.0/README.md +46 -0
- chp_adapter_git-0.11.0/chp_adapter_git/__init__.py +8 -0
- chp_adapter_git-0.11.0/chp_adapter_git/adapter.py +684 -0
- chp_adapter_git-0.11.0/pyproject.toml +40 -0
- chp_adapter_git-0.11.0/tests/test_git_adapter.py +877 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
.next/
|
|
4
|
+
out/
|
|
5
|
+
.turbo/
|
|
6
|
+
*.tsbuildinfo
|
|
7
|
+
.yalc/
|
|
8
|
+
yalc.lock
|
|
9
|
+
*.tgz
|
|
10
|
+
.env
|
|
11
|
+
.env.*
|
|
12
|
+
coverage/
|
|
13
|
+
dashboard/
|
|
14
|
+
components/
|
|
15
|
+
# ...but the cockpit's app source lives in app/components — never ignore real source.
|
|
16
|
+
!cockpit/app/components/
|
|
17
|
+
!cockpit/app/components/**
|
|
18
|
+
!chp-evidence/app/components/
|
|
19
|
+
!chp-evidence/app/components/**
|
|
20
|
+
.tech-hub-cache/
|
|
21
|
+
__pycache__/
|
|
22
|
+
*.py[cod]
|
|
23
|
+
.pytest_cache/
|
|
24
|
+
.chp/
|
|
25
|
+
.DS_Store
|
|
26
|
+
.coverage
|
|
27
|
+
.forge/
|
|
28
|
+
.hypothesis/
|
|
29
|
+
.claude/
|
|
30
|
+
|
|
31
|
+
# chp-agent evidence store
|
|
32
|
+
.chp-agent/sessions.sqlite
|
|
33
|
+
.publish-dist/
|
|
34
|
+
|
|
35
|
+
# matrix-bot runtime session registry (CC session ids)
|
|
36
|
+
matrix-bot/sessions.json
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chp-adapter-git
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: CHP capability adapter — Git repository inspection and operations
|
|
5
|
+
Author: Auxo
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: adapter,capability-host-protocol,chp,git,version-control
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: chp-core>=0.7.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# chp-adapter-git
|
|
25
|
+
|
|
26
|
+
CHP capability adapter for local Git repository inspection and operations.
|
|
27
|
+
|
|
28
|
+
## Capabilities
|
|
29
|
+
|
|
30
|
+
| Capability ID | Risk | Description |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `chp.adapters.git.status` | low | Working tree status: branch, staged/unstaged/untracked counts |
|
|
33
|
+
| `chp.adapters.git.inspect_repo` | low | Repository overview: branch, HEAD SHA, remotes, commit count |
|
|
34
|
+
| `chp.adapters.git.log` | low | Recent commits list (sha7, author, subject, date) |
|
|
35
|
+
| `chp.adapters.git.diff_summary` | low | Diff statistics: files changed, insertions, deletions |
|
|
36
|
+
| `chp.adapters.git.precommit_check` | low | Staged file list + unstaged/untracked counts |
|
|
37
|
+
| `chp.adapters.git.checkout_branch` | medium | Create or switch to a branch |
|
|
38
|
+
| `chp.adapters.git.commit` | medium | Stage files and commit with a message |
|
|
39
|
+
|
|
40
|
+
## Evidence Hygiene
|
|
41
|
+
|
|
42
|
+
- Diff content (patch text): **never** in evidence
|
|
43
|
+
- File content: **never** in evidence
|
|
44
|
+
- Commit messages: **not** in evidence (only sha7/count in events)
|
|
45
|
+
- Commit subjects truncated to 80 chars in `log` output
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from chp_core import LocalCapabilityHost, SQLiteEvidenceStore
|
|
51
|
+
from chp_adapter_git import GitAdapter, GitConfig
|
|
52
|
+
|
|
53
|
+
store = SQLiteEvidenceStore("evidence.db")
|
|
54
|
+
host = LocalCapabilityHost(store=store)
|
|
55
|
+
host.register_adapter(GitAdapter(config=GitConfig(default_repo_path="/path/to/repo")))
|
|
56
|
+
|
|
57
|
+
result = await host.ainvoke("chp.adapters.git.status", {})
|
|
58
|
+
print(result.output) # {"branch": "main", "staged": 0, "unstaged": 1, "untracked": 2, "clean": False}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Testing with Injectable Backend
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
class FakeGitBackend:
|
|
65
|
+
def run(self, *args, cwd=None):
|
|
66
|
+
return {"rev-parse --abbrev-ref HEAD": "main"}.get(" ".join(args), "")
|
|
67
|
+
|
|
68
|
+
adapter = GitAdapter(config=GitConfig(backend=FakeGitBackend()))
|
|
69
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# chp-adapter-git
|
|
2
|
+
|
|
3
|
+
CHP capability adapter for local Git repository inspection and operations.
|
|
4
|
+
|
|
5
|
+
## Capabilities
|
|
6
|
+
|
|
7
|
+
| Capability ID | Risk | Description |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `chp.adapters.git.status` | low | Working tree status: branch, staged/unstaged/untracked counts |
|
|
10
|
+
| `chp.adapters.git.inspect_repo` | low | Repository overview: branch, HEAD SHA, remotes, commit count |
|
|
11
|
+
| `chp.adapters.git.log` | low | Recent commits list (sha7, author, subject, date) |
|
|
12
|
+
| `chp.adapters.git.diff_summary` | low | Diff statistics: files changed, insertions, deletions |
|
|
13
|
+
| `chp.adapters.git.precommit_check` | low | Staged file list + unstaged/untracked counts |
|
|
14
|
+
| `chp.adapters.git.checkout_branch` | medium | Create or switch to a branch |
|
|
15
|
+
| `chp.adapters.git.commit` | medium | Stage files and commit with a message |
|
|
16
|
+
|
|
17
|
+
## Evidence Hygiene
|
|
18
|
+
|
|
19
|
+
- Diff content (patch text): **never** in evidence
|
|
20
|
+
- File content: **never** in evidence
|
|
21
|
+
- Commit messages: **not** in evidence (only sha7/count in events)
|
|
22
|
+
- Commit subjects truncated to 80 chars in `log` output
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from chp_core import LocalCapabilityHost, SQLiteEvidenceStore
|
|
28
|
+
from chp_adapter_git import GitAdapter, GitConfig
|
|
29
|
+
|
|
30
|
+
store = SQLiteEvidenceStore("evidence.db")
|
|
31
|
+
host = LocalCapabilityHost(store=store)
|
|
32
|
+
host.register_adapter(GitAdapter(config=GitConfig(default_repo_path="/path/to/repo")))
|
|
33
|
+
|
|
34
|
+
result = await host.ainvoke("chp.adapters.git.status", {})
|
|
35
|
+
print(result.output) # {"branch": "main", "staged": 0, "unstaged": 1, "untracked": 2, "clean": False}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Testing with Injectable Backend
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
class FakeGitBackend:
|
|
42
|
+
def run(self, *args, cwd=None):
|
|
43
|
+
return {"rev-parse --abbrev-ref HEAD": "main"}.get(" ".join(args), "")
|
|
44
|
+
|
|
45
|
+
adapter = GitAdapter(config=GitConfig(backend=FakeGitBackend()))
|
|
46
|
+
```
|