olly-molly 0.1.2 → 0.1.4

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/cli.js +131 -85
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -4,102 +4,148 @@ const { spawn, execSync } = require('child_process');
4
4
  const path = require('path');
5
5
  const fs = require('fs');
6
6
  const os = require('os');
7
+ const https = require('https');
7
8
 
8
9
  const APP_NAME = 'olly-molly';
9
- const REPO_URL = 'https://github.com/ruucm/olly-molly.git';
10
+ const REPO = 'ruucm/olly-molly';
10
11
  const APP_DIR = path.join(os.homedir(), '.olly-molly');
12
+ const TARBALL_URL = `https://github.com/${REPO}/archive/refs/heads/main.tar.gz`;
11
13
 
12
14
  console.log('\nšŸ™ Olly Molly - Your AI Development Team\n');
13
15
 
14
- // Check if app is installed locally
15
- if (!fs.existsSync(APP_DIR)) {
16
- console.log('šŸ“¦ First run - downloading Olly Molly...\n');
17
- try {
18
- execSync(`git clone --depth 1 ${REPO_URL} "${APP_DIR}"`, {
19
- stdio: 'inherit'
20
- });
21
- } catch (error) {
22
- console.error('āŒ Failed to download. Make sure git is installed.');
23
- process.exit(1);
24
- }
16
+ function downloadAndExtract(url, destDir) {
17
+ return new Promise((resolve, reject) => {
18
+ const tempFile = path.join(os.tmpdir(), 'olly-molly.tar.gz');
19
+ const file = fs.createWriteStream(tempFile);
20
+
21
+ console.log('šŸ“„ Downloading...');
22
+
23
+ const download = (downloadUrl) => {
24
+ https.get(downloadUrl, (response) => {
25
+ // Handle redirects
26
+ if (response.statusCode === 302 || response.statusCode === 301) {
27
+ download(response.headers.location);
28
+ return;
29
+ }
30
+
31
+ if (response.statusCode !== 200) {
32
+ reject(new Error(`Download failed: ${response.statusCode}`));
33
+ return;
34
+ }
35
+
36
+ response.pipe(file);
37
+ file.on('finish', () => {
38
+ file.close();
39
+
40
+ console.log('šŸ“¦ Extracting...');
41
+
42
+ // Create dest directory
43
+ if (!fs.existsSync(destDir)) {
44
+ fs.mkdirSync(destDir, { recursive: true });
45
+ }
46
+
47
+ // Extract tarball
48
+ try {
49
+ execSync(`tar -xzf "${tempFile}" -C "${destDir}" --strip-components=1`, {
50
+ stdio: 'pipe'
51
+ });
52
+ fs.unlinkSync(tempFile);
53
+ resolve();
54
+ } catch (err) {
55
+ reject(err);
56
+ }
57
+ });
58
+ }).on('error', reject);
59
+ };
60
+
61
+ download(url);
62
+ });
25
63
  }
26
64
 
27
- // Check for updates (pull latest)
28
- const args = process.argv.slice(2);
29
- if (args.includes('--update') || args.includes('-u')) {
30
- console.log('šŸ”„ Updating Olly Molly...\n');
31
- try {
32
- execSync('git pull origin main', {
33
- cwd: APP_DIR,
34
- stdio: 'inherit'
35
- });
36
- // Clear build cache after update
37
- const nextDir = path.join(APP_DIR, '.next');
38
- if (fs.existsSync(nextDir)) {
39
- fs.rmSync(nextDir, { recursive: true, force: true });
65
+ async function main() {
66
+ const args = process.argv.slice(2);
67
+
68
+ // Update flag
69
+ if (args.includes('--update') || args.includes('-u')) {
70
+ console.log('šŸ”„ Updating Olly Molly...\n');
71
+ if (fs.existsSync(APP_DIR)) {
72
+ fs.rmSync(APP_DIR, { recursive: true, force: true });
40
73
  }
41
- console.log('āœ… Updated! Rebuilding...\n');
42
- } catch (error) {
43
- console.error('āš ļø Update failed, continuing with current version');
44
74
  }
45
- }
46
-
47
- // Install dependencies if needed
48
- const nodeModulesPath = path.join(APP_DIR, 'node_modules');
49
- if (!fs.existsSync(nodeModulesPath)) {
50
- console.log('šŸ“¦ Installing dependencies...\n');
51
- try {
52
- execSync('npm install', {
53
- cwd: APP_DIR,
54
- stdio: 'inherit'
55
- });
56
- } catch (error) {
57
- console.error('āŒ Failed to install dependencies');
58
- process.exit(1);
75
+
76
+ // Download if not exists
77
+ if (!fs.existsSync(APP_DIR)) {
78
+ console.log('šŸ“¦ First run - downloading Olly Molly...\n');
79
+ try {
80
+ await downloadAndExtract(TARBALL_URL, APP_DIR);
81
+ console.log('āœ… Downloaded!\n');
82
+ } catch (error) {
83
+ console.error('āŒ Download failed:', error.message);
84
+ console.error('\n Make sure the repository is public at:');
85
+ console.error(` https://github.com/${REPO}\n`);
86
+ process.exit(1);
87
+ }
59
88
  }
60
- }
61
-
62
- // Build if needed
63
- const nextPath = path.join(APP_DIR, '.next');
64
- if (!fs.existsSync(nextPath)) {
65
- console.log('šŸ”Ø Building app (first time only)...\n');
66
- try {
67
- execSync('npm run build', {
68
- cwd: APP_DIR,
69
- stdio: 'inherit'
70
- });
71
- } catch (error) {
72
- console.error('āŒ Failed to build');
73
- process.exit(1);
89
+
90
+ // Install dependencies if needed
91
+ const nodeModulesPath = path.join(APP_DIR, 'node_modules');
92
+ if (!fs.existsSync(nodeModulesPath)) {
93
+ console.log('šŸ“¦ Installing dependencies (first time only)...\n');
94
+ try {
95
+ execSync('npm install --production', {
96
+ cwd: APP_DIR,
97
+ stdio: 'inherit'
98
+ });
99
+ } catch (error) {
100
+ console.error('āŒ Failed to install dependencies');
101
+ process.exit(1);
102
+ }
103
+ }
104
+
105
+ // Build if needed
106
+ const nextPath = path.join(APP_DIR, '.next');
107
+ if (!fs.existsSync(nextPath)) {
108
+ console.log('šŸ”Ø Building app (first time only)...\n');
109
+ try {
110
+ execSync('npm run build', {
111
+ cwd: APP_DIR,
112
+ stdio: 'inherit'
113
+ });
114
+ } catch (error) {
115
+ console.error('āŒ Failed to build');
116
+ process.exit(1);
117
+ }
74
118
  }
119
+
120
+ console.log('\nšŸš€ Starting on http://localhost:1234\n');
121
+ console.log(' Press Ctrl+C to stop');
122
+ console.log(' Run "npx olly-molly -u" to update\n');
123
+
124
+ // Start the server
125
+ const server = spawn('npm', ['run', 'start', '--', '--port', '1234'], {
126
+ cwd: APP_DIR,
127
+ stdio: 'inherit',
128
+ shell: true
129
+ });
130
+
131
+ server.on('error', (error) => {
132
+ console.error('āŒ Failed to start:', error.message);
133
+ process.exit(1);
134
+ });
135
+
136
+ server.on('close', (code) => {
137
+ process.exit(code || 0);
138
+ });
139
+
140
+ // Graceful shutdown
141
+ process.on('SIGINT', () => {
142
+ console.log('\nšŸ‘‹ Bye!');
143
+ server.kill('SIGINT');
144
+ });
145
+
146
+ process.on('SIGTERM', () => {
147
+ server.kill('SIGTERM');
148
+ });
75
149
  }
76
150
 
77
- console.log('šŸš€ Starting on http://localhost:1234\n');
78
- console.log(' Press Ctrl+C to stop');
79
- console.log(' Run "npx olly-molly --update" to get latest version\n');
80
-
81
- // Start the server
82
- const server = spawn('npm', ['run', 'start', '--', '--port', '1234'], {
83
- cwd: APP_DIR,
84
- stdio: 'inherit',
85
- shell: true
86
- });
87
-
88
- server.on('error', (error) => {
89
- console.error('āŒ Failed to start:', error.message);
90
- process.exit(1);
91
- });
92
-
93
- server.on('close', (code) => {
94
- process.exit(code || 0);
95
- });
96
-
97
- // Graceful shutdown
98
- process.on('SIGINT', () => {
99
- console.log('\nšŸ‘‹ Bye!');
100
- server.kill('SIGINT');
101
- });
102
-
103
- process.on('SIGTERM', () => {
104
- server.kill('SIGTERM');
105
- });
151
+ main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olly-molly",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",