Skip to content

Conversation

@kbwo
Copy link
Owner

@kbwo kbwo commented Jan 17, 2026

Summary

  • Add per-project configuration support with .ccmanager.json files
  • Project settings override global settings with clear inheritance indication
  • Configuration UI now supports both Project and Global scopes
  • Use singleton pattern to ensure config changes are immediately visible to all components

Changes

New Files

  • src/services/projectConfigEditor.ts - Project-level config editor
  • src/services/configEditor.ts - Scope-aware config editor wrapper
  • src/services/configReader.ts - Merged config reader for runtime
  • src/contexts/ConfigEditorContext.tsx - React Context for config UI

Renamed

  • configurationManager.tsglobalConfigEditor.ts

Architecture

Configuration UI → ConfigEditor → singletons (global/project)
                                        ↓
Runtime Components ← ConfigReader ← singletons

All components use the same singletons, ensuring config changes are immediately reflected everywhere.

Test plan

  • Start app in single-project mode, verify 'P' opens Project Configuration
  • Verify 'C' opens Global Configuration
  • Create .ccmanager.json with shortcut override, verify it takes precedence
  • Update shortcut in Project Configuration, verify Session uses new shortcut immediately
  • Verify "Inheriting from global configuration" indicator appears when no project override exists

🤖 Generated with Claude Code

kbwo and others added 3 commits January 18, 2026 00:19
- Add ProjectConfigEditor for project-level config (.ccmanager.json)
- Add ConfigEditor for scope-aware config editing (project/global)
- Add ConfigReader for merged config reading (project > global priority)
- Rename configurationManager to globalConfigEditor for clarity
- Add ConfigEditorProvider React Context for configuration UI
- Update Configuration UI to show scope and inheritance status
- Update Menu to show Project/Global configuration options
- Use singleton pattern for consistent config state across components

BREAKING CHANGE: configurationManager is now globalConfigEditor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove CommandConfig interface and all associated code since command
presets (CommandPresetsConfig) replaced this functionality:

- Remove CommandConfig interface from types/index.ts
- Remove commandConfig property from Session interface
- Remove getCommandConfig/setCommandConfig from globalConfigEditor
- Remove getCommandConfig from configReader
- Simplify session creation by removing commandConfig parameter
- Update fallback handler to use default 'claude' command
- Update all test files to remove CommandConfig references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts by accepting both changes:
- ConfigureCommand.tsx: Keep origin/main's handleAddStrategySelect logic
- sessionManager.ts: Keep CommandConfig removal (HEAD) + stateDetector (origin/main)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kbwo kbwo linked an issue Jan 18, 2026 that may be closed by this pull request
kbwo and others added 15 commits January 18, 2026 11:48
Simplify ConfigEditor by removing the confusing getEffectiveXXX methods.
The getXXX methods now handle fallback to global config internally when
project config value is undefined.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move all config-related files into src/services/config/ directory and rename:
- globalConfigEditor -> globalConfigManager
- projectConfigEditor -> projectConfigManager

The globalConfigManager and projectConfigManager are now marked as internal
and should only be used within the config directory. External code should
use ConfigEditor or ConfigReader from the public index.ts exports.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GlobalConfigManager already provides default values, so the additional
fallbacks in ConfigReader were unnecessary.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move worktreeLastOpened state from config layer to worktreeService
  where it belongs (runtime state, not configuration data)
- Fix ConfigReader.reload() to reload both project and global configs
- Update sessionManager to import setWorktreeLastOpened from worktreeService
- Update tests to use actual setWorktreeLastOpened instead of mocking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use Either-based error handling for preset lookup in sessionManager
- Remove getPresetById from configReader and globalConfigManager
- Inline preset lookup logic into getPresetByIdEffect
- Fix Either type parameter order (CommandPreset, ValidationError)
- Update all test mocks to use getPresetByIdEffect

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move loadConfigEffect and validateConfig from globalConfigManager.ts
and configReader.ts to a dedicated testUtils.ts file. These functions
were only used in tests. The testUtils.ts file includes a clear warning
that it is for test use only.

getPresetByIdEffect remains in the main classes as it is used in
production code by sessionManager.ts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove methods that exist only in one of GlobalConfigManager or
ProjectConfigManager to ensure both classes implement only the
IConfigEditor interface consistently.

Deleted (unused in app):
- GlobalConfigManager: getConfiguration, setConfiguration,
  setAutoApprovalEnabled, setAutoApprovalTimeout
- ProjectConfigManager: getConfigPath, hasConfigFile

Moved to testUtils.ts (test-only):
- addPreset, deletePreset, setDefaultPreset
- getDefaultPreset, getSelectPresetOnStart, setSelectPresetOnStart
- isAutoApprovalEnabled, getPresetByIdEffect
- saveConfigEffect, setShortcutsEffect, setCommandPresetsEffect
- addPresetEffect, deletePresetEffect, setDefaultPresetEffect

The app now uses configReader which has its own implementations
of these methods, so globalConfigManager versions were redundant.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Split the config interface to better reflect read-only vs read-write usage:
- IConfigReader: provides read-only access to configuration
- IConfigEditor: extends IConfigReader with write capabilities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename test files from globalConfigManager.*.test.ts to configEditor.*.test.ts
- Update tests to use ConfigEditor with 'global' scope instead of GlobalConfigManager directly
- Update testUtils.ts to accept IConfigEditor interface instead of GlobalConfigManager
- Add reload() calls after ConfigEditor creation to pick up mocked filesystem

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused CommandPreset import from globalConfigManager.ts
- Fix prettier formatting in test files and testUtils.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GlobalConfigManager and ProjectConfigManager classes are now
private to their modules. Only singleton instances are exported.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When CCMANAGER_MULTI_PROJECT_ROOT is set, ProjectConfigManager
skips loading project config to ensure global config is used.
Added tests to verify this behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add getGitRepositoryRoot utility function in gitUtils.ts
- ProjectConfigManager now reads .ccmanager.json from git root
- Renamed constructor arg to 'cwd', fields to 'gitRoot' and 'configPath'
- Added tests to verify config is read/written to git root, not cwd

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add docs/project-config.md explaining project config feature
- Update README.md with Per-Project Configuration section
- Rename "Configuration" menu to "Global Configuration" in all docs
- Add references to project config where config.json is mentioned

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kbwo kbwo marked this pull request as ready for review January 19, 2026 15:07
@kbwo kbwo merged commit f7b2860 into main Jan 19, 2026
1 check passed
@kbwo kbwo deleted the feature/per-project-config-2026-01-17 branch January 19, 2026 15:09
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.

feat: Add per-project configuration support

2 participants