@venn-lang/env 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vinicius Borges
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # @venn-lang/env
2
+
3
+ > The `env` namespace: the variables `venn.toml` declares, read as `env.NAME`.
4
+
5
+ This plugin contributes no verbs. `env.NAME` is a read, not a call. What it contributes is the name
6
+ itself, so a file that reads configuration has to say so with `use`, exactly like one that makes a
7
+ request or an assertion. The reader should never have to know which names are magic.
8
+
9
+ ## Install
10
+
11
+ `@venn-lang/env` is part of the stdlib the `venn` CLI and the language server load, so there is nothing
12
+ to install. A file that reads configuration says so:
13
+
14
+ ```ruby
15
+ use "venn/env"
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```toml
21
+ # venn.toml
22
+ [env.local]
23
+ BASE = "http://localhost:3000"
24
+
25
+ [env.staging]
26
+ BASE = "https://staging.example.com"
27
+ ```
28
+
29
+ ```ruby
30
+ # config.vn
31
+ module demo.config
32
+
33
+ use "venn/assert"
34
+ use "venn/env"
35
+
36
+ flow "Config" {
37
+ step "reads the selected environment" {
38
+ log "base=${env.BASE} env=${env.name}"
39
+ expect env.name oneOf ["local", "staging"]
40
+ }
41
+ }
42
+ ```
43
+
44
+ ```bash
45
+ venn test config.vn --env staging
46
+ ```
47
+
48
+ `--env` selects the environment and defaults to `local`. Both `venn run` and `venn test` accept it.
49
+
50
+ ## Names
51
+
52
+ | Name | Where it comes from |
53
+ | --- | --- |
54
+ | `env.name` | The environment that was selected. Always present, whatever the manifest declares. |
55
+ | `env.ANYTHING_ELSE` | The `[env.<name>]` table of `venn.toml`, a dotenv file, or the real process environment. |
56
+
57
+ Values come from three places, lowest precedence first:
58
+
59
+ 1. `[env.<name>]` in `venn.toml`: the documented default, committed to the repository.
60
+ 2. The dotenv files, in order: `.env`, `.env.<name>`, `.env.local`, `.env.<name>.local`, or whatever
61
+ `[env] files` lists instead.
62
+ 3. The environment the process was started with.
63
+
64
+ The real environment wins, because that is how CI passes a token in, and a value set on the command
65
+ line should never lose to a file in the repository. It overrides rather than adds: a name has to be
66
+ declared in one of the first two places for the third to fill it. That is what keeps `PATH` and
67
+ `TEMP` out of the editor's completion, and what stops a typo silently reading something off the
68
+ machine. A value that exists only in CI and is never declared is read through `secrets.*`, which
69
+ needs no declaration and redacts what it returns.
70
+
71
+ ## Diagnostics
72
+
73
+ `env.KEYCLOAK_URL` used to resolve to nothing at all: a typo produced an empty string and a puzzling
74
+ 404 rather than an error. Every `env.*` read is now checked against what the manifest declares,
75
+ including reads written inside a `"${…}"` placeholder.
76
+
77
+ | Code | When |
78
+ | --- | --- |
79
+ | `VN2007` | `env.*` is read in a file that never wrote `use "venn/env"`. |
80
+ | `VN2006` | The name is not declared in `venn.toml`. The nearest declared name is offered: `"env.BAES" is not declared in venn.toml, did you mean "env.BASE"?` |
81
+
82
+ Nothing is reported when the manifest could not be read at all: a wrong error about a variable that
83
+ does exist is worse than no error.
84
+
85
+ ## API
86
+
87
+ | Export | What it is |
88
+ | --- | --- |
89
+ | `envPlugin` (also the default export) | The `PluginDefinition`: namespace `env` and nothing else. No actions, no matchers, no `typeDefs`, no required capability. |
90
+
91
+ The namespace is deliberately empty. The values are the strings `venn.toml` declares, and the check
92
+ above, not a type, is what catches `env.TPYO`.
93
+
94
+ ## See also
95
+
96
+ - [`@venn-lang/cli`](../cli) for `--env`, the manifest and the dotenv files it reads.
97
+ - [`@venn-lang/runtime`](../runtime) for the check that produces `VN2006` and `VN2007`.
98
+ - [`@venn-lang/assert`](../std-assert) for the matchers used beside a configuration read.
@@ -0,0 +1,14 @@
1
+ import { PluginDefinition } from "@venn-lang/sdk";
2
+ //#region src/plugin.d.ts
3
+ /**
4
+ * The `env` plugin: the namespace behind `env.NAME`.
5
+ *
6
+ * It contributes no verbs, because `env.NAME` is a read, not a call. What it
7
+ * contributes is the name itself, so a file that reads configuration has to say
8
+ * so with `use`, exactly like one that makes a request or an assertion. The
9
+ * values come from the `[env.*]` tables of `venn.toml`, chosen with `--env`.
10
+ */
11
+ declare const envPlugin: PluginDefinition;
12
+ //#endregion
13
+ export { envPlugin as default, envPlugin };
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;;;cAUa,WAAW"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import { definePlugin } from "@venn-lang/sdk";
2
+ //#region src/plugin.ts
3
+ /**
4
+ * The `env` plugin: the namespace behind `env.NAME`.
5
+ *
6
+ * It contributes no verbs, because `env.NAME` is a read, not a call. What it
7
+ * contributes is the name itself, so a file that reads configuration has to say
8
+ * so with `use`, exactly like one that makes a request or an assertion. The
9
+ * values come from the `[env.*]` tables of `venn.toml`, chosen with `--env`.
10
+ */
11
+ const envPlugin = definePlugin({
12
+ name: "venn/env",
13
+ version: "0.0.0",
14
+ namespace: "env"
15
+ });
16
+ //#endregion
17
+ export { envPlugin as default, envPlugin };
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import { definePlugin, type PluginDefinition } from \"@venn-lang/sdk\";\n\n/**\n * The `env` plugin: the namespace behind `env.NAME`.\n *\n * It contributes no verbs, because `env.NAME` is a read, not a call. What it\n * contributes is the name itself, so a file that reads configuration has to say\n * so with `use`, exactly like one that makes a request or an assertion. The\n * values come from the `[env.*]` tables of `venn.toml`, chosen with `--env`.\n */\nexport const envPlugin: PluginDefinition = definePlugin({\n name: \"venn/env\",\n version: \"0.0.0\",\n namespace: \"env\",\n});\n"],"mappings":";;;;;;;;;;AAUA,MAAa,YAA8B,aAAa;CACtD,MAAM;CACN,SAAS;CACT,WAAW;AACb,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@venn-lang/env",
3
+ "version": "0.1.0",
4
+ "description": "The env namespace: the variables venn.toml declares, read as env.NAME.",
5
+ "keywords": [
6
+ "venn",
7
+ "testing",
8
+ "e2e",
9
+ "env"
10
+ ],
11
+ "homepage": "https://github.com/venn-lang/venn/tree/main/packages/std-env#readme",
12
+ "bugs": "https://github.com/venn-lang/venn/issues",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/venn-lang/venn.git",
16
+ "directory": "packages/std-env"
17
+ },
18
+ "license": "MIT",
19
+ "author": "Vinicius Borges",
20
+ "type": "module",
21
+ "sideEffects": false,
22
+ "exports": {
23
+ ".": {
24
+ "development": "./src/index.ts",
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "src",
33
+ "!src/**/*.test.ts",
34
+ "!src/**/*.suite.ts"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "@venn-lang/sdk": "0.1.0"
41
+ },
42
+ "devDependencies": {
43
+ "tsdown": "^0.22.14",
44
+ "typescript": "^7.0.2",
45
+ "vitest": "^4.1.10"
46
+ },
47
+ "scripts": {
48
+ "build": "tsdown",
49
+ "test": "vitest run",
50
+ "typecheck": "tsc --noEmit"
51
+ }
52
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ // The `env` namespace, read from venn.toml.
2
+ export { envPlugin, envPlugin as default } from "./plugin.js";
package/src/plugin.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { definePlugin, type PluginDefinition } from "@venn-lang/sdk";
2
+
3
+ /**
4
+ * The `env` plugin: the namespace behind `env.NAME`.
5
+ *
6
+ * It contributes no verbs, because `env.NAME` is a read, not a call. What it
7
+ * contributes is the name itself, so a file that reads configuration has to say
8
+ * so with `use`, exactly like one that makes a request or an assertion. The
9
+ * values come from the `[env.*]` tables of `venn.toml`, chosen with `--env`.
10
+ */
11
+ export const envPlugin: PluginDefinition = definePlugin({
12
+ name: "venn/env",
13
+ version: "0.0.0",
14
+ namespace: "env",
15
+ });