insightcrm 0.0.0-stage → 0.1.0

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 (4) hide show
  1. package/README.md +20 -2
  2. package/SKILL.md +144 -0
  3. package/dist/cli.js +20526 -0
  4. package/package.json +46 -4
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # Temporary Holding Version
1
+ # insightcrm
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ InsightCRM 的命令行(也是给 AI agent 用的接口)。客户档案存在你自己的 InsightCRM 服务器上,用你自己的 agent(Claude Code、Cursor 等)从聊天记录、截图里抽取并写入;这个 CLI 只负责存取,不调用任何模型,也不保存任何 API key。
4
+
5
+ ```bash
6
+ npm i -g insightcrm # 得到 insightcrm 和 crm 两个命令(crm 是别名)
7
+ # 或者不安装:npx insightcrm --help
8
+
9
+ crm login https://<你的服务器> # 浏览器里点「允许」(设备码登录)
10
+ crm schema --json # 字段契约,含每个字段的填写指引
11
+ echo '{"name":"王小明","company":"ACME"}' | crm add - --json
12
+ crm list --due-today --json
13
+ crm skill --install # 把使用说明装进 Claude Code
14
+ ```
15
+
16
+ - `--json` 时 stdout 只有一个 JSON 对象,过程信息走 stderr。
17
+ - 退出码:`0` 成功 · `1` 出错 · `2` 用法或输入不合法 · `3` 认证 · `4` 限流 · `5` 冲突。
18
+ - 环境变量:`CRM_API_URL`、`CRM_TOKEN`、`CRM_SERVER`、`CRM_JSON=1`、`CRM_LANG`。
19
+ - 可自定义的 prompt 模板(抽取规则、起草消息等):`crm prompts list`。
20
+
21
+ 需要一个运行中的 InsightCRM 服务器,部署方式见仓库:<https://github.com/shadowcz007/InsightCRM>。
package/SKILL.md ADDED
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: insightcrm
3
+ description: Record and look up customers in InsightCRM with the `crm` CLI. Use when the user pastes a chat log, WeChat Moments / social screenshots, a business card or meeting notes and wants the person filed as a customer profile; asks to update an existing customer; asks who to follow up with today; or wants to reuse phrasings ("hooks") that worked on other customers.
4
+ ---
5
+
6
+ # 用 crm 管理客户档案
7
+
8
+ 安装:`npm i -g insightcrm`,得到 `insightcrm` 和 `crm` 两个命令(`crm` 是别名,下面都用 `crm`)。不想全局安装就用 `npx insightcrm …`。
9
+
10
+ InsightCRM 只负责**存储和展示**。抽取、判断、总结都由你(agent)来做,`crm` 只是把你整理好的结构化结果落库。用户在网页上浏览你录入的内容。
11
+
12
+ ## 先登录
13
+
14
+ ```bash
15
+ crm login https://<服务器地址>
16
+ ```
17
+
18
+ 命令会打印一个网址和 `XXXX-XXXX` 授权码,并打开浏览器。**让用户在浏览器里点「允许」,不要自己去批准。** CI 环境用 `CRM_TOKEN` 和 `CRM_API_URL` 环境变量代替。
19
+
20
+ 邮箱没验证的账号只能读不能写(写入返回退出码 3,错误码 `email_unverified`)。告诉用户去验证邮箱,没收到邮件就联系管理员要验证链接。
21
+
22
+ ## 工作流程
23
+
24
+ 1. **读契约**:`crm schema --json`。每个字段都有 `guide`,写入前读一遍,不要凭印象填。再读用户自己的抽取规则:`crm prompts show extraction-rules`,抽取时一并遵守(见下面「Prompt 模板」)。
25
+ 2. **查重**:`crm search <姓名或公司> --json`。已存在就 `update`,不要 `add` 出第二份。
26
+ 3. **看已有标签**:`crm tags --json`。痛点标签尽量沿用已有写法(「预算」不要写成「预算有限」「没预算」),这样才能按标签聚合。
27
+ 4. **抽取并写入**:
28
+ ```bash
29
+ echo '{"name":"王小明","company":"ACME","conversionPotential":"High", ...}' | crm add - --json
30
+ ```
31
+ 5. **复述结果**:把写入的 `id`、姓名和关键字段告诉用户,让他核对。
32
+
33
+ 所有命令加 `--json` 后,stdout 只有**一个** JSON 对象,过程信息在 stderr。失败时是 `{"error":{"code","message"}}`。
34
+
35
+ 退出码:`0` 成功 · `1` 出错 · `2` 用法或输入不合法 · `3` 认证(没登录、邮箱未验证) · `4` 被限流 · `5` 冲突或被拒绝。
36
+
37
+ ## 怎么从材料里抽取
38
+
39
+ **身份与联系**:`name`、`company`、`title`;`wechatId`、`city`。只填材料里明确出现的。看不到就省略,不要猜。
40
+
41
+ **画像**:
42
+ - `painPoints`:痛点和兴趣标签,每条几个字。
43
+ - `goals`:短期目标。
44
+ - `currentAction`:对方正在做的事,或我方下一步该做的动作。
45
+ - `conversionPotential`:`High` / `Medium` / `Low`。综合痛点的紧迫度、预算信号、对方的决策角色来判断,拿不准填 `Medium`。
46
+ - `conversionCycleDays`:预估的转化黄金窗口(天)。信号越弱越长,信号明确可以短到 7–14 天。
47
+
48
+ **日程 `upcomingEvents`**:`{title, date, type}` 的数组,`date` 是 `YYYY-MM-DD`,`type` 是 `meeting` / `follow_up` / `deadline` / `other`。
49
+ - 今天是几号要自己确认,相对日期(「下周三」)按今天换算成具体日期。
50
+ - **已经过去的日期不要录**。
51
+ - 没有明确日期的约定不要编日期。
52
+
53
+ **按材料类型**:
54
+ - **朋友圈 / 社交平台截图**:重点抽**兴趣和需求**,写进 `painPoints` 和 `summary`。
55
+ - **名片**:重点是身份(`name` / `company` / `title`),别的字段通常没有。
56
+ - **聊天记录**:除了画像,还要找**钩子**(见下)。
57
+
58
+ ## 成功钩子
59
+
60
+ 钩子 = 对话里**哪句话、哪个说法成功引起了对方的注意,或带来了正向回复**,以及为什么有效。它是跨客户复用的话术资产,是这个产品最有价值的数据。
61
+
62
+ - 创建客户时顺带记录:`socialHook: {"title":"钩子名","description":"可复用的具体话术或逻辑"}`,或用 `--hook-title` / `--hook-desc`。
63
+ - 单独添加:`crm hook add --title ... --desc ... --customer <id>`。
64
+ - 写 `description` 时让别的客户场景也能照着用:写清楚话术本身和有效的原因,不要只写「聊得很好」。
65
+ - **找不到就别编。** 没有明确的「这句话奏效了」的证据,就不要创建钩子。宁可没有,不要一条虚构的。
66
+ - 想给新对话找灵感时:`crm hook list --json`。
67
+
68
+ ## 更新已有客户
69
+
70
+ `crm update <id>` 只改你传的字段。列表字段有两种写法,别搞混:
71
+
72
+ | 想做的事 | 用 |
73
+ |---|---|
74
+ | 在已有基础上**追加**标签 / 目标 / 日程 | `--add-pain` / `--add-goal` / `--add-event` |
75
+ | **整体替换**整个列表 | `--pain` / `--goal` / `--event`,或 JSON 里直接传数组 |
76
+ | 清空日程 | `--clear-events` |
77
+
78
+ `upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。
79
+
80
+ `summary` 是对这个客户的整体描述。合并新材料时,是在原有摘要上补充,不是整段覆盖掉已有的信息:先 `crm get <id> --json` 读出旧内容再写。
81
+
82
+ ## 查询
83
+
84
+ ```bash
85
+ crm list --potential high --city 北京 --json # 按等级、城市、标签筛选
86
+ crm list --due-today --json # 今天有日程的客户(今天要联系谁)
87
+ crm list --due 2026-10-20 --json
88
+ crm list -q 跨境 --json # 关键词:姓名、公司、职位、城市、摘要、备注、标签、目标
89
+ crm get <id> --json
90
+ ```
91
+
92
+ ## 推荐库
93
+
94
+ 用户维护的、可以发给客户的文章 / 产品 / 服务 / 活动:
95
+
96
+ ```bash
97
+ crm rec list --json
98
+ crm rec add --title "..." --type Article|Product|Service|Event --desc "适合什么样的客户" --link https://...
99
+ ```
100
+
101
+ 给客户挑推荐时,只推荐高度相关的,并说明理由。
102
+
103
+ ## Prompt 模板
104
+
105
+ 用户可以自定义的 prompt 模板,存在本机(`~/.config/insightcrm/prompts.json`),网页里没有。
106
+
107
+ ```bash
108
+ crm prompts list # 全部模板,customized 表示用户改过或自己加的
109
+ crm prompts show extraction-rules # 用户的抽取规则:抽取客户资料时额外遵守
110
+ crm prompts show draft --customer <id> # 起草消息;{{name}} {{company}} 等用这个客户的资料填好
111
+ crm prompts show gift --customer <id> --json # --json 里带上 customer 档案,可直接作为上下文
112
+ ```
113
+
114
+ 内置的任务模板:`draft`(起草消息)、`gift`(送礼策略)、`starters`(社交破冰)、`advice`(关系升温)。用户让你「给王小明起草一条消息」「想想送什么礼物」这类事时,先 `show` 对应模板再照着做;模板里带 `[请补充]` 的地方要向用户问清楚或自己补全。
115
+
116
+ 用户想改模板时:
117
+
118
+ ```bash
119
+ crm prompts set gift --prompt "给 {{name}} 挑一份 500 元内的礼物,并写卡片寄语" # 覆盖内置模板
120
+ crm prompts set followup --label "跟进" - < followup.txt # 新增自己的模板(id 随意取)
121
+ crm prompts reset gift # 恢复默认;crm prompts reset --all 全部恢复
122
+ ```
123
+
124
+ 模板语言按 `CRM_LANG` 或系统语言选,也可以 `--lang zh|en` 指定。
125
+
126
+ ## 备份与迁移
127
+
128
+ ```bash
129
+ crm export -o backup.json # 全量导出
130
+ crm import backup.json # 重复导入同一份是安全的(相同 id 会更新,不会重复)
131
+ ```
132
+
133
+ `import` 也能读旧版纯浏览器应用导出的备份文件。
134
+
135
+ ## 删除
136
+
137
+ `crm rm <id> --yes` 删除客户,**先问用户**。客户的钩子会保留在钩子库里。
138
+
139
+ ## 装这份说明到 Claude Code
140
+
141
+ ```bash
142
+ crm skill --install # 装到 ~/.claude/skills/insightcrm/
143
+ crm skill --install --dir ./.claude/skills # 只装到当前项目
144
+ ```