chainlesschain 0.37.6 → 0.37.7
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/package.json +2 -2
- package/src/constants.js +1 -1
- package/src/lib/downloader.js +27 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chainlesschain",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.7",
|
|
4
4
|
"description": "CLI for ChainlessChain - install, configure, and manage your personal AI management system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/chainlesschain/chainlesschain.git",
|
|
40
40
|
"directory": "packages/cli"
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://www.chainlesschain.com",
|
package/src/constants.js
CHANGED
|
@@ -9,7 +9,7 @@ const pkg = require(join(__dirname, "..", "package.json"));
|
|
|
9
9
|
|
|
10
10
|
export const VERSION = pkg.version;
|
|
11
11
|
|
|
12
|
-
export const GITHUB_OWNER = "
|
|
12
|
+
export const GITHUB_OWNER = "chainlesschain";
|
|
13
13
|
export const GITHUB_REPO = "chainlesschain";
|
|
14
14
|
export const GITHUB_API_BASE = `https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPO}`;
|
|
15
15
|
export const GITHUB_RELEASES_URL = `${GITHUB_API_BASE}/releases`;
|
package/src/lib/downloader.js
CHANGED
|
@@ -89,28 +89,44 @@ export async function downloadRelease(version, options = {}) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
async function resolveAssetUrl(version, binaryName) {
|
|
92
|
+
// Try exact version first, then fall back to latest release
|
|
92
93
|
const tagName = `v${version}`;
|
|
93
|
-
|
|
94
|
+
let release = await fetchRelease(`${GITHUB_RELEASES_URL}/tags/${tagName}`);
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
if (!release) {
|
|
97
|
+
logger.info(`Release ${tagName} not found, fetching latest release...`);
|
|
98
|
+
release = await fetchRelease(`${GITHUB_RELEASES_URL}/latest`);
|
|
99
|
+
}
|
|
98
100
|
|
|
99
|
-
if (!
|
|
100
|
-
throw new Error(
|
|
101
|
-
`Failed to find release ${tagName}: HTTP ${response.status}`,
|
|
102
|
-
);
|
|
101
|
+
if (!release) {
|
|
102
|
+
throw new Error(`No releases found for ${GITHUB_RELEASES_URL}`);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
const
|
|
105
|
+
// Re-resolve binary name with the actual release version
|
|
106
|
+
const actualVersion = release.tag_name.replace(/^v/, "");
|
|
107
|
+
const actualBinaryName = binaryName.replace(version, actualVersion);
|
|
108
|
+
|
|
109
|
+
const asset =
|
|
110
|
+
release.assets.find((a) => a.name === actualBinaryName) ||
|
|
111
|
+
release.assets.find((a) => a.name === binaryName);
|
|
107
112
|
if (!asset) {
|
|
108
|
-
|
|
113
|
+
const available = release.assets.map((a) => a.name).join(", ");
|
|
114
|
+
throw new Error(
|
|
115
|
+
`No matching asset in release ${release.tag_name}. Available: ${available}`,
|
|
116
|
+
);
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
return asset.browser_download_url;
|
|
112
120
|
}
|
|
113
121
|
|
|
122
|
+
async function fetchRelease(url) {
|
|
123
|
+
const response = await fetch(url, {
|
|
124
|
+
headers: { Accept: "application/vnd.github.v3+json" },
|
|
125
|
+
});
|
|
126
|
+
if (!response.ok) return null;
|
|
127
|
+
return response.json();
|
|
128
|
+
}
|
|
129
|
+
|
|
114
130
|
function formatBytes(bytes) {
|
|
115
131
|
if (bytes < 1024) return `${bytes}B`;
|
|
116
132
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
|