Hashpipe is an experimental JSON-based shell. Imagine that Bash was designed for manipulating web APIs instead of a filesystem.
Featuring:
- JSON-typed input & output (strings, numbers, objects, and arrays)
- Alternative piping constructs (like the parallel pipe
||, sequential pipe|=, and error pipe|?) - First-class functions (lambda literals like
{| * 2 }and named commands viadef) - Modular design (
usemodules to unlock namespaced commands likehttp.getandfiles.cat)
$ npm install -g hashpipe
$ hashpipe
#|
Bash-like command pipelines
#| use files
#| files.cat names.txt | split '\n' | match John | sort
[ 'John Adams',
'John King',
'John Lee',
'John Mitchell' ]
Parallel and series pipes to map commands over arrays
#| [1, 3, 4, 12] || * 5
[ 5, 15, 20, 60 ]
#| echo john jacob jingleheimer | split ' ' || upper
[ 'JOHN', 'JACOB', 'JINGLEHEIMER' ]
Special @ syntax for traversing JSON objects and arrays
#| ['a', 'b', 'c'] @ 0
'a'
#| {name: "George", age: 55} @ name
'George'
#| [{name: "Fred"}, {name: "Jerry"}, {name: "Tim"}] @ :name
[ 'Fred', 'Jerry', 'Tim' ]
Lambdas and named functions for reusable pipelines
#| [1, 2, 3] | map {| * 2 }
[ 2, 4, 6 ]
#| def dog-years { $n | $n * 7 }
#| dog-years 6
42
#| 6 | dog-years
42
Designed for easy interaction with JSON APIs
#| use http
#| http.get https://api.github.com/repos/spro/hashpipe @ {name, language, stars: stargazers_count}
{ name: 'hashpipe', language: 'TypeScript', stars: ... }
Start with the core docs:
- Syntax crash course for the language
- Command reference for builtins and bundled modules
- Cookbook for common workflows
Then try one of the Hashpipe walkthroughs to see it in action:
Commands are plain functions with a (inp, args, ctx, cb) signature, and
modules are TypeScript files that export them. The
module-author guide
covers the contract, namespacing, async commands, and accepting lambdas.