Skip to content

feat: add ClawHub publishing#1587

Merged
Mijamind719 merged 1 commit intovolcengine:mainfrom
LinQiang391:main
Apr 21, 2026
Merged

feat: add ClawHub publishing#1587
Mijamind719 merged 1 commit intovolcengine:mainfrom
LinQiang391:main

Conversation

@LinQiang391
Copy link
Copy Markdown
Contributor

Description

Add openclaw openviking setup interactive wizard — detects Python, verifies OpenViking package, writes config

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 20, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🏅 Score: 85
🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 Multiple PR themes

Sub-PR theme: Add runtime-utils and refactor env/process handling

Relevant files:

  • examples/openclaw-plugin/runtime-utils.ts
  • examples/openclaw-plugin/config.ts
  • examples/openclaw-plugin/index.ts
  • examples/openclaw-plugin/process-manager.ts

Sub-PR theme: Add interactive setup wizard and ClawHub publishing

Relevant files:

  • examples/openclaw-plugin/commands/setup.ts
  • examples/openclaw-plugin/INSTALL.md
  • examples/openclaw-plugin/INSTALL-ZH.md
  • examples/openclaw-plugin/install-manifest.json
  • examples/openclaw-plugin/openclaw.plugin.json
  • examples/openclaw-plugin/package.json
  • examples/openclaw-plugin/.clawhubignore

⚡ Recommended focus areas for review

Shell Escaping Risk

The writeOpenvikingEnv function writes environment files with unescaped pythonPath. If the path contains single quotes (Unix) or double quotes (Windows/PowerShell), it can break the script syntax.

function writeOpenvikingEnv(pythonPath: string): void {
  if (!fs.existsSync(OPENCLAW_DIR)) fs.mkdirSync(OPENCLAW_DIR, { recursive: true });
  if (IS_WIN) {
    fs.writeFileSync(path.join(OPENCLAW_DIR, "openviking.env.bat"), `@echo off\r\nset "OPENVIKING_PYTHON=${pythonPath}"\r\n`, "utf-8");
    fs.writeFileSync(path.join(OPENCLAW_DIR, "openviking.env.ps1"), `$env:OPENVIKING_PYTHON = "${pythonPath.replace(/\\/g, "\\\\")}"\n`, "utf-8");
  } else {
    fs.writeFileSync(path.join(OPENCLAW_DIR, "openviking.env"), `export OPENVIKING_PYTHON='${pythonPath}'\n`, "utf-8");
  }
}

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Clear timeout in finally block to avoid leaks

The checkServiceHealth function does not clear the timeout in case of an error
(e.g., when the fetch is aborted or throws). This can lead to memory leaks as the
timeout will still fire after the function has completed. Move the clearTimeout call
to a finally block to ensure it always runs.

examples/openclaw-plugin/commands/setup.ts [144-167]

 async function checkServiceHealth(baseUrl: string, apiKey?: string): Promise<{ ok: boolean; version: string; error: string }> {
+  const controller = new AbortController();
+  const timeoutId = setTimeout(() => controller.abort(), 10_000);
   try {
     const headers: Record<string, string> = {};
     if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
-    const controller = new AbortController();
-    const timeoutId = setTimeout(() => controller.abort(), 10_000);
     const response = await fetch(`${baseUrl.replace(/\/+$/, "")}/health`, {
       headers,
       signal: controller.signal,
     });
-    clearTimeout(timeoutId);
     if (response.ok) {
       try {
         const data = await response.json() as Record<string, unknown>;
         return { ok: true, version: String(data.version ?? ""), error: "" };
       } catch {
         return { ok: true, version: "", error: "" };
       }
     }
     return { ok: false, version: "", error: `HTTP ${response.status}` };
   } catch (err) {
     return { ok: false, version: "", error: String(err instanceof Error ? err.message : err) };
+  } finally {
+    clearTimeout(timeoutId);
   }
 }
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a potential memory leak by ensuring the timeout is cleared in a finally block, which runs regardless of whether the fetch succeeds or fails. This is a moderate quality improvement.

Low

@LinQiang391 LinQiang391 changed the title [WIP]feat: add ClawHub publishing feat: add ClawHub publishing Apr 21, 2026
@Mijamind719 Mijamind719 self-assigned this Apr 21, 2026
@Mijamind719 Mijamind719 merged commit 09bb76c into volcengine:main Apr 21, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Apr 21, 2026
Copy link
Copy Markdown
Collaborator

@qin-ctx qin-ctx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues found in the ClawHub setup flow and Windows runtime persistence.

function writeOpenvikingEnv(pythonPath: string): void {
if (!fs.existsSync(OPENCLAW_DIR)) fs.mkdirSync(OPENCLAW_DIR, { recursive: true });
if (IS_WIN) {
fs.writeFileSync(path.join(OPENCLAW_DIR, "openviking.env.bat"), `@echo off\r\nset "OPENVIKING_PYTHON=${pythonPath}"\r\n`, "utf-8");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (blocking) On Windows, the wizard writes openviking.env.bat as set "OPENVIKING_PYTHON=...", but both readers only match set OPENVIKING_PYTHON=... without the surrounding quotes. That means the path you persist here cannot be recovered later by either the setup wizard or normal gateway startup, so OPENVIKING_PYTHON silently stops being reusable after the first run. Please make the writer and both readers accept the same syntax, and add a Windows round-trip test for the .bat format.

const defaultConfigPath = existing?.configPath ? String(existing.configPath) : DEFAULT_CONFIG_PATH;
const defaultPort = existing?.port ? String(existing.port) : String(DEFAULT_PORT);

const cfgPath = await q(tr(zh, "Config path", "配置文件路径"), defaultConfigPath);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Bug] (blocking) This local-mode setup flow saves configPath and tells the user to run openclaw gateway --force, but it never verifies that ov.conf exists or is valid, and it never generates one. With the docs now recommending openclaw plugins install clawhub:@openclaw/openviking + openclaw openviking setup as the primary install path, a first-time user can complete the wizard successfully and still hit an immediate startup failure on the next gateway launch because openviking.server.config.load_server_config() requires a real ov.conf. Please either validate-and-block here, generate a minimal config, or explicitly route first-time local installs through the existing ov-install flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants