Skip to main content

Crate khive_pack_git

Crate khive_pack_git 

Source
Expand description

khive-pack-git — the git-lifecycle pack (ADR-088, amended by ADR-088 Amendment 1 and ADR-108).

Contributes three note kinds (commit, issue, pull_request) that make repository provenance queryable through the KG graph, one read/ingest agent-facing verb, git.digest(source, project?, max_items?, include?) (handlers), that drives the batch, cursor-based ingester (ingest) against either a local path or a remote https:// URL (cloned/fetched into a daemon-owned scratch cache, cache), and three write verbs (write_handlers, ADR-108) that shell to system git with hardened, allowlisted argv construction (write_argv). See docs/adr/ADR-088-git-lifecycle-pack.md, docs/adr/ADR-088-amendment-1-git-digest.md, and docs/adr/ADR-108-git-write-surface.md.

VerbArgsWhat it does
git.digestsource, project?, max_items?, include?Ingest commit/issue/PR provenance from a local path or https:// URL, bounded and cursor-resumable
git.commitrepo, message, paths?, author?Stage and commit against a local repo; returns the resulting SHA
git.branchrepo, name, from?Create a branch, optionally from a named ref/SHA
git.pushrepo, branch, remote?Push a branch to a remote; force-push is always denied

kkernel git-ingest remains the unbounded, all-kinds admin CLI path over the same shared ingest::run_ingest core.

Modules§

cache
Scratch-clone cache for git.digest’s remote-URL mode (ADR-088 Amendment 1). Clones/fetches into ~/.khive/scratch/git-digest/<cache_key>/, keyed by canonical URL (crate::source::cache_key). An LRU cap (env-var configured: KHIVE_GIT_DIGEST_CACHE_MAX_REPOS, KHIVE_GIT_DIGEST_CACHE_MAX_BYTES, KHIVE_GIT_DIGEST_CLONE_MAX_BYTES, KHIVE_GIT_DIGEST_SCRATCH_ROOT) evicts least-recently-used clones once the cache exceeds its repo-count or total-byte limit; a per-clone size cap rejects an oversized clone/fetch before it enters the addressable cache slot. See crates/khive-pack-git/docs/api/cache.md for the full design rationale (ownership-proof eviction, staging-then-move installation, per-clone cap enforcement).
handlers
git.digest verb handler (ADR-088 Amendment 1).
hook
KindHook implementations for the three note kinds this pack contributes. Validation only — provenance edges are supplied by the caller and linked by the runtime’s create_note path itself. See crates/khive-pack-git/docs/api/hooks.md for why no after_create edge work is needed here.
ingest
Batch, cursor-based git-history ingester (ADR-088 §5). One-shot: walks local git history plus (optionally) gh-fetched issues and pull requests, and writes commit / issue / pull_request notes through the standard create verb. See crates/khive-pack-git/docs/api/ingest.md for the full module overview.
refs
GitHub reference-grammar extraction (ADR-088 Amendment 1, ingest enrichment riders): Closes/Fixes/Resolves #N and bare #N mentions in commit messages and issue/PR bodies.
source
git.digest source resolution (ADR-088 Amendment 1): local paths vs. https:// remote URLs, canonicalization, and github.com owner/repo slug derivation for gh-based issue/PR ingestion.
write_argv
Hardened argv construction for the git write verbs (ADR-108).
write_handlers
git.commit / git.branch / git.push verb handlers (ADR-108, amended by the ADR-108 Amendment).
write_policy
Handler-level git-write policy allowlist (ADR-108 Amendment).

Structs§

GitPack
Git-lifecycle pack (ADR-088, amended by ADR-088 Amendment 1 and ADR-108) — registers commit / issue / pull_request note kinds populated by the batch ingester in src/ingest.rs, one read/ingest agent-facing verb, git.digest (src/handlers.rs), and three write verbs, git.commit / git.branch / git.push (src/write_handlers.rs, ADR-108). Extends the base edge contract with precedes commit→commit (parent→child lineage, ADR-088 Amendment 1 ingest enrichment) — the only new endpoint rule this pack contributes; everything else uses the base annotates contract.