- Reworked internal signals

- Separated input passing from signal calling
- Exposed command registry to the broader codebase
- Moved command execution call to internal shell logic
- TTY is now expected to watch for stdout escape sequences to perform tasks
This commit is contained in:
2026-11-23 13:31:22 +01:00
parent dbffe5375e
commit 41739d7cf9
15 changed files with 191 additions and 133 deletions
+27
View File
@@ -0,0 +1,27 @@
import type { CommandDescriptor, CommandOutput } from "@core/command";
import type { CommandIO } from "@core/command_io";
import { COMMAND_REGISTRY } from "@core/command_registry";
import { createSuccessResult, type ResultSuccess } from "@core/result";
import type { ShellState } from "@core/shell_state";
import type { ShellError } from "@core/util/errors";
export const COMMAND_NAME = "help";
async function main(io: CommandIO, state: ShellState, args: string[]): Promise<CommandOutput<ShellError>> {
const e = new TextEncoder();
for (const entry of COMMAND_REGISTRY.keys()) {
io.writeStdout(e.encode(` ${entry}\n`));
}
const result: ResultSuccess = createSuccessResult(COMMAND_NAME);
return {
state: state,
result,
};
}
export const descriptor: CommandDescriptor = {
fn: main,
name: COMMAND_NAME,
};