Add examples path to system prompt
Agent can now find examples at the documented path for hooks, custom tools, and SDK usage.
This commit is contained in:
@@ -75,6 +75,11 @@ export function getDocsPath(): string {
|
|||||||
return resolve(join(getPackageDir(), "docs"));
|
return resolve(join(getPackageDir(), "docs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get path to examples directory */
|
||||||
|
export function getExamplesPath(): string {
|
||||||
|
return resolve(join(getPackageDir(), "examples"));
|
||||||
|
}
|
||||||
|
|
||||||
/** Get path to CHANGELOG.md */
|
/** Get path to CHANGELOG.md */
|
||||||
export function getChangelogPath(): string {
|
export function getChangelogPath(): string {
|
||||||
return resolve(join(getPackageDir(), "CHANGELOG.md"));
|
return resolve(join(getPackageDir(), "CHANGELOG.md"));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { existsSync, readFileSync } from "fs";
|
import { existsSync, readFileSync } from "fs";
|
||||||
import { join, resolve } from "path";
|
import { join, resolve } from "path";
|
||||||
import { getAgentDir, getDocsPath, getReadmePath } from "../config.js";
|
import { getAgentDir, getDocsPath, getExamplesPath, getReadmePath } from "../config.js";
|
||||||
import type { SkillsSettings } from "./settings-manager.js";
|
import type { SkillsSettings } from "./settings-manager.js";
|
||||||
import { formatSkillsForPrompt, loadSkills, type Skill } from "./skills.js";
|
import { formatSkillsForPrompt, loadSkills, type Skill } from "./skills.js";
|
||||||
import type { ToolName } from "./tools/index.js";
|
import type { ToolName } from "./tools/index.js";
|
||||||
@@ -202,9 +202,10 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin
|
|||||||
return prompt;
|
return prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get absolute paths to documentation
|
// Get absolute paths to documentation and examples
|
||||||
const readmePath = getReadmePath();
|
const readmePath = getReadmePath();
|
||||||
const docsPath = getDocsPath();
|
const docsPath = getDocsPath();
|
||||||
|
const examplesPath = getExamplesPath();
|
||||||
|
|
||||||
// Build tools list based on selected tools
|
// Build tools list based on selected tools
|
||||||
const tools = selectedTools || (["read", "bash", "edit", "write"] as ToolName[]);
|
const tools = selectedTools || (["read", "bash", "edit", "write"] as ToolName[]);
|
||||||
@@ -279,6 +280,7 @@ ${guidelines}
|
|||||||
Documentation:
|
Documentation:
|
||||||
- Main documentation: ${readmePath}
|
- Main documentation: ${readmePath}
|
||||||
- Additional docs: ${docsPath}
|
- Additional docs: ${docsPath}
|
||||||
|
- Examples: ${examplesPath}
|
||||||
- When asked about: custom models/providers (README sufficient), themes (docs/theme.md), skills (docs/skills.md), hooks (docs/hooks.md), custom tools (docs/custom-tools.md), RPC (docs/rpc.md)`;
|
- When asked about: custom models/providers (README sufficient), themes (docs/theme.md), skills (docs/skills.md), hooks (docs/hooks.md), custom tools (docs/custom-tools.md), RPC (docs/rpc.md)`;
|
||||||
|
|
||||||
if (appendSection) {
|
if (appendSection) {
|
||||||
|
|||||||
Reference in New Issue
Block a user