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

@garyr/pt-cli

v1.0.1

Published

Project Template CLI - Learn structures and initialize projects

Readme

pt - Project Template CLI

A lightweight, cross-platform CLI tool to record existing directory structures as reusable templates and quickly initialize new projects from them.

graph LR
    subgraph Inputs ["Source & Configuration"]
        Existing[Existing Project]
        Config[(Template Config)]
    end
    
    Engine[[pt-cli]]
    
    subgraph Outputs ["Generated Scaffolding"]
        RSA[Replicated Structure A]
        RSB[Replicated Structure B]
    end
    
    %% Flow logic
    Existing -- Learn --> Engine
    Config <-- Read/Write --> Engine
    Engine -- Initialize --> RSA
    Engine -- Initialize --> RSB
    
    %% Separate the Update logic to avoid crossing lines
    RSA -. Update .-> Engine
    
    style Engine fill:#f9f,stroke:#333,stroke-width:2px,color:#000

Why pt-cli?

Traditional project templating often tightly couples logic and configuration, meaning every new template requires code changes. pt-cli breaks that ceiling by separating project definitions from the underlying logic.

Instead of writing complex, hard-coded configuration files to scaffold new work, pt-cli allows you to "learn" from your existing project directories and turn them into templates. It doesn't enforce a specific folder structure; it supports your existing patterns.

Core Benefits & Uses

🚀 Low-Friction Templating

Stop recreating folder structures manually or editing shell scripts. pt learn saves the exact shape of any existing project. If you have a workspace organized the way you like it, pt-cli can help you turn it into a reusable template.

🧠 Reduces Cognitive Load

Standardization is key to lowering the friction of starting new work. By ensuring a predictable architecture, you can rely on downstream automation. When your folder layout is consistent, scripts for tasks like image conversion, generating dailies, or compiling documentation run flawlessly.

📦 Sharing is Caring

Templates can be exported as JSON configuration files via pt config <name> --json > .pt-template.json. This exports the template's structure (folders, files to copy), variables, and post-config tasks — but not the actual file contents.

For fully self-contained distribution, commit the template's source directory alongside its JSON config.

🤖 Agentic and API Friendly

pt-cli fully supports headless operation via non-interactive flags (--yes, --vars). It includes an official operator skill, allowing AI agents to autonomously lay down standardized boilerplate and capture new architectures you develop together.

Prefer a graphical interface, an official GUI is available.

Features at a Glance

  • Learn Any Structure: Learn any directory structure and save it as a reusable template.
  • Remote Templates: Learn templates directly from a remote repository or archive URL.
  • Variable Injection: Define template variables for dynamic file customization. Automatically scans text files for {{ var }} syntax during learn/update.
  • Automated Setup: Auto-detect and suggest post-config setup tasks (e.g., npm install, git init, Python virtual environments).
  • Global Configuration: Configure global post-config tasks in ~/.pt/config.yaml to apply them to all projects automatically.
  • Direct Scaffolding: Initialize projects directly from a JSON file without registering them in your config.

Quick Start

Installation

npm i -g @garyr/pt-cli 
# ...or clone this repository, then:
# cd pt-cli && npm install && npm run build && npm link

Basic Commands

# Learn an existing local project structure
pt learn /path/to/PROJECT

# Learn a template from a remote repository (e.g. GitHub, Gitea, or path to tarball)
pt learn https://github.com/garyritchie/pt_godot

# Scaffold a new project from a learned template
pt init <template_name> /path/to/NEW_PROJECT

# List available templates and configurations
pt config

# Export an existing template as JSON
pt config my-template --json > my-template.json

# Import a template from JSON
pt add my-new-template --file my-new-template.json

# Scaffold directly from a JSON file (no config registration required)
pt init ./new-project --file my-template.json --yes

Agent Integration

pt-cli is fully compatible with AI agents. By utilizing non-interactive flags (--yes, --vars, --name, --desc), agents can autonomously scaffold and learn projects without hanging on interactive terminal prompts.

An official agent skill is included in this repository: skills/agency-pt-operator/SKILL.md.

Equipping your agent with this skill allows it to automatically use pt-cli to construct standardized workspaces and record new architectures as you build them.

Documentation

  • Detailed Usage - Learn, Initialize, Update, and Remove commands.
  • Configuration Guide - Template variables, post-config tasks, file copying, and more.
  • Exclusions - Learn about default ignored files and how to set custom patterns.

Development

  • src/index.ts: Entry point and command registration.
  • src/commands/: Individual command handler modules.
  • src/config.ts: Configuration loading, saving, and type definitions.

Technical Notes:

  • ESM Migration: The project is now pure ESM. All internal imports must use the .js extension.
  • Development Tooling: Use tsx for running .ts files directly (npm run dev).
  • Building: Use tsc to compile to dist/.

Where are the Templates?

The way you organize your workspace is highly personal. A folder hierarchy that makes perfect sense for a VFX pipeline might look entirely backwards for a company branding project.

Because pt-cli is built around flexibility, the app purposefully avoids imposing strong opinions or hardcoded structures out of the box. Instead, it empowers you to learn and share exactly what works for your specific needs.

  • Example Templates: We have provided a few templates based on our own workflows to get you started. These include helpful Python scripts for streamlining common tasks, such as downloading the latest version of Blender or pruning unused folders from a project.
  • Share Your Own: Have you built a project structure that works perfectly for your niche? Join us in GitHub Discussions to share your templates and see how others are organizing their work.

1.0 Release & API Stability

pt-cli v1.0.0 marks the first stable release with a locked public API. This means:

🔒 Stability Guarantee (1.x series)

  • No breaking changes to CLI command signatures, flags, or config schema (~/.pt/config.yaml) within the 1.x series
  • No breaking changes to the JSON template format (.pt-template.json / template.json)
  • No breaking changes to the Node.js programmatic API (if used as a library)

📦 Versioning Policy

| Version | Meaning | |---------|---------| | MAJOR (1.0 → 2.0) | Breaking changes to CLI, config schema, or JSON template format | | MINOR (1.0 → 1.1) | New features, commands, or config options (backward compatible) | | PATCH (1.0 → 1.0.1) | Bug fixes, security patches, documentation updates |

📋 What's Locked in 1.0

CLI Commands & Flags:

pt learn [path] [--ignore] [--name] [--desc] [--yes] [--json] [--allow-untrusted] [--no-diff]
pt init [template] [dest] [--file] [--skip-post-config] [--dry-run] [--yes] [--vars]
pt update <template> [path] [--ignore] [--desc] [--yes] [--no-diff]
pt config [template] [--json]
pt add <name> [--file] [json]
pt remove <template> [--yes]        # alias: pt rm
pt variables [--set] [--delete] [--json]
pt default-post-config [--set --json]
pt ignore [patterns] [--set]
pt security-response <response>

Config Schema (~/.pt/config.yaml v3.0):

version: "3.0"
templates: { <name>: TemplateConfig }
default_post_config: PostConfigTask[]
ignore: string[]
variables: TemplateVariable[]
security: SecurityPolicy  # optional

TemplateConfig (per-template):

description: string
templateRoot?: string
variables?: TemplateVariable[]
folders: FolderNode[]
exclude?: string[]
copy_files?: CopyFileEntry[]
post_copy?: PostCopyFile[]
post_config?: PostConfigTask[]

JSON Template Format (.pt-template.json):

{
  "name": "template-name",
  "description": "Template description",
  "variables": [{ "name": "", "prompt": "", "default": "", "required": false }],
  "folders": [{ "name": "", "info": "", "children": [] }],
  "copy_files": [{ "src": "", "dest": "", "substitute_variables": false, "chmod": "" }],
  "post_config": [{ "command": "", "description": "", "type": "", "always_prompt": false, "script": "", "cross_platform": false, "checked": true }],
  "post_copy": [{ "src": "", "dest": "" }]
}

📖 Migration from 0.x to 1.0

If you're upgrading from a 0.x version:

  1. Config auto-migratespt automatically upgrades your ~/.pt/config.yaml from v2.0 → v3.0 on first run (renames namedescription, removes type, migrates global_post_configdefault_post_config, normalizes variables)
  2. No action needed — Just run any pt command; migration happens silently with a backup (.bak) created
  3. CLI flags unchanged — All 0.x flags work identically in 1.0

Breaking changes from 0.x already landed in 0.30+:

  • Config version 3.0 (v0.30+)
  • default_post_config replaces global_post_config (v0.30+)
  • Additive diff mode for pt update (v0.38+)
  • Nested variable expansion (v0.36+)
  • .env file scanning for defaults (v0.36+)

If you skipped intermediate 0.x versions, the auto-migration handles everything.


Documentation