Skip to content

Conversation

@zanesq
Copy link
Collaborator

@zanesq zanesq commented Oct 3, 2025

Summary

Follow up for the larger refactor efforts mentioned in feedback on #4693

I had goose analyze my changes to help with my PR description:

Major Architectural Improvements

1. Hook Separation and Specialization

  • Split useAgent.ts: Extracted agent initialization logic into a dedicated useAgentInitialization.ts hook
  • Decomposed useRecipeManager.ts: Broke down the monolithic recipe manager into three specialized hooks:
    • useRecipeState.ts - Core recipe state management and validation
    • useRecipeUI.ts - UI-specific interactions and modal handling
    • useRecipeCreationModal.ts - Recipe creation modal logic
  • Reduced complexity: The main useAgent.ts went from 257 lines to just 61 lines

2. Improved State Management

  • Cleaner reset logic: Replaced forceReset and generic resetChat with targeted reset options:
    • resetSession - Creates new session ID
    • clearMessages - Clears chat messages
    • clearRecipe - Removes recipe configuration
    • clearRecipeParameters - Clears recipe parameters
  • Better initialization context: More explicit control over what gets reset during initialization

3. Enhanced Error Handling

  • Custom error types: Added specific error classes:
    • NoProviderOrModelError
    • AgentInitializationError
    • ConfigurationError
  • Better error boundaries: More granular error handling during agent initialization

4. Recipe Management Improvements

  • Unified save location: Both create and edit recipe modals now use the same save logic
  • Recipe launching while saving: Added ability to launch a recipe immediately after saving it
  • Consistent naming: Replaced recipeConfig with recipe throughout the codebase for consistency
  • Better parameter validation: Improved filtering of recipe parameters to only show those actually used

5. UI/UX Enhancements

  • Streamlined modals: Better modal state management and user flow
  • Improved recipe form: Enhanced recipe creation/editing with better validation
  • Auto-execution support: Better handling of scheduled recipe execution
  • Cleaner component structure: Reduced coupling between UI components and business logic

6. Code Quality Improvements

  • Better separation of concerns: UI logic separated from business logic
  • More testable code: Smaller, focused hooks are easier to test
  • Reduced duplication: Consolidated common recipe operations
  • Type safety: Added comprehensive TypeScript types for agent states and contexts

Key Benefits

  1. Maintainability: Code is now more modular and easier to understand
  2. Testability: Smaller, focused hooks with clear responsibilities
  3. Reliability: Better error handling and state management
  4. User Experience: More responsive UI with better modal handling
  5. Developer Experience: Cleaner APIs and more predictable behavior

zanesq added 10 commits October 1, 2025 12:35
…se into zane/create-recipe-unification-feedback

* 'zane/create-recipe-unification' of github.com:block/goose:
  feat(nightly): build nightlies from main shas (#4888)
  Add missing library for fedora/rhel/centos docs (#4819)
  feat(process): Add GOVERNANCE and MAINTAINERS documents (#4962)
  Pause test finder, have it run cargo fmt (#4958)
  Disable the issue comment trigger on pr-comment-bundle (#4961)
  fix(providers): update Claude Sonnet 4 model identifier (#4884)
  fix redirect to extensions page after deeplink install and show toast with success message (#4863)
  Remove wait-for-ready log (#4956)
…recipe while saving and remove unnecessary optional fields
…se into zane/create-recipe-unification-feedback

* 'zane/create-recipe-unification' of github.com:block/goose:
  Lifei/create save recipe to file (#4895)
@zanesq zanesq requested a review from DOsinga October 3, 2025 03:48
@zanesq
Copy link
Collaborator Author

zanesq commented Oct 3, 2025

Closing this so we can get a plan together first will bring over the ui changes to the original PR

@zanesq zanesq closed this Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants