goldy-cli 1.3.1 → 1.3.2

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/install.js CHANGED
@@ -89,6 +89,13 @@ async function main() {
89
89
  const archiveName = `${BIN_NAME}_${goos}_${goarch}.${ext}`;
90
90
  const url = `https://github.com/${REPO}/releases/download/v${version}/${archiveName}`;
91
91
 
92
+ fs.mkdirSync(BIN_DIR, { recursive: true });
93
+ const destBin = path.join(BIN_DIR, `${BIN_NAME}${binSuffix}`);
94
+
95
+ // Check if bundled binary already exists and works for this platform
96
+ const bundledBin = path.join(BIN_DIR, BIN_NAME);
97
+ const hasBundledBin = fs.existsSync(bundledBin);
98
+
92
99
  console.log(`Downloading goldy v${version} for ${goos}/${goarch}...`);
93
100
 
94
101
  try {
@@ -101,10 +108,7 @@ async function main() {
101
108
  await extractTarGz(buffer, tmpDir);
102
109
  }
103
110
 
104
- fs.mkdirSync(BIN_DIR, { recursive: true });
105
-
106
111
  const srcBin = path.join(tmpDir, `${BIN_NAME}${binSuffix}`);
107
- const destBin = path.join(BIN_DIR, `${BIN_NAME}${binSuffix}`);
108
112
 
109
113
  fs.copyFileSync(srcBin, destBin);
110
114
  if (!isWindows) {
@@ -115,12 +119,43 @@ async function main() {
115
119
 
116
120
  console.log(`Installed goldy to ${destBin}`);
117
121
  } catch (err) {
118
- console.error(`Failed to download goldy: ${err.message}`);
119
- console.error(`URL: ${url}`);
120
- console.error("");
121
- console.error("You can install manually:");
122
- console.error(" cd ~/.goldy/cmd/goldy-install && go install .");
123
- process.exit(1);
122
+ // If download fails, try falling back to the latest available release
123
+ console.warn(`Release v${version} not found, trying latest release...`);
124
+ try {
125
+ const latestUrl = `https://github.com/${REPO}/releases/latest/download/${archiveName}`;
126
+ const buffer = await downloadFile(latestUrl);
127
+ const tmpDir = path.join(os.tmpdir(), `goldy-extract-${Date.now()}`);
128
+
129
+ if (isWindows) {
130
+ await extractZip(buffer, tmpDir);
131
+ } else {
132
+ await extractTarGz(buffer, tmpDir);
133
+ }
134
+
135
+ const srcBin = path.join(tmpDir, `${BIN_NAME}${binSuffix}`);
136
+
137
+ fs.copyFileSync(srcBin, destBin);
138
+ if (!isWindows) {
139
+ fs.chmodSync(destBin, 0o755);
140
+ }
141
+
142
+ fs.rmSync(tmpDir, { recursive: true, force: true });
143
+
144
+ console.log(`Installed goldy (latest release) to ${destBin}`);
145
+ } catch (fallbackErr) {
146
+ if (hasBundledBin) {
147
+ console.warn(`Download failed, using bundled binary.`);
148
+ fs.chmodSync(bundledBin, 0o755);
149
+ console.log(`Using bundled goldy at ${bundledBin}`);
150
+ } else {
151
+ console.error(`Failed to download goldy: ${err.message}`);
152
+ console.error(`URL: ${url}`);
153
+ console.error("");
154
+ console.error("You can install manually:");
155
+ console.error(" curl -fsSL https://raw.githubusercontent.com/SacredTexts/goldy/main/install.sh | bash");
156
+ process.exit(1);
157
+ }
158
+ }
124
159
  }
125
160
  }
126
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goldy-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "GOLDY toolkit for Claude Code",
5
5
  "bin": {
6
6
  "goldy": "bin/goldy"