Esta página está em português. A versão em inglês é a referência principal quando houver divergência.
Organization Sync (SaaS IDE)
Organization management for the CFactory SaaS IDE lives in a hosted control plane (or the cfactory-admin React + shadcn UI in this monorepo). The CLI runtime (packages/opencode) is the only sync consumer. Editors inherit via cfactory serve.
This page describes repository-defined sync contracts. Production org CRUD, billing ledgers, and SSO live in CFactory-Org/cloud. Local cfactory-gateway-server emulates the same shapes for dev:stack.
Hard invariants
- Organization artifacts never enter a git worktree (no writes to
.cfactory/,AGENTS.md, or marketplace-style project installs). - Org and user content coexist (
source: "organization"vs user). Same basename does not clobber. - Free-form
mergeDeepof/api/configis rejected. Only allowlisted keys apply.
Allowlisted /api/config
Accepted:
skills.urls(HTTPS indexes pulled into~/.cache/cfactory/org/<orgId>/skills/)instructions(HTTPS URLs only)cfactory.org(models,providers,mcp, extra skill/instruction URLs)
cfactory.org.models fields:
allow/deny/defaultModelallowLocalModelOverrideByProject— map ofprojectId → boolean(resolved againstorg-bindings.json)allowLocalModelOverride— optional global fallback
cfactory.org.providers fields (structured; never free-form provider merge):
enabled— CFly staff master switch for the orgallowCustom— org admin: members may add local custom providerscatalog— org-published provider entries (id,name,npm,baseURL,models) with no secrets
Ignored (examples): permission, mcp, agent, formatter, tui, provider, skills.paths.
CLI entrypoints
Sync runs on Config load for TUI, cfactory run, and cfactory serve. Acceptance: org skills/rules appear without the VS Code extension installed.
Org model/provider policy is applied at runtime:
- When
allowLocalModelOverrideis false for the bound project, localmodel/small_model/subagent_model/agent.*.modeloverrides are ignored anddefaultModelis applied. - Provider catalog entries are additive; local OpenAI-compatible custom providers are stripped when staff has not enabled the feature or the admin has disabled custom adds.
consoleManagedProvidersis populated from the org catalog.- The model catalog is pre-filtered with
modelAllowed().
Project bind
~/.config/cfactory/org-bindings.json maps directory or git remote → organizationId + projectId. The CLI sets CFACTORY_PROJECT_ID for gateway usage headers.
Model policy
Gateway returns 403 for disallowed models. Catalog endpoints filter the list. Client UI filter alone is insufficient.
Provider policy
| Flag | Who sets it | Meaning |
|---|---|---|
providers.enabled | CFly staff (per org) | Master switch |
providers.allowCustom | Org admin (only if enabled) | Users may add local custom providers |
providers.catalog | Org admin (only if enabled) | Org provider catalog |
Admin UI: Governance → Providers. Staff toggle lives on the Organization page when profile.user.staff is true.
Admin UI kit
packages/cfactory-admin uses React + shadcn + Tailwind, dark-first, primary #d2006f (CFly brand pink). It does not use Solid cfactory-ui.