@punks/cli 2.2.8 → 2.3.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/dist/index.js CHANGED
@@ -10891,7 +10891,7 @@ var require_public_api = __commonJS((exports) => {
10891
10891
 
10892
10892
  // src/index.ts
10893
10893
  import { spawn as spawn2 } from "node:child_process";
10894
- import { existsSync as existsSync10, mkdirSync as mkdirSync8, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
10894
+ import { existsSync as existsSync11, mkdirSync as mkdirSync8, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
10895
10895
  import { homedir as homedir3 } from "node:os";
10896
10896
  import path17 from "node:path";
10897
10897
  import { createInterface as createInterface3 } from "node:readline/promises";
@@ -52254,7 +52254,7 @@ var embeddedAssets = [];
52254
52254
 
52255
52255
  // package.json
52256
52256
  var name = "@punks/cli";
52257
- var version = "2.2.8";
52257
+ var version = "2.3.0";
52258
52258
  // src/content/data.ts
52259
52259
  var findFirst8 = (candidates) => candidates.find((candidate) => existsSync(candidate));
52260
52260
  var executableSignature = () => {
@@ -52926,7 +52926,7 @@ import path13 from "node:path";
52926
52926
  // src/baseline/resolve.ts
52927
52927
  import { createHash } from "node:crypto";
52928
52928
  import { execFileSync as execFileSync2, spawnSync } from "node:child_process";
52929
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
52929
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
52930
52930
  import { tmpdir as tmpdir3 } from "node:os";
52931
52931
  import path5 from "node:path";
52932
52932
 
@@ -53294,8 +53294,14 @@ var packCatalog = [
53294
53294
  id: "frontend",
53295
53295
  category: "surface",
53296
53296
  triggerPackages: [],
53297
- description: "Frontend pack: agent-browser, design taste, and frontend domain structure.",
53298
- skills: ["agent-browser", "design-taste-frontend", "frontend-domain-structure"],
53297
+ description: "Frontend pack: agent-browser, design taste, image generation, and frontend domain structure.",
53298
+ skills: [
53299
+ "agent-browser",
53300
+ "design-taste-frontend",
53301
+ "imagegen-frontend-mobile",
53302
+ "imagegen-frontend-web",
53303
+ "frontend-domain-structure"
53304
+ ],
53299
53305
  lintAssets: [],
53300
53306
  hooks: [],
53301
53307
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
@@ -53679,6 +53685,22 @@ var skillCatalog = [
53679
53685
  framework: null,
53680
53686
  requiresTools: []
53681
53687
  },
53688
+ {
53689
+ id: "imagegen-frontend-mobile",
53690
+ sourceDirectory: "skills/agnostic/frontend/imagegen-frontend-mobile",
53691
+ tier: "agnostic",
53692
+ language: null,
53693
+ framework: null,
53694
+ requiresTools: []
53695
+ },
53696
+ {
53697
+ id: "imagegen-frontend-web",
53698
+ sourceDirectory: "skills/agnostic/frontend/imagegen-frontend-web",
53699
+ tier: "agnostic",
53700
+ language: null,
53701
+ framework: null,
53702
+ requiresTools: []
53703
+ },
53682
53704
  {
53683
53705
  id: "frontend-domain-structure",
53684
53706
  sourceDirectory: "skills/agnostic/frontend/frontend-domain-structure",
@@ -54044,13 +54066,23 @@ var bundledBaseline = {
54044
54066
  };
54045
54067
 
54046
54068
  // src/baseline/load.ts
54047
- import { readFileSync as readFileSync2 } from "node:fs";
54069
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
54048
54070
  import path4 from "node:path";
54049
54071
  var readJson = (filePath) => JSON.parse(readFileSync2(filePath, "utf8"));
54072
+ var validateBaselineAssets = ({
54073
+ root,
54074
+ skills
54075
+ }) => {
54076
+ for (const skill of skills) {
54077
+ if (!existsSync2(path4.join(root, skill.sourceDirectory))) {
54078
+ throw new Error(`Baseline skill asset missing: ${skill.sourceDirectory}`);
54079
+ }
54080
+ }
54081
+ };
54050
54082
  var loadBaselineFromDirectory = (root, source) => {
54051
54083
  const metadata = readJson(path4.join(root, "baseline.json"));
54052
54084
  const dataRoot2 = path4.join(root, "data");
54053
- return {
54085
+ const baseline = {
54054
54086
  summary: {
54055
54087
  source,
54056
54088
  channel: metadata.channel ?? "stable",
@@ -54068,6 +54100,8 @@ var loadBaselineFromDirectory = (root, source) => {
54068
54100
  hooks: readJson(path4.join(dataRoot2, "catalog", "hooks.json")),
54069
54101
  lintAssets: validateLintCatalog(readJson(path4.join(dataRoot2, "catalog", "lint-assets.json")))
54070
54102
  };
54103
+ validateBaselineAssets(baseline);
54104
+ return baseline;
54071
54105
  };
54072
54106
 
54073
54107
  // src/baseline/resolve.ts
@@ -54167,6 +54201,17 @@ var tryResolveLatestStableTagWithCli = (timeoutMs) => {
54167
54201
  return null;
54168
54202
  }
54169
54203
  };
54204
+ var loadReusableCachedBaseline = (targetDirectory) => {
54205
+ if (!existsSync3(path5.join(targetDirectory, "baseline.json"))) {
54206
+ return null;
54207
+ }
54208
+ try {
54209
+ return loadBaselineFromDirectory(targetDirectory, "remote");
54210
+ } catch {
54211
+ rmSync(targetDirectory, { recursive: true, force: true });
54212
+ return null;
54213
+ }
54214
+ };
54170
54215
  var tryResolveGitHubStableBaselineWithCli = async ({
54171
54216
  refresh,
54172
54217
  timeoutMs,
@@ -54179,8 +54224,11 @@ var tryResolveGitHubStableBaselineWithCli = async ({
54179
54224
  }
54180
54225
  const version2 = stableVersionFromTag(tag6);
54181
54226
  const targetDirectory = path5.join(cacheRoot(), "stable", version2);
54182
- if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54183
- return loadBaselineFromDirectory(targetDirectory, "remote");
54227
+ if (!refresh) {
54228
+ const cachedBaseline = loadReusableCachedBaseline(targetDirectory);
54229
+ if (cachedBaseline !== null) {
54230
+ return cachedBaseline;
54231
+ }
54184
54232
  }
54185
54233
  const tempDirectory = mkdtempSync(path5.join(tmpdir3(), "punks-gh-baseline-"));
54186
54234
  try {
@@ -54219,7 +54267,10 @@ var tryResolveGitHubStableBaselineWithCli = async ({
54219
54267
  const extractedMetadataPath = path5.join(manifestTargetDirectory, "baseline.json");
54220
54268
  const extractedMetadata = JSON.parse(readFileSync3(extractedMetadataPath, "utf8"));
54221
54269
  writeFileSync2(extractedMetadataPath, JSON.stringify({ ...extractedMetadata, sha256: archiveSha256 }, null, 2), "utf8");
54222
- const baseline = loadBaselineFromDirectory(manifestTargetDirectory, "remote");
54270
+ const baseline = loadReusableCachedBaseline(manifestTargetDirectory);
54271
+ if (baseline === null) {
54272
+ throw new Error("Downloaded GitHub baseline failed validation.");
54273
+ }
54223
54274
  await submitArtifactPullTelemetry(baseline, cwd);
54224
54275
  return baseline;
54225
54276
  } finally {
@@ -54260,11 +54311,14 @@ var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) =>
54260
54311
  throw new Error(`Unsafe control plane baseline version: ${resolution.version}`);
54261
54312
  }
54262
54313
  const targetDirectory = path5.join(cacheRoot(), "control-plane", resolution.version);
54263
- if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54264
- return {
54265
- baseline: loadBaselineFromDirectory(targetDirectory, "remote"),
54266
- artifactPulled: false
54267
- };
54314
+ if (!refresh) {
54315
+ const cachedBaseline = loadReusableCachedBaseline(targetDirectory);
54316
+ if (cachedBaseline !== null) {
54317
+ return {
54318
+ baseline: cachedBaseline,
54319
+ artifactPulled: false
54320
+ };
54321
+ }
54268
54322
  }
54269
54323
  const tempDirectory = mkdtempSync(path5.join(tmpdir3(), "punks-control-plane-baseline-"));
54270
54324
  const archivePath = path5.join(tempDirectory, assetArchiveName);
@@ -54286,8 +54340,12 @@ var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) =>
54286
54340
  sha256: archiveSha256
54287
54341
  }, null, 2), "utf8");
54288
54342
  rmSync(tempDirectory, { recursive: true, force: true });
54343
+ const baseline = loadReusableCachedBaseline(targetDirectory);
54344
+ if (baseline === null) {
54345
+ throw new Error("Downloaded control plane baseline failed validation.");
54346
+ }
54289
54347
  return {
54290
- baseline: loadBaselineFromDirectory(targetDirectory, "remote"),
54348
+ baseline,
54291
54349
  artifactPulled: true
54292
54350
  };
54293
54351
  };
@@ -54377,8 +54435,11 @@ var materializeGitHubStableRelease = async ({
54377
54435
  return manifest;
54378
54436
  }
54379
54437
  const targetDirectory = path5.join(cacheRoot(), "stable", manifest.version);
54380
- if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54381
- return loadBaselineFromDirectory(targetDirectory, "remote");
54438
+ if (!refresh) {
54439
+ const cachedBaseline = loadReusableCachedBaseline(targetDirectory);
54440
+ if (cachedBaseline !== null) {
54441
+ return cachedBaseline;
54442
+ }
54382
54443
  }
54383
54444
  const tempDirectory = mkdtempSync(path5.join(tmpdir3(), "punks-baseline-"));
54384
54445
  const archivePath = path5.join(tempDirectory, assetArchiveName);
@@ -54408,7 +54469,10 @@ var materializeGitHubStableRelease = async ({
54408
54469
  const extractedMetadata = JSON.parse(readFileSync3(extractedMetadataPath, "utf8"));
54409
54470
  writeFileSync2(extractedMetadataPath, JSON.stringify({ ...extractedMetadata, sha256: archiveSha256 }, null, 2), "utf8");
54410
54471
  rmSync(tempDirectory, { recursive: true, force: true });
54411
- const baseline = loadBaselineFromDirectory(targetDirectory, "remote");
54472
+ const baseline = loadReusableCachedBaseline(targetDirectory);
54473
+ if (baseline === null) {
54474
+ throw new Error("Downloaded baseline failed validation.");
54475
+ }
54412
54476
  await submitArtifactPullTelemetry(baseline, cwd);
54413
54477
  return baseline;
54414
54478
  };
@@ -54461,16 +54525,14 @@ var resolveRemoteStableBaseline = async ({
54461
54525
  ...cwd === undefined ? {} : { cwd }
54462
54526
  });
54463
54527
  if (controlPlaneBaseline !== null) {
54464
- if (refresh) {
54465
- const stableTag = await resolveLatestStableReleaseTag(releasesUrl, timeoutMs);
54466
- if (stableTag !== null && stableVersionFromTag(stableTag) !== controlPlaneBaseline.summary.version) {
54467
- return resolveGitHubStableBaseline({
54468
- refresh,
54469
- timeoutMs,
54470
- releasesUrl,
54471
- ...cwd === undefined ? {} : { cwd }
54472
- });
54473
- }
54528
+ const stableTag = await resolveLatestStableReleaseTag(releasesUrl, timeoutMs);
54529
+ if (stableTag !== null && stableVersionFromTag(stableTag) !== controlPlaneBaseline.summary.version) {
54530
+ return resolveGitHubStableBaseline({
54531
+ refresh,
54532
+ timeoutMs,
54533
+ releasesUrl,
54534
+ ...cwd === undefined ? {} : { cwd }
54535
+ });
54474
54536
  }
54475
54537
  return controlPlaneBaseline;
54476
54538
  }
@@ -54990,7 +55052,7 @@ var requiredToolsForSkills = (skillIds, baseline = bundledBaseline) => [
54990
55052
  ].toSorted();
54991
55053
 
54992
55054
  // src/core/detect.ts
54993
- import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync } from "node:fs";
55055
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync } from "node:fs";
54994
55056
  import path6 from "node:path";
54995
55057
  var ignoredDirectoryNames = new Set([
54996
55058
  ".git",
@@ -55093,7 +55155,7 @@ var recursiveFindFiles = (cwd, filename) => {
55093
55155
  }
55094
55156
  }
55095
55157
  };
55096
- if (existsSync3(cwd)) {
55158
+ if (existsSync4(cwd)) {
55097
55159
  visit2(cwd);
55098
55160
  }
55099
55161
  return results.toSorted();
@@ -55101,7 +55163,7 @@ var recursiveFindFiles = (cwd, filename) => {
55101
55163
  var discoverPackageJsonPaths = (cwd) => {
55102
55164
  const rootPackageJsonPath = path6.join(cwd, "package.json");
55103
55165
  const recursivePackageJsonPaths = recursiveFindFiles(cwd, "package.json");
55104
- if (!existsSync3(rootPackageJsonPath)) {
55166
+ if (!existsSync4(rootPackageJsonPath)) {
55105
55167
  return recursivePackageJsonPaths;
55106
55168
  }
55107
55169
  const rootPackageJson = parsePackageJsonRecord(readFileSync4(rootPackageJsonPath, "utf8"));
@@ -55121,12 +55183,12 @@ var discoverPackageJsonPaths = (cwd) => {
55121
55183
  };
55122
55184
  var discoverConventionalWorkspacePackageJsonPaths = (cwd) => conventionalWorkspaceRoots.flatMap((rootDirectoryName) => {
55123
55185
  const rootDirectory = path6.join(cwd, rootDirectoryName);
55124
- if (!existsSync3(rootDirectory)) {
55186
+ if (!existsSync4(rootDirectory)) {
55125
55187
  return [];
55126
55188
  }
55127
- return readdirSync(rootDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(rootDirectory, entry.name, "package.json")).filter((manifestPath) => existsSync3(manifestPath));
55189
+ return readdirSync(rootDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(rootDirectory, entry.name, "package.json")).filter((manifestPath) => existsSync4(manifestPath));
55128
55190
  });
55129
- var discoverTopLevelPackageJsonPaths = (cwd) => readdirSync(cwd, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(cwd, entry.name, "package.json")).filter((manifestPath) => existsSync3(manifestPath));
55191
+ var discoverTopLevelPackageJsonPaths = (cwd) => readdirSync(cwd, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(cwd, entry.name, "package.json")).filter((manifestPath) => existsSync4(manifestPath));
55130
55192
  var readPackageJsonWorkspacePatterns = (pkg) => {
55131
55193
  const { workspaces } = pkg;
55132
55194
  if (exports_Array.isArray(workspaces)) {
@@ -55139,7 +55201,7 @@ var readPackageJsonWorkspacePatterns = (pkg) => {
55139
55201
  };
55140
55202
  var readPnpmWorkspacePatterns = (cwd) => {
55141
55203
  const workspacePath = path6.join(cwd, "pnpm-workspace.yaml");
55142
- if (!existsSync3(workspacePath)) {
55204
+ if (!existsSync4(workspacePath)) {
55143
55205
  return [];
55144
55206
  }
55145
55207
  const patterns = [];
@@ -55169,16 +55231,16 @@ var readPnpmWorkspacePatterns = (cwd) => {
55169
55231
  var expandWorkspacePattern = (cwd, pattern2) => {
55170
55232
  if (pattern2.endsWith("/*")) {
55171
55233
  const baseDirectory = path6.join(cwd, pattern2.slice(0, -2));
55172
- if (!existsSync3(baseDirectory)) {
55234
+ if (!existsSync4(baseDirectory)) {
55173
55235
  return [];
55174
55236
  }
55175
- return readdirSync(baseDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(baseDirectory, entry.name, "package.json")).filter((manifestPath2) => existsSync3(manifestPath2)).toSorted();
55237
+ return readdirSync(baseDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(baseDirectory, entry.name, "package.json")).filter((manifestPath2) => existsSync4(manifestPath2)).toSorted();
55176
55238
  }
55177
55239
  if (pattern2.includes("*")) {
55178
55240
  return [];
55179
55241
  }
55180
55242
  const manifestPath = path6.join(cwd, pattern2, "package.json");
55181
- return existsSync3(manifestPath) ? [manifestPath] : [];
55243
+ return existsSync4(manifestPath) ? [manifestPath] : [];
55182
55244
  };
55183
55245
  var detectTechnologies = (manifests) => {
55184
55246
  const packageNames = new Set(packDetectionManifests(manifests).flatMap((manifest) => manifest.dependencies));
@@ -55239,7 +55301,7 @@ var detectSourceLanguages = (cwd) => {
55239
55301
  }
55240
55302
  }
55241
55303
  };
55242
- if (existsSync3(cwd)) {
55304
+ if (existsSync4(cwd)) {
55243
55305
  visit2(cwd);
55244
55306
  }
55245
55307
  return languageDetectionOrder.filter((language) => detected.has(language));
@@ -55345,7 +55407,7 @@ import path8 from "node:path";
55345
55407
 
55346
55408
  // src/core/tools.ts
55347
55409
  import { execFileSync as execFileSync3 } from "node:child_process";
55348
- import { accessSync, constants as constants2, existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
55410
+ import { accessSync, constants as constants2, existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
55349
55411
  import { homedir } from "node:os";
55350
55412
  import path7 from "node:path";
55351
55413
  var repoSettingsFile = ".devpunks/settings.json";
@@ -55382,7 +55444,7 @@ var normalizeRepoSettings = (value6) => {
55382
55444
  };
55383
55445
  var readRepoSettings = (rootDirectory) => {
55384
55446
  const settingsPath = path7.join(rootDirectory, repoSettingsFile);
55385
- if (!existsSync4(settingsPath))
55447
+ if (!existsSync5(settingsPath))
55386
55448
  return null;
55387
55449
  return normalizeRepoSettings(JSON.parse(readFileSync5(settingsPath, "utf8")));
55388
55450
  };
@@ -55398,7 +55460,7 @@ var inferBacklogProviderFromWiki = (rootDirectory) => {
55398
55460
  const hints = new Set;
55399
55461
  for (const wikiRoot of wikiRoots) {
55400
55462
  const pinPath = path7.join(rootDirectory, wikiRoot, "backlog-provider.md");
55401
- if (!existsSync4(pinPath))
55463
+ if (!existsSync5(pinPath))
55402
55464
  continue;
55403
55465
  const content = readFileSync5(pinPath, "utf8");
55404
55466
  for (const provider of backlogProviders) {
@@ -55414,7 +55476,7 @@ var inferBacklogProviderFromWiki = (rootDirectory) => {
55414
55476
  };
55415
55477
  var inferRepositoryManagerFromGitConfig = (rootDirectory) => {
55416
55478
  const configPath = path7.join(rootDirectory, ".git/config");
55417
- if (!existsSync4(configPath))
55479
+ if (!existsSync5(configPath))
55418
55480
  return null;
55419
55481
  const content = readFileSync5(configPath, "utf8");
55420
55482
  if (content.includes("github.com"))
@@ -55840,7 +55902,7 @@ var formatResolvedPackSummary = (options9) => options9.optionalPacks.length ===
55840
55902
  `);
55841
55903
 
55842
55904
  // src/core/gitignore.ts
55843
- import { existsSync as existsSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
55905
+ import { existsSync as existsSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
55844
55906
  import path9 from "node:path";
55845
55907
  var harnessDirectories = new Set([".agents", ".claude", ".codex", ".cursor", ".opencode"]);
55846
55908
  var normalizeGitignorePattern = (line4) => {
@@ -55856,7 +55918,7 @@ var isHarnessDirectoryIgnore = (line4) => {
55856
55918
  };
55857
55919
  var removeHarnessDirectoriesFromGitignore = (rootDirectory) => {
55858
55920
  const gitignorePath = path9.join(rootDirectory, ".gitignore");
55859
- if (!existsSync5(gitignorePath)) {
55921
+ if (!existsSync6(gitignorePath)) {
55860
55922
  return { gitignorePath, removedPatterns: [] };
55861
55923
  }
55862
55924
  const original = readFileSync6(gitignorePath, "utf8");
@@ -55965,7 +56027,7 @@ var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(pac
55965
56027
  import { createHash as createHash2 } from "node:crypto";
55966
56028
  import {
55967
56029
  cpSync,
55968
- existsSync as existsSync6,
56030
+ existsSync as existsSync7,
55969
56031
  lstatSync,
55970
56032
  mkdirSync as mkdirSync4,
55971
56033
  readdirSync as readdirSync2,
@@ -56878,13 +56940,13 @@ var legacySkillDirectories = [
56878
56940
  ".opencode/skills"
56879
56941
  ];
56880
56942
  var nextAvailableSkillDirectory = (sharedSkillsDirectory, skillName, reservedSkillNames) => {
56881
- if (!reservedSkillNames.has(skillName) && !existsSync6(path10.join(sharedSkillsDirectory, skillName))) {
56943
+ if (!reservedSkillNames.has(skillName) && !existsSync7(path10.join(sharedSkillsDirectory, skillName))) {
56882
56944
  return skillName;
56883
56945
  }
56884
56946
  let suffix = 1;
56885
56947
  while (true) {
56886
56948
  const candidate = suffix === 1 ? `${skillName}-local` : `${skillName}-local-${suffix}`;
56887
- if (!reservedSkillNames.has(candidate) && !existsSync6(path10.join(sharedSkillsDirectory, candidate))) {
56949
+ if (!reservedSkillNames.has(candidate) && !existsSync7(path10.join(sharedSkillsDirectory, candidate))) {
56888
56950
  return candidate;
56889
56951
  }
56890
56952
  suffix += 1;
@@ -56899,7 +56961,7 @@ var migrateLegacySkillDirectories = ({
56899
56961
  mkdirSync4(sharedSkillsDirectory, { recursive: true });
56900
56962
  for (const relativeDirectory of legacySkillDirectories) {
56901
56963
  const absoluteDirectory = path10.join(outputDirectory, relativeDirectory);
56902
- if (!existsSync6(absoluteDirectory)) {
56964
+ if (!existsSync7(absoluteDirectory)) {
56903
56965
  continue;
56904
56966
  }
56905
56967
  const stat3 = lstatSync(absoluteDirectory);
@@ -56924,7 +56986,7 @@ var selectedHookIds = (finalPacks, baseline) => uniqueSorted([
56924
56986
  ...finalPacks.flatMap((packId) => hooksForPack(packId, baseline))
56925
56987
  ]);
56926
56988
  var oxlintConfigCandidates = ["oxlint.config.ts", ".oxlintrc.json", ".oxlintrc.jsonc"];
56927
- var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync6(path10.join(scanDirectory, candidate)));
56989
+ var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync7(path10.join(scanDirectory, candidate)));
56928
56990
  var oxlintStarterConfig = {
56929
56991
  extends: ["ultracite/oxlint/core"],
56930
56992
  configFile: "oxlint.config.ts"
@@ -56994,11 +57056,11 @@ var sourceOrOutputPath = ({
56994
57056
  relativePath
56995
57057
  }) => {
56996
57058
  const outputPath = path10.join(outputDirectory, relativePath);
56997
- if (existsSync6(outputPath)) {
57059
+ if (existsSync7(outputPath)) {
56998
57060
  return outputPath;
56999
57061
  }
57000
57062
  const sourcePath = path10.join(scanDirectory, relativePath);
57001
- return existsSync6(sourcePath) ? sourcePath : null;
57063
+ return existsSync7(sourcePath) ? sourcePath : null;
57002
57064
  };
57003
57065
  var ensureStringArray = (value6) => Array.isArray(value6) ? value6.filter((entry) => typeof entry === "string") : [];
57004
57066
  var ensureStringOrStringArray = (value6) => {
@@ -57167,11 +57229,52 @@ var existingJsonOxlintConfigPath = ({
57167
57229
  };
57168
57230
  var hasRootDocsContent = (scanDirectory) => {
57169
57231
  const docsDirectory = path10.join(scanDirectory, "docs");
57170
- if (!existsSync6(docsDirectory)) {
57232
+ if (!existsSync7(docsDirectory)) {
57171
57233
  return false;
57172
57234
  }
57173
57235
  return readdirSync2(docsDirectory).some((entry) => entry !== "AGENTS.md");
57174
57236
  };
57237
+ var ignoredPromptTargetDirectories = new Set([
57238
+ ".git",
57239
+ ".agents",
57240
+ ".claude",
57241
+ ".codex",
57242
+ ".cursor",
57243
+ ".devpunks",
57244
+ ".devpunks-cache",
57245
+ ".next",
57246
+ ".opencode",
57247
+ ".source",
57248
+ ".turbo",
57249
+ "build",
57250
+ "coverage",
57251
+ "dist",
57252
+ "node_modules",
57253
+ "opensrc",
57254
+ "skills",
57255
+ "tmp",
57256
+ "worktrees"
57257
+ ]);
57258
+ var discoverAuthoredAgentPromptTargets = (scanDirectory) => {
57259
+ const targets = [];
57260
+ const visit2 = (directory3) => {
57261
+ for (const entry of readdirSync2(directory3, { withFileTypes: true })) {
57262
+ if (entry.isDirectory()) {
57263
+ if (!ignoredPromptTargetDirectories.has(entry.name)) {
57264
+ visit2(path10.join(directory3, entry.name));
57265
+ }
57266
+ continue;
57267
+ }
57268
+ if (entry.isFile() && entry.name === "AGENTS.md") {
57269
+ targets.push(relativePosixPath(scanDirectory, path10.join(directory3, entry.name)));
57270
+ }
57271
+ }
57272
+ };
57273
+ if (existsSync7(scanDirectory)) {
57274
+ visit2(scanDirectory);
57275
+ }
57276
+ return targets.toSorted();
57277
+ };
57175
57278
  var hasJavaScriptWorkspaceDependency = (manifest) => manifest.dependencies.some((dependency) => dependency === "next" || dependency === "react" || dependency === "react-dom" || dependency === "typescript" || dependency === "vite" || dependency.startsWith("@effect/") || dependency.startsWith("@tanstack/") || dependency.startsWith("@trpc/"));
57176
57279
  var isPythonUvWorkspace = ({
57177
57280
  scanDirectory,
@@ -57423,7 +57526,7 @@ var buildPromptSpec = ({
57423
57526
  baseline
57424
57527
  }) => {
57425
57528
  const sourcePath = path10.join(scanDirectory, relativePath);
57426
- const source = existsSync6(sourcePath) ? "copied" : "generated";
57529
+ const source = existsSync7(sourcePath) ? "copied" : "generated";
57427
57530
  const workspacePath = relativePath === ".agents/AGENTS.md" ? ".agents" : relativePath === "AGENTS.md" ? "." : relativePath === "docs/AGENTS.md" ? "docs" : path10.dirname(relativePath);
57428
57531
  const packs = packsForWorkspace({
57429
57532
  relativeWorkspacePath: workspacePath,
@@ -57506,7 +57609,7 @@ var resolvePromptContent = ({
57506
57609
  preserveExistingManagedFiles
57507
57610
  }) => {
57508
57611
  const sourcePath = path10.join(scanDirectory, relativePath);
57509
- if (preserveExistingManagedFiles && existsSync6(sourcePath)) {
57612
+ if (preserveExistingManagedFiles && existsSync7(sourcePath)) {
57510
57613
  return readFileSync7(sourcePath, "utf8");
57511
57614
  }
57512
57615
  if (relativePath === ".agents/AGENTS.md") {
@@ -57541,7 +57644,7 @@ var resolvePromptContent = ({
57541
57644
  };
57542
57645
  var collectRelativeFiles = (outputDirectory, relativeDirectory) => {
57543
57646
  const absoluteDirectory = path10.join(outputDirectory, relativeDirectory);
57544
- if (!existsSync6(absoluteDirectory)) {
57647
+ if (!existsSync7(absoluteDirectory)) {
57545
57648
  return [];
57546
57649
  }
57547
57650
  const files = [];
@@ -57604,7 +57707,7 @@ var expandManagedFiles = (outputDirectory, relativePaths) => {
57604
57707
  const files = new Set;
57605
57708
  for (const relativePath of relativePaths) {
57606
57709
  const absolutePath = path10.join(outputDirectory, relativePath);
57607
- if (!existsSync6(absolutePath)) {
57710
+ if (!existsSync7(absolutePath)) {
57608
57711
  continue;
57609
57712
  }
57610
57713
  const stat3 = lstatSync(absolutePath);
@@ -57630,27 +57733,34 @@ var expandManagedFiles = (outputDirectory, relativePaths) => {
57630
57733
  });
57631
57734
  };
57632
57735
  var promptTargetsForDetection = (scanDirectory, detection) => {
57633
- const targets = [
57634
- { relativePath: ".agents/AGENTS.md", manifest: null },
57635
- { relativePath: "AGENTS.md", manifest: null }
57636
- ];
57637
- if (hasRootDocsContent(scanDirectory)) {
57638
- targets.push({ relativePath: "docs/AGENTS.md", manifest: null });
57639
- }
57640
- if (!detection.monorepo) {
57641
- return targets;
57642
- }
57643
- for (const manifest of detection.manifests) {
57644
- const relativeManifestPath = relativePosixPath(scanDirectory, manifest.path);
57645
- if (relativeManifestPath === "package.json") {
57646
- continue;
57736
+ const targets = new Map;
57737
+ const setTarget = (target) => {
57738
+ const existing = targets.get(target.relativePath);
57739
+ if (existing === undefined || existing.manifest === null && target.manifest !== null) {
57740
+ targets.set(target.relativePath, target);
57741
+ }
57742
+ };
57743
+ setTarget({ relativePath: ".agents/AGENTS.md", manifest: null });
57744
+ setTarget({ relativePath: "AGENTS.md", manifest: null });
57745
+ if (hasRootDocsContent(scanDirectory) || existsSync7(path10.join(scanDirectory, "docs/AGENTS.md"))) {
57746
+ setTarget({ relativePath: "docs/AGENTS.md", manifest: null });
57747
+ }
57748
+ for (const relativePath of discoverAuthoredAgentPromptTargets(scanDirectory)) {
57749
+ setTarget({ relativePath, manifest: null });
57750
+ }
57751
+ if (detection.monorepo) {
57752
+ for (const manifest of detection.manifests) {
57753
+ const relativeManifestPath = relativePosixPath(scanDirectory, manifest.path);
57754
+ if (relativeManifestPath === "package.json") {
57755
+ continue;
57756
+ }
57757
+ setTarget({
57758
+ relativePath: path10.posix.join(path10.posix.dirname(relativeManifestPath), "AGENTS.md"),
57759
+ manifest
57760
+ });
57647
57761
  }
57648
- targets.push({
57649
- relativePath: path10.posix.join(path10.posix.dirname(relativeManifestPath), "AGENTS.md"),
57650
- manifest
57651
- });
57652
57762
  }
57653
- return targets;
57763
+ return [...targets.values()].toSorted((left3, right3) => left3.relativePath.localeCompare(right3.relativePath));
57654
57764
  };
57655
57765
  var writeScaffoldOutput = ({
57656
57766
  scanDirectory,
@@ -57843,7 +57953,7 @@ var writeScaffoldOutput = ({
57843
57953
  generatedFiles.push(writeArtifact({
57844
57954
  outputDirectory,
57845
57955
  relativePath: ".agents/subagents/manifest.mjs",
57846
- content: shouldPreserveExistingManagedFiles && existsSync6(sourceManifestPath) ? readFileSync7(sourceManifestPath, "utf8") : renderSubagentManifestModule({
57956
+ content: shouldPreserveExistingManagedFiles && existsSync7(sourceManifestPath) ? readFileSync7(sourceManifestPath, "utf8") : renderSubagentManifestModule({
57847
57957
  spec: subagentManifestSpec,
57848
57958
  baseline,
57849
57959
  fallback: defaultSubagentManifestTemplate
@@ -57863,7 +57973,7 @@ var writeScaffoldOutput = ({
57863
57973
  cwd: outputDirectory
57864
57974
  });
57865
57975
  harnessFiles.push(...collectRelativeFiles(outputDirectory, ".claude"), ...collectRelativeFiles(outputDirectory, ".codex"), ...collectRelativeFiles(outputDirectory, ".cursor"), ...collectRelativeFiles(outputDirectory, ".opencode"));
57866
- if (existsSync6(path10.join(outputDirectory, "opencode.json"))) {
57976
+ if (existsSync7(path10.join(outputDirectory, "opencode.json"))) {
57867
57977
  harnessFiles.push("opencode.json");
57868
57978
  }
57869
57979
  generatedFiles.push(...harnessFiles);
@@ -58303,7 +58413,7 @@ var runScaffold = ({
58303
58413
  // src/scaffold/stage.ts
58304
58414
  import {
58305
58415
  cpSync as cpSync2,
58306
- existsSync as existsSync7,
58416
+ existsSync as existsSync8,
58307
58417
  statSync as statSync2,
58308
58418
  mkdirSync as mkdirSync6,
58309
58419
  readFileSync as readFileSync8,
@@ -60051,20 +60161,20 @@ var writeMissingFile = ({
60051
60161
  targetPath,
60052
60162
  content
60053
60163
  }) => {
60054
- if (existsSync7(targetPath)) {
60164
+ if (existsSync8(targetPath)) {
60055
60165
  return null;
60056
60166
  }
60057
60167
  mkdirSync6(path12.dirname(targetPath), { recursive: true });
60058
60168
  writeFileSync7(targetPath, content);
60059
60169
  return relativePosixPath2(outputDirectory, targetPath);
60060
60170
  };
60061
- var directoryHasEntries = (directoryPath) => existsSync7(directoryPath) && readdirSync3(directoryPath).some((entry) => !entry.startsWith("."));
60171
+ var directoryHasEntries = (directoryPath) => existsSync8(directoryPath) && readdirSync3(directoryPath).some((entry) => !entry.startsWith("."));
60062
60172
  var writeManagedFile = ({
60063
60173
  outputDirectory,
60064
60174
  targetPath,
60065
60175
  content
60066
60176
  }) => {
60067
- if (existsSync7(targetPath) && readFileSync8(targetPath, "utf8") === content) {
60177
+ if (existsSync8(targetPath) && readFileSync8(targetPath, "utf8") === content) {
60068
60178
  return null;
60069
60179
  }
60070
60180
  mkdirSync6(path12.dirname(targetPath), { recursive: true });
@@ -60120,7 +60230,7 @@ var updateExistingWikiPackage = ({
60120
60230
  packagePath,
60121
60231
  wikiFramework
60122
60232
  }) => {
60123
- if (!existsSync7(packagePath))
60233
+ if (!existsSync8(packagePath))
60124
60234
  return null;
60125
60235
  const packageJson = JSON.parse(readFileSync8(packagePath, "utf8"));
60126
60236
  const scripts = packageJson.scripts;
@@ -60167,7 +60277,7 @@ var updateExistingTanstackViteConfig = ({
60167
60277
  outputDirectory,
60168
60278
  viteConfigPath
60169
60279
  }) => {
60170
- if (!existsSync7(viteConfigPath))
60280
+ if (!existsSync8(viteConfigPath))
60171
60281
  return null;
60172
60282
  const content = readFileSync8(viteConfigPath, "utf8");
60173
60283
  const nextContent = content.replace(/preset:\s*["']vercel["']/u, 'preset: "node-server"').replace(/preset:\s*["']node["']/u, 'preset: "node-server"');
@@ -60181,7 +60291,7 @@ var updateExistingWikiGitignore = ({
60181
60291
  gitignorePath,
60182
60292
  expectedContent
60183
60293
  }) => {
60184
- if (expectedContent === undefined || !existsSync7(gitignorePath))
60294
+ if (expectedContent === undefined || !existsSync8(gitignorePath))
60185
60295
  return null;
60186
60296
  const content = readFileSync8(gitignorePath, "utf8");
60187
60297
  const existingLines = new Set(content.split(/\r?\n/u).map((line4) => line4.trim()).filter(Boolean));
@@ -60196,7 +60306,7 @@ var updateExistingWikiGitignore = ({
60196
60306
  `);
60197
60307
  return relativePosixPath2(outputDirectory, gitignorePath);
60198
60308
  };
60199
- var hasFlatRoutePage = (directoryPath) => existsSync7(`${directoryPath}.md`) || existsSync7(`${directoryPath}.mdx`);
60309
+ var hasFlatRoutePage = (directoryPath) => existsSync8(`${directoryPath}.md`) || existsSync8(`${directoryPath}.mdx`);
60200
60310
  var isNestedRouteSeedBlockedByFlatPage = ({
60201
60311
  wikiDirectory,
60202
60312
  filePath
@@ -60295,7 +60405,7 @@ var scaffoldWiki = ({
60295
60405
  createdFiles.push(agentsFile);
60296
60406
  }
60297
60407
  const claudePath = path12.join(wikiDirectory, "CLAUDE.md");
60298
- if (!existsSync7(claudePath)) {
60408
+ if (!existsSync8(claudePath)) {
60299
60409
  symlinkSync("AGENTS.md", claudePath);
60300
60410
  createdFiles.push(relativePosixPath2(outputDirectory, claudePath));
60301
60411
  }
@@ -60365,10 +60475,10 @@ var isDirectory = (directoryPath) => {
60365
60475
  return false;
60366
60476
  }
60367
60477
  };
60368
- var hasWikiRootMarkers = (directoryPath) => wikiRootMarkerFiles.some((marker) => existsSync7(path12.join(directoryPath, marker)));
60478
+ var hasWikiRootMarkers = (directoryPath) => wikiRootMarkerFiles.some((marker) => existsSync8(path12.join(directoryPath, marker)));
60369
60479
  var hasRootWorkspaces = (outputDirectory) => {
60370
60480
  const packagePath = path12.join(outputDirectory, "package.json");
60371
- if (!existsSync7(packagePath))
60481
+ if (!existsSync8(packagePath))
60372
60482
  return false;
60373
60483
  try {
60374
60484
  const packageJson = JSON.parse(readFileSync8(packagePath, "utf8"));
@@ -60377,7 +60487,7 @@ var hasRootWorkspaces = (outputDirectory) => {
60377
60487
  return false;
60378
60488
  }
60379
60489
  };
60380
- var hasRootMonorepoSignals = (outputDirectory) => existsSync7(path12.join(outputDirectory, "pnpm-workspace.yaml")) || existsSync7(path12.join(outputDirectory, "turbo.json")) || hasRootWorkspaces(outputDirectory);
60490
+ var hasRootMonorepoSignals = (outputDirectory) => existsSync8(path12.join(outputDirectory, "pnpm-workspace.yaml")) || existsSync8(path12.join(outputDirectory, "turbo.json")) || hasRootWorkspaces(outputDirectory);
60381
60491
  var hasAppPackageSurfaces = (outputDirectory) => {
60382
60492
  if (hasRootMonorepoSignals(outputDirectory)) {
60383
60493
  return false;
@@ -60385,7 +60495,7 @@ var hasAppPackageSurfaces = (outputDirectory) => {
60385
60495
  const appDirectory = path12.join(outputDirectory, "app");
60386
60496
  if (!isDirectory(appDirectory))
60387
60497
  return false;
60388
- return readdirSync3(appDirectory, { withFileTypes: true }).some((entry) => entry.isDirectory() && existsSync7(path12.join(appDirectory, entry.name, "package.json")));
60498
+ return readdirSync3(appDirectory, { withFileTypes: true }).some((entry) => entry.isDirectory() && existsSync8(path12.join(appDirectory, entry.name, "package.json")));
60389
60499
  };
60390
60500
  var stageWikiTarget = ({
60391
60501
  outputDirectory,
@@ -60643,7 +60753,7 @@ import path16 from "node:path";
60643
60753
  import { createHash as createHash3 } from "node:crypto";
60644
60754
  import {
60645
60755
  cpSync as cpSync3,
60646
- existsSync as existsSync8,
60756
+ existsSync as existsSync9,
60647
60757
  lstatSync as lstatSync2,
60648
60758
  mkdirSync as mkdirSync7,
60649
60759
  mkdtempSync as mkdtempSync2,
@@ -60656,917 +60766,6 @@ import {
60656
60766
  } from "node:fs";
60657
60767
  import { tmpdir as tmpdir4 } from "node:os";
60658
60768
  import path15 from "node:path";
60659
-
60660
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/base.js
60661
- class Diff {
60662
- diff(oldStr, newStr, options9 = {}) {
60663
- let callback;
60664
- if (typeof options9 === "function") {
60665
- callback = options9;
60666
- options9 = {};
60667
- } else if ("callback" in options9) {
60668
- callback = options9.callback;
60669
- }
60670
- const oldString = this.castInput(oldStr, options9);
60671
- const newString = this.castInput(newStr, options9);
60672
- const oldTokens = this.removeEmpty(this.tokenize(oldString, options9));
60673
- const newTokens = this.removeEmpty(this.tokenize(newString, options9));
60674
- return this.diffWithOptionsObj(oldTokens, newTokens, options9, callback);
60675
- }
60676
- diffWithOptionsObj(oldTokens, newTokens, options9, callback) {
60677
- var _a;
60678
- const done9 = (value6) => {
60679
- value6 = this.postProcess(value6, options9);
60680
- if (callback) {
60681
- setTimeout(function() {
60682
- callback(value6);
60683
- }, 0);
60684
- return;
60685
- } else {
60686
- return value6;
60687
- }
60688
- };
60689
- const newLen = newTokens.length, oldLen = oldTokens.length;
60690
- let editLength = 1;
60691
- let maxEditLength = newLen + oldLen;
60692
- if (options9.maxEditLength != null) {
60693
- maxEditLength = Math.min(maxEditLength, options9.maxEditLength);
60694
- }
60695
- const maxExecutionTime = (_a = options9.timeout) !== null && _a !== undefined ? _a : Infinity;
60696
- const abortAfterTimestamp = Date.now() + maxExecutionTime;
60697
- const bestPath = [{ oldPos: -1, lastComponent: undefined }];
60698
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options9);
60699
- if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
60700
- return done9(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
60701
- }
60702
- let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
60703
- const execEditLength = () => {
60704
- for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength);diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
60705
- let basePath;
60706
- const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
60707
- if (removePath) {
60708
- bestPath[diagonalPath - 1] = undefined;
60709
- }
60710
- let canAdd = false;
60711
- if (addPath) {
60712
- const addPathNewPos = addPath.oldPos - diagonalPath;
60713
- canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
60714
- }
60715
- const canRemove = removePath && removePath.oldPos + 1 < oldLen;
60716
- if (!canAdd && !canRemove) {
60717
- bestPath[diagonalPath] = undefined;
60718
- continue;
60719
- }
60720
- if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
60721
- basePath = this.addToPath(addPath, true, false, 0, options9);
60722
- } else {
60723
- basePath = this.addToPath(removePath, false, true, 1, options9);
60724
- }
60725
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9);
60726
- if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
60727
- return done9(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
60728
- } else {
60729
- bestPath[diagonalPath] = basePath;
60730
- if (basePath.oldPos + 1 >= oldLen) {
60731
- maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
60732
- }
60733
- if (newPos + 1 >= newLen) {
60734
- minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
60735
- }
60736
- }
60737
- }
60738
- editLength++;
60739
- };
60740
- if (callback) {
60741
- (function exec() {
60742
- setTimeout(function() {
60743
- if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
60744
- return callback(undefined);
60745
- }
60746
- if (!execEditLength()) {
60747
- exec();
60748
- }
60749
- }, 0);
60750
- })();
60751
- } else {
60752
- while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
60753
- const ret = execEditLength();
60754
- if (ret) {
60755
- return ret;
60756
- }
60757
- }
60758
- }
60759
- }
60760
- addToPath(path15, added, removed, oldPosInc, options9) {
60761
- const last5 = path15.lastComponent;
60762
- if (last5 && !options9.oneChangePerToken && last5.added === added && last5.removed === removed) {
60763
- return {
60764
- oldPos: path15.oldPos + oldPosInc,
60765
- lastComponent: { count: last5.count + 1, added, removed, previousComponent: last5.previousComponent }
60766
- };
60767
- } else {
60768
- return {
60769
- oldPos: path15.oldPos + oldPosInc,
60770
- lastComponent: { count: 1, added, removed, previousComponent: last5 }
60771
- };
60772
- }
60773
- }
60774
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9) {
60775
- const newLen = newTokens.length, oldLen = oldTokens.length;
60776
- let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
60777
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options9)) {
60778
- newPos++;
60779
- oldPos++;
60780
- commonCount++;
60781
- if (options9.oneChangePerToken) {
60782
- basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
60783
- }
60784
- }
60785
- if (commonCount && !options9.oneChangePerToken) {
60786
- basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
60787
- }
60788
- basePath.oldPos = oldPos;
60789
- return newPos;
60790
- }
60791
- equals(left3, right3, options9) {
60792
- if (options9.comparator) {
60793
- return options9.comparator(left3, right3);
60794
- } else {
60795
- return left3 === right3 || !!options9.ignoreCase && left3.toLowerCase() === right3.toLowerCase();
60796
- }
60797
- }
60798
- removeEmpty(array9) {
60799
- const ret = [];
60800
- for (let i = 0;i < array9.length; i++) {
60801
- if (array9[i]) {
60802
- ret.push(array9[i]);
60803
- }
60804
- }
60805
- return ret;
60806
- }
60807
- castInput(value6, options9) {
60808
- return value6;
60809
- }
60810
- tokenize(value6, options9) {
60811
- return Array.from(value6);
60812
- }
60813
- join(chars) {
60814
- return chars.join("");
60815
- }
60816
- postProcess(changeObjects, options9) {
60817
- return changeObjects;
60818
- }
60819
- get useLongestToken() {
60820
- return false;
60821
- }
60822
- buildValues(lastComponent, newTokens, oldTokens) {
60823
- const components = [];
60824
- let nextComponent;
60825
- while (lastComponent) {
60826
- components.push(lastComponent);
60827
- nextComponent = lastComponent.previousComponent;
60828
- delete lastComponent.previousComponent;
60829
- lastComponent = nextComponent;
60830
- }
60831
- components.reverse();
60832
- const componentLen = components.length;
60833
- let componentPos = 0, newPos = 0, oldPos = 0;
60834
- for (;componentPos < componentLen; componentPos++) {
60835
- const component = components[componentPos];
60836
- if (!component.removed) {
60837
- if (!component.added && this.useLongestToken) {
60838
- let value6 = newTokens.slice(newPos, newPos + component.count);
60839
- value6 = value6.map(function(value7, i) {
60840
- const oldValue = oldTokens[oldPos + i];
60841
- return oldValue.length > value7.length ? oldValue : value7;
60842
- });
60843
- component.value = this.join(value6);
60844
- } else {
60845
- component.value = this.join(newTokens.slice(newPos, newPos + component.count));
60846
- }
60847
- newPos += component.count;
60848
- if (!component.added) {
60849
- oldPos += component.count;
60850
- }
60851
- } else {
60852
- component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
60853
- oldPos += component.count;
60854
- }
60855
- }
60856
- return components;
60857
- }
60858
- }
60859
-
60860
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/character.js
60861
- class CharacterDiff extends Diff {
60862
- }
60863
- var characterDiff = new CharacterDiff;
60864
-
60865
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/util/string.js
60866
- function longestCommonPrefix(str1, str2) {
60867
- let i;
60868
- for (i = 0;i < str1.length && i < str2.length; i++) {
60869
- if (str1[i] != str2[i]) {
60870
- return str1.slice(0, i);
60871
- }
60872
- }
60873
- return str1.slice(0, i);
60874
- }
60875
- function longestCommonSuffix(str1, str2) {
60876
- let i;
60877
- if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
60878
- return "";
60879
- }
60880
- for (i = 0;i < str1.length && i < str2.length; i++) {
60881
- if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
60882
- return str1.slice(-i);
60883
- }
60884
- }
60885
- return str1.slice(-i);
60886
- }
60887
- function replacePrefix(string8, oldPrefix, newPrefix) {
60888
- if (string8.slice(0, oldPrefix.length) != oldPrefix) {
60889
- throw Error(`string ${JSON.stringify(string8)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
60890
- }
60891
- return newPrefix + string8.slice(oldPrefix.length);
60892
- }
60893
- function replaceSuffix(string8, oldSuffix, newSuffix) {
60894
- if (!oldSuffix) {
60895
- return string8 + newSuffix;
60896
- }
60897
- if (string8.slice(-oldSuffix.length) != oldSuffix) {
60898
- throw Error(`string ${JSON.stringify(string8)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
60899
- }
60900
- return string8.slice(0, -oldSuffix.length) + newSuffix;
60901
- }
60902
- function removePrefix(string8, oldPrefix) {
60903
- return replacePrefix(string8, oldPrefix, "");
60904
- }
60905
- function removeSuffix(string8, oldSuffix) {
60906
- return replaceSuffix(string8, oldSuffix, "");
60907
- }
60908
- function maximumOverlap(string1, string22) {
60909
- return string22.slice(0, overlapCount(string1, string22));
60910
- }
60911
- function overlapCount(a, b) {
60912
- let startA = 0;
60913
- if (a.length > b.length) {
60914
- startA = a.length - b.length;
60915
- }
60916
- let endB = b.length;
60917
- if (a.length < b.length) {
60918
- endB = a.length;
60919
- }
60920
- const map36 = Array(endB);
60921
- let k = 0;
60922
- map36[0] = 0;
60923
- for (let j = 1;j < endB; j++) {
60924
- if (b[j] == b[k]) {
60925
- map36[j] = map36[k];
60926
- } else {
60927
- map36[j] = k;
60928
- }
60929
- while (k > 0 && b[j] != b[k]) {
60930
- k = map36[k];
60931
- }
60932
- if (b[j] == b[k]) {
60933
- k++;
60934
- }
60935
- }
60936
- k = 0;
60937
- for (let i = startA;i < a.length; i++) {
60938
- while (k > 0 && a[i] != b[k]) {
60939
- k = map36[k];
60940
- }
60941
- if (a[i] == b[k]) {
60942
- k++;
60943
- }
60944
- }
60945
- return k;
60946
- }
60947
- function segment(string8, segmenter) {
60948
- const parts2 = [];
60949
- for (const segmentObj of Array.from(segmenter.segment(string8))) {
60950
- const segment2 = segmentObj.segment;
60951
- if (parts2.length && /\s/.test(parts2[parts2.length - 1]) && /\s/.test(segment2)) {
60952
- parts2[parts2.length - 1] += segment2;
60953
- } else {
60954
- parts2.push(segment2);
60955
- }
60956
- }
60957
- return parts2;
60958
- }
60959
- function trailingWs(string8, segmenter) {
60960
- if (segmenter) {
60961
- return leadingAndTrailingWs(string8, segmenter)[1];
60962
- }
60963
- let i;
60964
- for (i = string8.length - 1;i >= 0; i--) {
60965
- if (!string8[i].match(/\s/)) {
60966
- break;
60967
- }
60968
- }
60969
- return string8.substring(i + 1);
60970
- }
60971
- function leadingWs(string8, segmenter) {
60972
- if (segmenter) {
60973
- return leadingAndTrailingWs(string8, segmenter)[0];
60974
- }
60975
- const match19 = string8.match(/^\s*/);
60976
- return match19 ? match19[0] : "";
60977
- }
60978
- function leadingAndTrailingWs(string8, segmenter) {
60979
- if (!segmenter) {
60980
- return [leadingWs(string8), trailingWs(string8)];
60981
- }
60982
- if (segmenter.resolvedOptions().granularity != "word") {
60983
- throw new Error('The segmenter passed must have a granularity of "word"');
60984
- }
60985
- const segments = segment(string8, segmenter);
60986
- const firstSeg = segments[0];
60987
- const lastSeg = segments[segments.length - 1];
60988
- const head13 = /\s/.test(firstSeg) ? firstSeg : "";
60989
- const tail2 = /\s/.test(lastSeg) ? lastSeg : "";
60990
- return [head13, tail2];
60991
- }
60992
-
60993
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/word.js
60994
- 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}";
60995
- var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
60996
-
60997
- class WordDiff extends Diff {
60998
- equals(left3, right3, options9) {
60999
- if (options9.ignoreCase) {
61000
- left3 = left3.toLowerCase();
61001
- right3 = right3.toLowerCase();
61002
- }
61003
- return left3.trim() === right3.trim();
61004
- }
61005
- tokenize(value6, options9 = {}) {
61006
- let parts2;
61007
- if (options9.intlSegmenter) {
61008
- const segmenter = options9.intlSegmenter;
61009
- if (segmenter.resolvedOptions().granularity != "word") {
61010
- throw new Error('The segmenter passed must have a granularity of "word"');
61011
- }
61012
- parts2 = segment(value6, segmenter);
61013
- } else {
61014
- parts2 = value6.match(tokenizeIncludingWhitespace) || [];
61015
- }
61016
- const tokens = [];
61017
- let prevPart = null;
61018
- parts2.forEach((part) => {
61019
- if (/\s/.test(part)) {
61020
- if (prevPart == null) {
61021
- tokens.push(part);
61022
- } else {
61023
- tokens.push(tokens.pop() + part);
61024
- }
61025
- } else if (prevPart != null && /\s/.test(prevPart)) {
61026
- if (tokens[tokens.length - 1] == prevPart) {
61027
- tokens.push(tokens.pop() + part);
61028
- } else {
61029
- tokens.push(prevPart + part);
61030
- }
61031
- } else {
61032
- tokens.push(part);
61033
- }
61034
- prevPart = part;
61035
- });
61036
- return tokens;
61037
- }
61038
- join(tokens) {
61039
- return tokens.map((token, i) => {
61040
- if (i == 0) {
61041
- return token;
61042
- } else {
61043
- return token.replace(/^\s+/, "");
61044
- }
61045
- }).join("");
61046
- }
61047
- postProcess(changes2, options9) {
61048
- if (!changes2 || options9.oneChangePerToken) {
61049
- return changes2;
61050
- }
61051
- let lastKeep = null;
61052
- let insertion = null;
61053
- let deletion = null;
61054
- changes2.forEach((change) => {
61055
- if (change.added) {
61056
- insertion = change;
61057
- } else if (change.removed) {
61058
- deletion = change;
61059
- } else {
61060
- if (insertion || deletion) {
61061
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options9.intlSegmenter);
61062
- }
61063
- lastKeep = change;
61064
- insertion = null;
61065
- deletion = null;
61066
- }
61067
- });
61068
- if (insertion || deletion) {
61069
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options9.intlSegmenter);
61070
- }
61071
- return changes2;
61072
- }
61073
- }
61074
- var wordDiff = new WordDiff;
61075
- function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep, segmenter) {
61076
- if (deletion && insertion) {
61077
- const [oldWsPrefix, oldWsSuffix] = leadingAndTrailingWs(deletion.value, segmenter);
61078
- const [newWsPrefix, newWsSuffix] = leadingAndTrailingWs(insertion.value, segmenter);
61079
- if (startKeep) {
61080
- const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
61081
- startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
61082
- deletion.value = removePrefix(deletion.value, commonWsPrefix);
61083
- insertion.value = removePrefix(insertion.value, commonWsPrefix);
61084
- }
61085
- if (endKeep) {
61086
- const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
61087
- endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
61088
- deletion.value = removeSuffix(deletion.value, commonWsSuffix);
61089
- insertion.value = removeSuffix(insertion.value, commonWsSuffix);
61090
- }
61091
- } else if (insertion) {
61092
- if (startKeep) {
61093
- const ws = leadingWs(insertion.value, segmenter);
61094
- insertion.value = insertion.value.substring(ws.length);
61095
- }
61096
- if (endKeep) {
61097
- const ws = leadingWs(endKeep.value, segmenter);
61098
- endKeep.value = endKeep.value.substring(ws.length);
61099
- }
61100
- } else if (startKeep && endKeep) {
61101
- const newWsFull = leadingWs(endKeep.value, segmenter), [delWsStart, delWsEnd] = leadingAndTrailingWs(deletion.value, segmenter);
61102
- const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
61103
- deletion.value = removePrefix(deletion.value, newWsStart);
61104
- const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
61105
- deletion.value = removeSuffix(deletion.value, newWsEnd);
61106
- endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
61107
- startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
61108
- } else if (endKeep) {
61109
- const endKeepWsPrefix = leadingWs(endKeep.value, segmenter);
61110
- const deletionWsSuffix = trailingWs(deletion.value, segmenter);
61111
- const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
61112
- deletion.value = removeSuffix(deletion.value, overlap);
61113
- } else if (startKeep) {
61114
- const startKeepWsSuffix = trailingWs(startKeep.value, segmenter);
61115
- const deletionWsPrefix = leadingWs(deletion.value, segmenter);
61116
- const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
61117
- deletion.value = removePrefix(deletion.value, overlap);
61118
- }
61119
- }
61120
-
61121
- class WordsWithSpaceDiff extends Diff {
61122
- tokenize(value6) {
61123
- const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
61124
- return value6.match(regex) || [];
61125
- }
61126
- }
61127
- var wordsWithSpaceDiff = new WordsWithSpaceDiff;
61128
-
61129
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/line.js
61130
- class LineDiff extends Diff {
61131
- constructor() {
61132
- super(...arguments);
61133
- this.tokenize = tokenize;
61134
- }
61135
- equals(left3, right3, options9) {
61136
- if (options9.ignoreWhitespace) {
61137
- if (!options9.newlineIsToken || !left3.includes(`
61138
- `)) {
61139
- left3 = left3.trim();
61140
- }
61141
- if (!options9.newlineIsToken || !right3.includes(`
61142
- `)) {
61143
- right3 = right3.trim();
61144
- }
61145
- } else if (options9.ignoreNewlineAtEof && !options9.newlineIsToken) {
61146
- if (left3.endsWith(`
61147
- `)) {
61148
- left3 = left3.slice(0, -1);
61149
- }
61150
- if (right3.endsWith(`
61151
- `)) {
61152
- right3 = right3.slice(0, -1);
61153
- }
61154
- }
61155
- return super.equals(left3, right3, options9);
61156
- }
61157
- }
61158
- var lineDiff = new LineDiff;
61159
- function diffLines(oldStr, newStr, options9) {
61160
- return lineDiff.diff(oldStr, newStr, options9);
61161
- }
61162
- function tokenize(value6, options9) {
61163
- if (options9.stripTrailingCr) {
61164
- value6 = value6.replace(/\r\n/g, `
61165
- `);
61166
- }
61167
- const retLines = [], linesAndNewlines = value6.split(/(\n|\r\n)/);
61168
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
61169
- linesAndNewlines.pop();
61170
- }
61171
- for (let i = 0;i < linesAndNewlines.length; i++) {
61172
- const line4 = linesAndNewlines[i];
61173
- if (i % 2 && !options9.newlineIsToken) {
61174
- retLines[retLines.length - 1] += line4;
61175
- } else {
61176
- retLines.push(line4);
61177
- }
61178
- }
61179
- return retLines;
61180
- }
61181
-
61182
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/sentence.js
61183
- function isSentenceEndPunct(char4) {
61184
- return char4 == "." || char4 == "!" || char4 == "?";
61185
- }
61186
-
61187
- class SentenceDiff extends Diff {
61188
- tokenize(value6) {
61189
- var _a;
61190
- const result = [];
61191
- let tokenStartI = 0;
61192
- for (let i = 0;i < value6.length; i++) {
61193
- if (i == value6.length - 1) {
61194
- result.push(value6.slice(tokenStartI));
61195
- break;
61196
- }
61197
- if (isSentenceEndPunct(value6[i]) && value6[i + 1].match(/\s/)) {
61198
- result.push(value6.slice(tokenStartI, i + 1));
61199
- i = tokenStartI = i + 1;
61200
- while ((_a = value6[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
61201
- i++;
61202
- }
61203
- result.push(value6.slice(tokenStartI, i + 1));
61204
- tokenStartI = i + 1;
61205
- }
61206
- }
61207
- return result;
61208
- }
61209
- }
61210
- var sentenceDiff = new SentenceDiff;
61211
-
61212
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/css.js
61213
- class CssDiff extends Diff {
61214
- tokenize(value6) {
61215
- return value6.split(/([{}:;,]|\s+)/);
61216
- }
61217
- }
61218
- var cssDiff = new CssDiff;
61219
-
61220
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/json.js
61221
- class JsonDiff extends Diff {
61222
- constructor() {
61223
- super(...arguments);
61224
- this.tokenize = tokenize;
61225
- }
61226
- get useLongestToken() {
61227
- return true;
61228
- }
61229
- castInput(value6, options9) {
61230
- const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options9;
61231
- return typeof value6 === "string" ? value6 : JSON.stringify(canonicalize(value6, null, null, stringifyReplacer), null, " ");
61232
- }
61233
- equals(left3, right3, options9) {
61234
- return super.equals(left3.replace(/,([\r\n])/g, "$1"), right3.replace(/,([\r\n])/g, "$1"), options9);
61235
- }
61236
- }
61237
- var jsonDiff = new JsonDiff;
61238
- function canonicalize(obj, stack, replacementStack, replacer, key) {
61239
- stack = stack || [];
61240
- replacementStack = replacementStack || [];
61241
- if (replacer) {
61242
- obj = replacer(key === undefined ? "" : key, obj);
61243
- }
61244
- let i;
61245
- for (i = 0;i < stack.length; i += 1) {
61246
- if (stack[i] === obj) {
61247
- return replacementStack[i];
61248
- }
61249
- }
61250
- let canonicalizedObj;
61251
- if (Object.prototype.toString.call(obj) === "[object Array]") {
61252
- stack.push(obj);
61253
- canonicalizedObj = new Array(obj.length);
61254
- replacementStack.push(canonicalizedObj);
61255
- for (i = 0;i < obj.length; i += 1) {
61256
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
61257
- }
61258
- stack.pop();
61259
- replacementStack.pop();
61260
- return canonicalizedObj;
61261
- }
61262
- if (obj && obj.toJSON) {
61263
- obj = obj.toJSON();
61264
- }
61265
- if (typeof obj === "object" && obj !== null) {
61266
- stack.push(obj);
61267
- canonicalizedObj = {};
61268
- replacementStack.push(canonicalizedObj);
61269
- const sortedKeys = [];
61270
- let key2;
61271
- for (key2 in obj) {
61272
- if (Object.prototype.hasOwnProperty.call(obj, key2)) {
61273
- sortedKeys.push(key2);
61274
- }
61275
- }
61276
- sortedKeys.sort();
61277
- for (i = 0;i < sortedKeys.length; i += 1) {
61278
- key2 = sortedKeys[i];
61279
- canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
61280
- }
61281
- stack.pop();
61282
- replacementStack.pop();
61283
- } else {
61284
- canonicalizedObj = obj;
61285
- }
61286
- return canonicalizedObj;
61287
- }
61288
-
61289
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/array.js
61290
- class ArrayDiff extends Diff {
61291
- tokenize(value6) {
61292
- return value6.slice();
61293
- }
61294
- join(value6) {
61295
- return value6;
61296
- }
61297
- removeEmpty(value6) {
61298
- return value6;
61299
- }
61300
- }
61301
- var arrayDiff = new ArrayDiff;
61302
-
61303
- // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/patch/create.js
61304
- function needsQuoting(s) {
61305
- for (let i = 0;i < s.length; i++) {
61306
- if (s[i] < " " || s[i] > "~" || s[i] === '"' || s[i] === "\\") {
61307
- return true;
61308
- }
61309
- }
61310
- return false;
61311
- }
61312
- function quoteFileNameIfNeeded(s) {
61313
- if (!needsQuoting(s)) {
61314
- return s;
61315
- }
61316
- let result = '"';
61317
- const bytes = new TextEncoder().encode(s);
61318
- let i = 0;
61319
- while (i < bytes.length) {
61320
- const b = bytes[i];
61321
- if (b === 7) {
61322
- result += "\\a";
61323
- } else if (b === 8) {
61324
- result += "\\b";
61325
- } else if (b === 9) {
61326
- result += "\\t";
61327
- } else if (b === 10) {
61328
- result += "\\n";
61329
- } else if (b === 11) {
61330
- result += "\\v";
61331
- } else if (b === 12) {
61332
- result += "\\f";
61333
- } else if (b === 13) {
61334
- result += "\\r";
61335
- } else if (b === 34) {
61336
- result += "\\\"";
61337
- } else if (b === 92) {
61338
- result += "\\\\";
61339
- } else if (b >= 32 && b <= 126) {
61340
- result += String.fromCharCode(b);
61341
- } else {
61342
- result += "\\" + b.toString(8).padStart(3, "0");
61343
- }
61344
- i++;
61345
- }
61346
- result += '"';
61347
- return result;
61348
- }
61349
- var INCLUDE_HEADERS = {
61350
- includeIndex: true,
61351
- includeUnderline: true,
61352
- includeFileHeaders: true
61353
- };
61354
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
61355
- let optionsObj;
61356
- if (!options9) {
61357
- optionsObj = {};
61358
- } else if (typeof options9 === "function") {
61359
- optionsObj = { callback: options9 };
61360
- } else {
61361
- optionsObj = options9;
61362
- }
61363
- if (typeof optionsObj.context === "undefined") {
61364
- optionsObj.context = 4;
61365
- }
61366
- const context8 = optionsObj.context;
61367
- if (optionsObj.newlineIsToken) {
61368
- throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
61369
- }
61370
- if (!optionsObj.callback) {
61371
- return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
61372
- } else {
61373
- const { callback } = optionsObj;
61374
- diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff8) => {
61375
- const patch15 = diffLinesResultToPatch(diff8);
61376
- callback(patch15);
61377
- } }));
61378
- }
61379
- function diffLinesResultToPatch(diff8) {
61380
- if (!diff8) {
61381
- return;
61382
- }
61383
- diff8.push({ value: "", lines: [] });
61384
- function contextLines(lines3) {
61385
- return lines3.map(function(entry) {
61386
- return " " + entry;
61387
- });
61388
- }
61389
- const hunks = [];
61390
- let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
61391
- for (let i = 0;i < diff8.length; i++) {
61392
- const current = diff8[i], lines3 = current.lines || splitLines4(current.value);
61393
- current.lines = lines3;
61394
- if (current.added || current.removed) {
61395
- if (!oldRangeStart) {
61396
- const prev = diff8[i - 1];
61397
- oldRangeStart = oldLine;
61398
- newRangeStart = newLine;
61399
- if (prev) {
61400
- curRange = context8 > 0 ? contextLines(prev.lines.slice(-context8)) : [];
61401
- oldRangeStart -= curRange.length;
61402
- newRangeStart -= curRange.length;
61403
- }
61404
- }
61405
- for (const line4 of lines3) {
61406
- curRange.push((current.added ? "+" : "-") + line4);
61407
- }
61408
- if (current.added) {
61409
- newLine += lines3.length;
61410
- } else {
61411
- oldLine += lines3.length;
61412
- }
61413
- } else {
61414
- if (oldRangeStart) {
61415
- if (lines3.length <= context8 * 2 && i < diff8.length - 2) {
61416
- for (const line4 of contextLines(lines3)) {
61417
- curRange.push(line4);
61418
- }
61419
- } else {
61420
- const contextSize = Math.min(lines3.length, context8);
61421
- for (const line4 of contextLines(lines3.slice(0, contextSize))) {
61422
- curRange.push(line4);
61423
- }
61424
- const hunk = {
61425
- oldStart: oldRangeStart,
61426
- oldLines: oldLine - oldRangeStart + contextSize,
61427
- newStart: newRangeStart,
61428
- newLines: newLine - newRangeStart + contextSize,
61429
- lines: curRange
61430
- };
61431
- hunks.push(hunk);
61432
- oldRangeStart = 0;
61433
- newRangeStart = 0;
61434
- curRange = [];
61435
- }
61436
- }
61437
- oldLine += lines3.length;
61438
- newLine += lines3.length;
61439
- }
61440
- }
61441
- for (const hunk of hunks) {
61442
- for (let i = 0;i < hunk.lines.length; i++) {
61443
- if (hunk.lines[i].endsWith(`
61444
- `)) {
61445
- hunk.lines[i] = hunk.lines[i].slice(0, -1);
61446
- } else {
61447
- hunk.lines.splice(i + 1, 0, "\");
61448
- i++;
61449
- }
61450
- }
61451
- }
61452
- return {
61453
- oldFileName,
61454
- newFileName,
61455
- oldHeader,
61456
- newHeader,
61457
- hunks
61458
- };
61459
- }
61460
- }
61461
- function formatPatch(patch15, headerOptions) {
61462
- var _a, _b, _c, _d, _e, _f;
61463
- if (!headerOptions) {
61464
- headerOptions = INCLUDE_HEADERS;
61465
- }
61466
- if (Array.isArray(patch15)) {
61467
- if (patch15.length > 1 && !headerOptions.includeFileHeaders && !patch15.every((p3) => p3.isGit)) {
61468
- 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?)");
61469
- }
61470
- return patch15.map((p3) => formatPatch(p3, headerOptions)).join(`
61471
- `);
61472
- }
61473
- const ret = [];
61474
- if (patch15.isGit) {
61475
- headerOptions = INCLUDE_HEADERS;
61476
- if (!patch15.oldFileName) {
61477
- throw new Error("oldFileName must be specified for Git patches");
61478
- }
61479
- if (!patch15.newFileName) {
61480
- throw new Error("newFileName must be specified for Git patches");
61481
- }
61482
- let gitOldName = patch15.oldFileName;
61483
- let gitNewName = patch15.newFileName;
61484
- if (patch15.isCreate && gitOldName === "/dev/null") {
61485
- gitOldName = gitNewName.replace(/^b\//, "a/");
61486
- } else if (patch15.isDelete && gitNewName === "/dev/null") {
61487
- gitNewName = gitOldName.replace(/^a\//, "b/");
61488
- }
61489
- ret.push("diff --git " + quoteFileNameIfNeeded(gitOldName) + " " + quoteFileNameIfNeeded(gitNewName));
61490
- if (patch15.isDelete) {
61491
- ret.push("deleted file mode " + ((_a = patch15.oldMode) !== null && _a !== undefined ? _a : "100644"));
61492
- }
61493
- if (patch15.isCreate) {
61494
- ret.push("new file mode " + ((_b = patch15.newMode) !== null && _b !== undefined ? _b : "100644"));
61495
- }
61496
- if (patch15.oldMode && patch15.newMode && !patch15.isDelete && !patch15.isCreate) {
61497
- ret.push("old mode " + patch15.oldMode);
61498
- ret.push("new mode " + patch15.newMode);
61499
- }
61500
- if (patch15.isRename) {
61501
- ret.push("rename from " + quoteFileNameIfNeeded(((_c = patch15.oldFileName) !== null && _c !== undefined ? _c : "").replace(/^a\//, "")));
61502
- ret.push("rename to " + quoteFileNameIfNeeded(((_d = patch15.newFileName) !== null && _d !== undefined ? _d : "").replace(/^b\//, "")));
61503
- }
61504
- if (patch15.isCopy) {
61505
- ret.push("copy from " + quoteFileNameIfNeeded(((_e = patch15.oldFileName) !== null && _e !== undefined ? _e : "").replace(/^a\//, "")));
61506
- ret.push("copy to " + quoteFileNameIfNeeded(((_f = patch15.newFileName) !== null && _f !== undefined ? _f : "").replace(/^b\//, "")));
61507
- }
61508
- } else {
61509
- if (headerOptions.includeIndex && patch15.oldFileName == patch15.newFileName && patch15.oldFileName !== undefined) {
61510
- ret.push("Index: " + patch15.oldFileName);
61511
- }
61512
- if (headerOptions.includeUnderline) {
61513
- ret.push("===================================================================");
61514
- }
61515
- }
61516
- const hasHunks = patch15.hunks.length > 0;
61517
- if (headerOptions.includeFileHeaders && patch15.oldFileName !== undefined && patch15.newFileName !== undefined && (!patch15.isGit || hasHunks)) {
61518
- ret.push("--- " + quoteFileNameIfNeeded(patch15.oldFileName) + (patch15.oldHeader ? "\t" + patch15.oldHeader : ""));
61519
- ret.push("+++ " + quoteFileNameIfNeeded(patch15.newFileName) + (patch15.newHeader ? "\t" + patch15.newHeader : ""));
61520
- }
61521
- for (let i = 0;i < patch15.hunks.length; i++) {
61522
- const hunk = patch15.hunks[i];
61523
- const oldStart = hunk.oldLines === 0 ? hunk.oldStart - 1 : hunk.oldStart;
61524
- const newStart = hunk.newLines === 0 ? hunk.newStart - 1 : hunk.newStart;
61525
- ret.push("@@ -" + oldStart + "," + hunk.oldLines + " +" + newStart + "," + hunk.newLines + " @@");
61526
- for (const line4 of hunk.lines) {
61527
- ret.push(line4);
61528
- }
61529
- }
61530
- return ret.join(`
61531
- `) + `
61532
- `;
61533
- }
61534
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
61535
- if (typeof options9 === "function") {
61536
- options9 = { callback: options9 };
61537
- }
61538
- if (!(options9 === null || options9 === undefined ? undefined : options9.callback)) {
61539
- const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9);
61540
- if (!patchObj) {
61541
- return;
61542
- }
61543
- return formatPatch(patchObj, options9 === null || options9 === undefined ? undefined : options9.headerOptions);
61544
- } else {
61545
- const { callback } = options9;
61546
- structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options9), { callback: (patchObj) => {
61547
- if (!patchObj) {
61548
- callback(undefined);
61549
- } else {
61550
- callback(formatPatch(patchObj, options9.headerOptions));
61551
- }
61552
- } }));
61553
- }
61554
- }
61555
- function splitLines4(text12) {
61556
- const hasTrailingNl = text12.endsWith(`
61557
- `);
61558
- const result = text12.split(`
61559
- `).map((line4) => line4 + `
61560
- `);
61561
- if (hasTrailingNl) {
61562
- result.pop();
61563
- } else {
61564
- result.push(result.pop().slice(0, -1));
61565
- }
61566
- return result;
61567
- }
61568
-
61569
- // src/update/run.ts
61570
60769
  var scaffoldManifestFile = ".devpunks/scaffold-manifest.json";
61571
60770
  var agentHandoffFile = ".devpunks/AGENT-HANDOFF.md";
61572
60771
  var agentSystemPromptFile2 = ".devpunks/AGENT-SYSTEM-PROMPT.md";
@@ -61616,14 +60815,14 @@ var selectedSkills3 = (finalPacks, baseline) => [
61616
60815
  ].toSorted();
61617
60816
  var readManifest = (rootDirectory) => {
61618
60817
  const manifestPath = path15.join(rootDirectory, scaffoldManifestFile);
61619
- if (!existsSync8(manifestPath)) {
60818
+ if (!existsSync9(manifestPath)) {
61620
60819
  throw new Error(`Missing ${scaffoldManifestFile}. Run \`punks scaffold setup\` first.`);
61621
60820
  }
61622
60821
  return parseManifest(readFileSync9(manifestPath, "utf8"));
61623
60822
  };
61624
60823
  var contentForDiff = (rootDirectory, relativePath) => {
61625
60824
  const absolutePath = path15.join(rootDirectory, relativePath);
61626
- if (!existsSync8(absolutePath)) {
60825
+ if (!existsSync9(absolutePath)) {
61627
60826
  return "";
61628
60827
  }
61629
60828
  const stat3 = lstatSync2(absolutePath);
@@ -61652,16 +60851,37 @@ var stableJsonStringify = (value6) => {
61652
60851
  };
61653
60852
  var hashPath = (rootDirectory, relativePath) => {
61654
60853
  const absolutePath = path15.join(rootDirectory, relativePath);
61655
- if (!existsSync8(absolutePath)) {
60854
+ if (!existsSync9(absolutePath)) {
61656
60855
  return null;
61657
60856
  }
61658
60857
  const stat3 = lstatSync2(absolutePath);
61659
60858
  const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync2(absolutePath)}` : readFileSync9(absolutePath);
61660
60859
  return hashContent2(content);
61661
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
+ });
61662
60882
  var collectRelativeFiles2 = (rootDirectory, relativeDirectory) => {
61663
60883
  const absoluteDirectory = path15.join(rootDirectory, relativeDirectory);
61664
- if (!existsSync8(absoluteDirectory)) {
60884
+ if (!existsSync9(absoluteDirectory)) {
61665
60885
  return [];
61666
60886
  }
61667
60887
  const files = [];
@@ -61669,7 +60889,8 @@ var collectRelativeFiles2 = (rootDirectory, relativeDirectory) => {
61669
60889
  for (const entry of readdirSync4(currentDirectory, { withFileTypes: true })) {
61670
60890
  const absolutePath = path15.join(currentDirectory, entry.name);
61671
60891
  const relativePath = path15.relative(rootDirectory, absolutePath).split(path15.sep).join("/");
61672
- if (relativePath.split("/").includes("node_modules")) {
60892
+ const wikiRelativePath = path15.relative(absoluteDirectory, absolutePath).split(path15.sep).join("/");
60893
+ if (hasIgnoredWikiAlignmentRootDirectory(wikiRelativePath)) {
61673
60894
  continue;
61674
60895
  }
61675
60896
  if (entry.isDirectory()) {
@@ -61693,7 +60914,7 @@ var copyManagedFile = ({
61693
60914
  const targetPath = path15.join(toDirectory, relativePath);
61694
60915
  const stat3 = lstatSync2(sourcePath);
61695
60916
  mkdirSync7(path15.dirname(targetPath), { recursive: true });
61696
- if (existsSync8(targetPath)) {
60917
+ if (existsSync9(targetPath)) {
61697
60918
  rmSync4(targetPath, { recursive: true, force: true });
61698
60919
  }
61699
60920
  if (stat3.isSymbolicLink()) {
@@ -61748,7 +60969,6 @@ var summarizeStaleFiles = (staleFiles) => {
61748
60969
  ].join(`
61749
60970
  `);
61750
60971
  };
61751
- var diffableChanges = (changes2) => changes2.filter((change) => change.status !== "missing" && change.kind !== "manifest" && change.patch.length <= 8000).slice(0, 5);
61752
60972
  var packDriftPrompt = ({
61753
60973
  rootDirectory,
61754
60974
  finalPacks,
@@ -61784,15 +61004,27 @@ var buildChanges = ({
61784
61004
  {
61785
61005
  path: expected.path,
61786
61006
  kind: expected.kind,
61787
- status: status2,
61788
- patch: createTwoFilesPatch(expected.path, expected.path, contentForDiff(rootDirectory, expected.path), contentForDiff(expectedDirectory, expected.path), "current", "expected")
61007
+ status: status2
61789
61008
  }
61790
61009
  ];
61791
61010
  }).toSorted((left3, right3) => left3.path.localeCompare(right3.path));
61792
61011
  };
61793
- var isProjectAuthoredManagedFile = (file6) => {
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
+ }) => {
61794
61026
  if (file6.path === ".agents/scripts/sync-subagents.mjs") {
61795
- return true;
61027
+ return isTailoredSyncSubagentsScript(rootDirectory);
61796
61028
  }
61797
61029
  if (file6.kind === "agent-prompt" || file6.kind === "handoff" || file6.kind === "manifest" || file6.kind === "prompt-spec" || file6.kind === "subagent") {
61798
61030
  return true;
@@ -61805,18 +61037,16 @@ var buildLegacyRequiredToolsPromptChanges = ({
61805
61037
  const promptFiles = [agentHandoffFile, agentSystemPromptFile2];
61806
61038
  return promptFiles.flatMap((promptFile) => {
61807
61039
  const absolutePath = path15.join(rootDirectory, promptFile);
61808
- if (!existsSync8(absolutePath))
61040
+ if (!existsSync9(absolutePath))
61809
61041
  return [];
61810
61042
  const current = readFileSync9(absolutePath, "utf8");
61811
61043
  if (!current.includes(legacyRequiredToolsFile))
61812
61044
  return [];
61813
- const expected = current.replaceAll(legacyRequiredToolsFile, repoSettingsDisplayFile);
61814
61045
  return [
61815
61046
  {
61816
61047
  path: promptFile,
61817
61048
  kind: "handoff",
61818
- status: "local-edited",
61819
- patch: createTwoFilesPatch(promptFile, promptFile, current, expected, "current", "expected")
61049
+ status: "local-edited"
61820
61050
  }
61821
61051
  ];
61822
61052
  });
@@ -61826,7 +61056,7 @@ var rewriteLegacyRequiredToolsPrompt = ({
61826
61056
  relativePath
61827
61057
  }) => {
61828
61058
  const absolutePath = path15.join(rootDirectory, relativePath);
61829
- if (!existsSync8(absolutePath))
61059
+ if (!existsSync9(absolutePath))
61830
61060
  return;
61831
61061
  const current = readFileSync9(absolutePath, "utf8");
61832
61062
  if (!current.includes(legacyRequiredToolsFile))
@@ -61836,10 +61066,11 @@ var rewriteLegacyRequiredToolsPrompt = ({
61836
61066
  var copyIfExists = ({
61837
61067
  rootDirectory,
61838
61068
  targetDirectory,
61839
- relativePath
61069
+ relativePath,
61070
+ ignoreGeneratedRootDirectories = false
61840
61071
  }) => {
61841
61072
  const sourcePath = path15.join(rootDirectory, relativePath);
61842
- if (!existsSync8(sourcePath))
61073
+ if (!existsSync9(sourcePath))
61843
61074
  return;
61844
61075
  const targetPath = path15.join(targetDirectory, relativePath);
61845
61076
  const stat3 = lstatSync2(sourcePath);
@@ -61848,7 +61079,14 @@ var copyIfExists = ({
61848
61079
  symlinkSync2(readlinkSync2(sourcePath), targetPath);
61849
61080
  return;
61850
61081
  }
61851
- cpSync3(sourcePath, targetPath, { recursive: true, verbatimSymlinks: true });
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
+ });
61852
61090
  };
61853
61091
  var buildWikiAlignment = ({
61854
61092
  rootDirectory,
@@ -61857,10 +61095,15 @@ var buildWikiAlignment = ({
61857
61095
  const expectedDirectory = mkdtempSync2(path15.join(tmpdir4(), "punks-wiki-update-"));
61858
61096
  const hasWikiRootMarkers2 = (relativeRoot) => {
61859
61097
  const absoluteRoot = path15.join(rootDirectory, relativeRoot);
61860
- return ["package.json", "backlog-provider.md", "wiki-framework.md"].some((marker) => existsSync8(path15.join(absoluteRoot, marker)));
61098
+ return ["package.json", "backlog-provider.md", "wiki-framework.md"].some((marker) => existsSync9(path15.join(absoluteRoot, marker)));
61861
61099
  };
61862
- const wikiRoot = hasWikiRootMarkers2("apps/wiki") ? "apps/wiki" : hasWikiRootMarkers2("app/wiki") ? "app/wiki" : existsSync8(path15.join(rootDirectory, "apps/wiki")) ? "apps/wiki" : existsSync8(path15.join(rootDirectory, "wiki")) ? "wiki" : detection.monorepo ? "apps/wiki" : "wiki";
61863
- copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: wikiRoot });
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";
61101
+ copyIfExists({
61102
+ rootDirectory,
61103
+ targetDirectory: expectedDirectory,
61104
+ relativePath: wikiRoot,
61105
+ ignoreGeneratedRootDirectories: true
61106
+ });
61864
61107
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
61865
61108
  const wikiFramework = readWikiFrameworkPin(path15.join(expectedDirectory, wikiRoot));
61866
61109
  scaffoldWikiForDirectory({
@@ -61869,7 +61112,7 @@ var buildWikiAlignment = ({
61869
61112
  wikiFramework
61870
61113
  });
61871
61114
  const syncScript = path15.join(expectedDirectory, wikiRoot, "scripts", "sync-content.mjs");
61872
- if (existsSync8(syncScript)) {
61115
+ if (existsSync9(syncScript)) {
61873
61116
  runJavaScriptFileSync({
61874
61117
  file: syncScript,
61875
61118
  cwd: expectedDirectory
@@ -61882,6 +61125,7 @@ var buildWikiAlignment = ({
61882
61125
  }));
61883
61126
  return {
61884
61127
  expectedDirectory,
61128
+ expectedFiles,
61885
61129
  changes: buildChanges({
61886
61130
  rootDirectory,
61887
61131
  expectedDirectory,
@@ -61892,7 +61136,7 @@ var buildWikiAlignment = ({
61892
61136
  };
61893
61137
  var readWikiFrameworkPin = (wikiDirectory) => {
61894
61138
  const pinPath = path15.join(wikiDirectory, "wiki-framework.md");
61895
- if (!existsSync8(pinPath))
61139
+ if (!existsSync9(pinPath))
61896
61140
  return "next";
61897
61141
  const content = readFileSync9(pinPath, "utf8");
61898
61142
  if (content.includes("`tanstack-start`"))
@@ -61906,7 +61150,7 @@ var buildGitignoreCleanup = ({
61906
61150
  expectedDirectory
61907
61151
  }) => {
61908
61152
  const relativePath = ".gitignore";
61909
- if (!existsSync8(path15.join(rootDirectory, relativePath))) {
61153
+ if (!existsSync9(path15.join(rootDirectory, relativePath))) {
61910
61154
  return [];
61911
61155
  }
61912
61156
  copyManagedFile({ fromDirectory: rootDirectory, toDirectory: expectedDirectory, relativePath });
@@ -62015,7 +61259,7 @@ var runUpdate = ({
62015
61259
  const changes2 = buildChanges({
62016
61260
  rootDirectory,
62017
61261
  expectedDirectory,
62018
- expectedFiles: expected.managedFiles.filter((file6) => !isProjectAuthoredManagedFile(file6)),
61262
+ expectedFiles: expected.managedFiles.filter((file6) => !isProjectAuthoredManagedFile({ file: file6, rootDirectory })),
62019
61263
  previousFiles
62020
61264
  });
62021
61265
  const legacyRequiredToolsPromptChanges = buildLegacyRequiredToolsPromptChanges({
@@ -62025,19 +61269,23 @@ var runUpdate = ({
62025
61269
  rootDirectory,
62026
61270
  expectedDirectory
62027
61271
  });
62028
- const wikiAlignment = buildWikiAlignment({
61272
+ const shouldAlignWiki = finalPacks.includes("docs") || expected.managedFiles.some((file6) => isWikiManagedPath(file6.path));
61273
+ const wikiAlignment = shouldAlignWiki ? buildWikiAlignment({
62029
61274
  rootDirectory,
62030
61275
  detection
62031
- });
61276
+ }) : null;
62032
61277
  const allChanges = [
62033
61278
  ...changes2,
62034
61279
  ...legacyRequiredToolsPromptChanges,
62035
61280
  ...gitignoreChanges,
62036
- ...wikiAlignment.changes,
61281
+ ...wikiAlignment?.changes ?? [],
62037
61282
  ...settingsChanges
62038
61283
  ].toSorted((left3, right3) => left3.path.localeCompare(right3.path));
62039
- const expectedPaths = new Set(expected.managedFiles.map((file6) => file6.path));
62040
- const staleFiles = previousFiles.filter((file6) => !isProjectAuthoredManagedFile(file6)).map((file6) => file6.path).filter((file6) => !expectedPaths.has(file6)).toSorted();
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();
62041
61289
  const hasManagedUpdates = allChanges.length > 0 || staleFiles.length > 0;
62042
61290
  const needsAttention = hasManagedUpdates || packDrift || baselineDrift;
62043
61291
  const driftPrompt = packDrift ? packDriftPrompt({ rootDirectory, finalPacks, resolvedPacks }) : null;
@@ -62077,17 +61325,6 @@ var runUpdate = ({
62077
61325
  yield* writeHuman("");
62078
61326
  yield* writeHuman(renderCommandSection("Stale Managed Files", summarizeStaleFiles(staleFiles)));
62079
61327
  }
62080
- const patchPreview = diffableChanges(allChanges);
62081
- if (patchPreview.length > 0) {
62082
- yield* writeHuman("");
62083
- yield* writeHuman(renderCommandSection("Diff Preview", [
62084
- ...patchPreview.map((change) => change.patch),
62085
- ...allChanges.length > patchPreview.length ? [
62086
- `Showing ${patchPreview.length} focused diffs. Full structured details are available with --json.`
62087
- ] : []
62088
- ].join(`
62089
- `)));
62090
- }
62091
61328
  const applyRequested = write4 || yes ? true : check2 || emitJson || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
62092
61329
  const unsafeBundledBaselineDrift = applyRequested && baselineDrift && baseline.summary.source === "bundled" && !allowBundledBaselineDriftApply;
62093
61330
  if (unsafeBundledBaselineDrift) {
@@ -62139,12 +61376,14 @@ var runUpdate = ({
62139
61376
  relativePath: change.path
62140
61377
  });
62141
61378
  }
62142
- for (const change of wikiAlignment.changes) {
62143
- copyManagedFile({
62144
- fromDirectory: wikiAlignment.expectedDirectory,
62145
- toDirectory: rootDirectory,
62146
- relativePath: change.path
62147
- });
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
+ }
62148
61387
  }
62149
61388
  for (const change of settingsChanges) {
62150
61389
  copyManagedFile({
@@ -62194,7 +61433,9 @@ var runUpdate = ({
62194
61433
  yield* prompt4.writeLine(encodePrettyJson3(result));
62195
61434
  }
62196
61435
  rmSync4(expectedDirectory, { recursive: true, force: true });
62197
- rmSync4(wikiAlignment.expectedDirectory, { recursive: true, force: true });
61436
+ if (wikiAlignment !== null) {
61437
+ rmSync4(wikiAlignment.expectedDirectory, { recursive: true, force: true });
61438
+ }
62198
61439
  if (result.applied) {
62199
61440
  yield* submitCliEventEffect("cli.scaffold.update.applied", {
62200
61441
  cwd: rootDirectory,
@@ -62248,7 +61489,7 @@ var updateCommand = exports_Command.make("update", {
62248
61489
 
62249
61490
  // src/core/self-update.ts
62250
61491
  import { spawnSync as spawnSync2 } from "node:child_process";
62251
- import { existsSync as existsSync9, realpathSync } from "node:fs";
61492
+ import { existsSync as existsSync10, realpathSync } from "node:fs";
62252
61493
  var parseSemver = (value6) => {
62253
61494
  const match19 = value6.match(/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u);
62254
61495
  if (match19 === null) {
@@ -62356,7 +61597,7 @@ var checkSelfUpdate = async ({
62356
61597
  updateAvailable: isNewerVersion(latestVersion, currentVersion)
62357
61598
  };
62358
61599
  };
62359
- var looksLikePath = (value6) => value6.includes("/") || value6.includes("\\") || existsSync9(value6);
61600
+ var looksLikePath = (value6) => value6.includes("/") || value6.includes("\\") || existsSync10(value6);
62360
61601
  var defaultEntrypointCandidates = () => [process.argv[1] ?? "", process.execPath].filter((value6) => value6.length > 0);
62361
61602
  var detectCliInstallPackageManager = ({
62362
61603
  entrypoint,
@@ -62813,7 +62054,7 @@ var startBackgroundStartupChecks = () => {
62813
62054
  return;
62814
62055
  }
62815
62056
  const entrypoint = process.argv[1];
62816
- if (entrypoint === undefined || !existsSync10(entrypoint)) {
62057
+ if (entrypoint === undefined || !existsSync11(entrypoint)) {
62817
62058
  return;
62818
62059
  }
62819
62060
  markStartupCheckStarted();