mem-terminal 1.0.0 → 1.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/README.md CHANGED
@@ -13,7 +13,7 @@ mem "docker compose"
13
13
  ## Install
14
14
 
15
15
  ```bash
16
- npm install -g @siddu-lingampelli/mem-search
16
+ npm install -g mem-terminal
17
17
  ```
18
18
 
19
19
  ## Usage
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Returns the path to the PSReadLine history file.
3
- * Checks the env var first (if set and non-empty), then tries
4
- * PowerShell 7 location, then falls back to Windows PowerShell 5.1.
2
+ * Returns the path to the first existing history file.
3
+ * Honors PSREADLINE_HISTORY_FILE if set and non-empty (used for tests/overrides).
4
+ * Falls back to the PowerShell 7 location when no file exists yet, so the
5
+ * caller can decide how to respond (e.g. "No history found").
5
6
  */
6
7
  export declare function getHistoryFilePath(): string;
package/dist/utils.js CHANGED
@@ -1,9 +1,24 @@
1
1
  import { homedir } from "os";
2
2
  import { join } from "path";
3
+ import { existsSync } from "fs";
3
4
  /**
4
- * Returns the path to the PSReadLine history file.
5
- * Checks the env var first (if set and non-empty), then tries
6
- * PowerShell 7 location, then falls back to Windows PowerShell 5.1.
5
+ * Candidate history file locations, in priority order.
6
+ * Covers Windows PowerShell 5.1, PowerShell 7+, and VS Code's integrated
7
+ * PowerShell host. The first existing file wins.
8
+ */
9
+ const CANDIDATES = [
10
+ // Windows PowerShell 5.1 — default
11
+ "AppData/Roaming/Microsoft/Windows/PowerShell/PSReadLine/ConsoleHost_history.txt",
12
+ // PowerShell 7+ (pwsh) — default
13
+ "AppData/Roaming/Microsoft/PowerShell/PSReadLine/ConsoleHost_history.txt",
14
+ // VS Code integrated terminal running PowerShell
15
+ "AppData/Roaming/Microsoft/PowerShell/PSReadLine/Visual Studio Code Host_history.txt",
16
+ ];
17
+ /**
18
+ * Returns the path to the first existing history file.
19
+ * Honors PSREADLINE_HISTORY_FILE if set and non-empty (used for tests/overrides).
20
+ * Falls back to the PowerShell 7 location when no file exists yet, so the
21
+ * caller can decide how to respond (e.g. "No history found").
7
22
  */
8
23
  export function getHistoryFilePath() {
9
24
  const envPath = process.env.PSREADLINE_HISTORY_FILE;
@@ -11,6 +26,13 @@ export function getHistoryFilePath() {
11
26
  return envPath;
12
27
  }
13
28
  const home = homedir();
14
- return join(home, "AppData", "Roaming", "Microsoft", "PowerShell", "PSReadLine", "ConsoleHost_history.txt");
29
+ for (const candidate of CANDIDATES) {
30
+ const full = join(home, candidate);
31
+ if (existsSync(full)) {
32
+ return full;
33
+ }
34
+ }
35
+ // Nothing found yet — return the most common default so the caller can error gracefully.
36
+ return join(home, CANDIDATES[1]);
15
37
  }
16
38
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IACpD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,yBAAyB,CAAC,CAAC;AAC9G,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,GAAa;IAC3B,mCAAmC;IACnC,iFAAiF;IACjF,iCAAiC;IACjC,yEAAyE;IACzE,iDAAiD;IACjD,qFAAqF;CACtF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IACpD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACnC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,yFAAyF;IACzF,OAAO,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mem-terminal",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Search your terminal history instantly. Fuzzy search for PowerShell/PSReadLine history.",
5
5
  "type": "module",
6
6
  "bin": {