insightcrm 0.1.6 → 0.1.8
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 +2 -0
- package/SKILL.md +28 -3
- package/dist/cli.js +156 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ crm schema --json # 字段契约,含每个字段的填写
|
|
|
11
11
|
echo '{"name":"王小明","company":"ACME"}' | crm add - --json
|
|
12
12
|
crm add --name "王小明" --social channels:@wm email:wm@example.com # 视频号 / 小红书 / 邮箱等社交账号
|
|
13
13
|
crm add --name "王小明" --relationship 学员 社群成员 # 他在你这里是什么身份(可多个)
|
|
14
|
+
crm add --name "王小明" --org "同济大学:在职教师:在职" # 他挂着的单位(可多个,机构名:身份:状态)
|
|
14
15
|
crm list --relationship 甲方 --json # 甲方名单
|
|
16
|
+
crm list --org 同济 --json # 挂在某个机构的客户
|
|
15
17
|
crm list --due-today --json
|
|
16
18
|
crm version # 当前版本 + npm 上有没有新版
|
|
17
19
|
crm skill # 打印给 agent 的使用说明;在 agent 指令里加一句「先运行 crm skill」
|
package/SKILL.md
CHANGED
|
@@ -60,6 +60,14 @@ crm login https://<服务器地址>
|
|
|
60
60
|
- 转化了**追加**新关系,别删旧的——学员变甲方,两个都留着,路径才追得回。
|
|
61
61
|
- 没有依据就留空,不要编。命令行写法:`--relationship 学员 甲方`。
|
|
62
62
|
|
|
63
|
+
**单位 `orgs`**:这个人挂着的**所有**机构——公司、学校、协会、平台、实验室。
|
|
64
|
+
- 元素形如 `{"org":"同济大学建筑与城市规划学院","role":"在职教师","status":"current"}`。`role` 是在这个机构里的身份 / 职位(自由文本);`status` 是受控词表。
|
|
65
|
+
- `status` 写中文就行(`在职`、`已离职`、`在读`、`校友`、`创始人`、`顾问`),会自动归一化;**分不清就填 `unknown`,别猜**。
|
|
66
|
+
- **一个人常常同时有多个单位**:高校教师 + 博士在读 + 平台共建;企业服务平台 + 协会任职 + 园区平台发起人。**都要写,履历和现任都写**,别只留现在的。
|
|
67
|
+
- `company` 只写**主单位**(现在最主要的那一个),完整清单放 `orgs`。两者不冲突:`company` 是给人看的摘要,`orgs` 是可筛选的结构化数据。
|
|
68
|
+
- 机构名**照抄材料里的写法**,不要擅自合并全称和简称(「上海开索人工智能科技有限公司」和「开索 AI」是两个写法,别自己并成一个)。按机构筛选用的是包含匹配,简称也能命中。
|
|
69
|
+
- 材料里没出现就整条省略,**不要编造**。命令行写法:`--org "同济大学:在职教师:在职" "浙江理工大学:博士在读:在读"`(机构名:身份:状态,身份可省略)。
|
|
70
|
+
|
|
63
71
|
**日程 `upcomingEvents`**:`{title, date, type}` 的数组,`date` 是 `YYYY-MM-DD`,`type` 是 `meeting` / `follow_up` / `deadline` / `other`。
|
|
64
72
|
- 今天是几号要自己确认,相对日期(「下周三」)按今天换算成具体日期。
|
|
65
73
|
- **已经过去的日期不要录**。
|
|
@@ -70,6 +78,20 @@ crm login https://<服务器地址>
|
|
|
70
78
|
- **名片**:重点是身份(`name` / `company` / `title`),名片上的邮箱写进 `socials`(`platform` 用 `email`)。
|
|
71
79
|
- **聊天记录**:除了画像,还要找**钩子**(见下)。
|
|
72
80
|
|
|
81
|
+
**图片材料以原图为准**:
|
|
82
|
+
|
|
83
|
+
截图里的**名字、账号、地区、英文缩写**必须放大逐字核对再写进字段。导出工具附带的元数据(`chat.txt` 里的昵称、地区、关键词)是自动抽取的结果,**会错**:图上可能根本没有那个字段,也可能把 OPC 抽成 OPIC、把城市抽成「中国社会」。用户的口头转述同样可能沿用了错值,以图为准。
|
|
84
|
+
|
|
85
|
+
- 放大核对:先看尺寸,再裁出目标区域放大到能逐字辨认。
|
|
86
|
+
```bash
|
|
87
|
+
sips -g pixelWidth -g pixelHeight screen.png
|
|
88
|
+
ffmpeg -i screen.png -vf "crop=290:120:0:0,scale=1160:480:flags=lanczos" out.png
|
|
89
|
+
```
|
|
90
|
+
- 只在元数据里出现、原图上找不到的,写成「导出元数据记作 X(图片未佐证)」,别当成事实。
|
|
91
|
+
- **判断是不是同一个人,头像一致是最硬的证据**,比文字描述可靠;不同平台头像不同很正常,不要据此起疑。
|
|
92
|
+
- 性别、真实姓名这类「看起来像事实」的东西,原图上没有书面依据就不要写——微信名片、小红书主页、私信截图都不含性别信息,照片也认不出人,中文名尤其不能靠猜。
|
|
93
|
+
- 核对出旧档案写错了,回头改掉,并在 `notes` 里留一段**更正说明**写清原来错在哪、正确是什么,别静默改掉——错值留痕才知道当时错在哪。
|
|
94
|
+
|
|
73
95
|
## 成功钩子
|
|
74
96
|
|
|
75
97
|
钩子 = 对话里**哪句话、哪个说法成功引起了对方的注意,或带来了正向回复**,以及为什么有效。它是跨客户复用的话术资产,是这个产品最有价值的数据。
|
|
@@ -86,14 +108,16 @@ crm login https://<服务器地址>
|
|
|
86
108
|
|
|
87
109
|
| 想做的事 | 用 |
|
|
88
110
|
|---|---|
|
|
89
|
-
| 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` |
|
|
90
|
-
| **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship`,或 JSON 里直接传数组 |
|
|
111
|
+
| 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 / 单位 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` / `--add-org` |
|
|
112
|
+
| **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship` / `--org`,或 JSON 里直接传数组 |
|
|
91
113
|
| 清空日程 | `--clear-events` |
|
|
92
114
|
|
|
93
115
|
`upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。
|
|
94
116
|
|
|
95
117
|
`socials` 同理:传了就是**整体替换**。只想补一个号,用 `--add-social channels:@san三`。
|
|
96
118
|
|
|
119
|
+
`orgs` 也一样:传了就是**整体替换**。只想补一个单位,用 `--add-org "同济大学:在职教师:在职"`。
|
|
120
|
+
|
|
97
121
|
`summary` 是对这个客户的整体描述。合并新材料时,是在原有摘要上补充,不是整段覆盖掉已有的信息:先 `crm get <id> --json` 读出旧内容再写。
|
|
98
122
|
|
|
99
123
|
## 查询
|
|
@@ -102,9 +126,10 @@ crm login https://<服务器地址>
|
|
|
102
126
|
crm list --potential high --city 北京 --json # 按等级、城市、标签筛选
|
|
103
127
|
crm list --due-today --json # 今天有日程的客户(今天要联系谁)
|
|
104
128
|
crm list --due 2026-10-20 --json
|
|
105
|
-
crm list -q 跨境 --json #
|
|
129
|
+
crm list -q 跨境 --json # 关键词:姓名、公司、职位、城市、微信、社交账号、关系、单位、摘要、备注、标签、目标
|
|
106
130
|
crm list --social-platform xiaohongshu --json # 有小红书账号的客户
|
|
107
131
|
crm list --relationship 甲方 --json # 甲方名单(写 client 一样命中)
|
|
132
|
+
crm list --org 同济 --json # 挂在某个机构的客户(包含匹配,简称也能命中)
|
|
108
133
|
crm get <id> --json
|
|
109
134
|
```
|
|
110
135
|
|
package/dist/cli.js
CHANGED
|
@@ -156,6 +156,8 @@ var RELATIONSHIPS = [
|
|
|
156
156
|
// 合伙人:合作项目、联合孵化
|
|
157
157
|
"member",
|
|
158
158
|
// 社群成员
|
|
159
|
+
"guest",
|
|
160
|
+
// 访谈嘉宾:上过我的访谈节目
|
|
159
161
|
"supplier",
|
|
160
162
|
// 服务方:给我干活的外包、乙方
|
|
161
163
|
"mentor",
|
|
@@ -165,6 +167,22 @@ var RELATIONSHIPS = [
|
|
|
165
167
|
"other"
|
|
166
168
|
// 其他
|
|
167
169
|
];
|
|
170
|
+
var ORG_STATUSES = [
|
|
171
|
+
"current",
|
|
172
|
+
// 在职:现在在这里
|
|
173
|
+
"former",
|
|
174
|
+
// 已离职:曾经在这里
|
|
175
|
+
"student",
|
|
176
|
+
// 在读:学生 / 博士生
|
|
177
|
+
"alumni",
|
|
178
|
+
// 校友:已毕业
|
|
179
|
+
"founder",
|
|
180
|
+
// 创始人 / 合伙人
|
|
181
|
+
"advisor",
|
|
182
|
+
// 顾问 / 兼职
|
|
183
|
+
"unknown"
|
|
184
|
+
// 未明示:只知道有这么个机构,关系待确认
|
|
185
|
+
];
|
|
168
186
|
var EXIT = {
|
|
169
187
|
ok: 0,
|
|
170
188
|
error: 1,
|
|
@@ -475,6 +493,13 @@ var RELATIONSHIP_ALIASES = {
|
|
|
475
493
|
\u7FA4\u53CB: "member",
|
|
476
494
|
\u793E\u533A\u6210\u5458: "member",
|
|
477
495
|
\u793E\u7FA4: "member",
|
|
496
|
+
// 访谈嘉宾
|
|
497
|
+
guest: "guest",
|
|
498
|
+
podcast_guest: "guest",
|
|
499
|
+
\u8BBF\u8C08\u5609\u5BBE: "guest",
|
|
500
|
+
\u53D7\u8BBF\u5609\u5BBE: "guest",
|
|
501
|
+
\u64AD\u5BA2\u5609\u5BBE: "guest",
|
|
502
|
+
\u5609\u5BBE: "guest",
|
|
478
503
|
// 服务方
|
|
479
504
|
supplier: "supplier",
|
|
480
505
|
vendor: "supplier",
|
|
@@ -516,6 +541,7 @@ var RELATIONSHIP_LABELS = {
|
|
|
516
541
|
channel: { zh: "\u6E20\u9053\u65B9", en: "Channel partner" },
|
|
517
542
|
partner: { zh: "\u5408\u4F19\u4EBA", en: "Partner" },
|
|
518
543
|
member: { zh: "\u793E\u7FA4\u6210\u5458", en: "Community member" },
|
|
544
|
+
guest: { zh: "\u8BBF\u8C08\u5609\u5BBE", en: "Podcast guest" },
|
|
519
545
|
supplier: { zh: "\u670D\u52A1\u65B9", en: "Supplier" },
|
|
520
546
|
mentor: { zh: "\u524D\u8F88", en: "Mentor" },
|
|
521
547
|
friend: { zh: "\u4E2A\u4EBA\u5173\u7CFB", en: "Friend" },
|
|
@@ -525,6 +551,78 @@ function relationshipLabel(relationship, lang = "zh") {
|
|
|
525
551
|
return RELATIONSHIP_LABELS[relationship]?.[lang] ?? relationship;
|
|
526
552
|
}
|
|
527
553
|
|
|
554
|
+
// ../shared/src/org.ts
|
|
555
|
+
var ORG_STATUS_ALIASES = {
|
|
556
|
+
// 在职
|
|
557
|
+
current: "current",
|
|
558
|
+
employee: "current",
|
|
559
|
+
\u5728\u804C: "current",
|
|
560
|
+
\u73B0\u4EFB: "current",
|
|
561
|
+
\u4EFB\u804C: "current",
|
|
562
|
+
// 已离职
|
|
563
|
+
former: "former",
|
|
564
|
+
ex: "former",
|
|
565
|
+
past: "former",
|
|
566
|
+
\u5DF2\u79BB\u804C: "former",
|
|
567
|
+
\u79BB\u804C: "former",
|
|
568
|
+
\u524D: "former",
|
|
569
|
+
\u66FE\u4EFB: "former",
|
|
570
|
+
\u5386\u4EFB: "former",
|
|
571
|
+
// 在读
|
|
572
|
+
student: "student",
|
|
573
|
+
\u5728\u8BFB: "student",
|
|
574
|
+
\u5C31\u8BFB: "student",
|
|
575
|
+
\u535A\u58EB\u751F: "student",
|
|
576
|
+
\u7855\u58EB\u751F: "student",
|
|
577
|
+
// 校友
|
|
578
|
+
alumni: "alumni",
|
|
579
|
+
\u6821\u53CB: "alumni",
|
|
580
|
+
\u6BD5\u4E1A: "alumni",
|
|
581
|
+
// 创始人
|
|
582
|
+
founder: "founder",
|
|
583
|
+
cofounder: "founder",
|
|
584
|
+
\u521B\u59CB\u4EBA: "founder",
|
|
585
|
+
\u8054\u5408\u521B\u59CB\u4EBA: "founder",
|
|
586
|
+
\u5408\u4F19\u4EBA: "founder",
|
|
587
|
+
\u53D1\u8D77\u4EBA: "founder",
|
|
588
|
+
// 顾问
|
|
589
|
+
advisor: "advisor",
|
|
590
|
+
consultant: "advisor",
|
|
591
|
+
\u987E\u95EE: "advisor",
|
|
592
|
+
\u517C\u804C: "advisor",
|
|
593
|
+
\u7279\u8058: "advisor",
|
|
594
|
+
// 未明示
|
|
595
|
+
unknown: "unknown",
|
|
596
|
+
\u672A\u660E\u793A: "unknown",
|
|
597
|
+
\u5F85\u786E\u8BA4: "unknown"
|
|
598
|
+
};
|
|
599
|
+
var LOOKUP4 = /* @__PURE__ */ new Map();
|
|
600
|
+
for (const s of ORG_STATUSES) LOOKUP4.set(s.toLowerCase(), s);
|
|
601
|
+
for (const [alias, canonical] of Object.entries(ORG_STATUS_ALIASES)) LOOKUP4.set(alias.toLowerCase(), canonical);
|
|
602
|
+
function normalizeOrgStatus(input2) {
|
|
603
|
+
if (!input2) return "unknown";
|
|
604
|
+
const cleaned = input2.replace(/[ \s]+/g, " ").trim();
|
|
605
|
+
if (!cleaned) return "unknown";
|
|
606
|
+
return LOOKUP4.get(cleaned.toLowerCase()) ?? cleaned;
|
|
607
|
+
}
|
|
608
|
+
var isKnownOrgStatus = (input2) => ORG_STATUSES.includes(normalizeOrgStatus(input2));
|
|
609
|
+
var ORG_STATUS_LABELS = {
|
|
610
|
+
current: { zh: "\u5728\u804C", en: "Current" },
|
|
611
|
+
former: { zh: "\u5DF2\u79BB\u804C", en: "Former" },
|
|
612
|
+
student: { zh: "\u5728\u8BFB", en: "Student" },
|
|
613
|
+
alumni: { zh: "\u6821\u53CB", en: "Alumni" },
|
|
614
|
+
founder: { zh: "\u521B\u59CB\u4EBA", en: "Founder" },
|
|
615
|
+
advisor: { zh: "\u987E\u95EE", en: "Advisor" },
|
|
616
|
+
unknown: { zh: "\u672A\u660E\u793A", en: "Unknown" }
|
|
617
|
+
};
|
|
618
|
+
function orgStatusLabel(status, lang = "zh") {
|
|
619
|
+
return ORG_STATUS_LABELS[status]?.[lang] ?? status;
|
|
620
|
+
}
|
|
621
|
+
function normalizeOrgName(input2) {
|
|
622
|
+
if (!input2) return "";
|
|
623
|
+
return input2.replace(/[ \s]+/g, " ").trim();
|
|
624
|
+
}
|
|
625
|
+
|
|
528
626
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
|
|
529
627
|
var external_exports = {};
|
|
530
628
|
__export(external_exports, {
|
|
@@ -20252,6 +20350,11 @@ var socialLink = external_exports.object({
|
|
|
20252
20350
|
handle: external_exports.string().trim().min(1).max(200),
|
|
20253
20351
|
url: external_exports.string().trim().max(2e3).nullable().optional()
|
|
20254
20352
|
});
|
|
20353
|
+
var orgLink = external_exports.object({
|
|
20354
|
+
org: external_exports.string().trim().min(1).max(200).transform(normalizeOrgName),
|
|
20355
|
+
role: external_exports.string().trim().max(200).nullable().optional(),
|
|
20356
|
+
status: external_exports.string().trim().min(1).max(50).transform(normalizeOrgStatus)
|
|
20357
|
+
});
|
|
20255
20358
|
var eventInput = external_exports.object({
|
|
20256
20359
|
title: short(200).min(1),
|
|
20257
20360
|
date: isoDate,
|
|
@@ -20271,6 +20374,8 @@ var customerShape = {
|
|
|
20271
20374
|
socials: external_exports.array(socialLink).max(50),
|
|
20272
20375
|
/** 关系:这个人是谁。可以多个,按重要性从高到低。整体替换 */
|
|
20273
20376
|
relationships: external_exports.array(external_exports.string().trim().min(1).max(50).transform(normalizeRelationship)).max(20),
|
|
20377
|
+
/** 关联的机构:一个人可以挂多个单位。整体替换 */
|
|
20378
|
+
orgs: external_exports.array(orgLink).max(30),
|
|
20274
20379
|
summary: short(5e3),
|
|
20275
20380
|
painPoints: tags,
|
|
20276
20381
|
goals: tags,
|
|
@@ -20324,13 +20429,24 @@ var socialFields = [
|
|
|
20324
20429
|
{ 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
20430
|
{ 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
20431
|
];
|
|
20432
|
+
var orgFields = [
|
|
20433
|
+
{ name: "org", type: "string", required: true, guide: "\u673A\u6784\u540D\uFF1A\u516C\u53F8\u3001\u5B66\u6821\u3001\u534F\u4F1A\u3001\u5E73\u53F0\u3001\u5B9E\u9A8C\u5BA4\u7B49\uFF0C\u5982\u300C\u540C\u6D4E\u5927\u5B66\u5EFA\u7B51\u4E0E\u57CE\u5E02\u89C4\u5212\u5B66\u9662\u300D\u300C\u4E0A\u6D77\u5E02\u5408\u540C\u4FE1\u7528\u4FC3\u8FDB\u4F1A\u300D" },
|
|
20434
|
+
{ name: "role", type: "string", nullable: true, guide: "\u5728\u8FD9\u4E2A\u673A\u6784\u91CC\u7684\u8EAB\u4EFD\u6216\u804C\u4F4D\uFF0C\u5982\u300C\u5728\u804C\u6559\u5E08\u300D\u300C\u79D8\u4E66\u957F\u300D\u300C\u8054\u5408\u521B\u59CB\u4EBA\u300D\u3002\u6750\u6599\u91CC\u6CA1\u5199\u5C31\u7701\u7565\uFF0C\u4E0D\u8981\u7F16\u9020" },
|
|
20435
|
+
{
|
|
20436
|
+
name: "status",
|
|
20437
|
+
type: "enum",
|
|
20438
|
+
required: true,
|
|
20439
|
+
values: ORG_STATUSES,
|
|
20440
|
+
guide: "\u8DDF\u8FD9\u4E2A\u673A\u6784\u7684\u5173\u7CFB\u72B6\u6001\u3002\u5199\u300C\u5728\u804C\u300D\u300C\u73B0\u4EFB\u300D\u300C\u5DF2\u79BB\u804C\u300D\u300C\u5728\u8BFB\u300D\u300C\u6821\u53CB\u300D\u7B49\u4E2D\u6587\u4F1A\u81EA\u52A8\u5F52\u4E00\u5316\uFF1B\u6E05\u5355\u5916\u7684\u5199\u6CD5\u4E0D\u62A5\u9519\uFF0C\u539F\u6837\u4FDD\u7559\u3002\u5206\u4E0D\u6E05\u5C31\u586B unknown\u3002"
|
|
20441
|
+
}
|
|
20442
|
+
];
|
|
20327
20443
|
var SCHEMA = {
|
|
20328
20444
|
customer: {
|
|
20329
20445
|
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",
|
|
20330
20446
|
fields: [
|
|
20331
20447
|
{ 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" },
|
|
20332
|
-
{ name: "company", type: "string", guide: "\
|
|
20333
|
-
{ name: "title", type: "string", guide: "\u804C\u4F4D\u6216\u8EAB\u4EFD" },
|
|
20448
|
+
{ name: "company", type: "string", guide: "\u4E3B\u5355\u4F4D\uFF1A\u4ED6\u73B0\u5728\u6700\u4E3B\u8981\u7684\u90A3\u4E2A\u673A\u6784\u7B80\u79F0\uFF0C\u5982\u300C\u5F00\u7D22 AI\u300D\u300C\u4E0A\u6D77\u7D22\u95FC\u79D1\u6280\u300D\u3002\u5B8C\u6574\u7684\u673A\u6784\u6E05\u5355\u5199\u8FDB orgs" },
|
|
20449
|
+
{ name: "title", type: "string", guide: "\u804C\u4F4D\u6216\u8EAB\u4EFD\u3002\u4E3B\u5355\u4F4D\u91CC\u7684\u804C\u4F4D\uFF0C\u5982\u300C\u521B\u59CB\u4EBA\u517C CEO\u300D\u3002\u591A\u4E2A\u8EAB\u4EFD\u5199\u8FDB orgs \u7684 role" },
|
|
20334
20450
|
{ 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" },
|
|
20335
20451
|
{ name: "wechatId", type: "string", nullable: true, guide: "\u5FAE\u4FE1\u53F7\u3002\u53EA\u5728\u5BF9\u8BDD\u91CC\u660E\u786E\u51FA\u73B0\u65F6\u586B\u5199" },
|
|
20336
20452
|
{
|
|
@@ -20345,6 +20461,12 @@ var SCHEMA = {
|
|
|
20345
20461
|
values: RELATIONSHIPS,
|
|
20346
20462
|
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
20463
|
},
|
|
20464
|
+
{
|
|
20465
|
+
name: "orgs",
|
|
20466
|
+
type: "object[]",
|
|
20467
|
+
fields: orgFields,
|
|
20468
|
+
guide: "\u5173\u8054\u7684\u673A\u6784\uFF1A\u8FD9\u4E2A\u4EBA\u6302\u7740\u7684\u6240\u6709\u5355\u4F4D\u3002\u4E00\u4E2A\u4EBA\u5E38\u5E38\u540C\u65F6\u6709\u591A\u4E2A\uFF08\u9AD8\u6821\u6559\u5E08 + \u535A\u58EB\u5728\u8BFB + \u5E73\u53F0\u5171\u5EFA\uFF1B\u4F01\u4E1A\u670D\u52A1\u5E73\u53F0 + \u534F\u4F1A\u4EFB\u804C + \u56ED\u533A\u5E73\u53F0\u53D1\u8D77\u4EBA\uFF09\uFF0C\u90FD\u5199\u8FDB\u6765\u3002\u5143\u7D20\u5F62\u5982 {org:'\u540C\u6D4E\u5927\u5B66\u5EFA\u7B51\u4E0E\u57CE\u5E02\u89C4\u5212\u5B66\u9662', role:'\u5728\u804C\u6559\u5E08', status:'current'}\u3002status \u533A\u5206\u73B0\u5728\u8FD8\u662F\u8FC7\u53BB\uFF08\u5728\u804C / \u5DF2\u79BB\u804C / \u5728\u8BFB / \u6821\u53CB / \u521B\u59CB\u4EBA / \u987E\u95EE / \u672A\u660E\u793A\uFF09\uFF0C\u5C65\u5386\u4E0E\u73B0\u4EFB\u90FD\u5199\uFF0C\u522B\u53EA\u7559\u73B0\u5728\u7684\u3002\u6CA1\u6709\u4F9D\u636E\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"
|
|
20469
|
+
},
|
|
20348
20470
|
{ 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" },
|
|
20349
20471
|
{ 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" },
|
|
20350
20472
|
{ name: "goals", type: "string[]", guide: "\u77ED\u671F\u76EE\u6807\uFF0C\u6BCF\u6761\u4E00\u53E5\u8BDD" },
|
|
@@ -20438,7 +20560,7 @@ function renderPrompt(text, customer) {
|
|
|
20438
20560
|
// package.json
|
|
20439
20561
|
var package_default = {
|
|
20440
20562
|
name: "insightcrm",
|
|
20441
|
-
version: "0.1.
|
|
20563
|
+
version: "0.1.8",
|
|
20442
20564
|
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.",
|
|
20443
20565
|
license: "MIT",
|
|
20444
20566
|
type: "module",
|
|
@@ -20550,6 +20672,22 @@ function createClient(apiUrl, token) {
|
|
|
20550
20672
|
};
|
|
20551
20673
|
}
|
|
20552
20674
|
|
|
20675
|
+
// src/org.ts
|
|
20676
|
+
function parseOrg(s) {
|
|
20677
|
+
const parts = s.split(":").map((p) => p.trim());
|
|
20678
|
+
const org = parts[0] ?? "";
|
|
20679
|
+
if (!org) throw new CliError("usage", `Can't read organization "${s}". Use name[:role[:status]], e.g. \u540C\u6D4E\u5927\u5B66:\u5728\u804C\u6559\u5E08:\u5728\u804C`, EXIT.usage);
|
|
20680
|
+
if (parts.length === 1) return { org, status: "unknown" };
|
|
20681
|
+
if (parts.length === 2) {
|
|
20682
|
+
const second = parts[1];
|
|
20683
|
+
return isKnownOrgStatus(second) ? { org, status: second } : { org, role: second, status: "unknown" };
|
|
20684
|
+
}
|
|
20685
|
+
const role = parts.slice(1, -1).join(":");
|
|
20686
|
+
const status = parts[parts.length - 1];
|
|
20687
|
+
return { org, ...role ? { role } : {}, status };
|
|
20688
|
+
}
|
|
20689
|
+
var orgKey = (o) => JSON.stringify([o.org, o.status]);
|
|
20690
|
+
|
|
20553
20691
|
// src/prompts.ts
|
|
20554
20692
|
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
20555
20693
|
import path2 from "path";
|
|
@@ -20715,7 +20853,9 @@ Examples:
|
|
|
20715
20853
|
$ echo '{"name":"Wang Ming","company":"ACME","conversionPotential":"High"}' | crm add - --json
|
|
20716
20854
|
$ crm add --name "\u738B\u5C0F\u660E" --social channels:@san3 email:wang@example.com --json
|
|
20717
20855
|
$ crm add --name "\u738B\u5C0F\u660E" --relationship \u5B66\u5458 --relationship \u793E\u7FA4\u6210\u5458 --json
|
|
20856
|
+
$ crm add --name "\u738B\u5C0F\u660E" --org "\u540C\u6D4E\u5927\u5B66:\u5728\u804C\u6559\u5E08:\u5728\u804C" "\u6D59\u6C5F\u7406\u5DE5\u5927\u5B66:\u535A\u58EB\u5728\u8BFB:\u5728\u8BFB" --json
|
|
20718
20857
|
$ crm list --potential high --city Beijing --due-today --json
|
|
20858
|
+
$ crm list --org \u540C\u6D4E --json
|
|
20719
20859
|
$ crm update 3f2a\u2026 --summary "Needs a quote by Friday" --json
|
|
20720
20860
|
$ crm hook add --title "Opened with a peer case" --desc "Led with a competitor's result, then asked about theirs" --customer 3f2a\u2026
|
|
20721
20861
|
$ crm export -o backup.json`
|
|
@@ -20793,9 +20933,9 @@ function parseSocial(s) {
|
|
|
20793
20933
|
return { platform: platform2, handle };
|
|
20794
20934
|
}
|
|
20795
20935
|
function withCustomerOptions(cmd, forUpdate) {
|
|
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)" : ""}`);
|
|
20936
|
+
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)" : ""}`).option("--org <name:role:status...>", `organizations, e.g. \u540C\u6D4E\u5927\u5B66:\u5728\u804C\u6559\u5E08:\u5728\u804C\uFF08\u673A\u6784\u540D:\u8EAB\u4EFD:\u72B6\u6001\uFF0C\u8EAB\u4EFD\u53EF\u7701\u7565\uFF09${forUpdate ? " (replaces the whole list; see --add-org)" : ""}`);
|
|
20797
20937
|
if (forUpdate) {
|
|
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");
|
|
20938
|
+
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("--add-org <name:role:status...>", "append organizations, keeping existing ones (\u673A\u6784\u540D:\u8EAB\u4EFD:\u72B6\u6001)").option("--clear-events", "remove all calendar events");
|
|
20799
20939
|
} else {
|
|
20800
20940
|
cmd.option("--hook-title <s>", "also record a successful hook for this customer (needs --hook-desc)").option("--hook-desc <s>");
|
|
20801
20941
|
}
|
|
@@ -20826,6 +20966,7 @@ function buildCustomerBody(base, o) {
|
|
|
20826
20966
|
if (o.clearEvents) body.upcomingEvents = [];
|
|
20827
20967
|
if (o.social) body.socials = o.social.map(parseSocial);
|
|
20828
20968
|
if (o.relationship) body.relationships = o.relationship;
|
|
20969
|
+
if (o.org) body.orgs = o.org.map(parseOrg);
|
|
20829
20970
|
if (o.hookTitle || o.hookDesc) {
|
|
20830
20971
|
if (!o.hookTitle || !o.hookDesc) throw new CliError("usage", "--hook-title and --hook-desc go together", EXIT.usage);
|
|
20831
20972
|
body.socialHook = { title: o.hookTitle, description: o.hookDesc };
|
|
@@ -20843,6 +20984,7 @@ function detail(c) {
|
|
|
20843
20984
|
["wechat", c.wechatId ?? ""],
|
|
20844
20985
|
["socials", c.socials.map((s) => `${s.platform}: ${s.handle}${s.url ? ` (${s.url})` : ""}`).join("; ")],
|
|
20845
20986
|
["relationship", c.relationships.map((r) => relationshipLabel(r, "zh")).join(", ")],
|
|
20987
|
+
["orgs", (c.orgs ?? []).map((o) => `${o.org}${o.role ? ` \xB7 ${o.role}` : ""} [${orgStatusLabel(o.status, "zh")}]`).join("; ")],
|
|
20846
20988
|
["potential", c.conversionPotential],
|
|
20847
20989
|
["cycle days", String(c.conversionCycleDays)],
|
|
20848
20990
|
["pain points", c.painPoints.join(", ")],
|
|
@@ -20987,12 +21129,12 @@ withCustomerOptions(
|
|
|
20987
21129
|
out(`Created ${line(customer)}`, { customer, created: true });
|
|
20988
21130
|
});
|
|
20989
21131
|
withCustomerOptions(
|
|
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"),
|
|
21132
|
+
program.command("update").description("Change a customer. Only the fields you pass change. --pain / --goal / --event / --social / --relationship / --org REPLACE the list; --add-pain / --add-goal / --add-event / --add-social / --add-relationship / --add-org append.").argument("<id>").argument("[json-file]", "JSON file, or - for stdin"),
|
|
20991
21133
|
true
|
|
20992
21134
|
).action(async (id, src, o) => {
|
|
20993
21135
|
const api = await client();
|
|
20994
21136
|
const body = buildCustomerBody(await readJsonInput(src), o);
|
|
20995
|
-
if (o.addPain || o.addGoal || o.addEvent || o.addSocial || o.addRelationship) {
|
|
21137
|
+
if (o.addPain || o.addGoal || o.addEvent || o.addSocial || o.addRelationship || o.addOrg) {
|
|
20996
21138
|
const { customer: cur } = await api.getCustomer(id);
|
|
20997
21139
|
if (o.addPain) body.painPoints = [.../* @__PURE__ */ new Set([...body.painPoints ?? cur.painPoints, ...o.addPain])];
|
|
20998
21140
|
if (o.addGoal) body.goals = [.../* @__PURE__ */ new Set([...body.goals ?? cur.goals, ...o.addGoal])];
|
|
@@ -21007,6 +21149,11 @@ withCustomerOptions(
|
|
|
21007
21149
|
const existing = body.relationships ?? cur.relationships;
|
|
21008
21150
|
body.relationships = [...existing, ...o.addRelationship.filter((r) => !existing.includes(r))];
|
|
21009
21151
|
}
|
|
21152
|
+
if (o.addOrg) {
|
|
21153
|
+
const added = o.addOrg.map(parseOrg);
|
|
21154
|
+
const existing = body.orgs ?? cur.orgs;
|
|
21155
|
+
body.orgs = [...existing, ...added.filter((x) => !existing.some((e) => orgKey(e) === orgKey(x)))];
|
|
21156
|
+
}
|
|
21010
21157
|
}
|
|
21011
21158
|
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);
|
|
21012
21159
|
const { customer } = await api.updateCustomer(id, body);
|
|
@@ -21016,7 +21163,7 @@ program.command("get").description("Show one customer").argument("<id>").action(
|
|
|
21016
21163
|
const { customer } = await (await client()).getCustomer(id);
|
|
21017
21164
|
out(detail(customer), { customer });
|
|
21018
21165
|
});
|
|
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) => {
|
|
21166
|
+
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("--org <s>", "is affiliated with this organization (substring match, e.g. \u540C\u6D4E / \u535A\u4E16)").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, organizations, summary, notes, tags, goals").action(async (o) => {
|
|
21020
21167
|
const { customers } = await (await client()).listCustomers({
|
|
21021
21168
|
potential: o.potential ? potentialOf(o.potential) : void 0,
|
|
21022
21169
|
city: o.city,
|
|
@@ -21024,6 +21171,7 @@ program.command("list").description("List customers (newest update first), optio
|
|
|
21024
21171
|
q: o.query,
|
|
21025
21172
|
socialPlatform: o.socialPlatform,
|
|
21026
21173
|
relationship: o.relationship,
|
|
21174
|
+
org: o.org,
|
|
21027
21175
|
dueOn: o.dueToday ? today() : o.due
|
|
21028
21176
|
});
|
|
21029
21177
|
out(customers.length ? customers.map(line).join("\n") : "No customers match.", { customers, count: customers.length });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insightcrm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|