|
| 1 | +# AI Agent Instructions for On-Chain SSI |
| 2 | + |
| 3 | +## Project Context |
| 4 | +This is an On-Chain Self-Sovereign Identity (SSI) architecture project. It enables organizations to issue and verify decentralized digital identities anchored on the blockchain using the `did:ethr` standard and CRSet (Credential Revocation Set) management. |
| 5 | +The repository is a **monorepo** containing smart contracts, frontend, and backend packages. |
| 6 | + |
| 7 | +## Tech Stack & Global Rules |
| 8 | +- **Node.js**: Strict requirement of `>= 22.12.0` (Do NOT use Node 20.x due to Hardhat 3 and Vite 7 constraints). |
| 9 | +- **Package Manager**: `npm` (version `>= 10.0.0`). Do not use `yarn` or `pnpm`. |
| 10 | +- **Language**: TypeScript is used everywhere (contracts and frontend). |
| 11 | + |
| 12 | +## Package-Specific Guidelines |
| 13 | + |
| 14 | +### 1. Smart Contracts (`packages/trust-anchor-did-ethr`) |
| 15 | +- **Framework**: Hardhat 3 with Viem (`@nomicfoundation/hardhat-toolbox-viem`). |
| 16 | +- **Solidity Version**: `0.8.28`. |
| 17 | +- **Deployment**: We use **Hardhat Ignition** (`@nomicfoundation/hardhat-ignition`). Do not use the legacy `hardhat-deploy` plugins. |
| 18 | +- **Testing**: Tests are written using Hardhat and Viem. |
| 19 | +- **Commands**: |
| 20 | + - Compile: `npm run compile` (or `npx hardhat compile`) |
| 21 | + - Test: `npx hardhat test` |
| 22 | + - Local Node: `npx hardhat node` |
| 23 | + |
| 24 | +### 2. Frontend (`packages/demo-app-frontend`) |
| 25 | +- **Framework**: React 19 + Vite 7. |
| 26 | +- **Blockchain Interaction**: `wagmi` (v3) + `viem` (v2). |
| 27 | +- **Styling**: Tailwind CSS + Vanilla CSS (`index.css`). Use modern, clean aesthetics. |
| 28 | +- **Linting/Formatting**: ESLint and Prettier are strictly enforced via Husky pre-commit hooks. Ensure code passes `npm run lint` before committing. |
| 29 | +- **Commands**: |
| 30 | + - Dev server: `npm run dev` |
| 31 | + - Build: `npm run build` |
| 32 | + |
| 33 | +## Workflows |
| 34 | + |
| 35 | +### Git & Code Commits |
| 36 | +- We use Husky pre-commit hooks to lint and format code automatically. Do not bypass them unless explicitly instructed. |
| 37 | +- When generating Markdown documentation, ensure compliance with `markdownlint` (we ignore MD013 / line lengths by default). |
| 38 | + |
| 39 | +### Implementation Steps (For AI Agents) |
| 40 | +1. **Plan Mode**: Analyze the file structure, specifically checking the `package.json` in the respective sub-package before importing new libraries. Ask for clarification if unsure about the system architecture. |
| 41 | +2. **Build Mode**: Write clean, modular TypeScript code. Document any new smart contract functions with NatSpec comments. |
| 42 | +3. **Verification**: Always double-check your output against the specific Vite or Hardhat versions we are using. |
0 commit comments