MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / select

Function select

atomic-cli/src/commands/query/graph_inspector.js:142–183  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

140 });
141 }
142 function select(id) {
143 var node = byId.get(id);
144 picker.value = node ? node.id : '';
145 clear.disabled = !node;
146 container.dataset.selectedNode = node ? node.id : '';
147 content.replaceChildren();
148 container.scrollTop = 0;
149 if (!node) {
150 status.textContent = 'No node selected.';
151 content.appendChild(element('p', 'Click a node to pin its details here. Follow a relationship to inspect its other endpoint. Escape or Clear resets selection.', 'inspector-muted'));
152 } else {
153 status.textContent = 'Selected: ' + (node.label || node.id);
154 field('Label', node.label || '(no label)');
155 field('Canonical ID', node.id);
156 field('Types', (node.types || [node.kind]).join('\n'));
157 field('Source', node.source || '(not recorded)');
158 field('Summary', node.summary || '(no summary recorded)');
159 usageDetails(node);
160 var metadata = section('Metadata');
161 if (node.metadata === undefined || node.metadata === null) {
162 metadata.appendChild(element('p', 'No metadata exported.', 'inspector-muted'));
163 } else if (typeof node.metadata === 'object' && !Array.isArray(node.metadata)) {
164 Object.keys(node.metadata).filter(function(key) {
165 return !['ai_usage', 'ai_usage_records', 'ai_usage_state', 'ai_usage_record_version'].includes(key);
166 }).sort().forEach(function(key) {
167 metadata.appendChild(element('h4', key));
168 var value = node.metadata[key];
169 metadata.appendChild(element('pre', typeof value === 'string' ? value : JSON.stringify(value, null, 2), 'inspector-value'));
170 });
171 } else {
172 metadata.appendChild(element('pre', JSON.stringify(node.metadata, null, 2), 'inspector-value'));
173 }
174 relationships('Outgoing relationships', outgoing.get(node.id) || []);
175 relationships('Incoming relationships', incoming.get(node.id) || []);
176 var raw = element('details', undefined, 'inspector-section');
177 raw.appendChild(element('summary', 'Raw exported node'));
178 raw.appendChild(element('pre', JSON.stringify(node, null, 2), 'inspector-value'));
179 content.appendChild(raw);
180 content.appendChild(element('p', 'Snapshot data only. File contents and historical patch bodies are not fetched.', 'inspector-muted'));
181 }
182 if (onSelect) onSelect(node ? node.id : null);
183 }
184 picker.addEventListener('change', function() { select(picker.value); });
185 clear.addEventListener('click', function() { select(null); picker.focus(); });
186 doc.addEventListener('keydown', function(event) {

Callers 2

relationshipsFunction · 0.85
createGraphInspectorFunction · 0.85

Calls 8

elementFunction · 0.85
usageDetailsFunction · 0.85
relationshipsFunction · 0.85
sortMethod · 0.80
includesMethod · 0.80
fieldFunction · 0.70
sectionFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected