-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathchatbots.js
More file actions
22 lines (18 loc) · 762 Bytes
/
Copy pathchatbots.js
File metadata and controls
22 lines (18 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env node
// Opens KudoAI chatbots in VS Code
'use strict'
;(() => {
const chatbots = ['amazongpt', 'bravegpt', 'duckduckgpt', 'googlegpt'],
{ dirname, resolve } = require('path'),
fs = require('fs'),
spawn = require('cross-spawn')
const repoRoot = (dir => {
while (dir != '/' && !fs.existsSync(resolve(dir, 'package.json'))) dir = dirname(dir)
return dir
})(__dirname)
const filePaths = chatbots
.map(chatbot => resolve(repoRoot, `chatgpt/${chatbot}/${chatbot}.user.js`))
.filter(path => fs.existsSync(path))
spawn('code', ['-r', repoRoot, ...filePaths], { stdio: 'inherit' })
.on('error', err => console.error(`Failed to open VS Code: ${err.message}`))
})()