Aller au contenu

Build extensions and custom tools

Ce contenu n’est pas encore disponible dans votre langue.

Extensions load TypeScript behavior with --extension or --hook; project discovery can also load extensions, tools, hooks, commands, and rules under .xcsh/.

Load one explicit file with -e <PATH> and disable discovery with --no-extensions. Confirm its registered command or tool, then test shutdown and error handling.

Hooks observe or alter lifecycle events; rules add durable instructions. Keep each rule narrow and each hook deterministic. Use --no-rules to prove whether a rule changes the result.

Start from a temporary extension that registers one uniquely named capability. Launch xcsh --no-extensions -e ./path/to/extension.ts, invoke that capability, and then exit the session to exercise teardown. The extension runs with the xcsh process account and can create the same local or remote side effects as its code; review it before loading. Delete the temporary file and repeat without -e to confirm discovery no longer exposes it.