claude-threads 0.16.2 → 0.16.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 +6 -0
- package/dist/index.js +46 -36
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.16.3] - 2025-12-31
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Build with `--target node` for Node.js compatibility (fixes "__require is not a function" error)
|
|
14
|
+
- Fixed package.json path resolution for bundled builds
|
|
15
|
+
|
|
10
16
|
## [0.16.2] - 2025-12-31
|
|
11
17
|
|
|
12
18
|
### Fixed
|
package/dist/index.js
CHANGED
|
@@ -15189,7 +15189,7 @@ class ClaudeCli extends EventEmitter2 {
|
|
|
15189
15189
|
// src/session/commands.ts
|
|
15190
15190
|
import { randomUUID } from "crypto";
|
|
15191
15191
|
import { resolve as resolve5 } from "path";
|
|
15192
|
-
import { existsSync as
|
|
15192
|
+
import { existsSync as existsSync6, statSync } from "fs";
|
|
15193
15193
|
|
|
15194
15194
|
// node_modules/update-notifier/update-notifier.js
|
|
15195
15195
|
import process10 from "process";
|
|
@@ -18478,18 +18478,43 @@ function updateNotifier(options) {
|
|
|
18478
18478
|
|
|
18479
18479
|
// src/update-notifier.ts
|
|
18480
18480
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
18481
|
-
|
|
18482
|
-
|
|
18481
|
+
|
|
18482
|
+
// src/version.ts
|
|
18483
|
+
import { readFileSync as readFileSync4, existsSync as existsSync4 } from "fs";
|
|
18484
|
+
import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
18483
18485
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
18484
|
-
var __dirname4 = fileURLToPath4(
|
|
18486
|
+
var __dirname4 = dirname3(fileURLToPath4(import.meta.url));
|
|
18487
|
+
function loadPackageJson() {
|
|
18488
|
+
const candidates = [
|
|
18489
|
+
resolve3(__dirname4, "..", "package.json"),
|
|
18490
|
+
resolve3(__dirname4, "..", "..", "package.json"),
|
|
18491
|
+
resolve3(process.cwd(), "package.json")
|
|
18492
|
+
];
|
|
18493
|
+
for (const candidate of candidates) {
|
|
18494
|
+
if (existsSync4(candidate)) {
|
|
18495
|
+
try {
|
|
18496
|
+
const pkg = JSON.parse(readFileSync4(candidate, "utf-8"));
|
|
18497
|
+
if (pkg.name === "claude-threads") {
|
|
18498
|
+
return { version: pkg.version, name: pkg.name };
|
|
18499
|
+
}
|
|
18500
|
+
} catch {}
|
|
18501
|
+
}
|
|
18502
|
+
}
|
|
18503
|
+
return { version: "unknown", name: "claude-threads" };
|
|
18504
|
+
}
|
|
18505
|
+
var pkgInfo = loadPackageJson();
|
|
18506
|
+
var VERSION = pkgInfo.version;
|
|
18507
|
+
var PACKAGE_NAME = pkgInfo.name;
|
|
18508
|
+
var PKG = pkgInfo;
|
|
18509
|
+
|
|
18510
|
+
// src/update-notifier.ts
|
|
18485
18511
|
var cachedUpdateInfo;
|
|
18486
18512
|
function checkForUpdates() {
|
|
18487
18513
|
if (process.env.NO_UPDATE_NOTIFIER)
|
|
18488
18514
|
return;
|
|
18489
18515
|
try {
|
|
18490
|
-
const pkg = JSON.parse(readFileSync4(resolve3(__dirname4, "..", "package.json"), "utf-8"));
|
|
18491
18516
|
const notifier = updateNotifier({
|
|
18492
|
-
pkg,
|
|
18517
|
+
pkg: PKG,
|
|
18493
18518
|
updateCheckInterval: 1000 * 60 * 30
|
|
18494
18519
|
});
|
|
18495
18520
|
cachedUpdateInfo = notifier.update;
|
|
@@ -18511,10 +18536,10 @@ function getUpdateInfo() {
|
|
|
18511
18536
|
}
|
|
18512
18537
|
|
|
18513
18538
|
// src/changelog.ts
|
|
18514
|
-
import { readFileSync as readFileSync5, existsSync as
|
|
18515
|
-
import { dirname as
|
|
18539
|
+
import { readFileSync as readFileSync5, existsSync as existsSync5 } from "fs";
|
|
18540
|
+
import { dirname as dirname4, resolve as resolve4 } from "path";
|
|
18516
18541
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
18517
|
-
var __dirname5 =
|
|
18542
|
+
var __dirname5 = dirname4(fileURLToPath5(import.meta.url));
|
|
18518
18543
|
function getReleaseNotes(version) {
|
|
18519
18544
|
const possiblePaths = [
|
|
18520
18545
|
resolve4(__dirname5, "..", "CHANGELOG.md"),
|
|
@@ -18522,7 +18547,7 @@ function getReleaseNotes(version) {
|
|
|
18522
18547
|
];
|
|
18523
18548
|
let changelogPath = null;
|
|
18524
18549
|
for (const p of possiblePaths) {
|
|
18525
|
-
if (
|
|
18550
|
+
if (existsSync5(p)) {
|
|
18526
18551
|
changelogPath = p;
|
|
18527
18552
|
break;
|
|
18528
18553
|
}
|
|
@@ -18650,11 +18675,6 @@ function printLogo() {
|
|
|
18650
18675
|
}
|
|
18651
18676
|
|
|
18652
18677
|
// src/session/commands.ts
|
|
18653
|
-
import { readFileSync as readFileSync6 } from "fs";
|
|
18654
|
-
import { dirname as dirname4 } from "path";
|
|
18655
|
-
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
18656
|
-
var __dirname6 = dirname4(fileURLToPath6(import.meta.url));
|
|
18657
|
-
var pkg = JSON.parse(readFileSync6(resolve5(__dirname6, "..", "..", "package.json"), "utf-8"));
|
|
18658
18678
|
async function cancelSession(session, username, ctx) {
|
|
18659
18679
|
const shortId = session.threadId.substring(0, 8);
|
|
18660
18680
|
console.log(` \uD83D\uDED1 Session (${shortId}\u2026) cancelled by @${username}`);
|
|
@@ -18681,7 +18701,7 @@ async function changeDirectory(session, newDir, username, ctx) {
|
|
|
18681
18701
|
}
|
|
18682
18702
|
const expandedDir = newDir.startsWith("~") ? newDir.replace("~", process.env.HOME || "") : newDir;
|
|
18683
18703
|
const absoluteDir = resolve5(expandedDir);
|
|
18684
|
-
if (!
|
|
18704
|
+
if (!existsSync6(absoluteDir)) {
|
|
18685
18705
|
await session.platform.createPost(`\u274C Directory does not exist: \`${newDir}\``, session.threadId);
|
|
18686
18706
|
return;
|
|
18687
18707
|
}
|
|
@@ -18856,13 +18876,13 @@ async function updateSessionHeader(session, ctx) {
|
|
|
18856
18876
|
const updateNotice = updateInfo ? `
|
|
18857
18877
|
> \u26A0\uFE0F **Update available:** v${updateInfo.current} \u2192 v${updateInfo.latest} - Run \`npm install -g claude-threads\`
|
|
18858
18878
|
` : "";
|
|
18859
|
-
const releaseNotes = getReleaseNotes(
|
|
18879
|
+
const releaseNotes = getReleaseNotes(VERSION);
|
|
18860
18880
|
const whatsNew = releaseNotes ? getWhatsNewSummary(releaseNotes) : "";
|
|
18861
18881
|
const whatsNewLine = whatsNew ? `
|
|
18862
18882
|
> \u2728 **What's new:** ${whatsNew}
|
|
18863
18883
|
` : "";
|
|
18864
18884
|
const msg = [
|
|
18865
|
-
getLogo(
|
|
18885
|
+
getLogo(VERSION),
|
|
18866
18886
|
updateNotice,
|
|
18867
18887
|
whatsNewLine,
|
|
18868
18888
|
`| | |`,
|
|
@@ -18879,11 +18899,6 @@ async function updateSessionHeader(session, ctx) {
|
|
|
18879
18899
|
|
|
18880
18900
|
// src/session/lifecycle.ts
|
|
18881
18901
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
18882
|
-
import { readFileSync as readFileSync7 } from "fs";
|
|
18883
|
-
import { dirname as dirname5, resolve as resolve6 } from "path";
|
|
18884
|
-
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
18885
|
-
var __dirname7 = dirname5(fileURLToPath7(import.meta.url));
|
|
18886
|
-
var pkg2 = JSON.parse(readFileSync7(resolve6(__dirname7, "..", "..", "package.json"), "utf-8"));
|
|
18887
18902
|
function findPersistedByThreadId(persisted, threadId) {
|
|
18888
18903
|
for (const session of persisted.values()) {
|
|
18889
18904
|
if (session.threadId === threadId) {
|
|
@@ -18910,7 +18925,7 @@ async function startSession(options, username, replyToPostId, platformId, ctx) {
|
|
|
18910
18925
|
}
|
|
18911
18926
|
let post;
|
|
18912
18927
|
try {
|
|
18913
|
-
post = await platform.createPost(`${getLogo(
|
|
18928
|
+
post = await platform.createPost(`${getLogo(VERSION)}
|
|
18914
18929
|
|
|
18915
18930
|
*Starting session...*`, replyToPostId);
|
|
18916
18931
|
} catch (err) {
|
|
@@ -19068,7 +19083,7 @@ async function resumeSession(state, ctx) {
|
|
|
19068
19083
|
try {
|
|
19069
19084
|
claude.start();
|
|
19070
19085
|
console.log(` \uD83D\uDD04 Resumed session ${shortId}... (@${state.startedBy})`);
|
|
19071
|
-
await session.platform.createPost(`\uD83D\uDD04 **Session resumed** after bot restart (v${
|
|
19086
|
+
await session.platform.createPost(`\uD83D\uDD04 **Session resumed** after bot restart (v${VERSION})
|
|
19072
19087
|
*Reconnected to Claude session. You can continue where you left off.*`, state.threadId);
|
|
19073
19088
|
await ctx.updateSessionHeader(session);
|
|
19074
19089
|
ctx.persistSession(session);
|
|
@@ -19241,7 +19256,7 @@ import { randomUUID as randomUUID3 } from "crypto";
|
|
|
19241
19256
|
import * as path9 from "path";
|
|
19242
19257
|
import * as fs5 from "fs/promises";
|
|
19243
19258
|
async function execGit(args, cwd) {
|
|
19244
|
-
return new Promise((
|
|
19259
|
+
return new Promise((resolve6, reject) => {
|
|
19245
19260
|
const proc = spawn3("git", args, { cwd });
|
|
19246
19261
|
let stdout = "";
|
|
19247
19262
|
let stderr = "";
|
|
@@ -19253,7 +19268,7 @@ async function execGit(args, cwd) {
|
|
|
19253
19268
|
});
|
|
19254
19269
|
proc.on("close", (code) => {
|
|
19255
19270
|
if (code === 0) {
|
|
19256
|
-
|
|
19271
|
+
resolve6(stdout.trim());
|
|
19257
19272
|
} else {
|
|
19258
19273
|
reject(new Error(`git ${args.join(" ")} failed: ${stderr || stdout}`));
|
|
19259
19274
|
}
|
|
@@ -20091,15 +20106,10 @@ class SessionManager {
|
|
|
20091
20106
|
}
|
|
20092
20107
|
}
|
|
20093
20108
|
// src/index.ts
|
|
20094
|
-
import { readFileSync as readFileSync8 } from "fs";
|
|
20095
|
-
import { dirname as dirname7, resolve as resolve7 } from "path";
|
|
20096
|
-
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
20097
|
-
var __dirname8 = dirname7(fileURLToPath8(import.meta.url));
|
|
20098
|
-
var pkg3 = JSON.parse(readFileSync8(resolve7(__dirname8, "..", "package.json"), "utf-8"));
|
|
20099
20109
|
var dim2 = (s) => `\x1B[2m${s}\x1B[0m`;
|
|
20100
20110
|
var bold2 = (s) => `\x1B[1m${s}\x1B[0m`;
|
|
20101
20111
|
var cyan = (s) => `\x1B[36m${s}\x1B[0m`;
|
|
20102
|
-
program.name("claude-threads").version(
|
|
20112
|
+
program.name("claude-threads").version(VERSION).description("Share Claude Code sessions in Mattermost").option("--url <url>", "Mattermost server URL").option("--token <token>", "Mattermost bot token").option("--channel <id>", "Mattermost channel ID").option("--bot-name <name>", "Bot mention name (default: claude-code)").option("--allowed-users <users>", "Comma-separated allowed usernames").option("--skip-permissions", "Skip interactive permission prompts").option("--no-skip-permissions", "Enable interactive permission prompts (override env)").option("--chrome", "Enable Claude in Chrome integration").option("--no-chrome", "Disable Claude in Chrome integration").option("--worktree-mode <mode>", "Git worktree mode: off, prompt, require (default: prompt)").option("--setup", "Run interactive setup wizard (reconfigure existing settings)").option("--debug", "Enable debug logging").parse();
|
|
20103
20113
|
var opts = program.opts();
|
|
20104
20114
|
function hasRequiredCliArgs(args) {
|
|
20105
20115
|
return !!(args.url && args.token && args.channel);
|
|
@@ -20141,7 +20151,7 @@ async function main() {
|
|
|
20141
20151
|
}
|
|
20142
20152
|
const config = newConfig;
|
|
20143
20153
|
printLogo();
|
|
20144
|
-
console.log(dim2(` v${
|
|
20154
|
+
console.log(dim2(` v${VERSION}`));
|
|
20145
20155
|
console.log("");
|
|
20146
20156
|
console.log(` \uD83D\uDCC2 ${cyan(workingDir)}`);
|
|
20147
20157
|
console.log(` \uD83D\uDCAC ${cyan("@" + platformConfig.botName)}`);
|
|
@@ -20228,11 +20238,11 @@ async function main() {
|
|
|
20228
20238
|
return;
|
|
20229
20239
|
}
|
|
20230
20240
|
if (lowerContent === "!release-notes" || lowerContent === "!changelog") {
|
|
20231
|
-
const notes = getReleaseNotes(
|
|
20241
|
+
const notes = getReleaseNotes(VERSION);
|
|
20232
20242
|
if (notes) {
|
|
20233
20243
|
await mattermost.createPost(formatReleaseNotes(notes), threadRoot);
|
|
20234
20244
|
} else {
|
|
20235
|
-
await mattermost.createPost(`\uD83D\uDCCB **claude-threads v${
|
|
20245
|
+
await mattermost.createPost(`\uD83D\uDCCB **claude-threads v${VERSION}**
|
|
20236
20246
|
|
|
20237
20247
|
Release notes not available. See [GitHub releases](https://github.com/anneschuth/claude-threads/releases).`, threadRoot);
|
|
20238
20248
|
}
|