@fastmoss/cli 0.1.6 → 0.1.14

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.zh-CN.md CHANGED
@@ -1,218 +1,171 @@
1
- # FastMoss CLI
1
+ # @fastmoss/cli
2
2
 
3
3
  [English](./README.md)
4
4
 
5
- FastMoss CLI 用于在终端或 AI Agent 中发现并调用 FastMoss MCP 工具,覆盖 TikTok Shop 选品、达人发现、店铺分析、广告分析、市场洞察、视频/直播分析和 FastMoss 知识库查询等场景。
5
+ `@fastmoss/cli` 只安装 `fastmoss` 命令。npm 包会解析精确同版本的平台包,安装时和运行时都不会下载二进制文件。
6
6
 
7
- CLI 需要配合 FastMoss CLI Agent Skill 一起使用:
8
-
9
- - `@fastmoss/cli` 安装 `fastmoss` 命令,用于真正执行工具调用。
10
- - `npx skills add FastMoss/cli` 安装 Agent Skill,让你的 Agent 知道有哪些 FastMoss 工具、什么时候使用、怎么调用。
7
+ <!-- FASTMOSS_INSTALLATION_START -->
8
+ ## 安装
11
9
 
12
- 安装 CLI:
10
+ CLI 与 Agent Skill 相互独立,安装其中一个不会自动安装另一个。
13
11
 
14
- ```bash
15
- npm install -g @fastmoss/cli
16
- ```
12
+ ### npm
17
13
 
18
- 单独安装 Skill
14
+ 只安装 CLI
19
15
 
20
16
  ```bash
21
- npx skills add FastMoss/cli -y -g
22
- npx skills add FastMoss/cli --agent claude-code
23
- # 如果你的 skills CLI 支持 --client:
24
- npx skills add FastMoss/cli --client claude
17
+ npm install -g @fastmoss/cli@latest
25
18
  ```
26
19
 
27
- ## 关于 FastMoss
28
-
29
- [FastMoss](https://www.fastmoss.com/) 是面向全球 TikTok 品牌、商家、服务商、创作者和运营团队的数据分析平台。FastMoss 帮助用户洞察大盘趋势、发现爆品和品类机会、寻找达人与机构、监控竞店、分析广告投放,并研究直播生态。
30
-
31
- FastMoss 主要提供以 TikTok 和 TikTok Shop 为核心的大数据分析服务,覆盖直播、商品、店铺、达人、广告、视频、音乐、标签等版块,涵盖美国、英国、印尼、越南、菲律宾、泰国、马来西亚、西班牙、墨西哥、法国、德国、巴西等主要 TikTok 商业化国家和区域的数据。
32
-
33
- ## 安装
34
-
35
- 不安装,直接通过 npx 运行:
20
+ 不做全局安装,临时运行 CLI:
36
21
 
37
22
  ```bash
38
- npx @fastmoss/cli
23
+ npx -y @fastmoss/cli@latest
39
24
  ```
40
25
 
41
- 全局安装:
26
+ 只安装或更新 Agent Skill:
42
27
 
43
28
  ```bash
44
- npm install -g @fastmoss/cli
45
- fastmoss
29
+ npx -y @fastmoss/skill@latest
46
30
  ```
47
31
 
48
- 全局安装后,命令名是 `fastmoss`。如果终端提示 `command not found: fastmoss`,通常是 npm 全局 bin 目录没有加入 `PATH`。
32
+ Skill 命令全程非交互,可以直接发送到 Agent 聊天框由 Agent 执行。默认会把 `fastmoss-cli` 安装到 Codex、Claude 和通用 Agents 三个目录,并输出实际 `SKILL.md` 路径和当前会话加载提示。
49
33
 
50
- 如果你的 npm 配置禁止 lifecycle scripts,可以允许本包的 postinstall 脚本在安装期预下载二进制:
34
+ 指定 Agent 或卸载:
51
35
 
52
36
  ```bash
53
- npm install -g --allow-scripts=@fastmoss/cli @fastmoss/cli
37
+ npx -y @fastmoss/skill@latest --agent codex
38
+ npx -y @fastmoss/skill@latest --agent claude
39
+ npx -y @fastmoss/skill@latest --agent agents
40
+ npx -y @fastmoss/skill@latest --agent all
41
+ npx -y @fastmoss/skill@latest uninstall --agent all
54
42
  ```
55
43
 
56
- ## API Key 和积分
57
-
58
- FastMoss 工具调用需要 API Key,并会消耗积分。访问 [FastMoss 开发者平台](https://developers.fastmoss.com/mcp/overview.html) 登录、创建 MCP API Key、查看用量并管理积分。
44
+ 设置 `FASTMOSS_SKILL_DIR` 后只安装到一个自定义 skills 根目录。npm 安装只使用用户配置的 npm registry,不会从 GitHub 下载文件。
59
45
 
60
- 常规配置:
46
+ ### GitHub clone
61
47
 
62
48
  ```bash
63
- fastmoss login --api-key <your-api-key>
64
- fastmoss whoami
49
+ git clone --depth 1 https://github.com/FastMoss/cli.git
50
+ cd cli
51
+ ./install.sh --cli
52
+ ./install.sh --skill
53
+ ./install.sh --all
65
54
  ```
66
55
 
67
- 如果积分不足,请在开发者平台的计费/价格页面充值或升级套餐。计费和积分规则见 [FastMoss MCP Pricing](https://developers.fastmoss.com/mcp/pricing.html)。
56
+ Windows PowerShell:
57
+
58
+ ```powershell
59
+ git clone --depth 1 https://github.com/FastMoss/cli.git
60
+ cd cli
61
+ .\install.ps1 -Cli
62
+ .\install.ps1 -Skill
63
+ .\install.ps1 -All
64
+ ```
68
65
 
69
- ## 命令
66
+ `--all` 和 `-All` 只是依次执行两个独立安装动作。clone 或下载 GitHub Release 离线包后,安装过程只读取本地文件,不调用 npm,也不继续下载其他文件。
67
+ <!-- FASTMOSS_INSTALLATION_END -->
70
68
 
71
- 查看版本和帮助:
69
+ ## 使用
72
70
 
73
71
  ```bash
74
72
  fastmoss --version
75
73
  fastmoss help
76
- ```
77
-
78
- 登录和本地配置:
79
-
80
- ```bash
81
74
  fastmoss login --api-key <your-api-key>
82
- fastmoss logout
83
- fastmoss whoami
84
- fastmoss set api-key <your-api-key>
85
- fastmoss clear api-key
86
- fastmoss set language zh
87
- fastmoss set language en
88
- fastmoss show config
89
- fastmoss show auth
90
- ```
91
-
92
- 发现工具:
93
-
94
- ```bash
95
75
  fastmoss tools
96
- fastmoss tools --json
97
- fastmoss tools --search <tool_name>
98
- ```
99
-
100
- 调用工具:
101
-
102
- ```bash
103
76
  fastmoss call --tool <tool_name> --args '<json>' --output mcp
104
- fastmoss <tool_name> --args '<json>' --output mcp
105
77
  ```
106
78
 
107
- LLM Agent 读取结果时优先使用 `--output mcp`。终端里只想看简洁结果时使用 `--output data`。只有调试原始 RPC 响应时才使用 `--output rpc`。
108
-
109
- 联网命令常用参数:
110
-
111
- ```bash
112
- --api-key <api-key>
113
- --base-url <url>
114
- --timeout <seconds>
115
- --insecure-skip-tls
116
- ```
117
-
118
- ## 支持的工具
119
-
120
- 随包发布的 Agent Skill 包含静态工具目录。你也可以执行 `fastmoss tools` `fastmoss tools --json` 查看当前账号实时可用的工具列表。
121
-
122
- | 分类 | name | title |
123
- |---|---|---|
124
- | 广告工具 | `ad_data_overview` | Ad data overview |
125
- | 广告工具 | `ad_search` | Ad search |
126
- | 达人工具 | `creator_cargo_summary` | Creator ecommerce summary |
127
- | 达人工具 | `creator_data_trends` | Creator data trends |
128
- | 达人工具 | `creator_fans_distribution` | Creator fans distribution |
129
- | 达人工具 | `creator_product_list` | Creator product list |
130
- | 达人工具 | `creator_profile_overview` | Creator profile overview |
131
- | 达人工具 | `creator_rank_top_ecommerce` | Top ecommerce creators |
132
- | 达人工具 | `creator_rank_top_growth` | Top creator follower growth |
133
- | 达人工具 | `creator_rank_top_potential` | Top potential creators |
134
- | 达人工具 | `creator_search` | Creator search |
135
- | 达人工具 | `creator_video_analysis` | Creator video analysis |
136
- | 辅助和知识库工具 | `fastmoss_detail_url_examples` | FastMoss Detail URL Examples |
137
- | 辅助和知识库工具 | `live_detail_analysis` | Live detail analysis and category breakdown |
138
- | 辅助和知识库工具 | `live_products_list` | Live promoted product list |
139
- | 辅助和知识库工具 | `live_search` | Live search |
140
- | 市场洞察工具 | `market_category_analysis` | Category market analysis |
141
- | 市场洞察工具 | `market_category_author_sales_matrix` | Category creator sales matrix |
142
- | 市场洞察工具 | `market_category_ranking` | Category market ranking |
143
- | 商品工具 | `product_category_info` | Product category list |
144
- | 商品工具 | `product_creator_analysis` | Product creator analysis and creator list |
145
- | 商品工具 | `product_detail_info` | Product detail info |
146
- | 商品工具 | `product_investment` | Product ad investment analysis |
147
- | 商品工具 | `product_overview` | Product overview |
148
- | 商品工具 | `product_rank_new_listed` | New listed product ranking |
149
- | 商品工具 | `product_rank_top_selling` | Top selling products |
150
- | 商品工具 | `product_review_list` | Product review list |
151
- | 商品工具 | `product_sales_trend` | Product sales trend |
152
- | 商品工具 | `product_search` | Product search |
153
- | 商品工具 | `product_sku` | Product SKU analysis |
154
- | 商品工具 | `product_video_list` | Product video list |
155
- | 辅助和知识库工具 | `search_category_by_words` | Search TikTok Product Category by Keywords |
156
- | 辅助和知识库工具 | `search_fastmoss_documents` | FastMoss Knowledge Base Search |
157
- | 店铺工具 | `shop_base_info` | Shop base info |
158
- | 店铺工具 | `shop_creator_analysis` | Shop creator analysis and creator list |
159
- | 店铺工具 | `shop_data_trends` | Shop data trends |
160
- | 店铺工具 | `shop_investment_analysis` | Shop ad investment analysis |
161
- | 店铺工具 | `shop_live_analysis` | Shop live analysis and live list |
162
- | 店铺工具 | `shop_product_analysis` | Shop product analysis and product list |
163
- | 店铺工具 | `shop_rank_top_selling` | Top selling shops |
164
- | 店铺工具 | `shop_sale_analysis` | Shop sales analysis |
165
- | 店铺工具 | `shop_search` | Shop search |
166
- | 店铺工具 | `shop_video_analysis` | Shop video analysis and video list |
167
- | 辅助和知识库工具 | `video_data_trends` | Video data trends |
168
- | 辅助和知识库工具 | `video_detail_analysis` | Video detail analysis and product list |
169
- | 辅助和知识库工具 | `video_script_info` | Video subtitle script |
170
- | 辅助和知识库工具 | `video_search` | Video search |
171
-
172
- ## 二进制下载
173
-
174
- 本包会安装 `fastmoss` 命令。npm 包本身不内置 Go 二进制文件,而是在安装或首次运行时从 GitHub Releases 下载当前平台对应的 `fastmoss` 二进制,缓存到本地后转发所有 CLI 参数。
175
-
176
- 安装时会尝试预下载当前平台二进制。如果下载失败,npm 安装仍会完成;首次运行 `fastmoss` 时会再次下载,并显示下载地址。
177
-
178
- 你可以跳过安装期下载,让首次运行时再下载:
179
-
180
- ```bash
181
- FASTMOSS_SKIP_DOWNLOAD=1 npm install -g @fastmoss/cli
182
- ```
183
-
184
- 内部调试或私有镜像可以覆盖下载地址:
185
-
186
- ```bash
187
- FASTMOSS_DOWNLOAD_BASE_URL=https://downloads.example.com/releases npx @fastmoss/cli
188
- ```
189
-
190
- ## 缓存目录
191
-
192
- 默认缓存目录:
193
-
194
- ```text
195
- ~/.fastmoss/bin/<version>/<platform>/
196
- ```
197
-
198
- 自定义缓存目录:
199
-
200
- ```bash
201
- FASTMOSS_CACHE_DIR=/custom/cache/dir npx @fastmoss/cli
202
- ```
203
-
204
- ## 支持平台
205
-
206
- - macOS `amd64`
207
- - macOS `arm64`
208
- - Linux `amd64`
209
- - Linux `arm64`
210
- - Windows `amd64`
211
-
212
- wrapper 会根据当前平台请求以下资产之一:
213
-
214
- - `fastmoss-darwin-amd64`
215
- - `fastmoss-darwin-arm64`
216
- - `fastmoss-linux-amd64`
217
- - `fastmoss-linux-arm64`
218
- - `fastmoss-windows-amd64.exe`
79
+ ## CLI Tool Catalog
80
+
81
+ ### Advertising Tools
82
+
83
+ | Tool | Description |
84
+ |---|---|
85
+ | `ad_data_overview` | Use when the user has a video_id and wants ad spend, ROAS, play, engagement, follower, and commerce performance over a date range. |
86
+ | `ad_search` | Use when the user wants active ad creatives or needs to filter ads by country, category, landing page, spend, ROAS, plays, or run days. Returns ad, creator, shop, products, and performance sections. |
87
+
88
+ ### Agency Tools
89
+
90
+ | Tool | Description |
91
+ |---|---|
92
+ | `agency_creator_analysis` | Use when the user wants agency creator structure, follower tiers, and individual collaborators. Returns distributions and a paginated creator list. |
93
+ | `agency_product_analysis` | Use for agency product-category and price-band structure. Use agency_product_list for individual products. |
94
+ | `agency_product_list` | Use when the user wants individual products promoted through an agency. Supports category, price, period, sorting, and pagination. |
95
+ | `agency_profile_overview` | Use when the user wants an agency profile, historical performance, and recent 7/28/90-day data overview. |
96
+ | `agency_rank_top` | Use when the user wants leading MCN agencies in a market. Returns weekly or monthly agency rankings and period performance. |
97
+ | `agency_search` | Use when the user has an agency name or market clue but no agency_id. Returns matching agencies and recent 7-day performance. |
98
+ | `agency_shop_analysis` | Use when the user wants agency collaborating-shop totals and individual shop performance. |
99
+
100
+ ### Creator Tools
101
+
102
+ | Tool | Description |
103
+ |---|---|
104
+ | `creator_cargo_summary` | Use when the user wants a creator video-vs-live selling split and main promoted categories. |
105
+ | `creator_data_trends` | Use when the user asks about creator follower, engagement, or commerce trends. Select field_type; returns daily series and period totals. |
106
+ | `creator_fans_distribution` | Use when the user wants to check whether a creator audience matches a target market. Returns age, gender, location, and top segments. |
107
+ | `creator_product_list` | Use when the user wants a creator showcase product list. Returns product GMV, units sold, category, price, commission, shop info, and time_range_days. |
108
+ | `creator_profile_overview` | Use when the user wants a creator snapshot or partnership check. Returns profile and performance_overview; GMV/rankings are mostly historical cumulative, so use creator_search day28_gmv for current activity. |
109
+ | `creator_rank_top_ecommerce` | Use when the user wants top ecommerce creators. Returns creator and ranking_metrics; date_value is returned as YYYY-Www for weekly rankings. |
110
+ | `creator_rank_top_growth` | Use when the user wants fast-growing creators. Returns creator and growth_metrics; date_value is returned as YYYY-Www for weekly rankings. |
111
+ | `creator_rank_top_potential` | Use when the user wants creators with ecommerce potential. Returns creator, potential_metrics, and audience_summary; date_value is returned as YYYY-Www for weekly rankings. |
112
+ | `creator_search` | Use when the user has no UID and provides a nickname, keyword, niche, or region. Returns creator, commerce_summary, and audience_summary; day28_gmv is the key current-activity metric for tiering; has_email as a boolean, not the email address itself. |
113
+ | `creator_video_analysis` | Use when the user wants creator content direction, tags, and selling videos. Returns video_tag_summary and video_list with interaction_rate_percent and linked_products so the model does not confuse video performance with product performance. |
114
+
115
+ ### Product Tools
116
+
117
+ | Tool | Description |
118
+ |---|---|
119
+ | `product_category_info` | Use when the user needs the product category tree or category levels. Prefer search_category_by_words for natural-language category terms. |
120
+ | `product_creator_analysis` | Use when the user wants who sells a product or the creator structure. Returns creator_summary with follower_tier_distribution and creator_category_distribution, plus linked_creators with creator, product_contribution, creator_cumulative_performance, and audience_summary. |
121
+ | `product_detail_info` | Use when the user wants product basics, shop, price, rating, logistics, images, or ad status. Returns product and shop; detail_url points to TikTok. |
122
+ | `product_investment` | Use when the user asks about product ads, spend, ROAS, or daily paid-traffic changes. Returns ad_performance_summary and daily_ad_performance_trend; ad_gmv is ad-attributed. |
123
+ | `product_overview` | Use when the user wants product channel attribution, lifecycle/momentum, or ad-vs-organic structure. Returns period_summary, daily_trend, ads_distribution, channel_distribution, and content_distribution. |
124
+ | `product_rank_new_listed` | Use when the user wants recently listed hot products. Returns FastMoss new-product ranking, first_3d_gmv/units_sold, and total_gmv/units_sold; new means listed within 30 days. |
125
+ | `product_rank_top_selling` | Use when the user wants bestsellers or top products. Returns period_gmv/units_sold, total_gmv/units_sold, and units_sold_growth_rate_percent. |
126
+ | `product_review_list` | Use when the user wants product reviews or buyer feedback. Returns review list and count; supports time_range_days and rating/create_time/review_id sorting. |
127
+ | `product_sales_trend` | Use when the user wants a product GMV/units trend or traction check. Returns period_summary and daily_trend with period_gmv, period_units_sold, daily_gmv, and daily_units_sold. |
128
+ | `product_search` | Use when the user has no product_id and provides a name, keyword, price band, category, bestseller clue, or new-product clue. Returns product, sales_summary, distribution_summary, and shop. |
129
+ | `product_sku` | Use when the user wants SKU sales share, inventory share, or SKU health. Returns SKU-level sales and inventory shares. |
130
+ | `product_video_list` | Use when the user wants videos selling a product, high-play videos, or paid-vs-organic video traffic. Filter with is_ad; returns GMV, plays, video_desc, and fastmoss_url. |
131
+
132
+ ### Shop Tools
133
+
134
+ | Tool | Description |
135
+ |---|---|
136
+ | `shop_base_info` | Use when the user wants a shop snapshot, store type, rating, or profile. Returns cumulative GMV/units, ranks, age, product count, and creator/video/live counts. |
137
+ | `shop_creator_analysis` | Use when the user wants shop collaborators, creator tiers, or video-vs-live selling structure. Returns creator list and distributions. |
138
+ | `shop_data_trends` | Use when the user wants recent shop GMV, units, creator, live, video, or active-product trends. Returns daily trends. |
139
+ | `shop_investment_analysis` | Use when the user asks about shop ads, spend, ROAS, ad GMV, or promoted assets. Returns ad estimates and daily changes. |
140
+ | `shop_live_analysis` | Use when the user wants shop live performance, shop-live vs affiliate-live structure, or live sessions. |
141
+ | `shop_product_analysis` | Use when the user wants shop categories, price bands, product mix, or product details. Returns distributions and product list. |
142
+ | `shop_rank_top_selling` | Use when the user wants top shops in a market or category. Returns shop ranking and ecommerce metrics. |
143
+ | `shop_sale_analysis` | Use when the user wants shop sales by short video, live, product card, creator, or self-operated channels. Returns channel_distribution and content_distribution. |
144
+ | `shop_search` | Use when the user has no seller_id and provides a shop name, keyword, or region. Returns matching shops. |
145
+ | `shop_video_analysis` | Use when the user wants shop selling videos, video performance, or ad status. |
146
+
147
+ ### Market Insight Tools
148
+
149
+ | Tool | Description |
150
+ |---|---|
151
+ | `market_category_analysis` | Use when the user wants category size, growth, competition, or opportunity. analysis_type basic_metrics returns category, scale_metrics, growth_metrics, concentration_metrics; sales_trends returns trend_series; price_distribution returns sales_price_distribution with left-open right-closed price bands and sub_category_units_sold_total. |
152
+ | `market_category_author_sales_matrix` | Use when the user wants category sales contribution by creator follower_tier. Returns creator_count, category_gmv, gmv_share_percent, units_sold, and avg_creator_gmv. |
153
+ | `market_category_ranking` | Use when the user wants category ranking, growth, or concentration. Returns ranking_scope and ranked_categories; no category_id means level-1 category ranking, and a level-1 category_id means level-2 subcategory ranking. |
154
+
155
+ ### Auxiliary and Knowledge Base Tools
156
+
157
+ | Tool | Description |
158
+ |---|---|
159
+ | `fastmoss_detail_url_examples` | Use when the AI needs FastMoss detail-page links. Takes no arguments and returns product, creator, shop, video, and live URL templates. |
160
+ | `live_detail_analysis` | Use when the user wants one live session info, creator, key performance, and category breakdown. |
161
+ | `live_products_list` | Use when the user wants products sold in a live session or high GMV/units within this live session. Returns live_units_sold, live_gmv, commission_rate_percent, sales_timeline only when pagesize <= 10, and shop_cumulative_units_sold. |
162
+ | `live_search` | Use when the user has no room_id and provides a live title, host, or shop. Returns live, creator, and performance_summary. |
163
+ | `search_category_by_words` | Use when the user knows a product/category term but does not have the category_id yet. Returns matched TikTok product category IDs and Chinese category paths. |
164
+ | `search_fastmoss_documents` | Use when the user asks about FastMoss rules, features, terms, or operations rather than real-time business data. Returns knowledge snippets and documents. |
165
+ | `video_data_trends` | Use when the user wants one video play, like, comment, or share trends. Returns daily interaction trends. |
166
+ | `video_detail_analysis` | Use when the user wants one video basics, plays, engagement, interaction rate, IPM, and linked products. |
167
+ | `video_script_info` | Use when the user wants video subtitles or line-by-line spoken copy. Returns start/end time and text; empty subtitles can fall back to video_desc. |
168
+ | `video_search` | Use when the user has no video_id and provides video keywords, title, or creator. Returns matching videos. |
169
+
170
+
171
+ 这个包只负责 CLI。需要让 Agent 知道如何、何时调用 CLI 时,请单独安装 `@fastmoss/skill`。
package/bin/fastmoss.js CHANGED
@@ -3,10 +3,15 @@
3
3
  const packageJSON = require("../package.json");
4
4
  const { runCLI } = require("../lib/runtime");
5
5
 
6
- runCLI({
7
- version: packageJSON.version,
8
- configuredDownloadBaseURL: packageJSON.fastmoss?.downloadBaseURL,
9
- }).catch((error) => {
10
- process.stderr.write(`fastmoss wrapper error: ${error.message}\n`);
11
- process.exit(1);
12
- });
6
+ runCLI({ version: packageJSON.version })
7
+ .then(({ code, signal }) => {
8
+ if (signal) {
9
+ process.kill(process.pid, signal);
10
+ return;
11
+ }
12
+ process.exitCode = code == null ? 1 : code;
13
+ })
14
+ .catch((error) => {
15
+ process.stderr.write(`fastmoss wrapper error: ${error.message}\n`);
16
+ process.exitCode = 1;
17
+ });