save-my-process
v1.0.1
Published
Export/import your shell history, pip/npm package lists, and project files so you don't lose your session when the browser or sandbox closes.
Maintainers
Readme
save-my-process
Save your shell history, installed pip/npm packages, and project files to a single archive before your session (browser tab, sandbox, container) closes — and restore them later.
Works on Windows, macOS, Linux. No native dependencies.
Install
# as a CLI globally
npm install -g save-my-process
# or as a library in your project
npm install save-my-processCLI Usage
Export current session
save-my-process
# name? my-session
# zip? (yes/no) yes
# split? (yes/no) no
# → creates .my-session-export/my-session.zipOptions asked interactively:
- name — base name for output files (default
smp_<timestamp>) - zip — pack
export.jsoninto a.zip(recommended) - split — split output into ≤100MB parts (
_part_1_of_N) for environments with upload/download limits
Supports piped input (CI / scripting):
printf "my-session\nyes\nno\n" | save-my-processImport / Restore
save-my-process import my-session.zip
# or
save-my-process import export.jsonWhat restore does:
- appends saved bash history to
~/.bash_history - writes
requirements.txtnext to the export and runspip install -r - decodes and writes every captured project file back to disk
Split parts (
.part) must be reassembled first:cat my-session_part_*.zip.part > my-session.zip save-my-process import my-session.zip
Other
save-my-process --versionLibrary Usage
Use it programmatically in Node.js (ESM):
import { gatherExportData, packageExportData, importExportData } from 'save-my-process';
// 1. Gather
const exportData = gatherExportData({
cwd: '/path/to/project',
onProgress: (msg) => console.log(msg),
});
// exportData = { history, pipList, npmList, files: [{ path, content: base64 }] }
// 2. Package to disk
const files = await packageExportData({
exportData,
outDir: './my-backup',
baseName: 'my-session',
zip: true, // true → .zip, false → .json
split: false, // true → split into ≤100MB chunks
onProgress: console.log,
});
// files = [{ name, path }]
// 3. Restore later
importExportData({
jsonPath: './my-backup/export.json', // or extracted from zip
targetDir: '/where/to/restore',
onProgress: console.log,
});API
gatherExportData({ cwd?, onProgress? })
Scans ~/.bash_history, pip freeze, npm list, and all project files (skips node_modules, .git, venv, .next, dist). Returns { history, pipList, npmList, files }.
packageExportData({ exportData, outDir, baseName?, zip?, split?, onProgress? })
Writes export.json and optionally zips/splits it. Returns Promise<{ name, path }[]>.
importExportData({ jsonPath, targetDir?, onProgress? })
Restores history, pip packages, and files from an export.json.
Requirements
- Node.js
>=18 - Optional:
pip/pip3andnpmon PATH (gracefully skipped if missing)
Publishing (for maintainers)
npm login
npm view save-my-process # confirm name is available (currently free)
npm publish # or: npm publish --access publicIf the name is taken, publish under a scope:
{ "name": "@your-scope/save-my-process" }Then:
npm publish --access publicLicense
MIT — see LICENSE
