fix(brain): align Windows getCleoHome with env-paths Data subdir#103
Open
calabresejordan-Caljord wants to merge 2 commits intokryptobaseddev:mainfrom
Conversation
On Windows, both `@cleocode/brain` and `@cleocode/studio` resolved `cleoHome` to `%LOCALAPPDATA%\cleo`, but the CLI uses `env-paths` (or equivalent) which appends a `Data` subdir, so `cleo admin paths --json` reports `cleoHome` as `%LOCALAPPDATA%\cleo\Data`. Result: Brain's `getNexusDbPath()` and `getSignaldockDbPath()` pointed at non-existent files. `getNexusSubstrate()` / `getSignaldockSubstrate()` silently returned 0 nodes despite populated DBs being present at the correct (one-level-deeper) path. Setting `CLEO_HOME=%LOCALAPPDATA%\cleo\Data` worked around it. Patch the win32 branch in both files to append `'Data'`, with a comment explaining the env-paths convention. macOS and Linux branches are unchanged. The `packages/brain/src/cleo-home.ts` header comment is updated to match. The Brain header notes that this file is "a trimmed mirror of packages/studio/src/lib/server/cleo-home.ts ... Kept in sync manually" so both files must be patched together. Signed-off-by: Jordan Calabrese <calabresejordan@gmail.com>
The spec listed the Windows nexus.db location as `%APPDATA%/cleo/` (Roaming, no `Data` subdir), but the CLI actually writes to `%LOCALAPPDATA%/cleo/Data/`. The previous text mismatched both: 1. wrong base env var (`%APPDATA%` is Roaming; CLEO uses Local). 2. missing the `Data` subdir that the env-paths convention appends. Update the location line for nexus.db so it matches `cleo admin paths --json` and the corrected Brain/Studio code paths in the companion fix. Signed-off-by: Jordan Calabrese <calabresejordan@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Target branch
develop-- Normal feature/fix (default)main-- Hotfix only (bypasses develop, requires back-merge to develop after)Process compliance
fix/...branch<type>(<scope>): <subject>(no T-id since this is an external bug; scope is the package)Summary
getCleoHome()on Windows in both@cleocode/brainand@cleocode/studioto append theDatasubdir, matching theenv-pathsconvention the CLI uses.docs/specs/DATABASE-ARCHITECTURE.mdWindows path to match.Change type
Related issues
Closes #102
Repro (before this PR)
Verified on this Windows host (
cleo@2026.4.158,@cleocode/brain@2026.4.161, Node v24.13.0, Win 11):Result:
getNexusSubstrate()/getSignaldockSubstrate()silently return 0 nodes despite populated DBs.After this PR
How was this tested
pnpm test(Vitest) -- not run; this is a Windows-host-only path resolution change with no existing tests forcleo-home.ts(no__tests__/cleo-home.test.tsin the brain package). Happy to add a test if you want one written.pnpm typecheck-- not run locallypnpm build-- not run locallydist/src/cleo-home.jsapplied to a global install,getCleoHome()returns%LOCALAPPDATA%\cleo\Dataand Brain's nexus/signaldock paths now resolve to existing files (exists: true). Project-tier substrates (tasks/brain/conduit) continue to work unchanged.CLEO-specific checklist
fix(brain): ...anddocs(database-architecture): ...per CONTRIBUTING.md (T-id omitted because non-release; release-lint hook exits 0 for non-release commits perscripts/hooks/commit-msg-release-lint.mjs)Environment
AI agent disclosure
Notes
Both commits include
Signed-off-by: Jordan Calabrese <calabresejordan@gmail.com>.packages/brain/src/cleo-home.tsnotes in its header that it is "a trimmed mirror ofpackages/studio/src/lib/server/cleo-home.ts... Kept in sync manually" -- both files are patched together so they stay in sync. Suggest a follow-up to either factorgetCleoHomeinto a shared utility (perhaps inpackages/contracts) or replace both with a direct dependency onenv-paths, but that's out of scope here.