Issue2/environment variables#14
Conversation
- Add environment variables configuration with Supabase integration - Configure Prettier for consistent code formatting - Set up ESLint with Next.js and Prettier integration - Install and configure Husky for Git hooks - Add lint-staged for pre-commit code formatting and linting - Implement commitlint for conventional commit message validation - Test all development scripts (dev, build, lint, type-check) - Verify Git hooks prevent bad commits and auto-format code
WalkthroughThis update standardizes environment variable naming in the backend by converting all configuration fields to uppercase with underscores and updates all references accordingly. The web frontend undergoes a comprehensive code style unification, converting double quotes to single quotes, removing semicolons, and condensing formatting. Additionally, Husky Git hooks and lint-staged configurations are introduced for commit and pre-commit checks. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Git as Git
participant Husky as Husky Hooks
participant LintStaged as lint-staged
participant CommitLint as commitlint
Dev->>Git: git commit
Git->>Husky: Trigger pre-commit & commit-msg hooks
Husky->>LintStaged: Run linting/formatting on staged files
Husky->>CommitLint: Lint commit message
CommitLint-->>Husky: Pass/Fail
Husky-->>Git: Allow or block commit
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 5
🔭 Outside diff range comments (3)
web/components/articles/article-card.tsx (1)
24-29: AvoidtoLocaleDateString()to prevent hydration mismatch & locale-dependent rendering
new Date(createdAt).toLocaleDateString()produces locale-specific output that can differ between the Node.js SSR render and the client browser, causing a React hydration warning. It also re-formats on every render.Consider pre-formatting the date with a deterministic library (e.g.
date-fns) or ISO slicing:-import { format } from 'date-fns' - -<small className="text-default-500">{new Date(createdAt).toLocaleDateString()}</small> +import { format } from 'date-fns' + +<small className="text-default-500"> + {format(new Date(createdAt), 'yyyy-MM-dd')} +</small>This keeps SSR/CSR output identical and avoids locale surprises.
ai-backend/main.py (1)
88-93: Agents are re-instantiated per request – heavy & defeats cachingInside
AgentOrchestrator.generate_article()you recreate all four agents even though they were already initialised in__init__. This adds unnecessary latency and resource usage.- configs = AgentConfigurations.get_all_configs() - data_collector = DataCollectorAgent(configs["data_collector"].parameters) - researcher = ResearchAgent(configs["researcher"].parameters) - writer = WritingAgent(configs["writer"].parameters) - editor = EditorAgent(configs["editor"].parameters) + # Re-use the long-lived agents initialised in __init__ + data_collector = self.data_collector + researcher = self.researcher + writer = self.writer + editor = self.editorIf thread-safety is a concern, wrap agent usage with locks instead of reinstantiating.
web/components/admin/dashboard.tsx (1)
52-55: Tailwind cannot statically analyze template-literal class names
className={text-${color}}is generated at runtime, so Tailwind’s JIT compiler will purge the resulting classes (text-primary, etc.) from the final CSS bundle.Map the colour to explicit class names instead:
const colorClass = { primary: 'text-primary', secondary: 'text-secondary', success: 'text-success', warning: 'text-warning', danger: 'text-danger', }[color] <div className={colorClass}>{icon}</div>This guarantees the classes are present in the build output.
🧹 Nitpick comments (17)
web/app/loading.tsx (1)
4-7: Consider adding an accessible label to the Spinner.Screen-reader users get no feedback while the page is in the loading state. Pass
aria-label(or similar prop supported by@heroui/react’sSpinner) or wrap withrole="status"+ visually-hidden text.- <Spinner size="lg" /> + <Spinner size="lg" aria-label="Loading content…" />web/app/layout.tsx (2)
7-10: Consider typingmetadataexplicitly
Addingas const(or an explicitMetadatatype fromnext) ensures the object remains read-only and benefits from stronger IntelliSense in consuming files.-export const metadata = { - title: 'Sport Scribe - AI-Powered Sports Journalism', - description: 'Intelligent sports journalism platform using multi-agent AI', -} +export const metadata = { + title: 'Sport Scribe - AI-Powered Sports Journalism', + description: 'Intelligent sports journalism platform using multi-agent AI', +} as const
14-16: DuplicatesuppressHydrationWarningattribute
You’re passingsuppressHydrationWarningto both<html>and<body>. The Next.js docs recommend applying it only to the element whose mismatches you expect (typically<body>). Keeping it in two places is redundant and may mask unexpected hydration issues higher up.-<html lang="en" suppressHydrationWarning> +<html lang="en">web/app/error.tsx (2)
6-12: Suppress thenoShadowRestrictedNameslint warning in-place rather than renaming the componentThe component must be exported as
Errorfor Next 13’serror.tsxconvention to work.
Renaming it would break the automatic error boundary, but the current name shadows the global
Errorconstructor, which triggerslint/suspicious/noShadowRestrictedNames.Silence the rule locally so the Husky / lint-staged pipeline stays green:
-export default function Error({ +// biome-ignore lint/suspicious/noShadowRestrictedNames -- Next.js requires the component to be named `Error`. +export default function Error({
14-15: Consider routing errors to an external logger instead ofconsole.errorBrowser consoles are easily missed in production. Forwarding
errorto a telemetry
service (e.g. Sentry, LogRocket) gives you alerting and traceability.No action required for functionality, but worth adding before release.
web/app/globals.css (1)
21-22: Prefer explicit comma to delimit the gradient layer from the fallback colorCSS accepts the current shorthand, but adding an explicit comma between the
linear-gradientand the solid color makes the two background layers unambiguous and aligns with common style-guide recommendations.- background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))) - rgb(var(--background-start-rgb)); + background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb))), + rgb(var(--background-start-rgb));web/components/ui/hero-input.tsx (1)
7-9: Preserve refs withReact.forwardRef
WrappingInputin your own component drops the consumer’sref, which is frequently needed for focusing/error handling. Consider:-import { Input, InputProps } from '@heroui/react' +import { forwardRef } from 'react' +import { Input, InputProps } from '@heroui/react' -export function HeroInput({ ...props }: HeroInputProps) { - return <Input {...props} /> -} +export const HeroInput = forwardRef<HTMLInputElement, HeroInputProps>( + (props, ref) => <Input ref={ref} {...props} />, +)web/app/admin/page.tsx (1)
33-34: Semicolon removal is purely stylistic
Just ensuresemi:false(or equivalent) is enforced in the shared Prettier config to avoid churn.web/app/not-found.tsx (1)
5-13: Optional: addmetadatafor better 404 SEO
Although outside the style diff, addingexport const metadata = { title: '404 – Not Found' }helps Next.js set correct meta tags.web/components/ui/hero-button.tsx (1)
7-9: Forward refs for better composability
As withHeroInput, expose the underlyingButtonref viaReact.forwardRefto allow consumers to call.focus()etc.web/tailwind.config.js (1)
6-10: Avoid scanning non-existenttsxfiles insidenode_modulesto keep Tailwind compilation fast
@heroui/theme/distonly ships JavaScript; including*.tsxwill cause Tailwind to walk thousands of files that cannot possibly contain class names, slowing startup & HMR.- './node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}', + './node_modules/@heroui/theme/dist/**/*.{js,ts}',web/components/ui/loading-wrapper.tsx (1)
11-19: Minor naming/readability nit
mountedis a boolean; prefixing withis/hasmakes intent clearer and avoids the occasional “mounted is not a function” typo.- const [mounted, setMounted] = useState(false) + const [isMounted, setIsMounted] = useState(false) ... - if (!mounted) { + if (!isMounted) { return fallback || null }web/app/api/webhooks/article-generated/route.ts (1)
13-21: Replaceconsole.*with the project’s logger before shippingRaw
console.log/errorcalls get dropped in serverless prod and make log aggregation harder.
Hook into whatever structured logger the rest of the API uses (e.g.pino,winston,next-logger) once the TODO items are addressed.web/.husky/pre-commit (1)
4-4: Harden the directory switchIf the repo root is renamed or contains spaces the unquoted
cdcould fail silently. Minor but cheap to fix:-cd web && npx lint-staged +cd "web" || exit 1 +npx lint-stagedAdds a guard and quotes the path.
web/components/articles/related-articles.tsx (1)
20-22: Minor perf-win: memoise the 3-item slice
articles.slice(0, 3)re-runs on every render, even whenarticleshasn’t changed. Wrapping the slice inuseMemo(keyed byarticles) prevents needless allocations on re-renders from an unrelated state change.+ const topThree = React.useMemo(() => articles.slice(0, 3), [articles]) … - {articles.slice(0, 3).map((article) => ( + {topThree.map((article) => ( <ArticleCard key={article.id} {...article} /> ))}web/components/articles/article-content.tsx (1)
34-38: Avoid using list index as React key
Using the array index as thekeycan cause unnecessary DOM churn if paragraph order ever changes. A stable key (e.g., a hash of the paragraph text) is safer.- {content.split('\n').map((paragraph, index) => ( - <p key={index} className="mb-4"> + {content + .split('\n') + .filter(Boolean) + .map((paragraph) => ( + <p key={paragraph.slice(0, 40)} className="mb-4"> {paragraph} </p> ))}web/components/admin/article-manager.tsx (1)
28-92: Component length exceeds 50-line threshold – extract aManagedArticleRowsub-componentStatic analysis flagged 60 LOC. Splitting the table row rendering into its own component will:
- Satisfy the linter
- Improve readability & testability
- Reduce re-render surface area when memoised
No diff given because the refactor spans multiple sections.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (52)
ai-backend/config/settings.py(3 hunks)ai-backend/main.py(4 hunks)ai-backend/utils/logging.py(1 hunks)scripts/seed-data.py(4 hunks)web/.husky/commit-msg(1 hunks)web/.husky/pre-commit(1 hunks)web/.lintstagedrc.json(1 hunks)web/app/admin/analytics/page.tsx(2 hunks)web/app/admin/articles/page.tsx(2 hunks)web/app/admin/page.tsx(2 hunks)web/app/api/analytics/route.ts(2 hunks)web/app/api/articles/[id]/route.ts(1 hunks)web/app/api/articles/route.ts(1 hunks)web/app/api/health/route.ts(1 hunks)web/app/api/webhooks/article-generated/route.ts(1 hunks)web/app/articles/[id]/page.tsx(2 hunks)web/app/articles/page.tsx(2 hunks)web/app/error.tsx(2 hunks)web/app/globals.css(1 hunks)web/app/layout.tsx(1 hunks)web/app/loading.tsx(1 hunks)web/app/not-found.tsx(2 hunks)web/app/page.tsx(2 hunks)web/app/providers.tsx(1 hunks)web/app/sports/[sport]/page.tsx(1 hunks)web/app/sports/page.tsx(2 hunks)web/commitlint.config.js(1 hunks)web/components/admin/analytics-panel.tsx(5 hunks)web/components/admin/article-manager.tsx(3 hunks)web/components/admin/dashboard.tsx(8 hunks)web/components/articles/article-card.tsx(4 hunks)web/components/articles/article-content.tsx(2 hunks)web/components/articles/article-grid.tsx(2 hunks)web/components/articles/related-articles.tsx(2 hunks)web/components/layout/footer.tsx(1 hunks)web/components/layout/header.tsx(1 hunks)web/components/layout/navigation.tsx(2 hunks)web/components/ui/hero-button.tsx(1 hunks)web/components/ui/hero-card.tsx(1 hunks)web/components/ui/hero-input.tsx(1 hunks)web/components/ui/hero-navbar.tsx(2 hunks)web/components/ui/loading-wrapper.tsx(1 hunks)web/components/ui/theme-provider.tsx(2 hunks)web/contexts/auth-context.tsx(1 hunks)web/contexts/theme-context.tsx(1 hunks)web/hooks/use-analytics.ts(1 hunks)web/hooks/use-articles.ts(2 hunks)web/hooks/use-supabase.ts(1 hunks)web/next.config.js(1 hunks)web/package.json(1 hunks)web/postcss.config.js(1 hunks)web/tailwind.config.js(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (11)
web/app/api/webhooks/article-generated/route.ts (1)
web/app/api/articles/route.ts (1)
POST(24-39)
web/components/layout/header.tsx (1)
web/components/ui/hero-navbar.tsx (1)
HeroNavbar(4-35)
web/app/providers.tsx (2)
web/components/ui/theme-provider.tsx (1)
ThemeProvider(7-31)web/contexts/theme-context.tsx (1)
ThemeProvider(15-70)
web/components/articles/related-articles.tsx (1)
web/components/articles/article-card.tsx (1)
ArticleCardProps(4-11)
web/components/articles/article-grid.tsx (1)
web/components/articles/article-card.tsx (1)
ArticleCardProps(4-11)
web/components/ui/theme-provider.tsx (1)
web/contexts/theme-context.tsx (1)
ThemeProvider(15-70)
web/hooks/use-analytics.ts (2)
web/components/admin/analytics-panel.tsx (1)
AnalyticsData(3-11)web/app/error.tsx (1)
Error(6-25)
web/hooks/use-supabase.ts (1)
web/lib/supabase/client.ts (1)
createClient(4-8)
web/app/api/articles/[id]/route.ts (3)
web/app/api/analytics/route.ts (1)
GET(4-24)web/app/api/health/route.ts (1)
GET(3-10)web/app/api/articles/route.ts (1)
GET(4-21)
web/components/admin/analytics-panel.tsx (1)
web/hooks/use-analytics.ts (1)
AnalyticsData(5-22)
web/app/layout.tsx (1)
web/app/providers.tsx (1)
Providers(6-12)
🪛 Biome (1.9.4)
web/app/error.tsx
[error] 6-6: Do not shadow the global "Error" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
🪛 GitHub Check: Codacy Static Code Analysis
web/components/admin/article-manager.tsx
[warning] 28-28: web/components/admin/article-manager.tsx#L28
Method ArticleManager has 60 lines of code (limit is 50)
🪛 Pylint (3.3.7)
ai-backend/config/settings.py
[error] 60-60: Method 'validate_openai_key' should have "self" as first argument
(E0213)
[error] 68-68: Method 'validate_supabase_url' should have "self" as first argument
(E0213)
[error] 76-76: Method 'validate_environment' should have "self" as first argument
(E0213)
[error] 83-83: Method 'validate_log_level' should have "self" as first argument
(E0213)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (49)
web/app/loading.tsx (1)
1-1: Style change aligns with repo-wide conventions – looks good.
Nothing functional here, import path remains untouched; switch to single quotes is consistent with the new Prettier rules.web/app/layout.tsx (1)
1-3: Stylistic cleanup looks good
Imports were updated to single quotes and unused semicolons removed, aligning with the new Prettier rules introduced in this PR. 👍web/components/ui/hero-input.tsx (1)
1-1: Style change looks good
Quotes are now single and consistent with the repo’s new Prettier rules.web/app/admin/page.tsx (1)
1-2: Consistent import style – LGTM
Single-quote conversion aligns with repo standards.web/app/not-found.tsx (1)
1-2: Import quote update confirmed
Matches the global formatting rules.web/components/layout/footer.tsx (1)
12-13: Trailing semicolon dropped—fine
No functional impact; consistent with new lint rules.web/components/ui/hero-button.tsx (1)
1-1: Import quote change approved
Aligns with project formatting.web/app/api/analytics/route.ts (1)
1-24: LGTM! Code style standardization looks good.The stylistic changes consistently convert double quotes to single quotes and remove unnecessary semicolons, improving code consistency across the codebase without affecting functionality.
web/app/page.tsx (1)
1-26: LGTM! Consistent formatting improvements.The stylistic changes enhance code consistency by standardizing quote usage and improving JSX formatting without altering component functionality.
web/app/api/health/route.ts (1)
1-10: LGTM! Stylistic improvements are consistent.The quote style standardization aligns with the broader code formatting improvements across the project.
web/postcss.config.js (1)
6-6: LGTM! Semicolon removal is consistent with modern style.The formatting change aligns with the project's code style standardization while maintaining valid JavaScript syntax.
web/components/layout/navigation.tsx (1)
1-27: LGTM! Comprehensive stylistic improvements.The formatting changes consistently apply the new code style standards across imports, data structures, and JSX return statements without affecting component functionality.
web/next.config.js (1)
6-8: LGTM! Stylistic changes are syntactically correct.The removal of semicolons is valid JavaScript and aligns with the code style standardization effort. These changes don't introduce syntax errors as JavaScript supports automatic semicolon insertion (ASI).
web/components/ui/theme-provider.tsx (2)
1-12: LGTM! Consistent code style standardization.The changes properly standardize the code style by converting double quotes to single quotes and removing semicolons. These modifications align with the PR's code formatting objectives and don't affect the component's functionality.
30-30: LGTM! Return statement formatting is improved.The condensed return statement formatting enhances readability while maintaining the same functionality.
web/app/sports/page.tsx (2)
1-4: LGTM! Import statements and array formatting standardized.The conversion to single quotes and condensed array formatting improves code consistency and readability without affecting functionality.
18-26: LGTM! JSX formatting improvements.The condensed Button component props and return statement formatting enhance code readability while maintaining the same functionality.
web/components/ui/hero-card.tsx (2)
1-8: LGTM! Interface and import standardization.The conversion to single quotes and removal of semicolons in the interface properties aligns with the code style standards. The component's TypeScript interface remains functionally identical.
15-15: LGTM! Return statement formatting improved.The condensed return statement formatting enhances readability while maintaining the same component functionality.
web/app/sports/[sport]/page.tsx (2)
1-7: LGTM! Import and interface standardization.The conversion to single quotes and removal of semicolons in the interface properties maintains consistent code style throughout the codebase. The component's functionality remains unchanged.
12-25: LGTM! JSX formatting improvements.The condensed JSX element formatting and return statement improve code readability while preserving the same page functionality and dynamic routing behavior.
web/hooks/use-supabase.ts (1)
1-56: LGTM! Consistent stylistic improvements applied.The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for Supabase authentication, session management, and auth state handling remains intact and unchanged.
web/contexts/theme-context.tsx (1)
1-78: LGTM! Consistent stylistic improvements applied.The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for theme management, localStorage persistence, and system theme detection remains intact and unchanged.
web/hooks/use-articles.ts (1)
1-176: LGTM! Consistent stylistic improvements applied.The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for article management, including data fetching, filtering, validation, and error handling, remains intact and unchanged.
web/hooks/use-analytics.ts (1)
1-61: LGTM! Consistent stylistic improvements applied.The formatting changes successfully standardize the code style by converting double quotes to single quotes and removing trailing semicolons. All functional logic for analytics data management, including API calls, error handling, and state management, remains intact and unchanged.
web/app/api/articles/[id]/route.ts (1)
1-52: LGTM! Consistent stylistic improvements applied.The formatting changes successfully standardize the code style by converting double quotes to single quotes and consolidating multiline function parameters. All functional logic for the article API endpoints (GET, PUT, DELETE) remains intact and unchanged, with placeholder implementations preserved for future database integration.
web/app/articles/page.tsx (1)
1-20: LGTM – purely stylistic touches
No behavioural changes detected; import path and JSX still valid.web/app/admin/analytics/page.tsx (1)
1-35: Looks good – style unification only
No functional alterations; component still renders as before.web/components/layout/header.tsx (1)
1-9: Header refactor approved
Import path and JSX remain correct; change is cosmetic.web/app/admin/articles/page.tsx (1)
17-18: Looks good – style-only touch-up
No functional deltas; the split string still renders as expected.web/package.json (1)
42-44: Husky hook wired correctly
The trailing comma plus the newpreparescript conform to Husky’s install pattern. 👍web/components/ui/hero-navbar.tsx (1)
1-2: LGTM – consolidated imports only
Pure formatting; no functional changes introduced.web/.husky/commit-msg (1)
1-4: LGTM! Well-structured Husky commit-msg hook.The script correctly follows Husky conventions by sourcing the environment setup, changing to the appropriate directory, and running commitlint with the commit message file argument.
web/.lintstagedrc.json (1)
1-5: LGTM! Comprehensive lint-staged configuration.The configuration properly handles different file types with appropriate tooling:
- ESLint with auto-fix followed by Prettier for TypeScript/JavaScript files
- Prettier-only formatting for JSON, Markdown, and CSS files
This ensures consistent code quality and formatting across the project.
web/commitlint.config.js (1)
1-18: LGTM! Well-configured commitlint setup.The configuration correctly extends the conventional commitlint config and defines a comprehensive set of commit types with helpful comments. The error-level enforcement ensures strict adherence to commit message standards.
web/app/articles/[id]/page.tsx (3)
1-1: LGTM! Consistent import formatting.The change from double quotes to single quotes aligns with the project's code style standardization.
5-6: LGTM! Consistent interface formatting.The removal of trailing semicolons follows modern TypeScript conventions and maintains consistency with the project's formatting standards.
19-24: LGTM! Consistent JSX formatting.The condensed formatting maintains readability while following the project's style guidelines.
ai-backend/utils/logging.py (1)
127-128: ✔ Settings configuration updated to use uppercase attributesThe
Settingsclass in ai-backend/config/settings.py now defines and validates bothLOG_LEVEL(line 50) andLOG_FORMAT(line 51), and these are consistently referenced inmain.pyandutils/logging.py. No further changes are needed—LGTM.web/components/articles/article-grid.tsx (1)
1-14: LGTM – purely stylistic changes
No functional or performance concerns spotted.scripts/seed-data.py (4)
13-20: Good practice: Environment variable loading with graceful fallback.The dotenv loading implementation handles the missing dependency gracefully while providing clear installation instructions. This ensures the script can work in environments where python-dotenv isn't installed.
75-75: Appropriate change for AI-generated content representation.Changing from
"author"to"author_id": Noneis a logical improvement that properly represents AI-generated content in the data model, aligning with relational database design principles.
178-179: Confirm database schema fortagscolumnIt appears that in
scripts/seed-data.pywe’re correctly keepingtagsas an array (and the JSON‐dump line is commented out), and there are no other code paths convertingtagsto strings. Before merging, please verify that your database schema and any ORM/model definitions expect and persisttagsas an array type (e.g.TEXT[]orJSONB) rather than a JSON string.Files/locations to double‐check:
- supabase/migrations/*.sql (look for
CREATE TABLE articlesand thetagscolumn definition)- Any ORM or schema files (GraphQL, Pydantic models, etc.) referencing
tagsNo changes to application code are needed if your
tagscolumn is already defined as an array.
56-56: Verify support for the new “final” game statusI searched the codebase for any database models or application logic that define or validate game status values and did not find an enum/constraint for game.status. Please ensure that:
- Your database schema (e.g. enum column, constraint, migration) allows “final” as a valid game status
- Any service or query consuming the game.status field is updated to handle “final” (instead of “completed”)
File needing attention:
- scripts/seed-data.py (around line 56):
"status": "final",web/components/admin/analytics-panel.tsx (1)
1-91: LGTM: Consistent code style improvements.The changes are purely stylistic, converting double quotes to single quotes and removing semicolons for consistency with the project's code style. The component's functionality, TypeScript interfaces, and rendering logic remain unchanged.
ai-backend/config/settings.py (4)
24-58: Excellent: Systematic environment variable naming standardization.The conversion to uppercase with underscores (e.g.,
OPENAI_API_KEY,SUPABASE_URL) follows standard environment variable naming conventions and improves consistency across the application.
59-95: Validator decorators correctly updated.All Pydantic validator decorators have been properly updated to reference the new uppercase field names. The static analysis hints about missing "self" parameter are false positives - Pydantic validators correctly use
clsas the first argument.
100-111: Dictionary method properly updated for new field names.The
to_dictmethod correctly references all the new uppercase field names while maintaining the same return structure and excluding sensitive values.
120-121: Good addition: Backward compatibility support.Adding
populate_by_name = Trueto the Pydantic Config allows the settings to be populated using both the new field names and any potential aliases, providing backward compatibility during the transition.
- Replace deprecated Math.random().toString(36).substr() with crypto.randomUUID() for robust ID generation in articles API route - Optimize auth context performance by stabilizing Supabase client instance using useMemo to prevent unnecessary re-subscriptions - Fix SSR hydration risk in article manager by using deterministic date formatting with fixed 'en-CA' locale - Improve article manager component by extracting getStatusColor function outside component and adding proper TypeScript typing with union types - Remove redundant HeroUIProvider wrapper in providers to eliminate unnecessary nesting and potential context identity issues - Fix TypeScript version compatibility warning by downgrading to 5.3.3 to match @typescript-eslint/typescript-estree supported range
🛠️ Development Environment Setup
📋 Description
This PR completes the development environment setup with proper environment variables, development tools, and code quality tools. This ensures consistent development practices across the team.
🎯 Changes Made
Environment Configuration
.env.localwith Supabase configurationCode Quality Tools
✅ Prettier: Configured for consistent code formatting
.prettierrcwith team standards.prettierignorefor exclusions✅ ESLint: Set up with Next.js integration
.eslintrc.jsonwith Next.js and PrettierGit Hooks & Commit Standards
✅ Husky: Installed and configured Git hooks
✅ lint-staged: Configured for staged file processing
✅ commitlint: Enforces conventional commit messages
Development Scripts
npm run dev- Development servernpm run build- Production buildnpm run lint- Code lintingnpx tsc --noEmit- TypeScript checking🧪 Testing
📁 Files Added/Modified
New Files
web/.env.local- Environment configurationweb/.lintstagedrc.json- Lint-staged configurationweb/commitlint.config.js- Commit message validationweb/.husky/pre-commit- Pre-commit Git hookweb/.husky/commit-msg- Commit message Git hookModified Files
web/package.json- Added prepare script for Huskyweb/.prettierrc- Prettier configurationweb/.eslintrc.json- ESLint configuration🎯 Acceptance Criteria
.env.localfile created with placeholder valuesnpm run lintcompletes without errorsnpx prettier --check .shows all files are formatted🚀 Ready for Development
The development environment is now fully configured with:
📚 Resources
Type:
featBreaking Changes: None
Testing: All development scripts tested and working
Summary by CodeRabbit
Chores
Style
Bug Fixes
Documentation