Skip to content

feat: add flow delete/version prune and permissions assignment delete commands - #133

Merged
ClayChipps merged 4 commits into
mainfrom
feat/flow-permission-assignment-cleanup
Aug 27, 2026
Merged

feat: add flow delete/version prune and permissions assignment delete commands#133
ClayChipps merged 4 commits into
mainfrom
feat/flow-permission-assignment-cleanup

Conversation

@ClayChipps

Copy link
Copy Markdown
Contributor

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.

  • New simply-flow package:
    • sf simply flow delete — deactivates and hard-deletes every version of the Flows named in a
      destructiveChanges.xml (or via explicit --flow-name flags). Required before a destructive
      metadata 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-run preview the original script never had.
  • New command in simply-permissions: sf simply permissions assignment delete — deletes
    PermissionSetAssignments for permission sets/groups named in a destructiveChanges.xml (or
    explicit name flags), so their own destructive deploy doesn't fail or orphan assignments.
  • New simply-core helper: readPackageManifestMembers(xmlContent, typeName) — shared by both
    --file-reading commands to read <members> out of a package.xml/destructiveChanges.xml-shaped
    document, instead of each command rolling its own parser.

All three commands use simply-core's existing chunkedInQuery/escapeSoqlLiteral for every SOQL
query, 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 table
instead of the originals' console.error-and-continue, and sets process.exitCode for CI gating.

The design doc has a post-implementation "Implementation notes" section covering a couple of things
the build taught: a SaveResult failure carries no id, so assignment delete's chunked delete
attributes failures by request-array position instead; and the Tooling API bulk-destroy() question
from 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/kit dependency that got carried over
from scaffolding simply-flow off simply-permissions's package.json.

Note: pnpm-lock.yaml's diff is large but mostly cosmetic YAML-reformatting churn (same as the prior
two PRs), plus the real additions (fast-xml-parser for simply-core, glob for simply-flow).

Test plan

  • pnpm run build and pnpm test pass for simply-core, simply-flow, and simply-permissions
    individually (verified independently, not just via cached wireit output)
  • Root pnpm run build/pnpm test across all 16 projects passes (ran as part of the pre-push hook)
  • pnpm run readme regenerated for all three packages
  • New unit tests: packageManifest.test.ts (single/array normalization, missing type, empty manifest)
  • New command tests: flow/delete.test.ts, flow/version/prune.test.ts,
    permissions/assignment/delete.test.ts (failure-collection behavior, --dry-run, mutually
    exclusive input flags, chunking)

🤖 Generated with Claude Code

ClayChipps and others added 4 commits August 27, 2026 10:43
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>
@ClayChipps
ClayChipps enabled auto-merge August 27, 2026 15:03
@ClayChipps
ClayChipps merged commit 3c978ab into main Aug 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant