Skip to content

Add DevTools self-update workflow#273

Merged
coisa merged 14 commits intomainfrom
feature/272-global-self-update
Apr 28, 2026
Merged

Add DevTools self-update workflow#273
coisa merged 14 commits intomainfrom
feature/272-global-self-update

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 28, 2026

Related Issue

Closes #272

Follow-up: #274

Motivation / Context

  • DevTools can now be used as a standalone or global binary, so it needs Composer-like project targeting and a safe update path without requiring users to remember the right Composer command.
  • The binary should be able to warn about stale installed versions while never blocking the requested command when metadata lookup fails.
  • Commands that resolve local resources must respect the effective --working-dir instead of capturing the process cwd while the container definitions are assembled.

Changes

  • Adds global --working-dir/-d and --auto-update options through the Symfony application input definition.
  • Adds dev-tools:self-update with standalone self-update and selfupdate aliases; the update target is inferred from whether the active DevTools package lives under Composer global or the current project installation.
  • Adds a best-effort version freshness checker/notifier that is silent in repository checkouts, CI/GitHub Actions, explicit FAST_FORWARD_SKIP_VERSION_CHECK contexts, and non-blocking on failures.
  • Centralizes common runtime environment checks (GITHUB_ACTIONS, CI, Composer test runs, and truthy env flags) behind RuntimeEnvironmentInterface so output, process queue rendering, and self-update checks share one interpretation.
  • Introduces a local DevTools Composer plugin contract that centralizes reserved Composer command names/aliases and exposes isRegisteredCommand() for active-project conflict checks.
  • Adds a small DevTools ClassReflection helper so command metadata lookup can read attributes as normalized named arguments without repeating raw ReflectionClass boilerplate.
  • Keeps Composer plugin command registration canonical while preserving safe DevTools aliases such as composer code-style; aliases known to belong to Composer itself and root scripts from the active project are filtered before proxy registration.
  • Resolves the FileLocatorInterface lazily so project resource lookup sees the current working directory after the application applies --working-dir.
  • Documents the new command, global binary options, inferred self-update scope, auto-update environment behavior, and the new test doubles/helpers introduced by this PR.

Verification

  • composer dev-tools
  • composer dev-tools:fix
  • composer dev-tools phpdoc
  • Focused command(s): composer dev-tools tests -- --filter='PluginTest|DevToolsCommandProviderTest'
  • Focused command(s): composer dev-tools tests -- --filter='(SelfUpdate|DevToolsTest|DevToolsCommandProviderTest)'
  • Focused command(s): composer dev-tools tests -- --filter='DevToolsServiceProviderTest'
  • Focused command(s): composer dev-tools tests -- --filter='(DevToolsTest|SelfUpdateCommandTest)'
  • Focused command(s): composer dev-tools tests -- --filter='SelfUpdateCommandTest|DevToolsTest'
  • Focused command(s): composer dev-tools tests -- --filter='(ClassReflectionTest|DevToolsCommandLoaderTest|SelfUpdateCommandTest|DevToolsTest)'
  • Focused command(s): composer dev-tools tests -- --filter='(ClassReflectionTest|SelfUpdateCommandTest|ComposerSelfUpdateRunnerTest|VersionCheckNotifierTest|DevToolsCommandLoaderTest|DevToolsTest)'
  • Focused command(s): composer dev-tools tests -- --filter=VersionCheckNotifierTest
  • Focused command(s): composer dev-tools tests -- --filter='(RuntimeEnvironmentTest|VersionCheckNotifierTest|ProcessQueueTest|OutputFormatLoggerTest)'
  • Focused command(s): composer dev-tools tests -- --filter='(RuntimeEnvironmentTest|VersionCheckNotifierTest|ProcessQueueTest|OutputFormatLoggerTest|DevToolsTest)'
  • Focused command(s): composer dev-tools tests -- --filter=SelfUpdateCommandTest --coverage=.dev-tools/coverage/self-update-command
  • Focused command(s): composer dev-tools tests -- --filter='(SelfUpdateCommandTest|ComposerSelfUpdateScopeResolverTest|DevToolsTest)' --coverage=.dev-tools/coverage/self-update-scope
  • Manual verification: php bin/dev-tools.php self-update --help --no-ansi
  • Manual verification: php /Users/mentordosnerds/Sites/github.com/php-fast-forward/dev-tools/bin/dev-tools.php --working-dir=/Users/mentordosnerds/Sites/github.com/php-fast-forward/dev-tools list --no-ansi from /tmp
  • Manual verification: invalid --working-dir returns status 1 with a clean error message

Documentation / Generated Output

  • README updated
  • docs/ updated
  • Generated or synchronized output reviewed

Changelog

  • Added a notable CHANGELOG.md entry

Reviewer Notes

  • dev-tools:self-update is the canonical command name; self-update and selfupdate remain available only on the standalone DevTools binary because self-update is reserved by Composer. There is no --global override: global updates are selected only when the running DevTools package is installed under Composer global.
  • The Composer plugin bridge does not instantiate Composer\Console\Application and does not inspect Composer package files. It asks the active DevTools plugin contract whether command names or aliases are registered/reserved in Composer before returning proxies.
  • ClassReflection is intentionally small and local; roave/better-reflection would be more useful if DevTools needed source analysis without loading classes, which is not the case for the current command metadata flow.
  • --workspace-dir normalization is intentionally left to Normalize workspace directory handling for generated DevTools artifacts #274 so this PR only fixes the current --working-dir resource lookup bug without broadening the path policy surface.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

@coisa coisa force-pushed the feature/272-global-self-update branch from fac7d78 to ac0daf1 Compare April 28, 2026 17:36
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@coisa coisa force-pushed the feature/272-global-self-update branch from 73e9c67 to 490bcd6 Compare April 28, 2026 17:51
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@coisa coisa force-pushed the feature/272-global-self-update branch from af475e3 to 26762e1 Compare April 28, 2026 17:58
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@coisa coisa force-pushed the feature/272-global-self-update branch from a4c3e15 to aae3c27 Compare April 28, 2026 18:03
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@coisa coisa force-pushed the feature/272-global-self-update branch from b3ca917 to 5141f9f Compare April 28, 2026 18:18
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@coisa coisa force-pushed the feature/272-global-self-update branch from 5940ca5 to ac2dd3a Compare April 28, 2026 18:25
@coisa coisa force-pushed the feature/272-global-self-update branch from 1032072 to abe64fa Compare April 28, 2026 18:32
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@coisa coisa force-pushed the feature/272-global-self-update branch from e28495f to 6508518 Compare April 28, 2026 18:40
@coisa coisa merged commit 8adc64b into main Apr 28, 2026
12 checks passed
@coisa coisa deleted the feature/272-global-self-update branch April 28, 2026 20:51
github-actions Bot added a commit that referenced this pull request Apr 28, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Released in PHP Fast Forward Project Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Released

Development

Successfully merging this pull request may close these issues.

Add global DevTools working directory and self-update flow

1 participant