opencode-statboard 2.10.16 → 2.10.18

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,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = beforeTryListen + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');
@@ -1,79 +0,0 @@
1
- const fs = require('fs');
2
- const c = fs.readFileSync('server.js', 'utf8');
3
-
4
- // Find the tryListen function start
5
- const tryListenStart = c.indexOf('function tryListen(port, maxPort) {');
6
- if (tryListenStart === -1) {
7
- console.log('Could not find tryListen function');
8
- process.exit(1);
9
- }
10
-
11
- // Find the end of tryListen function
12
- let braceCount = 0;
13
- let tryListenEnd = -1;
14
- for (let i = tryListenStart; i < c.length; i++) {
15
- if (c[i] === '{') braceCount++;
16
- else if (c[i] === '}') {
17
- braceCount--;
18
- if (braceCount === 0) {
19
- tryListenEnd = i + 1; // Include the closing brace
20
- break;
21
- }
22
- }
23
-
24
- if (tryListenEnd === -1) {
25
- console.log('Could not find end of tryListen function');
26
- process.exit(1);
27
- }
28
-
29
- // Find the IIFE start
30
- const iifeStart = c.indexOf('(async () => {');
31
- if (iifeStart === -1) {
32
- console.log('Could not find IIFE start');
33
- process.exit(1);
34
- }
35
-
36
- // Find the end of the IIFE (the closing })();)
37
- let braceCount = 0;
38
- let iifeEnd = -1;
39
- for (let i = c.indexOf('(async () => {'); i < c.length; i++) {
40
- if (c[i] === '{') braceCount++;
41
- else if (c[i] === '}') {
42
- braceCount--;
43
- if (braceCount === 0) {
44
- // Check if next chars are })();
45
- const nextChars = c.substring(i, i + 10);
46
- if (nextChars.startsWith('})();')) {
47
- iifeEnd = i + 5; // Include })();
48
- break;
49
- }
50
- }
51
- }
52
-
53
- if (iifeEnd === -1) {
54
- console.log('Could not find end of IIFE');
55
- process.exit(1);
56
- }
57
-
58
- // Build new content
59
- const beforeTryListen = c.substring(0, tryListenStart);
60
- const afterIifeEnd = c.substring(iifeEnd);
61
-
62
- const newContent = c.substring(0, tryListenStart) + `
63
- async function startServer() {
64
- return new Promise((resolve, reject) => {
65
- server.listen(PORT, '127.0.0.1', () => {
66
- console.log('opencode stats dashboard: http://127.0.0.1:' + PORT);
67
- resolve(PORT);
68
- });
69
- server.once('error', (e) => {
70
- console.error('Server error:', e.message);
71
- process.exit(1);
72
- });
73
- });
74
- }
75
-
76
- ` + c.substring(iifeStart);
77
-
78
- fs.writeFileSync('server.js', newContent);
79
- console.log('Fixed server.js - replaced tryListen with fixed port listener');