@f5xc-salesdemos/pi-utils 15.7.0 → 15.9.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/dirs.ts +40 -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.7.0",
4
+ "version": "15.9.0",
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.7.0"
41
+ "@f5xc-salesdemos/pi-natives": "15.9.0"
42
42
  },
43
43
  "engines": {
44
44
  "bun": ">=1.3.7"
package/src/dirs.ts CHANGED
@@ -89,6 +89,19 @@ export function setProjectDir(dir: string): void {
89
89
  process.chdir(projectDir);
90
90
  }
91
91
 
92
+ /** Shell-tracked working directory (follows persistent-shell cd). */
93
+ let shellPwd = projectDir;
94
+
95
+ /** Get the shell's current working directory (may differ from Agent CWD). */
96
+ export function getShellPwd(): string {
97
+ return shellPwd;
98
+ }
99
+
100
+ /** Update the shell's tracked working directory. Does NOT change Agent CWD. */
101
+ export function setShellPwd(dir: string): void {
102
+ shellPwd = standardizeMacOSPath(path.resolve(dir));
103
+ }
104
+
92
105
  /** Get the config directory name relative to home (e.g. ".xcsh" or PI_CONFIG_DIR override). */
93
106
  export function getConfigDirName(): string {
94
107
  return process.env.PI_CONFIG_DIR || CONFIG_DIR_NAME;
@@ -423,3 +436,30 @@ export function getSSHConfigPath(scope: "user" | "project", cwd: string = getPro
423
436
  }
424
437
  return path.join(getProjectAgentDir(cwd), "ssh.json");
425
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
+ }