@vellumai/cli 0.9.0-dev.202606162156.4bad3e5 → 0.9.0-dev.202606162243.4268db3
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/package.json
CHANGED
|
@@ -87,10 +87,9 @@ export function getCurrentEnvironment(
|
|
|
87
87
|
if (!seed) {
|
|
88
88
|
if (name !== DEFAULT_ENVIRONMENT_NAME) {
|
|
89
89
|
// Warn on stderr instead of throwing, to match the silent-fallback
|
|
90
|
-
// behavior in assistant/src/util/platform.ts:getXdgVellumConfigDirName
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
// writers don't end up in disjoint states on a typo.
|
|
90
|
+
// behavior in assistant/src/util/platform.ts:getXdgVellumConfigDirName,
|
|
91
|
+
// which silently falls back to production; the CLI agrees so neither
|
|
92
|
+
// writer ends up in a disjoint state on a typo.
|
|
94
93
|
process.stderr.write(
|
|
95
94
|
`warning: unknown environment "${name}"; falling back to "${DEFAULT_ENVIRONMENT_NAME}". ` +
|
|
96
95
|
`Add it to packages/environments/src/seeds.ts and rebuild if this was intentional.\n`,
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
import { SEEDS } from "@vellumai/environments";
|
|
6
|
-
|
|
7
|
-
// Drift guard between the two language-level sources of truth for the set of
|
|
8
|
-
// known environment names:
|
|
9
|
-
//
|
|
10
|
-
// 1. packages/environments/src/seeds.ts — SEEDS record (TS source of truth)
|
|
11
|
-
// 2. clients/shared/App/VellumEnvironment.swift — Swift `VellumEnvironment` enum
|
|
12
|
-
//
|
|
13
|
-
// The Swift client can't import the TypeScript package, so the two lists are
|
|
14
|
-
// maintained independently and must be kept in lockstep by hand. This test
|
|
15
|
-
// parses the enum cases out of the Swift source and asserts they agree with
|
|
16
|
-
// SEEDS. Adding an environment means updating both sites.
|
|
17
|
-
|
|
18
|
-
const REPO_ROOT = join(import.meta.dir, "..", "..", "..");
|
|
19
|
-
const SWIFT_ENVIRONMENT = join(
|
|
20
|
-
REPO_ROOT,
|
|
21
|
-
"clients",
|
|
22
|
-
"shared",
|
|
23
|
-
"App",
|
|
24
|
-
"VellumEnvironment.swift",
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Extract the case names declared in the `VellumEnvironment` enum. Matches
|
|
29
|
-
* standalone `case <name>` declaration lines (one identifier, nothing else),
|
|
30
|
-
* which is the enum's own declaration syntax. Switch-statement arms like
|
|
31
|
-
* `case .local:` carry a leading dot and a trailing colon, so they're
|
|
32
|
-
* excluded — the match is anchored to a bare identifier at end of line.
|
|
33
|
-
*/
|
|
34
|
-
function extractSwiftEnumCases(source: string): string[] {
|
|
35
|
-
const names: string[] = [];
|
|
36
|
-
for (const line of source.split("\n")) {
|
|
37
|
-
const match = line.match(/^\s*case\s+([a-zA-Z][a-zA-Z0-9]*)\s*$/);
|
|
38
|
-
if (match) names.push(match[1]!);
|
|
39
|
-
}
|
|
40
|
-
return names;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
describe("environment name drift guard (TS ↔ Swift)", () => {
|
|
44
|
-
const seedNames = new Set(Object.keys(SEEDS));
|
|
45
|
-
|
|
46
|
-
test("clients/shared/App/VellumEnvironment.swift matches SEEDS", () => {
|
|
47
|
-
const source = readFileSync(SWIFT_ENVIRONMENT, "utf8");
|
|
48
|
-
const swiftNames = new Set(extractSwiftEnumCases(source));
|
|
49
|
-
|
|
50
|
-
expect(swiftNames.size).toBeGreaterThan(0);
|
|
51
|
-
expect([...swiftNames].sort()).toEqual([...seedNames].sort());
|
|
52
|
-
});
|
|
53
|
-
});
|