Simplify REA onboarding and app targeting

This commit is contained in:
morluto
2026-07-12 12:26:16 +08:00
parent 051b6db656
commit fc21c9a2d7
16 changed files with 608 additions and 367 deletions
+6 -10
View File
@@ -6,6 +6,7 @@ import { join } from "node:path";
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { parseBinaryTarget } from "../domain/binaryTarget.js";
import { probeHomebrew } from "./homebrew.js";
const execFileAsync = promisify(execFile);
@@ -25,7 +26,7 @@ export interface DoctorHost {
readonly nodeVersion: string;
readonly configuredHopperPath?: string;
macosVersion(): Promise<string | undefined>;
readable(path: string): Promise<boolean>;
validTarget(path: string): Promise<boolean>;
executable(path: string): Promise<boolean>;
brewHopperPath(): Promise<string | undefined>;
manualHopperPaths(): Promise<readonly string[]>;
@@ -89,9 +90,9 @@ export const runDoctor = async (
checks.push(
check(
"target",
await host.readable(target),
await host.validTarget(target),
target,
"Supply a readable local binary path.",
"Supply a readable local app or program path.",
),
);
return {
@@ -117,13 +118,8 @@ export const systemDoctorHost = (): DoctorHost => ({
return undefined;
}
},
async readable(path) {
try {
await access(path, constants.R_OK);
return true;
} catch {
return false;
}
async validTarget(path) {
return (await parseBinaryTarget(path)).ok;
},
async executable(path) {
try {
+7 -1
View File
@@ -276,8 +276,14 @@ const installCanonicalSkill = async (
PRODUCT_IDENTITY.skillName,
"SKILL.md",
);
const content = `---\nname: ${PRODUCT_IDENTITY.skillName}\ndescription: Analyze binaries with REA and Hopper.\n---\n\nOpen a target with open_binary, begin with binary_overview, and close it when finished.\n`;
try {
const content = await readFile(
new URL(
`../../skills/${PRODUCT_IDENTITY.skillName}/SKILL.md`,
import.meta.url,
),
"utf8",
);
if (
(await readFile(destination, "utf8").catch(() => undefined)) === content
)