@satori-sh/cli 0.0.9 → 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.
Files changed (2) hide show
  1. package/dist/index.js +12 -14
  2. 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 configFile = Bun.file(configPath);
54
- if (await configFile.exists()) {
55
- return await configFile.json();
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 configPath = join(homedir(), ".config", "satori", "satori.json");
69
- const configFile = Bun.file(configPath);
70
- if (await configFile.exists()) {
71
- const data = await configFile.json();
72
- if (data && typeof data.api_key === "string") {
73
- apiKey = data.api_key;
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.main) {
396
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
399
397
  main();
400
398
  }
401
399
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@satori-sh/cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "CLI tool for Satori memory server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",