From 68f7eabe2c4c0c28aa3b12cc0fd228f282d6eb7b Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Thu, 9 Oct 2025 11:28:28 -0700 Subject: [PATCH] feat: initial prototype --- .gitea/workflows/ci.yml | 38 + .gitea/workflows/sonar.yml | 34 + .gitignore | 3 + .vscode/settings.json | 6 + README.md | 18 +- eslint.config.js | 5 + package.json | 32 + pnpm-lock.yaml | 5233 +++++++++++++++++++++++++++++ prod.env | 3 + src/commands/clear.ts | 24 + src/commands/dm.ts | 26 + src/config/personality.ts | 15 + src/events/handleDmMessage.ts | 93 + src/events/handleGuildMessage.ts | 76 + src/events/handleThreadMessage.ts | 86 + src/events/onMessage.ts | 38 + src/index.ts | 78 + src/modules/clear.ts | 47 + src/modules/dm.ts | 39 + src/server/serve.ts | 79 + src/utils/ai.ts | 15 + src/utils/calculateCost.ts | 30 + src/utils/isNaomi.ts | 80 + src/utils/logger.ts | 12 + src/utils/replyToError.ts | 39 + tsconfig.json | 8 + vitest.config.ts | 15 + 27 files changed, 6158 insertions(+), 14 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/sonar.yml create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 eslint.config.js create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 prod.env create mode 100644 src/commands/clear.ts create mode 100644 src/commands/dm.ts create mode 100644 src/config/personality.ts create mode 100644 src/events/handleDmMessage.ts create mode 100644 src/events/handleGuildMessage.ts create mode 100644 src/events/handleThreadMessage.ts create mode 100644 src/events/onMessage.ts create mode 100644 src/index.ts create mode 100644 src/modules/clear.ts create mode 100644 src/modules/dm.ts create mode 100644 src/server/serve.ts create mode 100644 src/utils/ai.ts create mode 100644 src/utils/calculateCost.ts create mode 100644 src/utils/isNaomi.ts create mode 100644 src/utils/logger.ts create mode 100644 src/utils/replyToError.ts create mode 100644 tsconfig.json create mode 100644 vitest.config.ts diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..7cdce8d --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,38 @@ +name: Node.js CI +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + name: Lint and Test + + steps: + - name: Checkout Source Files + uses: actions/checkout@v4 + + - name: Use Node.js v22 + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 10 + + - name: Install Dependencies + run: pnpm install + + - name: Lint Source Files + run: pnpm run lint + + - name: Verify Build + run: pnpm run build + + - name: Run Tests + run: pnpm run test diff --git a/.gitea/workflows/sonar.yml b/.gitea/workflows/sonar.yml new file mode 100644 index 0000000..09ed5cf --- /dev/null +++ b/.gitea/workflows/sonar.yml @@ -0,0 +1,34 @@ +name: Code Analysis +on: + push: + branches: + - main + +jobs: + sonar: + name: SonarQube + + steps: + - name: Checkout Source Files + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: SonarCube Scan + uses: SonarSource/sonarqube-scan-action@v4 + timeout-minutes: 10 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: "https://quality.nhcarrigan.com" + with: + args: > + -Dsonar.sources=. + -Dsonar.projectKey=maylin-taryne + + - name: SonarQube Quality Gate check + uses: sonarsource/sonarqube-quality-gate-action@v1 + with: + pollingTimeoutSec: 600 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: "https://quality.nhcarrigan.com" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6240af --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +prod +coverage \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2beb504 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "eslint.validate": ["typescript"] +} diff --git a/README.md b/README.md index 47a840e..70972fc 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,14 @@ -# New Repository Template +# Maylin Taryne -This template contains all of our basic files for a new GitHub repository. There is also a handy workflow that will create an issue on a new repository made from this template, with a checklist for the steps we usually take in setting up a new repository. - -If you're starting a Node.JS project with TypeScript, we have a [specific template](https://github.com/naomi-lgbt/nodejs-typescript-template) for that purpose. - -## Readme - -Delete all of the above text (including this line), and uncomment the below text to use our standard readme template. - -