uptask
v0.6.0
Published
Run TypeScript functions from CLI
Downloads
380
Readme
Uptask
Uptask scans your project for files matching a glob, parses each exported function's signature with the TypeScript compiler, and registers a Commander command for each one. No decorators, no boilerplate — just write functions.
Install
pnpm add -D uptask
# or
npm install --save-dev uptaskWrite a task file
The default scan pattern is @*.ts. Create one anywhere in your project:
/**
* Build the project.
*
* @param target Build target name
* @param watch Enable watch mode
* @param concurrency Number of parallel builds
*/
export function build(
target: string,
watch: boolean = false,
concurrency: number = 4,
) {
console.log({ target, watch, concurrency })
}Required positional types (string, number) become arguments. Optional or
boolean parameters become --flag options. JSDoc descriptions surface in
--help.
Add a config file
A minimal uptask.config.ts at the project root:
import { defineConfig } from "uptask"
export default defineConfig({
// pattern: "@*.ts" by default
// groups: [] by default — see "Groups"
})The config is optional. Without one, uptask uses sensible defaults derived from
package.json.
Run
Add a bin entry or run via pnpm exec:
pnpm exec uptask --help
pnpm exec uptask build my-target --watchEach exported function gets --help of its own — argument descriptions and
default values come straight from the JSDoc and the parameter signature.
