Module map

A conservative map of the current apps/desktop/ and packages/core/ split. It only lists modules that exist on main.

apps/desktop/electron/ -- Main process + preload

FileRole
main.tsBrowserWindow construction, app lifecycle, IPC + protocol registration.
preload.tscontextBridge.exposeInMainWorld('cfs', { … }). Single contract source for the renderer-side window.cfs.* shape. Flavor-specific: the macOS author preload omits health, deploy, deployRecovery, revert, auditResults, and system.
ipc-handlers.tsRegisters every cfs:* IPC channel. Each channel is a thin wrapper around a packages/core/handlers/ export.
ipc-validators.tsTyped payload validators per channel (CF-SEC-002). Rejects malformed payloads at the IPC boundary, before they reach handlers.
navigation-guard.tsBlocks will-navigate outside the bundled UI + file:// navigation (CF-SEC-001).
protocol-handler.tscfs-blob:// custom protocol for streaming in-process artifacts (PDFs, exports) to the renderer without writing to disk first.
log.tsTyped main-process logger (v0.2.1). scoped(name), setLogger(), resetLogger(), redact(). Wraps electron-log; falls back to console in vitest.
elevate.tsProcess elevation. UAC on Windows, pkexec on Linux. Uses scoped('elevate') for all logging.
platform-detection.tsRDP / Wayland / X11 / WSL detection helpers used by elevate + main window creation.

apps/desktop/src/lib/ -- Renderer infrastructure

FileRole
cfs.tsRenderer-side typed proxy for window.cfs, plus safeCfs() / hasCfsNamespace() capability checks.
platform.tsRenderer platform/theme hooks through the preload bridge.
use-navigation-guard.tsUnsaved-changes navigation guard for the HashRouter app.
electron-restore-client.tsRenderer client for interrupted deploy recovery UI.
monaco-setup.tsMonaco setup shared by editor surfaces.

apps/desktop/src/pages/ -- pages

The five Phase A-E lighthouse pages are directory-based:

<Page>/
├─ index.tsx
├─ state/             # hooks + tests
├─ components/        # optional memoized sub-components
└─ helpers.tsx        # optional pure render helpers
Page directoryState/hooksComponents
ManifestEditor/useManifestEditorState, useDeployFlow (+ tests)AddSettingsPane, ComplianceTable, DeployResultPanel, ManifestContent, ManifestDetailFooter, ManifestHeader, VisualManifestViewer
Manifests/useManifestList, useFlashMessage, useBulkSelection (+ tests)none extracted yet
ManifestNew/useNewManifestForm (+ tests)none extracted yet
Library/useLibraryFilters (+ tests)none extracted yet
Diff/useDiffMatrix (+ tests)CisDiffTab; other panels remain in index.tsx

Other current page files are still flat files: Home.tsx (Dashboard), Compliance.tsx (Export Readiness), CisCatalog.tsx (Benchmark Mapping), Settings.tsx, ManifestAuditPack.tsx, ManifestCompliance.tsx, ManifestHistory.tsx, ManifestRationale.tsx, and NotFound.tsx.

Routes are wired in apps/desktop/src/App.tsx; sidebar labels are wired in apps/desktop/src/components/Sidebar.tsx.

apps/desktop/src/components/ -- Shared sub-components

FileRole
manifest-editor.tsxMonaco-based YAML/JSON editor + inline validator. Validates against data/osc-manifest-schema.json (Monaco JSON mode) AND a custom inline validator that's tighter (e.g. enforces keyPath + valueName + valueType for Registry resources).
diff-viewer.tsxPairwise diff component used by the Diff page.
ai-analysis-panel.tsxAI changelog generation panel (Diff page).
conflict-detector.tsxlocal conflict detection across selected manifests.
HealthIndicator.tsxFooter pill: 🟢/🟠/🔴/⚪ states. Clickable amber opens CliRequiredModal.
WelcomeDialog.tsxFirst-run two-card welcome. Persists dismissal via localStorage['cfs.welcome.dismissedAt'].
CliRequiredModal.tsxShared install dialog opened by Manifests / ManifestEditor / Layout / WelcomeDialog when oscfg is missing.
Layout.tsxTop-level layout: sidebar, header, footer, route outlet. Wires HealthIndicator.onInstallClick → CliRequiredModal.
ExternalLink.tsxAnchor wrapper that routes through cfs.shell.openExternal() so external URLs open in the user's default browser.
AuditProgressCounter.tsxStable-width progress counter for audit operations. Uses monospace digit rendering to prevent layout shift as numbers increment.

pages/ManifestEditor/components/VisualManifestViewer.tsx is shared by ManifestEditor and ManifestNew. Its pure projection/mutation layer lives in pages/ManifestEditor/visual-viewer.ts. | Breadcrumb.tsx | Breadcrumb navigation component. Renders the current page path as clickable segments for quick navigation between parent views. |

packages/core/src/handlers/ -- Pure handler functions

Single source of truth for business logic. Each handler is a pure function called from apps/desktop/electron/ipc-handlers.ts and directly tested by vitest.

FileRole
index.tsRe-exports.
manifests.tsList / register / delete manifests. Platform-agnostic register (schema-only); deploy is the platform gate.
deploy.tsrunDeploy (audit + enforce modes). Preflight checks resolveOscfgBinary(); throws cliRequiredError() if missing.
revert.tsrevertManifest: restore pre-deploy snapshot or delete the namespace when no usable snapshot exists. It revalidates snapshot YAML before apply and translates CLI-missing apply/delete failures to CLI_REQUIRED.
health.tsgetHealthStatus + recheckHealth (cache-busting reprobe).
import.tsFile → manifest converter. CSV/TSV/XLSX and JSON security-definition imports both emit Registry resources with all schema-required props (keyPath + valueName + valueType) via inferRegistryValueType(). Imports capped at MAX_IMPORT_BYTES = 10 MB.
export.tsManifest → YAML/JSON round-trip.
library.tsCatalog of bundled baselines.
history.tsSnapshot store wrappers.
audit-pack.tsPDF + markdown audit-pack builder. Uses escapeMarkdown() for any user-supplied or generated text (CF-SEC-005/006).
docs.ts, docs-write.tsManifest documentation generation/save surfaces.
baseline-csv.tsPer-baseline CSV parser.
downloads.tsBrowser-download surface (filename/MIME negotiation).
rationale.ts, rationale-write.tsPer-manifest rationale log read/write surfaces.
manifests-status.tsRegistered/CLI-visible status lookup.
diff-matrix.ts, matrix-xlsx.tsMatrix diff and XLSX export handlers.
cis-lookup.tsPer-resource CIS lookup chain.
cis-bulk-lookup.tsBulk CIS coverage for the Diff page's CIS Diff tab.
cis-status.tsCIS data discovery, diagnostics, and cache reset support.
settings.ts~/.configforge/settings.json preferences, atomic writes, retention resolution.
activity.tsRecent activity feed.
compliance-report.tsCompliance report handler.
system-config.tsSystem configuration summaries for manifests.
drift.ts, scenarios.tsRetired/unavailable compatibility surfaces.
errors.tsHandlerError with code field. cliRequiredError() factory (status 412, code CLI_REQUIRED). isCliMissingMessage() substring detector.
contract.tsShared request/response types.

packages/core/src/oscfg/ -- Single CLI choke-point

runOscfg() in runner.ts is the operational CLI spawn path. binary.ts uses spawnSync only for discovery/version probes; handlers and renderer code do not spawn oscfg directly.

FileRole
index.tsRe-exports.
runner.tsBounded worker queue (MAX_CONCURRENT_SPAWNS = 4), preamble scrubbing, translated errors, stdin-EOF management.
binary.tsResolves oscfg from OSCFG_BIN env, well-known install paths, PATH, WindowsApps alias, MSIX (Get-AppxPackage), and the dev-only resources/oscfg/<plat>/ drop.
apply.tsoscfg apply wrapper.
get.tsoscfg get namespace / get resource -n <ns>.
exec.tsoscfg exec resource --mode ... wrapper for direct provider reads.
manage.tsNamespace/resource deletion helpers.
registered-types.tsWhitelist of resource types accepted by the targeted CLI version (OSCFG_CLI_VERSION = '1.3.9-preview11'). Types missing from the list trigger a soft warning at register time; the manifest still registers.
registry-types.tsRegistry valueType mapping (Dword, String, …).
registry.tsRegistry resource specifics.
compliance.tsDecides compliant / non-compliant / indeterminate from CLI output.
naming.tsisValidNamespace: refuses path-traversal, control chars.
format.tsPretty-prints CLI output for the UI.
concurrency.tsPer-namespace mutex.

packages/core/src/ai/ -- Local analysis and provenance

FileRole
analyzer.tsLocal, deterministic diff/changelog analysis (no LLM or network). analyzeDiff, generateChangelog, renderChangelogMarkdown. Output is labeled via tagAsAiGenerated before it leaves the system.
provenance.tsAiSource + Provenance types, normalizeUrl (strips utm_*, etc.), dedupeSources, computeCitationCoverage (mean of per-source confidence — a heuristic), decorateWithProvenance.
circular-guard.tstagAsAiGenerated / isAiGenerated / assertNotAiGenerated / stripAiMarker. Spoof-resistant (CF-SEC-007) via an in-process content-hash registry (FNV-1a 64-bit, browser-safe) in addition to the inline <!-- ai-generated:rev=N --> marker. Pure JS hash, no crypto import, so the module is safe to pull into the renderer bundle. assertNotAiGenerated/isAiGenerated detect marked content but are not currently wired into ingestion (advisory labeling, not enforcement).

packages/core/src/markdown/ -- Output escaping

FileRole
escape.tsescapeMarkdown(text): escapes <, >, &, etc. so user-supplied or generated content rendered as markdown can't inject HTML / script (CF-SEC-005/006).

packages/core/src/manifest/ -- Registration metadata

FileRole
rationale-store.tsPer-manifest JSONL rationale log.
audit-results-store.tsPer-manifest audit-result store.

packages/core/src/history/ -- Snapshot store

FileRole
index.tssaveSnapshot / createSnapshot, listSnapshots, getSnapshot. Dedupe + retention sweep.
restore.tsPre-restore snapshot + replay.
author.tsresolveAuthor(): env → git → OS user → unknown.

packages/core/src/diff/ -- Pairwise + matrix

FileRole
matrix.tsN-way matrix builder.
xlsx-builder.tsExcel export.

packages/core/src/audit-pack/ -- Auditor deliverable

FileRole
index.tsPDF builder. Streams to a Readable.
sections.tsOne function per section: header, compliance, history, rationale, citations, footer.
markdown.tsMarkdown emitter. Uses escapeMarkdown() for user-supplied text.
rationale-loader.tsLoads + filters per-manifest rationale entries for the pack.

packages/core/src/cis/ -- Microsoft/CIS cross-reference

The data files this module reads are not bundled in the repo or installer (license restrictions). Users drop their own legally licensed CIS benchmark files into the data directory at runtime. Loaders return null when files are absent and the UI hides every CIS surface.

FileRole
data.tsLoads user-supplied JSON catalogs from the CIS data directory. Returns null on ENOENT.
crossref.tsStrict-name match + property-mapping fallback.
compliance.ts{matched, mismatched, missing, score}.
xccdf-parser.tsXCCDF + OVAL XML parser. Supports registry exact lookup, non-registry indices, CSP-aware fuzzy title matching, and Linux fuzzy helpers used by bulk CIS Diff.
azure-policy-cis.tsAzure Policy CIS JSON parser. Supplies the Azure Policy fallback catalogs; Windows uses PascalCase/CSP word-overlap, while Linux bulk matching uses linuxFuzzyMatch.

packages/core/src/system/ -- OS dispatch

FileRole
index.tsgetSystemInfo: memoized for the process lifetime.
windows.tsPowerShell calls for admin check, server type, OS version.
linux.tsBash calls for the same.
types.tsShared shape.

packages/core/src/import-export/

FileRole
index.tsYAML / JSON round-trips + parseExcelBaseline for CSV/TSV/XLSX import.