opencode-studio-server 1.0.6 → 1.0.7

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/index.js +20 -23
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -850,34 +850,31 @@ app.get('/api/auth', (req, res) => {
850
850
  res.json({ credentials, authFile, hasGeminiAuthPlugin });
851
851
  });
852
852
 
853
- app.post('/api/auth/login', (req, res) => {
854
- const { provider } = req.body;
855
-
856
- if (!provider) {
857
- return res.status(400).json({ error: 'Provider is required' });
858
- }
859
-
860
- if (!PROVIDER_DISPLAY_NAMES[provider]) {
861
- return res.status(400).json({ error: 'Invalid provider' });
862
- }
863
-
864
- // Run opencode auth login - this opens browser
853
+ app.post('/api/auth/login', (req, res) => {
854
+ // opencode auth login is interactive and requires a terminal
855
+ // Open a new terminal window with the command
865
856
  const isWindows = process.platform === 'win32';
866
- const command = isWindows
867
- ? `start "" opencode auth login ${provider}`
868
- : `opencode auth login ${provider}`;
857
+ const isMac = process.platform === 'darwin';
858
+
859
+ let command;
860
+ if (isWindows) {
861
+ command = 'start cmd /k "opencode auth login"';
862
+ } else if (isMac) {
863
+ command = 'osascript -e \'tell app "Terminal" to do script "opencode auth login"\'';
864
+ } else {
865
+ command = 'x-terminal-emulator -e "opencode auth login" || gnome-terminal -- opencode auth login || xterm -e "opencode auth login"';
866
+ }
869
867
 
870
868
  exec(command, (err) => {
871
- if (err) console.error('Failed to start auth login:', err);
869
+ if (err) console.error('Failed to open terminal:', err);
872
870
  });
873
871
 
874
- // Return immediately - login happens in browser
875
- res.json({
876
- success: true,
877
- message: `Opening browser for ${provider} login...`,
878
- note: 'Complete authentication in your browser, then refresh this page.'
879
- });
880
- });
872
+ res.json({
873
+ success: true,
874
+ message: 'Opening terminal for authentication...',
875
+ note: 'Complete authentication in the terminal window, then refresh this page.'
876
+ });
877
+ });
881
878
 
882
879
  app.delete('/api/auth/:provider', (req, res) => {
883
880
  const provider = req.params.provider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {