ccstatusline-zh 2.2.33 → 2.2.35
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 +22 -8
- package/dist/{ccstatusline-rdsx5ab1.js → ccstatusline-71188a0p.js} +23 -25
- package/dist/ccstatusline-88bs860s.js +6063 -0
- package/dist/{ccstatusline-3tcnryv5.js → ccstatusline-98magj3t.js} +1907 -6930
- package/dist/ccstatusline-j1gdxtq4.js +180 -0
- package/dist/ccstatusline.js +407 -18
- package/dist/dev-reload-egdx2kp5.js +23 -0
- package/dist/{devtools-3w5md92d.js → devtools-nceaxkjz.js} +1713 -2407
- package/dist/{hooks-q322knq1.js → hooks-zr7bxw3x.js} +23 -14
- package/dist/{index-d0c2je2n.js → index-7sf5nvak.js} +328 -91
- package/package.json +5 -5
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import"./ccstatusline-88bs860s.js";
|
|
1
2
|
import {
|
|
2
3
|
loadClaudeSettings,
|
|
3
4
|
saveClaudeSettings,
|
|
4
5
|
getExistingStatusLine,
|
|
5
6
|
getWidget
|
|
6
|
-
} from "./ccstatusline-
|
|
7
|
+
} from "./ccstatusline-98magj3t.js";
|
|
7
8
|
|
|
8
9
|
// src/utils/hooks.ts
|
|
9
10
|
var HOOK_TAG = "ccstatusline-managed";
|
|
@@ -44,28 +45,35 @@ function stripManagedHooks(hooks) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
const defs = [];
|
|
48
|
+
function getHookWidgets(settings) {
|
|
49
|
+
const widgets = new Set;
|
|
50
50
|
for (const line of settings.lines) {
|
|
51
51
|
for (const item of line) {
|
|
52
52
|
const widget = getWidget(item.type);
|
|
53
|
-
if (
|
|
54
|
-
|
|
53
|
+
if (hasWidgetHooks(widget)) {
|
|
54
|
+
widgets.add(widget);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return [...widgets];
|
|
59
|
+
}
|
|
60
|
+
function getActiveHookDefs(widgets) {
|
|
61
|
+
const seen = new Set;
|
|
62
|
+
const defs = [];
|
|
63
|
+
for (const widget of widgets) {
|
|
64
|
+
for (const hook of widget.getHooks()) {
|
|
65
|
+
const key = `${hook.event}:${hook.matcher ?? ""}`;
|
|
66
|
+
if (!seen.has(key)) {
|
|
67
|
+
seen.add(key);
|
|
68
|
+
defs.push(hook);
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
return defs;
|
|
66
73
|
}
|
|
67
74
|
async function syncWidgetHooks(settings) {
|
|
68
|
-
const
|
|
75
|
+
const hookWidgets = getHookWidgets(settings);
|
|
76
|
+
const needed = getActiveHookDefs(hookWidgets);
|
|
69
77
|
const claudeSettings = await loadClaudeSettings({ logErrors: false });
|
|
70
78
|
const hooks = claudeSettings.hooks ?? {};
|
|
71
79
|
stripManagedHooks(hooks);
|
|
@@ -73,7 +81,7 @@ async function syncWidgetHooks(settings) {
|
|
|
73
81
|
if (!statusCommand?.includes("ccstatusline")) {
|
|
74
82
|
claudeSettings.hooks = Object.keys(hooks).length > 0 ? hooks : undefined;
|
|
75
83
|
await saveClaudeSettings(claudeSettings);
|
|
76
|
-
return;
|
|
84
|
+
return statusCommand && needed.length > 0 ? { statusCommand, widgetNames: hookWidgets.map((widget) => widget.getDisplayName()) } : null;
|
|
77
85
|
}
|
|
78
86
|
const hookCommand = `${statusCommand} --hook`;
|
|
79
87
|
for (const def of needed) {
|
|
@@ -89,6 +97,7 @@ async function syncWidgetHooks(settings) {
|
|
|
89
97
|
}
|
|
90
98
|
claudeSettings.hooks = Object.keys(hooks).length > 0 ? hooks : undefined;
|
|
91
99
|
await saveClaudeSettings(claudeSettings);
|
|
100
|
+
return null;
|
|
92
101
|
}
|
|
93
102
|
async function removeManagedHooks() {
|
|
94
103
|
const claudeSettings = await loadClaudeSettings({ logErrors: false });
|