effective-command
v0.2.2
Published
Local AI command toolbox for individual developers.
Downloads
284
Readme
effective_command
面向个人开发者的本地 AI 命令工具。
当前 MVP 提供两个命令:根据当前 Git 仓库里尚未提交的代码变更生成 commit message,或对这些变更做一次本地 review。
命令
ec commit
ec reviewec commit
默认行为:
- 检查当前目录是否是 Git 仓库。
- 检查是否存在未提交变更。
- 调用本地
codex exec。 - 让 Codex 自行读取
git status --short、git diff HEAD --stat、git diff HEAD。 - 用边框输出一条 commit message。
- 询问是否使用这条 message 执行
git commit。
确认提示:
Use this message and run git commit? [Y/n]直接按 Enter 默认执行提交,输入 n 则只输出 message,不提交。
ec commit 默认不会把 Codex 的中间过程或完整 git diff 打到终端里;只有最终 commit message 和必要的状态信息会显示出来。Codex 或 git commit 长时间运行时,会定期输出仍在运行的状态提示。
ec review
默认行为:
- 检查当前目录是否是 Git 仓库。
- 检查是否存在未提交变更。
- 调用本地
codex exec。 - 让 Codex 自行读取
git status --short、git diff HEAD --stat、git diff HEAD。 - 用彩色标题、分隔线和自动换行输出审查结果。
ec review 只输出建议,不会修改文件,也不会执行 git commit。
使用
本地需要已经安装并登录 Codex CLI:
codex --help
codex login本仓库内直接运行:
./bin/ec.js commit安装后运行:
npm install -g effective-command
ec commit
ec review本地开发时可以把当前仓库链接为全局命令:
npm link
ec commit
ec review取消本地链接:
npm unlink -g effective-command参数
ec commit --lang zh-CN
ec commit --style conventional
ec commit --model gpt-5
ec commit --profile work
ec commit --copy
ec commit --log
ec review --lang zh-CN
ec review --model gpt-5
ec review --log参数说明:
--lang <locale>:输出语言,默认zh-CN。--style <style>:commit 风格,默认conventional,仅用于ec commit。--model <model>:透传给codex exec --model。--profile <profile>:透传给codex exec --profile。--copy:生成后尝试复制到剪贴板,仅用于ec commit。--log:打印更详细的运行日志,包括当前仓库上下文、实际执行的 Codex/Git 命令,以及 Codex 或 Git 子进程输出。
环境变量:
EFFECTIVE_COMMAND_LANGUAGE=zh-CN
EFFECTIVE_COMMAND_MODEL=gpt-5
EFFECTIVE_COMMAND_CODEX_PROFILE=work发布
发布前检查:
npm run check
npm pack --dry-run升级版本:
npm version patch --no-git-tag-version也可以按需要使用:
npm version minor --no-git-tag-version
npm version major --no-git-tag-version登录 npm:
npm login
npm whoami发布:
npm publish --otp=你的验证码或recovery_codenpm 不允许覆盖已经发布过的版本。如果发布时报:
You cannot publish over the previously published versions需要先升级 package.json 里的版本号,再重新发布。
安装最新版本:
npm install -g effective-command@latest
ec --help如果本机已经安装过旧版本,可以强制更新:
npm install -g effective-command@latest --forcePrompt
ec commit 和 ec review 都不把 diff 内容塞进 prompt,也不通过 stdin 传代码。它们只提供任务说明,让 Codex 在本地仓库中自己读取变更。
核心提示词形态:
You are running inside a local Git repository. Generate a high quality Git commit message by inspecting the local uncommitted changes yourself with read-only commands.
Suggested commands:
- git status --short
- git diff HEAD --stat
- git diff HEAD
Output language: zh-CN
Commit style: conventional
Rules:
- Return only the commit message.
- Do not wrap it in markdown.
- Do not explain your reasoning.
- First line must be <= 72 characters.
- If style is conventional, use "type(scope): summary" when a scope is obvious.
- Add a short body with bullets only when it adds useful context.
- Do not mention files mechanically unless it clarifies the behavior change.
Do not modify files. Do not run git commit.当前结构
effective_command/
README.md
package.json
bin/
ec.js
src/
main.js后续方向
先把 ec commit 和 ec review 做稳定,再考虑增加其他命令。暂时不做:
ec configec summary- 插件系统
- 多 provider 管理
- 直接管理 API key
