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/cfactory-cli) is the only sync consumer. Editors inherit via cfactory serve.
This page describes repository-defined sync contracts. Local cfactory-gateway-server is a real, multi-tenant control plane backed by Postgres (cp_* tables). Organization owners configure SSO (OIDC/SAML) via admin Settings → SSO; Keycloak Organizations brokers per-tenant IdPs.
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/)commands.urls/hooks.urls(+hooks.enforce) — pulled into org cache; never into the worktreeinstructions(HTTPS URLs only)cfactory.org(models,providers,mcp,hooks, extra skill/command/instruction/hook URLs)
cfactory.org.models fields:
allow/deny/defaultModelagentModels— map of mode name →provider/model(e.g.plan→cfactory/opus)routingPreference—cost|balance|quality(Bifrost Auto routing bias; defaultbalance)requireAutoModel— when true, members may only usecfactory-auto/*(gateway 403 + client catalog filter); concrete allow/deny still applies to Auto routing targetsallowLocalModelOverrideByProject— map ofprojectId → boolean(resolved againstorg-bindings.json)allowLocalModelOverride— optional global fallback
When allowLocalModelOverride is false for the bound project:
- CLI applies
defaultModelandagentModels(falling back todefaultModelfor modes without an entry) and clears stickymodel.jsonper-mode picks. - IDE disables model changes in Settings → Models, Mode Edit, and the chat model picker.
Auto virtual models (cfactory-auto/* and gateway-owned cfactory/smart) resolve as follows: cfactory/smart is orchestrated in the gateway (cheap classifier → concrete model). Other Auto tiers still resolve in Bifrost; the gateway injects org routingPreference and allowed concrete model ids on those requests.
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 and orgdefaultModel/agentModelsare applied. - When unlocked, org
agentModelsfill missing localagent.*.modelentries only (user overrides win). - 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.