@helm-ai/cli 1.1.0 → 1.3.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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/cli.js +126 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -86,6 +86,7 @@ Every resource follows the same shape — `list`, `get <id>`, `create`, `update
86
86
  | `company`, `contact`, `deal`, `pipeline` | Customers: companies, people, and the sales pipeline |
87
87
  | `invoice`, `estimate`, `product` | Money: billing documents and the product catalog |
88
88
  | `doc` | Rich-text documents, folders, and pages |
89
+ | `file` | Uploaded files and saved links: `list`, and `read` for the extracted text (`--text`) or a download (`--save`) |
89
90
  | `calendar` | Events and meetings |
90
91
  | `form`, `sequence`, `email` | Capture and follow-up |
91
92
  | `workflow`, `template` | Automations and reusable project structures |
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { Command as Command3 } from "commander";
4
+ import { Command as Command4 } from "commander";
5
5
  import kleur8 from "kleur";
6
6
 
7
7
  // src/lib/branding.ts
@@ -25,7 +25,7 @@ function renderSplash(ctx) {
25
25
  }
26
26
 
27
27
  // src/version.ts
28
- var version = "1.1.0";
28
+ var version = "1.3.0";
29
29
 
30
30
  // src/commands/auth.ts
31
31
  import prompts from "prompts";
@@ -641,6 +641,22 @@ var HelmClient = class _HelmClient {
641
641
  return data;
642
642
  }
643
643
  };
644
+ /** Uploaded files and saved links (Helm Files). Documents are `documents`. */
645
+ files = {
646
+ list: async (filters = {}) => {
647
+ const data = await this.request("list_files", "GET", filters);
648
+ return {
649
+ files: data.files ?? [],
650
+ total: data.total ?? null,
651
+ has_more: data.has_more === true
652
+ };
653
+ },
654
+ /** Extracted text when there is any, plus a download link valid for 5 minutes. */
655
+ read: async (fileId) => {
656
+ const data = await this.request("read_file", "GET", { file_id: fileId });
657
+ return data;
658
+ }
659
+ };
644
660
  documents = {
645
661
  list: async (filters = {}) => {
646
662
  const data = await this.request("get_documents", "GET", filters);
@@ -1795,14 +1811,14 @@ function registerPipelineCommands(parent) {
1795
1811
  cmd.command("create").description("Create a pipeline (seeds default stages unless --stage given)").requiredOption("-n, --name <name>", "pipeline name (required)").option("-d, --description <text>").option("--color <name>", "accent color name").option("--default", "make this the default pipeline").option("--stage <key:label>", "seed stage (repeatable), e.g. --stage trial:Trial", collectStage, []).option("-p, --profile <name>").action(async (opts) => {
1796
1812
  try {
1797
1813
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
1798
- const pipeline = await client.pipelines.create({
1814
+ const pipeline2 = await client.pipelines.create({
1799
1815
  name: opts.name,
1800
1816
  description: opts.description,
1801
1817
  color: opts.color,
1802
1818
  is_default: opts.default,
1803
1819
  stages: opts.stage.length ? opts.stage : void 0
1804
1820
  });
1805
- console.log(JSON.stringify(pipeline, null, 2));
1821
+ console.log(JSON.stringify(pipeline2, null, 2));
1806
1822
  } catch (err) {
1807
1823
  console.error(formatErrorForCli(err));
1808
1824
  process.exitCode = 1;
@@ -1812,14 +1828,14 @@ function registerPipelineCommands(parent) {
1812
1828
  cmd.command("update <id>").description("Update a pipeline").option("-n, --name <name>").option("-d, --description <text>").option("--color <name>").option("--default", "make this the default pipeline").option("--position <n>", "order position", (v) => parseInt(v, 10)).option("-p, --profile <name>").action(async (id, opts) => {
1813
1829
  try {
1814
1830
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
1815
- const pipeline = await client.pipelines.update(id, {
1831
+ const pipeline2 = await client.pipelines.update(id, {
1816
1832
  name: opts.name,
1817
1833
  description: opts.description,
1818
1834
  color: opts.color,
1819
1835
  is_default: opts.default,
1820
1836
  position: opts.position
1821
1837
  });
1822
- console.log(JSON.stringify(pipeline, null, 2));
1838
+ console.log(JSON.stringify(pipeline2, null, 2));
1823
1839
  } catch (err) {
1824
1840
  console.error(formatErrorForCli(err));
1825
1841
  process.exitCode = 1;
@@ -3460,7 +3476,10 @@ function registerCalendarCommands(parent) {
3460
3476
  return;
3461
3477
  }
3462
3478
  });
3463
- cmd.command("create").description("Create a calendar event").requiredOption("-t, --title <title>").requiredOption("--start <date>", "ISO 8601 start time").requiredOption("--end <date>", "ISO 8601 end time").option("-d, --description <text>").option("--location <text>").option("--all-day").option("--meet", "auto-create Google Meet link").option("--zoom <url>", "attach a Zoom URL").option("--project <id>").option("--company <id>").option("-p, --profile <name>").action(async (opts) => {
3479
+ cmd.command("create").description("Create a calendar event").requiredOption("-t, --title <title>").requiredOption("--start <date>", "ISO 8601 start time").requiredOption("--end <date>", "ISO 8601 end time").option("-d, --description <text>").option("--location <text>").option("--all-day").option("--meet", "auto-create Google Meet link").option("--zoom <url>", "attach a Zoom URL").option("--project <id>").option("--company <id>").option("--timezone <iana>", "IANA zone, e.g. America/Los_Angeles: --start/--end without an offset are read as wall-clock time there, and a repeating event keeps that local time across daylight saving (default: UTC)").option(
3480
+ "--repeat <rule>",
3481
+ "repeat it: daily, weekly, monthly or yearly (from the start date), or an RRULE line such as 'FREQ=WEEKLY;BYDAY=MO,WE;COUNT=10'. Needs Google Calendar connected"
3482
+ ).option("-p, --profile <name>").action(async (opts) => {
3464
3483
  try {
3465
3484
  const client = HelmClient.fromProfile(resolveProfile(opts.profile));
3466
3485
  const event = await client.calendar.create({
@@ -3473,7 +3492,9 @@ function registerCalendarCommands(parent) {
3473
3492
  conference_provider: opts.meet ? "google_meet" : opts.zoom ? "zoom" : void 0,
3474
3493
  conference_url: opts.zoom,
3475
3494
  project_id: opts.project,
3476
- company_id: opts.company
3495
+ company_id: opts.company,
3496
+ timezone: opts.timezone,
3497
+ recurrence: repeatRule(opts.repeat)
3477
3498
  });
3478
3499
  console.log(JSON.stringify(event, null, 2));
3479
3500
  } catch (err) {
@@ -3494,6 +3515,17 @@ function registerCalendarCommands(parent) {
3494
3515
  }
3495
3516
  });
3496
3517
  }
3518
+ function repeatRule(value) {
3519
+ if (!value) return void 0;
3520
+ const word = value.trim().toLowerCase();
3521
+ const presets = {
3522
+ daily: "RRULE:FREQ=DAILY",
3523
+ weekly: "RRULE:FREQ=WEEKLY",
3524
+ monthly: "RRULE:FREQ=MONTHLY",
3525
+ yearly: "RRULE:FREQ=YEARLY"
3526
+ };
3527
+ return presets[word] ?? value.trim();
3528
+ }
3497
3529
 
3498
3530
  // src/commands/doc.ts
3499
3531
  import { InvalidArgumentError as InvalidArgumentError3 } from "commander";
@@ -3714,6 +3746,90 @@ function registerDocCommands(parent) {
3714
3746
  });
3715
3747
  }
3716
3748
 
3749
+ // src/commands/file.ts
3750
+ import { InvalidArgumentError as InvalidArgumentError4 } from "commander";
3751
+ import { createWriteStream } from "fs";
3752
+ import { Readable } from "stream";
3753
+ import { pipeline } from "stream/promises";
3754
+ var KINDS = ["image", "pdf", "spreadsheet", "video", "link", "other"];
3755
+ function parseKind(value) {
3756
+ if (!KINDS.includes(value)) {
3757
+ throw new InvalidArgumentError4(`must be one of: ${KINDS.join(", ")}`);
3758
+ }
3759
+ return value;
3760
+ }
3761
+ function parseCount(value) {
3762
+ const n = Number(value);
3763
+ if (!Number.isInteger(n) || n < 1) throw new InvalidArgumentError4("must be a whole number, 1 or more");
3764
+ return n;
3765
+ }
3766
+ function formatSize(bytes) {
3767
+ if (typeof bytes !== "number" || bytes < 0) return "";
3768
+ const units = ["B", "KB", "MB", "GB"];
3769
+ let n = bytes;
3770
+ let i = 0;
3771
+ while (n >= 1024 && i < units.length - 1) {
3772
+ n /= 1024;
3773
+ i++;
3774
+ }
3775
+ return i === 0 ? `${n} B` : `${n.toFixed(1)} ${units[i]}`;
3776
+ }
3777
+ function registerFileCommands(parent) {
3778
+ const cmd = parent.command("file").alias("files").description("Uploaded files and saved links (Helm Files)");
3779
+ cmd.command("list").description("List files, newest first").option("-q, --query <text>", "match part of the file name").option("-k, --kind <kind>", KINDS.join("|"), parseKind).option("--folder <id>", 'a folder id, or "root" for files in no folder').option("--company <id>", "files attached to this company").option("--project <id>", "files attached to this project").option("-l, --limit <n>", "max rows (up to 100)", parseCount, 25).option("-o, --output <format>").option("-p, --profile <name>").action(async (opts) => {
3780
+ try {
3781
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
3782
+ const { files, total, has_more } = await client.files.list({
3783
+ query: opts.query,
3784
+ kind: opts.kind,
3785
+ folder_id: opts.folder,
3786
+ company_id: opts.company,
3787
+ project_id: opts.project,
3788
+ limit: opts.limit
3789
+ });
3790
+ console.log(render(files, [
3791
+ { header: "Name", get: (r) => r.name, truncate: 40 },
3792
+ { header: "Kind", get: (r) => r.kind },
3793
+ { header: "Size", get: (r) => r.kind === "link" ? "" : formatSize(r.size_bytes) },
3794
+ { header: "Folder", get: (r) => r.folder ?? "" },
3795
+ { header: "Added", get: (r) => r.created_at?.slice(0, 10) },
3796
+ { header: "ID", get: (r) => r.file_id }
3797
+ ], opts.output ?? defaultFormat()));
3798
+ if (has_more) console.error(`Showing ${files.length}${total !== null ? ` of ${total}` : ""}. Use --limit for more.`);
3799
+ } catch (err) {
3800
+ console.error(formatErrorForCli(err));
3801
+ process.exitCode = 1;
3802
+ }
3803
+ });
3804
+ cmd.command("read <id>").description("Show a file: its extracted text and a 5-minute download link (JSON by default)").option("--text", "print only the extracted text").option("--save <path>", "download the file to this path").option("-p, --profile <name>").action(async (id, opts) => {
3805
+ try {
3806
+ const client = HelmClient.fromProfile(resolveProfile(opts.profile));
3807
+ const file = await client.files.read(id);
3808
+ if (opts.save) {
3809
+ if (!file.download_url) throw new Error(file.kind === "link" ? `That's a saved link: ${file.url}` : "No download link for that file.");
3810
+ const res = await fetch(file.download_url);
3811
+ if (!res.ok || !res.body) throw new Error(`Download failed (${res.status}).`);
3812
+ await pipeline(Readable.fromWeb(res.body), createWriteStream(opts.save));
3813
+ console.error(`Saved ${file.name} to ${opts.save}`);
3814
+ return;
3815
+ }
3816
+ if (opts.text) {
3817
+ if (typeof file.text !== "string") {
3818
+ const why = file.kind === "link" ? `it's a saved link: ${file.url}` : file.text_status === "pending" ? "its text is still being extracted" : "no text could be extracted from it";
3819
+ throw new Error(`No text for ${file.name}: ${why}.`);
3820
+ }
3821
+ console.log(file.text);
3822
+ if (file.text_truncated) console.error("(Only the first part of this file was extracted.)");
3823
+ return;
3824
+ }
3825
+ console.log(JSON.stringify(file, null, 2));
3826
+ } catch (err) {
3827
+ console.error(formatErrorForCli(err));
3828
+ process.exitCode = 1;
3829
+ }
3830
+ });
3831
+ }
3832
+
3717
3833
  // src/commands/agent.ts
3718
3834
  var DAY_MAP = {
3719
3835
  sun: 0,
@@ -4919,7 +5035,7 @@ function registerEmailCommands(parent) {
4919
5035
  }
4920
5036
 
4921
5037
  // src/cli.ts
4922
- var program = new Command3();
5038
+ var program = new Command4();
4923
5039
  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 }) : "");
4924
5040
  registerAuthCommands(program);
4925
5041
  registerProfileCommands(program);
@@ -4940,6 +5056,7 @@ registerProductCommands(program);
4940
5056
  registerFormCommands(program);
4941
5057
  registerCalendarCommands(program);
4942
5058
  registerDocCommands(program);
5059
+ registerFileCommands(program);
4943
5060
  registerAgentCommands(program);
4944
5061
  registerImportCommands(program);
4945
5062
  registerTemplateCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helm-ai/cli",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Command line interface for Helm",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",