@yawlabs/ctxlint 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,465 @@
1
+ import {
2
+ __commonJS,
3
+ __require
4
+ } from "./chunk-MCKGQKYU.js";
5
+
6
+ // node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs
7
+ var require_tiktoken_bg = __commonJS({
8
+ "node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs"(exports, module) {
9
+ "use strict";
10
+ var wasm;
11
+ module.exports.__wbg_set_wasm = function(val) {
12
+ wasm = val;
13
+ };
14
+ var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
15
+ var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
16
+ cachedTextDecoder.decode();
17
+ var cachedUint8ArrayMemory0 = null;
18
+ function getUint8ArrayMemory0() {
19
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
20
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
21
+ }
22
+ return cachedUint8ArrayMemory0;
23
+ }
24
+ function getStringFromWasm0(ptr, len) {
25
+ ptr = ptr >>> 0;
26
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
27
+ }
28
+ var heap = new Array(128).fill(void 0);
29
+ heap.push(void 0, null, true, false);
30
+ var heap_next = heap.length;
31
+ function addHeapObject(obj) {
32
+ if (heap_next === heap.length) heap.push(heap.length + 1);
33
+ const idx = heap_next;
34
+ heap_next = heap[idx];
35
+ heap[idx] = obj;
36
+ return idx;
37
+ }
38
+ function handleError(f, args) {
39
+ try {
40
+ return f.apply(this, args);
41
+ } catch (e) {
42
+ wasm.__wbindgen_export_0(addHeapObject(e));
43
+ }
44
+ }
45
+ function getObject(idx) {
46
+ return heap[idx];
47
+ }
48
+ function dropObject(idx) {
49
+ if (idx < 132) return;
50
+ heap[idx] = heap_next;
51
+ heap_next = idx;
52
+ }
53
+ function takeObject(idx) {
54
+ const ret = getObject(idx);
55
+ dropObject(idx);
56
+ return ret;
57
+ }
58
+ var WASM_VECTOR_LEN = 0;
59
+ var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
60
+ var cachedTextEncoder = new lTextEncoder("utf-8");
61
+ var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
62
+ return cachedTextEncoder.encodeInto(arg, view);
63
+ } : function(arg, view) {
64
+ const buf = cachedTextEncoder.encode(arg);
65
+ view.set(buf);
66
+ return {
67
+ read: arg.length,
68
+ written: buf.length
69
+ };
70
+ };
71
+ function passStringToWasm0(arg, malloc, realloc) {
72
+ if (realloc === void 0) {
73
+ const buf = cachedTextEncoder.encode(arg);
74
+ const ptr2 = malloc(buf.length, 1) >>> 0;
75
+ getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
76
+ WASM_VECTOR_LEN = buf.length;
77
+ return ptr2;
78
+ }
79
+ let len = arg.length;
80
+ let ptr = malloc(len, 1) >>> 0;
81
+ const mem = getUint8ArrayMemory0();
82
+ let offset = 0;
83
+ for (; offset < len; offset++) {
84
+ const code = arg.charCodeAt(offset);
85
+ if (code > 127) break;
86
+ mem[ptr + offset] = code;
87
+ }
88
+ if (offset !== len) {
89
+ if (offset !== 0) {
90
+ arg = arg.slice(offset);
91
+ }
92
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
93
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
94
+ const ret = encodeString(arg, view);
95
+ offset += ret.written;
96
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
97
+ }
98
+ WASM_VECTOR_LEN = offset;
99
+ return ptr;
100
+ }
101
+ function isLikeNone(x) {
102
+ return x === void 0 || x === null;
103
+ }
104
+ var cachedDataViewMemory0 = null;
105
+ function getDataViewMemory0() {
106
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
107
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
108
+ }
109
+ return cachedDataViewMemory0;
110
+ }
111
+ var cachedUint32ArrayMemory0 = null;
112
+ function getUint32ArrayMemory0() {
113
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
114
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
115
+ }
116
+ return cachedUint32ArrayMemory0;
117
+ }
118
+ function getArrayU32FromWasm0(ptr, len) {
119
+ ptr = ptr >>> 0;
120
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
121
+ }
122
+ function passArray8ToWasm0(arg, malloc) {
123
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
124
+ getUint8ArrayMemory0().set(arg, ptr / 1);
125
+ WASM_VECTOR_LEN = arg.length;
126
+ return ptr;
127
+ }
128
+ function passArray32ToWasm0(arg, malloc) {
129
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
130
+ getUint32ArrayMemory0().set(arg, ptr / 4);
131
+ WASM_VECTOR_LEN = arg.length;
132
+ return ptr;
133
+ }
134
+ function getArrayU8FromWasm0(ptr, len) {
135
+ ptr = ptr >>> 0;
136
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
137
+ }
138
+ module.exports.get_encoding = function(encoding, extend_special_tokens) {
139
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
140
+ try {
141
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
142
+ const ptr0 = passStringToWasm0(encoding, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
143
+ const len0 = WASM_VECTOR_LEN;
144
+ wasm.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
147
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
148
+ if (r2) {
149
+ throw takeObject(r1);
150
+ }
151
+ return Tiktoken.__wrap(r0);
152
+ } finally {
153
+ wasm.__wbindgen_add_to_stack_pointer(16);
154
+ }
155
+ };
156
+ module.exports.encoding_for_model = function(model, extend_special_tokens) {
157
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
158
+ try {
159
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
+ const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
161
+ const len0 = WASM_VECTOR_LEN;
162
+ wasm.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
163
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
164
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
165
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
166
+ if (r2) {
167
+ throw takeObject(r1);
168
+ }
169
+ return Tiktoken.__wrap(r0);
170
+ } finally {
171
+ wasm.__wbindgen_add_to_stack_pointer(16);
172
+ }
173
+ };
174
+ module.exports.get_encoding_name_for_model = function(model) {
175
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
176
+ let deferred3_0;
177
+ let deferred3_1;
178
+ try {
179
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
180
+ const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
181
+ const len0 = WASM_VECTOR_LEN;
182
+ wasm.get_encoding_name_for_model(retptr, ptr0, len0);
183
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
184
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
185
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
186
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
187
+ var ptr2 = r0;
188
+ var len2 = r1;
189
+ if (r3) {
190
+ ptr2 = 0;
191
+ len2 = 0;
192
+ throw takeObject(r2);
193
+ }
194
+ deferred3_0 = ptr2;
195
+ deferred3_1 = len2;
196
+ return getStringFromWasm0(ptr2, len2);
197
+ } finally {
198
+ wasm.__wbindgen_add_to_stack_pointer(16);
199
+ wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
200
+ }
201
+ };
202
+ var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
203
+ }, unregister: () => {
204
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_tiktoken_free(ptr >>> 0, 1));
205
+ var Tiktoken = class _Tiktoken {
206
+ /**
207
+ * @param {string} tiktoken_bfe
208
+ * @param {any} special_tokens
209
+ * @param {string} pat_str
210
+ */
211
+ constructor(tiktoken_bfe, special_tokens, pat_str) {
212
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
213
+ const ptr0 = passStringToWasm0(tiktoken_bfe, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
214
+ const len0 = WASM_VECTOR_LEN;
215
+ const ptr1 = passStringToWasm0(pat_str, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
216
+ const len1 = WASM_VECTOR_LEN;
217
+ const ret = wasm.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
218
+ this.__wbg_ptr = ret >>> 0;
219
+ TiktokenFinalization.register(this, this.__wbg_ptr, this);
220
+ return this;
221
+ }
222
+ /** @returns {string | undefined} */
223
+ get name() {
224
+ try {
225
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
226
+ wasm.tiktoken_name(retptr, this.__wbg_ptr);
227
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
228
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
229
+ let v1;
230
+ if (r0 !== 0) {
231
+ v1 = getStringFromWasm0(r0, r1).slice();
232
+ wasm.__wbindgen_export_3(r0, r1 * 1, 1);
233
+ }
234
+ return v1;
235
+ } finally {
236
+ wasm.__wbindgen_add_to_stack_pointer(16);
237
+ }
238
+ }
239
+ static __wrap(ptr) {
240
+ ptr = ptr >>> 0;
241
+ const obj = Object.create(_Tiktoken.prototype);
242
+ obj.__wbg_ptr = ptr;
243
+ TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
244
+ return obj;
245
+ }
246
+ __destroy_into_raw() {
247
+ const ptr = this.__wbg_ptr;
248
+ this.__wbg_ptr = 0;
249
+ TiktokenFinalization.unregister(this);
250
+ return ptr;
251
+ }
252
+ free() {
253
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
254
+ const ptr = this.__destroy_into_raw();
255
+ wasm.__wbg_tiktoken_free(ptr, 0);
256
+ }
257
+ /**
258
+ * @param {string} text
259
+ * @param {any} allowed_special
260
+ * @param {any} disallowed_special
261
+ * @returns {Uint32Array}
262
+ */
263
+ encode(text, allowed_special, disallowed_special) {
264
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
265
+ try {
266
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
267
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
268
+ const len0 = WASM_VECTOR_LEN;
269
+ wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
270
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
271
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
272
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
273
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
274
+ if (r3) {
275
+ throw takeObject(r2);
276
+ }
277
+ var v2 = getArrayU32FromWasm0(r0, r1).slice();
278
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
279
+ return v2;
280
+ } finally {
281
+ wasm.__wbindgen_add_to_stack_pointer(16);
282
+ }
283
+ }
284
+ /**
285
+ * @param {string} text
286
+ * @returns {Uint32Array}
287
+ */
288
+ encode_ordinary(text) {
289
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
290
+ try {
291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
292
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
293
+ const len0 = WASM_VECTOR_LEN;
294
+ wasm.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
295
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
296
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
297
+ var v2 = getArrayU32FromWasm0(r0, r1).slice();
298
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
299
+ return v2;
300
+ } finally {
301
+ wasm.__wbindgen_add_to_stack_pointer(16);
302
+ }
303
+ }
304
+ /**
305
+ * @param {string} text
306
+ * @param {any} allowed_special
307
+ * @param {any} disallowed_special
308
+ * @returns {any}
309
+ */
310
+ encode_with_unstable(text, allowed_special, disallowed_special) {
311
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
312
+ try {
313
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
314
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
315
+ const len0 = WASM_VECTOR_LEN;
316
+ wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
317
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
318
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
319
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
320
+ if (r2) {
321
+ throw takeObject(r1);
322
+ }
323
+ return takeObject(r0);
324
+ } finally {
325
+ wasm.__wbindgen_add_to_stack_pointer(16);
326
+ }
327
+ }
328
+ /**
329
+ * @param {Uint8Array} bytes
330
+ * @returns {number}
331
+ */
332
+ encode_single_token(bytes) {
333
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
334
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_1);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ const ret = wasm.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
337
+ return ret >>> 0;
338
+ }
339
+ /**
340
+ * @param {Uint32Array} tokens
341
+ * @returns {Uint8Array}
342
+ */
343
+ decode(tokens) {
344
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
345
+ try {
346
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
347
+ const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_export_1);
348
+ const len0 = WASM_VECTOR_LEN;
349
+ wasm.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
350
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
351
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
352
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
353
+ wasm.__wbindgen_export_3(r0, r1 * 1, 1);
354
+ return v2;
355
+ } finally {
356
+ wasm.__wbindgen_add_to_stack_pointer(16);
357
+ }
358
+ }
359
+ /**
360
+ * @param {number} token
361
+ * @returns {Uint8Array}
362
+ */
363
+ decode_single_token_bytes(token) {
364
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
365
+ try {
366
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
367
+ wasm.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
368
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
371
+ wasm.__wbindgen_export_3(r0, r1 * 1, 1);
372
+ return v1;
373
+ } finally {
374
+ wasm.__wbindgen_add_to_stack_pointer(16);
375
+ }
376
+ }
377
+ /** @returns {any} */
378
+ token_byte_values() {
379
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
380
+ const ret = wasm.tiktoken_token_byte_values(this.__wbg_ptr);
381
+ return takeObject(ret);
382
+ }
383
+ };
384
+ module.exports.Tiktoken = Tiktoken;
385
+ module.exports.__wbg_parse_def2e24ef1252aff = function() {
386
+ return handleError(function(arg0, arg1) {
387
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
388
+ return addHeapObject(ret);
389
+ }, arguments);
390
+ };
391
+ module.exports.__wbg_stringify_f7ed6987935b4a24 = function() {
392
+ return handleError(function(arg0) {
393
+ const ret = JSON.stringify(getObject(arg0));
394
+ return addHeapObject(ret);
395
+ }, arguments);
396
+ };
397
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
398
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
399
+ return addHeapObject(ret);
400
+ };
401
+ module.exports.__wbindgen_is_undefined = function(arg0) {
402
+ const ret = getObject(arg0) === void 0;
403
+ return ret;
404
+ };
405
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
406
+ takeObject(arg0);
407
+ };
408
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
409
+ if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
410
+ const obj = getObject(arg1);
411
+ const ret = typeof obj === "string" ? obj : void 0;
412
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
413
+ var len1 = WASM_VECTOR_LEN;
414
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
415
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
416
+ };
417
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
418
+ throw new Error(getStringFromWasm0(arg0, arg1));
419
+ };
420
+ }
421
+ });
422
+
423
+ // node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs
424
+ var require_tiktoken = __commonJS({
425
+ "node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs"(exports) {
426
+ var wasm = require_tiktoken_bg();
427
+ var imports = {};
428
+ imports["./tiktoken_bg.js"] = wasm;
429
+ var path = __require("path");
430
+ var fs = __require("fs");
431
+ var candidates = __dirname.split(path.sep).reduce((memo, _, index, array) => {
432
+ const prefix = array.slice(0, index + 1).join(path.sep) + path.sep;
433
+ if (!prefix.includes("node_modules" + path.sep)) {
434
+ memo.unshift(
435
+ path.join(
436
+ prefix,
437
+ "node_modules",
438
+ "tiktoken",
439
+ "",
440
+ "./tiktoken_bg.wasm"
441
+ )
442
+ );
443
+ }
444
+ return memo;
445
+ }, []);
446
+ candidates.unshift(path.join(__dirname, "./tiktoken_bg.wasm"));
447
+ var bytes = null;
448
+ for (const candidate of candidates) {
449
+ try {
450
+ bytes = fs.readFileSync(candidate);
451
+ break;
452
+ } catch {
453
+ }
454
+ }
455
+ if (bytes == null) throw new Error("Missing tiktoken_bg.wasm");
456
+ var wasmModule = new WebAssembly.Module(bytes);
457
+ var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
458
+ wasm.__wbg_set_wasm(wasmInstance.exports);
459
+ exports["get_encoding"] = wasm["get_encoding"];
460
+ exports["encoding_for_model"] = wasm["encoding_for_model"];
461
+ exports["get_encoding_name_for_model"] = wasm["get_encoding_name_for_model"];
462
+ exports["Tiktoken"] = wasm["Tiktoken"];
463
+ }
464
+ });
465
+ export default require_tiktoken();
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  ALL_CHECKS,
4
4
  ALL_MCP_CHECKS,
5
+ ALL_SESSION_CHECKS,
5
6
  VERSION,
6
7
  applyFixes,
7
8
  fileExists,
@@ -12,7 +13,8 @@ import {
12
13
  resetGit,
13
14
  runAudit,
14
15
  scanForContextFiles
15
- } from "./chunk-FHTSMC5D.js";
16
+ } from "./chunk-DYPYGTPV.js";
17
+ import "./chunk-ZXMDA7VB.js";
16
18
 
17
19
  // src/mcp/server.ts
18
20
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -34,7 +36,12 @@ var checkEnum = z.enum([
34
36
  "mcp-env",
35
37
  "mcp-urls",
36
38
  "mcp-consistency",
37
- "mcp-redundancy"
39
+ "mcp-redundancy",
40
+ "session-missing-secret",
41
+ "session-diverged-file",
42
+ "session-missing-workflow",
43
+ "session-stale-memory",
44
+ "session-duplicate-memory"
38
45
  ]);
39
46
  var server = new McpServer({
40
47
  name: "ctxlint",
@@ -42,7 +49,7 @@ var server = new McpServer({
42
49
  });
43
50
  server.tool(
44
51
  "ctxlint_audit",
45
- "Audit all AI agent context files (CLAUDE.md, AGENTS.md, etc.) in the project for stale references, invalid commands, redundant content, contradictions, frontmatter issues, and token waste.",
52
+ "Audit all AI agent context files (CLAUDE.md, AGENTS.md, etc.) and optionally MCP server configs in the project. Checks for stale references, invalid commands, redundant content, contradictions, frontmatter issues, token waste, and MCP config errors.",
46
53
  {
47
54
  projectPath: z.string().optional().describe("Path to the project root. Defaults to current working directory."),
48
55
  checks: z.array(checkEnum).optional().describe("Which checks to run. Defaults to all.")
@@ -243,5 +250,39 @@ server.tool(
243
250
  }
244
251
  }
245
252
  );
253
+ server.tool(
254
+ "ctxlint_session_audit",
255
+ "Audit AI agent session data for cross-project consistency. Checks for missing GitHub secrets, diverged config files, missing workflows, stale memory entries, and duplicate memories across sibling repositories.",
256
+ {
257
+ projectPath: z.string().optional().describe("Path to the project root. Defaults to current working directory."),
258
+ checks: z.array(checkEnum).optional().describe("Specific session checks to run (default: all session-* checks).")
259
+ },
260
+ {
261
+ readOnlyHint: true,
262
+ destructiveHint: false,
263
+ idempotentHint: true,
264
+ openWorldHint: true
265
+ },
266
+ async ({ projectPath, checks }) => {
267
+ const root = path.resolve(projectPath || process.cwd());
268
+ const activeChecks = checks || ALL_SESSION_CHECKS;
269
+ try {
270
+ const result = await runAudit(root, activeChecks, {
271
+ session: true,
272
+ sessionOnly: true
273
+ });
274
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
275
+ } catch (err) {
276
+ const msg = err instanceof Error ? err.message : String(err);
277
+ return {
278
+ content: [{ type: "text", text: JSON.stringify({ error: msg }) }],
279
+ isError: true
280
+ };
281
+ } finally {
282
+ freeEncoder();
283
+ resetGit();
284
+ }
285
+ }
286
+ );
246
287
  var transport = new StdioServerTransport();
247
288
  await server.connect(transport);