@bensandee/forgejo-cli

中文文档
0.10.0发布于 2026/11/06MITES Module近 30 天下载 2742

bst-fj: Forgejo API commands without the rest of bst

原始使用文档
文档目录4 节
  1. Installation
  2. Connection
  3. Environment file
  4. Commands

@bensandee/forgejo-cli

bst-fj: the Forgejo API commands, without the rest of bst. Most of these commands used to ship on @bensandee/tooling's bst bin; issue:*, pr:create, pr:update, pr:ready, pr:reopen and pr:retarget still do, and run the same code.

Installation

pnpm add -D @bensandee/forgejo-cli

# Or run directly
pnpm dlx @bensandee/forgejo-cli --help

Connection

Every command finds its repository and token the same way bst does. It reads the environment first:

VariableMeaning
FORGEJO_SERVER_URLThe forge's base URL, such as https://codeberg.org
FORGEJO_REPOSITORYThe target repository as owner/repo
RELEASE_TOKENThe API token (FORGEJO_TOKEN is used when this is unset)

When the server URL or repository is not set, it falls back to the origin git remote, then to package.json#repository. A command that takes --repo targets that repository instead.

Environment file

Set BST_ENV_FILE to the path of an env file, and bst-fj loads it before anything else runs, the same way bst does. A variable already set in the environment always wins over the file. A file that cannot be read stops the command before it starts. This is for development only: a production run should get every variable from its environment and leave BST_ENV_FILE unset.

Commands

Run bst-fj --help for the list and bst-fj <command> --help for each command's flags. Every command takes --json, which prints exactly one JSON document, failures included.

CommandWhat it does
labelslist a repository's labels, or sync one named set from a --file (creates and updates, never deletes)
secretsset, list or delete Forgejo Actions secrets
webhooksList webhooks across an instance (system, user, org and repo)
release:createCreate a release for a tag the forge already has; refuses a tag the forge lacks unless given --target
pr:checksRead a pull request's CI verdict, optionally --wait for it to settle
pr:listList a repository's pull requests
commit:statusRead the status checks for a commit SHA, branch, tag or git ref
issue:*view, list, comment, create, update, download, label, unlabel, set-labels, close, reopen
pr:createPush the current branch and open a pull request, deriving the title and body when none is given; reports no closed-issue claims, which bst pr:create does
pr:updatePush the current branch and update its open pull request
branch:listList a repository's branches
branch:deleteDelete a branch through the API; reports the forge's reason when it refuses
pr:filesList the files a pull request changes
pr:mergeMerge an open, non-draft, mergeable PR pinned to the head it read; refuses closed, draft, conflicted, unconfirmed or non-green checks (zero statuses included) unless --ignore-checks; --delete-branch is opt-in
pr:readyMark a draft pull request ready, dropping one WIP: prefix or taking --title, and confirm the forge no longer reports a draft; the number defaults to the current branch's open pull request
pr:closeClose an open pull request, optionally posting --comment/--comment-file first; reports an already-closed or merged PR without writing; refuses an issue
pr:reopenReopen a closed pull request and confirm the forge reports it open; reports an already-open PR without writing; refuses a merged PR and an issue; the number defaults to the current branch's closed, unmerged pull request
pr:retargetRepoint an open pull request at a new base branch, confirm the forge took it, and report its mergeability as advice; the number defaults to the current branch's open pull request
workflow:dispatchDispatch a workflow with --workflow, --ref and repeatable --input; takes --repo owner/repo, not a URL
ci:runsList a repository's workflow runs with their jobs, filtered by workflow, ref, pull request, head SHA or status
ci:logPrint one workflow job's whole log, or with --grep only the lines whose text matches

Zero posted statuses reads as no-status, never as green. Every command is Forgejo-only: on GitHub, use gh. The issue:*, pr:create, pr:update, pr:ready, pr:reopen and pr:retarget commands take the same flags and print the same --json documents as bst's, except that issue:create has no config default for assignees.

版本与发布记录

@bensandee/forgejo-cli 共发布 24 个版本,首次发布于 2026/10/01;过去 12 个月发布了 24 个版本。

版本发布日期距今
0.10.0latest2026/11/062 天前
0.9.02026/11/043 天前
0.8.02026/11/035 天前
0.7.02026/10/309 天前
0.6.22026/10/2810 天前
0.6.12026/10/2712 天前

关于 @bensandee/forgejo-cli 的常见问题

@bensandee/forgejo-cli 是什么?

bst-fj: Forgejo API commands without the rest of bst

如何安装 @bensandee/forgejo-cli?

在项目目录运行 npm install @bensandee/forgejo-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 bst-fj,可以用 npx bst-fj 直接运行。

@bensandee/forgejo-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bensandee__forgejo-cli 是否存在。

@bensandee/forgejo-cli 支持 ESM 还是 CommonJS?

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

@bensandee/forgejo-cli 可以商用吗?

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

@bensandee/forgejo-cli 的下载量有多少?

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

@bensandee/forgejo-cli 还在维护吗?

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