@braingrid/cli 0.2.21 → 0.2.23

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,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.23] - 2025-12-18
11
+
12
+ ### Added
13
+
14
+ - **Automatic README.md installation**
15
+ - Copies `.braingrid/README.md` documentation during `init`, `update`, and `setup` commands
16
+ - Ensures users always have the latest BrainGrid integration documentation
17
+ - Fails silently if GitHub is unreachable (non-blocking operation)
18
+
19
+ ## [0.2.22] - 2025-12-18
20
+
21
+ ### Added
22
+
23
+ - **Task commands documentation**
24
+ - Added `braingrid task` command examples to CLAUDE.md and AGENTS.md
25
+ - Documents `task list`, `task show`, and `task update` usage
26
+
27
+ ### Changed
28
+
29
+ - **IDE integration update prompts**
30
+ - Now prompts for IDE integration updates even when CLI is already up to date
31
+ - Ensures users can update BrainGrid integration files independently of CLI version
32
+
33
+ - **Token efficiency optimizations**
34
+ - Optimized AGENTS.md and CLAUDE.md for reduced token usage
35
+ - Moved README.md from `.claude/` to `.braingrid/` for better organization
36
+
37
+ ### Fixed
38
+
39
+ - **Duplicate BRAINGRID INTEGRATION markers**
40
+ - Fixed issue where setup could add duplicate integration markers to CLAUDE.md
41
+ - Content injection now properly checks for existing markers before adding
42
+
43
+ - **Flaky test in cli-tools**
44
+ - Fixed parallel timing assertion test that was too strict (50ms → 100ms threshold)
45
+ - Prevents intermittent test failures in CI environments
46
+
10
47
  ## [0.2.21] - 2025-12-18
11
48
 
12
49
  ### Fixed
package/README.md CHANGED
@@ -47,7 +47,7 @@ braingrid setup claude-code
47
47
 
48
48
  Installs slash commands (`/specify`, `/breakdown`, `/build`), BrainGrid skill, and status line showing your project/requirement/task context in real-time.
49
49
 
50
- [→ Full Claude Code setup guide](./.claude/README.md)
50
+ [→ Full Claude Code setup guide](./.braingrid/README.md)
51
51
 
52
52
  ### Cursor
53
53
 
@@ -115,7 +115,7 @@ The `init` command creates a `.braingrid/project.json` file in the `.braingrid/`
115
115
 
116
116
  Install BrainGrid integration files for AI coding tools. These commands fetch integration files from the [BrainGrid repository](https://github.com/BrainGridAI/braingrid) and install them in your project.
117
117
 
118
- For detailed usage guides, see [Claude Code setup](./.claude/README.md) or [Cursor setup](./.cursor/README.md).
118
+ For detailed usage guides, see [Claude Code setup](./.braingrid/README.md) or [Cursor setup](./.cursor/README.md).
119
119
 
120
120
  **Prerequisites:**
121
121
 
package/dist/cli.js CHANGED
@@ -422,7 +422,7 @@ import axios3, { AxiosError as AxiosError2 } from "axios";
422
422
 
423
423
  // src/build-config.ts
424
424
  var BUILD_ENV = true ? "production" : process.env.NODE_ENV === "test" ? "development" : "production";
425
- var CLI_VERSION = true ? "0.2.21" : "0.0.0-test";
425
+ var CLI_VERSION = true ? "0.2.23" : "0.0.0-test";
426
426
  var PRODUCTION_CONFIG = {
427
427
  apiUrl: "https://app.braingrid.ai",
428
428
  workosAuthUrl: "https://auth.braingrid.ai",
@@ -5803,6 +5803,14 @@ async function injectContentIntoFile(targetPath, content) {
5803
5803
  } catch {
5804
5804
  fileContent = "";
5805
5805
  }
5806
+ let cleanContent = content;
5807
+ if (content.includes(BEGIN_MARKER)) {
5808
+ const beginIdx = content.indexOf(BEGIN_MARKER);
5809
+ const endIdx = content.indexOf(END_MARKER);
5810
+ if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
5811
+ cleanContent = content.substring(beginIdx + BEGIN_MARKER.length, endIdx).trim();
5812
+ }
5813
+ }
5806
5814
  if (fileExists3) {
5807
5815
  const beginIndex = fileContent.indexOf(BEGIN_MARKER);
5808
5816
  const endIndex = fileContent.indexOf(END_MARKER);
@@ -5810,14 +5818,14 @@ async function injectContentIntoFile(targetPath, content) {
5810
5818
  const before = fileContent.substring(0, beginIndex);
5811
5819
  const after = fileContent.substring(endIndex + END_MARKER.length);
5812
5820
  const newContent = `${before}${BEGIN_MARKER}
5813
- ${content}
5821
+ ${cleanContent}
5814
5822
  ${END_MARKER}${after}`;
5815
5823
  await fs3.writeFile(targetPath, newContent, { encoding: "utf8" });
5816
5824
  } else {
5817
5825
  const newContent = `${fileContent}
5818
5826
 
5819
5827
  ${BEGIN_MARKER}
5820
- ${content}
5828
+ ${cleanContent}
5821
5829
  ${END_MARKER}
5822
5830
  `;
5823
5831
  await fs3.writeFile(targetPath, newContent, { encoding: "utf8" });
@@ -5826,7 +5834,7 @@ ${END_MARKER}
5826
5834
  const parentDir = path3.dirname(targetPath);
5827
5835
  await fs3.mkdir(parentDir, { recursive: true });
5828
5836
  const newContent = `${BEGIN_MARKER}
5829
- ${content}
5837
+ ${cleanContent}
5830
5838
  ${END_MARKER}
5831
5839
  `;
5832
5840
  await fs3.writeFile(targetPath, newContent, { encoding: "utf8", mode: 420 });
@@ -5846,6 +5854,17 @@ async function installStatusLineScript(scriptContent, targetPath = ".claude/stat
5846
5854
  throw new Error(`Failed to install status line script to ${targetPath}: ${errorMessage}`);
5847
5855
  }
5848
5856
  }
5857
+ async function copyBraingridReadme(targetPath = ".braingrid/README.md") {
5858
+ try {
5859
+ const content = await fetchFileFromGitHub("claude-code/README.md");
5860
+ const parentDir = path3.dirname(targetPath);
5861
+ await fs3.mkdir(parentDir, { recursive: true });
5862
+ await fs3.writeFile(targetPath, content, { encoding: "utf8", mode: 420 });
5863
+ return true;
5864
+ } catch {
5865
+ return false;
5866
+ }
5867
+ }
5849
5868
  async function updateClaudeSettings(settingsPath = ".claude/settings.json", scriptPath = ".claude/statusline.sh") {
5850
5869
  try {
5851
5870
  let settings = {};
@@ -6048,6 +6067,7 @@ async function _handleSetup(config, opts) {
6048
6067
  );
6049
6068
  }
6050
6069
  }
6070
+ await copyBraingridReadme();
6051
6071
  const statusLineMessage = statusLineInstalled ? chalk12.dim(" Status line: .claude/statusline.sh\n") : "";
6052
6072
  return {
6053
6073
  success: true,
@@ -6095,6 +6115,33 @@ async function handleSetupCursor(opts) {
6095
6115
  }
6096
6116
 
6097
6117
  // src/handlers/update.handlers.ts
6118
+ async function promptForIdeUpdates() {
6119
+ const cliTools = await checkInstalledCliTools();
6120
+ const claudeInstalled = cliTools.find((t) => t.command === "claude")?.installed;
6121
+ const cursorInstalled = cliTools.find((t) => t.command === "cursor")?.installed;
6122
+ let setupOutput = "";
6123
+ if (claudeInstalled) {
6124
+ const shouldUpdate = await confirm({
6125
+ message: "Claude Code detected. Update BrainGrid integration?",
6126
+ default: true
6127
+ });
6128
+ if (shouldUpdate) {
6129
+ const result = await handleSetupClaudeCode({ force: true });
6130
+ setupOutput += "\n" + result.message;
6131
+ }
6132
+ }
6133
+ if (cursorInstalled) {
6134
+ const shouldUpdate = await confirm({
6135
+ message: "Cursor detected. Update BrainGrid integration?",
6136
+ default: true
6137
+ });
6138
+ if (shouldUpdate) {
6139
+ const result = await handleSetupCursor({ force: true });
6140
+ setupOutput += "\n" + result.message;
6141
+ }
6142
+ }
6143
+ return setupOutput;
6144
+ }
6098
6145
  async function handleUpdate(opts) {
6099
6146
  try {
6100
6147
  const currentVersion = getCurrentVersion();
@@ -6109,9 +6156,12 @@ async function handleUpdate(opts) {
6109
6156
  const comparison = compareVersions(currentVersion, latestVersion);
6110
6157
  if (comparison === 0) {
6111
6158
  output += chalk13.green("\u2705 You are already on the latest version!\n");
6159
+ console.log(output);
6160
+ await copyBraingridReadme();
6161
+ const setupOutput2 = await promptForIdeUpdates();
6112
6162
  return {
6113
6163
  success: true,
6114
- message: output,
6164
+ message: output + setupOutput2,
6115
6165
  data: { currentVersion, latestVersion, upToDate: true }
6116
6166
  };
6117
6167
  }
@@ -6144,30 +6194,8 @@ async function handleUpdate(opts) {
6144
6194
  output += chalk13.dim("Running: ") + chalk13.cyan(updateCommand) + "\n\n";
6145
6195
  console.log(output);
6146
6196
  executeUpdate(packageManager, PACKAGE_NAME);
6147
- const cliTools = await checkInstalledCliTools();
6148
- const claudeInstalled = cliTools.find((t) => t.command === "claude")?.installed;
6149
- const cursorInstalled = cliTools.find((t) => t.command === "cursor")?.installed;
6150
- let setupOutput = "";
6151
- if (claudeInstalled) {
6152
- const shouldUpdate = await confirm({
6153
- message: "Claude Code detected. Update BrainGrid integration?",
6154
- default: true
6155
- });
6156
- if (shouldUpdate) {
6157
- const result = await handleSetupClaudeCode({ force: true });
6158
- setupOutput += "\n" + result.message;
6159
- }
6160
- }
6161
- if (cursorInstalled) {
6162
- const shouldUpdate = await confirm({
6163
- message: "Cursor detected. Update BrainGrid integration?",
6164
- default: true
6165
- });
6166
- if (shouldUpdate) {
6167
- const result = await handleSetupCursor({ force: true });
6168
- setupOutput += "\n" + result.message;
6169
- }
6170
- }
6197
+ await copyBraingridReadme();
6198
+ const setupOutput = await promptForIdeUpdates();
6171
6199
  return {
6172
6200
  success: true,
6173
6201
  message: chalk13.green("\n\u2705 Successfully updated BrainGrid CLI!\n") + setupOutput,
@@ -6846,6 +6874,7 @@ async function handleInit(opts) {
6846
6874
  created_at: project2.created_at
6847
6875
  };
6848
6876
  await saveProjectConfig(localConfig);
6877
+ await copyBraingridReadme();
6849
6878
  console.log(
6850
6879
  chalk15.green("\u2705 Repository initialized successfully!\n\n") + chalk15.dim("Project: ") + chalk15.cyan(project2.name) + chalk15.dim(` (${project2.short_id})`) + "\n" + chalk15.dim("Config: ") + chalk15.gray(".braingrid/project.json") + "\n"
6851
6880
  );