@yawlabs/ctxlint 0.9.4 → 0.9.6

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.
@@ -148,17 +148,6 @@
148
148
  "fixable": false,
149
149
  "stability": "stable"
150
150
  },
151
- {
152
- "id": "commands/npm-auth-trap",
153
- "category": "commands",
154
- "severity": "info",
155
- "description": "Context file documents an npm write operation (deprecate, unpublish, dist-tag, access, owner) as a local CLI command. Under WebAuthn-only 2FA (no TOTP authenticator), these commands return 422 because npm treats CLI web-auth tokens as not-2FA-authenticated for writes. The npm website settings UI is the only path that works; CI-driven workflows are the scalable alternative.",
156
- "trigger": "Context file references `npm deprecate`, `npm unpublish`, `npm dist-tag add/rm/set`, `npm access grant/revoke/2fa`, or `npm owner add/rm` as a command.",
157
- "message": "\"{cmd}\" — npm {op} requires a 2FA-authenticated session; CLI returns 422 under WebAuthn-only auth",
158
- "fixable": false,
159
- "stability": "experimental",
160
- "source": "https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification"
161
- },
162
151
  {
163
152
  "id": "staleness/stale",
164
153
  "category": "staleness",
package/dist/index.js CHANGED
@@ -25639,7 +25639,7 @@ var require_compile = __commonJS({
25639
25639
  }
25640
25640
  }
25641
25641
  exports.compileSchema = compileSchema;
25642
- function resolveRef2(root, baseId, ref) {
25642
+ function resolveRef3(root, baseId, ref) {
25643
25643
  var _a3;
25644
25644
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
25645
25645
  const schOrFunc = root.refs[ref];
@@ -25656,7 +25656,7 @@ var require_compile = __commonJS({
25656
25656
  return;
25657
25657
  return root.refs[ref] = inlineOrCompile.call(this, _sch);
25658
25658
  }
25659
- exports.resolveRef = resolveRef2;
25659
+ exports.resolveRef = resolveRef3;
25660
25660
  function inlineOrCompile(sch) {
25661
25661
  if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
25662
25662
  return sch.schema;
@@ -34482,473 +34482,28 @@ var init_scanner = __esm({
34482
34482
  }
34483
34483
  });
34484
34484
 
34485
- // node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs
34486
- var require_tiktoken_bg = __commonJS({
34487
- "node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs"(exports, module) {
34488
- var wasm;
34489
- module.exports.__wbg_set_wasm = function(val) {
34490
- wasm = val;
34491
- };
34492
- var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
34493
- var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
34494
- cachedTextDecoder.decode();
34495
- var cachedUint8ArrayMemory0 = null;
34496
- function getUint8ArrayMemory0() {
34497
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
34498
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
34499
- }
34500
- return cachedUint8ArrayMemory0;
34501
- }
34502
- function getStringFromWasm0(ptr, len) {
34503
- ptr = ptr >>> 0;
34504
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
34505
- }
34506
- var heap = new Array(128).fill(void 0);
34507
- heap.push(void 0, null, true, false);
34508
- var heap_next = heap.length;
34509
- function addHeapObject(obj) {
34510
- if (heap_next === heap.length) heap.push(heap.length + 1);
34511
- const idx = heap_next;
34512
- heap_next = heap[idx];
34513
- heap[idx] = obj;
34514
- return idx;
34515
- }
34516
- function handleError(f, args) {
34517
- try {
34518
- return f.apply(this, args);
34519
- } catch (e) {
34520
- wasm.__wbindgen_export_0(addHeapObject(e));
34521
- }
34522
- }
34523
- function getObject(idx) {
34524
- return heap[idx];
34525
- }
34526
- function dropObject(idx) {
34527
- if (idx < 132) return;
34528
- heap[idx] = heap_next;
34529
- heap_next = idx;
34530
- }
34531
- function takeObject(idx) {
34532
- const ret = getObject(idx);
34533
- dropObject(idx);
34534
- return ret;
34535
- }
34536
- var WASM_VECTOR_LEN = 0;
34537
- var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
34538
- var cachedTextEncoder = new lTextEncoder("utf-8");
34539
- var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
34540
- return cachedTextEncoder.encodeInto(arg, view);
34541
- } : function(arg, view) {
34542
- const buf = cachedTextEncoder.encode(arg);
34543
- view.set(buf);
34544
- return {
34545
- read: arg.length,
34546
- written: buf.length
34547
- };
34548
- };
34549
- function passStringToWasm0(arg, malloc, realloc) {
34550
- if (realloc === void 0) {
34551
- const buf = cachedTextEncoder.encode(arg);
34552
- const ptr2 = malloc(buf.length, 1) >>> 0;
34553
- getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
34554
- WASM_VECTOR_LEN = buf.length;
34555
- return ptr2;
34556
- }
34557
- let len = arg.length;
34558
- let ptr = malloc(len, 1) >>> 0;
34559
- const mem = getUint8ArrayMemory0();
34560
- let offset = 0;
34561
- for (; offset < len; offset++) {
34562
- const code = arg.charCodeAt(offset);
34563
- if (code > 127) break;
34564
- mem[ptr + offset] = code;
34565
- }
34566
- if (offset !== len) {
34567
- if (offset !== 0) {
34568
- arg = arg.slice(offset);
34569
- }
34570
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
34571
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
34572
- const ret = encodeString(arg, view);
34573
- offset += ret.written;
34574
- ptr = realloc(ptr, len, offset, 1) >>> 0;
34575
- }
34576
- WASM_VECTOR_LEN = offset;
34577
- return ptr;
34578
- }
34579
- function isLikeNone(x3) {
34580
- return x3 === void 0 || x3 === null;
34581
- }
34582
- var cachedDataViewMemory0 = null;
34583
- function getDataViewMemory0() {
34584
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
34585
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
34586
- }
34587
- return cachedDataViewMemory0;
34588
- }
34589
- var cachedUint32ArrayMemory0 = null;
34590
- function getUint32ArrayMemory0() {
34591
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
34592
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
34593
- }
34594
- return cachedUint32ArrayMemory0;
34595
- }
34596
- function getArrayU32FromWasm0(ptr, len) {
34597
- ptr = ptr >>> 0;
34598
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
34599
- }
34600
- function passArray8ToWasm0(arg, malloc) {
34601
- const ptr = malloc(arg.length * 1, 1) >>> 0;
34602
- getUint8ArrayMemory0().set(arg, ptr / 1);
34603
- WASM_VECTOR_LEN = arg.length;
34604
- return ptr;
34605
- }
34606
- function passArray32ToWasm0(arg, malloc) {
34607
- const ptr = malloc(arg.length * 4, 4) >>> 0;
34608
- getUint32ArrayMemory0().set(arg, ptr / 4);
34609
- WASM_VECTOR_LEN = arg.length;
34610
- return ptr;
34611
- }
34612
- function getArrayU8FromWasm0(ptr, len) {
34613
- ptr = ptr >>> 0;
34614
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
34615
- }
34616
- module.exports.get_encoding = function(encoding, extend_special_tokens) {
34617
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34618
- try {
34619
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34620
- const ptr0 = passStringToWasm0(encoding, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34621
- const len0 = WASM_VECTOR_LEN;
34622
- wasm.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
34623
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34624
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34625
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
34626
- if (r2) {
34627
- throw takeObject(r1);
34628
- }
34629
- return Tiktoken.__wrap(r0);
34630
- } finally {
34631
- wasm.__wbindgen_add_to_stack_pointer(16);
34632
- }
34633
- };
34634
- module.exports.encoding_for_model = function(model, extend_special_tokens) {
34635
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34636
- try {
34637
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34638
- const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34639
- const len0 = WASM_VECTOR_LEN;
34640
- wasm.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
34641
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34642
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34643
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
34644
- if (r2) {
34645
- throw takeObject(r1);
34646
- }
34647
- return Tiktoken.__wrap(r0);
34648
- } finally {
34649
- wasm.__wbindgen_add_to_stack_pointer(16);
34650
- }
34651
- };
34652
- module.exports.get_encoding_name_for_model = function(model) {
34653
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34654
- let deferred3_0;
34655
- let deferred3_1;
34656
- try {
34657
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34658
- const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34659
- const len0 = WASM_VECTOR_LEN;
34660
- wasm.get_encoding_name_for_model(retptr, ptr0, len0);
34661
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34662
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34663
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
34664
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
34665
- var ptr2 = r0;
34666
- var len2 = r1;
34667
- if (r3) {
34668
- ptr2 = 0;
34669
- len2 = 0;
34670
- throw takeObject(r2);
34671
- }
34672
- deferred3_0 = ptr2;
34673
- deferred3_1 = len2;
34674
- return getStringFromWasm0(ptr2, len2);
34675
- } finally {
34676
- wasm.__wbindgen_add_to_stack_pointer(16);
34677
- wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
34678
- }
34679
- };
34680
- var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
34681
- }, unregister: () => {
34682
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_tiktoken_free(ptr >>> 0, 1));
34683
- var Tiktoken = class _Tiktoken {
34684
- /**
34685
- * @param {string} tiktoken_bfe
34686
- * @param {any} special_tokens
34687
- * @param {string} pat_str
34688
- */
34689
- constructor(tiktoken_bfe, special_tokens, pat_str) {
34690
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34691
- const ptr0 = passStringToWasm0(tiktoken_bfe, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34692
- const len0 = WASM_VECTOR_LEN;
34693
- const ptr1 = passStringToWasm0(pat_str, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34694
- const len1 = WASM_VECTOR_LEN;
34695
- const ret = wasm.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
34696
- this.__wbg_ptr = ret >>> 0;
34697
- TiktokenFinalization.register(this, this.__wbg_ptr, this);
34698
- return this;
34699
- }
34700
- /** @returns {string | undefined} */
34701
- get name() {
34702
- try {
34703
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34704
- wasm.tiktoken_name(retptr, this.__wbg_ptr);
34705
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34706
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34707
- let v1;
34708
- if (r0 !== 0) {
34709
- v1 = getStringFromWasm0(r0, r1).slice();
34710
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
34711
- }
34712
- return v1;
34713
- } finally {
34714
- wasm.__wbindgen_add_to_stack_pointer(16);
34715
- }
34716
- }
34717
- static __wrap(ptr) {
34718
- ptr = ptr >>> 0;
34719
- const obj = Object.create(_Tiktoken.prototype);
34720
- obj.__wbg_ptr = ptr;
34721
- TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
34722
- return obj;
34723
- }
34724
- __destroy_into_raw() {
34725
- const ptr = this.__wbg_ptr;
34726
- this.__wbg_ptr = 0;
34727
- TiktokenFinalization.unregister(this);
34728
- return ptr;
34729
- }
34730
- free() {
34731
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34732
- const ptr = this.__destroy_into_raw();
34733
- wasm.__wbg_tiktoken_free(ptr, 0);
34734
- }
34735
- /**
34736
- * @param {string} text
34737
- * @param {any} allowed_special
34738
- * @param {any} disallowed_special
34739
- * @returns {Uint32Array}
34740
- */
34741
- encode(text, allowed_special, disallowed_special) {
34742
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34743
- try {
34744
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34745
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34746
- const len0 = WASM_VECTOR_LEN;
34747
- wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
34748
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34749
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34750
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
34751
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
34752
- if (r3) {
34753
- throw takeObject(r2);
34754
- }
34755
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
34756
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
34757
- return v2;
34758
- } finally {
34759
- wasm.__wbindgen_add_to_stack_pointer(16);
34760
- }
34761
- }
34762
- /**
34763
- * @param {string} text
34764
- * @returns {Uint32Array}
34765
- */
34766
- encode_ordinary(text) {
34767
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34768
- try {
34769
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34770
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34771
- const len0 = WASM_VECTOR_LEN;
34772
- wasm.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
34773
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34774
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34775
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
34776
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
34777
- return v2;
34778
- } finally {
34779
- wasm.__wbindgen_add_to_stack_pointer(16);
34780
- }
34781
- }
34782
- /**
34783
- * @param {string} text
34784
- * @param {any} allowed_special
34785
- * @param {any} disallowed_special
34786
- * @returns {any}
34787
- */
34788
- encode_with_unstable(text, allowed_special, disallowed_special) {
34789
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34790
- try {
34791
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34792
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34793
- const len0 = WASM_VECTOR_LEN;
34794
- wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
34795
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34796
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34797
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
34798
- if (r2) {
34799
- throw takeObject(r1);
34800
- }
34801
- return takeObject(r0);
34802
- } finally {
34803
- wasm.__wbindgen_add_to_stack_pointer(16);
34804
- }
34805
- }
34806
- /**
34807
- * @param {Uint8Array} bytes
34808
- * @returns {number}
34809
- */
34810
- encode_single_token(bytes) {
34811
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34812
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_1);
34813
- const len0 = WASM_VECTOR_LEN;
34814
- const ret = wasm.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
34815
- return ret >>> 0;
34816
- }
34817
- /**
34818
- * @param {Uint32Array} tokens
34819
- * @returns {Uint8Array}
34820
- */
34821
- decode(tokens) {
34822
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34823
- try {
34824
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34825
- const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_export_1);
34826
- const len0 = WASM_VECTOR_LEN;
34827
- wasm.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
34828
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34829
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34830
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
34831
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
34832
- return v2;
34833
- } finally {
34834
- wasm.__wbindgen_add_to_stack_pointer(16);
34835
- }
34836
- }
34837
- /**
34838
- * @param {number} token
34839
- * @returns {Uint8Array}
34840
- */
34841
- decode_single_token_bytes(token) {
34842
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34843
- try {
34844
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
34845
- wasm.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
34846
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
34847
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34848
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
34849
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
34850
- return v1;
34851
- } finally {
34852
- wasm.__wbindgen_add_to_stack_pointer(16);
34853
- }
34854
- }
34855
- /** @returns {any} */
34856
- token_byte_values() {
34857
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34858
- const ret = wasm.tiktoken_token_byte_values(this.__wbg_ptr);
34859
- return takeObject(ret);
34860
- }
34861
- };
34862
- module.exports.Tiktoken = Tiktoken;
34863
- module.exports.__wbg_parse_def2e24ef1252aff = function() {
34864
- return handleError(function(arg0, arg1) {
34865
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
34866
- return addHeapObject(ret);
34867
- }, arguments);
34868
- };
34869
- module.exports.__wbg_stringify_f7ed6987935b4a24 = function() {
34870
- return handleError(function(arg0) {
34871
- const ret = JSON.stringify(getObject(arg0));
34872
- return addHeapObject(ret);
34873
- }, arguments);
34874
- };
34875
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
34876
- const ret = new Error(getStringFromWasm0(arg0, arg1));
34877
- return addHeapObject(ret);
34878
- };
34879
- module.exports.__wbindgen_is_undefined = function(arg0) {
34880
- const ret = getObject(arg0) === void 0;
34881
- return ret;
34882
- };
34883
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
34884
- takeObject(arg0);
34885
- };
34886
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
34887
- if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
34888
- const obj = getObject(arg1);
34889
- const ret = typeof obj === "string" ? obj : void 0;
34890
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
34891
- var len1 = WASM_VECTOR_LEN;
34892
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
34893
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
34894
- };
34895
- module.exports.__wbindgen_throw = function(arg0, arg1) {
34896
- throw new Error(getStringFromWasm0(arg0, arg1));
34897
- };
34898
- }
34899
- });
34900
-
34901
- // node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs
34902
- var require_tiktoken = __commonJS({
34903
- "node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs"(exports) {
34904
- var wasm = require_tiktoken_bg();
34905
- var imports = {};
34906
- imports["./tiktoken_bg.js"] = wasm;
34907
- var path12 = __require("path");
34908
- var fs10 = __require("fs");
34909
- var candidates = __dirname.split(path12.sep).reduce((memo, _3, index, array2) => {
34910
- const prefix = array2.slice(0, index + 1).join(path12.sep) + path12.sep;
34911
- if (!prefix.includes("node_modules" + path12.sep)) {
34912
- memo.unshift(
34913
- path12.join(
34914
- prefix,
34915
- "node_modules",
34916
- "tiktoken",
34917
- "",
34918
- "./tiktoken_bg.wasm"
34919
- )
34920
- );
34921
- }
34922
- return memo;
34923
- }, []);
34924
- candidates.unshift(path12.join(__dirname, "./tiktoken_bg.wasm"));
34925
- var bytes = null;
34926
- for (const candidate of candidates) {
34927
- try {
34928
- bytes = fs10.readFileSync(candidate);
34929
- break;
34930
- } catch {
34931
- }
34932
- }
34933
- if (bytes == null) throw new Error("Missing tiktoken_bg.wasm");
34934
- var wasmModule = new WebAssembly.Module(bytes);
34935
- var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
34936
- wasm.__wbg_set_wasm(wasmInstance.exports);
34937
- exports["get_encoding"] = wasm["get_encoding"];
34938
- exports["encoding_for_model"] = wasm["encoding_for_model"];
34939
- exports["get_encoding_name_for_model"] = wasm["get_encoding_name_for_model"];
34940
- exports["Tiktoken"] = wasm["Tiktoken"];
34941
- }
34942
- });
34943
-
34944
34485
  // src/utils/tokens.ts
34945
- function getEncoder() {
34946
- if (!encoder && encodingForModel) {
34947
- encoder = encodingForModel("gpt-4");
34486
+ import { createRequire } from "node:module";
34487
+ function loadEncodingForModel() {
34488
+ if (loadAttempted) return encodingForModel;
34489
+ loadAttempted = true;
34490
+ try {
34491
+ const req = createRequire(import.meta.url);
34492
+ const tiktoken = req("tiktoken");
34493
+ encodingForModel = tiktoken.encoding_for_model;
34494
+ } catch {
34948
34495
  }
34496
+ return encodingForModel;
34497
+ }
34498
+ function getEncoder() {
34499
+ if (encoder) return encoder;
34500
+ const loader = loadEncodingForModel();
34501
+ if (!loader) return null;
34502
+ encoder = loader("gpt-4");
34949
34503
  return encoder;
34950
34504
  }
34951
34505
  function countTokens(text) {
34506
+ if (!text) return 0;
34952
34507
  const enc = getEncoder();
34953
34508
  if (!enc) {
34954
34509
  return Math.ceil(text.length / 4);
@@ -34968,16 +34523,12 @@ function freeEncoder() {
34968
34523
  function keepEncoderAlive(keep) {
34969
34524
  _keepAlive = keep;
34970
34525
  }
34971
- var encodingForModel, encoder, _keepAlive;
34526
+ var encodingForModel, loadAttempted, encoder, _keepAlive;
34972
34527
  var init_tokens = __esm({
34973
- async "src/utils/tokens.ts"() {
34528
+ "src/utils/tokens.ts"() {
34974
34529
  "use strict";
34975
34530
  encodingForModel = null;
34976
- try {
34977
- const tiktoken = await Promise.resolve().then(() => __toESM(require_tiktoken(), 1));
34978
- encodingForModel = tiktoken.encoding_for_model;
34979
- } catch {
34980
- }
34531
+ loadAttempted = false;
34981
34532
  encoder = null;
34982
34533
  _keepAlive = false;
34983
34534
  }
@@ -35067,6 +34618,10 @@ function extractPathReferences(lines, sections) {
35067
34618
  if (PATH_EXCLUDE.test(value)) continue;
35068
34619
  if (value.length < 3) continue;
35069
34620
  if (/^v?\d+\.\d+\//.test(value)) continue;
34621
+ if (/^\d+\/\d+$/.test(value)) continue;
34622
+ if (/^[A-Z][\w.-]*\/[A-Z][\w.-]*$/.test(value) && !value.includes(".")) {
34623
+ continue;
34624
+ }
35070
34625
  const column = match.index + match[0].length - match[1].length + 1;
35071
34626
  paths.push({
35072
34627
  value,
@@ -35171,11 +34726,11 @@ function extractCommandReferences(lines, sections) {
35171
34726
  }
35172
34727
  var PATH_PATTERN, PATH_EXCLUDE, COMMAND_PREFIXES, COMMON_COMMANDS;
35173
34728
  var init_parser = __esm({
35174
- async "src/core/parser.ts"() {
34729
+ "src/core/parser.ts"() {
35175
34730
  "use strict";
35176
34731
  init_fs();
35177
- await init_tokens();
35178
- PATH_PATTERN = /(?:^|[\s`"'(])((\.{0,2}\/)?(?:[\w@.-]+\/)+[\w.*-]+(?:\.\w+)?)(?=[\s`"'),;:]|$)/gm;
34732
+ init_tokens();
34733
+ PATH_PATTERN = /(?:^|[\s`"'(])((\.{0,2}\/)?(?:[\w@.-]+\/)+[\w.*-]*(?:\.\w+)?)(?=[\s`"'),;:]|$)/gm;
35179
34734
  PATH_EXCLUDE = /^(https?:\/\/|ftp:\/\/|mailto:|n\/a|w\/o|I\/O|i\/o|e\.g\.|N\/A|\.deb\/|\.rpm[.\/]|\.tar[.\/]|\.zip[.\/])/i;
35180
34735
  COMMAND_PREFIXES = /^\s*[\$>]\s+(.+)$/;
35181
34736
  COMMON_COMMANDS = /^(npm|npx|pnpm|yarn|make|cargo|go\s+(run|build|test)|python|pytest|vitest|jest|bun|deno)\b/;
@@ -41488,21 +41043,6 @@ async function checkCommands(file2, projectRoot) {
41488
41043
  const makefile = loadMakefile(projectRoot);
41489
41044
  for (const ref of file2.references.commands) {
41490
41045
  const cmd = ref.value;
41491
- const writeMatch = cmd.match(NPM_WRITE_OP_PATTERN);
41492
- if (writeMatch) {
41493
- const op = writeMatch[1].split(/\s+/)[0];
41494
- if (op !== "publish") {
41495
- issues.push({
41496
- severity: "info",
41497
- check: "commands",
41498
- ruleId: "commands/npm-auth-trap",
41499
- line: ref.line,
41500
- message: `"${cmd}" \u2014 npm ${op} requires a 2FA-authenticated session; CLI returns 422 under WebAuthn-only auth`,
41501
- suggestion: "Under WebAuthn 2FA without a TOTP fallback, the npm website UI (npmjs.com/package/<pkg>/settings) is the only path that works. For recurring writes, prefer a CI-driven workflow using a granular NPM_TOKEN secret.",
41502
- detail: "npm treats CLI web-auth tokens as not-2FA-authenticated for writes; WebAuthn yields no TOTP code to satisfy the check."
41503
- });
41504
- }
41505
- }
41506
41046
  const scriptMatch = cmd.match(NPM_SCRIPT_PATTERN);
41507
41047
  if (scriptMatch && pkgJson) {
41508
41048
  const scriptName = scriptMatch[1];
@@ -41622,7 +41162,7 @@ function hasMakeTarget(makefile, target) {
41622
41162
  const pattern = new RegExp(`^${target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:`, "m");
41623
41163
  return pattern.test(makefile);
41624
41164
  }
41625
- var NPM_SCRIPT_PATTERN, MAKE_PATTERN, NPX_PATTERN, NPM_WRITE_OP_PATTERN;
41165
+ var NPM_SCRIPT_PATTERN, MAKE_PATTERN, NPX_PATTERN;
41626
41166
  var init_commands = __esm({
41627
41167
  "src/core/checks/commands.ts"() {
41628
41168
  "use strict";
@@ -41630,7 +41170,6 @@ var init_commands = __esm({
41630
41170
  NPM_SCRIPT_PATTERN = /^(?:npm\s+run|pnpm(?:\s+run)?|yarn(?:\s+run)?|bun(?:\s+run)?)\s+(\S+)/;
41631
41171
  MAKE_PATTERN = /^make\s+(\S+)/;
41632
41172
  NPX_PATTERN = /^npx\s+(\S+)/;
41633
- NPM_WRITE_OP_PATTERN = /^npm\s+(publish|deprecate|unpublish|access\s+(grant|revoke|2fa)|dist-tag\s+(add|rm|set)|owner\s+(add|rm))\b/;
41634
41173
  }
41635
41174
  });
41636
41175
 
@@ -41801,8 +41340,8 @@ function isAlwaysLoaded(file2) {
41801
41340
  if (rel.includes("/rules/")) {
41802
41341
  return !hasPathsFrontmatter(file2.content);
41803
41342
  }
41804
- const basename2 = rel.split("/").pop() ?? "";
41805
- return ALWAYS_LOADED_BASENAMES.has(basename2);
41343
+ const basename3 = rel.split("/").pop() ?? "";
41344
+ return ALWAYS_LOADED_BASENAMES.has(basename3);
41806
41345
  }
41807
41346
  function computeSectionCosts(file2) {
41808
41347
  if (file2.sections.length === 0) return [];
@@ -41830,16 +41369,21 @@ function loadSettingsSources(projectRoot) {
41830
41369
  }
41831
41370
  return sources;
41832
41371
  }
41372
+ function canonicalizeCommand(backticked) {
41373
+ const beforeFlags = backticked.trim().split(/\s+--?/, 1)[0];
41374
+ return beforeFlags.replace(/\s+/g, " ");
41375
+ }
41833
41376
  function commandIsEnforced(cmd, settings) {
41834
- const lower = cmd.toLowerCase();
41377
+ const escaped = cmd.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
41378
+ const pattern = new RegExp(`\\b${escaped}\\b`, "i");
41835
41379
  for (const s of settings) {
41836
41380
  for (const entry of s.permissions?.deny ?? []) {
41837
- if (entry.toLowerCase().includes(lower)) return true;
41381
+ if (pattern.test(entry)) return true;
41838
41382
  }
41839
41383
  for (const h2 of s.hooks?.PreToolUse ?? []) {
41840
- if ((h2.matcher || "").toLowerCase().includes(lower)) return true;
41384
+ if (pattern.test(h2.matcher || "")) return true;
41841
41385
  for (const sub of h2.hooks ?? []) {
41842
- if ((sub.command || "").toLowerCase().includes(lower)) return true;
41386
+ if (pattern.test(sub.command || "")) return true;
41843
41387
  }
41844
41388
  }
41845
41389
  }
@@ -41850,10 +41394,9 @@ function checkHardEnforcement(file2, settings) {
41850
41394
  const lines = file2.content.split("\n");
41851
41395
  for (let i2 = 0; i2 < lines.length; i2++) {
41852
41396
  const line = lines[i2];
41853
- if (!INVIOLABLE_FRAMING.test(line)) continue;
41854
- COMMAND_IN_BACKTICKS.lastIndex = 0;
41855
- const matches = [...line.matchAll(COMMAND_IN_BACKTICKS)].map((m) => m[1]);
41856
- const cmd = matches.find((m) => /^[\w.-][\w\s.-]*/.test(m) && !m.includes("/"));
41397
+ const match = line.match(INVIOLABLE_WITH_COMMAND);
41398
+ if (!match) continue;
41399
+ const cmd = canonicalizeCommand(match[2]);
41857
41400
  if (!cmd) continue;
41858
41401
  if (commandIsEnforced(cmd, settings)) continue;
41859
41402
  issues.push({
@@ -41862,7 +41405,7 @@ function checkHardEnforcement(file2, settings) {
41862
41405
  ruleId: "tier-tokens/hard-enforcement-missing",
41863
41406
  line: i2 + 1,
41864
41407
  message: `Inviolable framing ("${line.trim().slice(0, 80)}") without a hook to back it up`,
41865
- suggestion: `Rules in always-loaded files are advisory. For "${cmd}", add a PreToolUse hook (or permissions.deny entry) in .claude/settings.json so the command is physically blocked.`
41408
+ suggestion: `Rules in always-loaded files are advisory. For \`${cmd}\`, add a PreToolUse hook (or permissions.deny entry) in .claude/settings.json so the command is physically blocked.`
41866
41409
  });
41867
41410
  }
41868
41411
  return issues;
@@ -41910,11 +41453,11 @@ function checkAggregateTierTokens(files) {
41910
41453
  suggestion: "Consider moving the largest files or their heaviest sections to on-demand tiers (skills, subagents, memory)."
41911
41454
  };
41912
41455
  }
41913
- var ALWAYS_LOADED_BASENAMES, TOP_SECTIONS_TO_REPORT, INVIOLABLE_FRAMING, COMMAND_IN_BACKTICKS;
41456
+ var ALWAYS_LOADED_BASENAMES, TOP_SECTIONS_TO_REPORT, INVIOLABLE_WITH_COMMAND;
41914
41457
  var init_tier_tokens = __esm({
41915
- async "src/core/checks/tier-tokens.ts"() {
41458
+ "src/core/checks/tier-tokens.ts"() {
41916
41459
  "use strict";
41917
- await init_tokens();
41460
+ init_tokens();
41918
41461
  init_tokens2();
41919
41462
  ALWAYS_LOADED_BASENAMES = /* @__PURE__ */ new Set([
41920
41463
  "CLAUDE.md",
@@ -41936,8 +41479,7 @@ var init_tier_tokens = __esm({
41936
41479
  "instructions.md"
41937
41480
  ]);
41938
41481
  TOP_SECTIONS_TO_REPORT = 3;
41939
- INVIOLABLE_FRAMING = /\b(NEVER|ALWAYS|DON'?T|DO NOT|MUST NOT)\b/i;
41940
- COMMAND_IN_BACKTICKS = /`([^`]+)`/g;
41482
+ INVIOLABLE_WITH_COMMAND = /\b(NEVER|ALWAYS|DON'?T|DO NOT|MUST NOT)\b[^.!?`]{0,80}`([^`]+)`/i;
41941
41483
  }
41942
41484
  });
41943
41485
 
@@ -42060,10 +41602,10 @@ function escapeRegex2(str) {
42060
41602
  }
42061
41603
  var PACKAGE_TECH_MAP;
42062
41604
  var init_redundancy = __esm({
42063
- async "src/core/checks/redundancy.ts"() {
41605
+ "src/core/checks/redundancy.ts"() {
42064
41606
  "use strict";
42065
41607
  init_fs();
42066
- await init_tokens();
41608
+ init_tokens();
42067
41609
  PACKAGE_TECH_MAP = {
42068
41610
  react: ["React", "react"],
42069
41611
  "react-dom": ["React DOM", "ReactDOM"],
@@ -43219,22 +42761,70 @@ function checkMissingFromClient(configs) {
43219
42761
  }
43220
42762
  return issues;
43221
42763
  }
42764
+ function collectServerNameKeys(content, rootKey) {
42765
+ const names = [];
42766
+ let i2 = 0;
42767
+ let depth = 0;
42768
+ let inString = false;
42769
+ let escape2 = false;
42770
+ let rootKeyDepth = -1;
42771
+ let pendingKey = "";
42772
+ let collectingKey = false;
42773
+ while (i2 < content.length) {
42774
+ const c3 = content[i2];
42775
+ if (escape2) {
42776
+ escape2 = false;
42777
+ if (collectingKey) pendingKey += c3;
42778
+ i2++;
42779
+ continue;
42780
+ }
42781
+ if (c3 === "\\" && inString) {
42782
+ escape2 = true;
42783
+ if (collectingKey) pendingKey += c3;
42784
+ i2++;
42785
+ continue;
42786
+ }
42787
+ if (c3 === '"') {
42788
+ if (!inString) {
42789
+ inString = true;
42790
+ collectingKey = true;
42791
+ pendingKey = "";
42792
+ } else {
42793
+ inString = false;
42794
+ let j3 = i2 + 1;
42795
+ while (j3 < content.length && /\s/.test(content[j3])) j3++;
42796
+ if (content[j3] === ":") {
42797
+ if (pendingKey === rootKey && rootKeyDepth === -1) {
42798
+ rootKeyDepth = depth;
42799
+ } else if (rootKeyDepth !== -1 && depth === rootKeyDepth + 1) {
42800
+ names.push(pendingKey);
42801
+ }
42802
+ }
42803
+ collectingKey = false;
42804
+ pendingKey = "";
42805
+ }
42806
+ i2++;
42807
+ continue;
42808
+ }
42809
+ if (inString) {
42810
+ if (collectingKey) pendingKey += c3;
42811
+ i2++;
42812
+ continue;
42813
+ }
42814
+ if (c3 === "{" || c3 === "[") depth++;
42815
+ else if (c3 === "}" || c3 === "]") depth--;
42816
+ i2++;
42817
+ }
42818
+ return names;
42819
+ }
43222
42820
  function checkSingleFileIssues(configs) {
43223
42821
  const issues = [];
43224
42822
  for (const config2 of configs) {
43225
- const nameCount = /* @__PURE__ */ new Map();
43226
- const lines = config2.content.split("\n");
43227
- for (const server2 of config2.servers) {
43228
- const escaped = server2.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
43229
- const pattern = new RegExp(`"${escaped}"\\s*:`, "g");
43230
- let count = 0;
43231
- for (const line of lines) {
43232
- if (pattern.test(line)) count++;
43233
- pattern.lastIndex = 0;
43234
- }
43235
- nameCount.set(server2.name, count);
43236
- }
43237
- for (const [name, count] of nameCount) {
42823
+ if (!config2.actualRootKey) continue;
42824
+ const serverKeys = collectServerNameKeys(config2.content, config2.actualRootKey);
42825
+ const counts = /* @__PURE__ */ new Map();
42826
+ for (const k3 of serverKeys) counts.set(k3, (counts.get(k3) ?? 0) + 1);
42827
+ for (const [name, count] of counts) {
43238
42828
  if (count > 1) {
43239
42829
  issues.push({
43240
42830
  severity: "warning",
@@ -43584,7 +43174,10 @@ var init_session_scanner = __esm({
43584
43174
  });
43585
43175
 
43586
43176
  // src/core/checks/session/missing-secret.ts
43587
- import { resolve as resolve5 } from "node:path";
43177
+ import { resolve as resolve5, basename as basename2 } from "node:path";
43178
+ function normalizePath(p2) {
43179
+ return resolve5(p2).replace(/\\/g, "/").toLowerCase();
43180
+ }
43588
43181
  async function checkMissingSecret(ctx) {
43589
43182
  const issues = [];
43590
43183
  const secrets = [];
@@ -43604,15 +43197,25 @@ async function checkMissingSecret(ctx) {
43604
43197
  byName.get(s.name).add(s.project);
43605
43198
  if (s.repo) byName.get(s.name).add(s.repo);
43606
43199
  }
43607
- const currentNorm = resolve5(ctx.currentProject).replace(/\\/g, "/");
43200
+ const currentNorm = normalizePath(ctx.currentProject);
43201
+ const currentBase = basename2(currentNorm);
43608
43202
  for (const [secretName, projects] of byName) {
43609
- const currentHas = [...projects].some(
43610
- (p2) => p2.includes(currentNorm) || currentNorm.includes(p2.replace(/\\/g, "/")) || p2.includes(resolve5(ctx.currentProject).split(/[/\\]/).pop() || "")
43611
- );
43203
+ const normalizedProjects = [...projects].map(normalizePath);
43204
+ const currentHas = normalizedProjects.some((p2) => {
43205
+ if (p2 === currentNorm) return true;
43206
+ const lastSegment = p2.split("/").pop() || "";
43207
+ return lastSegment === currentBase;
43208
+ });
43612
43209
  if (currentHas) continue;
43613
- const siblingMatches = ctx.siblings.filter(
43614
- (sib) => [...projects].some((p2) => p2.replace(/\\/g, "/").includes(sib.name) || p2.includes(sib.path))
43615
- );
43210
+ const siblingMatches = ctx.siblings.filter((sib) => {
43211
+ const sibNorm = normalizePath(sib.path);
43212
+ const sibBase = basename2(sibNorm);
43213
+ return normalizedProjects.some((p2) => {
43214
+ if (p2 === sibNorm) return true;
43215
+ const lastSegment = p2.split("/").pop() || "";
43216
+ return lastSegment === sibBase;
43217
+ });
43218
+ });
43616
43219
  if (siblingMatches.length >= 2) {
43617
43220
  const sibNames = siblingMatches.map((s) => s.name).join(", ");
43618
43221
  issues.push({
@@ -43769,6 +43372,15 @@ var init_missing_workflow = __esm({
43769
43372
  // src/core/checks/session/stale-memory.ts
43770
43373
  import { existsSync as existsSync4 } from "node:fs";
43771
43374
  import { resolve as resolve6, isAbsolute } from "node:path";
43375
+ function resolveRef2(ref, projectRoot) {
43376
+ if (ref.startsWith("~/") || ref === "~") {
43377
+ const home2 = process.env.HOME || process.env.USERPROFILE;
43378
+ if (!home2) return null;
43379
+ return ref === "~" ? home2 : resolve6(home2, ref.slice(2));
43380
+ }
43381
+ if (isAbsolute(ref)) return ref;
43382
+ return resolve6(projectRoot, ref);
43383
+ }
43772
43384
  async function checkStaleMemory(ctx) {
43773
43385
  const issues = [];
43774
43386
  const projectMemories = ctx.memories.filter(
@@ -43777,7 +43389,8 @@ async function checkStaleMemory(ctx) {
43777
43389
  for (const mem of projectMemories) {
43778
43390
  const brokenPaths = [];
43779
43391
  for (const ref of mem.referencedPaths) {
43780
- const fullPath = isAbsolute(ref) ? ref : resolve6(ctx.currentProject, ref);
43392
+ const fullPath = resolveRef2(ref, ctx.currentProject);
43393
+ if (!fullPath) continue;
43781
43394
  if (!existsSync4(fullPath)) {
43782
43395
  brokenPaths.push(ref);
43783
43396
  }
@@ -44153,7 +43766,7 @@ import { readFileSync as readFileSync4 } from "node:fs";
44153
43766
  import { resolve as resolve8, dirname as dirname3 } from "node:path";
44154
43767
  import { fileURLToPath } from "node:url";
44155
43768
  function loadVersion() {
44156
- if (true) return "0.9.4";
43769
+ if (true) return "0.9.6";
44157
43770
  const __dir = dirname3(fileURLToPath(import.meta.url));
44158
43771
  const pkgPath = resolve8(__dir, "../package.json");
44159
43772
  const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
@@ -44365,18 +43978,18 @@ async function runAudit(projectRoot, activeChecks, options = {}) {
44365
43978
  }
44366
43979
  var ALL_CHECKS, ALL_MCP_CHECKS, ALL_SESSION_CHECKS;
44367
43980
  var init_audit = __esm({
44368
- async "src/core/audit.ts"() {
43981
+ "src/core/audit.ts"() {
44369
43982
  "use strict";
44370
43983
  init_scanner();
44371
- await init_parser();
43984
+ init_parser();
44372
43985
  init_mcp_parser();
44373
- await init_tokens();
43986
+ init_tokens();
44374
43987
  init_paths();
44375
43988
  init_commands();
44376
43989
  init_staleness();
44377
43990
  init_tokens2();
44378
- await init_tier_tokens();
44379
- await init_redundancy();
43991
+ init_tier_tokens();
43992
+ init_redundancy();
44380
43993
  init_contradictions();
44381
43994
  init_frontmatter();
44382
43995
  init_schema();
@@ -44975,16 +44588,32 @@ import * as fs7 from "node:fs";
44975
44588
  function applyFixes(result, options = {}) {
44976
44589
  const log = options.quiet ? () => {
44977
44590
  } : console.log.bind(console);
44591
+ const dryRun = options.dryRun ?? false;
44592
+ const skipSymlinks = options.skipSymlinks ?? true;
44593
+ const symlinkFiles = /* @__PURE__ */ new Set();
44594
+ if (skipSymlinks) {
44595
+ for (const f of result.files) {
44596
+ if (f.isSymlink) symlinkFiles.add(f.path);
44597
+ }
44598
+ }
44978
44599
  const fixesByFile = /* @__PURE__ */ new Map();
44600
+ const skippedSymlinks = /* @__PURE__ */ new Set();
44979
44601
  for (const file2 of result.files) {
44980
44602
  for (const issue2 of file2.issues) {
44981
44603
  if (issue2.fix) {
44604
+ if (skipSymlinks && file2.isSymlink) {
44605
+ skippedSymlinks.add(file2.path);
44606
+ continue;
44607
+ }
44982
44608
  const existing = fixesByFile.get(issue2.fix.file) || [];
44983
44609
  existing.push(issue2.fix);
44984
44610
  fixesByFile.set(issue2.fix.file, existing);
44985
44611
  }
44986
44612
  }
44987
44613
  }
44614
+ for (const p2 of skippedSymlinks) {
44615
+ log(source_default.yellow(" Skipped") + ` ${p2}: symlink (use --follow-symlinks to override)`);
44616
+ }
44988
44617
  let totalFixes = 0;
44989
44618
  const filesModified = [];
44990
44619
  for (const [filePath, fixes] of fixesByFile) {
@@ -45006,8 +44635,9 @@ function applyFixes(result, options = {}) {
45006
44635
  if (line.includes(fix.oldText)) {
45007
44636
  line = line.replace(fix.oldText, fix.newText);
45008
44637
  totalFixes++;
44638
+ const prefix = dryRun ? source_default.cyan(" Would fix") : source_default.green(" Fixed");
45009
44639
  log(
45010
- source_default.green(" Fixed") + ` Line ${fix.line}: ${source_default.dim(fix.oldText)} ${source_default.dim("\u2192")} ${fix.newText}`
44640
+ prefix + ` Line ${fix.line}: ${source_default.dim(fix.oldText)} ${source_default.dim("\u2192")} ${fix.newText}`
45011
44641
  );
45012
44642
  }
45013
44643
  }
@@ -45026,7 +44656,9 @@ function applyFixes(result, options = {}) {
45026
44656
  continue;
45027
44657
  }
45028
44658
  }
45029
- fs7.writeFileSync(filePath, newContent, "utf-8");
44659
+ if (!dryRun) {
44660
+ fs7.writeFileSync(filePath, newContent, "utf-8");
44661
+ }
45030
44662
  filesModified.push(filePath);
45031
44663
  }
45032
44664
  }
@@ -45050,12 +44682,12 @@ var init_server3 = __esm({
45050
44682
  init_stdio2();
45051
44683
  init_zod();
45052
44684
  init_scanner();
45053
- await init_parser();
45054
- await init_audit();
44685
+ init_parser();
44686
+ init_audit();
45055
44687
  init_fixer();
45056
44688
  init_fs();
45057
44689
  init_git();
45058
- await init_tokens();
44690
+ init_tokens();
45059
44691
  init_git();
45060
44692
  init_paths();
45061
44693
  init_version2();
@@ -51984,6 +51616,13 @@ function buildRuleDescriptors() {
51984
51616
  shortDescription: { text: "Context file token usage" },
51985
51617
  helpUri: "https://github.com/yawlabs/ctxlint#what-it-checks"
51986
51618
  },
51619
+ {
51620
+ id: "ctxlint/tier-tokens",
51621
+ shortDescription: {
51622
+ text: "Tier-aware token accounting for always-loaded context files"
51623
+ },
51624
+ helpUri: "https://github.com/yawlabs/ctxlint#what-it-checks"
51625
+ },
51987
51626
  {
51988
51627
  id: "ctxlint/redundancy",
51989
51628
  shortDescription: { text: "Content is redundant or inferable" },
@@ -52078,6 +51717,13 @@ function buildRuleDescriptors() {
52078
51717
  id: "ctxlint/session-loop-detection",
52079
51718
  shortDescription: { text: "Agent looping pattern detected in session history" },
52080
51719
  helpUri: "https://github.com/yawlabs/ctxlint#what-it-checks"
51720
+ },
51721
+ {
51722
+ id: "ctxlint/session-memory-index-overflow",
51723
+ shortDescription: {
51724
+ text: "MEMORY.md exceeds Claude Code's 200-line / 25KB session-load cap"
51725
+ },
51726
+ helpUri: "https://github.com/yawlabs/ctxlint#what-it-checks"
52081
51727
  }
52082
51728
  ];
52083
51729
  }
@@ -52155,7 +51801,7 @@ async function runCli() {
52155
51801
  "Lint your AI agent context files and MCP server configs against your actual codebase"
52156
51802
  ).version(VERSION).argument("[path]", "Project directory to scan", ".").option("--strict", "Exit code 1 on any warning or error (for CI)", false).option("--checks <checks>", "Comma-separated list of checks to run", "").addOption(
52157
51803
  new Option("--format <format>", "Output format: text, json, or sarif").choices(["text", "json", "sarif"]).default("text")
52158
- ).option("--tokens", "Show token breakdown per file", false).option("--verbose", "Show passing checks too", false).option("--fix", "Auto-fix broken paths using git history and fuzzy matching", false).option("--ignore <checks>", "Comma-separated list of checks to ignore", "").option("--quiet", "Suppress all output except errors (exit code only)", false).option("--config <path>", "Path to config file (default: .ctxlintrc in project root)").option("--depth <n>", "Max subdirectory depth to scan (default: 2)", "2").option("--mcp", "Enable MCP config linting alongside context file checks", false).option("--mcp-only", "Run only MCP config checks, skip context file checks", false).option("--mcp-global", "Also scan user/global MCP config files (implies --mcp)", false).option("--mcp-server", "Start the MCP server (for IDE/agent integration)").option("--session", "Run session audit checks (cross-project consistency)", false).option("--session-only", "Run only session checks, skip context and MCP checks", false).option("--watch", "Re-lint on context file changes", false).action(async (projectPath, opts) => {
51804
+ ).option("--tokens", "Show token breakdown per file", false).option("--verbose", "Show passing checks too", false).option("--fix", "Auto-fix broken paths using git history and fuzzy matching", false).option("--fix-dry-run", "Preview --fix changes without writing", false).option("--yes", "Skip interactive confirmation prompts (required for --fix in TTY)", false).option("--follow-symlinks", "Allow --fix to write through symlinks (default: skip)", false).option("--ignore <checks>", "Comma-separated list of checks to ignore", "").option("--quiet", "Suppress all output except errors (exit code only)", false).option("--config <path>", "Path to config file (default: .ctxlintrc in project root)").option("--depth <n>", "Max subdirectory depth to scan (default: 2)", "2").option("--mcp", "Enable MCP config linting alongside context file checks", false).option("--mcp-only", "Run only MCP config checks, skip context file checks", false).option("--mcp-global", "Also scan user/global MCP config files (implies --mcp)", false).option("--mcp-server", "Start the MCP server (for IDE/agent integration)").option("--session", "Run session audit checks (cross-project consistency)", false).option("--session-only", "Run only session checks, skip context and MCP checks", false).option("--watch", "Re-lint on context file changes", false).action(async (projectPath, opts) => {
52159
51805
  const resolvedPath = path11.resolve(projectPath);
52160
51806
  const configPath = opts.config ? path11.resolve(opts.config) : void 0;
52161
51807
  const config2 = configPath ? loadConfigFromPath(configPath) : loadConfig(resolvedPath);
@@ -52237,14 +51883,59 @@ async function runCli() {
52237
51883
  }
52238
51884
  if (!opts.watch) return;
52239
51885
  }
52240
- if (options.fix) {
52241
- const fixSummary = applyFixes(result, { quiet: options.quiet });
52242
- if (fixSummary.totalFixes > 0 && !options.quiet) {
52243
- console.log(
52244
- `
52245
- Fixed ${fixSummary.totalFixes} issue${fixSummary.totalFixes !== 1 ? "s" : ""} in ${fixSummary.filesModified.length} file${fixSummary.filesModified.length !== 1 ? "s" : ""}.
51886
+ const dryRunFlag = opts.fixDryRun || false;
51887
+ const yes = opts.yes || false;
51888
+ const followSymlinks = opts.followSymlinks || false;
51889
+ const isInteractive2 = !!process.stdout.isTTY && !options.quiet;
51890
+ if (dryRunFlag || options.fix) {
51891
+ const commonOpts = { quiet: options.quiet, skipSymlinks: !followSymlinks };
51892
+ if (dryRunFlag) {
51893
+ const preview = applyFixes(result, { ...commonOpts, dryRun: true });
51894
+ if (!options.quiet) {
51895
+ if (preview.totalFixes === 0) {
51896
+ console.log("\nNo auto-fixable issues.\n");
51897
+ } else {
51898
+ console.log(
51899
+ `
51900
+ Would fix ${preview.totalFixes} issue${preview.totalFixes !== 1 ? "s" : ""} in ${preview.filesModified.length} file${preview.filesModified.length !== 1 ? "s" : ""}. (dry-run \u2014 no files modified)
52246
51901
  `
52247
- );
51902
+ );
51903
+ }
51904
+ }
51905
+ } else if (options.fix) {
51906
+ if (isInteractive2 && !yes) {
51907
+ const preview = applyFixes(result, { ...commonOpts, dryRun: true });
51908
+ if (preview.totalFixes === 0) {
51909
+ console.log("\nNo auto-fixable issues.\n");
51910
+ } else {
51911
+ console.log(
51912
+ `
51913
+ ${preview.totalFixes} fix${preview.totalFixes !== 1 ? "es" : ""} proposed across ${preview.filesModified.length} file${preview.filesModified.length !== 1 ? "s" : ""}.`
51914
+ );
51915
+ const confirmed = await promptYesNo(
51916
+ "Apply these fixes? Re-run with --yes to skip this prompt. [y/N] "
51917
+ );
51918
+ if (!confirmed) {
51919
+ console.log("Aborted. No files modified.\n");
51920
+ } else {
51921
+ const applied = applyFixes(result, commonOpts);
51922
+ console.log(
51923
+ `
51924
+ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${applied.filesModified.length} file${applied.filesModified.length !== 1 ? "s" : ""}.
51925
+ `
51926
+ );
51927
+ }
51928
+ }
51929
+ } else {
51930
+ const applied = applyFixes(result, commonOpts);
51931
+ if (applied.totalFixes > 0 && !options.quiet) {
51932
+ console.log(
51933
+ `
51934
+ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${applied.filesModified.length} file${applied.filesModified.length !== 1 ? "s" : ""}.
51935
+ `
51936
+ );
51937
+ }
51938
+ }
52248
51939
  }
52249
51940
  }
52250
51941
  if (!options.quiet) {
@@ -52396,6 +52087,16 @@ npx @yawlabs/ctxlint --strict
52396
52087
  });
52397
52088
  program2.parse();
52398
52089
  }
52090
+ async function promptYesNo(question) {
52091
+ const { createInterface: createInterface2 } = await import("node:readline/promises");
52092
+ const rl = createInterface2({ input: process.stdin, output: process.stdout });
52093
+ try {
52094
+ const answer = await rl.question(question);
52095
+ return /^\s*y(es)?\s*$/i.test(answer);
52096
+ } finally {
52097
+ rl.close();
52098
+ }
52099
+ }
52399
52100
  function loadConfigFromPath(configPath) {
52400
52101
  try {
52401
52102
  const content = fs9.readFileSync(configPath, "utf-8");
@@ -52408,7 +52109,7 @@ function loadConfigFromPath(configPath) {
52408
52109
  }
52409
52110
  var VALID_CHECKS;
52410
52111
  var init_cli = __esm({
52411
- async "src/cli.ts"() {
52112
+ "src/cli.ts"() {
52412
52113
  "use strict";
52413
52114
  init_esm3();
52414
52115
  init_ora();
@@ -52416,11 +52117,11 @@ var init_cli = __esm({
52416
52117
  init_tokens2();
52417
52118
  init_reporter();
52418
52119
  init_fixer();
52419
- await init_tokens();
52120
+ init_tokens();
52420
52121
  init_git();
52421
52122
  init_fs();
52422
52123
  init_config2();
52423
- await init_audit();
52124
+ init_audit();
52424
52125
  init_version2();
52425
52126
  VALID_CHECKS = /* @__PURE__ */ new Set([...ALL_CHECKS, ...ALL_MCP_CHECKS, ...ALL_SESSION_CHECKS]);
52426
52127
  }
@@ -52430,7 +52131,7 @@ var init_cli = __esm({
52430
52131
  if (process.argv.includes("--mcp-server")) {
52431
52132
  await init_server3().then(() => server_exports);
52432
52133
  } else {
52433
- const { runCli: runCli2 } = await init_cli().then(() => cli_exports);
52134
+ const { runCli: runCli2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
52434
52135
  await runCli2();
52435
52136
  }
52436
52137
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/ctxlint",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Lint your AI agent context files, MCP server configs, and session data against your actual codebase",
5
5
  "bin": {
6
6
  "ctxlint": "dist/index.js"