@datalyr/wizard 1.0.6 → 1.0.8

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
@@ -3116,8 +3116,12 @@ async function runAgentWizard(_config, options = {}) {
3116
3116
  enableServerSideConversions: false
3117
3117
  };
3118
3118
  if (!p.isCancel(runningAds) && runningAds) {
3119
+ p.note(
3120
+ `${import_chalk4.default.dim("Use")} ${import_chalk4.default.cyan("\u2191\u2193")} ${import_chalk4.default.dim("to navigate,")} ${import_chalk4.default.cyan("Space")} ${import_chalk4.default.dim("to select,")} ${import_chalk4.default.cyan("Enter")} ${import_chalk4.default.dim("to confirm")}`,
3121
+ "Controls"
3122
+ );
3119
3123
  const adPlatformChoices = await p.multiselect({
3120
- message: "Select your ad platforms:",
3124
+ message: "Select your ad platforms (Space to toggle, Enter to confirm):",
3121
3125
  options: AD_PLATFORMS.filter((p2) => p2.id !== "none").map((platform) => ({
3122
3126
  value: platform.id,
3123
3127
  label: platform.label,
@@ -3209,7 +3213,7 @@ ${import_chalk4.default.bold("High-value events")} are the key actions that matt
3209
3213
  "Suggested Events"
3210
3214
  );
3211
3215
  const selectedEventNames = await p.multiselect({
3212
- message: "Select events to track:",
3216
+ message: "Select events to track (Space to toggle, Enter to confirm):",
3213
3217
  options: eventOptions,
3214
3218
  initialValues: ["__all_recommended__"],
3215
3219
  required: false
@@ -3342,7 +3346,7 @@ async function executeAgent(params) {
3342
3346
  { role: "user", content: initialMessage }
3343
3347
  ];
3344
3348
  const filesModified = [];
3345
- const maxIterations = 20;
3349
+ const maxIterations = 30;
3346
3350
  let iterations = 0;
3347
3351
  while (iterations < maxIterations) {
3348
3352
  iterations++;
@@ -3514,6 +3518,73 @@ async function executeTool(toolUse, cwd, debug) {
3514
3518
  });
3515
3519
  return { content: files.slice(0, 100).join("\n") };
3516
3520
  }
3521
+ case "edit_file": {
3522
+ if (typeof input2.path !== "string" || !input2.path.trim()) {
3523
+ return { content: "Error: path must be a non-empty string", is_error: true };
3524
+ }
3525
+ if (typeof input2.old_string !== "string") {
3526
+ return { content: "Error: old_string must be a string", is_error: true };
3527
+ }
3528
+ if (typeof input2.new_string !== "string") {
3529
+ return { content: "Error: new_string must be a string", is_error: true };
3530
+ }
3531
+ const path6 = input2.path.trim();
3532
+ const oldString = input2.old_string;
3533
+ const newString = input2.new_string;
3534
+ if (!isPathSafe(cwd, path6)) {
3535
+ return { content: "Error: path traversal detected - access denied", is_error: true };
3536
+ }
3537
+ const fullPath = (0, import_path5.join)(cwd, path6);
3538
+ const content = await (0, import_promises.readFile)(fullPath, "utf-8");
3539
+ const occurrences = content.split(oldString).length - 1;
3540
+ if (occurrences === 0) {
3541
+ return { content: `Error: old_string not found in ${path6}`, is_error: true };
3542
+ }
3543
+ if (occurrences > 1) {
3544
+ return { content: `Error: old_string found ${occurrences} times in ${path6} - must be unique`, is_error: true };
3545
+ }
3546
+ const newContent = content.replace(oldString, newString);
3547
+ await (0, import_promises.writeFile)(fullPath, newContent, "utf-8");
3548
+ return { content: `Successfully edited ${path6}` };
3549
+ }
3550
+ case "search_files": {
3551
+ if (typeof input2.pattern !== "string" || !input2.pattern.trim()) {
3552
+ return { content: "Error: pattern must be a non-empty string", is_error: true };
3553
+ }
3554
+ const searchPattern = input2.pattern.trim();
3555
+ const searchPath = typeof input2.path === "string" ? input2.path.trim() : ".";
3556
+ const filePattern = typeof input2.file_pattern === "string" ? input2.file_pattern : "**/*.{ts,tsx,js,jsx,json,md}";
3557
+ if (!isPathSafe(cwd, searchPath)) {
3558
+ return { content: "Error: path traversal detected - access denied", is_error: true };
3559
+ }
3560
+ const fullPath = (0, import_path5.join)(cwd, searchPath);
3561
+ const files = await (0, import_glob2.glob)(filePattern, {
3562
+ cwd: fullPath,
3563
+ nodir: true,
3564
+ maxDepth: 5
3565
+ });
3566
+ const results = [];
3567
+ const regex = new RegExp(searchPattern, "gi");
3568
+ for (const file of files.slice(0, 50)) {
3569
+ try {
3570
+ const filePath = (0, import_path5.join)(fullPath, file);
3571
+ const content = await (0, import_promises.readFile)(filePath, "utf-8");
3572
+ const lines = content.split("\n");
3573
+ lines.forEach((line, index) => {
3574
+ if (regex.test(line)) {
3575
+ results.push(`${file}:${index + 1}: ${line.trim().slice(0, 100)}`);
3576
+ }
3577
+ regex.lastIndex = 0;
3578
+ });
3579
+ } catch {
3580
+ }
3581
+ if (results.length >= 50) break;
3582
+ }
3583
+ if (results.length === 0) {
3584
+ return { content: `No matches found for "${searchPattern}"` };
3585
+ }
3586
+ return { content: results.join("\n") };
3587
+ }
3517
3588
  default:
3518
3589
  return { content: `Unknown tool: ${name}`, is_error: true };
3519
3590
  }