@jmylchreest/aide-plugin 0.1.1 → 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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/skills/reflect/SKILL.md +24 -8
  3. package/src/cli/codex-config.ts +15 -0
  4. package/src/core/context-pruning/dedup.ts +7 -2
  5. package/src/core/context-pruning/tracker.ts +0 -23
  6. package/src/core/memory-query.ts +63 -0
  7. package/src/core/partial-memory.ts +23 -105
  8. package/src/core/session-checkpoint-logic.ts +170 -0
  9. package/src/core/session-resume-logic.ts +104 -0
  10. package/src/core/session-summary-logic.ts +16 -41
  11. package/src/core/session-text.ts +60 -0
  12. package/src/core/tool-observe.ts +53 -14
  13. package/src/hooks/agent-cleanup.ts +11 -28
  14. package/src/hooks/agent-signals.ts +11 -18
  15. package/src/hooks/comment-checker.ts +14 -31
  16. package/src/hooks/context-guard.ts +17 -31
  17. package/src/hooks/context-pruning.ts +13 -30
  18. package/src/hooks/hud-updater.ts +11 -29
  19. package/src/hooks/permission-handler.ts +14 -25
  20. package/src/hooks/persistence.ts +15 -31
  21. package/src/hooks/pre-compact.ts +52 -38
  22. package/src/hooks/pre-tool-enforcer.ts +14 -30
  23. package/src/hooks/reflect.ts +15 -8
  24. package/src/hooks/search-enrichment.ts +12 -29
  25. package/src/hooks/session-end.ts +60 -11
  26. package/src/hooks/session-start.ts +68 -30
  27. package/src/hooks/session-summary.ts +11 -27
  28. package/src/hooks/skill-injector.ts +15 -30
  29. package/src/hooks/subagent-tracker.ts +44 -39
  30. package/src/hooks/task-completed.ts +6 -9
  31. package/src/hooks/tool-observe.ts +27 -32
  32. package/src/hooks/tool-tracker.ts +11 -28
  33. package/src/hooks/write-guard.ts +12 -29
  34. package/src/lib/hook-utils.ts +48 -0
  35. package/src/lib/project-root.ts +30 -15
@@ -9,10 +9,14 @@
9
9
  */
10
10
 
11
11
  import { Logger, debug } from "../lib/logger.js";
12
- import { readStdin } from "../lib/hook-utils.js";
12
+ import {
13
+ readStdin,
14
+ emitHookResult,
15
+ installHookSafetyNet,
16
+ findAideBinary,
17
+ } from "../lib/hook-utils.js";
13
18
 
14
19
  const SOURCE = "hud-updater";
15
- import { findAideBinary } from "../core/aide-client.js";
16
20
  import { updateToolStats } from "../core/tool-tracking.js";
17
21
  import { storePartialMemory } from "../core/partial-memory.js";
18
22
  import {
@@ -49,7 +53,7 @@ async function main(): Promise<void> {
49
53
  try {
50
54
  const input = await readStdin();
51
55
  if (!input.trim()) {
52
- console.log(JSON.stringify({ continue: true }));
56
+ emitHookResult({ continue: true });
53
57
  return;
54
58
  }
55
59
 
@@ -69,11 +73,7 @@ async function main(): Promise<void> {
69
73
  // Update session state (per-agent tracking) — delegates to core
70
74
  if (toolName) {
71
75
  log.start("updateSessionState");
72
- const binary = findAideBinary({
73
- cwd,
74
- pluginRoot:
75
- process.env.AIDE_PLUGIN_ROOT || process.env.CLAUDE_PLUGIN_ROOT,
76
- });
76
+ const binary = findAideBinary(cwd);
77
77
  if (binary) {
78
78
  updateToolStats(binary, cwd, toolName, agentId);
79
79
 
@@ -86,7 +86,6 @@ async function main(): Promise<void> {
86
86
  description: data.tool_input?.description,
87
87
  success: data.tool_result?.success,
88
88
  });
89
-
90
89
  }
91
90
  log.end("updateSessionState");
92
91
  }
@@ -125,33 +124,16 @@ async function main(): Promise<void> {
125
124
  log.flush();
126
125
 
127
126
  // Always continue
128
- console.log(JSON.stringify({ continue: true }));
127
+ emitHookResult({ continue: true });
129
128
  } catch (error) {
130
129
  if (log) {
131
130
  log.error("HUD update failed", error);
132
131
  log.flush();
133
132
  }
134
- console.log(JSON.stringify({ continue: true }));
133
+ emitHookResult({ continue: true });
135
134
  }
136
135
  }
137
136
 
138
- process.on("uncaughtException", (err) => {
139
- debug(SOURCE, `UNCAUGHT EXCEPTION: ${err}`);
140
- try {
141
- console.log(JSON.stringify({ continue: true }));
142
- } catch {
143
- console.log('{"continue":true}');
144
- }
145
- process.exit(0);
146
- });
147
- process.on("unhandledRejection", (reason) => {
148
- debug(SOURCE, `UNHANDLED REJECTION: ${reason}`);
149
- try {
150
- console.log(JSON.stringify({ continue: true }));
151
- } catch {
152
- console.log('{"continue":true}');
153
- }
154
- process.exit(0);
155
- });
137
+ installHookSafetyNet(SOURCE);
156
138
 
157
139
  main();
@@ -20,7 +20,13 @@
20
20
  * - { continue: true } to show normal permission prompt
21
21
  */
22
22
 
23
- import { readStdin, findAideBinary, runAide } from "../lib/hook-utils.js";
23
+ import {
24
+ readStdin,
25
+ findAideBinary,
26
+ runAide,
27
+ emitHookResult,
28
+ installHookSafetyNet,
29
+ } from "../lib/hook-utils.js";
24
30
  import { sanitizeForLog } from "../core/aide-client.js";
25
31
  import { debug } from "../lib/logger.js";
26
32
 
@@ -106,7 +112,7 @@ async function main(): Promise<void> {
106
112
  try {
107
113
  const input = await readStdin();
108
114
  if (!input.trim()) {
109
- console.log(JSON.stringify({ continue: true }));
115
+ emitHookResult({ continue: true });
110
116
  return;
111
117
  }
112
118
 
@@ -114,7 +120,7 @@ async function main(): Promise<void> {
114
120
 
115
121
  // Only handle Bash permissions
116
122
  if (data.tool_name !== "Bash" || !data.tool_input?.command) {
117
- console.log(JSON.stringify({ continue: true }));
123
+ emitHookResult({ continue: true });
118
124
  return;
119
125
  }
120
126
 
@@ -129,7 +135,7 @@ async function main(): Promise<void> {
129
135
  reason:
130
136
  "This command has been blocked for safety. It matches a dangerous pattern.",
131
137
  };
132
- console.log(JSON.stringify(response));
138
+ emitHookResult(response);
133
139
  return;
134
140
  }
135
141
 
@@ -139,35 +145,18 @@ async function main(): Promise<void> {
139
145
  const response: PermissionResponse = {
140
146
  allow: true,
141
147
  };
142
- console.log(JSON.stringify(response));
148
+ emitHookResult(response);
143
149
  return;
144
150
  }
145
151
 
146
152
  // Default: show normal permission prompt
147
- console.log(JSON.stringify({ continue: true }));
153
+ emitHookResult({ continue: true });
148
154
  } catch (error) {
149
155
  debug(SOURCE, `Hook error: ${error}`);
150
- console.log(JSON.stringify({ continue: true }));
156
+ emitHookResult({ continue: true });
151
157
  }
152
158
  }
153
159
 
154
- process.on("uncaughtException", (err) => {
155
- debug(SOURCE, `UNCAUGHT EXCEPTION: ${err}`);
156
- try {
157
- console.log(JSON.stringify({ continue: true }));
158
- } catch {
159
- console.log('{"continue":true}');
160
- }
161
- process.exit(0);
162
- });
163
- process.on("unhandledRejection", (reason) => {
164
- debug(SOURCE, `UNHANDLED REJECTION: ${reason}`);
165
- try {
166
- console.log(JSON.stringify({ continue: true }));
167
- } catch {
168
- console.log('{"continue":true}');
169
- }
170
- process.exit(0);
171
- });
160
+ installHookSafetyNet(SOURCE);
172
161
 
173
162
  main();
@@ -6,8 +6,12 @@
6
6
  * Checks for active modes (autopilot) via aide-memory state.
7
7
  */
8
8
 
9
- import { readStdin } from "../lib/hook-utils.js";
10
- import { findAideBinary } from "../core/aide-client.js";
9
+ import {
10
+ readStdin,
11
+ emitHookResult,
12
+ installHookSafetyNet,
13
+ findAideBinary,
14
+ } from "../lib/hook-utils.js";
11
15
  import { checkPersistence } from "../core/persistence-logic.js";
12
16
  import { debug } from "../lib/logger.js";
13
17
 
@@ -31,7 +35,7 @@ async function main(): Promise<void> {
31
35
  try {
32
36
  const input = await readStdin();
33
37
  if (!input.trim()) {
34
- console.log(JSON.stringify({}));
38
+ emitHookResult({});
35
39
  return;
36
40
  }
37
41
 
@@ -39,23 +43,19 @@ async function main(): Promise<void> {
39
43
  const cwd = data.cwd || process.cwd();
40
44
 
41
45
  if (data.stop_hook_active) {
42
- console.log(JSON.stringify({}));
46
+ emitHookResult({});
43
47
  return;
44
48
  }
45
49
 
46
- const binary = findAideBinary({
47
- cwd,
48
- pluginRoot:
49
- process.env.AIDE_PLUGIN_ROOT || process.env.CLAUDE_PLUGIN_ROOT,
50
- });
50
+ const binary = findAideBinary(cwd);
51
51
  if (!binary) {
52
- console.log(JSON.stringify({}));
52
+ emitHookResult({});
53
53
  return;
54
54
  }
55
55
 
56
56
  const result = checkPersistence(binary, cwd, data.session_id);
57
57
  if (!result) {
58
- console.log(JSON.stringify({}));
58
+ emitHookResult({});
59
59
  return;
60
60
  }
61
61
 
@@ -64,30 +64,14 @@ async function main(): Promise<void> {
64
64
  reason: result.reason,
65
65
  };
66
66
 
67
- console.log(JSON.stringify(output));
67
+ emitHookResult(output);
68
68
  } catch (err) {
69
69
  debug(SOURCE, `Hook error: ${err}`);
70
- console.log(JSON.stringify({}));
70
+ emitHookResult({});
71
71
  }
72
72
  }
73
73
 
74
- process.on("uncaughtException", (err) => {
75
- debug(SOURCE, `UNCAUGHT EXCEPTION: ${err}`);
76
- try {
77
- console.log(JSON.stringify({}));
78
- } catch {
79
- console.log("{}");
80
- }
81
- process.exit(0);
82
- });
83
- process.on("unhandledRejection", (reason) => {
84
- debug(SOURCE, `UNHANDLED REJECTION: ${reason}`);
85
- try {
86
- console.log(JSON.stringify({}));
87
- } catch {
88
- console.log("{}");
89
- }
90
- process.exit(0);
91
- });
74
+ // This Stop hook emits {} (not {continue:true}) as its neutral result.
75
+ installHookSafetyNet(SOURCE, {});
92
76
 
93
77
  main();
@@ -10,8 +10,12 @@
10
10
  * - summary_prompt (the prompt used for summarization)
11
11
  */
12
12
 
13
- import { readStdin } from "../lib/hook-utils.js";
14
- import { findAideBinary } from "../core/aide-client.js";
13
+ import {
14
+ readStdin,
15
+ emitHookResult,
16
+ installHookSafetyNet,
17
+ findAideBinary,
18
+ } from "../lib/hook-utils.js";
15
19
  import { saveStateSnapshot as coreSaveStateSnapshot } from "../core/pre-compact-logic.js";
16
20
  import {
17
21
  buildSessionSummaryFromState,
@@ -22,7 +26,13 @@ import {
22
26
  gatherPartials,
23
27
  buildSummaryFromPartials,
24
28
  } from "../core/partial-memory.js";
29
+ import {
30
+ buildSessionCheckpoint,
31
+ getTaskTree,
32
+ getGitLiveState,
33
+ } from "../core/session-checkpoint-logic.js";
25
34
  import { debug } from "../lib/logger.js";
35
+ import { recordObserveEvent } from "../core/read-tracking.js";
26
36
 
27
37
  const SOURCE = "pre-compact";
28
38
 
@@ -37,7 +47,7 @@ async function main(): Promise<void> {
37
47
  try {
38
48
  const input = await readStdin();
39
49
  if (!input.trim()) {
40
- console.log(JSON.stringify({ continue: true }));
50
+ emitHookResult();
41
51
  return;
42
52
  }
43
53
 
@@ -46,12 +56,18 @@ async function main(): Promise<void> {
46
56
  const sessionId = data.session_id || "unknown";
47
57
 
48
58
  // Save state snapshot before compaction — delegates to core
49
- const binary = findAideBinary({
50
- cwd,
51
- pluginRoot:
52
- process.env.AIDE_PLUGIN_ROOT || process.env.CLAUDE_PLUGIN_ROOT,
53
- });
59
+ const binary = findAideBinary(cwd);
54
60
  if (binary) {
61
+ // Emit a lifecycle trigger so PreCompact is traceable in the dashboard,
62
+ // symmetric with session-start and subagent-start/stop.
63
+ recordObserveEvent(binary, cwd, {
64
+ kind: "session",
65
+ name: "pre-compact",
66
+ category: "lifecycle",
67
+ subtype: (data as { trigger?: string }).trigger || "compact",
68
+ session: sessionId,
69
+ });
70
+
55
71
  coreSaveStateSnapshot(binary, cwd, sessionId);
56
72
 
57
73
  // Persist a session summary as a memory before context is compacted.
@@ -59,16 +75,33 @@ async function main(): Promise<void> {
59
75
  // Uses partials (if available) for a richer summary, falling back to git-only.
60
76
  try {
61
77
  const partials = gatherPartials(binary, cwd, sessionId);
78
+ const commits = getSessionCommits(cwd);
62
79
  let summary: string | null = null;
80
+ // `checkpoint` tag marks the richest, structured snapshot so the
81
+ // session-start resume path can find it; `partial` keeps it out of
82
+ // normal recall and lets the session-end summary supersede it.
83
+ let tags = `partial,session-summary,session:${sessionId}`;
63
84
 
64
85
  if (partials.length > 0) {
65
- // Build from partials + git data
66
- const commits = getSessionCommits(cwd);
67
- summary = buildSummaryFromPartials(partials, commits, []);
68
- debug(
69
- SOURCE,
70
- `Built pre-compact summary from ${partials.length} partials`,
71
- );
86
+ // Structured checkpoint: pulls task tree + live git state from aide's
87
+ // own stores in addition to the partial roll-up. No LLM needed.
88
+ summary = buildSessionCheckpoint({
89
+ sessionId,
90
+ partials,
91
+ commits,
92
+ taskTree: getTaskTree(binary, cwd),
93
+ liveState: getGitLiveState(cwd),
94
+ });
95
+ if (summary) {
96
+ tags = `partial,checkpoint,session-summary,session:${sessionId}`;
97
+ debug(
98
+ SOURCE,
99
+ `Built structured checkpoint from ${partials.length} partials`,
100
+ );
101
+ } else {
102
+ // Defensive: partials present but checkpoint empty — fall back.
103
+ summary = buildSummaryFromPartials(partials, commits, []);
104
+ }
72
105
  }
73
106
 
74
107
  // Fall back to state-only summary if no partials
@@ -77,8 +110,6 @@ async function main(): Promise<void> {
77
110
  }
78
111
 
79
112
  if (summary) {
80
- // Tag as partial so the session-end summary supersedes it
81
- const tags = `partial,session-summary,session:${sessionId}`;
82
113
  (await import("child_process")).execFileSync(
83
114
  binary,
84
115
  ["memory", "add", "--category=session", `--tags=${tags}`, summary],
@@ -86,7 +117,7 @@ async function main(): Promise<void> {
86
117
  );
87
118
  debug(
88
119
  SOURCE,
89
- `Saved pre-compaction partial session summary for ${sessionId.slice(0, 8)}`,
120
+ `Saved pre-compaction checkpoint for ${sessionId.slice(0, 8)}`,
90
121
  );
91
122
  }
92
123
  } catch (err) {
@@ -98,30 +129,13 @@ async function main(): Promise<void> {
98
129
  }
99
130
 
100
131
  // Always allow compaction to continue
101
- console.log(JSON.stringify({ continue: true }));
132
+ emitHookResult();
102
133
  } catch (error) {
103
134
  debug(SOURCE, `Hook error: ${error}`);
104
- console.log(JSON.stringify({ continue: true }));
135
+ emitHookResult();
105
136
  }
106
137
  }
107
138
 
108
- process.on("uncaughtException", (err) => {
109
- debug(SOURCE, `UNCAUGHT EXCEPTION: ${err}`);
110
- try {
111
- console.log(JSON.stringify({ continue: true }));
112
- } catch {
113
- console.log('{"continue":true}');
114
- }
115
- process.exit(0);
116
- });
117
- process.on("unhandledRejection", (reason) => {
118
- debug(SOURCE, `UNHANDLED REJECTION: ${reason}`);
119
- try {
120
- console.log(JSON.stringify({ continue: true }));
121
- } catch {
122
- console.log('{"continue":true}');
123
- }
124
- process.exit(0);
125
- });
139
+ installHookSafetyNet(SOURCE);
126
140
 
127
141
  main();
@@ -10,10 +10,15 @@
10
10
  * Core logic is in src/core/tool-enforcement.ts for cross-platform reuse.
11
11
  */
12
12
 
13
- import { readStdin } from "../lib/hook-utils.js";
13
+ import {
14
+ readStdin,
15
+ emitHookResult,
16
+ installHookSafetyNet,
17
+ findAideBinary,
18
+ } from "../lib/hook-utils.js";
14
19
  import { debug } from "../lib/logger.js";
15
20
  import { evaluateToolUse } from "../core/tool-enforcement.js";
16
- import { findAideBinary, getState } from "../core/aide-client.js";
21
+ import { getState } from "../core/aide-client.js";
17
22
  import { emitInjectionEvent } from "../core/read-tracking.js";
18
23
 
19
24
  const SOURCE = "pre-tool-enforcer";
@@ -42,7 +47,7 @@ async function main(): Promise<void> {
42
47
  try {
43
48
  const input = await readStdin();
44
49
  if (!input.trim()) {
45
- console.log(JSON.stringify({ continue: true }));
50
+ emitHookResult({ continue: true });
46
51
  return;
47
52
  }
48
53
 
@@ -56,11 +61,7 @@ async function main(): Promise<void> {
56
61
  let activeMode: string | null = null;
57
62
  let aideBinary: string | null = null;
58
63
  try {
59
- aideBinary = findAideBinary({
60
- cwd,
61
- pluginRoot:
62
- process.env.AIDE_PLUGIN_ROOT || process.env.CLAUDE_PLUGIN_ROOT,
63
- });
64
+ aideBinary = findAideBinary(cwd);
64
65
  if (aideBinary) {
65
66
  activeMode = getState(aideBinary, cwd, "mode");
66
67
  }
@@ -79,7 +80,7 @@ async function main(): Promise<void> {
79
80
  continue: false,
80
81
  message: result.denyMessage,
81
82
  };
82
- console.log(JSON.stringify(output));
83
+ emitHookResult(output);
83
84
  return;
84
85
  }
85
86
 
@@ -108,33 +109,16 @@ async function main(): Promise<void> {
108
109
  additionalContext: result.reminder,
109
110
  },
110
111
  };
111
- console.log(JSON.stringify(output));
112
+ emitHookResult(output);
112
113
  } else {
113
- console.log(JSON.stringify({ continue: true }));
114
+ emitHookResult({ continue: true });
114
115
  }
115
116
  } catch (error) {
116
117
  debug(SOURCE, `Hook error: ${error}`);
117
- console.log(JSON.stringify({ continue: true }));
118
+ emitHookResult({ continue: true });
118
119
  }
119
120
  }
120
121
 
121
- process.on("uncaughtException", (err) => {
122
- debug(SOURCE, `UNCAUGHT EXCEPTION: ${err}`);
123
- try {
124
- console.log(JSON.stringify({ continue: true }));
125
- } catch {
126
- console.log('{"continue":true}');
127
- }
128
- process.exit(0);
129
- });
130
- process.on("unhandledRejection", (reason) => {
131
- debug(SOURCE, `UNHANDLED REJECTION: ${reason}`);
132
- try {
133
- console.log(JSON.stringify({ continue: true }));
134
- } catch {
135
- console.log('{"continue":true}');
136
- }
137
- process.exit(0);
138
- });
122
+ installHookSafetyNet(SOURCE);
139
123
 
140
124
  main();
@@ -9,8 +9,12 @@
9
9
  */
10
10
 
11
11
  import { execFileSync } from "child_process";
12
- import { readStdin } from "../lib/hook-utils.js";
13
- import { findAideBinary } from "../core/aide-client.js";
12
+ import {
13
+ readStdin,
14
+ emitHookResult,
15
+ installHookSafetyNet,
16
+ findAideBinary,
17
+ } from "../lib/hook-utils.js";
14
18
  import { debug } from "../lib/logger.js";
15
19
 
16
20
  const SOURCE = "reflect";
@@ -30,7 +34,7 @@ async function main(): Promise<void> {
30
34
 
31
35
  const input = await readStdin();
32
36
  if (!input.trim()) {
33
- console.log(JSON.stringify({}));
37
+ emitHookResult({});
34
38
  return;
35
39
  }
36
40
 
@@ -38,13 +42,13 @@ async function main(): Promise<void> {
38
42
  const cwd = data.cwd || process.cwd();
39
43
  const sessionID = data.session_id;
40
44
  if (!sessionID) {
41
- console.log(JSON.stringify({}));
45
+ emitHookResult({});
42
46
  return;
43
47
  }
44
48
 
45
- const binary = findAideBinary({ cwd });
49
+ const binary = findAideBinary(cwd);
46
50
  if (!binary) {
47
- console.log(JSON.stringify({}));
51
+ emitHookResult({});
48
52
  return;
49
53
  }
50
54
 
@@ -59,11 +63,14 @@ async function main(): Promise<void> {
59
63
  debug(SOURCE, `reflect run failed (non-fatal): ${err}`);
60
64
  }
61
65
 
62
- console.log(JSON.stringify({}));
66
+ emitHookResult({});
63
67
  } catch (err) {
64
68
  debug(SOURCE, `error: ${err}`);
65
- console.log(JSON.stringify({}));
69
+ emitHookResult({});
66
70
  }
67
71
  }
68
72
 
73
+ // This Stop hook emits {} (not {continue:true}) as its neutral result.
74
+ installHookSafetyNet(SOURCE, {});
75
+
69
76
  void main();
@@ -11,10 +11,14 @@
11
11
  * Core logic is in src/core/search-enrichment.ts for cross-platform reuse.
12
12
  */
13
13
 
14
- import { readStdin } from "../lib/hook-utils.js";
14
+ import {
15
+ readStdin,
16
+ emitHookResult,
17
+ installHookSafetyNet,
18
+ findAideBinary,
19
+ } from "../lib/hook-utils.js";
15
20
  import { debug } from "../lib/logger.js";
16
21
  import { checkSearchEnrichment } from "../core/search-enrichment.js";
17
- import { findAideBinary } from "../core/aide-client.js";
18
22
  import { emitInjectionEvent } from "../core/read-tracking.js";
19
23
 
20
24
  const SOURCE = "search-enrichment";
@@ -42,7 +46,7 @@ async function main(): Promise<void> {
42
46
  try {
43
47
  const input = await readStdin();
44
48
  if (!input.trim()) {
45
- console.log(JSON.stringify({ continue: true }));
49
+ emitHookResult({ continue: true });
46
50
  return;
47
51
  }
48
52
 
@@ -52,11 +56,7 @@ async function main(): Promise<void> {
52
56
  const cwd = data.cwd || process.cwd();
53
57
  const sessionId = data.session_id || "";
54
58
 
55
- const binary = findAideBinary({
56
- cwd,
57
- pluginRoot:
58
- process.env.AIDE_PLUGIN_ROOT || process.env.CLAUDE_PLUGIN_ROOT,
59
- });
59
+ const binary = findAideBinary(cwd);
60
60
 
61
61
  const result = checkSearchEnrichment(toolName, toolInput, cwd, binary);
62
62
 
@@ -87,33 +87,16 @@ async function main(): Promise<void> {
87
87
  additionalContext: result.enrichment,
88
88
  },
89
89
  };
90
- console.log(JSON.stringify(output));
90
+ emitHookResult(output);
91
91
  } else {
92
- console.log(JSON.stringify({ continue: true }));
92
+ emitHookResult({ continue: true });
93
93
  }
94
94
  } catch (error) {
95
95
  debug(SOURCE, `Hook error: ${error}`);
96
- console.log(JSON.stringify({ continue: true }));
96
+ emitHookResult({ continue: true });
97
97
  }
98
98
  }
99
99
 
100
- process.on("uncaughtException", (err) => {
101
- debug(SOURCE, `UNCAUGHT EXCEPTION: ${err}`);
102
- try {
103
- console.log(JSON.stringify({ continue: true }));
104
- } catch {
105
- console.log('{"continue":true}');
106
- }
107
- process.exit(0);
108
- });
109
- process.on("unhandledRejection", (reason) => {
110
- debug(SOURCE, `UNHANDLED REJECTION: ${reason}`);
111
- try {
112
- console.log(JSON.stringify({ continue: true }));
113
- } catch {
114
- console.log('{"continue":true}');
115
- }
116
- process.exit(0);
117
- });
100
+ installHookSafetyNet(SOURCE);
118
101
 
119
102
  main();