olly-molly 0.3.66 → 0.3.67

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 (3) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +65 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -303,7 +303,7 @@ scripts/build-prebuilt-macos.sh
303
303
  ```
304
304
 
305
305
  ```bash
306
- npm version major|minor|patch
306
+ npm version major|minor|patch (or edit package.json)
307
307
  npm publish
308
308
  ```
309
309
 
package/bin/cli.js CHANGED
@@ -21,6 +21,8 @@ const CLI_OPTIONS = {
21
21
  // Data/path settings
22
22
  'data-dir': { type: 'string', short: 'd' },
23
23
  'db-path': { type: 'string' },
24
+ // API key
25
+ 'api-key': { type: 'string' },
24
26
  // Development/debugging
25
27
  dev: { type: 'boolean', default: false },
26
28
  verbose: { type: 'boolean', short: 'v', default: false },
@@ -70,6 +72,9 @@ DATA/PATH SETTINGS
70
72
  -d, --data-dir <path> App data directory (default: ~/.olly-molly)
71
73
  --db-path <path> Database path (default: <data-dir>/db)
72
74
 
75
+ API SETTINGS
76
+ --api-key <key> Anthropic API key (saved to ~/.olly-molly/.env)
77
+
73
78
  DEVELOPMENT
74
79
  --dev Run in development mode (next dev)
75
80
  -v, --verbose Enable verbose logging
@@ -90,7 +95,10 @@ ENVIRONMENT VARIABLES
90
95
  OLLY_MOLLY_DATA_DIR App data directory (fallback)
91
96
  OLLY_MOLLY_DB_PATH Database path (fallback)
92
97
 
98
+ ANTHROPIC_API_KEY Anthropic API key (required for AI agents)
99
+
93
100
  You can also create ~/.olly-molly/.env file:
101
+ ANTHROPIC_API_KEY=sk-ant-api03-xxxxx
94
102
  AWS_REGION=ap-northeast-2
95
103
  AWS_ACCESS_KEY_ID=your-key
96
104
  AWS_SECRET_ACCESS_KEY=your-secret
@@ -555,6 +563,60 @@ function restoreUserData(backupDir, config) {
555
563
  fs.rmSync(backupDir, { recursive: true, force: true });
556
564
  }
557
565
 
566
+ // Ensure ANTHROPIC_API_KEY exists: CLI arg → env → .env file → prompt user
567
+ async function ensureApiKey(config) {
568
+ // 1. --api-key flag: save to .env and set in process.env
569
+ if (args['api-key']) {
570
+ saveApiKeyToEnv(config.APP_DIR, args['api-key']);
571
+ process.env.ANTHROPIC_API_KEY = args['api-key'];
572
+ console.log('✅ API key saved to ~/.olly-molly/.env\n');
573
+ return;
574
+ }
575
+
576
+ // 2. Already available via env or .env file
577
+ if (process.env.ANTHROPIC_API_KEY) return;
578
+
579
+ // 3. Prompt user
580
+ const readline = require('readline');
581
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
582
+
583
+ console.log('🔑 Anthropic API key is required to run AI agents.');
584
+ console.log(' Get one at: https://console.anthropic.com/settings/keys\n');
585
+
586
+ const key = await new Promise((resolve) => {
587
+ rl.question('Enter your API key (sk-ant-...): ', (answer) => {
588
+ rl.close();
589
+ resolve(answer.trim());
590
+ });
591
+ });
592
+
593
+ if (!key) {
594
+ console.error('❌ No API key provided. Exiting.');
595
+ process.exit(1);
596
+ }
597
+
598
+ saveApiKeyToEnv(config.APP_DIR, key);
599
+ process.env.ANTHROPIC_API_KEY = key;
600
+ console.log('\n✅ API key saved to ~/.olly-molly/.env\n');
601
+ }
602
+
603
+ function saveApiKeyToEnv(appDir, apiKey) {
604
+ fs.mkdirSync(appDir, { recursive: true });
605
+ const envPath = path.join(appDir, '.env');
606
+
607
+ if (fs.existsSync(envPath)) {
608
+ let content = fs.readFileSync(envPath, 'utf8');
609
+ if (/^ANTHROPIC_API_KEY=.*/m.test(content)) {
610
+ content = content.replace(/^ANTHROPIC_API_KEY=.*/m, `ANTHROPIC_API_KEY=${apiKey}`);
611
+ } else {
612
+ content = `ANTHROPIC_API_KEY=${apiKey}\n${content}`;
613
+ }
614
+ fs.writeFileSync(envPath, content);
615
+ } else {
616
+ fs.writeFileSync(envPath, `ANTHROPIC_API_KEY=${apiKey}\n`);
617
+ }
618
+ }
619
+
558
620
  async function main() {
559
621
  console.log('\n🐙 Olly Molly\n');
560
622
 
@@ -582,6 +644,9 @@ async function main() {
582
644
  process.exit(0);
583
645
  }
584
646
 
647
+ // Ensure API key is configured
648
+ await ensureApiKey(config);
649
+
585
650
  // Handle dev mode
586
651
  if (config.DEV_MODE) {
587
652
  await handleDevMode(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olly-molly",
3
- "version": "0.3.66",
3
+ "version": "0.3.67",
4
4
  "description": "Your AI Development Team, Running Locally - Manage AI agents (PM, Frontend, Backend, QA) from a beautiful kanban board",
5
5
  "keywords": [
6
6
  "ai",