Skip to content

feat: directional sync + devcontainer demo + graph polish/persistence#43

Merged
aniongithub merged 3 commits into
mainfrom
feat/wiki-sync-demo
May 19, 2026
Merged

feat: directional sync + devcontainer demo + graph polish/persistence#43
aniongithub merged 3 commits into
mainfrom
feat/wiki-sync-demo

Conversation

@aniongithub
Copy link
Copy Markdown
Owner

A self-documenting devcontainer + the graph polish from last night. Three commits.

1. 9a80027 — Graph polish: translucent edges, opaque arrows, fit-all button

  • Edges are translucent so they don't visually merge with nodes of the same color: path edges at 0.5 alpha, reference edges at 0.55. Path edge width bumped 1px → 1.5px to compensate for softer contrast.
  • Arrowheads stay opaque via linkDirectionalArrowColor set to the full-alpha edge color — the arrow reliably covers the translucent line where it would otherwise show through.
  • Arrow length 4 → 2.5 (was oversized at the new node radius).
  • New "fit all" button in the graph toolbar — forceGraph.zoomToFit(400ms, 40px). Handy when a search filter has narrowed the visible set to a few far-apart nodes.
  • withAlpha() helper handles #rgb, #rrggbb, #rrggbbaa, and rgb()/rgba() so the alpha override survives whatever format CSS vars use.

2. 7c9a757 — Directional sync + devcontainer demo via the wiki itself

The headline feature: a fresh git clone + devcontainer rebuild now downloads mind-map's own documentation from the project's GitHub wiki via the very sync feature we're demonstrating.

Sync direction (new code)

  • New SyncMapping.Direction field. Values: bidirectional (default, backward-compatible), pull (read-only — never push local changes), push (write-only — never pull remote changes).
  • SyncDirection.Normalize() coerces empty/unknown values to bidirectional so existing configs keep working.
  • syncTarget honors direction: pull skips copyFromWiki + commit + push; push skips copyToWiki + reindex. Both modes still fetch+merge so push has a base and pull picks up remote changes — only the local copy directions are gated.
  • Regression tests: TestPullOnlyDoesNotPushLocalChanges and TestPushOnlyDoesNotPullRemoteChanges.

Devcontainer wiring

  • .devcontainer/devcontainer.json bind-mounts ${localWorkspaceFolder}/.mind-map as the vscode user's ~/.mind-map/ so the committed sync config is what mind-map serve reads.
  • .mind-map/config.json declares a single pull-only mapping at prefix:"" pointing at https://github.com/aniongithub/mind-map.wiki.git.
  • .mind-map/.gitignore keeps everything but config.json out of git (wiki content, SQLite index, shadow clones, logs all regenerated on first launch).
  • .vscode/launch.json drops --dir overrides — defaults route to ~/.mind-map/wiki where sync lands content.

SKILL.md updates

  • Adds move_page to the tools list + a dedicated section explaining why agents should use it instead of create+delete (atomic rename, preserves the link graph).
  • Adds a "Wiki Layout (Recommended)" section nudging agents toward <project-or-area>/<category>/<page>. Not enforced — encouraged so prefix-based sync mappings have meaningful shapes.
  • Adds a "Sync" section explaining the new direction modes.

testdata removal

The previous testdata/ contents have been pushed to the GitHub wiki (33 pages: concepts/, architecture/, agents/, design/, comparisons/, guides/). Fresh devcontainer launches pull that content down via sync instead of carrying it in-repo.

Verified end-to-end

Rebuilt the devcontainer, ran mind-map serve, sync created the shadow clone and populated 34 pages into the wiki dir within 1.5 seconds. /api/context returned the full page list. Pull-only direction confirmed in logs (no commit/push attempted).

3. acfb1f7 — Graph auto-fits on first load, persists pan/zoom

  • On first mount we subscribe to onEngineStop and call zoomToFit(400, 40) the first time the simulation cools, so users always land on the full graph rather than a random pre-layout fragment.
  • onZoomEnd persists the current {k, x, y} transform to localStorage under mm-graph-view. Subsequent loads restore it via centerAt + zoom (duration=0) and skip the auto-fit.
  • Guarded with a closure-local flag so zoom-end events during the auto-fit animation don't clobber the meaningful saved state, and so later simulation kicks (e.g. theme changes re-feeding data) don't snap the view back.

… button

  - Edges are now translucent so they don't visually merge with nodes
    of the same color: path edges at 0.5 alpha, reference edges at
    0.55. Path edge width bumped 1px → 1.5px to compensate for the
    softer contrast.
  - Arrowheads stay opaque via linkDirectionalArrowColor set to the
    full-alpha edge color, so they reliably cover the translucent
    line where it would otherwise show through the arrow body. Arrow
    length shrunk 4 → 2.5 — felt oversized at the new node radius.
  - New 'fit all' button in the graph toolbar. Calls
    forceGraph.zoomToFit(400ms, 40px padding) — handy when a search
    filter has narrowed the visible set down to a few far-apart
    nodes, or when the user has zoomed/panned away from the layout.
  - withAlpha() helper handles #rgb, #rrggbb, #rrggbbaa, and
    rgb()/rgba() forms so the alpha override survives whatever CSS
    var format the theme uses.
Adds a per-mapping direction field to the sync config and uses it to
ship a self-documenting devcontainer: on first launch the container
pulls mind-map's own documentation down from the project's GitHub
wiki via the very sync feature we're demonstrating.

## Sync direction

  - New SyncMapping.Direction field. Values: 'bidirectional'
    (default, backward-compatible), 'pull' (read-only — never push
    local changes), 'push' (write-only — never pull remote changes).
  - SyncDirection.Normalize() coerces empty/unknown values to
    bidirectional so existing configs keep working.
  - syncTarget honors direction: pull skips copyFromWiki + commit +
    push; push skips copyToWiki + reindex.
  - Both modes still fetch+merge so push has a base to push onto and
    pull picks up remote changes — only the local copy directions
    are gated.
  - Regression tests: TestPullOnlyDoesNotPushLocalChanges and
    TestPushOnlyDoesNotPullRemoteChanges.

## Devcontainer wiring

  - .devcontainer/devcontainer.json bind-mounts the workspace's
    .mind-map/ as the vscode user's ~/.mind-map/ so the committed
    sync config is what mind-map serve reads.
  - .mind-map/config.json declares a single pull-only mapping at
    prefix '' pointing at the project's GitHub wiki repo.
  - .mind-map/.gitignore keeps everything but config.json out of
    git (the wiki content, sqlite index, shadow clones, logs all
    get regenerated on first launch).
  - .vscode/launch.json drops --dir overrides; defaults route to
    ~/.mind-map/wiki which is now where sync lands content.

## SKILL.md updates

  - Adds move_page to the tools list and a dedicated section
    explaining why agents should use it instead of create+delete.
  - Adds a 'Wiki Layout (Recommended)' section nudging agents
    toward <project-or-area>/<category>/<page>. Not enforced, but
    encouraged so prefix-based sync mappings have meaningful
    shapes to bite on.
  - Adds a 'Sync' section explaining the new direction modes.

## testdata removal

The previous testdata/ contents have been pushed to the GitHub wiki
(33 pages organized as concepts/, architecture/, agents/, design/,
comparisons/, guides/). Fresh devcontainer launches now pull that
content down via sync instead of carrying it in-repo.

Verified end-to-end: rebuilt devcontainer, ran mind-map serve, sync
created the shadow clone and populated 34 pages into the wiki dir
within 1.5 seconds. /api/context returned the full page list.
  - On first mount we subscribe to onEngineStop and call
    zoomToFit(400, 40) the first time the simulation cools, so the
    user always sees the full graph rather than landing on a random
    pre-layout fragment.
  - onZoomEnd persists the current {k, x, y} transform to
    localStorage under 'mm-graph-view'. Subsequent loads restore it
    via centerAt + zoom (duration=0) and skip the auto-fit.
  - Guarded with a closure-local 'initialViewApplied' flag so the
    zoom-end events that fire during the auto-fit animation don't
    clobber the meaningful persisted state, and so later simulation
    kicks (e.g. theme changes re-feeding data) don't snap the view
    back to the auto-fit.
@aniongithub aniongithub merged commit 1cf9170 into main May 19, 2026
1 check passed
@aniongithub aniongithub deleted the feat/wiki-sync-demo branch May 19, 2026 06:25
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