Skip to content

Commit d638611

Browse files
authored
feat: split diffs language pack
Split the diffs viewer Shiki language pack into an external publishable plugin. The diffs plugin keeps the default curated syntax set, while the new @openclaw/diffs-language-pack package carries the extended Shiki languages for npm and ClawHub distribution. The install metadata includes the external ClawHub spec, and the curated C# alias set keeps both c# and cs supported without the language pack. Co-authored-by: Dallin Romney <[email protected]>
1 parent 5f7e21e commit d638611

44 files changed

Lines changed: 1168 additions & 108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/labeler.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@
496496
- changed-files:
497497
- any-glob-to-any-file:
498498
- "extensions/diffs/**"
499+
- "extensions/diffs-language-pack/**"
499500
"extensions: elevenlabs":
500501
- changed-files:
501502
- any-glob-to-any-file:

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ extensions/qa-lab/web/dist/
249249
# Generated bundled plugin runtime dependency manifests
250250
extensions/**/.openclaw-runtime-deps.json
251251
extensions/**/.openclaw-runtime-deps-stamp.json
252+
extensions/diffs-language-pack/assets/viewer-runtime.js
252253

253254
# Output dir for scripts/run-opengrep.sh (local opengrep scans)
254255
/.opengrep-out/

‎.oxlintrc.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
"dist-runtime/",
183183
"docs/_layouts/",
184184
"extensions/diffs/assets/viewer-runtime.js",
185+
"extensions/diffs-language-pack/assets/viewer-runtime.js",
185186
"node_modules/",
186187
"patches/",
187188
"pnpm-lock.yaml",

‎docs/plugins/manifest.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ or npm install metadata. Those belong in your plugin code and `package.json`.
149149
| ------------------------------------ | -------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
150150
| `id` | Yes | `string` | Canonical plugin id. This is the id used in `plugins.entries.<id>`. |
151151
| `configSchema` | Yes | `object` | Inline JSON Schema for this plugin's config. |
152+
| `requiresPlugins` | No | `string[]` | Plugin ids that must also be installed for this plugin to have an effect. Discovery keeps the plugin loadable but warns when any required plugin is missing. |
152153
| `enabledByDefault` | No | `true` | Marks a bundled plugin as enabled by default. Omit it, or set any non-`true` value, to leave the plugin disabled by default. |
153154
| `enabledByDefaultOnPlatforms` | No | `string[]` | Marks a bundled plugin as enabled by default only on the listed Node.js platforms, for example `["darwin"]`. Explicit config still wins. |
154155
| `legacyPluginIds` | No | `string[]` | Legacy ids that normalize to this canonical plugin id. |

‎docs/plugins/plugin-inventory.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ commands.
151151
| [diagnostics-otel](/plugins/reference/diagnostics-otel) | OpenClaw diagnostics OpenTelemetry exporter. | `@openclaw/diagnostics-otel`<br />npm; ClawHub: `clawhub:@openclaw/diagnostics-otel` | plugin |
152152
| [diagnostics-prometheus](/plugins/reference/diagnostics-prometheus) | OpenClaw diagnostics Prometheus exporter. | `@openclaw/diagnostics-prometheus`<br />npm; ClawHub: `clawhub:@openclaw/diagnostics-prometheus` | plugin |
153153
| [diffs](/plugins/reference/diffs) | Read-only diff viewer and file renderer for agents. | `@openclaw/diffs`<br />npm; ClawHub | contracts: tools; skills |
154+
| [diffs-language-pack](/plugins/reference/diffs-language-pack) | Adds syntax highlighting for languages outside the default diffs viewer set. | `@openclaw/diffs-language-pack`<br />npm; ClawHub: `clawhub:@openclaw/diffs-language-pack` | plugin |
154155
| [discord](/plugins/reference/discord) | Adds the Discord channel surface for sending and receiving OpenClaw messages. | `@openclaw/discord`<br />npm; ClawHub | channels: discord; contracts: transcriptSourceProviders |
155156
| [feishu](/plugins/reference/feishu) | Adds the Feishu channel surface for sending and receiving OpenClaw messages. | `@openclaw/feishu`<br />npm; ClawHub | channels: feishu; contracts: tools; skills |
156157
| [google-meet](/plugins/reference/google-meet) | Join Google Meet calls through Chrome or Twilio transports. | `@openclaw/google-meet`<br />npm; ClawHub | contracts: tools |

‎docs/plugins/reference.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pnpm plugins:inventory:gen
4444
| [diagnostics-otel](/plugins/reference/diagnostics-otel) | OpenClaw diagnostics OpenTelemetry exporter. | `@openclaw/diagnostics-otel`<br />npm; ClawHub: `clawhub:@openclaw/diagnostics-otel` | plugin |
4545
| [diagnostics-prometheus](/plugins/reference/diagnostics-prometheus) | OpenClaw diagnostics Prometheus exporter. | `@openclaw/diagnostics-prometheus`<br />npm; ClawHub: `clawhub:@openclaw/diagnostics-prometheus` | plugin |
4646
| [diffs](/plugins/reference/diffs) | Read-only diff viewer and file renderer for agents. | `@openclaw/diffs`<br />npm; ClawHub | contracts: tools; skills |
47+
| [diffs-language-pack](/plugins/reference/diffs-language-pack) | Adds syntax highlighting for languages outside the default diffs viewer set. | `@openclaw/diffs-language-pack`<br />npm; ClawHub: `clawhub:@openclaw/diffs-language-pack` | plugin |
4748
| [discord](/plugins/reference/discord) | Adds the Discord channel surface for sending and receiving OpenClaw messages. | `@openclaw/discord`<br />npm; ClawHub | channels: discord; contracts: transcriptSourceProviders |
4849
| [document-extract](/plugins/reference/document-extract) | Extract text and fallback page images from local document attachments. | `@openclaw/document-extract-plugin`<br />included in OpenClaw | contracts: documentExtractors |
4950
| [duckduckgo](/plugins/reference/duckduckgo) | Adds web search provider support. | `@openclaw/duckduckgo-plugin`<br />included in OpenClaw | contracts: webSearchProviders |
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
summary: "Adds syntax highlighting for languages outside the default diffs viewer set."
3+
read_when:
4+
- You are installing, configuring, or auditing the diffs-language-pack plugin
5+
title: "Diffs Language Pack plugin"
6+
---
7+
8+
# Diffs Language Pack plugin
9+
10+
Adds syntax highlighting for languages outside the default diffs viewer set.
11+
12+
## Distribution
13+
14+
- Package: `@openclaw/diffs-language-pack`
15+
- Install route: npm; ClawHub: `clawhub:@openclaw/diffs-language-pack`
16+
17+
## Surface
18+
19+
plugin

‎docs/tools/diffs.md‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ All fields are optional unless noted.
136136
Display filename for before and after mode.
137137
</ParamField>
138138
<ParamField path="lang" type="string">
139-
Language override hint for before and after mode. Unknown values fall back to plain text.
139+
Language override hint for before and after mode. Unknown values and languages outside the default viewer set fall back to plain text unless the
140+
Diff Viewer Language Pack plugin is installed.
140141
</ParamField>
142+
141143
<ParamField path="title" type="string">
142144
Viewer title override.
143145
</ParamField>
@@ -200,6 +202,22 @@ All fields are optional unless noted.
200202
</Accordion>
201203
</AccordionGroup>
202204

205+
## Syntax highlighting
206+
207+
OpenClaw includes syntax highlighting for common source, config, and documentation languages:
208+
209+
`javascript`, `typescript`, `tsx`, `jsx`, `json`, `markdown`, `yaml`, `css`, `html`, `sh`, `python`, `go`, `rust`, `java`, `c`, `cpp`, `csharp`, `php`, `sql`, and `docker`.
210+
211+
Common aliases such as `js`, `ts`, `bash`, `md`, `yml`, `c++`, and `dockerfile` are normalized to those default languages.
212+
213+
Install the Diff Viewer Language Pack plugin to highlight other languages:
214+
215+
```bash
216+
openclaw plugins install diffs-language-pack
217+
```
218+
219+
With the language pack available, OpenClaw automatically uses it for languages outside the default list. Without it, those files stay readable as plain text.
220+
203221
## Output details contract
204222

205223
The tool returns structured metadata under `details`.
@@ -385,6 +403,7 @@ Viewer assets:
385403

386404
- `/plugins/diffs/assets/viewer.js`
387405
- `/plugins/diffs/assets/viewer-runtime.js`
406+
- `/plugins/diffs-language-pack/assets/viewer.js` when the diff uses a language from the Diff Viewer Language Pack
388407

389408
The viewer document resolves those assets relative to the viewer URL, so an optional `baseUrl` path prefix is preserved for both asset requests too.
390409

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export {
2+
definePluginEntry,
3+
type OpenClawPluginApi,
4+
type OpenClawPluginHttpRouteHandler,
5+
type PluginLogger,
6+
} from "openclaw/plugin-sdk/plugin-entry";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { definePluginEntry } from "./api.js";
2+
import { registerDiffsLanguagePackPlugin } from "./src/plugin.js";
3+
4+
export default definePluginEntry({
5+
id: "diffs-language-pack",
6+
name: "Diff Viewer Language Pack",
7+
description: "Adds syntax highlighting for languages outside the default diffs viewer set.",
8+
register: registerDiffsLanguagePackPlugin,
9+
});

0 commit comments

Comments
 (0)