Skip to content

Refactor app-log backend into process/stream/platform modules #161

Closed

Description

@thymikee

Problem

src/daemon/app-log.ts is currently ~523 LOC and combines process lifecycle/pid-file management, iOS/android backend setup, log file rotation/metadata, redaction/stream writing, and diagnostics helpers in one module.

Goal

Split app-log backend into focused modules with a stable orchestrator API.

Proposed split

  • src/daemon/app-log-process.ts
    • pid metadata parse/write/cleanup + stale process handling
  • src/daemon/app-log-stream.ts
    • redaction + line writer + child stream attachment
  • src/daemon/app-log-ios.ts
    • iOS simulator/device log backend setup
  • src/daemon/app-log-android.ts
    • Android log backend setup
  • Keep src/daemon/app-log.ts as orchestrator/public API.

Acceptance criteria

  • Public app-log API signatures remain stable.
  • Log file rotation, marker, and doctor behavior remains unchanged.
  • New modules target <=300 LOC where practical.
  • Existing app-log tests pass without reduced coverage.

Validation

  • pnpm typecheck
  • pnpm test:unit
  • pnpm test:smoke

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions