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

Method execute

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

Source from the content-addressed store, hash-verified

86
87impl CheckpointSubcommand {
88 pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
89 // Check if checkpoint is enabled
90 if !ExperimentManager::is_enabled(os, ExperimentName::Checkpoint) {
91 execute!(
92 session.stderr,
93 StyledText::error_fg(),
94 style::Print("\nCheckpoint is disabled. Enable it with: q settings chat.enableCheckpoint true\n"),
95 StyledText::reset(),
96 )?;
97 return Ok(ChatState::PromptUser {
98 skip_printing_tools: true,
99 });
100 }
101
102 // Check if in tangent mode - captures are disabled during tangent mode
103 if session.conversation.is_in_tangent_mode() {
104 execute!(
105 session.stderr,
106 StyledText::warning_fg(),
107 style::Print(
108 "⚠️ Checkpoint is disabled while in tangent mode. Please exit tangent mode if you want to use checkpoint.\n\n"
109 ),
110 StyledText::reset(),
111 )?;
112 return Ok(ChatState::PromptUser {
113 skip_printing_tools: true,
114 });
115 }
116 match self {
117 Self::Init => self.handle_init(os, session).await,
118 Self::Restore { ref tag, hard } => self.handle_restore(session, tag.clone(), hard).await,
119 Self::List { limit } => Self::handle_list(session, limit),
120 Self::Clean => self.handle_clean(os, session).await,
121 Self::Expand { ref tag } => Self::handle_expand(session, tag.clone()),
122 Self::Diff { ref tag1, ref tag2 } => Self::handle_diff(session, tag1.clone(), tag2.clone()),
123 }
124 }
125
126 async fn handle_init(&self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
127 if session.conversation.checkpoint_manager.is_some() {

Callers

nothing calls this directly

Calls 5

is_in_tangent_modeMethod · 0.80
handle_initMethod · 0.80
handle_restoreMethod · 0.80
handle_cleanMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected