specdx 0.4.0-alpha.9 → 0.4.0
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/.claude-plugin/plugin.json +7 -2
- package/README.md +259 -0
- package/dist/{check-4FSSC6HN.js → check-PHXXA7VY.js} +68 -30
- package/dist/check-PHXXA7VY.js.map +1 -0
- package/dist/chunk-2BZIG7OE.js +185 -0
- package/dist/chunk-2BZIG7OE.js.map +1 -0
- package/dist/{chunk-N77RNV7J.js → chunk-3YXRWQGX.js} +217 -42
- package/dist/chunk-3YXRWQGX.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-DMGABJ6T.js +41 -0
- package/dist/chunk-DMGABJ6T.js.map +1 -0
- package/dist/{chunk-7JXW2GTJ.js → chunk-HCJDCS26.js} +9 -2
- package/dist/chunk-HCJDCS26.js.map +1 -0
- package/dist/chunk-LJTLNXGV.js +835 -0
- package/dist/chunk-LJTLNXGV.js.map +1 -0
- package/dist/chunk-NAWYG4VV.js +2846 -0
- package/dist/chunk-NAWYG4VV.js.map +1 -0
- package/dist/chunk-NHD44ZYN.js +20 -0
- package/dist/chunk-NHD44ZYN.js.map +1 -0
- package/dist/chunk-OVIKIIR4.js +103 -0
- package/dist/chunk-OVIKIIR4.js.map +1 -0
- package/dist/{chunk-IHTYAW7C.js → chunk-SNQNQ2MP.js} +111 -7
- package/dist/chunk-SNQNQ2MP.js.map +1 -0
- package/dist/{chunk-AKNPCB37.js → chunk-YRQPY5NF.js} +32 -12
- package/dist/chunk-YRQPY5NF.js.map +1 -0
- package/dist/diff-6C5LJ7SH.js +200 -0
- package/dist/diff-6C5LJ7SH.js.map +1 -0
- package/dist/{dist-4DIRTBJH.js → dist-PK52GA7M.js} +43 -20
- package/dist/dist-PK52GA7M.js.map +1 -0
- package/dist/{dist-RL2DT3ZE.js → dist-ROHCFKYT.js} +3 -2
- package/dist/dist-ROHCFKYT.js.map +1 -0
- package/dist/generate-K72WD455.js +21 -0
- package/dist/generate-K72WD455.js.map +1 -0
- package/dist/{generate-story-EFHGINHA.js → generate-story-NUCNYL3I.js} +43 -19
- package/dist/generate-story-NUCNYL3I.js.map +1 -0
- package/dist/{generate-test-plan-BO7444RG.js → generate-test-plan-Z46W3N3B.js} +61 -11
- package/dist/generate-test-plan-Z46W3N3B.js.map +1 -0
- package/dist/{graph-5XINV7PT.js → graph-4RNURBNP.js} +49 -11
- package/dist/graph-4RNURBNP.js.map +1 -0
- package/dist/index.d.ts +275 -0
- package/dist/index.js +2660 -371
- package/dist/index.js.map +1 -1
- package/dist/{lint-PTMWMLDQ.js → lint-2VZPNLE3.js} +46 -18
- package/dist/lint-2VZPNLE3.js.map +1 -0
- package/dist/main.js +10 -229
- package/dist/main.js.map +1 -1
- package/dist/mcp-E6PJWBDQ.js +35 -0
- package/dist/mcp-E6PJWBDQ.js.map +1 -0
- package/dist/{migrate-4KF6GHLO.js → migrate-FKFC7UAO.js} +21 -9
- package/dist/migrate-FKFC7UAO.js.map +1 -0
- package/dist/{pack-DSOODXAN.js → pack-DE4UBTCC.js} +41 -13
- package/dist/pack-DE4UBTCC.js.map +1 -0
- package/dist/{ready-6DNKIHP6.js → ready-K74SLQ24.js} +55 -14
- package/dist/ready-K74SLQ24.js.map +1 -0
- package/dist/skills/{specdx-author-spec.md → core/specdx-author-spec/SKILL.md} +10 -6
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-01-frontmatter.md +1 -1
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-02-sections.md +41 -0
- package/dist/skills/{specdx-onboard.md → core/specdx-onboard/SKILL.md} +8 -3
- package/dist/skills/{specdx-plan-from-spec.md → core/specdx-plan-from-spec/SKILL.md} +5 -1
- package/dist/skills/{specdx-pre-commit.md → core/specdx-pre-commit/SKILL.md} +16 -2
- package/dist/skills/{specdx-review-spec.md → core/specdx-review-spec/SKILL.md} +5 -1
- package/dist/skills/core/specdx-router/SKILL.md +67 -0
- package/dist/skills/{specdx-sprint-review.md → core/specdx-sprint-review/SKILL.md} +6 -2
- package/dist/skills/{specdx-start-task.md → core/specdx-start-task/SKILL.md} +5 -1
- package/dist/skills/{specdx-check-drift.md → experimental/specdx-check-drift/SKILL.md} +10 -4
- package/dist/skills/{specdx-verify.md → experimental/specdx-verify/SKILL.md} +6 -2
- package/dist/skills-36SRUEMR.js +121 -0
- package/dist/skills-36SRUEMR.js.map +1 -0
- package/dist/{status-WZK247CI.js → status-IAE3BB77.js} +63 -32
- package/dist/status-IAE3BB77.js.map +1 -0
- package/dist/{update-JTNSYX3B.js → update-UFOHZEAK.js} +22 -12
- package/dist/update-UFOHZEAK.js.map +1 -0
- package/dist/{validate-LBDYWUDX.js → validate-EZHUB5TW.js} +36 -17
- package/dist/validate-EZHUB5TW.js.map +1 -0
- package/hooks/hooks.json +12 -6
- package/hooks/session-start +35 -3
- package/package.json +28 -13
- package/dist/changelog-XUVHY3QK.js +0 -93
- package/dist/changelog-XUVHY3QK.js.map +0 -1
- package/dist/check-4FSSC6HN.js.map +0 -1
- package/dist/chunk-7JXW2GTJ.js.map +0 -1
- package/dist/chunk-AKNPCB37.js.map +0 -1
- package/dist/chunk-DAZCOUVK.js +0 -496
- package/dist/chunk-DAZCOUVK.js.map +0 -1
- package/dist/chunk-GAM4MXPC.js +0 -15
- package/dist/chunk-GAM4MXPC.js.map +0 -1
- package/dist/chunk-IHTYAW7C.js.map +0 -1
- package/dist/chunk-N77RNV7J.js.map +0 -1
- package/dist/chunk-SRZ33RJP.js +0 -1147
- package/dist/chunk-SRZ33RJP.js.map +0 -1
- package/dist/diff-OXZ34NU4.js +0 -107
- package/dist/diff-OXZ34NU4.js.map +0 -1
- package/dist/dist-4DIRTBJH.js.map +0 -1
- package/dist/explain-QBV3AESQ.js +0 -109
- package/dist/explain-QBV3AESQ.js.map +0 -1
- package/dist/generate-7GNPT2WJ.js +0 -13
- package/dist/generate-7GNPT2WJ.js.map +0 -1
- package/dist/generate-story-EFHGINHA.js.map +0 -1
- package/dist/generate-test-plan-BO7444RG.js.map +0 -1
- package/dist/graph-5XINV7PT.js.map +0 -1
- package/dist/lint-PTMWMLDQ.js.map +0 -1
- package/dist/mcp-BGFAPM6G.js +0 -17
- package/dist/mcp-BGFAPM6G.js.map +0 -1
- package/dist/migrate-4KF6GHLO.js.map +0 -1
- package/dist/pack-DSOODXAN.js.map +0 -1
- package/dist/ready-6DNKIHP6.js.map +0 -1
- package/dist/skills-3GBBWZW2.js +0 -93
- package/dist/skills-3GBBWZW2.js.map +0 -1
- package/dist/status-WZK247CI.js.map +0 -1
- package/dist/update-JTNSYX3B.js.map +0 -1
- package/dist/validate-LBDYWUDX.js.map +0 -1
- /package/dist/{dist-RL2DT3ZE.js.map → chunk-5WRI5ZAA.js.map} +0 -0
- /package/dist/skills/{spec-type-reference.md → core/specdx-author-spec/references/spec-type-reference.md} +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-03-finalize.md +0 -0
package/dist/chunk-SRZ33RJP.js
DELETED
|
@@ -1,1147 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildGraph,
|
|
3
|
-
loadConfig,
|
|
4
|
-
parseSpecFromString
|
|
5
|
-
} from "./chunk-IHTYAW7C.js";
|
|
6
|
-
|
|
7
|
-
// ../diff/dist/types.js
|
|
8
|
-
var DEFAULT_DIFF_CONFIG = {
|
|
9
|
-
baseline_ref: "main",
|
|
10
|
-
staleness_threshold_days: 14
|
|
11
|
-
};
|
|
12
|
-
var DiffError = class extends Error {
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "DiffError";
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// ../diff/dist/git.js
|
|
20
|
-
import { execSync } from "child_process";
|
|
21
|
-
import { realpathSync } from "fs";
|
|
22
|
-
import { dirname, relative, resolve } from "path";
|
|
23
|
-
|
|
24
|
-
// ../../node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.mjs
|
|
25
|
-
function Diff() {
|
|
26
|
-
}
|
|
27
|
-
Diff.prototype = {
|
|
28
|
-
diff: function diff(oldString, newString) {
|
|
29
|
-
var _options$timeout;
|
|
30
|
-
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
31
|
-
var callback = options.callback;
|
|
32
|
-
if (typeof options === "function") {
|
|
33
|
-
callback = options;
|
|
34
|
-
options = {};
|
|
35
|
-
}
|
|
36
|
-
var self = this;
|
|
37
|
-
function done(value) {
|
|
38
|
-
value = self.postProcess(value, options);
|
|
39
|
-
if (callback) {
|
|
40
|
-
setTimeout(function() {
|
|
41
|
-
callback(value);
|
|
42
|
-
}, 0);
|
|
43
|
-
return true;
|
|
44
|
-
} else {
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
oldString = this.castInput(oldString, options);
|
|
49
|
-
newString = this.castInput(newString, options);
|
|
50
|
-
oldString = this.removeEmpty(this.tokenize(oldString, options));
|
|
51
|
-
newString = this.removeEmpty(this.tokenize(newString, options));
|
|
52
|
-
var newLen = newString.length, oldLen = oldString.length;
|
|
53
|
-
var editLength = 1;
|
|
54
|
-
var maxEditLength = newLen + oldLen;
|
|
55
|
-
if (options.maxEditLength != null) {
|
|
56
|
-
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
57
|
-
}
|
|
58
|
-
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
|
|
59
|
-
var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
60
|
-
var bestPath = [{
|
|
61
|
-
oldPos: -1,
|
|
62
|
-
lastComponent: void 0
|
|
63
|
-
}];
|
|
64
|
-
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
|
|
65
|
-
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
66
|
-
return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));
|
|
67
|
-
}
|
|
68
|
-
var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
69
|
-
function execEditLength() {
|
|
70
|
-
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
71
|
-
var basePath = void 0;
|
|
72
|
-
var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
73
|
-
if (removePath) {
|
|
74
|
-
bestPath[diagonalPath - 1] = void 0;
|
|
75
|
-
}
|
|
76
|
-
var canAdd = false;
|
|
77
|
-
if (addPath) {
|
|
78
|
-
var addPathNewPos = addPath.oldPos - diagonalPath;
|
|
79
|
-
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
80
|
-
}
|
|
81
|
-
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
82
|
-
if (!canAdd && !canRemove) {
|
|
83
|
-
bestPath[diagonalPath] = void 0;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
87
|
-
basePath = self.addToPath(addPath, true, false, 0, options);
|
|
88
|
-
} else {
|
|
89
|
-
basePath = self.addToPath(removePath, false, true, 1, options);
|
|
90
|
-
}
|
|
91
|
-
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);
|
|
92
|
-
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
93
|
-
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
|
94
|
-
} else {
|
|
95
|
-
bestPath[diagonalPath] = basePath;
|
|
96
|
-
if (basePath.oldPos + 1 >= oldLen) {
|
|
97
|
-
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
98
|
-
}
|
|
99
|
-
if (newPos + 1 >= newLen) {
|
|
100
|
-
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
editLength++;
|
|
105
|
-
}
|
|
106
|
-
if (callback) {
|
|
107
|
-
(function exec() {
|
|
108
|
-
setTimeout(function() {
|
|
109
|
-
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
110
|
-
return callback();
|
|
111
|
-
}
|
|
112
|
-
if (!execEditLength()) {
|
|
113
|
-
exec();
|
|
114
|
-
}
|
|
115
|
-
}, 0);
|
|
116
|
-
})();
|
|
117
|
-
} else {
|
|
118
|
-
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
119
|
-
var ret = execEditLength();
|
|
120
|
-
if (ret) {
|
|
121
|
-
return ret;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
addToPath: function addToPath(path, added, removed, oldPosInc, options) {
|
|
127
|
-
var last = path.lastComponent;
|
|
128
|
-
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
129
|
-
return {
|
|
130
|
-
oldPos: path.oldPos + oldPosInc,
|
|
131
|
-
lastComponent: {
|
|
132
|
-
count: last.count + 1,
|
|
133
|
-
added,
|
|
134
|
-
removed,
|
|
135
|
-
previousComponent: last.previousComponent
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
} else {
|
|
139
|
-
return {
|
|
140
|
-
oldPos: path.oldPos + oldPosInc,
|
|
141
|
-
lastComponent: {
|
|
142
|
-
count: 1,
|
|
143
|
-
added,
|
|
144
|
-
removed,
|
|
145
|
-
previousComponent: last
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
|
|
151
|
-
var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
152
|
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
|
|
153
|
-
newPos++;
|
|
154
|
-
oldPos++;
|
|
155
|
-
commonCount++;
|
|
156
|
-
if (options.oneChangePerToken) {
|
|
157
|
-
basePath.lastComponent = {
|
|
158
|
-
count: 1,
|
|
159
|
-
previousComponent: basePath.lastComponent,
|
|
160
|
-
added: false,
|
|
161
|
-
removed: false
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (commonCount && !options.oneChangePerToken) {
|
|
166
|
-
basePath.lastComponent = {
|
|
167
|
-
count: commonCount,
|
|
168
|
-
previousComponent: basePath.lastComponent,
|
|
169
|
-
added: false,
|
|
170
|
-
removed: false
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
basePath.oldPos = oldPos;
|
|
174
|
-
return newPos;
|
|
175
|
-
},
|
|
176
|
-
equals: function equals(left, right, options) {
|
|
177
|
-
if (options.comparator) {
|
|
178
|
-
return options.comparator(left, right);
|
|
179
|
-
} else {
|
|
180
|
-
return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
removeEmpty: function removeEmpty(array) {
|
|
184
|
-
var ret = [];
|
|
185
|
-
for (var i = 0; i < array.length; i++) {
|
|
186
|
-
if (array[i]) {
|
|
187
|
-
ret.push(array[i]);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return ret;
|
|
191
|
-
},
|
|
192
|
-
castInput: function castInput(value) {
|
|
193
|
-
return value;
|
|
194
|
-
},
|
|
195
|
-
tokenize: function tokenize(value) {
|
|
196
|
-
return Array.from(value);
|
|
197
|
-
},
|
|
198
|
-
join: function join(chars) {
|
|
199
|
-
return chars.join("");
|
|
200
|
-
},
|
|
201
|
-
postProcess: function postProcess(changeObjects) {
|
|
202
|
-
return changeObjects;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
|
|
206
|
-
var components = [];
|
|
207
|
-
var nextComponent;
|
|
208
|
-
while (lastComponent) {
|
|
209
|
-
components.push(lastComponent);
|
|
210
|
-
nextComponent = lastComponent.previousComponent;
|
|
211
|
-
delete lastComponent.previousComponent;
|
|
212
|
-
lastComponent = nextComponent;
|
|
213
|
-
}
|
|
214
|
-
components.reverse();
|
|
215
|
-
var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
|
216
|
-
for (; componentPos < componentLen; componentPos++) {
|
|
217
|
-
var component = components[componentPos];
|
|
218
|
-
if (!component.removed) {
|
|
219
|
-
if (!component.added && useLongestToken) {
|
|
220
|
-
var value = newString.slice(newPos, newPos + component.count);
|
|
221
|
-
value = value.map(function(value2, i) {
|
|
222
|
-
var oldValue = oldString[oldPos + i];
|
|
223
|
-
return oldValue.length > value2.length ? oldValue : value2;
|
|
224
|
-
});
|
|
225
|
-
component.value = diff2.join(value);
|
|
226
|
-
} else {
|
|
227
|
-
component.value = diff2.join(newString.slice(newPos, newPos + component.count));
|
|
228
|
-
}
|
|
229
|
-
newPos += component.count;
|
|
230
|
-
if (!component.added) {
|
|
231
|
-
oldPos += component.count;
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
|
|
235
|
-
oldPos += component.count;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return components;
|
|
239
|
-
}
|
|
240
|
-
var characterDiff = new Diff();
|
|
241
|
-
function longestCommonPrefix(str1, str2) {
|
|
242
|
-
var i;
|
|
243
|
-
for (i = 0; i < str1.length && i < str2.length; i++) {
|
|
244
|
-
if (str1[i] != str2[i]) {
|
|
245
|
-
return str1.slice(0, i);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return str1.slice(0, i);
|
|
249
|
-
}
|
|
250
|
-
function longestCommonSuffix(str1, str2) {
|
|
251
|
-
var i;
|
|
252
|
-
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
253
|
-
return "";
|
|
254
|
-
}
|
|
255
|
-
for (i = 0; i < str1.length && i < str2.length; i++) {
|
|
256
|
-
if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
|
|
257
|
-
return str1.slice(-i);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return str1.slice(-i);
|
|
261
|
-
}
|
|
262
|
-
function replacePrefix(string, oldPrefix, newPrefix) {
|
|
263
|
-
if (string.slice(0, oldPrefix.length) != oldPrefix) {
|
|
264
|
-
throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
|
|
265
|
-
}
|
|
266
|
-
return newPrefix + string.slice(oldPrefix.length);
|
|
267
|
-
}
|
|
268
|
-
function replaceSuffix(string, oldSuffix, newSuffix) {
|
|
269
|
-
if (!oldSuffix) {
|
|
270
|
-
return string + newSuffix;
|
|
271
|
-
}
|
|
272
|
-
if (string.slice(-oldSuffix.length) != oldSuffix) {
|
|
273
|
-
throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
|
|
274
|
-
}
|
|
275
|
-
return string.slice(0, -oldSuffix.length) + newSuffix;
|
|
276
|
-
}
|
|
277
|
-
function removePrefix(string, oldPrefix) {
|
|
278
|
-
return replacePrefix(string, oldPrefix, "");
|
|
279
|
-
}
|
|
280
|
-
function removeSuffix(string, oldSuffix) {
|
|
281
|
-
return replaceSuffix(string, oldSuffix, "");
|
|
282
|
-
}
|
|
283
|
-
function maximumOverlap(string1, string2) {
|
|
284
|
-
return string2.slice(0, overlapCount(string1, string2));
|
|
285
|
-
}
|
|
286
|
-
function overlapCount(a, b) {
|
|
287
|
-
var startA = 0;
|
|
288
|
-
if (a.length > b.length) {
|
|
289
|
-
startA = a.length - b.length;
|
|
290
|
-
}
|
|
291
|
-
var endB = b.length;
|
|
292
|
-
if (a.length < b.length) {
|
|
293
|
-
endB = a.length;
|
|
294
|
-
}
|
|
295
|
-
var map = Array(endB);
|
|
296
|
-
var k = 0;
|
|
297
|
-
map[0] = 0;
|
|
298
|
-
for (var j = 1; j < endB; j++) {
|
|
299
|
-
if (b[j] == b[k]) {
|
|
300
|
-
map[j] = map[k];
|
|
301
|
-
} else {
|
|
302
|
-
map[j] = k;
|
|
303
|
-
}
|
|
304
|
-
while (k > 0 && b[j] != b[k]) {
|
|
305
|
-
k = map[k];
|
|
306
|
-
}
|
|
307
|
-
if (b[j] == b[k]) {
|
|
308
|
-
k++;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
k = 0;
|
|
312
|
-
for (var i = startA; i < a.length; i++) {
|
|
313
|
-
while (k > 0 && a[i] != b[k]) {
|
|
314
|
-
k = map[k];
|
|
315
|
-
}
|
|
316
|
-
if (a[i] == b[k]) {
|
|
317
|
-
k++;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
return k;
|
|
321
|
-
}
|
|
322
|
-
var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
|
|
323
|
-
var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
|
|
324
|
-
var wordDiff = new Diff();
|
|
325
|
-
wordDiff.equals = function(left, right, options) {
|
|
326
|
-
if (options.ignoreCase) {
|
|
327
|
-
left = left.toLowerCase();
|
|
328
|
-
right = right.toLowerCase();
|
|
329
|
-
}
|
|
330
|
-
return left.trim() === right.trim();
|
|
331
|
-
};
|
|
332
|
-
wordDiff.tokenize = function(value) {
|
|
333
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
334
|
-
var parts;
|
|
335
|
-
if (options.intlSegmenter) {
|
|
336
|
-
if (options.intlSegmenter.resolvedOptions().granularity != "word") {
|
|
337
|
-
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
338
|
-
}
|
|
339
|
-
parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
|
|
340
|
-
return segment.segment;
|
|
341
|
-
});
|
|
342
|
-
} else {
|
|
343
|
-
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
344
|
-
}
|
|
345
|
-
var tokens = [];
|
|
346
|
-
var prevPart = null;
|
|
347
|
-
parts.forEach(function(part) {
|
|
348
|
-
if (/\s/.test(part)) {
|
|
349
|
-
if (prevPart == null) {
|
|
350
|
-
tokens.push(part);
|
|
351
|
-
} else {
|
|
352
|
-
tokens.push(tokens.pop() + part);
|
|
353
|
-
}
|
|
354
|
-
} else if (/\s/.test(prevPart)) {
|
|
355
|
-
if (tokens[tokens.length - 1] == prevPart) {
|
|
356
|
-
tokens.push(tokens.pop() + part);
|
|
357
|
-
} else {
|
|
358
|
-
tokens.push(prevPart + part);
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
tokens.push(part);
|
|
362
|
-
}
|
|
363
|
-
prevPart = part;
|
|
364
|
-
});
|
|
365
|
-
return tokens;
|
|
366
|
-
};
|
|
367
|
-
wordDiff.join = function(tokens) {
|
|
368
|
-
return tokens.map(function(token, i) {
|
|
369
|
-
if (i == 0) {
|
|
370
|
-
return token;
|
|
371
|
-
} else {
|
|
372
|
-
return token.replace(/^\s+/, "");
|
|
373
|
-
}
|
|
374
|
-
}).join("");
|
|
375
|
-
};
|
|
376
|
-
wordDiff.postProcess = function(changes, options) {
|
|
377
|
-
if (!changes || options.oneChangePerToken) {
|
|
378
|
-
return changes;
|
|
379
|
-
}
|
|
380
|
-
var lastKeep = null;
|
|
381
|
-
var insertion = null;
|
|
382
|
-
var deletion = null;
|
|
383
|
-
changes.forEach(function(change) {
|
|
384
|
-
if (change.added) {
|
|
385
|
-
insertion = change;
|
|
386
|
-
} else if (change.removed) {
|
|
387
|
-
deletion = change;
|
|
388
|
-
} else {
|
|
389
|
-
if (insertion || deletion) {
|
|
390
|
-
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
|
|
391
|
-
}
|
|
392
|
-
lastKeep = change;
|
|
393
|
-
insertion = null;
|
|
394
|
-
deletion = null;
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
if (insertion || deletion) {
|
|
398
|
-
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
|
|
399
|
-
}
|
|
400
|
-
return changes;
|
|
401
|
-
};
|
|
402
|
-
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
|
|
403
|
-
if (deletion && insertion) {
|
|
404
|
-
var oldWsPrefix = deletion.value.match(/^\s*/)[0];
|
|
405
|
-
var oldWsSuffix = deletion.value.match(/\s*$/)[0];
|
|
406
|
-
var newWsPrefix = insertion.value.match(/^\s*/)[0];
|
|
407
|
-
var newWsSuffix = insertion.value.match(/\s*$/)[0];
|
|
408
|
-
if (startKeep) {
|
|
409
|
-
var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
410
|
-
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
411
|
-
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
412
|
-
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
413
|
-
}
|
|
414
|
-
if (endKeep) {
|
|
415
|
-
var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
416
|
-
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
417
|
-
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
418
|
-
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
419
|
-
}
|
|
420
|
-
} else if (insertion) {
|
|
421
|
-
if (startKeep) {
|
|
422
|
-
insertion.value = insertion.value.replace(/^\s*/, "");
|
|
423
|
-
}
|
|
424
|
-
if (endKeep) {
|
|
425
|
-
endKeep.value = endKeep.value.replace(/^\s*/, "");
|
|
426
|
-
}
|
|
427
|
-
} else if (startKeep && endKeep) {
|
|
428
|
-
var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
|
|
429
|
-
var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
430
|
-
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
431
|
-
var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
432
|
-
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
433
|
-
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
434
|
-
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
435
|
-
} else if (endKeep) {
|
|
436
|
-
var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
|
|
437
|
-
var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
|
|
438
|
-
var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
439
|
-
deletion.value = removeSuffix(deletion.value, overlap);
|
|
440
|
-
} else if (startKeep) {
|
|
441
|
-
var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
|
|
442
|
-
var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
|
|
443
|
-
var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
444
|
-
deletion.value = removePrefix(deletion.value, _overlap);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
var wordWithSpaceDiff = new Diff();
|
|
448
|
-
wordWithSpaceDiff.tokenize = function(value) {
|
|
449
|
-
var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
|
|
450
|
-
return value.match(regex) || [];
|
|
451
|
-
};
|
|
452
|
-
var lineDiff = new Diff();
|
|
453
|
-
lineDiff.tokenize = function(value, options) {
|
|
454
|
-
if (options.stripTrailingCr) {
|
|
455
|
-
value = value.replace(/\r\n/g, "\n");
|
|
456
|
-
}
|
|
457
|
-
var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
458
|
-
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
459
|
-
linesAndNewlines.pop();
|
|
460
|
-
}
|
|
461
|
-
for (var i = 0; i < linesAndNewlines.length; i++) {
|
|
462
|
-
var line = linesAndNewlines[i];
|
|
463
|
-
if (i % 2 && !options.newlineIsToken) {
|
|
464
|
-
retLines[retLines.length - 1] += line;
|
|
465
|
-
} else {
|
|
466
|
-
retLines.push(line);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
return retLines;
|
|
470
|
-
};
|
|
471
|
-
lineDiff.equals = function(left, right, options) {
|
|
472
|
-
if (options.ignoreWhitespace) {
|
|
473
|
-
if (!options.newlineIsToken || !left.includes("\n")) {
|
|
474
|
-
left = left.trim();
|
|
475
|
-
}
|
|
476
|
-
if (!options.newlineIsToken || !right.includes("\n")) {
|
|
477
|
-
right = right.trim();
|
|
478
|
-
}
|
|
479
|
-
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
480
|
-
if (left.endsWith("\n")) {
|
|
481
|
-
left = left.slice(0, -1);
|
|
482
|
-
}
|
|
483
|
-
if (right.endsWith("\n")) {
|
|
484
|
-
right = right.slice(0, -1);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return Diff.prototype.equals.call(this, left, right, options);
|
|
488
|
-
};
|
|
489
|
-
function diffLines(oldStr, newStr, callback) {
|
|
490
|
-
return lineDiff.diff(oldStr, newStr, callback);
|
|
491
|
-
}
|
|
492
|
-
var sentenceDiff = new Diff();
|
|
493
|
-
sentenceDiff.tokenize = function(value) {
|
|
494
|
-
return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
|
495
|
-
};
|
|
496
|
-
var cssDiff = new Diff();
|
|
497
|
-
cssDiff.tokenize = function(value) {
|
|
498
|
-
return value.split(/([{}:;,]|\s+)/);
|
|
499
|
-
};
|
|
500
|
-
function ownKeys(e, r) {
|
|
501
|
-
var t = Object.keys(e);
|
|
502
|
-
if (Object.getOwnPropertySymbols) {
|
|
503
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
504
|
-
r && (o = o.filter(function(r2) {
|
|
505
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
506
|
-
})), t.push.apply(t, o);
|
|
507
|
-
}
|
|
508
|
-
return t;
|
|
509
|
-
}
|
|
510
|
-
function _objectSpread2(e) {
|
|
511
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
512
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
513
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
514
|
-
_defineProperty(e, r2, t[r2]);
|
|
515
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
516
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
return e;
|
|
520
|
-
}
|
|
521
|
-
function _toPrimitive(t, r) {
|
|
522
|
-
if ("object" != typeof t || !t) return t;
|
|
523
|
-
var e = t[Symbol.toPrimitive];
|
|
524
|
-
if (void 0 !== e) {
|
|
525
|
-
var i = e.call(t, r || "default");
|
|
526
|
-
if ("object" != typeof i) return i;
|
|
527
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
528
|
-
}
|
|
529
|
-
return ("string" === r ? String : Number)(t);
|
|
530
|
-
}
|
|
531
|
-
function _toPropertyKey(t) {
|
|
532
|
-
var i = _toPrimitive(t, "string");
|
|
533
|
-
return "symbol" == typeof i ? i : i + "";
|
|
534
|
-
}
|
|
535
|
-
function _typeof(o) {
|
|
536
|
-
"@babel/helpers - typeof";
|
|
537
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
538
|
-
return typeof o2;
|
|
539
|
-
} : function(o2) {
|
|
540
|
-
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
541
|
-
}, _typeof(o);
|
|
542
|
-
}
|
|
543
|
-
function _defineProperty(obj, key, value) {
|
|
544
|
-
key = _toPropertyKey(key);
|
|
545
|
-
if (key in obj) {
|
|
546
|
-
Object.defineProperty(obj, key, {
|
|
547
|
-
value,
|
|
548
|
-
enumerable: true,
|
|
549
|
-
configurable: true,
|
|
550
|
-
writable: true
|
|
551
|
-
});
|
|
552
|
-
} else {
|
|
553
|
-
obj[key] = value;
|
|
554
|
-
}
|
|
555
|
-
return obj;
|
|
556
|
-
}
|
|
557
|
-
function _toConsumableArray(arr) {
|
|
558
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
559
|
-
}
|
|
560
|
-
function _arrayWithoutHoles(arr) {
|
|
561
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
562
|
-
}
|
|
563
|
-
function _iterableToArray(iter) {
|
|
564
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
565
|
-
}
|
|
566
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
567
|
-
if (!o) return;
|
|
568
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
569
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
570
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
571
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
572
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
573
|
-
}
|
|
574
|
-
function _arrayLikeToArray(arr, len) {
|
|
575
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
576
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
577
|
-
return arr2;
|
|
578
|
-
}
|
|
579
|
-
function _nonIterableSpread() {
|
|
580
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
581
|
-
}
|
|
582
|
-
var jsonDiff = new Diff();
|
|
583
|
-
jsonDiff.useLongestToken = true;
|
|
584
|
-
jsonDiff.tokenize = lineDiff.tokenize;
|
|
585
|
-
jsonDiff.castInput = function(value, options) {
|
|
586
|
-
var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = options.stringifyReplacer, stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
|
|
587
|
-
return typeof v === "undefined" ? undefinedReplacement : v;
|
|
588
|
-
} : _options$stringifyRep;
|
|
589
|
-
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
|
|
590
|
-
};
|
|
591
|
-
jsonDiff.equals = function(left, right, options) {
|
|
592
|
-
return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
|
|
593
|
-
};
|
|
594
|
-
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
595
|
-
stack = stack || [];
|
|
596
|
-
replacementStack = replacementStack || [];
|
|
597
|
-
if (replacer) {
|
|
598
|
-
obj = replacer(key, obj);
|
|
599
|
-
}
|
|
600
|
-
var i;
|
|
601
|
-
for (i = 0; i < stack.length; i += 1) {
|
|
602
|
-
if (stack[i] === obj) {
|
|
603
|
-
return replacementStack[i];
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
var canonicalizedObj;
|
|
607
|
-
if ("[object Array]" === Object.prototype.toString.call(obj)) {
|
|
608
|
-
stack.push(obj);
|
|
609
|
-
canonicalizedObj = new Array(obj.length);
|
|
610
|
-
replacementStack.push(canonicalizedObj);
|
|
611
|
-
for (i = 0; i < obj.length; i += 1) {
|
|
612
|
-
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
|
|
613
|
-
}
|
|
614
|
-
stack.pop();
|
|
615
|
-
replacementStack.pop();
|
|
616
|
-
return canonicalizedObj;
|
|
617
|
-
}
|
|
618
|
-
if (obj && obj.toJSON) {
|
|
619
|
-
obj = obj.toJSON();
|
|
620
|
-
}
|
|
621
|
-
if (_typeof(obj) === "object" && obj !== null) {
|
|
622
|
-
stack.push(obj);
|
|
623
|
-
canonicalizedObj = {};
|
|
624
|
-
replacementStack.push(canonicalizedObj);
|
|
625
|
-
var sortedKeys = [], _key;
|
|
626
|
-
for (_key in obj) {
|
|
627
|
-
if (Object.prototype.hasOwnProperty.call(obj, _key)) {
|
|
628
|
-
sortedKeys.push(_key);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
sortedKeys.sort();
|
|
632
|
-
for (i = 0; i < sortedKeys.length; i += 1) {
|
|
633
|
-
_key = sortedKeys[i];
|
|
634
|
-
canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
|
|
635
|
-
}
|
|
636
|
-
stack.pop();
|
|
637
|
-
replacementStack.pop();
|
|
638
|
-
} else {
|
|
639
|
-
canonicalizedObj = obj;
|
|
640
|
-
}
|
|
641
|
-
return canonicalizedObj;
|
|
642
|
-
}
|
|
643
|
-
var arrayDiff = new Diff();
|
|
644
|
-
arrayDiff.tokenize = function(value) {
|
|
645
|
-
return value.slice();
|
|
646
|
-
};
|
|
647
|
-
arrayDiff.join = arrayDiff.removeEmpty = function(value) {
|
|
648
|
-
return value;
|
|
649
|
-
};
|
|
650
|
-
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
651
|
-
if (!options) {
|
|
652
|
-
options = {};
|
|
653
|
-
}
|
|
654
|
-
if (typeof options === "function") {
|
|
655
|
-
options = {
|
|
656
|
-
callback: options
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
if (typeof options.context === "undefined") {
|
|
660
|
-
options.context = 4;
|
|
661
|
-
}
|
|
662
|
-
if (options.newlineIsToken) {
|
|
663
|
-
throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
|
|
664
|
-
}
|
|
665
|
-
if (!options.callback) {
|
|
666
|
-
return diffLinesResultToPatch(diffLines(oldStr, newStr, options));
|
|
667
|
-
} else {
|
|
668
|
-
var _options = options, _callback = _options.callback;
|
|
669
|
-
diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
670
|
-
callback: function callback(diff2) {
|
|
671
|
-
var patch = diffLinesResultToPatch(diff2);
|
|
672
|
-
_callback(patch);
|
|
673
|
-
}
|
|
674
|
-
}));
|
|
675
|
-
}
|
|
676
|
-
function diffLinesResultToPatch(diff2) {
|
|
677
|
-
if (!diff2) {
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
diff2.push({
|
|
681
|
-
value: "",
|
|
682
|
-
lines: []
|
|
683
|
-
});
|
|
684
|
-
function contextLines(lines) {
|
|
685
|
-
return lines.map(function(entry) {
|
|
686
|
-
return " " + entry;
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
var hunks = [];
|
|
690
|
-
var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
|
691
|
-
var _loop = function _loop2() {
|
|
692
|
-
var current = diff2[i], lines = current.lines || splitLines(current.value);
|
|
693
|
-
current.lines = lines;
|
|
694
|
-
if (current.added || current.removed) {
|
|
695
|
-
var _curRange;
|
|
696
|
-
if (!oldRangeStart) {
|
|
697
|
-
var prev = diff2[i - 1];
|
|
698
|
-
oldRangeStart = oldLine;
|
|
699
|
-
newRangeStart = newLine;
|
|
700
|
-
if (prev) {
|
|
701
|
-
curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
|
|
702
|
-
oldRangeStart -= curRange.length;
|
|
703
|
-
newRangeStart -= curRange.length;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
(_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function(entry) {
|
|
707
|
-
return (current.added ? "+" : "-") + entry;
|
|
708
|
-
})));
|
|
709
|
-
if (current.added) {
|
|
710
|
-
newLine += lines.length;
|
|
711
|
-
} else {
|
|
712
|
-
oldLine += lines.length;
|
|
713
|
-
}
|
|
714
|
-
} else {
|
|
715
|
-
if (oldRangeStart) {
|
|
716
|
-
if (lines.length <= options.context * 2 && i < diff2.length - 2) {
|
|
717
|
-
var _curRange2;
|
|
718
|
-
(_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
|
|
719
|
-
} else {
|
|
720
|
-
var _curRange3;
|
|
721
|
-
var contextSize = Math.min(lines.length, options.context);
|
|
722
|
-
(_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
|
|
723
|
-
var _hunk = {
|
|
724
|
-
oldStart: oldRangeStart,
|
|
725
|
-
oldLines: oldLine - oldRangeStart + contextSize,
|
|
726
|
-
newStart: newRangeStart,
|
|
727
|
-
newLines: newLine - newRangeStart + contextSize,
|
|
728
|
-
lines: curRange
|
|
729
|
-
};
|
|
730
|
-
hunks.push(_hunk);
|
|
731
|
-
oldRangeStart = 0;
|
|
732
|
-
newRangeStart = 0;
|
|
733
|
-
curRange = [];
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
oldLine += lines.length;
|
|
737
|
-
newLine += lines.length;
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
for (var i = 0; i < diff2.length; i++) {
|
|
741
|
-
_loop();
|
|
742
|
-
}
|
|
743
|
-
for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) {
|
|
744
|
-
var hunk = _hunks[_i];
|
|
745
|
-
for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) {
|
|
746
|
-
if (hunk.lines[_i2].endsWith("\n")) {
|
|
747
|
-
hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1);
|
|
748
|
-
} else {
|
|
749
|
-
hunk.lines.splice(_i2 + 1, 0, "\");
|
|
750
|
-
_i2++;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
return {
|
|
755
|
-
oldFileName,
|
|
756
|
-
newFileName,
|
|
757
|
-
oldHeader,
|
|
758
|
-
newHeader,
|
|
759
|
-
hunks
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
function formatPatch(diff2) {
|
|
764
|
-
if (Array.isArray(diff2)) {
|
|
765
|
-
return diff2.map(formatPatch).join("\n");
|
|
766
|
-
}
|
|
767
|
-
var ret = [];
|
|
768
|
-
if (diff2.oldFileName == diff2.newFileName) {
|
|
769
|
-
ret.push("Index: " + diff2.oldFileName);
|
|
770
|
-
}
|
|
771
|
-
ret.push("===================================================================");
|
|
772
|
-
ret.push("--- " + diff2.oldFileName + (typeof diff2.oldHeader === "undefined" ? "" : " " + diff2.oldHeader));
|
|
773
|
-
ret.push("+++ " + diff2.newFileName + (typeof diff2.newHeader === "undefined" ? "" : " " + diff2.newHeader));
|
|
774
|
-
for (var i = 0; i < diff2.hunks.length; i++) {
|
|
775
|
-
var hunk = diff2.hunks[i];
|
|
776
|
-
if (hunk.oldLines === 0) {
|
|
777
|
-
hunk.oldStart -= 1;
|
|
778
|
-
}
|
|
779
|
-
if (hunk.newLines === 0) {
|
|
780
|
-
hunk.newStart -= 1;
|
|
781
|
-
}
|
|
782
|
-
ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
|
|
783
|
-
ret.push.apply(ret, hunk.lines);
|
|
784
|
-
}
|
|
785
|
-
return ret.join("\n") + "\n";
|
|
786
|
-
}
|
|
787
|
-
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
788
|
-
var _options2;
|
|
789
|
-
if (typeof options === "function") {
|
|
790
|
-
options = {
|
|
791
|
-
callback: options
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) {
|
|
795
|
-
var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
796
|
-
if (!patchObj) {
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
return formatPatch(patchObj);
|
|
800
|
-
} else {
|
|
801
|
-
var _options3 = options, _callback2 = _options3.callback;
|
|
802
|
-
structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
803
|
-
callback: function callback(patchObj2) {
|
|
804
|
-
if (!patchObj2) {
|
|
805
|
-
_callback2();
|
|
806
|
-
} else {
|
|
807
|
-
_callback2(formatPatch(patchObj2));
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}));
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
814
|
-
return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
815
|
-
}
|
|
816
|
-
function splitLines(text) {
|
|
817
|
-
var hasTrailingNl = text.endsWith("\n");
|
|
818
|
-
var result = text.split("\n").map(function(line) {
|
|
819
|
-
return line + "\n";
|
|
820
|
-
});
|
|
821
|
-
if (hasTrailingNl) {
|
|
822
|
-
result.pop();
|
|
823
|
-
} else {
|
|
824
|
-
result.push(result.pop().slice(0, -1));
|
|
825
|
-
}
|
|
826
|
-
return result;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
// ../diff/dist/diff-specs.js
|
|
830
|
-
function diffSpecs(before, after) {
|
|
831
|
-
const frontmatter = diffFrontmatter(before.frontmatter, after.frontmatter);
|
|
832
|
-
const sections = diffSections(before.parsedSections, after.parsedSections);
|
|
833
|
-
const specId = after.frontmatter.id;
|
|
834
|
-
const parts = [];
|
|
835
|
-
if (frontmatter.length > 0)
|
|
836
|
-
parts.push(`${frontmatter.length} field(s) changed`);
|
|
837
|
-
if (sections.length > 0)
|
|
838
|
-
parts.push(`${sections.length} section(s) changed`);
|
|
839
|
-
const summary = parts.length > 0 ? `${specId}: ${parts.join(", ")}` : `${specId}: no changes`;
|
|
840
|
-
return { specId, filePath: after.filePath, frontmatter, sections, summary };
|
|
841
|
-
}
|
|
842
|
-
function diffFrontmatter(before, after) {
|
|
843
|
-
const changes = [];
|
|
844
|
-
const allKeys = /* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)]);
|
|
845
|
-
for (const key of allKeys) {
|
|
846
|
-
const inBefore = Object.prototype.hasOwnProperty.call(before, key);
|
|
847
|
-
const inAfter = Object.prototype.hasOwnProperty.call(after, key);
|
|
848
|
-
if (inBefore && !inAfter) {
|
|
849
|
-
changes.push({ field: key, type: "removed", before: before[key] });
|
|
850
|
-
} else if (!inBefore && inAfter) {
|
|
851
|
-
changes.push({ field: key, type: "added", after: after[key] });
|
|
852
|
-
} else if (inBefore && inAfter) {
|
|
853
|
-
const bVal = before[key];
|
|
854
|
-
const aVal = after[key];
|
|
855
|
-
if (JSON.stringify(bVal) !== JSON.stringify(aVal)) {
|
|
856
|
-
changes.push({ field: key, type: "modified", before: bVal, after: aVal });
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
return changes;
|
|
861
|
-
}
|
|
862
|
-
function diffSections(before, after) {
|
|
863
|
-
const changes = [];
|
|
864
|
-
const beforeMap = /* @__PURE__ */ new Map();
|
|
865
|
-
for (const section of before) {
|
|
866
|
-
beforeMap.set(section.heading, section);
|
|
867
|
-
}
|
|
868
|
-
const afterMap = /* @__PURE__ */ new Map();
|
|
869
|
-
for (const section of after) {
|
|
870
|
-
afterMap.set(section.heading, section);
|
|
871
|
-
}
|
|
872
|
-
for (const [heading] of beforeMap) {
|
|
873
|
-
if (!afterMap.has(heading)) {
|
|
874
|
-
changes.push({ heading, type: "removed" });
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
for (const [heading, afterSection] of afterMap) {
|
|
878
|
-
const beforeSection = beforeMap.get(heading);
|
|
879
|
-
if (!beforeSection) {
|
|
880
|
-
changes.push({ heading, type: "added" });
|
|
881
|
-
} else if (beforeSection.content !== afterSection.content) {
|
|
882
|
-
const contentDiff = createPatch(heading, beforeSection.content, afterSection.content, "before", "after");
|
|
883
|
-
changes.push({ heading, type: "modified", contentDiff });
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
return changes;
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
// ../diff/dist/impact.js
|
|
890
|
-
var STRUCTURAL_SECTIONS = /* @__PURE__ */ new Set([
|
|
891
|
-
"Goals",
|
|
892
|
-
"Architecture",
|
|
893
|
-
"Features",
|
|
894
|
-
"Endpoints",
|
|
895
|
-
"Data Model",
|
|
896
|
-
"API Design",
|
|
897
|
-
"Problem Statement"
|
|
898
|
-
]);
|
|
899
|
-
function bfsDistances(startId, graph) {
|
|
900
|
-
const distances = /* @__PURE__ */ new Map();
|
|
901
|
-
const queue = [];
|
|
902
|
-
for (const edge of graph.edges) {
|
|
903
|
-
if (edge.from === startId) {
|
|
904
|
-
if (!distances.has(edge.to)) {
|
|
905
|
-
distances.set(edge.to, 1);
|
|
906
|
-
queue.push({ id: edge.to, distance: 1 });
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
while (queue.length > 0) {
|
|
911
|
-
const item = queue.shift();
|
|
912
|
-
const currentDist = item.distance;
|
|
913
|
-
for (const edge of graph.edges) {
|
|
914
|
-
if (edge.from === item.id && !distances.has(edge.to)) {
|
|
915
|
-
distances.set(edge.to, currentDist + 1);
|
|
916
|
-
queue.push({ id: edge.to, distance: currentDist + 1 });
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
return distances;
|
|
921
|
-
}
|
|
922
|
-
function daysBetween(dateStr) {
|
|
923
|
-
const then = new Date(dateStr).getTime();
|
|
924
|
-
const now = Date.now();
|
|
925
|
-
return Math.max(0, (now - then) / (1e3 * 60 * 60 * 24));
|
|
926
|
-
}
|
|
927
|
-
function clamp(min, max, value) {
|
|
928
|
-
return Math.min(max, Math.max(min, value));
|
|
929
|
-
}
|
|
930
|
-
function analyzeImpact(changedSpecId, diff2, graph, allSpecs, thresholdDays = 14) {
|
|
931
|
-
const distanceMap = bfsDistances(changedSpecId, graph);
|
|
932
|
-
if (distanceMap.size === 0) {
|
|
933
|
-
return {
|
|
934
|
-
changedSpec: changedSpecId,
|
|
935
|
-
downstream: [],
|
|
936
|
-
totalAffected: 0
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
const totalSections = Math.max(1, diff2.sections.length);
|
|
940
|
-
const structuralSectionsChanged = diff2.sections.filter((s) => STRUCTURAL_SECTIONS.has(s.heading)).length;
|
|
941
|
-
const specById = /* @__PURE__ */ new Map();
|
|
942
|
-
for (const spec of allSpecs) {
|
|
943
|
-
const id = spec.frontmatter.id;
|
|
944
|
-
if (id)
|
|
945
|
-
specById.set(id, spec);
|
|
946
|
-
}
|
|
947
|
-
const downstream = [];
|
|
948
|
-
for (const [specId, distance] of distanceMap) {
|
|
949
|
-
const spec = specById.get(specId);
|
|
950
|
-
const lastUpdated = spec?.frontmatter.updated ?? spec?.frontmatter.created ?? null;
|
|
951
|
-
const filePath = spec?.filePath ?? `specs/${specId}.md`;
|
|
952
|
-
let staleness;
|
|
953
|
-
if (lastUpdated) {
|
|
954
|
-
const daysSinceUpdate = daysBetween(lastUpdated);
|
|
955
|
-
staleness = clamp(0, 1, daysSinceUpdate / thresholdDays * 0.5 + structuralSectionsChanged / totalSections * 0.3 + 1 / distance * 0.2);
|
|
956
|
-
} else {
|
|
957
|
-
staleness = clamp(0, 1, structuralSectionsChanged / totalSections * 0.3 + 1 / distance * 0.2);
|
|
958
|
-
}
|
|
959
|
-
const parts = [];
|
|
960
|
-
parts.push(`depends on ${changedSpecId} (distance ${distance})`);
|
|
961
|
-
if (structuralSectionsChanged > 0) {
|
|
962
|
-
parts.push(`${structuralSectionsChanged} structural section(s) changed`);
|
|
963
|
-
}
|
|
964
|
-
if (lastUpdated) {
|
|
965
|
-
const days = Math.round(daysBetween(lastUpdated));
|
|
966
|
-
parts.push(`last updated ${days} day(s) ago`);
|
|
967
|
-
}
|
|
968
|
-
const reason = parts.join("; ");
|
|
969
|
-
downstream.push({
|
|
970
|
-
specId,
|
|
971
|
-
filePath,
|
|
972
|
-
distance,
|
|
973
|
-
lastUpdated,
|
|
974
|
-
staleness,
|
|
975
|
-
reason
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
downstream.sort((a, b) => a.distance - b.distance || b.staleness - a.staleness);
|
|
979
|
-
return {
|
|
980
|
-
changedSpec: changedSpecId,
|
|
981
|
-
downstream,
|
|
982
|
-
totalAffected: downstream.length
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
// ../diff/dist/cross-refs.js
|
|
987
|
-
function checkCrossReferences(allSpecs, removedIds) {
|
|
988
|
-
const validIds = new Set(allSpecs.map((s) => s.frontmatter.id));
|
|
989
|
-
for (const id of removedIds) {
|
|
990
|
-
validIds.delete(id);
|
|
991
|
-
}
|
|
992
|
-
const broken = [];
|
|
993
|
-
for (const spec of allSpecs) {
|
|
994
|
-
const references = spec.frontmatter.references;
|
|
995
|
-
if (!references || references.length === 0) {
|
|
996
|
-
continue;
|
|
997
|
-
}
|
|
998
|
-
for (const ref of references) {
|
|
999
|
-
if (!validIds.has(ref.id)) {
|
|
1000
|
-
broken.push({
|
|
1001
|
-
specId: spec.frontmatter.id,
|
|
1002
|
-
field: "references",
|
|
1003
|
-
type: "broken-reference",
|
|
1004
|
-
referencedId: ref.id
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
return broken;
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
// ../diff/dist/git.js
|
|
1013
|
-
function getRepoRoot(cwd) {
|
|
1014
|
-
const root = execSync("git rev-parse --show-toplevel", {
|
|
1015
|
-
cwd,
|
|
1016
|
-
encoding: "utf-8",
|
|
1017
|
-
stdio: "pipe"
|
|
1018
|
-
}).trim();
|
|
1019
|
-
return realpathSync(root);
|
|
1020
|
-
}
|
|
1021
|
-
function validateRef(ref, cwd) {
|
|
1022
|
-
try {
|
|
1023
|
-
execSync(`git rev-parse --verify ${ref}`, { cwd, encoding: "utf-8", stdio: "pipe" });
|
|
1024
|
-
} catch {
|
|
1025
|
-
throw new DiffError(`Invalid git ref: "${ref}"`);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
function gitShow(ref, filePath, projectRoot, repoRoot) {
|
|
1029
|
-
const relPath = relative(repoRoot, resolve(projectRoot, filePath));
|
|
1030
|
-
try {
|
|
1031
|
-
return execSync(`git show ${ref}:${relPath}`, {
|
|
1032
|
-
cwd: repoRoot,
|
|
1033
|
-
encoding: "utf-8",
|
|
1034
|
-
stdio: "pipe"
|
|
1035
|
-
});
|
|
1036
|
-
} catch {
|
|
1037
|
-
throw new DiffError(`Cannot read "${filePath}" at ref "${ref}"`);
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
function getChangedSpecFiles(baseRef, headRef, specPaths, projectRoot, repoRoot) {
|
|
1041
|
-
const repoRelToProjectRel = /* @__PURE__ */ new Map();
|
|
1042
|
-
for (const p of specPaths) {
|
|
1043
|
-
const repoRel = relative(repoRoot, resolve(projectRoot, p));
|
|
1044
|
-
repoRelToProjectRel.set(repoRel, p);
|
|
1045
|
-
}
|
|
1046
|
-
let diffOutput;
|
|
1047
|
-
try {
|
|
1048
|
-
diffOutput = execSync(`git diff --name-status ${baseRef} ${headRef}`, {
|
|
1049
|
-
cwd: repoRoot,
|
|
1050
|
-
encoding: "utf-8",
|
|
1051
|
-
stdio: "pipe"
|
|
1052
|
-
});
|
|
1053
|
-
} catch {
|
|
1054
|
-
throw new DiffError(`Failed to run git diff between "${baseRef}" and "${headRef}"`);
|
|
1055
|
-
}
|
|
1056
|
-
const result = { modified: [], added: [], deleted: [] };
|
|
1057
|
-
for (const line of diffOutput.trim().split("\n")) {
|
|
1058
|
-
if (!line)
|
|
1059
|
-
continue;
|
|
1060
|
-
const parts = line.split(" ");
|
|
1061
|
-
const status = parts[0];
|
|
1062
|
-
const filePath = parts[1];
|
|
1063
|
-
if (!status || !filePath)
|
|
1064
|
-
continue;
|
|
1065
|
-
const projectRelPath = repoRelToProjectRel.get(filePath);
|
|
1066
|
-
if (projectRelPath === void 0)
|
|
1067
|
-
continue;
|
|
1068
|
-
if (status === "M") {
|
|
1069
|
-
result.modified.push(projectRelPath);
|
|
1070
|
-
} else if (status === "A") {
|
|
1071
|
-
result.added.push(projectRelPath);
|
|
1072
|
-
} else if (status === "D") {
|
|
1073
|
-
result.deleted.push(projectRelPath);
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
return result;
|
|
1077
|
-
}
|
|
1078
|
-
async function diffBetweenRefs(configPath, baseRef, headRef) {
|
|
1079
|
-
const projectRoot = realpathSync(dirname(resolve(configPath)));
|
|
1080
|
-
const repoRoot = getRepoRoot(projectRoot);
|
|
1081
|
-
validateRef(baseRef, projectRoot);
|
|
1082
|
-
validateRef(headRef, projectRoot);
|
|
1083
|
-
const config = await loadConfig(configPath);
|
|
1084
|
-
const specPaths = [];
|
|
1085
|
-
const specIdByPath = /* @__PURE__ */ new Map();
|
|
1086
|
-
for (const [specId, entry] of Object.entries(config.specs)) {
|
|
1087
|
-
specPaths.push(entry.path);
|
|
1088
|
-
specIdByPath.set(entry.path, specId);
|
|
1089
|
-
}
|
|
1090
|
-
const changed = getChangedSpecFiles(baseRef, headRef, specPaths, projectRoot, repoRoot);
|
|
1091
|
-
const diffs = [];
|
|
1092
|
-
for (const filePath of changed.modified) {
|
|
1093
|
-
const beforeContent = gitShow(baseRef, filePath, projectRoot, repoRoot);
|
|
1094
|
-
const afterContent = gitShow(headRef, filePath, projectRoot, repoRoot);
|
|
1095
|
-
const beforeSpec = await parseSpecFromString(beforeContent, filePath);
|
|
1096
|
-
const afterSpec = await parseSpecFromString(afterContent, filePath);
|
|
1097
|
-
const diff2 = diffSpecs(beforeSpec, afterSpec);
|
|
1098
|
-
diffs.push(diff2);
|
|
1099
|
-
}
|
|
1100
|
-
const added = changed.added.map((p) => specIdByPath.get(p)).filter((id) => id !== void 0);
|
|
1101
|
-
const removed = changed.deleted.map((p) => specIdByPath.get(p)).filter((id) => id !== void 0);
|
|
1102
|
-
const graph = buildGraph(config);
|
|
1103
|
-
const impact = [];
|
|
1104
|
-
const allSpecs = [];
|
|
1105
|
-
for (const entry of Object.values(config.specs)) {
|
|
1106
|
-
try {
|
|
1107
|
-
const content = gitShow(headRef, entry.path, projectRoot, repoRoot);
|
|
1108
|
-
const parsed = await parseSpecFromString(content, entry.path);
|
|
1109
|
-
allSpecs.push(parsed);
|
|
1110
|
-
} catch {
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
const thresholdDays = config.diff?.staleness_threshold_days ?? 14;
|
|
1114
|
-
for (const diff2 of diffs) {
|
|
1115
|
-
const analysis = analyzeImpact(diff2.specId, diff2, graph, allSpecs, thresholdDays);
|
|
1116
|
-
if (analysis.totalAffected > 0) {
|
|
1117
|
-
impact.push(analysis);
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
const _brokenRefs = checkCrossReferences(allSpecs, removed);
|
|
1121
|
-
const summaryParts = [];
|
|
1122
|
-
if (diffs.length > 0) {
|
|
1123
|
-
summaryParts.push(`${diffs.length} spec(s) modified`);
|
|
1124
|
-
}
|
|
1125
|
-
if (added.length > 0) {
|
|
1126
|
-
summaryParts.push(`${added.length} spec(s) added`);
|
|
1127
|
-
}
|
|
1128
|
-
if (removed.length > 0) {
|
|
1129
|
-
summaryParts.push(`${removed.length} spec(s) removed`);
|
|
1130
|
-
}
|
|
1131
|
-
if (impact.length > 0) {
|
|
1132
|
-
const totalDownstream = impact.reduce((sum, i) => sum + i.totalAffected, 0);
|
|
1133
|
-
summaryParts.push(`${totalDownstream} downstream spec(s) potentially affected`);
|
|
1134
|
-
}
|
|
1135
|
-
if (_brokenRefs.length > 0) {
|
|
1136
|
-
summaryParts.push(`${_brokenRefs.length} broken reference(s)`);
|
|
1137
|
-
}
|
|
1138
|
-
const summary = summaryParts.length > 0 ? summaryParts.join("; ") : "No changes detected";
|
|
1139
|
-
return { diffs, added, removed, impact, summary };
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
export {
|
|
1143
|
-
DEFAULT_DIFF_CONFIG,
|
|
1144
|
-
DiffError,
|
|
1145
|
-
diffBetweenRefs
|
|
1146
|
-
};
|
|
1147
|
-
//# sourceMappingURL=chunk-SRZ33RJP.js.map
|