(mgr *cmd.CommandHelper, containerName, spec, pluginID string)
| 1299 | } |
| 1300 | |
| 1301 | func installOpenclawPlugin(mgr *cmd.CommandHelper, containerName, spec, pluginID string) error { |
| 1302 | workdir := path.Join(openclawPluginPackageTmpDir, pluginID) |
| 1303 | defer func() { |
| 1304 | _ = mgr.Run("docker", "exec", containerName, "rm", "-rf", workdir) |
| 1305 | }() |
| 1306 | if err := mgr.Run("docker", "exec", containerName, "rm", "-rf", workdir); err != nil { |
| 1307 | return err |
| 1308 | } |
| 1309 | if err := mgr.Run("docker", "exec", containerName, "mkdir", "-p", workdir); err != nil { |
| 1310 | return err |
| 1311 | } |
| 1312 | if err := mgr.Run("docker", "exec", "-w", workdir, containerName, "npm", "pack", "--silent", spec); err != nil { |
| 1313 | return err |
| 1314 | } |
| 1315 | pkgPath, err := cmd.RunDockerExecWithStdout(10*time.Minute, containerName, "find", workdir, "-maxdepth", "1", "-type", "f", "-name", "*.tgz", "-print", "-quit") |
| 1316 | if err != nil { |
| 1317 | return err |
| 1318 | } |
| 1319 | pkgPath = strings.TrimSpace(pkgPath) |
| 1320 | if pkgPath == "" { |
| 1321 | return fmt.Errorf("openclaw plugin package not found") |
| 1322 | } |
| 1323 | return mgr.Run("docker", "exec", containerName, "openclaw", "plugins", "install", pkgPath, "--dangerously-force-unsafe-install") |
| 1324 | } |
| 1325 | |
| 1326 | func uninstallOpenclawPlugin(mgr *cmd.CommandHelper, containerName, pluginID string) error { |
| 1327 | _, err := mgr.RunPipe( |
no test coverage detected