aboutsummaryrefslogtreecommitdiff
path: root/modules/ext/console.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ext/console.js')
-rw-r--r--modules/ext/console.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/ext/console.js b/modules/ext/console.js
index f041ad0..5d3007a 100644
--- a/modules/ext/console.js
+++ b/modules/ext/console.js
@@ -8,13 +8,23 @@ class JSConsoleModule {
getHelpInfo() {
return {
'js': 'js <expression> — Evaluate JavaScript in page context',
- 'js-run': 'js-run <path> — Load and execute a JS file from VFS'
+ 'js-run': 'js-run <path> — Load and execute a JS file from VFS',
+ 'node': 'node <path> — Alias for js-run (executes a JS file from VFS)'
};
}
registerCommands() {
this.commands['js'] = (args) => this.evalJS(args);
this.commands['js-run'] = (args) => this.evalJSFile(args);
+ this.commands['node'] = (args) => {
+ // Bridge: AI hallucinates `node script.js` — map to js-run
+ if (!args[0]) return this.terminal.print('Usage: node <script.js> (alias for js-run)', 'warning');
+ // Handle `node -e "expr"` — inline eval like Node.js
+ if (args[0] === '-e') {
+ return this.evalJS(args.slice(1));
+ }
+ return this.evalJSFile(args);
+ };
}
evalJS(args) {