@braingrid/cli 0.2.29 → 0.2.31

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,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.31] - 2026-02-03
11
+
12
+ ### Added
13
+
14
+ - **Hook script installation during setup**
15
+ - `braingrid setup claude-code` now installs sync-braingrid-task.sh hook
16
+ - Hook automatically syncs task status between Claude Code and BrainGrid
17
+ - Installed to `.claude/hooks/` with executable permissions
18
+
19
+ ## [0.2.30] - 2025-02-02
20
+
21
+ ### Fixed
22
+
23
+ - **Validation error handling crash**
24
+ - Fixed `TypeError: errors is not iterable` when API returns single string errors
25
+ - Error handler now handles both array and string formats for validation errors
26
+
10
27
  ## [0.2.29] - 2025-02-02
11
28
 
12
29
  ### Added
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.29" : "0.0.0-test";
225
+ var CLI_VERSION = true ? "0.2.31" : "0.0.0-test";
226
226
  var PRODUCTION_CONFIG = {
227
227
  apiUrl: "https://app.braingrid.ai",
228
228
  workosAuthUrl: "https://auth.braingrid.ai",
@@ -1759,12 +1759,13 @@ ${chalk.yellow(responseData.message)}`;
1759
1759
  message += `
1760
1760
 
1761
1761
  ${chalk.dim("Validation errors:")}`;
1762
- for (const [field, errors] of Object.entries(responseData.errors)) {
1762
+ for (const [field, fieldErrors] of Object.entries(responseData.errors)) {
1763
1763
  message += `
1764
1764
  ${chalk.dim(` ${field}:`)}`;
1765
- for (const error2 of errors) {
1765
+ const errorList = Array.isArray(fieldErrors) ? fieldErrors : [fieldErrors];
1766
+ for (const err of errorList) {
1766
1767
  message += `
1767
- ${chalk.dim(` - ${error2}`)}`;
1768
+ ${chalk.dim(` - ${err}`)}`;
1768
1769
  }
1769
1770
  }
1770
1771
  } else {
@@ -2657,6 +2658,16 @@ async function installStatusLineScript(scriptContent, targetPath = ".claude/stat
2657
2658
  throw new Error(`Failed to install status line script to ${targetPath}: ${errorMessage}`);
2658
2659
  }
2659
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
+ }
2660
2671
  async function copyBraingridReadme(targetPath = ".braingrid/README.md") {
2661
2672
  try {
2662
2673
  const content = await fetchFileFromGitHub("claude-code/README.md");
@@ -3377,14 +3388,28 @@ async function _handleSetup(config2, opts) {
3377
3388
  );
3378
3389
  }
3379
3390
  }
3391
+ let hookInstalled = false;
3392
+ if (config2.name === "Claude Code") {
3393
+ try {
3394
+ const hookContent = await fetchFileFromGitHub("claude-code/hooks/sync-braingrid-task.sh");
3395
+ await installHookScript(hookContent);
3396
+ hookInstalled = true;
3397
+ } catch (error) {
3398
+ console.error(
3399
+ chalk8.yellow("\u26A0\uFE0F Failed to install hook script:"),
3400
+ error instanceof Error ? error.message : String(error)
3401
+ );
3402
+ }
3403
+ }
3380
3404
  await copyBraingridReadme();
3381
3405
  const statusLineMessage = statusLineInstalled ? chalk8.dim(" Status line: .claude/statusline.sh\n") : "";
3406
+ const hookMessage = hookInstalled ? chalk8.dim(" Hook script: .claude/hooks/sync-braingrid-task.sh\n") : "";
3382
3407
  return {
3383
3408
  success: true,
3384
3409
  message: chalk8.green(`\u2705 ${config2.name} integration installed successfully!
3385
3410
 
3386
3411
  `) + chalk8.dim("Files installed:\n") + chalk8.dim(` Commands: ${result.installed} files
3387
- `) + statusLineMessage + chalk8.dim(` Content injected into: ${config2.injection.targetFile}
3412
+ `) + statusLineMessage + hookMessage + chalk8.dim(` Content injected into: ${config2.injection.targetFile}
3388
3413
 
3389
3414
  `) + chalk8.dim("Next steps:\n") + chalk8.dim(" 1. Review the integration files\n") + chalk8.dim(` 2. Open ${config2.name}
3390
3415
  `) + chalk8.dim(" 3. Try the /specify or /breakdown commands\n") + chalk8.dim(" 4. Learn more: ") + chalk8.cyan(config2.docsUrl)