mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-14 09:11:54 +00:00
* fix(desktop): honor default project directory for new sessions The Settings picker persisted project-dir.json but the renderer kept seeding new chats from sticky localStorage home. Prefer the configured default on boot and session.create, pin TERMINAL_CWD at backend spawn, and reject packaged install-dir paths that regressed after #37536. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(desktop): address review on default project dir PR Add workspace cwd precedence tests, extract isPackagedInstallPath for platform test coverage, and stop rewriting live $currentCwd when a session is already active (cache-only until the next new chat). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
/**
|
|
* Tests for electron/workspace-cwd.cjs.
|
|
*
|
|
* Run with: node --test electron/workspace-cwd.test.cjs
|
|
*/
|
|
|
|
const test = require('node:test')
|
|
const assert = require('node:assert/strict')
|
|
const path = require('node:path')
|
|
|
|
const { isPackagedInstallPath } = require('./workspace-cwd.cjs')
|
|
|
|
const installRoot = path.resolve('/opt/Hermes')
|
|
|
|
test('isPackagedInstallPath returns false when not packaged', () => {
|
|
assert.equal(
|
|
isPackagedInstallPath(installRoot, { isPackaged: false, installRoots: [installRoot] }),
|
|
false
|
|
)
|
|
})
|
|
|
|
test('isPackagedInstallPath flags the install root itself', () => {
|
|
assert.equal(
|
|
isPackagedInstallPath(installRoot, { isPackaged: true, installRoots: [installRoot] }),
|
|
true
|
|
)
|
|
})
|
|
|
|
test('isPackagedInstallPath flags paths nested under the install root', () => {
|
|
const nested = path.join(installRoot, 'resources', 'app.asar')
|
|
|
|
assert.equal(
|
|
isPackagedInstallPath(nested, { isPackaged: true, installRoots: [installRoot] }),
|
|
true
|
|
)
|
|
})
|
|
|
|
test('isPackagedInstallPath ignores paths outside the install root', () => {
|
|
const homeProject = path.resolve('/home/user/projects/demo')
|
|
|
|
assert.equal(
|
|
isPackagedInstallPath(homeProject, { isPackaged: true, installRoots: [installRoot] }),
|
|
false
|
|
)
|
|
})
|