Skip to content

Add README metadata during Composer JSON sync #57

@coisa

Description

@coisa

Objective

Update UpdateComposerJsonCommand so it adds the README link to composer.json when a repository has README.md and Composer metadata does not already expose it.

Current Limitation

dev-tools:sync can normalize and enrich Composer metadata, but it does not currently add a README reference when the project already has a root README.md. As a result, packages can miss a useful Packagist/Composer metadata link even though the file exists in the repository.

Proposed Work

Teach UpdateComposerJsonCommand to detect a root-level README.md and add the Composer readme property only when it is missing.

Scope

  • Detect README.md in the project root.
  • Add readme to composer.json when it is absent.
  • Use README.md as the default value.
  • Preserve an existing readme value if one is already present.
  • Keep the update idempotent across repeated dev-tools:sync runs.
  • Cover the behavior with focused tests for UpdateComposerJsonCommand or the Composer JSON update service it delegates to.

Non-goals

  • Generating or modifying README content.
  • Overwriting an existing Composer readme value.
  • Supporting multiple README filenames in the first implementation.
  • Changing unrelated Composer metadata.

Acceptance Criteria

Delivery Criteria

  • Running dev-tools:sync adds "readme": "README.md" to composer.json when root README.md exists and readme is missing.
  • Running dev-tools:sync does not add readme when no root README.md exists.
  • Existing Composer readme values are preserved unchanged.
  • Re-running sync does not duplicate or reorder unrelated Composer metadata unnecessarily.
  • Tests cover adding the missing README link, preserving an existing value, and skipping when the file does not exist.

Architectural / Isolation Criteria

  • UpdateComposerJsonCommand remains orchestration-focused if the repository already uses a dedicated Composer JSON update helper.
  • File existence checks use existing repository filesystem abstractions where practical.
  • The implementation keeps deterministic JSON output compatible with existing Composer normalization.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions