claude-threads 1.4.3 → 1.4.4

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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.4.4] - 2026-01-18
9
+
10
+ ### Fixed
11
+ - **Worktree commands in root messages** - `!worktree list` now works without a session, `!worktree branch-name` now starts session without requiring additional prompt (#241)
12
+
8
13
  ## [1.4.3] - 2026-01-18
9
14
 
10
15
  ### Added
package/dist/index.js CHANGED
@@ -54845,7 +54845,11 @@ var handleWorktree = async (ctx, args) => {
54845
54845
  }
54846
54846
  switch (subcommandOrBranch) {
54847
54847
  case "list":
54848
- await ctx.sessionManager.listWorktreesCommand(ctx.threadId, ctx.username);
54848
+ if (ctx.commandContext === "first-message") {
54849
+ await ctx.sessionManager.listWorktreesWithoutSession(ctx.client.platformId, ctx.threadId);
54850
+ } else {
54851
+ await ctx.sessionManager.listWorktreesCommand(ctx.threadId, ctx.username);
54852
+ }
54849
54853
  return { handled: true };
54850
54854
  case "switch":
54851
54855
  if (!subArgs) {
@@ -66183,33 +66187,40 @@ async function switchToWorktree(session, branchOrPath, username, changeDirectory
66183
66187
  session.messageManager?.setWorktreeInfo(target.path, target.branch);
66184
66188
  session.isWorktreeOwner = false;
66185
66189
  }
66186
- async function buildWorktreeListMessage(session) {
66187
- const isRepo = await isGitRepository(session.workingDir);
66190
+ async function buildWorktreeListMessageFromDir(workingDir, formatter, currentWorkingDir) {
66191
+ const isRepo = await isGitRepository(workingDir);
66188
66192
  if (!isRepo) {
66189
- sessionLog3(session).warn(`\uD83C\uDF3F Not a git repository: ${session.workingDir}`);
66190
66193
  return null;
66191
66194
  }
66192
- const repoRoot = session.worktreeInfo?.repoRoot || await getRepositoryRoot(session.workingDir);
66195
+ const repoRoot = await getRepositoryRoot(workingDir);
66193
66196
  const worktrees = await listWorktrees(repoRoot);
66194
66197
  if (worktrees.length === 0) {
66195
- sessionLog3(session).debug(`\uD83C\uDF3F No worktrees found`);
66196
66198
  return "No worktrees found for this repository";
66197
66199
  }
66198
66200
  const shortRepoRoot = repoRoot.replace(process.env.HOME || "", "~");
66199
- const fmt = session.platform.getFormatter();
66200
- let message = `\uD83D\uDCCB ${fmt.formatBold("Worktrees for")} ${fmt.formatCode(shortRepoRoot)}:
66201
+ let message = `\uD83D\uDCCB ${formatter.formatBold("Worktrees for")} ${formatter.formatCode(shortRepoRoot)}:
66201
66202
 
66202
66203
  `;
66203
66204
  for (const wt of worktrees) {
66204
66205
  const shortPath = wt.isMain ? wt.path.replace(process.env.HOME || "", "~") : shortenPath(wt.path, undefined, { path: wt.path, branch: wt.branch });
66205
- const isCurrent = session.workingDir === wt.path;
66206
+ const isCurrent = currentWorkingDir === wt.path;
66206
66207
  const marker = isCurrent ? " ← current" : "";
66207
66208
  const label = wt.isMain ? "(main repository)" : "";
66208
- message += `• ${fmt.formatCode(wt.branch)} → ${fmt.formatCode(shortPath)} ${label}${marker}
66209
+ message += `• ${formatter.formatCode(wt.branch)} → ${formatter.formatCode(shortPath)} ${label}${marker}
66209
66210
  `;
66210
66211
  }
66211
66212
  return message;
66212
66213
  }
66214
+ async function buildWorktreeListMessage(session) {
66215
+ const repoRoot = session.worktreeInfo?.repoRoot;
66216
+ const isRepo = await isGitRepository(session.workingDir);
66217
+ if (!isRepo) {
66218
+ sessionLog3(session).warn(`\uD83C\uDF3F Not a git repository: ${session.workingDir}`);
66219
+ return null;
66220
+ }
66221
+ const workingDirForList = repoRoot || session.workingDir;
66222
+ return buildWorktreeListMessageFromDir(workingDirForList, session.platform.getFormatter(), session.workingDir);
66223
+ }
66213
66224
  async function listWorktreesCommand(session) {
66214
66225
  const message = await buildWorktreeListMessage(session);
66215
66226
  if (message === null) {
@@ -68710,6 +68721,18 @@ class SessionManager extends EventEmitter4 {
68710
68721
  return;
68711
68722
  await listWorktreesCommand(session);
68712
68723
  }
68724
+ async listWorktreesWithoutSession(platformId, threadId) {
68725
+ const platform = this.platforms.get(platformId);
68726
+ if (!platform)
68727
+ return;
68728
+ const formatter = platform.getFormatter();
68729
+ const message = await buildWorktreeListMessageFromDir(this.workingDir, formatter, this.workingDir);
68730
+ if (message === null) {
68731
+ await platform.createPost(`❌ Current directory is not a git repository`, threadId);
68732
+ return;
68733
+ }
68734
+ await platform.createPost(message, threadId);
68735
+ }
68713
68736
  async removeWorktreeCommand(threadId, branchOrPath, username) {
68714
68737
  const session = this.findSessionByThreadId(threadId);
68715
68738
  if (!session)
@@ -79485,7 +79508,7 @@ async function handleMessage(client, session, post2, user, options2) {
79485
79508
  prompt = prompt.replace(/on branch\s+\S+/i, "").trim();
79486
79509
  }
79487
79510
  }
79488
- if (!prompt.trim() && !files?.length) {
79511
+ if (!prompt.trim() && !files?.length && !worktreeBranch) {
79489
79512
  await client.createPost(`Mention me with your request`, threadRoot);
79490
79513
  return;
79491
79514
  }
@@ -38568,7 +38568,11 @@ var handleWorktree = async (ctx, args) => {
38568
38568
  }
38569
38569
  switch (subcommandOrBranch) {
38570
38570
  case "list":
38571
- await ctx.sessionManager.listWorktreesCommand(ctx.threadId, ctx.username);
38571
+ if (ctx.commandContext === "first-message") {
38572
+ await ctx.sessionManager.listWorktreesWithoutSession(ctx.client.platformId, ctx.threadId);
38573
+ } else {
38574
+ await ctx.sessionManager.listWorktreesCommand(ctx.threadId, ctx.username);
38575
+ }
38572
38576
  return { handled: true };
38573
38577
  case "switch":
38574
38578
  if (!subArgs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-threads",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
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",