insightcrm 0.1.9 → 0.1.11
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 +1 -0
- package/SKILL.md +34 -3
- package/dist/cli.js +212 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ crm login https://<你的服务器> # 浏览器里点「允许」(设备
|
|
|
10
10
|
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
|
+
crm add --name "王小明" --wechat wm2024 --social wechat:小明 # 微信号用 --wechat,微信昵称用 wechat 平台;name 只写姓名本身
|
|
13
14
|
crm add --name "王小明" --relationship 学员 社群成员 # 他在你这里是什么身份(可多个)
|
|
14
15
|
crm add --name "王小明" --org "同济大学:在职教师:在职" # 他挂着的单位(可多个,机构名:身份:状态)
|
|
15
16
|
crm list --relationship 甲方 --json # 甲方名单
|
package/SKILL.md
CHANGED
|
@@ -37,6 +37,9 @@ crm login https://<服务器地址>
|
|
|
37
37
|
## 怎么从材料里抽取
|
|
38
38
|
|
|
39
39
|
**身份与联系**:`name`、`company`、`title`;`wechatId`、`city`。只填材料里明确出现的。看不到就省略,不要猜。
|
|
40
|
+
- **`name` 只写姓名本身**(含常用英文名,如「李源枫 Philip F. Yuan」),不超过 40 字,**不要带括号注释**。「白微微(微信名…,昵称…,微信号…)」这种写法会被服务端拒绝。
|
|
41
|
+
- 微信号(登录用的 ID)写 `wechatId`;微信昵称 / 显示名 / 群昵称写进 `socials`(`platform` 用 `wechat`,见下);职务、城市写各自字段;「真名未知」「shadow 备注」之类的说明写进 `notes`。
|
|
42
|
+
- 无法确定真名时,`name` 写对方使用的称呼,并在 `notes` 里注明真名未知。
|
|
40
43
|
`city` 取 `crm schema --json` 里 `city` 字段的 `values`(城市枚举);写成「上海市」「Shanghai」「臺北」也会被自动归一化成「上海」「上海」「台北」,所以直接按你看到的写就行。
|
|
41
44
|
|
|
42
45
|
**画像**:
|
|
@@ -48,7 +51,7 @@ crm login https://<服务器地址>
|
|
|
48
51
|
|
|
49
52
|
**社交账号 `socials`**:客户在其他平台上的号——视频号、小红书、邮箱、抖音、B站、公众号等。
|
|
50
53
|
- 元素形如 `{"platform":"channels","handle":"@san三"}`。`platform` 直接写中文也行(`视频号`、`小红书`、`邮箱`),会自动归一化到标准值。
|
|
51
|
-
-
|
|
54
|
+
- **微信昵称 / 显示名**用 `platform: "wechat"`,如 `{"platform":"wechat","handle":"白生"}`(`微信昵称` 也会归一化)。**微信号(ID)不放这里**,统一写 `wechatId`。
|
|
52
55
|
- 有主页链接就补 `"url"`,没有就省略,不要猜。
|
|
53
56
|
- 材料里没出现就整条省略,**不要编造**。邮箱也是:只在材料里明确写了邮箱才填。
|
|
54
57
|
- 命令行写法:`--social channels:@san三 email:zhang@example.com`(平台:账号)。
|
|
@@ -111,6 +114,8 @@ crm login https://<服务器地址>
|
|
|
111
114
|
- 写 `description` 时让别的客户场景也能照着用:写清楚话术本身和有效的原因,不要只写「聊得很好」。
|
|
112
115
|
- **找不到就别编。** 没有明确的「这句话奏效了」的证据,就不要创建钩子。宁可没有,不要一条虚构的。
|
|
113
116
|
- 想给新对话找灵感时:`crm hook list --json`。
|
|
117
|
+
- 钩子是独立库、按 `customerId` 关联的:`crm get <id>` 会把这个客户已有的钩子一起列出来(`--json` 时在 `hooks` 字段里)。
|
|
118
|
+
看到某个客户已经有钩子,就别重复建;看到没有、而这次对话里确实有一句话奏效了,就补一条。
|
|
114
119
|
|
|
115
120
|
## 更新已有客户
|
|
116
121
|
|
|
@@ -121,8 +126,9 @@ crm login https://<服务器地址>
|
|
|
121
126
|
| 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 / 单位 / 相关人物 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` / `--add-org` / `--add-related` |
|
|
122
127
|
| **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship` / `--org` / `--related`,或 JSON 里直接传数组 |
|
|
123
128
|
| 清空日程 | `--clear-events` |
|
|
129
|
+
| 删**某一天**的日程(其余保留) | `--remove-event 2026-11-01`;只删当天标题含某词的:`--remove-event 2026-11-01:Day2`。没命中会报错、不改任何数据 |
|
|
124
130
|
|
|
125
|
-
`upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline
|
|
131
|
+
`upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。只想删一个,用 `--remove-event`,同理别手写整个数组。
|
|
126
132
|
|
|
127
133
|
`socials` 同理:传了就是**整体替换**。只想补一个号,用 `--add-social channels:@san三`。
|
|
128
134
|
|
|
@@ -138,14 +144,39 @@ crm login https://<服务器地址>
|
|
|
138
144
|
crm list --potential high --city 北京 --json # 按等级、城市、标签筛选
|
|
139
145
|
crm list --due-today --json # 今天有日程的客户(今天要联系谁)
|
|
140
146
|
crm list --due 2026-10-20 --json
|
|
147
|
+
crm list --expired --json # 有过期日程的客户(日期早于今天,默认就是今天)
|
|
148
|
+
crm list --expired 2026-10-01 --json # 更早的截止日
|
|
141
149
|
crm list -q 跨境 --json # 关键词:姓名、公司、职位、城市、微信、社交账号、关系、单位、相关人物、摘要、备注、标签、目标
|
|
142
150
|
crm list --social-platform xiaohongshu --json # 有小红书账号的客户
|
|
143
151
|
crm list --relationship 甲方 --json # 甲方名单(写 client 一样命中)
|
|
144
|
-
crm list --org 同济 --json #
|
|
152
|
+
crm list --org 同济 --json # 挂在某个机构的客户(包含匹配,简称也能命中;company 和 orgs 都查)
|
|
145
153
|
crm list --related 李雅婷 --json # 和李雅婷有关系的人(含「被指向」的反向关联)
|
|
146
154
|
crm get <id> --json
|
|
147
155
|
```
|
|
148
156
|
|
|
157
|
+
## 体检(`crm lint`)
|
|
158
|
+
|
|
159
|
+
写入路径对拿不准的值是**刻意宽松**的:认不出来的 `orgs.status`、清单外的城市、过期日期都原样保留、不报错,
|
|
160
|
+
这是批量归档时想要的(一条写歪的记录不该打断整批)。代价是脏数据会悄悄攒起来。`crm lint` 就是那个能看见它们的入口。
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
crm lint --json # 全库体检:只报告,不改数据
|
|
164
|
+
crm lint --severity error --json # 只看会造成实际问题的(notes 超上限、状态越界、过期日程、悬空引用)
|
|
165
|
+
crm lint --kind company-prose --json # 只看某一类
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
报告的类别:`notes-over-limit`(会被服务端拒)、`notes-long`、`unknown-status`(状态不在受控词表里,按状态聚合会漏)、
|
|
169
|
+
`expired-event`(过期日程)、`dangling-related-id`(相关人物指向库里没有的人)、`duplicate-wechat`、
|
|
170
|
+
`company-prose`(company 写成了说明文而不是简称)、`company-without-orgs`、`orgs-without-company`、
|
|
171
|
+
`no-relationship`(不知道这个人是谁)、`city-off-list`、`half-width-punctuation`。
|
|
172
|
+
|
|
173
|
+
**lint 只报告,不改。** 要改就照着报告里的 id 逐条 `crm update`。
|
|
174
|
+
注意:`crm update` 会把 `last_updated` 顶到当前时间,把这条档案顶到列表最前面——
|
|
175
|
+
**批量清洗存量请走 `db:backfill-*` 脚本**(保留 `last_updated`、写审计日志),别用 update 循环。
|
|
176
|
+
|
|
177
|
+
写入时 CLI 会把拿不准的地方打到 stderr 当提醒(未知的 `orgs.status`、清单外的城市、过期的日程、写成说明文的 company)。
|
|
178
|
+
**这些是提醒不是错误**,写入照常成功——除非 `notes` 超过 10000 字符,那种会被服务端整条拒掉,所以 CLI 提前拦了一道。
|
|
179
|
+
|
|
149
180
|
## 推荐库(是用户的库存,不是聊天里挖出来的东西)
|
|
150
181
|
|
|
151
182
|
推荐库是**用户自己的待推荐库存**:他要推给客户的产品、服务、文章、活动。内容只来自用户本人。
|
package/dist/cli.js
CHANGED
|
@@ -116,6 +116,8 @@ var CITIES = [
|
|
|
116
116
|
var SOCIAL_PLATFORMS = [
|
|
117
117
|
"email",
|
|
118
118
|
// 邮箱
|
|
119
|
+
"wechat",
|
|
120
|
+
// 微信昵称 / 显示名(微信号写 wechatId,不放这里)
|
|
119
121
|
"channels",
|
|
120
122
|
// 视频号
|
|
121
123
|
"xiaohongshu",
|
|
@@ -347,6 +349,7 @@ function normalizeCity(input2) {
|
|
|
347
349
|
}
|
|
348
350
|
return cleaned;
|
|
349
351
|
}
|
|
352
|
+
var isKnownCity = (input2) => CITIES.includes(normalizeCity(input2));
|
|
350
353
|
|
|
351
354
|
// ../shared/src/social.ts
|
|
352
355
|
var SOCIAL_PLATFORM_ALIASES = {
|
|
@@ -357,6 +360,12 @@ var SOCIAL_PLATFORM_ALIASES = {
|
|
|
357
360
|
\u90AE\u7BB1: "email",
|
|
358
361
|
\u90AE\u4EF6: "email",
|
|
359
362
|
\u7535\u5B50\u90AE\u4EF6: "email",
|
|
363
|
+
// 微信昵称(微信号是 wechatId,不是这里)
|
|
364
|
+
wechat: "wechat",
|
|
365
|
+
\u5FAE\u4FE1: "wechat",
|
|
366
|
+
\u5FAE\u4FE1\u6635\u79F0: "wechat",
|
|
367
|
+
\u5FAE\u4FE1\u540D: "wechat",
|
|
368
|
+
\u5FAE\u4FE1\u663E\u793A\u540D: "wechat",
|
|
360
369
|
// 视频号
|
|
361
370
|
channels: "channels",
|
|
362
371
|
wechat_channels: "channels",
|
|
@@ -418,6 +427,7 @@ function normalizeSocialPlatform(input2) {
|
|
|
418
427
|
}
|
|
419
428
|
var SOCIAL_PLATFORM_LABELS = {
|
|
420
429
|
email: { zh: "\u90AE\u7BB1", en: "Email" },
|
|
430
|
+
wechat: { zh: "\u5FAE\u4FE1\u6635\u79F0", en: "WeChat name" },
|
|
421
431
|
channels: { zh: "\u89C6\u9891\u53F7", en: "Channels" },
|
|
422
432
|
xiaohongshu: { zh: "\u5C0F\u7EA2\u4E66", en: "Xiaohongshu" },
|
|
423
433
|
douyin: { zh: "\u6296\u97F3", en: "Douyin" },
|
|
@@ -633,6 +643,33 @@ function normalizeRelatedRelation(input2) {
|
|
|
633
643
|
return input2.replace(/[ \s]+/g, " ").trim();
|
|
634
644
|
}
|
|
635
645
|
|
|
646
|
+
// ../shared/src/profile.ts
|
|
647
|
+
var NOTES_MAX = 1e4;
|
|
648
|
+
var NOTES_LONG = 6e3;
|
|
649
|
+
var COMPANY_LONG = 80;
|
|
650
|
+
var NAME_MAX = 40;
|
|
651
|
+
function nameProblem(name) {
|
|
652
|
+
const n = (name ?? "").trim();
|
|
653
|
+
if (!n) return null;
|
|
654
|
+
const hint = "name \u53EA\u5199\u59D3\u540D\u672C\u8EAB\uFF1A\u5FAE\u4FE1\u53F7\u5199 wechatId\uFF0C\u5FAE\u4FE1\u6635\u79F0 / \u663E\u793A\u540D\u5199\u8FDB socials\uFF08platform=wechat\uFF09\uFF0C\u5176\u4F59\u8BF4\u660E\u5199\u8FDB notes";
|
|
655
|
+
if (n.length > NAME_MAX) return `name \u8FC7\u957F\uFF08${n.length} \u5B57\uFF0C\u4E0A\u9650 ${NAME_MAX}\uFF09\u3002${hint}`;
|
|
656
|
+
if (/[((][^))]*(微信|昵称|显示名|备注|手机|邮箱|真名|未知)/.test(n)) return `name \u91CC\u5E26\u4E86\u6CE8\u91CA\u6027\u62EC\u53F7\u3002${hint}`;
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
var CJK = /[一-鿿]/g;
|
|
660
|
+
function isProseCompany(company) {
|
|
661
|
+
const c = (company ?? "").trim();
|
|
662
|
+
if (!c) return false;
|
|
663
|
+
if (/^未明示|^未明确/.test(c)) return true;
|
|
664
|
+
const m = /((.+))\s*$/.exec(c);
|
|
665
|
+
if (m && m[1].length > 20 && (m[1].match(CJK) ?? []).length >= 12) return true;
|
|
666
|
+
return c.length > COMPANY_LONG;
|
|
667
|
+
}
|
|
668
|
+
function halfWidthPunctuation(text) {
|
|
669
|
+
const hits = text.match(/[一-鿿][,.:;!?]|[,;:!?][一-鿿]|[一-鿿]\([^)]{1,20}\)/g);
|
|
670
|
+
return hits ? [...new Set(hits)] : [];
|
|
671
|
+
}
|
|
672
|
+
|
|
636
673
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
|
|
637
674
|
var external_exports = {};
|
|
638
675
|
__export(external_exports, {
|
|
@@ -20381,7 +20418,10 @@ var socialHookInput = external_exports.object({
|
|
|
20381
20418
|
description: short(5e3).min(1)
|
|
20382
20419
|
});
|
|
20383
20420
|
var customerShape = {
|
|
20384
|
-
name: short(200).min(1),
|
|
20421
|
+
name: short(200).min(1).superRefine((v, ctx) => {
|
|
20422
|
+
const p = nameProblem(v);
|
|
20423
|
+
if (p) ctx.addIssue({ code: "custom", message: p });
|
|
20424
|
+
}),
|
|
20385
20425
|
company: short(200),
|
|
20386
20426
|
title: short(200),
|
|
20387
20427
|
city,
|
|
@@ -20442,7 +20482,7 @@ var socialFields = [
|
|
|
20442
20482
|
type: "enum",
|
|
20443
20483
|
required: true,
|
|
20444
20484
|
values: SOCIAL_PLATFORMS,
|
|
20445
|
-
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\
|
|
20485
|
+
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\u6635\u79F0 / \u663E\u793A\u540D\u7528 platform=wechat\uFF1B\u5FAE\u4FE1\u53F7\uFF08ID\uFF09\u4E0D\u653E\u8FD9\u91CC\uFF0C\u5199 wechatId\u3002"
|
|
20446
20486
|
},
|
|
20447
20487
|
{ 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" },
|
|
20448
20488
|
{ 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" }
|
|
@@ -20468,11 +20508,11 @@ var SCHEMA = {
|
|
|
20468
20508
|
customer: {
|
|
20469
20509
|
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",
|
|
20470
20510
|
fields: [
|
|
20471
|
-
{ name: "name", type: "string", required: true, guide: "\
|
|
20511
|
+
{ name: "name", type: "string", required: true, guide: "\u53EA\u5199\u59D3\u540D\u672C\u8EAB\uFF08\u542B\u5E38\u7528\u82F1\u6587\u540D\uFF0C\u5982\u300C\u674E\u6E90\u67AB Philip F. Yuan\u300D\uFF09\uFF0C\u4E0D\u8D85\u8FC7 40 \u5B57\uFF0C\u4E0D\u8981\u5E26\u62EC\u53F7\u6CE8\u91CA\u3002\u5FAE\u4FE1\u53F7\u5199 wechatId\uFF0C\u5FAE\u4FE1\u6635\u79F0 / \u663E\u793A\u540D / \u7FA4\u6635\u79F0\u5199\u8FDB socials\uFF08platform=wechat\uFF09\uFF0C\u804C\u52A1\u3001\u57CE\u5E02\u3001\u5907\u6CE8\u5199\u8FDB\u5404\u81EA\u5B57\u6BB5\u6216 notes\u3002\u65E0\u6CD5\u786E\u5B9A\u771F\u540D\u65F6\u5199\u5BF9\u65B9\u4F7F\u7528\u7684\u79F0\u547C\uFF0C\u300C\u771F\u540D\u672A\u77E5\u300D\u4E4B\u7C7B\u7684\u8BF4\u660E\u5199\u8FDB notes" },
|
|
20472
20512
|
{ 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" },
|
|
20473
20513
|
{ 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" },
|
|
20474
20514
|
{ 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" },
|
|
20475
|
-
{ name: "wechatId", type: "string", nullable: true, guide: "\u5FAE\u4FE1\u53F7\u3002\u53EA\u5728\u5BF9\u8BDD\u91CC\u660E\u786E\u51FA\u73B0\u65F6\u586B\u5199" },
|
|
20515
|
+
{ name: "wechatId", type: "string", nullable: true, guide: "\u5FAE\u4FE1\u53F7\uFF08\u767B\u5F55\u7528\u7684 ID\uFF0C\u5982 elphawhite\uFF09\u3002\u53EA\u5728\u5BF9\u8BDD\u91CC\u660E\u786E\u51FA\u73B0\u65F6\u586B\u5199\u3002\u5FAE\u4FE1\u6635\u79F0 / \u663E\u793A\u540D\u4E0D\u662F\u5FAE\u4FE1\u53F7\uFF0C\u5199\u8FDB socials" },
|
|
20476
20516
|
{
|
|
20477
20517
|
name: "socials",
|
|
20478
20518
|
type: "object[]",
|
|
@@ -20590,7 +20630,7 @@ function renderPrompt(text, customer) {
|
|
|
20590
20630
|
// package.json
|
|
20591
20631
|
var package_default = {
|
|
20592
20632
|
name: "insightcrm",
|
|
20593
|
-
version: "0.1.
|
|
20633
|
+
version: "0.1.11",
|
|
20594
20634
|
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.",
|
|
20595
20635
|
license: "MIT",
|
|
20596
20636
|
type: "module",
|
|
@@ -20702,6 +20742,96 @@ function createClient(apiUrl, token) {
|
|
|
20702
20742
|
};
|
|
20703
20743
|
}
|
|
20704
20744
|
|
|
20745
|
+
// src/lint.ts
|
|
20746
|
+
function lintCustomers(customers, today2) {
|
|
20747
|
+
const issues = [];
|
|
20748
|
+
const ids = new Set(customers.map((c) => c.id));
|
|
20749
|
+
const push = (c, kind, severity, detail2) => issues.push({ id: c.id, name: c.name, kind, severity, detail: detail2 });
|
|
20750
|
+
const byWechat = /* @__PURE__ */ new Map();
|
|
20751
|
+
for (const c of customers) {
|
|
20752
|
+
const w = (c.wechatId ?? "").trim();
|
|
20753
|
+
if (!w) continue;
|
|
20754
|
+
const arr = byWechat.get(w);
|
|
20755
|
+
if (arr) arr.push(c);
|
|
20756
|
+
else byWechat.set(w, [c]);
|
|
20757
|
+
}
|
|
20758
|
+
for (const c of customers) {
|
|
20759
|
+
const notesLen = (c.notes ?? "").length;
|
|
20760
|
+
if (notesLen > NOTES_MAX) push(c, "notes-over-limit", "error", `notes ${notesLen} \u5B57\u7B26\uFF0C\u8D85\u670D\u52A1\u7AEF\u4E0A\u9650 ${NOTES_MAX}\uFF0C\u518D\u8FFD\u52A0\u4F1A\u88AB\u6574\u6761\u62D2\u7EDD`);
|
|
20761
|
+
else if (notesLen > NOTES_LONG) push(c, "notes-long", "warn", `notes ${notesLen} \u5B57\u7B26\uFF0C\u504F\u81C3\u80BF\uFF08\u4E0A\u9650 ${NOTES_MAX}\uFF09`);
|
|
20762
|
+
const nameIssue = nameProblem(c.name);
|
|
20763
|
+
if (nameIssue) push(c, "name-annotated", "warn", `${nameIssue}\uFF1A\u300C${c.name.slice(0, 40)}${c.name.length > 40 ? "\u2026" : ""}\u300D`);
|
|
20764
|
+
for (const o of c.orgs ?? []) {
|
|
20765
|
+
if (!isKnownOrgStatus(o.status)) {
|
|
20766
|
+
push(c, "unknown-status", "error", `orgs[].status="${o.status}"\uFF08org=${o.org}\uFF09\u4E0D\u5728\u53D7\u63A7\u8BCD\u8868\u91CC\uFF0C\u6309\u72B6\u6001\u805A\u5408\u65F6\u8FD9\u6761\u4F1A\u6F0F\u6389`);
|
|
20767
|
+
}
|
|
20768
|
+
}
|
|
20769
|
+
const company = (c.company ?? "").trim();
|
|
20770
|
+
const orgs = c.orgs ?? [];
|
|
20771
|
+
if (company && !orgs.length) push(c, "company-without-orgs", "warn", "company \u6709\u503C\u4F46 orgs \u4E3A\u7A7A\uFF0C\u673A\u6784\u4FE1\u606F\u53EA\u5B58\u5728\u4E8E\u6458\u8981\u91CC\uFF0C\u6309\u673A\u6784\u7B5B\u4E0D\u5230");
|
|
20772
|
+
if (!company && orgs.length) push(c, "orgs-without-company", "warn", "orgs \u6709\u503C\u4F46 company \u4E3A\u7A7A\uFF0C\u7F3A\u300C\u4E3B\u5355\u4F4D\u300D\u6458\u8981");
|
|
20773
|
+
if (company && isProseCompany(company)) push(c, "company-prose", "warn", `company \u662F\u8BF4\u660E\u6587\u800C\u4E0D\u662F\u7B80\u79F0\uFF1A\u300C${company.slice(0, 40)}${company.length > 40 ? "\u2026" : ""}\u300D`);
|
|
20774
|
+
if (!c.relationships?.length) push(c, "no-relationship", "warn", "relationships \u4E3A\u7A7A\uFF0C\u4E0D\u77E5\u9053\u8FD9\u4E2A\u4EBA\u662F\u8C01");
|
|
20775
|
+
const city2 = (c.city ?? "").trim();
|
|
20776
|
+
if (city2 && !isKnownCity(city2)) push(c, "city-off-list", "warn", `city="${city2}" \u4E0D\u5728\u6807\u51C6\u57CE\u5E02\u8868\u91CC\uFF0C\u6309\u57CE\u5E02\u805A\u5408\u65F6\u8FD9\u6761\u4F1A\u6F0F\u6389`);
|
|
20777
|
+
for (const e of c.upcomingEvents ?? []) {
|
|
20778
|
+
if (e.date && e.date < today2) push(c, "expired-event", "error", `\u65E5\u7A0B\u5DF2\u8FC7\u671F\uFF1A${e.date}\u300C${e.title}\u300D`);
|
|
20779
|
+
}
|
|
20780
|
+
for (const p of c.relatedPeople ?? []) {
|
|
20781
|
+
if (p.id && !ids.has(p.id)) push(c, "dangling-related-id", "error", `relatedPeople[${p.name}].id=${p.id} \u6307\u5411\u5E93\u91CC\u4E0D\u5B58\u5728\u7684\u5BA2\u6237`);
|
|
20782
|
+
}
|
|
20783
|
+
const w = (c.wechatId ?? "").trim();
|
|
20784
|
+
if (w && (byWechat.get(w)?.length ?? 0) > 1) {
|
|
20785
|
+
push(c, "duplicate-wechat", "warn", `wechatId=${w} \u5728 ${byWechat.get(w).length} \u6761\u8BB0\u5F55\u4E0A\u91CD\u590D`);
|
|
20786
|
+
}
|
|
20787
|
+
const texts = [
|
|
20788
|
+
["summary", c.summary ?? ""],
|
|
20789
|
+
["notes", c.notes ?? ""],
|
|
20790
|
+
["currentAction", c.currentAction ?? ""],
|
|
20791
|
+
...(c.painPoints ?? []).map((p) => ["painPoints", p]),
|
|
20792
|
+
...(c.goals ?? []).map((g2) => ["goals", g2])
|
|
20793
|
+
];
|
|
20794
|
+
for (const [field, text] of texts) {
|
|
20795
|
+
if (!text) continue;
|
|
20796
|
+
const hits = halfWidthPunctuation(text);
|
|
20797
|
+
if (hits.length) push(c, "half-width-punctuation", "info", `${field} \u6709 ${hits.length} \u5904\u534A\u89D2\u6807\u70B9\uFF1A${hits.slice(0, 4).join(" ")}`);
|
|
20798
|
+
}
|
|
20799
|
+
}
|
|
20800
|
+
return issues;
|
|
20801
|
+
}
|
|
20802
|
+
function groupLintIssues(issues) {
|
|
20803
|
+
const rank = { error: 0, warn: 1, info: 2 };
|
|
20804
|
+
const perCustomer = /* @__PURE__ */ new Map();
|
|
20805
|
+
for (const i of issues) {
|
|
20806
|
+
const arr = perCustomer.get(i.id);
|
|
20807
|
+
if (arr) arr.push(i);
|
|
20808
|
+
else perCustomer.set(i.id, [i]);
|
|
20809
|
+
}
|
|
20810
|
+
return {
|
|
20811
|
+
issues: [...issues].sort((a, b) => rank[a.severity] - rank[b.severity] || a.name.localeCompare(b.name)),
|
|
20812
|
+
perCustomer: [...perCustomer.entries()].map(([id, list]) => ({
|
|
20813
|
+
id,
|
|
20814
|
+
name: list[0].name,
|
|
20815
|
+
count: list.length,
|
|
20816
|
+
errors: list.filter((i) => i.severity === "error").length,
|
|
20817
|
+
kinds: [...new Set(list.map((i) => i.kind))]
|
|
20818
|
+
})).sort((a, b) => b.errors - a.errors || b.count - a.count)
|
|
20819
|
+
};
|
|
20820
|
+
}
|
|
20821
|
+
|
|
20822
|
+
// src/events.ts
|
|
20823
|
+
function removeEvents(events, specs) {
|
|
20824
|
+
let rest = events;
|
|
20825
|
+
for (const spec of specs) {
|
|
20826
|
+
const m = /^(\d{4}-\d{2}-\d{2})(?::(.+))?$/.exec(spec.trim());
|
|
20827
|
+
if (!m) throw new CliError("usage", `Can't read "${spec}". Use YYYY-MM-DD or YYYY-MM-DD:keyword, e.g. 2026-11-01:Day2`, EXIT.usage);
|
|
20828
|
+
const next = rest.filter((e) => !(e.date === m[1] && (!m[2] || e.title.includes(m[2].trim()))));
|
|
20829
|
+
if (next.length === rest.length) throw new CliError("usage", `No event matches "${spec}". Nothing was changed`, EXIT.usage);
|
|
20830
|
+
rest = next;
|
|
20831
|
+
}
|
|
20832
|
+
return rest;
|
|
20833
|
+
}
|
|
20834
|
+
|
|
20705
20835
|
// src/org.ts
|
|
20706
20836
|
function parseOrg(s) {
|
|
20707
20837
|
const parts = s.split(":").map((p) => p.trim());
|
|
@@ -20881,6 +21011,7 @@ Recommended workflow (for agents):
|
|
|
20881
21011
|
Before adding search <name> --json (avoid duplicates; if the customer exists, update instead of add)
|
|
20882
21012
|
Record a customer add - --json < profile.json (or: add --name ... --potential High)
|
|
20883
21013
|
Update update <id> --add-pain "budget" --add-event 2026-10-20:follow_up:send quote --json
|
|
21014
|
+
Audit the records lint --json (report dirty records; reports only, never writes)
|
|
20884
21015
|
Reuse what works hook list --json (successful phrasings from other customers)
|
|
20885
21016
|
Recommend rec list --json (the user's OWN inventory: pick what fits; add items only when the user asks, never from chat)
|
|
20886
21017
|
House rules prompts show extraction-rules (the user's own extraction rules: follow them when extracting)
|
|
@@ -20897,7 +21028,9 @@ Examples:
|
|
|
20897
21028
|
$ crm add --name "\u738B\u5C0F\u660E" --relationship \u5B66\u5458 --relationship \u793E\u7FA4\u6210\u5458 --json
|
|
20898
21029
|
$ 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
|
|
20899
21030
|
$ crm list --potential high --city Beijing --due-today --json
|
|
21031
|
+
$ crm list --expired --json
|
|
20900
21032
|
$ crm list --org \u540C\u6D4E --json
|
|
21033
|
+
$ crm lint --severity error --json
|
|
20901
21034
|
$ crm add --name "\u738B\u5C0F\u660E" --related "\u674E\u96C5\u5A77:\u8F6C\u4ECB\u7ECD\u4EBA" "\u67F4\u8001\u5E08:\u5BFC\u5E08" --json
|
|
20902
21035
|
$ crm list --related \u674E\u96C5\u5A77 --json
|
|
20903
21036
|
$ crm update 3f2a\u2026 --summary "Needs a quote by Friday" --json
|
|
@@ -20979,7 +21112,7 @@ function parseSocial(s) {
|
|
|
20979
21112
|
function withCustomerOptions(cmd, forUpdate) {
|
|
20980
21113
|
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)" : ""}`).option("--related <name:relation:note...>", `related people, e.g. \u674E\u96C5\u5A77:\u8F6C\u4ECB\u7ECD\u4EBA\uFF08\u59D3\u540D:\u5173\u7CFB\uFF0C\u8BF4\u660E\u53EF\u7701\u7565\uFF09${forUpdate ? " (replaces the whole list; see --add-related)" : ""}`);
|
|
20981
21114
|
if (forUpdate) {
|
|
20982
|
-
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("--add-related <name:relation:note...>", "append related people, keeping existing ones (\u59D3\u540D:\u5173\u7CFB\uFF0C\u8BF4\u660E\u53EF\u7701\u7565)").option("--clear-events", "remove all calendar events");
|
|
21115
|
+
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("--add-related <name:relation:note...>", "append related people, keeping existing ones (\u59D3\u540D:\u5173\u7CFB\uFF0C\u8BF4\u660E\u53EF\u7701\u7565)").option("--remove-event <date:keyword...>", "remove calendar events on that date (YYYY-MM-DD), or with date:keyword only those whose title contains the keyword; other events stay").option("--clear-events", "remove all calendar events");
|
|
20983
21116
|
} else {
|
|
20984
21117
|
cmd.option("--hook-title <s>", "also record a successful hook for this customer (needs --hook-desc)").option("--hook-desc <s>");
|
|
20985
21118
|
}
|
|
@@ -21018,6 +21151,34 @@ function buildCustomerBody(base, o) {
|
|
|
21018
21151
|
}
|
|
21019
21152
|
return body;
|
|
21020
21153
|
}
|
|
21154
|
+
function checkNotesLength(body) {
|
|
21155
|
+
const notes = body.notes;
|
|
21156
|
+
if (typeof notes === "string" && notes.length > NOTES_MAX) {
|
|
21157
|
+
throw new CliError(
|
|
21158
|
+
"usage",
|
|
21159
|
+
`notes is ${notes.length} characters, ${notes.length - NOTES_MAX} over the ${NOTES_MAX} limit. Compress it (move detail into the structured fields) and retry`,
|
|
21160
|
+
EXIT.usage
|
|
21161
|
+
);
|
|
21162
|
+
}
|
|
21163
|
+
}
|
|
21164
|
+
function warnPayload(body) {
|
|
21165
|
+
const warns = [];
|
|
21166
|
+
for (const o of body.orgs ?? []) {
|
|
21167
|
+
if (o?.status && !isKnownOrgStatus(o.status)) {
|
|
21168
|
+
warns.push(`orgs[].status="${o.status}" is not a controlled value (${ORG_STATUSES.join(" | ")}) \u2014 it won't aggregate by status`);
|
|
21169
|
+
}
|
|
21170
|
+
}
|
|
21171
|
+
if (typeof body.city === "string" && body.city.trim() && !isKnownCity(body.city)) {
|
|
21172
|
+
warns.push(`city="${body.city}" is not in the standard city list \u2014 it won't aggregate by city`);
|
|
21173
|
+
}
|
|
21174
|
+
for (const e of body.upcomingEvents ?? []) {
|
|
21175
|
+
if (e?.date && e.date < today()) warns.push(`event "${e.title ?? ""}" ${e.date} is already in the past`);
|
|
21176
|
+
}
|
|
21177
|
+
if (typeof body.company === "string" && isProseCompany(body.company)) {
|
|
21178
|
+
warns.push(`company looks like a note rather than a short name \u2014 keep the name short and move the detail into orgs / notes`);
|
|
21179
|
+
}
|
|
21180
|
+
for (const w of warns) info(`\u26A0 ${w}`);
|
|
21181
|
+
}
|
|
21021
21182
|
var line = (c) => `${c.id} ${c.name}${c.company || c.title ? ` (${[c.company, c.title].filter(Boolean).join(" \xB7 ")})` : ""}${c.city ? ` ${c.city}` : ""} ${c.conversionPotential} ${c.conversionCycleDays}d${c.painPoints.length ? ` [${c.painPoints.join(", ")}]` : ""}`;
|
|
21022
21183
|
function detail(c) {
|
|
21023
21184
|
const rows = [
|
|
@@ -21171,6 +21332,8 @@ withCustomerOptions(
|
|
|
21171
21332
|
).action(async (src, o) => {
|
|
21172
21333
|
const body = buildCustomerBody(await readJsonInput(src), o);
|
|
21173
21334
|
if (!body.name) throw new CliError("usage", "name is required (pass --name or include it in the JSON)", EXIT.usage);
|
|
21335
|
+
checkNotesLength(body);
|
|
21336
|
+
warnPayload(body);
|
|
21174
21337
|
const { customer } = await (await client()).addCustomer(body);
|
|
21175
21338
|
out(`Created ${line(customer)}`, { customer, created: true });
|
|
21176
21339
|
});
|
|
@@ -21180,11 +21343,14 @@ withCustomerOptions(
|
|
|
21180
21343
|
).action(async (id, src, o) => {
|
|
21181
21344
|
const api = await client();
|
|
21182
21345
|
const body = buildCustomerBody(await readJsonInput(src), o);
|
|
21183
|
-
if (o.addPain || o.addGoal || o.addEvent || o.addSocial || o.addRelationship || o.addOrg || o.addRelated) {
|
|
21346
|
+
if (o.addPain || o.addGoal || o.addEvent || o.removeEvent || o.addSocial || o.addRelationship || o.addOrg || o.addRelated) {
|
|
21184
21347
|
const { customer: cur } = await api.getCustomer(id);
|
|
21185
21348
|
if (o.addPain) body.painPoints = [.../* @__PURE__ */ new Set([...body.painPoints ?? cur.painPoints, ...o.addPain])];
|
|
21186
21349
|
if (o.addGoal) body.goals = [.../* @__PURE__ */ new Set([...body.goals ?? cur.goals, ...o.addGoal])];
|
|
21187
|
-
if (o.
|
|
21350
|
+
if (o.removeEvent || o.addEvent) {
|
|
21351
|
+
const base = body.upcomingEvents ?? cur.upcomingEvents.map(({ title, date: date5, type }) => ({ title, date: date5, type }));
|
|
21352
|
+
body.upcomingEvents = [...removeEvents(base, o.removeEvent ?? []), ...(o.addEvent ?? []).map(parseEvent)];
|
|
21353
|
+
}
|
|
21188
21354
|
if (o.addSocial) {
|
|
21189
21355
|
const added = o.addSocial.map(parseSocial);
|
|
21190
21356
|
const key = (s) => JSON.stringify([s.platform, s.handle]);
|
|
@@ -21207,14 +21373,47 @@ withCustomerOptions(
|
|
|
21207
21373
|
}
|
|
21208
21374
|
}
|
|
21209
21375
|
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);
|
|
21376
|
+
checkNotesLength(body);
|
|
21377
|
+
warnPayload(body);
|
|
21210
21378
|
const { customer } = await api.updateCustomer(id, body);
|
|
21211
21379
|
out(`Updated ${line(customer)}`, { customer, updated: true });
|
|
21212
21380
|
});
|
|
21213
21381
|
program.command("get").description("Show one customer").argument("<id>").action(async (id) => {
|
|
21214
|
-
const
|
|
21215
|
-
|
|
21382
|
+
const api = await client();
|
|
21383
|
+
const { customer } = await api.getCustomer(id);
|
|
21384
|
+
const { hooks } = await api.listHooks(id);
|
|
21385
|
+
const rows = [
|
|
21386
|
+
...detail(customer).split("\n"),
|
|
21387
|
+
...hooks.length ? ["", "hooks", ...hooks.map((h) => ` ${h.isEnabled ? " " : "\xD7"} ${h.title}
|
|
21388
|
+
${h.description}`)] : []
|
|
21389
|
+
].join("\n");
|
|
21390
|
+
out(rows, { customer, hooks });
|
|
21391
|
+
});
|
|
21392
|
+
program.command("lint").description("Audit every customer record and report what should be checked or fixed. Reports only \u2014 never writes.").option("--kind <kind>", "only report one kind of issue").option("--severity <level>", "only report this severity: error / warn / info").action(async (o) => {
|
|
21393
|
+
const api = await client();
|
|
21394
|
+
const { customers } = await api.listCustomers({});
|
|
21395
|
+
const all = lintCustomers(customers, today());
|
|
21396
|
+
const issues = all.filter(
|
|
21397
|
+
(i) => (!o.kind || i.kind === o.kind) && (!o.severity || i.severity === o.severity)
|
|
21398
|
+
);
|
|
21399
|
+
const { perCustomer } = groupLintIssues(issues);
|
|
21400
|
+
const errors = issues.filter((i) => i.severity === "error").length;
|
|
21401
|
+
const warns = issues.filter((i) => i.severity === "warn").length;
|
|
21402
|
+
const infos = issues.filter((i) => i.severity === "info").length;
|
|
21403
|
+
const human = [
|
|
21404
|
+
`Scanned ${customers.length} customers \xB7 ${issues.length} issues (${errors} error / ${warns} warn / ${infos} info)`,
|
|
21405
|
+
"",
|
|
21406
|
+
...perCustomer.map(
|
|
21407
|
+
(p) => `${p.count === 1 ? " " : "!"} ${p.name} (${p.id}) ${p.count} issue${p.count > 1 ? "s" : ""}${p.errors ? `, ${p.errors} error` : ""}
|
|
21408
|
+
${p.kinds.join(", ")}`
|
|
21409
|
+
),
|
|
21410
|
+
"",
|
|
21411
|
+
"Per issue:",
|
|
21412
|
+
...issues.map((i) => ` [${i.severity}] ${i.name} \u2014 ${i.kind}: ${i.detail}`)
|
|
21413
|
+
].join("\n");
|
|
21414
|
+
out(human, { scanned: customers.length, count: issues.length, errors, warns, infos, issues, perCustomer });
|
|
21216
21415
|
});
|
|
21217
|
-
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("--related <s>", "is connected to this person (substring match on the related-people list; also matches records that point at this customer)").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, related people, summary, notes, tags, goals").action(async (o) => {
|
|
21416
|
+
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("--related <s>", "is connected to this person (substring match on the related-people list; also matches records that point at this customer)").option("--due-today", "has a calendar event today (your local date)").option("--due <YYYY-MM-DD>", "has a calendar event on this date").option("--expired [date]", "has a calendar event before this date (default: today) \u2014 overdue events nobody cleaned up").option("-q, --query <s>", "keyword across name, company, title, city, wechat, social accounts, relationships, organizations, related people, summary, notes, tags, goals").action(async (o) => {
|
|
21218
21417
|
const { customers } = await (await client()).listCustomers({
|
|
21219
21418
|
potential: o.potential ? potentialOf(o.potential) : void 0,
|
|
21220
21419
|
city: o.city,
|
|
@@ -21224,7 +21423,8 @@ program.command("list").description("List customers (newest update first), optio
|
|
|
21224
21423
|
relationship: o.relationship,
|
|
21225
21424
|
org: o.org,
|
|
21226
21425
|
related: o.related,
|
|
21227
|
-
dueOn: o.dueToday ? today() : o.due
|
|
21426
|
+
dueOn: o.dueToday ? today() : o.due,
|
|
21427
|
+
expiredBefore: o.expired ? o.expired === true ? today() : o.expired : void 0
|
|
21228
21428
|
});
|
|
21229
21429
|
out(customers.length ? customers.map(line).join("\n") : "No customers match.", { customers, count: customers.length });
|
|
21230
21430
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insightcrm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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",
|