🎨 Add git format hook

This commit is contained in:
adam.watkins
2023-04-08 17:30:23 +03:00
parent 0ccc3fbead
commit cb74dbf533
5 changed files with 1213 additions and 8 deletions

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

1192
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,8 @@
"dev": "next dev", "dev": "next dev",
"postinstall": "prisma generate", "postinstall": "prisma generate",
"lint": "next lint", "lint": "next lint",
"start": "next start" "start": "next start",
"prepare": "husky install"
}, },
"dependencies": { "dependencies": {
"@formkit/auto-animate": "^1.0.0-beta.6", "@formkit/auto-animate": "^1.0.0-beta.6",
@@ -42,6 +43,8 @@
"autoprefixer": "^10.4.7", "autoprefixer": "^10.4.7",
"eslint": "^8.30.0", "eslint": "^8.30.0",
"eslint-config-next": "13.1.6", "eslint-config-next": "13.1.6",
"husky": "^8.0.3",
"lint-staged": "^13.2.1",
"postcss": "^8.4.14", "postcss": "^8.4.14",
"prettier": "^2.8.1", "prettier": "^2.8.1",
"prettier-plugin-tailwindcss": "^0.2.1", "prettier-plugin-tailwindcss": "^0.2.1",
@@ -51,5 +54,9 @@
}, },
"ct3aMetadata": { "ct3aMetadata": {
"initVersion": "7.4.0" "initVersion": "7.4.0"
},
"lint-staged": {
"*.js": "eslint --cache --fix",
"*.{js,css,md}": "prettier --write"
} }
} }

View File

@@ -1,4 +1,4 @@
import type { NextApiRequest, NextApiResponse } from 'next' import type { NextApiRequest, NextApiResponse } from "next";
import { startGoalAgent } from "../../utils/chain"; import { startGoalAgent } from "../../utils/chain";
export interface ChainAPIRequest extends NextApiRequest { export interface ChainAPIRequest extends NextApiRequest {
@@ -8,13 +8,14 @@ export interface ChainAPIRequest extends NextApiRequest {
} }
export interface ChainAPIResponse extends NextApiResponse { export interface ChainAPIResponse extends NextApiResponse {
body: { body: { tasks: string[] };
tasks: string[]
};
} }
export default async function handler(req: ChainAPIRequest, res: ChainAPIResponse) { export default async function handler(
req: ChainAPIRequest,
res: ChainAPIResponse
) {
const completion = await startGoalAgent(req.body.prompt); const completion = await startGoalAgent(req.body.prompt);
console.log(completion.text); console.log(completion.text);
res.status(200).json({ tasks: completion.text as string[] }) res.status(200).json({ tasks: completion.text as string[] });
} }