Skip to content

refactor: move challenges to typescript and improve types (@fehmer)#8159

Open
fehmer wants to merge 20 commits into
masterfrom
feature/refactor-challenges
Open

refactor: move challenges to typescript and improve types (@fehmer)#8159
fehmer wants to merge 20 commits into
masterfrom
feature/refactor-challenges

Conversation

@fehmer

@fehmer fehmer commented Jun 25, 2026

Copy link
Copy Markdown
Member

No description provided.

@monkeytypegeorge monkeytypegeorge added backend Server stuff frontend User interface or web stuff local dev Related to the build process or dependencies assets Languages, themes, layouts, etc. packages Changes in local packages labels Jun 25, 2026
@monkeytypegeorge monkeytypegeorge added the api A change to the Application Programming Interface (API) label Jul 5, 2026
@Miodec Miodec requested a review from Copilot July 5, 2026 14:09
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors challenge definitions from frontend static JSON into a new @monkeytype/challenges workspace package, then wires frontend/backend to consume the shared TS source + stronger schemas/types.

Changes:

  • Add packages/challenges package (typed challenge defs + helpers) and depend on it from frontend/backend.
  • Move typedKeys/typedEntries/typedValues into @monkeytype/util/objects and update call sites.
  • Tighten result schema typing by switching CompletedEvent.challenge to ChallengeNameSchema.

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds workspace link + lock updates for new challenges package
packages/util/src/objects.ts New shared typed keys/entries/values helpers
packages/schemas/src/results.ts Uses ChallengeNameSchema for CompletedEvent.challenge
packages/schemas/src/challenges.ts Introduces ChallengeNameSchema enum + ChallengeName type
packages/challenges/vitest.config.ts Vitest config for new package
packages/challenges/tsup.config.js TSUP entry config for new package
packages/challenges/tsconfig.json TS config for building challenges package
packages/challenges/src/index.ts New canonical challenge definitions + accessors
packages/challenges/scripts/challenge-roles.ts Script to emit Discord role mapping
packages/challenges/package.json Package metadata/scripts/exports for challenges
packages/challenges/.oxlintrc.json Lint config for challenges package
packages/challenges/test/tsconfig.json Test TS config scaffold
frontend/static/challenges/_list.json Removes static challenges list JSON
frontend/src/ts/utils/misc.ts Removes typedKeys/typedEntries from frontend misc utils
frontend/src/ts/utils/json-data.ts Removes getChallengeList() fetcher for _list.json
frontend/src/ts/states/test.ts Switches Challenge type import to @monkeytype/challenges
frontend/src/ts/controllers/url-handler.tsx Loads challenge from URL using ChallengeController.setup()
frontend/src/ts/controllers/chart-controller.ts Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/controllers/challenge-controller.ts Uses @monkeytype/challenges data instead of fetched JSON
frontend/src/ts/config/utils.ts Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/config/setters.ts Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/config/lifecycle.ts Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/components/pages/account/utils.ts Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/components/modals/SimpleModal.tsx Switches to typedEntries from @monkeytype/util/objects
frontend/src/ts/components/common/AsyncContent.tsx Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/commandline/lists/load-challenge.ts Builds challenge command list from getChallenges()
frontend/src/ts/commandline/lists.ts Removes async challenge list bootstrap/waits
frontend/src/ts/commandline/commandline-metadata.ts Switches to typedKeys from @monkeytype/util/objects
frontend/src/ts/auth.tsx Switches to typedKeys from @monkeytype/util/objects
frontend/scripts/check-assets.ts Removes challenges list validation path
frontend/package.json Adds @monkeytype/challenges dependency
backend/src/constants/auto-roles.ts Removes hardcoded auto-role list
backend/src/api/controllers/result.ts Uses getChallenges() for auto-role eligibility
backend/package.json Adds @monkeytype/challenges dependency
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread frontend/src/ts/controllers/url-handler.tsx Outdated
Comment thread frontend/src/ts/controllers/url-handler.tsx Outdated
Comment thread frontend/src/ts/controllers/challenge-controller.ts
Comment thread backend/src/api/controllers/result.ts
Comment thread packages/challenges/src/index.ts Outdated
Comment thread packages/challenges/src/index.ts Outdated
@Miodec Miodec added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for review Pull requests that require a review before continuing labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 5, 2026
@Miodec Miodec requested a review from Copilot July 5, 2026 15:06
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jul 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread frontend/src/ts/controllers/url-handler.tsx Outdated
Comment thread backend/__tests__/setup-tests.ts
@github-actions github-actions Bot removed the waiting for review Pull requests that require a review before continuing label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api A change to the Application Programming Interface (API) assets Languages, themes, layouts, etc. backend Server stuff frontend User interface or web stuff local dev Related to the build process or dependencies packages Changes in local packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants