@ai-welopc/cli 0.1.2
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/LICENSE +21 -0
- package/README.md +43 -0
- package/bin/welopc.js +60 -0
- package/package.json +43 -0
- package/src/packs.mjs +164 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WelOPC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @ai-welopc/cli
|
|
2
|
+
|
|
3
|
+
WelOPC scenario pack installer for OpenClaw and agent workflows.
|
|
4
|
+
|
|
5
|
+
## Install Scenario Packs
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @ai-welopc/cli add opc-content-factory
|
|
9
|
+
npx @ai-welopc/cli add opc-aihot
|
|
10
|
+
npx @ai-welopc/cli add opc-selfmedia
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Content factory creates:
|
|
14
|
+
|
|
15
|
+
- `.welopc/packs/opc-content-factory.json`
|
|
16
|
+
- `WELOPC_OPC_CONTENT_FACTORY.md`
|
|
17
|
+
|
|
18
|
+
AIHOT creates:
|
|
19
|
+
|
|
20
|
+
- `.welopc/packs/opc-aihot.json`
|
|
21
|
+
- `WELOPC_OPC_AIHOT.md`
|
|
22
|
+
|
|
23
|
+
Self-media OPC creates:
|
|
24
|
+
|
|
25
|
+
- `.welopc/packs/opc-selfmedia.json`
|
|
26
|
+
- `WELOPC_OPC_SELFMEDIA.md`
|
|
27
|
+
|
|
28
|
+
The AIHOT scenario pack connects agents to WelOPC AIHOT:
|
|
29
|
+
|
|
30
|
+
- AI热点雷达读取
|
|
31
|
+
- 趋势判断与归纳
|
|
32
|
+
- 日报周报生成
|
|
33
|
+
- 选题引用与素材沉淀
|
|
34
|
+
|
|
35
|
+
The self-media OPC scenario pack connects agents to:
|
|
36
|
+
|
|
37
|
+
- 热点输入
|
|
38
|
+
- 关键词追踪
|
|
39
|
+
- 竞品拆解
|
|
40
|
+
- 改写产出
|
|
41
|
+
- 复盘回填
|
|
42
|
+
|
|
43
|
+
Docs: https://welopc.com/ai-hot/agent/
|
package/bin/welopc.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { installPack, listPacks } from "../src/packs.mjs";
|
|
3
|
+
|
|
4
|
+
function printHelp() {
|
|
5
|
+
const availablePacks = listPacks()
|
|
6
|
+
.map((pack) => ` ${pack.name} ${pack.title}`)
|
|
7
|
+
.join("\n");
|
|
8
|
+
|
|
9
|
+
console.log(`WelOPC CLI
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
welopc list
|
|
13
|
+
welopc add <pack>
|
|
14
|
+
|
|
15
|
+
Available now:
|
|
16
|
+
${availablePacks}
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
npx @ai-welopc/cli list
|
|
20
|
+
npx @ai-welopc/cli add opc-content-factory
|
|
21
|
+
npx @ai-welopc/cli add opc-aihot
|
|
22
|
+
npx @ai-welopc/cli add opc-selfmedia
|
|
23
|
+
`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
const [, , command, arg] = process.argv;
|
|
28
|
+
|
|
29
|
+
if (!command || command === "--help" || command === "-h") {
|
|
30
|
+
printHelp();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (command === "list") {
|
|
35
|
+
for (const pack of listPacks()) {
|
|
36
|
+
console.log(`${pack.name}\t${pack.title}\t${pack.description}`);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (command === "add") {
|
|
42
|
+
if (!arg) {
|
|
43
|
+
throw new Error("Missing pack name. Example: welopc add opc-aihot");
|
|
44
|
+
}
|
|
45
|
+
const result = await installPack(arg);
|
|
46
|
+
console.log(`Installed ${result.pack.name}: ${result.pack.title}`);
|
|
47
|
+
for (const file of result.files) {
|
|
48
|
+
console.log(`- ${file}`);
|
|
49
|
+
}
|
|
50
|
+
console.log(`Docs: ${result.pack.homepage}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
throw new Error(`Unknown command: ${command}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
main().catch((error) => {
|
|
58
|
+
console.error(`Error: ${error.message}`);
|
|
59
|
+
process.exitCode = 1;
|
|
60
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ai-welopc/cli",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "WelOPC scenario pack installer for OpenClaw and agent workflows.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"cli": "bin/welopc.js",
|
|
8
|
+
"welopc": "bin/welopc.js",
|
|
9
|
+
"welopc-cli": "bin/welopc.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"src/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "node --test test/cli.test.mjs"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"welopc",
|
|
22
|
+
"openclaw",
|
|
23
|
+
"agent",
|
|
24
|
+
"scenario-pack",
|
|
25
|
+
"aihot",
|
|
26
|
+
"selfmedia",
|
|
27
|
+
"opc"
|
|
28
|
+
],
|
|
29
|
+
"author": "WelOPC",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"homepage": "https://welopc.com",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/welopc/cli.git"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"registry": "https://registry.npmjs.org/"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/packs.mjs
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
const API_BASE = "https://welopc.com/ai-hot/api/public";
|
|
5
|
+
|
|
6
|
+
const PACKS = [
|
|
7
|
+
{
|
|
8
|
+
name: "opc-content-factory",
|
|
9
|
+
title: "OPC 内容工厂",
|
|
10
|
+
command: "npx @ai-welopc/cli add opc-content-factory",
|
|
11
|
+
directCommand: "npx @ai-welopc/opc-content-factory init \"女装带货 OPC 文章\" --root ./articles",
|
|
12
|
+
packageName: "@ai-welopc/opc-content-factory",
|
|
13
|
+
guideFile: "WELOPC_OPC_CONTENT_FACTORY.md",
|
|
14
|
+
homepage: "https://welopc.com/",
|
|
15
|
+
apiBase: API_BASE,
|
|
16
|
+
sourceSkill: "opc-content-factory",
|
|
17
|
+
description: "把公众号链接、商品图、工作流 demo 或文章截图拆解成可发布的图文内容包,生成 HTML 审稿页、配图提示词和公众号草稿箱导入准备文件。",
|
|
18
|
+
capabilities: [
|
|
19
|
+
"公众号链接自动提取",
|
|
20
|
+
"图片理解与提示词反推",
|
|
21
|
+
"公众号格式与内容框架",
|
|
22
|
+
"文章配图脚本",
|
|
23
|
+
"HTML 主交付",
|
|
24
|
+
"公众号草稿箱 dry-run"
|
|
25
|
+
],
|
|
26
|
+
scripts: [
|
|
27
|
+
"npx @ai-welopc/opc-content-factory init \"女装带货 OPC 文章\" --root ./articles",
|
|
28
|
+
"npx @ai-welopc/opc-content-factory extract \"https://mp.weixin.qq.com/s/...\" --out ./articles/demo/source",
|
|
29
|
+
"npx @ai-welopc/opc-content-factory push-draft --title \"标题\" --digest \"摘要\" --html-file ./wechat_draft.html --cover-image ./cover.png --out ./draft/wechat_draft_payload.json"
|
|
30
|
+
],
|
|
31
|
+
usageNotes: [
|
|
32
|
+
"默认以 HTML 审稿页作为主交付,Markdown 只作为辅助归档。",
|
|
33
|
+
"公众号链接应先自动提取正文、图片和元数据,再进入图片理解与提示词反推。",
|
|
34
|
+
"草稿箱接口只做 dry-run 或创建草稿,不自动发布、不群发。",
|
|
35
|
+
"公开内容避免输出密钥、Cookie、token、水印和真实第三方 logo。"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "opc-aihot",
|
|
40
|
+
title: "AI资讯情报",
|
|
41
|
+
command: "npx @ai-welopc/cli add opc-aihot",
|
|
42
|
+
guideFile: "WELOPC_OPC_AIHOT.md",
|
|
43
|
+
homepage: "https://welopc.com/ai-hot/agent/",
|
|
44
|
+
apiBase: API_BASE,
|
|
45
|
+
description: "接入 WelOPC AIHOT 热点雷达,用于 AI资讯、趋势判断、日报周报、选题引用和 Agent 情报。",
|
|
46
|
+
capabilities: [
|
|
47
|
+
"AI热点雷达读取",
|
|
48
|
+
"趋势判断与归纳",
|
|
49
|
+
"日报周报生成",
|
|
50
|
+
"选题引用与素材沉淀"
|
|
51
|
+
],
|
|
52
|
+
scripts: [
|
|
53
|
+
"python scripts/latest.py --channel all --mode selected --limit 10 --format markdown",
|
|
54
|
+
"python scripts/daily.py --format markdown",
|
|
55
|
+
"python scripts/search.py \"Claude Code\" --channel all --mode all --limit 20 --format json",
|
|
56
|
+
"python scripts/stats.py --format json"
|
|
57
|
+
],
|
|
58
|
+
usageNotes: [
|
|
59
|
+
"Treat AIHOT as a content capability source, not a complete market database.",
|
|
60
|
+
"Prefer selected/high-signal results by default.",
|
|
61
|
+
"Keep source URLs and timestamps when generating reports, topics, or trend judgments."
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "opc-selfmedia",
|
|
66
|
+
title: "自媒体 OPC 运营工作台",
|
|
67
|
+
command: "npx @ai-welopc/cli add opc-selfmedia",
|
|
68
|
+
guideFile: "WELOPC_OPC_SELFMEDIA.md",
|
|
69
|
+
homepage: "https://welopc.com/",
|
|
70
|
+
apiBase: API_BASE,
|
|
71
|
+
sourceSkill: "welopc-self-media-opc-skill",
|
|
72
|
+
description: "把自媒体运营中重复的选题、关键词追踪、竞品拆解、改写产出和发布复盘组织成一套 Agent 可执行的 OPC 工作台。",
|
|
73
|
+
capabilities: [
|
|
74
|
+
"热点输入",
|
|
75
|
+
"关键词追踪",
|
|
76
|
+
"竞品拆解",
|
|
77
|
+
"改写产出",
|
|
78
|
+
"复盘回填",
|
|
79
|
+
"视频化路由"
|
|
80
|
+
],
|
|
81
|
+
scripts: [
|
|
82
|
+
"python scripts/latest.py --channel opcSolo --mode selected --limit 10 --format markdown",
|
|
83
|
+
"python scripts/search.py \"OPC\" --channel all --mode all --limit 20 --format json",
|
|
84
|
+
"python scripts/daily.py --format markdown",
|
|
85
|
+
"python scripts/stats.py --format json"
|
|
86
|
+
],
|
|
87
|
+
usageNotes: [
|
|
88
|
+
"先固定关键词、时间窗和平台类型,再让 Agent 执行选题判断。",
|
|
89
|
+
"把标题、封面、首屏、评论区和账号主页作为现场证据,不只看指标表格。",
|
|
90
|
+
"每次发布后回填开头、评论需求词和下一轮修改点,让复盘结果进入下一轮输入。",
|
|
91
|
+
"AIHOT 可作为趋势层补充,TikHub 或平台数据可作为近端平台层输入。"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
export function listPacks() {
|
|
97
|
+
return PACKS.map((pack) => ({ ...pack, capabilities: [...pack.capabilities], scripts: [...pack.scripts] }));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function findPack(name) {
|
|
101
|
+
return listPacks().find((pack) => pack.name === name);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function packManifest(pack) {
|
|
105
|
+
return {
|
|
106
|
+
name: pack.name,
|
|
107
|
+
title: pack.title,
|
|
108
|
+
command: pack.command,
|
|
109
|
+
directCommand: pack.directCommand,
|
|
110
|
+
packageName: pack.packageName,
|
|
111
|
+
description: pack.description,
|
|
112
|
+
homepage: pack.homepage,
|
|
113
|
+
apiBase: pack.apiBase,
|
|
114
|
+
sourceSkill: pack.sourceSkill,
|
|
115
|
+
capabilities: pack.capabilities,
|
|
116
|
+
scripts: pack.scripts,
|
|
117
|
+
installedAt: new Date().toISOString()
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function packGuide(pack) {
|
|
122
|
+
return `# ${pack.title} (${pack.name})
|
|
123
|
+
|
|
124
|
+
${pack.description}
|
|
125
|
+
|
|
126
|
+
## Public API
|
|
127
|
+
|
|
128
|
+
- Base: ${pack.apiBase}
|
|
129
|
+
- Agent docs: ${pack.homepage}
|
|
130
|
+
|
|
131
|
+
## Capabilities
|
|
132
|
+
|
|
133
|
+
${pack.capabilities.map((item) => `- ${item}`).join("\n")}
|
|
134
|
+
|
|
135
|
+
## Suggested Agent Commands
|
|
136
|
+
|
|
137
|
+
${pack.scripts.map((item) => `\`\`\`bash\n${item}\n\`\`\``).join("\n\n")}
|
|
138
|
+
|
|
139
|
+
## Usage Notes
|
|
140
|
+
|
|
141
|
+
${pack.usageNotes.map((item) => `- ${item}`).join("\n")}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export async function installPack(name, options = {}) {
|
|
146
|
+
const pack = findPack(name);
|
|
147
|
+
if (!pack) {
|
|
148
|
+
throw new Error(`Unknown WelOPC scenario pack: ${name}`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const cwd = options.cwd || process.cwd();
|
|
152
|
+
const packDir = path.join(cwd, ".welopc", "packs");
|
|
153
|
+
const manifestPath = path.join(packDir, `${pack.name}.json`);
|
|
154
|
+
const guidePath = path.join(cwd, pack.guideFile);
|
|
155
|
+
|
|
156
|
+
await mkdir(packDir, { recursive: true });
|
|
157
|
+
await writeFile(manifestPath, `${JSON.stringify(packManifest(pack), null, 2)}\n`, "utf8");
|
|
158
|
+
await writeFile(guidePath, packGuide(pack), "utf8");
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
pack,
|
|
162
|
+
files: [manifestPath, guidePath]
|
|
163
|
+
};
|
|
164
|
+
}
|