@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
25 lines • 1.01 kB
JavaScript
import { readFileSync } from "node:fs";
import { overrideSystemPromptGuidance } from "./guidance.js";
// Measured CLI behavior joins system-prompt arrays into one block and ignores the SDK sentinel,
// so emitting a boundary only pollutes the model prompt with literal garbage.
export function resolveCustomSystemPrompt(prompt) {
return prompt ?? "";
}
export function loadOverrideSystemPrompt(path) {
if (path === undefined) {
throw new Error(overrideSystemPromptGuidance(undefined, "the path is not configured"));
}
let content;
try {
content = readFileSync(path, "utf-8");
}
catch (error) {
const reason = error instanceof Error ? error.message : String(error);
throw new Error(overrideSystemPromptGuidance(path, reason));
}
if (content.trim().length === 0) {
throw new Error(overrideSystemPromptGuidance(path, "the file is empty"));
}
return resolveCustomSystemPrompt(content);
}
//# sourceMappingURL=system-prompt.js.map