Update dependency analysis artifacts

Refreshed static analysis of workspace dependency structure:
- graph.json: 10 crates, 17 crate-level edges, 95 files, 123 file-level edges
- graph.summary.md: Updated metrics and fan-in/fan-out rankings
- sccs.md: Confirmed no cycles (DAG structure intact)
- layers.observed.md: 5-layer hierarchy from binaries to infrastructure
- hotspots.md: Identified g3-config, g3-providers as high fan-in; g3-cli as high fan-out
- limitations.md: Documented extraction method constraints

Agent: euler
This commit is contained in:
Dhanji R. Prasanna
2026-01-12 20:32:16 +05:30
parent fe67e72ddd
commit 028285825b
6 changed files with 2130 additions and 2343 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,112 +4,90 @@
| Metric | Count |
|--------|-------|
| Total nodes | 143 |
| Crate nodes | 9 |
| File nodes | 134 |
| Total edges | 189 |
| Workspace crates | 10 |
| Crate-level edges | 17 |
| Source files (non-test) | 95 |
| File-level edges | 123 |
| Cross-crate imports | 43 |
| Strongly connected components | 0 |
## Node Distribution
## Crate-Level Structure
### Files by Crate
### Crates by Type
| Crate | File Count |
| Crate | Type | Files |
|-------|------|-------|
| g3 | bin (root) | 1 |
| g3-cli | lib | 16 |
| g3-core | lib | 38 |
| g3-providers | lib | 7 |
| g3-config | lib | 2 |
| g3-execution | lib | 1 |
| g3-computer-control | lib | 16 |
| g3-planner | lib | 8 |
| g3-ensembles | lib | 4 |
| studio | bin | 3 |
### Fan-In (Most Depended Upon)
| Crate | Dependents |
|-------|------------|
| g3-core | 60 |
| g3-computer-control | 29 |
| g3-cli | 12 |
| g3-planner | 12 |
| g3-providers | 10 |
| g3-ensembles | 5 |
| g3 (root) | 2 |
| g3-config | 2 |
| g3-execution | 2 |
| g3-config | 4 |
| g3-providers | 4 |
| g3-core | 3 |
| g3-computer-control | 2 |
| g3-cli | 1 |
| g3-ensembles | 1 |
| g3-execution | 1 |
| g3-planner | 1 |
### Files by Type
### Fan-Out (Most Dependencies)
| Type | Count |
|------|-------|
| module | 72 |
| test | 37 |
| example | 15 |
| lib | 8 |
| build | 1 |
| main | 1 |
## Edge Distribution
| Edge Type | Count | Description |
|-----------|-------|-------------|
| file_to_crate | 101 | File imports from external crate |
| mod_declaration | 71 | Module declaration within crate |
| crate_dependency | 17 | Cargo.toml dependency |
## Crate Dependency Structure
```
g3 (root binary)
├── g3-cli
│ ├── g3-core
│ │ ├── g3-providers
│ │ ├── g3-config
│ │ ├── g3-execution
│ │ └── g3-computer-control
│ ├── g3-config
│ ├── g3-planner
│ │ ├── g3-providers
│ │ ├── g3-core
│ │ └── g3-config
│ ├── g3-computer-control
│ ├── g3-providers
│ └── g3-ensembles
│ ├── g3-core
│ └── g3-config
└── g3-providers
```
## Top Fan-In Nodes (Most Depended Upon)
| Node | Fan-In |
|------|--------|
| g3-core | 43 |
| g3-providers | 27 |
| g3-config | 16 |
| g3-computer-control | 12 |
| g3-planner | 10 |
| g3-cli | 5 |
| g3-ensembles | 3 |
| g3-execution | 2 |
## Top Fan-Out Nodes (Most Dependencies)
| Node | Fan-Out |
|------|--------|
| ./crates/g3-core/src/lib.rs | 27 |
| ./crates/g3-cli/src/lib.rs | 12 |
| ./crates/g3-core/src/tools/mod.rs | 8 |
| ./crates/g3-planner/src/lib.rs | 8 |
| ./crates/g3-providers/src/lib.rs | 6 |
| Crate | Dependencies |
|-------|-------------|
| g3-cli | 6 |
| ./crates/g3-computer-control/src/lib.rs | 5 |
| ./crates/g3-planner/src/llm.rs | 5 |
| g3-core | 4 |
| g3-planner | 3 |
| g3 | 2 |
| g3-ensembles | 2 |
## File-Level Structure
### Top Fan-Out Files (Most Outgoing Edges)
| File | Edges | Description |
|------|-------|-------------|
| crates/g3-core/src/lib.rs | 29 | Core library root |
| crates/g3-cli/src/lib.rs | 17 | CLI library root |
| crates/g3-core/src/tools/mod.rs | 9 | Tools module root |
| crates/g3-planner/src/lib.rs | 8 | Planner library root |
| crates/g3-providers/src/lib.rs | 6 | Providers library root |
| crates/g3-computer-control/src/lib.rs | 5 | Computer control root |
| crates/g3-planner/src/llm.rs | 5 | LLM integration |
### Top Fan-In (Most Imported)
| Target | Imports |
|--------|--------|
| g3-core (crate) | 21 |
| g3-providers (crate) | 11 |
| g3-config (crate) | 9 |
| g3-computer-control (crate) | 2 |
## Entrypoints
| File | Type | Description |
|------|------|-------------|
| ./src/main.rs | main | Root binary entrypoint |
| ./crates/g3-cli/src/lib.rs | lib | CLI library root |
| ./crates/g3-core/src/lib.rs | lib | Core engine library root |
| ./crates/g3-providers/src/lib.rs | lib | LLM providers library root |
| ./crates/g3-config/src/lib.rs | lib | Configuration library root |
| ./crates/g3-execution/src/lib.rs | lib | Execution library root |
| ./crates/g3-computer-control/src/lib.rs | lib | Computer control library root |
| ./crates/g3-ensembles/src/lib.rs | lib | Ensembles library root |
| ./crates/g3-planner/src/lib.rs | lib | Planner library root |
| File | Type |
|------|------|
| src/main.rs | Binary entrypoint (g3) |
| crates/studio/src/main.rs | Binary entrypoint (studio) |
| crates/g3-cli/src/lib.rs | Library root |
| crates/g3-core/src/lib.rs | Library root |
## Extraction Method
## Extraction Limitations
- Crate dependencies: Parsed from `Cargo.toml` files
- File-to-crate edges: Extracted from `use g3_*::` statements
- Module declarations: Extracted from `mod` and `pub mod` statements
- File classification: Based on path patterns and filename conventions
- Only `use` and `mod` statements at line start are parsed
- Conditional compilation (`#[cfg(...)]`) not evaluated
- Macro-generated imports not detected
- Re-exports through `pub use` not fully traced
- Test modules (`mod tests`) excluded from graph
- Test files (`*_test.rs`, `tests/`) excluded from graph

View File

@@ -1,101 +1,112 @@
# Coupling Hotspots
## Identification Method
## Method
Hotspots identified by:
1. Fan-in: Number of incoming edges (dependents)
2. Fan-out: Number of outgoing edges (dependencies)
3. Cross-crate edges: Files with imports from multiple external crates
1. Fan-in > 2× average (high incoming dependencies)
2. Fan-out > 2× average (high outgoing dependencies)
3. Cross-group edge concentration
## Metrics
### Crate Level
| Metric | Value |
|--------|-------|
| Average fan-in | 2.0 |
| Average fan-out | 1.7 |
| Threshold (2×) | 4.0 / 3.4 |
### File Level
| Metric | Value |
|--------|-------|
| Total edges | 123 |
| Total files | 95 |
| Average fan-out | 1.3 |
| Threshold (2×) | 2.6 |
## Crate-Level Hotspots
### By Fan-In (Most Depended Upon)
### High Fan-In (Most Depended Upon)
| Crate | Fan-In | Dependents |
|-------|--------|------------|
| g3-core | 43 | g3-cli, g3-ensembles, g3-planner + 40 file imports |
| g3-providers | 27 | g3-core, g3-planner + 25 file imports |
| g3-config | 16 | g3-cli, g3-core, g3-ensembles, g3-planner + 12 file imports |
| g3-computer-control | 12 | g3-cli, g3-core + 10 file imports |
| Crate | Fan-In | Status |
|-------|--------|--------|
| g3-config | 4 | **HOTSPOT** (2× avg) |
| g3-providers | 4 | **HOTSPOT** (2× avg) |
| g3-core | 3 | Near threshold |
### By Fan-Out (Most Dependencies)
**Evidence for g3-config:**
- Depended on by: g3-cli, g3-core, g3-planner, g3-ensembles
- Contains: Configuration types, loading logic
| Crate | Fan-Out | Dependencies |
|-------|---------|-------------|
| g3-cli | 6 | g3-core, g3-config, g3-planner, g3-computer-control, g3-providers, g3-ensembles |
| g3-core | 4 | g3-providers, g3-config, g3-execution, g3-computer-control |
| g3-planner | 3 | g3-providers, g3-core, g3-config |
| g3-ensembles | 2 | g3-core, g3-config |
**Evidence for g3-providers:**
- Depended on by: g3, g3-cli, g3-core, g3-planner
- Contains: LLM provider trait, message types, streaming
### High Fan-Out (Most Dependencies)
| Crate | Fan-Out | Status |
|-------|---------|--------|
| g3-cli | 6 | **HOTSPOT** (3.5× avg) |
| g3-core | 4 | **HOTSPOT** (2.4× avg) |
| g3-planner | 3 | Near threshold |
**Evidence for g3-cli:**
- Depends on: g3-core, g3-config, g3-planner, g3-computer-control, g3-providers, g3-ensembles
- Role: Top-level integration point
**Evidence for g3-core:**
- Depends on: g3-providers, g3-config, g3-execution, g3-computer-control
- Role: Central engine with multiple infrastructure dependencies
## File-Level Hotspots
### By Fan-Out (Files with Most Dependencies)
### High Fan-Out Files
| File | Fan-Out | Description |
|------|---------|-------------|
| ./crates/g3-core/src/lib.rs | 27 | Core library root - declares 22 modules + 5 external imports |
| ./crates/g3-cli/src/lib.rs | 12 | CLI library root - 5 modules + 7 external imports |
| ./crates/g3-core/src/tools/mod.rs | 8 | Tools module - declares 8 submodules |
| ./crates/g3-planner/src/lib.rs | 8 | Planner library root - 7 modules + 1 external import |
| ./crates/g3-providers/src/lib.rs | 6 | Providers library root - 5 modules + 1 internal |
| ./crates/g3-computer-control/src/lib.rs | 5 | Computer control root - 5 modules |
| ./crates/g3-planner/src/llm.rs | 5 | LLM integration - 5 external imports |
| File | Fan-Out | Threshold | Status |
|------|---------|-----------|--------|
| crates/g3-core/src/lib.rs | 29 | 2.6 | **HOTSPOT** (22× avg) |
| crates/g3-cli/src/lib.rs | 17 | 2.6 | **HOTSPOT** (13× avg) |
| crates/g3-core/src/tools/mod.rs | 9 | 2.6 | **HOTSPOT** (7× avg) |
| crates/g3-planner/src/lib.rs | 8 | 2.6 | **HOTSPOT** (6× avg) |
| crates/g3-providers/src/lib.rs | 6 | 2.6 | **HOTSPOT** (4.6× avg) |
| crates/g3-computer-control/src/lib.rs | 5 | 2.6 | **HOTSPOT** (3.8× avg) |
| crates/g3-planner/src/llm.rs | 5 | 2.6 | **HOTSPOT** (3.8× avg) |
### Files with Cross-Crate Imports
**Note:** High fan-out in `lib.rs` files is expected (module re-exports). The `tools/mod.rs` and `llm.rs` hotspots are more significant as they represent actual coupling.
| File | External Crates Imported |
|------|-------------------------|
| ./crates/g3-cli/src/lib.rs | g3-config, g3-core |
| ./crates/g3-core/src/lib.rs | g3-config, g3-providers |
| ./crates/g3-core/src/context_window.rs | g3-providers |
| ./crates/g3-core/src/streaming.rs | g3-providers |
| ./crates/g3-core/src/tool_definitions.rs | g3-providers |
| ./crates/g3-core/src/tools/executor.rs | g3-config |
| ./crates/g3-core/src/tools/research.rs | g3-config |
| ./crates/g3-core/src/tools/webdriver.rs | g3-computer-control |
| ./crates/g3-core/src/webdriver_session.rs | g3-computer-control |
| ./crates/g3-planner/src/llm.rs | g3-config, g3-core, g3-providers |
| ./crates/g3-planner/src/lib.rs | g3-providers |
| ./crates/g3-ensembles/src/flock.rs | g3-config |
### Cross-Crate Import Concentration
## High-Coupling Observations
| Source File | Cross-Crate Imports |
|-------------|--------------------|
| crates/g3-cli/src/lib.rs | 5 (g3-core, g3-config, g3-providers, g3-planner, g3-ensembles) |
| crates/g3-planner/src/llm.rs | 4 (g3-config, g3-core, g3-providers) |
| crates/g3-cli/src/autonomous.rs | 2 (g3-core) |
| crates/g3-cli/src/task_execution.rs | 2 (g3-core) |
### g3-core/src/lib.rs
## Observations
- Fan-out: 27 (highest in codebase)
- Declares 22 public modules
- Imports from: g3-config, g3-providers
- Central hub for all core functionality
1. **g3-core/src/lib.rs** has extreme fan-out (29 edges) due to declaring 22+ modules
2. **g3-config** and **g3-providers** are foundational crates with high fan-in
3. **g3-cli** is the integration hub, pulling together all subsystems
4. **tools/mod.rs** aggregates 9 tool modules - natural aggregation point
5. **g3-planner/src/llm.rs** has notable cross-crate coupling (imports from 3 other crates)
### g3-providers
## Cross-Group Edges
- Fan-in: 27 (second highest)
- Imported by 25 files across 3 crates
- Provides: Message, MessageRole, CompletionRequest, LLMProvider, etc.
- Core abstraction layer for LLM communication
Total cross-crate imports: 43
### g3-config
- Fan-in: 16
- Imported by 12 files across 4 crates
- Provides: Config struct
- Shared configuration across all layers
## Representative Evidence
### g3-core imports from g3-providers (18 edges)
```
./crates/g3-core/src/lib.rs: use g3_providers::{CacheControl, CompletionRequest, Message, MessageRole, ProviderRegistry};
./crates/g3-core/src/context_window.rs: use g3_providers::{Message, MessageRole, Usage};
./crates/g3-core/src/streaming.rs: use g3_providers::{CompletionRequest, MessageRole};
./crates/g3-core/src/tool_definitions.rs: use g3_providers::Tool;
```
### g3-planner imports from g3-core (5 edges)
```
./crates/g3-planner/src/llm.rs: use g3_core::project::Project;
./crates/g3-planner/src/llm.rs: use g3_core::Agent;
./crates/g3-planner/src/llm.rs: use g3_core::error_handling::{classify_error, ErrorType};
```
| From Crate | To Crate | Count |
|------------|----------|-------|
| g3-cli | g3-core | 21 |
| g3-cli | g3-config | 4 |
| g3-cli | g3-providers | 2 |
| g3-planner | g3-core | 5 |
| g3-planner | g3-providers | 4 |
| g3-planner | g3-config | 2 |
| g3-core | g3-providers | 8 |
| g3-core | g3-config | 3 |
| g3-core | g3-computer-control | 2 |
| g3-ensembles | g3-core | 1 |
| g3-ensembles | g3-config | 1 |

View File

@@ -4,103 +4,169 @@
Layers derived mechanically from:
1. Crate dependency direction in Cargo.toml
2. Path-based grouping within crates
3. Import directionality between files
2. Path-based module grouping
3. Import directionality analysis
## Crate Layers
## Crate Hierarchy
### Layer 0: Foundation (No internal dependencies)
```
┌─────────────────────────────────────────────────────────────┐
│ Layer 0: Binaries │
│ g3 (main entry) │
│ studio (standalone tool) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 1: Application │
│ g3-cli (CLI interface, 16 files) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 2: Orchestration │
│ g3-planner (planning logic, 8 files) │
│ g3-ensembles (multi-agent, 4 files) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 3: Core Engine │
│ g3-core (agent engine, 38 files) │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Layer 4: Infrastructure │
│ g3-providers (LLM providers, 7 files) │
│ g3-config (configuration, 2 files) │
│ g3-execution (code execution, 1 file) │
│ g3-computer-control (desktop automation, 16 files) │
└─────────────────────────────────────────────────────────────┘
```
| Crate | Purpose (from Cargo.toml description) |
|-------|---------------------------------------|
| g3-config | Configuration management |
| g3-execution | Code execution engine |
| g3-providers | LLM provider abstractions |
| g3-computer-control | Computer control (no description) |
## Intra-Crate Module Structure
### Layer 1: Core Services
### g3-core (38 files)
| Crate | Dependencies |
|-------|-------------|
| g3-core | g3-providers, g3-config, g3-execution, g3-computer-control |
```
lib.rs
├── acd.rs # Aggressive Context Dehydration
├── background_process.rs # Background process management
├── code_search/ # Tree-sitter code search
│ ├── mod.rs
│ └── searcher.rs
├── compaction.rs # Context compaction
├── context_window.rs # Context window management
├── error_handling.rs # Error classification
├── feedback_extraction.rs # Coach feedback extraction
├── paths.rs # Path utilities
├── project.rs # Project abstraction
├── prompts.rs # System prompts
├── provider_config.rs # Provider configuration
├── provider_registration.rs # Provider registration
├── retry.rs # Retry logic
├── session.rs # Session management
├── session_continuation.rs # Session continuation
├── streaming.rs # Streaming utilities
├── streaming_parser.rs # Tool call parser
├── task_result.rs # Task result types
├── tool_definitions.rs # Tool definitions
├── tool_dispatch.rs # Tool routing
├── tools/ # Tool implementations
│ ├── mod.rs
│ ├── acd.rs
│ ├── executor.rs
│ ├── file_ops.rs
│ ├── memory.rs
│ ├── misc.rs
│ ├── research.rs
│ ├── shell.rs
│ ├── todo.rs
│ └── webdriver.rs
├── ui_writer.rs # UI abstraction
├── utils.rs # General utilities
└── webdriver_session.rs # WebDriver session
```
### Layer 2: Higher-Level Services
### g3-cli (16 files)
| Crate | Dependencies |
|-------|-------------|
| g3-ensembles | g3-core, g3-config |
| g3-planner | g3-providers, g3-core, g3-config |
```
lib.rs
├── accumulative.rs # Accumulative mode
├── agent_mode.rs # Agent mode
├── autonomous.rs # Autonomous mode
├── cli_args.rs # CLI argument parsing
├── coach_feedback.rs # Coach feedback
├── filter_json.rs # JSON filtering
├── interactive.rs # Interactive mode
├── metrics.rs # Metrics/timing
├── project_files.rs # Project file loading
├── simple_output.rs # Simple output helper
├── streaming_markdown.rs # Markdown formatting
├── task_execution.rs # Task execution
├── theme.rs # UI theming
├── ui_writer_impl.rs # UiWriter implementation
└── utils.rs # CLI utilities
```
### Layer 3: Application
### g3-computer-control (16 files)
| Crate | Dependencies |
|-------|-------------|
| g3-cli | g3-core, g3-config, g3-planner, g3-computer-control, g3-providers, g3-ensembles |
| g3 (root) | g3-cli, g3-providers |
```
lib.rs
├── macax/ # macOS Accessibility
│ ├── mod.rs
│ └── controller.rs
├── ocr/ # OCR engines
│ ├── mod.rs
│ ├── tesseract.rs
│ └── vision.rs
├── platform/ # Platform implementations
│ ├── mod.rs
│ ├── linux.rs
│ ├── macos.rs
│ └── windows.rs
├── types.rs # Shared types
└── webdriver/ # WebDriver implementations
├── mod.rs
├── chrome.rs
├── diagnostics.rs
└── safari.rs
```
## Module Groupings Within Crates
### g3-providers (7 files)
### g3-core (60 files)
```
lib.rs
├── anthropic.rs # Anthropic Claude
├── databricks.rs # Databricks
├── embedded.rs # Local llama.cpp
├── oauth.rs # OAuth flow
├── openai.rs # OpenAI-compatible
└── streaming.rs # Streaming utilities
```
| Group | Files | Purpose |
|-------|-------|--------|
| tools/ | 9 | Tool implementations (file_ops, shell, webdriver, etc.) |
| code_search/ | 2 | Tree-sitter based code search |
| root modules | 22 | Core functionality (agent, context, streaming, etc.) |
| tests/ | 27 | Integration and unit tests |
### g3-planner (8 files)
### g3-computer-control (29 files)
```
lib.rs
├── code_explore.rs # Code exploration
├── git.rs # Git operations
├── history.rs # History management
├── llm.rs # LLM integration
├── planner.rs # Planning logic
├── prompts.rs # Planner prompts
└── state.rs # State management
```
| Group | Files | Purpose |
|-------|-------|--------|
| platform/ | 5 | OS-specific implementations (macos, linux, windows) |
| webdriver/ | 4 | Browser automation (safari, chrome) |
| ocr/ | 3 | Text recognition (tesseract, vision) |
| macax/ | 3 | macOS accessibility |
| examples/ | 12 | Usage examples |
### g3-providers (10 files)
| Group | Files | Purpose |
|-------|-------|--------|
| providers | 5 | LLM implementations (anthropic, databricks, openai, embedded) |
| support | 3 | OAuth, streaming utilities |
| tests/ | 3 | Provider tests |
### g3-planner (12 files)
| Group | Files | Purpose |
|-------|-------|--------|
| core | 7 | Planner logic (planner, state, llm, git, history) |
| tests/ | 4 | Planner tests |
## Observed Directionality
### Cross-Crate Import Patterns
| From Crate | To Crate | Edge Count |
|------------|----------|------------|
| g3-cli | g3-core | 5 |
| g3-cli | g3-config | 2 |
| g3-cli | g3-computer-control | 1 |
| g3-core | g3-providers | 18 |
| g3-core | g3-config | 6 |
| g3-core | g3-computer-control | 2 |
| g3-planner | g3-providers | 3 |
| g3-planner | g3-core | 5 |
| g3-planner | g3-config | 1 |
| g3-ensembles | g3-core | 1 |
| g3-ensembles | g3-config | 1 |
### Layer Violations
## Layer Violations
**None detected.**
All observed imports follow the declared crate dependency direction.
No file imports from a crate that is not declared as a dependency.
All dependencies flow downward through the layer hierarchy. No upward dependencies exist.
## Uncertainty
- Internal `use crate::` imports not fully resolved to specific files
- Some module relationships inferred from `mod` declarations only
- Test files may have additional dev-dependencies not tracked
- Layer assignment is based on dependency direction, not semantic intent
- `studio` is isolated (no internal crate dependencies) - layer assignment is nominal
- Some crates at Layer 4 could arguably be split further (e.g., `g3-computer-control` is large)

View File

@@ -1,103 +1,103 @@
# Analysis Limitations
## What Was Observed
## Extraction Method
| Source | Method | Confidence |
|--------|--------|------------|
| Crate dependencies | Parsed from Cargo.toml `[dependencies]` sections | High |
| External crate imports | Regex match on `use g3_*::` statements | High |
| Module declarations | Regex match on `mod` and `pub mod` statements | High |
| File classification | Path pattern matching (tests/, examples/, lib.rs, etc.) | High |
Dependencies extracted via:
1. Cargo.toml parsing for crate-level dependencies
2. Regex-based `use` and `mod` statement extraction from source files
## What Was Not Observed
## Known Limitations
### 1. Internal Module Imports
### 1. Conditional Compilation Not Evaluated
`use crate::` statements were detected but not resolved to specific target files.
**Impact**: File-to-file edges within a crate are incomplete. Only `mod` declaration edges are captured.
**Example not captured**:
```rust
// In ./crates/g3-core/src/streaming.rs
use crate::context_window::ContextWindow; // Edge to context_window.rs not in graph
#[cfg(target_os = "macos")]
use core_graphics::window::*;
```
### 2. Re-exports
Platform-specific imports in `g3-computer-control` are included unconditionally. The actual dependency graph varies by target platform.
`pub use` statements that re-export items from submodules are not tracked as separate edges.
**Affected files:**
- `crates/g3-computer-control/src/platform/macos.rs`
- `crates/g3-computer-control/src/platform/linux.rs`
- `crates/g3-computer-control/src/platform/windows.rs`
**Impact**: Transitive dependencies through re-exports are not visible.
### 2. Macro-Generated Imports Not Detected
Imports generated by procedural macros (e.g., `#[derive(...)]`, `#[async_trait]`) are not captured. These may introduce implicit dependencies.
**Common macros in codebase:**
- `serde::Serialize`, `serde::Deserialize`
- `async_trait::async_trait`
- `clap::Parser`
### 3. Re-Exports Not Fully Traced
**Example**:
```rust
// In ./crates/g3-core/src/lib.rs
pub use context_window::{ContextWindow, ThinScope}; // Re-export not tracked
pub use some_module::SomeType;
```
### 3. Conditional Compilation
Re-exports create transitive dependencies that are not fully traced. A file importing `SomeType` from a re-exporting module has an indirect dependency on the original module.
`#[cfg(...)]` attributes on imports are not parsed. All imports are treated as unconditional.
### 4. Glob Imports Partially Resolved
**Impact**: Platform-specific dependencies (e.g., macOS-only code in g3-computer-control) appear as universal.
### 4. Macro-Generated Imports
Imports generated by macros (e.g., `derive` macros, `include!`) are not detected.
**Impact**: Some edges may be missing if macros generate `use` statements.
### 5. Dev-Dependencies
Only `[dependencies]` sections were parsed. `[dev-dependencies]` were not included in crate-level edges.
**Impact**: Test-only dependencies (e.g., `tempfile`, `serial_test`) are not in the graph.
### 6. Build Dependencies
`[build-dependencies]` were not parsed.
**Impact**: Build script dependencies are not represented.
### 7. Feature-Gated Dependencies
Cargo features that enable optional dependencies are not tracked.
**Impact**: Optional dependencies appear the same as required ones.
### 8. Workspace Dependencies
`[workspace.dependencies]` are resolved but the inheritance relationship is not tracked.
**Impact**: Cannot distinguish workspace-inherited vs crate-specific dependency versions.
## What Was Inferred
| Inference | Basis | Confidence |
|-----------|-------|------------|
| File type classification | Filename and path patterns | Medium-High |
| Module file resolution | Rust module naming conventions (mod.rs, name.rs) | High |
| Crate membership | File path prefix matching | High |
## Potential Invalidation Conditions
1. **Non-standard module structure**: If any crate uses `#[path = "..."]` attributes to override module paths, those edges will be incorrect.
2. **Generated code**: If any `.rs` files are generated at build time (not checked into git), they are not included.
3. **Symlinks**: Symbolic links in the source tree are not followed or detected.
4. **External workspace members**: Only crates in `./crates/` and root `./src/` were analyzed. External workspace members would be missed.
## Verification Commands
To verify crate-level dependencies match Cargo's resolution:
```bash
cargo tree --prefix none --no-dedupe | grep '^g3-'
```rust
use crate::types::*;
```
To find imports not captured by this analysis:
```bash
rg 'use crate::' --type rust | wc -l # Internal imports (not fully resolved)
rg 'pub use' --type rust | wc -l # Re-exports (not tracked)
Glob imports are recorded but individual items are not enumerated. The actual coupling may be higher or lower than represented.
### 5. Test Code Excluded
Files matching these patterns are excluded:
- `*_test.rs`
- `tests/*.rs`
- `mod tests { ... }` blocks
Test dependencies are not represented in the graph.
### 6. Build Scripts Not Analyzed
`build.rs` files are not included. Build-time dependencies (e.g., code generation) are not captured.
**Affected:**
- `crates/g3-computer-control/build.rs`
### 7. External Crate Dependencies Not Graphed
Only workspace-internal dependencies are represented. External crates (tokio, serde, etc.) are not included in the graph.
### 8. Inline Module Definitions
```rust
mod foo {
// inline definition
}
```
Inline module definitions without corresponding files are detected but may not resolve to file edges.
### 9. Path Aliases Not Resolved
```rust
use crate::foo as bar;
```
Aliased imports are recorded with original path, but alias usage elsewhere is not correlated.
## What May Invalidate Conclusions
1. **Feature flags**: Cargo features may enable/disable entire modules
2. **Workspace changes**: Adding/removing crates changes the graph structure
3. **Refactoring**: Moving code between modules changes edges without changing functionality
4. **Dynamic dispatch**: Trait objects create runtime dependencies not visible statically
## Confidence Assessment
| Aspect | Confidence |
|--------|------------|
| Crate-level dependencies | High (from Cargo.toml) |
| Module tree structure | High (from mod declarations) |
| Cross-crate imports | Medium (regex-based) |
| Intra-module coupling | Low (not analyzed) |
| Runtime dependencies | Not captured |

View File

@@ -1,40 +1,44 @@
# Strongly Connected Components (Cycles)
# Strongly Connected Components Analysis
## Summary
## Method
**No non-trivial strongly connected components detected.**
Tarjan's algorithm applied to file-level dependency graph.
The dependency graph is acyclic at both the crate level and the file level.
Edge types considered:
- `mod_declaration`: Parent module declares child module
- `cross_crate_import`: File imports from another crate
## Analysis Details
## Results
- Algorithm: Tarjan's SCC algorithm
- Scope: All 143 nodes (9 crates + 134 files)
- Result: 0 cycles with size > 1
**No non-trivial SCCs detected.**
## Crate-Level Verification
The file-level dependency graph is acyclic. All `mod` declarations form a strict tree structure within each crate, and cross-crate imports follow the crate dependency DAG.
The crate dependency graph forms a directed acyclic graph (DAG):
## Crate-Level Cycle Analysis
The crate dependency graph was also analyzed:
```
Leaf crates (no dependencies on other g3-* crates):
- g3-providers
- g3-config
- g3-execution
- g3-computer-control
Intermediate crates:
- g3-core → depends on: g3-providers, g3-config, g3-execution, g3-computer-control
- g3-ensembles → depends on: g3-core, g3-config
- g3-planner → depends on: g3-providers, g3-core, g3-config
Top-level crates:
- g3-cli → depends on: g3-core, g3-config, g3-planner, g3-computer-control, g3-providers, g3-ensembles
- g3 (root) → depends on: g3-cli, g3-providers
g3 → g3-cli → g3-core → g3-providers
→ g3-config
→ g3-execution
→ g3-computer-control
→ g3-planner → g3-core
→ g3-providers
→ g3-config
→ g3-ensembles → g3-core
g3-config
```
**No cycles detected at crate level.**
The workspace forms a directed acyclic graph (DAG) with:
- Leaf crates: `g3-providers`, `g3-config`, `g3-execution`, `g3-computer-control`, `studio`
- Mid-tier crates: `g3-core`, `g3-planner`, `g3-ensembles`
- Top-tier crates: `g3-cli`, `g3`
## Implications
- No circular dependencies exist between crates
- No circular dependencies exist
- Build order is deterministic
- Crates can be compiled in topological order
- Crates can be compiled in parallel respecting the DAG