Skip to content

refactor: separate ensureSessionsDir from session barrel index #744

Description

@avoidwork

Restructure Analysis: ./src/session

Summary

The ./src/session directory is well-organized with 9 files at a single level. The primary finding is a minor cohesion issue in the barrel file.

Findings

File/Directory Issue Type Impact Summary Recommendation
./src/session/index.js cohesion low Barrel file mixes re-exports with a standalone function (ensureSessionsDir) Move ensureSessionsDir to its own file or into factory.js

Proposed Structure

No structural changes needed. Just refactor:

// Move ensureSessionsDir to factory.js or a new ensureDir.js
// index.js becomes pure barrel:
export { createSession } from "./factory.js";
export { SessionStateManager } from "./stateManager.js";
// ... etc

Restructuring Priority

  1. Move ensureSessionsDir to factory.js (logical home — session creation/initialization)
  2. Update imports in consumers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions