gbos 1.2.6 → 1.2.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.
- package/package.json +1 -1
- package/src/cli.js +3 -1
- package/src/commands/auth.js +16 -29
- package/src/commands/logo.js +4 -4
- package/src/lib/display.js +9 -9
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -77,7 +77,9 @@ program
|
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const userName = session.
|
|
80
|
+
const userName = session.user_first_name && session.user_last_name
|
|
81
|
+
? `${session.user_first_name} ${session.user_last_name}`
|
|
82
|
+
: session.user_name || `User ${session.user_id}`;
|
|
81
83
|
const accountName = session.account_name || `Account ${session.account_id}`;
|
|
82
84
|
|
|
83
85
|
console.log('\n┌─────────────────────────────────────────────────────────────┐');
|
package/src/commands/auth.js
CHANGED
|
@@ -2,22 +2,6 @@ const api = require('../lib/api');
|
|
|
2
2
|
const config = require('../lib/config');
|
|
3
3
|
const { checkForUpdates } = require('../lib/version');
|
|
4
4
|
const { displayAuthSuccess, displayMessageBox } = require('../lib/display');
|
|
5
|
-
const readline = require('readline');
|
|
6
|
-
|
|
7
|
-
// Simple prompt for email
|
|
8
|
-
async function promptEmail() {
|
|
9
|
-
const rl = readline.createInterface({
|
|
10
|
-
input: process.stdin,
|
|
11
|
-
output: process.stdout,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
return new Promise((resolve) => {
|
|
15
|
-
rl.question('Enter your email address: ', (answer) => {
|
|
16
|
-
rl.close();
|
|
17
|
-
resolve(answer.trim());
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
5
|
|
|
22
6
|
// Sleep helper
|
|
23
7
|
function sleep(ms) {
|
|
@@ -34,7 +18,9 @@ async function authCommand(options) {
|
|
|
34
18
|
// Check if already authenticated
|
|
35
19
|
if (config.isAuthenticated() && !options.force) {
|
|
36
20
|
const session = config.loadSession();
|
|
37
|
-
const userName = session.
|
|
21
|
+
const userName = session.user_first_name && session.user_last_name
|
|
22
|
+
? `${session.user_first_name} ${session.user_last_name}`
|
|
23
|
+
: session.user_name || `User ${session.user_id}`;
|
|
38
24
|
const accountName = session.account_name || `Account ${session.account_id}`;
|
|
39
25
|
displayMessageBox(
|
|
40
26
|
'Already Authenticated',
|
|
@@ -45,18 +31,10 @@ async function authCommand(options) {
|
|
|
45
31
|
}
|
|
46
32
|
|
|
47
33
|
try {
|
|
48
|
-
|
|
49
|
-
const email = options.email || (await promptEmail());
|
|
50
|
-
|
|
51
|
-
if (!email || !email.includes('@')) {
|
|
52
|
-
displayMessageBox('Invalid Email', 'Please enter a valid email address.', 'error');
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log(`\nInitializing authentication for: ${email}`);
|
|
34
|
+
console.log('\nInitializing authentication...');
|
|
57
35
|
|
|
58
36
|
// Initialize device auth flow
|
|
59
|
-
const initResponse = await api.initAuth({
|
|
37
|
+
const initResponse = await api.initAuth({});
|
|
60
38
|
const { device_code, verification_code, verification_url_complete, interval, expires_in } =
|
|
61
39
|
initResponse.data;
|
|
62
40
|
|
|
@@ -113,6 +91,8 @@ async function authCommand(options) {
|
|
|
113
91
|
user_id,
|
|
114
92
|
user_name,
|
|
115
93
|
user_email,
|
|
94
|
+
user_first_name,
|
|
95
|
+
user_last_name,
|
|
116
96
|
account_id,
|
|
117
97
|
account_name,
|
|
118
98
|
session_id,
|
|
@@ -122,13 +102,20 @@ async function authCommand(options) {
|
|
|
122
102
|
const expiresInSeconds = tokenExpires && tokenExpires > 60 ? tokenExpires : 86400;
|
|
123
103
|
const tokenExpiresAt = new Date(Date.now() + expiresInSeconds * 1000).toISOString();
|
|
124
104
|
|
|
105
|
+
// Build display name from first_name + last_name
|
|
106
|
+
const displayUserName = user_first_name && user_last_name
|
|
107
|
+
? `${user_first_name} ${user_last_name}`
|
|
108
|
+
: user_name || `User ${user_id}`;
|
|
109
|
+
|
|
125
110
|
// Save session with names
|
|
126
111
|
config.saveSession({
|
|
127
112
|
access_token,
|
|
128
113
|
refresh_token,
|
|
129
114
|
token_expires_at: tokenExpiresAt,
|
|
130
115
|
user_id,
|
|
131
|
-
user_name:
|
|
116
|
+
user_name: displayUserName,
|
|
117
|
+
user_first_name,
|
|
118
|
+
user_last_name,
|
|
132
119
|
user_email,
|
|
133
120
|
account_id,
|
|
134
121
|
account_name: account_name || `Account ${account_id}`,
|
|
@@ -138,7 +125,7 @@ async function authCommand(options) {
|
|
|
138
125
|
|
|
139
126
|
// Display success with logo - use names
|
|
140
127
|
displayAuthSuccess({
|
|
141
|
-
userName:
|
|
128
|
+
userName: displayUserName,
|
|
142
129
|
accountName: account_name || `Account ${account_id}`,
|
|
143
130
|
sessionId: session_id,
|
|
144
131
|
});
|
package/src/commands/logo.js
CHANGED
|
@@ -4,16 +4,16 @@ const { displayImage, getTerminalWidth } = require('../lib/display');
|
|
|
4
4
|
async function logoCommand() {
|
|
5
5
|
const logoPath = path.join(__dirname, '../../images/logo.png');
|
|
6
6
|
const terminalWidth = getTerminalWidth();
|
|
7
|
-
const targetWidth = Math.max(
|
|
7
|
+
const targetWidth = Math.max(20, Math.floor(terminalWidth * 0.2));
|
|
8
8
|
|
|
9
9
|
await displayImage(logoPath, {
|
|
10
10
|
width: targetWidth,
|
|
11
11
|
fallbackWidth: targetWidth,
|
|
12
|
-
fallbackHeight:
|
|
12
|
+
fallbackHeight: 8,
|
|
13
13
|
sharp: false,
|
|
14
14
|
crop: true,
|
|
15
|
-
alphaThreshold:
|
|
16
|
-
cropAlphaThreshold:
|
|
15
|
+
alphaThreshold: 180,
|
|
16
|
+
cropAlphaThreshold: 180,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
package/src/lib/display.js
CHANGED
|
@@ -298,16 +298,16 @@ function displayLogoWithDetails(details = null) {
|
|
|
298
298
|
const logoPath = path.join(__dirname, '../../images/logo.png');
|
|
299
299
|
const version = require('../../package.json').version;
|
|
300
300
|
|
|
301
|
-
// Render logo at ~
|
|
302
|
-
let logoLines = imageToPixels(logoPath,
|
|
303
|
-
alphaThreshold:
|
|
301
|
+
// Render logo at ~20 chars wide, 8 rows tall with smooth edges and dots
|
|
302
|
+
let logoLines = imageToPixels(logoPath, 20, 8, {
|
|
303
|
+
alphaThreshold: 180,
|
|
304
304
|
crop: true,
|
|
305
|
-
cropAlphaThreshold:
|
|
305
|
+
cropAlphaThreshold: 180,
|
|
306
306
|
sampleMode: 'coverage',
|
|
307
307
|
});
|
|
308
308
|
if (!logoLines) logoLines = COMPACT_LOGO;
|
|
309
309
|
|
|
310
|
-
const logoWidth =
|
|
310
|
+
const logoWidth = 26; // Account for escape codes
|
|
311
311
|
|
|
312
312
|
// Build right side - Claude Code style (clean lines, no boxes)
|
|
313
313
|
const rightLines = [];
|
|
@@ -342,15 +342,15 @@ function displayAuthSuccess(data) {
|
|
|
342
342
|
const logoPath = path.join(__dirname, '../../images/logo.png');
|
|
343
343
|
const version = require('../../package.json').version;
|
|
344
344
|
|
|
345
|
-
let logoLines = imageToPixels(logoPath,
|
|
346
|
-
alphaThreshold:
|
|
345
|
+
let logoLines = imageToPixels(logoPath, 20, 8, {
|
|
346
|
+
alphaThreshold: 180,
|
|
347
347
|
crop: true,
|
|
348
|
-
cropAlphaThreshold:
|
|
348
|
+
cropAlphaThreshold: 180,
|
|
349
349
|
sampleMode: 'coverage',
|
|
350
350
|
});
|
|
351
351
|
if (!logoLines) logoLines = COMPACT_LOGO;
|
|
352
352
|
|
|
353
|
-
const logoWidth =
|
|
353
|
+
const logoWidth = 26;
|
|
354
354
|
|
|
355
355
|
const rightLines = [];
|
|
356
356
|
rightLines.push(`${BOLD}${colors.purple5}gbos.io${RESET} ${DIM}v${version}${RESET}`);
|