pack
Create a tarball from an npm package directory to preview what would be published. Use the dry-run option to list files without generating the archive.
Instructions
Create a tarball from a package (preview what would be published)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the package directory | |
| dryRun | No | List files without creating tarball |
Implementation Reference
- src/index.ts:257-278 (handler)The registration and handler implementation for the "pack" tool, which creates a tarball of an npm package.
server.tool( "pack", "Create a tarball from a package (preview what would be published)", { path: z.string().describe("Absolute path to the package directory"), dryRun: z.boolean().optional().describe("List files without creating tarball"), }, async ({ path, dryRun }) => { const args = ["pack"]; if (dryRun) args.push("--dry-run"); args.push("--json"); try { const { stdout } = await run(args, path); return { content: [{ type: "text", text: stdout }] }; } catch (e: any) { return { content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }], isError: true, }; } }, );