mobbdev 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +34 -6
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -13409,7 +13409,7 @@ async function writeClaudeSettings(settings) {
13409
13409
  "utf-8"
13410
13410
  );
13411
13411
  }
13412
- async function installMobbHooks() {
13412
+ async function installMobbHooks(options = {}) {
13413
13413
  console.log(chalk10.blue("Installing Mobb hooks in Claude Code settings..."));
13414
13414
  if (!await claudeSettingsExists()) {
13415
13415
  console.log(chalk10.red("\u274C Claude Code settings file not found"));
@@ -13427,12 +13427,33 @@ async function installMobbHooks() {
13427
13427
  if (!settings.hooks.PostToolUse) {
13428
13428
  settings.hooks.PostToolUse = [];
13429
13429
  }
13430
+ let command = "npx --yes mobbdev@latest claude-code-process-hook";
13431
+ if (options.saveEnv) {
13432
+ const envVars = [];
13433
+ if (process.env["WEB_LOGIN_URL"]) {
13434
+ envVars.push(`WEB_LOGIN_URL="${process.env["WEB_LOGIN_URL"]}"`);
13435
+ }
13436
+ if (process.env["WEB_APP_URL"]) {
13437
+ envVars.push(`WEB_APP_URL="${process.env["WEB_APP_URL"]}"`);
13438
+ }
13439
+ if (process.env["API_URL"]) {
13440
+ envVars.push(`API_URL="${process.env["API_URL"]}"`);
13441
+ }
13442
+ if (envVars.length > 0) {
13443
+ command = `${envVars.join(" ")} ${command}`;
13444
+ console.log(
13445
+ chalk10.blue(
13446
+ `Adding environment variables to hook command: ${envVars.join(", ")}`
13447
+ )
13448
+ );
13449
+ }
13450
+ }
13430
13451
  const mobbHookConfig = {
13431
13452
  matcher: "Edit|Write",
13432
13453
  hooks: [
13433
13454
  {
13434
13455
  type: "command",
13435
- command: "npx --yes mobbdev@latest claude-code-process-hook"
13456
+ command
13436
13457
  }
13437
13458
  ]
13438
13459
  };
@@ -13451,7 +13472,7 @@ async function installMobbHooks() {
13451
13472
  await writeClaudeSettings(settings);
13452
13473
  console.log(
13453
13474
  chalk10.green(
13454
- `\u2705 Mobb hooks installed successfully in ${CLAUDE_SETTINGS_PATH}`
13475
+ `\u2705 Mobb hooks ${options.saveEnv ? "and environment variables " : ""}installed successfully in ${CLAUDE_SETTINGS_PATH}`
13455
13476
  )
13456
13477
  );
13457
13478
  }
@@ -13459,9 +13480,16 @@ async function installMobbHooks() {
13459
13480
  // src/args/commands/claude_code.ts
13460
13481
  var config6 = new Configstore5(packageJson.name, { apiToken: "" });
13461
13482
  var claudeCodeInstallHookBuilder = (yargs2) => {
13462
- return yargs2.example(
13483
+ return yargs2.option("save-env", {
13484
+ type: "boolean",
13485
+ description: "Save WEB_LOGIN_URL, WEB_APP_URL, and API_URL environment variables to hooks config",
13486
+ default: false
13487
+ }).example(
13463
13488
  "$0 claude-code-install-hook",
13464
13489
  "Install Claude Code hooks for data collection"
13490
+ ).example(
13491
+ "$0 claude-code-install-hook --save-env",
13492
+ "Install hooks and save environment variables to config"
13465
13493
  ).strict();
13466
13494
  };
13467
13495
  var claudeCodeProcessHookBuilder = (yargs2) => {
@@ -13470,7 +13498,7 @@ var claudeCodeProcessHookBuilder = (yargs2) => {
13470
13498
  "Process Claude Code hook data and upload to backend"
13471
13499
  ).strict();
13472
13500
  };
13473
- var claudeCodeInstallHookHandler = async () => {
13501
+ var claudeCodeInstallHookHandler = async (argv) => {
13474
13502
  try {
13475
13503
  const gqlClient = new GQLClient({
13476
13504
  apiKey: config6.get("apiToken") ?? "",
@@ -13480,7 +13508,7 @@ var claudeCodeInstallHookHandler = async () => {
13480
13508
  inGqlClient: gqlClient,
13481
13509
  skipPrompts: false
13482
13510
  });
13483
- await installMobbHooks();
13511
+ await installMobbHooks({ saveEnv: argv["save-env"] });
13484
13512
  process.exit(0);
13485
13513
  } catch (error) {
13486
13514
  console.error("Failed to install Claude Code hooks:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.mjs",