mattermost-claude-code 0.6.0 → 0.6.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.
@@ -215,13 +215,14 @@ export class SessionManager {
215
215
  session.activeSubagents.delete(toolUseId);
216
216
  }
217
217
  catch (err) {
218
- console.error('[Session] Failed to update subagent completion:', err);
218
+ console.error(' ⚠️ Failed to update subagent completion:', err);
219
219
  }
220
220
  }
221
221
  async handleExitPlanMode(session) {
222
222
  // If already approved in this session, auto-continue
223
223
  if (session.planApproved) {
224
- console.log('[Session] Plan already approved, auto-continuing...');
224
+ if (this.debug)
225
+ console.log(' ↪ Plan already approved, auto-continuing');
225
226
  if (session.claude.isRunning()) {
226
227
  session.claude.sendMessage('Continue with the implementation.');
227
228
  this.startTyping(session);
@@ -230,7 +231,8 @@ export class SessionManager {
230
231
  }
231
232
  // If we already have a pending approval, don't post another one
232
233
  if (session.pendingApproval && session.pendingApproval.type === 'plan') {
233
- console.log('[Session] Plan approval already pending, waiting...');
234
+ if (this.debug)
235
+ console.log(' ↪ Plan approval already pending, waiting');
234
236
  return;
235
237
  }
236
238
  // Flush any pending content first
@@ -251,7 +253,7 @@ export class SessionManager {
251
253
  await this.mattermost.addReaction(post.id, '-1');
252
254
  }
253
255
  catch (err) {
254
- console.error('[Session] Failed to add approval reactions:', err);
256
+ console.error(' ⚠️ Failed to add approval reactions:', err);
255
257
  }
256
258
  // Track this for reaction handling
257
259
  session.pendingApproval = { postId: post.id, type: 'plan' };
@@ -267,7 +269,7 @@ export class SessionManager {
267
269
  await this.mattermost.updatePost(session.tasksPostId, '📋 ~~Tasks~~ *(completed)*');
268
270
  }
269
271
  catch (err) {
270
- console.error('[Session] Failed to update tasks:', err);
272
+ console.error(' ⚠️ Failed to update tasks:', err);
271
273
  }
272
274
  }
273
275
  return;
@@ -303,7 +305,7 @@ export class SessionManager {
303
305
  }
304
306
  }
305
307
  catch (err) {
306
- console.error('[Session] Failed to update tasks:', err);
308
+ console.error(' ⚠️ Failed to update tasks:', err);
307
309
  }
308
310
  }
309
311
  async handleTaskStart(session, toolUseId, input) {
@@ -318,13 +320,14 @@ export class SessionManager {
318
320
  session.activeSubagents.set(toolUseId, post.id);
319
321
  }
320
322
  catch (err) {
321
- console.error('[Session] Failed to post subagent status:', err);
323
+ console.error(' ⚠️ Failed to post subagent status:', err);
322
324
  }
323
325
  }
324
326
  async handleAskUserQuestion(session, toolUseId, input) {
325
327
  // If we already have pending questions, don't start another set
326
328
  if (session.pendingQuestionSet) {
327
- console.log('[Session] Questions already pending, waiting...');
329
+ if (this.debug)
330
+ console.log(' ↪ Questions already pending, waiting');
328
331
  return;
329
332
  }
330
333
  // Flush any pending content first
@@ -381,7 +384,7 @@ export class SessionManager {
381
384
  await this.mattermost.addReaction(post.id, REACTION_EMOJIS[i]);
382
385
  }
383
386
  catch (err) {
384
- console.error(`[Session] Failed to add reaction ${REACTION_EMOJIS[i]}:`, err);
387
+ console.error(` ⚠️ Failed to add reaction ${REACTION_EMOJIS[i]}:`, err);
385
388
  }
386
389
  }
387
390
  }
@@ -429,13 +432,14 @@ export class SessionManager {
429
432
  return;
430
433
  const selectedOption = question.options[optionIndex];
431
434
  question.answer = selectedOption.label;
432
- console.log(`[Session] User ${username} answered "${question.header}": ${selectedOption.label}`);
435
+ if (this.debug)
436
+ console.log(` 💬 @${username} answered "${question.header}": ${selectedOption.label}`);
433
437
  // Update the post to show answer
434
438
  try {
435
439
  await this.mattermost.updatePost(postId, `✅ **${question.header}**: ${selectedOption.label}`);
436
440
  }
437
441
  catch (err) {
438
- console.error('[Session] Failed to update answered question:', err);
442
+ console.error(' ⚠️ Failed to update answered question:', err);
439
443
  }
440
444
  // Move to next question or finish
441
445
  session.pendingQuestionSet.currentIndex++;
@@ -449,7 +453,8 @@ export class SessionManager {
449
453
  for (const q of questions) {
450
454
  answersText += `- **${q.header}**: ${q.answer}\n`;
451
455
  }
452
- console.log(`[Session] All questions answered, sending as message:`, answersText);
456
+ if (this.debug)
457
+ console.log(' ✅ All questions answered');
453
458
  // Clear and send as regular message
454
459
  session.pendingQuestionSet = null;
455
460
  if (session.claude.isRunning()) {
@@ -466,7 +471,8 @@ export class SessionManager {
466
471
  if (!isApprove && !isReject)
467
472
  return;
468
473
  const postId = session.pendingApproval.postId;
469
- console.log(`[Session] User ${username} ${isApprove ? 'approved' : 'rejected'} the plan`);
474
+ const shortId = session.threadId.substring(0, 8);
475
+ console.log(` ${isApprove ? '✅' : '❌'} Plan ${isApprove ? 'approved' : 'rejected'} (${shortId}…) by @${username}`);
470
476
  // Update the post to show the decision
471
477
  try {
472
478
  const statusMessage = isApprove
@@ -475,7 +481,7 @@ export class SessionManager {
475
481
  await this.mattermost.updatePost(postId, statusMessage);
476
482
  }
477
483
  catch (err) {
478
- console.error('[Session] Failed to update approval post:', err);
484
+ console.error(' ⚠️ Failed to update approval post:', err);
479
485
  }
480
486
  // Clear pending approval and mark as approved
481
487
  session.pendingApproval = null;
@@ -895,7 +901,7 @@ export class SessionManager {
895
901
  await this.mattermost.updatePost(session.sessionStartPostId, msg);
896
902
  }
897
903
  catch (err) {
898
- console.error('[Session] Failed to update session header:', err);
904
+ console.error(' ⚠️ Failed to update session header:', err);
899
905
  }
900
906
  }
901
907
  /** Request approval for a message from an unauthorized user */
@@ -923,7 +929,7 @@ export class SessionManager {
923
929
  await this.mattermost.addReaction(post.id, '-1');
924
930
  }
925
931
  catch (err) {
926
- console.error('[Session] Failed to add message approval reactions:', err);
932
+ console.error(' ⚠️ Failed to add message approval reactions:', err);
927
933
  }
928
934
  }
929
935
  /** Kill all active sessions (for graceful shutdown) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mattermost-claude-code",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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",