Generate the integration kit
syncanix generate writes a syncanix/ directory into your project — the widget installer, your types, the registration files and the CSP requirement — and never edits a file you wrote.
syncanix generate writes everything Syncanix needs as code in one directory of your project. It creates new files and only new files: nothing it does can change something you wrote, so there is no diff of yours to review and nothing to undo.
npx syncanix generate --key pk_live_…What you get
One directory, one file per concern, all of it readable code you own:
syncanix/
index.ts the one file you import — installs the widget, applies everything below
widget.ts installs the widget from code (idempotent, with a teardown)
types.d.ts types for window.syncanix, so your editor knows the API
actions.ts functions the agent may run on the page
components.ts UI the agent may render in the chat
data-sources.ts live data the agent may read
page-actions.ts the routes and controls from your last scan
csp.ts the CSP sources the widget needs, as a value to spread
identity.ts your token provider (written only with --idp)The barrel is the point: it installs the command queue, then the widget, then applies every registration in the directory, in the order that makes them work. So your app imports one path and nothing else.
import './syncanix';These files are yours to edit
The generator records a hash of what it wrote. Re-running updates the files you have not touched and leaves the ones you have, reporting them rather than overwriting them — so adding your own actions to actions.ts does not put you on the wrong side of the next upgrade.
Telling Syncanix who the visitor is
Name your identity provider and the generator writes identity.ts for it. It takes your token getter as an argument rather than reaching for a global, because your auth client is something only your own code can reach — so the barrel deliberately does not call it, and you wire it from wherever that client lives.
npx syncanix generate --key pk_live_… --idp auth0import { connectSyncanixIdentity } from './syncanix/identity';
connectSyncanixIdentity(() => auth0.getAccessTokenSilently());The routes and controls come from your scan
page-actions.ts tells the agent which pages it can reach and which controls it may operate. Run a scan first and the generator fills it in for you; without one it writes a commented example for you to fill in by hand.
npx syncanix init
npx syncanix generateOr have the CLI do it for you
There are two ways to install the widget, and which one you want is a fact about your repository rather than a recommendation we can make for you.
- syncanix integrate
- Finds your framework and makes the edits: the embed into your HTML, your Content-Security-Policy, variables into .env. You approve each file from its diff, every overwrite is backed up, the whole set applies or none of it does, and --uninstall puts it back.
- syncanix generate
- Writes the kit and nothing else. Reach for this when a tool editing your repository is not something you want to sign off on.
- syncanix integrate --kit
- Both: the detection, the approval, the CSP and .env edits and the uninstall — but the code lands in the kit, and your HTML is left alone because the kit installs the widget from code. You add the one import.
npx syncanix integrate --kit