Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pm-debug.log
node_modules
.idea
.env
*.log
test/logs/
Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ Releases before `4.0.0` are recorded as git tags and GitHub Releases.

## [Unreleased]

## [4.2.0] - 2026-11-25

### Added

- `index.d.ts` now describes the public API, host and server configuration,
handlers, events, and runtime state for TypeScript and JavaScript editors.
The package points `types` at the declaration file and includes it in the
published files list. Runtime behavior is unchanged.
- README-linked live tests now carry JSDoc annotations that demonstrate the
same editor support, and the README explains the annotation pattern for
consumers.

### Fixed

- Restored the legacy `Stream`/`EventEmitter` options pass-through from the host
config so emitter options such as `captureRejections` still apply. The release
candidate had dropped it during JSDoc annotation.
- Corrected editor declarations for `hostVerifier` raw key bytes and nullable
error callbacks, and annotated the remaining README-linked
`keyboard-interactive` example.

### Development

- Added an AI-assisted workflow prompt for maintaining public declarations and
JSDoc annotations.

## [4.1.0] - 2026-11-23

### Added
Expand Down Expand Up @@ -184,7 +210,8 @@ See [docs/MIGRATING-4.md](./docs/MIGRATING-4.md) for the symptom-to-fix guide.
`~/.ssh/id_ed25519` copies that were only needed by nested `ssh -i` hops.
- `ssh2Client` is now `_ssh2Client` and is documented as an internal test seam.

[Unreleased]: https://github.com/cmp-202/ssh2shell/compare/v4.1.0...HEAD
[Unreleased]: https://github.com/cmp-202/ssh2shell/compare/v4.2.0...HEAD
[4.2.0]: https://github.com/cmp-202/ssh2shell/compare/v4.1.0...v4.2.0
[4.1.0]: https://github.com/cmp-202/ssh2shell/compare/v4.0.4...v4.1.0
[4.0.4]: https://github.com/cmp-202/ssh2shell/compare/v4.0.3...v4.0.4
[4.0.3]: https://github.com/cmp-202/ssh2shell/compare/v4.0.2...v4.0.3
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ one command to decide what to do next.
- [Why ssh2shell](#why-ssh2shell)
- [Installation](#installation)
- [Quick start](#quick-start)
- [Editor support](#editor-support)
- [Core concepts](#core-concepts)
- [Configuration reference](#configuration-reference)
- [`server`](#server)
Expand Down Expand Up @@ -124,6 +125,37 @@ SSH.connect((sessionText) => {
See [`test/live/simple.js`](./test/live/simple.js) for a runnable version that
appends messages and session text to a log file.

## Editor support

The package includes `index.d.ts`, so TypeScript projects get types without any
extra install step. The declarations describe the public API, the host object,
server options, event payloads, and handler signatures.

Plain JavaScript gets the same hover and completion information from JSDoc.
Annotate the module import and any host objects you want to document:

```javascript
/** @type {typeof import('ssh2shell')} */
const SSH2Shell = require('ssh2shell');

/** @type {import('ssh2shell').HostConfig} */
const host = {
server: { host: '192.168.0.10', userName: 'deploy' },
commands: ['pwd'],
};
```

The `HostConfig` annotation also gives contextual types to inline handlers such
as `onCommandProcessing`, including their `command`, `response`, `sshObj`, and
`stream` arguments. This is editor-only metadata; it does not change runtime
behaviour and does not add a TypeScript dependency to the package.

The README-linked live tests use the same annotations with a relative import
because they live inside this repository. See
[`test/live/simple.js`](./test/live/simple.js),
[`test/live/fingerprint.js`](./test/live/fingerprint.js), and
[`test/live/tunnel.js`](./test/live/tunnel.js) for examples.

## Core concepts

**The host object.** A host object has two required parts: `server` (how to
Expand Down
26 changes: 26 additions & 0 deletions REFACTORING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,32 @@ Pre-release cleanup of the instance and host-config surface. Released in
- `npm run test:src` — 166/166.
- `npm run test:baseline` — 158 pass, 8 baseline-skipped.

### L7.26 deliverables (editor type documentation)

Public editor support shipped in `v4.2.0`. Runtime behavior and the JavaScript
API are unchanged; this level adds metadata, documentation, and examples.

**Docs and declarations**

- Added a hand-maintained `index.d.ts` covering the constructor, public methods,
host and server configuration, handlers, events, and runtime state.
- Added `types` and the declaration file to the published package files, with
no TypeScript dependency or CI gate.
- Added JSDoc typedef aliases and `// @ts-check` in `src/`; `lib/` remains synced
through the normal build check.
- Added a concise README **Editor support** section and annotated the
README-linked live tests as consumer-facing examples.
- Added an AI-assisted workflow prompt for maintaining declarations and JSDoc.
- A release-candidate review restored the constructor's `Stream`/`EventEmitter`
options pass-through and corrected the `hostVerifier` and error-callback
declarations before tagging.

#### Verification

- `tsc` across sources and the annotated live tests — 0 errors.
- `npm test`, `npm run check:changelog`, `git diff --check`, and
`npm pack --dry-run` — passed.

## Backlog and future work

Items explicitly deferred until after the mechanical refactor. Each one changes
Expand Down
26 changes: 26 additions & 0 deletions docs/AI-ASSISTED-WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,32 @@ A change to <behavior> is ready. Keep README.md concise and put detail in docs/.
- Run npm run check:changelog and report what changed.
```

## Add or update TypeScript declarations and JSDoc

```text
You are adding editor/type support to ssh2shell. Start read-only.

- Treat index.d.ts as a hand-maintained public contract derived from runtime
code and documentation, not a generated artifact.
- Read README.md, docs/API-BASELINE.md, index.d.ts, package.json,
src/ssh2shell.js, src/ssh2shell/defaults.js, src/ssh2shell/util.js, and the
README-linked live tests before changing anything.
- Keep package.json `types` pointing at ./index.d.ts and keep index.d.ts in
`files`. Do not add a TypeScript runtime dependency, build step, or CI gate.
- Add JSDoc typedef aliases and `// @ts-check` in src/ where they improve the
public contract. Keep lib/ in sync with src/ through the repository's normal
build/check process.
- Use import('ssh2shell') in consumer-facing docs. Inside README-linked live
tests, use import('../../index') for module and HostConfig annotations so they
resolve locally.
- Keep JSDoc @type tags immediately above the declaration they describe.
- Verify with tsc against src/ and the annotated live tests, npm test,
git diff --check, and npm pack --dry-run when package metadata changed.
- Report the declared fields/signatures, docs that changed, and verification
results. Do not commit, push, open a PR, tag, publish, or release without
explicit approval. Docs/test-only editor support does not trigger a release.
```

## Decide whether a fix needs a release

```text
Expand Down
Loading