{"_id":"@1-/findgit","_rev":"3-568b872a905d715fc44789b9a837e4df","name":"@1-/findgit","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@1-/findgit","version":"0.1.0","keywords":["find","git","repository","root","upward"],"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","_id":"@1-/findgit@0.1.0","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/webc-site/npm/tree/main/findgit","bugs":{"url":"https://github.com/webc-site/npm/issues"},"dist":{"shasum":"261222c8e03ec86abb06cee72fd213a9c22988aa","tarball":"https://registry.npmjs.org/@1-/findgit/-/findgit-0.1.0.tgz","fileCount":3,"integrity":"sha512-0xkPzkx+zuSXY0iEKbudlaVonGAaVAW+ELrkKGT4UIuWRK+Xd+S1eZB/Ns8uIgIVPq6P1jd2yZ340pNoJe+Ucw==","signatures":[{"sig":"MEUCIBkfUJd7AOidN4y3SLdeh8barFXnwOhP+a5NfO/UNImTAiEAnEJwo/39fjI8jMopwXPhj6sX1m/CxV8M1407ywA+SCY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4379},"type":"module","exports":{".":"./_.js","./*":"./*"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/webc-site/npm.git","type":"git"},"_npmVersion":"11.13.0","description":"向上寻找 Git 仓库根目录。 / Find Git repository root directory upward.","directories":{},"_nodeVersion":"26.2.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/findgit_0.1.0_1780967406830_0.15957701745842767","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@1-/findgit","version":"0.1.1","keywords":["find","git","repository","root","upward"],"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","_id":"@1-/findgit@0.1.1","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/webc-site/npm/tree/main/findgit","bugs":{"url":"https://github.com/webc-site/npm/issues"},"dist":{"shasum":"b15d300e9bf4f140324f0563e271113452e40edd","tarball":"https://registry.npmjs.org/@1-/findgit/-/findgit-0.1.1.tgz","fileCount":3,"integrity":"sha512-zqvNIj0QoS7MOnSfKKGeMtUjipbgALo14dCDOMkRvwhvO0/R1hO4MEI2qNqjLYhIpGpu8uPuqnaj0MMPdHVxjg==","signatures":[{"sig":"MEQCIF0leRCrucQrWq2ZEasRFTv9CsO4R+2Ag5jVWfGILoMyAiBupjW+7HcN+UrPyQ8JqyusNiugcW37mHmuPx/W4doylw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5783},"type":"module","exports":{".":"./_.js","./*":"./*"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/webc-site/npm.git","type":"git"},"_npmVersion":"11.13.0","description":"向上寻找 Git 仓库根目录。 / Find Git repository root directory upward.","directories":{},"_nodeVersion":"26.2.0","dependencies":{"@1-/find":"^0.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/findgit_0.1.1_1780973381677_0.0068687000545542","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@1-/findgit","version":"0.1.2","description":"向上寻找 Git 仓库根目录。 / Find Git repository root directory upward.","keywords":["find","git","repository","root","upward"],"homepage":"https://github.com/webc-site/npm/tree/main/findgit","license":"MulanPSL-2.0","author":{"name":"x-at-01@googlegroups.com"},"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"type":"module","exports":{".":"./_.js","./*":"./*"},"dependencies":{"@1-/find":"^0.1.0"},"_id":"@1-/findgit@0.1.2","bugs":{"url":"https://github.com/webc-site/npm/issues"},"_nodeVersion":"26.2.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-lRKe2AgYm2CE5wF1SYf5bpbIVMceQjguMBkwiRAtBEhpOCsfGMe6CdbKUlK+i75iPTLRcVKFol6HqWVraLbZag==","shasum":"e5fd9ea2b5a78d221ebe9a57668afe6ba2303c99","tarball":"https://registry.npmjs.org/@1-/findgit/-/findgit-0.1.2.tgz","fileCount":3,"unpackedSize":4605,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCUrzWNbBjrDqHaQFavMgQlafrtbCV03SNsjAZ7uGWFwgIgCHTe3aDH9hFCeFW+lXETuMnH4fEQ5eqsTSNZ9qG0J6Y="}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/findgit_0.1.2_1780980807072_0.12666052589951504"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-09T01:10:06.666Z","modified":"2026-06-09T04:53:27.313Z","0.1.0":"2026-06-09T01:10:06.959Z","0.1.1":"2026-06-09T02:49:41.824Z","0.1.2":"2026-06-09T04:53:27.194Z"},"bugs":{"url":"https://github.com/webc-site/npm/issues"},"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","homepage":"https://github.com/webc-site/npm/tree/main/findgit","keywords":["find","git","repository","root","upward"],"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"description":"向上寻找 Git 仓库根目录。 / Find Git repository root directory upward.","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"readme":"[English](#en) | [中文](#zh)\n\n---\n\n<a id=\"en\"></a>\n# @1-/findgit : Find Git repository root directory upward\n\n## Table of Contents\n\n- [Features](#features)\n- [Usage](#usage)\n- [Design](#design)\n- [Tech Stack](#tech-stack)\n- [Directory Structure](#directory-structure)\n- [History Trivia](#history-trivia)\n\n## Features\n\nTraverses the directory tree upward from a specified starting path to locate the Git repository root directory containing the `.git` folder.\nReturns the initial input path if the system root is reached without finding `.git`.\n\n## Usage\n\n```javascript\nimport findgit from \"@1-/findgit\";\n\n// Locate the Git repository root for the current directory\nconst gitRoot = findgit(import.meta.dirname);\nconsole.log(gitRoot);\n```\n\n## Design\n\nThe module relies on the underlying `@1-/find` lookup logic to traverse directory trees.\nThe flow of calls is detailed below:\n\n![](https://i-01.eu.org/9-oaJVR7Nvr16rqhMu-LaA)\n\n## Tech Stack\n\n- Runtime: Bun / Node.js\n- Core Dependency: `@1-/find`\n- Native Modules: `node:fs` / `node:path`\n\n## Directory Structure\n\n```text\n.\n├── src/\n│   └── _.js        # Core lookup logic\n└── tests/\n    └── _.test.js   # Unit tests\n```\n\n## History Trivia\n\nIn April 2005, Bitmover revoked the free-of-charge license for BitKeeper, which was used for Linux kernel development. Linus Torvalds stepped in and wrote the initial version of Git in just about two weeks.\nGit discarded the traditional CVS/SVN model of placing metadata folders in every single subdirectory, opting instead for a single `.git` folder at the repository root.\nWhile this choice simplified version control management, it created a new requirement for toolchains and build tools running in nested folders to search upward recursively to find the repository boundary.\n`@1-/findgit` implements this lookup pattern with minimal overhead.\n## About\n\nThis library is developed by [WebC.site](https://webc.site).\n\n[WebC.site](https://webc.site): A new paradigm of web development for AI\n\n---\n\n<a id=\"zh\"></a>\n# @1-/findgit : 向上寻找 Git 仓库根目录\n\n## 目录\n\n- [功能介绍](#功能介绍)\n- [使用演示](#使用演示)\n- [设计思路](#设计思路)\n- [技术堆栈](#技术堆栈)\n- [目录结构](#目录结构)\n- [历史故事](#历史故事)\n\n## 功能介绍\n\n从指定路径起点开始，逐级向上检索父目录，定位包含 `.git` 文件夹的 Git 仓库根目录。\n若遍历至系统根目录仍未找到，则返回初始输入路径。\n\n## 使用演示\n\n```javascript\nimport findgit from \"@1-/findgit\";\n\n// 定位当前目录所属的 Git 仓库根目录\nconst git_root = findgit(import.meta.dirname);\nconsole.log(git_root);\n```\n\n## 设计思路\n\n模块依赖 `@1-/find` 底层通用查找逻辑，通过递归或循环方式向上遍历目录树。\n调用流程如下：\n\n![](https://i-01.eu.org/ag-VI8XuBO5AOMb9DmBrQQ)\n\n## 技术堆栈\n\n- 运行环境：Bun / Node.js\n- 核心依赖：`@1-/find`\n- 原生模块：`node:fs` / `node:path`\n\n## 目录结构\n\n```text\n.\n├── src/\n│   └── _.js        # 核心查找逻辑\n└── tests/\n    └── _.test.js   # 单元测试\n```\n\n## 历史故事\n\n2005年4月，由于 Bitmover 公司撤销了 Linux 社区免费使用 BitKeeper 版本控制系统的授权，Linus Torvalds 决定开发自主的版本控制系统。\n他在两周内设计并完成了 Git 的最初版本，抛弃了 CVS/SVN 等在每个子目录下创建元数据文件夹的繁琐设计，改用在仓库根目录下集中维护单一 `.git` 文件夹的设计。\n这种变革简化了版本管理，但也带来新需求：各种构建与辅助工具在子目录工作时，需要递归向上检索 `.git` 目录以确定项目边界。\n本项目以此为核心功能，提供极简的定位实现。\n## 关于\n\n本库由 [WebC.site](https://webc.site) 开发。\n\n[WebC.site](https://webc.site) : 面向人工智能的网站开发新范式\n","readmeFilename":"README.md"}