Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

ci: Add lint + CI pipeline for the server package (#201)

Pallavi Kumari4c2a8e331bca
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a6671bcd1..7e72474dd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,3 +28,19 @@ jobs:
run: yarn typecheck
- name: Vitest tests
run: yarn test
+ server:
+ name: server — lint & format
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: server
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: npm
+ cache-dependency-path: server/package-lock.json
+ - run: npm ci
+ - run: npm run lint
+ - run: npm run format:check
diff --git a/server/.prettierignore b/server/.prettierignore
new file mode 100644
index 000000000..9ac0aedf3
--- /dev/null
+++ b/server/.prettierignore
@@ -0,0 +1,2 @@
+node_modules/
+src/public/
diff --git a/server/.prettierrc.json b/server/.prettierrc.json
new file mode 100644
index 000000000..2c1db6c3f
--- /dev/null
+++ b/server/.prettierrc.json
@@ -0,0 +1,7 @@
+{
+ "singleQuote": true,
+ "printWidth": 100,
+ "trailingComma": "all",
+ "semi": true,
+ "tabWidth": 2
+}
diff --git a/server/eslint.config.mjs b/server/eslint.config.mjs
new file mode 100644
index 000000000..6d53f69f9
--- /dev/null
+++ b/server/eslint.config.mjs
@@ -0,0 +1,39 @@
+import { defineConfig, globalIgnores } from "eslint/config";
+import js from "@eslint/js";
+import prettier from "eslint-config-prettier";
+
+const eslintConfig = defineConfig([
+ js.configs.recommended,
+ {
+ languageOptions: {
+ ecmaVersion: "latest",
+ sourceType: "module",
+ globals: {
+ console: "readonly",
+ process: "readonly",
+ __dirname: "readonly",
+ __filename: "readonly",
+ module: "readonly",
+ require: "readonly",
+ exports: "readonly",
+ setTimeout: "readonly",
+ clearTimeout: "readonly",
+ setInterval: "readonly",
+ clearInterval: "readonly",
+ Buffer: "readonly",
+ URL: "readonly",
+ URLSearchParams: "readonly",
+ AbortController: "readonly",
+ AbortSignal: "readonly",
+ fetch: "readonly",
+ },
+ },
+ rules: {
+ "no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
+ },
+ },
+ prettier,
+ globalIgnores(["node_modules/**", "dist/**", "src/public/**"]),
+]);
+
+export default eslintConfig;
diff --git a/server/package-lock.json b/server/package-lock.json
index 765b4d93e..54b791745 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@ansvisor/ansvisor-server",
- "version": "0.1.0",
+ "version": "0.1.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@ansvisor/ansvisor-server",
- "version": "0.1.0",
+ "version": "0.1.2",
"license": "MIT",
"dependencies": {
"@ai-sdk/anthropic": "^3.0.58",
@@ -29,7 +29,11 @@
"zod": "^4.3.6"
},
"devDependencies": {
- "nodemon": "^3.0.2"
+ "@eslint/js": "^9.27.0",
+ "eslint": "^9.27.0",
+ "eslint-config-prettier": "^10.1.8",
+ "nodemon": "^3.0.2",
+ "prettier": "^3.8.3"
}
},
"node_modules/@ai-sdk/anthropic": {
@@ -155,6 +159,328 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@eslint-community/eslint-utils": {
+ "version": "4.9.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
+ "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^3.4.3"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
+ }
+ },
+ "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint-community/regexpp": {
+ "version": "4.12.2",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",
+ "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@eslint/config-array": {
+ "version": "0.21.2",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz",
+ "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/object-schema": "^2.1.7",
+ "debug": "^4.3.1",
+ "minimatch": "^3.1.5"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/config-array/node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@eslint/config-array/node_modules/brace-expansion": {
+ "version": "1.1.15",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
+ "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/@eslint/config-array/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@eslint/config-array/node_modules/minimatch": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/@eslint/config-array/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@eslint/config-helpers": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
+ "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^0.17.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/core": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
+ "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@types/json-schema": "^7.0.15"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/eslintrc": {
+ "version": "3.3.5",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz",
+ "integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^6.14.0",
+ "debug": "^4.3.2",
+ "espree": "^10.0.1",
+ "globals": "^14.0.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.1",
+ "minimatch": "^3.1.5",
+ "strip-json-comments": "^3.1.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@eslint/eslintrc/node_modules/brace-expansion": {
+ "version": "1.1.15",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
+ "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/minimatch": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@eslint/js": {
+ "version": "9.39.4",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz",
+ "integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ }
+ },
+ "node_modules/@eslint/object-schema": {
+ "version": "2.1.7",
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",
+ "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/plugin-kit": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
+ "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^0.17.0",
+ "levn": "^0.4.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@humanfs/core": {
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
+ "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/types": "^0.15.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/node": {
+ "version": "0.16.8",
+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",
+ "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/core": "^0.19.2",
+ "@humanfs/types": "^0.15.0",
+ "@humanwhocodes/retry": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/types": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",
+ "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@humanwhocodes/retry": {
+ "version": "0.4.3",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",
+ "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
"node_modules/@opentelemetry/api": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
@@ -566,6 +892,20 @@
"@types/node": "*"
}
},
+ "node_modules/@types/estree": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/node": {
"version": "25.4.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.4.0.tgz",
@@ -612,6 +952,29 @@
"node": ">= 0.6"
}
},
+ "node_modules/acorn": {
+ "version": "8.16.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
+ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
"node_modules/agent-base": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
@@ -639,6 +1002,23 @@
"zod": "^3.25.76 || ^4.1.8"
}
},
+ "node_modules/ajv": {
+ "version": "6.15.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
+ "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
"node_modules/amp": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/amp/-/amp-0.3.1.tgz",
@@ -872,6 +1252,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/chalk": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
@@ -971,6 +1361,13 @@
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"license": "MIT"
},
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
@@ -1030,6 +1427,21 @@
"integrity": "sha512-/f6gpQuxDaqXu+1kwQYSckUglPaOrHdbIlBAu0YuW8/Cdb45XwXYNUBXg3r/9Mo6n540Kn/smKcZWko5x99KrQ==",
"license": "MIT"
},
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
"node_modules/culvert": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/culvert/-/culvert-0.1.2.tgz",
@@ -1060,6 +1472,13 @@
"ms": "2.0.0"
}
},
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/degenerator": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz",
@@ -1289,6 +1708,239 @@
"source-map": "~0.6.1"
}
},
+ "node_modules/eslint": {
+ "version": "9.39.4",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz",
+ "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.8.0",
+ "@eslint-community/regexpp": "^4.12.1",
+ "@eslint/config-array": "^0.21.2",
+ "@eslint/config-helpers": "^0.4.2",
+ "@eslint/core": "^0.17.0",
+ "@eslint/eslintrc": "^3.3.5",
+ "@eslint/js": "9.39.4",
+ "@eslint/plugin-kit": "^0.4.1",
+ "@humanfs/node": "^0.16.6",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@humanwhocodes/retry": "^0.4.2",
+ "@types/estree": "^1.0.6",
+ "ajv": "^6.14.0",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.6",
+ "debug": "^4.3.2",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^8.4.0",
+ "eslint-visitor-keys": "^4.2.1",
+ "espree": "^10.4.0",
+ "esquery": "^1.5.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^8.0.0",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
+ "ignore": "^5.2.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.1.5",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.3"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ },
+ "peerDependencies": {
+ "jiti": "*"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint-config-prettier": {
+ "version": "10.1.8",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz",
+ "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "eslint-config-prettier": "bin/cli.js"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint-config-prettier"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.0.0"
+ }
+ },
+ "node_modules/eslint-scope": {
+ "version": "8.4.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
+ "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint-visitor-keys": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint/node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/eslint/node_modules/brace-expansion": {
+ "version": "1.1.15",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
+ "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/eslint/node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/eslint/node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint/node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/eslint/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/eslint/node_modules/minimatch": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/eslint/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/eslint/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/espree": {
+ "version": "10.4.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
+ "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.15.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^4.2.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
"node_modules/esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
@@ -1302,6 +1954,32 @@
"node": ">=4"
}
},
+ "node_modules/esquery": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",
+ "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "estraverse": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
"node_modules/estraverse": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
@@ -1414,18 +2092,52 @@
"follow-redirects": "^1.14.0"
}
},
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/fast-json-patch": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz",
"integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==",
"license": "MIT"
},
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/fclone": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz",
"integrity": "sha512-GDqVQezKzRABdeqflsgMr7ktzgF9CyS+p2oe0jJqUY6izSSbhPIQJDpoU4PtGcD7VPM9xh/dVrTu6z1nwgmEGw==",
"license": "MIT"
},
+ "node_modules/file-entry-cache": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
+ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flat-cache": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
@@ -1456,6 +2168,44 @@
"node": ">= 0.8"
}
},
+ "node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/flat-cache": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
+ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.4"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
+ "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
@@ -1615,6 +2365,19 @@
"node": ">= 6"
}
},
+ "node_modules/globals": {
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
@@ -1783,6 +2546,16 @@
"node": ">=0.10.0"
}
},
+ "node_modules/ignore": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
"node_modules/ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
@@ -1790,6 +2563,33 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/import-fresh": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.8.19"
+ }
+ },
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@@ -1877,6 +2677,13 @@
"node": ">=0.12.0"
}
},
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/js-git": {
"version": "0.7.8",
"resolved": "https://registry.npmjs.org/js-git/-/js-git-0.7.8.tgz",
@@ -1901,6 +2708,13 @@
"js-yaml": "bin/js-yaml.js"
}
},
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/json-schema": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
@@ -1920,6 +2734,20 @@
"node": ">=16"
}
},
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@@ -1927,6 +2755,16 @@
"license": "ISC",
"optional": true
},
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "json-buffer": "3.0.1"
+ }
+ },
"node_modules/lazy": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/lazy/-/lazy-1.0.11.tgz",
@@ -1936,12 +2774,49 @@
"node": ">=0.2.0"
}
},
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/lodash": {
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==",
"license": "MIT"
},
+ "node_modules/lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
@@ -2066,6 +2941,13 @@
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
"license": "ISC"
},
+ "node_modules/natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/needle": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz",
@@ -2261,6 +3143,56 @@
}
}
},
+ "node_modules/optionator": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.5"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/pac-proxy-agent": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz",
@@ -2322,6 +3254,19 @@
"integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==",
"license": "MIT"
},
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -2331,6 +3276,26 @@
"node": ">= 0.8"
}
},
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/path-parse": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
@@ -2586,6 +3551,32 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/prettier": {
+ "version": "3.8.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
+ "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
"node_modules/promptly": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/promptly/-/promptly-2.2.0.tgz",
@@ -2663,6 +3654,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/qs": {
"version": "6.14.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",
@@ -2783,6 +3784,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/run-series": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz",
@@ -2901,6 +3912,29 @@
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
"license": "ISC"
},
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/shimmer": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz",
@@ -3224,6 +4258,19 @@
"node": ">= 0.8"
}
},
+ "node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
@@ -3347,6 +4394,19 @@
"json-stringify-safe": "^5.0.1"
}
},
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@@ -3382,6 +4442,16 @@
"node": ">= 0.8"
}
},
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
@@ -3437,6 +4507,32 @@
"lodash": "^4.17.14"
}
},
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/ws": {
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
@@ -3464,6 +4560,19 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
},
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/zod": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",
diff --git a/server/package.json b/server/package.json
index 98345193c..13279365a 100644
--- a/server/package.json
+++ b/server/package.json
@@ -12,7 +12,10 @@
"homepage": "https://github.com/ansvisor/ansvisor",
"scripts": {
"dev": "NODE_ENV=development nodemon src/server.js",
- "start": "NODE_ENV=production pm2 start src/server.js --max-restarts 10000"
+ "start": "NODE_ENV=production pm2 start src/server.js --max-restarts 10000",
+ "lint": "eslint .",
+ "format": "prettier --write \"src/**/*.js\" --ignore-path .prettierignore",
+ "format:check": "prettier --check \"src/**/*.js\" --ignore-path .prettierignore"
},
"keywords": [],
"author": "Empler AI Inc.",
@@ -38,6 +41,10 @@
"zod": "^4.3.6"
},
"devDependencies": {
- "nodemon": "^3.0.2"
+ "@eslint/js": "^9.27.0",
+ "eslint": "^9.27.0",
+ "eslint-config-prettier": "^10.1.8",
+ "nodemon": "^3.0.2",
+ "prettier": "^3.8.3"
}
}
diff --git a/server/src/config/supabase.js b/server/src/config/supabase.js
index e74cfa1d9..2641e2a49 100644
--- a/server/src/config/supabase.js
+++ b/server/src/config/supabase.js
@@ -6,9 +6,7 @@ const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
const supabaseAnonKey = process.env.SUPABASE_ANON_KEY;
if (!supabaseUrl || !supabaseServiceRoleKey) {
- console.error(
- 'Missing SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY environment variables'
- );
+ console.error('Missing SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY environment variables');
process.exit(1);
}
diff --git a/server/src/lib/ai-provider.js b/server/src/lib/ai-provider.js
index e9ad3dbfd..918d3669d 100644
--- a/server/src/lib/ai-provider.js
+++ b/server/src/lib/ai-provider.js
@@ -40,8 +40,7 @@ if (process.env.GOOGLE_GENERATIVE_AI_API_KEY) {
* @returns AI SDK model instance
*/
export function resolveModel(modelString, options) {
- const defaultModel =
- process.env.DEFAULT_SUGGESTION_MODEL || 'openai/gpt-5-mini';
+ const defaultModel = process.env.DEFAULT_SUGGESTION_MODEL || 'openai/gpt-5-mini';
const target = modelString || defaultModel;
const [providerName, ...modelParts] = target.split('/');
diff --git a/server/src/lib/cloro-scraper.js b/server/src/lib/cloro-scraper.js
index 73d59bfbd..b4f4d0016 100644
--- a/server/src/lib/cloro-scraper.js
+++ b/server/src/lib/cloro-scraper.js
@@ -202,9 +202,7 @@ export async function submitScraperTask(promptText, scraperId, region, opts = {}
console.error(
`[cloro] Submit failed ${res.status} for ${scraperId}: ${errorBody.slice(0, 300)}`,
);
- throw new Error(
- `Cloro async submit error ${res.status}: ${errorBody.slice(0, 300)}`,
- );
+ throw new Error(`Cloro async submit error ${res.status}: ${errorBody.slice(0, 300)}`);
}
const data = await res.json();
@@ -214,14 +212,10 @@ export async function submitScraperTask(promptText, scraperId, region, opts = {}
`[cloro] Submit returned no task ID for ${scraperId}:`,
JSON.stringify(data).slice(0, 300),
);
- throw new Error(
- `Cloro async submit failed: ${data.error || 'No task ID returned'}`,
- );
+ throw new Error(`Cloro async submit failed: ${data.error || 'No task ID returned'}`);
}
- console.log(
- `[cloro] Task submitted: id=${data.task.id} type=${taskType} scraper=${scraperId}`,
- );
+ console.log(`[cloro] Task submitted: id=${data.task.id} type=${taskType} scraper=${scraperId}`);
return { taskId: data.task.id, scraperId };
}
@@ -246,56 +240,38 @@ export async function pollScraperResult(taskId, scraperId, opts = {}) {
if (!res.ok) {
if (res.status === 404) {
- console.error(
- `[cloro] Poll #${pollCount} task=${taskId}: 404 not found`,
- );
+ console.error(`[cloro] Poll #${pollCount} task=${taskId}: 404 not found`);
throw new Error(`Cloro task ${taskId} not found`);
}
const errorBody = await res.text().catch(() => '');
- console.error(
- `[cloro] Poll #${pollCount} task=${taskId}: HTTP ${res.status}`,
- );
- throw new Error(
- `Cloro poll error ${res.status}: ${errorBody.slice(0, 300)}`,
- );
+ console.error(`[cloro] Poll #${pollCount} task=${taskId}: HTTP ${res.status}`);
+ throw new Error(`Cloro poll error ${res.status}: ${errorBody.slice(0, 300)}`);
}
const data = await res.json();
const status = data.task?.status;
if (status === 'COMPLETED') {
- console.log(
- `[cloro] Task ${taskId} COMPLETED after ${pollCount} polls (${scraperId})`,
- );
+ console.log(`[cloro] Task ${taskId} COMPLETED after ${pollCount} polls (${scraperId})`);
const result = data.response;
- if (!result)
- throw new Error(
- `Cloro task ${taskId} completed but returned no response`,
- );
+ if (!result) throw new Error(`Cloro task ${taskId} completed but returned no response`);
return parseScraperResponse(result, scraperId);
}
if (status === 'FAILED') {
- const errMsg =
- data.response?.error || data.task?.failedReason || 'Unknown failure';
- console.error(
- `[cloro] Task ${taskId} FAILED after ${pollCount} polls: ${errMsg}`,
- );
+ const errMsg = data.response?.error || data.task?.failedReason || 'Unknown failure';
+ console.error(`[cloro] Task ${taskId} FAILED after ${pollCount} polls: ${errMsg}`);
throw new Error(`Cloro task ${taskId} failed: ${errMsg}`);
}
if (pollCount === 1 || pollCount % 5 === 0) {
- console.log(
- `[cloro] Task ${taskId} status=${status} poll #${pollCount} (${scraperId})`,
- );
+ console.log(`[cloro] Task ${taskId} status=${status} poll #${pollCount} (${scraperId})`);
}
await new Promise((r) => setTimeout(r, interval));
}
- console.error(
- `[cloro] Task ${taskId} TIMED OUT after ${pollCount} polls / ${maxWait / 1000}s`,
- );
+ console.error(`[cloro] Task ${taskId} TIMED OUT after ${pollCount} polls / ${maxWait / 1000}s`);
throw new Error(`Cloro task ${taskId} timed out after ${maxWait / 1000}s`);
}
diff --git a/server/src/lib/dataforseo.js b/server/src/lib/dataforseo.js
index e438ebda6..0a5cae73c 100644
--- a/server/src/lib/dataforseo.js
+++ b/server/src/lib/dataforseo.js
@@ -40,24 +40,18 @@ export async function getSearchVolumes(keywords, options = {}) {
});
if (!response.ok) {
- throw new Error(
- `DataForSEO API error (${response.status}): ${response.statusText}`,
- );
+ throw new Error(`DataForSEO API error (${response.status}): ${response.statusText}`);
}
const data = await response.json();
if (data.status_code !== 20000) {
- throw new Error(
- `DataForSEO error: ${data.status_message || 'Unknown error'}`,
- );
+ throw new Error(`DataForSEO error: ${data.status_message || 'Unknown error'}`);
}
const task = data.tasks?.[0];
if (!task || task.status_code !== 20000) {
- throw new Error(
- `DataForSEO task error: ${task?.status_message || 'No task returned'}`,
- );
+ throw new Error(`DataForSEO task error: ${task?.status_message || 'No task returned'}`);
}
const volumes = {};
diff --git a/server/src/lib/job-manager.js b/server/src/lib/job-manager.js
index 6bb6299aa..92b5ddf7f 100644
--- a/server/src/lib/job-manager.js
+++ b/server/src/lib/job-manager.js
@@ -175,10 +175,7 @@ export async function cleanupStaleJobs() {
*/
export async function cleanupOldJobs() {
const cutoff = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
- const { error } = await supabaseAdmin
- .from('jobs')
- .delete()
- .lt('created_at', cutoff);
+ const { error } = await supabaseAdmin.from('jobs').delete().lt('created_at', cutoff);
if (error) {
console.error('[job-manager] Failed to cleanup old jobs:', error.message);
diff --git a/server/src/lib/job-runner.js b/server/src/lib/job-runner.js
index b60d1dd04..a8746f871 100644
--- a/server/src/lib/job-runner.js
+++ b/server/src/lib/job-runner.js
@@ -79,7 +79,9 @@ export async function runTrackingJob(jobId, io) {
const latest = await getJob(jobId);
if (latest && latest.attempts < latest.max_attempts) {
const delay = latest.attempts * 30_000; // exponential-ish backoff
- console.log(`[job-runner] Retrying tracking job ${jobId} in ${delay / 1000}s (attempt ${latest.attempts}/${latest.max_attempts})`);
+ console.log(
+ `[job-runner] Retrying tracking job ${jobId} in ${delay / 1000}s (attempt ${latest.attempts}/${latest.max_attempts})`,
+ );
await failJob(jobId, err.message);
// Reset to waiting for retry
@@ -142,7 +144,9 @@ export async function runContentJob(jobId, io) {
const latest = await getJob(jobId);
if (latest && latest.attempts < latest.max_attempts) {
const delay = latest.attempts * 15_000;
- console.log(`[job-runner] Retrying content job ${jobId} in ${delay / 1000}s (attempt ${latest.attempts}/${latest.max_attempts})`);
+ console.log(
+ `[job-runner] Retrying content job ${jobId} in ${delay / 1000}s (attempt ${latest.attempts}/${latest.max_attempts})`,
+ );
await failJob(jobId, err.message);
const supabaseAdmin = (await import('../config/supabase.js')).default;
diff --git a/server/src/lib/openai-tracker.js b/server/src/lib/openai-tracker.js
index c0549b4ff..5d19fde84 100644
--- a/server/src/lib/openai-tracker.js
+++ b/server/src/lib/openai-tracker.js
@@ -96,22 +96,15 @@ export async function analyzeSentimentAI(responseText, brandName) {
const raw = (response.output_text || '').trim();
const json = JSON.parse(raw);
- const sentiment = ['positive', 'neutral', 'negative'].includes(
- json.sentiment,
- )
+ const sentiment = ['positive', 'neutral', 'negative'].includes(json.sentiment)
? json.sentiment
: 'neutral';
const confidence =
- typeof json.confidence === 'number'
- ? Math.max(0, Math.min(1, json.confidence))
- : 0.5;
+ typeof json.confidence === 'number' ? Math.max(0, Math.min(1, json.confidence)) : 0.5;
return { sentiment, confidence, reason: json.reason || '' };
} catch (err) {
- console.error(
- '[sentiment-ai] Failed, falling back to neutral:',
- err.message,
- );
+ console.error('[sentiment-ai] Failed, falling back to neutral:', err.message);
return { sentiment: 'neutral', confidence: 0, reason: 'Analysis failed' };
}
}
diff --git a/server/src/lib/opportunity-generator.js b/server/src/lib/opportunity-generator.js
index 06bffdc60..86341aa13 100644
--- a/server/src/lib/opportunity-generator.js
+++ b/server/src/lib/opportunity-generator.js
@@ -33,8 +33,14 @@ Rules:
function computeScore(volume, visibility, competitorGap, intent) {
const weights = {
- comparison: 1.0, 'best-top': 0.95, 'vs-review': 0.9, recommendation: 0.85,
- 'how-to': 0.75, 'problem-solving': 0.7, 'what-is': 0.6, other: 0.5,
+ comparison: 1.0,
+ 'best-top': 0.95,
+ 'vs-review': 0.9,
+ recommendation: 0.85,
+ 'how-to': 0.75,
+ 'problem-solving': 0.7,
+ 'what-is': 0.6,
+ other: 0.5,
};
const nv = Math.min(volume / 50000, 1);
const vg = (100 - (visibility || 0)) / 100;
@@ -100,20 +106,34 @@ export async function generateContentOpportunities(brandId) {
.map((p) => {
const vol = volMap[p.id];
const res = resMap[p.id] || [];
- const avgVis = res.length ? Math.round(res.reduce((s, r) => s + r.visibility_score, 0) / res.length) : 0;
+ const avgVis = res.length
+ ? Math.round(res.reduce((s, r) => s + r.visibility_score, 0) / res.length)
+ : 0;
const compMentions = {};
for (const r of res) {
- const cms = typeof r.competitor_mentions === 'string' ? JSON.parse(r.competitor_mentions) : r.competitor_mentions;
- for (const cm of cms || []) compMentions[cm.name] = (compMentions[cm.name] || 0) + (cm.visibility_score || 0);
+ const cms =
+ typeof r.competitor_mentions === 'string'
+ ? JSON.parse(r.competitor_mentions)
+ : r.competitor_mentions;
+ for (const cm of cms || [])
+ compMentions[cm.name] = (compMentions[cm.name] || 0) + (cm.visibility_score || 0);
}
const cg = Object.values(compMentions).length
- ? Math.round(Object.values(compMentions).reduce((a, b) => a + b, 0) / Object.values(compMentions).length) - avgVis
+ ? Math.round(
+ Object.values(compMentions).reduce((a, b) => a + b, 0) /
+ Object.values(compMentions).length,
+ ) - avgVis
: 0;
return {
- promptId: p.id, text: p.text, category: p.category || 'unknown',
- estAiVolume: vol?.est_ai_volume || 0, intent: vol?.intent || 'other',
- keywords: vol?.keywords || [], avgVisibility: avgVis, competitorGap: cg,
+ promptId: p.id,
+ text: p.text,
+ category: p.category || 'unknown',
+ estAiVolume: vol?.est_ai_volume || 0,
+ intent: vol?.intent || 'other',
+ keywords: vol?.keywords || [],
+ avgVisibility: avgVis,
+ competitorGap: cg,
competitorsCited: Object.keys(compMentions),
score: computeScore(vol?.est_ai_volume || 0, avgVis, cg, vol?.intent || 'other'),
};
@@ -147,9 +167,10 @@ Generate actionable content opportunities.`;
.eq('status', 'new');
const seen = new Set(
- (existing || []).map((opportunity) => (
- `${opportunity.prompt_id}::${(opportunity.title || '').toLowerCase().trim()}`
- )),
+ (existing || []).map(
+ (opportunity) =>
+ `${opportunity.prompt_id}::${(opportunity.title || '').toLowerCase().trim()}`,
+ ),
);
const rows = object.opportunities
@@ -173,9 +194,13 @@ Generate actionable content opportunities.`;
opportunity_score: rel.score,
status: 'new',
source_data: {
- promptText: rel.text, estAiVolume: rel.estAiVolume,
- visibilityScore: rel.avgVisibility, competitorGap: rel.competitorGap,
- intent: rel.intent, keywords: rel.keywords, competitorsCited: rel.competitorsCited,
+ promptText: rel.text,
+ estAiVolume: rel.estAiVolume,
+ visibilityScore: rel.avgVisibility,
+ competitorGap: rel.competitorGap,
+ intent: rel.intent,
+ keywords: rel.keywords,
+ competitorsCited: rel.competitorsCited,
},
}));
diff --git a/server/src/middleware/index.js b/server/src/middleware/index.js
index 58d6ae372..04756dbe9 100644
--- a/server/src/middleware/index.js
+++ b/server/src/middleware/index.js
@@ -46,7 +46,7 @@ class Middleware {
req.user = user;
return next();
- } catch (e) {
+ } catch {
return res.status(500).json({ message: 'Internal Error' });
}
}
@@ -97,9 +97,7 @@ class Middleware {
.map((o) => o.trim())
.filter(Boolean);
- const domain =
- socket?.handshake?.headers?.referer ||
- socket?.handshake?.headers?.origin;
+ const domain = socket?.handshake?.headers?.referer || socket?.handshake?.headers?.origin;
if (!domain) {
return next(new Error('Forbidden Socket'));
diff --git a/server/src/routes/competitors.js b/server/src/routes/competitors.js
index 3bb04fc04..b7c1a1de6 100644
--- a/server/src/routes/competitors.js
+++ b/server/src/routes/competitors.js
@@ -7,12 +7,15 @@ import { getLanguageName } from '../lib/languages.js';
const router = Router();
const competitorSchema = z.object({
- competitors: z.array(
- z.object({
- name: z.string().describe('Company/brand display name'),
- domain: z.string().describe('Root domain without protocol, e.g. "asana.com"'),
- })
- ).min(3).max(10),
+ competitors: z
+ .array(
+ z.object({
+ name: z.string().describe('Company/brand display name'),
+ domain: z.string().describe('Root domain without protocol, e.g. "asana.com"'),
+ }),
+ )
+ .min(3)
+ .max(10),
});
/**
@@ -32,7 +35,8 @@ router.post('/suggest', async (req, res) => {
return res.status(400).json({ error: 'brandName is required' });
}
- const competitorModel = process.env.COMPETITOR_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
+ const competitorModel =
+ process.env.COMPETITOR_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
// Phase 1: web search to find real competitors
const researchPrompt = `Search the web and find 5-10 direct competitors of "${brandName}".
diff --git a/server/src/routes/content.js b/server/src/routes/content.js
index 9a52a25cd..6915a1d94 100644
--- a/server/src/routes/content.js
+++ b/server/src/routes/content.js
@@ -33,58 +33,54 @@ function mapOpportunityRow(row) {
* POST /api/content/generate
* Enqueues a content opportunity generation job. Returns { jobId } immediately.
*/
-router.post(
- '/generate',
- requireFeature('content_optimization'),
- async (req, res) => {
- try {
- const { brandId, model } = req.body;
-
- if (!brandId) {
- return res.status(400).json({ error: 'brandId is required' });
- }
+router.post('/generate', requireFeature('content_optimization'), async (req, res) => {
+ try {
+ const { brandId, model } = req.body;
- const { data: brand } = await supabaseAdmin
- .from('brands')
- .select('id, organization_id')
- .eq('id', brandId)
- .single();
+ if (!brandId) {
+ return res.status(400).json({ error: 'brandId is required' });
+ }
- if (!brand) {
- return res.status(404).json({ error: 'Brand not found' });
- }
+ const { data: brand } = await supabaseAdmin
+ .from('brands')
+ .select('id, organization_id')
+ .eq('id', brandId)
+ .single();
- const { data: profile } = await supabaseAdmin
- .from('profiles')
- .select('organization_id')
- .eq('id', req.user.id)
- .single();
+ if (!brand) {
+ return res.status(404).json({ error: 'Brand not found' });
+ }
- if (!profile || profile.organization_id !== brand.organization_id) {
- return res.status(403).json({ error: 'Unauthorized' });
- }
+ const { data: profile } = await supabaseAdmin
+ .from('profiles')
+ .select('organization_id')
+ .eq('id', req.user.id)
+ .single();
- const job = await createJob({
- type: 'content',
- brandId,
- data: { brandId, model: model || null },
- maxAttempts: 2,
- });
-
- const io = req.app.get('io');
- runContentJob(job.id, io);
-
- return res.json({
- success: true,
- jobId: job.id,
- message: 'Content generation job enqueued',
- });
- } catch (error) {
- console.error('[content] Enqueue error:', error.message);
- return res.status(500).json({ error: error.message });
+ if (!profile || profile.organization_id !== brand.organization_id) {
+ return res.status(403).json({ error: 'Unauthorized' });
}
- },
-);
+
+ const job = await createJob({
+ type: 'content',
+ brandId,
+ data: { brandId, model: model || null },
+ maxAttempts: 2,
+ });
+
+ const io = req.app.get('io');
+ runContentJob(job.id, io);
+
+ return res.json({
+ success: true,
+ jobId: job.id,
+ message: 'Content generation job enqueued',
+ });
+ } catch (error) {
+ console.error('[content] Enqueue error:', error.message);
+ return res.status(500).json({ error: error.message });
+ }
+});
/**
* GET /api/content/job/:jobId
@@ -243,7 +239,8 @@ router.post('/bulk/send-webhook', async (req, res) => {
.eq('is_primary', true)
.limit(1);
- const serverUrl = process.env.PUBLIC_SERVER_URL || `http://localhost:${process.env.PORT || 3001}`;
+ const serverUrl =
+ process.env.PUBLIC_SERVER_URL || `http://localhost:${process.env.PORT || 3001}`;
const headers = { 'Content-Type': 'application/json' };
if (webhookConfig.webhook_secret) {
headers['X-Webhook-Secret'] = webhookConfig.webhook_secret;
@@ -274,9 +271,7 @@ router.post('/bulk/send-webhook', async (req, res) => {
impact: opportunity.impact,
opportunity_score: parseFloat(opportunity.opportunity_score),
},
- prompt: prompt
- ? { text: prompt.text, category: prompt.category }
- : null,
+ prompt: prompt ? { text: prompt.text, category: prompt.category } : null,
data: opportunity.source_data || {},
brief: opportunity.brief || null,
brand: {
@@ -416,7 +411,8 @@ router.post('/:id/send-webhook', async (req, res) => {
prompt = p;
}
- const serverUrl = process.env.PUBLIC_SERVER_URL || `http://localhost:${process.env.PORT || 3001}`;
+ const serverUrl =
+ process.env.PUBLIC_SERVER_URL || `http://localhost:${process.env.PORT || 3001}`;
const payload = {
event: 'opportunity.sent',
@@ -428,9 +424,7 @@ router.post('/:id/send-webhook', async (req, res) => {
impact: opportunity.impact,
opportunity_score: parseFloat(opportunity.opportunity_score),
},
- prompt: prompt
- ? { text: prompt.text, category: prompt.category }
- : null,
+ prompt: prompt ? { text: prompt.text, category: prompt.category } : null,
data: opportunity.source_data || {},
brief: opportunity.brief || null,
brand: {
@@ -622,7 +616,9 @@ export async function generateBriefForOpportunity(opportunityId, { force = false
const { data: results } = await supabaseAdmin
.from('prompt_results')
- .select('platform, visibility_score, mention_count, citation_count, sentiment, response, competitor_mentions')
+ .select(
+ 'platform, visibility_score, mention_count, citation_count, sentiment, response, competitor_mentions',
+ )
.eq('prompt_id', opportunity.prompt_id)
.order('created_at', { ascending: false })
.limit(10);
diff --git a/server/src/routes/prompts.js b/server/src/routes/prompts.js
index ab6e74b7a..594e5f464 100644
--- a/server/src/routes/prompts.js
+++ b/server/src/routes/prompts.js
@@ -39,16 +39,10 @@ async function loadSuggestionContext(brandId) {
{ data: existingTopics },
{ data: recentResults },
] = await Promise.all([
- supabaseAdmin
- .from('brands')
- .select('name, description, language')
- .eq('id', brandId)
- .single(),
+ supabaseAdmin.from('brands').select('name, description, language').eq('id', brandId).single(),
supabaseAdmin
.from('prompts')
- .select(
- 'id, text, prompt_sets!inner(brand_id), prompt_volumes(est_ai_volume, intent)',
- )
+ .select('id, text, prompt_sets!inner(brand_id), prompt_volumes(est_ai_volume, intent)')
.eq('prompt_sets.brand_id', brandId)
.eq('is_active', true)
.limit(80),
@@ -131,9 +125,7 @@ const newSuggestionSchema = z.object({
.string()
.min(20)
.max(120)
- .describe(
- 'A short, generic search query without any brand names',
- ),
+ .describe('A short, generic search query without any brand names'),
topic: z
.string()
.min(3)
@@ -208,8 +200,7 @@ ${volumeBlock}
Suggest the next 8 prompts this brand should start tracking, with topic, reason and a calibrated monthly AI search volume (estVolume).`;
- const promptModel =
- process.env.PROMPT_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
+ const promptModel = process.env.PROMPT_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
const aiModel = resolveModel(promptModel);
const { object } = await generateObject({
@@ -255,9 +246,7 @@ router.post(
.eq('brand_id', req.params.brandId)
.eq('status', 'new');
- const expiresAt = new Date(
- Date.now() + SUGGESTION_TTL_HOURS * 60 * 60 * 1000,
- ).toISOString();
+ const expiresAt = new Date(Date.now() + SUGGESTION_TTL_HOURS * 60 * 60 * 1000).toISOString();
const rows = [];
for (const s of suggestions) {
@@ -285,9 +274,7 @@ router.post(
} catch (error) {
const status = error.status || 500;
console.error('[prompt-suggestions] refresh error:', error.message);
- return res
- .status(status)
- .json({ error: error.message || 'Failed to generate suggestions' });
+ return res.status(status).json({ error: error.message || 'Failed to generate suggestions' });
}
},
);
@@ -303,9 +290,7 @@ router.get('/suggestions/:brandId', async (req, res) => {
.order('generated_at', { ascending: false });
if (error) throw error;
- const stale = (data || []).every(
- (r) => new Date(r.expires_at).getTime() < Date.now(),
- );
+ const stale = (data || []).every((r) => new Date(r.expires_at).getTime() < Date.now());
return res.json({
suggestions: data || [],
stale: data?.length === 0 || stale,
@@ -313,9 +298,7 @@ router.get('/suggestions/:brandId', async (req, res) => {
} catch (error) {
const status = error.status || 500;
console.error('[prompt-suggestions] list error:', error.message);
- return res
- .status(status)
- .json({ error: error.message || 'Failed to load suggestions' });
+ return res.status(status).json({ error: error.message || 'Failed to load suggestions' });
}
});
@@ -338,9 +321,7 @@ router.post('/suggestions/:id/dismiss', async (req, res) => {
} catch (error) {
const status = error.status || 500;
console.error('[prompt-suggestions] dismiss error:', error.message);
- return res
- .status(status)
- .json({ error: error.message || 'Failed to dismiss' });
+ return res.status(status).json({ error: error.message || 'Failed to dismiss' });
}
});
@@ -371,9 +352,7 @@ router.post('/suggestions/:id/accept', async (req, res) => {
} catch (error) {
const status = error.status || 500;
console.error('[prompt-suggestions] accept error:', error.message);
- return res
- .status(status)
- .json({ error: error.message || 'Failed to accept' });
+ return res.status(status).json({ error: error.message || 'Failed to accept' });
}
});
@@ -383,9 +362,7 @@ const promptSuggestionSchema = z.object({
z.object({
text: z
.string()
- .describe(
- 'A short, generic search query (30-100 characters) WITHOUT any brand names',
- ),
+ .describe('A short, generic search query (30-100 characters) WITHOUT any brand names'),
category: z
.enum([
'industry',
@@ -445,45 +422,41 @@ IMPORTANT: All prompts MUST be written in ${langName}.`;
* Body: { brandName, industry, description?, model? }
* Returns: { prompts: [{ text, category }] }
*/
-router.post(
- '/suggest',
- requireFeature('prompt_suggestions'),
- async (req, res) => {
- try {
- const { brandName, industry, description, model, language } = req.body;
- const langName = getLanguageName(language);
+router.post('/suggest', requireFeature('prompt_suggestions'), async (req, res) => {
+ try {
+ const { brandName, industry, description, model, language } = req.body;
+ const langName = getLanguageName(language);
- if (!brandName) {
- return res.status(400).json({ error: 'brandName is required' });
- }
+ if (!brandName) {
+ return res.status(400).json({ error: 'brandName is required' });
+ }
- const userPrompt = `Brand context (DO NOT use the brand name "${brandName}" in any prompt):
+ const userPrompt = `Brand context (DO NOT use the brand name "${brandName}" in any prompt):
Industry: ${industry || 'Not specified'}
Description: ${description || 'Not specified'}
Language: ${langName} — write ALL prompts in this language.
Based on this brand's industry and context, generate 10 short, generic search prompts (each 30-100 characters, aim for 40-80) that potential customers would type into AI search engines. These prompts should be queries where this brand COULD naturally appear in AI responses — but the prompts themselves must NOT contain any brand names.`;
- const promptModel = process.env.PROMPT_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
- const aiModel = resolveModel(model || promptModel);
+ const promptModel = process.env.PROMPT_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
+ const aiModel = resolveModel(model || promptModel);
- const { object } = await generateObject({
- model: aiModel,
- schema: promptSuggestionSchema,
- system: getSystemPrompt(langName),
- prompt: userPrompt,
- });
+ const { object } = await generateObject({
+ model: aiModel,
+ schema: promptSuggestionSchema,
+ system: getSystemPrompt(langName),
+ prompt: userPrompt,
+ });
- return res.json({ prompts: object.prompts });
- } catch (error) {
- console.error('Prompt suggestion error:', error);
- return res.status(500).json({
- error: 'Failed to generate prompt suggestions',
- details: error.message,
- });
- }
- },
-);
+ return res.json({ prompts: object.prompts });
+ } catch (error) {
+ console.error('Prompt suggestion error:', error);
+ return res.status(500).json({
+ error: 'Failed to generate prompt suggestions',
+ details: error.message,
+ });
+ }
+});
const topicPromptSchema = z.object({
topicPrompts: z.array(
@@ -505,9 +478,7 @@ router.post('/from-topics', async (req, res) => {
const langName = getLanguageName(language);
if (!brandName || !topics?.length) {
- return res
- .status(400)
- .json({ error: 'brandName and topics are required' });
+ return res.status(400).json({ error: 'brandName and topics are required' });
}
const promptModel = process.env.PROMPT_SUGGESTION_MODEL || 'google/gemini-3-flash-preview';
diff --git a/server/src/routes/topics.js b/server/src/routes/topics.js
index ddb83949b..80f6667eb 100644
--- a/server/src/routes/topics.js
+++ b/server/src/routes/topics.js
@@ -12,9 +12,7 @@ const topicSchema = z.object({
z.object({
name: z
.string()
- .describe(
- 'A concise topic name (3-8 words) relevant to the brand for AEO tracking',
- ),
+ .describe('A concise topic name (3-8 words) relevant to the brand for AEO tracking'),
}),
)
.min(6)
diff --git a/server/src/routes/tracking.js b/server/src/routes/tracking.js
index ad805ed94..9271282e8 100644
--- a/server/src/routes/tracking.js
+++ b/server/src/routes/tracking.js
@@ -200,7 +200,9 @@ router.post('/analyze-new', async (req, res) => {
// Check cooldown
if (onDemandCooldownMinutes > 0) {
- const cooldownCutoff = new Date(Date.now() - onDemandCooldownMinutes * 60 * 1000).toISOString();
+ const cooldownCutoff = new Date(
+ Date.now() - onDemandCooldownMinutes * 60 * 1000,
+ ).toISOString();
const { data: recentJobs } = await supabaseAdmin
.from('jobs')
@@ -212,7 +214,9 @@ router.post('/analyze-new', async (req, res) => {
.limit(1);
if (recentJobs && recentJobs.length > 0) {
- const nextAvailable = new Date(new Date(recentJobs[0].created_at).getTime() + onDemandCooldownMinutes * 60 * 1000);
+ const nextAvailable = new Date(
+ new Date(recentJobs[0].created_at).getTime() + onDemandCooldownMinutes * 60 * 1000,
+ );
const minutesLeft = Math.ceil((nextAvailable.getTime() - Date.now()) / 60_000);
return res.status(429).json({
success: false,
diff --git a/server/src/routes/traffic.js b/server/src/routes/traffic.js
index b9154e26d..0c26d94be 100644
--- a/server/src/routes/traffic.js
+++ b/server/src/routes/traffic.js
@@ -34,7 +34,7 @@ router.get('/t.js', (req, res) => {
res.set({
'Content-Type': 'application/javascript; charset=utf-8',
'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',
- 'ETag': etag,
+ ETag: etag,
'Access-Control-Allow-Origin': '*',
'X-Content-Type-Options': 'nosniff',
});
@@ -82,10 +82,11 @@ router.post('/track/:trackingCode', trafficLimiter, async (req, res) => {
return res.status(400).json({ ok: false });
}
- const ip = req.headers['cf-connecting-ip']
- || req.headers['x-forwarded-for']?.split(',')[0]?.trim()
- || req.headers['x-real-ip']
- || req.ip;
+ const ip =
+ req.headers['cf-connecting-ip'] ||
+ req.headers['x-forwarded-for']?.split(',')[0]?.trim() ||
+ req.headers['x-real-ip'] ||
+ req.ip;
const country = req.headers['cf-ipcountry'] || null;
diff --git a/server/src/routes/volumes.js b/server/src/routes/volumes.js
index a6d54feaf..0b75299b7 100644
--- a/server/src/routes/volumes.js
+++ b/server/src/routes/volumes.js
@@ -4,14 +4,17 @@ import { z } from 'zod';
import { resolveModel } from '../lib/ai-provider.js';
import { getSearchVolumes } from '../lib/dataforseo.js';
import { regionToLocationCode, languageToCode } from '../lib/dataforseo-codes.js';
-import { requireFeature, enforceVolumeQuota, getVolumeQuotaStatus, PlanLimitError } from '../lib/plan-guard.js';
+import {
+ requireFeature,
+ enforceVolumeQuota,
+ getVolumeQuotaStatus,
+ PlanLimitError,
+} from '../lib/plan-guard.js';
import supabaseAdmin from '../config/supabase.js';
const router = Router();
-const AI_VOLUME_MULTIPLIER = parseFloat(
- process.env.AI_VOLUME_MULTIPLIER || '0.15',
-);
+const AI_VOLUME_MULTIPLIER = parseFloat(process.env.AI_VOLUME_MULTIPLIER || '0.15');
const intentKeywordSchema = z.object({
intent: z
@@ -82,13 +85,7 @@ function mapVolumeRow(saved) {
};
}
-async function fetchAndSaveVolumes(
- promptId,
- keywords,
- intent,
- locationCode,
- languageCode,
-) {
+async function fetchAndSaveVolumes(promptId, keywords, intent, locationCode, languageCode) {
const volumes = await getSearchVolumes(keywords, {
locationCode: locationCode || undefined,
languageCode: languageCode || undefined,
@@ -110,9 +107,7 @@ async function fetchAndSaveVolumes(
}
const competitionIndex =
- competitionWeight > 0
- ? Math.round(competitionWeightedSum / competitionWeight)
- : null;
+ competitionWeight > 0 ? Math.round(competitionWeightedSum / competitionWeight) : null;
const competition =
competitionIndex === null
? null
@@ -160,13 +155,10 @@ router.post('/analyze', requireFeature('prompt_volumes'), async (req, res) => {
try {
const { remaining, orgId } = await enforceVolumeQuota(req.user.id);
- const { promptId, promptText, locationCode, languageCode, model, force } =
- req.body;
+ const { promptId, promptText, locationCode, languageCode, model, force } = req.body;
if (!promptId || !promptText) {
- return res
- .status(400)
- .json({ error: 'promptId and promptText are required' });
+ return res.status(400).json({ error: 'promptId and promptText are required' });
}
let resolvedLocationCode = locationCode;
@@ -255,131 +247,125 @@ router.post('/analyze', requireFeature('prompt_volumes'), async (req, res) => {
* Batch analysis. Uses saved keywords when available, calls LLM only for new prompts.
* Pass force=true to re-generate all keywords via LLM.
*/
-router.post(
- '/analyze-batch',
- requireFeature('prompt_volumes'),
- async (req, res) => {
- try {
- const { remaining, orgId } = await enforceVolumeQuota(req.user.id);
-
- const { prompts, locationCode, languageCode, model, force } = req.body;
-
- if (!Array.isArray(prompts) || prompts.length === 0) {
- return res
- .status(400)
- .json({ error: 'prompts array is required and must not be empty' });
- }
+router.post('/analyze-batch', requireFeature('prompt_volumes'), async (req, res) => {
+ try {
+ const { remaining, orgId } = await enforceVolumeQuota(req.user.id);
- if (prompts.length > 50) {
- return res.status(400).json({ error: 'Maximum 50 prompts per batch' });
- }
+ const { prompts, locationCode, languageCode, model, force } = req.body;
- const promptIds = prompts.map((p) => p.promptId);
-
- // Resolve DataForSEO location/language from the brand the prompts belong to,
- // unless the caller explicitly passed an override in the request body.
- let resolvedLocationCode = locationCode;
- let resolvedLanguageCode = languageCode;
- if (resolvedLocationCode == null || resolvedLanguageCode == null) {
- const { data: brandRow } = await supabaseAdmin
- .from('prompts')
- .select('prompt_sets!inner(brands!inner(region, language))')
- .in('id', promptIds)
- .limit(1)
- .maybeSingle();
- const brand = brandRow?.prompt_sets?.brands;
- if (brand) {
- if (resolvedLocationCode == null) {
- resolvedLocationCode = regionToLocationCode(brand.region);
- }
- if (resolvedLanguageCode == null) {
- resolvedLanguageCode = languageToCode(brand.language);
- }
+ if (!Array.isArray(prompts) || prompts.length === 0) {
+ return res.status(400).json({ error: 'prompts array is required and must not be empty' });
+ }
+
+ if (prompts.length > 50) {
+ return res.status(400).json({ error: 'Maximum 50 prompts per batch' });
+ }
+
+ const promptIds = prompts.map((p) => p.promptId);
+
+ // Resolve DataForSEO location/language from the brand the prompts belong to,
+ // unless the caller explicitly passed an override in the request body.
+ let resolvedLocationCode = locationCode;
+ let resolvedLanguageCode = languageCode;
+ if (resolvedLocationCode == null || resolvedLanguageCode == null) {
+ const { data: brandRow } = await supabaseAdmin
+ .from('prompts')
+ .select('prompt_sets!inner(brands!inner(region, language))')
+ .in('id', promptIds)
+ .limit(1)
+ .maybeSingle();
+ const brand = brandRow?.prompt_sets?.brands;
+ if (brand) {
+ if (resolvedLocationCode == null) {
+ resolvedLocationCode = regionToLocationCode(brand.region);
+ }
+ if (resolvedLanguageCode == null) {
+ resolvedLanguageCode = languageToCode(brand.language);
}
}
+ }
+
+ let existingMap = {};
- let existingMap = {};
-
- if (!force) {
- const { data: existingRows } = await supabaseAdmin
- .from('prompt_volumes')
- .select('prompt_id, intent, keywords')
- .in('prompt_id', promptIds);
-
- if (existingRows) {
- for (const row of existingRows) {
- if (row.keywords?.length) {
- existingMap[row.prompt_id] = {
- intent: row.intent,
- keywords: row.keywords,
- };
- }
+ if (!force) {
+ const { data: existingRows } = await supabaseAdmin
+ .from('prompt_volumes')
+ .select('prompt_id, intent, keywords')
+ .in('prompt_id', promptIds);
+
+ if (existingRows) {
+ for (const row of existingRows) {
+ if (row.keywords?.length) {
+ existingMap[row.prompt_id] = {
+ intent: row.intent,
+ keywords: row.keywords,
+ };
}
}
}
+ }
- const aiModel = resolveModel(model);
- const results = [];
-
- for (const { promptId, promptText } of prompts) {
- try {
- let intent;
- let keywords;
-
- const cached = existingMap[promptId];
- if (cached) {
- intent = cached.intent;
- keywords = cached.keywords;
- } else {
- const { object: intentResult } = await generateObject({
- model: aiModel,
- schema: intentKeywordSchema,
- system: INTENT_SYSTEM_PROMPT,
- prompt: `Analyze this AI search prompt and extract intent + 5 Google keywords:\n\n"${promptText}"`,
- });
- intent = intentResult.intent;
- keywords = intentResult.keywords;
- }
+ const aiModel = resolveModel(model);
+ const results = [];
- const saved = await fetchAndSaveVolumes(
- promptId,
- keywords,
- intent,
- resolvedLocationCode,
- resolvedLanguageCode,
- );
- results.push(mapVolumeRow(saved));
- } catch (err) {
- results.push({ promptId, error: err.message });
+ for (const { promptId, promptText } of prompts) {
+ try {
+ let intent;
+ let keywords;
+
+ const cached = existingMap[promptId];
+ if (cached) {
+ intent = cached.intent;
+ keywords = cached.keywords;
+ } else {
+ const { object: intentResult } = await generateObject({
+ model: aiModel,
+ schema: intentKeywordSchema,
+ system: INTENT_SYSTEM_PROMPT,
+ prompt: `Analyze this AI search prompt and extract intent + 5 Google keywords:\n\n"${promptText}"`,
+ });
+ intent = intentResult.intent;
+ keywords = intentResult.keywords;
}
- }
- const successCount = results.filter((r) => !r.error).length;
- if (successCount > 0 && orgId) {
- await supabaseAdmin.from('volume_usage').insert({
- organization_id: orgId,
- action: 'analyze-batch',
- prompt_count: successCount,
- });
+ const saved = await fetchAndSaveVolumes(
+ promptId,
+ keywords,
+ intent,
+ resolvedLocationCode,
+ resolvedLanguageCode,
+ );
+ results.push(mapVolumeRow(saved));
+ } catch (err) {
+ results.push({ promptId, error: err.message });
}
+ }
- return res.json({ results, remaining: remaining === -1 ? -1 : remaining - 1 });
- } catch (error) {
- if (error instanceof PlanLimitError) {
- return res.status(error.statusCode).json({
- success: false,
- error: 'quota_exceeded',
- message: error.message,
- });
- }
- console.error('Batch volume analysis error:', error);
- return res.status(500).json({
- error: 'Failed to analyze prompt volumes',
- details: error.message,
+ const successCount = results.filter((r) => !r.error).length;
+ if (successCount > 0 && orgId) {
+ await supabaseAdmin.from('volume_usage').insert({
+ organization_id: orgId,
+ action: 'analyze-batch',
+ prompt_count: successCount,
});
}
- },
-);
+
+ return res.json({ results, remaining: remaining === -1 ? -1 : remaining - 1 });
+ } catch (error) {
+ if (error instanceof PlanLimitError) {
+ return res.status(error.statusCode).json({
+ success: false,
+ error: 'quota_exceeded',
+ message: error.message,
+ });
+ }
+ console.error('Batch volume analysis error:', error);
+ return res.status(500).json({
+ error: 'Failed to analyze prompt volumes',
+ details: error.message,
+ });
+ }
+});
/**
* POST /api/volumes/refresh
@@ -526,9 +512,7 @@ router.get('/brand/:brandId', async (req, res) => {
.in('prompt_set_id', setIds);
if (pError) {
- return res
- .status(500)
- .json({ error: 'Failed to fetch prompts', details: pError.message });
+ return res.status(500).json({ error: 'Failed to fetch prompts', details: pError.message });
}
if (!prompts || prompts.length === 0) {
@@ -544,9 +528,7 @@ router.get('/brand/:brandId', async (req, res) => {
.order('est_ai_volume', { ascending: false });
if (vError) {
- return res
- .status(500)
- .json({ error: 'Failed to fetch volumes', details: vError.message });
+ return res.status(500).json({ error: 'Failed to fetch volumes', details: vError.message });
}
const promptMap = {};
diff --git a/server/src/server.js b/server/src/server.js
index b44e4536d..7ca9cef18 100644
--- a/server/src/server.js
+++ b/server/src/server.js
@@ -17,12 +17,7 @@ import { parseScraperResponse } from './lib/cloro-scraper.js';
import { handleScraperResult } from './lib/cloro-result-handler.js';
import { generateBriefForOpportunity } from './routes/content.js';
import supabaseAdmin from './config/supabase.js';
-import {
- getPlan,
- hasFeature,
- isCloud,
- isSubscriptionActive,
-} from './config/plans.js';
+import { getPlan, hasFeature, isCloud, isSubscriptionActive } from './config/plans.js';
const app = express();
app.set('trust proxy', 1);
@@ -52,13 +47,15 @@ app.use(
cors({
origin: allowedOrigins,
credentials: true,
- })
+ }),
);
// --- Security ---
-app.use(helmet({
- crossOriginResourcePolicy: { policy: 'cross-origin' },
-}));
+app.use(
+ helmet({
+ crossOriginResourcePolicy: { policy: 'cross-origin' },
+ }),
+);
// --- Rate limiting ---
app.use('/api', apiLimiter);
@@ -72,9 +69,7 @@ const io = new SocketIOServer(server, {
},
});
-io.use((socket, next) =>
- Middleware.checkRequestIsComingFromDomainForSocket(socket, next)
-);
+io.use((socket, next) => Middleware.checkRequestIsComingFromDomainForSocket(socket, next));
io.use((socket, next) => Middleware.decodeTokenForSocket(socket, next));
io.on('connection', (socket) => {
@@ -92,9 +87,7 @@ app.set('io', io);
async function runDailyTracking() {
const isCloudMode = isCloud();
- const { data: brands, error } = await supabaseAdmin
- .from('brands')
- .select('id, organization_id');
+ const { data: brands, error } = await supabaseAdmin.from('brands').select('id, organization_id');
if (error || !brands || brands.length === 0) {
return { triggered: 0, total: 0 };
@@ -258,10 +251,7 @@ app.post('/cloro/callback', async (req, res) => {
if (status === 'FAILED') {
console.error(`[cloro/callback] Task ${taskId} (${pending.scraper_id}) FAILED`);
- await supabaseAdmin
- .from('cloro_pending_tasks')
- .delete()
- .eq('task_id', taskId);
+ await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);
return;
}
@@ -272,40 +262,22 @@ app.post('/cloro/callback', async (req, res) => {
if (!response) {
console.error(`[cloro/callback] Task ${taskId} COMPLETED but missing response`);
- await supabaseAdmin
- .from('cloro_pending_tasks')
- .delete()
- .eq('task_id', taskId);
+ await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);
return;
}
// Fetch context for result handler
- const [
- { data: brand },
- { data: domains },
- { data: competitorRows },
- ] = await Promise.all([
- supabaseAdmin
- .from('brands')
- .select('id, name')
- .eq('id', pending.brand_id)
- .single(),
- supabaseAdmin
- .from('brand_domains')
- .select('domain')
- .eq('brand_id', pending.brand_id),
- supabaseAdmin
- .from('competitors')
- .select('id, name, domain')
- .eq('brand_id', pending.brand_id),
+ const [{ data: brand }, { data: domains }, { data: competitorRows }] = await Promise.all([
+ supabaseAdmin.from('brands').select('id, name').eq('id', pending.brand_id).single(),
+ supabaseAdmin.from('brand_domains').select('domain').eq('brand_id', pending.brand_id),
+ supabaseAdmin.from('competitors').select('id, name, domain').eq('brand_id', pending.brand_id),
]);
if (!brand) {
- console.error(`[cloro/callback] Brand ${pending.brand_id} for task ${taskId} not found — dropping`);
- await supabaseAdmin
- .from('cloro_pending_tasks')
- .delete()
- .eq('task_id', taskId);
+ console.error(
+ `[cloro/callback] Brand ${pending.brand_id} for task ${taskId} not found — dropping`,
+ );
+ await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);
return;
}
@@ -331,10 +303,7 @@ app.post('/cloro/callback', async (req, res) => {
competitors,
});
- await supabaseAdmin
- .from('cloro_pending_tasks')
- .delete()
- .eq('task_id', taskId);
+ await supabaseAdmin.from('cloro_pending_tasks').delete().eq('task_id', taskId);
console.log(`[cloro/callback] Task ${taskId} (${pending.scraper_id}) processed and inserted`);
} catch (err) {
@@ -360,10 +329,7 @@ app.use((err, req, res, _next) => {
console.error('Unhandled error:', err.message);
res.status(err.status || 500).json({
success: false,
- message:
- process.env.NODE_ENV === 'development'
- ? err.message
- : 'Internal Server Error',
+ message: process.env.NODE_ENV === 'development' ? err.message : 'Internal Server Error',
});
});
diff --git a/server/src/test-tracking.js b/server/src/test-tracking.js
index 07eed9cd1..a6e8dfa0f 100644
--- a/server/src/test-tracking.js
+++ b/server/src/test-tracking.js
@@ -10,8 +10,7 @@ import 'dotenv/config';
import { runPrompt } from './lib/openai-tracker.js';
import { parseResponse } from './lib/response-parser.js';
-const TEST_PROMPT =
- 'Best AI automation platforms for sales and marketing teams';
+const TEST_PROMPT = 'Best AI automation platforms for sales and marketing teams';
const TEST_BRAND = {
brandName: 'Empler AI',
domains: ['empler.ai'],
@@ -33,8 +32,7 @@ async function main() {
console.log(`--- Response (${elapsed}s) ---`);
console.log(response.text.slice(0, 500));
- if (response.text.length > 500)
- console.log(`... (${response.text.length} chars total)`);
+ if (response.text.length > 500) console.log(`... (${response.text.length} chars total)`);
console.log();
console.log(`--- Citations (${response.citations.length}) ---`);
diff --git a/server/src/test-volumes.js b/server/src/test-volumes.js
index 1f95beada..bd957f941 100644
--- a/server/src/test-volumes.js
+++ b/server/src/test-volumes.js
@@ -8,8 +8,13 @@ const AI_VOLUME_MULTIPLIER = parseFloat(process.env.AI_VOLUME_MULTIPLIER || '0.1
const intentKeywordSchema = z.object({
intent: z.enum([
- 'comparison', 'how-to', 'what-is', 'best-top',
- 'vs-review', 'recommendation', 'problem-solving',
+ 'comparison',
+ 'how-to',
+ 'what-is',
+ 'best-top',
+ 'vs-review',
+ 'recommendation',
+ 'problem-solving',
]),
keywords: z.array(z.string()).length(5),
});
@@ -28,10 +33,10 @@ async function testDataForSEO() {
console.log('=== Test 1: DataForSEO Connection ===\n');
try {
- const volumes = await getSearchVolumes(
- ['best crm software', 'crm tools comparison'],
- { locationCode: 2840, languageCode: 'en' }
- );
+ const volumes = await getSearchVolumes(['best crm software', 'crm tools comparison'], {
+ locationCode: 2840,
+ languageCode: 'en',
+ });
console.log('DataForSEO volumes:', volumes);
console.log('OK - DataForSEO connection works!\n');
return true;
@@ -96,14 +101,13 @@ async function testFullPipeline() {
);
}
- const totalGoogleVolume = Object.values(volumes).reduce(
- (sum, v) => sum + v.volume,
- 0,
- );
+ const totalGoogleVolume = Object.values(volumes).reduce((sum, v) => sum + v.volume, 0);
const estAiVolume = Math.round(totalGoogleVolume * AI_VOLUME_MULTIPLIER);
console.log(`\nTotal Google Volume: ${totalGoogleVolume.toLocaleString()}/mo`);
- console.log(`AI Multiplier: ${AI_VOLUME_MULTIPLIER} (${(AI_VOLUME_MULTIPLIER * 100).toFixed(0)}%)`);
+ console.log(
+ `AI Multiplier: ${AI_VOLUME_MULTIPLIER} (${(AI_VOLUME_MULTIPLIER * 100).toFixed(0)}%)`,
+ );
console.log(`Est. AI Volume: ${estAiVolume.toLocaleString()}/mo`);
console.log('\nOK - Full pipeline works!');
} catch (err) {
diff --git a/server/src/workers/content-worker.js b/server/src/workers/content-worker.js
index 5f0912df4..bdfdb6db2 100644
--- a/server/src/workers/content-worker.js
+++ b/server/src/workers/content-worker.js
@@ -14,9 +14,7 @@ const opportunitySchema = z.object({
z.object({
title: z
.string()
- .describe(
- 'A specific, actionable content recommendation backed by the data provided',
- ),
+ .describe('A specific, actionable content recommendation backed by the data provided'),
description: z
.string()
.describe(
@@ -69,10 +67,7 @@ function computeOpportunityScore(volume, visibility, competitorGap, intent) {
const intentWeight = intentWeights[intent] || 0.5;
const score =
- normalizedVolume * 40 +
- visibilityGap * 30 +
- normalizedCompGap * 20 +
- intentWeight * 10;
+ normalizedVolume * 40 + visibilityGap * 30 + normalizedCompGap * 20 + intentWeight * 10;
return Math.round(Math.min(score, 100) * 100) / 100;
}
@@ -121,19 +116,15 @@ export async function processContentJob({ brandId, model, job }) {
const promptIds = prompts.map((p) => p.id);
const [volumeResult, resultResult, competitorResult] = await Promise.all([
- supabaseAdmin
- .from('prompt_volumes')
- .select('*')
- .in('prompt_id', promptIds),
+ supabaseAdmin.from('prompt_volumes').select('*').in('prompt_id', promptIds),
supabaseAdmin
.from('prompt_results')
- .select('prompt_id, visibility_score, mention_count, citation_count, sentiment, competitor_mentions')
+ .select(
+ 'prompt_id, visibility_score, mention_count, citation_count, sentiment, competitor_mentions',
+ )
.in('prompt_id', promptIds)
.order('created_at', { ascending: false }),
- supabaseAdmin
- .from('competitors')
- .select('id, name, domain')
- .eq('brand_id', brandId),
+ supabaseAdmin.from('competitors').select('id, name, domain').eq('brand_id', brandId),
]);
const volumes = volumeResult.data || [];
@@ -159,16 +150,15 @@ export async function processContentJob({ brandId, model, job }) {
const res = resultMap[p.id] || [];
const avgVisibility =
- res.length > 0
- ? Math.round(res.reduce((s, r) => s + r.visibility_score, 0) / res.length)
- : 0;
+ res.length > 0 ? Math.round(res.reduce((s, r) => s + r.visibility_score, 0) / res.length) : 0;
const competitorMentions = {};
for (const r of res) {
if (r.competitor_mentions) {
- const mentions = typeof r.competitor_mentions === 'string'
- ? JSON.parse(r.competitor_mentions)
- : r.competitor_mentions;
+ const mentions =
+ typeof r.competitor_mentions === 'string'
+ ? JSON.parse(r.competitor_mentions)
+ : r.competitor_mentions;
for (const cm of mentions || []) {
competitorMentions[cm.name] =
(competitorMentions[cm.name] || 0) + (cm.visibility_score || 0);
@@ -200,12 +190,7 @@ export async function processContentJob({ brandId, model, job }) {
const scoredPrompts = promptDataForLLM
.map((p) => ({
...p,
- score: computeOpportunityScore(
- p.estAiVolume,
- p.avgVisibility,
- p.competitorGap,
- p.intent,
- ),
+ score: computeOpportunityScore(p.estAiVolume, p.avgVisibility, p.competitorGap, p.intent),
}))
.sort((a, b) => b.score - a.score)
.slice(0, 25);
@@ -278,9 +263,7 @@ Generate actionable content opportunities based on this data. Reference specific
};
});
- const { error: insertErr } = await supabaseAdmin
- .from('content_opportunities')
- .insert(rows);
+ const { error: insertErr } = await supabaseAdmin.from('content_opportunities').insert(rows);
if (insertErr) {
throw new Error(insertErr.message);
diff --git a/server/src/workers/tracking-worker.js b/server/src/workers/tracking-worker.js
index c0e2a48f2..afc6d0ee1 100644
--- a/server/src/workers/tracking-worker.js
+++ b/server/src/workers/tracking-worker.js
@@ -108,12 +108,8 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
// 6. Phase 1: Collect & run all scraper (platform) tasks first
const scraperTasks = [];
for (const prompt of prompts) {
- const scrapersToRun = prompt.platforms && prompt.platforms.length > 0
- ? prompt.platforms
- : [];
- const regionsToRun = prompt.regions && prompt.regions.length > 0
- ? prompt.regions
- : [null];
+ const scrapersToRun = prompt.platforms && prompt.platforms.length > 0 ? prompt.platforms : [];
+ const regionsToRun = prompt.regions && prompt.regions.length > 0 ? prompt.regions : [null];
for (const scraperId of scrapersToRun) {
for (const region of regionsToRun) {
@@ -142,15 +138,19 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
// Submit all tasks concurrently
const submissions = await Promise.allSettled(
scraperTasks.map((t) =>
- submitScraperTask(t.prompt.text, t.scraperId, t.region, { webhookUrl })
- .then((res) => ({ ...res, meta: t }))
+ submitScraperTask(t.prompt.text, t.scraperId, t.region, { webhookUrl }).then((res) => ({
+ ...res,
+ meta: t,
+ })),
),
);
const submitted = [];
for (const sub of submissions) {
if (sub.status === 'fulfilled') {
- console.log(`[tracking] Submitted ${sub.value.scraperId} task=${sub.value.taskId} prompt="${sub.value.meta.prompt.text.slice(0, 50)}..."`);
+ console.log(
+ `[tracking] Submitted ${sub.value.scraperId} task=${sub.value.taskId} prompt="${sub.value.meta.prompt.text.slice(0, 50)}..."`,
+ );
submitted.push(sub.value);
} else {
const failedTask = scraperTasks[submissions.indexOf(sub)];
@@ -227,7 +227,9 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
completedTasks += expectedSubmitted;
} else {
- console.log(`[tracking] ${submitted.length}/${scraperTasks.length} tasks submitted, polling for results...`);
+ console.log(
+ `[tracking] ${submitted.length}/${scraperTasks.length} tasks submitted, polling for results...`,
+ );
// Polling fallback: wait for each task inline (legacy behavior)
await Promise.allSettled(
@@ -235,13 +237,21 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
try {
console.log(`[tracking] Polling task=${taskId} scraper=${scraperId}...`);
const aiResponse = await pollScraperResult(taskId, scraperId);
- console.log(`[tracking] Task=${taskId} scraper=${scraperId} completed, inserting result...`);
+ console.log(
+ `[tracking] Task=${taskId} scraper=${scraperId} completed, inserting result...`,
+ );
const mentionCount = countBrandMentions(aiResponse.text, brandInfo);
- const sentimentResult = mentionCount > 0
- ? await analyzeSentimentAI(aiResponse.text, brandInfo.brandName)
- : { sentiment: 'neutral', confidence: 0, reason: 'Brand not mentioned' };
- const metrics = parseResponse(aiResponse, brandInfo, sentimentResult.sentiment, competitors);
+ const sentimentResult =
+ mentionCount > 0
+ ? await analyzeSentimentAI(aiResponse.text, brandInfo.brandName)
+ : { sentiment: 'neutral', confidence: 0, reason: 'Brand not mentioned' };
+ const metrics = parseResponse(
+ aiResponse,
+ brandInfo,
+ sentimentResult.sentiment,
+ competitors,
+ );
await insertResult({
prompt_id: meta.prompt.id,
@@ -260,9 +270,7 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
console.log(`[tracking] Task=${taskId} scraper=${scraperId} result saved.`);
} catch (err) {
- console.error(
- `[tracking] Task=${taskId} scraper=${scraperId} failed: ${err.message}`,
- );
+ console.error(`[tracking] Task=${taskId} scraper=${scraperId} failed: ${err.message}`);
}
completedTasks++;
@@ -283,12 +291,8 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
// 7. Phase 2: Run AI model tasks concurrently
const modelTasks = [];
for (const prompt of prompts) {
- const modelsToRun = prompt.models && prompt.models.length > 0
- ? prompt.models
- : [];
- const regionsToRun = prompt.regions && prompt.regions.length > 0
- ? prompt.regions
- : [null];
+ const modelsToRun = prompt.models && prompt.models.length > 0 ? prompt.models : [];
+ const regionsToRun = prompt.regions && prompt.regions.length > 0 ? prompt.regions : [null];
for (const modelName of modelsToRun) {
for (const region of regionsToRun) {
@@ -317,10 +321,16 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
const aiResponse = await runPrompt(prompt.text, modelName, region);
const mentionCount = countBrandMentions(aiResponse.text, brandInfo);
- const sentimentResult = mentionCount > 0
- ? await analyzeSentimentAI(aiResponse.text, brandInfo.brandName)
- : { sentiment: 'neutral', confidence: 0, reason: 'Brand not mentioned' };
- const metrics = parseResponse(aiResponse, brandInfo, sentimentResult.sentiment, competitors);
+ const sentimentResult =
+ mentionCount > 0
+ ? await analyzeSentimentAI(aiResponse.text, brandInfo.brandName)
+ : { sentiment: 'neutral', confidence: 0, reason: 'Brand not mentioned' };
+ const metrics = parseResponse(
+ aiResponse,
+ brandInfo,
+ sentimentResult.sentiment,
+ competitors,
+ );
await insertResult({
prompt_id: prompt.id,
@@ -377,7 +387,10 @@ export async function processTrackingJob({ brandId, promptId, promptIds, job })
const plan = getPlan(org?.plan);
if (hasFeature(plan, 'content_optimization')) {
generateContentOpportunities(brandId).catch((err) => {
- console.error(`[tracking] Auto opportunity generation failed for brand ${brandId}:`, err.message);
+ console.error(
+ `[tracking] Auto opportunity generation failed for brand ${brandId}:`,
+ err.message,
+ );
});
}
}