Skip to content

SkillsCommand

github-actions edited this page Apr 10, 2026 · 2 revisions

Synchronizes packaged Fast Forward skills into the consumer repository.

This command SHALL ensure that the consumer repository contains the expected .agents/skills directory structure backed by the packaged skill set. The command MUST verify that the packaged skills directory exists before any synchronization is attempted. If the target skills directory does not exist, it SHALL be created before the synchronization process begins.

The synchronization workflow is delegated to

  • See: \FastForward\DevTools\Agent\Skills\SkillsSynchronizer. This command MUST act as an orchestration layer only: it prepares the source and target paths, triggers synchronization, and translates the resulting status into Symfony Console output and process exit codes.

Methods

__construct

Initializes the command with an optional skills synchronizer instance.

public __construct(\FastForward\DevTools\Agent\Skills\SkillsSynchronizer|null $synchronizer = new \FastForward\DevTools\Agent\Skills\SkillsSynchronizer(), \Symfony\Component\Filesystem\Filesystem|null $filesystem = null): mixed

If no synchronizer is provided, the command SHALL instantiate the default

  • See: \FastForward\DevTools\Agent\Skills\SkillsSynchronizer implementation. Consumers MAY inject a custom synchronizer for testing or alternative synchronization behavior, provided it preserves the expected contract.

Parameters:

Parameter Type Description
$synchronizer \FastForward\DevTools\Agent\Skills\SkillsSynchronizer|null the synchronizer responsible
for applying the skills
synchronization process
$filesystem \Symfony\Component\Filesystem\Filesystem|null filesystem used to resolve
and manage the skills
directory structure

configure

Configures the command name, description, and help text.

protected configure(): void

The command metadata MUST clearly describe that the operation synchronizes Fast Forward skills into the .agents/skills directory and that it manages link-based synchronization for packaged skills.


execute

Executes the skills synchronization workflow.

protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): int

This method SHALL:

  • announce the start of synchronization;

  • resolve the packaged skills path and consumer target directory;

  • fail when the packaged skills directory does not exist;

  • create the target directory when it is missing;

  • delegate synchronization to

  • See: \FastForward\DevTools\Agent\Skills\SkillsSynchronizer;

  • return a success or failure exit code based on the synchronization result.

The command MUST return

  • See: \FastForward\DevTools\Command\self::FAILURE when packaged skills are not available or when the synchronizer reports a failure. It MUST return

  • See: \FastForward\DevTools\Command\self::SUCCESS only when synchronization completes successfully.

Parameters:

Parameter Type Description
$input \Symfony\Component\Console\Input\InputInterface the console input instance provided by Symfony
$output \Symfony\Component\Console\Output\OutputInterface the console output instance used to report progress

Return Value:

The process exit status. This MUST be

  • See: \FastForward\DevTools\Command\self::SUCCESS on success and
  • See: \FastForward\DevTools\Command\self::FAILURE on failure.

Inherited methods

__construct

Constructs a new AbstractCommand instance.

public __construct(\Symfony\Component\Filesystem\Filesystem|null $filesystem = null): mixed

The method MAY accept a Filesystem instance; if omitted, it SHALL instantiate a new one.

Parameters:

Parameter Type Description
$filesystem \Symfony\Component\Filesystem\Filesystem|null the filesystem utility to use

runProcess

Executes a given system process gracefully and outputs its buffer.

protected runProcess(\Symfony\Component\Process\Process $command, \Symfony\Component\Console\Output\OutputInterface $output, bool $tty = true): int

The method MUST execute the provided command ensuring the output is channeled to the OutputInterface. It SHOULD leverage TTY if supported. If the process fails, it MUST return self::FAILURE; otherwise, it SHALL return self::SUCCESS.

Parameters:

Parameter Type Description
$command \Symfony\Component\Process\Process the configured process instance to run
$output \Symfony\Component\Console\Output\OutputInterface the output interface to log warnings or results
$tty bool

Return Value:

the status code of the command execution


getCurrentWorkingDirectory

Retrieves the current working directory of the application.

protected getCurrentWorkingDirectory(): string

The method MUST return the initial working directory defined by the application. If not available, it SHALL fall back to the safe current working directory.

Return Value:

the absolute path to the current working directory


getAbsolutePath

Computes the absolute path for a given relative or absolute path.

protected getAbsolutePath(string $relativePath): string

This method MUST return the exact path if it is already absolute. If relative, it SHALL make it absolute relying on the current working directory.

Parameters:

Parameter Type Description
$relativePath string the path to evaluate or resolve

Return Value:

the resolved absolute path


getConfigFile

Determines the correct absolute path to a configuration file.

protected getConfigFile(string $filename, bool $force = false): string

The method MUST attempt to resolve the configuration file locally in the working directory. If absent and not forced, it SHALL provide the default equivalent from the package itself.

Parameters:

Parameter Type Description
$filename string the name of the configuration file
$force bool determines whether to bypass fallback and forcefully return the local file path

Return Value:

the resolved absolute path to the configuration file


getDevToolsFile

Resolves the absolute path to a file within the fast-forward/dev-tools package.

protected getDevToolsFile(string $filename): string

This method uses Composer's InstalledVersions to determine the installation path of the fast-forward/dev-tools package and returns the absolute path to the given filename within it. It is used as a fallback when a configuration file is not found in the project root.

Parameters:

Parameter Type Description
$filename string the name of the file to resolve within the dev-tools package

Return Value:

the absolute path to the file inside the dev-tools package


runCommand

Configures and executes a registered console command by name.

protected runCommand(string $command, \Symfony\Component\Console\Output\OutputInterface $output): int

The method MUST run the specified command with the provided input and output interfaces.

Parameters:

Parameter Type Description
$command string the commandline name of the command to execute
$output \Symfony\Component\Console\Output\OutputInterface the interface for buffering output

Return Value:

the status code resulting from the dispatched command


getPsr4Namespaces

Retrieves configured PSR-4 namespaces from the composer configuration.

protected getPsr4Namespaces(): array

This method SHALL parse the underlying composer.json using the Composer instance, and MUST provide an empty array if no specific paths exist.

Return Value:

the PSR-4 namespaces mappings


getProjectName

Computes the human-readable title or description of the current application.

protected getProjectName(): string

The method SHOULD utilize the package description as the title, but MUST provide the raw package name as a fallback mechanism.

Return Value:

the computed title or description string


getProjectDescription

Computes the human-readable description of the current application.

protected getProjectDescription(): string

The method SHOULD utilize the package description as the title, but MUST provide the raw package name as a fallback mechanism.

Return Value:

the computed title or description string


Clone this wiki locally