@hamsterbase/evidra 0.7.1 → 0.9.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/dist/service/cli.js +158 -47
- package/dist/web/assets/ProjectFileEditor-BzdTjbeh.css +1 -0
- package/dist/web/assets/ProjectFileEditor-Cvj7CY89.js +103 -0
- package/dist/web/assets/{cssMode-DLjojEX5.js → cssMode-CTtxQe_H.js} +1 -1
- package/dist/web/assets/{editor.api-Cm8Jz3Ng.js → editor.api-DbueYBpJ.js} +1 -1
- package/dist/web/assets/{freemarker2-ffO1wPRi.js → freemarker2-B_RP2mBl.js} +1 -1
- package/dist/web/assets/{handlebars-B67yYAds.js → handlebars-Hz0h_0ZE.js} +1 -1
- package/dist/web/assets/{html-D4vuTio3.js → html-MsYis9Cj.js} +1 -1
- package/dist/web/assets/{htmlMode-Nau5A2BZ.js → htmlMode-Qf9QxGpi.js} +1 -1
- package/dist/web/assets/{index-DuyTRx9x.js → index-BShYpQzA.js} +2 -2
- package/dist/web/assets/{javascript-j7PBySIN.js → javascript-BvAccjqb.js} +1 -1
- package/dist/web/assets/{jsonMode-Dlcb-cLx.js → jsonMode-BUGkR3Gl.js} +1 -1
- package/dist/web/assets/{liquid-DSGlvFRw.js → liquid-CN2uFItr.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DUpjT3Ad.js → lspLanguageFeatures-CI_8opt3.js} +1 -1
- package/dist/web/assets/main-B3dHaxwJ.js +13 -0
- package/dist/web/assets/main-CvYPjM14.js +18 -0
- package/dist/web/assets/{main-Bl-lTPMD.css → main-DV8f993q.css} +1 -1
- package/dist/web/assets/main-XYcKXGAp.css +2 -0
- package/dist/web/assets/{mdx-BjjEiDsC.js → mdx-D8RkMdxf.js} +1 -1
- package/dist/web/assets/{monaco-3fFILk_i.js → monaco-BIg-2np-.js} +4 -4
- package/dist/web/assets/{python-dNdKGm1p.js → python-CmKFcpYI.js} +1 -1
- package/dist/web/assets/{razor-CATEbAgj.js → razor-D0oItoxm.js} +1 -1
- package/dist/web/assets/{tsMode-BULlPLGv.js → tsMode-5WrTYXyf.js} +1 -1
- package/dist/web/assets/{typescript-Cwd0ePfj.js → typescript-BvBpgcZL.js} +1 -1
- package/dist/web/assets/{workers-C57gUq9G.js → workers-DFvt3dCi.js} +1 -1
- package/dist/web/assets/{xml-DjQsY_vM.js → xml-Dxottn9D.js} +1 -1
- package/dist/web/assets/{yaml-BOOR4cPJ.js → yaml-B8OI7mBu.js} +1 -1
- package/dist/web/index.html +12 -3
- package/package.json +2 -2
- package/skills/evidra/SKILL.md +4 -0
- package/skills/evidra-share/SKILL.md +23 -0
- package/skills/evidra-share/scripts/share.sh +237 -0
- package/skills/evidra-share/scripts/status.sh +88 -0
- package/skills/evidra-share/scripts/tunnel-watch.sh +34 -0
- package/dist/web/assets/ProjectFileEditor-Drd5hhbo.js +0 -90
- package/dist/web/assets/ProjectFileEditor-uqf4b7Mq.css +0 -1
- package/dist/web/assets/main-DKZIIy2T.css +0 -2
- package/dist/web/assets/main-IQ1sFdJO.js +0 -26
- package/dist/web/assets/main-rJTrPQRY.js +0 -18
package/dist/service/cli.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// packages/service/src/cli.ts
|
|
2
2
|
import { cac } from "cac";
|
|
3
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
3
4
|
import path36 from "node:path";
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
4
6
|
|
|
5
7
|
// modules/core/implementations/Functions/resolveConfig.ts
|
|
6
8
|
import path3 from "node:path";
|
|
@@ -1498,15 +1500,15 @@ async function worktreeSide(repo, file) {
|
|
|
1498
1500
|
const relative = path18.relative(repo, parent);
|
|
1499
1501
|
if (relative === ".." || relative.startsWith(`..${path18.sep}`) || path18.isAbsolute(relative))
|
|
1500
1502
|
throw new Error("\u6587\u4EF6\u4E0D\u5728\u4ED3\u5E93\u5185");
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
if (
|
|
1503
|
+
const stat4 = await lstat(absolute);
|
|
1504
|
+
if (stat4.isSymbolicLink()) return { mode: "120000", hash: hash(await readlink(absolute)) };
|
|
1505
|
+
if (stat4.isDirectory()) {
|
|
1504
1506
|
const commit = (await git(absolute, ["rev-parse", "HEAD"])).trim();
|
|
1505
1507
|
return { mode: "160000", hash: hash(`Subproject commit ${commit}
|
|
1506
1508
|
`) };
|
|
1507
1509
|
}
|
|
1508
1510
|
return {
|
|
1509
|
-
mode:
|
|
1511
|
+
mode: stat4.mode & 73 ? "100755" : "100644",
|
|
1510
1512
|
hash: await fileDigest(absolute)
|
|
1511
1513
|
};
|
|
1512
1514
|
}
|
|
@@ -2023,12 +2025,12 @@ async function getGitDiff(input) {
|
|
|
2023
2025
|
const relative = path24.relative(repo, parent);
|
|
2024
2026
|
if (relative === ".." || relative.startsWith(`..${path24.sep}`) || path24.isAbsolute(relative))
|
|
2025
2027
|
throw new Error("\u6587\u4EF6\u4E0D\u5728\u4ED3\u5E93\u5185");
|
|
2026
|
-
const
|
|
2027
|
-
if (
|
|
2028
|
-
else if (
|
|
2028
|
+
const stat4 = await lstat2(absolute);
|
|
2029
|
+
if (stat4.isSymbolicLink()) modified = await readlink2(absolute);
|
|
2030
|
+
else if (stat4.isDirectory())
|
|
2029
2031
|
modified = `Subproject commit ${(await git(absolute, ["rev-parse", "HEAD"])).trim()}
|
|
2030
2032
|
`;
|
|
2031
|
-
else if (
|
|
2033
|
+
else if (stat4.size > MAX_BYTES) tooLarge = true;
|
|
2032
2034
|
else modified = await readFile10(absolute, "utf8");
|
|
2033
2035
|
}
|
|
2034
2036
|
const isBinary = original.includes("\0") || modified.includes("\0");
|
|
@@ -2045,6 +2047,7 @@ async function getGitDiff(input) {
|
|
|
2045
2047
|
|
|
2046
2048
|
// modules/core/implementations/Functions/projectFiles.ts
|
|
2047
2049
|
import { isUtf8 } from "node:buffer";
|
|
2050
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
2048
2051
|
import { constants } from "node:fs";
|
|
2049
2052
|
import { lstat as lstat3, open, readdir as readdir3, readlink as readlink3, realpath as realpath3 } from "node:fs/promises";
|
|
2050
2053
|
import path25 from "node:path";
|
|
@@ -2063,6 +2066,29 @@ var ReadProjectFileInputSchema = z20.object({
|
|
|
2063
2066
|
|
|
2064
2067
|
// modules/core/implementations/Functions/projectFiles.ts
|
|
2065
2068
|
var pageBytes = 256 * 1024;
|
|
2069
|
+
function findIgnoredPaths(repoRoot, paths) {
|
|
2070
|
+
if (!paths.length) return Promise.resolve(/* @__PURE__ */ new Set());
|
|
2071
|
+
return new Promise((resolve) => {
|
|
2072
|
+
const child = spawn2("git", ["-C", repoRoot, "check-ignore", "--stdin", "-z"], {
|
|
2073
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
2074
|
+
timeout: 2e4,
|
|
2075
|
+
windowsHide: true
|
|
2076
|
+
});
|
|
2077
|
+
const chunks = [];
|
|
2078
|
+
child.stdout.on("data", (chunk) => chunks.push(chunk));
|
|
2079
|
+
child.on("error", () => resolve(/* @__PURE__ */ new Set()));
|
|
2080
|
+
child.on("close", (code) => {
|
|
2081
|
+
if (code !== 0) {
|
|
2082
|
+
resolve(/* @__PURE__ */ new Set());
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
resolve(new Set(Buffer.concat(chunks).toString("utf8").split("\0").filter(Boolean)));
|
|
2086
|
+
});
|
|
2087
|
+
child.stdin.on("error", () => {
|
|
2088
|
+
});
|
|
2089
|
+
child.stdin.end(paths.join("\0") + "\0");
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2066
2092
|
async function projectPath(root, relative, directory) {
|
|
2067
2093
|
const parts = relative ? relative.split("/") : [];
|
|
2068
2094
|
if (parts.some(
|
|
@@ -2083,9 +2109,18 @@ async function listProjectFiles(input) {
|
|
|
2083
2109
|
const entries2 = await readdir3(await projectPath(repoRoot, directory, true), {
|
|
2084
2110
|
withFileTypes: true
|
|
2085
2111
|
});
|
|
2086
|
-
|
|
2112
|
+
const sorted = entries2.filter(
|
|
2087
2113
|
(entry) => entry.name.toLowerCase() !== ".git" && (entry.isFile() || entry.isDirectory() || entry.isSymbolicLink())
|
|
2088
2114
|
).map((entry) => ({ name: entry.name, directory: entry.isDirectory() })).sort((a, b) => Number(b.directory) - Number(a.directory) || a.name.localeCompare(b.name));
|
|
2115
|
+
const queries = sorted.map((entry) => {
|
|
2116
|
+
const relative = directory ? `${directory}/${entry.name}` : entry.name;
|
|
2117
|
+
return entry.directory ? `${relative}/` : relative;
|
|
2118
|
+
});
|
|
2119
|
+
const ignored = await findIgnoredPaths(repoRoot, queries);
|
|
2120
|
+
return sorted.map((entry, index) => ({
|
|
2121
|
+
...entry,
|
|
2122
|
+
ignored: ignored.has(queries[index])
|
|
2123
|
+
}));
|
|
2089
2124
|
}
|
|
2090
2125
|
async function readProjectFile(input) {
|
|
2091
2126
|
const { repoRoot, file, offset } = ReadProjectFileInputSchema.parse(input);
|
|
@@ -2732,6 +2767,8 @@ import process2 from "node:process";
|
|
|
2732
2767
|
import { serve } from "@hono/node-server";
|
|
2733
2768
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
2734
2769
|
import { Hono as Hono2 } from "hono";
|
|
2770
|
+
import { csrf } from "hono/csrf";
|
|
2771
|
+
import { HTTPException } from "hono/http-exception";
|
|
2735
2772
|
import { existsSync as existsSync2 } from "node:fs";
|
|
2736
2773
|
import { stat as stat3 } from "node:fs/promises";
|
|
2737
2774
|
import path33 from "node:path";
|
|
@@ -2863,6 +2900,44 @@ function createConformanceRoutes(root) {
|
|
|
2863
2900
|
return app;
|
|
2864
2901
|
}
|
|
2865
2902
|
|
|
2903
|
+
// packages/service/src/reportSession.ts
|
|
2904
|
+
import { createHash as createHash4, randomBytes, timingSafeEqual } from "node:crypto";
|
|
2905
|
+
import { getCookie, setCookie } from "hono/cookie";
|
|
2906
|
+
|
|
2907
|
+
// packages/client-sdk/src/error.ts
|
|
2908
|
+
var REPORT_PASSWORD_REQUIRED = "REPORT_PASSWORD_REQUIRED";
|
|
2909
|
+
var REPORT_PASSWORD_INVALID = "REPORT_PASSWORD_INVALID";
|
|
2910
|
+
|
|
2911
|
+
// packages/service/src/reportSession.ts
|
|
2912
|
+
function createReportSession(password) {
|
|
2913
|
+
const passwordHash = createHash4("sha256").update(password).digest();
|
|
2914
|
+
const token = randomBytes(32).toString("base64url");
|
|
2915
|
+
const cookieName = (context) => `evidra_session_${new URL(context.req.url).port || "default"}`;
|
|
2916
|
+
const requireSession = async (context, next) => {
|
|
2917
|
+
if (getCookie(context, cookieName(context)) !== token) {
|
|
2918
|
+
context.header("Cache-Control", "no-store");
|
|
2919
|
+
return context.json({ code: REPORT_PASSWORD_REQUIRED, error: "\u8BF7\u8F93\u5165\u62A5\u544A\u5BC6\u7801" }, 401);
|
|
2920
|
+
}
|
|
2921
|
+
await next();
|
|
2922
|
+
};
|
|
2923
|
+
async function login(context) {
|
|
2924
|
+
if (context.req.header("Content-Type")?.split(";")[0]?.trim().toLowerCase() !== "application/json")
|
|
2925
|
+
return context.json({ error: "\u8BF7\u4F7F\u7528 JSON \u63D0\u4EA4\u5BC6\u7801" }, 415);
|
|
2926
|
+
const body = await context.req.json().catch(() => null);
|
|
2927
|
+
if (typeof body?.password !== "string" || !timingSafeEqual(createHash4("sha256").update(body.password).digest(), passwordHash)) {
|
|
2928
|
+
return context.json({ code: REPORT_PASSWORD_INVALID, error: "\u5BC6\u7801\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u3002" }, 401);
|
|
2929
|
+
}
|
|
2930
|
+
setCookie(context, cookieName(context), token, {
|
|
2931
|
+
httpOnly: true,
|
|
2932
|
+
sameSite: "Strict",
|
|
2933
|
+
secure: new URL(context.req.url).protocol === "https:",
|
|
2934
|
+
path: "/"
|
|
2935
|
+
});
|
|
2936
|
+
return context.body(null, 204);
|
|
2937
|
+
}
|
|
2938
|
+
return { login, requireSession };
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2866
2941
|
// packages/service/src/server.ts
|
|
2867
2942
|
function defaultWebDist() {
|
|
2868
2943
|
const fromSource = path33.resolve(import.meta.dirname, "../../../dist/web");
|
|
@@ -2873,7 +2948,8 @@ async function startServer(options) {
|
|
|
2873
2948
|
const root = path33.resolve(options.repoRoot);
|
|
2874
2949
|
await loadConfig({ repoRoot: root });
|
|
2875
2950
|
const webDist = options.webDist ?? defaultWebDist();
|
|
2876
|
-
|
|
2951
|
+
if (options.password === "") throw new Error("\u62A5\u544A\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A");
|
|
2952
|
+
const app = createApp(root, webDist, options.password);
|
|
2877
2953
|
let server;
|
|
2878
2954
|
const address = await new Promise((resolve, reject) => {
|
|
2879
2955
|
server = serve(
|
|
@@ -2911,9 +2987,10 @@ function projectFileError(error) {
|
|
|
2911
2987
|
throw new Error("\u65E0\u6CD5\u8BFB\u53D6\u6587\u4EF6\u6216\u76EE\u5F55\u3002");
|
|
2912
2988
|
}
|
|
2913
2989
|
}
|
|
2914
|
-
function createApp(root, webDist) {
|
|
2990
|
+
function createApp(root, webDist, password) {
|
|
2915
2991
|
const app = new Hono2();
|
|
2916
2992
|
app.onError((error, context) => {
|
|
2993
|
+
if (error instanceof HTTPException) return context.json({ error: error.message }, error.status);
|
|
2917
2994
|
const status = error instanceof z28.ZodError ? 400 : error.statusCode ?? 500;
|
|
2918
2995
|
return context.json({ error: String(error.message ?? error) }, status);
|
|
2919
2996
|
});
|
|
@@ -2921,6 +2998,13 @@ function createApp(root, webDist) {
|
|
|
2921
2998
|
context.header("Cache-Control", "no-store");
|
|
2922
2999
|
await next();
|
|
2923
3000
|
});
|
|
3001
|
+
if (password !== void 0) {
|
|
3002
|
+
const session = createReportSession(password);
|
|
3003
|
+
app.post("/api/session", session.login);
|
|
3004
|
+
app.use("/api/*", session.requireSession);
|
|
3005
|
+
app.use("/api/*", csrf());
|
|
3006
|
+
app.use("/report-static/*", session.requireSession);
|
|
3007
|
+
}
|
|
2924
3008
|
app.get(
|
|
2925
3009
|
"/api/project",
|
|
2926
3010
|
async (context) => context.json(await readProjectInfo({ repoRoot: root }))
|
|
@@ -3059,8 +3143,16 @@ function createApp(root, webDist) {
|
|
|
3059
3143
|
`W/"${stats.size.toString(16)}-${stats.mtimeMs.toString(16)}-${stats.ctimeMs.toString(16)}"`
|
|
3060
3144
|
);
|
|
3061
3145
|
const relativePath = path33.relative(webDist, filePath).split(path33.sep).join("/");
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3146
|
+
const reportFile = context.req.path.startsWith("/report-static/");
|
|
3147
|
+
if (reportFile && password !== void 0) {
|
|
3148
|
+
context.header("Cache-Control", "private, no-cache");
|
|
3149
|
+
} else {
|
|
3150
|
+
const immutable = reportFile ? /(?:^|[-/])[a-f0-9]{64}\.png$/.test(context.req.path) : /^assets\/.+-[\w-]{8,}\.[\w.]+$/.test(relativePath);
|
|
3151
|
+
context.header(
|
|
3152
|
+
"Cache-Control",
|
|
3153
|
+
immutable ? "public, max-age=31536000, immutable" : "no-cache"
|
|
3154
|
+
);
|
|
3155
|
+
}
|
|
3064
3156
|
if (context.res.status !== 200 || !["GET", "HEAD"].includes(context.req.method)) return;
|
|
3065
3157
|
const etag = context.res.headers.get("ETag");
|
|
3066
3158
|
if (!etag) return;
|
|
@@ -3106,13 +3198,13 @@ function createApp(root, webDist) {
|
|
|
3106
3198
|
|
|
3107
3199
|
// packages/service/src/index.ts
|
|
3108
3200
|
async function startWorkbench(options) {
|
|
3109
|
-
const {
|
|
3110
|
-
const server = await startServer({ repoRoot, port, host: "0.0.0.0" });
|
|
3201
|
+
const server = await startServer({ ...options, host: "0.0.0.0" });
|
|
3111
3202
|
console.log(`
|
|
3112
3203
|
\u6D4B\u8BD5\u62A5\u544A\u670D\u52A1\u5DF2\u542F\u52A8`);
|
|
3113
|
-
console.log(`\u4ED3\u5E93: ${repoRoot}`);
|
|
3204
|
+
console.log(`\u4ED3\u5E93: ${options.repoRoot}`);
|
|
3114
3205
|
console.log(`\u5730\u5740: ${server.url}`);
|
|
3115
3206
|
console.log(`\u9875\u9762: ${server.url}/`);
|
|
3207
|
+
if (options.password !== void 0) console.log(`\u5BC6\u7801: ${options.password}`);
|
|
3116
3208
|
console.log(`\u505C\u6B62: Ctrl+C
|
|
3117
3209
|
`);
|
|
3118
3210
|
let stopping = false;
|
|
@@ -3127,40 +3219,40 @@ async function startWorkbench(options) {
|
|
|
3127
3219
|
}
|
|
3128
3220
|
|
|
3129
3221
|
// packages/service/src/init.ts
|
|
3130
|
-
import {
|
|
3222
|
+
import { existsSync as existsSync3, statSync } from "node:fs";
|
|
3223
|
+
import { cp, readdir as readdir6, rm as rm6, writeFile as writeFile3 } from "node:fs/promises";
|
|
3131
3224
|
import path34 from "node:path";
|
|
3225
|
+
var skillsDirectory = [
|
|
3226
|
+
path34.resolve(import.meta.dirname, "../../../skills"),
|
|
3227
|
+
path34.resolve(import.meta.dirname, "../../skills")
|
|
3228
|
+
].find((directory) => existsSync3(directory));
|
|
3229
|
+
var warning = `# \u8BF7\u52FF\u4FEE\u6539\u6B64\u76EE\u5F55
|
|
3230
|
+
|
|
3231
|
+
\u6B64\u76EE\u5F55\u7531 \`evidra init\` \u751F\u6210\u3002\u6BCF\u6B21\u8FD0\u884C \`evidra init\` \u90FD\u4F1A\u5220\u9664\u5E76\u91CD\u65B0\u5199\u5165\u6574\u4E2A\u76EE\u5F55\uFF0C\u5728\u8FD9\u91CC\u505A\u7684\u4FEE\u6539\u4F1A\u4E22\u5931\u3002
|
|
3232
|
+
|
|
3233
|
+
\u5982\u9700\u81EA\u5B9A\u4E49\uFF0C\u8BF7\u628A\u76EE\u5F55\u590D\u5236\u4E3A\u5176\u4ED6\u540D\u5B57\uFF0C\u5E76\u4FEE\u6539\u5176\u4E2D SKILL.md \u7684 \`name\`\u3002
|
|
3234
|
+
`;
|
|
3132
3235
|
async function initProject(directory) {
|
|
3133
3236
|
const root = path34.resolve(directory);
|
|
3134
|
-
|
|
3237
|
+
if (!skillsDirectory) throw new Error("\u672A\u627E\u5230\u968F\u5305\u63D0\u4F9B\u7684 skills \u76EE\u5F55");
|
|
3238
|
+
const skills = (await readdir6(skillsDirectory, { withFileTypes: true })).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name);
|
|
3135
3239
|
const messages = [];
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
for (const agent of [".claude", ".codex"]) {
|
|
3151
|
-
let exists = false;
|
|
3152
|
-
try {
|
|
3153
|
-
exists = (await stat4(path34.join(root, agent))).isDirectory();
|
|
3154
|
-
} catch (error) {
|
|
3155
|
-
if (error.code !== "ENOENT") throw error;
|
|
3240
|
+
const agents = [".claude", ".codex"];
|
|
3241
|
+
if (statSync(path34.join(root, ".agents"), { throwIfNoEntry: false })?.isDirectory()) {
|
|
3242
|
+
agents.push(".agents");
|
|
3243
|
+
}
|
|
3244
|
+
for (const agent of agents) {
|
|
3245
|
+
for (const skill of skills) {
|
|
3246
|
+
const target = path34.join(root, agent, "skills", skill);
|
|
3247
|
+
await rm6(target, { recursive: true, force: true });
|
|
3248
|
+
await cp(path34.join(skillsDirectory, skill), target, {
|
|
3249
|
+
recursive: true,
|
|
3250
|
+
filter: (source) => !path34.basename(source).startsWith(".")
|
|
3251
|
+
});
|
|
3252
|
+
await writeFile3(path34.join(target, "DO_NOT_EDIT.md"), warning);
|
|
3253
|
+
messages.push(`\u5DF2\u5199\u5165 ${path34.relative(root, target)}`);
|
|
3156
3254
|
}
|
|
3157
|
-
if (!exists) continue;
|
|
3158
|
-
injected = true;
|
|
3159
|
-
const target = path34.join(root, agent, "skills/evidra");
|
|
3160
|
-
await mkdir3(target, { recursive: true });
|
|
3161
|
-
await create(path34.join(target, "SKILL.md"), skill);
|
|
3162
3255
|
}
|
|
3163
|
-
if (!injected) messages.push("\u672A\u53D1\u73B0 .claude \u6216 .codex \u6587\u4EF6\u5939\uFF0C\u672A\u6CE8\u5165\u4EFB\u4F55 skill\u3002");
|
|
3164
3256
|
return messages;
|
|
3165
3257
|
}
|
|
3166
3258
|
|
|
@@ -3210,18 +3302,37 @@ async function runConformance(directory) {
|
|
|
3210
3302
|
|
|
3211
3303
|
// packages/service/src/cli.ts
|
|
3212
3304
|
var cli = cac("evidra");
|
|
3213
|
-
|
|
3305
|
+
function startPassword() {
|
|
3306
|
+
const { tokens } = parseArgs({
|
|
3307
|
+
strict: false,
|
|
3308
|
+
allowPositionals: true,
|
|
3309
|
+
tokens: true,
|
|
3310
|
+
options: { repo: { type: "string" }, port: { type: "string" } }
|
|
3311
|
+
});
|
|
3312
|
+
let password;
|
|
3313
|
+
for (const [index, token] of tokens.entries()) {
|
|
3314
|
+
if (token.kind !== "option") continue;
|
|
3315
|
+
if (!cli.matchedCommand?.hasOption(token.name)) throw new Error(`\u672A\u77E5\u53C2\u6570\uFF1A${token.rawName}`);
|
|
3316
|
+
if (token.name !== "password") continue;
|
|
3317
|
+
if (password !== void 0) throw new Error("\u8BF7\u53EA\u6307\u5B9A\u4E00\u6B21 --password");
|
|
3318
|
+
const next = tokens[index + 1];
|
|
3319
|
+
password = token.value ?? (next?.kind === "positional" ? next.value : randomBytes2(16).toString("base64url"));
|
|
3320
|
+
}
|
|
3321
|
+
return password;
|
|
3322
|
+
}
|
|
3323
|
+
cli.command("init [path]", "\u590D\u5236 skill \u5230 .claude\u3001.codex \u548C\u5DF2\u5B58\u5728\u7684 .agents\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").action(async (target) => {
|
|
3214
3324
|
const root = path36.resolve(target ?? process.cwd());
|
|
3215
3325
|
console.log(`\u521D\u59CB\u5316 Evidra\uFF1A${root}`);
|
|
3216
3326
|
for (const message of await initProject(root)) console.log(message);
|
|
3217
3327
|
});
|
|
3218
|
-
cli.command("start", "\u542F\u52A8\u5DE5\u4F5C\u53F0\uFF0C\u670D\u52A1\u5728\u524D\u53F0\u8FD0\u884C\uFF0C\u6309 Ctrl+C \u505C\u6B62").option("--repo <path>", "\u4ED3\u5E93\u8DEF\u5F84\uFF0C\u9ED8\u8BA4 TEST_REPORT_REPO \u6216\u5F53\u524D\u76EE\u5F55").option("--port <port>", "\u7AEF\u53E3\uFF0C\u9ED8\u8BA4 TEST_REPORT_PORT \u6216 4175").action(async (options) => {
|
|
3328
|
+
cli.command("start", "\u542F\u52A8\u5DE5\u4F5C\u53F0\uFF0C\u670D\u52A1\u5728\u524D\u53F0\u8FD0\u884C\uFF0C\u6309 Ctrl+C \u505C\u6B62").option("--repo <path>", "\u4ED3\u5E93\u8DEF\u5F84\uFF0C\u9ED8\u8BA4 TEST_REPORT_REPO \u6216\u5F53\u524D\u76EE\u5F55").option("--port <port>", "\u7AEF\u53E3\uFF0C\u9ED8\u8BA4 TEST_REPORT_PORT \u6216 4175").option("--password [value]", "\u542F\u7528\u62A5\u544A\u5BC6\u7801\u4FDD\u62A4\uFF0C\u7701\u7565\u503C\u65F6\u968F\u673A\u751F\u6210\uFF1B\u9ED8\u8BA4\u514D\u5BC6").action(async (options) => {
|
|
3219
3329
|
const port = Number(options.port ?? process.env.TEST_REPORT_PORT ?? "4175");
|
|
3220
3330
|
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
3221
3331
|
throw new Error("\u7AEF\u53E3\u5FC5\u987B\u662F 1\u201365535 \u7684\u6574\u6570");
|
|
3222
3332
|
await startWorkbench({
|
|
3223
3333
|
repoRoot: path36.resolve(options.repo ?? process.env.TEST_REPORT_REPO ?? process.cwd()),
|
|
3224
|
-
port
|
|
3334
|
+
port,
|
|
3335
|
+
password: startPassword()
|
|
3225
3336
|
});
|
|
3226
3337
|
});
|
|
3227
3338
|
cli.command("compare", "\u8C03\u7528 core \u6BD4\u8F83\u4EFB\u52A1\u548C\u57FA\u7EBF\uFF0C\u8F93\u51FA summary").option("--repo <path>", "\u4ED3\u5E93\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").option("--task-id <id>", "\u4EFB\u52A1 ID").option("--full", "\u8F93\u51FA\u5B8C\u6574\u6BD4\u8F83\u7ED3\u679C").action(async (options) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
body:has(.report-access){min-width:0}.report-access{min-height:100dvh;color:var(--hb-ink);display:grid}.report-access-panel{flex-direction:column;min-width:0;display:flex}.report-access-header{flex-direction:column;display:flex}.report-access-title{color:var(--hb-ink);margin:0;font-weight:600}.report-access-description{color:var(--hb-muted);margin:0}.report-access-field{flex-direction:column;min-width:0;display:flex}.report-access-label{font-weight:500;display:block}.report-access-input{appearance:none;border:1px solid var(--hb-input-line);background:var(--hb-input);width:100%;min-width:0;color:var(--hb-ink);font:inherit;outline:none;transition:border-color .12s,box-shadow .12s;display:block}.report-access-input::selection{background:var(--hb-accent-soft);color:var(--hb-ink)}.report-access-input[aria-invalid=true]{border-color:var(--hb-danger)}.report-access-error{color:var(--hb-danger);margin:0}.report-access-button{font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap;border:0;border-radius:9999px;justify-content:center;align-items:center;transition:background-color .15s,color .15s,opacity .15s,transform .12s;display:inline-flex}.report-access-button.is-primary{background:var(--hb-accent);width:100%;color:var(--hb-accent-contrast)}.report-access .report-access-button:focus-visible{outline:1.5px solid var(--hb-accent);outline-offset:2px}.report-access-button:disabled{cursor:default}.report-access[data-variant=desktop]{background:var(--hb-surface-alt);place-items:center;padding:24px 24px 8vh}.report-access[data-variant=desktop] .report-access-panel{border-radius:var(--radius-panel,12px);background:var(--hb-surface);width:min(100%,348px);box-shadow:var(--hb-control-shadow);padding:24px}.report-access[data-variant=desktop] .report-access-title{letter-spacing:-.01em;font-size:16px;line-height:22px}.report-access[data-variant=desktop] .report-access-description{font-size:var(--text-ui-body,13px);margin-top:4px;line-height:20px}.report-access[data-variant=desktop] .report-access-field{margin-top:20px}.report-access[data-variant=desktop] .report-access-label{color:var(--hb-body);font-size:var(--text-label,12px);margin-bottom:6px;line-height:16px}.report-access[data-variant=desktop] .report-access-input{border-radius:var(--radius-control,8px);height:34px;box-shadow:var(--hb-panel-shadow);font-size:var(--text-ui-body,13px);padding:0 11px;line-height:20px}.report-access[data-variant=desktop] .report-access-input:not(:focus):not([aria-invalid=true]):hover{border-color:var(--hub-border-control-hover,color-mix(in srgb, var(--hb-ink) 22%, transparent))}.report-access[data-variant=desktop] .report-access-input:focus{border-color:var(--hb-accent);box-shadow:0 0 0 2px color-mix(in srgb, var(--hb-accent) 12%, transparent)}.report-access[data-variant=desktop] .report-access-input[aria-invalid=true]:focus{border-color:var(--hb-danger);box-shadow:0 0 0 2px color-mix(in srgb, var(--hb-danger) 12%, transparent)}.report-access[data-variant=desktop] .report-access-error{font-size:var(--text-label,12px);margin-top:6px;line-height:18px}.report-access[data-variant=desktop] .report-access-button{height:32px;font-size:var(--text-ui-body,13px);padding:0 16px;font-weight:500;line-height:normal}.report-access[data-variant=desktop] .report-access-button.is-primary{box-shadow:var(--hb-panel-shadow);margin-top:16px}.report-access[data-variant=desktop] .report-access-button.is-primary:enabled:hover{background:var(--hb-accent-hover)}.report-access[data-variant=desktop] .report-access-button.is-primary:disabled{opacity:.45}.report-access[data-variant=desktop] .report-access-button.is-primary[data-pending=true]{opacity:.72}@media (width<=420px){.report-access[data-variant=desktop]{padding-inline:12px}.report-access[data-variant=desktop] .report-access-panel{padding:20px 16px}}@media (height<=460px){.report-access[data-variant=desktop]{padding-block:16px}.report-access[data-variant=desktop] .report-access-panel{padding-block:20px}.report-access[data-variant=desktop] .report-access-field,.report-access[data-variant=desktop] .report-access-button.is-primary{margin-top:14px}}.report-access[data-variant=mobile]{padding:calc(env(safe-area-inset-top) + clamp(52px, 14dvh, 116px)) max(24px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 28px) max(24px, env(safe-area-inset-left));background:var(--hb-canvas);align-content:start;justify-items:center}.report-access[data-variant=mobile] .report-access-panel{width:min(100%,400px)}.report-access[data-variant=mobile] .report-access-title{letter-spacing:-.02em;font-size:22px;line-height:1.25}.report-access[data-variant=mobile] .report-access-description{margin-top:6px;font-size:14.5px;line-height:1.5}.report-access[data-variant=mobile] .report-access-field{margin-top:28px}.report-access[data-variant=mobile] .report-access-label{color:var(--hb-muted);margin-bottom:8px;font-size:13px;line-height:1.4}.report-access[data-variant=mobile] .report-access-input{border-radius:12px;height:48px;padding:0 14px;font-size:16px;line-height:1.4}.report-access[data-variant=mobile] .report-access-input:focus{border-color:var(--hb-accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--hb-accent) 12%, transparent)}.report-access[data-variant=mobile] .report-access-input[aria-invalid=true]:focus{border-color:var(--hb-danger);box-shadow:0 0 0 3px color-mix(in srgb, var(--hb-danger) 12%, transparent)}.report-access[data-variant=mobile] .report-access-error{margin-top:8px;font-size:13px;line-height:1.45}.report-access[data-variant=mobile] .report-access-button{height:46px;padding:0 24px;font-size:15px;font-weight:600}.report-access[data-variant=mobile] .report-access-button.is-primary{margin-top:20px}.report-access[data-variant=mobile] .report-access-button.is-primary:enabled:active{background:var(--hb-accent-hover)}.report-access[data-variant=mobile] .report-access-button.is-primary:disabled{opacity:.4}.report-access[data-variant=mobile] .report-access-button.is-primary[data-pending=true]{opacity:.72}@media (width<=359px){.report-access[data-variant=mobile]{padding-right:max(var(--m-gutter,16px), env(safe-area-inset-right));padding-left:max(var(--m-gutter,16px), env(safe-area-inset-left))}}@media (height<=500px){.report-access[data-variant=mobile]{padding-top:calc(env(safe-area-inset-top) + 16px);padding-bottom:calc(env(safe-area-inset-bottom) + 16px);align-content:center}.report-access[data-variant=mobile] .report-access-title{font-size:19px;line-height:24px}.report-access[data-variant=mobile] .report-access-description{margin-top:4px;font-size:13.5px;line-height:19px}.report-access[data-variant=mobile] .report-access-field{margin-top:14px}.report-access[data-variant=mobile] .report-access-label{margin-bottom:6px}.report-access[data-variant=mobile] .report-access-input{height:44px}.report-access[data-variant=mobile] .report-access-error{margin-top:6px}.report-access[data-variant=mobile] .report-access-button{height:44px}.report-access[data-variant=mobile] .report-access-button.is-primary{margin-top:14px}}@media (prefers-reduced-motion:no-preference){.report-access[data-variant=mobile] .report-access-button:enabled:active{transform:scale(.985)}}@media (prefers-reduced-motion:reduce){.report-access-input,.report-access-button{transition:none}}:root{--file-icon-folder:#6d7b8c;--file-icon-ts:#2b6cb0;--file-icon-tsx:#0284c7;--file-icon-js:#b7791f;--file-icon-jsx:#0891b2;--file-icon-json:#b45309;--file-icon-css:#2563eb;--file-icon-scss:#db2777;--file-icon-html:#dc4c24;--file-icon-md:#2563eb;--file-icon-yaml:#7c3aed;--file-icon-shell:#15803d;--file-icon-git:#de4c36;--file-icon-npm:#cb3837;--file-icon-test:#0d9488;--file-icon-image:#7c3aed;--file-icon-svg:#d97706;--file-icon-font:#e11d48;--file-icon-vue:#15803d;--file-icon-svelte:#ea580c;--file-icon-python:#2b6cb0;--file-icon-go:#0089ad;--file-icon-rust:#b45309;--file-icon-ruby:#dc2626;--file-icon-docker:#0284c7;--file-icon-db:#0d9488;--file-icon-graphql:#db2777;--file-icon-env:#ca8a04;--file-icon-lock:#78716c;--file-icon-config:#64748b;--file-icon-archive:#a16207;--file-icon-pdf:#dc2626;--file-icon-default:var(--hb-faint)}@media (prefers-color-scheme:dark){.m-app{--file-icon-folder:#8e9baa;--file-icon-ts:#569cd6;--file-icon-tsx:#4fc1ff;--file-icon-js:#e5c04b;--file-icon-jsx:#61dafb;--file-icon-json:#e5b54c;--file-icon-css:#5ea1ff;--file-icon-scss:#f472b6;--file-icon-html:#e86f4c;--file-icon-md:#60a5fa;--file-icon-yaml:#b983ff;--file-icon-shell:#4ade80;--file-icon-git:#f06a4d;--file-icon-npm:#e56362;--file-icon-test:#2dd4bf;--file-icon-image:#a78bfa;--file-icon-svg:#fbbf24;--file-icon-font:#fb7185;--file-icon-vue:#42b883;--file-icon-svelte:#ff6b3d;--file-icon-python:#63b3ed;--file-icon-go:#29beb0;--file-icon-rust:#e08a56;--file-icon-ruby:#f87171;--file-icon-docker:#38bdf8;--file-icon-db:#2dd4bf;--file-icon-graphql:#f472b6;--file-icon-env:#eab308;--file-icon-lock:#a8a29e;--file-icon-config:#94a3b8;--file-icon-archive:#eab308;--file-icon-pdf:#f87171}}.file-icon{flex:none;display:block}.file-icon.is-muted{opacity:.5}.project-file-tree :is(.report-tree-label,.m-tree-label){flex:0 auto}.project-file-tree .report-tree-trailing{margin-left:0}.project-folder-loading{color:var(--hb-muted)}.project-folder-error{color:var(--hb-danger);display:inline-flex}@media (prefers-reduced-motion:no-preference){.project-folder-loading{animation:.9s linear infinite project-folder-spin}}@keyframes project-folder-spin{to{transform:rotate(360deg)}}.project-file-editor{flex:1;min-height:120px;position:relative}.project-file-editor-host,.project-file-fallback{position:absolute;inset:0}.project-file-fallback{font:12px/1.7 var(--font-metadata,var(--m-font-mono,monospace));tab-size:4;background:var(--hb-surface);margin:0;padding:12px 16px;overflow:auto}.m-project-file-page{flex-direction:column;display:flex}.m-project-file-section:has(.project-file-editor){flex-direction:column;display:flex}.m-project-file-section>.m-code-block:has(.project-file-editor){flex-direction:column;display:flex}.m-project-file-section:has(.project-file-editor){flex:1;min-height:0}.m-project-file-section>.m-code-block:has(.project-file-editor){flex:1;min-height:0}.m-code-block>.project-file-editor{background:var(--hb-surface);border:1px solid var(--hb-separator);border-radius:10px;overflow:hidden}.m-project-file-section .m-empty{overflow-wrap:anywhere}
|