Skip to content

Commit 98443f6

Browse files
chore: replace dfx with icp-cli across the repository (dfinity#3801)
## Summary DFX has been superseded by ICP-CLI ([`dfinity/icp-cli`](https://github.com/dfinity/icp-cli), binary `icp`, config `icp.yaml`, v0.2.0 as of March 2026). This PR migrates the entire repository off DFX so that it builds, tests, deploys, and runs locally via `icp` only. Migration guide: https://cli.internetcomputer.org/0.2/migration/from-dfx.md ## Changes **Configuration** - `dfx.json` → `icp.yaml` (YAML manifest format required by icp-cli) - `demos/using-dev-build/dfx.json` → `demos/using-dev-build/icp.yaml` - Version tracking: `.icp-cli-version` file (replaces `"dfx"` field in `dfx.json`) - `dfx.example.json` files → `icp.yaml.example` - `.dfx/` cache directory → `.icp/` in all ignore files **CI Workflows** - Replace `dfinity/setup-dfx` action with `npm install -g @icp-sdk/icp-cli@$(cat .icp-cli-version)` - `canister-tests.yml`: all `dfx` commands → `icp` equivalents - `deploy-rc.yml`: all `dfx` commands → `icp` equivalents - Rename `update-dfx.yml` → `update-icp-cli.yml`, re-point at `dfinity/icp-cli` releases - `DFX_DEPLOY_KEY` local env var → `ICP_DEPLOY_KEY` (still reads `secrets.DFX_DEPLOY_KEY`) **Scripts** - `scripts/build`: metadata key `dfx` → `icp-cli` - `scripts/deploy-archive`: `dfx canister` → `icp canister` - `scripts/deploy-common.bash`: `dfx canister` → `icp canister`, `--network` → `-e` - `scripts/deploy-local-to-beta`, `scripts/deploy-pr-to-beta`: updated references - `scripts/make-upgrade-proposal`: all `dfx` commands → `icp` equivalents - `demos/vc_issuer/provision`: `dfx` → `icp`, `--dfx-network` → `--icp-network` **Source Code** - `src/vite-plugins/src/utils.ts`: `dfx info/canister` → `icp info/canister` - `src/frontend/src/hooks.server.ts`: `dfx canister id` → `icp canister status --id-only` - `demos/using-dev-build/test.ts`: same command updates - `demos/using-dev-build/vite.plugins.ts`: `DFX_NETWORK` → `ICP_NETWORK`, `.dfx/` → `.icp/` - `src/try-ii/src/try-ii-frontend/package.json`: `dfx` → `icp` in npm scripts **Documentation** - `HACKING.md`: all dfx commands → icp-cli equivalents, updated prerequisites - `README.md`: updated config example with array-based canisters format - All demo and stable-memory READMEs updated ## Key command mapping | dfx | icp-cli | |-----|---------| | `dfx start --background` | `icp network start -d` | | `dfx stop` | `icp network stop` | | `dfx deploy` | `icp deploy` | | `dfx build` | `icp build` | | `dfx canister call` | `icp canister call` | | `dfx canister id <name>` | `icp canister status <name> --id-only` | | `dfx canister create --all` | individual `icp canister create <name>` per canister | | `--network ic` | `-e ic` | | `--argument` | `--args` | | `--argument-type` | `--args-format` | | `--argument-file` | `--args-file` | | `--wallet <id>` | `--proxy <id>` | ## Test plan - [ ] CI passes (canister tests, e2e tests, deploy job) - [ ] Local development works: `icp network start -d && icp deploy` - [ ] No remaining active `dfx` references (only historical code comments preserved) --------- Co-authored-by: Tim Aterton <timothyaterton@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a6fa3c8 commit 98443f6

41 files changed

Lines changed: 375 additions & 446 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Dockerfile
1515
*.swp
1616

1717
# filter out all "hidden" files and directories
18-
# (.git, .dfx, .*ignore, etc)
18+
# (.git, .icp, .*ignore, etc)
1919
.*
2020

2121
# except for the ones we really want

.github/workflows/canister-tests.yml

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,14 @@ jobs:
492492
- name: Install Playwright Browsers
493493
run: npx playwright install chromium
494494

495-
- uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365
495+
- name: Install icp-cli
496+
run: npm install -g @icp-sdk/icp-cli@$(cat .icp-cli-version | tr -d '[:space:]')
496497

497498
# Helps with debugging
498499
- name: Show versions
499500
run: |
500-
echo dfx --version
501-
dfx --version
501+
echo icp --version
502+
icp --version
502503
echo node --version
503504
node --version
504505
@@ -511,8 +512,8 @@ jobs:
511512
npm start --prefix ./src/test_openid_provider -- "$port" | tee -a "test-openid-provider-${port}-logs.txt" &
512513
done
513514
514-
- name: "Run dfx"
515-
run: dfx start --background --artificial-delay 0
515+
- name: "Run icp-cli"
516+
run: icp network start -d
516517

517518
- name: "Download II backend wasm"
518519
uses: actions/download-artifact@v4
@@ -533,7 +534,10 @@ jobs:
533534
path: demos/test-app
534535

535536
- name: Create Canisters
536-
run: dfx canister create --all
537+
run: |
538+
icp canister create internet_identity
539+
icp canister create internet_identity_frontend
540+
icp canister create test_app
537541
538542
- name: Generate OpenID configs
539543
id: openid-configs
@@ -548,11 +552,11 @@ jobs:
548552
549553
- name: Deploy canisters
550554
run: |
551-
# NOTE: dfx install will run the postinstall scripts from dfx.json
552-
dfx canister install internet_identity --wasm internet_identity_backend.wasm.gz --argument "(opt record { captcha_config = opt record { max_unsolved_captchas= 50:nat64; captcha_trigger = variant {Static = variant { CaptchaDisabled }}}; related_origins = opt vec { \"https://id.ai\"; \"https://identity.ic0.app\"; \"https://identity.internetcomputer.org\" }; new_flow_origins = opt vec { \"https://id.ai\" }; openid_configs = opt vec { ${{ steps.openid-configs.outputs.OPENID_CONFIGS }} } })"
553-
II_CANISTER_ID=$(dfx canister id internet_identity)
554-
dfx canister install internet_identity_frontend --wasm internet_identity_frontend.wasm.gz --argument "(record { backend_canister_id = principal \"$II_CANISTER_ID\"; backend_origin = \"https://backend.id.ai\"; related_origins = opt vec { \"https://id.ai\"; \"https://identity.ic0.app\"; \"https://identity.internetcomputer.org\" }; fetch_root_key = opt true; dev_csp = opt true })"
555-
dfx canister install test_app --wasm demos/test-app/test_app.wasm
555+
# NOTE: icp canister install will run the sync steps from icp.yaml
556+
icp canister install internet_identity --wasm internet_identity_backend.wasm.gz --args "(opt record { captcha_config = opt record { max_unsolved_captchas= 50:nat64; captcha_trigger = variant {Static = variant { CaptchaDisabled }}}; related_origins = opt vec { \"https://id.ai\"; \"https://identity.ic0.app\"; \"https://identity.internetcomputer.org\" }; new_flow_origins = opt vec { \"https://id.ai\" }; openid_configs = opt vec { ${{ steps.openid-configs.outputs.OPENID_CONFIGS }} } })"
557+
II_CANISTER_ID=$(icp canister status internet_identity --id-only)
558+
icp canister install internet_identity_frontend --wasm internet_identity_frontend.wasm.gz --args "(record { backend_canister_id = principal \"$II_CANISTER_ID\"; backend_origin = \"https://backend.id.ai\"; related_origins = opt vec { \"https://id.ai\"; \"https://identity.ic0.app\"; \"https://identity.internetcomputer.org\" }; fetch_root_key = opt true; dev_csp = opt true })"
559+
icp canister install test_app --wasm demos/test-app/test_app.wasm
556560
557561
- name: Run dev server
558562
id: dev-server-start
@@ -569,9 +573,9 @@ jobs:
569573
run: |
570574
npx playwright test --project ${{ matrix.device }} --workers 1 --shard=$(tr <<<'${{ matrix.shard }}' -s _ /) --reporter=line,html
571575
572-
- name: Stop dfx
576+
- name: Stop icp-cli
573577
if: ${{ always() }}
574-
run: dfx stop
578+
run: icp network stop
575579

576580
- name: Stop dev server
577581
if: ${{ always() }}
@@ -615,7 +619,8 @@ jobs:
615619
steps:
616620
- uses: actions/checkout@v4
617621

618-
- uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365
622+
- name: Install icp-cli
623+
run: npm install -g @icp-sdk/icp-cli@$(cat .icp-cli-version | tr -d '[:space:]')
619624

620625
- name: "Download II wasm"
621626
uses: actions/download-artifact@v4
@@ -631,23 +636,23 @@ jobs:
631636

632637
- name: "Install key"
633638
env:
634-
DFX_DEPLOY_KEY: ${{ secrets.DFX_DEPLOY_KEY }}
639+
ICP_DEPLOY_KEY: ${{ secrets.DFX_DEPLOY_KEY }}
635640
run: |
636641
key_pem=$(mktemp)
637-
printenv "DFX_DEPLOY_KEY" > "$key_pem"
638-
dfx identity import --disable-encryption --force default "$key_pem"
642+
printenv "ICP_DEPLOY_KEY" > "$key_pem"
643+
icp identity import --disable-encryption --force default "$key_pem"
639644
rm "$key_pem"
640645
641646
- name: "Deploy II"
642647
run: |
643648
wallet="cvthj-wyaaa-aaaad-aaaaq-cai"
644-
# Needed to surpass dfx error to use the insecure plaintext identity
645-
export DFX_WARNING=-mainnet_plaintext_identity
649+
# Needed to suppress icp-cli warning about insecure plaintext identity
650+
export ICP_WARNING=-mainnet_plaintext_identity
646651
sha=$(shasum -a 256 ./archive.wasm.gz | cut -d ' ' -f1 | sed 's/../\\&/g')
647-
dfx canister --network ic --wallet "$wallet" install --mode upgrade \
648-
--argument "(opt record {archive_config = record { module_hash = blob \"$sha\"; entries_buffer_limit = 10000:nat64; entries_fetch_limit = 1000:nat16; polling_interval_ns = 60000000000:nat64}; canister_creation_cycles_cost = opt (1000000000000:nat64); })" \
649-
--wasm internet_identity_backend.wasm.gz \
650-
y2aaj-miaaa-aaaad-aacxq-cai
652+
icp canister install y2aaj-miaaa-aaaad-aacxq-cai \
653+
-e ic --proxy "$wallet" --mode upgrade \
654+
--args "(opt record {archive_config = record { module_hash = blob \"$sha\"; entries_buffer_limit = 10000:nat64; entries_fetch_limit = 1000:nat16; polling_interval_ns = 60000000000:nat64}; canister_creation_cycles_cost = opt (1000000000000:nat64); })" \
655+
--wasm internet_identity_backend.wasm.gz
651656
652657
- name: "Download test app wasm"
653658
uses: actions/download-artifact@v4
@@ -658,11 +663,11 @@ jobs:
658663
- name: "Deploy test app"
659664
run: |
660665
wallet="cvthj-wyaaa-aaaad-aaaaq-cai"
661-
# Needed to surpass dfx error to use the insecure plaintext identity
662-
export DFX_WARNING=-mainnet_plaintext_identity
663-
dfx canister --network ic --wallet "$wallet" install --mode upgrade \
664-
--wasm ./test_app.wasm \
665-
vt36r-2qaaa-aaaad-aad5a-cai
666+
# Needed to suppress icp-cli warning about insecure plaintext identity
667+
export ICP_WARNING=-mainnet_plaintext_identity
668+
icp canister install vt36r-2qaaa-aaaad-aad5a-cai \
669+
-e ic --proxy "$wallet" --mode upgrade \
670+
--wasm ./test_app.wasm
666671
667672
- name: "Download VC issuer wasm"
668673
uses: actions/download-artifact@v4
@@ -673,21 +678,21 @@ jobs:
673678
- name: "Deploy Issuer"
674679
run: |
675680
wallet="cvthj-wyaaa-aaaad-aaaaq-cai"
676-
# Needed to surpass dfx error to use the insecure plaintext identity
677-
export DFX_WARNING=-mainnet_plaintext_identity
678-
dfx canister --network ic --wallet "$wallet" install --mode upgrade \
679-
--wasm vc_demo_issuer.wasm.gz \
680-
v2yvn-myaaa-aaaad-aad4q-cai
681+
# Needed to suppress icp-cli warning about insecure plaintext identity
682+
export ICP_WARNING=-mainnet_plaintext_identity
683+
icp canister install v2yvn-myaaa-aaaad-aad4q-cai \
684+
-e ic --proxy "$wallet" --mode upgrade \
685+
--wasm vc_demo_issuer.wasm.gz
681686
./demos/vc_issuer/provision \
682687
--ii-canister-id y2aaj-miaaa-aaaad-aacxq-cai \
683-
--dfx-network ic \
688+
--icp-network ic \
684689
--issuer-canister v2yvn-myaaa-aaaad-aad4q-cai \
685-
--wallet "$wallet"
690+
--proxy "$wallet"
686691
687692
- name: "Deploy archive"
688693
run: |
689-
# Needed to surpass dfx error to use the insecure plaintext identity
690-
export DFX_WARNING=-mainnet_plaintext_identity
694+
# Needed to suppress icp-cli warning about insecure plaintext identity
695+
export ICP_WARNING=-mainnet_plaintext_identity
691696
scripts/deploy-archive --wasm archive.wasm.gz --canister-id y2aaj-miaaa-aaaad-aacxq-cai --network ic
692697
693698
# This prepares all the files necessary for a release (all flavors of Wasm, release notes).
@@ -801,8 +806,8 @@ jobs:
801806
cp internet_identity_backend.wasm.gz internet_identity_production.wasm.gz
802807
cp internet_identity_backend.wasm.gz internet_identity_dev.wasm.gz
803808
804-
# Create a sha file for dfx pull, referenced by the metadata set in the build
805-
- name: Create sha for dfx pull
809+
# Create a sha file for icp-cli pull, referenced by the metadata set in the build
810+
- name: Create sha for icp-cli pull
806811
run: |
807812
shasum -a 256 \
808813
./internet_identity_backend.wasm.gz > \

.github/workflows/deploy-rc.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,26 @@ jobs:
5858
- name: "Print shasum of found build"
5959
run: shasum -a 256 ./internet_identity_backend.wasm.gz
6060

61-
- uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365
61+
- name: Install icp-cli
62+
run: npm install -g @icp-sdk/icp-cli@$(cat .icp-cli-version | tr -d '[:space:]')
6263

6364
- name: "Install key"
6465
env:
65-
DFX_DEPLOY_KEY: ${{ secrets.DFX_DEPLOY_KEY }}
66+
ICP_DEPLOY_KEY: ${{ secrets.DFX_DEPLOY_KEY }}
6667
run: |
6768
key_pem=$(mktemp)
68-
printenv "DFX_DEPLOY_KEY" > "$key_pem"
69-
dfx identity import --disable-encryption --force default "$key_pem"
69+
printenv "ICP_DEPLOY_KEY" > "$key_pem"
70+
icp identity import --disable-encryption --force default "$key_pem"
7071
rm "$key_pem"
7172
7273
- name: "Deploy Release Candidate"
7374
run: |
7475
wallet="${{ env.wallet_canister_id }}"
75-
# Needed to surpass dfx error to use the insecure plaintext identity
76-
export DFX_WARNING=-mainnet_plaintext_identity
77-
dfx canister --network ic --wallet "$wallet" install --mode upgrade \
78-
--wasm internet_identity_backend.wasm.gz \
79-
${{ env.ii_canister_id }}
76+
# Needed to suppress icp-cli warning about insecure plaintext identity
77+
export ICP_WARNING=-mainnet_plaintext_identity
78+
icp canister install ${{ env.ii_canister_id }} \
79+
-e ic --proxy "$wallet" --mode upgrade \
80+
--wasm internet_identity_backend.wasm.gz
8081
8182
- name: Send RC link to slack
8283
uses: ./.github/actions/slack

.github/workflows/update-dfx.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# A GitHub Actions workflow that regularly checks for new icp-cli releases
2+
# and creates a PR on new versions.
3+
name: icp-cli Update
4+
5+
on:
6+
schedule:
7+
# check for new icp-cli releases daily at 7:30
8+
- cron: "30 7 * * *"
9+
workflow_dispatch:
10+
11+
jobs:
12+
icp-cli-update:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
# First, check icp-cli releases for a new version.
18+
- name: Check new icp-cli version
19+
id: update
20+
run: |
21+
current_icp_cli_release=$(cat .icp-cli-version | tr -d '[:space:]')
22+
echo "current icp-cli release '$current_icp_cli_release'"
23+
24+
latest_icp_cli_release=$(curl -sSL https://api.github.com/repos/dfinity/icp-cli/releases/latest | jq -r '.tag_name | sub("^v"; "")')
25+
echo "latest icp-cli release '$latest_icp_cli_release'"
26+
27+
if [ "$current_icp_cli_release" != "$latest_icp_cli_release" ]
28+
then
29+
echo icp-cli needs an update
30+
echo "$latest_icp_cli_release" > .icp-cli-version
31+
echo "updated=1" >> "$GITHUB_OUTPUT"
32+
else
33+
echo "updated=0" >> "$GITHUB_OUTPUT"
34+
fi
35+
36+
cat .icp-cli-version
37+
38+
# If the version was updated, create a PR.
39+
- name: Create Pull Request
40+
if: ${{ steps.update.outputs.updated == '1' }}
41+
uses: peter-evans/create-pull-request@v6
42+
with:
43+
token: ${{ secrets.GIX_BOT_PAT }}
44+
base: main
45+
add-paths: ./.icp-cli-version
46+
commit-message: Update icp-cli release
47+
committer: GitHub <noreply@github.com>
48+
author: gix-bot <gix-bot@users.noreply.github.com>
49+
branch: bot-icp-cli-update
50+
delete-branch: true
51+
title: "Update icp-cli"
52+
53+
# Since this is a scheduled job, a failure won't be shown on any
54+
# PR status. To notify the team, we send a message to our Slack channel on failure.
55+
- name: Notify Slack on failure
56+
uses: ./.github/actions/slack
57+
if: ${{ failure() }}
58+
with:
59+
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
60+
MESSAGE: "icp-cli update failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
.DS_Store
99
**/.DS_Store
1010

11-
# dfx temporary files
12-
.dfx/
11+
# icp-cli temporary files
12+
.icp/
1313

1414
# frontend code
1515
node_modules/

.icp-cli-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2.0

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
.DS_Store
88
**/.DS_Store
99

10-
# dfx temporary files
11-
.dfx/
10+
# icp-cli temporary files
11+
.icp/
1212

1313
# frontend code
1414
node_modules/

0 commit comments

Comments
 (0)