reposuite 0.1.0
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/LICENSE +21 -0
- package/README.md +46 -0
- package/RELEASE.md +10 -0
- package/bin/reposuite.js +63 -0
- package/package.json +23 -0
- package/scripts/install.js +282 -0
- package/scripts/smoke-install.js +9 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RepoSuite
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# reposuite
|
|
2
|
+
|
|
3
|
+
Developer toolkit for repo navigation, task automation, and browser control.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g reposuite
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
reposuite --help
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Supported platforms
|
|
18
|
+
|
|
19
|
+
- macOS: amd64, arm64
|
|
20
|
+
- Linux: amd64, arm64
|
|
21
|
+
- Windows: amd64, arm64
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
|
|
25
|
+
RepoSuite downloads platform-specific binaries from GitHub Releases during install.
|
|
26
|
+
To install a specific release, set `REPOSUITE_VERSION` (example: `v1.2.3`).
|
|
27
|
+
|
|
28
|
+
Optional alias (print-only, no auto changes):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
alias rp="reposuite"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Troubleshooting
|
|
35
|
+
|
|
36
|
+
If installation fails with a download error, check that GitHub Releases are reachable from your network and try reinstalling:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm i -g reposuite
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
You can validate the installer flow without downloads:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run smoke:install
|
|
46
|
+
```
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Release checklist
|
|
2
|
+
|
|
3
|
+
1. Tag the private Go repo with the release version.
|
|
4
|
+
2. Confirm binaries are uploaded to GitHub Releases under `vX.Y.Z`.
|
|
5
|
+
3. Bump npm wrapper version in `package.json`.
|
|
6
|
+
4. Run `npm pack` and validate contents.
|
|
7
|
+
5. Run `npm publish`.
|
|
8
|
+
6. Verify with `npm view reposuite` and install test.
|
|
9
|
+
7. Optionally run `npm run smoke:install` to validate installer scaffolding.
|
|
10
|
+
8. If testing a specific release asset, set `REPOSUITE_VERSION=vX.Y.Z` before install.
|
package/bin/reposuite.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { spawn } = require("child_process");
|
|
4
|
+
|
|
5
|
+
function normalizePlatform(platform) {
|
|
6
|
+
if (platform === "darwin") return "darwin";
|
|
7
|
+
if (platform === "linux") return "linux";
|
|
8
|
+
if (platform === "win32") return "windows";
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function normalizeArch(arch) {
|
|
13
|
+
if (arch === "x64") return "amd64";
|
|
14
|
+
if (arch === "arm64") return "arm64";
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const platform = normalizePlatform(process.platform);
|
|
19
|
+
const arch = normalizeArch(process.arch);
|
|
20
|
+
|
|
21
|
+
if (!platform || !arch) {
|
|
22
|
+
console.error(
|
|
23
|
+
`Unsupported platform or architecture: ${process.platform}/${process.arch}`
|
|
24
|
+
);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const exeName = platform === "windows" ? "reposuite.exe" : "reposuite";
|
|
29
|
+
const binPath = path.join(
|
|
30
|
+
__dirname,
|
|
31
|
+
"..",
|
|
32
|
+
".reposuite",
|
|
33
|
+
"bin",
|
|
34
|
+
platform,
|
|
35
|
+
arch,
|
|
36
|
+
exeName
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
require("fs").accessSync(binPath);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error("RepoSuite binary not found.");
|
|
43
|
+
console.error(`Expected path: ${binPath}`);
|
|
44
|
+
console.error(
|
|
45
|
+
"Reinstall the package or run `node scripts/install.js` from this directory."
|
|
46
|
+
);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
51
|
+
|
|
52
|
+
child.on("exit", (code, signal) => {
|
|
53
|
+
if (signal) {
|
|
54
|
+
process.kill(process.pid, signal);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
process.exit(code === null ? 1 : code);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
child.on("error", (error) => {
|
|
61
|
+
console.error(`Failed to start RepoSuite: ${error.message}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "reposuite",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Developer toolkit for repo navigation, task automation, and browser control.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"reposuite": "bin/reposuite.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/install.js",
|
|
11
|
+
"smoke:install": "node scripts/smoke-install.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/",
|
|
15
|
+
"scripts/",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"RELEASE.md"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const os = require("os");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const https = require("https");
|
|
5
|
+
const crypto = require("crypto");
|
|
6
|
+
const { spawnSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
function normalizePlatform(platform) {
|
|
9
|
+
if (platform === "darwin") return "darwin";
|
|
10
|
+
if (platform === "linux") return "linux";
|
|
11
|
+
if (platform === "win32") return "windows";
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function normalizeArch(arch) {
|
|
16
|
+
if (arch === "x64") return "amd64";
|
|
17
|
+
if (arch === "arm64") return "arm64";
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const platform = normalizePlatform(process.platform);
|
|
22
|
+
const arch = normalizeArch(process.arch);
|
|
23
|
+
|
|
24
|
+
if (!platform || !arch) {
|
|
25
|
+
console.error(
|
|
26
|
+
`Unsupported platform or architecture: ${process.platform}/${process.arch}`
|
|
27
|
+
);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const owner = process.env.REPOSUITE_OWNER || "reposuite";
|
|
32
|
+
const repo = process.env.REPOSUITE_REPO || "reposuite";
|
|
33
|
+
|
|
34
|
+
let version = process.env.REPOSUITE_VERSION;
|
|
35
|
+
if (!version) {
|
|
36
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
37
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
38
|
+
version = `v${pkg.version}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const asset =
|
|
42
|
+
platform === "windows"
|
|
43
|
+
? `reposuite_windows_${arch}.zip`
|
|
44
|
+
: `reposuite_${platform}_${arch}.tar.gz`;
|
|
45
|
+
|
|
46
|
+
const url = `https://github.com/${owner}/${repo}/releases/download/${version}/${asset}`;
|
|
47
|
+
const checksumsUrl = `https://github.com/${owner}/${repo}/releases/download/${version}/checksums.txt`;
|
|
48
|
+
const targetDir = path.join(
|
|
49
|
+
__dirname,
|
|
50
|
+
"..",
|
|
51
|
+
".reposuite",
|
|
52
|
+
"bin",
|
|
53
|
+
platform,
|
|
54
|
+
arch
|
|
55
|
+
);
|
|
56
|
+
const exeName = platform === "windows" ? "reposuite.exe" : "reposuite";
|
|
57
|
+
|
|
58
|
+
function downloadToFile(sourceUrl, destPath, redirects = 0) {
|
|
59
|
+
if (redirects > 5) {
|
|
60
|
+
return Promise.reject(new Error("Too many redirects"));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
https
|
|
65
|
+
.get(sourceUrl, (res) => {
|
|
66
|
+
const redirect =
|
|
67
|
+
res.statusCode >= 300 &&
|
|
68
|
+
res.statusCode < 400 &&
|
|
69
|
+
res.headers.location;
|
|
70
|
+
if (redirect) {
|
|
71
|
+
res.resume();
|
|
72
|
+
resolve(downloadToFile(res.headers.location, destPath, redirects + 1));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (res.statusCode !== 200) {
|
|
77
|
+
res.resume();
|
|
78
|
+
reject(
|
|
79
|
+
new Error(`Download failed (${res.statusCode}) from ${sourceUrl}`)
|
|
80
|
+
);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const file = fs.createWriteStream(destPath);
|
|
85
|
+
res.pipe(file);
|
|
86
|
+
file.on("finish", () => file.close(resolve));
|
|
87
|
+
file.on("error", (error) => {
|
|
88
|
+
file.close(() => reject(error));
|
|
89
|
+
});
|
|
90
|
+
})
|
|
91
|
+
.on("error", reject);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function downloadToString(sourceUrl, redirects = 0) {
|
|
96
|
+
if (redirects > 5) {
|
|
97
|
+
return Promise.reject(new Error("Too many redirects"));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
https
|
|
102
|
+
.get(sourceUrl, (res) => {
|
|
103
|
+
const redirect =
|
|
104
|
+
res.statusCode >= 300 &&
|
|
105
|
+
res.statusCode < 400 &&
|
|
106
|
+
res.headers.location;
|
|
107
|
+
if (redirect) {
|
|
108
|
+
res.resume();
|
|
109
|
+
resolve(downloadToString(res.headers.location, redirects + 1));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (res.statusCode === 404) {
|
|
114
|
+
res.resume();
|
|
115
|
+
resolve(null);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (res.statusCode !== 200) {
|
|
120
|
+
res.resume();
|
|
121
|
+
reject(
|
|
122
|
+
new Error(`Download failed (${res.statusCode}) from ${sourceUrl}`)
|
|
123
|
+
);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let data = "";
|
|
128
|
+
res.setEncoding("utf8");
|
|
129
|
+
res.on("data", (chunk) => {
|
|
130
|
+
data += chunk;
|
|
131
|
+
});
|
|
132
|
+
res.on("end", () => resolve(data));
|
|
133
|
+
})
|
|
134
|
+
.on("error", reject);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function sha256File(filePath) {
|
|
139
|
+
return new Promise((resolve, reject) => {
|
|
140
|
+
const hash = crypto.createHash("sha256");
|
|
141
|
+
const stream = fs.createReadStream(filePath);
|
|
142
|
+
stream.on("data", (chunk) => hash.update(chunk));
|
|
143
|
+
stream.on("end", () => resolve(hash.digest("hex")));
|
|
144
|
+
stream.on("error", reject);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function extractArchive(archivePath) {
|
|
149
|
+
if (platform === "windows") {
|
|
150
|
+
const result = spawnSync(
|
|
151
|
+
"powershell.exe",
|
|
152
|
+
[
|
|
153
|
+
"-NoProfile",
|
|
154
|
+
"-Command",
|
|
155
|
+
`Expand-Archive -Path "${archivePath}" -DestinationPath "${targetDir}" -Force`,
|
|
156
|
+
],
|
|
157
|
+
{ stdio: "inherit" }
|
|
158
|
+
);
|
|
159
|
+
if (result.status !== 0) {
|
|
160
|
+
throw new Error("Failed to extract zip archive.");
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const result = spawnSync(
|
|
166
|
+
"tar",
|
|
167
|
+
["-xzf", archivePath, "-C", targetDir],
|
|
168
|
+
{ stdio: "inherit" }
|
|
169
|
+
);
|
|
170
|
+
if (result.status !== 0) {
|
|
171
|
+
throw new Error("Failed to extract tar.gz archive.");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function findFileRecursive(dir, name) {
|
|
176
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
177
|
+
for (const entry of entries) {
|
|
178
|
+
const fullPath = path.join(dir, entry.name);
|
|
179
|
+
if (entry.isFile() && entry.name === name) {
|
|
180
|
+
return fullPath;
|
|
181
|
+
}
|
|
182
|
+
if (entry.isDirectory()) {
|
|
183
|
+
const found = findFileRecursive(fullPath, name);
|
|
184
|
+
if (found) return found;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function verifyChecksum(archivePath) {
|
|
191
|
+
const checksumText = await downloadToString(checksumsUrl);
|
|
192
|
+
if (!checksumText) {
|
|
193
|
+
throw new Error(
|
|
194
|
+
"checksums.txt not found. Expected a file containing lines like: <sha256> <asset>"
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const lines = checksumText
|
|
199
|
+
.split(/\r?\n/)
|
|
200
|
+
.map((value) => value.trim())
|
|
201
|
+
.filter(Boolean);
|
|
202
|
+
|
|
203
|
+
let expected = null;
|
|
204
|
+
for (const line of lines) {
|
|
205
|
+
const parts = line.split(/\s+/);
|
|
206
|
+
if (parts.length < 2) continue;
|
|
207
|
+
const name = parts[1].replace(/^\*/, "");
|
|
208
|
+
if (name === asset) {
|
|
209
|
+
expected = parts[0];
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (!expected) {
|
|
215
|
+
throw new Error(
|
|
216
|
+
`Checksum entry not found. Expected a line like: <sha256> *${asset}`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
const actual = await sha256File(archivePath);
|
|
220
|
+
if (expected !== actual) {
|
|
221
|
+
throw new Error("Checksum validation failed.");
|
|
222
|
+
}
|
|
223
|
+
console.log("Checksum validated.");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function main() {
|
|
227
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
228
|
+
|
|
229
|
+
console.log(`Platform: ${platform}`);
|
|
230
|
+
console.log(`Architecture: ${arch}`);
|
|
231
|
+
console.log(`Asset: ${asset}`);
|
|
232
|
+
console.log(`URL: ${url}`);
|
|
233
|
+
console.log(`Target directory: ${targetDir}`);
|
|
234
|
+
|
|
235
|
+
if (version === "v0.0.0") {
|
|
236
|
+
console.log(
|
|
237
|
+
"Version is v0.0.0; skipping download. Set REPOSUITE_VERSION to install a release."
|
|
238
|
+
);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "reposuite-"));
|
|
243
|
+
const archivePath = path.join(tempDir, asset);
|
|
244
|
+
|
|
245
|
+
try {
|
|
246
|
+
console.log("Downloading release asset...");
|
|
247
|
+
await downloadToFile(url, archivePath);
|
|
248
|
+
await verifyChecksum(archivePath);
|
|
249
|
+
console.log("Extracting archive...");
|
|
250
|
+
extractArchive(archivePath);
|
|
251
|
+
|
|
252
|
+
const desiredPath = path.join(targetDir, exeName);
|
|
253
|
+
let binPath = fs.existsSync(desiredPath)
|
|
254
|
+
? desiredPath
|
|
255
|
+
: findFileRecursive(targetDir, exeName);
|
|
256
|
+
|
|
257
|
+
if (!binPath) {
|
|
258
|
+
throw new Error("RepoSuite binary not found after extraction.");
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (binPath !== desiredPath) {
|
|
262
|
+
fs.copyFileSync(binPath, desiredPath);
|
|
263
|
+
if (binPath !== desiredPath) {
|
|
264
|
+
fs.unlinkSync(binPath);
|
|
265
|
+
}
|
|
266
|
+
binPath = desiredPath;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (platform !== "windows") {
|
|
270
|
+
fs.chmodSync(binPath, 0o755);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
console.log(`Installed binary: ${binPath}`);
|
|
274
|
+
} finally {
|
|
275
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
main().catch((error) => {
|
|
280
|
+
console.error(`Install failed: ${error.message}`);
|
|
281
|
+
process.exit(1);
|
|
282
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const { spawnSync } = require("child_process");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const result = spawnSync("node", [path.join(__dirname, "install.js")], {
|
|
5
|
+
stdio: "inherit",
|
|
6
|
+
env: { ...process.env, REPOSUITE_VERSION: "v0.0.0" },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
process.exit(result.status === null ? 1 : result.status);
|