Skip to content

feat(cli): build the add-readme output from the adapter's real io.yaml contract #1866

In progress

Description

@planetf1

What happens today

m alora add-readme generates a README for a trained adapter, including a usage snippet. Neither the README text nor the snippet reflects the adapter's real output contract, even though that contract is in the io.yaml the user uploaded with m alora upload --intrinsic. Someone reading the README cannot see what the adapter returns, and the snippet checks only that the output is a JSON object.

Observed

  • cli/alora/README_TEMPLATE.jinja builds the adapter with io_contract=get_io_contract(_INTRINSIC_ADAPTER_NAME).
  • For a name outside the catalogue, get_io_contract returns a fallback contract with no required keys (mellea/backends/adapters/io_contracts.py, the end of get_io_contract). Any JSON object passes.
  • generate_readme() and make_readme_jinja_dict() in cli/alora/readme_generator.py take no io.yaml input, so nothing in the generated text describes the output schema.
  • m alora add-readme has a --io-yaml option that was meant to feed this but was never wired up. bug: m alora add-readme accepts --io-yaml but never uses it #1860 covers that inconsistency, and fix(cli): deprecate the ignored --io-yaml option on 'm alora add-readme' #1865 deprecates the option so the CLI and docs agree with the behaviour.

Expected

The generated README describes the adapter's real output (for example the response_format in io.yaml), and the usage snippet is built around the matching contract rather than the permissive fallback.

Open design questions

  • Where does the contract come from: a local io.yaml path, or the io.yaml already uploaded to the adapter's Hub repo (which would need no flag)?
  • What happens when the path is missing or the file is invalid? Failing early seems right.
  • What should the README do for an adapter that has no io.yaml?
  • What happens to --io-yaml on add-readme: revive it with real behaviour, or remove it once the Hub repo is the source?

Related

#1860, #1865

Activity

  1. skritosss commented on Nov 25, 2026

    @skritosss
    Contributor

    I would like to work on this. Could you assign it to me if the following scope makes sense?

    I suggest reading the Hub-side io.yaml for the same adapter variant targeted by add-readme, rather than bringing back the unused flag being deprecated in #1865. I would reuse the existing contract parsing where possible, render the declared response format in the README, and make the usage snippet validate that contract instead of falling back to an arbitrary JSON object. Invalid or inaccessible YAML should fail before any README is written to the Hub.

    One compatibility question: for legacy or non-intrinsic adapters with no io.yaml, would you prefer to keep the generic README (without implying a schema) or fail with instructions? I can start with offline fixtures that cover a valid custom schema and the missing/invalid cases once that behavior is agreed.

  2. planetf1 commented on Nov 25, 2026

    @planetf1
    ContributorAuthor

    Thanks, happy for you to take this, assigning you. Worth checking how add-readme and io_contracts.py fit together before you commit to it. From a quick look, this seems about right:

    • Source: read io.yaml from the adapter's Hub repo for the same variant. upload --intrinsic already puts it there, so no flag is needed. --io-yaml stays deprecated per fix(cli): deprecate the ignored --io-yaml option on 'm alora add-readme' #1865 and can be removed later.
    • No io.yaml: keep the generic README, imply no schema, and print a warning to stderr. Failing would break add-readme for existing non-intrinsic adapters.
    • Invalid io.yaml, or an inaccessible repo: fail before anything is written to the Hub. Keep these distinct from "file absent", so a network or auth error isn't read as "no io.yaml".
    • Tests: offline fixtures for a valid custom schema, an invalid file, a missing file, and an inaccessible repo.

    If the code points somewhere different, say so here and we can adjust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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