summaryrefslogtreecommitdiff
path: root/packages/cli/src/services/CommandService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/services/CommandService.ts')
-rw-r--r--packages/cli/src/services/CommandService.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/cli/src/services/CommandService.ts b/packages/cli/src/services/CommandService.ts
new file mode 100644
index 00000000..588eabf7
--- /dev/null
+++ b/packages/cli/src/services/CommandService.ts
@@ -0,0 +1,36 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { SlashCommand } from '../ui/commands/types.js';
+import { memoryCommand } from '../ui/commands/memoryCommand.js';
+import { helpCommand } from '../ui/commands/helpCommand.js';
+import { clearCommand } from '../ui/commands/clearCommand.js';
+
+const loadBuiltInCommands = async (): Promise<SlashCommand[]> => [
+ clearCommand,
+ helpCommand,
+ memoryCommand,
+];
+
+export class CommandService {
+ private commands: SlashCommand[] = [];
+
+ constructor(
+ private commandLoader: () => Promise<SlashCommand[]> = loadBuiltInCommands,
+ ) {
+ // The constructor can be used for dependency injection in the future.
+ }
+
+ async loadCommands(): Promise<void> {
+ // For now, we only load the built-in commands.
+ // File-based and remote commands will be added later.
+ this.commands = await this.commandLoader();
+ }
+
+ getCommands(): SlashCommand[] {
+ return this.commands;
+ }
+}