@skydiveai/git-cache 0.1.0-beta.2728 → 0.1.0-beta.2851

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/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { f as startServer } from "./server-BrGhh8-W.mjs";
2
+ import { f as startServer } from "./server-Dh-RKXuT.mjs";
3
3
  //#region src/cli.ts
4
4
  /**
5
5
  * `git-cache` CLI — the published binary for @skydiveai/git-cache.
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as isProtocolV2Request, c as parseAdvertisement, d as shouldBackfillAfterPassthrough, f as startServer, i as explainRejection, l as parseUpstream, n as classifyUploadRequest, o as metricsSnapshot, r as copyRequestHeaders, s as mirrorHasObjects, t as SidebandPackExtractor, u as recordColdBuildOutcome } from "./server-BrGhh8-W.mjs";
1
+ import { a as isProtocolV2Request, c as parseAdvertisement, d as shouldBackfillAfterPassthrough, f as startServer, i as explainRejection, l as parseUpstream, n as classifyUploadRequest, o as metricsSnapshot, r as copyRequestHeaders, s as mirrorHasObjects, t as SidebandPackExtractor, u as recordColdBuildOutcome } from "./server-Dh-RKXuT.mjs";
2
2
  export { SidebandPackExtractor, classifyUploadRequest, copyRequestHeaders, explainRejection, isProtocolV2Request, metricsSnapshot, mirrorHasObjects, parseAdvertisement, parseUpstream, recordColdBuildOutcome, shouldBackfillAfterPassthrough, startServer };
@@ -5,6 +5,7 @@ import { spawn } from "node:child_process";
5
5
  import { mkdir, readFile, readdir, rename, rm, stat, utimes, writeFile } from "node:fs/promises";
6
6
  import { hostname } from "node:os";
7
7
  import path from "node:path";
8
+ import { fileURLToPath } from "node:url";
8
9
  import { createGunzip, gunzip } from "node:zlib";
9
10
  import { promisify } from "node:util";
10
11
  //#region src/server.ts
@@ -46,6 +47,16 @@ import { promisify } from "node:util";
46
47
  * with no npm install.
47
48
  */
48
49
  const gunzip$1 = promisify(gunzip);
50
+ let runningVersion = null;
51
+ async function readOwnPackageVersion() {
52
+ try {
53
+ const here = path.dirname(fileURLToPath(import.meta.url));
54
+ const manifest = JSON.parse(await readFile(path.join(here, "..", "package.json"), "utf8"));
55
+ return typeof manifest.version === "string" ? manifest.version : null;
56
+ } catch (_error) {
57
+ return null;
58
+ }
59
+ }
49
60
  /**
50
61
  * An unset/empty env resolves to trusted-client (the daemon's original
51
62
  * contract); anything other than the two known modes is a hard startup
@@ -1707,6 +1718,7 @@ async function handle(req, res) {
1707
1718
  res.writeHead(200, { "Content-Type": "application/json" });
1708
1719
  return res.end(JSON.stringify({
1709
1720
  ok: true,
1721
+ version: runningVersion,
1710
1722
  bind: config.bindHost,
1711
1723
  cacheDir: config.cacheDir,
1712
1724
  ttlSeconds: config.ttlSeconds,
@@ -1869,6 +1881,7 @@ async function startServer(options = {}) {
1869
1881
  if (config.authMode === "check-through" && config.credentialHelper) throw new Error("git-cache: credentialHelper is incompatible with check-through authorization — upstream requests authenticate with each client's own credential.");
1870
1882
  await mkdir(path.join(config.cacheDir, "mirrors"), { recursive: true });
1871
1883
  await cleanupQuarantine();
1884
+ runningVersion = await readOwnPackageVersion();
1872
1885
  const server = http.createServer((req, res) => {
1873
1886
  handle(req, res).catch((error) => {
1874
1887
  log("error", "unhandled", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skydiveai/git-cache",
3
- "version": "0.1.0-beta.2728",
3
+ "version": "0.1.0-beta.2851",
4
4
  "description": "Sandbox-local Git smart-HTTP clone/fetch cache: a loopback daemon that transparently mirrors HTTPS git reads so repeated clone/fetch/ls-remote skip the origin round-trip. Runs inside an agent sandbox; pushes stay direct.",
5
5
  "homepage": "https://skydive.com",
6
6
  "license": "MIT",