-
Notifications
You must be signed in to change notification settings - Fork 0
feat: update project configuration and build setup #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,7 @@ playground | |
| tmp | ||
| dist | ||
| .turbo | ||
| opencode-lsp-test/ | ||
| .serena/ | ||
|
|
||
| .serena/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| #!/bin/sh | ||
| bun run typecheck | ||
| bun typecheck |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| import tseslint from '@typescript-eslint/eslint-plugin'; | ||
| import tsParser from '@typescript-eslint/parser'; | ||
| import functional from 'eslint-plugin-functional'; | ||
| import importPlugin from 'eslint-plugin-import'; | ||
| import promise from 'eslint-plugin-promise'; | ||
| import sonarjs from 'eslint-plugin-sonarjs'; | ||
| import ava from 'eslint-plugin-ava'; | ||
|
Comment on lines
+1
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new ESLint config imports Useful? React with 👍 / 👎. |
||
|
|
||
| export default [ | ||
| { | ||
| ignores: [ | ||
| '**/dist/**', | ||
| '**/.cache/**', | ||
| './scripts/**', | ||
| './templates/**', | ||
| './eslint.config.ts', | ||
| '**/pseudo/**', | ||
| 'packages/smartgpt-bridge/src/fixtures', | ||
| ], | ||
| }, | ||
| { | ||
| files: ['**/*.{ts,tsx}'], | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| parserOptions: { | ||
| projectService: true, // uses your tsconfig.* automatically | ||
| allowDefaultProject: true, | ||
| ecmaVersion: 'latest', | ||
| sourceType: 'module', | ||
| }, | ||
| }, | ||
| plugins: { | ||
| '@typescript-eslint': tseslint, | ||
| functional, | ||
| import: importPlugin, | ||
| sonarjs, | ||
| promise, | ||
| ava, | ||
| }, | ||
| rules: { | ||
| 'sonarjs/cognitive-complexity': ['error', 15], | ||
| 'sonarjs/no-collapsible-if': 'warn', | ||
| 'sonarjs/no-inverted-boolean-check': 'warn', | ||
| 'max-lines': ['error', { max: 300, skipBlankLines: true, skipComments: true }], | ||
| 'max-lines-per-function': ['error', { max: 50, IIFEs: true }], | ||
| 'max-params': ['error', 4], | ||
| complexity: ['error', 15], | ||
|
Comment on lines
+44
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that complexity and size limits align with existing codebase. The configuration enforces strict limits:
These are quite strict and may require significant refactoring of existing code. Before enforcing these limits, verify the current state of the codebase: Consider starting with warnings instead of errors to assess the impact: - 'max-lines': ['error', { max: 300, skipBlankLines: true, skipComments: true }],
- 'max-lines-per-function': ['error', { max: 50, IIFEs: true }],
+ 'max-lines': ['warn', { max: 300, skipBlankLines: true, skipComments: true }],
+ 'max-lines-per-function': ['warn', { max: 50, IIFEs: true }],🏁 Script executed: #!/bin/bash
# Find large files and functions
echo "Files over 300 lines:"
fd -e ts -e tsx -x wc -l {} \; | awk '$1 > 300 {print $0}' | sort -rn | head -20
echo ""
echo "Sample of functions that might exceed limits:"
# This is a heuristic - proper analysis would need AST parsing
rg -n "^(export )?(async )?function" --type ts -A 60 | grep -E "^[0-9]+-.*function" | head -10Length of output: 968 I need to gather more information about function lengths, generated files, and whether the eslint config already excludes certain files. 🏁 Script executed: #!/bin/bash
# Check for .eslintignore or ignorePatterns in eslint config
echo "=== Checking ESLint exclusions ==="
if [ -f .eslintignore ]; then
echo ".eslintignore exists:"
cat .eslintignore
else
echo "No .eslintignore file found"
fi
echo ""
echo "=== Checking eslint.config.mjs for ignorePatterns ==="
grep -n "ignore" ./eslint.config.mjs | head -20
echo ""
echo "=== Generated files check ==="
echo "Generated TypeScript files (.gen.ts):"
fd -e gen.ts | head -10Length of output: 855 🏁 Script executed: #!/bin/bash
# Better function length analysis using AST patterns
echo "=== Functions over 50 lines (sample) ==="
# Search for function declarations and count lines until next function or export
ast-grep --pattern $'function $_ ($_) {
$$$
}' -A 60 | head -100Length of output: 5471 🏁 Script executed: #!/bin/bash
# Check eslint.config.mjs structure to understand current configuration
echo "=== Current eslint.config.mjs context ==="
cat ./eslint.config.mjs | head -60Length of output: 2007 I need to verify whether the .gen.ts files are auto-generated and if they should be excluded from linting. 🏁 Script executed: #!/bin/bash
# Check if .gen.ts files are auto-generated (look for generation markers)
echo "=== Checking .gen.ts files for generation markers ==="
rg -n "generated|do not edit|auto-generated" packages/sdk/js/src/gen/types.gen.ts -A 2 -B 2 | head -20
echo ""
echo "=== Check build config for code generation ==="
fd -e "package.json" | xargs grep -l "codegen\|generate" | head -5Length of output: 186 🏁 Script executed: #!/bin/bash
# Check if non-generated files can realistically fit within limits
echo "=== Largest non-.gen.ts files ==="
fd -e ts -e tsx ! -path "*/.gen.ts" -x wc -l {} \; | awk '$1 > 300 {print $0}' | sort -rn | head -15Length of output: 202 🏁 Script executed: #!/bin/bash
echo "=== Largest non-generated files (excluding .gen.ts) ==="
fd -e ts -e tsx -x wc -l {} \; | grep -v "\.gen\.ts" | awk '$1 > 300 {print $0}' | sort -rn | head -15Length of output: 740 Exclude auto-generated files and consider starting with warnings for linting limits. The configuration enforces strict limits that will require codebase refactoring:
Two critical issues:
🤖 Prompt for AI Agents |
||
| // TypeScript strictness (lint-side) | ||
| '@typescript-eslint/no-unnecessary-type-assertion': 'error', | ||
| '@typescript-eslint/no-floating-promises': 'error', | ||
| '@typescript-eslint/explicit-module-boundary-types': 'error', | ||
|
|
||
| '@typescript-eslint/no-explicit-any': 'error', | ||
| '@typescript-eslint/prefer-readonly-parameter-types': [ | ||
| 'warn', | ||
| { | ||
| // these avoid most transient-symbol pitfalls | ||
| ignoreInferredTypes: true, | ||
| checkParameterProperties: false, | ||
| // optional: if DOM/3rd-party types cause noise, allow them: | ||
| // allow: [{ from: "lib", name: ["HTMLElement", "Event"] }] | ||
| }, | ||
| ], | ||
| 'no-var': 'error', | ||
| 'prefer-const': 'error', | ||
| "import/no-dynamic-require": "error", | ||
| 'no-restricted-syntax': [ | ||
| 'error', | ||
| { | ||
| selector: "CallExpression[callee.name='require']", | ||
| message: 'ESM only', | ||
| }, | ||
| { | ||
| selector: "MemberExpression[object.name='module'][property.name='exports']", | ||
| message: 'ESM only', | ||
| }, | ||
| { | ||
| selector: 'ClassDeclaration', | ||
| message: 'Class declarations are not allowed.', | ||
| }, | ||
| { | ||
| selector: 'ClassExpression', | ||
| message: 'Class expressions are not allowed.', | ||
| }, | ||
|
Comment on lines
+67
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainReconsider the ban on class declarations and expressions. Lines 78-84 completely prohibit class usage, which is extremely restrictive and may conflict with third-party libraries, framework requirements, or legitimate use cases (e.g., custom errors, builder patterns). While functional programming has benefits, a complete ban on classes might be too extreme for a real-world project. Consider:
- {
- selector: 'ClassDeclaration',
- message: 'Class declarations are not allowed.',
- },
- {
- selector: 'ClassExpression',
- message: 'Class expressions are not allowed.',
- },Check if classes are already used in the codebase: If classes are found, you'll need to refactor them or adjust this rule. 🏁 Script executed: #!/bin/bash
# Search for existing class usage
echo "Searching for class declarations in TypeScript files..."
ast-grep --pattern 'class $_ { $$$ }'Length of output: 4439 🏁 Script executed: #!/bin/bash
# Check eslint.config.mjs for ignore patterns and file scope
echo "=== Checking eslint.config.mjs for ignores and scope ==="
cat eslint.config.mjs | head -100Length of output: 3401 🏁 Script executed: #!/bin/bash
# Search for more class usages to get full picture
echo "=== Searching for all class declarations ==="
rg -n "^\s*(export\s+)?(abstract\s+)?class\s+" --type=ts --type=js -g '!node_modules' -g '!dist' | head -20Length of output: 1594 🏁 Script executed: #!/bin/bash
# Check if there are any ESLint ignores or overrides for generated files
echo "=== Checking for ESLint ignores in package.json or other configs ==="
find . -maxdepth 2 -type f \( -name ".eslintignore" -o -name "eslintrc*" -o -name "package.json" \) ! -path '*/node_modules/*' -exec echo "File: {}" \; -exec cat {} \; 2>/dev/null | head -150Length of output: 2712 The class ban rule will cause linting failures on existing codebase—critical conflict. The ESLint config applies to all TypeScript files across the repository without ignoring the real source code. However, classes already exist extensively throughout:
Enabling this rule will break the linting pipeline. Either:
🤖 Prompt for AI Agents |
||
| ], | ||
| // FP: immutability & purity | ||
| 'functional/no-let': 'error', | ||
| 'functional/no-try-statements': 'warn', // flip to "warn" if you want | ||
| 'functional/prefer-immutable-types': [ | ||
| 'warn', | ||
| { | ||
| enforcement: 'ReadonlyDeep', | ||
| ignoreInferredTypes: true, // avoids noise on inferred literals | ||
| }, | ||
| ], | ||
| '@typescript-eslint/no-unsafe-assignment': 'error', | ||
| '@typescript-eslint/no-unsafe-call': 'error', | ||
| '@typescript-eslint/no-unsafe-member-access': 'error', | ||
| '@typescript-eslint/no-unsafe-argument': 'error', | ||
| '@typescript-eslint/switch-exhaustiveness-check': 'error', | ||
| 'functional/immutable-data': ['warn', { ignoreClasses: 'fieldsOnly' }], | ||
| 'functional/no-loop-statements': 'warn', | ||
| 'functional/no-method-signature': 'off', // keep TS ergonomics | ||
| 'functional/prefer-tacit': 'off', // readability first | ||
|
|
||
| // Side-effect control | ||
| 'promise/no-return-wrap': 'warn', | ||
| 'promise/param-names': 'warn', | ||
|
|
||
| // Imports hygiene | ||
| 'import/first': 'warn', | ||
| 'import/no-default-export': 'warn', | ||
| 'import/no-cycle': ['warn', { maxDepth: 1 }], | ||
| 'import/order': [ | ||
| 'warn', | ||
| { | ||
| groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'], | ||
| 'newlines-between': 'always', | ||
| }, | ||
| ], | ||
| 'no-restricted-imports': [ | ||
| 'error', | ||
| { | ||
| paths: [ | ||
| { | ||
| name: '@promethean/persistence', | ||
| importNames: ['ContextStore'], | ||
| message: 'Use makeContextStore (functional) instead of class ContextStore.', | ||
| }, | ||
| { | ||
| name: '@promethean/agents/agent-context', | ||
| importNames: ['DefaultContextManager', 'ContextManager'], | ||
| message: | ||
| 'This is agent state, not LLM conversation. Import makeAgentStateManager (or LegacyAgentStateManager alias) instead.', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
|
Comment on lines
+121
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainRemove or update references to non-existent The These rules will either fail to load or never trigger. They appear to be copied from another project's configuration. Verify if these packages exist: If these packages don't exist, remove these restriction rules: 'no-restricted-imports': [
'error',
{
- paths: [
- {
- name: '@promethean/persistence',
- importNames: ['ContextStore'],
- message: 'Use makeContextStore (functional) instead of class ContextStore.',
- },
- {
- name: '@promethean/agents/agent-context',
- importNames: ['DefaultContextManager', 'ContextManager'],
- message:
- 'This is agent state, not LLM conversation. Import makeAgentStateManager (or LegacyAgentStateManager alias) instead.',
- },
- ],
+ paths: [],
},
],🏁 Script executed: #!/bin/bash
# Search for @promethean packages in the codebase
echo "Searching for @promethean package usage..."
rg -n "@promethean/(persistence|agents)" --type ts --type js
echo ""
echo "Available workspace packages:"
cat package.json | jq -r '.workspaces.packages[]'Length of output: 134 Length of output: 265 Remove references to non-existent The restricted import rules reference Remove these restriction rules from lines 125-133: 'no-restricted-imports': [
'error',
{
paths: [
- {
- name: '@promethean/persistence',
- importNames: ['ContextStore'],
- message: 'Use makeContextStore (functional) instead of class ContextStore.',
- },
- {
- name: '@promethean/agents/agent-context',
- importNames: ['DefaultContextManager', 'ContextManager'],
- message:
- 'This is agent state, not LLM conversation. Import makeAgentStateManager (or LegacyAgentStateManager alias) instead.',
- },
],
},
],🤖 Prompt for AI Agents |
||
| }, | ||
| }, | ||
| { | ||
| files: ['**/src/scripts/**/*.ts'], | ||
| rules: { | ||
| // Loosen function length for script utilities | ||
| 'max-lines-per-function': ['warn', { max: 100, IIFEs: true }], | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.test.{ts,tsx,js}', '**/*.spec.{ts,tsx,js}', '**/tests/**/*.{ts,tsx,js}'], | ||
| plugins: { ava }, | ||
| rules: { | ||
| 'ava/no-only-test': 'error', | ||
| 'ava/no-identical-title': 'error', | ||
| 'ava/test-title': 'warn', | ||
| // your existing no-restricted-syntax for setTimeout | ||
| 'no-restricted-syntax': [ | ||
| 'error', | ||
| { | ||
| selector: "CallExpression[callee.name='setTimeout'][arguments.0.type='Identifier']", | ||
| message: | ||
| 'Use sleep from @promethean/test-utils instead of setTimeout for sleeps in tests.', | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // File with various linting errors | ||
|
|
||
| var unused_var = "this variable is never used" | ||
|
|
||
| function badFunction(param1, param2, extra_param) { | ||
| var x = 1 | ||
| var y = 2 | ||
|
|
||
| if (x == 1) { | ||
| console.log("use === instead of ==") | ||
| } | ||
|
|
||
| var result = param1 + param2 | ||
| console.log(result) | ||
|
|
||
| return | ||
| } | ||
|
|
||
| function anotherFunction() { | ||
| var a = 1, | ||
| b = 2, | ||
| c = 3 | ||
| console.log(a, b, c) | ||
| } | ||
|
|
||
| // Missing semicolons | ||
| var obj = { | ||
| name: "test", | ||
| value: 123, | ||
| } | ||
|
|
||
| // Trailing whitespace | ||
| var spaced = "hello" | ||
|
|
||
| // Unused function | ||
| function unusedFunction() { | ||
| return "never called" | ||
| } | ||
|
|
||
| // Mixed quotes | ||
| var single = "single quotes" | ||
| var double = "double quotes" | ||
|
|
||
| // Undefined variable | ||
| console.log(undefined_variable) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,17 @@ | ||
| { | ||
| "$schema": "https://opencode.ai/config.json" | ||
| "$schema": "https://opencode.ai/config.json", | ||
| "plugin": ["opencode-openai-codex-auth"], | ||
| "mcp": { | ||
| "weather": { | ||
| "type": "local", | ||
| "command": ["bun", "x", "@h1deya/mcp-server-weather"] | ||
| }, | ||
| "context7": { | ||
| "type": "remote", | ||
| "url": "https://mcp.context7.com/mcp", | ||
| "headers": { | ||
| "CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}" | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| preload = ["@opentui/solid/preload"] | ||
|
|
||
| [test] | ||
| preload = ["./test/preload.ts"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import js from "@eslint/js" | ||
| import typescript from "@typescript-eslint/eslint-plugin" | ||
| import typescriptParser from "@typescript-eslint/parser" | ||
|
|
||
| export default [ | ||
| js.configs.recommended, | ||
| { | ||
| files: ["**/*.ts"], | ||
| languageOptions: { | ||
| parser: typescriptParser, | ||
| parserOptions: { | ||
| ecmaVersion: "latest", | ||
| sourceType: "module", | ||
| }, | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": typescript, | ||
| }, | ||
| rules: { | ||
| // Enable some common linting rules to trigger errors | ||
| "no-unused-vars": "off", // Turn off base version for TypeScript | ||
| "no-console": "error", | ||
| "prefer-const": "error", | ||
| "no-var": "error", | ||
| "@typescript-eslint/no-unused-vars": "error", | ||
| "@typescript-eslint/no-explicit-any": "error", | ||
| }, | ||
| }, | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate .serena/ entry.
The
.serena/directory is listed twice (lines 14 and 16). Remove one of the duplicate entries to keep the .gitignore file clean.Apply this diff to remove the duplicate:
📝 Committable suggestion
🤖 Prompt for AI Agents