Repository navigation
Description
Parent Issue
Part of Epic #69: Text Editor Architecture Enhancement - Phase 2
Summary
Implement Universal Node Reference Service to provide real-time @ trigger detection, nodespace:// URI creation, and autocomplete-based node selection with bidirectional reference tracking.
Background
Building on Phase 1's enhanced ContentProcessor, this implements the universal node reference system that enables NodeSpace to reference any node type (users, tasks, documents, dates, custom entities) through a single @ trigger interface.
Architectural Foundation: ADR-005 establishes the universal @ trigger system with nodespace:// URIs and content-driven decorations.
Core Functionality
- Universal
@Trigger: Single interface for referencing any node type - Autocomplete Selection: Modal with search/filter for existing nodes or creation
nodespace://URI Storage: Standard markdown links with custom URI scheme- Bidirectional References: Maintain consistent relationship tracking
Service Interface
interface NodeReferenceService {
// @ trigger detection and handling
detectTrigger(content: string, cursorPosition: number): TriggerContext | null;
showAutocomplete(triggerContext: TriggerContext): Promise<AutocompleteResult>;
insertNodeReference(selectedNode: BaseNode, insertPosition: Position): string;
// nodespace:// URI handling
parseNodespaceURI(uri: string): NodeReference;
createNodespaceURI(nodeId: string, options?: URIOptions): string;
resolveNodespaceURI(uri: string): BaseNode | null;
// Bidirectional reference management
addReference(sourceId: string, targetId: string): void;
removeReference(sourceId: string, targetId: string): void;
getOutgoingReferences(nodeId: string): NodeReference[];
getIncomingReferences(nodeId: string): NodeReference[];
// Node search and creation
searchNodes(query: string, nodeType?: string): BaseNode[];
createNode(nodeType: string, content: string): BaseNode;
// ContentProcessor integration
enhanceContentProcessor(): void;
detectNodespaceLinks(content: string): NodespaceLink[];
}
interface TriggerContext {
position: number;
query: string;
element: HTMLElement;
cursorRect: DOMRect;
}
interface NodeReference {
sourceId: string;
targetId: string;
linkText: string;
nodeType: string;
created: Date;
resolved: boolean;
}
interface NodespaceLink {
linkText: string;
nodeId: string;
startPos: number;
endPos: number;
resolved: boolean;
}Implementation Tasks
- Create NodeReferenceService interface and core implementation
- Implement
@keystroke detection in contenteditable elements - Build autocomplete modal with node search and filtering
- Create
nodespace://URI parsing and generation - Implement bidirectional reference tracking with Map storage
- Enhance ContentProcessor to detect
nodespace://links - Build node search service with fuzzy matching
- Create node creation flow for new entities
- Integrate with existing TextNode component
- Add real-time reference updates via EventBus
Acceptance Criteria
-
@keystroke triggers autocomplete modal in any text editing context - Autocomplete shows existing nodes filtered by search query
- Selecting node inserts
[content](nodespace://uuid)markdown link - Creating new node generates UUID and inserts reference
-
nodespace://URIs resolve to correct node instances - Bidirectional reference tracking maintains consistency
- Performance handles 100+ simultaneous references efficiently
- Integration preserves all existing TextNode functionality
- Foundation ready for Phase 2.2 rich decorations
Dependencies
- Phase 1.1: Enhanced ContentProcessor with Dual-Representation #70
- Phase 1.3: EventBus System for Dynamic Coordination #72
- Phase 1.3: Migrate Core Logic Components from nodespace-core-logic #75
Estimated Effort
7-8 days
Definition of Done
- NodeReferenceService implemented with comprehensive functionality
-
@trigger detection working in text editor - Autocomplete modal functional with node search/creation
-
nodespace://URI system operational and tested - Bidirectional reference tracking working
- ContentProcessor enhanced for
nodespace://link detection - Performance benchmarks meet requirements
- All existing functionality preserved
- Documentation and code review completed
Technical Notes
This service replaces the planned [[wikilink]] approach with the superior universal @ trigger system documented in ADR-005. The implementation prepares the foundation for rich node type decorations in Phase 2.2.
Activity
Implement core logic migration from nodespace-core-logic to TypeScript
Phase 1.3: Migrate Core Logic Components from nodespace-core-logic (#78)
Epic #69 Phase 2: Complete Universal Node Reference System
Complete Phase 2 implementation: Component-based node reference decor…
Complete Design System Integration with NodeViewer (#91)
Epic: Text Editor Architecture Enhancement (#92)
Major Enhancement: Design System Integration with NodeViewer and Prec…
Fix universal references system integration issues
Document unlocked Universal References System (Issues #73, #74)
malibio commentedon Sep 25, 2025
Closing as superseded by business logic layer approach. Mentions/backlinks will be handled by the new Rust backend mention system (Issue #105).
Phase 1.3: Migrate Core Logic Components from nodespace-core-logic (#78)
Complete Design System Integration with NodeViewer (#91)
Epic: Text Editor Architecture Enhancement (#92)
Major Enhancement: Design System Integration with NodeViewer and Prec…
Implement core logic migration from nodespace-core-logic to TypeScript
Fix universal references system integration issues
Document unlocked Universal References System (Issues #73, #74)
Phase 1.3: Migrate Core Logic Components from nodespace-core-logic (#78)
Complete Design System Integration with NodeViewer (#91)
Epic: Text Editor Architecture Enhancement (#92)
Major Enhancement: Design System Integration with NodeViewer and Prec…
Implement core logic migration from nodespace-core-logic to TypeScript
Fix universal references system integration issues
Document unlocked Universal References System (Issues #73, #74)
Rename methodology "recipe" to "Playbook" across code and docs (#2897)