fix: use explicit monitor repository url

This commit is contained in:
2026-04-04 07:28:32 +00:00
parent 485f8e117b
commit ff5c07a38c

View File

@@ -30,6 +30,7 @@ const PLUGIN_NAME = 'harbor-forge';
const OLD_PLUGIN_NAME = 'harborforge-monitor'; const OLD_PLUGIN_NAME = 'harborforge-monitor';
const PLUGIN_SRC_DIR = join(__dirname, 'plugin'); const PLUGIN_SRC_DIR = join(__dirname, 'plugin');
const SKILLS_SRC_DIR = join(__dirname, 'skills'); const SKILLS_SRC_DIR = join(__dirname, 'skills');
const MONITOR_REPO_URL = 'https://git.hangman-lab.top/zhi/HarborForge.Monitor.git';
const args = process.argv.slice(2); const args = process.argv.slice(2);
const options = { const options = {
@@ -182,15 +183,12 @@ async function build() {
function installManagedMonitor(openclawPath) { function installManagedMonitor(openclawPath) {
if (options.installMonitor !== 'yes') return null; if (options.installMonitor !== 'yes') return null;
const projectRoot = resolve(__dirname, '..');
const gitRoot = exec('git config --get remote.origin.url', { cwd: projectRoot, silent: true }).trim();
const monitorRepo = gitRoot.replace(/HarborForge\.OpenclawPlugin(\.git)?$/, 'HarborForge.Monitor.git');
const tmpDir = join('/tmp', `harborforge-monitor-${Date.now()}`); const tmpDir = join('/tmp', `harborforge-monitor-${Date.now()}`);
const monitorDestDir = join(openclawPath, 'plugins', PLUGIN_NAME, 'bin'); const monitorDestDir = join(openclawPath, 'plugins', PLUGIN_NAME, 'bin');
const binaryPath = join(monitorDestDir, 'HarborForge.Monitor'); const binaryPath = join(monitorDestDir, 'HarborForge.Monitor');
mkdirSync(monitorDestDir, { recursive: true }); mkdirSync(monitorDestDir, { recursive: true });
try { try {
exec(`git clone --branch ${shellEscape(options.monitorBranch)} ${shellEscape(monitorRepo)} ${shellEscape(tmpDir)}`, { silent: !options.verbose }); exec(`git clone --branch ${shellEscape(options.monitorBranch)} ${shellEscape(MONITOR_REPO_URL)} ${shellEscape(tmpDir)}`, { silent: !options.verbose });
exec(`go build -o ${shellEscape(binaryPath)} ./cmd/harborforge-monitor`, { cwd: tmpDir, silent: !options.verbose }); exec(`go build -o ${shellEscape(binaryPath)} ./cmd/harborforge-monitor`, { cwd: tmpDir, silent: !options.verbose });
chmodSync(binaryPath, 0o755); chmodSync(binaryPath, 0o755);
logOk(`Managed monitor installed → ${binaryPath} (branch hint: ${options.monitorBranch})`); logOk(`Managed monitor installed → ${binaryPath} (branch hint: ${options.monitorBranch})`);