tmpa-cli 1.0.4 → 1.0.6

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.
Files changed (2) hide show
  1. package/bin/index.js +48 -31
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -8,6 +8,21 @@ const { execSync } = require('child_process');
8
8
 
9
9
  const CONFIG_FILE = path.join(os.homedir(), '.tmpa_config.json');
10
10
 
11
+ // Exact RGB Gradient Colors (Cyan -> Light Blue -> Deep Blue -> Purple)
12
+ const C = {
13
+ reset: '\x1b[0m',
14
+ c1: '\x1b[38;2;0;210;255m', // Bright Cyan
15
+ c2: '\x1b[38;2;30;144;255m', // Light Blue
16
+ c3: '\x1b[38;2;99;102;241m', // Indigo Blue
17
+ c4: '\x1b[38;2;168;85;247m', // Purple
18
+ green: '\x1b[38;2;34;197;94m',
19
+ cyan: '\x1b[38;2;6x;182;212m',
20
+ yellow: '\x1b[38;2;234;179;8m',
21
+ red: '\x1b[38;2;239;68;68m',
22
+ gray: '\x1b[38;2;148;163;184m',
23
+ darkGray: '\x1b[38;2;71;85;105m'
24
+ };
25
+
11
26
  function loadConfig() {
12
27
  if (fs.existsSync(CONFIG_FILE)) {
13
28
  try {
@@ -29,18 +44,20 @@ function saveConfig(config) {
29
44
 
30
45
  function showBanner() {
31
46
  console.clear();
32
- console.log(`\x1b[36m
33
- ████████╗███╗ ███╗██████╗ █████╗
34
- ╚══██╔══╝████╗ ████║██╔══██╗██╔══██╗
35
- ██║ ██╔████╔██║██████╔╝███████║
36
- ██║ ██║╚██╔╝██║██╔═══╝ ██╔══██║
37
- ██║ ██║ ╚═╝ ██║██║ ██║ ██║
38
- ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
39
- \x1b[0m───────────────────────────────────────────────────
40
- \x1b[32mThe Multi Platform AI [Interactive Mode]\x1b[0m
41
- /config : Ubah API | /connect : Hubungkan Web
42
- /uninstall : Hapus CLI | /exit : Keluar
43
- ───────────────────────────────────────────────────\n`);
47
+
48
+ // Exact Banner matching the image structure
49
+ console.log(`
50
+ ${C.c1}████████╗███╗ ███╗██████╗ █████╗ ${C.reset}
51
+ ${C.c2}╚══██╔══╝████╗ ████║██╔══██╗██╔══██╗${C.reset}
52
+ ${C.c2} ██║ ██╔████╔██║██████╔╝███████║${C.reset}
53
+ ${C.c3} ██║ ██║╚██╔╝██║██╔═══╝ ██╔══██║${C.reset}
54
+ ${C.c4} ██║ ██║ ╚═╝ ██║██║ ██║ ██║${C.reset}
55
+ ${C.c4} ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝${C.reset}
56
+ ${C.darkGray}────────────────────────────────────────────────────────────${C.reset}
57
+ ${C.reset}The Multi Platform AI ${C.green}[Interactive Mode]${C.reset}
58
+ ${C.gray}/config : Set API | /connect : Web Integration | /uninstall : Remove | /exit : Exit${C.reset}
59
+ ${C.darkGray}────────────────────────────────────────────────────────────${C.reset}
60
+ `);
44
61
  }
45
62
 
46
63
  const rl = readline.createInterface({
@@ -51,12 +68,12 @@ const rl = readline.createInterface({
51
68
  let config = loadConfig();
52
69
 
53
70
  function askConfig(callback) {
54
- rl.question('🔑 Masukkan API Key TMPA/Gemini: ', (apiKey) => {
55
- rl.question('🌐 Masukkan Endpoint API (Tekan Enter untuk Default Gemini): ', (endpoint) => {
71
+ rl.question(`${C.yellow}[>] Enter API Key:${C.reset} `, (apiKey) => {
72
+ rl.question(`${C.yellow}[>] Enter Endpoint URL (Press Enter for Default Gemini):${C.reset} `, (endpoint) => {
56
73
  config.apiKey = apiKey.trim();
57
74
  config.endpoint = endpoint.trim() || 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent';
58
75
  saveConfig(config);
59
- console.log('✅ Konfigurasi berhasil disimpan!\n');
76
+ console.log(`${C.green}[+] Configuration saved successfully!${C.reset}\n`);
60
77
  if (callback) callback();
61
78
  });
62
79
  });
@@ -64,7 +81,7 @@ function askConfig(callback) {
64
81
 
65
82
  async function handleChat(prompt) {
66
83
  if (!config.apiKey) {
67
- console.log('⚠️ API Key belum diset!');
84
+ console.log(`${C.yellow}[!] API Key is not set.${C.reset}`);
68
85
  return askConfig(() => startPrompt());
69
86
  }
70
87
 
@@ -72,7 +89,7 @@ async function handleChat(prompt) {
72
89
  config.endpoint = 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent';
73
90
  }
74
91
 
75
- console.log('\x1b[33mTMPA CLI memproses...\x1b[0m');
92
+ console.log(`${C.yellow}TMPA CLI processing...${C.reset}`);
76
93
 
77
94
  try {
78
95
  const url = config.endpoint.includes('googleapis.com')
@@ -90,7 +107,7 @@ async function handleChat(prompt) {
90
107
  });
91
108
 
92
109
  const data = await response.json();
93
- let reply = 'Tidak ada respon dari server.';
110
+ let reply = 'No response from server.';
94
111
 
95
112
  if (data.candidates && data.candidates[0]?.content?.parts[0]?.text) {
96
113
  reply = data.candidates[0].content.parts[0].text;
@@ -100,43 +117,43 @@ async function handleChat(prompt) {
100
117
  reply = data.message;
101
118
  }
102
119
 
103
- console.log(`\n\x1b[34mTMPA CLI :\x1b[0m ${reply}\n`);
120
+ console.log(`\n${C.c1}TMPA CLI :${C.reset} ${reply}\n`);
104
121
  } catch (error) {
105
- console.log(`\n Error: ${error.message}\n`);
122
+ console.log(`\n${C.red}[x] Error: ${error.message}${C.reset}\n`);
106
123
  }
107
124
 
108
125
  startPrompt();
109
126
  }
110
127
 
111
128
  function handleUninstall() {
112
- rl.question('⚠️ Apakah Anda yakin ingin menghapus TMPA CLI? (y/N): ', (answer) => {
113
- if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'ya') {
114
- console.log('\n Menghapus TMPA CLI dan konfigurasi...');
129
+ rl.question(`${C.red}[!] Are you sure you want to uninstall TMPA CLI? (y/N):${C.reset} `, (answer) => {
130
+ if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
131
+ console.log(`\n${C.yellow}[...] Removing TMPA CLI and cleaning configuration...${C.reset}`);
115
132
  try {
116
133
  if (fs.existsSync(CONFIG_FILE)) {
117
134
  fs.unlinkSync(CONFIG_FILE);
118
135
  }
119
- console.log('✅ Konfigurasi lokal dibersihkan.');
136
+ console.log(`${C.green}[+] Local configuration cleared.${C.reset}`);
120
137
  execSync('npm uninstall -g tmpa-cli', { stdio: 'inherit' });
121
- console.log('\n👋 TMPA CLI berhasil di-uninstall. Sampai jumpa!\n');
138
+ console.log(`\n${C.green}[+] TMPA CLI uninstalled successfully. Goodbye!${C.reset}\n`);
122
139
  process.exit(0);
123
140
  } catch (err) {
124
- console.log('\n Gagal uninstall otomatis. Jalankan: npm uninstall -g tmpa-cli secara manual.\n');
141
+ console.log(`\n${C.red}[x] Failed to uninstall automatically. Run: npm uninstall -g tmpa-cli manually.${C.reset}\n`);
125
142
  process.exit(0);
126
143
  }
127
144
  } else {
128
- console.log('Batal menghapus.\n');
145
+ console.log(`${C.gray}Uninstall process cancelled.${C.reset}\n`);
129
146
  startPrompt();
130
147
  }
131
148
  });
132
149
  }
133
150
 
134
151
  function startPrompt() {
135
- rl.question('\x1b[36mTMPA >\x1b[0m ', (input) => {
152
+ rl.question(`${C.c1}TMPA >${C.reset} `, (input) => {
136
153
  const cmd = input.trim();
137
154
 
138
155
  if (cmd === '/exit') {
139
- console.log('Sampai jumpa! 👋');
156
+ console.log(`${C.gray}Goodbye!${C.reset}`);
140
157
  process.exit(0);
141
158
  } else if (cmd === '/clear') {
142
159
  showBanner();
@@ -144,7 +161,7 @@ function startPrompt() {
144
161
  } else if (cmd === '/config') {
145
162
  askConfig(() => startPrompt());
146
163
  } else if (cmd === '/connect') {
147
- console.log('\n🔗 [COMING SOON] Fitur login & integrasi website TMPA akan segera hadir pada update berikutnya!\n');
164
+ console.log(`\n${C.c4}[!] [COMING SOON] Web integration & auth login features will be available in the next release.${C.reset}\n`);
148
165
  startPrompt();
149
166
  } else if (cmd === '/uninstall') {
150
167
  handleUninstall();
@@ -156,7 +173,7 @@ function startPrompt() {
156
173
  });
157
174
  }
158
175
 
159
- // Jalankan Program
176
+ // Program Execution
160
177
  showBanner();
161
178
  if (!config.apiKey) {
162
179
  askConfig(() => startPrompt());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmpa-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "bin": {