apm icon indicating copy to clipboard operation
apm copied to clipboard

[FEATURE] Non-interactive flags for `apm init` project metadata (name, description, version, author)

Open sproott opened this issue 4 months ago • 6 comments

Is your feature request related to a problem? Please describe.

apm init's interactive mode collects four metadata fields — name, version, description, author — but its non-interactive mode can freely set none of them, so scripted / CI / --yes init is stuck with auto-detected boilerplate and must hand-edit apm.yml afterward.

The command (init) declares only these value-bearing options: the project_name argument, --yes, --plugin, --marketplace, --target, --verbose. There is no --description, --version, or --author. The two paths diverge on what a user can control:

  • Interactive (_interactive_project_setup) prompts for name, version, description, and author. In the current directory (no positional arg) it seeds the name prompt with the directory basename but lets the user type any name — a custom-named project in-place.
  • Non-interactive (--yes or non-TTY stdin) takes _get_default_config, which hardcodes version: "1.0.0", description: f"APM project for {name}", and author from git config user.name. No flag feeds config, so the field the interactive user is most likely to customize — the description — is the one a non-interactive user cannot set at all. For name, the positional arg is the only input, and _perform_init treats it as mkdir(project_name) + chdir into that subdir; a bare ./no-arg forces the current dir's basename. Neither path names a project in-place.

Current behavior — every metadata field is either rejected as an unknown option or pinned to boilerplate:

$ apm init myproj --yes --description "My cool project"
Error: No such option: --description

$ apm init myproj --yes
$ cat myproj/apm.yml
name: myproj
version: 1.0.0
description: APM project for myproj      # boilerplate, unsettable
author: Jane Dev                         # git user.name, unsettable

Describe the solution you'd like

--description, --version, and --author flags on apm init, so every field the interactive prompt collects can be set without the prompt:

apm init myproj --yes --description "My cool project" --version 0.1.0 --author "Jane Dev"

writes those exact values and exits 0. Also a way to name a project in the current directory non-interactively (e.g. a --name flag decoupled from the positional arg's mkdir behavior), matching what interactive init already allows in-place.

Describe alternatives you've considered

  • Run apm init interactively, then re-run non-interactively — not viable in CI.
  • Hand-edit or sed the generated apm.yml after apm init --yes — works but defeats the point of a scaffolding command and is brittle.

There is precedent in the CLI's own scaffolding surface: sibling apm marketplace init already takes --name and --owner, so "set metadata without the prompt" is an established mode — just not on apm init.

Additional context

Observed on apm v0.24.0 (Linux, Python 3.14). The gap is visible from the apm init flag surface alone (apm init --help lists no metadata flags) and the two code paths cited above — no reproduction directory needed.

sproott avatar Jul 11 '26 07:07 sproott

Triage Panel Verdict

Thank you for this well-documented feature request, @sproott. The gap between what interactive apm init collects and what non-interactive apm init --yes allows is a real CI/scripting friction point.

DevX UX Expert: Non-interactive / CI use is a first-class scenario for any scaffolding command. The four metadata fields that the interactive prompt collects -- name, version, description, author -- should all be settable via flags without a prompt. The apm marketplace init --name --owner precedent confirms this is the established pattern in the CLI. A --name flag decoupled from the positional arg's mkdir behavior is the correct solution for in-place naming; the positional arg conflating "name the project" with "mkdir + chdir" is a footgun that should not be extended to --yes users.

OSS Growth Hacker: This is a friction point that will affect any team integrating APM into CI pipelines or project templates. A well-scoped, externally filed issue with code references and reproduction steps -- this is exactly the kind of contribution to encourage. Marking as help wanted is appropriate if the maintainer wants to route it back to the contributor or community.

APM CEO (arbiter): Accepted. The scope is clear and bounded: add --description, --version, --author, and --name flags to apm init; wire them into _get_default_config so --yes + flags produces a manifest without prompts. No design doc required. Targeted for v0.25.0 as a feature addition.


Triage decision: Accepted. Next action: implement --description, --version, --author, and --name flags on apm init; ensure flag values take precedence over _get_default_config defaults in non-interactive mode; update apm init --help output and docs.

Field Value
Area cli
Type feature
Milestone v0.25.0

Generated by Triage Panel · 112.4 AIC · ⌖ 8.08 AIC · ⊞ 9.2K · ◷

github-actions[bot] avatar Jul 11 '26 12:07 github-actions[bot]

Triage Panel Verdict

Thanks for the well-specified feature request, @sproott. Panel ran three mandatory reviewers (DevX UX Expert, Supply Chain Security Expert, APM CEO) plus Python Architect given the CLI surface change.

Panel consensus

DevX UX Expert: This is a real ergonomics gap. CI/CD users and script authors who call apm init --yes today are forced to post-edit apm.yml for every project -- defeating the purpose of a scaffolding command. Adding --description, --version, and --author is table-stakes parity with interactive mode. The --name decoupled from mkdir behavior is a secondary but legitimate ask; it should be scoped carefully to avoid breaking the positional-arg contract.

Python Architect: Implementation is straightforward: add Click options to init.py, thread them through _get_default_config (or a small override layer). No architectural change required. Recommend a single --name flag that only affects the manifest's name: field when no positional arg triggers mkdir; the positional-arg mkdir path stays unchanged to avoid breaking existing scripts.

APM CEO (arbiter): Scripted init is a common entry point for platform teams managing many agent projects. Blocking CI on interactive prompts is a friction point that reduces adoption. This is a well-understood, bounded feature with clear precedent. Targeting v0.25.0 to allow proper design review of the --name boundary.

Triage decision

Dimension Value
Theme (none -- CLI ergonomics)
Area area/cli (added)
Type type/feature (existing)
Status status/triaged (added)
Priority (not assigned -- normal backlog priority)
Milestone v0.25.0

Suggested next action: Implement --description, --version, --author as Click options in init.py with a clear note in help text that --name only applies when no positional project_name argument is given. Add unit tests covering --yes + each flag, non-TTY stdin + each flag, and the in-place naming case.


Triage status: agentic proposal pending human ratification. Silence is approval. Maintainers can:

  • Override any label or milestone above by editing it directly -- human edits are authoritative and will not be reverted on subsequent runs.
  • Re-trigger triage by applying the status/needs-triage label, or by removing status/triaged to enroll the issue in the next daily sweep.

Posted by the Triage Panel workflow. See .apm/skills/apm-triage-panel for the panel skill.

Generated by Triage Panel · 112.4 AIC · ⌖ 8.08 AIC · ⊞ 9.2K · ◷

github-actions[bot] avatar Jul 11 '26 12:07 github-actions[bot]

Opened #2231 for this.

It implements the panel's suggested next action -- --description, --version and --author as Click options, plus --name scoped to the in-place case so the positional argument's mkdir contract is untouched. Passing both reports the ignored --name rather than dropping it silently, and --name gets the same validation the interactive prompt already enforces.

Two things surfaced while tracing the path, both covered in the PR:

  • Plugin mode overwrote config["version"] with 0.1.0 after the config was built, which would have silently clobbered an explicit --version. Now gated on no version being given.
  • The metadata branch keys purely on yes -- _stdin_is_tty() only guards the target prompt -- so the issue's "non-TTY stdin" description doesn't hold for metadata. Rather than ignore flags outside --yes, they seed the matching prompt defaults, so nothing is silently discarded.

Overrides are applied where the interactive and --yes paths converge, leaving _get_default_config() untouched for its commands/install.py caller; the new _perform_init() parameters are keyword-only and default to None, so apm plugin init is unchanged. 11 new tests, all verified failing on unmodified main first.

atulya-singh avatar Jul 15 '26 18:07 atulya-singh

A related case for this issue: apm install <pkg> in a directory with no apm.yml bootstraps one through the same _get_default_config, so it also writes author: <git config user.name> without asking:

$ git config user.name
Jane Example
$ apm install --target copilot ../demo-pkg
[*] Created apm.yml
...
$ head -4 apm.yml
name: p4
version: 1.0.0
description: APM project for p4
author: Jane Example

The person who first runs apm install is not necessarily the author of the consuming project, and the file is normally committed. That puts a personal name into the repository as a side effect of installing a dependency.

The open PR #2231 adds --author, but keeps git config user.name as the default (auto_author = author or _auto_detect_author()), and apm install's bootstrap does not pass the flag. It would help if the implicit bootstrap paths (apm install, apm init --yes) did not infer author from git at all, and left it unset unless passed explicitly. Cargo dropped author inference for the same reason (RFC 3052). Tools that wrap apm currently have to strip the field after every bootstrap.

Seen on APM 0.35.0 (17a2fc4) and 0.33.0 (18c4c43).

johnwilliams-12 avatar Nov 02 '26 09:11 johnwilliams-12

Decision: approve Area: project Scope: Add --name, --description, --version and --author options to apm init so non-interactive runs (--yes or non-TTY) can set the same four manifest fields the interactive prompts collect; --name applies only to in-place init and reports when it is ignored because a positional project directory was given; values reuse the interactive prompts' validation; plugin mode must not overwrite an explicitly provided version. Done when: Tests cover each flag with --yes and non-TTY input, in-place and positional project paths, the ignored --name notice, invalid name/version rejection matching the interactive rules, and plugin-mode version preservation; defaults are unchanged when the flags are absent; CLI reference docs and the apm-usage commands guide list the options. Out of scope: Changing default values or auto-detection; the apm install auto-bootstrap author behavior (tracked separately); new manifest fields; interactive prompt changes. Review contact: @danielmeppiel

danielmeppiel avatar Nov 12 '26 11:11 danielmeppiel

The apm-scope:v1 record above was approved by @danielmeppiel on 2026-11-12. @atulya-singh, thank you for #2231 and for your patience since July; it is now in the review-and-landing pipeline against this scope. @johnwilliams-12, your point about apm install stamping the git user as author when it bootstraps apm.yml is tracked as a separate issue.


Posted with AI assistance on behalf of @danielmeppiel.

danielmeppiel avatar Nov 12 '26 11:11 danielmeppiel