fix(ci): use sha256sum on Windows and improve A2UI path resolution
This commit is contained in:
1 parent
c10d759c44
commit
0ac8f6e425
2 files changed
+37
-2
No files matched your search
@@ -18,6 +18,25 @@ export function resetA2uiCache(): void {
|
||||
resolvingA2uiRoot = null;
|
||||
}
|
||||
|
||||
async function findRepoRoot(startDir: string): Promise<string | null> {
|
||||
let dir = startDir;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
try {
|
||||
const pkgPath = path.join(dir, "package.json");
|
||||
await fs.stat(pkgPath);
|
||||
// Verify it's the clawdbot package
|
||||
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf8"));
|
||||
if (pkg.name === "clawdbot") return dir;
|
||||
} catch {
|
||||
// not found, go up
|
||||
}
|
||||
const parent = path.dirname(dir);
|
||||
if (parent === dir) break;
|
||||
dir = parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function resolveA2uiRoot(): Promise<string | null> {
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
const candidates = [
|
||||
@@ -32,6 +51,12 @@ async function resolveA2uiRoot(): Promise<string | null> {
|
||||
if (process.execPath) {
|
||||
candidates.unshift(path.resolve(path.dirname(process.execPath), "a2ui"));
|
||||
}
|
||||
// Find repo root by walking up from `here` (handles vitest/vite transforms).
|
||||
const repoRoot = await findRepoRoot(here);
|
||||
if (repoRoot) {
|
||||
candidates.push(path.resolve(repoRoot, "src/canvas-host/a2ui"));
|
||||
candidates.push(path.resolve(repoRoot, "dist/canvas-host/a2ui"));
|
||||
}
|
||||
|
||||
for (const dir of candidates) {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user