replicas-cli 0.2.770 → 0.2.771

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 (2) hide show
  1. package/dist/index.cjs +19 -10
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -23592,6 +23592,15 @@ function insertDisplayMessageByTimestamp(messages, message) {
23592
23592
  }
23593
23593
 
23594
23594
  // ../shared/src/display-message/format.ts
23595
+ function fileContentDiff(path7, content, action) {
23596
+ const lines = content.replace(/\n$/, "").split("\n");
23597
+ return [
23598
+ `--- ${action === "add" ? "/dev/null" : `a/${path7}`}`,
23599
+ `+++ ${action === "add" ? `b/${path7}` : "/dev/null"}`,
23600
+ action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
23601
+ ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
23602
+ ].join("\n");
23603
+ }
23595
23604
  var SCRIPT_ROOT = "/";
23596
23605
  var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
23597
23606
  var fileWrites = ({ writes }) => writes.filter(({ path: path7 }) => path7 !== "/dev/null");
@@ -27049,21 +27058,21 @@ function fileOrCommandMessage(toolName, toolUseId, input, timestamp) {
27049
27058
  if (toolName === "Edit" && typeof input.old_string === "string" && typeof input.new_string === "string") {
27050
27059
  const oldLines = input.old_string.replace(/\n$/, "").split("\n");
27051
27060
  const newLines = input.new_string.replace(/\n$/, "").split("\n");
27061
+ let head = 0;
27062
+ while (head < oldLines.length && head < newLines.length && oldLines[head] === newLines[head]) head++;
27063
+ let tail = 0;
27064
+ while (tail < oldLines.length - head && tail < newLines.length - head && oldLines[oldLines.length - 1 - tail] === newLines[newLines.length - 1 - tail]) tail++;
27052
27065
  diff = [
27053
27066
  `--- a/${filePath}`,
27054
27067
  `+++ b/${filePath}`,
27055
27068
  `@@ -1,${oldLines.length} +1,${newLines.length} @@`,
27056
- ...oldLines.map((l) => `-${l}`),
27057
- ...newLines.map((l) => `+${l}`)
27069
+ ...oldLines.slice(0, head).map((l) => ` ${l}`),
27070
+ ...oldLines.slice(head, oldLines.length - tail).map((l) => `-${l}`),
27071
+ ...newLines.slice(head, newLines.length - tail).map((l) => `+${l}`),
27072
+ ...oldLines.slice(oldLines.length - tail).map((l) => ` ${l}`)
27058
27073
  ].join("\n");
27059
27074
  } else if (toolName === "Write" && typeof input.content === "string") {
27060
- const newLines = input.content.replace(/\n$/, "").split("\n");
27061
- diff = [
27062
- `--- /dev/null`,
27063
- `+++ b/${filePath}`,
27064
- `@@ -0,0 +1,${newLines.length} @@`,
27065
- ...newLines.map((l) => `+${l}`)
27066
- ].join("\n");
27075
+ diff = fileContentDiff(filePath, input.content, "add");
27067
27076
  }
27068
27077
  return {
27069
27078
  id: `patch-${toolUseId}`,
@@ -27954,7 +27963,7 @@ var headlessAgentRequestSchema = external_exports.object({
27954
27963
  });
27955
27964
 
27956
27965
  // ../shared/src/cli-version.ts
27957
- var CLI_VERSION = "0.2.770";
27966
+ var CLI_VERSION = "0.2.771";
27958
27967
 
27959
27968
  // ../shared/src/version.ts
27960
27969
  function compareVersions(v1, v2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.770",
3
+ "version": "0.2.771",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {