-
Notifications
You must be signed in to change notification settings - Fork 548
feat: Add multi-profile thoughts repository support (fixes #843) #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ryanrozich
wants to merge
5
commits into
humanlayer:main
Choose a base branch
from
ryanrozich:GH-843-multi-profile-thoughts-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Add multi-profile thoughts repository support (fixes #843) #859
ryanrozich
wants to merge
5
commits into
humanlayer:main
from
ryanrozich:GH-843-multi-profile-thoughts-support
Conversation
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
…ughts support - Add RepoMappingObject and ProfileConfig types to support profile-based configuration - Extend ConfigFile type to include optional profiles field - Update ThoughtsConfig interface to support both string and object mapping formats - Add ResolvedProfileConfig interface for profile resolution results - Implement resolveProfileForRepo() function for automatic profile detection - Add helper functions for mapping format conversion and profile validation - Update all path resolution functions with function overloads for backward compatibility Refs: humanlayer#843
- Add 'humanlayer thoughts profile create' command with interactive and non-interactive modes - Add 'humanlayer thoughts profile list' command with JSON output support - Add 'humanlayer thoughts profile show' command for viewing profile details - Add 'humanlayer thoughts profile delete' command with safety checks - Register all profile subcommands in thoughts command group - Support profile validation, sanitization, and usage tracking Users can now create and manage multiple named thoughts profiles for different organizational contexts (personal, client A, client B, etc.). Refs: humanlayer#843
- init: Add --profile option and early profile resolution (tempProfileConfig) - init: Use profile config for directory listings and path messages - init: Write object-format mappings when profile specified - sync: Resolve profile and use correct thoughtsRepo for git operations - status: Display profile information and use profile's repo for git status - config: Show profiles and handle new mapping format in display - uninit: Handle object-format mappings and show correct profile repo path All commands now automatically detect and use the correct profile based on repository mappings. Includes fix for bug where init command was using default thoughtsRepo for messages when --profile was specified. Refs: humanlayer#843
- Add comprehensive profile management section to README - Include examples of profile creation, usage, and management - Document --profile flag for init command - Explain profile features and use cases - Provide configuration examples Refs: humanlayer#843
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to 2f7ed8f in 1 minute and 0 seconds. Click for details.
- Reviewed
1341lines of code in13files - Skipped
0files when reviewing. - Skipped posting
10draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. hlyr/src/commands/thoughts.ts:21
- Draft comment:
Good addition of the '--profile' option to the init command. It clearly exposes multi-profile support. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. hlyr/src/commands/thoughts/config.ts:55
- Draft comment:
Profile details are now printed alongside repo mappings. The code cleanly distinguishes default vs. profile mappings. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. hlyr/src/commands/thoughts/init.ts:400
- Draft comment:
The profile validation logic is clear, but similar prompt functions are re‐implemented. Consider extracting a shared utility to reduce duplication. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
4. hlyr/src/commands/thoughts/init.ts:605
- Draft comment:
The update to repoMappings (object vs. string) is handled well for backward compatibility. Verify that downstream commands correctly interpret both formats. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
5. hlyr/src/commands/thoughts/profile/create.ts:20
- Draft comment:
The interactive prompts for profile creation work as intended. As with init, consider abstracting the prompt functionality to a common helper for maintainability. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
6. hlyr/src/commands/thoughts/sync.ts:238
- Draft comment:
Passing profileConfig.thoughtsRepo to syncThoughts works, but note that syncThoughts uses a legacy signature. Consider refactoring to accept a profile config object for consistency. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
7. hlyr/src/thoughtsConfig.ts:249
- Draft comment:
Overloaded functions (ensureThoughtsRepoExists, getRepoThoughtsPath, createThoughtsDirectoryStructure, updateSymlinksForNewUsers) correctly handle legacy and new profile support. Adding inline comments to explain the parameter differences could improve readability. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
8. hlyr/src/thoughtsConfig.ts:256
- Draft comment:
The sanitizeProfileName function reuses directory naming rules, which is consistent with other naming conventions. This is a good design choice. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
9. hlyr/src/config.ts:10
- Draft comment:
Type definitions for RepoMappingObject and ProfileConfig are clear and help support multi-profile functionality. No issues here. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
10. hlyr/src/commands/thoughts/uninit.ts:36
- Draft comment:
The uninit command properly handles profile-based configurations and informs the user of the associated profile mapping. This is clear and well implemented. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
Workflow ID: wflow_aDxfI6EThOVA64Oo
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
- Add 34 unit tests covering all profile-related functionality - Test resolveProfileForRepo() with all edge cases (string, object, invalid profiles) - Test helper functions (getRepoNameFromMapping, getProfileNameFromMapping) - Test profile validation and name sanitization - Test backward compatibility with legacy configs - All 61 tests passing (27 existing + 34 new) Coverage includes: - Profile resolution for string/object mappings - Fallback behavior for invalid profiles - Mixed legacy and new format mappings - Edge cases (undefined profiles, empty configs, special characters) - Profile name sanitization rules Refs: humanlayer#843
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.
feat: Add multi-profile thoughts repository support
Problem
Developers working across multiple organizations (personal projects, multiple clients) currently need to manually manage separate thoughts configurations through complex symlink setups. Each context requires switching configurations, making it difficult to maintain separate thought repositories for different work contexts.
Solution
This PR adds multi-profile support to the thoughts system, enabling developers to maintain separate thoughts repositories that automatically switch based on the current code repository.
Developer Experience:
Key Benefits:
Implementation
New Commands:
humanlayer thoughts profile create/list/show/delete- Manage profilesUpdated Commands:
init- Added--profileflag, uses profile-specific pathssync/status/config/uninit- Automatically detect and use correct profileCode Changes:
ProfileConfigandRepoMappingObjecttypes for configurationresolveProfileForRepo()for automatic profile detectionFiles Changed: 13 files (+799/-77 lines)
thoughtsConfig.tsVerification
Automated:
Test Coverage: Added comprehensive unit tests for profile resolution logic, including edge cases, backward compatibility, and helper functions (Vitest framework).
Manual Testing:
--profileflag--profileuses default)Migration
No migration required. Feature is opt-in:
--profilefor separate contextsRelated
thoughts/shared/plans/2025-11-13-GH-843-multi-profile-thoughts-support.mdSummary: Developers can now manage multiple thoughts repositories for different work contexts with simple profile commands, eliminating manual configuration while maintaining full backward compatibility.