Skip to content

Feature Request: Allow declaring canister IDs in icp.yaml #488

@q-uint

Description

@q-uint

There is currently no way to associate an existing canister ID with a project canister in icp.yaml. The only way to get a mapping is to have the CLI create the canister itself, which writes to .icp/data/mappings/<env>.ids.json.

This is a problem when:

  • A canister was created outside the CLI (e.g. via dfx, NNS proposal, or another tool) and you want to adopt it into an icp project.
  • You clone a repo and want to deploy to an existing canister without manually creating internal state files.
  • You want canister IDs to be version-controlled alongside the rest of the project config.

Right now you have to manually create .icp/data/mappings/<env>.ids.json with the correct format, which is undocumented and fragile.

Proposed addition to the canister manifest:

canisters:
  - name: frontend
    ids:
      ic: "vmenl-oyaaa-aaaax-qaa2a-cai"
    recipe:
      type: "@dfinity/asset-canister@v2.1.0"

This would make icp.yaml the single source of truth for project configuration, which is what you'd expect from a declarative manifest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions