Skip to content

refactor: deduplicate OpenClaw adapter, fix clawdbot config#98

Merged
rohitg00 merged 2 commits intomainfrom
fix/openclaw-cleanup
Apr 7, 2026
Merged

refactor: deduplicate OpenClaw adapter, fix clawdbot config#98
rohitg00 merged 2 commits intomainfrom
fix/openclaw-cleanup

Conversation

@rohitg00
Copy link
Copy Markdown
Owner

@rohitg00 rohitg00 commented Apr 7, 2026

Summary

Follow-up cleanup to #86 (merged with @austinmao's full attribution).

  • OpenClawAdapter extends ClawdbotAdapter — removes 80 lines of identical generateConfig/parseConfig/getInvokeCommand
  • Clawdbot config reverted to legacy paths (.clawdbot/skills, AGENTS.md) — preserves existing clawdbot users
  • OpenClaw keeps its own configskills/, CLAUDE.md, ~/.openclaw/, extended frontmatter
  • Detection separated — OpenClaw: ~/.openclaw or openclaw.json. Clawdbot: ~/.clawdbot or clawdbot.json
  • Tests fixed — adapter count 44→45, stale skills/ detection assertions removed

Test Plan

  • 189 agent tests pass
  • core + agents build clean

Open with Devin

Summary by CodeRabbit

  • Refactor

    • Improved agent adapter structure for better reuse.
    • Simplified OpenClaw detection to check for standard config locations.
  • Chores

    • Updated Clawdbot configuration and skill directory locations.
    • Standardized agent type declarations across the codebase.
  • Tests

    • Adjusted adapter registry test count and removed a Clawdbot detection test.

Follow-up to #86 — cleanup without changing contributor attribution.

- OpenClawAdapter extends ClawdbotAdapter (removes 80 lines of copy-paste)
- Revert clawdbot config to legacy paths (.clawdbot/skills, AGENTS.md)
- OpenClaw detection: ~/.openclaw or openclaw.json
- Widen ClawdbotAdapter property types for extensibility
- Fix tests: adapter count 44→45, remove stale detection assertions
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
skillkit Ignored Ignored Preview Apr 7, 2026 10:52am
skillkit-docs Ignored Ignored Preview Apr 7, 2026 10:52am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6767f63c-856d-40e8-b9f0-e4652140a255

📥 Commits

Reviewing files that changed from the base of the PR and between 808ae83 and 02fe3f2.

📒 Files selected for processing (1)
  • packages/tui/src/services/translator.service.ts

📝 Walkthrough

Walkthrough

Clawdbot and OpenClaw adapters were restructured: OpenClawAdapter now extends ClawdbotAdapter. Clawdbot adapter properties gained explicit string type annotations. OpenClaw detection logic was simplified. Clawdbot agent config entries were updated. Test expectations were adjusted (adapter count and Clawdbot detection assertions).

Changes

Cohort / File(s) Summary
Tests
packages/agents/src/__tests__/adapters.test.ts, packages/agents/src/__tests__/clawdbot.test.ts
Adapter registry test updated expected count from 44 → 45; removed a Clawdbot detection test/assertion that checked for a project skills directory.
Adapter implementations
packages/agents/src/clawdbot.ts, packages/agents/src/openclaw.ts
ClawdbotAdapter properties annotated explicitly as string. OpenClawAdapter changed from implementing AgentAdapter to extending ClawdbotAdapter; removed its own generate/parse/invoke implementations and simplified isDetected() to check only ~/.openclaw or local openclaw.json.
Agent configuration
packages/core/src/agent-config.ts
AGENT_CONFIG['clawdbot'] revised: skillsDir'.clawdbot/skills', configFile'AGENTS.md', altSkillsDirs changed, globalSkillsDir removed, and frontmatterFields removed.
Type export change
packages/tui/src/services/translator.service.ts
Removed local AgentType union; now imports and re-exports AgentType from @skillkit/core.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through code with nimble paws and cheer,

OpenClaw now leans on Clawdbot near,
Paths snug in .clawdbot where configs hide,
Tests updated — one more adapter beside,
A rabbit's small cheer for the tidy new stride.

🚥 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 'refactor: deduplicate OpenClaw adapter, fix clawdbot config' clearly and accurately summarizes the main changes: refactoring OpenClaw to extend ClawdbotAdapter (deduplication) and fixing clawdbot configuration paths.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/openclaw-cleanup

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.

The TUI had a manually-maintained 44-agent AgentType union in
translator.service.ts that fell out of sync when openclaw was added
to core. Replace with re-export from @skillkit/core so it stays in
sync automatically. Fixes CI typecheck failure from #86.
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@packages/agents/src/openclaw.ts`:
- Around line 16-21: The detection logic in isDetected was loosened by removing
the skills/ directory check; restore the original semantics so we only return
true when either (there is a local skills directory AND the global ~/.openclaw
exists) OR a local openclaw.json exists. Update isDetected to compute the
skillsDir (e.g., join(process.cwd(), 'skills')), check existsSync(skillsDir)
together with globalOpenClaw, and only OR that combined result with
existsSync(openclawConfig); keep using the same identifiers (isDetected,
globalOpenClaw, openclawConfig) and existsSync checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7b499885-4769-438d-a366-1a1ed2109c5e

📥 Commits

Reviewing files that changed from the base of the PR and between 5324e45 and 808ae83.

📒 Files selected for processing (5)
  • packages/agents/src/__tests__/adapters.test.ts
  • packages/agents/src/__tests__/clawdbot.test.ts
  • packages/agents/src/clawdbot.ts
  • packages/agents/src/openclaw.ts
  • packages/core/src/agent-config.ts
💤 Files with no reviewable changes (1)
  • packages/agents/src/tests/clawdbot.test.ts

Comment on lines +16 to 21
override async isDetected(): Promise<boolean> {
const globalOpenClaw = join(homedir(), '.openclaw');
// OpenClaw config file
const openclawConfig = join(process.cwd(), 'openclaw.json');

return (
(existsSync(projectSkills) && existsSync(globalOpenClaw)) ||
existsSync(openclawConfig)
);
return existsSync(globalOpenClaw) || existsSync(openclawConfig);
}
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if there are any other detection patterns in the codebase that might conflict
echo "Checking other adapter detection patterns..."
rg -n "isDetected|existsSync.*skills" packages/agents/src/*.ts

echo ""
echo "Checking if any tests verify the old detection behavior with skills/ directory..."
rg -n "isDetected|skills.*openclaw|openclaw.*skills" packages/agents/src/__tests__/

Repository: rohitg00/skillkit

Length of output: 2415


🏁 Script executed:

# Find and examine openclaw test file
find packages/agents/src/__tests__/ -name "*openclaw*" -type f

Repository: rohitg00/skillkit

Length of output: 43


🏁 Script executed:

# Read the full openclaw.ts file to see context
cat -n packages/agents/src/openclaw.ts

Repository: rohitg00/skillkit

Length of output: 1001


🏁 Script executed:

# Check git history for changes to skills/ directory check in openclaw.ts
git log --oneline packages/agents/src/openclaw.ts | head -20

Repository: rohitg00/skillkit

Length of output: 128


🏁 Script executed:

# Search for any references to skills/ directory in openclaw-related context
rg "skills" packages/agents/src/ -i --type ts -B 2 -A 2

Repository: rohitg00/skillkit

Length of output: 50373


🏁 Script executed:

# Get the actual diff from the commit that refactored openclaw
git show 808ae83 packages/agents/src/openclaw.ts

Repository: rohitg00/skillkit

Length of output: 1705


🏁 Script executed:

# Check the ClawdbotAdapter parent class to understand inheritance
cat -n packages/agents/src/clawdbot.ts | head -100

Repository: rohitg00/skillkit

Length of output: 2874


🏁 Script executed:

# Search for any mention of skills/ directory in openclaw context across the codebase
rg "openclaw|OpenClaw" packages/agents/src/ -B 3 -A 3 | grep -i "skills\|skill" | head -30

Repository: rohitg00/skillkit

Length of output: 302


🏁 Script executed:

# Check if there's a backup or old version of openclaw file
find . -name "*openclaw*" -type f | head -20

Repository: rohitg00/skillkit

Length of output: 94


🏁 Script executed:

# Look for any PR or commit message reference to `#86`
git log --all --oneline | grep -i "#86\|openclaw" | head -10

Repository: rohitg00/skillkit

Length of output: 315


🏁 Script executed:

# Show the original OpenClaw adapter implementation from PR `#86`
git show 5324e45:packages/agents/src/openclaw.ts

Repository: rohitg00/skillkit

Length of output: 3179


Detection logic was significantly relaxed — verify intentional scope change.

The isDetected() method previously required (skills/ directory AND ~/.openclaw exist) OR openclaw.json exists. It now returns true if either ~/.openclaw OR openclaw.json exists, removing the skills/ directory check entirely.

This means projects will now be detected as OpenClaw if the developer simply has ~/.openclaw installed globally—even without a local skills/ directory or openclaw.json file. Confirm this intentional relaxation won't cause false positives, particularly in environments where multiple developers share the same machine with a shared ~/.openclaw directory.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/agents/src/openclaw.ts` around lines 16 - 21, The detection logic in
isDetected was loosened by removing the skills/ directory check; restore the
original semantics so we only return true when either (there is a local skills
directory AND the global ~/.openclaw exists) OR a local openclaw.json exists.
Update isDetected to compute the skillsDir (e.g., join(process.cwd(),
'skills')), check existsSync(skillsDir) together with globalOpenClaw, and only
OR that combined result with existsSync(openclawConfig); keep using the same
identifiers (isDetected, globalOpenClaw, openclawConfig) and existsSync checks.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@rohitg00 rohitg00 merged commit 12bba7f into main Apr 7, 2026
10 checks passed
@rohitg00 rohitg00 deleted the fix/openclaw-cleanup branch April 7, 2026 10:57
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.

1 participant