mirror of
https://github.com/laaielichter/Reverseport.git
synced 2026-11-07 10:16:04 -10:00
feat(plugin): settings instead of environment variables, and an icon (#63)
This commit is contained in:
1 parent
1653becc6f
commit
afb4ccdb9f
8 files changed
+92
-24
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -27,7 +27,37 @@
|
||||
"command": "node",
|
||||
"args": [
|
||||
"${CLAUDE_PLUGIN_ROOT}/port/plugin/mcp-launch.mjs"
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"REVERSEPORT_PLUGIN_ENGINE": "${user_config.engine}",
|
||||
"REVERSEPORT_PROFILE": "${user_config.tool_profile}",
|
||||
"REVERSEPORT_HOME": "${user_config.workspace}",
|
||||
"GHIDRA_INSTALL_DIR": "${user_config.ghidra_install_dir}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"userConfig": {
|
||||
"engine": {
|
||||
"type": "boolean",
|
||||
"title": "Deep-analysis engine",
|
||||
"description": "Run the published engine through npx (downloaded once) so decompilation, Android, .NET, Electron and browser tools work in the plugin. Off: ReversePort's own tools only.",
|
||||
"default": false
|
||||
},
|
||||
"tool_profile": {
|
||||
"type": "string",
|
||||
"title": "Tool list size",
|
||||
"description": "compact (small models or contexts), standard, or full (every engine tool listed). Agents can also switch with set_tool_profile.",
|
||||
"default": "standard"
|
||||
},
|
||||
"workspace": {
|
||||
"type": "directory",
|
||||
"title": "Workspace folder",
|
||||
"description": "Where ReversePort keeps extracted packs, port plans, reports and saved big results. Empty: ~/.reverseport."
|
||||
},
|
||||
"ghidra_install_dir": {
|
||||
"type": "directory",
|
||||
"title": "Ghidra installation (optional)",
|
||||
"description": "Your own Ghidra folder for native decompilation. Empty: none or found by setup."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,10 @@ instead of `npx`. Setup and `connect` both register the server under the name `r
|
||||
twice. In Claude Code, use either `setup` or the plugin, not both: the plugin brings its own copy of the server.
|
||||
|
||||
The Claude Code plugin installed from GitHub has no built deep-analysis engine; it starts with ReversePort's own
|
||||
tools. Set `REVERSEPORT_ENGINE_FETCH=npx` to have it run the published engine through `npx` (downloaded once).
|
||||
tools. Turn on the plugin's **Deep-analysis engine** setting (`/plugin` → reverseport → configure) to have it run
|
||||
the published engine through `npx` (downloaded once); `REVERSEPORT_ENGINE_FETCH=npx` does the same. The plugin's
|
||||
other settings choose the tool list size, the workspace folder and your Ghidra folder, so nobody edits
|
||||
`settings.json` by hand.
|
||||
|
||||
## Function calling over HTTP
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@ die bij je agent past; ze komen allemaal uit bij dezelfde tools.
|
||||
twee keer. Gebruik in Claude Code `setup` of de plugin, niet beide: de plugin bevat zijn eigen kopie van de server.
|
||||
|
||||
The Claude Code plugin installed from GitHub has no built deep-analysis engine; it starts with ReversePort's own
|
||||
tools. Stel `REVERSEPORT_ENGINE_FETCH=npx` in om de gepubliceerde engine via `npx` uit te voeren (eenmalig gedownload).
|
||||
tools. Zet de plugin-instelling **Deep-analysis engine** aan (`/plugin` → reverseport → configure) om de
|
||||
gepubliceerde engine via `npx` uit te voeren (eenmalig gedownload); `REVERSEPORT_ENGINE_FETCH=npx` doet hetzelfde. Met
|
||||
de andere instellingen kies je de lengte van de tool-lijst, de werkmap en je Ghidra-map, zonder `settings.json` met de
|
||||
hand aan te passen.
|
||||
|
||||
## Functieaanroepen via HTTP
|
||||
|
||||
|
||||
@@ -3,10 +3,22 @@
|
||||
// folder. Set REVERSEPORT_HOME to put it elsewhere (e.g. a roomier drive).
|
||||
import { isMainModule } from '../src/main-module.mjs';
|
||||
|
||||
/** Plugin settings (userConfig) arrive as env values; an empty or unsubstituted one means "not set". */
|
||||
export function applyPluginSettings(env = process.env) {
|
||||
for (const key of ['REVERSEPORT_PLUGIN_ENGINE', 'REVERSEPORT_PROFILE', 'REVERSEPORT_HOME', 'GHIDRA_INSTALL_DIR']) {
|
||||
const value = env[key];
|
||||
if (value !== undefined && (value.trim() === '' || /^\$\{user_config\.[A-Za-z0-9_]+\}$/.test(value.trim()))) delete env[key];
|
||||
}
|
||||
if (['true', '1', 'yes', 'on'].includes(String(env.REVERSEPORT_PLUGIN_ENGINE ?? '').toLowerCase())) env.REVERSEPORT_ENGINE_FETCH ??= 'npx';
|
||||
delete env.REVERSEPORT_PLUGIN_ENGINE;
|
||||
return env;
|
||||
}
|
||||
|
||||
export async function main() {
|
||||
// A plugin installed from git has no built engine. REVERSEPORT_ENGINE_FETCH=npx lets it run the published engine
|
||||
// through npx instead (downloads the package once); without it the server starts with ReversePort's own tools and
|
||||
// says how to add the engine.
|
||||
applyPluginSettings();
|
||||
// A plugin installed from git has no built engine. The engine setting (or REVERSEPORT_ENGINE_FETCH=npx) lets it run
|
||||
// the published engine through npx instead (downloads the package once); without it the server starts with
|
||||
// ReversePort's own tools and says how to add the engine.
|
||||
if (process.env.REVERSEPORT_ENGINE_FETCH === 'npx' && !process.env.REVERSEPORT_ENGINE_COMMAND) {
|
||||
const { engineCommand } = await import('../src/relay.mjs');
|
||||
const { VERSION } = await import('../src/tools.mjs');
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ META_TOOLS.push({ name: 'run_batch', title: 'Run several tools in one call',
|
||||
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false } });
|
||||
|
||||
const ENGINE_MISSING = 'The deep-analysis engine is not built in this copy of ReversePort, so decompilation and the other engine tools are not available yet. ReversePort\'s own tools work now — continue with them. To add the engine, ask the user first, then: `npx -y reverseport@latest setup`, or in this checkout `npm ci && npm run build`; the agent client then needs a restart.';
|
||||
const ENGINE_MISSING_PLUGIN = 'The deep-analysis engine is not included in the Claude Code plugin, so decompilation and the other engine tools are not available yet. ReversePort\'s own tools work now — continue with them. To add the engine, ask the user to start Claude Code with REVERSEPORT_ENGINE_FETCH=npx set (it downloads the published engine once). Do not also run setup.';
|
||||
const ENGINE_MISSING_PLUGIN = 'The deep-analysis engine is not included in the Claude Code plugin, so decompilation and the other engine tools are not available yet. ReversePort\'s own tools work now — continue with them. To add the engine, ask the user to turn on the plugin\'s "Deep-analysis engine" setting (/plugin → reverseport → configure; it downloads the published engine once through npx), or to start Claude Code with REVERSEPORT_ENGINE_FETCH=npx. Do not also run setup.';
|
||||
const ENGINE_OFF = 'The deep-analysis engine is turned off (REVERSEPORT_ENGINE=off). Unset it and reconnect to use the engine tools.';
|
||||
|
||||
/** The command that starts the engine's MCP server: { command } or { off | missing | error }. */
|
||||
|
||||
@@ -33,6 +33,26 @@ test('Claude Code plugin and marketplace manifests', async () => {
|
||||
['agentdisk', { source: 'github', repo: 'laaielichter/agentdisk' }],
|
||||
]);
|
||||
for (const p of market.plugins) assert.ok(p.description?.length >= 40, `${p.name}: description`);
|
||||
// Settings the user fills in once, instead of editing settings.json by hand; every one reaches the server.
|
||||
for (const [key, option] of Object.entries(m.userConfig)) {
|
||||
assert.match(key, /^[a-z_]+$/);
|
||||
assert.ok(['string', 'number', 'boolean', 'directory', 'file'].includes(option.type), `${key}: type`);
|
||||
assert.ok(option.title && option.description, `${key}: title and description`);
|
||||
assert.ok(Object.values(m.mcpServers.reverseport.env).includes(`\${user_config.${key}}`), `${key}: passed to the server`);
|
||||
}
|
||||
});
|
||||
|
||||
test('plugin settings: empty or unsubstituted values are unset; the engine setting fetches the engine', async () => {
|
||||
const { applyPluginSettings } = await import('../plugin/mcp-launch.mjs');
|
||||
const env = applyPluginSettings({ REVERSEPORT_PLUGIN_ENGINE: 'true', REVERSEPORT_PROFILE: 'compact', REVERSEPORT_HOME: '', GHIDRA_INSTALL_DIR: '${user_config.ghidra_install_dir}' });
|
||||
assert.equal(env.REVERSEPORT_ENGINE_FETCH, 'npx');
|
||||
assert.equal(env.REVERSEPORT_PROFILE, 'compact');
|
||||
assert.equal('REVERSEPORT_HOME' in env, false);
|
||||
assert.equal('GHIDRA_INSTALL_DIR' in env, false);
|
||||
assert.equal('REVERSEPORT_PLUGIN_ENGINE' in env, false);
|
||||
const off = applyPluginSettings({ REVERSEPORT_PLUGIN_ENGINE: 'false' });
|
||||
assert.equal(off.REVERSEPORT_ENGINE_FETCH, undefined);
|
||||
assert.equal(applyPluginSettings({ REVERSEPORT_PLUGIN_ENGINE: 'true', REVERSEPORT_ENGINE_FETCH: 'off' }).REVERSEPORT_ENGINE_FETCH, 'off', 'an explicit environment choice wins');
|
||||
});
|
||||
|
||||
test('skills and agent: frontmatter, and only real tool names', async () => {
|
||||
|
||||
@@ -5,23 +5,23 @@ description: Fix ReversePort errors and odd results — unreadable scenes, packs
|
||||
|
||||
# Troubleshooting ReversePort
|
||||
|
||||
| Error / symptom | Cause | Fix |
|
||||
| -------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||
| `NOT_FOUND`, `NOT_A_FILE`, `NOT_A_FOLDER` | Wrong path or kind | Absolute paths are safest; `re_scan` wants a folder, `re_binary`/`re_archive`/`re_probe` a file. |
|
||||
| `BAD_FORMAT` on a Unity scene | Binary serialization | Unity: Project Settings → Editor → Asset Serialization = Force Text, then save. |
|
||||
| `UNSUPPORTED_SCENE` on .scn/.res | Godot binary resource | Open in Godot, Save As .tscn/.tres. |
|
||||
| `NOT_A_PCK` | No GDPC header, trailer or `pck` section | The pack may be next to the executable (`*.pck`), or the build is not Godot (`re_scan` the folder). |
|
||||
| `encryptedDirectory: true` | Encrypted Godot export | Not supported by design. Use the project source. |
|
||||
| `UNSUPPORTED_ARCHIVE` (Unity bundle, Unreal pak) | Identified only | Port from the project source instead. |
|
||||
| Graph misses an edge | Dynamic loads (`load(path_var)`, reflection, string-built paths) | Read the code; add the dependency to your notes. Type references need class names of 3+ characters. |
|
||||
| `OUTPUT_NOT_EMPTY` | The output folder has files ReversePort did not create | Choose a new folder; ReversePort never overwrites foreign files. |
|
||||
| `UNSAFE_PATH` | A path tried to leave the output/extraction folder | Use paths relative to the output project, without `..`. |
|
||||
| `INVALID_ARGUMENT … Unknown argument` | Typo in an argument name | The message lists the allowed names. |
|
||||
| Large results truncated | Limits keep answers readable | Use `match`, `limit`, `offset`, or point at a subfolder. |
|
||||
| MCP server not visible | Client not restarted / Node < 22.19 / not registered | `reverseport doctor`, `reverseport setup`, then restart the agent app. |
|
||||
| Only `re_*`/`port_*` tools are listed | The deep-analysis engine is not built | From npm: `npx -y reverseport@latest setup`. Git checkout: `npm ci && npm run build`, then restart the agent. |
|
||||
| Only ReversePort tools listed (Claude Code plugin) | The plugin does not include the engine | Ask the user to start Claude Code with `REVERSEPORT_ENGINE_FETCH=npx`; do not also run setup. |
|
||||
| Decompile/xref tools report a missing provider | Ghidra, Hopper or IDA not configured | `reverseport doctor`, then follow docs/installation.md (provider setup). |
|
||||
| Error / symptom | Cause | Fix |
|
||||
| -------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `NOT_FOUND`, `NOT_A_FILE`, `NOT_A_FOLDER` | Wrong path or kind | Absolute paths are safest; `re_scan` wants a folder, `re_binary`/`re_archive`/`re_probe` a file. |
|
||||
| `BAD_FORMAT` on a Unity scene | Binary serialization | Unity: Project Settings → Editor → Asset Serialization = Force Text, then save. |
|
||||
| `UNSUPPORTED_SCENE` on .scn/.res | Godot binary resource | Open in Godot, Save As .tscn/.tres. |
|
||||
| `NOT_A_PCK` | No GDPC header, trailer or `pck` section | The pack may be next to the executable (`*.pck`), or the build is not Godot (`re_scan` the folder). |
|
||||
| `encryptedDirectory: true` | Encrypted Godot export | Not supported by design. Use the project source. |
|
||||
| `UNSUPPORTED_ARCHIVE` (Unity bundle, Unreal pak) | Identified only | Port from the project source instead. |
|
||||
| Graph misses an edge | Dynamic loads (`load(path_var)`, reflection, string-built paths) | Read the code; add the dependency to your notes. Type references need class names of 3+ characters. |
|
||||
| `OUTPUT_NOT_EMPTY` | The output folder has files ReversePort did not create | Choose a new folder; ReversePort never overwrites foreign files. |
|
||||
| `UNSAFE_PATH` | A path tried to leave the output/extraction folder | Use paths relative to the output project, without `..`. |
|
||||
| `INVALID_ARGUMENT … Unknown argument` | Typo in an argument name | The message lists the allowed names. |
|
||||
| Large results truncated | Limits keep answers readable | Use `match`, `limit`, `offset`, or point at a subfolder. |
|
||||
| MCP server not visible | Client not restarted / Node < 22.19 / not registered | `reverseport doctor`, `reverseport setup`, then restart the agent app. |
|
||||
| Only `re_*`/`port_*` tools are listed | The deep-analysis engine is not built | From npm: `npx -y reverseport@latest setup`. Git checkout: `npm ci && npm run build`, then restart the agent. |
|
||||
| Only ReversePort tools listed (Claude Code plugin) | The plugin does not include the engine | Ask the user to turn on the plugin's Deep-analysis engine setting (`/plugin` → reverseport → configure); do not also run setup. |
|
||||
| Decompile/xref tools report a missing provider | Ghidra, Hopper or IDA not configured | `reverseport doctor`, then follow docs/installation.md (provider setup). |
|
||||
|
||||
Workspace: `~/.reverseport` (plans in `ports/`, extracted files in `extracted/`, reports in `reports/`); set
|
||||
`REVERSEPORT_HOME` to move it.
|
||||
Reference in new issue
Block a user