npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

long-git-cli

v2.0.5

Published

Bitbucket + Jenkins deployment CLI with V2 web configuration center.

Downloads

883

Readme

Long CLI 2.0

long-git-cli 是一个面向 Bitbucket + Jenkins 的自动化部署工具。
2.0 版本引入了新的 V2 配置模型、Web 配置中心、独立部署守护进程,以及统一的 CLI / Web 流水线执行链路。

安装

npm install -g long-git-cli --registry https://registry.npmjs.org/

本地开发:

npm install
npm run build
npm link

说明:

  • 2.0.1 起不再在安装阶段下载 Puppeteer 浏览器
  • 涉及 Jenkins 自动登录或 long oa 时,默认直接使用本机已安装的 Chrome / Chromium

2.0 核心变化

  • 配置中心升级为 long config Web UI
  • 配置模型升级为 V2:credentials / projects / environments / pipelines / history
  • Web 服务与部署服务拆分
  • Web 与 CLI 共用同一套流水线配置和部署执行语义
  • 部署主流程改为 Bitbucket API 驱动,不再依赖本地项目目录执行 Git
  • 支持流水线部署历史、最近一次部署日志、Jenkins 参数读取

命令

long config

long config

启动 Web 配置中心,用于管理:

  • Bitbucket 凭证
  • Jenkins 凭证
  • 项目
  • 环境
  • 流水线
  • 部署历史

long deploy

long deploy
long deploy --list
long deploy --project frontend-msg-admin --env test01

用途:

  • 作为“快捷触发已配置流水线”的 CLI 入口
  • 自动唤起后台部署守护进程
  • 触发后实时输出部署日志

执行链路:

  1. 根据已配置流水线读取项目、环境、分支
  2. 通过 Bitbucket API 获取最近时间最新的匹配 Tag
  3. 基于 tagPrefix 生成下一个 Tag
  4. 创建 Tag 并等待 Bitbucket Pipeline 构建完成
  5. 触发环境绑定的 Jenkins Job
  6. 等待 Jenkins 构建完成
  7. 落库部署历史和完整日志

long tag

long tag
long tag --env uat

保留为独立 Tag 工具。
long uat-tag 仍然可用,但只是兼容别名。

long commit

long commit

交互式规范化提交并 push。

V2 配置模型

2.0 版本统一使用:

{
  "version": "2.0.0",
  "credentials": {},
  "projects": {},
  "environments": {},
  "pipelines": {},
  "history": []
}

说明:

  • projects:项目基础元数据,仅维护仓库信息
  • environments:环境配置,包含 tagPrefixjenkinsJobNamejenkinsTagParameter、额外 Jenkins 参数
  • pipelines:项目 + 环境 + 分支 的部署入口
  • history:部署历史和完整日志

旧版 config.json 只保留凭证迁移价值。
业务配置以 config-v2.json 为准。

Web 配置说明

项目

项目只维护基础信息:

  • 项目名称
  • Bitbucket 仓库地址

仓库地址会自动解析出:

  • workspace
  • repoSlug

环境

每个项目下可配置多个环境,例如:

  • test01
  • uat

每个环境支持:

  • tagPrefix
  • jenkinsJobName
  • jenkinsTagParameter
  • jenkinsParameters

其中:

  • tagPrefix 只需要填写前缀,例如 testuat
  • 系统会按此前缀找到最近一次部署所使用的 Tag,并递增最后一段数字

流水线

流水线是最终部署入口。
流水线配置项包括:

  • 流水线名称
  • 所属项目
  • 所属环境
  • 部署分支

同一条流水线,无论从 Web 还是 CLI 触发,执行结果应保持一致。

Jenkins 参数

某些 Jenkins Job 需要额外参数,例如:

brand=hy
action=approve

2.0 支持两种方式:

  • 手动填写额外 Jenkins 参数
  • 在环境配置中点击“读取 Jenkins 参数”,从 Jenkins Job 自动读取参数定义

这可以解决 Jenkins 页面显示字段名与真实参数名不一致的问题,例如:

  • 页面显示:tag
  • 实际参数:TAG_VERSION

部署历史与日志

每条流水线都支持:

  • 查看部署记录
  • 查看最近一次部署日志

历史记录会持久化:

  • 部署状态
  • Tag
  • Jenkins 构建号
  • 完整日志

即使守护进程重启,最近一次部署日志仍然可以从历史记录中查看。

测试与构建

npm run build
npm test -- --runInBand

迭代文档

当前仓库已补齐 V2 相关单测,包括:

  • 配置迁移
  • 配置关系同步
  • Git 校验
  • Tag 生成

Breaking Changes

2.0 包含破坏性更新:

  • 不再以旧版项目路径模型作为主流程
  • 不再推荐在本地仓库内直接通过 Git 推 Tag 部署
  • Web UI 菜单和页面结构已按 V2 重组
  • 配置主文件从旧版逻辑迁移到 config-v2.json

发布

npm run build
npm test -- --runInBand
npm publish --registry https://registry.npmjs.org/ --access public

License

MIT