In 5 minutes, you should be able to:
- add a source
- bind it to a local directory
- sync remote content into that directory
- watch sync events
- inspect / compare / resolve a path by local path
This example uses a local filesystem source so the flow is easy to reproduce.
- remote source root:
/srv/section-demo-source - local bound root:
~/section-demo
section source add demo --provider fs --opt root=/srv/section-demo-sourceExpected shape:
Source 'demo' added (provider: fs).
section source bind demo ~/section-demoExpected shape:
Source 'demo' bound to local root /Users/you/section-demo.
Section will place a lightweight discovery marker at:
~/section-demo/.section/root.json
That marker is only for local discovery. Sync truth still comes from the control plane.
section source sync demoExpected shape:
Source 'demo' synced. local_root=/Users/you/section-demo, pulled=2, pushed=0, conflicts=0, events=2
At this point, files and directories from the remote source should exist under the bound local root.
section --json path inspect ~/section-demo/docs/readme.txtExample output shape:
{
"source_id": "demo",
"local_root": "/Users/you/section-demo",
"local_path": "/Users/you/section-demo/docs/readme.txt",
"source_path": "docs/readme.txt",
"state": "ready",
"detail": {
"local_present": true,
"dirty_local": false,
"dirty_remote": false,
"pinned": false,
"stale": false
},
"base_remote_version": "<hash>",
"current_remote_version": "<hash>"
}section --json path compare ~/section-demo/docs/readme.txtExample output shape:
{
"source_id": "demo",
"source_path": "docs/readme.txt",
"entry_kind": "file",
"state": "ready",
"local_present": true,
"remote_present": true,
"local_version": "<hash>",
"base_remote_version": "<hash>",
"current_remote_version": "<hash>",
"local_matches_base": true,
"local_matches_current_remote": true,
"stale": false
}Use path compare when you need to know whether the local file is still based on the current remote version.
section --json watch ~/section-demoExample output shape:
{"id":1,"source_name":"demo","path":"docs","kind":"synced_from_remote","state":"ready","created_at_ms":1775451218105}
{"id":2,"source_name":"demo","path":"docs/readme.txt","kind":"synced_from_remote","state":"ready","created_at_ms":1775451218106}Recommended agent loop:
- subscribe once with
watch - react only to paths named by events
- call
path inspectorpath compareon demand - call
path resolveonly when action is required
If both local and remote changed since the last common remote base, Section enters conflict and refuses blind overwrite.
Check the conflicted path:
section --json path compare ~/section-demo/docs/readme.txtConflict output shape:
{
"state": "conflict",
"local_matches_base": false,
"local_matches_current_remote": false,
"stale": true
}Then choose a resolution:
section --json path resolve ~/section-demo/docs/readme.txt --strategy use-localOr:
section --json path resolve ~/section-demo/docs/readme.txt --strategy use-remoteResolution output shape:
{
"source_id": "demo",
"source_path": "docs/readme.txt",
"strategy": "use-local",
"state": "ready",
"base_remote_version": "<hash>",
"current_remote_version": "<hash>"
}- work in the local tree for normal editing
- use the control plane for sync truth
- use
watchfor notification - use
inspect/compare/resolvefor decisions