pi-interview 0.3.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/settings.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { homedir } from "node:os";
4
+
5
+ export const SETTINGS_PATH = join(homedir(), ".pi", "agent", "settings.json");
6
+
7
+ export interface InterviewThemeSettings {
8
+ mode?: "auto" | "light" | "dark";
9
+ name?: string;
10
+ lightPath?: string;
11
+ darkPath?: string;
12
+ toggleHotkey?: string;
13
+ }
14
+
15
+ export interface InterviewSettings {
16
+ browser?: string;
17
+ timeout?: number;
18
+ port?: number;
19
+ theme?: InterviewThemeSettings;
20
+ }
21
+
22
+ export function loadSettings(): InterviewSettings {
23
+ try {
24
+ const data = JSON.parse(readFileSync(SETTINGS_PATH, "utf-8"));
25
+ return (data.interview as InterviewSettings) ?? {};
26
+ } catch {
27
+ return {};
28
+ }
29
+ }