@dubeyvishal/orbital-cli 1.0.2 → 1.0.3
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dubeyvishal/orbital-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A fullstack CLI-based AI platform with chat mode, multi-tool agents, and agentic AI workflows. Includes GitHub login with device authorization, secure authentication, and modular client–server architecture for building intelligent automation tools.",
|
|
5
5
|
"author": "Vishal Dubey",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import yoctoSpinner from "yocto-spinner";
|
|
4
|
+
import { getStoredToken } from "../../../lib/token.js";
|
|
5
|
+
import prisma from "../../../lib/db.js";
|
|
6
|
+
import { ensureDbConnection } from "../../../lib/dbHealth.js";
|
|
7
|
+
import { select } from "@clack/prompts";
|
|
8
|
+
import {openGithub , openLinkedin , openLeetcode , openGmail , openWhatsApp} from "../../../cli/generalApp/Apps.js"
|
|
9
|
+
|
|
10
|
+
const openAppAction = async () => {
|
|
11
|
+
const token = await getStoredToken();
|
|
12
|
+
|
|
13
|
+
if (!token?.access_token) {
|
|
14
|
+
console.log(chalk.red("Not Authenticated. Please login."));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const dbOk = await ensureDbConnection();
|
|
19
|
+
if (!dbOk) return;
|
|
20
|
+
|
|
21
|
+
const spinner = yoctoSpinner({ text: "Fetching user information..." });
|
|
22
|
+
spinner.start();
|
|
23
|
+
|
|
24
|
+
let user;
|
|
25
|
+
try {
|
|
26
|
+
user = await prisma.user.findFirst({
|
|
27
|
+
where: {
|
|
28
|
+
sessions: {
|
|
29
|
+
some: {
|
|
30
|
+
token: token.access_token,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
select: {
|
|
35
|
+
id: true,
|
|
36
|
+
name: true,
|
|
37
|
+
email: true,
|
|
38
|
+
image: true,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
} finally {
|
|
42
|
+
spinner.stop();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!user) {
|
|
46
|
+
console.log(chalk.red("User not found."));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
console.log(chalk.green(`Welcome back, ${user.name}!\n`));
|
|
51
|
+
|
|
52
|
+
while (true) {
|
|
53
|
+
const choice = await select({
|
|
54
|
+
message: chalk.yellow("Select the app to open"),
|
|
55
|
+
options: [
|
|
56
|
+
{ value: "github", label: "GitHub", hint: "View repositories & projects" },
|
|
57
|
+
{ value: "whatsapp", label: "WhatsApp", hint: "Open messaging app" },
|
|
58
|
+
{ value: "gmail", label: "Gmail", hint: "Check emails quickly" },
|
|
59
|
+
{ value: "linkedin", label: "LinkedIn", hint: "View connections & jobs" },
|
|
60
|
+
{ value: "leetcode", label: "LeetCode", hint: "Practice coding problems" },
|
|
61
|
+
{ value: "exit", label: "Exit", hint: "Close launcher" },
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (choice === "exit") {
|
|
66
|
+
console.log(" Exiting launcher...");
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
switch (choice) {
|
|
71
|
+
case "github":
|
|
72
|
+
openGithub();
|
|
73
|
+
break;
|
|
74
|
+
case "gmail":
|
|
75
|
+
openGmail();
|
|
76
|
+
break;
|
|
77
|
+
case "leetcode":
|
|
78
|
+
openLeetcode();
|
|
79
|
+
break;
|
|
80
|
+
case "linkedin":
|
|
81
|
+
openLinkedin();
|
|
82
|
+
break;
|
|
83
|
+
case "whatsapp":
|
|
84
|
+
openWhatsApp();
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const launch = new Command("launch")
|
|
91
|
+
.description("Open external apps like GitHub, WhatsApp, etc.")
|
|
92
|
+
.alias("open")
|
|
93
|
+
.action(openAppAction);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { exec } from "child_process";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
|
|
5
|
+
const playAction = (songParts) => {
|
|
6
|
+
const song = songParts.join(" ");
|
|
7
|
+
const encoded = encodeURIComponent(song);
|
|
8
|
+
|
|
9
|
+
console.log(chalk.green(`Searching "${song}" on Spotify ...`));
|
|
10
|
+
|
|
11
|
+
exec(`start /min "" spotify:search:${encoded}`);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const play = new Command("play")
|
|
15
|
+
.description("Search and open Spotify minimized")
|
|
16
|
+
.argument("<song...>", "Song name to search")
|
|
17
|
+
.action(playAction);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { exec } from "child_process";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
|
|
5
|
+
const searchYoutubeAction = (query) => {
|
|
6
|
+
if (!query) {
|
|
7
|
+
console.log(chalk.red("Please provide a search query."));
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const encodedQuery = encodeURIComponent(query); //removes the special characters so that url does not break
|
|
12
|
+
const url = `https://www.youtube.com/results?search_query=${encodedQuery}`;
|
|
13
|
+
|
|
14
|
+
console.log(chalk.green(`Searching YouTube for: "${query}"`));
|
|
15
|
+
exec(`start "" "${url}"`);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const search = new Command("search")
|
|
19
|
+
.description("Search videos on YouTube")
|
|
20
|
+
.argument("<query>", "Search term")
|
|
21
|
+
.action(searchYoutubeAction);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { exec } from "child_process";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
|
|
4
|
+
const openApp = (url, name) => {
|
|
5
|
+
console.log(chalk.green(`Opening ${name}...`));
|
|
6
|
+
exec(`start "" "${url}"`);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const openGithub = () => openApp("https://github.com", "GitHub");
|
|
10
|
+
export const openGmail = () => openApp("https://gmail.com", "Gmail");
|
|
11
|
+
export const openLeetcode = () => openApp("https://leetcode.com", "LeetCode");
|
|
12
|
+
export const openLinkedin = () => openApp("https://linkedin.com", "LinkedIn");
|
|
13
|
+
|
|
14
|
+
export const openWhatsApp = () => {
|
|
15
|
+
exec("start whatsapp:", (err) => {
|
|
16
|
+
if (err) {
|
|
17
|
+
exec('start "" "https://web.whatsapp.com"');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
package/server/src/cli/main.js
CHANGED
|
@@ -9,6 +9,9 @@ import {logout} from "./commands/auth/logout.js"
|
|
|
9
9
|
import {whoAmI} from "./commands/auth/aboutMe.js"
|
|
10
10
|
import {wakeUp} from "./commands/ai/wakeUp.js"
|
|
11
11
|
import {setkey} from "./commands/config/setkey.js"
|
|
12
|
+
import {launch} from "./commands/General/openApp.js"
|
|
13
|
+
import {search} from "./commands/General/searchYoutube.js"
|
|
14
|
+
import {play} from "./commands/General/playSong.js"
|
|
12
15
|
|
|
13
16
|
const main = async()=>{
|
|
14
17
|
|
|
@@ -23,6 +26,8 @@ const main = async()=>{
|
|
|
23
26
|
console.log(chalk.yellow(" A CLI Based AI Tool \n"));
|
|
24
27
|
|
|
25
28
|
const program = new Command("orbital");
|
|
29
|
+
|
|
30
|
+
|
|
26
31
|
|
|
27
32
|
program.version("0.0.1").
|
|
28
33
|
description("Orbital CLI - A CLI Based AI Tool").
|
|
@@ -30,7 +35,10 @@ const main = async()=>{
|
|
|
30
35
|
addCommand(logout).
|
|
31
36
|
addCommand(whoAmI).
|
|
32
37
|
addCommand(wakeUp).
|
|
33
|
-
addCommand(setkey)
|
|
38
|
+
addCommand(setkey).
|
|
39
|
+
addCommand(launch).
|
|
40
|
+
addCommand(search).
|
|
41
|
+
addCommand(play)
|
|
34
42
|
|
|
35
43
|
program.action(()=>{
|
|
36
44
|
program.help();
|