@coggit/core 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/internal.js CHANGED
@@ -5,14 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res, err) => function __init() {
9
- if (err) throw err[0];
10
- try {
11
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
- } catch (e) {
13
- throw err = [e], e;
14
- }
15
- };
16
8
  var __commonJS = (cb, mod) => function __require() {
17
9
  try {
18
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -42,243 +34,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
42
34
  ));
43
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
44
36
 
45
- // src/path-utils.ts
46
- var path_utils_exports = {};
47
- __export(path_utils_exports, {
48
- basename: () => basename,
49
- dirname: () => dirname,
50
- isAbsolute: () => isAbsolute,
51
- join: () => join,
52
- normalize: () => normalize,
53
- posix: () => posix,
54
- relative: () => relative,
55
- resolve: () => resolve,
56
- win32: () => win32
57
- });
58
- function isAbsolute(p) {
59
- return p.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(p);
60
- }
61
- function dirname(p) {
62
- const trimmed = p.replace(/[/\\]+$/, "");
63
- const idx = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
64
- if (idx < 0) {
65
- return ".";
66
- }
67
- if (idx === 0) {
68
- return "/";
69
- }
70
- return trimmed.slice(0, idx);
71
- }
72
- function basename(p) {
73
- const trimmed = p.replace(/[/\\]+$/, "");
74
- return trimmed.slice(Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\")) + 1);
75
- }
76
- function normalizeParts(p) {
77
- const parts = [];
78
- for (const seg of p.replace(/\\/g, "/").split("/")) {
79
- if (seg === "" || seg === ".") {
80
- continue;
81
- }
82
- if (seg === "..") {
83
- if (parts.length && parts[parts.length - 1] !== "..") {
84
- parts.pop();
85
- } else {
86
- parts.push("..");
87
- }
88
- } else {
89
- parts.push(seg);
90
- }
91
- }
92
- return parts;
93
- }
94
- function normalize(p) {
95
- const prefix = p.startsWith("/") ? "/" : /^[a-zA-Z]:[/\\]/.test(p) ? p.slice(0, 3) : "";
96
- return prefix + normalizeParts(p).join("/");
97
- }
98
- function resolve(...segments) {
99
- if (segments.length === 0) {
100
- return ".";
101
- }
102
- let resolved = "";
103
- for (let i = segments.length - 1; i >= 0; i--) {
104
- const segment = segments[i];
105
- if (!segment) {
106
- continue;
107
- }
108
- resolved = resolved ? `${segment}/${resolved}` : segment;
109
- if (isAbsolute(segment)) {
110
- break;
111
- }
112
- }
113
- return normalize(resolved || ".");
114
- }
115
- function relative(from, to) {
116
- const a = normalizeParts(from);
117
- const b = normalizeParts(to);
118
- let i = 0;
119
- while (i < a.length && i < b.length && a[i] === b[i]) {
120
- i++;
121
- }
122
- const up = a.slice(i).map(() => "..");
123
- const down = b.slice(i);
124
- return up.concat(down).join("/") || ".";
125
- }
126
- function join(...segments) {
127
- return normalize(segments.join("/"));
128
- }
129
- var posix, win32;
130
- var init_path_utils = __esm({
131
- "src/path-utils.ts"() {
132
- "use strict";
133
- posix = {
134
- isAbsolute(p) {
135
- return p.startsWith("/");
136
- },
137
- parse(p) {
138
- const i = p.lastIndexOf("/");
139
- const dir = i < 0 ? "" : p.slice(0, i);
140
- const file = i < 0 ? p : p.slice(i + 1);
141
- const j = file.lastIndexOf(".");
142
- if (j <= 0) {
143
- return { dir, name: file, ext: "" };
144
- }
145
- return { dir, name: file.slice(0, j), ext: file.slice(j) };
146
- },
147
- join(...segments) {
148
- return posix.normalize(segments.join("/"));
149
- },
150
- normalize(p) {
151
- const parts = [];
152
- for (const seg of p.split("/")) {
153
- if (seg === "" || seg === ".") {
154
- continue;
155
- }
156
- if (seg === "..") {
157
- if (parts.length && parts[parts.length - 1] !== "..") {
158
- parts.pop();
159
- } else {
160
- parts.push("..");
161
- }
162
- } else {
163
- parts.push(seg);
164
- }
165
- }
166
- return (p.startsWith("/") ? "/" : "") + parts.join("/");
167
- }
168
- };
169
- win32 = {
170
- isAbsolute(p) {
171
- return /^[a-zA-Z]:[/\\]/.test(p);
172
- }
173
- };
174
- }
175
- });
176
-
177
- // src/uri-utils.ts
178
- var uri_utils_exports = {};
179
- __export(uri_utils_exports, {
180
- externalPathFromString: () => externalPathFromString,
181
- formatUri: () => formatUri,
182
- isEqualOrChildUri: () => isEqualOrChildUri,
183
- joinUriPath: () => joinUriPath,
184
- parseUriKey: () => parseUriKey,
185
- uriBasename: () => uriBasename,
186
- uriKey: () => uriKey,
187
- uriRelativePath: () => uriRelativePath,
188
- uriToExternalPath: () => uriToExternalPath
189
- });
190
- function uriKey(components) {
191
- return `${components.scheme}://${components.authority}${components.path}${components.query ? "?" + components.query : ""}${components.fragment ? "#" + components.fragment : ""}`;
192
- }
193
- function uriRelativePath(root, child) {
194
- if (root.scheme !== child.scheme || root.authority !== child.authority) {
195
- return void 0;
196
- }
197
- const rootPath = trimTrailingSlash(root.path);
198
- const childPath = trimTrailingSlash(child.path);
199
- if (childPath === rootPath) {
200
- return ".";
201
- }
202
- const prefix = rootPath + "/";
203
- if (!childPath.startsWith(prefix)) {
204
- return void 0;
205
- }
206
- return childPath.slice(prefix.length) || ".";
207
- }
208
- function isEqualOrChildUri(parent, child) {
209
- return uriRelativePath(parent, child) !== void 0;
210
- }
211
- function joinUriPath(base, ...segments) {
212
- let joined = trimTrailingSlash(base.path);
213
- for (const seg of segments) {
214
- if (seg === "..") {
215
- const idx = joined.lastIndexOf("/");
216
- if (idx > 0) {
217
- joined = joined.slice(0, idx);
218
- } else {
219
- joined = "/";
220
- }
221
- } else if (seg !== ".") {
222
- joined = joined === "/" ? "/" + seg : joined + "/" + seg;
223
- }
224
- }
225
- return { ...base, path: joined };
226
- }
227
- function uriBasename(uri) {
228
- const p = trimTrailingSlash(uri.path);
229
- const idx = p.lastIndexOf("/");
230
- return idx >= 0 ? p.slice(idx + 1) : p;
231
- }
232
- function formatUri(uri) {
233
- return uriKey(uri);
234
- }
235
- function trimTrailingSlash(value) {
236
- return value.length > 1 ? value.replace(/\/+$/u, "") : value;
237
- }
238
- function uriToExternalPath(uri) {
239
- if (uri.scheme === "file") {
240
- const p = uri.path;
241
- if (/^\/[a-zA-Z]:[/\\]/u.test(p)) {
242
- return p.slice(1);
243
- }
244
- return p;
245
- }
246
- return uriKey(uri);
247
- }
248
- function externalPathFromString(uriKeyStr) {
249
- if (uriKeyStr.startsWith("file://")) {
250
- const withoutScheme = uriKeyStr.slice(7);
251
- if (/^\/[a-zA-Z]:[/\\]/u.test(withoutScheme)) {
252
- return withoutScheme.slice(1);
253
- }
254
- return withoutScheme;
255
- }
256
- return uriKeyStr;
257
- }
258
- function parseUriKey(uriKeyStr) {
259
- const schemeEnd = uriKeyStr.indexOf("://");
260
- if (schemeEnd === -1) {
261
- throw new Error(`Invalid URI key: ${uriKeyStr}`);
262
- }
263
- const scheme = uriKeyStr.slice(0, schemeEnd);
264
- const rest = uriKeyStr.slice(schemeEnd + 3);
265
- const authEnd = rest.indexOf("/");
266
- const authority = authEnd === -1 ? rest : rest.slice(0, authEnd);
267
- const pathAndMaybeQuery = authEnd === -1 ? "" : rest.slice(authEnd);
268
- const qIdx = pathAndMaybeQuery.indexOf("?");
269
- const fIdx = pathAndMaybeQuery.indexOf("#");
270
- const pathEnd = qIdx !== -1 ? qIdx : fIdx !== -1 ? fIdx : pathAndMaybeQuery.length;
271
- const path = pathAndMaybeQuery.slice(0, pathEnd);
272
- const query = qIdx !== -1 ? pathAndMaybeQuery.slice(qIdx + 1, fIdx !== -1 ? fIdx : void 0) : "";
273
- const fragment = fIdx !== -1 ? pathAndMaybeQuery.slice(fIdx + 1) : "";
274
- return { scheme, authority, path: path || "/", query, fragment };
275
- }
276
- var init_uri_utils = __esm({
277
- "src/uri-utils.ts"() {
278
- "use strict";
279
- }
280
- });
281
-
282
37
  // ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
283
38
  var require_identity = __commonJS({
284
39
  "../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js"(exports2) {
@@ -7606,459 +7361,6 @@ var require_dist = __commonJS({
7606
7361
  }
7607
7362
  });
7608
7363
 
7609
- // src/mapping.js
7610
- var require_mapping = __commonJS({
7611
- "src/mapping.js"(exports2) {
7612
- "use strict";
7613
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
7614
- if (k2 === void 0) k2 = k;
7615
- var desc = Object.getOwnPropertyDescriptor(m, k);
7616
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7617
- desc = { enumerable: true, get: function() {
7618
- return m[k];
7619
- } };
7620
- }
7621
- Object.defineProperty(o, k2, desc);
7622
- }) : (function(o, m, k, k2) {
7623
- if (k2 === void 0) k2 = k;
7624
- o[k2] = m[k];
7625
- }));
7626
- var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
7627
- Object.defineProperty(o, "default", { enumerable: true, value: v });
7628
- }) : function(o, v) {
7629
- o["default"] = v;
7630
- });
7631
- var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
7632
- var ownKeys = function(o) {
7633
- ownKeys = Object.getOwnPropertyNames || function(o2) {
7634
- var ar = [];
7635
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
7636
- return ar;
7637
- };
7638
- return ownKeys(o);
7639
- };
7640
- return function(mod) {
7641
- if (mod && mod.__esModule) return mod;
7642
- var result = {};
7643
- if (mod != null) {
7644
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
7645
- }
7646
- __setModuleDefault(result, mod);
7647
- return result;
7648
- };
7649
- })();
7650
- Object.defineProperty(exports2, "__esModule", { value: true });
7651
- exports2.getProjectRootPath = getProjectRootPath2;
7652
- exports2.resolveConfigRoots = resolveConfigRoots2;
7653
- exports2.resolveConfigRootPaths = resolveConfigRootPaths;
7654
- exports2.resolvePath = resolvePath;
7655
- exports2.toRelativePath = toRelativePath2;
7656
- exports2.toRelativeUriPath = toRelativeUriPath4;
7657
- exports2.normalizeSourcePathInput = normalizeSourcePathInput2;
7658
- exports2.sourceIdentityToCognitionIdentity = sourceIdentityToCognitionIdentity2;
7659
- exports2.cognitionIdentityToSourceIdentity = cognitionIdentityToSourceIdentity2;
7660
- exports2.toCognitionFilePath = toCognitionFilePath2;
7661
- exports2.toCognitionFileUri = toCognitionFileUri2;
7662
- exports2.toCognitionFolderReadmePath = toCognitionFolderReadmePath2;
7663
- exports2.toCognitionFolderReadmeUri = toCognitionFolderReadmeUri2;
7664
- exports2.inferSourceUriFromCognitionUri = inferSourceUriFromCognitionUri;
7665
- exports2.inferSourceUriCandidatesFromCognitionUri = inferSourceUriCandidatesFromCognitionUri2;
7666
- exports2.sourceIdentityToProjectRelative = sourceIdentityToProjectRelative2;
7667
- exports2.cognitionIdentityToProjectRelative = cognitionIdentityToProjectRelative2;
7668
- exports2.projectRelativeToSourceIdentity = projectRelativeToSourceIdentity;
7669
- exports2.getParentDir = getParentDir2;
7670
- exports2.isWithin = isWithin;
7671
- exports2.basename = basename3;
7672
- var path = __importStar((init_path_utils(), __toCommonJS(path_utils_exports)));
7673
- var uri_utils_1 = (init_uri_utils(), __toCommonJS(uri_utils_exports));
7674
- function getProjectRootPath2(configPath) {
7675
- return path.resolve(path.dirname(configPath), "..");
7676
- }
7677
- function resolveConfigRoots2(configUri, config) {
7678
- const projectRootUri = (0, uri_utils_1.joinUriPath)(configUri, "..", "..");
7679
- return {
7680
- projectRootUri,
7681
- sourceRootUri: resolveUri2(projectRootUri, config.sourceRoot),
7682
- cognitionRootUri: resolveUri2(projectRootUri, config.cognitionRoot)
7683
- };
7684
- }
7685
- function resolveConfigRootPaths(configPath, config) {
7686
- const projectRoot = getProjectRootPath2(configPath);
7687
- return {
7688
- projectRoot,
7689
- sourceRoot: resolvePath(projectRoot, config.sourceRoot),
7690
- cognitionRoot: resolvePath(projectRoot, config.cognitionRoot)
7691
- };
7692
- }
7693
- function resolvePath(basePath, targetPath) {
7694
- if (path.isAbsolute(targetPath)) {
7695
- return path.normalize(targetPath);
7696
- }
7697
- return path.resolve(basePath, targetPath);
7698
- }
7699
- function resolveUri2(baseUri, targetPath) {
7700
- if (isAbsoluteFsPath2(targetPath)) {
7701
- return { ...baseUri, path: normalizeUriPath2(targetPath) };
7702
- }
7703
- const segments = normalizePath2(targetPath).split("/").filter((segment) => segment.length > 0 && segment !== ".");
7704
- return segments.length === 0 ? baseUri : (0, uri_utils_1.joinUriPath)(baseUri, ...segments);
7705
- }
7706
- function isAbsoluteFsPath2(targetPath) {
7707
- return path.posix.isAbsolute(targetPath) || path.win32.isAbsolute(targetPath);
7708
- }
7709
- function normalizeUriPath2(targetPath) {
7710
- const normalized = normalizePath2(targetPath);
7711
- return normalized.startsWith("/") ? normalized : `/${normalized}`;
7712
- }
7713
- function toRelativePath2(sourceRootPath, sourcePath) {
7714
- return normalizePath2(path.relative(sourceRootPath, sourcePath));
7715
- }
7716
- function toRelativeUriPath4(rootUri, uri) {
7717
- const relativePath = (0, uri_utils_1.uriRelativePath)(rootUri, uri);
7718
- if (relativePath === void 0) {
7719
- throw new Error(`URI is not under root: ${(0, uri_utils_1.uriKey)(uri)} is not under ${(0, uri_utils_1.uriKey)(rootUri)}`);
7720
- }
7721
- return relativePath;
7722
- }
7723
- function normalizeSourcePathInput2(sourcePath, context) {
7724
- const normalizedPath = trimSlashes2(sourcePath.replace(/\\/g, "/"));
7725
- if (normalizedPath === "" || normalizedPath === ".") {
7726
- return normalizedPath;
7727
- }
7728
- const sourceRoot = context?.sourceRoot ? trimSlashes2(context.sourceRoot.replace(/\\/g, "/")) : sourceRootPrefixFromUris2(context);
7729
- if (!sourceRoot || sourceRoot === ".") {
7730
- return normalizedPath;
7731
- }
7732
- if (normalizedPath === sourceRoot) {
7733
- return ".";
7734
- }
7735
- if (normalizedPath.startsWith(sourceRoot + "/")) {
7736
- return normalizedPath.slice(sourceRoot.length + 1) || ".";
7737
- }
7738
- return normalizedPath;
7739
- }
7740
- function sourceRootPrefixFromUris2(context) {
7741
- if (!context?.projectRootUri || !context.sourceRootUri) {
7742
- return void 0;
7743
- }
7744
- return toRelativeUriPath4(context.projectRootUri, context.sourceRootUri);
7745
- }
7746
- function trimSlashes2(input) {
7747
- return input.replace(/^\/+|\/+$/gu, "");
7748
- }
7749
- function sourceIdentityToCognitionIdentity2(sourceIdentity, kind) {
7750
- const identity = sourceIdentity === "" ? "." : sourceIdentity;
7751
- if (kind === "leaf") {
7752
- return `${identity}.md`;
7753
- }
7754
- return identity === "." ? "README.md" : `${identity}/README.md`;
7755
- }
7756
- function cognitionIdentityToSourceIdentity2(cognitionIdentity) {
7757
- const normalized = cognitionIdentity.replace(/\\/g, "/");
7758
- if (!normalized.endsWith(".md")) {
7759
- return void 0;
7760
- }
7761
- const withoutMd = normalized.slice(0, -".md".length);
7762
- if (withoutMd === "") {
7763
- return void 0;
7764
- }
7765
- if (withoutMd === "README") {
7766
- return { sourceIdentity: ".", kind: "folder" };
7767
- }
7768
- const lastSegment = withoutMd.split("/").pop();
7769
- if (lastSegment === "README") {
7770
- return {
7771
- sourceIdentity: withoutMd.slice(0, -"/README".length) || ".",
7772
- kind: "folder"
7773
- };
7774
- }
7775
- const hasSourceExtension = lastSegment.startsWith(".") ? lastSegment.slice(1).includes(".") : lastSegment.includes(".");
7776
- if (!hasSourceExtension) {
7777
- return void 0;
7778
- }
7779
- return { sourceIdentity: withoutMd, kind: "leaf" };
7780
- }
7781
- function toCognitionFilePath2(sourceRootPath, cognitionRootPath, sourceFilePath) {
7782
- const rel = toRelativePath2(sourceRootPath, sourceFilePath);
7783
- return path.join(cognitionRootPath, sourceIdentityToCognitionIdentity2(rel, "leaf"));
7784
- }
7785
- function toCognitionFileUri2(sourceRootUri, cognitionRootUri, sourceFileUri) {
7786
- const rel = toRelativeUriPath4(sourceRootUri, sourceFileUri);
7787
- return joinIdentityPath2(cognitionRootUri, sourceIdentityToCognitionIdentity2(rel, "leaf"));
7788
- }
7789
- function toCognitionFolderReadmePath2(sourceRootPath, cognitionRootPath, folderPath) {
7790
- const rel = toRelativePath2(sourceRootPath, folderPath);
7791
- return path.join(cognitionRootPath, sourceIdentityToCognitionIdentity2(rel, "folder"));
7792
- }
7793
- function toCognitionFolderReadmeUri2(sourceRootUri, cognitionRootUri, folderUri) {
7794
- const rel = toRelativeUriPath4(sourceRootUri, folderUri);
7795
- return joinIdentityPath2(cognitionRootUri, sourceIdentityToCognitionIdentity2(rel, "folder"));
7796
- }
7797
- function inferSourceUriFromCognitionUri(cognitionUri, sourceRootUri, cognitionRootUri) {
7798
- const candidates = inferSourceUriCandidatesFromCognitionUri2(cognitionUri, sourceRootUri, cognitionRootUri);
7799
- return candidates[0];
7800
- }
7801
- function inferSourceUriCandidatesFromCognitionUri2(cognitionUri, sourceRootUri, cognitionRootUri) {
7802
- const relativePath = toRelativeUriPath4(cognitionRootUri, cognitionUri);
7803
- if (relativePath === ".") {
7804
- return [];
7805
- }
7806
- const mapped = cognitionIdentityToSourceIdentity2(relativePath);
7807
- if (!mapped) {
7808
- return [];
7809
- }
7810
- return [joinIdentityPath2(sourceRootUri, mapped.sourceIdentity)];
7811
- }
7812
- function sourceIdentityToProjectRelative2(root, sourceIdentity) {
7813
- return prependRootName2(rootName2(root.projectRootUri, root.sourceRootUri), sourceIdentity);
7814
- }
7815
- function cognitionIdentityToProjectRelative2(root, cognitionIdentity) {
7816
- return prependRootName2(rootName2(root.projectRootUri, root.cognitionRootUri), cognitionIdentity);
7817
- }
7818
- function projectRelativeToSourceIdentity(root, projectRelative) {
7819
- return stripRootName(rootName2(root.projectRootUri, root.sourceRootUri), projectRelative);
7820
- }
7821
- function rootName2(projectRootUri, rootUri) {
7822
- return toRelativeUriPath4(projectRootUri, rootUri);
7823
- }
7824
- function prependRootName2(rootName3, identity) {
7825
- if (rootName3 === "." || rootName3 === "") {
7826
- return identity === "" ? "." : identity;
7827
- }
7828
- if (identity === "." || identity === "") {
7829
- return rootName3;
7830
- }
7831
- return `${rootName3}/${identity}`;
7832
- }
7833
- function stripRootName(rootName3, projectRelative) {
7834
- const normalized = projectRelative.replace(/\\/g, "/").replace(/^\/+|\/+$/gu, "");
7835
- if (rootName3 === "." || rootName3 === "") {
7836
- return normalized === "" ? "." : normalized;
7837
- }
7838
- if (normalized === rootName3) {
7839
- return ".";
7840
- }
7841
- if (normalized.startsWith(`${rootName3}/`)) {
7842
- return normalized.slice(rootName3.length + 1) || ".";
7843
- }
7844
- return normalized;
7845
- }
7846
- function joinIdentityPath2(base, identity) {
7847
- const segments = identity.replace(/\\/g, "/").split("/").filter((segment) => segment.length > 0 && segment !== ".");
7848
- return segments.length === 0 ? base : (0, uri_utils_1.joinUriPath)(base, ...segments);
7849
- }
7850
- function getParentDir2(filePath) {
7851
- return path.dirname(filePath);
7852
- }
7853
- function isWithin(parentPath, childPath) {
7854
- const rel = path.relative(parentPath, childPath);
7855
- return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
7856
- }
7857
- function basename3(filePath) {
7858
- return path.basename(filePath);
7859
- }
7860
- function normalizePath2(targetPath) {
7861
- const normalized = targetPath.replace(/\\/g, "/");
7862
- return normalized === "" ? "." : normalized;
7863
- }
7864
- }
7865
- });
7866
-
7867
- // src/pathHints.js
7868
- var require_pathHints = __commonJS({
7869
- "src/pathHints.js"(exports2) {
7870
- "use strict";
7871
- Object.defineProperty(exports2, "__esModule", { value: true });
7872
- exports2.PATH_HINT_MESSAGE = exports2.PATH_MISS_MESSAGE = void 0;
7873
- exports2.suggestPathHints = suggestPathHints3;
7874
- exports2.pathMissMessage = pathMissMessage2;
7875
- exports2.pathHintsTryText = pathHintsTryText2;
7876
- exports2.renderPathMissText = renderPathMissText2;
7877
- var HINT_COLLECT_CAP2 = 5;
7878
- function suggestPathHints3(candidatePaths, sourcePath) {
7879
- if (sourcePath === "" || sourcePath === ".") {
7880
- return [];
7881
- }
7882
- const hints = /* @__PURE__ */ new Set();
7883
- for (const candidate of candidatePaths) {
7884
- if (pathHintMatches2(candidate, sourcePath)) {
7885
- hints.add(candidate);
7886
- if (hints.size >= HINT_COLLECT_CAP2) {
7887
- break;
7888
- }
7889
- }
7890
- }
7891
- return [...hints];
7892
- }
7893
- var PATH_MISS_BASE2 = "Path not found in any CogGit project";
7894
- exports2.PATH_MISS_MESSAGE = `${PATH_MISS_BASE2}.`;
7895
- exports2.PATH_HINT_MESSAGE = "You may mean one of these source-root-relative source paths.";
7896
- function pathMissMessage2(sourcePath) {
7897
- return `${PATH_MISS_BASE2}: ${sourcePath}`;
7898
- }
7899
- function pathHintsTryText2(pathHints) {
7900
- return `Try: ${pathHints.map((hint) => `\`${hint}\``).join(", ")}`;
7901
- }
7902
- function renderPathMissText2(result) {
7903
- const lines = [result.pathMissMessage ?? pathMissMessage2(result.sourcePath ?? "")];
7904
- if (result.pathHintMessage && result.pathHints.length > 0) {
7905
- lines.push(result.pathHintMessage);
7906
- lines.push(pathHintsTryText2(result.pathHints));
7907
- }
7908
- return lines.join("\n");
7909
- }
7910
- function pathHintMatches2(candidate, sourcePath) {
7911
- if (candidate === sourcePath) {
7912
- return false;
7913
- }
7914
- const candidateSegments = candidate.split("/").filter(Boolean);
7915
- const sourceSegments = sourcePath.split("/").filter(Boolean);
7916
- if (sourceSegments.length === 0) {
7917
- return false;
7918
- }
7919
- if (candidate.endsWith(`/${sourcePath}`)) {
7920
- return true;
7921
- }
7922
- const tail = candidateSegments.slice(-sourceSegments.length);
7923
- if (tail.length !== sourceSegments.length) {
7924
- return false;
7925
- }
7926
- const queryLeaf = sourceSegments[sourceSegments.length - 1];
7927
- if (queryLeaf.includes(".")) {
7928
- return tail.join("/") === sourcePath;
7929
- }
7930
- tail[tail.length - 1] = stripLeafExtension2(tail[tail.length - 1]);
7931
- return tail.join("/") === sourcePath;
7932
- }
7933
- function stripLeafExtension2(segment) {
7934
- if (/^\.+$/u.test(segment)) {
7935
- return segment;
7936
- }
7937
- const dot = segment.lastIndexOf(".");
7938
- if (dot <= 0) {
7939
- return segment;
7940
- }
7941
- return segment.slice(0, dot);
7942
- }
7943
- }
7944
- });
7945
-
7946
- // src/projection.js
7947
- var require_projection = __commonJS({
7948
- "src/projection.js"(exports2) {
7949
- "use strict";
7950
- Object.defineProperty(exports2, "__esModule", { value: true });
7951
- exports2.applyTreeDepth = applyTreeDepth3;
7952
- exports2.projectTreeFromSnapshot = projectTreeFromSnapshot2;
7953
- exports2.projectSnapshotTree = projectSnapshotTree2;
7954
- var mapping_js_1 = require_mapping();
7955
- function applyTreeDepth3(nodes, depth) {
7956
- let omittedChildrenCount = 0;
7957
- const result = nodes.map((node) => {
7958
- if (depth <= 0) {
7959
- const nodeOmittedChildrenCount = node.children?.length ?? 0;
7960
- omittedChildrenCount += nodeOmittedChildrenCount;
7961
- const { children: _, ...rest } = node;
7962
- return nodeOmittedChildrenCount > 0 ? {
7963
- ...rest,
7964
- truncated: true,
7965
- omittedChildrenCount: nodeOmittedChildrenCount
7966
- } : rest;
7967
- }
7968
- const childResult = node.children ? applyTreeDepth3(node.children, depth - 1) : { nodes: [], truncated: false, omittedChildrenCount: 0 };
7969
- omittedChildrenCount += childResult.omittedChildrenCount;
7970
- return {
7971
- ...node,
7972
- children: childResult.nodes.length > 0 ? childResult.nodes : void 0
7973
- };
7974
- });
7975
- return {
7976
- nodes: result,
7977
- truncated: omittedChildrenCount > 0,
7978
- omittedChildrenCount
7979
- };
7980
- }
7981
- function projectTreeFromSnapshot2(node, options = {}) {
7982
- const depth = options.depth ?? 2;
7983
- const scope = options.scope ?? "tracked";
7984
- const result = renderProjectionNode2(node, 0, { depth, scope });
7985
- return result ? [result] : [];
7986
- }
7987
- function projectSnapshotTree2(snapshot, options = {}) {
7988
- const depth = options.depth ?? 2;
7989
- const scope = options.scope ?? "tracked";
7990
- return snapshot.roots.map((root) => renderProjectionNode2(root, 0, { depth, scope })).filter((node) => node !== void 0);
7991
- }
7992
- function renderProjectionNode2(node, currentDepth, options) {
7993
- const canRenderChildren = options.depth === void 0 || currentDepth < options.depth;
7994
- const renderedChildren = canRenderChildren ? (node.children ?? []).map((child) => renderProjectionNode2(child, currentDepth + 1, options)).filter((child) => child !== void 0) : [];
7995
- const matchesScope = nodeMatchesProjectionScope2(node, options.scope);
7996
- const containsScope = matchesScope || nodeContainsProjectionScope2(node, options.scope);
7997
- if (!containsScope && renderedChildren.length === 0) {
7998
- return void 0;
7999
- }
8000
- const projectedNode = {
8001
- path: node.relativePath,
8002
- label: node.label,
8003
- kind: node.kind,
8004
- ...node.cognitionUri ? { cognition: toRelativeCognitionPath2(node) } : {},
8005
- ...node.description ? { description: node.description } : {},
8006
- observedStatus: node.status?.observedStatus ?? null,
8007
- ownObservedStatus: node.ownStatus?.ownObservedStatus ?? null,
8008
- tracked: node.ownStatus?.coverage?.ownCognition === "present"
8009
- };
8010
- if (renderedChildren.length > 0) {
8011
- projectedNode.children = renderedChildren;
8012
- }
8013
- return projectedNode;
8014
- }
8015
- function toRelativeCognitionPath2(node) {
8016
- if (!node.cognitionUri || !node.root) {
8017
- return "";
8018
- }
8019
- try {
8020
- return (0, mapping_js_1.toRelativeUriPath)(node.root.cognitionRootUri, node.cognitionUri);
8021
- } catch {
8022
- return node.cognitionUri.path;
8023
- }
8024
- }
8025
- function nodeMatchesProjectionScope2(node, scope) {
8026
- switch (scope) {
8027
- case "all":
8028
- return true;
8029
- case "tracked":
8030
- return node.ownStatus?.coverage?.ownCognition === "present";
8031
- case "untracked":
8032
- return node.ownStatus?.coverage?.ownCognition === "missing" && node.ownStatus.coverage.isMaterializable === true;
8033
- case "issues":
8034
- return (node.ownStatus?.issues?.length ?? 0) > 0;
8035
- default:
8036
- return false;
8037
- }
8038
- }
8039
- function nodeContainsProjectionScope2(node, scope) {
8040
- switch (scope) {
8041
- case "all":
8042
- return true;
8043
- case "tracked":
8044
- return (node.status?.coverage?.coveredCount ?? 0) > 0;
8045
- case "untracked":
8046
- return (node.status?.coverage?.missingMaterializableCount ?? 0) > 0;
8047
- case "issues":
8048
- return subtreeHasIssues2(node);
8049
- default:
8050
- return false;
8051
- }
8052
- }
8053
- function subtreeHasIssues2(node) {
8054
- if ((node.ownStatus?.issues?.length ?? 0) > 0) {
8055
- return true;
8056
- }
8057
- return (node.children ?? []).some((child) => subtreeHasIssues2(child));
8058
- }
8059
- }
8060
- });
8061
-
8062
7364
  // src/internal.ts
8063
7365
  var internal_exports = {};
8064
7366
  __export(internal_exports, {
@@ -8247,9 +7549,177 @@ function getEnvLogLevel() {
8247
7549
  return void 0;
8248
7550
  }
8249
7551
 
7552
+ // src/path-utils.ts
7553
+ function isAbsolute(p) {
7554
+ return p.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(p);
7555
+ }
7556
+ function dirname(p) {
7557
+ const trimmed = p.replace(/[/\\]+$/, "");
7558
+ const idx = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
7559
+ if (idx < 0) {
7560
+ return ".";
7561
+ }
7562
+ if (idx === 0) {
7563
+ return "/";
7564
+ }
7565
+ return trimmed.slice(0, idx);
7566
+ }
7567
+ function normalizeParts(p) {
7568
+ const parts = [];
7569
+ for (const seg of p.replace(/\\/g, "/").split("/")) {
7570
+ if (seg === "" || seg === ".") {
7571
+ continue;
7572
+ }
7573
+ if (seg === "..") {
7574
+ if (parts.length && parts[parts.length - 1] !== "..") {
7575
+ parts.pop();
7576
+ } else {
7577
+ parts.push("..");
7578
+ }
7579
+ } else {
7580
+ parts.push(seg);
7581
+ }
7582
+ }
7583
+ return parts;
7584
+ }
7585
+ function normalize(p) {
7586
+ const prefix = p.startsWith("/") ? "/" : /^[a-zA-Z]:[/\\]/.test(p) ? p.slice(0, 3) : "";
7587
+ return prefix + normalizeParts(p).join("/");
7588
+ }
7589
+ function resolve(...segments) {
7590
+ if (segments.length === 0) {
7591
+ return ".";
7592
+ }
7593
+ let resolved = "";
7594
+ for (let i = segments.length - 1; i >= 0; i--) {
7595
+ const segment = segments[i];
7596
+ if (!segment) {
7597
+ continue;
7598
+ }
7599
+ resolved = resolved ? `${segment}/${resolved}` : segment;
7600
+ if (isAbsolute(segment)) {
7601
+ break;
7602
+ }
7603
+ }
7604
+ return normalize(resolved || ".");
7605
+ }
7606
+ function relative(from, to) {
7607
+ const a = normalizeParts(from);
7608
+ const b = normalizeParts(to);
7609
+ let i = 0;
7610
+ while (i < a.length && i < b.length && a[i] === b[i]) {
7611
+ i++;
7612
+ }
7613
+ const up = a.slice(i).map(() => "..");
7614
+ const down = b.slice(i);
7615
+ return up.concat(down).join("/") || ".";
7616
+ }
7617
+ function join(...segments) {
7618
+ return normalize(segments.join("/"));
7619
+ }
7620
+ var posix = {
7621
+ isAbsolute(p) {
7622
+ return p.startsWith("/");
7623
+ },
7624
+ parse(p) {
7625
+ const i = p.lastIndexOf("/");
7626
+ const dir = i < 0 ? "" : p.slice(0, i);
7627
+ const file = i < 0 ? p : p.slice(i + 1);
7628
+ const j = file.lastIndexOf(".");
7629
+ if (j <= 0) {
7630
+ return { dir, name: file, ext: "" };
7631
+ }
7632
+ return { dir, name: file.slice(0, j), ext: file.slice(j) };
7633
+ },
7634
+ join(...segments) {
7635
+ return posix.normalize(segments.join("/"));
7636
+ },
7637
+ normalize(p) {
7638
+ const parts = [];
7639
+ for (const seg of p.split("/")) {
7640
+ if (seg === "" || seg === ".") {
7641
+ continue;
7642
+ }
7643
+ if (seg === "..") {
7644
+ if (parts.length && parts[parts.length - 1] !== "..") {
7645
+ parts.pop();
7646
+ } else {
7647
+ parts.push("..");
7648
+ }
7649
+ } else {
7650
+ parts.push(seg);
7651
+ }
7652
+ }
7653
+ return (p.startsWith("/") ? "/" : "") + parts.join("/");
7654
+ }
7655
+ };
7656
+ var win32 = {
7657
+ isAbsolute(p) {
7658
+ return /^[a-zA-Z]:[/\\]/.test(p);
7659
+ }
7660
+ };
7661
+
7662
+ // src/uri-utils.ts
7663
+ function uriKey(components) {
7664
+ return `${components.scheme}://${components.authority}${components.path}${components.query ? "?" + components.query : ""}${components.fragment ? "#" + components.fragment : ""}`;
7665
+ }
7666
+ function uriRelativePath(root, child) {
7667
+ if (root.scheme !== child.scheme || root.authority !== child.authority) {
7668
+ return void 0;
7669
+ }
7670
+ const rootPath = trimTrailingSlash(root.path);
7671
+ const childPath = trimTrailingSlash(child.path);
7672
+ if (childPath === rootPath) {
7673
+ return ".";
7674
+ }
7675
+ const prefix = rootPath + "/";
7676
+ if (!childPath.startsWith(prefix)) {
7677
+ return void 0;
7678
+ }
7679
+ return childPath.slice(prefix.length) || ".";
7680
+ }
7681
+ function isEqualOrChildUri(parent, child) {
7682
+ return uriRelativePath(parent, child) !== void 0;
7683
+ }
7684
+ function joinUriPath(base, ...segments) {
7685
+ let joined = trimTrailingSlash(base.path);
7686
+ for (const seg of segments) {
7687
+ if (seg === "..") {
7688
+ const idx = joined.lastIndexOf("/");
7689
+ if (idx > 0) {
7690
+ joined = joined.slice(0, idx);
7691
+ } else {
7692
+ joined = "/";
7693
+ }
7694
+ } else if (seg !== ".") {
7695
+ joined = joined === "/" ? "/" + seg : joined + "/" + seg;
7696
+ }
7697
+ }
7698
+ return { ...base, path: joined };
7699
+ }
7700
+ function uriBasename(uri) {
7701
+ const p = trimTrailingSlash(uri.path);
7702
+ const idx = p.lastIndexOf("/");
7703
+ return idx >= 0 ? p.slice(idx + 1) : p;
7704
+ }
7705
+ function formatUri(uri) {
7706
+ return uriKey(uri);
7707
+ }
7708
+ function trimTrailingSlash(value) {
7709
+ return value.length > 1 ? value.replace(/\/+$/u, "") : value;
7710
+ }
7711
+ function externalPathFromString(uriKeyStr) {
7712
+ if (uriKeyStr.startsWith("file://")) {
7713
+ const withoutScheme = uriKeyStr.slice(7);
7714
+ if (/^\/[a-zA-Z]:[/\\]/u.test(withoutScheme)) {
7715
+ return withoutScheme.slice(1);
7716
+ }
7717
+ return withoutScheme;
7718
+ }
7719
+ return uriKeyStr;
7720
+ }
7721
+
8250
7722
  // src/mapping.ts
8251
- init_path_utils();
8252
- init_uri_utils();
8253
7723
  function getProjectRootPath(configPath) {
8254
7724
  return resolve(dirname(configPath), "..");
8255
7725
  }
@@ -8453,9 +7923,6 @@ function computeCognitionIdentity(content) {
8453
7923
  return computeContentIdentity("cognition", content);
8454
7924
  }
8455
7925
 
8456
- // src/project/project.ts
8457
- init_uri_utils();
8458
-
8459
7926
  // src/registry/index.ts
8460
7927
  var import_node_crypto2 = require("node:crypto");
8461
7928
  var REGISTRY_SCHEMA_VERSION = 6;
@@ -8791,7 +8258,6 @@ function isIdentity(value) {
8791
8258
  }
8792
8259
 
8793
8260
  // src/cognitionDiscovery.ts
8794
- init_uri_utils();
8795
8261
  var FILE_TYPE_FILE = 1;
8796
8262
  var FILE_TYPE_DIRECTORY = 2;
8797
8263
  async function discoverCognitionEntries(fs, cognitionRootUri, options = {}) {
@@ -8923,7 +8389,6 @@ async function reconcileRegistry(registry, scanResult) {
8923
8389
 
8924
8390
  // src/project/workspace.ts
8925
8391
  var import_yaml = __toESM(require_dist());
8926
- init_uri_utils();
8927
8392
  async function discoverWorkspaceRoots(fs, config, logger) {
8928
8393
  const workspaceFolders = config.getWorkspaceFolders();
8929
8394
  const roots = [];
@@ -9809,11 +9274,7 @@ var __testing__ = {
9809
9274
  inspectNodeStatus
9810
9275
  };
9811
9276
 
9812
- // src/snapshot/tree.ts
9813
- init_uri_utils();
9814
-
9815
9277
  // src/gitignore.ts
9816
- init_uri_utils();
9817
9278
  async function loadGitignoreRules(projectRootUri, directoryUri, inheritedRules, fileReader) {
9818
9279
  const gitignoreUri = joinUriPath(directoryUri, ".gitignore");
9819
9280
  if (!await fileReader.exists(gitignoreUri)) {
@@ -9949,7 +9410,6 @@ function directoryEntryFingerprint(items) {
9949
9410
  }
9950
9411
 
9951
9412
  // src/snapshot/mappingIndex.ts
9952
- init_uri_utils();
9953
9413
  function buildMappingIndex(nodes) {
9954
9414
  const sourceToCognition = /* @__PURE__ */ new Map();
9955
9415
  const cognitionToSource = /* @__PURE__ */ new Map();
@@ -10657,7 +10117,6 @@ function isStringArray(value) {
10657
10117
  }
10658
10118
 
10659
10119
  // src/cognitionRoutes.ts
10660
- init_uri_utils();
10661
10120
  var FILE_TYPE_FILE3 = 1;
10662
10121
  var FILE_TYPE_DIRECTORY3 = 2;
10663
10122
  async function buildCognitionRoutes(root, fs, registryLookup, project, options = {}) {
@@ -10872,11 +10331,7 @@ var noOpWatchLeaseManager = {
10872
10331
  }
10873
10332
  };
10874
10333
 
10875
- // src/maintenance.ts
10876
- init_uri_utils();
10877
-
10878
10334
  // src/layout.ts
10879
- init_uri_utils();
10880
10335
  async function detectMisplacedCognitionEntries(root, fs, entries) {
10881
10336
  const misplaced = [];
10882
10337
  for (const [registryKey, entry] of Object.entries(entries)) {
@@ -11009,9 +10464,6 @@ function joinRelativePath3(rootUri, relativePath) {
11009
10464
  return segments.length === 0 ? rootUri : joinUriPath(rootUri, ...segments);
11010
10465
  }
11011
10466
 
11012
- // src/cognition/index.ts
11013
- init_uri_utils();
11014
-
11015
10467
  // src/cognition/leaf-handbook.md
11016
10468
  var leaf_handbook_default = "# Leaf Maintenance Handbook\n\n## Role\n\nA leaf is the atomic unit of cognition for one source file.\n\nIt records the design intent, hidden contract, rejected alternative, or\nnon-obvious boundary that would be lost if a reader only inspected the code.\n\n## Creation Rule\n\nNot every source file needs a leaf.\n\nCreate one when the file has:\n\n- A meaningful design decision\n- A boundary that is easy to misread\n- A hidden caller/callee contract\n- A non-obvious dependency rule\n- A role that matters more than what it exports\n\nDo not create one for files whose purpose is fully explained by file name,\ntypes, signatures, and nearby skeleton or module inventory.\n\n## WANOC Test\n\nUse the We-Are-Not-Our-Code test:\n\n> If you only saw the file name and a one-line comment, would this cognition\n> entry still tell you something not recoverable from signatures and code?\n\nIf the answer is no, remove the entry.\n\n## Preferred Structure\n\nUse this minimum shape:\n\n```markdown\n## Role\n\n## Design Decisions\n```\n\nAdd these only when they carry real cognition:\n\n- `Boundaries`\n- `Open Questions`\n\nAvoid standalone sections for:\n\n- `Callers`\n- `Dependencies`\n- `Invariants`\n- `What It Does Not Do`\n- `Responsibilities`\n\nThese sections are not forbidden, but they tend to bloat leaf files. Fold their\nuseful parts into design decisions or boundaries instead.\n\n## Design Source & Collisions\n\n### SSOT Projection\n\nWhen the agent is already working from an external single source of truth\n(SSOT) - an ADR, RFC, design doc, or documented verbal agreement - record its\nlocal projection inside the decision's entry: source identifier plus local\nimplication. Do not create a standalone `## References` section. If the\ndecision is self-evident from code, omit the source.\n\n### Collision Recording\n\nWhen multiple design sources constrain the same file and their constraints\ninteract or conflict, record the collision as a Note within the relevant\ndecision. Include: which sources, what the tension is, and how it was\nresolved at this node. This is the fastest place to surface collisions -\nhigher-level documents cannot see them.\n\n`Source` and `Note` are orthogonal. `Source` records the SSOT projection:\nsource identifier plus local implication. `Note` records the local collision\nwhen projected sources meet here.\n\n### Source-Aware Update\n\nWhen a cited source is relevant to the current change, use it to check whether\nthe local projection still holds. Use the cited Source to clarify local\ntension, not to start routine source auditing.\n\n## Boundaries Rule\n\nOnly record a boundary when a reasonable reader might otherwise misjudge what\nthis module is responsible for.\n\nGood boundary:\n\n- An API facade does not orchestrate multi-step workflows.\n\n## Invariants Rule\n\nRecord leaf-level invariants under the design decision they constrain.\n\n## Dependency Notes Rule\n\nDo not list source-level dependencies.\n\nMention a dependency only when it is design evidence: a boundary, access rule,\nconstraint, or non-obvious choice. Otherwise, let the source speak for itself.\n\n## Anti-Bloat Rule\n\nA leaf should not turn into a code summary, a source-level dependency list, or a\npile of negative claims.\n\nKeep only what adds design cognition beyond signatures and direct\nimplementation.\n\nA leaf that approaches the source file's length is probably restating code.\n\n## Update Rule\n\nUpdate a leaf when:\n\n- A design decision changes.\n- A hidden contract changes.\n- A dependency note that carries design meaning changes.\n- A previous boundary becomes misleading.\n- A design source already in scope changes the local implication.\n- A new collision between design sources at this node is discovered.\n\nDo not update a leaf unless the local design meaning changes.\n";
11017
10469
 
@@ -11194,7 +10646,6 @@ function relocateSourcePath(sourcePath, relocation) {
11194
10646
  }
11195
10647
 
11196
10648
  // src/project/projectContext.ts
11197
- init_uri_utils();
11198
10649
  function projectContextFromRoot(root) {
11199
10650
  return {
11200
10651
  label: root.label,
@@ -12307,8 +11758,6 @@ function isCoggitServices(value) {
12307
11758
  }
12308
11759
 
12309
11760
  // src/project/discover.ts
12310
- init_path_utils();
12311
- init_uri_utils();
12312
11761
  var DEFAULT_MAX_WALK_DEPTH = 20;
12313
11762
  async function findProjectRoot(startUri, fs, options) {
12314
11763
  const maxDepth = options?.maxWalkDepth ?? DEFAULT_MAX_WALK_DEPTH;
@@ -12343,7 +11792,6 @@ function isDotCoggitDir(path) {
12343
11792
  }
12344
11793
 
12345
11794
  // src/project/init.ts
12346
- init_uri_utils();
12347
11795
  var DEFAULT_SOURCE_ROOT = "src";
12348
11796
  var DEFAULT_COGNITION_ROOT = "src_cognition";
12349
11797
  var COGGIT_GITIGNORE_RULE = "*.bak";
@@ -12497,7 +11945,6 @@ function dedupePairs(pairs) {
12497
11945
  }
12498
11946
 
12499
11947
  // src/watchPipeline.ts
12500
- init_uri_utils();
12501
11948
  function selectWatchRefreshMode(kind, hasMappingIndex) {
12502
11949
  if (kind !== "change") {
12503
11950
  return "full";
@@ -12588,7 +12035,6 @@ function countTrue(values) {
12588
12035
  }
12589
12036
 
12590
12037
  // src/watchHost.ts
12591
- init_uri_utils();
12592
12038
  function createWatchHost(options) {
12593
12039
  let generation = 0;
12594
12040
  let subscription;
@@ -12693,9 +12139,6 @@ function matchProjects(projects, observation) {
12693
12139
  });
12694
12140
  }
12695
12141
 
12696
- // src/operations.ts
12697
- init_uri_utils();
12698
-
12699
12142
  // src/pathHints.ts
12700
12143
  var HINT_COLLECT_CAP = 5;
12701
12144
  function suggestPathHints(candidatePaths, sourcePath) {
@@ -13272,7 +12715,6 @@ function getCoggitSystemPrompt(kind = "minimal") {
13272
12715
  }
13273
12716
 
13274
12717
  // src/projection.ts
13275
- var import_mapping12 = __toESM(require_mapping());
13276
12718
  function applyTreeDepth(nodes, depth) {
13277
12719
  let omittedChildrenCount = 0;
13278
12720
  const result = nodes.map((node) => {
@@ -13338,7 +12780,7 @@ function toRelativeCognitionPath(node) {
13338
12780
  return "";
13339
12781
  }
13340
12782
  try {
13341
- return (0, import_mapping12.toRelativeUriPath)(node.root.cognitionRootUri, node.cognitionUri);
12783
+ return toRelativeUriPath(node.root.cognitionRootUri, node.cognitionUri);
13342
12784
  } catch {
13343
12785
  return node.cognitionUri.path;
13344
12786
  }
@@ -13379,8 +12821,6 @@ function subtreeHasIssues(node) {
13379
12821
  }
13380
12822
 
13381
12823
  // src/routesProjection.ts
13382
- var import_pathHints2 = __toESM(require_pathHints());
13383
- var import_projection = __toESM(require_projection());
13384
12824
  var DEFAULT_ROUTES_DEPTH = 2;
13385
12825
  function projectRoutesEntries(entries) {
13386
12826
  return buildRoutesProjectionTree(entries.map((entry) => ({
@@ -13421,7 +12861,7 @@ function suggestRoutePathHints(tree, sourcePath, _sourceRoot) {
13421
12861
  return suggestHintsFromNormalizedPath(tree, normalizedPath);
13422
12862
  }
13423
12863
  function suggestHintsFromNormalizedPath(tree, normalizedPath) {
13424
- return (0, import_pathHints2.suggestPathHints)(
12864
+ return suggestPathHints(
13425
12865
  flattenRouteNodes(tree).map((node) => node.path),
13426
12866
  normalizedPath
13427
12867
  );
@@ -13514,7 +12954,7 @@ function assembleRoutesContent(input, options = {}) {
13514
12954
  projectRootUri: options.projectRootUri,
13515
12955
  sourceRootUri: options.sourceRootUri
13516
12956
  });
13517
- const depthResult = (0, import_projection.applyTreeDepth)(selection.nodes, depth);
12957
+ const depthResult = applyTreeDepth(selection.nodes, depth);
13518
12958
  const content = {
13519
12959
  project: input.project,
13520
12960
  depth,
@@ -14086,9 +13526,6 @@ function projectStatusTriage(inspection) {
14086
13526
  };
14087
13527
  }
14088
13528
 
14089
- // src/internal.ts
14090
- init_uri_utils();
14091
-
14092
13529
  // src/registry/inMemoryRegistryProvider.ts
14093
13530
  var InMemoryRegistryProvider = class {
14094
13531
  data = null;
@@ -14103,9 +13540,6 @@ var InMemoryRegistryProvider = class {
14103
13540
  this.data = { schemaVersion: 0, entries: {} };
14104
13541
  }
14105
13542
  };
14106
-
14107
- // src/internal.ts
14108
- init_uri_utils();
14109
13543
  // Annotate the CommonJS export names for ESM import in node:
14110
13544
  0 && (module.exports = {
14111
13545
  ADD_OPERATION_ERROR_CODES,