The initializeServices tests were failing in CI with "Response returned an
error code" because the refactored function now calls onboarding/auth modules
that make real API calls.
Changes:
- Added mocks for onboarding.js and auth/workos.js modules
- Enhanced modeService mock to include getToolPermissionService method
- Added serviceContainer mocks to prevent real service initialization
- Updated all test cases to use headless: true to skip onboarding flow
- Fixed test expectations to include isHeadless parameter
This ensures tests run in isolation without making network requests,
preventing CI failures due to authentication or network issues.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Enhanced isFilePath function to properly detect Windows absolute paths,
UNC paths, and paths with file extensions. This fixes test failures on
Windows where paths like "C:\Users\..." were incorrectly treated as
assistant slugs instead of file paths.
Changes:
- Added Windows drive letter pattern detection (C:\, D:\, etc.)
- Added UNC path detection (\\server\share)
- Added file extension detection (.yaml, .yml, .json)
Fixes Windows CI test failure: "Invalid assistant slug format" error
when --config points to non-existent Windows file paths.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added comprehensive environment detection in runOnboardingFlow to skip
interactive prompts in test/CI environments. Detects:
- NODE_ENV=test
- CI=true
- VITEST=true
- GITHUB_ACTIONS=true
- \!process.stdin.isTTY
This prevents "The current environment doesn't support interactive
reading from TTY" errors in GitHub Actions CI.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add environment detection in runOnboardingFlow to skip interactive prompts in CI/test environments
- Check for NODE_ENV=test, CI=true, VITEST=true, or lack of TTY
- Prevents "The current environment doesn't support interactive reading from TTY" errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix import order issues across multiple files
- Remove unused imports (loadAuthConfig, ValidationOptions)
- Add proper import group separations
- All lint checks and tests now pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
ESLint was reporting import order violations. Fixed by running
eslint --fix which properly ordered the imports according to
the project's import order rules.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The test file was still importing from '@jest/globals' instead of 'vitest',
causing CI failures. Updated to use vitest imports to match the project's
migration from Jest to Vitest.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Previously, typing "/org" would hide the suggestion immediately upon
completion. Now suggestions only disappear when user presses space
or Enter, making it clearer that the command is available to execute.
Fixes UX issue where users lose visual confirmation of valid commands.
Merged Sentry error tracking features with main branch changes:
- Integrated Sentry service with main branch logger architecture
- Preserved Sentry error capture functionality with improved error handling
- Combined import patterns and maintained compatibility
- Fixed logger.ts conflicts to include both Sentry integration and Winston logging
The merge conflict was handled by claude, please verify the changes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Merged explicit config path error handling with main branch changes:
- Preserved error handling for explicit --config flag failures
- Integrated with main branch service initialization patterns
- Maintained proper error propagation for config validation
The merge conflict was handled by claude, please verify the changes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Merge conflicts were handled by Claude AI - please verify the changes:
- src/commands/chat.ts: Integrated flag processing with main branch changes
- src/commands/serve.ts: Updated logger import and integrated flag processing
- src/services/index.ts: Updated logger import and maintained initialization logic
- src/services/index.test.ts: Accepted main branch version
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fix service initialization race condition where getAllTools() would return
all tools when ToolPermissionService wasn't ready, causing plan mode to
incorrectly include excluded tools like Bash.
The issue occurred in GitHub Actions where `cn -p` (plan mode) should exclude
Bash tool, but due to timing issues, Bash was being presented to the LLM and
then failing during execution with permission errors.
Changes:
- Fix getAllTools() to properly pass permissions to filterExcludedTools()
- Throw descriptive error when service not initialized instead of fallback
- Add comprehensive regression tests covering all modes and edge cases
Fixes automated PR review failures in GitHub Actions workflows.
The services/index.test.ts was failing in CI because it triggers the onboarding
flow which uses readlineSync, but CI environments don't have TTY access.
These tests are specifically for testing mode conversion logic (plan/auto/normal
to readonly/auto flags), not onboarding functionality. Onboarding is properly
tested in the dedicated onboarding.test.ts file.
- Add headless: true flag to all initializeServices() calls in tests
- This skips the onboarding flow and focuses on the actual logic being tested
- Maintains proper test coverage while fixing CI compatibility
Replaces scattered ad-hoc validation with a centralized, testable validation
system. Provides consistent error messages and comprehensive coverage of
flag combinations and edge cases.
Changes:
- Add flagValidator module with comprehensive validation functions
- Test coverage for all validation scenarios (17 tests)
- Replace scattered validation in index.ts with centralized validateFlags()
- Validate flag dependencies (--format/--silent require -p)
- Validate conflicting flags (--readonly vs --auto)
- Validate permission flag values (no empty tool names)
- Consistent error formatting and exit handling
All existing validation behavior preserved while adding new validations
for edge cases like empty permission tool names.
Eliminates major code duplication between TUI and headless modes by handling
onboarding internally within initializeServices(). Previously TUI mode called
initializeWithOnboarding() then startTUIChat() called initializeServices()
again, while headless mode called initializeServices() directly.
Changes:
- Add skipOnboarding option to ServiceInitOptions
- Modify initializeServices() to handle onboarding internally for TUI mode
- Remove duplicate initializeWithOnboarding() call from chat.ts TUI path
- Update startTUIChat() to skip initialization when already done
- Update serve.ts to use shared flag processing from Phase 1
This eliminates the dual initialization paths while preserving all existing
behavior. TUI mode now has single initialization path with proper onboarding.
Extract common flag processing logic from TUI and headless code paths into
shared flagProcessor module. This eliminates code duplication where both
paths independently converted readonly/auto flags to mode and structured
permission overrides.
Changes:
- Add src/flags/flagProcessor.ts with shared flag processing functions
- Replace duplicated logic in chat.ts (lines 168-173 and 259-264)
- Add comprehensive unit tests for all flag processing scenarios
- Add validation for conflicting --readonly and --auto flags
This is a pure refactor with no behavior changes. All existing functionality
preserved while eliminating 20+ lines of duplicated code.
Fixes issue where the --config flag was being ignored and the CLI would
silently fall back to ~/.continue/config.yaml instead of the specified
config file.
Changes:
- Add proper error handling in runNormalFlow() for explicit --config failures
- Fix config precedence in initializeServices() to prefer --config over saved state
- Add integration tests to verify config loading behavior
Resolves config loading falling back silently when explicit config path fails.