agentinit 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # [1.3.0](https://github.com/agentinit/agentinit/compare/v1.2.1...v1.3.0) (2025-09-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * address review comments ([e337f07](https://github.com/agentinit/agentinit/commit/e337f072bd41794756c72a3cdba96ebaff033e5f))
7
+ * address review comments ([6be5b93](https://github.com/agentinit/agentinit/commit/6be5b937ec6fcbf924ea93f378156ba44a46b9d5))
8
+
9
+
10
+ ### Features
11
+
12
+ * centralize constants and add timeout support to apply command ([d35a6fc](https://github.com/agentinit/agentinit/commit/d35a6fc2dd76923c82ca7f26b4503260f25e944f))
13
+
14
+ ## [1.2.1](https://github.com/agentinit/agentinit/compare/v1.2.0...v1.2.1) (2025-09-20)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * upd package ([06fa82f](https://github.com/agentinit/agentinit/commit/06fa82fb67e296e85330806084ecea12f6916f05))
20
+
1
21
  # [1.2.0](https://github.com/agentinit/agentinit/compare/v1.1.0...v1.2.0) (2025-09-20)
2
22
 
3
23
 
package/README.md CHANGED
@@ -94,25 +94,16 @@ agentinit mcp --install <name> # Install specific MCP
94
94
 
95
95
  ### `agentinit verify_mcp`
96
96
 
97
- Verify MCP server installations and list their capabilities.
98
-
99
- ```bash
100
- agentinit verify_mcp --all # Verify all configured MCP servers
101
- agentinit verify_mcp --mcp-name <name> # Verify specific MCP server
102
- ```
97
+ Verify MCP server installations and get their tools with token usage.
103
98
 
104
99
  **Examples:**
105
100
  ```bash
106
101
  # Verify all MCPs in project
107
102
  agentinit verify_mcp --all
108
-
109
- # Verify specific server
110
- agentinit verify_mcp --mcp-name everything
111
-
112
- # Test MCP configuration directly
103
+ # Verify STDIO server
113
104
  agentinit verify_mcp --mcp-stdio everything "npx -y @modelcontextprotocol/server-everything"
114
-
115
- agentinit verify_mcp --mcp-http
105
+ # Verify HTTP server
106
+ agentinit verify_mcp --mcp-http notion_api "https://mcp.notion.com/mcp" --timeout 30000
116
107
  ```
117
108
 
118
109
  Shows connection status, response time, and available tools/resources/prompts for each MCP server.
@@ -181,7 +172,13 @@ This generates `.agentinit/agentinit.toml` with your MCP configurations.
181
172
  - `--header "KEY:VALUE"` - Adds custom headers in KEY:VALUE format (can be used multiple times)
182
173
  - Both flags can be combined for APIs requiring multiple authentication methods
183
174
 
184
- **MCP Verification**: Use the `--verify-mcp` flag to test MCP servers immediately after configuration. This ensures servers are reachable and shows their available tools, resources, and prompts.
175
+ **MCP Verification**: Use the `--verify-mcp` flag to test MCP servers immediately after configuration. This ensures servers are reachable and shows their available tools, resources, and prompts. Use `--timeout <ms>` to set a custom connection timeout (default: 30000ms).
176
+
177
+ ```bash
178
+ # Verify with custom timeout
179
+ npx agentinit apply --verify-mcp --timeout 30000 \
180
+ --mcp-stdio chrome-mcp "bunx -y chrome-devtools-mcp@latest"
181
+ ```
185
182
 
186
183
  #### Rules Configuration
187
184
 
Binary file
package/dist/index.js CHANGED
@@ -13753,402 +13753,6 @@ var require_toml = __commonJS((exports) => {
13753
13753
  exports.stringify = require_stringify2();
13754
13754
  });
13755
13755
 
13756
- // node_modules/tiktoken/tiktoken_bg.cjs
13757
- var require_tiktoken_bg = __commonJS((exports, module) => {
13758
- var getUint8ArrayMemory0 = function() {
13759
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13760
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
13761
- }
13762
- return cachedUint8ArrayMemory0;
13763
- };
13764
- var getStringFromWasm0 = function(ptr, len) {
13765
- ptr = ptr >>> 0;
13766
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
13767
- };
13768
- var addHeapObject = function(obj) {
13769
- if (heap_next === heap.length)
13770
- heap.push(heap.length + 1);
13771
- const idx = heap_next;
13772
- heap_next = heap[idx];
13773
- heap[idx] = obj;
13774
- return idx;
13775
- };
13776
- var handleError = function(f, args) {
13777
- try {
13778
- return f.apply(this, args);
13779
- } catch (e) {
13780
- wasm.__wbindgen_export_0(addHeapObject(e));
13781
- }
13782
- };
13783
- var getObject = function(idx) {
13784
- return heap[idx];
13785
- };
13786
- var dropObject = function(idx) {
13787
- if (idx < 132)
13788
- return;
13789
- heap[idx] = heap_next;
13790
- heap_next = idx;
13791
- };
13792
- var takeObject = function(idx) {
13793
- const ret = getObject(idx);
13794
- dropObject(idx);
13795
- return ret;
13796
- };
13797
- var passStringToWasm0 = function(arg, malloc, realloc) {
13798
- if (realloc === undefined) {
13799
- const buf = cachedTextEncoder.encode(arg);
13800
- const ptr2 = malloc(buf.length, 1) >>> 0;
13801
- getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
13802
- WASM_VECTOR_LEN = buf.length;
13803
- return ptr2;
13804
- }
13805
- let len = arg.length;
13806
- let ptr = malloc(len, 1) >>> 0;
13807
- const mem = getUint8ArrayMemory0();
13808
- let offset = 0;
13809
- for (;offset < len; offset++) {
13810
- const code = arg.charCodeAt(offset);
13811
- if (code > 127)
13812
- break;
13813
- mem[ptr + offset] = code;
13814
- }
13815
- if (offset !== len) {
13816
- if (offset !== 0) {
13817
- arg = arg.slice(offset);
13818
- }
13819
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
13820
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
13821
- const ret = encodeString(arg, view);
13822
- offset += ret.written;
13823
- ptr = realloc(ptr, len, offset, 1) >>> 0;
13824
- }
13825
- WASM_VECTOR_LEN = offset;
13826
- return ptr;
13827
- };
13828
- var isLikeNone = function(x) {
13829
- return x === undefined || x === null;
13830
- };
13831
- var getDataViewMemory0 = function() {
13832
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
13833
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
13834
- }
13835
- return cachedDataViewMemory0;
13836
- };
13837
- var getUint32ArrayMemory0 = function() {
13838
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
13839
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
13840
- }
13841
- return cachedUint32ArrayMemory0;
13842
- };
13843
- var getArrayU32FromWasm0 = function(ptr, len) {
13844
- ptr = ptr >>> 0;
13845
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
13846
- };
13847
- var passArray8ToWasm0 = function(arg, malloc) {
13848
- const ptr = malloc(arg.length * 1, 1) >>> 0;
13849
- getUint8ArrayMemory0().set(arg, ptr / 1);
13850
- WASM_VECTOR_LEN = arg.length;
13851
- return ptr;
13852
- };
13853
- var passArray32ToWasm0 = function(arg, malloc) {
13854
- const ptr = malloc(arg.length * 4, 4) >>> 0;
13855
- getUint32ArrayMemory0().set(arg, ptr / 4);
13856
- WASM_VECTOR_LEN = arg.length;
13857
- return ptr;
13858
- };
13859
- var getArrayU8FromWasm0 = function(ptr, len) {
13860
- ptr = ptr >>> 0;
13861
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
13862
- };
13863
- var wasm;
13864
- exports.__wbg_set_wasm = function(val) {
13865
- wasm = val;
13866
- };
13867
- var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
13868
- var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
13869
- cachedTextDecoder.decode();
13870
- var cachedUint8ArrayMemory0 = null;
13871
- var heap = new Array(128).fill(undefined);
13872
- heap.push(undefined, null, true, false);
13873
- var heap_next = heap.length;
13874
- var WASM_VECTOR_LEN = 0;
13875
- var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
13876
- var cachedTextEncoder = new lTextEncoder("utf-8");
13877
- var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
13878
- return cachedTextEncoder.encodeInto(arg, view);
13879
- } : function(arg, view) {
13880
- const buf = cachedTextEncoder.encode(arg);
13881
- view.set(buf);
13882
- return {
13883
- read: arg.length,
13884
- written: buf.length
13885
- };
13886
- };
13887
- var cachedDataViewMemory0 = null;
13888
- var cachedUint32ArrayMemory0 = null;
13889
- exports.get_encoding = function(encoding, extend_special_tokens) {
13890
- if (wasm == null)
13891
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
13892
- try {
13893
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13894
- const ptr0 = passStringToWasm0(encoding, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
13895
- const len0 = WASM_VECTOR_LEN;
13896
- wasm.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
13897
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13898
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13899
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
13900
- if (r2) {
13901
- throw takeObject(r1);
13902
- }
13903
- return Tiktoken.__wrap(r0);
13904
- } finally {
13905
- wasm.__wbindgen_add_to_stack_pointer(16);
13906
- }
13907
- };
13908
- exports.encoding_for_model = function(model, extend_special_tokens) {
13909
- if (wasm == null)
13910
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
13911
- try {
13912
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13913
- const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
13914
- const len0 = WASM_VECTOR_LEN;
13915
- wasm.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
13916
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13917
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13918
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
13919
- if (r2) {
13920
- throw takeObject(r1);
13921
- }
13922
- return Tiktoken.__wrap(r0);
13923
- } finally {
13924
- wasm.__wbindgen_add_to_stack_pointer(16);
13925
- }
13926
- };
13927
- exports.get_encoding_name_for_model = function(model) {
13928
- if (wasm == null)
13929
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
13930
- let deferred3_0;
13931
- let deferred3_1;
13932
- try {
13933
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13934
- const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
13935
- const len0 = WASM_VECTOR_LEN;
13936
- wasm.get_encoding_name_for_model(retptr, ptr0, len0);
13937
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13938
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13939
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
13940
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
13941
- var ptr2 = r0;
13942
- var len2 = r1;
13943
- if (r3) {
13944
- ptr2 = 0;
13945
- len2 = 0;
13946
- throw takeObject(r2);
13947
- }
13948
- deferred3_0 = ptr2;
13949
- deferred3_1 = len2;
13950
- return getStringFromWasm0(ptr2, len2);
13951
- } finally {
13952
- wasm.__wbindgen_add_to_stack_pointer(16);
13953
- wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
13954
- }
13955
- };
13956
- var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
13957
- }, unregister: () => {
13958
- } } : new FinalizationRegistry((ptr) => wasm.__wbg_tiktoken_free(ptr >>> 0, 1));
13959
-
13960
- class Tiktoken {
13961
- constructor(tiktoken_bfe, special_tokens, pat_str) {
13962
- if (wasm == null)
13963
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
13964
- const ptr0 = passStringToWasm0(tiktoken_bfe, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
13965
- const len0 = WASM_VECTOR_LEN;
13966
- const ptr1 = passStringToWasm0(pat_str, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
13967
- const len1 = WASM_VECTOR_LEN;
13968
- const ret = wasm.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
13969
- this.__wbg_ptr = ret >>> 0;
13970
- TiktokenFinalization.register(this, this.__wbg_ptr, this);
13971
- return this;
13972
- }
13973
- get name() {
13974
- try {
13975
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13976
- wasm.tiktoken_name(retptr, this.__wbg_ptr);
13977
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13978
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13979
- let v1;
13980
- if (r0 !== 0) {
13981
- v1 = getStringFromWasm0(r0, r1).slice();
13982
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
13983
- }
13984
- return v1;
13985
- } finally {
13986
- wasm.__wbindgen_add_to_stack_pointer(16);
13987
- }
13988
- }
13989
- static __wrap(ptr) {
13990
- ptr = ptr >>> 0;
13991
- const obj = Object.create(Tiktoken.prototype);
13992
- obj.__wbg_ptr = ptr;
13993
- TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
13994
- return obj;
13995
- }
13996
- __destroy_into_raw() {
13997
- const ptr = this.__wbg_ptr;
13998
- this.__wbg_ptr = 0;
13999
- TiktokenFinalization.unregister(this);
14000
- return ptr;
14001
- }
14002
- free() {
14003
- if (wasm == null)
14004
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14005
- const ptr = this.__destroy_into_raw();
14006
- wasm.__wbg_tiktoken_free(ptr, 0);
14007
- }
14008
- encode(text, allowed_special, disallowed_special) {
14009
- if (wasm == null)
14010
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14011
- try {
14012
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14013
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
14014
- const len0 = WASM_VECTOR_LEN;
14015
- wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
14016
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
14017
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
14018
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
14019
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
14020
- if (r3) {
14021
- throw takeObject(r2);
14022
- }
14023
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
14024
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
14025
- return v2;
14026
- } finally {
14027
- wasm.__wbindgen_add_to_stack_pointer(16);
14028
- }
14029
- }
14030
- encode_ordinary(text) {
14031
- if (wasm == null)
14032
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14033
- try {
14034
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14035
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
14036
- const len0 = WASM_VECTOR_LEN;
14037
- wasm.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
14038
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
14039
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
14040
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
14041
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
14042
- return v2;
14043
- } finally {
14044
- wasm.__wbindgen_add_to_stack_pointer(16);
14045
- }
14046
- }
14047
- encode_with_unstable(text, allowed_special, disallowed_special) {
14048
- if (wasm == null)
14049
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14050
- try {
14051
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14052
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
14053
- const len0 = WASM_VECTOR_LEN;
14054
- wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
14055
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
14056
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
14057
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
14058
- if (r2) {
14059
- throw takeObject(r1);
14060
- }
14061
- return takeObject(r0);
14062
- } finally {
14063
- wasm.__wbindgen_add_to_stack_pointer(16);
14064
- }
14065
- }
14066
- encode_single_token(bytes) {
14067
- if (wasm == null)
14068
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14069
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_1);
14070
- const len0 = WASM_VECTOR_LEN;
14071
- const ret = wasm.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
14072
- return ret >>> 0;
14073
- }
14074
- decode(tokens) {
14075
- if (wasm == null)
14076
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14077
- try {
14078
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14079
- const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_export_1);
14080
- const len0 = WASM_VECTOR_LEN;
14081
- wasm.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
14082
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
14083
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
14084
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
14085
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
14086
- return v2;
14087
- } finally {
14088
- wasm.__wbindgen_add_to_stack_pointer(16);
14089
- }
14090
- }
14091
- decode_single_token_bytes(token) {
14092
- if (wasm == null)
14093
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14094
- try {
14095
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14096
- wasm.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
14097
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
14098
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
14099
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
14100
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
14101
- return v1;
14102
- } finally {
14103
- wasm.__wbindgen_add_to_stack_pointer(16);
14104
- }
14105
- }
14106
- token_byte_values() {
14107
- if (wasm == null)
14108
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14109
- const ret = wasm.tiktoken_token_byte_values(this.__wbg_ptr);
14110
- return takeObject(ret);
14111
- }
14112
- }
14113
- exports.Tiktoken = Tiktoken;
14114
- exports.__wbg_parse_def2e24ef1252aff = function() {
14115
- return handleError(function(arg0, arg1) {
14116
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
14117
- return addHeapObject(ret);
14118
- }, arguments);
14119
- };
14120
- exports.__wbg_stringify_f7ed6987935b4a24 = function() {
14121
- return handleError(function(arg0) {
14122
- const ret = JSON.stringify(getObject(arg0));
14123
- return addHeapObject(ret);
14124
- }, arguments);
14125
- };
14126
- exports.__wbindgen_error_new = function(arg0, arg1) {
14127
- const ret = new Error(getStringFromWasm0(arg0, arg1));
14128
- return addHeapObject(ret);
14129
- };
14130
- exports.__wbindgen_is_undefined = function(arg0) {
14131
- const ret = getObject(arg0) === undefined;
14132
- return ret;
14133
- };
14134
- exports.__wbindgen_object_drop_ref = function(arg0) {
14135
- takeObject(arg0);
14136
- };
14137
- exports.__wbindgen_string_get = function(arg0, arg1) {
14138
- if (wasm == null)
14139
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
14140
- const obj = getObject(arg1);
14141
- const ret = typeof obj === "string" ? obj : undefined;
14142
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
14143
- var len1 = WASM_VECTOR_LEN;
14144
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
14145
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
14146
- };
14147
- exports.__wbindgen_throw = function(arg0, arg1) {
14148
- throw new Error(getStringFromWasm0(arg0, arg1));
14149
- };
14150
- });
14151
-
14152
13756
  // node_modules/ajv/lib/refs/data.json
14153
13757
  var require_data = __commonJS((exports, module) => {
14154
13758
  module.exports = {
@@ -15150,8 +14754,8 @@ var require_uri_all = __commonJS((exports, module) => {
15150
14754
  wsComponents.secure = undefined;
15151
14755
  }
15152
14756
  if (wsComponents.resourceName) {
15153
- var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path2 = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
15154
- wsComponents.path = path2 && path2 !== "/" ? path2 : undefined;
14757
+ var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
14758
+ wsComponents.path = path && path !== "/" ? path : undefined;
15155
14759
  wsComponents.query = query;
15156
14760
  wsComponents.resourceName = undefined;
15157
14761
  }
@@ -15517,12 +15121,12 @@ var require_util3 = __commonJS((exports, module) => {
15517
15121
  return "\'" + escapeQuotes(str2) + "\'";
15518
15122
  };
15519
15123
  var getPathExpr = function(currentPath, expr, jsonPointers, isNumber) {
15520
- var path2 = jsonPointers ? "\'/\' + " + expr + (isNumber ? "" : ".replace(/~/g, \'~0\').replace(/\\//g, \'~1\')") : isNumber ? "\'[\' + " + expr + " + \']\'" : "\'[\\\'\' + " + expr + " + \'\\\']\'";
15521
- return joinPaths(currentPath, path2);
15124
+ var path = jsonPointers ? "\'/\' + " + expr + (isNumber ? "" : ".replace(/~/g, \'~0\').replace(/\\//g, \'~1\')") : isNumber ? "\'[\' + " + expr + " + \']\'" : "\'[\\\'\' + " + expr + " + \'\\\']\'";
15125
+ return joinPaths(currentPath, path);
15522
15126
  };
15523
15127
  var getPath = function(currentPath, prop, jsonPointers) {
15524
- var path2 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
15525
- return joinPaths(currentPath, path2);
15128
+ var path = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
15129
+ return joinPaths(currentPath, path);
15526
15130
  };
15527
15131
  var getData = function($data, lvl, paths2) {
15528
15132
  var up, jsonPointer, data, matches;
@@ -20322,7 +19926,7 @@ var require_ajv = __commonJS((exports, module) => {
20322
19926
 
20323
19927
  // node_modules/isexe/windows.js
20324
19928
  var require_windows = __commonJS((exports, module) => {
20325
- var checkPathExt = function(path2, options2) {
19929
+ var checkPathExt = function(path, options2) {
20326
19930
  var pathext = options2.pathExt !== undefined ? options2.pathExt : process.env.PATHEXT;
20327
19931
  if (!pathext) {
20328
19932
  return true;
@@ -20333,40 +19937,40 @@ var require_windows = __commonJS((exports, module) => {
20333
19937
  }
20334
19938
  for (var i = 0;i < pathext.length; i++) {
20335
19939
  var p = pathext[i].toLowerCase();
20336
- if (p && path2.substr(-p.length).toLowerCase() === p) {
19940
+ if (p && path.substr(-p.length).toLowerCase() === p) {
20337
19941
  return true;
20338
19942
  }
20339
19943
  }
20340
19944
  return false;
20341
19945
  };
20342
- var checkStat = function(stat, path2, options2) {
19946
+ var checkStat = function(stat, path, options2) {
20343
19947
  if (!stat.isSymbolicLink() && !stat.isFile()) {
20344
19948
  return false;
20345
19949
  }
20346
- return checkPathExt(path2, options2);
19950
+ return checkPathExt(path, options2);
20347
19951
  };
20348
- var isexe = function(path2, options2, cb) {
20349
- fs15.stat(path2, function(er, stat) {
20350
- cb(er, er ? false : checkStat(stat, path2, options2));
19952
+ var isexe = function(path, options2, cb) {
19953
+ fs14.stat(path, function(er, stat) {
19954
+ cb(er, er ? false : checkStat(stat, path, options2));
20351
19955
  });
20352
19956
  };
20353
- var sync = function(path2, options2) {
20354
- return checkStat(fs15.statSync(path2), path2, options2);
19957
+ var sync = function(path, options2) {
19958
+ return checkStat(fs14.statSync(path), path, options2);
20355
19959
  };
20356
19960
  module.exports = isexe;
20357
19961
  isexe.sync = sync;
20358
- var fs15 = __require("fs");
19962
+ var fs14 = __require("fs");
20359
19963
  });
20360
19964
 
20361
19965
  // node_modules/isexe/mode.js
20362
19966
  var require_mode = __commonJS((exports, module) => {
20363
- var isexe = function(path2, options2, cb) {
20364
- fs15.stat(path2, function(er, stat) {
19967
+ var isexe = function(path, options2, cb) {
19968
+ fs14.stat(path, function(er, stat) {
20365
19969
  cb(er, er ? false : checkStat(stat, options2));
20366
19970
  });
20367
19971
  };
20368
- var sync = function(path2, options2) {
20369
- return checkStat(fs15.statSync(path2), options2);
19972
+ var sync = function(path, options2) {
19973
+ return checkStat(fs14.statSync(path), options2);
20370
19974
  };
20371
19975
  var checkStat = function(stat, options2) {
20372
19976
  return stat.isFile() && checkMode(stat, options2);
@@ -20386,12 +19990,12 @@ var require_mode = __commonJS((exports, module) => {
20386
19990
  };
20387
19991
  module.exports = isexe;
20388
19992
  isexe.sync = sync;
20389
- var fs15 = __require("fs");
19993
+ var fs14 = __require("fs");
20390
19994
  });
20391
19995
 
20392
19996
  // node_modules/isexe/index.js
20393
19997
  var require_isexe = __commonJS((exports, module) => {
20394
- var isexe = function(path2, options2, cb) {
19998
+ var isexe = function(path, options2, cb) {
20395
19999
  if (typeof options2 === "function") {
20396
20000
  cb = options2;
20397
20001
  options2 = {};
@@ -20401,7 +20005,7 @@ var require_isexe = __commonJS((exports, module) => {
20401
20005
  throw new TypeError("callback not provided");
20402
20006
  }
20403
20007
  return new Promise(function(resolve9, reject) {
20404
- isexe(path2, options2 || {}, function(er, is) {
20008
+ isexe(path, options2 || {}, function(er, is) {
20405
20009
  if (er) {
20406
20010
  reject(er);
20407
20011
  } else {
@@ -20410,7 +20014,7 @@ var require_isexe = __commonJS((exports, module) => {
20410
20014
  });
20411
20015
  });
20412
20016
  }
20413
- core(path2, options2 || {}, function(er, is) {
20017
+ core(path, options2 || {}, function(er, is) {
20414
20018
  if (er) {
20415
20019
  if (er.code === "EACCES" || options2 && options2.ignoreErrors) {
20416
20020
  er = null;
@@ -20420,9 +20024,9 @@ var require_isexe = __commonJS((exports, module) => {
20420
20024
  cb(er, is);
20421
20025
  });
20422
20026
  };
20423
- var sync = function(path2, options2) {
20027
+ var sync = function(path, options2) {
20424
20028
  try {
20425
- return core.sync(path2, options2 || {});
20029
+ return core.sync(path, options2 || {});
20426
20030
  } catch (er) {
20427
20031
  if (options2 && options2.ignoreErrors || er.code === "EACCES") {
20428
20032
  return false;
@@ -20431,7 +20035,7 @@ var require_isexe = __commonJS((exports, module) => {
20431
20035
  }
20432
20036
  }
20433
20037
  };
20434
- var fs15 = __require("fs");
20038
+ var fs14 = __require("fs");
20435
20039
  var core;
20436
20040
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
20437
20041
  core = require_windows();
@@ -20445,7 +20049,7 @@ var require_isexe = __commonJS((exports, module) => {
20445
20049
  // node_modules/which/which.js
20446
20050
  var require_which = __commonJS((exports, module) => {
20447
20051
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
20448
- var path2 = __require("path");
20052
+ var path = __require("path");
20449
20053
  var COLON = isWindows ? ";" : ":";
20450
20054
  var isexe = require_isexe();
20451
20055
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -20481,7 +20085,7 @@ var require_which = __commonJS((exports, module) => {
20481
20085
  return opt.all && found.length ? resolve9(found) : reject(getNotFoundError(cmd));
20482
20086
  const ppRaw = pathEnv[i];
20483
20087
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
20484
- const pCmd = path2.join(pathPart, cmd);
20088
+ const pCmd = path.join(pathPart, cmd);
20485
20089
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
20486
20090
  resolve9(subStep(p, i, 0));
20487
20091
  });
@@ -20508,7 +20112,7 @@ var require_which = __commonJS((exports, module) => {
20508
20112
  for (let i = 0;i < pathEnv.length; i++) {
20509
20113
  const ppRaw = pathEnv[i];
20510
20114
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
20511
- const pCmd = path2.join(pathPart, cmd);
20115
+ const pCmd = path.join(pathPart, cmd);
20512
20116
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
20513
20117
  for (let j = 0;j < pathExt.length; j++) {
20514
20118
  const cur = p + pathExt[j];
@@ -20565,7 +20169,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
20565
20169
  try {
20566
20170
  resolved = which.sync(parsed.command, {
20567
20171
  path: env2[getPathKey({ env: env2 })],
20568
- pathExt: withoutPathExt ? path2.delimiter : undefined
20172
+ pathExt: withoutPathExt ? path.delimiter : undefined
20569
20173
  });
20570
20174
  } catch (e) {
20571
20175
  } finally {
@@ -20574,14 +20178,14 @@ var require_resolveCommand = __commonJS((exports, module) => {
20574
20178
  }
20575
20179
  }
20576
20180
  if (resolved) {
20577
- resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
20181
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
20578
20182
  }
20579
20183
  return resolved;
20580
20184
  };
20581
20185
  var resolveCommand = function(parsed) {
20582
20186
  return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
20583
20187
  };
20584
- var path2 = __require("path");
20188
+ var path = __require("path");
20585
20189
  var which = require_which();
20586
20190
  var getPathKey = require_path_key();
20587
20191
  module.exports = resolveCommand;
@@ -20622,8 +20226,8 @@ var require_shebang_command = __commonJS((exports, module) => {
20622
20226
  if (!match) {
20623
20227
  return null;
20624
20228
  }
20625
- const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
20626
- const binary = path2.split("/").pop();
20229
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
20230
+ const binary = path.split("/").pop();
20627
20231
  if (binary === "env") {
20628
20232
  return argument;
20629
20233
  }
@@ -20638,14 +20242,14 @@ var require_readShebang = __commonJS((exports, module) => {
20638
20242
  const buffer = Buffer.alloc(size);
20639
20243
  let fd;
20640
20244
  try {
20641
- fd = fs15.openSync(command, "r");
20642
- fs15.readSync(fd, buffer, 0, size, 0);
20643
- fs15.closeSync(fd);
20245
+ fd = fs14.openSync(command, "r");
20246
+ fs14.readSync(fd, buffer, 0, size, 0);
20247
+ fs14.closeSync(fd);
20644
20248
  } catch (e) {
20645
20249
  }
20646
20250
  return shebangCommand(buffer.toString());
20647
20251
  };
20648
- var fs15 = __require("fs");
20252
+ var fs14 = __require("fs");
20649
20253
  var shebangCommand = require_shebang_command();
20650
20254
  module.exports = readShebang;
20651
20255
  });
@@ -20670,7 +20274,7 @@ var require_parse3 = __commonJS((exports, module) => {
20670
20274
  const needsShell = !isExecutableRegExp.test(commandFile);
20671
20275
  if (parsed.options.forceShell || needsShell) {
20672
20276
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
20673
- parsed.command = path2.normalize(parsed.command);
20277
+ parsed.command = path.normalize(parsed.command);
20674
20278
  parsed.command = escape.command(parsed.command);
20675
20279
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
20676
20280
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -20699,7 +20303,7 @@ var require_parse3 = __commonJS((exports, module) => {
20699
20303
  };
20700
20304
  return options2.shell ? parsed : parseNonShell(parsed);
20701
20305
  };
20702
- var path2 = __require("path");
20306
+ var path = __require("path");
20703
20307
  var resolveCommand = require_resolveCommand();
20704
20308
  var escape = require_escape();
20705
20309
  var readShebang = require_readShebang();
@@ -23381,16 +22985,48 @@ class MCPParser {
23381
22985
  }
23382
22986
  }
23383
22987
 
22988
+ // src/constants/mcp.ts
22989
+ import {readFileSync} from "fs";
22990
+ import {fileURLToPath} from "url";
22991
+ import {dirname as dirname3, join as join2} from "path";
22992
+ var getPackageVersion = function() {
22993
+ try {
22994
+ const __filename2 = fileURLToPath(import.meta.url);
22995
+ const __dirname2 = dirname3(__filename2);
22996
+ const packageJsonPath = join2(__dirname2, "../../package.json");
22997
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
22998
+ return packageJson.version || "1.0.0";
22999
+ } catch {
23000
+ return "1.0.0";
23001
+ }
23002
+ };
23003
+ var DEFAULT_CONNECTION_TIMEOUT_MS = 30000;
23004
+ var MCP_VERIFIER_CONFIG = {
23005
+ name: "agentinit-verifier",
23006
+ version: getPackageVersion()
23007
+ };
23008
+
23009
+ class TimeoutError extends Error {
23010
+ constructor(message) {
23011
+ super(message);
23012
+ this.name = "TimeoutError";
23013
+ }
23014
+ }
23015
+ // src/constants/tokens.ts
23016
+ var TOKEN_COUNT_THRESHOLDS = {
23017
+ LOW: 5000,
23018
+ MEDIUM: 15000
23019
+ };
23384
23020
  // src/core/rulesParser.ts
23385
- import {readFileSync as readFileSync2} from "fs";
23021
+ import {readFileSync as readFileSync3} from "fs";
23386
23022
 
23387
23023
  // src/core/rulesTemplateLoader.ts
23388
23024
  var toml = __toESM(require_toml(), 1);
23389
- import {resolve as resolve5, dirname as dirname3} from "path";
23390
- import {fileURLToPath} from "url";
23391
- import {readFileSync, readdirSync, existsSync} from "fs";
23392
- var __filename2 = fileURLToPath(import.meta.url);
23393
- var __dirname2 = dirname3(__filename2);
23025
+ import {resolve as resolve5, dirname as dirname4} from "path";
23026
+ import {fileURLToPath as fileURLToPath2} from "url";
23027
+ import {readFileSync as readFileSync2, readdirSync, existsSync} from "fs";
23028
+ var __filename2 = fileURLToPath2(import.meta.url);
23029
+ var __dirname2 = dirname4(__filename2);
23394
23030
 
23395
23031
  class RulesTemplateLoader {
23396
23032
  templatesPath;
@@ -23407,7 +23043,7 @@ class RulesTemplateLoader {
23407
23043
  for (const file of files) {
23408
23044
  try {
23409
23045
  const filePath = resolve5(this.templatesPath, file);
23410
- const content = readFileSync(filePath, "utf-8");
23046
+ const content = readFileSync2(filePath, "utf-8");
23411
23047
  const parsed = toml.default.parse(content);
23412
23048
  const template = {
23413
23049
  id: parsed.template.id,
@@ -23555,7 +23191,7 @@ class RulesParser {
23555
23191
  throw new RulesParseError(`Rules file not found: ${filePath}`);
23556
23192
  }
23557
23193
  try {
23558
- const content = readFileSync2(filePath, "utf-8");
23194
+ const content = readFileSync3(filePath, "utf-8");
23559
23195
  if (filePath.endsWith(".json")) {
23560
23196
  const parsed = JSON.parse(content);
23561
23197
  return this.extractRulesFromObject(parsed);
@@ -23581,12 +23217,17 @@ class RulesParser {
23581
23217
  }
23582
23218
  }
23583
23219
  const controller = new AbortController;
23584
- const timeoutId = setTimeout(() => controller.abort(), options2.timeout || 1e4);
23585
- const response = await fetch(options2.url, {
23586
- headers,
23587
- signal: controller.signal
23588
- });
23589
- clearTimeout(timeoutId);
23220
+ const timeoutMs = options2.timeout ?? DEFAULT_CONNECTION_TIMEOUT_MS;
23221
+ const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
23222
+ let response;
23223
+ try {
23224
+ response = await fetch(options2.url, {
23225
+ headers,
23226
+ signal: controller.signal
23227
+ });
23228
+ } finally {
23229
+ clearTimeout(timeoutId);
23230
+ }
23590
23231
  if (!response.ok) {
23591
23232
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
23592
23233
  }
@@ -23791,7 +23432,7 @@ class TOMLGenerator {
23791
23432
  import {resolve as resolve8} from "path";
23792
23433
 
23793
23434
  // src/utils/paths.ts
23794
- import {resolve as resolve6, join as join2} from "path";
23435
+ import {resolve as resolve6, join as join3} from "path";
23795
23436
  import {homedir} from "os";
23796
23437
  function getHomeDirectory() {
23797
23438
  return homedir();
@@ -23810,7 +23451,7 @@ function getPlatform() {
23810
23451
  }
23811
23452
  function expandTilde(path) {
23812
23453
  if (path.startsWith("~/")) {
23813
- return join2(getHomeDirectory(), path.slice(2));
23454
+ return join3(getHomeDirectory(), path.slice(2));
23814
23455
  }
23815
23456
  if (path === "~") {
23816
23457
  return getHomeDirectory();
@@ -23862,9 +23503,9 @@ import {resolve as resolve7} from "path";
23862
23503
  // node_modules/contextcalc/dist/lib/index.js
23863
23504
  async function isBinaryFile(filePath) {
23864
23505
  try {
23865
- const fs8 = await import("node:fs/promises");
23506
+ const fs7 = await import("node:fs/promises");
23866
23507
  const buffer = Buffer.alloc(1024);
23867
- const fd = await fs8.open(filePath, "r");
23508
+ const fd = await fs7.open(filePath, "r");
23868
23509
  try {
23869
23510
  const { bytesRead } = await fd.read(buffer, 0, 1024, 0);
23870
23511
  for (let i = 0;i < bytesRead; i++) {
@@ -23884,47 +23525,13 @@ async function isBinaryFile(filePath) {
23884
23525
  var estimateBinaryTokens = function(sizeInBytes) {
23885
23526
  return Math.ceil(sizeInBytes / 4);
23886
23527
  };
23887
-
23888
- // node_modules/tiktoken/tiktoken.cjs
23889
- var __dirname = "/home/runner/work/agentinit/agentinit/node_modules/tiktoken";
23890
- var wasm = require_tiktoken_bg();
23891
- var imports = {};
23892
- imports["./tiktoken_bg.js"] = wasm;
23893
- var path = __require("path");
23894
- var fs7 = __require("fs");
23895
- var candidates = __dirname.split(path.sep).reduce((memo, _, index, array) => {
23896
- const prefix = array.slice(0, index + 1).join(path.sep) + path.sep;
23897
- if (!prefix.includes("node_modules" + path.sep)) {
23898
- memo.unshift(path.join(prefix, "node_modules", "tiktoken", "", "./tiktoken_bg.wasm"));
23899
- }
23900
- return memo;
23901
- }, []);
23902
- candidates.unshift(path.join(__dirname, "./tiktoken_bg.wasm"));
23903
- var bytes = null;
23904
- for (const candidate of candidates) {
23905
- try {
23906
- bytes = fs7.readFileSync(candidate);
23907
- break;
23908
- } catch {
23909
- }
23910
- }
23911
- if (bytes == null)
23912
- throw new Error("Missing tiktoken_bg.wasm");
23913
- var wasmModule = new WebAssembly.Module(bytes);
23914
- var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
23915
- wasm.__wbg_set_wasm(wasmInstance.exports);
23916
- var $get_encoding = wasm["get_encoding"];
23917
- var $encoding_for_model = wasm["encoding_for_model"];
23918
- var $get_encoding_name_for_model = wasm["get_encoding_name_for_model"];
23919
- var $Tiktoken = wasm["Tiktoken"];
23920
-
23921
- // node_modules/contextcalc/dist/lib/index.js
23528
+ import {get_encoding} from "tiktoken";
23922
23529
  var initializeTiktoken = function() {
23923
23530
  if (tiktokenInstance) {
23924
23531
  return tiktokenInstance;
23925
23532
  }
23926
23533
  try {
23927
- const encoding = $get_encoding(ENCODING_NAME);
23534
+ const encoding = get_encoding(ENCODING_NAME);
23928
23535
  try {
23929
23536
  encoding.encode("test");
23930
23537
  } catch (validationError) {
@@ -24117,15 +23724,15 @@ class Tokenizer {
24117
23724
  }
24118
23725
  async countTokens(filePath) {
24119
23726
  try {
24120
- const fs8 = await import("node:fs/promises");
24121
- const stats = await fs8.stat(filePath);
23727
+ const fs7 = await import("node:fs/promises");
23728
+ const stats = await fs7.stat(filePath);
24122
23729
  if (await isBinaryFile(filePath)) {
24123
23730
  return {
24124
23731
  tokens: estimateBinaryTokens(stats.size),
24125
23732
  lines: 0
24126
23733
  };
24127
23734
  }
24128
- const content = await fs8.readFile(filePath, "utf8");
23735
+ const content = await fs7.readFile(filePath, "utf8");
24129
23736
  const tokens = this.countTokensFromText(content);
24130
23737
  const lines = this.countLines(content);
24131
23738
  return { tokens, lines };
@@ -26337,8 +25944,8 @@ function addIssueToContext(ctx, issueData) {
26337
25944
  ctx.common.issues.push(issue);
26338
25945
  }
26339
25946
  var makeIssue = (params) => {
26340
- const { data, path: path2, errorMaps, issueData } = params;
26341
- const fullPath = [...path2, ...issueData.path || []];
25947
+ const { data, path, errorMaps, issueData } = params;
25948
+ const fullPath = [...path, ...issueData.path || []];
26342
25949
  const fullIssue = {
26343
25950
  ...issueData,
26344
25951
  path: fullPath
@@ -26627,11 +26234,11 @@ function custom(check, _params = {}, fatal) {
26627
26234
  }
26628
26235
 
26629
26236
  class ParseInputLazyPath {
26630
- constructor(parent, value, path2, key) {
26237
+ constructor(parent, value, path, key) {
26631
26238
  this._cachedPath = [];
26632
26239
  this.parent = parent;
26633
26240
  this.data = value;
26634
- this._path = path2;
26241
+ this._path = path;
26635
26242
  this._key = key;
26636
26243
  }
26637
26244
  get path() {
@@ -32666,22 +32273,15 @@ class MCPVerificationError extends Error {
32666
32273
  }
32667
32274
  }
32668
32275
 
32669
- class TimeoutError extends Error {
32670
- constructor(message) {
32671
- super(message);
32672
- this.name = "TimeoutError";
32673
- }
32674
- }
32675
-
32676
32276
  class MCPVerifier {
32677
32277
  defaultTimeout;
32678
- constructor(defaultTimeout = 1e4) {
32278
+ constructor(defaultTimeout = DEFAULT_CONNECTION_TIMEOUT_MS) {
32679
32279
  this.defaultTimeout = defaultTimeout;
32680
32280
  }
32681
32281
  colorizeTokenCount(tokenCount) {
32682
- if (tokenCount <= 5000)
32282
+ if (tokenCount <= TOKEN_COUNT_THRESHOLDS.LOW)
32683
32283
  return green(tokenCount.toString());
32684
- if (tokenCount <= 15000)
32284
+ if (tokenCount <= TOKEN_COUNT_THRESHOLDS.MEDIUM)
32685
32285
  return yellow(tokenCount.toString());
32686
32286
  return red(tokenCount.toString());
32687
32287
  }
@@ -32715,8 +32315,8 @@ class MCPVerifier {
32715
32315
  try {
32716
32316
  transport = await this.createTransport(server);
32717
32317
  client2 = new Client({
32718
- name: "agentinit-verifier",
32719
- version: "1.0.0"
32318
+ name: MCP_VERIFIER_CONFIG.name,
32319
+ version: MCP_VERIFIER_CONFIG.version
32720
32320
  });
32721
32321
  const timeoutPromise = new Promise((_, reject) => {
32722
32322
  const timeoutId = setTimeout(async () => {
@@ -32972,12 +32572,10 @@ class MCPVerifier {
32972
32572
 
32973
32573
  // src/commands/apply.ts
32974
32574
  var colorizeTokenCount = function(tokenCount) {
32975
- if (tokenCount <= 5000)
32575
+ if (tokenCount <= TOKEN_COUNT_THRESHOLDS.LOW)
32976
32576
  return green(tokenCount.toString());
32977
- if (tokenCount <= 15000)
32577
+ if (tokenCount <= TOKEN_COUNT_THRESHOLDS.MEDIUM)
32978
32578
  return yellow(tokenCount.toString());
32979
- if (tokenCount <= 30000)
32980
- return red(tokenCount.toString());
32981
32579
  return red(tokenCount.toString());
32982
32580
  };
32983
32581
  var colorizeTokenDiff = function(diff) {
@@ -32996,6 +32594,10 @@ async function applyCommand(args) {
32996
32594
  const specifiedClient = clientArgIndex >= 0 && clientArgIndex + 1 < args.length ? args[clientArgIndex + 1] : null;
32997
32595
  const isGlobal = args.includes("--global");
32998
32596
  const verifyMcp = args.includes("--verify-mcp");
32597
+ const timeoutIndex = args.findIndex((arg) => arg === "--timeout");
32598
+ const timeoutArg = timeoutIndex >= 0 && timeoutIndex + 1 < args.length ? args[timeoutIndex + 1] : null;
32599
+ const parsedTimeout = timeoutArg ? parseInt(timeoutArg, 10) : NaN;
32600
+ const timeout = timeoutArg && Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : undefined;
32999
32601
  if (!hasMcpArgs && !hasRulesArgs) {
33000
32602
  logger.info("Usage: agentinit apply [options]");
33001
32603
  logger.info("");
@@ -33005,6 +32607,7 @@ async function applyCommand(args) {
33005
32607
  logger.info(" --global Apply configuration globally (requires --agent)");
33006
32608
  logger.info(" If not specified, auto-detects agents in the project");
33007
32609
  logger.info(" --verify-mcp Verify MCP servers after configuration");
32610
+ logger.info(` --timeout <ms> Connection timeout in milliseconds for MCP verification (default: ${DEFAULT_CONNECTION_TIMEOUT_MS})`);
33008
32611
  logger.info("");
33009
32612
  logger.info("Rules Configuration Options:");
33010
32613
  logger.info(" --rules <templates> Apply rule templates (comma-separated)");
@@ -33061,11 +32664,11 @@ async function applyCommand(args) {
33061
32664
  const spinner = ora("Parsing configurations...").start();
33062
32665
  try {
33063
32666
  const mcpArgs = args.filter((arg, index) => {
33064
- if (arg === "--client" || arg === "--agent" || arg === "--global" || arg === "--verify-mcp")
32667
+ if (arg === "--client" || arg === "--agent" || arg === "--global" || arg === "--verify-mcp" || arg === "--timeout")
33065
32668
  return false;
33066
32669
  if (arg === "--rules" || arg === "--rule-raw" || arg === "--rules-file" || arg === "--rules-remote")
33067
32670
  return false;
33068
- if (index > 0 && (args[index - 1] === "--client" || args[index - 1] === "--agent"))
32671
+ if (index > 0 && (args[index - 1] === "--client" || args[index - 1] === "--agent" || args[index - 1] === "--timeout"))
33069
32672
  return false;
33070
32673
  if (index > 0 && (args[index - 1] === "--rules" || args[index - 1] === "--rule-raw" || args[index - 1] === "--rules-file" || args[index - 1] === "--rules-remote"))
33071
32674
  return false;
@@ -33216,8 +32819,8 @@ async function applyCommand(args) {
33216
32819
  logger.info("");
33217
32820
  const verifySpinner = ora(`Verifying ${mcpParsed.servers.length} MCP server(s)...`).start();
33218
32821
  try {
33219
- const verifier = new MCPVerifier;
33220
- const verificationResults = await verifier.verifyServers(mcpParsed.servers);
32822
+ const verifier = new MCPVerifier(timeout);
32823
+ const verificationResults = await verifier.verifyServers(mcpParsed.servers, timeout);
33221
32824
  const successCount = verificationResults.filter((r) => r.status === "success").length;
33222
32825
  const errorCount = verificationResults.filter((r) => r.status === "error").length;
33223
32826
  const timeoutCount = verificationResults.filter((r) => r.status === "timeout").length;
@@ -33251,7 +32854,17 @@ async function applyCommand(args) {
33251
32854
  if (server.type === "stdio" && server.command) {
33252
32855
  logger.info(` Command: ${server.command} ${server.args?.join(" ") || ""}`);
33253
32856
  } else if (server.url) {
33254
- logger.info(` URL: ${server.url}`);
32857
+ let sanitizedUrl;
32858
+ try {
32859
+ const parsedUrl = new URL(server.url);
32860
+ parsedUrl.username = "";
32861
+ parsedUrl.password = "";
32862
+ parsedUrl.search = "";
32863
+ sanitizedUrl = parsedUrl.toString();
32864
+ } catch {
32865
+ sanitizedUrl = server.url.split("?")[0] || "invalid-url";
32866
+ }
32867
+ logger.info(` URL: ${sanitizedUrl}`);
33255
32868
  }
33256
32869
  });
33257
32870
  }
@@ -33367,7 +32980,7 @@ async function verifyMcpCommand(args) {
33367
32980
  const timeoutIndex = args.findIndex((arg) => arg === "--timeout");
33368
32981
  const timeoutArg = timeoutIndex >= 0 && timeoutIndex + 1 < args.length ? args[timeoutIndex + 1] : null;
33369
32982
  const parsedTimeout = timeoutArg ? parseInt(timeoutArg, 10) : NaN;
33370
- const timeout = timeoutArg && !Number.isNaN(parsedTimeout) && Number.isFinite(parsedTimeout) ? parsedTimeout : undefined;
32983
+ const timeout = timeoutArg && Number.isFinite(parsedTimeout) && parsedTimeout > 0 ? parsedTimeout : undefined;
33371
32984
  const hasMcpArgs = args.some((arg) => arg.startsWith("--mcp-"));
33372
32985
  if (mcpName && hasAll) {
33373
32986
  logger.error("Cannot use --mcp-name and --all together. Choose one option.");
@@ -33383,7 +32996,7 @@ async function verifyMcpCommand(args) {
33383
32996
  logger.info("Verify existing configurations:");
33384
32997
  logger.info(" --mcp-name <name> Verify specific MCP server by name");
33385
32998
  logger.info(" --all Verify all configured MCP servers");
33386
- logger.info(" --timeout <ms> Connection timeout in milliseconds (default: 10000)");
32999
+ logger.info(` --timeout <ms> Connection timeout in milliseconds (default: ${DEFAULT_CONNECTION_TIMEOUT_MS})`);
33387
33000
  logger.info("");
33388
33001
  logger.info("Verify direct MCP configuration:");
33389
33002
  logger.info(" --mcp-stdio <name> <command> Verify STDIO MCP server");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentinit",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A CLI tool for managing and configuring AI coding agents",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -8,7 +8,7 @@
8
8
  "agentinit": "dist/index.js"
9
9
  },
10
10
  "scripts": {
11
- "build": "bun build src/index.ts --outdir dist --target node && cp -r src/templates dist/",
11
+ "build": "bun build src/index.ts --outdir dist --target node --external tiktoken && cp -r src/templates dist/",
12
12
  "dev": "bun run src/index.ts",
13
13
  "test": "vitest run",
14
14
  "test:watch": "vitest",
Binary file