mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-20 10:06:54 +03:00
Auto-generate argument hint with all commands grouped by category
The static "[command] [target]" hint didn't help users discover available commands. The build now reads command-metadata.json and groups commands by category (from SKILL_CATEGORIES) with middle-dot separators for natural line-breaking in the prompt bar. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
455fe39155
commit
e4d1d96926
@@ -43,7 +43,7 @@ const EXCLUDED_SKILLS = new Set([
|
||||
* Mirrors public/js/data.js commandCategories. Validated below: the
|
||||
* generator fails if any user-invocable skill is missing from this map.
|
||||
*/
|
||||
const SKILL_CATEGORIES = {
|
||||
export const SKILL_CATEGORIES = {
|
||||
// CREATE - build something new
|
||||
impeccable: 'create',
|
||||
craft: 'create',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import path from 'path';
|
||||
import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceholders } from '../utils.js';
|
||||
import { SKILL_CATEGORIES, CATEGORY_ORDER } from '../sub-pages-data.js';
|
||||
|
||||
/**
|
||||
* Map from frontmatter field name to extraction spec.
|
||||
@@ -86,6 +87,24 @@ export function createTransformer(config) {
|
||||
if (val) frontmatterObj[spec.yamlKey] = val;
|
||||
}
|
||||
|
||||
// Replace {{command_hint}} in argument-hint with command names from metadata,
|
||||
// grouped by category with middle dots between groups for natural line-breaking.
|
||||
if (frontmatterObj['argument-hint']?.includes('{{command_hint}}')) {
|
||||
const metaScript = skill.scripts?.find(s => s.name === 'command-metadata.json');
|
||||
if (metaScript) {
|
||||
const commands = Object.keys(JSON.parse(metaScript.content));
|
||||
// Derive groups from SKILL_CATEGORIES, excluding the parent skill name
|
||||
const grouped = CATEGORY_ORDER
|
||||
.map(cat => commands.filter(c => SKILL_CATEGORIES[c] === cat).join('|'))
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
frontmatterObj['argument-hint'] = frontmatterObj['argument-hint'].replace(
|
||||
'{{command_hint}}',
|
||||
grouped
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const frontmatter = generateYamlFrontmatter(frontmatterObj);
|
||||
|
||||
// Build body
|
||||
|
||||
Reference in New Issue
Block a user