insightcrm 0.1.3 → 0.1.6
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.md +3 -0
- package/SKILL.md +26 -5
- package/dist/cli.js +568 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,9 @@ npm i -g insightcrm # 得到 insightcrm 和 crm 两个命令(crm 是别
|
|
|
9
9
|
crm login https://<你的服务器> # 浏览器里点「允许」(设备码登录)
|
|
10
10
|
crm schema --json # 字段契约,含每个字段的填写指引
|
|
11
11
|
echo '{"name":"王小明","company":"ACME"}' | crm add - --json
|
|
12
|
+
crm add --name "王小明" --social channels:@wm email:wm@example.com # 视频号 / 小红书 / 邮箱等社交账号
|
|
13
|
+
crm add --name "王小明" --relationship 学员 社群成员 # 他在你这里是什么身份(可多个)
|
|
14
|
+
crm list --relationship 甲方 --json # 甲方名单
|
|
12
15
|
crm list --due-today --json
|
|
13
16
|
crm version # 当前版本 + npm 上有没有新版
|
|
14
17
|
crm skill # 打印给 agent 的使用说明;在 agent 指令里加一句「先运行 crm skill」
|
package/SKILL.md
CHANGED
|
@@ -37,6 +37,7 @@ crm login https://<服务器地址>
|
|
|
37
37
|
## 怎么从材料里抽取
|
|
38
38
|
|
|
39
39
|
**身份与联系**:`name`、`company`、`title`;`wechatId`、`city`。只填材料里明确出现的。看不到就省略,不要猜。
|
|
40
|
+
`city` 取 `crm schema --json` 里 `city` 字段的 `values`(城市枚举);写成「上海市」「Shanghai」「臺北」也会被自动归一化成「上海」「上海」「台北」,所以直接按你看到的写就行。
|
|
40
41
|
|
|
41
42
|
**画像**:
|
|
42
43
|
- `painPoints`:痛点和兴趣标签,每条几个字。
|
|
@@ -45,14 +46,28 @@ crm login https://<服务器地址>
|
|
|
45
46
|
- `conversionPotential`:`High` / `Medium` / `Low`。综合痛点的紧迫度、预算信号、对方的决策角色来判断,拿不准填 `Medium`。
|
|
46
47
|
- `conversionCycleDays`:预估的转化黄金窗口(天)。信号越弱越长,信号明确可以短到 7–14 天。
|
|
47
48
|
|
|
49
|
+
**社交账号 `socials`**:客户在其他平台上的号——视频号、小红书、邮箱、抖音、B站、公众号等。
|
|
50
|
+
- 元素形如 `{"platform":"channels","handle":"@san三"}`。`platform` 直接写中文也行(`视频号`、`小红书`、`邮箱`),会自动归一化到标准值。
|
|
51
|
+
- **微信不要放这里**,微信号统一写 `wechatId`。
|
|
52
|
+
- 有主页链接就补 `"url"`,没有就省略,不要猜。
|
|
53
|
+
- 材料里没出现就整条省略,**不要编造**。邮箱也是:只在材料里明确写了邮箱才填。
|
|
54
|
+
- 命令行写法:`--social channels:@san三 email:zhang@example.com`(平台:账号)。
|
|
55
|
+
|
|
56
|
+
**关系 `relationships`**:这个人在我这里是什么身份——甲方 / 渠道方 / 学员 / 社群成员……
|
|
57
|
+
- **可以同时多个**,按重要性从高到低(第一个是当前最主要的关系)。写中文就行(`甲方`、`学员`、`渠道方`),会自动归一化;也可以写英文键(`client`、`student`、`channel`)。
|
|
58
|
+
- 常见路径:潜客 → 意向学员 → 学员 → 校友 → 意向甲方 → 甲方。
|
|
59
|
+
- **微信标签里写明的身份最硬**(「AI编程 N23 期学员」就是学员)。注意区分:职位(产品经理、老师)不是关系,别混进 `title` 和 `relationships`。
|
|
60
|
+
- 转化了**追加**新关系,别删旧的——学员变甲方,两个都留着,路径才追得回。
|
|
61
|
+
- 没有依据就留空,不要编。命令行写法:`--relationship 学员 甲方`。
|
|
62
|
+
|
|
48
63
|
**日程 `upcomingEvents`**:`{title, date, type}` 的数组,`date` 是 `YYYY-MM-DD`,`type` 是 `meeting` / `follow_up` / `deadline` / `other`。
|
|
49
64
|
- 今天是几号要自己确认,相对日期(「下周三」)按今天换算成具体日期。
|
|
50
65
|
- **已经过去的日期不要录**。
|
|
51
66
|
- 没有明确日期的约定不要编日期。
|
|
52
67
|
|
|
53
68
|
**按材料类型**:
|
|
54
|
-
- **朋友圈 / 社交平台截图**:重点抽**兴趣和需求**,写进 `painPoints` 和 `summary`。
|
|
55
|
-
- **名片**:重点是身份(`name` / `company` / `title
|
|
69
|
+
- **朋友圈 / 社交平台截图**:重点抽**兴趣和需求**,写进 `painPoints` 和 `summary`;截图里露出的账号信息(小红书号、抖音号、邮箱)写进 `socials`。
|
|
70
|
+
- **名片**:重点是身份(`name` / `company` / `title`),名片上的邮箱写进 `socials`(`platform` 用 `email`)。
|
|
56
71
|
- **聊天记录**:除了画像,还要找**钩子**(见下)。
|
|
57
72
|
|
|
58
73
|
## 成功钩子
|
|
@@ -71,12 +86,14 @@ crm login https://<服务器地址>
|
|
|
71
86
|
|
|
72
87
|
| 想做的事 | 用 |
|
|
73
88
|
|---|---|
|
|
74
|
-
| 在已有基础上**追加**标签 / 目标 / 日程 | `--add-pain` / `--add-goal` / `--add-event` |
|
|
75
|
-
| **整体替换**整个列表 | `--pain` / `--goal` / `--event`,或 JSON 里直接传数组 |
|
|
89
|
+
| 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` |
|
|
90
|
+
| **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship`,或 JSON 里直接传数组 |
|
|
76
91
|
| 清空日程 | `--clear-events` |
|
|
77
92
|
|
|
78
93
|
`upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。
|
|
79
94
|
|
|
95
|
+
`socials` 同理:传了就是**整体替换**。只想补一个号,用 `--add-social channels:@san三`。
|
|
96
|
+
|
|
80
97
|
`summary` 是对这个客户的整体描述。合并新材料时,是在原有摘要上补充,不是整段覆盖掉已有的信息:先 `crm get <id> --json` 读出旧内容再写。
|
|
81
98
|
|
|
82
99
|
## 查询
|
|
@@ -85,7 +102,9 @@ crm login https://<服务器地址>
|
|
|
85
102
|
crm list --potential high --city 北京 --json # 按等级、城市、标签筛选
|
|
86
103
|
crm list --due-today --json # 今天有日程的客户(今天要联系谁)
|
|
87
104
|
crm list --due 2026-10-20 --json
|
|
88
|
-
crm list -q 跨境 --json #
|
|
105
|
+
crm list -q 跨境 --json # 关键词:姓名、公司、职位、城市、微信、社交账号、摘要、备注、标签、目标
|
|
106
|
+
crm list --social-platform xiaohongshu --json # 有小红书账号的客户
|
|
107
|
+
crm list --relationship 甲方 --json # 甲方名单(写 client 一样命中)
|
|
89
108
|
crm get <id> --json
|
|
90
109
|
```
|
|
91
110
|
|
|
@@ -117,6 +136,8 @@ crm prompts show gift --customer <id> --json # --json 里带上 customer 档
|
|
|
117
136
|
|
|
118
137
|
内置的任务模板:`draft`(起草消息)、`gift`(送礼策略)、`starters`(社交破冰)、`advice`(关系升温)。用户让你「给王小明起草一条消息」「想想送什么礼物」这类事时,先 `show` 对应模板再照着做;模板里带 `[请补充]` 的地方要向用户问清楚或自己补全。
|
|
119
138
|
|
|
139
|
+
可用占位符:`{{name}}` `{{company}}` `{{title}}` `{{city}}` `{{wechatId}}` `{{socials}}`(社交账号,渲染成「视频号: @san3, 邮箱: san@example.com」这样的一行)。
|
|
140
|
+
|
|
120
141
|
用户想改模板时:
|
|
121
142
|
|
|
122
143
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -17,6 +17,154 @@ import { Command, Option } from "commander";
|
|
|
17
17
|
var CONVERSION_POTENTIALS = ["High", "Medium", "Low"];
|
|
18
18
|
var EVENT_TYPES = ["meeting", "follow_up", "deadline", "other"];
|
|
19
19
|
var RECOMMENDATION_TYPES = ["Article", "Product", "Service", "Event"];
|
|
20
|
+
var CITIES = [
|
|
21
|
+
// 一线 / 新一线
|
|
22
|
+
"\u4E0A\u6D77",
|
|
23
|
+
"\u5317\u4EAC",
|
|
24
|
+
"\u6DF1\u5733",
|
|
25
|
+
"\u5E7F\u5DDE",
|
|
26
|
+
"\u676D\u5DDE",
|
|
27
|
+
"\u6210\u90FD",
|
|
28
|
+
"\u91CD\u5E86",
|
|
29
|
+
"\u82CF\u5DDE",
|
|
30
|
+
"\u6B66\u6C49",
|
|
31
|
+
"\u897F\u5B89",
|
|
32
|
+
"\u5357\u4EAC",
|
|
33
|
+
"\u5929\u6D25",
|
|
34
|
+
"\u90D1\u5DDE",
|
|
35
|
+
"\u957F\u6C99",
|
|
36
|
+
"\u9752\u5C9B",
|
|
37
|
+
"\u4E1C\u839E",
|
|
38
|
+
"\u5408\u80A5",
|
|
39
|
+
// 省会 / 区域中心
|
|
40
|
+
"\u798F\u5DDE",
|
|
41
|
+
"\u53A6\u95E8",
|
|
42
|
+
"\u6D4E\u5357",
|
|
43
|
+
"\u6C88\u9633",
|
|
44
|
+
"\u5927\u8FDE",
|
|
45
|
+
"\u957F\u6625",
|
|
46
|
+
"\u54C8\u5C14\u6EE8",
|
|
47
|
+
"\u77F3\u5BB6\u5E84",
|
|
48
|
+
"\u592A\u539F",
|
|
49
|
+
"\u5357\u660C",
|
|
50
|
+
"\u6606\u660E",
|
|
51
|
+
"\u8D35\u9633",
|
|
52
|
+
"\u5357\u5B81",
|
|
53
|
+
"\u5170\u5DDE",
|
|
54
|
+
"\u4E4C\u9C81\u6728\u9F50",
|
|
55
|
+
"\u547C\u548C\u6D69\u7279",
|
|
56
|
+
"\u94F6\u5DDD",
|
|
57
|
+
"\u897F\u5B81",
|
|
58
|
+
"\u6D77\u53E3",
|
|
59
|
+
"\u62C9\u8428",
|
|
60
|
+
// 强二线 / 主要地级市
|
|
61
|
+
"\u5B81\u6CE2",
|
|
62
|
+
"\u4F5B\u5C71",
|
|
63
|
+
"\u6E29\u5DDE",
|
|
64
|
+
"\u65E0\u9521",
|
|
65
|
+
"\u5E38\u5DDE",
|
|
66
|
+
"\u5357\u901A",
|
|
67
|
+
"\u5609\u5174",
|
|
68
|
+
"\u7ECD\u5174",
|
|
69
|
+
"\u91D1\u534E",
|
|
70
|
+
"\u53F0\u5DDE",
|
|
71
|
+
"\u6CC9\u5DDE",
|
|
72
|
+
"\u5F90\u5DDE",
|
|
73
|
+
"\u626C\u5DDE",
|
|
74
|
+
"\u60E0\u5DDE",
|
|
75
|
+
"\u73E0\u6D77",
|
|
76
|
+
"\u4E2D\u5C71",
|
|
77
|
+
"\u6C55\u5934",
|
|
78
|
+
"\u6D1B\u9633",
|
|
79
|
+
"\u8944\u9633",
|
|
80
|
+
"\u6842\u6797",
|
|
81
|
+
"\u67F3\u5DDE",
|
|
82
|
+
"\u682A\u6D32",
|
|
83
|
+
"\u5CB3\u9633",
|
|
84
|
+
"\u5B9C\u660C",
|
|
85
|
+
"\u7EF5\u9633",
|
|
86
|
+
"\u9075\u4E49",
|
|
87
|
+
"\u4E3D\u6C5F",
|
|
88
|
+
"\u5927\u7406",
|
|
89
|
+
"\u4E09\u4E9A",
|
|
90
|
+
"\u5317\u6D77",
|
|
91
|
+
// 港澳台
|
|
92
|
+
"\u9999\u6E2F",
|
|
93
|
+
"\u6FB3\u95E8",
|
|
94
|
+
"\u53F0\u5317",
|
|
95
|
+
"\u9AD8\u96C4",
|
|
96
|
+
// 海外
|
|
97
|
+
"\u65B0\u52A0\u5761",
|
|
98
|
+
"\u4E1C\u4EAC",
|
|
99
|
+
"\u9996\u5C14",
|
|
100
|
+
"\u66FC\u8C37",
|
|
101
|
+
"\u5409\u9686\u5761",
|
|
102
|
+
"\u6CB3\u5185",
|
|
103
|
+
"\u80E1\u5FD7\u660E\u5E02",
|
|
104
|
+
"\u4F26\u6566",
|
|
105
|
+
"\u7EBD\u7EA6",
|
|
106
|
+
"\u6D1B\u6749\u77F6",
|
|
107
|
+
"\u65E7\u91D1\u5C71",
|
|
108
|
+
"\u897F\u96C5\u56FE",
|
|
109
|
+
"\u6E29\u54E5\u534E",
|
|
110
|
+
"\u591A\u4F26\u591A",
|
|
111
|
+
"\u6089\u5C3C",
|
|
112
|
+
"\u58A8\u5C14\u672C",
|
|
113
|
+
"\u8FEA\u62DC",
|
|
114
|
+
"\u67CF\u6797"
|
|
115
|
+
];
|
|
116
|
+
var SOCIAL_PLATFORMS = [
|
|
117
|
+
"email",
|
|
118
|
+
// 邮箱
|
|
119
|
+
"channels",
|
|
120
|
+
// 视频号
|
|
121
|
+
"xiaohongshu",
|
|
122
|
+
// 小红书
|
|
123
|
+
"douyin",
|
|
124
|
+
// 抖音
|
|
125
|
+
"weibo",
|
|
126
|
+
// 微博
|
|
127
|
+
"bilibili",
|
|
128
|
+
// B站
|
|
129
|
+
"zhihu",
|
|
130
|
+
// 知乎
|
|
131
|
+
"mp",
|
|
132
|
+
// 公众号
|
|
133
|
+
"linkedin",
|
|
134
|
+
// LinkedIn
|
|
135
|
+
"website",
|
|
136
|
+
// 个人网站
|
|
137
|
+
"other"
|
|
138
|
+
// 其他
|
|
139
|
+
];
|
|
140
|
+
var RELATIONSHIPS = [
|
|
141
|
+
"lead",
|
|
142
|
+
// 潜客:泛线索,还看不出要什么
|
|
143
|
+
"student_intent",
|
|
144
|
+
// 意向学员:问价、想报名,还没付款
|
|
145
|
+
"student",
|
|
146
|
+
// 学员:在册
|
|
147
|
+
"alumni",
|
|
148
|
+
// 校友:学过 / 结业
|
|
149
|
+
"prospect_client",
|
|
150
|
+
// 意向甲方:有明确需求与预算,还没签约
|
|
151
|
+
"client",
|
|
152
|
+
// 甲方:已付费的 B2B 客户(含内训甲方、陪跑甲方)
|
|
153
|
+
"channel",
|
|
154
|
+
// 渠道方:带单、分销、联合办课
|
|
155
|
+
"partner",
|
|
156
|
+
// 合伙人:合作项目、联合孵化
|
|
157
|
+
"member",
|
|
158
|
+
// 社群成员
|
|
159
|
+
"supplier",
|
|
160
|
+
// 服务方:给我干活的外包、乙方
|
|
161
|
+
"mentor",
|
|
162
|
+
// 前辈:介绍资源、给建议
|
|
163
|
+
"friend",
|
|
164
|
+
// 个人关系:朋友、私交
|
|
165
|
+
"other"
|
|
166
|
+
// 其他
|
|
167
|
+
];
|
|
20
168
|
var EXIT = {
|
|
21
169
|
ok: 0,
|
|
22
170
|
error: 1,
|
|
@@ -32,6 +180,351 @@ var CLI_AUTH = {
|
|
|
32
180
|
pollIntervalSec: 3
|
|
33
181
|
};
|
|
34
182
|
|
|
183
|
+
// ../shared/src/city.ts
|
|
184
|
+
var CITY_ALIASES = {
|
|
185
|
+
// 英文
|
|
186
|
+
beijing: "\u5317\u4EAC",
|
|
187
|
+
peking: "\u5317\u4EAC",
|
|
188
|
+
shanghai: "\u4E0A\u6D77",
|
|
189
|
+
shenzhen: "\u6DF1\u5733",
|
|
190
|
+
guangzhou: "\u5E7F\u5DDE",
|
|
191
|
+
canton: "\u5E7F\u5DDE",
|
|
192
|
+
hangzhou: "\u676D\u5DDE",
|
|
193
|
+
chengdu: "\u6210\u90FD",
|
|
194
|
+
chongqing: "\u91CD\u5E86",
|
|
195
|
+
suzhou: "\u82CF\u5DDE",
|
|
196
|
+
wuhan: "\u6B66\u6C49",
|
|
197
|
+
xian: "\u897F\u5B89",
|
|
198
|
+
"xi'an": "\u897F\u5B89",
|
|
199
|
+
nanjing: "\u5357\u4EAC",
|
|
200
|
+
tianjin: "\u5929\u6D25",
|
|
201
|
+
zhengzhou: "\u90D1\u5DDE",
|
|
202
|
+
changsha: "\u957F\u6C99",
|
|
203
|
+
qingdao: "\u9752\u5C9B",
|
|
204
|
+
dongguan: "\u4E1C\u839E",
|
|
205
|
+
ningbo: "\u5B81\u6CE2",
|
|
206
|
+
foshan: "\u4F5B\u5C71",
|
|
207
|
+
hefei: "\u5408\u80A5",
|
|
208
|
+
fuzhou: "\u798F\u5DDE",
|
|
209
|
+
xiamen: "\u53A6\u95E8",
|
|
210
|
+
jinan: "\u6D4E\u5357",
|
|
211
|
+
shenyang: "\u6C88\u9633",
|
|
212
|
+
dalian: "\u5927\u8FDE",
|
|
213
|
+
changchun: "\u957F\u6625",
|
|
214
|
+
kunming: "\u6606\u660E",
|
|
215
|
+
nanning: "\u5357\u5B81",
|
|
216
|
+
harbin: "\u54C8\u5C14\u6EE8",
|
|
217
|
+
hohhot: "\u547C\u548C\u6D69\u7279",
|
|
218
|
+
urumqi: "\u4E4C\u9C81\u6728\u9F50",
|
|
219
|
+
"hong kong": "\u9999\u6E2F",
|
|
220
|
+
hongkong: "\u9999\u6E2F",
|
|
221
|
+
macau: "\u6FB3\u95E8",
|
|
222
|
+
macao: "\u6FB3\u95E8",
|
|
223
|
+
taipei: "\u53F0\u5317",
|
|
224
|
+
singapore: "\u65B0\u52A0\u5761",
|
|
225
|
+
tokyo: "\u4E1C\u4EAC",
|
|
226
|
+
seoul: "\u9996\u5C14",
|
|
227
|
+
bangkok: "\u66FC\u8C37",
|
|
228
|
+
"kuala lumpur": "\u5409\u9686\u5761",
|
|
229
|
+
hanoi: "\u6CB3\u5185",
|
|
230
|
+
"ho chi minh": "\u80E1\u5FD7\u660E\u5E02",
|
|
231
|
+
hcmc: "\u80E1\u5FD7\u660E\u5E02",
|
|
232
|
+
london: "\u4F26\u6566",
|
|
233
|
+
"new york": "\u7EBD\u7EA6",
|
|
234
|
+
nyc: "\u7EBD\u7EA6",
|
|
235
|
+
"los angeles": "\u6D1B\u6749\u77F6",
|
|
236
|
+
"san francisco": "\u65E7\u91D1\u5C71",
|
|
237
|
+
seattle: "\u897F\u96C5\u56FE",
|
|
238
|
+
vancouver: "\u6E29\u54E5\u534E",
|
|
239
|
+
toronto: "\u591A\u4F26\u591A",
|
|
240
|
+
sydney: "\u6089\u5C3C",
|
|
241
|
+
melbourne: "\u58A8\u5C14\u672C",
|
|
242
|
+
dubai: "\u8FEA\u62DC",
|
|
243
|
+
berlin: "\u67CF\u6797",
|
|
244
|
+
// 整词差异(繁简字符表管不到的那些)
|
|
245
|
+
\u6C49\u57CE: "\u9996\u5C14",
|
|
246
|
+
\u96EA\u68A8: "\u6089\u5C3C",
|
|
247
|
+
\u675C\u62DC: "\u8FEA\u62DC"
|
|
248
|
+
};
|
|
249
|
+
var TRAD_TO_SIMP = {
|
|
250
|
+
\u6771: "\u4E1C",
|
|
251
|
+
\u5EE3: "\u5E7F",
|
|
252
|
+
\u8607: "\u82CF",
|
|
253
|
+
\u912D: "\u90D1",
|
|
254
|
+
\u6F22: "\u6C49",
|
|
255
|
+
\u5CF6: "\u5C9B",
|
|
256
|
+
\u5BE7: "\u5B81",
|
|
257
|
+
\u5EC8: "\u53A6",
|
|
258
|
+
\u6FDF: "\u6D4E",
|
|
259
|
+
\u700B: "\u6C88",
|
|
260
|
+
\u9023: "\u8FDE",
|
|
261
|
+
\u9577: "\u957F",
|
|
262
|
+
\u723E: "\u5C14",
|
|
263
|
+
\u6FF1: "\u6EE8",
|
|
264
|
+
\u838A: "\u5E84",
|
|
265
|
+
\u8CB4: "\u8D35",
|
|
266
|
+
\u70CF: "\u4E4C",
|
|
267
|
+
\u9B6F: "\u9C81",
|
|
268
|
+
\u9F4A: "\u9F50",
|
|
269
|
+
\u9280: "\u94F6",
|
|
270
|
+
\u85A9: "\u8428",
|
|
271
|
+
\u6EAB: "\u6E29",
|
|
272
|
+
\u932B: "\u9521",
|
|
273
|
+
\u8208: "\u5174",
|
|
274
|
+
\u83EF: "\u534E",
|
|
275
|
+
\u81FA: "\u53F0",
|
|
276
|
+
\u63DA: "\u626C",
|
|
277
|
+
\u982D: "\u5934",
|
|
278
|
+
\u967D: "\u9633",
|
|
279
|
+
\u4E9E: "\u4E9A",
|
|
280
|
+
\u7DBF: "\u7EF5",
|
|
281
|
+
\u7FA9: "\u4E49",
|
|
282
|
+
\u9E97: "\u4E3D",
|
|
283
|
+
\u5167: "\u5185",
|
|
284
|
+
\u502B: "\u4F26",
|
|
285
|
+
\u7D04: "\u7EA6",
|
|
286
|
+
\u7D10: "\u7EBD",
|
|
287
|
+
\u78EF: "\u77F6",
|
|
288
|
+
\u820A: "\u65E7",
|
|
289
|
+
\u862D: "\u5170",
|
|
290
|
+
\u7121: "\u65E0",
|
|
291
|
+
\u9751: "\u9752",
|
|
292
|
+
\u9580: "\u95E8",
|
|
293
|
+
\u9F8D: "\u9F99"
|
|
294
|
+
};
|
|
295
|
+
var toSimplified = (s) => s.replace(/[㐀-鿿]/g, (ch) => TRAD_TO_SIMP[ch] ?? ch);
|
|
296
|
+
var LOOKUP = /* @__PURE__ */ new Map();
|
|
297
|
+
for (const city2 of CITIES) LOOKUP.set(city2.toLowerCase(), city2);
|
|
298
|
+
for (const [alias, canonical] of Object.entries(CITY_ALIASES)) LOOKUP.set(alias.toLowerCase(), canonical);
|
|
299
|
+
function normalizeCity(input2) {
|
|
300
|
+
if (!input2) return "";
|
|
301
|
+
const cleaned = input2.replace(/[ \s]+/g, " ").trim();
|
|
302
|
+
if (!cleaned) return "";
|
|
303
|
+
const simplified = toSimplified(cleaned);
|
|
304
|
+
const forms = simplified === cleaned ? [cleaned] : [cleaned, simplified];
|
|
305
|
+
for (const form of forms) {
|
|
306
|
+
const hit = LOOKUP.get(form.toLowerCase());
|
|
307
|
+
if (hit) return hit;
|
|
308
|
+
}
|
|
309
|
+
for (const form of forms) {
|
|
310
|
+
const bare = form.replace(/(特别行政区|自治区|省|市|区|县|州|盟|旗)$/u, "");
|
|
311
|
+
if (bare && bare !== form) {
|
|
312
|
+
const hit = LOOKUP.get(bare.toLowerCase());
|
|
313
|
+
if (hit) return hit;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
for (const form of forms) {
|
|
317
|
+
const compact = form.replace(/\s+/g, "");
|
|
318
|
+
let best;
|
|
319
|
+
let bestAt = Infinity;
|
|
320
|
+
for (const c of CITIES) {
|
|
321
|
+
const at = compact.indexOf(c);
|
|
322
|
+
if (at === -1) continue;
|
|
323
|
+
if (at < bestAt) {
|
|
324
|
+
best = c;
|
|
325
|
+
bestAt = at;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (best) return best;
|
|
329
|
+
}
|
|
330
|
+
return cleaned;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// ../shared/src/social.ts
|
|
334
|
+
var SOCIAL_PLATFORM_ALIASES = {
|
|
335
|
+
// 邮箱
|
|
336
|
+
email: "email",
|
|
337
|
+
mail: "email",
|
|
338
|
+
"e-mail": "email",
|
|
339
|
+
\u90AE\u7BB1: "email",
|
|
340
|
+
\u90AE\u4EF6: "email",
|
|
341
|
+
\u7535\u5B50\u90AE\u4EF6: "email",
|
|
342
|
+
// 视频号
|
|
343
|
+
channels: "channels",
|
|
344
|
+
wechat_channels: "channels",
|
|
345
|
+
\u89C6\u9891\u53F7: "channels",
|
|
346
|
+
\u5FAE\u4FE1\u89C6\u9891\u53F7: "channels",
|
|
347
|
+
// 小红书
|
|
348
|
+
xiaohongshu: "xiaohongshu",
|
|
349
|
+
xhs: "xiaohongshu",
|
|
350
|
+
red: "xiaohongshu",
|
|
351
|
+
\u5C0F\u7EA2\u4E66: "xiaohongshu",
|
|
352
|
+
// 抖音
|
|
353
|
+
douyin: "douyin",
|
|
354
|
+
\u6296\u97F3: "douyin",
|
|
355
|
+
// 微博
|
|
356
|
+
weibo: "weibo",
|
|
357
|
+
\u5FAE\u535A: "weibo",
|
|
358
|
+
// B站
|
|
359
|
+
bilibili: "bilibili",
|
|
360
|
+
bili: "bilibili",
|
|
361
|
+
b\u7AD9: "bilibili",
|
|
362
|
+
\u54D4\u54E9\u54D4\u54E9: "bilibili",
|
|
363
|
+
// 知乎
|
|
364
|
+
zhihu: "zhihu",
|
|
365
|
+
\u77E5\u4E4E: "zhihu",
|
|
366
|
+
// 公众号
|
|
367
|
+
mp: "mp",
|
|
368
|
+
wechat_mp: "mp",
|
|
369
|
+
\u516C\u4F17\u53F7: "mp",
|
|
370
|
+
\u8BA2\u9605\u53F7: "mp",
|
|
371
|
+
\u5FAE\u4FE1\u516C\u4F17\u53F7: "mp",
|
|
372
|
+
// LinkedIn
|
|
373
|
+
linkedin: "linkedin",
|
|
374
|
+
\u9886\u82F1: "linkedin",
|
|
375
|
+
// 个人网站
|
|
376
|
+
website: "website",
|
|
377
|
+
\u7F51\u7AD9: "website",
|
|
378
|
+
\u5B98\u7F51: "website",
|
|
379
|
+
\u535A\u5BA2: "website",
|
|
380
|
+
blog: "website",
|
|
381
|
+
// 其他
|
|
382
|
+
other: "other",
|
|
383
|
+
\u5176\u4ED6: "other"
|
|
384
|
+
};
|
|
385
|
+
var LOOKUP2 = /* @__PURE__ */ new Map();
|
|
386
|
+
for (const p of SOCIAL_PLATFORMS) LOOKUP2.set(p.toLowerCase(), p);
|
|
387
|
+
for (const [alias, canonical] of Object.entries(SOCIAL_PLATFORM_ALIASES)) LOOKUP2.set(alias.toLowerCase(), canonical);
|
|
388
|
+
var CONTAINS_KEYS = [...LOOKUP2.keys()].filter((k) => /[^\x00-\x7F]/.test(k)).sort((a, b) => b.length - a.length);
|
|
389
|
+
function normalizeSocialPlatform(input2) {
|
|
390
|
+
if (!input2) return "";
|
|
391
|
+
const cleaned = input2.replace(/[ \s]+/g, " ").trim();
|
|
392
|
+
if (!cleaned) return "";
|
|
393
|
+
const hit = LOOKUP2.get(cleaned.toLowerCase());
|
|
394
|
+
if (hit) return hit;
|
|
395
|
+
const compact = cleaned.replace(/\s+/g, "");
|
|
396
|
+
for (const key of CONTAINS_KEYS) {
|
|
397
|
+
if (compact.includes(key)) return LOOKUP2.get(key);
|
|
398
|
+
}
|
|
399
|
+
return cleaned;
|
|
400
|
+
}
|
|
401
|
+
var SOCIAL_PLATFORM_LABELS = {
|
|
402
|
+
email: { zh: "\u90AE\u7BB1", en: "Email" },
|
|
403
|
+
channels: { zh: "\u89C6\u9891\u53F7", en: "Channels" },
|
|
404
|
+
xiaohongshu: { zh: "\u5C0F\u7EA2\u4E66", en: "Xiaohongshu" },
|
|
405
|
+
douyin: { zh: "\u6296\u97F3", en: "Douyin" },
|
|
406
|
+
weibo: { zh: "\u5FAE\u535A", en: "Weibo" },
|
|
407
|
+
bilibili: { zh: "B\u7AD9", en: "Bilibili" },
|
|
408
|
+
zhihu: { zh: "\u77E5\u4E4E", en: "Zhihu" },
|
|
409
|
+
mp: { zh: "\u516C\u4F17\u53F7", en: "WeChat MP" },
|
|
410
|
+
linkedin: { zh: "\u9886\u82F1", en: "LinkedIn" },
|
|
411
|
+
website: { zh: "\u4E2A\u4EBA\u7F51\u7AD9", en: "Website" },
|
|
412
|
+
other: { zh: "\u5176\u4ED6", en: "Other" }
|
|
413
|
+
};
|
|
414
|
+
function socialPlatformLabel(platform2, lang = "zh") {
|
|
415
|
+
return SOCIAL_PLATFORM_LABELS[platform2]?.[lang] ?? platform2;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// ../shared/src/relationship.ts
|
|
419
|
+
var RELATIONSHIP_ALIASES = {
|
|
420
|
+
// 潜客
|
|
421
|
+
lead: "lead",
|
|
422
|
+
\u6F5C\u5BA2: "lead",
|
|
423
|
+
\u7EBF\u7D22: "lead",
|
|
424
|
+
// 意向学员
|
|
425
|
+
student_intent: "student_intent",
|
|
426
|
+
potential_student: "student_intent",
|
|
427
|
+
\u610F\u5411\u5B66\u5458: "student_intent",
|
|
428
|
+
\u5B66\u5458\u610F\u5411: "student_intent",
|
|
429
|
+
\u51C6\u5B66\u5458: "student_intent",
|
|
430
|
+
\u60F3\u62A5\u540D: "student_intent",
|
|
431
|
+
// 学员
|
|
432
|
+
student: "student",
|
|
433
|
+
\u5B66\u5458: "student",
|
|
434
|
+
\u5B66\u751F: "student",
|
|
435
|
+
\u5728\u518C\u5B66\u5458: "student",
|
|
436
|
+
\u6B63\u5F0F\u5B66\u5458: "student",
|
|
437
|
+
// 校友
|
|
438
|
+
alumni: "alumni",
|
|
439
|
+
graduate: "alumni",
|
|
440
|
+
\u6821\u53CB: "alumni",
|
|
441
|
+
\u6BD5\u4E1A\u751F: "alumni",
|
|
442
|
+
\u7ED3\u4E1A\u5B66\u5458: "alumni",
|
|
443
|
+
\u8001\u5B66\u5458: "alumni",
|
|
444
|
+
\u5F80\u5C4A\u5B66\u5458: "alumni",
|
|
445
|
+
// 意向甲方
|
|
446
|
+
prospect_client: "prospect_client",
|
|
447
|
+
potential_client: "prospect_client",
|
|
448
|
+
\u610F\u5411\u7532\u65B9: "prospect_client",
|
|
449
|
+
\u6F5C\u5728\u7532\u65B9: "prospect_client",
|
|
450
|
+
\u610F\u5411\u5BA2\u6237: "prospect_client",
|
|
451
|
+
\u5F85\u7B7E\u5BA2\u6237: "prospect_client",
|
|
452
|
+
// 甲方
|
|
453
|
+
client: "client",
|
|
454
|
+
customer: "client",
|
|
455
|
+
\u7532\u65B9: "client",
|
|
456
|
+
\u5BA2\u6237: "client",
|
|
457
|
+
\u5BA2\u6237\u65B9: "client",
|
|
458
|
+
\u5DF2\u7B7E\u7EA6: "client",
|
|
459
|
+
// 渠道方
|
|
460
|
+
channel: "channel",
|
|
461
|
+
\u6E20\u9053\u65B9: "channel",
|
|
462
|
+
\u6E20\u9053: "channel",
|
|
463
|
+
\u6E20\u9053\u4F19\u4F34: "channel",
|
|
464
|
+
\u5206\u9500\u65B9: "channel",
|
|
465
|
+
\u4EE3\u7406: "channel",
|
|
466
|
+
// 合伙人
|
|
467
|
+
partner: "partner",
|
|
468
|
+
\u5408\u4F19\u4EBA: "partner",
|
|
469
|
+
\u5408\u4F5C\u65B9: "partner",
|
|
470
|
+
\u5408\u4F5C\u4F19\u4F34: "partner",
|
|
471
|
+
\u8054\u5408\u521B\u59CB\u4EBA: "partner",
|
|
472
|
+
// 社群成员
|
|
473
|
+
member: "member",
|
|
474
|
+
\u793E\u7FA4\u6210\u5458: "member",
|
|
475
|
+
\u7FA4\u53CB: "member",
|
|
476
|
+
\u793E\u533A\u6210\u5458: "member",
|
|
477
|
+
\u793E\u7FA4: "member",
|
|
478
|
+
// 服务方
|
|
479
|
+
supplier: "supplier",
|
|
480
|
+
vendor: "supplier",
|
|
481
|
+
\u670D\u52A1\u65B9: "supplier",
|
|
482
|
+
\u4F9B\u5E94\u5546: "supplier",
|
|
483
|
+
\u5916\u5305\u65B9: "supplier",
|
|
484
|
+
\u4E59\u65B9: "supplier",
|
|
485
|
+
// 前辈
|
|
486
|
+
mentor: "mentor",
|
|
487
|
+
\u524D\u8F88: "mentor",
|
|
488
|
+
\u5BFC\u5E08: "mentor",
|
|
489
|
+
\u987E\u95EE: "mentor",
|
|
490
|
+
// 个人关系
|
|
491
|
+
friend: "friend",
|
|
492
|
+
\u670B\u53CB: "friend",
|
|
493
|
+
\u4E2A\u4EBA\u5173\u7CFB: "friend",
|
|
494
|
+
\u79C1\u4EA4: "friend",
|
|
495
|
+
// 其他
|
|
496
|
+
other: "other",
|
|
497
|
+
\u5176\u4ED6: "other",
|
|
498
|
+
\u5176\u5B83: "other"
|
|
499
|
+
};
|
|
500
|
+
var LOOKUP3 = /* @__PURE__ */ new Map();
|
|
501
|
+
for (const r of RELATIONSHIPS) LOOKUP3.set(r.toLowerCase(), r);
|
|
502
|
+
for (const [alias, canonical] of Object.entries(RELATIONSHIP_ALIASES)) LOOKUP3.set(alias.toLowerCase(), canonical);
|
|
503
|
+
function normalizeRelationship(input2) {
|
|
504
|
+
if (!input2) return "";
|
|
505
|
+
const cleaned = input2.replace(/[ \s]+/g, " ").trim();
|
|
506
|
+
if (!cleaned) return "";
|
|
507
|
+
return LOOKUP3.get(cleaned.toLowerCase()) ?? cleaned;
|
|
508
|
+
}
|
|
509
|
+
var RELATIONSHIP_LABELS = {
|
|
510
|
+
lead: { zh: "\u6F5C\u5BA2", en: "Lead" },
|
|
511
|
+
student_intent: { zh: "\u610F\u5411\u5B66\u5458", en: "Prospective student" },
|
|
512
|
+
student: { zh: "\u5B66\u5458", en: "Student" },
|
|
513
|
+
alumni: { zh: "\u6821\u53CB", en: "Alumni" },
|
|
514
|
+
prospect_client: { zh: "\u610F\u5411\u7532\u65B9", en: "Prospective client" },
|
|
515
|
+
client: { zh: "\u7532\u65B9", en: "Client" },
|
|
516
|
+
channel: { zh: "\u6E20\u9053\u65B9", en: "Channel partner" },
|
|
517
|
+
partner: { zh: "\u5408\u4F19\u4EBA", en: "Partner" },
|
|
518
|
+
member: { zh: "\u793E\u7FA4\u6210\u5458", en: "Community member" },
|
|
519
|
+
supplier: { zh: "\u670D\u52A1\u65B9", en: "Supplier" },
|
|
520
|
+
mentor: { zh: "\u524D\u8F88", en: "Mentor" },
|
|
521
|
+
friend: { zh: "\u4E2A\u4EBA\u5173\u7CFB", en: "Friend" },
|
|
522
|
+
other: { zh: "\u5176\u4ED6", en: "Other" }
|
|
523
|
+
};
|
|
524
|
+
function relationshipLabel(relationship, lang = "zh") {
|
|
525
|
+
return RELATIONSHIP_LABELS[relationship]?.[lang] ?? relationship;
|
|
526
|
+
}
|
|
527
|
+
|
|
35
528
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
|
|
36
529
|
var external_exports = {};
|
|
37
530
|
__export(external_exports, {
|
|
@@ -19753,6 +20246,12 @@ function date4(params) {
|
|
|
19753
20246
|
var short = (max) => external_exports.string().trim().max(max);
|
|
19754
20247
|
var tags = external_exports.array(external_exports.string().trim().min(1).max(200)).max(50);
|
|
19755
20248
|
var isoDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/, "YYYY-MM-DD");
|
|
20249
|
+
var city = external_exports.string().trim().max(100).transform(normalizeCity);
|
|
20250
|
+
var socialLink = external_exports.object({
|
|
20251
|
+
platform: external_exports.string().trim().min(1).max(50).transform(normalizeSocialPlatform),
|
|
20252
|
+
handle: external_exports.string().trim().min(1).max(200),
|
|
20253
|
+
url: external_exports.string().trim().max(2e3).nullable().optional()
|
|
20254
|
+
});
|
|
19756
20255
|
var eventInput = external_exports.object({
|
|
19757
20256
|
title: short(200).min(1),
|
|
19758
20257
|
date: isoDate,
|
|
@@ -19766,8 +20265,12 @@ var customerShape = {
|
|
|
19766
20265
|
name: short(200).min(1),
|
|
19767
20266
|
company: short(200),
|
|
19768
20267
|
title: short(200),
|
|
19769
|
-
city
|
|
20268
|
+
city,
|
|
19770
20269
|
wechatId: short(100).nullable(),
|
|
20270
|
+
/** 其他社交账号(视频号 / 小红书 / 邮箱…)。整体替换:传了就用这组覆盖旧的 */
|
|
20271
|
+
socials: external_exports.array(socialLink).max(50),
|
|
20272
|
+
/** 关系:这个人是谁。可以多个,按重要性从高到低。整体替换 */
|
|
20273
|
+
relationships: external_exports.array(external_exports.string().trim().min(1).max(50).transform(normalizeRelationship)).max(20),
|
|
19771
20274
|
summary: short(5e3),
|
|
19772
20275
|
painPoints: tags,
|
|
19773
20276
|
goals: tags,
|
|
@@ -19810,6 +20313,17 @@ var hookFields = [
|
|
|
19810
20313
|
{ name: "title", type: "string", required: true, guide: "\u94A9\u5B50\u540D\u79F0\uFF0C\u4E00\u53E5\u8BDD\u6982\u62EC\uFF0C\u5982\u300C\u7528\u884C\u4E1A\u5BF9\u6807\u6848\u4F8B\u5F00\u573A\u300D" },
|
|
19811
20314
|
{ name: "description", type: "string", required: true, guide: "\u53EF\u590D\u7528\u7684\u5177\u4F53\u8BDD\u672F\u6216\u903B\u8F91\uFF0C\u5199\u6E05\u695A\u4E3A\u4EC0\u4E48\u6709\u6548\uFF0C\u8BA9\u522B\u7684\u5BA2\u6237\u573A\u666F\u4E5F\u80FD\u7167\u7740\u7528" }
|
|
19812
20315
|
];
|
|
20316
|
+
var socialFields = [
|
|
20317
|
+
{
|
|
20318
|
+
name: "platform",
|
|
20319
|
+
type: "enum",
|
|
20320
|
+
required: true,
|
|
20321
|
+
values: SOCIAL_PLATFORMS,
|
|
20322
|
+
guide: "\u5E73\u53F0\u3002\u5199\u300C\u89C6\u9891\u53F7\u300D\u300C\u5C0F\u7EA2\u4E66\u300D\u300C\u90AE\u7BB1\u300D\u300C\u516C\u4F17\u53F7\u300D\u7B49\u4E2D\u6587\u4F1A\u81EA\u52A8\u5F52\u4E00\u5316\u5230\u6E05\u5355\u91CC\u7684\u503C\uFF1B\u6E05\u5355\u5916\u7684\u5E73\u53F0\uFF08\u5982\u300C\u5FEB\u624B\u300D\uFF09\u4E0D\u62A5\u9519\uFF0C\u539F\u6837\u4FDD\u7559\u3002\u5FAE\u4FE1\u4E0D\u8981\u653E\u8FD9\u91CC\uFF0C\u5FAE\u4FE1\u53F7\u5199 wechatId\u3002"
|
|
20323
|
+
},
|
|
20324
|
+
{ name: "handle", type: "string", required: true, guide: "\u8D26\u53F7\u540D\u6216\u90AE\u7BB1\u5730\u5740\uFF0C\u5982\u300C@san\u4E09\u300D\u300Czhang@example.com\u300D" },
|
|
20325
|
+
{ name: "url", type: "string", nullable: true, guide: "\u8D26\u53F7\u4E3B\u9875\u94FE\u63A5\u3002\u6750\u6599\u91CC\u6CA1\u6709\u5C31\u7701\u7565\uFF0C\u4E0D\u8981\u731C" }
|
|
20326
|
+
];
|
|
19813
20327
|
var SCHEMA = {
|
|
19814
20328
|
customer: {
|
|
19815
20329
|
description: "\u5BA2\u6237\u6863\u6848\u3002\u521B\u5EFA\u53EA\u9700\u8981 name\uFF0C\u5176\u4F59\u5B57\u6BB5\u80FD\u4ECE\u5BF9\u8BDD\u91CC\u786E\u5B9A\u7684\u90FD\u5E94\u586B\u5199\uFF0C\u6CA1\u6709\u4F9D\u636E\u7684\u4E0D\u8981\u7F16\u9020\u3002",
|
|
@@ -19817,8 +20331,20 @@ var SCHEMA = {
|
|
|
19817
20331
|
{ name: "name", type: "string", required: true, guide: "\u5BA2\u6237\u59D3\u540D\u3002\u5BF9\u8BDD\u91CC\u51FA\u73B0\u7684\u79F0\u547C\u3001\u6635\u79F0\u82E5\u65E0\u6CD5\u786E\u5B9A\u771F\u540D\uFF0C\u5199\u5BF9\u65B9\u4F7F\u7528\u7684\u540D\u5B57" },
|
|
19818
20332
|
{ name: "company", type: "string", guide: "\u6240\u5728\u516C\u53F8\u6216\u7EC4\u7EC7" },
|
|
19819
20333
|
{ name: "title", type: "string", guide: "\u804C\u4F4D\u6216\u8EAB\u4EFD" },
|
|
19820
|
-
{ name: "city", type: "
|
|
20334
|
+
{ name: "city", type: "enum", values: CITIES, guide: "\u6240\u5728\u57CE\u5E02\u3002\u4F18\u5148\u53D6\u4E0B\u9762\u6E05\u5355\u91CC\u7684\u503C\uFF1B\u5199\u300C\u4E0A\u6D77\u5E02\u300D\u300CShanghai\u300D\u300C\u81FA\u5317\u300D\u4F1A\u81EA\u52A8\u5F52\u4E00\u5316\u6210\u300C\u4E0A\u6D77\u300D\u300C\u4E0A\u6D77\u300D\u300C\u53F0\u5317\u300D\u3002\u6E05\u5355\u5916\u7684\u5199\u6CD5\u4E0D\u4F1A\u62A5\u9519\uFF0C\u539F\u6837\u4FDD\u7559\uFF0C\u4E8B\u540E\u53EF\u5F52\u7C7B\u3002" },
|
|
19821
20335
|
{ name: "wechatId", type: "string", nullable: true, guide: "\u5FAE\u4FE1\u53F7\u3002\u53EA\u5728\u5BF9\u8BDD\u91CC\u660E\u786E\u51FA\u73B0\u65F6\u586B\u5199" },
|
|
20336
|
+
{
|
|
20337
|
+
name: "socials",
|
|
20338
|
+
type: "object[]",
|
|
20339
|
+
fields: socialFields,
|
|
20340
|
+
guide: "\u5BA2\u6237\u7684\u5176\u4ED6\u793E\u4EA4\u8D26\u53F7\uFF1A\u89C6\u9891\u53F7\u3001\u5C0F\u7EA2\u4E66\u3001\u90AE\u7BB1\u3001\u6296\u97F3\u3001B\u7AD9\u7B49\u3002\u5143\u7D20\u5F62\u5982 {platform:'channels', handle:'@san\u4E09'}\u3002\u53EA\u5728\u6750\u6599\u91CC\u660E\u786E\u51FA\u73B0\u65F6\u586B\uFF0C\u6CA1\u6709\u5C31\u7701\u7565\uFF0C\u4E0D\u8981\u7F16\u9020\u3002\u66F4\u65B0\u65F6\u4F20\u5165\u5B8C\u6574\u5217\u8868\u4F1A\u6574\u4F53\u66FF\u6362\u65E7\u5217\u8868\uFF1B\u4E0D\u4F20\u5219\u4E0D\u52A8\u3002"
|
|
20341
|
+
},
|
|
20342
|
+
{
|
|
20343
|
+
name: "relationships",
|
|
20344
|
+
type: "string[]",
|
|
20345
|
+
values: RELATIONSHIPS,
|
|
20346
|
+
guide: "\u8FD9\u4E2A\u4EBA\u5728\u6211\u8FD9\u91CC\u662F\u4EC0\u4E48\u8EAB\u4EFD\uFF1A\u7532\u65B9 / \u6E20\u9053\u65B9 / \u5B66\u5458 / \u793E\u7FA4\u6210\u5458\u2026\u53EF\u4EE5\u540C\u65F6\u591A\u4E2A\uFF0C\u6309\u91CD\u8981\u6027\u4ECE\u9AD8\u5230\u4F4E\uFF08\u7B2C\u4E00\u4E2A\u662F\u5F53\u524D\u6700\u4E3B\u8981\u7684\u5173\u7CFB\uFF09\u3002\u5199\u4E2D\u6587\u4F1A\u81EA\u52A8\u5F52\u4E00\u5316\uFF08\u300C\u7532\u65B9\u300D\u300C\u5BA2\u6237\u65B9\u300D\u300C\u5B66\u5458\u300D\u300C\u6E20\u9053\u65B9\u300D\uFF09\u3002\u5E38\u89C1\u8DEF\u5F84\uFF1A\u6F5C\u5BA2 \u2192 \u610F\u5411\u5B66\u5458 \u2192 \u5B66\u5458 \u2192 \u6821\u53CB \u2192 \u610F\u5411\u7532\u65B9 \u2192 \u7532\u65B9\u3002\u5FAE\u4FE1\u6807\u7B7E\u91CC\u5199\u660E\u7684\u8EAB\u4EFD\u6700\u786C\uFF08\u5982\u300CAI\u7F16\u7A0B N23 \u671F\u5B66\u5458\u300D\u5C31\u662F\u5B66\u5458\uFF09\u3002\u6CA1\u6709\u4F9D\u636E\u5C31\u7559\u7A7A\uFF0C\u4E0D\u8981\u7F16\u3002\u66F4\u65B0\u65F6\u4F20\u5165\u5B8C\u6574\u5217\u8868\u4F1A\u6574\u4F53\u66FF\u6362\u65E7\u5217\u8868\u3002"
|
|
20347
|
+
},
|
|
19822
20348
|
{ name: "summary", type: "string", guide: "\u4E00\u6BB5\u8BDD\u6982\u62EC\u8FD9\u4E2A\u5BA2\u6237\u662F\u8C01\u3001\u5F53\u524D\u5904\u4E8E\u4EC0\u4E48\u9636\u6BB5" },
|
|
19823
20349
|
{ name: "painPoints", type: "string[]", guide: "\u75DB\u70B9\u6807\u7B7E\uFF0C\u6BCF\u6761\u7B80\u77ED\uFF08\u51E0\u4E2A\u5B57\u5230\u4E00\u53E5\u8BDD\uFF09\u3002\u540C\u4E00\u4E2A\u75DB\u70B9\u590D\u7528\u5DF2\u6709\u6807\u7B7E\u7684\u5199\u6CD5\uFF0C\u4FBF\u4E8E\u6309\u6807\u7B7E\u805A\u5408" },
|
|
19824
20350
|
{ name: "goals", type: "string[]", guide: "\u77ED\u671F\u76EE\u6807\uFF0C\u6BCF\u6761\u4E00\u53E5\u8BDD" },
|
|
@@ -19904,14 +20430,15 @@ var DEFAULT_PROMPTS = [
|
|
|
19904
20430
|
function renderPrompt(text, customer) {
|
|
19905
20431
|
return text.replace(/\{\{\s*(\w+)\s*\}\}/g, (whole, key) => {
|
|
19906
20432
|
const v = customer?.[key];
|
|
19907
|
-
|
|
20433
|
+
if (!v || Array.isArray(v) && v.length === 0) return whole;
|
|
20434
|
+
return Array.isArray(v) ? v.join(", ") : v;
|
|
19908
20435
|
});
|
|
19909
20436
|
}
|
|
19910
20437
|
|
|
19911
20438
|
// package.json
|
|
19912
20439
|
var package_default = {
|
|
19913
20440
|
name: "insightcrm",
|
|
19914
|
-
version: "0.1.
|
|
20441
|
+
version: "0.1.6",
|
|
19915
20442
|
description: "Command line and agent skill for InsightCRM: file customers from chats and screenshots with your own AI agent. Non-interactive, --json output, stable exit codes.",
|
|
19916
20443
|
license: "MIT",
|
|
19917
20444
|
type: "module",
|
|
@@ -20186,6 +20713,8 @@ Examples:
|
|
|
20186
20713
|
$ crm login https://crm.example.com
|
|
20187
20714
|
$ crm schema --json
|
|
20188
20715
|
$ echo '{"name":"Wang Ming","company":"ACME","conversionPotential":"High"}' | crm add - --json
|
|
20716
|
+
$ crm add --name "\u738B\u5C0F\u660E" --social channels:@san3 email:wang@example.com --json
|
|
20717
|
+
$ crm add --name "\u738B\u5C0F\u660E" --relationship \u5B66\u5458 --relationship \u793E\u7FA4\u6210\u5458 --json
|
|
20189
20718
|
$ crm list --potential high --city Beijing --due-today --json
|
|
20190
20719
|
$ crm update 3f2a\u2026 --summary "Needs a quote by Friday" --json
|
|
20191
20720
|
$ crm hook add --title "Opened with a peer case" --desc "Led with a competitor's result, then asked about theirs" --customer 3f2a\u2026
|
|
@@ -20256,10 +20785,17 @@ var potentialOf = (v) => {
|
|
|
20256
20785
|
if (!CONVERSION_POTENTIALS.includes(p)) throw new CliError("usage", `--potential must be one of ${CONVERSION_POTENTIALS.join(", ")}`, EXIT.usage);
|
|
20257
20786
|
return p;
|
|
20258
20787
|
};
|
|
20788
|
+
function parseSocial(s) {
|
|
20789
|
+
const at = s.indexOf(":");
|
|
20790
|
+
const platform2 = at === -1 ? "" : s.slice(0, at).trim();
|
|
20791
|
+
const handle = at === -1 ? "" : s.slice(at + 1).trim();
|
|
20792
|
+
if (!platform2 || !handle) throw new CliError("usage", `Can't read social "${s}". Use platform:handle, e.g. channels:@san or email:zhang@example.com`, EXIT.usage);
|
|
20793
|
+
return { platform: platform2, handle };
|
|
20794
|
+
}
|
|
20259
20795
|
function withCustomerOptions(cmd, forUpdate) {
|
|
20260
|
-
cmd.option("--name <s>", "name").option("--company <s>").option("--title <s>", "job title").option("--city <s>").option("--wechat <s>", "WeChat id").option("--summary <s>").option("--current-action <s>").option("--notes <s>").option("--potential <High|Medium|Low>").option("--cycle-days <n>", "predicted conversion window in days").option("--pain <a,b,c>", `pain-point tags, comma separated${forUpdate ? " (replaces the whole list)" : ""}`).option("--goal <s...>", `goals${forUpdate ? " (replaces the whole list)" : ""}`).option("--event <date:type:title...>", `calendar events${forUpdate ? " (replaces the whole calendar; see --add-event)" : ""}`);
|
|
20796
|
+
cmd.option("--name <s>", "name").option("--company <s>").option("--title <s>", "job title").option("--city <s>").option("--wechat <s>", "WeChat id").option("--summary <s>").option("--current-action <s>").option("--notes <s>").option("--potential <High|Medium|Low>").option("--cycle-days <n>", "predicted conversion window in days").option("--pain <a,b,c>", `pain-point tags, comma separated${forUpdate ? " (replaces the whole list)" : ""}`).option("--goal <s...>", `goals${forUpdate ? " (replaces the whole list)" : ""}`).option("--event <date:type:title...>", `calendar events${forUpdate ? " (replaces the whole calendar; see --add-event)" : ""}`).option("--social <platform:handle...>", `social accounts, e.g. channels:@san xiaohongshu:san${forUpdate ? " (replaces the whole list; see --add-social)" : ""}`).option("--relationship <r...>", `relationship to the user, e.g. \u5B66\u5458 \u7532\u65B9${forUpdate ? " (replaces the whole list; see --add-relationship)" : ""}`);
|
|
20261
20797
|
if (forUpdate) {
|
|
20262
|
-
cmd.option("--add-pain <s...>", "append pain-point tags, keeping existing ones").option("--add-goal <s...>", "append goals, keeping existing ones").option("--add-event <date:type:title...>", "append calendar events, keeping existing ones").option("--clear-events", "remove all calendar events");
|
|
20798
|
+
cmd.option("--add-pain <s...>", "append pain-point tags, keeping existing ones").option("--add-goal <s...>", "append goals, keeping existing ones").option("--add-event <date:type:title...>", "append calendar events, keeping existing ones").option("--add-social <platform:handle...>", "append social accounts, keeping existing ones").option("--add-relationship <r...>", "append relationships, keeping existing ones").option("--clear-events", "remove all calendar events");
|
|
20263
20799
|
} else {
|
|
20264
20800
|
cmd.option("--hook-title <s>", "also record a successful hook for this customer (needs --hook-desc)").option("--hook-desc <s>");
|
|
20265
20801
|
}
|
|
@@ -20288,6 +20824,8 @@ function buildCustomerBody(base, o) {
|
|
|
20288
20824
|
if (o.goal) body.goals = o.goal;
|
|
20289
20825
|
if (o.event) body.upcomingEvents = o.event.map(parseEvent);
|
|
20290
20826
|
if (o.clearEvents) body.upcomingEvents = [];
|
|
20827
|
+
if (o.social) body.socials = o.social.map(parseSocial);
|
|
20828
|
+
if (o.relationship) body.relationships = o.relationship;
|
|
20291
20829
|
if (o.hookTitle || o.hookDesc) {
|
|
20292
20830
|
if (!o.hookTitle || !o.hookDesc) throw new CliError("usage", "--hook-title and --hook-desc go together", EXIT.usage);
|
|
20293
20831
|
body.socialHook = { title: o.hookTitle, description: o.hookDesc };
|
|
@@ -20303,6 +20841,8 @@ function detail(c) {
|
|
|
20303
20841
|
["title", c.title],
|
|
20304
20842
|
["city", c.city],
|
|
20305
20843
|
["wechat", c.wechatId ?? ""],
|
|
20844
|
+
["socials", c.socials.map((s) => `${s.platform}: ${s.handle}${s.url ? ` (${s.url})` : ""}`).join("; ")],
|
|
20845
|
+
["relationship", c.relationships.map((r) => relationshipLabel(r, "zh")).join(", ")],
|
|
20306
20846
|
["potential", c.conversionPotential],
|
|
20307
20847
|
["cycle days", String(c.conversionCycleDays)],
|
|
20308
20848
|
["pain points", c.painPoints.join(", ")],
|
|
@@ -20430,8 +20970,11 @@ latest (not checked)`, { current, latest: null, updateAvailable: null, checke
|
|
|
20430
20970
|
program.command("schema").description('Field definitions AND filling guidance: the contract for writing records. Read the "guide" of every field before you add.').addOption(new Option("--entity <name>", "only this entity").choices([...ENTITIES])).action(async (o) => {
|
|
20431
20971
|
const entities = (o.entity ? [o.entity] : [...ENTITIES]).map((e) => ({ entity: e, ...SCHEMA[e] }));
|
|
20432
20972
|
const human = entities.map((e) => `# ${e.entity}: ${e.description}
|
|
20433
|
-
` + e.fields.map((f) =>
|
|
20434
|
-
|
|
20973
|
+
` + e.fields.map((f) => {
|
|
20974
|
+
const values = !f.values ? "" : f.values.length > 12 ? ` (${f.values.length} allowed values \u2014 see --json)` : ` (${f.values.join("|")})`;
|
|
20975
|
+
return ` ${f.name}${f.required ? "*" : ""} ${f.type}${values}
|
|
20976
|
+
${f.guide}`;
|
|
20977
|
+
}).join("\n")).join("\n\n");
|
|
20435
20978
|
out(human, { entities });
|
|
20436
20979
|
});
|
|
20437
20980
|
withCustomerOptions(
|
|
@@ -20444,16 +20987,26 @@ withCustomerOptions(
|
|
|
20444
20987
|
out(`Created ${line(customer)}`, { customer, created: true });
|
|
20445
20988
|
});
|
|
20446
20989
|
withCustomerOptions(
|
|
20447
|
-
program.command("update").description("Change a customer. Only the fields you pass change. --pain / --goal / --event REPLACE the list; --add-pain / --add-goal / --add-event append.").argument("<id>").argument("[json-file]", "JSON file, or - for stdin"),
|
|
20990
|
+
program.command("update").description("Change a customer. Only the fields you pass change. --pain / --goal / --event / --social / --relationship REPLACE the list; --add-pain / --add-goal / --add-event / --add-social / --add-relationship append.").argument("<id>").argument("[json-file]", "JSON file, or - for stdin"),
|
|
20448
20991
|
true
|
|
20449
20992
|
).action(async (id, src, o) => {
|
|
20450
20993
|
const api = await client();
|
|
20451
20994
|
const body = buildCustomerBody(await readJsonInput(src), o);
|
|
20452
|
-
if (o.addPain || o.addGoal || o.addEvent) {
|
|
20995
|
+
if (o.addPain || o.addGoal || o.addEvent || o.addSocial || o.addRelationship) {
|
|
20453
20996
|
const { customer: cur } = await api.getCustomer(id);
|
|
20454
20997
|
if (o.addPain) body.painPoints = [.../* @__PURE__ */ new Set([...body.painPoints ?? cur.painPoints, ...o.addPain])];
|
|
20455
20998
|
if (o.addGoal) body.goals = [.../* @__PURE__ */ new Set([...body.goals ?? cur.goals, ...o.addGoal])];
|
|
20456
20999
|
if (o.addEvent) body.upcomingEvents = [...body.upcomingEvents ?? cur.upcomingEvents.map(({ title, date: date5, type }) => ({ title, date: date5, type })), ...o.addEvent.map(parseEvent)];
|
|
21000
|
+
if (o.addSocial) {
|
|
21001
|
+
const added = o.addSocial.map(parseSocial);
|
|
21002
|
+
const key = (s) => JSON.stringify([s.platform, s.handle]);
|
|
21003
|
+
const existing = body.socials ?? cur.socials;
|
|
21004
|
+
body.socials = [...existing, ...added.filter((s) => !existing.some((e) => key(e) === key(s)))];
|
|
21005
|
+
}
|
|
21006
|
+
if (o.addRelationship) {
|
|
21007
|
+
const existing = body.relationships ?? cur.relationships;
|
|
21008
|
+
body.relationships = [...existing, ...o.addRelationship.filter((r) => !existing.includes(r))];
|
|
21009
|
+
}
|
|
20457
21010
|
}
|
|
20458
21011
|
if (!Object.keys(body).length) throw new CliError("usage", "Nothing to change. Pass a JSON input or flags like --summary, --potential, --add-pain", EXIT.usage);
|
|
20459
21012
|
const { customer } = await api.updateCustomer(id, body);
|
|
@@ -20463,12 +21016,14 @@ program.command("get").description("Show one customer").argument("<id>").action(
|
|
|
20463
21016
|
const { customer } = await (await client()).getCustomer(id);
|
|
20464
21017
|
out(detail(customer), { customer });
|
|
20465
21018
|
});
|
|
20466
|
-
program.command("list").description("List customers (newest update first), optionally filtered").option("--potential <High|Medium|Low>").option("--city <s>", "exact city (case-insensitive)").option("--tag <s>", "has this pain-point tag").option("--due-today", "has a calendar event today (your local date)").option("--due <YYYY-MM-DD>", "has a calendar event on this date").option("-q, --query <s>", "keyword across name, company, title, city, wechat, summary, notes, tags, goals").action(async (o) => {
|
|
21019
|
+
program.command("list").description("List customers (newest update first), optionally filtered").option("--potential <High|Medium|Low>").option("--city <s>", "exact city (case-insensitive)").option("--tag <s>", "has this pain-point tag").option("--social-platform <s>", "has a social account on this platform (e.g. xiaohongshu, channels, email)").option("--relationship <s>", "has this relationship to the user (e.g. \u7532\u65B9 / client, \u5B66\u5458 / student, \u6E20\u9053\u65B9 / channel)").option("--due-today", "has a calendar event today (your local date)").option("--due <YYYY-MM-DD>", "has a calendar event on this date").option("-q, --query <s>", "keyword across name, company, title, city, wechat, social accounts, relationships, summary, notes, tags, goals").action(async (o) => {
|
|
20467
21020
|
const { customers } = await (await client()).listCustomers({
|
|
20468
21021
|
potential: o.potential ? potentialOf(o.potential) : void 0,
|
|
20469
21022
|
city: o.city,
|
|
20470
21023
|
tag: o.tag,
|
|
20471
21024
|
q: o.query,
|
|
21025
|
+
socialPlatform: o.socialPlatform,
|
|
21026
|
+
relationship: o.relationship,
|
|
20472
21027
|
dueOn: o.dueToday ? today() : o.due
|
|
20473
21028
|
});
|
|
20474
21029
|
out(customers.length ? customers.map(line).join("\n") : "No customers match.", { customers, count: customers.length });
|
|
@@ -20540,11 +21095,11 @@ prompts.command("list").description("List templates. `customized` marks the ones
|
|
|
20540
21095
|
{ prompts: list, path: promptsPath }
|
|
20541
21096
|
);
|
|
20542
21097
|
});
|
|
20543
|
-
prompts.command("show").description("Print a template. With --customer, {{name}} {{company}} {{title}} {{city}} {{wechatId}} are filled in from that customer (and --json includes the customer profile as context).").argument("<id>", "template id, see `crm prompts list`").option("--customer <id>", "fill the placeholders from this customer").addOption(langOption()).action(async (id, o) => {
|
|
21098
|
+
prompts.command("show").description("Print a template. With --customer, {{name}} {{company}} {{title}} {{city}} {{wechatId}} {{socials}} are filled in from that customer (and --json includes the customer profile as context).").argument("<id>", "template id, see `crm prompts list`").option("--customer <id>", "fill the placeholders from this customer").addOption(langOption()).action(async (id, o) => {
|
|
20544
21099
|
const p = resolvePrompts(langOf(o), await loadCustom()).find((x) => x.id === id);
|
|
20545
21100
|
if (!p) throw new CliError("not_found", `No template "${id}". Run \`crm prompts list\``, EXIT.usage);
|
|
20546
21101
|
const customer = o.customer ? (await (await client()).getCustomer(o.customer)).customer : void 0;
|
|
20547
|
-
const rendered = renderPrompt(p.prompt, customer);
|
|
21102
|
+
const rendered = renderPrompt(p.prompt, customer && { ...customer, socials: customer.socials.map((s) => `${socialPlatformLabel(s.platform, langOf(o))}: ${s.handle}`) });
|
|
20548
21103
|
out(rendered, { id: p.id, kind: p.kind, label: p.label, prompt: rendered, template: p.prompt, customized: p.customized, ...customer ? { customer } : {} });
|
|
20549
21104
|
});
|
|
20550
21105
|
prompts.command("set").description("Change a built-in template or add your own. Text comes from --prompt, a file, or stdin (`-`). Saved on this machine only.").argument("<id>", "a built-in id (to override it) or a new id (letters, digits, - and _)").argument("[file]", "file with the template text, or - for stdin").option("--prompt <text>", "template text").option("--label <text>", "display name").action(async (id, src, o) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insightcrm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Command line and agent skill for InsightCRM: file customers from chats and screenshots with your own AI agent. Non-interactive, --json output, stable exit codes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|