gangtise-openapi-cli 0.10.3 → 0.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,18 +2,12 @@
2
2
 
3
3
  一个可直接调用 Gangtise OpenAPI 的命令行工具。
4
4
 
5
- ## 安装
5
+ ## 首次安装
6
6
 
7
7
  ```bash
8
8
  npm install -g gangtise-openapi-cli
9
9
  ```
10
10
 
11
- 更新到最新版:
12
-
13
- ```bash
14
- npm update -g gangtise-openapi-cli
15
- ```
16
-
17
11
  验证安装:
18
12
 
19
13
  ```bash
@@ -28,8 +22,22 @@ cd gangtise-openapi-cli
28
22
  npm install
29
23
  npm run dev -- --help
30
24
  ```
25
+ ## 版本更新
26
+
27
+ 查看当前版本(自动与线上版本比对):
28
+
29
+ ```bash
30
+ gangtise --version
31
+ ```
32
+
33
+ 手动更新到最新版:
34
+
35
+ ```bash
36
+ npm update -g gangtise-openapi-cli
37
+ ```
31
38
 
32
- ## 配置
39
+
40
+ ## 环境配置
33
41
 
34
42
  优先读取以下环境变量:
35
43
 
@@ -43,6 +51,51 @@ export GANGTISE_TOKEN="Bearer xxx"
43
51
  如果没有 `GANGTISE_TOKEN`,CLI 会自动调用 token 接口并缓存到本地。
44
52
 
45
53
 
54
+ ## AI Agent Skill
55
+
56
+ 本项目包含 Skill 定义(`gangtise-openapi/SKILL.md`),可让 AI agent 自动调用 `gangtise` CLI 完成投研数据查询。支持以下 AI 编程助手:
57
+
58
+ - [Claude Code](https://claude.ai/claude-code) — `~/.claude/skills/`
59
+ - [OpenClaw](https://github.com/openclaw/openclaw) — `~/.openclaw/skills/`
60
+ - [Hermes](https://github.com/nicepkg/hermes) — `~/.hermes/skills/`
61
+
62
+ Skill 目录结构:
63
+
64
+ ```
65
+ gangtise-openapi/
66
+ ├── SKILL.md # 主 skill 文件(命令参考、参数枚举、使用规则)
67
+ └── references/
68
+ ├── fields.md # 字段中英文对照速查表
69
+ └── lookup-ids.md # 常用 ID 速查表(行业/券商/机构/公告分类等)
70
+ ```
71
+
72
+ 安装:
73
+
74
+ ```bash
75
+ # Claude Code
76
+ cp -r gangtise-openapi ~/.claude/skills/gangtise-openapi
77
+
78
+ # OpenClaw
79
+ cp -r gangtise-openapi ~/.openclaw/skills/gangtise-openapi
80
+
81
+ # Hermes
82
+ cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
83
+ ```
84
+
85
+ > **版本更新**:每次 CLI 发版时,`gangtise-openapi/SKILL.md` 的 `version` 字段会自动同步。更新 CLI 后,请将项目中的 `gangtise-openapi/` 目录重新复制到对应的 skills 目录覆盖更新:
86
+ >
87
+ > ```bash
88
+ > # 示例:更新 Claude Code 的 skill
89
+ > cp -r gangtise-openapi ~/.claude/skills/gangtise-openapi
90
+ > ```
91
+ >
92
+ > 可通过查看 SKILL.md 头部的 `version` 字段确认当前版本。
93
+
94
+ 安装后,可以用自然语言触发,例如:
95
+ - "帮我查今天所有的研报"
96
+ - "用 gangtise 命令查一下贵州茅台的日K线"
97
+ - "导出最近一周的首席观点到 jsonl"
98
+
46
99
  ## 数据接口覆盖
47
100
 
48
101
  | 模块 | 子命令 | 说明 |
@@ -83,43 +136,6 @@ export GANGTISE_TOKEN="Bearer xxx"
83
136
  | | `my-conference-list` / `my-conference-download` | 我的会议列表与下载 |
84
137
  | **Raw** | `call` | 原始接口调用(可访问任意 endpoint) |
85
138
 
86
- ## AI Agent Skill
87
-
88
- 本项目包含 SKill 定义(`gangtise-openapi/SKILL.md`),可让 AI agent 自动调用 `gangtise` CLI 完成投研数据查询。支持以下 AI 编程助手:
89
-
90
- - [Claude Code](https://claude.ai/claude-code) — `~/.claude/skills/`
91
- - [OpenClaw](https://github.com/openclaw/openclaw) — `~/.openclaw/skills/`
92
- - [Hermes](https://github.com/nicepkg/hermes) — `~/.hermes/skills/`
93
-
94
- Skill 目录结构:
95
-
96
- ```
97
- gangtise-openapi/
98
- ├── SKILL.md # 主 skill 文件(命令参考、参数枚举、使用规则)
99
- └── references/
100
- ├── fields.md # 字段中英文对照速查表
101
- └── lookup-ids.md # 常用 ID 速查表(行业/券商/机构/公告分类等)
102
- ```
103
-
104
- 安装:
105
-
106
- ```bash
107
- # Claude Code
108
- cp -r gangtise-openapi ~/.claude/skills/gangtise-openapi
109
-
110
- # OpenClaw
111
- cp -r gangtise-openapi ~/.openclaw/skills/gangtise-openapi
112
-
113
- # Hermes
114
- cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
115
- ```
116
-
117
- 安装后,可以用自然语言触发,例如:
118
- - "帮我查今天所有的研报"
119
- - "用 gangtise 命令查一下贵州茅台的日K线"
120
- - "导出最近一周的首席观点到 jsonl"
121
-
122
-
123
139
  ## 命令概览
124
140
 
125
141
  - `gangtise auth ...`
@@ -349,3 +365,5 @@ gangtise raw call insight.opinion.list --body '{"from":0,"size":120}'
349
365
  | `999999` | Gangtise 系统错误,请稍后重试 |
350
366
  | `433007` | 不支持该数据源(`knowledge-resource-download` 需正确的 `resourceType + sourceId` 组合) |
351
367
  | `430007` | 行情查询超出限制(日K线/分钟K线不传 `--security` 返回全市场,数据量过大;请指定证券代码或缩短日期范围) |
368
+ | `410110` | 异步任务生成中(非终态,需继续轮询) |
369
+ | `410111` | 异步任务生成失败(终态,不可重试) |
package/dist/src/cli.js CHANGED
@@ -646,3 +646,23 @@ async function main() {
646
646
  }
647
647
  }
648
648
  void main();
649
+ // Background update check on --version
650
+ if (process.argv.includes("--version") || process.argv.includes("-V")) {
651
+ import("node:https").then((https) => {
652
+ const req = https.get("https://registry.npmjs.org/gangtise-openapi-cli/latest", (res) => {
653
+ let body = "";
654
+ res.on("data", (chunk) => { body += chunk; });
655
+ res.on("end", () => {
656
+ try {
657
+ const latest = JSON.parse(body).version;
658
+ if (latest && latest !== CLI_VERSION) {
659
+ process.stderr.write(`\nUpdate available: ${CLI_VERSION} → ${latest}\nRun: npm update -g gangtise-openapi-cli\n`);
660
+ }
661
+ }
662
+ catch { /* ignore */ }
663
+ });
664
+ });
665
+ req.on("error", () => { });
666
+ req.setTimeout(3000, () => { req.destroy(); });
667
+ }).catch(() => { });
668
+ }
@@ -1,2 +1,2 @@
1
1
  // Auto-generated — DO NOT EDIT
2
- export const CLI_VERSION = "0.10.3";
2
+ export const CLI_VERSION = "0.10.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gangtise-openapi-cli",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "CLI for Gangtise OpenAPI",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "build": "tsc -p tsconfig.json",
24
24
  "dev": "tsx src/cli.ts",
25
25
  "test": "vitest run",
26
- "prepare": "node -e \"const p=JSON.parse(require('fs').readFileSync('package.json','utf8'));require('fs').writeFileSync('src/version.ts','// Auto-generated — DO NOT EDIT\\nexport const CLI_VERSION = \\\"'+p.version+'\\\"\\n')\" && npm run build"
26
+ "prepare": "node scripts/prepare.cjs && npm run build"
27
27
  },
28
28
  "engines": {
29
29
  "node": ">=20"