Codync
免費、開源的 1:1 替代方案,取代 Grok Bot 與 Muse。從 iPhone、Mac 或 Linux 桌面將 Claude Code、Codex、Cursor 與 40+ 程式碼代理人作為持續機器人傳訊。群組聊天、主題串…
AI 翻譯
尚未收集儲存庫資訊。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
Turn Python-like pseudocode into an editable control-flow graph
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗English | 日本語
An interactive web application that generates live, layout-preserving control-flow graphs (CFGs)from Python-like or CUDA-like pseudocode
Live demo: pseudo-cfg.r4ai.dev
Creating control-flow graphs for algorithms, specifications, or lecture slides usually forces a trade-off:
if or loop requires moving nodes and re-routing arrows by handPseudo CFG combines a forgiving pseudocode parser with an incremental layout engine.
You write Python-like or CUDA-like pseudocode on the left, fine-tune node positions on the right, and keep your layout intact as the code evolves.
flowchart LR
subgraph Editor["CodeMirror 6 Editor"]
Code["Python- / CUDA-like Pseudocode"]
end
subgraph Engine["CFG & Layout Engine"]
Parse["Forgiving Parser & CFG Builder"]
Reconcile["LCS Node Reconciliation"]
Layout["Incremental Layout & Orthogonal Router"]
end
subgraph Canvas["Interactive React Flow Canvas"]
Graph["Draggable CFG (Blocks / Statements)"]
Export["Clipboard PNG / SVG / Share URL"]
end
Code --> Parse --> Reconcile --> Layout --> Graph
Graph --> Export
Graph -. "Click / Double-click sync" .-> Code
def, if / elif / else, while, for, break, continue, return, and raisetry / except and match / case as branches and treats any other text as a plain statement__global__ kernels, if / else if / else, for, while, do / while, and switch with fallthroughTrue / next paths straight down and False / done branches in columns to the rightT, F, next, done, raise) in collision-free positionsBlocks) and per-statement (Statements) granularity#code=... URL fragments (never sent to a server) and saves state in localStorage| Action | Effect |
|---|---|
| Drag a node | Adjust position(preserved across code edits and saved in localStorage) |
| Drag empty canvas | Box-select multiple nodes |
Scroll / Space + drag | Pan the canvas |
⌘ / Ctrl + scroll | Zoom in or out |
| Click a node | Highlight corresponding lines in the editor |
Double-click / Enter on a node | Jump editor cursor to the node's source line |
⌘ / Ctrl + Z⌘ / Ctrl + Shift + Z | Undo / redo layout changes(when the canvas is focused) |
Blocks / Statements | Toggle between basic-block nodes and single-statement nodes |
Tidy up | Discard manual adjustments and run a fresh structured layout |
Copy PNG / Export menu | Copy a 2x PNG to the clipboard or download as PNG / SVG |
Examples / Link button | Load sample pseudocode or copy a #code=... share URL |
| Problems status bar | Open syntax / unreachable-code diagnostics and jump to the line |
| Construct | Graph Representation |
|---|---|
def name(args): | Separate CFG component placed side by side with other scopes |
if cond: / elif cond: / else: | Diamond branch node with green T (down) and red F (right) exits |
while cond: (+ optional else:) | Diamond header with T loop body, dashed back edge, and F exit |
for x in items: (+ optional else:) | Hexagon header with green next body, dashed back edge, and red done exit |
break / continue | Jump edge to the loop exit or dashed back edge to the loop header |
return / raise | Jump edge directly to the scope's end node (raise labeled in red) |
try: / except: / match: / case: | Sequential header with optional branch per except or case (with warning) |
| Any other line | Plain statement node (merged into basic blocks in Blocks mode) |
| Shortcut (macOS / Windows & Linux) | Action |
|---|---|
⌘D / Ctrl+D | Select next occurrence |
⌘⇧L / Ctrl+Shift+L | Select all occurrences |
⌥Click / Alt+Click | Add cursor |
⇧⌥Drag / Shift+Alt+Drag | Box (column) selection |
⌘⌥↑/↓ / Ctrl+Alt+↑/↓ | Add cursor above / below |
⌥↑/↓ / Alt+↑/↓ | Move line up / down |
⇧⌥↑/↓ / Shift+Alt+↑/↓ | Copy line up / down |
⌘⇧K / Ctrl+Shift+K | Delete line |
⌘/ / Ctrl+/ | Toggle line comment |
⌘] / ⌘[ (Ctrl+] / Ctrl+[) | Indent / outdent line |
⌘F / ⌘⌥F (Ctrl+F / Ctrl+H) | Find / replace |
⌃G / Ctrl+G | Go to line |
flowchart TD
Source["1. Parse Pseudocode (parse.ts)"] --> Build["2. Build Scope CFGs (build-cfg.ts)"]
Build --> Reconcile["3. Reconcile Node IDs via LCS (reconcile.ts)"]
Reconcile --> ReplaceCheck{"Mostly replaced?"}
ReplaceCheck -- "Yes" --> Auto["Fresh Structured Layout (structured-layout.ts)"]
ReplaceCheck -- "No" --> Inc["4. Incremental Placement & Push-Down (layout.ts)"]
Auto & Inc --> Route["5. Obstacle-Avoiding Orthogonal Routing (edge-route.ts)"]
Route --> Render["Render Canvas & Standalone SVG / PNG"]
top-level and each def)True / next spine vertically and places False / done branches to the rightSee Architecture & Internals for algorithm details.