Capability first · transport second

TerminalCommandRegistry.js

Routes parsed command lines to injected handlers and provides definitions/completions.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
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

JavaScript
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

BindingFormDeclaration or signatureParameter syntax
splitCommandLinefunctionfunction splitCommandLine(input='')input=''
defaultdefault · classclass TerminalCommandRegistry
CallableKindExact public signatureParameter syntax
splitCommandLineexported-functionfunction splitCommandLine(input='')input=''
MemberKindExact public declarationParameter syntax
TerminalCommandRegistry.constructorconstructorconstructor(commands=[])commands=[]
TerminalCommandRegistry.registermethodregister({name,aliases=[],description='',usage='',run}={}){name,aliases=[],description='',usage='',run}={}
TerminalCommandRegistry.resolvemethodresolve(name)name
TerminalCommandRegistry.definitionsmethoddefinitions()
TerminalCommandRegistry.completionsmethodcompletions(prefix='')prefix=''
TerminalCommandRegistry.executeasync methodasync 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

JavaScript
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'));

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.