mirror of
https://github.com/JuliusBrussee/caveman.git
synced 2026-09-14 18:02:35 +08:00
82864c8f4c
Single-commit port of the Caveman 2 tree onto the original repo history (candidate caveman-2@88878a4 applied over main@3098342). No unrelated-history merge; original history untouched. Preserved v1 surfaces: - skills/caveman/SKILL.md byte-for-byte, plus plugin mirror and caveman.skill zip - legacy CI (Node 18/20/22 installer + Python 3.11 suites) alongside engine-ci - cli/install.js compatibility shim forwarding to bin/install.js - .codex/config.toml ships both hooks and codex_hooks for older Codex (#617) - README Trendshift + Skills.sh badges and local star-history asset - v1.10.0-pinned curl installs; benchmarks/tmp-starcharts ignore rules Fixed for public same-repo release: - SECURITY.md vulnerability reporting points at this repository - release-binaries.yml publishes to this repo via job-scoped GITHUB_TOKEN (cross-repo PAT removed); binary-release environment still gates signing - packages/cli/PUBLISHING.md rewritten for packages/ layout and same-repo flow - profile-contract and provider-catalog lanes skip lane-scope gates on initial import so the launch PR can gate on their real validation steps - ANNOUNCEMENT.md network claim corrected: compression is local; requests still go to the provider you configured Caveman 2 stays opt-in: bin-v1.0.0 binaries and @caveman-ai/cli publish separately after this lands and soaks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BLvb5QniwYjmcawyssQNw9
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
import { createReadStream, statSync } from "node:fs";
|
|
import { createServer } from "node:http";
|
|
import { resolve, sep } from "node:path";
|
|
|
|
const root = resolve(process.argv[2] ?? "");
|
|
const port = Number(process.argv[3] ?? "8765");
|
|
if (!root || !Number.isInteger(port) || port <= 0) {
|
|
throw new Error("usage: static-release-server.mjs <asset-root> [port]");
|
|
}
|
|
|
|
const server = createServer((request, response) => {
|
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
response.writeHead(405).end();
|
|
return;
|
|
}
|
|
const pathname = decodeURIComponent(new URL(request.url ?? "/", "http://release.invalid").pathname);
|
|
const path = resolve(root, `.${pathname}`);
|
|
if (path !== root && !path.startsWith(`${root}${sep}`)) {
|
|
response.writeHead(403).end();
|
|
return;
|
|
}
|
|
try {
|
|
const stat = statSync(path);
|
|
if (!stat.isFile()) throw new Error("not a file");
|
|
response.writeHead(200, {
|
|
"content-length": stat.size,
|
|
"content-type": "application/octet-stream",
|
|
});
|
|
if (request.method === "HEAD") response.end();
|
|
else createReadStream(path).pipe(response);
|
|
} catch {
|
|
response.writeHead(404).end();
|
|
}
|
|
});
|
|
|
|
server.listen(port, "127.0.0.1", () => {
|
|
process.stdout.write(`static release server listening on 127.0.0.1:${port}\n`);
|
|
});
|
|
process.on("SIGTERM", () => server.close(() => process.exit(0)));
|