codeep 1.0.103 → 1.0.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,9 @@
1
1
  import Conf from 'conf';
2
2
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, unlinkSync, statSync } from 'fs';
3
- import { join } from 'path';
4
- import { homedir } from 'os';
3
+ import { join, dirname } from 'path';
5
4
  import { PROVIDERS, getProvider } from './providers.js';
6
5
  import { logSession } from '../utils/logger.js';
7
- // Global sessions directory (fallback when not in a project)
8
- const GLOBAL_SESSIONS_DIR = join(homedir(), '.codeep', 'sessions');
9
- // Ensure global sessions directory exists
10
- if (!existsSync(GLOBAL_SESSIONS_DIR)) {
11
- mkdirSync(GLOBAL_SESSIONS_DIR, { recursive: true });
12
- }
6
+ // We'll initialize GLOBAL_SESSIONS_DIR after config is created (to use config.path)
13
7
  /**
14
8
  * Get sessions directory - local .codeep/sessions/ if in project, otherwise global
15
9
  */
@@ -87,6 +81,14 @@ export const config = new Conf({
87
81
  if (config.get('agentMode') === 'auto') {
88
82
  config.set('agentMode', 'on');
89
83
  }
84
+ // Global sessions directory - use same directory as conf package for cross-platform consistency
85
+ // config.path gives us something like ~/.config/codeep-nodejs/config.json, we use its parent
86
+ const GLOBAL_BASE_DIR = dirname(config.path);
87
+ const GLOBAL_SESSIONS_DIR = join(GLOBAL_BASE_DIR, 'sessions');
88
+ // Ensure global sessions directory exists
89
+ if (!existsSync(GLOBAL_SESSIONS_DIR)) {
90
+ mkdirSync(GLOBAL_SESSIONS_DIR, { recursive: true });
91
+ }
90
92
  // In-memory cache for API keys (populated on first access)
91
93
  const apiKeyCache = new Map();
92
94
  export const LANGUAGES = {
@@ -348,11 +348,10 @@ export function detectFilePaths(text, projectRoot = process.cwd()) {
348
348
  * Get full project context for AI
349
349
  */
350
350
  export function getProjectContext(dir = process.cwd()) {
351
- if (!isProjectDirectory(dir))
352
- return null;
353
351
  try {
354
352
  const files = scanDirectory(dir, 3);
355
- const projectType = getProjectType(dir);
353
+ const isProject = isProjectDirectory(dir);
354
+ const projectType = isProject ? getProjectType(dir) : 'generic';
356
355
  const structure = generateTreeStructure(files, 25);
357
356
  // Find key files that exist
358
357
  const existingKeyFiles = KEY_FILES
@@ -370,7 +369,9 @@ export function getProjectContext(dir = process.cwd()) {
370
369
  const codeFiles = files.filter(f => !f.isDirectory);
371
370
  const fileCount = codeFiles.length;
372
371
  // Generate summary
373
- const summary = `${projectName} is a ${projectType} project with ${fileCount} code files.`;
372
+ const summary = isProject
373
+ ? `${projectName} is a ${projectType} project with ${fileCount} code files.`
374
+ : `${projectName} is a folder with ${fileCount} files.`;
374
375
  return {
375
376
  root: dir,
376
377
  name: projectName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.103",
3
+ "version": "1.0.105",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",