@braingrid/cli 0.2.48 → 0.2.50

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,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.50] - 2026-02-23
11
+
12
+ ### Fixed
13
+
14
+ - **Setup GitHub auth** — fall back to unauthenticated requests when `gh auth` token is expired, instead of failing every API call with 401
15
+
16
+ ## [0.2.49] - 2026-02-23
17
+
18
+ ### Added
19
+
20
+ - **Build command** — save requirement content to temp file for context persistence across build sessions
21
+
22
+ ### Fixed
23
+
24
+ - **Setup hooks** — distribute `log-helper.sh` utility script alongside hook scripts so hooks don't fail with "No such file or directory"
25
+
10
26
  ## [0.2.48] - 2026-02-23
11
27
 
12
28
  ### Added
package/dist/cli.js CHANGED
@@ -228,7 +228,7 @@ async function axiosWithRetry(config2, options) {
228
228
 
229
229
  // src/build-config.ts
230
230
  var BUILD_ENV = true ? "production" : process.env.NODE_ENV === "test" ? "development" : "production";
231
- var CLI_VERSION = true ? "0.2.48" : "0.0.0-test";
231
+ var CLI_VERSION = true ? "0.2.50" : "0.0.0-test";
232
232
  var PRODUCTION_CONFIG = {
233
233
  apiUrl: "https://app.braingrid.ai",
234
234
  workosAuthUrl: "https://auth.braingrid.ai",
@@ -2658,6 +2658,18 @@ async function getGitHubHeaders() {
2658
2658
  cachedHeaders = headers;
2659
2659
  return headers;
2660
2660
  }
2661
+ async function githubGet(url) {
2662
+ const headers = await getGitHubHeaders();
2663
+ try {
2664
+ return await axios5.get(url, { headers });
2665
+ } catch (error) {
2666
+ if (axios5.isAxiosError(error) && error.response?.status === 401 && cachedHeaders?.Authorization) {
2667
+ delete cachedHeaders.Authorization;
2668
+ return axios5.get(url, { headers: cachedHeaders });
2669
+ }
2670
+ throw error;
2671
+ }
2672
+ }
2661
2673
  var BEGIN_MARKER = "<!-- BEGIN BRAINGRID INTEGRATION -->";
2662
2674
  var END_MARKER = "<!-- END BRAINGRID INTEGRATION -->";
2663
2675
  async function withRetry(fn, retries = MAX_RETRIES, delay = INITIAL_RETRY_DELAY) {
@@ -2701,10 +2713,8 @@ function parseGitHubError(error) {
2701
2713
  async function fetchFileFromGitHub(filePath) {
2702
2714
  return withRetry(async () => {
2703
2715
  try {
2704
- const headers = await getGitHubHeaders();
2705
- const { data: response } = await axios5.get(
2706
- `${GITHUB_API_BASE}/${filePath}`,
2707
- { headers }
2716
+ const { data: response } = await githubGet(
2717
+ `${GITHUB_API_BASE}/${filePath}`
2708
2718
  );
2709
2719
  if (response.type !== "file") {
2710
2720
  throw new Error(`Path ${filePath} is not a file`);
@@ -2732,10 +2742,8 @@ async function fetchFileFromGitHub(filePath) {
2732
2742
  async function listGitHubDirectory(dirPath) {
2733
2743
  return withRetry(async () => {
2734
2744
  try {
2735
- const headers = await getGitHubHeaders();
2736
- const { data: response } = await axios5.get(
2737
- `${GITHUB_API_BASE}/${dirPath}`,
2738
- { headers }
2745
+ const { data: response } = await githubGet(
2746
+ `${GITHUB_API_BASE}/${dirPath}`
2739
2747
  );
2740
2748
  if (!Array.isArray(response)) {
2741
2749
  throw new Error(`Path ${dirPath} is not a directory`);
@@ -2897,6 +2905,7 @@ var HOOK_REGISTRY = [
2897
2905
  commands: [{ script: "task-completed-validate.sh" }]
2898
2906
  }
2899
2907
  ];
2908
+ var HOOK_UTILITY_SCRIPTS = ["log-helper.sh"];
2900
2909
  function buildHookCommand(cmd) {
2901
2910
  const result = {
2902
2911
  type: "command",
@@ -3725,7 +3734,12 @@ async function handleSetupClaudeCode(opts) {
3725
3734
  error instanceof Error ? error.message : String(error)
3726
3735
  );
3727
3736
  }
3728
- const allScripts = HOOK_REGISTRY.flatMap((e) => e.commands.map((c) => c.script));
3737
+ const allScripts = [
3738
+ .../* @__PURE__ */ new Set([
3739
+ ...HOOK_REGISTRY.flatMap((e) => e.commands.map((c) => c.script)),
3740
+ ...HOOK_UTILITY_SCRIPTS
3741
+ ])
3742
+ ];
3729
3743
  const installedHooks = [];
3730
3744
  for (const script of allScripts) {
3731
3745
  try {