@gitpagedocs/tools

中文文档
0.0.26发布于 2026/11/09ISCTypeScriptES Module零依赖近 30 天下载 4288

Shared business-logic core for Git Page Docs (consumed by frontend, cli and mcp). Ships TypeScript source; consume via tsx or a TS-aware bundler.

原始使用文档
文档目录4 节
  1. Modules ( src/ )
  2. Entry points ( exports )
  3. Usage
  4. Tests

@gitpagedocs/tools

The shared business-logic core of the Git Page Docs monorepo — the single home for domain logic consumed by the frontend, the CLI, and the MCP server. It ships TypeScript source and is consumed via tsx (CLI/MCP) or a TS-aware bundler (Next transpilePackages).

Modules (src/)

ModuleResponsibility
ai/14-provider AI system — data-driven PROVIDER_CATALOG, registry + factory (no switch chains), 5 family adapters (OpenAI-compatible, Anthropic, Gemini, Ollama, Cohere), SSE/NDJSON streaming, legacy↔catalog id mapping
security/EncryptedCredentialVault (AES-256-GCM, PBKDF2-HMAC-SHA-256 key derivation), SessionPasswordGate; WebStorageVaultStorage (site localStorage vault) + FileVaultStorage (the CLI .gitpagedocsvault file) adapters
crypto/NodeCryptoService + WebCryptoService (SHA-256, PBKDF2, AES-256-GCM, masking, secure wipe); deriveDocAccessKeys / verifyDocAccess (double-hash documentation password gate shared by the CLI password command and the frontend gate)
cache/MemoryCache, FileCache, WebStorageCache (Strategy over one Cache port)
config/GitPageDocsConfigLoader (.json / .js / .ts)
config-format/Browser-safe compactSiteIcons / expandSiteIcons and applyRouteDefaults / factorRouteDefaults for compact configuration and inherited route values
logger/Level-filtered logger with secret redaction
errors/AppError + typed subclasses
filesystem/FileService (list/read/write/search with lexical and canonical root containment; validates existing parents before creating files and rejects destination symlinks on writes; concurrent path replacement still requires trusted filesystem boundaries)
documentation/DocumentationService, patchManagedRegion, DocUpdater
i18n/Language bundles (site.languages toggles in config.json + langs/<lang>.json): loadConfigLanguageBundles, applyLanguageBundles (fold into site.langmenu / translations), filterEnabledLanguages, splitLanguageBundles (generator side); browser-safe
ports/Type-only contracts (logger, cache, crypto, security, config, ai)

Entry points (exports)

. (full barrel) · ./ai · ./errors · ./i18n · ./config-format · ./ports · ./crypto/web · ./security/web · ./cache/web — the web subpaths, ./i18n and ./config-format are browser-safe (no node: imports) for the Next.js bundle.

Usage

import { createDefaultFactory, PROVIDER_CATALOG } from "@gitpagedocs/tools/ai";
import { EncryptedCredentialVault } from "@gitpagedocs/tools/security/web";

Tests

Unit + integration + E2E live in tools/tests/** (Vitest); self-tests in tools/smoke/**. Run from the repo root: npx vitest run and npm run smoke:all.

版本与发布记录

@gitpagedocs/tools 共发布 50 个版本,首次发布于 2026/06/15;过去 12 个月发布了 50 个版本。

版本发布日期距今
0.0.26latest2026/11/097 天前
0.0.252026/11/097 天前
0.0.242026/11/097 天前
0.0.232026/11/097 天前
0.0.222026/11/088 天前
0.0.212026/11/088 天前

关于 @gitpagedocs/tools 的常见问题

@gitpagedocs/tools 是什么?

Shared business-logic core for Git Page Docs (consumed by frontend, cli and mcp). Ships TypeScript source; consume via tsx or a TS-aware bundler.

如何安装 @gitpagedocs/tools?

在项目目录运行 npm install @gitpagedocs/tools,或使用 pnpm add / yarn add / bun add。

@gitpagedocs/tools 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gitpagedocs/tools 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gitpagedocs/tools 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gitpagedocs/tools 可以商用吗?

@gitpagedocs/tools 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gitpagedocs/tools 的下载量有多少?

根据 npm 官方下载统计,@gitpagedocs/tools 在 2026/10/17 – 2026/11/15 这 30 天内被下载 4,288 次,日均约 143 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gitpagedocs/tools 还在维护吗?

最新版本 0.0.26 发布于 2026/11/09(7 天前);至今共发布 50 个版本,其中过去 12 个月发布了 50 个;首次发布于 2026/06/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。