@braingrid/cli 0.2.8 → 0.2.10

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
@@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.10] - 2025-11-25
9
+
10
+ ### Fixed
11
+
12
+ - **Organization ID handling in project initialization**
13
+ - Fixed issue where `organization_id` was set to "default" in `.braingrid/project.json`
14
+ - Login flow now automatically fetches organization ID from validation endpoint when missing from JWT token
15
+ - Init command validates and fixes any existing sessions with "default" organization_id
16
+ - Added clear user feedback with warnings and success messages during organization ID updates
17
+ - Prevents invalid "default" organization IDs from being stored in project configuration
18
+
19
+ ### Changed
20
+
21
+ - **Enhanced breakdown command documentation**
22
+ - Added patience messages to both Claude Code and Cursor breakdown slash commands
23
+ - Commands now explicitly instruct AI agents to wait 1-3 minutes for AI task generation
24
+ - Prevents AI agents from prematurely aborting breakdown operations before completion
25
+ - Improves reliability of AI-powered task breakdown workflow
26
+
27
+ ## [0.2.9] - 2025-11-12
28
+
29
+ ### Fixed
30
+
31
+ - **Documentation URLs updated to docs subdomain**
32
+ - Updated Claude Code documentation URL from `https://braingrid.ai/docs/claude-code` to `https://docs.braingrid.ai/claude-code`
33
+ - Updated Cursor documentation URL from `https://braingrid.ai/docs/cursor` to `https://docs.braingrid.ai/cursor`
34
+ - URLs displayed in setup command success messages now point to correct documentation location
35
+ - Affects `braingrid setup claude-code` and `braingrid setup cursor` output
36
+
8
37
  ## [0.2.8] - 2025-11-12
9
38
 
10
39
  ### Fixed
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.8" : "0.0.0-test";
425
+ var CLI_VERSION = true ? "0.2.10" : "0.0.0-test";
426
426
  var PRODUCTION_CONFIG = {
427
427
  apiUrl: "https://app.braingrid.ai",
428
428
  workosAuthUrl: "https://sensitive-harvest-60.authkit.app",
@@ -1251,12 +1251,45 @@ var BraingridAuth = class {
1251
1251
  externalId: null,
1252
1252
  metadata: jwtPayload.metadata || {}
1253
1253
  };
1254
+ let organizationId = jwtPayload.organization_id;
1255
+ if (!organizationId) {
1256
+ this.logger.warn(
1257
+ "[AUTH] organization_id missing from JWT, fetching from validation endpoint"
1258
+ );
1259
+ try {
1260
+ const tempSession = {
1261
+ user,
1262
+ sealed_session: authResult.accessToken,
1263
+ organization_id: "default",
1264
+ // Temporary placeholder
1265
+ created_at: /* @__PURE__ */ new Date(),
1266
+ updated_at: /* @__PURE__ */ new Date(),
1267
+ login_time: /* @__PURE__ */ new Date(),
1268
+ git_user: gitUser
1269
+ };
1270
+ const validationResult = await this.validateSessionWithServer(tempSession);
1271
+ if (validationResult.isValid && validationResult.user?.metadata?.organizationId) {
1272
+ organizationId = validationResult.user.metadata.organizationId;
1273
+ this.logger.debug(`[AUTH] Fetched organization_id from validation: ${organizationId}`);
1274
+ user.metadata = {
1275
+ ...user.metadata,
1276
+ organizationId: validationResult.user.metadata.organizationId,
1277
+ organizationName: validationResult.user.metadata.organizationName
1278
+ };
1279
+ } else {
1280
+ this.logger.error("[AUTH] Failed to fetch organization_id from validation endpoint");
1281
+ organizationId = "default";
1282
+ }
1283
+ } catch (error) {
1284
+ this.logger.error("[AUTH] Error fetching organization_id from validation:", { error });
1285
+ organizationId = "default";
1286
+ }
1287
+ }
1254
1288
  const session = {
1255
1289
  user,
1256
1290
  sealed_session: authResult.accessToken,
1257
1291
  // Store access token as sealed_session
1258
- organization_id: jwtPayload.organization_id || "default",
1259
- // Use organization from token or default
1292
+ organization_id: organizationId,
1260
1293
  created_at: /* @__PURE__ */ new Date(),
1261
1294
  updated_at: /* @__PURE__ */ new Date(),
1262
1295
  login_time: /* @__PURE__ */ new Date(),
@@ -5766,7 +5799,7 @@ async function handleSetupClaudeCode(opts) {
5766
5799
  sourceFile: "claude-code/CLAUDE.md",
5767
5800
  targetFile: "CLAUDE.md"
5768
5801
  },
5769
- docsUrl: "https://braingrid.ai/docs/claude-code"
5802
+ docsUrl: "https://docs.braingrid.ai/claude-code"
5770
5803
  };
5771
5804
  return _handleSetup(config, opts);
5772
5805
  }
@@ -5779,7 +5812,7 @@ async function handleSetupCursor(opts) {
5779
5812
  sourceFile: "cursor/AGENTS.md",
5780
5813
  targetFile: "AGENTS.md"
5781
5814
  },
5782
- docsUrl: "https://braingrid.ai/docs/cursor"
5815
+ docsUrl: "https://docs.braingrid.ai/cursor"
5783
5816
  };
5784
5817
  return _handleSetup(config, opts);
5785
5818
  }
@@ -6218,6 +6251,25 @@ async function handleInit(opts) {
6218
6251
  message: chalk13.red("\u274C No session found. Please run `braingrid login` first.")
6219
6252
  };
6220
6253
  }
6254
+ if (session.organization_id === "default") {
6255
+ console.log(chalk13.yellow("\u26A0\uFE0F Organization ID not set, validating session...\n"));
6256
+ const isValid = await auth.isAuthenticated();
6257
+ if (!isValid) {
6258
+ return {
6259
+ success: false,
6260
+ message: chalk13.red("\u274C Session validation failed. Please run `braingrid login` again.")
6261
+ };
6262
+ }
6263
+ const updatedSession = await auth.getStoredSession();
6264
+ if (!updatedSession || updatedSession.organization_id === "default") {
6265
+ return {
6266
+ success: false,
6267
+ message: chalk13.red("\u274C Unable to retrieve organization information.\n\n") + chalk13.dim("This may indicate an issue with your account setup.\n") + chalk13.dim("Please contact support or try logging in again with ") + chalk13.cyan("braingrid logout") + chalk13.dim(" and ") + chalk13.cyan("braingrid login")
6268
+ };
6269
+ }
6270
+ Object.assign(session, updatedSession);
6271
+ console.log(chalk13.green("\u2705 Organization ID updated successfully\n"));
6272
+ }
6221
6273
  let gitInfo = await getGitRepositoryInfo();
6222
6274
  let project2;
6223
6275
  if (opts.project) {