Skip to content

feat(tui): Add Edge Management to Edit Form#25

Open
JasonWarrenUK wants to merge 1 commit intoexperiment/auto-execute-roadmapfrom
worktree-agent-a9ba0a48
Open

feat(tui): Add Edge Management to Edit Form#25
JasonWarrenUK wants to merge 1 commit intoexperiment/auto-execute-roadmapfrom
worktree-agent-a9ba0a48

Conversation

@JasonWarrenUK
Copy link
Copy Markdown
Owner

feat(tui): Add Edge Management to Edit Form

Overview

CP.11 — Edit forms now support viewing, removing, and creating edges directly from the form UI.

Summary

Like a switchboard operator who can now see all the lines plugged into a socket and unplug the dodgy ones while patching in fresh connections — the edit form has grown tentacles of awareness about its node's relationships in the graph.

Tip

No migration steps needed. The index parameter is nil-safe — edit forms degrade gracefully when no index is available.


Changes

internal/tui/form.go — edge management in edit forms
  • Added edgeEntry struct to describe connected edges with direction, type, target, and label
  • Added index types.GraphIndex field to formPane struct
  • Added edge state fields: existingEdges, keptEdgeIDs, newEdgeType, newEdgeTarget
  • Added buildEdgeEntries() to query the index for all edges connected to a node
  • Added shortNodeLabel() to resolve target node titles for display
  • Added appendEdgeFields() to build huh multi-select (existing edges) and select/input (new edge) fields
  • Added applyEdgeChanges() to diff kept vs existing edges and delete/create on submit
  • Updated all three edit constructors (newEditTaskFormPane, newEditJournalFormPane, newEditNoteFormPane) to accept index parameter and call appendEdgeFields
  • Updated all three exported wrappers to pass through the index parameter
internal/tui/app.go — wire index into edit forms
  • handleEditNode() now passes m.index to all edit form constructors
internal/tui/form_test.go — edge management tests
  • Added formTestIndex stub implementing GraphIndex
  • Added deletedIDs tracking to formTestStore
  • Updated existing edit form tests for new constructor signature (pass nil index)
  • Added 8 new tests for CP.11:
    • TestEditFormShowsExistingEdges — multi-select appears when edges exist
    • TestEditFormShowsAddEdgeType — add-edge fields always present
    • TestEditFormNilIndexNoEdgeFields — nil index does not panic
    • TestEditFormEdgeLabelsShowTargetTitle — section renders with edges
    • TestEditFormIncomingEdgeShowsSection — incoming edges detected
    • TestEditJournalFormShowsEdgeFields — journal forms get edge fields
    • TestEditNoteFormShowsEdgeFields — note forms get edge fields
    • TestEditFormNoExistingEdgesSection — no multi-select when no edges

🤖 Generated with Claude Code

Edit forms now show existing edges via a multi-select (uncheck to
remove) and fields to create a new edge by type and target node ID.
The index is threaded through edit constructors so edge queries work
at form build time, and edge diffs are applied on submit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant