MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / intent_update

Function intent_update

atomic-cli/src/commands/rpc.rs:909–1009  ·  view source on GitHub ↗

`atomic intent update` over UpdateVaultEntity — the FULL surface. The wire's composed-update arm carries every field in ONE request (status, assignee, priority, title, reason, informed-by, body, and the --force rewrite guard), so the handler applies them atomically through the same domain update the local body performs. The body still composes client-side (inline or stdin — reading the client's st

(args: &super::intent::update::IntentUpdate)

Source from the content-addressed store, hash-verified

907/// stdin is client-side by design); the no-op form errors client-side
908/// with the local body's exact message.
909pub fn intent_update(args: &super::intent::update::IntentUpdate) -> CliResult<bool> {
910 let body_requested = args.body.is_some() || args.body_stdin;
911 if !body_requested
912 && args.status.is_none()
913 && args.assignee.is_none()
914 && args.priority.is_none()
915 && args.title.is_none()
916 && args.reason.is_none()
917 && args.informed_by.is_empty()
918 && !args.force
919 {
920 return Err(CliError::InvalidArgument {
921 message: "Nothing to update. Provide at least one of \
922 --status, --assignee, --priority, --title, --reason, \
923 --informed-by, \
924 --body, or --body-stdin."
925 .to_string(),
926 });
927 }
928 let Some(session) = Service::open()? else {
929 return Ok(false);
930 };
931 // The pure status/body forms ride their original wire arms; anything
932 // else composes the full field set into ONE request.
933 let update = if args.assignee.is_none()
934 && args.priority.is_none()
935 && args.title.is_none()
936 && args.reason.is_none()
937 && args.informed_by.is_empty()
938 && !args.force
939 {
940 if body_requested {
941 let body = args
942 .resolve_body()?
943 .expect("--body/--body-stdin always resolves a body");
944 UpdateKind::Body(body)
945 } else {
946 let status = args.status.clone().expect("checked above");
947 let proto_status = match status.as_str() {
948 "backlog" => Status::Backlog,
949 "in_progress" | "in-progress" => Status::InProgress,
950 "needs-review" => Status::NeedsReview,
951 "done" | "completed" => Status::Done,
952 "planned" => Status::Planned,
953 "icebox" => Status::Suspended,
954 other => {
955 return Err(CliError::InvalidArgument {
956 message: format!("unknown intent status '{other}'"),
957 })
958 }
959 };
960 UpdateKind::Status(proto_status as i32)
961 }
962 } else {
963 // The mixed/multi-field update: ONE request, applied atomically.
964 UpdateKind::Fields(pb::IntentUpdateFields {
965 status: args.status.clone(),
966 assignee: args.assignee.clone(),

Callers 1

runMethod · 0.85

Calls 10

FieldsClass · 0.85
is_noneMethod · 0.80
resolve_bodyMethod · 0.80
StatusClass · 0.70
request_metaFunction · 0.70
openFunction · 0.50
is_emptyMethod · 0.45
cloneMethod · 0.45
as_strMethod · 0.45
update_vault_entityMethod · 0.45

Tested by

no test coverage detected