Skip to content
Sarj Workspace Sync

Plan / apply

A Terraform-style workflow through the TypeScript API.

Plan

~ slack.profile["UADA"]
~ title: "Engineer" -> "Staff Engineer"
Plan: 1 field(s) to update.
Current
{
"linkedin": "",
"manages": "",
"reportsTo": "",
"team": "Engineering",
"title": "Engineer"
}
Desired
{
"linkedin": "",
"manages": "",
"reportsTo": "",
"team": "Engineering",
"title": "Staff Engineer"
}

This synthetic preview runs the real profile planner at build time.

Apply

import { SlackProfileSync } from "@sarj-ai/workspace-sync";
import type {
OrgSyncRunReport,
OrgSyncServiceOptions,
} from "@sarj-ai/workspace-sync/org-sync/service";
export async function syncProfiles(
options: OrgSyncServiceOptions,
approve: (plan: OrgSyncRunReport) => Promise<boolean>,
): Promise<OrgSyncRunReport> {
const sync = new SlackProfileSync(options);
const plan = await sync.plan();
if (await approve(plan)) return sync.apply(plan);
return plan;
}

SlackProfileSync is exported by the package. Supply your Google and Slack clients, preview the plan, and approve it in your application. apply(plan) carries the approval hash and rechecks current data for you.

One apply updates at most one profile. It needs no SQL database. Scheduled hosts can pass an identityBudget option to share a one-person limit across retries and other provider operations.

Terraform?

Keep the TypeScript core. A thin Terraform adapter could expose these workflows later, but replacing the core would duplicate provider integrations and host approval guards.

A provider action is a closer fit for invoking reconciliation than a resource that owns every employee account. Actions support side effects without changing Terraform resource state. Keep approval and write guards in the core, and secrets outside saved plans and state.