mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Fixes #67: argument-hint values starting with [ were parsed as YAML flow sequences. Replace structured args arrays in source files with pre-formatted argument-hint strings, and quote values starting with [ or { in generateYamlFrontmatter(). Also consolidates 8 nearly-identical transformer files into a single config-driven createTransformer() factory. Adding a new provider now requires only a config object in providers.js instead of a full file. - Replace args source frontmatter with argument-hint strings - Add YAML quoting for values starting with [ or { - Add quote stripping to parseFrontmatter() for round-trip support - Create factory.js + providers.js, delete 8 individual transformers - Replace 16 explicit build.js calls with a loop over PROVIDERS - Consolidate 8 test files into 2 (factory + providers) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
73 lines
2.1 KiB
JavaScript
73 lines
2.1 KiB
JavaScript
/**
|
|
* Provider configurations for the transformer factory.
|
|
*
|
|
* Each config specifies:
|
|
* - provider: key into PROVIDER_PLACEHOLDERS (e.g. 'claude-code')
|
|
* - configDir: dot-directory name (e.g. '.claude')
|
|
* - displayName: human-readable name for log output (e.g. 'Claude Code')
|
|
* - frontmatterFields: which optional fields to emit beyond name + description
|
|
* - bodyTransform: optional function (body, skill) => transformed body
|
|
*/
|
|
export const PROVIDERS = {
|
|
cursor: {
|
|
provider: 'cursor',
|
|
configDir: '.cursor',
|
|
displayName: 'Cursor',
|
|
frontmatterFields: ['license'],
|
|
},
|
|
'claude-code': {
|
|
provider: 'claude-code',
|
|
configDir: '.claude',
|
|
displayName: 'Claude Code',
|
|
frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata', 'allowed-tools'],
|
|
},
|
|
gemini: {
|
|
provider: 'gemini',
|
|
configDir: '.gemini',
|
|
displayName: 'Gemini',
|
|
frontmatterFields: [],
|
|
bodyTransform: (body, skill) => {
|
|
if (skill.userInvocable) {
|
|
return body.replace(/\{\{[^}]+\}\}/g, '{{args}}');
|
|
}
|
|
return body;
|
|
},
|
|
},
|
|
codex: {
|
|
provider: 'codex',
|
|
configDir: '.codex',
|
|
displayName: 'Codex',
|
|
frontmatterFields: ['argument-hint', 'license'],
|
|
bodyTransform: (body, skill) => {
|
|
if (skill.userInvocable) {
|
|
return body.replace(/\{\{([^}]+)\}\}/g, (_, argName) => `$${argName.toUpperCase()}`);
|
|
}
|
|
return body;
|
|
},
|
|
},
|
|
agents: {
|
|
provider: 'agents',
|
|
configDir: '.agents',
|
|
displayName: 'Agents',
|
|
frontmatterFields: ['user-invocable', 'argument-hint'],
|
|
},
|
|
kiro: {
|
|
provider: 'kiro',
|
|
configDir: '.kiro',
|
|
displayName: 'Kiro',
|
|
frontmatterFields: ['license', 'compatibility', 'metadata'],
|
|
},
|
|
opencode: {
|
|
provider: 'opencode',
|
|
configDir: '.opencode',
|
|
displayName: 'OpenCode',
|
|
frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata', 'allowed-tools'],
|
|
},
|
|
pi: {
|
|
provider: 'pi',
|
|
configDir: '.pi',
|
|
displayName: 'Pi',
|
|
frontmatterFields: ['license', 'compatibility', 'metadata'],
|
|
},
|
|
};
|