### Setup Development Environment Source: https://github.com/teknologika/spec-server/blob/main/README.md Clones the spec-server repository and installs development dependencies. ```bash git clone https://github.com/teknologika/spec-server.git cd spec-server pip install -e ".[dev]" ``` -------------------------------- ### Verify spec-server Installation Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Checks if spec-server is installed by listing installed packages and searching for 'spec-server'. Also demonstrates how to run spec-server using the module execution. ```bash pip list | grep spec-server ``` ```bash python -m spec_server ``` -------------------------------- ### Install/Upgrade spec-server Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Installs or upgrades the spec-server package, including all necessary dependencies, or installs from source with development dependencies. ```bash pip install --upgrade spec-server ``` ```bash pip install -e ".[dev]" ``` -------------------------------- ### LLM Interaction Examples Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md Examples of prompts to guide LLM interactions for iteration, providing rationale, and highlighting trade-offs in a development context. ```text Remember that we can iterate on these [requirements/design/tasks] as needed. It's better to get feedback early rather than proceeding with incorrect assumptions. ``` ```text I'm suggesting this [requirement/design approach/task breakdown] because [rationale]. This helps address [specific need or concern you mentioned]. ``` ```text There's a trade-off to consider here: - Option A offers [benefit] but has [drawback] - Option B offers [benefit] but has [drawback] What's more important for your specific needs? ``` -------------------------------- ### Install spec-server Source: https://github.com/teknologika/spec-server/blob/main/README.md Provides instructions for installing the spec-server package, both from PyPI and from source. ```bash pip install spec-server ``` ```bash git clone https://github.com/teknologika/spec-server.git cd spec-server pip install -e . ``` -------------------------------- ### Force Reinstall spec-server Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Reinstalls spec-server forcefully, ensuring that any corrupted installations are overwritten and entry points are correctly set up. ```bash pip install --force-reinstall spec-server ``` -------------------------------- ### Configuration File Example Source: https://github.com/teknologika/spec-server/blob/main/README.md An example of the optional `spec-server.json` file for configuring various aspects of the spec-server. ```json { "specs_dir": "specs", "auto_detect_workspace": true, "workspace_specs_dir": ".specs", "host": "127.0.0.1", "port": 8000, "transport": "stdio", "log_level": "INFO", "auto_backup": true, "cache_enabled": true } ``` -------------------------------- ### Manage PATH for Scripts Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Finds the user base directory where pip installs scripts and demonstrates how to add this directory to the system's PATH environment variable. ```bash # Find where pip installs scripts python -m site --user-base # Add to PATH if needed export PATH="$PATH:$(python -m site --user-base)/bin" ``` -------------------------------- ### File System and Backup Configuration Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Details environment variables and commands related to file system access and backup configuration for the spec-server. ```APIDOC File System & Backup Configuration: - `SPEC_SERVER_SPECS_DIR`: Path to the specs directory (default: ./specs). - Example: `export SPEC_SERVER_SPECS_DIR=/data/specs` - `SPEC_SERVER_AUTO_BACKUP`: Boolean to enable/disable automatic backups (default: true). - Example: `export SPEC_SERVER_AUTO_BACKUP=false` - Directory Permissions: - Specs directory: `chmod 755 specs` - Backups directory: `chmod 755 backups` ``` -------------------------------- ### Connect Back to Requirements Example Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md Demonstrates how to connect a design decision back to a specific project requirement, explaining the benefit of the decision. ```plaintext This design decision directly supports the requirement you mentioned about [specific requirement]. It ensures that [benefit]. ``` -------------------------------- ### Test Server Startup and Basic Functionality Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Provides commands to test the spec-server's basic operations, including its help output and the ability to respond to a simple JSON-RPC ping request. ```bash # Test server startup spec-server --help # Test with simple command echo '{"jsonrpc": "2.0", "method": "ping", "id": 1}' | spec-server ``` -------------------------------- ### Leverage Automatic Features Example Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md Shows how a system can automatically format tasks and link them to requirements, moving irrelevant content to appropriate documents. ```plaintext I'll create the tasks now, and the system will automatically format them and link them to the relevant requirements we discussed. If any content doesn't belong in tasks, it will be moved to the appropriate document. ``` -------------------------------- ### Check Directory Permissions Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Checks and sets read/write/execute permissions for the 'specs' directory, ensuring spec-server can create files and directories. ```bash ls -la specs/ chmod 755 specs/ ``` -------------------------------- ### Acknowledge Uncertainty Example Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md Provides an example of how to acknowledge uncertainty about a specific aspect and request further information for informed decision-making. ```plaintext I'm not entirely certain about [aspect]. Could you provide more information about [specific question] so we can make a more informed decision? ``` -------------------------------- ### Automatic Design Enhancement Example Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md Explains how a system automatically enhances designs with the Intent/Goals/Logic format for consistent documentation structure. ```plaintext The system will automatically enhance this design with the Intent/Goals/Logic format for any technical elements that need it. This ensures consistent documentation structure across all your specs. ``` -------------------------------- ### Verify spec-server Status (Stdio and SSE) Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Tests if the spec-server is running and responsive using the stdio transport by sending an initialize request, and checks the SSE endpoint. ```bash # For stdio transport echo '{"jsonrpc": "2.0", "method": "initialize", "id": 1}' | spec-server # For SSE transport curl http://localhost:8000/sse ``` -------------------------------- ### Test Specific Functionality (Get Config) Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md A Python snippet to test a specific piece of functionality, in this case, retrieving the server's configuration. This is useful for isolating and testing individual components. ```python from spec_server.config import get_config; print(get_config()) ``` -------------------------------- ### Logging Configuration Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Specifies environment variables for configuring the logging level and output file for the spec-server. ```APIDOC Logging Configuration: - `SPEC_SERVER_LOG_LEVEL`: Sets the logging verbosity (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL). - Default: INFO - Example: `export SPEC_SERVER_LOG_LEVEL=DEBUG` - `SPEC_SERVER_LOG_FILE`: Specifies the path to the log file. - Default: stdout - Example: `export SPEC_SERVER_LOG_FILE=debug.log` ``` -------------------------------- ### Create and Secure Specs Directory Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Ensures the 'specs' directory exists and has appropriate permissions for the spec-server to operate correctly. This is crucial for organizing and accessing specification files. ```bash mkdir -p specs chmod 755 specs ``` -------------------------------- ### Call Tool with Correct Parameters Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Demonstrates the correct Python syntax for calling a spec-server tool, specifically 'create_spec', with properly formatted parameters like feature name (kebab-case) and initial idea. ```python # Correct format await session.call_tool("create_spec", { "feature_name": "user-auth", # kebab-case "initial_idea": "User authentication system" }) ``` -------------------------------- ### Common Error Codes and Descriptions Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md A reference table mapping common error codes encountered in the spec-server to their descriptions and potential causes. ```APIDOC Common Error Codes: - `SPEC_NOT_FOUND`: Specification not found. Causes: Typo in feature name, spec not created. - `SPEC_ALREADY_EXISTS`: Specification already exists. Causes: Duplicate creation attempt. - `SPEC_INVALID_NAME`: Invalid feature name format. Causes: Not kebab-case, contains special characters. - `DOCUMENT_NOT_FOUND`: Document not found. Causes: Invalid document type, spec not created. - `VALIDATION_ERROR`: Input validation failed. Causes: Invalid parameters, format issues. - `WORKFLOW_APPROVAL_REQUIRED`: Phase approval needed. Causes: Missing `phase_approval=true`. - `TASK_NOT_FOUND`: Task not found. Causes: Invalid task identifier. - `FILE_NOT_FOUND`: File reference not found. Causes: Broken file reference. - `INTERNAL_ERROR`: Unexpected server error. Causes: System issue, check logs. ``` -------------------------------- ### Use Enhanced Design Format Example Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md Illustrates structuring a component's documentation using the Intent/Goals/Logic format, emphasizing clarity and communication of purpose and implementation. ```plaintext For this component, let me structure it using the Intent/Goals/Logic format: **Intent**: This component serves as the main data processor for user requests. **Goals**: - Validate incoming data according to business rules - Transform data into the required internal format - Handle errors gracefully with meaningful messages - Maintain high performance under load **Logic**: The component will implement a pipeline pattern where data flows through validation, transformation, and error handling stages. It will use dependency injection for testability and include comprehensive logging for debugging. Does this structure clearly communicate the component's purpose and implementation approach? ``` -------------------------------- ### Check Python Version Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Verifies the installed Python version to ensure compatibility with spec-server, which requires Python 3.12 or later. ```bash python3 --version ``` -------------------------------- ### Requirements Phase - Understand User Needs Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md This snippet provides guiding questions for an LLM to understand user needs during the requirements phase of the spec-server workflow. ```text Before we document requirements, let's discuss: - Who will use this feature? - What problem does it solve? - What are the must-have vs. nice-to-have aspects? - How will we know if it's successful? ``` -------------------------------- ### Change SSE Port Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Starts the spec-server SSE transport on a different port to avoid conflicts if the default port (e.g., 8000) is already in use. ```bash spec-server sse --port 8001 ``` -------------------------------- ### Performance and Memory Configuration Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Outlines environment variables used to configure performance-related settings such as caching and validation strictness, as well as memory management options. ```APIDOC Performance & Memory Configuration: - `SPEC_SERVER_CACHE_ENABLED`: Boolean to enable/disable caching (default: false). - Example: `export SPEC_SERVER_CACHE_ENABLED=true` - `SPEC_SERVER_CACHE_SIZE`: Maximum cache size in MB (default: 100). - Example: `export SPEC_SERVER_CACHE_SIZE=200` - `SPEC_SERVER_STRICT_VALIDATION`: Boolean to enforce strict validation (default: true). - Example: `export SPEC_SERVER_STRICT_VALIDATION=false` - `SPEC_SERVER_MAX_SPECS`: Maximum number of specs to manage (default: 500). - Example: `export SPEC_SERVER_MAX_SPECS=100` ``` -------------------------------- ### Create and Secure Backup Directory Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Ensures the 'backups' directory exists and has the correct permissions for storing backup files. This is essential for successful backup operations. ```bash mkdir -p backups chmod 755 backups ``` -------------------------------- ### Check Port Usage Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Lists network connections and listening ports to identify which processes are using a specific port. ```bash netstat -tulpn | grep :8000 ``` -------------------------------- ### Run Unit Tests Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Executes the project's unit tests using the pytest framework. Running tests is a fundamental step in verifying code correctness and identifying regressions. ```bash python -m pytest tests/ -v ``` -------------------------------- ### Find and Kill Process by Port Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Identifies the process ID (PID) using a specific port (e.g., 8000) and terminates it. ```bash lsof -i :8000 kill -9 ``` -------------------------------- ### Collect System and Package Information Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Gathers essential system and package information, including OS details, Python versions, and specific package versions. This data is vital for diagnosing environment-related issues. ```bash # System info uname -a python3 --version pip --version # Package versions pip list | grep -E "(spec-server|fastmcp|pydantic)" # Environment env | grep SPEC_SERVER # File permissions ls -la specs/ backups/ ``` -------------------------------- ### Basic MCP Client Configuration Source: https://github.com/teknologika/spec-server/blob/main/docs/mcp-client-config.md Configures the MCP client to connect to spec-server using the 'stdio' transport. This is the default and simplest setup. ```json { "mcpServers": { "spec-server": { "command": "spec-server", "args": ["stdio"], "disabled": false, "autoApprove": [] } } } ``` -------------------------------- ### Configure Custom Specs Directory Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Sets the SPEC_SERVER_SPECS_DIR environment variable to a custom, writable directory for storing specs, or configures it within MCP settings. ```bash export SPEC_SERVER_SPECS_DIR=~/my-specs ``` ```json { "mcpServers": { "spec-server": { "command": "spec-server", "args": ["stdio"], "env": { "SPEC_SERVER_SPECS_DIR": "/path/to/writable/directory/specs" } } } } ``` -------------------------------- ### Configure spec-server Transport and Logging Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Configures the spec-server transport (stdio) and enables debug logging by setting the SPEC_SERVER_LOG_LEVEL environment variable within the MCP configuration. ```json { "mcpServers": { "spec-server": { "command": "spec-server", "args": ["stdio"], "env": { "SPEC_SERVER_LOG_LEVEL": "DEBUG" } } } } ``` -------------------------------- ### Requirements Phase - Discuss Acceptance Criteria (EARS) Source: https://github.com/teknologika/spec-server/blob/main/docs/llm-guidance.md This snippet guides an LLM on discussing acceptance criteria using the EARS (Event-driven, Actor-centric, Rule-based, State-based) format. ```text Let's define some acceptance criteria using the EARS format. These are specific conditions that must be met for the feature to be considered complete: - WHEN [condition] THEN the system SHALL [response] - WHEN [condition] THEN the system SHALL [response] - IF [condition] THEN the system SHALL [response] ``` -------------------------------- ### Disable Automatic Backups Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Temporarily disables the automatic backup feature by setting an environment variable. This can be useful for troubleshooting backup-related issues or during maintenance. ```bash export SPEC_SERVER_AUTO_BACKUP=false spec-server ``` -------------------------------- ### Enable Debug Logging Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Configures the spec-server to output detailed debug information to a specified log file. This is essential for diagnosing complex issues and understanding the server's internal state. ```bash # Environment variable export SPEC_SERVER_LOG_LEVEL=DEBUG export SPEC_SERVER_LOG_FILE=debug.log spec-server # Check logs tail -f debug.log ``` -------------------------------- ### Configure Custom Specs Directory Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Allows users to specify a custom location for the specs directory using an environment variable. This is useful for managing specs in non-default locations. ```bash export SPEC_SERVER_SPECS_DIR=/path/to/specs spec-server ``` -------------------------------- ### Handle Tool Execution Errors Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Shows how to check the result of a tool call in Python, specifically looking for a 'success' flag and extracting error messages and suggestions if the operation failed. ```python result = await session.call_tool("create_spec", {...}) if not result.get("success", True): print("Error:", result.get("message")) print("Suggestions:", result.get("suggestions", [])) ``` -------------------------------- ### Check System Resources (CPU and Disk) Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Commands to monitor system resource utilization, including CPU load and disk space. High resource usage can lead to slow response times and performance degradation. ```bash top df -h ``` -------------------------------- ### Limit Maximum Number of Specs Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Sets a limit on the maximum number of specifications the server will manage. This can help control memory usage and prevent excessive resource consumption. ```bash export SPEC_SERVER_MAX_SPECS=100 ``` -------------------------------- ### Content Validation Rules Source: https://github.com/teknologika/spec-server/blob/main/docs/troubleshooting.md Defines the rules for content validation, including maximum size limits and restrictions on dangerous content types like script tags or executable code. ```APIDOC Content Validation: - Maximum Size: 1MB (1,000,000 bytes) - Minimum for ideas: 10 characters - Forbidden Content: -