-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.mjs
More file actions
36 lines (31 loc) · 1.08 KB
/
start.mjs
File metadata and controls
36 lines (31 loc) · 1.08 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
// /Users/goldlabel/GitHub/abgeschottet-ki/start.mjs
import { exec } from 'child_process';
import open from 'open'; // yarn add open
// Absolute path to your project root
const projectPath = '/Users/goldlabel/GitHub/aki';
// Helper: run a command in a new Terminal window/tab with proper cwd
function runInNewTerminal(command) {
const fullCommand = `cd ${projectPath} && ${command}`;
const script = `tell application "Terminal"
activate
do script "${fullCommand}"
end tell`;
exec(`osascript -e '${script}'`, (err, stdout, stderr) => {
if (err) {
console.error(`Error starting "${command}":`, err);
}
if (stderr) console.error(stderr);
if (stdout) console.log(stdout);
});
}
// Start each process in its own Terminal window/tab
runInNewTerminal('yarn ollama');
runInNewTerminal('yarn codellama');
runInNewTerminal('yarn frontend');
runInNewTerminal('yarn backend');
// Open browser after a delay
setTimeout(() => {
const targetUrl = 'http://localhost:1975/database/table/pdfs';
console.log(`aki-frontend open on ${targetUrl}`);
open(targetUrl);
}, 5000);