mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 00:51:25 +00:00
feat: enrich system prompt docs guidance
This commit is contained in:
27
src/agents/docs-path.ts
Normal file
27
src/agents/docs-path.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { resolveClawdbotPackageRoot } from "../infra/clawdbot-root.js";
|
||||
|
||||
export async function resolveClawdbotDocsPath(params: {
|
||||
workspaceDir?: string;
|
||||
argv1?: string;
|
||||
cwd?: string;
|
||||
moduleUrl?: string;
|
||||
}): Promise<string | null> {
|
||||
const workspaceDir = params.workspaceDir?.trim();
|
||||
if (workspaceDir) {
|
||||
const workspaceDocs = path.join(workspaceDir, "docs");
|
||||
if (fs.existsSync(workspaceDocs)) return workspaceDocs;
|
||||
}
|
||||
|
||||
const packageRoot = await resolveClawdbotPackageRoot({
|
||||
cwd: params.cwd,
|
||||
argv1: params.argv1,
|
||||
moduleUrl: params.moduleUrl,
|
||||
});
|
||||
if (!packageRoot) return null;
|
||||
|
||||
const packageDocs = path.join(packageRoot, "docs");
|
||||
return fs.existsSync(packageDocs) ? packageDocs : null;
|
||||
}
|
||||
Reference in New Issue
Block a user