Skip to content

feat(cli): add evlog addon - #1030

Merged
AmanVarshney01 merged 11 commits into
mainfrom
aman/evlog-addon-skills
May 2, 2026
Merged

AmanVarshney01 merged 11 commits into
mainfrom
aman/evlog-addon-skills

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented May 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds an evlog addon to Better T Stack.

The addon wires structured request logging into supported generated apps:

  • Server backends: Hono, Express, Fastify, and Elysia
  • Fullstack web backends: Next.js, TanStack Start, Nuxt, SvelteKit, and Astro
  • Better Auth user/session enrichment when Better Auth is selected
  • AI SDK observability helpers when the AI example is selected
  • Dependency injection for generated projects and better-t-stack add
  • Evlog agent-skill recommendations when skills is selected with the Evlog addon

Latest Package Alignment

  • Bumped better-auth and @better-auth/expo to 1.6.9
  • Bumped Convex Better Auth integration to @convex-dev/better-auth@^0.12.1
  • Bumped Nuxt template dependency to nuxt@^4.4.4
  • Verified evlog@^2.14.1 is already the latest published evlog version

Compatibility

Evlog is hidden and blocked for unsupported stacks, especially Convex and backend none. The CLI prompt, flag validation, add command, and /new stack builder share the same compatibility shape so unsupported stacks do not show or accept the addon.

Fixes Covered

  • Better Auth enrichment now follows the evlog docs shape instead of generated bridge helpers.
  • Server, Next, Nuxt, SvelteKit, Astro, and TanStack Start templates now use createAuthMiddleware(auth as BetterAuthInstance, ...) or createAuthIdentifier(auth as BetterAuthInstance, ...) directly.
  • Removed generated declare module "h3", H3EventContext, createEvlogAuth, toHeaders, and as unknown as BetterAuthInstance code from evlog auth output.
  • Factory-based Cloudflare auth wiring stays inside the request path so createAuth() is not evaluated before runtime env exists.
  • Nuxt Better Auth enrichment uses documented server middleware with createAuthMiddleware and no Nitro plugin event cast.
  • TanStack Start keeps the documented Nitro createAuthIdentifier shape.
  • Keeps Nuxt configs parseable when Evlog is combined with Cloudflare web deploy.
  • Adds local cloudflare:workers fallback wiring for generated Nuxt, TanStack Start, and Astro Cloudflare web builds when Alchemy config is not present yet.
  • Keeps SvelteKit Cloudflare local dev working by falling back to the env package's root .env loader when event.platform.env is unavailable.
  • Avoids passing a same-origin Better Auth baseURL through the Nuxt client plugin for self backend projects.

Validation

  • bun run check passes with 0 warnings and 0 errors.
  • bun run build:cli passes.
  • bun test apps/cli/test/addons.test.ts -t "Evlog Addon" passes: 33 tests, 442 expects.
  • Full fresh scaffold smoke with install: true passed for all 31 evlog-supported combinations. Each case ran dependency install, bun run check-types, bun run build, and a runtime HTTP smoke:
    • 10 standalone server cases: Hono/Express/Fastify/Elysia across supported runtimes and tRPC/oRPC
    • 14 fullstack cases: Next.js, TanStack Start, Nuxt, SvelteKit, and Astro with webDeploy none/Cloudflare where supported
    • 7 separate frontend/backend cases: TanStack Router, React Router, Next.js, TanStack Start, Nuxt, SvelteKit, and Astro with Hono Node backend
  • rg scan confirms removed bridge/hack strings only exist in negative test assertions.
  • Earlier cd apps/cli && bun run test full-suite runs hit unrelated long-running child-process timeouts in existing git-init/create smoke tests under Bun's per-test timeout. The exact timed-out cases rerun individually passed, including PWA + tanstack-router, nuxt + oRPC, and silent-create-output.test.ts.

Source Checks

  • Read https://www.evlog.dev/llms.txt
  • Read https://www.evlog.dev/raw/logging/better-auth.md
  • Read https://www.evlog.dev/raw/frameworks/nitro.md
  • Read https://www.evlog.dev/raw/frameworks/tanstack-start.md
  • Cloned and inspected HugoRCD/evlog source integration types
  • Checked HugoRCD/evlog GitHub issues for an existing Better Auth header/type mismatch report; no exact issue found

@vercel

vercel Bot commented May 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
create-better-t-stack-web Ready Ready Preview, Comment May 2, 2026 9:02am

Request Review

@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

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

Walkthrough

Adds first-class support for the "evlog" addon across CLI, prompts, validation, generator templates/deps, web UI, types/schemas, docs, and tests, including addon-setup wiring, compatibility rules, curated skills source, dependency pins, and extensive regression/unit tests.

Changes

Cohort / File(s) Summary
CLI: addon wiring & setup
apps/cli/src/constants.ts, apps/cli/src/helpers/addons/evlog-setup.ts, apps/cli/src/helpers/addons/addons-setup.ts, apps/cli/README.md
Register evlog in addon constants, add setupEvlog(config) implementing idempotent code/filesystem edits for server/web frameworks, and invoke it from the generic addon setup flow; update README and CLI help to list evlog. Attention: file-injection logic and AddonSetupError wrapping.
CLI: prompts, validation & handlers
apps/cli/src/prompts/addons.ts, apps/cli/src/prompts/config-prompts.ts, apps/cli/src/helpers/core/add-handler.ts, apps/cli/src/helpers/core/command-handlers.ts, apps/cli/src/utils/compatibility-rules.ts, apps/cli/src/utils/config-validation.ts
Expose evlog in interactive prompts, thread backend/runtime into compatibility checks, add supportsEvlogAddon and validateAddonsAgainstConfig, update function signatures and call-sites, and enforce early aborts on validation failures. Attention: signature changes and new validation branch.
CLI: skills & tests
apps/cli/src/helpers/addons/skills-setup.ts, apps/cli/test/addon-setup-regressions.test.ts, apps/cli/test/addons.test.ts, apps/cli/test/input-schemas.test.ts
Add https://www.evlog.dev skills source and curated skill mappings for evlog; add regression and integration tests validating evlog generation, compatibility, AI & Better Auth wiring, and input-schema parsing. Attention: new test fixtures and assertions.
Web app: UI & builder
apps/web/src/app/(home)/new/_components/utils.ts, apps/web/src/lib/constant.ts, apps/web/src/lib/stack-utils.ts, apps/web/test/stack-builder-compatibility.test.ts
Add backend-compatibility predicate for evlog, include it in selectable TECH_OPTIONS, ensure --addons emission includes evlog, auto-remove/disable evlog for incompatible backends and add compatibility tests (Convex negative case). Attention: UI auto-removal/disable behavior.
Docs & README
apps/web/content/docs/cli/agent-workflows.mdx, apps/web/content/docs/cli/options.mdx, apps/web/content/docs/index.mdx, apps/web/content/docs/project-structure.mdx, apps/cli/README.md
Document evlog in CLI flags, options, examples, and README features/addons tables; add Evlog skills example in CLI docs.
Template generator: deps & templates
packages/template-generator/src/processors/addons-deps.ts, packages/template-generator/src/processors/db-deps.ts, packages/template-generator/src/processors/workspace-deps.ts, packages/template-generator/src/templates.generated.ts, packages/template-generator/src/processors/alchemy-plugins.ts, packages/template-generator/src/processors/auth-deps.ts, packages/template-generator/templates/.../*, packages/template-generator/src/utils/add-deps.ts
Add evlog (and nitro for tanstack-start) to dependencyVersionMap and conditional package.json injection, tighten web DB/workspace dependency gating, adjust several template snippets/typings/initialization patterns, and update Better Auth pinned versions. Attention: dependency mapping and conditional injection logic.
Types / schemas
packages/types/src/schemas.ts
Extend Zod schemas to accept "evlog" and the skills source URL https://www.evlog.dev.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(cli): add evlog addon' directly and clearly describes the main change—adding a new evlog addon to the CLI. It is specific, concise, and summarizes the primary objective of the changeset.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 37df2059-7ef8-4838-8577-2811566ccefe

📥 Commits

Reviewing files that changed from the base of the PR and between c6b1d8c and 1181506.

📒 Files selected for processing (32)
  • apps/cli/README.md
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/addons-setup.ts
  • apps/cli/src/helpers/addons/evlog-setup.ts
  • apps/cli/src/helpers/addons/skills-setup.ts
  • apps/cli/src/helpers/core/add-handler.ts
  • apps/cli/src/helpers/core/command-handlers.ts
  • apps/cli/src/prompts/addons.ts
  • apps/cli/src/prompts/config-prompts.ts
  • apps/cli/src/utils/compatibility-rules.ts
  • apps/cli/src/utils/config-validation.ts
  • apps/cli/test/addon-setup-regressions.test.ts
  • apps/cli/test/addons.test.ts
  • apps/cli/test/input-schemas.test.ts
  • apps/web/content/docs/cli/agent-workflows.mdx
  • apps/web/content/docs/cli/options.mdx
  • apps/web/content/docs/index.mdx
  • apps/web/content/docs/project-structure.mdx
  • apps/web/src/app/(home)/new/_components/utils.ts
  • apps/web/src/lib/constant.ts
  • apps/web/src/lib/stack-utils.ts
  • apps/web/test/stack-builder-compatibility.test.ts
  • packages/template-generator/src/processors/addons-deps.ts
  • packages/template-generator/src/processors/db-deps.ts
  • packages/template-generator/src/processors/workspace-deps.ts
  • packages/template-generator/src/templates.generated.ts
  • packages/template-generator/src/utils/add-deps.ts
  • packages/template-generator/templates/auth/better-auth/web/svelte/src/components/SignInForm.svelte.hbs
  • packages/template-generator/templates/auth/better-auth/web/svelte/src/components/SignUpForm.svelte.hbs
  • packages/template-generator/templates/backend/server/elysia/src/index.ts.hbs
  • packages/template-generator/templates/frontend/react/next/next.config.ts.hbs
  • packages/types/src/schemas.ts

Comment on lines +70 to 73
{
"source": "https://www.evlog.dev",
"skills": ["review-logging-patterns", "analyze-logs"]
}

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify the add-json Evlog example by including the evlog addon.

The example adds Evlog-specific skills but the addons list does not include evlog, which makes the intent ambiguous.

Suggested docs fix
-  "addons": ["skills", "ultracite"],
+  "addons": ["skills", "ultracite", "evlog"],

@AmanVarshney01 AmanVarshney01 changed the title fix(cli): gate evlog addon compatibility feat(cli): add evlog addon May 1, 2026
@AmanVarshney01
AmanVarshney01 force-pushed the aman/evlog-addon-skills branch from 8f3ca32 to a3f2e30 Compare May 1, 2026 10:05

@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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bead96b8-42c6-431d-be13-f8884fc319d8

📥 Commits

Reviewing files that changed from the base of the PR and between 8f3ca32 and a3f2e30.

📒 Files selected for processing (12)
  • apps/cli/README.md
  • apps/cli/src/helpers/addons/evlog-setup.ts
  • apps/cli/src/helpers/core/add-handler.ts
  • apps/cli/src/helpers/core/command-handlers.ts
  • apps/cli/src/prompts/addons.ts
  • apps/cli/src/prompts/config-prompts.ts
  • apps/cli/src/utils/compatibility-rules.ts
  • apps/cli/src/utils/config-validation.ts
  • apps/cli/test/addons.test.ts
  • apps/web/content/docs/cli/options.mdx
  • apps/web/src/app/(home)/new/_components/utils.ts
  • apps/web/test/stack-builder-compatibility.test.ts
✅ Files skipped from review due to trivial changes (1)
  • apps/web/content/docs/cli/options.mdx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/cli/src/prompts/config-prompts.ts
  • apps/web/test/stack-builder-compatibility.test.ts

Comment on lines +18 to +47
async function readSourceFiles(dir: string): Promise<{ path: string; content: string }[]> {
if (!existsSync(dir)) return [];

const entries = await readdir(dir, { withFileTypes: true });
const files = await Promise.all(
entries.map(async (entry) => {
const entryPath = join(dir, entry.name);
if (entry.isDirectory()) return readSourceFiles(entryPath);
if (!/\.(?:cjs|js|mjs|ts|tsx|vue)$/.test(entry.name)) return [];
return [{ path: entryPath, content: await readFile(entryPath, "utf-8") }];
}),
);

return files.flat();
}

function expectParseableTypeScript(content: string) {
const diagnostics =
transpileModule(content, {
compilerOptions: {
module: ModuleKind.ESNext,
target: ScriptTarget.ESNext,
},
reportDiagnostics: true,
}).diagnostics?.filter((diagnostic) => diagnostic.category === DiagnosticCategory.Error) ?? [];

expect(
diagnostics.map((diagnostic) => flattenDiagnosticMessageText(diagnostic.messageText, "\n")),
).toEqual([]);
}

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.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

TypeScript 6.0 transpileModule API changes

💡 Result:

In TypeScript 6.0, the transpileModule API has a breaking change related to the handling of the rootDir compiler option. Previously, in TypeScript 5.x, transpileModule would silently infer rootDir from the common source directory if not explicitly set. In 6.0, rootDir must be explicitly provided in the compilerOptions passed to transpileModule; setting it to undefined (as some tools like ts-loader did) now triggers error TS5011: "The common source directory of 'tsconfig.json' is './src/connect'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout." This change aligns with broader 6.0 updates where rootDir defaults to the tsconfig directory instead of being inferred, affecting standalone transpile scenarios. Tools using transpileModule need to ensure rootDir is explicitly passed from their configuration rather than overridden to undefined. No other API changes to transpileModule parameters, return types, or behavior are documented in official TypeScript 6.0 release notes. The compiler API remains compatible with 5.9 as stated in announcements.

Citations:


🏁 Script executed:

fd package.json | head -10

Repository: AmanVarshney01/create-better-t-stack

Length of output: 553


🏁 Script executed:

cat package.json | grep -A 2 -B 2 typescript

Repository: AmanVarshney01/create-better-t-stack

Length of output: 316


🏁 Script executed:

cat apps/cli/test/setup.ts 2>/dev/null || echo "Setup file not found"

Repository: AmanVarshney01/create-better-t-stack

Length of output: 1678


🏁 Script executed:

cat tsconfig.json 2>/dev/null | head -30

Repository: AmanVarshney01/create-better-t-stack

Length of output: 793


Add explicit rootDir to transpileModule call for TypeScript 6.0 compatibility.

The expectParseableTypeScript function calls transpileModule without setting rootDir in compilerOptions. TypeScript 6.0 requires rootDir to be explicitly provided; omitting it triggers error TS5011. Add rootDir: "." (or an appropriate path) to the compilerOptions:

Fix for expectParseableTypeScript
function expectParseableTypeScript(content: string) {
  const diagnostics =
    transpileModule(content, {
      compilerOptions: {
        module: ModuleKind.ESNext,
        target: ScriptTarget.ESNext,
        rootDir: ".",
      },
      reportDiagnostics: true,
    }).diagnostics?.filter((diagnostic) => diagnostic.category === DiagnosticCategory.Error) ?? [];

  expect(
    diagnostics.map((diagnostic) => flattenDiagnosticMessageText(diagnostic.messageText, "\n")),
  ).toEqual([]);
}

@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

🧹 Nitpick comments (2)
apps/cli/src/utils/compatibility-rules.ts (1)

89-106: 💤 Low value

Unused _runtime parameter in supportsEvlogAddon.

The _runtime parameter is declared but never used in the function body. If this is intentional for future use, the underscore prefix is appropriate. However, if runtime should affect evlog compatibility (e.g., workers runtime restrictions), this may be incomplete.

💡 If runtime is not needed, consider removing it
 export function supportsEvlogAddon(
   frontend: Frontend[] = [],
   backend?: Backend,
-  _runtime?: Runtime,
 ) {

And update all call sites accordingly in validateAddonCompatibility and getCompatibleAddons.

apps/cli/src/helpers/addons/evlog-setup.ts (1)

124-154: 💤 Low value

Consider edge case when streamText call structure varies.

The regex patterns for AI SDK telemetry wiring assume specific code structure (e.g., const result = streamText({...model,...). If the generated template code structure changes, these patterns may fail silently since insertAfterOnce and string replacements return unchanged content when markers aren't found.

This is acceptable for template-controlled code, but worth noting for maintainability.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 860ff152-89c5-4e58-8e79-14f4997a8f44

📥 Commits

Reviewing files that changed from the base of the PR and between a3f2e30 and fff37a5.

📒 Files selected for processing (13)
  • apps/cli/README.md
  • apps/cli/src/helpers/addons/evlog-setup.ts
  • apps/cli/src/helpers/core/add-handler.ts
  • apps/cli/src/helpers/core/command-handlers.ts
  • apps/cli/src/prompts/addons.ts
  • apps/cli/src/prompts/config-prompts.ts
  • apps/cli/src/utils/compatibility-rules.ts
  • apps/cli/src/utils/config-validation.ts
  • apps/cli/test/addons.test.ts
  • apps/web/content/docs/cli/options.mdx
  • apps/web/src/app/(home)/new/_components/utils.ts
  • apps/web/test/stack-builder-compatibility.test.ts
  • packages/template-generator/src/processors/alchemy-plugins.ts
✅ Files skipped from review due to trivial changes (3)
  • apps/web/content/docs/cli/options.mdx
  • apps/cli/src/utils/config-validation.ts
  • apps/cli/test/addons.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/cli/README.md

@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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c5472b9-685e-4ecb-bc94-c1532233c7f5

📥 Commits

Reviewing files that changed from the base of the PR and between fff37a5 and e9afab0.

📒 Files selected for processing (10)
  • apps/cli/src/helpers/addons/evlog-setup.ts
  • apps/cli/test/addons.test.ts
  • packages/template-generator/src/processors/alchemy-plugins.ts
  • packages/template-generator/src/processors/auth-deps.ts
  • packages/template-generator/src/templates.generated.ts
  • packages/template-generator/src/utils/add-deps.ts
  • packages/template-generator/templates/auth/better-auth/web/nuxt/app/plugins/auth-client.ts.hbs
  • packages/template-generator/templates/frontend/nuxt/nuxt.config.ts.hbs
  • packages/template-generator/templates/frontend/nuxt/package.json.hbs
  • packages/template-generator/templates/packages/env/src/server.ts.hbs
✅ Files skipped from review due to trivial changes (3)
  • packages/template-generator/src/processors/auth-deps.ts
  • packages/template-generator/templates/packages/env/src/server.ts.hbs
  • packages/template-generator/templates/frontend/nuxt/package.json.hbs
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/template-generator/src/utils/add-deps.ts
  • packages/template-generator/src/templates.generated.ts

Comment thread apps/cli/test/addons.test.ts Resolved
@AmanVarshney01
AmanVarshney01 enabled auto-merge (squash) May 2, 2026 09:03
@AmanVarshney01
AmanVarshney01 merged commit d617b1f into main May 2, 2026
3 checks passed
@AmanVarshney01
AmanVarshney01 deleted the aman/evlog-addon-skills branch May 2, 2026 09:04

This branch was successfully deployed

1 active deployment
Preview — f1928504 Deployed May 2, 2026 by vercel[bot]
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