Runs the repo's CI gates (gofmt on tracked Go roots, make lint, make check-file-sizes when defined) before `git push` / `gh pr create|merge`, and denies the…

<img src="docs/static/img/ailang-logo.svg" alt="AILANG Logo" width="128" height="128">
<!-- EXAMPLES_STATUS_START -->
Example status <!-- EXAMPLES_STATUS_END -->
Third-party verification. AILANG is written autonomously by AI agents via its own coordinator. The badges above are independent static-analysis and supply-chain scores — not self-reported. The benchmark dashboard publishes the live correctness signal across current benchmark and model cohorts.
AILANG is a purely functional, effect-typed language designed as a deterministic execution substrate for AI-generated code. Every construct has deterministic semantics that can be reflected, verified, and serialized.
Documentation | Examples | Live Demos | Vision | Benchmarks
AILANG is designed to be used by AI coding agents. The AILANG Bootstrap packages the current language guidance, reusable skills, and local MCP tools for Claude Code and OpenAI Codex.
Install the AILANG CLI first:
curl -fsSL https://ailang.sunholo.com/install.sh | bash
ailang --version
The agent integrations call the local ailang executable, so it must be available on PATH.
/plugin marketplace add sunholo-data/ailang_bootstrap
/plugin install ailang@sunholo-data/ailang_bootstrap
AILANG Bootstrap also ships a Codex plugin manifest. Add its stable marketplace:
# Required by the plugin's local MCP server on first launch
node --version
npm --version
codex plugin marketplace add sunholo-data/ailang_bootstrap --ref stable
codex plugin add ailang@ailang-marketplace
codex plugin list
Start a new Codex session after installation. Alternatively, after adding the marketplace, launch codex, enter /plugins, and install ailang from the AILANG marketplace. The plugin can also be installed from the Plugins directory in the Codex desktop app. Codex plugins are not currently available in the IDE extension.
Codex reads this repository's AGENTS.md automatically, whether or not the plugin is installed. The plugin adds the reusable AILANG skills and MCP tools; AGENTS.md supplies repository-specific workflows and guardrails.
ailang executableailang_prompt, ailang_check, ailang_run, ailang_builtins, ailang_evalailang promptThe packaging is intentionally native to each host:
| Capability | Claude Code | Codex |
|---|---|---|
| Persistent guidance | CLAUDE.md | AGENTS.md |
| Reusable workflows | Plugin skills | Plugin skills |
| Local AILANG MCP tools | Yes | Yes |
| Host-native commands | Claude slash commands | Skills and MCP tools |
| AILANG Bootstrap hooks | Claude hooks | Not currently packaged |
Once installed, ask the agent to write AILANG code. All agents should run ailang prompt before authoring .ail files; it is the installed CLI's source for current syntax and idioms.
See ailang_bootstrap for details.
The installer detects your OS and architecture automatically. To pin a release:
curl -fsSL https://ailang.sunholo.com/install.sh | VERSION=v0.33.1 bash
# macOS (Apple Silicon)
curl -L https://github.com/sunholo-data/ailang/releases/latest/download/darwin.arm64.ailang.tar.gz | tar -xz
sudo mv ailang /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/sunholo-data/ailang/releases/latest/download/darwin.x64.ailang.tar.gz | tar -xz
sudo mv ailang /usr/local/bin/
# Linux
curl -L https://github.com/sunholo-data/ailang/releases/latest/download/linux.x64.ailang.tar.gz | tar -xz
sudo mv ailang /usr/local/bin/
# From source
git clone https://github.com/sunholo-data/ailang.git
cd ailang && make install
# Verify
ailang --version
For complete setup instructions, see the Getting Started Guide.
module examples/hello_world
import std/io (println)
export func main() -> () ! {IO} {
println("Hello, World!")
}
ailang run --caps IO examples/hello_world.ail
# Output: Hello, World!
ailang repl
λ> 1 + 2
3 :: Int
λ> let double = \x. x * 2 in double(21)
42 :: Int
λ> :type \x. x + x
\x. x + x :: ∀α. Num α ⇒ α → α
λ> :quit
ailang lsp --stdio ships in the binary: diagnostics, hover types, go-to-def, references, document symbols. One-command VS Code install: ailang editor install vscode (guide)Learn more: Why AILANG? | No Loops Design | Go Interop | Stability Promise (1.x)
make install # Build and install
make test # Run all tests
make repl # Start REPL
make lint # Run linter
Guides:
ailang/
├── cmd/ailang/ # CLI
├── internal/ # Compiler (lexer, parser, types, eval, effects)
├── std/ # Standard library (std/io, std/fs, std/json, std/zip, std/xml, etc.)
├── examples/ # Example and reference programs
├── docs/ # Documentation website source
└── design_docs/ # Design documents
Apache 2.0 - See LICENSE
AILANG draws inspiration from Haskell, OCaml, Rust, and Idris/Agda.
For AI agents: Deterministic functional language with Hindley-Milner type inference, algebraic effects, and explicit effect tracking. Read AGENTS.md, then use ailang prompt for current language guidance.
hooks/register.ts 53 lines1import type { EngineInterface, Register } from 'claude-code'
2
3import { goRoots, isPushCommand, makeTargetDefined, skipRequested } from './core'
4
5// Same gates and same refusals as .pi/extensions/prepush-gate.ts. The escape
6// hatch is read from Claude Code's own launch environment ($.env), so an agent
7// writing `AILANG_SKIP_PREPUSH=1 git push` does not open it. Not a security
8// boundary (M-CLAUDE-CODE-MODS C1): it saves a red CI round-trip, nothing more.
9
10async function gateFailure($: EngineInterface): Promise<string | undefined> {
11 if (skipRequested({ AILANG_SKIP_PREPUSH: await $.env.get('AILANG_SKIP_PREPUSH') })) return undefined
12 const cwd = await $.session.cwd()
13 const run = (argv: string[], timeoutMs: number) => $.process.run(argv, { cwd, timeoutMs })
14
15 // A gate for a toolchain the repo does not use has nothing to check.
16 const tracked = await run(['git', 'ls-files', 'cmd/*.go', 'internal/*.go', 'cmd/**/*.go', 'internal/**/*.go'], 15_000)
17 const roots = goRoots(tracked.stdout)
18 if (roots.length === 0) return undefined
19
20 const gofmt = await run(['gofmt', '-l', ...roots.map(r => `${r}/`)], 30_000)
21 const unformatted = gofmt.stdout.split('\n').filter(l => l.trim() !== '')
22 if (unformatted.length > 0) {
23 return `gofmt: ${unformatted.length} unformatted Go file(s): ${unformatted.slice(0, 3).join(', ')}. Run gofmt -w on them, then push again.`
24 }
25
26 const defined = async (target: string) => {
27 const probe = await run(['make', '-n', target], 15_000)
28 return makeTargetDefined(target, probe.exitCode, `${probe.stderr}\n${probe.stdout}`)
29 }
30 if (await defined('lint')) {
31 const lint = await run(['make', 'lint'], 180_000)
32 if (lint.exitCode !== 0) {
33 const tail = (lint.stderr || lint.stdout).split('\n').filter(Boolean).slice(-6).join('\n')
34 return `prepush gate failed (lint):\n${tail.slice(0, 2000)}\n\nFix locally, then push again.`
35 }
36 }
37 if (await defined('check-file-sizes')) {
38 const sizes = await run(['make', 'check-file-sizes'], 15_000)
39 if (sizes.exitCode !== 0) return `prepush gate failed (file sizes >800 lines):\n${sizes.stdout.slice(-400)}`
40 }
41 return undefined
42}
43
44export const register: Register = on => {
45 on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
46 if (!isPushCommand(e.command)) return next(e)
47
48 $.ui.status('prepush gate: running CI gates…')
49 const failure = await gateFailure($).finally(() => $.ui.status(undefined))
50 return failure ? { deny: `${$.plugin.name}: ${failure}` } : next(e)
51 })
52}
53hooks/core.ts 49 lines1// pi-core: .pi/extensions/prepush-gate.ts GateStep gateSteps goRoots makeTargetDefined skipRequested isPushCommand
2// Generated by scripts/check_claude_mods_drift.sh --write from the pi source
3// above. Do not edit here: change pi, then regenerate.
4
5export interface GateStep {
6 name: string;
7 cmd: string;
8 args: string[];
9 timeoutMs: number;
10}
11
12/** Pure: the prepush gate chain for a Go repo (ailang's gates, fast subset). */
13export function gateSteps(): { name: string; cmd: string; args: string[]; timeoutMs: number }[] {
14 return [
15 { name: "gofmt", cmd: "gofmt", args: ["-l", "cmd", "internal"], timeoutMs: 15_000 },
16 { name: "lint", cmd: "make", args: ["lint"], timeoutMs: 180_000 },
17 { name: "file-sizes", cmd: "make", args: ["check-file-sizes"], timeoutMs: 15_000 },
18 ];
19}
20
21/** Pure: the Go source roots (of cmd/, internal/) that `git ls-files` output touches. */
22export function goRoots(lsFilesStdout: string): string[] {
23 const files = lsFilesStdout.split("\n").filter((l) => l.trim() !== "");
24 return ["cmd", "internal"].filter((root) => files.some((f) => f.startsWith(`${root}/`)));
25}
26
27/**
28 * Pure: given `make -n <target>`'s result, does the repo define the target?
29 * Only the two "it isn't there" shapes count as absent; any other failure
30 * means the target exists and is broken, so the gate still runs (and blocks).
31 */
32export function makeTargetDefined(target: string, code: number, output: string): boolean {
33 if (code === 0) return true;
34 if (/No targets specified and no makefile found/i.test(output)) return false;
35 const noRule = new RegExp(`No rule to make target [\`'"‘]${target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}['"’]`);
36 return !noRule.test(output);
37}
38
39/** Pure: is the operator-level escape hatch set in pi's own environment? */
40export function skipRequested(env: Record<string, string | undefined>): boolean {
41 return env.AILANG_SKIP_PREPUSH === "1";
42}
43
44/** Pure: does this bash command push to a remote? */
45export function isPushCommand(command: string | undefined): boolean {
46 if (!command) return false;
47 return /\bgit push\b/.test(command) || /\bgh pr (create|merge)\b/.test(command);
48}
49