Sign In

@panerelay/setup

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@panerelay/setup - npm Package Compare versions

Comparing version
0.9.0
to
0.10.0
+32
dist/global-cli.d.ts
import { type CommandRunner } from '@panerelay/bridge/platform';
export declare const GLOBAL_CLI_INSTALL_TIMEOUT_MS: number;
export declare const GLOBAL_CLI_PROBE_TIMEOUT_MS = 10000;
export declare const GLOBAL_CLI_OWNERSHIP_PROTOCOL = "panerelay.setup-cli.v1";
export type GlobalCliOperation = 'current' | 'installed' | 'updated' | 'preserved' | 'removed' | 'absent';
export declare class GlobalCliLifecycleError extends Error {
readonly code: 'npm-unavailable' | 'operation-failed' | 'ownership-invalid';
readonly operation: 'install' | 'uninstall';
constructor(code: 'npm-unavailable' | 'operation-failed' | 'ownership-invalid', operation: 'install' | 'uninstall');
}
export interface GlobalCliLifecycleResult {
executablePath?: string;
managed: boolean;
operation: GlobalCliOperation;
packageSpec: string;
version?: string;
}
export interface GlobalCliLifecycleOptions {
cliExecutablePath?: false | string;
environment?: NodeJS.ProcessEnv;
homeDirectory?: string;
nodePath?: string;
packageManager?: string;
platform?: NodeJS.Platform;
runner?: CommandRunner;
timeoutMs?: number;
}
export declare function globalCliOwnershipPath(homeDirectory?: string): string;
export declare function globalCliPackageSpec(version: string): string;
export declare function installGlobalPanerelayCli(version: string, options?: GlobalCliLifecycleOptions): Promise<GlobalCliLifecycleResult>;
export declare function uninstallGlobalPanerelayCli(options?: GlobalCliLifecycleOptions): Promise<GlobalCliLifecycleResult>;
//# sourceMappingURL=global-cli.d.ts.map
{"version":3,"file":"global-cli.d.ts","sourceRoot":"","sources":["../src/global-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAOpC,eAAO,MAAM,6BAA6B,QAAa,CAAC;AACxD,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD,eA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GAAE,yBAA8B,GACtC,OAAO,CAAC,wBAAwB,CAAC,CAsDnC"}
import { resolveExecutablePath, resolveSpawnCommand, runCommand, } from '@panerelay/bridge/platform';
import { isPanerelayReleaseVersion } from '@panerelay/protocol';
import { randomBytes } from 'node:crypto';
import { lstat, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
import { homedir } from 'node:os';
import { dirname, join } from 'node:path';
export const GLOBAL_CLI_INSTALL_TIMEOUT_MS = 5 * 60_000;
export const GLOBAL_CLI_PROBE_TIMEOUT_MS = 10_000;
export const GLOBAL_CLI_OWNERSHIP_PROTOCOL = 'panerelay.setup-cli.v1';
export class GlobalCliLifecycleError extends Error {
code;
operation;
constructor(code, operation) {
super(code === 'npm-unavailable'
? 'npm is unavailable'
: code === 'ownership-invalid'
? 'The Panerelay CLI ownership record is invalid'
: `The global Panerelay CLI ${operation} did not complete successfully`);
this.code = code;
this.operation = operation;
this.name = 'GlobalCliLifecycleError';
}
}
export function globalCliOwnershipPath(homeDirectory = homedir()) {
return join(homeDirectory, '.panerelay', 'setup-cli.json');
}
export function globalCliPackageSpec(version) {
if (!isPanerelayReleaseVersion(version)) {
throw new Error('The global Panerelay CLI version must be an exact Panerelay release');
}
return `@panerelay/cli@${version}`;
}
async function resolvePackageManager(options, operation) {
if (options.packageManager)
return options.packageManager;
const environment = options.environment ?? process.env;
const nodePath = options.nodePath ?? process.execPath;
const packageManager = await resolveExecutablePath('npm', {
environment,
extraDirectories: [dirname(nodePath)],
platform: options.platform,
});
if (!packageManager)
throw new GlobalCliLifecycleError('npm-unavailable', operation);
return packageManager;
}
async function runNpm(packageManager, args, options, operation) {
const environment = options.environment ?? process.env;
const platform = options.platform ?? process.platform;
const launch = resolveSpawnCommand(packageManager, args, platform, environment.ComSpec);
try {
return await (options.runner ?? runCommand)(launch.command, launch.args, {
environment,
timeoutMs: options.timeoutMs ?? GLOBAL_CLI_INSTALL_TIMEOUT_MS,
windowsVerbatimArguments: launch.windowsVerbatimArguments,
});
}
catch {
throw new GlobalCliLifecycleError('operation-failed', operation);
}
}
function isProjectPackageExecutable(filePath) {
return filePath.replaceAll('\\', '/').includes('/node_modules/.bin/');
}
async function existingGlobalCliExecutable(options) {
if (options.cliExecutablePath === false)
return undefined;
const executablePath = options.cliExecutablePath ??
(await resolveExecutablePath('panerelay', {
environment: options.environment ?? process.env,
platform: options.platform,
}));
return executablePath && !isProjectPackageExecutable(executablePath) ? executablePath : undefined;
}
async function executableVersion(executablePath, options) {
const environment = options.environment ?? process.env;
const platform = options.platform ?? process.platform;
const launch = resolveSpawnCommand(executablePath, ['--version'], platform, environment.ComSpec);
try {
const result = await (options.runner ?? runCommand)(launch.command, launch.args, {
environment,
timeoutMs: Math.min(options.timeoutMs ?? GLOBAL_CLI_PROBE_TIMEOUT_MS, GLOBAL_CLI_PROBE_TIMEOUT_MS),
windowsVerbatimArguments: launch.windowsVerbatimArguments,
});
if (result.code !== 0)
return undefined;
const value = result.stdout.trim().replace(/^v/, '');
return isPanerelayReleaseVersion(value) ? value : undefined;
}
catch {
return undefined;
}
}
async function globalCliVersion(packageManager, options, operation) {
const result = await runNpm(packageManager, ['list', '--global', '--depth=0', '--json', '@panerelay/cli'], options, operation);
let manifest;
try {
manifest = JSON.parse(result.stdout);
}
catch {
throw new GlobalCliLifecycleError('operation-failed', operation);
}
if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) {
throw new GlobalCliLifecycleError('operation-failed', operation);
}
const dependencies = manifest.dependencies;
if (dependencies === undefined)
return undefined;
if (!dependencies || typeof dependencies !== 'object' || Array.isArray(dependencies)) {
throw new GlobalCliLifecycleError('operation-failed', operation);
}
const installed = dependencies['@panerelay/cli'];
if (installed === undefined)
return undefined;
if (!installed || typeof installed !== 'object' || Array.isArray(installed)) {
throw new GlobalCliLifecycleError('operation-failed', operation);
}
const version = installed.version;
if (!isPanerelayReleaseVersion(version)) {
throw new GlobalCliLifecycleError('operation-failed', operation);
}
return version;
}
async function readOwnership(filePath, platform, operation) {
let fileStat;
try {
fileStat = await lstat(filePath);
}
catch (error) {
if (error.code === 'ENOENT')
return undefined;
throw error;
}
if (!fileStat.isFile() ||
fileStat.isSymbolicLink() ||
fileStat.size > 1_024 ||
(platform !== 'win32' && (fileStat.mode & 0o022) !== 0)) {
throw new GlobalCliLifecycleError('ownership-invalid', operation);
}
try {
const value = JSON.parse(await readFile(filePath, 'utf8'));
if (Object.keys(value).length !== 2 ||
value.protocol !== GLOBAL_CLI_OWNERSHIP_PROTOCOL ||
!isPanerelayReleaseVersion(value.version)) {
throw new Error('invalid');
}
return {
protocol: GLOBAL_CLI_OWNERSHIP_PROTOCOL,
version: value.version,
};
}
catch {
throw new GlobalCliLifecycleError('ownership-invalid', operation);
}
}
async function writeOwnership(filePath, version) {
const directory = dirname(filePath);
const temporaryPath = join(directory, `.setup-cli.${process.pid}.${randomBytes(8).toString('hex')}.tmp`);
await mkdir(directory, { recursive: true, mode: 0o700 });
try {
await writeFile(temporaryPath, `${JSON.stringify({ protocol: GLOBAL_CLI_OWNERSHIP_PROTOCOL, version }, null, 2)}\n`, { flag: 'wx', mode: 0o600 });
await rm(filePath, { force: true });
await rename(temporaryPath, filePath);
}
finally {
await rm(temporaryPath, { force: true });
}
}
export async function installGlobalPanerelayCli(version, options = {}) {
const packageSpec = globalCliPackageSpec(version);
const platform = options.platform ?? process.platform;
const ownershipPath = globalCliOwnershipPath(options.homeDirectory);
const [ownership, executablePath] = await Promise.all([
readOwnership(ownershipPath, platform, 'install'),
existingGlobalCliExecutable(options),
]);
if (executablePath && !ownership) {
const versionOnPath = await executableVersion(executablePath, options);
return {
executablePath,
managed: false,
operation: 'preserved',
packageSpec,
...(versionOnPath ? { version: versionOnPath } : {}),
};
}
const packageManager = await resolvePackageManager(options, 'install');
const existingVersion = await globalCliVersion(packageManager, options, 'install');
if (executablePath && ownership && !existingVersion) {
await rm(ownershipPath, { force: true });
const versionOnPath = await executableVersion(executablePath, options);
return {
executablePath,
managed: false,
operation: 'preserved',
packageSpec,
...(versionOnPath ? { version: versionOnPath } : {}),
};
}
if (existingVersion && !ownership) {
return {
...(executablePath ? { executablePath } : {}),
managed: false,
operation: 'preserved',
packageSpec,
version: existingVersion,
};
}
if (existingVersion && ownership && existingVersion !== ownership.version) {
await rm(ownershipPath, { force: true });
return {
...(executablePath ? { executablePath } : {}),
managed: false,
operation: 'preserved',
packageSpec,
version: existingVersion,
};
}
if (existingVersion === version) {
return {
...(executablePath ? { executablePath } : {}),
managed: true,
operation: 'current',
packageSpec,
version,
};
}
const result = await runNpm(packageManager, ['install', '--global', '--no-audit', '--no-fund', '--loglevel=error', packageSpec], options, 'install');
if (result.code !== 0)
throw new GlobalCliLifecycleError('operation-failed', 'install');
await writeOwnership(ownershipPath, version);
const installedExecutablePath = await existingGlobalCliExecutable(options);
return {
...(installedExecutablePath ? { executablePath: installedExecutablePath } : {}),
managed: true,
operation: existingVersion ? 'updated' : 'installed',
packageSpec,
version,
};
}
export async function uninstallGlobalPanerelayCli(options = {}) {
const platform = options.platform ?? process.platform;
const ownershipPath = globalCliOwnershipPath(options.homeDirectory);
const [ownership, executablePath] = await Promise.all([
readOwnership(ownershipPath, platform, 'uninstall'),
existingGlobalCliExecutable(options),
]);
if (!ownership) {
const versionOnPath = executablePath
? await executableVersion(executablePath, options)
: undefined;
return {
...(executablePath ? { executablePath } : {}),
managed: false,
operation: executablePath ? 'preserved' : 'absent',
packageSpec: '@panerelay/cli',
...(versionOnPath ? { version: versionOnPath } : {}),
};
}
const packageManager = await resolvePackageManager(options, 'uninstall');
const existingVersion = await globalCliVersion(packageManager, options, 'uninstall');
if ((executablePath && !existingVersion) ||
(existingVersion && existingVersion !== ownership.version)) {
await rm(ownershipPath, { force: true });
return {
...(executablePath ? { executablePath } : {}),
managed: false,
operation: executablePath || existingVersion ? 'preserved' : 'absent',
packageSpec: '@panerelay/cli',
...(existingVersion ? { version: existingVersion } : {}),
};
}
if (!existingVersion) {
await rm(ownershipPath, { force: true });
return { managed: true, operation: 'absent', packageSpec: '@panerelay/cli' };
}
const result = await runNpm(packageManager, ['uninstall', '--global', '--no-audit', '--no-fund', '--loglevel=error', '@panerelay/cli'], options, 'uninstall');
if (result.code !== 0)
throw new GlobalCliLifecycleError('operation-failed', 'uninstall');
await rm(ownershipPath, { force: true });
return {
managed: true,
operation: 'removed',
packageSpec: '@panerelay/cli',
version: existingVersion,
};
}
+2
-0

@@ -23,2 +23,4 @@ #!/usr/bin/env node

yes: boolean;
skipCli?: boolean;
keepCli?: boolean;
adapterItems?: string[];

@@ -25,0 +27,0 @@ adapterAll?: boolean;

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AACjE,OAAO,EAA6C,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EACL,yBAAyB,EAEzB,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA8B,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAKnG,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE9F,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,OA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K,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAiCD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CAyK9D;AAsPD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAC7C,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,aAAa,CAAC;IAC1C,MAAM,CAAC,EAAE,OAAO,eAAe,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,oBAAoB,CAAC;IACnD,iBAAiB,CAAC,EAAE,OAAO,iBAAiB,CAAC;IAC7C,oBAAoB,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACxD,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;IAC7C,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;IACjD,KAAK,CAAC,EAAE,OAAO,cAAc,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,kBAAkB,CAAC;CACvC;AAoMD,wBAAsB,IAAI,CACxB,IAAI,GAAE,MAAM,EAA0B,EACtC,YAAY,GAAE,eAAoB,GACjC,OAAO,CAAC,MAAM,CAAC,CAuWjB"}

@@ -16,2 +16,3 @@ #!/usr/bin/env node

import { installFetchAdapters, listFetchAdapters, removeFetchAdapters } from './fetch-adapters.js';
import { GlobalCliLifecycleError } from './global-cli.js';
const PANERELAY_CHROME_WEB_STORE_URL = 'https://chromewebstore.google.com/detail/panerelay/panplnkjlkoceaonlmpdekjphgmbggmi';

@@ -145,2 +146,4 @@ function versionRequested(argv) {

let yes = false;
let skipCli = false;
let keepCli = false;
let extensionId;

@@ -167,2 +170,6 @@ for (let index = optionStart; index < localized.argv.length; index += 1) {

json = true;
else if (argument === '--no-cli')
skipCli = true;
else if (argument === '--keep-cli')
keepCli = true;
else if (argument === '--extension-id' || argument.startsWith('--extension-id=')) {

@@ -188,2 +195,8 @@ if (extensionId !== undefined)

}
if (skipCli && operation !== 'setup') {
throw new Error('--no-cli is only available with setup, update, or install');
}
if (keepCli && operation !== 'uninstall') {
throw new Error('--keep-cli is only available with uninstall');
}
if (globalDefault && operation === 'uninstall') {

@@ -234,2 +247,4 @@ throw new Error('--global-default is not needed with uninstall');

yes,
...(skipCli ? { skipCli: true } : {}),
...(keepCli ? { keepCli: true } : {}),
};

@@ -466,2 +481,7 @@ }

}
function localizedGlobalCliError(error, locale) {
if (error.code === 'npm-unavailable')
return translate(locale, 'globalCliNpmUnavailable');
return translate(locale, error.operation === 'install' ? 'globalCliInstallFailed' : 'globalCliUninstallFailed');
}
function terminalSetupProgress() {

@@ -707,3 +727,6 @@ if (!isInteractiveTerminal())

}
const result = await (dependencies.uninstall ?? uninstallPanerelay)({});
const result = await (dependencies.uninstall ?? uninstallPanerelay)({
environment: dependencies.environment,
uninstallCli: !parsed.keepCli,
});
console.log(translate(locale, 'uninstallComplete'));

@@ -715,2 +738,3 @@ if (result.browserUseIntegration.detachedDaemonMayRemain) {

}
const cliVersion = parsed.skipCli ? undefined : await packageVersion();
let setupOptions = {

@@ -727,2 +751,4 @@ agentBrowser: parsed.agentBrowser,

globalDefault: parsed.globalDefault,
installCli: !parsed.skipCli,
...(cliVersion ? { cliVersion } : {}),
...(parsed.browserUse && parsed.globalDefault

@@ -773,2 +799,19 @@ ? { browserUseDefault: 'extension' }

printSetupCheck('pass', translate(locale, 'setupNativeHost'), result.host.hostPath);
if (result.cli) {
const status = !result.cli.executablePath || (!result.cli.managed && result.cli.version !== cliVersion)
? 'warn'
: 'pass';
const detail = !result.cli.executablePath
? translate(locale, 'setupCliCommandMissing', {
version: result.cli.version ?? cliVersion ?? 'unknown',
})
: result.cli.managed
? (result.cli.version ?? cliVersion ?? result.cli.executablePath)
: result.cli.version
? translate(locale, 'setupCliPreserved', { version: result.cli.version })
: translate(locale, 'setupCliPreservedPath', {
path: result.cli.executablePath,
});
printSetupCheck(status, translate(locale, 'setupCli'), detail);
}
printSetupCheck('pass', translate(locale, 'setupExtensionId'), result.host.extensionId);

@@ -870,7 +913,11 @@ printSetupSubline(translate(locale, 'setupNextStep'), result.host.extensionId === PANERELAY_EXTENSION_ID

setupProgress?.error(translate(locale, 'setupProgressFailed'));
console.error(parsed.operation === 'add' || parsed.operation === 'remove' || parsed.operation === 'adapters'
? localizedAdapterError(error, locale)
: error instanceof Error
? error.message
: String(error));
console.error(error instanceof GlobalCliLifecycleError
? localizedGlobalCliError(error, locale)
: parsed.operation === 'add' ||
parsed.operation === 'remove' ||
parsed.operation === 'adapters'
? localizedAdapterError(error, locale)
: error instanceof Error
? error.message
: String(error));
return 1;

@@ -877,0 +924,0 @@ }

@@ -56,2 +56,5 @@ export type SupportedLocale = 'en' | 'zh-CN';

readonly globalDefault: "Global default configuration: {path}";
readonly globalCliInstallFailed: "Could not install or update the Panerelay CLI. Check npm global-install permissions and network access, then rerun setup or use --no-cli.";
readonly globalCliNpmUnavailable: "npm is unavailable, so Setup could not install the Panerelay CLI. Install npm or rerun setup with --no-cli.";
readonly globalCliUninstallFailed: "Could not remove the Setup-managed Panerelay CLI. Check npm global-install permissions and rerun uninstall, or use --keep-cli.";
readonly setupAgentBrowser: "agent-browser";

@@ -70,2 +73,6 @@ readonly setupBrowserHarnessEnvironment: "Browser Harness environment";

readonly setupExtensionId: "Extension ID";
readonly setupCli: "Panerelay CLI";
readonly setupCliCommandMissing: "{version} installed, but panerelay is not on PATH";
readonly setupCliPreserved: "{version} (existing global installation preserved)";
readonly setupCliPreservedPath: "Existing command preserved: {path}";
readonly setupFix: "Fix";

@@ -88,3 +95,3 @@ readonly setupGroupAutomation: "Automation integrations";

readonly integrationSelectPrompt: "Select integrations (checked: install/update; unchecked: remove Panerelay integration)";
readonly help: "Panerelay Setup\n\nUsage:\n npx --yes @panerelay/setup [--agent-browser] [--browser-use] [--playwright] [--codex-fetch|--remove-codex-fetch] [--claude-fetch|--remove-claude-fetch] [--global-default] [--extension-id <id>] [--lang <language>]\n npx --yes @panerelay/setup doctor [--agent-browser] [--browser-use] [--playwright] [--codex-fetch] [--claude-fetch] [--global-default] [--extension-id <id>] [--json] [--lang <language>]\n npx --yes @panerelay/setup uninstall [--yes] [--lang <language>]\n npx --yes @panerelay/setup add <adapter|path|github-source>... | --all\n npx --yes @panerelay/setup remove <adapter>... | --all\n npx --yes @panerelay/setup adapters\n\nCommands:\n doctor Diagnose the local Panerelay integration\n uninstall Remove Panerelay-managed local integration files\n add Install built-in, local two-file/source-form, or public GitHub fetch adapters\n remove Remove one or more installed fetch adapters\n adapters List installed fetch adapters\n\nOptions:\n --agent-browser Also install or diagnose the Panerelay agent-browser integration\n --browser-use Also install or diagnose the Panerelay Browser Use integration\n --playwright Also install or diagnose the Panerelay Playwright CLI integration\n --codex-fetch Route external Codex web access through Panerelay Fetch MCP\n --claude-fetch Route external Claude Code WebFetch through Panerelay Fetch MCP\n --remove-codex-fetch Remove Panerelay-owned external Codex fetch routing\n --remove-claude-fetch\n Remove Panerelay-owned external Claude Code fetch routing\n --global-default\n Set selected automation integrations as user-level defaults\n --extension-id\n Use a custom 32-character Chrome Extension ID for this installation\n --json Print a machine-readable doctor report\n --lang Use en or zh-CN instead of the system language\n --yes, -y Confirm uninstall without a prompt\n --version, -v\n Show the version\n --help, -h Show this help\n\nOptional automation integrations:\n npx --yes @panerelay/setup --agent-browser\n npx --yes @panerelay/setup --browser-use\n npx --yes @panerelay/setup --playwright\n npx --yes @panerelay/setup --codex-fetch\n npx --yes @panerelay/setup --claude-fetch\n npx --yes @panerelay/setup --remove-codex-fetch\n npx --yes @panerelay/setup --remove-claude-fetch\n\nOptional fetch adapters:\n npx --yes @panerelay/setup add bilibili\n npx --yes @panerelay/setup add --all\n npx --yes @panerelay/setup add ./my-site\n npx --yes @panerelay/setup add owner/repository\n npx --yes @panerelay/setup add github:owner/repository@v1.0.0#sites/example\n npx --yes @panerelay/setup add 'https://github.com/owner/repository?ref=v1.0.0&path=sites/example'\n npx --yes @panerelay/setup remove bilibili";
readonly help: "Panerelay Setup\n\nUsage:\n npx --yes @panerelay/setup [--agent-browser] [--browser-use] [--playwright] [--codex-fetch|--remove-codex-fetch] [--claude-fetch|--remove-claude-fetch] [--global-default] [--extension-id <id>] [--no-cli] [--lang <language>]\n npx --yes @panerelay/setup doctor [--agent-browser] [--browser-use] [--playwright] [--codex-fetch] [--claude-fetch] [--global-default] [--extension-id <id>] [--json] [--lang <language>]\n npx --yes @panerelay/setup uninstall [--yes] [--keep-cli] [--lang <language>]\n npx --yes @panerelay/setup add <adapter|path|github-source>... | --all\n npx --yes @panerelay/setup remove <adapter>... | --all\n npx --yes @panerelay/setup adapters\n\nCommands:\n doctor Diagnose the local Panerelay integration\n uninstall Remove Panerelay-managed local integration files\n add Install built-in, local two-file/source-form, or public GitHub fetch adapters\n remove Remove one or more installed fetch adapters\n adapters List installed fetch adapters\n\nOptions:\n --agent-browser Also install or diagnose the Panerelay agent-browser integration\n --browser-use Also install or diagnose the Panerelay Browser Use integration\n --playwright Also install or diagnose the Panerelay Playwright CLI integration\n --codex-fetch Route external Codex web access through Panerelay Fetch MCP\n --claude-fetch Route external Claude Code WebFetch through Panerelay Fetch MCP\n --remove-codex-fetch Remove Panerelay-owned external Codex fetch routing\n --remove-claude-fetch\n Remove Panerelay-owned external Claude Code fetch routing\n --global-default\n Set selected automation integrations as user-level defaults\n --extension-id\n Use a custom 32-character Chrome Extension ID for this installation\n --json Print a machine-readable doctor report\n --no-cli Do not install or update the global Panerelay CLI during setup\n --keep-cli Keep a Setup-managed global Panerelay CLI during uninstall\n --lang Use en or zh-CN instead of the system language\n --yes, -y Confirm uninstall without a prompt\n --version, -v\n Show the version\n --help, -h Show this help\n\nOptional automation integrations:\n npx --yes @panerelay/setup --agent-browser\n npx --yes @panerelay/setup --browser-use\n npx --yes @panerelay/setup --playwright\n npx --yes @panerelay/setup --codex-fetch\n npx --yes @panerelay/setup --claude-fetch\n npx --yes @panerelay/setup --remove-codex-fetch\n npx --yes @panerelay/setup --remove-claude-fetch\n\nOptional fetch adapters:\n npx --yes @panerelay/setup add bilibili\n npx --yes @panerelay/setup add --all\n npx --yes @panerelay/setup add ./my-site\n npx --yes @panerelay/setup add owner/repository\n npx --yes @panerelay/setup add github:owner/repository@v1.0.0#sites/example\n npx --yes @panerelay/setup add 'https://github.com/owner/repository?ref=v1.0.0&path=sites/example'\n npx --yes @panerelay/setup remove bilibili";
readonly nativeHost: "Native Host: {path}";

@@ -91,0 +98,0 @@ readonly nonInteractiveUninstall: "Non-interactive input detected. Re-run with --yes.";

@@ -1,1 +0,1 @@

{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC;AAE7C,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJX,CAAC;AAEX,KAAK,UAAU,GAAG,MAAM,OAAO,eAAe,CAAC;AA0J/C,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAMtF;AAyBD,wBAAgB,aAAa,CAAC,OAAO,GAAE,uBAA4B,GAAG,eAAe,CAWpF;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,UAAU,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAClC,MAAM,CAGR"}
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC;AAE7C,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoKX,CAAC;AAEX,KAAK,UAAU,GAAG,MAAM,OAAO,eAAe,CAAC;AAsK/C,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAMtF;AAyBD,wBAAgB,aAAa,CAAC,OAAO,GAAE,uBAA4B,GAAG,eAAe,CAWpF;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,UAAU,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAClC,MAAM,CAGR"}

@@ -56,2 +56,5 @@ import { execFileSync } from 'node:child_process';

globalDefault: 'Global default configuration: {path}',
globalCliInstallFailed: 'Could not install or update the Panerelay CLI. Check npm global-install permissions and network access, then rerun setup or use --no-cli.',
globalCliNpmUnavailable: 'npm is unavailable, so Setup could not install the Panerelay CLI. Install npm or rerun setup with --no-cli.',
globalCliUninstallFailed: 'Could not remove the Setup-managed Panerelay CLI. Check npm global-install permissions and rerun uninstall, or use --keep-cli.',
setupAgentBrowser: 'agent-browser',

@@ -70,2 +73,6 @@ setupBrowserHarnessEnvironment: 'Browser Harness environment',

setupExtensionId: 'Extension ID',
setupCli: 'Panerelay CLI',
setupCliCommandMissing: '{version} installed, but panerelay is not on PATH',
setupCliPreserved: '{version} (existing global installation preserved)',
setupCliPreservedPath: 'Existing command preserved: {path}',
setupFix: 'Fix',

@@ -91,5 +98,5 @@ setupGroupAutomation: 'Automation integrations',

Usage:
npx --yes @panerelay/setup [--agent-browser] [--browser-use] [--playwright] [--codex-fetch|--remove-codex-fetch] [--claude-fetch|--remove-claude-fetch] [--global-default] [--extension-id <id>] [--lang <language>]
npx --yes @panerelay/setup [--agent-browser] [--browser-use] [--playwright] [--codex-fetch|--remove-codex-fetch] [--claude-fetch|--remove-claude-fetch] [--global-default] [--extension-id <id>] [--no-cli] [--lang <language>]
npx --yes @panerelay/setup doctor [--agent-browser] [--browser-use] [--playwright] [--codex-fetch] [--claude-fetch] [--global-default] [--extension-id <id>] [--json] [--lang <language>]
npx --yes @panerelay/setup uninstall [--yes] [--lang <language>]
npx --yes @panerelay/setup uninstall [--yes] [--keep-cli] [--lang <language>]
npx --yes @panerelay/setup add <adapter|path|github-source>... | --all

@@ -120,2 +127,4 @@ npx --yes @panerelay/setup remove <adapter>... | --all

--json Print a machine-readable doctor report
--no-cli Do not install or update the global Panerelay CLI during setup
--keep-cli Keep a Setup-managed global Panerelay CLI during uninstall
--lang Use en or zh-CN instead of the system language

@@ -205,2 +214,5 @@ --yes, -y Confirm uninstall without a prompt

globalDefault: '全局默认配置:{path}',
globalCliInstallFailed: '无法安装或更新 Panerelay CLI。请检查 npm 全局安装权限和网络后重新运行 setup,或使用 --no-cli。',
globalCliNpmUnavailable: '未找到 npm,Setup 无法安装 Panerelay CLI。请安装 npm,或使用 --no-cli 重新运行 setup。',
globalCliUninstallFailed: '无法移除由 Setup 管理的 Panerelay CLI。请检查 npm 全局安装权限后重新运行 uninstall,或使用 --keep-cli。',
setupAgentBrowser: 'agent-browser',

@@ -220,2 +232,6 @@ setupBrowserHarnessEnvironment: 'Browser Harness 环境',

setupExtensionId: '扩展 ID',
setupCli: 'Panerelay CLI',
setupCliCommandMissing: '已安装 {version},但 PATH 中找不到 panerelay',
setupCliPreserved: '{version}(保留已有全局安装)',
setupCliPreservedPath: '已保留现有命令:{path}',
setupFix: '处理',

@@ -241,5 +257,5 @@ setupGroupAutomation: '自动化集成',

用法:
npx --yes @panerelay/setup [--agent-browser] [--browser-use] [--playwright] [--codex-fetch|--remove-codex-fetch] [--claude-fetch|--remove-claude-fetch] [--global-default] [--extension-id <id>] [--lang <语言>]
npx --yes @panerelay/setup [--agent-browser] [--browser-use] [--playwright] [--codex-fetch|--remove-codex-fetch] [--claude-fetch|--remove-claude-fetch] [--global-default] [--extension-id <id>] [--no-cli] [--lang <语言>]
npx --yes @panerelay/setup doctor [--agent-browser] [--browser-use] [--playwright] [--codex-fetch] [--claude-fetch] [--global-default] [--extension-id <id>] [--json] [--lang <语言>]
npx --yes @panerelay/setup uninstall [--yes] [--lang <语言>]
npx --yes @panerelay/setup uninstall [--yes] [--keep-cli] [--lang <语言>]
npx --yes @panerelay/setup add <适配器|路径|GitHub 来源>... | --all

@@ -270,2 +286,4 @@ npx --yes @panerelay/setup remove <适配器>... | --all

--json 输出机器可读的 doctor 报告
--no-cli setup 时不安装或更新全局 Panerelay CLI
--keep-cli uninstall 时保留由 Setup 管理的全局 Panerelay CLI
--lang 使用 en 或 zh-CN,不跟随系统语言

@@ -272,0 +290,0 @@ --yes, -y 无需确认直接卸载

@@ -9,2 +9,3 @@ import { installNativeHost, uninstallNativeHost, type NativeHostInstallationResult } from '@panerelay/bridge/install';

import { installClaudeFetchIntegration, installCodexFetchIntegration, uninstallClaudeFetchIntegration, uninstallCodexFetchIntegration } from './agent-fetch-integration.js';
import { installGlobalPanerelayCli, uninstallGlobalPanerelayCli, type GlobalCliLifecycleResult } from './global-cli.js';
export interface PanerelaySetupOptions {

@@ -23,2 +24,4 @@ agentBrowser?: boolean;

homeDirectory?: string;
installCli?: boolean;
cliVersion?: string;
platform?: NodeJS.Platform;

@@ -28,2 +31,3 @@ project?: boolean;

reconcileIntegrations?: boolean;
uninstallCli?: boolean;
}

@@ -34,2 +38,3 @@ export interface PanerelaySetupResult {

globalDefault: boolean;
cli?: GlobalCliLifecycleResult;
host: NativeHostInstallationResult;

@@ -58,2 +63,3 @@ browserUseRequested?: boolean;

projectConfigPath?: string;
cli?: GlobalCliLifecycleResult;
}

@@ -68,2 +74,3 @@ export interface LifecycleDependencies {

installCodexFetch?: typeof installCodexFetchIntegration;
installGlobalCli?: typeof installGlobalPanerelayCli;
probeBrowserUse?: typeof probeBrowserUseVersions;

@@ -77,2 +84,3 @@ probeAgentBrowser?: typeof probeAgentBrowserInstallation;

uninstallCodexFetch?: typeof uninstallCodexFetchIntegration;
uninstallGlobalCli?: typeof uninstallGlobalPanerelayCli;
installPlaywright?: typeof installPlaywrightIntegration;

@@ -79,0 +87,0 @@ probePlaywright?: typeof probePlaywrightInstallation;

@@ -1,1 +0,1 @@

{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,4BAA4B,EAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qCAAqC,EACrC,uCAAuC,EACvC,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EAC1C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,uBAAuB,EACvB,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,6BAA6B,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,KAAK,iCAAiC,EACtC,8BA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,CAAC,CA4DnC"}

@@ -9,2 +9,3 @@ import { installNativeHost, uninstallNativeHost, } from '@panerelay/bridge/install';

import { installClaudeFetchIntegration, installCodexFetchIntegration, uninstallClaudeFetchIntegration, uninstallCodexFetchIntegration, } from './agent-fetch-integration.js';
import { installGlobalPanerelayCli, uninstallGlobalPanerelayCli, } from './global-cli.js';
export async function setupPanerelay(options = {}, dependencies = {}) {

@@ -31,2 +32,12 @@ const installHost = dependencies.installHost ?? installNativeHost;

}
if (options.installCli && !options.cliVersion) {
throw new Error('cliVersion is required when installCli is enabled');
}
const cli = options.installCli
? await (dependencies.installGlobalCli ?? installGlobalPanerelayCli)(options.cliVersion, {
environment: options.environment,
homeDirectory: options.homeDirectory,
platform: options.platform,
})
: undefined;
const agentBrowserInstallation = options.agentBrowser

@@ -126,2 +137,3 @@ ? await (dependencies.probeAgentBrowser ?? probeAgentBrowserInstallation)({

host,
...(cli ? { cli } : {}),
...(agentBrowserInstallation ? { agentBrowserInstallation } : {}),

@@ -154,2 +166,3 @@ ...(agentBrowserConfigPath ? { agentBrowserConfigPath } : {}),

host,
...(cli ? { cli } : {}),
...(agentBrowserInstallation ? { agentBrowserInstallation } : {}),

@@ -179,2 +192,9 @@ ...(agentBrowserConfigPath ? { agentBrowserConfigPath } : {}),

export async function uninstallPanerelay(options = {}, dependencies = {}) {
const cli = options.uninstallCli
? await (dependencies.uninstallGlobalCli ?? uninstallGlobalPanerelayCli)({
environment: options.environment,
homeDirectory: options.homeDirectory,
platform: options.platform,
})
: undefined;
const uninstallHost = dependencies.uninstallHost ?? uninstallNativeHost;

@@ -210,2 +230,3 @@ const unregisterProvider = dependencies.unregisterProvider ?? unregisterPanerelayProvider;

playwrightIntegration,
...(cli ? { cli } : {}),
};

@@ -222,4 +243,5 @@ }

playwrightIntegration,
...(cli ? { cli } : {}),
projectConfigPath,
};
}
{
"name": "@panerelay/setup",
"version": "0.9.0",
"version": "0.10.0",
"description": "Install and diagnose Panerelay's local integration and optional automation adapters.",

@@ -39,10 +39,10 @@ "type": "module",

"@clack/prompts": "1.2.0",
"@panerelay/bridge": "0.9.0",
"@panerelay/browser-use": "0.9.0",
"@panerelay/browser-registry": "0.9.0",
"@panerelay/playwright": "0.9.0",
"@panerelay/cli": "0.9.0",
"@panerelay/protocol": "0.9.0",
"@panerelay/site-kit": "0.9.0",
"@panerelay/sites": "0.9.0"
"@panerelay/bridge": "0.10.0",
"@panerelay/browser-registry": "0.10.0",
"@panerelay/browser-use": "0.10.0",
"@panerelay/cli": "0.10.0",
"@panerelay/playwright": "0.10.0",
"@panerelay/site-kit": "0.10.0",
"@panerelay/protocol": "0.10.0",
"@panerelay/sites": "0.10.0"
},

@@ -49,0 +49,0 @@ "devDependencies": {

@@ -18,3 +18,3 @@ # @panerelay/setup

The base command always installs the Native Host and side-panel prerequisites. In an interactive terminal it also offers one automation-integration selector; in non-interactive use it remains engine-neutral. Setup does not manage an Agent Skill or change `PATH`.
The base command always installs the Native Host and side-panel prerequisites. It also installs the exact same-version global `@panerelay/cli` when absent, so the recurring `panerelay` command is available. A pre-existing PATH-visible global command is preserved even when it belongs to another NVM, Volta, or npm prefix; later setup/update runs change only a version that still matches Setup's protected ownership record. Project-local `node_modules/.bin` commands do not count as global installations. Use `--no-cli` to skip this lifecycle. In an interactive terminal Setup also offers one automation-integration selector; in non-interactive use it remains engine-neutral. Setup does not manage an Agent Skill or edit shell startup files.

@@ -44,3 +44,3 @@ Agents in the side panel keep the selected project as their working directory and receive only bounded current-tab URL and title context. Panerelay-owned Codex and Claude Code processes also receive the bounded Panerelay Fetch MCP for browser-authenticated HTTP(S) requests. Automation MCP servers and Skills continue to come from the Agent's own configuration.

```bash
npx skills add F-loat/panerelay --skill panerelay
npx skills add https://github.com/F-loat/panerelay --skill panerelay
```

@@ -72,3 +72,3 @@

Fetch adapters are independent from base setup and automation-engine integrations. They are installed only by an explicit adapter command:
Fetch adapters are independent from base setup and automation-engine integrations. Run base Setup first so the `panerelay` command is available; adapters are then installed only by an explicit adapter command:

@@ -195,10 +195,10 @@ ```bash

```bash
npx --yes @panerelay/cli browsers
npx --yes @panerelay/cli browser use chrome
panerelay browsers
panerelay browser use chrome
# Or use an exact registration ID:
# npx --yes @panerelay/cli browser use REGISTRATION_ID
npx --yes @panerelay/cli browser clear
# panerelay browser use REGISTRATION_ID
panerelay browser clear
```
`@panerelay/cli` is an optional, engine-neutral administration package. Install it globally when a persistent `panerelay` command is useful. Setup does not install it globally or modify the shell `PATH`.
`@panerelay/cli` is the engine-neutral recurring command installed by normal base Setup. Setup uses npm's configured global prefix without editing shell startup files, skips an already matching Setup-owned release, and preserves any pre-existing or externally changed global installation. `--no-cli` skips this step; uninstall removes only an unchanged Setup-owned CLI unless `--keep-cli` is supplied.

@@ -205,0 +205,0 @@ `PANERELAY_BROWSER_ID` selects one exact registration for a process. `PANERELAY_BROWSER` accepts an exact ID or an unambiguous browser family. Explicit selection wins over the saved browser default. Without either, Panerelay selects only when exactly one CDP-ready browser is live; ambiguity and unavailable defaults fail closed. Existing sessions remain pinned to the browser through which they were created.