Update terminal

This commit is contained in:
ngoc 2026-01-26 10:32:53 +07:00
parent 6568b87786
commit a4bc3d1707
No known key found for this signature in database
GPG Key ID: 51FE6110113A5C32
2 changed files with 37 additions and 2 deletions

View File

@ -205,6 +205,42 @@ export async function runDevCommand(cliDir: string, envPath?: string) {
process.on('SIGINT', cleanup);
process.on('SIGTERM', cleanup);
// Open a new terminal
console.log(`\n${colors.green}✅ Setup complete!${colors.reset}`);
console.log(`${colors.blue}Opening new terminal...${colors.reset}\n`);
try {
// For macOS, open a new Terminal window
if (process.platform === 'darwin') {
spawn('osascript', [
'-e',
`tell application "Terminal" to do script "cd ${process.cwd()}"`
], { detached: true, stdio: 'ignore' }).unref();
}
// For Linux, try common terminal emulators
else if (process.platform === 'linux') {
const terminals = ['gnome-terminal', 'konsole', 'xterm'];
for (const term of terminals) {
if (commandExists(term)) {
spawn(term, ['--working-directory', process.cwd()], {
detached: true,
stdio: 'ignore'
}).unref();
break;
}
}
}
// For Windows
else if (process.platform === 'win32') {
spawn('cmd', ['/c', 'start', 'cmd', '/K', `cd /d ${process.cwd()}`], {
detached: true,
stdio: 'ignore'
}).unref();
}
} catch (e) {
console.log(`${colors.yellow}⚠️ Could not open new terminal automatically${colors.reset}`);
}
// Keep process alive
await new Promise(() => {});
}

View File

@ -1,6 +1,6 @@
{
"name": "nla",
"version": "1.0.1",
"version": "1.0.0",
"description": "Natural Language Agreement Oracle - CLI for creating and managing blockchain agreements using natural language",
"type": "module",
"private": false,
@ -43,7 +43,6 @@
"patch": "npm version patch",
"minor": "npm version minor",
"major": "npm version major",
"publish": "npm publish --dry-run",
"dev": "bun run index.ts",
"start": "bun run index.ts",
"test": "bun test ./tests --exclude alkahest-ts/** ",