ai-gains 1.3.4 → 1.3.5
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/init.js +12 -5
- package/template/.claude/settings.json +3 -3
- /package/template/.claude/scripts/ai-gains/{session-start.js → session-start.cjs} +0 -0
- /package/template/.claude/scripts/ai-gains/{stop.js → stop.cjs} +0 -0
- /package/template/.claude/scripts/ai-gains/{user-prompt-submit.js → user-prompt-submit.cjs} +0 -0
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -15,17 +15,24 @@ function mergeSettings(existing, template) {
|
|
|
15
15
|
continue;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
//
|
|
19
|
-
const
|
|
18
|
+
// Build a map of label -> hook object for existing hooks so we can update in-place
|
|
19
|
+
const existingByLabel = new Map();
|
|
20
20
|
for (const entry of result.hooks[hookType]) {
|
|
21
21
|
for (const hook of (entry.hooks || [])) {
|
|
22
|
-
if (hook.label)
|
|
22
|
+
if (hook.label) existingByLabel.set(hook.label, hook);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
//
|
|
26
|
+
// Update existing hooks in-place; append hooks whose label isn't already present
|
|
27
27
|
for (const templateEntry of templateEntries) {
|
|
28
|
-
const newHooks =
|
|
28
|
+
const newHooks = [];
|
|
29
|
+
for (const templateHook of (templateEntry.hooks || [])) {
|
|
30
|
+
if (existingByLabel.has(templateHook.label)) {
|
|
31
|
+
Object.assign(existingByLabel.get(templateHook.label), templateHook);
|
|
32
|
+
} else {
|
|
33
|
+
newHooks.push(templateHook);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
29
36
|
if (newHooks.length > 0) {
|
|
30
37
|
result.hooks[hookType].push({ hooks: newHooks });
|
|
31
38
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{
|
|
7
7
|
"type": "command",
|
|
8
8
|
"label": "ai-gains",
|
|
9
|
-
"command": "node .claude/scripts/ai-gains/session-start.
|
|
9
|
+
"command": "node .claude/scripts/ai-gains/session-start.cjs"
|
|
10
10
|
}
|
|
11
11
|
]
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
{
|
|
18
18
|
"type": "command",
|
|
19
19
|
"label": "ai-gains",
|
|
20
|
-
"command": "node .claude/scripts/ai-gains/user-prompt-submit.
|
|
20
|
+
"command": "node .claude/scripts/ai-gains/user-prompt-submit.cjs"
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
{
|
|
29
29
|
"type": "command",
|
|
30
30
|
"label": "ai-gains",
|
|
31
|
-
"command": "node .claude/scripts/ai-gains/stop.
|
|
31
|
+
"command": "node .claude/scripts/ai-gains/stop.cjs"
|
|
32
32
|
}
|
|
33
33
|
]
|
|
34
34
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|