A minimal JavaScript/TypeScript runtime written in Go.
Built on top of QuickJS and esbuild, Kimera provides a fast, lightweight alternative for running JavaScript and TypeScript code.
const asyncSayHello = async (text) => {
console.log(text);
};
asyncSayHello("Hello World!");
kimera run myScript.js
Hello World!
go install github.com/UltiRequiem/kimera@latest
Kimera.js provides a lightweight JavaScript/TypeScript runtime with the following capabilities:
Launch an interactive Read-Eval-Print Loop for testing JavaScript code:
kimera
The REPL supports:
Ctrl+C or Ctrl+DRun JavaScript or TypeScript files directly:
kimera run myScript.js
kimera run myScript.ts
Permission Flags:
Kimera implements a secure-by-default permission system. Scripts must explicitly request access to sensitive operations:
kimera run script.js --fs # Allow filesystem access
kimera run script.js --net # Allow network access
kimera run script.js --env # Allow environment variable access
# Multiple flags can be combined
kimera run script.js --fs --net --env
Native TypeScript support out of the box - no configuration needed. Kimera automatically transpiles TypeScript files using esbuild:
const greet = (name: string): void => {
console.log(`Hello, ${name}!`);
};
greet("World");
Full support for modern JavaScript syntax including:
Example:
const fetchData = async () => {
return "Data loaded";
};
fetchData().then((data) => console.log(data));
Standard console logging functionality:
console.log("Simple message");
console.log("Multiple", "arguments", "supported");
console.log(`Template literals: ${1 + 1}`);
Built-in file handling through the Kimera global object:
// Read file content as string
const content = Kimera.readFile("path/to/file.txt");
console.log(content);
// Write string content to file
Kimera.writeFile("path/to/output.txt", "Hello World!");
// Write multi-line content
const data = "Line 1\nLine 2\nLine 3";
Kimera.writeFile("output.txt", data);
File operations throw errors for invalid operations:
try {
const content = Kimera.readFile("nonexistent.txt");
} catch (error) {
console.log("File not found!");
}
Access and modify environment variables through the Kimera global object (requires --env flag):
// Get an environment variable
const path = Kimera.getEnv("PATH");
console.log("PATH:", path);
// Check if a variable exists
const myVar = Kimera.getEnv("MY_VAR");
if (myVar) {
console.log("MY_VAR is set to:", myVar);
} else {
console.log("MY_VAR is not set");
}
// Set an environment variable
Kimera.setEnv("MY_VAR", "my_value");
// Verify it was set
const value = Kimera.getEnv("MY_VAR");
console.log(value); // "my_value"
Environment operations throw errors when permission is not granted:
try {
const value = Kimera.getEnv("PATH");
} catch (error) {
console.log("Environment access denied!");
}
Note: Environment variable operations require the --env flag:
kimera run script.js --env
Kimera provides the following global objects:
console - Console logging APIKimera - File system, environment variables, and runtime APIclose() - Function to exit the runtimeCheck the installed Kimera version:
kimera version
Make HTTP requests with the fetch API (requires --net flag):
// Make a GET request
const response = fetch("https://api.example.com/data");
console.log("Status: " + response.status);
const data = response.json();
// Make a POST request
const postResponse = fetch("https://api.example.com/data", {
method: "POST",
body: JSON.stringify({ key: "value" }),
headers: {
"Content-Type": "application/json",
},
});
Note: Network operations require the --net flag:
kimera run script.js --net
# Run the REPL (all permissions enabled)
kimera
# Run a JavaScript file
kimera run script.js
# Run a TypeScript file
kimera run script.ts
# Run with specific permissions
kimera run script.js --fs # Filesystem access
kimera run script.js --net # Network access
kimera run script.js --env # Environment variables
kimera run script.js --fs --net # Multiple permissions
# Check version
kimera version
# Get help
kimera --help
git clone https://github.com/UltiRequiem/kimera.git
cd kimera
go build
go test ./...
The full documentation for Kimera.js is available online at GitHub Pages. It is automatically deployed from Markdown files in the repository whenever changes are made.
The documentation includes:
Documentation is automatically generated and deployed:
Automatic Deployment: The .github/workflows/deploy-docs.yaml workflow automatically deploys documentation to GitHub Pages when:
.md filemain branch that affect .md filesDocumentation Sources: All Markdown files in the repository (except those in .github/ and node_modules/) are:
gh-pages branchContributing to Documentation: To update documentation:
.md file in the repositoryNo manual steps are required to deploy documentation updates.
Contributions are welcome! Please feel free to submit a Pull Request.
Kimera.js is licensed under the MIT License.