Add the SQLX CLI integration to the settings page - #2959
Merged
Merged
Conversation
The page installs, updates and locates the OtterMind SQLX command line, imports the datasources Chat2DB already holds, and shows the Skill commands an agent needs. SQLX is a separate product from the chat2db CLI, so it gets its own module and its own page section instead of extending the existing CLI entry. * chat2db-community-sqlx: platform and asset mapping for the official release, version parsing, a process runner, the release installer with SHA-256 verification and an atomic move, settings storage, and the status service. Credentials are read through queryDisplayDataSourceById(id, true) -- the decrypted view the connection path uses -- and travel to the SQLX child process on stdin, never through argv, files, the renderer or the logs. * chat2db-community-tools: the SqlxBridge contract, SqlxStatus and SqlxDatasourceState so the JCEF shell can reach the bridge without depending on a domain or storage module. * chat2db-community-jcef: eight handlers (status, install, update, check, cancel, choose binary, import, datasource states) plus a boundary test that fails if any handler imports an implementation package. * chat2db-community-start: registers the bridge before Spring starts and attaches the datasource reader after app.run, so the page never sees a missing bridge. * chat2db-community-client: the CLI 集成 settings section with the version line, one adaptive action button, a redetect that stays visible long enough to be seen, a datasource table with a status column (已导入 / 未导入 / 暂不支持 / 信息不完整) that only lets importable rows be selected, an import result reported as an alert, and the Skill commands with hover copy buttons. SqlxConnectionMapping now reaches the eight engines added for the next SQLX release (Presto, Hive, Kylin, XuguDB, Db2, Informix -- which Chat2DB spells INFOMIX -- SUNDB and GBase 8s), so they import once that release ships instead of being skipped as unsupported. Snowflake, Oscar, Elasticsearch, BigQuery and Redshift stay unsupported and keep reporting their reason. Verified: chat2db-community-sqlx tests (41, including the new engine mapping and the datasource reader that must use the decrypted view), test:sqlx-setting, test:settings-layout, test:i18n, eslint on the changed files, and build:web:community. The desktop app was exercised by hand against a real installation, an update and an import of a MySQL datasource.
The Skill page section only showed `sqlx skill install --target <agent>`, which installs the Skill into an agent whose plugin the user still has to add. Each row now carries the command the SQLX README documents for that agent, so the plugin, the CLI and the Skill arrive together: * Codex and Claude Code: marketplace plus plugin install. * dsh: both documented profiles, browser UI and terminal UI. * pi: the npm package. The section description says the plugin brings the CLI and the Skill, and the settings search indexes plugin and marketplace. Verified with test:sqlx-setting, test:i18n, eslint and build:web:community.
The mapping filled `service` for Oracle only, so an imported Informix or GBase 8s connection stored an empty server instance. SQLX does not require it for those two engines, so the import reported success and the failure appeared later, when the driver refused the URL with "GBASEDBTSERVER has to be specified" or an INFORMIXSERVER error. Chat2DB keeps that instance in the form's service field (`InformixDBManager` appends `INFORMIXSERVER=`, `GBase8sDBManager` appends `GBASEDBTSERVER=`) and in the saved URL parameter block. The mapping now sends it as `--service`, and the database name it derives drops the `:KEY=value` block, which used to end up inside `database` (`app:INFORMIXSERVER=informix`). 42 module tests pass.
`useBinary` recorded the path, version and source of the adopted executable but left the note and digest of the download this page made. The page renders that note when the probe has no message of its own, so an adopted binary could still show "could not install into ..." from an earlier, unrelated install.
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.
What this adds
A CLI 集成 section in 设置 that installs, updates and locates the OtterMind SQLX command line,
imports the datasources Chat2DB already holds, and shows the Skill command an agent needs.
SQLX is a separate product from the
chat2dbCLI (/api/cli/v1), so it gets its own module and its ownpage section instead of extending the existing CLI entry.
Backend
chat2db-community-sqlx(new module): platform/asset mapping for the official release, versionparsing from
sqlx --version, a process runner, the release installer (download → SHA-256 → extract →atomic move, with a managed fallback directory when the official directory is not writable), settings
storage, and the status service the page polls.
queryDisplayDataSourceById(id, true)— the decrypted view the connection path itself uses — and sendsthem to the SQLX child process on stdin. They do not appear in argv, on disk, in the renderer, or in
logs. The status endpoint never returns a credential.
chat2db-community-tools: theSqlxBridgecontract plusSqlxStatusandSqlxDatasourceState, sothe JCEF shell reaches the bridge without depending on a domain or storage module.
chat2db-community-jcef: eight handlers (get-sqlx-status,install-sqlx,update-sqlx,check-sqlx-update,cancel-sqlx-operation,set-sqlx-binary,import-sqlx-datasources,get-sqlx-datasource-states) and a boundary test that fails if a handler imports an implementationpackage.
chat2db-community-start: registers the bridge before Spring starts and attaches the datasourcereader after
app.run, so the page never sees a missing bridge.SqlxConnectionMappingreaches the eight engines added for the next SQLX release — Presto, Hive,Kylin, XuguDB, Db2, Informix (which Chat2DB spells
INFOMIX), SUNDB and GBase 8s — instead of skippingthem as unsupported. Snowflake, Oscar, Elasticsearch, BigQuery and Redshift stay unsupported and keep
reporting their reason.
Page
Version line with the update check, one adaptive action button (install / update / check), a redetect that
stays visible long enough to be seen, the executable path, a datasource table with a status column
(已导入 / 未导入 / 暂不支持 / 信息不完整) where only importable rows can be selected, the import result as an
alert, and the Skill commands with hover copy buttons.
Verification
mvn -pl :chat2db-community-sqlx -am test— 41 tests, including the engine mapping for the new types,the datasource reader that must use the decrypted view, and the release installer.
yarn test:sqlx-setting,yarn test:settings-layout,yarn test:i18n,yarn test:community-boundary,eslint on the changed files, and
yarn build:web:community.MySQL datasource that then answered a query through
sqlx.