MCPcopy
hub / github.com/github/awesome-copilot / deleteSectionContent

Function deleteSectionContent

extensions/site-studio/extension.mjs:745–767  ·  view source on GitHub ↗
(sectionId, field, author = "agent")

Source from the content-addressed store, hash-verified

743}
744
745function deleteSectionContent(sectionId, field, author = "agent") {
746 const section = findSectionOrThrow(sectionId);
747 const normalizedField = safeString(field).trim();
748 if (!normalizedField) {
749 throw new CanvasError("invalid_field", "Field name is required.");
750 }
751 if (!section.content || !Object.prototype.hasOwnProperty.call(section.content, normalizedField)) {
752 return { section, field: normalizedField, removed: false };
753 }
754 delete section.content[normalizedField];
755 section.lastModified = nowIso();
756 stateCache.lastUpdated = section.lastModified;
757 addChange({
758 type: "file_modified",
759 summary: `Field removed from ${section.name}.${normalizedField}.`,
760 timestamp: section.lastModified,
761 sectionId: section.id,
762 });
763 if (author === "human") {
764 addNote(sectionId, `Removed field "${normalizedField}".`, "human");
765 }
766 return { section, field: normalizedField, removed: true };
767}
768
769function getSectionGuide(sectionId) {
770 const section = findSectionOrThrow(sectionId);

Callers 1

handleApiFunction · 0.85

Calls 5

findSectionOrThrowFunction · 0.85
safeStringFunction · 0.85
nowIsoFunction · 0.85
addChangeFunction · 0.85
addNoteFunction · 0.85

Tested by

no test coverage detected