feat: add flow delete/version prune and permissions assignment delete commands - #133
Merged
Merged
Conversation
Reads <members> out of a <types> block in a package.xml/ destructiveChanges.xml-shaped document, normalizing fast-xml-parser's single-vs-array quirk for both <types> and <members> the same way customMetadataXml.ts already does for CustomMetadata <values>. Shared by the new simply-flow and simply-permissions commands that read a destructive-changes manifest.
New package for Flow-lifecycle commands, replacing the bespoke deleteFlows.mjs/deleteObsoleteFlowVersions.mjs scripts: - `sf simply flow delete` deactivates and hard-deletes every version of one or more Flows, named via --file (a destructiveChanges.xml/ package.xml-shaped manifest) or --flow-name. - `sf simply flow version prune` deletes obsolete Flow versions found under --source-dir, with a --dry-run preview. Bundled into the @simplysf/simply orchestrator alongside the other plugins. See docs/design/0013-flow-and-permission-set-assignment-cleanup.md.
sf simply permissions assignment delete deletes every PermissionSetAssignment against the PermissionSet/PermissionSetGroup members named via --file (a destructiveChanges.xml/package.xml-shaped manifest) or explicit --permission-set-name/--permission-set-group-name flags, replacing the bespoke deletePermissionSetAssignments.mjs script. Also regenerates the simply orchestrator's bundled command-snapshot.json for both this and the new simply-flow commands, and adds the design doc's post-implementation notes.
Left over from scaffolding off simply-permissions; nothing in simply-flow's source actually uses it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements docs/design/0013-flow-and-permission-set-assignment-cleanup.md: replaces three bespoke,
per-customer-repo Node scripts with proper commands in this monorepo.
simply-flowpackage:sf simply flow delete— deactivates and hard-deletes every version of the Flows named in adestructiveChanges.xml(or via explicit--flow-nameflags). Required before a destructivemetadata deploy can remove a Flow that still has an active version.
sf simply flow version prune— deletes obsolete Flow versions for flows found under--source-dir, with a--dry-runpreview the original script never had.simply-permissions:sf simply permissions assignment delete— deletesPermissionSetAssignments for permission sets/groups named in adestructiveChanges.xml(orexplicit name flags), so their own destructive deploy doesn't fail or orphan assignments.
simply-corehelper:readPackageManifestMembers(xmlContent, typeName)— shared by both--file-reading commands to read<members>out of apackage.xml/destructiveChanges.xml-shapeddocument, instead of each command rolling its own parser.
All three commands use
simply-core's existingchunkedInQuery/escapeSoqlLiteralfor every SOQLquery, closing a real SOQL-injection gap the original scripts had (unescaped string interpolation into
IN (...)clauses). Every delete loop collects per-item failures into a structured result and tableinstead of the originals'
console.error-and-continue, and setsprocess.exitCodefor CI gating.The design doc has a post-implementation "Implementation notes" section covering a couple of things
the build taught: a
SaveResultfailure carries noid, soassignment delete's chunked deleteattributes failures by request-array position instead; and the Tooling API bulk-
destroy()questionfrom the design doc's Open Questions is resolved as "client-library capable, server capability
unverified" — both new Flow commands keep the original's one-version-at-a-time loop rather than risk
an unverified bulk path.
One fix beyond the design doc: removed an unused
@salesforce/kitdependency that got carried overfrom scaffolding
simply-flowoffsimply-permissions's package.json.Note:
pnpm-lock.yaml's diff is large but mostly cosmetic YAML-reformatting churn (same as the priortwo PRs), plus the real additions (
fast-xml-parserforsimply-core,globforsimply-flow).Test plan
pnpm run buildandpnpm testpass forsimply-core,simply-flow, andsimply-permissionsindividually (verified independently, not just via cached wireit output)
pnpm run build/pnpm testacross all 16 projects passes (ran as part of the pre-push hook)pnpm run readmeregenerated for all three packagespackageManifest.test.ts(single/array normalization, missing type, empty manifest)flow/delete.test.ts,flow/version/prune.test.ts,permissions/assignment/delete.test.ts(failure-collection behavior,--dry-run, mutuallyexclusive input flags, chunking)
🤖 Generated with Claude Code