mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 14:01:06 +00:00
feat(coding-agent): add --no-tools flag to disable built-in tools
Add --no-tools flag that allows starting pi without any built-in tools, enabling extension-only tool setups (e.g., pi-ssh-remote). - Add --no-tools flag to CLI args parsing - Handle --tools '' (empty string) as equivalent to no tools - Fix system prompt to not show READ-ONLY mode when no tools (extensions may provide write capabilities) - Add tests for new flag and system prompt behavior fixes #555
This commit is contained in:
parent
cfa63c255d
commit
8f5523ed56
6 changed files with 123 additions and 15 deletions
|
|
@ -209,7 +209,7 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin
|
|||
|
||||
// Build tools list based on selected tools
|
||||
const tools = selectedTools || (["read", "bash", "edit", "write"] as ToolName[]);
|
||||
const toolsList = tools.map((t) => `- ${t}: ${toolDescriptions[t]}`).join("\n");
|
||||
const toolsList = tools.length > 0 ? tools.map((t) => `- ${t}: ${toolDescriptions[t]}`).join("\n") : "(none)";
|
||||
|
||||
// Build guidelines based on which tools are actually available
|
||||
const guidelinesList: string[] = [];
|
||||
|
|
@ -222,8 +222,9 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin
|
|||
const hasLs = tools.includes("ls");
|
||||
const hasRead = tools.includes("read");
|
||||
|
||||
// Read-only mode notice (no bash, edit, or write)
|
||||
if (!hasBash && !hasEdit && !hasWrite) {
|
||||
// Read-only mode notice (only if we have some read-only tools but no write tools)
|
||||
// Skip this if there are no built-in tools at all (extensions may provide write capabilities)
|
||||
if (tools.length > 0 && !hasBash && !hasEdit && !hasWrite) {
|
||||
guidelinesList.push("You are in READ-ONLY mode - you cannot modify files or execute arbitrary commands");
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +266,9 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin
|
|||
|
||||
// Always include these
|
||||
guidelinesList.push("Be concise in your responses");
|
||||
guidelinesList.push("Show file paths clearly when working with files");
|
||||
if (tools.length > 0) {
|
||||
guidelinesList.push("Show file paths clearly when working with files");
|
||||
}
|
||||
|
||||
const guidelines = guidelinesList.map((g) => `- ${g}`).join("\n");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue