Skip to content

Commit ccd3100

Browse files
committed
(chore) (openai/gpt-5.5, reviewed T, tested T) move cli into pnpm workspace
1 parent 8a722e4 commit ccd3100

34 files changed

Lines changed: 57 additions & 41 deletions

.github/workflows/test-cli.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@ permissions: {}
55
on:
66
push:
77
paths:
8-
- "cli/**"
8+
- "packages/cli/**"
9+
- "package.json"
10+
- "pnpm-lock.yaml"
11+
- "pnpm-workspace.yaml"
912
- ".github/workflows/test-cli.yml"
1013
pull_request:
1114
paths:
12-
- "cli/**"
15+
- "packages/cli/**"
16+
- "package.json"
17+
- "pnpm-lock.yaml"
18+
- "pnpm-workspace.yaml"
1319
- ".github/workflows/test-cli.yml"
1420
workflow_dispatch:
1521

1622
defaults:
1723
run:
18-
working-directory: cli
24+
working-directory: packages/cli
1925

2026
jobs:
2127
test:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.DS_store
1+
.DS_store
2+
node_modules/

AGENTS.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ At the foundation of fcf is the **Repository Identity Key** (**RIK**), an ERC-72
1515
## Monorepo
1616

1717
- `contracts/`: EVM smart contracts that define protocol identity and funding primitives.
18-
- `cli/`: command-line tooling for repository onboarding and protocol operations.
18+
- `packages/cli/`: command-line tooling for repository onboarding and protocol operations.
1919

2020
## Create a RIK
2121

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "fcf",
3+
"private": true,
4+
"packageManager": "pnpm@10.24.0"
5+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/freecodexyz/fcf.git",
9-
"directory": "cli"
9+
"directory": "packages/cli"
1010
},
1111
"bin": {
1212
"fcf": "./dist/index.js"
@@ -22,7 +22,7 @@
2222
},
2323
"scripts": {
2424
"dev": "tsx src/index.ts",
25-
"abi": "forge build --root ../contracts && node scripts/generate-abi.mjs",
25+
"abi": "forge build --root ../../contracts && node scripts/generate-abi.mjs",
2626
"build": "tsup src/index.ts --format esm --dts --clean",
2727
"version:minor": "node scripts/bump-minor.mjs",
2828
"prepublishOnly": "pnpm version:minor && pnpm abi && pnpm test && pnpm typecheck && pnpm build",

0 commit comments

Comments
 (0)