kukicha

package module
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 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. Built for AI integration, cloud automation, and everyday data/CLI scripting.

kukicha.org · Cookbook · Quick Reference · Stdlib Reference

Where to start

You are… Start here Then
A Go developer Already use Go? (translation table below) Cookbook, Quick Reference
A shell / Python scripter Kukicha for Shell Scripters or Data & AI Scripting Python/Shell Equivalents CookbookCLI Explorer
New to programming Beginner Tutorial CLI ExplorerWeb AppHealth Checker
A cloud / ops person AWS Starter or GCP Starter Production Patterns
Driving Claude or another agent Agent Workflow Tutorial kukicha init in your project writes an AGENTS.md reference

What's it for?


A sip of Kukicha

Fetch GitHub issues, classify in parallel with Claude, keep the urgent ones, sort, print a colored table:

# triage.kuki  classify open issues with Claude, flag the urgent ones
import "stdlib/color"
import "stdlib/concurrent"
import "stdlib/fetch"
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

func sevColor(s: Severity) func(string) string
    if s equals Severity.OnFire
        return color.BrightRed
    return color.Yellow

func 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))

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

    verdict.number = issue.number
    return verdict

func 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({"sev", "kind", "#", "summary"})
    for v in urgent
        label := sevColor(v.severity)("P{v.severity}")
        t = t |> table.AddRow({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 manageable.

For a smaller, no-network sample see examples/scan.kuki: tally log levels in parallel.


Why Kukicha?

  • Readable. English operators (and, equals, isnt), pipes, indentation-based blocks
  • 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 lints that flag SQL injection, XSS, shell injection, path traversal, SSRF, and open redirects, paired with stdlib (safe.Wrap, fetch.NewExternal, http.SafeHTML) Errors are values handled with onerr.
  • No lock-in. kukicha brew file.kuki converts a file back to 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.19.2
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 reverts to standard Go before compilation, so mix and match freely. Run kukicha-blend on existing Go to see idiomatic Kukicha suggestions, and kukicha brew to convert any .kuki file back to Go.

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


More

Cookbook · Quick Reference · Stdlib · FAQ · Contributing


Version: 0.19.2 | 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
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