{"id":21131283,"url":"https://github.com/jrop/autoterm","last_synced_at":"2026-04-27T17:04:06.683Z","repository":{"id":57187665,"uuid":"76903738","full_name":"jrop/autoterm","owner":"jrop","description":"Automate interactive terminal sessions with JavaScript","archived":false,"fork":false,"pushed_at":"2017-09-01T17:31:37.000Z","size":13,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T10:49:05.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/autoterm","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jrop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-19T22:53:48.000Z","updated_at":"2016-12-20T16:48:04.000Z","dependencies_parsed_at":"2022-08-28T13:00:30.443Z","dependency_job_id":null,"html_url":"https://github.com/jrop/autoterm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Fautoterm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Fautoterm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Fautoterm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrop%2Fautoterm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jrop","download_url":"https://codeload.github.com/jrop/autoterm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243021776,"owners_count":20223068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T05:52:52.285Z","updated_at":"2025-12-29T17:17:24.025Z","avatar_url":"https://github.com/jrop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# autoterm\n\nAutomate interactive terminal sessions with JavaScript\n\n## Installation\n\n```js\nnpm install autoterm\n```\n\n## Usage\n\nCreate a script:\n\n```js\n// task-runner.js\n#!/usr/bin/env node\n'use strict'\nconst autoterm = require('autoterm')\nconst t = autoterm({shell: 'sh', prompt: /\\$\\s+$/, echo: true})\n\nasync function runner() {\n\tawait t.run('ls')\n\tawait t.run('exit')\n}\nrunner()\n```\n\nThen run your script:\n\n```sh\n$ node ./task-runner.js\n```\n\nIt's that easy!\n\nIf you need to change the prompt recognition regular expression temporarily, use:\n\n```js\nawait t.push(/new-prompt-recoginzer-regex\u003e $/).run('ssh ...')\n// ...\nawait t.pop().run('exit') // go back to old prompt recognizer\n```\n\nThis is useful for if you SSH into a server that has a different prompt than the computer `autoterm` starts executing commands on.\n\nIf you need to disconnect stdin from a running TTY, just call `kbd(false)`.  You can later turn it back on with `kbd(true)`.  This is useful if you want to automate two different terminals at once, and choose which one to send keyboard data to.\n\n## API\n\n```js\nkbd(pipeKeyboardToTTY: boolean)\nrun(cmd: string, prompt?: string|RegExp): Promise\u003cstring\u003e\npush(prompt: string|RegExp)\npop()\n```\n\n## License\nISC License (ISC)\nCopyright (c) 2016, Jonathan Apodaca \u003cjrapodaca@gmail.com\u003e\n\nPermission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrop%2Fautoterm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjrop%2Fautoterm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrop%2Fautoterm/lists"}