Skip to content

Add init --minimal and require CLI 1.0.0 - #386

Closed
jetm wants to merge 5 commits into
feed-loop/rewrite-loopbackfrom
feed-loop/init-minimal
Closed

jetm wants to merge 5 commits into
feed-loop/rewrite-loopbackfrom
feed-loop/init-minimal

Conversation

@jetm

@jetm jetm commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Problem

avocado init always wrote three remote extensions, so a first install against a feed without an extension repository failed. The template also required a CLI version that rejects pre-release builds.

Solution

init --minimal writes a project with only the local app extension. The template requires >=1.0.0, which pre-release builds of 1.1.0 satisfy.

Key changes

  • New --minimal flag through a builder method, with a validity test.
  • Template cli_requirement bumped to >=1.0.0.
  • A test fixing that enabled: false extensions are still fetched.

Reviewer notes

The last test makes explicit that enabled: false keeps its current meaning. Tests: 2,372 passed (same single existing failure).

@jetm
jetm added this pull request to stack #388 November 12, 2026 13:54
@jetm
jetm force-pushed the feed-loop/init-minimal branch from e95e68f to 7c15ceb Compare November 12, 2026 15:03
@jetm
jetm marked this pull request as ready for review November 12, 2026 21:18
@jetm
jetm force-pushed the feed-loop/init-minimal branch from 7c15ceb to f5803ae Compare November 12, 2026 22:59
jetm added 5 commits November 12, 2026 17:24
The generated avocado.yaml template still pins cli_requirement to
>=0.41.0, which no longer reflects the CLI version that new projects
are meant to be created for. Projects initialized with the current CLI
would accept older releases that lack features the template relies on.

Raise the template requirement to >=1.0.0 so new projects require a
compatible CLI. Pre-release builds such as 1.1.0-dev must still satisfy
this range, since development builds are used to initialize and build
projects. Older releases like 0.99.0 must be rejected.

Split the version comparison out of check_cli_requirement into a helper
that accepts an explicit version. The existing check always compares
against the compiled package version, which made it impossible to
verify pre-release and older-version behavior in tests. The helper lets
a test validate the generated template against chosen versions without
depending on the build's own version.

Signed-off-by: Javier Tia <javier@peridio.com>
The default project template always pulls in avocado-ext-dev,
avocado-ext-sshd-dev and the board BSP as remote package extensions.
When the user builds against a feed that does not carry these
packages, the first build fails on dependency resolution. This blocks
bootstrapping a project from such a feed, since the generated config
has to be edited by hand before anything can be built.

Add a --minimal option to init that generates the template without
those extensions, leaving only the local application extension. The
default output is unchanged so existing workflows keep working. The
option only applies to the generated template, because a project
fetched with --reference is a user-chosen snapshot and should not be
rewritten.

Strip the extensions by removing exact template blocks rather than
parsing and re-serializing the YAML. This preserves the comments and
formatting of the template. The exactness is guarded by a test that
validates the minimal output, so a template edit that breaks a block
is caught instead of silently producing a config that still references
the dropped extensions.

Signed-off-by: Javier Tia <javier@peridio.com>
The semantics of `enabled: false` on a runtime extension entry are
easy to misread. It looks like a switch that would drop the extension
entirely, but the intended behavior is narrower: the flag only decides
whether the extension ships in the runtime image. Nothing currently
guards this, so a future change could silently stop fetching
shipped-off extensions at SDK install and break builds that depend on
them being present.

Add regression tests at both layers that decide which extensions get
fetched. One covers the active extension set computed from the composed
config, and the other covers the install command's required extension
list. Both use a runtime with an enabled extension and a shipped-off
one, and assert that both are still reported. This pins the agreed
ruling so any deliberate change in semantics has to update the tests
explicitly.

Signed-off-by: Javier Tia <javier@peridio.com>
New projects now demand a newer CLI and can opt out of the default
remote extensions. Without a note, the raised requirement looks like an
unexplained failure and --minimal stays undiscoverable.

Record --minimal under Added and the cli_requirement bump under
Changed.

Signed-off-by: Javier Tia <javier@peridio.com>
A reference project is copied as authored, so --minimal has nothing to
omit from it and was silently ignored. Make clap refuse the pair so the
user learns the flag did not apply instead of assuming a trimmed config.

Signed-off-by: Javier Tia <javier@peridio.com>
@jetm

jetm commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into #394, which carries this layer's commits together with the rest of the feed-first stack. Closing so review happens in one place.

@jetm jetm closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant