githits 0.1.10 → 0.1.11
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.plugin/plugin.json +1 -1
- package/dist/cli.js +159 -30
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-5g0k8452.js → chunk-hyfjv9fg.js} +1 -1
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
package/.plugin/plugin.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
version
|
|
4
|
-
} from "./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-hyfjv9fg.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -7446,6 +7446,113 @@ function registerFeedbackCommand(program) {
|
|
|
7446
7446
|
});
|
|
7447
7447
|
}
|
|
7448
7448
|
// src/commands/init/setup-handlers.ts
|
|
7449
|
+
function isPlainObject(value) {
|
|
7450
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7451
|
+
}
|
|
7452
|
+
function deepEqual(left, right) {
|
|
7453
|
+
if (Object.is(left, right)) {
|
|
7454
|
+
return true;
|
|
7455
|
+
}
|
|
7456
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
7457
|
+
if (left.length !== right.length) {
|
|
7458
|
+
return false;
|
|
7459
|
+
}
|
|
7460
|
+
for (let i = 0;i < left.length; i++) {
|
|
7461
|
+
if (!deepEqual(left[i], right[i])) {
|
|
7462
|
+
return false;
|
|
7463
|
+
}
|
|
7464
|
+
}
|
|
7465
|
+
return true;
|
|
7466
|
+
}
|
|
7467
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
7468
|
+
const leftKeys = Object.keys(left).sort();
|
|
7469
|
+
const rightKeys = Object.keys(right).sort();
|
|
7470
|
+
if (!deepEqual(leftKeys, rightKeys)) {
|
|
7471
|
+
return false;
|
|
7472
|
+
}
|
|
7473
|
+
for (const key of leftKeys) {
|
|
7474
|
+
if (!deepEqual(left[key], right[key])) {
|
|
7475
|
+
return false;
|
|
7476
|
+
}
|
|
7477
|
+
}
|
|
7478
|
+
return true;
|
|
7479
|
+
}
|
|
7480
|
+
return false;
|
|
7481
|
+
}
|
|
7482
|
+
function isStringArray2(value) {
|
|
7483
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
7484
|
+
}
|
|
7485
|
+
function isGitHitsPackageToken(token) {
|
|
7486
|
+
return token.toLowerCase() === "githits@latest";
|
|
7487
|
+
}
|
|
7488
|
+
function isLocalGitHitsInvocation(invocation) {
|
|
7489
|
+
if (invocation.length === 5) {
|
|
7490
|
+
const [command, yesFlag, packageToken, subcommand, action] = invocation;
|
|
7491
|
+
return command === "npx" && yesFlag === "-y" && typeof packageToken === "string" && isGitHitsPackageToken(packageToken) && subcommand === "mcp" && action === "start";
|
|
7492
|
+
}
|
|
7493
|
+
return false;
|
|
7494
|
+
}
|
|
7495
|
+
function extractInvocation(config) {
|
|
7496
|
+
if (!isPlainObject(config)) {
|
|
7497
|
+
return null;
|
|
7498
|
+
}
|
|
7499
|
+
const command = config.command;
|
|
7500
|
+
if (typeof command === "string") {
|
|
7501
|
+
const args = config.args;
|
|
7502
|
+
if (!isStringArray2(args)) {
|
|
7503
|
+
return null;
|
|
7504
|
+
}
|
|
7505
|
+
return [command, ...args];
|
|
7506
|
+
}
|
|
7507
|
+
if (isStringArray2(command)) {
|
|
7508
|
+
return [...command];
|
|
7509
|
+
}
|
|
7510
|
+
return null;
|
|
7511
|
+
}
|
|
7512
|
+
function nonCommandFieldsEqual(existing, expected) {
|
|
7513
|
+
for (const [key, value] of Object.entries(expected)) {
|
|
7514
|
+
if (key === "command" || key === "args") {
|
|
7515
|
+
continue;
|
|
7516
|
+
}
|
|
7517
|
+
if (!deepEqual(existing[key], value)) {
|
|
7518
|
+
return false;
|
|
7519
|
+
}
|
|
7520
|
+
}
|
|
7521
|
+
return true;
|
|
7522
|
+
}
|
|
7523
|
+
function hasLegacyRemoteIndicators(existing, expected) {
|
|
7524
|
+
if ("url" in existing || "serverUrl" in existing) {
|
|
7525
|
+
return true;
|
|
7526
|
+
}
|
|
7527
|
+
if ("type" in existing && !("type" in expected) && (existing.type === "http" || existing.type === "streamableHttp")) {
|
|
7528
|
+
return true;
|
|
7529
|
+
}
|
|
7530
|
+
return false;
|
|
7531
|
+
}
|
|
7532
|
+
function isEquivalentConfiguredValue(existing, expected) {
|
|
7533
|
+
if (deepEqual(existing, expected)) {
|
|
7534
|
+
return true;
|
|
7535
|
+
}
|
|
7536
|
+
if (!isPlainObject(existing)) {
|
|
7537
|
+
return false;
|
|
7538
|
+
}
|
|
7539
|
+
const expectedInvocation = extractInvocation(expected);
|
|
7540
|
+
const existingInvocation = extractInvocation(existing);
|
|
7541
|
+
if (!expectedInvocation || !existingInvocation) {
|
|
7542
|
+
return false;
|
|
7543
|
+
}
|
|
7544
|
+
if (!isLocalGitHitsInvocation(expectedInvocation) || !isLocalGitHitsInvocation(existingInvocation)) {
|
|
7545
|
+
return false;
|
|
7546
|
+
}
|
|
7547
|
+
if (hasLegacyRemoteIndicators(existing, expected)) {
|
|
7548
|
+
return false;
|
|
7549
|
+
}
|
|
7550
|
+
return nonCommandFieldsEqual(existing, expected);
|
|
7551
|
+
}
|
|
7552
|
+
function getMatchingServerKeys(servers, serverName) {
|
|
7553
|
+
const normalizedTarget = serverName.toLowerCase();
|
|
7554
|
+
return Object.keys(servers).filter((key) => key.toLowerCase() === normalizedTarget);
|
|
7555
|
+
}
|
|
7449
7556
|
function mergeServerConfig(existingContent, serversKey, serverName, serverConfig) {
|
|
7450
7557
|
let content = existingContent;
|
|
7451
7558
|
if (content.charCodeAt(0) === 65279) {
|
|
@@ -7481,12 +7588,17 @@ function mergeServerConfig(existingContent, serversKey, serverName, serverConfig
|
|
|
7481
7588
|
};
|
|
7482
7589
|
}
|
|
7483
7590
|
const serversObj = servers;
|
|
7484
|
-
|
|
7591
|
+
const matchingKeys = getMatchingServerKeys(serversObj, serverName);
|
|
7592
|
+
if (matchingKeys.length === 1 && matchingKeys[0] === serverName && isEquivalentConfiguredValue(serversObj[serverName], serverConfig)) {
|
|
7485
7593
|
return { status: "already_configured" };
|
|
7486
7594
|
}
|
|
7595
|
+
for (const key of matchingKeys) {
|
|
7596
|
+
delete serversObj[key];
|
|
7597
|
+
}
|
|
7598
|
+
const hadExisting = matchingKeys.length > 0;
|
|
7487
7599
|
serversObj[serverName] = serverConfig;
|
|
7488
7600
|
return {
|
|
7489
|
-
status: "added",
|
|
7601
|
+
status: hadExisting ? "updated" : "added",
|
|
7490
7602
|
content: `${JSON.stringify(config, null, 2)}
|
|
7491
7603
|
`
|
|
7492
7604
|
};
|
|
@@ -7524,7 +7636,12 @@ async function isAlreadyConfigured(config, fs) {
|
|
|
7524
7636
|
if (typeof servers !== "object" || servers === null || Array.isArray(servers)) {
|
|
7525
7637
|
return false;
|
|
7526
7638
|
}
|
|
7527
|
-
|
|
7639
|
+
const serversObj = servers;
|
|
7640
|
+
const matchingKeys = getMatchingServerKeys(serversObj, config.serverName);
|
|
7641
|
+
if (matchingKeys.length !== 1 || matchingKeys[0] !== config.serverName) {
|
|
7642
|
+
return false;
|
|
7643
|
+
}
|
|
7644
|
+
return isEquivalentConfiguredValue(serversObj[config.serverName], config.serverConfig);
|
|
7528
7645
|
} catch {
|
|
7529
7646
|
return false;
|
|
7530
7647
|
}
|
|
@@ -7654,6 +7771,13 @@ async function executeConfigFileSetup(setup, fs) {
|
|
|
7654
7771
|
}
|
|
7655
7772
|
|
|
7656
7773
|
// src/commands/init/agent-definitions.ts
|
|
7774
|
+
var GITHITS_SERVER_NAME = "GitHits";
|
|
7775
|
+
var GITHITS_MCP_COMMAND = "npx";
|
|
7776
|
+
var GITHITS_MCP_ARGS = ["-y", "githits@latest", "mcp", "start"];
|
|
7777
|
+
var GITHITS_MCP_INVOCATION = [
|
|
7778
|
+
GITHITS_MCP_COMMAND,
|
|
7779
|
+
...GITHITS_MCP_ARGS
|
|
7780
|
+
];
|
|
7657
7781
|
function getAppDataPath(fs, appName) {
|
|
7658
7782
|
const home = fs.getHomeDir();
|
|
7659
7783
|
switch (process.platform) {
|
|
@@ -7709,8 +7833,11 @@ var cursor = {
|
|
|
7709
7833
|
method: "config-file",
|
|
7710
7834
|
configPath: fs.joinPath(fs.getHomeDir(), ".cursor", "mcp.json"),
|
|
7711
7835
|
serversKey: "mcpServers",
|
|
7712
|
-
serverName:
|
|
7713
|
-
serverConfig: {
|
|
7836
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7837
|
+
serverConfig: {
|
|
7838
|
+
command: GITHITS_MCP_COMMAND,
|
|
7839
|
+
args: [...GITHITS_MCP_ARGS]
|
|
7840
|
+
}
|
|
7714
7841
|
})
|
|
7715
7842
|
};
|
|
7716
7843
|
var windsurf = {
|
|
@@ -7723,8 +7850,11 @@ var windsurf = {
|
|
|
7723
7850
|
method: "config-file",
|
|
7724
7851
|
configPath: fs.joinPath(fs.getHomeDir(), ".codeium", "windsurf", "mcp_config.json"),
|
|
7725
7852
|
serversKey: "mcpServers",
|
|
7726
|
-
serverName:
|
|
7727
|
-
serverConfig: {
|
|
7853
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7854
|
+
serverConfig: {
|
|
7855
|
+
command: GITHITS_MCP_COMMAND,
|
|
7856
|
+
args: [...GITHITS_MCP_ARGS]
|
|
7857
|
+
}
|
|
7728
7858
|
})
|
|
7729
7859
|
};
|
|
7730
7860
|
var claudeDesktop = {
|
|
@@ -7751,10 +7881,10 @@ var claudeDesktop = {
|
|
|
7751
7881
|
method: "config-file",
|
|
7752
7882
|
configPath: fs.joinPath(appData, "claude_desktop_config.json"),
|
|
7753
7883
|
serversKey: "mcpServers",
|
|
7754
|
-
serverName:
|
|
7884
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7755
7885
|
serverConfig: {
|
|
7756
|
-
command:
|
|
7757
|
-
args: [
|
|
7886
|
+
command: GITHITS_MCP_COMMAND,
|
|
7887
|
+
args: [...GITHITS_MCP_ARGS]
|
|
7758
7888
|
}
|
|
7759
7889
|
};
|
|
7760
7890
|
}
|
|
@@ -7770,17 +7900,7 @@ var codexCli = {
|
|
|
7770
7900
|
commands: [
|
|
7771
7901
|
{
|
|
7772
7902
|
command: "codex",
|
|
7773
|
-
args: [
|
|
7774
|
-
"mcp",
|
|
7775
|
-
"add",
|
|
7776
|
-
"githits",
|
|
7777
|
-
"--",
|
|
7778
|
-
"npx",
|
|
7779
|
-
"-y",
|
|
7780
|
-
"githits@latest",
|
|
7781
|
-
"mcp",
|
|
7782
|
-
"start"
|
|
7783
|
-
]
|
|
7903
|
+
args: ["mcp", "add", "githits", "--", ...GITHITS_MCP_INVOCATION]
|
|
7784
7904
|
}
|
|
7785
7905
|
],
|
|
7786
7906
|
checkCommand: {
|
|
@@ -7805,8 +7925,11 @@ var vscode = {
|
|
|
7805
7925
|
method: "config-file",
|
|
7806
7926
|
configPath: fs.joinPath(appData, "User", "mcp.json"),
|
|
7807
7927
|
serversKey: "servers",
|
|
7808
|
-
serverName:
|
|
7809
|
-
serverConfig: {
|
|
7928
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7929
|
+
serverConfig: {
|
|
7930
|
+
command: GITHITS_MCP_COMMAND,
|
|
7931
|
+
args: [...GITHITS_MCP_ARGS]
|
|
7932
|
+
}
|
|
7810
7933
|
};
|
|
7811
7934
|
}
|
|
7812
7935
|
};
|
|
@@ -7820,8 +7943,11 @@ var cline = {
|
|
|
7820
7943
|
method: "config-file",
|
|
7821
7944
|
configPath: fs.joinPath(fs.getHomeDir(), ".cline", "data", "settings", "cline_mcp_settings.json"),
|
|
7822
7945
|
serversKey: "mcpServers",
|
|
7823
|
-
serverName:
|
|
7824
|
-
serverConfig: {
|
|
7946
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7947
|
+
serverConfig: {
|
|
7948
|
+
command: GITHITS_MCP_COMMAND,
|
|
7949
|
+
args: [...GITHITS_MCP_ARGS]
|
|
7950
|
+
}
|
|
7825
7951
|
})
|
|
7826
7952
|
};
|
|
7827
7953
|
var geminiCli = {
|
|
@@ -7865,8 +7991,11 @@ var googleAntigravity = {
|
|
|
7865
7991
|
method: "config-file",
|
|
7866
7992
|
configPath: fs.joinPath(fs.getHomeDir(), ".gemini", "antigravity", "mcp_config.json"),
|
|
7867
7993
|
serversKey: "mcpServers",
|
|
7868
|
-
serverName:
|
|
7869
|
-
serverConfig: {
|
|
7994
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7995
|
+
serverConfig: {
|
|
7996
|
+
command: GITHITS_MCP_COMMAND,
|
|
7997
|
+
args: [...GITHITS_MCP_ARGS]
|
|
7998
|
+
}
|
|
7870
7999
|
})
|
|
7871
8000
|
};
|
|
7872
8001
|
var openCode = {
|
|
@@ -7879,10 +8008,10 @@ var openCode = {
|
|
|
7879
8008
|
method: "config-file",
|
|
7880
8009
|
configPath: process.platform === "win32" ? fs.joinPath(process.env.APPDATA ?? fs.joinPath(fs.getHomeDir(), "AppData", "Roaming"), "opencode", "opencode.json") : fs.joinPath(fs.getHomeDir(), ".config", "opencode", "opencode.json"),
|
|
7881
8010
|
serversKey: "mcp",
|
|
7882
|
-
serverName:
|
|
8011
|
+
serverName: GITHITS_SERVER_NAME,
|
|
7883
8012
|
serverConfig: {
|
|
7884
8013
|
type: "local",
|
|
7885
|
-
command: [
|
|
8014
|
+
command: [...GITHITS_MCP_INVOCATION],
|
|
7886
8015
|
enabled: true
|
|
7887
8016
|
}
|
|
7888
8017
|
})
|
package/dist/index.js
CHANGED
package/gemini-extension.json
CHANGED
package/package.json
CHANGED