TitanPl SDK
The developer toolkit for Titan Planet with type safety and IntelliSense.
Titan SDK is a development-only toolkit designed to bridge the gap between your local coding environment and the native Titan Planet binary.
Note: The actual implementation of
t.log,t.fetch, and other APIs are embedded directly into the Titan Planet Binary. This SDK simply provides the "blueprints" (types) and a "sandbox" (test runner).
β¨ Features
- π Blueprint Types (IntelliSense): Provides the full TypeScript
index.d.tsfor the globaltobject so you get autocomplete in VS Code and other editors. - π‘οΈ Static Validation: Catch parameter mismatches and typos in
t.log,t.fetch,t.db, etc., during development. - π Extension Test Harness: A "lite" version of Gravity that simulates the native environment to test extensions in isolation.
- π Zero Production Trace: This is a
devDependenciespackage. It never ships with your binary, keeping your production footprint at literal zero.
π The Test Harness (Lite Gravity)
The SDK includes a specialized Test Runner. This is a "lite" version of the Titan ecosystem that acts as a bridge for developers.
How it works:
When you run the SDK in an extension folder, it:
- Scaffolds a Virtual Project: Creates a temporary, minimal Titan environment in
.titan_test_run. - Native Compilation: Automatically builds your native Rust code (
native/) if it exists. - Hot-Linking: Junctions your local extension into the virtual project's
node_modules. - Verification: Generates a test suite that attempts to call your extension's methods via the real
tobject inside the sandbox.
Usage:
# Inside your extension directory
titan run extβ¨οΈ Enabling IntelliSense
Since the t object is injected globally by Gravity at runtime, your IDE won't recognize it by default. The SDK fixes this.
-
Install the SDK:
npm install --save-dev titanpl-sdk -
Configure Types: Create or update
jsconfig.json(ortsconfig.json) in your project root:{ "compilerOptions": { "types": ["titan-sdk"] } }
Now your editor will treat t as a first-class citizen:
export function myAction(req) {
t.log.info("Request received", req.path); // Autocomplete works!
return { status: "ok" };
}π Community & Documentation
- Core Framework: Titan Planet
- Author: ezetgalaxy
@titanpl/eslint-plugin-titanpl
ESLint plugin for Titan Planet projects. Enforces Titan Planet-specific rules including blocking Node.js built-in modules that are not available in the Gravity runtime.
@titanpl/core
The official Core Standard Library for Titan Planet - a high-performance JavaScript extension for Gravity Runtime.