mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
## CHANGES
- Removed PROJECT_FILES_CONTEXT from wizard system prompt template 🗑️ - Added instruction to examine working directory before responding 🔍 - Simplified discovery approach to look for file patterns directly 📁 - Removed ProjectFileInfo interface and related functionality 🧹 - Cleaned up projectFiles parameter from configuration interfaces ✨ - Removed buildProjectFilesContext function and file analysis logic 🎯 - Updated system prompt to rely on direct file examination 👀 - Streamlined template variable replacement in prompt generation 🚀 - Maintained existing docs functionality for session continuity 📝 - Improved clarity of file-based project type detection approach 💡
This commit is contained in:
@@ -11,8 +11,6 @@ You will ONLY create or modify files within this directory:
|
||||
|
||||
Do not reference, create, or modify files outside this path.
|
||||
|
||||
{{PROJECT_FILES_CONTEXT}}
|
||||
|
||||
## Your Goal
|
||||
|
||||
Through a brief, focused conversation:
|
||||
@@ -23,8 +21,10 @@ Through a brief, focused conversation:
|
||||
|
||||
## Discovery Approach
|
||||
|
||||
**IMPORTANT: Before your first response, examine the working directory to see what files exist.**
|
||||
|
||||
**If the project directory contains existing files:**
|
||||
- Analyze the file structure and any recognizable patterns (package.json, Cargo.toml, requirements.txt, README, etc.)
|
||||
- Look for recognizable patterns (package.json, Cargo.toml, requirements.txt, README, etc.)
|
||||
- Make an educated assessment of what the project is based on the files present
|
||||
- Start the conversation by presenting your assessment: "Based on the files I see, this looks like a [type of project] using [technologies]. Is that right?"
|
||||
- Ask clarifying questions about what the user wants to accomplish with this existing project
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
type StructuredAgentResponse,
|
||||
type ParsedResponse,
|
||||
type ExistingDocument,
|
||||
type ProjectFileInfo,
|
||||
READY_CONFIDENCE_THRESHOLD,
|
||||
} from './wizardPrompts';
|
||||
|
||||
@@ -32,8 +31,6 @@ export interface ConversationConfig {
|
||||
projectName: string;
|
||||
/** Existing Auto Run documents (when continuing from previous session) */
|
||||
existingDocs?: ExistingDocument[];
|
||||
/** Files in the project directory for context (auto-fetched if not provided) */
|
||||
projectFiles?: ProjectFileInfo[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,16 +45,6 @@ export interface ExistingDocument {
|
||||
content: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Project file info for context
|
||||
*/
|
||||
export interface ProjectFileInfo {
|
||||
/** File name */
|
||||
name: string;
|
||||
/** Whether it's a directory */
|
||||
isDirectory: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for generating the system prompt
|
||||
*/
|
||||
@@ -65,8 +55,6 @@ export interface SystemPromptConfig {
|
||||
agentPath: string;
|
||||
/** Existing Auto Run documents (when continuing from previous session) */
|
||||
existingDocs?: ExistingDocument[];
|
||||
/** Files in the project directory for context */
|
||||
projectFiles?: ProjectFileInfo[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,66 +99,6 @@ const DEFAULT_CONFIDENCE = 20;
|
||||
*/
|
||||
export const READY_CONFIDENCE_THRESHOLD = 80;
|
||||
|
||||
/**
|
||||
* Build the project files context section for the system prompt
|
||||
*/
|
||||
function buildProjectFilesContext(projectFiles?: ProjectFileInfo[]): string {
|
||||
if (!projectFiles || projectFiles.length === 0) {
|
||||
return '## Project Directory\n\nThe project directory is empty or contains no files yet.';
|
||||
}
|
||||
|
||||
// Filter out hidden files and common non-essential items for cleaner context
|
||||
const relevantFiles = projectFiles.filter(f => !f.name.startsWith('.') ||
|
||||
// Keep important dotfiles
|
||||
['.gitignore', '.env.example', '.eslintrc', '.prettierrc', '.editorconfig'].includes(f.name)
|
||||
);
|
||||
|
||||
if (relevantFiles.length === 0) {
|
||||
return '## Project Directory\n\nThe project directory contains only hidden files.';
|
||||
}
|
||||
|
||||
// Separate directories and files
|
||||
const dirs = relevantFiles.filter(f => f.isDirectory).map(f => f.name);
|
||||
const files = relevantFiles.filter(f => !f.isDirectory).map(f => f.name);
|
||||
|
||||
let context = '## Project Directory\n\nThe project directory contains the following files and folders:\n\n';
|
||||
|
||||
if (dirs.length > 0) {
|
||||
context += '**Directories:**\n';
|
||||
context += dirs.map(d => `- ${d}/`).join('\n');
|
||||
context += '\n\n';
|
||||
}
|
||||
|
||||
if (files.length > 0) {
|
||||
context += '**Files:**\n';
|
||||
context += files.map(f => `- ${f}`).join('\n');
|
||||
context += '\n';
|
||||
}
|
||||
|
||||
// Add hints about what these files might indicate
|
||||
const hints: string[] = [];
|
||||
if (files.includes('package.json')) hints.push('Node.js/JavaScript project');
|
||||
if (files.includes('Cargo.toml')) hints.push('Rust project');
|
||||
if (files.includes('requirements.txt') || files.includes('pyproject.toml') || files.includes('setup.py')) hints.push('Python project');
|
||||
if (files.includes('go.mod')) hints.push('Go project');
|
||||
if (files.includes('pom.xml') || files.includes('build.gradle')) hints.push('Java project');
|
||||
if (files.includes('Gemfile')) hints.push('Ruby project');
|
||||
if (files.includes('composer.json')) hints.push('PHP project');
|
||||
if (files.includes('pubspec.yaml')) hints.push('Dart/Flutter project');
|
||||
if (files.includes('CMakeLists.txt') || files.includes('Makefile')) hints.push('C/C++ project');
|
||||
if (dirs.includes('src')) hints.push('source code in src/');
|
||||
if (dirs.includes('lib')) hints.push('library code');
|
||||
if (dirs.includes('test') || dirs.includes('tests') || dirs.includes('__tests__')) hints.push('has test suite');
|
||||
if (files.includes('README.md') || files.includes('README')) hints.push('has documentation');
|
||||
if (files.includes('Dockerfile') || files.includes('docker-compose.yml')) hints.push('Docker containerized');
|
||||
|
||||
if (hints.length > 0) {
|
||||
context += '\n**Indicators:** ' + hints.join(', ');
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the system prompt for the wizard conversation
|
||||
*
|
||||
@@ -178,7 +106,7 @@ function buildProjectFilesContext(projectFiles?: ProjectFileInfo[]): string {
|
||||
* @returns The complete system prompt for the agent
|
||||
*/
|
||||
export function generateSystemPrompt(config: SystemPromptConfig): string {
|
||||
const { agentName, agentPath, existingDocs, projectFiles } = config;
|
||||
const { agentName, agentPath, existingDocs } = config;
|
||||
const projectName = agentName || 'this project';
|
||||
|
||||
// Build existing docs section if continuing from previous session
|
||||
@@ -188,20 +116,15 @@ export function generateSystemPrompt(config: SystemPromptConfig): string {
|
||||
existingDocsSection = wizardSystemContinuationPrompt.replace('{{EXISTING_DOCS}}', docsContent);
|
||||
}
|
||||
|
||||
// Build project files context
|
||||
const projectFilesContext = buildProjectFilesContext(projectFiles);
|
||||
|
||||
// First, handle wizard-specific variables that have different semantics
|
||||
// from the central template system. We do this BEFORE the central function
|
||||
// so they take precedence over central defaults.
|
||||
// - PROJECT_NAME: wizard uses user-provided agentName (or "this project"),
|
||||
// not the path-derived name from the central system
|
||||
// - READY_CONFIDENCE_THRESHOLD: wizard-specific constant
|
||||
// - PROJECT_FILES_CONTEXT: the directory listing for existing project detection
|
||||
let prompt = wizardSystemPrompt
|
||||
.replace(/\{\{PROJECT_NAME\}\}/gi, projectName)
|
||||
.replace(/\{\{READY_CONFIDENCE_THRESHOLD\}\}/gi, String(READY_CONFIDENCE_THRESHOLD))
|
||||
.replace(/\{\{PROJECT_FILES_CONTEXT\}\}/gi, projectFilesContext);
|
||||
.replace(/\{\{READY_CONFIDENCE_THRESHOLD\}\}/gi, String(READY_CONFIDENCE_THRESHOLD));
|
||||
|
||||
// Build template context for remaining variables (date/time, etc.)
|
||||
const templateContext: TemplateContext = {
|
||||
|
||||
Reference in New Issue
Block a user