MCPcopy Create free account
hub / github.com/dwgx/WindsurfAPI / buildProposeCodeBody

Function buildProposeCodeBody

src/cascade-native-bridge.js:766–792  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

764// string replacement_content = 2
765// bool allow_multiple = 3
766function buildProposeCodeBody(args) {
767 const parts = [];
768 // action_spec.command(1).{...}
769 const cmdParts = [];
770 if (args.instruction) cmdParts.push(writeStringField(1, args.instruction));
771 cmdParts.push(writeBoolField(2, true)); // is_edit
772 if (Array.isArray(args.replacement_chunks)) {
773 for (const c of args.replacement_chunks) {
774 const chunkParts = [];
775 if (typeof c.target === 'string') chunkParts.push(writeStringField(1, c.target));
776 if (typeof c.replacement === 'string') chunkParts.push(writeStringField(2, c.replacement));
777 if (c.allow_multiple) chunkParts.push(writeBoolField(3, true));
778 cmdParts.push(writeMessageField(9, Buffer.concat(chunkParts)));
779 }
780 }
781 if (args.target_file_uri) {
782 // PathScopeItem { absolute_uri = 5 }
783 const psi = writeStringField(5, args.target_file_uri);
784 cmdParts.push(writeMessageField(4, psi)); // ActionSpecCommand.target.file = 4
785 }
786 const command = Buffer.concat(cmdParts);
787 // ActionSpec.command oneof at field 1
788 const actionSpec = writeMessageField(1, command);
789 parts.push(writeMessageField(1, actionSpec)); // CortexStepProposeCode.action_spec = 1
790 if (args.instruction) parts.push(writeStringField(3, args.instruction));
791 return Buffer.concat(parts);
792}
793
794// v2.0.70 — search_web (CortexStepSearchWeb = field 42 oneof).
795// query = 1 string

Callers

nothing calls this directly

Calls 4

writeStringFieldFunction · 0.90
writeBoolFieldFunction · 0.90
writeMessageFieldFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected