Itty.bitty is a tool to create links that contain small sites
Find a file
google-labs-jules[bot] be79518f7f feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI)
This commit introduces the AAH-CLI, a Node.js command-line tool for creating `itty.bitty`-style URL fragments.

The CLI includes two main commands:
- `encode`: Compresses text content using Gzip or LZMA and outputs a Base64-encoded string. It accepts input from files, direct text strings, or stdin.
- `publish`: Encodes content and then publishes the resulting link to a specified file within a GitHub repository. This command uses Git to clone, modify, commit, and push the changes.

The project is structured into modular components for encoding (`encoder.js`) and publishing (`publisher.js`), with a manual argument parser in the main `aah-cli.js` file for robustness.

Includes comprehensive `README.md` and `AGENTS.md` documentation.
2025-09-08 11:08:09 +00:00
.vscode Update Recipe formatting 2022-09-05 11:41:33 -07:00
docs Update manifest.json 2022-12-23 20:54:20 +00:00
functions ignore descriptions shorter than one character 2022-01-22 15:04:26 -08:00
netlify/edge-functions Handle errors in metadata 2022-07-28 09:39:42 -04:00
scripts Add generator script 2022-12-04 10:03:51 -08:00
.firebaserc Initial commit 2018-05-25 17:16:21 -07:00
.gitattributes Initial commit 2018-05-25 17:16:21 -07:00
.gitignore Add netlify 2022-04-27 21:03:00 -06:00
aah-cli.js feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI) 2025-09-08 11:08:09 +00:00
AGENTS.md feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI) 2025-09-08 11:08:09 +00:00
build-v2.js Test of resource embedding. Fixes for color and recipe 2022-10-19 21:47:36 -07:00
encoder.js feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI) 2025-09-08 11:08:09 +00:00
examples.md Add encryption, gzip, and renderers 2022-02-15 17:28:50 -06:00
firebase.json Decode content correctly 2022-01-19 20:01:30 -08:00
LICENSE Add Licenses, remove extra files 2018-07-04 11:03:21 -07:00
netlify.toml Update netlify.toml 2022-12-23 15:04:07 +00:00
package.json feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI) 2025-09-08 11:08:09 +00:00
publisher.js feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI) 2025-09-08 11:08:09 +00:00
README.md feat: Implement Agent-Assisted Hypermedia Encoding CLI (AAH-CLI) 2025-09-08 11:08:09 +00:00
recipe.py Add encryption, gzip, and renderers 2022-02-15 17:28:50 -06:00

Agent-Assisted Hypermedia Encoding CLI (AAH-CLI)

AAH-CLI is a command-line tool designed to transform text into highly portable, self-contained URL fragments, inspired by the core functionality of itty.bitty. It allows you to take a piece of text or an entire file, compress it using Gzip or LZMA, and get a Base64-encoded string ready to be used in a URL.

This tool also provides a publish command to automate the process of adding your generated link to a file within a GitHub repository, streamlining the process of sharing your hypermedia content.

Features

  • Compress and encode text using Gzip or LZMA.
  • Accepts input from files, direct text strings, or stdin.
  • encode command: Generates a raw Base64 URL fragment.
  • publish command: Encodes content and pushes a formatted link to a specified file in a GitHub repository.

Installation

  1. Clone this repository.
  2. Install dependencies:
    npm install
    
  3. Install the CLI globally or use npm link for development:
    npm link
    
    You can now use aah-cli from anywhere in your terminal.

Usage

The CLI has two main commands: encode and publish.

encode

This command takes your content and outputs the raw, compressed, Base64-encoded string to standard output.

Usage: aah-cli encode [options]

Options:

  • -f, --file <path>: Path to the source file to encode.
  • -t, --text <string>: A direct string of text to encode.
  • -a, --algorithm <type>: The compression algorithm to use (gzip or lzma). Defaults to gzip.
  • -h, --help: Display help message.

Examples:

  1. From a text string:

    aah-cli encode --text "Hello, world!"
    

    Output: eNrzSM3JyVcozy/KSQEAGgsEXQ==

  2. From a file:

    aah-cli encode --file ./my-article.txt
    
  3. From stdin:

    cat my-article.txt | aah-cli encode
    
  4. Using LZMA compression:

    aah-cli encode --text "Hello, world!" --algorithm lzma
    

You can use the output to create an itty.bitty link like this: https://itty.bitty.host/#/<output_string>

publish

This command encodes your content and then adds it as a link to a file in a remote GitHub repository.

Prerequisites: You must have Git installed on your system. Your environment must be authenticated with GitHub (e.g., via SSH keys or a credential helper) so that you can push to the specified repository without interactive prompts.

Usage: aah-cli publish [options]

Options:

  • Content (--file or --text): The content to encode.
  • --repo <url>: Required. The clone URL of the target GitHub repository.
  • --path <filepath>: Required. The path to the file to update within the repository (e.g., README.md).
  • --branch <name>: The target branch name. Defaults to main.
  • --message <msg>: The commit message.
  • --algorithm <type>: The compression algorithm. Defaults to gzip.

Example:

aah-cli publish \
  --text "This is my new blog post." \
  --repo "git@github.com:user/my-repo.git" \
  --path "links.md" \
  --branch "develop" \
  --message "Add new post link"

This will encode "This is my new blog post.", clone the my-repo repository, append a formatted itty.bitty link to links.md, and push the commit to the develop branch.