@opencodehub/cli 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 +202 -0
- package/README.md +85 -0
- package/dist/agent-context.d.ts +54 -0
- package/dist/agent-context.d.ts.map +1 -0
- package/dist/agent-context.js +122 -0
- package/dist/agent-context.js.map +1 -0
- package/dist/cobol-proleap-setup.d.ts +77 -0
- package/dist/cobol-proleap-setup.d.ts.map +1 -0
- package/dist/cobol-proleap-setup.js +289 -0
- package/dist/cobol-proleap-setup.js.map +1 -0
- package/dist/commands/analyze.d.ts +234 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +1096 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/augment.d.ts +48 -0
- package/dist/commands/augment.d.ts.map +1 -0
- package/dist/commands/augment.js +249 -0
- package/dist/commands/augment.js.map +1 -0
- package/dist/commands/baseline.d.ts +68 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +110 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/bench.d.ts +54 -0
- package/dist/commands/bench.d.ts.map +1 -0
- package/dist/commands/bench.js +283 -0
- package/dist/commands/bench.js.map +1 -0
- package/dist/commands/ci-init.d.ts +37 -0
- package/dist/commands/ci-init.d.ts.map +1 -0
- package/dist/commands/ci-init.js +115 -0
- package/dist/commands/ci-init.js.map +1 -0
- package/dist/commands/clean.d.ts +13 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +38 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/code-pack.d.ts +105 -0
- package/dist/commands/code-pack.d.ts.map +1 -0
- package/dist/commands/code-pack.js +187 -0
- package/dist/commands/code-pack.js.map +1 -0
- package/dist/commands/context.d.ts +30 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +237 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/detect-changes.d.ts +26 -0
- package/dist/commands/detect-changes.d.ts.map +1 -0
- package/dist/commands/detect-changes.js +73 -0
- package/dist/commands/detect-changes.js.map +1 -0
- package/dist/commands/doctor.d.ts +52 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +472 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/find-enclosing-symbol.d.ts +67 -0
- package/dist/commands/find-enclosing-symbol.d.ts.map +1 -0
- package/dist/commands/find-enclosing-symbol.js +106 -0
- package/dist/commands/find-enclosing-symbol.js.map +1 -0
- package/dist/commands/group.d.ts +123 -0
- package/dist/commands/group.d.ts.map +1 -0
- package/dist/commands/group.js +448 -0
- package/dist/commands/group.js.map +1 -0
- package/dist/commands/impact.d.ts +23 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +91 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/index-repo.d.ts +39 -0
- package/dist/commands/index-repo.d.ts.map +1 -0
- package/dist/commands/index-repo.js +148 -0
- package/dist/commands/index-repo.js.map +1 -0
- package/dist/commands/ingest-sarif.d.ts +64 -0
- package/dist/commands/ingest-sarif.d.ts.map +1 -0
- package/dist/commands/ingest-sarif.js +381 -0
- package/dist/commands/ingest-sarif.js.map +1 -0
- package/dist/commands/init.d.ts +75 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +315 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +17 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +79 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/mcp.d.ts +8 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +28 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/open-store.d.ts +25 -0
- package/dist/commands/open-store.d.ts.map +1 -0
- package/dist/commands/open-store.js +47 -0
- package/dist/commands/open-store.js.map +1 -0
- package/dist/commands/pack.d.ts +35 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +83 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/query.d.ts +85 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +309 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/scan.d.ts +81 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +407 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/setup.d.ts +178 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +370 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/sql.d.ts +19 -0
- package/dist/commands/sql.d.ts.map +1 -0
- package/dist/commands/sql.js +51 -0
- package/dist/commands/sql.js.map +1 -0
- package/dist/commands/status.d.ts +13 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +66 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/verdict-render.d.ts +33 -0
- package/dist/commands/verdict-render.d.ts.map +1 -0
- package/dist/commands/verdict-render.js +123 -0
- package/dist/commands/verdict-render.js.map +1 -0
- package/dist/commands/verdict.d.ts +61 -0
- package/dist/commands/verdict.d.ts.map +1 -0
- package/dist/commands/verdict.js +146 -0
- package/dist/commands/verdict.js.map +1 -0
- package/dist/commands/wiki.d.ts +26 -0
- package/dist/commands/wiki.d.ts.map +1 -0
- package/dist/commands/wiki.js +74 -0
- package/dist/commands/wiki.js.map +1 -0
- package/dist/editors/claude-code.d.ts +23 -0
- package/dist/editors/claude-code.d.ts.map +1 -0
- package/dist/editors/claude-code.js +58 -0
- package/dist/editors/claude-code.js.map +1 -0
- package/dist/editors/codex.d.ts +22 -0
- package/dist/editors/codex.d.ts.map +1 -0
- package/dist/editors/codex.js +59 -0
- package/dist/editors/codex.js.map +1 -0
- package/dist/editors/cursor.d.ts +13 -0
- package/dist/editors/cursor.d.ts.map +1 -0
- package/dist/editors/cursor.js +21 -0
- package/dist/editors/cursor.js.map +1 -0
- package/dist/editors/index.d.ts +12 -0
- package/dist/editors/index.d.ts.map +1 -0
- package/dist/editors/index.js +11 -0
- package/dist/editors/index.js.map +1 -0
- package/dist/editors/opencode.d.ts +23 -0
- package/dist/editors/opencode.d.ts.map +1 -0
- package/dist/editors/opencode.js +61 -0
- package/dist/editors/opencode.js.map +1 -0
- package/dist/editors/types.d.ts +33 -0
- package/dist/editors/types.d.ts.map +1 -0
- package/dist/editors/types.js +19 -0
- package/dist/editors/types.js.map +1 -0
- package/dist/editors/windows-wrap.d.ts +19 -0
- package/dist/editors/windows-wrap.d.ts.map +1 -0
- package/dist/editors/windows-wrap.js +28 -0
- package/dist/editors/windows-wrap.js.map +1 -0
- package/dist/editors/windsurf.d.ts +12 -0
- package/dist/editors/windsurf.d.ts.map +1 -0
- package/dist/editors/windsurf.js +21 -0
- package/dist/editors/windsurf.js.map +1 -0
- package/dist/embedder-downloader.d.ts +87 -0
- package/dist/embedder-downloader.d.ts.map +1 -0
- package/dist/embedder-downloader.js +261 -0
- package/dist/embedder-downloader.js.map +1 -0
- package/dist/fs-atomic.d.ts +22 -0
- package/dist/fs-atomic.d.ts.map +1 -0
- package/dist/fs-atomic.js +28 -0
- package/dist/fs-atomic.js.map +1 -0
- package/dist/groups.d.ts +64 -0
- package/dist/groups.d.ts.map +1 -0
- package/dist/groups.js +172 -0
- package/dist/groups.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +703 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/is-indexed.d.ts +20 -0
- package/dist/lib/is-indexed.d.ts.map +1 -0
- package/dist/lib/is-indexed.js +35 -0
- package/dist/lib/is-indexed.js.map +1 -0
- package/dist/registry.d.ts +64 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +145 -0
- package/dist/registry.js.map +1 -0
- package/dist/scip-downloader.d.ts +138 -0
- package/dist/scip-downloader.d.ts.map +1 -0
- package/dist/scip-downloader.js +372 -0
- package/dist/scip-downloader.js.map +1 -0
- package/dist/scip-pins.d.ts +99 -0
- package/dist/scip-pins.d.ts.map +1 -0
- package/dist/scip-pins.js +195 -0
- package/dist/scip-pins.js.map +1 -0
- package/dist/skills-gen.d.ts +47 -0
- package/dist/skills-gen.d.ts.map +1 -0
- package/dist/skills-gen.js +292 -0
- package/dist/skills-gen.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHA256-pinned downloader for external SCIP adapter binaries.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the shape of `embedder-downloader.ts` but is scoped per-tool rather
|
|
5
|
+
* than per-variant. Each call installs one tool into `~/.codehub/bin/`:
|
|
6
|
+
*
|
|
7
|
+
* 1. Detect the running platform (`process.platform` + `process.arch`).
|
|
8
|
+
* Unsupported combinations throw a clear "unsupported platform" error.
|
|
9
|
+
* 2. Resolve the per-platform pin from `SCIP_PINS`.
|
|
10
|
+
* 3. If the target path already exists and its SHA256 matches the pin, skip.
|
|
11
|
+
* 4. Otherwise stream-download to `<target>.tmp`, hash during write, verify,
|
|
12
|
+
* `chmod +x`, and atomic-rename into place.
|
|
13
|
+
*
|
|
14
|
+
* `scip-dotnet` is a special case: upstream does NOT ship a self-contained
|
|
15
|
+
* binary — it is installed via `dotnet tool install --global scip-dotnet` and
|
|
16
|
+
* needs .NET SDK 8+. The downloader probes `dotnet --version` first; if the
|
|
17
|
+
* SDK is missing or too old, it surfaces the specific install hint instead of
|
|
18
|
+
* attempting a binary download.
|
|
19
|
+
*
|
|
20
|
+
* Concurrency: concurrent calls for the same tool on the same process are
|
|
21
|
+
* serialized via an in-memory promise map keyed by `(tool, destDir)`. This
|
|
22
|
+
* avoids two parallel `installScipTool("clang")` invocations each writing the
|
|
23
|
+
* same `<target>.tmp` and corrupting each other's output. Cross-process
|
|
24
|
+
* concurrent setup is out of scope — the atomic-rename still means no half-
|
|
25
|
+
* written binary ever appears at the final path.
|
|
26
|
+
*
|
|
27
|
+
* Placeholder SHA256 handling: some pins ship with all-zero placeholder
|
|
28
|
+
* hashes in `scip-pins.ts`. We refuse to verify against placeholder hashes
|
|
29
|
+
* at runtime. Each adapter's first-install smoke test passes
|
|
30
|
+
* `allowPlaceholder: true` so it can compute the real hash and substitute
|
|
31
|
+
* it back into the pin file.
|
|
32
|
+
*/
|
|
33
|
+
import { execFile as execFileCb } from "node:child_process";
|
|
34
|
+
import { createHash } from "node:crypto";
|
|
35
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
36
|
+
import { chmod, mkdir, rename, stat, unlink } from "node:fs/promises";
|
|
37
|
+
import { homedir } from "node:os";
|
|
38
|
+
import { dirname, join } from "node:path";
|
|
39
|
+
import { Readable, Writable } from "node:stream";
|
|
40
|
+
import { pipeline as streamPipeline } from "node:stream/promises";
|
|
41
|
+
import { promisify } from "node:util";
|
|
42
|
+
import { SCIP_PINS, SCIP_TOOL_ORDER, } from "./scip-pins.js";
|
|
43
|
+
export { isScipTool, SCIP_PINS, SCIP_TOOL_ORDER } from "./scip-pins.js";
|
|
44
|
+
const execFile = promisify(execFileCb);
|
|
45
|
+
/**
|
|
46
|
+
* Thrown when a downloaded file's SHA256 doesn't match the pinned value.
|
|
47
|
+
* The temp file is deleted before this throws so partial payloads never
|
|
48
|
+
* linger on disk.
|
|
49
|
+
*/
|
|
50
|
+
export class ScipSha256MismatchError extends Error {
|
|
51
|
+
code = "SCIP_SHA256_MISMATCH";
|
|
52
|
+
tool;
|
|
53
|
+
expected;
|
|
54
|
+
actual;
|
|
55
|
+
constructor(tool, expected, actual) {
|
|
56
|
+
super(`SHA256 mismatch for scip-${tool}: expected ${expected}, got ${actual}`);
|
|
57
|
+
this.name = "ScipSha256MismatchError";
|
|
58
|
+
this.tool = tool;
|
|
59
|
+
this.expected = expected;
|
|
60
|
+
this.actual = actual;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Thrown for all non-hash download failures (404, network, etc.). */
|
|
64
|
+
export class ScipDownloadError extends Error {
|
|
65
|
+
code = "SCIP_DOWNLOAD_FAILED";
|
|
66
|
+
url;
|
|
67
|
+
constructor(url, message, options) {
|
|
68
|
+
super(`Download failed for ${url}: ${message}`, options);
|
|
69
|
+
this.name = "ScipDownloadError";
|
|
70
|
+
this.url = url;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Thrown when the current platform is not covered by a pin. */
|
|
74
|
+
export class UnsupportedPlatformError extends Error {
|
|
75
|
+
code = "SCIP_UNSUPPORTED_PLATFORM";
|
|
76
|
+
os;
|
|
77
|
+
arch;
|
|
78
|
+
constructor(os, arch, toolHint) {
|
|
79
|
+
super(`Unsupported platform for ${toolHint ?? "scip tool"}: ${os}-${arch}. ` +
|
|
80
|
+
`Supported: linux-x64, linux-arm64, darwin-x64, darwin-arm64.`);
|
|
81
|
+
this.name = "UnsupportedPlatformError";
|
|
82
|
+
this.os = os;
|
|
83
|
+
this.arch = arch;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Thrown when a pin still has placeholder SHA256 digests. */
|
|
87
|
+
export class PlaceholderHashError extends Error {
|
|
88
|
+
code = "SCIP_PLACEHOLDER_HASH";
|
|
89
|
+
tool;
|
|
90
|
+
constructor(tool) {
|
|
91
|
+
super(`scip-${tool} pin still carries placeholder SHA256 digests. ` +
|
|
92
|
+
`The real hash is computed at adapter first-install time. ` +
|
|
93
|
+
`Pass allowPlaceholder: true from a smoke test, or wait for the adapter to land.`);
|
|
94
|
+
this.name = "PlaceholderHashError";
|
|
95
|
+
this.tool = tool;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** Thrown when `scip-dotnet` requires `dotnet` SDK >= N and it is missing or older. */
|
|
99
|
+
export class DotnetSdkMissingError extends Error {
|
|
100
|
+
code = "SCIP_DOTNET_SDK_MISSING";
|
|
101
|
+
minMajor;
|
|
102
|
+
detectedVersion;
|
|
103
|
+
constructor(minMajor, detectedVersion) {
|
|
104
|
+
const detected = detectedVersion === undefined
|
|
105
|
+
? "dotnet is not on PATH"
|
|
106
|
+
: `detected dotnet --version: ${detectedVersion}`;
|
|
107
|
+
super(`scip-dotnet requires .NET SDK ${minMajor}.0+ on PATH (${detected}). ` +
|
|
108
|
+
`Install from https://dotnet.microsoft.com/download, then retry ` +
|
|
109
|
+
`\`codehub setup --scip=dotnet\` (which runs ` +
|
|
110
|
+
`\`dotnet tool install --global scip-dotnet\`).`);
|
|
111
|
+
this.name = "DotnetSdkMissingError";
|
|
112
|
+
this.minMajor = minMajor;
|
|
113
|
+
this.detectedVersion = detectedVersion;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Detect the running platform. Normalizes `process.arch` values into the
|
|
118
|
+
* `x64` / `arm64` discriminator the pin file uses.
|
|
119
|
+
*/
|
|
120
|
+
export function detectPlatform(platform = process.platform, arch = process.arch) {
|
|
121
|
+
let normalizedArch;
|
|
122
|
+
if (arch === "x64") {
|
|
123
|
+
normalizedArch = "x64";
|
|
124
|
+
}
|
|
125
|
+
else if (arch === "arm64") {
|
|
126
|
+
normalizedArch = "arm64";
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
throw new UnsupportedPlatformError(platform, arch);
|
|
130
|
+
}
|
|
131
|
+
if (platform === "linux") {
|
|
132
|
+
return { os: "linux", arch: normalizedArch };
|
|
133
|
+
}
|
|
134
|
+
if (platform === "darwin") {
|
|
135
|
+
return { os: "darwin", arch: normalizedArch };
|
|
136
|
+
}
|
|
137
|
+
throw new UnsupportedPlatformError(platform, arch);
|
|
138
|
+
}
|
|
139
|
+
/** Resolve the default install dir: `~/.codehub/bin`. */
|
|
140
|
+
export function defaultScipBinDir(home = homedir()) {
|
|
141
|
+
return join(home, ".codehub", "bin");
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Default `dotnet --version` probe. Returns the version string on success or
|
|
145
|
+
* undefined when the binary isn't on PATH / fails to execute.
|
|
146
|
+
*/
|
|
147
|
+
const defaultDotnetProbe = async () => {
|
|
148
|
+
try {
|
|
149
|
+
const { stdout } = await execFile("dotnet", ["--version"], { timeout: 5000 });
|
|
150
|
+
return stdout.trim();
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
/** Parse `dotnet --version` output and extract the major version number. */
|
|
157
|
+
function parseDotnetMajor(version) {
|
|
158
|
+
if (version === undefined)
|
|
159
|
+
return undefined;
|
|
160
|
+
const match = version.match(/^(\d+)\./);
|
|
161
|
+
if (match === null)
|
|
162
|
+
return undefined;
|
|
163
|
+
const parsed = Number.parseInt(match[1] ?? "", 10);
|
|
164
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
165
|
+
}
|
|
166
|
+
/** Lookup the platform-specific pin for a tool. Throws on unsupported combos. */
|
|
167
|
+
function resolvePlatformPin(pin, platform) {
|
|
168
|
+
const hit = pin.platforms.find((p) => p.os === platform.os && p.arch === platform.arch);
|
|
169
|
+
if (hit === undefined) {
|
|
170
|
+
throw new UnsupportedPlatformError(platform.os, platform.arch, `scip-${pin.tool}`);
|
|
171
|
+
}
|
|
172
|
+
if (hit.platformUnavailable === true) {
|
|
173
|
+
throw new UnsupportedPlatformError(platform.os, platform.arch, `scip-${pin.tool} v${pin.version} (upstream does not ship a release asset for this platform)`);
|
|
174
|
+
}
|
|
175
|
+
return hit;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Hash an existing file in streaming fashion. Returns `undefined` if the file
|
|
179
|
+
* does not exist — callers use that as the "not yet downloaded" signal.
|
|
180
|
+
*/
|
|
181
|
+
async function hashFileIfExists(path) {
|
|
182
|
+
try {
|
|
183
|
+
await stat(path);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
const hasher = createHash("sha256");
|
|
189
|
+
const rs = createReadStream(path);
|
|
190
|
+
await streamPipeline(rs, new Writable({
|
|
191
|
+
write(chunk, _enc, cb) {
|
|
192
|
+
hasher.update(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
|
|
193
|
+
cb();
|
|
194
|
+
},
|
|
195
|
+
}));
|
|
196
|
+
return hasher.digest("hex");
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Stream one binary to disk: hash-as-we-write, verify, chmod +x, atomic
|
|
200
|
+
* rename. Does NOT retry — the embedder downloader's retry ladder is
|
|
201
|
+
* overkill for a single-binary install; a failed download surfaces directly.
|
|
202
|
+
*/
|
|
203
|
+
async function downloadBinary(tool, platformPin, targetPath, fetchImpl) {
|
|
204
|
+
const tmpPath = `${targetPath}.tmp`;
|
|
205
|
+
try {
|
|
206
|
+
await unlink(tmpPath);
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
// Doesn't exist — fine.
|
|
210
|
+
}
|
|
211
|
+
let res;
|
|
212
|
+
try {
|
|
213
|
+
res = await fetchImpl(platformPin.url, { redirect: "follow" });
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
throw new ScipDownloadError(platformPin.url, err instanceof Error ? err.message : String(err), err instanceof Error ? { cause: err } : undefined);
|
|
217
|
+
}
|
|
218
|
+
if (!res.ok) {
|
|
219
|
+
throw new ScipDownloadError(platformPin.url, `HTTP ${res.status} ${res.statusText}`);
|
|
220
|
+
}
|
|
221
|
+
if (res.body === null) {
|
|
222
|
+
throw new ScipDownloadError(platformPin.url, "response body is null");
|
|
223
|
+
}
|
|
224
|
+
const hasher = createHash("sha256");
|
|
225
|
+
let bytesWritten = 0;
|
|
226
|
+
const writeStream = createWriteStream(tmpPath);
|
|
227
|
+
const bodyAsNode = Readable.fromWeb(res.body);
|
|
228
|
+
try {
|
|
229
|
+
await streamPipeline(bodyAsNode, new Writable({
|
|
230
|
+
write(chunk, _enc, cb) {
|
|
231
|
+
const view = new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
232
|
+
hasher.update(view);
|
|
233
|
+
bytesWritten += chunk.byteLength;
|
|
234
|
+
if (!writeStream.write(chunk)) {
|
|
235
|
+
writeStream.once("drain", () => cb());
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
cb();
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
final(cb) {
|
|
242
|
+
writeStream.end(() => cb());
|
|
243
|
+
},
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
try {
|
|
248
|
+
await unlink(tmpPath);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
// Nothing to do.
|
|
252
|
+
}
|
|
253
|
+
throw new ScipDownloadError(platformPin.url, err instanceof Error ? err.message : String(err), err instanceof Error ? { cause: err } : undefined);
|
|
254
|
+
}
|
|
255
|
+
const actual = hasher.digest("hex");
|
|
256
|
+
if (actual !== platformPin.sha256) {
|
|
257
|
+
try {
|
|
258
|
+
await unlink(tmpPath);
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
// Nothing to do.
|
|
262
|
+
}
|
|
263
|
+
throw new ScipSha256MismatchError(tool, platformPin.sha256, actual);
|
|
264
|
+
}
|
|
265
|
+
// 0o755 — owner rwx, everyone rx. Matches what a release tarball extraction
|
|
266
|
+
// would produce.
|
|
267
|
+
await chmod(tmpPath, 0o755);
|
|
268
|
+
await rename(tmpPath, targetPath);
|
|
269
|
+
return bytesWritten;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* In-memory guard against concurrent installs of the same tool in the same
|
|
273
|
+
* process. Keyed by `${tool}:${destDir}` so parallel tests with distinct
|
|
274
|
+
* temp dirs don't serialize against each other.
|
|
275
|
+
*/
|
|
276
|
+
const inFlight = new Map();
|
|
277
|
+
/**
|
|
278
|
+
* Install one SCIP tool. Returns immediately with `skipped: true` when the
|
|
279
|
+
* on-disk binary already matches the pin; downloads otherwise.
|
|
280
|
+
*/
|
|
281
|
+
export async function installScipTool(tool, opts = {}) {
|
|
282
|
+
const destDir = opts.destDir ?? defaultScipBinDir();
|
|
283
|
+
const key = `${tool}:${destDir}`;
|
|
284
|
+
const existing = inFlight.get(key);
|
|
285
|
+
if (existing !== undefined) {
|
|
286
|
+
return existing;
|
|
287
|
+
}
|
|
288
|
+
const task = installScipToolInner(tool, destDir, opts).finally(() => {
|
|
289
|
+
inFlight.delete(key);
|
|
290
|
+
});
|
|
291
|
+
inFlight.set(key, task);
|
|
292
|
+
return task;
|
|
293
|
+
}
|
|
294
|
+
async function installScipToolInner(tool, destDir, opts) {
|
|
295
|
+
const pin = SCIP_PINS[tool];
|
|
296
|
+
const log = opts.log ?? (() => undefined);
|
|
297
|
+
if (pin.installerKind === "dotnet-tool") {
|
|
298
|
+
const probe = opts.dotnetProbe ?? defaultDotnetProbe;
|
|
299
|
+
const version = await probe();
|
|
300
|
+
const major = parseDotnetMajor(version);
|
|
301
|
+
const minMajor = pin.minDotnetMajor ?? 8;
|
|
302
|
+
if (major === undefined || major < minMajor) {
|
|
303
|
+
throw new DotnetSdkMissingError(minMajor, version);
|
|
304
|
+
}
|
|
305
|
+
// We do NOT actually run `dotnet tool install` here — that is a
|
|
306
|
+
// side-effectful system install the user should run explicitly. We
|
|
307
|
+
// return the hint string so the setup command can print it.
|
|
308
|
+
const hint = `dotnet tool install --global scip-${tool}`;
|
|
309
|
+
log(`codehub setup --scip=${tool}: SDK ${major} detected; run \`${hint}\` to install`);
|
|
310
|
+
return {
|
|
311
|
+
tool,
|
|
312
|
+
installed: false,
|
|
313
|
+
skipped: true,
|
|
314
|
+
version: pin.version,
|
|
315
|
+
path: hint,
|
|
316
|
+
dotnetToolHint: hint,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
if (pin.placeholder && opts.allowPlaceholder !== true) {
|
|
320
|
+
throw new PlaceholderHashError(tool);
|
|
321
|
+
}
|
|
322
|
+
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
323
|
+
if (typeof fetchImpl !== "function") {
|
|
324
|
+
throw new Error("Global fetch is not available. Node >= 18 required; supply opts.fetchImpl otherwise.");
|
|
325
|
+
}
|
|
326
|
+
const platform = opts.platform ?? detectPlatform();
|
|
327
|
+
const platformPin = resolvePlatformPin(pin, platform);
|
|
328
|
+
const targetPath = join(destDir, pin.binName);
|
|
329
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
330
|
+
if (opts.force !== true) {
|
|
331
|
+
const existingHash = await hashFileIfExists(targetPath);
|
|
332
|
+
if (existingHash !== undefined && existingHash === platformPin.sha256) {
|
|
333
|
+
log(`codehub setup --scip=${tool}: already installed at ${targetPath} (version ${pin.version})`);
|
|
334
|
+
return {
|
|
335
|
+
tool,
|
|
336
|
+
installed: false,
|
|
337
|
+
skipped: true,
|
|
338
|
+
version: pin.version,
|
|
339
|
+
path: targetPath,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
log(`codehub setup --scip=${tool}: downloading ${platformPin.url}`);
|
|
344
|
+
const bytes = await downloadBinary(tool, platformPin, targetPath, fetchImpl);
|
|
345
|
+
log(`codehub setup --scip=${tool}: installed ${bytes} bytes → ${targetPath}`);
|
|
346
|
+
return {
|
|
347
|
+
tool,
|
|
348
|
+
installed: true,
|
|
349
|
+
skipped: false,
|
|
350
|
+
version: pin.version,
|
|
351
|
+
path: targetPath,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Install every known SCIP tool in declaration order. Collects successes and
|
|
356
|
+
* failures without short-circuiting — `scip-dotnet` missing `dotnet` on PATH
|
|
357
|
+
* must not prevent the clang/ruby/kotlin installs from running. Returns the
|
|
358
|
+
* per-tool result array; caller decides how to surface errors.
|
|
359
|
+
*/
|
|
360
|
+
export async function installAllScipTools(opts = {}) {
|
|
361
|
+
const results = [];
|
|
362
|
+
for (const tool of SCIP_TOOL_ORDER) {
|
|
363
|
+
try {
|
|
364
|
+
results.push(await installScipTool(tool, opts));
|
|
365
|
+
}
|
|
366
|
+
catch (err) {
|
|
367
|
+
results.push({ tool, error: err instanceof Error ? err : new Error(String(err)) });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return results;
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=scip-downloader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scip-downloader.js","sourceRoot":"","sources":["../src/scip-downloader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,SAAS,EACT,eAAe,GAMhB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAiDvC;;;;GAIG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,IAAI,GAAG,sBAA+B,CAAC;IACvC,IAAI,CAAW;IACf,QAAQ,CAAS;IACjB,MAAM,CAAS;IAExB,YAAY,IAA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YACH,OAAO,CAAC,IAAI,CAAC,MAAM,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pinned external SCIP adapter binaries.
|
|
3
|
+
*
|
|
4
|
+
* This is the single source of truth for every downloadable SCIP indexer we
|
|
5
|
+
* ship via `codehub setup --scip=<tool>`. Each entry carries:
|
|
6
|
+
*
|
|
7
|
+
* - `tool`: the indexer family.
|
|
8
|
+
* - `version`: upstream release tag (no `v` prefix).
|
|
9
|
+
* - `platforms[]`: per-platform download metadata. Each lists the target
|
|
10
|
+
* `{os, arch}`, the direct release URL, the expected SHA256
|
|
11
|
+
* digest, and (optionally) the binary's executable name on
|
|
12
|
+
* disk.
|
|
13
|
+
*
|
|
14
|
+
* Some pins ship PLACEHOLDER SHA256 hashes (64 zeros) for standalone
|
|
15
|
+
* binaries until each adapter's first-install smoke test computes and
|
|
16
|
+
* substitutes the real digest against the upstream release asset. The
|
|
17
|
+
* `placeholder: true` flag is the canonical "do NOT trust this hash at
|
|
18
|
+
* runtime" marker — `installScipTool()` refuses to run when the selected pin
|
|
19
|
+
* has `placeholder: true` unless the caller sets `opts.allowPlaceholder`
|
|
20
|
+
* (reserved for adapter first-install smoke tests).
|
|
21
|
+
*
|
|
22
|
+
* `scip-kotlin` ships a real SHA256 computed against Maven Central: upstream
|
|
23
|
+
* publishes the plugin as a Maven Central JAR
|
|
24
|
+
* (`com.sourcegraph:semanticdb-kotlinc:0.6.0`) whose SHA256 is stable and
|
|
25
|
+
* publicly verifiable — no first-install smoke test needed.
|
|
26
|
+
*
|
|
27
|
+
* `scip-dotnet` is the odd one out: upstream does NOT ship a self-contained
|
|
28
|
+
* release binary, so its install path goes through
|
|
29
|
+
* `dotnet tool install --global scip-dotnet`. Its entry therefore carries an
|
|
30
|
+
* empty `platforms` array and a sentinel `installerKind: "dotnet-tool"`. The
|
|
31
|
+
* downloader dispatches on that kind and skips the fetch/verify path entirely.
|
|
32
|
+
*/
|
|
33
|
+
/** Platform = `${os}-${arch}`. Matches what we read from `process.platform` + `process.arch`. */
|
|
34
|
+
export type ScipOs = "linux" | "darwin";
|
|
35
|
+
export type ScipArch = "x64" | "arm64";
|
|
36
|
+
/** The four binary-backed SCIP tools plus the .NET tool-sourced adapter. */
|
|
37
|
+
export type ScipTool = "clang" | "ruby" | "dotnet" | "kotlin";
|
|
38
|
+
/** Per-platform download descriptor. */
|
|
39
|
+
export interface ScipPlatformPin {
|
|
40
|
+
readonly os: ScipOs;
|
|
41
|
+
readonly arch: ScipArch;
|
|
42
|
+
readonly url: string;
|
|
43
|
+
/** Hex-encoded SHA256 (64 chars). PLACEHOLDER when `placeholder` is true. */
|
|
44
|
+
readonly sha256: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional: name of the archive entry that contains the binary. When absent
|
|
47
|
+
* the downloader treats the URL's payload as the binary itself.
|
|
48
|
+
*
|
|
49
|
+
* We currently download raw binaries (the Sourcegraph release artifacts are
|
|
50
|
+
* standalone executables), so this stays undefined for now. Reserved for
|
|
51
|
+
* future tools that publish tarballs or zips.
|
|
52
|
+
*/
|
|
53
|
+
readonly archiveEntry?: string;
|
|
54
|
+
/**
|
|
55
|
+
* True when upstream does NOT publish a release asset for this `{os, arch}`
|
|
56
|
+
* pair. The entry is retained so the pin documents the gap explicitly
|
|
57
|
+
* (vs. silently omitting the row, which would leave callers guessing).
|
|
58
|
+
* The downloader refuses to install against an unavailable platform and
|
|
59
|
+
* surfaces a specific "upstream does not ship this platform" error. The
|
|
60
|
+
* `sha256` and `url` stay for traceability but must never be fetched.
|
|
61
|
+
*/
|
|
62
|
+
readonly platformUnavailable?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Canonical pin shape shared by every tool. */
|
|
65
|
+
export interface ScipToolPin {
|
|
66
|
+
readonly tool: ScipTool;
|
|
67
|
+
readonly version: string;
|
|
68
|
+
/** How the installer should source the binary. */
|
|
69
|
+
readonly installerKind: "download" | "dotnet-tool";
|
|
70
|
+
/**
|
|
71
|
+
* True while the per-platform SHA256 digests are placeholders (all zeros).
|
|
72
|
+
* Downloader refuses to verify against placeholder hashes unless the caller
|
|
73
|
+
* opts in with `allowPlaceholder: true` (used by the first-install smoke
|
|
74
|
+
* test in each adapter PR).
|
|
75
|
+
*/
|
|
76
|
+
readonly placeholder: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Platforms covered by this tool. Empty for `installerKind === "dotnet-tool"`.
|
|
79
|
+
*/
|
|
80
|
+
readonly platforms: readonly ScipPlatformPin[];
|
|
81
|
+
/**
|
|
82
|
+
* Name the binary is installed under inside `~/.codehub/bin/`. Usually
|
|
83
|
+
* `scip-<tool>`. Set explicitly so each pin is self-describing.
|
|
84
|
+
*/
|
|
85
|
+
readonly binName: string;
|
|
86
|
+
/**
|
|
87
|
+
* `dotnet tool install --global scip-dotnet` runtime requirement — minimum
|
|
88
|
+
* .NET SDK major version (probed via `dotnet --version`). Only consulted
|
|
89
|
+
* when `installerKind === "dotnet-tool"`.
|
|
90
|
+
*/
|
|
91
|
+
readonly minDotnetMajor?: number;
|
|
92
|
+
}
|
|
93
|
+
/** Single source of truth. Keep insertion order stable for `--scip=all`. */
|
|
94
|
+
export declare const SCIP_PINS: Readonly<Record<ScipTool, ScipToolPin>>;
|
|
95
|
+
/** Ordered list used by `--scip=all`. */
|
|
96
|
+
export declare const SCIP_TOOL_ORDER: readonly ScipTool[];
|
|
97
|
+
/** True when `value` is a known SCIP tool name. Used to validate CLI input. */
|
|
98
|
+
export declare function isScipTool(value: string): value is ScipTool;
|
|
99
|
+
//# sourceMappingURL=scip-pins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scip-pins.d.ts","sourceRoot":"","sources":["../src/scip-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,iGAAiG;AACjG,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AACxC,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEvC,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9D,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,UAAU,GAAG,aAAa,CAAC;IACnD;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IAC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