@cottonc/lit
v0.1.1
Published
CLI tool to generate prompt files from a template
Readme
lit (prompt / instruct generator)
Generate timestamped instruction files in ./instructs/ from a template, with optional per-project local templates.
Install / Run
- Build:
pnpm build - Run locally:
pnpm dev(runssrc/index.ts) - Tests:
pnpm test
If you install this package as a CLI, it exposes the lit command.
Commands
lit (default)
Creates a new file under ./instructs/:
- Output path:
instructs/YYYY-MM-DD-HH-MM-SS-<template>-<name>.md - If
--templateor--nameare missing,litwill prompt interactively.
Options:
-t, --template <template>:feat | refactor | fix-n, --name <name>: instruction filename suffix (sanitized)--official: never prompt about local templates; always use bundledtemplates/*.md--local-templates [folder]: force using local templates (and create/copy them if needed)- When omitted, defaults to
./.ins-template foldercan be a relative path (tocwd) or an absolute path
- When omitted, defaults to
lit init [folder]
Explicitly creates/uses a local template folder and copies bundled templates into it.
- Default folder:
.ins-template - Only copies missing files; it does not overwrite existing local template files.
Options:
-y, --yes: skip the confirmation prompt
Examples:
lit init(prompts, creates./.ins-template)lit init my-templates -y(no prompt, creates./my-templates)
Template selection logic (default lit command)
Let:
- official templates = bundled
templates/*.mdshipped with the CLI - local templates = a folder in your working directory (default
./.ins-template)
Resolution order:
- If
--officialis set: use official templates (no prompt). - Else if
--local-templatesis set: use local templates (ensure folder exists + copy missing templates). - Else if the local templates folder already exists: use local templates (ensure missing templates are copied).
- Else if
./instructs/already exists: use official templates (no prompt). - Otherwise (fresh folder): ask whether to create/use local templates.
- Yes: create local folder + copy templates, then use local templates
- No: use official templates
Customizing templates
- Run
lit init(orlit init <folder>) in your project. - Edit the copied
*.mdfiles inside your local template folder. - Run
lit --local-templates(or rely on auto-detection once the local folder exists).
