Git Utils
Installation
Section titled “Installation”pnpm add @theholocron/git-utilsNode-only: it shells out to git and touches the filesystem. Zero dependencies.
import { parseGitRemoteUrl, upsertManagedBlock } from "@theholocron/git-utils";
parseGitRemoteUrl("git@github.com:theholocron/holocron.git");// { host: "github.com", owner: "theholocron", repo: "holocron", slug: "theholocron/holocron" }
upsertManagedBlock("node_modules\n", { start: "# managed: skills", end: "# end managed: skills", lines: ["/.agents/"],});// "node_modules\n\n# managed: skills\n/.agents/\n# end managed: skills\n"How the pieces fit
Section titled “How the pieces fit”parseGitRemoteUrlandupsertManagedBlockare pure.readGitRemoterunsgit remote get-urland parses the result withparseGitRemoteUrl;updateGitignoreappliesupsertManagedBlockto a file.- A managed block has no default markers. Choose them and keep them stable, because they are how an existing block is found again.
The full API reference is generated from the package’s TSDoc comments.