@@ -8,7 +8,7 @@ Guidance for AI coding agents working in this repository. See
88- Project name: write it as ` fcf ` in prose and commands.
99- Purpose: CLI tooling and EVM smart contracts for the
1010 ` @freecodexyz ` funding layer.
11- - Repository shape: small monorepo with a TypeScript CLI in ` cli/ ` and a
11+ - Repository shape: small monorepo with a TypeScript CLI in ` packages/ cli/` and a
1212 Foundry Solidity project in ` contracts/ ` .
1313- CLI stack: Node 24 in CI, ESM TypeScript, ` pnpm@10.24.0 ` , Commander, Viem,
1414 tsup, tsx, TypeScript, and Vitest.
@@ -20,7 +20,7 @@ Guidance for AI coding agents working in this repository. See
2020## Environment Setup
2121
2222- Use Node 24 for CLI work to match GitHub Actions.
23- - Use Corepack and pnpm in ` cli/ ` ; there is no root ` package.json ` .
23+ - Use Corepack and pnpm from the workspace root or ` packages/cli/ ` .
2424- Initialize submodules before contract work:
2525 ` git submodule update --init --recursive ` .
2626- Install Foundry for contract build/test commands: ` forge ` , ` cast ` , and
@@ -32,12 +32,12 @@ Guidance for AI coding agents working in this repository. See
3232
3333| Purpose | Command |
3434| --- | --- |
35- | Install CLI dependencies | ` cd cli && corepack enable && pnpm install --frozen-lockfile` |
36- | Run CLI from source | ` cd cli && pnpm dev -- --help ` |
37- | CLI typecheck | ` cd cli && pnpm typecheck ` |
38- | CLI tests | ` cd cli && pnpm test ` |
39- | CLI build | ` cd cli && pnpm build ` |
40- | Regenerate committed ABI | ` cd cli && pnpm abi ` |
35+ | Install CLI dependencies | ` corepack enable && pnpm install --frozen-lockfile ` |
36+ | Run CLI from source | ` cd packages/ cli && pnpm dev -- --help ` |
37+ | CLI typecheck | ` cd packages/ cli && pnpm typecheck ` |
38+ | CLI tests | ` cd packages/ cli && pnpm test ` |
39+ | CLI build | ` cd packages/ cli && pnpm build ` |
40+ | Regenerate committed ABI | ` cd packages/ cli && pnpm abi ` |
4141| Contract format check | ` cd contracts && forge fmt --check ` |
4242| Contract build with sizes | ` cd contracts && forge build --sizes ` |
4343| Contract tests | ` cd contracts && forge test -vvv ` |
@@ -46,27 +46,27 @@ Guidance for AI coding agents working in this repository. See
4646| Base Sepolia RIKLauncher + RIKRoyaltySplitter deploy script | ` cd contracts && PRIVATE_KEY=... AIRLOCK_ADDRESS=... RIK_ADDRESS=... ./deploy-rik-launcher-and-splitter-base-sepolia.sh ` |
4747| Finds agents TODOs when asked | ` rg -F 'TODO (AGENT)' ` |
4848
49- Do not run release/versioning commands such as ` cd cli && pnpm version:minor `
50- or ` cd cli && pnpm prepublishOnly ` unless the user explicitly asks for a
51- release path. They mutate ` cli/package.json ` .
49+ Do not run release/versioning commands such as ` cd packages/ cli && pnpm version:minor `
50+ or ` cd packages/ cli && pnpm prepublishOnly ` unless the user explicitly asks for a
51+ release path. They mutate ` packages/ cli/package.json` .
5252
5353## Repository Structure
5454
5555- ` .github/workflows/test-cli.yml ` : CLI CI; installs with pnpm and runs
56- ` pnpm test ` under ` cli/ ` .
56+ ` pnpm test ` under ` packages/ cli/` .
5757- ` .github/workflows/test-contracts.yml ` : contract CI; runs ` forge fmt --check ` ,
5858 ` forge build --sizes ` , and ` forge test -vvv ` under ` contracts/ ` .
5959- ` .github/workflows/fcf-register.yml ` : checked-in registration workflow emitted
6060 by the CLI ` init ` command.
6161- ` local-rpc.sh ` : root helper that starts Anvil, deploys a contract, prints the
6262 RPC URL/private key/owner/contract address, and waits until interrupted.
63- - ` cli/src/index.ts ` : Commander CLI entrypoint.
64- - ` cli/templates/fcf-register.yml ` : workflow template emitted by CLI ` init ` .
65- - ` cli/src/oidc.ts ` : JWT base64url helpers, parsing, and GitHub ` kid ` hashing.
66- - ` cli/src/importAbi.ts ` : loads the committed static ABI by default.
67- - ` cli/src/abi/RIK.json ` : committed generated ABI used by the published CLI.
68- - ` cli/scripts/generate-abi.mjs ` : copies the ABI from the Foundry artifact into
69- ` cli/src/abi/RIK.json ` .
63+ - ` packages/ cli/src/index.ts` : Commander CLI entrypoint.
64+ - ` packages/ cli/templates/fcf-register.yml` : workflow template emitted by CLI ` init ` .
65+ - ` packages/ cli/src/github /oidc.ts` : JWT base64url helpers, parsing, and GitHub ` kid ` hashing.
66+ - ` packages/ cli/src/utils /importAbi.ts` : loads the committed static ABI by default.
67+ - ` packages/ cli/src/abi/RIK.json` : committed generated ABI used by the published CLI.
68+ - ` packages/ cli/scripts/generate-abi.mjs` : copies the ABI from the Foundry artifact into
69+ ` packages/ cli/src/abi/RIK.json` .
7070- ` contracts/src/RIK.sol ` : repository identity ERC-721 and JWT verification.
7171- ` contracts/src/JsonClaim.sol ` : minimal byte-search JSON claim helper.
7272- ` contracts/test/RIK.t.sol ` : Foundry regression tests for registration,
@@ -103,12 +103,12 @@ release path. They mutate `cli/package.json`.
103103- ` JsonClaim ` is deliberately small and byte-oriented. If claim parsing changes,
104104 add regression tests for missing claims, mismatched claims, and valid compact
105105 JWT payloads.
106- - ` cli/src/importAbi.ts ` defaults to the committed static ABI. ` SKIP_STATIC_ABI `
106+ - ` packages/ cli/src/utils /importAbi.ts` defaults to the committed static ABI. ` SKIP_STATIC_ABI `
107107 switches to the Foundry artifact path for local development.
108- - Keep ` cli/templates/fcf-register.yml ` and
108+ - Keep ` packages/ cli/templates/fcf-register.yml` and
109109 ` .github/workflows/fcf-register.yml ` behavior in sync when registration
110110 workflow semantics change.
111- - Contract ABI changes must be followed by ` cd cli && pnpm abi ` so the packaged
111+ - Contract ABI changes must be followed by ` cd packages/ cli && pnpm abi ` so the packaged
112112 CLI ABI stays current.
113113
114114## Code Style
@@ -132,16 +132,16 @@ release path. They mutate `cli/package.json`.
132132
133133## Testing
134134
135- - For CLI-only changes, run ` cd cli && pnpm typecheck ` and ` cd cli && pnpm test ` .
135+ - For CLI-only changes, run ` cd packages/ cli && pnpm typecheck ` and ` cd packages/ cli && pnpm test ` .
136136- For contract-only changes, run ` cd contracts && forge fmt --check ` ,
137137 ` cd contracts && forge build --sizes ` , and ` cd contracts && forge test -vvv ` .
138- - For ABI-affecting contract changes, also run ` cd cli && pnpm abi ` ,
139- ` cd cli && pnpm typecheck ` , and ` cd cli && pnpm build ` .
138+ - For ABI-affecting contract changes, also run ` cd packages/ cli && pnpm abi ` ,
139+ ` cd packages/ cli && pnpm typecheck ` , and ` cd packages/ cli && pnpm build ` .
140140- Keep Foundry tests deterministic and local. Do not hit GitHub, Sepolia, or
141141 other live RPC endpoints from unit tests.
142142- Contract tests may use ` vm.ffi ` with ` contracts/test/fixtures/load-fixture.mjs ` ;
143143 avoid adding more external process dependencies unless necessary.
144- - Add CLI tests as Vitest tests under ` cli/src/ ` or a future ` cli/test/ `
144+ - Add CLI tests as Vitest tests under ` packages/ cli/src/` or a future ` packages/ cli/test/`
145145 directory. Mock ` fetch ` , Viem clients, and filesystem writes rather than using
146146 live network calls.
147147
@@ -172,10 +172,10 @@ release path. They mutate `cli/package.json`.
172172- Do not change production/provider configuration without explicit approval:
173173 environment variable names, default RPC behavior, GitHub OIDC issuer,
174174 workflow permissions, contract addresses, or default package tags.
175- - Do not edit generated or dependency directories directly: ` cli/node_modules/ ` ,
176- ` cli/dist/ ` , ` contracts/cache/ ` , ` contracts/out/ ` , ` contracts/broadcast/ ` ,
175+ - Do not edit generated or dependency directories directly: ` packages/ cli/node_modules/` ,
176+ ` packages/ cli/dist/` , ` contracts/cache/ ` , ` contracts/out/ ` , ` contracts/broadcast/ ` ,
177177 or ` contracts/lib/ ` .
178- - The committed static ABI at ` cli/src/abi/RIK.json ` is generated but tracked;
179- update it only through ` cd cli && pnpm abi ` when the contract ABI changes.
178+ - The committed static ABI at ` packages/ cli/src/abi/RIK.json` is generated but tracked;
179+ update it only through ` cd packages/ cli && pnpm abi ` when the contract ABI changes.
180180- Never replace pnpm with npm/yarn or Foundry with another contract toolchain
181181 without explicit user approval.
0 commit comments