opencode-hashline 1.0.3 → 1.0.4

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.
@@ -111,13 +111,14 @@ function stripHashes(content, prefix) {
111
111
  const escapedPrefix = effectivePrefix.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
112
112
  let hashLinePattern = stripRegexCache.get(escapedPrefix);
113
113
  if (!hashLinePattern) {
114
- hashLinePattern = new RegExp(`^${escapedPrefix}\\d+:[0-9a-f]{2,8}\\|`);
114
+ hashLinePattern = new RegExp(`^([+ \\-])?${escapedPrefix}\\d+:[0-9a-f]{2,8}\\|`);
115
115
  stripRegexCache.set(escapedPrefix, hashLinePattern);
116
116
  }
117
117
  return content.split("\n").map((line) => {
118
118
  const match = line.match(hashLinePattern);
119
119
  if (match) {
120
- return line.slice(match[0].length);
120
+ const patchMarker = match[1] || "";
121
+ return patchMarker + line.slice(match[0].length);
121
122
  }
122
123
  return line;
123
124
  }).join("\n");
@@ -4,7 +4,7 @@ import {
4
4
  resolveConfig,
5
5
  shouldExclude,
6
6
  stripHashes
7
- } from "./chunk-IVZSANZ4.js";
7
+ } from "./chunk-3AJXTHJ3.js";
8
8
 
9
9
  // src/hooks.ts
10
10
  import { appendFileSync } from "fs";
@@ -19,7 +19,7 @@ import {
19
19
  shouldExclude,
20
20
  stripHashes,
21
21
  verifyHash
22
- } from "./chunk-IVZSANZ4.js";
22
+ } from "./chunk-3AJXTHJ3.js";
23
23
  export {
24
24
  DEFAULT_CONFIG,
25
25
  DEFAULT_EXCLUDE_PATTERNS,
package/dist/index.cjs CHANGED
@@ -123,13 +123,14 @@ function stripHashes(content, prefix) {
123
123
  const escapedPrefix = effectivePrefix.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
124
124
  let hashLinePattern = stripRegexCache.get(escapedPrefix);
125
125
  if (!hashLinePattern) {
126
- hashLinePattern = new RegExp(`^${escapedPrefix}\\d+:[0-9a-f]{2,8}\\|`);
126
+ hashLinePattern = new RegExp(`^([+ \\-])?${escapedPrefix}\\d+:[0-9a-f]{2,8}\\|`);
127
127
  stripRegexCache.set(escapedPrefix, hashLinePattern);
128
128
  }
129
129
  return content.split("\n").map((line) => {
130
130
  const match = line.match(hashLinePattern);
131
131
  if (match) {
132
- return line.slice(match[0].length);
132
+ const patchMarker = match[1] || "";
133
+ return patchMarker + line.slice(match[0].length);
133
134
  }
134
135
  return line;
135
136
  }).join("\n");
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  createFileEditBeforeHook,
3
3
  createFileReadAfterHook,
4
4
  createSystemPromptHook
5
- } from "./chunk-OJ2CHKQK.js";
5
+ } from "./chunk-DUTTCCXT.js";
6
6
  import {
7
7
  HashlineCache,
8
8
  applyHashEdit,
9
9
  resolveConfig
10
- } from "./chunk-IVZSANZ4.js";
10
+ } from "./chunk-3AJXTHJ3.js";
11
11
 
12
12
  // src/index.ts
13
13
  import { readFileSync as readFileSync2, realpathSync as realpathSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
@@ -163,7 +163,7 @@ function createHashlinePlugin(userConfig) {
163
163
  const out = output;
164
164
  const hashLen = config.hashLength || 0;
165
165
  const prefix = config.prefix;
166
- const { formatFileWithHashes, shouldExclude, getByteLength } = await import("./hashline-W2FT5QN4.js");
166
+ const { formatFileWithHashes, shouldExclude, getByteLength } = await import("./hashline-V3FR43UZ.js");
167
167
  for (const p of out.parts ?? []) {
168
168
  if (p.type !== "file") continue;
169
169
  if (!p.url || !p.mime?.startsWith("text/")) continue;
package/dist/utils.cjs CHANGED
@@ -170,13 +170,14 @@ function stripHashes(content, prefix) {
170
170
  const escapedPrefix = effectivePrefix.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
171
171
  let hashLinePattern = stripRegexCache.get(escapedPrefix);
172
172
  if (!hashLinePattern) {
173
- hashLinePattern = new RegExp(`^${escapedPrefix}\\d+:[0-9a-f]{2,8}\\|`);
173
+ hashLinePattern = new RegExp(`^([+ \\-])?${escapedPrefix}\\d+:[0-9a-f]{2,8}\\|`);
174
174
  stripRegexCache.set(escapedPrefix, hashLinePattern);
175
175
  }
176
176
  return content.split("\n").map((line) => {
177
177
  const match = line.match(hashLinePattern);
178
178
  if (match) {
179
- return line.slice(match[0].length);
179
+ const patchMarker = match[1] || "";
180
+ return patchMarker + line.slice(match[0].length);
180
181
  }
181
182
  return line;
182
183
  }).join("\n");
package/dist/utils.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createFileReadAfterHook,
4
4
  createSystemPromptHook,
5
5
  isFileReadTool
6
- } from "./chunk-OJ2CHKQK.js";
6
+ } from "./chunk-DUTTCCXT.js";
7
7
  import {
8
8
  DEFAULT_CONFIG,
9
9
  DEFAULT_EXCLUDE_PATTERNS,
@@ -25,7 +25,7 @@ import {
25
25
  shouldExclude,
26
26
  stripHashes,
27
27
  verifyHash
28
- } from "./chunk-IVZSANZ4.js";
28
+ } from "./chunk-3AJXTHJ3.js";
29
29
  export {
30
30
  DEFAULT_CONFIG,
31
31
  DEFAULT_EXCLUDE_PATTERNS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-hashline",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Hashline plugin for OpenCode — content-addressable line hashing for precise AI code editing",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",