The Local-First Salesforce Analysis Pipeline

SF Analyzer combines deterministic metadata extraction with selective AI documentation.

Workflow

Step-by-step pipeline.

01

Secure Org Connection

Connect your Salesforce environment using standard web-based OAuth. SF Analyzer invokes the official Salesforce CLI (`sf org login web`) in the background.

  • Access tokens remain in the Salesforce CLI secure keychain.
  • The portal never receives or proxies Salesforce credentials.
Shell Command (Spawned)$ sf org login web --instance-url https://test.salesforce.com --alias target-org
✔ Authorization succeeded. Saved credentials in local sf keychain.
02

Registry-Safe Metadata Retrieve

Select custom metadata types (Apex Classes, Fields, Flows, Custom Objects, LWC). We inspect the local Salesforce metadata registry to automatically filter out unsupported components, avoiding API retrieval crashes.

  • Powered by the Node library `@salesforce/source-deploy-retrieve`.
  • Automatically handles retrieval dependencies and skips invalid API types.
Node Registry Preflight Checkconst registry = new RegistryAccess();
try {
  registry.getTypeByName("ActivationPlatformActvAttr"); Missing definition
} catch {
  skipUnsupportedType("ActivationPlatformActvAttr");
}
03

Lossless Snapshot Assembly

We merge raw metadata source code with runtime information (active licenses, system limits, object field descriptions, and record counts). This creates a single canonical file: `snapshot.json`.

  • A single JSON represents the entire state of your custom development.
  • No data is sent cloud-side; the snapshot is saved in the local workspace.
snapshot.json (Simplified Schema){
  "metadata": { "ApexClass": ["AccountService"], "Flow": ["OrderProcess"] },
  "runtime": { "limits": { "SingleEmail": 5000 }, "licenses": [...] },
  "objects": { "Account": { "fields": [...], "recordCount": 24082 } }
}
04

Local Git Store Versioning

Every analysis run is versioned inside a local Git repository in the app’s workspace directory. Using `isomorphic-git`, we commit the snapshot and assign a unique tag for history tracking.

  • Enables absolute delta analysis: immediately inspect what changed between two runs.
  • No external git server or GitHub token is required.
Local Git Diff Output+ feat(class): AccountService.cls (added)
~ refactor(flow): OrderProcess.flow (modified)
- chore(class): OldRepository.cls (deleted)
Tag: analysis-2026-07-01_10-25
05

BYO-Key AI Wiki Generation

The desktop app calls your configured AI provider directly (OpenAI, Anthropic, Google) using the model key stored in your OS keychain. We document custom classes, triggers, and fields, storing the output in Markdown pages.

  • Content-hash tracking: we only re-document files that have changed since the last run.
  • Saves money and token costs, documenting incrementally.
Incremental Documenter LogAccountService.cls hash: a8e9f2 (modified) -> running AI documentor...
AccountTrigger.cls hash: 5c3b12 (unchanged) -> skipped (cache hit)
✔ Wrote wiki/AccountService.md with new updates.
06

Guided TDD & Impact Harness

The AI document agent runs locally in the background, utilizing read-only tools to crawl the workspace. It guides developers through drafting technical design documents (TDD) or impact assessments based on real metadata.

  • Guarded SOQL Tool: executing only SELECT queries, protected against database writes.
  • Coverage guard prevents AI agents from generating documents without analyzing files.
Agent Harness VerificationRunning document agent: "Draft TDD for Billing address synchronization"
Checking coverage guard: verified 4 related classes analyzed.
✔ Document exported to billing-sync-tdd.md.