Files
linear-coding-agent/prompts.py
David Blanc Brioir 2e33637dae Update framework configuration and clean up obsolete specs
Configuration updates:
- Added .env.example template for environment variables
- Updated README.md with better setup instructions (.env usage)
- Enhanced .claude/settings.local.json with additional Bash permissions
- Added .claude/CLAUDE.md framework documentation

Spec cleanup:
- Removed obsolete spec files (language_selection, mistral_extensible, template, theme_customization)
- Consolidated app_spec.txt (Claude Clone example)
- Added app_spec_model.txt as reference template
- Added app_spec_library_rag_types_docs.txt
- Added coding_prompt_library.md

Framework improvements:
- Updated agent.py, autonomous_agent_demo.py, client.py with minor fixes
- Enhanced dockerize_my_project.py
- Updated prompts (initializer, initializer_bis) with better guidance
- Added docker-compose.my_project.yml example

This commit consolidates improvements made during development sessions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 12:53:14 +01:00

69 lines
2.2 KiB
Python

"""
Prompt Loading Utilities
========================
Functions for loading prompt templates from the prompts directory.
"""
import shutil
from pathlib import Path
PROMPTS_DIR = Path(__file__).parent / "prompts"
def load_prompt(name: str) -> str:
"""Load a prompt template from the prompts directory."""
prompt_path = PROMPTS_DIR / f"{name}.md"
return prompt_path.read_text()
def get_initializer_prompt() -> str:
"""Load the initializer prompt."""
return load_prompt("initializer_prompt")
def get_coding_prompt() -> str:
"""Load the coding agent prompt."""
return load_prompt("coding_prompt")
def get_coding_prompt_library() -> str:
"""Load the library-specific coding agent prompt (for type safety & documentation projects)."""
return load_prompt("coding_prompt_library")
def copy_spec_to_project(project_dir: Path) -> None:
"""Copy the app spec file into the project directory for the agent to read."""
spec_source = PROMPTS_DIR / "app_spec.txt"
spec_dest = project_dir / "app_spec.txt"
if not spec_dest.exists():
shutil.copy(spec_source, spec_dest)
print("Copied app_spec.txt to project directory")
############################################################################################
# New specifications added by davebb
############################################################################################
def get_initializer_bis_prompt() -> str:
"""Load the initializer bis prompt for adding new specifications."""
return load_prompt("initializer_bis_prompt")
def copy_new_spec_to_project(project_dir: Path, new_spec_filename: str) -> None:
"""
Copy a new specification file into the project directory for the agent to read.
Args:
project_dir: Project directory path
new_spec_filename: Name of the new spec file (e.g., "app_spec_new1.txt")
"""
spec_source = PROMPTS_DIR / new_spec_filename
if not spec_source.exists():
raise FileNotFoundError(f"New specification file not found: {spec_source}")
spec_dest = project_dir / new_spec_filename
shutil.copy(spec_source, spec_dest)
print(f"Copied {new_spec_filename} to project directory")