mattermost-claude-code 0.7.1 → 0.7.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.
@@ -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,10 @@ 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
+ return;
717
+ }
713
718
  this.stopTyping(session);
714
719
  if (session.updateTimer) {
715
720
  clearTimeout(session.updateTimer);
@@ -810,6 +815,7 @@ export class SessionManager {
810
815
  console.log(` 📂 Session (${shortId}…) changing directory to ${shortDir}`);
811
816
  // Stop the current Claude CLI
812
817
  this.stopTyping(session);
818
+ session.isRestarting = true; // Suppress exit message during restart
813
819
  session.claude.kill();
814
820
  // Flush any pending content
815
821
  await this.flush(session);
@@ -830,8 +836,10 @@ export class SessionManager {
830
836
  // Start the new Claude CLI
831
837
  try {
832
838
  session.claude.start();
839
+ session.isRestarting = false; // Successfully restarted
833
840
  }
834
841
  catch (err) {
842
+ session.isRestarting = false; // Reset flag even on failure
835
843
  console.error(' ❌ Failed to restart Claude:', err);
836
844
  await this.mattermost.createPost(`❌ Failed to restart Claude: ${err}`, threadId);
837
845
  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.2",
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",