Skip to content

Commit f19c444

Browse files
chore: fix for issues found in QA
1 parent 6ee56bf commit f19c444

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/commands/agent/generate/authoring-bundle.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
6363
private static readonly FLAGGABLE_PROMPTS = {
6464
name: {
6565
message: messages.getMessage('flags.name.summary'),
66-
validate: (d: string): boolean | string => d.length > 0 || 'Name cannot be empty',
66+
validate: (d: string): boolean | string =>
67+
d.trim().length > 0 || 'Name cannot be empty or contain only whitespace',
6768
required: true,
6869
},
6970
'api-name': {

src/flags.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ export function makeFlags<T extends Record<string, FlaggablePrompt>>(flaggablePr
9191
) as FlagsOfPrompts<T>;
9292
}
9393

94+
export async function getHiddenDirs(projectRoot?: string): Promise<string[]> {
95+
const rootDir = projectRoot ?? process.cwd();
96+
97+
try {
98+
const files = await readdir(rootDir, { withFileTypes: true });
99+
return files.filter((file) => file.isDirectory() && file.name.startsWith('.')).map((file) => file.name);
100+
} catch (error) {
101+
return [];
102+
}
103+
}
104+
94105
export async function traverseForFiles(dir: string, suffixes: string[], excludeDirs?: string[]): Promise<string[]> {
95106
const files = await readdir(dir, { withFileTypes: true });
96107
const results: string[] = [];
@@ -141,7 +152,8 @@ export const promptForAiEvaluationDefinitionApiName = async (
141152
};
142153

143154
export const promptForYamlFile = async (flagDef: FlaggablePrompt): Promise<string> => {
144-
const yamlFiles = await traverseForFiles(process.cwd(), ['.yml', '.yaml'], ['node_modules']);
155+
const hiddenDirs = await getHiddenDirs();
156+
const yamlFiles = await traverseForFiles(process.cwd(), ['.yml', '.yaml'], ['node_modules', ...hiddenDirs]);
145157
return autocomplete({
146158
message: flagDef.message,
147159
// eslint-disable-next-line @typescript-eslint/require-await

0 commit comments

Comments
 (0)