@nectarcrm/ccx 0.5.0 → 0.5.1

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/ccx.js +10 -2
  2. package/package.json +1 -1
package/bin/ccx.js CHANGED
@@ -787,8 +787,16 @@ if (cmd === 'doctor') await doctor()
787
787
 
788
788
  if (cmd === 'login') await login(rest[0] ?? readJson(APP, null)?.url ?? DEFAULT_URL)
789
789
 
790
- const app = readJson(APP, null)
791
- const key = app && secretGet()
790
+ let app = readJson(APP, null)
791
+ let key = app && secretGet()
792
+ // `ccx` sozinho num terminal sem login: faz o login e segue pra escolha da conta.
793
+ // Os outros comandos (e scripts, sem terminal) só avisam: nunca abrem o navegador sem a pessoa pedir.
794
+ if ((!app || !key) && !cmd && process.stdin.isTTY) {
795
+ console.error('Este computador ainda não está conectado. Vamos fazer o login.\n')
796
+ await login(app?.url ?? DEFAULT_URL)
797
+ app = readJson(APP, null)
798
+ key = app && secretGet()
799
+ }
792
800
  if (!app || !key) die('Este computador ainda não está conectado. Rode: ccx login')
793
801
 
794
802
  if (cmd === 'logout') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectarcrm/ccx",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Escolhe qual conta Claude este computador usa, conectado ao app Contas Claude da Nectar.",
5
5
  "type": "module",
6
6
  "bin": { "ccx": "bin/ccx.js" },