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
16 changes: 16 additions & 0 deletions .cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EagleEye — Cursor Rules

> Read `AGENTS.md` at the start of every session for full project context.

EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.

## Critical Rules

- Dart CLI only — no platform dependencies in `lib/`
- No cyclic dependencies between `lib/` subdirectories
- `lib/model/` depends on nothing
- Tests use `package:test` framework
- Commit messages: English, semantic
- Never expose internal implementation from `lib/` as public API

For complete rules and skills, read `ai/`.
18 changes: 18 additions & 0 deletions .gemini/context.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EagleEye — Gemini

> Read `AGENTS.md` at the start of every session for full project context.

EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.

## Critical Rules

- Dart CLI only — no platform dependencies in `lib/`
- No cyclic dependencies between `lib/` subdirectories
- `lib/model/` depends on nothing; `lib/data/` depends on `model/`; `lib/analyzer/` depends on `model/`, `data/`, and `util/`
- `lib/util/` has zero internal dependencies
- `bin/main.dart` only accesses the public API entry point
- Tests use `package:test` framework, naming: `<name>_test.dart`
- Commit messages: English, semantic (`feat:`, `fix:`, `test:`, `chore:`, `docs:`)
- Never expose internal implementation from `lib/` as public API

For complete rules and skills, read `ai/`.
18 changes: 18 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EagleEye — GitHub Copilot

> Read `AGENTS.md` at the start of every session for full project context.

EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.

## Critical Rules

- Dart CLI only — no platform dependencies in `lib/`
- No cyclic dependencies between `lib/` subdirectories
- `lib/model/` depends on nothing; `lib/data/` depends on `model/`; `lib/analyzer/` depends on `model/` and `data/`
- `lib/util/` has zero internal dependencies
- `bin/main.dart` only accesses the public API entry point
- Tests use `package:test` framework, naming: `<name>_test.dart`
- Commit messages: English, semantic (`feat:`, `fix:`, `test:`, `chore:`, `docs:`)
- Never expose internal implementation from `lib/` as public API

For complete rules and skills, read `ai/`.
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ example/
6. Publish to pub.dev (`dart pub publish`)
- **Git tag strategy:** `vX.Y.Z` (e.g., `v2.0.2`)
- **Versioning strategy:** Semantic Versioning (SemVer)

## Available Skills

Before starting any task:
1. List all directories in `ai/skills/`
2. Identify which one covers the current task
3. Read that file in full before proceeding

Each skill file is a self-contained guide. Never skip this step — the skill may contain patterns, checklists, or constraints that are not obvious from the code alone.
5 changes: 5 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# EagleEye — Claude Code

> Read `AGENTS.md` at the start of every session for full project context.

EagleEye is a Dart CLI tool for detecting architecture violations in Dart projects.
69 changes: 69 additions & 0 deletions README-AI-CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# AI Context Structure

EagleEye uses multiple AI coding tools (OpenCode, Claude Code, GitHub Copilot, Gemini, Cursor, etc.). Instead of maintaining separate context files for each tool — which would quickly diverge — all tools point to the same source.

```
📄 AGENTS.md ← single source of truth (master initializer)
📁 ai/ ← detailed context: instructions, skills, module graph
```

```mermaid
graph LR
OPENCODE["OpenCode<br/><code>opencode.json → AGENTS.md</code>"]
CLAUDE["Claude Code<br/><code>CLAUDE.md</code>"]
COPILOT["GitHub Copilot<br/><code>.github/copilot-instructions.md</code>"]
CURSOR["Cursor<br/><code>.cursorrules</code>"]
GEMINI["Gemini<br/><code>.gemini/context.md</code>"]
CODEX["Codex / OpenAI<br/>(reads natively)"]

AG["📄 AGENTS.md<br/>Master Initializer"]
AI["📁 ai/<br/>Detailed Context"]

OPENCODE -->|reads| AG
CLAUDE -->|reads| AG
COPILOT -->|reads| AG
CURSOR -->|reads| AG
GEMINI -->|reads| AG
CODEX -->|reads| AG

AG -->|references| AI
```

## ai/ structure

```
ai/
module-graph.md ← module dependency graph
instructions/
dart.md ← Dart CLI patterns and conventions
skills/
architecture/
SKILL.md ← architectural rules and code conventions
documentation-review/
SKILL.md ← docs validation
generate-tests/
SKILL.md ← test generation
minimum-requirements/
SKILL.md ← version requirements
release-notes/
SKILL.md ← release process
review-pr/
SKILL.md ← PR review checklist
run-build/
SKILL.md ← how to build and test
testing/
SKILL.md ← testing strategies
validate-architecture/
SKILL.md ← architectural validation
```

## Tool-specific config

| Location | Tool | Purpose |
|---|---|---|
| `AGENTS.md` | All tools | Master initializer — single source of truth |
| `CLAUDE.md` | Claude Code | Entry point → reads `AGENTS.md` |
| `.gemini/context.md` | Gemini | Entry point → reads `AGENTS.md` |
| `.github/copilot-instructions.md` | GitHub Copilot | Entry point → reads `AGENTS.md` |
| `.cursorrules` | Cursor | Entry point → reads `AGENTS.md` |
| `opencode.json` → `AGENTS.md` | OpenCode | Reads `AGENTS.md` and `ai/skills/` |
100 changes: 100 additions & 0 deletions ai/instructions/dart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Dart CLI — Platform Instructions

> Read this file when starting any EagleEye task.

---

## Core Abstractions

| Class/File | Role |
|---|---|
| `lib/analyzer/analyzer.dart` | Main analysis engine — walks files, resolves imports |
| `lib/analyzer/checker/` | Individual rule checkers |
| `lib/model/` | Domain models and exceptions |
| `lib/data/` | Config loading and data access |
| `lib/util/` | Shared utilities |
| `bin/main.dart` | CLI entry point |

## Architecture Overview

EagleEye works in three phases:

1. **Config loading** — reads `eagle_eye_config.json` from the project root
2. **File scanning** — walks Dart files in the target project, resolves imports
3. **Rule checking** — applies each rule from the config against the import graph

### Rule Engine

Rules are defined in JSON config:
```json
[
{
"filePattern": "*util.dart",
"dependenciesAllowed": false
},
{
"filePattern": "*viewmodel.dart",
"exclusiveDependencies": ["*repository.dart"]
},
{
"filePattern": "*repository.dart",
"forbiddenDependencies": ["*screen.dart"]
}
]
```

Each checker in `lib/analyzer/checker/` implements one rule type.

## Folder Structure

```
lib/
analyzer/
analyzer.dart — main analysis engine
checker/
checker.dart — base checker interface
no_depends_checker.dart
exclusive_depends_checker.dart
forbidden_depends_checker.dart
do_not_with_patterns_checker.dart
data/
config_loader.dart — JSON config loading
model/ — internal data models
model/
analysis_result.dart
violation.dart
rule_config.dart
exceptions/
util/
file_utils.dart
import_resolver.dart
test/
analyzer/
analyzer_test.dart
checker/
model/
```

## Dart Conventions

- **Naming:** `snake_case` for files, `lowerCamelCase` for variables/functions, `UpperCamelCase` for classes
- **Imports:** Prefer `package:` imports over relative. `avoid_relative_lib_imports` is enforced
- **Testing:** `package:test` framework with descriptive test names
- **CLI:** `args` package for argument parsing, `stdout` for output, exit codes for success/failure

## Build

```bash
dart pub get # install dependencies
dart analyze # static analysis
dart test # run tests
dart run eagle_eye:main # run CLI locally
```

## Tests

- Framework: `package:test` (defined in `pubspec.yaml`)
- File naming: `<name>_test.dart` mirroring `<name>.dart` in `lib/`
- Test names: descriptive strings, lowercase with spaces
- Structure: `group()` for logical grouping, `test()` for individual cases
- Assertions: `expect(actual, matcher)`
68 changes: 68 additions & 0 deletions ai/module-graph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# EagleEye — Module Dependency Graph

## Module Structure

```
lib/
model/ ← data classes, enums, exceptions (zero internal deps)
data/ ← data access, serialization (depends on model/)
analyzer/ ← analysis engine, rule checkers (depends on model/, data/)
checker/ ← individual rule implementations (depends on model/)
util/ ← shared utilities (zero internal deps)
bin/
main.dart ← CLI entry point (depends only on public API in lib/)
```

## Dependency Rules

```
┌─────────────────────┐
│ lib/util/ │ ← no internal dependencies
└─────────────────────┘

┌─────────────────────┐
│ lib/model/ │ ← no internal dependencies
└──────────┬──────────┘
│ depends on
┌─────────────────────┐
│ lib/data/ │ ← depends on model/
└──────────┬──────────┘
│ depends on
┌─────────────────────┐
│ lib/analyzer/ │ ← depends on model/, data/, util/
└──────────┬──────────┘
│ depends on
┌─────────────────────┐
│ lib/analyzer/ │
│ checker/ │ ← depends on model/, analyzer/
└─────────────────────┘

✗ data/ → analyzer/ FORBIDDEN
✗ data/ → util/ FORBIDDEN
✗ model/ → data/ FORBIDDEN
✗ model/ → analyzer/ FORBIDDEN
✗ model/ → util/ FORBIDDEN
✗ bin/ → lib/* (internal) FORBIDDEN (only public API entry point)
```

## Layer Responsibilities

| Layer | Role |
|---|---|
| `model/` | Data classes, enums, custom exceptions. Zero knowledge of other layers. |
| `data/` | Config loading, JSON parsing, file I/O. Depends on `model/` for types. |
| `analyzer/` | Core logic: walks files, resolves imports, checks rules. Orchestrates the analysis. |
| `analyzer/checker/` | Individual rule implementations. Each checker validates one rule type. |
| `util/` | Shared helpers (string, file, path utilities). No knowledge of project domain. |
| `bin/main.dart` | CLI entry point. Only calls the public API — never internal modules directly. |

## Adding a New Feature

1. If a new domain type is needed → add to `model/`
2. If data loading/parsing is needed → add to `data/`
3. If a new rule type is needed → add to `analyzer/checker/`
4. If a shared utility is needed → add to `util/`
5. Wire it up in `analyzer/` or `bin/main.dart`
38 changes: 38 additions & 0 deletions ai/skills/architecture/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: architecture
description: Verify architectural consistency and dependency rules in EagleEye
trigger: when the user asks about architecture, rules, conventions, or what is/isn't allowed in the codebase
---

# EagleEye — Architectural Rules & Conventions

## Architectural Rules — Never Violate

1. **Layer separation is strict.** `lib/model/` depends on nothing. `lib/data/` may depend on `model/`. `lib/analyzer/` may depend on `model/`, `data/`, and `util/`. `lib/util/` depends on nothing.

2. **No cyclic dependencies** between `lib/` subdirectories.

3. **`bin/main.dart` only accesses the public API.** Never import internal modules directly from the CLI entry point.

4. **Public API should be minimal and intentional.** Internal implementation details should not be exposed.

5. **Files outside `lib/`** (e.g., `bin/`, `test/`) should not be imported by `lib/`.

6. **`lib/util/` should be independent** of other layers — no imports from `model/`, `data/`, or `analyzer/`.

7. **Test files mirror the `lib/` structure.** `test/analyzer/` mirrors `lib/analyzer/`, `test/model/` mirrors `lib/model/`.

## Code Conventions

- **Dart:** follows official Dart conventions. `snake_case` for files, `lowerCamelCase` for variables/functions, `UpperCamelCase` for classes.
- **Imports:** prefer `package:` imports over relative. `avoid_relative_lib_imports` is enforced.
- **Tests:** `package:test` framework. Descriptive test names, `group()` for logical grouping.
- **Commits:** messages in English, semantic (`feat:`, `fix:`, `test:`, `chore:`, `docs:`).

## What NOT to Do

- Do not add platform dependencies in `lib/` (Dart CLI only)
- Do not create cyclic dependencies between `lib/` subpackages
- Do not commit `local.properties` or credential files
- Do not use `--no-verify` to bypass CI hooks
- Do not expose internal implementation as public API
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
name: documentation-review
description: Validate project documentation matches actual implementation
description: Validate EagleEye documentation matches actual implementation
trigger: when the user asks to review documentation, check for outdated docs, or verify docs match code
---

# Documentation Review for EagleEye

When invoked:

1. Scan all documentation:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
name: generate-tests
description: Generate tests following project conventions
trigger: when the user asks to write tests, review test files, or generate new test cases
---

# Generate Tests

When invoked:

1. Detect testing framework:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
name: minimum-requirements
description: Determine minimum requirements to consume the library
description: Determine minimum requirements to consume the EagleEye library
trigger: when the user asks about minimum SDK version, requirements, or compatible Dart versions
---

# Minimum Requirements for EagleEye

When invoked:

1. Detect project type:
Expand Down
Loading
Loading