cosmic
Quick reference for cosmic-lua — language essentials, CLI commands, and project conventions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Quick reference for cosmic-lua — language essentials, CLI commands, and project conventions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | cosmic |
| description | Quick reference for cosmic-lua — language essentials, CLI commands, and project conventions |
cosmic is a batteries-included Lua distribution built on Cosmopolitan Libc. it produces fat-binary executables that run on Linux, macOS, Windows, FreeBSD, OpenBSD, and NetBSD from a single file. the source language is Teal (typed Lua) compiled to Lua 5.4.
source files use the .tl extension. formatting is 2-space indent, LF line endings. all .tl files must be <=500 lines.
cosmic script.tl # run a Teal script
cosmic --check types file.tl # type check (strict)
cosmic --check fmt file.tl # check formatting
cosmic --format file.tl # format to stdout
cosmic --test <out> <cmd> # run test, capture output
cosmic --docs [query] # search documentation
naming: snake_case for functions/variables, PascalCase for record types. doc comments use --- prefix with @param and @return tags.
error handling: return value, string (nil + error message on failure). never throw from library code.
imports: use cosmic.* modules.
local json = require("cosmic.json")
local data, err = json.decode(input)
if not data then
io.stderr:write("error: " .. err .. "\n")
os.exit(1)
end
use proc.is_main() to write files that work as both scripts and importable modules:
local proc = require("cosmic.proc")
local function greet(name: string): string
return "hello, " .. name
end
if proc.is_main() then
print(greet(arg[1] or "world"))
end
return { greet = greet }
run cosmic --docs guide.<topic> or see the files below for deeper coverage:
cosmic --test, assert patterns)cosmic --check typescosmic --format / --check fmtcosmic --makecosmic.* modules)