bitfab-cli 0.2.278 → 0.2.280
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/dist/index.js +69 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28851,6 +28851,7 @@ var SKIP_FLAG = "--dangerously-skip-permissions";
|
|
|
28851
28851
|
var REPO = "Project-White-Rabbit/bitfab-claude-plugin";
|
|
28852
28852
|
var MARKETPLACE = "bitfab";
|
|
28853
28853
|
var PLUGIN_KEY = "bitfab@bitfab";
|
|
28854
|
+
var MCP_SERVER_NAME = `plugin:${MARKETPLACE}:Bitfab`;
|
|
28854
28855
|
var SETUP_COMMAND = "/bitfab:setup";
|
|
28855
28856
|
var ANALYZE_REPO_COMMAND = "/bitfab:setup analyze-repo";
|
|
28856
28857
|
var ASSISTANT_COMMAND = "/bitfab:assistant";
|
|
@@ -28882,6 +28883,13 @@ var checkClaudeAuth = makeCliAuthCheck({
|
|
|
28882
28883
|
});
|
|
28883
28884
|
function runClaudeInstall() {
|
|
28884
28885
|
const s = p3.spinner();
|
|
28886
|
+
const repaired = enableBitfabMcpServer(
|
|
28887
|
+
path17.join(os15.homedir(), ".claude.json"),
|
|
28888
|
+
process.cwd()
|
|
28889
|
+
);
|
|
28890
|
+
if (repaired) {
|
|
28891
|
+
p3.log.step("Re-enabled the Bitfab MCP server for this project");
|
|
28892
|
+
}
|
|
28885
28893
|
const localPluginKey = activeLocalClaudeBitfabPlugin();
|
|
28886
28894
|
if (localPluginKey !== null) {
|
|
28887
28895
|
p3.log.step(`Local Bitfab plugin already enabled (${localPluginKey})`);
|
|
@@ -29787,6 +29795,67 @@ function pluginStateFromText(listOut) {
|
|
|
29787
29795
|
}
|
|
29788
29796
|
return new RegExp(`${key}\\s*\\n.*\\n.*\\n.*disabled`).test(listOut) ? "disabled" : "enabled";
|
|
29789
29797
|
}
|
|
29798
|
+
function claudeProjectKeys(projectPath) {
|
|
29799
|
+
const shape = (value) => {
|
|
29800
|
+
const normalized = path17.normalize(value.normalize("NFC"));
|
|
29801
|
+
return process.platform === "win32" ? normalized.replaceAll("\\", "/") : normalized;
|
|
29802
|
+
};
|
|
29803
|
+
const candidates = [projectPath, shape(projectPath)];
|
|
29804
|
+
const root = runCliResult("git", [
|
|
29805
|
+
"-C",
|
|
29806
|
+
projectPath,
|
|
29807
|
+
"rev-parse",
|
|
29808
|
+
"--show-toplevel"
|
|
29809
|
+
]);
|
|
29810
|
+
const toplevel = root.status === 0 ? root.output.trim() : "";
|
|
29811
|
+
if (toplevel !== "") {
|
|
29812
|
+
candidates.unshift(shape(toplevel));
|
|
29813
|
+
}
|
|
29814
|
+
return Array.from(new Set(candidates));
|
|
29815
|
+
}
|
|
29816
|
+
function enableBitfabMcpServer(configPath, projectPath) {
|
|
29817
|
+
let staging;
|
|
29818
|
+
try {
|
|
29819
|
+
if (!fs20.existsSync(configPath)) {
|
|
29820
|
+
return false;
|
|
29821
|
+
}
|
|
29822
|
+
const raw = fs20.readFileSync(configPath, "utf-8");
|
|
29823
|
+
if (raw.trim() === "") {
|
|
29824
|
+
return false;
|
|
29825
|
+
}
|
|
29826
|
+
const config4 = JSON.parse(raw);
|
|
29827
|
+
const projects = config4.projects ?? {};
|
|
29828
|
+
const hit = claudeProjectKeys(projectPath).map((key) => projects[key]).find(
|
|
29829
|
+
(entry) => entry !== null && typeof entry === "object" && Array.isArray(entry.disabledMcpServers) && entry.disabledMcpServers.includes(MCP_SERVER_NAME)
|
|
29830
|
+
);
|
|
29831
|
+
if (hit === void 0) {
|
|
29832
|
+
return false;
|
|
29833
|
+
}
|
|
29834
|
+
const project = hit;
|
|
29835
|
+
const disabled = project.disabledMcpServers;
|
|
29836
|
+
project.disabledMcpServers = disabled.filter(
|
|
29837
|
+
(name) => name !== MCP_SERVER_NAME
|
|
29838
|
+
);
|
|
29839
|
+
const target = fs20.realpathSync(configPath);
|
|
29840
|
+
const mode = fs20.statSync(target).mode & 511;
|
|
29841
|
+
const stagingPath = `${target}.bitfab-${process.pid}.tmp`;
|
|
29842
|
+
fs20.writeFileSync(stagingPath, JSON.stringify(config4, null, 2), {
|
|
29843
|
+
mode,
|
|
29844
|
+
flag: "wx"
|
|
29845
|
+
});
|
|
29846
|
+
staging = stagingPath;
|
|
29847
|
+
fs20.renameSync(staging, target);
|
|
29848
|
+
return true;
|
|
29849
|
+
} catch {
|
|
29850
|
+
if (staging !== void 0) {
|
|
29851
|
+
try {
|
|
29852
|
+
fs20.rmSync(staging, { force: true });
|
|
29853
|
+
} catch {
|
|
29854
|
+
}
|
|
29855
|
+
}
|
|
29856
|
+
return false;
|
|
29857
|
+
}
|
|
29858
|
+
}
|
|
29790
29859
|
function enableAutoUpdate(settingsPath) {
|
|
29791
29860
|
let settings = {};
|
|
29792
29861
|
if (fs20.existsSync(settingsPath)) {
|