@wrongstack/sdd 1.0.27 → 1.0.29

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.
@@ -7,10 +7,15 @@ interface ConflictFileIO {
7
7
  /**
8
8
  * Resolve every standard git conflict hunk in `text` by keeping `side`. Handles
9
9
  * both 2-way (`<<<<<<< / ======= / >>>>>>>`) and diff3 (`||||||| base`) markers.
10
- * Returns the rewritten text (markers removed).
10
+ * Returns the rewritten text (markers removed). A hunk that never closes is not
11
+ * guessed at: the input comes back unchanged, so the marker check refuses it.
11
12
  */
12
13
  export declare function resolveConflictText(text: string, side: ConflictSide): string;
13
- /** True when `text` still contains a git conflict marker line. */
14
+ /**
15
+ * True when `text` still contains a git conflict marker line. A bare `=======`
16
+ * is not counted: without a `<<<<<<<` it cannot be told apart from a setext
17
+ * heading underline (core's WorktreeManager check draws the same line).
18
+ */
14
19
  export declare function hasConflictMarkers(text: string): boolean;
15
20
  /**
16
21
  * Build a `conflictResolver` that keeps `side` of every hunk in each conflicted
package/dist/index.js CHANGED
@@ -5905,42 +5905,40 @@ var defaultFileIO = {
5905
5905
  await writeFile(path7, content, "utf8");
5906
5906
  }
5907
5907
  };
5908
- var START = "<<<<<<<";
5909
- var BASE = "|||||||";
5910
- var SEP = "=======";
5911
- var END = ">>>>>>>";
5908
+ var START_LINE = /^(<{7,})(?: |\r?$)/;
5909
+ var LABELLED_MARKER_LINE = /^(?:<{7,}|\|{7,}|>{7,})(?: |\r?$)/;
5910
+ var ANY_MARKER_LINE = /^(?:<{7,}|\|{7,}|>{7,})(?: |\r?$)|^={7,}\r?$/;
5911
+ function isMarker(line, char, size) {
5912
+ for (let i = 0; i < size; i++) if (line[i] !== char) return false;
5913
+ const rest = line.slice(size).replace(/\r$/, "");
5914
+ return char === "=" ? rest === "" : rest === "" || rest.startsWith(" ");
5915
+ }
5912
5916
  function resolveConflictText(text, side) {
5913
5917
  const out = [];
5914
5918
  let state = "normal";
5919
+ let size = 0;
5915
5920
  for (const line of text.split("\n")) {
5916
- const marker = line.slice(0, 7);
5917
- if (state === "normal" && marker === START) {
5918
- state = "ours";
5919
- continue;
5920
- }
5921
- if (state !== "normal" && marker === BASE) {
5922
- state = "base";
5923
- continue;
5924
- }
5925
- if (state !== "normal" && marker === SEP) {
5926
- state = "theirs";
5927
- continue;
5928
- }
5929
- if (state !== "normal" && marker === END) {
5930
- state = "normal";
5921
+ if (state === "normal") {
5922
+ const start = START_LINE.exec(line);
5923
+ if (start) {
5924
+ size = start[1].length;
5925
+ state = "ours";
5926
+ } else {
5927
+ out.push(line);
5928
+ }
5931
5929
  continue;
5932
5930
  }
5933
- if (state === "normal") out.push(line);
5931
+ if (isMarker(line, "|", size)) state = "base";
5932
+ else if (isMarker(line, "=", size)) state = "theirs";
5933
+ else if (isMarker(line, ">", size)) state = "normal";
5934
5934
  else if (state === "ours" && side === "base") out.push(line);
5935
5935
  else if (state === "theirs" && side === "incoming") out.push(line);
5936
5936
  }
5937
+ if (state !== "normal") return text;
5937
5938
  return out.join("\n");
5938
5939
  }
5939
5940
  function hasConflictMarkers(text) {
5940
- return text.split("\n").some((l) => {
5941
- const m = l.slice(0, 7);
5942
- return m === START || m === SEP || m === END || m === BASE;
5943
- });
5941
+ return text.split("\n").some((l) => LABELLED_MARKER_LINE.test(l));
5944
5942
  }
5945
5943
  function makePreferSideConflictResolver(side, io = defaultFileIO) {
5946
5944
  return async function conflictResolver(info) {
@@ -5969,10 +5967,7 @@ function unfence(text) {
5969
5967
  return m?.[1] !== void 0 ? m[1] : text.trim();
5970
5968
  }
5971
5969
  function nonMarkerLineCount(text) {
5972
- return text.split("\n").filter((l) => {
5973
- const m = l.slice(0, 7);
5974
- return m !== START && m !== SEP && m !== END && m !== BASE;
5975
- }).length;
5970
+ return text.split("\n").filter((l) => !ANY_MARKER_LINE.test(l)).length;
5976
5971
  }
5977
5972
  function makeLlmConflictResolver(opts) {
5978
5973
  const minFraction = opts.minRetainedFraction ?? 0.5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/sdd",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack Spec-Driven Development engine — standalone package extracted from @wrongstack/core. Task graph generation, tracking, execution, lifecycle management, and AI-driven spec building for SDD workflows.",
6
6
  "repository": {
@@ -27,10 +27,10 @@
27
27
  "!dist/**/*.map"
28
28
  ],
29
29
  "dependencies": {
30
- "@wrongstack/core": "1.0.27",
31
- "@wrongstack/kanban": "1.0.27",
32
- "@wrongstack/primitives": "1.0.27",
33
- "@wrongstack/requirement-intake": "1.0.27"
30
+ "@wrongstack/core": "1.0.29",
31
+ "@wrongstack/kanban": "1.0.29",
32
+ "@wrongstack/primitives": "1.0.29",
33
+ "@wrongstack/requirement-intake": "1.0.29"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^26.5.1",