Skip to content

feat(projectkey): route by a .devbrain-project marker when a folder has no usable remote - #407

Open
jacklau04 wants to merge 1 commit into
TheWeiHu:mainfrom
jacklau04:fix/project-marker-file
Open

jacklau04 wants to merge 1 commit into
TheWeiHu:mainfrom
jacklau04:fix/project-marker-file

Conversation

@jacklau04

Copy link
Copy Markdown
Contributor

Why

Routing is keyed by the git origin remote; everything else lands in miscellaneous. Scratch folders, local-only repos and synced project directories therefore share one namespace. On my machine 17 of 30 Superset project folders have no remote: their logs, brain pages and TODO queue mix, and devbrain todo list run in one of them shows another's tasks. DEVBRAIN_PROJECT cannot fix this: capture is sweep-based, so the flusher's environment, not the session's, decides where a transcript goes.

What

  • A .devbrain-project file names the project key on its first line. ProjectKey consults it after $DEVBRAIN_PROJECT and the data-repo guard, and before the remote, walking up from cwd the way git finds .git, so subdirectories inherit it.
  • Keys go through Sanitize and the existing project-aliases canonicalisation, like remote-derived keys. Blank or dot-only values are ignored, so a marker can never resolve to projects/...
  • The remote path is unchanged; its alias step is shared via a small canonicalFor helper. README documents the marker.

How verified

  • New TestProjectKeyMarkerFile: no-git folder, subdirectory inheritance, marker-in-repo precedence over the remote, and blank / .. / ./ rejection. Failed before the change (routed to miscellaneous / the remote key), passes after.
  • make test (vet, full suite, dashboard node checks) is green.

🤖 Generated with Claude Code

…as no usable remote

Routing is keyed by the git origin remote; everything else lands in
`miscellaneous`. Scratch folders, local-only repos and synced project
directories therefore share one namespace — logs, brain pages and the TODO
queue mix. DEVBRAIN_PROJECT cannot fix it: capture is sweep-based, so the
flusher's environment, not the session's, decides.

A `.devbrain-project` file names the project key on its first line.
ProjectKey consults it after $DEVBRAIN_PROJECT and the data-repo guard and
before the remote, walking up from cwd like `.git` so subdirectories inherit
it. Keys are sanitised and canonicalised through project-aliases like remote
keys; blank or dot-only values are ignored so a marker can never resolve to
projects/.. The remote path is unchanged (shared canonicalFor helper).

Co-Authored-By: Claude Fable 5.1 <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