@braingrid/cli 0.2.30 → 0.2.32

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 CHANGED
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.32] - 2026-02-03
11
+
12
+ ### Added
13
+
14
+ - **Hooks configuration in settings.json**
15
+ - `braingrid setup claude-code` now configures PostToolUse hooks in `.claude/settings.json`
16
+ - Hooks trigger sync-braingrid-task.sh on TaskUpdate events with 10s timeout
17
+ - Enables automatic task status synchronization between Claude Code and BrainGrid
18
+
19
+ ## [0.2.31] - 2026-02-03
20
+
21
+ ### Added
22
+
23
+ - **Hook script installation during setup**
24
+ - `braingrid setup claude-code` now installs sync-braingrid-task.sh hook
25
+ - Hook automatically syncs task status between Claude Code and BrainGrid
26
+ - Installed to `.claude/hooks/` with executable permissions
27
+
10
28
  ## [0.2.30] - 2025-02-02
11
29
 
12
30
  ### Fixed
package/dist/cli.js CHANGED
@@ -222,7 +222,7 @@ async function axiosWithRetry(config2, options) {
222
222
 
223
223
  // src/build-config.ts
224
224
  var BUILD_ENV = true ? "production" : process.env.NODE_ENV === "test" ? "development" : "production";
225
- var CLI_VERSION = true ? "0.2.30" : "0.0.0-test";
225
+ var CLI_VERSION = true ? "0.2.32" : "0.0.0-test";
226
226
  var PRODUCTION_CONFIG = {
227
227
  apiUrl: "https://app.braingrid.ai",
228
228
  workosAuthUrl: "https://auth.braingrid.ai",
@@ -2658,6 +2658,16 @@ async function installStatusLineScript(scriptContent, targetPath = ".claude/stat
2658
2658
  throw new Error(`Failed to install status line script to ${targetPath}: ${errorMessage}`);
2659
2659
  }
2660
2660
  }
2661
+ async function installHookScript(scriptContent, targetPath = ".claude/hooks/sync-braingrid-task.sh") {
2662
+ try {
2663
+ const parentDir = path2.dirname(targetPath);
2664
+ await fs2.mkdir(parentDir, { recursive: true });
2665
+ await fs2.writeFile(targetPath, scriptContent, { encoding: "utf8", mode: 493 });
2666
+ } catch (error) {
2667
+ const errorMessage = error instanceof Error ? error.message : String(error);
2668
+ throw new Error(`Failed to install hook script to ${targetPath}: ${errorMessage}`);
2669
+ }
2670
+ }
2661
2671
  async function copyBraingridReadme(targetPath = ".braingrid/README.md") {
2662
2672
  try {
2663
2673
  const content = await fetchFileFromGitHub("claude-code/README.md");
@@ -2669,7 +2679,7 @@ async function copyBraingridReadme(targetPath = ".braingrid/README.md") {
2669
2679
  return false;
2670
2680
  }
2671
2681
  }
2672
- async function updateClaudeSettings(settingsPath = ".claude/settings.json", scriptPath2 = ".claude/statusline.sh") {
2682
+ async function updateClaudeSettings(settingsPath = ".claude/settings.json", scriptPath2 = ".claude/statusline.sh", hookScriptPath = ".claude/hooks/sync-braingrid-task.sh") {
2673
2683
  try {
2674
2684
  let settings = {};
2675
2685
  try {
@@ -2682,9 +2692,23 @@ async function updateClaudeSettings(settingsPath = ".claude/settings.json", scri
2682
2692
  command: scriptPath2,
2683
2693
  padding: 0
2684
2694
  };
2695
+ settings.hooks = {
2696
+ PostToolUse: [
2697
+ {
2698
+ matcher: "TaskUpdate",
2699
+ hooks: [
2700
+ {
2701
+ type: "command",
2702
+ command: hookScriptPath,
2703
+ timeout: 1e4
2704
+ }
2705
+ ]
2706
+ }
2707
+ ]
2708
+ };
2685
2709
  const parentDir = path2.dirname(settingsPath);
2686
2710
  await fs2.mkdir(parentDir, { recursive: true });
2687
- const content = JSON.stringify(settings, null, 2);
2711
+ const content = JSON.stringify(settings, null, " ");
2688
2712
  await fs2.writeFile(settingsPath, content, { encoding: "utf8" });
2689
2713
  } catch (error) {
2690
2714
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -3378,14 +3402,28 @@ async function _handleSetup(config2, opts) {
3378
3402
  );
3379
3403
  }
3380
3404
  }
3405
+ let hookInstalled = false;
3406
+ if (config2.name === "Claude Code") {
3407
+ try {
3408
+ const hookContent = await fetchFileFromGitHub("claude-code/hooks/sync-braingrid-task.sh");
3409
+ await installHookScript(hookContent);
3410
+ hookInstalled = true;
3411
+ } catch (error) {
3412
+ console.error(
3413
+ chalk8.yellow("\u26A0\uFE0F Failed to install hook script:"),
3414
+ error instanceof Error ? error.message : String(error)
3415
+ );
3416
+ }
3417
+ }
3381
3418
  await copyBraingridReadme();
3382
3419
  const statusLineMessage = statusLineInstalled ? chalk8.dim(" Status line: .claude/statusline.sh\n") : "";
3420
+ const hookMessage = hookInstalled ? chalk8.dim(" Hook script: .claude/hooks/sync-braingrid-task.sh\n") : "";
3383
3421
  return {
3384
3422
  success: true,
3385
3423
  message: chalk8.green(`\u2705 ${config2.name} integration installed successfully!
3386
3424
 
3387
3425
  `) + chalk8.dim("Files installed:\n") + chalk8.dim(` Commands: ${result.installed} files
3388
- `) + statusLineMessage + chalk8.dim(` Content injected into: ${config2.injection.targetFile}
3426
+ `) + statusLineMessage + hookMessage + chalk8.dim(` Content injected into: ${config2.injection.targetFile}
3389
3427
 
3390
3428
  `) + chalk8.dim("Next steps:\n") + chalk8.dim(" 1. Review the integration files\n") + chalk8.dim(` 2. Open ${config2.name}
3391
3429
  `) + chalk8.dim(" 3. Try the /specify or /breakdown commands\n") + chalk8.dim(" 4. Learn more: ") + chalk8.cyan(config2.docsUrl)