Skip to content

feat: icp deploy accepts install args#489

Merged
lwshang merged 9 commits intomainfrom
lwshang/SDK-2663_deploy_args
Apr 8, 2026
Merged

feat: icp deploy accepts install args#489
lwshang merged 9 commits intomainfrom
lwshang/SDK-2663_deploy_args

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented Apr 8, 2026

Summary

  • Add --args, --args-file, and --args-format flags to icp deploy to pass install arguments at the command line, overriding init_args in the manifest
  • Extract a reusable ArgsOpt struct (grouping --args, --args-file, --args-format) shared by icp canister install and icp deploy
  • Rename InitArgsFormat to ArgsFormat to reflect its broader use

Test plan

  • Added 4 deploy_tests cases.

lwshang and others added 6 commits April 8, 2026 13:43
Extract shared ArgsOpt struct and load_args helper into args.rs to
deduplicate init-args handling across canister install, canister call,
and deploy. CLI flags take priority over manifest init_args when
deploying a single canister.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The type is used for both canister install and call args, not just init args.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Updates InitArgsFormat → ArgsFormat in JSON schemas and CLI reference docs.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@lwshang lwshang changed the title feat: add --args/--args-file/--args-format flags to icp deploy feat: icp deploy accepts install args Apr 8, 2026
@lwshang lwshang requested a review from Copilot April 8, 2026 18:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the icp deploy command to accept initialization/install arguments via CLI flags (matching icp canister install behavior), and generalizes the argument-format type to be shared across call/install/deploy paths.

Changes:

  • Added --args, --args-file, and --args-format to icp deploy, with CLI args taking precedence over manifest init_args.
  • Extracted a reusable ArgsOpt (and load_args) for shared CLI arg parsing/encoding logic.
  • Renamed InitArgsFormat to ArgsFormat and updated Rust code + JSON schemas accordingly.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/schemas/icp-yaml-schema.json Renames schema def from InitArgsFormat to ArgsFormat and updates $refs.
docs/schemas/environment-yaml-schema.json Same schema rename/update for environment manifests.
docs/schemas/canister-yaml-schema.json Same schema rename/update for canister manifests.
docs/reference/cli.md Documents new icp deploy args flags.
crates/icp/src/project.rs Updates manifest init-args resolution to use ArgsFormat.
crates/icp/src/manifest/project.rs Updates tests to use ArgsFormat.
crates/icp/src/manifest/mod.rs Re-exports ArgsFormat instead of InitArgsFormat.
crates/icp/src/manifest/canister.rs Renames enum to ArgsFormat and updates manifest types/tests.
crates/icp/src/lib.rs Updates InitArgs encoding to use ArgsFormat.
crates/icp-cli/src/commands/args.rs Introduces ArgsOpt and shared load_args helper.
crates/icp-cli/src/commands/deploy.rs Adds ArgsOpt to deploy and applies CLI-over-manifest precedence.
crates/icp-cli/src/commands/canister/install.rs Refactors install args handling to use ArgsOpt.
crates/icp-cli/src/commands/canister/call.rs Switches to ArgsFormat and reuses load_args for file/inline parsing.
crates/icp-cli/tests/deploy_tests.rs Adds deploy test cases covering inline args, args file, hex format, and multi-canister failure.
CHANGELOG.md Notes the new deploy flags feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lwshang and others added 2 commits April 8, 2026 14:43
…gs field descriptions

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@lwshang lwshang marked this pull request as ready for review April 8, 2026 18:50
@lwshang lwshang requested a review from a team as a code owner April 8, 2026 18:50
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@lwshang lwshang enabled auto-merge (squash) April 8, 2026 20:05
@lwshang lwshang merged commit 18f87b1 into main Apr 8, 2026
88 checks passed
@lwshang lwshang deleted the lwshang/SDK-2663_deploy_args branch April 8, 2026 20:09
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.

3 participants