# summary

Delete profiling definitions that no longer represent current analysis intent — keeping the definition inventory focused on actively profiled objects.

# description

Profiling definitions accumulate over iterative scoping cycles: test definitions, exploration definitions, definitions for objects the team decided not to profile. This command removes them, leaving the inventory focused on current business intent.

Three selection modes: by specific definition key (`--keys`), by composable AND filters (object, pattern, method, category, status, namespace), or all definitions (`--all`). Before deletion, the command pre-categorizes every matched definition into two groups: deletable (no summaries) and blocked by summaries (must run `summary purge` first). A paginated preview table shows this categorization with a can-delete indicator per definition.

IMPORTANT: Definitions with existing summaries must have their summaries purged first. The full cleanup dependency order:

1. `sf cuneiform profile request cancel` — cancel queued requests
2. `sf cuneiform profile request delete` — remove canceled and rejected requests
3. `sf cuneiform summary purge` — remove summaries (cascade-deletes completed requests; resets definition status)
4. `sf cuneiform definition purge` — remove definitions (requires zero summaries)

THREE SELECTION MODES:

- **By key** (`--keys PD-0001,PD-0003`) — Delete specific definitions. Exclusive mode — all filter flags are ignored.
- **By filter** (`--objects Account --method metadata`) — Delete definitions matching ALL specified filters (AND logic). Combine --objects, --filter, --pattern, --method, --category, --status, and --namespace.
- **All** (`--all`) — Delete all eligible definitions. Can be combined with filters to narrow scope.

NATURAL LANGUAGE → FLAG MAPPING:
"delete the Account definition" → --keys PD-0001 (look up the key with `definition list`)
"remove all unused definitions" → --all --status "NOT PROFILED"
"clean up custom object definitions" → --all --filter custom
"delete metadata-only definitions" → --all --method metadata
"remove FSC definitions" → --all --namespace FinServ
"what would be deleted?" → --all --dry-run

COMMAND SEQUENCE: `summary purge` (remove summaries from blocked definitions) → `definition purge --dry-run` (preview) → `definition purge` (execute)

# flags.target-org.summary

Salesforce org to purge definitions from. The command validates Cuneiform installation and permissions before any deletions.

# flags.all.summary

Target all definitions for deletion. Combine with filter flags (--objects, --method, --status, etc.) to narrow scope. Definitions blocked by summaries are reported but not deleted — run `summary purge` for those first.

# flags.keys.summary

Delete specific definitions by key (e.g., --keys PD-0001,PD-0003). Exclusive mode — when --keys is specified, all other filter flags are ignored. Look up definition keys with `definition list`.

# flags.objects.summary

Filter definitions by target object API names (e.g., --objects Account,Contact). Limits deletion to definitions targeting the specified objects.

# flags.filter.summary

Filter definitions by object type: standard or custom. Targets definitions for one category of objects (e.g., --filter custom to clean up custom object definitions after scoping).

# flags.pattern.summary

Filter definitions by name pattern using SOQL LIKE wildcards (e.g., --pattern Account% matches definitions whose name starts with "Account"). Use % for multi-character wildcard and \_ for single-character wildcard.

# flags.method.summary

Filter definitions by profiling method: metadata, historical, or comparative (e.g., --method metadata to remove metadata-only definitions). Targets definitions of a specific analysis type.

# flags.category.summary

Filter definitions by category label (e.g., --category "Phase 1"). Removes definitions from a completed engagement phase or functional area.

# flags.status.summary

Filter definitions by profiling status: "NOT PROFILED", "IN PROGRESS", "COMPLETE", "COMPLETE w/ FAILURES", or "ERROR". Use --status "NOT PROFILED" to target definitions that were created but never executed.

# flags.namespace.summary

Filter definitions by the namespace prefix of their target object (e.g., --namespace FinServ for Financial Services Cloud, --namespace SBQQ for CPQ). Removes definitions for a managed package that is no longer in profiling scope.

# flags.limit.summary

Maximum number of definitions to process per batch (default: 50). Controls batch size for large deletion operations.

# flags.dry-run.summary

Preview what would be deleted without making changes. Shows the same two-category classification (deletable and blocked by summaries) as a real run. Use this first to verify scope and share the preview with stakeholders before committing.

# flags.format.summary

Output format: table (default, human-readable) or json (structured output for scripted pipelines).

# examples

- Preview what would be deleted and what is blocked by summaries:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --dry-run

- Delete specific definitions by key (exclusive mode ignores all filters):

  <%= config.bin %> <%= command.id %> --target-org myOrg --keys PD-0001,PD-0003

- Remove definitions that were never profiled after exploration:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --status "NOT PROFILED"

- Clean up Financial Services Cloud definitions no longer in profiling scope:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --namespace FinServ

- Remove metadata-only definitions after upgrading to comparative analysis:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --method metadata

- Scripted scratch org reset with JSON output for CI verification:

  <%= config.bin %> <%= command.id %> --target-org myOrg --all --no-prompt --format json

# errors.noSelectionCriteria

No selection criteria specified. Provide --all, --keys, or filter flags.

# errors.noEligibleDefinitions

No definitions found matching the specified criteria.

# errors.queryFailed

Failed to query definitions: %s

# errors.deleteFailed

Failed to delete definitions: %s

# errors.noTargetOrg

Could not determine target org username.

# blockedBySummaries.header

Blocked by summaries — run `sf cuneiform summary purge` first:

# queued.header

Queued — these definitions have related requests in queue and cannot be deleted yet:

# flags.no-prompt.summary

Skip the confirmation prompt and delete immediately. Use for scripted execution in CI pipelines and automation workflows.

# prompt.confirm.singular

Delete this Profiling Definition

# prompt.confirm.plural

Delete these %s Profiling Definitions

# output.noDeletable

Purge cancelled — there are no Profiling Definitions that can be deleted.

# output.cancelled

Purge cancelled. No definitions were deleted.

# spinner.connecting

Connecting

# spinner.retrievingDefinitions

Retrieving Definitions

# spinner.deletingDefinitions

Deleting Definitions

# spinner.status.deleted

deleted

# spinner.status.skipped

skipped

# spinner.status.failed

failed

# spinner.status.queued

queued

# output.initializing

Initializing Profiling Definition Purging %s...

# output.initializing.dryRunMode

(dry run)

# output.definitionsFound.singular

%s definition found

# output.definitionsFound.plural

%s definitions found

# output.noEligible.message

No definitions were found matching the specified criteria.

# output.noEligible.guidance

- Please check your filters and confirm that definitions exist in your Salesforce org.

# output.summaryHeader

Summary

# output.summary.deleted

Deleted:

# output.summary.skipped

Skipped:

# output.summary.failed

Failed:

# output.summary.queued

Queued:

# output.summary.total

Total:

# reason.hasSummaries

Has Summaries

# reason.notFound

Not Found

# reason.lookupFailed

Lookup Failed

# reason.queuedKeyword

has related requests in queue

# table.header.key

Key

# table.header.object

Object

# table.header.category

Category

# table.header.timeCategory

Time Category

# table.header.segmentCategory

Segment Category

# table.header.status

Status

# table.header.deleted

Deleted?

# table.header.canDelete

Can Delete?

# preview.summary

%s to delete, %s blocked by summaries

# dryRun.banner.singular

[DRY RUN] Would delete %s definition. %s blocked by summaries.

# dryRun.banner.plural

[DRY RUN] Would delete %s definitions. %s blocked by summaries.

# table.column.key

KEY

# table.column.name

NAME

# table.column.object

OBJECT

# table.column.status

STATUS

# table.column.action

ACTION

# warnings.limitIgnoredWithAll

--limit is ignored when --all is specified. All eligible records will be processed.
