@ghl-ai/aw 0.1.42-beta.4 → 0.1.42-beta.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/startup.mjs +11 -4
package/package.json
CHANGED
package/startup.mjs
CHANGED
|
@@ -168,7 +168,10 @@ function hasCommandHook(entry, command) {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
function isManagedClaudeTelemetryEntry(entry) {
|
|
171
|
-
|
|
171
|
+
if (entry?.description === CLAUDE_TELEMETRY_DESCRIPTION) return true;
|
|
172
|
+
// Also match legacy entries (no description) by command pattern
|
|
173
|
+
const cmds = Array.isArray(entry?.hooks) ? entry.hooks.map(h => h?.command || '') : [];
|
|
174
|
+
return cmds.some(c => c.includes('aw-usage-'));
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
function buildClaudeTelemetryEntry(hookDef) {
|
|
@@ -196,10 +199,14 @@ function enableClaudeTelemetryHooks(homeDir = homedir()) {
|
|
|
196
199
|
|
|
197
200
|
for (const hookDef of CLAUDE_TELEMETRY_HOOKS) {
|
|
198
201
|
const current = Array.isArray(config.hooks[hookDef.phase]) ? config.hooks[hookDef.phase] : [];
|
|
199
|
-
|
|
200
|
-
if (current.some(isManagedClaudeTelemetryEntry)) continue;
|
|
202
|
+
const managed = current.filter(isManagedClaudeTelemetryEntry);
|
|
201
203
|
|
|
202
|
-
|
|
204
|
+
// If exactly one properly described entry exists, nothing to do
|
|
205
|
+
if (managed.length === 1 && managed[0].description === CLAUDE_TELEMETRY_DESCRIPTION) continue;
|
|
206
|
+
|
|
207
|
+
// Remove all legacy/duplicate telemetry entries, then add the canonical one
|
|
208
|
+
const cleaned = current.filter(e => !isManagedClaudeTelemetryEntry(e));
|
|
209
|
+
config.hooks[hookDef.phase] = [...cleaned, buildClaudeTelemetryEntry(hookDef)];
|
|
203
210
|
changed = true;
|
|
204
211
|
}
|
|
205
212
|
|