@punks/cli 2.2.9 → 2.3.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.
- package/dist/data/scripts/sync-subagents.mjs +68 -6
- package/dist/index.js +79 -948
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
cp,
|
|
2
3
|
lstat,
|
|
3
4
|
mkdir,
|
|
4
5
|
readFile,
|
|
@@ -52,6 +53,10 @@ const cursorManagedComment =
|
|
|
52
53
|
"<!-- Generated by scripts/sync-subagents.mjs. Edit .agents/subagents/manifest.mjs instead. -->";
|
|
53
54
|
const opencodeManagedComment =
|
|
54
55
|
"<!-- Generated by scripts/sync-subagents.mjs. Edit .agents/subagents/manifest.mjs instead. -->";
|
|
56
|
+
const claudeUpdateCheckCommand =
|
|
57
|
+
'node "$CLAUDE_PROJECT_DIR"/.claude/hooks/scaffold-update-check.mjs claude';
|
|
58
|
+
const claudeFormatCommand =
|
|
59
|
+
'node "$CLAUDE_PROJECT_DIR"/.claude/hooks/format-edited-file.mjs claude';
|
|
55
60
|
|
|
56
61
|
function buildCodexAgentConfig({ hasFormatHook, hasUpdateCheckHook }) {
|
|
57
62
|
const lines = [
|
|
@@ -100,39 +105,80 @@ function buildCodexAgentConfig({ hasFormatHook, hasUpdateCheckHook }) {
|
|
|
100
105
|
return lines.join("\n");
|
|
101
106
|
}
|
|
102
107
|
|
|
103
|
-
function
|
|
104
|
-
|
|
108
|
+
function isObject(value) {
|
|
109
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function removeClaudeHookCommand(entries, command) {
|
|
113
|
+
if (!Array.isArray(entries)) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return entries.flatMap((entry) => {
|
|
118
|
+
if (!isObject(entry) || !Array.isArray(entry.hooks)) {
|
|
119
|
+
return [entry];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const hooks = entry.hooks.filter((hook) => !isObject(hook) || hook.command !== command);
|
|
123
|
+
return hooks.length === 0 ? [] : [{ ...entry, hooks }];
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function setClaudeHookEntries(hooks, key, entries) {
|
|
128
|
+
if (entries.length > 0) {
|
|
129
|
+
hooks[key] = entries;
|
|
130
|
+
} else {
|
|
131
|
+
delete hooks[key];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildClaudeSettingsConfig(existingConfig, { hasFormatHook, hasUpdateCheckHook }) {
|
|
136
|
+
const config = isObject(existingConfig) ? existingConfig : {};
|
|
137
|
+
const existingHooks = isObject(config.hooks) ? config.hooks : {};
|
|
138
|
+
const hooks = { ...existingHooks };
|
|
139
|
+
const sessionStartHooks = removeClaudeHookCommand(
|
|
140
|
+
existingHooks.SessionStart,
|
|
141
|
+
claudeUpdateCheckCommand,
|
|
142
|
+
);
|
|
143
|
+
const postToolUseHooks = removeClaudeHookCommand(existingHooks.PostToolUse, claudeFormatCommand);
|
|
105
144
|
|
|
106
145
|
if (hasUpdateCheckHook) {
|
|
107
146
|
hooks.SessionStart = [
|
|
147
|
+
...sessionStartHooks,
|
|
108
148
|
{
|
|
109
149
|
hooks: [
|
|
110
150
|
{
|
|
111
151
|
type: "command",
|
|
112
|
-
command:
|
|
152
|
+
command: claudeUpdateCheckCommand,
|
|
113
153
|
timeout: 60,
|
|
114
154
|
},
|
|
115
155
|
],
|
|
116
156
|
},
|
|
117
157
|
];
|
|
158
|
+
} else {
|
|
159
|
+
setClaudeHookEntries(hooks, "SessionStart", sessionStartHooks);
|
|
118
160
|
}
|
|
119
161
|
|
|
120
162
|
if (hasFormatHook) {
|
|
121
163
|
hooks.PostToolUse = [
|
|
164
|
+
...postToolUseHooks,
|
|
122
165
|
{
|
|
123
166
|
matcher: "Edit|Write|MultiEdit",
|
|
124
167
|
hooks: [
|
|
125
168
|
{
|
|
126
169
|
type: "command",
|
|
127
|
-
command:
|
|
170
|
+
command: claudeFormatCommand,
|
|
128
171
|
timeout: 30,
|
|
129
172
|
},
|
|
130
173
|
],
|
|
131
174
|
},
|
|
132
175
|
];
|
|
176
|
+
} else {
|
|
177
|
+
setClaudeHookEntries(hooks, "PostToolUse", postToolUseHooks);
|
|
133
178
|
}
|
|
134
179
|
|
|
135
180
|
return {
|
|
181
|
+
...config,
|
|
136
182
|
hooks,
|
|
137
183
|
};
|
|
138
184
|
}
|
|
@@ -390,7 +436,23 @@ async function ensureSymlink(linkPath, targetPath) {
|
|
|
390
436
|
}
|
|
391
437
|
|
|
392
438
|
await rm(linkPath, { force: true, recursive: true });
|
|
393
|
-
await
|
|
439
|
+
const targetStat = process.platform === "win32" ? await lstat(targetPath) : undefined;
|
|
440
|
+
const symlinkType = targetStat?.isDirectory() ? "junction" : undefined;
|
|
441
|
+
|
|
442
|
+
try {
|
|
443
|
+
await symlink(symlinkType === "junction" ? targetPath : relativeTarget, linkPath, symlinkType);
|
|
444
|
+
} catch (error) {
|
|
445
|
+
if (!(error && typeof error === "object" && "code" in error && error.code === "EPERM")) {
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const copyTargetStat = await lstat(targetPath);
|
|
450
|
+
await cp(targetPath, linkPath, {
|
|
451
|
+
recursive: copyTargetStat.isDirectory(),
|
|
452
|
+
force: true,
|
|
453
|
+
errorOnExist: false,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
394
456
|
}
|
|
395
457
|
|
|
396
458
|
async function pathExists(filePath) {
|
|
@@ -499,7 +561,7 @@ async function main() {
|
|
|
499
561
|
await rm(path.join(codexDir, "hooks.json"), { force: true });
|
|
500
562
|
await writeFile(
|
|
501
563
|
claudeSettingsPath,
|
|
502
|
-
encodeJson(buildClaudeSettingsConfig(availableHooks)),
|
|
564
|
+
encodeJson(buildClaudeSettingsConfig(await readJsonFile(claudeSettingsPath), availableHooks)),
|
|
503
565
|
"utf8",
|
|
504
566
|
);
|
|
505
567
|
await writeFile(cursorHooksJsonPath, encodeJson(buildCursorHooksConfig(availableHooks)), "utf8");
|
package/dist/index.js
CHANGED
|
@@ -52254,7 +52254,7 @@ var embeddedAssets = [];
|
|
|
52254
52254
|
|
|
52255
52255
|
// package.json
|
|
52256
52256
|
var name = "@punks/cli";
|
|
52257
|
-
var version = "2.
|
|
52257
|
+
var version = "2.3.1";
|
|
52258
52258
|
// src/content/data.ts
|
|
52259
52259
|
var findFirst8 = (candidates) => candidates.find((candidate) => existsSync(candidate));
|
|
52260
52260
|
var executableSignature = () => {
|
|
@@ -60766,917 +60766,6 @@ import {
|
|
|
60766
60766
|
} from "node:fs";
|
|
60767
60767
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
60768
60768
|
import path15 from "node:path";
|
|
60769
|
-
|
|
60770
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/base.js
|
|
60771
|
-
class Diff {
|
|
60772
|
-
diff(oldStr, newStr, options9 = {}) {
|
|
60773
|
-
let callback;
|
|
60774
|
-
if (typeof options9 === "function") {
|
|
60775
|
-
callback = options9;
|
|
60776
|
-
options9 = {};
|
|
60777
|
-
} else if ("callback" in options9) {
|
|
60778
|
-
callback = options9.callback;
|
|
60779
|
-
}
|
|
60780
|
-
const oldString = this.castInput(oldStr, options9);
|
|
60781
|
-
const newString = this.castInput(newStr, options9);
|
|
60782
|
-
const oldTokens = this.removeEmpty(this.tokenize(oldString, options9));
|
|
60783
|
-
const newTokens = this.removeEmpty(this.tokenize(newString, options9));
|
|
60784
|
-
return this.diffWithOptionsObj(oldTokens, newTokens, options9, callback);
|
|
60785
|
-
}
|
|
60786
|
-
diffWithOptionsObj(oldTokens, newTokens, options9, callback) {
|
|
60787
|
-
var _a;
|
|
60788
|
-
const done9 = (value6) => {
|
|
60789
|
-
value6 = this.postProcess(value6, options9);
|
|
60790
|
-
if (callback) {
|
|
60791
|
-
setTimeout(function() {
|
|
60792
|
-
callback(value6);
|
|
60793
|
-
}, 0);
|
|
60794
|
-
return;
|
|
60795
|
-
} else {
|
|
60796
|
-
return value6;
|
|
60797
|
-
}
|
|
60798
|
-
};
|
|
60799
|
-
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
60800
|
-
let editLength = 1;
|
|
60801
|
-
let maxEditLength = newLen + oldLen;
|
|
60802
|
-
if (options9.maxEditLength != null) {
|
|
60803
|
-
maxEditLength = Math.min(maxEditLength, options9.maxEditLength);
|
|
60804
|
-
}
|
|
60805
|
-
const maxExecutionTime = (_a = options9.timeout) !== null && _a !== undefined ? _a : Infinity;
|
|
60806
|
-
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
60807
|
-
const bestPath = [{ oldPos: -1, lastComponent: undefined }];
|
|
60808
|
-
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options9);
|
|
60809
|
-
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
60810
|
-
return done9(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
60811
|
-
}
|
|
60812
|
-
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
60813
|
-
const execEditLength = () => {
|
|
60814
|
-
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength);diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
60815
|
-
let basePath;
|
|
60816
|
-
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
60817
|
-
if (removePath) {
|
|
60818
|
-
bestPath[diagonalPath - 1] = undefined;
|
|
60819
|
-
}
|
|
60820
|
-
let canAdd = false;
|
|
60821
|
-
if (addPath) {
|
|
60822
|
-
const addPathNewPos = addPath.oldPos - diagonalPath;
|
|
60823
|
-
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
60824
|
-
}
|
|
60825
|
-
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
60826
|
-
if (!canAdd && !canRemove) {
|
|
60827
|
-
bestPath[diagonalPath] = undefined;
|
|
60828
|
-
continue;
|
|
60829
|
-
}
|
|
60830
|
-
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
60831
|
-
basePath = this.addToPath(addPath, true, false, 0, options9);
|
|
60832
|
-
} else {
|
|
60833
|
-
basePath = this.addToPath(removePath, false, true, 1, options9);
|
|
60834
|
-
}
|
|
60835
|
-
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9);
|
|
60836
|
-
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
60837
|
-
return done9(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
60838
|
-
} else {
|
|
60839
|
-
bestPath[diagonalPath] = basePath;
|
|
60840
|
-
if (basePath.oldPos + 1 >= oldLen) {
|
|
60841
|
-
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
60842
|
-
}
|
|
60843
|
-
if (newPos + 1 >= newLen) {
|
|
60844
|
-
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
60845
|
-
}
|
|
60846
|
-
}
|
|
60847
|
-
}
|
|
60848
|
-
editLength++;
|
|
60849
|
-
};
|
|
60850
|
-
if (callback) {
|
|
60851
|
-
(function exec() {
|
|
60852
|
-
setTimeout(function() {
|
|
60853
|
-
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
60854
|
-
return callback(undefined);
|
|
60855
|
-
}
|
|
60856
|
-
if (!execEditLength()) {
|
|
60857
|
-
exec();
|
|
60858
|
-
}
|
|
60859
|
-
}, 0);
|
|
60860
|
-
})();
|
|
60861
|
-
} else {
|
|
60862
|
-
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
60863
|
-
const ret = execEditLength();
|
|
60864
|
-
if (ret) {
|
|
60865
|
-
return ret;
|
|
60866
|
-
}
|
|
60867
|
-
}
|
|
60868
|
-
}
|
|
60869
|
-
}
|
|
60870
|
-
addToPath(path15, added, removed, oldPosInc, options9) {
|
|
60871
|
-
const last5 = path15.lastComponent;
|
|
60872
|
-
if (last5 && !options9.oneChangePerToken && last5.added === added && last5.removed === removed) {
|
|
60873
|
-
return {
|
|
60874
|
-
oldPos: path15.oldPos + oldPosInc,
|
|
60875
|
-
lastComponent: { count: last5.count + 1, added, removed, previousComponent: last5.previousComponent }
|
|
60876
|
-
};
|
|
60877
|
-
} else {
|
|
60878
|
-
return {
|
|
60879
|
-
oldPos: path15.oldPos + oldPosInc,
|
|
60880
|
-
lastComponent: { count: 1, added, removed, previousComponent: last5 }
|
|
60881
|
-
};
|
|
60882
|
-
}
|
|
60883
|
-
}
|
|
60884
|
-
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9) {
|
|
60885
|
-
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
60886
|
-
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
60887
|
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options9)) {
|
|
60888
|
-
newPos++;
|
|
60889
|
-
oldPos++;
|
|
60890
|
-
commonCount++;
|
|
60891
|
-
if (options9.oneChangePerToken) {
|
|
60892
|
-
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
60893
|
-
}
|
|
60894
|
-
}
|
|
60895
|
-
if (commonCount && !options9.oneChangePerToken) {
|
|
60896
|
-
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
60897
|
-
}
|
|
60898
|
-
basePath.oldPos = oldPos;
|
|
60899
|
-
return newPos;
|
|
60900
|
-
}
|
|
60901
|
-
equals(left3, right3, options9) {
|
|
60902
|
-
if (options9.comparator) {
|
|
60903
|
-
return options9.comparator(left3, right3);
|
|
60904
|
-
} else {
|
|
60905
|
-
return left3 === right3 || !!options9.ignoreCase && left3.toLowerCase() === right3.toLowerCase();
|
|
60906
|
-
}
|
|
60907
|
-
}
|
|
60908
|
-
removeEmpty(array9) {
|
|
60909
|
-
const ret = [];
|
|
60910
|
-
for (let i = 0;i < array9.length; i++) {
|
|
60911
|
-
if (array9[i]) {
|
|
60912
|
-
ret.push(array9[i]);
|
|
60913
|
-
}
|
|
60914
|
-
}
|
|
60915
|
-
return ret;
|
|
60916
|
-
}
|
|
60917
|
-
castInput(value6, options9) {
|
|
60918
|
-
return value6;
|
|
60919
|
-
}
|
|
60920
|
-
tokenize(value6, options9) {
|
|
60921
|
-
return Array.from(value6);
|
|
60922
|
-
}
|
|
60923
|
-
join(chars) {
|
|
60924
|
-
return chars.join("");
|
|
60925
|
-
}
|
|
60926
|
-
postProcess(changeObjects, options9) {
|
|
60927
|
-
return changeObjects;
|
|
60928
|
-
}
|
|
60929
|
-
get useLongestToken() {
|
|
60930
|
-
return false;
|
|
60931
|
-
}
|
|
60932
|
-
buildValues(lastComponent, newTokens, oldTokens) {
|
|
60933
|
-
const components = [];
|
|
60934
|
-
let nextComponent;
|
|
60935
|
-
while (lastComponent) {
|
|
60936
|
-
components.push(lastComponent);
|
|
60937
|
-
nextComponent = lastComponent.previousComponent;
|
|
60938
|
-
delete lastComponent.previousComponent;
|
|
60939
|
-
lastComponent = nextComponent;
|
|
60940
|
-
}
|
|
60941
|
-
components.reverse();
|
|
60942
|
-
const componentLen = components.length;
|
|
60943
|
-
let componentPos = 0, newPos = 0, oldPos = 0;
|
|
60944
|
-
for (;componentPos < componentLen; componentPos++) {
|
|
60945
|
-
const component = components[componentPos];
|
|
60946
|
-
if (!component.removed) {
|
|
60947
|
-
if (!component.added && this.useLongestToken) {
|
|
60948
|
-
let value6 = newTokens.slice(newPos, newPos + component.count);
|
|
60949
|
-
value6 = value6.map(function(value7, i) {
|
|
60950
|
-
const oldValue = oldTokens[oldPos + i];
|
|
60951
|
-
return oldValue.length > value7.length ? oldValue : value7;
|
|
60952
|
-
});
|
|
60953
|
-
component.value = this.join(value6);
|
|
60954
|
-
} else {
|
|
60955
|
-
component.value = this.join(newTokens.slice(newPos, newPos + component.count));
|
|
60956
|
-
}
|
|
60957
|
-
newPos += component.count;
|
|
60958
|
-
if (!component.added) {
|
|
60959
|
-
oldPos += component.count;
|
|
60960
|
-
}
|
|
60961
|
-
} else {
|
|
60962
|
-
component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
|
|
60963
|
-
oldPos += component.count;
|
|
60964
|
-
}
|
|
60965
|
-
}
|
|
60966
|
-
return components;
|
|
60967
|
-
}
|
|
60968
|
-
}
|
|
60969
|
-
|
|
60970
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/character.js
|
|
60971
|
-
class CharacterDiff extends Diff {
|
|
60972
|
-
}
|
|
60973
|
-
var characterDiff = new CharacterDiff;
|
|
60974
|
-
|
|
60975
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/util/string.js
|
|
60976
|
-
function longestCommonPrefix(str1, str2) {
|
|
60977
|
-
let i;
|
|
60978
|
-
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
60979
|
-
if (str1[i] != str2[i]) {
|
|
60980
|
-
return str1.slice(0, i);
|
|
60981
|
-
}
|
|
60982
|
-
}
|
|
60983
|
-
return str1.slice(0, i);
|
|
60984
|
-
}
|
|
60985
|
-
function longestCommonSuffix(str1, str2) {
|
|
60986
|
-
let i;
|
|
60987
|
-
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
60988
|
-
return "";
|
|
60989
|
-
}
|
|
60990
|
-
for (i = 0;i < str1.length && i < str2.length; i++) {
|
|
60991
|
-
if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
|
|
60992
|
-
return str1.slice(-i);
|
|
60993
|
-
}
|
|
60994
|
-
}
|
|
60995
|
-
return str1.slice(-i);
|
|
60996
|
-
}
|
|
60997
|
-
function replacePrefix(string8, oldPrefix, newPrefix) {
|
|
60998
|
-
if (string8.slice(0, oldPrefix.length) != oldPrefix) {
|
|
60999
|
-
throw Error(`string ${JSON.stringify(string8)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
|
|
61000
|
-
}
|
|
61001
|
-
return newPrefix + string8.slice(oldPrefix.length);
|
|
61002
|
-
}
|
|
61003
|
-
function replaceSuffix(string8, oldSuffix, newSuffix) {
|
|
61004
|
-
if (!oldSuffix) {
|
|
61005
|
-
return string8 + newSuffix;
|
|
61006
|
-
}
|
|
61007
|
-
if (string8.slice(-oldSuffix.length) != oldSuffix) {
|
|
61008
|
-
throw Error(`string ${JSON.stringify(string8)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
|
|
61009
|
-
}
|
|
61010
|
-
return string8.slice(0, -oldSuffix.length) + newSuffix;
|
|
61011
|
-
}
|
|
61012
|
-
function removePrefix(string8, oldPrefix) {
|
|
61013
|
-
return replacePrefix(string8, oldPrefix, "");
|
|
61014
|
-
}
|
|
61015
|
-
function removeSuffix(string8, oldSuffix) {
|
|
61016
|
-
return replaceSuffix(string8, oldSuffix, "");
|
|
61017
|
-
}
|
|
61018
|
-
function maximumOverlap(string1, string22) {
|
|
61019
|
-
return string22.slice(0, overlapCount(string1, string22));
|
|
61020
|
-
}
|
|
61021
|
-
function overlapCount(a, b) {
|
|
61022
|
-
let startA = 0;
|
|
61023
|
-
if (a.length > b.length) {
|
|
61024
|
-
startA = a.length - b.length;
|
|
61025
|
-
}
|
|
61026
|
-
let endB = b.length;
|
|
61027
|
-
if (a.length < b.length) {
|
|
61028
|
-
endB = a.length;
|
|
61029
|
-
}
|
|
61030
|
-
const map36 = Array(endB);
|
|
61031
|
-
let k = 0;
|
|
61032
|
-
map36[0] = 0;
|
|
61033
|
-
for (let j = 1;j < endB; j++) {
|
|
61034
|
-
if (b[j] == b[k]) {
|
|
61035
|
-
map36[j] = map36[k];
|
|
61036
|
-
} else {
|
|
61037
|
-
map36[j] = k;
|
|
61038
|
-
}
|
|
61039
|
-
while (k > 0 && b[j] != b[k]) {
|
|
61040
|
-
k = map36[k];
|
|
61041
|
-
}
|
|
61042
|
-
if (b[j] == b[k]) {
|
|
61043
|
-
k++;
|
|
61044
|
-
}
|
|
61045
|
-
}
|
|
61046
|
-
k = 0;
|
|
61047
|
-
for (let i = startA;i < a.length; i++) {
|
|
61048
|
-
while (k > 0 && a[i] != b[k]) {
|
|
61049
|
-
k = map36[k];
|
|
61050
|
-
}
|
|
61051
|
-
if (a[i] == b[k]) {
|
|
61052
|
-
k++;
|
|
61053
|
-
}
|
|
61054
|
-
}
|
|
61055
|
-
return k;
|
|
61056
|
-
}
|
|
61057
|
-
function segment(string8, segmenter) {
|
|
61058
|
-
const parts2 = [];
|
|
61059
|
-
for (const segmentObj of Array.from(segmenter.segment(string8))) {
|
|
61060
|
-
const segment2 = segmentObj.segment;
|
|
61061
|
-
if (parts2.length && /\s/.test(parts2[parts2.length - 1]) && /\s/.test(segment2)) {
|
|
61062
|
-
parts2[parts2.length - 1] += segment2;
|
|
61063
|
-
} else {
|
|
61064
|
-
parts2.push(segment2);
|
|
61065
|
-
}
|
|
61066
|
-
}
|
|
61067
|
-
return parts2;
|
|
61068
|
-
}
|
|
61069
|
-
function trailingWs(string8, segmenter) {
|
|
61070
|
-
if (segmenter) {
|
|
61071
|
-
return leadingAndTrailingWs(string8, segmenter)[1];
|
|
61072
|
-
}
|
|
61073
|
-
let i;
|
|
61074
|
-
for (i = string8.length - 1;i >= 0; i--) {
|
|
61075
|
-
if (!string8[i].match(/\s/)) {
|
|
61076
|
-
break;
|
|
61077
|
-
}
|
|
61078
|
-
}
|
|
61079
|
-
return string8.substring(i + 1);
|
|
61080
|
-
}
|
|
61081
|
-
function leadingWs(string8, segmenter) {
|
|
61082
|
-
if (segmenter) {
|
|
61083
|
-
return leadingAndTrailingWs(string8, segmenter)[0];
|
|
61084
|
-
}
|
|
61085
|
-
const match19 = string8.match(/^\s*/);
|
|
61086
|
-
return match19 ? match19[0] : "";
|
|
61087
|
-
}
|
|
61088
|
-
function leadingAndTrailingWs(string8, segmenter) {
|
|
61089
|
-
if (!segmenter) {
|
|
61090
|
-
return [leadingWs(string8), trailingWs(string8)];
|
|
61091
|
-
}
|
|
61092
|
-
if (segmenter.resolvedOptions().granularity != "word") {
|
|
61093
|
-
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
61094
|
-
}
|
|
61095
|
-
const segments = segment(string8, segmenter);
|
|
61096
|
-
const firstSeg = segments[0];
|
|
61097
|
-
const lastSeg = segments[segments.length - 1];
|
|
61098
|
-
const head13 = /\s/.test(firstSeg) ? firstSeg : "";
|
|
61099
|
-
const tail2 = /\s/.test(lastSeg) ? lastSeg : "";
|
|
61100
|
-
return [head13, tail2];
|
|
61101
|
-
}
|
|
61102
|
-
|
|
61103
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/word.js
|
|
61104
|
-
var extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
|
|
61105
|
-
var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
|
|
61106
|
-
|
|
61107
|
-
class WordDiff extends Diff {
|
|
61108
|
-
equals(left3, right3, options9) {
|
|
61109
|
-
if (options9.ignoreCase) {
|
|
61110
|
-
left3 = left3.toLowerCase();
|
|
61111
|
-
right3 = right3.toLowerCase();
|
|
61112
|
-
}
|
|
61113
|
-
return left3.trim() === right3.trim();
|
|
61114
|
-
}
|
|
61115
|
-
tokenize(value6, options9 = {}) {
|
|
61116
|
-
let parts2;
|
|
61117
|
-
if (options9.intlSegmenter) {
|
|
61118
|
-
const segmenter = options9.intlSegmenter;
|
|
61119
|
-
if (segmenter.resolvedOptions().granularity != "word") {
|
|
61120
|
-
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
61121
|
-
}
|
|
61122
|
-
parts2 = segment(value6, segmenter);
|
|
61123
|
-
} else {
|
|
61124
|
-
parts2 = value6.match(tokenizeIncludingWhitespace) || [];
|
|
61125
|
-
}
|
|
61126
|
-
const tokens = [];
|
|
61127
|
-
let prevPart = null;
|
|
61128
|
-
parts2.forEach((part) => {
|
|
61129
|
-
if (/\s/.test(part)) {
|
|
61130
|
-
if (prevPart == null) {
|
|
61131
|
-
tokens.push(part);
|
|
61132
|
-
} else {
|
|
61133
|
-
tokens.push(tokens.pop() + part);
|
|
61134
|
-
}
|
|
61135
|
-
} else if (prevPart != null && /\s/.test(prevPart)) {
|
|
61136
|
-
if (tokens[tokens.length - 1] == prevPart) {
|
|
61137
|
-
tokens.push(tokens.pop() + part);
|
|
61138
|
-
} else {
|
|
61139
|
-
tokens.push(prevPart + part);
|
|
61140
|
-
}
|
|
61141
|
-
} else {
|
|
61142
|
-
tokens.push(part);
|
|
61143
|
-
}
|
|
61144
|
-
prevPart = part;
|
|
61145
|
-
});
|
|
61146
|
-
return tokens;
|
|
61147
|
-
}
|
|
61148
|
-
join(tokens) {
|
|
61149
|
-
return tokens.map((token, i) => {
|
|
61150
|
-
if (i == 0) {
|
|
61151
|
-
return token;
|
|
61152
|
-
} else {
|
|
61153
|
-
return token.replace(/^\s+/, "");
|
|
61154
|
-
}
|
|
61155
|
-
}).join("");
|
|
61156
|
-
}
|
|
61157
|
-
postProcess(changes2, options9) {
|
|
61158
|
-
if (!changes2 || options9.oneChangePerToken) {
|
|
61159
|
-
return changes2;
|
|
61160
|
-
}
|
|
61161
|
-
let lastKeep = null;
|
|
61162
|
-
let insertion = null;
|
|
61163
|
-
let deletion = null;
|
|
61164
|
-
changes2.forEach((change) => {
|
|
61165
|
-
if (change.added) {
|
|
61166
|
-
insertion = change;
|
|
61167
|
-
} else if (change.removed) {
|
|
61168
|
-
deletion = change;
|
|
61169
|
-
} else {
|
|
61170
|
-
if (insertion || deletion) {
|
|
61171
|
-
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options9.intlSegmenter);
|
|
61172
|
-
}
|
|
61173
|
-
lastKeep = change;
|
|
61174
|
-
insertion = null;
|
|
61175
|
-
deletion = null;
|
|
61176
|
-
}
|
|
61177
|
-
});
|
|
61178
|
-
if (insertion || deletion) {
|
|
61179
|
-
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options9.intlSegmenter);
|
|
61180
|
-
}
|
|
61181
|
-
return changes2;
|
|
61182
|
-
}
|
|
61183
|
-
}
|
|
61184
|
-
var wordDiff = new WordDiff;
|
|
61185
|
-
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep, segmenter) {
|
|
61186
|
-
if (deletion && insertion) {
|
|
61187
|
-
const [oldWsPrefix, oldWsSuffix] = leadingAndTrailingWs(deletion.value, segmenter);
|
|
61188
|
-
const [newWsPrefix, newWsSuffix] = leadingAndTrailingWs(insertion.value, segmenter);
|
|
61189
|
-
if (startKeep) {
|
|
61190
|
-
const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
61191
|
-
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
61192
|
-
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
61193
|
-
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
61194
|
-
}
|
|
61195
|
-
if (endKeep) {
|
|
61196
|
-
const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
61197
|
-
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
61198
|
-
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
61199
|
-
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
61200
|
-
}
|
|
61201
|
-
} else if (insertion) {
|
|
61202
|
-
if (startKeep) {
|
|
61203
|
-
const ws = leadingWs(insertion.value, segmenter);
|
|
61204
|
-
insertion.value = insertion.value.substring(ws.length);
|
|
61205
|
-
}
|
|
61206
|
-
if (endKeep) {
|
|
61207
|
-
const ws = leadingWs(endKeep.value, segmenter);
|
|
61208
|
-
endKeep.value = endKeep.value.substring(ws.length);
|
|
61209
|
-
}
|
|
61210
|
-
} else if (startKeep && endKeep) {
|
|
61211
|
-
const newWsFull = leadingWs(endKeep.value, segmenter), [delWsStart, delWsEnd] = leadingAndTrailingWs(deletion.value, segmenter);
|
|
61212
|
-
const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
61213
|
-
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
61214
|
-
const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
61215
|
-
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
61216
|
-
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
61217
|
-
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
61218
|
-
} else if (endKeep) {
|
|
61219
|
-
const endKeepWsPrefix = leadingWs(endKeep.value, segmenter);
|
|
61220
|
-
const deletionWsSuffix = trailingWs(deletion.value, segmenter);
|
|
61221
|
-
const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
61222
|
-
deletion.value = removeSuffix(deletion.value, overlap);
|
|
61223
|
-
} else if (startKeep) {
|
|
61224
|
-
const startKeepWsSuffix = trailingWs(startKeep.value, segmenter);
|
|
61225
|
-
const deletionWsPrefix = leadingWs(deletion.value, segmenter);
|
|
61226
|
-
const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
61227
|
-
deletion.value = removePrefix(deletion.value, overlap);
|
|
61228
|
-
}
|
|
61229
|
-
}
|
|
61230
|
-
|
|
61231
|
-
class WordsWithSpaceDiff extends Diff {
|
|
61232
|
-
tokenize(value6) {
|
|
61233
|
-
const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
|
|
61234
|
-
return value6.match(regex) || [];
|
|
61235
|
-
}
|
|
61236
|
-
}
|
|
61237
|
-
var wordsWithSpaceDiff = new WordsWithSpaceDiff;
|
|
61238
|
-
|
|
61239
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/line.js
|
|
61240
|
-
class LineDiff extends Diff {
|
|
61241
|
-
constructor() {
|
|
61242
|
-
super(...arguments);
|
|
61243
|
-
this.tokenize = tokenize;
|
|
61244
|
-
}
|
|
61245
|
-
equals(left3, right3, options9) {
|
|
61246
|
-
if (options9.ignoreWhitespace) {
|
|
61247
|
-
if (!options9.newlineIsToken || !left3.includes(`
|
|
61248
|
-
`)) {
|
|
61249
|
-
left3 = left3.trim();
|
|
61250
|
-
}
|
|
61251
|
-
if (!options9.newlineIsToken || !right3.includes(`
|
|
61252
|
-
`)) {
|
|
61253
|
-
right3 = right3.trim();
|
|
61254
|
-
}
|
|
61255
|
-
} else if (options9.ignoreNewlineAtEof && !options9.newlineIsToken) {
|
|
61256
|
-
if (left3.endsWith(`
|
|
61257
|
-
`)) {
|
|
61258
|
-
left3 = left3.slice(0, -1);
|
|
61259
|
-
}
|
|
61260
|
-
if (right3.endsWith(`
|
|
61261
|
-
`)) {
|
|
61262
|
-
right3 = right3.slice(0, -1);
|
|
61263
|
-
}
|
|
61264
|
-
}
|
|
61265
|
-
return super.equals(left3, right3, options9);
|
|
61266
|
-
}
|
|
61267
|
-
}
|
|
61268
|
-
var lineDiff = new LineDiff;
|
|
61269
|
-
function diffLines(oldStr, newStr, options9) {
|
|
61270
|
-
return lineDiff.diff(oldStr, newStr, options9);
|
|
61271
|
-
}
|
|
61272
|
-
function tokenize(value6, options9) {
|
|
61273
|
-
if (options9.stripTrailingCr) {
|
|
61274
|
-
value6 = value6.replace(/\r\n/g, `
|
|
61275
|
-
`);
|
|
61276
|
-
}
|
|
61277
|
-
const retLines = [], linesAndNewlines = value6.split(/(\n|\r\n)/);
|
|
61278
|
-
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
61279
|
-
linesAndNewlines.pop();
|
|
61280
|
-
}
|
|
61281
|
-
for (let i = 0;i < linesAndNewlines.length; i++) {
|
|
61282
|
-
const line4 = linesAndNewlines[i];
|
|
61283
|
-
if (i % 2 && !options9.newlineIsToken) {
|
|
61284
|
-
retLines[retLines.length - 1] += line4;
|
|
61285
|
-
} else {
|
|
61286
|
-
retLines.push(line4);
|
|
61287
|
-
}
|
|
61288
|
-
}
|
|
61289
|
-
return retLines;
|
|
61290
|
-
}
|
|
61291
|
-
|
|
61292
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/sentence.js
|
|
61293
|
-
function isSentenceEndPunct(char4) {
|
|
61294
|
-
return char4 == "." || char4 == "!" || char4 == "?";
|
|
61295
|
-
}
|
|
61296
|
-
|
|
61297
|
-
class SentenceDiff extends Diff {
|
|
61298
|
-
tokenize(value6) {
|
|
61299
|
-
var _a;
|
|
61300
|
-
const result = [];
|
|
61301
|
-
let tokenStartI = 0;
|
|
61302
|
-
for (let i = 0;i < value6.length; i++) {
|
|
61303
|
-
if (i == value6.length - 1) {
|
|
61304
|
-
result.push(value6.slice(tokenStartI));
|
|
61305
|
-
break;
|
|
61306
|
-
}
|
|
61307
|
-
if (isSentenceEndPunct(value6[i]) && value6[i + 1].match(/\s/)) {
|
|
61308
|
-
result.push(value6.slice(tokenStartI, i + 1));
|
|
61309
|
-
i = tokenStartI = i + 1;
|
|
61310
|
-
while ((_a = value6[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
|
|
61311
|
-
i++;
|
|
61312
|
-
}
|
|
61313
|
-
result.push(value6.slice(tokenStartI, i + 1));
|
|
61314
|
-
tokenStartI = i + 1;
|
|
61315
|
-
}
|
|
61316
|
-
}
|
|
61317
|
-
return result;
|
|
61318
|
-
}
|
|
61319
|
-
}
|
|
61320
|
-
var sentenceDiff = new SentenceDiff;
|
|
61321
|
-
|
|
61322
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/css.js
|
|
61323
|
-
class CssDiff extends Diff {
|
|
61324
|
-
tokenize(value6) {
|
|
61325
|
-
return value6.split(/([{}:;,]|\s+)/);
|
|
61326
|
-
}
|
|
61327
|
-
}
|
|
61328
|
-
var cssDiff = new CssDiff;
|
|
61329
|
-
|
|
61330
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/json.js
|
|
61331
|
-
class JsonDiff extends Diff {
|
|
61332
|
-
constructor() {
|
|
61333
|
-
super(...arguments);
|
|
61334
|
-
this.tokenize = tokenize;
|
|
61335
|
-
}
|
|
61336
|
-
get useLongestToken() {
|
|
61337
|
-
return true;
|
|
61338
|
-
}
|
|
61339
|
-
castInput(value6, options9) {
|
|
61340
|
-
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options9;
|
|
61341
|
-
return typeof value6 === "string" ? value6 : JSON.stringify(canonicalize(value6, null, null, stringifyReplacer), null, " ");
|
|
61342
|
-
}
|
|
61343
|
-
equals(left3, right3, options9) {
|
|
61344
|
-
return super.equals(left3.replace(/,([\r\n])/g, "$1"), right3.replace(/,([\r\n])/g, "$1"), options9);
|
|
61345
|
-
}
|
|
61346
|
-
}
|
|
61347
|
-
var jsonDiff = new JsonDiff;
|
|
61348
|
-
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
61349
|
-
stack = stack || [];
|
|
61350
|
-
replacementStack = replacementStack || [];
|
|
61351
|
-
if (replacer) {
|
|
61352
|
-
obj = replacer(key === undefined ? "" : key, obj);
|
|
61353
|
-
}
|
|
61354
|
-
let i;
|
|
61355
|
-
for (i = 0;i < stack.length; i += 1) {
|
|
61356
|
-
if (stack[i] === obj) {
|
|
61357
|
-
return replacementStack[i];
|
|
61358
|
-
}
|
|
61359
|
-
}
|
|
61360
|
-
let canonicalizedObj;
|
|
61361
|
-
if (Object.prototype.toString.call(obj) === "[object Array]") {
|
|
61362
|
-
stack.push(obj);
|
|
61363
|
-
canonicalizedObj = new Array(obj.length);
|
|
61364
|
-
replacementStack.push(canonicalizedObj);
|
|
61365
|
-
for (i = 0;i < obj.length; i += 1) {
|
|
61366
|
-
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
|
|
61367
|
-
}
|
|
61368
|
-
stack.pop();
|
|
61369
|
-
replacementStack.pop();
|
|
61370
|
-
return canonicalizedObj;
|
|
61371
|
-
}
|
|
61372
|
-
if (obj && obj.toJSON) {
|
|
61373
|
-
obj = obj.toJSON();
|
|
61374
|
-
}
|
|
61375
|
-
if (typeof obj === "object" && obj !== null) {
|
|
61376
|
-
stack.push(obj);
|
|
61377
|
-
canonicalizedObj = {};
|
|
61378
|
-
replacementStack.push(canonicalizedObj);
|
|
61379
|
-
const sortedKeys = [];
|
|
61380
|
-
let key2;
|
|
61381
|
-
for (key2 in obj) {
|
|
61382
|
-
if (Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
61383
|
-
sortedKeys.push(key2);
|
|
61384
|
-
}
|
|
61385
|
-
}
|
|
61386
|
-
sortedKeys.sort();
|
|
61387
|
-
for (i = 0;i < sortedKeys.length; i += 1) {
|
|
61388
|
-
key2 = sortedKeys[i];
|
|
61389
|
-
canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
|
|
61390
|
-
}
|
|
61391
|
-
stack.pop();
|
|
61392
|
-
replacementStack.pop();
|
|
61393
|
-
} else {
|
|
61394
|
-
canonicalizedObj = obj;
|
|
61395
|
-
}
|
|
61396
|
-
return canonicalizedObj;
|
|
61397
|
-
}
|
|
61398
|
-
|
|
61399
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/array.js
|
|
61400
|
-
class ArrayDiff extends Diff {
|
|
61401
|
-
tokenize(value6) {
|
|
61402
|
-
return value6.slice();
|
|
61403
|
-
}
|
|
61404
|
-
join(value6) {
|
|
61405
|
-
return value6;
|
|
61406
|
-
}
|
|
61407
|
-
removeEmpty(value6) {
|
|
61408
|
-
return value6;
|
|
61409
|
-
}
|
|
61410
|
-
}
|
|
61411
|
-
var arrayDiff = new ArrayDiff;
|
|
61412
|
-
|
|
61413
|
-
// ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/patch/create.js
|
|
61414
|
-
function needsQuoting(s) {
|
|
61415
|
-
for (let i = 0;i < s.length; i++) {
|
|
61416
|
-
if (s[i] < " " || s[i] > "~" || s[i] === '"' || s[i] === "\\") {
|
|
61417
|
-
return true;
|
|
61418
|
-
}
|
|
61419
|
-
}
|
|
61420
|
-
return false;
|
|
61421
|
-
}
|
|
61422
|
-
function quoteFileNameIfNeeded(s) {
|
|
61423
|
-
if (!needsQuoting(s)) {
|
|
61424
|
-
return s;
|
|
61425
|
-
}
|
|
61426
|
-
let result = '"';
|
|
61427
|
-
const bytes = new TextEncoder().encode(s);
|
|
61428
|
-
let i = 0;
|
|
61429
|
-
while (i < bytes.length) {
|
|
61430
|
-
const b = bytes[i];
|
|
61431
|
-
if (b === 7) {
|
|
61432
|
-
result += "\\a";
|
|
61433
|
-
} else if (b === 8) {
|
|
61434
|
-
result += "\\b";
|
|
61435
|
-
} else if (b === 9) {
|
|
61436
|
-
result += "\\t";
|
|
61437
|
-
} else if (b === 10) {
|
|
61438
|
-
result += "\\n";
|
|
61439
|
-
} else if (b === 11) {
|
|
61440
|
-
result += "\\v";
|
|
61441
|
-
} else if (b === 12) {
|
|
61442
|
-
result += "\\f";
|
|
61443
|
-
} else if (b === 13) {
|
|
61444
|
-
result += "\\r";
|
|
61445
|
-
} else if (b === 34) {
|
|
61446
|
-
result += "\\\"";
|
|
61447
|
-
} else if (b === 92) {
|
|
61448
|
-
result += "\\\\";
|
|
61449
|
-
} else if (b >= 32 && b <= 126) {
|
|
61450
|
-
result += String.fromCharCode(b);
|
|
61451
|
-
} else {
|
|
61452
|
-
result += "\\" + b.toString(8).padStart(3, "0");
|
|
61453
|
-
}
|
|
61454
|
-
i++;
|
|
61455
|
-
}
|
|
61456
|
-
result += '"';
|
|
61457
|
-
return result;
|
|
61458
|
-
}
|
|
61459
|
-
var INCLUDE_HEADERS = {
|
|
61460
|
-
includeIndex: true,
|
|
61461
|
-
includeUnderline: true,
|
|
61462
|
-
includeFileHeaders: true
|
|
61463
|
-
};
|
|
61464
|
-
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
|
|
61465
|
-
let optionsObj;
|
|
61466
|
-
if (!options9) {
|
|
61467
|
-
optionsObj = {};
|
|
61468
|
-
} else if (typeof options9 === "function") {
|
|
61469
|
-
optionsObj = { callback: options9 };
|
|
61470
|
-
} else {
|
|
61471
|
-
optionsObj = options9;
|
|
61472
|
-
}
|
|
61473
|
-
if (typeof optionsObj.context === "undefined") {
|
|
61474
|
-
optionsObj.context = 4;
|
|
61475
|
-
}
|
|
61476
|
-
const context8 = optionsObj.context;
|
|
61477
|
-
if (optionsObj.newlineIsToken) {
|
|
61478
|
-
throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
|
|
61479
|
-
}
|
|
61480
|
-
if (!optionsObj.callback) {
|
|
61481
|
-
return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
|
|
61482
|
-
} else {
|
|
61483
|
-
const { callback } = optionsObj;
|
|
61484
|
-
diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff8) => {
|
|
61485
|
-
const patch15 = diffLinesResultToPatch(diff8);
|
|
61486
|
-
callback(patch15);
|
|
61487
|
-
} }));
|
|
61488
|
-
}
|
|
61489
|
-
function diffLinesResultToPatch(diff8) {
|
|
61490
|
-
if (!diff8) {
|
|
61491
|
-
return;
|
|
61492
|
-
}
|
|
61493
|
-
diff8.push({ value: "", lines: [] });
|
|
61494
|
-
function contextLines(lines3) {
|
|
61495
|
-
return lines3.map(function(entry) {
|
|
61496
|
-
return " " + entry;
|
|
61497
|
-
});
|
|
61498
|
-
}
|
|
61499
|
-
const hunks = [];
|
|
61500
|
-
let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
|
61501
|
-
for (let i = 0;i < diff8.length; i++) {
|
|
61502
|
-
const current = diff8[i], lines3 = current.lines || splitLines4(current.value);
|
|
61503
|
-
current.lines = lines3;
|
|
61504
|
-
if (current.added || current.removed) {
|
|
61505
|
-
if (!oldRangeStart) {
|
|
61506
|
-
const prev = diff8[i - 1];
|
|
61507
|
-
oldRangeStart = oldLine;
|
|
61508
|
-
newRangeStart = newLine;
|
|
61509
|
-
if (prev) {
|
|
61510
|
-
curRange = context8 > 0 ? contextLines(prev.lines.slice(-context8)) : [];
|
|
61511
|
-
oldRangeStart -= curRange.length;
|
|
61512
|
-
newRangeStart -= curRange.length;
|
|
61513
|
-
}
|
|
61514
|
-
}
|
|
61515
|
-
for (const line4 of lines3) {
|
|
61516
|
-
curRange.push((current.added ? "+" : "-") + line4);
|
|
61517
|
-
}
|
|
61518
|
-
if (current.added) {
|
|
61519
|
-
newLine += lines3.length;
|
|
61520
|
-
} else {
|
|
61521
|
-
oldLine += lines3.length;
|
|
61522
|
-
}
|
|
61523
|
-
} else {
|
|
61524
|
-
if (oldRangeStart) {
|
|
61525
|
-
if (lines3.length <= context8 * 2 && i < diff8.length - 2) {
|
|
61526
|
-
for (const line4 of contextLines(lines3)) {
|
|
61527
|
-
curRange.push(line4);
|
|
61528
|
-
}
|
|
61529
|
-
} else {
|
|
61530
|
-
const contextSize = Math.min(lines3.length, context8);
|
|
61531
|
-
for (const line4 of contextLines(lines3.slice(0, contextSize))) {
|
|
61532
|
-
curRange.push(line4);
|
|
61533
|
-
}
|
|
61534
|
-
const hunk = {
|
|
61535
|
-
oldStart: oldRangeStart,
|
|
61536
|
-
oldLines: oldLine - oldRangeStart + contextSize,
|
|
61537
|
-
newStart: newRangeStart,
|
|
61538
|
-
newLines: newLine - newRangeStart + contextSize,
|
|
61539
|
-
lines: curRange
|
|
61540
|
-
};
|
|
61541
|
-
hunks.push(hunk);
|
|
61542
|
-
oldRangeStart = 0;
|
|
61543
|
-
newRangeStart = 0;
|
|
61544
|
-
curRange = [];
|
|
61545
|
-
}
|
|
61546
|
-
}
|
|
61547
|
-
oldLine += lines3.length;
|
|
61548
|
-
newLine += lines3.length;
|
|
61549
|
-
}
|
|
61550
|
-
}
|
|
61551
|
-
for (const hunk of hunks) {
|
|
61552
|
-
for (let i = 0;i < hunk.lines.length; i++) {
|
|
61553
|
-
if (hunk.lines[i].endsWith(`
|
|
61554
|
-
`)) {
|
|
61555
|
-
hunk.lines[i] = hunk.lines[i].slice(0, -1);
|
|
61556
|
-
} else {
|
|
61557
|
-
hunk.lines.splice(i + 1, 0, "\");
|
|
61558
|
-
i++;
|
|
61559
|
-
}
|
|
61560
|
-
}
|
|
61561
|
-
}
|
|
61562
|
-
return {
|
|
61563
|
-
oldFileName,
|
|
61564
|
-
newFileName,
|
|
61565
|
-
oldHeader,
|
|
61566
|
-
newHeader,
|
|
61567
|
-
hunks
|
|
61568
|
-
};
|
|
61569
|
-
}
|
|
61570
|
-
}
|
|
61571
|
-
function formatPatch(patch15, headerOptions) {
|
|
61572
|
-
var _a, _b, _c, _d, _e, _f;
|
|
61573
|
-
if (!headerOptions) {
|
|
61574
|
-
headerOptions = INCLUDE_HEADERS;
|
|
61575
|
-
}
|
|
61576
|
-
if (Array.isArray(patch15)) {
|
|
61577
|
-
if (patch15.length > 1 && !headerOptions.includeFileHeaders && !patch15.every((p3) => p3.isGit)) {
|
|
61578
|
-
throw new Error("Cannot omit file headers on a multi-file patch. " + "(The result would be unparseable; how would a tool trying to apply " + "the patch know which changes are to which file?)");
|
|
61579
|
-
}
|
|
61580
|
-
return patch15.map((p3) => formatPatch(p3, headerOptions)).join(`
|
|
61581
|
-
`);
|
|
61582
|
-
}
|
|
61583
|
-
const ret = [];
|
|
61584
|
-
if (patch15.isGit) {
|
|
61585
|
-
headerOptions = INCLUDE_HEADERS;
|
|
61586
|
-
if (!patch15.oldFileName) {
|
|
61587
|
-
throw new Error("oldFileName must be specified for Git patches");
|
|
61588
|
-
}
|
|
61589
|
-
if (!patch15.newFileName) {
|
|
61590
|
-
throw new Error("newFileName must be specified for Git patches");
|
|
61591
|
-
}
|
|
61592
|
-
let gitOldName = patch15.oldFileName;
|
|
61593
|
-
let gitNewName = patch15.newFileName;
|
|
61594
|
-
if (patch15.isCreate && gitOldName === "/dev/null") {
|
|
61595
|
-
gitOldName = gitNewName.replace(/^b\//, "a/");
|
|
61596
|
-
} else if (patch15.isDelete && gitNewName === "/dev/null") {
|
|
61597
|
-
gitNewName = gitOldName.replace(/^a\//, "b/");
|
|
61598
|
-
}
|
|
61599
|
-
ret.push("diff --git " + quoteFileNameIfNeeded(gitOldName) + " " + quoteFileNameIfNeeded(gitNewName));
|
|
61600
|
-
if (patch15.isDelete) {
|
|
61601
|
-
ret.push("deleted file mode " + ((_a = patch15.oldMode) !== null && _a !== undefined ? _a : "100644"));
|
|
61602
|
-
}
|
|
61603
|
-
if (patch15.isCreate) {
|
|
61604
|
-
ret.push("new file mode " + ((_b = patch15.newMode) !== null && _b !== undefined ? _b : "100644"));
|
|
61605
|
-
}
|
|
61606
|
-
if (patch15.oldMode && patch15.newMode && !patch15.isDelete && !patch15.isCreate) {
|
|
61607
|
-
ret.push("old mode " + patch15.oldMode);
|
|
61608
|
-
ret.push("new mode " + patch15.newMode);
|
|
61609
|
-
}
|
|
61610
|
-
if (patch15.isRename) {
|
|
61611
|
-
ret.push("rename from " + quoteFileNameIfNeeded(((_c = patch15.oldFileName) !== null && _c !== undefined ? _c : "").replace(/^a\//, "")));
|
|
61612
|
-
ret.push("rename to " + quoteFileNameIfNeeded(((_d = patch15.newFileName) !== null && _d !== undefined ? _d : "").replace(/^b\//, "")));
|
|
61613
|
-
}
|
|
61614
|
-
if (patch15.isCopy) {
|
|
61615
|
-
ret.push("copy from " + quoteFileNameIfNeeded(((_e = patch15.oldFileName) !== null && _e !== undefined ? _e : "").replace(/^a\//, "")));
|
|
61616
|
-
ret.push("copy to " + quoteFileNameIfNeeded(((_f = patch15.newFileName) !== null && _f !== undefined ? _f : "").replace(/^b\//, "")));
|
|
61617
|
-
}
|
|
61618
|
-
} else {
|
|
61619
|
-
if (headerOptions.includeIndex && patch15.oldFileName == patch15.newFileName && patch15.oldFileName !== undefined) {
|
|
61620
|
-
ret.push("Index: " + patch15.oldFileName);
|
|
61621
|
-
}
|
|
61622
|
-
if (headerOptions.includeUnderline) {
|
|
61623
|
-
ret.push("===================================================================");
|
|
61624
|
-
}
|
|
61625
|
-
}
|
|
61626
|
-
const hasHunks = patch15.hunks.length > 0;
|
|
61627
|
-
if (headerOptions.includeFileHeaders && patch15.oldFileName !== undefined && patch15.newFileName !== undefined && (!patch15.isGit || hasHunks)) {
|
|
61628
|
-
ret.push("--- " + quoteFileNameIfNeeded(patch15.oldFileName) + (patch15.oldHeader ? "\t" + patch15.oldHeader : ""));
|
|
61629
|
-
ret.push("+++ " + quoteFileNameIfNeeded(patch15.newFileName) + (patch15.newHeader ? "\t" + patch15.newHeader : ""));
|
|
61630
|
-
}
|
|
61631
|
-
for (let i = 0;i < patch15.hunks.length; i++) {
|
|
61632
|
-
const hunk = patch15.hunks[i];
|
|
61633
|
-
const oldStart = hunk.oldLines === 0 ? hunk.oldStart - 1 : hunk.oldStart;
|
|
61634
|
-
const newStart = hunk.newLines === 0 ? hunk.newStart - 1 : hunk.newStart;
|
|
61635
|
-
ret.push("@@ -" + oldStart + "," + hunk.oldLines + " +" + newStart + "," + hunk.newLines + " @@");
|
|
61636
|
-
for (const line4 of hunk.lines) {
|
|
61637
|
-
ret.push(line4);
|
|
61638
|
-
}
|
|
61639
|
-
}
|
|
61640
|
-
return ret.join(`
|
|
61641
|
-
`) + `
|
|
61642
|
-
`;
|
|
61643
|
-
}
|
|
61644
|
-
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
|
|
61645
|
-
if (typeof options9 === "function") {
|
|
61646
|
-
options9 = { callback: options9 };
|
|
61647
|
-
}
|
|
61648
|
-
if (!(options9 === null || options9 === undefined ? undefined : options9.callback)) {
|
|
61649
|
-
const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9);
|
|
61650
|
-
if (!patchObj) {
|
|
61651
|
-
return;
|
|
61652
|
-
}
|
|
61653
|
-
return formatPatch(patchObj, options9 === null || options9 === undefined ? undefined : options9.headerOptions);
|
|
61654
|
-
} else {
|
|
61655
|
-
const { callback } = options9;
|
|
61656
|
-
structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options9), { callback: (patchObj) => {
|
|
61657
|
-
if (!patchObj) {
|
|
61658
|
-
callback(undefined);
|
|
61659
|
-
} else {
|
|
61660
|
-
callback(formatPatch(patchObj, options9.headerOptions));
|
|
61661
|
-
}
|
|
61662
|
-
} }));
|
|
61663
|
-
}
|
|
61664
|
-
}
|
|
61665
|
-
function splitLines4(text12) {
|
|
61666
|
-
const hasTrailingNl = text12.endsWith(`
|
|
61667
|
-
`);
|
|
61668
|
-
const result = text12.split(`
|
|
61669
|
-
`).map((line4) => line4 + `
|
|
61670
|
-
`);
|
|
61671
|
-
if (hasTrailingNl) {
|
|
61672
|
-
result.pop();
|
|
61673
|
-
} else {
|
|
61674
|
-
result.push(result.pop().slice(0, -1));
|
|
61675
|
-
}
|
|
61676
|
-
return result;
|
|
61677
|
-
}
|
|
61678
|
-
|
|
61679
|
-
// src/update/run.ts
|
|
61680
60769
|
var scaffoldManifestFile = ".devpunks/scaffold-manifest.json";
|
|
61681
60770
|
var agentHandoffFile = ".devpunks/AGENT-HANDOFF.md";
|
|
61682
60771
|
var agentSystemPromptFile2 = ".devpunks/AGENT-SYSTEM-PROMPT.md";
|
|
@@ -61769,6 +60858,27 @@ var hashPath = (rootDirectory, relativePath) => {
|
|
|
61769
60858
|
const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync2(absolutePath)}` : readFileSync9(absolutePath);
|
|
61770
60859
|
return hashContent2(content);
|
|
61771
60860
|
};
|
|
60861
|
+
var ignoredWikiAlignmentRootDirectoryNames = new Set([
|
|
60862
|
+
".next",
|
|
60863
|
+
".nitro",
|
|
60864
|
+
".output",
|
|
60865
|
+
".source",
|
|
60866
|
+
".tanstack",
|
|
60867
|
+
".turbo",
|
|
60868
|
+
"build",
|
|
60869
|
+
"coverage",
|
|
60870
|
+
"dist",
|
|
60871
|
+
"node_modules"
|
|
60872
|
+
]);
|
|
60873
|
+
var hasIgnoredWikiAlignmentRootDirectory = (relativePath) => {
|
|
60874
|
+
const [firstSegment] = relativePath.split("/").filter(Boolean);
|
|
60875
|
+
return firstSegment !== undefined && ignoredWikiAlignmentRootDirectoryNames.has(firstSegment);
|
|
60876
|
+
};
|
|
60877
|
+
var wikiAlignmentRootDirectories = ["apps/wiki", "app/wiki", "wiki"];
|
|
60878
|
+
var hasIgnoredWikiAlignmentPath = (relativePath) => wikiAlignmentRootDirectories.some((wikiRoot) => {
|
|
60879
|
+
const prefix = `${wikiRoot}/`;
|
|
60880
|
+
return relativePath.startsWith(prefix) && hasIgnoredWikiAlignmentRootDirectory(relativePath.slice(prefix.length));
|
|
60881
|
+
});
|
|
61772
60882
|
var collectRelativeFiles2 = (rootDirectory, relativeDirectory) => {
|
|
61773
60883
|
const absoluteDirectory = path15.join(rootDirectory, relativeDirectory);
|
|
61774
60884
|
if (!existsSync9(absoluteDirectory)) {
|
|
@@ -61779,7 +60889,8 @@ var collectRelativeFiles2 = (rootDirectory, relativeDirectory) => {
|
|
|
61779
60889
|
for (const entry of readdirSync4(currentDirectory, { withFileTypes: true })) {
|
|
61780
60890
|
const absolutePath = path15.join(currentDirectory, entry.name);
|
|
61781
60891
|
const relativePath = path15.relative(rootDirectory, absolutePath).split(path15.sep).join("/");
|
|
61782
|
-
|
|
60892
|
+
const wikiRelativePath = path15.relative(absoluteDirectory, absolutePath).split(path15.sep).join("/");
|
|
60893
|
+
if (hasIgnoredWikiAlignmentRootDirectory(wikiRelativePath)) {
|
|
61783
60894
|
continue;
|
|
61784
60895
|
}
|
|
61785
60896
|
if (entry.isDirectory()) {
|
|
@@ -61858,7 +60969,6 @@ var summarizeStaleFiles = (staleFiles) => {
|
|
|
61858
60969
|
].join(`
|
|
61859
60970
|
`);
|
|
61860
60971
|
};
|
|
61861
|
-
var diffableChanges = (changes2) => changes2.filter((change) => change.status !== "missing" && change.kind !== "manifest" && change.patch.length <= 8000).slice(0, 5);
|
|
61862
60972
|
var packDriftPrompt = ({
|
|
61863
60973
|
rootDirectory,
|
|
61864
60974
|
finalPacks,
|
|
@@ -61894,15 +61004,27 @@ var buildChanges = ({
|
|
|
61894
61004
|
{
|
|
61895
61005
|
path: expected.path,
|
|
61896
61006
|
kind: expected.kind,
|
|
61897
|
-
status: status2
|
|
61898
|
-
patch: createTwoFilesPatch(expected.path, expected.path, contentForDiff(rootDirectory, expected.path), contentForDiff(expectedDirectory, expected.path), "current", "expected")
|
|
61007
|
+
status: status2
|
|
61899
61008
|
}
|
|
61900
61009
|
];
|
|
61901
61010
|
}).toSorted((left3, right3) => left3.path.localeCompare(right3.path));
|
|
61902
61011
|
};
|
|
61903
|
-
var
|
|
61012
|
+
var syncSubagentsScriptFile = ".agents/scripts/sync-subagents.mjs";
|
|
61013
|
+
var isWikiManagedPath = (relativePath) => relativePath.startsWith("wiki/") || relativePath.startsWith("app/wiki/") || relativePath.startsWith("apps/wiki/");
|
|
61014
|
+
var isTailoredSyncSubagentsScript = (rootDirectory) => {
|
|
61015
|
+
const scriptPath = path15.join(rootDirectory, syncSubagentsScriptFile);
|
|
61016
|
+
if (!existsSync9(scriptPath)) {
|
|
61017
|
+
return false;
|
|
61018
|
+
}
|
|
61019
|
+
const content = readFileSync9(scriptPath, "utf8");
|
|
61020
|
+
return /["'`](?:app|apps|packages|infra)\//.test(content);
|
|
61021
|
+
};
|
|
61022
|
+
var isProjectAuthoredManagedFile = ({
|
|
61023
|
+
file: file6,
|
|
61024
|
+
rootDirectory
|
|
61025
|
+
}) => {
|
|
61904
61026
|
if (file6.path === ".agents/scripts/sync-subagents.mjs") {
|
|
61905
|
-
return
|
|
61027
|
+
return isTailoredSyncSubagentsScript(rootDirectory);
|
|
61906
61028
|
}
|
|
61907
61029
|
if (file6.kind === "agent-prompt" || file6.kind === "handoff" || file6.kind === "manifest" || file6.kind === "prompt-spec" || file6.kind === "subagent") {
|
|
61908
61030
|
return true;
|
|
@@ -61920,13 +61042,11 @@ var buildLegacyRequiredToolsPromptChanges = ({
|
|
|
61920
61042
|
const current = readFileSync9(absolutePath, "utf8");
|
|
61921
61043
|
if (!current.includes(legacyRequiredToolsFile))
|
|
61922
61044
|
return [];
|
|
61923
|
-
const expected = current.replaceAll(legacyRequiredToolsFile, repoSettingsDisplayFile);
|
|
61924
61045
|
return [
|
|
61925
61046
|
{
|
|
61926
61047
|
path: promptFile,
|
|
61927
61048
|
kind: "handoff",
|
|
61928
|
-
status: "local-edited"
|
|
61929
|
-
patch: createTwoFilesPatch(promptFile, promptFile, current, expected, "current", "expected")
|
|
61049
|
+
status: "local-edited"
|
|
61930
61050
|
}
|
|
61931
61051
|
];
|
|
61932
61052
|
});
|
|
@@ -61946,7 +61066,8 @@ var rewriteLegacyRequiredToolsPrompt = ({
|
|
|
61946
61066
|
var copyIfExists = ({
|
|
61947
61067
|
rootDirectory,
|
|
61948
61068
|
targetDirectory,
|
|
61949
|
-
relativePath
|
|
61069
|
+
relativePath,
|
|
61070
|
+
ignoreGeneratedRootDirectories = false
|
|
61950
61071
|
}) => {
|
|
61951
61072
|
const sourcePath = path15.join(rootDirectory, relativePath);
|
|
61952
61073
|
if (!existsSync9(sourcePath))
|
|
@@ -61958,7 +61079,14 @@ var copyIfExists = ({
|
|
|
61958
61079
|
symlinkSync2(readlinkSync2(sourcePath), targetPath);
|
|
61959
61080
|
return;
|
|
61960
61081
|
}
|
|
61961
|
-
cpSync3(sourcePath, targetPath, {
|
|
61082
|
+
cpSync3(sourcePath, targetPath, {
|
|
61083
|
+
recursive: true,
|
|
61084
|
+
verbatimSymlinks: true,
|
|
61085
|
+
filter: (source) => {
|
|
61086
|
+
const relativeSource = path15.relative(sourcePath, source).split(path15.sep).join("/");
|
|
61087
|
+
return !ignoreGeneratedRootDirectories || !hasIgnoredWikiAlignmentRootDirectory(relativeSource);
|
|
61088
|
+
}
|
|
61089
|
+
});
|
|
61962
61090
|
};
|
|
61963
61091
|
var buildWikiAlignment = ({
|
|
61964
61092
|
rootDirectory,
|
|
@@ -61970,7 +61098,12 @@ var buildWikiAlignment = ({
|
|
|
61970
61098
|
return ["package.json", "backlog-provider.md", "wiki-framework.md"].some((marker) => existsSync9(path15.join(absoluteRoot, marker)));
|
|
61971
61099
|
};
|
|
61972
61100
|
const wikiRoot = hasWikiRootMarkers2("apps/wiki") ? "apps/wiki" : hasWikiRootMarkers2("app/wiki") ? "app/wiki" : existsSync9(path15.join(rootDirectory, "apps/wiki")) ? "apps/wiki" : existsSync9(path15.join(rootDirectory, "wiki")) ? "wiki" : detection.monorepo ? "apps/wiki" : "wiki";
|
|
61973
|
-
copyIfExists({
|
|
61101
|
+
copyIfExists({
|
|
61102
|
+
rootDirectory,
|
|
61103
|
+
targetDirectory: expectedDirectory,
|
|
61104
|
+
relativePath: wikiRoot,
|
|
61105
|
+
ignoreGeneratedRootDirectories: true
|
|
61106
|
+
});
|
|
61974
61107
|
copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
|
|
61975
61108
|
const wikiFramework = readWikiFrameworkPin(path15.join(expectedDirectory, wikiRoot));
|
|
61976
61109
|
scaffoldWikiForDirectory({
|
|
@@ -61992,6 +61125,7 @@ var buildWikiAlignment = ({
|
|
|
61992
61125
|
}));
|
|
61993
61126
|
return {
|
|
61994
61127
|
expectedDirectory,
|
|
61128
|
+
expectedFiles,
|
|
61995
61129
|
changes: buildChanges({
|
|
61996
61130
|
rootDirectory,
|
|
61997
61131
|
expectedDirectory,
|
|
@@ -62125,7 +61259,7 @@ var runUpdate = ({
|
|
|
62125
61259
|
const changes2 = buildChanges({
|
|
62126
61260
|
rootDirectory,
|
|
62127
61261
|
expectedDirectory,
|
|
62128
|
-
expectedFiles: expected.managedFiles.filter((file6) => !isProjectAuthoredManagedFile(file6)),
|
|
61262
|
+
expectedFiles: expected.managedFiles.filter((file6) => !isProjectAuthoredManagedFile({ file: file6, rootDirectory })),
|
|
62129
61263
|
previousFiles
|
|
62130
61264
|
});
|
|
62131
61265
|
const legacyRequiredToolsPromptChanges = buildLegacyRequiredToolsPromptChanges({
|
|
@@ -62135,19 +61269,23 @@ var runUpdate = ({
|
|
|
62135
61269
|
rootDirectory,
|
|
62136
61270
|
expectedDirectory
|
|
62137
61271
|
});
|
|
62138
|
-
const
|
|
61272
|
+
const shouldAlignWiki = finalPacks.includes("docs") || expected.managedFiles.some((file6) => isWikiManagedPath(file6.path));
|
|
61273
|
+
const wikiAlignment = shouldAlignWiki ? buildWikiAlignment({
|
|
62139
61274
|
rootDirectory,
|
|
62140
61275
|
detection
|
|
62141
|
-
});
|
|
61276
|
+
}) : null;
|
|
62142
61277
|
const allChanges = [
|
|
62143
61278
|
...changes2,
|
|
62144
61279
|
...legacyRequiredToolsPromptChanges,
|
|
62145
61280
|
...gitignoreChanges,
|
|
62146
|
-
...wikiAlignment
|
|
61281
|
+
...wikiAlignment?.changes ?? [],
|
|
62147
61282
|
...settingsChanges
|
|
62148
61283
|
].toSorted((left3, right3) => left3.path.localeCompare(right3.path));
|
|
62149
|
-
const expectedPaths = new Set(
|
|
62150
|
-
|
|
61284
|
+
const expectedPaths = new Set([
|
|
61285
|
+
...expected.managedFiles.map((file6) => file6.path),
|
|
61286
|
+
...wikiAlignment?.expectedFiles.map((file6) => file6.path) ?? []
|
|
61287
|
+
]);
|
|
61288
|
+
const staleFiles = previousFiles.filter((file6) => !isProjectAuthoredManagedFile({ file: file6, rootDirectory })).map((file6) => file6.path).filter((file6) => !hasIgnoredWikiAlignmentPath(file6)).filter((file6) => !expectedPaths.has(file6)).toSorted();
|
|
62151
61289
|
const hasManagedUpdates = allChanges.length > 0 || staleFiles.length > 0;
|
|
62152
61290
|
const needsAttention = hasManagedUpdates || packDrift || baselineDrift;
|
|
62153
61291
|
const driftPrompt = packDrift ? packDriftPrompt({ rootDirectory, finalPacks, resolvedPacks }) : null;
|
|
@@ -62187,17 +61325,6 @@ var runUpdate = ({
|
|
|
62187
61325
|
yield* writeHuman("");
|
|
62188
61326
|
yield* writeHuman(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
|
|
62189
61327
|
}
|
|
62190
|
-
const patchPreview = diffableChanges(allChanges);
|
|
62191
|
-
if (patchPreview.length > 0) {
|
|
62192
|
-
yield* writeHuman("");
|
|
62193
|
-
yield* writeHuman(renderCommandSection("Diff Preview", [
|
|
62194
|
-
...patchPreview.map((change) => change.patch),
|
|
62195
|
-
...allChanges.length > patchPreview.length ? [
|
|
62196
|
-
`Showing ${patchPreview.length} focused diffs. Full structured details are available with --json.`
|
|
62197
|
-
] : []
|
|
62198
|
-
].join(`
|
|
62199
|
-
`)));
|
|
62200
|
-
}
|
|
62201
61328
|
const applyRequested = write4 || yes ? true : check2 || emitJson || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
|
|
62202
61329
|
const unsafeBundledBaselineDrift = applyRequested && baselineDrift && baseline.summary.source === "bundled" && !allowBundledBaselineDriftApply;
|
|
62203
61330
|
if (unsafeBundledBaselineDrift) {
|
|
@@ -62249,12 +61376,14 @@ var runUpdate = ({
|
|
|
62249
61376
|
relativePath: change.path
|
|
62250
61377
|
});
|
|
62251
61378
|
}
|
|
62252
|
-
|
|
62253
|
-
|
|
62254
|
-
|
|
62255
|
-
|
|
62256
|
-
|
|
62257
|
-
|
|
61379
|
+
if (wikiAlignment !== null) {
|
|
61380
|
+
for (const change of wikiAlignment.changes) {
|
|
61381
|
+
copyManagedFile({
|
|
61382
|
+
fromDirectory: wikiAlignment.expectedDirectory,
|
|
61383
|
+
toDirectory: rootDirectory,
|
|
61384
|
+
relativePath: change.path
|
|
61385
|
+
});
|
|
61386
|
+
}
|
|
62258
61387
|
}
|
|
62259
61388
|
for (const change of settingsChanges) {
|
|
62260
61389
|
copyManagedFile({
|
|
@@ -62304,7 +61433,9 @@ var runUpdate = ({
|
|
|
62304
61433
|
yield* prompt4.writeLine(encodePrettyJson3(result));
|
|
62305
61434
|
}
|
|
62306
61435
|
rmSync4(expectedDirectory, { recursive: true, force: true });
|
|
62307
|
-
|
|
61436
|
+
if (wikiAlignment !== null) {
|
|
61437
|
+
rmSync4(wikiAlignment.expectedDirectory, { recursive: true, force: true });
|
|
61438
|
+
}
|
|
62308
61439
|
if (result.applied) {
|
|
62309
61440
|
yield* submitCliEventEffect("cli.scaffold.update.applied", {
|
|
62310
61441
|
cwd: rootDirectory,
|