@helm-ai/cli 1.5.0 → 1.7.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,341 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@helm-ai/cli` are listed here, newest first. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
5
+ package uses [semantic versioning](https://semver.org/): a new command or flag is
6
+ a minor release, a fix is a patch, and a change to an existing command's shape is
7
+ a major release.
8
+
9
+ Dates are npm publish dates (UTC). Versions before 0.15.0 were installed from git
10
+ and never published to npm; their dates are when the version was cut.
11
+
12
+ For changes to the Helm app itself, see https://gethelm.ai/changelog.
13
+
14
+ ## [Unreleased]
15
+
16
+ ## [1.7.0] - 2026-12-02
17
+
18
+ ### Added
19
+ - `outcome record` records a business result (a consult booked, a client
20
+ renewed) and credits the agent work that led to it, so agents learn what
21
+ works. `--ref` and `--toolkit` name the object in a connected tool; `--key`
22
+ counts a repeated result once.
23
+ - `outcome list` lists recorded results, filtered by company, result, source
24
+ or date.
25
+ - `doc create --type` sets the document type: note, sop, template,
26
+ meeting_notes, or the new deck (a presentation made of `:::card{…}` … `:::`
27
+ blocks).
28
+ - `doc list --type` filters by type, and the list shows a Type column.
29
+ - `doc create` and `doc update` take `--theme` (brand, light, dark, mono),
30
+ `--width` (normal, wide) and `--logo` / `--no-logo` for a deck.
31
+
32
+ ## [1.6.0] - 2026-11-30
33
+
34
+ ### Added
35
+ - `sequence update` renames a sequence and changes its exit-on-reply,
36
+ exit-on-bounce and transactional settings.
37
+ - `sequence emails` lists a sequence's emails in order.
38
+ - `sequence update-email` edits an email's subject, body (`--html-file`,
39
+ `--text-file`) or delay in place.
40
+ - `sequence remove-email`, `sequence reorder` and `sequence delete` (with `--yes`
41
+ to skip the confirmation).
42
+
43
+ ## [1.5.0] - 2026-11-07
44
+
45
+ ### Added
46
+ - `invoice create --already-billed` records a bill the client already got another
47
+ way (text, paper). It's saved as open, so it counts as owed, and nothing is sent.
48
+
49
+ ## [1.4.0] - 2026-11-05
50
+
51
+ ### Added
52
+ - Commands respect the member access preset of the person behind the API key. A
53
+ refusal names the area and level and doesn't ask you to log in again.
54
+
55
+ ## [1.3.0] - 2026-11-04
56
+
57
+ ### Added
58
+ - `calendar create --repeat <rule>` creates a repeating event.
59
+ - `calendar create --timezone <iana>` reads `--start` and `--end` without an offset
60
+ as wall-clock time in that zone, and a repeating event keeps its local time
61
+ across daylight saving.
62
+
63
+ ## [1.2.0] - 2026-11-03
64
+
65
+ ### Added
66
+ - `file list` and `file read` for Helm Files, with filters for company, project,
67
+ folder, kind and a text query. `file read --text` prints a file's extracted
68
+ text; `--save` downloads it.
69
+
70
+ ## [1.1.0] - 2026-10-28
71
+
72
+ ### Added
73
+ - `deal create` and `deal update` take `--next-step`, `--next-step-date`,
74
+ `--source` and `--lost-reason`.
75
+
76
+ ## [1.0.0] - 2026-10-27
77
+
78
+ ### Changed
79
+ - **Breaking:** Accounts are now Companies. The `account` command is now
80
+ `company`, and every `--account` flag (on `calendar`, `contact`, `deal`,
81
+ `estimate`, `hours`, `invoice`, `payment`, `project` and `subscription`) is now
82
+ `--company`. Update scripts that call the old names.
83
+
84
+ ## [0.31.2] - 2026-10-23
85
+
86
+ ### Changed
87
+ - Subscription payment links print Helm's link, which doesn't expire, in place of
88
+ the checkout page that expired within 24 hours. `subscription links` shows
89
+ "never" for these.
90
+
91
+ ## [0.31.1] - 2026-10-18
92
+
93
+ ### Fixed
94
+ - `task update`, `task complete` and `task comment` with `--as <agent>` only
95
+ accept an agent on the task's project.
96
+
97
+ ## [0.31.0] - 2026-10-18
98
+
99
+ ### Added
100
+ - `task owner --user <email>` makes a person a task's owner. An owner is one
101
+ person or one agent.
102
+
103
+ ## [0.30.0] - 2026-10-18
104
+
105
+ ### Added
106
+ - `task owner` names an agent as a task's owner without starting it on the work;
107
+ `--clear` removes the owner.
108
+ - `--as <agent>` on task updates, completions and comments posts the change as an
109
+ agent (admins only).
110
+
111
+ ## [0.29.1] - 2026-10-18
112
+
113
+ ### Fixed
114
+ - `--low-alert` help says the percent is of the newest hours added, not of
115
+ everything bought.
116
+
117
+ ## [0.29.0] - 2026-10-15
118
+
119
+ ### Added
120
+ - Hour plans: `hours create`, `hours update`, `hours plan`, `hours add`,
121
+ `hours void`, `hours activity` and `hours statement`, covering monthly and
122
+ prepaid plans, rollover, rounding, overage rates and low-hours alerts.
123
+
124
+ ## [0.28.0] - 2026-10-15
125
+
126
+ ### Added
127
+ - `hours balance` shows how many hours a client has left, by company, plan or
128
+ project.
129
+
130
+ ## [0.27.0] - 2026-10-12
131
+
132
+ ### Added
133
+ - `subscription links`, `subscription resend-link` and
134
+ `subscription cancel-link` for payment links that were sent and not yet paid.
135
+
136
+ ## [0.26.0] - 2026-10-08
137
+
138
+ ### Added
139
+ - `project create --stage` accepts `on_hold`, along with planning, active,
140
+ review, completed and archived.
141
+
142
+ ## [0.25.0] - 2026-10-07
143
+
144
+ ### Added
145
+ - `estimate get` and `estimate update`.
146
+ - `line-item update` and `line-item remove` edit an invoice or estimate after
147
+ it's created.
148
+
149
+ ## [0.24.0] - 2026-10-07
150
+
151
+ ### Added
152
+ - `invoice create` and `estimate create` take line items with `--item` (repeatable)
153
+ or `--items` (a JSON file).
154
+ - `estimate create --contact` and `--internal-notes`.
155
+
156
+ ### Fixed
157
+ - Invoices and estimates created from the CLI are numbered the same way as the
158
+ app's.
159
+
160
+ ## [0.23.0] - 2026-10-03
161
+
162
+ ### Added
163
+ - `doc outline`, `doc blocks` and `doc patch` read and edit a document section by
164
+ section (`--replace`, `--insert-after`, `--insert-before`, `--delete`).
165
+ - `doc page update`, `doc page delete` and `doc page reorder` rename, move,
166
+ reorder and delete pages after the first.
167
+
168
+ ## [0.22.0] - 2026-09-03
169
+
170
+ ### Added
171
+ - Subscriptions: `subscription create`, `get`, `list`, `pause`, `resume`,
172
+ `cancel`, `refresh` and `mrr`.
173
+
174
+ ## [0.21.0] - 2026-09-02
175
+
176
+ ### Changed
177
+ - `form list` shows a form's hosted page when it has one.
178
+
179
+ ## [0.20.0] - 2026-08-31
180
+
181
+ ### Added
182
+ - `agent schedule create --output-channels` delivers a routine's results to more
183
+ than one place.
184
+
185
+ ## [0.19.0] - 2026-08-31
186
+
187
+ ### Added
188
+ - `agent schedule create --output-channel` accepts `slack_dm` and `email`.
189
+
190
+ ## [0.18.0] - 2026-08-26
191
+
192
+ ### Added
193
+ - `task comments` reads a task's comment thread.
194
+
195
+ ## [0.17.0] - 2026-08-24
196
+
197
+ ### Fixed
198
+ - `deal get` includes the revenue rollup: invoiced, collected, and what a won deal
199
+ is still owed.
200
+
201
+ ## [0.16.0] - 2026-08-24
202
+
203
+ ### Added
204
+ - `payment list` and `payment record`, including the deal a payment won.
205
+ - `invoice create --deal` links an invoice to a deal.
206
+
207
+ ### Changed
208
+ - The CLI installs as `helm-ai` only. The short `helm` alias is gone, since it
209
+ clashes with the Kubernetes package manager.
210
+ - A README.
211
+
212
+ ## [0.15.0] - 2026-08-24
213
+
214
+ First version published to npm.
215
+
216
+ ### Added
217
+ - `pipeline update-stage --archived` parks a stage outside funnels and forecasts.
218
+
219
+ ## [0.14.0] - 2026-08-14
220
+
221
+ ### Added
222
+ - Email drafts: `email draft`, `email drafts`, `email update`, `email delete` and
223
+ `email identities`.
224
+ - `time update` and `time delete`, and `time log --date` and `--at` to log work
225
+ on another day.
226
+ - `deal create --contact` links a deal to a person.
227
+
228
+ ### Fixed
229
+ - Multi-assign on tasks, and a `-v` flag collision.
230
+
231
+ ## [0.13.0] - 2026-07-27
232
+
233
+ ### Added
234
+ - Contact profile fields: phone, address, timezone, social links, lead source,
235
+ last contacted and next follow-up.
236
+ - `sequence create --transactional` for billing and account mail that still sends
237
+ to marketing unsubscribes.
238
+
239
+ ## [0.12.3] - 2026-07-16
240
+
241
+ ### Added
242
+ - Pipelines: `pipeline create`, `list`, `update`, `delete`, `add-stage`,
243
+ `update-stage` and `delete-stage`.
244
+ - `deal update`, and `deal create --pipeline`.
245
+ - `form update-field`, `remove-field`, `update-step` and `remove-step`.
246
+
247
+ ### Fixed
248
+ - The login prompt points to the right place for your API key.
249
+
250
+ ## [0.12.2] - 2026-07-11
251
+
252
+ ### Added
253
+ - `--query` search on `contact list`, `account list` and `task list`.
254
+
255
+ ## [0.12.1] - 2026-07-11
256
+
257
+ ### Added
258
+ - Forms accept consent fields.
259
+
260
+ ## [0.12.0] - 2026-07-08
261
+
262
+ ### Added
263
+ - `doc page` adds pages to a document.
264
+
265
+ ## [0.11.0] - 2026-06-21
266
+
267
+ ### Added
268
+ - Workflow authoring: `workflow create`, `update`, `delete` and `schema`.
269
+ - `agent send-email` sends email as a named agent.
270
+
271
+ ## [0.10.0] - 2026-06-11
272
+
273
+ ### Added
274
+ - `task create --attach` and `task update --attach` attach files of any type.
275
+
276
+ ## [0.9.0] - 2026-06-10
277
+
278
+ ### Added
279
+ - Forms: `form create`, `get`, `list`, `add-field`, `add-step`, `status`, `stats`
280
+ and `submissions`.
281
+ - Product price tiers: `product tier`, `product add` and `product rm`.
282
+ - `sequence create` and `sequence add-email`.
283
+
284
+ ## [0.8.1] - 2026-05-25
285
+
286
+ ### Added
287
+ - `product update` and `product archive`.
288
+
289
+ ### Fixed
290
+ - Output is flushed before the CLI exits.
291
+ - `deal delete` asks for a real confirmation.
292
+
293
+ ## [0.8.0] - 2026-05-23
294
+
295
+ ### Added
296
+ - `contact delete`, and `--all` / `--offset` paging on contact and account lists.
297
+
298
+ ### Fixed
299
+ - CSV import checks for duplicates across every page of existing records.
300
+
301
+ ## [0.7.1] - 2026-05-23
302
+
303
+ ### Fixed
304
+ - CSV import of custom fields with dotted keys or a whole-object column.
305
+
306
+ ## [0.7.0] - 2026-05-23
307
+
308
+ ### Added
309
+ - Tags and custom fields on contacts and accounts.
310
+ - `account attach`, `detach` and `products` link products to an account.
311
+
312
+ ### Fixed
313
+ - CSV import updates duplicates instead of skipping them.
314
+
315
+ ## [0.6.0] - 2026-05-23
316
+
317
+ ### Added
318
+ - `workflow list`, `get`, `run` and `runs`.
319
+ - `sequence list`, `get`, `enroll` and `enrollments`.
320
+
321
+ ## [0.5.0] - 2026-05-22
322
+
323
+ ### Added
324
+ - Products: `product create`, `get`, `list`, `attach` and `add-line`.
325
+
326
+ ## [0.4.3] - 2026-05-04
327
+
328
+ ### Added
329
+ - `template list` and `template apply` install built-in Program Templates.
330
+ - `task create --parent` for subtasks.
331
+
332
+ ## [0.4.0] - 2026-04-27
333
+
334
+ ### Added
335
+ - Profiles for working across several workspaces: `profile list`, `use` and
336
+ `current`.
337
+
338
+ ## [0.3.1] - 2026-04-25
339
+
340
+ First release: login, accounts (now companies), contacts, deals, projects, tasks,
341
+ time, invoices, estimates, calendar, documents, agents, config and CSV import.
package/README.md CHANGED
@@ -91,6 +91,7 @@ Every resource follows the same shape — `list`, `get <id>`, `create`, `update
91
91
  | `form`, `sequence`, `email` | Capture and follow-up |
92
92
  | `workflow`, `template` | Automations and reusable project structures |
93
93
  | `agent` | AI staff — schedules, objectives, and runs |
94
+ | `outcome` | Business results agents learn from: `record` and `list` |
94
95
  | `import` | Bulk import of people, companies, deals and tasks from CSV/JSON |
95
96
  | `login`, `logout`, `whoami`, `profile`, `config` | Credentials and settings |
96
97
 
package/dist/cli.js CHANGED
@@ -25,7 +25,7 @@ function renderSplash(ctx) {
25
25
  }
26
26
 
27
27
  // src/version.ts
28
- var version = "1.5.0";
28
+ var version = "1.7.0";
29
29
 
30
30
  // src/commands/auth.ts
31
31
  import prompts from "prompts";
@@ -883,6 +883,16 @@ var HelmClient = class _HelmClient {
883
883
  return data;
884
884
  }
885
885
  };
886
+ outcomes = {
887
+ record: async (input) => {
888
+ const data = await this.request("record_outcome", "POST", input);
889
+ return data;
890
+ },
891
+ list: async (filters = {}) => {
892
+ const data = await this.request("list_outcomes", "GET", filters);
893
+ return data.outcomes ?? [];
894
+ }
895
+ };
886
896
  sequences = {
887
897
  list: async (filters = {}) => {
888
898
  const data = await this.request("list_email_sequences", "GET", filters);
@@ -905,6 +915,26 @@ var HelmClient = class _HelmClient {
905
915
  const data = await this.request("create_sequence_email", "POST", { sequence_id: sequenceId, ...input });
906
916
  return data.step;
907
917
  },
918
+ update: async (sequenceId, updates) => {
919
+ const data = await this.request("update_email_sequence", "POST", { sequence_id: sequenceId, ...updates });
920
+ return data.sequence;
921
+ },
922
+ delete: async (sequenceId) => {
923
+ const data = await this.request("delete_email_sequence", "POST", { sequence_id: sequenceId });
924
+ return data;
925
+ },
926
+ updateEmail: async (sequenceId, emailId, updates) => {
927
+ const data = await this.request("update_sequence_email", "POST", { id: emailId, sequence_id: sequenceId, ...updates });
928
+ return data.step;
929
+ },
930
+ removeEmail: async (sequenceId, emailId) => {
931
+ const data = await this.request("delete_sequence_email", "POST", { id: emailId, sequence_id: sequenceId });
932
+ return data;
933
+ },
934
+ reorderEmails: async (sequenceId, orderedEmailIds) => {
935
+ const data = await this.request("reorder_sequence_emails", "POST", { sequence_id: sequenceId, ordered_step_ids: orderedEmailIds });
936
+ return data;
937
+ },
908
938
  enrollments: async (sequenceId, filters = {}) => {
909
939
  const data = await this.request("list_sequence_enrollments", "GET", { sequence_id: sequenceId, ...filters });
910
940
  return data.enrollments ?? [];
@@ -927,6 +957,9 @@ var HelmClient = class _HelmClient {
927
957
  }
928
958
  };
929
959
  };
960
+ var DOCUMENT_TYPES = ["note", "sop", "template", "meeting_notes", "deck"];
961
+ var DECK_THEMES = ["brand", "light", "dark", "mono"];
962
+ var DECK_WIDTHS = ["normal", "wide"];
930
963
 
931
964
  // src/lib/config.ts
932
965
  import { readFileSync, writeFileSync, existsSync, mkdirSync, chmodSync, statSync } from "fs";
@@ -1774,13 +1807,13 @@ function registerDealCommands(parent) {
1774
1807
  process.exitCode = 1;
1775
1808
  return;
1776
1809
  }
1777
- const { confirmed } = await prompts2({
1810
+ const { confirmed: confirmed2 } = await prompts2({
1778
1811
  type: "confirm",
1779
1812
  name: "confirmed",
1780
1813
  message: `Delete deal ${id}? This cannot be undone.`,
1781
1814
  initial: false
1782
1815
  });
1783
- if (!confirmed) {
1816
+ if (!confirmed2) {
1784
1817
  console.log("Aborted.");
1785
1818
  return;
1786
1819
  }
@@ -1868,13 +1901,13 @@ function registerPipelineCommands(parent) {
1868
1901
  process.exitCode = 1;
1869
1902
  return;
1870
1903
  }
1871
- const { confirmed } = await prompts3({
1904
+ const { confirmed: confirmed2 } = await prompts3({
1872
1905
  type: "confirm",
1873
1906
  name: "confirmed",
1874
1907
  message: `Delete pipeline ${id}? This cannot be undone.`,
1875
1908
  initial: false
1876
1909
  });
1877
- if (!confirmed) {
1910
+ if (!confirmed2) {
1878
1911
  console.log("Aborted.");
1879
1912
  return;
1880
1913
  }
@@ -1935,13 +1968,13 @@ function registerPipelineCommands(parent) {
1935
1968
  process.exitCode = 1;
1936
1969
  return;
1937
1970
  }
1938
- const { confirmed } = await prompts3({
1971
+ const { confirmed: confirmed2 } = await prompts3({
1939
1972
  type: "confirm",
1940
1973
  name: "confirmed",
1941
1974
  message: `Delete stage ${stageId}?`,
1942
1975
  initial: false
1943
1976
  });
1944
- if (!confirmed) {
1977
+ if (!confirmed2) {
1945
1978
  console.log("Aborted.");
1946
1979
  return;
1947
1980
  }
@@ -2453,13 +2486,13 @@ Refusing to void without confirmation in a non-interactive shell. Re-run with -y
2453
2486
  process.exitCode = 1;
2454
2487
  return;
2455
2488
  }
2456
- const { confirmed } = await prompts4({
2489
+ const { confirmed: confirmed2 } = await prompts4({
2457
2490
  type: "confirm",
2458
2491
  name: "confirmed",
2459
2492
  message: `${check.impact} Void these hours?`,
2460
2493
  initial: false
2461
2494
  });
2462
- if (!confirmed) {
2495
+ if (!confirmed2) {
2463
2496
  console.log("Aborted.");
2464
2497
  return;
2465
2498
  }
@@ -3556,6 +3589,26 @@ function readContent(opts) {
3556
3589
  if (opts.content === "-") return readFileSync3(0, "utf8");
3557
3590
  return opts.content;
3558
3591
  }
3592
+ function parseDocType(value) {
3593
+ if (!DOCUMENT_TYPES.includes(value)) {
3594
+ throw new InvalidArgumentError3(`must be one of ${DOCUMENT_TYPES.join(", ")}`);
3595
+ }
3596
+ return value;
3597
+ }
3598
+ function parseDeckTheme(value) {
3599
+ if (!DECK_THEMES.includes(value)) {
3600
+ throw new InvalidArgumentError3(`must be one of ${DECK_THEMES.join(", ")}`);
3601
+ }
3602
+ return value;
3603
+ }
3604
+ function parseDeckWidth(value) {
3605
+ if (!DECK_WIDTHS.includes(value)) {
3606
+ throw new InvalidArgumentError3(`must be one of ${DECK_WIDTHS.join(", ")}`);
3607
+ }
3608
+ return value;
3609
+ }
3610
+ var DECK_THEME_HELP = `decks only: ${DECK_THEMES.join("|")} (brand: your brand color; dark: dark cards)`;
3611
+ var DECK_WIDTH_HELP = `decks only: ${DECK_WIDTHS.join("|")}`;
3559
3612
  function parsePosition2(value) {
3560
3613
  const n = Number(value);
3561
3614
  if (!Number.isInteger(n) || n < 0) throw new InvalidArgumentError3("must be a whole number, 0 or more");
@@ -3563,7 +3616,7 @@ function parsePosition2(value) {
3563
3616
  }
3564
3617
  function registerDocCommands(parent) {
3565
3618
  const cmd = parent.command("doc").alias("docs").description("Manage documents");
3566
- cmd.command("list").description("List documents").option("-s, --status <status>", "draft|published|archived").option("--visibility <vis>", "private|workspace|shared|public").option("--category <cat>").option("--project <id>").option("-l, --limit <n>", "max rows", (v) => parseInt(v, 10), 50).option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
3619
+ cmd.command("list").description("List documents").option("-s, --status <status>", "draft|published|archived").option("--visibility <vis>", "private|workspace|shared|public").option("--category <cat>").option("--project <id>").option("--type <type>", `${DOCUMENT_TYPES.join("|")}`, parseDocType).option("-l, --limit <n>", "max rows", (v) => parseInt(v, 10), 50).option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
3567
3620
  try {
3568
3621
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
3569
3622
  const rows = await client.documents.list({
@@ -3571,10 +3624,12 @@ function registerDocCommands(parent) {
3571
3624
  visibility: opts.visibility,
3572
3625
  category: opts.category,
3573
3626
  project_id: opts.project,
3627
+ document_type: opts.type,
3574
3628
  limit: opts.limit
3575
3629
  });
3576
3630
  console.log(render(rows, [
3577
3631
  { header: "Title", get: (r) => r.title, truncate: 40 },
3632
+ { header: "Type", get: (r) => r.document_type },
3578
3633
  { header: "Status", get: (r) => r.status },
3579
3634
  { header: "Visibility", get: (r) => r.visibility },
3580
3635
  { header: "Updated", get: (r) => r.updated_at?.slice(0, 10) },
@@ -3597,7 +3652,7 @@ function registerDocCommands(parent) {
3597
3652
  return;
3598
3653
  }
3599
3654
  });
3600
- cmd.command("create").description("Create a document (content from --content, --content-file, or stdin with -c -)").requiredOption("-t, --title <title>").option("-c, --content <text>", 'content as markdown (use "-" for stdin)').option("--content-file <path>", "read content from a file").option("-d, --description <text>").option("--project <id>").option("-s, --status <status>", "draft|published|archived", "draft").option("--visibility <vis>", "private|workspace|shared|public", "private").option("--category <cat>").option("--tag <tag...>").option("-p, --profile <name>").action(async (opts) => {
3655
+ cmd.command("create").description("Create a document (content from --content, --content-file, or stdin with -c -)").requiredOption("-t, --title <title>").option("-c, --content <text>", 'content as markdown (use "-" for stdin)').option("--content-file <path>", "read content from a file").option("-d, --description <text>").option("--project <id>").option("-s, --status <status>", "draft|published|archived", "draft").option("--visibility <vis>", "private|workspace|shared|public", "private").option("--category <cat>").option("--tag <tag...>").option("--type <type>", `${DOCUMENT_TYPES.join("|")} (default note; a deck is written as :::card{\u2026} \u2026 ::: blocks)`, parseDocType).option("--theme <theme>", `${DECK_THEME_HELP}; default brand`, parseDeckTheme).option("--width <width>", `${DECK_WIDTH_HELP}; default normal`, parseDeckWidth).option("--logo", "decks only: show the workspace logo on title cards").option("--no-logo", "decks only: hide the logo").option("-p, --profile <name>").action(async (opts) => {
3601
3656
  try {
3602
3657
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
3603
3658
  const doc = await client.documents.create({
@@ -3608,7 +3663,11 @@ function registerDocCommands(parent) {
3608
3663
  status: opts.status,
3609
3664
  visibility: opts.visibility,
3610
3665
  category: opts.category,
3611
- tags: opts.tag
3666
+ tags: opts.tag,
3667
+ document_type: opts.type,
3668
+ deck_theme: opts.theme,
3669
+ deck_width: opts.width,
3670
+ deck_logo: opts.logo
3612
3671
  });
3613
3672
  console.log(JSON.stringify(doc, null, 2));
3614
3673
  } catch (err) {
@@ -3617,13 +3676,16 @@ function registerDocCommands(parent) {
3617
3676
  return;
3618
3677
  }
3619
3678
  });
3620
- cmd.command("update <id>").description("Update a document").option("-t, --title <title>").option("-c, --content <text>", 'use "-" for stdin').option("--content-file <path>").option("-s, --status <status>").option("-p, --profile <name>").action(async (id, opts) => {
3679
+ cmd.command("update <id>").description("Update a document").option("-t, --title <title>").option("-c, --content <text>", 'use "-" for stdin').option("--content-file <path>").option("-s, --status <status>").option("--theme <theme>", DECK_THEME_HELP, parseDeckTheme).option("--width <width>", DECK_WIDTH_HELP, parseDeckWidth).option("--logo", "decks only: show the workspace logo on title cards").option("--no-logo", "decks only: hide the logo").option("-p, --profile <name>").action(async (id, opts) => {
3621
3680
  try {
3622
3681
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
3623
3682
  const doc = await client.documents.update(id, {
3624
3683
  title: opts.title,
3625
3684
  content: readContent(opts),
3626
- status: opts.status
3685
+ status: opts.status,
3686
+ deck_theme: opts.theme,
3687
+ deck_width: opts.width,
3688
+ deck_logo: opts.logo
3627
3689
  });
3628
3690
  console.log(JSON.stringify(doc, null, 2));
3629
3691
  } catch (err) {
@@ -4592,8 +4654,8 @@ async function readJsonSource(path) {
4592
4654
  for await (const chunk of process.stdin) chunks.push(chunk);
4593
4655
  raw = Buffer.concat(chunks).toString("utf8");
4594
4656
  } else {
4595
- const { readFileSync: readFileSync6 } = await import("fs");
4596
- raw = readFileSync6(path, "utf8");
4657
+ const { readFileSync: readFileSync7 } = await import("fs");
4658
+ raw = readFileSync7(path, "utf8");
4597
4659
  }
4598
4660
  try {
4599
4661
  return JSON.parse(raw);
@@ -4688,8 +4750,8 @@ function registerWorkflowCommands(parent) {
4688
4750
  try {
4689
4751
  let triggerData;
4690
4752
  if (opts.dataFile) {
4691
- const { readFileSync: readFileSync6 } = await import("fs");
4692
- triggerData = JSON.parse(readFileSync6(opts.dataFile, "utf8"));
4753
+ const { readFileSync: readFileSync7 } = await import("fs");
4754
+ triggerData = JSON.parse(readFileSync7(opts.dataFile, "utf8"));
4693
4755
  } else if (opts.data) {
4694
4756
  triggerData = JSON.parse(opts.data);
4695
4757
  }
@@ -4755,10 +4817,47 @@ function registerWorkflowCommands(parent) {
4755
4817
  }
4756
4818
 
4757
4819
  // src/commands/sequence.ts
4820
+ import { readFileSync as readFileSync5 } from "fs";
4821
+ import prompts5 from "prompts";
4758
4822
  import { stringify as yamlStringify2 } from "yaml";
4759
4823
  var collect2 = (value, prev) => prev.concat([value]);
4824
+ var UNITS = ["minutes", "hours", "days"];
4825
+ function readBodies(opts) {
4826
+ if (opts.text !== void 0 && opts.textFile) throw new Error("Use --text or --text-file, not both.");
4827
+ if (opts.html !== void 0 && opts.htmlFile) throw new Error("Use --html or --html-file, not both.");
4828
+ if (opts.textFile === "-" && opts.htmlFile === "-") throw new Error("Only one of --text-file and --html-file can read stdin (-).");
4829
+ const read = (path) => readFileSync5(path === "-" ? 0 : path, "utf8");
4830
+ return {
4831
+ text: opts.textFile ? read(opts.textFile) : opts.text,
4832
+ html: opts.htmlFile ? read(opts.htmlFile) : opts.html
4833
+ };
4834
+ }
4835
+ function parseDelay(delay, unit) {
4836
+ const out = {};
4837
+ if (delay !== void 0) {
4838
+ const n = Number(delay);
4839
+ if (!Number.isInteger(n) || n < 0) throw new Error("--delay must be a whole number of 0 or more.");
4840
+ out.delay_value = n;
4841
+ }
4842
+ if (unit !== void 0) {
4843
+ if (!UNITS.includes(unit)) throw new Error("--unit must be minutes, hours or days.");
4844
+ out.delay_unit = unit;
4845
+ }
4846
+ return out;
4847
+ }
4848
+ async function confirmed(message, yes) {
4849
+ if (yes) return true;
4850
+ if (!process.stdin.isTTY) {
4851
+ console.error("Refusing without confirmation in a non-interactive shell. Re-run with -y/--yes.");
4852
+ process.exitCode = 1;
4853
+ return false;
4854
+ }
4855
+ const { ok } = await prompts5({ type: "confirm", name: "ok", message, initial: false });
4856
+ if (!ok) console.log("Aborted.");
4857
+ return !!ok;
4858
+ }
4760
4859
  function registerSequenceCommands(parent) {
4761
- const cmd = parent.command("sequence").alias("sequences").description("Operate email sequences (read, enroll, lifecycle)");
4860
+ const cmd = parent.command("sequence").alias("sequences").description("Operate email sequences (read, build, edit, enroll, lifecycle)");
4762
4861
  cmd.command("list").description("List email sequences").option("--status <status>", "draft|live|paused|archived").option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
4763
4862
  try {
4764
4863
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
@@ -4863,20 +4962,22 @@ Next: add emails with
4863
4962
  return;
4864
4963
  }
4865
4964
  });
4866
- cmd.command("add-email <id>").description("Add an email to a sequence (appends to the end)").requiredOption("--subject <subject>", "email subject line").option("--text <body>", "plain-text body (provide --text and/or --html)").option("--html <body>", "HTML body (provide --text and/or --html)").requiredOption("--delay <n>", "wait before this email, with --unit (0 = on enrollment)").option("--unit <unit>", "minutes|hours|days", "days").option("--position <n>", "1-based insert position (omit to append)").option("-p, --profile <name>").action(async (id, opts) => {
4965
+ cmd.command("add-email <id>").description("Add an email to a sequence (appends to the end)").requiredOption("--subject <subject>", "email subject line").option("--text <body>", "plain-text body (provide a text and/or HTML body)").option("--html <body>", "HTML body (provide a text and/or HTML body)").option("--text-file <path>", "read the plain-text body from a file (- for stdin)").option("--html-file <path>", "read the HTML body from a file (- for stdin)").requiredOption("--delay <n>", "wait before this email, with --unit (0 = on enrollment)").option("--unit <unit>", "minutes|hours|days", "days").option("--position <n>", "1-based insert position (omit to append)").option("-p, --profile <name>").action(async (id, opts) => {
4867
4966
  try {
4868
- if (!opts.text && !opts.html) {
4869
- console.error("Provide --text and/or --html for the email body.");
4967
+ const { text, html } = readBodies(opts);
4968
+ if (!text && !html) {
4969
+ console.error("Provide a body with --text/--text-file and/or --html/--html-file.");
4870
4970
  process.exitCode = 1;
4871
4971
  return;
4872
4972
  }
4973
+ const delay = parseDelay(opts.delay, opts.unit);
4873
4974
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
4874
4975
  const step = await client.sequences.addEmail(id, {
4875
4976
  subject: opts.subject,
4876
- text_body: opts.text,
4877
- html_body: opts.html,
4878
- delay_value: Number(opts.delay),
4879
- delay_unit: opts.unit,
4977
+ text_body: text,
4978
+ html_body: html,
4979
+ delay_value: delay.delay_value ?? 0,
4980
+ delay_unit: delay.delay_unit ?? "days",
4880
4981
  position: opts.position != null ? Number(opts.position) : void 0
4881
4982
  });
4882
4983
  console.log(`\u2713 Added email #${step.position}: "${step.subject}" (after ${step.delay_value ?? 0} ${step.delay_unit ?? opts.unit})`);
@@ -4886,6 +4987,106 @@ Next: add emails with
4886
4987
  return;
4887
4988
  }
4888
4989
  });
4990
+ cmd.command("emails <id>").description("List a sequence's emails in order, with the IDs the edit commands take").option("-o, --output <format>").option("-p, --profile <name>").action(async (id, opts) => {
4991
+ try {
4992
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
4993
+ const { steps } = await client.sequences.get(id);
4994
+ const rows = [...steps ?? []].sort((a, b) => a.position - b.position);
4995
+ console.log(render(rows, [
4996
+ { header: "#", get: (r) => String(r.position) },
4997
+ { header: "Subject", get: (r) => r.subject },
4998
+ { header: "Wait", get: (r) => `${r.delay_value ?? 0} ${r.delay_unit ?? "days"}` },
4999
+ { header: "ID", get: (r) => r.id }
5000
+ ], opts.output ?? defaultFormat()));
5001
+ } catch (err) {
5002
+ console.error(formatErrorForCli(err));
5003
+ process.exitCode = 1;
5004
+ return;
5005
+ }
5006
+ });
5007
+ cmd.command("update-email <id> <emailId>").description("Edit an email in a sequence (only the options you pass change)").option("--subject <subject>", "new subject line").option("--text <body>", "new plain-text body").option("--html <body>", "new HTML body").option("--text-file <path>", "read the new plain-text body from a file (- for stdin)").option("--html-file <path>", "read the new HTML body from a file (- for stdin)").option("--delay <n>", "new wait before this email").option("--unit <unit>", "minutes|hours|days").option("-p, --profile <name>").action(async (id, emailId, opts) => {
5008
+ try {
5009
+ const { text, html } = readBodies(opts);
5010
+ const delay = parseDelay(opts.delay, opts.unit);
5011
+ const updates = {
5012
+ ...opts.subject !== void 0 ? { subject: opts.subject } : {},
5013
+ ...text !== void 0 ? { text_body: text } : {},
5014
+ ...html !== void 0 ? { html_body: html } : {},
5015
+ ...delay
5016
+ };
5017
+ if (Object.keys(updates).length === 0) {
5018
+ console.error("Nothing to change. Pass --subject, a body, --delay or --unit.");
5019
+ process.exitCode = 1;
5020
+ return;
5021
+ }
5022
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5023
+ const step = await client.sequences.updateEmail(id, emailId, updates);
5024
+ console.log(`\u2713 Updated email #${step.position}: "${step.subject}" (after ${step.delay_value ?? 0} ${step.delay_unit ?? "days"})`);
5025
+ } catch (err) {
5026
+ console.error(formatErrorForCli(err));
5027
+ process.exitCode = 1;
5028
+ return;
5029
+ }
5030
+ });
5031
+ cmd.command("remove-email <id> <emailId>").description("Remove an email from a sequence (the rest close up the gap)").option("-y, --yes", "skip confirmation").option("-p, --profile <name>").action(async (id, emailId, opts) => {
5032
+ try {
5033
+ if (!await confirmed(`Remove email ${emailId} from the sequence? This cannot be undone.`, opts.yes)) return;
5034
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5035
+ await client.sequences.removeEmail(id, emailId);
5036
+ console.log(`\u2713 Removed email ${emailId}`);
5037
+ } catch (err) {
5038
+ console.error(formatErrorForCli(err));
5039
+ process.exitCode = 1;
5040
+ return;
5041
+ }
5042
+ });
5043
+ cmd.command("reorder <id> <emailIds...>").description("Set the order of a sequence's emails (list every email ID, first to last)").option("-p, --profile <name>").action(async (id, emailIds, opts) => {
5044
+ try {
5045
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5046
+ await client.sequences.reorderEmails(id, emailIds);
5047
+ console.log(`\u2713 Reordered ${emailIds.length} emails`);
5048
+ } catch (err) {
5049
+ console.error(formatErrorForCli(err));
5050
+ process.exitCode = 1;
5051
+ return;
5052
+ }
5053
+ });
5054
+ cmd.command("update <id>").description("Change a sequence's settings (only the options you pass change)").option("-n, --name <name>", "new name").option("--description <text>", "new description").option("--sender <id>", "sender identity UUID").option("--exit-on-reply", "stop sending when a contact replies").option("--no-exit-on-reply", "keep sending after a contact replies").option("--exit-on-bounce", "stop sending after a bounce").option("--no-exit-on-bounce", "keep sending after a bounce").option("--transactional", "billing/account mail: still sends to marketing unsubscribes, no unsubscribe footer").option("--no-transactional", "marketing mail: honors unsubscribes, adds the unsubscribe footer").option("-p, --profile <name>").action(async (id, opts) => {
5055
+ try {
5056
+ const updates = Object.fromEntries(Object.entries({
5057
+ name: opts.name,
5058
+ description: opts.description,
5059
+ sender_identity_id: opts.sender,
5060
+ exit_on_reply: opts.exitOnReply,
5061
+ exit_on_bounce: opts.exitOnBounce,
5062
+ is_transactional: opts.transactional
5063
+ }).filter(([, v]) => v !== void 0));
5064
+ if (Object.keys(updates).length === 0) {
5065
+ console.error("Nothing to change. Pass at least one option (see --help).");
5066
+ process.exitCode = 1;
5067
+ return;
5068
+ }
5069
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5070
+ const seq = await client.sequences.update(id, updates);
5071
+ console.log(`\u2713 Updated sequence "${seq.name ?? id}"`);
5072
+ } catch (err) {
5073
+ console.error(formatErrorForCli(err));
5074
+ process.exitCode = 1;
5075
+ return;
5076
+ }
5077
+ });
5078
+ cmd.command("delete <id>").description("Permanently delete a sequence, its emails and its enrollments").option("-y, --yes", "skip confirmation").option("-p, --profile <name>").action(async (id, opts) => {
5079
+ try {
5080
+ if (!await confirmed(`Delete sequence ${id}, its emails and enrollments? This cannot be undone. (archive keeps them)`, opts.yes)) return;
5081
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5082
+ await client.sequences.delete(id);
5083
+ console.log(`\u2713 Deleted sequence ${id}`);
5084
+ } catch (err) {
5085
+ console.error(formatErrorForCli(err));
5086
+ process.exitCode = 1;
5087
+ return;
5088
+ }
5089
+ });
4889
5090
  const setStatus = (verb, status, desc) => {
4890
5091
  cmd.command(`${verb} <id>`).description(desc).option("-p, --profile <name>").action(async (id, opts) => {
4891
5092
  try {
@@ -4924,7 +5125,7 @@ Next: add emails with
4924
5125
  }
4925
5126
 
4926
5127
  // src/commands/email.ts
4927
- import { readFileSync as readFileSync5 } from "fs";
5128
+ import { readFileSync as readFileSync6 } from "fs";
4928
5129
  function registerEmailCommands(parent) {
4929
5130
  const cmd = parent.command("email").description("Draft and revise email from your own address");
4930
5131
  cmd.command("identities").alias("addresses").description("List the addresses you can send from").option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
@@ -4956,7 +5157,7 @@ function registerEmailCommands(parent) {
4956
5157
  const splitAddrs = (v) => (v ?? "").split(",").map((s) => s.trim()).filter(Boolean);
4957
5158
  let body = opts.body;
4958
5159
  if (opts.bodyFile) {
4959
- body = readFileSync5(opts.bodyFile === "-" ? 0 : opts.bodyFile, "utf8");
5160
+ body = readFileSync6(opts.bodyFile === "-" ? 0 : opts.bodyFile, "utf8");
4960
5161
  }
4961
5162
  if (!body && !opts.html) {
4962
5163
  throw new Error("--body, --body-file, or --html is required");
@@ -5017,7 +5218,7 @@ function registerEmailCommands(parent) {
5017
5218
  const splitAddrs = (v) => v.split(",").map((s) => s.trim()).filter(Boolean);
5018
5219
  let body = opts.body;
5019
5220
  if (opts.bodyFile) {
5020
- body = readFileSync5(opts.bodyFile === "-" ? 0 : opts.bodyFile, "utf8");
5221
+ body = readFileSync6(opts.bodyFile === "-" ? 0 : opts.bodyFile, "utf8");
5021
5222
  }
5022
5223
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5023
5224
  const draft = await client.email.updateDraft({
@@ -5055,6 +5256,69 @@ function registerEmailCommands(parent) {
5055
5256
  });
5056
5257
  }
5057
5258
 
5259
+ // src/commands/outcome.ts
5260
+ var RESULTS = ["success", "failure", "neutral"];
5261
+ function parseNumber(flag) {
5262
+ return (v) => {
5263
+ const n = Number(v);
5264
+ if (!Number.isFinite(n)) throw new Error(`${flag} must be a number (got "${v}").`);
5265
+ return n;
5266
+ };
5267
+ }
5268
+ function registerOutcomeCommands(parent) {
5269
+ const cmd = parent.command("outcome").description("Record and list business results that agents learn from");
5270
+ cmd.command("record <result> <label>").description('Record a result (success, failure or neutral), e.g. outcome record success "Consult booked" --company <id>').option("--company <id>", "the company it is about").option("--ref <id>", "id of the object in a connected tool (an ad campaign, a form, a booking)").option("--toolkit <slug>", "the connected tool --ref comes from, e.g. metaads").option("--runs <ids>", "agent run ids known to have caused it, comma-separated").option("--metric <name>", "measurement name, e.g. cost_per_lead").option("--metric-value <n>", "measurement value", parseNumber("--metric-value")).option("--metric-unit <unit>", "measurement unit, e.g. USD").option("--value <usd>", "what the result is worth, in USD", parseNumber("--value")).option("--at <iso>", "when it happened (ISO 8601, default: now)").option("--note <text>").option("--key <key>", "idempotency key: recording the same key again does nothing").option("-p, --profile <name>").action(async (result, label, opts) => {
5271
+ try {
5272
+ if (!RESULTS.includes(result)) throw new Error(`Result must be success, failure or neutral (got "${result}").`);
5273
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5274
+ const out = await client.outcomes.record({
5275
+ result,
5276
+ label,
5277
+ company_id: opts.company,
5278
+ external_ref: opts.ref,
5279
+ toolkit: opts.toolkit,
5280
+ run_ids: opts.runs ? String(opts.runs).split(",").map((s) => s.trim()).filter(Boolean) : void 0,
5281
+ metric: opts.metric,
5282
+ metric_value: opts.metricValue,
5283
+ metric_unit: opts.metricUnit,
5284
+ value_usd: opts.value,
5285
+ occurred_at: opts.at,
5286
+ note: opts.note,
5287
+ idempotency_key: opts.key
5288
+ });
5289
+ console.log(JSON.stringify(out, null, 2));
5290
+ } catch (err) {
5291
+ console.error(formatErrorForCli(err));
5292
+ process.exitCode = 1;
5293
+ return;
5294
+ }
5295
+ });
5296
+ cmd.command("list").description("List recorded results, newest first").option("--company <id>").option("--result <result>", "success, failure or neutral").option("--source <source>", "system, agent, workflow, api or user").option("--since <date>", "on or after this date (ISO 8601)").option("-l, --limit <n>", "max rows (max 100)", (v) => parseInt(v, 10), 25).option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
5297
+ try {
5298
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
5299
+ const rows = await client.outcomes.list({
5300
+ company_id: opts.company,
5301
+ result: opts.result,
5302
+ source: opts.source,
5303
+ since: opts.since,
5304
+ limit: opts.limit
5305
+ });
5306
+ console.log(render(rows, [
5307
+ { header: "What", get: (r) => r.what, truncate: 40 },
5308
+ { header: "Result", get: (r) => r.result },
5309
+ { header: "Company", get: (r) => r.company_name ?? "", truncate: 24 },
5310
+ { header: "Source", get: (r) => r.source },
5311
+ { header: "When", get: (r) => r.occurred_at?.slice(0, 16) },
5312
+ { header: "ID", get: (r) => r.outcome_id, truncate: 8 }
5313
+ ], opts.output ?? defaultFormat()));
5314
+ } catch (err) {
5315
+ console.error(formatErrorForCli(err));
5316
+ process.exitCode = 1;
5317
+ return;
5318
+ }
5319
+ });
5320
+ }
5321
+
5058
5322
  // src/cli.ts
5059
5323
  var program = new Command4();
5060
5324
  program.name("helm-ai").description("Helm CLI \u2014 run your business operations (projects, CRM, billing, automations, AI agents) from the terminal").version(version, "-v, --version").addHelpText("beforeAll", () => process.stdout.isTTY ? renderSplash({ version }) : "");
@@ -5084,6 +5348,7 @@ registerTemplateCommands(program);
5084
5348
  registerWorkflowCommands(program);
5085
5349
  registerSequenceCommands(program);
5086
5350
  registerEmailCommands(program);
5351
+ registerOutcomeCommands(program);
5087
5352
  program.action(() => {
5088
5353
  if (process.stdout.isTTY) {
5089
5354
  process.stdout.write(renderSplash({ version }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helm-ai/cli",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Command line interface for Helm",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
- "README.md"
12
+ "README.md",
13
+ "CHANGELOG.md"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsup",