PluginsRefreshCommand class

artisan plugins:refresh: regenerates lib/app/_plugins.g.dart from the authoritative .artisan/plugins.json registry written by plugin install commands.

The generated file is the consumer-side codegen barrel imported by the project's bin/dispatcher.dart wrapper to wire every installed plugin's ArtisanServiceProvider into the in-process command registry without dart:mirrors (AOT-prohibited) or runtime file scanning.

Parallels CommandsRefreshCommand: both are deterministic codegen primitives ("read source of truth → emit Dart"), both are idempotent (consecutive runs produce byte-identical output), both write atomically via .tmp + rename so an open editor never observes a partial file.

Failure modes

  • lib/app/ missing → FormatException pointing the operator at dart run magic:artisan install.
  • Two registry entries claiming the same providerClassFormatException naming both colliding plugin names (mirrors the fail-fast collision semantics already enforced by ArtisanRegistry).
  • A providerClass that is not a valid Dart identifier → FormatException (defense against code injection via the registry).

Testing seams

The constructor accepts an optional VirtualFs, an optional projectRoot override, and an optional directoryExists predicate so the command can be driven against an InMemoryFs without touching the host filesystem. Production callers pass nothing and get RealFs + FileHelper.findProjectRoot + Directory.existsSync by default.

Inheritance

Constructors

PluginsRefreshCommand({VirtualFs? fs, String? projectRoot, bool directoryExists(String absDir)?})
Creates a PluginsRefreshCommand.

Properties

boot CommandBoot
What boot context the dispatcher must establish before calling handle. See CommandBoot for the V1 taxonomy (none, connected).
no setteroverride
description String
One-line description (rendered in artisan list next to name).
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
name String
Dispatch key. Colons (:) act as namespace prefixes for artisan list grouping (e.g. dusk:snap groups under dusk).
no setterinherited
parsedSignature CommandSignature?
Lazy-parsed signature. Cached for the lifetime of the instance.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signature String
Optional Laravel-style signature DSL. When set, name derives from it and configure auto-registers the declared options/flags.
no setteroverride

Methods

configure(ArgParser parser) → void
Auto-applies signature to the parser when set. Override to register extra ArgParser features (mandatory options, aliases, custom value validators). When you override, call super.configure(parser) first if you also use the signature DSL.
inherited
handle(ArtisanContext ctx) Future<int>
Execute the command. Returns the process exit code.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited