Skip to content

Feature/add events - #108

Merged
aliroberts merged 2 commits into
devfrom
feature/add-events
Feb 4, 2026
Merged

aliroberts merged 2 commits into
devfrom
feature/add-events

Conversation

@aliroberts

Copy link
Copy Markdown
Collaborator

PR: Improve CLI event logging + update setup install flow (download vs git clone)

Summary

  • Improved CLI event logging with consistent context (installation_id, invocation_id, client_version, invoked_via) and a client-side timestamp for accurate ordering.
  • Centralized event definitions and context handling in weco/events.py, keeping event reporting strictly best-effort (never breaks CLI commands).
  • Updated the auth flow to emit only auth.started, auth.completed, auth.failed from the CLI with full context.
  • Refactored config/ID management into weco/config.py to avoid circular imports and keep auth/event modules clean.
  • Updated weco setup to install via download (not git clone), and instrumented setup events (skill.install.started/completed/failed).

Key changes

Event logging

  • weco/events.py
    • Added typed event models (e.g. CLIInvokedEvent, RunStartAttemptedEvent, AuthStartedEvent, AuthCompletedEvent, AuthFailedEvent, SkillInstall*Event)
    • Added a client-side timestamp to every event payload for ordering
    • Background thread sending with full error swallowing (fire-and-forget)
    • Event context helpers (create_event_context, get_event_context, set_event_context)
    • invoked_via detection (CLI vs skill / Cursor / Claude Code)
  • weco/cli.py
    • Added --via-skill flag to tag invocations that originate from an AI skill
    • Sends cli.invoked at startup with command name
  • weco/optimizer.py + weco/api.py
    • Propagate tracking context into run metadata so run lifecycle events can be tied back to the CLI journey

Auth logging + linking

  • weco/auth.py
    • Emits auth.started, auth.completed, auth.failed (client-side only)
    • Passes installation_id in the device token request
  • weco/config.py
    • New home for config directory, api key persistence, and installation id management (avoids circular import issues)

Setup install flow

  • weco/setup.py
    • Switches setup install from git clone to downloading the skill bundle (more reliable, fewer dependencies)
    • Instruments setup funnel events (skill.install.*) around the download/install steps

@aliroberts
aliroberts merged commit 0b31f14 into dev Feb 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant