Open
Conversation
Register the SDK safety middleware on the global middleware registry from the
extension so destructive HTTP calls honor SFCC_SAFETY_LEVEL, SFCC_SAFETY_CONFIRM,
SFCC_SAFETY_CONFIG, and per-instance `safety` blocks in dw.json. Rebuild the
guard on config reset so instance switches re-apply the policy.
Add registerSafeCommand() that evaluates every VS Code command against the guard
(command rules like { "command": "b2c-dx.sandbox.delete", "action": "block" }),
mirroring BaseCommand's per-command evaluation. Replace vscode.commands.registerCommand
across all feature areas. Sandbox destructive ops additionally run through
runWithSafety() for an idiomatic VS Code modal when the policy requires confirm.
ContentConfigProvider was clearing only the library cache on config reset, so browsed libraries from the previous instance persisted in the tree. Also reset the browsed libraries list so getRootChildren() re-seeds from the new instance's contentLibrary on the next refresh.
Add assetQuery to NormalizedConfig and DwJsonConfig so it can be set per-instance in dw.json, project-wide in package.json under "b2c", or via SFCC_ASSET_QUERY. Wire it through the dw.json↔normalized mapping, merge, env source array parsing, and PackageJsonSource allow-list. The VS Code Content Libraries tree and export commands now pass the resolved value to fetchContentLibrary/exportContent; b2c content export falls back to the config value when --asset-query isn't provided (default remains ["image.path"]).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SFCC_SAFETY_LEVEL,SFCC_SAFETY_CONFIRM,SFCC_SAFETY_CONFIG, and per-instancesafetyblocks indw.json. AddregisterSafeCommand()which evaluates every VS Code command against the guard (command rules like{ "command": "b2c-dx.sandbox.delete", "action": "block" }), mirroringBaseCommand.evaluateCommandSafety(). Sandbox destructive ops additionally flow throughrunWithSafety()for a native VS Code confirm modal.ContentConfigProvidernow also clears browsed libraries (not just the cache) ononDidReset, so the tree re-seeds from the new instance'scontentLibrary.assetQueryas a first-class config field. Settable indw.json,package.jsonb2cblock, orSFCC_ASSET_QUERY. VS Code tree +b2c content exportboth honor it;--asset-queryflag still wins when provided.Notes
sandbox:deletevs VS Codeb2c-dx.sandbox.delete) — rules are not portable verbatim between them. Worth calling out in the Safety docs as a follow-up.setup inspectdoesn't render thesafetysection (pre-existing display gap noticed during this work). Not fixed here; small follow-up.Test plan
SFCC_SAFETY_LEVEL=NO_DELETEin the host shell; right-click → Delete a sandbox → confirm it blocks with an error toast."safety": { "level": "NONE", "rules": [{ "command": "b2c-dx.sandbox.extendExpiration", "action": "confirm" }] }to adw.jsonconfig → Extend Expiration shows a native modal before prompting for TTL.contentLibraryvalues; Content Libraries tree reloads with the new library and drops the old one.b2c content export PAGE_ID -l LIB_IDusesassetQueryfromdw.jsonwhen--asset-queryis not passed;--asset-querystill overrides.pnpm --filter @salesforce/b2c-tooling-sdk run test:agentandpnpm --filter @salesforce/b2c-cli run test:agentboth green.