@fajiang/ltgr-cli
v1.2.1
Published
Fajiang Lantian Gerui CLI query tool.
Keywords
Readme
蓝天格锐 CLI
蓝天格锐查询 CLI,命令前缀为 ltgr。本工具只做查询,不做新增、修改、删除、导入、导出、同步或重算;权限、脱敏、分页和状态枚举以后端接口为准。
安装
npm install --global @fajiang/ltgr-cli
ltgr auth status
ltgr skill status安装后会尝试同步 Skill 到 ~/.agents/skills/ltgr。如果自动同步失败,可以手动执行:
ltgr skill install
ltgr skill reinstall本地调试
cd /Users/kailiu/developEnvironment/project/fajiang/fajiang-ltgr-cli
npm install
npm run link:local
ltgr --help
ltgr auth mode --name dev --base-url http://127.0.0.1:8082
ltgr auth manual --token YOUR_TOKEN_HERE
ltgr auth status
ltgr organization my --format json
ltgr organization switch --org-id ORG_ID --format jsonLTGR CLI 专用于蓝天-己任追赔工作台组织。业务查询会校验当前组织;如果当前登录组织不是蓝天-己任追赔工作台,请先用 organization my 查看可用组织,再用 organization switch 切换。
取消本地链接:
npm run unlink:localJSON 请求文件
查询字段较多时,推荐先复制示例 JSON,再执行查询:
ltgr examples list
ltgr examples print --name transaction.query.json
ltgr examples copy --name transaction.query.json --output ./transaction.query.json
ltgr guide --target command.transaction.query --json ./transaction.query.json --format json
ltgr transaction query --json ./transaction.query.json --format json命令行参数会覆盖 JSON 文件中的同名参数:
ltgr transaction query --json ./transaction.query.json --name 张三 --page 0 --limit 20 --format jsonJSON 文件与命令行参数会合并为同一份请求参数,再按对应命令的 schema 校验。JSON 文件只能包含业务查询字段;未知字段、all、错误日期和不支持的筛选条件都会在请求发出前报错。format、json、command、subcommand 等 CLI 控制参数不能写入 JSON 文件。
name、phone、idCard、userId 会由 CLI 按业务 schema 自动解析或映射。自然身份查询默认必须唯一;如果姓名、手机号或身份证号命中多个用户,CLI 会返回 AMBIGUOUS_IDENTITY,不会自动合并多个用户继续查询。只有显式传入 --user-id、--user-ids 或 JSON 中的 userIds 时,才视为明确指定查询主体。
业务查询会通过 transformResult 在后端原始记录上追加 normalized 字段,便于模型理解;原始后端字段会完整保留,不会被覆盖或删除。
简单姓名查询可以直接使用 --name,不要要求用户先提供手机号或用户 ID:
ltgr contract query --name 刘凯 --format json
ltgr material query --name 刘凯 --format jsonGuide
guide 返回机器可读的字段提示、姓名规则和建议命令,用于模型组装查询:
ltgr guide --target command.contract.query --json ./contract.query.json --format json
ltgr guide contract query --json ./contract.query.json --format json
ltgr guide comment detail --json ./comment.detail.json --format json查询命令
ltgr victim query --json ./victim.query.json --format json
ltgr questionnaire query --json ./questionnaire.query.json --format json
ltgr material query --json ./material.query.json --format json
ltgr contract query --json ./contract.query.json --format json
ltgr transaction query --json ./transaction.query.json --format json
ltgr clearance query --json ./clearance.query.json --format json
ltgr handwrite query --json ./handwrite.query.json --format json
ltgr exception query --json ./exception.query.json --format json
ltgr kyc-link query --json ./kyc-link.query.json --format json
ltgr sign query --json ./sign.query.json --format json
ltgr comment query --page 0 --limit 10 --format json
ltgr comment query --replied no --format json
ltgr comment query --name 刘凯 --format json
ltgr comment query --user-id USER_ID --format json
ltgr comment detail --name 刘凯 --format json
ltgr comment detail --user-id USER_ID --format json
ltgr whitelist query --json ./whitelist.query.json --format json
ltgr review-log query --json ./review-log.query.json --format jsonmaterial-analyse 已统一重命名为 material。对外文档、Skill、示例和 guide 均使用 ltgr material query;底层仍调用蓝天格锐材料分析列表接口,数据口径不变。
通用参数:
--json FILE
--name TEXT --phone TEXT --id-card TEXT --user-id ID
--page N --limit N
--format json常用辅助查询:
ltgr whitelist query --btype ltgr_questionnaire --name 张三 --format json
ltgr whitelist query --btype ltgr_kyc_link --page 0 --limit 10 --format json
ltgr whitelist query --btype ltgr_kyc_link --phone 13800000000 --format json
ltgr review-log query --customer-id USER_ID --type first --date-from 2026-06-01 --format json
ltgr comment query --replied no --format json
ltgr comment query --user-id USER_ID --format json
ltgr comment detail --name 刘凯 --format jsoncomment detail 返回 JSON;如需生成表格、报告或附件清单,请由 Codex 或业务工具基于 JSON 结果处理。
汇总、导出和批量处理
本 CLI 不提供独立的 summary、export 三级动作,不支持 --export、--format csv/table,也不内置 --batch-file。在 Codex 使用场景中:
- 统计或汇总:先执行对应
query --format json,必要时分页,再由 Codex 从返回结果的data字段中读取业务数据后计数、分组和生成报告。 - 本地导出:先执行
query --format json,再由 Codex 基于 JSON 结果生成 Markdown、CSV、Excel 或 Word 文件。 - 批量查询:由 Codex 读取本地 txt/csv/xlsx,识别姓名、手机号、身份证号或用户 ID,逐条调用
ltgr <command> query --format json,默认低并发执行,并从每次返回结果的data字段读取业务数据、从logId字段记录排查标识。
Codex 持久授权建议
Codex 的命令授权按前缀匹配。为了减少 guide、查询、日志排查和留言明细等命令反复弹授权,推荐一次性持久授权 LTGR CLI 前缀:
["ltgr"]本地开发若直接执行源码入口,可额外授权:
["node", "./bin/ltgr.js"]当前 CLI 定位为蓝天格锐查询工具。如果未来新增写操作、同步、批量修改或高风险管理命令,应重新评估授权策略,并改回更精确的命令前缀授权,例如:
["ltgr", "<command>", "query"]
["ltgr", "<command>", "detail"]CLI 的结果输出固定为 JSON;--format json 可显式声明,但省略时也会返回相同结构。--format table、--format csv 和 --export 会在执行前返回 JSON 格式的参数错误。
成功时,CLI 统一返回:
{
"success": true,
"logId": "LOG_ID",
"data": {}
}失败时会返回:
{
"success": false,
"logId": "LOG_ID",
"error": {
"code": "ERROR_CODE",
"message": "错误信息",
"detail": {}
}
}后续排查时,记录 CLI 命令和 logId,再通过 log query 查询日志。这里的 --trace-id 入参就是上一条命令返回的 logId:
ltgr log query --trace-id LOG_ID --format json查询某个用户作为被操作对象的操作日志列表时,使用对象类型和对象 ID 查询:
ltgr log query --obj-type user --obj-id USER_ID --format jsonlog query 复用后端现有组织管理员日志接口,执行账号需要具备组织管理员权限。CLI 当前只支持 JSON 输出。
Skill
ltgr skill status
ltgr skill install
ltgr skill reinstall默认 Skill 路径为 ~/.agents/skills/ltgr。status 会返回安装状态、当前版本、已安装版本、源路径和目标路径。
