Skip to main content

Crate gkit_core

Crate gkit_core 

Source
Expand description

gkit-core — shared library for the gkit toolkit.

Side effects go through git (a Git trait, shelling out to the real binary), so logic stays unit-testable. It houses the clone, logoff, stmb, and key logic behind the gkit CLI.

Modules§

checks
The six log-off checks, ported from the zsh isEverythingCheckedIn (code-conf gitCoreLib.sh). Each is a pure function over a &dyn Git, so it can be unit-tested with FakeGit. A repo is “ok” only if all six pass.
clone
Config-driven clone with explicit flag placement, built-in stateless steps, and pre/post-clone hooks.
conf
Clone config — structured TOML.
config
Resolve a repo’s base/integration branch — the single branch gkit treats as “the trunk” for the correct-branch check. Replaces the zsh’s hardcoded dev|main|master. Resolution order:
fixsub
Fix submodule metadata over an existing tree — a generalized port of the zsh fixSubModuleMeta. Two universal, idempotent fixes applied recursively to every initialized submodule:
git
Thin abstraction over invoking git, so the checks are unit-testable without a real repository. The real impl shells out to git -C <dir> …; tests use a FakeGit keyed by the command’s args.
key
key — ssh key/identity management. Pure, testable core: rendering and regenerating the gkit-owned ~/.ssh/git_users file (the disposable, Included ssh config), ensuring the Include line, and listing hosts. Side effects (ssh-keygen, ssh-add, clipboard, file IO) live in the CLI layer.
report
Output formatting. Entries arrive already in the fixed post-order DFS order (see submodules), so these just render — keeping the per-check order fixed and the lines greppable (path-first, stable keys, trailing boolean).
stamp
Re-apply a clone conf’s post-clone hooks over an existing tree, without cloning. gkit clone runs post-clone once, right after cloning; gkit stamp re-runs the same hooks on repos that are already on disk.
stmb
stmb — “switch to main branch”: finish a feature branch by returning to the base/integration branch, updating it, and deleting the (merged) feature branch.
submodules
Submodule traversal + parallel evaluation with deterministic output order.