Kernel.js is a command-line process manager written in JavaScript. It simulates a basic operating system environment, allowing users to manage processes within virtual folders. Users can start processes, list them, and stop them using simple commands, all through a command-line interface embedded in a web application.
- Start Processes: Launch processes inside virtual folders.
- List Processes: View all running processes within a specific folder.
- Stop Processes: Stop a process by its unique ID.
- Command-Line Interface: A terminal-like interface for interacting with the system.
The project is organized as follows:
/project-root
├── /src/ # Source files (for production code)
│ ├── /styles # CSS/Styling
│ │ └── stylus.css # Styling for the application
│ ├── /scripts # JavaScript files
│ │ └── kernel.js # Core logic for process management
│ └── /markup # HTML files
│ └── index.html # Main HTML file with the UI
├── /test # Test files
│ └── kernelTests.js # Unit tests for Kernel.js functionality
├── /docs # Documentation (README, Contribution Guidelines, etc.)
│ └── README.md # Project Overview and Instructions
├── /public # Public assets (images, icons, etc.)
│ └── /images # Store images/icons here
├── package.json # Project metadata and dependencies (if using npm)
├── .gitignore # Git ignore file to exclude unnecessary files
└── LICENSE # License for the project
Before you begin, make sure you have the following installed:
- Node.js (v16.x or higher)
- npm (Node Package Manager)
-
Clone the repository:
git clone https://github.com/pawvan/kernel.js.git cd kernel.js -
Install dependencies: If your project requires any dependencies, install them using:
npm install
-
Run the application: Open the
src/markup/index.htmlfile in your web browser. This will load the UI and allow you to interact with the command-line interface. -
Test the setup: Run the kernel.js script to check if everything is working:
node src/scripts/kernel.js
-
Start a Process:
start /folder_name process_name
Example:
start /folder1 process1
This command starts a process named
process1in the/folder1folder. -
List Running Processes in a Folder:
list /folder_name
Example:
list /folder1
This will display all processes currently running in
/folder1. -
Stop a Process by ID:
stop /folder_name process_id
Example:
stop /folder1 1234567890
This will stop the process with ID
1234567890in the/folder1folder.
-
Start a process:
start /folder1 process1
-
List processes:
list /folder1
-
Stop a process by ID:
stop /folder1 1234567890
To ensure that the core functionality works as expected, unit tests are provided in the /test directory.
Run the tests by executing the following command:
npm testimport { kernel } from '../src/scripts/kernel.js';
test('Starting, listing, and stopping processes', () => {
let result = kernel.handleCommand('start /folder1 process1');
expect(result).toContain('Started process: process1');
result = kernel.handleCommand('list /folder1');
expect(result).toContain('process1');
const processId = kernel.folders['/folder1'][0].id;
result = kernel.handleCommand(`stop /folder1 ${processId}`);
expect(result).toContain('Stopped process');
});- Add Decoding: Implement the decoding functionality to convert byte sequences back into the original string (coming soon).
- Expand Process Management: Implement features such as pausing and resuming processes.
- Enhance User Interface: Improve the UI for better user interaction and visual feedback.
- Cross-platform Support: Ensure the command-line interface works on all major operating systems (Windows, macOS, Linux).
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/my-new-feature). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature/my-new-feature). - Create a pull request.
Please ensure that your code adheres to the existing style and includes relevant tests.
This project is licensed under the MIT License. See the LICENSE file for details.
- JavaScript Documentation: MDN JavaScript
- Node.js Documentation: Node.js
If you have any questions or feedback, feel free to reach out:
- Email: [email protected]
- GitHub: github.com/pawvan/kernel.js
- Kernel.js is a lightweight process manager with a simple, easy-to-use command-line interface.
- The UI is built using HTML, CSS, and JavaScript, offering an interactive command-line simulation.
- Unit tests are included to verify functionality and ensure everything works as expected.