lore-memory 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lore-memory",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Persistent project memory for developers. Captures decisions, invariants, gotchas, and graveyard entries — automatically and manually — and injects them into AI coding sessions.",
5
5
  "main": "bin/lore.js",
6
6
  "bin": {
@@ -28,7 +28,9 @@ async function serve(options) {
28
28
  const uiPort = options.port || 3333;
29
29
  try {
30
30
  const { startDashboard } = require('./ui');
31
- startDashboard(uiPort);
31
+ // Pass quiet: true to prevent stdout corruption of the MCP protocol stream
32
+ // and prevent the UI from calling process.exit() if the port is in use.
33
+ startDashboard(uiPort, { quiet: true, openBrowser: false });
32
34
  } catch (e) {
33
35
  process.stderr.write(chalk.yellow(`⚠ Could not start UI dashboard: ${e.message}\n`));
34
36
  }
@@ -16,7 +16,7 @@ async function openBrowser(url) {
16
16
  await open(url);
17
17
  }
18
18
 
19
- function createApp(portNum) {
19
+ function createApp(portNum, options = {}) {
20
20
  const app = express();
21
21
  const PORT = portNum || 3333;
22
22
 
@@ -153,28 +153,40 @@ function createApp(portNum) {
153
153
  });
154
154
 
155
155
  const server = app.listen(PORT, () => {
156
- const url = `http://localhost:${PORT}`;
157
- console.log(chalk.green(`\n🚀 Lore UI Dashboard running at ${chalk.bold(url)}\n`));
158
- console.log(chalk.cyan(` Press Ctrl+C to stop the server.`));
159
-
160
- // Use native exec to open browser to avoid ESM import issues with 'open'
161
- const { exec } = require('child_process');
162
- const startPath = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
163
- exec(`${startPath} ${url}`, (err) => {
164
- if (err) {
165
- console.log(chalk.dim(` (Could not open browser automatically. Please visit ${url} manually)`));
156
+ if (!options.quiet) {
157
+ const url = `http://localhost:${PORT}`;
158
+ console.log(chalk.green(`\n🚀 Lore UI Dashboard running at ${chalk.bold(url)}\n`));
159
+ console.log(chalk.cyan(` Press Ctrl+C to stop the server.`));
160
+
161
+ // Use native exec to open browser to avoid ESM import issues with 'open'
162
+ if (options.openBrowser !== false) {
163
+ const { exec } = require('child_process');
164
+ const startPath = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
165
+ exec(`${startPath} ${url}`, (err) => {
166
+ if (err) {
167
+ console.log(chalk.dim(` (Could not open browser automatically. Please visit ${url} manually)`));
168
+ }
169
+ });
166
170
  }
167
- });
171
+ }
168
172
  });
169
173
 
170
174
  server.on('error', (e) => {
171
175
  if (e.code === 'EADDRINUSE') {
172
- console.error(chalk.red(`\nPort ${PORT} is already in use by another process.`));
173
- console.error(chalk.yellow(`Use 'lore ui --port <number>' to specify a different port.\n`));
174
- process.exit(1);
176
+ if (!options.quiet) {
177
+ console.error(chalk.red(`\nPort ${PORT} is already in use by another process.`));
178
+ console.error(chalk.yellow(`Use 'lore ui --port <number>' to specify a different port.\n`));
179
+ process.exit(1);
180
+ } else {
181
+ process.stderr.write(chalk.yellow(`\n⚠ Lore UI dashboard port ${PORT} is in use; dashboard disabled for this instance.\n`));
182
+ }
175
183
  } else {
176
- console.error(chalk.red(`\nFailed to start server: ${e.message}\n`));
177
- process.exit(1);
184
+ if (!options.quiet) {
185
+ console.error(chalk.red(`\nFailed to start server: ${e.message}\n`));
186
+ process.exit(1);
187
+ } else {
188
+ process.stderr.write(chalk.red(`\n⚠ Failed to start Lore UI dashboard: ${e.message}\n`));
189
+ }
178
190
  }
179
191
  });
180
192
 
@@ -186,13 +198,13 @@ function createApp(portNum) {
186
198
  * @param {number} port
187
199
  * @returns {object} Express server instance
188
200
  */
189
- function startDashboard(port) {
190
- return createApp(port || 3333);
201
+ function startDashboard(port, options = {}) {
202
+ return createApp(port || 3333, options);
191
203
  }
192
204
 
193
205
  function ui(options) {
194
206
  requireInit();
195
- createApp(options.port || 3333);
207
+ createApp(options.port || 3333, { quiet: false, openBrowser: true });
196
208
  }
197
209
 
198
210
  module.exports = ui;