Skip to main content

Package boundaries (a2c-workflow)

Normative ownership and dependency rules for the three Python packages in the a2c-workflow repository. Builds on accepted architecture (overview.md, ADR-0006).

Repository: a2c-workflow Primary Python packages: a2c_core, a2c_cli, a2c_tui

Status: Implementation specification — M1 scaffold complete; does not change accepted ADRs.

Ownership matrix

PackageOwnsMust not ownDepends on
a2c_coreDomain logic; metadata read/write; schema validation; repository artifact contracts; decomposition orchestration hooks; AI workflow orchestration and evaluation; shared result/error typesCLI argument parsing; stdout/stderr formatting; Textual screens/widgets; editor or host-specific codeLowest-level third-party libs only (e.g. pydantic, pyyaml, pathlib stdlib) — never a2c_cli or a2c_tui
a2c_cliCommand tree; argument parsing; exit codes; human-readable tables/text; JSON command output for automation and extensionCore business rules; schema definitions; AI prompt content; Textual UIa2c_core only
a2c_tuiTextual App structure; navigation; forms and diagnostic screens; calling core services for displayCore business rules; CLI parsing semantics; duplicate validation logica2c_core only — not a2c_cli (see TUI interaction model)

Allowed dependency directions

FromToAllowed
a2c_clia2c_coreYes
a2c_tuia2c_coreYes
a2c_corea2c_cliNo
a2c_corea2c_tuiNo
a2c_tuia2c_cliNo — TUI calls core services directly
a2c_clia2c_tuiNo

Rationale: CLI and TUI are peer presentation layers. TUI must not shell out to CLI (avoids subprocess overhead, divergent error paths, and circular packaging). The VS Code extension does invoke CLI — that is an external host concern (ADR-0007).

Forbidden imports (enforced by convention + lint)

PackageMust never import
a2c_corea2c_cli, a2c_tui, textual, click/typer (if used in CLI only)
a2c_clia2c_tui, textual
a2c_tuia2c_cli

Add an import-linter or ruff banned-module rule in Phase 0 when the a2c-workflow scaffold exists.

Shared types and service boundaries

All cross-surface contracts live in a2c_core:

Module area (intended)Contents
a2c_core.schemasPydantic/dataclass models for metadata files, config, CLI result envelope
a2c_core.contractsRepository artifact expectations (paths, required files)
a2c_core.servicesValidation, metadata CRUD, decomposition orchestration entrypoints
a2c_core.workflowsAI workflow runners, prompt assembly, approval gates
a2c_core.errorsTyped exceptions → mapped to CLI exit codes / TUI messages / JSON error field

Presentation packages map core outcomes to their surface — they do not redefine domain types.

Cross-cutting concerns

ConcernOwnerNotes
Config loadinga2c_coreSingle loader; CLI/TUI pass paths or use defaults
Logginga2c_coreStructured logger factory; CLI/TUI attach handlers for verbosity
Paths / repo discoverya2c_coreFind A2C metadata root, docs/adr/, etc.
Version stringa2c_core__version__ or shared VERSION reader — CLI a2c version reads from core
Human-in-control gatesa2c_core.workflowsApproval checkpoints before mutating writes; CLI/TUI only render prompts

AI workflow interaction

RuleDetail
Orchestration lives in a2c_core.workflowsPrompt templates may load from packaged rules/ / prompts/ assets
No UI in workflow modulesWorkflows return structured plans/results — never Textual widgets or ANSI formatting
CLI exposes workflowsa2c_cli commands call a2c_core.workflows and serialize via result envelope
TUI exposes workflowsScreens call same core APIs; optional human approval UI in TUI layer only
Evaluation fixturesUnder tests/fixtures/ — assert core workflow outputs, not CLI ANSI snapshots

Anti-patterns

  • Duplicating validation in CLI “for convenience”
  • TUI subprocess calling a2c CLI for every button action
  • Putting schema models in a2c_cli.models because “CLI needs them first”
  • AI prompt strings hard-coded in a2c_tui screens
  • Extension-oriented JSON shapes defined only in extension TypeScript — CLI JSON contract is owned by a2c_core + a2c_cli

Still open (implementation)

  • Exact internal module names under a2c_core
  • Whether a2c_tui uses async Textual with core sync services via thread pool
  • Plugin/hook extension points in core (future ADR if needed)