Skip to content

Commit 28aafd7

Browse files
committed
docs: clarify skill.when scope
1 parent 73d60e3 commit 28aafd7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ function logHelpMessage(
124124
extraSkills?: ExtraSkill[],
125125
) {
126126
const toolsList = [...BUILTIN_TOOLS];
127+
// Keep help output exhaustive for discoverability. `skill.when` only gates
128+
// the interactive prompt, not the documented list of available skills.
127129
const skillsList = (extraSkills ?? [])
128130
.map((skill) => skill.value)
129131
.filter(Boolean);
@@ -236,6 +238,8 @@ function filterExtraSkills(
236238
templateName?: string,
237239
tools: string[] = [],
238240
) {
241+
// `skill.when` only affects the interactive prompt. Explicit `--skill`
242+
// values are handled separately in `getSkills`.
239243
return extraSkills?.filter((extraSkill) => {
240244
const when = extraSkill.when ?? (() => true);
241245
return templateName ? when(templateName, tools) : true;
@@ -265,6 +269,8 @@ async function getSkills(
265269
const filteredExtraSkills = filterExtraSkills(extraSkills, templateName, tools);
266270

267271
if (parsedSkills !== null) {
272+
// Treat explicit `--skill` values as authoritative as long as they refer to
273+
// a declared skill. `skill.when` only hides options from the prompt.
268274
return parsedSkills.filter((value: string) =>
269275
extraSkills?.some((extraSkill) => extraSkill.value === value),
270276
);
@@ -369,6 +375,11 @@ type ExtraSkill = {
369375
label: string;
370376
source: string;
371377
skill?: string;
378+
/**
379+
* Controls whether the skill is shown in the interactive prompt for the
380+
* selected template/tools. Explicit `--skill` values and `--help` remain
381+
* unfiltered so CLI input stays authoritative and help stays discoverable.
382+
*/
372383
when?: (templateName: string, tools: string[]) => boolean;
373384
order?: 'pre' | 'post';
374385
};

0 commit comments

Comments
 (0)