archiving tracks
This commit is contained in:
9
conductor/archive/on_demand_def_lookup_20260306/index.md
Normal file
9
conductor/archive/on_demand_def_lookup_20260306/index.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# On-Demand Definition Lookup
|
||||
|
||||
**Track ID:** on_demand_def_lookup_20260306
|
||||
|
||||
**Status:** Planned
|
||||
|
||||
**See Also:**
|
||||
- [Spec](./spec.md)
|
||||
- [Plan](./plan.md)
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "on_demand_def_lookup_20260306",
|
||||
"name": "On-Demand Definition Lookup",
|
||||
"status": "planned",
|
||||
"created_at": "2026-03-06T00:00:00Z",
|
||||
"updated_at": "2026-03-06T00:00:00Z",
|
||||
"type": "feature",
|
||||
"priority": "medium"
|
||||
}
|
||||
49
conductor/archive/on_demand_def_lookup_20260306/plan.md
Normal file
49
conductor/archive/on_demand_def_lookup_20260306/plan.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Implementation Plan: On-Demand Definition Lookup (on_demand_def_lookup_20260306)
|
||||
|
||||
> **Reference:** [Spec](./spec.md) | [Architecture Guide](../../../docs/guide_architecture.md)
|
||||
|
||||
## Phase 1: Symbol Parsing [checkpoint: f392aa3]
|
||||
Focus: Parse @symbol syntax from user input
|
||||
|
||||
- [x] Task 1.1: Initialize MMA Environment
|
||||
- [x] Task 1.2: Implement @symbol regex parser (a0a9d00)
|
||||
- WHERE: `src/gui_2.py` in `_send_callback()`
|
||||
- WHAT: Extract @SymbolName patterns
|
||||
- HOW:
|
||||
```python
|
||||
import re
|
||||
def parse_symbols(text: str) -> list[str]:
|
||||
return re.findall(r'@(\w+(?:\.\w+)*)', text)
|
||||
```
|
||||
|
||||
## Phase 2: Definition Retrieval
|
||||
Focus: Use existing MCP tool to get definitions
|
||||
|
||||
- [x] Task 2.1: Integrate py_get_definition (c6f9dc8)
|
||||
- WHERE: `src/gui_2.py`
|
||||
- WHAT: Call MCP tool for each symbol
|
||||
- HOW:
|
||||
```python
|
||||
from src import mcp_client
|
||||
def get_symbol_definition(symbol: str, files: list[str]) -> tuple[str, str] | None:
|
||||
for file_path in files:
|
||||
result = mcp_client.py_get_definition(file_path, symbol)
|
||||
if result and "not found" not in result.lower():
|
||||
return (file_path, result)
|
||||
return None
|
||||
```
|
||||
|
||||
## Phase 3: Inline Display [checkpoint: 7ea833e]
|
||||
Focus: Display definition in discussion
|
||||
|
||||
- [x] Task 3.1: Inject definition as context (7ea833e)
|
||||
|
||||
## Phase 4: Click Navigation [checkpoint: 7ea833e]
|
||||
Focus: Allow clicking definition to open file
|
||||
|
||||
- [x] Task 4.1: Store file/line metadata with definition (7ea833e)
|
||||
- [x] Task 4.2: Add click handler (7ea833e)
|
||||
|
||||
## Phase 5: Testing [checkpoint: 7ea833e]
|
||||
- [x] Task 5.1: Write unit tests for parsing (7ea833e)
|
||||
- [x] Task 5.2: Conductor - Phase Verification (7ea833e)
|
||||
115
conductor/archive/on_demand_def_lookup_20260306/spec.md
Normal file
115
conductor/archive/on_demand_def_lookup_20260306/spec.md
Normal file
@@ -0,0 +1,115 @@
|
||||
# Track Specification: On-Demand Definition Lookup (on_demand_def_lookup_20260306)
|
||||
|
||||
## Overview
|
||||
Add ability for agent to request specific class/function definitions during discussion. Parse @symbol syntax to trigger lookup and display inline in the discussion.
|
||||
|
||||
## Current State Audit
|
||||
|
||||
### Already Implemented (DO NOT re-implement)
|
||||
|
||||
#### MCP Tool (mcp_client.py)
|
||||
- **`py_get_definition(path, name)`**: Returns full source of class/function/method
|
||||
- **Already exposed to AI** as tool #18 in tool inventory
|
||||
- **Parameters**: `path` (file path), `name` (symbol name, supports `ClassName.method_name`)
|
||||
|
||||
#### Code Outline Tool (outline_tool.py)
|
||||
- **`CodeOutliner` class**: Uses AST to extract code structure
|
||||
- **`outline(code: str) -> str`**: Returns hierarchical outline
|
||||
|
||||
#### GUI Discussion (gui_2.py)
|
||||
- **`_render_discussion_panel()`**: Renders discussion history
|
||||
- **`_send_callback()`**: Handles user input submission
|
||||
- **No @symbol parsing exists**
|
||||
|
||||
### Gaps to Fill (This Track's Scope)
|
||||
- No parsing of @symbol syntax in user input
|
||||
- No automatic definition lookup on @symbol
|
||||
- No inline display of definitions in discussion
|
||||
- No click-to-navigate to source file
|
||||
|
||||
## Architectural Constraints
|
||||
|
||||
### Lookup Performance
|
||||
- Definition lookup MUST complete in <100ms
|
||||
- Use existing MCP tool - no new parsing needed
|
||||
|
||||
### Display Integration
|
||||
- Definitions displayed inline in discussion flow
|
||||
- Preserve discussion context (don't replace user message)
|
||||
|
||||
## Architecture Reference
|
||||
|
||||
### Key Integration Points
|
||||
|
||||
| File | Lines | Purpose |
|
||||
|------|-------|---------|
|
||||
| `src/gui_2.py` | ~1400-1500 | `_send_callback()` - add @symbol parsing |
|
||||
| `src/gui_2.py` | ~1200-1300 | `_render_discussion_panel()` - display definitions |
|
||||
| `src/mcp_client.py` | ~400-450 | `py_get_definition()` - existing tool |
|
||||
| `src/outline_tool.py` | 10-30 | `CodeOutliner` class |
|
||||
|
||||
### Proposed Flow
|
||||
```
|
||||
1. User types: "Check @MyClass.method_name implementation"
|
||||
2. _send_callback() parses input, finds @symbol
|
||||
3. Call py_get_definition() for symbol
|
||||
4. Inject definition into discussion as system message
|
||||
5. Display with syntax highlighting
|
||||
6. Click on definition opens file at line
|
||||
```
|
||||
|
||||
## Functional Requirements
|
||||
|
||||
### FR1: @Symbol Parsing
|
||||
- Parse user input for `@SymbolName` pattern
|
||||
- Support: `@FunctionName`, `@ClassName`, `@ClassName.method_name`
|
||||
- Extract symbol name and optional file context
|
||||
|
||||
### FR2: Definition Retrieval
|
||||
- Use existing `py_get_definition()` MCP tool
|
||||
- If no file specified, search all project files
|
||||
- Handle "symbol not found" gracefully
|
||||
|
||||
### FR3: Inline Display
|
||||
- Inject definition as special discussion entry
|
||||
- Use monospace font with syntax highlighting
|
||||
- Show file path and line numbers
|
||||
- Collapse long definitions (>50 lines)
|
||||
|
||||
### FR4: Click Navigation
|
||||
- Store file path and line number with definition
|
||||
- On click, open file viewer at that location
|
||||
- Use existing file viewing mechanism
|
||||
|
||||
## Non-Functional Requirements
|
||||
|
||||
| Requirement | Constraint |
|
||||
|-------------|------------|
|
||||
| Lookup Time | <100ms per symbol |
|
||||
| Display Impact | No frame drop during display |
|
||||
| Memory | Definitions not cached (lookup each time) |
|
||||
|
||||
## Testing Requirements
|
||||
|
||||
### Unit Tests
|
||||
- Test @symbol regex parsing
|
||||
- Test symbol name extraction
|
||||
- Test file path resolution
|
||||
|
||||
### Integration Tests (via `live_gui` fixture)
|
||||
- Type @symbol, verify definition appears
|
||||
- Click definition, verify navigation works
|
||||
|
||||
## Out of Scope
|
||||
- Auto-fetch on unknown symbols (explicit @ only)
|
||||
- Definition editing inline
|
||||
- Multi-file symbol search optimization
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] @symbol triggers lookup
|
||||
- [ ] Definition displays inline in discussion
|
||||
- [ ] File path and line numbers shown
|
||||
- [ ] Click navigates to source
|
||||
- [ ] "Not found" handled gracefully
|
||||
- [ ] Uses existing `py_get_definition()`
|
||||
- [ ] 1-space indentation maintained
|
||||
Reference in New Issue
Block a user