@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/startup.mjs +11 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.42-beta.4",
3
+ "version": "0.1.42-beta.5",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {
package/startup.mjs CHANGED
@@ -168,7 +168,10 @@ function hasCommandHook(entry, command) {
168
168
  }
169
169
 
170
170
  function isManagedClaudeTelemetryEntry(entry) {
171
- return entry?.description === CLAUDE_TELEMETRY_DESCRIPTION;
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
- // Skip if already present
200
- if (current.some(isManagedClaudeTelemetryEntry)) continue;
202
+ const managed = current.filter(isManagedClaudeTelemetryEntry);
201
203
 
202
- config.hooks[hookDef.phase] = [...current, buildClaudeTelemetryEntry(hookDef)];
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