@sma1lboy/kobe 0.6.7 → 0.6.8

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +61 -4
  2. package/package.json +6 -2
package/dist/cli/index.js CHANGED
@@ -70,14 +70,18 @@ var init_package = __esm(() => {
70
70
  package_default = {
71
71
  $schema: "https://json.schemastore.org/package.json",
72
72
  name: "@sma1lboy/kobe",
73
- version: "0.6.7",
73
+ version: "0.6.8",
74
74
  description: "TUI orchestrator for Claude Code (codename)",
75
75
  type: "module",
76
76
  packageManager: "bun@1.3.13",
77
77
  bin: {
78
78
  kobe: "dist/cli/index.js"
79
79
  },
80
- files: ["dist", "README.md", "LICENSE"],
80
+ files: [
81
+ "dist",
82
+ "README.md",
83
+ "LICENSE"
84
+ ],
81
85
  publishConfig: {
82
86
  access: "public"
83
87
  },
@@ -4199,6 +4203,7 @@ __export(exports_client, {
4199
4203
  tmuxArgs: () => tmuxArgs,
4200
4204
  tagPaneRole: () => tagPaneRole,
4201
4205
  tagClaudePane: () => tagClaudePane,
4206
+ switchClientBeforeKill: () => switchClientBeforeKill,
4202
4207
  setWindowOption: () => setWindowOption,
4203
4208
  setSessionOption: () => setSessionOption,
4204
4209
  sessionExists: () => sessionExists,
@@ -4213,6 +4218,7 @@ __export(exports_client, {
4213
4218
  killSession: () => killSession,
4214
4219
  getSessionOptions: () => getSessionOptions,
4215
4220
  getSessionOption: () => getSessionOption,
4221
+ ensureFallbackSession: () => ensureFallbackSession,
4216
4222
  currentSessionName: () => currentSessionName,
4217
4223
  claudePaneIdStrict: () => claudePaneIdStrict,
4218
4224
  claudePaneId: () => claudePaneId,
@@ -4220,6 +4226,7 @@ __export(exports_client, {
4220
4226
  attachArgv: () => attachArgv,
4221
4227
  PANE_ROLE_OPTION: () => PANE_ROLE_OPTION,
4222
4228
  KOBE_TMUX_SOCKET: () => KOBE_TMUX_SOCKET,
4229
+ KOBE_HOME_SESSION: () => KOBE_HOME_SESSION,
4223
4230
  CLAUDE_ROLE_OPTION: () => CLAUDE_ROLE_OPTION
4224
4231
  });
4225
4232
  function tmuxArgs(...args) {
@@ -4394,7 +4401,37 @@ async function killSession(name) {
4394
4401
  if (await sessionExists(name))
4395
4402
  await runTmux(["kill-session", "-t", `=${name}`]);
4396
4403
  }
4397
- var KOBE_TMUX_SOCKET, PANE_ROLE_OPTION = "@kobe_role", CLAUDE_ROLE_OPTION, CLAUDE_ROLE_VALUE = "claude";
4404
+ async function ensureFallbackSession() {
4405
+ const name = KOBE_HOME_SESSION;
4406
+ if (!await sessionExists(name)) {
4407
+ await runTmux([
4408
+ "new-session",
4409
+ "-d",
4410
+ "-s",
4411
+ name,
4412
+ "-x",
4413
+ "220",
4414
+ "-y",
4415
+ "50",
4416
+ "sh",
4417
+ "-c",
4418
+ 'clear; printf "\\n No active task\\n\\n Select a task from the sidebar to continue.\\n\\n"; exec ${SHELL:-sh}'
4419
+ ]);
4420
+ }
4421
+ return name;
4422
+ }
4423
+ async function switchClientBeforeKill(killedName, nextSessionName) {
4424
+ const current = await currentSessionName();
4425
+ if (current !== killedName)
4426
+ return;
4427
+ if (nextSessionName && nextSessionName !== killedName && await sessionExists(nextSessionName)) {
4428
+ await runTmux(["switch-client", "-t", `=${nextSessionName}`]);
4429
+ return;
4430
+ }
4431
+ const fallback = await ensureFallbackSession();
4432
+ await runTmux(["switch-client", "-t", `=${fallback}`]);
4433
+ }
4434
+ var KOBE_TMUX_SOCKET, PANE_ROLE_OPTION = "@kobe_role", CLAUDE_ROLE_OPTION, CLAUDE_ROLE_VALUE = "claude", KOBE_HOME_SESSION = "kobe-home";
4398
4435
  var init_client2 = __esm(() => {
4399
4436
  KOBE_TMUX_SOCKET = process.env.KOBE_TMUX_SOCKET?.trim() || "kobe";
4400
4437
  CLAUDE_ROLE_OPTION = PANE_ROLE_OPTION;
@@ -4518,6 +4555,7 @@ __export(exports_tmux, {
4518
4555
  tmuxSessionName: () => tmuxSessionName,
4519
4556
  tmuxInitialSizeArgs: () => tmuxInitialSizeArgs,
4520
4557
  tmuxAvailable: () => tmuxAvailable,
4558
+ switchClientBeforeKill: () => switchClientBeforeKill,
4521
4559
  sessionExists: () => sessionExists,
4522
4560
  quickCreate: () => quickCreate,
4523
4561
  openUpdateTab: () => openUpdateTab,
@@ -14983,6 +15021,10 @@ function TasksShell(props) {
14983
15021
  try {
14984
15022
  await props.orch.setArchived(id, nextArchived);
14985
15023
  if (nextArchived) {
15024
+ const nextTask = props.tasks().find((t) => t.id !== id && !t.archived);
15025
+ await switchClientBeforeKill(tmuxSessionName(id), nextTask ? tmuxSessionName(nextTask.id) : undefined).catch((err) => {
15026
+ console.error("[kobe tasks] switch-client failed:", err);
15027
+ });
14986
15028
  await killSession(tmuxSessionName(id)).catch((err) => {
14987
15029
  console.error("[kobe tasks] kill tmux session failed:", err);
14988
15030
  });
@@ -15024,6 +15066,10 @@ function TasksShell(props) {
15024
15066
  }
15025
15067
  if (!deleted)
15026
15068
  return;
15069
+ const nextTask = props.tasks().find((t) => t.id !== id && !t.archived);
15070
+ await switchClientBeforeKill(tmuxSessionName(id), nextTask ? tmuxSessionName(nextTask.id) : undefined).catch((err) => {
15071
+ console.error("[kobe tasks] switch-client failed:", err);
15072
+ });
15027
15073
  await killSession(tmuxSessionName(id)).catch((err) => {
15028
15074
  console.error("[kobe tasks] kill tmux session failed:", err);
15029
15075
  });
@@ -20665,8 +20711,19 @@ function Shell(props) {
20665
20711
  HelpDialog.show(dialog);
20666
20712
  }
20667
20713
  async function archiveTask(taskId) {
20668
- await props.orchestrator.setArchived(taskId).catch((err) => {
20714
+ try {
20715
+ await props.orchestrator.setArchived(taskId);
20716
+ } catch (err) {
20669
20717
  console.error("[kobe] archive failed:", err);
20718
+ return;
20719
+ }
20720
+ const sessionName = tmuxSessionName(taskId);
20721
+ const nextTask = tasksAcc().find((t) => t.id !== taskId && !t.archived);
20722
+ await switchClientBeforeKill(sessionName, nextTask ? tmuxSessionName(nextTask.id) : undefined).catch((err) => {
20723
+ console.error("[kobe] switch-client failed:", err);
20724
+ });
20725
+ await killSession(sessionName).catch((err) => {
20726
+ console.error("[kobe] kill tmux session failed:", err);
20670
20727
  });
20671
20728
  }
20672
20729
  async function renameTask(taskId) {
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@sma1lboy/kobe",
4
- "version": "0.6.7",
4
+ "version": "0.6.8",
5
5
  "description": "TUI orchestrator for Claude Code (codename)",
6
6
  "type": "module",
7
7
  "packageManager": "bun@1.3.13",
8
8
  "bin": {
9
9
  "kobe": "dist/cli/index.js"
10
10
  },
11
- "files": ["dist", "README.md", "LICENSE"],
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
12
16
  "publishConfig": {
13
17
  "access": "public"
14
18
  },