@braingrid/cli 0.2.49 → 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 +6 -0
- package/dist/cli.js +17 -9
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ 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
|
+
|
|
10
16
|
## [0.2.49] - 2026-02-23
|
|
11
17
|
|
|
12
18
|
### 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.
|
|
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
|
|
2705
|
-
|
|
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
|
|
2736
|
-
|
|
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`);
|