agentinit 1.1.0 → 1.2.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 +18 -0
- package/README.md +27 -0
- package/dist/agentinit-1.2.0.tgz +0 -0
- package/dist/index.js +95 -35
- package/package.json +2 -2
- package/dist/agentinit-1.1.0.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/agentinit/agentinit/compare/v1.1.0...v1.2.0) (2025-09-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* pckg lock ([ed4acbb](https://github.com/agentinit/agentinit/commit/ed4acbbc27c6342a109c81b91e6a23f264de1b9f))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add --header flag support for HTTP MCP custom headers ([45a065f](https://github.com/agentinit/agentinit/commit/45a065f3b3876056acc76df4291db1808b94040a))
|
|
12
|
+
|
|
13
|
+
# [1.1.1](https://github.com/agentinit/agentinit/compare/v1.1.0...v1.1.1) (TBD)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add --header flag support for HTTP MCP custom headers ([COMMIT_HASH](https://github.com/agentinit/agentinit/commit/COMMIT_HASH))
|
|
18
|
+
|
|
1
19
|
# [1.1.0](https://github.com/agentinit/agentinit/compare/v1.0.1...v1.1.0) (2025-09-19)
|
|
2
20
|
|
|
3
21
|
|
package/README.md
CHANGED
|
@@ -142,11 +142,33 @@ npx agentinit apply \
|
|
|
142
142
|
npx agentinit apply \
|
|
143
143
|
--mcp-http github "https://api.githubcopilot.com/mcp/" --auth "Bearer YOUR_GITHUB_PAT"
|
|
144
144
|
|
|
145
|
+
# Configure HTTP MCP with custom headers
|
|
146
|
+
npx agentinit apply \
|
|
147
|
+
--mcp-http context7 "https://mcp.context7.com/mcp" \
|
|
148
|
+
--header "CONTEXT7_API_KEY:YOUR_API_KEY"
|
|
149
|
+
|
|
150
|
+
# Multiple custom headers
|
|
151
|
+
npx agentinit apply \
|
|
152
|
+
--mcp-http api_server "https://api.example.com/mcp" \
|
|
153
|
+
--header "X-API-Key:YOUR_API_KEY" \
|
|
154
|
+
--header "X-Client-ID:YOUR_CLIENT_ID"
|
|
155
|
+
|
|
156
|
+
# Combine Bearer auth with custom headers
|
|
157
|
+
npx agentinit apply \
|
|
158
|
+
--mcp-http advanced_api "https://api.example.com/mcp" \
|
|
159
|
+
--auth "Bearer YOUR_TOKEN" \
|
|
160
|
+
--header "X-Custom-Header:custom_value"
|
|
161
|
+
|
|
145
162
|
# Configure Docker-based MCP with environment
|
|
146
163
|
npx agentinit apply \
|
|
147
164
|
--mcp-stdio browserbase "docker run -i --rm ghcr.io/metorial/mcp-container--browserbase--mcp-server-browserbase--browserbase node cli.js" \
|
|
148
165
|
--env "BROWSERBASE_API_KEY=browserbase-api-key"
|
|
149
166
|
|
|
167
|
+
# Global configuration with custom headers
|
|
168
|
+
npx agentinit apply --global --client claude \
|
|
169
|
+
--mcp-http context7 "https://mcp.context7.com/mcp" \
|
|
170
|
+
--header "CONTEXT7_API_KEY:YOUR_API_KEY"
|
|
171
|
+
|
|
150
172
|
# Verify MCPs immediately after configuration
|
|
151
173
|
npx agentinit apply --verify-mcp \
|
|
152
174
|
--mcp-stdio everything "npx -y @modelcontextprotocol/server-everything"
|
|
@@ -154,6 +176,11 @@ npx agentinit apply --verify-mcp \
|
|
|
154
176
|
|
|
155
177
|
This generates `.agentinit/agentinit.toml` with your MCP configurations.
|
|
156
178
|
|
|
179
|
+
**MCP Authentication Options**:
|
|
180
|
+
- `--auth "Bearer TOKEN"` - Adds Authorization header for Bearer token authentication
|
|
181
|
+
- `--header "KEY:VALUE"` - Adds custom headers in KEY:VALUE format (can be used multiple times)
|
|
182
|
+
- Both flags can be combined for APIs requiring multiple authentication methods
|
|
183
|
+
|
|
157
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.
|
|
158
185
|
|
|
159
186
|
#### Rules Configuration
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -23269,6 +23269,19 @@ class MCPParser {
|
|
|
23269
23269
|
}
|
|
23270
23270
|
}
|
|
23271
23271
|
i += 2;
|
|
23272
|
+
} else if (nextArg === "--header" && i + 1 < args.length) {
|
|
23273
|
+
const headerStr = args[i + 1];
|
|
23274
|
+
if (headerStr) {
|
|
23275
|
+
const colonIndex = headerStr.indexOf(":");
|
|
23276
|
+
if (colonIndex > 0 && colonIndex < headerStr.length - 1) {
|
|
23277
|
+
const key = headerStr.substring(0, colonIndex).trim();
|
|
23278
|
+
const value = headerStr.substring(colonIndex + 1).trim();
|
|
23279
|
+
if (key && value) {
|
|
23280
|
+
server.headers[key] = value;
|
|
23281
|
+
}
|
|
23282
|
+
}
|
|
23283
|
+
}
|
|
23284
|
+
i += 2;
|
|
23272
23285
|
} else if (nextArg.startsWith("--mcp-")) {
|
|
23273
23286
|
break;
|
|
23274
23287
|
} else {
|
|
@@ -23846,6 +23859,32 @@ function getFullGlobalConfigPath(globalConfigPath, globalConfigPaths) {
|
|
|
23846
23859
|
// src/core/rulesApplicator.ts
|
|
23847
23860
|
import {resolve as resolve7} from "path";
|
|
23848
23861
|
|
|
23862
|
+
// node_modules/contextcalc/dist/lib/index.js
|
|
23863
|
+
async function isBinaryFile(filePath) {
|
|
23864
|
+
try {
|
|
23865
|
+
const fs8 = await import("node:fs/promises");
|
|
23866
|
+
const buffer = Buffer.alloc(1024);
|
|
23867
|
+
const fd = await fs8.open(filePath, "r");
|
|
23868
|
+
try {
|
|
23869
|
+
const { bytesRead } = await fd.read(buffer, 0, 1024, 0);
|
|
23870
|
+
for (let i = 0;i < bytesRead; i++) {
|
|
23871
|
+
const byte = buffer[i];
|
|
23872
|
+
if (byte === 0 || byte < 32 && byte !== 9 && byte !== 10 && byte !== 13) {
|
|
23873
|
+
return true;
|
|
23874
|
+
}
|
|
23875
|
+
}
|
|
23876
|
+
return false;
|
|
23877
|
+
} finally {
|
|
23878
|
+
await fd.close();
|
|
23879
|
+
}
|
|
23880
|
+
} catch {
|
|
23881
|
+
return true;
|
|
23882
|
+
}
|
|
23883
|
+
}
|
|
23884
|
+
var estimateBinaryTokens = function(sizeInBytes) {
|
|
23885
|
+
return Math.ceil(sizeInBytes / 4);
|
|
23886
|
+
};
|
|
23887
|
+
|
|
23849
23888
|
// node_modules/tiktoken/tiktoken.cjs
|
|
23850
23889
|
var __dirname = "/home/runner/work/agentinit/agentinit/node_modules/tiktoken";
|
|
23851
23890
|
var wasm = require_tiktoken_bg();
|
|
@@ -23880,29 +23919,51 @@ var $get_encoding_name_for_model = wasm["get_encoding_name_for_model"];
|
|
|
23880
23919
|
var $Tiktoken = wasm["Tiktoken"];
|
|
23881
23920
|
|
|
23882
23921
|
// node_modules/contextcalc/dist/lib/index.js
|
|
23883
|
-
|
|
23922
|
+
var initializeTiktoken = function() {
|
|
23923
|
+
if (tiktokenInstance) {
|
|
23924
|
+
return tiktokenInstance;
|
|
23925
|
+
}
|
|
23884
23926
|
try {
|
|
23885
|
-
const
|
|
23886
|
-
const buffer = Buffer.alloc(1024);
|
|
23887
|
-
const fd = await fs8.open(filePath, "r");
|
|
23927
|
+
const encoding = $get_encoding(ENCODING_NAME);
|
|
23888
23928
|
try {
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
if (byte === 0 || byte < 32 && byte !== 9 && byte !== 10 && byte !== 13) {
|
|
23893
|
-
return true;
|
|
23894
|
-
}
|
|
23895
|
-
}
|
|
23896
|
-
return false;
|
|
23897
|
-
} finally {
|
|
23898
|
-
await fd.close();
|
|
23929
|
+
encoding.encode("test");
|
|
23930
|
+
} catch (validationError) {
|
|
23931
|
+
throw new Error(`Tiktoken encoding validation failed: ${validationError instanceof Error ? validationError.message : "Unknown validation error"}`);
|
|
23899
23932
|
}
|
|
23900
|
-
|
|
23901
|
-
|
|
23933
|
+
tiktokenInstance = {
|
|
23934
|
+
encoding,
|
|
23935
|
+
isInitialized: true
|
|
23936
|
+
};
|
|
23937
|
+
return tiktokenInstance;
|
|
23938
|
+
} catch (error) {
|
|
23939
|
+
const errorInstance = error instanceof Error ? error : new Error(String(error));
|
|
23940
|
+
if (errorInstance.message.includes("tiktoken_bg.wasm")) {
|
|
23941
|
+
const enhancedError = new Error(`Failed to load tiktoken WebAssembly module: ${errorInstance.message}
|
|
23942
|
+
|
|
23943
|
+
` + `This usually happens when using contextcalc as a dependency. Try:
|
|
23944
|
+
1. Ensure tiktoken is installed: npm install tiktoken
|
|
23945
|
+
2. If using in a bundled environment, ensure WASM files are copied
|
|
23946
|
+
3. Check that the tiktoken_bg.wasm file is accessible in your project
|
|
23947
|
+
|
|
23948
|
+
For more help, see: https://github.com/agentinit/contextcalc/issues`);
|
|
23949
|
+
enhancedError.cause = errorInstance;
|
|
23950
|
+
tiktokenInstance = {
|
|
23951
|
+
encoding: {},
|
|
23952
|
+
isInitialized: false,
|
|
23953
|
+
error: enhancedError
|
|
23954
|
+
};
|
|
23955
|
+
} else {
|
|
23956
|
+
tiktokenInstance = {
|
|
23957
|
+
encoding: {},
|
|
23958
|
+
isInitialized: false,
|
|
23959
|
+
error: new Error(`Failed to initialize tokenizer with encoding '${ENCODING_NAME}': ${errorInstance.message}`)
|
|
23960
|
+
};
|
|
23961
|
+
}
|
|
23962
|
+
return tiktokenInstance;
|
|
23902
23963
|
}
|
|
23903
|
-
}
|
|
23904
|
-
var
|
|
23905
|
-
return
|
|
23964
|
+
};
|
|
23965
|
+
var getTiktoken = function() {
|
|
23966
|
+
return initializeTiktoken();
|
|
23906
23967
|
};
|
|
23907
23968
|
var getTokenizer = function() {
|
|
23908
23969
|
if (!tokenizerInstance) {
|
|
@@ -24035,6 +24096,7 @@ var DOCS_EXTENSIONS = new Set([
|
|
|
24035
24096
|
".md",
|
|
24036
24097
|
".markdown",
|
|
24037
24098
|
".mdx",
|
|
24099
|
+
".mdc",
|
|
24038
24100
|
".txt",
|
|
24039
24101
|
".text",
|
|
24040
24102
|
".rst",
|
|
@@ -24046,15 +24108,12 @@ var DOCS_EXTENSIONS = new Set([
|
|
|
24046
24108
|
".wiki"
|
|
24047
24109
|
]);
|
|
24048
24110
|
var ENCODING_NAME = "o200k_base";
|
|
24111
|
+
var tiktokenInstance = null;
|
|
24049
24112
|
|
|
24050
24113
|
class Tokenizer {
|
|
24051
|
-
|
|
24114
|
+
tiktokenWrapper;
|
|
24052
24115
|
constructor() {
|
|
24053
|
-
|
|
24054
|
-
this.encoding = $get_encoding(ENCODING_NAME);
|
|
24055
|
-
} catch (error) {
|
|
24056
|
-
throw new Error(`Failed to initialize tokenizer with encoding '${ENCODING_NAME}': ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
24057
|
-
}
|
|
24116
|
+
this.tiktokenWrapper = getTiktoken();
|
|
24058
24117
|
}
|
|
24059
24118
|
async countTokens(filePath) {
|
|
24060
24119
|
try {
|
|
@@ -24075,12 +24134,14 @@ class Tokenizer {
|
|
|
24075
24134
|
}
|
|
24076
24135
|
}
|
|
24077
24136
|
countTokensFromText(text) {
|
|
24137
|
+
if (!this.tiktokenWrapper.isInitialized) {
|
|
24138
|
+
throw new Error("Tiktoken is not properly initialized. Cannot provide accurate token counts.");
|
|
24139
|
+
}
|
|
24078
24140
|
try {
|
|
24079
|
-
const tokens = this.encoding.encode(text);
|
|
24141
|
+
const tokens = this.tiktokenWrapper.encoding.encode(text);
|
|
24080
24142
|
return tokens.length;
|
|
24081
24143
|
} catch (error) {
|
|
24082
|
-
|
|
24083
|
-
return Math.ceil(text.length / 4);
|
|
24144
|
+
throw new Error(`Failed to encode text for token counting: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
24084
24145
|
}
|
|
24085
24146
|
}
|
|
24086
24147
|
countLines(text) {
|
|
@@ -24092,11 +24153,6 @@ class Tokenizer {
|
|
|
24092
24153
|
`) ? lines - 1 : lines;
|
|
24093
24154
|
}
|
|
24094
24155
|
dispose() {
|
|
24095
|
-
try {
|
|
24096
|
-
this.encoding.free();
|
|
24097
|
-
} catch (error) {
|
|
24098
|
-
console.warn("Warning: Failed to free tokenizer encoding:", error instanceof Error ? error.message : "Unknown error");
|
|
24099
|
-
}
|
|
24100
24156
|
}
|
|
24101
24157
|
formatTokenCount(count) {
|
|
24102
24158
|
const thresholds = [
|
|
@@ -32980,6 +33036,10 @@ async function applyCommand(args) {
|
|
|
32980
33036
|
logger.info(" agentinit apply --client claude \\");
|
|
32981
33037
|
logger.info(' --mcp-http github "https://api.githubcopilot.com/mcp/" --auth "Bearer YOUR_GITHUB_PAT"');
|
|
32982
33038
|
logger.info("");
|
|
33039
|
+
logger.info(" # HTTP MCP with custom headers");
|
|
33040
|
+
logger.info(" agentinit apply --global --client claude \\");
|
|
33041
|
+
logger.info(' --mcp-http context7 "https://mcp.context7.com/mcp" --header "CONTEXT7_API_KEY:your_api_key"');
|
|
33042
|
+
logger.info("");
|
|
32983
33043
|
logger.info(" # Multiple MCPs with auto-detection");
|
|
32984
33044
|
logger.info(" agentinit apply \\");
|
|
32985
33045
|
logger.info(' --mcp-stdio supabase "npx -y @supabase/mcp-server-supabase@latest" \\');
|
|
@@ -33003,11 +33063,11 @@ async function applyCommand(args) {
|
|
|
33003
33063
|
const mcpArgs = args.filter((arg, index) => {
|
|
33004
33064
|
if (arg === "--client" || arg === "--agent" || arg === "--global" || arg === "--verify-mcp")
|
|
33005
33065
|
return false;
|
|
33006
|
-
if (arg === "--rules" || arg === "--rule-raw" || arg === "--rules-file" || arg === "--rules-remote"
|
|
33066
|
+
if (arg === "--rules" || arg === "--rule-raw" || arg === "--rules-file" || arg === "--rules-remote")
|
|
33007
33067
|
return false;
|
|
33008
33068
|
if (index > 0 && (args[index - 1] === "--client" || args[index - 1] === "--agent"))
|
|
33009
33069
|
return false;
|
|
33010
|
-
if (index > 0 && (args[index - 1] === "--rules" || args[index - 1] === "--rule-raw" || args[index - 1] === "--rules-file" || args[index - 1] === "--rules-remote"
|
|
33070
|
+
if (index > 0 && (args[index - 1] === "--rules" || args[index - 1] === "--rule-raw" || args[index - 1] === "--rules-file" || args[index - 1] === "--rules-remote"))
|
|
33011
33071
|
return false;
|
|
33012
33072
|
return true;
|
|
33013
33073
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentinit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A CLI tool for managing and configuring AI coding agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@iarna/toml": "^2.2.5",
|
|
41
41
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
|
-
"contextcalc": "^1.3.
|
|
43
|
+
"contextcalc": "^1.3.5",
|
|
44
44
|
"gray-matter": "^4.0.3",
|
|
45
45
|
"js-yaml": "^4.1.0",
|
|
46
46
|
"kleur": "^4.1.5",
|
package/dist/agentinit-1.1.0.tgz
DELETED
|
Binary file
|