feat(coding-agent): export project config dir name
This commit is contained in:
@@ -42,7 +42,7 @@ import { existsSync, readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { Api, Model } from "@earendil-works/pi-ai";
|
||||
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
||||
import { DynamicBorder, getAgentDir } from "@earendil-works/pi-coding-agent";
|
||||
import { CONFIG_DIR_NAME, DynamicBorder, getAgentDir } from "@earendil-works/pi-coding-agent";
|
||||
import { Container, Key, type SelectItem, SelectList, Text } from "@earendil-works/pi-tui";
|
||||
|
||||
// Preset configuration
|
||||
@@ -69,7 +69,7 @@ interface PresetsConfig {
|
||||
*/
|
||||
function loadPresets(cwd: string): PresetsConfig {
|
||||
const globalPath = join(getAgentDir(), "presets.json");
|
||||
const projectPath = join(cwd, ".pi", "presets.json");
|
||||
const projectPath = join(cwd, CONFIG_DIR_NAME, "presets.json");
|
||||
|
||||
let globalPresets: PresetsConfig = {};
|
||||
let projectPresets: PresetsConfig = {};
|
||||
@@ -200,7 +200,10 @@ export default function presetExtension(pi: ExtensionAPI) {
|
||||
const presetNames = Object.keys(presets);
|
||||
|
||||
if (presetNames.length === 0) {
|
||||
ctx.ui.notify("No presets defined. Add presets to ~/.pi/agent/presets.json or .pi/presets.json", "warning");
|
||||
ctx.ui.notify(
|
||||
`No presets defined. Add presets to ${join(getAgentDir(), "presets.json")} or ${join(ctx.cwd, CONFIG_DIR_NAME, "presets.json")}`,
|
||||
"warning",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -308,7 +311,10 @@ export default function presetExtension(pi: ExtensionAPI) {
|
||||
async function cyclePreset(ctx: ExtensionContext): Promise<void> {
|
||||
const presetNames = getPresetOrder();
|
||||
if (presetNames.length === 0) {
|
||||
ctx.ui.notify("No presets defined. Add presets to ~/.pi/agent/presets.json or .pi/presets.json", "warning");
|
||||
ctx.ui.notify(
|
||||
`No presets defined. Add presets to ${join(getAgentDir(), "presets.json")} or ${join(ctx.cwd, CONFIG_DIR_NAME, "presets.json")}`,
|
||||
"warning",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user