MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / handle_init

Method handle_init

crates/chat-cli/src/cli/chat/cli/checkpoint.rs:126–166  ·  view source on GitHub ↗
(&self, os: &Os, session: &mut ChatSession)

Source from the content-addressed store, hash-verified

124 }
125
126 async fn handle_init(&self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
127 if session.conversation.checkpoint_manager.is_some() {
128 execute!(
129 session.stderr,
130 StyledText::info_fg(),
131 style::Print(
132 "✓ Checkpoints are already enabled for this session! Use /checkpoint list to see current checkpoints.\n"
133 ),
134 StyledText::reset(),
135 )?;
136 } else {
137 let path = PathResolver::new(os)
138 .global()
139 .shadow_repo_dir()
140 .map_err(|e| ChatError::Custom(e.to_string().into()))?
141 .join(session.conversation.conversation_id());
142
143 let start = std::time::Instant::now();
144 session.conversation.checkpoint_manager = Some(
145 CheckpointManager::manual_init(os, path, session.conversation.history())
146 .await
147 .map_err(|e| ChatError::Custom(format!("Checkpoints could not be initialized: {e}").into()))?,
148 );
149
150 execute!(
151 session.stderr,
152 StyledText::info_fg(),
153 style::SetAttribute(Attribute::Bold),
154 style::Print(format!(
155 "📷 Checkpoints are enabled! (took {:.2}s)\n",
156 start.elapsed().as_secs_f32()
157 )),
158 StyledText::reset(),
159 StyledText::reset_attributes(),
160 )?;
161 }
162
163 Ok(ChatState::PromptUser {
164 skip_printing_tools: true,
165 })
166 }
167
168 async fn handle_restore(
169 &self,

Callers 1

executeMethod · 0.80

Calls 7

CustomClass · 0.85
joinMethod · 0.80
shadow_repo_dirMethod · 0.80
globalMethod · 0.80
to_stringMethod · 0.80
conversation_idMethod · 0.45
historyMethod · 0.45

Tested by

no test coverage detected