Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1alpha1/claw_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ type ClawSpec struct {

// Plugins lists OpenClaw plugins to install via an init container before
// the gateway starts. Each entry is a package name (e.g. "@openclaw/matrix").
// The operator runs `openclaw plugins install clawhub:<pkg>` for each entry.
// The operator runs `openclaw plugins install <pkg>` for each entry.
// +optional
Plugins []string `json:"plugins,omitempty"`

Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/claw.sandbox.redhat.com_claws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ spec:
description: |-
Plugins lists OpenClaw plugins to install via an init container before
the gateway starts. Each entry is a package name (e.g. "@openclaw/matrix").
The operator runs `openclaw plugins install clawhub:<pkg>` for each entry.
The operator runs `openclaw plugins install <pkg>` for each entry.
items:
type: string
type: array
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/claw_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ls "$EXT" 2>/dev/null | sort > /tmp/before-plugins.txt
`)
for _, pkg := range plugins {
escaped := "'" + strings.ReplaceAll(pkg, "'", "'\\''") + "'"
fmt.Fprintf(&b, "openclaw plugins install clawhub:%s\n", escaped)
fmt.Fprintf(&b, "openclaw plugins install %s\n", escaped)
Comment on lines 117 to +119

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find any remaining references to the old clawhub: install form
rg -n "plugins install clawhub:" --hidden -g '!**/vendor/**'

Repository: codeready-toolchain/claw-operator

Length of output: 171


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n-- matches for old form --\n'
rg -n "plugins install clawhub:" --hidden -g '!**/vendor/**' || true

printf '\n-- matches for generated command and related docs --\n'
rg -n "openclaw plugins install|clawhub:" internal/assets/manifests/claw/configmap.yaml docs/user-guide.md internal/controller/claw_plugins.go || true

printf '\n-- relevant file excerpts --\n'
sed -n '110,125p' internal/controller/claw_plugins.go
echo
sed -n '1110,1130p' internal/assets/manifests/claw/configmap.yaml
echo
sed -n '1640,1660p' docs/user-guide.md

Repository: codeready-toolchain/claw-operator

Length of output: 199


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n-- clawhub references --\n'
rg -n "clawhub:" internal/assets/manifests/claw/configmap.yaml docs/user-guide.md internal/controller/claw_plugins.go || true

printf '\n-- install command references --\n'
rg -n "openclaw plugins install|plugins install" internal/assets/manifests/claw/configmap.yaml docs/user-guide.md internal/controller/claw_plugins.go || true

Repository: codeready-toolchain/claw-operator

Length of output: 1389


Update the stale plugin install docs. internal/controller/claw_plugins.go now emits openclaw plugins install <pkg>, but docs/user-guide.md:1646 and internal/assets/manifests/claw/configmap.yaml:1120 still document clawhub:<pkg>. Keep those examples aligned with the generated command.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/controller/claw_plugins.go` around lines 117 - 119, The plugin
install command format in claw plugin generation has changed, so update the
stale examples to match the new output from claw_plugins.go’s install command
builder. Align the documented install syntax in the user guide and the configmap
manifest examples with the generated openclaw plugins install <pkg> form,
keeping the docs consistent with the behavior of the plugin list/install code
path.

}
b.WriteString(`ls "$EXT" | sort | comm -13 /tmp/before-plugins.txt - > "$MANIFEST"
`)
Expand Down
20 changes: 10 additions & 10 deletions internal/controller/claw_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ func TestGeneratePluginInstallScript(t *testing.T) {

t.Run("should generate install command for single plugin", func(t *testing.T) {
script := generatePluginInstallScript([]string{"@openclaw/matrix"})
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/matrix'")
})

t.Run("should generate install commands for multiple plugins", func(t *testing.T) {
script := generatePluginInstallScript([]string{"@openclaw/matrix", "@openclaw/diagnostics-otel"})
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/diagnostics-otel'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/diagnostics-otel'")
})

t.Run("should escape single quotes in plugin names", func(t *testing.T) {
script := generatePluginInstallScript([]string{"foo'bar"})
assert.Contains(t, script, "openclaw plugins install clawhub:'foo'\\''bar'")
assert.Contains(t, script, "openclaw plugins install 'foo'\\''bar'")
})

t.Run("should escape shell metacharacters", func(t *testing.T) {
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestConfigurePluginsInitContainer(t *testing.T) {
command := pluginInit["command"].([]any)
assert.Equal(t, "sh", command[0])
assert.Equal(t, "-c", command[1])
assert.Contains(t, command[2], "openclaw plugins install clawhub:'@openclaw/matrix'")
assert.Contains(t, command[2], "openclaw plugins install '@openclaw/matrix'")
})

t.Run("should set proxy environment variables", func(t *testing.T) {
Expand Down Expand Up @@ -338,8 +338,8 @@ func TestConfigurePluginsInitContainer(t *testing.T) {
command := pluginInit["command"].([]any)
script := command[2].(string)
assert.Contains(t, script, "set -e")
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/diagnostics-otel'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/diagnostics-otel'")
})

t.Run("should include manifest-tracked cleanup in init container script", func(t *testing.T) {
Expand Down Expand Up @@ -625,7 +625,7 @@ func TestPluginsIntegration(t *testing.T) {
for _, ic := range deployment.Spec.Template.Spec.InitContainers {
if ic.Name == PluginsInitContainerName {
found = true
assert.Contains(t, ic.Command[2], "openclaw plugins install clawhub:'@openclaw/matrix'")
assert.Contains(t, ic.Command[2], "openclaw plugins install '@openclaw/matrix'")

envMap := make(map[string]string)
for _, e := range ic.Env {
Expand Down Expand Up @@ -696,8 +696,8 @@ func TestPluginsIntegration(t *testing.T) {
for _, ic := range deployment.Spec.Template.Spec.InitContainers {
if ic.Name == PluginsInitContainerName {
script := ic.Command[2]
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install clawhub:'@openclaw/diagnostics-otel'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/matrix'")
assert.Contains(t, script, "openclaw plugins install '@openclaw/diagnostics-otel'")
return
}
}
Expand Down
Loading