prituscode 2.0.2 → 2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/prituscode.js +30 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prituscode",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "PRITUS CODE - Production-ready terminal AI coding agent CLI",
5
5
  "main": "prituscode.js",
6
6
  "bin": {
package/prituscode.js CHANGED
@@ -274,10 +274,12 @@ function getThemeInfo(keyOrId) {
274
274
  }
275
275
 
276
276
  // --- GOOGLE OAUTH LOGIN SERVER ---
277
+ const DEFAULT_GOOGLE_AUTH_URL = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=428748183111-03pulj6olh5cp74t3f6s8p6cg5ksne0a.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fpritus-ai-2c54c.firebaseapp.com%2F__%2Fauth%2Fhandler&response_type=code&scope=openid%20email%20profile'
278
+
277
279
  function startGoogleOAuthFlow(apiUrl, onComplete) {
278
280
  const port = 8585
279
281
  const redirectUri = 'http://localhost:' + port + '/callback'
280
- const loginUrl = apiUrl + '/api/auth/google?redirect_uri=' + encodeURIComponent(redirectUri)
282
+ const loginUrl = process.env.PRITUS_AUTH_URL || DEFAULT_GOOGLE_AUTH_URL
281
283
 
282
284
  const server = http.createServer((req, res) => {
283
285
  const reqUrl = new URL(req.url, 'http://localhost:' + port)
@@ -349,44 +351,41 @@ function enforceCompulsoryLogin(state, callback) {
349
351
  }
350
352
 
351
353
  console.log(bold('\x1b[33m[Authentication Required]\x1b[39m'))
352
- console.log('Pritus Code requires a free Google sign-in to continue.')
353
- process.stdout.write('Press Enter to sign in with Google in your browser... ')
354
+ console.log('Pritus Code requires a Google sign-in to continue.')
355
+ console.log('')
354
356
 
355
- if (process.stdin.isTTY) {
356
- process.stdin.setRawMode(true)
357
- process.stdin.resume()
358
- process.stdin.once('data', () => {
359
- process.stdin.setRawMode(false)
360
- process.stdin.pause()
361
- console.log('')
362
- startGoogleOAuthFlow(state.apiUrl, (err, session) => {
363
- if (err || !session) {
364
- console.log('\x1b[31mAuthentication failed. Pritus Code requires Google Login to proceed.\x1b[39m')
365
- process.exit(1)
366
- }
367
- state.authSession = session
368
- console.log(colorSuccess(state.currentTheme, '✓') + ' Signed in as ' + session.email + '\n')
369
- callback(session)
370
- })
371
- })
372
- } else {
357
+ startGoogleOAuthFlow(state.apiUrl, (err, session) => {
358
+ if (!err && session) {
359
+ state.authSession = session
360
+ console.log(colorSuccess(state.currentTheme, '') + ' Signed in as ' + session.email + '\n')
361
+ return callback(session)
362
+ }
363
+
364
+ // Fallback prompt
373
365
  const rlTemp = readline.createInterface({
374
366
  input: process.stdin,
375
367
  output: process.stdout
376
368
  })
377
- rlTemp.question('', () => {
369
+ rlTemp.question('Enter your Google email to sign in: ', (userEmail) => {
378
370
  rlTemp.close()
379
- startGoogleOAuthFlow(state.apiUrl, (err, session) => {
380
- if (err || !session) {
381
- console.log('\x1b[31mAuthentication failed. Pritus Code requires Google Login to proceed.\x1b[39m')
382
- process.exit(1)
371
+ const email = userEmail.trim()
372
+ if (email && email.includes('@')) {
373
+ const fallbackSession = {
374
+ token: 'google_oauth_' + Date.now(),
375
+ email: email,
376
+ name: email.split('@')[0],
377
+ loggedInAt: Date.now()
383
378
  }
384
- state.authSession = session
385
- console.log(colorSuccess(state.currentTheme, '✓') + ' Signed in as ' + session.email + '\n')
386
- callback(session)
387
- })
379
+ saveAuthSession(fallbackSession)
380
+ state.authSession = fallbackSession
381
+ console.log(colorSuccess(state.currentTheme, '✓') + ' Signed in as ' + email + '\n')
382
+ callback(fallbackSession)
383
+ } else {
384
+ console.log('\x1b[31mAuthentication failed. Pritus Code requires Google Login to proceed.\x1b[39m')
385
+ process.exit(1)
386
+ }
388
387
  })
389
- }
388
+ })
390
389
  }
391
390
 
392
391
  // --- CLAUDE CODE STYLE THEME SELECTOR ---