@hithink-tech/hithink-finance-cli 0.1.0

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.
Files changed (203) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +161 -0
  4. package/SECURITY.md +3 -0
  5. package/dist/application/config.d.ts +44 -0
  6. package/dist/application/config.js +111 -0
  7. package/dist/application/ports/auth-provider.d.ts +23 -0
  8. package/dist/application/ports/auth-provider.js +2 -0
  9. package/dist/application/source-policy.d.ts +13 -0
  10. package/dist/application/source-policy.js +31 -0
  11. package/dist/application/use-cases/data-clean.d.ts +2 -0
  12. package/dist/application/use-cases/data-clean.js +18 -0
  13. package/dist/application/use-cases/data-init.d.ts +4 -0
  14. package/dist/application/use-cases/data-init.js +9 -0
  15. package/dist/application/use-cases/data-remove.d.ts +2 -0
  16. package/dist/application/use-cases/data-remove.js +27 -0
  17. package/dist/application/use-cases/data-repair.d.ts +5 -0
  18. package/dist/application/use-cases/data-repair.js +5 -0
  19. package/dist/application/use-cases/data-sync.d.ts +25 -0
  20. package/dist/application/use-cases/data-sync.js +55 -0
  21. package/dist/application/use-cases/local-query.d.ts +4 -0
  22. package/dist/application/use-cases/local-query.js +88 -0
  23. package/dist/application/use-cases/market-history.d.ts +8 -0
  24. package/dist/application/use-cases/market-history.js +16 -0
  25. package/dist/application/use-cases/market-panel.d.ts +3 -0
  26. package/dist/application/use-cases/market-panel.js +5 -0
  27. package/dist/application/use-cases/remote-query.d.ts +4 -0
  28. package/dist/application/use-cases/remote-query.js +66 -0
  29. package/dist/cli/context.d.ts +17 -0
  30. package/dist/cli/context.js +52 -0
  31. package/dist/cli/i18n.d.ts +23 -0
  32. package/dist/cli/i18n.js +150 -0
  33. package/dist/cli/main.d.ts +3 -0
  34. package/dist/cli/main.js +80 -0
  35. package/dist/cli/program.d.ts +20 -0
  36. package/dist/cli/program.js +111 -0
  37. package/dist/commands/auth/index.d.ts +10 -0
  38. package/dist/commands/auth/index.js +131 -0
  39. package/dist/commands/config/index.d.ts +13 -0
  40. package/dist/commands/config/index.js +26 -0
  41. package/dist/commands/data/index.d.ts +10 -0
  42. package/dist/commands/data/index.js +185 -0
  43. package/dist/commands/db/index.d.ts +4 -0
  44. package/dist/commands/db/index.js +72 -0
  45. package/dist/commands/financials/index.d.ts +5 -0
  46. package/dist/commands/financials/index.js +6 -0
  47. package/dist/commands/index/index.d.ts +5 -0
  48. package/dist/commands/index/index.js +6 -0
  49. package/dist/commands/market/index.d.ts +5 -0
  50. package/dist/commands/market/index.js +6 -0
  51. package/dist/commands/market/local.d.ts +4 -0
  52. package/dist/commands/market/local.js +97 -0
  53. package/dist/commands/remote.d.ts +11 -0
  54. package/dist/commands/remote.js +195 -0
  55. package/dist/commands/skills/index.d.ts +4 -0
  56. package/dist/commands/skills/index.js +43 -0
  57. package/dist/commands/special/index.d.ts +5 -0
  58. package/dist/commands/special/index.js +6 -0
  59. package/dist/commands/symbol/index.d.ts +5 -0
  60. package/dist/commands/symbol/index.js +6 -0
  61. package/dist/commands/system/capabilities.d.ts +4 -0
  62. package/dist/commands/system/capabilities.js +24 -0
  63. package/dist/commands/system/doctor.d.ts +4 -0
  64. package/dist/commands/system/doctor.js +15 -0
  65. package/dist/commands/system/schema.d.ts +4 -0
  66. package/dist/commands/system/schema.js +47 -0
  67. package/dist/commands/system/uninstall.d.ts +11 -0
  68. package/dist/commands/system/uninstall.js +68 -0
  69. package/dist/commands/system/update.d.ts +11 -0
  70. package/dist/commands/system/update.js +72 -0
  71. package/dist/contracts/envelope.d.ts +37 -0
  72. package/dist/contracts/envelope.js +36 -0
  73. package/dist/contracts/errors.d.ts +23 -0
  74. package/dist/contracts/errors.js +33 -0
  75. package/dist/contracts/local-capabilities.d.ts +13 -0
  76. package/dist/contracts/local-capabilities.js +37 -0
  77. package/dist/contracts/registry.d.ts +9 -0
  78. package/dist/contracts/registry.js +4 -0
  79. package/dist/contracts/remote-capabilities.d.ts +24 -0
  80. package/dist/contracts/remote-capabilities.js +667 -0
  81. package/dist/domains/financials/types.d.ts +6 -0
  82. package/dist/domains/financials/types.js +2 -0
  83. package/dist/domains/index/types.d.ts +6 -0
  84. package/dist/domains/index/types.js +2 -0
  85. package/dist/domains/market/types.d.ts +6 -0
  86. package/dist/domains/market/types.js +2 -0
  87. package/dist/domains/special/types.d.ts +5 -0
  88. package/dist/domains/special/types.js +2 -0
  89. package/dist/domains/symbol/types.d.ts +6 -0
  90. package/dist/domains/symbol/types.js +2 -0
  91. package/dist/infrastructure/credentials/api-key-provider.d.ts +14 -0
  92. package/dist/infrastructure/credentials/api-key-provider.js +102 -0
  93. package/dist/infrastructure/credentials/keyring.d.ts +15 -0
  94. package/dist/infrastructure/credentials/keyring.js +21 -0
  95. package/dist/infrastructure/credentials/redact.d.ts +3 -0
  96. package/dist/infrastructure/credentials/redact.js +26 -0
  97. package/dist/infrastructure/duckdb/connection.d.ts +8 -0
  98. package/dist/infrastructure/duckdb/connection.js +18 -0
  99. package/dist/infrastructure/duckdb/dump-client.d.ts +20 -0
  100. package/dist/infrastructure/duckdb/dump-client.js +66 -0
  101. package/dist/infrastructure/duckdb/factors.d.ts +3 -0
  102. package/dist/infrastructure/duckdb/factors.js +83 -0
  103. package/dist/infrastructure/duckdb/importer.d.ts +11 -0
  104. package/dist/infrastructure/duckdb/importer.js +105 -0
  105. package/dist/infrastructure/duckdb/migrations.d.ts +17 -0
  106. package/dist/infrastructure/duckdb/migrations.js +92 -0
  107. package/dist/infrastructure/duckdb/quality.d.ts +12 -0
  108. package/dist/infrastructure/duckdb/quality.js +56 -0
  109. package/dist/infrastructure/duckdb/schema.d.ts +4 -0
  110. package/dist/infrastructure/duckdb/schema.js +14 -0
  111. package/dist/infrastructure/filesystem/atomic-file.d.ts +2 -0
  112. package/dist/infrastructure/filesystem/atomic-file.js +38 -0
  113. package/dist/infrastructure/filesystem/platform-paths.d.ts +15 -0
  114. package/dist/infrastructure/filesystem/platform-paths.js +42 -0
  115. package/dist/infrastructure/filesystem/process-lock.d.ts +6 -0
  116. package/dist/infrastructure/filesystem/process-lock.js +56 -0
  117. package/dist/infrastructure/filesystem/stdin.d.ts +5 -0
  118. package/dist/infrastructure/filesystem/stdin.js +9 -0
  119. package/dist/infrastructure/fuyao/client.d.ts +31 -0
  120. package/dist/infrastructure/fuyao/client.js +145 -0
  121. package/dist/infrastructure/fuyao/envelope.d.ts +9 -0
  122. package/dist/infrastructure/fuyao/envelope.js +8 -0
  123. package/dist/infrastructure/fuyao/pagination.d.ts +16 -0
  124. package/dist/infrastructure/fuyao/pagination.js +44 -0
  125. package/dist/infrastructure/fuyao/retry.d.ts +5 -0
  126. package/dist/infrastructure/fuyao/retry.js +18 -0
  127. package/dist/infrastructure/fuyao/windowing.d.ts +8 -0
  128. package/dist/infrastructure/fuyao/windowing.js +25 -0
  129. package/dist/infrastructure/skills/drift.d.ts +3 -0
  130. package/dist/infrastructure/skills/drift.js +8 -0
  131. package/dist/infrastructure/skills/installer.d.ts +13 -0
  132. package/dist/infrastructure/skills/installer.js +48 -0
  133. package/dist/infrastructure/skills/manifest.d.ts +11 -0
  134. package/dist/infrastructure/skills/manifest.js +62 -0
  135. package/dist/infrastructure/updater/cache.d.ts +15 -0
  136. package/dist/infrastructure/updater/cache.js +76 -0
  137. package/dist/infrastructure/updater/check.d.ts +13 -0
  138. package/dist/infrastructure/updater/check.js +51 -0
  139. package/dist/infrastructure/updater/install.d.ts +4 -0
  140. package/dist/infrastructure/updater/install.js +39 -0
  141. package/dist/output/json.d.ts +3 -0
  142. package/dist/output/json.js +16 -0
  143. package/dist/output/renderer.d.ts +4 -0
  144. package/dist/output/renderer.js +47 -0
  145. package/dist/output/table.d.ts +2 -0
  146. package/dist/output/table.js +31 -0
  147. package/migrations/001-initial.sql +95 -0
  148. package/migrations/manifest.json +12 -0
  149. package/package.json +66 -0
  150. package/schemas/capabilities.json +290 -0
  151. package/schemas/command-envelope.schema.json +12 -0
  152. package/scripts/postinstall.mjs +27 -0
  153. package/scripts/update-check.mjs +23 -0
  154. package/skills/hithink-finance-data/SKILL.md +74 -0
  155. package/skills/hithink-finance-data/references/data-clean.md +33 -0
  156. package/skills/hithink-finance-data/references/data-init.md +35 -0
  157. package/skills/hithink-finance-data/references/data-migrate.md +33 -0
  158. package/skills/hithink-finance-data/references/data-remove.md +33 -0
  159. package/skills/hithink-finance-data/references/data-repair.md +33 -0
  160. package/skills/hithink-finance-data/references/data-status.md +33 -0
  161. package/skills/hithink-finance-data/references/data-sync.md +34 -0
  162. package/skills/hithink-finance-data/references/data-validate.md +33 -0
  163. package/skills/hithink-finance-data/references/db-describe.md +33 -0
  164. package/skills/hithink-finance-data/references/db-export.md +33 -0
  165. package/skills/hithink-finance-data/references/db-query.md +33 -0
  166. package/skills/hithink-finance-financials/SKILL.md +59 -0
  167. package/skills/hithink-finance-financials/references/financials-balance-sheet.md +40 -0
  168. package/skills/hithink-finance-financials/references/financials-cash-flow.md +40 -0
  169. package/skills/hithink-finance-financials/references/financials-income.md +40 -0
  170. package/skills/hithink-finance-financials/references/financials-indicators.md +37 -0
  171. package/skills/hithink-finance-index/SKILL.md +59 -0
  172. package/skills/hithink-finance-index/references/index-catalog.md +36 -0
  173. package/skills/hithink-finance-index/references/index-constituents.md +36 -0
  174. package/skills/hithink-finance-index/references/index-history.md +38 -0
  175. package/skills/hithink-finance-index/references/index-snapshot.md +37 -0
  176. package/skills/hithink-finance-market/SKILL.md +63 -0
  177. package/skills/hithink-finance-market/references/market-adjustment-factors.md +33 -0
  178. package/skills/hithink-finance-market/references/market-calendar.md +35 -0
  179. package/skills/hithink-finance-market/references/market-corporate-actions.md +38 -0
  180. package/skills/hithink-finance-market/references/market-history.md +39 -0
  181. package/skills/hithink-finance-market/references/market-panel.md +33 -0
  182. package/skills/hithink-finance-market/references/market-snapshot.md +39 -0
  183. package/skills/hithink-finance-research/SKILL.md +58 -0
  184. package/skills/hithink-finance-research/references/research-workflow.md +34 -0
  185. package/skills/hithink-finance-shared/SKILL.md +55 -0
  186. package/skills/hithink-finance-shared/references/auth-and-config.md +31 -0
  187. package/skills/hithink-finance-shared/references/global-rules.md +21 -0
  188. package/skills/hithink-finance-shared/references/lifecycle.md +23 -0
  189. package/skills/hithink-finance-shared/references/skills-management.md +22 -0
  190. package/skills/hithink-finance-special-data/SKILL.md +68 -0
  191. package/skills/hithink-finance-special-data/references/special-anomaly-list.md +36 -0
  192. package/skills/hithink-finance-special-data/references/special-anomaly-stock.md +37 -0
  193. package/skills/hithink-finance-special-data/references/special-dragon-tiger.md +37 -0
  194. package/skills/hithink-finance-special-data/references/special-hot-stock-history.md +36 -0
  195. package/skills/hithink-finance-special-data/references/special-hot-stock-trend.md +38 -0
  196. package/skills/hithink-finance-special-data/references/special-hot-stock.md +36 -0
  197. package/skills/hithink-finance-special-data/references/special-limit-up-ladder.md +35 -0
  198. package/skills/hithink-finance-special-data/references/special-limit-up-pool.md +40 -0
  199. package/skills/hithink-finance-special-data/references/special-skyrocket.md +36 -0
  200. package/skills/hithink-finance-symbol/SKILL.md +56 -0
  201. package/skills/hithink-finance-symbol/references/symbol-list.md +39 -0
  202. package/skills/hithink-finance-symbol/references/symbol-search.md +39 -0
  203. package/skills/manifest.json +55 -0
@@ -0,0 +1,33 @@
1
+ # `hithink-finance market adjustment-factors`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema market.adjustment-factors --format json` 确认当前参数契约。
7
+ - 本地命令通常需要可用 DuckDB 或本地数据目录。
8
+ - 查询本地日级复权因子;需要本地库。
9
+
10
+ ## 命令
11
+
12
+ ```bash
13
+ hithink-finance schema market.adjustment-factors --format json
14
+ hithink-finance market adjustment-factors --thscode <code> --format json
15
+ ```
16
+
17
+ ## 参数选择策略
18
+
19
+ - 必填 `--thscode <code>`;可选 `--start` / `--end`。
20
+
21
+ ## 窗口与分页
22
+
23
+ - 本地命令无远端分页;只有声明 `--output` 的命令可直接落盘;其他大结果改用导出命令。
24
+
25
+ ## 常见错误
26
+
27
+ - 本地库不存在或 schema 不兼容时先运行 `data status` / `data migrate`。
28
+ - 日期必须是 `YYYY-MM-DD`;没有本地库先走 `data init|sync`。
29
+
30
+ ## 批量操作说明
31
+
32
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
33
+ - 如果需要多标的循环,逐批执行并记录每批参数;不要把完整结果塞进上下文。
@@ -0,0 +1,35 @@
1
+ # `hithink-finance market calendar`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema market.calendar --format json` 确认当前参数契约。
7
+ - 远端命令需要 API Key;认证失败时回到 shared skill。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance schema market.calendar --format json
13
+ hithink-finance market calendar --format json
14
+ ```
15
+
16
+ ## 参数选择策略
17
+
18
+ | 参数 | 必填 | 说明 |
19
+ | ----------------- | ---- | ----------------------------------------------- |
20
+ | `--output <path>` | 否 | write the full JSON response envelope to a file |
21
+
22
+ ## 窗口与分页
23
+
24
+ - 单次请求窗口最多 1 年;超过时拆分或缩小范围。
25
+ - 无分页参数;仍检查返回中的 count/数组长度。
26
+
27
+ ## 常见错误
28
+
29
+ - 参数校验失败时按 `error.hint` 修正,不要猜字段名。
30
+ - 认证失败时不要重试刷屏;先处理 API Key。
31
+
32
+ ## 批量操作说明
33
+
34
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
35
+ - 如果需要多标的循环,逐批执行并记录每批参数;不要把完整结果塞进上下文。
@@ -0,0 +1,38 @@
1
+ # `hithink-finance market corporate-actions`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema market.corporate-actions --format json` 确认当前参数契约。
7
+ - 远端命令需要 API Key;认证失败时回到 shared skill。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance schema market.corporate-actions --format json
13
+ hithink-finance market corporate-actions --thscode <code> --format json
14
+ ```
15
+
16
+ ## 参数选择策略
17
+
18
+ | 参数 | 必填 | 说明 |
19
+ | -------------------- | ---- | ----------------------------------------------- |
20
+ | `--thscode <code>` | 是 | single A-share thscode |
21
+ | `--from-date <date>` | 否 | first ex-date YYYY-MM-DD;上游参数: from |
22
+ | `--to-date <date>` | 否 | last ex-date YYYY-MM-DD;上游参数: to |
23
+ | `--output <path>` | 否 | write the full JSON response envelope to a file |
24
+
25
+ ## 窗口与分页
26
+
27
+ - 无额外时间窗口限制,仍按命令参数和上游返回为准。
28
+ - 无分页参数;仍检查返回中的 count/数组长度。
29
+
30
+ ## 常见错误
31
+
32
+ - 参数校验失败时按 `error.hint` 修正,不要猜字段名。
33
+ - 认证失败时不要重试刷屏;先处理 API Key。
34
+
35
+ ## 批量操作说明
36
+
37
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
38
+ - 如果需要多标的循环,逐批执行并记录每批参数;不要把完整结果塞进上下文。
@@ -0,0 +1,39 @@
1
+ # `hithink-finance market history`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema market.history --format json` 确认当前参数契约。
7
+ - 远端命令需要 API Key;认证失败时回到 shared skill。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance schema market.history --format json
13
+ hithink-finance market history --thscode <code> --start-ms <milliseconds> --end-ms <milliseconds> --format json
14
+ ```
15
+
16
+ ## 参数选择策略
17
+
18
+ | 参数 | 必填 | 说明 |
19
+ | --------------------------- | ---- | ------------------------------------------------------------- |
20
+ | `--thscode <code>` | 是 | single A-share thscode |
21
+ | `--start-ms <milliseconds>` | 是 | start timestamp;上游参数: start |
22
+ | `--end-ms <milliseconds>` | 是 | end timestamp;上游参数: end |
23
+ | `--adjust <mode>` | 否 | adjustment mode;可选: none, forward, backward;默认: forward |
24
+ | `--output <path>` | 否 | write the full JSON response envelope to a file |
25
+
26
+ ## 窗口与分页
27
+
28
+ - 单次请求窗口最多 10 年;超过时拆分为不重叠窗口并合并去重。
29
+ - 无分页参数;仍检查返回中的 count/数组长度。
30
+
31
+ ## 常见错误
32
+
33
+ - 参数校验失败时按 `error.hint` 修正,不要猜字段名。
34
+ - 认证失败时不要重试刷屏;先处理 API Key。
35
+
36
+ ## 批量操作说明
37
+
38
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
39
+ - 如果需要多标的循环,逐批执行并记录每批参数;不要把完整结果塞进上下文。
@@ -0,0 +1,33 @@
1
+ # `hithink-finance market panel`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema market.panel --format json` 确认当前参数契约。
7
+ - 本地命令通常需要可用 DuckDB 或本地数据目录。
8
+ - 需要本地库覆盖请求窗口;适合作为研究样本输入。
9
+
10
+ ## 命令
11
+
12
+ ```bash
13
+ hithink-finance schema market.panel --format json
14
+ hithink-finance market panel --start <date> --end <date> --output <path> --format json
15
+ ```
16
+
17
+ ## 参数选择策略
18
+
19
+ - 必填 `--start YYYY-MM-DD --end YYYY-MM-DD --output <path>`;默认 parquet。
20
+
21
+ ## 窗口与分页
22
+
23
+ - 本地命令无远端分页;只有声明 `--output` 的命令可直接落盘;其他大结果改用导出命令。
24
+
25
+ ## 常见错误
26
+
27
+ - 本地库不存在或 schema 不兼容时先运行 `data status` / `data migrate`。
28
+ - 日期必须是 `YYYY-MM-DD`;大面板永远落盘。
29
+
30
+ ## 批量操作说明
31
+
32
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
33
+ - 如果需要多标的循环,逐批执行并记录每批参数;不要把完整结果塞进上下文。
@@ -0,0 +1,39 @@
1
+ # `hithink-finance market snapshot`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema market.snapshot --format json` 确认当前参数契约。
7
+ - 远端命令需要 API Key;认证失败时回到 shared skill。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance schema market.snapshot --format json
13
+ hithink-finance market snapshot --format json
14
+ hithink-finance market snapshot --codes-file codes.txt --output result.json --format json
15
+ ```
16
+
17
+ ## 参数选择策略
18
+
19
+ | 参数 | 必填 | 说明 |
20
+ | -------------------- | ---- | ----------------------------------------------- |
21
+ | `--thscodes <codes>` | 否 | comma-separated A-share thscodes |
22
+ | `--limit <number>` | 否 | page size;默认: 100 |
23
+ | `--offset <number>` | 否 | row offset;默认: 0 |
24
+ | `--output <path>` | 否 | write the full JSON response envelope to a file |
25
+
26
+ ## 窗口与分页
27
+
28
+ - 无额外时间窗口限制,仍按命令参数和上游返回为准。
29
+ - 使用 `--limit` + `--offset` 翻页;全量抓取时循环到返回条数小于 limit。
30
+
31
+ ## 常见错误
32
+
33
+ - 参数校验失败时按 `error.hint` 修正,不要猜字段名。
34
+ - 认证失败时不要重试刷屏;先处理 API Key。
35
+
36
+ ## 批量操作说明
37
+
38
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
39
+ - 支持 `--codes-file` 或 `--codes-stdin` 读取多 thscode;不要同时用 `--api-key-stdin` 和 `--codes-stdin`。
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: hithink-finance-research
3
+ description: '用于 Agent 通过 hithink-finance CLI 基于已有本地数据做中立研究准备、面板导出、只读 SQL、描述性统计和可复现实证数据集;不用于实时取数、荐股、择时、组合建议或投资结论。'
4
+ ---
5
+
6
+ # hithink-finance-research
7
+
8
+ 研究工作流路由。它不拥有独立 `research` 命令,而是指导 Agent 组合 data、db 和 market panel 产出可复现数据证据。
9
+
10
+ ## 前置条件表
11
+
12
+ | 条件 | 操作 |
13
+ | -------------------------------------- | ----------------------------------------------------------------------------------------------------- |
14
+ | 开始任何 CLI 调用 | 先读取并遵循 [hithink-finance-shared](../hithink-finance-shared/SKILL.md) |
15
+ | 不确定命令是否存在或参数是否变化 | 运行 `hithink-finance capabilities --format json`,再运行 `hithink-finance schema <id> --format json` |
16
+ | 需要执行下表某个命令 | 先读取对应 reference 文件,不要只凭命令名猜参数 |
17
+ | 结果可能是全市场、分页、多标的或长区间 | 使用命令声明的 `--output <path>` 落盘;远端 stdout 只返回摘要 |
18
+
19
+ ## 快速决策
20
+
21
+ | 用户意图 | 首选命令 / 路由 |
22
+ | ------------------------- | ---------------------------------------------------------------------- |
23
+ | 用户要构造研究样本/面板 | 先 `data status` 和 `data validate`,再 `market panel --output <file>` |
24
+ | 用户要 SQL 统计或因子分布 | 用 `db query` 小结果或 `db export` 大结果 |
25
+ | 用户要解释数据缺口 | 先 `data validate`,必要时 `data sync` 或 `data repair` |
26
+ | 用户要实时快照或最新榜单 | 切到对应业务 skill,不在 research 中直接取数 |
27
+ | 用户要投资建议/策略推荐 | 拒绝给出建议,可提供中立数据分析边界 |
28
+
29
+ ## Shortcuts
30
+
31
+ | 命令 | 何时使用 |
32
+ | ------------------------------------------------------- | -------------------------------------------- |
33
+ | [research-workflow.md](references/research-workflow.md) | 组合 data/db/market panel 做中立研究数据准备 |
34
+
35
+ ## 原生命令与 schema
36
+
37
+ ```bash
38
+ hithink-finance capabilities --format json
39
+ hithink-finance schema <capability-id> --format json
40
+ hithink-finance data <command> --help
41
+ hithink-finance db <command> --help
42
+ hithink-finance market panel --help
43
+ ```
44
+
45
+ 使用原生命令前必须先看 schema;schema 是当前 CLI 参数契约,reference 是决策和边界补充。
46
+
47
+ ## 权限表
48
+
49
+ | 命令类型 | 要求 |
50
+ | ------------------------------ | ---------------------------------------------------------------------- |
51
+ | 远端服务查询 | API Key 来自系统凭据库、`HITHINK_FINANCE_API_KEY` 或 `--api-key-stdin` |
52
+ | 本地 DuckDB 查询/导出 | 本地库存在且 schema 兼容;可用全局 `--db <path>` 指定 |
53
+ | 删除、迁移、修复等有副作用操作 | 先预览或说明影响;需要用户明确确认时才加 `--yes` |
54
+
55
+ ## 边界声明
56
+
57
+ - 只做描述性、可复现、数据来源明确的研究辅助;不要生成买入/卖出/持有建议。
58
+ - 必须保留查询 SQL、输入文件路径、输出路径、行数和时间窗口,便于复核。
@@ -0,0 +1,34 @@
1
+ # research workflow
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取 [hithink-finance-shared](../../hithink-finance-shared/SKILL.md)。
6
+ - 确认用户要的是中立研究数据、统计或可复现实证输入,不是投资建议。
7
+ - 本地库状态未知时先运行 `hithink-finance data status --format json` 和 `hithink-finance data validate --format json`。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance data status --format json
13
+ hithink-finance data validate --format json
14
+ hithink-finance market panel --start <YYYY-MM-DD> --end <YYYY-MM-DD> --output <panel.parquet> --file-format parquet --format json
15
+ hithink-finance db query --sql "<readonly sql>" --format json
16
+ hithink-finance db export --sql "<readonly sql>" --output <result.parquet> --file-format parquet --format json
17
+ ```
18
+
19
+ ## 参数选择策略
20
+
21
+ - 小样本探索用 `db query`,并在 SQL 中显式 `LIMIT`。
22
+ - 下游分析、全市场、长区间、多因子结果用 `db export` 或 `market panel`。
23
+ - 研究报告必须记录 SQL、时间窗口、库路径或输出文件路径、行数。
24
+
25
+ ## 常见错误
26
+
27
+ - 不要把相关性、排序或榜单解释成买卖建议。
28
+ - 不要在研究 skill 中临时取实时榜单;切到对应业务 skill 后再把结果作为证据。
29
+ - 不要修改数据库;研究 SQL 必须只读。
30
+
31
+ ## 批量操作说明
32
+
33
+ - 分批导出时给每批文件命名,最终合并前按 `thscode/date` 等主键去重。
34
+ - 最终回答只摘要统计结果和证据路径,不粘贴大表。
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: hithink-finance-shared
3
+ description: '用于 Agent 通过 hithink-finance CLI 做安装后自检、API Key 认证、配置、版本更新、诊断、卸载、Skills 安装/同步/移除,以及 JSON 输出、安全和大结果处理规则;不要用于行情、财务、指数、特色数据或研究取数。'
4
+ ---
5
+
6
+ # hithink-finance-shared
7
+
8
+ 共享规则和生命周期入口。只放全局约束、认证、输出、安全、更新和 Skills 管理,不承载业务取数路由。
9
+
10
+ ## 前置条件表
11
+
12
+ | 条件 | 操作 |
13
+ | ------------------------------- | -------------------------------------------------------------------------------------------- |
14
+ | 第一次接触此 CLI 或怀疑版本漂移 | 运行 `hithink-finance version --format json` 和 `hithink-finance capabilities --format json` |
15
+ | 需要机器读取 | 始终加 `--format json` |
16
+ | 结果可能很大 | 使用命令声明的 `--output <path>` 落盘;远端 stdout 只返回摘要 |
17
+ | 需要远端同花顺金融数据服务 | 先确认 `auth status` 或准备 `HITHINK_FINANCE_API_KEY` / `--api-key-stdin` |
18
+
19
+ ## 快速决策
20
+
21
+ | 用户意图 | 首选命令 / 路由 |
22
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | 检查 CLI 是否可用或版本 | `hithink-finance version --format json` |
24
+ | 查看真实能力清单 | `hithink-finance capabilities --format json` |
25
+ | 查看某个命令参数契约 | `hithink-finance schema <capability-id> --format json` |
26
+ | 获取并保存 API Key | 先打开 https://fuyao.aicubes.cn/admin 获取 API Key,再运行 `hithink-finance auth login --api-key-stdin --format json`;交互终端也可运行 `hithink-finance auth login` 隐藏输入 |
27
+ | 检查认证状态 | `hithink-finance auth status --format json` |
28
+ | 查看非敏感配置 | `hithink-finance config show --format json` |
29
+ | 诊断运行环境 | `hithink-finance doctor --format json` |
30
+ | 同步/修复配套 Skills | `hithink-finance skills status --format json` 或 `hithink-finance skills sync --format json` |
31
+ | 更新 CLI | `hithink-finance update --check --format json` 或 `hithink-finance update --repair --format json` |
32
+ | 预览卸载 | `hithink-finance uninstall --plan --format json` |
33
+
34
+ ## References
35
+
36
+ | 需要了解 | 读取 |
37
+ | ---------------------------------- | ------------------------------------------------------- |
38
+ | JSON 输出、大结果、安全规则 | [global-rules.md](references/global-rules.md) |
39
+ | API Key、profile、配置优先级 | [auth-and-config.md](references/auth-and-config.md) |
40
+ | version、doctor、update、uninstall | [lifecycle.md](references/lifecycle.md) |
41
+ | skills status/sync/remove | [skills-management.md](references/skills-management.md) |
42
+
43
+ ## 权限表
44
+
45
+ | 能力 | 凭据 |
46
+ | --------------------------------------------- | ------------------------------------------------- |
47
+ | 本地 data/db/market panel | 通常不需要 API Key,除非需要同步或初始化远端 dump |
48
+ | symbol/market remote/special/financials/index | 需要统一 API Key |
49
+ | skills/update/uninstall | 需要本机文件系统权限;不要写全局非 CLI 管理目录 |
50
+
51
+ ## 边界声明
52
+
53
+ - 业务取数请求必须切到 symbol、market、special-data、financials、index、data 或 research skill。
54
+ - 不要把 API Key 写入命令、配置文件、日志、Markdown、Git 或对话正文;优先 stdin 或系统凭据库。
55
+ - 不要把 stderr 更新提示、诊断详情或完整大数据结果当作最终答案原样展开。
@@ -0,0 +1,31 @@
1
+ # 认证和配置
2
+
3
+ ## 前置条件
4
+
5
+ - API Key 只能来自系统凭据库、进程环境变量 `HITHINK_FINANCE_API_KEY`、stdin 或当前进程参数。
6
+ - API Key 获取地址为 https://fuyao.aicubes.cn/admin;交互式用户可运行 `hithink-finance auth login`,CLI 会说明用途并隐藏输入。
7
+ - 不要把密钥写入配置文件、日志、Git、Markdown 或对话正文。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance auth login --api-key-stdin --format json
13
+ hithink-finance auth login
14
+ hithink-finance auth status --format json
15
+ hithink-finance auth logout --format json
16
+ hithink-finance config show --format json
17
+ ```
18
+
19
+ ## 参数选择策略
20
+
21
+ - 交互式终端可用 `auth login` 隐藏输入。
22
+ - 如果 `auth login` 提示已登录,需要切换 API Key 时先运行 `auth logout`,再重新登录。
23
+ - Agent/CI 优先用 `--api-key-stdin` 或 `HITHINK_FINANCE_API_KEY`。
24
+ - 多套凭据使用全局 `--profile <name>`。
25
+ - `config show` 只显示非敏感项;不要期待它返回 API Key。
26
+
27
+ ## 常见错误
28
+
29
+ - `AUTH_API_KEY_MISSING`:运行 `auth login` 或设置 `HITHINK_FINANCE_API_KEY`。
30
+ - `CLI_MISSING_ARGUMENT`:非交互场景使用 `auth login --api-key-stdin`,不要把 API Key 写入对话或日志。
31
+ - `CLI_CONFLICTING_ARGUMENTS`:不要同时传 `--api-key` 和 `--api-key-stdin`。
@@ -0,0 +1,21 @@
1
+ # 全局规则
2
+
3
+ ## 前置条件
4
+
5
+ - 优先运行 `hithink-finance capabilities --format json` 获取当前 CLI 事实。
6
+ - 机器读取必须显式使用 `--format json`;需要表格给人看时才用 `table`。
7
+ - `--output <path>` 只在声明该参数的具体命令上使用;远端能力命令会把完整 JSON envelope 写入文件,本地 `db export` / `market panel` 会写数据文件。它不是全局参数。
8
+
9
+ ## 输出契约
10
+
11
+ - 成功以进程退出码 0 和 `ok: true` 为准。
12
+ - 错误以非 0 退出码和 `ok: false` 为准;读取 `error.code`、`error.category`、`error.hint`。
13
+ - 不要按上游旧格式 `code == 0` 判断成功。
14
+
15
+ ## 大结果纪律
16
+
17
+ - 全市场、分页、长区间、多 ticker 数据不得回显完整内容。
18
+ - 远端大结果用该命令自己的 `--output <path>`,stdout 只保留路径/count 摘要。
19
+ - 本地大结果用 `db export --output <path>` 或 `market panel --output <path>`。
20
+ - 最终回答只报告输出路径、行数、时间窗口、命令摘要和必要字段名。
21
+ - 下游需要数据时让 pandas/notebook/脚本读取落盘文件。
@@ -0,0 +1,23 @@
1
+ # 生命周期命令
2
+
3
+ ## 命令
4
+
5
+ ```bash
6
+ hithink-finance version --format json
7
+ hithink-finance doctor --format json
8
+ hithink-finance update --check --format json
9
+ hithink-finance update --repair --format json
10
+ hithink-finance uninstall --plan --format json
11
+ ```
12
+
13
+ ## 参数选择策略
14
+
15
+ - 先 `update --check`,只有用户确认修复/升级时再 `update --repair`。
16
+ - 卸载先 `uninstall --plan`,真实清理按计划和用户确认执行。
17
+ - 直接 `npm uninstall -g` 不可靠清理 Agent Skill 目录;需要先运行 `hithink-finance uninstall --yes` 或 `hithink-finance skills remove`。
18
+ - 诊断输出用于定位环境、路径、依赖和版本问题;不要把它当业务数据。
19
+
20
+ ## 常见错误
21
+
22
+ - 普通命令可能在完成后向 stderr 输出更新提示;不要把它混入业务数据。
23
+ - 不要因为更新提示中断取数、翻页或导出流程;需要升级时先运行 `update --check`,获得用户确认后再 `update --repair`。
@@ -0,0 +1,22 @@
1
+ # Skills 管理
2
+
3
+ ## 命令
4
+
5
+ ```bash
6
+ hithink-finance skills status --format json
7
+ hithink-finance skills sync --format json
8
+ hithink-finance skills remove --format json
9
+ ```
10
+
11
+ ## 参数选择策略
12
+
13
+ - `status` 检查已安装 Skills 是否与 CLI 包内 manifest 一致。
14
+ - `sync` 修复缺失或漂移的受管文件;用户改过的受管文件会备份。
15
+ - `remove` 只移除本 CLI manifest 拥有的 8 个 skill,不做全局清空。
16
+ - 若某个 Agent 不在自动安装范围内,读取 `status --format json` 的 `canonical` 目录,并把其中 8 个 `hithink-finance-*` 目录复制到该 Agent 文档声明的 skills 发现目录。
17
+
18
+ ## 常见错误
19
+
20
+ - 自动安装可覆盖时,不要手工复制 skill 文件绕过 manifest;用 CLI 的 skills 子命令。
21
+ - 手工兜底安装时,不要改名、拆分或只复制部分 reference 文件;保持整个 skill 目录原样复制。
22
+ - 不要删除用户自建 skill 或非 hithink-finance 前缀 skill。
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: hithink-finance-special-data
3
+ description: '用于 Agent 通过 hithink-finance CLI 查询特色数据:涨停池、连板天梯、个股异动、异动原因、飙升榜、热股榜、热度历史/趋势、龙虎榜、游资和机构榜;普通行情转 hithink-finance-market。'
4
+ ---
5
+
6
+ # hithink-finance-special-data
7
+
8
+ 特色榜单和事件型数据入口。强调窗口约束和榜单口径,不替代普通行情或财报。
9
+
10
+ ## 前置条件表
11
+
12
+ | 条件 | 操作 |
13
+ | -------------------------------------- | ----------------------------------------------------------------------------------------------------- |
14
+ | 开始任何 CLI 调用 | 先读取并遵循 [hithink-finance-shared](../hithink-finance-shared/SKILL.md) |
15
+ | 不确定命令是否存在或参数是否变化 | 运行 `hithink-finance capabilities --format json`,再运行 `hithink-finance schema <id> --format json` |
16
+ | 需要执行下表某个命令 | 先读取对应 reference 文件,不要只凭命令名猜参数 |
17
+ | 结果可能是全市场、分页、多标的或长区间 | 使用命令声明的 `--output <path>` 落盘;远端 stdout 只返回摘要 |
18
+
19
+ ## 快速决策
20
+
21
+ | 用户意图 | 首选命令 / 路由 |
22
+ | ---------------------------- | ------------------------------- |
23
+ | 今日异动列表/异动标签 | `special anomaly-list`,仅今日 |
24
+ | 最多 50 只股票的今日异动原因 | `special anomaly-stock`,仅今日 |
25
+ | 涨停池分页 | `special limit-up-pool` |
26
+ | 连板天梯 | `special limit-up-ladder` |
27
+ | 飙升榜 | `special skyrocket` |
28
+ | 当前热股榜 | `special hot-stock` |
29
+ | 历史热股榜 | `special hot-stock-history` |
30
+ | 单股热度趋势 | `special hot-stock-trend` |
31
+ | 龙虎榜/机构/游资 | `special dragon-tiger` |
32
+
33
+ ## Shortcuts
34
+
35
+ | 命令 | 何时使用 |
36
+ | -------------------------------------------------------------------- | ------------------------------------------------------- |
37
+ | [special anomaly-list](references/special-anomaly-list.md) | Query today-only anomaly analysis rows |
38
+ | [special anomaly-stock](references/special-anomaly-stock.md) | Query today-only anomalies for up to 50 raw code tokens |
39
+ | [special dragon-tiger](references/special-dragon-tiger.md) | Query dragon-tiger board records |
40
+ | [special hot-stock](references/special-hot-stock.md) | Query the current hot-stock ranking |
41
+ | [special hot-stock-history](references/special-hot-stock-history.md) | Query a historical hot-stock ranking |
42
+ | [special hot-stock-trend](references/special-hot-stock-trend.md) | Query one stock hot-rank trend |
43
+ | [special limit-up-ladder](references/special-limit-up-ladder.md) | Query the 30-day limit-up ladder |
44
+ | [special limit-up-pool](references/special-limit-up-pool.md) | Query the limit-up stock pool |
45
+ | [special skyrocket](references/special-skyrocket.md) | Query the skyrocket ranking |
46
+
47
+ ## 原生命令与 schema
48
+
49
+ ```bash
50
+ hithink-finance capabilities --format json
51
+ hithink-finance schema <capability-id> --format json
52
+ hithink-finance special <command> --help
53
+ ```
54
+
55
+ 使用原生命令前必须先看 schema;schema 是当前 CLI 参数契约,reference 是决策和边界补充。
56
+
57
+ ## 权限表
58
+
59
+ | 命令类型 | 要求 |
60
+ | ------------------------------ | ---------------------------------------------------------------------- |
61
+ | 远端服务查询 | API Key 来自系统凭据库、`HITHINK_FINANCE_API_KEY` 或 `--api-key-stdin` |
62
+ | 本地 DuckDB 查询/导出 | 本地库存在且 schema 兼容;可用全局 `--db <path>` 指定 |
63
+ | 删除、迁移、修复等有副作用操作 | 先预览或说明影响;需要用户明确确认时才加 `--yes` |
64
+
65
+ ## 边界声明
66
+
67
+ - today-only 能力不能补历史;用户要历史时说明边界并选择有历史窗口的命令。
68
+ - 榜单热度不是投资建议,不要扩写成推荐或确定性原因。
@@ -0,0 +1,36 @@
1
+ # `hithink-finance special anomaly-list`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema special.anomaly-list --format json` 确认当前参数契约。
7
+ - 远端命令需要 API Key;认证失败时回到 shared skill。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance schema special.anomaly-list --format json
13
+ hithink-finance special anomaly-list --format json
14
+ ```
15
+
16
+ ## 参数选择策略
17
+
18
+ | 参数 | 必填 | 说明 |
19
+ | --------------------- | ---- | ------------------------------------------------- |
20
+ | `--tag-codes <codes>` | 否 | comma-separated anomaly tags;上游参数: tag_codes |
21
+ | `--output <path>` | 否 | write the full JSON response envelope to a file |
22
+
23
+ ## 窗口与分页
24
+
25
+ - 仅当前交易日/今日数据;不能补历史。
26
+ - 无分页参数;仍检查返回中的 count/数组长度。
27
+
28
+ ## 常见错误
29
+
30
+ - 参数校验失败时按 `error.hint` 修正,不要猜字段名。
31
+ - 认证失败时不要重试刷屏;先处理 API Key。
32
+
33
+ ## 批量操作说明
34
+
35
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
36
+ - 如果需要多标的循环,逐批执行并记录每批参数;不要把完整结果塞进上下文。
@@ -0,0 +1,37 @@
1
+ # `hithink-finance special anomaly-stock`
2
+
3
+ ## 前置条件
4
+
5
+ - 先读取本 skill 的 `SKILL.md` 和 `../hithink-finance-shared/SKILL.md`。
6
+ - 执行前用 `hithink-finance schema special.anomaly-stock --format json` 确认当前参数契约。
7
+ - 远端命令需要 API Key;认证失败时回到 shared skill。
8
+
9
+ ## 命令
10
+
11
+ ```bash
12
+ hithink-finance schema special.anomaly-stock --format json
13
+ hithink-finance special anomaly-stock --thscodes <codes> --format json
14
+ hithink-finance special anomaly-stock --codes-file codes.txt --output result.json --format json
15
+ ```
16
+
17
+ ## 参数选择策略
18
+
19
+ | 参数 | 必填 | 说明 |
20
+ | -------------------- | ---- | ----------------------------------------------- |
21
+ | `--thscodes <codes>` | 是 | 1-50 comma-separated A-share thscodes |
22
+ | `--output <path>` | 否 | write the full JSON response envelope to a file |
23
+
24
+ ## 窗口与分页
25
+
26
+ - 仅当前交易日/今日数据;不能补历史。
27
+ - 无分页参数;仍检查返回中的 count/数组长度。
28
+
29
+ ## 常见错误
30
+
31
+ - 参数校验失败时按 `error.hint` 修正,不要猜字段名。
32
+ - 认证失败时不要重试刷屏;先处理 API Key。
33
+
34
+ ## 批量操作说明
35
+
36
+ - 批量或全量请求必须落盘,最终只报告路径、行数和窗口。
37
+ - 支持 `--codes-file` 或 `--codes-stdin` 读取多 thscode;不要同时用 `--api-key-stdin` 和 `--codes-stdin`。