mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 12:03:23 +00:00
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
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { buildSystemPrompt } from "../src/core/system-prompt.js";
|
|
|
|
describe("buildSystemPrompt", () => {
|
|
describe("empty tools", () => {
|
|
test("does not show READ-ONLY mode when no built-in tools", () => {
|
|
const prompt = buildSystemPrompt({
|
|
selectedTools: [],
|
|
contextFiles: [],
|
|
skills: [],
|
|
});
|
|
|
|
// Should not mention READ-ONLY mode when there are no tools
|
|
// (extensions may provide write capabilities)
|
|
expect(prompt).not.toContain("READ-ONLY mode");
|
|
});
|
|
|
|
test("shows (none) for empty tools list", () => {
|
|
const prompt = buildSystemPrompt({
|
|
selectedTools: [],
|
|
contextFiles: [],
|
|
skills: [],
|
|
});
|
|
|
|
expect(prompt).toContain("Available tools:\n(none)");
|
|
});
|
|
|
|
test("does not show file paths guideline when no tools", () => {
|
|
const prompt = buildSystemPrompt({
|
|
selectedTools: [],
|
|
contextFiles: [],
|
|
skills: [],
|
|
});
|
|
|
|
expect(prompt).not.toContain("Show file paths clearly");
|
|
});
|
|
});
|
|
|
|
describe("read-only tools", () => {
|
|
test("shows READ-ONLY mode when only read tools available", () => {
|
|
const prompt = buildSystemPrompt({
|
|
selectedTools: ["read", "grep", "find", "ls"],
|
|
contextFiles: [],
|
|
skills: [],
|
|
});
|
|
|
|
expect(prompt).toContain("READ-ONLY mode");
|
|
});
|
|
});
|
|
|
|
describe("default tools", () => {
|
|
test("does not show READ-ONLY mode with default tools", () => {
|
|
const prompt = buildSystemPrompt({
|
|
contextFiles: [],
|
|
skills: [],
|
|
});
|
|
|
|
expect(prompt).not.toContain("READ-ONLY mode");
|
|
expect(prompt).toContain("- read:");
|
|
expect(prompt).toContain("- bash:");
|
|
expect(prompt).toContain("- edit:");
|
|
expect(prompt).toContain("- write:");
|
|
});
|
|
});
|
|
});
|