@satori-sh/cli 0.0.8 → 0.0.10
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/dist/index.js +12 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49,10 +49,12 @@ async function saveMemoryId(memoryId) {
|
|
|
49
49
|
}
|
|
50
50
|
async function loadConfigFile() {
|
|
51
51
|
try {
|
|
52
|
+
const { promises: fs } = await import("fs");
|
|
52
53
|
const configPath = join(homedir(), ".config", "satori", "satori.json");
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const raw = await fs.readFile(configPath, "utf8");
|
|
55
|
+
const data = JSON.parse(raw);
|
|
56
|
+
if (data && typeof data === "object") {
|
|
57
|
+
return data;
|
|
56
58
|
}
|
|
57
59
|
} catch {
|
|
58
60
|
}
|
|
@@ -65,16 +67,12 @@ async function getConfig() {
|
|
|
65
67
|
let apiKey = null;
|
|
66
68
|
let memoryId = void 0;
|
|
67
69
|
try {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
if (data && typeof data.memory_id === "string") {
|
|
76
|
-
memoryId = data.memory_id;
|
|
77
|
-
}
|
|
70
|
+
const data = await loadConfigFile();
|
|
71
|
+
if (typeof data.api_key === "string") {
|
|
72
|
+
apiKey = data.api_key;
|
|
73
|
+
}
|
|
74
|
+
if (typeof data.memory_id === "string") {
|
|
75
|
+
memoryId = data.memory_id;
|
|
78
76
|
}
|
|
79
77
|
} catch {
|
|
80
78
|
}
|
|
@@ -395,7 +393,7 @@ ${memoryContext.instruction}`);
|
|
|
395
393
|
});
|
|
396
394
|
program.parse();
|
|
397
395
|
}
|
|
398
|
-
if (import.meta.
|
|
396
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
399
397
|
main();
|
|
400
398
|
}
|
|
401
399
|
export {
|