mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 11:02:17 +00:00
- Add ResourceLoader interface and DefaultResourceLoader implementation - Add PackageManager for npm/git extension sources with install/remove/update - Add session.reload() and session.bindExtensions() APIs - Add /reload command in interactive mode - Add CLI flags: --skill, --theme, --prompt-template, --no-themes, --no-prompt-templates - Add pi install/remove/update commands for extension management - Refactor settings.json to use arrays for skills, prompts, themes - Remove legacy SkillsSettings source flags and filters - Update SDK examples and documentation for ResourceLoader pattern - Add theme registration and loadThemeFromPath for dynamic themes - Add getShellEnv to include bin dir in PATH for bash commands
39 lines
985 B
TypeScript
39 lines
985 B
TypeScript
/**
|
|
* Context Files (AGENTS.md)
|
|
*
|
|
* Context files provide project-specific instructions loaded into the system prompt.
|
|
*/
|
|
|
|
import { createAgentSession, DefaultResourceLoader, SessionManager } from "@mariozechner/pi-coding-agent";
|
|
|
|
const loader = new DefaultResourceLoader({
|
|
agentsFilesOverride: (current) => ({
|
|
agentsFiles: [
|
|
...current.agentsFiles,
|
|
{
|
|
path: "/virtual/AGENTS.md",
|
|
content: `# Project Guidelines
|
|
|
|
## Code Style
|
|
- Use TypeScript strict mode
|
|
- No any types
|
|
- Prefer const over let`,
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
await loader.reload();
|
|
|
|
// Discover AGENTS.md files walking up from cwd
|
|
const discovered = loader.getAgentsFiles().agentsFiles;
|
|
console.log("Discovered context files:");
|
|
for (const file of discovered) {
|
|
console.log(` - ${file.path} (${file.content.length} chars)`);
|
|
}
|
|
|
|
await createAgentSession({
|
|
resourceLoader: loader,
|
|
sessionManager: SessionManager.inMemory(),
|
|
});
|
|
|
|
console.log(`Session created with ${discovered.length + 1} context files`);
|