Skip to content

Add init operation for 22 package managers#14

Open
andrew wants to merge 3 commits intomainfrom
add-init-operation
Open

Add init operation for 22 package managers#14
andrew wants to merge 3 commits intomainfrom
add-init-operation

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented Mar 27, 2026

Adds Init() to the Manager interface and CapInit capability constant. Adds init command definitions to the 22 managers that support non-interactive, in-place project initialization.

Each manager uses its native init command (npm init -y, bundle init, cargo init --lib, etc.) to scaffold a manifest in the current directory.

Excluded managers fall into three groups: global installers with no project concept (brew, gem, cpanm), managers with interactive-only init (maven, pip, sbt), managers whose new command always creates a child directory rather than scaffolding in-place (mix, lein, helm, stack, pub, rebar3), and opam whose init bootstraps ~/.opam rather than a project. cocoapods requires an existing .xcodeproj.

Add Init() to the Manager interface and CapInit capability. Adds init
command definitions to 30 of 36 managers that support non-interactive
project initialization.

Managers without init: brew, cpanm, gem, maven, pip, sbt (global
installers or interactive-only init).
Drops 8 managers and tightens the contract: init must produce a
manifest in the working directory, not a child directory.

- Move CapInit to end of iota block to preserve existing constant
  values; add TestCapabilityOrdering to pin them
- Drop opam (opam init bootstraps ~/.opam, not a project)
- Drop cocoapods (no capabilities section, requires .xcodeproj)
- Drop mix/lein/helm/stack/pub/rebar3 (their new commands always
  create a child directory)
- Fix nuget to use bare `dotnet new classlib` (writes to cwd)
- Fix shards init (does not take a name argument)
- Fix conan to Conan 2 syntax (template first, -d name=, -d version=)
- Revert unrelated AddOptions.Version change
- Add tests for Init(), Init_NoCommand, Init_RunnerError
- gofmt alignment fixes in schema.go and docs/examples

22 managers now support init.
@andrew andrew changed the title Add init operation for 30 package managers Add init operation for 22 package managers Apr 13, 2026
@andrew andrew marked this pull request as ready for review April 13, 2026 08:33
The translator already handles version args (npm uses position 0 with
@ suffix to produce lodash@4.17.21, bundler uses --version flag, etc.)
but GenericManager.Add never passed opts.Version into input.Args.

Needed by git-pkgs/resolve which calls Add with version constraints
when building temp projects for resolution.
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