@f5-sales-demo/pi-utils 23.10.17 → 24.0.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/package.json +2 -2
- package/src/xcsh-context-resolver.ts +13 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-utils",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "24.0.0",
|
|
5
5
|
"description": "Shared utilities for pi packages",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/bun": "1.4.4",
|
|
44
|
-
"@f5-sales-demo/pi-natives": "
|
|
44
|
+
"@f5-sales-demo/pi-natives": "24.0.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"bun": ">=1.4.4"
|
|
@@ -217,7 +217,18 @@ export class ContextResolver {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
resolve(cwd: string): Promise<ResolvedContext | null> {
|
|
220
|
-
// Priority 1:
|
|
220
|
+
// Priority 1: local .xcsh/contexts/
|
|
221
|
+
const localDir = this.findLocalContextsDir(cwd);
|
|
222
|
+
if (localDir) {
|
|
223
|
+
const localResult = this.#resolveFromDir("local", cwd);
|
|
224
|
+
if (localResult) return Promise.resolve(localResult);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Priority 2: global saved selection.
|
|
228
|
+
const global = this.#resolveGlobal();
|
|
229
|
+
if (global) return Promise.resolve(global);
|
|
230
|
+
|
|
231
|
+
// Fallback: environment variables, only when no saved context resolves
|
|
221
232
|
const envUrl = process.env.XCSH_API_URL;
|
|
222
233
|
const envToken = process.env.XCSH_API_TOKEN;
|
|
223
234
|
if (envUrl && envToken) {
|
|
@@ -235,15 +246,7 @@ export class ContextResolver {
|
|
|
235
246
|
);
|
|
236
247
|
}
|
|
237
248
|
|
|
238
|
-
|
|
239
|
-
const localDir = this.findLocalContextsDir(cwd);
|
|
240
|
-
if (localDir) {
|
|
241
|
-
const localResult = this.#resolveFromDir("local", cwd);
|
|
242
|
-
if (localResult) return Promise.resolve(localResult);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Priority 3: global ~/.config/xcsh/contexts/
|
|
246
|
-
return Promise.resolve(this.#resolveGlobal());
|
|
249
|
+
return Promise.resolve(null);
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
/** Resolve an explicit identity without changing any saved active pointer. */
|