devtopia 1.8.1 → 1.8.2

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.
@@ -1,5 +1,6 @@
1
1
  import { readFileSync, existsSync } from 'fs';
2
2
  import { extname, resolve, dirname, join } from 'path';
3
+ import { createInterface } from 'readline';
3
4
  import { API_BASE } from '../config.js';
4
5
  import { loadIdentity, hasIdentity } from '../identity.js';
5
6
  const LANG_MAP = {
@@ -362,9 +363,54 @@ export async function submit(name, file, options) {
362
363
  console.log();
363
364
  process.exit(1);
364
365
  }
366
+ // Auto-detect if not provided
365
367
  if (!category) {
366
368
  category = detectCategory(description, source);
367
369
  }
370
+ // Prompt for category confirmation/selection if not provided via CLI
371
+ if (!options.category && process.stdin.isTTY) {
372
+ const rl = createInterface({
373
+ input: process.stdin,
374
+ output: process.stdout
375
+ });
376
+ const detectedCat = CATEGORIES.find(c => c.id === category);
377
+ console.log(`\nšŸ“ Category Selection`);
378
+ console.log(` Auto-detected: ${detectedCat?.name || category} (${category})`);
379
+ console.log(`\n Common categories:`);
380
+ // Show most common/relevant categories
381
+ const commonCategories = [
382
+ 'api', 'json', 'data', 'text', 'web', 'crypto', 'file',
383
+ 'array', 'validate', 'util', 'other'
384
+ ];
385
+ for (const catId of commonCategories) {
386
+ const cat = CATEGORIES.find(c => c.id === catId);
387
+ if (cat) {
388
+ const marker = cat.id === category ? ' ← detected' : '';
389
+ console.log(` ${cat.id.padEnd(12)} ${cat.name}${marker}`);
390
+ }
391
+ }
392
+ console.log(`\n (Use 'devtopia categories' to see all categories)`);
393
+ console.log(`\n Press Enter to use detected category, or type a category ID:`);
394
+ const answer = await new Promise((resolve) => {
395
+ rl.question(` Category [${category}]: `, (ans) => {
396
+ rl.close();
397
+ resolve(ans.trim());
398
+ });
399
+ });
400
+ if (answer) {
401
+ const selectedCat = CATEGORIES.find(c => c.id === answer.toLowerCase());
402
+ if (selectedCat) {
403
+ category = selectedCat.id;
404
+ }
405
+ else {
406
+ console.log(`\nāš ļø Invalid category "${answer}", using detected: ${category}\n`);
407
+ }
408
+ }
409
+ }
410
+ else if (!options.category) {
411
+ console.log(`\nšŸ’” Tip: Category auto-detected as "${category}"`);
412
+ console.log(` Use -c <category> to specify a different category.\n`);
413
+ }
368
414
  // Parse dependencies
369
415
  const dependencies = options.deps
370
416
  ? options.deps.split(',').map(d => d.trim()).filter(Boolean)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devtopia",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "CLI for Devtopia - AI agent tool registry",
5
5
  "type": "module",
6
6
  "bin": {