pfy sync
pfy sync fills project.yaml from a project that already exists on the Manager: it writes project_id and project_name, and seeds one environment alias per tenant. It never changes version or the ci: block. Use it when you join an existing project or lost your local file.
Synopsis
pfy sync --project <slug>
pfy sync --project-id <uuid>Description
The sync command pulls project metadata from the manager backend and updates your local project.yaml file. This is useful when:
- Starting work on an existing project
- Updating project name or ID after changes in manager
- Recovering lost local configuration
The command preserves existing CI/CD settings (language, registry, image name) while updating project-level metadata.
Flags
--project <slug-or-id>
The slug or UUID of the project in the ProductifyFW manager; UUID-formatted values are auto-detected and looked up by ID.
pfy sync --project my-application
pfy sync --project 01234567-89ab-cdef-0123-456789abcdef--project-id <slug-or-id> (deprecated)
Deprecated alias of --project (it accepts the same slug-or-ID values). Use --project in new scripts.
Examples
Basic Sync
Pull project configuration from manager:
pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdefOutput:
Successfully synced project configuration from manager:
ID: 01234567-89ab-cdef-0123-456789abcdef
Name: My Application
Environments: 2 aliases inferred from tenants
Configuration saved to project.yamlInitialize from Manager
Start a new local project from existing manager project:
# Clone repository
git clone https://github.com/myorg/myapp.git
cd myapp
# Initialize from manager
pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdef
# Verify configuration
cat project.yamlResult:
project_id: 01234567-89ab-cdef-0123-456789abcdef
project_name: My Application
version: 0.1.0
ci:
type: github
language: go
registry: ghcr.io
image_name: my-applicationUpdate After Manager Changes
If project name changed in manager:
# Before: project_name was "Old Name"
pfy sync --project my-app
# After: project_name is now "New Name"
cat project.yaml
# project_name: New Name ← Updated
# version: 0.1.0 ← Preserved (sync never touches version)
# ci: ← Preserved
# type: github ← PreservedBehavior
What Gets Updated
project_id: Set to manager project IDproject_name: Set to manager project nameenvironments: One alias is seeded per tenant of the project (named after the tenant slug, carrying itstenant_id), so the--env-driven deploy workflow starts pre-seeded. Existing aliases keep any extra fields (e.g.environment_id) they already carry. Only the first 100 tenants are considered; this step is best-effort and never fails the sync.
sync does not update version (see Version Management).
What Gets Preserved
ci.type: CI platform (github/gitlab)ci.language: Project language (go/node)ci.registry: Docker registry URLci.image_name: Docker image name
File Creation
If project.yaml doesn't exist, sync creates it with:
- Project ID and name from manager
- Default version
0.1.0 - Default CI settings (github, go, ghcr.io)
Use Cases
Team Onboarding
New team member setting up local environment:
# 1. Clone repo
git clone <repo-url>
cd project
# 2. Login to manager
pfy login --server https://manager.example.com --token <token>
# 3. Sync project config
pfy sync --project-id <project-id>
# 4. Start development
pfy ci updateConfiguration Recovery
Lost project.yaml after git operations:
# Recover from manager (creates project.yaml with default ci: settings)
pfy sync --project my-app
# Then fix the ci: block by hand if your defaults differ (pfy init refuses to run
# once project.yaml exists)
$EDITOR project.yamlMulti-Repository Projects
Sync same project ID across multiple repositories:
# In frontend repo
cd frontend
pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdef
# In backend repo
cd ../backend
pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdef
# Both repos now share project IDGlobal Flags
--manager <url>
Override manager URL from config:
pfy --manager https://staging-mgr.example.com sync --project-id 01234567-89ab-cdef-0123-456789abcdef--token <string>
Provide authentication token:
pfy --token <personal-access-token> sync --project-id 01234567-89ab-cdef-0123-456789abcdef--verbose, -v
Show detailed sync progress:
pfy --verbose sync --project-id 01234567-89ab-cdef-0123-456789abcdefOutput:
Connecting to ProductifyFW manager...
Fetching project details for '01234567-89ab-cdef-0123-456789abcdef'...
Successfully synced project configuration from manager:
ID: 01234567-89ab-cdef-0123-456789abcdef
Name: My Application
Environments: 2 aliases inferred from tenants
Configuration saved to project.yaml--quiet, -q
Suppress the progress and summary lines:
pfy --quiet sync --project-id 01234567-89ab-cdef-0123-456789abcdefError Handling
Project Not Found
If the slug or ID does not exist, the Manager's error is passed through after the failed to fetch project from manager: prefix (the exact wording comes from the server):
$ pfy sync --project no-such-project
Error: failed to fetch project from manager: ...Solution: check the slug with pfy project list.
Authentication Required
If not logged in:
$ pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdef
Error: manager URL is required (use --manager flag, PFY_MANAGER_URL env var, or run 'pfy login')Solution: run pfy login first.
Token rejected
A 401/403 from the Manager is reported as:
Error: token rejected by https://manager.example.com - either the token is invalid or expired (run 'pfy login' to replace it), or the URL points at the manager directly instead of the proxied entrypoint that injects authenticationSolution: run pfy whoami, then pfy login again, and make sure the URL is the proxied entrypoint.
Configuration Updates
Before sync:
# project.yaml
project_id: ""
project_name: my-local-project
version: 1.0.0
ci:
type: github
language: goAfter pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdef:
# project.yaml
project_id: 01234567-89ab-cdef-0123-456789abcdef # ← Updated
project_name: Official Name # ← Updated from manager
version: 1.0.0 # ← Preserved (sync never touches version)
ci:
type: github # ← Preserved
language: go # ← Preserved
environments: # ← Seeded: one alias per tenant
prod:
tenant_id: 33333333-4444-5555-6666-777777777777
name: ProductionIntegration
With pfy init
Use sync after init to connect local project to manager:
# Create local config
pfy init --name my-app
# Connect to manager project
pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdefWith CI/CD
Use in CI to ensure config is up-to-date:
# .github/workflows/ci.yml
- name: Sync project config
run: |
pfy login --server $MANAGER_URL --token $MANAGER_TOKEN
pfy sync --project-id $PROJECT_ID
pfy ci updateWith Version Management
Sync never touches version; the local project.yaml version is the source of truth and is managed with pfy version:
pfy sync --project my-app
pfy version show # unchanged by the sync
pfy version set --version 2.0.0Best Practices
1. Sync Before Major Operations
Always sync before deploying or rolling out to tenants:
pfy sync --project $PROJECT_SLUG
pfy application enable --app $APP_SLUG --tenant $TENANT_SLUG --project $PROJECT_SLUG2. Commit After Sync
Track configuration changes:
pfy sync --project my-saas
git diff project.yaml # Review changes
git commit -am "Sync project config from manager"3. Use in Automation
Add to deployment scripts:
#!/bin/bash
# deploy.sh
pfy sync --project-id $PROJECT_ID
pfy version bump --part patch
pfy ci update
git commit -am "Prepare release"4. Document Project ID
Store project ID in README:
# My Application
Project ID: `01234567-89ab-cdef-0123-456789abcdef`
## Setup
\`\`\`bash
pfy sync --project-id 01234567-89ab-cdef-0123-456789abcdef
\`\`\`See Also
- pfy init - Initialize new project configuration
- Project Configuration - project.yaml reference
- pfy login - Authenticate with manager
- pfy project - Project management commands