feat(coding-agent): configurable app name and config dir for forks (#95)

- Add piConfig to package.json for app name and config directory
- Consolidate paths.ts into config.ts with clearer naming
- Fix Bun binary detection (changed from %7EBUN to $bunfs)
- Update all hardcoded paths to use config.ts exports
- getThemesDir() for built-in themes, getCustomThemesDir() for user themes
This commit is contained in:
Mario Zechner 2025-12-03 16:18:59 +01:00
parent 9d5fe1fe85
commit e82fb0fc83
17 changed files with 241 additions and 167 deletions

View file

@ -2,8 +2,7 @@ import { type Api, getApiKey, getModels, getProviders, type KnownProvider, type
import { type Static, Type } from "@sinclair/typebox";
import AjvModule from "ajv";
import { existsSync, readFileSync } from "fs";
import { homedir } from "os";
import { join } from "path";
import { getModelsPath } from "./config.js";
import { getOAuthToken, type SupportedOAuthProvider } from "./oauth/index.js";
import { loadOAuthCredentials } from "./oauth/storage.js";
@ -75,11 +74,11 @@ export function resolveApiKey(keyConfig: string): string | undefined {
}
/**
* Load custom models from ~/.pi/agent/models.json
* Load custom models from models.json in agent config dir
* Returns { models, error } - either models array or error message
*/
function loadCustomModels(): { models: Model<Api>[]; error: string | null } {
const configPath = join(homedir(), ".pi", "agent", "models.json");
const configPath = getModelsPath();
if (!existsSync(configPath)) {
return { models: [], error: null };
}