difit 1.1.1 → 1.1.2

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/dist/cli/index.js CHANGED
@@ -54,7 +54,7 @@ program
54
54
  console.error(`Error: ${validation.error}`);
55
55
  process.exit(1);
56
56
  }
57
- const { url } = await startServer({
57
+ const { url, port } = await startServer({
58
58
  targetCommitish,
59
59
  baseCommitish,
60
60
  preferredPort: options.port,
@@ -69,8 +69,21 @@ program
69
69
  else {
70
70
  console.log('šŸ’” Use --open to automatically open browser\n');
71
71
  }
72
- process.on('SIGINT', () => {
72
+ process.on('SIGINT', async () => {
73
73
  console.log('\nšŸ‘‹ Shutting down ReviewIt server...');
74
+ // Try to fetch comments before shutting down
75
+ try {
76
+ const response = await fetch(`http://localhost:${port}/api/comments-output`);
77
+ if (response.ok) {
78
+ const data = await response.text();
79
+ if (data.trim()) {
80
+ console.log(data);
81
+ }
82
+ }
83
+ }
84
+ catch {
85
+ // Silently ignore fetch errors during shutdown
86
+ }
74
87
  process.exit(0);
75
88
  });
76
89
  }