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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ksconsole/smartgit

v1.0.2

Published

smartgit helps you write better commit messages with AI

Downloads

11

Readme


Setup

The minimum supported version of Node.js is the latest v14. Check your Node.js version with node --version.

  1. 安装:

    npm install -g @ksconsole/smartgit
  2. 获取你的api key 瀚海应用

  3. 设置你的密钥:

    smartgit config set BIG_DESERT_KEY=<你的token>

    会创建一个 .smartgit 文件在你的home目录下.

升级

检查安装的版本:

smartgit --version

如果不是最新版本, 运行:

   npm update -g @ksconsole/smartgit

Usage

CLI模式

你可以直接运行 smartgit 来生成一个提交信息:

git add <files...>
smartgit

smartgit 会将未知的标志传递给 git commit, 所以你可以传递 commit 标志.

例如, 你可以像平常一样提交:

smartgit --all # or -a

👉 提示: 使用 smg 别名, 如果 smartgit 太长.

生成多个推荐

有时候推荐的提交信息不是最好的, 所以你想生成几个来选择. 你可以通过传递 --generate <i> 标志来生成多个提交信息, 其中 'i' 是生成的消息数量:

smartgit --generate <i> # or -g <i>

警告: 这会使用更多的token, 这意味着它会花费更多.

生成 Conventional Commits

如果你想生成 Conventional Commits, 你可以使用 --type 标志, 后面跟上 conventional. 这将提示 smartgit 根据 Conventional Commits 规范格式化提交信息:

smartgit --type conventional # or -t conventional

这个功能在你遵循 Conventional Commits 标准或者使用依赖于这个提交格式的工具时非常有用.

Git hook

你也可以通过 prepare-commit-msg 钩子将 smartgit 与 Git 集成. 这让你像平常一样使用 Git, 并在提交之前编辑提交信息.

安装

在你要安装钩子的 Git 仓库中运行:

smartgit hook install

卸载

在你要卸载钩子的 Git 仓库中运行:

smartgit hook uninstall

使用

  1. 暂存你的文件并提交:

    git add <files...>
    git commit # Only generates a message when it's not passed in

    If you ever want to write your own message instead of generating one, you can simply pass one in: git commit -m "My message"

    1. Smartgit will generate the commit message for you and pass it back to Git. Git will open it with the configured editor for you to review/edit it.
  2. 保存并关闭编辑器来提交!

配置

读取配置值

要检索配置选项, 使用命令:

smartgit config get <key>

例如, 要检索api key, 你可以使用:

smartgit config get BIG_DESERT_KEY

你可以一次检索多个配置选项, 用空格分隔它们:

   smartgit config get OPENAI_KEY generate

设置配置值

要设置配置选项, 使用命令:

   aicommits config set <key>=<value>

例如, 要设置api key, 你可以使用:

aicommits config set BIG_DESERT_KEY=<你的api key>

你可以一次设置多个配置选项, 用空格分隔它们, 例如:

aicommits config set BIG_DESERT_KEY=<your-api-key> generate=3 locale=en

选项

BIG_DESERT_KEY

必填

获取api key 瀚海应用.

locale

默认: zh

生成的提交信息所使用的语言.

generate

Default: 1

生成的提交信息数量.

注意, 这会使用更多的token, 因为它生成了更多的结果.

proxy

设置HTTP/HTTPS代理.

要清除代理选项, 你可以使用命令 (注意等号后面的空值):

smartgit config set proxy=

timeout

默认: 10000 (10秒)

设置网络请求到瀚海API的超时时间, 单位为毫秒.

smartgit config set timeout=20000 # 20s

max-length

默认: 50

设置生成的提交信息的最大字符长度.

smartgit config set max-length=100

How it works

这个CLI工具运行 git diff 来获取你最新的代码更改, 然后将它们发送到瀚海的GPT-3, 然后返回AI生成的提交信息.