Skip to content

Instantly share code, notes, and snippets.

@badlogic
badlogic / comment.ts
Created May 4, 2026 12:29
pi comment extension
import { spawnSync } from "node:child_process";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import type { ExtensionAPI, SessionEntry } from "@mariozechner/pi-coding-agent";
import type { AssistantMessage } from "@mariozechner/pi-ai";
function getLastAssistantText(branch: SessionEntry[]): string | undefined {
for (let i = branch.length - 1; i >= 0; i--) {
const entry = branch[i];
@badlogic
badlogic / README.md
Last active April 21, 2026 23:01
Pi extension: playable Pitris using only the pi.dev logo block

pi-pitris-widget

Playable Pitris for Pi.

  • exposes /pitris
  • uses only the pi.dev logo shape as the falling piece
  • controls: arrows or i j k l
  • rotate: up, i, or space
  • soft drop: down or k (holding the key repeats and accelerates the fall)
@badlogic
badlogic / README.md
Created April 21, 2026 22:34
Pi extension: compact context/progress widget with cwd tree

pi-context-tree-widget

A minimal Pi extension that adds a compact top-right widget with:

  • current context usage as a progress bar
  • used/total (percent) label
  • a small tree view of the current working directory

Install

@badlogic
badlogic / template-accelerator.ts
Created March 2, 2026 20:49
pi template accelerator extension - auto-fill prompt template args from conversation context
/**
* Template Accelerator - use conversation context to auto-fill prompt template args.
*
* Type `$$ /template` (no args) and the extension will:
* 1. Read the template file
* 2. Ask the current LLM to extract arguments from conversation context
* 3. Put the filled `/template "arg1" "arg2" ...` into the editor for review
*
* Press Enter to execute, or edit first.
*
@badlogic
badlogic / diff.ts
Last active January 23, 2026 23:34
pi extension: /diff command to show git changes and open in VS Code diff view
/**
* Diff Extension
*
* /diff command shows modified/deleted/new files from git status and opens
* the selected file in VS Code's diff view.
*/
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
import { DynamicBorder } from "@mariozechner/pi-coding-agent";
import { Container, Key, matchesKey, type SelectItem, SelectList, Text } from "@mariozechner/pi-tui";
@badlogic
badlogic / review-extension-v3.ts
Created January 16, 2026 14:02
Pi extension: /review - branch from root with UI side effects documented
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
/**
* /review command - Create a review branch from root, return with summary
*
* Usage:
* /review - Start review branch from root (null parent)
* /end-review - Return to origin with auto-summary
* /end-review <text> - Return with custom summary text
*
@badlogic
badlogic / review-extension-v2.ts
Created January 16, 2026 13:56
Pi extension: /review command - branch from root (parentId: null), work, return with summary
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
/**
* /review command - Create a review branch from root, return with summary
*
* Usage:
* /review - Start review branch from root (null parent)
* /end-review - Return to origin with auto-summary
* /end-review <text> - Return with custom summary text
*
@badlogic
badlogic / review-extension.ts
Created January 16, 2026 13:53
Pi extension: /review command - branch from root, work, return with summary (in-session branching)
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
/**
* /review command - Create a review branch from root, return with summary
*
* Usage:
* /review - Start review branch from root
* /end-review - Return to origin with auto-summary
* /end-review <text> - Return with custom summary text
*
@badlogic
badlogic / review-extension-corrected.ts
Last active January 16, 2026 13:51
Pi extension: /review command for branching and returning with summary
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
export default function (pi: ExtensionAPI) {
// Store review state
let reviewState: {
originalSessionFile: string;
reviewSessionFile: string;
branchFromId: string;
} | undefined;
@badlogic
badlogic / session.html
Created January 13, 2026 13:50
Token Clicker - We don't need your bank account, we need tokens
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Token Clicker - We don't need your bank account</title>
<style>
* {
margin: 0;
padding: 0;