Skip to content

feat: restructure app with discrete backends and move root files to src #630

Description

@avoidwork

Summary

Restructure the application by moving root-level files (config.yaml & index.js) into 'src' and organizing the codebase around discrete backends.

Motivation

The current structure has config.yaml and index.js at the project root alongside the src/ directory, creating an inconsistent layout. Moving these files into src/ and organizing around discrete backends will improve code organization, make the project structure more maintainable, and align with the project's architecture.

Proposed Solution

  1. Move config.yaml from project root into src/config/
  2. Move index.js from project root into src/
  3. Update all import paths and references accordingly
  4. Update Dockerfile and build scripts to reflect new structure

Alternatives Considered

Keeping files at root level but adding documentation — rejected as it doesn't solve the structural inconsistency.

OpenSpec Note

This project uses OpenSpec for feature development. If this request is approved, I will:

  1. Run /opsx:propose to generate a full proposal with specs and tasks
  2. Iterate on the design before any code is written
  3. Follow the task-driven implementation workflow

Additional Context

Current root files:

  • config.yaml (1.7KB)
  • index.js (11.6KB)

Existing src/ structure includes: agent, config, logger, memory, provider, sandbox, scheduler, session, skills, telemetry, tools, tui, workspace

Audit Findings (for Issue #630)

  • src/config/loader.js:12 — Hardcoded path join(PROJECT_ROOT, "../../config.yaml") assumes config.yaml is at project root. Moving config.yaml to src/config/ would simplify this to join(PROJECT_ROOT, "config.yaml").
  • Dockerfile:13,41COPY config.yaml ./ copies from project root. Would need to change to COPY src/config.yaml ./src/ or similar.
  • package.json:27,29"index.js" and "config.yaml" listed in files/exports. Both would need path updates.
  • package.json:38,39,41"main": "index.js", "bin": "index.js", and "start": "node index.js --mode interactive" all reference root index.js. Would need to point to src/index.js or equivalent.
  • Dockerfile:26 — Entrypoint script references index.js directly in /app. Would need update to match new path.
  • src/tui/contextTokens.js:6 — Comment references config.yaml (cosmetic, but should be updated).
  • src/session/checkpointer.js:5 — JSDoc references config.yaml (cosmetic).
  • src/agent/backends/coreBackend.js, contextBackend.js — Use relative imports from src/ — moving root files into src/ may affect their import chains.
  • src/workspace/loadAgents.js — Uses relative path traversal (../..) — restructuring may simplify or complicate these paths depending on final layout.

Key impact areas:

  1. Dockerfile COPY commands and entrypoint (2 files, 4 lines)
  2. package.json main/bin/start/config references (4 lines)
  3. src/config/loader.js config path resolution (1 critical line)
  4. Any external consumers referencing root index.js (npm package entry point)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions