Skip to content

pfy init ​

pfy init creates a project.yaml in the current directory. Run it once per repository; other commands (pfy ci update, pfy version, pfy nomad deploy --env ...) read their defaults from that file.

Synopsis ​

bash
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:

  1. Auto-detect project language from go.mod or package.json
  2. Use the current directory name as the project name
  3. Set sensible defaults for registry and CI type
  4. Create a project.yaml file

Flags ​

--name <string> ​

Project name. Defaults to the current directory name.

bash
pfy init --name my-application

--language <string> ​

Project programming language. Valid values: go, node.

If not specified, auto-detects from:

  • go.mod → Go
  • package.json → Node.js
bash
pfy init --language go

--ci-type <string> ​

CI/CD platform type. Valid values: github, gitlab.

Defaults to github.

bash
pfy init --ci-type gitlab

--registry <string> ​

Docker container registry URL.

Defaults to ghcr.io (GitHub Container Registry).

bash
pfy init --registry docker.io

Examples ​

Basic Initialization ​

Initialize with auto-detected settings:

bash
pfy init

Output:

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:

bash
pfy init \
  --name my-service \
  --language node \
  --ci-type gitlab \
  --registry docker.io

Go Project ​

For a Go project (with go.mod present):

bash
pfy init --name auth-service

Generated project.yaml:

yaml
project_name: auth-service
version: 0.1.0
ci:
  type: github
  language: go
  registry: ghcr.io
  image_name: auth-service

Node.js Project ​

For a Node.js project (with package.json present):

bash
pfy init --name api-gateway --ci-type gitlab

Generated project.yaml:

yaml
project_name: api-gateway
version: 0.1.0
ci:
  type: gitlab
  language: node
  registry: ghcr.io
  image_name: api-gateway

Custom Registry ​

Use a different Docker registry:

bash
pfy init --registry registry.example.com

Generated File ​

The command creates project.yaml:

yaml
project_name: my-application
version: 0.1.0
ci:
  type: github
  language: go
  registry: ghcr.io
  image_name: my-application

Usage After Initialization ​

Once project.yaml exists, you can run commands without flags:

bash
# Without project.yaml - need all flags
pfy ci update --type github --language go --project-name my-app

# With project.yaml - no flags needed
pfy ci update

Auto-Detection ​

The command auto-detects settings in this order:

  1. Language: go.mod present sets go; package.json present sets node; neither defaults to go
  2. Project name: the --name flag, otherwise the current directory name
  3. Image name: the project name, unchanged (no lowercasing)

Error Handling ​

File Already Exists ​

If project.yaml already exists:

bash
$ pfy init
Error: failed to initialize project: project.yaml already exists in current directory

Solution: delete the file or edit it manually.

Invalid Language ​

If an invalid language is specified:

bash
$ pfy init --language python

The value is not checked. The file is written with language: python. pfy ci update then writes the Node.js Dockerfile (anything that is not go gets it) and strips both the Go-only and the Node-only jobs from the pipeline, leaving only the language-neutral ones. Valid languages: go, node.

Updating Configuration ​

To update an existing configuration:

  1. Edit project.yaml directly
  2. Delete project.yaml and run pfy init again

Global Flags ​

All global pfy flags are available:

  • --verbose, -v: Show detailed output
  • --quiet, -q: Suppress non-essential output

Verbose Output ​

bash
pfy --verbose init

Output:

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:

bash
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:

bash
# Development
pfy ci update

# Production with different registry
pfy ci update --registry production.registry.com

See Also ​