sandforge 1.79.0 → 1.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{chunk-JVL444U5.mjs → chunk-2BA2XKAY.mjs} +1 -1
- package/lib/chunk-2CNCDM56.mjs +7 -0
- package/lib/{chunk-W7KFAY55.mjs → chunk-2GTBABKU.mjs} +1 -1
- package/lib/{chunk-DLDX6RRC.mjs → chunk-2NBYT7GR.mjs} +1 -1
- package/lib/{chunk-HV2MXMGI.mjs → chunk-2UZPIMUC.mjs} +1 -1
- package/lib/chunk-3F6Q5E7I.mjs +14 -0
- package/lib/{chunk-PBI4BYWW.mjs → chunk-3RZQZHEB.mjs} +1 -1
- package/lib/{chunk-P7GSGFJO.mjs → chunk-3TJON4F3.mjs} +1 -1
- package/lib/chunk-4VS2V6WU.mjs +25 -0
- package/lib/{chunk-TQX3PURV.mjs → chunk-5K5VLULK.mjs} +1 -1
- package/lib/{chunk-MYTIL2JD.mjs → chunk-5TC3QB4U.mjs} +1 -1
- package/lib/{chunk-NM4MDLK4.mjs → chunk-6XYKJSGX.mjs} +1 -1
- package/lib/{chunk-RFEO2KAN.mjs → chunk-74Q6DORA.mjs} +1 -1
- package/lib/chunk-7ABODJ4G.mjs +7 -0
- package/lib/{chunk-ZPYJPGDK.mjs → chunk-7EGQP6S4.mjs} +1 -1
- package/lib/chunk-7FFGJWHN.mjs +7 -0
- package/lib/chunk-7YDNUBO5.mjs +7 -0
- package/lib/{chunk-CGWXQX75.mjs → chunk-A527W53V.mjs} +1 -1
- package/lib/chunk-ADOAS63R.mjs +7 -0
- package/lib/chunk-AEKONPF4.mjs +7 -0
- package/lib/{chunk-4HFRHFGQ.mjs → chunk-B5QQJ4SI.mjs} +1 -1
- package/lib/{chunk-2BVTCNWA.mjs → chunk-BGUEWRK2.mjs} +1 -1
- package/lib/{chunk-GNC27UEU.mjs → chunk-BKDV4ENO.mjs} +1 -1
- package/lib/{chunk-QRV2OSIS.mjs → chunk-BTWDMNN3.mjs} +1 -1
- package/lib/{chunk-FOVVHGEP.mjs → chunk-BV6VTP3J.mjs} +1 -1
- package/lib/{chunk-PZTSVQSF.mjs → chunk-BXU6WFMH.mjs} +1 -1
- package/lib/{chunk-ZQOZ4EFW.mjs → chunk-BY2HJFFG.mjs} +1 -1
- package/lib/{chunk-NZ5ZZLKS.mjs → chunk-CEX3NEZL.mjs} +1 -1
- package/lib/{chunk-HTJ5OGP5.mjs → chunk-CHYDMRSV.mjs} +1 -1
- package/lib/chunk-CION3VMZ.mjs +7 -0
- package/lib/chunk-COFG7Q6R.mjs +7 -0
- package/lib/chunk-CSBS5U5I.mjs +7 -0
- package/lib/{chunk-55HEMHEG.mjs → chunk-CU2INBND.mjs} +1 -1
- package/lib/chunk-DB7RBE5D.mjs +7 -0
- package/lib/{chunk-QPF6C5MX.mjs → chunk-DBB3EMIN.mjs} +1 -1
- package/lib/{chunk-F74IHMGL.mjs → chunk-DYFALGRT.mjs} +1 -1
- package/lib/{chunk-TEOLMRDO.mjs → chunk-E5AHXLS6.mjs} +1 -1
- package/lib/{chunk-LRFAIUN7.mjs → chunk-E5ZB3LU5.mjs} +1 -1
- package/lib/chunk-EFR2Y7E4.mjs +7 -0
- package/lib/chunk-EHQ3FX6X.mjs +7 -0
- package/lib/{chunk-RAAANPPG.mjs → chunk-ELFXJHU7.mjs} +1 -1
- package/lib/{chunk-BN7A4GRQ.mjs → chunk-EMNC6YI4.mjs} +1 -1
- package/lib/{chunk-HJC7AIBK.mjs → chunk-EQNW3UC2.mjs} +1 -1
- package/lib/{chunk-Z7X534S4.mjs → chunk-F43REJDZ.mjs} +2 -2
- package/lib/{chunk-QQZZMKU3.mjs → chunk-F6GUDTOB.mjs} +1 -1
- package/lib/{chunk-6EBMEGZB.mjs → chunk-FGRG7ANU.mjs} +1 -1
- package/lib/{chunk-4NAHW2D3.mjs → chunk-FKG7Q3WH.mjs} +1 -1
- package/lib/{chunk-7UQD6V6F.mjs → chunk-FPKYYFM7.mjs} +1 -1
- package/lib/{chunk-ZJKCWBRJ.mjs → chunk-FXXLX4O6.mjs} +1 -1
- package/lib/chunk-G35N4P7D.mjs +7 -0
- package/lib/{chunk-SIOZXPFG.mjs → chunk-GGD7ON3M.mjs} +1 -1
- package/lib/chunk-GSG7WZHM.mjs +7 -0
- package/lib/{chunk-OTWRDD6L.mjs → chunk-GSKCGQIP.mjs} +1 -1
- package/lib/{chunk-3CA767QB.mjs → chunk-HEKAZJRH.mjs} +1 -1
- package/lib/{chunk-4SNDMJP2.mjs → chunk-HLWMJF6Y.mjs} +1 -1
- package/lib/chunk-HOJYWTP7.mjs +20 -0
- package/lib/chunk-HS4YRX4J.mjs +7 -0
- package/lib/chunk-IFETCRWE.mjs +10 -0
- package/lib/{chunk-PUOX4NBJ.mjs → chunk-IG2MTQRP.mjs} +1 -1
- package/lib/{chunk-RACDTRZA.mjs → chunk-IGYH7GMA.mjs} +1 -1
- package/lib/{chunk-X65MT4W3.mjs → chunk-IOIWJ3DJ.mjs} +1 -1
- package/lib/{chunk-4U6NXJNL.mjs → chunk-IQXHJEYB.mjs} +1 -1
- package/lib/{chunk-P2PJYWGQ.mjs → chunk-IWDREM66.mjs} +1 -1
- package/lib/{chunk-ZOVSMN5C.mjs → chunk-IZQZ6ZUF.mjs} +1 -1
- package/lib/{chunk-XBG5SP6Q.mjs → chunk-J525F5KI.mjs} +1 -1
- package/lib/{chunk-5CD257T7.mjs → chunk-JEERQRLW.mjs} +1 -1
- package/lib/{chunk-6QSM2WIH.mjs → chunk-JPUR2CFX.mjs} +1 -1
- package/lib/chunk-JWTSEDIQ.mjs +7 -0
- package/lib/chunk-K327QKMD.mjs +7 -0
- package/lib/{chunk-J7HVXMSW.mjs → chunk-KBJ5VERV.mjs} +1 -1
- package/lib/chunk-KDGMAGQR.mjs +7 -0
- package/lib/chunk-KRCA6IPH.mjs +8 -0
- package/lib/chunk-KYEDBS54.mjs +7 -0
- package/lib/chunk-L5FGY6YA.mjs +7 -0
- package/lib/{chunk-PNCONNFJ.mjs → chunk-L77FJZEP.mjs} +1 -1
- package/lib/{chunk-3OHPD72J.mjs → chunk-LKQ5RKIV.mjs} +1 -1
- package/lib/{chunk-WJY54JO7.mjs → chunk-LPBMBW3O.mjs} +1 -1
- package/lib/{chunk-LV6G4XTK.mjs → chunk-LWW4U276.mjs} +1 -1
- package/lib/{chunk-IAZB4WIL.mjs → chunk-M3ROUWDX.mjs} +1 -1
- package/lib/chunk-MFG4MUIO.mjs +9 -0
- package/lib/{chunk-H45UXY6G.mjs → chunk-MHMH6MTP.mjs} +1 -1
- package/lib/{chunk-HCIDVIOW.mjs → chunk-MILU7WFN.mjs} +1 -1
- package/lib/chunk-MJU2PGZQ.mjs +15 -0
- package/lib/{chunk-HJKM3E56.mjs → chunk-MJVTDA5Q.mjs} +1 -1
- package/lib/{chunk-SBIMVCXT.mjs → chunk-MS4FJDFD.mjs} +9 -9
- package/lib/{chunk-3SRXFZSD.mjs → chunk-MYW5QNGI.mjs} +1 -1
- package/lib/{chunk-VHI54FBK.mjs → chunk-N652NMZ4.mjs} +26 -26
- package/lib/{chunk-3DCUADVK.mjs → chunk-NTFIRZP6.mjs} +1 -1
- package/lib/{chunk-342FN7AO.mjs → chunk-NZC67CGR.mjs} +1 -1
- package/lib/{chunk-RSYICMZG.mjs → chunk-O2HDYYUV.mjs} +1 -1
- package/lib/chunk-OAZRPP4I.mjs +7 -0
- package/lib/{chunk-BILZ3SSR.mjs → chunk-OHWNPXWW.mjs} +1 -1
- package/lib/chunk-OLSGVAIL.mjs +341 -0
- package/lib/chunk-OO6CLPEH.mjs +7 -0
- package/lib/chunk-OPXCV2KL.mjs +7 -0
- package/lib/chunk-P33PSCXK.mjs +7 -0
- package/lib/{chunk-AUTM6H6Z.mjs → chunk-PJ5I73CK.mjs} +1 -1
- package/lib/{chunk-NTDN2JQZ.mjs → chunk-PZPJKATS.mjs} +1 -1
- package/lib/{chunk-5QKTYCWE.mjs → chunk-Q3DM32KF.mjs} +1 -1
- package/lib/{chunk-K22PA4XL.mjs → chunk-QR3WELJQ.mjs} +1 -1
- package/lib/{chunk-42RER7V4.mjs → chunk-R3X3LV64.mjs} +1 -1
- package/lib/chunk-RMBPOTD7.mjs +7 -0
- package/lib/{chunk-IEYG5ATY.mjs → chunk-RPI7LRTW.mjs} +1 -1
- package/lib/{chunk-5MMXFWPD.mjs → chunk-SE4QEZUG.mjs} +1 -1
- package/lib/{chunk-ALJVEUUS.mjs → chunk-SIHORWVK.mjs} +1 -1
- package/lib/{chunk-AAVJ5XVX.mjs → chunk-SOGQW4IG.mjs} +1 -1
- package/lib/chunk-SOU4FRYN.mjs +7 -0
- package/lib/chunk-SU65Z2BA.mjs +7 -0
- package/lib/chunk-T62WNR54.mjs +7 -0
- package/lib/{chunk-5O6JOMHS.mjs → chunk-TSLJUSLW.mjs} +1 -1
- package/lib/chunk-TTFDUKUS.mjs +47 -0
- package/lib/{chunk-57VHUYNG.mjs → chunk-TTKXMDBN.mjs} +1 -1
- package/lib/chunk-UCD54V2M.mjs +7 -0
- package/lib/{chunk-TBZMC2VV.mjs → chunk-UNJA4J37.mjs} +1 -1
- package/lib/{chunk-NGSMZZDA.mjs → chunk-VE6XKGGD.mjs} +1 -1
- package/lib/chunk-VS7ZXUII.mjs +824 -0
- package/lib/{chunk-ALUFROGA.mjs → chunk-VXQLDM4R.mjs} +1 -1
- package/lib/chunk-VYXMVJL5.mjs +7 -0
- package/lib/{chunk-WFEB5X4U.mjs → chunk-W622GUAW.mjs} +1 -1
- package/lib/chunk-W7U5E5ZL.mjs +9 -0
- package/lib/{chunk-AR7BE5O2.mjs → chunk-WA7EYLAQ.mjs} +1 -1
- package/lib/{chunk-EQF2IJS2.mjs → chunk-WR4Q363I.mjs} +1 -1
- package/lib/{chunk-ZXH4MBWP.mjs → chunk-WU3GLFZO.mjs} +1 -1
- package/lib/chunk-WXAQ7FK3.mjs +115 -0
- package/lib/{chunk-YBU4Z4QV.mjs → chunk-X5JYBPXP.mjs} +1 -1
- package/lib/chunk-XAMBCQPU.mjs +7 -0
- package/lib/{chunk-LQ4DRFUH.mjs → chunk-XLXIPIEW.mjs} +1 -1
- package/lib/{chunk-H2PJNIYJ.mjs → chunk-XUWL6ZPC.mjs} +1 -1
- package/lib/{chunk-P42X3B4D.mjs → chunk-YKKRIEH4.mjs} +1 -1
- package/lib/chunk-YRQGKDHM.mjs +7 -0
- package/lib/chunk-ZM6OJGIG.mjs +7 -0
- package/lib/{chunk-SFURUNJM.mjs → chunk-ZVAED4QV.mjs} +1 -1
- package/lib/sandforge-autopilot.mjs +29 -24
- package/lib/sandforge-backup.mjs +25 -21
- package/lib/sandforge-checkpoint.mjs +15 -14
- package/lib/sandforge-cleanup.mjs +14 -10
- package/lib/sandforge-clone.mjs +1 -1
- package/lib/sandforge-compare.mjs +9 -8
- package/lib/sandforge-dataops.mjs +1 -1
- package/lib/sandforge-empty.mjs +15 -15
- package/lib/sandforge-env.mjs +88 -88
- package/lib/sandforge-frozen.mjs +43 -34
- package/lib/sandforge-mcp.mjs +12 -12
- package/lib/sandforge-monitor.mjs +7 -7
- package/lib/sandforge-seed.mjs +1 -1
- package/lib/sandforge-sync.mjs +1 -1
- package/lib/sandforge.mjs +4 -4
- package/package.json +1 -1
- package/lib/chunk-2S5OMIIA.mjs +0 -7
- package/lib/chunk-36U7IQ6Y.mjs +0 -25
- package/lib/chunk-3F5YMM2F.mjs +0 -7
- package/lib/chunk-3RYLICRX.mjs +0 -7
- package/lib/chunk-4GL773D5.mjs +0 -7
- package/lib/chunk-4XZ5YT5O.mjs +0 -7
- package/lib/chunk-5AJRHRXA.mjs +0 -20
- package/lib/chunk-5HMAPZBV.mjs +0 -7
- package/lib/chunk-6LAXTAVN.mjs +0 -7
- package/lib/chunk-6MUEPV7M.mjs +0 -9
- package/lib/chunk-75ADZS6B.mjs +0 -7
- package/lib/chunk-B45CNPUX.mjs +0 -47
- package/lib/chunk-BS5T3MOQ.mjs +0 -7
- package/lib/chunk-D3QRXG63.mjs +0 -787
- package/lib/chunk-EEVVGGM6.mjs +0 -7
- package/lib/chunk-ENLBYECD.mjs +0 -7
- package/lib/chunk-EQOQASDQ.mjs +0 -7
- package/lib/chunk-FQBRBBY4.mjs +0 -7
- package/lib/chunk-GAM726CK.mjs +0 -7
- package/lib/chunk-HUMEKZT5.mjs +0 -8
- package/lib/chunk-I3JKJTLO.mjs +0 -110
- package/lib/chunk-KLX67VPL.mjs +0 -7
- package/lib/chunk-L776PUMV.mjs +0 -7
- package/lib/chunk-NEVXIGR6.mjs +0 -10
- package/lib/chunk-NHWE66K5.mjs +0 -7
- package/lib/chunk-OQOZAPCI.mjs +0 -7
- package/lib/chunk-PA3MKJVH.mjs +0 -7
- package/lib/chunk-RH3N2H7P.mjs +0 -7
- package/lib/chunk-SRQDABQ2.mjs +0 -15
- package/lib/chunk-SVS6UMDU.mjs +0 -323
- package/lib/chunk-TNXUU6W7.mjs +0 -14
- package/lib/chunk-VXHDBYMI.mjs +0 -7
- package/lib/chunk-WRU5FJFC.mjs +0 -7
- package/lib/chunk-X2PY6MWZ.mjs +0 -7
- package/lib/chunk-XEFDB2R4.mjs +0 -7
- package/lib/chunk-XETCPL7E.mjs +0 -7
- package/lib/chunk-Y5CGXLUB.mjs +0 -7
- package/lib/chunk-Y6J6QFI2.mjs +0 -7
- package/lib/chunk-YMJVMFPY.mjs +0 -7
- package/lib/chunk-YPSRZRIT.mjs +0 -7
- package/lib/chunk-YW2SBL4Z.mjs +0 -7
- package/lib/chunk-ZE6HKRR4.mjs +0 -9
- package/lib/chunk-ZLZRU6MO.mjs +0 -7
- package/lib/chunk-ZYEE34WO.mjs +0 -7
package/lib/sandforge-mcp.mjs
CHANGED
|
@@ -4,12 +4,12 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{b as Y}from"./chunk-YS4G22C2.mjs";import{b as X}from"./chunk-SCKUIE3R.mjs";import"./chunk-QROPNEGY.mjs";import{a as Z,b as q,e as K}from"./chunk-BZ24IAP5.mjs";import{a as V,b as G,g as Q}from"./chunk-MTMH6H2A.mjs";import{bb as J,w as L}from"./chunk-B45CNPUX.mjs";import{A as o}from"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as Te}from"node:fs";import{join as Ee}from"node:path";import{createInterface as _e}from"node:readline";var S="2026-07-28",_=["2025-11-25","2025-06-18","2025-03-26"],E={version:"io.modelcontextprotocol/protocolVersion",capabilities:"io.modelcontextprotocol/clientCapabilities",serverInfo:"io.modelcontextprotocol/serverInfo"},f={parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603,unsupportedVersion:-32022},ee=60*6e4,te={name:"sandforge",title:"SandForge",version:String(JSON.parse(Te(Ee(__dirname,"..","package.json"),"utf8")).version??"0.0.0")},oe="SandForge's Seed, Forge's clone of a record, the removal of a run, the emptying of objects or of a whole org, Checkpoints and the environments of a sandforge.yaml, run from the sandforge npm package. Every org is named by its sf CLI alias, as `sf alias list` shows them. A tool that writes to an org takes confirm, the alias of that org exactly: give it only once the person using you has agreed to that write, after a dry run, a preview or a plan has said what it would do. The acceptances (acceptAutomation and the others) are theirs to give too. A production org is refused by every tool that writes to an org. Each answer carries the script's own JSON, its exit code and its lines.";function Ie(e={}){return Y({...e,relayedBy:"sandforge mcp"})}var Ne=Ie();function $e(e){let t=o.toJSONSchema(e);return delete t.$schema,t}function u(e){return{definition:{name:e.name,title:e.title,description:e.description,inputSchema:$e(e.args),annotations:{title:e.title,readOnlyHint:e.readOnly,...e.readOnly?{}:{destructiveHint:e.destructive===!0}}},...e.writes!==void 0?{writes:e.writes}:{},...e.readFirst!==void 0?{readFirst:e.readFirst}:{},flags:e.flags??{},named:e.named??{},exits:e.exits??{},read:t=>{let n=e.args.safeParse(t);if(!n.success)return{refusal:n.error.issues.map(w=>`${w.path.join(".")||"arguments"}: ${w.message}`).join("; ")};let s=n.data,c=e.writesTo?.(s),m=s.confirm;return{call:{...c!==void 0?{writesTo:c}:{},...typeof m=="string"?{confirm:m}:{},run:e.run(s),after:w=>e.after?.(s,w)??[]}}}}}var x=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,Pe=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,Ce=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,I=/^[^-\r\n][^\r\n]*$/,Fe=/^[a-z][a-z0-9-]{0,62}$/,p=e=>o.string().regex(G,'an sf CLI alias, or the username it stands for, not starting with "-"').describe(e),k=e=>o.string().max(255).describe(`The alias of ${e} again, exactly as given: the person using you agrees to this write. Without it, the call is refused before anything is read.`),$=e=>o.string().min(1).max(200).regex(I,'one line, not starting with "-"').describe(e),r=e=>o.boolean().optional().describe(e),ne=e=>o.strictObject({keepDays:o.number().int().min(L.min).max(L.max).optional().describe("The days it is kept on this machine; 0 until it is deleted (default 7)."),excluded:o.array(o.string().regex(x,"an object API name")).min(1).max(500).optional().describe("Objects to leave out of it, by API name, named in the answer: a rewind leaves their records as they are.")}).optional().describe(`Before ${e}'s first write, take a checkpoint of each object it writes, and of each the target's flows that still run create as it writes them, held whole: {} takes it with the defaults. Its cost is that of the tables, not of the records written, and its values stay unencrypted on this machine: give it only once the person using you has seen, in a dry run with it, what it would hold and cost. Refused, ${e} writes nothing; deleted again when it writes nothing.`);function re(e){return e===void 0?[]:["--checkpoint-first",...e.keepDays!==void 0?["--checkpoint-keep-days",String(e.keepDays)]:[],...(e.excluded??[]).flatMap(t=>["--checkpoint-exclude-object",t])]}var se=e=>r(`Keep quiet what the org runs as ${e} writes, through its own bypass: the permission sets holding it are assigned to the user it writes as, for the run alone, under a lease, and taken back as it ends; what no bypass keeps quiet still runs. A dry run with it says what it would assign, and assigns nothing. Refused on a production org and for a user who cannot assign permission sets. Only once the person using you has agreed to it.`),C=e=>r(`Keep quiet what the org runs as ${e} writes, through its own bypass: the permission sets holding it are assigned to the user it writes as, for ${e} alone, under a lease, and taken back as it ends; what no bypass keeps quiet still needs acceptAutomation. Refused on a production org and for a user who cannot assign permission sets. Only once the person using you has agreed to it.`);function ie(e){return`is no parameter of ${e}: an environment's acceptance of automation is its file's. Write accept: { automation: true } on the resource whose run it names, in the file, once the person using you has accepted what fires, then call ${e} again.`}var je={"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation","--accept-no-undo":"acceptNoUndo","--accept-recreate":"acceptRecreate","--accept-outside":"acceptOutside","--accept-unseen":"acceptUnseen"},De=Object.fromEntries(Object.entries(je).map(([e,t])=>[e,`is checkpoint_rewind's ${t}: true, on the rewind this preview is of. Give it only once the person using you has accepted what it lets through.`])),ae=()=>o.array(o.string().regex(x,"an object API name")).min(1).max(500).optional().describe("Limit the rewind to these objects of the checkpoint, by API name (default: every object). What they depend on is never added: the answer names it."),ce=/^em-\d{8}-\d{6}-[a-z0-9]{4}$/,de={objects:o.array(o.string().regex(x,"an object API name")).min(1).max(500).optional().describe("Empty these objects, by API name: every record of each. Not with wholeOrg."),wholeOrg:o.literal(!0).optional().describe("Empty every object people work in, less users, setup, Chatter, history, sharing, the org's flows, settings and definitions, and the standard price book. Not with objects."),excluded:o.array(o.string().regex(x,"an object API name")).min(1).max(500).optional().describe("With wholeOrg: objects to leave out, by API name."),customSettings:r("With wholeOrg: empty the custom settings too."),files:r("With wholeOrg: empty the files and attachments too."),managedPackages:r("With wholeOrg: empty the objects of managed packages too."),unrestorable:r("With wholeOrg: empty too, by passes of their own, the objects whose records Salesforce does not bring back from the recycle bin on their own. Only once the person using you has accepted that Undo cannot bring those back."),hardDelete:r("Delete for good, with what goes along: nothing goes to the recycle bin and no undo brings anything back. Needs the Bulk API Hard Delete permission of the user. Only once the person using you has accepted that nothing can be brought back."),checkpointFirst:r("Take a checkpoint of the objects emptied before the first delete, to rewind to."),acceptAutomation:r("Empty although the org runs flows, Apex triggers, processes or workflow rules as the records are deleted, or would not say what it runs."),acceptEmails:r("Empty although the org delivers every email what still runs as the records go sends, or would not say whether it does. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:C("the emptying"),acceptNoUndo:r("Empty although some records go before a record they name, as Salesforce requires, so that Undo cannot bring them back once both have gone."),acceptPeopleActive:r("Empty although people other than the user changed records of these objects in the hour before the read, their work going with it: empty_preview says how many and each one's last change. It covers those the preview named, and taking up a run, whoever. Only once the person using you has accepted that their work goes.")};function le(e){return[e.objects,e.wholeOrg,e.resume].filter(n=>n!==void 0).length===1}function he(e){return[...e.objects!==void 0?["--objects",e.objects.join(",")]:[],...e.wholeOrg===!0?["--org"]:[],...(e.excluded??[]).flatMap(t=>["--exclude-object",t]),...e.customSettings===!0?["--custom-settings"]:[],...e.files===!0?["--files"]:[],...e.managedPackages===!0?["--managed-packages"]:[],...e.unrestorable===!0?["--unrestorable"]:[],...e.hardDelete===!0?["--hard-delete"]:[],...e.checkpointFirst===!0?["--checkpoint-first"]:[],...e.acceptNoUndo===!0?["--accept-no-undo"]:[]]}function M(e){return[...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[]]}var Re={"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},ue={...Re,"--accept-no-undo":"acceptNoUndo","--accept-people-active":"acceptPeopleActive"},pe={"--undo":"is empty_undo, with the run the line names: it brings back what that run deleted.","--resume":"is empty_run's resume, with the run the line names: it takes that run up."};function Le(e){if(typeof e!="object"||e===null)return[];let{result:t}=e;return typeof t?.runId=="string"&&t.runId!==""&&t.undo?.offered===!0?[`empty_undo with run "${t.runId}" brings back what it deleted while the recycle bin holds it, as long as no other emptying of the org follows.`]:[]}var U=()=>o.string().min(1).max(4096).regex(I,'one line, not starting with "-"').describe("The sandforge.yaml, by its path; a relative path is read from where the server was started.");function qe(e,t,n){let s=n===void 0?"gives no confirm":`gives confirm "${n}", which is not "${t}", the alias of the org it writes to`;return`${e.definition.name} writes to ${t}: it ${e.writes??"writes to the org"}. This call ${s}. `+(e.readFirst!==void 0?`Before it, ${e.readFirst}. `:"")+`Give confirm: "${t}" once the person using you has agreed to this write. Refused: nothing was read or written.`}function me(e,t){if(typeof t!="object"||t===null)return[];let{runFile:n,journal:s}=t,c=e==="seed"?n:s;return typeof c=="string"?[`run_remove with module "${e}" and run "${c}" takes this run back.`]:[]}function ge(e){if(typeof e!="object"||e===null)return[];let{checkpoint:t}=e;return t?.state==="taken"&&typeof t.checkpointId=="string"?[`checkpoint_rewind with checkpoint "${t.checkpointId}" returns the org to how it was before this run, and takes back what anyone did since on the objects it holds: checkpoint_preview says what it would do first.`]:[]}var Me={seed:"sandforge-seed",forge:"sandforge-clone",sync:"sandforge-sync"},F=[u({name:"seed_templates",title:"Seed templates",description:"The built-in Seed templates, as the Seed page's gallery lists them: id, name, what it is for, and the records each object gets at most. The first is the one a new Developer Edition holds whole. seed_run takes the id. Reads no org.",readOnly:!0,args:o.strictObject({}),run:()=>({local:We})}),u({name:"seed_run",title:"Seed an org",description:`Fill an org with records, from a Seed template (template, an id seed_templates gives) or with generated rows (objects), as sandforge seed --json does. Run it with dryRun: true first: it reads the org and writes nothing, and says what a real run would meet \u2014 the data storage it takes, the emails the org's automation would send, what runs as the records are created. Past the storage the org has left, it says the counts that fit; fit: "share" seeds them, the largest share of every count that fits, and fitWithinMB holds the run to fewer MB still. checkpointFirst takes a checkpoint of what the run writes before its first write, and a dry run says what it would hold and cost. dryRun: false writes, a production org refused, and needs confirm. acceptEmails lets it write although the org delivers every email what still runs sends, or would not say whether it does; muteAutomation keeps the org's automation quiet for the run through its own bypass, and a dry run with it says what it would assign. The answer names the run file, which run_remove with module "seed" takes the run back from, and the checkpoint it took, which checkpoint_rewind returns the org to.`,readOnly:!1,destructive:!1,args:o.strictObject({org:p("The org to fill: its sf CLI alias."),template:o.string().regex(Ce,"a template id, as seed_templates gives them").optional().describe("A built-in template, by the id seed_templates gives; or give objects."),objects:o.array(o.strictObject({objectApiName:o.string().regex(x,"an object API name"),count:o.number().int().min(1).max(1e5)})).min(1).max(50).optional().describe("Objects and how many records each gets, in insert order, their fields drawn by the faker; or give template."),dryRun:o.boolean().describe("true: read the org and say what a run would do, writing nothing."),fit:o.enum(["share"]).optional().describe('"share": seed the largest share of every count that fits the data storage the org has left, each object about that share of its records, a child no more than its parents kept hold, room kept for what its flows still running create. The answer says the counts, object by object; give it to a write only once the person using you has seen them in a dry run.'),fitWithinMB:o.number().min(.01).max(1e6).optional().describe("With fit: take no more than this many MB, whatever the org has left."),checkpointFirst:ne("the seed"),acceptEmails:r("Write although the org delivers every email of what still runs as the records go in, or would not say whether it does: only once the person using you has accepted that these emails go out."),muteAutomation:se("the seed"),confirm:k("org").optional()}).refine(e=>e.fitWithinMB===void 0||e.fit!==void 0,{message:'fitWithinMB goes with fit: "share"',path:["fitWithinMB"]}),writesTo:e=>e.dryRun?void 0:e.org,writes:"creates the records of the seed in it",readFirst:"a dry run of the same seed says what it would write and meet",flags:{"--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},after:(e,t)=>e.dryRun?[]:[...me("seed",t),...ge(t)],run:e=>({script:"sandforge-seed",args:["--target",e.org,...e.template!==void 0?["--template",e.template]:[],...(e.objects??[]).flatMap(t=>["--object",`${t.objectApiName}:${t.count}`]),...e.dryRun?["--dry-run"]:[],...e.fit!==void 0?["--fit",e.fit]:[],...e.fitWithinMB!==void 0?["--fit-within",String(e.fitWithinMB)]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...re(e.checkpointFirst),"--json"]})}),u({name:"clone_record",title:"Clone a record (Forge)",description:`Clone one record from source into target with the records it needs and the ones that hang from it, as Forge's record clone and sandforge clone --record --json do. Run it with dryRun: true first: it reads both orgs, counts what it would write and says what would stop a real run \u2014 the target's automation, its data storage, the emails its flows send \u2014 and writes nothing. dryRun: false writes into target, a sandbox or a Developer Edition only, and needs confirm, the alias of target. acceptAutomation lets it write although the target runs automation as the records go in; acceptEmails, although the target delivers every email what still runs sends, or would not say whether it does, which acceptAutomation never stands for. muteAutomation keeps what the target runs quiet for the clone through the target's own bypass; what no bypass keeps quiet still needs acceptAutomation. checkpointFirst takes a checkpoint of what the clone writes before its first write, and a dry run says what it would hold and cost. The answer names the run journal, which run_remove with module "forge" takes the run back from, and the checkpoint it took, which checkpoint_rewind returns the org to.`,readOnly:!1,destructive:!1,args:o.strictObject({source:p("The org to read from: its sf CLI alias."),target:p("The org to write into: its sf CLI alias."),recordId:o.string().regex(Pe,"a 15- or 18-character Salesforce record id").describe("The record to clone, in source."),depth:o.union([o.enum(["direct","full"]),o.number().int().min(1).max(10)]).optional().describe('How far from the record discovery goes: "direct", "full", or a number of hops (default 5).'),maxNodes:o.number().int().min(10).max(500).optional().describe("How many objects discovery may reach (default 50)."),dryRun:o.boolean().describe("true: read both orgs and say what a clone would do, writing nothing."),confirm:k("target").optional(),acceptAutomation:r("Write although the target runs flows, Apex triggers, processes or workflow rules as the records go in, or would not say what it runs: only once the person using you has accepted what the dry run named."),acceptEmails:r("Write although the target delivers every email of what still runs as the records go in, or would not say whether it does. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:se("the clone"),checkpointFirst:ne("the clone")}),writesTo:e=>e.dryRun?void 0:e.target,writes:"creates the records of the clone in it",readFirst:"a dry run of the same clone says what it would write and meet",flags:{"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},after:(e,t)=>e.dryRun?[]:[...me("forge",t),...ge(t)],run:e=>({script:"sandforge-clone",args:["--record",e.recordId,"--source",e.source,"--target",e.target,...e.depth===void 0?[]:typeof e.depth=="number"?["--depth","custom","--custom-depth",String(e.depth)]:["--depth",e.depth],...e.maxNodes!==void 0?["--max-nodes",String(e.maxNodes)]:[],...e.dryRun?["--dry-run"]:[],...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...re(e.checkpointFirst),"--json"]})}),u({name:"run_remove",title:"Remove a run's records",description:`Delete from org, into its recycle bin, what one run of Seed (module "seed"), Forge (module "forge") or Sync (module "sync") created, as that script's --remove --json does; a Sync run also gives the records it wrote over their values back. run is the summary file the run's --json was saved to, its run file or journal, or, for Seed and Sync, its run id. Records changed since the run are kept, unless includeChanged. A production org is refused. Needs confirm, the alias of org. acceptAutomation lets it delete although the org runs automation as the records go; muteAutomation keeps that automation quiet for the removal through the org's own bypass. Where its user may not delete the records of some objects of the run, it stops before its first delete, unless leaveUndeletable. store, for a Sync run of a saved configuration, is that configuration's store, which the removal tells what it took.`,readOnly:!1,destructive:!0,args:o.strictObject({module:o.enum(["seed","forge","sync"]).describe("Which module made the run."),org:p("The org the run wrote to: its sf CLI alias."),run:o.string().min(1).max(4096).regex(I,'one line, not starting with "-"').describe("The run's summary file, its run file or journal, or (Seed, Sync) its run id; a relative path is read from where the server was started."),confirm:k("org").optional(),includeChanged:r("Take also the records changed since the run, and what was added to them since: on a shared sandbox, others' work. Only once the person using you has accepted it."),acceptAutomation:r("Delete although the org runs flows, Apex triggers, processes or workflow rules as the records go, or would not say what it runs: only once the person using you has accepted it."),muteAutomation:r("Keep quiet what the org runs as the records go, through its own bypass: the removal assigns the permission sets holding it to the user it deletes as, for the removal alone, under a lease, and takes them back as it ends; what no bypass keeps quiet still needs acceptAutomation. Refused on a production org and for a user who cannot assign permission sets. Only once the person using you has agreed to it."),leaveUndeletable:r("Where the user the alias connects as may not delete the records of some objects of the run, remove the rest and leave those, with the records they hang from; without it the removal stops before its first delete and names them. Only once the person using you has accepted it."),store:o.string().min(1).max(4096).regex(I,'one line, not starting with "-"').optional().describe(`module "sync" only: the directory the saved configuration the run was of is kept in, the run's --store, which the removal tells what it took, so that its next delta run reads those objects whole; a relative path is read from where the server was started. The person using you names it.`)}).refine(e=>e.store===void 0||e.module==="sync",{message:'store goes with module "sync": a Seed or Forge run keeps no configuration',path:["store"]}),writesTo:e=>e.org,writes:"deletes the records the run created, into the recycle bin",flags:{"--include-changed":"includeChanged","--accept-automation":"acceptAutomation","--mute-automation":"muteAutomation","--leave-undeletable":"leaveUndeletable"},named:{"--store":"is this tool's store: the directory of the run's saved configuration, as the person using you names it."},run:e=>({script:Me[e.module],args:["--remove",e.run,"--target",e.org,...e.includeChanged===!0?["--include-changed"]:[],...e.acceptAutomation===!0?["--accept-automation"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...e.leaveUndeletable===!0?["--leave-undeletable"]:[],...e.store!==void 0?["--store",e.store]:[],"--json"]})}),u({name:"checkpoint_list",title:"List checkpoints",description:"The checkpoints of org kept on this machine, newest first, with what a rewind and an undo can still reach. Reads this machine alone, and never contacts an org. Named org only: the other orgs' names and aliases never reach the agent.",readOnly:!0,args:o.strictObject({org:p("The org, by its sf CLI alias: its checkpoints alone.")}),run:e=>({script:"sandforge-checkpoint",args:["list","--org",e.org,"--json"]})}),u({name:"checkpoint_preview",title:"Preview a rewind",description:"What a rewind of org to a checkpoint would do: the records it would delete, give back and bring back, who last changed them, what the org runs as the rewind writes, the emails and API requests it takes, what neither a rewind nor its undo can take back, and the refusal a rewind would meet now. Given objects, those of a rewind limited to them, with what it would leave of them and the objects it needs added. Reads the org, writes nothing.",readOnly:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:$("A checkpoint of it: its id, its name, or latest (the default).").optional(),objects:ae()}),named:De,run:e=>({script:"sandforge-checkpoint",args:["preview","--org",e.org,"--checkpoint",e.checkpoint??"latest",...(e.objects??[]).flatMap(t=>["--object",t]),"--json"]})}),u({name:"checkpoint_take",title:"Take a checkpoint",description:"Read org's records and keep them on this machine as a checkpoint, to rewind the org to later: every object people work in, or the objects named. estimate: true says the records, API requests, time and disk it would take, and keeps nothing. It writes nothing to the org; the checkpoint holds the records' values unencrypted, readable by this machine's user alone. A production org is refused.",readOnly:!1,destructive:!1,args:o.strictObject({org:p("The org: its sf CLI alias."),name:o.string().min(1).max(200).regex(I,'one line, not starting with "-"').optional().describe("What it is called (default: the date and time)."),objects:o.array(o.string().regex(x,"an object API name")).min(1).max(500).optional().describe("The objects to keep, by API name (default: every object people work in)."),estimate:o.boolean().optional().describe("true: say what it would take, then stop, keeping nothing.")}),run:e=>({script:"sandforge-checkpoint",args:["take","--org",e.org,...e.name!==void 0?["--name",e.name]:[],...(e.objects??[]).flatMap(t=>["--object",t]),...e.estimate===!0?["--estimate"]:[],"--json"]})}),u({name:"checkpoint_rewind",title:"Rewind an org",description:"Return org to a checkpoint: delete the records created since, give the records changed since their values back and bring back from the recycle bin the records deleted since \u2014 whoever made those changes \u2014 then read the org again. It rewinds from its own preview, said first in its answer with who last changed what; the answer says what Undo could not bring back, and checkpoint_undo takes the rewind back. Needs confirm, the alias of org: checkpoint_preview first. Refused without acceptAutomation when the org runs automation as the rewind writes, without acceptEmails when the org delivers every email what still runs sends, or would not say whether it does, without acceptNoUndo when Undo could not bring back records it deletes, without acceptRecreate when records no longer in the recycle bin would be made again with new Ids, without acceptUnseen when, for a user without View All Data and Modify All Data, what it deletes takes along records the user is not proven to see. Given objects, it rewinds those alone, never adding what they depend on: its answer names what it left of them, the objects to add, and what still differs in the others. A production org is refused.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:$("The checkpoint: its id or its name. latest is refused: one taken since would be the one the rewind returns to."),confirm:k("org").optional(),acceptAutomation:r("Rewind although the org runs flows, Apex triggers, processes or workflow rules as records are updated, deleted or brought back, or would not say what it runs."),acceptEmails:r("Rewind although the org delivers every email its automation sends (Setup > Deliverability: All email), or would not say whether it does, and what still runs as the rewind writes sends some. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:C("the rewind"),acceptNoUndo:r("Rewind although Undo could not bring back some records it deletes (objects Salesforce undeletes only with their parent)."),acceptRecreate:r("Make again, with new Ids, the records deleted since that the recycle bin no longer gives back: what outside Salesforce names their old Ids no longer finds them."),acceptOutside:r("For a checkpoint of picked objects: also delete the records outside it created under records it deletes."),acceptUnseen:r("For a user without View All Data and Modify All Data: delete records whose delete takes along records of objects the user is not proven to see, tasks and events among them, which no count holds."),objects:ae()}),writesTo:e=>e.org,writes:"deletes the records created since the checkpoint, gives the records changed since their values back and brings back the records deleted since, whoever made those changes",readFirst:"checkpoint_preview says what it would do, writing nothing",flags:je,run:e=>({script:"sandforge-checkpoint",args:["rewind","--org",e.org,"--checkpoint",e.checkpoint,"--yes",...(e.objects??[]).flatMap(t=>["--object",t]),...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...e.acceptNoUndo===!0?["--accept-no-undo"]:[],...e.acceptRecreate===!0?["--accept-recreate"]:[],...e.acceptOutside===!0?["--accept-outside"]:[],...e.acceptUnseen===!0?["--accept-unseen"]:[],"--json"]})}),u({name:"checkpoint_undo",title:"Undo a rewind",description:"Take back org's last rewind to a checkpoint: bring back what it deleted, give back what it wrote over, send back to the recycle bin what it brought back; what anyone changed since the rewind stays, and is said. Needs confirm, the alias of org. acceptAutomation and acceptEmails as for checkpoint_rewind.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:$("The checkpoint the rewind went back to: its id or its name."),confirm:k("org").optional(),acceptAutomation:r("Undo although the org runs flows, Apex triggers, processes or workflow rules as records are updated, deleted or brought back, or would not say what it runs."),acceptEmails:r("Undo although the org delivers every email its automation sends (Setup > Deliverability: All email), or would not say whether it does, and what still runs as the undo writes sends some. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:C("the undo")}),writesTo:e=>e.org,writes:"brings back what its last rewind deleted, gives back what it wrote over and sends back to the recycle bin what it brought back",readFirst:"checkpoint_list says which rewind it would take back, and until when",flags:{"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},run:e=>({script:"sandforge-checkpoint",args:["undo","--org",e.org,"--checkpoint",e.checkpoint,"--yes",...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],"--json"]})}),u({name:"checkpoint_delete",title:"Delete a checkpoint",description:"Delete a checkpoint of org from this machine: the org is not touched, and can no longer be rewound to it, nor its last rewind to it undone. Needs confirm, the alias of org.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:$("The checkpoint: its id or its name."),confirm:k("org").optional()}),writesTo:e=>e.org,writes:"deletes the checkpoint from this machine, and the org can no longer be rewound to it",run:e=>({script:"sandforge-checkpoint",args:["delete","--org",e.org,"--checkpoint",e.checkpoint,"--yes","--json"]})}),u({name:"empty_preview",title:"Preview an emptying",description:"What emptying objects of org, or every object people work in there, would do: per object the records it deletes and what the org deletes along with them, in the order it takes them; what will likely refuse, what blocks, what no undo would bring back, what it leaves out and why; the API requests, Bulk API batches and time against what the org has left today, and the recycle bin; what the user is not proven to see; what the org runs as the records go, and its emails; and every refusal a run with the same parameters would meet now. Reads the org, deletes nothing.",readOnly:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),...de}).refine(le,{message:"give objects or wholeOrg, one of them"}),flags:ue,named:pe,run:e=>({script:"sandforge-empty",args:["--target",e.org,...he(e),...M(e),...e.acceptPeopleActive===!0?["--accept-people-active"]:[],"--dry-run","--json"]})}),u({name:"empty_run",title:"Empty objects or an org",description:"Delete every record of the objects named of org, or of every object people work in there, with what the org deletes along with them: to the recycle bin, which empty_undo brings them back from, or for good with hardDelete. It reads the org as empty_preview does, says it all first in its answer, and deletes only when nothing refuses it. Given resume, the run id of the org's last emptying stopped part way, it takes that run up instead. Needs confirm, the alias of org: empty_preview first. Refused without acceptAutomation when the org runs automation as the records go, without acceptEmails when the org delivers every email what still runs sends, or would not say whether it does, without acceptNoUndo when Undo could not bring back some records, without acceptPeopleActive while someone else changed records of these objects in the last hour, past the day's API requests or Bulk API batches, and on a production org, always.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),confirm:k("org").optional(),...de,resume:o.string().regex(ce,"the run id of an emptying, em-...").optional().describe("Take up the org's last emptying stopped part way, by its run id, in place of objects or wholeOrg: on what its journal confirmed.")}).refine(le,{message:"give objects, wholeOrg or resume, one of them"}),writesTo:e=>e.org,writes:"deletes every record of the objects named, or of every object people work in, with what the org deletes along with them",readFirst:"empty_preview says what it would delete and meet, deleting nothing",flags:ue,named:pe,after:(e,t)=>Le(t),run:e=>({script:"sandforge-empty",args:["--target",e.org,...e.resume!==void 0?["--resume",e.resume]:he(e),...M(e),...e.acceptPeopleActive===!0?["--accept-people-active"]:[],"--yes","--json"]})}),u({name:"empty_undo",title:"Undo an emptying",description:"Bring back from the recycle bin what org's last emptying deleted, parents first, while the bin holds them; the answer names what could not come back and why. Refused for a run that deleted for good. Needs confirm, the alias of org. acceptAutomation, acceptEmails and muteAutomation as for empty_run.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),run:o.string().regex(ce,"the run id of an emptying, em-...").describe("The org's last emptying, by the run id its answer gave."),confirm:k("org").optional(),acceptAutomation:r("Undo although the org runs flows, Apex triggers, processes or workflow rules as records are brought back, or would not say what it runs."),acceptEmails:r("Undo although the org delivers every email what still runs as records come back sends, or would not say whether it does. Only once the person using you has accepted that these emails go out."),muteAutomation:C("the undo")}),writesTo:e=>e.org,writes:"brings back from the recycle bin what the org's last emptying deleted",readFirst:"empty_run's answer names the run and whether its undo is offered",flags:Re,run:e=>({script:"sandforge-empty",args:["--target",e.org,"--undo",e.run,...M(e),"--yes","--json"]})}),u({name:"env_plan",title:"Plan an environment",description:"What env_apply would do to org from a sandforge.yaml (file), as sandforge env plan --json says it: per resource, create, keep, replace, delete, or why it is blocked; what an earlier apply left there and what changed since; per object the records it would write; the API requests, storage and emails it takes. Each resource is dry-run by its own script. Reads the org and the sources its resources clone from, writes nothing to an org. failOnDrift: true ends it exit 3 when the org no longer holds the environment as applied \u2014 records deleted or changed since.",readOnly:!0,args:o.strictObject({file:U(),org:p("The org to fill: its sf CLI alias."),failOnDrift:o.boolean().optional().describe("true: exit 3 when records the environment holds were deleted or changed since."),acceptEmails:r("Plan what env_apply would do with acceptEmails: a seed or a clone is otherwise blocked where the org delivers the emails what still runs sends, or would not say whether it does.")}),flags:{"--accept-emails":"acceptEmails"},exits:{3:"drift: the org no longer holds the environment as applied, records deleted or changed since, each said above"},run:e=>({script:"sandforge-env",args:["plan","--file",e.file,"--org",e.org,...e.failOnDrift===!0?["--fail-on-drift"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],"--json"]})}),u({name:"env_apply",title:"Apply an environment",description:"Do to org what env_plan says, as sandforge env apply --yes --json does: plans again, then creates what the file declares, replaces what it is told to (replace: the resources, by name) and deletes the resources the file no longer holds, each by its own script, into the state kept on this machine; applied again, it writes nothing. A production org is refused, and a sandbox the file does not list. Needs confirm, the alias of org: env_plan first. acceptNoState lets it apply to an org this machine has no state of, where records an earlier apply left would be created twice. A resource's accept: { automation: true } in the file is what lets its runs be taken back although the org runs automation. acceptEmails lets its resources write although the org delivers the emails what still runs sends, or would not say whether it does. The answer ends with the env_destroy call that takes the environment back.",readOnly:!1,destructive:!0,args:o.strictObject({file:U(),org:p("The org to fill: its sf CLI alias."),confirm:k("org").optional(),replace:o.array(o.string().regex(Fe,"a resource of the file, by its name")).min(1).max(50).optional().describe("Resources to replace although kept or drifted, by their names in the file: their earlier runs are taken back, then run again."),acceptNoState:r("Apply to a Developer Edition or a sandbox this machine has no state of: records an earlier apply left there would be created twice. Only once the person using you has accepted it."),acceptEmails:r("Apply although the org delivers every email its automation sends (Setup > Deliverability: All email), or would not say whether it does, and what still runs as its resources write sends some. Only once the person using you has accepted that these emails go out.")}),writesTo:e=>e.org,writes:"creates, replaces and deletes the resources of the file there as its plan says, taking back the earlier runs a replace or a delete takes back",readFirst:"env_plan of the same file says what it would do, writing nothing",flags:{"--accept-no-state":"acceptNoState","--accept-emails":"acceptEmails"},named:{"--accept-automation":ie("env_apply")},after:e=>[`env_destroy with file "${e.file}" and org "${e.org}" takes this environment back.`],run:e=>({script:"sandforge-env",args:["apply","--file",e.file,"--org",e.org,...(e.replace??[]).flatMap(t=>["--replace",t]),...e.acceptNoState===!0?["--accept-no-state"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],"--yes","--json"]})}),u({name:"env_destroy",title:"Destroy an environment",description:"Take back from org what env_apply created there from file, the last resource first, into its recycle bin, as sandforge env destroy --yes --json does; what it cannot take back is named, with why. Records changed since the apply are kept unless includeChanged: on a shared sandbox, a colleague\u2019s work. A production org is refused. Needs confirm, the alias of org. It takes back by removal alone: no rewind to a checkpoint.",readOnly:!1,destructive:!0,args:o.strictObject({file:U(),org:p("The org the environment was applied to: its sf CLI alias."),confirm:k("org").optional(),includeChanged:r("Take also the records changed since the apply, and what was created under them since: on a shared sandbox, others' work. Only once the person using you has accepted it.")}),writesTo:e=>e.org,writes:"deletes the records its applies created, into the recycle bin, the last resource first",readFirst:"env_plan of the same file says what the org holds of the environment and what changed since",flags:{"--include-changed":"includeChanged"},named:{"--accept-automation":ie("env_destroy")},run:e=>({script:"sandforge-env",args:["destroy","--file",e.file,"--org",e.org,...e.includeChanged===!0?["--include-changed"]:[],"--yes","--json"]})})],Ue=new Map(F.map(e=>[e.definition.name,e]));async function We(){let{templateDisplayName:e}=await import("./sandforge-seed.mjs"),t=J.map(n=>{let s=n.objects.map(c=>({objectApiName:c.objectApiName,records:c.recordCount}));return{id:n.id,name:e(n),description:e({name:n.description}),objects:s,records:s.reduce((c,m)=>c+m.records,0)}});return{text:t.map(n=>`${n.id} \u2014 ${n.name}: ${n.records} records at most in ${n.objects.length} objects (${n.objects.map(s=>`${s.objectApiName} ${s.records}`).join(", ")})`).join(`
|
|
8
|
-
`),structured:{templates:t}}}function
|
|
9
|
-
${n.stdout}`;for(let[R,T]of Object.entries(e.flags))
|
|
10
|
-
`)},{type:"text",text:JSON.stringify(
|
|
11
|
-
`)}),s,c=new Map,m=new Set,w=new Set,g=d=>{e.send(JSON.stringify({jsonrpc:"2.0",...d}))},b=(d,a)=>d==="perRequest"?{resultType:"complete",...a,_meta:{[E.serverInfo]:
|
|
12
|
-
`)}}var
|
|
7
|
+
import{b as Q}from"./chunk-YS4G22C2.mjs";import"./chunk-QROPNEGY.mjs";import{a as X,b as M,e as Y}from"./chunk-BZ24IAP5.mjs";import{a as _,b as V}from"./chunk-SCKUIE3R.mjs";import{a as Z,b as K,g as ee}from"./chunk-MTMH6H2A.mjs";import{eb as G,x as q}from"./chunk-TTFDUKUS.mjs";import{A as o}from"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as _e}from"node:fs";import{join as Ee}from"node:path";import{createInterface as Ie}from"node:readline";var x="2026-07-28",I=["2025-11-25","2025-06-18","2025-03-26"],E={version:"io.modelcontextprotocol/protocolVersion",capabilities:"io.modelcontextprotocol/clientCapabilities",serverInfo:"io.modelcontextprotocol/serverInfo"},f={parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603,unsupportedVersion:-32022},te=60*6e4,oe={name:"sandforge",title:"SandForge",version:String(JSON.parse(_e(Ee(__dirname,"..","package.json"),"utf8")).version??"0.0.0")},ne=`SandForge's Seed, Forge's clone of a record, the removal of a run, the emptying of objects or of a whole org, Checkpoints and the environments of a sandforge.yaml, run from the sandforge npm package. Every org is named by its sf CLI alias, as \`sf alias list\` shows them. A tool that writes to an org takes confirm, the alias of that org exactly: give it only once the person using you has agreed to that write, after a dry run, a preview or a plan has said what it would do. The acceptances (acceptAutomation and the others) are theirs to give too. A production org is refused by every tool that writes to an org. Each answer carries the script's own JSON, its exit code and its lines. No tool clones the whole org, a sample of it that fits the target (${_("clone")} --depth all --fit share, its --dry-run first), or whole tables (${_("clone")} --object <ApiName> --where <condition>), nor compares two orgs (${_("compare")}) or takes a DataOps snapshot (${_("backup")}): give the person the command to run in a terminal, or a sandforge.yaml resource that env_plan and env_apply run.`,Ne=1e6;function $e(e={}){return Q({...e,relayedBy:"sandforge mcp"})}var Pe=$e();function Ce(e){let t=o.toJSONSchema(e);return delete t.$schema,t}function u(e){return{definition:{name:e.name,title:e.title,description:e.description,inputSchema:Ce(e.args),annotations:{title:e.title,readOnlyHint:e.readOnly,...e.readOnly?{}:{destructiveHint:e.destructive===!0}}},...e.writes!==void 0?{writes:e.writes}:{},...e.readFirst!==void 0?{readFirst:e.readFirst}:{},flags:e.flags??{},named:e.named??{},exits:e.exits??{},read:t=>{let n=e.args.safeParse(t);if(!n.success)return{refusal:n.error.issues.map(w=>`${w.path.join(".")||"arguments"}: ${w.message}`).join("; ")};let s=n.data,c=e.writesTo?.(s),m=s.confirm;return{call:{...c!==void 0?{writesTo:c}:{},...typeof m=="string"?{confirm:m}:{},run:e.run(s),after:w=>e.after?.(s,w)??[]}}}}}var S=/^[A-Za-z][A-Za-z0-9_]{0,79}$/,Fe=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,De=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,N=/^[^-\r\n][^\r\n]*$/,Le=/^[a-z][a-z0-9-]{0,62}$/,p=e=>o.string().regex(K,'an sf CLI alias, or the username it stands for, not starting with "-"').describe(e),k=e=>o.string().max(255).describe(`The alias of ${e} again, exactly as given: the person using you agrees to this write. Without it, the call is refused before anything is read.`),P=e=>o.string().min(1).max(200).regex(N,'one line, not starting with "-"').describe(e),r=e=>o.boolean().optional().describe(e),re=e=>o.strictObject({keepDays:o.number().int().min(q.min).max(q.max).optional().describe("The days it is kept on this machine; 0 until it is deleted (default 7)."),excluded:o.array(o.string().regex(S,"an object API name")).min(1).max(500).optional().describe("Objects to leave out of it, by API name, named in the answer: a rewind leaves their records as they are.")}).optional().describe(`Before ${e}'s first write, take a checkpoint of each object it writes, and of each the target's flows that still run create as it writes them, held whole: {} takes it with the defaults. Its cost is that of the tables, not of the records written, and its values stay unencrypted on this machine: give it only once the person using you has seen, in a dry run with it, what it would hold and cost. Refused, ${e} writes nothing; deleted again when it writes nothing.`);function se(e){return e===void 0?[]:["--checkpoint-first",...e.keepDays!==void 0?["--checkpoint-keep-days",String(e.keepDays)]:[],...(e.excluded??[]).flatMap(t=>["--checkpoint-exclude-object",t])]}var ie=e=>r(`Keep quiet what the org runs as ${e} writes, through its own bypass: the permission sets holding it are assigned to the user it writes as, for the run alone, under a lease, and taken back as it ends; what no bypass keeps quiet still runs. A dry run with it says what it would assign, and assigns nothing. Refused on a production org and for a user who cannot assign permission sets. Only once the person using you has agreed to it.`),F=e=>r(`Keep quiet what the org runs as ${e} writes, through its own bypass: the permission sets holding it are assigned to the user it writes as, for ${e} alone, under a lease, and taken back as it ends; what no bypass keeps quiet still needs acceptAutomation. Refused on a production org and for a user who cannot assign permission sets. Only once the person using you has agreed to it.`);function ae(e){return`is no parameter of ${e}: an environment's acceptance of automation is its file's. Write accept: { automation: true } on the resource whose run it names, in the file, once the person using you has accepted what fires, then call ${e} again.`}var Re={"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation","--accept-no-undo":"acceptNoUndo","--accept-recreate":"acceptRecreate","--accept-outside":"acceptOutside","--accept-unseen":"acceptUnseen"},qe=Object.fromEntries(Object.entries(Re).map(([e,t])=>[e,`is checkpoint_rewind's ${t}: true, on the rewind this preview is of. Give it only once the person using you has accepted what it lets through.`])),ce=()=>o.array(o.string().regex(S,"an object API name")).min(1).max(500).optional().describe("Limit the rewind to these objects of the checkpoint, by API name (default: every object). What they depend on is never added: the answer names it."),de=/^em-\d{8}-\d{6}-[a-z0-9]{4}$/,le={objects:o.array(o.string().regex(S,"an object API name")).min(1).max(500).optional().describe("Empty these objects, by API name: every record of each. Not with wholeOrg."),wholeOrg:o.literal(!0).optional().describe("Empty every object people work in, less users, setup, Chatter, history, sharing, the org's flows, settings and definitions, and the standard price book. Not with objects."),excluded:o.array(o.string().regex(S,"an object API name")).min(1).max(500).optional().describe("With wholeOrg: objects to leave out, by API name."),customSettings:r("With wholeOrg: empty the custom settings too."),files:r("With wholeOrg: empty the files and attachments too."),managedPackages:r("With wholeOrg: empty the objects of managed packages too."),unrestorable:r("With wholeOrg: empty too, by passes of their own, the objects whose records Salesforce does not bring back from the recycle bin on their own. Only once the person using you has accepted that Undo cannot bring those back."),hardDelete:r("Delete for good, with what goes along: nothing goes to the recycle bin and no undo brings anything back. Needs the Bulk API Hard Delete permission of the user. Only once the person using you has accepted that nothing can be brought back."),checkpointFirst:r("Take a checkpoint of the objects emptied before the first delete, to rewind to."),acceptAutomation:r("Empty although the org runs flows, Apex triggers, processes or workflow rules as the records are deleted, or would not say what it runs."),acceptEmails:r("Empty although the org delivers every email what still runs as the records go sends, or would not say whether it does. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:F("the emptying"),acceptNoUndo:r("Empty although some records go before a record they name, as Salesforce requires, so that Undo cannot bring them back once both have gone."),acceptPeopleActive:r("Empty although people other than the user changed records of these objects in the hour before the read, their work going with it: empty_preview says how many and each one's last change. It covers those the preview named, and taking up a run, whoever. Only once the person using you has accepted that their work goes.")};function he(e){return[e.objects,e.wholeOrg,e.resume].filter(n=>n!==void 0).length===1}function ue(e){return[...e.objects!==void 0?["--objects",e.objects.join(",")]:[],...e.wholeOrg===!0?["--org"]:[],...(e.excluded??[]).flatMap(t=>["--exclude-object",t]),...e.customSettings===!0?["--custom-settings"]:[],...e.files===!0?["--files"]:[],...e.managedPackages===!0?["--managed-packages"]:[],...e.unrestorable===!0?["--unrestorable"]:[],...e.hardDelete===!0?["--hard-delete"]:[],...e.checkpointFirst===!0?["--checkpoint-first"]:[],...e.acceptNoUndo===!0?["--accept-no-undo"]:[]]}function U(e){return[...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[]]}var Oe={"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},pe={...Oe,"--accept-no-undo":"acceptNoUndo","--accept-people-active":"acceptPeopleActive"},me={"--undo":"is empty_undo, with the run the line names: it brings back what that run deleted.","--resume":"is empty_run's resume, with the run the line names: it takes that run up."};function Me(e){if(typeof e!="object"||e===null)return[];let{result:t}=e;return typeof t?.runId=="string"&&t.runId!==""&&t.undo?.offered===!0?[`empty_undo with run "${t.runId}" brings back what it deleted while the recycle bin holds it, as long as no other emptying of the org follows.`]:[]}var W=()=>o.string().min(1).max(4096).regex(N,'one line, not starting with "-"').describe("The sandforge.yaml, by its path; a relative path is read from where the server was started.");function Ue(e,t,n){let s=n===void 0?"gives no confirm":`gives confirm "${n}", which is not "${t}", the alias of the org it writes to`;return`${e.definition.name} writes to ${t}: it ${e.writes??"writes to the org"}. This call ${s}. `+(e.readFirst!==void 0?`Before it, ${e.readFirst}. `:"")+`Give confirm: "${t}" once the person using you has agreed to this write. Refused: nothing was read or written.`}function ge(e,t){if(typeof t!="object"||t===null)return[];let{runFile:n,journal:s}=t,c=e==="seed"?n:s;return typeof c=="string"?[`run_remove with module "${e}" and run "${c}" takes this run back.`]:[]}function fe(e){if(typeof e!="object"||e===null)return[];let{checkpoint:t}=e;return t?.state==="taken"&&typeof t.checkpointId=="string"?[`checkpoint_rewind with checkpoint "${t.checkpointId}" returns the org to how it was before this run, and takes back what anyone did since on the objects it holds: checkpoint_preview says what it would do first.`]:[]}var We={seed:"sandforge-seed",forge:"sandforge-clone",sync:"sandforge-sync"},D=[u({name:"seed_templates",title:"Seed templates",description:"The built-in Seed templates, as the Seed page's gallery lists them: id, name, what it is for, and the records each object gets at most. The first is the one a new Developer Edition holds whole. seed_run takes the id. Reads no org.",readOnly:!0,args:o.strictObject({}),run:()=>({local:Be})}),u({name:"seed_run",title:"Seed an org",description:`Fill an org with records, from a Seed template (template, an id seed_templates gives) or with generated rows (objects), as sandforge seed --json does. Run it with dryRun: true first: it reads the org and writes nothing, and says what a real run would meet \u2014 the data storage it takes, the emails the org's automation would send, what runs as the records are created. Past the storage the org has left, it says the counts that fit; fit: "share" seeds them, the largest share of every count that fits, and fitWithinMB holds the run to fewer MB still. checkpointFirst takes a checkpoint of what the run writes before its first write, and a dry run says what it would hold and cost. dryRun: false writes, a production org refused, and needs confirm. acceptEmails lets it write although the org delivers every email what still runs sends, or would not say whether it does; muteAutomation keeps the org's automation quiet for the run through its own bypass, and a dry run with it says what it would assign. The answer names the run file, which run_remove with module "seed" takes the run back from, and the checkpoint it took, which checkpoint_rewind returns the org to.`,readOnly:!1,destructive:!1,args:o.strictObject({org:p("The org to fill: its sf CLI alias."),template:o.string().regex(De,"a template id, as seed_templates gives them").optional().describe("A built-in template, by the id seed_templates gives; or give objects."),objects:o.array(o.strictObject({objectApiName:o.string().regex(S,"an object API name"),count:o.number().int().min(1).max(1e5)})).min(1).max(50).optional().describe("Objects and how many records each gets, in insert order, their fields drawn by the faker; or give template."),dryRun:o.boolean().describe("true: read the org and say what a run would do, writing nothing."),fit:o.enum(["share"]).optional().describe('"share": seed the largest share of every count that fits the data storage the org has left, each object about that share of its records, a child no more than its parents kept hold, room kept for what its flows still running create. The answer says the counts, object by object; give it to a write only once the person using you has seen them in a dry run.'),fitWithinMB:o.number().min(.01).max(1e6).optional().describe("With fit: take no more than this many MB, whatever the org has left."),checkpointFirst:re("the seed"),acceptEmails:r("Write although the org delivers every email of what still runs as the records go in, or would not say whether it does: only once the person using you has accepted that these emails go out."),muteAutomation:ie("the seed"),confirm:k("org").optional()}).refine(e=>e.fitWithinMB===void 0||e.fit!==void 0,{message:'fitWithinMB goes with fit: "share"',path:["fitWithinMB"]}),writesTo:e=>e.dryRun?void 0:e.org,writes:"creates the records of the seed in it",readFirst:"a dry run of the same seed says what it would write and meet",flags:{"--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},after:(e,t)=>e.dryRun?[]:[...ge("seed",t),...fe(t)],run:e=>({script:"sandforge-seed",args:["--target",e.org,...e.template!==void 0?["--template",e.template]:[],...(e.objects??[]).flatMap(t=>["--object",`${t.objectApiName}:${t.count}`]),...e.dryRun?["--dry-run"]:[],...e.fit!==void 0?["--fit",e.fit]:[],...e.fitWithinMB!==void 0?["--fit-within",String(e.fitWithinMB)]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...se(e.checkpointFirst),"--json"]})}),u({name:"clone_record",title:"Clone a record (Forge)",description:`Clone one record from source into target with the records it needs and the ones that hang from it, as Forge's record clone and sandforge clone --record --json do. Run it with dryRun: true first: it reads both orgs, counts what it would write and says what would stop a real run \u2014 the target's automation, its data storage, the emails its flows send \u2014 and writes nothing. dryRun: false writes into target, a sandbox or a Developer Edition only, and needs confirm, the alias of target. acceptAutomation lets it write although the target runs automation as the records go in; acceptEmails, although the target delivers every email what still runs sends, or would not say whether it does, which acceptAutomation never stands for. muteAutomation keeps what the target runs quiet for the clone through the target's own bypass; what no bypass keeps quiet still needs acceptAutomation. checkpointFirst takes a checkpoint of what the clone writes before its first write, and a dry run says what it would hold and cost. The answer names the run journal, which run_remove with module "forge" takes the run back from, and the checkpoint it took, which checkpoint_rewind returns the org to.`,readOnly:!1,destructive:!1,args:o.strictObject({source:p("The org to read from: its sf CLI alias."),target:p("The org to write into: its sf CLI alias."),recordId:o.string().regex(Fe,"a 15- or 18-character Salesforce record id").describe("The record to clone, in source."),depth:o.union([o.enum(["direct","full"]),o.number().int().min(1).max(10)]).optional().describe('How far from the record discovery goes: "direct", "full", or a number of hops (default 5).'),maxNodes:o.number().int().min(10).max(500).optional().describe("How many objects discovery may reach (default 50)."),dryRun:o.boolean().describe("true: read both orgs and say what a clone would do, writing nothing."),confirm:k("target").optional(),acceptAutomation:r("Write although the target runs flows, Apex triggers, processes or workflow rules as the records go in, or would not say what it runs: only once the person using you has accepted what the dry run named."),acceptEmails:r("Write although the target delivers every email of what still runs as the records go in, or would not say whether it does. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:ie("the clone"),checkpointFirst:re("the clone")}),writesTo:e=>e.dryRun?void 0:e.target,writes:"creates the records of the clone in it",readFirst:"a dry run of the same clone says what it would write and meet",flags:{"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},after:(e,t)=>e.dryRun?[]:[...ge("forge",t),...fe(t)],run:e=>({script:"sandforge-clone",args:["--record",e.recordId,"--source",e.source,"--target",e.target,...e.depth===void 0?[]:typeof e.depth=="number"?["--depth","custom","--custom-depth",String(e.depth)]:["--depth",e.depth],...e.maxNodes!==void 0?["--max-nodes",String(e.maxNodes)]:[],...e.dryRun?["--dry-run"]:[],...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...se(e.checkpointFirst),"--json"]})}),u({name:"run_remove",title:"Remove a run's records",description:`Delete from org, into its recycle bin, what one run of Seed (module "seed"), Forge (module "forge") or Sync (module "sync") created, as that script's --remove --json does; a Sync run also gives the records it wrote over their values back. run is the summary file the run's --json was saved to, its run file or journal, or, for Seed and Sync, its run id. Records changed since the run are kept, unless includeChanged. A production org is refused. Needs confirm, the alias of org. acceptAutomation lets it delete although the org runs automation as the records go; muteAutomation keeps that automation quiet for the removal through the org's own bypass. Where its user may not delete the records of some objects of the run, it stops before its first delete, unless leaveUndeletable. store, for a Sync run of a saved configuration, is that configuration's store, which the removal tells what it took.`,readOnly:!1,destructive:!0,args:o.strictObject({module:o.enum(["seed","forge","sync"]).describe("Which module made the run."),org:p("The org the run wrote to: its sf CLI alias."),run:o.string().min(1).max(4096).regex(N,'one line, not starting with "-"').describe("The run's summary file, its run file or journal, or (Seed, Sync) its run id; a relative path is read from where the server was started."),confirm:k("org").optional(),includeChanged:r("Take also the records changed since the run, and what was added to them since: on a shared sandbox, others' work. Only once the person using you has accepted it."),acceptAutomation:r("Delete although the org runs flows, Apex triggers, processes or workflow rules as the records go, or would not say what it runs: only once the person using you has accepted it."),muteAutomation:r("Keep quiet what the org runs as the records go, through its own bypass: the removal assigns the permission sets holding it to the user it deletes as, for the removal alone, under a lease, and takes them back as it ends; what no bypass keeps quiet still needs acceptAutomation. Refused on a production org and for a user who cannot assign permission sets. Only once the person using you has agreed to it."),leaveUndeletable:r("Where the user the alias connects as may not delete the records of some objects of the run, remove the rest and leave those, with the records they hang from; without it the removal stops before its first delete and names them. Only once the person using you has accepted it."),store:o.string().min(1).max(4096).regex(N,'one line, not starting with "-"').optional().describe(`module "sync" only: the directory the saved configuration the run was of is kept in, the run's --store, which the removal tells what it took, so that its next delta run reads those objects whole; a relative path is read from where the server was started. The person using you names it.`)}).refine(e=>e.store===void 0||e.module==="sync",{message:'store goes with module "sync": a Seed or Forge run keeps no configuration',path:["store"]}),writesTo:e=>e.org,writes:"deletes the records the run created, into the recycle bin",flags:{"--include-changed":"includeChanged","--accept-automation":"acceptAutomation","--mute-automation":"muteAutomation","--leave-undeletable":"leaveUndeletable"},named:{"--store":"is this tool's store: the directory of the run's saved configuration, as the person using you names it."},run:e=>({script:We[e.module],args:["--remove",e.run,"--target",e.org,...e.includeChanged===!0?["--include-changed"]:[],...e.acceptAutomation===!0?["--accept-automation"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...e.leaveUndeletable===!0?["--leave-undeletable"]:[],...e.store!==void 0?["--store",e.store]:[],"--json"]})}),u({name:"checkpoint_list",title:"List checkpoints",description:"The checkpoints of org kept on this machine, newest first, with what a rewind and an undo can still reach. Reads this machine alone, and never contacts an org. Named org only: the other orgs' names and aliases never reach the agent.",readOnly:!0,args:o.strictObject({org:p("The org, by its sf CLI alias: its checkpoints alone.")}),run:e=>({script:"sandforge-checkpoint",args:["list","--org",e.org,"--json"]})}),u({name:"checkpoint_preview",title:"Preview a rewind",description:"What a rewind of org to a checkpoint would do: the records it would delete, give back and bring back, who last changed them, what the org runs as the rewind writes, the emails and API requests it takes, what neither a rewind nor its undo can take back, and the refusal a rewind would meet now. Given objects, those of a rewind limited to them, with what it would leave of them and the objects it needs added. Reads the org, writes nothing.",readOnly:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:P("A checkpoint of it: its id, its name, or latest (the default).").optional(),objects:ce()}),named:qe,run:e=>({script:"sandforge-checkpoint",args:["preview","--org",e.org,"--checkpoint",e.checkpoint??"latest",...(e.objects??[]).flatMap(t=>["--object",t]),"--json"]})}),u({name:"checkpoint_take",title:"Take a checkpoint",description:"Read org's records and keep them on this machine as a checkpoint, to rewind the org to later: every object people work in, or the objects named. estimate: true says the records, API requests, time and disk it would take, and keeps nothing. It writes nothing to the org; the checkpoint holds the records' values unencrypted, readable by this machine's user alone. A production org is refused.",readOnly:!1,destructive:!1,args:o.strictObject({org:p("The org: its sf CLI alias."),name:o.string().min(1).max(200).regex(N,'one line, not starting with "-"').optional().describe("What it is called (default: the date and time)."),objects:o.array(o.string().regex(S,"an object API name")).min(1).max(500).optional().describe("The objects to keep, by API name (default: every object people work in)."),maxTotal:o.number().int().min(1).max(Ne).optional().describe("The most records it holds, all objects together (default 500,000, a million at most): past it, it is refused before reading any, the refusal naming --max-total, which this sets."),estimate:o.boolean().optional().describe("true: say what it would take, then stop, keeping nothing.")}),run:e=>({script:"sandforge-checkpoint",args:["take","--org",e.org,...e.name!==void 0?["--name",e.name]:[],...(e.objects??[]).flatMap(t=>["--object",t]),...e.maxTotal!==void 0?["--max-total",String(e.maxTotal)]:[],...e.estimate===!0?["--estimate"]:[],"--json"]})}),u({name:"checkpoint_rewind",title:"Rewind an org",description:"Return org to a checkpoint: delete the records created since, give the records changed since their values back and bring back from the recycle bin the records deleted since \u2014 whoever made those changes \u2014 then read the org again. It rewinds from its own preview, said first in its answer with who last changed what; the answer says what Undo could not bring back, and checkpoint_undo takes the rewind back. Needs confirm, the alias of org: checkpoint_preview first. Refused without acceptAutomation when the org runs automation as the rewind writes, without acceptEmails when the org delivers every email what still runs sends, or would not say whether it does, without acceptNoUndo when Undo could not bring back records it deletes, without acceptRecreate when records no longer in the recycle bin would be made again with new Ids, without acceptUnseen when, for a user without View All Data and Modify All Data, what it deletes takes along records the user is not proven to see. Given objects, it rewinds those alone, never adding what they depend on: its answer names what it left of them, the objects to add, and what still differs in the others. A production org is refused.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:P("The checkpoint: its id or its name. latest is refused: one taken since would be the one the rewind returns to."),confirm:k("org").optional(),acceptAutomation:r("Rewind although the org runs flows, Apex triggers, processes or workflow rules as records are updated, deleted or brought back, or would not say what it runs."),acceptEmails:r("Rewind although the org delivers every email its automation sends (Setup > Deliverability: All email), or would not say whether it does, and what still runs as the rewind writes sends some. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:F("the rewind"),acceptNoUndo:r("Rewind although Undo could not bring back some records it deletes (objects Salesforce undeletes only with their parent)."),acceptRecreate:r("Make again, with new Ids, the records deleted since that the recycle bin no longer gives back: what outside Salesforce names their old Ids no longer finds them."),acceptOutside:r("For a checkpoint of picked objects: also delete the records outside it created under records it deletes."),acceptUnseen:r("For a user without View All Data and Modify All Data: delete records whose delete takes along records of objects the user is not proven to see, tasks and events among them, which no count holds."),objects:ce()}),writesTo:e=>e.org,writes:"deletes the records created since the checkpoint, gives the records changed since their values back and brings back the records deleted since, whoever made those changes",readFirst:"checkpoint_preview says what it would do, writing nothing",flags:Re,run:e=>({script:"sandforge-checkpoint",args:["rewind","--org",e.org,"--checkpoint",e.checkpoint,"--yes",...(e.objects??[]).flatMap(t=>["--object",t]),...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],...e.acceptNoUndo===!0?["--accept-no-undo"]:[],...e.acceptRecreate===!0?["--accept-recreate"]:[],...e.acceptOutside===!0?["--accept-outside"]:[],...e.acceptUnseen===!0?["--accept-unseen"]:[],"--json"]})}),u({name:"checkpoint_undo",title:"Undo a rewind",description:"Take back org's last rewind to a checkpoint: bring back what it deleted, give back what it wrote over, send back to the recycle bin what it brought back; what anyone changed since the rewind stays, and is said. Needs confirm, the alias of org. acceptAutomation and acceptEmails as for checkpoint_rewind.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:P("The checkpoint the rewind went back to: its id or its name."),confirm:k("org").optional(),acceptAutomation:r("Undo although the org runs flows, Apex triggers, processes or workflow rules as records are updated, deleted or brought back, or would not say what it runs."),acceptEmails:r("Undo although the org delivers every email its automation sends (Setup > Deliverability: All email), or would not say whether it does, and what still runs as the undo writes sends some. acceptAutomation never stands for it. Only once the person using you has accepted that these emails go out."),muteAutomation:F("the undo")}),writesTo:e=>e.org,writes:"brings back what its last rewind deleted, gives back what it wrote over and sends back to the recycle bin what it brought back",readFirst:"checkpoint_list says which rewind it would take back, and until when",flags:{"--accept-automation":"acceptAutomation","--accept-emails":"acceptEmails","--mute-automation":"muteAutomation"},run:e=>({script:"sandforge-checkpoint",args:["undo","--org",e.org,"--checkpoint",e.checkpoint,"--yes",...e.acceptAutomation===!0?["--accept-automation"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],...e.muteAutomation===!0?["--mute-automation"]:[],"--json"]})}),u({name:"checkpoint_delete",title:"Delete a checkpoint",description:"Delete a checkpoint of org from this machine: the org is not touched, and can no longer be rewound to it, nor its last rewind to it undone. Needs confirm, the alias of org.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),checkpoint:P("The checkpoint: its id or its name."),confirm:k("org").optional()}),writesTo:e=>e.org,writes:"deletes the checkpoint from this machine, and the org can no longer be rewound to it",run:e=>({script:"sandforge-checkpoint",args:["delete","--org",e.org,"--checkpoint",e.checkpoint,"--yes","--json"]})}),u({name:"empty_preview",title:"Preview an emptying",description:"What emptying objects of org, or every object people work in there, would do: per object the records it deletes and what the org deletes along with them, in the order it takes them; what will likely refuse, what blocks, what no undo would bring back, what it leaves out and why; the API requests, Bulk API batches and time against what the org has left today, and the recycle bin; what the user is not proven to see; what the org runs as the records go, and its emails; and every refusal a run with the same parameters would meet now. Reads the org, deletes nothing.",readOnly:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),...le}).refine(he,{message:"give objects or wholeOrg, one of them"}),flags:pe,named:me,run:e=>({script:"sandforge-empty",args:["--target",e.org,...ue(e),...U(e),...e.acceptPeopleActive===!0?["--accept-people-active"]:[],"--dry-run","--json"]})}),u({name:"empty_run",title:"Empty objects or an org",description:"Delete every record of the objects named of org, or of every object people work in there, with what the org deletes along with them: to the recycle bin, which empty_undo brings them back from, or for good with hardDelete. It reads the org as empty_preview does, says it all first in its answer, and deletes only when nothing refuses it. Given resume, the run id of the org's last emptying stopped part way, it takes that run up instead. Needs confirm, the alias of org: empty_preview first. Refused without acceptAutomation when the org runs automation as the records go, without acceptEmails when the org delivers every email what still runs sends, or would not say whether it does, without acceptNoUndo when Undo could not bring back some records, without acceptPeopleActive while someone else changed records of these objects in the last hour, past the day's API requests or Bulk API batches, and on a production org, always.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),confirm:k("org").optional(),...le,resume:o.string().regex(de,"the run id of an emptying, em-...").optional().describe("Take up the org's last emptying stopped part way, by its run id, in place of objects or wholeOrg: on what its journal confirmed.")}).refine(he,{message:"give objects, wholeOrg or resume, one of them"}),writesTo:e=>e.org,writes:"deletes every record of the objects named, or of every object people work in, with what the org deletes along with them",readFirst:"empty_preview says what it would delete and meet, deleting nothing",flags:pe,named:me,after:(e,t)=>Me(t),run:e=>({script:"sandforge-empty",args:["--target",e.org,...e.resume!==void 0?["--resume",e.resume]:ue(e),...U(e),...e.acceptPeopleActive===!0?["--accept-people-active"]:[],"--yes","--json"]})}),u({name:"empty_undo",title:"Undo an emptying",description:"Bring back from the recycle bin what org's last emptying deleted, parents first, while the bin holds them; the answer names what could not come back and why. Refused for a run that deleted for good. Needs confirm, the alias of org. acceptAutomation, acceptEmails and muteAutomation as for empty_run.",readOnly:!1,destructive:!0,args:o.strictObject({org:p("The org: its sf CLI alias."),run:o.string().regex(de,"the run id of an emptying, em-...").describe("The org's last emptying, by the run id its answer gave."),confirm:k("org").optional(),acceptAutomation:r("Undo although the org runs flows, Apex triggers, processes or workflow rules as records are brought back, or would not say what it runs."),acceptEmails:r("Undo although the org delivers every email what still runs as records come back sends, or would not say whether it does. Only once the person using you has accepted that these emails go out."),muteAutomation:F("the undo")}),writesTo:e=>e.org,writes:"brings back from the recycle bin what the org's last emptying deleted",readFirst:"empty_run's answer names the run and whether its undo is offered",flags:Oe,run:e=>({script:"sandforge-empty",args:["--target",e.org,"--undo",e.run,...U(e),"--yes","--json"]})}),u({name:"env_plan",title:"Plan an environment",description:"What env_apply would do to org from a sandforge.yaml (file), as sandforge env plan --json says it: per resource, create, keep, replace, delete, or why it is blocked; what an earlier apply left there and what changed since; per object the records it would write; the API requests, storage and emails it takes. Each resource is dry-run by its own script. Reads the org and the sources its resources clone from, writes nothing to an org. failOnDrift: true ends it exit 3 when the org no longer holds the environment as applied \u2014 records deleted or changed since.",readOnly:!0,args:o.strictObject({file:W(),org:p("The org to fill: its sf CLI alias."),failOnDrift:o.boolean().optional().describe("true: exit 3 when records the environment holds were deleted or changed since."),acceptEmails:r("Plan what env_apply would do with acceptEmails: a seed or a clone is otherwise blocked where the org delivers the emails what still runs sends, or would not say whether it does.")}),flags:{"--accept-emails":"acceptEmails"},exits:{3:"drift: the org no longer holds the environment as applied, records deleted or changed since, each said above"},run:e=>({script:"sandforge-env",args:["plan","--file",e.file,"--org",e.org,...e.failOnDrift===!0?["--fail-on-drift"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],"--json"]})}),u({name:"env_apply",title:"Apply an environment",description:"Do to org what env_plan says, as sandforge env apply --yes --json does: plans again, then creates what the file declares, replaces what it is told to (replace: the resources, by name) and deletes the resources the file no longer holds, each by its own script, into the state kept on this machine; applied again, it writes nothing. A production org is refused, and a sandbox the file does not list. Needs confirm, the alias of org: env_plan first. acceptNoState lets it apply to an org this machine has no state of, where records an earlier apply left would be created twice. A resource's accept: { automation: true } in the file is what lets its runs be taken back although the org runs automation. acceptEmails lets its resources write although the org delivers the emails what still runs sends, or would not say whether it does. The answer ends with the env_destroy call that takes the environment back.",readOnly:!1,destructive:!0,args:o.strictObject({file:W(),org:p("The org to fill: its sf CLI alias."),confirm:k("org").optional(),replace:o.array(o.string().regex(Le,"a resource of the file, by its name")).min(1).max(50).optional().describe("Resources to replace although kept or drifted, by their names in the file: their earlier runs are taken back, then run again."),acceptNoState:r("Apply to a Developer Edition or a sandbox this machine has no state of: records an earlier apply left there would be created twice. Only once the person using you has accepted it."),acceptEmails:r("Apply although the org delivers every email its automation sends (Setup > Deliverability: All email), or would not say whether it does, and what still runs as its resources write sends some. Only once the person using you has accepted that these emails go out.")}),writesTo:e=>e.org,writes:"creates, replaces and deletes the resources of the file there as its plan says, taking back the earlier runs a replace or a delete takes back",readFirst:"env_plan of the same file says what it would do, writing nothing",flags:{"--accept-no-state":"acceptNoState","--accept-emails":"acceptEmails"},named:{"--accept-automation":ae("env_apply")},after:e=>[`env_destroy with file "${e.file}" and org "${e.org}" takes this environment back.`],run:e=>({script:"sandforge-env",args:["apply","--file",e.file,"--org",e.org,...(e.replace??[]).flatMap(t=>["--replace",t]),...e.acceptNoState===!0?["--accept-no-state"]:[],...e.acceptEmails===!0?["--accept-emails"]:[],"--yes","--json"]})}),u({name:"env_destroy",title:"Destroy an environment",description:"Take back from org what env_apply created there from file, the last resource first, into its recycle bin, as sandforge env destroy --yes --json does; what it cannot take back is named, with why. Records changed since the apply are kept unless includeChanged: on a shared sandbox, a colleague\u2019s work. A production org is refused. Needs confirm, the alias of org. It takes back by removal alone: no rewind to a checkpoint.",readOnly:!1,destructive:!0,args:o.strictObject({file:W(),org:p("The org the environment was applied to: its sf CLI alias."),confirm:k("org").optional(),includeChanged:r("Take also the records changed since the apply, and what was created under them since: on a shared sandbox, others' work. Only once the person using you has accepted it.")}),writesTo:e=>e.org,writes:"deletes the records its applies created, into the recycle bin, the last resource first",readFirst:"env_plan of the same file says what the org holds of the environment and what changed since",flags:{"--include-changed":"includeChanged"},named:{"--accept-automation":ae("env_destroy")},run:e=>({script:"sandforge-env",args:["destroy","--file",e.file,"--org",e.org,...e.includeChanged===!0?["--include-changed"]:[],"--yes","--json"]})})],ze=new Map(D.map(e=>[e.definition.name,e]));async function Be(){let{templateDisplayName:e}=await import("./sandforge-seed.mjs"),t=G.map(n=>{let s=n.objects.map(c=>({objectApiName:c.objectApiName,records:c.recordCount}));return{id:n.id,name:e(n),description:e({name:n.description}),objects:s,records:s.reduce((c,m)=>c+m.records,0)}});return{text:t.map(n=>`${n.id} \u2014 ${n.name}: ${n.records} records at most in ${n.objects.length} objects (${n.objects.map(s=>`${s.objectApiName} ${s.records}`).join(", ")})`).join(`
|
|
8
|
+
`),structured:{templates:t}}}function we(e,t){let n={refusal:{code:e,message:t}};return{content:[{type:"text",text:t},{type:"text",text:JSON.stringify(n)}],structuredContent:n,isError:!0}}function He(e){switch(e){case 0:return"done";case 1:return"refused before it wrote, could not start, or did nothing but fail";case 2:return"a request the script could not take, or a question for the person using you: nothing was written";case 3:return"partial: records were left, refused or not checked, each said with why";case 4:return"unstable: someone else wrote to the records meanwhile";default:{let t=X.find(n=>M(n)===e);return t!==void 0?`stopped by ${t} before it was through`:"ended on an error"}}}var ye=new Set([0,3,4]),Je="no terminal to answer",be=(e,t)=>new RegExp(`(?<![\\w-])${t}(?![\\w-])`).test(e);function xe(e,t){let n=t.map(s=>/^[\w.@:+/=,-]+$/.test(s)?s:`'${s.replace(/'/g,"'\\''")}'`);return["npx sandforge",e.replace(/^sandforge-/,""),...n].join(" ")}function Ve(e){let t=e.trim();if(t!=="")try{return JSON.parse(t)}catch{return}}function Ge(e,t,n,s=()=>[]){let c=Ve(n.stdout),m=[`ran: ${xe(t.script,t.args)}`,`exit ${n.code}: ${e.exits?.[n.code]??He(n.code)}`],w=n.stderr.trimEnd();w!==""&&m.push("",w),c===void 0&&n.stdout.trim()!==""&&m.push("",n.stdout.trimEnd());let g=[];n.code===2&&n.stderr.includes(Je)&&g.push("The script asked the question above and had no terminal to answer it on, so it stopped having written nothing. It is a question for the person using you: no parameter of this tool answers it.");let b=`${n.stderr}
|
|
9
|
+
${n.stdout}`;for(let[R,T]of Object.entries(e.flags))be(b,R)&&g.push(`${R}, named above, is this tool's ${T}: true. Give it only once the person using you has accepted what it lets through.`);for(let[R,T]of Object.entries(e.named??{}))be(b,R)&&g.push(`${R}, named above, ${T}`);ye.has(n.code)&&g.push(...s(c)),g.length>0&&m.push("",...g);let $={exitCode:n.code,...c!==void 0?{answer:c}:{}};return{content:[{type:"text",text:m.join(`
|
|
10
|
+
`)},{type:"text",text:JSON.stringify($)}],structuredContent:$,isError:!ye.has(n.code)}}var j=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),C=e=>typeof e=="string"||typeof e=="number"&&Number.isInteger(e);function Ze(e){let t=e.runCommand??Pe,n=e.log??(d=>{process.stderr.write(`${d}
|
|
11
|
+
`)}),s,c=new Map,m=new Set,w=new Set,g=d=>{e.send(JSON.stringify({jsonrpc:"2.0",...d}))},b=(d,a)=>d==="perRequest"?{resultType:"complete",...a,_meta:{[E.serverInfo]:oe}}:a,$=d=>{let a=j(d)?d.protocolVersion:void 0;if(typeof a!="string")return{error:{code:f.invalidParams,message:"initialize names the protocol version it asks for in protocolVersion."}};let i=I.includes(a)?a:I[0];return s=i,n(`sandforge mcp: ${a===i?"agreed on":`asked for ${a}, offered`} ${i}`),{result:{protocolVersion:i,capabilities:{tools:{}},serverInfo:oe,instructions:ne}}},R=async(d,a,i)=>{if(!j(a)||typeof a.name!="string")return{error:{code:f.invalidParams,message:"tools/call names its tool in name."}};let l=ze.get(a.name);if(!l)return{error:{code:f.invalidParams,message:`Unknown tool: ${a.name}`}};if(a.arguments!==void 0&&!j(a.arguments))return{error:{code:f.invalidParams,message:"tools/call takes its arguments as an object."}};let y=l.read(a.arguments??{});if("refusal"in y)return{result:b(i,{...we("ARGUMENTS",`${l.definition.name}: ${y.refusal}. Nothing was run.`)})};let{call:h}=y;if(h.writesTo!==void 0&&h.confirm!==h.writesTo)return{result:b(i,{...we("CONFIRM",Ue(l,h.writesTo,h.confirm))})};if("local"in h.run){let O=await h.run.local();return{result:b(i,{content:[{type:"text",text:O.text},{type:"text",text:JSON.stringify(O.structured)}],structuredContent:O.structured,isError:!1})}}let{script:A,args:v}=h.run,J=new AbortController;c.set(d,J);try{n(`sandforge mcp: ${l.definition.name} runs ${xe(A,v)}`);let O;try{O=await t(A,v,J.signal)}catch(L){O={code:1,stdout:"",stderr:`${V(A)} could not be started: ${L instanceof Error?L.message:String(L)}`}}return m.has(d)?void 0:{result:b(i,{...Ge(l,h.run,O,h.after)})}}finally{c.delete(d),m.delete(d)}},T=async(d,a,i)=>{if(a==="initialize")return $(i);let l=j(i)&&j(i._meta)?i._meta:void 0,y=l?.[E.version],h;if(y!==void 0){if(y!==x)return{error:{code:f.unsupportedVersion,message:"Unsupported protocol version",data:{supported:[x],requested:String(y)}}};if(!j(l?.[E.capabilities]))return{error:{code:f.invalidParams,message:`A request of ${x} names its client's capabilities in _meta["${E.capabilities}"].`}};h="perRequest"}else{if(a==="ping")return{result:{}};if(s!==void 0)h="handshake";else return{error:{code:f.invalidParams,message:`Name the protocol version in _meta["${E.version}"] (${x}), or open with initialize (${I.join(", ")}).`}}}switch(a){case"server/discover":if(h!=="perRequest")break;return{result:b(h,{supportedVersions:[x],capabilities:{tools:{}},instructions:ne,ttlMs:te,cacheScope:"public"})};case"ping":return{result:b(h,{})};case"tools/list":return{result:b(h,{tools:D.map(A=>A.definition),...h==="perRequest"?{ttlMs:te,cacheScope:"public"}:{}})};case"tools/call":return R(d,i,h)}return{error:{code:f.methodNotFound,message:`${a} is not a method of this server: it serves tools/list and tools/call.`}}},Se=(d,a)=>{if(d!=="notifications/cancelled"||!j(a))return;let{requestId:i}=a;if(!C(i))return;let l=c.get(i);l&&(m.add(i),n(`sandforge mcp: request ${String(i)} cancelled: its script is stopped as Ctrl-C stops it`),l.abort())},Te=d=>{let a=d.trim();if(a==="")return;let i;try{i=JSON.parse(a)}catch{g({error:{code:f.parse,message:"Parse error: a line that is not JSON."}});return}if(Array.isArray(i)){g({error:{code:f.invalidRequest,message:"A batch is not a message of this protocol: send one message a line."}});return}if(!j(i)){g({error:{code:f.invalidRequest,message:"A message is a JSON-RPC object."}});return}let{id:l,method:y,params:h}=i;if(y===void 0&&("result"in i||"error"in i))return;if(i.jsonrpc!=="2.0"||typeof y!="string"){g({...C(l)?{id:l}:{},error:{code:f.invalidRequest,message:'A message has jsonrpc "2.0" and a method.'}});return}if(l===void 0){Se(y,h);return}if(!C(l)||c.has(l)){g({error:{code:f.invalidRequest,message:C(l)?`A request with the id ${String(l)} is still under way: give each its own.`:"A request id is a string or a whole number."}});return}let A=T(l,y,h).then(v=>{v!==void 0&&g({id:l,...v})}).catch(v=>{g({id:l,error:{code:f.internal,message:v instanceof Error?v.message:String(v)}})}).finally(()=>{w.delete(A)});w.add(A)},B=async()=>{for(let d of c.values())d.abort();for(;w.size>0;)await Promise.allSettled([...w])},H=Ie({input:e.input,crlfDelay:1/0});return H.on("line",Te),{done:new Promise(d=>{H.once("close",()=>{B().then(d)})}),stop:B}}function Ke(e,t){let n=e.write.bind(e);return e.write=t.write.bind(t),s=>{n(`${s}
|
|
12
|
+
`)}}var Xe=`sandforge mcp \u2014 Seed, Forge's clone of a record, the removal of a run, the emptying of
|
|
13
13
|
objects or of a whole org, Checkpoints and the environments of a sandforge.yaml, as tools for an AI
|
|
14
14
|
agent, over the Model Context Protocol on stdio.
|
|
15
15
|
|
|
@@ -20,10 +20,10 @@ Usage:
|
|
|
20
20
|
stdout; every other line goes to stderr. In Claude Code:
|
|
21
21
|
claude mcp add sandforge -- npx -y sandforge mcp
|
|
22
22
|
|
|
23
|
-
Protocol: MCP ${
|
|
24
|
-
${
|
|
23
|
+
Protocol: MCP ${x}, each request naming it in _meta; and the initialize handshake of
|
|
24
|
+
${I.join(", ")}.
|
|
25
25
|
|
|
26
|
-
Tools: ${
|
|
26
|
+
Tools: ${D.map(e=>e.definition.name).join(", ")}.
|
|
27
27
|
Each one but seed_templates runs the script of this folder that does the same, with --json, in a
|
|
28
28
|
process of its own, and answers with its JSON, its exit code and its lines: every guard of the
|
|
29
29
|
script holds. A tool that writes to an org needs confirm, the alias of that org exactly, or it is
|
|
@@ -35,6 +35,6 @@ Environment:
|
|
|
35
35
|
checkpoints (default: ~/.sandforge), as each script's --help says
|
|
36
36
|
|
|
37
37
|
--help this text
|
|
38
|
-
`;async function
|
|
39
|
-
`),await s.done,c()}/sandforge-mcp\.[cm]?[jt]s$/.test(process.argv[1]??"")&&(
|
|
40
|
-
`),process.exit(1)}));export{f as ERROR,
|
|
38
|
+
`;async function Ye(e=process.argv){let t=e.slice(2);if(t.includes("--help")||t.includes("-h")){process.stdout.write(Xe);return}Z(t,{switches:[],values:[]});let n=Ke(process.stdout,process.stderr),s=Ze({input:process.stdin,send:n});process.stdout.on("error",()=>{s.stop().then(()=>process.exit(0))});let c=Y(m=>{s.stop().then(()=>process.exit(M(m)))});process.stderr.write(`sandforge mcp: ${D.length} tools on stdio, MCP ${x} (and ${I.join(", ")} by initialize)
|
|
39
|
+
`),await s.done,c()}/sandforge-mcp\.[cm]?[jt]s$/.test(process.argv[1]??"")&&(ee(),Ye().catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
40
|
+
`),process.exit(1)}));export{f as ERROR,I as HANDSHAKE_VERSIONS,ne as INSTRUCTIONS,x as PROTOCOL_VERSION,D as TOOLS,Ke as claimStdout,xe as commandText,Ue as confirmRefusal,He as exitWords,Ye as main,Ge as resultOf,Ze as serve,$e as toolRunner};
|
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{
|
|
7
|
+
import{a as j,f as O}from"./chunk-3F6Q5E7I.mjs";import"./chunk-IC2C2GOF.mjs";import"./chunk-VGW4MXXZ.mjs";import"./chunk-2BA2XKAY.mjs";import"./chunk-OAZRPP4I.mjs";import"./chunk-JEERQRLW.mjs";import"./chunk-HOJYWTP7.mjs";import"./chunk-R3X3LV64.mjs";import"./chunk-E5ZB3LU5.mjs";import"./chunk-EFR2Y7E4.mjs";import"./chunk-O2HDYYUV.mjs";import"./chunk-M3ROUWDX.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-ZM6OJGIG.mjs";import"./chunk-MHMH6MTP.mjs";import"./chunk-COFG7Q6R.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-PJ5I73CK.mjs";import"./chunk-BKDV4ENO.mjs";import"./chunk-X5JYBPXP.mjs";import{b as S,c as x}from"./chunk-I7O6C2B5.mjs";import"./chunk-YRQGKDHM.mjs";import"./chunk-MJU2PGZQ.mjs";import"./chunk-66NMFCWX.mjs";import"./chunk-LWW4U276.mjs";import"./chunk-MJVTDA5Q.mjs";import"./chunk-XCA5AONB.mjs";import"./chunk-WR2GIKWE.mjs";import"./chunk-2CNCDM56.mjs";import"./chunk-SIHORWVK.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-B5QQJ4SI.mjs";import"./chunk-NZC67CGR.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-4VS2V6WU.mjs";import"./chunk-KYEDBS54.mjs";import"./chunk-6XYKJSGX.mjs";import"./chunk-K2FBZIXY.mjs";import"./chunk-F43REJDZ.mjs";import"./chunk-JPUR2CFX.mjs";import"./chunk-LPBMBW3O.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-DBFJB2B6.mjs";import"./chunk-IFETCRWE.mjs";import"./chunk-PZPJKATS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-DYFALGRT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-7FFGJWHN.mjs";import"./chunk-G35N4P7D.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-SAR5622P.mjs";import"./chunk-KDGMAGQR.mjs";import"./chunk-MFG4MUIO.mjs";import"./chunk-EQNW3UC2.mjs";import"./chunk-GSKCGQIP.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-TYYOBZMU.mjs";import"./chunk-HS4YRX4J.mjs";import"./chunk-ZUTYVST5.mjs";import"./chunk-CU2INBND.mjs";import"./chunk-YKKRIEH4.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-VYXMVJL5.mjs";import"./chunk-AEKONPF4.mjs";import"./chunk-JWTSEDIQ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-CION3VMZ.mjs";import"./chunk-WIO4XO4F.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-GCOB7K5N.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-L77FJZEP.mjs";import"./chunk-A527W53V.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-GGD7ON3M.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import{a as w,e as b,g as y}from"./chunk-MTMH6H2A.mjs";import"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-NTOVCTRS.mjs";var v=`sandforge monitor \u2014 read an org the way the Monitor page does, without the editor.
|
|
8
8
|
|
|
9
9
|
Usage:
|
|
10
10
|
npx sandforge monitor --org <alias> [options]
|
|
@@ -33,11 +33,11 @@ Nothing is written to the org.
|
|
|
33
33
|
Exit codes: 0 every request was answered (read the answers); 1 it could not
|
|
34
34
|
start, or a request failed, was refused or was not answered in time; 2 a bad
|
|
35
35
|
command line.
|
|
36
|
-
`,$=["refresh","live-operations","storage","deployments","api-usage","error-logs","sessions","apex-insights","sandbox-refresh","alerts"],k={switches:["--json"],values:["--org","--op","--acknowledge","--dismiss","--repeat","--pause","--store","--wait"]};function
|
|
37
|
-
`),process.exit(2)},t=(c,m,p)=>{let l=Number(i(c,m)??m);return(!Number.isInteger(l)||l<p)&&u(`${c} takes a whole number from ${p}.`),l},s=[...new Set(o("--org"))];s.length===0&&u("Missing --org. Run with --help.");let r=o("--op");for(let c of r)c==="open-apex-jobs"
|
|
36
|
+
`,$=["refresh","live-operations","storage","deployments","api-usage","error-logs","sessions","apex-insights","sandbox-refresh","alerts"],k={switches:["--json"],values:["--org","--op","--acknowledge","--dismiss","--repeat","--pause","--store","--wait"]};function R(g){let e=g.slice(2);(e.includes("--help")||e.includes("-h"))&&(process.stdout.write(v),process.exit(0)),w(e,k);let i=(c,m)=>{let p=e.indexOf(c);return p>=0&&p+1<e.length?e[p+1]:m},o=c=>{let m=[];for(let p=0;p<e.length;p++)e[p]===c&&p+1<e.length&&m.push(e[p+1]);return m},u=c=>{process.stderr.write(`${c}
|
|
37
|
+
`),process.exit(2)},t=(c,m,p)=>{let l=Number(i(c,m)??m);return(!Number.isInteger(l)||l<p)&&u(`${c} takes a whole number from ${p}.`),l},s=[...new Set(o("--org"))];s.length===0&&u("Missing --org. Run with --help.");let r=o("--op");for(let c of r){if(c==="open-apex-jobs"){let m=o("--org")[0]??"<alias>";u(`open-apex-jobs opens a browser and reads nothing: it is not run from here. sf org open --target-org ${m} --path ${j} opens the same page.`)}$.includes(c)||u(`Not a Monitor request: "${c}". One of: ${$.join(", ")}.`)}let n=o("--acknowledge"),a=o("--dismiss"),d=r.length>0?[...new Set(r)]:n.length+a.length>0?[]:[...$];return{orgs:s,operations:d,acknowledge:n,dismiss:a,repeat:t("--repeat","1",1),pauseMs:t("--pause","0",0)*1e3,storeDir:i("--store")??S("monitor"),waitMs:t("--wait","300",1)*1e3,json:e.includes("--json")}}function T(g,e){switch(g){case"refresh":return{type:"monitor:refresh",payload:{orgId:e},responseType:"monitor:data"};case"live-operations":return{type:"monitor:live-operations"};case"alerts":return{type:"monitor:alerts",responseType:"monitor:alerts:result"};default:return{type:`monitor:${g}`,payload:{orgId:e}}}}function f(g,e=6){if(g.length===0)return"\u2014";let i=g.slice(0,e).join("; ");return g.length>e?`${i} \u2026 (+${g.length-e})`:i}function C(g,e,i){let o=t=>Array.isArray(e[t])?e[t]:[],u=t=>e.truncated===!0?`; the list stops at ${t}`:"";switch(g){case"refresh":{let t=o("limits"),s=[...t].sort((l,h)=>h.usedPercent-l.usedPercent).slice(0,5),r=o("jobs"),n={};for(let l of r)n[l.status]=(n[l.status]??0)+1;let a=e.orgInfo??void 0,d=e.orgHealthStatus??void 0,c=Array.isArray(e.jobInsights)?e.jobInsights:null,m=e.trends??{},p=a&&a.type!=="Sandbox"?`, created ${String(a.createdDate??"\u2014")}`:"";return[` health score ${String(e.healthScore)}; ${t.length} limit(s), highest: ${f(s.map(l=>`${l.name} ${l.usedPercent}% (${l.max-l.remaining}/${l.max})`),5)}`,` ${r.length} job(s)${e.jobsTruncated===!0?" (the window came back full: older jobs not read)":""}: ${f(Object.entries(n).map(([l,h])=>`${l} ${h}`))}`,` job insights: ${c===null?"none sent":f(c.map(l=>l.title))}`,a?` org: type ${String(a.type)}, edition ${String(a.edition)}, instance ${String(a.instanceName)}, API ${String(a.apiVersion)}, namespace ${String(a.namespacePrefix??"\u2014")}${p}, users ${String(a.userCount)}, custom objects ${String(a.customObjectCount)}, Apex classes ${String(a.apexClassCount)}, active flows ${String(a.flowCount)}`:" org: no org info sent",d?` health check: ${String(d.overall)}; api ${String(d.apiLimitsStatus)}, storage ${String(d.storageStatus)}, failed jobs ${String(d.failedJobs)}${typeof d.failedJobsOutOf=="number"?` of the ${d.failedJobsOutOf} latest`:""}, recent error logs ${String(d.recentErrorLogs)}`:" health check: none sent",` trends: ${f(Object.entries(m).map(([l,h])=>`${l} ${h.direction} (${h.sparklineData.length} pt)`),7)}`]}case"live-operations":return[` ${o("operations").length} operation(s)`];case"storage":{let t=o("objects");return[` ${t.length} of ${String(e.objectCount??t.length)} object(s) holding records listed, total ${String(e.totalRecords)} record(s)`,` ${f(t.map(s=>`${s.objectName} ${s.recordCount}`),10)}`]}case"deployments":{let t=o("deployments");return[` ${t.length} deployment(s)${u(t.length)}`,` ${f(t.map(s=>`${s.status} ${s.startDate} (${s.componentCount})`),5)}`]}case"api-usage":{let t=o("categories");return[` ${t.length} categor(ies)`,` ${f(t.map(s=>`${s.category} ${s.usedPercent}% (${s.used}/${s.max})`),16)}`]}case"error-logs":{let t=o("errors");return[` total ${String(e.totalCount)}; ${t.length} listed${u(t.length)}; by type ${f(o("errorsByType").map(s=>`${s.type} ${s.count}`))}`,t.length>0?` newest ${t[0].timestamp}, oldest ${t[t.length-1].timestamp}`:" \u2014"]}case"sessions":{let t=o("sessions"),s={};for(let r of t)s[r.sessionType]=(s[r.sessionType]??0)+1;return[` ${t.length} session(s), ${String(e.activeUserCount)} active user(s)${u(t.length)}`,` ${f(Object.entries(s).map(([r,n])=>`${r} ${n}`),10)}`]}case"apex-insights":return[` ${o("analyses").length} log(s) analysed${u(o("analyses").length)}; top issues: ${f(o("topIssues").map(t=>t.message))}`];case"sandbox-refresh":return[` supported ${String(e.supported)}; ${o("refreshes").length} refresh(es)${u(o("refreshes").length)}; in progress ${String(e.inProgress)}`];case"alerts":{let t=o("alerts"),s=o("history"),r=t.filter(n=>n.orgId===i);return[` ${t.length} active alert(s), ${r.length} of this org; ${s.length} in history, ${s.filter(n=>n.orgId===i).length} of this org`,...t.map(n=>` ${n.id} ${n.status} ${n.orgId===i?"this org":"another org"}: ${n.message}`)]}}}function A(g,e,i,o=""){let u=`${(i.elapsedMs/1e3).toFixed(1)}s`,t=`${g} ${i.outcome} in ${u}`,s=[i.late?`${t} \u2014 past the page's timeout: the page dropped it`:t],r=i.message?.payload??{};return i.outcome!=="answered"?(i.message&&s.push(` ${String(r.message??JSON.stringify(r))}`),i.outcome==="unanswered"&&s.push(` nothing came back in ${Math.round(i.elapsedMs/1e3)} s: give a longer --wait, or read fewer requests at once with --op`),s):e?[...s,...C(e,r,o)]:[...s,` ${JSON.stringify(r)}`]}async function N(g=process.argv){let e=R(g),i=r=>{process[e.json?"stderr":"stdout"].write(`${r}
|
|
38
38
|
`)},o=x(e.storeDir);if(o!==void 0){process.stderr.write(`${o}
|
|
39
|
-
`),process.exitCode=1;return}let u=
|
|
39
|
+
`),process.exitCode=1;return}let u=O({storeDir:e.storeDir,log:r=>{/^\s*!|\[(ERR|WARN|ALERT)\]/.test(r)&&i(r)},waitMs:e.waitMs}),t=[];for(let r of e.orgs){let n=await u.connect(r);t.push(n),i(`sandforge monitor ${r} (${n.orgType}) store: ${e.storeDir}`)}let s=[];for(let r=1;r<=e.repeat;r++){e.repeat>1&&i(`
|
|
40
40
|
\u2014 pass ${r} of ${e.repeat}`);for(let n of t){t.length>1&&i(`
|
|
41
|
-
[${n.alias}]`);for(let a of e.operations){let d=await u.request(
|
|
42
|
-
`),b(
|
|
43
|
-
`),process.exit(1)}));export{
|
|
41
|
+
[${n.alias}]`);for(let a of e.operations){let d=await u.request(T(a,n.id));s.push({pass:r,org:n.alias,label:`monitor:${a}`,answer:d});for(let c of A(`monitor:${a}`,a,d,n.id))i(c)}}for(let[n,a]of[["acknowledge",e.acknowledge],["dismiss",e.dismiss]])for(let d of a){let c=`monitor:alert:${n}`,m=await u.request({type:c,payload:{alertId:d}});s.push({pass:r,org:"",label:c,answer:m});for(let p of A(`${c} ${d}`,void 0,m))i(p)}r<e.repeat&&e.pauseMs>0&&await new Promise(n=>setTimeout(n,e.pauseMs))}e.json&&process.stdout.write(`${JSON.stringify({tool:"sandforge-monitor",results:s,posted:u.posted},null,2)}
|
|
42
|
+
`),b(I(s.map(({answer:r})=>r)))}function I(g){return g.some(e=>e.outcome!=="answered")?1:0}process.argv[1]?.includes("sandforge-monitor")&&(y(),N().then(()=>process.exit(process.exitCode??0)).catch(g=>{process.stderr.write(`${g instanceof Error?g.message:String(g)}
|
|
43
|
+
`),process.exit(1)}));export{A as describeAnswer,N as main,I as monitorExitCode,T as pageRequest,R as parseArgs};
|
package/lib/sandforge-seed.mjs
CHANGED
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{A,B,C,D,E,F,G,H,I,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
7
|
+
import{A,B,C,D,E,F,G,H,I,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-N652NMZ4.mjs";import"./chunk-SOGQW4IG.mjs";import"./chunk-W622GUAW.mjs";import"./chunk-WA7EYLAQ.mjs";import"./chunk-LKQ5RKIV.mjs";import"./chunk-XAMBCQPU.mjs";import"./chunk-IG2MTQRP.mjs";import"./chunk-WR4Q363I.mjs";import"./chunk-CHYDMRSV.mjs";import"./chunk-F6GUDTOB.mjs";import"./chunk-BXU6WFMH.mjs";import"./chunk-2GTBABKU.mjs";import"./chunk-P33PSCXK.mjs";import"./chunk-UCD54V2M.mjs";import"./chunk-BV6VTP3J.mjs";import"./chunk-OLSGVAIL.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-ELFXJHU7.mjs";import"./chunk-W7U5E5ZL.mjs";import"./chunk-EFR2Y7E4.mjs";import"./chunk-O2HDYYUV.mjs";import"./chunk-M3ROUWDX.mjs";import"./chunk-FQGHL7GR.mjs";import"./chunk-ZM6OJGIG.mjs";import"./chunk-MHMH6MTP.mjs";import"./chunk-COFG7Q6R.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-PJ5I73CK.mjs";import"./chunk-BKDV4ENO.mjs";import"./chunk-X5JYBPXP.mjs";import"./chunk-5P4PHJRL.mjs";import"./chunk-VS7ZXUII.mjs";import"./chunk-SOU4FRYN.mjs";import"./chunk-E5AHXLS6.mjs";import"./chunk-OO6CLPEH.mjs";import"./chunk-YS4G22C2.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-AV5SWEHP.mjs";import"./chunk-I7O6C2B5.mjs";import"./chunk-2CNCDM56.mjs";import"./chunk-SIHORWVK.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-4VS2V6WU.mjs";import"./chunk-KYEDBS54.mjs";import"./chunk-6XYKJSGX.mjs";import"./chunk-K2FBZIXY.mjs";import"./chunk-F43REJDZ.mjs";import"./chunk-JPUR2CFX.mjs";import"./chunk-LPBMBW3O.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-DBFJB2B6.mjs";import"./chunk-IFETCRWE.mjs";import"./chunk-PZPJKATS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-DYFALGRT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-7FFGJWHN.mjs";import"./chunk-G35N4P7D.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-SAR5622P.mjs";import"./chunk-KDGMAGQR.mjs";import"./chunk-MFG4MUIO.mjs";import"./chunk-EQNW3UC2.mjs";import"./chunk-GSKCGQIP.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-TYYOBZMU.mjs";import"./chunk-HS4YRX4J.mjs";import"./chunk-ZUTYVST5.mjs";import"./chunk-CU2INBND.mjs";import"./chunk-YKKRIEH4.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-VYXMVJL5.mjs";import"./chunk-AEKONPF4.mjs";import"./chunk-JWTSEDIQ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-CION3VMZ.mjs";import"./chunk-WIO4XO4F.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-GCOB7K5N.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-L77FJZEP.mjs";import"./chunk-A527W53V.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-GGD7ON3M.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-MTMH6H2A.mjs";import"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ENV_RUN_ID_RE,G as PREVIEW_UNREAD,l as accountKindOfRecordTypes,v as apiRequestsJson,p as describeDistribution,u as dryRunGatesJson,x as fitJson,c as fitOfArgs,y as main,d as parseArgs,C as parseRemoveArgs,m as personAccountLine,k as personRecordTypeNames,i as prebuiltTemplate,D as readRunSummary,f as readTemplateFile,o as recordTypeChoiceLine,n as recordTypeRule,A as refusalLines,H as removalPreviewJson,I as removalPreviewLines,F as removeMain,j as rulesFromDescribe,g as runIdRefusal,E as runOfSummary,z as scenarioKeptLines,t as seedAutomationCheck,w as seedFitLines,B as seedInterruptedLine,q as seedOrchestrator,r as seedWritePathOf,b as seededRandom,s as storageLine,e as templateDisplayName,h as templateRecordTypesRefusal};
|
package/lib/sandforge-sync.mjs
CHANGED
|
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
7
|
+
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-OLSGVAIL.mjs";import"./chunk-INIQ23K6.mjs";import"./chunk-ELFXJHU7.mjs";import"./chunk-W7U5E5ZL.mjs";import"./chunk-ZM6OJGIG.mjs";import"./chunk-MHMH6MTP.mjs";import"./chunk-COFG7Q6R.mjs";import"./chunk-GMY5427L.mjs";import"./chunk-PJ5I73CK.mjs";import"./chunk-BKDV4ENO.mjs";import"./chunk-X5JYBPXP.mjs";import"./chunk-5P4PHJRL.mjs";import"./chunk-VS7ZXUII.mjs";import"./chunk-SOU4FRYN.mjs";import"./chunk-E5AHXLS6.mjs";import"./chunk-OO6CLPEH.mjs";import"./chunk-YS4G22C2.mjs";import"./chunk-QROPNEGY.mjs";import"./chunk-BZ24IAP5.mjs";import"./chunk-SCKUIE3R.mjs";import"./chunk-AV5SWEHP.mjs";import"./chunk-I7O6C2B5.mjs";import"./chunk-2CNCDM56.mjs";import"./chunk-SIHORWVK.mjs";import"./chunk-CE6ZDGBB.mjs";import"./chunk-BOGNK4LV.mjs";import"./chunk-4VS2V6WU.mjs";import"./chunk-KYEDBS54.mjs";import"./chunk-6XYKJSGX.mjs";import"./chunk-K2FBZIXY.mjs";import"./chunk-F43REJDZ.mjs";import"./chunk-JPUR2CFX.mjs";import"./chunk-LPBMBW3O.mjs";import"./chunk-T63U4OZJ.mjs";import"./chunk-DBFJB2B6.mjs";import"./chunk-IFETCRWE.mjs";import"./chunk-PZPJKATS.mjs";import"./chunk-QSRAEUGZ.mjs";import"./chunk-DYFALGRT.mjs";import"./chunk-M6P5ZZLE.mjs";import"./chunk-7FFGJWHN.mjs";import"./chunk-G35N4P7D.mjs";import"./chunk-YYZL7UGV.mjs";import"./chunk-SAR5622P.mjs";import"./chunk-KDGMAGQR.mjs";import"./chunk-MFG4MUIO.mjs";import"./chunk-EQNW3UC2.mjs";import"./chunk-GSKCGQIP.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-TYYOBZMU.mjs";import"./chunk-HS4YRX4J.mjs";import"./chunk-ZUTYVST5.mjs";import"./chunk-CU2INBND.mjs";import"./chunk-YKKRIEH4.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-VYXMVJL5.mjs";import"./chunk-AEKONPF4.mjs";import"./chunk-JWTSEDIQ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-CION3VMZ.mjs";import"./chunk-WIO4XO4F.mjs";import"./chunk-EADHKH3A.mjs";import"./chunk-GCOB7K5N.mjs";import"./chunk-INIT2UKJ.mjs";import"./chunk-SU65Z2BA.mjs";import"./chunk-HF6LAK3G.mjs";import"./chunk-L77FJZEP.mjs";import"./chunk-A527W53V.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-GGD7ON3M.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-MTMH6H2A.mjs";import"./chunk-TTFDUKUS.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-MS4FJDFD.mjs";import"./chunk-NTOVCTRS.mjs";var export_jsforce=a.default;export{D as LINE_RUN,r as alreadyLinkedWords,C as bothRecorders,c as buildConfig,h as buildQueryFn,g as cliAllowsDeletes,k as cliCountFn,f as cliFileDeps,l as cliPersonAccountsFn,m as cliSourceIdsFn,N as configurationToldLines,x as contactPointLines,A as deltaLine,w as encryptedLeftOutLine,n as inTheCommandsWords,P as jobLines,export_jsforce as jsforce,E as main,B as memoryCreations,u as objectCountsLine,y as objectCurrencyLines,t as objectErrorLines,z as objectPriceLines,v as objectWrittenLines,b as parseArgs,F as parseRemoveArgs,i as readCutLines,G as readRunSummary,d as readSavedConfig,q as recordTypeGivenOfObjectsLines,J as removalRefusal,K as removalSummaryLines,H as removalsPathOf,Q as removeMain,L as restoredLines,O as runFileOf,I as runOfSummary,e as savedConfigStore,s as simulationLines,j as statusWithReadCuts,o as syncApiRequestsJson,M as undeletedLines,p as writeCheckLines};
|
package/lib/sandforge.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
|
|
|
4
4
|
const require = __sandforgeRequire(import.meta.url);
|
|
5
5
|
const __filename = __sandforgePath(import.meta.url);
|
|
6
6
|
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import"./chunk-NTOVCTRS.mjs";import{readFileSync as
|
|
7
|
+
import{a as s}from"./chunk-SCKUIE3R.mjs";import"./chunk-NTOVCTRS.mjs";import{readFileSync as d}from"node:fs";import{extname as c,join as i}from"node:path";import{pathToFileURL as p}from"node:url";var r={autopilot:"run an Autopilot copy between two orgs",backup:"take and restore DataOps snapshots",checkpoint:"take a checkpoint of an org's data, and rewind the org to it",cleanup:"Bulk delete records you created on a sandbox in a time window",clone:"clone a record, or whole tables, from one org to a sandbox, or remove a run",compare:"compare two orgs the way the Compare page does",dataops:"mask an org's records, and put them back",empty:"empty objects of a sandbox, or the whole of it",env:"apply a sandforge.yaml to an org, and take it back",frozen:"build and replay a Frozen Dataset",mcp:"the MCP server: these scripts as tools for an AI agent, on stdio",monitor:"read an org the way the Monitor page does",seed:"fill an org from a seed template",sync:"run a Sync between two orgs"},a=o=>Object.prototype.hasOwnProperty.call(r,o);function m(o){let[e,...n]=o;if(e===void 0)return{kind:"refused",reason:"Name the command to run."};if(e==="--help"||e==="-h"||e==="help")return{kind:"help"};if(e==="--version"||e==="-v")return{kind:"version"};if(a(e))return{kind:"run",tool:e,args:n};let t=e.replace(/^sandforge-/,"");return t!==e&&a(t)?{kind:"refused",reason:`"${e}" is named ${t} here: ${s(t)} \u2026.`}:{kind:"refused",reason:e.startsWith("-")?`"${e}" is not a flag sandforge reads: name a command first.`:`"${e}" is not a command of sandforge.`}}function l(){let o=Math.max(...Object.keys(r).map(n=>n.length));return`sandforge \u2014 SandForge's command lines, without the editor: Seed, Forge's clone, Sync,
|
|
8
8
|
Checkpoints, DataOps, Frozen Dataset, the emptying of a sandbox, sandforge.yaml environments, and
|
|
9
9
|
the MCP server.
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ to it. In Claude Code:
|
|
|
22
22
|
|
|
23
23
|
--version the version of SandForge these scripts belong to
|
|
24
24
|
--help this text
|
|
25
|
-
`}function
|
|
25
|
+
`}function f(o,e=__dirname,n=__filename){return i(e,`sandforge-${o}${c(n)}`)}function g(o=__dirname){let e=JSON.parse(d(i(o,"..","package.json"),"utf8"));return typeof e.version=="string"?e.version:"0.0.0"}var h=o=>import(p(o).href);async function u(o=process.argv,e=h){let n=m(o.slice(2));switch(n.kind){case"help":process.stdout.write(l());return;case"version":process.stdout.write(`${g()}
|
|
26
26
|
`);return;case"refused":process.stderr.write(`${n.reason} Nothing was run. The commands: ${Object.keys(r).join(", ")}. Run with --help.
|
|
27
|
-
`),process.exitCode=2;return;case"run":{let t=
|
|
28
|
-
`),process.exit(1)});export{r as TOOLS,
|
|
27
|
+
`),process.exitCode=2;return;case"run":{let t=f(n.tool);process.argv=[o[0]??process.execPath,t,...n.args],await e(t);return}}}/(?:^|[\\/])sandforge\.[cm]?[jt]s$/.test(process.argv[1]??"")&&u().catch(o=>{process.stderr.write(`${o instanceof Error?o.message:String(o)}
|
|
28
|
+
`),process.exit(1)});export{r as TOOLS,m as dispatchOf,l as helpText,u as main,f as toolFile,g as versionOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sandforge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.80.0",
|
|
4
4
|
"description": "SandForge's command lines, without the editor: seed, clone and sync Salesforce orgs, checkpoints and rewinds, masking, Frozen Datasets, sandforge.yaml environments, and an MCP server for AI agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salesforce",
|
package/lib/chunk-2S5OMIIA.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire as __sandforgeRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __sandforgePath } from 'node:url';
|
|
3
|
-
import { dirname as __sandforgeDirname } from 'node:path';
|
|
4
|
-
const require = __sandforgeRequire(import.meta.url);
|
|
5
|
-
const __filename = __sandforgePath(import.meta.url);
|
|
6
|
-
const __dirname = __sandforgeDirname(__filename);
|
|
7
|
-
import{A as y,B as z,C as A,D as B,E as C,F as D,G as E,H as F,I as G,J as H,K as I,L as J,M as K,c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i,l as j,m as k,n as l,o as m,p as n,q as o,r as p,s as q,t as r,u as s,v as t,w as u,x as v,y as w,z as x}from"./chunk-NEVXIGR6.mjs";import"./chunk-TYYOBZMU.mjs";import"./chunk-TUACWKIH.mjs";import"./chunk-SIOZXPFG.mjs";import"./chunk-UNDIBZWG.mjs";import"./chunk-B45CNPUX.mjs";import"./chunk-7EANH5PY.mjs";import"./chunk-NTOVCTRS.mjs";export{a as CHECKPOINT_DIR_MODE,b as CHECKPOINT_FILE_MODE,p as CHECKPOINT_FILE_PATH,C as CheckpointStoreError,c as DEFAULT_KEEP_DAYS,d as EXPIRY_WARNING_DAYS,G as OrgCheckpointStore,f as PREVIEW_KEEP_MS,e as RECYCLE_BIN_DAYS,J as acquireOrgLock,m as binFileOf,A as binReachSince,E as compressedFieldPrints,h as defaultCheckpointLocksDir,g as defaultCheckpointStoreRoot,x as expiresAtFor,z as expiresSoon,s as exportedFileIn,r as exportedFilesOf,n as filesDocumentsFileOf,o as filesLinksFileOf,j as indexFileOf,y as isExpired,q as isExportedPath,H as latestRewindOf,v as makePrivateDir,w as newFolderId,l as notInBinFileOf,F as openCheckpointStore,I as orgLockFileOf,K as orgLockHolder,i as organizationKey,t as previewDirOf,D as readFieldPrints,k as recreatedFileOf,u as rewindDirOf,B as scratchOrgExpired};
|