EasyP

EasyP v0 to v1

Preview-first migration that preserves configuration and verifies historical dependency pins.

The v1 CLI does not execute the old combined configuration. Use the explicit migration command for supported, unambiguous v0 projects. Keep the project in version control and stop other writers before applying changes.

Interactive terminal wizard

# Starts the wizard when both input and output are terminals.
easyp migrate

# Explicit wizard with prefilled values.
easyp migrate --interactive --dir . --module github.com/acme/contracts

The wizard asks for the project directory and module identity when those flags are omitted. An existing native manifest or the current directory's local Git origin can supply an identity suggestion; accepting a suggestion is still an explicit input step. This lookup does not contact a server or display Git credentials.

It shows the actual candidate files before asking to proceed. When dependencies need verification, it asks separately for permission to resolve them and write their cache. After verification, it shows the complete plan, including the lock, and asks whether to apply it and create backups. Enter means no at both confirmations. Even prefilled --write and --resolve-lock do not bypass wizard confirmations. No plugin is executed.

Declining, Ctrl+C or EOF before application leaves project files unchanged. Cache entries from previously authorized resolution may remain. A change to the project during the prompts is detected instead of silently overwriting it. The existing restrictions and multi-file crash boundary still apply.

For compatibility, supplying --module without --interactive keeps the existing flag-only behavior, including in a terminal. --interactive=false explicitly disables prompting. Redirected input or output never triggers the wizard, and forced --interactive requires both streams to be terminals; a pipe of yes answers is not accepted as interactive consent. Scripts must supply --module and the relevant explicit flags.

Preview first

easyp migrate --dir . --module github.com/acme/contracts

In flag-only mode, without --write, the command prints actual candidate files and warnings. It does not change the project or execute plugins. A plain preview does not resolve dependencies or write their cache.

The candidate files are easyp.yaml for policies, easyp.gen.yaml for generation, protobuf.mod for module metadata, and a verified protobuf.lock when dependency conversion is required. The supplied module identity is literal and must match the intended local module.

Verify dependencies and apply

# Explicitly permit dependency access/cache writes while still previewing.
easyp migrate --dir . --module github.com/acme/contracts --resolve-lock

# Apply only after the complete candidate set passes validation.
easyp migrate --dir . --module github.com/acme/contracts --resolve-lock --write

For a dependency-free project, --resolve-lock is unnecessary. With dependencies, --write without completed lock verification fails before writing the candidate configuration. No generation plugin is run by either command.

Modified legacy policy and manifest files receive byte-identical .v0.bak backups. Existing conflicting v1 files or backups are not overwritten. Original permissions are preserved when replacing a legacy file. The old easyp.lock remains unchanged as a historical record. A repeated migration of a validated v1 project is a no-op; it does not update dependencies.

What is preserved

The converter preserves the effective selected lint rules, exceptions, rule settings, and explicit legacy comment-suppression setting. It converts literal ignores and rule-specific prefix ignores to the corresponding v1 exclusions. Generation preserves plugin sources, argv, options, with_imports, and supported managed settings. Plugin output paths remain relative to the configuration directory.

Legacy direct and indirect requirements are converted to native require directives. The tool proves that local generation keeps the same protobuf files and import paths, using whole roots, literal generation paths or exact package selectors.

Git inputs and custom roots

Each git_repo.url becomes a require and a generation module selection, preserving its version and historical pin. root is an import-root resolution hint; sub_directory becomes a module-local generation path after verification.

generate:
  inputs:
    - git_repo:
        url: gitlab/products/svc
        root: api/svc/v1
        sub_directory: api/svc/v1/service

The initial preview accepts these selectors without dependency access. Authorized verification checks the pinned sources, historical hash and import-name mapping. Existing dependency roots retain priority. A metadata-free dependency can use the verified legacy root, recorded in protobuf.lock. Corrections appear in the verified preview; ambiguous or unrepresentable namespaces fail before files are written.

The selected subtree can become:

version: v1
generate:
  modules:
    - module: gitlab/products/svc
      paths: [api/svc/v1/service]
plugins: []

Paths are relative to the dependency module directory, while files keep import names such as service/svc.proto relative to root api/svc/v1. A plain module identity selects the full resolved module. Mixed local/Git inputs get separate module filters.

Keep default roots and source locations

An omitted or empty legacy root means .. Native protobuf.mod has the same default when roots is omitted; there is no need to move proto files into a new directory.

For example, an input selecting mcp under root . can become the following generation selection without including copies elsewhere in the repository:

version: v1
generate:
  paths: [mcp]
plugins:
  - name: go
    out: .
    opts:
      paths: source_relative

Import roots stay unchanged and generated files keep their source-relative paths. The wizard first tries whole-root equality, then literal directory paths, then complete package selectors for mixed-root cases. Each choice must select exactly the same physical files with the same import names. Paths can preserve part of a package: ignored Gradle build copies outside mcp stay out of generation. Hidden/vendor/nested-module boundary changes that cannot preserve the original selection remain blocked. Sources and fixed paths/packages are checked again before apply.

generate.paths matches literal module-directory-relative files or directory subtrees, with . meaning all sources; mcp does not select mcp-copy. Paths intersect optional package selectors, and every selector must match a resulting source across the selected modules. Unknown selectors fail before plugins or descriptor writes, even without plugins or under --all. Required imports outside these paths remain available. These paths are separate from plugin opts.paths, which controls output layout.

When migration uses the complete-package fallback, the preview warns that future files in those packages become targets regardless of their directory.

Variable placeholders are not expanded into saved values. If a placeholder or selector prevents safe analysis, conversion fails rather than persisting credentials or guessing its meaning.

For a sole local input, migration does not repeat its module in generate.modules: it is inferred from the generator location. With root: api, path: easyp, the output is generate.paths: [api/easyp] and protobuf import names stay unchanged. Global filters remain available without listing modules; each module object can also add its own paths/packages, intersected with global filters.

Migration does not create an empty options.go.package_prefix. This field is optional: omission allows normal v1 inheritance, while an explicitly empty value blocks prefix inheritance.

Historical lock integrity

A full commit SHA is preserved, including a full SHA embedded in an old pseudo-version. For a legacy lock entry containing a tag but no SHA, conversion resolves that tag and verifies the historical installed-tree hash before accepting the revision. A moved tag or mismatched historical hash is an error.

Git's annotated-tag spelling, such as v0.4.0^{}, is accepted for a full SemVer tag in the historical lock. The tag, commit and original hash are still verified, and the old lock stays byte-identical. Peeled branches, abbreviated refs, repeated suffixes and pseudo-version-shaped peeled tags are rejected.

Keep easyp.lock when it is available; deleting it before migration is unnecessary. Without an old lock digest, migration skips historical whole-repository/archive hashing. An explicit git_repo.url pin such as gitlab/products/svc@<full-commit-SHA> still selects that revision and is never replaced with HEAD. Long dependency phases report progress; use easyp --debug migrate for operation timings and file counts. See dependency timeouts and diagnostics.

Released v0 installers archived Git's *.proto pathspec and stripped legacy root prefixes before hashing. Migration reproduces that archive at the pinned revision; it also retains verification of the existing whole-tree hash format. Omitted selected or reachable proto sources and changes to verified archive bytes require manual migration. An unused export-ignore source outside a verified filtered Git selection is permitted when historical hash, target names and reachable bindings match. A whole input that would gain an extra target still fails.

The v1 content hash is then calculated independently over the materialized logical snapshot. Old and new hashes cover different path layouts and cannot be copied or compared as interchangeable values. A missing historical dependency pin is not replaced with current HEAD.

Internal symlinks to files, directories, import roots and metadata are supported. Protobuf import names follow the logical path of the alias. Local targets must remain inside their owning source boundary; Git targets must be relative and resolve entirely from the pinned tree. Selected dangling links, cycles, submodule crossings and undeclared nested repositories fail. Invalid unused auxiliary links are omitted. Native Git snapshots contain regular resolved bytes for selected proto files and canonical metadata, regardless of core.symlinks; unrelated code and build aliases are omitted. Explicitly extended policy fragments with arbitrary names are read separately from pinned Git objects.

If the legacy configuration file itself is a symlink, migration replaces that logical file with regular v1 content and creates a regular backup of its original contents. The former target stays unchanged; rollback restores the original link. Inputs and link topology are checked again before applying.

Historical v0 archive verification remains a separate migration step. A valid historical file alias must preserve both its installed import name and resolved contents. Its target must exist in the archived inputs; the verifier cannot use current files or unarchived Git blobs. The v1 hash is calculated independently from the materialized snapshot.

Explicit limitations

Invalid known fields, invalid or multi-document YAML, ambiguous source selection, unsupported references, and conflicting native outputs are rejected. Keys ignored by v0 are omitted with warnings and remain in the legacy backup. Custom Git-input roots/subdirectories, external or sliced local inputs whose exact selection cannot be preserved, unsafe managed selectors, and full lock conversion with local replacements may require manual migration. Buf configurations are not inputs to this v0 converter.

The command stages all outputs and checks observed inputs again before applying. Ordinary application failures are rolled back. Several file replacements are not one process-crash-atomic transaction: after a machine or process failure, inspect the preserved backups and Git state before continuing. Uncooperative concurrent writers cannot be made safe by this command.

Verify the result

easyp validate-config
easyp mod download
easyp lint
easyp generate

Run mod download when the migrated project has a lock. Check real generated code, not only the exit status of configuration validation. Recursive multi-project generation now requires explicit --all or repeated --project; migration does not authorize unrelated projects.

Command plugins now receive literal argv rather than an implicitly assembled shell command. Review legacy commands that relied on shell operators; use an explicit shell invocation only when that is intentional. Migration does not prove equivalence of arbitrary plugin side effects.

An unsuffixed native v2+ dependency cannot be converted automatically. Select a published /vN identity and matching version, or a valid v0/v1 release; migration never renames dependencies or substitutes versions. An explicit +incompatible requirement is eligible only when the exact revision has no native manifest; migration does not add the marker speculatively. Requirements from older metadata are also checked when used at the native source boundary. See major version identities.

On this page