@ftshare-lab/dsh-kline 0.0.0-stage → 0.6.11
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/CHANGELOG.md +611 -0
- package/LICENSE +21 -0
- package/PROVENANCE.md +13 -0
- package/README.en.md +171 -0
- package/README.md +170 -2
- package/chart_service.py +687 -0
- package/config/basic-symbols.json +570 -0
- package/config/dsh-kline.patch.yml +4 -0
- package/config/dsh-tool-catalog.json +3875 -0
- package/cordis.patch.yml +33 -0
- package/core/__init__.py +0 -0
- package/core/adjustment.py +16 -0
- package/core/calc.py +691 -0
- package/core/rows.py +228 -0
- package/core/ta_engine.py +99 -0
- package/docs/anonymous-market-support.md +33 -0
- package/docs/automatic-drawing.md +24 -0
- package/docs/chart-functions.md +136 -0
- package/docs/drawing-examples.en.md +13 -0
- package/docs/drawing-examples.md +13 -0
- package/docs/embedding.md +77 -0
- package/docs/fixtures/price-pattern-real-v1.json +1 -0
- package/docs/free-foreign-daily.md +44 -0
- package/docs/guide.en.md +232 -0
- package/docs/guide.md +248 -0
- package/docs/images/abc-drawing-v0.5.0.jpg +0 -0
- package/docs/images/channel-drawing-v0.5.0.jpg +0 -0
- package/docs/images/drawing-workbench-v0.5.0.jpg +0 -0
- package/docs/images/dsh-kline-tab-workspace.png +0 -0
- package/docs/images/dsh-market.png +0 -0
- package/docs/images/kline-news.png +0 -0
- package/docs/images/kline-range-stats.png +0 -0
- package/docs/images/kline-support.png +0 -0
- package/docs/images/main-chart-comparison-v0.6.9.png +0 -0
- package/docs/images/market-overview-v0.6.9.png +0 -0
- package/docs/images/natural-language-abc-wolong-2026-10-27.png +0 -0
- package/docs/images/natural-language-descending-channel-wolong-2026-10-27.png +0 -0
- package/docs/images/platform-breakout-msft-v0.6.9.png +0 -0
- package/docs/npm-release.md +33 -0
- package/docs/price-pattern-rules-v1.md +40 -0
- package/docs/price-pattern-samples-v1.md +42 -0
- package/docs/provider-adaptation.md +73 -0
- package/docs/release-acceptance-v0.4.0.md +46 -0
- package/docs/release-acceptance-v0.4.1.md +43 -0
- package/docs/release-acceptance-v0.5.0.md +40 -0
- package/docs/release-acceptance-v0.6.0.md +33 -0
- package/docs/release-acceptance-v0.6.1.md +19 -0
- package/docs/release-acceptance-v0.6.10.md +21 -0
- package/docs/release-acceptance-v0.6.11.md +21 -0
- package/docs/release-acceptance-v0.6.2.md +31 -0
- package/docs/release-acceptance-v0.6.3.md +25 -0
- package/docs/release-acceptance-v0.6.4.md +24 -0
- package/docs/release-acceptance-v0.6.5.md +21 -0
- package/docs/release-acceptance-v0.6.6.md +21 -0
- package/docs/release-acceptance-v0.6.7.md +18 -0
- package/docs/release-acceptance-v0.6.8.md +18 -0
- package/docs/release-acceptance-v0.6.9.md +98 -0
- package/docs/release-notes-v0.5.0.md +23 -0
- package/docs/release-notes-v0.6.0.md +11 -0
- package/docs/release-notes-v0.6.1.md +20 -0
- package/docs/release-notes-v0.6.10.md +11 -0
- package/docs/release-notes-v0.6.11.md +16 -0
- package/docs/release-notes-v0.6.2.md +14 -0
- package/docs/release-notes-v0.6.3.md +26 -0
- package/docs/release-notes-v0.6.4.md +12 -0
- package/docs/release-notes-v0.6.5.md +13 -0
- package/docs/release-notes-v0.6.6.md +13 -0
- package/docs/release-notes-v0.6.7.md +17 -0
- package/docs/release-notes-v0.6.8.md +10 -0
- package/docs/release-notes-v0.6.9.md +16 -0
- package/lib/candle-sequence.js +15 -0
- package/lib/chart-adjustment.js +7 -0
- package/lib/chart-annotations.js +33 -0
- package/lib/chart-applications.js +171 -0
- package/lib/chart-context.js +164 -0
- package/lib/chart-observation.js +251 -0
- package/lib/chart-service-status.js +82 -0
- package/lib/chart-source-status.js +39 -0
- package/lib/chart-sources.js +354 -0
- package/lib/client/BetterSidebarTab.js +70 -0
- package/lib/client/ClassicShell.js +254 -0
- package/lib/client/KlineContent.js +155 -0
- package/lib/client/PanelHost.js +46 -0
- package/lib/client/chart-apply.js +73 -0
- package/lib/client/chart-context.js +233 -0
- package/lib/client/chart-handoff.js +34 -0
- package/lib/client/chart-session-resolver.js +74 -0
- package/lib/client/client-context.js +1 -0
- package/lib/client/conversation.js +88 -0
- package/lib/client/default-tab.js +83 -0
- package/lib/client/embed.js +50 -0
- package/lib/client/generated-view.js +12983 -0
- package/lib/client/horizontal-lines.js +19 -0
- package/lib/client/host-options.js +41 -0
- package/lib/client/host-panels.js +111 -0
- package/lib/client/index.js +77 -0
- package/lib/client/mode-preferences.js +48 -0
- package/lib/client/native-sidebar-contract.js +45 -0
- package/lib/client/native-sidebar-register.js +133 -0
- package/lib/client/native-sidebar-services.js +1 -0
- package/lib/client/native-sidebar.js +98 -0
- package/lib/client/sidebar-integration.js +93 -0
- package/lib/client/ui-onboarding.js +48 -0
- package/lib/client/version.js +14 -0
- package/lib/client.js +17581 -0
- package/lib/client.js.map +1 -0
- package/lib/drawing-feedback.js +284 -0
- package/lib/fibonacci.js +18 -0
- package/lib/ftshare-settings-bridge.js +159 -0
- package/lib/index.js +279 -0
- package/lib/labeled-polyline.js +17 -0
- package/lib/pattern-groups.js +91 -0
- package/lib/price-bands.js +55 -0
- package/lib/price-series.js +47 -0
- package/lib/price-sticks.js +32 -0
- package/lib/types/candle-sequence.d.ts +2 -0
- package/lib/types/chart-adjustment.d.ts +2 -0
- package/lib/types/chart-annotations.d.ts +4 -0
- package/lib/types/chart-applications.d.ts +26 -0
- package/lib/types/chart-context.d.ts +14 -0
- package/lib/types/chart-observation.d.ts +8 -0
- package/lib/types/chart-service-status.d.ts +22 -0
- package/lib/types/chart-source-status.d.ts +47 -0
- package/lib/types/chart-sources.d.ts +25 -0
- package/lib/types/client/BetterSidebarTab.d.ts +12 -0
- package/lib/types/client/ClassicShell.d.ts +4 -0
- package/lib/types/client/KlineContent.d.ts +37 -0
- package/lib/types/client/PanelHost.d.ts +25 -0
- package/lib/types/client/chart-apply.d.ts +13 -0
- package/lib/types/client/chart-context.d.ts +23 -0
- package/lib/types/client/chart-handoff.d.ts +5 -0
- package/lib/types/client/chart-session-resolver.d.ts +2 -0
- package/lib/types/client/client-context.d.ts +16 -0
- package/lib/types/client/conversation.d.ts +43 -0
- package/lib/types/client/default-tab.d.ts +3 -0
- package/lib/types/client/embed.d.ts +37 -0
- package/lib/types/client/generated-view.d.ts +2 -0
- package/lib/types/client/horizontal-lines.d.ts +1 -0
- package/lib/types/client/host-options.d.ts +38 -0
- package/lib/types/client/host-panels.d.ts +55 -0
- package/lib/types/client/index.d.ts +4 -0
- package/lib/types/client/mode-preferences.d.ts +25 -0
- package/lib/types/client/native-sidebar-contract.d.ts +52 -0
- package/lib/types/client/native-sidebar-register.d.ts +46 -0
- package/lib/types/client/native-sidebar-services.d.ts +45 -0
- package/lib/types/client/native-sidebar.d.ts +47 -0
- package/lib/types/client/sidebar-integration.d.ts +12 -0
- package/lib/types/client/ui-onboarding.d.ts +7 -0
- package/lib/types/client/version.d.ts +1 -0
- package/lib/types/drawing-feedback.d.ts +5 -0
- package/lib/types/fibonacci.d.ts +5 -0
- package/lib/types/ftshare-settings-bridge.d.ts +50 -0
- package/lib/types/index.d.ts +26 -0
- package/lib/types/labeled-polyline.d.ts +11 -0
- package/lib/types/pattern-groups.d.ts +2 -0
- package/lib/types/price-bands.d.ts +3 -0
- package/lib/types/price-series.d.ts +5 -0
- package/lib/types/price-sticks.d.ts +3 -0
- package/package.json +155 -4
- package/requirements.txt +6 -0
- package/screenshots.json +8 -0
- package/scripts/bootstrap.sh +5 -0
- package/scripts/dsh-bootstrap.mjs +179 -0
- package/scripts/dsh-mcp-plugin.mjs +27 -0
- package/scripts/run-dsh-kline.mjs +658 -0
- package/scripts/run-dsh-kline.sh +5 -0
- package/server.py +1755 -0
- package/tools/__init__.py +0 -0
- package/tools/annotations.py +119 -0
- package/tools/automatic_analysis.py +158 -0
- package/tools/baostock_source.py +176 -0
- package/tools/calc.py +39 -0
- package/tools/channel_candidates.py +260 -0
- package/tools/channel_preview.py +82 -0
- package/tools/channels.py +104 -0
- package/tools/chart_applications.py +204 -0
- package/tools/chart_context.py +186 -0
- package/tools/chart_edits.py +363 -0
- package/tools/chart_functions.py +451 -0
- package/tools/chart_indicators.py +65 -0
- package/tools/chart_measurements.py +84 -0
- package/tools/chart_source_status.py +32 -0
- package/tools/chart_sources.py +31 -0
- package/tools/closed_daily.py +68 -0
- package/tools/draw.py +410 -0
- package/tools/drawing_feedback.py +45 -0
- package/tools/drawing_interaction.py +117 -0
- package/tools/drawing_verification.py +141 -0
- package/tools/fetch.py +4680 -0
- package/tools/fibonacci.py +83 -0
- package/tools/foreign_daily.py +185 -0
- package/tools/free_sources.py +483 -0
- package/tools/lines.py +91 -0
- package/tools/nine_count.py +66 -0
- package/tools/pattern_groups.py +103 -0
- package/tools/pivots.py +60 -0
- package/tools/polylines.py +131 -0
- package/tools/price_bands.py +165 -0
- package/tools/price_patterns.py +311 -0
- package/tools/price_series.py +162 -0
- package/tools/price_sticks.py +114 -0
- package/tools/range_candidates.py +170 -0
- package/tools/recent_drawing_candidates.py +123 -0
- package/tools/rectangles.py +76 -0
- package/tools/regression_channels.py +87 -0
- package/tools/ta_functions.py +228 -0
- package/tools/trend_lines.py +106 -0
- package/tools/watchlist.py +149 -0
- package/view/ft-logo.jpg +0 -0
- package/view/kline.html +12436 -0
- package/view/vendor/klinecharts.min.js +7 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 免费港美股日 K:数据合同与验证
|
|
2
|
+
|
|
3
|
+
v0.6.7 使用腾讯公开行情。无 Key 时优先走此路径,无需 FTShare SDK;有 Key 时 FTShare 优先,仅失败后尝试腾讯。仅适用于 `day`、`interval_value=1`。不会补充分钟、周月线、新闻或板块排行,也不把外国证券送入 A 股接口。
|
|
4
|
+
|
|
5
|
+
## 价格与身份
|
|
6
|
+
|
|
7
|
+
| 市场 | 不复权 | 前复权 | 后复权 |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| 港股 | kline/kline → day | hkfqkline/get → qfqday | hkfqkline/get → hfqday |
|
|
10
|
+
| 美股 | kline/kline → day | usfqkline/get → qfqday | 未支持,保留主源结果并说明限制 |
|
|
11
|
+
|
|
12
|
+
固定请求域名为 `web.ifzq.gtimg.cn`,参数为 `code,day,,end,count,mode`。不复权 mode 为空,前/后复权为 qfq/hfq;必须返回对应序列,`day` 不得冒充 `qfqday` 或 `hfqday`。港股形如 `hk00700`。美股先从固定 `qt.gtimg.cn` 公开 quote 的第 3 字段读取身份,限定证券根代码完全相同且后缀为 `.OQ/.N/.AM`,例如 `usAAPL.OQ`、`usBRK.B.N`、`usSPY.AM`。不猜交易所,不截断类别股,不支持尚未验证的其他后缀。
|
|
13
|
+
|
|
14
|
+
合同来自腾讯官网页面直接引用的 [港股图表脚本](https://st.gtimg.com/quotes/hk/zxgweb-chart-9fc1788a8403.js)、[美股图表脚本](https://st.gtimg.com/quotes/us/zxgweb-chart-8e4bcd3c375c.js)。HK 脚本 SHA-256 为 `f6ab9fb6f7df9258ab74a6c148e4480adfc260a1eab0f60ff4ba2d8488988edb`,US 为 `2c4d58ef34357a60260a4a512fe98e58f9dd44270f5ac1e2abaa2399c67796b3`。菜单、路由、成交量映射均已静态核对并与实际 JSON 样本交叉检查;未执行供应商浏览器脚本。
|
|
15
|
+
|
|
16
|
+
## 成交量与公司行动
|
|
17
|
+
|
|
18
|
+
数组字段为日期、开盘、收盘、最高、最低、成交量。官网 `STOCK_UNIT` 中 HK/US 都是“股”,第 6 列直接进入 volume。输出 `volume_unit=shares`、`volume_adjustment=historical_session_shares`:不乘 100,不随复权比例缩放。跨拆股比较量比时须意识到这是历史当日股数,拆股前后股本单位改变;不要混入其他供应商按最新股本重算的历史量。
|
|
19
|
+
|
|
20
|
+
2026-11-06 核对的记录样本(价格是当次供应商快照,后续分红可能使前复权历史价改变):
|
|
21
|
+
|
|
22
|
+
| 标的、日期 | 不复权 close | 前复权 close | 成交量(两者相同) |
|
|
23
|
+
| --- | ---: | ---: | ---: |
|
|
24
|
+
| NVDA 2024-06-07 | 1208.88 | 120.51 | 41,238,580 股 |
|
|
25
|
+
| NVDA 2024-06-10 | 121.79 | 121.41 | 314,162,650 股 |
|
|
26
|
+
| AAPL 2024-05-09 | 184.57 | 182.57 | 按原始响应保留 |
|
|
27
|
+
| AAPL 2024-05-10 | 183.05 | 181.32 | 按原始响应保留 |
|
|
28
|
+
| 00700 2024-05-16 | 397.00 | 383.80 | 按原始响应保留 |
|
|
29
|
+
| 00700 2024-05-17 | 395.00 | 385.20 | 按原始响应保留 |
|
|
30
|
+
|
|
31
|
+
NVDA [SEC 8-K](https://www.sec.gov/Archives/edgar/data/1045810/000104581024000144/nvda-20240607.htm) 确认 1 股拆为 10 股,2024-06-10 起拆后交易。价格跳变在前复权中消除,成交量保持当日股数。Apple [股息记录](https://investor.apple.com/dividend-history/)与腾讯 [2024 股息公告](https://static.www.tencent.com/uploads/2024/05/16/ff201b0efd70a96a7e2136bed628c202.pdf)用来核对除息日:腾讯前复权变化为 `395−397+3.4=1.4`;后复权 close `2197.93→2204.93` 的差额为该变化的历史倍率 5 倍。记录响应的必要价格/量字段存于 `tests/fixtures/foreign-daily.json`,离线回归不依赖供应商当日网络。
|
|
32
|
+
|
|
33
|
+
## 历史覆盖与时间
|
|
34
|
+
|
|
35
|
+
- 每页最多 640 根,最多 8 页,请求总量封顶 4,000 根;响应上限 2 MB、单请求超时 6 秒。使用固定 HTTPS 地址和短缓存,不执行远程代码。
|
|
36
|
+
- 向更早 end 日期回溯,页边界重叠;重叠行 OHLCV 必须完全相同。日期须递增、身份及复权序列须准确,非有限数、错误 OHLC 范围、负成交量会使该页无效。不混合供应商和复权基础。
|
|
37
|
+
- 返回实际起止时间、根数、`history_complete` 和 `coverage_reason`。数量不足、源不可用、重复返回、不遵守 end、页间口径变化均明确报告,保留已验证的较新行;`history_complete` 仅表示达到请求根数,不是交易所全历史完整性的保证。
|
|
38
|
+
- 一些港股累计现金分配会令早期前复权价格为零/负数。当前图表不接受非正价格,此时仅保留最近连续的正价格区间并返回 `non_positive_adjusted_prices`;不把负数改成零或删掉中间日期后继续拼接。不复权/后复权可另行请求。
|
|
39
|
+
- 日线用交易所日期的当地 16:00 作统一时间锚点。使用 `Asia/Hong_Kong` / `America/New_York`,美国夏令时正确切换;该锚点不是每个历史交易日真实最后成交时刻,提前收市日也保持统一约定。
|
|
40
|
+
- 美国当天 16:00 前、香港当天 16:15 前不纳入当天未完成日线。免费源可能延迟或中断,数据仍使用现有 freshness/status 提示;不承诺实时性、OTC、所有证券或全部公司行动的完整覆盖。
|
|
41
|
+
|
|
42
|
+
2026-11-06 实际多页请求:00700 不复权/前复权各 1,300 根(2021-07-28 至 2026-11-05),后复权 650 根;AAPL 不复权及 NVDA 前复权各 1,300 根(2021-09-02 至 2026-11-05),均跨页校验成功。另验证 BRK.B 不复权、SPY 前复权各 220 根,HK 更早 end 请求能返回 2011 年数据。最新日受当时交易状态影响,此记录不构成永久覆盖承诺。
|
|
43
|
+
|
|
44
|
+
最大请求量也已实测:00700 不复权/后复权各 4,000 根,起于 2010-08-12;AAPL 前复权、NVDA 不复权各 4,000 根,起于 2010-12-08,均截至 2026-11-05。00700 前复权请求 4,000 根时返回 3,292 根正价格日线,始于 2013-06-26,并正确报告 `history_complete=false` / `non_positive_adjusted_prices`。
|
package/docs/guide.en.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Installation, usage and maintenance
|
|
2
|
+
|
|
3
|
+
[Back to overview](../README.en.md)
|
|
4
|
+
|
|
5
|
+
[Codex](#use-with-codex) · [DSH](#get-started-with-dsh) · [Charts](#using-the-chart) · [Sources](#quotes-and-data-sources) · [FAQ](#frequently-asked-questions) · [Development](#for-ai-and-developers)
|
|
6
|
+
|
|
7
|
+
## Use with Codex
|
|
8
|
+
|
|
9
|
+
The Codex plugin is `ft-kline`, available from the **FTShare** marketplace (`ftshare`). Add the GitHub source once, install the plugin, and use the same source for updates. No ZIP download or source build is required. This is a project-maintained marketplace, not a listing in OpenAI's official public plugin directory.
|
|
10
|
+
|
|
11
|
+
### Install and verify
|
|
12
|
+
|
|
13
|
+
1. Install Git, Node.js **22.19+**, Python **3.11+**, and a Codex client supporting plugins. Enable Python Launcher on Windows; Git Bash and WSL are unnecessary.
|
|
14
|
+
2. Run these commands. The first adds the source and follows CI-validated `main`; the second installs and enables the plugin:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
codex plugin marketplace add FTShare-Lab/dsh_kline --ref main
|
|
18
|
+
codex plugin add ft-kline@ftshare
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. Reopen Codex and ask for a daily chart and its data source. During first-time preparation, ask to check FT K-Line runtime status. Desktop users can expand the chart card, search symbols and use the drawing workbench; CLI returns data and analysis.
|
|
22
|
+
|
|
23
|
+
After adding the source, you can also reopen the desktop app and select **FTShare → FT K-Line** in the Plugins page. Inspect the source and available plugins with:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
codex plugin marketplace list
|
|
27
|
+
codex plugin list --marketplace ftshare --available --json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Updates and migration
|
|
31
|
+
|
|
32
|
+
Refresh the existing source, install its current plugin version, then reopen Codex:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
codex plugin marketplace upgrade ftshare
|
|
36
|
+
codex plugin add ft-kline@ftshare
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If you previously installed `ft-kline@ftshare-local` from a ZIP, disable that old installation in the Plugins page before enabling `ft-kline@ftshare`, so two sources do not expose duplicate tools. The GitHub source needs access to GitHub; first launch also downloads Python dependencies.
|
|
40
|
+
|
|
41
|
+
### Install a fixed release ZIP
|
|
42
|
+
|
|
43
|
+
To stay on a fixed release, download `ft-kline-v0.6.8.zip` and its SHA-256 from the [v0.6.8 release](https://github.com/FTShare-Lab/dsh_kline/releases/tag/v0.6.8), verify the hash, and extract to a permanent folder. Replace the quoted path below with that absolute folder path:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
codex plugin marketplace add "/absolute/path/ft-kline-v0.6.8"
|
|
47
|
+
codex plugin add ft-kline@ftshare-local
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Reopen Codex to use it. The ZIP source is `ftshare-local`, separate from the public GitHub source `ftshare`. DSH retains its `dsh-kline-v0.6.8.tgz` package and the installation method below.
|
|
51
|
+
|
|
52
|
+
### First launch and runtime modes
|
|
53
|
+
|
|
54
|
+
First use finds Python and installs dependencies automatically, which can take several minutes. The Node entry completes the handshake and exposes the **complete catalog on the first tools/list**, plus preloadable chart resources. It does not depend on catalog-change notifications. Check `ft_kline_runtime_status` while preparing. Ordinary calls wait briefly, then return `runtime_preparing` if necessary; rejected edits never execute later. Once ready, retry the original request without refreshing tools or reopening the chat. Logs are in `~/.cache/ft-kline/bootstrap.log` or `%LOCALAPPDATA%\ft-kline\bootstrap.log` on Windows.
|
|
55
|
+
|
|
56
|
+
Restart Codex once after upgrading from v0.6.1 to replace its previous status-only startup snapshot. Then request a daily chart directly. Runtime readiness, data delivery and a visibly rendered native chart are separate acceptance checks; a fallback visualization does not satisfy native-plugin acceptance.
|
|
57
|
+
|
|
58
|
+
Default `auto` mode checks the host's declared MCP Apps HTML capability. Supporting hosts get interactive charts and guarded edits; other hosts, including CLI, get structured data and analysis without chart resources or drawing writes. Advanced integrations can explicitly set `FT_KLINE_CLIENT=desktop` or `cli`.
|
|
59
|
+
|
|
60
|
+
Chart edits follow `get_chart_context → prepare_chart_edit → apply_chart_edit → get_chart_edit_status`. Server commits, UI receipts and visual verification remain separate.
|
|
61
|
+
|
|
62
|
+
### Reuse an FTShare key
|
|
63
|
+
|
|
64
|
+
Symbol discovery and quote access are separate. v0.6.7 adds a keyless Tencent HK/US daily fallback: HK supports unadjusted, forward and backward adjustment; US supports unadjusted and forward adjustment. Volumes remain historical session shares. Public-source coverage is bounded; see the [data contract](free-foreign-daily.md). See the [key-less capability and evaluation notes](anonymous-market-support.md); fixed release archives retain their release's behavior.
|
|
65
|
+
|
|
66
|
+
Credential priority is: **plugin-process `FTSHARE_API_KEY` → explicitly configured `FTSHARE_API_KEY_FILE` → temporary App-session key**. An export in an unrelated terminal is not automatically visible to the desktop app.
|
|
67
|
+
|
|
68
|
+
The selected file is reread before provider requests and is never modified or deleted by the plugin. Use JSON `{"version":1,"api_key":"your key"}`. macOS/Linux require owner-only permissions (`chmod 600`); symbolic links are rejected. Status reports only `environment`, `external_file`, `session` or `none`, never the key or path. Codex does not discover DSH credentials or scan `.env`, shell profiles, keychains or other apps; sharing a file requires explicitly configuring its path.
|
|
69
|
+
|
|
70
|
+
Without a key, supported A-share, HK and US daily-history and index fallbacks remain available. Chart state, results, watchlists and App-entered keys stay in connection memory until the last view closes, disconnect, or 30 idle minutes. User-managed environment/file credentials are not deleted when a chart closes. DSH persistent watchlists are not inherited.
|
|
71
|
+
|
|
72
|
+
For the v0.6.11 candidate, see [release notes](release-notes-v0.6.11.md), [acceptance](release-acceptance-v0.6.11.md), and [npm preparation](npm-release.md).
|
|
73
|
+
|
|
74
|
+
See the [v0.6.8 release notes](release-notes-v0.6.8.md) and [acceptance checklist](release-acceptance-v0.6.8.md) for verification and remaining manual desktop checks.
|
|
75
|
+
|
|
76
|
+
## Get started with DSH
|
|
77
|
+
|
|
78
|
+
v0.6.5 adds an optional chart-panel mounting interface for host developers, with external symbol and theme updates. Canvas and paper-trading panels require host integration; see the [embedding contract](embedding.md).
|
|
79
|
+
|
|
80
|
+
### 1. Install and enable
|
|
81
|
+
|
|
82
|
+
Find `dsh_kline` in the DeepSeek Harness plugin marketplace. If the catalog has not refreshed yet, install directly from GitHub:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
dsh plugin --profile web add github:FTShare-Lab/dsh_kline
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The first launch prepares its runtime automatically. Later, update from the marketplace or Settings when a new version is available.
|
|
89
|
+
|
|
90
|
+
The plugin supports macOS, Linux, and native Windows. Install a working DSH Web host and Python 3.11 or newer first. On Windows, use the [python.org installer](https://www.python.org/downloads/windows/) with the Python Launcher enabled. Git Bash and WSL are not required. First-launch details are stored in `dsh_kline/bootstrap.log` under the user cache directory; the Windows default is `%LOCALAPPDATA%\dsh_kline\bootstrap.log`.
|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+
### 2. Choose either entry point
|
|
95
|
+
|
|
96
|
+
**Ask AI** in a conversation, for example:
|
|
97
|
+
|
|
98
|
+
- `Show the K-line chart for Zijin Mining and its trend over the last month`
|
|
99
|
+
- `Show Tencent's daily chart and mark support and resistance`
|
|
100
|
+
- `Analyze NVIDIA's volume, MACD, and RSI over the past month`
|
|
101
|
+
- `What recent news and fundamentals should I know about this company?`
|
|
102
|
+
- `Draw a blue level at 1300 on the current chart, then change that object to green`
|
|
103
|
+
- `Propose three anchors for a descending channel; explain the deviation and wait for my confirmation`
|
|
104
|
+
- `Screen my watchlist for ABC candidates; verify one symbol's 0/A/B/C pivots on its daily chart before drawing, and tell me whether C is confirmed`
|
|
105
|
+
|
|
106
|
+
**Open the workspace directly**: click the K button on the right, or choose **非凸 K 线助手 / dsh_kline** from the `+` menu where workspace Tabs are available. Search by name or ticker; exchange suffixes are not required.
|
|
107
|
+
|
|
108
|
+
Both entry points can operate on the same new drawing objects in the active chart. In the chart toolbar, **Draw** opens the drawing workbench: choose a tool to draw the latest eligible candidate, or pick candles and enter parameters manually. Drawings appear directly and remain when the controls close. Conversations retain separate chart states; watchlists remain user-level data.
|
|
109
|
+
|
|
110
|
+
## Using the chart
|
|
111
|
+
|
|
112
|
+
1. Search for a company or ticker at the top.
|
|
113
|
+
2. Pick a time range and candle timeframe. Intraday availability depends on the market and data entitlement.
|
|
114
|
+
3. Enable the indicators you need, then pan, zoom, or use the crosshair for detail.
|
|
115
|
+
4. Select **Levels** for support and resistance. Under **Draw**, choose a tool for an automatic recent candidate or use **Pick anchors manually**. Drawings appear directly; closing the panel preserves them. Use **Clear** inside Draw to remove them.
|
|
116
|
+
5. Click two candles in sequence to review return, range, drawdown, and trading activity for that interval.
|
|
117
|
+
6. Select the star beside a symbol to add it to a watchlist.
|
|
118
|
+
7. Under **Compare**, search for stocks, indices, or ETFs, or use an index shortcut to add lines to the main chart.
|
|
119
|
+
|
|
120
|
+
Where a **UI** menu is available, choose Automatic, Classic sidebar, or workspace Tab. Automatic uses the best interface your current Harness supports; when Tabs are unavailable, the regular K-line sidebar continues to work.
|
|
121
|
+
|
|
122
|
+
### Sidebar compatibility
|
|
123
|
+
|
|
124
|
+
Newer DeepSeek Harness versions provide native right-sidebar tabs: **Better Sidebar is not required**. Choose **Workspace tab** under **UI**; the classic K sidebar remains the default. Older hosts may use a compatible Better Sidebar integration, sharing the same chart content. Native auto-open was tested on DSH 0.2.1-rc.5, a prerelease host; this does not establish compatibility with every host version.
|
|
125
|
+
|
|
126
|
+
## Quotes and data sources
|
|
127
|
+
|
|
128
|
+
FTShare is the default optional source. After you configure an API key, the plugin exposes the quote, intraday, news, and company-data capabilities available to your account. Availability differs by market and plan.
|
|
129
|
+
|
|
130
|
+
Only unadjusted (`none`) single-session one-minute requests for regular A-share stocks prefer FTShare's raw realtime feed. Forward/backward requests (including qfq/hfq) use history with the matching `adjust_kind`; failure never silently falls back to raw realtime rows. Indices, ETFs and multi-session history retain their applicable endpoints. Full-session returns and adjustment-isolated caching are unchanged; routing is not independent verification of vendor-adjusted prices.
|
|
131
|
+
Explicit source minute size survives ingestion, local redraw and workspace state. Missing/invalid metadata stays unknown; it is not inferred from timestamp spacing, UI labels or the previous symbol. Unconfirmed sources still cannot authorize guarded drawing.
|
|
132
|
+
|
|
133
|
+
The plugin reuses FTShare credentials in this order: an `FTSHARE_API_KEY` already injected into the current DSH service, an explicitly configured `FTSHARE_API_KEY_FILE`, a Key saved in the DSH FTShare settings, and a local credential previously saved by this plugin. If the key is already available to the process that starts DSH, it is used automatically. Installing the FTShare SDK alone, or storing a key in another app's private configuration, is not enough for the plugin to read it.
|
|
134
|
+
|
|
135
|
+
When the DSH FTShare settings plugin is installed, the host publishes its Key to the MCP server, which re-reads it before every request — so adding, rotating, or clearing the Key in the settings page needs no dsh restart. That Key belongs to the settings page; this plugin never displays or clears it.
|
|
136
|
+
|
|
137
|
+
For safety, the plugin never scans `.env` files, shell configuration, keychains, or other apps' configuration files, and never displays a key or path. **Settings → Data source** identifies the active source; use **Manage FTShare configuration** to paste and test a replacement key, either for the current session or saved locally for future launches.
|
|
138
|
+
|
|
139
|
+
Theme and language follow the DSH host by default. **Settings → Theme/Language** also offers manual choices and a way back to **Follow host (default)**.
|
|
140
|
+
|
|
141
|
+
[FTShare's free-plan endpoints](https://market.ft.tech/gateway/doc/p/pb8eizu3) still require a registered API key. Without a key, some historical daily A-share bars can use BaoStock, HK/US daily bars can use Tencent, and selected broad-market indices have separate free fallbacks. Intraday bars, news and other capabilities still depend on source coverage and permissions. Existing valid OHLCV data, including rows supplied by the host, can still drive local indicators and drawing. The UI reports the applicable source or error when data is rate-limited, unavailable, or outside the account's entitlement.
|
|
142
|
+
|
|
143
|
+
## Frequently asked questions
|
|
144
|
+
|
|
145
|
+
**Why is an intraday chart unavailable?**
|
|
146
|
+
Intraday access depends on the symbol's market, your account plan, and the source's currently supported coverage. Test the connection in Data source first. Daily, weekly, and monthly views do not require the intraday entitlement, but individual-stock candles still need a working data source; FTShare's free plan requires an API key too.
|
|
147
|
+
|
|
148
|
+
**What if the first launch fails on Windows?**
|
|
149
|
+
|
|
150
|
+
Inspect `%LOCALAPPDATA%\dsh_kline\bootstrap.log`. From v0.6.4, dependency upgrades reuse a working venv; rebuilding also tries its recorded base interpreter and Desktop's bundled standard Python. Trimmed distributions lacking venv/ensurepip still need a standard Python 3.11+ installation. Check `py -3.11 --version` (newer versions work), or set `DSH_KLINE_PYTHON` to the full `python.exe` path before starting DSH. Correcting the configuration invalidates the old retry delay. Nested bundles no longer need a profile-root K-line package, but bundles pinning an older plugin must update it. DSH installation and Windows sandbox issues remain host-level concerns.
|
|
151
|
+
|
|
152
|
+
**Why do two conversations show different charts?**
|
|
153
|
+
This is intentional: each chart belongs to its conversation, so an analysis in one conversation cannot replace another's chart. Search or start a new analysis in the other conversation when needed.
|
|
154
|
+
|
|
155
|
+
**Why can data differ slightly from another platform?**
|
|
156
|
+
Quotes can be delayed and may differ with adjustment policy, exchange conventions, market-close state, and upstream services. Use appropriately licensed feeds for commercial, high-frequency, or latency-sensitive work.
|
|
157
|
+
|
|
158
|
+
## For AI and developers
|
|
159
|
+
|
|
160
|
+
### Drawing through chat and the workbench
|
|
161
|
+
|
|
162
|
+
On a source-checked current chart, the host can interpret a request and use the plugin's calculate → prepare → apply → verify flow. The workbench exposes the same protected objects for automatic candidates, manual anchors, direct drawing, and editing. Selected families are horizontal levels, two-anchor trend segments, three-anchor finite parallel channels, rectangular ranges, two-anchor Fibonacci retracements, manually supplied or host-proposed-and-checked ABC anchors, double tops/bottoms, head-and-shoulders patterns, platform states, basic nine-count groups, and standalone SMA/EMA lines or BOLL three-line bands. Names, four colors, channel midlines, and rectangle fills are supported. The plugin draws ABC labels; **it does not automatically recognize Elliott waves**, and candidates are not definitive conclusions.
|
|
163
|
+
|
|
164
|
+
Try “draw a blue level at 31.2 called support”, “move support to 30.8; leave everything else”,
|
|
165
|
+
or “propose a descending channel with three anchors and explain deviations; wait for approval”.
|
|
166
|
+
|
|
167
|
+
The host interprets language, analyzes candles and selects anchors. The plugin observes,
|
|
168
|
+
measures, executes and reports; it does not embed another AI or replay predefined drawing skills.
|
|
169
|
+
Explicit parameters may execute directly; proposal-first requests must wait for approval.
|
|
170
|
+
Host explanations and professional anchor selection can be wrong and require user judgement.
|
|
171
|
+
|
|
172
|
+
Foundation scope and limitations:
|
|
173
|
+
|
|
174
|
+
- Daily/weekly paths are the main acceptance scope. Anchors must match actual loaded bars.
|
|
175
|
+
The plugin does not guess missing dates, snap anchors or fetch extra candles to repair edits.
|
|
176
|
+
- Trend segments and channels are finite, with no automatic extension or logarithmic geometry.
|
|
177
|
+
Channels and rectangles retain their creation interval.
|
|
178
|
+
- Guarded edits target stable IDs without resetting candles, indicators or the viewport.
|
|
179
|
+
Manual drawings, automatic annotations and AI objects remain separate.
|
|
180
|
+
- Confirmed drawings can restore and be edited after browser refresh within the same host run.
|
|
181
|
+
Conversations are isolated. Returning to a conversation restores its last confirmed drawing
|
|
182
|
+
checkpoint, **not necessarily its last manually selected interval, range or viewport**.
|
|
183
|
+
- Workbench point selection and form editing are supported; AI mouse dragging, undo, cross-process old-chart editing and complete automatic failure
|
|
184
|
+
recovery are not supported. Unknown outcomes stop automatic retries.
|
|
185
|
+
- **Clear drawings and annotations** asks for confirmation, then removes AI objects,
|
|
186
|
+
analysis annotations, manual drawings, and custom levels for the current symbol and interval.
|
|
187
|
+
Indicators and alerts remain. Request an exact AI target when you want to delete only one object.
|
|
188
|
+
- An object may be outside the visible time/price range. Object state and application receipts
|
|
189
|
+
do not prove screen pixels, professional pattern quality or vendor quote correctness.
|
|
190
|
+
- Minute availability depends on source/permissions; not all markets, minute sizes or operation combinations are accepted. Channels, boxes and ABC labels are not automatically recognized professional patterns. Chan analysis is not included. The 201 TA-Lib functions are primarily read-only; only the selected SMA/EMA/BBANDS outputs have a guarded drawing conversion.
|
|
191
|
+
|
|
192
|
+
Host integration uses `get_chart_context → prepare_chart_edit → apply_chart_edit → get_chart_edit_status`.
|
|
193
|
+
Read fresh context after approval and verify against independently retained approved parameters.
|
|
194
|
+
A `context_ref` is not a `chart_session`. Read-only `preview_chart_channel` and `verify_chart_drawings`
|
|
195
|
+
measure geometry/check parameters; neither selects patterns or grants drawing permission.
|
|
196
|
+
Legacy per-family tools manipulate explicit snapshots, not the guarded live-chart workflow.
|
|
197
|
+
|
|
198
|
+
Run `pnpm build:sidebar` and `pnpm test` for the build and complete Node/Python regression suite.
|
|
199
|
+
See the [v0.5.0 candidate acceptance notes](release-acceptance-v0.5.0.md) for scope, evidence, and remaining release gates. The full [function guide](chart-functions.md) separates read-only calculations from drawable results.
|
|
200
|
+
First-time automatic dependency preparation needs network access and may take several minutes.
|
|
201
|
+
|
|
202
|
+
### Host-provided Python runtime
|
|
203
|
+
|
|
204
|
+
Ordinary installs default to `DSH_KLINE_RUNTIME_MODE=auto`, preserving existing Python/venv selection and dependency preparation. Desktop applications, containers, and other hosts can set these variables before starting DSH:
|
|
205
|
+
|
|
206
|
+
| Environment variable | Meaning |
|
|
207
|
+
| --- | --- |
|
|
208
|
+
| `DSH_KLINE_PACKAGE_ROOT` | Optional absolute plugin package directory; otherwise resolved beside the plugin module, including nested installs. |
|
|
209
|
+
| `DSH_KLINE_PYTHON` | Path to the Python interpreter provided by the host. |
|
|
210
|
+
| `DSH_KLINE_RUNTIME_MODE` | `auto` (default) or `external`. |
|
|
211
|
+
|
|
212
|
+
`external` requires Python 3.11+ with the required dependencies already available. It only validates and launches the service: no venv creation, dependency installation, or interpreter fallback. The host must repair failures. This mode rejects `DSH_KLINE_VENV`, `--prepare-project`, and `--bootstrap-runtime`. `DSH_KLINE_DEFER_BOOTSTRAP` does not trigger background installation in this mode.
|
|
213
|
+
|
|
214
|
+
`DSH_KLINE_PYTHON` must identify the executable file (`python.exe` on Windows), not its directory. Automatic preparation distinguishes `PYTHON_NOT_FOUND`, `PYTHON_VERSION_TOO_OLD`, `PYTHON_EXECUTION_FAILED`, `PYTHON_VENV_UNAVAILABLE`, `PYTHON_DEPENDENCY_INSTALL_FAILED`, and `PYTHON_IMPORT_CHECK_FAILED`; an unusable Windows Store redirector is `PYTHON_STORE_ALIAS`. Candidate paths and outcomes are logged locally, without keys or a dump of the parent environment.
|
|
215
|
+
|
|
216
|
+
In `external` mode, the host owns the interpreter, dependency search paths, and isolation settings (such as `PYTHONPATH`, `PYTHONNOUSERSITE`, or Windows embedded Python's `._pth`); no other interpreter is discovered. `auto` mode uses the bounded discovery and repair described above. Set `DSH_KLINE_CHART_PORT=0` for a dynamic port. The MCP patch explicitly forwards runtime variables without changes to DSH core.
|
|
217
|
+
|
|
218
|
+
## Updates and license
|
|
219
|
+
|
|
220
|
+
See [Releases](https://github.com/FTShare-Lab/dsh_kline/releases) for version history. This project is released under the [MIT License](../LICENSE); frontend provenance is in [PROVENANCE.md](../PROVENANCE.md).
|
|
221
|
+
|
|
222
|
+
Maintainers changing tools, annotations, resources or the App bridge must regenerate the packaged catalog with `python scripts/generate-codex-catalog.py`; `--check` and regression tests detect stale catalogs.
|
|
223
|
+
|
|
224
|
+
The public `marketplace/ft-kline/` snapshot is generated from the same Codex package allowlist. After editing source, plugin manifests or README files, run `pnpm sync:codex-marketplace` and commit the generated files. CI runs `pnpm verify:codex-marketplace` and independently starts the directory in Desktop and CLI modes. Do not edit generated files directly; see [marketplace maintenance](https://github.com/FTShare-Lab/dsh_kline/blob/main/marketplace/README.md).
|
|
225
|
+
|
|
226
|
+
### DSH startup diagnostics
|
|
227
|
+
|
|
228
|
+
MCP discovery remains connected while Python is prepared; `dsh_kline_runtime_status` reports `preparing`, `recovering`, or `ready`. Backend restarts never replay operations with unknown outcomes. Chart registration retries without terminating other MCP tools.
|
|
229
|
+
|
|
230
|
+
Request `/dsh-kline/healthz` on the current DSH Web origin: 200 confirms the locator and HTTP backend instance agree; 503 identifies the failure. It does not check provider permissions or MCP tool execution. Historical `/dsh-kline/session?session=…` snapshots are not a health check. Use the locator's actual service port rather than assuming 8765.
|
|
231
|
+
|
|
232
|
+
Dependency logs remain in `bootstrap.log`; backend stderr is persisted to `logs/backend-<host_pid>.log` with one `.previous` rotation at approximately 1 MiB. The default cache is `~/.cache/dsh_kline` on macOS/Linux (honoring `XDG_CACHE_HOME`) or `%LOCALAPPDATA%\dsh_kline` on Windows. `DSH_KLINE_CACHE_DIR` overrides it; `DSH_KLINE_RUNTIME_DIR` independently overrides runtime files. Health responses never expose the service token.
|
package/docs/guide.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# 安装、使用与维护指南
|
|
2
|
+
|
|
3
|
+
[返回首页](../README.md)
|
|
4
|
+
|
|
5
|
+
[Codex 安装与配置](#在-codex-中使用) · [DSH 安装](#开始使用-dsh-版) · [绘图](#绘图对话与工作台共用一个对象流程) · [数据源](#行情与数据源) · [常见问题](#常见问题) · [开发与诊断](#给-ai-与开发者)
|
|
6
|
+
|
|
7
|
+
## 在 Codex 中使用
|
|
8
|
+
|
|
9
|
+
Codex 插件名为 `ft-kline`,公开源名称为 **FTShare**(标识 `ftshare`)。添加一次 GitHub 源后即可安装,后续从同一个源更新,无需下载 ZIP 或构建源码。该源由本项目维护,尚未上架 OpenAI 官方公共插件目录。
|
|
10
|
+
|
|
11
|
+
### 安装、启动与验证
|
|
12
|
+
|
|
13
|
+
1. 先安装 Git、Node.js **22.19+**、Python **3.11+** 和支持插件的 Codex。Windows 推荐启用 Python Launcher;不要求 Git Bash 或 WSL。
|
|
14
|
+
2. 在终端执行下面两条命令。第一条添加公开源并跟随经过 CI 验证的 `main`;第二条安装并启用插件:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
codex plugin marketplace add FTShare-Lab/dsh_kline --ref main
|
|
18
|
+
codex plugin add ft-kline@ftshare
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. 重新打开 Codex,然后说“打开招商银行日 K,显示数据来源”。首次准备期间可先查询“检查 FT K-Line 运行状态”。桌面端可展开图表卡片,搜索、切换标的并使用绘图工作台;CLI 只返回数据和分析。
|
|
22
|
+
|
|
23
|
+
添加源后,也可以重新打开桌面应用,在插件页面选择 **FTShare → FT K-Line** 安装。可用下面的命令检查源和插件列表:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
codex plugin marketplace list
|
|
27
|
+
codex plugin list --marketplace ftshare --available --json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 更新与旧安装迁移
|
|
31
|
+
|
|
32
|
+
以后更新时刷新已添加的源,再安装该源的当前版本,最后重新打开 Codex:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
codex plugin marketplace upgrade ftshare
|
|
36
|
+
codex plugin add ft-kline@ftshare
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
如果此前从 ZIP 安装了 `ft-kline@ftshare-local`,请在插件页面停用旧安装,再启用 `ft-kline@ftshare`,避免同时加载两个来源的同名工具。GitHub 源需要访问 GitHub;首次启动还需要联网下载 Python 依赖。
|
|
40
|
+
|
|
41
|
+
### 固定版本 ZIP 安装
|
|
42
|
+
|
|
43
|
+
如需固定在发布版本,也可从 [v0.6.8 发布页](https://github.com/FTShare-Lab/dsh_kline/releases/tag/v0.6.8) 下载 `ft-kline-v0.6.8.zip` 和同名 SHA-256 文件,核对后解压到长期保留的目录。将下面路径换成实际解压目录;含空格时保留引号:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
codex plugin marketplace add "/absolute/path/ft-kline-v0.6.8"
|
|
47
|
+
codex plugin add ft-kline@ftshare-local
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
重新打开 Codex 后即可使用。ZIP 源标识为 `ftshare-local`,与公开 GitHub 源 `ftshare` 分开维护。DSH 沿用 `dsh-kline-v0.6.8.tgz` 安装包及下文的 DSH 安装方式。
|
|
51
|
+
|
|
52
|
+
### 首次准备与运行模式
|
|
53
|
+
|
|
54
|
+
首次连接会自动寻找可用 Python 并准备依赖,可能需要数分钟。Node 入口先完成握手,并从**第一次工具查询**就提供该宿主模式的完整工具目录和图表资源,不依赖工具列表变更通知。准备期间可查询 `ft_kline_runtime_status`;普通调用会短暂等待,仍未就绪则明确返回 `runtime_preparing`,不会延迟执行已退回的绘图操作。准备完成后直接重试原请求,无需刷新目录或重开对话。失败详情见 `~/.cache/ft-kline/bootstrap.log`,Windows 为 `%LOCALAPPDATA%\ft-kline\bootstrap.log`。
|
|
55
|
+
|
|
56
|
+
从 v0.6.1 升级后重启一次 Codex,以替换此前只包含状态工具的启动快照;然后直接请求“打开招商银行日 K”。已就绪、数据返回和原生画布实际可见分别验证,备用绘图不计为插件原生验收。
|
|
57
|
+
|
|
58
|
+
Codex 入口默认按宿主声明的 MCP Apps HTML 能力选择模式:具备图表能力时提供交互图表和受控绘图;其他宿主(包括 CLI)只提供行情、指标与结构化分析。未声明图表能力的宿主不会收到无法使用的绘图工具。高级接入可显式设置 `FT_KLINE_CLIENT=desktop` 或 `cli`;普通安装保持默认 `auto` 即可。
|
|
59
|
+
|
|
60
|
+
自然语言修改当前图使用 `get_chart_context → prepare_chart_edit → apply_chart_edit → get_chart_edit_status`;服务端提交、应用界面回执和实际画布观察分别核对。CLI 不提供交互图表。
|
|
61
|
+
|
|
62
|
+
### 已有 FTShare Key 如何复用
|
|
63
|
+
|
|
64
|
+
无 Key 不等于所有市场都不可用,搜索目录与行情权限也相互独立。v0.6.7 新增腾讯港美股免费日 K 备用源:港股支持三种复权,美股支持不复权和前复权;成交量为历史当日股数。仅接入日 K,历史覆盖受公开源限制,详见[数据口径](free-foreign-daily.md)。搜索与其他能力见[无 Key 说明](anonymous-market-support.md)。固定版本安装包以对应发行版为准。
|
|
65
|
+
|
|
66
|
+
Codex 依次使用:
|
|
67
|
+
|
|
68
|
+
1. **启动插件的进程环境**中的 `FTSHARE_API_KEY`;仅在另一个终端执行过 `export`,不代表桌面应用也能继承。
|
|
69
|
+
2. 用户明确指定的 `FTSHARE_API_KEY_FILE`,每次取数前重新读取;文件由用户管理,插件不修改、不清除。JSON 格式为 `{"version":1,"api_key":"你的 Key"}`;macOS/Linux 必须限制为仅当前用户可读写(`chmod 600`),不接受符号链接。
|
|
70
|
+
3. 图表“设置 → 数据源”输入的临时 Key,仅当前 App 会话使用。
|
|
71
|
+
|
|
72
|
+
没有 Key 仍可尝试 A 股、港股、美股历史日 K 和免费指数备用源;公开源失败不代表 Key 无效。Codex **不自动扫描** DSH、`.env`、shell、钥匙串或其他应用的配置;如需共享已有文件,必须明确设置上述文件路径。状态只显示 `environment`、`external_file`、`session` 或 `none`,不回显 Key 或路径。
|
|
73
|
+
|
|
74
|
+
图表、函数结果、自选和应用内临时 Key 保存在当前连接内存中;最后一个图表视图关闭、连接结束或空闲 30 分钟后清除。Codex 不继承 DSH 的持久化自选。环境变量和显式文件由用户管理,不会随图表关闭而被插件删除。
|
|
75
|
+
|
|
76
|
+
v0.6.11 候选见[发布说明](release-notes-v0.6.11.md)、[验收记录](release-acceptance-v0.6.11.md)与[npm 发布准备](npm-release.md)。
|
|
77
|
+
|
|
78
|
+
已发布版本内容、自动化验证和桌面验收见 [v0.6.8 发布说明](release-notes-v0.6.8.md) 与 [验收说明](release-acceptance-v0.6.8.md)。
|
|
79
|
+
|
|
80
|
+
## 开始使用 DSH 版
|
|
81
|
+
|
|
82
|
+
v0.6.5 为宿主开发者提供可选的图表面板挂载接口,支持外部标的与主题联动。画布、模拟盘等场景需要宿主接入;接口与布局约定见[嵌入说明](embedding.md)。
|
|
83
|
+
|
|
84
|
+
### 1. 安装并启用
|
|
85
|
+
|
|
86
|
+
在 DeepSeek Harness 的插件市场搜索 `dsh_kline`。如果市场目录还没有刷新,可以直接从 GitHub 安装:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
dsh plugin --profile web add github:FTShare-Lab/dsh_kline
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
首次启动会自动准备所需运行环境。以后有新版本时,在插件市场或设置页更新即可。
|
|
93
|
+
|
|
94
|
+
插件支持 macOS、Linux 和原生 Windows。用户需要先安装可运行的 DSH Web,以及 Python 3.11 或更高版本;Windows 推荐使用 [python.org](https://www.python.org/downloads/windows/) 安装包并启用 Python Launcher。插件不要求 Git Bash 或 WSL。首次启动的依赖安装日志位于用户缓存目录下的 `dsh_kline/bootstrap.log`;Windows 默认为 `%LOCALAPPDATA%\dsh_kline\bootstrap.log`。
|
|
95
|
+
|
|
96
|
+

|
|
97
|
+
|
|
98
|
+
### 2. 任选一种入口
|
|
99
|
+
|
|
100
|
+
**和 AI 对话**:在对话中提出需求,例如:
|
|
101
|
+
|
|
102
|
+
- `调取紫金矿业的 K 线,看看最近一个月走势`
|
|
103
|
+
- `分析腾讯控股日 K,标注支撑位和压力位`
|
|
104
|
+
- `查看英伟达最近一个月的成交量、MACD 和 RSI`
|
|
105
|
+
- `这只股票最近有什么新闻和基本面变化?`
|
|
106
|
+
- `在当前图画1300元的蓝色支撑线,叫关键支撑;之后把它改成绿色`
|
|
107
|
+
- `请先给出下降通道的三个锚点和偏离,再等我确认是否落图`
|
|
108
|
+
- `从我的自选中筛选 ABC 候选;选一只核对 0、A、B、C 四个拐点后画到日 K 图上,并说明 C 点是否已经确认`
|
|
109
|
+
|
|
110
|
+
**直接打开工作台**:点击右侧 K 按钮,或在支持工作台 Tab 的界面从 `+` 菜单选择 **非凸 K 线助手 / dsh_kline**。输入股票名称或代码即可开始,不需要记住交易所后缀。
|
|
111
|
+
|
|
112
|
+
两种入口可操作同一张当前图中的新绘图对象;也可以在图表工具栏打开 **绘图**,选择工具后自动绘制最近合格候选,或手动点选 K 线锚点。每个对话各自保存图表状态,避免串图;自选与分组属于用户级数据,跨对话保留。
|
|
113
|
+
|
|
114
|
+
## 图表怎么用
|
|
115
|
+
|
|
116
|
+
1. 用顶部搜索框输入标的名称或代码。
|
|
117
|
+
2. 选择时间范围和 K 线周期;分钟线是否可用取决于数据权限和市场。
|
|
118
|
+
3. 开启需要的指标,拖动、缩放或使用十字线查看细节。
|
|
119
|
+
4. 点击 **点位** 查看支撑和压力;点击 **绘图** 选择工具,自动绘制最近合格候选,或用 **手动选点** 指定锚点。图形直接显示,关闭面板保留;通过面板内的 **清除** 移除。
|
|
120
|
+
5. 依次点击两根 K 线,查看这段区间的涨跌、振幅、回撤与成交统计。
|
|
121
|
+
6. 点击名称旁的星标,把标的放进自选。
|
|
122
|
+
7. 点击 **对比** 搜索个股、指数或 ETF,或选择常用指数快捷项,在主图叠加走势。
|
|
123
|
+
|
|
124
|
+
如果界面提供 **UI** 入口,可按习惯选择自动、独立侧栏或工作台 Tab。自动模式会使用当前 Harness 能提供的最佳界面;没有工作台 Tab 框架时,仍可正常使用右侧 K 线侧栏。
|
|
125
|
+
|
|
126
|
+
### 界面兼容
|
|
127
|
+
|
|
128
|
+
新版 DeepSeek Harness 提供原生右侧标签,**无需安装 Better Sidebar**。在右上角 **UI** 选择“工作台标签”即可使用;经典 K 侧栏仍为默认。旧宿主也可通过兼容的 Better Sidebar 提供标签接口,两者共用图表内容。已在 DSH 0.2.1-rc.5 中验证原生自动开图;这是预发布宿主,不代表其他版本均已验收。
|
|
129
|
+
|
|
130
|
+
## 绘图:对话与工作台共用一个对象流程
|
|
131
|
+
|
|
132
|
+
在当前已核对来源的图表中,宿主可根据自然语言调用插件的计算、准备、应用和状态核对;工作台提供自动候选、手动选点和直接绘图。精选范围包括:
|
|
133
|
+
|
|
134
|
+
- 水平线:指定价位、名称、颜色。
|
|
135
|
+
- 两点趋势线:连接已有 K 线的两个时间 / 价格锚点。
|
|
136
|
+
- 平行通道:三点确定上升、下降或水平通道,可开关中线。
|
|
137
|
+
- 平台矩形框:指定时间和上下价格边界,可开关淡色填充。
|
|
138
|
+
- 斐波那契回撤:两点及比例作为一个对象管理;价位由插件按价格公式计算。
|
|
139
|
+
- ABC 折线标注:连接用户指定、或由宿主基于行情提议并核对的 0/A/B/C 锚点,可按点名续改;**插件不自动识浪,候选并非定论**。
|
|
140
|
+
- 价格形态与九转:双顶/底、头肩顶/底、平台状态与基础九转,支持自动分析和整体绘制。
|
|
141
|
+
- SMA、EMA 单线与 BOLL 三轨:TA-Lib 结果可在明确要求后作为独立主图对象落图,不等于切换现有指标开关。
|
|
142
|
+
|
|
143
|
+
例如:
|
|
144
|
+
|
|
145
|
+
- `在31.2元画蓝色水平线,叫基础支撑`
|
|
146
|
+
- `把基础支撑移到30.8元,其他图形不动`
|
|
147
|
+
- `把这两天的最低价连成绿色趋势线`
|
|
148
|
+
- `找一段下降通道,先告诉我三个锚点和明显偏离,确认后再画`
|
|
149
|
+
- `框出这段整理区间;把框的上沿改到31.2;只删除这个框`
|
|
150
|
+
|
|
151
|
+
宿主 AI 负责理解、分析和选点;插件负责读取当前图、确定性测量、执行与反馈,
|
|
152
|
+
不内置另一套 AI,也不靠预置绘图 skill 回放。明确参数可直接执行;要求先提方案时,
|
|
153
|
+
确认前不绘制。宿主分析和解释可能出错,专业画线质量仍需使用者核对。
|
|
154
|
+
|
|
155
|
+
### 当前范围与限制
|
|
156
|
+
|
|
157
|
+
- 重点验收日线 / 周线。锚点必须对应当前已加载的真实 K 线,不会猜日期、吸附端点或自动取新行情补点。
|
|
158
|
+
- 支持蓝、绿、橙、红四种颜色。两点线和通道为有限区间,不自动延伸,不支持对数通道。
|
|
159
|
+
- 修改按稳定对象 ID 定位,绘图不重置行情、指标或可见范围;通道和平台框按创建周期隔离。
|
|
160
|
+
- 当前宿主运行期间,同一对话已确认图形可在网页刷新后恢复并继续修改;不同对话不共用绘图对象。
|
|
161
|
+
返回对话恢复最后确认的绘图检查点,**不保证恢复离开前最后一次手动选择的周期、范围或视口**。
|
|
162
|
+
- 工作台支持表单与图上点选,已确认的新对象可由对话或工作台按 ID 续改;鼠标拖拽和撤销暂不支持。旧手动画线、自动标注与受保护对象分开管理。
|
|
163
|
+
- 绘图面板内的 **清除** 会先确认,再清除当前标的、当前周期的 AI 图形、分析标注、手动画线和自定义点位;指标与预警保留。只想删除一个 AI 图形时,可在对话中指定目标。
|
|
164
|
+
- 图形可能超出当前时间 / 价格可见区。对象核对和应用回执不等于屏幕像素核验,也不证明供应商行情真值。
|
|
165
|
+
- 来源过期、周期 / 复权不明、多个活动视图或结果未知时停止修改;不要自动重做未知操作。
|
|
166
|
+
完整服务重启后的旧图编辑和完整异常自动恢复尚不支持。
|
|
167
|
+
- 分钟功能取决于来源与权限,本版不承诺全部分钟 / 市场 / 操作组合。通道、平台、ABC 均不代表自动专业形态识别;缠论未接入。201 个 TA-Lib 函数大多只读,不承诺全部可绘制。
|
|
168
|
+
|
|
169
|
+
### 给宿主与开发者
|
|
170
|
+
|
|
171
|
+
当前图修改使用 `get_chart_context → prepare_chart_edit → apply_chart_edit → get_chart_edit_status`。
|
|
172
|
+
确认后重新读取当前观察,以原批准参数核对;`context_ref` 不是 `chart_session`。
|
|
173
|
+
只读 `preview_chart_channel` 提供几何 / 偏差核对,`verify_chart_drawings` 核对指定对象参数;
|
|
174
|
+
二者不选点、不评判专业形态、不代替绘图授权。旧的分类型工具是快照接口,不应绕过当前图应用协议。
|
|
175
|
+
|
|
176
|
+
运行 `pnpm build:sidebar` 和 `pnpm test` 验证构建与全部 Node / Python 回归。
|
|
177
|
+
DSH 绘图范围见[v0.5.0 验收说明](release-acceptance-v0.5.0.md),当前候选安装与 Codex 验证见[v0.6.11 验收说明](release-acceptance-v0.6.11.md)。
|
|
178
|
+
首次自动准备依赖需要网络,耗时取决于网络和本机环境。
|
|
179
|
+
|
|
180
|
+
## 行情与数据源
|
|
181
|
+
|
|
182
|
+
默认可接入 FTShare。配置 API Key 后,插件会根据你的账户权限提供相应的行情、分钟线、新闻和公司资料能力;不同市场和套餐的可用范围可能不同。
|
|
183
|
+
|
|
184
|
+
普通 A 股当日1分钟、none不复权请求优先使用 FTShare 的实时一分钟数据;前 / 后复权请求(含qfq / hfq)使用携带匹配adjust_kind的历史接口,失败时不混入原始实时数据。指数、ETF 与多日分钟历史继续使用各自适用的历史接口;完整交易时段与缓存复权隔离规则不变。此分流不等于对供应商复权价格正确性的独立验证。
|
|
185
|
+
分钟粒度随明确来源、重绘及工作区状态保留;元数据缺失或非法时仍为未知,不按K线时间间隔 / 界面标签猜测,也不继承上一标的粒度。来源未确认时继续禁止受保护绘图。
|
|
186
|
+
|
|
187
|
+
DSH 版会按以下顺序复用 FTShare 凭据:当前 DSH 服务已注入的 `FTSHARE_API_KEY`、用户显式指定的 `FTSHARE_API_KEY_FILE`、DSH 的 FTShare 设置所保存的 Key,以及此前由本插件保存的本机凭据。也就是说,若你已把 Key 配给启动 DSH 的环境,插件会直接使用;仅安装 FTShare SDK、或把 Key 留在其他应用的私有配置中,并不会被自动读取。
|
|
188
|
+
|
|
189
|
+
DSH 中安装了 FTShare 设置插件时,宿主会把设置里的 Key 发布给 MCP 服务,插件在每次取数前重新读取,因此在设置页新增、更换或清除 Key 后无需重启 dsh;该 Key 由设置页管理,插件不会显示或清除它。
|
|
190
|
+
|
|
191
|
+
出于安全考虑,插件不会扫描 `.env`、shell 配置、钥匙串或其他应用的配置文件,也不会显示 Key 或文件路径。**设置 → 数据源** 会清楚标出当前来源;需要更换时,在“管理 FTShare 配置”中粘贴 Key 并测试连接,DSH 版可选择仅本次使用,或保存到本机供下次启动加载;Codex 版仅提供会话临时输入,或读取用户明确指定的外部文件。
|
|
192
|
+
|
|
193
|
+
主题和语言默认跟随 dsh 宿主,可在 **设置 → 主题/语言** 中改为手动选择;随时可切回“跟随宿主(默认)”。
|
|
194
|
+
|
|
195
|
+
[FTShare 的“免费版”接口](https://market.ft.tech/gateway/doc/p/pb8eizu3)仍需注册并配置 API Key。完全不配置 Key 时,部分 A 股历史日 K 可尝试 BaoStock 备用源,港美股日 K 可尝试腾讯,部分大盘指数也有独立免费备用行情;分钟线、新闻等能力仍取决于来源与权限。已有的合规 K 线数据(包括宿主提供的标准 OHLCV)仍可用于本地指标计算与绘图。遇到限流、权限不足或上游暂不可用,界面会说明实际原因和数据来源。
|
|
196
|
+
|
|
197
|
+
## 常见问题
|
|
198
|
+
|
|
199
|
+
**为什么找不到分钟线?**
|
|
200
|
+
分钟行情是否可用取决于标的市场、账户套餐和数据源当前支持范围。请先在“数据源”中测试连接;日、周、月等周期不受分钟权限限制,但个股 K 线仍需可用的数据源,FTShare 免费套餐也需要 API Key。
|
|
201
|
+
|
|
202
|
+
**Windows 首次启动失败怎么办?**
|
|
203
|
+
|
|
204
|
+
先查看 `%LOCALAPPDATA%\dsh_kline\bootstrap.log`。v0.6.4 起,依赖更新优先复用现有 venv;重建时会尝试已记录的基础解释器和 Desktop 随附的标准 Python。裁剪版 Python 缺少 venv/ensurepip 时仍需另装 Python 3.11+。可执行 `py -3.11 --version`(更高版本也可以),或在启动 DSH 前将 `DSH_KLINE_PYTHON` 设为 `python.exe` 的完整路径;修正后无需等旧失败记录冷却。嵌套 bundle 安装不再要求 profile 根存在 K 线包,但固定旧版依赖的 bundle 仍需更新。DSH 自身安装或 Windows sandbox 问题请参考 DSH 文档。
|
|
205
|
+
|
|
206
|
+
**为什么两个对话显示不同的图?**
|
|
207
|
+
这是刻意设计:图表会绑定各自对话,避免 A 对话的分析覆盖 B 对话。需要在另一个对话查看时,直接搜索或重新发起分析即可。
|
|
208
|
+
|
|
209
|
+
**为什么同一标的的数据与其他平台略有不同?**
|
|
210
|
+
行情可能延迟,也会受复权方式、交易所口径、收盘状态和上游服务影响。商业、高频或对时效有严格要求的场景,请使用有相应授权与服务等级的数据源。
|
|
211
|
+
|
|
212
|
+
## 给 AI 与开发者
|
|
213
|
+
|
|
214
|
+
大多数场景只需调用 `analyze_kline`。插件还提供 `fetch_candles`、`search_symbols`、`calc_metrics`、`analyze_kline_rows`、`data_source_status`、`configure_ftshare`、`test_ftshare_connection` 和 `health`,用于原始数据、外部 OHLCV、配置与诊断;`market_pulse`、`market_board_detail` 和 `security_intelligence` 提供市场与标的情报;`get_watchlist`、`save_watchlist` 用于读取和保存自选分组。
|
|
215
|
+
|
|
216
|
+
FTShare 只是默认适配器,不是分析引擎的前提。调用方可以把自己的标准 OHLCV 数据交给 `analyze_kline_rows`,继续使用指标、关键点位、图表和工作台。接入说明见 [数据源适配指南](provider-adaptation.md)。
|
|
217
|
+
|
|
218
|
+
### 由宿主提供 Python 运行环境
|
|
219
|
+
|
|
220
|
+
普通安装默认使用 `DSH_KLINE_RUNTIME_MODE=auto`,沿用现有的 Python/venv 选择和依赖准备流程。桌面应用、容器等宿主可在启动 DSH 前设置:
|
|
221
|
+
|
|
222
|
+
| 环境变量 | 含义 |
|
|
223
|
+
| --- | --- |
|
|
224
|
+
| `DSH_KLINE_PACKAGE_ROOT` | 可选的插件包根目录绝对路径;未设置时从插件模块自身定位,支持嵌套安装。 |
|
|
225
|
+
| `DSH_KLINE_PYTHON` | 宿主提供的 Python 解释器路径。 |
|
|
226
|
+
| `DSH_KLINE_RUNTIME_MODE` | `auto`(默认)或 `external`。 |
|
|
227
|
+
|
|
228
|
+
`external` 模式要求 Python 3.11+ 和所需依赖已经可用,只校验并启动服务,不创建 venv、不安装依赖、不回退到其他解释器;失败应由宿主修复。该模式不能与 `DSH_KLINE_VENV`、`--prepare-project` 或 `--bootstrap-runtime` 同时使用。`DSH_KLINE_DEFER_BOOTSTRAP` 在该模式下不触发后台安装。
|
|
229
|
+
|
|
230
|
+
`DSH_KLINE_PYTHON` 必须指向解释器文件本身(Windows 为 `python.exe`),不能填目录。自动准备失败时,日志会区分 `PYTHON_NOT_FOUND`、`PYTHON_VERSION_TOO_OLD`、`PYTHON_EXECUTION_FAILED`、`PYTHON_VENV_UNAVAILABLE`、`PYTHON_DEPENDENCY_INSTALL_FAILED` 和 `PYTHON_IMPORT_CHECK_FAILED`;不可用的 Windows Store 重定向入口标为 `PYTHON_STORE_ALIAS`。候选路径与结果仅用于本机诊断,不记录密钥或完整环境变量。
|
|
231
|
+
|
|
232
|
+
`external` 模式由宿主负责解释器、依赖搜索路径及隔离配置(例如 `PYTHONPATH`、`PYTHONNOUSERSITE` 或 Windows 嵌入式 Python 的 `._pth`),不自动探测其他解释器。`auto` 模式的补装和有限解释器探测如上所述。需要动态端口时设置 `DSH_KLINE_CHART_PORT=0`。环境变量在 MCP patch 中显式转交,无需修改 DSH 核心。
|
|
233
|
+
|
|
234
|
+
## 更新与许可
|
|
235
|
+
|
|
236
|
+
更新记录见 [Releases](https://github.com/FTShare-Lab/dsh_kline/releases)。本项目采用 [MIT License](../LICENSE),前端来源说明见 [PROVENANCE.md](../PROVENANCE.md)。
|
|
237
|
+
|
|
238
|
+
维护者修改工具参数、注解、资源或 App 桥接代码后,运行 `python scripts/generate-codex-catalog.py` 更新随包目录;`--check` 与回归测试会阻止过期目录进入发布包。
|
|
239
|
+
|
|
240
|
+
公开 GitHub 源中的 `marketplace/ft-kline/` 由同一 Codex 打包清单生成。修改源码、插件声明或 README 后,运行 `pnpm sync:codex-marketplace` 并提交生成结果;CI 通过 `pnpm verify:codex-marketplace` 检查文件一致性,并独立验证该目录的桌面及 CLI 启动。不要直接修改生成目录,维护说明见 [marketplace/README.md](https://github.com/FTShare-Lab/dsh_kline/blob/main/marketplace/README.md)。
|
|
241
|
+
|
|
242
|
+
### DSH 启动诊断
|
|
243
|
+
|
|
244
|
+
首次启动时,MCP 工具目录会立即注册,Python 环境在同一连接内准备。`dsh_kline_runtime_status` 返回 `preparing` / `recovering` / `ready`;未就绪的调用会明确说明是否已经发送。结果未知的操作必须先核对状态,不能自动重放。图表定位文件写失败时其他 MCP 工具仍可用,目录恢复后自动注册。
|
|
245
|
+
|
|
246
|
+
在当前 DSH Web 地址请求 `/dsh-kline/healthz`:200 表示定位记录与实际 HTTP 后端实例一致;503 返回故障原因。这个检查不验证行情供应商权限或 MCP 工具调用。`/dsh-kline/session?session=…` 读取历史快照,不能代替健康检查。后端实际端口由定位文件决定,不能假定固定为 8765。
|
|
247
|
+
|
|
248
|
+
安装日志为缓存目录下的 `bootstrap.log`,后端 stderr 为 `logs/backend-<宿主PID>.log`,超过约 1 MiB 时保留一份 `.previous`。默认缓存目录为 macOS/Linux 的 `~/.cache/dsh_kline`(支持 `XDG_CACHE_HOME`)或 Windows 的 `%LOCALAPPDATA%\dsh_kline`,可用 `DSH_KLINE_CACHE_DIR` 覆盖;`DSH_KLINE_RUNTIME_DIR` 可独立覆盖运行目录。健康响应不会返回服务令牌。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# npm 发布与安装
|
|
2
|
+
|
|
3
|
+
包名:`@ftshare-lab/dsh-kline@0.6.11`,公共 npm registry,公开访问。
|
|
4
|
+
|
|
5
|
+
npm 安装包与 DSH GitHub 发行资产使用同一份已验证的 TGZ,避免发布时重新取到不同内容。`package.json` 已移除 `private` 并设置 `publishConfig.access=public`。上传需在跨平台 CI、发行资产核对及 npm 登录验证后执行。
|
|
6
|
+
|
|
7
|
+
## 发布前
|
|
8
|
+
|
|
9
|
+
1. 推送候选到 `test`,等待九组跨平台 CI 全部通过,完成 DSH/Codex 桌面验收,再合并 `main`。
|
|
10
|
+
2. 创建 `v0.6.11` 标签,等待现有发行流水线生成草稿资产;下载 TGZ/ZIP,校验版本、SHA-256 和内容。
|
|
11
|
+
3. 本机使用 `npm login` 登录有 `@ftshare-lab` scope 发布权限的账号;`npm whoami` 核对账号。GitHub 组织权限不等于 npm 组织权限,发布前分别核对。
|
|
12
|
+
4. 对准备上传的 TGZ 执行下面的 dry-run。dry-run 只验证打包与命令,不证明 npm 权限或正式上传会成功。
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm publish ./release/dsh-kline-v0.6.11.tgz --access public --dry-run
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 获准发布后
|
|
19
|
+
|
|
20
|
+
对核对过的同一份 TGZ 执行;如 npm 要求身份验证,由维护者完成。
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm publish ./release/dsh-kline-v0.6.11.tgz --access public
|
|
24
|
+
npm view @ftshare-lab/dsh-kline@0.6.11 version dist.integrity dist.tarball
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
发布后先用 `npm view @ftshare-lab/dsh-kline@0.6.11 version` 确认 registry 可读,再在全新 DSH profile 验证按包名安装,最后复核插件市场目录中的 npm 关联、版本和下载统计。GitHub 安装路径继续保留。
|
|
28
|
+
|
|
29
|
+
## 统计口径
|
|
30
|
+
|
|
31
|
+
市场显示 npm 下载量需市场目录关联本包,发布 npm 本身不会自动改目录。下载包含更新、重复下载和自动构建,不能称为安装人数;本候选未添加用户追踪或安装遥测。
|
|
32
|
+
|
|
33
|
+
参考:[npm 公开 scope 包](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages/)、[npm publish](https://docs.npmjs.com/cli/commands/npm-publish/)。
|