{"_id":"process-ancestry","_rev":"3-899c51bb83a2f44e1d8d8d791573859b","name":"process-ancestry","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"process-ancestry","version":"0.0.1","keywords":["process","ancestry","pid","parent","cross-platform","unix","linux","macos","windows","process-tree"],"author":{"name":"Matt Kane"},"license":"MIT","_id":"process-ancestry@0.0.1","maintainers":[{"name":"ascorbic","email":"m@mk.gg"}],"homepage":"https://github.com/ascorbic/process-ancestry","bugs":{"url":"https://github.com/ascorbic/process-ancestry/issues"},"dist":{"shasum":"75494640c98035ce2605c5b58f7e5edd2e0e209a","tarball":"https://registry.npmjs.org/process-ancestry/-/process-ancestry-0.0.1.tgz","fileCount":4,"integrity":"sha512-HnZ1kXghaJ4b8FkKJbmDaVNUQdHMHamEwOEc9N7pIRN4gXJ3TWPfYEE91oLs23+/EkcsIs6CVDnk3ZOGohrjlA==","signatures":[{"sig":"MEYCIQCNfUS3WYHRHA/chJstP6g4OnXFf3J3Z/6VbzmmyyNpLAIhAONj6YPyhFDMxyrg+46AS04d9PlF7sujxHqEOtQKe+aP","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8919},"main":"dist/index.js","type":"module","_from":"file:process-ancestry-0.0.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":"./dist/index.js"},"scripts":{"dev":"tsup src/index.ts --format esm --dts --watch","test":"vitest run","build":"tsup src/index.ts --format esm --dts --clean","check":"publint && attw --pack . --ignore-rules=cjs-resolves-to-esm"},"_npmUser":{"name":"ascorbic","email":"m@mk.gg"},"_resolved":"/tmp/9bca9cffc33c59e2cb14ccc372e62fc2/process-ancestry-0.0.1.tgz","_integrity":"sha512-HnZ1kXghaJ4b8FkKJbmDaVNUQdHMHamEwOEc9N7pIRN4gXJ3TWPfYEE91oLs23+/EkcsIs6CVDnk3ZOGohrjlA==","repository":{"url":"git+https://github.com/ascorbic/process-ancestry.git","type":"git","directory":"packages/process-ancestry"},"_npmVersion":"11.4.2","description":"Cross-platform Node.js library for retrieving process ancestry information on Unix/Linux, macOS, and Windows","directories":{},"_nodeVersion":"24.4.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","publint":"^0.3.12","typescript":"^5.8.3","@types/node":"^22.16.4","@types/feedparser":"^2.2.8","@arethetypeswrong/cli":"^0.18.2"},"_npmOperationalInternal":{"tmp":"tmp/process-ancestry_0.0.1_1752769570339_0.5301403505577207","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"process-ancestry","version":"0.0.2","keywords":["process","ancestry","pid","parent","cross-platform","unix","linux","macos","windows","process-tree"],"author":{"name":"Matt Kane"},"license":"MIT","_id":"process-ancestry@0.0.2","maintainers":[{"name":"ascorbic","email":"m@mk.gg"}],"homepage":"https://github.com/ascorbic/process-ancestry","bugs":{"url":"https://github.com/ascorbic/process-ancestry/issues"},"dist":{"shasum":"48df4d2c2a6e170abc4bca251c3b0169da278efa","tarball":"https://registry.npmjs.org/process-ancestry/-/process-ancestry-0.0.2.tgz","fileCount":4,"integrity":"sha512-JNHcMt3+iqEXTD5bS/Hxeo3JnIX0WL7tzvW23lPmG9N0VnUGVV0kPjam2ailnTZ72jSc87qn5jqLoZKvzq0Szw==","signatures":[{"sig":"MEYCIQCQDR6fK67Tck0PtVrSFwuCfCH0AAAemKMZrS+6MoUCZQIhAN+HOhxLtA90SoOjTBtgfRpq3Zy06TJKZZ+V25P/yhqf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7395},"main":"dist/index.js","type":"module","_from":"file:process-ancestry-0.0.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":"./dist/index.js"},"scripts":{"dev":"tsup src/index.ts --format esm --dts --watch","test":"vitest run","build":"tsup src/index.ts --format esm --dts --clean","check":"publint && attw --pack . --ignore-rules=cjs-resolves-to-esm"},"_npmUser":{"name":"ascorbic","email":"m@mk.gg"},"_resolved":"/tmp/3e4715bc4c86555f33286ed0e9e66218/process-ancestry-0.0.2.tgz","_integrity":"sha512-JNHcMt3+iqEXTD5bS/Hxeo3JnIX0WL7tzvW23lPmG9N0VnUGVV0kPjam2ailnTZ72jSc87qn5jqLoZKvzq0Szw==","repository":{"url":"git+https://github.com/ascorbic/process-ancestry.git","type":"git","directory":"packages/process-ancestry"},"_npmVersion":"11.4.2","description":"Cross-platform Node.js library for retrieving process ancestry information on Unix/Linux, macOS, and Windows","directories":{},"_nodeVersion":"24.4.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","publint":"^0.3.12","typescript":"^5.8.3","@types/node":"^22.16.4","@types/feedparser":"^2.2.8","@arethetypeswrong/cli":"^0.18.2"},"_npmOperationalInternal":{"tmp":"tmp/process-ancestry_0.0.2_1752776312525_0.8832251099923656","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"process-ancestry","version":"0.1.0","description":"Cross-platform Node.js library for retrieving process ancestry information on Unix/Linux, macOS, and Windows","type":"module","main":"dist/index.js","exports":{".":"./dist/index.js"},"devDependencies":{"@arethetypeswrong/cli":"^0.18.2","@types/feedparser":"^2.2.8","@types/node":"^22.16.4","publint":"^0.3.12","tsup":"^8.5.0","typescript":"^5.8.3"},"repository":{"type":"git","url":"git+https://github.com/ascorbic/process-ancestry.git","directory":"packages/process-ancestry"},"homepage":"https://github.com/ascorbic/process-ancestry","keywords":["process","ancestry","pid","parent","cross-platform","unix","linux","macos","windows","process-tree"],"author":{"name":"Matt Kane"},"license":"MIT","engines":{"node":">=18.0.0"},"scripts":{"build":"tsup src/index.ts --format esm --dts --clean","dev":"tsup src/index.ts --format esm --dts --watch","check":"publint && attw --pack . --ignore-rules=cjs-resolves-to-esm","test":"vitest run"},"types":"./dist/index.d.ts","_id":"process-ancestry@0.1.0","bugs":{"url":"https://github.com/ascorbic/process-ancestry/issues"},"_integrity":"sha512-tGqJW/UnclpYASFcM6Xh8D8l/BMtaQ9+CSG0vlJSJTcdMM4lDRv4c6H0Pdcsfted+bVczdYSfk2fdukg2gQkZg==","_resolved":"/tmp/4df91be1659898feed29dba6d09ec185/process-ancestry-0.1.0.tgz","_from":"file:process-ancestry-0.1.0.tgz","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-tGqJW/UnclpYASFcM6Xh8D8l/BMtaQ9+CSG0vlJSJTcdMM4lDRv4c6H0Pdcsfted+bVczdYSfk2fdukg2gQkZg==","shasum":"06a18bb06c413d827502190458fc7604ee6b3ded","tarball":"https://registry.npmjs.org/process-ancestry/-/process-ancestry-0.1.0.tgz","fileCount":4,"unpackedSize":7413,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDmcc0+ld/beGQ26QYz+To+CPYupVScpgg1u+2ccBQA8AIhAPM/lykdlbsE7+o62ShOIQBY4QAYx+SrHPe4b+aVKbat"}]},"_npmUser":{"name":"ascorbic","email":"m@mk.gg"},"directories":{},"maintainers":[{"name":"ascorbic","email":"m@mk.gg"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/process-ancestry_0.1.0_1764851444149_0.7527736070420803"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-17T16:26:10.171Z","modified":"2025-12-04T12:30:44.512Z","0.0.1":"2025-07-17T16:26:10.532Z","0.0.2":"2025-07-17T18:18:32.689Z","0.1.0":"2025-12-04T12:30:44.299Z"},"bugs":{"url":"https://github.com/ascorbic/process-ancestry/issues"},"author":{"name":"Matt Kane"},"license":"MIT","homepage":"https://github.com/ascorbic/process-ancestry","keywords":["process","ancestry","pid","parent","cross-platform","unix","linux","macos","windows","process-tree"],"repository":{"type":"git","url":"git+https://github.com/ascorbic/process-ancestry.git","directory":"packages/process-ancestry"},"description":"Cross-platform Node.js library for retrieving process ancestry information on Unix/Linux, macOS, and Windows","maintainers":[{"name":"ascorbic","email":"m@mk.gg"}],"readme":"# process-ancestry\n\nA cross-platform Node.js library for retrieving process ancestry information. Get the parent process chain for any process ID on Unix/Linux, macOS, and Windows systems.\n\n## Features\n\n- **Cross-platform**: Works on Unix/Linux/macOS (using `ps`) and Windows (using `wmic`)\n- **Robust**: Includes timeout handling, cycle detection, and comprehensive error handling\n- **TypeScript**: Full TypeScript support with type definitions\n- **Zero dependencies**: No external dependencies beyond Node.js built-ins\n- **ESM**: Native ES module support\n\n## Installation\n\n```bash\nnpm install process-ancestry\n```\n\n## Usage\n\n### Basic Usage\n\n```javascript\nimport { getProcessAncestry } from \"process-ancestry\";\n\n// Get ancestry for current process\nconst ancestry = getProcessAncestry();\nconsole.log(ancestry);\n\n// Get ancestry for specific PID\nconst ancestry = getProcessAncestry(1234);\nconsole.log(ancestry);\n```\n\n### Example Output\n\n```javascript\n[\n  {\n    pid: 1234,\n    ppid: 5678,\n    command: \"node script.js\",\n  },\n  {\n    pid: 5678,\n    ppid: 1,\n    command: \"bash\",\n  },\n];\n```\n\n## API Reference\n\n### `getProcessAncestry(pid?: number): ProcessInfo[]`\n\nRetrieves the process ancestry chain for a given process ID.\n\n#### Parameters\n\n- `pid` (optional): Process ID to get ancestry for. Defaults to `process.pid` (current process).\n\n#### Returns\n\nAn array of `ProcessInfo` objects representing the process ancestry chain, ordered from the given process up to the root.\n\n#### Throws\n\n- `Error`: If `pid` is not a positive integer\n\n### `ProcessInfo`\n\n```typescript\ninterface ProcessInfo {\n  /** Process ID */\n  pid: number;\n  /** Parent Process ID */\n  ppid: number;\n  /** Command line or executable name */\n  command?: string;\n}\n```\n\n## Platform Support\n\n- **Unix/Linux/macOS**: Uses `ps -p <pid> -o pid=,ppid=,command=`\n- **Windows**: Uses `wmic process where (ProcessId=<pid>) get ProcessId,ParentProcessId,CommandLine /format:csv`\n\n## Development\n\n```bash\n# Install dependencies\npnpm install\n\n# Run tests\npnpm test\n\n# Build\npnpm build\n\n# Run checks\npnpm check\n```\n\n## License\n\nMIT\n\n## Author\n\nMatt Kane\n","readmeFilename":"README.md"}