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

@delilegal/deli-cli

v0.4.0

Published

Deli Open Platform CLI for providing tools to skills.

Readme

@delilegal/deli-cli

得理开放平台命令行客户端,用于向 skill 提供法规检索、案例检索和 OCR 文件解析等开放平台工具能力。

本地开发与构建

cd deli-cli
pnpm install
pnpm run build

pnpm run build 会通过打包器生成 dist 产物。

构建后可直接运行:

node dist/cli.js --help

如需把 deli-cli 注册为本机全局命令:

pnpm link --global
deli-cli --help

本地发布前校验:

pnpm run verify

pnpm run verify 会同时验证普通构建和发布构建,并对发布包做 dry-run 检查。

生成发布构建产物:

pnpm run build:release

build:release 会重建 dist,确认不包含 source map 或类型声明文件,并检查 CLI 可启动;它只生成发布用 dist,不生成 tarball。

本地生成 tarball:

pnpm run pack:local

pack:local 会执行发布构建并生成最终 tarball,输出到 pack/ 目录;同时检查包内不包含源码、测试文件或 .map 文件。

发布与 npx 使用

pack/ 目录中的 .tgz 是最终发布包。例如:

pnpm run pack:local
pnpm publish pack/delilegal-deli-cli-1.0.0.tgz --access public

发布到 npm registry 后,用户可以通过 npx 临时下载并执行包内的 bin 入口:

npx -y @delilegal/deli-cli@latest --help

也可以用更显式的 npm exec 写法:

npm exec --package @delilegal/deli-cli@latest -- deli-cli --help

npx/npm exec 读取 package.json 中的 bin.deli-cli,实际执行的是发布包里的 dist/cli.js

配置

API Key 获取地址:https://open.delilegal.com/personal/keys

写入本机配置:

deli-cli init --apikey "<你的 API Key>"

API Key 会以加密形式保存到本机配置文件。若只想在当前 shell 环境注入加密后的 API Key,并跳过本机配置写入:

eval "$(deli-cli init --apikey "<你的 API Key>" --print-env --no-write)"

也可以把输出的 DELI_CLI_ENCRYPTED_APIKEY 写入特定 bash 环境;该环境变量优先于本机配置。

如需指向自定义测试环境域名,可同时指定 Open Platform API baseUrl:

deli-cli init --apikey "<你的测试环境 API Key>" --base-url "https://platform.ailawyers.cn/api/v1"

也可以仅在当前 shell 中设置 API Key 和 Base URL,不写入配置文件:

eval "$(deli-cli init --apikey "<你的测试环境 API Key>" --base-url "https://platform.ailawyers.cn/api/v1" --print-env --no-write)"

此时会输出并设置 DELI_CLI_ENCRYPTED_APIKEYDELI_CLI_BASE_URL。两者都优先于配置文件;Base URL 的完整优先级为:环境变量、配置文件、内置默认值。

配置会保存到:

~/.deli/cli/config.json

检查本机环境和 API Key 是否可用:

deli-cli check

使用方式

业务命令由远端 skill 实时提供。先用 cmds 发现某个 skill 当前可用的命令,并创建一个 run_... 调用入口:

deli-cli cmds [email protected]

输出会包含本次可复制的 run id、用法和命令参数。

usage: deli-cli run_a1b2c3d4e5f6 COMMAND [options]

commands:
  The following skill commands are available.

  COMMAND
    case-list            案例检索

    usage:              deli-cli run_a1b2c3d4e5f6 case-list --arg <value>
    required options:
      --query <string>  检索关键词
    optional options:
      --page-no <integer>  页码

实际命令名、参数名和说明以 cmds 当前输出为准。随后按 usage 行的命令形态,结合 options 传参:

deli-cli run_a1b2c3d4e5f6 case-list --query "劳动合同"

如果远端 skill 暴露 skill-version 工具,cmds 会自动检查当前版本和最新版本。只有最新版本高于当前版本时,输出开头才会出现 notice 提示;远端返回技能包 URL 时会显示 download 行,否则只显示得理法律 AI 开放平台下载入口。

查询类参数也可以用位置参数传入:

deli-cli run_a1b2c3d4e5f6 law-list "员工连续旷工三天 公司能否解除劳动合同"

cmds 只支持下列可选参数:

  • --refresh:跳过本地缓存,重新从远端获取最新命令说明;不加时会优先使用本地已发现过的命令说明,但仍会生成新的 run_... 入口。
  • --json:输出结构化 JSON,适合脚本或上层 agent 继续处理。

run_... <command> 的输出和缓存可选参数:

  • 默认输出:普通 skill 命令默认以 Markdown 输出。远端返回 Markdown 或文本时会直接输出;检索类响应包含 data 数组时,会按“结果元信息 → 单条元信息 → highlights → 正文”的顺序展示。
  • --json:输出远端原始 JSON 响应,适合脚本或上层 agent 继续处理。
  • --md / -m:显式使用默认 Markdown 输出;这是 run_... 的输出选项,不是 cmds 的参数。
  • --refresh:跳过本地工具缓存,重新获取该命令的远端 schema 后再调用。
  • --verbose / -v:把诊断信息写到 stderr,不污染 stdout。

OCR 文件解析

当某个 skill 同时提供文件上传和文件解析能力时,cmds 会聚合出一个 ocr-parse 命令,不需要手工串联底层上传接口:

deli-cli cmds [email protected]
deli-cli run_a1b2c3d4e5f6 ocr-parse --file ./scan.pdf

默认会把解析后的 Markdown 输出到 stdout。如需落盘、保留原始响应或指定解析参数,按需追加下列可选参数。

OCR 支持常见 PDF、Word、Excel、OFD、图片和文本类文件。ocr-parse 的可选参数:

  • --output-dir <dir>:把 Markdown 写入指定目录;不加时默认输出到 stdout。
  • --save-response:在落盘时同时保留远端原始响应。
  • --json:输出远端原始响应。
  • --lang <lang>--task-type <type>:只会在远端 schema 暴露时传入。

输出格式

普通 skill 命令默认输出 Markdown:

deli-cli run_a1b2c3d4e5f6 law-list "劳动合同"

如需结构化 JSON,请显式追加 --json

deli-cli run_a1b2c3d4e5f6 law-list "劳动合同" --json

开发结构

src/
├── cli.ts                    # 根路由和命令分发
├── config/                   # manifest、用户配置、文件路径
├── commands/                 # init/check/docs/skill 等命令入口
├── mcp/                      # MCP client、协议解析、缓存、run 和动态参数构建
├── services/                 # HTTP 工具和 OCR 本地封装
└── utils/                    # 参数解析、校验、格式化、错误处理