Use this skill when you need to create, debug, or test artifact preview providers for
agentic-preview.
- Run and verify the local preview CLI.
- Register custom command providers.
- Validate provider request/response payloads.
- Troubleshoot preview start/stop flows.
<repo-root>\\agentic-preview
- Node.js 18+.
- Project dependencies installed (
npm installin your<repo-root>).
node src/index.js providers list --json
Confirms built-in providers are present.node src/index.js preview <path> --json
Verifies baseline preview flow and returnspreviewId.node src/index.js list --json
Confirms active session appears.node src/index.js stop <previewId> --json
Confirms managed session stops cleanly.
node src/index.js providers add-command \
--id my-provider \
--name "My Provider" \
--command "node ./my-provider.js" \
--artifact-types "static_site,dynamic_site" \
--required-credentials "MY_PROVIDER_TOKEN" \
--managed \
--supports-stop \
--stop-command "node ./my-provider.js"Key expectations:
--commandexecutes on everypreviewrequest.--required-credentialscomma-separated credential keys; values are requested duringproviders enable.- Payload is sent as JSON on stdin.
- Script must emit a JSON object on stdout.
--stop-commandreceives stop payload whenagentic-preview stop <previewId>is called.
- Source:
samples/command-provider/provider.js - Register:
node src/index.js providers add-command \
--id sample-command-provider \
--name "Sample Command Provider" \
--command "node <repo-root>\\samples\\command-provider\\provider.js" \
--artifact-types "static_site,dynamic_site,image,video,file,url" \
--managed \
--supports-stop \
--stop-command "node <repo-root>\\samples\\command-provider\\provider.js"- Use it:
node src/index.js preview . --json- Remove provider later:
node src/index.js providers remove sample-command-provideraction: "start"previewIdproviderIdartifact(id, kind, type, path, entrypoint, sourceType, title)options(CLI reserved options block)
url(string, required)kind(usuallyurl)openIn(browsertypically)
Optional:
labelmessagemetadata
Payload when stopping:
action: "stop"previewIdproviderIdartifact
Return is not strictly parsed beyond successful process exit for stop flows.
Command returned no JSON output: stdout was not JSON.No provider supports artifact type: provider list doesn't support that artifact type.Provider ... is disabled or unavailable: provider not enabled in CLI config.
Create my-provider.js:
const fs = require('fs');
const payload = JSON.parse(fs.readFileSync(0, 'utf8') || '{}');
if (payload.action === 'stop') {
console.log(JSON.stringify({ ok: true, message: 'stopped' }));
process.exit(0);
}
console.log(JSON.stringify({
kind: 'url',
openIn: 'browser',
url: `file://${payload.artifact.path}`,
label: 'My Provider',
message: 'started',
}));- Re-run
node src/index.js preview <path> --json. - Confirm URL returned.
- Stop if managed:
node src/index.js stop <previewId> --json.