pennyrouter 0.2.8 → 0.2.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.
@@ -1,48 +1,48 @@
1
- import { atomicWrite, backupFile, compactHome, exists, expandHome, readText } from "../state.js";
2
- import { removeYamlKeys, setYamlScalar } from "./shared.js";
3
-
4
- const CONFIG_PATH = "~/.aider.conf.yml";
5
-
6
- export const aiderHarness = {
7
- id: "aider",
8
- name: "Aider",
9
-
10
- async detect() {
11
- return exists(CONFIG_PATH);
12
- },
13
-
14
- async planInstall() {
15
- return {
16
- configPath: expandHome(CONFIG_PATH),
17
- summary: [
18
- `write ${CONFIG_PATH}`,
19
- "set OpenAI-compatible base URL and API key",
20
- "set default model to Penny Custom through LiteLLM naming",
21
- ],
22
- };
23
- },
24
-
25
- async install({ apiKey, gatewayBaseUrl, plan }) {
26
- const backupPath = await backupFile(CONFIG_PATH, "aider");
27
- let next = await readText(CONFIG_PATH, "");
28
- next = setYamlScalar(next, "openai-api-base", `${gatewayBaseUrl}/v1`);
29
- next = setYamlScalar(next, "openai-api-key", apiKey);
30
- next = setYamlScalar(next, "model", "litellm/pennyrouter/auto");
31
- await atomicWrite(CONFIG_PATH, next.endsWith("\n") ? next : `${next}\n`);
32
-
33
- return {
34
- harness: "aider",
35
- config_path: compactHome(plan.configPath),
36
- backup_path: backupPath ? compactHome(backupPath) : null,
37
- installed_at: new Date().toISOString(),
38
- restart: "restart Aider",
39
- changes: { keys: ["openai-api-base", "openai-api-key", "model"] },
40
- };
41
- },
42
-
43
- async uninstall(record) {
44
- const text = await readText(record.config_path, "");
45
- const next = removeYamlKeys(text, ["openai-api-base", "openai-api-key", "model"]);
46
- await atomicWrite(record.config_path, next.endsWith("\n") ? next : `${next}\n`);
47
- },
48
- };
1
+ import { atomicWrite, backupFile, compactHome, exists, expandHome, readText } from "../state.js";
2
+ import { removeYamlKeys, setYamlScalar } from "./shared.js";
3
+
4
+ const CONFIG_PATH = "~/.aider.conf.yml";
5
+
6
+ export const aiderHarness = {
7
+ id: "aider",
8
+ name: "Aider",
9
+
10
+ async detect() {
11
+ return exists(CONFIG_PATH);
12
+ },
13
+
14
+ async planInstall() {
15
+ return {
16
+ configPath: expandHome(CONFIG_PATH),
17
+ summary: [
18
+ `write ${CONFIG_PATH}`,
19
+ "set OpenAI-compatible base URL and API key",
20
+ "set default model to Penny Custom through LiteLLM naming",
21
+ ],
22
+ };
23
+ },
24
+
25
+ async install({ apiKey, gatewayBaseUrl, plan }) {
26
+ const backupPath = await backupFile(CONFIG_PATH, "aider");
27
+ let next = await readText(CONFIG_PATH, "");
28
+ next = setYamlScalar(next, "openai-api-base", `${gatewayBaseUrl}/v1`);
29
+ next = setYamlScalar(next, "openai-api-key", apiKey);
30
+ next = setYamlScalar(next, "model", "litellm/pennyrouter/auto");
31
+ await atomicWrite(CONFIG_PATH, next.endsWith("\n") ? next : `${next}\n`);
32
+
33
+ return {
34
+ harness: "aider",
35
+ config_path: compactHome(plan.configPath),
36
+ backup_path: backupPath ? compactHome(backupPath) : null,
37
+ installed_at: new Date().toISOString(),
38
+ restart: "restart Aider",
39
+ changes: { keys: ["openai-api-base", "openai-api-key", "model"] },
40
+ };
41
+ },
42
+
43
+ async uninstall(record) {
44
+ const text = await readText(record.config_path, "");
45
+ const next = removeYamlKeys(text, ["openai-api-base", "openai-api-key", "model"]);
46
+ await atomicWrite(record.config_path, next.endsWith("\n") ? next : `${next}\n`);
47
+ },
48
+ };