feat: add appkit codemod on-plugins-ready CLI#291
Merged
MarioCadenas merged 9 commits intomainfrom Apr 27, 2026
Merged
Conversation
Replace the post-await extend/start ceremony with a declarative `customize` callback on createApp config. The callback runs after plugin setup but before the server starts, giving access to the full appkit handle for registering custom routes or async setup. - Add `customize` option to createApp config - Server start is now orchestrated by createApp (lookup by name) - Remove `autoStart` from public API, ServerConfig, and manifest - Remove `start()` from server plugin exports - Remove autoStart guards from extend() and getServer() - Remove ServerError.autoStartConflict() - Migrate dev-playground, template, and all tests Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
… detection Rename the lifecycle hook from `customize` to `onPluginsReady` to clearly communicate when it fires (after plugins are ready, before server starts). Add `appkit codemod customize-callback` CLI command that auto-migrates old autoStart/extend/start patterns to the new onPluginsReady callback. Supports both .then() chain (Pattern A) and await + imperative (Pattern B, with bail-out for complex cases). Add runtime detection that throws helpful errors when users pass autoStart to server() or call server.start() after upgrading, directing them to run the codemod. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
The test fixture .ts files import @databricks/appkit which doesn't exist in the shared package, causing tsc to fail in CI. Exclude the fixtures directory from the shared tsconfig. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Remove the codemod CLI from this PR to keep the review focused on the core lifecycle change. The codemod will land as a follow-up with bug fixes from review. Runtime detection (constructor autoStart throw + exports().start() trap) stays since it's part of the migration story. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Log when the onPluginsReady hook starts and completes to aid debugging in development mode. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Update runtime detection error messages to point users to `npx appkit codemod on-plugins-ready` to match the hook name. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
0e8847c to
c03f8d0
Compare
Add `appkit codemod on-plugins-ready` command that auto-migrates old autoStart/extend/start patterns to the new onPluginsReady callback. Handles Pattern A (.then chain) and Pattern B (await + imperative). Bails with a warning for complex cases (non-server usage of appkit handle, multiple extend calls). Includes fixes from review: - Use raw slice offset for brace matching (not trimmed) - Use brace-aware parsing for .catch() handlers with arrow functions - Bail out when multiple .extend() calls detected in Pattern B Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
- Remove entire `await appkit.server.start();` statements instead of just stripping `.start()` (which left dangling `await appkit.server;`) - Detect async callbacks in .then() and emit `async onPluginsReady` so await expressions inside the body remain valid Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
31e6174 to
3d50cfa
Compare
ditadi
approved these changes
Apr 27, 2026
MarioCadenas
added a commit
that referenced
this pull request
Apr 27, 2026
`server({ autoStart: false }).then(appkit => appkit.server.extend(...).start())`
is gone — `createApp` now orchestrates server start itself, with the
post-setup hook surfaced as the `onPluginsReady` config callback.
Drop `autoStart: false`, hoist the `extend` block from the trailing
`.then` chain into `onPluginsReady`, and replace the dangling promise
with `.catch(console.error)` so unhandled rejections still surface.
Tracks #280 / #291 (autoStart removal + on-plugins-ready codemod).
MarioCadenas
added a commit
that referenced
this pull request
Apr 29, 2026
`server({ autoStart: false }).then(appkit => appkit.server.extend(...).start())`
is gone — `createApp` now orchestrates server start itself, with the
post-setup hook surfaced as the `onPluginsReady` config callback.
Drop `autoStart: false`, hoist the `extend` block from the trailing
`.then` chain into `onPluginsReady`, and replace the dangling promise
with `.catch(console.error)` so unhandled rejections still surface.
Tracks #280 / #291 (autoStart removal + on-plugins-ready codemod).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
appkit codemod on-plugins-readyCLI command to auto-migrate apps from the oldautoStart/extend/startpattern to the newonPluginsReadycallback.Depends on #280.
Usage
What it does
.start(), injects asonPluginsReadyproperty, preserves.catch()handlers (including arrow functions with parens)onPluginsReady, removes standalone statements. Bails with warning for complex cases (non-server usage of appkit handle, multiple extend calls)autoStart: true/falsefrom allserver()configs, preserves other propertiescreateAppfrom@databricks/appkit--writeflag to apply changesTest plan
Demo
codemod-demo.mp4