Copilot CLI & Workspace Sync
Relevant source files
The following files were used as context for generating this wiki page:
Copilot CLI & Workspace Sync represents the integration layer between the developer's local environment, the GitHub Copilot ecosystem, and the GentelmeN-CorE (GeNCorE) bot infrastructure. This system ensures that the AI assistant remains synchronized with the project's codebase, documentation standards, and architectural constraints. It facilitates a "chat-with-code" experience by indexing project structures and providing context-aware responses based on the current workspace state.
The primary purpose of this module is to enforce project-specific coding standards, manage workspace-level instructions, and provide a bridge between the command-line interface (CLI) interactions and the backend AI models like Llama 3.3 or Qwen.
Core Architecture and Workspace Rules
The workspace synchronization is driven by a set of persistent instructions that define the bot's behavior, technical stack, and response formatting. These rules are centrally managed in the workspace configuration to ensure consistency across all developer sessions.
Technical Stack Enforcement
The system is configured to prioritize specific libraries and frameworks. For instance, it strictly uses pyTelegramBotAPI for Telegram interactions and psycopg2 for PostgreSQL database management.
| Component | Technology |
|---|---|
| Language | Python 3.10+ |
| Telegram API | pyTelegramBotAPI |
| Database | PostgreSQL (psycopg2) |
| AI Models | Groq (Llama 3.3, Qwen 2.5) |
| Integrations | KuCoin (ccxt), Brave Search, HuggingFace |
Sources: .github/copilot-instructions.md, requirements.txt
Workspace Knowledge Flow
The following diagram illustrates how workspace instructions and project context are synchronized to provide accurate AI responses.
The diagram shows the flow of information from static workspace files and specific instruction sets into the AI completion engine via a context provider.
Sources: .github/copilot-instructions.md, core/commands.py:168-185
Workspace Integration Components
Instruction Sets and Standards
The workspace sync relies on the .github/copilot-instructions.md file to set the "System Prompt" for all AI interactions. This includes:
- Persona: The assistant is identified as "GeNCorE".
- Language Policy: Defaulting to Polish but supporting English via
/encommand. - Error Handling: Mandatory use of
try-exceptblocks for network operations. - Code Style: Direct, concise, and focused on modern Pythonic practices.
Sources: .github/copilot-instructions.md, core/commands.py:173-177
Database and Preference Sync
User preferences, such as selected AI models and language settings, are synchronized between the local session and a PostgreSQL database. This ensures that the "Workspace Sync" persists across different interfaces (CLI or Telegram).
The ER diagram defines the schema used to store synchronized workspace state and user alerts.
Sources: core/database.py:17-37
Command and Feature Mapping
The CLI and workspace sync module maps specific commands to backend integrations. These mappings are defined in the handler registration process within the core logic.
Supported CLI/Bot Commands
| Command | Function | Description |
|---|---|---|
/llama | change_model | Syncs workspace to use Llama 3.3 70B model. |
/szukaj | explicit_search | Synchronizes with Brave Search API for real-time web data. |
/github | github_search | Pulls repository context directly into the workspace. |
/reset | reset_memory | Clears the local workspace context/history for the user. |
Sources: core/commands.py:236-250, core/commands.py:112-132
Search and Context Integration
When a user performs a search or asks for code context, the system utilizes core/integrations.py to fetch external data and merge it with the current workspace history.
# Integration of web context into the AI session
if any(w in m.text.lower() for w in ["cena", "news", "bitcoin"]):
web_info = search_brave(m.text, count=2)
if web_info:
sys_msg += f"\nNet Info:\n{web_info}"
Sources: core/commands.py:179-183, core/integrations.py:10-25
Initialization and Environment Sync
The workspace environment is initialized through a multi-stage process. The entry point bot.py triggers the core bot logic, which in turn verifies environment variables and establishes connections to the database and AI clients.
This sequence diagram tracks the initialization flow from the root script to the core service activation.
Sources: bot.py:1-7, core/bot.py:16-30
Summary
Copilot CLI & Workspace Sync in GeNCorE provides a robust framework for maintaining a consistent AI assistant behavior across different development contexts. By utilizing a centralized instruction file and a persistent database backend, it ensures that project standards are enforced and user preferences are maintained, while providing deep integration with external tools like GitHub, Brave, and HuggingFace.