codebase-snapshot 0.12.8 → 0.12.9

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/cli.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var childProcess = require('child_process');
4
4
  var fs16 = require('fs');
5
- var path17 = require('path');
5
+ var path22 = require('path');
6
6
  var util = require('util');
7
7
  var crypto3 = require('crypto');
8
8
  var module$1 = require('module');
@@ -38,7 +38,7 @@ function _interopNamespace(e) {
38
38
 
39
39
  var childProcess__namespace = /*#__PURE__*/_interopNamespace(childProcess);
40
40
  var fs16__namespace = /*#__PURE__*/_interopNamespace(fs16);
41
- var path17__namespace = /*#__PURE__*/_interopNamespace(path17);
41
+ var path22__namespace = /*#__PURE__*/_interopNamespace(path22);
42
42
  var crypto3__namespace = /*#__PURE__*/_interopNamespace(crypto3);
43
43
  var ts2__default = /*#__PURE__*/_interopDefault(ts2);
44
44
  var readline__namespace = /*#__PURE__*/_interopNamespace(readline);
@@ -101,7 +101,7 @@ function readSmallFile(fullPath) {
101
101
  }
102
102
  }
103
103
  function readManifest(cwd, name) {
104
- return readSmallFile(path17__namespace.join(cwd, name));
104
+ return readSmallFile(path22__namespace.join(cwd, name));
105
105
  }
106
106
  function dependenciesFromPackageJson(raw) {
107
107
  const names = /* @__PURE__ */ new Set();
@@ -161,7 +161,7 @@ function pnpmWorkspacePatterns(raw) {
161
161
  function childDirectories(cwd, parent) {
162
162
  let entries;
163
163
  try {
164
- entries = fs16__namespace.readdirSync(path17__namespace.join(cwd, parent), { withFileTypes: true });
164
+ entries = fs16__namespace.readdirSync(path22__namespace.join(cwd, parent), { withFileTypes: true });
165
165
  } catch {
166
166
  return [];
167
167
  }
@@ -197,12 +197,12 @@ function scanWorkspacePackages(cwd, patterns) {
197
197
  const files = /* @__PURE__ */ new Set();
198
198
  const dependencies = /* @__PURE__ */ new Set();
199
199
  for (const relative15 of workspacePackageDirs(cwd, patterns)) {
200
- const full = path17__namespace.join(cwd, relative15);
200
+ const full = path22__namespace.join(cwd, relative15);
201
201
  try {
202
202
  for (const entry of fs16__namespace.readdirSync(full, { withFileTypes: true })) files.add(entry.name);
203
203
  } catch {
204
204
  }
205
- const raw = readSmallFile(path17__namespace.join(full, "package.json"));
205
+ const raw = readSmallFile(path22__namespace.join(full, "package.json"));
206
206
  if (raw !== null) {
207
207
  for (const name of dependenciesFromPackageJson(raw)) dependencies.add(name);
208
208
  }
@@ -212,7 +212,7 @@ function scanWorkspacePackages(cwd, patterns) {
212
212
  var SNAPSHOT_MARKER = ".codebase-snapshot";
213
213
  function isToolOwnedDirectory(dir) {
214
214
  try {
215
- return fs16__namespace.statSync(dir).isDirectory() && fs16__namespace.existsSync(path17__namespace.join(dir, SNAPSHOT_MARKER));
215
+ return fs16__namespace.statSync(dir).isDirectory() && fs16__namespace.existsSync(path22__namespace.join(dir, SNAPSHOT_MARKER));
216
216
  } catch {
217
217
  return false;
218
218
  }
@@ -238,7 +238,7 @@ function countMarkdownFiles(cwd) {
238
238
  }
239
239
  if (!entry.isDirectory() || current.depth >= 2) continue;
240
240
  if (entry.name.startsWith(".") || SKIPPED_WALK_DIRS.has(entry.name)) continue;
241
- const child = path17__namespace.join(current.dir, entry.name);
241
+ const child = path22__namespace.join(current.dir, entry.name);
242
242
  if (isToolOwnedDirectory(child)) continue;
243
243
  queue.push({ dir: child, depth: current.depth + 1 });
244
244
  }
@@ -266,7 +266,7 @@ function buildPresetContext(cwd) {
266
266
  const isWorkspace = files.has("pnpm-workspace.yaml") || files.has("nx.json") || files.has("turbo.json") || files.has("lerna.json") || packageJson !== void 0 && packageJson.includes('"workspaces"') || declaredWorkspaces.length > 0;
267
267
  let workspace = { files: /* @__PURE__ */ new Set(), dependencies: /* @__PURE__ */ new Set() };
268
268
  if (isWorkspace) {
269
- const pnpmRaw = files.has("pnpm-workspace.yaml") ? readSmallFile(path17__namespace.join(cwd, "pnpm-workspace.yaml")) : null;
269
+ const pnpmRaw = files.has("pnpm-workspace.yaml") ? readSmallFile(path22__namespace.join(cwd, "pnpm-workspace.yaml")) : null;
270
270
  const declared = pnpmRaw === null ? [] : pnpmWorkspacePatterns(pnpmRaw);
271
271
  const patterns = declared.length > 0 ? declared : declaredWorkspaces.length > 0 ? declaredWorkspaces : DEFAULT_WORKSPACE_PATTERNS;
272
272
  workspace = scanWorkspacePackages(cwd, patterns);
@@ -2220,7 +2220,7 @@ function applySpansKeepingQuotes(line, spans) {
2220
2220
 
2221
2221
  // src/version.ts
2222
2222
  var GENERATOR_NAME = "codebase-snapshot";
2223
- var GENERATOR_VERSION = "0.12.8";
2223
+ var GENERATOR_VERSION = "0.12.9";
2224
2224
  var SCHEMA_VERSION = "3.0.0";
2225
2225
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
2226
2226
  function isOurGeneratorName(name) {
@@ -2244,7 +2244,7 @@ function readLinkTarget(linkPath, fallback) {
2244
2244
  }
2245
2245
  function brokenLinkRecord(linkPath, relativePath, rootReal) {
2246
2246
  const rawTarget = readLinkTarget(linkPath, linkPath);
2247
- const resolvedFallback = path17__namespace.resolve(path17__namespace.dirname(linkPath), rawTarget);
2247
+ const resolvedFallback = path22__namespace.resolve(path22__namespace.dirname(linkPath), rawTarget);
2248
2248
  return isInside(rootReal, resolvedFallback) ? { path: relativePath, reason: "read-error", detail: "broken symlink" } : {
2249
2249
  path: relativePath,
2250
2250
  reason: "outside-root",
@@ -2252,8 +2252,8 @@ function brokenLinkRecord(linkPath, relativePath, rootReal) {
2252
2252
  };
2253
2253
  }
2254
2254
  function isInside(root, candidate) {
2255
- const relative15 = path17__namespace.relative(root, candidate);
2256
- return relative15 === "" || !relative15.startsWith(`..${path17__namespace.sep}`) && relative15 !== ".." && !path17__namespace.isAbsolute(relative15);
2255
+ const relative15 = path22__namespace.relative(root, candidate);
2256
+ return relative15 === "" || !relative15.startsWith(`..${path22__namespace.sep}`) && relative15 !== ".." && !path22__namespace.isAbsolute(relative15);
2257
2257
  }
2258
2258
  var GIT_OUTPUT_LIMIT = 68157440;
2259
2259
  function getGitInfo(cwd, fallbackBranch = "main") {
@@ -2511,7 +2511,7 @@ function trimUnescapedTrailingSpaces(line) {
2511
2511
  return line.slice(0, end);
2512
2512
  }
2513
2513
  function readGitignoreRules(dir) {
2514
- const gitignorePath2 = path17__namespace.join(dir, ".gitignore");
2514
+ const gitignorePath2 = path22__namespace.join(dir, ".gitignore");
2515
2515
  let raw;
2516
2516
  try {
2517
2517
  raw = fs16__namespace.readFileSync(gitignorePath2, "utf8");
@@ -2725,7 +2725,7 @@ function listIgnoredPaths(cwd) {
2725
2725
  }
2726
2726
  function hasSnapshotMarker(target) {
2727
2727
  try {
2728
- return fs16__namespace.statSync(target).isDirectory() && fs16__namespace.existsSync(path17__namespace.join(target, ".codebase-snapshot"));
2728
+ return fs16__namespace.statSync(target).isDirectory() && fs16__namespace.existsSync(path22__namespace.join(target, ".codebase-snapshot"));
2729
2729
  } catch {
2730
2730
  return false;
2731
2731
  }
@@ -2734,7 +2734,7 @@ var IGNORABLE_DIRECTORY_ENTRIES = /* @__PURE__ */ new Set([".DS_Store"]);
2734
2734
  function isToolOwnedDirectory2(dir) {
2735
2735
  let raw;
2736
2736
  try {
2737
- raw = fs16__namespace.readFileSync(path17__namespace.join(dir, ".codebase-snapshot"), "utf8");
2737
+ raw = fs16__namespace.readFileSync(path22__namespace.join(dir, ".codebase-snapshot"), "utf8");
2738
2738
  } catch {
2739
2739
  return false;
2740
2740
  }
@@ -2778,7 +2778,7 @@ function makeToolOwnedDecider(cwd, toolOwnedPaths) {
2778
2778
  const prefix = parts.slice(0, depth).join("/");
2779
2779
  let hasMarker = markers.get(prefix);
2780
2780
  if (hasMarker === void 0) {
2781
- hasMarker = isToolOwnedDirectory2(path17__namespace.join(cwd, prefix));
2781
+ hasMarker = isToolOwnedDirectory2(path22__namespace.join(cwd, prefix));
2782
2782
  markers.set(prefix, hasMarker);
2783
2783
  }
2784
2784
  if (hasMarker) return true;
@@ -2821,7 +2821,7 @@ function dropLinkedDirectories(cwd, candidates, skipped) {
2821
2821
  let linkedPath = null;
2822
2822
  for (let depth = 1; depth <= parts.length; depth += 1) {
2823
2823
  const prefix = parts.slice(0, depth).join("/");
2824
- if (isLink(path17__namespace.join(cwd, prefix))) {
2824
+ if (isLink(path22__namespace.join(cwd, prefix))) {
2825
2825
  linkedPath = prefix;
2826
2826
  break;
2827
2827
  }
@@ -2830,7 +2830,7 @@ function dropLinkedDirectories(cwd, candidates, skipped) {
2830
2830
  kept.push(candidate);
2831
2831
  continue;
2832
2832
  }
2833
- const absolute = path17__namespace.join(cwd, linkedPath);
2833
+ const absolute = path22__namespace.join(cwd, linkedPath);
2834
2834
  const rawTarget = readLinkTarget(absolute, absolute);
2835
2835
  let targetReal = null;
2836
2836
  try {
@@ -2940,7 +2940,7 @@ function collectFiles(cwd, options = {}) {
2940
2940
  "Discovery mode is `git`, but git could not list this directory's files. Run inside a working repository, or pass --discovery walk (or auto) to scan the tree directly."
2941
2941
  );
2942
2942
  }
2943
- if (fs16__namespace.existsSync(path17__namespace.join(cwd, ".git"))) {
2943
+ if (fs16__namespace.existsSync(path22__namespace.join(cwd, ".git"))) {
2944
2944
  throw new Error(
2945
2945
  "This directory is a git repository, but git could not list its files. A plain walk honours .gitignore files, but git also applies .git/info/exclude and your global excludes file, includes files that are tracked although a .gitignore now matches them, and treats a submodule as a single entry. Fix the repository (git status should work), run outside git, or pass --discovery walk to accept those differences."
2946
2946
  );
@@ -3017,14 +3017,14 @@ function walkDirectory(dir, baseDir, rootReal, visited, reservedPaths = /* @__PU
3017
3017
  const results = { files: [], skipped: [] };
3018
3018
  const stack = [];
3019
3019
  const toolDirNames = toolDirNamesFor(reservedPaths);
3020
- const relativeToBase = (target) => path17__namespace.relative(baseDir, target).replace(/\\/g, "/") || ".";
3020
+ const relativeToBase = (target) => path22__namespace.relative(baseDir, target).replace(/\\/g, "/") || ".";
3021
3021
  const enter = (current, layers) => {
3022
3022
  if (visited.has(current)) return false;
3023
3023
  visited.add(current);
3024
3024
  const localRules = readGitignoreRules(current);
3025
3025
  const gitignoreLayers = localRules.length === 0 ? layers : [
3026
3026
  ...layers,
3027
- { prefix: path17__namespace.relative(baseDir, current).replace(/\\/g, "/"), rules: localRules }
3027
+ { prefix: path22__namespace.relative(baseDir, current).replace(/\\/g, "/"), rules: localRules }
3028
3028
  ];
3029
3029
  let entries;
3030
3030
  try {
@@ -3050,8 +3050,8 @@ function walkDirectory(dir, baseDir, rootReal, visited, reservedPaths = /* @__PU
3050
3050
  }
3051
3051
  const entry = frame.entries[frame.index];
3052
3052
  frame.index += 1;
3053
- const fullPath = path17__namespace.join(frame.dir, entry.name);
3054
- const relPath = path17__namespace.relative(baseDir, fullPath).replace(/\\/g, "/");
3053
+ const fullPath = path22__namespace.join(frame.dir, entry.name);
3054
+ const relPath = path22__namespace.relative(baseDir, fullPath).replace(/\\/g, "/");
3055
3055
  if (reservedPaths.has(relPath)) continue;
3056
3056
  if (entry.isDirectory() && DEFAULT_IGNORED_DIRS.includes(entry.name)) {
3057
3057
  results.skipped.push({
@@ -3121,7 +3121,7 @@ function walkDirectory(dir, baseDir, rootReal, visited, reservedPaths = /* @__PU
3121
3121
  });
3122
3122
  continue;
3123
3123
  }
3124
- const targetRelative = path17__namespace.relative(rootReal, targetReal).split(path17__namespace.sep).join("/");
3124
+ const targetRelative = path22__namespace.relative(rootReal, targetReal).split(path22__namespace.sep).join("/");
3125
3125
  if (isSensitivePath(targetRelative)) {
3126
3126
  results.skipped.push({
3127
3127
  path: relPath,
@@ -3325,7 +3325,7 @@ var RESERVED_SECTIONS = [
3325
3325
  ];
3326
3326
  function parseOwnerBrief(filePath, text2) {
3327
3327
  const problems = [];
3328
- const source = text2.replace(/^\uFEFF/, "");
3328
+ const source = text2.replace(/^\uFEFF/, "").replace(/<!--[\s\S]*?-->/g, "");
3329
3329
  const preamble = [];
3330
3330
  const sections = [];
3331
3331
  let current = null;
@@ -3379,7 +3379,7 @@ function parseOwnerBrief(filePath, text2) {
3379
3379
  }
3380
3380
  const ownerName = canonicalOwner.get(key);
3381
3381
  if (ownerName !== void 0) {
3382
- recognised[ownerName] = body;
3382
+ if (body.length > 0) recognised[ownerName] = body;
3383
3383
  continue;
3384
3384
  }
3385
3385
  notes.push({ heading: section.heading, body });
@@ -3436,7 +3436,7 @@ var CONFIG_FILENAMES = [
3436
3436
  ];
3437
3437
  function findConfigFile(cwd) {
3438
3438
  for (const filename of CONFIG_FILENAMES) {
3439
- const fullPath = path17__namespace.join(cwd, filename);
3439
+ const fullPath = path22__namespace.join(cwd, filename);
3440
3440
  let stats = null;
3441
3441
  try {
3442
3442
  stats = fs16__namespace.statSync(fullPath);
@@ -3446,7 +3446,7 @@ function findConfigFile(cwd) {
3446
3446
  }
3447
3447
  if (stats.isFile()) return fullPath;
3448
3448
  }
3449
- const pkgJsonPath = path17__namespace.join(cwd, "package.json");
3449
+ const pkgJsonPath = path22__namespace.join(cwd, "package.json");
3450
3450
  if (!fs16__namespace.existsSync(pkgJsonPath)) return null;
3451
3451
  try {
3452
3452
  const parsed = JSON.parse(stripJsonComments(fs16__namespace.readFileSync(pkgJsonPath, "utf8")));
@@ -3689,7 +3689,7 @@ async function importConfigModule(fullPath) {
3689
3689
  function attachConfigDir(config, filePath) {
3690
3690
  if (typeof config === "object" && config !== null) {
3691
3691
  Object.defineProperty(config, CONFIG_DIR_SYMBOL, {
3692
- value: path17__namespace.dirname(filePath),
3692
+ value: path22__namespace.dirname(filePath),
3693
3693
  enumerable: false,
3694
3694
  configurable: true
3695
3695
  });
@@ -3701,7 +3701,7 @@ async function loadConfigFileDetailed(cwd, options = {}) {
3701
3701
  const errors = [];
3702
3702
  const configDirectories = [];
3703
3703
  for (const filename of CONFIG_FILENAMES) {
3704
- const fullPath = path17__namespace.join(cwd, filename);
3704
+ const fullPath = path22__namespace.join(cwd, filename);
3705
3705
  let candidateStats = null;
3706
3706
  try {
3707
3707
  candidateStats = fs16__namespace.statSync(fullPath);
@@ -3754,7 +3754,7 @@ async function loadConfigFileDetailed(cwd, options = {}) {
3754
3754
  continue;
3755
3755
  }
3756
3756
  }
3757
- const pkgJsonPath = path17__namespace.join(cwd, "package.json");
3757
+ const pkgJsonPath = path22__namespace.join(cwd, "package.json");
3758
3758
  if (fs16__namespace.existsSync(pkgJsonPath)) {
3759
3759
  try {
3760
3760
  const parsed = parseJsonish(fs16__namespace.readFileSync(pkgJsonPath, "utf8"), pkgJsonPath);
@@ -3909,7 +3909,7 @@ function readConfiguredBrief(cwd, value) {
3909
3909
  "brief must be a path to a markdown file (received " + describeValue2(value) + ")."
3910
3910
  );
3911
3911
  }
3912
- const filePath = path17__namespace.resolve(cwd, value);
3912
+ const filePath = path22__namespace.resolve(cwd, value);
3913
3913
  let text2;
3914
3914
  try {
3915
3915
  if (!fs16__namespace.statSync(filePath).isFile()) throw new Error("not a file");
@@ -4025,9 +4025,9 @@ function resolveKindRules(value) {
4025
4025
  function outputExcludePatterns(cwd, outDir, tmpDir) {
4026
4026
  const patterns = [];
4027
4027
  for (const dir of [outDir, tmpDir]) {
4028
- const absolute = path17__namespace.resolve(cwd, dir);
4029
- const relative15 = path17__namespace.relative(cwd, absolute);
4030
- if (!relative15 || relative15 === ".." || relative15.startsWith(`..${path17__namespace.sep}`) || path17__namespace.isAbsolute(relative15)) {
4028
+ const absolute = path22__namespace.resolve(cwd, dir);
4029
+ const relative15 = path22__namespace.relative(cwd, absolute);
4030
+ if (!relative15 || relative15 === ".." || relative15.startsWith(`..${path22__namespace.sep}`) || path22__namespace.isAbsolute(relative15)) {
4031
4031
  continue;
4032
4032
  }
4033
4033
  patterns.push(`${relative15.replace(/\\/g, "/")}/**`);
@@ -4160,7 +4160,7 @@ function resolveCandidateCwd(userConfig, cliOptions, baseDir) {
4160
4160
  );
4161
4161
  }
4162
4162
  const candidate = cliOptions?.cwd || userConfig?.cwd || baseDir || process.cwd();
4163
- const resolved = path17__namespace.resolve(candidate);
4163
+ const resolved = path22__namespace.resolve(candidate);
4164
4164
  if (!fs16__namespace.existsSync(resolved)) {
4165
4165
  throw new Error(`Working directory does not exist: ${resolved}`);
4166
4166
  }
@@ -4579,7 +4579,7 @@ var PYTHON_SUFFIXES = [".py", ".pyi", "/__init__.py", "/__init__.pyi"];
4579
4579
  var CASE_INSENSITIVE_FILESYSTEM = process.platform === "win32" || process.platform === "darwin";
4580
4580
  var TSCONFIG_CACHE = /* @__PURE__ */ new Map();
4581
4581
  function tsconfigPathsFor(cwd) {
4582
- const configPath = path17__namespace.join(cwd, "tsconfig.json");
4582
+ const configPath = path22__namespace.join(cwd, "tsconfig.json");
4583
4583
  let stats;
4584
4584
  try {
4585
4585
  stats = fs16__namespace.statSync(configPath);
@@ -4616,8 +4616,8 @@ function tsconfigPathsFor(cwd) {
4616
4616
  return value;
4617
4617
  }
4618
4618
  function repositoryRelative(cwd, target) {
4619
- const relative15 = path17__namespace.relative(cwd, target).replace(/\\/g, "/");
4620
- return relative15.length === 0 || !relative15.startsWith("..") && !path17__namespace.isAbsolute(relative15) ? relative15 : null;
4619
+ const relative15 = path22__namespace.relative(cwd, target).replace(/\\/g, "/");
4620
+ return relative15.length === 0 || !relative15.startsWith("..") && !path22__namespace.isAbsolute(relative15) ? relative15 : null;
4621
4621
  }
4622
4622
  function rememberFirst(map, key, value) {
4623
4623
  if (!map.has(key)) map.set(key, value);
@@ -4632,15 +4632,15 @@ function buildImportResolver(files, options = {}) {
4632
4632
  if (CASE_INSENSITIVE_FILESYSTEM) {
4633
4633
  rememberFirst(byPathFolded, relativePath.toLowerCase(), relativePath);
4634
4634
  }
4635
- const extension = path17__namespace.posix.extname(relativePath);
4635
+ const extension = path22__namespace.posix.extname(relativePath);
4636
4636
  if (!SOURCE_EXTENSIONS.has(extension)) return;
4637
4637
  const stem = relativePath.slice(0, -extension.length);
4638
4638
  rememberFirst(byStem, stem, relativePath);
4639
4639
  if (CASE_INSENSITIVE_FILESYSTEM) {
4640
4640
  rememberFirst(byStemFolded, stem.toLowerCase(), relativePath);
4641
4641
  }
4642
- if (path17__namespace.posix.basename(stem) === "index") {
4643
- const directory = path17__namespace.posix.dirname(stem);
4642
+ if (path22__namespace.posix.basename(stem) === "index") {
4643
+ const directory = path22__namespace.posix.dirname(stem);
4644
4644
  rememberFirst(byStem, directory, relativePath);
4645
4645
  if (CASE_INSENSITIVE_FILESYSTEM) {
4646
4646
  rememberFirst(byStemFolded, directory.toLowerCase(), relativePath);
@@ -4656,7 +4656,7 @@ function buildImportResolver(files, options = {}) {
4656
4656
  return { byPath, byPathFolded, byStem, byStemFolded, tsconfig: options.tsconfig ?? null };
4657
4657
  }
4658
4658
  function resolveSpecifier(fromFile, specifier, resolver) {
4659
- const extension = path17__namespace.posix.extname(fromFile).toLowerCase();
4659
+ const extension = path22__namespace.posix.extname(fromFile).toLowerCase();
4660
4660
  const exact = (key) => resolver.byPath.get(key) ?? (CASE_INSENSITIVE_FILESYSTEM ? resolver.byPathFolded.get(key.toLowerCase()) : void 0) ?? null;
4661
4661
  const firstOf = (candidates) => {
4662
4662
  for (const candidate of candidates) {
@@ -4679,34 +4679,34 @@ function resolveSpecifier(fromFile, specifier, resolver) {
4679
4679
  if (PYTHON_EXTENSIONS.has(extension) && specifier.startsWith(".")) {
4680
4680
  const dots = /^\.+/.exec(specifier)?.[0].length ?? 0;
4681
4681
  const rest = specifier.slice(dots).replace(/\./g, "/");
4682
- let base = path17__namespace.posix.dirname(fromFile);
4683
- for (let up = 1; up < dots; up += 1) base = path17__namespace.posix.dirname(base);
4684
- const joined2 = rest ? path17__namespace.posix.normalize(path17__namespace.posix.join(base, rest)) : base;
4682
+ let base = path22__namespace.posix.dirname(fromFile);
4683
+ for (let up = 1; up < dots; up += 1) base = path22__namespace.posix.dirname(base);
4684
+ const joined2 = rest ? path22__namespace.posix.normalize(path22__namespace.posix.join(base, rest)) : base;
4685
4685
  return firstOf([joined2, ...PYTHON_SUFFIXES.map((suffix) => `${joined2}${suffix}`)]);
4686
4686
  }
4687
4687
  if (RUBY_EXTENSIONS.has(extension) && specifier.startsWith("./")) {
4688
- const joined2 = path17__namespace.posix.normalize(
4689
- path17__namespace.posix.join(path17__namespace.posix.dirname(fromFile), specifier)
4688
+ const joined2 = path22__namespace.posix.normalize(
4689
+ path22__namespace.posix.join(path22__namespace.posix.dirname(fromFile), specifier)
4690
4690
  );
4691
4691
  return firstOf([`${joined2}.rb`, joined2]);
4692
4692
  }
4693
4693
  if (C_EXTENSIONS.has(extension) && specifier.startsWith("./")) {
4694
- const joined2 = path17__namespace.posix.normalize(
4695
- path17__namespace.posix.join(path17__namespace.posix.dirname(fromFile), specifier)
4694
+ const joined2 = path22__namespace.posix.normalize(
4695
+ path22__namespace.posix.join(path22__namespace.posix.dirname(fromFile), specifier)
4696
4696
  );
4697
4697
  return exact(joined2);
4698
4698
  }
4699
4699
  if (extension === ".dart" && !specifier.includes(":")) {
4700
- const joined2 = path17__namespace.posix.normalize(
4701
- path17__namespace.posix.join(path17__namespace.posix.dirname(fromFile), specifier)
4700
+ const joined2 = path22__namespace.posix.normalize(
4701
+ path22__namespace.posix.join(path22__namespace.posix.dirname(fromFile), specifier)
4702
4702
  );
4703
4703
  return firstOf([joined2, `${joined2}.dart`]);
4704
4704
  }
4705
4705
  if (!RELATIVE_SPECIFIER.test(specifier)) {
4706
4706
  return resolveTsconfigSpecifier(specifier, resolver, lookupPath);
4707
4707
  }
4708
- const joined = path17__namespace.posix.normalize(
4709
- path17__namespace.posix.join(path17__namespace.posix.dirname(fromFile), specifier)
4708
+ const joined = path22__namespace.posix.normalize(
4709
+ path22__namespace.posix.join(path22__namespace.posix.dirname(fromFile), specifier)
4710
4710
  );
4711
4711
  return lookupPath(joined);
4712
4712
  }
@@ -4730,13 +4730,13 @@ function resolveTsconfigSpecifier(specifier, resolver, lookupPath) {
4730
4730
  if (captured === null) continue;
4731
4731
  for (const target of rule.targets) {
4732
4732
  const substituted = target.split("*").join(captured);
4733
- const base = config.baseUrl === null ? substituted : path17__namespace.posix.join(config.baseUrl, substituted);
4734
- const hit = lookupPath(path17__namespace.posix.normalize(base));
4733
+ const base = config.baseUrl === null ? substituted : path22__namespace.posix.join(config.baseUrl, substituted);
4734
+ const hit = lookupPath(path22__namespace.posix.normalize(base));
4735
4735
  if (hit) return hit;
4736
4736
  }
4737
4737
  }
4738
4738
  if (config.baseUrl !== null) {
4739
- return lookupPath(path17__namespace.posix.normalize(path17__namespace.posix.join(config.baseUrl, specifier)));
4739
+ return lookupPath(path22__namespace.posix.normalize(path22__namespace.posix.join(config.baseUrl, specifier)));
4740
4740
  }
4741
4741
  return null;
4742
4742
  }
@@ -5943,7 +5943,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
5943
5943
  ".so"
5944
5944
  ]);
5945
5945
  function isBinaryExtension(filePath) {
5946
- const ext = path17__namespace.extname(filePath).toLowerCase();
5946
+ const ext = path22__namespace.extname(filePath).toLowerCase();
5947
5947
  return BINARY_EXTENSIONS.has(ext);
5948
5948
  }
5949
5949
  function countControlBytes(buffer) {
@@ -6173,16 +6173,16 @@ function maskedPath(value, secretRules) {
6173
6173
  }
6174
6174
  function confineToDirectory(directory, filename) {
6175
6175
  if (filename.includes("\0")) return null;
6176
- if (path17__namespace.isAbsolute(filename)) return null;
6177
- const base = path17__namespace.resolve(directory);
6178
- const resolved = path17__namespace.resolve(base, filename);
6176
+ if (path22__namespace.isAbsolute(filename)) return null;
6177
+ const base = path22__namespace.resolve(directory);
6178
+ const resolved = path22__namespace.resolve(base, filename);
6179
6179
  const caseInsensitive = process.platform === "win32" || process.platform === "darwin";
6180
- const prefix = caseInsensitive ? `${base}${path17__namespace.sep}`.toLowerCase() : `${base}${path17__namespace.sep}`;
6180
+ const prefix = caseInsensitive ? `${base}${path22__namespace.sep}`.toLowerCase() : `${base}${path22__namespace.sep}`;
6181
6181
  const candidate = caseInsensitive ? resolved.toLowerCase() : resolved;
6182
6182
  return candidate.startsWith(prefix) ? resolved : null;
6183
6183
  }
6184
6184
  function findStagingDirectory(config) {
6185
- const tmpDir = path17__namespace.resolve(config.cwd, config.tmpDir);
6185
+ const tmpDir = path22__namespace.resolve(config.cwd, config.tmpDir);
6186
6186
  let entries;
6187
6187
  try {
6188
6188
  entries = fs16__namespace.readdirSync(tmpDir);
@@ -6191,11 +6191,11 @@ function findStagingDirectory(config) {
6191
6191
  }
6192
6192
  const runs = entries.filter((name) => name.startsWith("run-")).sort();
6193
6193
  const newest = runs[runs.length - 1];
6194
- return newest ? path17__namespace.join(tmpDir, newest) : null;
6194
+ return newest ? path22__namespace.join(tmpDir, newest) : null;
6195
6195
  }
6196
6196
  function describeMissingManifest(config, manifestPath) {
6197
- const outDir = path17__namespace.resolve(config.cwd, config.outDir);
6198
- const markerPath = path17__namespace.join(outDir, ".codebase-snapshot");
6197
+ const outDir = path22__namespace.resolve(config.cwd, config.outDir);
6198
+ const markerPath = path22__namespace.join(outDir, ".codebase-snapshot");
6199
6199
  let marker2 = null;
6200
6200
  try {
6201
6201
  if (fs16__namespace.existsSync(markerPath)) {
@@ -6234,7 +6234,7 @@ function sha256Hex(buffer) {
6234
6234
  return crypto3__namespace.createHash("sha256").update(buffer).digest("hex");
6235
6235
  }
6236
6236
  function wouldNowBeIncluded(cwd, relativePath) {
6237
- const absolutePath = path17__namespace.join(cwd, relativePath);
6237
+ const absolutePath = path22__namespace.join(cwd, relativePath);
6238
6238
  try {
6239
6239
  const stats = fs16__namespace.statSync(absolutePath);
6240
6240
  if (!stats.isFile()) return false;
@@ -6252,7 +6252,7 @@ var TRUNCATION_REASONS = /* @__PURE__ */ new Set([
6252
6252
  ]);
6253
6253
  function isConfinedRelative(value) {
6254
6254
  if (value.length === 0 || value.includes("\0") || value.includes("\\")) return false;
6255
- if (path17__namespace.isAbsolute(value)) return false;
6255
+ if (path22__namespace.isAbsolute(value)) return false;
6256
6256
  return !value.split("/").includes("..");
6257
6257
  }
6258
6258
  function describeManifestShapeProblem(value) {
@@ -6446,7 +6446,7 @@ function describeManifestShapeProblem(value) {
6446
6446
  if (typeof filename !== "string" || filename.trim() === "") {
6447
6447
  return 'a "parts" entry has no "filename"';
6448
6448
  }
6449
- if (filename.includes("/") || filename.includes("\\") || filename.includes("\0") || filename === "." || filename === ".." || path17__namespace.isAbsolute(filename)) {
6449
+ if (filename.includes("/") || filename.includes("\\") || filename.includes("\0") || filename === "." || filename === ".." || path22__namespace.isAbsolute(filename)) {
6450
6450
  return 'a "parts" entry "filename" must be a bare filename inside parts/';
6451
6451
  }
6452
6452
  if (currentSchema) {
@@ -6472,7 +6472,7 @@ function describeManifestShapeProblem(value) {
6472
6472
  function validateSnapshot(configInput) {
6473
6473
  assertUsableConfigInput(configInput);
6474
6474
  const config = isResolvedConfig(configInput) ? normalizeResolvedConfig(configInput) : resolveConfig(configInput);
6475
- const manifestPath = path17__namespace.resolve(config.cwd, config.outDir, "manifest.json");
6475
+ const manifestPath = path22__namespace.resolve(config.cwd, config.outDir, "manifest.json");
6476
6476
  if (!fs16__namespace.existsSync(manifestPath)) {
6477
6477
  return {
6478
6478
  valid: false,
@@ -6506,7 +6506,7 @@ function validateSnapshot(configInput) {
6506
6506
  }
6507
6507
  const drift = emptyDrift();
6508
6508
  const warnings = [];
6509
- const snapshotDir = path17__namespace.resolve(config.cwd, config.outDir);
6509
+ const snapshotDir = path22__namespace.resolve(config.cwd, config.outDir);
6510
6510
  const unreadableSkips = manifest.skipped.filter(
6511
6511
  (entry) => entry.reason === "missing" || entry.reason === "read-error"
6512
6512
  );
@@ -6609,7 +6609,7 @@ function validateSnapshot(configInput) {
6609
6609
  );
6610
6610
  return importsChangedFile(
6611
6611
  diskFile,
6612
- importsOfFile(diskFile, path17__namespace.join(config.cwd, diskFile)),
6612
+ importsOfFile(diskFile, path22__namespace.join(config.cwd, diskFile)),
6613
6613
  unchangedScope,
6614
6614
  dependentResolver
6615
6615
  );
@@ -6627,7 +6627,7 @@ function validateSnapshot(configInput) {
6627
6627
  // own output directory as a set of files missing from the snapshot, so a correct
6628
6628
  // snapshot was reported as drifting.
6629
6629
  toolOwnedPaths: [config.outDir, config.tmpDir].map(
6630
- (directory) => path17__namespace.relative(config.cwd, path17__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
6630
+ (directory) => path22__namespace.relative(config.cwd, path22__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
6631
6631
  ).filter((relative15) => relative15.length > 0 && !relative15.startsWith(".."))
6632
6632
  });
6633
6633
  for (const diskFile of collection.files) {
@@ -6653,7 +6653,7 @@ function validateSnapshot(configInput) {
6653
6653
  }
6654
6654
  let diskHash;
6655
6655
  try {
6656
- diskHash = sha256Hex(fs16__namespace.readFileSync(path17__namespace.join(config.cwd, diskFile)));
6656
+ diskHash = sha256Hex(fs16__namespace.readFileSync(path22__namespace.join(config.cwd, diskFile)));
6657
6657
  } catch (err) {
6658
6658
  if (err.code === "ENOENT") {
6659
6659
  drift.missingOnDisk.push(diskFile);
@@ -6697,7 +6697,7 @@ function validateSnapshot(configInput) {
6697
6697
  ...Object.values(config.budgets.byLayer)
6698
6698
  );
6699
6699
  const partNames = /* @__PURE__ */ new Set();
6700
- const partsDir = path17__namespace.join(snapshotDir, "parts");
6700
+ const partsDir = path22__namespace.join(snapshotDir, "parts");
6701
6701
  for (const part of manifest.parts) {
6702
6702
  if (!part || typeof part.filename !== "string") continue;
6703
6703
  partNames.add(part.filename);
@@ -7082,7 +7082,7 @@ function validateSnapshot(configInput) {
7082
7082
  ];
7083
7083
  for (const [key, artifact] of declaredArtifacts) {
7084
7084
  if (!artifact) continue;
7085
- const artifactPath = path17__namespace.join(snapshotDir, ...key.split("/"));
7085
+ const artifactPath = path22__namespace.join(snapshotDir, ...key.split("/"));
7086
7086
  let buffer;
7087
7087
  try {
7088
7088
  if (!fs16__namespace.statSync(artifactPath).isFile()) throw new Error("not a regular file");
@@ -7099,9 +7099,9 @@ function validateSnapshot(configInput) {
7099
7099
  for (const match of buffer.toString("utf8").matchAll(/\]\(([^)\s]+)\)/g)) {
7100
7100
  const target = match[1].split("#")[0];
7101
7101
  if (target.length === 0 || /^[a-z][a-z0-9+.-]*:/i.test(target)) continue;
7102
- const resolved = path17__namespace.resolve(snapshotDir, "reports", target);
7103
- const relative15 = path17__namespace.relative(snapshotDir, resolved);
7104
- if (relative15.startsWith("..") || path17__namespace.isAbsolute(relative15) || !fs16__namespace.existsSync(resolved)) {
7102
+ const resolved = path22__namespace.resolve(snapshotDir, "reports", target);
7103
+ const relative15 = path22__namespace.relative(snapshotDir, resolved);
7104
+ if (relative15.startsWith("..") || path22__namespace.isAbsolute(relative15) || !fs16__namespace.existsSync(resolved)) {
7105
7105
  drift.partIssues.push({
7106
7106
  part: key,
7107
7107
  issue: `links to ${maskedPath(target, config.secretRules)}, which does not exist in the snapshot`
@@ -7114,7 +7114,7 @@ function validateSnapshot(configInput) {
7114
7114
  if (sarifArtifact) {
7115
7115
  const sarifKey = "reports/audit.sarif";
7116
7116
  try {
7117
- const buffer = fs16__namespace.readFileSync(path17__namespace.join(snapshotDir, "reports", "audit.sarif"));
7117
+ const buffer = fs16__namespace.readFileSync(path22__namespace.join(snapshotDir, "reports", "audit.sarif"));
7118
7118
  if (sha256Hex(buffer) !== sarifArtifact.sha256 || buffer.length !== sarifArtifact.byteSize) {
7119
7119
  drift.partIssues.push({ part: sarifKey, issue: "artifact does not match its recorded digest" });
7120
7120
  }
@@ -7402,7 +7402,7 @@ function loadManifest(target) {
7402
7402
  } catch {
7403
7403
  throw new Error(`No snapshot found at ${target}: the path does not exist.`);
7404
7404
  }
7405
- const manifestPath = isDirectory ? path17__namespace.join(target, "manifest.json") : target;
7405
+ const manifestPath = isDirectory ? path22__namespace.join(target, "manifest.json") : target;
7406
7406
  let raw;
7407
7407
  try {
7408
7408
  raw = fs16__namespace.readFileSync(manifestPath, "utf8");
@@ -7638,10 +7638,10 @@ var LANGUAGE_BY_BASENAME = {
7638
7638
  };
7639
7639
  function detectLanguage(filePath) {
7640
7640
  const normalized = filePath.replace(/\\/g, "/");
7641
- const base = path17__namespace.posix.basename(normalized);
7641
+ const base = path22__namespace.posix.basename(normalized);
7642
7642
  if (LANGUAGE_BY_BASENAME[base]) return LANGUAGE_BY_BASENAME[base];
7643
7643
  if (base === ".env" || base.startsWith(".env.")) return "dotenv";
7644
- const ext = path17__namespace.posix.extname(base).toLowerCase();
7644
+ const ext = path22__namespace.posix.extname(base).toLowerCase();
7645
7645
  return LANGUAGE_BY_EXTENSION[ext] ?? "text";
7646
7646
  }
7647
7647
 
@@ -7683,13 +7683,13 @@ function describeMatcher(matcher) {
7683
7683
  return String(matcher);
7684
7684
  }
7685
7685
  function normalizeTarget(cwd, target) {
7686
- const resolvedCwd = path17__namespace.resolve(cwd);
7687
- const absolute = path17__namespace.resolve(resolvedCwd, target);
7688
- const relative15 = path17__namespace.relative(resolvedCwd, absolute);
7689
- if (relative15 === "" || relative15 === ".." || relative15.startsWith(`..${path17__namespace.sep}`) || path17__namespace.isAbsolute(relative15)) {
7686
+ const resolvedCwd = path22__namespace.resolve(cwd);
7687
+ const absolute = path22__namespace.resolve(resolvedCwd, target);
7688
+ const relative15 = path22__namespace.relative(resolvedCwd, absolute);
7689
+ if (relative15 === "" || relative15 === ".." || relative15.startsWith(`..${path22__namespace.sep}`) || path22__namespace.isAbsolute(relative15)) {
7690
7690
  return { relative: target.replace(/\\/g, "/"), outsideRoot: true };
7691
7691
  }
7692
- return { relative: relative15.split(path17__namespace.sep).join("/"), outsideRoot: false };
7692
+ return { relative: relative15.split(path22__namespace.sep).join("/"), outsideRoot: false };
7693
7693
  }
7694
7694
  function findRuleMatch(rules, relativePath) {
7695
7695
  return rules.find(
@@ -7708,7 +7708,7 @@ function findRecordedAncestor(skipped, relative15, maskedPath2) {
7708
7708
  return nearest;
7709
7709
  }
7710
7710
  function readManifest2(config) {
7711
- const manifestPath = path17__namespace.resolve(config.cwd, config.outDir, "manifest.json");
7711
+ const manifestPath = path22__namespace.resolve(config.cwd, config.outDir, "manifest.json");
7712
7712
  try {
7713
7713
  return JSON.parse(fs16__namespace.readFileSync(manifestPath, "utf8"));
7714
7714
  } catch {
@@ -7728,7 +7728,7 @@ function explainPath(config, target) {
7728
7728
  detail: "path resolves outside the configured repository root and was not inspected"
7729
7729
  };
7730
7730
  }
7731
- const absolute = path17__namespace.join(config.cwd, relative15);
7731
+ const absolute = path22__namespace.join(config.cwd, relative15);
7732
7732
  const result = {
7733
7733
  path: maskedPath2,
7734
7734
  exists: fs16__namespace.existsSync(absolute),
@@ -7745,7 +7745,7 @@ function explainPath(config, target) {
7745
7745
  // Same exclusion `generate` applies, so `explain` never says "not-discovered" about a file
7746
7746
  // that is only missing because the walker dropped the tool's own output directory.
7747
7747
  toolOwnedPaths: [config.outDir, config.tmpDir].map(
7748
- (directory) => path17__namespace.relative(config.cwd, path17__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
7748
+ (directory) => path22__namespace.relative(config.cwd, path22__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
7749
7749
  ).filter((relative16) => relative16.length > 0 && !relative16.startsWith(".."))
7750
7750
  });
7751
7751
  if (!collection.files.includes(relative15)) {
@@ -7949,7 +7949,7 @@ function canonicalIgnorePattern(line) {
7949
7949
  function appendGitignoreEntries(cwd, entries) {
7950
7950
  const wanted = [...new Set(entries)].filter((entry) => entry.trim().length > 0);
7951
7951
  if (wanted.length === 0) return { added: [], note: null };
7952
- const ignorePath = path17__namespace.join(cwd, ".gitignore");
7952
+ const ignorePath = path22__namespace.join(cwd, ".gitignore");
7953
7953
  const manual = `Add ${wanted.map((entry) => `"${entry}"`).join(" and ")} to your .gitignore yourself.`;
7954
7954
  let decoded = { text: "", bom: Buffer.alloc(0), encoding: "utf8" };
7955
7955
  try {
@@ -7989,9 +7989,59 @@ function appendGitignoreEntries(cwd, entries) {
7989
7989
  return { added, note: null };
7990
7990
  }
7991
7991
  function gitignorePath(cwd, filePath) {
7992
- return path17__namespace.relative(cwd, filePath).split(path17__namespace.sep).join("/");
7992
+ return path22__namespace.relative(cwd, filePath).split(path22__namespace.sep).join("/");
7993
7993
  }
7994
7994
 
7995
+ // src/wizard/brief-template.ts
7996
+ var BRIEF_SCAFFOLD_FILE = "BRIEF.md";
7997
+ var BRIEF_SCAFFOLD = [
7998
+ "<!-- BRIEF.md \u2014 the half of PROMPT.md only you can write.",
7999
+ "",
8000
+ " `snapshot generate` writes the facts: which files are here, which were skipped and why,",
8001
+ " the system map, the history, the standard, the coverage. It cannot know what the software",
8002
+ " is for, what has already gone wrong, or which failures this team would recognise.",
8003
+ " That is judgement, so it lives here.",
8004
+ "",
8005
+ " Five headings are merged into PROMPT.md:",
8006
+ " ## Stakes what breaks if this is wrong, and who carries it",
8007
+ " ## The system how the pieces fit, in your words",
8008
+ " ## What came before the rounds you have already run, and what they cost",
8009
+ " ## The bar what a finding has to do to be believed here",
8010
+ " ## Calibration failures from your own history, one line each",
8011
+ "",
8012
+ " Any other `##` heading is kept under Owner notes. A measured heading (Coverage,",
8013
+ " This snapshot, ...) is refused, because prose must not overwrite a measurement.",
8014
+ " Leave a section empty and it is simply not rendered. The file is capped at 64 KiB.",
8015
+ " -->",
8016
+ "",
8017
+ "## Stakes",
8018
+ "",
8019
+ "<!-- What breaks if this is wrong? Who carries the consequence? One paragraph. -->",
8020
+ "",
8021
+ "## The system",
8022
+ "",
8023
+ "<!-- How the pieces fit: the boundaries, the protocol between them, the rule that holds it",
8024
+ " together. The generated brief adds the file counts, importers and entry points beside",
8025
+ ' this, under "What the index records". -->',
8026
+ "",
8027
+ "## What came before",
8028
+ "",
8029
+ "<!-- The rounds already run: what was found, what was fixed, what keeps coming back. -->",
8030
+ "",
8031
+ "## The bar",
8032
+ "",
8033
+ "<!-- What a finding must do to be believed here: the lines, the state that reaches them, the",
8034
+ " test that would have caught it. Drop this section to keep the built-in standard. -->",
8035
+ "",
8036
+ "## Calibration",
8037
+ "",
8038
+ "<!-- Two or three real failures, one line each, in the shape you want them reported:",
8039
+ " - a grant signed for one recipe executing another recipe's deletions",
8040
+ " - a recipe that never worked, because its test supplied a number where the daemon sends a string",
8041
+ " -->",
8042
+ ""
8043
+ ].join("\n");
8044
+
7995
8045
  // src/wizard/config-template.ts
7996
8046
  var DEFAULT_ANSWERS = {
7997
8047
  maxPartBytes: "300k",
@@ -8141,7 +8191,8 @@ function renderConfig(answers) {
8141
8191
  // adding a part as the code grows. The plan in PROMPT.md becomes a fixed-length attachment list.
8142
8192
  // maxParts: 10,
8143
8193
  // The owner-written half of PROMPT.md: Stakes, The system, What came before, The bar, Calibration.
8144
- // brief: "docs/brief.md",
8194
+ // Any other heading is kept as Owner notes; a measured heading is refused. Capped at 64 KiB.
8195
+ ${answers.brief === void 0 ? '// brief: "docs/brief.md",' : `brief: ${JSON.stringify(answers.brief)},`}
8145
8196
  // Which job the brief is written for: audit, review or explain.
8146
8197
  // promptTask: "audit",
8147
8198
  // afterGenerate: (manifest) => { /* write your own artifact */ }
@@ -8538,7 +8589,7 @@ function parsePackageJson(raw) {
8538
8589
  }
8539
8590
  function readPackageJson(cwd) {
8540
8591
  try {
8541
- return parsePackageJson(fs16__namespace.readFileSync(path17__namespace.join(cwd, "package.json"), "utf8"));
8592
+ return parsePackageJson(fs16__namespace.readFileSync(path22__namespace.join(cwd, "package.json"), "utf8"));
8542
8593
  } catch {
8543
8594
  return null;
8544
8595
  }
@@ -8658,7 +8709,7 @@ function serializePackageJson(raw, value) {
8658
8709
  return `${bom}${text2}${raw.endsWith("\n") ? crlf ? "\r\n" : "\n" : ""}`;
8659
8710
  }
8660
8711
  function updatePackageJson(cwd, notes) {
8661
- const packagePath = path17__namespace.join(cwd, "package.json");
8712
+ const packagePath = path22__namespace.join(cwd, "package.json");
8662
8713
  const unchanged = {
8663
8714
  scripts: [],
8664
8715
  dependency: { name: GENERATOR_NAME, range: null, added: false }
@@ -8745,8 +8796,8 @@ function gitignoreEntriesFor(cwd, outDir, tmpDir) {
8745
8796
  const entries = [];
8746
8797
  for (const directory of [outDir, tmpDir]) {
8747
8798
  if (directory === null) continue;
8748
- const relative15 = path17__namespace.relative(cwd, path17__namespace.resolve(cwd, directory)).replace(/\\/g, "/");
8749
- if (relative15 === "" || relative15 === "." || relative15.startsWith("..") || path17__namespace.isAbsolute(relative15)) {
8799
+ const relative15 = path22__namespace.relative(cwd, path22__namespace.resolve(cwd, directory)).replace(/\\/g, "/");
8800
+ if (relative15 === "" || relative15 === "." || relative15.startsWith("..") || path22__namespace.isAbsolute(relative15)) {
8750
8801
  continue;
8751
8802
  }
8752
8803
  entries.push(`/${relative15}/`);
@@ -8796,6 +8847,9 @@ async function runInit(options) {
8796
8847
  artifacts: artifactAnswers(options),
8797
8848
  includeSensitiveFiles: options.includeSensitiveFiles ?? DEFAULT_ANSWERS.includeSensitiveFiles,
8798
8849
  outDir: options.outDir ?? DEFAULT_ANSWERS.outDir
8850
+ // The scaffold is written below but not wired in: a config that points at a file the user
8851
+ // may delete would turn "delete the template" into "generate now fails". They enable it
8852
+ // when they have something to say, and the scaffold says how.
8799
8853
  };
8800
8854
  const interactive = isInteractive(io) && options.yes !== true;
8801
8855
  if (interactive) {
@@ -8998,7 +9052,7 @@ async function runInit(options) {
8998
9052
  const configText = renderConfig(answers);
8999
9053
  const preferredName = chooseConfigFileName(options.cwd);
9000
9054
  const presentConfigs = CONFIG_CANDIDATES.filter(
9001
- (name) => fs16__namespace.existsSync(path17__namespace.join(options.cwd, name))
9055
+ (name) => fs16__namespace.existsSync(path22__namespace.join(options.cwd, name))
9002
9056
  );
9003
9057
  const present = presentConfigs[0] ?? null;
9004
9058
  if (presentConfigs.length > 1) {
@@ -9007,7 +9061,7 @@ async function runInit(options) {
9007
9061
  );
9008
9062
  }
9009
9063
  const configName = present !== null && options.force ? present : preferredName;
9010
- const configPath = path17__namespace.join(options.cwd, configName);
9064
+ const configPath = path22__namespace.join(options.cwd, configName);
9011
9065
  const reused = present !== null && options.force !== true && options.reuseConfig === true;
9012
9066
  if (reused) notes.push(`Kept the existing ${present} instead of writing a new one.`);
9013
9067
  if (options.dryRun) {
@@ -9023,7 +9077,9 @@ async function runInit(options) {
9023
9077
  gitignoreEntries: [],
9024
9078
  dependency: { name: GENERATOR_NAME, range: `^${GENERATOR_VERSION}`, added: false },
9025
9079
  notes,
9026
- outDir: answers.outDir
9080
+ outDir: answers.outDir,
9081
+ briefPath: path22__namespace.join(options.cwd, BRIEF_SCAFFOLD_FILE),
9082
+ briefWritten: false
9027
9083
  };
9028
9084
  }
9029
9085
  if (present !== null && present !== preferredName && !options.force && !reused) {
@@ -9045,6 +9101,12 @@ async function runInit(options) {
9045
9101
  throw new Error(`${configName} already exists. Re-run with --force to replace it.`);
9046
9102
  }
9047
9103
  if (!reused) writeFileOrExplain(configPath, configText);
9104
+ const briefPath = path22__namespace.join(options.cwd, BRIEF_SCAFFOLD_FILE);
9105
+ let briefWritten = false;
9106
+ if (!fs16__namespace.existsSync(briefPath)) {
9107
+ writeFileOrExplain(briefPath, BRIEF_SCAFFOLD);
9108
+ briefWritten = true;
9109
+ }
9048
9110
  const { scripts, dependency } = updatePackageJson(options.cwd, notes);
9049
9111
  const ignore = appendGitignoreEntries(
9050
9112
  options.cwd,
@@ -9063,13 +9125,15 @@ async function runInit(options) {
9063
9125
  gitignoreEntries: ignore.added,
9064
9126
  dependency,
9065
9127
  notes,
9128
+ briefPath,
9129
+ briefWritten,
9066
9130
  outDir: answers.outDir
9067
9131
  };
9068
9132
  }
9069
9133
  function describeTarget(cwd) {
9070
- const relative15 = path17__namespace.relative(process.cwd(), cwd);
9134
+ const relative15 = path22__namespace.relative(process.cwd(), cwd);
9071
9135
  if (relative15 === "") return "this directory";
9072
- if (relative15.startsWith("..") || path17__namespace.isAbsolute(relative15)) return cwd;
9136
+ if (relative15.startsWith("..") || path22__namespace.isAbsolute(relative15)) return cwd;
9073
9137
  return relative15;
9074
9138
  }
9075
9139
  function firstRunMessage(reason, cwd) {
@@ -9101,7 +9165,7 @@ function isEffectivelyEmpty(cwd) {
9101
9165
  function hasPriorSnapshot(cwd, outDir) {
9102
9166
  let parsed;
9103
9167
  try {
9104
- parsed = JSON.parse(fs16__namespace.readFileSync(path17__namespace.join(cwd, outDir, ".codebase-snapshot"), "utf8"));
9168
+ parsed = JSON.parse(fs16__namespace.readFileSync(path22__namespace.join(cwd, outDir, ".codebase-snapshot"), "utf8"));
9105
9169
  } catch {
9106
9170
  return false;
9107
9171
  }
@@ -10639,7 +10703,7 @@ function readText(file) {
10639
10703
  }
10640
10704
  }
10641
10705
  function readDescription(cwd) {
10642
- const raw = readText(path17__namespace.join(cwd, "package.json"));
10706
+ const raw = readText(path22__namespace.join(cwd, "package.json"));
10643
10707
  if (raw === null) return {};
10644
10708
  try {
10645
10709
  const parsed = JSON.parse(stripJsonComments(raw));
@@ -10649,7 +10713,7 @@ function readDescription(cwd) {
10649
10713
  }
10650
10714
  }
10651
10715
  function readSummary(cwd) {
10652
- const raw = readText(path17__namespace.join(cwd, "README.md"));
10716
+ const raw = readText(path22__namespace.join(cwd, "README.md"));
10653
10717
  if (raw === null) return {};
10654
10718
  const text2 = raw.replace(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi, "\n").replace(/<\/(p|div|section|header|footer|li)>/gi, "\n").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
10655
10719
  const paragraph = [];
@@ -10675,7 +10739,7 @@ function truncate(text2, limit) {
10675
10739
  return (space > limit / 2 ? window.slice(0, space) : window).trim() + "\u2026";
10676
10740
  }
10677
10741
  function readReleases(cwd) {
10678
- const raw = readText(path17__namespace.join(cwd, "CHANGELOG.md"));
10742
+ const raw = readText(path22__namespace.join(cwd, "CHANGELOG.md"));
10679
10743
  if (raw === null) return [];
10680
10744
  const headings = raw.split(/\r?\n/).map((line) => /^##\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((heading) => heading !== void 0 && /^v?\d+\.\d+/.test(heading));
10681
10745
  return headings.slice(0, MAX_RELEASES);
@@ -10728,17 +10792,17 @@ function isNewer(candidate, current) {
10728
10792
  }
10729
10793
  function cacheDirectory(env = process.env, platform = process.platform) {
10730
10794
  if (platform === "win32") {
10731
- const base2 = env.LOCALAPPDATA ?? path17__namespace.join(os__namespace.homedir(), "AppData", "Local");
10732
- return path17__namespace.join(base2, "codebase-snapshot");
10795
+ const base2 = env.LOCALAPPDATA ?? path22__namespace.join(os__namespace.homedir(), "AppData", "Local");
10796
+ return path22__namespace.join(base2, "codebase-snapshot");
10733
10797
  }
10734
10798
  if (platform === "darwin") {
10735
- return path17__namespace.join(os__namespace.homedir(), "Library", "Caches", "codebase-snapshot");
10799
+ return path22__namespace.join(os__namespace.homedir(), "Library", "Caches", "codebase-snapshot");
10736
10800
  }
10737
- const base = env.XDG_CACHE_HOME ?? path17__namespace.join(os__namespace.homedir(), ".cache");
10738
- return path17__namespace.join(base, "codebase-snapshot");
10801
+ const base = env.XDG_CACHE_HOME ?? path22__namespace.join(os__namespace.homedir(), ".cache");
10802
+ return path22__namespace.join(base, "codebase-snapshot");
10739
10803
  }
10740
10804
  function cacheFilePath(env = process.env) {
10741
- return path17__namespace.join(cacheDirectory(env), "update-check.json");
10805
+ return path22__namespace.join(cacheDirectory(env), "update-check.json");
10742
10806
  }
10743
10807
  function shouldCheck(argv, env) {
10744
10808
  const disabled = ["1", "true", "yes"].includes(
@@ -10785,7 +10849,7 @@ function readCache(file) {
10785
10849
  }
10786
10850
  function writeCache(file, entry) {
10787
10851
  try {
10788
- fs16__namespace.mkdirSync(path17__namespace.dirname(file), { recursive: true });
10852
+ fs16__namespace.mkdirSync(path22__namespace.dirname(file), { recursive: true });
10789
10853
  fs16__namespace.writeFileSync(file, `${JSON.stringify(entry)}
10790
10854
  `, "utf8");
10791
10855
  } catch {
@@ -10917,7 +10981,7 @@ fi
10917
10981
  `;
10918
10982
  }
10919
10983
  function gitDirectory(cwd) {
10920
- const dotGit = path17__namespace.join(cwd, ".git");
10984
+ const dotGit = path22__namespace.join(cwd, ".git");
10921
10985
  let stats;
10922
10986
  try {
10923
10987
  stats = fs16__namespace.statSync(dotGit);
@@ -10931,22 +10995,22 @@ function gitDirectory(cwd) {
10931
10995
  const match = /^gitdir:\s*(.+)$/m.exec(contents);
10932
10996
  if (!match) return null;
10933
10997
  const target = match[1];
10934
- const resolved = path17__namespace.isAbsolute(target.trim()) ? target.trim() : path17__namespace.join(cwd, target.trim());
10998
+ const resolved = path22__namespace.isAbsolute(target.trim()) ? target.trim() : path22__namespace.join(cwd, target.trim());
10935
10999
  if (!fs16__namespace.statSync(resolved).isDirectory()) return null;
10936
- if (isInside2(path17__namespace.resolve(cwd), path17__namespace.resolve(resolved))) return resolved;
10937
- return isRegisteredWorktree(path17__namespace.resolve(resolved), cwd) ? resolved : null;
11000
+ if (isInside2(path22__namespace.resolve(cwd), path22__namespace.resolve(resolved))) return resolved;
11001
+ return isRegisteredWorktree(path22__namespace.resolve(resolved), cwd) ? resolved : null;
10938
11002
  } catch {
10939
11003
  return null;
10940
11004
  }
10941
11005
  }
10942
11006
  function isInside2(parent, child) {
10943
- const relative15 = path17__namespace.relative(parent, child);
10944
- return relative15 === "" || !relative15.startsWith("..") && !path17__namespace.isAbsolute(relative15);
11007
+ const relative15 = path22__namespace.relative(parent, child);
11008
+ return relative15 === "" || !relative15.startsWith("..") && !path22__namespace.isAbsolute(relative15);
10945
11009
  }
10946
11010
  function isRegisteredWorktree(gitDir, cwd) {
10947
11011
  try {
10948
- const back = fs16__namespace.readFileSync(path17__namespace.join(gitDir, "gitdir"), "utf8").trim();
10949
- return path17__namespace.resolve(gitDir, back) === path17__namespace.join(path17__namespace.resolve(cwd), ".git");
11012
+ const back = fs16__namespace.readFileSync(path22__namespace.join(gitDir, "gitdir"), "utf8").trim();
11013
+ return path22__namespace.resolve(gitDir, back) === path22__namespace.join(path22__namespace.resolve(cwd), ".git");
10950
11014
  } catch {
10951
11015
  return false;
10952
11016
  }
@@ -10967,10 +11031,10 @@ function gitOutput(cwd, args) {
10967
11031
  function configuredHooksDirectory(cwd) {
10968
11032
  const hooks = gitOutput(cwd, ["rev-parse", "--git-path", "hooks"]);
10969
11033
  if (hooks === null) return null;
10970
- const resolved = path17__namespace.resolve(cwd, hooks);
11034
+ const resolved = path22__namespace.resolve(cwd, hooks);
10971
11035
  const common = gitOutput(cwd, ["rev-parse", "--git-common-dir"]);
10972
- const commonDir = common === null ? null : path17__namespace.resolve(cwd, common);
10973
- if (isInside2(path17__namespace.resolve(cwd), resolved)) return { dir: resolved };
11036
+ const commonDir = common === null ? null : path22__namespace.resolve(cwd, common);
11037
+ if (isInside2(path22__namespace.resolve(cwd), resolved)) return { dir: resolved };
10974
11038
  if (commonDir !== null && isInside2(commonDir, resolved)) return { dir: resolved };
10975
11039
  return {
10976
11040
  refusal: `The hooks directory git reports (${resolved}) is outside this repository, so no hook was written. Add \`npx ${GENERATOR_NAME} validate\` to the hook manager that owns it instead.`
@@ -10991,8 +11055,8 @@ function installPreCommitHook(cwd, outDir = "snapshot") {
10991
11055
  ]
10992
11056
  };
10993
11057
  }
10994
- const hooksDir = configured === null ? path17__namespace.join(gitDir, "hooks") : configured.dir;
10995
- const hookPath = path17__namespace.join(hooksDir, "pre-commit");
11058
+ const hooksDir = configured === null ? path22__namespace.join(gitDir, "hooks") : configured.dir;
11059
+ const hookPath = path22__namespace.join(hooksDir, "pre-commit");
10996
11060
  try {
10997
11061
  fs16__namespace.mkdirSync(hooksDir, { recursive: true });
10998
11062
  } catch (err) {
@@ -11037,7 +11101,7 @@ function installPreCommitHook(cwd, outDir = "snapshot") {
11037
11101
  };
11038
11102
  }
11039
11103
  function workerEntry(directory, isCjs) {
11040
- const entry = path17__namespace.join(directory, isCjs ? "index.cjs" : "index.js");
11104
+ const entry = path22__namespace.join(directory, isCjs ? "index.cjs" : "index.js");
11041
11105
  return { path: entry, url: url.pathToFileURL(entry).href };
11042
11106
  }
11043
11107
  var WORKER_SOURCE = `
@@ -11104,7 +11168,7 @@ function generateInWorker(cwd, cliOptions, options = {}) {
11104
11168
  resolve12(result);
11105
11169
  };
11106
11170
  const isCjs = typeof __dirname !== "undefined";
11107
- const directory = isCjs ? __dirname : path17__namespace.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))));
11171
+ const directory = isCjs ? __dirname : path22__namespace.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href))));
11108
11172
  try {
11109
11173
  worker = new worker_threads.Worker(WORKER_SOURCE, {
11110
11174
  eval: true,
@@ -11415,11 +11479,11 @@ function verifyInMemory(files, parts, unaccounted) {
11415
11479
  return errors;
11416
11480
  }
11417
11481
  function resolveSafeOutputDirs(config) {
11418
- const cwd = path17__namespace.resolve(config.cwd);
11419
- const outDir = path17__namespace.resolve(cwd, config.outDir);
11420
- const tmpDir = path17__namespace.resolve(cwd, config.tmpDir);
11421
- const root = path17__namespace.parse(cwd).root;
11422
- const contains = (parent, child) => child === parent || child.startsWith(`${parent}${path17__namespace.sep}`);
11482
+ const cwd = path22__namespace.resolve(config.cwd);
11483
+ const outDir = path22__namespace.resolve(cwd, config.outDir);
11484
+ const tmpDir = path22__namespace.resolve(cwd, config.tmpDir);
11485
+ const root = path22__namespace.parse(cwd).root;
11486
+ const contains = (parent, child) => child === parent || child.startsWith(`${parent}${path22__namespace.sep}`);
11423
11487
  const reject = (reason) => {
11424
11488
  throw new Error(
11425
11489
  `Refusing to generate: ${reason}. outDir=${outDir} tmpDir=${tmpDir} cwd=${cwd}`
@@ -11509,7 +11573,7 @@ function listEntries(dir) {
11509
11573
  for (const child of children) {
11510
11574
  const relative15 = prefix === "" ? child.name : `${prefix}/${child.name}`;
11511
11575
  entries.push(relative15);
11512
- if (child.isDirectory()) walk(path17__namespace.join(absolute, child.name), relative15);
11576
+ if (child.isDirectory()) walk(path22__namespace.join(absolute, child.name), relative15);
11513
11577
  }
11514
11578
  };
11515
11579
  walk(dir, "");
@@ -11521,7 +11585,7 @@ function markerInventory(dir, written) {
11521
11585
  for (const entry of entries) {
11522
11586
  if (entry === OWNERSHIP_MARKER) continue;
11523
11587
  if (isIgnorableEntry(entry)) continue;
11524
- const full = path17__namespace.join(dir, ...entry.split("/"));
11588
+ const full = path22__namespace.join(dir, ...entry.split("/"));
11525
11589
  let stats;
11526
11590
  try {
11527
11591
  stats = fs16__namespace.lstatSync(full);
@@ -11557,7 +11621,7 @@ function markerPayload(dir, state, id, createdAt, written) {
11557
11621
  entries,
11558
11622
  files
11559
11623
  };
11560
- const manifestPath = path17__namespace.join(dir, "manifest.json");
11624
+ const manifestPath = path22__namespace.join(dir, "manifest.json");
11561
11625
  if (fs16__namespace.existsSync(manifestPath)) {
11562
11626
  marker2.manifestSha256 = sha256Hex2(fs16__namespace.readFileSync(manifestPath));
11563
11627
  }
@@ -11565,7 +11629,7 @@ function markerPayload(dir, state, id, createdAt, written) {
11565
11629
  }
11566
11630
  function writeOwnershipMarker(dir, marker2) {
11567
11631
  fs16__namespace.writeFileSync(
11568
- path17__namespace.join(dir, OWNERSHIP_MARKER),
11632
+ path22__namespace.join(dir, OWNERSHIP_MARKER),
11569
11633
  `${JSON.stringify(marker2, null, 2)}
11570
11634
  `,
11571
11635
  "utf8"
@@ -11577,7 +11641,7 @@ function markerBelongsTo(dir, id) {
11577
11641
  return evidence.marker.id === id;
11578
11642
  }
11579
11643
  function readOwnershipMarker(dir) {
11580
- const markerPath = path17__namespace.join(dir, OWNERSHIP_MARKER);
11644
+ const markerPath = path22__namespace.join(dir, OWNERSHIP_MARKER);
11581
11645
  if (!fs16__namespace.existsSync(markerPath)) {
11582
11646
  return { marker: null, problem: "it holds no .codebase-snapshot marker" };
11583
11647
  }
@@ -11683,7 +11747,7 @@ function verifyMarkerInventory(dir, entries, files) {
11683
11747
  for (const entry of entries) {
11684
11748
  if (entry === OWNERSHIP_MARKER) continue;
11685
11749
  if (IGNORABLE_ENTRIES.has(entry.slice(entry.lastIndexOf("/") + 1))) continue;
11686
- const full = path17__namespace.join(dir, ...entry.split("/"));
11750
+ const full = path22__namespace.join(dir, ...entry.split("/"));
11687
11751
  let stats;
11688
11752
  try {
11689
11753
  stats = fs16__namespace.lstatSync(full);
@@ -11732,7 +11796,7 @@ function assessSnapshotDirectory(dir) {
11732
11796
  marker: marker2
11733
11797
  };
11734
11798
  }
11735
- const manifestPath = path17__namespace.join(dir, "manifest.json");
11799
+ const manifestPath = path22__namespace.join(dir, "manifest.json");
11736
11800
  const hasManifest = fs16__namespace.existsSync(manifestPath);
11737
11801
  if (hasManifest) {
11738
11802
  let raw;
@@ -11838,7 +11902,7 @@ function containsNoFiles(dir) {
11838
11902
  }
11839
11903
  for (const entry of entries) {
11840
11904
  if (entry.isDirectory()) {
11841
- pending.push(path17__namespace.join(current, entry.name));
11905
+ pending.push(path22__namespace.join(current, entry.name));
11842
11906
  } else if (!IGNORABLE_ENTRIES.has(entry.name)) {
11843
11907
  return false;
11844
11908
  }
@@ -11880,7 +11944,7 @@ function assertStagingRootUsable(tmpDir, secretRules) {
11880
11944
  const entries = fs16__namespace.readdirSync(tmpDir);
11881
11945
  if (entries.length === 0) return;
11882
11946
  const foreign = entries.filter((name) => {
11883
- const full = path17__namespace.join(tmpDir, name);
11947
+ const full = path22__namespace.join(tmpDir, name);
11884
11948
  if (!name.startsWith(RUN_DIR_PREFIX)) return true;
11885
11949
  let stats;
11886
11950
  try {
@@ -11913,7 +11977,7 @@ function cleanStaleRunDirs(tmpDir) {
11913
11977
  }
11914
11978
  for (const name of entries) {
11915
11979
  if (!name.startsWith(RUN_DIR_PREFIX)) continue;
11916
- const full = path17__namespace.join(tmpDir, name);
11980
+ const full = path22__namespace.join(tmpDir, name);
11917
11981
  const { marker: marker2 } = readOwnershipMarker(full);
11918
11982
  if (marker2) {
11919
11983
  const created = Date.parse(marker2.createdAt);
@@ -11940,7 +12004,7 @@ function removeIfEmpty(dir) {
11940
12004
  }
11941
12005
  }
11942
12006
  function ensureParentDirectory(target, label) {
11943
- const parent = path17__namespace.dirname(target);
12007
+ const parent = path22__namespace.dirname(target);
11944
12008
  if (fs16__namespace.existsSync(parent) && !fs16__namespace.statSync(parent).isDirectory()) {
11945
12009
  throw new Error(
11946
12010
  `Refusing to create ${label} ${target}: ${parent} exists but is not a directory.`
@@ -12035,22 +12099,22 @@ function lockKeyFor(stagingRoot) {
12035
12099
  return sha256Hex2(key).slice(0, 16);
12036
12100
  }
12037
12101
  function canonicalLockTarget(targetPath2) {
12038
- const resolved = path17__namespace.resolve(targetPath2);
12102
+ const resolved = path22__namespace.resolve(targetPath2);
12039
12103
  let existing = resolved;
12040
12104
  const tail = [];
12041
12105
  for (; ; ) {
12042
12106
  try {
12043
- return path17__namespace.join(fs16__namespace.realpathSync(existing), ...tail);
12107
+ return path22__namespace.join(fs16__namespace.realpathSync(existing), ...tail);
12044
12108
  } catch {
12045
- const parent = path17__namespace.dirname(existing);
12109
+ const parent = path22__namespace.dirname(existing);
12046
12110
  if (parent === existing) return resolved;
12047
- tail.unshift(path17__namespace.basename(existing));
12111
+ tail.unshift(path22__namespace.basename(existing));
12048
12112
  existing = parent;
12049
12113
  }
12050
12114
  }
12051
12115
  }
12052
12116
  function lockPathFor(stagingRoot) {
12053
- return path17__namespace.join(os__namespace.tmpdir(), `codebase-snapshot-${lockKeyFor(stagingRoot)}.lock`);
12117
+ return path22__namespace.join(os__namespace.tmpdir(), `codebase-snapshot-${lockKeyFor(stagingRoot)}.lock`);
12054
12118
  }
12055
12119
  function lockHeartbeatAgeMs(lockPath) {
12056
12120
  try {
@@ -12135,8 +12199,8 @@ function swapIntoPlace(stagingDir, outDir, beforeSwap) {
12135
12199
  }
12136
12200
  function recoverInterruptedPublish(outDir) {
12137
12201
  if (fs16__namespace.existsSync(outDir)) return;
12138
- const parent = path17__namespace.dirname(outDir);
12139
- const base = path17__namespace.basename(outDir);
12202
+ const parent = path22__namespace.dirname(outDir);
12203
+ const base = path22__namespace.basename(outDir);
12140
12204
  let backups;
12141
12205
  try {
12142
12206
  backups = fs16__namespace.readdirSync(parent).filter((name) => name.startsWith(`${base}.backup-`));
@@ -12144,7 +12208,7 @@ function recoverInterruptedPublish(outDir) {
12144
12208
  return;
12145
12209
  }
12146
12210
  if (backups.length !== 1) return;
12147
- const backupDir = path17__namespace.join(parent, backups[0]);
12211
+ const backupDir = path22__namespace.join(parent, backups[0]);
12148
12212
  const { marker: marker2, problem } = readOwnershipMarker(backupDir);
12149
12213
  if (problem !== null || marker2 === null || marker2.state !== "complete") return;
12150
12214
  try {
@@ -12384,7 +12448,7 @@ function generateSnapshot(configInput, options) {
12384
12448
  // first run cannot have marked them yet, so the name alone keeps a run from recording its own
12385
12449
  // output — but only at these exact paths, not at every directory that shares the name.
12386
12450
  toolOwnedPaths: [config.outDir, config.tmpDir].map(
12387
- (directory) => path17__namespace.relative(config.cwd, path17__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
12451
+ (directory) => path22__namespace.relative(config.cwd, path22__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
12388
12452
  ).filter((relative15) => relative15.length > 0 && !relative15.startsWith("..")),
12389
12453
  // A staged path can be absent from the working tree while its index blob exists. Discovery
12390
12454
  // lists the working tree, so those paths would never reach the scan at all.
@@ -12413,7 +12477,7 @@ function generateSnapshot(configInput, options) {
12413
12477
  let totalSizeBytes = 0;
12414
12478
  let largeFileCount = 0;
12415
12479
  for (const relativePath of candidateFiles) {
12416
- const absolutePath = path17__namespace.join(config.cwd, relativePath);
12480
+ const absolutePath = path22__namespace.join(config.cwd, relativePath);
12417
12481
  const fromIndex = stagedPaths.has(relativePath);
12418
12482
  let buffer;
12419
12483
  let sizeBytes;
@@ -12446,7 +12510,7 @@ function generateSnapshot(configInput, options) {
12446
12510
  try {
12447
12511
  stats = fs16__namespace.statSync(absolutePath);
12448
12512
  if (!stats.isFile()) {
12449
- const nestedRepository = stats.isDirectory() && fs16__namespace.existsSync(path17__namespace.join(absolutePath, ".git"));
12513
+ const nestedRepository = stats.isDirectory() && fs16__namespace.existsSync(path22__namespace.join(absolutePath, ".git"));
12450
12514
  skipped.push(
12451
12515
  nestedRepository ? {
12452
12516
  path: relativePath,
@@ -12980,7 +13044,7 @@ function generateSnapshot(configInput, options) {
12980
13044
  cleanStaleRunDirs(tmpDir);
12981
13045
  const snapshotId = crypto3__namespace.randomUUID();
12982
13046
  const createdAt = (/* @__PURE__ */ new Date()).toISOString();
12983
- stagingDir = path17__namespace.join(tmpDir, `${RUN_DIR_PREFIX}${process.pid}-${snapshotId.slice(0, 8)}`);
13047
+ stagingDir = path22__namespace.join(tmpDir, `${RUN_DIR_PREFIX}${process.pid}-${snapshotId.slice(0, 8)}`);
12984
13048
  fs16__namespace.mkdirSync(stagingDir);
12985
13049
  writeOwnershipMarker(stagingDir, {
12986
13050
  generator: GENERATOR_NAME,
@@ -12991,15 +13055,15 @@ function generateSnapshot(configInput, options) {
12991
13055
  id: snapshotId,
12992
13056
  pid: process.pid
12993
13057
  });
12994
- const partsDir = path17__namespace.join(stagingDir, "parts");
12995
- const reportsDir = path17__namespace.join(stagingDir, "reports");
13058
+ const partsDir = path22__namespace.join(stagingDir, "parts");
13059
+ const reportsDir = path22__namespace.join(stagingDir, "reports");
12996
13060
  if (artifacts.parts) fs16__namespace.mkdirSync(partsDir, { recursive: true });
12997
13061
  if (artifacts.navigation || artifacts.projectTree || artifacts.audit || config.sarif === true) {
12998
13062
  fs16__namespace.mkdirSync(reportsDir, { recursive: true });
12999
13063
  }
13000
13064
  const writtenArtifacts = /* @__PURE__ */ new Map();
13001
13065
  const writeArtifact = (targetDir, relativeEntry, data) => {
13002
- const full = path17__namespace.join(targetDir, ...relativeEntry.split("/"));
13066
+ const full = path22__namespace.join(targetDir, ...relativeEntry.split("/"));
13003
13067
  fs16__namespace.writeFileSync(full, data, "utf8");
13004
13068
  const stats = fs16__namespace.statSync(full);
13005
13069
  writtenArtifacts.set(relativeEntry, {
@@ -13008,7 +13072,7 @@ function generateSnapshot(configInput, options) {
13008
13072
  });
13009
13073
  };
13010
13074
  const recordArtifact = (targetDir, relativeEntry) => {
13011
- const full = path17__namespace.join(targetDir, ...relativeEntry.split("/"));
13075
+ const full = path22__namespace.join(targetDir, ...relativeEntry.split("/"));
13012
13076
  const stats = fs16__namespace.statSync(full);
13013
13077
  writtenArtifacts.set(relativeEntry, {
13014
13078
  digest: {
@@ -13062,7 +13126,7 @@ function generateSnapshot(configInput, options) {
13062
13126
  const shipHookState = () => {
13063
13127
  if (!markerBelongsTo(outDir, snapshotId)) return;
13064
13128
  if (artifacts.manifest && manifest.warnings.length !== warningsBeforeHook) {
13065
- writeManifestAtomically(path17__namespace.join(outDir, "manifest.json"), manifest);
13129
+ writeManifestAtomically(path22__namespace.join(outDir, "manifest.json"), manifest);
13066
13130
  recordArtifact(outDir, "manifest.json");
13067
13131
  }
13068
13132
  writeOwnershipMarker(
@@ -13226,7 +13290,7 @@ function foldForComparison(value) {
13226
13290
  return process.platform === "win32" || process.platform === "darwin" ? value.toLowerCase() : value;
13227
13291
  }
13228
13292
  function canonicalPath(value) {
13229
- const absolute = path17__namespace.resolve(value);
13293
+ const absolute = path22__namespace.resolve(value);
13230
13294
  try {
13231
13295
  return fs16__namespace.realpathSync(absolute);
13232
13296
  } catch {
@@ -13236,26 +13300,26 @@ function canonicalPath(value) {
13236
13300
  function isInside3(parent, child) {
13237
13301
  const foldedParent = foldForComparison(parent);
13238
13302
  const foldedChild = foldForComparison(child);
13239
- return foldedChild === foldedParent || foldedChild.startsWith(`${foldedParent}${path17__namespace.sep}`);
13303
+ return foldedChild === foldedParent || foldedChild.startsWith(`${foldedParent}${path22__namespace.sep}`);
13240
13304
  }
13241
13305
  function resolveThroughExistingAncestor(target) {
13242
13306
  let existing = target;
13243
13307
  const missing = [];
13244
13308
  while (!fs16__namespace.existsSync(existing)) {
13245
- missing.unshift(path17__namespace.basename(existing));
13246
- const parent = path17__namespace.dirname(existing);
13309
+ missing.unshift(path22__namespace.basename(existing));
13310
+ const parent = path22__namespace.dirname(existing);
13247
13311
  if (parent === existing) break;
13248
13312
  existing = parent;
13249
13313
  }
13250
13314
  const resolved = canonicalPath(existing);
13251
- return missing.length === 0 ? resolved : path17__namespace.join(resolved, ...missing);
13315
+ return missing.length === 0 ? resolved : path22__namespace.join(resolved, ...missing);
13252
13316
  }
13253
13317
  function resolveRoot(requested, context) {
13254
13318
  if (requested !== void 0 && (typeof requested !== "string" || requested.trim().length === 0)) {
13255
13319
  return { ok: false, message: '"root" must be a non-empty string when provided.' };
13256
13320
  }
13257
13321
  const wanted = typeof requested === "string" ? requested.trim() : context.cwd;
13258
- const absolute = path17__namespace.resolve(context.cwd, wanted);
13322
+ const absolute = path22__namespace.resolve(context.cwd, wanted);
13259
13323
  let stats;
13260
13324
  try {
13261
13325
  stats = fs16__namespace.statSync(absolute);
@@ -13310,7 +13374,7 @@ async function openWorkspace(root, overrides = {}, allowedRoots, options = {}) {
13310
13374
  }
13311
13375
  const requested = overrides.outDir.trim();
13312
13376
  const permitted = allowedRoots !== void 0 && allowedRoots.length > 0 ? allowedRoots : [root];
13313
- const resolved = resolveThroughExistingAncestor(path17__namespace.resolve(root, requested));
13377
+ const resolved = resolveThroughExistingAncestor(path22__namespace.resolve(root, requested));
13314
13378
  if (!permitted.some((allowed) => isInside3(canonicalPath(allowed), resolved))) {
13315
13379
  const shown = permitted.map((allowed) => canonicalPath(allowed)).join(", ");
13316
13380
  return {
@@ -13343,14 +13407,14 @@ async function openWorkspace(root, overrides = {}, allowedRoots, options = {}) {
13343
13407
  var MANIFEST_CACHE_LIMIT = 8;
13344
13408
  var manifestCache = /* @__PURE__ */ new Map();
13345
13409
  function manifestPathFor(workspace) {
13346
- return path17__namespace.resolve(workspace.root, workspace.config.outDir, "manifest.json");
13410
+ return path22__namespace.resolve(workspace.root, workspace.config.outDir, "manifest.json");
13347
13411
  }
13348
13412
  function partPathFor(workspace, filename) {
13349
13413
  if (filename.length === 0 || filename.includes("\0")) return null;
13350
- const partsDir = path17__namespace.resolve(workspace.root, workspace.config.outDir, "parts");
13351
- const resolved = path17__namespace.resolve(partsDir, filename);
13352
- const relative15 = path17__namespace.relative(partsDir, resolved);
13353
- if (relative15.length === 0 || relative15.includes(path17__namespace.sep) || relative15.includes("/") || relative15.includes("\\") || path17__namespace.isAbsolute(relative15)) {
13414
+ const partsDir = path22__namespace.resolve(workspace.root, workspace.config.outDir, "parts");
13415
+ const resolved = path22__namespace.resolve(partsDir, filename);
13416
+ const relative15 = path22__namespace.relative(partsDir, resolved);
13417
+ if (relative15.length === 0 || relative15.includes(path22__namespace.sep) || relative15.includes("/") || relative15.includes("\\") || path22__namespace.isAbsolute(relative15)) {
13354
13418
  return null;
13355
13419
  }
13356
13420
  let stats;
@@ -13361,7 +13425,7 @@ function partPathFor(workspace, filename) {
13361
13425
  }
13362
13426
  if (!stats.isFile()) return null;
13363
13427
  try {
13364
- if (path17__namespace.dirname(fs16__namespace.realpathSync(resolved)) !== fs16__namespace.realpathSync(partsDir)) return null;
13428
+ if (path22__namespace.dirname(fs16__namespace.realpathSync(resolved)) !== fs16__namespace.realpathSync(partsDir)) return null;
13365
13429
  } catch {
13366
13430
  return null;
13367
13431
  }
@@ -13369,7 +13433,7 @@ function partPathFor(workspace, filename) {
13369
13433
  }
13370
13434
  function readManifest3(workspace) {
13371
13435
  const file = manifestPathFor(workspace);
13372
- const shown = path17__namespace.relative(workspace.root, file).split(path17__namespace.sep).join("/") || file;
13436
+ const shown = path22__namespace.relative(workspace.root, file).split(path22__namespace.sep).join("/") || file;
13373
13437
  let stats;
13374
13438
  try {
13375
13439
  stats = fs16__namespace.statSync(file);
@@ -13498,7 +13562,7 @@ function formatBytes(bytes) {
13498
13562
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
13499
13563
  }
13500
13564
  function relativeFor(workspace, absolute) {
13501
- return path17__namespace.relative(workspace.root, absolute).split(path17__namespace.sep).join("/");
13565
+ return path22__namespace.relative(workspace.root, absolute).split(path22__namespace.sep).join("/");
13502
13566
  }
13503
13567
  function capped(values, limit = 20) {
13504
13568
  return { count: values.length, sample: values.slice(0, limit) };
@@ -13517,13 +13581,13 @@ function summarizeDrift(drift) {
13517
13581
  function toRelativePath(root, value) {
13518
13582
  const cleaned = value.trim();
13519
13583
  if (cleaned.length === 0 || cleaned.includes("\0")) return null;
13520
- const resolvedRoot = path17__namespace.resolve(root);
13521
- const absolute = path17__namespace.resolve(resolvedRoot, cleaned);
13522
- const relative15 = path17__namespace.relative(resolvedRoot, absolute);
13523
- if (relative15 === "" || relative15 === ".." || relative15.startsWith(`..${path17__namespace.sep}`) || path17__namespace.isAbsolute(relative15)) {
13584
+ const resolvedRoot = path22__namespace.resolve(root);
13585
+ const absolute = path22__namespace.resolve(resolvedRoot, cleaned);
13586
+ const relative15 = path22__namespace.relative(resolvedRoot, absolute);
13587
+ if (relative15 === "" || relative15 === ".." || relative15.startsWith(`..${path22__namespace.sep}`) || path22__namespace.isAbsolute(relative15)) {
13524
13588
  return null;
13525
13589
  }
13526
- return relative15.split(path17__namespace.sep).join("/");
13590
+ return relative15.split(path22__namespace.sep).join("/");
13527
13591
  }
13528
13592
  function symbolsOf(entry) {
13529
13593
  const summary = entry.summary;
@@ -13753,7 +13817,7 @@ var generateTool = {
13753
13817
  if (!result.ok) return failure(result.message);
13754
13818
  const summary = result.summary;
13755
13819
  forgetManifest(manifestPathFor(workspace));
13756
- const written = relativeFor(workspace, path17__namespace.resolve(workspace.root, workspace.config.outDir));
13820
+ const written = relativeFor(workspace, path22__namespace.resolve(workspace.root, workspace.config.outDir));
13757
13821
  const lines = [
13758
13822
  `Wrote ${written}/`,
13759
13823
  `Files: ${summary.totalFiles} included, ${summary.skippedCount} skipped, ${plural(summary.partsCount, "part")}`,
@@ -15444,14 +15508,14 @@ var LEGACY_AGENTS_MARKER = "<!-- codebase-snapshot:skill:start -->";
15444
15508
  function targetPath(cwd, target) {
15445
15509
  switch (target) {
15446
15510
  case "claude":
15447
- return path17__namespace.join(cwd, ".claude", "skills", SKILL_NAME, "SKILL.md");
15511
+ return path22__namespace.join(cwd, ".claude", "skills", SKILL_NAME, "SKILL.md");
15448
15512
  case "cursor":
15449
- return path17__namespace.join(cwd, ".cursor", "rules", `${SKILL_NAME}.mdc`);
15513
+ return path22__namespace.join(cwd, ".cursor", "rules", `${SKILL_NAME}.mdc`);
15450
15514
  }
15451
15515
  }
15452
15516
  function assertWritableInsideRepository(cwd, filePath) {
15453
15517
  const root = fs16__namespace.realpathSync(cwd);
15454
- const shown = path17__namespace.relative(root, filePath) || filePath;
15518
+ const shown = path22__namespace.relative(root, filePath) || filePath;
15455
15519
  let stat = null;
15456
15520
  try {
15457
15521
  stat = fs16__namespace.lstatSync(filePath);
@@ -15471,14 +15535,14 @@ function assertWritableInsideRepository(cwd, filePath) {
15471
15535
  let existing = filePath;
15472
15536
  const missing = [];
15473
15537
  while (!fs16__namespace.existsSync(existing)) {
15474
- missing.unshift(path17__namespace.basename(existing));
15475
- const parent = path17__namespace.dirname(existing);
15538
+ missing.unshift(path22__namespace.basename(existing));
15539
+ const parent = path22__namespace.dirname(existing);
15476
15540
  if (parent === existing) break;
15477
15541
  existing = parent;
15478
15542
  }
15479
15543
  const realAncestor = fs16__namespace.realpathSync(existing);
15480
- const resolved = missing.length === 0 ? realAncestor : path17__namespace.join(realAncestor, ...missing);
15481
- if (resolved !== root && !resolved.startsWith(`${root}${path17__namespace.sep}`)) {
15544
+ const resolved = missing.length === 0 ? realAncestor : path22__namespace.join(realAncestor, ...missing);
15545
+ if (resolved !== root && !resolved.startsWith(`${root}${path22__namespace.sep}`)) {
15482
15546
  throw new Error(
15483
15547
  `${REFUSED}: ${shown} resolves outside the repository (${resolved}). Move it back inside ${root}, or remove the link, and run again.`
15484
15548
  );
@@ -15487,12 +15551,12 @@ function assertWritableInsideRepository(cwd, filePath) {
15487
15551
  function writeIfChanged(target, filePath, content) {
15488
15552
  const existing = fs16__namespace.existsSync(filePath) ? fs16__namespace.readFileSync(filePath, "utf8") : null;
15489
15553
  if (existing === content) return { target, path: filePath, action: "unchanged" };
15490
- fs16__namespace.mkdirSync(path17__namespace.dirname(filePath), { recursive: true });
15554
+ fs16__namespace.mkdirSync(path22__namespace.dirname(filePath), { recursive: true });
15491
15555
  fs16__namespace.writeFileSync(filePath, content, "utf8");
15492
15556
  return { target, path: filePath, action: existing === null ? "created" : "updated" };
15493
15557
  }
15494
15558
  function legacyAgentsNote(cwd) {
15495
- const filePath = path17__namespace.join(cwd, "AGENTS.md");
15559
+ const filePath = path22__namespace.join(cwd, "AGENTS.md");
15496
15560
  try {
15497
15561
  if (!fs16__namespace.existsSync(filePath)) return null;
15498
15562
  if (!fs16__namespace.readFileSync(filePath, "utf8").includes(LEGACY_AGENTS_MARKER)) return null;
@@ -15509,7 +15573,7 @@ function installSkill(cwd, target = "all") {
15509
15573
  for (const item of wanted) assertWritableInsideRepository(cwd, targetPath(cwd, item));
15510
15574
  const createsSomething = wanted.some((item) => !fs16__namespace.existsSync(targetPath(cwd, item)));
15511
15575
  if (createsSomething) {
15512
- assertWritableInsideRepository(cwd, path17__namespace.join(cwd, ".gitignore"));
15576
+ assertWritableInsideRepository(cwd, path22__namespace.join(cwd, ".gitignore"));
15513
15577
  }
15514
15578
  for (const item of wanted) {
15515
15579
  written.push(writeIfChanged(item, targetPath(cwd, item), skill));
@@ -15782,7 +15846,7 @@ function buildResourceProvider() {
15782
15846
  if ("error" in workspace) return null;
15783
15847
  if (uri === PROMPT_URI) {
15784
15848
  const text2 = readFileIfPresent(
15785
- path17__namespace.resolve(workspace.root, workspace.config.outDir, "PROMPT.md")
15849
+ path22__namespace.resolve(workspace.root, workspace.config.outDir, "PROMPT.md")
15786
15850
  );
15787
15851
  if (text2 === null) {
15788
15852
  throw new ResourceNotFoundError(
@@ -15795,7 +15859,7 @@ function buildResourceProvider() {
15795
15859
  const report = REPORT_URIS.get(uri);
15796
15860
  if (report) {
15797
15861
  const text2 = readFileIfPresent(
15798
- path17__namespace.resolve(workspace.root, workspace.config.outDir, "reports", report.file)
15862
+ path22__namespace.resolve(workspace.root, workspace.config.outDir, "reports", report.file)
15799
15863
  );
15800
15864
  if (text2 === null) {
15801
15865
  throw new ResourceNotFoundError(
@@ -16869,7 +16933,7 @@ function parseCliArgs(argv) {
16869
16933
  install: values.install === true,
16870
16934
  noInstall: values["no-install"] === true,
16871
16935
  target: values.target === void 0 ? void 0 : String(values.target),
16872
- cwd: values.cwd === void 0 ? process.cwd() : path17__namespace.resolve(String(values.cwd)),
16936
+ cwd: values.cwd === void 0 ? process.cwd() : path22__namespace.resolve(String(values.cwd)),
16873
16937
  outDir: values["out-dir"] === void 0 ? void 0 : String(values["out-dir"]),
16874
16938
  includeMonolith: values["include-monolith"] === true || onlyNamesMonolith === true ? true : void 0,
16875
16939
  includeSensitiveFiles: values["include-sensitive-files"] === true ? true : void 0,
@@ -16957,9 +17021,9 @@ function splitList(value) {
16957
17021
  return value.split(",").map((entry) => entry.trim()).filter(Boolean);
16958
17022
  }
16959
17023
  function displayOutPath(cwd, outDir, ...segments) {
16960
- const absolute = path17__namespace.resolve(cwd, outDir, ...segments);
16961
- const relative15 = path17__namespace.relative(cwd, absolute);
16962
- if (relative15 && !relative15.startsWith("..") && !path17__namespace.isAbsolute(relative15)) return relative15;
17024
+ const absolute = path22__namespace.resolve(cwd, outDir, ...segments);
17025
+ const relative15 = path22__namespace.relative(cwd, absolute);
17026
+ if (relative15 && !relative15.startsWith("..") && !path22__namespace.isAbsolute(relative15)) return relative15;
16963
17027
  return absolute;
16964
17028
  }
16965
17029
  function nextStepHint(cwd, scriptsAddedNow) {
@@ -16967,7 +17031,7 @@ function nextStepHint(cwd, scriptsAddedNow) {
16967
17031
  if (!hasScript) {
16968
17032
  try {
16969
17033
  const parsed = JSON.parse(
16970
- stripJsonComments(fs16__namespace.readFileSync(path17__namespace.join(cwd, "package.json"), "utf8"))
17034
+ stripJsonComments(fs16__namespace.readFileSync(path22__namespace.join(cwd, "package.json"), "utf8"))
16971
17035
  );
16972
17036
  hasScript = typeof parsed.scripts?.snapshot === "string";
16973
17037
  } catch {
@@ -16975,7 +17039,7 @@ function nextStepHint(cwd, scriptsAddedNow) {
16975
17039
  }
16976
17040
  }
16977
17041
  if (!hasScript) return `npx ${GENERATOR_NAME} generate`;
16978
- const bin = path17__namespace.join(cwd, "node_modules", ".bin", "codebase-snapshot");
17042
+ const bin = path22__namespace.join(cwd, "node_modules", ".bin", "codebase-snapshot");
16979
17043
  const installed = fs16__namespace.existsSync(bin) || fs16__namespace.existsSync(`${bin}.cmd`);
16980
17044
  return installed ? "npm run snapshot" : "npm install && npm run snapshot";
16981
17045
  }
@@ -17012,7 +17076,7 @@ async function runInitCommand(invocation) {
17012
17076
  if (hook) for (const note of hook.notes) info(` ${note}`);
17013
17077
  return 0;
17014
17078
  }
17015
- info(`\u2705 Created ${path17__namespace.basename(result.configPath)} (${presetSummary(result)})`);
17079
+ info(`\u2705 Created ${path22__namespace.basename(result.configPath)} (${presetSummary(result)})`);
17016
17080
  if (result.scripts.length > 0) info(` Added npm scripts: ${result.scripts.join(", ")}`);
17017
17081
  if (result.dependency.added && result.dependency.range !== null) {
17018
17082
  info(` Added devDependency: ${result.dependency.name} ${result.dependency.range}`);
@@ -17020,6 +17084,13 @@ async function runInitCommand(invocation) {
17020
17084
  if (result.gitignoreEntries.length > 0) {
17021
17085
  info(` Added to .gitignore: ${result.gitignoreEntries.join(", ")}`);
17022
17086
  }
17087
+ if (result.briefWritten) {
17088
+ info(
17089
+ ` Wrote ${path22__namespace.basename(result.briefPath)}: a scaffold for the half of PROMPT.md only you can write. Fill it in, then set brief: ${JSON.stringify(path22__namespace.basename(result.briefPath))} in the config to merge it.`
17090
+ );
17091
+ } else if (fs16__namespace.existsSync(result.briefPath)) {
17092
+ info(` Kept ${path22__namespace.basename(result.briefPath)}: it already exists, and is never overwritten.`);
17093
+ }
17023
17094
  for (const note of result.notes) info(` \u26A0 ${note}`);
17024
17095
  if (hook) for (const note of hook.notes) info(` ${note}`);
17025
17096
  info("");
@@ -17035,18 +17106,18 @@ async function runInitCommand(invocation) {
17035
17106
  function generatorOrigin(cwd) {
17036
17107
  try {
17037
17108
  const pkg = JSON.parse(
17038
- stripJsonComments(fs16__namespace.readFileSync(path17__namespace.join(cwd, "package.json"), "utf8"))
17109
+ stripJsonComments(fs16__namespace.readFileSync(path22__namespace.join(cwd, "package.json"), "utf8"))
17039
17110
  );
17040
17111
  const spec = pkg.dependencies?.["codebase-snapshot"] ?? pkg.devDependencies?.["codebase-snapshot"];
17041
17112
  if (typeof spec === "string") return `project dependency ${spec}`;
17042
17113
  } catch {
17043
17114
  }
17044
17115
  const entry = process.argv[1] ?? "";
17045
- if (entry.includes("_npx") || entry.includes(`${path17__namespace.sep}npx${path17__namespace.sep}`)) return "via npx";
17116
+ if (entry.includes("_npx") || entry.includes(`${path22__namespace.sep}npx${path22__namespace.sep}`)) return "via npx";
17046
17117
  return "global or direct install";
17047
17118
  }
17048
17119
  function detectPackageManager(cwd) {
17049
- const has = (name) => fs16__namespace.existsSync(path17__namespace.join(cwd, name));
17120
+ const has = (name) => fs16__namespace.existsSync(path22__namespace.join(cwd, name));
17050
17121
  if (has("bun.lockb") || has("bun.lock")) return { name: "bun", command: "bun", args: ["install"] };
17051
17122
  if (has("pnpm-lock.yaml")) return { name: "pnpm", command: "pnpm", args: ["install"] };
17052
17123
  if (has("yarn.lock")) return { name: "yarn", command: "yarn", args: ["install"] };
@@ -17163,7 +17234,7 @@ async function runSetupCommand(invocation, options = {}) {
17163
17234
  }
17164
17235
  info("\n\u{1F9EA} Dry run \u2014 setup would:");
17165
17236
  info(
17166
- ` 1. ${init.reused ? `keep ${path17__namespace.basename(keptConfigPath)}` : `write ${path17__namespace.basename(keptConfigPath)} (preset: ${appliedPreset})`}`
17237
+ ` 1. ${init.reused ? `keep ${path22__namespace.basename(keptConfigPath)}` : `write ${path22__namespace.basename(keptConfigPath)} (preset: ${appliedPreset})`}`
17167
17238
  );
17168
17239
  info(" 2. add the npm scripts, the devDependency and the .gitignore entries");
17169
17240
  if (manager !== null) info(` 3. install with ${manager}`);
@@ -17176,9 +17247,9 @@ async function runSetupCommand(invocation, options = {}) {
17176
17247
  if (invocation.format !== "json") {
17177
17248
  if (!interactive) info(`\u{1F680} Setup for: ${invocation.cwd}`);
17178
17249
  if (init.reused) {
17179
- info(`\u267B Keeping ${path17__namespace.basename(keptConfigPath)}`);
17250
+ info(`\u267B Keeping ${path22__namespace.basename(keptConfigPath)}`);
17180
17251
  } else {
17181
- info(`\u2705 Created ${path17__namespace.basename(keptConfigPath)} (${presetSummary(init)})`);
17252
+ info(`\u2705 Created ${path22__namespace.basename(keptConfigPath)} (${presetSummary(init)})`);
17182
17253
  }
17183
17254
  if (init.scripts.length > 0) info(` Added npm scripts: ${init.scripts.join(", ")}`);
17184
17255
  if (init.dependency.added && init.dependency.range !== null) {
@@ -17192,7 +17263,7 @@ async function runSetupCommand(invocation, options = {}) {
17192
17263
  info(` \u26A0 --preset ${invocation.preset} was not applied: the existing config is kept.`);
17193
17264
  }
17194
17265
  }
17195
- const hasManifest = fs16__namespace.existsSync(path17__namespace.join(invocation.cwd, "package.json"));
17266
+ const hasManifest = fs16__namespace.existsSync(path22__namespace.join(invocation.cwd, "package.json"));
17196
17267
  let install = null;
17197
17268
  if (invocation.noInstall) {
17198
17269
  if (invocation.format !== "json") info(" Skipped the install (--no-install)");
@@ -17324,7 +17395,7 @@ function runSkillCommand(invocation) {
17324
17395
  }
17325
17396
  info(`\u2705 Agent skill installed (${SKILL_NAME}):`);
17326
17397
  for (const item of result.written) {
17327
- const shown = path17__namespace.relative(invocation.cwd, item.path) || item.path;
17398
+ const shown = path22__namespace.relative(invocation.cwd, item.path) || item.path;
17328
17399
  info(` - ${item.action.padEnd(9)} ${shown}`);
17329
17400
  }
17330
17401
  if (result.gitignored.length > 0) {
@@ -17445,7 +17516,7 @@ ${USAGE}
17445
17516
  return runSkillCommand(invocation);
17446
17517
  }
17447
17518
  if (invocation.command === "mcp") {
17448
- return await runStdioServer({ cwd: path17__namespace.resolve(invocation.cwd) });
17519
+ return await runStdioServer({ cwd: path22__namespace.resolve(invocation.cwd) });
17449
17520
  }
17450
17521
  if (invocation.command === "setup") {
17451
17522
  return runSetupCommand(invocation);
@@ -17464,7 +17535,7 @@ ${USAGE}
17464
17535
  );
17465
17536
  }
17466
17537
  for (const warning of loaded.warnings) warn(`\u26A0 Config: ${warning}`);
17467
- if (loaded.file) info(`\u2699 Using config ${path17__namespace.relative(process.cwd(), loaded.file) || loaded.file}`);
17538
+ if (loaded.file) info(`\u2699 Using config ${path22__namespace.relative(process.cwd(), loaded.file) || loaded.file}`);
17468
17539
  let resolved;
17469
17540
  try {
17470
17541
  resolved = resolveConfig(
@@ -17508,7 +17579,7 @@ ${USAGE}
17508
17579
  return result.valid ? 0 : 1;
17509
17580
  }
17510
17581
  if (invocation.command === "report") {
17511
- const manifestPath = path17__namespace.resolve(resolved.cwd, resolved.outDir, "manifest.json");
17582
+ const manifestPath = path22__namespace.resolve(resolved.cwd, resolved.outDir, "manifest.json");
17512
17583
  if (!fs16__namespace.existsSync(manifestPath)) {
17513
17584
  return fail(invocation.format, `Manifest not found at ${manifestPath}. Run generate first.`);
17514
17585
  }
@@ -17721,19 +17792,19 @@ function finishWatchRun(state, now) {
17721
17792
  };
17722
17793
  }
17723
17794
  function comparablePath(value) {
17724
- const absolute = path17__namespace.resolve(value);
17795
+ const absolute = path22__namespace.resolve(value);
17725
17796
  return process.platform === "win32" ? absolute.toLowerCase() : absolute;
17726
17797
  }
17727
17798
  function isSameOrInside(parent, candidate) {
17728
- const relative15 = path17__namespace.relative(parent, candidate);
17729
- return relative15 === "" || relative15 !== ".." && !relative15.startsWith(`..${path17__namespace.sep}`) && !path17__namespace.isAbsolute(relative15);
17799
+ const relative15 = path22__namespace.relative(parent, candidate);
17800
+ return relative15 === "" || relative15 !== ".." && !relative15.startsWith(`..${path22__namespace.sep}`) && !path22__namespace.isAbsolute(relative15);
17730
17801
  }
17731
17802
  function isGeneratedWatchPath(candidate, paths) {
17732
- const absolute = comparablePath(path17__namespace.resolve(paths.cwd, candidate));
17733
- const outDir = comparablePath(path17__namespace.resolve(paths.cwd, paths.outDir));
17734
- const tmpDir = comparablePath(path17__namespace.resolve(paths.cwd, paths.tmpDir));
17803
+ const absolute = comparablePath(path22__namespace.resolve(paths.cwd, candidate));
17804
+ const outDir = comparablePath(path22__namespace.resolve(paths.cwd, paths.outDir));
17805
+ const tmpDir = comparablePath(path22__namespace.resolve(paths.cwd, paths.tmpDir));
17735
17806
  if (isSameOrInside(outDir, absolute) || isSameOrInside(tmpDir, absolute)) return true;
17736
- const offsets = [path17__namespace.basename(outDir), path17__namespace.basename(tmpDir)].filter((name) => name.length > 0);
17807
+ const offsets = [path22__namespace.basename(outDir), path22__namespace.basename(tmpDir)].filter((name) => name.length > 0);
17737
17808
  const leftover = absolute.split(/[\\/]+/).some(
17738
17809
  (segment) => offsets.some(
17739
17810
  (name) => segment.startsWith(`${name}.backup-`) || segment.startsWith(`${name}.partial-`)
@@ -17756,8 +17827,8 @@ function decideWatchEvent(state, event, paths) {
17756
17827
  function watchPathsFor(config) {
17757
17828
  return {
17758
17829
  cwd: config.cwd,
17759
- outDir: path17__namespace.resolve(config.cwd, config.outDir),
17760
- tmpDir: path17__namespace.resolve(config.cwd, config.tmpDir)
17830
+ outDir: path22__namespace.resolve(config.cwd, config.outDir),
17831
+ tmpDir: path22__namespace.resolve(config.cwd, config.tmpDir)
17761
17832
  };
17762
17833
  }
17763
17834
  function watchSupportProblem(platform = process.platform, version = process.versions.node) {
@@ -17849,7 +17920,7 @@ async function runWatchLoop(invocation, resolved, options) {
17849
17920
  const decision = decideWatchEvent(
17850
17921
  state,
17851
17922
  {
17852
- path: filename ? path17__namespace.resolve(resolved.cwd, filename.toString()) : null,
17923
+ path: filename ? path22__namespace.resolve(resolved.cwd, filename.toString()) : null,
17853
17924
  now: performance.now()
17854
17925
  },
17855
17926
  paths
@@ -17888,7 +17959,7 @@ async function runWatchLoop(invocation, resolved, options) {
17888
17959
  return 0;
17889
17960
  }
17890
17961
  var entryFile = process.argv[1] ?? "";
17891
- var entryName = path17__namespace.basename(entryFile).toLowerCase();
17962
+ var entryName = path22__namespace.basename(entryFile).toLowerCase();
17892
17963
  var invokedDirectly = entryName === "cli.js" || entryName === "cli.cjs";
17893
17964
  if (invokedDirectly) {
17894
17965
  void main().then(