Repository navigation
refactor(runtime): split skills.ts along discovery/metadata/context/state seams - #1428
Merged
Merged
Conversation
Astro-Han
reviewed
Jul 24, 2026
Astro-Han
left a comment
Contributor
There was a problem hiding this comment.
The file split matches the responsibilities present at the merge base, but the branch is stale and cannot be merged as-is.
[P2] This branch conflicts with current main in packages/runtime/src/index.ts, packages/runtime/src/skill-invocation.ts, and packages/runtime/src/skills.ts. Since the branch point, main has added skill discovery diagnostics and invocation receipts that are missing here.
Rebase first, then apply the split to the current implementations. Do not resolve these conflicts by choosing one side wholesale. Afterward, verify the runtime skill tests, package exports, and workspace typecheck.
…tate seams Split the 1921-line skills.ts into focused sub-modules, keeping all public exports stable through a re-export barrel and index.ts updates: - skills-discovery.ts: resolveSkillDiscoveryPaths, normalizeSkillSource, scanSkills* family, scanSkillDir, ScannedSkill/RuntimeSkillDefinition types - skills-metadata.ts: validateSkillMetadata, parseSkillFrontMatter, manifest-parsing family, SkillManifest/validation types, cleanPromptText - skills-context.ts: gateSkillsByHostCapabilities, selectSkillsForContext, searchSkills + scoring, prompt rendering, loadSkillInstructions - skills-state.ts: readSkillRuntimeState, writeSkillRuntimeState/Preferences - skills-agent-tools.ts: buildSkillAgentTool, buildSkillSearchAgentTool, SkillShadowSelectionTracker - path-containment.ts: moved readContainedRegularFile, readContainedRegularTextFile, writeContainedRegularTextFile, isRecord (generic infrastructure already imported cross-package by desktop) skills.ts is now a thin re-export barrel so existing 'from ./skills.js' imports continue to work. Internal consumers (skill-invocation.ts, tool-catalog-derive.ts) updated to import from specific sub-modules. Closes apache#1408
sunheyi6
force-pushed
the
refactor/split-skills-ts-1408
branch
from
July 24, 2026 08:38
4196822 to
5bdc0cf
Compare
Contributor
|
LGTM now. Merging! |
Astro-Han
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1408
Part of #1084 (second-pass sink-file and boundary governance).
Summary
Split the 1921-line
packages/runtime/src/skills.tsinto focused sub-modules along the discovery/metadata/context/state seams visible today, keeping@maka/runtimeexports (20+ symbols viaindex.ts) stable through re-exports.Changes
skills-discovery.ts(438 lines)resolveSkillDiscoveryPaths,normalizeSkillSource,scanSkills*family,scanSkillDir,ScannedSkill/RuntimeSkillDefinitiontypesskills-metadata.ts(500 lines)validateSkillMetadata,parseSkillFrontMatter, manifest-parsing family,SkillManifest/validation types,cleanPromptTextskills-context.ts(620 lines)gateSkillsByHostCapabilities,selectSkillsForContext,searchSkills+ scoring, prompt rendering,loadSkillInstructionsskills-state.ts(213 lines)readSkillRuntimeState,writeSkillRuntimeState/writeSkillRuntimePreferencesskills-agent-tools.ts(180 lines)buildSkillAgentTool,buildSkillSearchAgentTool,SkillShadowSelectionTrackerAdditionally, moved generic contained-file I/O helpers (
readContainedRegularFile,readContainedRegularTextFile,writeContainedRegularTextFile,isRecord) intopath-containment.ts— they are generic infrastructure already imported cross-package byapps/desktop/src/main/skills.ts.skills.tsis now a thin re-export barrel (116 lines) so existingfrom './skills.js'imports continue to work without changes. Internal consumers (skill-invocation.ts,tool-catalog-derive.ts) updated to import from specific sub-modules directly.Invariants
@maka/runtimeexports preserved via re-exportspath-containment ← skills-metadata ← skills-state ← skills-discovery ← skills-context ← skills-agent-toolsVerification
tsc --noEmitonpackages/runtime/tsconfig.json— no errorstsc --noEmitonapps/desktop/tsconfig.main.json— no errorsskills.test.ts— 36/36 passskill-invocation.test.ts— 11/11 passtool-runtime-extraction-contract.test.ts— 8/8 pass