npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zvk/git-kit

v0.1.3

Published

Node-oriented git ports, safe operation descriptors, formatters, and optional simple-git adapters for ZVK applications.

Downloads

349

Readme

@zvk/git-kit

Node-oriented git ports, safe operation descriptors, formatters, and optional simple-git adapters for ZVK applications.

@zvk/git-kit is for local-first developer tools that need shared git status, log, diff, branch, stash, tag, and worktree behavior without moving project lookup, authorization, UI copy, or persistence into a shared package.

Public imports

import type { GitClientPort, GitRepositoryRef } from "@zvk/git-kit";
import { summarizeGitStatus } from "@zvk/git-kit/formatters";
import { assertGitOperationApproved, describeGitReset } from "@zvk/git-kit/operations";
import type { GitOperationDescriptor } from "@zvk/git-kit/operations";
import { createSimpleGitClient } from "@zvk/git-kit/simple-git";
import { createFakeGitClient } from "@zvk/git-kit/test-utils";

Use only the package root and exported subpaths:

  • @zvk/git-kit
  • @zvk/git-kit/ports
  • @zvk/git-kit/formatters
  • @zvk/git-kit/operations
  • @zvk/git-kit/simple-git
  • @zvk/git-kit/test-utils

Package boundaries

The root package exposes structural git types, pure formatters, and operation descriptors. It depends on @zvk/contracts and must not require simple-git.

See ../../docs/package-boundary-matrix.md for the package-family runtime boundary matrix. This package is Node-oriented; the optional simple-git adapter and test fakes stay on explicit subpaths.

@zvk/git-kit/simple-git is the optional Node adapter for apps that already want simple-git execution. Keep concrete simple-git types behind that subpath.

@zvk/git-kit/test-utils provides deterministic fakes for app tests without importing a test framework. Apps that need spies should wrap the fake with their own Vitest or Jest helpers.

Applications own:

  • repository root lookup and validation;
  • auth, project membership, and destructive-operation policy;
  • route names, MCP action names, and UI copy;
  • git operation history, audit logs, and persistence;
  • concrete queueing, locking, and long-running process behavior.

Repository roots and persistence

Inject repository roots from app-owned project state and pass only the structural repository reference into @zvk/git-kit ports.

import type { GitClientPort, GitRepositoryRef } from "@zvk/git-kit";

type ProjectGitContext = {
  readonly projectId: number;
  readonly rootPath: string;
};

function toGitRepositoryRef(project: ProjectGitContext): GitRepositoryRef {
  return { rootPath: project.rootPath };
}

export async function getProjectStatus(git: GitClientPort, project: ProjectGitContext) {
  const repo = toGitRepositoryRef(project);
  const snapshot = await git.status(repo);

  await recordGitStatusSnapshot({
    projectId: project.projectId,
    branch: snapshot.currentBranch,
    isClean: snapshot.isClean
  });

  return snapshot;
}

Persist app facts, not package internals. Store project IDs, repository roots, operation names, descriptors, approvals, actor IDs, timestamps, and execution results in the application schema.

Safe operation descriptor flow

Mutating and destructive work must be described before it can be executed. The caller decides whether the descriptor is approved.

import { assertGitOperationApproved, describeGitReset } from "@zvk/git-kit/operations";

const descriptor = describeGitReset({ ref: "HEAD~1", mode: "hard" });

await recordRequestedGitOperation({
  projectId,
  actorId,
  descriptor
});

assertGitOperationApproved(descriptor, approval.approved);

Use the descriptor risk to route review:

  • read-only: safe for normal status, log, diff, branch-list, tag-list, and worktree-list requests.
  • writes-working-tree: requires app policy because files or refs may change.
  • rewrites-history: requires explicit approval and usually stronger UI/MCP confirmation.
  • destructive: requires explicit approval, audit persistence, and a narrow execution path.

@zvk/git-kit classifies risk. The app decides who can approve, where approval is stored, and how that approval is presented to users or MCP callers.

Optional simple-git adapter

Use the optional adapter when the app wants direct local git execution:

import { createSimpleGitClient } from "@zvk/git-kit/simple-git";

const git = createSimpleGitClient();
const status = await git.status({ rootPath: project.rootPath });

Apps can inject a factory for tests or alternate simple-git wiring. Keep adapter construction at the app boundary so repository roots, locks, and policy checks remain visible to the application.

Tests and fakes

Use @zvk/git-kit/test-utils for framework-neutral fake git clients:

import { createFakeGitClient } from "@zvk/git-kit/test-utils";

const git = createFakeGitClient({
  status: { currentBranch: "main", ahead: 0, behind: 0, files: [], isClean: true }
});

Keep assertions in the app test framework. The package fake should provide deterministic responses, not product policy.

Promptliano migration sketch

Move shared git shape and safety logic into @zvk/git-kit, but keep Promptliano ownership of product behavior:

  • Routes load project context, validate repository access, call a GitClientPort, and map results to existing HTTP response contracts.
  • Services wrap injected git ports and app repositories. They own project lookup, persistence, locking, and audit writes.
  • MCP tools keep their action names and caller-facing copy in Promptliano. For risky operations, return or persist a GitOperationDescriptor first, then execute only after Promptliano records explicit approval.
  • Tests replace local git doubles with @zvk/git-kit/test-utils fakes while keeping Promptliano authorization and persistence assertions local.

Repo Skill

Use .codex/skills/use-zvk-git-kit/SKILL.md when maintaining this package.

See ../../docs/package-boundary-matrix.md for the browser-safe, adapter-only, Node-only, and test-only subpaths.