fix(cli): map .env.local to development environment - #4
Conversation
Remove keyway_get_secret (no longer exists), add keyway_generate, keyway_diff, keyway_scan, and keyway_validate with parameter tables and example prompts. Also update docs CLAUDE.md directory listing with 3 missing pages (installation, ai-agents, organizations). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Complete documentation for deploying Keyway on your own infrastructure with Docker Compose, including DNS setup, GitHub App creation, environment configuration, architecture diagram, optional services, GitHub Enterprise support, and troubleshooting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add language identifiers to fenced code blocks (MD040) - Fix EMAIL_FROM_NAME/EMAIL_FROM_ADDRESS example values - Capitalize GitHub.com per official branding Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
.env.local (Next.js/Vite convention) was mapped to "local" which doesn't exist as a vault environment, causing push to fail. Add alias mapping for common env file suffixes (.local, .dev, .prod, .stage, .*.local) to standard vault environments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds environment-name canonicalization for .env suffixes via a new exported function Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/cli/internal/env/discover.go (1)
68-73: Prefer a shared env normalization function to prevent alias drift.Derivation here and CLI-arg normalization (
packages/cli/internal/cmd/diff.go:244-256) are now separate rule sets. Centralizing normalization in one helper would prevent mismatches (e.g., aliases supported in args but not in file-derived envs).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cli/internal/env/discover.go` around lines 68 - 73, The env name derivation in discover.go (the strings.TrimPrefix(base, ".env.") + envAliases lookup) is diverging from the CLI-arg normalization logic in diff.go; add a single exported helper like normalizeEnvName (or normalizeEnvAlias) that encapsulates the TrimPrefix + envAliases mapping and any other alias rules, replace the inline logic in discover.go (the suffix/envAliases branch) with a call to that helper, and update the CLI arg normalization in packages/cli/internal/cmd/diff.go to call the same helper so both file-derived and arg-derived env names use the exact same rules.packages/cli/internal/env/discover_test.go (1)
223-231: Add regression cases for shorthand local aliases.Please add
".env.dev.local",".env.prod.local", and".env.stage.local"to lock expected canonical mapping and prevent future regressions.Suggested test additions
{".env.development.local", "development"}, // Next.js local override {".env.production.local", "production"}, // Next.js local override {".env.staging.local", "staging"}, // Next.js local override + {".env.dev.local", "development"}, // shorthand + local + {".env.prod.local", "production"}, // shorthand + local + {".env.stage.local", "staging"}, // shorthand + local {".env.test.local", "development"}, // Next.js local override🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cli/internal/env/discover_test.go` around lines 223 - 231, Update the alias mappings in the test data inside discover_test.go to include the missing shorthand local aliases so the canonical mapping is locked: add entries for ".env.dev.local" -> "development", ".env.prod.local" -> "production", and ".env.stage.local" -> "staging" to the existing alias mappings slice used by the tests (the list shown in the diff that contains ".env.local", ".env.dev", ".env.stage", etc.) so the test asserts cover these regression cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/internal/env/discover.go`:
- Around line 45-54: The envAliases map in discover.go is missing shorthand keys
for suffixes like "dev.local" and "prod.local", causing names like "prod.local"
to be returned unmapped; update the envAliases map to include shorthand
"*.local" entries (e.g., "dev.local" -> "development", "prod.local" ->
"production", "stage.local" -> "staging", "test.local" -> "development") so that
lookups using the envAliases symbol normalize ".env.X.local" suffixes to the
canonical environment names.
In `@packages/docs/docs/intro.md`:
- Line 141: Replace the absolute docs link "/self-hosting" with a relative
internal docs link for the "Self-Hosting" entry; update the Markdown link text
"[Self-Hosting](/self-hosting)" to use the repo convention (e.g.,
"[Self-Hosting](./self-hosting)") so the entry in intro.md uses a relative path
consistent with other docs.
---
Nitpick comments:
In `@packages/cli/internal/env/discover_test.go`:
- Around line 223-231: Update the alias mappings in the test data inside
discover_test.go to include the missing shorthand local aliases so the canonical
mapping is locked: add entries for ".env.dev.local" -> "development",
".env.prod.local" -> "production", and ".env.stage.local" -> "staging" to the
existing alias mappings slice used by the tests (the list shown in the diff that
contains ".env.local", ".env.dev", ".env.stage", etc.) so the test asserts cover
these regression cases.
In `@packages/cli/internal/env/discover.go`:
- Around line 68-73: The env name derivation in discover.go (the
strings.TrimPrefix(base, ".env.") + envAliases lookup) is diverging from the
CLI-arg normalization logic in diff.go; add a single exported helper like
normalizeEnvName (or normalizeEnvAlias) that encapsulates the TrimPrefix +
envAliases mapping and any other alias rules, replace the inline logic in
discover.go (the suffix/envAliases branch) with a call to that helper, and
update the CLI arg normalization in packages/cli/internal/cmd/diff.go to call
the same helper so both file-derived and arg-derived env names use the exact
same rules.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 494ff81c-f7b8-4a33-8fa6-d482ef99d052
📒 Files selected for processing (7)
packages/cli/internal/env/discover.gopackages/cli/internal/env/discover_test.gopackages/docs/CLAUDE.mdpackages/docs/docs/intro.mdpackages/docs/docs/mcp.mdpackages/docs/docs/self-hosting.mdpackages/docs/sidebars.ts
| - [API](/api) - REST API and API keys | ||
| - [Organizations](/organizations) - Team billing and management | ||
| - [Security](/security) - Permissions and activity logs | ||
| - [Self-Hosting](/self-hosting) - Deploy on your own infrastructure |
There was a problem hiding this comment.
Use a relative internal link for the new Self-Hosting entry.
Line [141] uses /self-hosting; use a relative docs link to match repo docs conventions.
Suggested fix
-- [Self-Hosting](/self-hosting) - Deploy on your own infrastructure
+- [Self-Hosting](./self-hosting) - Deploy on your own infrastructureAs per coding guidelines, packages/docs/docs/**/*.md: Use relative paths for internal links in Markdown files (e.g., [API Reference](./api) instead of absolute paths).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - [Self-Hosting](/self-hosting) - Deploy on your own infrastructure | |
| - [Self-Hosting](./self-hosting) - Deploy on your own infrastructure |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/docs/docs/intro.md` at line 141, Replace the absolute docs link
"/self-hosting" with a relative internal docs link for the "Self-Hosting" entry;
update the Markdown link text "[Self-Hosting](/self-hosting)" to use the repo
convention (e.g., "[Self-Hosting](./self-hosting)") so the entry in intro.md
uses a relative path consistent with other docs.
- Add missing shorthand *.local aliases (dev.local, prod.local, stage.local) - Export NormalizeEnvName in env package and reuse it in diff.go to centralize env name normalization - Add stg alias for staging - Normalize env names to lowercase Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
.env.localwas mapped to environment"local"which doesn't exist in vaults (onlydevelopment,staging,production), causingkeyway pushto fail afterkeyway init.local→ development,.dev→ development,.prod→ production,.stage→ staging, plus*.localvariantsTest plan
go test ./internal/env/...— all passkeyway initin a repo with.env.localshould map todevelopment🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements