@devframes/plugin-git

中文文档
1.3.3发布于 2026/11/10MITTypeScriptES Module构建来源已验证近 30 天下载 2715

Devframe plugin that shows a Git dashboard for status, log, branches, and diffs.

原始使用文档
文档目录5 节
  1. Install
  2. Standalone CLI
  3. Programmatic
  4. RPC
  5. Develop

@devframes/plugin-git

[!WARNING] Experimental This devframe is experimental and may change without a major version bump until it stabilizes.

A git devframe built on devframe: a repository dashboard with a Next.js App Router + shadcn/ui SPA over type-safe RPC. The node side shells out to git and exposes the repository; the same bundle runs as a live dev server or a fully static deployment.

Status, a SourceTree-style commit graph, branches, and diffs, plus staging, unstaging, and committing, all through the shared @devframes/service-git wire service. The UI follows the system light/dark preference with a manual toggle.

Install

npm i -D @devframes/plugin-git

Standalone CLI

Run the dashboard against the current repository:

pnpx @devframes/plugin-git         # dev server (live RPC over WebSocket)
pnpx @devframes/plugin-git build   # static deploy → dist-static/
pnpx @devframes/plugin-git --port 4000

Programmatic

createGitDevframe(options) returns a devframe definition you can mount into any host framework with devframe's adapters, or drive yourself.

import { createGitDevframe } from '@devframes/plugin-git'
import { createCac } from 'devframe/adapters/cac'

await createCac(createGitDevframe({
  repoRoot: process.cwd()
})).parse()
OptionDefaultDescription
repoRootthe devframe cwdRepository directory to inspect.
basePathadapter-resolvedMount path (/ standalone, /__git/ hosted).
distDirbundled SPAOverride the served SPA directory.
port9710Preferred dev-server port.

RPC

All git work runs through the @devframes/service-git wire service, which this devframe declares (services) and its SPA calls directly over devframes:service:git:*. The read functions are query functions that degrade to an empty, isRepo: false result outside a git repository; the definition opts them into the static build via rpc.snapshot (resolved live over WebSocket in dev, served from a build-time snapshot for static deploys).

  • devframes:service:git:status: branch, upstream tracking (ahead/behind), staged / unstaged / untracked files, parsed from git status --porcelain=v2.
  • devframes:service:git:log: paginated commit history (limit / skip) including parent hashes, which drive the commit graph.
  • devframes:service:git:branches: local branches with SHA, upstream, ahead/behind, tip subject.
  • devframes:service:git:diff: per-file added/deleted counts for the working tree or index, plus a unified patch for a selected file.

Write actions are action functions, always exposed by the service, with write authorization governed by the connection-trust boundary. Each returns fresh status (commit returns a result):

  • devframes:service:git:stage: git add the given paths.
  • devframes:service:git:unstage: git restore --staged the given paths.
  • devframes:service:git:commit: commit the staged changes with a message.

Develop

pnpm -C plugins/git dev     # client (Next.js HMR) + RPC backend together
pnpm -C plugins/git build   # tsdown (node) + next build (SPA) → dist/

pnpm dev starts the Next.js dev server (with hot-reload) and the devframe RPC/WebSocket backend at the same time, then prints both URLs; open the UI one. The SPA connects to the backend over the WebSocket port carried in NEXT_PUBLIC_DEVFRAME_WS. Override ports with PORT (UI) and DEVFRAME_GIT_PORT (backend). Run a single side with dev:client or dev:server.

The SPA is a standard shadcn/ui setup (Tailwind v4, components/ui/*). Three Next.js settings in app/next.config.mjs keep it portable: output: 'export' (devframe owns the server), assetPrefix: '.' (relative assets so the same bundle works at any base), and trailingSlash: true (composes with devframe's static directory-with-index resolution).

版本与发布记录

@devframes/plugin-git 共发布 68 个版本,首次发布于 2026/07/06;过去 12 个月发布了 68 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.3.3latest2026/11/101 天前
1.3.22026/11/0210 天前
1.3.12026/11/0110 天前
1.3.02026/10/3112 天前
1.2.62026/10/1924 天前
1.2.52026/10/1429 天前

关于 @devframes/plugin-git 的常见问题

@devframes/plugin-git 是什么?

Devframe plugin that shows a Git dashboard for status, log, branches, and diffs.

如何安装 @devframes/plugin-git?

在项目目录运行 npm install @devframes/plugin-git,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 devframe-git,可以用 npx devframe-git 直接运行。

@devframes/plugin-git 支持 TypeScript 吗?

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

@devframes/plugin-git 支持 ESM 还是 CommonJS?

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

@devframes/plugin-git 可以商用吗?

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

@devframes/plugin-git 的下载量有多少?

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

@devframes/plugin-git 还在维护吗?

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