Skip to content

feat: introduce @evlog/cli#431

Merged
HugoRCD merged 8 commits into
mainfrom
feat/cli
Jul 20, 2026
Merged

feat: introduce @evlog/cli#431
HugoRCD merged 8 commits into
mainfrom
feat/cli

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Introduce @evlog/cli (binary evlog): citty command tree with registry under commands/, branded help + per-command header (gradient), opt-out via --no-header / EVLOG_CLI_NO_HEADER
  • Ship evlog doctor (monorepo-aware: workspace root, hoist-aware evlog resolve, stack detect, .evlog/logs) and evlog telemetry status|enable|disable via @evlog/telemetry
  • Register cli conventional-commit scope; include changeset for the first minor

Summary by CodeRabbit

  • New Features
    • Introduced the evlog CLI with doctor diagnostics and telemetry management.
    • Added branded help/banner and consistent headers with opt-out; supports --debug and --json.
    • Updated doctor --json to include environment details and JSON schema v2; improved output/exit-code behavior.
    • telemetry status now displays the telemetry data directory.
  • Documentation
    • Added full CLI README and debug DX guidance.
  • Tests
    • Added/expanded coverage for doctor, branding, output/UI/exit behavior, debug reporting, environment resolution, and telemetry.

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
evlog-docs Skipped Skipped Jul 20, 2026 6:24pm
just-use-evlog Skipped Skipped Jul 20, 2026 6:24pm

Request Review

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@HugoRCD HugoRCD changed the title feat(cli): draft @evlog/cli with doctor, telemetry, and on-brand output feat: introduce @evlog/cli Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dfbd186e-c81c-48a3-9c02-82e157e7bae4

📥 Commits

Reviewing files that changed from the base of the PR and between 188bc36 and 6dd708f.

📒 Files selected for processing (1)
  • packages/cli/test/doctor.test.ts

📝 Walkthrough

Walkthrough

Introduces the @evlog/cli package with executable command wiring, doctor diagnostics, telemetry controls, branded output, JSON contracts, debug reporting, project discovery, environment metadata, documentation, tests, and release configuration.

Changes

CLI foundation

Layer / File(s) Summary
Package and release foundation
.github/*, packages/cli/package.json, packages/cli/bin/*, packages/cli/README.md, packages/cli/*config*, .changeset/*, packages/evlog/package.json, packages/cli/DEBUG-DX.md
Adds the publishable CLI package, evlog executable, build/test configuration, documentation, release entries, semantic scopes, and evlog/package.json export.
Telemetry environment contract
packages/telemetry/src/*, packages/telemetry/test/*
Adds environment-stage resolution and validation to telemetry events, preserves typed command arguments, exposes telemetry data-directory status, and covers the updated behavior with tests.
Context, output, branding, and usage
packages/cli/src/core/*, packages/cli/test/brand.test.ts, packages/cli/test/output.test.ts
Adds CLI context creation, schema-versioned JSON output, exit-code and check formatting, branded banners and headers, and branded usage rendering.
Runtime diagnostics infrastructure
packages/cli/src/lib/*, packages/cli/test/*
Adds environment detection, project and workspace resolution, typed CLI errors, debug logging/reporting, UI output control, and corresponding tests.
Doctor diagnostics and command wiring
packages/cli/src/commands/*, packages/cli/src/index.ts, packages/cli/src/cli.ts
Implements project checks and report formatting, registers doctor and telemetry commands, wraps command execution with headers, debug handling, and telemetry, and connects the executable bootstrap.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Doctor
  participant ProjectResolver
  participant CliUi
  participant Telemetry
  User->>Doctor: run doctor with cwd/json options
  Doctor->>ProjectResolver: resolveProject, resolveEvlog, findLogsSink
  ProjectResolver-->>Doctor: project and installation details
  Doctor->>CliUi: emit report or JSON payload
  Doctor->>Telemetry: record summary and project kind
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks the required template sections and omits a detailed description, linked issue, and checklist items. Rewrite it using the template headings for Linked issue, Description, and Checklist, and fill in the missing details.
Docstring Coverage ⚠️ Warning Docstring coverage is 63.49% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, conventional, and clearly names the main change: introducing @evlog/cli.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/evlog@431
npm i https://pkg.pr.new/@evlog/nuxthub@431
npm i https://pkg.pr.new/@evlog/telemetry@431

commit: 6dd708f

@vercel
vercel Bot temporarily deployed to Preview – evlog-docs July 17, 2026 15:36 Inactive
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog July 17, 2026 15:36 Inactive
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog July 17, 2026 15:37 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs July 17, 2026 15:37 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/lib/project.ts`:
- Around line 5-34: Add concise JSDoc descriptions to the exported PackageJson
interface, WorkspaceKind type, ProjectInfo interface, and EvlogInstall interface
in project.ts. Document each public API’s purpose, while preserving the existing
member-level comments and type definitions.
- Around line 77-89: Update the ancestor traversal in the project detection flow
so the root is assigned only when detectWorkspaceKind identifies a valid
workspace; remove the unconditional root = dir assignment after the detection
check. Preserve packageDir and packageJson discovery while ensuring unrelated
parent packages cannot become the project root.

In `@packages/cli/test/doctor.test.ts`:
- Around line 118-174: The test should exercise the production --json
serialization path instead of rebuilding a separate payload from runDoctor’s
result. Update the test around runDoctor and the CLI handler/writeJson flow to
invoke the handler while capturing stdout, or reuse the single serializer used
by production, then assert the captured JSON against the schema snapshot.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1ce29978-2f55-487c-a7be-cd14a328bad6

📥 Commits

Reviewing files that changed from the base of the PR and between 1ab5b6b and b4e3db6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (24)
  • .changeset/cli-skeleton-doctor.md
  • .github/pull_request_template.md
  • .github/workflows/semantic-pull-request.yml
  • packages/cli/README.md
  • packages/cli/bin/evlog.mjs
  • packages/cli/package.json
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/doctor.ts
  • packages/cli/src/commands/index.ts
  • packages/cli/src/commands/telemetry.ts
  • packages/cli/src/core/brand.ts
  • packages/cli/src/core/context.ts
  • packages/cli/src/core/output.ts
  • packages/cli/src/core/usage.ts
  • packages/cli/src/index.ts
  • packages/cli/src/lib/command.ts
  • packages/cli/src/lib/constants.ts
  • packages/cli/src/lib/project.ts
  • packages/cli/test/brand.test.ts
  • packages/cli/test/doctor.test.ts
  • packages/cli/test/output.test.ts
  • packages/cli/tsconfig.json
  • packages/cli/tsdown.config.ts
  • packages/cli/vitest.config.ts

Comment thread packages/cli/src/lib/project.ts
Comment thread packages/cli/src/lib/project.ts
Comment thread packages/cli/test/doctor.test.ts
HugoRCD added 3 commits July 20, 2026 19:29
Packaged installs report production; workspace builds report development. Override via EVLOG_CLI_ENV / EVLOG_TELEMETRY_ENV or VERCEL_ENV.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (3)
packages/cli/src/lib/project.ts (2)

5-35: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Still missing JSDoc on exported project types.

PackageJson, WorkspaceKind, ProjectInfo, and EvlogInstall remain undocumented, while the newly-added ResolveAttempt in this same file does have JSDoc. As per coding guidelines, "Add JSDoc to all public APIs."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/lib/project.ts` around lines 5 - 35, Add JSDoc comments
documenting the exported PackageJson interface, WorkspaceKind type, ProjectInfo
interface, and EvlogInstall interface in packages/cli/src/lib/project.ts,
matching the existing documentation style used by ResolveAttempt and preserving
the current API definitions.

Source: Coding guidelines


79-129: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Root promotion bug appears unresolved: unrelated ancestor packages can still become the workspace root.

root = dir still executes unconditionally after the detectWorkspaceKind check whenever any ancestor has a package.json, even without a workspace marker (pnpm-workspace.yaml, workspaces field, etc.). This can resolve evlog/.evlog/logs from an unrelated parent directory and report a false-healthy result, matching a previously flagged concern that doesn't appear to have been fixed.

🐛 Proposed fix (as previously suggested)
       if (!packageDir) {
         packageDir = dir
         packageJson = pkg
+        root = dir
       }
       const detected = await detectWorkspaceKind(dir, pkg)
       if (detected) {
         root = dir
         kind = detected
         break
       }
       // Keep walking — a parent may be the workspace root.
-      root = dir
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/lib/project.ts` around lines 79 - 129, Update resolveProject
so root is not reassigned for package.json files whose detectWorkspaceKind
result is null; remove the unconditional root = dir in that branch. Preserve
root promotion only when detectWorkspaceKind identifies a workspace, while
retaining the initial cwd root for single-package projects.
packages/cli/test/doctor.test.ts (1)

119-178: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Still rebuilding the JSON payload by hand instead of exercising the real --json output path.

This test constructs its own payload from runDoctor()'s result (now also hardcoding environment: 'development' and schemaVersion: 2) rather than invoking the doctor command handler and capturing its actual JSON output. doctor.ts's own ui.done() call only passes {project, checks, summary} — the schemaVersion/environment envelope fields asserted here are never actually verified against production output, so a real regression in the command's JSON contract could slip through undetected.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/test/doctor.test.ts` around lines 119 - 178, Update the “keeps
the --json schema contract” test to invoke the actual doctor command handler
with JSON output enabled and capture the payload emitted through its ui.done()
path, instead of rebuilding it from runDoctor(). Assert the captured production
payload, including schemaVersion and environment, while preserving the existing
expected schema and values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@packages/cli/src/lib/project.ts`:
- Around line 5-35: Add JSDoc comments documenting the exported PackageJson
interface, WorkspaceKind type, ProjectInfo interface, and EvlogInstall interface
in packages/cli/src/lib/project.ts, matching the existing documentation style
used by ResolveAttempt and preserving the current API definitions.
- Around line 79-129: Update resolveProject so root is not reassigned for
package.json files whose detectWorkspaceKind result is null; remove the
unconditional root = dir in that branch. Preserve root promotion only when
detectWorkspaceKind identifies a workspace, while retaining the initial cwd root
for single-package projects.

In `@packages/cli/test/doctor.test.ts`:
- Around line 119-178: Update the “keeps the --json schema contract” test to
invoke the actual doctor command handler with JSON output enabled and capture
the payload emitted through its ui.done() path, instead of rebuilding it from
runDoctor(). Assert the captured production payload, including schemaVersion and
environment, while preserving the existing expected schema and values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 94ee6bc1-b3c4-4087-9758-55155e5a7b06

📥 Commits

Reviewing files that changed from the base of the PR and between 283d6b8 and a7d452e.

⛔ Files ignored due to path filters (1)
  • packages/telemetry/test/__snapshots__/telemetry.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (32)
  • .changeset/cli.md
  • .changeset/evlog-package-json-export.md
  • packages/cli/DEBUG-DX.md
  • packages/cli/README.md
  • packages/cli/src/commands/doctor.ts
  • packages/cli/src/core/brand.ts
  • packages/cli/src/core/context.ts
  • packages/cli/src/core/output.ts
  • packages/cli/src/index.ts
  • packages/cli/src/lib/command.ts
  • packages/cli/src/lib/debug-report.ts
  • packages/cli/src/lib/debug.ts
  • packages/cli/src/lib/environment.ts
  • packages/cli/src/lib/errors.ts
  • packages/cli/src/lib/project.ts
  • packages/cli/src/lib/ui.ts
  • packages/cli/test/debug-report.test.ts
  • packages/cli/test/debug.test.ts
  • packages/cli/test/doctor.test.ts
  • packages/cli/test/environment.test.ts
  • packages/cli/test/output.test.ts
  • packages/cli/test/ui.test.ts
  • packages/evlog/package.json
  • packages/telemetry/src/citty.ts
  • packages/telemetry/src/commands.ts
  • packages/telemetry/src/create.ts
  • packages/telemetry/src/disclosure.ts
  • packages/telemetry/src/enrich.ts
  • packages/telemetry/src/ingest.ts
  • packages/telemetry/src/types.ts
  • packages/telemetry/test/enrich.test.ts
  • packages/telemetry/test/telemetry.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/test/doctor.test.ts`:
- Around line 145-151: In the test invocation around doctor.run, remove the
typeof check and await fallback, since defineEvlogCommand provides run as a
plain function. Call doctor.run directly with the existing arguments while
preserving the non-null handling if required by its type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4990b244-05fb-4066-880c-d85e848b0c70

📥 Commits

Reviewing files that changed from the base of the PR and between a7d452e and 188bc36.

📒 Files selected for processing (4)
  • .changeset/cli.md
  • packages/cli/src/lib/project.ts
  • packages/cli/test/doctor.test.ts
  • packages/cli/test/project.test.ts

Comment thread packages/cli/test/doctor.test.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog July 20, 2026 18:24 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs July 20, 2026 18:24 Inactive
@HugoRCD
HugoRCD merged commit 61d0c02 into main Jul 20, 2026
17 checks passed
@HugoRCD
HugoRCD deleted the feat/cli branch July 20, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant