mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-19 22:10:51 +00:00
fix: restore full gate
This commit is contained in:
@@ -14,6 +14,18 @@ const SECRET_TARGET_CALLSITES = [
|
||||
"src/commands/status.scan.ts",
|
||||
] as const;
|
||||
|
||||
async function readCommandSource(relativePath: string): Promise<string> {
|
||||
const absolutePath = path.join(process.cwd(), relativePath);
|
||||
const source = await fs.readFile(absolutePath, "utf8");
|
||||
const reexportMatch = source.match(/^export \* from "(?<target>[^"]+)";$/m)?.groups?.target;
|
||||
if (!reexportMatch) {
|
||||
return source;
|
||||
}
|
||||
const resolvedTarget = path.join(path.dirname(absolutePath), reexportMatch);
|
||||
const tsResolvedTarget = resolvedTarget.replace(/\.js$/u, ".ts");
|
||||
return await fs.readFile(tsResolvedTarget, "utf8");
|
||||
}
|
||||
|
||||
function hasSupportedTargetIdsWiring(source: string): boolean {
|
||||
return (
|
||||
/targetIds:\s*get[A-Za-z0-9_]+\(\)/m.test(source) ||
|
||||
@@ -25,8 +37,7 @@ describe("command secret resolution coverage", () => {
|
||||
it.each(SECRET_TARGET_CALLSITES)(
|
||||
"routes target-id command path through shared gateway resolver: %s",
|
||||
async (relativePath) => {
|
||||
const absolutePath = path.join(process.cwd(), relativePath);
|
||||
const source = await fs.readFile(absolutePath, "utf8");
|
||||
const source = await readCommandSource(relativePath);
|
||||
expect(source).toContain("resolveCommandSecretRefsViaGateway");
|
||||
expect(hasSupportedTargetIdsWiring(source)).toBe(true);
|
||||
expect(source).toContain("resolveCommandSecretRefsViaGateway({");
|
||||
|
||||
Reference in New Issue
Block a user