@softerist/heuristic-mcp 3.2.7 → 3.2.8

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/index.js +18 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -260,6 +260,11 @@ function isCrashShutdownReason(reason) {
260
260
  return normalized.includes('uncaughtexception') || normalized.includes('unhandledrejection');
261
261
  }
262
262
 
263
+ function shouldLogProcessLifecycle() {
264
+ const value = String(process.env.HEURISTIC_MCP_PROCESS_LIFECYCLE || '').trim().toLowerCase();
265
+ return value === '1' || value === 'true' || value === 'yes' || value === 'on';
266
+ }
267
+
263
268
  function getShutdownExitCode(reason) {
264
269
  const normalized = String(reason || '').trim().toUpperCase();
265
270
  if (normalized === 'SIGINT') return 130;
@@ -270,15 +275,20 @@ function getShutdownExitCode(reason) {
270
275
  function registerProcessDiagnostics({ isServerMode, requestShutdown, getShutdownReason }) {
271
276
  if (!isServerMode) return;
272
277
 
273
- process.on('beforeExit', (code) => {
274
- const reason = getShutdownReason() || 'natural';
275
- console.info(`[Server] Process beforeExit (code=${code}, reason=${reason}).`);
276
- });
278
+ if (shouldLogProcessLifecycle()) {
279
+ let beforeExitLogged = false;
280
+ process.on('beforeExit', (code) => {
281
+ if (beforeExitLogged) return;
282
+ beforeExitLogged = true;
283
+ const reason = getShutdownReason() || 'natural';
284
+ console.info(`[Server] Process beforeExit (code=${code}, reason=${reason}).`);
285
+ });
277
286
 
278
- process.on('exit', (code) => {
279
- const reason = getShutdownReason() || 'natural';
280
- console.info(`[Server] Process exit (code=${code}, reason=${reason}).`);
281
- });
287
+ process.on('exit', (code) => {
288
+ const reason = getShutdownReason() || 'natural';
289
+ console.info(`[Server] Process exit (code=${code}, reason=${reason}).`);
290
+ });
291
+ }
282
292
 
283
293
  let fatalHandled = false;
284
294
  const handleFatalError = (reason, detail) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softerist/heuristic-mcp",
3
- "version": "3.2.7",
3
+ "version": "3.2.8",
4
4
  "description": "An enhanced MCP server providing intelligent semantic code search with find-similar-code, recency ranking, and improved chunking. Fork of smart-coding-mcp.",
5
5
  "type": "module",
6
6
  "main": "index.js",