@caddis/cli 0.4.112 → 0.4.114
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/bundles/antigravity-plugin/plugin.json +1 -1
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_exit.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_file_lock.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_frontmatter.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_redact.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_roadmap.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_rows.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_status.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_tidy.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_todo.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_workstreams.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/__pycache__/caddis_worktree_safety.cpython-311.pyc +0 -0
- package/bundles/antigravity-plugin/scripts/caddis_coordinate.py +107 -1
- package/bundles/antigravity-plugin/scripts/caddis_guide.json +2 -2
- package/bundles/antigravity-plugin/scripts/oss_review.py +10 -5
- package/bundles/antigravity-plugin/skills/coordinate/SKILL.md +6 -2
- package/bundles/manifest.json +2 -2
- package/dist/cli.js +207 -113
- package/dist/ui/assets/{Activity-B816JVqx.js → Activity-CITEjSUJ.js} +1 -1
- package/dist/ui/assets/Benchmarks-B2_1oerW.css +1 -0
- package/dist/ui/assets/Benchmarks-ChQoYa0P.js +1 -0
- package/dist/ui/assets/{Guide-CnL1DiTr.js → Guide-9Ob-m7gx.js} +1 -1
- package/dist/ui/assets/{Palette-BKM_A64G.js → Palette-CinCoveU.js} +1 -1
- package/dist/ui/assets/{RoadmapTab-DhC4-kqv.js → RoadmapTab-BeD4-8IU.js} +2 -2
- package/dist/ui/assets/{external-link-DagTFCsV.js → external-link-D_rks7KV.js} +1 -1
- package/dist/ui/assets/index-CFKn_GzG.js +231 -0
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/index-Bj5qA-fq.js +0 -226
package/dist/cli.js
CHANGED
|
@@ -1209,7 +1209,7 @@ var require_command = __commonJS({
|
|
|
1209
1209
|
"use strict";
|
|
1210
1210
|
var EventEmitter = __require("events").EventEmitter;
|
|
1211
1211
|
var childProcess = __require("child_process");
|
|
1212
|
-
var
|
|
1212
|
+
var path30 = __require("path");
|
|
1213
1213
|
var fs = __require("fs");
|
|
1214
1214
|
var process3 = __require("process");
|
|
1215
1215
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -2222,9 +2222,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2222
2222
|
let launchWithNode = false;
|
|
2223
2223
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2224
2224
|
function findFile(baseDir, baseName) {
|
|
2225
|
-
const localBin =
|
|
2225
|
+
const localBin = path30.resolve(baseDir, baseName);
|
|
2226
2226
|
if (fs.existsSync(localBin)) return localBin;
|
|
2227
|
-
if (sourceExt.includes(
|
|
2227
|
+
if (sourceExt.includes(path30.extname(baseName))) return void 0;
|
|
2228
2228
|
const foundExt = sourceExt.find(
|
|
2229
2229
|
(ext) => fs.existsSync(`${localBin}${ext}`)
|
|
2230
2230
|
);
|
|
@@ -2242,17 +2242,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2242
2242
|
} catch {
|
|
2243
2243
|
resolvedScriptPath = this._scriptPath;
|
|
2244
2244
|
}
|
|
2245
|
-
executableDir =
|
|
2246
|
-
|
|
2245
|
+
executableDir = path30.resolve(
|
|
2246
|
+
path30.dirname(resolvedScriptPath),
|
|
2247
2247
|
executableDir
|
|
2248
2248
|
);
|
|
2249
2249
|
}
|
|
2250
2250
|
if (executableDir) {
|
|
2251
2251
|
let localFile = findFile(executableDir, executableFile);
|
|
2252
2252
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2253
|
-
const legacyName =
|
|
2253
|
+
const legacyName = path30.basename(
|
|
2254
2254
|
this._scriptPath,
|
|
2255
|
-
|
|
2255
|
+
path30.extname(this._scriptPath)
|
|
2256
2256
|
);
|
|
2257
2257
|
if (legacyName !== this._name) {
|
|
2258
2258
|
localFile = findFile(
|
|
@@ -2263,7 +2263,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2263
2263
|
}
|
|
2264
2264
|
executableFile = localFile || executableFile;
|
|
2265
2265
|
}
|
|
2266
|
-
launchWithNode = sourceExt.includes(
|
|
2266
|
+
launchWithNode = sourceExt.includes(path30.extname(executableFile));
|
|
2267
2267
|
let proc;
|
|
2268
2268
|
if (process3.platform !== "win32") {
|
|
2269
2269
|
if (launchWithNode) {
|
|
@@ -3178,7 +3178,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3178
3178
|
* @return {Command}
|
|
3179
3179
|
*/
|
|
3180
3180
|
nameFromFilename(filename) {
|
|
3181
|
-
this._name =
|
|
3181
|
+
this._name = path30.basename(filename, path30.extname(filename));
|
|
3182
3182
|
return this;
|
|
3183
3183
|
}
|
|
3184
3184
|
/**
|
|
@@ -3192,9 +3192,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3192
3192
|
* @param {string} [path]
|
|
3193
3193
|
* @return {(string|null|Command)}
|
|
3194
3194
|
*/
|
|
3195
|
-
executableDir(
|
|
3196
|
-
if (
|
|
3197
|
-
this._executableDir =
|
|
3195
|
+
executableDir(path31) {
|
|
3196
|
+
if (path31 === void 0) return this._executableDir;
|
|
3197
|
+
this._executableDir = path31;
|
|
3198
3198
|
return this;
|
|
3199
3199
|
}
|
|
3200
3200
|
/**
|
|
@@ -5012,10 +5012,10 @@ function keysFilePath(env) {
|
|
|
5012
5012
|
const expanded = expandHome(configured);
|
|
5013
5013
|
return isAbsolute(expanded) ? expanded : expanded;
|
|
5014
5014
|
}
|
|
5015
|
-
function parseKeysFile(
|
|
5015
|
+
function parseKeysFile(path30) {
|
|
5016
5016
|
let text2;
|
|
5017
5017
|
try {
|
|
5018
|
-
text2 = readFileSync3(
|
|
5018
|
+
text2 = readFileSync3(path30, "utf8");
|
|
5019
5019
|
} catch {
|
|
5020
5020
|
return {};
|
|
5021
5021
|
}
|
|
@@ -5127,18 +5127,18 @@ function upsertKeyLines(existing, updates) {
|
|
|
5127
5127
|
if (!text2.endsWith("\n")) text2 += "\n";
|
|
5128
5128
|
return text2;
|
|
5129
5129
|
}
|
|
5130
|
-
function restrictPermissions(
|
|
5130
|
+
function restrictPermissions(path30) {
|
|
5131
5131
|
if (process.platform === "win32") return null;
|
|
5132
5132
|
try {
|
|
5133
|
-
chmodSync(
|
|
5133
|
+
chmodSync(path30, 384);
|
|
5134
5134
|
return null;
|
|
5135
5135
|
} catch (error) {
|
|
5136
5136
|
return error instanceof Error ? error.message : String(error);
|
|
5137
5137
|
}
|
|
5138
5138
|
}
|
|
5139
5139
|
async function keys(options = {}) {
|
|
5140
|
-
const
|
|
5141
|
-
const fileKeys = parseKeysFile(
|
|
5140
|
+
const path30 = keysFilePath(process.env);
|
|
5141
|
+
const fileKeys = parseKeysFile(path30);
|
|
5142
5142
|
const names = Object.keys(PROVIDERS).sort();
|
|
5143
5143
|
const current = names.map((name) => {
|
|
5144
5144
|
const preset = PROVIDERS[name];
|
|
@@ -5154,7 +5154,7 @@ async function keys(options = {}) {
|
|
|
5154
5154
|
if (options.check) {
|
|
5155
5155
|
const configured = current.filter((entry) => entry.value);
|
|
5156
5156
|
if (!configured.length) {
|
|
5157
|
-
process.stdout.write(`no provider keys configured (looked in $ENV and ${
|
|
5157
|
+
process.stdout.write(`no provider keys configured (looked in $ENV and ${path30})
|
|
5158
5158
|
`);
|
|
5159
5159
|
return 1;
|
|
5160
5160
|
}
|
|
@@ -5169,7 +5169,7 @@ async function keys(options = {}) {
|
|
|
5169
5169
|
return bad ? 1 : 0;
|
|
5170
5170
|
}
|
|
5171
5171
|
Ie("caddis keys");
|
|
5172
|
-
process.stdout.write(` keys file: ${
|
|
5172
|
+
process.stdout.write(` keys file: ${path30}
|
|
5173
5173
|
|
|
5174
5174
|
`);
|
|
5175
5175
|
for (const entry of current) {
|
|
@@ -5229,20 +5229,20 @@ async function keys(options = {}) {
|
|
|
5229
5229
|
return 0;
|
|
5230
5230
|
}
|
|
5231
5231
|
if (options.dryRun) {
|
|
5232
|
-
Se(`dry run \u2014 would write ${Object.keys(collected).join(", ")} to ${
|
|
5232
|
+
Se(`dry run \u2014 would write ${Object.keys(collected).join(", ")} to ${path30}`);
|
|
5233
5233
|
return 0;
|
|
5234
5234
|
}
|
|
5235
5235
|
let existing = "";
|
|
5236
5236
|
try {
|
|
5237
|
-
existing = readFileSync4(
|
|
5237
|
+
existing = readFileSync4(path30, "utf8");
|
|
5238
5238
|
} catch {
|
|
5239
5239
|
existing = "";
|
|
5240
5240
|
}
|
|
5241
|
-
mkdirSync2(dirname(
|
|
5242
|
-
writeFileSync(
|
|
5243
|
-
const permWarning = restrictPermissions(
|
|
5241
|
+
mkdirSync2(dirname(path30), { recursive: true });
|
|
5242
|
+
writeFileSync(path30, upsertKeyLines(existing, collected), { encoding: "utf8" });
|
|
5243
|
+
const permWarning = restrictPermissions(path30);
|
|
5244
5244
|
process.stdout.write(`
|
|
5245
|
-
wrote ${Object.keys(collected).join(", ")} to ${
|
|
5245
|
+
wrote ${Object.keys(collected).join(", ")} to ${path30}
|
|
5246
5246
|
`);
|
|
5247
5247
|
if (permWarning) process.stdout.write(color2.yellow(` could not set 0600 on the keys file: ${permWarning}
|
|
5248
5248
|
`));
|
|
@@ -7855,7 +7855,7 @@ function createCollectorSource(opts) {
|
|
|
7855
7855
|
const now = opts.now ?? Date.now;
|
|
7856
7856
|
const spawn2 = opts.spawn ?? spawnBounded;
|
|
7857
7857
|
const log = opts.log ?? errorLine;
|
|
7858
|
-
const
|
|
7858
|
+
const cache3 = /* @__PURE__ */ new Map();
|
|
7859
7859
|
let spend = null;
|
|
7860
7860
|
let guide = null;
|
|
7861
7861
|
let schema = COLLECTOR_SCHEMA;
|
|
@@ -7897,16 +7897,16 @@ function createCollectorSource(opts) {
|
|
|
7897
7897
|
schema = version;
|
|
7898
7898
|
generatedAt = typeof out.generated_at === "string" ? out.generated_at : "";
|
|
7899
7899
|
const keep = new Set(wanted);
|
|
7900
|
-
for (const key of [...
|
|
7900
|
+
for (const key of [...cache3.keys()]) if (!keep.has(key)) cache3.delete(key);
|
|
7901
7901
|
for (const entry of out.repos) {
|
|
7902
7902
|
if (!entry || typeof entry.path !== "string" || !keep.has(entry.path)) continue;
|
|
7903
7903
|
if (entry.unchanged === true) continue;
|
|
7904
|
-
const old =
|
|
7904
|
+
const old = cache3.get(entry.path);
|
|
7905
7905
|
if (entry.error !== void 0 || entry.fingerprint === void 0) {
|
|
7906
|
-
if (!old || old.error !== void 0)
|
|
7906
|
+
if (!old || old.error !== void 0) cache3.set(entry.path, entry);
|
|
7907
7907
|
continue;
|
|
7908
7908
|
}
|
|
7909
|
-
if (!old || old.error !== void 0 || old.fingerprint !== entry.fingerprint)
|
|
7909
|
+
if (!old || old.error !== void 0 || old.fingerprint !== entry.fingerprint) cache3.set(entry.path, withDone(entry, old));
|
|
7910
7910
|
}
|
|
7911
7911
|
const keepOrError = (next, old) => {
|
|
7912
7912
|
if (!next || typeof next !== "object") return old;
|
|
@@ -7931,8 +7931,8 @@ function createCollectorSource(opts) {
|
|
|
7931
7931
|
pre = found.pre;
|
|
7932
7932
|
}
|
|
7933
7933
|
const script = opts.scriptPath ?? defaultScriptPath();
|
|
7934
|
-
const known = [...
|
|
7935
|
-
const doneKnown = [...
|
|
7934
|
+
const known = [...cache3.values()].filter((r2) => !knownUnsupported && r2.error === void 0 && typeof r2.fingerprint === "string" && repos.includes(r2.path)).map((r2) => `${r2.path}=${r2.fingerprint}`);
|
|
7935
|
+
const doneKnown = [...cache3.values()].filter((r2) => !knownUnsupported && !doneKnownUnsupported && r2.error === void 0 && repos.includes(r2.path)).flatMap((r2) => {
|
|
7936
7936
|
const tree = r2.plans?.done?.tree;
|
|
7937
7937
|
return typeof tree === "string" && tree ? [`${r2.path}=${tree}`] : [];
|
|
7938
7938
|
});
|
|
@@ -8003,7 +8003,7 @@ function createCollectorSource(opts) {
|
|
|
8003
8003
|
last_error: lastError,
|
|
8004
8004
|
stale: lastOkAt === null || now() - lastOkAt > STALE_AFTER_MS3,
|
|
8005
8005
|
update_needed: updateNeeded,
|
|
8006
|
-
data: hasData ? { schema, generated_at: generatedAt, repos: [...
|
|
8006
|
+
data: hasData ? { schema, generated_at: generatedAt, repos: [...cache3.values()], spend: spend ?? {}, guide: guide ?? {} } : null
|
|
8007
8007
|
};
|
|
8008
8008
|
}
|
|
8009
8009
|
};
|
|
@@ -8901,10 +8901,90 @@ var init_actions = __esm({
|
|
|
8901
8901
|
}
|
|
8902
8902
|
});
|
|
8903
8903
|
|
|
8904
|
+
// src/hub/benchmarks.ts
|
|
8905
|
+
import { readFileSync as readFileSync16, realpathSync, statSync as statSync5 } from "fs";
|
|
8906
|
+
import path24 from "path";
|
|
8907
|
+
function readBenchmarks(repoPaths) {
|
|
8908
|
+
const boards = [];
|
|
8909
|
+
const errors = [];
|
|
8910
|
+
for (const repoPath of repoPaths) {
|
|
8911
|
+
const resolvedRepo = path24.resolve(repoPath);
|
|
8912
|
+
const repo = path24.basename(resolvedRepo);
|
|
8913
|
+
const file = path24.join(resolvedRepo, "evals", "results", "review-scoreboard.json");
|
|
8914
|
+
let sig;
|
|
8915
|
+
try {
|
|
8916
|
+
const st = statSync5(file);
|
|
8917
|
+
if (!st.isFile()) {
|
|
8918
|
+
cache2.delete(file);
|
|
8919
|
+
continue;
|
|
8920
|
+
}
|
|
8921
|
+
sig = `${st.size}:${st.mtimeMs}`;
|
|
8922
|
+
} catch (e2) {
|
|
8923
|
+
cache2.delete(file);
|
|
8924
|
+
const code = e2.code;
|
|
8925
|
+
if (code === "ENOENT" || code === "ENOTDIR") continue;
|
|
8926
|
+
errors.push({ repo, error: e2 instanceof Error ? e2.message : String(e2) });
|
|
8927
|
+
continue;
|
|
8928
|
+
}
|
|
8929
|
+
const hit = cache2.get(file);
|
|
8930
|
+
if (hit && hit.sig === sig) {
|
|
8931
|
+
if (hit.kind === "board") boards.push(hit.entry);
|
|
8932
|
+
else errors.push({ repo, error: hit.error });
|
|
8933
|
+
continue;
|
|
8934
|
+
}
|
|
8935
|
+
let text2;
|
|
8936
|
+
try {
|
|
8937
|
+
const realRepo = realpathSync(resolvedRepo);
|
|
8938
|
+
const realFile = realpathSync(file);
|
|
8939
|
+
const rel = path24.relative(realRepo, realFile);
|
|
8940
|
+
if (!rel || rel === ".." || rel.startsWith(`..${path24.sep}`) || path24.isAbsolute(rel)) {
|
|
8941
|
+
const msg = "scoreboard path escapes repo";
|
|
8942
|
+
cache2.set(file, { sig, kind: "error", error: msg });
|
|
8943
|
+
errors.push({ repo, error: msg });
|
|
8944
|
+
continue;
|
|
8945
|
+
}
|
|
8946
|
+
text2 = readFileSync16(realFile, "utf8");
|
|
8947
|
+
} catch (e2) {
|
|
8948
|
+
cache2.delete(file);
|
|
8949
|
+
const code = e2.code;
|
|
8950
|
+
if (code === "ENOENT" || code === "ENOTDIR") continue;
|
|
8951
|
+
errors.push({ repo, error: e2 instanceof Error ? e2.message : String(e2) });
|
|
8952
|
+
continue;
|
|
8953
|
+
}
|
|
8954
|
+
let parsed;
|
|
8955
|
+
try {
|
|
8956
|
+
parsed = JSON.parse(text2);
|
|
8957
|
+
} catch (e2) {
|
|
8958
|
+
const msg = e2 instanceof Error ? e2.message : String(e2);
|
|
8959
|
+
cache2.set(file, { sig, kind: "error", error: msg });
|
|
8960
|
+
errors.push({ repo, error: msg });
|
|
8961
|
+
continue;
|
|
8962
|
+
}
|
|
8963
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
8964
|
+
const msg = "scoreboard is not a JSON object";
|
|
8965
|
+
cache2.set(file, { sig, kind: "error", error: msg });
|
|
8966
|
+
errors.push({ repo, error: msg });
|
|
8967
|
+
continue;
|
|
8968
|
+
}
|
|
8969
|
+
const entry = { repo, path: SCOREBOARD_REL_PATH, board: parsed };
|
|
8970
|
+
cache2.set(file, { sig, kind: "board", entry });
|
|
8971
|
+
boards.push(entry);
|
|
8972
|
+
}
|
|
8973
|
+
return { boards, errors };
|
|
8974
|
+
}
|
|
8975
|
+
var SCOREBOARD_REL_PATH, cache2;
|
|
8976
|
+
var init_benchmarks = __esm({
|
|
8977
|
+
"src/hub/benchmarks.ts"() {
|
|
8978
|
+
"use strict";
|
|
8979
|
+
SCOREBOARD_REL_PATH = "evals/results/review-scoreboard.json";
|
|
8980
|
+
cache2 = /* @__PURE__ */ new Map();
|
|
8981
|
+
}
|
|
8982
|
+
});
|
|
8983
|
+
|
|
8904
8984
|
// src/hub/auth.ts
|
|
8905
8985
|
import { createHash as createHash2, randomBytes as randomBytes3, timingSafeEqual } from "crypto";
|
|
8906
|
-
import { mkdirSync as mkdirSync10, readFileSync as
|
|
8907
|
-
import
|
|
8986
|
+
import { mkdirSync as mkdirSync10, readFileSync as readFileSync17, renameSync as renameSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
8987
|
+
import path25 from "path";
|
|
8908
8988
|
function randomToken() {
|
|
8909
8989
|
return randomBytes3(32).toString("base64url");
|
|
8910
8990
|
}
|
|
@@ -8958,7 +9038,7 @@ var init_auth = __esm({
|
|
|
8958
9038
|
if (!this.file) return [];
|
|
8959
9039
|
let raw;
|
|
8960
9040
|
try {
|
|
8961
|
-
raw = JSON.parse(
|
|
9041
|
+
raw = JSON.parse(readFileSync17(this.file, "utf8"));
|
|
8962
9042
|
} catch {
|
|
8963
9043
|
return [];
|
|
8964
9044
|
}
|
|
@@ -9001,7 +9081,7 @@ var init_auth = __esm({
|
|
|
9001
9081
|
};
|
|
9002
9082
|
const tmp = `${this.file}.${process.pid}.tmp`;
|
|
9003
9083
|
try {
|
|
9004
|
-
mkdirSync10(
|
|
9084
|
+
mkdirSync10(path25.dirname(this.file), { recursive: true });
|
|
9005
9085
|
writeFileSync7(tmp, JSON.stringify(body), { mode: 384 });
|
|
9006
9086
|
renameSync4(tmp, this.file);
|
|
9007
9087
|
for (const s of this.sessions) s.savedSeenAt = s.lastSeenAt;
|
|
@@ -9160,14 +9240,14 @@ var init_phaseText = __esm({
|
|
|
9160
9240
|
import http from "http";
|
|
9161
9241
|
import { existsSync as existsSync10 } from "fs";
|
|
9162
9242
|
import { readFile, stat } from "fs/promises";
|
|
9163
|
-
import
|
|
9243
|
+
import path26 from "path";
|
|
9164
9244
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
9165
9245
|
import { promisify } from "util";
|
|
9166
9246
|
import { gzip } from "zlib";
|
|
9167
9247
|
function defaultUiDir() {
|
|
9168
|
-
const here =
|
|
9169
|
-
const beside =
|
|
9170
|
-
return existsSync10(beside) ? beside :
|
|
9248
|
+
const here = path26.dirname(fileURLToPath2(import.meta.url));
|
|
9249
|
+
const beside = path26.join(here, "ui");
|
|
9250
|
+
return existsSync10(beside) ? beside : path26.resolve(here, "..", "..", "dist", "ui");
|
|
9171
9251
|
}
|
|
9172
9252
|
function resolveStatic(root, urlPath) {
|
|
9173
9253
|
let decoded;
|
|
@@ -9178,9 +9258,9 @@ function resolveStatic(root, urlPath) {
|
|
|
9178
9258
|
}
|
|
9179
9259
|
if (decoded.includes(String.fromCharCode(0)) || decoded.includes(String.fromCharCode(92))) return null;
|
|
9180
9260
|
if (decoded.split("/").includes("..")) return null;
|
|
9181
|
-
const base =
|
|
9182
|
-
const file =
|
|
9183
|
-
return file.startsWith(base +
|
|
9261
|
+
const base = path26.resolve(root);
|
|
9262
|
+
const file = path26.resolve(base, "." + decoded);
|
|
9263
|
+
return file.startsWith(base + path26.sep) ? file : null;
|
|
9184
9264
|
}
|
|
9185
9265
|
function send(res, status5, body, extra = {}) {
|
|
9186
9266
|
const text2 = JSON.stringify(body);
|
|
@@ -9272,7 +9352,7 @@ async function serveStatic(res, uiDir, urlPath) {
|
|
|
9272
9352
|
return fail(res, 404, "not_found");
|
|
9273
9353
|
}
|
|
9274
9354
|
res.writeHead(200, {
|
|
9275
|
-
"Content-Type": MIME[
|
|
9355
|
+
"Content-Type": MIME[path26.extname(file).toLowerCase()] ?? "application/octet-stream",
|
|
9276
9356
|
"Content-Length": body.length,
|
|
9277
9357
|
"Cache-Control": urlPath === "/" ? "no-store" : "public, max-age=31536000, immutable"
|
|
9278
9358
|
});
|
|
@@ -9308,23 +9388,23 @@ async function startServer(opts) {
|
|
|
9308
9388
|
fail(res, 400, "bad_url");
|
|
9309
9389
|
return;
|
|
9310
9390
|
}
|
|
9311
|
-
const
|
|
9391
|
+
const path30 = url.pathname;
|
|
9312
9392
|
const method = req.method ?? "GET";
|
|
9313
|
-
if (
|
|
9393
|
+
if (path30.startsWith("/api/") || path30 === "/login") res.setHeader("Cache-Control", "no-store");
|
|
9314
9394
|
if (!hostAllowed(req.headers.host, port)) {
|
|
9315
|
-
if (
|
|
9395
|
+
if (path30 === "/login") auth.discardCode(url.searchParams.get("code") ?? "");
|
|
9316
9396
|
fail(res, 403, "bad_host");
|
|
9317
9397
|
return;
|
|
9318
9398
|
}
|
|
9319
|
-
if (
|
|
9399
|
+
if (path30 === "/api/hub/whoami" && method === "GET") {
|
|
9320
9400
|
if (!opts.instance) return fail(res, 404, "not_found");
|
|
9321
9401
|
return send(res, 200, { instance: opts.instance });
|
|
9322
9402
|
}
|
|
9323
|
-
if (
|
|
9403
|
+
if (path30 === "/api/health" && method === "GET") {
|
|
9324
9404
|
if (!keyOk(req, key)) return fail(res, 401, "unauthorized");
|
|
9325
9405
|
return send(res, 200, { schema: 1, ok: true, versions });
|
|
9326
9406
|
}
|
|
9327
|
-
if (
|
|
9407
|
+
if (path30 === "/api/hub/code" && method === "POST") {
|
|
9328
9408
|
if (!keyOk(req, key)) return fail(res, 401, "unauthorized");
|
|
9329
9409
|
try {
|
|
9330
9410
|
await readBody(req);
|
|
@@ -9335,7 +9415,7 @@ async function startServer(opts) {
|
|
|
9335
9415
|
const code = auth.mintCode();
|
|
9336
9416
|
return send(res, 200, { schema: 1, code, expires_at: auth.codeExpiresAt() });
|
|
9337
9417
|
}
|
|
9338
|
-
if (
|
|
9418
|
+
if (path30 === "/api/hub/stop" && method === "POST") {
|
|
9339
9419
|
if (!keyOk(req, key)) return fail(res, 401, "unauthorized");
|
|
9340
9420
|
try {
|
|
9341
9421
|
await readBody(req);
|
|
@@ -9353,7 +9433,7 @@ async function startServer(opts) {
|
|
|
9353
9433
|
if (!session) return fail(res, 401, "unauthorized");
|
|
9354
9434
|
const token = req.headers[CSRF_HEADER];
|
|
9355
9435
|
if (typeof token !== "string" || !safeEqual(token, session.csrf)) return fail(res, 403, "bad_csrf");
|
|
9356
|
-
if (
|
|
9436
|
+
if (path30 === "/api/actions" && method === "POST" && opts.actions) {
|
|
9357
9437
|
if (!tabSessionOf(req)) return fail(res, 401, "unauthorized");
|
|
9358
9438
|
const type = String(req.headers["content-type"] ?? "").split(";")[0]?.trim().toLowerCase();
|
|
9359
9439
|
if (type !== "application/json") return fail(res, 415, "json_only");
|
|
@@ -9379,7 +9459,7 @@ async function startServer(opts) {
|
|
|
9379
9459
|
if (e2 instanceof BodyTooLarge) return tooLarge(req, res);
|
|
9380
9460
|
throw e2;
|
|
9381
9461
|
}
|
|
9382
|
-
if (
|
|
9462
|
+
if (path30 === "/api/logout" && method === "POST") {
|
|
9383
9463
|
auth.deleteSession(parseCookies(req.headers.cookie)[SESSION_COOKIE] ?? "");
|
|
9384
9464
|
return send(res, 200, { schema: 1, ok: true }, {
|
|
9385
9465
|
"Set-Cookie": `${SESSION_COOKIE}=; HttpOnly; SameSite=Strict; Path=/; Max-Age=0`
|
|
@@ -9387,11 +9467,11 @@ async function startServer(opts) {
|
|
|
9387
9467
|
}
|
|
9388
9468
|
return fail(res, 404, "not_found");
|
|
9389
9469
|
}
|
|
9390
|
-
if (
|
|
9391
|
-
await serveStatic(res, uiDir,
|
|
9470
|
+
if (path30 === "/" || path30.startsWith("/assets/") || path30.startsWith("/fonts/")) {
|
|
9471
|
+
await serveStatic(res, uiDir, path30);
|
|
9392
9472
|
return;
|
|
9393
9473
|
}
|
|
9394
|
-
if (
|
|
9474
|
+
if (path30 === "/login") {
|
|
9395
9475
|
const id = auth.redeemCode(url.searchParams.get("code") ?? "");
|
|
9396
9476
|
const session = id ? auth.getSession(id) : null;
|
|
9397
9477
|
if (!id || !session) return fail(res, 401, "bad_code");
|
|
@@ -9403,12 +9483,12 @@ async function startServer(opts) {
|
|
|
9403
9483
|
res.end();
|
|
9404
9484
|
return;
|
|
9405
9485
|
}
|
|
9406
|
-
if (
|
|
9486
|
+
if (path30 === "/api/session") {
|
|
9407
9487
|
const session = tabSessionOf(req);
|
|
9408
9488
|
if (!session) return fail(res, 401, "unauthorized");
|
|
9409
9489
|
return send(res, 200, { schema: 1, csrf_token: session.csrf, versions });
|
|
9410
9490
|
}
|
|
9411
|
-
if (
|
|
9491
|
+
if (path30 === "/api/state") {
|
|
9412
9492
|
if (!tabSessionOf(req)) return fail(res, 401, "unauthorized");
|
|
9413
9493
|
let state;
|
|
9414
9494
|
try {
|
|
@@ -9418,7 +9498,7 @@ async function startServer(opts) {
|
|
|
9418
9498
|
}
|
|
9419
9499
|
return sendState(req, res, stripPhaseText(state));
|
|
9420
9500
|
}
|
|
9421
|
-
if (
|
|
9501
|
+
if (path30 === "/api/plan-phase") {
|
|
9422
9502
|
if (!tabSessionOf(req)) return fail(res, 401, "unauthorized");
|
|
9423
9503
|
const repo = url.searchParams.get("repo") ?? "";
|
|
9424
9504
|
const plan2 = url.searchParams.get("plan") ?? "";
|
|
@@ -9433,6 +9513,18 @@ async function startServer(opts) {
|
|
|
9433
9513
|
const sec = findPhaseSection(state, repo, plan2, phaseKey);
|
|
9434
9514
|
return sec ? send(res, 200, { schema: 1, ...sec }) : fail(res, 404, "not_found");
|
|
9435
9515
|
}
|
|
9516
|
+
if (path30 === "/api/benchmarks") {
|
|
9517
|
+
if (!tabSessionOf(req)) return fail(res, 401, "unauthorized");
|
|
9518
|
+
if (!opts.getBenchmarks) return fail(res, 404, "not_found");
|
|
9519
|
+
let data;
|
|
9520
|
+
try {
|
|
9521
|
+
data = await opts.getBenchmarks();
|
|
9522
|
+
} catch {
|
|
9523
|
+
return fail(res, 500, "benchmarks_failed");
|
|
9524
|
+
}
|
|
9525
|
+
const body = data && typeof data === "object" && !Array.isArray(data) ? { schema: 1, ...data } : { schema: 1, boards: [], errors: [] };
|
|
9526
|
+
return send(res, 200, body);
|
|
9527
|
+
}
|
|
9436
9528
|
return fail(res, 404, "not_found");
|
|
9437
9529
|
}
|
|
9438
9530
|
const server = http.createServer((req, res) => {
|
|
@@ -9515,8 +9607,8 @@ __export(hub_exports, {
|
|
|
9515
9607
|
startHub: () => startHub
|
|
9516
9608
|
});
|
|
9517
9609
|
import http2 from "http";
|
|
9518
|
-
import
|
|
9519
|
-
import { mkdirSync as mkdirSync11, readFileSync as
|
|
9610
|
+
import path27 from "path";
|
|
9611
|
+
import { mkdirSync as mkdirSync11, readFileSync as readFileSync18 } from "fs";
|
|
9520
9612
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
9521
9613
|
function defaultVersions2() {
|
|
9522
9614
|
return { cli: packageInfo().version, caddis: bundleManifest().poolVersion };
|
|
@@ -9533,7 +9625,7 @@ function resolvePort(deps) {
|
|
|
9533
9625
|
}
|
|
9534
9626
|
function readKeyQuiet(home) {
|
|
9535
9627
|
try {
|
|
9536
|
-
const k3 =
|
|
9628
|
+
const k3 = readFileSync18(keyPath(home), "utf8").trim();
|
|
9537
9629
|
return /^[0-9a-f]{64}$/.test(k3) ? k3 : null;
|
|
9538
9630
|
} catch {
|
|
9539
9631
|
return null;
|
|
@@ -9601,7 +9693,7 @@ async function isNodeProcess(pid) {
|
|
|
9601
9693
|
if (!r2.ok) return false;
|
|
9602
9694
|
const name = (r2.stdout.split(/\r?\n/)[0] ?? "").replace(/^"([^"]*)".*$/, "$1").trim().toLowerCase();
|
|
9603
9695
|
if (!name) return false;
|
|
9604
|
-
const runtime =
|
|
9696
|
+
const runtime = path27.basename(process.execPath).toLowerCase().replace(/\.exe$/, "");
|
|
9605
9697
|
return name.includes("node") || name.includes(runtime);
|
|
9606
9698
|
}
|
|
9607
9699
|
async function defaultOpener(url) {
|
|
@@ -9686,6 +9778,7 @@ async function startHub(deps = {}) {
|
|
|
9686
9778
|
port,
|
|
9687
9779
|
key,
|
|
9688
9780
|
getState: () => state.getState(),
|
|
9781
|
+
getBenchmarks: () => readBenchmarks(state.repoPaths()),
|
|
9689
9782
|
actions: createActions({ home, getState: () => state.getState(), now }),
|
|
9690
9783
|
versions: deps.versions ?? defaultVersions2(),
|
|
9691
9784
|
now,
|
|
@@ -9744,7 +9837,7 @@ async function hubServe(deps = {}) {
|
|
|
9744
9837
|
process.once("exit", onExit);
|
|
9745
9838
|
line(`caddis hub serving on ${hubUrl(hub2.port)} (pid ${process.pid}); stop it with: caddis hub stop`);
|
|
9746
9839
|
const pkgRoot = packageInfo().root;
|
|
9747
|
-
const newEntry =
|
|
9840
|
+
const newEntry = path27.join(pkgRoot, "dist", "cli.js");
|
|
9748
9841
|
const runningVersion = (deps.versions ?? defaultVersions2()).cli ?? packageInfo().version;
|
|
9749
9842
|
const log = (text2) => hubLog(text2, home, deps.now);
|
|
9750
9843
|
let installing = () => false;
|
|
@@ -10026,6 +10119,7 @@ var init_hub = __esm({
|
|
|
10026
10119
|
init_restart();
|
|
10027
10120
|
init_selfUpdate();
|
|
10028
10121
|
init_actions();
|
|
10122
|
+
init_benchmarks();
|
|
10029
10123
|
init_server();
|
|
10030
10124
|
init_state();
|
|
10031
10125
|
init_exec();
|
|
@@ -10233,8 +10327,8 @@ var init_data = __esm({
|
|
|
10233
10327
|
});
|
|
10234
10328
|
|
|
10235
10329
|
// src/hub/export/privacy.ts
|
|
10236
|
-
import { lstatSync, readdirSync as readdirSync6, readFileSync as
|
|
10237
|
-
import
|
|
10330
|
+
import { lstatSync, readdirSync as readdirSync6, readFileSync as readFileSync19 } from "fs";
|
|
10331
|
+
import path28 from "path";
|
|
10238
10332
|
function parseAllowedUrls(text2) {
|
|
10239
10333
|
const exact = /* @__PURE__ */ new Set();
|
|
10240
10334
|
const templates = [];
|
|
@@ -10247,13 +10341,13 @@ function parseAllowedUrls(text2) {
|
|
|
10247
10341
|
return { exact, templates };
|
|
10248
10342
|
}
|
|
10249
10343
|
function defaultAllowedUrls() {
|
|
10250
|
-
return
|
|
10344
|
+
return readFileSync19(new URL("./allowed-urls.txt", import.meta.url), "utf8");
|
|
10251
10345
|
}
|
|
10252
10346
|
function walk(dir, base = "") {
|
|
10253
10347
|
const out = [];
|
|
10254
10348
|
for (const name of readdirSync6(dir).sort()) {
|
|
10255
10349
|
const rel = base ? `${base}/${name}` : name;
|
|
10256
|
-
const full =
|
|
10350
|
+
const full = path28.join(dir, name);
|
|
10257
10351
|
if (lstatSync(full).isDirectory()) out.push(...walk(full, rel));
|
|
10258
10352
|
else out.push(rel);
|
|
10259
10353
|
}
|
|
@@ -10298,13 +10392,13 @@ function isPrivateText(text2, deny) {
|
|
|
10298
10392
|
function scanExport(dir, opts) {
|
|
10299
10393
|
const hits = [];
|
|
10300
10394
|
for (const file of walk(dir)) {
|
|
10301
|
-
const full =
|
|
10395
|
+
const full = path28.join(dir, ...file.split("/"));
|
|
10302
10396
|
if (lstatSync(full).isSymbolicLink()) {
|
|
10303
10397
|
hits.push({ file, offset: 0, rule: "symbolic-link" });
|
|
10304
10398
|
continue;
|
|
10305
10399
|
}
|
|
10306
|
-
const buf =
|
|
10307
|
-
const binary = BINARY_EXT.has(
|
|
10400
|
+
const buf = readFileSync19(full);
|
|
10401
|
+
const binary = BINARY_EXT.has(path28.extname(file).toLowerCase());
|
|
10308
10402
|
const text2 = binary ? null : buf.toString("utf8");
|
|
10309
10403
|
scanDeny(file, buf, text2, opts.deny, hits);
|
|
10310
10404
|
if (text2 === null) continue;
|
|
@@ -10387,13 +10481,13 @@ import {
|
|
|
10387
10481
|
lstatSync as lstatSync2,
|
|
10388
10482
|
mkdirSync as mkdirSync12,
|
|
10389
10483
|
readdirSync as readdirSync7,
|
|
10390
|
-
readFileSync as
|
|
10484
|
+
readFileSync as readFileSync20,
|
|
10391
10485
|
rmSync as rmSync4,
|
|
10392
|
-
statSync as
|
|
10486
|
+
statSync as statSync6,
|
|
10393
10487
|
writeFileSync as writeFileSync8
|
|
10394
10488
|
} from "fs";
|
|
10395
10489
|
import os7 from "os";
|
|
10396
|
-
import
|
|
10490
|
+
import path29 from "path";
|
|
10397
10491
|
function prsForCollector(gh, repo) {
|
|
10398
10492
|
if (!Array.isArray(gh)) return null;
|
|
10399
10493
|
const heads = [];
|
|
@@ -10413,7 +10507,7 @@ function prsForCollector(gh, repo) {
|
|
|
10413
10507
|
}
|
|
10414
10508
|
function holdsLink(dir) {
|
|
10415
10509
|
for (const name of readdirSync7(dir)) {
|
|
10416
|
-
const full =
|
|
10510
|
+
const full = path29.join(dir, name);
|
|
10417
10511
|
const st = lstatSync2(full);
|
|
10418
10512
|
if (st.isSymbolicLink()) return true;
|
|
10419
10513
|
if (st.isDirectory() && holdsLink(full)) return true;
|
|
@@ -10432,7 +10526,7 @@ function checkOut(out, repo) {
|
|
|
10432
10526
|
if (st.isSymbolicLink()) return "--out is a link";
|
|
10433
10527
|
if (!st.isDirectory()) return "--out is a file";
|
|
10434
10528
|
if (readdirSync7(out).length === 0) return null;
|
|
10435
|
-
if (!existsSync11(
|
|
10529
|
+
if (!existsSync11(path29.join(out, MARKER)) || lstatSync2(path29.join(out, MARKER)).isSymbolicLink()) {
|
|
10436
10530
|
return `--out is not empty and has no ${MARKER} marker: this command did not make it`;
|
|
10437
10531
|
}
|
|
10438
10532
|
if (holdsLink(out)) return "--out holds a link";
|
|
@@ -10458,33 +10552,33 @@ function notFoundPage() {
|
|
|
10458
10552
|
`;
|
|
10459
10553
|
}
|
|
10460
10554
|
function copyFixedSet(dist, dest) {
|
|
10461
|
-
mkdirSync12(
|
|
10462
|
-
mkdirSync12(
|
|
10463
|
-
mkdirSync12(
|
|
10464
|
-
copyFileSync(
|
|
10465
|
-
for (const name of readdirSync7(
|
|
10466
|
-
const from =
|
|
10467
|
-
if (lstatSync2(from).isFile()) copyFileSync(from,
|
|
10468
|
-
}
|
|
10469
|
-
const fonts =
|
|
10555
|
+
mkdirSync12(path29.join(dest, "assets"), { recursive: true });
|
|
10556
|
+
mkdirSync12(path29.join(dest, "fonts"), { recursive: true });
|
|
10557
|
+
mkdirSync12(path29.join(dest, "licenses"), { recursive: true });
|
|
10558
|
+
copyFileSync(path29.join(dist, "index.html"), path29.join(dest, "index.html"));
|
|
10559
|
+
for (const name of readdirSync7(path29.join(dist, "assets"))) {
|
|
10560
|
+
const from = path29.join(dist, "assets", name);
|
|
10561
|
+
if (lstatSync2(from).isFile()) copyFileSync(from, path29.join(dest, "assets", name));
|
|
10562
|
+
}
|
|
10563
|
+
const fonts = path29.join(dist, "fonts");
|
|
10470
10564
|
if (isDir2(fonts)) {
|
|
10471
10565
|
for (const name of readdirSync7(fonts)) {
|
|
10472
|
-
const from =
|
|
10566
|
+
const from = path29.join(fonts, name);
|
|
10473
10567
|
if (!lstatSync2(from).isFile()) continue;
|
|
10474
|
-
if (name.endsWith(".woff2")) copyFileSync(from,
|
|
10568
|
+
if (name.endsWith(".woff2")) copyFileSync(from, path29.join(dest, "fonts", name));
|
|
10475
10569
|
}
|
|
10476
10570
|
}
|
|
10477
|
-
const licenses =
|
|
10571
|
+
const licenses = path29.join(dist, "licenses");
|
|
10478
10572
|
if (isDir2(licenses)) {
|
|
10479
10573
|
for (const name of readdirSync7(licenses)) {
|
|
10480
|
-
const from =
|
|
10481
|
-
if (lstatSync2(from).isFile() && /^(OFL-[A-Za-z]+|LICENSE-Lucide)\.txt$/.test(name)) copyFileSync(from,
|
|
10574
|
+
const from = path29.join(licenses, name);
|
|
10575
|
+
if (lstatSync2(from).isFile() && /^(OFL-[A-Za-z]+|LICENSE-Lucide)\.txt$/.test(name)) copyFileSync(from, path29.join(dest, "licenses", name));
|
|
10482
10576
|
}
|
|
10483
10577
|
}
|
|
10484
10578
|
}
|
|
10485
10579
|
function countFiles(dir) {
|
|
10486
10580
|
return readdirSync7(dir).reduce((n, name) => {
|
|
10487
|
-
const full =
|
|
10581
|
+
const full = path29.join(dir, name);
|
|
10488
10582
|
return n + (lstatSync2(full).isDirectory() ? countFiles(full) : name === MARKER ? 0 : 1);
|
|
10489
10583
|
}, 0);
|
|
10490
10584
|
}
|
|
@@ -10506,7 +10600,7 @@ async function hubExport(args, deps = {}) {
|
|
|
10506
10600
|
return 2;
|
|
10507
10601
|
}
|
|
10508
10602
|
if (args.check !== void 0) {
|
|
10509
|
-
const dir =
|
|
10603
|
+
const dir = path29.resolve(args.check);
|
|
10510
10604
|
if (!isDir2(dir)) {
|
|
10511
10605
|
err(`error: --check folder not found: ${args.check}`);
|
|
10512
10606
|
return 1;
|
|
@@ -10530,9 +10624,9 @@ async function hubExport(args, deps = {}) {
|
|
|
10530
10624
|
err("error: --commit must be 7 to 40 hex characters");
|
|
10531
10625
|
return 2;
|
|
10532
10626
|
}
|
|
10533
|
-
const repo =
|
|
10534
|
-
const outDir =
|
|
10535
|
-
if (!existsSync11(
|
|
10627
|
+
const repo = path29.resolve(args.repo);
|
|
10628
|
+
const outDir = path29.resolve(args.out);
|
|
10629
|
+
if (!existsSync11(path29.join(repo, ".git")) || !(isDir2(path29.join(repo, ".caddis", "roadmaps")) || isDir2(path29.join(repo, ".caddis", "plans")))) {
|
|
10536
10630
|
err("error: --repo must be a git checkout with .caddis/roadmaps/ or .caddis/plans/");
|
|
10537
10631
|
return 2;
|
|
10538
10632
|
}
|
|
@@ -10541,8 +10635,8 @@ async function hubExport(args, deps = {}) {
|
|
|
10541
10635
|
err(`error: ${refused}`);
|
|
10542
10636
|
return 2;
|
|
10543
10637
|
}
|
|
10544
|
-
const dist = deps.distDir ??
|
|
10545
|
-
if (!existsSync11(
|
|
10638
|
+
const dist = deps.distDir ?? path29.join(packageInfo().root, "dist", "export");
|
|
10639
|
+
if (!existsSync11(path29.join(dist, "index.html")) || !isDir2(path29.join(dist, "assets"))) {
|
|
10546
10640
|
err(`error: the export app is not built (${dist}). Run: npm run build:ui`);
|
|
10547
10641
|
return 1;
|
|
10548
10642
|
}
|
|
@@ -10592,7 +10686,7 @@ async function hubExport(args, deps = {}) {
|
|
|
10592
10686
|
if (args.prs !== void 0) {
|
|
10593
10687
|
let gh = null;
|
|
10594
10688
|
try {
|
|
10595
|
-
gh = JSON.parse(
|
|
10689
|
+
gh = JSON.parse(readFileSync20(path29.resolve(args.prs), "utf8"));
|
|
10596
10690
|
} catch {
|
|
10597
10691
|
gh = null;
|
|
10598
10692
|
}
|
|
@@ -10602,7 +10696,7 @@ async function hubExport(args, deps = {}) {
|
|
|
10602
10696
|
} else {
|
|
10603
10697
|
prsFile = `${outDir}.prs-${process.pid}.json`;
|
|
10604
10698
|
try {
|
|
10605
|
-
mkdirSync12(
|
|
10699
|
+
mkdirSync12(path29.dirname(prsFile), { recursive: true });
|
|
10606
10700
|
writeFileSync8(prsFile, JSON.stringify(body));
|
|
10607
10701
|
} catch (error) {
|
|
10608
10702
|
rmSync4(prsFile, { force: true });
|
|
@@ -10637,12 +10731,12 @@ async function hubExport(args, deps = {}) {
|
|
|
10637
10731
|
const build = (page) => {
|
|
10638
10732
|
rmSync4(staging, { recursive: true, force: true });
|
|
10639
10733
|
copyFixedSet(dist, staging);
|
|
10640
|
-
const indexPath =
|
|
10641
|
-
const html =
|
|
10734
|
+
const indexPath = path29.join(staging, "index.html");
|
|
10735
|
+
const html = readFileSync20(indexPath, "utf8");
|
|
10642
10736
|
if (!html.includes(PLACEHOLDER)) throw new Error("the built index.html has no data placeholder");
|
|
10643
10737
|
const block = `<script type="application/json" id="caddis-export-data">${escapeJson(JSON.stringify(page))}</script>`;
|
|
10644
10738
|
writeFileSync8(indexPath, html.replace(PLACEHOLDER, () => block));
|
|
10645
|
-
writeFileSync8(
|
|
10739
|
+
writeFileSync8(path29.join(staging, "404.html"), notFoundPage());
|
|
10646
10740
|
};
|
|
10647
10741
|
try {
|
|
10648
10742
|
build(data);
|
|
@@ -10668,10 +10762,10 @@ async function hubExport(args, deps = {}) {
|
|
|
10668
10762
|
rmSync4(staging, { recursive: true, force: true });
|
|
10669
10763
|
return 3;
|
|
10670
10764
|
}
|
|
10671
|
-
mkdirSync12(
|
|
10765
|
+
mkdirSync12(path29.dirname(outDir), { recursive: true });
|
|
10672
10766
|
if (existsSync11(outDir)) rmSync4(outDir, { recursive: true, force: true });
|
|
10673
10767
|
renameWithRetry(staging, outDir);
|
|
10674
|
-
writeFileSync8(
|
|
10768
|
+
writeFileSync8(path29.join(outDir, MARKER), "written by caddis hub export\n");
|
|
10675
10769
|
out(`[EXPORT] ${countFiles(outDir)} file(s) in ${outDir}`);
|
|
10676
10770
|
return 0;
|
|
10677
10771
|
} catch (error) {
|
|
@@ -10701,18 +10795,18 @@ var init_export = __esm({
|
|
|
10701
10795
|
FIXED_FILES = ["index.html", "404.html"];
|
|
10702
10796
|
isDir2 = (p2) => {
|
|
10703
10797
|
try {
|
|
10704
|
-
return
|
|
10798
|
+
return statSync6(p2).isDirectory();
|
|
10705
10799
|
} catch {
|
|
10706
10800
|
return false;
|
|
10707
10801
|
}
|
|
10708
10802
|
};
|
|
10709
10803
|
samePath = (a, b3) => {
|
|
10710
|
-
const norm = (p2) =>
|
|
10804
|
+
const norm = (p2) => path29.resolve(p2).replace(/[\\/]+$/, "").toLowerCase();
|
|
10711
10805
|
return norm(a) === norm(b3);
|
|
10712
10806
|
};
|
|
10713
10807
|
isInside = (child, parent) => {
|
|
10714
|
-
const rel =
|
|
10715
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
10808
|
+
const rel = path29.relative(path29.resolve(parent), path29.resolve(child));
|
|
10809
|
+
return rel !== "" && !rel.startsWith("..") && !path29.isAbsolute(rel);
|
|
10716
10810
|
};
|
|
10717
10811
|
NOT_FOUND_SCRIPT = "var p=location.pathname.split('/');var f=p.pop();p.pop();var m=/^([A-Za-z0-9._-]+)\\.html$/.exec(f);if(m&&p.length>1)location.replace(p.join('/')+'/#/roadmap/'+encodeURIComponent(m[1]));";
|
|
10718
10812
|
}
|
|
@@ -10773,14 +10867,14 @@ function* pluginBlocks(stdout) {
|
|
|
10773
10867
|
if (current) yield current;
|
|
10774
10868
|
}
|
|
10775
10869
|
async function detect() {
|
|
10776
|
-
const
|
|
10777
|
-
if (!
|
|
10870
|
+
const path30 = await findBin(BIN);
|
|
10871
|
+
if (!path30) {
|
|
10778
10872
|
return { present: false, note: "no `claude` binary on PATH" };
|
|
10779
10873
|
}
|
|
10780
10874
|
const version = await run(BIN, ["--version"], { timeout: 2e4 });
|
|
10781
10875
|
return {
|
|
10782
10876
|
present: true,
|
|
10783
|
-
path:
|
|
10877
|
+
path: path30,
|
|
10784
10878
|
agentVersion: version.ok ? version.stdout.trim().split(/\s+/)[0] || void 0 : void 0,
|
|
10785
10879
|
note: version.ok ? void 0 : "binary found but `claude --version` failed"
|
|
10786
10880
|
};
|