Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/agent/clis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
return

// Parse individual tool names and hints from "[Read: path]" or "[Read, Glob: path1, path2]"
const match = chunk.match(/^\[([^:[\]]+)(?::\s(.+))?\]$/)

Check warning on line 88 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 88 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
if (!match)
return

Expand All @@ -99,7 +99,7 @@
const prefix = section ? `\x1B[90m[${section}]\x1B[0m ` : ''

if ((rawName === 'Bash' || rawName === 'run_shell_command') && hint) {
const searchMatch = hint.match(/skilld search\s+"([^"]+)"/)

Check warning on line 102 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 102 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
if (searchMatch) {
emit(`${prefix}Searching \x1B[36m"${searchMatch[1]}"\x1B[0m`)
}
Expand Down Expand Up @@ -280,7 +280,7 @@

/** Strip absolute paths from prompt so the hash is project-independent */
function normalizePromptForHash(prompt: string): string {
return prompt.replace(/\/[^\s`]*\.(?:claude|codex|gemini)\/skills\/[^\s/`]+/g, '<SKILL_DIR>')

Check warning on line 283 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 283 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
}

function hashPrompt(prompt: string, model: OptimizeModel, section: SkillSection): string {
Expand Down Expand Up @@ -337,7 +337,7 @@
// Debug logging
if (debug) {
const logsDir = join(skilldDir, 'logs')
const logName = section.toUpperCase().replace(/-/g, '_')

Check warning on line 340 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 340 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
mkdirSync(logsDir, { recursive: true })
if (raw)
writeFileSync(join(logsDir, `${logName}.md`), raw)
Expand Down Expand Up @@ -511,7 +511,7 @@

// Always write stderr on failure; write all logs in debug mode
const logsDir = join(skilldDir, 'logs')
const logName = section.toUpperCase().replace(/-/g, '_')

Check warning on line 514 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 514 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
if (debug || (stderr && (!raw || code !== 0))) {
mkdirSync(logsDir, { recursive: true })
if (stderr)
Expand Down Expand Up @@ -561,7 +561,7 @@
// ── Main orchestrator ────────────────────────────────────────────────

export async function optimizeDocs(opts: OptimizeDocsOptions): Promise<OptimizeResult> {
const { packageName, skillDir, model = 'sonnet', version, hasGithub, hasReleases, hasChangelog, docFiles, docsType, hasShippedDocs, onProgress, timeout = 180000, debug, noCache, sections, customPrompt, features, pkgFiles } = opts
const { packageName, skillDir, model = 'sonnet', version, hasGithub, hasReleases, hasChangelog, docFiles, docsType, hasShippedDocs, onProgress, timeout = 180000, debug, noCache, sections, customPrompt, features, pkgFiles, overheadLines } = opts

const selectedSections = sections ?? ['api-changes', 'best-practices'] as SkillSection[]

Expand All @@ -580,6 +580,7 @@
customPrompt,
features,
pkgFiles,
overheadLines,
sections: selectedSections,
})

Expand Down Expand Up @@ -781,7 +782,7 @@

/** Replace absolute paths in a command string with shortened versions */
function shortenCommand(cmd: string): string {
return cmd.replace(/\/[^\s"']+/g, (match) => {

Check warning on line 785 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 785 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
// Only shorten paths that look like they're inside a project
if (match.includes('.claude/') || match.includes('.skilld/') || match.includes('node_modules/'))
return `.../${match.split('/').slice(-2).join('/')}`
Expand All @@ -795,12 +796,12 @@

// Strip wrapping fences if output is wrapped in ```markdown, ```md, or bare ```
// Requires matched open+close pair to avoid stripping internal code blocks
const wrapMatch = cleaned.match(/^```(?:markdown|md)?[^\S\n]*\n([\s\S]+)\n```[^\S\n]*$/)

Check warning on line 799 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 799 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
if (wrapMatch) {
const inner = wrapMatch[1]!.trim()
// For bare ``` wrappers (no markdown/md tag), verify inner looks like section output
const isExplicitWrapper = /^```(?:markdown|md)/.test(cleaned)

Check warning on line 803 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 803 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
if (isExplicitWrapper || /^##\s/m.test(inner) || /^- (?:BREAKING|DEPRECATED|NEW): /m.test(inner)) {

Check warning on line 804 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call

Check warning on line 804 in src/agent/clis/index.ts

View workflow job for this annotation

GitHub Actions / test

Move this regular expression to module scope to avoid re-compilation on every call
cleaned = inner
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/agent/clis/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export interface OptimizeDocsOptions {
features?: FeaturesConfig
/** Key files from the package (e.g., dist/pkg.d.ts) */
pkgFiles?: string[]
/** Lines consumed by SKILL.md overhead (frontmatter + header + search + footer) */
overheadLines?: number
}

export interface OptimizeResult {
Expand Down
6 changes: 3 additions & 3 deletions src/agent/prompts/optional/api-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolveSkilldCommand } from '../../../core/shared.ts'
import { maxItems, maxLines, releaseBoost } from './budget.ts'
import { checkAbsolutePaths, checkLineCount, checkSourceCoverage, checkSourcePaths, checkSparseness } from './validate.ts'

export function apiChangesSection({ packageName, version, hasReleases, hasChangelog, hasDocs, hasIssues, hasDiscussions, pkgFiles, features, enabledSectionCount, releaseCount }: SectionContext): PromptSection {
export function apiChangesSection({ packageName, version, hasReleases, hasChangelog, hasDocs, hasIssues, hasDiscussions, pkgFiles, features, enabledSectionCount, releaseCount, overheadLines }: SectionContext): PromptSection {
const [, major, minor] = version?.match(/^(\d+)\.(\d+)/) ?? []
const boost = releaseBoost(releaseCount, minor ? Number(minor) : undefined)

Expand Down Expand Up @@ -69,7 +69,7 @@ export function apiChangesSection({ packageName, version, hasReleases, hasChange
The "Older" column means ≀ v${Number(major) - 2}.x β€” these changes are NOT useful because anyone on v${major}.x already migrated past them.`
: ''

const apiChangesMaxLines = maxLines(50, Math.round(80 * boost), enabledSectionCount)
const apiChangesMaxLines = maxLines(60, Math.round(130 * boost), enabledSectionCount, overheadLines)

return {
referenceWeights,
Expand Down Expand Up @@ -123,7 +123,7 @@ Each item: BREAKING/DEPRECATED/NEW label + API name + what changed + source link
**Tiered format:** Top-scoring items get full detailed entries. Remaining relevant items go in a compact "**Also changed:**" line at the end β€” API name + brief label, separated by \` Β· \`. This surfaces more changes without bloating the section.`,

rules: [
`- **API Changes:** ${maxItems(6, Math.round(12 * boost), enabledSectionCount)} detailed items + compact "Also changed" line for remaining, MAX ${apiChangesMaxLines} lines`,
`- **API Changes:** ${maxItems(8, Math.round(18 * boost), enabledSectionCount)} detailed items + compact "Also changed" line for remaining, MAX ${apiChangesMaxLines} lines`,
'- **Every detailed item MUST have a `[source](./.skilld/...#section)` link** with a section anchor (`#heading-slug`) or line reference (`:L<line>` or `:L<start>:<end>`). If you cannot cite a specific location in a release, changelog entry, or migration doc, do NOT include the item',
'- **Recency:** Only include changes from the current major version and the previous→current migration. Exclude changes from older major versions entirely — users already migrated past them',
'- Focus on APIs that CHANGED, not general conventions or gotchas',
Expand Down
6 changes: 3 additions & 3 deletions src/agent/prompts/optional/best-practices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolveSkilldCommand } from '../../../core/shared.ts'
import { maxItems, maxLines, releaseBoost } from './budget.ts'
import { checkAbsolutePaths, checkLineCount, checkSourceCoverage, checkSourcePaths, checkSparseness } from './validate.ts'

export function bestPracticesSection({ packageName, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles, features, enabledSectionCount, releaseCount, version }: SectionContext): PromptSection {
export function bestPracticesSection({ packageName, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles, features, enabledSectionCount, releaseCount, version, overheadLines }: SectionContext): PromptSection {
const [,, minor] = version?.match(/^(\d+)\.(\d+)/) ?? []
// Dampened boost β€” best practices are less directly tied to releases than API changes
const rawBoost = releaseBoost(releaseCount, minor ? Number(minor) : undefined)
Expand Down Expand Up @@ -35,7 +35,7 @@ export function bestPracticesSection({ packageName, hasIssues, hasDiscussions, h
referenceWeights.push({ name: 'Changelog', path: `./.skilld/${hasChangelog}`, score: 3, useFor: 'Only for new patterns introduced in recent versions' })
}

const bpMaxLines = maxLines(80, Math.round(150 * boost), enabledSectionCount)
const bpMaxLines = maxLines(100, Math.round(250 * boost), enabledSectionCount, overheadLines)

return {
referenceWeights,
Expand Down Expand Up @@ -86,7 +86,7 @@ const client = createX({ retryDelay: attempt => Math.min(1000 * 2 ** attempt, 30
Each item: markdown list item (-) + ${packageName}-specific pattern + why it's preferred + \`[source](./.skilld/...#section)\` link. **Prefer concise descriptions over inline code** β€” the source link points the agent to full examples in the docs. Only add a code block when the pattern genuinely cannot be understood from the description alone (e.g., non-obvious syntax, multi-step wiring). Most items should be description + source link only. All source links MUST use \`./.skilld/\` prefix and include a **section anchor** (\`#heading-slug\`) or **line reference** (\`:L<line>\` or \`:L<start>:<end>\`) to pinpoint the exact location. Do NOT use emoji β€” use plain text markers only.`,

rules: [
`- **${maxItems(4, Math.round(10 * boost), enabledSectionCount)} best practice items**`,
`- **${maxItems(6, Math.round(15 * boost), enabledSectionCount)} best practice items**`,
`- **MAX ${bpMaxLines} lines** for best practices section`,
'- **Every item MUST have a `[source](./.skilld/...#section)` link** with a section anchor (`#heading-slug`) or line reference (`:L<line>` or `:L<start>:<end>`). If you cannot cite a specific location in a reference file, do NOT include the item β€” unsourced items risk hallucination and will be rejected',
'- **Minimize inline code.** Most items should be description + source link only. The source file contains full examples the agent can read. Only add a code block when the pattern is unintuitable from the description (non-obvious syntax, surprising argument order, multi-step wiring). Aim for at most 1 in 4 items having a code block',
Expand Down
23 changes: 17 additions & 6 deletions src/agent/prompts/optional/budget.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
/**
* Dynamic budget allocation for skill sections.
*
* Total SKILL.md body should stay under ~300 lines (β‰ˆ5,000 words per Agent Skills guide).
* When more sections are enabled, each gets proportionally less space.
* When a package has many releases, API changes budget scales up to capture more churn.
* Total SKILL.md target is ~500 lines. Overhead (frontmatter, header, search, footer)
* is subtracted to get the available body budget, which is divided among enabled sections.
* When a package has many releases, budgets scale up.
*/

/** Scale max lines based on enabled section count. Solo sections get full budget, 4 sections ~60%. */
export function maxLines(min: number, max: number, sectionCount?: number): number {
const TOTAL_TARGET = 500
const DEFAULT_OVERHEAD = 30

/** Available body lines after overhead is subtracted */
function remainingLines(overheadLines?: number): number {
return TOTAL_TARGET - (overheadLines ?? DEFAULT_OVERHEAD)
}

/** Scale max lines based on enabled section count and available remaining space. */
export function maxLines(min: number, max: number, sectionCount?: number, overheadLines?: number): number {
const remaining = remainingLines(overheadLines)
const sections = Math.max(1, sectionCount ?? 1)
const perSection = Math.floor(remaining / sections)
const scale = budgetScale(sectionCount)
return Math.max(min, Math.round(max * scale))
return Math.max(min, Math.min(Math.round(max * scale), perSection))
}

/** Scale item count based on enabled section count. */
Expand Down
4 changes: 2 additions & 2 deletions src/agent/prompts/optional/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { CustomPrompt, PromptSection, SectionValidationWarning } from './ty
import { maxLines } from './budget.ts'
import { checkAbsolutePaths, checkLineCount, checkSourceCoverage, checkSourcePaths, checkSparseness } from './validate.ts'

export function customSection({ heading, body }: CustomPrompt, enabledSectionCount?: number): PromptSection {
const customMaxLines = maxLines(50, 80, enabledSectionCount)
export function customSection({ heading, body }: CustomPrompt, enabledSectionCount?: number, overheadLines?: number): PromptSection {
const customMaxLines = maxLines(50, 80, enabledSectionCount, overheadLines)

return {
validate(content: string): SectionValidationWarning[] {
Expand Down
2 changes: 2 additions & 0 deletions src/agent/prompts/optional/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export interface SectionContext {
enabledSectionCount?: number
/** Number of release files β€” used for adaptive API changes budget */
releaseCount?: number
/** Lines consumed by frontmatter + header + search + footer */
overheadLines?: number
}

export interface CustomPrompt {
Expand Down
6 changes: 4 additions & 2 deletions src/agent/prompts/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export interface BuildSkillPromptOptions {
enabledSectionCount?: number
/** Key files from the package (e.g., dist/pkg.d.ts) β€” surfaced in prompt for tool hints */
pkgFiles?: string[]
/** Lines consumed by SKILL.md overhead (frontmatter + header + search + footer) */
overheadLines?: number
}

/**
Expand Down Expand Up @@ -171,7 +173,7 @@ function getSectionDef(section: SkillSection, ctx: SectionContext, customPrompt?
switch (section) {
case 'api-changes': return apiChangesSection(ctx)
case 'best-practices': return bestPracticesSection(ctx)
case 'custom': return customPrompt ? customSection(customPrompt, ctx.enabledSectionCount) : null
case 'custom': return customPrompt ? customSection(customPrompt, ctx.enabledSectionCount, ctx.overheadLines) : null
}
}

Expand Down Expand Up @@ -204,7 +206,7 @@ export function buildSectionPrompt(opts: BuildSkillPromptOptions & { section: Sk
const m = f.match(/v\d+\.(\d+)\.(\d+)\.md$/)
return m && (m[1] === '0' || m[2] === '0') // major (x.0.y) or minor (x.y.0)
}).length
const ctx: SectionContext = { packageName, version, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles: opts.pkgFiles, features: opts.features, enabledSectionCount: opts.enabledSectionCount, releaseCount }
const ctx: SectionContext = { packageName, version, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles: opts.pkgFiles, features: opts.features, enabledSectionCount: opts.enabledSectionCount, releaseCount, overheadLines: opts.overheadLines }
const sectionDef = getSectionDef(section, ctx, customPrompt)
if (!sectionDef)
return ''
Expand Down
13 changes: 3 additions & 10 deletions src/agent/prompts/skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export interface SkillOptions {
name: string
version?: string
releasedAt?: string
/** Production dependencies with version specifiers */
dependencies?: Record<string, string>
/** npm dist-tags with version and release date */
distTags?: Record<string, { version: string, releasedAt?: string }>
globs?: string[]
Expand Down Expand Up @@ -70,7 +68,7 @@ function formatShortDate(isoDate: string): string {
return `${months[date.getUTCMonth()]} ${date.getUTCFullYear()}`
}

function generatePackageHeader({ name, description, version, releasedAt, dependencies, distTags, repoUrl, hasIssues, hasDiscussions, hasReleases, docsType, pkgFiles, packages, eject }: SkillOptions): string {
function generatePackageHeader({ name, description, version, releasedAt, distTags, repoUrl, hasIssues, hasDiscussions, hasReleases, docsType, pkgFiles, packages, eject }: SkillOptions): string {
let title = `# ${name}`
if (repoUrl) {
const url = repoUrl.startsWith('http') ? repoUrl : `https://github.com/${repoUrl}`
Expand All @@ -89,15 +87,10 @@ function generatePackageHeader({ name, description, version, releasedAt, depende
lines.push('', `**Version:** ${versionStr}`)
}

if (dependencies && Object.keys(dependencies).length > 0) {
const deps = Object.entries(dependencies)
.map(([n, v]) => `${n}@${v}`)
.join(', ')
lines.push(`**Deps:** ${deps}`)
}

if (distTags && Object.keys(distTags).length > 0) {
const tags = Object.entries(distTags)
.sort(([, a], [, b]) => (b.releasedAt ?? '').localeCompare(a.releasedAt ?? ''))
.slice(0, 3)
.map(([tag, info]) => {
const relDate = info.releasedAt ? ` (${formatShortDate(info.releasedAt)})` : ''
return `${tag}: ${info.version}${relDate}`
Expand Down
6 changes: 0 additions & 6 deletions src/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,11 @@ async function enhanceRegenerated(
const cwd = process.cwd()
const pkgPath = resolvePkgDir(pkgName, cwd, version)
let description: string | undefined
let dependencies: Record<string, string> | undefined
if (pkgPath) {
const pkgJsonPath = join(pkgPath, 'package.json')
if (existsSync(pkgJsonPath)) {
const pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'))
description = pkg.description
dependencies = pkg.dependencies
}
}

Expand All @@ -600,7 +598,6 @@ async function enhanceRegenerated(
name: pkgName,
version,
description,
dependencies,
body: optimized,
relatedSkills: [],
hasIssues,
Expand Down Expand Up @@ -659,13 +656,11 @@ function regenerateBaseSkillMd(
// Read description + deps from local package.json
const pkgPath = resolvePkgDir(pkgName, cwd, version)
let description: string | undefined
let dependencies: Record<string, string> | undefined
if (pkgPath) {
const pkgJsonPath = join(pkgPath, 'package.json')
if (existsSync(pkgJsonPath)) {
const pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'))
description = pkg.description
dependencies = pkg.dependencies
}
}

Expand Down Expand Up @@ -696,7 +691,6 @@ function regenerateBaseSkillMd(
name: pkgName,
version,
description,
dependencies,
relatedSkills,
hasIssues,
hasDiscussions,
Expand Down
11 changes: 8 additions & 3 deletions src/commands/sync-parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ interface BaseSkillData {
/** Whether the existing SKILL.md had LLM-generated content */
wasEnhanced?: boolean
usedCache: boolean
/** Lines consumed by SKILL.md overhead */
overheadLines?: number
}

export async function syncPackagesParallel(config: ParallelSyncConfig): Promise<void> {
Expand Down Expand Up @@ -260,7 +262,7 @@ export async function syncPackagesParallel(config: ParallelSyncConfig): Promise<
name: resolvedName,
version: data.version,
releasedAt: data.resolved.releasedAt,
dependencies: data.resolved.dependencies,

distTags: data.resolved.distTags,
body: cachedBody,
relatedSkills: data.relatedSkills,
Expand Down Expand Up @@ -350,6 +352,7 @@ export async function syncPackagesParallel(config: ParallelSyncConfig): Promise<
sections: llmConfig.sections,
customPrompt: llmConfig.customPrompt,
features: data.features,
overheadLines: data.overheadLines,
})
}
}
Expand Down Expand Up @@ -567,7 +570,7 @@ async function syncBaseSkill(
version,
releasedAt: resolved.releasedAt,
description: resolved.description,
dependencies: resolved.dependencies,

distTags: resolved.distTags,
relatedSkills,
hasIssues: resources.hasIssues,
Expand All @@ -583,6 +586,7 @@ async function syncBaseSkill(
features,
})
writeFileSync(join(skillDir, 'SKILL.md'), skillMd)
const overheadLines = skillMd.split('\n').length

// Link shared dir to per-agent dirs
const shared = !config.global && getSharedSkillsDir(cwd)
Expand Down Expand Up @@ -614,6 +618,7 @@ async function syncBaseSkill(
oldVersion: preLock?.version,
oldSyncedAt: preLock?.syncedAt,
wasEnhanced: preEnhanced,
overheadLines,
}
}

Expand Down Expand Up @@ -652,6 +657,7 @@ async function enhanceWithLLM(
customPrompt,
features: data.features,
pkgFiles: data.pkgFiles,
overheadLines: data.overheadLines,
onProgress: (progress) => {
const isReasoning = progress.type === 'reasoning'
const status = isReasoning ? 'exploring' : 'generating'
Expand All @@ -671,7 +677,6 @@ async function enhanceWithLLM(
name: packageName,
version: data.version,
releasedAt: data.resolved.releasedAt,
dependencies: data.resolved.dependencies,
distTags: data.resolved.distTags,
body: optimized,
relatedSkills: data.relatedSkills,
Expand Down
8 changes: 6 additions & 2 deletions src/commands/sync-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1376,10 +1376,11 @@ export interface EnhanceOptions {
packages?: Array<{ name: string }>
features?: FeaturesConfig
eject?: boolean
overheadLines?: number
}

export async function enhanceSkillWithLLM(opts: EnhanceOptions): Promise<void> {
const { packageName, version, skillDir, dirName, model, resolved, relatedSkills, hasIssues, hasDiscussions, hasReleases, hasChangelog, docsType, hasShippedDocs: shippedDocs, pkgFiles, force, debug, sections, customPrompt, packages, features, eject } = opts
const { packageName, version, skillDir, dirName, model, resolved, relatedSkills, hasIssues, hasDiscussions, hasReleases, hasChangelog, docsType, hasShippedDocs: shippedDocs, pkgFiles, force, debug, sections, customPrompt, packages, features, eject, overheadLines } = opts

const effectiveFeatures = features

Expand All @@ -1403,6 +1404,7 @@ export async function enhanceSkillWithLLM(opts: EnhanceOptions): Promise<void> {
customPrompt,
features: effectiveFeatures,
pkgFiles,
overheadLines,
onProgress: createToolProgress(llmLog),
})

Expand All @@ -1428,7 +1430,7 @@ export async function enhanceSkillWithLLM(opts: EnhanceOptions): Promise<void> {
name: packageName,
version,
releasedAt: resolved.releasedAt,
dependencies: resolved.dependencies,

distTags: resolved.distTags,
body: optimized,
relatedSkills,
Expand Down Expand Up @@ -1467,6 +1469,7 @@ export interface WritePromptFilesOptions {
sections: SkillSection[]
customPrompt?: CustomPrompt
features?: FeaturesConfig
overheadLines?: number
}

/**
Expand All @@ -1490,6 +1493,7 @@ export function writePromptFiles(opts: WritePromptFilesOptions): SkillSection[]
pkgFiles: opts.pkgFiles,
customPrompt,
features,
overheadLines: opts.overheadLines,
sections,
})

Expand Down
Loading
Loading