### Run Example Application Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Starts the Electron-based example application. ```sh npm start:electron ``` -------------------------------- ### Build and Run Theia Electron Example Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Clones the Theia repository, installs dependencies, builds the Electron example, downloads plugins, and starts the Electron application. ```sh git clone https://github.com/eclipse-theia/theia \ && cd theia \ && npm install \ && npm run build:electron \ && npm run download:plugins \ && npm run start:electron ``` -------------------------------- ### Build and Run Theia Browser Example Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Clones the Theia repository, installs dependencies, builds the browser example, downloads plugins, and starts the browser application. Access the application at http://localhost:3000. ```sh git clone https://github.com/eclipse-theia/theia \ && cd theia \ && npm install \ && npm run build:browser \ && npm run download:plugins \ && npm run start:browser ``` -------------------------------- ### Build Example Applications Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Commands to build various example applications. Use `build:applications` to build all examples at once. Ensure dependencies are installed before running these commands. ```sh npm run build:browser npm run build:browser-only npm run build:electron # build all example applications at once: npm run build:applications ``` -------------------------------- ### Run Browser-Based Example Application Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Starts the backend application for the browser-based example, making the frontend available on http://localhost:3000. Ensure you are in the `examples/browser` directory. ```sh npm run start ``` -------------------------------- ### Start Theia Browser Example App Source: https://github.com/eclipse-theia/theia/blob/master/sample-plugins/sample-namespace/plugin-browser/README.md Starts the browser example application for Theia. ```sh npm run start:browser ``` -------------------------------- ### Build Theia Electron Example Source: https://github.com/eclipse-theia/theia/blob/master/scripts/performance/README.md Installs dependencies and builds the Electron example for Theia. Run these commands in the root directory. ```bash npm install npm run build:electron ``` -------------------------------- ### Clone, Install, Build, and Start Theia on Windows Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md A comprehensive command sequence for cloning the Theia repository, installing dependencies, building the browser version, and starting the application. Requires Git Bash or a similar environment. ```sh git clone https://github.com/eclipse-theia/theia.git \ && cd theia \ && npm install \ && npm run build:browser \ && npm run start:browser ``` -------------------------------- ### Build Browser Example App Source: https://github.com/eclipse-theia/theia/blob/master/CLAUDE.md Builds all packages and bundles the Browser example app, preferred for development. ```bash npm run build:browser ``` -------------------------------- ### Launch Browser Frontend Debug Configuration Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use this configuration to debug the frontend of a browser example. Ensure the backend is started and the frontend is accessible via http://localhost:3000/. ```json { "name": "Launch Browser Frontend", "type": "chrome", "request": "launch", "url": "http://localhost:3000", "webRoot": "${workspaceFolder}/lib" } ``` -------------------------------- ### Start Electron Application Source: https://github.com/eclipse-theia/theia/blob/master/CLAUDE.md Starts the Electron application. ```bash npm run start:electron ``` -------------------------------- ### Watch Example Applications Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Rebuilds example applications when changes are detected in frontend or backend code. ```sh # either npm run watch:browser # or npm run watch:electron ``` -------------------------------- ### Build Playwright Library and Dependencies Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md Commands to navigate to the playwright examples directory and install necessary dependencies and build the library. ```bash cd examples/playwright yarn build ``` -------------------------------- ### Install Dependencies Source: https://github.com/eclipse-theia/theia/blob/master/CLAUDE.md Installs project dependencies and runs post-install hooks. ```bash npm install ``` -------------------------------- ### Build Everything Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md A comprehensive command to install dependencies, link and build TypeScript packages, perform linting, and build all example applications. This is a convenient command for a full project build. ```sh npm run all ``` -------------------------------- ### Build Playwright Library and Dependencies Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/DEVELOPING.md Navigates to the Playwright example directory, builds the Playwright library, runs tests, and installs necessary dependencies like Chromium. ```bash cd examples/playwright npm run build ``` -------------------------------- ### Run Theia Browser Example with SSL Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Builds and runs the browser example with SSL enabled. Requires specifying certificate and key paths. Access the application at https://localhost:3000. ```sh git clone https://github.com/eclipse-theia/theia \ && cd theia \ && npm install \ && npm run download:plugins \ && npm run build:browser \ && npm run start:browser -- -- --ssl --cert /path/to/cert.crt --certkey /path/to/certkey.key ``` -------------------------------- ### Rebuild Browser Native Node.js Packages Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Rollback changes to native Node.js packages for Electron before starting the browser example. Run this command from the root directory. ```sh npm run rebuild:browser ``` -------------------------------- ### Install theiaext Dependency Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/private-ext-scripts/README.md This example demonstrates how to add the '@theia/ext-scripts' package as a devDependency in a project's package.json. This makes the 'theiaext' command available for use. ```json { "name": "@theia/myextension", "devDependencies": { "@theia/ext-scripts": "^0.1.1" } } ``` -------------------------------- ### Theia 3PP License Check Script Example Source: https://github.com/eclipse-theia/theia/wiki/Dev-Meetings-2024 An example of integrating the [@eclipse-dash/nodejs-wrapper](https://www.npmjs.com/package/@eclipse-dash/nodejs-wrapper) for checking third-party licenses in a repository. ```javascript const { checkLicenses } = require('@eclipse-dash/nodejs-wrapper'); checkLicenses({ // Options }); ``` -------------------------------- ### Install synp tool for lockfile conversion Source: https://github.com/eclipse-theia/theia/wiki/Registering-CQs Installs the synp utility globally via npm to convert yarn.lock files into package-lock.json format for license analysis. ```bash npm install -g synp ``` -------------------------------- ### Start Theia Backend Server Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Starts the backend server for Theia. For the browser target, a server starts on http://localhost:3000 by default. For the Electron target, it starts on `localhost` with a dynamically allocated port. Arguments are passed directly to the server; use `--help` for supported options. ```bash theia start ``` -------------------------------- ### Prepare repository for production dependency assessment Source: https://github.com/eclipse-theia/theia/wiki/Registering-CQs Commands to clean the local environment and install production dependencies to perform a full repository license audit. ```bash # Checkout PR git checkout --track upstream/env-methods # clean state git clean -fdx # install only prod dependencies yarn install --production ``` -------------------------------- ### Install Xcode Command Line Tools on macOS Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Install the necessary Xcode command line tools on macOS for building and running Theia. ```sh xcode-select --install ``` -------------------------------- ### Example Prompt for Brave Search Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Illustrates the format of a prompt used to trigger the brave-search MCP server for web searches. ```markdown ~{mcp_brave-search_brave_web_search} ``` -------------------------------- ### Example User Query for Search Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Shows a typical user query that would invoke the search functionality provided by an MCP server. ```markdown Search the internet for XYZ ``` -------------------------------- ### Download Theia Plugins Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Downloads plugins to be used with Theia example applications. ```sh npm run download:plugins ``` -------------------------------- ### Install Windows Build Tools via PowerShell Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Manually install the necessary build tools for Node.js native modules on Windows using PowerShell. This command adds Python to the path and installs the production build tools. ```powershell npm --add-python-to-path install --global --production windows-build-tools ``` -------------------------------- ### Configure Filesystem MCP Server Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Configures the filesystem MCP server, specifying an absolute path to an allowed directory. Uses npx for installation and execution. ```json { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "ABSOLUTE_PATH_TO_ALLOWED_DIRECTORY" ] } } ``` -------------------------------- ### Log Message Format Example Source: https://github.com/eclipse-theia/theia/blob/master/packages/core/README_TEMPLATE.md Example of a Theia log message, showing the logger name ('root') and log level ('INFO'). Optionally, child process name and PID may follow. ```text root INFO [parcel-watcher: 10734] Started watching: /Users/captain.future/git/theia/CONTRIBUTING.md ``` -------------------------------- ### Run Theia API Tests Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Starts the backend server and runs API tests against it. The command terminates after tests are completed. It accepts arguments similar to the `start` command, plus additional options for specifying test files, enabling inspection, or generating test coverage. ```bash theia test ``` -------------------------------- ### Configure Memory MCP Server Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Defines the configuration for the memory MCP server using npx to install and run the server. Autostart is disabled by default. ```json { "ai-features.mcp.mcpServers": { "memory": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-memory" ], "autostart": false } } } ``` -------------------------------- ### Initialize Theia Playwright Template Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md Commands to clone the official template repository and install necessary dependencies using yarn. ```bash git clone git@github.com:eclipse-theia/theia-playwright-template.git cd theia-playwright-template yarn ``` -------------------------------- ### Implement Theia Text Editor System Test Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md A Playwright test example demonstrating how to open a workspace, manipulate text editor content, perform undo/redo operations, and verify dirty states. ```typescript test('should undo and redo text changes and correctly update the dirty state', async ({ playwright, browser }) => { // 1. set up workspace contents and open Theia app const ws = new TheiaWorkspace([path.resolve(__dirname, 'resources/sample-files1']); app = await TheiaAppLoader.load( { playwright, browser }, ws); // 2. open Theia text editor const sampleTextEditor = await app.openEditor( 'sample.txt', TheiaTextEditor ); // 3. make a change and verify contents and dirty await sampleTextEditor.replaceLineWithLineNumber('change', 1); expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( 'change' ); expect(await sampleTextEditor.isDirty()).toBe(true); // 4. undo and verify contents and dirty state await sampleTextEditor.undo(2); expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( 'this is just a sample file' ); expect(await sampleTextEditor.isDirty()).toBe(false); // 5. undo and verify contents and dirty state await sampleTextEditor.redo(2); expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( 'change' ); expect(await sampleTextEditor.isDirty()).toBe(true); // 6. save verify dirty state await sampleTextEditor.save(); expect(await sampleTextEditor.isDirty()).toBe(false); await sampleTextEditor.close(); // 7. reopen editor and verify dirty state const reopenedEditor = await app.openEditor('sample.txt', TheiaTextEditor); expect(await reopenedEditor.textContentOfLineByLineNumber(1)).toBe( 'change' ); await reopenedEditor.close(); }); ``` -------------------------------- ### Publish Release Locally Source: https://github.com/eclipse-theia/theia/blob/master/doc/Publishing.md Example of a local publishing run using npm and lerna. Ensure you are logged into NPM and have your 2FA ready. The `--yes` parameter can be removed to confirm each step. ```bash npm run publish:next lerna notice ... lerna info Found 1 package to publish: - @theia/some-package => x.y.z ✔ Are you sure you want to publish these packages? Yes lerna info publish Publishing packages to npm... ✔ This operation requires a one-time password: lerna success published @theia/some-package x.y.z lerna notice lerna notice 📦 @theia/some-package@x.y.z lerna notice === Tarball Contents === ... lerna notice Successfully published: - @theia/some-package@x.y.z lerna success published 1 package Done in ...s. ``` -------------------------------- ### Configure Git MCP Server (uv) Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Sets up the git MCP server using the 'uv' command to run 'mcp-server-git' within a specified repository directory. ```json { "git": { "command": "uv", "args": [ "--directory", "/path/to/repo", "run", "mcp-server-git" ] } } ``` -------------------------------- ### Run Playwright Tests in UI Mode Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md Executes the UI tests using the Playwright UI mode, which provides a visual interface for watching and tracing test execution. ```bash yarn ui-tests --ui ``` -------------------------------- ### Accessing Exported Plugin API in JavaScript Source: https://github.com/eclipse-theia/theia/blob/master/packages/plugin/README.md Shows how another plugin can retrieve and use the exported API from a previously started plugin. It uses 'theia.plugins.getPlugin' to get the plugin instance and access its 'exports'. ```javascript let mathExt = theia.plugins.getPlugin('genius.math'); let importedApi = mathExt.exports; console.log(importedApi.mul(42, 1)); ``` -------------------------------- ### Launch Browser Backend Debug Configuration Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use this configuration to debug the backend of a browser example. Open the debug view and run the 'Launch Browser Backend' configuration. ```json { "name": "Launch Browser Backend", "request": "launch", "type": "node", "program": "${workspaceFolder}/lib/server.js", "args": [ "--inspect=9229" ], "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/lib/**/*.js" ], "internalConsoleOptions": "openOnSessionStart" } ``` -------------------------------- ### Launch Electron Backend Debug Configuration Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use this configuration to debug the backend of an Electron example. Open the debug view and run the 'Launch Electron Backend' configuration. ```json { "name": "Launch Electron Backend", "type": "node", "request": "launch", "program": "${workspaceFolder}/node_modules/electron/dist/Electron.js", "args": [ "${workspaceFolder}/lib/main.js", "--inspect=9229" ], "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/lib/**/*.js" ], "internalConsoleOptions": "openOnSessionStart" } ``` -------------------------------- ### Run 3PP License Check with Theia Source: https://github.com/eclipse-theia/theia/wiki/Eclipse-Theia-contributors:-Intellectual-Property-(IP)-guide These npm scripts in package.json are used to execute the third-party license check. The `license:check` script runs a standard check, while `license:check:review` enables the auto-review mode, which can automatically open IP check tickets on GitLab for non-compliant dependencies. This requires Node.js to be installed. ```json { "license:check": "node scripts/check_3pp_licenses.js", "license:check:review": "node scripts/check_3pp_licenses.js --review" } ``` -------------------------------- ### Install Dependencies and Compile TypeScript Packages Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use these commands to download all necessary dependencies and build all TypeScript packages within the project. This is a foundational step for most development tasks. ```sh npm install npm run compile ``` -------------------------------- ### Configure Git MCP Server (uvx) Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Configures an alternative git MCP server using 'uvx' to run 'mcp-server-git' with a specified repository path. ```json { "git2": { "command": "uvx", "args": [ "mcp-server-git", "--repository", "/path/to/otherrepo" ] } } ``` -------------------------------- ### Copy Plugin to Plugins Directory Source: https://github.com/eclipse-theia/theia/blob/master/sample-plugins/sample-namespace/plugin-browser/README.md Copies the plugin-browser sample to the deployed plugins directory. ```sh cp -r sample-plugins/sample-namespace/plugin-browser plugins/ ``` -------------------------------- ### Launch VS Code Extension as Theia Plugin Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Launch configuration to start the backend process and connect on port 9339 to debug the plugin-host sub-process. The plugin source repository should be under `${workspaceFolder}/plugins`. ```json { "name": "Launch VS Code extension as Theia plugin", "type": "node", "request": "launch", "port": 9339, "timeout": 100000, "args": [ "${workspaceFolder}/examples/browser/src-gen/backend/main.js", "${workspaceFolder}", "--port=3030", "--hosted-plugin-inspect=9339", "--plugins=local-dir:${workspaceFolder}/plugins" ], "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/**/*.js" ], "internalConsoleOptions": "openOnSessionStart", "outputCapture": "std" } ``` -------------------------------- ### Install npm Packages with Unsafe Perms Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use the --unsafe-perm flag during npm installation to bypass root privilege errors. ```sh npm install --unsafe-perm ``` -------------------------------- ### Configure Brave Search MCP Server Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Sets up the brave-search MCP server, requiring a BRAVE_API_KEY environment variable for authentication. Uses npx to install and run. ```json { "brave-search": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-brave-search" ], "env": { "BRAVE_API_KEY": "YOUR_API_KEY" } } } ``` -------------------------------- ### Install Theia CLI as a development dependency Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Install the @theia/cli package using popular Node.js package managers to enable Theia development scripts. ```bash yarn add @theia/cli@next --dev ``` ```bash npm install @theia/cli@next --save-dev ``` -------------------------------- ### Factory with Runtime Parameters Source: https://github.com/eclipse-theia/theia/blob/master/doc/coding-guidelines.md Demonstrates how to use a factory pattern for classes requiring runtime parameters, using an options object. This example is inspired by the process task runner. ```typescript export const TaskProcessOptions = Symbol('TaskProcessOptions'); export interface TaskProcessOptions { label: string; process: Process; } @injectable() export class ProcessTask { constructor(@inject(TaskProcessOptions) protected readonly options: TaskProcessOptions) { } } export const TaskFactory = Symbol('TaskFactory'); export type TaskFactory = (options: TaskProcessOptions) => ProcessTask; @injectable() export class ProcessTaskRunner { @inject(TaskFactory) protected readonly taskFactory: TaskFactory; protected createTask(task: TaskConfiguration, process: Process): ProcessTask { return this.taskFactory({ label: task.label, process }); } } bind(ProcessTask).toSelf(); bind(TaskFactory).toFactory(ctx => (options: TaskProcessOptions) => { const child = new Container({ defaultScope: 'Singleton' }); child.parent = ctx.container; child.bind(TaskProcessOptions).toConstantValue(options); return child.get(ProcessTask); }); ``` -------------------------------- ### Rebuild All Packages Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Rebuilds all TypeScript code and example applications in the monorepo. ```sh npm run build ``` -------------------------------- ### GET /files/ Source: https://github.com/eclipse-theia/theia/blob/master/packages/filesystem/src/common/download/README.md Downloads a single file or a directory as a tar archive. ```APIDOC ## GET /files/ ### Description Downloads a single file or a directory. Folders are automatically compressed into tar archives. ### Method GET ### Endpoint /files/ ### Parameters #### Query Parameters - **uri** (string) - Required - The encoded URI of the file or directory to download. ### Request Example GET http://localhost:3000/files/?uri=file:///path/to/resource ### Response #### Success Response (200) - **file/archive** (binary) - The requested file or tar archive. #### Response Example Binary stream of file content. ```