sarangai-cli 1.0.0 → 1.0.2
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.cjs +9 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,23 +35,24 @@ var import_path2 = __toESM(require("path"));
|
|
|
35
35
|
var import_fs = __toESM(require("fs"));
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
37
|
var import_os = __toESM(require("os"));
|
|
38
|
-
var
|
|
38
|
+
var CONFIG_FILE = import_path.default.join(import_os.default.homedir(), ".sarangairc");
|
|
39
39
|
function getConfig() {
|
|
40
40
|
try {
|
|
41
|
-
if (import_fs.default.existsSync(
|
|
42
|
-
|
|
41
|
+
if (import_fs.default.existsSync(CONFIG_FILE)) {
|
|
42
|
+
const raw = import_fs.default.readFileSync(CONFIG_FILE, "utf-8");
|
|
43
|
+
return JSON.parse(raw);
|
|
43
44
|
}
|
|
44
45
|
} catch {
|
|
45
46
|
}
|
|
46
47
|
return {
|
|
47
|
-
baseUrl: "https://
|
|
48
|
-
defaultModel: "
|
|
48
|
+
baseUrl: "https://idshop.or.id",
|
|
49
|
+
defaultModel: "minimax/minimax-m2.7"
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
function saveConfig(
|
|
52
|
+
function saveConfig(newConfig) {
|
|
52
53
|
const current = getConfig();
|
|
53
|
-
const
|
|
54
|
-
import_fs.default.writeFileSync(
|
|
54
|
+
const merged = { ...current, ...newConfig };
|
|
55
|
+
import_fs.default.writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2), "utf-8");
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
// src/index.ts
|