slacklocalvibe 0.1.3 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slacklocalvibe",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "SlackLocalVibe: Codex/Claude Code turn notifications and reply→resume bridge for Slack DM (Socket Mode)",
5
5
  "bin": {
6
6
  "slacklocalvibe": "src/cli.js"
@@ -69,7 +69,8 @@ async function runNotify({ tool }) {
69
69
  throw new Error("通知対象のイベントではありません。");
70
70
  }
71
71
  if (input.skip) {
72
- log(LEVELS.WARNING, "notify.skip.empty_input_messages", {
72
+ const reason = input.skip_reason || "unknown";
73
+ log(LEVELS.WARNING, `notify.skip.${reason}`, {
73
74
  meta: input.meta || {},
74
75
  duration_ms: Date.now() - startedAt,
75
76
  });
@@ -109,7 +109,7 @@ async function runWizard() {
109
109
  { title: "アップデートを確認する", value: "update" },
110
110
  { title: "テストから始める", value: "test" },
111
111
  { title: "リセットして最初からセットアップ", value: "reset" },
112
- { title: "終了(保存せず終了)", value: "exit" },
112
+ { title: "終了", value: "exit" },
113
113
  ],
114
114
  initial: 0,
115
115
  });
@@ -137,7 +137,7 @@ async function runWizard() {
137
137
  choices: [
138
138
  { title: "アップデートする", value: "update" },
139
139
  { title: "戻る", value: "back" },
140
- { title: "終了(保存せず終了)", value: "exit" },
140
+ { title: "終了", value: "exit" },
141
141
  ],
142
142
  initial: 0,
143
143
  });
@@ -202,7 +202,7 @@ async function runWizard() {
202
202
  message: "次の操作を選んでください",
203
203
  choices: [
204
204
  { title: "リセットして最初から", value: "reset" },
205
- { title: "終了(保存せず終了)", value: "exit" },
205
+ { title: "終了", value: "exit" },
206
206
  ],
207
207
  });
208
208
  if (next === "reset") {
@@ -404,7 +404,7 @@ async function stepReplySetup({ log }) {
404
404
  message: "次の操作を選んでください",
405
405
  choices: [
406
406
  { title: "npm i -g slacklocalvibe で登録する(必須)", value: "install" },
407
- { title: "終了(保存せず終了)", value: "exit" },
407
+ { title: "終了", value: "exit" },
408
408
  ],
409
409
  initial: 0,
410
410
  });
@@ -467,7 +467,7 @@ async function stepNotifyTest({ log, botToken, dmConfig }) {
467
467
  choices: [
468
468
  { title: "Bot Token を再入力する", value: "retry_token" },
469
469
  { title: "送信先(DM)を見直す", value: "retry_dm" },
470
- { title: "終了(保存せず終了)", value: "exit" },
470
+ { title: "終了", value: "exit" },
471
471
  ],
472
472
  });
473
473
  if (choice === "retry_token") {
@@ -527,7 +527,7 @@ async function stepCodexConfig({ log }) {
527
527
  message: "Codex設定の更新に失敗しました。次の操作を選んでください",
528
528
  choices: [
529
529
  { title: "再試行", value: "retry" },
530
- { title: "終了(保存せず終了)", value: "exit" },
530
+ { title: "終了", value: "exit" },
531
531
  ],
532
532
  });
533
533
  if (next === "retry") continue;
@@ -561,7 +561,7 @@ async function stepClaudeConfig({ log }) {
561
561
  message: "Claude設定の更新に失敗しました。次の操作を選んでください",
562
562
  choices: [
563
563
  { title: "再試行", value: "retry" },
564
- { title: "終了(保存せず終了)", value: "exit" },
564
+ { title: "終了", value: "exit" },
565
565
  ],
566
566
  });
567
567
  if (next === "retry") continue;
@@ -596,7 +596,7 @@ async function stepDeliveryConfirmation({ log, stage }) {
596
596
  choices: [
597
597
  { title: "届いたので次へ進む", value: "ok" },
598
598
  { title: "届いていないのでログを表示する", value: "logs" },
599
- { title: "終了(保存せず終了)", value: "exit" },
599
+ { title: "終了", value: "exit" },
600
600
  ],
601
601
  });
602
602
  if (choice === "ok") {
@@ -709,7 +709,7 @@ async function runTestCommand({ log, tool }) {
709
709
  message: "次の操作を選んでください",
710
710
  choices: [
711
711
  { title: "再試行", value: "retry" },
712
- { title: "終了(保存せず終了)", value: "exit" },
712
+ { title: "終了", value: "exit" },
713
713
  ],
714
714
  });
715
715
  if (next === "retry") continue;
@@ -727,7 +727,7 @@ async function stepLaunchd({ log }) {
727
727
  choices: [
728
728
  { title: "launchd に登録する(推奨)", value: "install" },
729
729
  { title: "スキップして次へ進む", value: "skip" },
730
- { title: "終了(保存せず終了)", value: "exit" },
730
+ { title: "終了", value: "exit" },
731
731
  ],
732
732
  initial: 0,
733
733
  });
@@ -763,7 +763,7 @@ async function stepLaunchd({ log }) {
763
763
  choices: [
764
764
  { title: "再試行", value: "retry" },
765
765
  { title: "スキップして次へ進む", value: "skip" },
766
- { title: "終了(保存せず終了)", value: "exit" },
766
+ { title: "終了", value: "exit" },
767
767
  ],
768
768
  });
769
769
  if (next === "retry") continue;
@@ -974,7 +974,7 @@ async function copyManifestToClipboard({ log }) {
974
974
  message: "次の操作を選んでください",
975
975
  choices: [
976
976
  { title: "再試行", value: "retry" },
977
- { title: "終了(保存せず終了)", value: "exit" },
977
+ { title: "終了", value: "exit" },
978
978
  ],
979
979
  });
980
980
  if (next === "retry") continue;
@@ -1116,7 +1116,7 @@ async function ensureGlobalInstall({ log }) {
1116
1116
  message: "次の操作を選んでください",
1117
1117
  choices: [
1118
1118
  { title: "再試行", value: "retry" },
1119
- { title: "終了(保存せず終了)", value: "exit" },
1119
+ { title: "終了", value: "exit" },
1120
1120
  ],
1121
1121
  });
1122
1122
  if (next === "retry") continue;
@@ -1195,7 +1195,7 @@ async function promptLaunchdReinstall({ log, recommended }) {
1195
1195
  choices: [
1196
1196
  { title, value: "install" },
1197
1197
  { title: "あとでやる", value: "skip" },
1198
- { title: "終了(保存せず終了)", value: "exit" },
1198
+ { title: "終了", value: "exit" },
1199
1199
  ],
1200
1200
  initial: 0,
1201
1201
  });
@@ -1230,7 +1230,7 @@ async function promptLaunchdReinstall({ log, recommended }) {
1230
1230
  choices: [
1231
1231
  { title: "再試行", value: "retry" },
1232
1232
  { title: "あとでやる", value: "skip" },
1233
- { title: "終了(保存せず終了)", value: "exit" },
1233
+ { title: "終了", value: "exit" },
1234
1234
  ],
1235
1235
  });
1236
1236
  if (next === "retry") continue;
@@ -11,7 +11,17 @@ function parseCodexNotify(rawJson) {
11
11
  const turnId = payload["turn-id"] ? String(payload["turn-id"]) : undefined;
12
12
  const inputMessages = payload["input-messages"];
13
13
  const meta = buildCodexInputMeta(inputMessages);
14
- const rolloutResult = readCodexUserMessageFromRollout(sessionId);
14
+ const codexHomeInfo = resolveCodexHomeInfo();
15
+ Object.assign(meta, codexHomeInfo.meta || {});
16
+ if (codexHomeInfo.isDefault) {
17
+ return {
18
+ tool: "codex",
19
+ skip: true,
20
+ skip_reason: "codex_home_default",
21
+ meta,
22
+ };
23
+ }
24
+ const rolloutResult = readCodexUserMessageFromRollout(sessionId, codexHomeInfo.home);
15
25
  Object.assign(meta, rolloutResult.meta || {});
16
26
  const userText = rolloutResult.userText || "";
17
27
  const assistantText = extractAssistantText(payload["last-assistant-message"]);
@@ -68,7 +78,7 @@ function extractAssistantText(content) {
68
78
  return normalizeContent(content);
69
79
  }
70
80
 
71
- function readCodexUserMessageFromRollout(sessionId) {
81
+ function readCodexUserMessageFromRollout(sessionId, codexHome) {
72
82
  const meta = {
73
83
  codex_rollout_found: false,
74
84
  codex_rollout_source: "",
@@ -79,7 +89,7 @@ function readCodexUserMessageFromRollout(sessionId) {
79
89
  codex_rollout_line_count: 0,
80
90
  codex_rollout_error: "",
81
91
  };
82
- const rolloutPath = findCodexRolloutPath(sessionId, meta);
92
+ const rolloutPath = findCodexRolloutPath(sessionId, meta, codexHome);
83
93
  if (!rolloutPath) {
84
94
  return { userText: "", meta };
85
95
  }
@@ -129,12 +139,13 @@ function extractCodexUserMessage(payload) {
129
139
  return normalizeContent(content);
130
140
  }
131
141
 
132
- function findCodexRolloutPath(sessionId, meta) {
142
+ function findCodexRolloutPath(sessionId, meta, codexHome) {
133
143
  if (!sessionId) {
134
144
  meta.codex_rollout_error = "session_id_missing";
135
145
  return "";
136
146
  }
137
- const sessionsDir = path.join(os.homedir(), ".codex", "sessions");
147
+ const baseHome = codexHome || path.join(os.homedir(), ".codex");
148
+ const sessionsDir = path.join(baseHome, "sessions");
138
149
  meta.codex_sessions_dir = sessionsDir;
139
150
  if (!fs.existsSync(sessionsDir)) {
140
151
  meta.codex_rollout_error = "sessions_dir_missing";
@@ -239,6 +250,38 @@ function findRolloutByContent(files, sessionId, meta) {
239
250
  return null;
240
251
  }
241
252
 
253
+ function resolveCodexHomeInfo() {
254
+ const defaultHome = path.join(os.homedir(), ".codex");
255
+ const defaultResolved = path.resolve(defaultHome);
256
+ const envHome = process.env.CODEX_HOME;
257
+ if (!envHome) {
258
+ return {
259
+ home: defaultResolved,
260
+ isDefault: true,
261
+ isSet: false,
262
+ meta: {
263
+ codex_home: defaultResolved,
264
+ codex_home_default: defaultResolved,
265
+ codex_home_is_default: true,
266
+ codex_home_set: false,
267
+ },
268
+ };
269
+ }
270
+ const resolved = path.resolve(envHome);
271
+ const isDefault = resolved === defaultResolved;
272
+ return {
273
+ home: resolved,
274
+ isDefault,
275
+ isSet: true,
276
+ meta: {
277
+ codex_home: resolved,
278
+ codex_home_default: defaultResolved,
279
+ codex_home_is_default: isDefault,
280
+ codex_home_set: true,
281
+ },
282
+ };
283
+ }
284
+
242
285
  function extractTextDeep(value, depth = 0) {
243
286
  if (depth > 6) return "";
244
287
  if (value === null || value === undefined) return "";