Improve type safety and code quality based on PR review comments:
- Convert PackButton.vue to TypeScript with proper type definitions
- Fix AbortSignal.reason comparison using strict equality instead of String()
- Extract magic number constant for API timeout in server configuration
These changes enhance type safety, improve code robustness, and increase
maintainability as suggested by automated code reviewers.
Implement cancel button for pack requests with improved user experience.
The button now shows "Cancel" on hover during processing and allows users
to abort ongoing requests. Also improved error messages for better clarity.
- Add cancel functionality to PackButton with hover state
- Implement request cancellation using AbortController
- Improve error messages for remote repository processing failures
- Update timeout handling and server configuration
- Add proper event handling to prevent form submission conflicts
Updated biome from v1.9.4 to v2.2.4 to take advantage of latest linting improvements.
- Upgraded @biomejs/biome from ^1.9.4 to ^2.2.4
- Updated biome.json configuration for v2 compatibility:
- Changed schema to 2.2.4
- Updated file includes/ignores syntax
- Added Vue file overrides to disable noUnusedVariables/noUnusedImports
- Fixed all lint errors:
- Added radix parameter to parseInt calls
- Prefixed unused parameters with underscore
- Removed unused imports
- Fixed biome suppression comments
- Removed !important from CSS
- Added type ignores for Vue component definitions
All 325 files now pass lint with 0 warnings and 0 errors.
Updates validation.ts to use Zod v4 API:
- Changed error.errors to error.issues
- Renamed parameter from err to issue for clarity
This resolves build errors after upgrading to Zod v4.
This change optimizes resource usage for the website server by reducing
the CPU allocation in the Cloud Run deployment configuration. The change
should maintain adequate performance while reducing operational costs.
- Extract isProduction constant to avoid magic strings
- Use ternary operator for more concise transport initialization
- Reuse isProduction constant for log level configuration
- Improve code readability and maintainability
Addresses feedback from @Copilot and @gemini-code-assist[bot]
- Separate transport configuration for production and development
- Production: Use only Cloud Logging transport to prevent duplicates
- Development: Use only Console transport for local debugging
- Fixes issue where Cloud Logging and Console transports caused duplicate log entries
- Move createErrorResponse function and ErrorResponse interface from logger.ts to utils/http.ts
- Update imports across packAction.ts, rateLimit.ts, and bodyLimit.ts
- Improve separation of concerns: logging utilities vs HTTP response utilities
- Maintains consistent error response format across the application
- Use FILE_SIZE_LIMITS constant instead of hardcoded value in packAction.ts
- Remove redundant URL validation check (Zod schema already validates)
- Use createErrorResponse for consistent error handling in rateLimit.ts
- Add try-catch for JSON.parse with proper error handling
- Enhance sanitizePattern to block Windows absolute and UNC paths for security
- Replace non-null assertion with type casting for better linting compliance
- Add calculateMemoryDiff function to utils/memory.ts for memory usage comparison
- Replace logMemoryUsage with detailed before/after memory tracking in packAction
- Include memory diff calculation in Pack operation completed logs
- Add input type (file/url) information to operation logs for better monitoring
- Create dedicated rateLimitMiddleware for better separation of concerns
- Remove rate limiting logic from packAction to focus on business logic
- Apply rate limiting at middleware layer for early request blocking
- Simplify packAction by removing rate limiting imports and checks
- Improve middleware ordering in index.ts for optimal request processing
This architectural improvement follows the middleware pattern and provides:
- Better security through early rate limiting
- Cleaner action layer focused on business logic
- Consistent middleware-based approach for cross-cutting concerns
- Improved reusability for future API endpoints
- Inline schema definitions for better readability and reduced complexity
- Remove intermediate variables (packOptionsSchema, fileSchema, isValidZipFile, ignorePatternRegex)
- Eliminate redundant manual validation checks already covered by Zod schema:
- Remove manual format enum validation (handled by z.enum)
- Remove manual file/url existence check (handled by schema refinements)
- Consolidate validation logic entirely within the Zod schema for consistency
This simplification follows the DRY principle and ensures all validation is handled uniformly through the schema-first approach.
Major improvements to the website server architecture following domain-driven design principles:
## Validation & Request Handling
- Move request validation from domain functions to packAction (action layer responsibility)
- Consolidate request schemas from separate files into packAction.ts for better colocation
- Create reusable utils/validation.ts for generic validation functionality
- Remove redundant validation.ts from actions directory
## Rate Limiting & Client Information
- Move rate limiting checks from domain functions to action layer
- Create utils/clientInfo.ts utility for centralized client information extraction
- Replace individual IP extraction with structured ClientInfo interface including IP, userAgent, and referer
- Update cloudLogger middleware to use unified clientInfo utility
## Code Organization
- Consolidate FILE_SIZE_LIMITS constants into domains/pack/utils/fileUtils.ts
- Remove unused constants.ts and schemas/request.ts files
- Rename middlewares/logger.ts to cloudLogger.ts with cloudLoggerMiddleware function for clarity
- Clean up domain function signatures by removing clientIp parameters
## Architecture Benefits
- Clear separation of concerns between action, domain, and utility layers
- Centralized validation and rate limiting at appropriate architectural boundaries
- Improved code reusability and maintainability
- Better error handling and client information management
This refactoring establishes a solid foundation for future feature development while maintaining backward compatibility.
This commit creates a dedicated middlewares directory and extracts Hono
middleware configurations from the main server file for better organization
and maintainability.
Changes:
- Create middlewares/ directory for middleware organization
- Extract cloudLogger middleware to middlewares/logger.ts:
- Move custom logging middleware with request tracking
- Generate unique request IDs and track request lifecycle
- Include memory usage and latency monitoring
- Fix type errors with proper function signatures
- Extract CORS configuration to middlewares/cors.ts:
- Define allowed origins and headers
- Handle development and production environments
- Extract body limit middleware to middlewares/bodyLimit.ts:
- Configure request size limits
- Handle file size exceeded errors
- Clean up utils/logger.ts:
- Remove middleware-specific code
- Export logger instance for reuse
- Focus on pure logging utilities
- Simplify index.ts:
- Import middleware from dedicated modules
- Remove inline middleware configurations
- Improve code readability and maintainability
This separation follows middleware best practices and makes the codebase
more modular while maintaining all existing functionality.
This commit reorganizes the utilities directory by moving pack-specific
utilities into the pack domain structure, following domain-driven design
principles.
Changes:
- Move pack-specific utilities to domains/pack/utils/:
- cache.ts: PackResult-specific caching functionality
- fileUtils.ts: ZIP processing and pack-related file operations
- validation.ts: Pack request validation logic
- sharedInstance.ts: Pack domain cache and rate limiter instances
- Keep generic utilities in utils/:
- errorHandler.ts: Application-wide error handling
- logger.ts: Cross-domain logging functionality
- memory.ts: Cross-domain memory monitoring
- network.ts: Cross-domain network utilities
- processConcurrency.ts: System-wide CPU information
- rateLimit.ts: Base rate limiting functionality
- time.ts: Cross-domain time processing
- Update all import paths to reflect new structure
- Maintain separation of concerns between domain-specific and generic utilities
This improves code organization by placing domain-specific logic within
the appropriate domain boundaries while keeping truly generic utilities
accessible across all domains.
This commit restructures the website server code to follow a domain-driven design pattern, improving maintainability and separation of concerns.
Changes:
- Create src/actions/ directory for API action handlers
- Create src/domains/pack/ directory for pack-related business logic
- Extract pack endpoint logic from index.ts into packAction.ts
- Move processZipFile.ts and remoteRepo.ts to domains/pack/
- Update all import paths to reflect new directory structure
- Simplify index.ts to focus on server configuration and routing
The new structure separates API routing (index.ts), action handlers (actions/),
and domain logic (domains/pack/) for better code organization.
- Update @typescript/native-preview from 7.0.0-dev.20250708.1 to 7.0.0-dev.20250824.1
- Update package-lock.json files for all subprojects to reflect the latest version
- Ensures compatibility with latest TypeScript native performance improvements
This keeps all packages in sync with the latest tsgo release for consistent type checking performance.
- Update browser/package.json to use tsgo instead of tsc for lint-tsc script
- Update website/client/package.json to use tsgo instead of tsc for lint-tsc script
- Update website/server/package.json to use tsgo instead of tsc for lint-tsc script
- Add @typescript/native-preview dependency to all subprojects for tsgo compatibility
This aligns with the main package.json which already uses tsgo for faster TypeScript type checking.
- Add oxlint as dev dependency and integrate into npm run lint
- Create oxlint configuration with warning levels for gradual adoption
- Add oxlint CI job to GitHub Actions
- Fix regex patterns flagged by oxlint:
- Remove unnecessary escape characters in file regex patterns
- Fix regex patterns in website validation and PHP test files
- Update lint script order: biome -> oxlint -> ts -> secretlint
oxlint provides 50-100x faster linting with 500+ rules from ESLint ecosystem.
Current warnings are configured as non-blocking to allow gradual improvement.
- Extract constants: FILE_SELECTION_WARNING_THRESHOLD and TabType to dedicated files
- Extract warning message to reusable FileSelectionWarning component
- Optimize performance: replace deep watch with shallow watch and use structuredClone
- Enhance accessibility: add comprehensive aria-label attributes to all interactive elements
- Strengthen error handling: add zero division protection for percentage calculation
- Improve code quality: enhance comments and maintain consistent type definitions
This refactoring improves code maintainability, performance, and user experience
while following Vue.js and accessibility best practices.
- Replace forEach loops with for...of loops for better performance
- Fix import ordering and spacing inconsistencies
- Simplify interface definitions and type declarations
- Add proper padding to tokens column in file selection table
- Remove unnecessary line breaks in computed properties
- Improve code readability and consistency across components
- Convert file list to table format with clickable rows and compact layout
- Add warning message when selecting more than 500 files
- Increase include patterns limit from 1,000 to 100,000 characters
- Auto-switch to Result tab when Re-pack button is clicked
- Fix re-pack loading state to use shared loading status
- Sort files by token count instead of character count
- Replace Package icon with custom SVG for re-pack button
- Add row hover effects and full-row click selection
- Implement proper file selection state management during re-pack
Add tokenCountTree option to CLI configuration to ensure token counts
are calculated for all files in the repository, not just the top files.
This is required for the file selection feature to display accurate
token statistics for each individual file.
The tokenCountTree option enables complete token count generation
across the entire repository structure, supporting the selective
re-packing functionality.
Adjusts RateLimiter configuration to allow more requests during development:
- Development: 10 requests per minute (increased from 3)
- Production: 3 requests per minute (unchanged)
This improves developer experience when testing file selection and
re-packing functionality without being overly restrictive during development.