ConstLang v7.0 Terminal
Interactive CLI Commands Reference
📋 Available Commands
1. Version & Info
Constlang >> constlang version
version: v7.0
Displays the installed ConstLang version.
2. Terminal Control
Constlang >> clear
// Clears all terminal output
Constlang >> cls
// Same as clear (Windows style)
Clear terminal history and start fresh.
3. Project Management
Constlang >> cpm new --app
// Creates new console application project
Constlang >> cpm new --go
// Creates Windows GUI project
Constlang >> cpm new --web
// Creates ASP.NET Core web project
Constlang >> cpm new --bat
// Creates Linux application
Constlang >> cpm new --sh
// Creates macOS application
Create new projects with different platform targets. A project compiler is dynamically loaded from compilers/[type]compiler.js.
4. Building & Compilation
Constlang >> constlang build
Compiling source files...
// [Waits 700ms for compilation simulation]
Build completed.
Constlang >> constlang build --app
// Builds and initializes app compiler
Compile your ConstLang source files to C#. The --app flag triggers compiler.start().
5. Package Management (CPM)
Constlang >> cpm install -url:https://example.com/package.clg
// Installs package from URL
Constlang >> cpm install -github:user/repo
// Installs from GitHub repository
// URL becomes: https://raw.githubusercontent.com/user/repo
Constlang >> cpm install -tool:formatter
// Installs development tool from tools/ directory
Install packages and dependencies using the ConstLang Package Manager.
6. Platform Commands
Constlang >> linux ls -la
Pocket-Forward: Linux ls -la
// Executes bash command on Linux
Constlang >> windows dir /s
Pocket-Forward: Windows dir /s
// Executes batch command on Windows
Constlang >> macos ls -la
Pocket-Forward: Macos ls -la
// Executes shell command on macOS
Run platform-specific system commands. Routes to system.run.sh(), system.run.bat(), or system.run.command().
7. Folder Information
Constlang >> folder
folder: /path/to/project
// Shows current working directory
Display the current project folder path. Uses window.dirHandle or global dirHandle.
8. Script Files (.csdf)
Constlang >> // Script execution via IPC
[Shell] .csdf file (5 lines)...
Constlang (Script) >> command 1
Constlang (Script) >> command 2
Constlang (Script) >> command 3
[Shell] Script loadend
Execute .csdf script files. Lines starting with // or # are ignored. Scripts are executed with 150ms delay between commands.
📊 Command Structure Reference
| Command |
Format |
Purpose |
Handler |
constlang version |
Simple |
Show version |
Direct output |
clear / cls |
Simple |
Clear history |
Clear HTML |
cpm new --[type] |
Type-based |
Create project |
Load compiler JS |
constlang build |
Optional flags |
Compile code |
Simulation + compiler |
[linux/windows/macos] [cmd] |
Prefix + args |
System commands |
system.run.* |
cpm install -[type]:[value] |
Flag-based |
Install package |
cpm.install() |
folder |
Simple |
Show path |
Direct output |
🔧 Terminal Features
Input Display System
How Input Works:
• Real input: #cmd-input (transparent, z-index: 5)
• Display helper: #input-helper (mirrors input, z-index: 1)
• Cursor: blinking animation (z-index: 2)
• This creates seamless overlay effect
Command Processing Flow
1. User types and presses Enter
2. executeCommand(raw) is called
3. Command is matched against conditions
4. Appropriate handler executes (system call, compiler load, etc.)
5. Output is printed to history
6. Terminal scrolls to bottom
Color Scheme
| Element |
Color |
Usage |
| Prompt |
#65e459 (Green) |
Command prefix |
| Text |
#cccccc (Gray) |
Default output |
| Library Calls |
#3b82f6 (Blue) |
System operations |
| Success |
#22a559 (Green) |
Successful operations |
| Error |
#f85149 (Red) |
Error messages |
💡 Advanced Usage Examples
Example 1: Create and Build a Project
Constlang >> cpm new --app
// Project created
Constlang >> constlang build --app
Compiling source files...
Build completed.
Example 2: Install Package from GitHub
Constlang >> cpm install -github:exemple/exemple-lib/lib.nat
// Fetches from: https://raw.githubusercontent.com/ilkin/constlang-math
Example 3: Execute System Commands
Constlang >> linux npm install
Pocket-Forward: Linux npm install
Constlang >> windows pip install numpy
Pocket-Forward: Windows pip install numpy
Example 4: Run Script File
[Shell] .csdf file (8 lines)...
Constlang (Script) >> cpm new --app TestProject
Constlang (Script) >> constlang build
Constlang (Script) >> linux ls -la
[Shell] Script loadend
⚙️ Technical Details
Electron Integration
The terminal uses Electron's ipcRenderer for IPC communication:
// Listen for script execution from main process
ipcRenderer.on('run-csdf-script', async (event, content) => { ... })
Dynamic Compiler Loading
When cpm new --[type] is executed:
const s = document.body.appendChild(document.createElement('script'));
s.src = `compilers/${type}compiler.js`;
s.onload = () => { if(typeof compiler !== 'undefined') compiler.add(); };
Command Router Logic
Commands are processed in this order:
- Platform commands (linux/windows/macos)
- Package manager (cpm install)
- Terminal control (clear/cls)
- Build commands
- Project creation (cpm new)
- Version/info
- Fallback: Send to system
🎯 Tips for Effective Usage:
• Use clear to reset terminal state
• Check folder to verify working directory
• Platform commands work on installed tools only
• Script files can chain multiple commands
• Terminal focuses automatically on click