Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cli/src/__tests__/project-files-chat-id.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
getCurrentChatId,
setCurrentChatId,
startNewChat,
setProjectRoot,
getProjectDataDir,
} from '../project-files'

describe('chat id lifecycle', () => {
Expand All @@ -32,3 +34,19 @@ describe('chat id lifecycle', () => {
expect(rotated).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.\d{3}Z$/)
})
})

describe('getProjectDataDir', () => {
test('returns a path containing the project basename', () => {
setProjectRoot('/tmp/my-project')
const dataDir = getProjectDataDir()
expect(dataDir).toContain('my-project')
expect(dataDir).toContain('projects')
})

test('uses config-dir getConfigDir (not auth re-export)', () => {
setProjectRoot('/tmp/test-repo')
const dataDir = getProjectDataDir()
// Should resolve via ~/.config/manicode* without pulling in auth.ts
expect(dataDir).toMatch(/\.config\/manicode/)
})
})
2 changes: 1 addition & 1 deletion cli/src/project-files.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mkdirSync, readdirSync, statSync } from 'fs'
import path from 'path'

import { getConfigDir } from './utils/auth'
import { getConfigDir } from './utils/config-dir'

let projectRoot: string | undefined
let currentChatId: string | undefined
Expand Down
Loading