tmpa-cli 1.0.13 → 1.0.14

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 +57 -36
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -79,7 +79,7 @@ ${C.c3} ██║ ██║╚██╔╝██║██╔═══╝ █
79
79
  ${C.c4} ██║ ██║ ╚═╝ ██║██║ ██║ ██║${C.reset}
80
80
  ${C.c4} ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝${C.reset}
81
81
  ${C.darkGray}────────────────────────────────────────────────────────────${C.reset}
82
- ${C.reset}The Multi Platform AI ${C.green}[Interactive Mode + Tool Runner]${C.reset}
82
+ ${C.reset}The Multi Platform AI ${C.green}[Interactive Mode + Multi-Location Scanner]${C.reset}
83
83
  ${C.gray}/config | /models | /skill | /mcp | /connect | /scan | /exit${C.reset}
84
84
  ${C.darkGray}────────────────────────────────────────────────────────────${C.reset}
85
85
  `);
@@ -89,7 +89,6 @@ ${C.darkGray}──────────────────────
89
89
  function getActiveToolsContext() {
90
90
  let contextParts = [];
91
91
 
92
- // Skills Context
93
92
  const activeSkills = Object.keys(registry.skills || {});
94
93
  if (activeSkills.length > 0) {
95
94
  contextParts.push("AVAILABLE SKILLS:");
@@ -99,7 +98,6 @@ function getActiveToolsContext() {
99
98
  });
100
99
  }
101
100
 
102
- // MCP Context
103
101
  const activeMCP = Object.keys(registry.mcp || {});
104
102
  if (activeMCP.length > 0) {
105
103
  contextParts.push("AVAILABLE MCP SERVERS:");
@@ -120,7 +118,7 @@ function listSkills() {
120
118
  console.log(`\n${C.cyan}=== Registered Skills ===${C.reset}`);
121
119
  const keys = Object.keys(registry.skills || {});
122
120
  if (keys.length === 0) {
123
- console.log(`${C.gray}Belum ada skill yang terhubung. Gunakan ${C.yellow}/connect skill <path>${C.gray} untuk menghubungkan.${C.reset}\n`);
121
+ console.log(`${C.gray}Belum ada skill yang terhubung. Gunakan ${C.yellow}/connect skill <path>${C.gray} atau ${C.yellow}/scan${C.gray} untuk memindai.${C.reset}\n`);
124
122
  return;
125
123
  }
126
124
  keys.forEach((name, i) => {
@@ -134,7 +132,7 @@ function listMCP() {
134
132
  console.log(`\n${C.cyan}=== Registered MCP (Model Context Protocol) Servers ===${C.reset}`);
135
133
  const keys = Object.keys(registry.mcp || {});
136
134
  if (keys.length === 0) {
137
- console.log(`${C.gray}Belum ada MCP server terhubung. Gunakan ${C.yellow}/connect mcp <target>${C.gray} untuk menghubungkan.${C.reset}\n`);
135
+ console.log(`${C.gray}Belum ada MCP server terhubung. Gunakan ${C.yellow}/connect mcp <target>${C.gray} atau ${C.yellow}/scan${C.gray} untuk memindai.${C.reset}\n`);
138
136
  return;
139
137
  }
140
138
  keys.forEach((name, i) => {
@@ -184,36 +182,65 @@ function connectResource(inputArgs) {
184
182
  }
185
183
  }
186
184
 
185
+ // Deep Multi-Location Scanner Function
187
186
  function scanResources() {
188
- console.log(`${C.yellow}[...] Memindai folder ~/.tmpa/skills dan ~/.tmpa/mcp...${C.reset}`);
187
+ console.log(`${C.yellow}[...] Memindai folder internal & lokasi umum pengguna (Gemini/Claude/System)...${C.reset}`);
189
188
  registry = loadRegistry();
190
-
191
- if (fs.existsSync(SKILLS_DIR)) {
192
- const files = fs.readdirSync(SKILLS_DIR);
193
- files.forEach(file => {
194
- const fullPath = path.join(SKILLS_DIR, file);
195
- const name = path.basename(file, path.extname(file));
196
- if (!registry.skills[name]) {
197
- registry.skills[name] = { path: fullPath, connectedAt: new Date().toISOString(), status: 'Active' };
198
- console.log(`${C.green}[+] Auto-detected skill: ${name}${C.reset}`);
199
- }
200
- });
201
- }
202
-
203
- if (fs.existsSync(MCP_DIR)) {
204
- const files = fs.readdirSync(MCP_DIR);
205
- files.forEach(file => {
206
- const fullPath = path.join(MCP_DIR, file);
207
- const name = path.basename(file, path.extname(file));
208
- if (!registry.mcp[name]) {
209
- registry.mcp[name] = { target: fullPath, type: 'local', connectedAt: new Date().toISOString(), status: 'Connected' };
210
- console.log(`${C.green}[+] Auto-detected MCP: ${name}${C.reset}`);
189
+ registry.skills = registry.skills || {};
190
+ registry.mcp = registry.mcp || {};
191
+
192
+ const home = os.homedir();
193
+ const searchTargets = [
194
+ // Folder Internal TMPA
195
+ { type: 'skill', dir: SKILLS_DIR },
196
+ { type: 'mcp', dir: MCP_DIR },
197
+
198
+ // Folder Umum Pengguna (Direct Home Directory)
199
+ { type: 'skill', dir: path.join(home, 'skills') },
200
+ { type: 'mcp', dir: path.join(home, 'mcp') },
201
+ { type: 'mcp', dir: path.join(home, '.mcp') },
202
+
203
+ // Folder Konfigurasi Gemini CLI & Claude Desktop
204
+ { type: 'skill', dir: path.join(home, '.gemini', 'skills') },
205
+ { type: 'mcp', dir: path.join(home, '.gemini', 'mcp') },
206
+ { type: 'skill', dir: path.join(home, '.config', 'gemini', 'skills') },
207
+ { type: 'mcp', dir: path.join(home, '.config', 'gemini', 'mcp') },
208
+ { type: 'mcp', dir: path.join(home, '.claude', 'mcp') },
209
+ { type: 'mcp', dir: path.join(home, '.config', 'claude', 'mcp') }
210
+ ];
211
+
212
+ let addedCount = 0;
213
+
214
+ searchTargets.forEach(({ type, dir }) => {
215
+ if (fs.existsSync(dir)) {
216
+ try {
217
+ const items = fs.readdirSync(dir);
218
+ items.forEach(item => {
219
+ const fullPath = path.join(dir, item);
220
+ const name = path.basename(item, path.extname(item));
221
+
222
+ if (type === 'skill') {
223
+ if (!registry.skills[name]) {
224
+ registry.skills[name] = { path: fullPath, connectedAt: new Date().toISOString(), status: 'Active' };
225
+ console.log(`${C.green}[+] Terdeteksi Skill: ${name}${C.reset} ${C.gray}(${fullPath})${C.reset}`);
226
+ addedCount++;
227
+ }
228
+ } else if (type === 'mcp') {
229
+ if (!registry.mcp[name]) {
230
+ registry.mcp[name] = { target: fullPath, type: 'local', connectedAt: new Date().toISOString(), status: 'Connected' };
231
+ console.log(`${C.green}[+] Terdeteksi MCP: ${name}${C.reset} ${C.gray}(${fullPath})${C.reset}`);
232
+ addedCount++;
233
+ }
234
+ }
235
+ });
236
+ } catch (e) {
237
+ // Skip folder jika permission terikat
211
238
  }
212
- });
213
- }
239
+ }
240
+ });
214
241
 
215
242
  saveRegistry(registry);
216
- console.log(`${C.green}[+] Pemindaian selesai.${C.reset}\n`);
243
+ console.log(`${C.green}[+] Pemindaian selesai. Total item baru terdeteksi: ${addedCount}${C.reset}\n`);
217
244
  }
218
245
 
219
246
  function askConfig(callback) {
@@ -382,7 +409,6 @@ async function handleChat(prompt) {
382
409
  let headers = { 'Content-Type': 'application/json' };
383
410
  let bodyData = {};
384
411
 
385
- // Combine User Prompt + Active Tools Context
386
412
  const toolsContext = getActiveToolsContext();
387
413
  const fullPrompt = prompt + toolsContext;
388
414
 
@@ -423,11 +449,6 @@ async function handleChat(prompt) {
423
449
 
424
450
  console.log(`\n${C.c1}TMPA CLI (${config.model || 'AI'}) :${C.reset} ${aiResponse}\n`);
425
451
 
426
- // Check if AI requested execution of a local tool/skill
427
- if (aiResponse.includes('[EXEC_TOOL:')) {
428
- console.log(`${C.cyan}[+] Detected Tool Execution Request from AI...${C.reset}`);
429
- }
430
-
431
452
  } catch (error) {
432
453
  console.log(`\n${C.red}[x] Fetch Error: ${error.message}${C.reset}\n`);
433
454
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmpa-cli",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "bin": {