Commit 82fe212
feat(cli): Add context management feature with profiles (#834)
* Execute build
* Trigger build (#33)
* Trigger Build (#34)
* docs: planning context feature
* Rename alias -> profile
* Detailed design
* Add todo list
* Updated detailed design
* Remove todo
* Add planning subdirs
* Add implementation plan
* implement prompt 1
* implement prompt 2
* Fix context.rs tests by adding module to chat/mod.rs and removing intentionally failing test
* Implement profile management functions for context feature
* Fix test visibility for context manager
* Fix context management implementation issues: add clear method and fix test references
* Update profile name validation to require alphanumeric first character
* Implement context file processing (prompt 4)
* Implement prompt 5: Extend the Command Enum and Parser for context management
* Implement command completion for context management feature
* Update help text with context management commands
* Implement prompt 8: Integrate with ConversationState
* Implement context command execution in main chat loop
* Update command prompt to indicate active context profile
* Add debug print statements
* Fix bugs
* feat(context): Add --expand flag to /context show
Implements the --expand flag for the /context show command to display
all files that match the glob patterns in the context configuration.
This helps users understand which files are actually being included
in the context.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* docs: Add development guidelines for Q CLI
Add documentation with guidelines for development practices, including
verification steps, commit message formatting, and git workflow best
practices. This helps ensure consistent development patterns across
the codebase.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* docs(context): Add profile rename implementation plan
Add detailed implementation plan for the context profile rename feature.
This includes a checklist to track implementation progress and detailed
code examples for each step of the implementation.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* Revert "Add debug print statements"
This reverts commit 99e401a35ea1bce5daacb60485f3b548a0faef49.
* feat(context): Add profile rename functionality
Add the ability to rename context profiles using the command:
/context profile --rename <old_name> <new_name>
This enhances the context management feature by allowing users to
rename their existing profiles without having to recreate them.
The implementation includes:
- Adding rename option to the ContextSubcommand enum
- Adding rename_profile method to the ContextManager
- Updating command parsing and execution flow
- Adding comprehensive unit tests
- Updating help text and command completion
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* fix(context): Add validation for paths in /context add command
Improve the validation logic for /context add to ensure paths exist before adding them.
- Return error if path doesn't exist or glob pattern doesn't match any files
- Add --force option to override validation and add non-existent paths
- Update tests to use the new force parameter
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* feat(cli): Add context command to welcome message
Add /context command to the welcome message to improve discoverability
of the context management feature for users.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* feat(cli): Enhance prompt display with context profile indicator
Implement colored profile indicator in the prompt when using a non-default
context profile. This improves user experience by making the active profile
more visible during chat sessions.
- Added cyan coloring for profile indicator in prompt
- Added unit tests for prompt generation with different profiles
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* feat(cli): Add profile flag to chat command
Implemented CLI flag for specifying a context profile at startup.
- Added profile validation to prevent errors with non-existent profiles
- Added unit tests for CLI flag handling
- Updated chat function to verify profile exists before starting
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(chat): Extract common test code into helper functions
Refactored command.rs test code to use helper functions for better maintainability
and readability. Removed duplicate test functions and improved documentation.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* fix(context): Fix glob pattern handling in context show --expand
When a glob pattern doesn't match any files in /context show --expand,
silently skip it instead of adding a placeholder entry.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* fix(context): Fix non-glob path handling in context show --expand
When a non-glob path doesn't exist in /context show --expand,
silently skip it instead of returning an error, similar to how
glob patterns are handled.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* test(context): Add integration tests for context management feature
Implement integration tests for the context management feature:
- Add tests for file system operations used by the context manager
- Add tests for JSON configuration persistence
- Add tests for profile operations
- Add tests for glob pattern expansion
- Add CLI-specific tests (marked as ignored)
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* test(context): Fix CLI integration tests for context management feature
- Remove /quit command that was causing errors
- Keep tests marked as ignored since they require the CLI binary
- Improve error messages for better debugging
- Split profile switch and delete operations into separate commands
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* development guidelines updates
* Move development.md to AmazonQ.md
* Minor AmazonQ.md changes
* docs(context): Update detailed design document for context management feature
- Update data structures to match current implementation
- Add details about the force flag for non-existent files
- Add details about profile renaming functionality
- Update command syntax with new options
- Focus on high-level structure rather than excessive code examples
- Add comprehensive error handling section
- List files to be modified and added
- Organize key components more clearly
- Add dedicated section explaining how context files are included in messages
- Add size considerations for large context files
- Improve document organization by avoiding redundancy
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* Organize design/implementation files
* fix(tests): Remove unused Path import in context_management_cli_test.rs
- Fix warning about unused import in CLI test file
- Simplify path imports to only include what's needed
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* fix(tests): Update context manager test to be more resilient
- Fix failing test that assumed context_manager would always be initialized
- Make test more resilient by checking conversation_id instead
- Ensure test passes in all environments
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(cli): Rename --profile flag to --context-profile for clarity
Renamed the CLI flag from --profile to --context-profile to make its purpose clearer
and avoid potential confusion with AWS profiles.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* docs: Minor tweak to AmazonQ.md
* docs(context): Convert trailing comment to doc comment
Convert the trailing comment for the rename field in ContextSubcommand::Profile
to a proper doc comment for better code documentation.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(context): Replace verbose file operations with simpler fs methods
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(context): Move standalone functions out of impl block
Move load_profile_config and load_global_config functions out of the
ContextManager impl block since they don't use self and don't construct
the type. This follows Rust best practices for associated functions.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* feat(context): Update default global context files
Update the default global context configuration to include:
- .amazonq/rules/**/*.md (updated path)
- README.md (new addition)
- AmazonQ.md (unchanged)
This provides better default context for new users.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* docs: removing design/implementation docs
- Removed most implementation docs (team will explore separate RFC repo
for this kind of documentation)
- Moved codebase-summary.md to project base dir as it's generally useful
* refactor: add telemetry, /profile, fix tests
* fix: update error messages when command parsing fails
---------
Co-authored-by: Chay Nabors <[email protected]>
Co-authored-by: Brandon Kiser <[email protected]>
Co-authored-by: Brandon Kiser <[email protected]>1 parent 8184a7b commit 82fe212
File tree
16 files changed
+1892
-46
lines changed- crates
- aws-toolkit-telemetry-definitions
- fig_telemetry_core/src
- fig_telemetry/src
- fig_util/src
- q_cli
- src/cli
- chat
16 files changed
+1892
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| |||
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
170 | | - | |
| 175 | + | |
| 176 | + | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| |||
685 | 686 | | |
686 | 687 | | |
687 | 688 | | |
688 | | - | |
| 689 | + | |
689 | 690 | | |
690 | 691 | | |
691 | 692 | | |
| 693 | + | |
692 | 694 | | |
693 | 695 | | |
694 | 696 | | |
| |||
784 | 786 | | |
785 | 787 | | |
786 | 788 | | |
787 | | - | |
| 789 | + | |
788 | 790 | | |
789 | 791 | | |
790 | 792 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
288 | 292 | | |
289 | 293 | | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
293 | 297 | | |
| 298 | + | |
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
| |||
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
| 407 | + | |
402 | 408 | | |
403 | 409 | | |
404 | 410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
326 | 339 | | |
327 | 340 | | |
328 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
0 commit comments