mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-19 22:41:45 +02:00
fix(hooks): keep ~/.claude eligible as project sharing root with CLAUDE_CONFIG_DIR
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
01c9a670de
commit
334b7847bd
@@ -116,6 +116,8 @@ function resolveAllowedProjectConfigHome(candidate) {
|
||||
const allowedRoots = [
|
||||
getDefaultCursorAgentDataHome(),
|
||||
getDefaultClaudeAgentDataHome(),
|
||||
// Keep ~/.claude eligible when CLAUDE_CONFIG_DIR points elsewhere.
|
||||
path.join(getHomeDirFromEnv(), DEFAULT_CLAUDE_DIR_NAME),
|
||||
];
|
||||
|
||||
for (const allowedRoot of allowedRoots) {
|
||||
|
||||
@@ -91,6 +91,7 @@ function runTests() {
|
||||
withIsolatedCwd(() => {
|
||||
withEnv({
|
||||
ECC_AGENT_DATA_HOME: undefined,
|
||||
CLAUDE_CONFIG_DIR: undefined,
|
||||
CURSOR_VERSION: undefined,
|
||||
CURSOR_PROJECT_DIR: undefined,
|
||||
}, () => {
|
||||
@@ -534,6 +535,29 @@ function runTests() {
|
||||
});
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('project config may select ~/.claude/shared when CLAUDE_CONFIG_DIR points elsewhere', () => {
|
||||
const homeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-agent-data-home-claude-root-'));
|
||||
const projectDir = path.join(homeDir, 'project');
|
||||
const configPath = path.join(projectDir, '.cursor', 'ecc-agent-data.json');
|
||||
const sharedHome = path.join(homeDir, '.claude', 'shared');
|
||||
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
||||
fs.writeFileSync(configPath, JSON.stringify({ agentDataHome: sharedHome }), 'utf8');
|
||||
|
||||
try {
|
||||
withEnv({
|
||||
ECC_AGENT_DATA_HOME: undefined,
|
||||
CLAUDE_CONFIG_DIR: path.join(homeDir, 'custom-claude-profile'),
|
||||
HOME: homeDir,
|
||||
USERPROFILE: undefined,
|
||||
}, () => {
|
||||
const agentDataHome = require('../../scripts/lib/agent-data-home');
|
||||
assert.strictEqual(agentDataHome.readProjectConfigAt(configPath), sharedHome);
|
||||
});
|
||||
} finally {
|
||||
fs.rmSync(homeDir, { recursive: true, force: true });
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('ensureAgentDataHomeEnv sets process.env when unset', () => {
|
||||
withEnv({
|
||||
ECC_AGENT_DATA_HOME: undefined,
|
||||
|
||||
Reference in New Issue
Block a user