experiments in a post-browser web
1/**
2 * Debug command - opens a URL in a new window with DevTools enabled
3 */
4import windows from 'peek://app/windows.js';
5
6export default {
7 name: 'debug',
8 description: 'Open URL with DevTools',
9 execute: async (msg) => {
10 console.log('debug command', msg);
11
12 const parts = msg.typed.split(' ');
13 parts.shift();
14
15 const address = parts.shift();
16
17 if (!address) {
18 return;
19 }
20
21 // Use the new windows API with DevTools enabled (tracking handled automatically)
22 try {
23 const windowController = await windows.createWindow(address, {
24 width: 900,
25 height: 700,
26 openDevTools: true,
27 detachedDevTools: true,
28 trackingSource: 'cmd',
29 trackingSourceId: 'debug'
30 });
31 console.log('Debug window opened with ID:', windowController.id);
32 } catch (error) {
33 console.error('Failed to open debug window:', error);
34 }
35
36 return {
37 command: 'debug',
38 address
39 };
40 }
41};