ticketlens 0.1.6 → 0.1.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.
@@ -309,9 +309,12 @@ switch (command) {
309
309
  try {
310
310
  token = await browserLogin();
311
311
  } catch (err) {
312
- process.stderr.write(`\x1b[A\r\x1b[2K ${s.red('✖')} ${err.message}\n`);
313
- process.stderr.write(`\n ${s.dim(`Try ${s.cyan('ticketlens login --manual')} to paste a token instead.`)}\n\n`);
314
- process.exitCode = 1;
312
+ const cancelled = err.message === 'Authorization cancelled';
313
+ process.stderr.write(`\x1b[A\r\x1b[2K ${s.red('✖')} ${cancelled ? 'Login cancelled.' : err.message}\n`);
314
+ if (!cancelled) {
315
+ process.stderr.write(`\n ${s.dim(`Try ${s.cyan('ticketlens login --manual')} to paste a token instead.`)}\n\n`);
316
+ }
317
+ process.exitCode = cancelled ? 0 : 1;
315
318
  return;
316
319
  }
317
320
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticketlens",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Jira CLI for developers — fetch ticket context, triage your queue, and stop tab-switching. Zero dependencies, all local.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -49,6 +49,7 @@ export function startLocalServer(port, expectedState, timeoutMs = TIMEOUT_MS) {
49
49
 
50
50
  const token = url.searchParams.get('token') ?? '';
51
51
  const state = url.searchParams.get('state') ?? '';
52
+ const error = url.searchParams.get('error') ?? '';
52
53
 
53
54
  if (state !== expectedState) {
54
55
  res.writeHead(400, { 'Content-Type': 'text/plain' });
@@ -57,6 +58,18 @@ export function startLocalServer(port, expectedState, timeoutMs = TIMEOUT_MS) {
57
58
  return;
58
59
  }
59
60
 
61
+ if (error) {
62
+ res.writeHead(200, { 'Content-Type': 'text/html' });
63
+ res.end(
64
+ '<html><body style="font-family:sans-serif;text-align:center;padding:60px;background:#0d1117;color:#cdd9e5">'
65
+ + '<h2 style="color:#8b949e">Authorization cancelled</h2>'
66
+ + '<p style="color:#8b949e">You can close this tab.</p>'
67
+ + '</body></html>',
68
+ );
69
+ settle(reject, new Error('Authorization cancelled'));
70
+ return;
71
+ }
72
+
60
73
  if (!token.startsWith('tl_')) {
61
74
  res.writeHead(400, { 'Content-Type': 'text/plain' });
62
75
  res.end('Invalid token received.');