refactor: use sfHome() for SF-WORKFLOW.md paths and skills dir; deduplicate errorMessage
- commands-handlers.js: replace process.env.HOME/.sf/agent/SF-WORKFLOW.md with sfHome() at both call sites (lines 62 and 412) - skills/directory.js: replace process.env.HOME/.sf/skills with sfHome() - tools/tool-helpers.js: remove duplicate errorMessage implementation; re-export getErrorMessage from error-utils.js under the errorMessage alias Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
181a19ac65
commit
d3d7342370
3 changed files with 7 additions and 8 deletions
|
|
@ -27,6 +27,7 @@ import {
|
|||
} from "./doctor.js";
|
||||
import { appendKnowledge, appendOverride } from "./files.js";
|
||||
import { sfRoot } from "./paths.js";
|
||||
import { sfHome } from "./sf-home.js";
|
||||
import { loadPrompt } from "./prompt-loader.js";
|
||||
import { deriveState } from "./state.js";
|
||||
|
||||
|
|
@ -58,9 +59,7 @@ async function fetchLatestVersionForCommand() {
|
|||
export function dispatchDoctorHeal(pi, scope, reportText, structuredIssues) {
|
||||
const workflowPath =
|
||||
process.env.SF_WORKFLOW_PATH ??
|
||||
join(process.env.HOME ?? "~", ".sf", "agent", "SF-WORKFLOW.md");
|
||||
const workflow = readFileSync(workflowPath, "utf-8");
|
||||
const prompt = loadPrompt("doctor-heal", {
|
||||
join(sfHome(), "agent", "SF-WORKFLOW.md");
|
||||
doctorSummary: reportText,
|
||||
structuredIssues,
|
||||
scopeLabel: scope ?? "active milestone / blocking scope",
|
||||
|
|
@ -410,7 +409,7 @@ export async function handleTriage(args, ctx, pi, basePath) {
|
|||
});
|
||||
const workflowPath =
|
||||
process.env.SF_WORKFLOW_PATH ??
|
||||
join(process.env.HOME ?? "~", ".sf", "agent", "SF-WORKFLOW.md");
|
||||
join(sfHome(), "agent", "SF-WORKFLOW.md");
|
||||
const workflow = readFileSync(workflowPath, "utf-8");
|
||||
pi.sendMessage(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,12 +9,13 @@
|
|||
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { sfHome } from "../sf-home.js";
|
||||
|
||||
const SKILL_FILENAME = "SKILL.md";
|
||||
|
||||
export { SKILL_FILENAME };
|
||||
|
||||
const USER_SKILL_DIR = join(process.env.HOME ?? "", ".sf", "skills");
|
||||
const USER_SKILL_DIR = join(sfHome(), "skills");
|
||||
|
||||
export { USER_SKILL_DIR };
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
import { promises as fs, constants as fsConstants } from "node:fs";
|
||||
import { dirname } from "node:path";
|
||||
import { getErrorMessage } from "../error-utils.js";
|
||||
import { appendEvent } from "../workflow-events.js";
|
||||
import { logWarning } from "../workflow-logger.js";
|
||||
import { writeManifest } from "../workflow-manifest.js";
|
||||
|
|
@ -37,9 +38,7 @@ export async function ensureWritableParent(filePath) {
|
|||
*
|
||||
* Consumer: complete-task.js, complete-slice.js error formatting.
|
||||
*/
|
||||
export function errorMessage(error) {
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
export const errorMessage = getErrorMessage;
|
||||
|
||||
/**
|
||||
* Run the standard post-mutation hook: project all projections, write the
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue