@f5xc-salesdemos/pi-utils 15.8.0 → 15.9.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/dirs.ts +27 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5xc-salesdemos/pi-utils",
4
- "version": "15.8.0",
4
+ "version": "15.9.1",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://github.com/f5xc-salesdemos/xcsh",
7
7
  "author": "Can Boluk",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/bun": "^1.3",
41
- "@f5xc-salesdemos/pi-natives": "15.8.0"
41
+ "@f5xc-salesdemos/pi-natives": "15.9.1"
42
42
  },
43
43
  "engines": {
44
44
  "bun": ">=1.3.7"
package/src/dirs.ts CHANGED
@@ -436,3 +436,30 @@ export function getSSHConfigPath(scope: "user" | "project", cwd: string = getPro
436
436
  }
437
437
  return path.join(getProjectAgentDir(cwd), "ssh.json");
438
438
  }
439
+
440
+ // =============================================================================
441
+ // F5 Distributed Cloud (F5 XC) profile paths
442
+ // =============================================================================
443
+
444
+ const F5XC_DIR_NAME = "f5xc";
445
+
446
+ /** Get the F5 XC config directory ($XDG_CONFIG_HOME/f5xc or ~/.config/f5xc). */
447
+ export function getF5XCConfigDir(): string {
448
+ const xdgConfig = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
449
+ return path.join(xdgConfig, F5XC_DIR_NAME);
450
+ }
451
+
452
+ /** Get the F5 XC profiles directory (~/.config/f5xc/profiles). */
453
+ export function getF5XCProfilesDir(): string {
454
+ return path.join(getF5XCConfigDir(), "profiles");
455
+ }
456
+
457
+ /** Get the path to the active profile indicator file (~/.config/f5xc/active_profile). */
458
+ export function getF5XCActiveProfilePath(): string {
459
+ return path.join(getF5XCConfigDir(), "active_profile");
460
+ }
461
+
462
+ /** Get the path to a specific profile JSON file (~/.config/f5xc/profiles/<name>.json). */
463
+ export function getF5XCProfilePath(name: string): string {
464
+ return path.join(getF5XCProfilesDir(), `${name}.json`);
465
+ }