@walkeros/cli 3.0.0 → 3.0.2

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/dist/index.js CHANGED
@@ -2937,7 +2937,7 @@ function rn(n, e2) {
2937
2937
  }, () => J({ ok: false }))(), "Push", n.hooks);
2938
2938
  }
2939
2939
  async function un(n) {
2940
- const e2 = r({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n, { merge: false, extend: false }), t2 = { level: n.logger?.level, handler: n.logger?.handler }, o2 = i(t2), s2 = { ...e2.globalsStatic, ...n.globals }, a2 = { allowed: false, config: e2, consent: n.consent || {}, count: 0, custom: n.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s2, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n.user || {}, version: "2.1.1", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
2940
+ const e2 = r({ globalsStatic: {}, sessionStatic: {}, tagging: 0, run: true }, n, { merge: false, extend: false }), t2 = { level: n.logger?.level, handler: n.logger?.handler }, o2 = i(t2), s2 = { ...e2.globalsStatic, ...n.globals }, a2 = { allowed: false, config: e2, consent: n.consent || {}, count: 0, custom: n.custom || {}, destinations: {}, transformers: {}, stores: {}, globals: s2, group: "", hooks: {}, logger: o2, on: {}, queue: [], round: 0, session: void 0, status: { startedAt: Date.now(), in: 0, out: 0, failed: 0, sources: {}, destinations: {} }, timing: Date.now(), user: n.user || {}, version: "3.0.1", sources: {}, pending: { sources: {}, destinations: {} }, push: void 0, command: void 0 };
2941
2941
  a2.push = rn(a2, (n2) => ({ timing: Math.round((Date.now() - a2.timing) / 10) / 100, source: { type: "collector", id: "", previous_id: "" }, ...n2 })), a2.command = (function(n2, e3) {
2942
2942
  return an(async (t3, o3, s3) => await cn(async () => await e3(n2, t3, o3, s3), () => J({ ok: false }))(), "Command", n2.hooks);
2943
2943
  })(a2, Y);
@@ -6464,10 +6464,82 @@ async function createDeployCommand(config, options) {
6464
6464
  }
6465
6465
  }
6466
6466
 
6467
+ // src/commands/feedback/index.ts
6468
+ init_config_file();
6469
+ init_cli_logger();
6470
+ import { createInterface } from "readline";
6471
+ async function feedback(text, options) {
6472
+ const config = readConfig();
6473
+ const anonymous = options?.anonymous ?? config?.anonymousFeedback ?? true;
6474
+ const payload = { text };
6475
+ if (!anonymous && config?.email) {
6476
+ payload.userId = config.email;
6477
+ const projectId = process.env.WALKEROS_PROJECT_ID;
6478
+ if (projectId) {
6479
+ payload.projectId = projectId;
6480
+ }
6481
+ }
6482
+ const appUrl = resolveAppUrl();
6483
+ const response = await fetch(`${appUrl}/api/feedback`, {
6484
+ method: "POST",
6485
+ headers: { "Content-Type": "application/json" },
6486
+ body: JSON.stringify(payload)
6487
+ });
6488
+ if (!response.ok) {
6489
+ throw new Error(
6490
+ `Feedback submission failed: ${response.status} ${response.statusText}`
6491
+ );
6492
+ }
6493
+ }
6494
+ async function feedbackCommand(text) {
6495
+ const logger = createCLILogger({});
6496
+ try {
6497
+ const config = readConfig();
6498
+ let anonymous;
6499
+ if (config?.anonymousFeedback === void 0) {
6500
+ const answer = await promptUser(
6501
+ "Include your user and project info with feedback? (y/N) "
6502
+ );
6503
+ const anonymousFeedback = !answer.toLowerCase().startsWith("y");
6504
+ if (config) {
6505
+ writeConfig({ ...config, anonymousFeedback });
6506
+ } else {
6507
+ writeConfig({
6508
+ token: "",
6509
+ email: "",
6510
+ appUrl: "",
6511
+ anonymousFeedback
6512
+ });
6513
+ }
6514
+ anonymous = anonymousFeedback;
6515
+ } else {
6516
+ anonymous = config.anonymousFeedback;
6517
+ }
6518
+ await feedback(text, { anonymous });
6519
+ logger.info("Feedback sent. Thanks!");
6520
+ } catch (error) {
6521
+ logger.error(error instanceof Error ? error.message : String(error));
6522
+ process.exit(1);
6523
+ }
6524
+ }
6525
+ function promptUser(question) {
6526
+ return new Promise((resolve2) => {
6527
+ const rl = createInterface({
6528
+ input: process.stdin,
6529
+ output: process.stderr
6530
+ });
6531
+ rl.question(question, (answer) => {
6532
+ rl.close();
6533
+ resolve2(answer);
6534
+ });
6535
+ });
6536
+ }
6537
+
6467
6538
  // src/index.ts
6468
6539
  init_bundle();
6469
6540
  init_auth();
6470
6541
  init_api_client();
6542
+ init_config_file();
6471
6543
  init_sse();
6472
6544
  init_utils();
6473
6545
  export {
@@ -6494,6 +6566,8 @@ export {
6494
6566
  deployCommand,
6495
6567
  duplicateFlow,
6496
6568
  duplicateFlowCommand,
6569
+ feedback,
6570
+ feedbackCommand,
6497
6571
  findExample,
6498
6572
  getAuthHeaders,
6499
6573
  getDeployment,
@@ -6517,6 +6591,7 @@ export {
6517
6591
  parseSSEEvents,
6518
6592
  push,
6519
6593
  pushCommand,
6594
+ readConfig,
6520
6595
  requireProjectId,
6521
6596
  resolveBaseUrl,
6522
6597
  run,
@@ -6530,6 +6605,7 @@ export {
6530
6605
  validate,
6531
6606
  validateCommand,
6532
6607
  whoami,
6533
- whoamiCommand
6608
+ whoamiCommand,
6609
+ writeConfig
6534
6610
  };
6535
6611
  //# sourceMappingURL=index.js.map