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.8.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for chp_adapter_git-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc1968665be94bef046f55685a17800ee8264786c7411d7770602000032be9f2
MD5 ca73c43254edc5bf9e0dc0cdea45ddb5
BLAKE2b-256 8058e7aa88f9a2a62b03a4cfa1f2beab4c9e9623b1e745b1062fad01db92fb99

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