fix(plugin-sql): migrate to messageService API and auto-create PGLite directories #6202
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
This PR modernizes the standalone example files and improves the SQL plugin's directory handling by:
MESSAGE_RECEIVEDevent system to the newmessageService.handleMessage()APIChanges
Examples ( & )
MESSAGE_RECEIVEDevent withmessageService.handleMessage()APILOG_LEVELto'silent'for cleaner console outputEventTypeandfsimportsmessageServerIdto be properly converted to UUID instandalone-cli-chat.tsresult.responseContent.textSQL Plugin
createDatabaseAdapter()(bothindex.tsandindex.node.ts)memory://,idb://, or other special URIs)mkdirSync(dataDir, { recursive: true })to ensure parent directories are created__tests__/unit/directory-creation.test.ts:memory://,idb://) don't trigger directory creationTesting
standalone.tsexamplestandalone-cli-chat.tsexampleType of Change
Related Issues
Migration Guide
Users of the examples will now benefit from:
No breaking changes - fully backward compatible.
Note
Updates examples to use messageService.handleMessage and adds automatic PGLite directory creation in the SQL plugin with tests.
EventType.MESSAGE_RECEIVEDwithruntime.messageService.handleMessage()inexamples/standalone.tsandexamples/standalone-cli-chat.ts.process.env.LOG_LEVEL = 'silent'; remove manual FS dir creation and unused imports.messageServerIduses UUID instandalone-cli-chat.ts; improve response fallback handling.packages/plugin-sql/src/index.tsandindex.node.ts, auto-create PGLite data directory viamkdirSync(dataDir, { recursive: true })whendataDiris a filesystem path.memory://,idb://, and whenpostgresUrlis provided.__tests__/unit/directory-creation.test.tscovering new directory-creation behavior.Written by Cursor Bugbot for commit 3048a27. This will update automatically on new commits. Configure here.