@arjun-shah/agentbar-cli 0.1.0 → 0.1.7

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/README.md CHANGED
@@ -4,6 +4,12 @@ CLI helper to generate and manage the Agent Plugin Bar embed snippet.
4
4
 
5
5
  ## Install
6
6
 
7
+ ```bash
8
+ npm install -g agentbar-cli
9
+ ```
10
+
11
+ If you prefer the scoped package directly:
12
+
7
13
  ```bash
8
14
  npm install -g @arjun-shah/agentbar-cli
9
15
  ```
@@ -17,3 +23,43 @@ agentbar set siteUrl https://your-site.com
17
23
  ```
18
24
 
19
25
  The CLI writes `agentbar.config.json` in your project directory.
26
+
27
+ ## Customization
28
+
29
+ You can update appearance and behavior with `agentbar set`:
30
+
31
+ ```bash
32
+ agentbar set themeColor "#0ea5e9"
33
+ agentbar set accentTextColor "#0f172a"
34
+ agentbar set userBubbleBackground "rgba(14,165,233,0.12)"
35
+ agentbar set assistantBubbleBackground "#f8fafc"
36
+ agentbar set fontFamily "Satoshi, ui-sans-serif"
37
+ agentbar set position right
38
+ agentbar set offsetY 24
39
+ agentbar set draggable true
40
+ agentbar set persistPosition true
41
+ agentbar set dragOffset 0
42
+ agentbar set inputPlaceholder "Ask about this page"
43
+ agentbar set sendLabel "Send"
44
+ agentbar set suggestions "Search pricing | Summarize docs | Draft copy"
45
+ agentbar set badgeLabel "AI"
46
+ agentbar set greeting "Welcome back. How can I help?"
47
+ agentbar set persist true
48
+ agentbar set showReset true
49
+ agentbar set showExport true
50
+ agentbar set exportLabel "Copy"
51
+ agentbar set showScrollButton true
52
+ agentbar set scrollLabel "Scroll"
53
+ agentbar set showMinimize true
54
+ agentbar set minimizedOnLoad false
55
+ agentbar set minimizeLabel "Minimize"
56
+ agentbar set expandLabel "Expand"
57
+ agentbar set showTimestamps true
58
+ agentbar set timestampLocale "en-US"
59
+ agentbar set autoScroll true
60
+ agentbar set autoScrollThreshold 24
61
+ agentbar set messageMaxWidth "85%"
62
+ agentbar set launcherTooltip "Open assistant"
63
+ agentbar set openOnLoad false
64
+ agentbar set autoIngest true
65
+ ```
package/bin/agentbar.js CHANGED
@@ -14,8 +14,62 @@ const DEFAULT_CONFIG = {
14
14
  themeColor: "#059669",
15
15
  position: "right",
16
16
  title: "Site Assistant",
17
- subtitle: "Ask anything about this site.",
18
- buttonLabel: "Ask",
17
+ subtitle: "Get answers from your site.",
18
+ buttonLabel: "",
19
+ fontFamily: "ui-sans-serif, system-ui, -apple-system",
20
+ panelBackground: "#ffffff",
21
+ textColor: "#0f172a",
22
+ mutedTextColor: "#64748b",
23
+ borderColor: "#e2e8f0",
24
+ buttonBackground: "#ffffff",
25
+ buttonTextColor: "#0f172a",
26
+ accentTextColor: "",
27
+ buttonShadow: "0 18px 40px -28px rgba(15, 23, 42, 0.35)",
28
+ panelShadow: "0 30px 60px -45px rgba(15, 23, 42, 0.35)",
29
+ badgeLabel: "",
30
+ badgeBackground: "",
31
+ badgeTextColor: "",
32
+ userBubbleBackground: "",
33
+ userBubbleText: "",
34
+ userBubbleBorder: "",
35
+ assistantBubbleBackground: "",
36
+ assistantBubbleText: "",
37
+ assistantBubbleBorder: "",
38
+ panelWidth: "320px",
39
+ panelMaxHeight: "70vh",
40
+ panelRadius: "16px",
41
+ buttonRadius: "16px",
42
+ offsetX: 20,
43
+ offsetY: 20,
44
+ inputPlaceholder: "Type a message",
45
+ sendLabel: "Send",
46
+ suggestions: ["Search pricing", "Explain a feature", "Draft homepage copy"],
47
+ greeting: "",
48
+ draggable: true,
49
+ dragOffset: 0,
50
+ persistPosition: false,
51
+ positionKey: "",
52
+ openOnLoad: false,
53
+ autoIngest: true,
54
+ closeOnOutsideClick: true,
55
+ showReset: false,
56
+ persist: false,
57
+ storageKey: "",
58
+ showTypingIndicator: true,
59
+ showExport: false,
60
+ exportLabel: "Copy",
61
+ showScrollButton: true,
62
+ scrollLabel: "Scroll",
63
+ showMinimize: false,
64
+ minimizedOnLoad: false,
65
+ minimizeLabel: "Minimize",
66
+ expandLabel: "Expand",
67
+ showTimestamps: false,
68
+ timestampLocale: "",
69
+ autoScroll: true,
70
+ autoScrollThreshold: 24,
71
+ messageMaxWidth: "85%",
72
+ launcherTooltip: "",
19
73
  };
20
74
 
21
75
  const configPath = path.join(process.cwd(), CONFIG_FILE);
@@ -63,6 +117,168 @@ const renderSnippet = (config) => {
63
117
  if (config.buttonLabel) {
64
118
  lines.push(` data-button-label=\"${config.buttonLabel}\"`);
65
119
  }
120
+ if (config.fontFamily) {
121
+ lines.push(` data-font-family=\"${config.fontFamily}\"`);
122
+ }
123
+ if (config.panelBackground) {
124
+ lines.push(` data-panel-background=\"${config.panelBackground}\"`);
125
+ }
126
+ if (config.textColor) {
127
+ lines.push(` data-text-color=\"${config.textColor}\"`);
128
+ }
129
+ if (config.mutedTextColor) {
130
+ lines.push(` data-muted-text-color=\"${config.mutedTextColor}\"`);
131
+ }
132
+ if (config.borderColor) {
133
+ lines.push(` data-border-color=\"${config.borderColor}\"`);
134
+ }
135
+ if (config.buttonBackground) {
136
+ lines.push(` data-button-background=\"${config.buttonBackground}\"`);
137
+ }
138
+ if (config.buttonTextColor) {
139
+ lines.push(` data-button-text-color=\"${config.buttonTextColor}\"`);
140
+ }
141
+ if (config.accentTextColor) {
142
+ lines.push(` data-accent-text-color=\"${config.accentTextColor}\"`);
143
+ }
144
+ if (config.buttonShadow) {
145
+ lines.push(` data-button-shadow=\"${config.buttonShadow}\"`);
146
+ }
147
+ if (config.panelShadow) {
148
+ lines.push(` data-panel-shadow=\"${config.panelShadow}\"`);
149
+ }
150
+ if (config.badgeLabel) {
151
+ lines.push(` data-badge-label=\"${config.badgeLabel}\"`);
152
+ }
153
+ if (config.badgeBackground) {
154
+ lines.push(` data-badge-background=\"${config.badgeBackground}\"`);
155
+ }
156
+ if (config.badgeTextColor) {
157
+ lines.push(` data-badge-text-color=\"${config.badgeTextColor}\"`);
158
+ }
159
+ if (config.userBubbleBackground) {
160
+ lines.push(` data-user-bubble-background=\"${config.userBubbleBackground}\"`);
161
+ }
162
+ if (config.userBubbleText) {
163
+ lines.push(` data-user-bubble-text=\"${config.userBubbleText}\"`);
164
+ }
165
+ if (config.userBubbleBorder) {
166
+ lines.push(` data-user-bubble-border=\"${config.userBubbleBorder}\"`);
167
+ }
168
+ if (config.assistantBubbleBackground) {
169
+ lines.push(` data-assistant-bubble-background=\"${config.assistantBubbleBackground}\"`);
170
+ }
171
+ if (config.assistantBubbleText) {
172
+ lines.push(` data-assistant-bubble-text=\"${config.assistantBubbleText}\"`);
173
+ }
174
+ if (config.assistantBubbleBorder) {
175
+ lines.push(` data-assistant-bubble-border=\"${config.assistantBubbleBorder}\"`);
176
+ }
177
+ if (config.panelWidth) {
178
+ lines.push(` data-panel-width=\"${config.panelWidth}\"`);
179
+ }
180
+ if (config.panelMaxHeight) {
181
+ lines.push(` data-panel-max-height=\"${config.panelMaxHeight}\"`);
182
+ }
183
+ if (config.panelRadius) {
184
+ lines.push(` data-panel-radius=\"${config.panelRadius}\"`);
185
+ }
186
+ if (config.buttonRadius) {
187
+ lines.push(` data-button-radius=\"${config.buttonRadius}\"`);
188
+ }
189
+ if (typeof config.offsetX === "number") {
190
+ lines.push(` data-offset-x=\"${config.offsetX}\"`);
191
+ }
192
+ if (typeof config.offsetY === "number") {
193
+ lines.push(` data-offset-y=\"${config.offsetY}\"`);
194
+ }
195
+ if (config.inputPlaceholder) {
196
+ lines.push(` data-input-placeholder=\"${config.inputPlaceholder}\"`);
197
+ }
198
+ if (config.sendLabel) {
199
+ lines.push(` data-send-label=\"${config.sendLabel}\"`);
200
+ }
201
+ if (config.suggestions?.length) {
202
+ lines.push(` data-suggestions=\"${config.suggestions.join(" | ")}\"`);
203
+ }
204
+ if (config.greeting) {
205
+ lines.push(` data-greeting=\"${config.greeting}\"`);
206
+ }
207
+ if (typeof config.draggable === "boolean") {
208
+ lines.push(` data-draggable=\"${config.draggable}\"`);
209
+ }
210
+ if (typeof config.dragOffset === "number" && config.dragOffset !== 0) {
211
+ lines.push(` data-drag-offset=\"${config.dragOffset}\"`);
212
+ }
213
+ if (typeof config.persistPosition === "boolean") {
214
+ lines.push(` data-persist-position=\"${config.persistPosition}\"`);
215
+ }
216
+ if (config.positionKey) {
217
+ lines.push(` data-position-key=\"${config.positionKey}\"`);
218
+ }
219
+ if (config.openOnLoad) {
220
+ lines.push(` data-open=\"${config.openOnLoad}\"`);
221
+ }
222
+ if (config.showReset) {
223
+ lines.push(` data-show-reset=\"${config.showReset}\"`);
224
+ }
225
+ if (config.persist) {
226
+ lines.push(` data-persist=\"${config.persist}\"`);
227
+ }
228
+ if (config.storageKey) {
229
+ lines.push(` data-storage-key=\"${config.storageKey}\"`);
230
+ }
231
+ if (typeof config.showTypingIndicator === "boolean") {
232
+ lines.push(` data-show-typing-indicator=\"${config.showTypingIndicator}\"`);
233
+ }
234
+ if (typeof config.showExport === "boolean") {
235
+ lines.push(` data-show-export=\"${config.showExport}\"`);
236
+ }
237
+ if (config.exportLabel) {
238
+ lines.push(` data-export-label=\"${config.exportLabel}\"`);
239
+ }
240
+ if (typeof config.showScrollButton === "boolean") {
241
+ lines.push(` data-show-scroll-button=\"${config.showScrollButton}\"`);
242
+ }
243
+ if (config.scrollLabel) {
244
+ lines.push(` data-scroll-label=\"${config.scrollLabel}\"`);
245
+ }
246
+ if (typeof config.showMinimize === "boolean") {
247
+ lines.push(` data-show-minimize=\"${config.showMinimize}\"`);
248
+ }
249
+ if (typeof config.minimizedOnLoad === "boolean") {
250
+ lines.push(` data-minimized-on-load=\"${config.minimizedOnLoad}\"`);
251
+ }
252
+ if (config.minimizeLabel) {
253
+ lines.push(` data-minimize-label=\"${config.minimizeLabel}\"`);
254
+ }
255
+ if (config.expandLabel) {
256
+ lines.push(` data-expand-label=\"${config.expandLabel}\"`);
257
+ }
258
+ if (typeof config.showTimestamps === "boolean") {
259
+ lines.push(` data-show-timestamps=\"${config.showTimestamps}\"`);
260
+ }
261
+ if (config.timestampLocale) {
262
+ lines.push(` data-timestamp-locale=\"${config.timestampLocale}\"`);
263
+ }
264
+ if (typeof config.autoScroll === "boolean") {
265
+ lines.push(` data-auto-scroll=\"${config.autoScroll}\"`);
266
+ }
267
+ if (typeof config.autoScrollThreshold === "number") {
268
+ lines.push(` data-auto-scroll-threshold=\"${config.autoScrollThreshold}\"`);
269
+ }
270
+ if (config.messageMaxWidth) {
271
+ lines.push(` data-message-max-width=\"${config.messageMaxWidth}\"`);
272
+ }
273
+ if (config.launcherTooltip) {
274
+ lines.push(` data-launcher-tooltip=\"${config.launcherTooltip}\"`);
275
+ }
276
+ if (typeof config.autoIngest === "boolean") {
277
+ lines.push(` data-auto-ingest=\"${config.autoIngest}\"`);
278
+ }
279
+ if (typeof config.closeOnOutsideClick === "boolean") {
280
+ lines.push(` data-close-on-outside-click=\"${config.closeOnOutsideClick}\"`);
281
+ }
66
282
  lines.push("></script>");
67
283
  return lines.join("\n");
68
284
  };
@@ -76,8 +292,37 @@ const printHelp = () => {
76
292
  console.log(" agentbar config Print config JSON");
77
293
  console.log(" agentbar help Show help\n");
78
294
  console.log("Config keys:");
79
- console.log(" siteUrl, apiBase, depth, maxPages, siteKey, themeColor, position,");
80
- console.log(" title, subtitle, buttonLabel\n");
295
+ console.log(
296
+ " siteUrl, apiBase, depth, maxPages, siteKey, themeColor, position, title, subtitle,"
297
+ );
298
+ console.log(
299
+ " buttonLabel, fontFamily, panelBackground, textColor, mutedTextColor, borderColor,"
300
+ );
301
+ console.log(
302
+ " buttonBackground, buttonTextColor, accentTextColor, buttonShadow, panelShadow, badgeLabel,"
303
+ );
304
+ console.log(
305
+ " badgeBackground, badgeTextColor, userBubbleBackground, userBubbleText, userBubbleBorder,"
306
+ );
307
+ console.log(
308
+ " assistantBubbleBackground, assistantBubbleText, assistantBubbleBorder, panelWidth, panelMaxHeight,"
309
+ );
310
+ console.log(
311
+ " panelRadius, buttonRadius, offsetX, offsetY, inputPlaceholder, sendLabel, suggestions,"
312
+ );
313
+ console.log(
314
+ " greeting, draggable, dragOffset, persistPosition, positionKey, openOnLoad, autoIngest,"
315
+ );
316
+ console.log(
317
+ " showReset, persist, storageKey, showTypingIndicator, showExport, exportLabel,"
318
+ );
319
+ console.log(
320
+ " showScrollButton, scrollLabel, showMinimize, minimizedOnLoad, minimizeLabel, expandLabel,"
321
+ );
322
+ console.log(
323
+ " showTimestamps, timestampLocale, autoScroll, autoScrollThreshold, messageMaxWidth,"
324
+ );
325
+ console.log(" launcherTooltip, closeOnOutsideClick\n");
81
326
  console.log(`Config file: ${configPath}`);
82
327
  };
83
328
 
@@ -110,6 +355,47 @@ const init = async () => {
110
355
  config.title = await ask(rl, "Widget title", config.title);
111
356
  config.subtitle = await ask(rl, "Widget subtitle", config.subtitle);
112
357
  config.buttonLabel = await ask(rl, "Button label", config.buttonLabel);
358
+ config.fontFamily = await ask(rl, "Font family", config.fontFamily);
359
+ config.inputPlaceholder = await ask(rl, "Input placeholder", config.inputPlaceholder);
360
+ config.sendLabel = await ask(rl, "Send button label", config.sendLabel);
361
+ const suggestionInput = await ask(
362
+ rl,
363
+ "Suggestions (pipe or comma separated)",
364
+ config.suggestions.join(" | ")
365
+ );
366
+ config.suggestions = suggestionInput
367
+ .split(/[|,]/)
368
+ .map((value) => value.trim())
369
+ .filter(Boolean);
370
+ config.greeting = await ask(rl, "Greeting (optional)", config.greeting);
371
+ config.draggable =
372
+ (await ask(rl, "Draggable launcher (true/false)", String(config.draggable))) === "true";
373
+ config.persistPosition =
374
+ (await ask(rl, "Persist position (true/false)", String(config.persistPosition))) === "true";
375
+ config.openOnLoad = (await ask(rl, "Open on load (true/false)", String(config.openOnLoad))) === "true";
376
+ config.showReset = (await ask(rl, "Show reset button (true/false)", String(config.showReset))) === "true";
377
+ config.persist = (await ask(rl, "Persist chat (true/false)", String(config.persist))) === "true";
378
+ config.showTypingIndicator =
379
+ (await ask(rl, "Show typing indicator (true/false)", String(config.showTypingIndicator))) ===
380
+ "true";
381
+ config.showExport =
382
+ (await ask(rl, "Show export button (true/false)", String(config.showExport))) === "true";
383
+ config.exportLabel = await ask(rl, "Export label", config.exportLabel);
384
+ config.showScrollButton =
385
+ (await ask(rl, "Show scroll button (true/false)", String(config.showScrollButton))) ===
386
+ "true";
387
+ config.scrollLabel = await ask(rl, "Scroll button label", config.scrollLabel);
388
+ config.showMinimize =
389
+ (await ask(rl, "Show minimize button (true/false)", String(config.showMinimize))) ===
390
+ "true";
391
+ config.minimizedOnLoad =
392
+ (await ask(rl, "Minimized on load (true/false)", String(config.minimizedOnLoad))) ===
393
+ "true";
394
+ config.showTimestamps =
395
+ (await ask(rl, "Show timestamps (true/false)", String(config.showTimestamps))) === "true";
396
+ config.autoScroll =
397
+ (await ask(rl, "Auto scroll (true/false)", String(config.autoScroll))) === "true";
398
+ config.autoIngest = (await ask(rl, "Auto ingest (true/false)", String(config.autoIngest))) === "true";
113
399
  } finally {
114
400
  rl.close();
115
401
  }
@@ -134,13 +420,49 @@ const setValue = (key, value) => {
134
420
  process.exit(1);
135
421
  }
136
422
 
137
- if (key === "depth" || key === "maxPages") {
423
+ if (key === "depth" || key === "maxPages" || key === "autoScrollThreshold") {
424
+ const parsed = Number(value);
425
+ if (!Number.isFinite(parsed)) {
426
+ console.error(`${key} must be a number.`);
427
+ process.exit(1);
428
+ }
429
+ config[key] = parsed;
430
+ } else if (key === "offsetX" || key === "offsetY") {
431
+ const parsed = Number(value);
432
+ if (!Number.isFinite(parsed)) {
433
+ console.error(`${key} must be a number.`);
434
+ process.exit(1);
435
+ }
436
+ config[key] = parsed;
437
+ } else if (
438
+ key === "openOnLoad" ||
439
+ key === "autoIngest" ||
440
+ key === "closeOnOutsideClick" ||
441
+ key === "showReset" ||
442
+ key === "persist" ||
443
+ key === "showTypingIndicator" ||
444
+ key === "draggable" ||
445
+ key === "persistPosition" ||
446
+ key === "showExport" ||
447
+ key === "showScrollButton" ||
448
+ key === "showMinimize" ||
449
+ key === "minimizedOnLoad" ||
450
+ key === "showTimestamps" ||
451
+ key === "autoScroll"
452
+ ) {
453
+ config[key] = value === "true" || value === true;
454
+ } else if (key === "dragOffset") {
138
455
  const parsed = Number(value);
139
456
  if (!Number.isFinite(parsed)) {
140
457
  console.error(`${key} must be a number.`);
141
458
  process.exit(1);
142
459
  }
143
460
  config[key] = parsed;
461
+ } else if (key === "suggestions") {
462
+ config[key] = String(value)
463
+ .split(/[|,]/)
464
+ .map((item) => item.trim())
465
+ .filter(Boolean);
144
466
  } else {
145
467
  config[key] = value;
146
468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arjun-shah/agentbar-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Agent Plugin Bar CLI helper.",
6
6
  "bin": {