npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spec-copy-selection

v1.0.16

Published

A CLI utility for copying text to clipboard

Readme

spec-copy-selection

A CLI tool to copy specific line ranges from files to your clipboard. Designed for developers who need to quickly extract and share code snippets with proper context.

Installation

Run directly via npx (no installation required):

npx spec-copy-selection@latest <file-path>:<start-line>-<end-line>

Basic Usage

Copy lines from any file to your clipboard:

# Copy lines 1-5 from package.json
spec-copy-selection ./package.json:1-5

# Copy lines 10-20 from a TypeScript file
spec-copy-selection src/index.ts:10-20

# Windows absolute paths are supported
spec-copy-selection D:\projects\file.ts:10-20

Output format for standard files:

src/index.ts:10-20
[selected content]

Backlog.md Special Features

When copying from specs/[feature]/backlog.md files, the tool provides special formatting to help with spec-driven workflows.

Special Output Format

Copying from a backlog file produces formatted output with context:

spec-copy-selection specs/cli-file-operations/backlog.md:69-70

Output:

spec: cli-file-operations
[selected content]

(note: this request was extracted from specs/cli-file-operations/backlog.md:69-70)

Automatic Separator Insertion

When copying a non-first section from a backlog.md file:

  • The system automatically inserts a --- separator before the selected content in the source file
  • Line numbers are adjusted (+3) after insertion to account for the added separator
  • This helps maintain clean section boundaries in backlog files

Note: Separators are only inserted when:

  • The file already contains at least one --- separator
  • There is content after the last separator (indicating a new section has started)
  • You're not copying from line 1

IDE Integration (JetBrains External Tools)

Configure as an external tool with these variables:

bunx
spec-copy-selection $FilePathRelativeToProjectRoot$:$SelectionStartLine$-$SelectionEndLine$
$ContentRoot$

img.png img_1.png

Error Handling

The tool provides clear error messages for common issues:

  • Invalid format: Invalid format. Usage: spec-copy-selection <file-path>:<start-line>-<end-line>
  • File not found: File not found: {file-path}
  • Invalid range: Invalid range: start line ({start}) cannot be greater than end line ({end})

Run spec-copy-selection --help for usage instructions.