Add opt-in anonymous command counters to the CLI

Open
#733 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
36/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start by reading the CLI command registration and configuration code, then inspect docs/reference/cli.md and the existing test layout. The issue calls for opt-in settings, daily local counters, transport behavior, privacy checks, and regenerated translations; the named checks should establish what each part must cover. Done means the opt-in controls and documented payload work, with tests confirming the specified privacy and CI behavior.

Written by the indexing model from the issue text.

Description

Problem

There is no KPI on which Nexy commands developers actually use, so it is hard to decide what to
improve. Public download figures from #732 cannot say how often nx dev, nx build, nx add or any
other command runs. The developer wants counts only, no sensitive data: country plus invocation count
for every command, and count only for nx start.

Change to make

Add anonymous command counters, off by default and opt-in:

  • opt in with useTelemetry = True in nexyconfig.py or NEXY_TELEMETRY=1; add nx telemetry on,
    nx telemetry off and nx telemetry status, the last one printing the exact payload sent
  • every CLI command records one anonymous invocation of that command. Counters are aggregated
    locally and sent once per day with the command name and its count. The country is added by the
    ingestion endpoint, never by the CLI
  • nx start sends its count without a country. No country, no traffic data and no request data
    from anything served in production
  • no file paths, no command arguments, no source text, no environment values and no machine
    identifier in any payload
  • fire and forget with a 500 ms timeout, silent when offline, skipped in CI, never blocking startup
  • a versioned payload schema shared with the ingestion endpoint in #734

Out of scope

The ingestion endpoint (#734), public figures (#732), production traffic analytics and identifying
users.

Checks

Tests stub the transport and assert no call when the option is off, that every command produces a
counter with its own name, that the nx start payload has no country field, that CI is skipped and
that no path or source text is sent. nx telemetry status has a CLI test. docs/reference/cli.md
and a privacy page list every field and the opt-in, with translations regenerated.

Dominant language
Python
Stars
11
Forks
6
Avg merge
2h 14m
Merged PRs (30d)
265

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NexyPy/nexy

All issues in NexyPy/nexy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.