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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Why

<!-- The problem this solves or the behaviour it changes. -->
<!-- The problem this solves or the behavior it changes. -->

## How it was tested

Expand Down
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ Releases before `4.0.0` are recorded as git tags and GitHub Releases.
the standard host prefix and credential redaction. The internal `_systemMsg`
name is replaced; the frozen baseline keeps it for comparison tests.

### Fixed

- Applied four fixes from the release-candidate review: a graceful-close timer
no longer survives a primary-host transition, debug/verbose overrides are
reapplied when an ancestor is restored and when an override is cleared,
and class instances with credential-named properties are redacted in verbose
config dumps. A follow-up review tightened the latter two: restored flags
come from the host config rather than a cached effective value, nested
credentials and cycles on class instances are redacted too, and clearing an
override preserves the host's configured value.

### Development

- Added live coverage for keyboard-interactive authentication on a nested hop
Expand All @@ -32,10 +43,13 @@ Releases before `4.0.0` are recorded as git tags and GitHub Releases.
other, so a parallel publish or push cannot remove a PR's required
`Live suite` check.
- Added a second round of unit tests for transport and state guards, host
traversal, shutdown flows, and behaviour hardening, plus two live tests for
traversal, shutdown flows, and behavior hardening, plus two live tests for
the default command timeout and the TTY progress indicator. `test/coverage.md`
records the local coverage review and full miss-overlap analysis (98.12%
records the local coverage review and full miss-overlap analysis (98.15%
combined line coverage).
- Added `docs/AI-ASSISTED-WORKFLOWS.md` with reusable prompts and approval
boundaries for AI-assisted session setup, releases, reviews, and coverage
refreshes.

## [4.0.4] - 2026-11-18

Expand Down
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ documents the environment and the curated batch.
- Branch from `master`. `master` requires a pull request, the CI matrix, and the
live suite, so direct pushes are rejected.
- Keep the change focused, and update `README.md`, `docs/`, and `CHANGELOG.md`
when behaviour changes.
when behavior changes.
- Use `npm run test:live` for connection, command-flow, and hop changes. Run
`npm run test:live:all` before a release.
- The release process is in [docs/PUBLISHING.md](./docs/PUBLISHING.md).

## AI-assisted work

Reusable prompts and the boundaries that apply to AI assistants are in
[docs/AI-ASSISTED-WORKFLOWS.md](./docs/AI-ASSISTED-WORKFLOWS.md). The approval
and release rules in that document apply to human contributors too.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ const host = {
return;
}

// Fall back to the default behaviour: record the response and close.
// Fall back to the default behavior: record the response and close.
this.emit(
'error',
`${this.sshObj.server.host}: Command timed out after ${this.idleTime / 1000} seconds`,
Expand Down
8 changes: 4 additions & 4 deletions REFACTORING.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ Signed-off-by: user review of the backlog, before further error-handling work.
### L6.1 deliverables (approved optimisation and robustness follow-ups)

Signed-off-by: user selection of the optimisation review's "safe set + approved
behaviour fixes" option.
behavior fixes" option.

#### Behaviour-neutral cleanups
#### behavior-neutral cleanups

- `src/ssh2shell.js` — top-of-file and `_systemMsg` comments now describe the
current build instead of the L1 baseline; removed the orphaned numbered
Expand All @@ -434,7 +434,7 @@ behaviour fixes" option.
`lib/` matches `src/`; `npm test` runs it before the suites, so a stale build
cannot silently pass.

#### Behaviour fixes (signed off)
#### behavior fixes (signed off)

- `src/ssh2shell.js` — post-auth `_processSSHPrompt` output that matches no
prompt now re-arms the idle timer instead of returning with no timer. A silent
Expand Down Expand Up @@ -539,7 +539,7 @@ were after L6.1.
API, advanced usage, troubleshooting, security, and development.
- Replaced the inline configuration block with per-section tables for `server`,
commands, prompts/filters, timeouts, messages, and host handlers.
- Corrected defaults and behaviour: `textColorFilter` is
- Corrected defaults and behavior: `textColorFilter` is
`\\x1b\\[[0-9;]*m`; `asciiFilter` is `[^\r\n\x20-\x7e]` and the compiled
default preserves tabs; `window`/`pty` are `true` and explicit `false`
survives; `idleTimeOut`/`dataIdleTimeOut` are distinguished.
Expand Down
239 changes: 239 additions & 0 deletions docs/AI-ASSISTED-WORKFLOWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# AI-assisted workflows

This file holds reusable prompts for common ssh2shell tasks. They are written
for an AI assistant with repository access. Each prompt points to the canonical
documents for detail and repeats only the boundaries that must hold while the
assistant is working.

Copy a prompt into a new session, fill the placeholders, and keep the assistant
read-only until you approve an action. Point-in-time state notes belong outside
the repository; only stable prompts that are useful to any contributor belong
here.

## Guardrails for every task

Apply these whether or not a prompt repeats them:

- No commit, push, PR, tag, or publish without explicit user approval.
- Docs live in git. `README.md` stays concise; detail belongs in `docs/`.
- Coverage is diagnostic, not a release gate. No coverage dependency and no CI
coverage gate.
- Live tests count in CI. `publish` must not run unless the live suite passes.
- An external/free review of the release candidate is a release step; resolve
its actionable findings before tagging, with user sign-off on every change.
LongCat specifically is informational and quota-dependent, not a gate.
- Never dismiss a real CodeQL alert; fix the code.
- Merge continuously; no same-day follow-up release unless the fix is critical.
- Release only for a security/critical fix, user-facing bug fix, new feature,
or explicit milestone. Docs/test/CI-only changes do not trigger a release.
- Before a task that depends on remote services, live hosts, or free models,
run the environmental assessment below first.

## Start or recover a session

```text
You are working in the ssh2shell repository. Start read-only.

1. Read README.md, CONTRIBUTING.md, docs/PUBLISHING.md, test/coverage.md, and
docs/AI-ASSISTED-WORKFLOWS.md.
2. Report git status --short, the current branch, and the latest commit.
3. Summarise which document is the source of truth for the requested task.
4. Do not commit, push, tag, or publish. Ask before any action that changes
the working tree or remote state.
```

## Set up the environment

```text
You are preparing to work on ssh2shell. Start read-only.

- Confirm Node.js 18 or newer is available.
- Run npm ci, then npm test.
- Live tests need reachable SSH hosts and a local .env. Copy .env-example to
.env and follow test/README.md for host and key setup.
- Provisioning uses its own test/provision/.env (PROVISION_* variables); see
test/provision/README.md. Check VM availability before either workflow.
- Report the Node version, the test result, and whether live tests can run here.
Do not change .env, change VM power state, or provision hosts without
approval.
```

## Assess environmental limitations

```text
Run this before any other prompt that depends on remote services, live hosts,
or free models. Start read-only. Do not change .env, install packages, provision
hosts, alter CI or configuration, or take any remote action without approval.

Check and record evidence for:

1. Toolchain: node, npm, git, and gh versions. Compare them with the versions
the repository expects (CONTRIBUTING.md and .github/workflows/).
2. GitHub access: gh auth status and its token scopes, plus SSH auth to the git
remote. Note any missing scope that would block PRs, releases, or workflow
file edits via the API.
3. npm access: npm whoami and whether an auth token is configured. Publishing
uses GitHub OIDC trusted publishing, so a local token is not required. If
the trusted-publisher configuration on npmjs.com cannot be verified from
here, say so explicitly rather than assuming it works.
4. Live configuration: whether the root .env has the expected host/key
variables for live tests, and whether test/provision/.env has the
PROVISION_* variables for the role being rebuilt. List names only, never
values.
5. VM accessibility: probe SSH to the configured hosts (read-only) and, if a
hypervisor CLI such as VirtualBox VBoxManage is available, list VMs and
running VMs. Report which VMs are up and whether this machine can control
them. Starting, stopping, or provisioning a VM needs explicit approval. If
no control tooling exists, say VM availability is user-dependent and ask
the user to confirm the VMs are running. CI starts its own sshd hosts and
skips the live workflow for fork PRs.
6. Models: which free models are currently available and whether quotas are
exhausted. LongCat is informational only and may be unavailable.
7. Local resources: temp directory, free disk, timezone, and anything else the
planned commands need.

Report a table with columns: capability, evidence, affected prompt(s), impact,
mitigation. Finish by stating which prompts are safe to run here and which need
a decision first. Ask before substituting a model, changing configuration, or
taking a remote action.
```

## Verify before a pull request

```text
Run the full pre-PR verification for ssh2shell and report results only.

1. npm test (build check, unit, and baseline)
2. npm run test:live:all, or npm run test:live if told the change is local-only;
say which set ran
3. npm run check:changelog
4. git diff --check
5. If code or tests changed, prepare the coverage summary from test/coverage.md:
the text table, full miss-overlap table, missed by both headline, Node
version, and commands. Keep raw LCOV files local.

Do not commit, push, or open the PR without explicit approval.
```

## Add a live test

```text
I am adding a live test <name> for <behavior>. Follow test/README.md.

- Put the file in test/live/.
- Add per-test success checks in scripts/run-live.js where needed.
- Add the name to defaultTests only if it belongs in the curated batch;
acceptance tests for a specific change can stay out.
- Verify with node scripts/run-live.js --list, then run the new test by name,
then npm run test:live:all.
- Report whether it was added to the curated batch and why.
```

## Respond to a CodeQL or security alert

```text
A CodeQL/security alert was reported for ssh2shell. Do not dismiss it.

- Read the alert and locate the exact source line.
- Fix the code, not the alert configuration or a suppression.
- Add or update a test that would fail without the fix where practical.
- Re-run the relevant checks and report the result.
- Ask before changing CI or dependency configuration.
```

## Document a behavior change

```text
A change to <behavior> is ready. Keep README.md concise and put detail in docs/.

- Identify what changed for users.
- Update the relevant docs/ page and add a CHANGELOG entry under the correct
version heading.
- If the release procedure is affected, update docs/PUBLISHING.md too.
- Run npm run check:changelog and report what changed.
```

## Decide whether a fix needs a release

```text
Assess whether <change> requires a release now. Follow docs/PUBLISHING.md.

A release is triggered only by a security/critical fix, a user-facing bug fix,
a new feature, or an explicit milestone. Docs/test/CI-only changes do not
trigger one.

- Classify the change and state the reason.
- If a release is due, state the target version and bump type.
- If not, say it can wait for the next release.
- Apply the cadence rule: no same-day follow-up release unless the fix is
critical.
- Do not bump versions, tag, or publish. Report the recommendation only.
```

## Prepare a release

```text
We are preparing release <version> of ssh2shell. Follow docs/PUBLISHING.md.

- Confirm the bump has an allowed reason: security/critical fix, user-facing
bug fix, new feature, or explicit milestone. Docs/test/CI-only changes do not
trigger a release.
- Run npm test, npm run test:live:all, npm run check:changelog, and
git diff --check.
- Open a release PR from release/<version> to master. Include the coverage
summary from test/coverage.md: the text table, the full miss-overlap table,
missed by both as the residual headline, the Node version, and the commands.
Leave raw LCOV files local.
- Stop after the PR is opened. Report the URL and check status. Do not tag or
publish without a separate explicit approval.
```

## Review a release candidate

```text
Review the release candidate read-only. Do not modify files, commit, push,
tag, or publish.

- Candidate: <commit or PR>. Base: <commit>.
- Diff: git diff <base> <candidate> -- src lib test docs README.md CHANGELOG.md
- Focus on src/ssh2shell.js and src/ssh2shell/util.js; tests and docs are
secondary.
- Report findings by severity with file:line and a concrete failure scenario.
State "No findings" explicitly if there are none. Skip style nits.
- Return only the report. Any fix needs explicit user sign-off first.
```

Use a free model from the currently available model list. This is the RC review
required by docs/PUBLISHING.md: report actionable findings and wait for user
sign-off before changing code. A LongCat pass, when available, is informational
only; account-wide free quotas can make it unavailable.

## Refresh coverage evidence

```text
Refresh the coverage evidence for ssh2shell using test/coverage.md as the method.

- Run the unit and live commands from "Measurement method" with the LCOV
reporters enabled. The live command runs every file in test/live/, matching
npm run test:live:all and CI. Do not use NODE_V8_COVERAGE on the live suite.
- Recompute the miss-overlap table with the appendix parser in test/coverage.md.
Keep the full table and use missed by both as the residual-risk headline.
- Update test/coverage.md and include the summary in the PR description or a
PR comment. Raw LCOV files stay local.
- Never add a coverage dependency or a CI coverage gate. Coverage is
informational; the gates are CI checks, the live suite, and RC review.
```

## Hand off a session

```text
Produce a handoff note for a replacement AI session. Keep it factual and
time-stamped, and do not store it in git.

Include:
- branch, base, and uncommitted changes;
- open PR number and check status;
- what was approved, what is paused, and the next gate;
- which docs and commands are authoritative;
- anything a new session would otherwise have to rediscover.
```
4 changes: 2 additions & 2 deletions docs/MIGRATING-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Consequences worth checking:
- Each hop verifies its own host key. Set `hostHash` / `hostVerifier` on a
nested host if the primary pins its key.

## Behaviour changes that look like bugs
## behavior changes that look like bugs

- **A silent command times out.** The idle timer is armed when a command is
written, not after the first output, and there is no longer an opt-in flag.
Expand Down Expand Up @@ -191,5 +191,5 @@ rather than staying on 3.x silently.
breaking-change list.
- [Host-to-host connections](./NEXT-HOST-CONNECTION.md) — the hop design and
the full `server.ssh` mapping.
- [Error handling](./ERROR-HANDLING.md) — `error` payloads and close behaviour.
- [Error handling](./ERROR-HANDLING.md) — `error` payloads and close behavior.
- [README](../README.md) — current host, command, and tunnelling usage.
Loading