Make and reload your first change
Change the starter command, rebuild the same plugin version, and use Phials’ development reload action to replace the running module. A reload is a lifecycle operation, not a page refresh and not the build itself.
Change the command
In src/main.ts, replace the existing helloCommand with:
const helloCommand: Command = {
id: "acme.hello-phials.hello",
label: "Say hello to Phials",
description: "Confirms that the latest development build is activated",
icon: "mdi:hand-wave",
category: "View",
contextKeys: ["always"],
action: () => {
api?.notify.success("My first plugin change is running");
},
};Keep the command ID stable. IDs identify commands across reloads and user configuration; the label and behavior can change without creating a second command.
Rebuild and reinstall
Run the same validation gate against the changed source, then replace the installed development artifacts:
npm run check
npm run build
npm run validate
npm run dev:installIf you installed into an isolated Phials Home, pass the same location again:
npm run dev:install -- --phials-home /absolute/path/to/phials-plugin-devThe build and install commands update files on disk. The old module remains activated in the running Phials process until you explicitly reload it.
Reload in Phials
Open Settings → Plugins → Community plugins → Installed, find Hello Phials, and choose Reload.
Phials performs the plugin reload lifecycle:
- calls the old module’s
onBeforeReloadhook when it exists and retains only the state that hook returns; - deactivates the old plugin and removes its active capabilities and runtime registrations;
- imports the newly installed
main.js; - accepts and activates the new plugin definition; and
- passes retained reload state to the new module’s
onAfterReloadhook when both sides support it.
The starter does not preserve reload state, so this first reload simply replaces the command and file surface. Durable settings and plugin data follow their own storage contracts and are not deleted by deactivation.
If the new release cannot load or activate, Phials reports the reload error and restores the prior activated development release. Correct the source, rerun the four commands, and choose Reload again.
Verify the new code
Open the Command Bar and search for Say hello to Phials. The old Hello from Phials label should no longer appear. Run the new command and confirm the notification says:
My first plugin change is runningThose results show that Phials imported and activated the rebuilt module rather than merely rereading the old plugin definition.
You now have the basic authoring loop. Continue to Rebuild and reload plugin changes for watch mode and repeated development, or begin with Define and register a command to turn the example into a useful capability.