Skip to content

Layering and hexagonal-style layout

This repository uses a pragmatic hexagonal (ports & adapters) + layered layout inside workspace packages.

  • Ports — Interfaces and DTOs in @agent-detective/types (TaskEvent, AgentRunner, RepoMatcher, PrWorkflowService, etc.).
  • Driving adapters — HTTP entry points (e.g. Jira webhook controller).
  • Application — Use cases: webhook dispatch, handler routing, config schemas for a plugin.
  • Domain — Pure logic without Express or network I/O (normalization, trigger rules, plugin-local types).
  • Infrastructure — Outbound adapters: Jira REST clients, GitHub/Bitbucket APIs, ADF conversion, mocks.
LayerPath
Presentationsrc/presentation/
Applicationsrc/application/ (webhook pipeline, handlers, options-schema)
Domainsrc/domain/ (types, normalizer, comment triggers)
Infrastructuresrc/infrastructure/ (Jira clients, markdown→ADF)

Entry point remains src/index.ts (plugin registration / composition).

LayerPath
Applicationsrc/application/ (run-pr-workflow, options-schema)
Infrastructuresrc/infrastructure/ (GitHub, Bitbucket, tokens, Jira stamping helpers)

Entry point remains src/index.ts.

LayerPath
Presentationsrc/presentation/ (repos-controller)
Applicationsrc/application/ (analyzer, options-schema)
Domainsrc/domain/ (types, repo-matcher, validate)
Infrastructuresrc/infrastructure/ (tech-stack-detector, summary-generator, repo-context)

Entry point remains src/index.ts.

The host process is the composition root: Express server (presentation), plugin system and orchestrator (application / glue), agent CLI adapters (infrastructure). See ADR 0001.

  • Generic utils/ buckets without a layer name.
  • Big-bang renames without stabilizing shared types in @agent-detective/types first.

For the original design discussion, see the internal planning note Structure hexagonal fit (project plans).