Compare commits

...

3 Commits

Author SHA1 Message Date
a193bf5cad fix 2026-02-26 19:49:08 -08:00
8d09e3017f 0.0.11 2026-02-26 19:48:53 -08:00
32da4e220f Add random branch name generation with word lists 2026-02-26 19:43:48 -08:00
2 changed files with 22 additions and 3 deletions

View File

@ -1,10 +1,10 @@
{
"name": "@because/sandlot",
"version": "0.0.10",
"version": "0.0.11",
"description": "Sandboxed, branch-based development with Claude",
"type": "module",
"bin": {
"sandlot": "./src/cli.ts"
"sandlot": "src/cli.ts"
},
"files": [
"src",

View File

@ -10,6 +10,25 @@ import { requireApiKey } from "../env.ts"
import { renderMarkdown } from "../markdown.ts"
import { saveChanges } from "./helpers.ts"
const ADJECTIVES = [
"calm", "bold", "warm", "cool", "keen", "soft", "fast", "wild", "fair", "rare",
"deep", "dark", "pale", "wide", "slim", "tall", "glad", "pure", "safe", "free",
"hazy", "lazy", "cozy", "tiny", "vast", "busy", "easy", "gray", "gold", "blue",
"rosy", "wavy", "mild", "loud", "firm", "flat", "crisp", "dry", "raw", "odd",
]
const NOUNS = [
"fern", "dune", "cove", "pine", "reef", "hawk", "pond", "mesa", "vale", "glen",
"haze", "moss", "peak", "tide", "dawn", "lynx", "wren", "sage", "crag", "flint",
"leaf", "reed", "cave", "star", "gust", "surf", "opal", "lark", "vale", "plum",
"birch", "clay", "jade", "ivy", "fox", "elk", "bay", "ash", "dew", "oak",
]
function randomBranchName(): string {
const adj = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)]
const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)]
return `${adj}-${noun}`
}
function fallbackBranchName(text: string): string {
return text
.toLowerCase()
@ -63,7 +82,7 @@ export async function action(
if (!branch && opts.print) {
branch = await branchFromPrompt(opts.print)
} else if (!branch) {
die("Branch name or prompt is required.")
branch = randomBranchName()
} else if (branch.includes(" ")) {
// If the "branch" contains spaces, it's actually a prompt — derive the branch name
prompt = branch