-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6326e66
Showing
48 changed files
with
2,377 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# Build | ||
node_modules/ | ||
dist/ | ||
coverage | ||
|
||
# Environment Files | ||
.env | ||
|
||
# Configuration Files | ||
Dockerfile | ||
.dockerignore | ||
.git | ||
.gitignore | ||
|
||
# Logs | ||
npm-debug.log | ||
|
||
# Documentation | ||
README.md | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
PORT=3001 | ||
LOGGER_LEVEL=debug | ||
|
||
# Chasm | ||
# Orchestrator URL | ||
ORCHESTRATOR_URL= | ||
SCOUT_NAME= | ||
# Scout UID | ||
SCOUT_UID= | ||
# Scout API Key | ||
WEBHOOK_API_KEY= | ||
# Scout Webhook Url, update based on your server's IP and Port, e.g. http://123.123.123.123:3001/ | ||
WEBHOOK_URL= | ||
|
||
# Chosen Provider (groq, openrouter) | ||
# Seperated by comma (,) | ||
# The scout will prioritize the first provider and fallback to the next one | ||
PROVIDERS=groq,openrouter | ||
MODEL=gemma-7b-it | ||
|
||
# Provider | ||
GROQ_API_KEY= | ||
|
||
# Optional | ||
OPENAI_API_KEY= | ||
OPENROUTER_API_KEY= | ||
|
||
#local or production | ||
NODE_ENV=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# IDE | ||
.idea/ | ||
.vscode/ | ||
|
||
# Dependencies | ||
node_modules/ | ||
dist/ | ||
coverage | ||
package.json | ||
|
||
# Docker Configs | ||
docker-compose.yml | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Environment Files | ||
.env | ||
|
||
# Configuration Files | ||
tsconfig.json | ||
.eslintrc.json | ||
.prettierrc.json | ||
.lintstagedrc.json | ||
|
||
# GitHub Actions | ||
.github/ | ||
|
||
# Logs | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"unused-imports" | ||
], | ||
"rules": { | ||
"prefer-const": "warn", | ||
"no-self-assign": "warn", | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-var-requires": "warn", | ||
"@typescript-eslint/no-unused-vars": "off", //"no-unused-vars": "off", | ||
"unused-imports/no-unused-imports": "warn", | ||
"unused-imports/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"vars": "all", | ||
"varsIgnorePattern": "^_", | ||
"args": "after-used", | ||
"argsIgnorePattern": "^_" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
name: Pre-merge Checks | ||
|
||
on: | ||
pull_request: | ||
branches: [ main, master ] | ||
|
||
jobs: | ||
checkout-install: | ||
name: Checkout and Install Dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Cache Bun packages | ||
id: cache-bun | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.bun/bun | ||
~/.bun/install | ||
~/.bun/bin | ||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
restore-keys: | | ||
${{ runner.os }}-bun- | ||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Upload Bun cache | ||
if: steps.cache-bun.outputs.cache-hit != 'true' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.bun/bun | ||
~/.bun/install | ||
~/.bun/bin | ||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
||
formatting-linting: | ||
name: Formatting and Linting Checks | ||
runs-on: ubuntu-latest | ||
needs: checkout-install | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Bun cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.bun/bun | ||
~/.bun/install | ||
~/.bun/bin | ||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run formatting checks | ||
run: bun run prettier | ||
|
||
- name: Run linting checks | ||
run: bun run lint | ||
|
||
jest-tests: | ||
name: Jest Tests | ||
runs-on: ubuntu-latest | ||
needs: checkout-install | ||
environment: CI | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Bun cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.bun/bun | ||
~/.bun/install | ||
~/.bun/bin | ||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run Jest unit & integration tests | ||
env: | ||
OPENAI_API_KEY: ${{ vars.OPENAI_API_KEY }} | ||
GROQ_API_KEY: ${{ vars.GROQ_API_KEY }} | ||
OPENROUTER_API_KEY: ${{ vars.OPENROUTER_API_KEY }} | ||
run: bun run test --verbose | ||
|
||
type-check: | ||
name: Type Checks | ||
runs-on: ubuntu-latest | ||
needs: [formatting-linting, jest-tests] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Bun cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.bun/bun | ||
~/.bun/install | ||
~/.bun/bin | ||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run type checks | ||
run: bun run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# IDE | ||
.idea | ||
.vscode | ||
|
||
# Build | ||
node_modules/ | ||
dist/ | ||
coverage | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Environment Files | ||
.env | ||
.env.prod | ||
.env.test | ||
.env.test | ||
|
||
# Logs | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bunx lint-staged | ||
bun run build | ||
# bun run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"*.ts": [ | ||
"bun run prettier:fix", | ||
"bun run lint" | ||
], | ||
"*.md": [ | ||
"bun run prettier:fix" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# IDE | ||
.idea/ | ||
.vscode/ | ||
|
||
# Dependencies | ||
node_modules/ | ||
dist/ | ||
coverage | ||
package.json | ||
|
||
# Docker Configs | ||
docker-compose.yml | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Environment Files | ||
.env | ||
|
||
# Configuration Files | ||
tsconfig.json | ||
.eslintrc.json | ||
.prettierrc.json | ||
.lintstagedrc.json | ||
|
||
# GitHub Actions | ||
.github/ | ||
|
||
# Logs | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"quoteProps": "consistent", | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"proseWrap": "preserve", | ||
"importOrder": [ | ||
"^dotenv(.*)$", | ||
"<THIRD_PARTY_MODULES>", | ||
"", | ||
"^[./]" | ||
], | ||
"importOrderParserPlugins": [ | ||
"typescript", | ||
"jsx", | ||
"decorators-legacy" | ||
], | ||
"importOrderTypeScriptVersion": "5.0.0", | ||
"plugins": [ | ||
"@ianvs/prettier-plugin-sort-imports" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM oven/bun:alpine AS builder | ||
|
||
ENV PATH="/root/.bun/bin:${PATH}" | ||
WORKDIR /usr/src/app | ||
COPY package.json tsconfig.json bun.lockb* ./ | ||
RUN bun install | ||
COPY src ./src | ||
RUN bun run build | ||
|
||
|
||
FROM oven/bun:alpine | ||
|
||
ENV PATH="/root/.bun/bin:${PATH}" | ||
WORKDIR /usr/src/app | ||
COPY --from=builder /usr/src/app/dist ./dist | ||
COPY --from=builder /usr/src/app/package.json ./package.json | ||
RUN bun install --production --ignore-scripts | ||
EXPOSE 3001 | ||
|
||
RUN addgroup -S scout && adduser -S appuser -G scout | ||
RUN chown -R appuser:scout /usr/src/app/ | ||
USER appuser | ||
|
||
CMD ["bun", "run", "dist/src/server/express.js"] |
Oops, something went wrong.