@gitkraken/core-gitlens

中文文档
0.39.0发布于 2026/11/16SEE LICENSE IN LICENSETypeScriptES Module近 30 天下载 1.4万

GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption

原始使用文档
文档目录8 节
  1. Usage
  2. Provider integrations
  3. Notifications
  4. Node vs browser
  5. Tree-shaking
  6. Licensing
  7. Versioning
  8. Source

@gitkraken/core-gitlens

Shared Git, AI, and GitHub primitives from GitLens, bundled for consumption by internal GitKraken products.

This package flattens nine internal workspace packages into a single tarball:

SubpathSource packageLicense
utils/*@gitlens/utilsSee LICENSE
ipc/*@gitlens/ipcSee LICENSE
git/*@gitlens/gitSee LICENSE
git-cli/*@gitlens/git-cliSee LICENSE
plus/ai/*@gitlens/aiLICENSE.plus
plus/git-github/*@gitlens/git-githubLICENSE.plus
plus/agents/*@gitlens/agentsLICENSE.plus
plus/integrations/*@gitlens/integrationsLICENSE.plus
plus/notifications/*@gitlens/notificationsLICENSE.plus

Usage

import { Logger } from '@gitkraken/core-gitlens/utils/logger.js';
import { GitService } from '@gitkraken/core-gitlens/git/service.js';
import { Repository } from '@gitkraken/core-gitlens/git/models/repository.js';
import { CliGitProvider } from '@gitkraken/core-gitlens/git-cli/cliGitProvider.js';

// Plus subpaths (proprietary)
import type { GitHubGitProviderInternal } from '@gitkraken/core-gitlens/plus/git-github/providers/githubProvider.js';
import { OpenAIProvider } from '@gitkraken/core-gitlens/plus/ai/providers/openaiProvider.js';

All exports are fully typed and source-mapped, with the original TypeScript sources embedded in the maps.

Provider integrations

Reading provider data (pull requests, issues, orgs, projects, repos, repository identity) goes through the provider-neutral facade at plus/integrations/index.js. It has its own guide — runtime wiring, the paging and warning contracts, the filter capability table, and a per-provider capability matrix: docs/integrations.md.

Notifications

Showing GitKraken notifications (the notifications-service-v2 inbox) in another host goes through plus/notifications/notificationsService.js and its host context. Its guide covers implementing the context, the refresh and toast contracts, and what the host must own (polling, persistence, toast de-duplication, safe link handling): docs/notifications.md.

Node vs browser

utils/ uses internal #env/* imports that resolve differently based on the target:

  • Node: dist/utils/env/node/*.js
  • Browser / webworker bundlers (webpack, Vite, esbuild, Rspack): dist/utils/env/browser/*.js

No consumer configuration required — the runtime / bundler picks the right variant automatically via the package's "imports" field.

Tree-shaking

The package is marked "sideEffects": false and uses per-file subpath exports. If you only import from git/* or utils/*, the plus/* code (including octokit dependencies) will never be loaded by Node nor included in a webpack/Rollup/esbuild bundle.

Licensing

  • LICENSE — governs utils/, git/, and git-cli/.
  • LICENSE.plus — governs everything under plus/ (currently plus/ai/, plus/git-github/, plus/agents/, plus/integrations/, and plus/notifications/). Proprietary; not for redistribution.

Versioning

Independent from the GitLens VS Code extension. Breaking changes may happen on any minor bump while the package is 0.x.

Source

Built from the packages/ workspace of vscode-gitlens, by pnpm --filter @gitkraken/core-gitlens run build in two steps:

  1. tsdown.config.ts compiles the nine packages' TypeScript sources straight into dist/, one emitted module per source module, each rooted at the subpath in the table above. It reads their src/ directly — the packages' own manifests resolve to source, so nothing here waits on their dist/ — and cross-package imports come out as relative paths, with #env/* staying external for the "imports" field to resolve.
  2. scripts/bundle.mjs assembles everything around that: it copies the LICENSEs and generates the manifest's exports, imports, and dependencies from the nine sub-packages' own manifests.

Neither the subpath layout nor the generated manifest is hand-written, so adding or removing a bundled package is a one-line change to scripts/packages.mjs, which both steps read.

The declaration files are emitted by the TypeScript compiler against tsconfig.core-dts.json at the repo root. That config sits at the root rather than beside this package because the emitter uses its directory as the compiler's rootDir, which has to contain every bundled source.

版本与发布记录

@gitkraken/core-gitlens 共发布 97 个版本,首次发布于 2026/04/21;过去 12 个月发布了 97 个版本。

版本发布日期距今
0.39.0latest2026/11/16今天
0.38.42026/11/16今天
0.38.32026/11/16今天
0.38.22026/11/151 天前
0.38.12026/11/151 天前
0.38.02026/11/142 天前

关于 @gitkraken/core-gitlens 的常见问题

@gitkraken/core-gitlens 是什么?

GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption

如何安装 @gitkraken/core-gitlens?

在项目目录运行 npm install @gitkraken/core-gitlens,或使用 pnpm add / yarn add / bun add。

@gitkraken/core-gitlens 支持 TypeScript 吗?

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

@gitkraken/core-gitlens 支持 ESM 还是 CommonJS?

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

@gitkraken/core-gitlens 需要什么版本的 Node.js?

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

@gitkraken/core-gitlens 可以商用吗?

@gitkraken/core-gitlens 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@gitkraken/core-gitlens 的下载量有多少?

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

@gitkraken/core-gitlens 还在维护吗?

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