Repository navigation
feat(env): require --env when the project has more than one environment - #79
Merged
Merged
Conversation
A project with only PROD works as before: no env needed, with or without --env PROD. A project with several environments needs the env named on every project-scoped command (--env, --prod, NORBIX_ENV, or a default saved with `norbix env use` / a profile, which is then printed on stderr); otherwise the command exits 2 with ENV_REQUIRED and the list, and sends nothing. The list is read through the same client and cached per project for 5 minutes; env list/use/delete and CM-ERRORS-ENVIRONMENTS-001 refresh it. Envs that cannot be read: runs as before with one stderr warning. `whoami` shows the env source and the rule. Plain SDK/API apps unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en there are several Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.33.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owner rule (2026-10-14): a project with only PROD needs no env; a project with more than one environment needs the caller to name one. A coding agent wrote to PROD because it did not know the project had TEST.
env list/use/deleteandCM-ERRORS-ENVIRONMENTS-001refresh it). Several envs and none named → exit 2ENV_REQUIREDwith the list; nothing is sent (a dry run fails the same way).--env,--prod(new, short for--env PROD),NORBIX_ENV, or a saved default (norbix env use, profileenv) — a saved one is printed on stderr:env: TEST (profile [x]).norbix env …are not checked.whoamishows the env source and the rule.--env.Breaking: on a project with more than one environment, a command without an env now stops (exit 2) instead of running in PROD.
Tests:
npm test992 passed (12 new in tests/env-rule.test.ts: single env no flag → no header; multi env no flag → ENV_REQUIRED, nothing sent; --env TEST → norbix-env: TEST; NORBIX_ENV; --prod; saved env printed; dry run; cache read once / dropped by env use, env delete and the env error; unreadable envs → warning).Task file: /Users/djovaisas/Projects/norbix/docs/tasks/ux-fixes-2026-10-14/env-rule.md (workspace, not a repo). Gateway part shipped in codemash-io/gateway 880be9010.
🤖 Generated with Claude Code