Skip to content

Commit e418845

Browse files
committed
feat(templates): add command to list available workflow template names
1 parent 7fce4a8 commit e418845

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/cli/commands/templates.command.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import type { SelectionChoice } from '../utils/selection-menu.js';
1010
import { isModuleStep } from '../../workflows/templates/types.js';
1111
import { resolvePackageRoot } from '../../shared/runtime/root.js';
1212
import { getAllInstalledImports } from '../../shared/imports/index.js';
13-
import { runInteractiveImport } from './import.command.js';
1413
import { registerImportedAgents, clearImportedAgents } from '../../workflows/utils/config.js';
1514

1615
const packageRoot = resolvePackageRoot(import.meta.url, 'templates command');
@@ -176,6 +175,19 @@ export async function selectTemplateByNumber(templateNumber: number): Promise<vo
176175
}
177176
}
178177

178+
export async function listTemplates(): Promise<void> {
179+
const templates = await getAvailableTemplates();
180+
181+
if (templates.length === 0) {
182+
console.log('No workflow templates found.');
183+
return;
184+
}
185+
186+
for (const t of templates) {
187+
console.log(t.title);
188+
}
189+
}
190+
179191
export async function runTemplatesCommand(inSession: boolean = false): Promise<void> {
180192
try {
181193
const templates = await getAvailableTemplates();
@@ -221,8 +233,13 @@ export async function runTemplatesCommand(inSession: boolean = false): Promise<v
221233
}
222234

223235
export function registerTemplatesCommand(program: Command): void {
224-
program
236+
const templates = program
225237
.command('templates')
226238
.description('List and select workflow templates')
227239
.action(runTemplatesCommand);
240+
241+
templates
242+
.command('list')
243+
.description('List available template names')
244+
.action(listTemplates);
228245
}

0 commit comments

Comments
 (0)