aiconductor-cli 1.4.0 → 1.5.1

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.
@@ -2,13 +2,13 @@
2
2
 
3
3
  const { Command } = require("commander");
4
4
  const { publishCommand } = require("../src/commands/html_publish");
5
- const {
6
- publishCommand: webpagePublishCommand,
7
- listCommand: webpageListCommand,
8
- deleteCommand: webpageDeleteCommand,
9
- } = require("../src/commands/md_publish");
10
- const { searchCommand } = require("../src/commands/web_search");
11
- const { briefingCommand } = require("../src/commands/content");
5
+ const {
6
+ publishCommand: webpagePublishCommand,
7
+ listCommand: webpageListCommand,
8
+ deleteCommand: webpageDeleteCommand,
9
+ } = require("../src/commands/md_publish");
10
+ const { searchCommand } = require("../src/commands/web_search");
11
+ const { briefingCommand } = require("../src/commands/content");
12
12
  const {
13
13
  videoInfoCommand,
14
14
  videoCommentsCommand,
@@ -18,13 +18,17 @@ const {
18
18
  videoSearchCommand,
19
19
  linkToTextCommand,
20
20
  } = require("../src/commands/douyin");
21
- const { hotListCommand: xhsHotListCommand, notePublishCommand } = require("../src/commands/xhs");
22
-
23
- const program = new Command();
24
-
25
- function collect(value, previous) {
26
- return previous ? previous.concat([value]) : [value];
27
- }
21
+ const { hotListCommand: xhsHotListCommand, notePublishCommand } = require("../src/commands/xhs");
22
+ const {
23
+ articleDataCommand: wxArticleDataCommand,
24
+ historyCommand: wxHistoryCommand,
25
+ } = require("../src/commands/wx");
26
+
27
+ const program = new Command();
28
+
29
+ function collect(value, previous) {
30
+ return previous ? previous.concat([value]) : [value];
31
+ }
28
32
 
29
33
  program
30
34
  .name("aiconductor-cli")
@@ -52,8 +56,8 @@ const webpageCmd = program
52
56
  .command("webpage")
53
57
  .description("网页发布(支持 Markdown 和 HTML)");
54
58
 
55
- webpageCmd
56
- .command("publish")
59
+ webpageCmd
60
+ .command("publish")
57
61
  .description("将 Markdown 或 HTML 发布为在线网页(自动识别类型)")
58
62
  .argument("<input>", "Markdown/HTML 文本字符串或文件路径")
59
63
  .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
@@ -61,30 +65,30 @@ webpageCmd
61
65
  .option("--type <type>", "强制指定类型:md 或 html(默认自动识别)")
62
66
  .option("--copy-button", "添加代码复制按钮(仅 Markdown 类型生效)")
63
67
  .option("-f, --format <format>", "输出格式:json 或 text", "json")
64
- .action((input, options) => {
65
- webpagePublishCommand(input, options);
66
- });
67
-
68
- webpageCmd
69
- .command("list")
70
- .description("查询当前用户已发布的网页")
71
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
72
- .option("--page <page>", "页码,最小为 1", "1")
73
- .option("--page-size <size>", "每页条数,范围为 1 到 100", "20")
74
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
75
- .action((options) => {
76
- webpageListCommand(options);
77
- });
78
-
79
- webpageCmd
80
- .command("delete")
81
- .description("删除当前用户指定的已发布网页")
82
- .argument("<webpage_id>", "网页记录 ID,可通过 webpage list 获取")
83
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
84
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
85
- .action((webpageId, options) => {
86
- webpageDeleteCommand(webpageId, options);
87
- });
68
+ .action((input, options) => {
69
+ webpagePublishCommand(input, options);
70
+ });
71
+
72
+ webpageCmd
73
+ .command("list")
74
+ .description("查询当前用户已发布的网页")
75
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
76
+ .option("--page <page>", "页码,最小为 1", "1")
77
+ .option("--page-size <size>", "每页条数,范围为 1 到 100", "20")
78
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
79
+ .action((options) => {
80
+ webpageListCommand(options);
81
+ });
82
+
83
+ webpageCmd
84
+ .command("delete")
85
+ .description("删除当前用户指定的已发布网页")
86
+ .argument("<webpage_id>", "网页记录 ID,可通过 webpage list 获取")
87
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
88
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
89
+ .action((webpageId, options) => {
90
+ webpageDeleteCommand(webpageId, options);
91
+ });
88
92
 
89
93
  // search 子命令组
90
94
  const searchCmd = program
@@ -96,54 +100,54 @@ searchCmd
96
100
  .description("网页搜索")
97
101
  .argument("<query>", "搜索关键词(1~100字符)")
98
102
  .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
99
- .option("-n, --count <n>", "返回条数(最多50)")
100
- .option("--time-range <range>", "时间范围:OneDay/OneWeek/OneMonth/OneYear 或 YYYY-MM-DD..YYYY-MM-DD")
101
- .option("--need-content", "仅返回包含正文的结果")
102
- .option("--need-url", "仅返回带原文链接的结果")
103
- .option("--sites <domains>", "限定搜索站点,完整域名以 | 分隔,最多20个")
104
- .option("--block-hosts <domains>", "屏蔽站点,完整域名以 | 分隔,最多5个")
105
- .option("--auth-info-level <level>", "权威度过滤:0=不限制,1=仅非常权威内容")
106
- .option("--auth-level <level>", "兼容别名,等同 --auth-info-level")
107
- .option("--content-format <format>", "正文格式:text 或 markdown", "text")
108
- .option("--industry <type>", "行业搜索:finance、game 或 gov")
109
- .option("--query-rewrite", "开启 Query 改写")
103
+ .option("-n, --count <n>", "返回条数(最多50)")
104
+ .option("--time-range <range>", "时间范围:OneDay/OneWeek/OneMonth/OneYear 或 YYYY-MM-DD..YYYY-MM-DD")
105
+ .option("--need-content", "仅返回包含正文的结果")
106
+ .option("--need-url", "仅返回带原文链接的结果")
107
+ .option("--sites <domains>", "限定搜索站点,完整域名以 | 分隔,最多20个")
108
+ .option("--block-hosts <domains>", "屏蔽站点,完整域名以 | 分隔,最多5个")
109
+ .option("--auth-info-level <level>", "权威度过滤:0=不限制,1=仅非常权威内容")
110
+ .option("--auth-level <level>", "兼容别名,等同 --auth-info-level")
111
+ .option("--content-format <format>", "正文格式:text 或 markdown", "text")
112
+ .option("--industry <type>", "行业搜索:finance、game 或 gov")
113
+ .option("--query-rewrite", "开启 Query 改写")
110
114
  .option("-f, --format <format>", "输出格式:json 或 text", "json")
111
115
  .action((query, options) => {
112
116
  searchCommand(query, "web", options);
113
117
  });
114
118
 
115
- searchCmd
116
- .command("image")
119
+ searchCmd
120
+ .command("image")
117
121
  .description("图片搜索")
118
122
  .argument("<query>", "搜索关键词(1~100字符)")
119
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
120
- .option("-n, --count <n>", "返回条数(最多5)")
121
- .option("--image-width-min <px>", "图片最小宽度")
122
- .option("--image-width-max <px>", "图片最大宽度")
123
- .option("--image-height-min <px>", "图片最小高度")
124
- .option("--image-height-max <px>", "图片最大高度")
125
- .option("--image-shapes <shapes>", "图片形状,以 | 分隔:横长方形、竖长方形、方形")
126
- .option("--query-rewrite", "开启 Query 改写")
123
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
124
+ .option("-n, --count <n>", "返回条数(最多5)")
125
+ .option("--image-width-min <px>", "图片最小宽度")
126
+ .option("--image-width-max <px>", "图片最大宽度")
127
+ .option("--image-height-min <px>", "图片最小高度")
128
+ .option("--image-height-max <px>", "图片最大高度")
129
+ .option("--image-shapes <shapes>", "图片形状,以 | 分隔:横长方形、竖长方形、方形")
130
+ .option("--query-rewrite", "开启 Query 改写")
131
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
132
+ .action((query, options) => {
133
+ searchCommand(query, "image", options);
134
+ });
135
+
136
+ // content 子命令组
137
+ const contentCmd = program
138
+ .command("content")
139
+ .description("内容选题与素材工具");
140
+
141
+ contentCmd
142
+ .command("briefing")
143
+ .description("聚合多平台热点与小红书热榜,生成选题原料")
144
+ .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
145
+ .option("--sources <ids>", "来源 ID,逗号分隔;默认 zhihu,weibo,douyin,aihot")
146
+ .option("--limit <n>", "每个来源返回条数,范围 1 到 30", "30")
127
147
  .option("-f, --format <format>", "输出格式:json 或 text", "json")
128
- .action((query, options) => {
129
- searchCommand(query, "image", options);
130
- });
131
-
132
- // content 子命令组
133
- const contentCmd = program
134
- .command("content")
135
- .description("内容选题与素材工具");
136
-
137
- contentCmd
138
- .command("briefing")
139
- .description("聚合多平台热点与小红书热榜,生成选题原料")
140
- .option("-k, --api-key <key>", "AIConductor API Key(也可通过 AICONDUCTOR_API_KEY 环境变量或 .env 文件提供)")
141
- .option("--sources <ids>", "来源 ID,逗号分隔;默认 zhihu,weibo,douyin,aihot")
142
- .option("--limit <n>", "每个来源返回条数,范围 1 到 30", "30")
143
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
144
- .action((options) => {
145
- briefingCommand(options);
146
- });
148
+ .action((options) => {
149
+ briefingCommand(options);
150
+ });
147
151
 
148
152
  // 未知命令处理
149
153
 
@@ -222,37 +226,61 @@ douyinCmd
222
226
  .action((videoUrl, options) => { linkToTextCommand(videoUrl, options); });
223
227
 
224
228
  // xhs 子命令组
225
- const xhsCmd = program
226
- .command("xhs")
227
- .description("小红书数据工具箱");
228
-
229
- xhsCmd
230
- .command("hot-list")
231
- .description("获取小红书实时热榜")
232
- .option("-k, --api-key <key>", "AIConductor API Key")
233
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
234
- .action((options) => { xhsHotListCommand(options); });
235
-
236
- xhsCmd
229
+ const xhsCmd = program
230
+ .command("xhs")
231
+ .description("小红书数据工具箱");
232
+
233
+ xhsCmd
234
+ .command("hot-list")
235
+ .description("获取小红书实时热榜")
236
+ .option("-k, --api-key <key>", "AIConductor API Key")
237
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
238
+ .action((options) => { xhsHotListCommand(options); });
239
+
240
+ xhsCmd
237
241
  .command("note-publish")
238
- .description("生成小红书扫码发布页与二维码(0.05元/次)")
242
+ .description("生成小红书扫码发布页与二维码(0.05元/次)")
239
243
  .argument("<type>", "笔记类型:normal(图文)或 video(视频)")
240
244
  .option("-k, --api-key <key>", "AIConductor API Key")
241
- .option("-t, --title <title>", "笔记标题(最多20字符)")
242
- .option("--content <text>", "笔记正文(最多1000字符)")
243
- .option("--images <urls>", "图片公网URL列表,逗号分隔(normal类型,最多18张)")
244
- .option("--image-file <path>", "本地图片路径,可重复使用(normal类型,最多18张)", collect)
245
- .option("--image-base64 <data>", "图片Base64/data URL/@文本文件,可重复使用", collect)
246
- .option("--video <url>", "视频公网URL(与--video-file、--video-base64三选一)")
247
- .option("--video-file <path>", "本地视频路径(与--video、--video-base64三选一)")
248
- .option("--video-base64 <data>", "视频Base64/data URL/@文本文件(与其他视频来源三选一)")
249
- .option("--cover <url>", "视频封面图公网URL(与其他封面来源三选一)")
250
- .option("--cover-file <path>", "本地视频封面路径(仅video类型有效)")
251
- .option("--cover-base64 <data>", "视频封面Base64/data URL/@文本文件(仅video类型)")
252
- .option("--upload-valid-days <days>", "本地/Base64素材临时链接有效期:1或7天", "7")
253
- .option("-f, --format <format>", "输出格式:json 或 text", "json")
245
+ .option("-t, --title <title>", "笔记标题(最多20字符)")
246
+ .option("--content <text>", "笔记正文(最多1000字符)")
247
+ .option("--images <urls>", "图片公网URL列表,逗号分隔(normal类型,最多18张)")
248
+ .option("--image-file <path>", "本地图片路径,可重复使用(normal类型,最多18张)", collect)
249
+ .option("--image-base64 <data>", "图片Base64/data URL/@文本文件,可重复使用", collect)
250
+ .option("--video <url>", "视频公网URL(与--video-file、--video-base64三选一)")
251
+ .option("--video-file <path>", "本地视频路径(与--video、--video-base64三选一)")
252
+ .option("--video-base64 <data>", "视频Base64/data URL/@文本文件(与其他视频来源三选一)")
253
+ .option("--cover <url>", "视频封面图公网URL(与其他封面来源三选一)")
254
+ .option("--cover-file <path>", "本地视频封面路径(仅video类型有效)")
255
+ .option("--cover-base64 <data>", "视频封面Base64/data URL/@文本文件(仅video类型)")
256
+ .option("--upload-valid-days <days>", "本地/Base64素材临时链接有效期:1或7天", "7")
257
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
254
258
  .action((type, options) => { notePublishCommand(type, options); });
255
259
 
260
+ // wx 子命令组(公众号数据)
261
+ const wxCmd = program
262
+ .command("wx")
263
+ .description("微信公众号数据工具箱");
264
+
265
+ wxCmd
266
+ .command("article-data")
267
+ .description("获取公众号文章互动数据(按次计费)")
268
+ .argument("<url>", "微信文章链接")
269
+ .option("-k, --api-key <key>", "AIConductor API Key")
270
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
271
+ .action((url, options) => { wxArticleDataCommand(url, options); });
272
+
273
+ wxCmd
274
+ .command("history")
275
+ .description("获取公众号历史文章列表(按成功翻页次数计费)")
276
+ .argument("[url]", "微信文章链接(用于定位公众号)")
277
+ .option("-k, --api-key <key>", "AIConductor API Key")
278
+ .option("--name <name>", "公众号名称或微信 ID(与 url 至少提供一个)")
279
+ .option("--max-pages <n>", "最大翻页数量", "1")
280
+ .option("--max-seconds <n>", "最长运行时间(秒),最大 170", "50")
281
+ .option("-f, --format <format>", "输出格式:json 或 text", "json")
282
+ .action((url, options) => { wxHistoryCommand(url, options); });
283
+
256
284
  // 未知命令处理
257
285
  program.on("command:*", () => {
258
286
  console.error(`未知命令: ${program.args.join(" ")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiconductor-cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "AIConductor CLI 工具箱",
5
5
  "keywords": [
6
6
  "aiconductor",