@ghl-ai/aw 0.1.73-beta.2 → 0.1.73-beta.3
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/commands/init.mjs +17 -14
- package/package.json +1 -1
package/commands/init.mjs
CHANGED
|
@@ -77,6 +77,19 @@ function writeHookManifestBestEffort(manifest, context) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
function installAwUsageHooksBestEffort({ silent = false } = {}) {
|
|
81
|
+
ensureTelemetryConfig();
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
if (!isDefaultRoutingEnabled(HOME, process.env)) return null;
|
|
85
|
+
const result = installAwUsageHooks();
|
|
86
|
+
return formatAwUsageHooksInstallReport(result);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
if (!silent) fmt.note(`aw-usage hooks install: ${e.message}`, 'Telemetry');
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
80
93
|
function formatIntegrationStatusSummary(statuses, installedNow = []) {
|
|
81
94
|
if (!statuses || statuses.length === 0) return null;
|
|
82
95
|
|
|
@@ -506,6 +519,8 @@ export async function initCommand(args) {
|
|
|
506
519
|
if (cwd !== HOME) installLocalCommitHook(cwd);
|
|
507
520
|
if (!silent) fmt.logStep(`IDE wired — ${chalk.bold(symlinks)} symlinks · ${chalk.bold(commands)} commands`);
|
|
508
521
|
|
|
522
|
+
const awUsageHooksReport = installAwUsageHooksBestEffort({ silent });
|
|
523
|
+
|
|
509
524
|
// Write hook manifest after all hook installation is complete
|
|
510
525
|
writeHookManifestBestEffort({ eccVersion: AW_ECC_TAG, awVersion: VERSION });
|
|
511
526
|
|
|
@@ -533,6 +548,7 @@ export async function initCommand(args) {
|
|
|
533
548
|
'',
|
|
534
549
|
` ${chalk.green('✓')} Registry synced`,
|
|
535
550
|
` ${chalk.green('✓')} IDE refreshed — ${chalk.bold(symlinks)} symlinks · ${chalk.bold(commands)} commands`,
|
|
551
|
+
awUsageHooksReport ? ` ${chalk.green('✓')} ${awUsageHooksReport}` : null,
|
|
536
552
|
removedLegacyStartupFiles.length > 0
|
|
537
553
|
? ` ${chalk.green('✓')} Removed ${removedLegacyStartupFiles.length} legacy repo startup file${removedLegacyStartupFiles.length > 1 ? 's' : ''}`
|
|
538
554
|
: null,
|
|
@@ -680,25 +696,12 @@ export async function initCommand(args) {
|
|
|
680
696
|
];
|
|
681
697
|
if (!silent) fmt.logStep(`IDE wired — ${chalk.bold(symlinks)} symlinks · ${chalk.bold(commands)} commands`);
|
|
682
698
|
|
|
683
|
-
// Ensure telemetry config exists (generates machine_id on first run)
|
|
684
|
-
ensureTelemetryConfig();
|
|
685
|
-
|
|
686
699
|
// Install bundled aw-usage producer hooks into ~/.claude.
|
|
687
700
|
// Copies the scripts + lib files and non-destructively merges 5 hook phases
|
|
688
701
|
// (SessionStart, UserPromptSubmit, PostToolUse, PostToolUseFailure, Stop)
|
|
689
702
|
// into ~/.claude/settings.json. Idempotent. After this, every Claude Code
|
|
690
703
|
// session emits usage_events to the live telemetry API automatically.
|
|
691
|
-
|
|
692
|
-
try {
|
|
693
|
-
if (isDefaultRoutingEnabled(HOME, process.env)) {
|
|
694
|
-
const result = installAwUsageHooks();
|
|
695
|
-
awUsageHooksReport = formatAwUsageHooksInstallReport(result);
|
|
696
|
-
}
|
|
697
|
-
} catch (e) {
|
|
698
|
-
// Non-fatal — telemetry is observational. Surface the error in silent mode
|
|
699
|
-
// logs but don't block the install.
|
|
700
|
-
if (!silent) fmt.note(`aw-usage hooks install: ${e.message}`, 'Telemetry');
|
|
701
|
-
}
|
|
704
|
+
const awUsageHooksReport = installAwUsageHooksBestEffort({ silent });
|
|
702
705
|
|
|
703
706
|
// Write hook manifest after all hook installation is complete, including
|
|
704
707
|
// bundled usage hooks, so `aw nuke` can prune AW-managed settings entries.
|