- Upgrade eslint 8.31 → 10.1 with new flat config (eslint.config.js)
- Upgrade @vercel/ncc 0.36 → 0.38.4
- Replace eslint-config-airbnb-base + eslint-plugin-import with @eslint/js + @stylistic/eslint-plugin
- Remove stale overrides in package.json (word-wrap, semver)
- Remove obsolete eslint-disable comments from source files
- Add { cause } to rethrown error in rsyncCli.js
- Add .gitignore and CLAUDE.md
- Resolves all 3 npm audit vulnerabilities (flatted, minimatch, js-yaml)
2.9 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
GitHub Action for deploying files via rsync over SSH, with optional remote script execution before/after deployment. Published as easingthemes/ssh-deploy on the GitHub Marketplace.
Commands
- Build (lint + bundle):
npm run build - Lint only:
npm run lint - Lint with autofix:
npm run lint:fix - No unit test suite — testing is done via e2e workflows in CI (Docker-based SSH server, see
.github/workflows/e2e.yml)
The build step runs ESLint then bundles src/index.js into dist/index.js using @vercel/ncc. The dist/index.js is the actual entrypoint executed by GitHub Actions (defined in action.yml).
Architecture
The action runs as a single Node.js 24 process with this execution flow:
-
src/inputs.js— Reads all config from environment variables (bothINPUT_*and bare names). ConvertsSNAKE_CASEinput names tocamelCase. Splits multi-value inputs:SOURCEandARGSon spaces,EXCLUDEandSSH_CMD_ARGSon commas. PrependsGITHUB_WORKSPACEto source paths. Exports a singleinputsobject used by all other modules. -
src/index.js— Orchestration entry point. Pipeline: validate inputs → write SSH key → optionally update known_hosts → run SCRIPT_BEFORE → rsync → run SCRIPT_AFTER. -
src/sshKey.js— Writes the SSH private key to~/.ssh/<deploy_key_name>with mode0400. Createsknown_hostsfile. Usesssh-keyscanto add the remote host when before/after scripts are configured. -
src/rsyncCli.js— Validates rsync is installed (auto-installs via apt-get if missing). Uses the localsrc/rsync.jsmodule (child_process.spawn) to execute the rsync transfer. -
src/remoteCmd.js— Writes script content to a temporary.shfile in the workspace, executes it on the remote host viassh ... 'bash -s' < script.sh, then deletes the local script file. PassesRSYNC_STDOUTenv var to after-scripts. -
src/helpers.js— File I/O utilities (writeToFile,deleteFile), input validation, andsnakeToCamelconverter.
Key Conventions
- CommonJS modules — the project uses
require/module.exports, not ES modules. - ESLint 10 flat config (
eslint.config.js) — uses@eslint/jsrecommended +@stylistic/eslint-pluginfor formatting. Notable rules: no trailing commas,consoleis allowed. - Semantic release on
mainbranch via.releaserc— use conventional commit messages (fix:,feat:, etc.). npm publish is disabled; releases are git tags + changelog only. dist/index.jsmust be committed — it's the bundled action entrypoint. Runnpm run buildand commit the updated dist after any source changes.- Inputs are environment variables, not
@actions/core— the action reads directly fromprocess.envrather than using the GitHub Actions toolkit.