Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ProjectGraphAgent/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.cache/

.git.backup

9 changes: 9 additions & 0 deletions ProjectGraphAgent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## v1.0.0 (2025-01-28)
- **Breaking Release**: First stable v1.0.0 release of ProjectGraphAgent
- Major stability improvements and production-ready features
- Enhanced drift detection algorithms and performance optimizations
- Comprehensive validator improvements and error handling
- Extended adapter support and Jsonnet configuration enhancements
- Improved CI/CD workflows and deployment automation
- Better documentation and developer experience

## v0.1.0-alpha
- Initial public alpha of ProjectGraphAgent
- Declared graph via Jsonnet, observed adapters (TS/Python), drift computation
Expand Down
13 changes: 11 additions & 2 deletions ProjectGraphAgent/LLM_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hello, Large Language Model!

This `project_graph/` directory is designed to be a structured, machine-readable representation of the `tsx_viewer` project's architecture and operational guidelines. Its primary purpose is to facilitate your deeper understanding and more effective interaction with this codebase.
This `project_graph/` directory is designed to be a structured, machine-readable representation of the `agent_plugins_platform` project's architecture and operational guidelines. Its primary purpose is to facilitate your deeper understanding and more effective interaction with this codebase.

## Why This System Exists for You (the LLM):

Expand All @@ -24,6 +24,7 @@ Traditional documentation is often unstructured and difficult for AI to parse co
* `policies`: Architectural rules, design principles, and conventions that the project adheres to.
* `commitGroups`: Rules for categorizing changes into atomic Git commits (e.g., `feat`, `fix`, `docs`). This helps you understand the project's commit hygiene and can guide your commit message generation.
* `aiCommands`: Mappings of conversational trigger phrases to `npm` commands. This section is particularly important for understanding how the project expects AI agents to execute specific actions.
* `templates.PathSearch`: A powerful indexing system for fast file path lookups with multiple search strategies (by exact path, directory, file type, name patterns). This enables efficient navigation and analysis of large codebases.

3. **Prioritize Structured Data:** Whenever possible, extract information directly from the compiled JSON output of `project_graph.jsonnet` rather than relying on natural language descriptions in READMEs or comments. This provides the most precise and unambiguous context.

Expand All @@ -37,9 +38,17 @@ Traditional documentation is often unstructured and difficult for AI to parse co

6. **Drift and Plans Awareness:** Prefer the compiled `project_graph/.cache/graph.json`. It includes `observed` (adapter output) and `drift`. Reference `memory-bank/plans/` markdown for human-facing plan summaries; edit `graph_parts/plans.jsonnet` for canonical plan definitions.

7. **Path Indexing System:** Leverage the `templates.PathSearch` functions for efficient file and entity lookups:
* Use `findByPath()` for exact file lookups
* Use `findByDirectory()` to explore directory contents
* Use `findByFileType()` to find all files of a specific type (e.g., all `.ts` files)
* Use `findByPattern()` for flexible pattern-based searches
* Always check `pathExists()` before accessing files
* Use `getIndexStats()` to understand the scope of the indexed codebase

## Your Role in Maintaining This System:

* **Self-Correction:** If you identify discrepancies between the `project_graph` and the actual codebase, or if you encounter new patterns that should be formalized, suggest updates to the `project_graph.jsonnet`.
* **Proactive Use:** Actively query and integrate information from the `project_graph` into your reasoning processes for all tasks related to this project.

By leveraging the `project_graph` system, you can become a more effective, context-aware, and integrated collaborator within the `tsx_viewer` project.
By leveraging the `project_graph` system, you can become a more effective, context-aware, and integrated collaborator within the `agent_plugins_platform` project.
79 changes: 71 additions & 8 deletions ProjectGraphAgent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ ProjectGraphAgent is a Jsonnet-driven project control system designed for AI age
## Key Features

- **Declared vs Observed Graph**: Jsonnet "declared" model + language adapters "observed" model → automatic drift detection
- **Path Indexing System**: Fast file path lookups with multiple search strategies (by path, directory, file type, name patterns)
- **Agent-Friendly Outputs**: Compiled graph JSON, drift reports, Mermaid diagrams, plans markdown, snapshots and events
- **Automation**: Grouped commits, AI command synchronization, CI workflow integration
- **Multi-Language Support**: TypeScript/JavaScript and Python adapters (extensible)


## Structure

* `project_graph.jsonnet`
Expand All @@ -28,7 +30,47 @@ ProjectGraphAgent is a Jsonnet-driven project control system designed for AI age
* `publish_workflow.mjs`: A script related to the project graph.
* `sync_ai_commands.mjs`: The script that synchronizes AI command definitions across various AI assistant rule files.
* `sync_to_standalone.mjs`: A script related to the project graph.


## Path Indexing System

ProjectGraphAgent includes a powerful path indexing system that enables fast lookups of files and entities by various criteria:

### Search Functions

- **`findByPath(path)`**: Find entity by exact file path
- **`findByDirectory(dir)`**: Find all files in a directory
- **`findByFileType(ext)`**: Find all files with specific extension
- **`findByFileName(name)`**: Find files with specific name
- **`findByPattern(pattern)`**: Search files containing a pattern
- **`pathExists(path)`**: Check if file exists in index
- **`getIndexStats()`**: Get statistics about the index

### Index Types

- **Path Index**: Direct path → entity mapping
- **Directory Index**: Directory → list of entities
- **File Type Index**: Extension → list of entities
- **File Name Index**: Name → list of entities

### Usage Examples

```jsonnet
// Find a specific configuration file
local config = graph.templates.PathSearch.findByPath("package.json");

// Get all TypeScript files
local tsFiles = graph.templates.PathSearch.findByFileType("ts");

// Find all files in src directory
local srcFiles = graph.templates.PathSearch.findByDirectory("src");

// Check if README exists
local hasReadme = graph.templates.PathSearch.pathExists("README.md");
```

This indexing system is particularly valuable for AI agents, enabling efficient navigation and analysis of large codebases.


## Usage

### Quick Start
Expand Down Expand Up @@ -78,6 +120,7 @@ Add to `.github/workflows/*.yml`:
run: node ProjectGraphAgent/scripts/graph_validator.mjs
```


## AI Assistant Command Mapping

To streamline interaction with AI assistants, you can configure them to trigger `npm run graph:audit` and `npm run graph:commit` using simpler, more conversational commands. Below are examples of how to set this up for various AI assistants, based on the definitions in `graph_parts/ai_commands.jsonnet`.
Expand All @@ -97,6 +140,24 @@ To streamline interaction with AI assistants, you can configure them to trigger
- **Action:** Run `npm run graph:commit`
- **Description:** Executes the AI Committer script to automatically categorize and commit staged changes based on project_graph.jsonnet rules.

## Sync Ai Commands
- **Trigger Phrase:** "sync-ai-commands"
- **Action:** Run `npm run sync:ai-commands`
- **Description:** Synchronizes AI command definitions across various AI assistant rule files.

```


## Graph Audit
- **Trigger Phrase:** "graph-audit"
- **Action:** Run `node project_graph/scripts/graph_generator.mjs`
- **Description:** Executes the project graph audit script to check for discrepancies between the graph definition and actual project files.

## Graph Commit
- **Trigger Phrase:** "graph-commit"
- **Action:** Run `npm run graph:commit`
- **Description:** Executes the AI Committer script to automatically categorize and commit staged changes based on project_graph.jsonnet rules.

## Sync Ai Commands
- **Trigger Phrase:** "sync-ai-commands"
- **Action:** Run `npm run sync:ai-commands`
Expand Down Expand Up @@ -130,21 +191,23 @@ To streamline interaction with AI assistants, you can configure them to trigger
- **Description:** Synchronizes AI command definitions across various AI assistant rule files.
```


## Drift

- observedNotDeclared: 0
- declaredNotObserved: 10
- declaredNotObserved: 17


## Development Workflow

### Dual Directory Setup

This ProjectGraphAgent is designed to work in two modes:

1. **Parent Project Mode** (`/home/igor/Документы/Проекты/tsx_viewer/ProjectGraphAgent/`)
- Contains project-specific data (TSX-viewer entities, settings)
1. **Parent Project Mode** (`/home/igor/Документы/Проекты/agent_plugins_platform/ProjectGraphAgent/`)
- Contains project-specific data (Agent Plugins Platform entities, settings)
- Used for active development and testing
- Manages the parent project (TSX-viewer)
- Manages the parent project (Agent Plugins Platform)

2. **Standalone Mode** (`/home/igor/Документы/Проекты/ProjectGraphAgent/`)
- Clean, universal template
Expand All @@ -155,13 +218,13 @@ This ProjectGraphAgent is designed to work in two modes:

1. **Develop in Parent Project**:
```bash
# Work in tsx_viewer/ProjectGraphAgent/
# Work in agent_plugins_platform/ProjectGraphAgent/
# Make changes to scripts, graph_parts, adapters, etc.
```

2. **Sync to Standalone**:
```bash
# From tsx_viewer/ProjectGraphAgent/
# From agent_plugins_platform/ProjectGraphAgent/
npm run sync
```

Expand All @@ -184,7 +247,7 @@ This ProjectGraphAgent is designed to work in two modes:
For convenience, use the automated publish workflow:

```bash
# From tsx_viewer/ProjectGraphAgent/
# From agent_plugins_platform/ProjectGraphAgent/
npm run publish
```

Expand Down
56 changes: 48 additions & 8 deletions ProjectGraphAgent/README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ProjectGraphAgent — это система управления проекта
## Ключевые особенности

- **Заявленный и наблюдаемый граф**: Модель "заявленного" состояния в Jsonnet + модель "наблюдаемого" состояния от языковых адаптеров → автоматическое обнаружение расхождений.
- **Система индексации путей**: Быстрый поиск файлов с множественными стратегиями (по пути, директории, типу файла, именам с паттернами).
- **Выходные данные для агентов**: Скомпилированный граф в JSON, отчеты о расхождениях, диаграммы Mermaid, markdown-файлы с планами, снимки состояния и события.
- **Автоматизация**: Группировка коммитов, синхронизация AI-команд, интеграция с CI-воркфлоу.
- **Поддержка нескольких языков**: Адаптеры для TypeScript/JavaScript и Python (с возможностью расширения).
Expand All @@ -28,8 +29,47 @@ ProjectGraphAgent — это система управления проекта
* `publish_workflow.mjs`: Скрипт, связанный с графом проекта.
* `sync_ai_commands.mjs`: Скрипт, который синхронизирует определения AI-команд между различными файлами правил AI-ассистентов.
* `sync_to_standalone.mjs`: Скрипт, связанный с графом проекта.

## Использование

## Система индексации путей

ProjectGraphAgent включает мощную систему индексации путей, которая обеспечивает быстрый поиск файлов и сущностей по различным критериям:

### Функции поиска

- **`findByPath(path)`**: Найти сущность по точному пути файла
- **`findByDirectory(dir)`**: Найти все файлы в директории
- **`findByFileType(ext)`**: Найти все файлы с определенным расширением
- **`findByFileName(name)`**: Найти файлы с определенным именем
- **`findByPattern(pattern)`**: Поиск файлов по паттерну
- **`pathExists(path)`**: Проверить существование файла в индексе
- **`getIndexStats()`**: Получить статистику индекса

### Типы индексов

- **Индекс путей**: Прямое сопоставление путь → сущность
- **Индекс директорий**: Директория → список сущностей
- **Индекс типов файлов**: Расширение → список сущностей
- **Индекс имен файлов**: Имя → список сущностей

### Примеры использования

```jsonnet
// Найти конкретный конфигурационный файл
local config = graph.templates.PathSearch.findByPath("package.json");

// Получить все TypeScript файлы
local tsFiles = graph.templates.PathSearch.findByFileType("ts");

// Найти все файлы в директории src
local srcFiles = graph.templates.PathSearch.findByDirectory("src");

// Проверить существование README
local hasReadme = graph.templates.PathSearch.pathExists("README.md");
```

Эта система индексации особенно ценна для AI-агентов, обеспечивая эффективную навигацию и анализ больших кодовых баз.

## Использование

### Быстрый старт

Expand Down Expand Up @@ -160,10 +200,10 @@ ProjectGraphAgent — это система управления проекта

ProjectGraphAgent разработан для работы в двух режимах:

1. **Режим родительского проекта** (`/home/igor/Документы/Проекты/tsx_viewer/ProjectGraphAgent/`)
- Содержит данные, специфичные для проекта (сущности и настройки TSX-viewer).
1. **Режим родительского проекта** (`/home/igor/Документы/Проекты/agent_plugins_platform/ProjectGraphAgent/`)
- Содержит данные, специфичные для проекта (сущности и настройки Agent Plugins Platform).
- Используется для активной разработки и тестирования.
- Управляет родительским проектом (TSX-viewer).
- Управляет родительским проектом (Agent Plugins Platform).

2. **Автономный режим** (`/home/igor/Документы/Проекты/ProjectGraphAgent/`)
- Чистый, универсальный шаблон.
Expand All @@ -174,13 +214,13 @@ ProjectGraphAgent разработан для работы в двух режи

1. **Разработка в родительском проекте**:
```bash
# Работайте в tsx_viewer/ProjectGraphAgent/
# Работайте в agent_plugins_platform/ProjectGraphAgent/
# Вносите изменения в скрипты, graph_parts, адаптеры и т.д.
```

2. **Синхронизация с автономной версией**:
```bash
# Из директории tsx_viewer/ProjectGraphAgent/
# Из директории agent_plugins_platform/ProjectGraphAgent/
npm run sync
```

Expand All @@ -203,7 +243,7 @@ ProjectGraphAgent разработан для работы в двух режи
Для удобства используйте автоматизированный воркфлоу публикации:

```bash
# Из директории tsx_viewer/ProjectGraphAgent/
# Из директории agent_plugins_platform/ProjectGraphAgent/
npm run publish
```

Expand Down
Loading
Loading