agent-dag 1.0.5 → 1.0.6
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/server/installer.mjs +22 -1
package/package.json
CHANGED
package/src/server/installer.mjs
CHANGED
|
@@ -29,6 +29,12 @@ export const HOOK_EVENTS = [
|
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
const MARK_KEY = "__agent-dag";
|
|
32
|
+
// Legacy marks from earlier names — purged on every install/uninstall so
|
|
33
|
+
// duplicate forwarders don't pile up when the project gets renamed.
|
|
34
|
+
const LEGACY_MARKS = ["__ccgraph", "__agent-flow"];
|
|
35
|
+
// ~/.claude/<name>/hook.js paths used by old releases. Any unmarked entry
|
|
36
|
+
// pointing into one of these is recognised as ours and removed.
|
|
37
|
+
const LEGACY_DIRS = ["ccgraph", "agent-flow", "agent-dag"];
|
|
32
38
|
|
|
33
39
|
function hookCommand(installedHookPath) {
|
|
34
40
|
// process.execPath = absolute path to current node (works on Win + *nix).
|
|
@@ -36,6 +42,21 @@ function hookCommand(installedHookPath) {
|
|
|
36
42
|
return `"${node}" "${installedHookPath}"`;
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
function isOurEntry(g) {
|
|
46
|
+
if (!g || typeof g !== "object") return false;
|
|
47
|
+
if (g[MARK_KEY] === true) return true;
|
|
48
|
+
for (const k of LEGACY_MARKS) if (g[k] === true) return true;
|
|
49
|
+
// Heuristic: command points at ~/.claude/<legacy-dir>/hook.js.
|
|
50
|
+
const cmds = Array.isArray(g.hooks) ? g.hooks : [];
|
|
51
|
+
for (const h of cmds) {
|
|
52
|
+
const c = typeof h?.command === "string" ? h.command : "";
|
|
53
|
+
for (const dir of LEGACY_DIRS) {
|
|
54
|
+
if (c.includes(`.claude/${dir}/hook.js`) || c.includes(`.claude\\${dir}\\hook.js`)) return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
async function ensureDir(p) {
|
|
40
61
|
if (!existsSync(p)) await mkdir(p, { recursive: true });
|
|
41
62
|
}
|
|
@@ -61,7 +82,7 @@ function buildHookEntry(command) {
|
|
|
61
82
|
|
|
62
83
|
function dedupeOurEntries(group) {
|
|
63
84
|
if (!Array.isArray(group)) return [];
|
|
64
|
-
return group.filter(g => !(g
|
|
85
|
+
return group.filter(g => !isOurEntry(g));
|
|
65
86
|
}
|
|
66
87
|
|
|
67
88
|
export async function installHooks() {
|