agdi 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +180 -47
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -323,22 +323,19 @@ import { input, select, password } from "@inquirer/prompts";
323
323
  import chalk from "chalk";
324
324
  async function login() {
325
325
  console.log(chalk.cyan.bold("\n\u{1F510} Agdi Authentication\n"));
326
+ console.log(chalk.gray("Configure your API key to use Agdi CLI.\n"));
326
327
  const config = loadConfig();
327
328
  const provider = await select({
328
- message: "How would you like to authenticate?",
329
+ message: "Select your AI provider:",
329
330
  choices: [
330
- { name: "\u{1F193} Agdi Cloud (FREE) - No API key needed!", value: "puter" },
331
- { name: "\u{1F511} Bring Your Own Key", value: "byok" },
331
+ { name: "\u{1F511} Google Gemini (Recommended)", value: "gemini" },
332
+ { name: "\u{1F511} OpenAI (GPT-4, GPT-5)", value: "openai" },
333
+ { name: "\u{1F511} Anthropic (Claude)", value: "anthropic" },
334
+ { name: "\u{1F511} DeepSeek", value: "deepseek" },
335
+ { name: "\u{1F511} OpenRouter (Multi-model)", value: "openrouter" },
332
336
  { name: "\u{1F3E0} Local LLM (Ollama)", value: "ollama" }
333
337
  ]
334
338
  });
335
- if (provider === "puter") {
336
- config.defaultProvider = "puter";
337
- saveConfig(config);
338
- console.log(chalk.green("\n\u2705 Using FREE Agdi Cloud (Puter.com)"));
339
- console.log(chalk.gray("No API key needed - access to 400+ models!\n"));
340
- return;
341
- }
342
339
  if (provider === "ollama") {
343
340
  const ollamaUrl = await input({
344
341
  message: "Ollama server URL:",
@@ -352,22 +349,11 @@ async function login() {
352
349
  `));
353
350
  return;
354
351
  }
355
- console.log(chalk.cyan("\n\u{1F511} Configure API Keys\n"));
356
- const keyType = await select({
357
- message: "Which provider?",
358
- choices: [
359
- { name: "Google Gemini", value: "gemini" },
360
- { name: "OpenAI (GPT-4)", value: "openai" },
361
- { name: "Anthropic (Claude)", value: "anthropic" },
362
- { name: "DeepSeek", value: "deepseek" },
363
- { name: "OpenRouter (Multi-model)", value: "openrouter" }
364
- ]
365
- });
366
352
  const apiKey = await password({
367
- message: `Enter your ${keyType} API key:`,
353
+ message: `Enter your ${provider} API key:`,
368
354
  mask: "*"
369
355
  });
370
- switch (keyType) {
356
+ switch (provider) {
371
357
  case "gemini":
372
358
  config.geminiApiKey = apiKey;
373
359
  break;
@@ -384,10 +370,10 @@ async function login() {
384
370
  config.openrouterApiKey = apiKey;
385
371
  break;
386
372
  }
387
- config.defaultProvider = keyType;
373
+ config.defaultProvider = provider;
388
374
  saveConfig(config);
389
375
  console.log(chalk.green(`
390
- \u2705 ${keyType} API key saved securely`));
376
+ \u2705 ${provider} API key saved securely`));
391
377
  console.log(chalk.gray("Keys stored in ~/.agdi/config.json\n"));
392
378
  }
393
379
  async function showStatus() {
@@ -414,29 +400,176 @@ async function showStatus() {
414
400
  import { input as input2 } from "@inquirer/prompts";
415
401
  import chalk2 from "chalk";
416
402
  import ora from "ora";
417
- var SYSTEM_PROMPT2 = `You are Agdi, an expert AI software architect.
418
- You help users build applications by generating code.
419
- When asked to create something, output complete, working code files.
420
- Be concise but thorough. Use TypeScript and modern best practices.`;
403
+ var SYSTEM_PROMPT2 = `You are Agdi, an elite full-stack software architect and senior engineer with deep expertise across the entire web development stack.
404
+
405
+ # Core Expertise
406
+ You excel at:
407
+ - Full-stack web applications (React, Next.js, Node.js, TypeScript)
408
+ - Modern frontend frameworks (React, Vue, Svelte, Angular)
409
+ - Backend development (Node.js, Express, Fastify, NestJS, Python/Django/Flask)
410
+ - Database design and optimization (PostgreSQL, MongoDB, Redis, MySQL)
411
+ - API design (REST, GraphQL, tRPC, WebSockets)
412
+ - Cloud architecture (AWS, GCP, Azure, Vercel, Railway)
413
+ - DevOps and CI/CD (Docker, Kubernetes, GitHub Actions)
414
+ - Testing strategies (Jest, Vitest, Playwright, Cypress)
415
+ - Performance optimization and scalability
416
+ - Security best practices and authentication (JWT, OAuth, NextAuth)
417
+ - Real-time applications and microservices
418
+
419
+ # Code Generation Principles
420
+
421
+ ## ALWAYS Create Artifacts for Code
422
+ When generating code, ALWAYS use artifacts with these rules:
423
+ - Use artifacts for ANY code longer than 15 lines
424
+ - Create complete, production-ready, working code - never use placeholders like "// rest of code here"
425
+ - Include all imports, types, and dependencies
426
+ - Provide full implementations, not snippets
427
+ - One artifact per logical component/file
428
+ - Use appropriate artifact types:
429
+ * "application/vnd.ant.react" for React/Next.js components
430
+ * "application/vnd.ant.code" for backend, configuration, or multi-file code
431
+ * "text/html" for standalone HTML demos
432
+
433
+ ## TypeScript First
434
+ - Default to TypeScript for all JavaScript code
435
+ - Use strict type checking
436
+ - Define proper interfaces and types
437
+ - Avoid 'any' types - use proper generics
438
+ - Leverage type inference where appropriate
439
+
440
+ ## Modern Best Practices
441
+ - Use functional components and hooks (React)
442
+ - Implement proper error handling and validation
443
+ - Follow SOLID principles and clean code practices
444
+ - Use async/await over promises chains
445
+ - Implement proper loading and error states
446
+ - Include proper TypeScript types and interfaces
447
+ - Use environment variables for configuration
448
+ - Implement proper logging and monitoring hooks
449
+ - Follow security best practices (input validation, sanitization, CORS, CSP)
450
+
451
+ ## Architecture Patterns
452
+ - Component-based architecture for frontend
453
+ - Layered architecture for backend (routes, controllers, services, repositories)
454
+ - Separation of concerns
455
+ - Dependency injection where appropriate
456
+ - Repository pattern for data access
457
+ - API versioning strategies
458
+ - Proper error handling middleware
459
+
460
+ ## Code Quality
461
+ - Write self-documenting code with clear naming
462
+ - Add JSDoc comments for complex functions
463
+ - Include error handling for edge cases
464
+ - Implement input validation
465
+ - Use constants for magic values
466
+ - Follow consistent code formatting
467
+ - Implement proper TypeScript generics
468
+
469
+ ## Performance Considerations
470
+ - Implement code splitting and lazy loading
471
+ - Use React.memo, useMemo, useCallback appropriately
472
+ - Optimize database queries (indexes, query optimization)
473
+ - Implement caching strategies (Redis, CDN)
474
+ - Use pagination for large datasets
475
+ - Optimize bundle sizes
476
+ - Implement proper loading strategies
477
+
478
+ ## Security First
479
+ - Never expose sensitive data or API keys in frontend code
480
+ - Implement proper authentication and authorization
481
+ - Validate and sanitize all inputs
482
+ - Use parameterized queries to prevent SQL injection
483
+ - Implement rate limiting
484
+ - Use HTTPS and secure headers
485
+ - Follow OWASP Top 10 guidelines
486
+ - Implement CSRF protection
487
+
488
+ ## Testing Approach
489
+ - Write testable code with proper separation
490
+ - Include unit tests for business logic
491
+ - Integration tests for API endpoints
492
+ - E2E tests for critical user flows
493
+ - Use proper mocking strategies
494
+
495
+ ## Complete Solutions
496
+ When asked to build something:
497
+ 1. Analyze requirements thoroughly
498
+ 2. Suggest optimal tech stack if not specified
499
+ 3. Provide complete file structure
500
+ 4. Generate all necessary files with full implementations
501
+ 5. Include setup instructions (package.json, env variables, database schemas)
502
+ 6. Provide deployment considerations
503
+ 7. Include basic documentation
504
+
505
+ ## Response Format
506
+ - Start with brief architecture overview when building complex apps
507
+ - Create artifacts for each file/component
508
+ - Provide clear file names and structure
509
+ - Include installation/setup instructions
510
+ - Explain key technical decisions
511
+ - Suggest improvements or considerations
512
+
513
+ ## Tech Stack Preferences (unless specified otherwise)
514
+ **Frontend:**
515
+ - React 18+ with TypeScript
516
+ - Next.js 14+ for full-stack apps (App Router)
517
+ - Tailwind CSS for styling
518
+ - shadcn/ui for component library
519
+ - React Query/TanStack Query for data fetching
520
+ - Zustand or Jotai for state management
521
+
522
+ **Backend:**
523
+ - Node.js with Express or Fastify
524
+ - TypeScript
525
+ - PostgreSQL for relational data
526
+ - Prisma or Drizzle ORM
527
+ - Redis for caching
528
+ - JWT or NextAuth for authentication
529
+
530
+ **DevOps:**
531
+ - Docker for containerization
532
+ - GitHub Actions for CI/CD
533
+ - Vercel/Railway for deployment
534
+ - Environment-based configuration
535
+
536
+ ## Communication Style
537
+ - Be direct and concise
538
+ - Focus on working solutions
539
+ - Explain complex architectural decisions
540
+ - Provide context for technology choices
541
+ - Suggest optimizations when relevant
542
+ - Warn about potential pitfalls
543
+ - Ask clarifying questions only when truly needed
544
+
545
+ ## Key Differentiators
546
+ - Generate COMPLETE, WORKING code - no placeholders
547
+ - Production-ready from the start
548
+ - Include error handling, validation, and edge cases
549
+ - Consider scalability and maintainability
550
+ - Security-first mindset
551
+ - Type-safe implementations
552
+ - Modern best practices throughout
553
+
554
+ You build software that works, scales, and follows industry best practices. Every solution is complete, tested, and ready for production deployment.`;
421
555
  async function startChat() {
422
556
  console.log(chalk2.cyan.bold("\n\u{1F4AC} Agdi Interactive Mode\n"));
423
557
  console.log(chalk2.gray('Type your coding requests. Type "exit" to quit.\n'));
424
558
  const config = loadConfig();
425
- const provider = config.defaultProvider || "puter";
559
+ let provider;
426
560
  let apiKey = "";
427
- switch (provider) {
428
- case "gemini":
429
- apiKey = config.geminiApiKey || "";
430
- break;
431
- case "puter":
432
- apiKey = "";
433
- break;
434
- default:
435
- apiKey = config.geminiApiKey || "";
436
- }
437
- if (provider !== "puter" && !apiKey) {
438
- console.log(chalk2.yellow("\u26A0\uFE0F No API key configured for " + provider));
439
- console.log(chalk2.gray('Run "agdi auth" to configure, or use FREE mode.\n'));
561
+ if (config.geminiApiKey) {
562
+ provider = "gemini";
563
+ apiKey = config.geminiApiKey;
564
+ } else if (config.defaultProvider === "puter") {
565
+ console.log(chalk2.yellow("\u26A0\uFE0F Puter.com FREE mode requires browser authentication."));
566
+ console.log(chalk2.gray("For CLI usage, please configure an API key:\n"));
567
+ console.log(chalk2.cyan(" agdi auth"));
568
+ console.log(chalk2.gray("\nSupported providers: Gemini, OpenAI, Anthropic, DeepSeek\n"));
569
+ return;
570
+ } else {
571
+ console.log(chalk2.yellow("\u26A0\uFE0F No API key configured."));
572
+ console.log(chalk2.gray('Run "agdi auth" to configure your API key.\n'));
440
573
  return;
441
574
  }
442
575
  console.log(chalk2.gray(`Using provider: ${chalk2.cyan(provider)}`));
@@ -608,12 +741,12 @@ program.command("init").description("Create a new project interactively").action
608
741
  process.exit(1);
609
742
  }
610
743
  });
611
- program.command("generate <prompt>").alias("g").description("Generate an app from a prompt").option("-p, --provider <provider>", "AI provider (puter or gemini)", "puter").option("-m, --model <model>", "AI model to use", "claude-sonnet-4").option("-o, --output <dir>", "Output directory", "./generated-app").action(async (prompt, options) => {
744
+ program.command("generate <prompt>").alias("g").description("Generate an app from a prompt").option("-p, --provider <provider>", "AI provider (gemini, openai, anthropic)", "gemini").option("-m, --model <model>", "AI model to use", "gemini-2.5-flash").option("-o, --output <dir>", "Output directory", "./generated-app").action(async (prompt, options) => {
612
745
  const config = loadConfig();
613
746
  const provider = options.provider;
614
- if (provider === "gemini" && !config.geminiApiKey) {
615
- console.error(chalk3.red("\u274C No Gemini API key configured. Run: agdi auth"));
616
- console.error(chalk3.yellow("\u{1F4A1} Tip: Use --provider puter for FREE access without API keys!"));
747
+ if (!config.geminiApiKey && provider === "gemini") {
748
+ console.error(chalk3.red("\u274C No Gemini API key configured."));
749
+ console.error(chalk3.yellow("\u{1F4A1} Run: agdi auth"));
617
750
  process.exit(1);
618
751
  }
619
752
  const spinner = ora2(`Generating app with ${chalk3.cyan(options.model)}...`).start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agdi",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "AI-powered app generator - build full-stack apps from natural language in your terminal",
5
5
  "type": "module",
6
6
  "bin": {