insightcrm 0.1.8 → 0.1.9

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.
Files changed (3) hide show
  1. package/SKILL.md +16 -3
  2. package/dist/cli.js +58 -6
  3. package/package.json +1 -1
package/SKILL.md CHANGED
@@ -68,6 +68,16 @@ crm login https://<服务器地址>
68
68
  - 机构名**照抄材料里的写法**,不要擅自合并全称和简称(「上海开索人工智能科技有限公司」和「开索 AI」是两个写法,别自己并成一个)。按机构筛选用的是包含匹配,简称也能命中。
69
69
  - 材料里没出现就整条省略,**不要编造**。命令行写法:`--org "同济大学:在职教师:在职" "浙江理工大学:博士在读:在读"`(机构名:身份:状态,身份可省略)。
70
70
 
71
+ **相关人物 `relatedPeople`**:这个人牵连到的**其他人**——人与人之间的关系。
72
+ - 元素形如 `{"name":"李雅婷","relation":"转介绍人","note":"07-15 发了她的名片说「这位同事推荐的」"}`。`name` 必填;`id` 和 `note` 选填。
73
+ - **跟 `relationships` 不是一回事**:`relationships` 是「这个人在我这里是什么身份」(对我),`relatedPeople` 是「人与人之间」(对内)。别把两者混着填。
74
+ - `relation` 是**自由文本**,不是受控词表。推荐写法:转介绍人 / 被转介绍人 / 对接协调方 / 拍板决策人 / 同场协作 / 同场竞争 / 同事 / 同学 / 导师 / 师傅 / 联合创始人 / 团队成员 / 投资人 / 介绍人。材料里没有的关系**不要编**。
75
+ - `id` 可以省略:省略后服务端会按**同一用户名下唯一同名**自动补上。**库外的人**(导师、师傅、联合创始人、团队成员……)只留名字就行,照样要记。
76
+ - **名字要照抄材料里的写法**,不要合并全名和简称。同名多人时服务端宁可不补 id,也不要指错人——所以靠 id 或全名才可靠,靠字符串匹配会误命中(库里有「谢」和另一个叫「谢扬」的人)。
77
+ - **按人筛是包含匹配**:`crm list --related 谢` 会把「老谢」「谢扬」这些不同的人一起带出来。要精确指某一个人,用全名或看档案里的 `relatedPeople.id`。
78
+ - **典型要记的场景**:谁把谁介绍来的、谁在中间做推进、谁跟谁一起做过事、谁跟谁在抢同一批名额。
79
+ - 材料里没出现就整条省略,**不要编造**。命令行写法:`--related "李雅婷:转介绍人" "柴老师:导师"`(姓名:关系,关系必填,说明可省略)。
80
+
71
81
  **日程 `upcomingEvents`**:`{title, date, type}` 的数组,`date` 是 `YYYY-MM-DD`,`type` 是 `meeting` / `follow_up` / `deadline` / `other`。
72
82
  - 今天是几号要自己确认,相对日期(「下周三」)按今天换算成具体日期。
73
83
  - **已经过去的日期不要录**。
@@ -108,8 +118,8 @@ crm login https://<服务器地址>
108
118
 
109
119
  | 想做的事 | 用 |
110
120
  |---|---|
111
- | 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 / 单位 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` / `--add-org` |
112
- | **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship` / `--org`,或 JSON 里直接传数组 |
121
+ | 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 / 单位 / 相关人物 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` / `--add-org` / `--add-related` |
122
+ | **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship` / `--org` / `--related`,或 JSON 里直接传数组 |
113
123
  | 清空日程 | `--clear-events` |
114
124
 
115
125
  `upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。
@@ -118,6 +128,8 @@ crm login https://<服务器地址>
118
128
 
119
129
  `orgs` 也一样:传了就是**整体替换**。只想补一个单位,用 `--add-org "同济大学:在职教师:在职"`。
120
130
 
131
+ `relatedPeople` 也一样:传了就是**整体替换**。只想补一个人,用 `--add-related "李雅婷:转介绍人"`。
132
+
121
133
  `summary` 是对这个客户的整体描述。合并新材料时,是在原有摘要上补充,不是整段覆盖掉已有的信息:先 `crm get <id> --json` 读出旧内容再写。
122
134
 
123
135
  ## 查询
@@ -126,10 +138,11 @@ crm login https://<服务器地址>
126
138
  crm list --potential high --city 北京 --json # 按等级、城市、标签筛选
127
139
  crm list --due-today --json # 今天有日程的客户(今天要联系谁)
128
140
  crm list --due 2026-10-20 --json
129
- crm list -q 跨境 --json # 关键词:姓名、公司、职位、城市、微信、社交账号、关系、单位、摘要、备注、标签、目标
141
+ crm list -q 跨境 --json # 关键词:姓名、公司、职位、城市、微信、社交账号、关系、单位、相关人物、摘要、备注、标签、目标
130
142
  crm list --social-platform xiaohongshu --json # 有小红书账号的客户
131
143
  crm list --relationship 甲方 --json # 甲方名单(写 client 一样命中)
132
144
  crm list --org 同济 --json # 挂在某个机构的客户(包含匹配,简称也能命中)
145
+ crm list --related 李雅婷 --json # 和李雅婷有关系的人(含「被指向」的反向关联)
133
146
  crm get <id> --json
134
147
  ```
135
148
 
package/dist/cli.js CHANGED
@@ -623,6 +623,16 @@ function normalizeOrgName(input2) {
623
623
  return input2.replace(/[ \s]+/g, " ").trim();
624
624
  }
625
625
 
626
+ // ../shared/src/related.ts
627
+ function normalizeRelatedName(input2) {
628
+ if (!input2) return "";
629
+ return input2.replace(/[ \s]+/g, " ").trim();
630
+ }
631
+ function normalizeRelatedRelation(input2) {
632
+ if (!input2) return "";
633
+ return input2.replace(/[ \s]+/g, " ").trim();
634
+ }
635
+
626
636
  // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
627
637
  var external_exports = {};
628
638
  __export(external_exports, {
@@ -20355,6 +20365,12 @@ var orgLink = external_exports.object({
20355
20365
  role: external_exports.string().trim().max(200).nullable().optional(),
20356
20366
  status: external_exports.string().trim().min(1).max(50).transform(normalizeOrgStatus)
20357
20367
  });
20368
+ var relatedPerson = external_exports.object({
20369
+ name: external_exports.string().trim().min(1).max(100).transform(normalizeRelatedName),
20370
+ id: external_exports.string().trim().max(64).nullable().optional(),
20371
+ relation: external_exports.string().trim().min(1).max(100).transform(normalizeRelatedRelation),
20372
+ note: external_exports.string().trim().max(500).nullable().optional()
20373
+ });
20358
20374
  var eventInput = external_exports.object({
20359
20375
  title: short(200).min(1),
20360
20376
  date: isoDate,
@@ -20376,6 +20392,8 @@ var customerShape = {
20376
20392
  relationships: external_exports.array(external_exports.string().trim().min(1).max(50).transform(normalizeRelationship)).max(20),
20377
20393
  /** 关联的机构:一个人可以挂多个单位。整体替换 */
20378
20394
  orgs: external_exports.array(orgLink).max(30),
20395
+ /** 相关人物:这个人牵连到的其他人。整体替换 */
20396
+ relatedPeople: external_exports.array(relatedPerson).max(50),
20379
20397
  summary: short(5e3),
20380
20398
  painPoints: tags,
20381
20399
  goals: tags,
@@ -20440,6 +20458,12 @@ var orgFields = [
20440
20458
  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
20459
  }
20442
20460
  ];
20461
+ var relatedFields = [
20462
+ { name: "name", type: "string", required: true, guide: "\u5BF9\u65B9\u59D3\u540D\u3002\u6750\u6599\u91CC\u51FA\u73B0\u7684\u4EBA\u540D\u7167\u6284\uFF0C\u4E0D\u8981\u6539\u5199\u6210\u5173\u7CFB\u79F0\u8C13" },
20463
+ { name: "id", type: "string", nullable: true, guide: "\u5BF9\u65B9\u5728 CRM \u91CC\u7684\u5BA2\u6237 id\u3002\u5BF9\u65B9\u4E0D\u5728\u5E93\u91CC\u5C31\u7701\u7565\uFF1B\u7559\u7A7A\u4E14\u5E93\u91CC\u6709\u552F\u4E00\u540C\u540D\u7684\u5BA2\u6237\u65F6\u670D\u52A1\u7AEF\u4F1A\u81EA\u52A8\u8865\u4E0A" },
20464
+ { name: "relation", type: "string", required: true, guide: "\u4ECE\u672C\u6761\u89C6\u89D2\u770B\u7684\u5173\u7CFB\uFF0C\u81EA\u7531\u6587\u672C\u3002\u63A8\u8350\u5199\u6CD5\uFF1A\u8F6C\u4ECB\u7ECD\u4EBA / \u88AB\u8F6C\u4ECB\u7ECD\u4EBA / \u5BF9\u63A5\u534F\u8C03\u65B9 / \u62CD\u677F\u51B3\u7B56\u4EBA / \u540C\u573A\u534F\u4F5C / \u540C\u573A\u7ADE\u4E89 / \u540C\u4E8B / \u540C\u5B66 / \u5BFC\u5E08 / \u5E08\u5085 / \u8054\u5408\u521B\u59CB\u4EBA / \u56E2\u961F\u6210\u5458 / \u6295\u8D44\u4EBA" },
20465
+ { name: "note", type: "string", nullable: true, guide: "\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u6761\u5173\u7CFB\u7684\u6765\u9F99\u53BB\u8109\uFF0C\u5982\u300C07-15 \u53D1\u5979\u7684\u540D\u7247\u8BF4\u300E\u8FD9\u4F4D\u540C\u4E8B\u63A8\u8350\u7684\u300F\u300D" }
20466
+ ];
20443
20467
  var SCHEMA = {
20444
20468
  customer: {
20445
20469
  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",
@@ -20467,6 +20491,12 @@ var SCHEMA = {
20467
20491
  fields: orgFields,
20468
20492
  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
20493
  },
20494
+ {
20495
+ name: "relatedPeople",
20496
+ type: "object[]",
20497
+ fields: relatedFields,
20498
+ guide: "\u76F8\u5173\u4EBA\u7269\uFF1A\u8FD9\u4E2A\u4EBA\u7275\u8FDE\u5230\u7684\u5176\u4ED6\u4EBA\u3002\u8DDF relationships\uFF08\u8FD9\u4E2A\u4EBA\u5728\u6211\u8FD9\u91CC\u662F\u4EC0\u4E48\u8EAB\u4EFD\uFF09\u4E0D\u662F\u4E00\u56DE\u4E8B\u2014\u2014\u90A3\u662F\u300C\u5BF9\u7528\u6237\u300D\u7684\u5173\u7CFB\uFF0C\u8FD9\u662F\u300C\u4EBA\u4E0E\u4EBA\u4E4B\u95F4\u300D\u7684\u5173\u7CFB\u3002\u5143\u7D20\u5F62\u5982 {name:'\u674E\u96C5\u5A77', relation:'\u8F6C\u4ECB\u7ECD\u4EBA', note:'07-15 \u53D1\u5979\u7684\u540D\u7247\u8BF4\u300C\u8FD9\u4F4D\u540C\u4E8B\u63A8\u8350\u7684\u300D'}\u3002\u8981\u8BB0\u7684\u5178\u578B\u573A\u666F\uFF1A\u8C01\u628A\u8C01\u4ECB\u7ECD\u6765\u7684\u3001\u8C01\u5728\u4E2D\u95F4\u505A\u63A8\u8FDB\u3001\u8C01\u8DDF\u8C01\u4E00\u8D77\u505A\u8FC7\u4E8B\u3001\u8C01\u8DDF\u8C01\u5728\u62A2\u540C\u4E00\u6279\u540D\u989D\u3002\u5BFC\u5E08\u3001\u5E08\u5085\u3001\u8054\u5408\u521B\u59CB\u4EBA\u3001\u56E2\u961F\u6210\u5458\u8FD9\u4E9B\u4E0D\u5728 CRM \u91CC\u7684\u4EBA\u4E5F\u8981\u8BB0\uFF0C\u53EA\u7559\u540D\u5B57\u5373\u53EF\u3002relation \u662F\u81EA\u7531\u6587\u672C\uFF0C\u4E0D\u8981\u7F16\u9020\u6750\u6599\u91CC\u6CA1\u6709\u7684\u5173\u7CFB\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"
20499
+ },
20470
20500
  { 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" },
20471
20501
  { 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" },
20472
20502
  { name: "goals", type: "string[]", guide: "\u77ED\u671F\u76EE\u6807\uFF0C\u6BCF\u6761\u4E00\u53E5\u8BDD" },
@@ -20560,7 +20590,7 @@ function renderPrompt(text, customer) {
20560
20590
  // package.json
20561
20591
  var package_default = {
20562
20592
  name: "insightcrm",
20563
- version: "0.1.8",
20593
+ version: "0.1.9",
20564
20594
  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.",
20565
20595
  license: "MIT",
20566
20596
  type: "module",
@@ -20688,6 +20718,18 @@ function parseOrg(s) {
20688
20718
  }
20689
20719
  var orgKey = (o) => JSON.stringify([o.org, o.status]);
20690
20720
 
20721
+ // src/related.ts
20722
+ function parseRelated(s) {
20723
+ const parts = s.split(":").map((p) => p.trim());
20724
+ const name = parts[0] ?? "";
20725
+ if (!name) throw new CliError("usage", `Can't read related person "${s}". Use name:relation, e.g. \u674E\u96C5\u5A77:\u8F6C\u4ECB\u7ECD\u4EBA`, EXIT.usage);
20726
+ const relation = parts[1] ?? "";
20727
+ if (!relation) throw new CliError("usage", `Can't read related person "${s}". Use name:relation, e.g. \u674E\u96C5\u5A77:\u8F6C\u4ECB\u7ECD\u4EBA`, EXIT.usage);
20728
+ const note = parts.length > 2 ? parts.slice(2).join(":").trim() : "";
20729
+ return { name, relation, ...note ? { note } : {} };
20730
+ }
20731
+ var relatedKey = (p) => JSON.stringify([p.name, p.relation]);
20732
+
20691
20733
  // src/prompts.ts
20692
20734
  import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
20693
20735
  import path2 from "path";
@@ -20856,6 +20898,8 @@ Examples:
20856
20898
  $ 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
20857
20899
  $ crm list --potential high --city Beijing --due-today --json
20858
20900
  $ crm list --org \u540C\u6D4E --json
20901
+ $ crm add --name "\u738B\u5C0F\u660E" --related "\u674E\u96C5\u5A77:\u8F6C\u4ECB\u7ECD\u4EBA" "\u67F4\u8001\u5E08:\u5BFC\u5E08" --json
20902
+ $ crm list --related \u674E\u96C5\u5A77 --json
20859
20903
  $ crm update 3f2a\u2026 --summary "Needs a quote by Friday" --json
20860
20904
  $ crm hook add --title "Opened with a peer case" --desc "Led with a competitor's result, then asked about theirs" --customer 3f2a\u2026
20861
20905
  $ crm export -o backup.json`
@@ -20933,9 +20977,9 @@ function parseSocial(s) {
20933
20977
  return { platform: platform2, handle };
20934
20978
  }
20935
20979
  function withCustomerOptions(cmd, forUpdate) {
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)" : ""}`);
20980
+ 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)" : ""}`);
20937
20981
  if (forUpdate) {
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");
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");
20939
20983
  } else {
20940
20984
  cmd.option("--hook-title <s>", "also record a successful hook for this customer (needs --hook-desc)").option("--hook-desc <s>");
20941
20985
  }
@@ -20967,6 +21011,7 @@ function buildCustomerBody(base, o) {
20967
21011
  if (o.social) body.socials = o.social.map(parseSocial);
20968
21012
  if (o.relationship) body.relationships = o.relationship;
20969
21013
  if (o.org) body.orgs = o.org.map(parseOrg);
21014
+ if (o.related) body.relatedPeople = o.related.map(parseRelated);
20970
21015
  if (o.hookTitle || o.hookDesc) {
20971
21016
  if (!o.hookTitle || !o.hookDesc) throw new CliError("usage", "--hook-title and --hook-desc go together", EXIT.usage);
20972
21017
  body.socialHook = { title: o.hookTitle, description: o.hookDesc };
@@ -20985,6 +21030,7 @@ function detail(c) {
20985
21030
  ["socials", c.socials.map((s) => `${s.platform}: ${s.handle}${s.url ? ` (${s.url})` : ""}`).join("; ")],
20986
21031
  ["relationship", c.relationships.map((r) => relationshipLabel(r, "zh")).join(", ")],
20987
21032
  ["orgs", (c.orgs ?? []).map((o) => `${o.org}${o.role ? ` \xB7 ${o.role}` : ""} [${orgStatusLabel(o.status, "zh")}]`).join("; ")],
21033
+ ["related", (c.relatedPeople ?? []).map((p) => `${p.name} \xB7 ${p.relation}${p.note ? `\uFF08${p.note}\uFF09` : ""}`).join("; ")],
20988
21034
  ["potential", c.conversionPotential],
20989
21035
  ["cycle days", String(c.conversionCycleDays)],
20990
21036
  ["pain points", c.painPoints.join(", ")],
@@ -21129,12 +21175,12 @@ withCustomerOptions(
21129
21175
  out(`Created ${line(customer)}`, { customer, created: true });
21130
21176
  });
21131
21177
  withCustomerOptions(
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"),
21178
+ program.command("update").description("Change a customer. Only the fields you pass change. --pain / --goal / --event / --social / --relationship / --org / --related REPLACE the list; --add-pain / --add-goal / --add-event / --add-social / --add-relationship / --add-org / --add-related append.").argument("<id>").argument("[json-file]", "JSON file, or - for stdin"),
21133
21179
  true
21134
21180
  ).action(async (id, src, o) => {
21135
21181
  const api = await client();
21136
21182
  const body = buildCustomerBody(await readJsonInput(src), o);
21137
- if (o.addPain || o.addGoal || o.addEvent || o.addSocial || o.addRelationship || o.addOrg) {
21183
+ if (o.addPain || o.addGoal || o.addEvent || o.addSocial || o.addRelationship || o.addOrg || o.addRelated) {
21138
21184
  const { customer: cur } = await api.getCustomer(id);
21139
21185
  if (o.addPain) body.painPoints = [.../* @__PURE__ */ new Set([...body.painPoints ?? cur.painPoints, ...o.addPain])];
21140
21186
  if (o.addGoal) body.goals = [.../* @__PURE__ */ new Set([...body.goals ?? cur.goals, ...o.addGoal])];
@@ -21154,6 +21200,11 @@ withCustomerOptions(
21154
21200
  const existing = body.orgs ?? cur.orgs;
21155
21201
  body.orgs = [...existing, ...added.filter((x) => !existing.some((e) => orgKey(e) === orgKey(x)))];
21156
21202
  }
21203
+ if (o.addRelated) {
21204
+ const added = o.addRelated.map(parseRelated);
21205
+ const existing = body.relatedPeople ?? cur.relatedPeople;
21206
+ body.relatedPeople = [...existing, ...added.filter((x) => !existing.some((e) => relatedKey(e) === relatedKey(x)))];
21207
+ }
21157
21208
  }
21158
21209
  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);
21159
21210
  const { customer } = await api.updateCustomer(id, body);
@@ -21163,7 +21214,7 @@ program.command("get").description("Show one customer").argument("<id>").action(
21163
21214
  const { customer } = await (await client()).getCustomer(id);
21164
21215
  out(detail(customer), { customer });
21165
21216
  });
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) => {
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) => {
21167
21218
  const { customers } = await (await client()).listCustomers({
21168
21219
  potential: o.potential ? potentialOf(o.potential) : void 0,
21169
21220
  city: o.city,
@@ -21172,6 +21223,7 @@ program.command("list").description("List customers (newest update first), optio
21172
21223
  socialPlatform: o.socialPlatform,
21173
21224
  relationship: o.relationship,
21174
21225
  org: o.org,
21226
+ related: o.related,
21175
21227
  dueOn: o.dueToday ? today() : o.due
21176
21228
  });
21177
21229
  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.8",
3
+ "version": "0.1.9",
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",