Skip to content

Commit

Permalink
Merge branch 'main' into feat/ingest-publish-rag
Browse files Browse the repository at this point in the history
  • Loading branch information
mantagen committed Dec 18, 2024
2 parents 7485394 + a0999c1 commit a9f6fb3
Show file tree
Hide file tree
Showing 343 changed files with 7,347 additions and 5,416 deletions.
407 changes: 407 additions & 0 deletions .dependency-cruiser.cjs

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/actions/ref_from_sha/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ outputs:
description: "The number of the PR if one is found"
runs:
using: "node20"
main: "index.js"
main: "index.cjs"
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
const core = require("@actions/core");
const github = require("@actions/github");

const prFromSha = require("./pr_from_sha");
const branchFromSha = require("./branch_from_sha");
const prFromSha = require("./pr_from_sha.cjs");
const branchFromSha = require("./branch_from_sha.cjs");

async function run() {
try {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const github = require("@actions/github");

const prFromSha = require("../pr_from_sha");
const branchFromSha = require("../branch_from_sha");
const prFromSha = require("../pr_from_sha.cjs");
const branchFromSha = require("../branch_from_sha.cjs");

const githubToken = process.env.GITHUB_TOKEN;

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Install deps (with cache)
run: pnpm install

- name: Prisma generate (no engine)
run: pnpm turbo db-generate:no-engine --cache-dir=".turbo"

- name: Build, lint and type-check
run: pnpm turbo lint type-check --cache-dir=".turbo"

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ jobs:
doppler-token: ${{ secrets.DOPPLER_TOKEN }}
inject-env-vars: true

- name: Get App Version
id: app-version
run: |
APP_VERSION=$(grep -m 1 -oP '(?<=## \[)\d+\.\d+\.\d+' CHANGE_LOG.md)
echo "version=$APP_VERSION" >> $GITHUB_OUTPUT
- name: SonarCloud scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ steps.doppler.outputs.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{ steps.app-version.outputs.version }}
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,15 @@ jobs:
inject-env-vars: true

- name: Run tests
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33%
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33% --coverage

# Run only on production branch
- name: Report coverage to SonarCloud
if: ${{ github.event.pull_request.merged == true && github.base_ref == 'production' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.javascript.lcov.reportPaths=packages/**/coverage/lcov.info,apps/nextjs/coverage/lcov.info
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ yarn-error.log*

# Allow each developer to have personal settings, but ignore these files
.vscode/launch.json
.vscode/*.settings.json
.vscode/*.settings.json

.sonar
.sonar/**/*

dependency-graph.svg
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"bradlc.vscode-tailwindcss",
"Prisma.prisma",
"orta.vscode-jest",
"ms-playwright.playwright"
"ms-playwright.playwright",
"sonarsource.sonarlint-vscode"
]
}
28 changes: 28 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"cSpell.ignorePaths": [
"pnpm-lock.json",
"node_modules",
"vscode-extension",
".git/{info,lfs,logs,refs,objects}/**",
".git/{index,*refs,*HEAD}",
".vscode",
".vscode-insiders"
],
"cSpell.words": [
"agentic",
"Aila",
"APIV",
"authed",
Expand All @@ -33,21 +43,27 @@
"COLOR",
"compat",
"contrib",
"corejs",
"cuid",
"dashify",
"datadoghq",
"datamodel",
"dialog",
"Dialogs",
"distractor",
"distractors",
"dmmf",
"Docgen",
"dockerized",
"dopplerhq",
"dotenv",
"Dsonar",
"EASS",
"Edtech",
"EHRC",
"estree",
"estruyf",
"evenodd",
"eyfs",
"firstname",
"fkey",
Expand All @@ -72,6 +88,7 @@
"initialisation",
"initialise",
"inngest",
"ipcountry",
"Jayne",
"jsonparse",
"jsonrepair",
Expand All @@ -90,8 +107,10 @@
"moderations",
"multilogical",
"NDJSON",
"Neue",
"nextjs",
"nocheck",
"Noto",
"Nullability",
"oakai",
"oaknational",
Expand Down Expand Up @@ -123,6 +142,7 @@
"psql",
"pusherapp",
"ratelimit",
"rect",
"refs",
"Regen",
"remeda",
Expand All @@ -131,11 +151,18 @@
"RSHE",
"rushstack",
"Sedar",
"Segoe",
"slidedeck",
"sonarcloud",
"sonarqube",
"sonarsource",
"sslcert",
"sslmode",
"SUBJ",
"superjson",
"svgs",
"svix",
"systemjs",
"tailwindcss",
"tanstack",
"testid",
Expand All @@ -144,6 +171,7 @@
"thenational",
"tiktoken",
"timeframe",
"transferrables",
"transpiles",
"trivago",
"trpc",
Expand Down
79 changes: 79 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,82 @@
# [1.19.0](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.18.2...v1.19.0) (2024-12-18)


### Bug Fixes

* sonar duplication ([#397](https://github.com/oaknational/oak-ai-lesson-assistant/issues/397)) ([dea3106](https://github.com/oaknational/oak-ai-lesson-assistant/commit/dea3106d249119169e515d7ccebc827f324bdbf3))


### Features

* soft delete ([#383](https://github.com/oaknational/oak-ai-lesson-assistant/issues/383)) ([9dee4ad](https://github.com/oaknational/oak-ai-lesson-assistant/commit/9dee4adb840a0a5d96e43f02349ad04597862539))

## [1.18.2](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.18.1...v1.18.2) (2024-12-17)

## [1.18.1](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.18.0...v1.18.1) (2024-12-16)


### Bug Fixes

* improve chances of showing 5 relevant plans ([#444](https://github.com/oaknational/oak-ai-lesson-assistant/issues/444)) ([4955a1e](https://github.com/oaknational/oak-ai-lesson-assistant/commit/4955a1e35fad9345de01ce9b831747059a95c579))
* posthog consistent event properties ([#440](https://github.com/oaknational/oak-ai-lesson-assistant/issues/440)) ([7c24485](https://github.com/oaknational/oak-ai-lesson-assistant/commit/7c24485f6604cc9a13a0a24058dd5f5a1b0f972e))
* remove key from chat provider ([#431](https://github.com/oaknational/oak-ai-lesson-assistant/issues/431)) ([35141b3](https://github.com/oaknational/oak-ai-lesson-assistant/commit/35141b3305ac7830feeb7269e8ee1f2611368c9a))
* temporarily disable no unsafe rules ([#429](https://github.com/oaknational/oak-ai-lesson-assistant/issues/429)) ([a8ada5d](https://github.com/oaknational/oak-ai-lesson-assistant/commit/a8ada5d008188ea3064476a431b041165fad6e81))

# [1.18.0](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.17.1...v1.18.0) (2024-12-11)


### Bug Fixes

* update eslint config and lint errors ([#422](https://github.com/oaknational/oak-ai-lesson-assistant/issues/422)) ([34774b5](https://github.com/oaknational/oak-ai-lesson-assistant/commit/34774b5b404c154d8c8aa10ae5b687507dc09c85))
* moderation persist scores [AI-696] ([#418](https://github.com/oaknational/oak-ai-lesson-assistant/issues/418)) ([7539661](https://github.com/oaknational/oak-ai-lesson-assistant/commit/7539661e22fa0e334138e0f796a700662e4e37e3))
* more flexible and efficient solution for images in docs ([#411](https://github.com/oaknational/oak-ai-lesson-assistant/issues/411)) ([abbff85](https://github.com/oaknational/oak-ai-lesson-assistant/commit/abbff8545476f6c045331a63290fc8f57cf3f54e))
* upgrade typescript + prettier + eslint with a single shared linting config ([#424](https://github.com/oaknational/oak-ai-lesson-assistant/issues/424)) ([1f4aa9d](https://github.com/oaknational/oak-ai-lesson-assistant/commit/1f4aa9dde84402df089ce4d6947472d389f576a0))


### Features

* report google drive storage quota ([#425](https://github.com/oaknational/oak-ai-lesson-assistant/issues/425)) ([a0cb485](https://github.com/oaknational/oak-ai-lesson-assistant/commit/a0cb4859ddb975d831a5b64d8d789ee8597aeda8))
* test coverage ([#406](https://github.com/oaknational/oak-ai-lesson-assistant/issues/406)) ([00767a0](https://github.com/oaknational/oak-ai-lesson-assistant/commit/00767a0148456f57f8fa21e0cb0149cf849f3574))

## [1.17.1](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.17.0...v1.17.1) (2024-12-03)


### Bug Fixes

* add linting command to db package ([#392](https://github.com/oaknational/oak-ai-lesson-assistant/issues/392)) ([d2177d5](https://github.com/oaknational/oak-ai-lesson-assistant/commit/d2177d5c061e973affd1ea52b0ef025c8c37cb29))
* address sonar major issues ([#393](https://github.com/oaknational/oak-ai-lesson-assistant/issues/393)) ([202a21f](https://github.com/oaknational/oak-ai-lesson-assistant/commit/202a21fbac0d457514c9944735b174c79dced08c))
* do not define components inline ([#413](https://github.com/oaknational/oak-ai-lesson-assistant/issues/413)) ([abda175](https://github.com/oaknational/oak-ai-lesson-assistant/commit/abda1753afecd9385b19b695767568abdd4383c1))
* do not use array index for key / use void for onSubmit ([#409](https://github.com/oaknational/oak-ai-lesson-assistant/issues/409)) ([44b5961](https://github.com/oaknational/oak-ai-lesson-assistant/commit/44b59617f3af8cad83110efdc2cb4df23d06e073))
* help page cloudflare email ([#399](https://github.com/oaknational/oak-ai-lesson-assistant/issues/399)) ([f6262f2](https://github.com/oaknational/oak-ai-lesson-assistant/commit/f6262f26d470a30ea721343bbab2cbfded77b91d))
* high and medium severity bugs on sonar cloud - AI-637 ([#379](https://github.com/oaknational/oak-ai-lesson-assistant/issues/379)) ([fb0258e](https://github.com/oaknational/oak-ai-lesson-assistant/commit/fb0258ec2f3c0d5fb79d884d3918827460cba404))
* icons in dialogs ([#398](https://github.com/oaknational/oak-ai-lesson-assistant/issues/398)) ([9700214](https://github.com/oaknational/oak-ai-lesson-assistant/commit/970021462a94b800dba270130f5ba1b1548e8745))
* intentionality of async / promise code for question generation ([#402](https://github.com/oaknational/oak-ai-lesson-assistant/issues/402)) ([65d1c5f](https://github.com/oaknational/oak-ai-lesson-assistant/commit/65d1c5f89c1b238e24315c02bde2e9eb253b4da3))
* memoize the sidebar context provider's value ([#408](https://github.com/oaknational/oak-ai-lesson-assistant/issues/408)) ([60ee010](https://github.com/oaknational/oak-ai-lesson-assistant/commit/60ee0102ea1ee733d6527c5460fd404cd7773292))
* minor sonar issues ([#390](https://github.com/oaknational/oak-ai-lesson-assistant/issues/390)) ([015cd25](https://github.com/oaknational/oak-ai-lesson-assistant/commit/015cd25984c3e5d1a545afef39fd111aa5245d58))
* prefer nullish coalescing ([#391](https://github.com/oaknational/oak-ai-lesson-assistant/issues/391)) ([b40def9](https://github.com/oaknational/oak-ai-lesson-assistant/commit/b40def9cfd3d69a0089db861a2f6ed47321a3753))
* readonly props for icons.tsx ([#389](https://github.com/oaknational/oak-ai-lesson-assistant/issues/389)) ([7b4d5bc](https://github.com/oaknational/oak-ai-lesson-assistant/commit/7b4d5bcc508b3179ea5313ec783aba90d1a7f3ae))
* revert tabindex change ([#404](https://github.com/oaknational/oak-ai-lesson-assistant/issues/404)) ([ac72713](https://github.com/oaknational/oak-ai-lesson-assistant/commit/ac72713dc54595f6bfacfd99e63899616f18b8ec))
* sonar maintain issues [#4](https://github.com/oaknational/oak-ai-lesson-assistant/issues/4) ([#405](https://github.com/oaknational/oak-ai-lesson-assistant/issues/405)) ([eca0019](https://github.com/oaknational/oak-ai-lesson-assistant/commit/eca001996a684f8d01465196c1c600d00e43a964))
* sonar maintain linting [#1](https://github.com/oaknational/oak-ai-lesson-assistant/issues/1) ([#394](https://github.com/oaknational/oak-ai-lesson-assistant/issues/394)) ([f4d95fc](https://github.com/oaknational/oak-ai-lesson-assistant/commit/f4d95fcbf39c3c43c3811f8c2022a37af363826a))
* sonar maintain linting [#2](https://github.com/oaknational/oak-ai-lesson-assistant/issues/2) ([#395](https://github.com/oaknational/oak-ai-lesson-assistant/issues/395)) ([1ed9d60](https://github.com/oaknational/oak-ai-lesson-assistant/commit/1ed9d6028713b096a68a0558d67608dc9efb812f))
* sonar maintain linting [#3](https://github.com/oaknational/oak-ai-lesson-assistant/issues/3) ([#403](https://github.com/oaknational/oak-ai-lesson-assistant/issues/403)) ([daa7efe](https://github.com/oaknational/oak-ai-lesson-assistant/commit/daa7efe6a2d5d2501f5108cd3c1ccaec86126655))
* sonar minors [#5](https://github.com/oaknational/oak-ai-lesson-assistant/issues/5) ([#414](https://github.com/oaknational/oak-ai-lesson-assistant/issues/414)) ([5f749f4](https://github.com/oaknational/oak-ai-lesson-assistant/commit/5f749f42f9f5d3d78c736438e313f4f5eff5406b))

# [1.17.0](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.16.2...v1.17.0) (2024-11-28)


### Bug Fixes

* assert readonly props ([#381](https://github.com/oaknational/oak-ai-lesson-assistant/issues/381)) ([cd88576](https://github.com/oaknational/oak-ai-lesson-assistant/commit/cd88576c5a337ad30f48783d74ea45d746a60956))
* help page cloudflare email ([#399](https://github.com/oaknational/oak-ai-lesson-assistant/issues/399)) ([391b67c](https://github.com/oaknational/oak-ai-lesson-assistant/commit/391b67c27a4048d4e422be22226d8d5aa1ac71bd))
* minor linting ([#384](https://github.com/oaknational/oak-ai-lesson-assistant/issues/384)) ([ec4ce6e](https://github.com/oaknational/oak-ai-lesson-assistant/commit/ec4ce6e5dcc7dbd4e242be65fd3b5f9708b94a40))
* svg clip-rule should be clipRule in JSX ([#382](https://github.com/oaknational/oak-ai-lesson-assistant/issues/382)) ([610d8c8](https://github.com/oaknational/oak-ai-lesson-assistant/commit/610d8c838273de24212a8531a8bc4b6136c05db1))


### Features

* move delete all button and restyle side menu ([#375](https://github.com/oaknational/oak-ai-lesson-assistant/issues/375)) ([69b2371](https://github.com/oaknational/oak-ai-lesson-assistant/commit/69b2371bf9ee7e7f783aa191ba6932dba0171837))

## [1.16.2](https://github.com/oaknational/oak-ai-lesson-assistant/compare/v1.16.1...v1.16.2) (2024-11-25)


Expand Down
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Oak AI Lesson Assistant is a project focused on experimenting with AI models and
- [End-to-end tests](#end-to-end-tests)
- [Playwright tags](#playwright-tags)
- [Testing in VSCode](#testing-in-vscode)
- [Standards](#standards)
- [Typescript](#typescript)
- [ES Modules](#esmodules)
- [CommonJS](#commonjs)
- [Code quality](#quality)
- [Sonar](#sonar)
- [ESLint](#eslint)
- [Prettier](#prettier)
- [Tsconfig]("#tsconfig)
- [Dependency cruiser](#dependency-cruiser)
- [Release process](#release-process)
- [PNPM / dependency problems](#pnpm--dependency-problems)
- [External contributions](#external-contributions)
Expand Down Expand Up @@ -176,6 +186,68 @@ Our Playwright tests are organised with tags:

Install the Jest and Playwright extensions recommended in the workspace config. Testing icons should appear in the gutter to the left of each test when viewing a test file. Clicking the icon will run the test. The testing tab in the VSCode nav bar provides an overview.

## Standards

### Typescript

By default, we develop in Typescript and aim to be up to date with the latest version. New code should default to being written in Typescript unless it is not possible.

### ES Modules

All packages are configured to be ES Modules.

### CommonJS

Currently NextJS, Tailwind and some other tools has some code which needs to be CommonJS. For these files, you should use the .cjs extension so that the correct linting rules are applied.

## Code quality

We use several tools to ensure code quality in the codebase and for checks during development. These checks run on each PR in Github to ensure we maintain good code quality. You can also run many of these checks locally before making a PR.

### Sonar

If you are using VS Code or Cursor, consider installing the SonarQube for IDE extension. This will give you feedback while you were as to any code quality or security issues that it has detected.

If you would like to run a Sonar scan locally, use the following command:

```shell
pnpm sonar
```

You will need to log in to Sonar when prompted the first time. This will generate a full report for you of your local development environment. Usually it is easier to make a PR and have this run for you automatically.

### ESLint

We have a single ESLint config for the whole monorepo. You will find it in packages/eslint-config.

This is using the latest version of ESLint and you should note that the config file format has changed to the "Flat file" config in version 9.

Each package does not have its own ESLint config by default. Instead we have a single config file, with regex path matchers to turn on/off rules that are specific for each package. This can be overridden and you can see an example of that in the logger package.

Each package specifies in its package.json file that it should use this shared config and there is a root ESLint config file for the whole mono repo which specifies that it should do the same.

To check for linting errors, run the following command:

```shell
pnpm lint
```

If you want to check for linting errors in an individual package, cd into that package and run the same command.

### Prettier

We also have a single Prettier config, which is located in packages/prettier-config. In general there should be no need to change this on a per-package basis.

### Tsconfig

We have an overall tsconfig.json file which specifies the overall Typescript configuration for the project. Then each package extends from it.

You can check the codebase for any Typescript issues by running the following command:

```shell
pnpm type-check
```

## Release process

The current release process is fully documented [in Notion](https://www.notion.so/oaknationalacademy/Branch-Strategy-and-Release-Process-ceeb32937af0426ba495565288e18844?pvs=4), but broadly works as follows:
Expand Down
Loading

0 comments on commit a9f6fb3

Please sign in to comment.