On this page
Overview
Routes parsed command lines to injected handlers and provides definitions/completions.
- Artifact
TerminalCommandRegistry.js· esm - Classification
public first party - Availability
Cross-host - Normalization
Parsing/routing normalized; handler result/error preserved.
Import and lifecycle
import * as module from '/arcane/modules/TerminalCommandRegistry.js';
Pure parser/registry. execute() invokes only the registered injected handler and awaits it; it makes no native terminal call by itself.
Application-facing behavior: default registry, splitCommandLine(), register/resolve/definitions/completions/execute APIs.
Protocol and host implementation
Injected handlers This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
splitCommandLine | function | function splitCommandLine(input='') | input='' |
default | default · class | class TerminalCommandRegistry | — |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
splitCommandLine | exported-function | function splitCommandLine(input='') | input='' |
| Member | Kind | Exact public declaration | Parameter syntax |
|---|---|---|---|
TerminalCommandRegistry.constructor | constructor | constructor(commands=[]) | commands=[] |
TerminalCommandRegistry.register | method | register({name,aliases=[],description='',usage='',run}={}) | {name,aliases=[],description='',usage='',run}={} |
TerminalCommandRegistry.resolve | method | resolve(name) | name |
TerminalCommandRegistry.definitions | method | definitions() | — |
TerminalCommandRegistry.completions | method | completions(prefix='') | prefix='' |
TerminalCommandRegistry.execute | async method | async execute(line,context={}) | line,context={} |
Parameter meanings and results
splitCommandLine(input) returns argv with quote/backslash handling. new Registry(commands); register({name,aliases?,description?,usage?,run}); resolve(); definitions(); completions(prefix); execute(line,context) resolves {handled:false} or {handled:true,value}.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
This artifact has no additional documented lifecycle event flow.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
- TypeError for invalid/duplicate command/alias or missing run().
- Handler errors propagate.
Availability and capabilities
Cross-host. Parsing/routing normalized; handler result/error preserved.
None; injected handlers retain their own authority.
Contract example
import Registry from '/arcane/modules/TerminalCommandRegistry.js';
const commands = new Registry([{
name:'greet',
run:({args}) => 'Hello ' + (args[0] ?? 'world')
}]);
console.log(await commands.execute('greet Arcane'));
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.