CoffeeScript
2009fragletwebfunctionalimperative.coffee
docker run --rm --platform="linux/amd64" 100hellos/coffeescript:latest
MCP + fragletc
MCPstdinargs
This language supports code execution via MCP and the fragletc CLI. Stdin piping and argument passing are both supported.
Install fragletc →CoffeeScript is a web-focused functional and imperative language first appearing in 2009.
Hello World
console.log("Hello World!")Coding Guide
Language Version
CoffeeScript 2.x (compiled to JavaScript, run on Node.js)
Execution Model
- Source is compiled to JavaScript, then executed by Node.js
- Code runs at the top level
- No explicit main; top-level statements run in order
Key Characteristics
- Significant whitespace (indentation defines blocks)
- No semicolons; newlines and indentation define structure
- Compiles to readable JavaScript
- Case-sensitive
Fragment Authoring
Write valid CoffeeScript: your fragment replaces the template's executable line and can be multiple lines. Use normal indentation for blocks (e.g. 2 spaces). Define functions, loops, and multiple statements as needed.
Available Packages
Node.js built-ins are available: process, fs, path, etc. No extra npm packages are pre-installed.
Common Patterns
- Print:
console.log "message" - Variables:
x = 10 - Functions:
greet = (name) -> "Hello, #{name}!"or multiline with->and indented body - Arrays:
[1, 2, 3] - String interpolation:
"Value: #{value}" - Arguments:
process.argv[2..](first two elements are node and script path) - Stdin:
require('fs').readFileSync(0, 'utf8')or stream withprocess.stdin
Examples
Simple output
console.log "Hello, World!"Function and call (multiline)
greet = (name) ->
"Hello, #{name}!"
console.log greet "Alice"Loop and aggregation (multiline)
numbers = [1, 2, 3, 4, 5]
squared = (x * x for x in numbers)
sum = squared.reduce (a, b) -> a + b
console.log "Sum of squares: #{sum}"Reading stdin (multiline)
fs = require 'fs'
input = fs.readFileSync 0, 'utf8'
input.split('\n').forEach (line) ->
console.log line.toUpperCase()Command-line args
args = process.argv[2..]
console.log "Args: " + args.join " "Caveats
- Output with
console.log(Node.js API) - Indentation must be consistent (spaces; typically 2)
- Your fragment can be as many lines as you need
Fraglet Scripts
Coffeescript Fortune
#!/usr/bin/env -S fragletc --vein=coffeescript
console.log "CoffeeScript: where semicolons go to die, and your indentation finally matters."Echo Args
#!/usr/bin/env -S fragletc --vein=coffeescript
args = process.argv[2..]
console.log "Args: " + args.join " "Stdin Upper
#!/usr/bin/env -S fragletc --vein=coffeescript
fs = require 'fs'
input = fs.readFileSync 0, 'utf8'
input.split('\n').forEach (line) ->
console.log line.toUpperCase()Test
#!/usr/bin/env -S fragletc --vein=coffeescript
console.log("Hello World!")Connections
influenced by
Container Info
image100hellos/coffeescript:latest
build scheduleSunday
fragletenabled
sourcecoffeescript/files/