cc-hooks-ts 0.0.2 → 0.0.3
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/README.md +4 -2
- package/dist/index.mjs +2 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,11 +24,13 @@ With Bun:
|
|
|
24
24
|
#!/usr/bin/env -S bun run --silent
|
|
25
25
|
import { defineHook, runHook } from "cc-hooks-ts";
|
|
26
26
|
|
|
27
|
+
// Session start hook
|
|
27
28
|
const sessionHook = defineHook({
|
|
28
29
|
trigger: { SessionStart: true },
|
|
29
30
|
run: (context) => {
|
|
31
|
+
// do something great
|
|
30
32
|
return context.success({
|
|
31
|
-
messageForUser: "
|
|
33
|
+
messageForUser: "Welcome to your coding session!"
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
});
|
|
@@ -46,7 +48,7 @@ import { defineHook, runHook } from "npm:cc-hooks-ts";
|
|
|
46
48
|
const sessionHook = defineHook({
|
|
47
49
|
trigger: { SessionStart: true },
|
|
48
50
|
run: (context) => {
|
|
49
|
-
|
|
51
|
+
// do something great
|
|
50
52
|
return context.success({
|
|
51
53
|
messageForUser: "Welcome to your coding session!"
|
|
52
54
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -103,10 +103,8 @@ function handleHookResult(eventName, hookResult) {
|
|
|
103
103
|
switch (hookResult.kind) {
|
|
104
104
|
case "success":
|
|
105
105
|
if (eventName === "UserPromptSubmit" || eventName === "SessionStart") {
|
|
106
|
-
if (isNonEmptyString(hookResult.payload.additionalClaudeContext))
|
|
107
|
-
|
|
108
|
-
return process.exit(0);
|
|
109
|
-
}
|
|
106
|
+
if (isNonEmptyString(hookResult.payload.additionalClaudeContext)) console.log(hookResult.payload.additionalClaudeContext);
|
|
107
|
+
return process.exit(0);
|
|
110
108
|
}
|
|
111
109
|
if (isNonEmptyString(hookResult.payload.messageForUser)) console.log(hookResult.payload.messageForUser);
|
|
112
110
|
return process.exit(0);
|