MCPcopy Index your code
hub / github.com/deepnote/deepnote / outputDot

Function outputDot

packages/cli/src/commands/dag.ts:497–526  ·  view source on GitHub ↗
(dag: BlockDependencyDag, blockMap: BlockMap)

Source from the content-addressed store, hash-verified

495}
496
497function outputDot(dag: BlockDependencyDag, blockMap: BlockMap): void {
498 const lines: string[] = []
499
500 lines.push('digraph dependencies {')
501 lines.push(' rankdir=TB;')
502 lines.push(' node [shape=box, style=rounded];')
503 lines.push('')
504
505 // Add nodes with labels
506 for (const node of dag.nodes) {
507 const info = blockMap.get(node.id)
508 const label = info?.label ?? node.id
509 const escapedLabel = label.replace(/"/g, '\\"')
510 const color = node.error ? 'red' : 'black'
511 lines.push(` "${node.id}" [label="${escapedLabel}", color=${color}];`)
512 }
513
514 lines.push('')
515
516 // Add edges
517 for (const edge of dag.edges) {
518 const vars = edge.inputVariables.join(', ')
519 const escapedVars = vars.replace(/"/g, '\\"')
520 lines.push(` "${edge.from}" -> "${edge.to}" [label="${escapedVars}"];`)
521 }
522
523 lines.push('}')
524
525 output(lines.join('\n'))
526}
527
528function handleError(error: unknown, options: DagOptions): never {
529 if (error instanceof DagHandledError) {

Callers 1

outputDagShowFunction · 0.85

Calls 1

outputFunction · 0.90

Tested by

no test coverage detected