slacklocalvibe 0.1.0 → 0.1.2
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 +1 -1
- package/src/cli.js +2 -1
- package/src/commands/notify.js +7 -0
- package/src/lib/notify-input.js +18 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -4,13 +4,14 @@ const { runWizard } = require("./commands/wizard");
|
|
|
4
4
|
const { runNotify } = require("./commands/notify");
|
|
5
5
|
const { runDaemon } = require("./commands/daemon");
|
|
6
6
|
const { runLaunchd } = require("./commands/launchd");
|
|
7
|
+
const packageJson = require("../package.json");
|
|
7
8
|
|
|
8
9
|
const program = new Command();
|
|
9
10
|
|
|
10
11
|
program
|
|
11
12
|
.name("slacklocalvibe")
|
|
12
13
|
.description("SlackLocalVibe: Slack DM通知 + 返信resumeブリッジ")
|
|
13
|
-
.version(
|
|
14
|
+
.version(packageJson.version);
|
|
14
15
|
|
|
15
16
|
program
|
|
16
17
|
.command("notify")
|
package/src/commands/notify.js
CHANGED
|
@@ -68,6 +68,13 @@ async function runNotify({ tool }) {
|
|
|
68
68
|
process.exitCode = 1;
|
|
69
69
|
throw new Error("通知対象のイベントではありません。");
|
|
70
70
|
}
|
|
71
|
+
if (input.skip) {
|
|
72
|
+
log(LEVELS.WARNING, "notify.skip.empty_input_messages", {
|
|
73
|
+
meta: input.meta || {},
|
|
74
|
+
duration_ms: Date.now() - startedAt,
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
71
78
|
|
|
72
79
|
if (!input.session_id) {
|
|
73
80
|
log(LEVELS.ERROR, "notify.session_missing");
|
package/src/lib/notify-input.js
CHANGED
|
@@ -9,6 +9,15 @@ function parseCodexNotify(rawJson) {
|
|
|
9
9
|
const turnId = payload["turn-id"] ? String(payload["turn-id"]) : undefined;
|
|
10
10
|
const inputMessages = payload["input-messages"];
|
|
11
11
|
const meta = buildCodexInputMeta(inputMessages);
|
|
12
|
+
const hasInputMessages = hasNonEmptyInputMessages(inputMessages);
|
|
13
|
+
if (!hasInputMessages) {
|
|
14
|
+
return {
|
|
15
|
+
tool: "codex",
|
|
16
|
+
skip: true,
|
|
17
|
+
skip_reason: "empty_input_messages",
|
|
18
|
+
meta,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
12
21
|
const userText = extractUserTextFromCodex(inputMessages);
|
|
13
22
|
const assistantText = extractAssistantText(payload["last-assistant-message"]);
|
|
14
23
|
const cwd = payload?.cwd ? String(payload.cwd) : "";
|
|
@@ -105,6 +114,15 @@ function normalizeContent(content) {
|
|
|
105
114
|
return extractTextDeep(content);
|
|
106
115
|
}
|
|
107
116
|
|
|
117
|
+
function hasNonEmptyInputMessages(inputMessages) {
|
|
118
|
+
if (!Array.isArray(inputMessages) || inputMessages.length === 0) return false;
|
|
119
|
+
for (const message of inputMessages) {
|
|
120
|
+
const text = normalizeContent(message);
|
|
121
|
+
if (text && String(text).trim()) return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
108
126
|
function parseClaudeHook(rawJson) {
|
|
109
127
|
const payload = JSON.parse(rawJson);
|
|
110
128
|
if (payload?.hook_event_name !== "Stop") {
|