@vatio-ai/cli 0.57.0 → 0.58.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.
@@ -1,20 +1,27 @@
1
- // business — the business the agent works for: name, description and opening
2
- // hours. Not part of vatio.yml: it belongs to whoever runs the business and is
3
- // usually edited on the inbox's Business page. This is the same row, for a
4
- // developer setting a workspace up from a terminal. One value for every
5
- // environment, live on save.
6
-
7
- import { readFileSync } from "node:fs";
1
+ // business — the business the agent works for: name, description, opening
2
+ // hours and brand (logo, color, about). Not part of vatio.yml: it belongs to
3
+ // whoever runs the business and is usually edited on the inbox's Business
4
+ // page. This is the same row, for a developer setting a workspace up from a
5
+ // terminal. One value for every environment, live on save.
6
+
7
+ import { readFileSync, statSync } from "node:fs";
8
+ import { basename, extname } from "node:path";
8
9
  import { deployClient } from "./deploy.mjs";
9
10
  import { fail, paint, takeFlag, takeValue } from "../support.mjs";
10
11
 
11
12
  const DAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
12
13
  const DAY_LABELS = { mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat", sun: "Sun" };
13
14
  const RANGE = /^\d{2}:\d{2}-\d{2}:\d{2}$/;
15
+ const HEX = /^#[0-9a-fA-F]{6}$/;
16
+ // The platform checks the type and the size again; these only fail early.
17
+ const LOGO_TYPES = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp", ".gif": "image/gif" };
18
+ const LOGO_MAX_BYTES = 2 * 1024 * 1024;
14
19
 
15
20
  const USAGE =
16
21
  "Usage: vatio business [show]\n" +
17
22
  " vatio business set [--name NAME] [--description TEXT | --description-file FILE]\n" +
23
+ " [--about TEXT] [--color #RRGGBB | --color default]\n" +
24
+ " [--logo FILE | --remove-logo]\n" +
18
25
  " vatio business hours [--timezone ZONE] [--mon 09:00-18:00] [--tue 09:00-13:00,14:00-18:00] ...\n" +
19
26
  " vatio business hours --clear";
20
27
 
@@ -36,6 +43,21 @@ export async function business(config, args) {
36
43
  if (name !== null) fields.name = name;
37
44
  if (description !== null) fields.summary = description;
38
45
  if (file !== null) fields.summary = readFileSync(file === "-" ? 0 : file, "utf8");
46
+
47
+ const about = takeValue(args, "--about");
48
+ if (about !== null) fields.about = about;
49
+
50
+ const color = takeValue(args, "--color");
51
+ if (color !== null) {
52
+ if (color !== "default" && !HEX.test(color)) fail(`--color: "${color}" is not #RRGGBB (or "default")`);
53
+ fields.accent_color = color === "default" ? null : color.toUpperCase();
54
+ }
55
+
56
+ const logo = takeValue(args, "--logo");
57
+ const removeLogo = takeFlag(args, "--remove-logo");
58
+ if (logo !== null && removeLogo) fail("Give --logo or --remove-logo, not both");
59
+ if (logo !== null) fields.logo = readLogo(logo);
60
+ if (removeLogo) fields.logo = null;
39
61
  rejectLeftovers(args);
40
62
  if (Object.keys(fields).length === 0) fail(USAGE);
41
63
 
@@ -80,6 +102,20 @@ export async function business(config, args) {
80
102
  fail(USAGE);
81
103
  }
82
104
 
105
+ // Sent inside the JSON body, base64, the same way the inbox sends it.
106
+ function readLogo(path) {
107
+ const contentType = LOGO_TYPES[extname(path).toLowerCase()];
108
+ if (!contentType) fail(`--logo: ${path} must be a PNG, JPG, WebP or GIF`);
109
+ let size;
110
+ try {
111
+ size = statSync(path).size;
112
+ } catch {
113
+ fail(`--logo: cannot read ${path}`);
114
+ }
115
+ if (size > LOGO_MAX_BYTES) fail(`--logo: ${path} is ${(size / 1024 / 1024).toFixed(1)} MB; the limit is 2 MB`);
116
+ return { data: readFileSync(path).toString("base64"), content_type: contentType, filename: basename(path) };
117
+ }
118
+
83
119
  function rejectLeftovers(args) {
84
120
  if (args.length > 0) fail(`Unexpected: ${args.join(" ")}\n\n${USAGE}`);
85
121
  }
@@ -96,6 +132,12 @@ function print(payload, workspace) {
96
132
  console.log(payload.summary ? indent(payload.summary) : " No description yet. Set one: vatio business set --description \"…\"");
97
133
  console.log("");
98
134
 
135
+ console.log("Brand:");
136
+ console.log(` logo ${payload.logo_url ?? "none (vatio business set --logo FILE)"}`);
137
+ console.log(` color ${payload.accent_color ?? `${payload.default_accent_color} (Vatio's default)`}`);
138
+ console.log(` about ${payload.about ? payload.about.replace(/\s*\n\s*/g, " ") : "none"}`);
139
+ console.log("");
140
+
99
141
  if (!payload.hours) {
100
142
  console.log("Hours: none set — someone is always available");
101
143
  } else {
package/lib/help.mjs CHANGED
@@ -74,8 +74,9 @@ and the one its pull request deploys to. Elsewhere commands default as listed.
74
74
 
75
75
  Business (one value for every environment, live on save; also on the inbox's
76
76
  Business page):
77
- business [show] Name, description, opening hours, handoff rules
77
+ business [show] Name, description, brand, opening hours, handoff rules
78
78
  business set [--name NAME] [--description TEXT | --description-file FILE]
79
+ [--about TEXT] [--color #RRGGBB|default] [--logo FILE | --remove-logo]
79
80
  business hours --timezone ZONE --mon 09:00-18:00 --tue 09:00-13:00,14:00-18:00 ...
80
81
  Replaces the week: a day not given is closed
81
82
  business hours --clear No hours: someone is always available
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vatio-ai/cli",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "Vatio CLI — deploy and manage Vatio agent workspaces",
5
5
  "keywords": [
6
6
  "vatio",