kukicha

package module
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 1 Imported by: 0

README

Kukicha

A readable language that ships as a single binary, brewed from what Go leaves on the table. Focused on DevOps type operations, without reverting to a DSL.

kukicha.org | Cookbook | Quick Reference | Tutorials | Stdlib Reference

Coming from Python or shell? Start with the Cookbook;task-indexed recipes ("how do I read JSON?", "how do I run a subprocess?") with Python and bash equivalents.


A taste of Kukicha

Triage open GitHub issues with an LLM. Fetch, classify in parallel, keep the urgent ones, sort, print.

# triage.kuki — classify open issues with Claude, flag the urgent ones
import "stdlib/color"
import "stdlib/concurrent"
import "stdlib/fetch"
import "stdlib/json" as jsonpkg
import "stdlib/llm/chat"
import "stdlib/llm/safe"
import "stdlib/log"
import "stdlib/slice"
import "stdlib/sort"
import "stdlib/table"

type Issue
    number int
    title string
    body string

enum Severity
    Unknown = 0
    Trivial = 1
    Minor = 2
    Normal = 3
    Urgent = 4
    OnFire = 5

type Verdict
    number int
    severity Severity
    kind string # bug | feature | docs | question
    summary string

function classify(issue: Issue) Verdict
    # title and body are attacker-controlled — wrap them so a crafted issue
    # can't override the system prompt
    title := safe.Wrap("title", safe.SanitizeLine(issue.title, 200))
    body := safe.Wrap("body", safe.Truncate(issue.body, 4000))

    reply := chat.New("anthropic:claude-sonnet-4-6")
        |> chat.JSONMode()
        |> chat.System(`{safe.UntrustedPreamble}
Classify GitHub issues. Reply JSON: {severity:1-5, kind, summary}`)
        |> chat.Ask("{title}\n\n{body}") onerr return {}

    verdict := jsonpkg.ParseString of Verdict from reply onerr return {}
    verdict.number = issue.number
    return verdict

function main()
    url := "https://api.github.com/repos/golang/go/issues?per_page=20"
    issues := fetch.GetJson of list of Issue from url onerr
        log.Error("github fetch failed", "url", url, "err", error)
        return

    triaged := issues
        |> concurrent.MapWithLimit(4, classify)
        |> slice.Reject(v => v.kind equals "question")

    urgent := triaged
        |> slice.Filter(v => v.severity >= Severity.Urgent)
        |> sort.By((a, b) => a.severity > b.severity)

    log.Info("triaged {len(triaged)}, urgent {len(urgent)}")

    if len(urgent) equals 0
        print(color.Dim("Nothing urgent — go enjoy your tea."))
        return

    print(color.Bold("Needs attention:"))
    t := table.New(list of string{"sev", "kind", "#", "summary"})
    for v in urgent
        label := if v.severity equals Severity.OnFire then color.BrightRed("P{v.severity}") else color.Yellow("P{v.severity}")
        t = t |> table.AddRow(list of string{label, color.Dim(v.kind), "#{v.number}", v.summary})
    t |> table.PrintWithStyle(table.Style.Box)

Read it top-to-bottom: wrap the untrusted issue text, classify four at a time, drop the questions, keep the urgent ones, sort, print a colored table. English operators (and, equals, isnt, if … then … else), pipes that flow left-to-right, named severities via enum, and a friendly stdlib (fetch.GetJson, concurrent.MapWithLimit, safe.Wrap, table.PrintWithStyle). onerr keeps error handling out of the flow.


Why Kukicha?

  • Readable
  • Ships as one file. kukicha build produces a static binary, copy it to a server and run.
  • Batteries included. fetch, shell, files, db, llm, mcp, concurrent, crypto, html and 30+ more.
  • Safe defaults. Compile-time checks for SQL injection, XSS, shell injection, path traversal, and SSRF. Errors are values handled with onerr.
  • No lock-in. kukicha brew file.kuki converts any file back to standard Go.

Quickstart

Grab a pre-built binary from GitHub Releases (Linux, macOS, Windows). Or, if you already have Go 1.26+ installed:

go install github.com/kukichalang/kukicha/cmd/kukicha@v0.16.0
mkdir myapp && cd myapp
kukicha init

kukicha init initializes a Go module (if go.mod is absent), extracts the stdlib, downloads dependencies, and writes an AGENTS.md language reference. Add .kukicha/ to your .gitignore.

Create hello.kuki:

function main()
    name := "World"
    print("Hello, {name}!")
kukicha run hello.kuki
Commands
Command What it does
kukicha check file.kuki Validate syntax without compiling
kukicha run file.kuki Compile and run immediately
kukicha build file.kuki Compile to a standalone binary
kukicha fmt -w file.kuki Format in place
kukicha brew file.kuki Convert back to standalone Go
kukicha-blend file.go Suggest Kukicha idioms for Go code

Already use Go?

Kukicha is a near-superset of Go. Most Go compiles as-is — operators, pointers, if err != nil, anonymous funcs, slices, generics, interfaces. A few Go constructs (range, case/default, struct {} type literals, chan T, goto, parenthesized const ( ... )) have Kukicha replacements and won't parse in their Go form; see docs/kukicha-quick-reference.md for the full list. Kukicha forms desugar to standard Go before compilation, so mix and match freely, drop them when they don't help, and run kukicha-blend on existing Go to see suggestions.

kukicha-blend main.go            # see what idioms apply
kukicha-blend --diff ./pkg/      # preview changes
kukicha-blend --apply main.go    # convert in place
kukicha brew main.kuki           # and anytime, back to Go

The translation table:

Concept Kukicha Go
Booleans and, or, not &&, ||, !
Comparison equals, isnt ==, !=
Lists list of string []string
Maps map of string to int map[string]int
Pointers reference User, reference of user *User, &user
Nil empty nil
Errors onerr return, error "msg" if err != nil { return err }, errors.New("msg")
Pipes x |> h() |> g() |> f() f(g(h(x)))
If-expression x := if cond then a else b (no Go equivalent)
Enums enum Status with named variants const + iota
Lambdas (x: int) => x * 2 func(x int) int { return x*2 }
Interpolation "hi {name}" fmt.Sprintf("hi %s", name)

Editor support


Documentation


Version: 0.16.0 | License: MIT


[!NOTE] Portions of this codebase were written with AI assistance. Commits are reviewed by human maintainers before merge.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SkillFS embed.FS

SkillFS contains docs/SKILL.md — the concise Kukicha language reference for AI coding agents. Extracted and upserted into AGENTS.md in user projects by `kukicha init`, tied to the same KUKICHA_VERSION stamp as the stdlib.

View Source
var StdlibFS embed.FS

StdlibFS contains the embedded Kukicha standard library source files. This includes all transpiled .go files from stdlib sub-packages. The .kuki source files are not embedded since only the Go code is needed. A go.mod file for the extracted stdlib is generated at extraction time.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
gengostdlib command
gengostdlib generates internal/semantic/go_stdlib_gen.go by inspecting Go standard library function signatures via go/packages.
gengostdlib generates internal/semantic/go_stdlib_gen.go by inspecting Go standard library function signatures via go/packages.
genstdlibregistry command
genstdlibregistry generates internal/semantic/stdlib_registry_gen.go by scanning all stdlib/*.kuki source files and extracting exported function signatures: return counts, per-position return types, and parameter names.
genstdlibregistry generates internal/semantic/stdlib_registry_gen.go by scanning all stdlib/*.kuki source files and extracting exported function signatures: return counts, per-position return types, and parameter names.
kukicha command
kukicha-blend command
kukicha-lsp command
kukicha-proxy command
kukicha-wasm command
Package main is the WASM entrypoint for the Kukicha playground.
Package main is the WASM entrypoint for the Kukicha playground.
examples
api-explorer command
beads_kukicha command
bookmark-tags command
deploy-status command
llm-chat command
internal
ast
cache
Package cache provides an opt-in on-disk cache for compiler outputs keyed by source content + compiler version.
Package cache provides an opt-in on-disk cache for compiler outputs keyed by source content + compiler version.
ir
lsp
pipeline
Package pipeline provides a small bounded-concurrency Map helper used by the CLI to run independent per-file work (parsing, per-file semantic analysis) in parallel without sacrificing deterministic output ordering.
Package pipeline provides a small bounded-concurrency Map helper used by the CLI to run independent per-file work (parsing, per-file semantic analysis) in parallel without sacrificing deterministic output ordering.
profile
Package profile provides an opt-in compiler phase profiler.
Package profile provides an opt-in compiler phase profiler.
project
Package project loads a Kukicha "package" — a single .kuki file or a directory of .kuki files — into a shared compilation context that the CLI subcommands (check, build, run) and the LSP can consume without duplicating directory walking, source pre-reads, or parse plumbing.
Package project loads a Kukicha "package" — a single .kuki file or a directory of .kuki files — into a shared compilation context that the CLI subcommands (check, build, run) and the LSP can consume without duplicating directory walking, source pre-reads, or parse plumbing.
semantic
Package semantic performs semantic analysis on a parsed Kukicha program: scope construction, symbol resolution, type checking, lint collection, and diagnostic emission.
Package semantic performs semantic analysis on a parsed Kukicha program: scope construction, symbol resolution, type checking, lint collection, and diagnostic emission.
summary
Package summary flattens an *ast.Program into a list of named symbols (top-level declarations and their nested children) with positions.
Package summary flattens an *ast.Program into a list of named symbols (top-level declarations and their nested children) with positions.
version
Package version provides the Kukicha compiler version.
Package version provides the Kukicha compiler version.
stdlib
cli
ctx
db
env
git
llm
log
mcp
obs
set
url

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL