Skip to content

forcedotcom/sf-skills / plugins/builder/dx-org-lifecycle/skills/automation-sandbox-post-copy-configure

automation-sandbox-post-copy-configure

Verified

Apply a Salesforce sandbox post-copy automation JSON config against a target org. Use when the user asks to apply, run, execute, dry-run, or preview a post-copy or post-refresh config file (e.g. `post-copy-config.json`) against a sandbox — including activating/deactivating a Flow (PATCH `FlowDefinition.Metadata.activeVersionNumber` to the version, or `null`), re-pointing an OBM endpoint, updating a RemoteSiteSetting URL, or re-scheduling a ScheduledApex job after refresh. Also trigger for phrasings like "apply post-copy config", "run post-copy automation", "activate Flow <name> post-refresh", "deactivate Flow <name>", "re-point outbound messages after refresh", or "configure sandbox after refresh". Per entry, derive the Tooling API sobject, verify via describe, resolve the Id via SOQL, then PATCH the compound `Metadata` field (`ScheduledApex` uses anonymous Apex). DO NOT TRIGGER for generating config JSON from an SOP (use `automation-sandbox-post-copy-config-generate`) or for deploying metadata XML.

scripts/plan-phases.mjs

View on GitHub
#!/usr/bin/env node
// Deterministic phase planner for automation-sandbox-post-copy-configure.
//
// Reads a post-copy config JSON array and emits the ordered execution plan
// the workflow steps through. Encodes the two invariants that were formerly
// prose in SKILL.md (authoring standard A9):
//
//   1. Phases are ORDINAL — the 1-indexed position of the entry's
//      ExecutionOrder bucket in the sorted list of distinct buckets. Sparse
//      ExecutionOrder values do NOT produce empty phases (1,2,5 → phases
//      1,2,3, not 1,2,5).
//   2. IsActive:false entries are pre-marked SKIPPED_INACTIVE and kept in
//      the plan (not filtered out) so the summary can list them.
//
// Usage:
//   node plan-phases.mjs <config.json>
//
// Emits to stdout (single JSON object):
//   {
//     "phases": [
//       { "ordinal": 1, "executionOrder": <raw>,
//         "entries": [
//           { "index": <0-based original index>,
//             "configurationName": "...",
//             "label": "...",
//             "isActive": <bool>,
//             "action": "APPLY" | "SKIP_INACTIVE",
//             "fields": { ... } } ] }
//     ],
//     "totals": { "entries": <n>, "phases": <m>, "skipInactive": <k> }
//   }
//
// Exit codes: 0 on success; 1 on any input/parse error (message on stderr).

import { readFileSync } from 'node:fs';

function fail(msg) {
  process.stderr.write(`plan-phases: ${msg}\n`);
  process.exit(1);
}

const [, , path] = process.argv;
if (!path) fail('missing config path argument');

let raw;
try {
  raw = readFileSync(path, 'utf-8');
} catch (err) {
  fail(`cannot read ${path}: ${err.message}`);
}

let entries;
try {
  entries = JSON.parse(raw);
} catch (err) {
  fail(`config is not valid JSON: ${err.message}`);
}

if (!Array.isArray(entries)) fail('config must be a top-level JSON array');

const buckets = new Map();
entries.forEach((entry, index) => {
  const eo = entry?.ExecutionOrder;
  if (!Number.isInteger(eo) || eo < 1) {
    fail(`entry[${index}] has invalid ExecutionOrder ${JSON.stringify(eo)} — must be a positive integer`);
  }
  const list = buckets.get(eo) ?? [];
  list.push({ entry, index });
  buckets.set(eo, list);
});

const sortedOrders = [...buckets.keys()].sort((a, b) => a - b);
let skipInactive = 0;

const phases = sortedOrders.map((eo, i) => ({
  ordinal: i + 1,
  executionOrder: eo,
  entries: buckets.get(eo).map(({ entry, index }) => {
    const isActive = entry.IsActive !== false;
    if (!isActive) skipInactive += 1;
    return {
      index,
      configurationName: entry.ConfigurationName,
      label: entry.Label,
      isActive,
      action: isActive ? 'APPLY' : 'SKIP_INACTIVE',
      fields: entry.Fields ?? {},
    };
  }),
}));

process.stdout.write(
  JSON.stringify(
    { phases, totals: { entries: entries.length, phases: phases.length, skipInactive } },
    null,
    2,
  ) + '\n',
);
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall