Skip to main content

CHP capability adapter — Git repository inspection and operations

Project description

chp-adapter-git

CHP capability adapter for local Git repository inspection and operations.

Capabilities

Capability ID Risk Description
chp.adapters.git.status low Working tree status: branch, staged/unstaged/untracked counts
chp.adapters.git.inspect_repo low Repository overview: branch, HEAD SHA, remotes, commit count
chp.adapters.git.log low Recent commits list (sha7, author, subject, date)
chp.adapters.git.diff_summary low Diff statistics: files changed, insertions, deletions
chp.adapters.git.precommit_check low Staged file list + unstaged/untracked counts
chp.adapters.git.checkout_branch medium Create or switch to a branch
chp.adapters.git.commit medium Stage files and commit with a message

Evidence Hygiene

  • Diff content (patch text): never in evidence
  • File content: never in evidence
  • Commit messages: not in evidence (only sha7/count in events)
  • Commit subjects truncated to 80 chars in log output

Usage

from chp_core import LocalCapabilityHost, SQLiteEvidenceStore
from chp_adapter_git import GitAdapter, GitConfig

store = SQLiteEvidenceStore("evidence.db")
host = LocalCapabilityHost(store=store)
host.register_adapter(GitAdapter(config=GitConfig(default_repo_path="/path/to/repo")))

result = await host.ainvoke("chp.adapters.git.status", {})
print(result.output)  # {"branch": "main", "staged": 0, "unstaged": 1, "untracked": 2, "clean": False}

Testing with Injectable Backend

class FakeGitBackend:
    def run(self, *args, cwd=None):
        return {"rev-parse --abbrev-ref HEAD": "main"}.get(" ".join(args), "")

adapter = GitAdapter(config=GitConfig(backend=FakeGitBackend()))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chp_adapter_git-0.10.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file chp_adapter_git-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chp_adapter_git-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35993ac75bd96506959082f9e5f46a01540d2126bb00572b5a4f9855d697dabe
MD5 fbf77b20ac358cf663ddfffaf729f543
BLAKE2b-256 3bd19db51c2dcace63184a75f3a5bec0a1fcb293e4202a00908eadf82c59d7ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page