Skip to content

feat(analytics): record how and where each command runs - #444

Merged
angeloashmore merged 7 commits into
mainfrom
claude/epic-brown-mz4qp6
Oct 30, 2026
Merged

angeloashmore merged 7 commits into
mainfrom
claude/epic-brown-mz4qp6

Conversation

@angeloashmore

@angeloashmore angeloashmore commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Resolves: #442

Description

Before this PR, CLI usage events recorded the command, the repository, and the agent. They did not show how a run signed in or what kind of machine ran it. As a result, CI jobs, remote agents, and new developers looked the same. Login problems in remote environments also stayed hidden among other failed commands.

After this PR, the Prismic CLI Start and Prismic CLI End events also report:

  • auth: login, user-token, write-token, unknown-token, or none
  • runtime: local, ci, cloud, container, or unknown
  • runtimeProvider: the CI or cloud platform, when the CLI recognizes it
  • os: the operating system

Each value reports only what the CLI can find out. A Linux machine with no known marker reports unknown, not local, so unrecognized cloud sandboxes do not look like developer machines. The CLI sends only these categories. It never sends token contents or environment values.

The agent property also reports Claude Code as claude-code, without a version. Before, each Claude Code release had its own value, such as claude-code_2-1-296_agent. Saved charts match Claude Code with "contains" or "has prefix", so they keep working. Other existing properties do not change.

The CLI does not recognize v0 or Google Jules yet.

Checklist

  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

  1. Build the CLI with npm run build.
  2. Run a command with PRISMIC_TELEMETRY_ENABLED=true on your computer, in a CI job, and in a cloud agent.
  3. Make sure that the Segment debugger shows the expected auth, runtime, runtimeProvider, and agent values for each run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L1dGD6moc6oMbcTcBsC6pN

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment. ↩

CLI usage events could not tell new developers apart from automation,
CI, or remote agents. Login problems in remote environments were also
hidden among other failures.

Start and End events now report how the run signed in, what kind of
machine ran it, and the operating system. The CLI sends only fixed
categories. It never sends token contents or environment values.
Existing event properties do not change.

Closes #442

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD6moc6oMbcTcBsC6pN
Codex cloud sets CODEX_EXEC_SERVER_REMOTE_BASE_URL. The local Codex CLI
does not, so the variable separates cloud runs from local runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD6moc6oMbcTcBsC6pN
The runtime fell back to local when no check matched. As a result,
unrecognized cloud sandboxes looked like developer machines.

Unrecognized Linux machines now report unknown. Local applies to
macOS, Windows, and WSL only. The runtime also recognizes Modal, E2B,
CodeSandbox, Kubernetes, AWS CodeBuild, and TeamCity. Vercel counts as
CI only during builds, because Vercel also sets VERCEL at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD6moc6oMbcTcBsC6pN
@angeloashmore
angeloashmore marked this pull request as ready for review October 29, 2026 22:00
Claude Code sets AI_AGENT with its version, such as
claude-code_2-1-296_agent. Usage events split Claude Code into one
agent value for each release.

The agent value is now claude-code for every Claude Code release.
Saved charts match it with "contains" or "has prefix", so they keep
working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD6moc6oMbcTcBsC6pN
@angeloashmore angeloashmore changed the title feat: record how and where each CLI command runs feat(analytics): record how and where each command runs Oct 29, 2026
Cursor cloud agents set CLOUD_AGENT_ALL_SECRET_NAMES next to
CURSOR_AGENT. Local Cursor sets only CURSOR_AGENT, so the pair
separates cloud runs from local runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L1dGD6moc6oMbcTcBsC6pN
@cursor

cursor Bot commented Oct 30, 2026

Copy link
Copy Markdown

Bugbot is paused — your team has an unpaid invoice

Bugbot is paused because your team has an unpaid invoice.

Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically.

(requestId: 200ca19b-14c8-4de3-98cf-7f553801b3f7)

@angeloashmore
angeloashmore merged commit 8625829 into main Oct 30, 2026
16 checks passed
@angeloashmore
angeloashmore deleted the claude/epic-brown-mz4qp6 branch October 30, 2026 20:39
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.

CLI usage events do not show how a run signed in, where it ran, or if it is internal

3 participants