feat: register /strict:review and /strict:security-review commands
Add strictReview.ts to register strict review variants as bundled skills with context:'fork' (sub-agent mode), using SKILL_FILES and CommandLocale. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
5ecc8277b8
commit
6c909321ed
63
src/costrict/skills/strictReview.ts
Normal file
63
src/costrict/skills/strictReview.ts
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import { registerBundledSkill } from 'src/skills/bundledSkills.js'
|
||||
import { getResolvedLanguage } from 'src/utils/language.js'
|
||||
import { CommandLocale } from 'src/costrict/command/locales/index.js'
|
||||
import {
|
||||
SKILL_FILES,
|
||||
SKILL_METADATA,
|
||||
} from 'src/costrict/review/skill/builtin.js'
|
||||
|
||||
const LOCALE_MAP: Record<string, string> = { zh: 'zh-CN', en: 'en' }
|
||||
|
||||
function getLocale(): string {
|
||||
const lang = getResolvedLanguage()
|
||||
return LOCALE_MAP[lang] ?? 'zh-CN'
|
||||
}
|
||||
|
||||
const ALLOWED_TOOLS = [
|
||||
'Skill',
|
||||
'Glob',
|
||||
'Grep',
|
||||
'Read',
|
||||
'TodoWrite',
|
||||
'Bash',
|
||||
'Agent',
|
||||
]
|
||||
|
||||
function registerStrictReviewSkill(
|
||||
name: string,
|
||||
skillKey: string,
|
||||
files: Record<string, string>,
|
||||
description: string,
|
||||
): void {
|
||||
registerBundledSkill({
|
||||
name,
|
||||
description,
|
||||
whenToUse: description,
|
||||
userInvocable: true,
|
||||
disableModelInvocation: true,
|
||||
allowedTools: ALLOWED_TOOLS,
|
||||
context: 'fork',
|
||||
files,
|
||||
async getPromptForCommand(args) {
|
||||
const template = CommandLocale.get(skillKey)
|
||||
const text = template
|
||||
? template.replace('$ARGUMENTS', args.trim())
|
||||
: args.trim() || `Please perform a ${skillKey}.`
|
||||
return [{ type: 'text', text }]
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function registerStrictReviewSkills(): void {
|
||||
const locale = getLocale()
|
||||
const localeFiles = SKILL_FILES[locale]
|
||||
const localeMetadata = SKILL_METADATA[locale]
|
||||
if (!localeFiles || !localeMetadata) return
|
||||
|
||||
for (const [skillKey, files] of Object.entries(localeFiles)) {
|
||||
const meta = localeMetadata[skillKey]
|
||||
if (!meta || !files) continue
|
||||
|
||||
registerStrictReviewSkill(`strict:${skillKey}`, skillKey, files, meta.description)
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import { registerUpdateConfigSkill } from './updateConfig.js'
|
|||
import { registerVerifySkill } from './verify.js'
|
||||
import { registerStrictPlanSkill } from 'src/costrict/skills/strictPlan.js'
|
||||
import { registerStrictSpecSkill } from 'src/costrict/skills/strictSpec.js'
|
||||
import { registerStrictReviewSkills } from 'src/costrict/skills/strictReview.js'
|
||||
import { registerProjectWikiSkill } from 'src/costrict/skills/projectWiki.js'
|
||||
import { registerTddSkill } from 'src/costrict/skills/tdd.js'
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ export function initBundledSkills(): void {
|
|||
registerTddSkill()
|
||||
registerStrictPlanSkill()
|
||||
registerStrictSpecSkill()
|
||||
registerStrictReviewSkills()
|
||||
registerKeybindingsSkill()
|
||||
registerVerifySkill()
|
||||
registerDebugSkill()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user