beads/cmd
CI Bot 200071fa1b refactor(context): one snapshot-to-fields projection for both context surfaces
`bd context` and GET /v0/beads/context both answer "which workspace is
this", and they shared nothing: each copied the same seven values out of
domain.ContextInfo field by field, so they were free to drift into naming
the same workspace differently and nothing would have noticed.

domain.PublishedContext is now that projection, once. The HTTP handler
fills its wire struct from it and names only the three members that are
the SERVER's rather than the workspace's — api version, schema version,
capabilities. contextInfoView fills the CLI's view from it and names only
the members that are local-only.

The exclusions move down with it, and that is the point of putting the
projection here rather than beside either surface.
PublishedContextFields has no SyncRemote member AT ALL — it is populated
unconditionally from the workspace's sync.remote config and remote URLs
routinely embed credentials — so a surface reaching identity through this
type cannot publish one by forgetting to leave it out. Same for the
database bind endpoint and the absolute host paths. The local CLI still
prints those, because it prints them to the terminal of whoever owns the
workspace, and it reads them off the snapshot beside the projection where
that choice is visible.

Both of `bd context`'s own routes converge here too: the direct route
reads config files itself, because it has to answer in degraded states
where no database opens, but it now assembles the same domain.ContextInfo
the provider hands the proxied route and passes it to the same view.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 22:35:09 +00:00
..
bd refactor(context): one snapshot-to-fields projection for both context surfaces 2026-07-31 22:35:09 +00:00