insightcrm 0.1.10 → 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.
Files changed (3) hide show
  1. package/SKILL.md +2 -1
  2. package/dist/cli.js +20 -4
  3. package/package.json +1 -1
package/SKILL.md CHANGED
@@ -126,8 +126,9 @@ crm login https://<服务器地址>
126
126
  | 在已有基础上**追加**标签 / 目标 / 日程 / 社交账号 / 关系 / 单位 / 相关人物 | `--add-pain` / `--add-goal` / `--add-event` / `--add-social` / `--add-relationship` / `--add-org` / `--add-related` |
127
127
  | **整体替换**整个列表 | `--pain` / `--goal` / `--event` / `--social` / `--relationship` / `--org` / `--related`,或 JSON 里直接传数组 |
128
128
  | 清空日程 | `--clear-events` |
129
+ | 删**某一天**的日程(其余保留) | `--remove-event 2026-11-01`;只删当天标题含某词的:`--remove-event 2026-11-01:Day2`。没命中会报错、不改任何数据 |
129
130
 
130
- `upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。
131
+ `upcomingEvents` 在 JSON 里传了就是**整体替换**。只想加一个日程,用 `--add-event 2026-10-25:deadline:报价截止`,不要把一个事件的数组传上去把旧的冲掉。只想删一个,用 `--remove-event`,同理别手写整个数组。
131
132
 
132
133
  `socials` 同理:传了就是**整体替换**。只想补一个号,用 `--add-social channels:@san三`。
133
134
 
package/dist/cli.js CHANGED
@@ -20630,7 +20630,7 @@ function renderPrompt(text, customer) {
20630
20630
  // package.json
20631
20631
  var package_default = {
20632
20632
  name: "insightcrm",
20633
- version: "0.1.10",
20633
+ version: "0.1.11",
20634
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.",
20635
20635
  license: "MIT",
20636
20636
  type: "module",
@@ -20819,6 +20819,19 @@ function groupLintIssues(issues) {
20819
20819
  };
20820
20820
  }
20821
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
+
20822
20835
  // src/org.ts
20823
20836
  function parseOrg(s) {
20824
20837
  const parts = s.split(":").map((p) => p.trim());
@@ -21099,7 +21112,7 @@ function parseSocial(s) {
21099
21112
  function withCustomerOptions(cmd, forUpdate) {
21100
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)" : ""}`);
21101
21114
  if (forUpdate) {
21102
- 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");
21103
21116
  } else {
21104
21117
  cmd.option("--hook-title <s>", "also record a successful hook for this customer (needs --hook-desc)").option("--hook-desc <s>");
21105
21118
  }
@@ -21330,11 +21343,14 @@ withCustomerOptions(
21330
21343
  ).action(async (id, src, o) => {
21331
21344
  const api = await client();
21332
21345
  const body = buildCustomerBody(await readJsonInput(src), o);
21333
- 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) {
21334
21347
  const { customer: cur } = await api.getCustomer(id);
21335
21348
  if (o.addPain) body.painPoints = [.../* @__PURE__ */ new Set([...body.painPoints ?? cur.painPoints, ...o.addPain])];
21336
21349
  if (o.addGoal) body.goals = [.../* @__PURE__ */ new Set([...body.goals ?? cur.goals, ...o.addGoal])];
21337
- if (o.addEvent) body.upcomingEvents = [...body.upcomingEvents ?? cur.upcomingEvents.map(({ title, date: date5, type }) => ({ title, date: date5, type })), ...o.addEvent.map(parseEvent)];
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
+ }
21338
21354
  if (o.addSocial) {
21339
21355
  const added = o.addSocial.map(parseSocial);
21340
21356
  const key = (s) => JSON.stringify([s.platform, s.handle]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insightcrm",
3
- "version": "0.1.10",
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",