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

Function intent_update

atomic-cli/src/commands/rpc.rs:908–1008  ·  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

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

Callers 1

runMethod · 0.85

Calls 10

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

Tested by

no test coverage detected