@lifeaitools/clauth 1.5.59 → 1.5.62

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,121 +1,121 @@
1
- // bootstrap.cjs — CommonJS, compiled to binary by pkg
2
- // Installs npm deps, links clauth, chains to: clauth install
3
- 'use strict';
4
- const { execSync, spawnSync } = require('child_process');
5
- const { join } = require('path');
6
- const ROOT = join(__dirname, '..');
7
-
8
- function run(cmd, opts) {
9
- return spawnSync(cmd, Object.assign({ shell: true, stdio: 'inherit', cwd: ROOT }, opts || {}));
10
- }
11
- function check(cmd) {
12
- try { execSync(cmd + ' --version', { stdio: 'pipe' }); return true; } catch { return false; }
13
- }
14
-
15
- console.log('\n Installing clauth runtime...\n');
16
-
17
- if (!check('git')) {
18
- console.error(' x git not found. Install from https://git-scm.com');
19
- process.exit(1);
20
- }
21
- var nodeVer = parseInt(process.version.slice(1));
22
- if (nodeVer < 18) {
23
- console.error(' x Node.js v18+ required (found ' + process.version + ')');
24
- console.error(' Install from https://nodejs.org');
25
- process.exit(1);
26
- }
27
-
28
- console.log(' -> Installing dependencies...');
29
- var inst = run('npm install --no-fund --no-audit', { stdio: ['ignore','ignore','pipe'] });
30
- if (inst.status !== 0) { console.error(' x npm install failed'); process.exit(1); }
31
- console.log(' + Dependencies ready');
32
-
33
- console.log(' -> Linking clauth command...');
34
- var lnk = run('npm link', { stdio: ['ignore','ignore','pipe'] });
35
- if (lnk.status !== 0) {
36
- var slnk = run('sudo npm link', { stdio: 'inherit' });
37
- if (slnk.status !== 0) console.warn(' ! Could not link globally — add ' + ROOT + '/node_modules/.bin to PATH');
38
- }
39
- console.log(' + clauth linked');
40
-
41
- // Check if cloudflared is installed
42
- var cfFound = false;
43
- try {
44
- execSync('cloudflared --version', { stdio: 'ignore' });
45
- cfFound = true;
46
- } catch {}
47
-
48
- if (!cfFound) {
49
- console.log('\n cloudflared not found — needed for claude.ai web integration (tunnel).');
50
-
51
- var platform = process.platform;
52
- var installCmd = null;
53
- var installLabel = null;
54
-
55
- if (platform === 'win32') {
56
- try {
57
- execSync('winget --version', { stdio: 'ignore' });
58
- installCmd = 'winget install Cloudflare.cloudflared --silent --accept-package-agreements --accept-source-agreements';
59
- installLabel = 'winget';
60
- } catch {}
61
- } else if (platform === 'darwin') {
62
- try {
63
- execSync('brew --version', { stdio: 'ignore' });
64
- installCmd = 'brew install cloudflare/cloudflare/cloudflared';
65
- installLabel = 'Homebrew';
66
- } catch {}
67
- }
68
- // Linux: no auto-install — falls through to manual instructions
69
-
70
- if (installCmd) {
71
- process.stdout.write(' Install now via ' + installLabel + '? (y/n): ');
72
- var answer = (function () {
73
- try {
74
- var buf = Buffer.alloc(3);
75
- var fd = require('fs').openSync('/dev/tty', 'r');
76
- require('fs').readSync(fd, buf, 0, 3);
77
- require('fs').closeSync(fd);
78
- return buf.toString().trim().toLowerCase();
79
- } catch {
80
- try {
81
- var result = require('child_process').spawnSync(
82
- 'powershell',
83
- ['-Command', "$k = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); $k.Character"],
84
- { encoding: 'utf8' }
85
- );
86
- return (result.stdout || '').trim().toLowerCase();
87
- } catch { return 'n'; }
88
- }
89
- })();
90
-
91
- if (answer === 'y') {
92
- console.log(' Installing cloudflared via ' + installLabel + '...');
93
- try {
94
- execSync(installCmd, { stdio: 'inherit' });
95
- console.log(' + cloudflared installed.');
96
- } catch (e) {
97
- console.log(' x Auto-install failed. Install manually:');
98
- console.log(' https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
99
- }
100
- } else {
101
- console.log(' Skipped. Install later and run: clauth tunnel setup');
102
- }
103
- } else {
104
- console.log(' Install manually:');
105
- if (platform === 'win32') {
106
- console.log(' winget install Cloudflare.cloudflared');
107
- console.log(' or: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
108
- } else if (platform === 'darwin') {
109
- console.log(' brew install cloudflare/cloudflare/cloudflared');
110
- console.log(' or: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
111
- } else {
112
- console.log(' https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
113
- }
114
- console.log(' Then run: clauth tunnel setup');
115
- }
116
- console.log('');
117
- }
118
-
119
- console.log('\n -> Launching clauth install...\n');
120
- var r = run('clauth install');
121
- process.exit(r.status || 0);
1
+ // bootstrap.cjs — CommonJS, compiled to binary by pkg
2
+ // Installs npm deps, links clauth, chains to: clauth install
3
+ 'use strict';
4
+ const { execSync, spawnSync } = require('child_process');
5
+ const { join } = require('path');
6
+ const ROOT = join(__dirname, '..');
7
+
8
+ function run(cmd, opts) {
9
+ return spawnSync(cmd, Object.assign({ shell: true, stdio: 'inherit', cwd: ROOT }, opts || {}));
10
+ }
11
+ function check(cmd) {
12
+ try { execSync(cmd + ' --version', { stdio: 'pipe' }); return true; } catch { return false; }
13
+ }
14
+
15
+ console.log('\n Installing clauth runtime...\n');
16
+
17
+ if (!check('git')) {
18
+ console.error(' x git not found. Install from https://git-scm.com');
19
+ process.exit(1);
20
+ }
21
+ var nodeVer = parseInt(process.version.slice(1));
22
+ if (nodeVer < 18) {
23
+ console.error(' x Node.js v18+ required (found ' + process.version + ')');
24
+ console.error(' Install from https://nodejs.org');
25
+ process.exit(1);
26
+ }
27
+
28
+ console.log(' -> Installing dependencies...');
29
+ var inst = run('npm install --no-fund --no-audit', { stdio: ['ignore','ignore','pipe'] });
30
+ if (inst.status !== 0) { console.error(' x npm install failed'); process.exit(1); }
31
+ console.log(' + Dependencies ready');
32
+
33
+ console.log(' -> Linking clauth command...');
34
+ var lnk = run('npm link', { stdio: ['ignore','ignore','pipe'] });
35
+ if (lnk.status !== 0) {
36
+ var slnk = run('sudo npm link', { stdio: 'inherit' });
37
+ if (slnk.status !== 0) console.warn(' ! Could not link globally — add ' + ROOT + '/node_modules/.bin to PATH');
38
+ }
39
+ console.log(' + clauth linked');
40
+
41
+ // Check if cloudflared is installed
42
+ var cfFound = false;
43
+ try {
44
+ execSync('cloudflared --version', { stdio: 'ignore' });
45
+ cfFound = true;
46
+ } catch {}
47
+
48
+ if (!cfFound) {
49
+ console.log('\n cloudflared not found — needed for claude.ai web integration (tunnel).');
50
+
51
+ var platform = process.platform;
52
+ var installCmd = null;
53
+ var installLabel = null;
54
+
55
+ if (platform === 'win32') {
56
+ try {
57
+ execSync('winget --version', { stdio: 'ignore' });
58
+ installCmd = 'winget install Cloudflare.cloudflared --silent --accept-package-agreements --accept-source-agreements';
59
+ installLabel = 'winget';
60
+ } catch {}
61
+ } else if (platform === 'darwin') {
62
+ try {
63
+ execSync('brew --version', { stdio: 'ignore' });
64
+ installCmd = 'brew install cloudflare/cloudflare/cloudflared';
65
+ installLabel = 'Homebrew';
66
+ } catch {}
67
+ }
68
+ // Linux: no auto-install — falls through to manual instructions
69
+
70
+ if (installCmd) {
71
+ process.stdout.write(' Install now via ' + installLabel + '? (y/n): ');
72
+ var answer = (function () {
73
+ try {
74
+ var buf = Buffer.alloc(3);
75
+ var fd = require('fs').openSync('/dev/tty', 'r');
76
+ require('fs').readSync(fd, buf, 0, 3);
77
+ require('fs').closeSync(fd);
78
+ return buf.toString().trim().toLowerCase();
79
+ } catch {
80
+ try {
81
+ var result = require('child_process').spawnSync(
82
+ 'powershell',
83
+ ['-Command', "$k = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); $k.Character"],
84
+ { encoding: 'utf8' }
85
+ );
86
+ return (result.stdout || '').trim().toLowerCase();
87
+ } catch { return 'n'; }
88
+ }
89
+ })();
90
+
91
+ if (answer === 'y') {
92
+ console.log(' Installing cloudflared via ' + installLabel + '...');
93
+ try {
94
+ execSync(installCmd, { stdio: 'inherit' });
95
+ console.log(' + cloudflared installed.');
96
+ } catch (e) {
97
+ console.log(' x Auto-install failed. Install manually:');
98
+ console.log(' https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
99
+ }
100
+ } else {
101
+ console.log(' Skipped. Install later and run: clauth tunnel setup');
102
+ }
103
+ } else {
104
+ console.log(' Install manually:');
105
+ if (platform === 'win32') {
106
+ console.log(' winget install Cloudflare.cloudflared');
107
+ console.log(' or: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
108
+ } else if (platform === 'darwin') {
109
+ console.log(' brew install cloudflare/cloudflare/cloudflared');
110
+ console.log(' or: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
111
+ } else {
112
+ console.log(' https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/');
113
+ }
114
+ console.log(' Then run: clauth tunnel setup');
115
+ }
116
+ console.log('');
117
+ }
118
+
119
+ console.log('\n -> Launching clauth install...\n');
120
+ var r = run('clauth install');
121
+ process.exit(r.status || 0);
package/scripts/build.sh CHANGED
@@ -1,45 +1,45 @@
1
- #!/usr/bin/env bash
2
- # scripts/build.sh — regenerate bootstrap binaries from source
3
- # Run: npm run build
4
- set -e
5
- cd "$(dirname "$0")/.."
6
-
7
- echo "→ Obfuscating bootstrap.cjs..."
8
- node -e "
9
- const J = require('javascript-obfuscator');
10
- const fs = require('fs');
11
- const src = fs.readFileSync('scripts/bootstrap.cjs', 'utf8');
12
- const out = J.obfuscate(src, {
13
- compact: true,
14
- controlFlowFlattening: true, controlFlowFlatteningThreshold: 0.75,
15
- deadCodeInjection: true, deadCodeInjectionThreshold: 0.4,
16
- identifierNamesGenerator: 'hexadecimal',
17
- rotateStringArray: true, shuffleStringArray: true,
18
- splitStrings: true, splitStringsChunkLength: 8,
19
- stringArray: true, stringArrayEncoding: ['base64'],
20
- stringArrayThreshold: 0.85,
21
- transformObjectKeys: true, target: 'node'
22
- });
23
- fs.writeFileSync('scripts/bootstrap.ob.cjs', out.getObfuscatedCode());
24
- console.log(' ✓ Obfuscated');
25
- "
26
-
27
- echo "→ Compiling binaries..."
28
- mkdir -p scripts/bin
29
- npx pkg scripts/bootstrap.ob.cjs \
30
- --targets node18-win-x64,node18-linux-x64,node18-macos-x64 \
31
- --out-path scripts/bin/tmp/ \
32
- 2>&1 | grep -v "^$" | grep -v "Warning" || true
33
-
34
- # Rename to clean names
35
- mv -f scripts/bin/tmp/bootstrap.ob-linux scripts/bin/bootstrap-linux 2>/dev/null || true
36
- mv -f scripts/bin/tmp/bootstrap.ob-macos scripts/bin/bootstrap-macos 2>/dev/null || true
37
- mv -f scripts/bin/tmp/bootstrap.ob-win.exe scripts/bin/bootstrap-win.exe 2>/dev/null || true
38
- rm -rf scripts/bin/tmp
39
- chmod +x scripts/bin/bootstrap-linux scripts/bin/bootstrap-macos 2>/dev/null || true
40
-
41
- # Clean intermediate
42
- rm -f scripts/bootstrap.ob.cjs
43
-
44
- ls -lh scripts/bin/
45
- echo "✓ Build complete"
1
+ #!/usr/bin/env bash
2
+ # scripts/build.sh — regenerate bootstrap binaries from source
3
+ # Run: npm run build
4
+ set -e
5
+ cd "$(dirname "$0")/.."
6
+
7
+ echo "→ Obfuscating bootstrap.cjs..."
8
+ node -e "
9
+ const J = require('javascript-obfuscator');
10
+ const fs = require('fs');
11
+ const src = fs.readFileSync('scripts/bootstrap.cjs', 'utf8');
12
+ const out = J.obfuscate(src, {
13
+ compact: true,
14
+ controlFlowFlattening: true, controlFlowFlatteningThreshold: 0.75,
15
+ deadCodeInjection: true, deadCodeInjectionThreshold: 0.4,
16
+ identifierNamesGenerator: 'hexadecimal',
17
+ rotateStringArray: true, shuffleStringArray: true,
18
+ splitStrings: true, splitStringsChunkLength: 8,
19
+ stringArray: true, stringArrayEncoding: ['base64'],
20
+ stringArrayThreshold: 0.85,
21
+ transformObjectKeys: true, target: 'node'
22
+ });
23
+ fs.writeFileSync('scripts/bootstrap.ob.cjs', out.getObfuscatedCode());
24
+ console.log(' ✓ Obfuscated');
25
+ "
26
+
27
+ echo "→ Compiling binaries..."
28
+ mkdir -p scripts/bin
29
+ npx pkg scripts/bootstrap.ob.cjs \
30
+ --targets node18-win-x64,node18-linux-x64,node18-macos-x64 \
31
+ --out-path scripts/bin/tmp/ \
32
+ 2>&1 | grep -v "^$" | grep -v "Warning" || true
33
+
34
+ # Rename to clean names
35
+ mv -f scripts/bin/tmp/bootstrap.ob-linux scripts/bin/bootstrap-linux 2>/dev/null || true
36
+ mv -f scripts/bin/tmp/bootstrap.ob-macos scripts/bin/bootstrap-macos 2>/dev/null || true
37
+ mv -f scripts/bin/tmp/bootstrap.ob-win.exe scripts/bin/bootstrap-win.exe 2>/dev/null || true
38
+ rm -rf scripts/bin/tmp
39
+ chmod +x scripts/bin/bootstrap-linux scripts/bin/bootstrap-macos 2>/dev/null || true
40
+
41
+ # Clean intermediate
42
+ rm -f scripts/bootstrap.ob.cjs
43
+
44
+ ls -lh scripts/bin/
45
+ echo "✓ Build complete"