Files
rtk-ai__rtk/openclaw/package.json
T
Alex 56160d8399 feat: OpenClaw plugin for transparent exec rewriting (#358)
* feat: add OpenClaw plugin for transparent exec rewriting

Adds an OpenClaw plugin that intercepts exec tool calls via the
before_tool_call hook and rewrites commands to their RTK equivalents.

This is the OpenClaw equivalent of hooks/rtk-rewrite.sh for Claude Code.

The plugin:
- Registers a before_tool_call hook on the exec tool
- Rewrites git, grep, find, ls, gh, docker, kubectl, and test commands
- Guards against rewriting piped/compound commands and heredocs
- Returns properly typed PluginHookBeforeToolCallResult
- Supports enabled/verbose config options

Measured savings: 48-87% token reduction on common commands.

Files:
- openclaw/index.ts — plugin source
- openclaw/openclaw.plugin.json — plugin manifest
- openclaw/README.md — installation and usage docs

* refactor: delegate OpenClaw plugin to rtk rewrite

Replace 60+ hardcoded regex rules with a single call to `rtk rewrite`,
matching the OpenCode plugin pattern (hooks/opencode-rtk.ts).

Benefits:
- Zero maintenance: new RTK filters work automatically
- Single source of truth: rewrite logic in Rust (src/discover/registry.rs)
- 122 → 73 lines, no rule duplication

Also: rebase on develop, fix homepage URL, bump version to 1.0.0.
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* feat: add package.json for npm publishing

Enables `openclaw plugins install @rtk-ai/rtk-rewrite` for OpenClaw users.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

---------

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Co-authored-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-18 15:00:30 +01:00

30 lines
610 B
JSON

{
"name": "@rtk-ai/rtk-rewrite",
"version": "1.0.0",
"description": "RTK plugin for OpenClaw — rewrites shell commands for 60-90% LLM token savings",
"main": "index.ts",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/rtk-ai/rtk",
"directory": "openclaw"
},
"homepage": "https://github.com/rtk-ai/rtk",
"keywords": [
"rtk",
"openclaw",
"openclaw-plugin",
"token-savings",
"llm",
"cli-proxy"
],
"files": [
"index.ts",
"openclaw.plugin.json",
"README.md"
],
"peerDependencies": {
"rtk": ">=0.28.0"
}
}