pfy init
Initialize a new project configuration file (project.yaml) with project metadata and CI/CD settings.
Synopsis
pfy init [flags]Description
The init command creates a project.yaml file in the current directory with project configuration. This file stores CI/CD settings, project metadata, and environment mappings, allowing subsequent commands to run without repetitive flags.
The command will:
- Auto-detect project language from
go.modorpackage.json - Use the current directory name as the project name
- Set sensible defaults for registry and CI type
- Create a
project.yamlfile
Flags
--name <string>
Project name. Defaults to the current directory name.
pfy init --name my-application--language <string>
Project programming language. Valid values: go, node.
If not specified, auto-detects from:
go.mod→ Gopackage.json→ Node.js
pfy init --language go--ci-type <string>
CI/CD platform type. Valid values: github, gitlab.
Defaults to github.
pfy init --ci-type gitlab--registry <string>
Docker container registry URL.
Defaults to ghcr.io (GitHub Container Registry).
pfy init --registry docker.ioExamples
Basic Initialization
Initialize with auto-detected settings:
pfy initOutput:
Successfully initialized project configuration:
Name: my-project
Language: go
CI Type: github
Registry: ghcr.io
Image: my-project
Configuration saved to project.yaml
You can now run 'pfy ci update' without additional flags.Custom Configuration
Specify all settings explicitly:
pfy init \
--name my-service \
--language node \
--ci-type gitlab \
--registry docker.ioGo Project
For a Go project (with go.mod present):
pfy init --name auth-serviceGenerated project.yaml:
project_name: auth-service
version: 0.1.0
ci:
type: github
language: go
registry: ghcr.io
image_name: auth-serviceNode.js Project
For a Node.js project (with package.json present):
pfy init --name api-gateway --ci-type gitlabGenerated project.yaml:
project_name: api-gateway
version: 0.1.0
ci:
type: gitlab
language: node
registry: ghcr.io
image_name: api-gatewayCustom Registry
Use a different Docker registry:
pfy init --registry registry.example.comGenerated File
The command creates project.yaml:
project_name: my-application
version: 0.1.0
ci:
type: github
language: go
registry: ghcr.io
image_name: my-applicationUsage After Initialization
Once project.yaml exists, you can run commands without flags:
# Without project.yaml - need all flags
pfy ci update --type github --language go --project-name my-app --output .github/workflows/ci.yml
# With project.yaml - no flags needed
pfy ci update --output .github/workflows/ci.ymlAuto-Detection
The command auto-detects settings in this order:
Language Detection:
- Check for
go.mod→ Set language togo - Check for
package.json→ Set language tonode - Default to
goif neither found
- Check for
Project Name:
- Use
--nameflag if provided - Otherwise use current directory name
- Use
Image Name:
- Derived from project name (lowercase)
Error Handling
File Already Exists
If project.yaml already exists:
$ pfy init
Error: project.yaml already exists in current directorySolution: Delete the file or edit it manually.
Invalid Language
If an invalid language is specified:
$ pfy init --language pythonThe file will be created, but CI commands may fail. Valid languages: go, node.
Updating Configuration
To update an existing configuration:
- Manual Edit: Directly edit
project.yaml - Reinitialize: Delete
project.yamland runpfy initagain
Global Flags
All global pfy flags are available:
--verbose, -v: Show detailed output--quiet, -q: Suppress non-essential output
Verbose Output
pfy init --verboseOutput:
Initializing project: my-project
Successfully initialized project configuration:
Name: my-project
Language: go
CI Type: github
Registry: ghcr.io
Image: my-project
Configuration saved to project.yaml
You can now run 'pfy ci update' without additional flags.Best Practices
Version Control
Commit project.yaml to version control:
pfy init
git add project.yaml
git commit -m "Add project configuration"Team Collaboration
Initialize the project once and share via version control. All team members will use the same configuration.
Environment-Specific Overrides
Use flags to override for specific environments:
# Development
pfy ci update
# Production with different registry
pfy ci update --registry production.registry.comSee Also
- Project Configuration - Detailed configuration guide
- pfy ci update - Generate CI/CD templates