-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-command-palette.html
More file actions
66 lines (60 loc) · 2.57 KB
/
debug-command-palette.html
File metadata and controls
66 lines (60 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<title>Debug Command Palette</title>
</head>
<body>
<h1>Debug Command Palette</h1>
<button onclick="testRegistry()">Test Tool Registry</button>
<button onclick="testCommandGeneration()">Test Command Generation</button>
<div id="output"></div>
<script type="module">
async function testRegistry() {
try {
// Import the registry module
const { getAllTools } = await import('/lib/tools/registry.js');
const tools = getAllTools();
document.getElementById('output').innerHTML = `
<h3>Tool Registry Test:</h3>
<p>Number of tools: ${tools.length}</p>
<p>Tool IDs: ${tools.map(t => t.id).join(', ')}</p>
<pre>${JSON.stringify(tools, null, 2)}</pre>
`;
} catch (error) {
document.getElementById('output').innerHTML = `
<h3>Tool Registry Error:</h3>
<pre>${error.message}\n${error.stack}</pre>
`;
}
}
async function testCommandGeneration() {
try {
// Import both modules
const { getAllTools } = await import('/lib/tools/registry.js');
const { generateCommandsFromRegistry } = await import('/lib/tools/command-generation.js');
const tools = getAllTools();
const commands = generateCommandsFromRegistry(tools, {
getNavigateToTab: () => () => console.log('navigate'),
getCurrentDocument: () => ({ id: 'test-doc' }),
isMac: false,
});
document.getElementById('output').innerHTML = `
<h3>Command Generation Test:</h3>
<p>Number of tools: ${tools.length}</p>
<p>Number of commands generated: ${commands.length}</p>
<p>Command IDs: ${commands.map(c => c.id).join(', ')}</p>
<pre>${JSON.stringify(commands, null, 2)}</pre>
`;
} catch (error) {
document.getElementById('output').innerHTML = `
<h3>Command Generation Error:</h3>
<pre>${error.message}\n${error.stack}</pre>
`;
}
}
// Make functions global
window.testRegistry = testRegistry;
window.testCommandGeneration = testCommandGeneration;
</script>
</body>
</html>