mattermost-claude-code 0.7.1 → 0.7.3

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.
@@ -53,6 +53,7 @@ interface Session {
53
53
  updateTimer: ReturnType<typeof setTimeout> | null;
54
54
  typingTimer: ReturnType<typeof setInterval> | null;
55
55
  timeoutWarningPosted: boolean;
56
+ isRestarting: boolean;
56
57
  }
57
58
  export declare class SessionManager {
58
59
  private mattermost;
@@ -131,6 +131,7 @@ export class SessionManager {
131
131
  updateTimer: null,
132
132
  typingTimer: null,
133
133
  timeoutWarningPosted: false,
134
+ isRestarting: false,
134
135
  };
135
136
  // Register session
136
137
  this.sessions.set(actualThreadId, session);
@@ -710,6 +711,11 @@ export class SessionManager {
710
711
  const session = this.sessions.get(threadId);
711
712
  if (!session)
712
713
  return;
714
+ // If we're intentionally restarting (e.g., !cd), don't clean up or post exit message
715
+ if (session.isRestarting) {
716
+ session.isRestarting = false; // Reset flag here, after the exit event fires
717
+ return;
718
+ }
713
719
  this.stopTyping(session);
714
720
  if (session.updateTimer) {
715
721
  clearTimeout(session.updateTimer);
@@ -810,6 +816,7 @@ export class SessionManager {
810
816
  console.log(` 📂 Session (${shortId}…) changing directory to ${shortDir}`);
811
817
  // Stop the current Claude CLI
812
818
  this.stopTyping(session);
819
+ session.isRestarting = true; // Suppress exit message during restart
813
820
  session.claude.kill();
814
821
  // Flush any pending content
815
822
  await this.flush(session);
@@ -830,8 +837,10 @@ export class SessionManager {
830
837
  // Start the new Claude CLI
831
838
  try {
832
839
  session.claude.start();
840
+ // Note: isRestarting is reset in handleExit when the old process exit event fires
833
841
  }
834
842
  catch (err) {
843
+ session.isRestarting = false; // Reset flag on failure since exit won't fire
835
844
  console.error(' ❌ Failed to restart Claude:', err);
836
845
  await this.mattermost.createPost(`❌ Failed to restart Claude: ${err}`, threadId);
837
846
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-claude-code",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Share Claude Code sessions live in a Mattermost channel with interactive features",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",