Skip to content

Packages and repository layout ​

Start with installation and the complete API program before this reference. The import and missing-client snippets illustrate package boundaries; they are not additional connection programs or commands to run against a server.

Dockline is one Git repository containing seven independently versioned npm packages. Install the packages you need. The repository root is a private workspace for development and is never the runtime package.

Pick the right level ​

PackageResponsibilityRuntime dependency boundary
@jalsoedesign/dockline-coreDockline, configuration-based client selection, connection scopes and local file helpersDepends on abstract. FTP and SFTP clients are optional peers.
@jalsoedesign/dockline-abstractShared adapter/configuration contracts, errors, retry policy, streams, limits, progress, publication, checksums, traversal and poolsHas no FTP or SSH transport implementation.
@jalsoedesign/dockline-keysIndependent key inspection, encrypted OpenSSH/PPK/PEM conversion and public-key formatsDepends on abstract for errors, sshpk and hash-wasm; no transport client.
@jalsoedesign/dockline-ftp-clientFtpConnector, common-config factory, FTP/FTPS sessions, TLS and filename handlingDepends on abstract and basic-ftp; does not depend on core or SFTP.
@jalsoedesign/dockline-sftp-clientSftpConnector, common-config factory, SSH authentication, trust and KnownHostsStoreDepends on abstract, dockline-keys and ssh2-sftp-client; does not depend on core or FTP.
@jalsoedesign/dockline-ssh-clientScoped commands, sudo and file helpersDepends on SFTP, dockline-keys and ssh2; does not depend on core or FTP.
@jalsoedesign/dockline-cliYAML-configured download, upload, list and remove commands; optional embedding APIUses core and the selected client; does not bundle either transport.

Use CLI plus a client for terminal commands and YAML configuration. Use core plus a client for Dockline.connect(), uploadFile() and downloadFile(). Use a direct client for its adapter API without the convenience wrapper. Use abstract when building your own adapter or working only with shared errors and transfer tools.

text
API consumer
  |
  +-- @jalsoedesign/dockline-core
  |     `-- selects the installed client for the configured protocol
  |
  `-- direct client use
        +-- @jalsoedesign/dockline-ftp-client  -> basic-ftp
        `-- @jalsoedesign/dockline-sftp-client -> ssh2-sftp-client

Core and both clients depend on @jalsoedesign/dockline-abstract.
The clients do not depend on core or on each other.

Installing @jalsoedesign/dockline-core alone does not install FTP, SFTP or their transport libraries. Importing core does not load both clients. Creating a connector resolves only the package required by protocol: FTP, FTPS and implicit FTPS select @jalsoedesign/dockline-ftp-client; SFTP selects @jalsoedesign/dockline-sftp-client.

The optional CLI uses core for transfers and contributes one executable, dockline. Installing the SDK or a direct client does not require the CLI. YAML parsing, command flags, terminal output and interactive host approval belong to the CLI package rather than the transfer engine.

Saved profiles are a separate optional layer ​

@jalsoedesign/portline-dockline is published from the Portline repository, not as an eighth Dockline package. It accepts complete normalized profiles from native readers and dynamically selects the installed FTP, SFTP or SSH client. Dockline's own core/client packages have no Portline or native-reader dependency. See saved-profile integration.

The transfer factory accepts only FTP/FTPS/SFTP. SshClient provides command sessions separately; installing it does not modify the factory's protocol union. The shared bridge chooses between file and command operations explicitly.

When a client is missing ​

new Dockline(config), Dockline.create(config) and core's createConnector(config) remain synchronous. They validate the configuration and load the selected installed client without opening a network connection. If the selected client is absent, they throw MissingClientPackageError.

ts
import {Dockline, MissingClientPackageError} from '@jalsoedesign/dockline-core';

try {
    const remote = Dockline.create({
        protocol: 'ftp',
        host: 'ftp.example.com',
        username: 'deploy',
        password: process.env.FTP_PASSWORD,
    });

    console.log('FTP client is available; no connection has been opened.');
    console.log(remote.toJSON());
} catch (error) {
    if (error instanceof MissingClientPackageError) {
        console.error(error.protocol, error.packageName, error.installCommand);
    } else {
        throw error;
    }
}
js
import {Dockline, MissingClientPackageError} from '@jalsoedesign/dockline-core';

try {
    const remote = Dockline.create({
        protocol: 'ftp',
        host: 'ftp.example.com',
        username: 'deploy',
        password: process.env.FTP_PASSWORD,
    });

    console.log('FTP client is available; no connection has been opened.');
    console.log(remote.toJSON());
} catch (error) {
    if (error instanceof MissingClientPackageError) {
        console.error(error.protocol, error.packageName, error.installCommand);
    } else {
        throw error;
    }
}
js
import {Dockline, MissingClientPackageError} from '@jalsoedesign/dockline-core';

try {
    const remote = Dockline.create({
        protocol: 'ftp',
        host: 'ftp.example.com',
        username: 'deploy',
        password: process.env.FTP_PASSWORD,
    });

    console.log('FTP client is available; no connection has been opened.');
    console.log(remote.toJSON());
} catch (error) {
    if (error instanceof MissingClientPackageError) {
        console.error(error.protocol, error.packageName, error.installCommand);
    } else {
        throw error;
    }
}
js
const {Dockline, MissingClientPackageError} = require('@jalsoedesign/dockline-core');

try {
    const remote = Dockline.create({
        protocol: 'ftp',
        host: 'ftp.example.com',
        username: 'deploy',
        password: process.env.FTP_PASSWORD,
    });

    console.log('FTP client is available; no connection has been opened.');
    console.log(remote.toJSON());
} catch (error) {
    if (error instanceof MissingClientPackageError) {
        console.error(error.protocol, error.packageName, error.installCommand);
    } else {
        throw error;
    }
}

The error extends ConnectorError, has code DOCKLINE_CLIENT_NOT_INSTALLED, and provides the requested protocol, required packageName and suggested installCommand. For FTP, the package is @jalsoedesign/dockline-ftp-client; for SFTP, it is @jalsoedesign/dockline-sftp-client.

The command is guidance for the application's developer. Dockline never runs it, installs a package or changes protocols. See installation for npm commands covering each package combination. A present but broken client, including a missing dependency or an exception while loading, retains its original error instead of being mislabeled as an absent optional client.

Dockline.connect() and Dockline.withConnection() return promises. A missing client rejects that promise before authentication. Client installation and host authentication are separate: finding a package does not open a connection or approve a host key.

The shared bridge reports a missing FTP, SFTP or SSH handler as ProfileExecutionError with code MISSING_HANDLER and an installation command. That error belongs to @jalsoedesign/portline-dockline; it is distinct from core's MissingClientPackageError. Direct imports of an absent SSH package produce Node's module-loading error. None of these layers automatically installs a client.

Shared exports and concrete clients ​

ts
import {Dockline, type FtpTransferConfig, ConnectorError} from '@jalsoedesign/dockline-core';
import {ConnectorPool, type TransferAdapter} from '@jalsoedesign/dockline-abstract';
import {FtpConnector} from '@jalsoedesign/dockline-ftp-client';
import {SftpConnector, KnownHostsStore} from '@jalsoedesign/dockline-sftp-client';
js
import {Dockline, ConnectorError} from '@jalsoedesign/dockline-core';
import {ConnectorPool} from '@jalsoedesign/dockline-abstract';
import {FtpConnector} from '@jalsoedesign/dockline-ftp-client';
import {SftpConnector, KnownHostsStore} from '@jalsoedesign/dockline-sftp-client';
js
import {Dockline, ConnectorError} from '@jalsoedesign/dockline-core';
import {ConnectorPool} from '@jalsoedesign/dockline-abstract';
import {FtpConnector} from '@jalsoedesign/dockline-ftp-client';
import {SftpConnector, KnownHostsStore} from '@jalsoedesign/dockline-sftp-client';
js
const {Dockline, ConnectorError} = require('@jalsoedesign/dockline-core');
const {ConnectorPool} = require('@jalsoedesign/dockline-abstract');
const {FtpConnector} = require('@jalsoedesign/dockline-ftp-client');
const {SftpConnector, KnownHostsStore} = require('@jalsoedesign/dockline-sftp-client');

Core re-exports the generic abstract API and common configuration types. Its TransferAdapter is a structural contract, not a union that imports both concrete clients. remote.connector implements that contract. Import a concrete class from its own client package when you need protocol-specific members.

Both clients export createConnector(commonConfig) in addition to their existing concrete classes and low-level config types. FTP accepts the FTP/FTPS common-config variants; SFTP accepts the SFTP variant. The direct factory maps common names such as username and root to the adapter's low-level configuration. It returns a lazy adapter; call connect() and close it explicitly, or use the adapter's documented lazy operation behavior.

Shared errors originate in abstract. With one resolved abstract installation, core and the client re-exports use the same constructors. Multiple separately installed copies can have ordinary JavaScript class-identity differences; keep compatible versions aligned.

Repository layout ​

text
Dockline/
  package.json             private npm workspace and shared commands
  package-lock.json        lockfile for all workspaces and development tools
  packages/
    abstract/
      src/
      tests/
      package.json
    core/
      src/
      tests/
      package.json
    ftp-client/
      src/
      tests/
      package.json
    sftp-client/
      src/
      tests/
      package.json
    keys/
      src/
      tests/
      package.json
    ssh-client/
      src/
      tests/
      package.json
    cli/
      src/
      tests/
      examples/
      package.json
  scripts/                 shared build and distribution checks
  docs/                    separately installed VitePress site

Each package has its own manifest, version, public entry point, source and generated dist/ directory. Published dependency ranges describe npm packages rather than sibling filesystem paths. Local workspaces satisfy those ranges during development; packed-consumer checks install actual tarballs outside the checkout.

Packages are independently versioned. Current versions and dependency minima live in their manifests; shared-contract changes must keep dependent ranges and optional peer compatibility accurate. See compiler and package build.

All packages belong to the Dockline repository; the CLI source is in packages/cli. Each npm package has its own page.

PackagenpmGitHub source
@jalsoedesign/dockline-abstractnpmpackages/abstract
@jalsoedesign/dockline-ftp-clientnpmpackages/ftp-client
@jalsoedesign/dockline-sftp-clientnpmpackages/sftp-client
@jalsoedesign/dockline-corenpmpackages/core
@jalsoedesign/dockline-keysnpmpackages/keys
@jalsoedesign/dockline-ssh-clientnpmpackages/ssh-client
@jalsoedesign/dockline-clinpmpackages/cli

SSH command client ​

@jalsoedesign/dockline-ssh-client adds scoped SSH commands, sudo and SFTP helpers. Guide · Source. It depends on the SFTP client and ssh2; existing core, FTP, SFTP and CLI packages do not install it automatically.