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

cli-contract-review

v1.0.0

Published

CLI 工具用于通过命令行访问合同评审系统 - Contract Review System CLI Tool

Readme

CLI 合同工具

一个强大的命令行工具,用于通过 CLI 访问合同评审系统。支持合同管理、评审操作和统计分析。

功能特性

  • 🔐 认证管理 - 安全的 Token 认证
  • 📄 合同管理 - 列表、查询、上传、删除合同
  • 📊 评审操作 - 查询状态、启动评审、获取总结
  • 📈 统计分析 - 整体概览、风险分布、通过率统计
  • 🎨 多种输出格式 - JSON、Table、CSV
  • 🌍 多 API 端点支持 - 动态配置端点

快速开始

安装

# 全局安装
npm install -g cli-contract

# 开发安装
git clone <repo>
cd cli-contract
pnpm install
pnpm link --global

基本使用

# 登录
cli-contract auth login --token your-token-here

# 查看当前用户
cli-contract auth whoami

# 查询合同列表
cli-contract contract list

# 获取合同详情
cli-contract contract info file123

# 查询评审状态
cli-contract review status file123

# 查看统计概览
cli-contract stats overview

# 退出登录
cli-contract auth logout

命令详细说明

认证命令

cli-contract auth login --token <token>          # 登录
cli-contract auth logout                         # 退出登录
cli-contract auth whoami                         # 显示当前用户

合同管理

cli-contract contract list                       # 查询合同列表
  --limit <n>      分页大小 (默认: 50, 最大: 200)
  --offset <n>     偏移量 (默认: 0)
  --output <fmt>   输出格式 [json|table|csv]

cli-contract contract info <fileId>             # 获取合同详情

cli-contract contract upload <filePath>         # 上传合同文件

cli-contract contract delete <fileId>           # 删除合同
  --force          强制删除,不需要确认

评审管理

cli-contract review status <fileId>             # 查询评审状态
  --type <type>    评审类型 [risk|base|all]

cli-contract review risk <fileId>               # 启动风险评审

cli-contract review base <fileId>               # 启动基线评审

cli-contract review summary <fileId>            # 获取评审总结

统计分析

cli-contract stats overview                     # 整体统计概览
  --time-range <range>   时间范围 [today|week|month|year|custom]
  --start-date <date>    开始日期 YYYY-MM-DD
  --end-date <date>      结束日期 YYYY-MM-DD
  --save <path>          保存结果到文件

cli-contract stats risk-distribution            # 风险分布分析
  --group-by <field>     分组字段 [level|item|date]

cli-contract stats pass-rate                    # 通过率统计
  --type <type>          评审类型 [risk|base|all]

全局选项

--endpoint <url>          指定 API 端点 (默认: http://localhost:3000)
--output <format>         输出格式 [json|table|csv] (默认: json)
--verbose                 详细输出模式
--no-color               禁用彩色输出

配置

本地配置文件保存在 ~/.cli-contract/config.json,包括:

  • API Token
  • 用户信息
  • API 端点
  • 输出格式偏好

日志文件保存在 ~/.cli-contract/logs/

环境变量

  • VITE_ENABLE_DEBUG - 启用 Debug 日志
  • DEBUG - 启用 Debug 日志

开发

# 安装依赖
pnpm install

# 运行测试
pnpm test

# 运行 ESLint
pnpm lint

# 自动修复代码
pnpm lint:fix

# 代码格式化
pnpm format

# 开发模式(文件变化自动重启)
pnpm dev

测试

项目使用 Jest 进行单元测试。

# 运行所有测试
pnpm test

# 监视模式
pnpm test:watch

# 生成覆盖率报告
NODE_OPTIONS='--experimental-vm-modules' jest --coverage

架构

项目结构遵循 TDD(测试驱动开发)原则:

cli-contract/
├── bin/                   # 可执行入口
├── src/
│  ├── commands/          # 命令处理模块
│  ├── client/            # API 客户端
│  ├── utils/             # 工具函数
│  └── index.js           # 主程序入口
├── tests/                # 测试文件
└── docs/                 # 文档

规范

  • 代码规范: ES6+, ESLint, Prettier
  • 测试规范: TDD, Jest 框架,覆盖率 ≥ 60%
  • 文档规范: Markdown, JSDoc 注释
  • 语言: 简体中文注释和输出

许可

ISC

变更日志

v1.0.0 (2026-03-17)

  • 初始发布
  • 实现所有 P0 版本功能
  • 完整的命令行界面
  • 多格式输出支持