-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Context
While using the internet-identity, asset-canister, and icp-cli skills together to add II authentication with a frontend to a Motoko project, an AI agent hit four sequential build/runtime failures before getting a working result. Two of these are already addressed by #91 (wrong II canister ID, missing fetch binding) and the related JS SDK fix. The remaining issues are about missing information in the skills.
Problem
The skills don't contain enough information for an agent (or developer) to produce a working frontend + II integration on the first attempt. Specifically:
-
No npm package versions anywhere. The
internet-identityskill lists@icp-sdk/authand@icp-sdk/coreas prerequisites but without version numbers. Thebinding-generation.mdreference shows@icp-sdk/bindgenusage but no version. An agent guessed^0.1.0— the actual versions are5.xand0.2.x, causingnpm installto fail. -
No Vite
build.targetguidance. The frontend code examples use top-levelawait(e.g.,await AuthClient.create()), but Vite's default build target (es2020) doesn't support it. The build fails with "Top-level await is not available in the configured target environment". No skill mentions thatbuild.target: "esnext"is required. -
No complete frontend project scaffold. Building a working frontend requires piecing together fragments from three skills and two reference docs:
icp.yamlfromasset-canister, auth code frominternet-identity, Vite plugin config fromicp-cli/references/binding-generation.md, dev server setup fromicp-cli/references/dev-server.md, and.ic-assets.json5fromasset-canister. There is no single place that shows a complete, workingpackage.json+vite.config.js+index.html.
Proposed changes
1. internet-identity/SKILL.md — add npm versions to prerequisites
Current:
- Frontend: `@icp-sdk/auth`, `@icp-sdk/core`
Proposed:
- Frontend: `@icp-sdk/auth` (>= 5.0.0), `@icp-sdk/core` (>= 5.0.0)
2. asset-canister/SKILL.md — add complete Vite project scaffold
Add a section with a working minimal frontend setup:
package.jsonwith@icp-sdk/core,@icp-sdk/bindgen, andviteat correct versionsvite.config.jswith:build.target: "esnext"(required for top-level await)@icp-sdk/bindgenplugin configured- Dev server config (currently buried in
icp-cli/references/dev-server.md)
- Minimal
index.htmlentry point
This belongs in asset-canister because any frontend on IC needs this base, regardless of auth method.
3. icp-cli/references/binding-generation.md — add @icp-sdk/bindgen version
The reference shows icpBindgen() usage but doesn't state which version to install. Add >= 0.2.0.
Already addressed
- Wrong II canister ID fallback → fix(internet-identity): hardcode II canister ID, add fetch binding #91
- Missing
fetch: window.fetch.bind(window)→ fix(internet-identity): hardcode II canister ID, add fetch binding #91 - Root cause
fetchbinding fix in JS SDK → linked in fix(internet-identity): hardcode II canister ID, add fetch binding #91