Skip to content

[Phase 5] Prepare Hex package with ExDoc and package metadata #45

@andreasronge

Description

@andreasronge

Summary

Prepare PtcRunner for publication to Hex.pm by adding ExDoc for documentation generation and required package metadata. This is the final step before the library can be published as a Hex package.

Context

Architecture reference: Phase 5: Polish
Dependencies: None - all core functionality (Phases 1-4) is complete
Related issues: None

Current State

Based on codebase analysis:

  • Main API module (lib/ptc_runner.ex) has @moduledoc and @doc with examples
  • mix.exs has basic project configuration but lacks:
    • ex_doc dependency for documentation generation
    • Package metadata (:package, :docs, :source_url, :homepage_url, etc.)

Verified via:

grep -r "@moduledoc\|@doc" lib/ptc_runner.ex  # Shows documentation exists
cat mix.exs  # Shows no ex_doc or package config

Acceptance Criteria

  • ex_doc added as dev dependency
  • Package metadata added to mix.exs:
    • :name - "PtcRunner"
    • :description - Already exists
    • :package with :licenses, :links, :files, `:homepage_url"
    • :docs with :main, :extras (README, architecture.md)
    • :source_url pointing to GitHub repo
  • mix docs generates documentation successfully
  • All public modules have @moduledoc (non-false)
  • Main PtcRunner module documented with comprehensive examples
  • Existing tests pass

Implementation Hints

Files to modify:

  • mix.exs - Add ex_doc dependency and package configuration

Patterns to follow:
Reference standard Hex package configuration:

defp deps do
  [
    {:ex_doc, "~> 0.31", only: :dev, runtime: false}
  ]
end

def project do
  [
    # ... existing config ...
    name: "PtcRunner",
    source_url: "https://github.com/devoteam-se/ptc_runner",
    docs: docs(),
    package: package()
  ]
end

defp docs do
  [
    main: "PtcRunner",
    extras: ["README.md", "docs/architecture.md"]
  ]
end

defp package do
  [
    licenses: ["MIT"],
    links: %{"GitHub" => "https://github.com/devoteam-se/ptc_runner"},
    homepage_url: "https://github.com/devoteam-se/ptc_runner"
  ]
end

Edge cases to consider:

  • Ensure internal modules (Parser, Validator, etc.) have appropriate @moduledoc (can be @moduledoc false if purely internal)

Test Plan

Verification:

  • Run mix deps.get - should fetch ex_doc
  • Run mix docs - should generate docs without warnings
  • Run mix hex.build --unpack - should create valid package (optional, for validation)
  • Run mix test - existing tests should pass

E2E verification:

  • Generated docs should include README content
  • Generated docs should include architecture.md as an extra page
  • API documentation should show examples from doctests

Out of Scope

  • Actually publishing to Hex.pm (requires account setup, versioning decisions)
  • Adding a LICENSE file (should be done before actual publishing)
  • Comprehensive documentation improvements beyond basic module docs
  • Adding req_llm as optional dependency for E2E examples (mentioned in architecture but can be a separate issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions