Refactor: consolidate types, add shared utils, tests, and CI#25
Open
TOFFster96 wants to merge 3 commits intoJIGGAI:mainfrom
Open
Refactor: consolidate types, add shared utils, tests, and CI#25TOFFster96 wants to merge 3 commits intoJIGGAI:mainfrom
TOFFster96 wants to merge 3 commits intoJIGGAI:mainfrom
Conversation
- Add errorMessage() util, replace 30+ duplicate catch patterns - Add listRecipes/findRecipeById in lib/recipes - Add CronJob type and cronJobId/cronJobLabel/fmtCronSchedule in lib/cron - Add slugifyId in lib/slugify, use in goals, CloneTeamModal, goal-promote - Consolidate AgentListItem (lib/agents), GoalFrontmatter (lib/goals) - Move forceFrontmatterId to lib/recipes - Add safeJsonParse to lib/json - Use Pick<AgentListItem> for team agents in team-editor - Add Vitest, 300+ tests, pre-commit hook, CI workflow Co-authored-by: Cursor <cursoragent@cursor.com>
- Add jscpd copy-paste detection + .jscpd.json config - Add scripts/refactor-report.mjs (coverage gaps, patterns; Node fallback when rg missing) - Add dup:check and refactor:report npm scripts - Add report/jscpd to CI, upload artifact - ESLint: add report/** to ignores, SonarJS duplicate rules, no-os-command override for refactor script - Extract api-route-helpers (getTeamContext, listWorkspaceFiles) for teams/agents API - Extract ConfirmationModal, WorkspaceFileListSidebar, GoalFormFields - Refactor CloneTeamModal, DeleteTeamModal, DeleteRecipeModal, agent delete to use ConfirmationModal - Extract updateTeamAgents in team-editor; use WorkspaceFileListSidebar in team/agent editors - Extract parseCommaList, parseGoalResponse, loadGoal in goals flow - Add .husky/pre-push for dup:check - Improve promote route coverage (EEXIST, error handling tests) - Ignore refactor-report.md output Co-authored-by: Cursor <cursoragent@cursor.com>
- Extract tab panels into sub-components in team-editor and agent-editor to reduce cognitive complexity below limit (22 -> ≤15) - Deduplicate IdentityTabProps type in agent-editor (fixes jscpd) - Harden slugify against ReDoS (avoid slow regex) - Fix react-hooks/exhaustive-deps in channels-client - Remove CI continue-on-error for jscpd (0 clones) Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
|
Appreciate the work! Kitchen was released tonight. No more major changes coming for a few |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves maintainability and reliability by: (1) centralizing repeated patterns into shared utilities, (2) adding 301 tests with Vitest to catch regressions, and (3) adding pre-commit hook + GitHub Actions CI. All changes are non-breaking; behavior stays the same.
Benefits of Merging
What Changed
New shared utilities (in
src/lib/):errorMessage(e)— replaces 30+ copies ofe instanceof Error ? e.message : String(e)listRecipes()/findRecipeById()— centralizes recipe lookup instead of duplicating runOpenClaw + JSON.parseslugifyId()— shared slugification used by goals, CloneTeamModal, and goal-promotecronJobId()/cronJobLabel()/fmtCronSchedule()— consistent handling of cron job objectsforceFrontmatterId()— moved from team-editor intolib/recipessafeJsonParse()— extracted from channels intolib/jsonType consolidation:
AgentListItem— exported fromlib/agents, used across 5 call sitesGoalFrontmatter— used instead of duplicatedGoaltype in goals clientsRecipeDetail— used in RecipeEditor instead of localRecipeCronJob— exported fromlib/cronfor cron UIsTesting & CI:
src/lib/**(80%)Testing
npm run lint— passesnpm run test:run— 301 tests passnpm run coverage— meets configured thresholdsBreaking Changes
None. All changes are refactors and additions; public behavior is unchanged.
Made with Cursor