{"_id":"@berryn/project-inspect","_rev":"3-bab753f3f39a9d8578e7a801a0c1f950","name":"@berryn/project-inspect","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@berryn/project-inspect","version":"0.1.0","author":"Berryn Core Engineering Team","license":"MIT","_id":"@berryn/project-inspect@0.1.0","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"homepage":"https://github.com/Grevix/berryn","bugs":{"url":"https://github.com/Grevix/berryn/issues"},"dist":{"shasum":"c9de21fbfddb74f8674a1fa893cbf69dfa1ac01d","tarball":"https://registry.npmjs.org/@berryn/project-inspect/-/project-inspect-0.1.0.tgz","fileCount":22,"integrity":"sha512-GxNJJm6mFEeDuf6YrrPtu++dQrSe4SCocPNRPeBp8AOFNymAMhvhd/qowJOCfHuKGcaQ/u57Cma7vzS7nrtePw==","signatures":[{"sig":"MEYCIQC/Xwqtpb7NOMaXWB8uMMCJRSVppIEt0jyNAEX8uFpLQAIhAPuHRM6brH42vsRF8uEr5ksy16HQvIFhf/ahwLZbV72U","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27980},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"scripts":{"build":"tsc --build","clean":"rimraf dist"},"_npmUser":{"name":"aaryan28","email":"aaryan28rwt@gmail.com"},"repository":{"url":"https://github.com/Grevix/berryn.git","type":"git"},"description":"Berryn Project Inspection — AST import scanner, package manifest parser, and call expression catalog","directories":{},"_nodeVersion":"24.14.0","dependencies":{"typescript":"^5.7.2","@berryn/core":"0.1.0","@berryn/security":"0.1.0","@berryn/diagnostics":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/project-inspect_0.1.0_1787000853619_0.7148584825073296","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@berryn/project-inspect","version":"0.2.0","author":{"name":"Berryn Core Engineering Team"},"license":"MIT","_id":"@berryn/project-inspect@0.2.0","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"homepage":"https://github.com/Grevix/berryn#readme","bugs":{"url":"https://github.com/Grevix/berryn/issues"},"dist":{"shasum":"1c16874096b24a33936d82c0aadaf42082e72990","tarball":"https://registry.npmjs.org/@berryn/project-inspect/-/project-inspect-0.2.0.tgz","fileCount":18,"integrity":"sha512-4imleiGDAmrgDE6SoQOukYgEYq0+WOXaC3+W6ve5pT3zbDpb2xii2kFtgk+RlMFYsi18OAl9XmRpeddW+nO7qA==","signatures":[{"sig":"MEYCIQCcmsaHgkw+ocX/Tamsc/MmDcs0/nw39Arvhe19+L5h/QIhALawxLVZFHmnDFqq+a6+QtASYG/WMRRF0lmGWcM561rv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDH3UtKC9nj4empsy/fVUmD1G81qH4pFQsyPZ06yDgN8AIhAJ2gWCQk4gxX004Clv6EQLuXd3D6WLiSQqC4SGZBRU0c","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26748},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"fc466500ff83c2753bb41429713719eacd7895d4","scripts":{"build":"tsc --build","clean":"rimraf dist"},"_npmUser":{"name":"aaryan28","email":"aaryan28rwt@gmail.com"},"repository":{"url":"git+https://github.com/Grevix/berryn.git","type":"git"},"_npmVersion":"11.9.0","description":"Berryn Project Inspection — AST import scanner, package manifest parser, and call expression catalog","directories":{},"_nodeVersion":"24.14.0","dependencies":{"typescript":"^5.7.2","@berryn/core":"workspace:*","@berryn/security":"workspace:*","@berryn/diagnostics":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/project-inspect_0.2.0_1788160300545_0.07100972857047805","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"_id":"@berryn/project-inspect@0.2.1","bugs":{"url":"https://github.com/Grevix/berryn/issues"},"dist":{"shasum":"11d5bab17d23045c6b2669d92e50fff76f3e074b","tarball":"https://registry.npmjs.org/@berryn/project-inspect/-/project-inspect-0.2.1.tgz","fileCount":18,"integrity":"sha512-juySnpdM6yAj56RGHGi+3mNW064tmlF6TSjq3aizfX5AjKM7Qw8Jt9C0VCjI7cG+k9mS14Bn5uE0FpwFIBLCEQ==","signatures":[{"sig":"MEUCIBJr4usym6EHQ5OAsGMnt343x1UQRx0FtvtNf7uUPFaNAiEAm8qp+fBcxc3S4Q4yOoAlijPCG7Rve5p/WTiVehBLnG0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID6ykegAKKR+S18N5/kGs8lYq0Azx8qRRKq7okf36MZeAiEA8aQOJBSviL3Eca8yQJ88MRGjvLUUHz3WWQ8r4WiwjL8="}],"unpackedSize":26730},"main":"./dist/index.js","name":"@berryn/project-inspect","type":"module","types":"./dist/index.d.ts","author":{"name":"Berryn Core Engineering Team"},"engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"gitHead":"576fa2934836ad4f045966f8a86d99490cbea05b","license":"MIT","scripts":{"build":"tsc --build","clean":"rimraf dist"},"version":"0.2.1","_npmUser":{"name":"aaryan28","email":"aaryan28rwt@gmail.com"},"homepage":"https://github.com/Grevix/berryn#readme","repository":{"url":"git+https://github.com/Grevix/berryn.git","type":"git"},"_npmVersion":"11.9.0","description":"Berryn Project Inspection — AST import scanner, package manifest parser, and call expression catalog","directories":{},"maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"_nodeVersion":"24.14.0","dependencies":{"typescript":"^5.7.2","@berryn/core":"0.2.1","@berryn/security":"0.2.1","@berryn/diagnostics":"0.2.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/project-inspect_0.2.1_1788165847387_0.6231298371434539"}}},"time":{"created":"2026-08-17T21:07:33.402Z","modified":"2026-08-31T08:44:07.695Z","0.1.0":"2026-08-17T21:07:33.769Z","0.2.0":"2026-08-31T07:11:40.640Z","0.2.1":"2026-08-31T08:44:07.465Z"},"bugs":{"url":"https://github.com/Grevix/berryn/issues"},"author":{"name":"Berryn Core Engineering Team"},"license":"MIT","homepage":"https://github.com/Grevix/berryn#readme","repository":{"url":"git+https://github.com/Grevix/berryn.git","type":"git"},"description":"Berryn Project Inspection — AST import scanner, package manifest parser, and call expression catalog","maintainers":[{"name":"aaryan28","email":"aaryan28rwt@gmail.com"}],"readme":"# @berryn/project-inspect\n\n> **Package manifest inspector and `ts-morph` AST static import scanner.**\n\n[![npm version](https://img.shields.io/npm/v/@berryn/project-inspect.svg)](https://www.npmjs.com/package/@berryn/project-inspect)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg)](https://nodejs.org)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.7%2B-blue.svg)](https://www.typescriptlang.org/)\n\n---\n\n## Overview\n\n`@berryn/project-inspect` statically analyzes application source trees and repository configuration without executing untrusted code. It detects incumbent libraries (`exceljs`, `xlsx`, `fluent-ffmpeg`), determines the active package manager (npm, pnpm, yarn, bun), and parses TypeScript/JavaScript ASTs to identify exact call sites, imported symbols, and usage patterns.\n\nStatic analysis eliminates runtime side-effects and provides the prerequisite dependency graph needed to plan safe codemods.\n\n---\n\n## Installation\n\n```bash\n# Using pnpm\npnpm add @berryn/project-inspect\n\n# Using npm\nnpm install @berryn/project-inspect\n```\n\n---\n\n## Key Features\n\n- **Manifest Parsing (`inspectPackageManifest`)**: Scans `package.json` and lockfiles (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb`) to extract dependency versions and incumbent footprints.\n- **Static AST Scanner (`scanSourceFileAst`)**: Leverages TypeScript compiler APIs and `ts-morph` to extract ESM imports, CommonJS `require()` calls, and member invocations.\n- **Aggregated Project Graph (`inspectProject`)**: Combines manifest metadata and source-level call-site occurrences into a unified inspection structure.\n- **Safety First**: Runs within the `@berryn/security` sandbox with zero code evaluation (`eval` / dynamic module execution).\n\n---\n\n## Usage Examples\n\n### 1. Inspecting a Project Manifest\n\n```typescript\nimport { inspectPackageManifest } from '@berryn/project-inspect';\n\nconst { manifest, diagnostics } = inspectPackageManifest('/workspace/my-project');\n\nconsole.log(`Package Name: ${manifest.name}`);\nconsole.log(`Package Manager: ${manifest.packageManager}`);\nconsole.log(`Incumbent Detected:`, manifest.incumbentsFound);\n// e.g. { exceljs: '^4.4.0' }\n```\n\n---\n\n### 2. Scanning Source File AST for Incumbent Usage\n\n```typescript\nimport { scanSourceFileAst } from '@berryn/project-inspect';\n\nconst { imports, calls, diagnostics } = scanSourceFileAst('/workspace/my-project/src/export.ts');\n\nfor (const imp of imports) {\n  console.log(`Import at line ${imp.line}: ${imp.packageName} -> [${imp.importedSymbols.join(', ')}]`);\n}\n\nfor (const call of calls) {\n  console.log(`API call at line ${call.line}: ${call.expressionText} (method: ${call.methodName})`);\n}\n```\n\n---\n\n### 3. Full Project Inspection\n\n```typescript\nimport { inspectProject } from '@berryn/project-inspect';\n\nconst sourceFiles = [\n  '/workspace/my-project/src/index.ts',\n  '/workspace/my-project/src/reports.ts'\n];\n\nconst { value: projectReport, diagnostics } = inspectProject('/workspace/my-project', sourceFiles);\n\nconsole.log(`Scanned ${projectReport.totalSourceFilesScanned} files.`);\nconsole.log(`Found ${projectReport.imports.length} imports and ${projectReport.apiCalls.length} API calls.`);\n```\n\n---\n\n## Exported Symbols\n\n| Symbol | Type | Description |\n|---|---|---|\n| `inspectPackageManifest` | Function | Parses `package.json`, detects lockfiles, and identifies incumbent libraries. |\n| `scanSourceFileAst` | Function | Static AST parser extracting imports and member call expressions. |\n| `inspectProject` | Function | High-level orchestrator performing manifest and multi-file AST inspection. |\n| `PackageManifestInfo` | Interface | Schema for parsed manifest data, package manager, and incumbent versions. |\n| `ImportOccurrence` | Interface | Metadata for an import declaration (file, line, symbols, CJS vs ESM). |\n| `ApiCallOccurrence` | Interface | Metadata for an API call site (file, line, method name, expression text). |\n| `ProjectInspectionResult` | Interface | Aggregated result structure containing manifest and all occurrences. |\n\n---\n\n## Links\n\n- **Repository**: [https://github.com/Grevix/berryn](https://github.com/Grevix/berryn)\n- **License**: [MIT](https://opensource.org/licenses/MIT) © 2026 Berryn Core Engineering Team\n","readmeFilename":"README.md"}