Skip to content

Add env property to parameter objects #8

Open

Description

@Mpdreamz

What

Add an optional env string property to the parameter schema object, emitted when a CLI flag has an associated environment variable source.

Proposed shape:

{
  "role": "flag",
  "name": "root",
  "type": "string",
  "required": false,
  "env": "MYAPP_ROOT"
}

env is omitted when no environment variable is associated with the parameter.

Why

Tooling and AI agents reading __schema currently have no way to know that --root and MYAPP_ROOT are the same setting. Without this link, an agent must read source code or documentation to discover the relationship — which defeats the purpose of a machine-readable schema.

The Argh CLI framework (nullean/argh) has implemented [Env("VAR_NAME")] attribute binding: when a handler parameter is annotated with [Env("MYAPP_ROOT")], the generator reads the environment variable as a fallback when the CLI flag is absent, using the same parser and validation. Emitting "env": "MYAPP_ROOT" in the parameter schema node would let any schema consumer (agent, linter, completion engine) surface that relationship without special-casing Argh.

We have the binding working end-to-end and would emit this field immediately, but the meta-schema's additionalProperties: false on parameter objects rejects it. We've temporarily removed the emission until the meta-schema supports it.

Companion

This is a companion to #7, which requests hidden on namespace objects for the same reason — we implemented the feature but cannot emit the schema field until the meta-schema allows it.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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