Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 0 additions & 8 deletions .changeset/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions .changeset/config.json

This file was deleted.

15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
env:
NODE_OPTIONS: "--max_old_space_size=8192"

steps:
- uses: actions/checkout@v4
# actions/checkout@v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

- uses: jdx/mise-action@v2
- name: Install mise
run: |
curl https://mise.run | MISE_VERSION=v2026.5.6 sh
Comment thread
petar-omni marked this conversation as resolved.
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
export PATH="$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH"
mise install

- run: pnpm install --frozen-lockfile

Expand All @@ -33,3 +38,5 @@ jobs:
- run: pnpm lint

- run: pnpm test

- run: pnpm check-hygiene
77 changes: 55 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,73 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write

environment: production
env:
NODE_OPTIONS: "--max_old_space_size=8192"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_DIR: packages/widget

steps:
- uses: actions/checkout@v4
# actions/checkout@v6.0.2
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0

- uses: jdx/mise-action@v2
- name: Install mise
run: |
curl https://mise.run | MISE_VERSION=v2026.5.6 sh
Comment thread
petar-omni marked this conversation as resolved.
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
export PATH="$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH"
mise install

# npm 11.5.1 or later is required for trusted publishing
- name: Update npm
run: npm install -g npm@latest
- name: Run release-please
id: release
# googleapis/release-please-action@v5.0.0
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
target-branch: ${{ github.ref_name }}

- name: Fix executable files for changesets
- name: Check npm publish status
id: publish
shell: bash
run: |
chmod -x .husky/commit-msg
package_name=$(node -p "require('./${PACKAGE_DIR}/package.json').name")
version=$(node -p "require('./${PACKAGE_DIR}/package.json').version")
tag="${package_name}@${version}"

- run: pnpm install --frozen-lockfile
{
echo "package_name=${package_name}"
echo "version=${version}"
echo "tag=${tag}"
} >> "$GITHUB_OUTPUT"

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
version: pnpm run version
commit: "ci(changesets): version packages"
title: "ci(changesets): version packages"
commitMode: github-api
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Use OIDC for npm authentication instead of NPM_TOKEN
NPM_TOKEN: "" # https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868
if ! gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "No GitHub release found for ${tag}; skipping npm publish."
echo "should_publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi

if npm view "${package_name}@${version}" version >/dev/null 2>&1; then
echo "${package_name}@${version} is already published; skipping npm publish."
echo "should_publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi

echo "should_publish=true" >> "$GITHUB_OUTPUT"

- name: Publish to npm
if: steps.publish.outputs.should_publish == 'true'
run: |
tag="${{ steps.publish.outputs.tag }}"
git fetch --force origin "refs/tags/${tag}:refs/tags/${tag}"
git checkout --detach "$tag"
mise install
pnpm install --frozen-lockfile
pnpm exec turbo --filter=@stakekit/widget build
npm publish "$PACKAGE_DIR"
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ yarn-error.log*
# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
Expand Down Expand Up @@ -266,4 +263,6 @@ next-env.d.ts
*.p12
*.pfx
*.crt
*.cer
*.cer

.pnpm-store
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packages/widget": "0.0.270"
}
60 changes: 60 additions & 0 deletions .rev-dep.config.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.7.schema.json?raw=true",
"configVersion": "1.7",
"rules": [
{
"path": "packages/widget",
"prodEntryPoints": [
"src/index.package.ts",
"src/index.bundle.ts",
"src/main.tsx",
"src/translation/i18next.d.ts",
"src/types/purify-extend.d.ts",
"src/types/window.d.ts",
"src/vite-env.d.ts",
"postcss.config.js",
"public/mockServiceWorker.js",
"vite/*.ts"
],
"devEntryPoints": [
"scripts/generate-effect-openapi.ts",
"tests/utils/setup.ts",
"tests/**/*.test.ts",
"tests/**/*.test.tsx"
],
"orphanFilesDetection": {
"enabled": true
},
"unusedExportsDetection": {
"enabled": true,
"ignoreFiles": ["src/types/yield-api-schema.d.ts"]
},
"unusedNodeModulesDetection": {
"enabled": true,
"excludeModules": [
"@effect/openapi-generator",
"@effect/platform-node",
"babel-plugin-react-compiler",
"playwright",
"postcss",
"swagger2openapi",
"tsx",
"yaml"
],
"pkgJsonFieldsWithBinaries": ["scripts"]
},
"missingNodeModulesDetection": {
"enabled": true
},
"unresolvedImportsDetection": {
"enabled": true
},
"circularImportsDetection": {
"enabled": true
}
// "devDepsUsageOnProdDetection": {
// "enabled": true
// }
}
]
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,20 @@
"typescript.preferences.importModuleSpecifier": "relative",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},

"typescript.preferences.autoImportFileExcludePatterns": ["repos/**"],
"javascript.preferences.autoImportFileExcludePatterns": ["repos/**"],

"files.exclude": {
"repos/**": true
},

"files.watcherExclude": {
"repos/**": true
},

"search.exclude": {
"repos/**": true
}
}
58 changes: 58 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# StakeKit Widget — Agent Guide

## Project Overview
- Monorepo managed with `pnpm` workspaces + Turborepo.
- Main package is `@stakekit/widget` in `packages/widget` (React + TypeScript + Vite).
- Widget supports two entry modes:
- React component export (`src/index.package.ts`)
- Fully bundled renderer (`src/index.bundle.ts`)
- Runtime branches between classic widget and dashboard variant in `src/App.tsx`.

## Repo Layout (important paths)
- `packages/widget/src/App.tsx` — root app, router setup, bundle renderer.
- `packages/widget/src/Widget.tsx` — non-dashboard route flow (earn/review/steps/details).
- `packages/widget/src/Dashboard.tsx` + `pages-dashboard/*` — dashboard variant UI.
- `packages/widget/src/providers/*` — global provider composition (API, query, wallet, tracking, theme, stores).
- `packages/widget/src/hooks/*` — feature and API hooks.
- `packages/widget/src/domain/*` — shared domain types/helpers.
- `packages/widget/src/translation/*` — i18n resources (`English`, `French`).
- `packages/widget/tests/*` — Vitest browser tests (MSW-backed).
- `packages/examples/*` — integration examples (`with-vite`, `with-vite-bundled`, `with-nextjs`, `with-cdn-script`).

## Commands Agents Should Use

### From repo root (all workspaces via Turbo)
- `pnpm build` — build all packages.
- `pnpm lint` — lint/type-check all packages.
- `pnpm test` — run all workspace tests.
- `pnpm format` — run formatting checks/tasks.
- `pnpm check-hygiene` - check unused deps, unresolved imports, circular deps, etc

### Focused widget commands (recommended for most tasks)
- `pnpm --filter @stakekit/widget {command}`

## Agent Working Guidelines (short)
- Keep public API compatibility in `src/index.package.ts` and `src/index.bundle.ts`.
- When changing user-facing copy, update both:
- `packages/widget/src/translation/English/translations.json`
- `packages/widget/src/translation/French/translations.json`
- After changes, confirm nothing is broken with lint command which checks lint/type errors

## Useful Context for Debugging
- API client is configured in `packages/widget/src/providers/api/api-client-provider.tsx`.
- React Query defaults are in `packages/widget/src/providers/query-client/index.tsx`.
- App-level config/env mapping is in `packages/widget/src/config/index.ts`.
- Test bootstrapping + MSW worker setup:
- `packages/widget/tests/utils/setup.ts`
- `packages/widget/tests/mocks/worker.ts`

## Vendored Repositories

This project vendors external repositories under @repos/

- Use vendored repositories as read-only reference material when working with related libraries
- Prefer examples and patterns from the vendored source code over generated guesses or web search results
- Do not edit files under @repos/ unless explicitly asked
- Do not import from @repos/ - application code should continue importing from normal package dependencies
- Before writing any Effect code, inspect @repos/effect/LLMS.md
- Before writing code that interacts with Effect `HttpClient`, inspect `agent-patterns/effect-http-client.md`
Loading
Loading