@openclaw/plugin-inspector 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +331 -152
- package/package.json +1 -1
- package/src/capture-api.js +18 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,51 +1,74 @@
|
|
|
1
|
-
<img src="docs/plugin-inspector-banner.jpg" alt="
|
|
1
|
+
<img src="docs/plugin-inspector-banner.jpg" alt="OpenClaw Plugin Inspector banner">
|
|
2
2
|
|
|
3
3
|
# OpenClaw Plugin Inspector
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
imports, `api.on(...)`, `api.register*`, and optional runtime registration
|
|
8
|
-
capture.
|
|
5
|
+
`@openclaw/plugin-inspector` is the offline compatibility checker for OpenClaw
|
|
6
|
+
plugin packages and plugin fixture suites.
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
It answers the questions that matter before a plugin reaches users:
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
- can OpenClaw discover the package metadata and `openclaw.plugin.json`
|
|
11
|
+
manifest?
|
|
12
|
+
- which hooks, registration calls, manifest contracts, and SDK imports does the
|
|
13
|
+
plugin use?
|
|
14
|
+
- does the plugin still look compatible without local OpenClaw internals?
|
|
15
|
+
- if CI finds a breakage, which JSON, Markdown, SARIF, JUnit, and summary
|
|
16
|
+
artifacts should downstream automation read?
|
|
17
|
+
- when a fixture-suite harness such as Crabpot runs many plugins, which findings
|
|
18
|
+
are hard breakages, known warnings, live issues, deprecations, or inspector
|
|
19
|
+
proof gaps?
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
21
|
+
The default path is static, offline, and credential-free. Runtime capture exists,
|
|
22
|
+
but it is opt-in because it imports plugin code.
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
when compatibility breakages are found.
|
|
24
|
+
## Requirements
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
- Node.js 22 or newer.
|
|
27
|
+
- A plugin package root with `package.json`.
|
|
28
|
+
- `openclaw.plugin.json` when the plugin uses the OpenClaw manifest contract.
|
|
29
|
+
- No OpenClaw checkout, credentials, network service, or live provider access for
|
|
30
|
+
default inspection.
|
|
31
|
+
|
|
32
|
+
Pass `--no-openclaw` when CI should not compare against a local OpenClaw
|
|
33
|
+
checkout. If an OpenClaw checkout is supplied with `--openclaw <path>`, the
|
|
34
|
+
inspector only reads public compatibility surfaces such as compat records, SDK
|
|
35
|
+
exports, hook names, manifest fields, and registrar metadata.
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
Run this from a plugin package root:
|
|
22
40
|
|
|
23
41
|
```bash
|
|
24
|
-
|
|
25
|
-
yarn dlx @openclaw/plugin-inspector
|
|
26
|
-
bunx @openclaw/plugin-inspector
|
|
42
|
+
npx @openclaw/plugin-inspector inspect --no-openclaw
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
Equivalent one-off runners:
|
|
30
46
|
|
|
31
47
|
```bash
|
|
32
|
-
|
|
48
|
+
pnpm dlx @openclaw/plugin-inspector inspect --no-openclaw
|
|
49
|
+
yarn dlx @openclaw/plugin-inspector inspect --no-openclaw
|
|
50
|
+
bunx @openclaw/plugin-inspector inspect --no-openclaw
|
|
33
51
|
```
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
`--package-manager pnpm`, `npm`, `yarn`, or `bun` when you want to override it.
|
|
37
|
-
Add `--scripts` to write `plugin:check` and `plugin:ci` package scripts.
|
|
38
|
-
Use `--dry-run` to preview the files first.
|
|
53
|
+
The command writes:
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
- `reports/plugin-inspector-report.json`
|
|
56
|
+
- `reports/plugin-inspector-report.md`
|
|
57
|
+
- `reports/plugin-inspector-issues.md`
|
|
58
|
+
|
|
59
|
+
It exits non-zero when hard compatibility breakages are found. Warnings,
|
|
60
|
+
suggestions, issue classifications, and logs stay visible in the report without
|
|
61
|
+
necessarily failing the command.
|
|
62
|
+
|
|
63
|
+
## Install In A Plugin Repo
|
|
64
|
+
|
|
65
|
+
Install the package when you want repeatable local scripts and CI:
|
|
41
66
|
|
|
42
67
|
```bash
|
|
43
68
|
npm install --save-dev @openclaw/plugin-inspector
|
|
44
|
-
npx plugin-inspector check
|
|
45
69
|
```
|
|
46
70
|
|
|
47
|
-
|
|
48
|
-
the same command:
|
|
71
|
+
Add scripts:
|
|
49
72
|
|
|
50
73
|
```json
|
|
51
74
|
{
|
|
@@ -56,55 +79,53 @@ the same command:
|
|
|
56
79
|
}
|
|
57
80
|
```
|
|
58
81
|
|
|
59
|
-
|
|
82
|
+
Then run:
|
|
60
83
|
|
|
61
84
|
```bash
|
|
62
|
-
|
|
63
|
-
npx @openclaw/plugin-inspector inspect
|
|
64
|
-
npx @openclaw/plugin-inspector ci --no-openclaw
|
|
65
|
-
npx @openclaw/plugin-inspector config
|
|
66
|
-
npx @openclaw/plugin-inspector check --plugin-root ./plugins/weather
|
|
67
|
-
npx @openclaw/plugin-inspector init --ci --package-manager pnpm
|
|
68
|
-
npx @openclaw/plugin-inspector init --ci --scripts --dry-run
|
|
69
|
-
npx @openclaw/plugin-inspector init --ci --scripts --dry-run --json
|
|
85
|
+
npm run plugin:check
|
|
70
86
|
```
|
|
71
87
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
is kept for scripts. Both write:
|
|
75
|
-
|
|
76
|
-
- `reports/plugin-inspector-report.json`
|
|
77
|
-
- `reports/plugin-inspector-report.md`
|
|
78
|
-
- `reports/plugin-inspector-issues.md`
|
|
79
|
-
|
|
80
|
-
Use CI-native outputs when you want annotations or test-summary ingestion:
|
|
88
|
+
The initializer can write the starter config, package scripts, and GitHub
|
|
89
|
+
Actions workflow:
|
|
81
90
|
|
|
82
91
|
```bash
|
|
83
|
-
plugin-inspector
|
|
92
|
+
npx @openclaw/plugin-inspector init --ci --scripts --dry-run
|
|
93
|
+
npx @openclaw/plugin-inspector init --ci --scripts
|
|
84
94
|
```
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
- `reports/plugin-inspector.junit.xml`
|
|
90
|
-
|
|
91
|
-
`config` prints the resolved plugin root, fixture id, seams, and capture
|
|
92
|
-
settings before CI runs:
|
|
96
|
+
`init` detects `packageManager` and common lockfiles. Override that with
|
|
97
|
+
`--package-manager npm`, `--package-manager pnpm`, `--package-manager yarn`, or
|
|
98
|
+
`--package-manager bun`. Existing files are protected unless you pass `--force`.
|
|
93
99
|
|
|
94
|
-
|
|
95
|
-
plugin-inspector config --json
|
|
96
|
-
```
|
|
100
|
+
## Configuration
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
checkout:
|
|
102
|
+
Small plugin repos can keep configuration in `package.json`:
|
|
100
103
|
|
|
101
|
-
```
|
|
102
|
-
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"scripts": {
|
|
107
|
+
"plugin:check": "plugin-inspector inspect --no-openclaw",
|
|
108
|
+
"plugin:ci": "plugin-inspector ci --no-openclaw --runtime --mock-sdk --allow-execute"
|
|
109
|
+
},
|
|
110
|
+
"pluginInspector": {
|
|
111
|
+
"version": 1,
|
|
112
|
+
"plugin": {
|
|
113
|
+
"id": "weather",
|
|
114
|
+
"priority": "high",
|
|
115
|
+
"seams": ["dynamic-tool"],
|
|
116
|
+
"sourceRoot": "src",
|
|
117
|
+
"expect": {
|
|
118
|
+
"registrations": ["registerTool"]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"capture": {
|
|
122
|
+
"mockSdk": true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
103
126
|
```
|
|
104
127
|
|
|
105
|
-
Use
|
|
106
|
-
`pluginInspector` block when CI needs stable fixture metadata, expected seams,
|
|
107
|
-
or runtime capture defaults:
|
|
128
|
+
Use `plugin-inspector.config.json` for a standalone config file:
|
|
108
129
|
|
|
109
130
|
```json
|
|
110
131
|
{
|
|
@@ -127,66 +148,88 @@ or runtime capture defaults:
|
|
|
127
148
|
}
|
|
128
149
|
```
|
|
129
150
|
|
|
130
|
-
|
|
151
|
+
Inspect the resolved config before wiring CI:
|
|
131
152
|
|
|
132
153
|
```bash
|
|
133
|
-
plugin-inspector
|
|
154
|
+
plugin-inspector config --json
|
|
134
155
|
```
|
|
135
156
|
|
|
136
|
-
|
|
157
|
+
Copy-ready examples live in:
|
|
137
158
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
"pluginInspector": {
|
|
144
|
-
"version": 1,
|
|
145
|
-
"plugin": {
|
|
146
|
-
"id": "weather",
|
|
147
|
-
"priority": "high",
|
|
148
|
-
"seams": ["dynamic-tool"],
|
|
149
|
-
"sourceRoot": "src"
|
|
150
|
-
},
|
|
151
|
-
"capture": {
|
|
152
|
-
"mockSdk": true
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
```
|
|
159
|
+
- `examples/plugin-inspector.config.json`
|
|
160
|
+
- `examples/package-json-plugin-inspector.json`
|
|
161
|
+
|
|
162
|
+
## Commands
|
|
157
163
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
`
|
|
161
|
-
`
|
|
162
|
-
`
|
|
163
|
-
|
|
164
|
+
| Command | Purpose |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| `plugin-inspector` | Default alias for `check`. |
|
|
167
|
+
| `plugin-inspector check` | Script-friendly plugin-root check. |
|
|
168
|
+
| `plugin-inspector inspect` | Plugin-root check unless `--config` is supplied; with `--config`, runs a fixture report. |
|
|
169
|
+
| `plugin-inspector ci` | Compatibility report plus CI summary, SARIF, and JUnit outputs. |
|
|
170
|
+
| `plugin-inspector config` | Print resolved plugin-root config as text or JSON. |
|
|
171
|
+
| `plugin-inspector init` | Write starter config, scripts, and optional GitHub Actions workflow. |
|
|
172
|
+
| `plugin-inspector report` | Run a fixture-suite config with many plugins. |
|
|
173
|
+
| `plugin-inspector capture` | Runtime-capture one entrypoint directly. |
|
|
174
|
+
|
|
175
|
+
Common options:
|
|
176
|
+
|
|
177
|
+
| Option | Meaning |
|
|
178
|
+
| --- | --- |
|
|
179
|
+
| `--plugin-root <path>` / `--root <path>` | Check a plugin somewhere other than the current directory. |
|
|
180
|
+
| `--config <path>` | Read a standalone config file. Required for fixture-suite `report`. |
|
|
181
|
+
| `--out <dir>` | Write reports somewhere other than `reports/`. |
|
|
182
|
+
| `--openclaw <path>` | Compare against a local OpenClaw checkout. |
|
|
183
|
+
| `--no-openclaw` | Disable OpenClaw checkout comparison. |
|
|
184
|
+
| `--runtime` / `--capture` | Add opt-in runtime registration capture. |
|
|
185
|
+
| `--no-runtime` / `--no-capture` | Disable runtime capture even when config enables it. |
|
|
186
|
+
| `--mock-sdk` / `--sdk mock` | Use generated SDK and external-package mocks for runtime capture. |
|
|
187
|
+
| `--real-sdk` / `--sdk real` | Use installed real SDK dependencies instead of mocks. |
|
|
188
|
+
| `--allow-execute` | Permit commands that import plugin code. |
|
|
189
|
+
| `--json` | Print machine-readable JSON to stdout. |
|
|
190
|
+
| `--sarif [path]` | Write SARIF from `check` or `inspect`; `ci` enables this by default. |
|
|
191
|
+
| `--junit [path]` | Write JUnit XML from `check` or `inspect`; `ci` enables this by default. |
|
|
192
|
+
| `--no-sarif` / `--no-junit` | Disable default `ci` outputs. |
|
|
193
|
+
|
|
194
|
+
Run the built-in help for the exact CLI surface:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
plugin-inspector --help
|
|
198
|
+
```
|
|
164
199
|
|
|
165
200
|
## Runtime Capture
|
|
166
201
|
|
|
167
202
|
Runtime capture imports plugin entrypoints in an isolated subprocess and records
|
|
168
|
-
|
|
169
|
-
|
|
203
|
+
what `register(api)` does. Use it when static inspection cannot prove the actual
|
|
204
|
+
registrations made at runtime.
|
|
170
205
|
|
|
171
206
|
```bash
|
|
172
|
-
|
|
207
|
+
plugin-inspector inspect --no-openclaw --runtime --mock-sdk --allow-execute
|
|
173
208
|
```
|
|
174
209
|
|
|
175
|
-
`--allow-execute` is the
|
|
176
|
-
older
|
|
177
|
-
|
|
210
|
+
`--allow-execute` is the deliberate safety switch. Without it, modes that import
|
|
211
|
+
plugin code fail closed. The older environment guard still works for custom
|
|
212
|
+
harnesses:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
PLUGIN_INSPECTOR_EXECUTE_ISOLATED=1 plugin-inspector inspect --no-openclaw --runtime --mock-sdk
|
|
216
|
+
```
|
|
178
217
|
|
|
179
|
-
By default, runtime capture uses
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
218
|
+
By default, runtime capture uses generated mocks for `openclaw/plugin-sdk`
|
|
219
|
+
subpaths and unresolved external packages discovered in the plugin import graph.
|
|
220
|
+
That keeps compatibility CI offline and credential-free. It does not call live
|
|
221
|
+
services, launch OpenClaw, run provider SDKs, or emulate service lifecycle side
|
|
222
|
+
effects.
|
|
223
|
+
|
|
224
|
+
Use `--real-sdk` only when the plugin workspace already has real SDK
|
|
225
|
+
dependencies installed and you intentionally want that path.
|
|
183
226
|
|
|
184
227
|
Runtime capture writes:
|
|
185
228
|
|
|
186
229
|
- `reports/plugin-inspector-runtime-capture.json`
|
|
187
230
|
- `reports/plugin-inspector-runtime-capture.md`
|
|
188
231
|
|
|
189
|
-
|
|
232
|
+
Capture one entrypoint directly:
|
|
190
233
|
|
|
191
234
|
```bash
|
|
192
235
|
plugin-inspector capture ./dist/index.js --mock-sdk --allow-execute
|
|
@@ -194,18 +237,10 @@ plugin-inspector capture ./dist/index.js --mock-sdk --allow-execute
|
|
|
194
237
|
|
|
195
238
|
## CI
|
|
196
239
|
|
|
197
|
-
|
|
240
|
+
`plugin-inspector ci` writes the normal compatibility report plus CI-native
|
|
241
|
+
summary, SARIF, and JUnit artifacts.
|
|
198
242
|
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
"scripts": {
|
|
202
|
-
"plugin:check": "plugin-inspector inspect --no-openclaw",
|
|
203
|
-
"plugin:ci": "plugin-inspector ci --no-openclaw --runtime --mock-sdk --allow-execute"
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
GitHub Actions without a local dev dependency:
|
|
243
|
+
Minimal GitHub Actions workflow:
|
|
209
244
|
|
|
210
245
|
```yaml
|
|
211
246
|
name: plugin-inspector
|
|
@@ -233,70 +268,214 @@ jobs:
|
|
|
233
268
|
path: reports/plugin-inspector-*
|
|
234
269
|
```
|
|
235
270
|
|
|
236
|
-
`ci`
|
|
237
|
-
|
|
271
|
+
Generated `ci` artifacts:
|
|
272
|
+
|
|
273
|
+
- `reports/plugin-inspector-report.json`
|
|
274
|
+
- `reports/plugin-inspector-report.md`
|
|
275
|
+
- `reports/plugin-inspector-issues.md`
|
|
276
|
+
- `reports/plugin-inspector-ci-summary.json`
|
|
277
|
+
- `reports/plugin-inspector-ci-summary.md`
|
|
278
|
+
- `reports/plugin-inspector.sarif`
|
|
279
|
+
- `reports/plugin-inspector.junit.xml`
|
|
280
|
+
|
|
281
|
+
CI examples:
|
|
282
|
+
|
|
283
|
+
- `examples/github-actions-plugin-inspector.yml`
|
|
284
|
+
- `examples/github-actions-code-scanning.yml`
|
|
285
|
+
- `examples/gitlab-ci-plugin-inspector.yml`
|
|
286
|
+
- `examples/circleci-plugin-inspector.yml`
|
|
287
|
+
|
|
288
|
+
## Report Surfaces
|
|
289
|
+
|
|
290
|
+
The compatibility report is the primary contract. Preserve field names and
|
|
291
|
+
finding codes because downstream CI and Crabpot reports may consume them.
|
|
292
|
+
|
|
293
|
+
Important report sections:
|
|
294
|
+
|
|
295
|
+
| Field | Meaning |
|
|
296
|
+
| --- | --- |
|
|
297
|
+
| `status` | `pass` unless hard breakages exist. |
|
|
298
|
+
| `summary` | Counts for fixtures, breakages, warnings, suggestions, issues, issue classes, and contract probes. |
|
|
299
|
+
| `targetOpenClaw` | Status and public compatibility data read from the optional OpenClaw checkout. |
|
|
300
|
+
| `fixtures` | Per-plugin metadata, hooks, registrations, manifest contracts, package data, and SDK imports. |
|
|
301
|
+
| `breakages` | Blocking compatibility failures. |
|
|
302
|
+
| `warnings` / `suggestions` | Non-blocking compatibility findings. |
|
|
303
|
+
| `issues` | Normalized issue rows with severity and class. |
|
|
304
|
+
| `contractProbes` | Suggested synthetic probes derived from observed contracts. |
|
|
305
|
+
| `logs` | Informational inventory and coverage rows. |
|
|
306
|
+
| `decisions` | Maintainer-facing follow-up or compatibility-policy decisions. |
|
|
307
|
+
|
|
308
|
+
Issue classes currently flow through the reports as live issues, compat gaps,
|
|
309
|
+
deprecation warnings, inspector gaps, upstream metadata, and fixture regressions.
|
|
310
|
+
|
|
311
|
+
## CI Policy And Shared Reporting Primitives
|
|
312
|
+
|
|
313
|
+
`plugin-inspector` owns the shared CI policy and report rendering primitives.
|
|
314
|
+
Fixture-suite harnesses such as Crabpot should call these exports instead of
|
|
315
|
+
reimplementing scoring, summaries, Markdown, SARIF, or JUnit handling.
|
|
316
|
+
|
|
317
|
+
The root API exposes grouped helpers:
|
|
318
|
+
|
|
319
|
+
```js
|
|
320
|
+
import { ci } from "@openclaw/plugin-inspector";
|
|
321
|
+
|
|
322
|
+
const policyReport = ci.buildPolicyReport({
|
|
323
|
+
policy,
|
|
324
|
+
compatibilityReport,
|
|
325
|
+
executionResults,
|
|
326
|
+
strict: false,
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
await ci.writePolicyReport(policyReport);
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
CI policy reports default to:
|
|
238
333
|
|
|
239
|
-
|
|
240
|
-
`
|
|
241
|
-
`reports/plugin-inspector.sarif` through CodeQL's SARIF upload action.
|
|
334
|
+
- `reports/plugin-inspector-ci-policy.json`
|
|
335
|
+
- `reports/plugin-inspector-ci-policy.md`
|
|
242
336
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
`
|
|
337
|
+
A policy must use `version: 1` and define:
|
|
338
|
+
|
|
339
|
+
- `allowedBlocked`
|
|
340
|
+
- `expectedWarnings`
|
|
341
|
+
- `thresholds`
|
|
342
|
+
- `fixtureSets`
|
|
343
|
+
|
|
344
|
+
Policy scoring fails hard breakages, unknown blocked synthetic probes, hard ref
|
|
345
|
+
diff regressions, failed execution results, strict live P0 issues, and strict
|
|
346
|
+
classified blockers. Non-strict mode keeps classified blocked probes and live P0
|
|
347
|
+
issues visible as warnings.
|
|
348
|
+
|
|
349
|
+
CI summary helpers read the known report set from `reports/` and render one
|
|
350
|
+
machine-readable and one Markdown rollup:
|
|
351
|
+
|
|
352
|
+
- compatibility
|
|
353
|
+
- runtime capture
|
|
354
|
+
- synthetic probes
|
|
355
|
+
- cold import readiness
|
|
356
|
+
- workspace plan
|
|
357
|
+
- platform probes
|
|
358
|
+
- import-loop profile
|
|
359
|
+
- execution results
|
|
360
|
+
- runtime profile
|
|
361
|
+
- ref diff
|
|
362
|
+
- profile diff
|
|
363
|
+
- CI policy
|
|
247
364
|
|
|
248
365
|
## Fixture Suites
|
|
249
366
|
|
|
250
|
-
|
|
367
|
+
Most plugin authors should use the plugin-root workflow. Use fixture suites when
|
|
368
|
+
one repository intentionally checks many plugins or packages, as Crabpot does.
|
|
251
369
|
|
|
252
370
|
```bash
|
|
253
371
|
plugin-inspector report --config crabpot.config.json --out reports
|
|
372
|
+
plugin-inspector report --config crabpot.config.json --out reports --check
|
|
373
|
+
plugin-inspector ci --config crabpot.config.json --out reports --no-openclaw
|
|
254
374
|
```
|
|
255
375
|
|
|
256
|
-
|
|
257
|
-
|
|
376
|
+
Fixture-suite configs are loaded through the explicit fixture helpers. That keeps
|
|
377
|
+
normal plugin-root configuration simple while still supporting bulk compatibility
|
|
378
|
+
harnesses.
|
|
258
379
|
|
|
259
|
-
##
|
|
380
|
+
## Public API
|
|
260
381
|
|
|
261
|
-
|
|
262
|
-
|
|
382
|
+
Prefer the CLI for normal plugin repositories. Import the public API when a test
|
|
383
|
+
harness needs to compose workflows directly:
|
|
263
384
|
|
|
264
385
|
```js
|
|
265
|
-
import { pluginRoot
|
|
386
|
+
import { pluginRoot } from "@openclaw/plugin-inspector";
|
|
266
387
|
|
|
267
|
-
const { report } = await pluginRoot.runCheck({
|
|
388
|
+
const { report, paths } = await pluginRoot.runCheck({
|
|
268
389
|
pluginRoot: process.cwd(),
|
|
269
390
|
openclawPath: false,
|
|
391
|
+
outDir: "reports",
|
|
270
392
|
});
|
|
271
|
-
|
|
272
|
-
|
|
393
|
+
|
|
394
|
+
console.log(report.status, paths.jsonPath);
|
|
273
395
|
```
|
|
274
396
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
397
|
+
Stable grouped facades:
|
|
398
|
+
|
|
399
|
+
| Facade | Use |
|
|
400
|
+
| --- | --- |
|
|
401
|
+
| `pluginRoot` | Load config, inspect, run checks, capture entrypoints, or set up a plugin repo. |
|
|
402
|
+
| `fixtureSuites` | Load fixture-suite configs, run reports, and build fixture-suite readiness plans. |
|
|
403
|
+
| `staticInspection` | Inspect source text or fixture sets without the compatibility report layer. |
|
|
404
|
+
| `reports` | Render/write reports and classify issue findings. |
|
|
405
|
+
| `contracts` | Build, render, validate, and write contract captures and coverage. |
|
|
406
|
+
| `ci` | Build summaries, policy reports, execution results, SARIF, and JUnit outputs. |
|
|
407
|
+
| `runtime` | Build runtime profiles, profile diffs, ref diffs, and import-loop profiles. |
|
|
408
|
+
| `synthetic` | Build and run synthetic probe plans. |
|
|
278
409
|
|
|
279
|
-
|
|
410
|
+
Named exports remain available for existing automation. Prefer the grouped
|
|
411
|
+
facades for new code because they show ownership and keep downstream wrappers
|
|
412
|
+
thin.
|
|
280
413
|
|
|
281
|
-
|
|
282
|
-
the only mode that imports plugin code.
|
|
414
|
+
## Development
|
|
283
415
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
416
|
+
Repository checks are intentionally small and offline:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
npm test
|
|
420
|
+
npm run release:contents
|
|
421
|
+
npm run check
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
`npm run check` runs the Node test suite and the package-contents guard. The
|
|
425
|
+
contents guard shells through `npm pack --dry-run --json` and verifies the npm
|
|
426
|
+
tarball includes package entrypoints, examples, README assets, and no private
|
|
427
|
+
`test/`, `scripts/`, or `.github/` paths.
|
|
428
|
+
|
|
429
|
+
Useful release-prep commands:
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
npm run release:local
|
|
433
|
+
npm run release:readiness
|
|
434
|
+
npm run release:notes
|
|
435
|
+
npm run release:plan
|
|
436
|
+
npm run release:crabpot -- --crabpot ../crabpot
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
`release:readiness` proves the local package and verifies Crabpot follow-through.
|
|
440
|
+
It does not publish.
|
|
441
|
+
|
|
442
|
+
Keep this package dependency-light. Do not add runtime dependencies unless they
|
|
443
|
+
remove real complexity. Default checks must stay offline and credential-free.
|
|
444
|
+
|
|
445
|
+
## Release Notes
|
|
446
|
+
|
|
447
|
+
The package publishes from annotated `v*` tags through GitHub Actions. The
|
|
448
|
+
release workflow runs the test suite, verifies the npm tarball, publishes the
|
|
449
|
+
GitHub release, and publishes the public npm package through npm trusted
|
|
450
|
+
publishing.
|
|
451
|
+
|
|
452
|
+
Before tagging a release:
|
|
453
|
+
|
|
454
|
+
1. Move `CHANGELOG.md` `Unreleased` notes into a versioned section.
|
|
455
|
+
2. Update `package.json` to the same version.
|
|
456
|
+
3. Update Crabpot's `pluginInspectorRef` to the release commit.
|
|
457
|
+
4. Run `npm run release:readiness`.
|
|
458
|
+
5. Run the Crabpot plugin-inspector smoke commands printed by
|
|
459
|
+
`npm run release:crabpot -- --crabpot ../crabpot`.
|
|
460
|
+
|
|
461
|
+
After npm publish, update Crabpot's package pin and run:
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
npm run release:crabpot -- --crabpot ../crabpot --published
|
|
465
|
+
```
|
|
289
466
|
|
|
290
|
-
|
|
291
|
-
in the plugin repo behind their own credentials and explicit opt-in flags.
|
|
467
|
+
Do not publish npm packages without explicit owner approval.
|
|
292
468
|
|
|
293
|
-
##
|
|
469
|
+
## Contribution Notes
|
|
294
470
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
`api.register*`, `define*`, SDK imports, and manifest contracts.
|
|
298
|
-
OpenClaw target checkout parsing is limited to public compatibility registries,
|
|
299
|
-
SDK package exports, manifest types, hooks, and captured registrar metadata.
|
|
471
|
+
There is no `CONTRIBUTING.md` in this repository. Until one exists, use the repo
|
|
472
|
+
scripts above as the local contract and follow these project rules:
|
|
300
473
|
|
|
301
|
-
|
|
302
|
-
|
|
474
|
+
- preserve stable report field names and finding codes;
|
|
475
|
+
- prefer public OpenClaw plugin contracts over core internals;
|
|
476
|
+
- isolate any OpenClaw source parsing behind explicit helpers;
|
|
477
|
+
- keep runtime execution behind `--allow-execute` or
|
|
478
|
+
`PLUGIN_INSPECTOR_EXECUTE_ISOLATED=1`;
|
|
479
|
+
- when behavior, entrypoints, release metadata, or the npm package version
|
|
480
|
+
change, update Crabpot's `@openclaw/plugin-inspector` pin/docs/smoke path and
|
|
481
|
+
run the Crabpot plugin-inspector smoke before calling the work done.
|
package/package.json
CHANGED
package/src/capture-api.js
CHANGED
|
@@ -82,6 +82,24 @@ export function createCaptureApi(options = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
return api;
|
|
84
84
|
},
|
|
85
|
+
onConversationBindingResolved(handler) {
|
|
86
|
+
const captureIndex =
|
|
87
|
+
captured.push({
|
|
88
|
+
kind: "hook",
|
|
89
|
+
name: "onConversationBindingResolved",
|
|
90
|
+
handlerType: typeof handler,
|
|
91
|
+
arguments: summarizeArguments([handler]),
|
|
92
|
+
}) - 1;
|
|
93
|
+
if (retainHandlers) {
|
|
94
|
+
retained.push({
|
|
95
|
+
kind: "hook",
|
|
96
|
+
name: "onConversationBindingResolved",
|
|
97
|
+
handler,
|
|
98
|
+
captureIndex,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return api;
|
|
102
|
+
},
|
|
85
103
|
},
|
|
86
104
|
{
|
|
87
105
|
get(target, property) {
|