mage-remote-run 0.29.0 → 0.30.0
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/bin/mage-remote-run.js +5 -5
- package/lib/events.js +6 -6
- package/lib/mcp.js +6 -6
- package/package.json +1 -1
package/bin/mage-remote-run.js
CHANGED
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
import { getActiveProfile } from '../lib/config.js';
|
|
46
46
|
import { startMcpServer } from '../lib/mcp.js';
|
|
47
47
|
import { PluginLoader } from '../lib/plugin-loader.js';
|
|
48
|
-
import { eventBus,
|
|
48
|
+
import { eventBus, events } from '../lib/events.js';
|
|
49
49
|
import { createClient } from '../lib/api/factory.js';
|
|
50
50
|
|
|
51
51
|
// Connection commands are registered dynamically via registerCommands
|
|
@@ -80,19 +80,19 @@ const appContext = {
|
|
|
80
80
|
config: await loadConfig(), // Re-load or reuse config
|
|
81
81
|
profile,
|
|
82
82
|
eventBus,
|
|
83
|
-
|
|
83
|
+
events,
|
|
84
84
|
createClient
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
const pluginLoader = new PluginLoader(appContext);
|
|
88
88
|
await pluginLoader.loadPlugins();
|
|
89
89
|
|
|
90
|
-
eventBus.emit(
|
|
90
|
+
eventBus.emit(events.INIT, appContext);
|
|
91
91
|
|
|
92
92
|
registerCommands(program, profile);
|
|
93
93
|
|
|
94
94
|
program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
95
|
-
eventBus.emit(
|
|
95
|
+
eventBus.emit(events.BEFORE_COMMAND, { thisCommand, actionCommand, profile });
|
|
96
96
|
|
|
97
97
|
// Check if we have an active profile and if format is not json/xml
|
|
98
98
|
// Note: 'options' are available on the command that has them defined.
|
|
@@ -111,7 +111,7 @@ program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
program.hook('postAction', async (thisCommand, actionCommand) => {
|
|
114
|
-
eventBus.emit(
|
|
114
|
+
eventBus.emit(events.AFTER_COMMAND, { thisCommand, actionCommand, profile });
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
import { expandCommandAbbreviations } from '../lib/command-helper.js';
|
package/lib/events.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { EventEmitter } from
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
2
|
|
|
3
3
|
export class AppEventBus extends EventEmitter {}
|
|
4
4
|
|
|
5
5
|
export const eventBus = new AppEventBus();
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const events = {
|
|
8
|
+
INIT: "init",
|
|
9
|
+
BEFORE_COMMAND: "beforeCommand",
|
|
10
|
+
AFTER_COMMAND: "afterCommand",
|
|
11
|
+
MCP_START: "mcpStart",
|
|
12
12
|
};
|
package/lib/mcp.js
CHANGED
|
@@ -12,7 +12,7 @@ import { readFileSync } from "fs";
|
|
|
12
12
|
import { registerAllCommands } from './command-registry.js';
|
|
13
13
|
import { PluginLoader } from './plugin-loader.js';
|
|
14
14
|
import { loadConfig } from './config.js';
|
|
15
|
-
import { eventBus, AppEventBus,
|
|
15
|
+
import { eventBus, AppEventBus, events } from './events.js';
|
|
16
16
|
|
|
17
17
|
// Helper to strip ANSI codes for cleaner output
|
|
18
18
|
function stripAnsi(str) {
|
|
@@ -39,7 +39,7 @@ export async function startMcpServer(options) {
|
|
|
39
39
|
version: packageJson.version
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
eventBus.emit(
|
|
42
|
+
eventBus.emit(events.MCP_START, { server, options });
|
|
43
43
|
|
|
44
44
|
const toolsCount = registerTools(server, program);
|
|
45
45
|
|
|
@@ -203,22 +203,22 @@ async function setupProgramAsync() {
|
|
|
203
203
|
// registerAllCommands registers everything. Plugins might need to know if they should register.
|
|
204
204
|
// Assuming plugins register globally for now or handle checking config themselves.
|
|
205
205
|
eventBus: localEventBus,
|
|
206
|
-
|
|
206
|
+
events
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
const pluginLoader = new PluginLoader(appContext);
|
|
210
210
|
await pluginLoader.loadPlugins();
|
|
211
211
|
|
|
212
|
-
localEventBus.emit(
|
|
212
|
+
localEventBus.emit(events.INIT, appContext);
|
|
213
213
|
|
|
214
214
|
registerAllCommands(program);
|
|
215
215
|
|
|
216
216
|
program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
217
|
-
localEventBus.emit(
|
|
217
|
+
localEventBus.emit(events.BEFORE_COMMAND, { thisCommand, actionCommand, profile: null });
|
|
218
218
|
});
|
|
219
219
|
|
|
220
220
|
program.hook('postAction', async (thisCommand, actionCommand) => {
|
|
221
|
-
localEventBus.emit(
|
|
221
|
+
localEventBus.emit(events.AFTER_COMMAND, { thisCommand, actionCommand, profile: null });
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
return program;
|