sb-convert 1.0.2 → 1.0.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.
Binary file
Binary file
Binary file
Binary file
package/bin/sb-convert.js CHANGED
@@ -27,15 +27,7 @@ const binaryPath = path.join(projectRoot, binaryName);
27
27
  // Check if raw Go source exists (for dev mode)
28
28
  const mainGoPath = path.join(projectRoot, 'main.go');
29
29
 
30
- const invocationName = path.basename(process.argv[1], '.js');
31
- let args = process.argv.slice(2);
32
-
33
- // If called as sb-deploy, ensure the first argument to the Go binary is 'deploy'
34
- if (invocationName.includes('sb-deploy')) {
35
- if (args.length === 0 || args[0] !== 'deploy') {
36
- args = ['deploy', ...args];
37
- }
38
- }
30
+ const args = process.argv.slice(2);
39
31
 
40
32
  let child;
41
33
 
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ function getBinaryName() {
8
+ const platform = os.platform();
9
+ const arch = os.arch();
10
+ if (platform === 'win32') {
11
+ return 'sb-convert-win.exe';
12
+ } else if (platform === 'darwin') {
13
+ if (arch === 'arm64') {
14
+ return 'sb-convert-macos-arm';
15
+ }
16
+ return 'sb-convert-macos';
17
+ }
18
+ return 'sb-convert-linux';
19
+ }
20
+
21
+ const binaryName = getBinaryName();
22
+ const args = ['deploy', ...process.argv.slice(2)];
23
+
24
+ const binDir = __dirname;
25
+ const localBinaryPath = path.join(binDir, binaryName);
26
+
27
+ // Fallback logic for development
28
+ const projectRoot = path.join(__dirname, '..', '..', '..');
29
+ const binaryPath = path.join(projectRoot, binaryName);
30
+
31
+ let child;
32
+ if (require('fs').existsSync(localBinaryPath)) {
33
+ child = spawn(localBinaryPath, args, {
34
+ cwd: process.cwd(),
35
+ stdio: 'inherit',
36
+ shell: true
37
+ });
38
+ } else if (require('fs').existsSync(binaryPath)) {
39
+ child = spawn(binaryPath, args, {
40
+ cwd: process.cwd(),
41
+ stdio: 'inherit',
42
+ shell: true
43
+ });
44
+ } else {
45
+ console.error(`Error: Could not find sb-convert binary.`);
46
+ process.exit(1);
47
+ }
48
+
49
+ child.on('error', (err) => {
50
+ console.error(`Failed to start sb-deploy: ${err.message}`);
51
+ process.exit(1);
52
+ });
53
+
54
+ child.on('exit', (code) => {
55
+ process.exit(code);
56
+ });
@@ -6,7 +6,7 @@ services:
6
6
  ports:
7
7
  - "2020:8080"
8
8
  environment:
9
- - GEMINI_API_KEY=AIzaSyCt26Utwx3zt2DvW-5c5th747D875dAGWE
9
+ - GEMINI_API_KEY=AIzaSyCAXq9xTIfKx0s0Hv20XrjMsNdbX4hyj38
10
10
  restart: always
11
11
 
12
12
  # This proxy can be used by the office to centralize and potentially cache or log AI calls.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "sb-convert",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Suburban AI Containerizer - Turn any app into a cloud-ready stack",
5
5
  "bin": {
6
6
  "sb-convert": "./bin/sb-convert.js",
7
- "sb-deploy": "./bin/sb-convert.js"
7
+ "sb-deploy": "./bin/sb-deploy.js"
8
8
  },
9
9
  "scripts": {
10
10
  "start": "node ./bin/sb-convert.js"
package/proxy.js CHANGED
@@ -12,10 +12,16 @@ if (!API_KEY) {
12
12
  const server = http.createServer((req, clientRes) => {
13
13
  console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`);
14
14
 
15
+ // Strip any 'key' from the query parameters to ensure Google uses our injected header
16
+ const targetPath = req.url.split('?')[0];
17
+ const queryParams = new URLSearchParams(req.url.split('?')[1] || '');
18
+ queryParams.delete('key');
19
+ const cleanPath = queryParams.toString() ? `${targetPath}?${queryParams.toString()}` : targetPath;
20
+
15
21
  const options = {
16
22
  hostname: 'generativelanguage.googleapis.com',
17
23
  port: 443,
18
- path: req.url,
24
+ path: cleanPath,
19
25
  method: req.method,
20
26
  headers: {
21
27
  ...req.headers,