@saluzi/saluzi-edu 0.1.15

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.
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Unified Chrome MCP setup script.
5
+ *
6
+ * Usage:
7
+ * node scripts/setup-chrome-mcp.mjs # Run full setup (fix-permissions → register → doctor)
8
+ * node scripts/setup-chrome-mcp.mjs doctor # Run a single sub-command
9
+ */
10
+
11
+ import { execFileSync } from 'node:child_process'
12
+ import { mkdirSync } from 'node:fs'
13
+ import { createRequire } from 'node:module'
14
+ import { homedir } from 'node:os'
15
+ import { join } from 'node:path'
16
+
17
+ if (process.env.SALUZI_SKIP_CHROME_MCP_SETUP === '1') {
18
+ process.exit(0)
19
+ }
20
+
21
+ const require = createRequire(import.meta.url)
22
+ const cliPath = require.resolve(
23
+ '@claude-code-best/mcp-chrome-bridge/dist/cli.js',
24
+ )
25
+
26
+ const userArgs = process.argv.slice(2)
27
+
28
+ function getChromeMcpLogDir() {
29
+ const home = homedir()
30
+ if (process.platform === 'darwin') {
31
+ return join(home, 'Library', 'Logs', 'mcp-chrome-bridge')
32
+ }
33
+ if (process.platform === 'win32') {
34
+ return join(
35
+ process.env.LOCALAPPDATA || join(home, 'AppData', 'Local'),
36
+ 'mcp-chrome-bridge',
37
+ 'logs',
38
+ )
39
+ }
40
+ return join(
41
+ process.env.XDG_STATE_HOME || join(home, '.local', 'state'),
42
+ 'mcp-chrome-bridge',
43
+ 'logs',
44
+ )
45
+ }
46
+
47
+ if (userArgs.length > 0) {
48
+ // Forward single sub-command
49
+ execFileSync('node', [cliPath, ...userArgs], { stdio: 'inherit' })
50
+ } else {
51
+ // Full setup sequence
52
+ const steps = [
53
+ ['fix-permissions'],
54
+ ['register', '--browser', 'chrome'],
55
+ ['doctor'],
56
+ ]
57
+
58
+ mkdirSync(getChromeMcpLogDir(), { recursive: true })
59
+
60
+ for (let i = 0; i < steps.length; i++) {
61
+ const args = steps[i]
62
+ const isLast = i === steps.length - 1
63
+ if (isLast) console.log(`\n[${i + 1}/${steps.length}] ${args.join(' ')}`)
64
+ execFileSync('node', [cliPath, ...args], {
65
+ stdio: isLast ? 'inherit' : 'pipe',
66
+ })
67
+ }
68
+
69
+ console.log('\nChrome MCP setup complete!')
70
+ }