codexslimedit 0.1.0 → 0.7.4-dev.29698722339.1

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/mcp.js +11 -5
  2. package/package.json +1 -1
package/dist/mcp.js CHANGED
@@ -4510,7 +4510,7 @@ function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
4510
4510
  //#endregion
4511
4511
  //#region src/version.ts
4512
4512
  /** Current independent codexslimedit package version. */
4513
- var CODEX_SLIM_EDIT_VERSION = "0.1.0";
4513
+ var CODEX_SLIM_EDIT_VERSION = "0.7.4-dev.29698722339.1";
4514
4514
  /** Returns whether command-line arguments request the package version. */
4515
4515
  function isVersionRequest(args) {
4516
4516
  return args.includes("--version");
@@ -4591,15 +4591,15 @@ async function readUtf8Text(path) {
4591
4591
  }
4592
4592
  }
4593
4593
  function replaceContent(content, oldString, newString) {
4594
+ const range = parseRange(oldString, lineCount(content));
4595
+ if (range !== null) return replaceLineRange(content, range.start, range.end, newString);
4594
4596
  const matches = exactMatchOffsets(content, oldString);
4595
4597
  if (matches.length === 1) {
4596
4598
  const [start] = matches;
4597
4599
  return `${content.slice(0, start)}${newString}${content.slice(start + oldString.length)}`;
4598
4600
  }
4599
4601
  if (matches.length > 1) throw new WorkspaceFileError("DUPLICATE_MATCH", "oldString matches more than once; provide unique exact content or a line range.");
4600
- const range = parseRange(oldString, lineCount(content));
4601
- if (range === null) throw new WorkspaceFileError("EXACT_MATCH_NOT_FOUND", "oldString was not found exactly and is not a valid line range.");
4602
- return replaceLineRange(content, range.start, range.end, newString);
4602
+ throw new WorkspaceFileError("EXACT_MATCH_NOT_FOUND", "oldString was not found exactly and is not a valid line range.");
4603
4603
  }
4604
4604
  function exactMatchOffsets(content, needle) {
4605
4605
  if (needle.length === 0) return [];
@@ -4633,7 +4633,7 @@ function replaceLineRange(content, start, end, newString) {
4633
4633
  const lines = content.split(/\r\n|\n|\r/);
4634
4634
  const hasFinalNewline = endsWithLineBreak(content);
4635
4635
  const editableLines = hasFinalNewline ? lines.slice(0, -1) : lines;
4636
- const replacement = newString === "" ? [] : normalizeLineEndings(newString, lineEnding).split(/\r\n|\n|\r/);
4636
+ const replacement = replacementLines(newString, lineEnding);
4637
4637
  const nextLines = [
4638
4638
  ...editableLines.slice(0, start - 1),
4639
4639
  ...replacement,
@@ -4642,6 +4642,12 @@ function replaceLineRange(content, start, end, newString) {
4642
4642
  if (nextLines.length === 0) return "";
4643
4643
  return `${nextLines.join(lineEnding)}${hasFinalNewline ? lineEnding : ""}`;
4644
4644
  }
4645
+ function replacementLines(newString, lineEnding) {
4646
+ if (newString === "") return [];
4647
+ const normalized = normalizeLineEndings(newString, lineEnding);
4648
+ const lines = normalized.split(lineEnding);
4649
+ return endsWithLineBreak(normalized) ? lines.slice(0, -1) : lines;
4650
+ }
4645
4651
  function endsWithLineBreak(content) {
4646
4652
  return /(?:\r\n|\n|\r)$/.test(content);
4647
4653
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexslimedit",
3
- "version": "0.1.0",
3
+ "version": "0.7.4-dev.29698722339.1",
4
4
  "description": "Concise, workspace-safe MCP file reading and editing.",
5
5
  "license": "SUL-1.0",
6
6
  "repository": {