Skip to content

feat: comprehensive icp-cli skill improvements for dfx migration#76

Merged
marc0olo merged 5 commits intomainfrom
feat/icp-cli-skill-improvements
Mar 5, 2026
Merged

feat: comprehensive icp-cli skill improvements for dfx migration#76
marc0olo merged 5 commits intomainfrom
feat/icp-cli-skill-improvements

Conversation

@marc0olo
Copy link
Member

@marc0olo marc0olo commented Mar 5, 2026

Summary

Significantly expands the icp-cli skill to cover real-world dfx-to-icp migration scenarios that were discovered during an actual migration. The original skill covered basic config and commands but missed critical patterns around frontend integration, canister discovery, and binding generation.

New Common Pitfalls (10-12)

  • #10: No .env file / output_env_file — icp-cli injects canister IDs via env vars, frontends read the ic_env cookie
  • #11: No dfx generate — use @icp-sdk/bindgen Vite plugin with a .did file on disk
  • #12: Candid file behavior with recipes — candid specified = must exist, omitted = auto-generated in build cache. Includes commands to generate .did files manually for both Rust (candid-extractor) and Motoko (moc --idl)

New Configuration Sections

  • Canister Environment Variables — how frontends (ic_env cookie + @icp-sdk/core) and backends (Rust env_var_value, Motoko Runtime.envVar with import) discover each other
  • Binding Generation@icp-sdk/bindgen Vite plugin setup for single and multi-canister projects, actor creation pattern, non-Vite CLI fallback
  • Dev Server Configuration — complete Vite dev server pattern using icp network status --json for api_url + root_key, multi-canister cookie setup, ICP_ENVIRONMENT for multi-environment support

New Migration Sections

  • Local network port change — dfx 4943 → icp-cli 8000, recommends dynamic api_url from icp network status
  • Remove .env file and output_env_file — dfx-specific env vars to clean up
  • Frontend package migration — required upgrade from @dfinity/* to @icp-sdk/* (bindgen depends on core), step-by-step instructions
  • Post-Migration Verification — replaces "Verify It Works" with actionable verification steps an agent can grep/check

Updated Existing Sections

  • Configuration mapping — added output_env_file and dfx generate rows
  • Replaced "Verify It Works" throwaway project with project-specific verification checklist

Context

These gaps were discovered during a real migration of marc0olo/promptathon-showcase from dfx to icp-cli, then validated against the example migration PRs (#1303, #1308, #1309, #1311) in dfinity/examples and the official icp-cli documentation.

References

Add coverage for canister environment variables, binding generation,
dev server configuration, frontend package migration, and post-migration
verification. Address gaps discovered during a real dfx-to-icp migration
including port changes, .env file removal, Candid file generation,
and multi-canister frontend patterns.
@marc0olo marc0olo requested a review from viviveevee March 5, 2026 11:52
marc0olo added 2 commits March 5, 2026 16:30
- Add clarifying comment for `-i` flag in dev server example
- Mention `canister_ids.json` in canister ID migration section
- Add explicit `rm -f canister_ids.json` step
Custom builds only support name, build, sync, settings, and init_args
at the canister level. Show how to use $ICP_WASM_OUTPUT_PATH and
ic-wasm for WASM output and candid metadata instead.
EOF

# Delete the dfx canister ID file — icp-cli uses .icp/data/mappings/ instead
rm -f canister_ids.json
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we play it safe and don't ask for this to be deleted?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it should be fine. The agent using the skill should create and commit the new mapping file. And typically the canister id could be recovered through the git history. If a dev explicitly asks to keep dfx working, I expect the Agent to respect this decision and keep the files required for dfx.

@marc0olo marc0olo merged commit 85bd730 into main Mar 5, 2026
6 checks passed
@marc0olo marc0olo deleted the feat/icp-cli-skill-improvements branch March 5, 2026 21:12
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