ai-agent-config 2.5.4 → 2.5.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agent-config",
3
- "version": "2.5.4",
3
+ "version": "2.5.7",
4
4
  "description": "Universal skill & workflow manager for AI coding assistants with bi-directional GitHub sync",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -62,7 +62,8 @@ function main() {
62
62
  }
63
63
  }
64
64
 
65
- // Add Bitwarden MCP server (enabled by default)
65
+ // Add/Enable Bitwarden MCP server
66
+ let changed = false;
66
67
  if (!mcpConfig.mcpServers.bitwarden) {
67
68
  mcpConfig.mcpServers.bitwarden = {
68
69
  command: "npx",
@@ -72,13 +73,20 @@ function main() {
72
73
  BW_CLIENTSECRET: "${BW_CLIENTSECRET}",
73
74
  },
74
75
  };
76
+ changed = true;
77
+ console.log("🔐 Bitwarden MCP server added to Antigravity (✓ enabled)");
78
+ } else if (mcpConfig.mcpServers.bitwarden.disabled) {
79
+ delete mcpConfig.mcpServers.bitwarden.disabled;
80
+ changed = true;
81
+ console.log("🔓 Bitwarden MCP server enabled in Antigravity");
82
+ }
75
83
 
84
+ if (changed) {
76
85
  fs.writeFileSync(
77
86
  antigravityMcpPath,
78
87
  JSON.stringify(mcpConfig, null, 2),
79
88
  "utf-8"
80
89
  );
81
- console.log("🔐 Bitwarden MCP server added to Antigravity (✓ enabled)");
82
90
  console.log(" Config: ~/.gemini/antigravity/mcp_config.json\n");
83
91
  }
84
92
  } catch (error) {
@@ -27,22 +27,81 @@ function validateBitwardenCLI() {
27
27
  }
28
28
 
29
29
  /**
30
- * Validate that Bitwarden API credentials are set
30
+ * Check Bitwarden login status using `bw status`
31
31
  */
32
- function validateBitwardenAuth() {
32
+ function getBitwardenStatus() {
33
+ try {
34
+ const result = spawnSync("bw", ["status"], {
35
+ encoding: "utf-8",
36
+ stdio: ["pipe", "pipe", "pipe"],
37
+ });
38
+ const output = result.stdout || "";
39
+ const json = JSON.parse(output.trim());
40
+ return json.status; // "unauthenticated", "locked", "unlocked"
41
+ } catch {
42
+ return "unauthenticated";
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Login to Bitwarden using API key (BW_CLIENTID + BW_CLIENTSECRET)
48
+ */
49
+ function loginBitwarden() {
33
50
  const clientId = process.env.BW_CLIENTID;
34
51
  const clientSecret = process.env.BW_CLIENTSECRET;
35
52
 
36
53
  if (!clientId || !clientSecret) {
37
54
  return {
38
- valid: false,
55
+ success: false,
39
56
  message:
40
57
  "Bitwarden API credentials not set. Add to ~/.zshrc:\n" +
41
58
  " export BW_CLIENTID=\"user.xxx\"\n" +
42
- " export BW_CLIENTSECRET=\"yyy\"",
59
+ " export BW_CLIENTSECRET=\"yyy\"\n\n" +
60
+ " Get your API key from: https://vault.bitwarden.com/#/settings/security/security-keys",
43
61
  };
44
62
  }
45
63
 
64
+ try {
65
+ const result = spawnSync("bw", ["login", "--apikey"], {
66
+ encoding: "utf-8",
67
+ env: { ...process.env, BW_CLIENTID: clientId, BW_CLIENTSECRET: clientSecret },
68
+ stdio: ["pipe", "pipe", "pipe"],
69
+ });
70
+
71
+ if (result.status === 0) {
72
+ return { success: true };
73
+ } else {
74
+ const errorMsg = result.stderr || result.stdout || "Unknown error";
75
+ return {
76
+ success: false,
77
+ message: `Failed to login: ${errorMsg.trim()}`,
78
+ };
79
+ }
80
+ } catch (error) {
81
+ return {
82
+ success: false,
83
+ message: `Failed to login: ${error.message}`,
84
+ };
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Ensure Bitwarden is logged in, auto-login if needed
90
+ */
91
+ function ensureBitwardenLogin() {
92
+ const status = getBitwardenStatus();
93
+
94
+ if (status === "unauthenticated") {
95
+ console.log("🔑 Logging into Bitwarden...");
96
+ const loginResult = loginBitwarden();
97
+ if (!loginResult.success) {
98
+ return { valid: false, message: loginResult.message };
99
+ }
100
+ console.log("✓ Logged in successfully\n");
101
+ } else {
102
+ console.log("✓ Already logged into Bitwarden\n");
103
+ }
104
+
46
105
  return { valid: true };
47
106
  }
48
107
 
@@ -253,8 +312,8 @@ async function syncSecrets() {
253
312
  process.exit(1);
254
313
  }
255
314
 
256
- // 2. Validate API credentials
257
- const authCheck = validateBitwardenAuth();
315
+ // 2. Check login status and auto-login if needed
316
+ const authCheck = ensureBitwardenLogin();
258
317
  if (!authCheck.valid) {
259
318
  console.error(`❌ ${authCheck.message}\n`);
260
319
  process.exit(1);
@@ -342,7 +401,7 @@ async function syncSecrets() {
342
401
  module.exports = {
343
402
  syncSecrets,
344
403
  validateBitwardenCLI,
345
- validateBitwardenAuth,
404
+ ensureBitwardenLogin,
346
405
  promptPassword,
347
406
  unlockBitwarden,
348
407
  discoverRequiredSecrets,