File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ use crate::cli::ConversationState;
2323use crate :: os:: Os ;
2424
2525// The shadow repo path that MUST be appended with a session-specific directory
26- pub const SHADOW_REPO_DIR : & str = "/Users/kiranbug/.amazonq/captures/" ;
26+ // pub const SHADOW_REPO_DIR: &str = "/Users/kiranbug/.amazonq/captures/";
2727
2828// CURRENT APPROACH:
2929// We only enable automatically enable checkpoints when the user is already in a git repo.
Original file line number Diff line number Diff line change 11use std:: io:: Write ;
2- use std:: path:: PathBuf ;
32
43use clap:: Subcommand ;
54use crossterm:: style:: {
@@ -16,14 +15,14 @@ use eyre::Result;
1615use crate :: cli:: chat:: capture:: {
1716 Capture ,
1817 CaptureManager ,
19- SHADOW_REPO_DIR ,
2018} ;
2119use crate :: cli:: chat:: {
2220 ChatError ,
2321 ChatSession ,
2422 ChatState ,
2523} ;
2624use crate :: os:: Os ;
25+ use crate :: util:: directories:: get_shadow_repo_dir;
2726
2827#[ derive( Debug , PartialEq , Subcommand ) ]
2928pub enum CaptureSubcommand {
@@ -68,7 +67,8 @@ impl CaptureSubcommand {
6867 )
6968 ) ?;
7069 } else {
71- let path = PathBuf :: from ( SHADOW_REPO_DIR ) . join ( session. conversation . conversation_id ( ) ) ;
70+ let path = get_shadow_repo_dir ( os, session. conversation . conversation_id ( ) . to_string ( ) )
71+ . map_err ( |e| ChatError :: Custom ( e. to_string ( ) . into ( ) ) ) ?;
7272 let start = std:: time:: Instant :: now ( ) ;
7373 session. conversation . capture_manager = Some (
7474 CaptureManager :: manual_init ( os, path)
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ pub enum DirectoryError {
4343type Result < T , E = DirectoryError > = std:: result:: Result < T , E > ;
4444
4545const WORKSPACE_AGENT_DIR_RELATIVE : & str = ".amazonq/cli-agents" ;
46+ const GLOBAL_SHADOW_REPO_DIR : & str = ".aws/.amazonq/cli-captures" ;
4647const GLOBAL_AGENT_DIR_RELATIVE_TO_HOME : & str = ".aws/amazonq/cli-agents" ;
4748const CLI_BASH_HISTORY_PATH : & str = ".aws/amazonq/.cli_bash_history" ;
4849
@@ -249,6 +250,10 @@ pub fn get_mcp_auth_dir(os: &Os) -> Result<PathBuf> {
249250 Ok ( home_dir ( os) ?. join ( ".aws" ) . join ( "sso" ) . join ( "cache" ) )
250251}
251252
253+ pub fn get_shadow_repo_dir ( os : & Os , conversation_id : String ) -> Result < PathBuf > {
254+ Ok ( home_dir ( os) ?. join ( GLOBAL_SHADOW_REPO_DIR ) . join ( conversation_id) )
255+ }
256+
252257/// Generate a unique identifier for an agent based on its path and name
253258fn generate_agent_unique_id ( agent : & crate :: cli:: Agent ) -> String {
254259 use std:: collections:: hash_map:: DefaultHasher ;
You can’t perform that action at this time.
0 commit comments