@existdb/xst

中文文档
4.1.2发布于 2026/03/05MITES Module构建来源已验证近 30 天下载 2112

Command line tool to interact with exist-db instances

原始使用文档
文档目录13 节
  1. Installation
  2. Updating
  3. Usage
  4. Examples
  5. Configuration
  6. With a Configuration File
  7. With Environment Variables
  8. Development
  9. Testing
  10. Coverage
  11. No REST
  12. Contributing
  13. commitlint
  ╲ ╱  ╓───  ──┰──
   ╳   ╰───╮   │  
  ╱ ╲  ▂▁▁▁│   ┇  

  A modern command line interface for exist-db

version Conventional Commits javascript style guide

Semantic Release CodeQL

Built on top of @existdb/node-exist.

Installation

Prerequisite: nodeJS version 18 or later

npm install --global @existdb/xst

This will put the executable xst in your path.

Updating

To update to the latest version of xst

npm update --global @existdb/xst

Usage

xst <command>

You can verify your installation is working with

xst --version

Output commands and options

xst --help

You can use --help with any command to get additional information on how to use it.

xst <command> --help

Available Commands

commanddescriptionaliases
infoGather system information
get [options] <source> <target>Download a collection or resourcedownload fetch
upload [options] <source> <target>Upload files and directories.up
remove [options] <paths..>Remove collections or resourcesrm delete del
edit [options] <resource>Edit a resource in a local editor
execute [<query>] [options]Execute a query string or filerun exec
list [options] <collection>List collection contentsls
package list [options]List installed packagespkg ls
package install <command>Install XAR packages from various sourcespkg i <command>
package uninstall [options] <packages..>Remove XAR packages (does check dependents)pkg uninstall.

Examples

List collections

xst list /db

List the entire contents of the apps collection

This will output extended and colored information of all collections and resources of /db/apps in a tree.

xst list /db/apps --long --tree --color

NOTE: Resources and collections the connecting user does not have access to will be omitted with --long.

Find the largest JavaScript resource

xst list /db/apps --long --recursive --color --glob '*.js' --sizesort

Download a resource

This will download the controller of the dashboard to the current working directory.

xst get /db/apps/dashboard/controller.xql .

Download a collection

If the target is a collection, a folder with the same name will be created at the specified target and all of its contents will be downloaded.

xst get /db/apps/dashboard .

The above downloads the contents of the collection /db/apps/dashboard into the dashboard folder in the current working directory.

Set the permission for a resource

This demonstrates how you can extend the current functionality by running arbitrary scripts. You need to connnect as a database administrator to be able to run the queries.

xst execute 'sm:chmod(xs:anyURI($file), $permissions)' \
  -b '{"file": "/db/apps/dashboard/controller.xql", "permissions": "rwxrwxr-x"}'

Reset the permissions back to their original state.

xst execute 'sm:chmod(xs:anyURI($file), $permissions)' \
  -b '{"file": "/db/apps/dashboard/controller.xql", "permissions": "rwxr-xr-x"}'

Executing a main module

If you find yourself using the same query over and over again or it is a complex one you can save it to a file and use the --file parameter.

xst execute --file my-query.xq

Installation of XAR packages

NOTE: The user initiating the command must be a member of the DBA group.

Package installation will attempt to resolve and install all dependencies declare in repo.xml. Installation will fail, if a dependency could not be found or could not be installed. The default registry (AKA public-repo) is https://exist-db.org/exist/apps/public-repo but can be overridden with the --registry option.

From a registry
xst package install from-registry demo-apps
One or more local files
xst package install local-files path/to/*.xar

List all installed application packages with their dependencies

xst package list --applications --dependencies

Uninstall a package

NOTE: The user initiating the command must be a member of the DBA group.

xst package uninstall demo-apps

Configuration

By default xst connects to https://localhost:8443 as user guest.

NOTE: The instance you want to connect to must be running and XML-RPC has to be enabled.

With a Configuration File

xst now supports configuration files. The global --config option expects a path to a readable configuration file. Currently three different formats are recognized.

Example

xst ls /db/apps --config spec/fixtures/.xstrc

.xstrc

A JSON formatted file where you can set connection options as well as other preferred settings like color or timesort. Have a look at the example .xstrc.

NOTE: The boolean option "secure" is deprecated. To switch between encrypted and unencrypted connections use "protocol" instead. "secure" will continue to work for both XMLRPC and REST until version 2.

.existdb.json

These are present in projects using the sync feature from eXistdb's Visual Studio Code plugin.

dotenv files

EXISTDB_USER=admin
EXISTDB_PASS=my super secret p455w0rd!
EXISTDB_SERVER=http://localhost:8080

NOTE: If the current working directory contains an .env file it will be loaded automatically unless the --config parameter is set.

With Environment Variables

Override any of the default connection parameters by setting environment variables prefixed with EXISTDB. In the following table you see a list of the parameters with their default values and a description.

variable namedefaultdescription
EXISTDB_USERguestthe user used to connect to the database and to execute queries with
EXISTDB_PASSguestthe password to authenticate the user against the database
EXISTDB_SERVERhttps://localhost:8443the URL of the database instance to connect to (only http and https protocols are allowed)

Example

EXISTDB_SERVER=http://127.0.0.1:8080 xst ls /db/apps

Development

If you want to test or develop this package further follow the steps below

  1. clone this repository

    git clone https://github.com/line-o/xst
    
  2. change to the working directory

    cd xst
    
  3. install package dependencies

    npm install
    
  4. link this package into your global packages directory

    npm link
    

Note: With this setup --version will always output 0.0.0-development.

Testing

Once you followed the above steps and linked a local clone of this repository run the testsuite with

npm test

NOTE: You will need to have an instance of existdb running (usually a local development instance).

Coverage

If you want to get test code coverage information run

npm run coverage

NOTE: You will need to have an instance of existdb running (usually a local development instance).

No REST

Additional tests in spec/norest/**/*.js ensure that everything keeps working even on instances where the REST API is disabled. You can run those with

npm run test:norest

NOTE: Keep in mind they will only run successfully against an instance that actually has REST disabled. The Test - No REST GitHub Action makes use of this.

Contributing

We are happy to accept contributions from the community. Contributions can be just a typo in the readme or better documentation, as well as bugfixes and new features. For bugfixes and features it is best to open an issue, so that we can discuss your approach first. That way your PR will be merged quickly.

When committing to this project each commit message must conform to conventional commits as versioning and releases are automated using semantic-release.

commitlint

If you want to check your commits while developing you can add a pre-commit-hook with husky.

Activate husky for this project

npx husky

This will add to git hooks

  • pre-commit npm run lint ensures any JS is formatted correctly and will prevent you from committing when it encounters problems like unused variables and such.
  • commit-msg will run commitlint to ensure the commit message is following conventional commit message format

These are not activated by default as it prevents you from doing work-in-progress commits. But keep in mind, both checks will run when you open a PR, so it might be easier to have this checked right from the start and not having to edit your history later.

版本与发布记录

@existdb/xst 共发布 34 个版本,首次发布于 2022/12/14;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.1.2latest2026/03/058 个月前
4.1.12026/02/059 个月前
4.1.02026/01/229 个月前
4.0.02026/01/199 个月前
3.3.02025/10/151.1 年前
3.2.02025/07/301.3 年前

关于 @existdb/xst 的常见问题

@existdb/xst 是什么?

Command line tool to interact with exist-db instances

如何安装 @existdb/xst?

在项目目录运行 npm install @existdb/xst,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 xst,可以用 npx xst 直接运行。

@existdb/xst 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/existdb__xst 是否存在。

@existdb/xst 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@existdb/xst 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^20.19.0 || >=22.11.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@existdb/xst 可以商用吗?

@existdb/xst 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@existdb/xst 的下载量有多少?

根据 npm 官方下载统计,@existdb/xst 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,112 次,日均约 70 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@existdb/xst 还在维护吗?

最新版本 4.1.2 发布于 2026/03/05(8 个月前);至今共发布 34 个版本,其中过去 12 个月发布了 4 个;首次发布于 2022/12/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。