feat: add parameterized resolver support to gen-skill-docs

Extend the placeholder regex from {{WORD}} to {{WORD:arg1:arg2}},
enabling parameterized resolvers like {{INVOKE_SKILL:plan-ceo-review}}.

- Widen ResolverFn type to accept optional args?: string[]
- Update RESOLVERS record to use ResolverFn type
- Both replacement and unresolved-check regexes updated
- Fully backward compatible: existing {{WORD}} patterns unchanged

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-28 23:06:24 -07:00
parent ae0a9ad195
commit 69150dc0eb
3 changed files with 16 additions and 8 deletions
+4 -2
View File
@@ -3,7 +3,7 @@
* Each resolver takes a TemplateContext and returns the replacement string.
*/
import type { TemplateContext } from './types';
import type { TemplateContext, ResolverFn } from './types';
// Domain modules
import { generatePreamble } from './preamble';
@@ -15,8 +15,9 @@ import { generateReviewDashboard, generatePlanFileReviewReport, generateSpecRevi
import { generateSlugEval, generateSlugSetup, generateBaseBranchDetect, generateDeployBootstrap, generateQAMethodology, generateCoAuthorTrailer } from './utility';
import { generateLearningsSearch, generateLearningsLog } from './learnings';
import { generateConfidenceCalibration } from './confidence';
import { generateInvokeSkill } from './composition';
export const RESOLVERS: Record<string, (ctx: TemplateContext) => string> = {
export const RESOLVERS: Record<string, ResolverFn> = {
SLUG_EVAL: generateSlugEval,
SLUG_SETUP: generateSlugSetup,
COMMAND_REFERENCE: generateCommandReference,
@@ -53,4 +54,5 @@ export const RESOLVERS: Record<string, (ctx: TemplateContext) => string> = {
LEARNINGS_SEARCH: generateLearningsSearch,
LEARNINGS_LOG: generateLearningsLog,
CONFIDENCE_CALIBRATION: generateConfidenceCalibration,
INVOKE_SKILL: generateInvokeSkill,
};
+3
View File
@@ -40,3 +40,6 @@ export interface TemplateContext {
paths: HostPaths;
preambleTier?: number; // 1-4, controls which preamble sections are included
}
/** Resolver function signature. args is populated for parameterized placeholders like {{INVOKE_SKILL:name}}. */
export type ResolverFn = (ctx: TemplateContext, args?: string[]) => string;