mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
- Add setEditorText() and getEditorText() to HookUIContext for prompt generator pattern - custom() now accepts async factories for fire-and-forget work - Add CancellableLoader component to tui package - Add BorderedLoader component for hooks with cancel UI - Export HookAPI, HookContext, HookFactory from main package - Update all examples to import from packages instead of relative paths - Update hooks.md and custom-tools.md documentation fixes #350
36 lines
892 B
TypeScript
36 lines
892 B
TypeScript
/**
|
|
* Context Files (AGENTS.md)
|
|
*
|
|
* Context files provide project-specific instructions loaded into the system prompt.
|
|
*/
|
|
|
|
import { createAgentSession, discoverContextFiles, SessionManager } from "@mariozechner/pi-coding-agent";
|
|
|
|
// Discover AGENTS.md files walking up from cwd
|
|
const discovered = discoverContextFiles();
|
|
console.log("Discovered context files:");
|
|
for (const file of discovered) {
|
|
console.log(` - ${file.path} (${file.content.length} chars)`);
|
|
}
|
|
|
|
// Use custom context files
|
|
await createAgentSession({
|
|
contextFiles: [
|
|
...discovered,
|
|
{
|
|
path: "/virtual/AGENTS.md",
|
|
content: `# Project Guidelines
|
|
|
|
## Code Style
|
|
- Use TypeScript strict mode
|
|
- No any types
|
|
- Prefer const over let`,
|
|
},
|
|
],
|
|
sessionManager: SessionManager.inMemory(),
|
|
});
|
|
|
|
console.log(`Session created with ${discovered.length + 1} context files`);
|
|
|
|
// Disable context files:
|
|
// contextFiles: []
|