@projectservan8n/cnapse 0.2.0 → 0.2.1

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/dist/index.js CHANGED
@@ -464,18 +464,22 @@ C-napse - Autonomous PC Intelligence
464
464
 
465
465
  Usage:
466
466
  cnapse Start interactive chat
467
+ cnapse init Interactive setup wizard
467
468
  cnapse auth <provider> <key> Set API key
468
469
  cnapse config Show configuration
469
470
  cnapse config set <k> <v> Set config value
470
471
  cnapse help Show this help
471
472
 
472
473
  Providers:
473
- ollama - Local AI (default)
474
- openrouter - OpenRouter API
474
+ ollama - Local AI (default, free)
475
+ openrouter - OpenRouter API (many models)
475
476
  anthropic - Anthropic Claude
476
477
  openai - OpenAI GPT
477
478
 
478
- Examples:
479
+ Quick Start:
480
+ cnapse init # Interactive setup
481
+
482
+ Manual Setup:
479
483
  cnapse auth openrouter sk-or-xxxxx
480
484
  cnapse config set provider openrouter
481
485
  cnapse config set model qwen/qwen-2.5-coder-32b-instruct
@@ -488,6 +492,48 @@ Examples:
488
492
  console.log("cnapse v0.2.0");
489
493
  process.exit(0);
490
494
  }
495
+ case "init": {
496
+ const readline = await import("readline");
497
+ const rl = readline.createInterface({
498
+ input: process.stdin,
499
+ output: process.stdout
500
+ });
501
+ const question = (q) => new Promise((resolve) => rl.question(q, resolve));
502
+ console.log("\n\u{1F680} C-napse Setup\n");
503
+ console.log("Select a provider:");
504
+ console.log(" 1. ollama - Local AI (free, requires Ollama installed)");
505
+ console.log(" 2. openrouter - OpenRouter API (pay per use, many models)");
506
+ console.log(" 3. anthropic - Anthropic Claude (pay per use)");
507
+ console.log(" 4. openai - OpenAI GPT (pay per use)");
508
+ console.log("");
509
+ const providerChoice = await question("Enter choice (1-4) [1]: ");
510
+ const providers = ["ollama", "openrouter", "anthropic", "openai"];
511
+ const providerIndex = parseInt(providerChoice || "1") - 1;
512
+ const provider = providers[providerIndex] || "ollama";
513
+ setProvider(provider);
514
+ console.log(`\u2713 Provider set to: ${provider}`);
515
+ if (provider !== "ollama") {
516
+ const apiKey = await question(`
517
+ Enter your ${provider} API key: `);
518
+ if (apiKey) {
519
+ setApiKey(provider, apiKey);
520
+ console.log(`\u2713 API key saved`);
521
+ }
522
+ }
523
+ const defaultModels = {
524
+ ollama: "qwen2.5:0.5b",
525
+ openrouter: "qwen/qwen-2.5-coder-32b-instruct",
526
+ anthropic: "claude-3-5-sonnet-20241022",
527
+ openai: "gpt-4o"
528
+ };
529
+ const model = await question(`
530
+ Model [${defaultModels[provider]}]: `);
531
+ setModel(model || defaultModels[provider]);
532
+ console.log(`\u2713 Model set to: ${model || defaultModels[provider]}`);
533
+ rl.close();
534
+ console.log("\n\u2705 Setup complete! Run `cnapse` to start chatting.\n");
535
+ process.exit(0);
536
+ }
491
537
  default: {
492
538
  break;
493
539
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectservan8n/cnapse",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Autonomous PC intelligence - AI assistant for desktop automation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.tsx CHANGED
@@ -81,18 +81,22 @@ C-napse - Autonomous PC Intelligence
81
81
 
82
82
  Usage:
83
83
  cnapse Start interactive chat
84
+ cnapse init Interactive setup wizard
84
85
  cnapse auth <provider> <key> Set API key
85
86
  cnapse config Show configuration
86
87
  cnapse config set <k> <v> Set config value
87
88
  cnapse help Show this help
88
89
 
89
90
  Providers:
90
- ollama - Local AI (default)
91
- openrouter - OpenRouter API
91
+ ollama - Local AI (default, free)
92
+ openrouter - OpenRouter API (many models)
92
93
  anthropic - Anthropic Claude
93
94
  openai - OpenAI GPT
94
95
 
95
- Examples:
96
+ Quick Start:
97
+ cnapse init # Interactive setup
98
+
99
+ Manual Setup:
96
100
  cnapse auth openrouter sk-or-xxxxx
97
101
  cnapse config set provider openrouter
98
102
  cnapse config set model qwen/qwen-2.5-coder-32b-instruct
@@ -107,6 +111,60 @@ Examples:
107
111
  process.exit(0);
108
112
  }
109
113
 
114
+ case 'init': {
115
+ // Interactive setup
116
+ const readline = await import('readline');
117
+ const rl = readline.createInterface({
118
+ input: process.stdin,
119
+ output: process.stdout,
120
+ });
121
+
122
+ const question = (q: string): Promise<string> =>
123
+ new Promise((resolve) => rl.question(q, resolve));
124
+
125
+ console.log('\nšŸš€ C-napse Setup\n');
126
+
127
+ console.log('Select a provider:');
128
+ console.log(' 1. ollama - Local AI (free, requires Ollama installed)');
129
+ console.log(' 2. openrouter - OpenRouter API (pay per use, many models)');
130
+ console.log(' 3. anthropic - Anthropic Claude (pay per use)');
131
+ console.log(' 4. openai - OpenAI GPT (pay per use)');
132
+ console.log('');
133
+
134
+ const providerChoice = await question('Enter choice (1-4) [1]: ');
135
+ const providers = ['ollama', 'openrouter', 'anthropic', 'openai'] as const;
136
+ const providerIndex = parseInt(providerChoice || '1') - 1;
137
+ const provider = providers[providerIndex] || 'ollama';
138
+
139
+ setProvider(provider);
140
+ console.log(`āœ“ Provider set to: ${provider}`);
141
+
142
+ if (provider !== 'ollama') {
143
+ const apiKey = await question(`\nEnter your ${provider} API key: `);
144
+ if (apiKey) {
145
+ setApiKey(provider as any, apiKey);
146
+ console.log(`āœ“ API key saved`);
147
+ }
148
+ }
149
+
150
+ // Set default model based on provider
151
+ const defaultModels: Record<string, string> = {
152
+ ollama: 'qwen2.5:0.5b',
153
+ openrouter: 'qwen/qwen-2.5-coder-32b-instruct',
154
+ anthropic: 'claude-3-5-sonnet-20241022',
155
+ openai: 'gpt-4o',
156
+ };
157
+
158
+ const model = await question(`\nModel [${defaultModels[provider]}]: `);
159
+ setModel(model || defaultModels[provider]!);
160
+ console.log(`āœ“ Model set to: ${model || defaultModels[provider]}`);
161
+
162
+ rl.close();
163
+
164
+ console.log('\nāœ… Setup complete! Run `cnapse` to start chatting.\n');
165
+ process.exit(0);
166
+ }
167
+
110
168
  default: {
111
169
  // Treat as a direct question
112
170
  // For now, just start the app