Skip to content

feat: improve install.sh with robust merging and parameterization#98

Closed
visahak wants to merge 1 commit into
AgentToolkit:mainfrom
visahak:copy-script
Closed

feat: improve install.sh with robust merging and parameterization#98
visahak wants to merge 1 commit into
AgentToolkit:mainfrom
visahak:copy-script

Conversation

@visahak

@visahak visahak commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator

Adding install and readme for the bob skills

Summary by CodeRabbit

  • New Features

    • Introduced Kaizen Lite Skills for Bob with automated installer that deploys skills and manages configuration seamlessly.
    • Includes backup and verification mechanisms to ensure successful installation.
  • Documentation

    • Added comprehensive guide covering installation instructions, usage examples, workflow recommendations, and development guidelines for Kaizen Lite.

@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces documentation and an automated installation script for Kaizen Lite Skills integration with Bob. The README provides setup instructions, usage examples, and development guidelines, while the install.sh script handles skill copying, configuration merging, and verification tasks.

Changes

Cohort / File(s) Summary
Kaizen Lite Documentation & Installation
platform-integrations/bob/kaizen-lite/README.md, platform-integrations/bob/kaizen-lite/install.sh
Adds comprehensive README documenting Kaizen Lite Skills (components, installation, usage, examples, and development guidelines). Introduces install.sh automation script that copies skills to target directory, manages custom_modes.yaml merging with backup creation, and performs post-install verification including skill listing and configuration validation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • illeatmyhat

Poem

🐰 A script hops through files with care and delight,
Skills copied and modes merged ever so right,
With backups and checks, the install flows true,
Kaizen Lite shines with docs crisp and new! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title focuses on install.sh improvements (robust merging and parameterization), but the PR adds both install.sh AND a README, with the description emphasizing installing bob skills generally. The title is only partially related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@platform-integrations/bob/kaizen-lite/install.sh`:
- Around line 117-129: The current awk that appends "everything after old
kaizen-lite" (the command referencing TARGET_MODES_FILE) fails to print trailing
content when kaizen-lite is the last mode; update that awk so it prints any
lines after the kaizen-lite match even if no subsequent "- slug:" is found.
Replace the awk '/^  - slug: kaizen-lite/ {f=1; next} f && /^  - slug:/ {p=1;
f=0} p' "$TARGET_MODES_FILE" >> "$temp_output" with an expression that sets a
flag on the kaizen-lite match and prints lines while the flag is set (and
continues to print after the next "- slug:" as before) — e.g. use logic like /^ 
- slug: kaizen-lite/{f=1; next} f{ if (/^  - slug:/) {p=1; f=0} } p||f{print} to
ensure trailing comments/content after kaizen-lite are preserved when appending
temp_new_mode; keep references to TARGET_MODES_FILE, temp_output and
temp_new_mode intact.
- Around line 107-132: temp_output is created but never removed and the awk
patterns only match exactly two-space indentation; add a cleanup trap at script
start to rm -f "$temp_new_mode" "$temp_output" on EXIT (so temp files are
removed even after mv or on errors) and update the awk/grep patterns that
currently use '^  - slug:' to a whitespace-flexible form (e.g., match leading
spaces/tabs before '- slug:' and specifically '- slug: kaizen-lite' when
selecting SOURCE_MODES_FILE and TARGET_MODES_FILE) so the merge works with
different YAML indentation styles.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 65a982d5-ef33-4154-ac0f-e4072de1d5b5

📥 Commits

Reviewing files that changed from the base of the PR and between bdd52ed and 19dc4a4.

📒 Files selected for processing (2)
  • platform-integrations/bob/kaizen-lite/README.md
  • platform-integrations/bob/kaizen-lite/install.sh

Comment on lines +107 to +132
temp_new_mode=$(mktemp)
awk '/^ - slug: kaizen-lite/ {f=1} /^ - slug:/ && !/kaizen-lite/ {f=0} f' "$SOURCE_MODES_FILE" > "$temp_new_mode"

# Check if kaizen-lite already exists in custom_modes.yaml
if grep -q "slug: kaizen-lite" "$TARGET_MODES_FILE"; then
echo -e "${BLUE} Updating existing kaizen-lite mode...${NC}"
# Remove old kaizen-lite mode and add new one
temp_output=$(mktemp)

# Copy everything before kaizen-lite
awk '/^ - slug: kaizen-lite/{exit} {print}' "$TARGET_MODES_FILE" > "$temp_output"

# Add new kaizen-lite mode
cat "$temp_new_mode" >> "$temp_output"

# Add everything after old kaizen-lite (skip to next mode or end)
awk '/^ - slug: kaizen-lite/ {f=1; next} f && /^ - slug:/ {p=1; f=0} p' "$TARGET_MODES_FILE" >> "$temp_output"

mv "$temp_output" "$TARGET_MODES_FILE"
else
echo -e "${BLUE} Adding new kaizen-lite mode...${NC}"
# Just append the new mode
cat "$temp_new_mode" >> "$TARGET_MODES_FILE"
fi

rm "$temp_new_mode"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Temp file temp_output is never cleaned up.

The temp_new_mode file is cleaned up at line 132, but temp_output (created at line 114) is never removed. After the mv operation, the temp file handle persists in /tmp.

Additionally, the awk patterns assume exactly 2-space YAML indentation (^ - slug:). Different indentation styles will silently break the merge.

🛠️ Proposed fix for temp file cleanup
             mv "$temp_output" "$TARGET_MODES_FILE"
+            # temp_output was moved, no cleanup needed
         else
             echo -e "${BLUE}  Adding new kaizen-lite mode...${NC}"
             # Just append the new mode
             cat "$temp_new_mode" >> "$TARGET_MODES_FILE"
         fi
         
         rm "$temp_new_mode"

Note: Since mv moves the file, explicit rm isn't needed for temp_output. However, consider adding a trap to clean up temp files on script exit/error:

# Near the top of the script, after set -e
cleanup() {
    rm -f "$temp_new_mode" "$temp_output" 2>/dev/null || true
}
trap cleanup EXIT
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@platform-integrations/bob/kaizen-lite/install.sh` around lines 107 - 132,
temp_output is created but never removed and the awk patterns only match exactly
two-space indentation; add a cleanup trap at script start to rm -f
"$temp_new_mode" "$temp_output" on EXIT (so temp files are removed even after mv
or on errors) and update the awk/grep patterns that currently use '^  - slug:'
to a whitespace-flexible form (e.g., match leading spaces/tabs before '- slug:'
and specifically '- slug: kaizen-lite' when selecting SOURCE_MODES_FILE and
TARGET_MODES_FILE) so the merge works with different YAML indentation styles.

Comment on lines +117 to +129
awk '/^ - slug: kaizen-lite/{exit} {print}' "$TARGET_MODES_FILE" > "$temp_output"

# Add new kaizen-lite mode
cat "$temp_new_mode" >> "$temp_output"

# Add everything after old kaizen-lite (skip to next mode or end)
awk '/^ - slug: kaizen-lite/ {f=1; next} f && /^ - slug:/ {p=1; f=0} p' "$TARGET_MODES_FILE" >> "$temp_output"

mv "$temp_output" "$TARGET_MODES_FILE"
else
echo -e "${BLUE} Adding new kaizen-lite mode...${NC}"
# Just append the new mode
cat "$temp_new_mode" >> "$TARGET_MODES_FILE"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

YAML merge may lose trailing content when kaizen-lite is the last mode.

The awk logic at line 123 only starts printing (p=1) when it encounters another - slug: after kaizen-lite. If kaizen-lite is the last mode in the target file, any trailing comments or content after it will be silently dropped.

♻️ Proposed fix to preserve trailing content
-            # Add everything after old kaizen-lite (skip to next mode or end)
-            awk '/^  - slug: kaizen-lite/ {f=1; next} f && /^  - slug:/ {p=1; f=0} p' "$TARGET_MODES_FILE" >> "$temp_output"
+            # Add everything after old kaizen-lite (skip to next mode or end, preserve trailing content)
+            awk '
+                /^  - slug: kaizen-lite/ {f=1; next}
+                f && /^  - slug:/ {p=1; f=0}
+                f && /^[^ ]/ && !/^  - slug:/ {p=1; f=0}  # Also catch non-indented lines (top-level keys, comments)
+                p
+            ' "$TARGET_MODES_FILE" >> "$temp_output"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@platform-integrations/bob/kaizen-lite/install.sh` around lines 117 - 129, The
current awk that appends "everything after old kaizen-lite" (the command
referencing TARGET_MODES_FILE) fails to print trailing content when kaizen-lite
is the last mode; update that awk so it prints any lines after the kaizen-lite
match even if no subsequent "- slug:" is found. Replace the awk '/^  - slug:
kaizen-lite/ {f=1; next} f && /^  - slug:/ {p=1; f=0} p' "$TARGET_MODES_FILE" >>
"$temp_output" with an expression that sets a flag on the kaizen-lite match and
prints lines while the flag is set (and continues to print after the next "-
slug:" as before) — e.g. use logic like /^  - slug: kaizen-lite/{f=1; next} f{
if (/^  - slug:/) {p=1; f=0} } p||f{print} to ensure trailing comments/content
after kaizen-lite are preserved when appending temp_new_mode; keep references to
TARGET_MODES_FILE, temp_output and temp_new_mode intact.

@vinodmut

Copy link
Copy Markdown
Contributor

@visahak Can you address the coderabbit comments?

@visahak

visahak commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator Author

I don't think we need to merge this anymore.

@visahak visahak closed this Mar 23, 2026
@visahak visahak deleted the copy-script branch April 1, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants