Skip to content

The design language that makes your AI harness better at design.

JavaScript

Merge main and integrate command_prefix support into factory

Paul Bakaus7c208cdfbb20
diff --cc .codex/skills/audit/SKILL.md
index 48ab66d54,ac09ebc59..1fdb07106
--- a/.codex/skills/audit/SKILL.md
+++ b/.codex/skills/audit/SKILL.md
@@@ -67,7 -67,7 +67,7 @@@ For each issue, document
- **Impact**: How it affects users
- **WCAG/Standard**: Which standard it violates (if applicable)
- **Recommendation**: How to fix it
--- **Suggested command**: Which command to use (prefer: /animate, /quieter, /optimize, /adapt, /clarify, /distill, /delight, /onboard, /normalize, /audit, /harden, /polish, /extract, /bolder, /arrange, /typeset, /critique, /colorize, /overdrive — or other installed skills you're sure exist)
++- **Suggested command**: Which command to use (prefer: $animate, $quieter, $optimize, $adapt, $clarify, $distill, $delight, $onboard, $normalize, $audit, $harden, $polish, $extract, $bolder, $arrange, $typeset, $critique, $colorize, $overdrive — or other installed skills you're sure exist)
#### Critical Issues
[Issues that block core functionality or violate WCAG A]
@@@ -104,12 -104,12 +104,12 @@@ Create actionable plan
### Suggested Commands for Fixes
--Map issues to available commands. Prefer these: /animate, /quieter, /optimize, /adapt, /clarify, /distill, /delight, /onboard, /normalize, /audit, /harden, /polish, /extract, /bolder, /arrange, /typeset, /critique, /colorize, /overdrive. You may also suggest other installed skills you're sure exist, but never invent commands.
++Map issues to available commands. Prefer these: $animate, $quieter, $optimize, $adapt, $clarify, $distill, $delight, $onboard, $normalize, $audit, $harden, $polish, $extract, $bolder, $arrange, $typeset, $critique, $colorize, $overdrive. You may also suggest other installed skills you're sure exist, but never invent commands.
Examples:
--- "Use `/normalize` to align with design system (addresses N theming issues)"
--- "Use `/optimize` to improve performance (addresses N performance issues)"
--- "Use `/harden` to improve resilience (addresses N edge cases)"
++- "Use `$normalize` to align with design system (addresses N theming issues)"
++- "Use `$optimize` to improve performance (addresses N performance issues)"
++- "Use `$harden` to improve resilience (addresses N edge cases)"
**IMPORTANT**: Be thorough but actionable. Too many low-priority issues creates noise. Focus on what actually matters.
diff --cc .codex/skills/critique/SKILL.md
index 6077c439a,615b3586b..1cf158408
--- a/.codex/skills/critique/SKILL.md
+++ b/.codex/skills/critique/SKILL.md
@@@ -98,7 -98,7 +98,7 @@@ For each issue
- **What**: Name the problem clearly
- **Why it matters**: How this hurts users or undermines goals
- **Fix**: What to do about it (be concrete)
--- **Command**: Which command to use (prefer: /animate, /quieter, /optimize, /adapt, /clarify, /distill, /delight, /onboard, /normalize, /audit, /harden, /polish, /extract, /bolder, /arrange, /typeset, /critique, /colorize, /overdrive — or other installed skills you're sure exist)
++- **Command**: Which command to use (prefer: $animate, $quieter, $optimize, $adapt, $clarify, $distill, $delight, $onboard, $normalize, $audit, $harden, $polish, $extract, $bolder, $arrange, $typeset, $critique, $colorize, $overdrive — or other installed skills you're sure exist)
### Minor Observations
Quick notes on smaller issues worth addressing.
diff --cc scripts/lib/transformers/factory.js
index df7e535f7,000000000..145bdd3dc
mode 100644,000000..100644
--- a/scripts/lib/transformers/factory.js
+++ b/scripts/lib/transformers/factory.js
@@@ -1,113 -1,0 +1,114 @@@
+import path from 'path';
- import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceholders, prefixSkillReferences } from '../utils.js';
++import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceholders, prefixSkillReferences, PROVIDER_PLACEHOLDERS } from '../utils.js';
+
+/**
+ * Map from frontmatter field name to extraction spec.
+ *
+ * - sourceKey: property name on the skill object
+ * - yamlKey: key name in YAML frontmatter
+ * - condition: if provided, field is only emitted when this returns true
+ * - value: if provided, use this instead of skill[sourceKey]
+ */
+const FIELD_SPECS = {
+ 'user-invocable': {
+ sourceKey: 'userInvocable',
+ yamlKey: 'user-invocable',
+ condition: (skill) => skill.userInvocable,
+ value: () => true,
+ },
+ 'argument-hint': {
+ sourceKey: 'argumentHint',
+ yamlKey: 'argument-hint',
+ condition: (skill) => skill.userInvocable && skill.argumentHint,
+ },
+ license: {
+ sourceKey: 'license',
+ yamlKey: 'license',
+ },
+ compatibility: {
+ sourceKey: 'compatibility',
+ yamlKey: 'compatibility',
+ },
+ metadata: {
+ sourceKey: 'metadata',
+ yamlKey: 'metadata',
+ },
+ 'allowed-tools': {
+ sourceKey: 'allowedTools',
+ yamlKey: 'allowed-tools',
+ },
+};
+
+/**
+ * Create a transformer function for a given provider config.
+ *
+ * @param {Object} config - Provider configuration from providers.js
+ * @returns {Function} transform(skills, distDir, options?)
+ */
+export function createTransformer(config) {
+ const { provider, configDir, displayName, frontmatterFields = [], bodyTransform } = config;
+
+ const activeFields = frontmatterFields
+ .map((name) => FIELD_SPECS[name])
+ .filter(Boolean);
+
+ return function transform(skills, distDir, options = {}) {
+ const { prefix = '', outputSuffix = '' } = options;
+ const providerDir = path.join(distDir, `${provider}${outputSuffix}`);
+ const skillsDir = path.join(providerDir, `${configDir}/skills`);
+
+ cleanDir(providerDir);
+ ensureDir(skillsDir);
+
+ const allSkillNames = skills.map((s) => s.name);
+ const commandNames = skills
+ .filter((s) => s.userInvocable)
+ .map((s) => `${prefix}${s.name}`);
+
+ let refCount = 0;
+
+ for (const skill of skills) {
+ const skillName = `${prefix}${skill.name}`;
+ const skillDir = path.join(skillsDir, skillName);
+
+ // Build frontmatter
+ const frontmatterObj = {
+ name: skillName,
+ description: skill.description,
+ };
+
+ for (const spec of activeFields) {
+ if (spec.condition && !spec.condition(skill)) continue;
+ const val = spec.value ? spec.value(skill) : skill[spec.sourceKey];
+ if (val) frontmatterObj[spec.yamlKey] = val;
+ }
+
+ const frontmatter = generateYamlFrontmatter(frontmatterObj);
+
+ // Build body
- let skillBody = replacePlaceholders(skill.body, provider, commandNames);
- if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames);
++ const cmdPrefix = (PROVIDER_PLACEHOLDERS[provider] || {}).command_prefix || '/';
++ let skillBody = replacePlaceholders(skill.body, provider, commandNames, allSkillNames);
++ if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames, cmdPrefix);
+ if (bodyTransform) skillBody = bodyTransform(skillBody, skill);
+
+ const content = `${frontmatter}\n\n${skillBody}`;
+ writeFile(path.join(skillDir, 'SKILL.md'), content);
+
+ // Copy reference files
+ if (skill.references && skill.references.length > 0) {
+ const refDir = path.join(skillDir, 'reference');
+ ensureDir(refDir);
+ for (const ref of skill.references) {
- const refContent = replacePlaceholders(ref.content, provider);
++ const refContent = replacePlaceholders(ref.content, provider, [], allSkillNames);
+ writeFile(path.join(refDir, `${ref.name}.md`), refContent);
+ refCount++;
+ }
+ }
+ }
+
+ const userInvocableCount = skills.filter((s) => s.userInvocable).length;
+ const refInfo = refCount > 0 ? ` (${refCount} reference files)` : '';
+ const prefixInfo = prefix ? ` [${prefix}prefixed]` : '';
+ console.log(`✓ ${displayName}${prefixInfo}: ${skills.length} skills (${userInvocableCount} user-invocable)${refInfo}`);
+ };
+}